/*!
 * ExcelPlus JavaScript Library v2.4.1
 *
 * Copyright 2016, aymeric@kodono.info
 * Licensed under GPL Version 3 licenses.
 *
 * http://aymkdn.github.io/ExcelPlus/
 */
function addEventListener(e,t,r){e.addEventListener?e.addEventListener(t,r):e.attachEvent&&e.attachEvent("on"+t,function(){r.call(e)})}function ExcelPlus(e){this.aLetters=[],this.aLetters.A=1,this.aLetters.B=2,this.aLetters.C=3,this.aLetters.D=4,this.aLetters.E=5,this.aLetters.F=6,this.aLetters.G=7,this.aLetters.H=8,this.aLetters.I=9,this.aLetters.J=10,this.aLetters.K=11,this.aLetters.L=12,this.aLetters.M=13,this.aLetters.N=14,this.aLetters.O=15,this.aLetters.P=16,this.aLetters.Q=17,this.aLetters.R=18,this.aLetters.S=19,this.aLetters.T=20,this.aLetters.U=21,this.aLetters.V=22,this.aLetters.W=23,this.aLetters.X=24,this.aLetters.Y=25,this.aLetters.Z=26,this.oSheet=null,this.selectedSheet="",this.nbSheets=0,this.oFile=null,this.nbRows=0,this.nbColumns=0,this.filename="",this.usedRange="",this.flashUsed=!1,e=e||{},this.error="",this.showErrors=void 0===e.showErrors?!0:e.showErrors,this.fmtidDatesNum=[14,15,16,17,18,19,20,21,22,27,28,29,30,31,32,33,34,35,36,45,46,47,50,51,52,53,54,55,56,57,58],this.fmtidDates={};for(var t=0;t<this.fmtidDatesNum.length;t++)this.fmtidDates[this.fmtidDatesNum[t]]=!0}var __ExcelPlus_flashPath="";ExcelPlus.prototype={reset:function(){return this.oFile=null,this.nbSheets=0,this.nbRows=0,this.nbColumns=0,this.usedRange="",this.oSheet=null,this.selectedSheet="",this},openLocal:function(e,t){if("function"==typeof e&&(t=e,e={}),t=t||function(){},e.idButton=e.idButton||"file-object",null===document.getElementById(e.idButton))return this.error="[openLocal] You must have a <object> tag in your code.",this._showErrors(),this;e.labelButton=e.labelButton||"Load a file",__ExcelPlus_flashPath=e.flashPath||"";var r=this;return"function"==typeof FileReader?(document.getElementById(e.idButton).outerHTML='<input id="'+e.idButton+'" type="file" value="'+e.labelButton+'" />',addEventListener(document.getElementById(e.idButton),"change",function(e){var s,i=e.target.files;if(i&&0!=i.length){s=i[0];var n=new FileReader;n.onload=function(e){r.filename=s.name,r.oFile=XLSX.read(e.target.result,{type:"binary",cellDates:!0,cellStyles:!0}),r.nbSheets=r.oFile.SheetNames.length,1==r.nbSheets&&r.selectSheet(1),t.call(r,!0)},n.readAsArrayBuffer(s)}})):(r.flashUsed=!0,Flash.getButtonLabel=function(){return e.labelButton},Flash.createButton(e.idButton,function(e){r.filename="Unknown Name",r.oFile=XLSX.read(e,{type:"base64",cellDates:!0,cellStyles:!0}),r.nbSheets=r.oFile.SheetNames.length,1==r.nbSheets&&r.selectSheet(1),t.call(r,!0)})),r},openRemote:function(e,t){var r=this,s=new XMLHttpRequest,i=function(e){return e};if(s.open("GET",e,!0),s.overrideMimeType)s.overrideMimeType("text/plain; charset=x-user-defined");else{s.setRequestHeader("Accept-Charset","x-user-defined");var n='<script language="VBScript">\r\nFunction IEBinaryToArray_ByteStr(Binary)\r\n  IEBinaryToArray_ByteStr = CStr(Binary)\r\nEnd Function\r\nFunction IEBinaryToArray_ByteStr_Last(Binary)\r\n  Dim lastIndex\r\n  lastIndex = LenB(Binary)\r\n  if lastIndex mod 2 Then\r\n    IEBinaryToArray_ByteStr_Last = Chr( AscB( MidB( Binary, lastIndex, 1 ) ) )\r\n  Else\r\n    IEBinaryToArray_ByteStr_Last = ""\r\n  End If\r\nEnd Function\r\n</script>\r\n';document.write(n),i=function(e){for(var t={},r=0;256>r;r++)for(var s=0;256>s;s++)t[String.fromCharCode(r+256*s)]=String.fromCharCode(r)+String.fromCharCode(s);var i=IEBinaryToArray_ByteStr(e),n=IEBinaryToArray_ByteStr_Last(e);return i.replace(/[\s\S]/g,function(e){return t[e]})+n}}return s.onreadystatechange=function(){if(4==s.readyState)if(200==s.status){r.filename=e.split("/").slice(-1);var n=s.overrideMimeType?s.responseText:i(s.responseBody);r.oFile=XLSX.read(n,{type:"binary",cellDates:!0,cellStyles:!0}),r.nbSheets=r.oFile.SheetNames.length,1==r.nbSheets&&r.selectSheet(1),t.call(r,!0)}else r.error="[openRemote] Cannot find the remote file",r._showErrors(),t.call(r,!1)},s.send(null),this},getSheetNames:function(){return null==this.oFile?(this.error="[getSheetNames] No Excel file opened.",this._showErrors(),this):this.oFile.SheetNames},selectSheet:function(e){if(null==this.oFile)return this.error="[selectSheet] No Excel file opened.",this._showErrors(),this;if(!isNaN(e)){var t=this.getSheetNames();e-=1;var r=t.length;if(e>=r)return this.error="[selectSheet] Impossible to select sheet #"+e+" because only "+r+" sheet"+(r>1?"s":"")+" found in the file.",this._showErrors(),this;for(var s=0;r>s;s++)if(e==s){e=t[s];break}}if(!isNaN(e))return this.error="[selectSheet] Impossible to select sheet #"+e+" because I cannot find it.",this._showErrors(),this;if(-1===this.oFile.SheetNames.indexOf(e))return this.error="[selectSheet] Impossible to select sheet "+e+" because there is no sheet with that name.",this._showErrors(),this;if(this.oSheet=this.oFile.Sheets[e],this.selectedSheet=e,this.oSheet["!ref"]){this.usedRange=this.oSheet["!ref"];var i=this._getCellCoord(this.usedRange.split(":")[1]);this.nbRows=1*i.row,this.nbColumns=1*i.column}return this},readAll:function(e){if(0==this._checkSheet())return this.error="[readAll] You have to select a sheet before using `readAll`",this._showErrors(),this;for(var t,r=[],s=1;s<=this.nbRows;s++){t=[];for(var i=1;i<=this.nbColumns;i++)t.push(this.read(this._getColumnName(i)+""+s,e));r.push(t)}return r},read:function(e,t){if(0==this._checkSheet())return this;t=t||{},t.parseDate=t.parseDate===!0,t.properties=t.properties===!0;var r=null;if(this._isRange(e)){e=XLSX.utils.decode_range(e);var s,i,n=[],o=[];for(s=e.s.r;s<=e.e.r;++s){for(o=[],i=e.s.c;i<=e.e.c;++i)o.push(this.read(XLSX.utils.encode_cell({c:i,r:s}),t));n.push(o)}return n}if(this._isCell(e)){if(r=this.oSheet[e]){if("n"===r.t&&r.fmtid&&r.fmt&&(this.fmtidDates[r.fmtid]||/((?=([^[]*\[[^[\]]*\])*([^[]*[ymdhs]+[^\]]*))|.*\[(h|mm|ss)\].*)/.test(r.fmt))&&(r.t="d"),t.properties)return r;"d"===r.t&&t.parseDate?(r=XLSX.SSF.parse_date_code(r.v),r=new Date(r.y,r.m-1,r.d,r.H,r.M,r.S)):r=r.w||r.v}else r=null;return r}return null},createFile:function(e){e=e||["Sheet1"],"string"==typeof e&&(e=[e]),this.oFile={SheetNames:[],Sheets:{}};for(var t=0;t<e.length;t++)if(this.createSheet(e[t])===!1)return this;return this},write:function(e){if(e.sheet=e.sheet||this.selectedSheet||this.oFile.SheetNames[0],this.selectSheet(e.sheet),"undefined"==typeof e.content)return this.error="[write] Please provide the 'content'",this._showErrors(),this;if(Array.isArray(e.content))e.cell=null;else if(!e.cell)return this.error="[write] Please provide the 'cell' reference",this._showErrors(),this;if(e.cell)this.writeCell(e.cell,e.content);else{var t,r,s,i,n=e.content;for(t=0;t!=n.length;++t)for(r=0;r!=n[t].length;++r)i=this._createCell(n[t][r]),null!=i.v&&(s=XLSX.utils.encode_cell({c:r,r:t}),this.oFile.Sheets[this.selectedSheet][s]=i,this._updateUsedRange(s))}return this.oSheet=this.oFile.Sheets[this.selectedSheet],this},writeCell:function(e,t){return this.selectedSheet?"undefined"==typeof t?(this.error="[writeCell] You have to provide the content",this._showErrors(),this):this._isCell(e)?(null==t?delete this.oFile.Sheets[this.selectedSheet][e]:this.oFile.Sheets[this.selectedSheet][e]=this._createCell(t),this._updateUsedRange(e),this.selectSheet(this.selectedSheet),this):(this.error="[writeCell] You have to provide a cell reference, e.g. 'A1'",this._showErrors(),this):this.oFile.SheetNames.length>0?(this.error="[writeCell] No sheet selected",this._showErrors(),this):(this.error="[writeCell] You have to create a sheet first",this._showErrors(),this)},writeRow:function(e,t){if(!this.selectedSheet)return this.oFile.SheetNames.length>0?(this.error="[writeRow] No sheet selected",this._showErrors(),this):(this.error="[writeRow] You have to create a sheet first",this._showErrors(),this);if("undefined"==typeof t)return this.error="[writeRow] You have to provide the content",this._showErrors(),this;if(isNaN(e))return this.error="[writeRow] You have to provide a row reference, e.g. '1'",this._showErrors(),this;if("[object Array]"!==Object.prototype.toString.call(t))return this.error="[writeRow] You have to provide an array for the content",this._showErrors(),this;for(var r=0;r<t.length;r++)this.writeCell(this._getColumnName(r+1)+""+e,t[r]);return this},writeNextRow:function(e){return"[object Array]"!==Object.prototype.toString.call(e)?(this.error="[writeRow] You have to provide an array for the content",this._showErrors(),this):(this.writeRow(this.nbRows+1,e),this)},deleteSheet:function(e){if(e=e||this.selectedSheet){delete this.oFile.Sheets[e],e==this.selectedSheet&&(this.selectedSheet="");var t=this.oFile.SheetNames.indexOf(e);t>-1&&this.oFile.SheetNames.splice(t,1)}return this},createSheet:function(e,t){return t=void 0===t?!0:t,e?-1!==this.oFile.SheetNames.indexOf(e)?(this.error="[createSheet] There is already a sheet with the name '"+e+"'",this._showErrors(),this):(this.oFile.SheetNames.push(e),this.oFile.Sheets[e]={"!ref":"A1:A1"},t&&this.selectSheet(e),this):(this.error="[createSheet] You have to provide a name for the sheet",this._showErrors(),this)},saveAs:function(e){e=e||"book1.xlsx";var t=e.split(".").pop();if(-1===["xlsx","xlsm","xlsb"].indexOf(t)&&(t="xlsx",e+="."+t),"undefined"==typeof Uint8Array)return this.error="[saveAs] Sorry but this function is only supported by modern browsers",this._showErrors(),this;var r=XLSX.write(this.oFile,{bookType:t,bookSST:!0,type:"binary"}),s=function(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),s=0;s!=e.length;++s)r[s]=255&e.charCodeAt(s);return t};return saveAs(new Blob([s(r)],{type:"application/octet-stream"}),e),this},saveTo:function(e,t){return XLSX.write(this.oFile,{bookType:e||"xlsx",bookSST:!0,type:t||"base64"})},_createCell:function(e){var t={v:e,t:this._getValueType(e)};return e instanceof Date&&(t.z=XLSX.SSF._table[14],t.v=this._dateToNum(e)),t},_updateUsedRange:function(e){var t=XLSX.utils.decode_range(this.oSheet["!ref"]);this._isCell(e)&&(e=this._getCellCoord(e)),e.row-=1,e.column-=1;var r=!1;if(t.s.r>e.row&&(r=!0,t.s.r=e.row),t.s.c>e.column&&(r=!0,t.s.c=e.column),t.e.r<e.row&&(r=!0,t.e.r=e.row),t.e.c<e.column&&(r=!0,t.e.c=e.column),r){t=XLSX.utils.encode_range(t),this.oFile.Sheets[this.selectedSheet]["!ref"]=t,this.usedRange=t;var s=this._getCellCoord(this.usedRange.split(":")[1]);this.nbRows=1*s.row,this.nbColumns=1*s.column}return this},_getValueType:function(e){return"number"==typeof e?"n":"boolean"==typeof e?"b":e instanceof Date?"n":"s"},_dateToNum:function(e,t){t&&(e+=1462);var r=Date.parse(e);return(r-new Date(Date.UTC(1899,11,30)))/864e5},_getColumn:function(e){var t=0;if(1==e.length)return this.aLetters[e];if(e.length>1){for(var r=e.split(""),s=r.length,i=0;s>i;i++)t+=s>i+1?26*this.aLetters[r[i]]:this.aLetters[r[i]];return t}return 0},_getColumnName:function(e){if(26>=e){var t=1;for(var r in this.aLetters)if(1==r.length){if(t==e)return r;t++}}else{var s=0;do e-=26,s++;while(e>26);var i="",t=1;for(var r in this.aLetters)if(1==r.length){if(t==s){i=r;break}t++}t=1;for(var r in this.aLetters)if(1==r.length){if(t==e)return i+""+r;t++}}},_getCellCoord:function(e){var t=e.match(/([A-Z]+)([0-9]+)/);return null==t||3!=t.length?(this.error="[_getCellCoord] The format of the cell is wrong.",this._showErrors(),this):{column:this._getColumn(t[1]),row:1*t[2]}},_getColorIndex:function(e){if(!isNaN(e))return e;switch(e){case"black":return 1;case"white":return 2;case"red":return 3;case"green":return 4;case"darkblue":return 5;case"blue":return 23;case"yellow":return 6;case"magenta":return 7;case"cyan":return 8;case"purple":return 13;case"lightgray":return 15;case"gray":return 16;case"orange":return 45;default:return this.error="[_getColorIndex] '"+e+"' is an unknown color. Known colors are: black, white, red, green, blue, yellow, magenta and cyan",this._showErrors(),this}},_isRange:function(e){return"string"==typeof e&&-1!=e.indexOf(":")&&null!=e.match(/[1-9]/)},_isCell:function(e){return"string"==typeof e&&-1==e.indexOf(":")&&null!=e.match(/[1-9]/)},_isColumn:function(e){return"string"==typeof e&&null==e.match(/[1-9]/)},_checkSheet:function(){return null==this.oSheet?(this.error="[_checkSheet] Please select a sheet first",this._showErrors(),this):void 0},_showErrors:function(){if(this.showErrors){if(""!==this.error)throw"[ExcelPlus] "+this.error;console.log("[ExcelPlus] No Error")}}};var swfobject,__Flash_getFileData_callback,Flash={callback:function(){},createButton:function(e,t){if("function"==typeof t&&(this.callback=t),__Flash_getFileData_callback=this.callback,void 0==swfobject){var r=document.createElement("script");return r.setAttribute("type","text/javascript"),r.setAttribute("src",__ExcelPlus_flashPath+"/swfobject.js"),document.getElementsByTagName("head")[0].appendChild(r),this._waitForObjectToBeLoaded(e,t)}var s=Flash.getButtonLabel(),i=8*s.length;swfobject.embedSWF(__ExcelPlus_flashPath+"/FileToDataURI.swf",e,i+"px","22px","10",__ExcelPlus_flashPath+"/expressInstall.swf",{},{},{})},getFileData:function(e){__Flash_getFileData_callback(e)},_waitForObjectToBeLoaded:function(e,t){void 0==swfobject?setTimeout(function(){Flash._waitForObjectToBeLoaded(e,t)},50):this.createButton(e,t)}};

/*! FileSaver.js
 *  A saveAs() FileSaver implementation.
 *  2014-01-24
 *
 *  By Eli Grey, http://eligrey.com
 *  License: X11/MIT
 *    See LICENSE.md
 */
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
;var saveAs=saveAs||(typeof navigator!=="undefined"&&navigator.msSaveOrOpenBlob&&navigator.msSaveOrOpenBlob.bind(navigator))||(function(h){if(typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var r=h.document,l=function(){return h.URL||h.webkitURL||h},e=h.URL||h.webkitURL||h,n=r.createElementNS("http://www.w3.org/1999/xhtml","a"),g=!h.externalHost&&"download" in n,j=function(t){var s=r.createEvent("MouseEvents");s.initMouseEvent("click",true,false,h,0,0,0,0,0,false,false,false,false,0,null);t.dispatchEvent(s)},o=h.webkitRequestFileSystem,p=h.requestFileSystem||o||h.mozRequestFileSystem,m=function(s){(h.setImmediate||h.setTimeout)(function(){throw s},0)},c="application/octet-stream",k=0,b=[],i=function(){var t=b.length;while(t--){var s=b[t];if(typeof s==="string"){e.revokeObjectURL(s)}else{s.remove()}}b.length=0},q=function(t,s,w){s=[].concat(s);var v=s.length;while(v--){var x=t["on"+s[v]];if(typeof x==="function"){try{x.call(t,w||t)}catch(u){m(u)}}}},f=function(t,v){var w=this,C=t.type,F=false,y,x,s=function(){var G=l().createObjectURL(t);b.push(G);return G},B=function(){q(w,"writestart progress write writeend".split(" "))},E=function(){if(F||!y){y=s(t)}if(x){x.location.href=y}else{if(navigator.userAgent.match(/7\.[\d\s\.]+Safari/)&&typeof window.FileReader!=="undefined"&&t.size<=1024*1024*150){var G=new window.FileReader();G.readAsDataURL(t);G.onloadend=function(){var H=r.createElement("iframe");H.src=G.result;H.style.display="none";r.body.appendChild(H);B();return};w.readyState=w.DONE;w.savedAs=w.SAVEDASUNKNOWN;return}else{window.open(y,"_blank");w.readyState=w.DONE;w.savedAs=w.SAVEDASBLOB;B();return}}},A=function(G){return function(){if(w.readyState!==w.DONE){return G.apply(this,arguments)}}},z={create:true,exclusive:false},D;w.readyState=w.INIT;if(!v){v="download"}if(g){y=s(t);r=h.document;n=r.createElementNS("http://www.w3.org/1999/xhtml","a");n.href=y;n.download=v;var u=r.createEvent("MouseEvents");u.initMouseEvent("click",true,false,h,0,0,0,0,0,false,false,false,false,0,null);n.dispatchEvent(u);w.readyState=w.DONE;w.savedAs=w.SAVEDASBLOB;B();return}if(h.chrome&&C&&C!==c){D=t.slice||t.webkitSlice;t=D.call(t,0,t.size,c);F=true}if(o&&v!=="download"){v+=".download"}if(C===c||o){x=h}if(!p){E();return}k+=t.size;p(h.TEMPORARY,k,A(function(G){G.root.getDirectory("saved",z,A(function(H){var I=function(){H.getFile(v,z,A(function(J){J.createWriter(A(function(K){K.onwriteend=function(L){x.location.href=J.toURL();b.push(J);w.readyState=w.DONE;w.savedAs=w.SAVEDASBLOB;q(w,"writeend",L)};K.onerror=function(){var L=K.error;if(L.code!==L.ABORT_ERR){E()}};"writestart progress write abort".split(" ").forEach(function(L){K["on"+L]=w["on"+L]});K.write(t);w.abort=function(){K.abort();w.readyState=w.DONE;w.savedAs=w.FAILED};w.readyState=w.WRITING}),E)}),E)};H.getFile(v,{create:false},A(function(J){J.remove();I()}),A(function(J){if(J.code===J.NOT_FOUND_ERR){I()}else{E()}}))}),E)}),E)},d=f.prototype,a=function(s,t){return new f(s,t)};d.abort=function(){var s=this;s.readyState=s.DONE;s.savedAs=s.FAILED;q(s,"abort")};d.readyState=d.INIT=0;d.WRITING=1;d.DONE=2;d.FAILED=-1;d.SAVEDASBLOB=1;d.SAVEDASURI=2;d.SAVEDASUNKNOWN=3;d.error=d.onwritestart=d.onprogress=d.onwrite=d.onabort=d.onerror=d.onwriteend=null;h.addEventListener("unload",i,false);a.unload=function(){i();h.removeEventListener("unload",i,false)};return a}(typeof self!=="undefined"&&self||typeof window!=="undefined"&&window||this.content));
