text: !function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).QrCodeWithLogo=r()}(this,(function(){"use strict";
  /*! *****************************************************************************
      Copyright (c) Microsoft Corporation.
  
      Permission to use, copy, modify, and/or distribute this software for any
      purpose with or without fee is hereby granted.
  
      THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
      REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
      AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
      INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
      LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
      OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
      PERFORMANCE OF THIS SOFTWARE.
      ***************************************************************************** */function t(t,r,e,n){return new(e||(e=Promise))((function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function u(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var r;t.done?o(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(a,u)}s((n=n.apply(t,r||[])).next())}))}function r(t,r){var e,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;a;)try{if(e=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(t,a)}catch(t){i=[6,t],n=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function e(t){return"string"==typeof t}var n="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},o=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,u=!1;function s(){u=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)o[r]=t[r],i[t.charCodeAt(r)]=r;i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63}function f(t,r,e){for(var n,i,a=[],u=r;u<e;u+=3)n=(t[u]<<16)+(t[u+1]<<8)+t[u+2],a.push(o[(i=n)>>18&63]+o[i>>12&63]+o[i>>6&63]+o[63&i]);return a.join("")}function h(t){var r;u||s();for(var e=t.length,n=e%3,i="",a=[],h=16383,c=0,l=e-n;c<l;c+=h)a.push(f(t,c,c+h>l?l:c+h));return 1===n?(r=t[e-1],i+=o[r>>2],i+=o[r<<4&63],i+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],i+=o[r>>10],i+=o[r>>4&63],i+=o[r<<2&63],i+="="),a.push(i),a.join("")}function c(t,r,e,n,o){var i,a,u=8*o-n-1,s=(1<<u)-1,f=s>>1,h=-7,c=e?o-1:0,l=e?-1:1,g=t[r+c];for(c+=l,i=g&(1<<-h)-1,g>>=-h,h+=u;h>0;i=256*i+t[r+c],c+=l,h-=8);for(a=i&(1<<-h)-1,i>>=-h,h+=n;h>0;a=256*a+t[r+c],c+=l,h-=8);if(0===i)i=1-f;else{if(i===s)return a?NaN:1/0*(g?-1:1);a+=Math.pow(2,n),i-=f}return(g?-1:1)*a*Math.pow(2,i-n)}function l(t,r,e,n,o,i){var a,u,s,f=8*i-o-1,h=(1<<f)-1,c=h>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:i-1,d=n?1:-1,p=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,a=h):(a=Math.floor(Math.log(r)/Math.LN2),r*(s=Math.pow(2,-a))<1&&(a--,s*=2),(r+=a+c>=1?l/s:l*Math.pow(2,1-c))*s>=2&&(a++,s/=2),a+c>=h?(u=0,a=h):a+c>=1?(u=(r*s-1)*Math.pow(2,o),a+=c):(u=r*Math.pow(2,c-1)*Math.pow(2,o),a=0));o>=8;t[e+g]=255&u,g+=d,u/=256,o-=8);for(a=a<<o|u,f+=o;f>0;t[e+g]=255&a,g+=d,a/=256,f-=8);t[e+g-d]|=128*p}var g={}.toString,d=Array.isArray||function(t){return"[object Array]"==g.call(t)};function p(){return w.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function v(t,r){if(p()<r)throw new RangeError("Invalid typed array length");return w.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=w.prototype:(null===t&&(t=new w(r)),t.length=r),t}function w(t,r,e){if(!(w.TYPED_ARRAY_SUPPORT||this instanceof w))return new w(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return E(this,t)}return y(this,t,r,e)}function y(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);w.TYPED_ARRAY_SUPPORT?(t=r).__proto__=w.prototype:t=A(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!w.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|T(r,e),o=(t=v(t,n)).write(r,e);o!==n&&(t=t.slice(0,o));return t}(t,r,e):function(t,r){if(R(r)){var e=0|b(r.length);return 0===(t=v(t,e)).length||r.copy(t,0,0,e),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?v(t,0):A(t,r);if("Buffer"===r.type&&d(r.data))return A(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function m(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function E(t,r){if(m(r),t=v(t,r<0?0:0|b(r)),!w.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function A(t,r){var e=r.length<0?0:0|b(r.length);t=v(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function b(t){if(t>=p())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+p().toString(16)+" bytes");return 0|t}function R(t){return!(null==t||!t._isBuffer)}function T(t,r){if(R(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return X(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return $(t).length;default:if(n)return X(t).length;r=(""+r).toLowerCase(),n=!0}}function P(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return F(this,r,e);case"utf8":case"utf-8":return Y(this,r,e);case"ascii":return O(this,r,e);case"latin1":case"binary":return k(this,r,e);case"base64":return x(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function B(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function I(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=w.from(r,n)),R(r))return 0===r.length?-1:C(t,r,e,n,o);if("number"==typeof r)return r&=255,w.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):C(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function C(t,r,e,n,o){var i,a=1,u=t.length,s=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;a=2,u/=2,s/=2,e/=2}function f(t,r){return 1===a?t[r]:t.readUInt16BE(r*a)}if(o){var h=-1;for(i=e;i<u;i++)if(f(t,i)===f(r,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===s)return h*a}else-1!==h&&(i-=i-h),h=-1}else for(e+s>u&&(e=u-s),i=e;i>=0;i--){for(var c=!0,l=0;l<s;l++)if(f(t,i+l)!==f(r,l)){c=!1;break}if(c)return i}return-1}function _(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n))>o&&(n=o):n=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a<n;++a){var u=parseInt(r.substr(2*a,2),16);if(isNaN(u))return a;t[e+a]=u}return a}function M(t,r,e,n){return Z(X(r,t.length-e),t,e,n)}function U(t,r,e,n){return Z(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function N(t,r,e,n){return U(t,r,e,n)}function L(t,r,e,n){return Z($(r),t,e,n)}function S(t,r,e,n){return Z(function(t,r){for(var e,n,o,i=[],a=0;a<t.length&&!((r-=2)<0);++a)n=(e=t.charCodeAt(a))>>8,o=e%256,i.push(o),i.push(n);return i}(r,t.length-e),t,e,n)}function x(t,r,e){return 0===r&&e===t.length?h(t):h(t.slice(r,e))}function Y(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var i,a,u,s,f=t[o],h=null,c=f>239?4:f>223?3:f>191?2:1;if(o+c<=e)switch(c){case 1:f<128&&(h=f);break;case 2:128==(192&(i=t[o+1]))&&(s=(31&f)<<6|63&i)>127&&(h=s);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(s=(15&f)<<12|(63&i)<<6|63&a)>2047&&(s<55296||s>57343)&&(h=s);break;case 4:i=t[o+1],a=t[o+2],u=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&u)&&(s=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&u)>65535&&s<1114112&&(h=s)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),o+=c}return function(t){var r=t.length;if(r<=D)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=D));return e}(n)}w.TYPED_ARRAY_SUPPORT=void 0===n.TYPED_ARRAY_SUPPORT||n.TYPED_ARRAY_SUPPORT,w.poolSize=8192,w._augment=function(t){return t.__proto__=w.prototype,t},w.from=function(t,r,e){return y(null,t,r,e)},w.TYPED_ARRAY_SUPPORT&&(w.prototype.__proto__=Uint8Array.prototype,w.__proto__=Uint8Array),w.alloc=function(t,r,e){return function(t,r,e,n){return m(r),r<=0?v(t,r):void 0!==e?"string"==typeof n?v(t,r).fill(e,n):v(t,r).fill(e):v(t,r)}(null,t,r,e)},w.allocUnsafe=function(t){return E(null,t)},w.allocUnsafeSlow=function(t){return E(null,t)},w.isBuffer=function(t){return null!=t&&(!!t._isBuffer||tt(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&tt(t.slice(0,0))}(t))},w.compare=function(t,r){if(!R(t)||!R(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,o=0,i=Math.min(e,n);o<i;++o)if(t[o]!==r[o]){e=t[o],n=r[o];break}return e<n?-1:n<e?1:0},w.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},w.concat=function(t,r){if(!d(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return w.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=w.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){var i=t[e];if(!R(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},w.byteLength=T,w.prototype._isBuffer=!0,w.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)B(this,r,r+1);return this},w.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)B(this,r,r+3),B(this,r+1,r+2);return this},w.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)B(this,r,r+7),B(this,r+1,r+6),B(this,r+2,r+5),B(this,r+3,r+4);return this},w.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?Y(this,0,t):P.apply(this,arguments)},w.prototype.equals=function(t){if(!R(t))throw new TypeError("Argument must be a Buffer");return this===t||0===w.compare(this,t)},w.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},w.prototype.compare=function(t,r,e,n,o){if(!R(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=e)return 0;if(n>=o)return-1;if(r>=e)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),a=(e>>>=0)-(r>>>=0),u=Math.min(i,a),s=this.slice(n,o),f=t.slice(r,e),h=0;h<u;++h)if(s[h]!==f[h]){i=s[h],a=f[h];break}return i<a?-1:a<i?1:0},w.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},w.prototype.indexOf=function(t,r,e){return I(this,t,r,e,!0)},w.prototype.lastIndexOf=function(t,r,e){return I(this,t,r,e,!1)},w.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var o=this.length-r;if((void 0===e||e>o)&&(e=o),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return _(this,t,r,e);case"utf8":case"utf-8":return M(this,t,r,e);case"ascii":return U(this,t,r,e);case"latin1":case"binary":return N(this,t,r,e);case"base64":return L(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,r,e);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},w.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var D=4096;function O(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(127&t[o]);return n}function k(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function F(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",i=r;i<e;++i)o+=G(t[i]);return o}function z(t,r,e){for(var n=t.slice(r,e),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function W(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function j(t,r,e,n,o,i){if(!R(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<i)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function q(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o<i;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function H(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o<i;++o)t[e+o]=r>>>8*(n?o:3-o)&255}function J(t,r,e,n,o,i){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function K(t,r,e,n,o){return o||J(t,0,e,4),l(t,r,e,n,23,4),e+4}function V(t,r,e,n,o){return o||J(t,0,e,8),l(t,r,e,n,52,8),e+8}w.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),w.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=w.prototype;else{var o=r-t;e=new w(o,void 0);for(var i=0;i<o;++i)e[i]=this[i+t]}return e},w.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||W(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n},w.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||W(t,r,this.length);for(var n=this[t+--r],o=1;r>0&&(o*=256);)n+=this[t+--r]*o;return n},w.prototype.readUInt8=function(t,r){return r||W(t,1,this.length),this[t]},w.prototype.readUInt16LE=function(t,r){return r||W(t,2,this.length),this[t]|this[t+1]<<8},w.prototype.readUInt16BE=function(t,r){return r||W(t,2,this.length),this[t]<<8|this[t+1]},w.prototype.readUInt32LE=function(t,r){return r||W(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},w.prototype.readUInt32BE=function(t,r){return r||W(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},w.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||W(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*r)),n},w.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||W(t,r,this.length);for(var n=r,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},w.prototype.readInt8=function(t,r){return r||W(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},w.prototype.readInt16LE=function(t,r){r||W(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},w.prototype.readInt16BE=function(t,r){r||W(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},w.prototype.readInt32LE=function(t,r){return r||W(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},w.prototype.readInt32BE=function(t,r){return r||W(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},w.prototype.readFloatLE=function(t,r){return r||W(t,4,this.length),c(this,t,!0,23,4)},w.prototype.readFloatBE=function(t,r){return r||W(t,4,this.length),c(this,t,!1,23,4)},w.prototype.readDoubleLE=function(t,r){return r||W(t,8,this.length),c(this,t,!0,52,8)},w.prototype.readDoubleBE=function(t,r){return r||W(t,8,this.length),c(this,t,!1,52,8)},w.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||j(this,t,r,e,Math.pow(2,8*e)-1,0);var o=1,i=0;for(this[r]=255&t;++i<e&&(o*=256);)this[r+i]=t/o&255;return r+e},w.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||j(this,t,r,e,Math.pow(2,8*e)-1,0);var o=e-1,i=1;for(this[r+o]=255&t;--o>=0&&(i*=256);)this[r+o]=t/i&255;return r+e},w.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,1,255,0),w.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},w.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,65535,0),w.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):q(this,t,r,!0),r+2},w.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,65535,0),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):q(this,t,r,!1),r+2},w.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,4294967295,0),w.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):H(this,t,r,!0),r+4},w.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,4294967295,0),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):H(this,t,r,!1),r+4},w.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);j(this,t,r,e,o-1,-o)}var i=0,a=1,u=0;for(this[r]=255&t;++i<e&&(a*=256);)t<0&&0===u&&0!==this[r+i-1]&&(u=1),this[r+i]=(t/a>>0)-u&255;return r+e},w.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);j(this,t,r,e,o-1,-o)}var i=e-1,a=1,u=0;for(this[r+i]=255&t;--i>=0&&(a*=256);)t<0&&0===u&&0!==this[r+i+1]&&(u=1),this[r+i]=(t/a>>0)-u&255;return r+e},w.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,1,127,-128),w.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},w.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,32767,-32768),w.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):q(this,t,r,!0),r+2},w.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,32767,-32768),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):q(this,t,r,!1),r+2},w.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,2147483647,-2147483648),w.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):H(this,t,r,!0),r+4},w.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):H(this,t,r,!1),r+4},w.prototype.writeFloatLE=function(t,r,e){return K(this,t,r,!0,e)},w.prototype.writeFloatBE=function(t,r,e){return K(this,t,r,!1,e)},w.prototype.writeDoubleLE=function(t,r,e){return V(this,t,r,!0,e)},w.prototype.writeDoubleBE=function(t,r,e){return V(this,t,r,!1,e)},w.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var o,i=n-e;if(this===t&&e<r&&r<n)for(o=i-1;o>=0;--o)t[o+r]=this[o+e];else if(i<1e3||!w.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+r]=this[o+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+i),r);return i},w.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!w.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var i;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(i=r;i<e;++i)this[i]=t;else{var a=R(t)?t:X(new w(t,n).toString()),u=a.length;for(i=0;i<e-r;++i)this[i+r]=a[i%u]}return this};var Q=/[^+\/0-9A-Za-z-_]/g;function G(t){return t<16?"0"+t.toString(16):t.toString(16)}function X(t,r){var e;r=r||1/0;for(var n=t.length,o=null,i=[],a=0;a<n;++a){if((e=t.charCodeAt(a))>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(r-=3)>-1&&i.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&i.push(239,191,189),o=e;continue}e=65536+(o-55296<<10|e-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;i.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return i}function $(t){return function(t){var r,e,n,o,f,h;u||s();var c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");f="="===t[c-2]?2:"="===t[c-1]?1:0,h=new a(3*c/4-f),n=f>0?c-4:c;var l=0;for(r=0,e=0;r<n;r+=4,e+=3)o=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],h[l++]=o>>16&255,h[l++]=o>>8&255,h[l++]=255&o;return 2===f?(o=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,h[l++]=255&o):1===f&&(o=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,h[l++]=o>>8&255,h[l++]=255&o),h}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Q,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Z(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function tt(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var rt=require("buffer-fill"),et=require("buffer-alloc-unsafe");module.exports=function(t,r,e){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative');if(w.alloc)return w.alloc(t,r,e);var n=et(t);return 0===t?n:void 0===r?rt(n,0):("string"!=typeof e&&(e=void 0),rt(n,r,e))};var nt=Object.prototype.toString,ot="function"==typeof w.alloc&&"function"==typeof w.allocUnsafe&&"function"==typeof w.from;module.exports=function(t,r,e){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return n=t,"ArrayBuffer"===nt.call(n).slice(8,-1)?function(t,r,e){r>>>=0;var n=t.byteLength-r;if(n<0)throw new RangeError("'offset' is out of bounds");if(void 0===e)e=n;else if((e>>>=0)>n)throw new RangeError("'length' is out of bounds");return ot?w.from(t.slice(r,r+e)):new w(new Uint8Array(t.slice(r,r+e)))}(t,r,e):"string"==typeof t?function(t,r){if("string"==typeof r&&""!==r||(r="utf8"),!w.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');return ot?w.from(t,r):new w(t,r)}(t,r):ot?w.from(t):new w(t);var n};var it=require("buffer-fill"),at=require("buffer-alloc-unsafe");module.exports=function(t,r,e){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative');if(w.alloc)return w.alloc(t,r,e);var n=at(t);return 0===t?n:void 0===r?it(n,0):("string"!=typeof e&&(e=void 0),it(n,r,e))};var ut=Object.freeze({__proto__:null}),st=Object.prototype.toString,ft="function"==typeof w.alloc&&"function"==typeof w.allocUnsafe&&"function"==typeof w.from;module.exports=function(t,r,e){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return n=t,"ArrayBuffer"===st.call(n).slice(8,-1)?function(t,r,e){r>>>=0;var n=t.byteLength-r;if(n<0)throw new RangeError("'offset' is out of bounds");if(void 0===e)e=n;else if((e>>>=0)>n)throw new RangeError("'length' is out of bounds");return ft?w.from(t.slice(r,r+e)):new w(new Uint8Array(t.slice(r,r+e)))}(t,r,e):"string"==typeof t?function(t,r){if("string"==typeof r&&""!==r||(r="utf8"),!w.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');return ft?w.from(t,r):new w(t,r)}(t,r):ft?w.from(t):new w(t);var n};var ht=Object.freeze({__proto__:null});function ct(t,r){return t(r={exports:{}},r.exports),r.exports}var lt,gt=ct((function(t,r){r.L={bit:1},r.M={bit:0},r.Q={bit:3},r.H={bit:2},r.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},r.from=function(t,e){if(r.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return r.L;case"m":case"medium":return r.M;case"q":case"quartile":return r.Q;case"h":case"high":return r.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(t){return e}}})),dt=(gt.L,gt.M,gt.Q,gt.H,gt.isValid,{alloc:ut,from:ht}),pt=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706],vt=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},wt=function(t){return pt[t]},yt=function(t){for(var r=0;0!==t;)r++,t>>>=1;return r},mt=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');lt=t},Et=function(){return void 0!==lt},At=function(t){return lt(t)},bt=ct((function(t,r){var e=vt;r.getRowColCoords=function(t){if(1===t)return[];for(var r=Math.floor(t/7)+2,n=e(t),o=145===n?26:2*Math.ceil((n-13)/(2*r-2)),i=[n-7],a=1;a<r-1;a++)i[a]=i[a-1]-o;return i.push(6),i.reverse()},r.getPositions=function(t){for(var e=[],n=r.getRowColCoords(t),o=n.length,i=0;i<o;i++)for(var a=0;a<o;a++)0===i&&0===a||0===i&&a===o-1||i===o-1&&0===a||e.push([n[i],n[a]]);return e}})),Rt=(bt.getRowColCoords,bt.getPositions,ct((function(t,r){r.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var e=3,n=3,o=40,i=10;function a(t,e,n){switch(t){case r.Patterns.PATTERN000:return(e+n)%2==0;case r.Patterns.PATTERN001:return e%2==0;case r.Patterns.PATTERN010:return n%3==0;case r.Patterns.PATTERN011:return(e+n)%3==0;case r.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(n/3))%2==0;case r.Patterns.PATTERN101:return e*n%2+e*n%3==0;case r.Patterns.PATTERN110:return(e*n%2+e*n%3)%2==0;case r.Patterns.PATTERN111:return(e*n%3+(e+n)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}r.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},r.from=function(t){return r.isValid(t)?parseInt(t,10):void 0},r.getPenaltyN1=function(t){for(var r=t.size,n=0,o=0,i=0,a=null,u=null,s=0;s<r;s++){o=i=0,a=u=null;for(var f=0;f<r;f++){var h=t.get(s,f);h===a?o++:(o>=5&&(n+=e+(o-5)),a=h,o=1),(h=t.get(f,s))===u?i++:(i>=5&&(n+=e+(i-5)),u=h,i=1)}o>=5&&(n+=e+(o-5)),i>=5&&(n+=e+(i-5))}return n},r.getPenaltyN2=function(t){for(var r=t.size,e=0,o=0;o<r-1;o++)for(var i=0;i<r-1;i++){var a=t.get(o,i)+t.get(o,i+1)+t.get(o+1,i)+t.get(o+1,i+1);4!==a&&0!==a||e++}return e*n},r.getPenaltyN3=function(t){for(var r=t.size,e=0,n=0,i=0,a=0;a<r;a++){n=i=0;for(var u=0;u<r;u++)n=n<<1&2047|t.get(a,u),u>=10&&(1488===n||93===n)&&e++,i=i<<1&2047|t.get(u,a),u>=10&&(1488===i||93===i)&&e++}return e*o},r.getPenaltyN4=function(t){for(var r=0,e=t.data.length,n=0;n<e;n++)r+=t.data[n];return Math.abs(Math.ceil(100*r/e/5)-10)*i},r.applyMask=function(t,r){for(var e=r.size,n=0;n<e;n++)for(var o=0;o<e;o++)r.isReserved(o,n)||r.xor(o,n,a(t,o,n))},r.getBestMask=function(t,e){for(var n=Object.keys(r.Patterns).length,o=0,i=1/0,a=0;a<n;a++){e(a),r.applyMask(a,t);var u=r.getPenaltyN1(t)+r.getPenaltyN2(t)+r.getPenaltyN3(t)+r.getPenaltyN4(t);r.applyMask(a,t),u<i&&(i=u,o=a)}return o}}))),Tt=(Rt.Patterns,Rt.isValid,Rt.getPenaltyN1,Rt.getPenaltyN2,Rt.getPenaltyN3,Rt.getPenaltyN4,Rt.applyMask,Rt.getBestMask,ct((function(t,r){r.L={bit:1},r.M={bit:0},r.Q={bit:3},r.H={bit:2},r.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},r.from=function(t,e){if(r.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return r.L;case"m":case"medium":return r.M;case"q":case"quartile":return r.Q;case"h":case"high":return r.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(t){return e}}}))),Pt=(Tt.L,Tt.M,Tt.Q,Tt.H,Tt.isValid,dt.alloc(512)),Bt=dt.alloc(256);!function(){for(var t=1,r=0;r<255;r++)Pt[r]=t,Bt[t]=r,256&(t<<=1)&&(t^=285);for(r=255;r<512;r++)Pt[r]=Pt[r-255]}();var It=dt.alloc(512),Ct=dt.alloc(256);!function(){for(var t=1,r=0;r<255;r++)It[r]=t,Ct[t]=r,256&(t<<=1)&&(t^=285);for(r=255;r<512;r++)It[r]=It[r-255]}();var _t=function(t){return It[t]},Mt=function(t,r){return 0===t||0===r?0:It[Ct[t]+Ct[r]]},Ut=ct((function(t,r){r.mul=function(t,r){for(var e=dt.alloc(t.length+r.length-1),n=0;n<t.length;n++)for(var o=0;o<r.length;o++)e[n+o]^=Mt(t[n],r[o]);return e},r.mod=function(t,r){for(var e=dt.from(t);e.length-r.length>=0;){for(var n=e[0],o=0;o<r.length;o++)e[o]^=Mt(r[o],n);for(var i=0;i<e.length&&0===e[i];)i++;e=e.slice(i)}return e},r.generateECPolynomial=function(t){for(var e=dt.from([1]),n=0;n<t;n++)e=r.mul(e,[1,_t(n)]);return e}})),Nt=(Ut.mul,Ut.mod,Ut.generateECPolynomial,ct((function(t,r){r.mul=function(t,r){for(var e=dt.alloc(t.length+r.length-1),n=0;n<t.length;n++)for(var o=0;o<r.length;o++)e[n+o]^=Mt(t[n],r[o]);return e},r.mod=function(t,r){for(var e=dt.from(t);e.length-r.length>=0;){for(var n=e[0],o=0;o<r.length;o++)e[o]^=Mt(r[o],n);for(var i=0;i<e.length&&0===e[i];)i++;e=e.slice(i)}return e},r.generateECPolynomial=function(t){for(var e=dt.from([1]),n=0;n<t;n++)e=r.mul(e,[1,_t(n)]);return e}}))),Lt=(Nt.mul,Nt.mod,Nt.generateECPolynomial,[]),St=[],xt="undefined"!=typeof Uint8Array?Uint8Array:Array,Yt=!1;function Dt(){Yt=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)Lt[r]=t[r],St[t.charCodeAt(r)]=r;St["-".charCodeAt(0)]=62,St["_".charCodeAt(0)]=63}function Ot(t,r,e){for(var n,o,i=[],a=r;a<e;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],i.push(Lt[(o=n)>>18&63]+Lt[o>>12&63]+Lt[o>>6&63]+Lt[63&o]);return i.join("")}function kt(t){var r;Yt||Dt();for(var e=t.length,n=e%3,o="",i=[],a=16383,u=0,s=e-n;u<s;u+=a)i.push(Ot(t,u,u+a>s?s:u+a));return 1===n?(r=t[e-1],o+=Lt[r>>2],o+=Lt[r<<4&63],o+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],o+=Lt[r>>10],o+=Lt[r>>4&63],o+=Lt[r<<2&63],o+="="),i.push(o),i.join("")}function Ft(t,r,e,n,o){var i,a,u=8*o-n-1,s=(1<<u)-1,f=s>>1,h=-7,c=e?o-1:0,l=e?-1:1,g=t[r+c];for(c+=l,i=g&(1<<-h)-1,g>>=-h,h+=u;h>0;i=256*i+t[r+c],c+=l,h-=8);for(a=i&(1<<-h)-1,i>>=-h,h+=n;h>0;a=256*a+t[r+c],c+=l,h-=8);if(0===i)i=1-f;else{if(i===s)return a?NaN:1/0*(g?-1:1);a+=Math.pow(2,n),i-=f}return(g?-1:1)*a*Math.pow(2,i-n)}function zt(t,r,e,n,o,i){var a,u,s,f=8*i-o-1,h=(1<<f)-1,c=h>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:i-1,d=n?1:-1,p=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,a=h):(a=Math.floor(Math.log(r)/Math.LN2),r*(s=Math.pow(2,-a))<1&&(a--,s*=2),(r+=a+c>=1?l/s:l*Math.pow(2,1-c))*s>=2&&(a++,s/=2),a+c>=h?(u=0,a=h):a+c>=1?(u=(r*s-1)*Math.pow(2,o),a+=c):(u=r*Math.pow(2,c-1)*Math.pow(2,o),a=0));o>=8;t[e+g]=255&u,g+=d,u/=256,o-=8);for(a=a<<o|u,f+=o;f>0;t[e+g]=255&a,g+=d,a/=256,f-=8);t[e+g-d]|=128*p}var Wt={}.toString,jt=Array.isArray||function(t){return"[object Array]"==Wt.call(t)};Kt.TYPED_ARRAY_SUPPORT=void 0===n.TYPED_ARRAY_SUPPORT||n.TYPED_ARRAY_SUPPORT;var qt=Ht();function Ht(){return Kt.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Jt(t,r){if(Ht()<r)throw new RangeError("Invalid typed array length");return Kt.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=Kt.prototype:(null===t&&(t=new Kt(r)),t.length=r),t}function Kt(t,r,e){if(!(Kt.TYPED_ARRAY_SUPPORT||this instanceof Kt))return new Kt(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return Gt(this,t)}return Vt(this,t,r,e)}function Vt(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);Kt.TYPED_ARRAY_SUPPORT?(t=r).__proto__=Kt.prototype:t=Xt(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!Kt.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|tr(r,e),o=(t=Jt(t,n)).write(r,e);o!==n&&(t=t.slice(0,o));return t}(t,r,e):function(t,r){if(Zt(r)){var e=0|$t(r.length);return 0===(t=Jt(t,e)).length||r.copy(t,0,0,e),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?Jt(t,0):Xt(t,r);if("Buffer"===r.type&&jt(r.data))return Xt(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function Qt(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Gt(t,r){if(Qt(r),t=Jt(t,r<0?0:0|$t(r)),!Kt.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function Xt(t,r){var e=r.length<0?0:0|$t(r.length);t=Jt(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function $t(t){if(t>=Ht())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ht().toString(16)+" bytes");return 0|t}function Zt(t){return!(null==t||!t._isBuffer)}function tr(t,r){if(Zt(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Ir(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return Cr(t).length;default:if(n)return Ir(t).length;r=(""+r).toLowerCase(),n=!0}}function rr(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return vr(this,r,e);case"utf8":case"utf-8":return lr(this,r,e);case"ascii":return dr(this,r,e);case"latin1":case"binary":return pr(this,r,e);case"base64":return cr(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wr(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function er(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function nr(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=Kt.from(r,n)),Zt(r))return 0===r.length?-1:or(t,r,e,n,o);if("number"==typeof r)return r&=255,Kt.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):or(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function or(t,r,e,n,o){var i,a=1,u=t.length,s=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;a=2,u/=2,s/=2,e/=2}function f(t,r){return 1===a?t[r]:t.readUInt16BE(r*a)}if(o){var h=-1;for(i=e;i<u;i++)if(f(t,i)===f(r,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===s)return h*a}else-1!==h&&(i-=i-h),h=-1}else for(e+s>u&&(e=u-s),i=e;i>=0;i--){for(var c=!0,l=0;l<s;l++)if(f(t,i+l)!==f(r,l)){c=!1;break}if(c)return i}return-1}function ir(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n))>o&&(n=o):n=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a<n;++a){var u=parseInt(r.substr(2*a,2),16);if(isNaN(u))return a;t[e+a]=u}return a}function ar(t,r,e,n){return _r(Ir(r,t.length-e),t,e,n)}function ur(t,r,e,n){return _r(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function sr(t,r,e,n){return ur(t,r,e,n)}function fr(t,r,e,n){return _r(Cr(r),t,e,n)}function hr(t,r,e,n){return _r(function(t,r){for(var e,n,o,i=[],a=0;a<t.length&&!((r-=2)<0);++a)n=(e=t.charCodeAt(a))>>8,o=e%256,i.push(o),i.push(n);return i}(r,t.length-e),t,e,n)}function cr(t,r,e){return 0===r&&e===t.length?kt(t):kt(t.slice(r,e))}function lr(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var i,a,u,s,f=t[o],h=null,c=f>239?4:f>223?3:f>191?2:1;if(o+c<=e)switch(c){case 1:f<128&&(h=f);break;case 2:128==(192&(i=t[o+1]))&&(s=(31&f)<<6|63&i)>127&&(h=s);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(s=(15&f)<<12|(63&i)<<6|63&a)>2047&&(s<55296||s>57343)&&(h=s);break;case 4:i=t[o+1],a=t[o+2],u=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&u)&&(s=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&u)>65535&&s<1114112&&(h=s)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),o+=c}return function(t){var r=t.length;if(r<=gr)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=gr));return e}(n)}Kt.poolSize=8192,Kt._augment=function(t){return t.__proto__=Kt.prototype,t},Kt.from=function(t,r,e){return Vt(null,t,r,e)},Kt.TYPED_ARRAY_SUPPORT&&(Kt.prototype.__proto__=Uint8Array.prototype,Kt.__proto__=Uint8Array),Kt.alloc=function(t,r,e){return function(t,r,e,n){return Qt(r),r<=0?Jt(t,r):void 0!==e?"string"==typeof n?Jt(t,r).fill(e,n):Jt(t,r).fill(e):Jt(t,r)}(null,t,r,e)},Kt.allocUnsafe=function(t){return Gt(null,t)},Kt.allocUnsafeSlow=function(t){return Gt(null,t)},Kt.isBuffer=Mr,Kt.compare=function(t,r){if(!Zt(t)||!Zt(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,o=0,i=Math.min(e,n);o<i;++o)if(t[o]!==r[o]){e=t[o],n=r[o];break}return e<n?-1:n<e?1:0},Kt.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Kt.concat=function(t,r){if(!jt(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Kt.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=Kt.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){var i=t[e];if(!Zt(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},Kt.byteLength=tr,Kt.prototype._isBuffer=!0,Kt.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)er(this,r,r+1);return this},Kt.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)er(this,r,r+3),er(this,r+1,r+2);return this},Kt.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)er(this,r,r+7),er(this,r+1,r+6),er(this,r+2,r+5),er(this,r+3,r+4);return this},Kt.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?lr(this,0,t):rr.apply(this,arguments)},Kt.prototype.equals=function(t){if(!Zt(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Kt.compare(this,t)},Kt.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},Kt.prototype.compare=function(t,r,e,n,o){if(!Zt(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=e)return 0;if(n>=o)return-1;if(r>=e)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),a=(e>>>=0)-(r>>>=0),u=Math.min(i,a),s=this.slice(n,o),f=t.slice(r,e),h=0;h<u;++h)if(s[h]!==f[h]){i=s[h],a=f[h];break}return i<a?-1:a<i?1:0},Kt.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},Kt.prototype.indexOf=function(t,r,e){return nr(this,t,r,e,!0)},Kt.prototype.lastIndexOf=function(t,r,e){return nr(this,t,r,e,!1)},Kt.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var o=this.length-r;if((void 0===e||e>o)&&(e=o),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return ir(this,t,r,e);case"utf8":case"utf-8":return ar(this,t,r,e);case"ascii":return ur(this,t,r,e);case"latin1":case"binary":return sr(this,t,r,e);case"base64":return fr(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return hr(this,t,r,e);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},Kt.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var gr=4096;function dr(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(127&t[o]);return n}function pr(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function vr(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",i=r;i<e;++i)o+=Br(t[i]);return o}function wr(t,r,e){for(var n=t.slice(r,e),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function yr(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function mr(t,r,e,n,o,i){if(!Zt(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<i)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function Er(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o<i;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function Ar(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o<i;++o)t[e+o]=r>>>8*(n?o:3-o)&255}function br(t,r,e,n,o,i){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Rr(t,r,e,n,o){return o||br(t,0,e,4),zt(t,r,e,n,23,4),e+4}function Tr(t,r,e,n,o){return o||br(t,0,e,8),zt(t,r,e,n,52,8),e+8}Kt.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),Kt.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=Kt.prototype;else{var o=r-t;e=new Kt(o,void 0);for(var i=0;i<o;++i)e[i]=this[i+t]}return e},Kt.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||yr(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n},Kt.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||yr(t,r,this.length);for(var n=this[t+--r],o=1;r>0&&(o*=256);)n+=this[t+--r]*o;return n},Kt.prototype.readUInt8=function(t,r){return r||yr(t,1,this.length),this[t]},Kt.prototype.readUInt16LE=function(t,r){return r||yr(t,2,this.length),this[t]|this[t+1]<<8},Kt.prototype.readUInt16BE=function(t,r){return r||yr(t,2,this.length),this[t]<<8|this[t+1]},Kt.prototype.readUInt32LE=function(t,r){return r||yr(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Kt.prototype.readUInt32BE=function(t,r){return r||yr(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Kt.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||yr(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*r)),n},Kt.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||yr(t,r,this.length);for(var n=r,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},Kt.prototype.readInt8=function(t,r){return r||yr(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Kt.prototype.readInt16LE=function(t,r){r||yr(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},Kt.prototype.readInt16BE=function(t,r){r||yr(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},Kt.prototype.readInt32LE=function(t,r){return r||yr(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Kt.prototype.readInt32BE=function(t,r){return r||yr(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Kt.prototype.readFloatLE=function(t,r){return r||yr(t,4,this.length),Ft(this,t,!0,23,4)},Kt.prototype.readFloatBE=function(t,r){return r||yr(t,4,this.length),Ft(this,t,!1,23,4)},Kt.prototype.readDoubleLE=function(t,r){return r||yr(t,8,this.length),Ft(this,t,!0,52,8)},Kt.prototype.readDoubleBE=function(t,r){return r||yr(t,8,this.length),Ft(this,t,!1,52,8)},Kt.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||mr(this,t,r,e,Math.pow(2,8*e)-1,0);var o=1,i=0;for(this[r]=255&t;++i<e&&(o*=256);)this[r+i]=t/o&255;return r+e},Kt.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||mr(this,t,r,e,Math.pow(2,8*e)-1,0);var o=e-1,i=1;for(this[r+o]=255&t;--o>=0&&(i*=256);)this[r+o]=t/i&255;return r+e},Kt.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||mr(this,t,r,1,255,0),Kt.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},Kt.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||mr(this,t,r,2,65535,0),Kt.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):Er(this,t,r,!0),r+2},Kt.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||mr(this,t,r,2,65535,0),Kt.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):Er(this,t,r,!1),r+2},Kt.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||mr(this,t,r,4,4294967295,0),Kt.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):Ar(this,t,r,!0),r+4},Kt.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||mr(this,t,r,4,4294967295,0),Kt.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):Ar(this,t,r,!1),r+4},Kt.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);mr(this,t,r,e,o-1,-o)}var i=0,a=1,u=0;for(this[r]=255&t;++i<e&&(a*=256);)t<0&&0===u&&0!==this[r+i-1]&&(u=1),this[r+i]=(t/a>>0)-u&255;return r+e},Kt.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);mr(this,t,r,e,o-1,-o)}var i=e-1,a=1,u=0;for(this[r+i]=255&t;--i>=0&&(a*=256);)t<0&&0===u&&0!==this[r+i+1]&&(u=1),this[r+i]=(t/a>>0)-u&255;return r+e},Kt.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||mr(this,t,r,1,127,-128),Kt.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},Kt.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||mr(this,t,r,2,32767,-32768),Kt.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):Er(this,t,r,!0),r+2},Kt.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||mr(this,t,r,2,32767,-32768),Kt.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):Er(this,t,r,!1),r+2},Kt.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||mr(this,t,r,4,2147483647,-2147483648),Kt.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):Ar(this,t,r,!0),r+4},Kt.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||mr(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Kt.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):Ar(this,t,r,!1),r+4},Kt.prototype.writeFloatLE=function(t,r,e){return Rr(this,t,r,!0,e)},Kt.prototype.writeFloatBE=function(t,r,e){return Rr(this,t,r,!1,e)},Kt.prototype.writeDoubleLE=function(t,r,e){return Tr(this,t,r,!0,e)},Kt.prototype.writeDoubleBE=function(t,r,e){return Tr(this,t,r,!1,e)},Kt.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var o,i=n-e;if(this===t&&e<r&&r<n)for(o=i-1;o>=0;--o)t[o+r]=this[o+e];else if(i<1e3||!Kt.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+r]=this[o+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+i),r);return i},Kt.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Kt.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var i;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(i=r;i<e;++i)this[i]=t;else{var a=Zt(t)?t:Ir(new Kt(t,n).toString()),u=a.length;for(i=0;i<e-r;++i)this[i+r]=a[i%u]}return this};var Pr=/[^+\/0-9A-Za-z-_]/g;function Br(t){return t<16?"0"+t.toString(16):t.toString(16)}function Ir(t,r){var e;r=r||1/0;for(var n=t.length,o=null,i=[],a=0;a<n;++a){if((e=t.charCodeAt(a))>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(r-=3)>-1&&i.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&i.push(239,191,189),o=e;continue}e=65536+(o-55296<<10|e-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;i.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return i}function Cr(t){return function(t){var r,e,n,o,i,a;Yt||Dt();var u=t.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===t[u-2]?2:"="===t[u-1]?1:0,a=new xt(3*u/4-i),n=i>0?u-4:u;var s=0;for(r=0,e=0;r<n;r+=4,e+=3)o=St[t.charCodeAt(r)]<<18|St[t.charCodeAt(r+1)]<<12|St[t.charCodeAt(r+2)]<<6|St[t.charCodeAt(r+3)],a[s++]=o>>16&255,a[s++]=o>>8&255,a[s++]=255&o;return 2===i?(o=St[t.charCodeAt(r)]<<2|St[t.charCodeAt(r+1)]>>4,a[s++]=255&o):1===i&&(o=St[t.charCodeAt(r)]<<10|St[t.charCodeAt(r+1)]<<4|St[t.charCodeAt(r+2)]>>2,a[s++]=o>>8&255,a[s++]=255&o),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Pr,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function _r(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function Mr(t){return null!=t&&(!!t._isBuffer||Ur(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&Ur(t.slice(0,0))}(t))}function Ur(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var Nr=Object.freeze({__proto__:null,Buffer:Kt,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),Kt.alloc(+t)},isBuffer:Mr,kMaxLength:qt}),Lr=(Nr.Buffer,"(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+");Lr=Lr.replace(/u/g,"\\u");var Sr=function(t){return!isNaN(t)&&t>=1&&t<=40},xr="[0-9]+",Yr="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",Dr="(?:(?![A-Z0-9 $%*+\\-./:]|"+(Yr=Yr.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+",Or=new RegExp(Yr,"g"),kr=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Fr=new RegExp(Dr,"g"),zr=new RegExp(xr,"g"),Wr=new RegExp("[A-Z $%*+\\-./:]+","g"),jr=new RegExp("^"+Yr+"$"),qr=new RegExp("^[0-9]+$"),Hr=new RegExp("^[A-Z0-9 $%*+\\-./:]+$"),Jr={KANJI:Or,BYTE_KANJI:kr,BYTE:Fr,NUMERIC:zr,ALPHANUMERIC:Wr,testKanji:function(t){return jr.test(t)},testNumeric:function(t){return qr.test(t)},testAlphanumeric:function(t){return Hr.test(t)}},Kr=ct((function(t,r){r.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},r.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},r.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},r.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},r.MIXED={bit:-1},r.getCharCountIndicator=function(t,r){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!Sr(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?t.ccBits[0]:r<27?t.ccBits[1]:t.ccBits[2]},r.getBestModeForData=function(t){return Jr.testNumeric(t)?r.NUMERIC:Jr.testAlphanumeric(t)?r.ALPHANUMERIC:Jr.testKanji(t)?r.KANJI:r.BYTE},r.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},r.isValid=function(t){return t&&t.bit&&t.ccBits},r.from=function(t,e){if(r.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return r.NUMERIC;case"alphanumeric":return r.ALPHANUMERIC;case"kanji":return r.KANJI;case"byte":return r.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(t){return e}}})),Vr=(Kr.NUMERIC,Kr.ALPHANUMERIC,Kr.BYTE,Kr.KANJI,Kr.MIXED,Kr.getCharCountIndicator,Kr.getBestModeForData,Kr.isValid,[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81]),Qr=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430],Gr=function(t,r){switch(r){case Tt.L:return Vr[4*(t-1)+0];case Tt.M:return Vr[4*(t-1)+1];case Tt.Q:return Vr[4*(t-1)+2];case Tt.H:return Vr[4*(t-1)+3];default:return}},Xr=function(t,r){switch(r){case Tt.L:return Qr[4*(t-1)+0];case Tt.M:return Qr[4*(t-1)+1];case Tt.Q:return Qr[4*(t-1)+2];case Tt.H:return Qr[4*(t-1)+3];default:return}},$r=ct((function(t,r){r.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},r.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},r.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},r.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},r.MIXED={bit:-1},r.getCharCountIndicator=function(t,r){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!Sr(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?t.ccBits[0]:r<27?t.ccBits[1]:t.ccBits[2]},r.getBestModeForData=function(t){return Jr.testNumeric(t)?r.NUMERIC:Jr.testAlphanumeric(t)?r.ALPHANUMERIC:Jr.testKanji(t)?r.KANJI:r.BYTE},r.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},r.isValid=function(t){return t&&t.bit&&t.ccBits},r.from=function(t,e){if(r.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return r.NUMERIC;case"alphanumeric":return r.ALPHANUMERIC;case"kanji":return r.KANJI;case"byte":return r.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(t){return e}}})),Zr=($r.NUMERIC,$r.ALPHANUMERIC,$r.BYTE,$r.KANJI,$r.MIXED,$r.getCharCountIndicator,$r.getBestModeForData,$r.isValid,{}.toString),te=Array.isArray||function(t){return"[object Array]"==Zr.call(t)},re=ct((function(t,r){var e=yt(7973);function n(t,r){return $r.getCharCountIndicator(t,r)+4}function o(t,r){var e=0;return t.forEach((function(t){var o=n(t.mode,r);e+=o+t.getBitsLength()})),e}r.from=function(t,r){return Sr(t)?parseInt(t,10):r},r.getCapacity=function(t,r,e){if(!Sr(t))throw new Error("Invalid QR Code version");void 0===e&&(e=$r.BYTE);var o=8*(wt(t)-Xr(t,r));if(e===$r.MIXED)return o;var i=o-n(e,t);switch(e){case $r.NUMERIC:return Math.floor(i/10*3);case $r.ALPHANUMERIC:return Math.floor(i/11*2);case $r.KANJI:return Math.floor(i/13);case $r.BYTE:default:return Math.floor(i/8)}},r.getBestVersionForData=function(t,e){var n,i=Tt.from(e,Tt.M);if(te(t)){if(t.length>1)return function(t,e){for(var n=1;n<=40;n++)if(o(t,n)<=r.getCapacity(n,e,$r.MIXED))return n}(t,i);if(0===t.length)return 1;n=t[0]}else n=t;return function(t,e,n){for(var o=1;o<=40;o++)if(e<=r.getCapacity(o,n,t))return o}(n.mode,n.getLength(),i)},r.getEncodedBits=function(t){if(!Sr(t)||t<7)throw new Error("Invalid QR Code version");for(var r=t<<12;yt(r)-e>=0;)r^=7973<<yt(r)-e;return t<<12|r}}));re.getCapacity,re.getBestVersionForData,re.getEncodedBits,yt(1335);function ee(t){this.mode=$r.NUMERIC,this.data=t.toString()}ee.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},ee.prototype.getLength=function(){return this.data.length},ee.prototype.getBitsLength=function(){return ee.getBitsLength(this.data.length)},ee.prototype.write=function(t){var r,e,n;for(r=0;r+3<=this.data.length;r+=3)e=this.data.substr(r,3),n=parseInt(e,10),t.put(n,10);var o=this.data.length-r;o>0&&(e=this.data.substr(r),n=parseInt(e,10),t.put(n,3*o+1))};var ne=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function oe(t){this.mode=$r.ALPHANUMERIC,this.data=t}function ie(t){this.mode=$r.BYTE,this.data=dt.from(t)}function ae(t){this.mode=$r.KANJI,this.data=t}oe.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},oe.prototype.getLength=function(){return this.data.length},oe.prototype.getBitsLength=function(){return oe.getBitsLength(this.data.length)},oe.prototype.write=function(t){var r;for(r=0;r+2<=this.data.length;r+=2){var e=45*ne.indexOf(this.data[r]);e+=ne.indexOf(this.data[r+1]),t.put(e,11)}this.data.length%2&&t.put(ne.indexOf(this.data[r]),6)},ie.getBitsLength=function(t){return 8*t},ie.prototype.getLength=function(){return this.data.length},ie.prototype.getBitsLength=function(){return ie.getBitsLength(this.data.length)},ie.prototype.write=function(t){for(var r=0,e=this.data.length;r<e;r++)t.put(this.data[r],8)},ae.getBitsLength=function(t){return 13*t},ae.prototype.getLength=function(){return this.data.length},ae.prototype.getBitsLength=function(){return ae.getBitsLength(this.data.length)},ae.prototype.write=function(t){var r;for(r=0;r<this.data.length;r++){var e=At(this.data[r]);if(e>=33088&&e<=40956)e-=33088;else{if(!(e>=57408&&e<=60351))throw new Error("Invalid SJIS character: "+this.data[r]+"\nMake sure your charset is UTF-8");e-=49472}e=192*(e>>>8&255)+(255&e),t.put(e,13)}};ct((function(t){var r={single_source_shortest_paths:function(t,e,n){var o={},i={};i[e]=0;var a,u,s,f,h,c,l,g=r.PriorityQueue.make();for(g.push(e,0);!g.empty();)for(s in u=(a=g.pop()).value,f=a.cost,h=t[u]||{})h.hasOwnProperty(s)&&(c=f+h[s],l=i[s],(void 0===i[s]||l>c)&&(i[s]=c,g.push(s,c),o[s]=u));if(void 0!==n&&void 0===i[n]){var d=["Could not find a path from ",e," to ",n,"."].join("");throw new Error(d)}return o},extract_shortest_path_from_predecessor_list:function(t,r){for(var e=[],n=r;n;)e.push(n),t[n],n=t[n];return e.reverse(),e},find_path:function(t,e,n){var o=r.single_source_shortest_paths(t,e,n);return r.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(t){var e,n=r.PriorityQueue,o={};for(e in t=t||{},n)n.hasOwnProperty(e)&&(o[e]=n[e]);return o.queue=[],o.sorter=t.sorter||n.default_sorter,o},default_sorter:function(t,r){return t.cost-r.cost},push:function(t,r){var e={value:t,cost:r};this.queue.push(e),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};t.exports=r}));function ue(t){this.mode=$r.NUMERIC,this.data=t.toString()}ue.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},ue.prototype.getLength=function(){return this.data.length},ue.prototype.getBitsLength=function(){return ue.getBitsLength(this.data.length)},ue.prototype.write=function(t){var r,e,n;for(r=0;r+3<=this.data.length;r+=3)e=this.data.substr(r,3),n=parseInt(e,10),t.put(n,10);var o=this.data.length-r;o>0&&(e=this.data.substr(r),n=parseInt(e,10),t.put(n,3*o+1))};var se=ue,fe=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function he(t){this.mode=$r.ALPHANUMERIC,this.data=t}he.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},he.prototype.getLength=function(){return this.data.length},he.prototype.getBitsLength=function(){return he.getBitsLength(this.data.length)},he.prototype.write=function(t){var r;for(r=0;r+2<=this.data.length;r+=2){var e=45*fe.indexOf(this.data[r]);e+=fe.indexOf(this.data[r+1]),t.put(e,11)}this.data.length%2&&t.put(fe.indexOf(this.data[r]),6)};var ce=he;function le(t){this.mode=$r.BYTE,this.data=dt.from(t)}le.getBitsLength=function(t){return 8*t},le.prototype.getLength=function(){return this.data.length},le.prototype.getBitsLength=function(){return le.getBitsLength(this.data.length)},le.prototype.write=function(t){for(var r=0,e=this.data.length;r<e;r++)t.put(this.data[r],8)};var ge=le;function de(t){this.mode=$r.KANJI,this.data=t}de.getBitsLength=function(t){return 13*t},de.prototype.getLength=function(){return this.data.length},de.prototype.getBitsLength=function(){return de.getBitsLength(this.data.length)},de.prototype.write=function(t){var r;for(r=0;r<this.data.length;r++){var e=At(this.data[r]);if(e>=33088&&e<=40956)e-=33088;else{if(!(e>=57408&&e<=60351))throw new Error("Invalid SJIS character: "+this.data[r]+"\nMake sure your charset is UTF-8");e-=49472}e=192*(e>>>8&255)+(255&e),t.put(e,13)}};var pe=de,ve=ct((function(t){var r={single_source_shortest_paths:function(t,e,n){var o={},i={};i[e]=0;var a,u,s,f,h,c,l,g=r.PriorityQueue.make();for(g.push(e,0);!g.empty();)for(s in u=(a=g.pop()).value,f=a.cost,h=t[u]||{})h.hasOwnProperty(s)&&(c=f+h[s],l=i[s],(void 0===i[s]||l>c)&&(i[s]=c,g.push(s,c),o[s]=u));if(void 0!==n&&void 0===i[n]){var d=["Could not find a path from ",e," to ",n,"."].join("");throw new Error(d)}return o},extract_shortest_path_from_predecessor_list:function(t,r){for(var e=[],n=r;n;)e.push(n),t[n],n=t[n];return e.reverse(),e},find_path:function(t,e,n){var o=r.single_source_shortest_paths(t,e,n);return r.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(t){var e,n=r.PriorityQueue,o={};for(e in t=t||{},n)n.hasOwnProperty(e)&&(o[e]=n[e]);return o.queue=[],o.sorter=t.sorter||n.default_sorter,o},default_sorter:function(t,r){return t.cost-r.cost},push:function(t,r){var e={value:t,cost:r};this.queue.push(e),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};t.exports=r})),we=ct((function(t,r){function e(t){return unescape(encodeURIComponent(t)).length}function n(t,r,e){for(var n,o=[];null!==(n=t.exec(e));)o.push({data:n[0],index:n.index,mode:r,length:n[0].length});return o}function o(t){var r,e,o=n(Jr.NUMERIC,$r.NUMERIC,t),i=n(Jr.ALPHANUMERIC,$r.ALPHANUMERIC,t);return Et()?(r=n(Jr.BYTE,$r.BYTE,t),e=n(Jr.KANJI,$r.KANJI,t)):(r=n(Jr.BYTE_KANJI,$r.BYTE,t),e=[]),o.concat(i,r,e).sort((function(t,r){return t.index-r.index})).map((function(t){return{data:t.data,mode:t.mode,length:t.length}}))}function i(t,r){switch(r){case $r.NUMERIC:return se.getBitsLength(t);case $r.ALPHANUMERIC:return ce.getBitsLength(t);case $r.KANJI:return pe.getBitsLength(t);case $r.BYTE:return ge.getBitsLength(t)}}function a(t,r){var e,n=$r.getBestModeForData(t);if((e=$r.from(r,n))!==$r.BYTE&&e.bit<n.bit)throw new Error('"'+t+'" cannot be encoded with mode '+$r.toString(e)+".\n Suggested mode is: "+$r.toString(n));switch(e!==$r.KANJI||Et()||(e=$r.BYTE),e){case $r.NUMERIC:return new se(t);case $r.ALPHANUMERIC:return new ce(t);case $r.KANJI:return new pe(t);case $r.BYTE:return new ge(t)}}r.fromArray=function(t){return t.reduce((function(t,r){return"string"==typeof r?t.push(a(r,null)):r.data&&t.push(a(r.data,r.mode)),t}),[])},r.fromString=function(t,n){for(var a=function(t,r){for(var e={},n={start:{}},o=["start"],a=0;a<t.length;a++){for(var u=t[a],s=[],f=0;f<u.length;f++){var h=u[f],c=""+a+f;s.push(c),e[c]={node:h,lastCount:0},n[c]={};for(var l=0;l<o.length;l++){var g=o[l];e[g]&&e[g].node.mode===h.mode?(n[g][c]=i(e[g].lastCount+h.length,h.mode)-i(e[g].lastCount,h.mode),e[g].lastCount+=h.length):(e[g]&&(e[g].lastCount=h.length),n[g][c]=i(h.length,h.mode)+4+$r.getCharCountIndicator(h.mode,r))}}o=s}for(l=0;l<o.length;l++)n[o[l]].end=0;return{map:n,table:e}}(function(t){for(var r=[],n=0;n<t.length;n++){var o=t[n];switch(o.mode){case $r.NUMERIC:r.push([o,{data:o.data,mode:$r.ALPHANUMERIC,length:o.length},{data:o.data,mode:$r.BYTE,length:o.length}]);break;case $r.ALPHANUMERIC:r.push([o,{data:o.data,mode:$r.BYTE,length:o.length}]);break;case $r.KANJI:r.push([o,{data:o.data,mode:$r.BYTE,length:e(o.data)}]);break;case $r.BYTE:r.push([{data:o.data,mode:$r.BYTE,length:e(o.data)}])}}return r}(o(t,Et())),n),u=ve.find_path(a.map,"start","end"),s=[],f=1;f<u.length-1;f++)s.push(a.table[u[f]].node);return r.fromArray(function(t){return t.reduce((function(t,r){var e=t.length-1>=0?t[t.length-1]:null;return e&&e.mode===r.mode?(t[t.length-1].data+=r.data,t):(t.push(r),t)}),[])}(s))},r.rawSplit=function(t){return r.fromArray(o(t,Et()))}}));we.fromArray,we.fromString,we.rawSplit;function ye(){this.buffer=[],this.length=0}ye.prototype={get:function(t){var r=Math.floor(t/8);return 1==(this.buffer[r]>>>7-t%8&1)},put:function(t,r){for(var e=0;e<r;e++)this.putBit(1==(t>>>r-e-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),t&&(this.buffer[r]|=128>>>this.length%8),this.length++}};var me=ye;function Ee(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=dt.alloc(t*t),this.reservedBit=dt.alloc(t*t)}Ee.prototype.set=function(t,r,e,n){var o=t*this.size+r;this.data[o]=e,n&&(this.reservedBit[o]=!0)},Ee.prototype.get=function(t,r){return this.data[t*this.size+r]},Ee.prototype.xor=function(t,r,e){this.data[t*this.size+r]^=e},Ee.prototype.isReserved=function(t,r){return this.reservedBit[t*this.size+r]};var Ae=Ee,be=ct((function(t,r){var e=vt;r.getRowColCoords=function(t){if(1===t)return[];for(var r=Math.floor(t/7)+2,n=e(t),o=145===n?26:2*Math.ceil((n-13)/(2*r-2)),i=[n-7],a=1;a<r-1;a++)i[a]=i[a-1]-o;return i.push(6),i.reverse()},r.getPositions=function(t){for(var e=[],n=r.getRowColCoords(t),o=n.length,i=0;i<o;i++)for(var a=0;a<o;a++)0===i&&0===a||0===i&&a===o-1||i===o-1&&0===a||e.push([n[i],n[a]]);return e}})),Re=(be.getRowColCoords,be.getPositions,vt),Te=function(t){var r=Re(t);return[[0,0],[r-7,0],[0,r-7]]},Pe=ct((function(t,r){r.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var e=3,n=3,o=40,i=10;function a(t,e,n){switch(t){case r.Patterns.PATTERN000:return(e+n)%2==0;case r.Patterns.PATTERN001:return e%2==0;case r.Patterns.PATTERN010:return n%3==0;case r.Patterns.PATTERN011:return(e+n)%3==0;case r.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(n/3))%2==0;case r.Patterns.PATTERN101:return e*n%2+e*n%3==0;case r.Patterns.PATTERN110:return(e*n%2+e*n%3)%2==0;case r.Patterns.PATTERN111:return(e*n%3+(e+n)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}r.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},r.from=function(t){return r.isValid(t)?parseInt(t,10):void 0},r.getPenaltyN1=function(t){for(var r=t.size,n=0,o=0,i=0,a=null,u=null,s=0;s<r;s++){o=i=0,a=u=null;for(var f=0;f<r;f++){var h=t.get(s,f);h===a?o++:(o>=5&&(n+=e+(o-5)),a=h,o=1),(h=t.get(f,s))===u?i++:(i>=5&&(n+=e+(i-5)),u=h,i=1)}o>=5&&(n+=e+(o-5)),i>=5&&(n+=e+(i-5))}return n},r.getPenaltyN2=function(t){for(var r=t.size,e=0,o=0;o<r-1;o++)for(var i=0;i<r-1;i++){var a=t.get(o,i)+t.get(o,i+1)+t.get(o+1,i)+t.get(o+1,i+1);4!==a&&0!==a||e++}return e*n},r.getPenaltyN3=function(t){for(var r=t.size,e=0,n=0,i=0,a=0;a<r;a++){n=i=0;for(var u=0;u<r;u++)n=n<<1&2047|t.get(a,u),u>=10&&(1488===n||93===n)&&e++,i=i<<1&2047|t.get(u,a),u>=10&&(1488===i||93===i)&&e++}return e*o},r.getPenaltyN4=function(t){for(var r=0,e=t.data.length,n=0;n<e;n++)r+=t.data[n];return Math.abs(Math.ceil(100*r/e/5)-10)*i},r.applyMask=function(t,r){for(var e=r.size,n=0;n<e;n++)for(var o=0;o<e;o++)r.isReserved(o,n)||r.xor(o,n,a(t,o,n))},r.getBestMask=function(t,e){for(var n=Object.keys(r.Patterns).length,o=0,i=1/0,a=0;a<n;a++){e(a),r.applyMask(a,t);var u=r.getPenaltyN1(t)+r.getPenaltyN2(t)+r.getPenaltyN3(t)+r.getPenaltyN4(t);r.applyMask(a,t),u<i&&(i=u,o=a)}return o}})),Be=(Pe.Patterns,Pe.isValid,Pe.getPenaltyN1,Pe.getPenaltyN2,Pe.getPenaltyN3,Pe.getPenaltyN4,Pe.applyMask,Pe.getBestMask,Nr.Buffer);function Ie(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}Ie.prototype.initialize=function(t){this.degree=t,this.genPoly=Nt.generateECPolynomial(this.degree)},Ie.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");var r=dt.alloc(this.degree),e=Be.concat([t,r],t.length+this.degree),n=Nt.mod(e,this.genPoly),o=this.degree-n.length;if(o>0){var i=dt.alloc(this.degree);return n.copy(i,o),i}return n};var Ce=Ie,_e=ct((function(t,r){var e=yt(7973);function n(t,r){return $r.getCharCountIndicator(t,r)+4}function o(t,r){var e=0;return t.forEach((function(t){var o=n(t.mode,r);e+=o+t.getBitsLength()})),e}r.from=function(t,r){return Sr(t)?parseInt(t,10):r},r.getCapacity=function(t,r,e){if(!Sr(t))throw new Error("Invalid QR Code version");void 0===e&&(e=$r.BYTE);var o=8*(wt(t)-Xr(t,r));if(e===$r.MIXED)return o;var i=o-n(e,t);switch(e){case $r.NUMERIC:return Math.floor(i/10*3);case $r.ALPHANUMERIC:return Math.floor(i/11*2);case $r.KANJI:return Math.floor(i/13);case $r.BYTE:default:return Math.floor(i/8)}},r.getBestVersionForData=function(t,e){var n,i=Tt.from(e,Tt.M);if(te(t)){if(t.length>1)return function(t,e){for(var n=1;n<=40;n++)if(o(t,n)<=r.getCapacity(n,e,$r.MIXED))return n}(t,i);if(0===t.length)return 1;n=t[0]}else n=t;return function(t,e,n){for(var o=1;o<=40;o++)if(e<=r.getCapacity(o,n,t))return o}(n.mode,n.getLength(),i)},r.getEncodedBits=function(t){if(!Sr(t)||t<7)throw new Error("Invalid QR Code version");for(var r=t<<12;yt(r)-e>=0;)r^=7973<<yt(r)-e;return t<<12|r}})),Me=(_e.getCapacity,_e.getBestVersionForData,_e.getEncodedBits,yt(1335)),Ue=function(t,r){for(var e=t.bit<<3|r,n=e<<10;yt(n)-Me>=0;)n^=1335<<yt(n)-Me;return 21522^(e<<10|n)},Ne=ct((function(t,r){function e(t){return unescape(encodeURIComponent(t)).length}function n(t,r,e){for(var n,o=[];null!==(n=t.exec(e));)o.push({data:n[0],index:n.index,mode:r,length:n[0].length});return o}function o(t){var r,e,o=n(Jr.NUMERIC,$r.NUMERIC,t),i=n(Jr.ALPHANUMERIC,$r.ALPHANUMERIC,t);return Et()?(r=n(Jr.BYTE,$r.BYTE,t),e=n(Jr.KANJI,$r.KANJI,t)):(r=n(Jr.BYTE_KANJI,$r.BYTE,t),e=[]),o.concat(i,r,e).sort((function(t,r){return t.index-r.index})).map((function(t){return{data:t.data,mode:t.mode,length:t.length}}))}function i(t,r){switch(r){case $r.NUMERIC:return se.getBitsLength(t);case $r.ALPHANUMERIC:return ce.getBitsLength(t);case $r.KANJI:return pe.getBitsLength(t);case $r.BYTE:return ge.getBitsLength(t)}}function a(t,r){var e,n=$r.getBestModeForData(t);if((e=$r.from(r,n))!==$r.BYTE&&e.bit<n.bit)throw new Error('"'+t+'" cannot be encoded with mode '+$r.toString(e)+".\n Suggested mode is: "+$r.toString(n));switch(e!==$r.KANJI||Et()||(e=$r.BYTE),e){case $r.NUMERIC:return new se(t);case $r.ALPHANUMERIC:return new ce(t);case $r.KANJI:return new pe(t);case $r.BYTE:return new ge(t)}}r.fromArray=function(t){return t.reduce((function(t,r){return"string"==typeof r?t.push(a(r,null)):r.data&&t.push(a(r.data,r.mode)),t}),[])},r.fromString=function(t,n){for(var a=function(t,r){for(var e={},n={start:{}},o=["start"],a=0;a<t.length;a++){for(var u=t[a],s=[],f=0;f<u.length;f++){var h=u[f],c=""+a+f;s.push(c),e[c]={node:h,lastCount:0},n[c]={};for(var l=0;l<o.length;l++){var g=o[l];e[g]&&e[g].node.mode===h.mode?(n[g][c]=i(e[g].lastCount+h.length,h.mode)-i(e[g].lastCount,h.mode),e[g].lastCount+=h.length):(e[g]&&(e[g].lastCount=h.length),n[g][c]=i(h.length,h.mode)+4+$r.getCharCountIndicator(h.mode,r))}}o=s}for(l=0;l<o.length;l++)n[o[l]].end=0;return{map:n,table:e}}(function(t){for(var r=[],n=0;n<t.length;n++){var o=t[n];switch(o.mode){case $r.NUMERIC:r.push([o,{data:o.data,mode:$r.ALPHANUMERIC,length:o.length},{data:o.data,mode:$r.BYTE,length:o.length}]);break;case $r.ALPHANUMERIC:r.push([o,{data:o.data,mode:$r.BYTE,length:o.length}]);break;case $r.KANJI:r.push([o,{data:o.data,mode:$r.BYTE,length:e(o.data)}]);break;case $r.BYTE:r.push([{data:o.data,mode:$r.BYTE,length:e(o.data)}])}}return r}(o(t,Et())),n),u=ve.find_path(a.map,"start","end"),s=[],f=1;f<u.length-1;f++)s.push(a.table[u[f]].node);return r.fromArray(function(t){return t.reduce((function(t,r){var e=t.length-1>=0?t[t.length-1]:null;return e&&e.mode===r.mode?(t[t.length-1].data+=r.data,t):(t.push(r),t)}),[])}(s))},r.rawSplit=function(t){return r.fromArray(o(t,Et()))}})),Le=(Ne.fromArray,Ne.fromString,Ne.rawSplit,require("fs")),Se=require("pngjs").PNG,xe=require("./utils");exports.render=function(t,r){var e=xe.getOptions(r),n=e.rendererOpts,o=xe.getImageWidth(t.modules.size,e);n.width=o,n.height=o;var i=new Se(n);return xe.qrToImageData(i.data,t,e),i},exports.renderToDataURL=function(t,r,e){void 0===e&&(e=r,r=void 0),exports.renderToBuffer(t,r,(function(t,r){t&&e(t);var n="data:image/png;base64,";n+=r.toString("base64"),e(null,n)}))},exports.renderToBuffer=function(t,r,e){void 0===e&&(e=r,r=void 0);var n=exports.render(t,r),o=[];n.on("error",e),n.on("data",(function(t){o.push(t)})),n.on("end",(function(){e(null,w.concat(o))})),n.pack()},exports.renderToFile=function(t,r,e,n){void 0===n&&(n=e,e=void 0);var o=Le.createWriteStream(t);o.on("error",n),o.on("close",n),exports.renderToFileStream(o,r,e)},exports.renderToFileStream=function(t,r,e){exports.render(r,e).pack().pipe(t)};var Ye=ct((function(t,r){function e(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw new Error("Color should be defined as hex string");var r=t.slice().replace("#","").split("");if(r.length<3||5===r.length||r.length>8)throw new Error("Invalid hex color: "+t);3!==r.length&&4!==r.length||(r=Array.prototype.concat.apply([],r.map((function(t){return[t,t]})))),6===r.length&&r.push("F","F");var e=parseInt(r.join(""),16);return{r:e>>24&255,g:e>>16&255,b:e>>8&255,a:255&e,hex:"#"+r.slice(0,6).join("")}}r.getOptions=function(t){t||(t={}),t.color||(t.color={});var r=void 0===t.margin||null===t.margin||t.margin<0?4:t.margin,n=t.width&&t.width>=21?t.width:void 0,o=t.scale||4;return{width:n,scale:n?4:o,margin:r,color:{dark:e(t.color.dark||"#000000ff"),light:e(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},r.getScale=function(t,r){return r.width&&r.width>=t+2*r.margin?r.width/(t+2*r.margin):r.scale},r.getImageWidth=function(t,e){var n=r.getScale(t,e);return Math.floor((t+2*e.margin)*n)},r.qrToImageData=function(t,e,n){for(var o=e.modules.size,i=e.modules.data,a=r.getScale(o,n),u=Math.floor((o+2*n.margin)*a),s=n.margin*a,f=[n.color.light,n.color.dark],h=0;h<u;h++)for(var c=0;c<u;c++){var l=4*(h*u+c),g=n.color.light;if(h>=s&&c>=s&&h<u-s&&c<u-s)g=f[i[Math.floor((h-s)/a)*o+Math.floor((c-s)/a)]?1:0];t[l++]=g.r,t[l++]=g.g,t[l++]=g.b,t[l]=g.a}}})),De=(Ye.getOptions,Ye.getScale,Ye.getImageWidth,Ye.qrToImageData,ct((function(t,r){function e(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw new Error("Color should be defined as hex string");var r=t.slice().replace("#","").split("");if(r.length<3||5===r.length||r.length>8)throw new Error("Invalid hex color: "+t);3!==r.length&&4!==r.length||(r=Array.prototype.concat.apply([],r.map((function(t){return[t,t]})))),6===r.length&&r.push("F","F");var e=parseInt(r.join(""),16);return{r:e>>24&255,g:e>>16&255,b:e>>8&255,a:255&e,hex:"#"+r.slice(0,6).join("")}}r.getOptions=function(t){t||(t={}),t.color||(t.color={});var r=void 0===t.margin||null===t.margin||t.margin<0?4:t.margin,n=t.width&&t.width>=21?t.width:void 0,o=t.scale||4;return{width:n,scale:n?4:o,margin:r,color:{dark:e(t.color.dark||"#000000ff"),light:e(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},r.getScale=function(t,r){return r.width&&r.width>=t+2*r.margin?r.width/(t+2*r.margin):r.scale},r.getImageWidth=function(t,e){var n=r.getScale(t,e);return Math.floor((t+2*e.margin)*n)},r.qrToImageData=function(t,e,n){for(var o=e.modules.size,i=e.modules.data,a=r.getScale(o,n),u=Math.floor((o+2*n.margin)*a),s=n.margin*a,f=[n.color.light,n.color.dark],h=0;h<u;h++)for(var c=0;c<u;c++){var l=4*(h*u+c),g=n.color.light;if(h>=s&&c>=s&&h<u-s&&c<u-s)g=f[i[Math.floor((h-s)/a)*o+Math.floor((c-s)/a)]?1:0];t[l++]=g.r,t[l++]=g.g,t[l++]=g.b,t[l]=g.a}}}))),Oe=(De.getOptions,De.getScale,De.getImageWidth,De.qrToImageData,{}),ke=ct((function(t,r){var e={WW:" ",WB:"▄",BB:"█",BW:"▀"},n={BB:" ",BW:"▄",WW:"█",WB:"▀"};function o(t,r,e){return t&&r?e.BB:t&&!r?e.BW:!t&&r?e.WB:e.WW}r.render=function(t,r,i){var a=De.getOptions(r),u=e;"#ffffff"!==a.color.dark.hex&&"#000000"!==a.color.light.hex||(u=n);var s=t.modules.size,f=t.modules.data,h="",c=Array(s+2*a.margin+1).join(u.WW);c=Array(a.margin/2+1).join(c+"\n");var l=Array(a.margin+1).join(u.WW);h+=c;for(var g=0;g<s;g+=2){h+=l;for(var d=0;d<s;d++){h+=o(f[g*s+d],f[(g+1)*s+d],u)}h+=l+"\n"}return h+=c.slice(0,-1),"function"==typeof i&&i(null,h),h},r.renderToFile=function(t,e,n,o){void 0===o&&(o=n,n=void 0);var i=Oe,a=r.render(e,n);i.writeFile(t,a,o)}}));ke.render,ke.renderToFile;function Fe(t,r){var e=t.a/255,n=r+'="'+t.hex+'"';return e<1?n+" "+r+'-opacity="'+e.toFixed(2).slice(1)+'"':n}function ze(t,r,e){var n=t+r;return void 0!==e&&(n+=" "+e),n}var We=function(t,r,e){var n=De.getOptions(r),o=t.modules.size,i=t.modules.data,a=o+2*n.margin,u=n.color.light.a?"<path "+Fe(n.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",s="<path "+Fe(n.color.dark,"stroke")+' d="'+function(t,r,e){for(var n="",o=0,i=!1,a=0,u=0;u<t.length;u++){var s=Math.floor(u%r),f=Math.floor(u/r);s||i||(i=!0),t[u]?(a++,u>0&&s>0&&t[u-1]||(n+=i?ze("M",s+e,.5+f+e):ze("m",o,0),o=0,i=!1),s+1<r&&t[u+1]||(n+=ze("h",a),a=0)):o++}return n}(i,o,n.margin)+'"/>',f='viewBox="0 0 '+a+" "+a+'"',h='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+f+' shape-rendering="crispEdges">'+u+s+"</svg>\n";return"function"==typeof e&&e(null,h),h},je=ct((function(t,r){r.render=We,r.renderToFile=function(t,e,n,o){void 0===o&&(o=n,n=void 0);var i=Oe,a='<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'+r.render(e,n);i.writeFile(t,a,o)}})),qe=(je.render,je.renderToFile,ct((function(t,r){r.render=function(t,r,e){var n=e,o=r;void 0!==n||r&&r.getContext||(n=r,r=void 0),r||(o=function(){try{return document.createElement("canvas")}catch(t){throw new Error("You need to specify a canvas element")}}()),n=De.getOptions(n);var i=De.getImageWidth(t.modules.size,n),a=o.getContext("2d"),u=a.createImageData(i,i);return De.qrToImageData(u.data,t,n),function(t,r,e){t.clearRect(0,0,r.width,r.height),r.style||(r.style={}),r.height=e,r.width=e,r.style.height=e+"px",r.style.width=e+"px"}(a,o,i),a.putImageData(u,0,0),o},r.renderToDataURL=function(t,e,n){var o=n;void 0!==o||e&&e.getContext||(o=e,e=void 0),o||(o={});var i=r.render(t,e,o),a=o.type||"image/png",u=o.rendererOpts||{};return i.toDataURL(a,u.quality)}}))),He=(qe.render,qe.renderToDataURL,function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then});function Je(t,r,e){var n,o,i=t.size,a=Ue(r,e);for(n=0;n<15;n++)o=1==(a>>n&1),n<6?t.set(n,8,o,!0):n<8?t.set(n+1,8,o,!0):t.set(i-15+n,8,o,!0),n<8?t.set(8,i-n-1,o,!0):n<9?t.set(8,15-n-1+1,o,!0):t.set(8,15-n-1,o,!0);t.set(i-8,8,1,!0)}function Ke(t,r,e){for(var n=wt(r),o=n-Xr(r,e),i=Gr(r,e),a=i-n%i,u=Math.floor(n/i),s=Math.floor(o/i),f=s+1,h=u-s,c=new Ce(h),l=0,g=new Array(i),d=new Array(i),p=0,v=dt.from(t.buffer),w=0;w<i;w++){var y=w<a?s:f;g[w]=v.slice(l,l+y),d[w]=c.encode(g[w]),l+=y,p=Math.max(p,y)}var m,E,A=dt.alloc(n),b=0;for(m=0;m<p;m++)for(E=0;E<i;E++)m<g[E].length&&(A[b++]=g[E][m]);for(m=0;m<h;m++)for(E=0;E<i;E++)A[b++]=d[E][m];return A}function Ve(t,r,e,n){var o;if(te(t))o=Ne.fromArray(t);else{if("string"!=typeof t)throw new Error("Invalid data");var i=r;if(!i){var a=Ne.rawSplit(t);i=_e.getBestVersionForData(a,e)}o=Ne.fromString(t,i||40)}var u=_e.getBestVersionForData(o,e);if(!u)throw new Error("The amount of data is too big to be stored in a QR Code");if(r){if(r<u)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+u+".\n")}else r=u;var s=function(t,r,e){var n=new me;e.forEach((function(r){n.put(r.mode.bit,4),n.put(r.getLength(),$r.getCharCountIndicator(r.mode,t)),r.write(n)}));var o=8*(wt(t)-Xr(t,r));for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(0);for(var i=(o-n.getLengthInBits())/8,a=0;a<i;a++)n.put(a%2?17:236,8);return Ke(n,t,r)}(r,e,o),f=vt(r),h=new Ae(f);return function(t,r){for(var e=t.size,n=Te(r),o=0;o<n.length;o++)for(var i=n[o][0],a=n[o][1],u=-1;u<=7;u++)if(!(i+u<=-1||e<=i+u))for(var s=-1;s<=7;s++)a+s<=-1||e<=a+s||(u>=0&&u<=6&&(0===s||6===s)||s>=0&&s<=6&&(0===u||6===u)||u>=2&&u<=4&&s>=2&&s<=4?t.set(i+u,a+s,!0,!0):t.set(i+u,a+s,!1,!0))}(h,r),function(t){for(var r=t.size,e=8;e<r-8;e++){var n=e%2==0;t.set(e,6,n,!0),t.set(6,e,n,!0)}}(h),function(t,r){for(var e=be.getPositions(r),n=0;n<e.length;n++)for(var o=e[n][0],i=e[n][1],a=-2;a<=2;a++)for(var u=-2;u<=2;u++)-2===a||2===a||-2===u||2===u||0===a&&0===u?t.set(o+a,i+u,!0,!0):t.set(o+a,i+u,!1,!0)}(h,r),Je(h,e,0),r>=7&&function(t,r){for(var e,n,o,i=t.size,a=_e.getEncodedBits(r),u=0;u<18;u++)e=Math.floor(u/3),n=u%3+i-8-3,o=1==(a>>u&1),t.set(e,n,o,!0),t.set(n,e,o,!0)}(h,r),function(t,r){for(var e=t.size,n=-1,o=e-1,i=7,a=0,u=e-1;u>0;u-=2)for(6===u&&u--;;){for(var s=0;s<2;s++)if(!t.isReserved(o,u-s)){var f=!1;a<r.length&&(f=1==(r[a]>>>i&1)),t.set(o,u-s,f),-1==--i&&(a++,i=7)}if((o+=n)<0||e<=o){o-=n,n=-n;break}}}(h,s),isNaN(n)&&(n=Pe.getBestMask(h,Je.bind(null,h,e))),Pe.applyMask(n,h),Je(h,e,n),{modules:h,version:r,errorCorrectionLevel:e,maskPattern:n,segments:o}}var Qe=function(t,r){if(void 0===t||""===t)throw new Error("No input text");var e,n,o=Tt.M;return void 0!==r&&(o=Tt.from(r.errorCorrectionLevel,Tt.M),e=_e.from(r.version),n=Pe.from(r.maskPattern),r.toSJISFunc&&mt(r.toSJISFunc)),Ve(t,e,o,n)},Ge=ct((function(t,r){r.render=function(t,r,e){var n=e,o=r;void 0!==n||r&&r.getContext||(n=r,r=void 0),r||(o=function(){try{return document.createElement("canvas")}catch(t){throw new Error("You need to specify a canvas element")}}()),n=De.getOptions(n);var i=De.getImageWidth(t.modules.size,n),a=o.getContext("2d"),u=a.createImageData(i,i);return De.qrToImageData(u.data,t,n),function(t,r,e){t.clearRect(0,0,r.width,r.height),r.style||(r.style={}),r.height=e,r.width=e,r.style.height=e+"px",r.style.width=e+"px"}(a,o,i),a.putImageData(u,0,0),o},r.renderToDataURL=function(t,e,n){var o=n;void 0!==o||e&&e.getContext||(o=e,e=void 0),o||(o={});var i=r.render(t,e,o),a=o.type||"image/png",u=o.rendererOpts||{};return i.toDataURL(a,u.quality)}}));Ge.render,Ge.renderToDataURL;function Xe(t,r,e,n,o){var i=[].slice.call(arguments,1),a=i.length,u="function"==typeof i[a-1];if(!u&&!He())throw new Error("Callback required as last argument");if(!u){if(a<1)throw new Error("Too few arguments provided");return 1===a?(e=r,r=n=void 0):2!==a||r.getContext||(n=e,e=r,r=void 0),new Promise((function(o,i){try{var a=Qe(e,n);o(t(a,r,n))}catch(t){i(t)}}))}if(a<2)throw new Error("Too few arguments provided");2===a?(o=e,e=r,r=n=void 0):3===a&&(r.getContext&&void 0===o?(o=n,n=void 0):(o=n,n=e,e=r,r=void 0));try{var s=Qe(e,n);o(null,t(s,r,n))}catch(t){o(t)}}Xe.bind(null,Ge.render),Xe.bind(null,Ge.renderToDataURL),Xe.bind(null,(function(t,r,e){return We(t,e)}));var $e=require("fs"),Ze=require("pngjs").PNG,tn=require("./utils");exports.render=function(t,r){var e=tn.getOptions(r),n=e.rendererOpts,o=tn.getImageWidth(t.modules.size,e);n.width=o,n.height=o;var i=new Ze(n);return tn.qrToImageData(i.data,t,e),i},exports.renderToDataURL=function(t,r,e){void 0===e&&(e=r,r=void 0),exports.renderToBuffer(t,r,(function(t,r){t&&e(t);var n="data:image/png;base64,";n+=r.toString("base64"),e(null,n)}))},exports.renderToBuffer=function(t,r,e){void 0===e&&(e=r,r=void 0);var n=exports.render(t,r),o=[];n.on("error",e),n.on("data",(function(t){o.push(t)})),n.on("end",(function(){e(null,w.concat(o))})),n.pack()},exports.renderToFile=function(t,r,e,n){void 0===n&&(n=e,e=void 0);var o=$e.createWriteStream(t);o.on("error",n),o.on("close",n),exports.renderToFileStream(o,r,e)},exports.renderToFileStream=function(t,r,e){exports.render(r,e).pack().pipe(t)};var rn=Object.freeze({__proto__:null}),en=ct((function(t,r){var e={WW:" ",WB:"▄",BB:"█",BW:"▀"},n={BB:" ",BW:"▄",WW:"█",WB:"▀"};function o(t,r,e){return t&&r?e.BB:t&&!r?e.BW:!t&&r?e.WB:e.WW}r.render=function(t,r,i){var a=De.getOptions(r),u=e;"#ffffff"!==a.color.dark.hex&&"#000000"!==a.color.light.hex||(u=n);var s=t.modules.size,f=t.modules.data,h="",c=Array(s+2*a.margin+1).join(u.WW);c=Array(a.margin/2+1).join(c+"\n");var l=Array(a.margin+1).join(u.WW);h+=c;for(var g=0;g<s;g+=2){h+=l;for(var d=0;d<s;d++){h+=o(f[g*s+d],f[(g+1)*s+d],u)}h+=l+"\n"}return h+=c.slice(0,-1),"function"==typeof i&&i(null,h),h},r.renderToFile=function(t,e,n,o){void 0===o&&(o=n,n=void 0);var i=Oe,a=r.render(e,n);i.writeFile(t,a,o)}})),nn=(en.render,en.renderToFile,{render:function(t,r,e){var n=t.modules.size,o=t.modules.data,i="[47m  [0m",a="",u=Array(n+3).join(i),s=Array(2).join(i);a+=u+"\n";for(var f=0;f<n;++f){a+=i;for(var h=0;h<n;h++)a+=o[f*n+h]?"[40m  [0m":i;a+=s+"\n"}return a+=u+"\n","function"==typeof e&&e(null,a),a}}),on=ct((function(t,r){r.render=We,r.renderToFile=function(t,e,n,o){void 0===o&&(o=n,n=void 0);var i=Oe,a='<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'+r.render(e,n);i.writeFile(t,a,o)}}));on.render,on.renderToFile;function an(t,r,e,n,o){var i=[].slice.call(arguments,1),a=i.length,u="function"==typeof i[a-1];if(!u&&!He())throw new Error("Callback required as last argument");if(!u){if(a<1)throw new Error("Too few arguments provided");return 1===a?(e=r,r=n=void 0):2!==a||r.getContext||(n=e,e=r,r=void 0),new Promise((function(o,i){try{var a=Qe(e,n);o(t(a,r,n))}catch(t){i(t)}}))}if(a<2)throw new Error("Too few arguments provided");2===a?(o=e,e=r,r=n=void 0):3===a&&(r.getContext&&void 0===o?(o=n,n=void 0):(o=n,n=e,e=r,r=void 0));try{var s=Qe(e,n);o(null,t(s,r,n))}catch(t){o(t)}}var un=Qe,sn=an.bind(null,Ge.render),fn=an.bind(null,Ge.renderToDataURL),hn=an.bind(null,(function(t,r,e){return We(t,e)}));function cn(t,r,e){if(void 0===t)throw new Error("String required as first argument");if(void 0===e&&(e=r,r={}),"function"!=typeof e){if(!He())throw new Error("Callback required as last argument");r=e||{},e=null}return{opts:r,cb:e}}function ln(t){return t.slice(2+(t.lastIndexOf(".")-1>>>0)).toLowerCase()}function gn(t){switch(t){case"svg":return on;case"txt":case"utf8":return en;case"png":case"image/png":default:return rn}}function dn(t,r,e){if(!e.cb)return new Promise((function(n,o){try{var i=Qe(r,e.opts);return t(i,e.opts,(function(t,r){return t?o(t):n(r)}))}catch(t){o(t)}}));try{var n=Qe(r,e.opts);return t(n,e.opts,e.cb)}catch(t){e.cb(t)}}var pn,vn=(pn={create:Qe,toCanvas:{create:un,toCanvas:sn,toDataURL:fn,toString:hn}.toCanvas,toString:function(t,r,e){var n=cn(t,r,e);return dn(function(t){switch(t){case"svg":return on;case"terminal":return nn;case"utf8":default:return en}}(n.opts.type).render,t,n)},toDataURL:function(t,r,e){var n=cn(t,r,e);return dn(gn(n.opts.type).renderToDataURL,t,n)},toBuffer:function(t,r,e){var n=cn(t,r,e);return dn(gn(n.opts.type).renderToBuffer,t,n)},toFile:function(t,r,e,n){if("string"!=typeof t||"string"!=typeof r&&"object"!=typeof r)throw new Error("Invalid argument");if(arguments.length<3&&!He())throw new Error("Too few arguments provided");var o=cn(r,e,n),i=o.opts.type||ln(t),a=gn(i),u=a.renderToFile.bind(null,t);return dn(u,r,o)},toFileStream:function(t,r,e){if(arguments.length<2)throw new Error("Too few arguments provided");var n=cn(r,e,t.emit.bind(t,"error")),o=gn("png"),i=o.renderToFileStream.bind(null,t);dn(i,r,n)}}.toCanvas,function(){var t=Array.prototype.slice.call(arguments);return new Promise((function(r,e){t.push((function(t,n){t?e(t):r(n)})),pn.apply(null,t)}))}),wn=function(t,r){var e=document.createElement("canvas");return vn(e,t,r).then((function(){return e.width}))},yn=function(t){return t.length>36?"M":t.length>16?"Q":"H"},mn=function(t){var r=t.canvas,n=t.logo;if(!n)return Promise.resolve();if(""===n)return Promise.resolve();var o=r.width;e(n)&&(n={src:n});var i=n,a=i.logoSize,u=void 0===a?.15:a,s=i.borderColor,f=void 0===s?"#ffffff":s,h=i.bgColor,c=void 0===h?f||"#ffffff":h,l=i.borderSize,g=void 0===l?.05:l,d=i.crossOrigin,p=i.borderRadius,v=void 0===p?8:p,w=i.logoRadius,y=void 0===w?0:w,m="string"==typeof n?n:n.src,E=o*u,A=o*(1-u)/2,b=o*(u+g),R=o*(1-u-g)/2,T=r.getContext("2d");En(T)(R,R,b,b,v),T.fillStyle=c,T.fill();var P=new Image;P.setAttribute("crossOrigin",d||"anonymous"),P.src=m;return new Promise((function(t){P.onload=function(){y?function(t){var r=document.createElement("canvas");r.width=A+E,r.height=A+E,r.getContext("2d").drawImage(t,A,A,E,E),En(T)(A,A,E,E,y),T.fillStyle=T.createPattern(r,"no-repeat"),T.fill()}(P):function(t){T.drawImage(t,A,A,E,E)}(P),t()}}))},En=function(t){return function(r,e,n,o,i){var a=Math.min(n,o);return i>a/2&&(i=a/2),t.beginPath(),t.moveTo(r+i,e),t.arcTo(r+n,e,r+n,e+o,i),t.arcTo(r+n,e+o,r,e+o,i),t.arcTo(r,e+o,r,e,i),t.arcTo(r,e,r+n,e,i),t.closePath(),t}},An=function(t){return function(t){var r=t.canvas,e=t.content,n=t.width,o=void 0===n?0:n,i=t.nodeQrCodeOptions,a=void 0===i?{}:i;return a.errorCorrectionLevel=a.errorCorrectionLevel||yn(e),wn(e,a).then((function(t){return a.scale=0===o?void 0:o/t*4,vn(r,e,a)}))}(t).then((function(){return mn(t)}))},bn=function(n){return t(this,void 0,void 0,(function(){var t,o,i,a,u,s,f;return r(this,(function(r){switch(r.label){case 0:return t=n.canvas,n.logo&&(e(n.logo)&&(n.logo={src:n.logo}),n.logo.crossOrigin="Anonymous"),this.ifCanvasDrawed?[3,2]:[4,An(n)];case 1:r.sent(),r.label=2;case 2:if(o=n.image,i=void 0===o?new Image:o,a=n.downloadName,u=void 0===a?"qr-code":a,s=n.download,!t.toDataURL())throw new Error("Can not get the canvas DataURL");return i.src=t.toDataURL(),this.ifImageCreated=!0,!0!==s&&"function"!=typeof s?[2]:(f=function(){Rn(i,u)},(s=!0===s?function(t){return t()}:s)&&s(f),[2,Promise.resolve()])}}))}))},Rn=function(t,r){var e=t.src,n=document.createElement("a");n.download=r,n.href=e,n.dispatchEvent(new MouseEvent("click"))},Tn=require("../package.json").version;return function(){function e(t){this.ifCanvasDrawed=!1,this.ifImageCreated=!1,this.defaultOption={canvas:document.createElement("canvas"),image:new Image,content:""},this.option=Object.assign(this.defaultOption,t)}return e.prototype.toCanvas=function(){var t=this;return An.call(this,this.option).then((function(){return t.ifCanvasDrawed=!0,Promise.resolve()}))},e.prototype.toImage=function(){return bn.call(this,this.option)},e.prototype.downloadImage=function(e){return t(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return this.ifImageCreated?[3,2]:[4,this.toImage()];case 1:t.sent(),t.label=2;case 2:return Rn(this.option.image,e),[2]}}))}))},e.prototype.getCanvas=function(){return t(this,void 0,Promise,(function(){return r(this,(function(t){switch(t.label){case 0:return this.ifCanvasDrawed?[3,2]:[4,this.toCanvas()];case 1:t.sent(),t.label=2;case 2:return[2,this.option.canvas]}}))}))},e.version=Tn,e}()}));
  