@corrin/json-key-string-xlsx
Version:
Convert between json and xlsx files by key string in a browser or NodeJS.
7 lines • 494 kB
JavaScript
/*!
* json-key-string-xlsx v1.4.4
* (c) 2019-2024 [object Object]
* Released under the MIT License.
*/
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=Array(t);r<t;r++)a[r]=e[r];return a}function t(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,n(a.key),a)}}function r(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=i(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var a=0,n=function(){};return{s:n,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){c=!0,s=e},f:function(){try{o||null==r.return||r.return()}finally{if(c)throw s}}}}function a(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||i(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(t,r){if(t){if("string"==typeof t)return e(t,r);var a={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?e(t,r):void 0}}
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */var o,c={version:"0.20.2"},l=1200,f=1252,h=[874,932,936,949,950,1250,1251,1252,1253,1254,1255,1256,1257,1258,1e4],u={0:1252,1:65001,2:65001,77:1e4,128:932,129:949,130:1361,134:936,136:950,161:1253,162:1254,163:1258,177:1255,178:1256,186:1257,204:1251,222:874,238:1250,255:1252,69:6969},d=function(e){-1!=h.indexOf(e)&&(f=u[0]=e)};var p=function(e){l=e,d(e)};function m(){p(1200),d(1252)}function v(e){for(var t=[],r=0,a=e.length;r<a;++r)t[r]=e.charCodeAt(r);return t}function g(e){for(var t=[],r=0;r<e.length>>1;++r)t[r]=String.fromCharCode(e.charCodeAt(2*r)+(e.charCodeAt(2*r+1)<<8));return t.join("")}function b(e){for(var t=[],r=0;r<e.length>>1;++r)t[r]=String.fromCharCode(e.charCodeAt(2*r+1)+(e.charCodeAt(2*r)<<8));return t.join("")}var w=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1);return 255==t&&254==r?g(e.slice(2)):254==t&&255==r?b(e.slice(2)):65279==t?e.slice(1):e},T=function(e){return String.fromCharCode(e)},y=function(e){return String.fromCharCode(e)};function k(e){o=e,p=function(e){l=e,d(e)},w=function(e){return 255===e.charCodeAt(0)&&254===e.charCodeAt(1)?o.utils.decode(1200,v(e.slice(2))):e},T=function(e){return 1200===l?String.fromCharCode(e):o.utils.decode(l,[255&e,e>>8])[0]},y=function(e){return o.utils.decode(f,[e])[0]},qr()}var E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function _(e){for(var t="",r=0,a=0,n=0,s=0,i=0,o=0,c=0,l=0;l<e.length;)s=(r=e.charCodeAt(l++))>>2,i=(3&r)<<4|(a=e.charCodeAt(l++))>>4,o=(15&a)<<2|(n=e.charCodeAt(l++))>>6,c=63&n,isNaN(a)?o=c=64:isNaN(n)&&(c=64),t+=E.charAt(s)+E.charAt(i)+E.charAt(o)+E.charAt(c);return t}function S(e){var t="",r=0,a=0,n=0,s=0,i=0,o=0;"data:"==e.slice(0,5)&&((c=e.slice(0,1024).indexOf(";base64,"))>-1&&(e=e.slice(c+8)));e=e.replace(/[^\w\+\/\=]/g,"");for(var c=0;c<e.length;)r=E.indexOf(e.charAt(c++))<<2|(s=E.indexOf(e.charAt(c++)))>>4,t+=String.fromCharCode(r),a=(15&s)<<4|(i=E.indexOf(e.charAt(c++)))>>2,64!==i&&(t+=String.fromCharCode(a)),n=(3&i)<<6|(o=E.indexOf(e.charAt(c++))),64!==o&&(t+=String.fromCharCode(n));return t}var x=function(){return"undefined"!=typeof Buffer&&"undefined"!=typeof process&&void 0!==process.versions&&!!process.versions.node}(),A=function(){if("undefined"!=typeof Buffer){var e=!Buffer.from;if(!e)try{Buffer.from("foo","utf8")}catch(t){e=!0}return e?function(e,t){return t?new Buffer(e,t):new Buffer(e)}:Buffer.from.bind(Buffer)}return function(){}}(),C=function(){if("undefined"==typeof Buffer)return!1;var e=A([65,0]);return!!e&&1==e.toString("utf16le").length}();function I(e){return x?Buffer.alloc?Buffer.alloc(e):new Buffer(e):"undefined"!=typeof Uint8Array?new Uint8Array(e):new Array(e)}function O(e){return x?Buffer.allocUnsafe?Buffer.allocUnsafe(e):new Buffer(e):"undefined"!=typeof Uint8Array?new Uint8Array(e):new Array(e)}var R=function(e){return x?A(e,"binary"):e.split("").map((function(e){return 255&e.charCodeAt(0)}))};function N(e){if("undefined"==typeof ArrayBuffer)return R(e);for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),a=0;a!=e.length;++a)r[a]=255&e.charCodeAt(a);return t}function F(e){if(Array.isArray(e))return e.map((function(e){return String.fromCharCode(e)})).join("");for(var t=[],r=0;r<e.length;++r)t[r]=String.fromCharCode(e[r]);return t.join("")}function D(e){if("undefined"==typeof ArrayBuffer)throw new Error("Unsupported");if(e instanceof ArrayBuffer)return D(new Uint8Array(e));for(var t=new Array(e.length),r=0;r<e.length;++r)t[r]=e[r];return t}var P=x?function(e){return Buffer.concat(e.map((function(e){return Buffer.isBuffer(e)?e:A(e)})))}:function(e){if("undefined"!=typeof Uint8Array){var t=0,r=0;for(t=0;t<e.length;++t)r+=e[t].length;var a=new Uint8Array(r),n=0;for(t=0,r=0;t<e.length;r+=n,++t)n=e[t].length,e[t]instanceof Uint8Array?a.set(e[t],r):"string"==typeof e[t]?a.set(new Uint8Array(R(e[t])),r):a.set(new Uint8Array(e[t]),r);return a}return[].concat.apply([],e.map((function(e){return Array.isArray(e)?e:[].slice.call(e)})))};var M=/\u0000/g,L=/[\u0001-\u0006]/g;function U(e){for(var t="",r=e.length-1;r>=0;)t+=e.charAt(r--);return t}function B(e,t){var r=""+e;return r.length>=t?r:Je("0",t-r.length)+r}function W(e,t){var r=""+e;return r.length>=t?r:Je(" ",t-r.length)+r}function z(e,t){var r=""+e;return r.length>=t?r:r+Je(" ",t-r.length)}var H=Math.pow(2,32);function V(e,t){return e>H||e<-H?function(e,t){var r=""+Math.round(e);return r.length>=t?r:Je("0",t-r.length)+r}(e,t):function(e,t){var r=""+e;return r.length>=t?r:Je("0",t-r.length)+r}(Math.round(e),t)}function j(e,t){return t=t||0,e.length>=7+t&&103==(32|e.charCodeAt(t))&&101==(32|e.charCodeAt(t+1))&&110==(32|e.charCodeAt(t+2))&&101==(32|e.charCodeAt(t+3))&&114==(32|e.charCodeAt(t+4))&&97==(32|e.charCodeAt(t+5))&&108==(32|e.charCodeAt(t+6))}var X=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],G=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]];var K={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"m/d/yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@",56:'"\u4e0a\u5348/\u4e0b\u5348 "hh"\u6642"mm"\u5206"ss"\u79d2 "'},Y={5:37,6:38,7:39,8:40,23:0,24:0,25:0,26:0,27:14,28:14,29:14,30:14,31:14,50:14,51:14,52:14,53:14,54:14,55:14,56:14,57:14,58:14,59:1,60:2,61:3,62:4,67:9,68:10,69:12,70:13,71:14,72:14,73:15,74:16,75:17,76:20,77:21,78:22,79:45,80:46,81:47,82:0},Z={5:'"$"#,##0_);\\("$"#,##0\\)',63:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',41:'_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)'};function J(e,t,r){for(var a=e<0?-1:1,n=e*a,s=0,i=1,o=0,c=1,l=0,f=0,h=Math.floor(n);l<t&&(o=(h=Math.floor(n))*i+s,f=h*l+c,!(n-h<5e-8));)n=1/(n-h),s=i,i=o,c=l,l=f;if(f>t&&(l>t?(f=c,o=s):(f=l,o=i)),!r)return[0,a*o,f];var u=Math.floor(a*o/f);return[u,a*o-u*f,f]}function q(e,t,r){if(e>2958465||e<0)return null;var a=0|(e=function(e){var t=e.toPrecision(16);if(t.indexOf("e")>-1){var r=t.slice(0,t.indexOf("e"));return(r=r.indexOf(".")>-1?r.slice(0,"0."==r.slice(0,2)?17:16):r.slice(0,15)+Je("0",r.length-15))+t.slice(t.indexOf("e"))}var a=t.indexOf(".")>-1?t.slice(0,"0."==t.slice(0,2)?17:16):t.slice(0,15)+Je("0",t.length-15);return Number(a)}(e)),n=Math.floor(86400*(e-a)),s=0,i=[],o={D:a,T:n,u:86400*(e-a)-n,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(o.u)<1e-6&&(o.u=0),t&&t.date1904&&(a+=1462),o.u>.9999&&(o.u=0,86400==++n&&(o.T=n=0,++a,++o.D)),60===a)i=r?[1317,10,29]:[1900,2,29],s=3;else if(0===a)i=r?[1317,8,29]:[1900,1,0],s=6;else{a>60&&--a;var c=new Date(1900,0,1);c.setDate(c.getDate()+a-1),i=[c.getFullYear(),c.getMonth()+1,c.getDate()],s=c.getDay(),a<60&&(s=(s+6)%7),r&&(s=function(e,t){t[0]-=581;var r=e.getDay();e<60&&(r=(r+6)%7);return r}(c,i))}return o.y=i[0],o.m=i[1],o.d=i[2],o.S=n%60,n=Math.floor(n/60),o.M=n%60,n=Math.floor(n/60),o.H=n,o.q=s,o}function Q(e){return-1==e.indexOf(".")?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)$/,"$1")}function ee(e){var t,r=Math.floor(Math.log(Math.abs(e))*Math.LOG10E);return t=r>=-4&&r<=-1?e.toPrecision(10+r):Math.abs(r)<=9?function(e){var t=e<0?12:11,r=Q(e.toFixed(12));return r.length<=t||(r=e.toPrecision(10)).length<=t?r:e.toExponential(5)}(e):10===r?e.toFixed(10).substr(0,12):function(e){var t=Q(e.toFixed(11));return t.length>(e<0?12:11)||"0"===t||"-0"===t?e.toPrecision(6):t}(e),Q(function(e){return-1==e.indexOf("E")?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,"$1E").replace(/(E[+-])(\d)$/,"$10$2")}(t.toUpperCase()))}function te(e,t){switch(typeof e){case"string":return e;case"boolean":return e?"TRUE":"FALSE";case"number":return(0|e)===e?e.toString(10):ee(e);case"undefined":return"";case"object":if(null==e)return"";if(e instanceof Date)return Te(14,He(e,t&&t.date1904),t)}throw new Error("unsupported value in General format: "+e)}function re(e,t,r,a){var n,s="",i=0,o=0,c=r.y,l=0;switch(e){case 98:c=r.y+543;case 121:switch(t.length){case 1:case 2:n=c%100,l=2;break;default:n=c%1e4,l=4}break;case 109:switch(t.length){case 1:case 2:n=r.m,l=t.length;break;case 3:return G[r.m-1][1];case 5:return G[r.m-1][0];default:return G[r.m-1][2]}break;case 100:switch(t.length){case 1:case 2:n=r.d,l=t.length;break;case 3:return X[r.q][0];default:return X[r.q][1]}break;case 104:switch(t.length){case 1:case 2:n=1+(r.H+11)%12,l=t.length;break;default:throw"bad hour format: "+t}break;case 72:switch(t.length){case 1:case 2:n=r.H,l=t.length;break;default:throw"bad hour format: "+t}break;case 77:switch(t.length){case 1:case 2:n=r.M,l=t.length;break;default:throw"bad minute format: "+t}break;case 115:if("s"!=t&&"ss"!=t&&".0"!=t&&".00"!=t&&".000"!=t)throw"bad second format: "+t;return 0!==r.u||"s"!=t&&"ss"!=t?(o=a>=2?3===a?1e3:100:1===a?10:1,(i=Math.round(o*(r.S+r.u)))>=60*o&&(i=0),"s"===t?0===i?"0":""+i/o:(s=B(i,2+a),"ss"===t?s.substr(0,2):"."+s.substr(2,t.length-1))):B(r.S,t.length);case 90:switch(t){case"[h]":case"[hh]":n=24*r.D+r.H;break;case"[m]":case"[mm]":n=60*(24*r.D+r.H)+r.M;break;case"[s]":case"[ss]":n=60*(60*(24*r.D+r.H)+r.M)+(0==a?Math.round(r.S+r.u):r.S);break;default:throw"bad abstime format: "+t}l=3===t.length?1:2;break;case 101:n=c,l=1}return l>0?B(n,l):""}function ae(e){if(e.length<=3)return e;for(var t=e.length%3,r=e.substr(0,t);t!=e.length;t+=3)r+=(r.length>0?",":"")+e.substr(t,3);return r}var ne=/%/g;var se=/# (\?+)( ?)\/( ?)(\d+)/;var ie=/^#*0*\.([0#]+)/,oe=/\)[^)]*[0#]/,ce=/\(###\) ###\\?-####/;function le(e){for(var t,r="",a=0;a!=e.length;++a)switch(t=e.charCodeAt(a)){case 35:break;case 63:r+=" ";break;case 48:r+="0";break;default:r+=String.fromCharCode(t)}return r}function fe(e,t){var r=Math.pow(10,t);return""+Math.round(e*r)/r}function he(e,t){var r=e-Math.floor(e),a=Math.pow(10,t);return t<(""+Math.round(r*a)).length?0:Math.round(r*a)}function ue(e,t,r){if(40===e.charCodeAt(0)&&!t.match(oe)){var a=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?ue("n",a,r):"("+ue("n",a,-r)+")"}if(44===t.charCodeAt(t.length-1))return function(e,t,r){for(var a=t.length-1;44===t.charCodeAt(a-1);)--a;return pe(e,t.substr(0,a),r/Math.pow(10,3*(t.length-a)))}(e,t,r);if(-1!==t.indexOf("%"))return function(e,t,r){var a=t.replace(ne,""),n=t.length-a.length;return pe(e,a,r*Math.pow(10,2*n))+Je("%",n)}(e,t,r);if(-1!==t.indexOf("E"))return function e(t,r){var a,n=t.indexOf("E")-t.indexOf(".")-1;if(t.match(/^#+0.0E\+0$/)){if(0==r)return"0.0E+0";if(r<0)return"-"+e(t,-r);var s=t.indexOf(".");-1===s&&(s=t.indexOf("E"));var i=Math.floor(Math.log(r)*Math.LOG10E)%s;if(i<0&&(i+=s),-1===(a=(r/Math.pow(10,i)).toPrecision(n+1+(s+i)%s)).indexOf("e")){var o=Math.floor(Math.log(r)*Math.LOG10E);for(-1===a.indexOf(".")?a=a.charAt(0)+"."+a.substr(1)+"E+"+(o-a.length+i):a+="E+"+(o-i);"0."===a.substr(0,2);)a=(a=a.charAt(0)+a.substr(2,s)+"."+a.substr(2+s)).replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");a=a.replace(/\+-/,"-")}a=a.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,(function(e,t,r,a){return t+r+a.substr(0,(s+i)%s)+"."+a.substr(i)+"E"}))}else a=r.toExponential(n);return t.match(/E\+00$/)&&a.match(/e[+-]\d$/)&&(a=a.substr(0,a.length-1)+"0"+a.charAt(a.length-1)),t.match(/E\-/)&&a.match(/e\+/)&&(a=a.replace(/e\+/,"e")),a.replace("e","E")}(t,r);if(36===t.charCodeAt(0))return"$"+ue(e,t.substr(" "==t.charAt(1)?2:1),r);var n,s,i,o,c=Math.abs(r),l=r<0?"-":"";if(t.match(/^00+$/))return l+V(c,t.length);if(t.match(/^[#?]+$/))return"0"===(n=V(r,0))&&(n=""),n.length>t.length?n:le(t.substr(0,t.length-n.length))+n;if(s=t.match(se))return function(e,t,r){var a=parseInt(e[4],10),n=Math.round(t*a),s=Math.floor(n/a),i=n-s*a,o=a;return r+(0===s?"":""+s)+" "+(0===i?Je(" ",e[1].length+1+e[4].length):W(i,e[1].length)+e[2]+"/"+e[3]+B(o,e[4].length))}(s,c,l);if(t.match(/^#+0+$/))return l+V(c,t.length-t.indexOf("0"));if(s=t.match(ie))return n=fe(r,s[1].length).replace(/^([^\.]+)$/,"$1."+le(s[1])).replace(/\.$/,"."+le(s[1])).replace(/\.(\d*)$/,(function(e,t){return"."+t+Je("0",le(s[1]).length-t.length)})),-1!==t.indexOf("0.")?n:n.replace(/^0\./,".");if(t=t.replace(/^#+([0.])/,"$1"),s=t.match(/^(0*)\.(#*)$/))return l+fe(c,s[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,s[1].length?"0.":".");if(s=t.match(/^#{1,3},##0(\.?)$/))return l+ae(V(c,0));if(s=t.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+ue(e,t,-r):ae(""+(Math.floor(r)+function(e,t){return t<(""+Math.round((e-Math.floor(e))*Math.pow(10,t))).length?1:0}(r,s[1].length)))+"."+B(he(r,s[1].length),s[1].length);if(s=t.match(/^#,#*,#0/))return ue(e,t.replace(/^#,#*,/,""),r);if(s=t.match(/^([0#]+)(\\?-([0#]+))+$/))return n=U(ue(e,t.replace(/[\\-]/g,""),r)),i=0,U(U(t.replace(/\\/g,"")).replace(/[0#]/g,(function(e){return i<n.length?n.charAt(i++):"0"===e?"0":""})));if(t.match(ce))return"("+(n=ue(e,"##########",r)).substr(0,3)+") "+n.substr(3,3)+"-"+n.substr(6);var f="";if(s=t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return i=Math.min(s[4].length,7),o=J(c,Math.pow(10,i)-1,!1),n=""+l," "==(f=pe("n",s[1],o[1])).charAt(f.length-1)&&(f=f.substr(0,f.length-1)+"0"),n+=f+s[2]+"/"+s[3],(f=z(o[2],i)).length<s[4].length&&(f=le(s[4].substr(s[4].length-f.length))+f),n+=f;if(s=t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return i=Math.min(Math.max(s[1].length,s[4].length),7),l+((o=J(c,Math.pow(10,i)-1,!0))[0]||(o[1]?"":"0"))+" "+(o[1]?W(o[1],i)+s[2]+"/"+s[3]+z(o[2],i):Je(" ",2*i+1+s[2].length+s[3].length));if(s=t.match(/^[#0?]+$/))return n=V(r,0),t.length<=n.length?n:le(t.substr(0,t.length-n.length))+n;if(s=t.match(/^([#0?]+)\.([#0]+)$/)){n=""+r.toFixed(Math.min(s[2].length,10)).replace(/([^0])0+$/,"$1"),i=n.indexOf(".");var h=t.indexOf(".")-i,u=t.length-n.length-h;return le(t.substr(0,h)+n+t.substr(t.length-u))}if(s=t.match(/^00,000\.([#0]*0)$/))return i=he(r,s[1].length),r<0?"-"+ue(e,t,-r):ae(function(e){return e<2147483647&&e>-2147483648?""+(e>=0?0|e:e-1|0):""+Math.floor(e)}(r)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,(function(e){return"00,"+(e.length<3?B(0,3-e.length):"")+e}))+"."+B(i,s[1].length);switch(t){case"###,##0.00":return ue(e,"#,##0.00",r);case"###,###":case"##,###":case"#,###":var d=ae(V(c,0));return"0"!==d?l+d:"";case"###,###.00":return ue(e,"###,##0.00",r).replace(/^0\./,".");case"#,###.00":return ue(e,"#,##0.00",r).replace(/^0\./,".")}throw new Error("unsupported format |"+t+"|")}function de(e,t,r){if(40===e.charCodeAt(0)&&!t.match(oe)){var a=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?de("n",a,r):"("+de("n",a,-r)+")"}if(44===t.charCodeAt(t.length-1))return function(e,t,r){for(var a=t.length-1;44===t.charCodeAt(a-1);)--a;return pe(e,t.substr(0,a),r/Math.pow(10,3*(t.length-a)))}(e,t,r);if(-1!==t.indexOf("%"))return function(e,t,r){var a=t.replace(ne,""),n=t.length-a.length;return pe(e,a,r*Math.pow(10,2*n))+Je("%",n)}(e,t,r);if(-1!==t.indexOf("E"))return function e(t,r){var a,n=t.indexOf("E")-t.indexOf(".")-1;if(t.match(/^#+0.0E\+0$/)){if(0==r)return"0.0E+0";if(r<0)return"-"+e(t,-r);var s=t.indexOf(".");-1===s&&(s=t.indexOf("E"));var i=Math.floor(Math.log(r)*Math.LOG10E)%s;if(i<0&&(i+=s),!(a=(r/Math.pow(10,i)).toPrecision(n+1+(s+i)%s)).match(/[Ee]/)){var o=Math.floor(Math.log(r)*Math.LOG10E);-1===a.indexOf(".")?a=a.charAt(0)+"."+a.substr(1)+"E+"+(o-a.length+i):a+="E+"+(o-i),a=a.replace(/\+-/,"-")}a=a.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,(function(e,t,r,a){return t+r+a.substr(0,(s+i)%s)+"."+a.substr(i)+"E"}))}else a=r.toExponential(n);return t.match(/E\+00$/)&&a.match(/e[+-]\d$/)&&(a=a.substr(0,a.length-1)+"0"+a.charAt(a.length-1)),t.match(/E\-/)&&a.match(/e\+/)&&(a=a.replace(/e\+/,"e")),a.replace("e","E")}(t,r);if(36===t.charCodeAt(0))return"$"+de(e,t.substr(" "==t.charAt(1)?2:1),r);var n,s,i,o,c=Math.abs(r),l=r<0?"-":"";if(t.match(/^00+$/))return l+B(c,t.length);if(t.match(/^[#?]+$/))return n=""+r,0===r&&(n=""),n.length>t.length?n:le(t.substr(0,t.length-n.length))+n;if(s=t.match(se))return function(e,t,r){return r+(0===t?"":""+t)+Je(" ",e[1].length+2+e[4].length)}(s,c,l);if(t.match(/^#+0+$/))return l+B(c,t.length-t.indexOf("0"));if(s=t.match(ie))return n=(n=(""+r).replace(/^([^\.]+)$/,"$1."+le(s[1])).replace(/\.$/,"."+le(s[1]))).replace(/\.(\d*)$/,(function(e,t){return"."+t+Je("0",le(s[1]).length-t.length)})),-1!==t.indexOf("0.")?n:n.replace(/^0\./,".");if(t=t.replace(/^#+([0.])/,"$1"),s=t.match(/^(0*)\.(#*)$/))return l+(""+c).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,s[1].length?"0.":".");if(s=t.match(/^#{1,3},##0(\.?)$/))return l+ae(""+c);if(s=t.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+de(e,t,-r):ae(""+r)+"."+Je("0",s[1].length);if(s=t.match(/^#,#*,#0/))return de(e,t.replace(/^#,#*,/,""),r);if(s=t.match(/^([0#]+)(\\?-([0#]+))+$/))return n=U(de(e,t.replace(/[\\-]/g,""),r)),i=0,U(U(t.replace(/\\/g,"")).replace(/[0#]/g,(function(e){return i<n.length?n.charAt(i++):"0"===e?"0":""})));if(t.match(ce))return"("+(n=de(e,"##########",r)).substr(0,3)+") "+n.substr(3,3)+"-"+n.substr(6);var f="";if(s=t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return i=Math.min(s[4].length,7),o=J(c,Math.pow(10,i)-1,!1),n=""+l," "==(f=pe("n",s[1],o[1])).charAt(f.length-1)&&(f=f.substr(0,f.length-1)+"0"),n+=f+s[2]+"/"+s[3],(f=z(o[2],i)).length<s[4].length&&(f=le(s[4].substr(s[4].length-f.length))+f),n+=f;if(s=t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return i=Math.min(Math.max(s[1].length,s[4].length),7),l+((o=J(c,Math.pow(10,i)-1,!0))[0]||(o[1]?"":"0"))+" "+(o[1]?W(o[1],i)+s[2]+"/"+s[3]+z(o[2],i):Je(" ",2*i+1+s[2].length+s[3].length));if(s=t.match(/^[#0?]+$/))return n=""+r,t.length<=n.length?n:le(t.substr(0,t.length-n.length))+n;if(s=t.match(/^([#0]+)\.([#0]+)$/)){n=""+r.toFixed(Math.min(s[2].length,10)).replace(/([^0])0+$/,"$1"),i=n.indexOf(".");var h=t.indexOf(".")-i,u=t.length-n.length-h;return le(t.substr(0,h)+n+t.substr(t.length-u))}if(s=t.match(/^00,000\.([#0]*0)$/))return r<0?"-"+de(e,t,-r):ae(""+r).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,(function(e){return"00,"+(e.length<3?B(0,3-e.length):"")+e}))+"."+B(0,s[1].length);switch(t){case"###,###":case"##,###":case"#,###":var d=ae(""+c);return"0"!==d?l+d:"";default:if(t.match(/\.[0#?]*$/))return de(e,t.slice(0,t.lastIndexOf(".")),r)+le(t.slice(t.lastIndexOf(".")))}throw new Error("unsupported format |"+t+"|")}function pe(e,t,r){return(0|r)===r?de(e,t,r):ue(e,t,r)}var me=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function ve(e){for(var t=0,r="",a="";t<e.length;)switch(r=e.charAt(t)){case"G":j(e,t)&&(t+=6),t++;break;case'"':for(;34!==e.charCodeAt(++t)&&t<e.length;);++t;break;case"\\":case"_":t+=2;break;case"@":++t;break;case"B":case"b":if("1"===e.charAt(t+1)||"2"===e.charAt(t+1))return!0;case"M":case"D":case"Y":case"H":case"S":case"E":case"m":case"d":case"y":case"h":case"s":case"e":case"g":return!0;case"A":case"a":case"\u4e0a":if("A/P"===e.substr(t,3).toUpperCase())return!0;if("AM/PM"===e.substr(t,5).toUpperCase())return!0;if("\u4e0a\u5348/\u4e0b\u5348"===e.substr(t,5).toUpperCase())return!0;++t;break;case"[":for(a=r;"]"!==e.charAt(t++)&&t<e.length;)a+=e.charAt(t);if(a.match(me))return!0;break;case".":case"0":case"#":for(;t<e.length&&("0#?.,E+-%".indexOf(r=e.charAt(++t))>-1||"\\"==r&&"-"==e.charAt(t+1)&&"0#".indexOf(e.charAt(t+2))>-1););break;case"?":for(;e.charAt(++t)===r;);break;case"*":++t," "!=e.charAt(t)&&"*"!=e.charAt(t)||++t;break;case"(":case")":++t;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;t<e.length&&"0123456789".indexOf(e.charAt(++t))>-1;);break;case" ":default:++t}return!1}var ge=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function be(e,t){if(null==t)return!1;var r=parseFloat(t[2]);switch(t[1]){case"=":if(e==r)return!0;break;case">":if(e>r)return!0;break;case"<":if(e<r)return!0;break;case"<>":if(e!=r)return!0;break;case">=":if(e>=r)return!0;break;case"<=":if(e<=r)return!0}return!1}function we(e,t){var r=function(e){for(var t=[],r=!1,a=0,n=0;a<e.length;++a)switch(e.charCodeAt(a)){case 34:r=!r;break;case 95:case 42:case 92:++a;break;case 59:t[t.length]=e.substr(n,a-n),n=a+1}if(t[t.length]=e.substr(n),!0===r)throw new Error("Format |"+e+"| unterminated string ");return t}(e),a=r.length,n=r[a-1].indexOf("@");if(a<4&&n>-1&&--a,r.length>4)throw new Error("cannot find right format for |"+r.join("|")+"|");if("number"!=typeof t)return[4,4===r.length||n>-1?r[r.length-1]:"@"];switch(r.length){case 1:r=n>-1?["General","General","General",r[0]]:[r[0],r[0],r[0],"@"];break;case 2:r=n>-1?[r[0],r[0],r[0],r[1]]:[r[0],r[1],r[0],"@"];break;case 3:r=n>-1?[r[0],r[1],r[0],r[2]]:[r[0],r[1],r[2],"@"]}var s=t>0?r[0]:t<0?r[1]:r[2];if(-1===r[0].indexOf("[")&&-1===r[1].indexOf("["))return[a,s];if(null!=r[0].match(/\[[=<>]/)||null!=r[1].match(/\[[=<>]/)){var i=r[0].match(ge),o=r[1].match(ge);return be(t,i)?[a,r[0]]:be(t,o)?[a,r[1]]:[a,r[null!=i&&null!=o?2:1]]}return[a,s]}function Te(e,t,r){null==r&&(r={});var a="";switch(typeof e){case"string":a="m/d/yy"==e&&r.dateNF?r.dateNF:e;break;case"number":null==(a=14==e&&r.dateNF?r.dateNF:(null!=r.table?r.table:K)[e])&&(a=r.table&&r.table[Y[e]]||K[Y[e]]),null==a&&(a=Z[e]||"General")}if(j(a,0))return te(t,r);t instanceof Date&&(t=He(t,r.date1904));var n=we(a,t);if(j(n[1]))return te(t,r);if(!0===t)t="TRUE";else if(!1===t)t="FALSE";else if(""===t||null==t)return"";return function(e,t,r,a){for(var n,s,i,o=[],c="",l=0,f="",h="t",u="H";l<e.length;)switch(f=e.charAt(l)){case"G":if(!j(e,l))throw new Error("unrecognized character "+f+" in "+e);o[o.length]={t:"G",v:"General"},l+=7;break;case'"':for(c="";34!==(i=e.charCodeAt(++l))&&l<e.length;)c+=String.fromCharCode(i);o[o.length]={t:"t",v:c},++l;break;case"\\":var d=e.charAt(++l),p="("===d||")"===d?d:"t";o[o.length]={t:p,v:d},++l;break;case"_":o[o.length]={t:"t",v:" "},l+=2;break;case"@":o[o.length]={t:"T",v:t},++l;break;case"B":case"b":if("1"===e.charAt(l+1)||"2"===e.charAt(l+1)){if(null==n&&null==(n=q(t,r,"2"===e.charAt(l+1))))return"";o[o.length]={t:"X",v:e.substr(l,2)},h=f,l+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":f=f.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if(t<0)return"";if(null==n&&null==(n=q(t,r)))return"";for(c=f;++l<e.length&&e.charAt(l).toLowerCase()===f;)c+=f;"m"===f&&"h"===h.toLowerCase()&&(f="M"),"h"===f&&(f=u),o[o.length]={t:f,v:c},h=f;break;case"A":case"a":case"\u4e0a":var m={t:f,v:f};if(null==n&&(n=q(t,r)),"A/P"===e.substr(l,3).toUpperCase()?(null!=n&&(m.v=n.H>=12?e.charAt(l+2):f),m.t="T",u="h",l+=3):"AM/PM"===e.substr(l,5).toUpperCase()?(null!=n&&(m.v=n.H>=12?"PM":"AM"),m.t="T",l+=5,u="h"):"\u4e0a\u5348/\u4e0b\u5348"===e.substr(l,5).toUpperCase()?(null!=n&&(m.v=n.H>=12?"\u4e0b\u5348":"\u4e0a\u5348"),m.t="T",l+=5,u="h"):(m.t="t",++l),null==n&&"T"===m.t)return"";o[o.length]=m,h=f;break;case"[":for(c=f;"]"!==e.charAt(l++)&&l<e.length;)c+=e.charAt(l);if("]"!==c.slice(-1))throw'unterminated "[" block: |'+c+"|";if(c.match(me)){if(null==n&&null==(n=q(t,r)))return"";o[o.length]={t:"Z",v:c.toLowerCase()},h=c.charAt(1)}else c.indexOf("$")>-1&&(c=(c.match(/\$([^-\[\]]*)/)||[])[1]||"$",ve(e)||(o[o.length]={t:"t",v:c}));break;case".":if(null!=n){for(c=f;++l<e.length&&"0"===(f=e.charAt(l));)c+=f;o[o.length]={t:"s",v:c};break}case"0":case"#":for(c=f;++l<e.length&&"0#?.,E+-%".indexOf(f=e.charAt(l))>-1;)c+=f;o[o.length]={t:"n",v:c};break;case"?":for(c=f;e.charAt(++l)===f;)c+=f;o[o.length]={t:f,v:c},h=f;break;case"*":++l," "!=e.charAt(l)&&"*"!=e.charAt(l)||++l;break;case"(":case")":o[o.length]={t:1===a?"t":f,v:f},++l;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(c=f;l<e.length&&"0123456789".indexOf(e.charAt(++l))>-1;)c+=e.charAt(l);o[o.length]={t:"D",v:c};break;case" ":o[o.length]={t:f,v:f},++l;break;case"$":o[o.length]={t:"t",v:"$"},++l;break;default:if(-1===",$-+/():!^&'~{}<>=\u20acacfijklopqrtuvwxzP".indexOf(f))throw new Error("unrecognized character "+f+" in "+e);o[o.length]={t:"t",v:f},++l}var v,g,b=0,w=0;for(l=o.length-1,h="t";l>=0;--l)switch(o[l].t){case"h":case"H":o[l].t=u,h="h",b<1&&(b=1);break;case"s":(v=o[l].v.match(/\.0+$/))&&(w=Math.max(w,v[0].length-1),b=4),b<3&&(b=3);case"d":case"y":case"e":h=o[l].t;break;case"M":h=o[l].t,b<2&&(b=2);break;case"m":"s"===h&&(o[l].t="M",b<2&&(b=2));break;case"X":break;case"Z":b<1&&o[l].v.match(/[Hh]/)&&(b=1),b<2&&o[l].v.match(/[Mm]/)&&(b=2),b<3&&o[l].v.match(/[Ss]/)&&(b=3)}switch(b){case 0:break;case 1:case 2:case 3:n.u>=.5&&(n.u=0,++n.S),n.S>=60&&(n.S=0,++n.M),n.M>=60&&(n.M=0,++n.H),n.H>=24&&(n.H=0,++n.D,(g=q(n.D)).u=n.u,g.S=n.S,g.M=n.M,g.H=n.H,n=g);break;case 4:switch(w){case 1:n.u=Math.round(10*n.u)/10;break;case 2:n.u=Math.round(100*n.u)/100;break;case 3:n.u=Math.round(1e3*n.u)/1e3}n.u>=1&&(n.u=0,++n.S),n.S>=60&&(n.S=0,++n.M),n.M>=60&&(n.M=0,++n.H),n.H>=24&&(n.H=0,++n.D,(g=q(n.D)).u=n.u,g.S=n.S,g.M=n.M,g.H=n.H,n=g)}var T,y="";for(l=0;l<o.length;++l)switch(o[l].t){case"t":case"T":case" ":case"D":break;case"X":o[l].v="",o[l].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":o[l].v=re(o[l].t.charCodeAt(0),o[l].v,n,w),o[l].t="t";break;case"n":case"?":for(T=l+1;null!=o[T]&&("?"===(f=o[T].t)||"D"===f||(" "===f||"t"===f)&&null!=o[T+1]&&("?"===o[T+1].t||"t"===o[T+1].t&&"/"===o[T+1].v)||"("===o[l].t&&(" "===f||"n"===f||")"===f)||"t"===f&&("/"===o[T].v||" "===o[T].v&&null!=o[T+1]&&"?"==o[T+1].t));)o[l].v+=o[T].v,o[T]={v:"",t:";"},++T;y+=o[l].v,l=T-1;break;case"G":o[l].t="t",o[l].v=te(t,r)}var k,E,_="";if(y.length>0){40==y.charCodeAt(0)?(k=t<0&&45===y.charCodeAt(0)?-t:t,E=pe("n",y,k)):(E=pe("n",y,k=t<0&&a>1?-t:t),k<0&&o[0]&&"t"==o[0].t&&(E=E.substr(1),o[0].v="-"+o[0].v)),T=E.length-1;var S=o.length;for(l=0;l<o.length;++l)if(null!=o[l]&&"t"!=o[l].t&&o[l].v.indexOf(".")>-1){S=l;break}var x=o.length;if(S===o.length&&-1===E.indexOf("E")){for(l=o.length-1;l>=0;--l)null!=o[l]&&-1!=="n?".indexOf(o[l].t)&&(T>=o[l].v.length-1?(T-=o[l].v.length,o[l].v=E.substr(T+1,o[l].v.length)):T<0?o[l].v="":(o[l].v=E.substr(0,T+1),T=-1),o[l].t="t",x=l);T>=0&&x<o.length&&(o[x].v=E.substr(0,T+1)+o[x].v)}else if(S!==o.length&&-1===E.indexOf("E")){for(T=E.indexOf(".")-1,l=S;l>=0;--l)if(null!=o[l]&&-1!=="n?".indexOf(o[l].t)){for(s=o[l].v.indexOf(".")>-1&&l===S?o[l].v.indexOf(".")-1:o[l].v.length-1,_=o[l].v.substr(s+1);s>=0;--s)T>=0&&("0"===o[l].v.charAt(s)||"#"===o[l].v.charAt(s))&&(_=E.charAt(T--)+_);o[l].v=_,o[l].t="t",x=l}for(T>=0&&x<o.length&&(o[x].v=E.substr(0,T+1)+o[x].v),T=E.indexOf(".")+1,l=S;l<o.length;++l)if(null!=o[l]&&(-1!=="n?(".indexOf(o[l].t)||l===S)){for(s=o[l].v.indexOf(".")>-1&&l===S?o[l].v.indexOf(".")+1:0,_=o[l].v.substr(0,s);s<o[l].v.length;++s)T<E.length&&(_+=E.charAt(T++));o[l].v=_,o[l].t="t",x=l}}}for(l=0;l<o.length;++l)null!=o[l]&&"n?".indexOf(o[l].t)>-1&&(k=a>1&&t<0&&l>0&&"-"===o[l-1].v?-t:t,o[l].v=pe(o[l].t,o[l].v,k),o[l].t="t");var A="";for(l=0;l!==o.length;++l)null!=o[l]&&(A+=o[l].v);return A}(n[1],t,r,n[0])}function ye(e,t){if("number"!=typeof t){t=+t||-1;for(var r=0;r<392;++r)if(null!=K[r]){if(K[r]==e){t=r;break}}else t<0&&(t=r);t<0&&(t=391)}return K[t]=e,t}function ke(e){for(var t=0;392!=t;++t)void 0!==e[t]&&ye(e[t],t)}function Ee(){var e;e||(e={}),e[0]="General",e[1]="0",e[2]="0.00",e[3]="#,##0",e[4]="#,##0.00",e[9]="0%",e[10]="0.00%",e[11]="0.00E+00",e[12]="# ?/?",e[13]="# ??/??",e[14]="m/d/yy",e[15]="d-mmm-yy",e[16]="d-mmm",e[17]="mmm-yy",e[18]="h:mm AM/PM",e[19]="h:mm:ss AM/PM",e[20]="h:mm",e[21]="h:mm:ss",e[22]="m/d/yy h:mm",e[37]="#,##0 ;(#,##0)",e[38]="#,##0 ;[Red](#,##0)",e[39]="#,##0.00;(#,##0.00)",e[40]="#,##0.00;[Red](#,##0.00)",e[45]="mm:ss",e[46]="[h]:mm:ss",e[47]="mmss.0",e[48]="##0.0E+0",e[49]="@",e[56]='"\u4e0a\u5348/\u4e0b\u5348 "hh"\u6642"mm"\u5206"ss"\u79d2 "',K=e}var _e={format:Te,load:ye,_table:K,load_table:ke,parse_date_code:q,is_date:ve,get_table:function(){return _e._table=K}},Se={5:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',23:"General",24:"General",25:"General",26:"General",27:"m/d/yy",28:"m/d/yy",29:"m/d/yy",30:"m/d/yy",31:"m/d/yy",32:"h:mm:ss",33:"h:mm:ss",34:"h:mm:ss",35:"h:mm:ss",36:"m/d/yy",41:'_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',50:"m/d/yy",51:"m/d/yy",52:"m/d/yy",53:"m/d/yy",54:"m/d/yy",55:"m/d/yy",56:"m/d/yy",57:"m/d/yy",58:"m/d/yy",59:"0",60:"0.00",61:"#,##0",62:"#,##0.00",63:'"$"#,##0_);\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',67:"0%",68:"0.00%",69:"# ?/?",70:"# ??/??",71:"m/d/yy",72:"m/d/yy",73:"d-mmm-yy",74:"d-mmm",75:"mmm-yy",76:"h:mm",77:"h:mm:ss",78:"m/d/yy h:mm",79:"mm:ss",80:"[h]:mm:ss",81:"mmss.0"},xe=/[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g;var Ae={"d.m":"d\\.m"};function Ce(e,t){return ye(Ae[e]||e,t)}var Ie,Oe=function(){var e={};e.version="1.2.0";var t=function(){for(var e=0,t=new Array(256),r=0;256!=r;++r)e=1&(e=1&(e=1&(e=1&(e=1&(e=1&(e=1&(e=1&(e=r)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1,t[r]=e;return"undefined"!=typeof Int32Array?new Int32Array(t):t}();var r=function(e){var t=0,r=0,a=0,n="undefined"!=typeof Int32Array?new Int32Array(4096):new Array(4096);for(a=0;256!=a;++a)n[a]=e[a];for(a=0;256!=a;++a)for(r=e[a],t=256+a;t<4096;t+=256)r=n[t]=r>>>8^e[255&r];var s=[];for(a=1;16!=a;++a)s[a-1]="undefined"!=typeof Int32Array&&"function"==typeof n.subarray?n.subarray(256*a,256*a+256):n.slice(256*a,256*a+256);return s}(t),a=r[0],n=r[1],s=r[2],i=r[3],o=r[4],c=r[5],l=r[6],f=r[7],h=r[8],u=r[9],d=r[10],p=r[11],m=r[12],v=r[13],g=r[14];return e.table=t,e.bstr=function(e,r){for(var a=-1^r,n=0,s=e.length;n<s;)a=a>>>8^t[255&(a^e.charCodeAt(n++))];return~a},e.buf=function(e,r){for(var b=-1^r,w=e.length-15,T=0;T<w;)b=g[e[T++]^255&b]^v[e[T++]^b>>8&255]^m[e[T++]^b>>16&255]^p[e[T++]^b>>>24]^d[e[T++]]^u[e[T++]]^h[e[T++]]^f[e[T++]]^l[e[T++]]^c[e[T++]]^o[e[T++]]^i[e[T++]]^s[e[T++]]^n[e[T++]]^a[e[T++]]^t[e[T++]];for(w+=15;T<w;)b=b>>>8^t[255&(b^e[T++])];return~b},e.str=function(e,r){for(var a=-1^r,n=0,s=e.length,i=0,o=0;n<s;)(i=e.charCodeAt(n++))<128?a=a>>>8^t[255&(a^i)]:i<2048?a=(a=a>>>8^t[255&(a^(192|i>>6&31))])>>>8^t[255&(a^(128|63&i))]:i>=55296&&i<57344?(i=64+(1023&i),o=1023&e.charCodeAt(n++),a=(a=(a=(a=a>>>8^t[255&(a^(240|i>>8&7))])>>>8^t[255&(a^(128|i>>2&63))])>>>8^t[255&(a^(128|o>>6&15|(3&i)<<4))])>>>8^t[255&(a^(128|63&o))]):a=(a=(a=a>>>8^t[255&(a^(224|i>>12&15))])>>>8^t[255&(a^(128|i>>6&63))])>>>8^t[255&(a^(128|63&i))];return~a},e}(),Re=function(){var e,t={};function r(e){if("/"==e.charAt(e.length-1))return-1===e.slice(0,-1).indexOf("/")?e:r(e.slice(0,-1));var t=e.lastIndexOf("/");return-1===t?e:e.slice(0,t+1)}function a(e){if("/"==e.charAt(e.length-1))return a(e.slice(0,-1));var t=e.lastIndexOf("/");return-1===t?e:e.slice(t+1)}function n(e,t){"string"==typeof t&&(t=new Date(t));var r=t.getHours();r=(r=r<<6|t.getMinutes())<<5|t.getSeconds()>>>1,e.write_shift(2,r);var a=t.getFullYear()-1980;a=(a=a<<4|t.getMonth()+1)<<5|t.getDate(),e.write_shift(2,a)}function s(e){la(e,0);for(var t={},r=0;e.l<=e.length-4;){var a=e.read_shift(2),n=e.read_shift(2),s=e.l+n,i={};switch(a){case 21589:1&(r=e.read_shift(1))&&(i.mtime=e.read_shift(4)),n>5&&(2&r&&(i.atime=e.read_shift(4)),4&r&&(i.ctime=e.read_shift(4))),i.mtime&&(i.mt=new Date(1e3*i.mtime));break;case 1:var o=e.read_shift(4),c=e.read_shift(4);i.usz=c*Math.pow(2,32)+o,o=e.read_shift(4),c=e.read_shift(4),i.csz=c*Math.pow(2,32)+o}e.l=s,t[a]=i}return t}function i(){return e||(e=Ie)}function o(e,t){if(80==e[0]&&75==e[1])return ue(e,t);if(109==(32|e[0])&&105==(32|e[1]))return function(e,t){if("mime-version:"!=y(e.slice(0,13)).toLowerCase())throw new Error("Unsupported MAD header");var r=t&&t.root||"",a=(x&&Buffer.isBuffer(e)?e.toString("binary"):y(e)).split("\r\n"),n=0,s="";for(n=0;n<a.length;++n)if(s=a[n],/^Content-Location:/i.test(s)&&(s=s.slice(s.indexOf("file")),r||(r=s.slice(0,s.lastIndexOf("/")+1)),s.slice(0,r.length)!=r))for(;r.length>0&&(r=(r=r.slice(0,r.length-1)).slice(0,r.lastIndexOf("/")+1),s.slice(0,r.length)!=r););var i=(a[1]||"").match(/boundary="(.*?)"/);if(!i)throw new Error("MAD cannot find boundary");var o="--"+(i[1]||""),c={FileIndex:[],FullPaths:[]};h(c);var l,f=0;for(n=0;n<a.length;++n){var u=a[n];u!==o&&u!==o+"--"||(f++&&be(c,a.slice(l,n),r),l=n)}return c}(e,t);if(e.length<512)throw new Error("CFB file size "+e.length+" < 512");var r,a,n,s,i,o,u=512,d=[],p=e.slice(0,512);la(p,0);var m=function(e){if(80==e[e.l]&&75==e[e.l+1])return[0,0];e.chk(g,"Header Signature: "),e.l+=16;var t=e.read_shift(2,"u");return[e.read_shift(2,"u"),t]}(p);switch(r=m[0]){case 3:u=512;break;case 4:u=4096;break;case 0:if(0==m[1])return ue(e,t);default:throw new Error("Major Version: Expected 3 or 4 saw "+r)}512!==u&&la(p=e.slice(0,u),28);var b=e.slice(0,u);!function(e,t){var r;switch(e.l+=2,r=e.read_shift(2)){case 9:if(3!=t)throw new Error("Sector Shift: Expected 9 saw "+r);break;case 12:if(4!=t)throw new Error("Sector Shift: Expected 12 saw "+r);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+r)}e.chk("0600","Mini Sector Shift: "),e.chk("000000000000","Reserved: ")}(p,r);var w=p.read_shift(4,"i");if(3===r&&0!==w)throw new Error("# Directory Sectors: Expected 0 saw "+w);p.l+=4,s=p.read_shift(4,"i"),p.l+=4,p.chk("00100000","Mini Stream Cutoff Size: "),i=p.read_shift(4,"i"),a=p.read_shift(4,"i"),o=p.read_shift(4,"i"),n=p.read_shift(4,"i");for(var T=-1,k=0;k<109&&!((T=p.read_shift(4,"i"))<0);++k)d[k]=T;var E=function(e,t){for(var r=Math.ceil(e.length/t)-1,a=[],n=1;n<r;++n)a[n-1]=e.slice(n*t,(n+1)*t);return a[r-1]=e.slice(r*t),a}(e,u);!function e(t,r,a,n,s){var i=v;if(t===v){if(0!==r)throw new Error("DIFAT chain shorter than expected")}else if(-1!==t){var o=a[t],c=(n>>>2)-1;if(!o)return;for(var l=0;l<c&&(i=aa(o,4*l))!==v;++l)s.push(i);r>=1&&e(aa(o,n-4),r-1,a,n,s)}}(o,n,E,u,d);var _=function(e,t,r,a){var n=e.length,s=[],i=[],o=[],c=[],l=a-1,f=0,h=0,u=0,d=0;for(f=0;f<n;++f)if(o=[],(u=f+t)>=n&&(u-=n),!i[u]){c=[];var p=[];for(h=u;h>=0;){p[h]=!0,i[h]=!0,o[o.length]=h,c.push(e[h]);var m=r[Math.floor(4*h/a)];if(a<4+(d=4*h&l))throw new Error("FAT boundary crossed: "+h+" 4 "+a);if(!e[m])break;if(h=aa(e[m],d),p[h])break}s[u]={nodes:o,data:Nr([c])}}return s}(E,s,d,u);s<_.length&&(_[s].name="!Directory"),a>0&&i!==v&&(_[i].name="!MiniFAT"),_[d[0]].name="!FAT",_.fat_addrs=d,_.ssz=u;var S=[],A=[],C=[];!function(e,t,r,a,n,s,i,o){for(var h,u=0,d=a.length?2:0,p=t[e].data,m=0,g=0;m<p.length;m+=128){var b=p.slice(m,m+128);la(b,64),g=b.read_shift(2),h=Dr(b,0,g-d),a.push(h);var w={name:h,type:b.read_shift(1),color:b.read_shift(1),L:b.read_shift(4,"i"),R:b.read_shift(4,"i"),C:b.read_shift(4,"i"),clsid:b.read_shift(16),state:b.read_shift(4,"i"),start:0,size:0};0!==b.read_shift(2)+b.read_shift(2)+b.read_shift(2)+b.read_shift(2)&&(w.ct=f(b,b.l-8)),0!==b.read_shift(2)+b.read_shift(2)+b.read_shift(2)+b.read_shift(2)&&(w.mt=f(b,b.l-8)),w.start=b.read_shift(4,"i"),w.size=b.read_shift(4,"i"),w.size<0&&w.start<0&&(w.size=w.type=0,w.start=v,w.name=""),5===w.type?(u=w.start,n>0&&u!==v&&(t[u].name="!StreamData")):w.size>=4096?(w.storage="fat",void 0===t[w.start]&&(t[w.start]=l(r,w.start,t.fat_addrs,t.ssz)),t[w.start].name=w.name,w.content=t[w.start].data.slice(0,w.size)):(w.storage="minifat",w.size<0?w.size=0:u!==v&&w.start!==v&&t[u]&&(w.content=c(w,t[u].data,(t[o]||{}).data))),w.content&&la(w.content,0),s[h]=w,i.push(w)}}(s,_,E,S,a,{},A,i),function(e,t,r){for(var a=0,n=0,s=0,i=0,o=0,c=r.length,l=[],f=[];a<c;++a)l[a]=f[a]=a,t[a]=r[a];for(;o<f.length;++o)a=f[o],n=e[a].L,s=e[a].R,i=e[a].C,l[a]===a&&(-1!==n&&l[n]!==n&&(l[a]=l[n]),-1!==s&&l[s]!==s&&(l[a]=l[s])),-1!==i&&(l[i]=a),-1!==n&&a!=l[a]&&(l[n]=l[a],f.lastIndexOf(n)<o&&f.push(n)),-1!==s&&a!=l[a]&&(l[s]=l[a],f.lastIndexOf(s)<o&&f.push(s));for(a=1;a<c;++a)l[a]===a&&(-1!==s&&l[s]!==s?l[a]=l[s]:-1!==n&&l[n]!==n&&(l[a]=l[n]));for(a=1;a<c;++a)if(0!==e[a].type){if((o=a)!=l[o])do{o=l[o],t[a]=t[o]+"/"+t[a]}while(0!==o&&-1!==l[o]&&o!=l[o]);l[a]=-1}for(t[0]+="/",a=1;a<c;++a)2!==e[a].type&&(t[a]+="/")}(A,C,S),S.shift();var I={FileIndex:A,FullPaths:C};return t&&t.raw&&(I.raw={header:b,sectors:E}),I}function c(e,t,r){for(var a=e.start,n=e.size,s=[],i=a;r&&n>0&&i>=0;)s.push(t.slice(i*m,i*m+m)),n-=m,i=aa(r,4*i);return 0===s.length?ha(0):P(s).slice(0,e.size)}function l(e,t,r,a,n){var s=[],i=[];n||(n=[]);var o=a-1,c=0,l=0;for(c=t;c>=0;){n[c]=!0,s[s.length]=c,i.push(e[c]);var f=r[Math.floor(4*c/a)];if(a<4+(l=4*c&o))throw new Error("FAT boundary crossed: "+c+" 4 "+a);if(!e[f])break;c=aa(e[f],l)}return{nodes:s,data:Nr([i])}}function f(e,t){return new Date(1e3*(ra(e,t+4)/1e7*Math.pow(2,32)+ra(e,t)/1e7-11644473600))}function h(e,t){var r=t||{},a=r.root||"Root Entry";if(e.FullPaths||(e.FullPaths=[]),e.FileIndex||(e.FileIndex=[]),e.FullPaths.length!==e.FileIndex.length)throw new Error("inconsistent CFB structure");0===e.FullPaths.length&&(e.FullPaths[0]=a+"/",e.FileIndex[0]={name:a,type:5}),r.CLSID&&(e.FileIndex[0].clsid=r.CLSID),function(e){var t="\x01Sh33tJ5";if(Re.find(e,"/"+t))return;var r=ha(4);r[0]=55,r[1]=r[3]=50,r[2]=54,e.FileIndex.push({name:t,type:2,content:r,size:4,L:69,R:69,C:69}),e.FullPaths.push(e.FullPaths[0]+t),u(e)}(e)}function u(e,t){h(e);for(var n=!1,s=!1,i=e.FullPaths.length-1;i>=0;--i){var o=e.FileIndex[i];switch(o.type){case 0:s?n=!0:(e.FileIndex.pop(),e.FullPaths.pop());break;case 1:case 2:case 5:s=!0,isNaN(o.R*o.L*o.C)&&(n=!0),o.R>-1&&o.L>-1&&o.R==o.L&&(n=!0);break;default:n=!0}}if(n||t){var c=new Date(1987,1,19),l=0,f=Object.create?Object.create(null):{},u=[];for(i=0;i<e.FullPaths.length;++i)f[e.FullPaths[i]]=!0,0!==e.FileIndex[i].type&&u.push([e.FullPaths[i],e.FileIndex[i]]);for(i=0;i<u.length;++i){var d=r(u[i][0]);for(s=f[d];!s;){for(;r(d)&&!f[r(d)];)d=r(d);u.push([d,{name:a(d).replace("/",""),type:1,clsid:w,ct:c,mt:c,content:null}]),f[d]=!0,s=f[d=r(u[i][0])]}}for(u.sort((function(e,t){return function(e,t){for(var r=e.split("/"),a=t.split("/"),n=0,s=0,i=Math.min(r.length,a.length);n<i;++n){if(s=r[n].length-a[n].length)return s;if(r[n]!=a[n])return r[n]<a[n]?-1:1}return r.length-a.length}(e[0],t[0])})),e.FullPaths=[],e.FileIndex=[],i=0;i<u.length;++i)e.FullPaths[i]=u[i][0],e.FileIndex[i]=u[i][1];for(i=0;i<u.length;++i){var p=e.FileIndex[i],m=e.FullPaths[i];if(p.name=a(m).replace("/",""),p.L=p.R=p.C=-(p.color=1),p.size=p.content?p.content.length:0,p.start=0,p.clsid=p.clsid||w,0===i)p.C=u.length>1?1:-1,p.size=0,p.type=5;else if("/"==m.slice(-1)){for(l=i+1;l<u.length&&r(e.FullPaths[l])!=m;++l);for(p.C=l>=u.length?-1:l,l=i+1;l<u.length&&r(e.FullPaths[l])!=r(m);++l);p.R=l>=u.length?-1:l,p.type=1}else r(e.FullPaths[i+1]||"")==r(m)&&(p.R=i+1),p.type=2}}}function d(e,t){var r=t||{};if("mad"==r.fileType)return function(e,t){for(var r=t||{},a=r.boundary||"SheetJS",n=["MIME-Version: 1.0",'Content-Type: multipart/related; boundary="'+(a="------="+a).slice(2)+'"',"","",""],s=e.FullPaths[0],i=s,o=e.FileIndex[0],c=1;c<e.FullPaths.length;++c)if(i=e.FullPaths[c].slice(s.length),(o=e.FileIndex[c]).size&&o.content&&"\x01Sh33tJ5"!=i){i=i.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF]/g,(function(e){return"_x"+e.charCodeAt(0).toString(16)+"_"})).replace(/[\u0080-\uFFFF]/g,(function(e){return"_u"+e.charCodeAt(0).toString(16)+"_"}));for(var l=o.content,f=x&&Buffer.isBuffer(l)?l.toString("binary"):y(l),h=0,u=Math.min(1024,f.length),d=0,p=0;p<=u;++p)(d=f.charCodeAt(p))>=32&&d<128&&++h;var m=h>=4*u/5;n.push(a),n.push("Content-Location: "+(r.root||"file:///C:/SheetJS/")+i),n.push("Content-Transfer-Encoding: "+(m?"quoted-printable":"base64")),n.push("Content-Type: "+me(o,i)),n.push(""),n.push(m?ge(f):ve(f))}return n.push(a+"--\r\n"),n.join("\r\n")}(e,r);switch(u(e),r.fileType){case"zip":return function(e,t){var r=t||{},a=[],s=[],i=ha(1),o=r.compression?8:0,c=0,l=0,f=0,h=0,u=e.FullPaths[0],d=u,m=e.FileIndex[0],v=[],g=0;for(c=1;c<e.FullPaths.length;++c)if(d=e.FullPaths[c].slice(u.length),(m=e.FileIndex[c]).size&&m.content&&"\x01Sh33tJ5"!=d){var b=f,w=ha(d.length);for(l=0;l<d.length;++l)w.write_shift(1,127&d.charCodeAt(l));w=w.slice(0,w.l),v[h]="string"==typeof m.content?Oe.bstr(m.content,0):Oe.buf(m.content,0);var T="string"==typeof m.content?R(m.content):m.content;8==o&&(y=T,T=p?p.deflateRawSync(y):ae(y)),(i=ha(30)).write_shift(4,67324752),i.write_shift(2,20),i.write_shift(2,0),i.write_shift(2,o),m.mt?n(i,m.mt):i.write_shift(4,0),i.write_shift(-4,v[h]),i.write_shift(4,T.length),i.write_shift(4,m.content.length),i.write_shift(2,w.length),i.write_shift(2,0),f+=i.length,a.push(i),f+=w.length,a.push(w),f+=T.length,a.push(T),(i=ha(46)).write_shift(4,33639248),i.write_shift(2,0),i.write_shift(2,20),i.write_shift(2,0),i.write_shift(2,o),i.write_shift(4,0),i.write_shift(-4,v[h]),i.write_shift(4,T.length),i.write_shift(4,m.content.length),i.write_shift(2,w.length),i.write_shift(2,0),i.write_shift(2,0),i.write_shift(2,0),i.write_shift(2,0),i.write_shift(4,0),i.write_shift(4,b),g+=i.l,s.push(i),g+=w.length,s.push(w),++h}var y;return(i=ha(22)).write_shift(4,101010256),i.write_shift(2,0),i.write_shift(2,0),i.write_shift(2,h),i.write_shift(2,h),i.write_shift(4,g),i.write_shift(4,f),i.write_shift(2,0),P([P(a),P(s),i])}(e,r)}var a=function(e){for(var t=0,r=0,a=0;a<e.FileIndex.length;++a){var n=e.FileIndex[a];if(n.content){var s=n.content.length;s>0&&(s<4096?t+=s+63>>6:r+=s+511>>9)}}for(var i=e.FullPaths.length+3>>2,o=t+127>>7,c=(t+7>>3)+r+i+o,l=c+127>>7,f=l<=109?0:Math.ceil((l-109)/127);c+l+f+127>>7>l;)f=++l<=109?0:Math.ceil((l-109)/127);var h=[1,f,l,o,i,r,t,0];return e.FileIndex[0].size=t<<6,h[7]=(e.FileIndex[0].start=h[0]+h[1]+h[2]+h[3]+h[4]+h[5])+(h[6]+7>>3),h}(e),s=ha(a[7]<<9),i=0,o=0;for(i=0;i<8;++i)s.write_shift(1,b[i]);for(i=0;i<8;++i)s.write_shift(2,0);for(s.write_shift(2,62),s.write_shift(2,3),s.write_shift(2,65534),s.write_shift(2,9),s.write_shift(2,6),i=0;i<3;++i)s.write_shift(2,0);for(s.write_shift(4,0),s.write_shift(4,a[2]),s.write_shift(4,a[0]+a[1]+a[2]+a[3]-1),s.write_shift(4,0),s.write_shift(4,4096),s.write_shift(4,a[3]?a[0]+a[1]+a[2]-1:v),s.write_shift(4,a[3]),s.write_shift(-4,a[1]?a[0]-1:v),s.write_shift(4,a[1]),i=0;i<109;++i)s.write_shift(-4,i<a[2]?a[1]+i:-1);if(a[1])for(o=0;o<a[1];++o){for(;i<236+127*o;++i)s.write_shift(-4,i<a[2]?a[1]+i:-1);s.write_shift(-4,o===a[1]-1?v:o+1)}var c=function(e){for(o+=e;i<o-1;++i)s.write_shift(-4,i+1);e&&(++i,s.write_shift(-4,v))};for(o=i=0,o+=a[1];i<o;++i)s.write_shift(-4,T.DIFSECT);for(o+=a[2];i<o;++i)s.write_shift(-4,T.FATSECT);c(a[3]),c(a[4]);for(var l=0,f=0,h=e.FileIndex[0];l<e.FileIndex.length;++l)(h=e.FileIndex[l]).content&&((f=h.content.length)<4096||(h.start=o,c(f+511>>9)));for(c(a[6]+7>>3);511&s.l;)s.write_shift(-4,T.ENDOFCHAIN);for(o=i=0,l=0;l<e.FileIndex.length;++l)(h=e.FileIndex[l]).content&&(!(f=h.content.length)||f>=4096||(h.start=o,c(f+63>>6)));for(;511&s.l;)s.write_shift(-4,T.ENDOFCHAIN);for(i=0;i<a[4]<<2;++i){var d=e.FullPaths[i];if(d&&0!==d.length){h=e.FileIndex[i],0===i&&(h.start=h.size?h.start-1:v);var m=0===i&&r.root||h.name;if(m.length>31&&(console.error("Name "+m+" will be truncated to "+m.slice(0,31)),m=m.slice(0,31)),f=2*(m.length+1),s.write_shift(64,m,"utf16le"),s.write_shift(2,f),s.write_shift(1,h.type),s.write_shift(1,h.color),s.write_shift(-4,h.L),s.write_shift(-4,h.R),s.write_shift(-4,h.C),h.clsid)s.write_shift(16,h.clsid,"hex");else for(l=0;l<4;++l)s.write_shift(4,0);s.write_shift(4,h.state||0),s.write_shift(4,0),s.write_shift(4,0),s.write_shift(4,0),s.write_shift(4,0),s.write_shift(4,h.start),s.write_shift(4,h.size),s.write_shift(4,0)}else{for(l=0;l<17;++l)s.write_shift(4,0);for(l=0;l<3;++l)s.write_shift(4,-1);for(l=0;l<12;++l)s.write_shift(4,0)}}for(i=1;i<e.FileIndex.length;++i)if((h=e.FileIndex[i]).size>=4096)if(s.l=h.start+1<<9,x&&Buffer.isBuffer(h.content))h.content.copy(s,s.l,0,h.size),s.l+=h.size+511&-512;else{for(l=0;l<h.size;++l)s.write_shift(1,h.content[l]);for(;511&l;++l)s.write_shift(1,0)}for(i=1;i<e.FileIndex.length;++i)if((h=e.FileIndex[i]).size>0&&h.size<4096)if(x&&Buffer.isBuffer(h.content))h.content.copy(s,s.l,0,h.size),s.l+=h.size+63&-64;else{for(l=0;l<h.size;++l)s.write_shift(1,h.content[l]);for(;63&l;++l)s.write_shift(1,0)}if(x)s.l=s.length;else for(;s.l<s.length;)s.write_shift(1,0);return s}t.version="1.2.2";var p,m=64,v=-2,g="d0cf11e0a1b11ae1",b=[208,207,17,224,161,177,26,225],w="00000000000000000000000000000000",T={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,ENDOFCHAIN:v,FREESECT:-1,HEADER_SIGNATURE:g,HEADER_MINOR_VERSION:"3e00",MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:w,EntryTypes:["unknown","storage","stream","lockbytes","property","root"]};function y(e){for(var t=new Array(e.length),r=0;r<e.length;++r)t[r]=String.fromCharCode(e[r]);return t.join("")}var k=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],E=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],C=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];for(var N,F,D="undefined"!=typeof Uint8Array,U=D?new Uint8Array(256):[],B=0;B<256;++B)U[B]=(F=void 0,255&((F=139536&((N=B)<<1|N<<11)|558144&(N<<5|N<<15))>>16|F>>8|F));function W(e,t){var r=U[255&e];return t<=8?r>>>8-t:(r=r<<8|U[e>>8&255],t<=16?r>>>16-t:(r=r<<8|U[e>>16&255])>>>24-t)}function z(e,t){var r=7&t,a=t>>>3;return(e[a]|(r<=6?0:e[a+1]<<8))>>>r&3}function H(e,t){var r=7&t,a=t>>>3;return(e[a]|(r<=5?0:e[a+1]<<8))>>>r&7}function V(e,t){var r=7&t,a=t>>>3;return(e[a]|(r<=3?0:e[a+1]<<8))>>>r&31}function j(e,t){var r=7&t,a=t>>>3;return(e[a]|(r<=1?0:e[a+1]<<8))>>>r&127}function $(e,t,r){var a=7&t,n=t>>>3,s=(1<<r)-1,i=e[n]>>>a;return r<8-a?i&s:(i|=e[n+1]<<8-a,r<16-a?i&s:(i|=e[n+2]<<16-a,r<24-a?i&s:(i|=e[n+3]<<24-a)&s))}function X(e,t,r){var a=7&t,n=t>>>3;return a<=5?e[n]|=(7&r)<<a:(e[n]|=r<<a&255,e[n+1]=(7&r)>>8-a),t+3}function G(e,t,r){return r=(1&r)<<(7&t),e[t>>>3]|=r,t+1}function K(e,t,r){var a=t>>>3;return r<<=7&t,e[a]|=255&r,r>>>=8,e[a+1]=r,t+8}function Y(e,t,r){var a=t>>>3;return r<<=7&t,e[a]|=255&r,r>>>=8,e[a+1]=255&r,e[a+2]=r>>>8,t+16}function Z(e,t){var r=e.length,a=2*r>t?2*r:t+5,n=0;if(r>=t)return e;if(x){var s=O(a);if(e.copy)e.copy(s);else for(;n<e.length;++n)s[n]=e[n];return s}if(D){var i=new Uint8Array(a);if(i.set)i.set(e);else for(;n<r;++n)i[n]=e[n];return i}return e.length=a,e}function J(e){for(var t=new Array(e),r=0;r<e;++r)t[r]=0;return t}function q(e,t,r){var a=1,n=0,s=0,i=0,o=0,c=e.length,l=D?new Uint16Array(32):J(32);for(s=0;s<32;++s)l[s]=0;for(s=c;s<r;++s)e[s]=0;c=e.length;var f=D?new Uint16Array(c):J(c);for(s=0;s<c;++s)l[n=e[s]]++,a<n&&(a=n),f[s]=0;for(l[0]=0,s=1;s<=a;++s)l[s+16]=o=o+l[s-1]<<1;for(s=0;s<c;++s)0!=(o=e[s])&&(f[s]=l[o+16]++);var h=0;for(s=0;s<c;++s)if(0!=(h=e[s]))for(o=W(f[s],a)>>a-h,i=(1<<a+4-h)-1;i>=0;--i)t[o|i<<h]=15&h|s<<4;return a}var Q=D?new Uint16Array(512):J(512),ee=D?new Uint16Array(32):J(32);if(!D){for(var te=0;te<512;++te)Q[te]=0;for(te=0;te<32;++te)ee[te]=0}!function(){for(var e=[],t=0;t<32;t++)e.push(5);q(e,ee,32);var r=[];for(t=0;t<=143;t++)r.push(8);for(;t<=255;t++)r.push(9);for(;t<=279;t++)r.push(7);for(;t<=287;t++)r.push(8);q(r,Q,288)}();var re=function(){for(var e=D?new Uint8Array(32768):[],t=0,r=0;t<C.length-1;