@lucky-office/js-docx 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +25 -0
- package/README.md +79 -0
- package/lib/README.md +79 -0
- package/lib/index.css +1 -0
- package/lib/index.d.ts +31 -0
- package/lib/index.js +9141 -0
- package/lib/index.umd.js +1 -0
- package/package.json +47 -0
package/lib/index.umd.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("stream"),require("events"),require("buffer"),require("util")):"function"==typeof define&&define.amd?define(["stream","events","buffer","util"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).jsPreviewDocx=t(e.require$$0,e.require$$2,e.require$$0$1,e.require$$1)}(this,function(e,t,r,n){"use strict";void 0===window.setImmediate&&(window.setImmediate=function(e,...t){setTimeout(()=>e(t))});var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var s,o,l,c,h,u={},d={},f={},p={exports:{}},m={exports:{}};function g(){if(s)return m.exports;return s=1,"undefined"==typeof process||!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?m.exports={nextTick:function(e,t,r,n){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var a,i,s=arguments.length;switch(s){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,r)});case 4:return process.nextTick(function(){e.call(null,t,r,n)});default:for(a=new Array(s-1),i=0;i<a.length;)a[i++]=arguments[i];return process.nextTick(function(){e.apply(null,a)})}}}:m.exports=process,m.exports}function b(){return h?c:(h=1,c=e)}var y,v={exports:{}};function w(){return y||(y=1,function(e,t){var n=r,a=n.Buffer;function i(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return a(e,t,r)}a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=s),i(a,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return a(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=a(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(v,v.exports)),v.exports}var _,k={};function S(){if(_)return k;function e(e){return Object.prototype.toString.call(e)}return _=1,k.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===e(t)},k.isBoolean=function(e){return"boolean"==typeof e},k.isNull=function(e){return null===e},k.isNullOrUndefined=function(e){return null==e},k.isNumber=function(e){return"number"==typeof e},k.isString=function(e){return"string"==typeof e},k.isSymbol=function(e){return"symbol"==typeof e},k.isUndefined=function(e){return void 0===e},k.isRegExp=function(t){return"[object RegExp]"===e(t)},k.isObject=function(e){return"object"==typeof e&&null!==e},k.isDate=function(t){return"[object Date]"===e(t)},k.isError=function(t){return"[object Error]"===e(t)||t instanceof Error},k.isFunction=function(e){return"function"==typeof e},k.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},k.isBuffer=r.Buffer.isBuffer,k}var x,C,E={exports:{}},A={exports:{}};function P(){if(C)return E.exports;C=1;try{var e=require("util");if("function"!=typeof e.inherits)throw"";E.exports=e.inherits}catch(e){E.exports=(x||(x=1,"function"==typeof Object.create?A.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:A.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}),A.exports)}return E.exports}var T,N,R,B,M,D,O,I,z,F={exports:{}};function L(){return T||(T=1,function(e){var t=w().Buffer,r=n;function a(e,t,r){e.copy(t,r)}e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return t.alloc(0);for(var r=t.allocUnsafe(e>>>0),n=this.head,i=0;n;)a(n.data,r,i),i+=n.data.length,n=n.next;return r},e}(),r&&r.inspect&&r.inspect.custom&&(e.exports.prototype[r.inspect.custom]=function(){var e=r.inspect({length:this.length});return this.constructor.name+" "+e})}(F)),F.exports}function j(){if(R)return N;R=1;var e=g();function t(e,t){e.emit("error",t)}return N={destroy:function(r,n){var a=this,i=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return i||s?(n?n(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(t,this,r)):e.nextTick(t,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,function(r){!n&&r?a._writableState?a._writableState.errorEmitted||(a._writableState.errorEmitted=!0,e.nextTick(t,a,r)):e.nextTick(t,a,r):n&&n(r)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}},N}function $(){if(O)return D;O=1;var e=g();function t(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var a=n.callback;t.pendingcb--,a(r),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}D=m;var r,i=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:e.nextTick;m.WritableState=p;var s=Object.create(S());s.inherits=P();var o={deprecate:M?B:(M=1,B=n.deprecate)},l=b(),c=w().Buffer,h=(void 0!==a?a:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var u,d=j();function f(){}function p(n,a){r=r||U(),n=n||{};var s=a instanceof r;this.objectMode=!!n.objectMode,s&&(this.objectMode=this.objectMode||!!n.writableObjectMode);var o=n.highWaterMark,l=n.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:s&&(l||0===l)?l:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===n.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,r){var n=t._writableState,a=n.sync,s=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),r)!function(t,r,n,a,i){--r.pendingcb,n?(e.nextTick(i,a),e.nextTick(C,t,r),t._writableState.errorEmitted=!0,t.emit("error",a)):(i(a),t._writableState.errorEmitted=!0,t.emit("error",a),C(t,r))}(t,n,a,r,s);else{var o=k(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||_(t,n),a?i(v,t,n,o,s):v(t,n,o,s)}}(a,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function m(e){if(r=r||U(),!(u.call(m,this)||this instanceof r))return new m(e);this._writableState=new p(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),l.call(this)}function y(e,t,r,n,a,i,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(a,t.onwrite):e._write(a,i,t.onwrite),t.sync=!1}function v(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),C(e,t)}function _(e,r){r.bufferProcessing=!0;var n=r.bufferedRequest;if(e._writev&&n&&n.next){var a=r.bufferedRequestCount,i=new Array(a),s=r.corkedRequestsFree;s.entry=n;for(var o=0,l=!0;n;)i[o]=n,n.isBuf||(l=!1),n=n.next,o+=1;i.allBuffers=l,y(e,r,!0,r.length,i,"",s.finish),r.pendingcb++,r.lastBufferedRequest=null,s.next?(r.corkedRequestsFree=s.next,s.next=null):r.corkedRequestsFree=new t(r),r.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,h=n.encoding,u=n.callback;if(y(e,r,!1,r.objectMode?1:c.length,c,h,u),n=n.next,r.bufferedRequestCount--,r.writing)break}null===n&&(r.lastBufferedRequest=null)}r.bufferedRequest=n,r.bufferProcessing=!1}function k(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function x(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),C(e,t)})}function C(t,r){var n=k(r);return n&&(!function(t,r){r.prefinished||r.finalCalled||("function"==typeof t._final?(r.pendingcb++,r.finalCalled=!0,e.nextTick(x,t,r)):(r.prefinished=!0,t.emit("prefinish")))}(t,r),0===r.pendingcb&&(r.finished=!0,t.emit("finish"))),n}return s.inherits(m,l),p.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(p.prototype,"buffer",{get:o.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(e){return!!u.call(this,e)||this===m&&(e&&e._writableState instanceof p)}})):u=function(e){return e instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(t,r,n){var a,i=this._writableState,s=!1,o=!i.objectMode&&(a=t,c.isBuffer(a)||a instanceof h);return o&&!c.isBuffer(t)&&(t=function(e){return c.from(e)}(t)),"function"==typeof r&&(n=r,r=null),o?r="buffer":r||(r=i.defaultEncoding),"function"!=typeof n&&(n=f),i.ended?function(t,r){var n=new Error("write after end");t.emit("error",n),e.nextTick(r,n)}(this,n):(o||function(t,r,n,a){var i=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||r.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(t.emit("error",s),e.nextTick(a,s),i=!1),i}(this,i,t,n))&&(i.pendingcb++,s=function(e,t,r,n,a,i){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=c.from(t,r));return t}(t,n,a);n!==s&&(r=!0,a="buffer",n=s)}var o=t.objectMode?1:n.length;t.length+=o;var l=t.length<t.highWaterMark;l||(t.needDrain=!0);if(t.writing||t.corked){var h=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:a,isBuf:r,callback:i,next:null},h?h.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else y(e,t,!1,o,n,a,i);return l}(this,i,o,t,r,n)),s},m.prototype.cork=function(){this._writableState.corked++},m.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||_(this,e))},m.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(t,r,n){var a=this._writableState;"function"==typeof t?(n=t,t=null,r=null):"function"==typeof r&&(n=r,r=null),null!=t&&this.write(t,r),a.corked&&(a.corked=1,this.uncork()),a.ending||function(t,r,n){r.ending=!0,C(t,r),n&&(r.finished?e.nextTick(n):t.once("finish",n));r.ended=!0,t.writable=!1}(this,a,n)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),m.prototype.destroy=d.destroy,m.prototype._undestroy=d.undestroy,m.prototype._destroy=function(e,t){this.end(),t(e)},D}function U(){if(z)return I;z=1;var e=g(),t=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};I=l;var r=Object.create(S());r.inherits=P();var n=Q(),a=$();r.inherits(l,n);for(var i=t(a.prototype),s=0;s<i.length;s++){var o=i[s];l.prototype[o]||(l.prototype[o]=a.prototype[o])}function l(e){if(!(this instanceof l))return new l(e);n.call(this,e),a.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",c)}function c(){this.allowHalfOpen||this._writableState.ended||e.nextTick(h,this)}function h(e){e.end()}return Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),l.prototype._destroy=function(t,r){this.push(null),this.end(),e.nextTick(r,t)},I}var H,W,Z,V,q,X,G,K,Y={};function J(){if(H)return Y;H=1;var e=w().Buffer,t=e.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var n;switch(this.encoding=function(r){var n=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(r);if("string"!=typeof n&&(e.isEncoding===t||!t(r)))throw new Error("Unknown encoding: "+r);return n||r}(r),this.encoding){case"utf16le":this.text=i,this.end=s,n=4;break;case"utf8":this.fillLast=a,n=4;break;case"base64":this.text=o,this.end=l,n=3;break;default:return this.write=c,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(n)}function n(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function i(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function s(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function o(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function c(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}return Y.StringDecoder=r,r.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},r.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},r.prototype.text=function(e,t){var r=function(e,t,r){var a=t.length-1;if(a<r)return 0;var i=n(t[a]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--a<r||-2===i)return 0;if(i=n(t[a]),i>=0)return i>0&&(e.lastNeed=i-2),i;if(--a<r||-2===i)return 0;if(i=n(t[a]),i>=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var a=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,a),e.toString("utf8",t,a)},r.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},Y}function Q(){if(Z)return W;Z=1;var e=g();W=x;var r,i=function(){if(l)return o;l=1;var e={}.toString;return o=Array.isArray||function(t){return"[object Array]"==e.call(t)}}();x.ReadableState=k,t.EventEmitter;var s=function(e,t){return e.listeners(t).length},c=b(),h=w().Buffer,u=(void 0!==a?a:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var d=Object.create(S());d.inherits=P();var f=n,p=void 0;p=f&&f.debuglog?f.debuglog("stream"):function(){};var m,y=L(),v=j();d.inherits(x,c);var _=["error","close","destroy","pause","resume"];function k(e,t){e=e||{};var n=t instanceof(r=r||U());this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var a=e.highWaterMark,i=e.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:n&&(i||0===i)?i:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(m||(m=J().StringDecoder),this.decoder=new m(e.encoding),this.encoding=e.encoding)}function x(e){if(r=r||U(),!(this instanceof x))return new x(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function C(e,t,r,n,a){var i,s=e._readableState;null===t?(s.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,N(e)}(e,s)):(a||(i=function(e,t){var r;n=t,h.isBuffer(n)||n instanceof u||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(s,t)),i?e.emit("error",i):s.objectMode||t&&t.length>0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===h.prototype||(t=function(e){return h.from(e)}(t)),n?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):E(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?E(e,s,t,!1):B(e,s)):E(e,s,t,!1))):n||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(s)}function E(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&N(e)),B(e,t)}Object.defineProperty(x.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),x.prototype.destroy=v.destroy,x.prototype._undestroy=v.undestroy,x.prototype._destroy=function(e,t){this.push(null),t(e)},x.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=h.from(e,t),t=""),r=!0),C(this,e,t,!1,r)},x.prototype.unshift=function(e){return C(this,e,null,!0,!1)},x.prototype.isPaused=function(){return!1===this._readableState.flowing},x.prototype.setEncoding=function(e){return m||(m=J().StringDecoder),this._readableState.decoder=new m(e),this._readableState.encoding=e,this};var A=8388608;function T(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=A?e=A:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function N(t){var r=t._readableState;r.needReadable=!1,r.emittedReadable||(p("emitReadable",r.flowing),r.emittedReadable=!0,r.sync?e.nextTick(R,t):R(t))}function R(e){p("emit readable"),e.emit("readable"),I(e)}function B(t,r){r.readingMore||(r.readingMore=!0,e.nextTick(M,t,r))}function M(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(p("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function D(e){p("readable nexttick read 0"),e.read(0)}function O(e,t){t.reading||(p("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),I(e),t.flowing&&!t.reading&&e.read(0)}function I(e){var t=e._readableState;for(p("flow",t.flowing);t.flowing&&null!==e.read(););}function z(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):n=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,n=1,a=r.data;e-=a.length;for(;r=r.next;){var i=r.data,s=e>i.length?i.length:e;if(s===i.length?a+=i:a+=i.slice(0,e),0===(e-=s)){s===i.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(s));break}++n}return t.length-=n,a}(e,t):function(e,t){var r=h.allocUnsafe(e),n=t.head,a=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var i=n.data,s=e>i.length?i.length:e;if(i.copy(r,r.length-e,0,s),0===(e-=s)){s===i.length?(++a,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=i.slice(s));break}++a}return t.length-=a,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function F(t){var r=t._readableState;if(r.length>0)throw new Error('"endReadable()" called on non-empty stream');r.endEmitted||(r.ended=!0,e.nextTick($,r,t))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function H(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}return x.prototype.read=function(e){p("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?F(this):N(this),null;if(0===(e=T(e,t))&&t.ended)return 0===t.length&&F(this),null;var n,a=t.needReadable;return p("need readable",a),(0===t.length||t.length-e<t.highWaterMark)&&p("length less than watermark",a=!0),t.ended||t.reading?p("reading or ended",a=!1):a&&(p("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=T(r,t))),null===(n=e>0?z(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&F(this)),null!==n&&this.emit("data",n),n},x.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},x.prototype.pipe=function(t,r){var n=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,p("pipe count=%d opts=%j",a.pipesCount,r);var o=(!r||!1!==r.end)&&t!==process.stdout&&t!==process.stderr?c:y;function l(e,r){p("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,p("cleanup"),t.removeListener("close",g),t.removeListener("finish",b),t.removeListener("drain",h),t.removeListener("error",m),t.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",y),n.removeListener("data",f),u=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function c(){p("onend"),t.end()}a.endEmitted?e.nextTick(o):n.once("end",o),t.on("unpipe",l);var h=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,I(e))}}(n);t.on("drain",h);var u=!1;var d=!1;function f(e){p("ondata"),d=!1,!1!==t.write(e)||d||((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==H(a.pipes,t))&&!u&&(p("false write response, pause",a.awaitDrain),a.awaitDrain++,d=!0),n.pause())}function m(e){p("onerror",e),y(),t.removeListener("error",m),0===s(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",b),y()}function b(){p("onfinish"),t.removeListener("close",g),y()}function y(){p("unpipe"),n.unpipe(t)}return n.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?i(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(t,"error",m),t.once("close",g),t.once("finish",b),t.emit("pipe",n),a.flowing||(p("pipe resume"),n.resume()),t},x.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,a=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<a;i++)n[i].emit("unpipe",this,{hasUnpiped:!1});return this}var s=H(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},x.prototype.on=function(t,r){var n=c.prototype.on.call(this,t,r);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var a=this._readableState;a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.emittedReadable=!1,a.reading?a.length&&N(this):e.nextTick(D,this))}return n},x.prototype.addListener=x.prototype.on,x.prototype.resume=function(){var t=this._readableState;return t.flowing||(p("resume"),t.flowing=!0,function(t,r){r.resumeScheduled||(r.resumeScheduled=!0,e.nextTick(O,t,r))}(this,t)),this},x.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this},x.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var a in e.on("end",function(){if(p("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(a){(p("wrapped data"),r.decoder&&(a=r.decoder.write(a)),r.objectMode&&null==a)||(r.objectMode||a&&a.length)&&(t.push(a)||(n=!0,e.pause()))}),e)void 0===this[a]&&"function"==typeof e[a]&&(this[a]=function(t){return function(){return e[t].apply(e,arguments)}}(a));for(var i=0;i<_.length;i++)e.on(_[i],this.emit.bind(this,_[i]));return this._read=function(t){p("wrapped _read",t),n&&(n=!1,e.resume())},this},Object.defineProperty(x.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),x._fromList=z,W}function ee(){if(q)return V;q=1,V=n;var e=U(),t=Object.create(S());function r(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var a=this._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}function n(t){if(!(this instanceof n))return new n(t);e.call(this,t),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",a)}function a(){var e=this;"function"==typeof this._flush?this._flush(function(t,r){i(e,t,r)}):i(this,null,null)}function i(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}return t.inherits=P(),t.inherits(n,e),n.prototype.push=function(t,r){return this._transformState.needTransform=!1,e.prototype.push.call(this,t,r)},n.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},n.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var a=this._readableState;(n.needTransform||a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}},n.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},n.prototype._destroy=function(t,r){var n=this;e.prototype._destroy.call(this,t,function(e){r(e),n.emit("close")})},V}function te(){return K||(K=1,function(t,r){var n=e;"disable"===process.env.READABLE_STREAM&&n?(t.exports=n,(r=t.exports=n.Readable).Readable=n.Readable,r.Writable=n.Writable,r.Duplex=n.Duplex,r.Transform=n.Transform,r.PassThrough=n.PassThrough,r.Stream=n):((r=t.exports=Q()).Stream=n||r,r.Readable=r,r.Writable=$(),r.Duplex=U(),r.Transform=ee(),r.PassThrough=function(){if(G)return X;G=1,X=r;var e=ee(),t=Object.create(S());function r(t){if(!(this instanceof r))return new r(t);e.call(this,t)}return t.inherits=P(),t.inherits(r,e),r.prototype._transform=function(e,t,r){r(null,e)},X}())}(p,p.exports)),p.exports}if(f.base64=!0,f.array=!0,f.string=!0,f.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,f.nodebuffer="undefined"!=typeof Buffer,f.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)f.blob=!1;else{var re=new ArrayBuffer(0);try{f.blob=0===new Blob([re],{type:"application/zip"}).size}catch(e){try{var ne=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);ne.append(re),f.blob=0===ne.getBlob("application/zip").size}catch(e){f.blob=!1}}}try{f.nodestream=!!te().Readable}catch(e){f.nodestream=!1}var ae,ie={};function se(){if(ae)return ie;ae=1;var e=me(),t=f,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return ie.encode=function(t){for(var n,a,i,s,o,l,c,h=[],u=0,d=t.length,f=d,p="string"!==e.getTypeOf(t);u<t.length;)f=d-u,p?(n=t[u++],a=u<d?t[u++]:0,i=u<d?t[u++]:0):(n=t.charCodeAt(u++),a=u<d?t.charCodeAt(u++):0,i=u<d?t.charCodeAt(u++):0),s=n>>2,o=(3&n)<<4|a>>4,l=f>1?(15&a)<<2|i>>6:64,c=f>2?63&i:64,h.push(r.charAt(s)+r.charAt(o)+r.charAt(l)+r.charAt(c));return h.join("")},ie.decode=function(e){var n,a,i,s,o,l,c=0,h=0,u="data:";if(e.substr(0,5)===u)throw new Error("Invalid base64 input, it looks like a data url.");var d,f=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===r.charAt(64)&&f--,e.charAt(e.length-2)===r.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(d=t.uint8array?new Uint8Array(0|f):new Array(0|f);c<e.length;)n=r.indexOf(e.charAt(c++))<<2|(s=r.indexOf(e.charAt(c++)))>>4,a=(15&s)<<4|(o=r.indexOf(e.charAt(c++)))>>2,i=(3&o)<<6|(l=r.indexOf(e.charAt(c++))),d[h++]=n,64!==o&&(d[h++]=a),64!==l&&(d[h++]=i);return d},ie}var oe,le,ce,he,ue={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}};var de=null;de="undefined"!=typeof Promise?Promise:function(){if(he)return ce;he=1;var e=function(){if(le)return oe;le=1;var e,t,r=a.MutationObserver||a.WebKitMutationObserver;if(process.browser)if(r){var n=0,i=new r(c),s=a.document.createTextNode("");i.observe(s,{characterData:!0}),e=function(){s.data=n=++n%2}}else if(a.setImmediate||void 0===a.MessageChannel)e="document"in a&&"onreadystatechange"in a.document.createElement("script")?function(){var e=a.document.createElement("script");e.onreadystatechange=function(){c(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},a.document.documentElement.appendChild(e)}:function(){setTimeout(c,0)};else{var o=new a.MessageChannel;o.port1.onmessage=c,e=function(){o.port2.postMessage(0)}}else e=function(){process.nextTick(c)};var l=[];function c(){var e,r;t=!0;for(var n=l.length;n;){for(r=l,l=[],e=-1;++e<n;)r[e]();n=l.length}t=!1}return oe=function(r){1!==l.push(r)||t||e()}}();function t(){}var r={},n=["REJECTED"],i=["FULFILLED"],s=["PENDING"];if(!process.browser)var o=["UNHANDLED"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=s,this.queue=[],this.outcome=void 0,process.browser||(this.handled=o),e!==t&&d(this,e)}function c(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function h(t,n,a){e(function(){var e;try{e=n(a)}catch(e){return r.reject(t,e)}e===t?r.reject(t,new TypeError("Cannot resolve promise with itself")):r.resolve(t,e)})}function u(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var n=!1;function a(t){n||(n=!0,r.reject(e,t))}function i(t){n||(n=!0,r.resolve(e,t))}var s=f(function(){t(i,a)});"error"===s.status&&a(s.value)}function f(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}return ce=l,l.prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(r){return t.resolve(e()).then(function(){return r})},function(r){return t.resolve(e()).then(function(){throw r})})},l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,r){if("function"!=typeof e&&this.state===i||"function"!=typeof r&&this.state===n)return this;var a=new this.constructor(t);return process.browser||this.handled===o&&(this.handled=null),this.state!==s?h(a,this.state===i?e:r,this.outcome):this.queue.push(new c(a,e,r)),a},c.prototype.callFulfilled=function(e){r.resolve(this.promise,e)},c.prototype.otherCallFulfilled=function(e){h(this.promise,this.onFulfilled,e)},c.prototype.callRejected=function(e){r.reject(this.promise,e)},c.prototype.otherCallRejected=function(e){h(this.promise,this.onRejected,e)},r.resolve=function(e,t){var n=f(u,t);if("error"===n.status)return r.reject(e,n.value);var a=n.value;if(a)d(e,a);else{e.state=i,e.outcome=t;for(var s=-1,o=e.queue.length;++s<o;)e.queue[s].callFulfilled(t)}return e},r.reject=function(t,r){t.state=n,t.outcome=r,process.browser||t.handled===o&&e(function(){t.handled===o&&process.emit("unhandledRejection",r,t)});for(var a=-1,i=t.queue.length;++a<i;)t.queue[a].callRejected(r);return t},l.resolve=function(e){return e instanceof this?e:r.resolve(new this(t),e)},l.reject=function(e){var n=new this(t);return r.reject(n,e)},l.all=function(e){var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var a=e.length,i=!1;if(!a)return this.resolve([]);for(var s=new Array(a),o=0,l=-1,c=new this(t);++l<a;)h(e[l],l);return c;function h(e,t){n.resolve(e).then(function(e){s[t]=e,++o!==a||i||(i=!0,r.resolve(c,s))},function(e){i||(i=!0,r.reject(c,e))})}},l.race=function(e){var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var a=e.length,i=!1;if(!a)return this.resolve([]);for(var s=-1,o=new this(t);++s<a;)l(e[s]);return o;function l(e){n.resolve(e).then(function(e){i||(i=!0,r.resolve(o,e))},function(e){i||(i=!0,r.reject(o,e))})}},ce}();var fe,pe={Promise:de};function me(){return fe||(fe=1,function(e){var t=f,r=se(),n=ue,a=pe;function i(e){return e}function s(e,t){for(var r=0;r<e.length;++r)t[r]=255&e.charCodeAt(r);return t}e.newBlob=function(t,r){e.checkSupport("blob");try{return new Blob([t],{type:r})}catch(e){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return n.append(t),n.getBlob(r)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var o={stringifyByChunk:function(e,t,r){var n=[],a=0,i=e.length;if(i<=r)return String.fromCharCode.apply(null,e);for(;a<i;)"array"===t||"nodebuffer"===t?n.push(String.fromCharCode.apply(null,e.slice(a,Math.min(a+r,i)))):n.push(String.fromCharCode.apply(null,e.subarray(a,Math.min(a+r,i)))),a+=r;return n.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:function(){try{return t.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return t.nodebuffer&&1===String.fromCharCode.apply(null,n.allocBuffer(1)).length}catch(e){return!1}}()}};function l(t){var r=65536,n=e.getTypeOf(t),a=!0;if("uint8array"===n?a=o.applyCanBeUsed.uint8array:"nodebuffer"===n&&(a=o.applyCanBeUsed.nodebuffer),a)for(;r>1;)try{return o.stringifyByChunk(t,n,r)}catch(e){r=Math.floor(r/2)}return o.stringifyByChar(t)}function c(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}e.applyFromCharCode=l;var h={};h.string={string:i,array:function(e){return s(e,new Array(e.length))},arraybuffer:function(e){return h.string.uint8array(e).buffer},uint8array:function(e){return s(e,new Uint8Array(e.length))},nodebuffer:function(e){return s(e,n.allocBuffer(e.length))}},h.array={string:l,array:i,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return n.newBufferFrom(e)}},h.arraybuffer={string:function(e){return l(new Uint8Array(e))},array:function(e){return c(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:i,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return n.newBufferFrom(new Uint8Array(e))}},h.uint8array={string:l,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:i,nodebuffer:function(e){return n.newBufferFrom(e)}},h.nodebuffer={string:l,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return h.nodebuffer.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:i},e.transformTo=function(t,r){if(r||(r=""),!t)return r;e.checkSupport(t);var n=e.getTypeOf(r);return h[n][t](r)},e.resolve=function(e){for(var t=e.split("/"),r=[],n=0;n<t.length;n++){var a=t[n];"."===a||""===a&&0!==n&&n!==t.length-1||(".."===a?r.pop():r.push(a))}return r.join("/")},e.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":t.nodebuffer&&n.isBuffer(e)?"nodebuffer":t.uint8array&&e instanceof Uint8Array?"uint8array":t.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},e.checkSupport=function(e){if(!t[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},e.MAX_VALUE_16BITS=65535,e.MAX_VALUE_32BITS=-1,e.pretty=function(e){var t,r,n="";for(r=0;r<(e||"").length;r++)n+="\\x"+((t=e.charCodeAt(r))<16?"0":"")+t.toString(16).toUpperCase();return n},e.delay=function(e,t,r){setImmediate(function(){e.apply(r||null,t||[])})},e.inherits=function(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r},e.extend=function(){var e,t,r={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===r[t]&&(r[t]=arguments[e][t]);return r},e.prepareContent=function(n,i,o,l,c){return a.Promise.resolve(i).then(function(e){return t.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new a.Promise(function(t,r){var n=new FileReader;n.onload=function(e){t(e.target.result)},n.onerror=function(e){r(e.target.error)},n.readAsArrayBuffer(e)}):e}).then(function(i){var h,u=e.getTypeOf(i);return u?("arraybuffer"===u?i=e.transformTo("uint8array",i):"string"===u&&(c?i=r.decode(i):o&&!0!==l&&(i=s(h=i,t.uint8array?new Uint8Array(h.length):new Array(h.length)))),i):a.Promise.reject(new Error("Can't read the data of '"+n+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}}(d)),d}function ge(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}!function(e){if(!e.setImmediate){var t,r,n,a,i,s=1,o={},l=!1,c=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,"[object process]"==={}.toString.call(e.process)?t=function(e){process.nextTick(function(){d(e)})}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?((n=new MessageChannel).port1.onmessage=function(e){d(e.data)},t=function(e){n.port2.postMessage(e)}):c&&"onreadystatechange"in c.createElement("script")?(r=c.documentElement,t=function(e){var t=c.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):t=function(e){setTimeout(d,0,e)}:(a="setImmediate$"+Math.random()+"$",i=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&d(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",i,!1):e.attachEvent("onmessage",i),t=function(t){e.postMessage(a+t,"*")}),h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var r=new Array(arguments.length-1),n=0;n<r.length;n++)r[n]=arguments[n+1];var a={callback:e,args:r};return o[s]=a,t(s),s++},h.clearImmediate=u}function u(e){delete o[e]}function d(e){if(l)setTimeout(d,0,e);else{var t=o[e];if(t){l=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(void 0,r)}}(t)}finally{u(e),l=!1}}}}}("undefined"==typeof self?a:self),ge.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var e=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}};var be=ge;!function(e){for(var t=me(),r=f,n=ue,a=be,i=new Array(256),s=0;s<256;s++)i[s]=s>=252?6:s>=248?5:s>=240?4:s>=224?3:s>=192?2:1;i[254]=i[254]=1;function o(){a.call(this,"utf-8 decode"),this.leftOver=null}function l(){a.call(this,"utf-8 encode")}e.utf8encode=function(e){return r.nodebuffer?n.newBufferFrom(e,"utf-8"):function(e){var t,n,a,i,s,o=e.length,l=0;for(i=0;i<o;i++)55296==(64512&(n=e.charCodeAt(i)))&&i+1<o&&56320==(64512&(a=e.charCodeAt(i+1)))&&(n=65536+(n-55296<<10)+(a-56320),i++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=r.uint8array?new Uint8Array(l):new Array(l),s=0,i=0;s<l;i++)55296==(64512&(n=e.charCodeAt(i)))&&i+1<o&&56320==(64512&(a=e.charCodeAt(i+1)))&&(n=65536+(n-55296<<10)+(a-56320),i++),n<128?t[s++]=n:n<2048?(t[s++]=192|n>>>6,t[s++]=128|63&n):n<65536?(t[s++]=224|n>>>12,t[s++]=128|n>>>6&63,t[s++]=128|63&n):(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63,t[s++]=128|n>>>6&63,t[s++]=128|63&n);return t}(e)},e.utf8decode=function(e){return r.nodebuffer?t.transformTo("nodebuffer",e).toString("utf-8"):function(e){var r,n,a,s,o=e.length,l=new Array(2*o);for(n=0,r=0;r<o;)if((a=e[r++])<128)l[n++]=a;else if((s=i[a])>4)l[n++]=65533,r+=s-1;else{for(a&=2===s?31:3===s?15:7;s>1&&r<o;)a=a<<6|63&e[r++],s--;s>1?l[n++]=65533:a<65536?l[n++]=a:(a-=65536,l[n++]=55296|a>>10&1023,l[n++]=56320|1023&a)}return l.length!==n&&(l.subarray?l=l.subarray(0,n):l.length=n),t.applyFromCharCode(l)}(e=t.transformTo(r.uint8array?"uint8array":"array",e))},t.inherits(o,a),o.prototype.processChunk=function(n){var a=t.transformTo(r.uint8array?"uint8array":"array",n.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var s=a;(a=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),a.set(s,this.leftOver.length)}else a=this.leftOver.concat(a);this.leftOver=null}var o=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+i[e[r]]>t?r:t}(a),l=a;o!==a.length&&(r.uint8array?(l=a.subarray(0,o),this.leftOver=a.subarray(o,a.length)):(l=a.slice(0,o),this.leftOver=a.slice(o,a.length))),this.push({data:e.utf8decode(l),meta:n.meta})},o.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:e.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},e.Utf8DecodeWorker=o,t.inherits(l,a),l.prototype.processChunk=function(t){this.push({data:e.utf8encode(t.data),meta:t.meta})},e.Utf8EncodeWorker=l}(u);var ye=be,ve=me();function we(e){ye.call(this,"ConvertWorker to "+e),this.destType=e}ve.inherits(we,ye),we.prototype.processChunk=function(e){this.push({data:ve.transformTo(this.destType,e.data),meta:e.meta})};var _e,ke,Se=we;var xe=me(),Ce=Se,Ee=be,Ae=se(),Pe=pe,Te=null;if(f.nodestream)try{Te=function(){if(ke)return _e;ke=1;var e=te().Readable;function t(t,r,n){e.call(this,r),this._helper=t;var a=this;t.on("data",function(e,t){a.push(e)||a._helper.pause(),n&&n(t)}).on("error",function(e){a.emit("error",e)}).on("end",function(){a.push(null)})}return me().inherits(t,e),t.prototype._read=function(){this._helper.resume()},_e=t}()}catch(e){}function Ne(e,t){return new Pe.Promise(function(r,n){var a=[],i=e._internalType,s=e._outputType,o=e._mimeType;e.on("data",function(e,r){a.push(e),t&&t(r)}).on("error",function(e){a=[],n(e)}).on("end",function(){try{var e=function(e,t,r){switch(e){case"blob":return xe.newBlob(xe.transformTo("arraybuffer",t),r);case"base64":return Ae.encode(t);default:return xe.transformTo(e,t)}}(s,function(e,t){var r,n=0,a=null,i=0;for(r=0;r<t.length;r++)i+=t[r].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(a=new Uint8Array(i),r=0;r<t.length;r++)a.set(t[r],n),n+=t[r].length;return a;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(i,a),o);r(e)}catch(e){n(e)}a=[]}).resume()})}function Re(e,t,r){var n=t;switch(t){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=t,this._mimeType=r,xe.checkSupport(n),this._worker=e.pipe(new Ce(n)),e.lock()}catch(e){this._worker=new Ee("error"),this._worker.error(e)}}Re.prototype={accumulate:function(e){return Ne(this,e)},on:function(e,t){var r=this;return"data"===e?this._worker.on(e,function(e){t.call(r,e.data,e.meta)}):this._worker.on(e,function(){xe.delay(t,arguments,r)}),this},resume:function(){return xe.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(xe.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new Te(this,{objectMode:"nodebuffer"!==this._outputType},e)}};var Be=Re,Me={base64:!1,binary:!1,dir:!1,createFolders:!0,date:null,compression:null,compressionOptions:null,comment:null,unixPermissions:null,dosPermissions:null},De=me(),Oe=be;function Ie(e){Oe.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=De.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}De.inherits(Ie,Oe),Ie.prototype.cleanUp=function(){Oe.prototype.cleanUp.call(this),this.data=null},Ie.prototype.resume=function(){return!!Oe.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,De.delay(this._tickAndRepeat,[],this)),!0)},Ie.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(De.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},Ie.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})};var ze=Ie,Fe=me();var Le=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var je=function(e,t){return void 0!==e&&e.length?"string"!==Fe.getTypeOf(e)?function(e,t,r,n){var a=Le,i=n+r;e^=-1;for(var s=n;s<i;s++)e=e>>>8^a[255&(e^t[s])];return-1^e}(0|t,e,e.length,0):function(e,t,r,n){var a=Le,i=n+r;e^=-1;for(var s=n;s<i;s++)e=e>>>8^a[255&(e^t.charCodeAt(s))];return-1^e}(0|t,e,e.length,0):0},$e=be,Ue=je;function He(){$e.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}me().inherits(He,$e),He.prototype.processChunk=function(e){this.streamInfo.crc32=Ue(e.data,this.streamInfo.crc32||0),this.push(e)};var We=He,Ze=me(),Ve=be;function qe(e){Ve.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}Ze.inherits(qe,Ve),qe.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}Ve.prototype.processChunk.call(this,e)};var Xe=pe,Ge=ze,Ke=We,Ye=qe;function Je(e,t,r,n,a){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=a}Je.prototype={getContentWorker:function(){var e=new Ge(Xe.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Ye("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new Ge(Xe.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},Je.createWorkerFrom=function(e,t,r){return e.pipe(new Ke).pipe(new Ye("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new Ye("compressedSize")).withStreamInfo("compression",t)};var Qe=Je,et=Be,tt=ze,rt=u,nt=Qe,at=be,it=function(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}};it.prototype={internalStream:function(e){var t=null,r="string";try{if(!e)throw new Error("No output type specified.");var n="string"===(r=e.toLowerCase())||"text"===r;"binarystring"!==r&&"text"!==r||(r="string"),t=this._decompressWorker();var a=!this._dataBinary;a&&!n&&(t=t.pipe(new rt.Utf8EncodeWorker)),!a&&n&&(t=t.pipe(new rt.Utf8DecodeWorker))}catch(e){(t=new at("error")).error(e)}return new et(t,r,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof nt&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new rt.Utf8EncodeWorker)),nt.createWorkerFrom(r,e,t)},_decompressWorker:function(){return this._data instanceof nt?this._data.getContentWorker():this._data instanceof at?this._data:new tt(this._data)}};for(var st=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],ot=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},lt=0;lt<st.length;lt++)it.prototype[st[lt]]=ot;var ct=it,ht={},ut={},dt={},ft={};!function(e){var t="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var a in n)r(n,a)&&(e[a]=n[a])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,n,a){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),a);else for(var i=0;i<n;i++)e[a+i]=t[r+i]},flattenChunks:function(e){var t,r,n,a,i,s;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(s=new Uint8Array(n),a=0,t=0,r=e.length;t<r;t++)i=e[t],s.set(i,a),a+=i.length;return s}},a={arraySet:function(e,t,r,n,a){for(var i=0;i<n;i++)e[a+i]=t[r+i]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,a))},e.setTyped(t)}(ft);var pt={},mt={},gt={},bt=ft;function yt(e){for(var t=e.length;--t>=0;)e[t]=0}var vt=256,wt=286,_t=30,kt=15,St=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],xt=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Ct=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Et=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],At=new Array(576);yt(At);var Pt=new Array(60);yt(Pt);var Tt=new Array(512);yt(Tt);var Nt=new Array(256);yt(Nt);var Rt=new Array(29);yt(Rt);var Bt,Mt,Dt,Ot=new Array(_t);function It(e,t,r,n,a){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=a,this.has_stree=e&&e.length}function zt(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Ft(e){return e<256?Tt[e]:Tt[256+(e>>>7)]}function Lt(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function jt(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,Lt(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function $t(e,t,r){jt(e,r[2*t],r[2*t+1])}function Ut(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function Ht(e,t,r){var n,a,i=new Array(16),s=0;for(n=1;n<=kt;n++)i[n]=s=s+r[n-1]<<1;for(a=0;a<=t;a++){var o=e[2*a+1];0!==o&&(e[2*a]=Ut(i[o]++,o))}}function Wt(e){var t;for(t=0;t<wt;t++)e.dyn_ltree[2*t]=0;for(t=0;t<_t;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Zt(e){e.bi_valid>8?Lt(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Vt(e,t,r,n){var a=2*t,i=2*r;return e[a]<e[i]||e[a]===e[i]&&n[t]<=n[r]}function qt(e,t,r){for(var n=e.heap[r],a=r<<1;a<=e.heap_len&&(a<e.heap_len&&Vt(t,e.heap[a+1],e.heap[a],e.depth)&&a++,!Vt(t,n,e.heap[a],e.depth));)e.heap[r]=e.heap[a],r=a,a<<=1;e.heap[r]=n}function Xt(e,t,r){var n,a,i,s,o=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*o]<<8|e.pending_buf[e.d_buf+2*o+1],a=e.pending_buf[e.l_buf+o],o++,0===n?$t(e,a,t):($t(e,(i=Nt[a])+vt+1,t),0!==(s=St[i])&&jt(e,a-=Rt[i],s),$t(e,i=Ft(--n),r),0!==(s=xt[i])&&jt(e,n-=Ot[i],s))}while(o<e.last_lit);$t(e,256,t)}function Gt(e,t){var r,n,a,i=t.dyn_tree,s=t.stat_desc.static_tree,o=t.stat_desc.has_stree,l=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<l;r++)0!==i[2*r]?(e.heap[++e.heap_len]=c=r,e.depth[r]=0):i[2*r+1]=0;for(;e.heap_len<2;)i[2*(a=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[a]=0,e.opt_len--,o&&(e.static_len-=s[2*a+1]);for(t.max_code=c,r=e.heap_len>>1;r>=1;r--)qt(e,i,r);a=l;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],qt(e,i,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,i[2*a]=i[2*r]+i[2*n],e.depth[a]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,i[2*r+1]=i[2*n+1]=a,e.heap[1]=a++,qt(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,a,i,s,o,l=t.dyn_tree,c=t.max_code,h=t.stat_desc.static_tree,u=t.stat_desc.has_stree,d=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(i=0;i<=kt;i++)e.bl_count[i]=0;for(l[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(i=l[2*l[2*(n=e.heap[r])+1]+1]+1)>p&&(i=p,m++),l[2*n+1]=i,n>c||(e.bl_count[i]++,s=0,n>=f&&(s=d[n-f]),o=l[2*n],e.opt_len+=o*(i+s),u&&(e.static_len+=o*(h[2*n+1]+s)));if(0!==m){do{for(i=p-1;0===e.bl_count[i];)i--;e.bl_count[i]--,e.bl_count[i+1]+=2,e.bl_count[p]--,m-=2}while(m>0);for(i=p;0!==i;i--)for(n=e.bl_count[i];0!==n;)(a=e.heap[--r])>c||(l[2*a+1]!==i&&(e.opt_len+=(i-l[2*a+1])*l[2*a],l[2*a+1]=i),n--)}}(e,t),Ht(i,c,e.bl_count)}function Kt(e,t,r){var n,a,i=-1,s=t[1],o=0,l=7,c=4;for(0===s&&(l=138,c=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)a=s,s=t[2*(n+1)+1],++o<l&&a===s||(o<c?e.bl_tree[2*a]+=o:0!==a?(a!==i&&e.bl_tree[2*a]++,e.bl_tree[32]++):o<=10?e.bl_tree[34]++:e.bl_tree[36]++,o=0,i=a,0===s?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4))}function Yt(e,t,r){var n,a,i=-1,s=t[1],o=0,l=7,c=4;for(0===s&&(l=138,c=3),n=0;n<=r;n++)if(a=s,s=t[2*(n+1)+1],!(++o<l&&a===s)){if(o<c)do{$t(e,a,e.bl_tree)}while(0!==--o);else 0!==a?(a!==i&&($t(e,a,e.bl_tree),o--),$t(e,16,e.bl_tree),jt(e,o-3,2)):o<=10?($t(e,17,e.bl_tree),jt(e,o-3,3)):($t(e,18,e.bl_tree),jt(e,o-11,7));o=0,i=a,0===s?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4)}}yt(Ot);var Jt=!1;function Qt(e,t,r,n){jt(e,0+(n?1:0),3),function(e,t,r,n){Zt(e),n&&(Lt(e,r),Lt(e,~r)),bt.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}gt._tr_init=function(e){Jt||(!function(){var e,t,r,n,a,i=new Array(16);for(r=0,n=0;n<28;n++)for(Rt[n]=r,e=0;e<1<<St[n];e++)Nt[r++]=n;for(Nt[r-1]=n,a=0,n=0;n<16;n++)for(Ot[n]=a,e=0;e<1<<xt[n];e++)Tt[a++]=n;for(a>>=7;n<_t;n++)for(Ot[n]=a<<7,e=0;e<1<<xt[n]-7;e++)Tt[256+a++]=n;for(t=0;t<=kt;t++)i[t]=0;for(e=0;e<=143;)At[2*e+1]=8,e++,i[8]++;for(;e<=255;)At[2*e+1]=9,e++,i[9]++;for(;e<=279;)At[2*e+1]=7,e++,i[7]++;for(;e<=287;)At[2*e+1]=8,e++,i[8]++;for(Ht(At,287,i),e=0;e<_t;e++)Pt[2*e+1]=5,Pt[2*e]=Ut(e,5);Bt=new It(At,St,257,wt,kt),Mt=new It(Pt,xt,0,_t,kt),Dt=new It(new Array(0),Ct,0,19,7)}(),Jt=!0),e.l_desc=new zt(e.dyn_ltree,Bt),e.d_desc=new zt(e.dyn_dtree,Mt),e.bl_desc=new zt(e.bl_tree,Dt),e.bi_buf=0,e.bi_valid=0,Wt(e)},gt._tr_stored_block=Qt,gt._tr_flush_block=function(e,t,r,n){var a,i,s=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<vt;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),Gt(e,e.l_desc),Gt(e,e.d_desc),s=function(e){var t;for(Kt(e,e.dyn_ltree,e.l_desc.max_code),Kt(e,e.dyn_dtree,e.d_desc.max_code),Gt(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Et[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),a=e.opt_len+3+7>>>3,(i=e.static_len+3+7>>>3)<=a&&(a=i)):a=i=r+5,r+4<=a&&-1!==t?Qt(e,t,r,n):4===e.strategy||i===a?(jt(e,2+(n?1:0),3),Xt(e,At,Pt)):(jt(e,4+(n?1:0),3),function(e,t,r,n){var a;for(jt(e,t-257,5),jt(e,r-1,5),jt(e,n-4,4),a=0;a<n;a++)jt(e,e.bl_tree[2*Et[a]+1],3);Yt(e,e.dyn_ltree,t-1),Yt(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),Xt(e,e.dyn_ltree,e.dyn_dtree)),Wt(e),n&&Zt(e)},gt._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(Nt[r]+vt+1)]++,e.dyn_dtree[2*Ft(t)]++),e.last_lit===e.lit_bufsize-1},gt._tr_align=function(e){jt(e,2,3),$t(e,256,At),function(e){16===e.bi_valid?(Lt(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)};var er=function(e,t,r,n){for(var a=65535&e,i=e>>>16&65535,s=0;0!==r;){r-=s=r>2e3?2e3:r;do{i=i+(a=a+t[n++]|0)|0}while(--s);a%=65521,i%=65521}return a|i<<16};var tr=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var rr,nr=function(e,t,r,n){var a=tr,i=n+r;e^=-1;for(var s=n;s<i;s++)e=e>>>8^a[255&(e^t[s])];return-1^e},ar={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ir=ft,sr=gt,or=er,lr=nr,cr=ar,hr=-2,ur=258,dr=262,fr=103,pr=113,mr=666;function gr(e,t){return e.msg=cr[t],t}function br(e){return(e<<1)-(e>4?9:0)}function yr(e){for(var t=e.length;--t>=0;)e[t]=0}function vr(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(ir.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function wr(e,t){sr._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,vr(e.strm)}function _r(e,t){e.pending_buf[e.pending++]=t}function kr(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function Sr(e,t,r,n){var a=e.avail_in;return a>n&&(a=n),0===a?0:(e.avail_in-=a,ir.arraySet(t,e.input,e.next_in,a,r),1===e.state.wrap?e.adler=or(e.adler,t,a,r):2===e.state.wrap&&(e.adler=lr(e.adler,t,a,r)),e.next_in+=a,e.total_in+=a,a)}function xr(e,t){var r,n,a=e.max_chain_length,i=e.strstart,s=e.prev_length,o=e.nice_match,l=e.strstart>e.w_size-dr?e.strstart-(e.w_size-dr):0,c=e.window,h=e.w_mask,u=e.prev,d=e.strstart+ur,f=c[i+s-1],p=c[i+s];e.prev_length>=e.good_match&&(a>>=2),o>e.lookahead&&(o=e.lookahead);do{if(c[(r=t)+s]===p&&c[r+s-1]===f&&c[r]===c[i]&&c[++r]===c[i+1]){i+=2,r++;do{}while(c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&i<d);if(n=ur-(d-i),i=d-ur,n>s){if(e.match_start=t,s=n,n>=o)break;f=c[i+s-1],p=c[i+s]}}}while((t=u[t&h])>l&&0!==--a);return s<=e.lookahead?s:e.lookahead}function Cr(e){var t,r,n,a,i,s=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=s+(s-dr)){ir.arraySet(e.window,e.window,s,s,0),e.match_start-=s,e.strstart-=s,e.block_start-=s,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=s?n-s:0}while(--r);t=r=s;do{n=e.prev[--t],e.prev[t]=n>=s?n-s:0}while(--r);a+=s}if(0===e.strm.avail_in)break;if(r=Sr(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=r,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<<e.hash_shift^e.window[i+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[i+3-1])&e.hash_mask,e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<dr&&0!==e.strm.avail_in)}function Er(e,t){for(var r,n;;){if(e.lookahead<dr){if(Cr(e),e.lookahead<dr&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-dr&&(e.match_length=xr(e,r)),e.match_length>=3)if(n=sr._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!==--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=sr._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(wr(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(wr(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(wr(e,!1),0===e.strm.avail_out)?1:2}function Ar(e,t){for(var r,n,a;;){if(e.lookahead<dr){if(Cr(e),e.lookahead<dr&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-dr&&(e.match_length=xr(e,r),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-3,n=sr._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=a&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!==--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(wr(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=sr._tr_tally(e,0,e.window[e.strstart-1]))&&wr(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=sr._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(wr(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(wr(e,!1),0===e.strm.avail_out)?1:2}function Pr(e,t,r,n,a){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=a}function Tr(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new ir.Buf16(1146),this.dyn_dtree=new ir.Buf16(122),this.bl_tree=new ir.Buf16(78),yr(this.dyn_ltree),yr(this.dyn_dtree),yr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new ir.Buf16(16),this.heap=new ir.Buf16(573),yr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new ir.Buf16(573),yr(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Nr(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:pr,e.adler=2===t.wrap?0:1,t.last_flush=0,sr._tr_init(t),0):gr(e,hr)}function Rr(e){var t,r=Nr(e);return 0===r&&((t=e.state).window_size=2*t.w_size,yr(t.head),t.max_lazy_match=rr[t.level].max_lazy,t.good_match=rr[t.level].good_length,t.nice_match=rr[t.level].nice_length,t.max_chain_length=rr[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),r}function Br(e,t,r,n,a,i){if(!e)return hr;var s=1;if(-1===t&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),a<1||a>9||8!==r||n<8||n>15||t<0||t>9||i<0||i>4)return gr(e,hr);8===n&&(n=9);var o=new Tr;return e.state=o,o.strm=e,o.wrap=s,o.gzhead=null,o.w_bits=n,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=a+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new ir.Buf8(2*o.w_size),o.head=new ir.Buf16(o.hash_size),o.prev=new ir.Buf16(o.w_size),o.lit_bufsize=1<<a+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new ir.Buf8(o.pending_buf_size),o.d_buf=1*o.lit_bufsize,o.l_buf=3*o.lit_bufsize,o.level=t,o.strategy=i,o.method=r,Rr(e)}rr=[new Pr(0,0,0,0,function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Cr(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,wr(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-dr&&(wr(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(wr(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(wr(e,!1),e.strm.avail_out),1)}),new Pr(4,4,8,4,Er),new Pr(4,5,16,8,Er),new Pr(4,6,32,32,Er),new Pr(4,4,16,16,Ar),new Pr(8,16,32,32,Ar),new Pr(8,16,128,128,Ar),new Pr(8,32,128,256,Ar),new Pr(32,128,258,1024,Ar),new Pr(32,258,258,4096,Ar)],mt.deflateInit=function(e,t){return Br(e,t,8,15,8,0)},mt.deflateInit2=Br,mt.deflateReset=Rr,mt.deflateResetKeep=Nr,mt.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?hr:(e.state.gzhead=t,0):hr},mt.deflate=function(e,t){var r,n,a,i;if(!e||!e.state||t>5||t<0)return e?gr(e,hr):hr;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===mr&&4!==t)return gr(e,0===e.avail_out?-5:hr);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,_r(n,31),_r(n,139),_r(n,8),n.gzhead?(_r(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),_r(n,255&n.gzhead.time),_r(n,n.gzhead.time>>8&255),_r(n,n.gzhead.time>>16&255),_r(n,n.gzhead.time>>24&255),_r(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),_r(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(_r(n,255&n.gzhead.extra.length),_r(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=lr(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(_r(n,0),_r(n,0),_r(n,0),_r(n,0),_r(n,0),_r(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),_r(n,3),n.status=pr);else{var s=8+(n.w_bits-8<<4)<<8;s|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=pr,kr(n,s),0!==n.strstart&&(kr(n,e.adler>>>16),kr(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(a=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>a&&(e.adler=lr(e.adler,n.pending_buf,n.pending-a,a)),vr(e),a=n.pending,n.pending!==n.pending_buf_size));)_r(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>a&&(e.adler=lr(e.adler,n.pending_buf,n.pending-a,a)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){a=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>a&&(e.adler=lr(e.adler,n.pending_buf,n.pending-a,a)),vr(e),a=n.pending,n.pending===n.pending_buf_size)){i=1;break}i=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,_r(n,i)}while(0!==i);n.gzhead.hcrc&&n.pending>a&&(e.adler=lr(e.adler,n.pending_buf,n.pending-a,a)),0===i&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){a=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>a&&(e.adler=lr(e.adler,n.pending_buf,n.pending-a,a)),vr(e),a=n.pending,n.pending===n.pending_buf_size)){i=1;break}i=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,_r(n,i)}while(0!==i);n.gzhead.hcrc&&n.pending>a&&(e.adler=lr(e.adler,n.pending_buf,n.pending-a,a)),0===i&&(n.status=fr)}else n.status=fr;if(n.status===fr&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&vr(e),n.pending+2<=n.pending_buf_size&&(_r(n,255&e.adler),_r(n,e.adler>>8&255),e.adler=0,n.status=pr)):n.status=pr),0!==n.pending){if(vr(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&br(t)<=br(r)&&4!==t)return gr(e,-5);if(n.status===mr&&0!==e.avail_in)return gr(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==mr){var o=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(Cr(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=sr._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(wr(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(wr(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(wr(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,n,a,i,s=e.window;;){if(e.lookahead<=ur){if(Cr(e),e.lookahead<=ur&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=s[a=e.strstart-1])===s[++a]&&n===s[++a]&&n===s[++a]){i=e.strstart+ur;do{}while(n===s[++a]&&n===s[++a]&&n===s[++a]&&n===s[++a]&&n===s[++a]&&n===s[++a]&&n===s[++a]&&n===s[++a]&&a<i);e.match_length=ur-(i-a),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=sr._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=sr._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(wr(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(wr(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(wr(e,!1),0===e.strm.avail_out)?1:2}(n,t):rr[n.level].func(n,t);if(3!==o&&4!==o||(n.status=mr),1===o||3===o)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===o&&(1===t?sr._tr_align(n):5!==t&&(sr._tr_stored_block(n,0,0,!1),3===t&&(yr(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),vr(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(_r(n,255&e.adler),_r(n,e.adler>>8&255),_r(n,e.adler>>16&255),_r(n,e.adler>>24&255),_r(n,255&e.total_in),_r(n,e.total_in>>8&255),_r(n,e.total_in>>16&255),_r(n,e.total_in>>24&255)):(kr(n,e.adler>>>16),kr(n,65535&e.adler)),vr(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},mt.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==fr&&t!==pr&&t!==mr?gr(e,hr):(e.state=null,t===pr?gr(e,-3):0):hr},mt.deflateSetDictionary=function(e,t){var r,n,a,i,s,o,l,c,h=t.length;if(!e||!e.state)return hr;if(2===(i=(r=e.state).wrap)||1===i&&42!==r.status||r.lookahead)return hr;for(1===i&&(e.adler=or(e.adler,t,h,0)),r.wrap=0,h>=r.w_size&&(0===i&&(yr(r.head),r.strstart=0,r.block_start=0,r.insert=0),c=new ir.Buf8(r.w_size),ir.arraySet(c,t,h-r.w_size,r.w_size,0),t=c,h=r.w_size),s=e.avail_in,o=e.next_in,l=e.input,e.avail_in=h,e.next_in=0,e.input=t,Cr(r);r.lookahead>=3;){n=r.strstart,a=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--a);r.strstart=n,r.lookahead=2,Cr(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=o,e.input=l,e.avail_in=s,r.wrap=i,0},mt.deflateInfo="pako deflate (from Nodeca project)";var Mr={},Dr=ft,Or=!0,Ir=!0;try{String.fromCharCode.apply(null,[0])}catch(e){Or=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Ir=!1}for(var zr=new Dr.Buf8(256),Fr=0;Fr<256;Fr++)zr[Fr]=Fr>=252?6:Fr>=248?5:Fr>=240?4:Fr>=224?3:Fr>=192?2:1;function Lr(e,t){if(t<65534&&(e.subarray&&Ir||!e.subarray&&Or))return String.fromCharCode.apply(null,Dr.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}zr[254]=zr[254]=1,Mr.string2buf=function(e){var t,r,n,a,i,s=e.length,o=0;for(a=0;a<s;a++)55296==(64512&(r=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(n=e.charCodeAt(a+1)))&&(r=65536+(r-55296<<10)+(n-56320),a++),o+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Dr.Buf8(o),i=0,a=0;i<o;a++)55296==(64512&(r=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(n=e.charCodeAt(a+1)))&&(r=65536+(r-55296<<10)+(n-56320),a++),r<128?t[i++]=r:r<2048?(t[i++]=192|r>>>6,t[i++]=128|63&r):r<65536?(t[i++]=224|r>>>12,t[i++]=128|r>>>6&63,t[i++]=128|63&r):(t[i++]=240|r>>>18,t[i++]=128|r>>>12&63,t[i++]=128|r>>>6&63,t[i++]=128|63&r);return t},Mr.buf2binstring=function(e){return Lr(e,e.length)},Mr.binstring2buf=function(e){for(var t=new Dr.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},Mr.buf2string=function(e,t){var r,n,a,i,s=t||e.length,o=new Array(2*s);for(n=0,r=0;r<s;)if((a=e[r++])<128)o[n++]=a;else if((i=zr[a])>4)o[n++]=65533,r+=i-1;else{for(a&=2===i?31:3===i?15:7;i>1&&r<s;)a=a<<6|63&e[r++],i--;i>1?o[n++]=65533:a<65536?o[n++]=a:(a-=65536,o[n++]=55296|a>>10&1023,o[n++]=56320|1023&a)}return Lr(o,n)},Mr.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+zr[e[r]]>t?r:t};var jr=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},$r=mt,Ur=ft,Hr=Mr,Wr=ar,Zr=jr,Vr=Object.prototype.toString;function qr(e){if(!(this instanceof qr))return new qr(e);this.options=Ur.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Zr,this.strm.avail_out=0;var r=$r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(Wr[r]);if(t.header&&$r.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?Hr.string2buf(t.dictionary):"[object ArrayBuffer]"===Vr.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=$r.deflateSetDictionary(this.strm,n)))throw new Error(Wr[r]);this._dict_set=!0}}function Xr(e,t){var r=new qr(t);if(r.push(e,!0),r.err)throw r.msg||Wr[r.err];return r.result}qr.prototype.push=function(e,t){var r,n,a=this.strm,i=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=Hr.string2buf(e):"[object ArrayBuffer]"===Vr.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new Ur.Buf8(i),a.next_out=0,a.avail_out=i),1!==(r=$r.deflate(a,n))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==a.avail_out&&(0!==a.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(Hr.buf2binstring(Ur.shrinkBuf(a.output,a.next_out))):this.onData(Ur.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||0===a.avail_out)&&1!==r);return 4===n?(r=$r.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),a.avail_out=0,!0)},qr.prototype.onData=function(e){this.chunks.push(e)},qr.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Ur.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},pt.Deflate=qr,pt.deflate=Xr,pt.deflateRaw=function(e,t){return(t=t||{}).raw=!0,Xr(e,t)},pt.gzip=function(e,t){return(t=t||{}).gzip=!0,Xr(e,t)};var Gr={},Kr={},Yr=ft,Jr=15,Qr=[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,0,0],en=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],tn=[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,0,0],rn=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],nn=ft,an=er,sn=nr,on=function(e,t){var r,n,a,i,s,o,l,c,h,u,d,f,p,m,g,b,y,v,w,_,k,S,x,C,E;r=e.state,n=e.next_in,C=e.input,a=n+(e.avail_in-5),i=e.next_out,E=e.output,s=i-(t-e.avail_out),o=i+(e.avail_out-257),l=r.dmax,c=r.wsize,h=r.whave,u=r.wnext,d=r.window,f=r.hold,p=r.bits,m=r.lencode,g=r.distcode,b=(1<<r.lenbits)-1,y=(1<<r.distbits)-1;e:do{p<15&&(f+=C[n++]<<p,p+=8,f+=C[n++]<<p,p+=8),v=m[f&b];t:for(;;){if(f>>>=w=v>>>24,p-=w,0===(w=v>>>16&255))E[i++]=65535&v;else{if(!(16&w)){if(64&w){if(32&w){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}v=m[(65535&v)+(f&(1<<w)-1)];continue t}for(_=65535&v,(w&=15)&&(p<w&&(f+=C[n++]<<p,p+=8),_+=f&(1<<w)-1,f>>>=w,p-=w),p<15&&(f+=C[n++]<<p,p+=8,f+=C[n++]<<p,p+=8),v=g[f&y];;){if(f>>>=w=v>>>24,p-=w,16&(w=v>>>16&255)){if(k=65535&v,p<(w&=15)&&(f+=C[n++]<<p,(p+=8)<w&&(f+=C[n++]<<p,p+=8)),(k+=f&(1<<w)-1)>l){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=w,p-=w,k>(w=i-s)){if((w=k-w)>h&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(S=0,x=d,0===u){if(S+=c-w,w<_){_-=w;do{E[i++]=d[S++]}while(--w);S=i-k,x=E}}else if(u<w){if(S+=c+u-w,(w-=u)<_){_-=w;do{E[i++]=d[S++]}while(--w);if(S=0,u<_){_-=w=u;do{E[i++]=d[S++]}while(--w);S=i-k,x=E}}}else if(S+=u-w,w<_){_-=w;do{E[i++]=d[S++]}while(--w);S=i-k,x=E}for(;_>2;)E[i++]=x[S++],E[i++]=x[S++],E[i++]=x[S++],_-=3;_&&(E[i++]=x[S++],_>1&&(E[i++]=x[S++]))}else{S=i-k;do{E[i++]=E[S++],E[i++]=E[S++],E[i++]=E[S++],_-=3}while(_>2);_&&(E[i++]=E[S++],_>1&&(E[i++]=E[S++]))}break}if(64&w){e.msg="invalid distance code",r.mode=30;break e}v=g[(65535&v)+(f&(1<<w)-1)]}}break}}while(n<a&&i<o);n-=_=p>>3,f&=(1<<(p-=_<<3))-1,e.next_in=n,e.next_out=i,e.avail_in=n<a?a-n+5:5-(n-a),e.avail_out=i<o?o-i+257:257-(i-o),r.hold=f,r.bits=p},ln=function(e,t,r,n,a,i,s,o){var l,c,h,u,d,f,p,m,g,b=o.bits,y=0,v=0,w=0,_=0,k=0,S=0,x=0,C=0,E=0,A=0,P=null,T=0,N=new Yr.Buf16(16),R=new Yr.Buf16(16),B=null,M=0;for(y=0;y<=Jr;y++)N[y]=0;for(v=0;v<n;v++)N[t[r+v]]++;for(k=b,_=Jr;_>=1&&0===N[_];_--);if(k>_&&(k=_),0===_)return a[i++]=20971520,a[i++]=20971520,o.bits=1,0;for(w=1;w<_&&0===N[w];w++);for(k<w&&(k=w),C=1,y=1;y<=Jr;y++)if(C<<=1,(C-=N[y])<0)return-1;if(C>0&&(0===e||1!==_))return-1;for(R[1]=0,y=1;y<Jr;y++)R[y+1]=R[y]+N[y];for(v=0;v<n;v++)0!==t[r+v]&&(s[R[t[r+v]]++]=v);if(0===e?(P=B=s,f=19):1===e?(P=Qr,T-=257,B=en,M-=257,f=256):(P=tn,B=rn,f=-1),A=0,v=0,y=w,d=i,S=k,x=0,h=-1,u=(E=1<<k)-1,1===e&&E>852||2===e&&E>592)return 1;for(;;){p=y-x,s[v]<f?(m=0,g=s[v]):s[v]>f?(m=B[M+s[v]],g=P[T+s[v]]):(m=96,g=0),l=1<<y-x,w=c=1<<S;do{a[d+(A>>x)+(c-=l)]=p<<24|m<<16|g}while(0!==c);for(l=1<<y-1;A&l;)l>>=1;if(0!==l?(A&=l-1,A+=l):A=0,v++,0===--N[y]){if(y===_)break;y=t[r+s[v]]}if(y>k&&(A&u)!==h){for(0===x&&(x=k),d+=w,C=1<<(S=y-x);S+x<_&&!((C-=N[S+x])<=0);)S++,C<<=1;if(E+=1<<S,1===e&&E>852||2===e&&E>592)return 1;a[h=A&u]=k<<24|S<<16|d-i}}return 0!==A&&(a[d+A]=y-x<<24|64<<16),o.bits=k,0},cn=-2,hn=12,un=30;function dn(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function fn(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new nn.Buf16(320),this.work=new nn.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function pn(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new nn.Buf32(852),t.distcode=t.distdyn=new nn.Buf32(592),t.sane=1,t.back=-1,0):cn}function mn(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,pn(e)):cn}function gn(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?cn:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,mn(e))):cn}function bn(e,t){var r,n;return e?(n=new fn,e.state=n,n.window=null,0!==(r=gn(e,t))&&(e.state=null),r):cn}var yn,vn,wn=!0;function _n(e){if(wn){var t;for(yn=new nn.Buf32(512),vn=new nn.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(ln(1,e.lens,0,288,yn,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;ln(2,e.lens,0,32,vn,0,e.work,{bits:5}),wn=!1}e.lencode=yn,e.lenbits=9,e.distcode=vn,e.distbits=5}function kn(e,t,r,n){var a,i=e.state;return null===i.window&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new nn.Buf8(i.wsize)),n>=i.wsize?(nn.arraySet(i.window,t,r-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):((a=i.wsize-i.wnext)>n&&(a=n),nn.arraySet(i.window,t,r-n,a,i.wnext),(n-=a)?(nn.arraySet(i.window,t,r-n,n,0),i.wnext=n,i.whave=i.wsize):(i.wnext+=a,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=a))),0}Kr.inflateReset=mn,Kr.inflateReset2=gn,Kr.inflateResetKeep=pn,Kr.inflateInit=function(e){return bn(e,15)},Kr.inflateInit2=bn,Kr.inflate=function(e,t){var r,n,a,i,s,o,l,c,h,u,d,f,p,m,g,b,y,v,w,_,k,S,x,C,E=0,A=new nn.Buf8(4),P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return cn;(r=e.state).mode===hn&&(r.mode=13),s=e.next_out,a=e.output,l=e.avail_out,i=e.next_in,n=e.input,o=e.avail_in,c=r.hold,h=r.bits,u=o,d=l,S=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;h<16;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}if(2&r.wrap&&35615===c){r.check=0,A[0]=255&c,A[1]=c>>>8&255,r.check=sn(r.check,A,2,0),c=0,h=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",r.mode=un;break}if(8!=(15&c)){e.msg="unknown compression method",r.mode=un;break}if(h-=4,k=8+(15&(c>>>=4)),0===r.wbits)r.wbits=k;else if(k>r.wbits){e.msg="invalid window size",r.mode=un;break}r.dmax=1<<k,e.adler=r.check=1,r.mode=512&c?10:hn,c=0,h=0;break;case 2:for(;h<16;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}if(r.flags=c,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=un;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=un;break}r.head&&(r.head.text=c>>8&1),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,r.check=sn(r.check,A,2,0)),c=0,h=0,r.mode=3;case 3:for(;h<32;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}r.head&&(r.head.time=c),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,A[2]=c>>>16&255,A[3]=c>>>24&255,r.check=sn(r.check,A,4,0)),c=0,h=0,r.mode=4;case 4:for(;h<16;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}r.head&&(r.head.xflags=255&c,r.head.os=c>>8),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,r.check=sn(r.check,A,2,0)),c=0,h=0,r.mode=5;case 5:if(1024&r.flags){for(;h<16;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}r.length=c,r.head&&(r.head.extra_len=c),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,r.check=sn(r.check,A,2,0)),c=0,h=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((f=r.length)>o&&(f=o),f&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),nn.arraySet(r.head.extra,n,i,f,k)),512&r.flags&&(r.check=sn(r.check,n,f,i)),o-=f,i+=f,r.length-=f),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===o)break e;f=0;do{k=n[i+f++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k))}while(k&&f<o);if(512&r.flags&&(r.check=sn(r.check,n,f,i)),o-=f,i+=f,k)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===o)break e;f=0;do{k=n[i+f++],r.head&&k&&r.length<65536&&(r.head.comment+=String.fromCharCode(k))}while(k&&f<o);if(512&r.flags&&(r.check=sn(r.check,n,f,i)),o-=f,i+=f,k)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;h<16;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}if(c!==(65535&r.check)){e.msg="header crc mismatch",r.mode=un;break}c=0,h=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=hn;break;case 10:for(;h<32;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}e.adler=r.check=dn(c),c=0,h=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=s,e.avail_out=l,e.next_in=i,e.avail_in=o,r.hold=c,r.bits=h,2;e.adler=r.check=1,r.mode=hn;case hn:if(5===t||6===t)break e;case 13:if(r.last){c>>>=7&h,h-=7&h,r.mode=27;break}for(;h<3;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}switch(r.last=1&c,h-=1,3&(c>>>=1)){case 0:r.mode=14;break;case 1:if(_n(r),r.mode=20,6===t){c>>>=2,h-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=un}c>>>=2,h-=2;break;case 14:for(c>>>=7&h,h-=7&h;h<32;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",r.mode=un;break}if(r.length=65535&c,c=0,h=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(f=r.length){if(f>o&&(f=o),f>l&&(f=l),0===f)break e;nn.arraySet(a,n,i,f,s),o-=f,i+=f,l-=f,s+=f,r.length-=f;break}r.mode=hn;break;case 17:for(;h<14;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}if(r.nlen=257+(31&c),c>>>=5,h-=5,r.ndist=1+(31&c),c>>>=5,h-=5,r.ncode=4+(15&c),c>>>=4,h-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=un;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;h<3;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}r.lens[P[r.have++]]=7&c,c>>>=3,h-=3}for(;r.have<19;)r.lens[P[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,x={bits:r.lenbits},S=ln(0,r.lens,0,19,r.lencode,0,r.work,x),r.lenbits=x.bits,S){e.msg="invalid code lengths set",r.mode=un;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;b=(E=r.lencode[c&(1<<r.lenbits)-1])>>>16&255,y=65535&E,!((g=E>>>24)<=h);){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}if(y<16)c>>>=g,h-=g,r.lens[r.have++]=y;else{if(16===y){for(C=g+2;h<C;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}if(c>>>=g,h-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=un;break}k=r.lens[r.have-1],f=3+(3&c),c>>>=2,h-=2}else if(17===y){for(C=g+3;h<C;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}h-=g,k=0,f=3+(7&(c>>>=g)),c>>>=3,h-=3}else{for(C=g+7;h<C;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}h-=g,k=0,f=11+(127&(c>>>=g)),c>>>=7,h-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=un;break}for(;f--;)r.lens[r.have++]=k}}if(r.mode===un)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=un;break}if(r.lenbits=9,x={bits:r.lenbits},S=ln(1,r.lens,0,r.nlen,r.lencode,0,r.work,x),r.lenbits=x.bits,S){e.msg="invalid literal/lengths set",r.mode=un;break}if(r.distbits=6,r.distcode=r.distdyn,x={bits:r.distbits},S=ln(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,x),r.distbits=x.bits,S){e.msg="invalid distances set",r.mode=un;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(o>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=i,e.avail_in=o,r.hold=c,r.bits=h,on(e,d),s=e.next_out,a=e.output,l=e.avail_out,i=e.next_in,n=e.input,o=e.avail_in,c=r.hold,h=r.bits,r.mode===hn&&(r.back=-1);break}for(r.back=0;b=(E=r.lencode[c&(1<<r.lenbits)-1])>>>16&255,y=65535&E,!((g=E>>>24)<=h);){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}if(b&&!(240&b)){for(v=g,w=b,_=y;b=(E=r.lencode[_+((c&(1<<v+w)-1)>>v)])>>>16&255,y=65535&E,!(v+(g=E>>>24)<=h);){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}c>>>=v,h-=v,r.back+=v}if(c>>>=g,h-=g,r.back+=g,r.length=y,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=hn;break}if(64&b){e.msg="invalid literal/length code",r.mode=un;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(C=r.extra;h<C;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,h-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(E=r.distcode[c&(1<<r.distbits)-1])>>>16&255,y=65535&E,!((g=E>>>24)<=h);){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}if(!(240&b)){for(v=g,w=b,_=y;b=(E=r.distcode[_+((c&(1<<v+w)-1)>>v)])>>>16&255,y=65535&E,!(v+(g=E>>>24)<=h);){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}c>>>=v,h-=v,r.back+=v}if(c>>>=g,h-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=un;break}r.offset=y,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(C=r.extra;h<C;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,h-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=un;break}r.mode=25;case 25:if(0===l)break e;if(f=d-l,r.offset>f){if((f=r.offset-f)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=un;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),m=r.window}else m=a,p=s-r.offset,f=r.length;f>l&&(f=l),l-=f,r.length-=f;do{a[s++]=m[p++]}while(--f);0===r.length&&(r.mode=21);break;case 26:if(0===l)break e;a[s++]=r.length,l--,r.mode=21;break;case 27:if(r.wrap){for(;h<32;){if(0===o)break e;o--,c|=n[i++]<<h,h+=8}if(d-=l,e.total_out+=d,r.total+=d,d&&(e.adler=r.check=r.flags?sn(r.check,a,d,s-d):an(r.check,a,d,s-d)),d=l,(r.flags?c:dn(c))!==r.check){e.msg="incorrect data check",r.mode=un;break}c=0,h=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;h<32;){if(0===o)break e;o--,c+=n[i++]<<h,h+=8}if(c!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=un;break}c=0,h=0}r.mode=29;case 29:S=1;break e;case un:S=-3;break e;case 31:return-4;default:return cn}return e.next_out=s,e.avail_out=l,e.next_in=i,e.avail_in=o,r.hold=c,r.bits=h,(r.wsize||d!==e.avail_out&&r.mode<un&&(r.mode<27||4!==t))&&kn(e,e.output,e.next_out,d-e.avail_out),u-=e.avail_in,d-=e.avail_out,e.total_in+=u,e.total_out+=d,r.total+=d,r.wrap&&d&&(e.adler=r.check=r.flags?sn(r.check,a,d,e.next_out-d):an(r.check,a,d,e.next_out-d)),e.data_type=r.bits+(r.last?64:0)+(r.mode===hn?128:0)+(20===r.mode||15===r.mode?256:0),(0===u&&0===d||4===t)&&0===S&&(S=-5),S},Kr.inflateEnd=function(e){if(!e||!e.state)return cn;var t=e.state;return t.window&&(t.window=null),e.state=null,0},Kr.inflateGetHeader=function(e,t){var r;return e&&e.state&&2&(r=e.state).wrap?(r.head=t,t.done=!1,0):cn},Kr.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?cn:11===r.mode&&an(1,t,n,0)!==r.check?-3:kn(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):cn},Kr.inflateInfo="pako inflate (from Nodeca project)";var Sn={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var xn=Kr,Cn=ft,En=Mr,An=Sn,Pn=ar,Tn=jr,Nn=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},Rn=Object.prototype.toString;function Bn(e){if(!(this instanceof Bn))return new Bn(e);this.options=Cn.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Tn,this.strm.avail_out=0;var r=xn.inflateInit2(this.strm,t.windowBits);if(r!==An.Z_OK)throw new Error(Pn[r]);if(this.header=new Nn,xn.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=En.string2buf(t.dictionary):"[object ArrayBuffer]"===Rn.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=xn.inflateSetDictionary(this.strm,t.dictionary))!==An.Z_OK))throw new Error(Pn[r])}function Mn(e,t){var r=new Bn(t);if(r.push(e,!0),r.err)throw r.msg||Pn[r.err];return r.result}Bn.prototype.push=function(e,t){var r,n,a,i,s,o=this.strm,l=this.options.chunkSize,c=this.options.dictionary,h=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?An.Z_FINISH:An.Z_NO_FLUSH,"string"==typeof e?o.input=En.binstring2buf(e):"[object ArrayBuffer]"===Rn.call(e)?o.input=new Uint8Array(e):o.input=e,o.next_in=0,o.avail_in=o.input.length;do{if(0===o.avail_out&&(o.output=new Cn.Buf8(l),o.next_out=0,o.avail_out=l),(r=xn.inflate(o,An.Z_NO_FLUSH))===An.Z_NEED_DICT&&c&&(r=xn.inflateSetDictionary(this.strm,c)),r===An.Z_BUF_ERROR&&!0===h&&(r=An.Z_OK,h=!1),r!==An.Z_STREAM_END&&r!==An.Z_OK)return this.onEnd(r),this.ended=!0,!1;o.next_out&&(0!==o.avail_out&&r!==An.Z_STREAM_END&&(0!==o.avail_in||n!==An.Z_FINISH&&n!==An.Z_SYNC_FLUSH)||("string"===this.options.to?(a=En.utf8border(o.output,o.next_out),i=o.next_out-a,s=En.buf2string(o.output,a),o.next_out=i,o.avail_out=l-i,i&&Cn.arraySet(o.output,o.output,a,i,0),this.onData(s)):this.onData(Cn.shrinkBuf(o.output,o.next_out)))),0===o.avail_in&&0===o.avail_out&&(h=!0)}while((o.avail_in>0||0===o.avail_out)&&r!==An.Z_STREAM_END);return r===An.Z_STREAM_END&&(n=An.Z_FINISH),n===An.Z_FINISH?(r=xn.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===An.Z_OK):n!==An.Z_SYNC_FLUSH||(this.onEnd(An.Z_OK),o.avail_out=0,!0)},Bn.prototype.onData=function(e){this.chunks.push(e)},Bn.prototype.onEnd=function(e){e===An.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Cn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},Gr.Inflate=Bn,Gr.inflate=Mn,Gr.inflateRaw=function(e,t){return(t=t||{}).raw=!0,Mn(e,t)},Gr.ungzip=Mn;var Dn={};(0,ft.assign)(Dn,pt,Gr,Sn);var On="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,In=Dn,zn=me(),Fn=be,Ln=On?"uint8array":"array";function jn(e,t){Fn.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}dt.magic="\b\0",zn.inherits(jn,Fn),jn.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(zn.transformTo(Ln,e.data),!1)},jn.prototype.flush=function(){Fn.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},jn.prototype.cleanUp=function(){Fn.prototype.cleanUp.call(this),this._pako=null},jn.prototype._createPako=function(){this._pako=new In[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},dt.compressWorker=function(e){return new jn("Deflate",e)},dt.uncompressWorker=function(){return new jn("Inflate",{})};var $n=be;ut.STORE={magic:"\0\0",compressWorker:function(){return new $n("STORE compression")},uncompressWorker:function(){return new $n("STORE decompression")}},ut.DEFLATE=dt;var Un={LOCAL_FILE_HEADER:"PK",CENTRAL_FILE_HEADER:"PK",CENTRAL_DIRECTORY_END:"PK",ZIP64_CENTRAL_DIRECTORY_LOCATOR:"PK",ZIP64_CENTRAL_DIRECTORY_END:"PK",DATA_DESCRIPTOR:"PK\b"},Hn=me(),Wn=be,Zn=u,Vn=je,qn=Un,Xn=function(e,t){var r,n="";for(r=0;r<t;r++)n+=String.fromCharCode(255&e),e>>>=8;return n},Gn=function(e,t,r,n,a,i){var s,o,l=e.file,c=e.compression,h=i!==Zn.utf8encode,u=Hn.transformTo("string",i(l.name)),d=Hn.transformTo("string",Zn.utf8encode(l.name)),f=l.comment,p=Hn.transformTo("string",i(f)),m=Hn.transformTo("string",Zn.utf8encode(f)),g=d.length!==l.name.length,b=m.length!==f.length,y="",v="",w="",_=l.dir,k=l.date,S={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(S.crc32=e.crc32,S.compressedSize=e.compressedSize,S.uncompressedSize=e.uncompressedSize);var x=0;t&&(x|=8),h||!g&&!b||(x|=2048);var C,E,A,P=0,T=0;_&&(P|=16),"UNIX"===a?(T=798,P|=(C=l.unixPermissions,E=_,A=C,C||(A=E?16893:33204),(65535&A)<<16)):(T=20,P|=63&(l.dosPermissions||0)),s=k.getUTCHours(),s<<=6,s|=k.getUTCMinutes(),s<<=5,s|=k.getUTCSeconds()/2,o=k.getUTCFullYear()-1980,o<<=4,o|=k.getUTCMonth()+1,o<<=5,o|=k.getUTCDate(),g&&(v=Xn(1,1)+Xn(Vn(u),4)+d,y+="up"+Xn(v.length,2)+v),b&&(w=Xn(1,1)+Xn(Vn(p),4)+m,y+="uc"+Xn(w.length,2)+w);var N="";return N+="\n\0",N+=Xn(x,2),N+=c.magic,N+=Xn(s,2),N+=Xn(o,2),N+=Xn(S.crc32,4),N+=Xn(S.compressedSize,4),N+=Xn(S.uncompressedSize,4),N+=Xn(u.length,2),N+=Xn(y.length,2),{fileRecord:qn.LOCAL_FILE_HEADER+N+u+y,dirRecord:qn.CENTRAL_FILE_HEADER+Xn(T,2)+N+Xn(p.length,2)+"\0\0\0\0"+Xn(P,4)+Xn(n,4)+u+y+p}},Kn=function(e){return qn.DATA_DESCRIPTOR+Xn(e.crc32,4)+Xn(e.compressedSize,4)+Xn(e.uncompressedSize,4)};function Yn(e,t,r,n){Wn.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}Hn.inherits(Yn,Wn),Yn.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,Wn.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-n-1))/r:100}}))},Yn.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=Gn(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},Yn.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=Gn(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:Kn(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},Yn.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var r=this.bytesWritten-e,n=function(e,t,r,n,a){var i=Hn.transformTo("string",a(n));return qn.CENTRAL_DIRECTORY_END+"\0\0\0\0"+Xn(e,2)+Xn(e,2)+Xn(t,4)+Xn(r,4)+Xn(i.length,2)+i}(this.dirRecords.length,r,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})},Yn.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},Yn.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},Yn.prototype.resume=function(){return!!Wn.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},Yn.prototype.error=function(e){var t=this._sources;if(!Wn.prototype.error.call(this,e))return!1;for(var r=0;r<t.length;r++)try{t[r].error(e)}catch(e){}return!0},Yn.prototype.lock=function(){Wn.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()};var Jn=ut,Qn=Yn;ht.generateWorker=function(e,t,r){var n=new Qn(t.streamFiles,r,t.platform,t.encodeFileName),a=0;try{e.forEach(function(e,r){a++;var i=function(e,t){var r=e||t,n=Jn[r];if(!n)throw new Error(r+" is not a valid compression method !");return n}(r.options.compression,t.compression),s=r.options.compressionOptions||t.compressionOptions||{},o=r.dir,l=r.date;r._compressWorker(i,s).withStreamInfo("file",{name:e,dir:o,date:l,comment:r.comment||"",unixPermissions:r.unixPermissions,dosPermissions:r.dosPermissions}).pipe(n)}),n.entriesCount=a}catch(e){n.error(e)}return n};var ea=me(),ta=be;function ra(e,t){ta.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}ea.inherits(ra,ta),ra.prototype._bindStream=function(e){var t=this;this._stream=e,e.pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},ra.prototype.pause=function(){return!!ta.prototype.pause.call(this)&&(this._stream.pause(),!0)},ra.prototype.resume=function(){return!!ta.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)};var na=ra,aa=u,ia=me(),sa=be,oa=Be,la=Me,ca=Qe,ha=ct,ua=ht,da=ue,fa=na,pa=function(e,t,r){var n,a=ia.getTypeOf(t),i=ia.extend(r||{},la);i.date=i.date||new Date,null!==i.compression&&(i.compression=i.compression.toUpperCase()),"string"==typeof i.unixPermissions&&(i.unixPermissions=parseInt(i.unixPermissions,8)),i.unixPermissions&&16384&i.unixPermissions&&(i.dir=!0),i.dosPermissions&&16&i.dosPermissions&&(i.dir=!0),i.dir&&(e=ga(e)),i.createFolders&&(n=ma(e))&&ba.call(this,n,!0);var s="string"===a&&!1===i.binary&&!1===i.base64;r&&void 0!==r.binary||(i.binary=!s),(t instanceof ca&&0===t.uncompressedSize||i.dir||!t||0===t.length)&&(i.base64=!1,i.binary=!0,t="",i.compression="STORE",a="string");var o=null;o=t instanceof ca||t instanceof sa?t:da.isNode&&da.isStream(t)?new fa(e,t):ia.prepareContent(e,t,i.binary,i.optimizedBinaryString,i.base64);var l=new ha(e,o,i);this.files[e]=l},ma=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},ga=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},ba=function(e,t){return t=void 0!==t?t:la.createFolders,e=ga(e),this.files[e]||pa.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function ya(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var va={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,n;for(t in this.files)n=this.files[t],(r=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(r,n)},filter:function(e){var t=[];return this.forEach(function(r,n){e(r,n)&&t.push(n)}),t},file:function(e,t,r){if(1===arguments.length){if(ya(e)){var n=e;return this.filter(function(e,t){return!t.dir&&n.test(e)})}var a=this.files[this.root+e];return a&&!a.dir?a:null}return e=this.root+e,pa.call(this,e,t,r),this},folder:function(e){if(!e)return this;if(ya(e))return this.filter(function(t,r){return r.dir&&e.test(t)});var t=this.root+e,r=ba.call(this,t),n=this.clone();return n.root=r.name,n},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var r=this.filter(function(t,r){return r.name.slice(0,e.length)===e}),n=0;n<r.length;n++)delete this.files[r[n].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,r={};try{if((r=ia.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:aa.utf8encode})).type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),"binarystring"===r.type&&(r.type="string"),!r.type)throw new Error("No output type specified.");ia.checkSupport(r.type),"darwin"!==r.platform&&"freebsd"!==r.platform&&"linux"!==r.platform&&"sunos"!==r.platform||(r.platform="UNIX"),"win32"===r.platform&&(r.platform="DOS");var n=r.comment||this.comment||"";t=ua.generateWorker(this,r,n)}catch(e){(t=new sa("error")).error(e)}return new oa(t,r.type||"string",r.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}},wa=va,_a=me();function ka(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}ka.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,r=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return _a.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}};var Sa=ka,xa=Sa;function Ca(e){xa.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}me().inherits(Ca,xa),Ca.prototype.byteAt=function(e){return this.data[this.zero+e]},Ca.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),a=e.charCodeAt(3),i=this.length-4;i>=0;--i)if(this.data[i]===t&&this.data[i+1]===r&&this.data[i+2]===n&&this.data[i+3]===a)return i-this.zero;return-1},Ca.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),a=e.charCodeAt(3),i=this.readData(4);return t===i[0]&&r===i[1]&&n===i[2]&&a===i[3]},Ca.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};var Ea=Ca,Aa=Sa;function Pa(e){Aa.call(this,e)}me().inherits(Pa,Aa),Pa.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},Pa.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},Pa.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},Pa.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};var Ta=Pa,Na=Ea;function Ra(e){Na.call(this,e)}me().inherits(Ra,Na),Ra.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};var Ba=Ra,Ma=Ba;function Da(e){Ma.call(this,e)}me().inherits(Da,Ma),Da.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};var Oa=Da,Ia=me(),za=f,Fa=Ea,La=Ta,ja=Oa,$a=Ba,Ua=function(e){var t=Ia.getTypeOf(e);return Ia.checkSupport(t),"string"!==t||za.uint8array?"nodebuffer"===t?new ja(e):za.uint8array?new $a(Ia.transformTo("uint8array",e)):new Fa(Ia.transformTo("array",e)):new La(e)},Ha=Ua,Wa=me(),Za=Qe,Va=je,qa=u,Xa=ut,Ga=f;function Ka(e,t){this.options=e,this.loadOptions=t}Ka.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in Xa)if(Object.prototype.hasOwnProperty.call(Xa,t)&&Xa[t].magic===e)return Xa[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+Wa.pretty(this.compressionMethod)+" unknown (inner file : "+Wa.transformTo("string",this.fileName)+")");this.decompressed=new Za(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0===e&&(this.dosPermissions=63&this.externalFileAttributes),3===e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=Ha(this.extraFields[1].value);this.uncompressedSize===Wa.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===Wa.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===Wa.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===Wa.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,r,n,a=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<a;)t=e.readInt(2),r=e.readInt(2),n=e.readData(r),this.extraFields[t]={id:t,length:r,value:n};e.setIndex(a)},handleUTF8:function(){var e=Ga.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=qa.utf8decode(this.fileName),this.fileCommentStr=qa.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var r=Wa.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var n=this.findExtraFieldUnicodeComment();if(null!==n)this.fileCommentStr=n;else{var a=Wa.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(a)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=Ha(e.value);return 1!==t.readInt(1)||Va(this.fileName)!==t.readInt(4)?null:qa.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=Ha(e.value);return 1!==t.readInt(1)||Va(this.fileComment)!==t.readInt(4)?null:qa.utf8decode(t.readData(e.length-5))}return null}};var Ya=Ka,Ja=Ua,Qa=me(),ei=Un,ti=Ya,ri=f;function ni(e){this.files=[],this.loadOptions=e}ni.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+Qa.pretty(t)+", expected "+Qa.pretty(e)+")")}},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var n=this.reader.readString(4)===t;return this.reader.setIndex(r),n},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=ri.uint8array?"uint8array":"array",r=Qa.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,r,n=this.zip64EndOfCentralSize-44;0<n;)e=this.reader.readInt(2),t=this.reader.readInt(4),r=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(ei.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(ei.CENTRAL_FILE_HEADER);)(e=new ti({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(ei.CENTRAL_DIRECTORY_END);if(e<0)throw!this.isSignature(0,ei.LOCAL_FILE_HEADER)?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory");this.reader.setIndex(e);var t=e;if(this.checkSignature(ei.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===Qa.MAX_VALUE_16BITS||this.diskWithCentralDirStart===Qa.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===Qa.MAX_VALUE_16BITS||this.centralDirRecords===Qa.MAX_VALUE_16BITS||this.centralDirSize===Qa.MAX_VALUE_32BITS||this.centralDirOffset===Qa.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(ei.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(ei.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,ei.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(ei.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(ei.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var r=this.centralDirOffset+this.centralDirSize;this.zip64&&(r+=20,r+=12+this.zip64EndOfCentralSize);var n=t-r;if(n>0)this.isSignature(t,ei.CENTRAL_FILE_HEADER)||(this.reader.zero=n);else if(n<0)throw new Error("Corrupted zip: missing "+Math.abs(n)+" bytes.")},prepareReader:function(e){this.reader=Ja(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};var ai=ni,ii=me(),si=pe,oi=u,li=ai,ci=We,hi=ue;function ui(e){return new si.Promise(function(t,r){var n=e.decompressed.getContentWorker().pipe(new ci);n.on("error",function(e){r(e)}).on("end",function(){n.streamInfo.crc32!==e.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}function di(){if(!(this instanceof di))return new di;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new di;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}di.prototype=wa,di.prototype.loadAsync=function(e,t){var r=this;return t=ii.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:oi.utf8decode}),hi.isNode&&hi.isStream(e)?si.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):ii.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var r=new li(t);return r.load(e),r}).then(function(e){var r=[si.Promise.resolve(e)],n=e.files;if(t.checkCRC32)for(var a=0;a<n.length;a++)r.push(ui(n[a]));return si.Promise.all(r)}).then(function(e){for(var n=e.shift(),a=n.files,i=0;i<a.length;i++){var s=a[i],o=s.fileNameStr,l=ii.resolve(s.fileNameStr);r.file(l,s.decompressed,{binary:!0,optimizedBinaryString:!0,date:s.date,dir:s.dir,comment:s.fileCommentStr.length?s.fileCommentStr:null,unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions,createFolders:t.createFolders}),s.dir||(r.file(l).unsafeOriginalName=o)}return n.zipComment.length&&(r.comment=n.zipComment),r})},di.support=f,di.defaults=Me,di.version="3.10.1",di.loadAsync=function(e,t){return(new di).loadAsync(e,t)},di.external=pe;var fi,pi=i(di);function mi(e){return/^[^"'].*\s.*[^"']$/.test(e)?`'${e}'`:e}function gi(e){let t=e.lastIndexOf("/")+1;return[0==t?"":e.substring(0,t),0==t?e:e.substring(t)]}function bi(e,t){try{const r="http://docx/";return new URL(e,r+t).toString().substring(r.length)}catch{return`${t}${e}`}}function yi(e,t){return e.reduce((e,r)=>(e[t(r)]=r,e),{})}function vi(e){return e&&"object"==typeof e&&!Array.isArray(e)}function wi(e,...t){if(!t.length)return e;const r=t.shift();if(vi(e)&&vi(r))for(const t in r)if(vi(r[t])){wi(e[t]??(e[t]={}),r[t])}else e[t]=r[t];return wi(e,...t)}function _i(e){return Array.isArray(e)?e:[e]}!function(e){e.OfficeDocument="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",e.FontTable="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",e.Image="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",e.Numbering="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",e.Styles="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",e.StylesWithEffects="http://schemas.microsoft.com/office/2007/relationships/stylesWithEffects",e.Theme="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",e.Settings="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",e.WebSettings="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",e.Hyperlink="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",e.Footnotes="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",e.Endnotes="http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",e.Footer="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",e.Header="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",e.ExtendedProperties="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",e.CoreProperties="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",e.CustomProperties="http://schemas.openxmlformats.org/package/2006/relationships/metadata/custom-properties",e.Comments="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",e.CommentsExtended="http://schemas.microsoft.com/office/2011/relationships/commentsExtended",e.AltChunk="http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk"}(fi||(fi={}));const ki="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Si={mul:.05,unit:"pt"},xi={mul:1/12700,unit:"pt"},Ci={mul:.5,unit:"pt"},Ei={mul:.125,unit:"pt",min:.25,max:12},Ai={mul:1,unit:"pt"},Pi={mul:.02,unit:"%"};function Ti(e,t=Si){if(null==e||/.+(p[xt]|[%])$/.test(e))return e;var r=parseInt(e)*t.mul;return t.min&&t.max&&(r=function(e,t,r){return t>e?t:r<e?r:e}(r,t.min,t.max)),`${r.toFixed(2)}${t.unit}`}function Ni(e,t,r){if(e.namespaceURI!=ki)return!1;switch(e.localName){case"color":t.color=r.attr(e,"val");break;case"sz":t.fontSize=r.lengthAttr(e,"val",Ci);break;default:return!1}return!0}class Ri{elements(e,t=null){const r=[];for(let n=0,a=e.childNodes.length;n<a;n++){let a=e.childNodes.item(n);a.nodeType!=Node.ELEMENT_NODE||null!=t&&a.localName!=t||r.push(a)}return r}element(e,t){for(let r=0,n=e.childNodes.length;r<n;r++){let n=e.childNodes.item(r);if(1==n.nodeType&&n.localName==t)return n}return null}elementAttr(e,t,r){var n=this.element(e,t);return n?this.attr(n,r):void 0}attrs(e){return Array.from(e.attributes)}attr(e,t){for(let r=0,n=e.attributes.length;r<n;r++){let n=e.attributes.item(r);if(n.localName==t)return n.value}return null}intAttr(e,t,r=null){var n=this.attr(e,t);return n?parseInt(n):r}hexAttr(e,t,r=null){var n=this.attr(e,t);return n?parseInt(n,16):r}floatAttr(e,t,r=null){var n=this.attr(e,t);return n?parseFloat(n):r}boolAttr(e,t,r=null){return function(e,t=!1){switch(e){case"1":case"on":case"true":return!0;case"0":case"off":case"false":return!1;default:return t}}(this.attr(e,t),r)}lengthAttr(e,t,r=Si){return Ti(this.attr(e,t),r)}}const Bi=new Ri;class Mi{constructor(e,t){this._package=e,this.path=t}async load(){this.rels=await this._package.loadRelationships(this.path);const e=await this._package.load(this.path),t=this._package.parseXmlDocument(e);this._package.options.keepOrigin&&(this._xmlDocument=t),this.parseXml(t.firstElementChild)}save(){var e;this._package.update(this.path,(e=this._xmlDocument,(new XMLSerializer).serializeToString(e)))}parseXml(e){}}const Di={embedRegular:"regular",embedBold:"bold",embedItalic:"italic",embedBoldItalic:"boldItalic"};function Oi(e,t){return t.elements(e).map(e=>function(e,t){let r={name:t.attr(e,"name"),embedFontRefs:[]};for(let n of t.elements(e))switch(n.localName){case"family":r.family=t.attr(n,"val");break;case"altName":r.altName=t.attr(n,"val");break;case"embedRegular":case"embedBold":case"embedItalic":case"embedBoldItalic":r.embedFontRefs.push(Ii(n,t))}return r}(e,t))}function Ii(e,t){return{id:t.attr(e,"id"),key:t.attr(e,"fontKey"),type:Di[e.localName]}}class zi extends Mi{parseXml(e){this.fonts=Oi(e,this._package.xmlParser)}}class Fi{constructor(e,t){this._zip=e,this.options=t,this.xmlParser=new Ri}get(e){const t=function(e){return e.startsWith("/")?e.substr(1):e}(e);return this._zip.files[t]??this._zip.files[t.replace(/\//g,"\\")]}update(e,t){this._zip.file(e,t)}static async load(e,t){const r=await pi.loadAsync(e);return new Fi(r,t)}save(e="blob"){return this._zip.generateAsync({type:e})}load(e,t="string"){return this.get(e)?.async(t)??Promise.resolve(null)}async loadRelationships(e=null){let t="_rels/.rels";if(null!=e){const[r,n]=gi(e);t=`${r}_rels/${n}.rels`}const r=await this.load(t);return r?(n=this.parseXmlDocument(r).firstElementChild,(a=this.xmlParser).elements(n).map(e=>({id:a.attr(e,"Id"),type:a.attr(e,"Type"),target:a.attr(e,"Target"),targetMode:a.attr(e,"TargetMode")}))):null;var n,a}parseXmlDocument(e){return function(e,t=!1){var r;t&&(e=e.replace(/<[?].*[?]>/,"")),e=65279===(r=e).charCodeAt(0)?r.substring(1):r;const n=(new DOMParser).parseFromString(e,"application/xml"),a=(i=n,i.getElementsByTagName("parsererror")[0]?.textContent);var i;if(a)throw new Error(a);return n}(e,this.options.trimXmlDeclaration)}}class Li extends Mi{constructor(e,t,r){super(e,t),this._documentParser=r}parseXml(e){this.body=this._documentParser.parseDocumentFile(e)}}function ji(e,t){return{type:t.attr(e,"val"),color:t.attr(e,"color"),size:t.lengthAttr(e,"sz",Ei),offset:t.lengthAttr(e,"space",Ai),frame:t.boolAttr(e,"frame"),shadow:t.boolAttr(e,"shadow")}}function $i(e,t){var r={};for(let n of t.elements(e))switch(n.localName){case"left":r.left=ji(n,t);break;case"top":r.top=ji(n,t);break;case"right":r.right=ji(n,t);break;case"bottom":r.bottom=ji(n,t)}return r}var Ui,Hi;function Wi(e,t=Bi){var r={};for(let n of t.elements(e))switch(n.localName){case"pgSz":r.pageSize={width:t.lengthAttr(n,"w"),height:t.lengthAttr(n,"h"),orientation:t.attr(n,"orient")};break;case"type":r.type=t.attr(n,"val");break;case"pgMar":r.pageMargins={left:t.lengthAttr(n,"left"),right:t.lengthAttr(n,"right"),top:t.lengthAttr(n,"top"),bottom:t.lengthAttr(n,"bottom"),header:t.lengthAttr(n,"header"),footer:t.lengthAttr(n,"footer"),gutter:t.lengthAttr(n,"gutter")};break;case"cols":r.columns=Zi(n,t);break;case"headerReference":(r.headerRefs??(r.headerRefs=[])).push(qi(n,t));break;case"footerReference":(r.footerRefs??(r.footerRefs=[])).push(qi(n,t));break;case"titlePg":r.titlePage=t.boolAttr(n,"val",!0);break;case"pgBorders":r.pageBorders=$i(n,t);break;case"pgNumType":r.pageNumber=Vi(n,t)}return r}function Zi(e,t){return{numberOfColumns:t.intAttr(e,"num"),space:t.lengthAttr(e,"space"),separator:t.boolAttr(e,"sep"),equalWidth:t.boolAttr(e,"equalWidth",!0),columns:t.elements(e,"col").map(e=>({width:t.lengthAttr(e,"w"),space:t.lengthAttr(e,"space")}))}}function Vi(e,t){return{chapSep:t.attr(e,"chapSep"),chapStyle:t.attr(e,"chapStyle"),format:t.attr(e,"fmt"),start:t.intAttr(e,"start")}}function qi(e,t){return{id:t.attr(e,"id"),type:t.attr(e,"type")}}function Xi(e,t){let r={};for(let n of t.elements(e))Gi(n,r,t);return r}function Gi(e,t,r){return!!Ni(e,t,r)}function Ki(e,t){let r={};for(let n of t.elements(e))Yi(n,r,t);return r}function Yi(e,t,r){if(e.namespaceURI!=ki)return!1;if(Ni(e,t,r))return!0;switch(e.localName){case"tabs":t.tabs=function(e,t){return t.elements(e,"tab").map(e=>({position:t.lengthAttr(e,"pos"),leader:t.attr(e,"leader"),style:t.attr(e,"val")}))}(e,r);break;case"sectPr":t.sectionProps=Wi(e,r);break;case"numPr":t.numbering=function(e,t){var r={};for(let n of t.elements(e))switch(n.localName){case"numId":r.id=t.attr(n,"val");break;case"ilvl":r.level=t.intAttr(n,"val")}return r}(e,r);break;case"spacing":return t.lineSpacing=function(e,t){return{before:t.lengthAttr(e,"before"),after:t.lengthAttr(e,"after"),line:t.intAttr(e,"line"),lineRule:t.attr(e,"lineRule")}}(e,r),!1;case"textAlignment":return t.textAlignment=r.attr(e,"val"),!1;case"keepLines":t.keepLines=r.boolAttr(e,"val",!0);break;case"keepNext":t.keepNext=r.boolAttr(e,"val",!0);break;case"pageBreakBefore":t.pageBreakBefore=r.boolAttr(e,"val",!0);break;case"outlineLvl":t.outlineLevel=r.intAttr(e,"val");break;case"pStyle":t.styleName=r.attr(e,"val");break;case"rPr":t.runProps=Xi(e,r);break;default:return!1}return!0}function Ji(e,t){let r={id:t.attr(e,"numId"),overrides:[]};for(let n of t.elements(e))switch(n.localName){case"abstractNumId":r.abstractId=t.attr(n,"val");break;case"lvlOverride":r.overrides.push(ts(n,t))}return r}function Qi(e,t){let r={id:t.attr(e,"abstractNumId"),levels:[]};for(let n of t.elements(e))switch(n.localName){case"name":r.name=t.attr(n,"val");break;case"multiLevelType":r.multiLevelType=t.attr(n,"val");break;case"numStyleLink":r.numberingStyleLink=t.attr(n,"val");break;case"styleLink":r.styleLink=t.attr(n,"val");break;case"lvl":r.levels.push(es(n,t))}return r}function es(e,t){let r={level:t.intAttr(e,"ilvl")};for(let n of t.elements(e))switch(n.localName){case"start":r.start=t.attr(n,"val");break;case"lvlRestart":r.restart=t.intAttr(n,"val");break;case"numFmt":r.format=t.attr(n,"val");break;case"lvlText":r.text=t.attr(n,"val");break;case"lvlJc":r.justification=t.attr(n,"val");break;case"lvlPicBulletId":r.bulletPictureId=t.attr(n,"val");break;case"pStyle":r.paragraphStyle=t.attr(n,"val");break;case"pPr":r.paragraphProps=Ki(n,t);break;case"rPr":r.runProps=Xi(n,t)}return r}function ts(e,t){let r={level:t.intAttr(e,"ilvl")};for(let n of t.elements(e))switch(n.localName){case"startOverride":r.start=t.intAttr(n,"val");break;case"lvl":r.numberingLevel=es(n,t)}return r}function rs(e,t){var r=t.element(e,"pict"),n=r&&t.element(r,"shape"),a=n&&t.element(n,"imagedata");return a?{id:t.attr(e,"numPicBulletId"),referenceId:t.attr(a,"id"),style:t.attr(n,"style")}:null}!function(e){e.Continuous="continuous",e.NextPage="nextPage",e.NextColumn="nextColumn",e.EvenPage="evenPage",e.OddPage="oddPage"}(Ui||(Ui={}));class ns extends Mi{constructor(e,t,r){super(e,t),this._documentParser=r}parseXml(e){Object.assign(this,function(e,t){let r={numberings:[],abstractNumberings:[],bulletPictures:[]};for(let n of t.elements(e))switch(n.localName){case"num":r.numberings.push(Ji(n,t));break;case"abstractNum":r.abstractNumberings.push(Qi(n,t));break;case"numPicBullet":r.bulletPictures.push(rs(n,t))}return r}(e,this._package.xmlParser)),this.domNumberings=this._documentParser.parseNumberingFile(e)}}class as extends Mi{constructor(e,t,r){super(e,t),this._documentParser=r}parseXml(e){this.styles=this._documentParser.parseStylesFile(e)}}!function(e){e.Document="document",e.Paragraph="paragraph",e.Run="run",e.Break="break",e.NoBreakHyphen="noBreakHyphen",e.Table="table",e.Row="row",e.Cell="cell",e.Hyperlink="hyperlink",e.SmartTag="smartTag",e.Drawing="drawing",e.Image="image",e.Text="text",e.Tab="tab",e.Symbol="symbol",e.BookmarkStart="bookmarkStart",e.BookmarkEnd="bookmarkEnd",e.Footer="footer",e.Header="header",e.FootnoteReference="footnoteReference",e.EndnoteReference="endnoteReference",e.Footnote="footnote",e.Endnote="endnote",e.SimpleField="simpleField",e.ComplexField="complexField",e.Instruction="instruction",e.VmlPicture="vmlPicture",e.MmlMath="mmlMath",e.MmlMathParagraph="mmlMathParagraph",e.MmlFraction="mmlFraction",e.MmlFunction="mmlFunction",e.MmlFunctionName="mmlFunctionName",e.MmlNumerator="mmlNumerator",e.MmlDenominator="mmlDenominator",e.MmlRadical="mmlRadical",e.MmlBase="mmlBase",e.MmlDegree="mmlDegree",e.MmlSuperscript="mmlSuperscript",e.MmlSubscript="mmlSubscript",e.MmlPreSubSuper="mmlPreSubSuper",e.MmlSubArgument="mmlSubArgument",e.MmlSuperArgument="mmlSuperArgument",e.MmlNary="mmlNary",e.MmlDelimiter="mmlDelimiter",e.MmlRun="mmlRun",e.MmlEquationArray="mmlEquationArray",e.MmlLimit="mmlLimit",e.MmlLimitLower="mmlLimitLower",e.MmlMatrix="mmlMatrix",e.MmlMatrixRow="mmlMatrixRow",e.MmlBox="mmlBox",e.MmlBar="mmlBar",e.MmlGroupChar="mmlGroupChar",e.VmlElement="vmlElement",e.Inserted="inserted",e.Deleted="deleted",e.DeletedText="deletedText",e.Comment="comment",e.CommentReference="commentReference",e.CommentRangeStart="commentRangeStart",e.CommentRangeEnd="commentRangeEnd",e.AltChunk="altChunk"}(Hi||(Hi={}));class is{constructor(){this.children=[],this.cssStyle={}}}class ss extends is{constructor(){super(...arguments),this.type=Hi.Header}}class os extends is{constructor(){super(...arguments),this.type=Hi.Footer}}class ls extends Mi{constructor(e,t,r){super(e,t),this._documentParser=r}parseXml(e){this.rootElement=this.createRootElement(),this.rootElement.children=this._documentParser.parseBodyElements(e)}}class cs extends ls{createRootElement(){return new ss}}class hs extends ls{createRootElement(){return new os}}function us(e){if(void 0!==e)return parseInt(e)}class ds extends Mi{parseXml(e){this.props=function(e,t){const r={};for(let n of t.elements(e))switch(n.localName){case"Template":r.template=n.textContent;break;case"Pages":r.pages=us(n.textContent);break;case"Words":r.words=us(n.textContent);break;case"Characters":r.characters=us(n.textContent);break;case"Application":r.application=n.textContent;break;case"Lines":r.lines=us(n.textContent);break;case"Paragraphs":r.paragraphs=us(n.textContent);break;case"Company":r.company=n.textContent;break;case"AppVersion":r.appVersion=n.textContent}return r}(e,this._package.xmlParser)}}class fs extends Mi{parseXml(e){this.props=function(e,t){const r={};for(let n of t.elements(e))switch(n.localName){case"title":r.title=n.textContent;break;case"description":r.description=n.textContent;break;case"subject":r.subject=n.textContent;break;case"creator":r.creator=n.textContent;break;case"keywords":r.keywords=n.textContent;break;case"language":r.language=n.textContent;break;case"lastModifiedBy":r.lastModifiedBy=n.textContent;break;case"revision":n.textContent&&(r.revision=parseInt(n.textContent))}return r}(e,this._package.xmlParser)}}class ps{}function ms(e,t){var r={name:t.attr(e,"name"),colors:{}};for(let i of t.elements(e)){var n=t.element(i,"srgbClr"),a=t.element(i,"sysClr");n?r.colors[i.localName]=t.attr(n,"val"):a&&(r.colors[i.localName]=t.attr(a,"lastClr"))}return r}function gs(e,t){var r={name:t.attr(e,"name")};for(let n of t.elements(e))switch(n.localName){case"majorFont":r.majorFont=bs(n,t);break;case"minorFont":r.minorFont=bs(n,t)}return r}function bs(e,t){return{latinTypeface:t.elementAttr(e,"latin","typeface"),eaTypeface:t.elementAttr(e,"ea","typeface"),csTypeface:t.elementAttr(e,"cs","typeface")}}class ys extends Mi{constructor(e,t){super(e,t)}parseXml(e){this.theme=function(e,t){var r=new ps,n=t.element(e,"themeElements");for(let e of t.elements(n))switch(e.localName){case"clrScheme":r.colorScheme=ms(e,t);break;case"fontScheme":r.fontScheme=gs(e,t)}return r}(e,this._package.xmlParser)}}class vs{}class ws extends vs{constructor(){super(...arguments),this.type=Hi.Footnote}}class _s extends vs{constructor(){super(...arguments),this.type=Hi.Endnote}}class ks extends Mi{constructor(e,t,r){super(e,t),this._documentParser=r}}class Ss extends ks{constructor(e,t,r){super(e,t,r)}parseXml(e){this.notes=this._documentParser.parseNotes(e,"footnote",ws)}}class xs extends ks{constructor(e,t,r){super(e,t,r)}parseXml(e){this.notes=this._documentParser.parseNotes(e,"endnote",_s)}}function Cs(e,t){var r={defaultNoteIds:[]};for(let n of t.elements(e))switch(n.localName){case"numFmt":r.nummeringFormat=t.attr(n,"val");break;case"footnote":case"endnote":r.defaultNoteIds.push(t.attr(n,"id"))}return r}class Es extends Mi{constructor(e,t){super(e,t)}parseXml(e){this.settings=function(e,t){var r={};for(let n of t.elements(e))switch(n.localName){case"defaultTabStop":r.defaultTabStop=t.lengthAttr(n,"val");break;case"footnotePr":r.footnoteProps=Cs(n,t);break;case"endnotePr":r.endnoteProps=Cs(n,t);break;case"autoHyphenation":r.autoHyphenation=t.boolAttr(n,"val")}return r}(e,this._package.xmlParser)}}class As extends Mi{parseXml(e){this.props=function(e,t){return t.elements(e,"property").map(e=>{const r=e.firstChild;return{formatId:t.attr(e,"fmtid"),name:t.attr(e,"name"),type:r.nodeName,value:r.textContent}})}(e,this._package.xmlParser)}}class Ps extends Mi{constructor(e,t,r){super(e,t),this._documentParser=r}parseXml(e){this.comments=this._documentParser.parseComments(e),this.commentMap=yi(this.comments,e=>e.id)}}class Ts extends Mi{constructor(e,t){super(e,t),this.comments=[]}parseXml(e){const t=this._package.xmlParser;for(let r of t.elements(e,"commentEx"))this.comments.push({paraId:t.attr(r,"paraId"),paraIdParent:t.attr(r,"paraIdParent"),done:t.boolAttr(r,"done")});this.commentMap=yi(this.comments,e=>e.paraId)}}const Ns=[{type:fi.OfficeDocument,target:"word/document.xml"},{type:fi.ExtendedProperties,target:"docProps/app.xml"},{type:fi.CoreProperties,target:"docProps/core.xml"},{type:fi.CustomProperties,target:"docProps/custom.xml"}];class Rs{constructor(){this.parts=[],this.partsMap={}}static async load(e,t,r){var n=new Rs;return n._options=r,n._parser=t,n._package=await Fi.load(e,r),n.rels=await n._package.loadRelationships(),await Promise.all(Ns.map(e=>{const t=n.rels.find(t=>t.type===e.type)??e;return n.loadRelationshipPart(t.target,t.type)})),n}save(e="blob"){return this._package.save(e)}async loadRelationshipPart(e,t){if(this.partsMap[e])return this.partsMap[e];if(!this._package.get(e))return null;let r=null;switch(t){case fi.OfficeDocument:this.documentPart=r=new Li(this._package,e,this._parser);break;case fi.FontTable:this.fontTablePart=r=new zi(this._package,e);break;case fi.Numbering:this.numberingPart=r=new ns(this._package,e,this._parser);break;case fi.Styles:this.stylesPart=r=new as(this._package,e,this._parser);break;case fi.Theme:this.themePart=r=new ys(this._package,e);break;case fi.Footnotes:this.footnotesPart=r=new Ss(this._package,e,this._parser);break;case fi.Endnotes:this.endnotesPart=r=new xs(this._package,e,this._parser);break;case fi.Footer:r=new hs(this._package,e,this._parser);break;case fi.Header:r=new cs(this._package,e,this._parser);break;case fi.CoreProperties:this.corePropsPart=r=new fs(this._package,e);break;case fi.ExtendedProperties:this.extendedPropsPart=r=new ds(this._package,e);break;case fi.CustomProperties:r=new As(this._package,e);break;case fi.Settings:this.settingsPart=r=new Es(this._package,e);break;case fi.Comments:this.commentsPart=r=new Ps(this._package,e,this._parser);break;case fi.CommentsExtended:this.commentsExtendedPart=r=new Ts(this._package,e)}if(null==r)return Promise.resolve(null);if(this.partsMap[e]=r,this.parts.push(r),await r.load(),r.rels?.length>0){const[e]=gi(r.path);await Promise.all(r.rels.map(t=>this.loadRelationshipPart(bi(t.target,e),t.type)))}return r}async loadDocumentImage(e,t){const r=await this.loadResource(t??this.documentPart,e,"blob");return this.blobToURL(r)}async loadNumberingImage(e){const t=await this.loadResource(this.numberingPart,e,"blob");return this.blobToURL(t)}async loadFont(e,t){const r=await this.loadResource(this.fontTablePart,e,"uint8array");return r?this.blobToURL(new Blob([Bs(r,t)])):r}async loadAltChunk(e,t){return await this.loadResource(t??this.documentPart,e,"string")}blobToURL(e){return e?this._options.useBase64URL?function(e){return new Promise((t,r)=>{const n=new FileReader;n.onloadend=()=>t(n.result),n.onerror=()=>r(),n.readAsDataURL(e)})}(e):URL.createObjectURL(e):null}findPartByRelId(e,t=null){var r=(t.rels??this.rels).find(t=>t.id==e);const n=t?gi(t.path)[0]:"";return r?this.partsMap[bi(r.target,n)]:null}getPathById(e,t){const r=e.rels.find(e=>e.id==t),[n]=gi(e.path);return r?bi(r.target,n):null}loadResource(e,t,r){const n=this.getPathById(e,t);return n?this._package.load(n,r):Promise.resolve(null)}}function Bs(e,t){const r=t.replace(/{|}|-/g,""),n=new Array(16);for(let e=0;e<16;e++)n[16-e-1]=parseInt(r.substring(2*e,2*e+2),16);for(let t=0;t<32;t++)e[t]=e[t]^n[t%16];return e}function Ms(e,t){return{type:Hi.BookmarkStart,id:t.attr(e,"id"),name:t.attr(e,"name"),colFirst:t.intAttr(e,"colFirst"),colLast:t.intAttr(e,"colLast")}}function Ds(e,t){return{type:Hi.BookmarkEnd,id:t.attr(e,"id")}}class Os extends is{constructor(){super(...arguments),this.type=Hi.VmlElement,this.attrs={}}}function Is(e,t){var r=new Os;switch(e.localName){case"rect":r.tagName="rect",Object.assign(r.attrs,{width:"100%",height:"100%"});break;case"oval":r.tagName="ellipse",Object.assign(r.attrs,{cx:"50%",cy:"50%",rx:"50%",ry:"50%"});break;case"line":r.tagName="line";break;case"shape":r.tagName="g";break;case"textbox":r.tagName="foreignObject",Object.assign(r.attrs,{width:"100%",height:"100%"});break;default:return null}for(const t of Bi.attrs(e))switch(t.localName){case"style":r.cssStyleText=t.value;break;case"fillcolor":r.attrs.fill=t.value;break;case"from":const[e,n]=Ls(t.value);Object.assign(r.attrs,{x1:e,y1:n});break;case"to":const[a,i]=Ls(t.value);Object.assign(r.attrs,{x2:a,y2:i})}for(const n of Bi.elements(e))switch(n.localName){case"stroke":Object.assign(r.attrs,zs(n));break;case"fill":Object.assign(r.attrs,Fs());break;case"imagedata":r.tagName="image",Object.assign(r.attrs,{width:"100%",height:"100%"}),r.imageHref={id:Bi.attr(n,"id"),title:Bi.attr(n,"title")};break;case"txbxContent":r.children.push(...t.parseBodyElements(n));break;default:const e=Is(n,t);e&&r.children.push(e)}return r}function zs(e){return{stroke:Bi.attr(e,"color"),"stroke-width":Bi.lengthAttr(e,"weight",xi)??"1px"}}function Fs(e){return{}}function Ls(e){return e.split(",")}class js extends is{constructor(){super(...arguments),this.type=Hi.Comment}}class $s extends is{constructor(e){super(),this.id=e,this.type=Hi.CommentReference}}class Us extends is{constructor(e){super(),this.id=e,this.type=Hi.CommentRangeStart}}class Hs extends is{constructor(e){super(),this.id=e,this.type=Hi.CommentRangeEnd}}var Ws="inherit",Zs="black",Vs="black",qs="transparent";const Xs=[],Gs={oMath:Hi.MmlMath,oMathPara:Hi.MmlMathParagraph,f:Hi.MmlFraction,func:Hi.MmlFunction,fName:Hi.MmlFunctionName,num:Hi.MmlNumerator,den:Hi.MmlDenominator,rad:Hi.MmlRadical,deg:Hi.MmlDegree,e:Hi.MmlBase,sSup:Hi.MmlSuperscript,sSub:Hi.MmlSubscript,sPre:Hi.MmlPreSubSuper,sup:Hi.MmlSuperArgument,sub:Hi.MmlSubArgument,d:Hi.MmlDelimiter,nary:Hi.MmlNary,eqArr:Hi.MmlEquationArray,lim:Hi.MmlLimit,limLow:Hi.MmlLimitLower,m:Hi.MmlMatrix,mr:Hi.MmlMatrixRow,box:Hi.MmlBox,bar:Hi.MmlBar,groupChr:Hi.MmlGroupChar};class Ks{constructor(e){this.options={ignoreWidth:!1,debug:!1,...e}}parseNotes(e,t,r){var n=[];for(let a of Bi.elements(e,t)){const e=new r;e.id=Bi.attr(a,"id"),e.noteType=Bi.attr(a,"type"),e.children=this.parseBodyElements(a),n.push(e)}return n}parseComments(e){var t=[];for(let r of Bi.elements(e,"comment")){const e=new js;e.id=Bi.attr(r,"id"),e.author=Bi.attr(r,"author"),e.initials=Bi.attr(r,"initials"),e.date=Bi.attr(r,"date"),e.children=this.parseBodyElements(r),t.push(e)}return t}parseDocumentFile(e){var t=Bi.element(e,"body"),r=Bi.element(e,"background"),n=Bi.element(t,"sectPr");return{type:Hi.Document,children:this.parseBodyElements(t),props:n?Wi(n,Bi):{},cssStyle:r?this.parseBackground(r):{}}}parseBackground(e){var t={},r=Js.colorAttr(e,"color");return r&&(t["background-color"]=r),t}parseBodyElements(e){var t=[];for(const r of Bi.elements(e))switch(r.localName){case"p":t.push(this.parseParagraph(r));break;case"altChunk":t.push(this.parseAltChunk(r));break;case"tbl":t.push(this.parseTable(r));break;case"sdt":t.push(...this.parseSdt(r,e=>this.parseBodyElements(e)))}return t}parseStylesFile(e){var t=[];for(const r of Bi.elements(e))switch(r.localName){case"style":t.push(this.parseStyle(r));break;case"docDefaults":t.push(this.parseDefaultStyles(r))}return t}parseDefaultStyles(e){var t={id:null,name:null,target:null,basedOn:null,styles:[]};for(const a of Bi.elements(e))switch(a.localName){case"rPrDefault":var r=Bi.element(a,"rPr");r&&t.styles.push({target:"span",values:this.parseDefaultProperties(r,{})});break;case"pPrDefault":var n=Bi.element(a,"pPr");n&&t.styles.push({target:"p",values:this.parseDefaultProperties(n,{})})}return t}parseStyle(e){var t={id:Bi.attr(e,"styleId"),isDefault:Bi.boolAttr(e,"default"),name:null,target:null,basedOn:null,styles:[],linked:null};switch(Bi.attr(e,"type")){case"paragraph":t.target="p";break;case"table":t.target="table";break;case"character":t.target="span"}for(const r of Bi.elements(e))switch(r.localName){case"basedOn":t.basedOn=Bi.attr(r,"val");break;case"name":t.name=Bi.attr(r,"val");break;case"link":t.linked=Bi.attr(r,"val");break;case"next":t.next=Bi.attr(r,"val");break;case"aliases":t.aliases=Bi.attr(r,"val").split(",");break;case"pPr":t.styles.push({target:"p",values:this.parseDefaultProperties(r,{})}),t.paragraphProps=Ki(r,Bi);break;case"rPr":t.styles.push({target:"span",values:this.parseDefaultProperties(r,{})}),t.runProps=Xi(r,Bi);break;case"tblPr":case"tcPr":t.styles.push({target:"td",values:this.parseDefaultProperties(r,{})});break;case"tblStylePr":for(let e of this.parseTableStyle(r))t.styles.push(e);break;case"rsid":case"qFormat":case"hidden":case"semiHidden":case"unhideWhenUsed":case"autoRedefine":case"uiPriority":break;default:this.options.debug&&console.warn(`DOCX: Unknown style element: ${r.localName}`)}return t}parseTableStyle(e){var t=[],r="",n="";switch(Bi.attr(e,"type")){case"firstRow":n=".first-row",r="tr.first-row td";break;case"lastRow":n=".last-row",r="tr.last-row td";break;case"firstCol":n=".first-col",r="td.first-col";break;case"lastCol":n=".last-col",r="td.last-col";break;case"band1Vert":n=":not(.no-vband)",r="td.odd-col";break;case"band2Vert":n=":not(.no-vband)",r="td.even-col";break;case"band1Horz":n=":not(.no-hband)",r="tr.odd-row";break;case"band2Horz":n=":not(.no-hband)",r="tr.even-row";break;default:return[]}for(const a of Bi.elements(e))switch(a.localName){case"pPr":t.push({target:`${r} p`,mod:n,values:this.parseDefaultProperties(a,{})});break;case"rPr":t.push({target:`${r} span`,mod:n,values:this.parseDefaultProperties(a,{})});break;case"tblPr":case"tcPr":t.push({target:r,mod:n,values:this.parseDefaultProperties(a,{})})}return t}parseNumberingFile(e){var t=[],r={},n=[];for(const s of Bi.elements(e))switch(s.localName){case"abstractNum":this.parseAbstractNumbering(s,n).forEach(e=>t.push(e));break;case"numPicBullet":n.push(this.parseNumberingPicBullet(s));break;case"num":var a=Bi.attr(s,"numId"),i=Bi.elementAttr(s,"abstractNumId","val");r[i]=a}return t.forEach(e=>e.id=r[e.id]),t}parseNumberingPicBullet(e){var t=Bi.element(e,"pict"),r=t&&Bi.element(t,"shape"),n=r&&Bi.element(r,"imagedata");return n?{id:Bi.intAttr(e,"numPicBulletId"),src:Bi.attr(n,"id"),style:Bi.attr(r,"style")}:null}parseAbstractNumbering(e,t){var r=[],n=Bi.attr(e,"abstractNumId");for(const a of Bi.elements(e))if("lvl"===a.localName)r.push(this.parseNumberingLevel(n,a,t));return r}parseNumberingLevel(e,t,r){var n={id:e,level:Bi.intAttr(t,"ilvl"),start:1,pStyleName:void 0,pStyle:{},rStyle:{},suff:"tab"};for(const e of Bi.elements(t))switch(e.localName){case"start":n.start=Bi.intAttr(e,"val");break;case"pPr":this.parseDefaultProperties(e,n.pStyle);break;case"rPr":this.parseDefaultProperties(e,n.rStyle);break;case"lvlPicBulletId":var a=Bi.intAttr(e,"val");n.bullet=r.find(e=>e?.id==a);break;case"lvlText":n.levelText=Bi.attr(e,"val");break;case"pStyle":n.pStyleName=Bi.attr(e,"val");break;case"numFmt":n.format=Bi.attr(e,"val");break;case"suff":n.suff=Bi.attr(e,"val")}return n}parseSdt(e,t){const r=Bi.element(e,"sdtContent");return r?t(r):[]}parseInserted(e,t){return{type:Hi.Inserted,children:t(e)?.children??[]}}parseDeleted(e,t){return{type:Hi.Deleted,children:t(e)?.children??[]}}parseAltChunk(e){return{type:Hi.AltChunk,children:[],id:Bi.attr(e,"id")}}parseParagraph(e){var t={type:Hi.Paragraph,children:[]};for(let r of Bi.elements(e))switch(r.localName){case"pPr":this.parseParagraphProperties(r,t);break;case"r":t.children.push(this.parseRun(r,t));break;case"hyperlink":t.children.push(this.parseHyperlink(r,t));break;case"smartTag":t.children.push(this.parseSmartTag(r,t));break;case"bookmarkStart":t.children.push(Ms(r,Bi));break;case"bookmarkEnd":t.children.push(Ds(r,Bi));break;case"commentRangeStart":t.children.push(new Us(Bi.attr(r,"id")));break;case"commentRangeEnd":t.children.push(new Hs(Bi.attr(r,"id")));break;case"oMath":case"oMathPara":t.children.push(this.parseMathElement(r));break;case"sdt":t.children.push(...this.parseSdt(r,e=>this.parseParagraph(e).children));break;case"ins":t.children.push(this.parseInserted(r,e=>this.parseParagraph(e)));break;case"del":t.children.push(this.parseDeleted(r,e=>this.parseParagraph(e)))}return t}parseParagraphProperties(e,t){this.parseDefaultProperties(e,t.cssStyle={},null,e=>{if(Yi(e,t,Bi))return!0;switch(e.localName){case"pStyle":t.styleName=Bi.attr(e,"val");break;case"cnfStyle":t.className=Qs.classNameOfCnfStyle(e);break;case"framePr":this.parseFrame(e,t);break;case"rPr":break;default:return!1}return!0})}parseFrame(e,t){"drop"==Bi.attr(e,"dropCap")&&(t.cssStyle.float="left")}parseHyperlink(e,t){var r={type:Hi.Hyperlink,parent:t,children:[]};r.anchor=Bi.attr(e,"anchor"),r.id=Bi.attr(e,"id");for(const t of Bi.elements(e))if("r"===t.localName)r.children.push(this.parseRun(t,r));return r}parseSmartTag(e,t){var r={type:Hi.SmartTag,parent:t,children:[]},n=Bi.attr(e,"uri"),a=Bi.attr(e,"element");n&&(r.uri=n),a&&(r.element=a);for(const t of Bi.elements(e))if("r"===t.localName)r.children.push(this.parseRun(t,r));return r}parseRun(e,t){var r={type:Hi.Run,parent:t,children:[]};for(let t of Bi.elements(e))switch(t=this.checkAlternateContent(t),t.localName){case"t":r.children.push({type:Hi.Text,text:t.textContent});break;case"delText":r.children.push({type:Hi.DeletedText,text:t.textContent});break;case"commentReference":r.children.push(new $s(Bi.attr(t,"id")));break;case"fldSimple":r.children.push({type:Hi.SimpleField,instruction:Bi.attr(t,"instr"),lock:Bi.boolAttr(t,"lock",!1),dirty:Bi.boolAttr(t,"dirty",!1)});break;case"instrText":r.fieldRun=!0,r.children.push({type:Hi.Instruction,text:t.textContent});break;case"fldChar":r.fieldRun=!0,r.children.push({type:Hi.ComplexField,charType:Bi.attr(t,"fldCharType"),lock:Bi.boolAttr(t,"lock",!1),dirty:Bi.boolAttr(t,"dirty",!1)});break;case"noBreakHyphen":r.children.push({type:Hi.NoBreakHyphen});break;case"br":r.children.push({type:Hi.Break,break:Bi.attr(t,"type")||"textWrapping"});break;case"lastRenderedPageBreak":r.children.push({type:Hi.Break,break:"lastRenderedPageBreak"});break;case"sym":r.children.push({type:Hi.Symbol,font:mi(Bi.attr(t,"font")),char:Bi.attr(t,"char")});break;case"tab":r.children.push({type:Hi.Tab});break;case"footnoteReference":r.children.push({type:Hi.FootnoteReference,id:Bi.attr(t,"id")});break;case"endnoteReference":r.children.push({type:Hi.EndnoteReference,id:Bi.attr(t,"id")});break;case"drawing":let e=this.parseDrawing(t);e&&(r.children=[e]);break;case"pict":r.children.push(this.parseVmlPicture(t));break;case"rPr":this.parseRunProperties(t,r)}return r}parseMathElement(e){const t=`${e.localName}Pr`,r={type:Gs[e.localName],children:[]};for(const a of Bi.elements(e)){if(Gs[a.localName])r.children.push(this.parseMathElement(a));else if("r"==a.localName){var n=this.parseRun(a);n.type=Hi.MmlRun,r.children.push(n)}else a.localName==t&&(r.props=this.parseMathProperies(a))}return r}parseMathProperies(e){const t={};for(const r of Bi.elements(e))switch(r.localName){case"chr":t.char=Bi.attr(r,"val");break;case"vertJc":t.verticalJustification=Bi.attr(r,"val");break;case"pos":t.position=Bi.attr(r,"val");break;case"degHide":t.hideDegree=Bi.boolAttr(r,"val");break;case"begChr":t.beginChar=Bi.attr(r,"val");break;case"endChr":t.endChar=Bi.attr(r,"val")}return t}parseRunProperties(e,t){this.parseDefaultProperties(e,t.cssStyle={},null,e=>{switch(e.localName){case"rStyle":t.styleName=Bi.attr(e,"val");break;case"vertAlign":t.verticalAlign=Qs.valueOfVertAlign(e,!0);break;default:return!1}return!0})}parseVmlPicture(e){const t={type:Hi.VmlPicture,children:[]};for(const r of Bi.elements(e)){const e=Is(r,this);e&&t.children.push(e)}return t}checkAlternateContent(e){if("AlternateContent"!=e.localName)return e;var t=Bi.element(e,"Choice");if(t){var r=Bi.attr(t,"Requires"),n=e.lookupNamespaceURI(r);if(Xs.includes(n))return t.firstElementChild}return Bi.element(e,"Fallback")?.firstElementChild}parseDrawing(e){for(var t of Bi.elements(e))switch(t.localName){case"inline":case"anchor":return this.parseDrawingWrapper(t)}}parseDrawingWrapper(e){var t={type:Hi.Drawing,children:[],cssStyle:{}},r="anchor"==e.localName;let n=null,a=Bi.boolAttr(e,"simplePos");Bi.boolAttr(e,"behindDoc");let i={relative:"page",align:"left",offset:"0"},s={relative:"page",align:"top",offset:"0"};for(var o of Bi.elements(e))switch(o.localName){case"simplePos":a&&(i.offset=Bi.lengthAttr(o,"x",xi),s.offset=Bi.lengthAttr(o,"y",xi));break;case"extent":t.cssStyle.width=Bi.lengthAttr(o,"cx",xi),t.cssStyle.height=Bi.lengthAttr(o,"cy",xi);break;case"positionH":case"positionV":if(!a){let e="positionH"==o.localName?i:s;var l=Bi.element(o,"align"),c=Bi.element(o,"posOffset");e.relative=Bi.attr(o,"relativeFrom")??e.relative,l&&(e.align=l.textContent),c&&(e.offset=Ti(c.textContent,xi))}break;case"wrapTopAndBottom":n="wrapTopAndBottom";break;case"wrapNone":n="wrapNone";break;case"graphic":var h=this.parseGraphic(o);h&&t.children.push(h)}return"wrapTopAndBottom"==n?(t.cssStyle.display="block",i.align&&(t.cssStyle["text-align"]=i.align,t.cssStyle.width="100%")):"wrapNone"==n?(t.cssStyle.display="block",t.cssStyle.position="relative",t.cssStyle.width="0px",t.cssStyle.height="0px",i.offset&&(t.cssStyle.left=i.offset),s.offset&&(t.cssStyle.top=s.offset)):!r||"left"!=i.align&&"right"!=i.align||(t.cssStyle.float=i.align),t}parseGraphic(e){var t=Bi.element(e,"graphicData");for(let e of Bi.elements(t))if("pic"===e.localName)return this.parsePicture(e);return null}parsePicture(e){var t={type:Hi.Image,src:"",cssStyle:{}},r=Bi.element(e,"blipFill"),n=Bi.element(r,"blip"),a=Bi.element(r,"srcRect");t.src=Bi.attr(n,"embed"),a&&(t.srcRect=[Bi.intAttr(a,"l",0)/1e5,Bi.intAttr(a,"t",0)/1e5,Bi.intAttr(a,"r",0)/1e5,Bi.intAttr(a,"b",0)/1e5]);var i=Bi.element(e,"spPr"),s=Bi.element(i,"xfrm");if(t.cssStyle.position="relative",s)for(var o of(t.rotation=Bi.intAttr(s,"rot",0)/6e4,Bi.elements(s)))switch(o.localName){case"ext":t.cssStyle.width=Bi.lengthAttr(o,"cx",xi),t.cssStyle.height=Bi.lengthAttr(o,"cy",xi);break;case"off":t.cssStyle.left=Bi.lengthAttr(o,"x",xi),t.cssStyle.top=Bi.lengthAttr(o,"y",xi)}return t}parseTable(e){var t={type:Hi.Table,children:[]};for(const r of Bi.elements(e))switch(r.localName){case"tr":t.children.push(this.parseTableRow(r));break;case"tblGrid":t.columns=this.parseTableColumns(r);break;case"tblPr":this.parseTableProperties(r,t)}return t}parseTableColumns(e){var t=[];for(const r of Bi.elements(e))if("gridCol"===r.localName)t.push({width:Bi.lengthAttr(r,"w")});return t}parseTableProperties(e,t){switch(t.cssStyle={},t.cellStyle={},this.parseDefaultProperties(e,t.cssStyle,t.cellStyle,e=>{switch(e.localName){case"tblStyle":t.styleName=Bi.attr(e,"val");break;case"tblLook":t.className=Qs.classNameOftblLook(e);break;case"tblpPr":this.parseTablePosition(e,t);break;case"tblStyleColBandSize":t.colBandSize=Bi.intAttr(e,"val");break;case"tblStyleRowBandSize":t.rowBandSize=Bi.intAttr(e,"val");break;case"hidden":t.cssStyle.display="none";break;default:return!1}return!0}),t.cssStyle["text-align"]){case"center":delete t.cssStyle["text-align"],t.cssStyle["margin-left"]="auto",t.cssStyle["margin-right"]="auto";break;case"right":delete t.cssStyle["text-align"],t.cssStyle["margin-left"]="auto"}}parseTablePosition(e,t){var r=Bi.lengthAttr(e,"topFromText"),n=Bi.lengthAttr(e,"bottomFromText"),a=Bi.lengthAttr(e,"rightFromText"),i=Bi.lengthAttr(e,"leftFromText");t.cssStyle.float="left",t.cssStyle["margin-bottom"]=Qs.addSize(t.cssStyle["margin-bottom"],n),t.cssStyle["margin-left"]=Qs.addSize(t.cssStyle["margin-left"],i),t.cssStyle["margin-right"]=Qs.addSize(t.cssStyle["margin-right"],a),t.cssStyle["margin-top"]=Qs.addSize(t.cssStyle["margin-top"],r)}parseTableRow(e){var t={type:Hi.Row,children:[]};for(const r of Bi.elements(e))switch(r.localName){case"tc":t.children.push(this.parseTableCell(r));break;case"trPr":case"tblPrEx":this.parseTableRowProperties(r,t)}return t}parseTableRowProperties(e,t){t.cssStyle=this.parseDefaultProperties(e,{},null,e=>{switch(e.localName){case"cnfStyle":t.className=Qs.classNameOfCnfStyle(e);break;case"tblHeader":t.isHeader=Bi.boolAttr(e,"val");break;case"gridBefore":t.gridBefore=Bi.intAttr(e,"val");break;case"gridAfter":t.gridAfter=Bi.intAttr(e,"val");break;default:return!1}return!0})}parseTableCell(e){var t={type:Hi.Cell,children:[]};for(const r of Bi.elements(e))switch(r.localName){case"tbl":t.children.push(this.parseTable(r));break;case"p":t.children.push(this.parseParagraph(r));break;case"tcPr":this.parseTableCellProperties(r,t)}return t}parseTableCellProperties(e,t){t.cssStyle=this.parseDefaultProperties(e,{},null,e=>{switch(e.localName){case"gridSpan":t.span=Bi.intAttr(e,"val",null);break;case"vMerge":t.verticalMerge=Bi.attr(e,"val")??"continue";break;case"cnfStyle":t.className=Qs.classNameOfCnfStyle(e);break;default:return!1}return!0}),this.parseTableCellVerticalText(e,t)}parseTableCellVerticalText(e,t){const r={btLr:{writingMode:"vertical-rl",transform:"rotate(180deg)"},lrTb:{writingMode:"vertical-lr",transform:"none"},tbRl:{writingMode:"vertical-rl",transform:"none"}};for(const n of Bi.elements(e))if("textDirection"===n.localName){const e=r[Bi.attr(n,"val")]||{writingMode:"horizontal-tb"};t.cssStyle["writing-mode"]=e.writingMode,t.cssStyle.transform=e.transform}}parseDefaultProperties(e,t=null,r=null,n=null){t=t||{};for(const a of Bi.elements(e))if(!n?.(a))switch(a.localName){case"jc":t["text-align"]=Qs.valueOfJc(a);break;case"textAlignment":t["vertical-align"]=Qs.valueOfTextAlignment(a);break;case"color":t.color=Js.colorAttr(a,"val",null,Zs);break;case"sz":t["font-size"]=t["min-height"]=Bi.lengthAttr(a,"val",Ci);break;case"shd":t["background-color"]=Js.colorAttr(a,"fill",null,Ws);break;case"highlight":t["background-color"]=Js.colorAttr(a,"val",null,qs);break;case"vertAlign":break;case"position":t.verticalAlign=Bi.lengthAttr(a,"val",Ci);break;case"tcW":if(this.options.ignoreWidth)break;case"tblW":t.width=Qs.valueOfSize(a,"w");break;case"trHeight":this.parseTrHeight(a,t);break;case"strike":t["text-decoration"]=Bi.boolAttr(a,"val",!0)?"line-through":"none";break;case"b":t["font-weight"]=Bi.boolAttr(a,"val",!0)?"bold":"normal";break;case"i":t["font-style"]=Bi.boolAttr(a,"val",!0)?"italic":"normal";break;case"caps":t["text-transform"]=Bi.boolAttr(a,"val",!0)?"uppercase":"none";break;case"smallCaps":t["font-variant"]=Bi.boolAttr(a,"val",!0)?"small-caps":"none";break;case"u":this.parseUnderline(a,t);break;case"ind":case"tblInd":this.parseIndentation(a,t);break;case"rFonts":this.parseFont(a,t);break;case"tblBorders":this.parseBorderProperties(a,r||t);break;case"tblCellSpacing":t["border-spacing"]=Qs.valueOfMargin(a),t["border-collapse"]="separate";break;case"pBdr":this.parseBorderProperties(a,t);break;case"bdr":t.border=Qs.valueOfBorder(a);break;case"tcBorders":this.parseBorderProperties(a,t);break;case"vanish":Bi.boolAttr(a,"val",!0)&&(t.display="none");break;case"kern":case"noWrap":break;case"tblCellMar":case"tcMar":this.parseMarginProperties(a,r||t);break;case"tblLayout":t["table-layout"]=Qs.valueOfTblLayout(a);break;case"vAlign":t["vertical-align"]=Qs.valueOfTextAlignment(a);break;case"spacing":"pPr"==e.localName&&this.parseSpacing(a,t);break;case"wordWrap":Bi.boolAttr(a,"val")&&(t["overflow-wrap"]="break-word");break;case"suppressAutoHyphens":t.hyphens=Bi.boolAttr(a,"val",!0)?"none":"auto";break;case"lang":t.$lang=Bi.attr(a,"val");break;case"rtl":case"bidi":Bi.boolAttr(a,"val",!0)&&(t.direction="rtl");break;case"bCs":case"iCs":case"szCs":case"tabs":case"outlineLvl":case"contextualSpacing":case"tblStyleColBandSize":case"tblStyleRowBandSize":case"webHidden":case"pageBreakBefore":case"suppressLineNumbers":case"keepLines":case"keepNext":case"widowControl":case"bidi":case"rtl":case"noProof":break;default:this.options.debug&&console.warn(`DOCX: Unknown document element: ${e.localName}.${a.localName}`)}return t}parseUnderline(e,t){var r=Bi.attr(e,"val");if(null!=r){switch(r){case"dash":case"dashDotDotHeavy":case"dashDotHeavy":case"dashedHeavy":case"dashLong":case"dashLongHeavy":case"dotDash":case"dotDotDash":t["text-decoration"]="underline dashed";break;case"dotted":case"dottedHeavy":t["text-decoration"]="underline dotted";break;case"double":t["text-decoration"]="underline double";break;case"single":case"thick":case"words":t["text-decoration"]="underline";break;case"wave":case"wavyDouble":case"wavyHeavy":t["text-decoration"]="underline wavy";break;case"none":t["text-decoration"]="none"}var n=Js.colorAttr(e,"color");n&&(t["text-decoration-color"]=n)}}parseFont(e,t){var r=[Bi.attr(e,"ascii"),Qs.themeValue(e,"asciiTheme"),Bi.attr(e,"eastAsia")].filter(e=>e).map(e=>mi(e));r.length>0&&(t["font-family"]=[...new Set(r)].join(", "))}parseIndentation(e,t){var r=Bi.lengthAttr(e,"firstLine"),n=Bi.lengthAttr(e,"hanging"),a=Bi.lengthAttr(e,"left"),i=Bi.lengthAttr(e,"start"),s=Bi.lengthAttr(e,"right"),o=Bi.lengthAttr(e,"end");r&&(t["text-indent"]=r),n&&(t["text-indent"]=`-${n}`),(a||i)&&(t["margin-inline-start"]=a||i),(s||o)&&(t["margin-inline-end"]=s||o)}parseSpacing(e,t){var r=Bi.lengthAttr(e,"before"),n=Bi.lengthAttr(e,"after"),a=Bi.intAttr(e,"line",null),i=Bi.attr(e,"lineRule");if(r&&(t["margin-top"]=r),n&&(t["margin-bottom"]=n),null!==a)switch(i){case"auto":t["line-height"]=`${(a/240).toFixed(2)}`;break;case"atLeast":t["line-height"]=`calc(100% + ${a/20}pt)`;break;default:t["line-height"]=t["min-height"]=a/20+"pt"}}parseMarginProperties(e,t){for(const r of Bi.elements(e))switch(r.localName){case"left":t["padding-left"]=Qs.valueOfMargin(r);break;case"right":t["padding-right"]=Qs.valueOfMargin(r);break;case"top":t["padding-top"]=Qs.valueOfMargin(r);break;case"bottom":t["padding-bottom"]=Qs.valueOfMargin(r)}}parseTrHeight(e,t){Bi.attr(e,"hRule"),t.height=Bi.lengthAttr(e,"val")}parseBorderProperties(e,t){for(const r of Bi.elements(e))switch(r.localName){case"start":case"left":t["border-left"]=Qs.valueOfBorder(r);break;case"end":case"right":t["border-right"]=Qs.valueOfBorder(r);break;case"top":t["border-top"]=Qs.valueOfBorder(r);break;case"bottom":t["border-bottom"]=Qs.valueOfBorder(r)}}}const Ys=["black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","none","red","white","yellow"];class Js{static colorAttr(e,t,r=null,n="black"){var a=Bi.attr(e,t);if(a)return"auto"==a?n:Ys.includes(a)?a:`#${a}`;var i=Bi.attr(e,"themeColor");return i?`var(--docx-${i}-color)`:r}}class Qs{static themeValue(e,t){var r=Bi.attr(e,t);return r?`var(--docx-${r}-font)`:null}static valueOfSize(e,t){var r=Si;switch(Bi.attr(e,"type")){case"dxa":break;case"pct":r=Pi;break;case"auto":return"auto"}return Bi.lengthAttr(e,t,r)}static valueOfMargin(e){return Bi.lengthAttr(e,"w")}static valueOfBorder(e){var t=Qs.parseBorderType(Bi.attr(e,"val"));if("none"==t)return"none";var r=Js.colorAttr(e,"color");return`${Bi.lengthAttr(e,"sz",Ei)} ${t} ${"auto"==r?Vs:r}`}static parseBorderType(e){switch(e){case"single":case"dashDotStroked":case"thick":case"thickThinLargeGap":case"thickThinMediumGap":case"thickThinSmallGap":case"thinThickLargeGap":case"thinThickMediumGap":case"thinThickSmallGap":case"thinThickThinLargeGap":case"thinThickThinMediumGap":case"thinThickThinSmallGap":case"threeDEmboss":case"threeDEngrave":case"wave":return"solid";case"dashed":case"dashSmallGap":return"dashed";case"dotDash":case"dotDotDash":case"dotted":return"dotted";case"double":case"doubleWave":case"triple":return"double";case"inset":return"inset";case"nil":case"none":return"none";case"outset":return"outset"}return"solid"}static valueOfTblLayout(e){return"fixed"==Bi.attr(e,"val")?"fixed":"auto"}static classNameOfCnfStyle(e){const t=Bi.attr(e,"val");return["first-row","last-row","first-col","last-col","odd-col","even-col","odd-row","even-row","ne-cell","nw-cell","se-cell","sw-cell"].filter((e,r)=>"1"==t[r]).join(" ")}static valueOfJc(e){var t=Bi.attr(e,"val");switch(t){case"start":case"left":return"left";case"center":return"center";case"end":case"right":return"right";case"both":return"justify"}return t}static valueOfVertAlign(e,t=!1){var r=Bi.attr(e,"val");switch(r){case"subscript":return"sub";case"superscript":return t?"sup":"super"}return t?null:r}static valueOfTextAlignment(e){var t=Bi.attr(e,"val");switch(t){case"auto":case"baseline":return"baseline";case"top":return"top";case"center":return"middle";case"bottom":return"bottom"}return t}static addSize(e,t){return null==e?t:null==t?e:`calc(${e} + ${t})`}static classNameOftblLook(e){const t=Bi.hexAttr(e,"val",0);let r="";return(Bi.boolAttr(e,"firstRow")||32&t)&&(r+=" first-row"),(Bi.boolAttr(e,"lastRow")||64&t)&&(r+=" last-row"),(Bi.boolAttr(e,"firstColumn")||128&t)&&(r+=" first-col"),(Bi.boolAttr(e,"lastColumn")||256&t)&&(r+=" last-col"),(Bi.boolAttr(e,"noHBand")||512&t)&&(r+=" no-hband"),(Bi.boolAttr(e,"noVBand")||1024&t)&&(r+=" no-vband"),r.trim()}}const eo={pos:0,leader:"none",style:"left"};function to(e,t,r,n=.75){const a=e.closest("p"),i=e.getBoundingClientRect(),s=a.getBoundingClientRect(),o=getComputedStyle(a),l=t?.length>0?t.map(e=>({pos:ro(e.position),leader:e.leader,style:e.style})).sort((e,t)=>e.pos-t.pos):[eo],c=l[l.length-1],h=s.width*n,u=ro(r);let d=c.pos+u;if(d<h)for(;d<h&&l.length<50;d+=u)l.push({...eo,pos:d});const f=parseFloat(o.marginLeft),p=s.left+f,m=(i.left-p)*n,g=l.find(e=>"clear"!=e.style&&e.pos>m);if(null==g)return;let b=1;if("right"==g.style||"center"==g.style){const t=Array.from(a.querySelectorAll(`.${e.className}`)),r=t.indexOf(e)+1,i=document.createRange();i.setStart(e,1),r<t.length?i.setEndBefore(t[r]):i.setEndAfter(a);const o="center"==g.style?.5:1,l=i.getBoundingClientRect(),c=l.left+o*l.width-(s.left-f);b=g.pos-c*n}else b=g.pos-m;switch(e.innerHTML=" ",e.style.textDecoration="inherit",e.style.wordSpacing=`${b.toFixed(0)}pt`,g.leader){case"dot":case"middleDot":e.style.textDecoration="underline",e.style.textDecorationStyle="dotted";break;case"hyphen":case"heavy":case"underscore":e.style.textDecoration="underline"}}function ro(e){return parseFloat(e)}const no="http://www.w3.org/2000/svg",ao="http://www.w3.org/1998/Math/MathML";class io{constructor(e){this.htmlDocument=e,this.className="docx",this.styleMap={},this.currentPart=null,this.tableVerticalMerges=[],this.currentVerticalMerge=null,this.tableCellPositions=[],this.currentCellPosition=null,this.footnoteMap={},this.endnoteMap={},this.currentEndnoteIds=[],this.usedHederFooterParts=[],this.currentTabs=[],this.commentMap={},this.tasks=[],this.postRenderTasks=[]}async render(e,t,r=null,n){this.document=e,this.options=n,this.className=n.className,this.rootSelector=n.inWrapper?`.${this.className}-wrapper`:":root",this.styleMap=null,this.tasks=[],this.options.renderComments&&globalThis.Highlight&&(this.commentHighlight=new Highlight),so(r=r||t),so(t),r.appendChild(this.createComment("docxjs library predefined styles")),r.appendChild(this.renderDefaultStyle()),e.themePart&&(r.appendChild(this.createComment("docxjs document theme values")),this.renderTheme(e.themePart,r)),null!=e.stylesPart&&(this.styleMap=this.processStyles(e.stylesPart.styles),r.appendChild(this.createComment("docxjs document styles")),r.appendChild(this.renderStyles(e.stylesPart.styles))),e.numberingPart&&(this.prodessNumberings(e.numberingPart.domNumberings),r.appendChild(this.createComment("docxjs document numbering styles")),r.appendChild(this.renderNumbering(e.numberingPart.domNumberings,r))),e.footnotesPart&&(this.footnoteMap=yi(e.footnotesPart.notes,e=>e.id)),e.endnotesPart&&(this.endnoteMap=yi(e.endnotesPart.notes,e=>e.id)),e.settingsPart&&(this.defaultTabSize=e.settingsPart.settings?.defaultTabStop),!n.ignoreFonts&&e.fontTablePart&&this.renderFontTable(e.fontTablePart,r);var a=this.renderSections(e.documentPart.body);this.options.inWrapper?t.appendChild(this.renderWrapper(a)):oo(t,a),this.commentHighlight&&n.renderComments&&CSS.highlights.set(`${this.className}-comments`,this.commentHighlight),this.postRenderTasks.forEach(e=>e()),await Promise.allSettled(this.tasks),this.refreshTabStops()}renderTheme(e,t){const r={},n=e.theme?.fontScheme;n&&(n.majorFont&&(r["--docx-majorHAnsi-font"]=n.majorFont.latinTypeface),n.minorFont&&(r["--docx-minorHAnsi-font"]=n.minorFont.latinTypeface));const a=e.theme?.colorScheme;if(a)for(let[e,t]of Object.entries(a.colors))r[`--docx-${e}-color`]=`#${t}`;const i=this.styleToString(`.${this.className}`,r);t.appendChild(this.createStyleElement(i))}renderFontTable(e,t){for(let r of e.fonts)for(let e of r.embedFontRefs)this.tasks.push(this.document.loadFont(e.id,e.key).then(n=>{const a={"font-family":mi(r.name),src:`url(${n})`};"bold"!=e.type&&"boldItalic"!=e.type||(a["font-weight"]="bold"),"italic"!=e.type&&"boldItalic"!=e.type||(a["font-style"]="italic");const i=this.styleToString("@font-face",a);t.appendChild(this.createComment(`docxjs ${r.name} font`)),t.appendChild(this.createStyleElement(i))}))}processStyleName(e){return e?`${this.className}_${function(e){return e?.replace(/[ .]+/g,"-").replace(/[&]+/g,"and").toLowerCase()}(e)}`:this.className}processStyles(e){const t=yi(e.filter(e=>null!=e.id),e=>e.id);for(const n of e.filter(e=>e.basedOn)){var r=t[n.basedOn];if(r){n.paragraphProps=wi(n.paragraphProps,r.paragraphProps),n.runProps=wi(n.runProps,r.runProps);for(const e of r.styles){const t=n.styles.find(t=>t.target==e.target);t?this.copyStyleProperties(e.values,t.values):n.styles.push({...e,values:{...e.values}})}}else this.options.debug&&console.warn(`Can't find base style ${n.basedOn}`)}for(let t of e)t.cssName=this.processStyleName(t.id);return t}prodessNumberings(e){for(let t of e.filter(e=>e.pStyleName)){const e=this.findStyle(t.pStyleName);e?.paragraphProps?.numbering&&(e.paragraphProps.numbering.level=t.level)}}processElement(e){if(e.children)for(var t of e.children)t.parent=e,t.type==Hi.Table?this.processTable(t):this.processElement(t)}processTable(e){for(var t of e.children)for(var r of t.children)r.cssStyle=this.copyStyleProperties(e.cellStyle,r.cssStyle,["border-left","border-right","border-top","border-bottom","padding-left","padding-right","padding-top","padding-bottom"]),this.processElement(r)}copyStyleProperties(e,t,r=null){if(!e)return t;for(var n of(null==t&&(t={}),null==r&&(r=Object.getOwnPropertyNames(e)),r))e.hasOwnProperty(n)&&!t.hasOwnProperty(n)&&(t[n]=e[n]);return t}createPageElement(e,t){var r=this.createElement("section",{className:e});return t&&(t.pageMargins&&(r.style.paddingLeft=t.pageMargins.left,r.style.paddingRight=t.pageMargins.right,r.style.paddingTop=t.pageMargins.top,r.style.paddingBottom=t.pageMargins.bottom),t.pageSize&&(this.options.ignoreWidth||(r.style.width=t.pageSize.width),this.options.ignoreHeight||(r.style.minHeight=t.pageSize.height))),r}createSectionContent(e){var t=this.createElement("article");return e.columns&&e.columns.numberOfColumns&&(t.style.columnCount=`${e.columns.numberOfColumns}`,t.style.columnGap=e.columns.space,e.columns.separator&&(t.style.columnRule="1px solid black")),t}renderSections(e){const t=[];this.processElement(e);const r=this.splitBySection(e.children,e.props),n=this.groupByPageBreaks(r);let a=null;for(let r=0,s=n.length;r<s;r++){this.currentFootnoteIds=[];let o=n[r][0].sectProps;const l=this.createPageElement(this.className,o);this.renderStyleValues(e.cssStyle,l),this.options.renderHeaders&&this.renderHeaderFooter(o.headerRefs,o,t.length,a!=o,l);for(const e of n[r]){var i=this.createSectionContent(e.sectProps);this.renderElements(e.elements,i),l.appendChild(i),o=e.sectProps}this.options.renderFootnotes&&this.renderNotes(this.currentFootnoteIds,this.footnoteMap,l),this.options.renderEndnotes&&r==s-1&&this.renderNotes(this.currentEndnoteIds,this.endnoteMap,l),this.options.renderFooters&&this.renderHeaderFooter(o.footerRefs,o,t.length,a!=o,l),t.push(l),a=o}return t}renderHeaderFooter(e,t,r,n,a){if(e){var i=(t.titlePage&&n?e.find(e=>"first"==e.type):null)??(r%2==1?e.find(e=>"even"==e.type):null)??e.find(e=>"default"==e.type),s=i&&this.document.findPartByRelId(i.id,this.document.documentPart);if(s){this.currentPart=s,this.usedHederFooterParts.includes(s.path)||(this.processElement(s.rootElement),this.usedHederFooterParts.push(s.path));const[e]=this.renderElements([s.rootElement],a);t?.pageMargins&&(s.rootElement.type===Hi.Header?(e.style.marginTop=`calc(${t.pageMargins.header} - ${t.pageMargins.top})`,e.style.minHeight=`calc(${t.pageMargins.top} - ${t.pageMargins.header})`):s.rootElement.type===Hi.Footer&&(e.style.marginBottom=`calc(${t.pageMargins.footer} - ${t.pageMargins.bottom})`,e.style.minHeight=`calc(${t.pageMargins.bottom} - ${t.pageMargins.footer})`)),this.currentPart=null}}}isPageBreakElement(e){return e.type==Hi.Break&&("lastRenderedPageBreak"==e.break?!this.options.ignoreLastRenderedPageBreak:"page"==e.break)}isPageBreakSection(e,t){return!!e&&(!!t&&(e.pageSize?.orientation!=t.pageSize?.orientation||e.pageSize?.width!=t.pageSize?.width||e.pageSize?.height!=t.pageSize?.height))}splitBySection(e,t){var r={sectProps:null,elements:[],pageBreak:!1},n=[r];for(let t of e){if(t.type==Hi.Paragraph){const e=this.findStyle(t.styleName);e?.paragraphProps?.pageBreakBefore&&(r.sectProps=a,r.pageBreak=!0,r={sectProps:null,elements:[],pageBreak:!1},n.push(r))}if(r.elements.push(t),t.type==Hi.Paragraph){const e=t;var a=e.sectionProps,i=-1,s=-1;if(this.options.breakPages&&e.children&&(i=e.children.findIndex(e=>-1!=(s=e.children?.findIndex(this.isPageBreakElement.bind(this))??-1))),(a||-1!=i)&&(r.sectProps=a,r.pageBreak=-1!=i,r={sectProps:null,elements:[],pageBreak:!1},n.push(r)),-1!=i){let n=e.children[i],a=s<n.children.length-1;if(i<e.children.length-1||a){var o=t.children,l={...t,children:o.slice(i)};if(t.children=o.slice(0,i),r.elements.push(l),a){let e=n.children,r={...n,children:e.slice(0,s)};t.children.push(r),n.children=e.slice(s)}}}}}let c=null;for(let e=n.length-1;e>=0;e--)null==n[e].sectProps?n[e].sectProps=c??t:c=n[e].sectProps;return n}groupByPageBreaks(e){let t,r=[];const n=[r];for(let a of e)r.push(a),(this.options.ignoreLastRenderedPageBreak||a.pageBreak||this.isPageBreakSection(t,a.sectProps))&&n.push(r=[]),t=a.sectProps;return n.filter(e=>e.length>0)}renderWrapper(e){return this.createElement("div",{className:`${this.className}-wrapper`},e)}renderDefaultStyle(){var e=this.className,t=`\n.${e}-wrapper { background: gray; padding: 30px; padding-bottom: 0px; display: flex; flex-flow: column; align-items: center; } \n.${e}-wrapper>section.${e} { background: white; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); margin-bottom: 30px; }`;this.options.hideWrapperOnPrint&&(t=`@media not print { ${t} }`);var r=`${t}\n.${e} { color: black; hyphens: auto; text-underline-position: from-font; }\nsection.${e} { box-sizing: border-box; display: flex; flex-flow: column nowrap; position: relative; overflow: hidden; }\nsection.${e}>article { margin-bottom: auto; z-index: 1; }\nsection.${e}>footer { z-index: 1; }\n.${e} table { border-collapse: collapse; }\n.${e} table td, .${e} table th { vertical-align: top; }\n.${e} p { margin: 0pt; min-height: 1em; }\n.${e} span { white-space: pre-wrap; overflow-wrap: break-word; }\n.${e} a { color: inherit; text-decoration: inherit; }\n.${e} svg { fill: transparent; }\n`;return this.options.renderComments&&(r+=`\n.${e}-comment-ref { cursor: default; }\n.${e}-comment-popover { display: none; z-index: 1000; padding: 0.5rem; background: white; position: absolute; box-shadow: 0 0 0.25rem rgba(0, 0, 0, 0.25); width: 30ch; }\n.${e}-comment-ref:hover~.${e}-comment-popover { display: block; }\n.${e}-comment-author,.${e}-comment-date { font-size: 0.875rem; color: #888; }\n`),this.createStyleElement(r)}renderNumbering(e,t){var r="",n=[];for(var a of e){var i=`p.${this.numberingClass(a.id,a.level)}`,s="none";if(a.bullet){let e=`--${this.className}-${a.bullet.src}`.toLowerCase();r+=this.styleToString(`${i}:before`,{content:"' '",display:"inline-block",background:`var(${e})`},a.bullet.style),this.tasks.push(this.document.loadNumberingImage(a.bullet.src).then(r=>{var n=`${this.rootSelector} { ${e}: url(${r}) }`;t.appendChild(this.createStyleElement(n))}))}else if(a.levelText){let e=this.numberingCounter(a.id,a.level);const t=e+" "+(a.start-1);a.level>0&&(r+=this.styleToString(`p.${this.numberingClass(a.id,a.level-1)}`,{"counter-set":t})),n.push(t),r+=this.styleToString(`${i}:before`,{content:this.levelTextToContent(a.levelText,a.suff,a.id,this.numFormatToCssValue(a.format)),"counter-increment":e,...a.rStyle})}else s=this.numFormatToCssValue(a.format);r+=this.styleToString(i,{display:"list-item","list-style-position":"inside","list-style-type":s,...a.pStyle})}return n.length>0&&(r+=this.styleToString(this.rootSelector,{"counter-reset":n.join(" ")})),this.createStyleElement(r)}renderStyles(e){var t="";const r=this.styleMap,n=yi(e.filter(e=>e.isDefault),e=>e.target);for(const o of e){var a=o.styles;if(o.linked){var i=o.linked&&r[o.linked];i?a=a.concat(i.styles):this.options.debug&&console.warn(`Can't find linked style ${o.linked}`)}for(const e of a){var s=`${o.target??""}.${o.cssName}`;o.target!=e.target&&(s+=` ${e.target}`),n[o.target]==o&&(s=`.${this.className} ${o.target}, `+s),t+=this.styleToString(s,e.values)}}return this.createStyleElement(t)}renderNotes(e,t,r){var n=e.map(e=>t[e]).filter(e=>e);if(n.length>0){var a=this.createElement("ol",null,this.renderElements(n));r.appendChild(a)}}renderElement(e){switch(e.type){case Hi.Paragraph:return this.renderParagraph(e);case Hi.BookmarkStart:return this.renderBookmarkStart(e);case Hi.BookmarkEnd:return null;case Hi.Run:return this.renderRun(e);case Hi.Table:return this.renderTable(e);case Hi.Row:return this.renderTableRow(e);case Hi.Cell:return this.renderTableCell(e);case Hi.Hyperlink:return this.renderHyperlink(e);case Hi.SmartTag:return this.renderSmartTag(e);case Hi.Drawing:return this.renderDrawing(e);case Hi.Image:return this.renderImage(e);case Hi.Text:case Hi.Text:return this.renderText(e);case Hi.DeletedText:return this.renderDeletedText(e);case Hi.Tab:return this.renderTab(e);case Hi.Symbol:return this.renderSymbol(e);case Hi.Break:return this.renderBreak(e);case Hi.Footer:return this.renderContainer(e,"footer");case Hi.Header:return this.renderContainer(e,"header");case Hi.Footnote:case Hi.Endnote:return this.renderContainer(e,"li");case Hi.FootnoteReference:return this.renderFootnoteReference(e);case Hi.EndnoteReference:return this.renderEndnoteReference(e);case Hi.NoBreakHyphen:return this.createElement("wbr");case Hi.VmlPicture:return this.renderVmlPicture(e);case Hi.VmlElement:return this.renderVmlElement(e);case Hi.MmlMath:return this.renderContainerNS(e,ao,"math",{xmlns:ao});case Hi.MmlMathParagraph:return this.renderContainer(e,"span");case Hi.MmlFraction:return this.renderContainerNS(e,ao,"mfrac");case Hi.MmlBase:return this.renderContainerNS(e,ao,e.parent.type==Hi.MmlMatrixRow?"mtd":"mrow");case Hi.MmlNumerator:case Hi.MmlDenominator:case Hi.MmlFunction:case Hi.MmlLimit:case Hi.MmlBox:return this.renderContainerNS(e,ao,"mrow");case Hi.MmlGroupChar:return this.renderMmlGroupChar(e);case Hi.MmlLimitLower:return this.renderContainerNS(e,ao,"munder");case Hi.MmlMatrix:return this.renderContainerNS(e,ao,"mtable");case Hi.MmlMatrixRow:return this.renderContainerNS(e,ao,"mtr");case Hi.MmlRadical:return this.renderMmlRadical(e);case Hi.MmlSuperscript:return this.renderContainerNS(e,ao,"msup");case Hi.MmlSubscript:return this.renderContainerNS(e,ao,"msub");case Hi.MmlDegree:case Hi.MmlSuperArgument:case Hi.MmlSubArgument:return this.renderContainerNS(e,ao,"mn");case Hi.MmlFunctionName:return this.renderContainerNS(e,ao,"ms");case Hi.MmlDelimiter:return this.renderMmlDelimiter(e);case Hi.MmlRun:return this.renderMmlRun(e);case Hi.MmlNary:return this.renderMmlNary(e);case Hi.MmlPreSubSuper:return this.renderMmlPreSubSuper(e);case Hi.MmlBar:return this.renderMmlBar(e);case Hi.MmlEquationArray:return this.renderMllList(e);case Hi.Inserted:return this.renderInserted(e);case Hi.Deleted:return this.renderDeleted(e);case Hi.CommentRangeStart:return this.renderCommentRangeStart(e);case Hi.CommentRangeEnd:return this.renderCommentRangeEnd(e);case Hi.CommentReference:return this.renderCommentReference(e);case Hi.AltChunk:return this.renderAltChunk(e)}return null}renderElements(e,t){if(null==e)return null;var r=e.flatMap(e=>this.renderElement(e)).filter(e=>null!=e);return t&&oo(t,r),r}renderContainer(e,t,r){return this.createElement(t,r,this.renderElements(e.children))}renderContainerNS(e,t,r,n){return this.createElementNS(t,r,n,this.renderElements(e.children))}renderParagraph(e){var t=this.renderContainer(e,"p");const r=this.findStyle(e.styleName);e.tabs??(e.tabs=r?.paragraphProps?.tabs),this.renderClass(e,t),this.renderStyleValues(e.cssStyle,t),this.renderCommonProperties(t.style,e);const n=e.numbering??r?.paragraphProps?.numbering;return n&&t.classList.add(this.numberingClass(n.id,n.level)),t}renderRunProperties(e,t){this.renderCommonProperties(e,t)}renderCommonProperties(e,t){null!=t&&(t.color&&(e.color=t.color),t.fontSize&&(e["font-size"]=t.fontSize))}renderHyperlink(e){var t=this.renderContainer(e,"a");this.renderStyleValues(e.cssStyle,t);let r="";if(e.id){const t=this.document.documentPart.rels.find(t=>t.id==e.id&&"External"===t.targetMode);r=t?.target??r}return e.anchor&&(r+=`#${e.anchor}`),t.href=r,t}renderSmartTag(e){return this.renderContainer(e,"span")}renderCommentRangeStart(e){if(!this.options.renderComments)return null;const t=new Range;this.commentHighlight?.add(t);const r=this.createComment(`start of comment #${e.id}`);return this.later(()=>t.setStart(r,0)),this.commentMap[e.id]=t,r}renderCommentRangeEnd(e){if(!this.options.renderComments)return null;const t=this.commentMap[e.id],r=this.createComment(`end of comment #${e.id}`);return this.later(()=>t?.setEnd(r,0)),r}renderCommentReference(e){if(!this.options.renderComments)return null;var t=this.document.commentsPart?.commentMap[e.id];if(!t)return null;const r=new DocumentFragment,n=this.createElement("span",{className:`${this.className}-comment-ref`},["💬"]),a=this.createElement("div",{className:`${this.className}-comment-popover`});return this.renderCommentContent(t,a),r.appendChild(this.createComment(`comment #${t.id} by ${t.author} on ${t.date}`)),r.appendChild(n),r.appendChild(a),r}renderAltChunk(e){if(!this.options.renderAltChunks)return null;var t=this.createElement("iframe");return this.tasks.push(this.document.loadAltChunk(e.id,this.currentPart).then(e=>{t.srcdoc=e})),t}renderCommentContent(e,t){t.appendChild(this.createElement("div",{className:`${this.className}-comment-author`},[e.author])),t.appendChild(this.createElement("div",{className:`${this.className}-comment-date`},[new Date(e.date).toLocaleString()])),this.renderElements(e.children,t)}renderDrawing(e){var t=this.renderContainer(e,"div");return t.style.display="inline-block",t.style.position="relative",t.style.textIndent="0px",this.renderStyleValues(e.cssStyle,t),t}renderImage(e){let t=this.createElement("img"),r=e.cssStyle?.transform;if(this.renderStyleValues(e.cssStyle,t),e.srcRect&&e.srcRect.some(e=>0!=e)){var[n,a,i,s]=e.srcRect;r=`scale(${1/(1-n-i)}, ${1/(1-a-s)})`,t.style["clip-path"]=`rect(${(100*a).toFixed(2)}% ${(100*(1-i)).toFixed(2)}% ${(100*(1-s)).toFixed(2)}% ${(100*n).toFixed(2)}%)`}return e.rotation&&(r=`rotate(${e.rotation}deg) ${r??""}`),t.style.transform=r?.trim(),this.document&&this.tasks.push(this.document.loadDocumentImage(e.src,this.currentPart).then(e=>{t.src=e})),t}renderText(e){return this.htmlDocument.createTextNode(e.text)}renderDeletedText(e){return this.options.renderChanges?this.renderText(e):null}renderBreak(e){return"textWrapping"==e.break?this.createElement("br"):null}renderInserted(e){return this.options.renderChanges?this.renderContainer(e,"ins"):this.renderElements(e.children)}renderDeleted(e){return this.options.renderChanges?this.renderContainer(e,"del"):null}renderSymbol(e){var t=this.createElement("span");return t.style.fontFamily=e.font,t.innerHTML=`&#x${e.char};`,t}renderFootnoteReference(e){var t=this.createElement("sup");return this.currentFootnoteIds.push(e.id),t.textContent=`${this.currentFootnoteIds.length}`,t}renderEndnoteReference(e){var t=this.createElement("sup");return this.currentEndnoteIds.push(e.id),t.textContent=`${this.currentEndnoteIds.length}`,t}renderTab(e){var t=this.createElement("span");if(t.innerHTML=" ",this.options.experimental){t.className=this.tabStopClass();var r=function(e,t){var r=e.parent;for(;null!=r&&r.type!=t;)r=r.parent;return r}(e,Hi.Paragraph)?.tabs;this.currentTabs.push({stops:r,span:t})}return t}renderBookmarkStart(e){return this.createElement("span",{id:e.name})}renderRun(e){if(e.fieldRun)return null;const t=this.createElement("span");if(e.id&&(t.id=e.id),this.renderClass(e,t),this.renderStyleValues(e.cssStyle,t),e.verticalAlign){const r=this.createElement(e.verticalAlign);this.renderElements(e.children,r),t.appendChild(r)}else this.renderElements(e.children,t);return t}renderTable(e){let t=this.createElement("table");return this.tableCellPositions.push(this.currentCellPosition),this.tableVerticalMerges.push(this.currentVerticalMerge),this.currentVerticalMerge={},this.currentCellPosition={col:0,row:0},e.columns&&t.appendChild(this.renderTableColumns(e.columns)),this.renderClass(e,t),this.renderElements(e.children,t),this.renderStyleValues(e.cssStyle,t),this.currentVerticalMerge=this.tableVerticalMerges.pop(),this.currentCellPosition=this.tableCellPositions.pop(),t}renderTableColumns(e){let t=this.createElement("colgroup");for(let r of e){let e=this.createElement("col");r.width&&(e.style.width=r.width),t.appendChild(e)}return t}renderTableRow(e){let t=this.createElement("tr");return this.currentCellPosition.col=0,e.gridBefore&&t.appendChild(this.renderTableCellPlaceholder(e.gridBefore)),this.renderClass(e,t),this.renderElements(e.children,t),this.renderStyleValues(e.cssStyle,t),e.gridAfter&&t.appendChild(this.renderTableCellPlaceholder(e.gridAfter)),this.currentCellPosition.row++,t}renderTableCellPlaceholder(e){const t=this.createElement("td",{colSpan:e});return t.style.border="none",t}renderTableCell(e){let t=this.renderContainer(e,"td");const r=this.currentCellPosition.col;return e.verticalMerge?"restart"==e.verticalMerge?(this.currentVerticalMerge[r]=t,t.rowSpan=1):this.currentVerticalMerge[r]&&(this.currentVerticalMerge[r].rowSpan+=1,t.style.display="none"):this.currentVerticalMerge[r]=null,this.renderClass(e,t),this.renderStyleValues(e.cssStyle,t),e.span&&(t.colSpan=e.span),this.currentCellPosition.col+=t.colSpan,t}renderVmlPicture(e){return this.renderContainer(e,"div")}renderVmlElement(e){var t=this.createSvgElement("svg");t.setAttribute("style",e.cssStyleText);const r=this.renderVmlChildElement(e);return e.imageHref?.id&&this.tasks.push(this.document?.loadDocumentImage(e.imageHref.id,this.currentPart).then(e=>r.setAttribute("href",e))),t.appendChild(r),requestAnimationFrame(()=>{const e=t.firstElementChild.getBBox();t.setAttribute("width",`${Math.ceil(e.x+e.width)}`),t.setAttribute("height",`${Math.ceil(e.y+e.height)}`)}),t}renderVmlChildElement(e){const t=this.createSvgElement(e.tagName);Object.entries(e.attrs).forEach(([e,r])=>t.setAttribute(e,r));for(let r of e.children)r.type==Hi.VmlElement?t.appendChild(this.renderVmlChildElement(r)):t.appendChild(..._i(this.renderElement(r)));return t}renderMmlRadical(e){const t=e.children.find(e=>e.type==Hi.MmlBase);if(e.props?.hideDegree)return this.createElementNS(ao,"msqrt",null,this.renderElements([t]));const r=e.children.find(e=>e.type==Hi.MmlDegree);return this.createElementNS(ao,"mroot",null,this.renderElements([t,r]))}renderMmlDelimiter(e){const t=[];return t.push(this.createElementNS(ao,"mo",null,[e.props.beginChar??"("])),t.push(...this.renderElements(e.children)),t.push(this.createElementNS(ao,"mo",null,[e.props.endChar??")"])),this.createElementNS(ao,"mrow",null,t)}renderMmlNary(e){const t=[],r=yi(e.children,e=>e.type),n=r[Hi.MmlSuperArgument],a=r[Hi.MmlSubArgument],i=n?this.createElementNS(ao,"mo",null,_i(this.renderElement(n))):null,s=a?this.createElementNS(ao,"mo",null,_i(this.renderElement(a))):null,o=this.createElementNS(ao,"mo",null,[e.props?.char??"∫"]);return i||s?t.push(this.createElementNS(ao,"munderover",null,[o,s,i])):i?t.push(this.createElementNS(ao,"mover",null,[o,i])):s?t.push(this.createElementNS(ao,"munder",null,[o,s])):t.push(o),t.push(...this.renderElements(r[Hi.MmlBase].children)),this.createElementNS(ao,"mrow",null,t)}renderMmlPreSubSuper(e){const t=[],r=yi(e.children,e=>e.type),n=r[Hi.MmlSuperArgument],a=r[Hi.MmlSubArgument],i=n?this.createElementNS(ao,"mo",null,_i(this.renderElement(n))):null,s=a?this.createElementNS(ao,"mo",null,_i(this.renderElement(a))):null,o=this.createElementNS(ao,"mo",null);return t.push(this.createElementNS(ao,"msubsup",null,[o,s,i])),t.push(...this.renderElements(r[Hi.MmlBase].children)),this.createElementNS(ao,"mrow",null,t)}renderMmlGroupChar(e){const t="bot"===e.props.verticalJustification?"mover":"munder",r=this.renderContainerNS(e,ao,t);return e.props.char&&r.appendChild(this.createElementNS(ao,"mo",null,[e.props.char])),r}renderMmlBar(e){const t=this.renderContainerNS(e,ao,"mrow");switch(e.props.position){case"top":t.style.textDecoration="overline";break;case"bottom":t.style.textDecoration="underline"}return t}renderMmlRun(e){const t=this.createElementNS(ao,"ms",null,this.renderElements(e.children));return this.renderClass(e,t),this.renderStyleValues(e.cssStyle,t),t}renderMllList(e){const t=this.createElementNS(ao,"mtable");this.renderClass(e,t),this.renderStyleValues(e.cssStyle,t);for(let r of this.renderElements(e.children))t.appendChild(this.createElementNS(ao,"mtr",null,[this.createElementNS(ao,"mtd",null,[r])]));return t}renderStyleValues(e,t){for(let r in e)r.startsWith("$")?t.setAttribute(r.slice(1),e[r]):t.style[r]=e[r]}renderClass(e,t){e.className&&(t.className=e.className),e.styleName&&t.classList.add(this.processStyleName(e.styleName))}findStyle(e){return e&&this.styleMap?.[e]}numberingClass(e,t){return`${this.className}-num-${e}-${t}`}tabStopClass(){return`${this.className}-tab-stop`}styleToString(e,t,r=null){let n=`${e} {\r\n`;for(const e in t)e.startsWith("$")||(n+=` ${e}: ${t[e]};\r\n`);return r&&(n+=r),n+"}\r\n"}numberingCounter(e,t){return`${this.className}-num-${e}-${t}`}levelTextToContent(e,t,r,n){return`"${e.replace(/%\d*/g,e=>{let t=parseInt(e.substring(1),10)-1;return`"counter(${this.numberingCounter(r,t)}, ${n})"`})}${{tab:"\\9",space:"\\a0"}[t]??""}"`}numFormatToCssValue(e){return{none:"none",bullet:"disc",decimal:"decimal",lowerLetter:"lower-alpha",upperLetter:"upper-alpha",lowerRoman:"lower-roman",upperRoman:"upper-roman",decimalZero:"decimal-leading-zero",aiueo:"katakana",aiueoFullWidth:"katakana",chineseCounting:"simp-chinese-informal",chineseCountingThousand:"simp-chinese-informal",chineseLegalSimplified:"simp-chinese-formal",chosung:"hangul-consonant",ideographDigital:"cjk-ideographic",ideographTraditional:"cjk-heavenly-stem",ideographLegalTraditional:"trad-chinese-formal",ideographZodiac:"cjk-earthly-branch",iroha:"katakana-iroha",irohaFullWidth:"katakana-iroha",japaneseCounting:"japanese-informal",japaneseDigitalTenThousand:"cjk-decimal",japaneseLegal:"japanese-formal",thaiNumbers:"thai",koreanCounting:"korean-hangul-formal",koreanDigital:"korean-hangul-formal",koreanDigital2:"korean-hanja-informal",hebrew1:"hebrew",hebrew2:"hebrew",hindiNumbers:"devanagari",ganada:"hangul",taiwaneseCounting:"cjk-ideographic",taiwaneseCountingThousand:"cjk-ideographic",taiwaneseDigital:"cjk-decimal"}[e]??e}refreshTabStops(){this.options.experimental&&setTimeout(()=>{const e=function(e=document.body){const t=document.createElement("div");t.style.width="100pt",e.appendChild(t);const r=100/t.offsetWidth;return e.removeChild(t),r}();for(let t of this.currentTabs)to(t.span,t.stops,this.defaultTabSize,e)},500)}createElementNS(e,t,r,n){var a=e?this.htmlDocument.createElementNS(e,t):this.htmlDocument.createElement(t);return Object.assign(a,r),n&&oo(a,n),a}createElement(e,t,r){return this.createElementNS(void 0,e,t,r)}createSvgElement(e,t,r){return this.createElementNS(no,e,t,r)}createStyleElement(e){return this.createElement("style",{innerHTML:e})}createComment(e){return this.htmlDocument.createComment(e)}later(e){this.postRenderTasks.push(e)}}function so(e){e.innerHTML=""}function oo(e,t){t.forEach(t=>{return e.appendChild("string"==typeof(r=t)||r instanceof String?document.createTextNode(t):t);var r})}const lo={ignoreHeight:!1,ignoreWidth:!1,ignoreFonts:!1,breakPages:!0,debug:!1,experimental:!1,className:"docx",inWrapper:!0,hideWrapperOnPrint:!1,trimXmlDeclaration:!0,ignoreLastRenderedPageBreak:!0,renderHeaders:!0,renderFooters:!0,renderFootnotes:!0,renderEndnotes:!0,useBase64URL:!1,renderChanges:!1,renderComments:!1,renderAltChunks:!0};async function co(e,t,r,n){const a=await function(e,t){const r={...lo,...t};return Rs.load(e,new Ks(r),r)}(e,n);return await async function(e,t,r,n){const a={...lo,...n},i=new io(window.document);return await i.render(e,t,r,a)}(a,t,r,n),a}const ho={ignoreLastRenderedPageBreak:!1};var uo={getData:function(e,t={}){return"string"==typeof e?function(e,t){return fetch(e,t).then(e=>200!==e.status?Promise.reject(e):e)}(e,t):Promise.resolve(e)},render:function(e,t,r={}){if(!e)return t.innerHTML="",Promise.resolve();let n;return e instanceof Blob?n=e:e instanceof Response?n=e.blob():e instanceof ArrayBuffer&&(n=new Blob([e])),co(n,t,t,{...ho,...r})},getBlob:async function(e){let t;return e instanceof Blob?t=e:e instanceof Response?t=await e.blob():e instanceof ArrayBuffer&&(t=new Blob([e])),t}};async function fo(e,t){t&&(t instanceof ArrayBuffer&&(t=new Blob([t])),function(e,t){let r=document.createElement("a");r.download=e,r.style.display="none",r.href=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}(e,URL.createObjectURL(t)))}class po{container=null;wrapper=null;wrapperMain=null;options={};requestOptions={};fileData=null;constructor(e,t={},r={}){this.container=e,this.options=t,this.requestOptions=r,this.createWrapper()}createWrapper(){this.wrapper=document.createElement("div"),this.wrapper.className="vue-office-docx",this.wrapperMain=document.createElement("div"),this.wrapperMain.className="vue-office-docx-main",this.wrapper.appendChild(this.wrapperMain),this.container.appendChild(this.wrapper)}setOptions(e){this.options=e}setRequestOptions(e){this.requestOptions=e}preview(e){return new Promise((t,r)=>{uo.getData(e,this.requestOptions).then(async e=>{this.fileData=await uo.getBlob(e),uo.render(this.fileData,this.wrapperMain,this.options).then(()=>{t()}).catch(e=>{uo.render("",this.wrapperMain,this.options),r(e)})}).catch(e=>{uo.render("",this.wrapperMain,this.options),r(e)})})}save(e){fo(e||`js-preview-docx-${(new Date).getTime()}.docx`,this.fileData)}destroy(){this.container.removeChild(this.wrapper),this.container=null,this.wrapper=null,this.wrapperMain=null,this.options=null,this.requestOptions=null}}return{init:function(e,t,r){return new po(e,t,r)}}});
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lucky-office/js-docx",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "基于 vue-office 二次开发的框架无关 Word(.docx)预览库(vanilla JS / UMD)。",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"lib/"
|
|
10
|
+
],
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"shx": "^0.3.4"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git@github.com:ZERO-WL/lucky-office.git"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/ZERO-WL/lucky-office#readme",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/ZERO-WL/lucky-office/issues"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"docx",
|
|
24
|
+
"word",
|
|
25
|
+
"docx-preview",
|
|
26
|
+
"lucky-office",
|
|
27
|
+
"vue-office"
|
|
28
|
+
],
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"author": "zhangwenli",
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public",
|
|
33
|
+
"registry": "https://registry.npmjs.org/"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"core-js": "^3.0.0"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"clean": "shx rm -rf lib",
|
|
41
|
+
"copyReadme": "shx cp README.md lib/README.md",
|
|
42
|
+
"copyType": "shx cp index.d.ts lib/index.d.ts",
|
|
43
|
+
"copyCss": "shx cp ./index.css ./lib/index.css",
|
|
44
|
+
"copy": "npm run copyCss && npm run copyType && npm run copyReadme",
|
|
45
|
+
"build": "npm run clean && rollup --config rollup.config.js && npm run copy"
|
|
46
|
+
}
|
|
47
|
+
}
|