sheetjs/dist/shim.min.js

2 lines
6.2 KiB
JavaScript

/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
if(!Object.keys){Object.keys=function(){var t=Object.prototype.hasOwnProperty,e=!{toString:null}.propertyIsEnumerable("toString"),r=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],i=r.length;return function(n){if(typeof n!=="object"&&typeof n!=="function"||n===null)throw new TypeError("Object.keys called on non-object");var o=[];for(var a in n){if(t.call(n,a))o.push(a)}if(e){for(var f=0;f<i;f++){if(t.call(n,r[f]))o.push(r[f])}}return o}}()}if(!Array.prototype.filter){Array.prototype.filter=function(t){"use strict";if(this==null)throw new TypeError;var e=Object(this);var r=e.length>>>0;if(typeof t!="function")throw new TypeError;var i=[];var n=arguments[1];for(var o=0;o<r;o++){if(o in e){var a=e[o];if(t.call(n,a,o,e))i.push(a)}}return i}}if(!String.prototype.trim){String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}}if(!Array.prototype.forEach){Array.prototype.forEach=function(t){"use strict";if(this===void 0||this===null)throw new TypeError;var e=Object(this);var r=e.length>>>0;if(typeof t!=="function")throw new TypeError;var i=arguments.length>=2?arguments[1]:void 0;for(var n=0;n<r;n++){if(n in e)t.call(i,e[n],n,e)}}}if(!Array.prototype.map){Array.prototype.map=function(t,e){var r,i,n;if(this==null){throw new TypeError(" this is null or not defined")}var o=Object(this);var a=o.length>>>0;if(typeof t!=="function"){throw new TypeError(t+" is not a function")}if(e){r=e}i=new Array(a);n=0;while(n<a){var f,l;if(n in o){f=o[n];l=t.call(r,f,n,o);i[n]=l}n++}return i}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(t,e){if(this===undefined||this===null){throw new TypeError('"this" is null or not defined')}var r=this.length>>>0;e=+e||0;if(Math.abs(e)===Infinity){e=0}if(e<0){e+=r;if(e<0){e=0}}for(;e<r;e++){if(this[e]===t){return e}}return-1}}if(!Array.isArray){Array.isArray=function(t){return Object.prototype.toString.call(t)==="[object Array]"}}"use strict";if(typeof ArrayBuffer!=="undefined"&&!ArrayBuffer.prototype.slice){ArrayBuffer.prototype.slice=function(t,e){t=t|0||0;var r=this.byteLength;e=e===void 0?r:e|0;if(t<0)t+=r;if(e<0)e+=r;if(r===0||t>=r||t>=e){return new ArrayBuffer(0)}var i=Math.min(r-t,e-t);var n=new ArrayBuffer(i);var o=new Uint8Array(n);o.set(new Uint8Array(this,t,i));return n}}(function(){var t=typeof exports!="undefined"?exports:typeof self!="undefined"?self:$.global;var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function r(t){this.message=t}r.prototype=new Error;r.prototype.name="InvalidCharacterError";t.btoa||(t.btoa=function(t){var i=String(t);for(var n,o,a=0,f=e,l="";i.charAt(a|0)||(f="=",a%1);l+=f.charAt(63&n>>8-a%1*8)){o=i.charCodeAt(a+=3/4);if(o>255){throw new r("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.")}n=n<<8|o}return l});t.atob||(t.atob=function(t){var i=String(t).replace(/[=]+$/,"");if(i.length%4==1){throw new r("'atob' failed: The string to be decoded is not correctly encoded.")}for(var n=0,o,a,f=0,l="";a=i.charAt(f++);~a&&(o=n%4?o*64+a:a,n++%4)?l+=String.fromCharCode(255&o>>(-2*n&6)):0){a=e.indexOf(a)}return l})})();if(!Date.prototype.toISOString){(function(){function t(t){if(t<10){return"0"+t}return t}Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+t(this.getUTCMonth()+1)+"-"+t(this.getUTCDate())+"T"+t(this.getUTCHours())+":"+t(this.getUTCMinutes())+":"+t(this.getUTCSeconds())+"."+(this.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}})()}if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.slice)Uint8Array.prototype.slice=function(t,e){if(t<0){t+=this.length;if(t<0)t=0}if(t>=this.length)return new Uint8Array(0);if(e==null)e=this.length;if(e<0){e+=this.length;if(e<0)e=0}if(e>this.length)e=this.length;var r=new Uint8Array(e-t);while(t<=--e)r[e-t]=this[e];return r};var IE_SaveFile=function(){try{if(typeof IE_SaveFile_Impl=="undefined")document.write(['<script type="text/vbscript" language="vbscript">','IE_GetProfileAndPath_Key = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\\"','Function IE_GetProfileAndPath(key): Set wshell = CreateObject("WScript.Shell"): IE_GetProfileAndPath = wshell.RegRead(IE_GetProfileAndPath_Key & key): IE_GetProfileAndPath = wshell.ExpandEnvironmentStrings("%USERPROFILE%") & "!" & IE_GetProfileAndPath: End Function','Function IE_SaveFile_Impl(FileName, payload): Dim data, plen, i, bit: data = CStr(payload): plen = Len(data): Set fso = CreateObject("Scripting.FileSystemObject"): fso.CreateTextFile FileName, True: Set f = fso.GetFile(FileName): Set stream = f.OpenAsTextStream(2, 0): For i = 1 To plen Step 3: bit = Mid(data, i, 2): stream.write Chr(CLng("&h" & bit)): Next: stream.Close: IE_SaveFile_Impl = True: End Function',"|/script>".replace("|","<")].join("\r\n"));if(typeof IE_SaveFile_Impl=="undefined")return void 0;var t=function(){var t="";try{t=IE_GetProfileAndPath("{374DE290-123F-4565-9164-39C4925E467B}")}catch(e){try{t=IE_GetProfileAndPath("Personal")}catch(e){try{t=IE_GetProfileAndPath("Desktop")}catch(e){throw e}}}var r=t.split("!");DDP=r[1].replace("%USERPROFILE%",r[0]);return function(t){return DDP+"\\"+t}}();function e(t){var e=[];var r=typeof t=="string";for(var i=0;i<t.length;++i)e.push(("00"+(r?t.charCodeAt(i):t[i]).toString(16)).slice(-2));var n=e.join("|");return n}return function(r,i){return IE_SaveFile_Impl(t(i),e(r))}}catch(r){return void 0}}();var IE_LoadFile=function(){try{if(typeof IE_LoadFile_Impl=="undefined")document.write(['<script type="text/vbscript" language="vbscript">','Function IE_LoadFile_Impl(FileName): Dim out(), plen, i, cc: Set fso = CreateObject("Scripting.FileSystemObject"): Set f = fso.GetFile(FileName): Set stream = f.OpenAsTextStream(1, 0): plen = f.Size: ReDim out(plen): For i = 1 To plen Step 1: cc = Hex(Asc(stream.read(1))): If Len(cc) < 2 Then: cc = "0" & cc: End If: out(i) = cc: Next: IE_LoadFile_Impl = Join(out,""): End Function',"|/script>".replace("|","<")].join("\r\n"));if(typeof IE_LoadFile_Impl=="undefined")return void 0;function t(t){var e=[];for(var r=0;r<t.length;r+=2)e.push(String.fromCharCode(parseInt(t.slice(r,r+2),16)));var i=e.join("");return i}return function(e){return t(IE_LoadFile_Impl(e))}}catch(e){return void 0}}();