mirror of
https://github.com/pierre42100/comunic
synced 2024-11-27 15:59:30 +00:00
171 lines
109 KiB
JavaScript
171 lines
109 KiB
JavaScript
|
/**
|
||
|
* jsPDF - PDF Document creation from JavaScript
|
||
|
* Version 1.0.150-git Built on 2014-05-30T00:40
|
||
|
* CommitID dcbc9fcb9b
|
||
|
*
|
||
|
* Copyright (c) 2010-2014 James Hall, https://github.com/MrRio/jsPDF
|
||
|
* 2010 Aaron Spike, https://github.com/acspike
|
||
|
* 2012 Willow Systems Corporation, willow-systems.com
|
||
|
* 2012 Pablo Hess, https://github.com/pablohess
|
||
|
* 2012 Florian Jenett, https://github.com/fjenett
|
||
|
* 2013 Warren Weckesser, https://github.com/warrenweckesser
|
||
|
* 2013 Youssef Beddad, https://github.com/lifof
|
||
|
* 2013 Lee Driscoll, https://github.com/lsdriscoll
|
||
|
* 2013 Stefan Slonevskiy, https://github.com/stefslon
|
||
|
* 2013 Jeremy Morel, https://github.com/jmorel
|
||
|
* 2013 Christoph Hartmann, https://github.com/chris-rock
|
||
|
* 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria
|
||
|
* 2014 James Makes, https://github.com/dollaruw
|
||
|
* 2014 Diego Casorran, https://github.com/diegocr
|
||
|
*
|
||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||
|
* a copy of this software and associated documentation files (the
|
||
|
* "Software"), to deal in the Software without restriction, including
|
||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||
|
* permit persons to whom the Software is furnished to do so, subject to
|
||
|
* the following conditions:
|
||
|
*
|
||
|
* The above copyright notice and this permission notice shall be
|
||
|
* included in all copies or substantial portions of the Software.
|
||
|
*
|
||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||
|
*
|
||
|
* Contributor(s):
|
||
|
* siefkenj, ahwolf, rickygu, Midnith, saintclair, eaparango,
|
||
|
* kim3er, mfo, alnorth,
|
||
|
*/
|
||
|
/**
|
||
|
* jsPDF addHTML PlugIn
|
||
|
* Copyright (c) 2014 Diego Casorran
|
||
|
* Licensed under the MIT License.
|
||
|
* http://opensource.org/licenses/mit-license
|
||
|
*/
|
||
|
/**
|
||
|
* jsPDF addImage plugin
|
||
|
* Copyright (c) 2012 Jason Siefken, https://github.com/siefkenj/
|
||
|
* 2013 Chris Dowling, https://github.com/gingerchris
|
||
|
* 2013 Trinh Ho, https://github.com/ineedfat
|
||
|
* 2013 Edwin Alejandro Perez, https://github.com/eaparango
|
||
|
* 2013 Norah Smith, https://github.com/burnburnrocket
|
||
|
* 2014 Diego Casorran, https://github.com/diegocr
|
||
|
* 2014 James Robb, https://github.com/jamesbrobb
|
||
|
*/
|
||
|
/**
|
||
|
* jsPDF Cell plugin
|
||
|
* Copyright (c) 2013 Youssef Beddad, youssef.beddad@gmail.com
|
||
|
* 2013 Eduardo Menezes de Morais, eduardo.morais@usp.br
|
||
|
* 2013 Lee Driscoll, https://github.com/lsdriscoll
|
||
|
* 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria
|
||
|
* 2014 James Hall, james@parall.ax
|
||
|
* 2014 Diego Casorran, https://github.com/diegocr
|
||
|
*/
|
||
|
/**
|
||
|
* jsPDF fromHTML plugin. BETA stage. API subject to change. Needs browser
|
||
|
* Copyright (c) 2012 Willow Systems Corporation, willow-systems.com
|
||
|
* 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria
|
||
|
* 2014 Diego Casorran, https://github.com/diegocr
|
||
|
* 2014 Daniel Husar, https://github.com/danielhusar
|
||
|
* 2014 Wolfgang Gassler, https://github.com/woolfg
|
||
|
*/
|
||
|
/**
|
||
|
* jsPDF JavaScript plugin
|
||
|
* Copyright (c) 2013 Youssef Beddad, youssef.beddad@gmail.com
|
||
|
*/
|
||
|
/**
|
||
|
* jsPDF PNG PlugIn
|
||
|
* Copyright (c) 2014 James Robb, https://github.com/jamesbrobb
|
||
|
*/
|
||
|
/**
|
||
|
jsPDF Silly SVG plugin
|
||
|
Copyright (c) 2012 Willow Systems Corporation, willow-systems.com
|
||
|
*/
|
||
|
/**
|
||
|
* jsPDF split_text_to_size plugin - MIT license.
|
||
|
* Copyright (c) 2012 Willow Systems Corporation, willow-systems.com
|
||
|
* 2014 Diego Casorran, https://github.com/diegocr
|
||
|
*/
|
||
|
/**
|
||
|
jsPDF standard_fonts_metrics plugin
|
||
|
Copyright (c) 2012 Willow Systems Corporation, willow-systems.com
|
||
|
MIT license.
|
||
|
*/
|
||
|
/**
|
||
|
* jsPDF total_pages plugin
|
||
|
* Copyright (c) 2013 Eduardo Menezes de Morais, eduardo.morais@usp.br
|
||
|
*/
|
||
|
/* Blob.js
|
||
|
* A Blob implementation.
|
||
|
* 2014-05-27
|
||
|
* By Eli Grey, http://eligrey.com
|
||
|
* By Devin Samarin, https://github.com/eboyjr
|
||
|
* License: X11/MIT
|
||
|
* See https://github.com/eligrey/Blob.js/blob/master/LICENSE.md
|
||
|
*/
|
||
|
/* FileSaver.js
|
||
|
* A saveAs() FileSaver implementation.
|
||
|
* 2014-05-27
|
||
|
* By Eli Grey, http://eligrey.com
|
||
|
* License: X11/MIT
|
||
|
* See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md
|
||
|
*/
|
||
|
/*
|
||
|
* Copyright (c) 2012 chick307 <chick307@gmail.com>
|
||
|
* Licensed under the MIT License.
|
||
|
* http://opensource.org/licenses/mit-license
|
||
|
*/
|
||
|
/*
|
||
|
Deflate.js - https://github.com/gildas-lormeau/zip.js
|
||
|
Copyright (c) 2013 Gildas Lormeau. All rights reserved.
|
||
|
Redistribution and use in source and binary forms, with or without
|
||
|
modification, are permitted provided that the following conditions are met:
|
||
|
1. Redistributions of source code must retain the above copyright notice,
|
||
|
this list of conditions and the following disclaimer.
|
||
|
2. Redistributions in binary form must reproduce the above copyright
|
||
|
notice, this list of conditions and the following disclaimer in
|
||
|
the documentation and/or other materials provided with the distribution.
|
||
|
3. The names of the authors may not be used to endorse or promote products
|
||
|
derived from this software without specific prior written permission.
|
||
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
||
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||
|
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
||
|
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||
|
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
|
*/
|
||
|
/*
|
||
|
# PNG.js
|
||
|
# Copyright (c) 2011 Devon Govett
|
||
|
# MIT LICENSE
|
||
|
#
|
||
|
*/
|
||
|
/*
|
||
|
* Extracted from pdf.js
|
||
|
* https://github.com/andreasgal/pdf.js
|
||
|
* Copyright (c) 2011 Mozilla Foundation
|
||
|
* Contributors: Andreas Gal <gal@mozilla.com>
|
||
|
* Chris G Jones <cjones@mozilla.com>
|
||
|
* Shaon Barman <shaon.barman@gmail.com>
|
||
|
* Vivien Nicolas <21@vingtetun.org>
|
||
|
* Justin D'Arcangelo <justindarc@gmail.com>
|
||
|
* Yury Delendik
|
||
|
*/
|
||
|
/**
|
||
|
* JavaScript Polyfill functions for jsPDF
|
||
|
* Collected from public resources by
|
||
|
* https://github.com/diegocr
|
||
|
*/
|
||
|
!function(t,e){e["true"]=t;var r=function(t){"use strict";function e(e){var r={};this.subscribe=function(t,e,n){if("function"!=typeof e)return!1;r.hasOwnProperty(t)||(r[t]={});var s=Math.random().toString(35);return r[t][s]=[e,!!n],s},this.unsubscribe=function(t){for(var e in r)if(r[e][t])return delete r[e][t],!0;return!1},this.publish=function(n){if(r.hasOwnProperty(n)){var s=Array.prototype.slice.call(arguments,1),o=[];for(var i in r[n]){var a=r[n][i];try{a[0].apply(e,s)}catch(u){t.console&&console.error("jsPDF PubSub Error",u.message,u)}a[1]&&o.push(i)}o.length&&o.forEach(this.unsubscribe)}}}function r(a,u,c,l){var f={};"object"==typeof a&&(f=a,a=f.orientation,u=f.unit||u,c=f.format||c,l=f.compress||f.compressPdf||l),u=u||"mm",c=c||"a4",a=(""+(a||"P")).toLowerCase();var d,h,p,m,w,y=(""+c).toLowerCase(),g=!!l&&"function"==typeof Uint8Array,v=f.textColor||"0 g",b=f.drawColor||"0 G",q=f.fontSize||16,x=f.lineHeight||1.15,k=f.lineWidth||.200025,_=2,A=!1,C=[],S={},E={},z=0,I=[],T=[],B=0,O=0,P=0,R={title:"",subject:"",author:"",keywords:"",creator:""},D={},U=new e(D),F=function(t){return t.toFixed(2)},L=function(t){return t.toFixed(3)},j=function(t){return("0"+parseInt(t)).slice(-2)},N=function(t){A?I[z].push(t):(P+=t.length+1,T.push(t))},M=function(){return _++,C[_]=P,N(_+" 0 obj"),_},H=function(t){N("stream"),N(t),N("endstream")},G=function(){var e,n,o,i,a,u,c,l=m*h,f=w*h;for(c=t.adler32cs||r.adler32cs,g&&"undefined"==typeof c&&(g=!1),e=1;z>=e;e++){if(M(),N("<</Type /Page"),N("/Parent 1 0 R"),N("/Resources 2 0 R"),N("/Contents "+(_+1)+" 0 R>>"),N("endobj"),n=I[e].join("\n"),M(),g){for(o=[],i=n.length;i--;)o[i]=n.charCodeAt(i);u=c.from(n),a=new s(6),a.append(new Uint8Array(o)),n=a.flush(),o=new Uint8Array(n.length+6),o.set(new Uint8Array([120,156])),o.set(n,2),o.set(new Uint8Array([255&u,u>>8&255,u>>16&255,u>>24&255]),n.length+2),n=String.fromCharCode.apply(null,o),N("<</Length "+n.length+" /Filter [/FlateDecode]>>")}else N("<</Length "+n.length+">>");H(n),N("endobj")}C[1]=P,N("1 0 obj"),N("<</Type /Pages");var d="/Kids [";for(i=0;z>i;i++)d+=3+2*i+" 0 R ";N(d+"]"),N("/Count "+z),N("/MediaBox [0 0 "+F(l)+" "+F(f)+"]"),N(">>"),N("endobj")},J=function(t){t.objectNumber=M(),N("<</BaseFont/"+t.PostScriptName+"/Type/Font"),"string"==typeof t.encoding&&N("/Encoding/"+t.encoding),N("/Subtype/Type1>>"),N("endobj")},V=function(){for(var t in S)S.hasOwnProperty(t)&&J(S[t])},W=function(){U.publish("putXobjectDict")},X=function(){N("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),N("/Font <<");for(var t in S)S.hasOwnProperty(t)&&N("/"+t+" "+S[t].objectNumber+" 0 R");N(">>"),N("/XObject <<"),W(),N(">>")},Y=function(){V(),U.publish("putResources"),C[2]=P,N("2 0 obj"),N("<<"),X(),N(">>"),N("endobj"),U.publish("postPutResources")},K=function(t,e,r){E.hasOwnProperty(e)||(E[e]={}),E[e][r]=t},Q=function(t,e,r,n){var s="F"+(Object.keys(S).length+1).toString(10),o=S[s]={id:s,PostScriptName:t,fontName:e,fontStyle:r,encoding:n,metadata:{}};return K(s,e,r),U.publish("addFont",o),s},$=function(){for(var t="helvetica",e="times",r="courier",n="normal",s="bold",o="italic",i="bolditalic",a="StandardEncoding",u=[["Helvetica",t,n],["Helvetica-Bold",t,s],["Helvetica-Oblique",t,o],["Helvetica-BoldOblique",t,i],["Courier",r,n],["Courier-Bold",r,s],["Courier-Oblique",r,o],["Courier-BoldOblique",r,i],["Times-Roman",e,n],["Times-Bold",e,s],["Times-Italic",e,o],["Times-BoldItalic",e,i]],c=0,l=u.length;l>c;c++){var f=Q(u[c][0],u[c][1],u[c][2],a),d=u[c][0].split("-");K(f,d[0],d[1]||"")}U.publish("addFonts",{fonts:S,dictionary:E})},Z=function(e){return e.foo=function(){try{return e.apply(this,arguments)}catch(r){var n=r.stack||"";~n.indexOf(" at ")&&(n=n.split(" at ")[1]);var s="Error in function "+n.split("\n")[0].split("<")[0]+": "+r.message;if(!t.console)throw new Error(s);console.log(s,r),t.alert&&alert(s),console.trace()}},e.foo.bar=e,e.foo},te=function(t,e){var r,n,s,o,i,a,u,c,l;if(e=e||{},s=e.sourceEncoding||"Unicode",i=e.outputEncoding,(e.autoencode||i)&&S[d].metadata&&S[d].metadata[s]&&S[d].metadata[s].encoding&&(o=S[d].metadata[s].encoding,!i&&S[d].encod
|
||
|
for(var c=function(t){var s=void 0!==t?t.pageNumber:1,i=e.y;e.y=e.pdf.internal.pageSize.height-e.pdf.margins_doc.bottom,e.pdf.margins_doc.bottom-=u;for(var a=o.getElementsByTagName("span"),c=0;c<a.length;++c)(" "+a[c].className+" ").replace(/[\n\t]/g," ").indexOf(" pageCounter ")>-1&&(a[c].innerHTML=s),(" "+a[c].className+" ").replace(/[\n\t]/g," ").indexOf(" totalPages ")>-1&&(a[c].innerHTML="###jsPDFVarTotalPages###");r(o,e,n),e.pdf.margins_doc.bottom+=u,e.y=i},l=o.getElementsByTagName("span"),f=0;f<l.length;++f)(" "+l[f].className+" ").replace(/[\n\t]/g," ").indexOf(" totalPages ")>-1&&e.pdf.internal.events.subscribe("htmlRenderingFinished",e.pdf.putTotalPages.bind(e.pdf,"###jsPDFVarTotalPages###"),!0);e.pdf.internal.events.subscribe("addPage",c,!1),c(),g.FOOTER=1}s()},w=function(t,e,n,s,o,i){if(!e)return!1;"string"==typeof e||e.parentNode||(e=""+e.innerHTML),"string"==typeof e&&(e=function(t){var e,r,n,s;return n="jsPDFhtmlText"+Date.now().toString()+(1e3*Math.random()).toFixed(0),s="position: absolute !important;clip: rect(1px 1px 1px 1px); /* IE6, IE7 */clip: rect(1px, 1px, 1px, 1px);padding:0 !important;border:0 !important;height: 1px !important;width: 1px !important; top:auto;left:-100px;overflow: hidden;",r=document.createElement("div"),r.style.cssText=s,r.innerHTML='<iframe style="height:1px;width:1px" name="'+n+'" />',document.body.appendChild(r),e=window.frames[n],e.document.body.innerHTML=t,e.document.body}(e.replace(/<\/?script[^>]*?>/gi,"")));var a=new u(t,n,s,o);return i=i||function(){},p.call(this,e,a,o.elementHandlers,function(){m.call(this,e,a,o.elementHandlers,function(){r(e,a,o.elementHandlers),a.pdf.internal.events.publish("htmlRenderingFinished"),i(a.dispose())})}),a.dispose()},u.prototype.init=function(){return this.paragraph={text:[],style:[]},this.pdf.internal.write("q")},u.prototype.dispose=function(){return this.pdf.internal.write("Q"),{x:this.x,y:this.y}},u.prototype.splitFragmentsIntoLines=function(t,r){var n,s,o,i,a,u,c,l,f,d,h,p,m,w,y;for(s=12,h=this.pdf.internal.scaleFactor,a={},o=void 0,d=void 0,i=void 0,u=void 0,y=void 0,f=void 0,l=void 0,c=void 0,p=[],m=[p],n=0,w=this.settings.width;t.length;)if(u=t.shift(),y=r.shift(),u)if(o=y["font-family"],d=y["font-style"],i=a[o+d],i||(i=this.pdf.internal.getFont(o,d).metadata.Unicode,a[o+d]=i),f={widths:i.widths,kerning:i.kerning,fontSize:y["font-size"]*s,textIndent:n},l=this.pdf.getStringUnitWidth(u,f)*f.fontSize/h,n+l>w){for(c=this.pdf.splitTextToSize(u,w,f),p.push([c.shift(),y]);c.length;)p=[[c.shift(),y]],m.push(p);n=this.pdf.getStringUnitWidth(p[0][0],f)*f.fontSize/h}else p.push([u,y]),n+=l;if(void 0!==y["text-align"]&&("center"===y["text-align"]||"right"===y["text-align"]||"justify"===y["text-align"]))for(var g=0;g<m.length;++g){var v=this.pdf.getStringUnitWidth(m[g][0][0],f)*f.fontSize/h;g>0&&(m[g][0][1]=e(m[g][0][1]));var b=w-v;if("right"===y["text-align"])m[g][0][1]["margin-left"]=b;else if("center"===y["text-align"])m[g][0][1]["margin-left"]=b/2;else if("justify"===y["text-align"]){var q=m[g][0][0].split(" ").length-1;m[g][0][1]["word-spacing"]=b/q,g===m.length-1&&(m[g][0][1]["word-spacing"]=0)}}return m},u.prototype.RenderTextFragment=function(t,e){var r,n;this.pdf.internal.pageSize.height-this.pdf.margins_doc.bottom<this.y+this.pdf.internal.getFontSize()&&(this.pdf.internal.write("ET","Q"),this.pdf.addPage(),this.y=this.pdf.margins_doc.top,this.pdf.internal.write("q","BT",this.pdf.internal.getCoordinateString(this.x),this.pdf.internal.getVerticalCoordinateString(this.y),"Td")),r=12,n=this.pdf.internal.getFont(e["font-family"],e["font-style"]),void 0!==e["word-spacing"]&&e["word-spacing"]>0&&this.pdf.internal.write(e["word-spacing"].toFixed(2),"Tw"),this.pdf.internal.write("/"+n.id,(r*e["font-size"]).toFixed(2),"Tf","("+this.pdf.internal.pdfEscape(t)+") Tj"),void 0!==e["word-spacing"]&&this.pdf.internal.write(0,"Tw")},u.prototype.renderParagraph=function(t){var e,r,n,s,o,i,u,c,l,f,d,h,p,m,w;if(s=a(this.paragraph.text),m=this.paragraph.style,e=this.paragraph.blockstyle,p=this.paragraph.blockstyle||{},this.paragraph={text:[],style:[],blo
|
||
|
},o.toString=function(){return"[object Blob]"},o.close=function(){this.size=this.data.length=0},r}(t);t.Blob=function(t,e){var n=e?e.type||"":"",s=new r;if(t)for(var o=0,i=t.length;i>o;o++)s.append(t[o]);return s.getBlob(n)}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content||this);var n=n||"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob&&navigator.msSaveOrOpenBlob.bind(navigator)||function(t){"use strict";if("undefined"==typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var e=t.document,r=function(){return t.URL||t.webkitURL||t},n=e.createElementNS("http://www.w3.org/1999/xhtml","a"),s=!t.externalHost&&"download"in n,o=function(r){var n=e.createEvent("MouseEvents");n.initMouseEvent("click",!0,!1,t,0,0,0,0,0,!1,!1,!1,!1,0,null),r.dispatchEvent(n)},i=t.webkitRequestFileSystem,a=t.requestFileSystem||i||t.mozRequestFileSystem,u=function(e){(t.setImmediate||t.setTimeout)(function(){throw e},0)},c="application/octet-stream",l=0,f=[],d=function(){for(var t=f.length;t--;){var e=f[t];"string"==typeof e?r().revokeObjectURL(e):e.remove()}f.length=0},h=function(t,e,r){e=[].concat(e);for(var n=e.length;n--;){var s=t["on"+e[n]];if("function"==typeof s)try{s.call(t,r||t)}catch(o){u(o)}}},p=function(e,u){var d,p,m,w=this,y=e.type,g=!1,v=function(){var t=r().createObjectURL(e);return f.push(t),t},b=function(){h(w,"writestart progress write writeend".split(" "))},q=function(){(g||!d)&&(d=v(e)),p?p.location.href=d:window.open(d,"_blank"),w.readyState=w.DONE,b()},x=function(t){return function(){return w.readyState!==w.DONE?t.apply(this,arguments):void 0}},k={create:!0,exclusive:!1};return w.readyState=w.INIT,u||(u="download"),s?(d=v(e),n.href=d,n.download=u,o(n),w.readyState=w.DONE,b(),void 0):(t.chrome&&y&&y!==c&&(m=e.slice||e.webkitSlice,e=m.call(e,0,e.size,c),g=!0),i&&"download"!==u&&(u+=".download"),(y===c||i)&&(p=t),a?(l+=e.size,a(t.TEMPORARY,l,x(function(t){t.root.getDirectory("saved",k,x(function(t){var r=function(){t.getFile(u,k,x(function(t){t.createWriter(x(function(r){r.onwriteend=function(e){p.location.href=t.toURL(),f.push(t),w.readyState=w.DONE,h(w,"writeend",e)},r.onerror=function(){var t=r.error;t.code!==t.ABORT_ERR&&q()},"writestart progress write abort".split(" ").forEach(function(t){r["on"+t]=w["on"+t]}),r.write(e),w.abort=function(){r.abort(),w.readyState=w.DONE},w.readyState=w.WRITING}),q)}),q)};t.getFile(u,{create:!1},x(function(t){t.remove(),r()}),x(function(t){t.code===t.NOT_FOUND_ERR?r():q()}))}),q)}),q),void 0):(q(),void 0))},m=p.prototype,w=function(t,e){return new p(t,e)};return m.abort=function(){var t=this;t.readyState=t.DONE,h(t,"abort")},m.readyState=m.INIT=0,m.WRITING=1,m.DONE=2,m.error=m.onwritestart=m.onprogress=m.onwrite=m.onabort=m.onerror=m.onwriteend=null,t.addEventListener("unload",d,!1),w.unload=function(){d(),t.removeEventListener("unload",d,!1)},w}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);"undefined"!=typeof module&&null!==module?module.exports=n:"undefined"!=typeof define&&null!==define&&null!=define.amd&&define([],function(){return n}),void function(t,e){"object"==typeof module?module.exports=e():t.adler32cs=e()}(r,function(){var t="function"==typeof ArrayBuffer&&"function"==typeof Uint8Array,e=null,r=function(){if(!t)return function(){return!1};try{var r=require("buffer");"function"==typeof r.Buffer&&(e=r.Buffer)}catch(n){}return function(t){return t instanceof ArrayBuffer||null!==e&&t instanceof e}}(),n=function(){return null!==e?function(t){return new e(t,"utf8").toString("binary")}:function(t){return unescape(encodeURIComponent(t))}}(),s=65521,o=function(t,e){for(var r=65535&t,n=t>>>16,o=0,i=e.length;i>o;o++)r=(r+(255&e.charCodeAt(o)))%s,n=(n+r)%s;return(n<<16|r)>>>0},i=function(t,e){for(var r=65535&t,n=t>>>16,o=0,i=e.length;i>o;o++)r=(r+e[o])%s,n=(n+r)%s;return(n<<16|r)>>>0},a={},u=a.Adler32=function(){var e=function(t){if(!(this instanceof e))throw new TypeError("Constructor cannot called be as a function.");if(!isFinite(t=null==t?1:+t))throw new Error("First arguments needs to be a finite number
|
||
|
return e.prototype=Object.create(o.prototype),e.prototype.getBits=function(e){for(var r,n=this.codeSize,s=this.codeBuf,o=this.bytes,i=this.bytesPos;e>n;)"undefined"==typeof(r=o[i++])&&t("Bad encoding in flate stream"),s|=r<<n,n+=8;return r=s&(1<<e)-1,this.codeBuf=s>>e,this.codeSize=n-=e,this.bytesPos=i,r},e.prototype.getCode=function(e){for(var r=e[0],n=e[1],s=this.codeSize,o=this.codeBuf,i=this.bytes,a=this.bytesPos;n>s;){var u;"undefined"==typeof(u=i[a++])&&t("Bad encoding in flate stream"),o|=u<<s,s+=8}var c=r[o&(1<<n)-1],l=c>>16,f=65535&c;return(0==s||l>s||0==l)&&t("Bad encoding in flate stream"),this.codeBuf=o>>l,this.codeSize=s-l,this.bytesPos=a,f},e.prototype.generateHuffmanTable=function(t){for(var e=t.length,r=0,n=0;e>n;++n)t[n]>r&&(r=t[n]);for(var s=1<<r,o=new Uint32Array(s),i=1,a=0,u=2;r>=i;++i,a<<=1,u<<=1)for(var c=0;e>c;++c)if(t[c]==i){for(var l=0,f=a,n=0;i>n;++n)l=l<<1|1&f,f>>=1;for(var n=l;s>n;n+=u)o[n]=i<<16|c;++a}return[o,r]},e.prototype.readBlock=function(){function e(t,e,r,n,s){for(var o=t.getBits(r)+n;o-->0;)e[k++]=s}var o=this.getBits(3);if(1&o&&(this.eof=!0),o>>=1,0==o){var u,c=this.bytes,l=this.bytesPos;"undefined"==typeof(u=c[l++])&&t("Bad block header in flate stream");var f=u;"undefined"==typeof(u=c[l++])&&t("Bad block header in flate stream"),f|=u<<8,"undefined"==typeof(u=c[l++])&&t("Bad block header in flate stream");var d=u;"undefined"==typeof(u=c[l++])&&t("Bad block header in flate stream"),d|=u<<8,d!=(65535&~f)&&t("Bad uncompressed block length in flate stream"),this.codeBuf=0,this.codeSize=0;var h=this.bufferLength,p=this.ensureBuffer(h+f),m=h+f;this.bufferLength=m;for(var w=h;m>w;++w){if("undefined"==typeof(u=c[l++])){this.eof=!0;break}p[w]=u}return this.bytesPos=l,void 0}var y,g;if(1==o)y=i,g=a;else if(2==o){for(var v=this.getBits(5)+257,b=this.getBits(5)+1,q=this.getBits(4)+4,x=Array(r.length),k=0;q>k;)x[r[k++]]=this.getBits(3);for(var _=this.generateHuffmanTable(x),A=0,k=0,C=v+b,S=new Array(C);C>k;){var E=this.getCode(_);16==E?e(this,S,2,3,A):17==E?e(this,S,3,3,A=0):18==E?e(this,S,7,11,A=0):S[k++]=A=E}y=this.generateHuffmanTable(S.slice(0,v)),g=this.generateHuffmanTable(S.slice(v,C))}else t("Unknown block type in flate stream");for(var p=this.buffer,z=p?p.length:0,I=this.bufferLength;;){var T=this.getCode(y);if(256>T)I+1>=z&&(p=this.ensureBuffer(I+1),z=p.length),p[I++]=T;else{if(256==T)return this.bufferLength=I,void 0;T-=257,T=n[T];var B=T>>16;B>0&&(B=this.getBits(B));var A=(65535&T)+B;T=this.getCode(g),T=s[T],B=T>>16,B>0&&(B=this.getBits(B));var O=(65535&T)+B;I+A>=z&&(p=this.ensureBuffer(I+A),z=p.length);for(var P=0;A>P;++P,++I)p[I]=p[I-O]}}},e}();!function(t){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";"undefined"==typeof t.btoa&&(t.btoa=function(t){var r,n,s,o,i,a,u,c,l=0,f=0,d="",h=[];if(!t)return t;do r=t.charCodeAt(l++),n=t.charCodeAt(l++),s=t.charCodeAt(l++),c=r<<16|n<<8|s,o=c>>18&63,i=c>>12&63,a=c>>6&63,u=63&c,h[f++]=e.charAt(o)+e.charAt(i)+e.charAt(a)+e.charAt(u);while(l<t.length);d=h.join("");var p=t.length%3;return(p?d.slice(0,p-3):d)+"===".slice(p||3)}),"undefined"==typeof t.atob&&(t.atob=function(t){var r,n,s,o,i,a,u,c,l=0,f=0,d="",h=[];if(!t)return t;t+="";do o=e.indexOf(t.charAt(l++)),i=e.indexOf(t.charAt(l++)),a=e.indexOf(t.charAt(l++)),u=e.indexOf(t.charAt(l++)),c=o<<18|i<<12|a<<6|u,r=c>>16&255,n=c>>8&255,s=255&c,h[f++]=64==a?String.fromCharCode(r):64==u?String.fromCharCode(r,n):String.fromCharCode(r,n,s);while(l<t.length);return d=h.join("")}),Array.prototype.map||(Array.prototype.map=function(t){if(void 0===this||null===this||"function"!=typeof t)throw new TypeError;for(var e=Object(this),r=e.length>>>0,n=new Array(r),s=arguments.length>1?arguments[1]:void 0,o=0;r>o;o++)o in e&&(n[o]=t.call(s,e[o],o,e));return n}),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Array.prototype.forEach||(Array.prototype.forEach=function(t,e){"use strict";if(void 0===this||null===this||"function"!=typeof t)throw new TypeError;for(var r=Object(this),n=r.length>>>0,s=0;n>s;s++)s in r&&t.call(e,r[s],s,r
|