cnf-qrcode
Version:
generate qrcode,support svg base64 utf8
1 lines • 155 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t=t||self,function(){var r=t.cnfQrcode,n=t.cnfQrcode={};e(n),n.noConflict=function(){return t.cnfQrcode=r,n}}())}(this,function(t){"use strict";var e={}.toString,r=Array.isArray||function(t){return"[object Array]"==e.call(t)},n="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},i=[],a=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s=!1;function h(){s=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)i[e]=t[e],a[t.charCodeAt(e)]=e;a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63}function f(t,e,r){for(var n,a,o=[],s=e;s<r;s+=3)n=(t[s]<<16)+(t[s+1]<<8)+t[s+2],o.push(i[(a=n)>>18&63]+i[a>>12&63]+i[a>>6&63]+i[63&a]);return o.join("")}function u(t){var e;s||h();for(var r=t.length,n=r%3,a="",o=[],u=0,l=r-n;u<l;u+=16383)o.push(f(t,u,u+16383>l?l:u+16383));return 1===n?(e=t[r-1],a+=i[e>>2],a+=i[e<<4&63],a+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],a+=i[e>>10],a+=i[e>>4&63],a+=i[e<<2&63],a+="="),o.push(a),o.join("")}function l(t,e,r,n,i){var a,o,s=8*i-n-1,h=(1<<s)-1,f=h>>1,u=-7,l=r?i-1:0,c=r?-1:1,d=t[e+l];for(l+=c,a=d&(1<<-u)-1,d>>=-u,u+=s;u>0;a=256*a+t[e+l],l+=c,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=256*o+t[e+l],l+=c,u-=8);if(0===a)a=1-f;else{if(a===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),a-=f}return(d?-1:1)*o*Math.pow(2,a-n)}function c(t,e,r,n,i,a){var o,s,h,f=8*a-i-1,u=(1<<f)-1,l=u>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=n?1:-1,_=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),(e+=o+l>=1?c/h:c*Math.pow(2,1-l))*h>=2&&(o++,h/=2),o+l>=u?(s=0,o=u):o+l>=1?(s=(e*h-1)*Math.pow(2,i),o+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),o=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(o=o<<i|s,f+=i;f>0;t[r+d]=255&o,d+=p,o/=256,f-=8);t[r+d-p]|=128*_}var d={}.toString,p=Array.isArray||function(t){return"[object Array]"==d.call(t)};v.TYPED_ARRAY_SUPPORT=void 0===n.TYPED_ARRAY_SUPPORT||n.TYPED_ARRAY_SUPPORT;var _=g();function g(){return v.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function w(t,e){if(g()<e)throw new RangeError("Invalid typed array length");return v.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=v.prototype:(null===t&&(t=new v(e)),t.length=e),t}function v(t,e,r){if(!(v.TYPED_ARRAY_SUPPORT||this instanceof v))return new v(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return y(this,t)}return b(this,t,e,r)}function b(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);v.TYPED_ARRAY_SUPPORT?(t=e).__proto__=v.prototype:t=E(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!v.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|T(e,r),i=(t=w(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(R(e)){var r=0|k(e.length);return 0===(t=w(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?w(t,0):E(t,e);if("Buffer"===e.type&&p(e.data))return E(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}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 y(t,e){if(m(e),t=w(t,e<0?0:0|k(e)),!v.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function E(t,e){var r=e.length<0?0:0|k(e.length);t=w(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function k(t){if(t>=g())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+g().toString(16)+" bytes");return 0|t}function R(t){return!(null==t||!t._isBuffer)}function T(t,e){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 r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return J(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(t).length;default:if(n)return J(t).length;e=(""+e).toLowerCase(),n=!0}}function L(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return Y(this,e,r);case"utf8":case"utf-8":return D(this,e,r);case"ascii":return U(this,e,r);case"latin1":case"binary":return F(this,e,r);case"base64":return B(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Z(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function A(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function x(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=v.from(e,n)),R(e))return 0===e.length?-1:S(t,e,r,n,i);if("number"==typeof e)return e&=255,v.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):S(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function S(t,e,r,n,i){var a,o=1,s=t.length,h=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,h/=2,r/=2}function f(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var u=-1;for(a=r;a<s;a++)if(f(t,a)===f(e,-1===u?0:a-u)){if(-1===u&&(u=a),a-u+1===h)return u*o}else-1!==u&&(a-=a-u),u=-1}else for(r+h>s&&(r=s-h),a=r;a>=0;a--){for(var l=!0,c=0;c<h;c++)if(f(t,a+c)!==f(e,c)){l=!1;break}if(l)return a}return-1}function O(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=e.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s=parseInt(e.substr(2*o,2),16);if(isNaN(s))return o;t[r+o]=s}return o}function C(t,e,r,n){return tt(J(e,t.length-r),t,r,n)}function I(t,e,r,n){return tt(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function P(t,e,r,n){return I(t,e,r,n)}function M(t,e,r,n){return tt(Q(e),t,r,n)}function z(t,e,r,n){return tt(function(t,e){for(var r,n,i,a=[],o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),n=r>>8,i=r%256,a.push(i),a.push(n);return a}(e,t.length-r),t,r,n)}function B(t,e,r){return 0===e&&r===t.length?u(t):u(t.slice(e,r))}function D(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var a,o,s,h,f=t[i],u=null,l=f>239?4:f>223?3:f>191?2:1;if(i+l<=r)switch(l){case 1:f<128&&(u=f);break;case 2:128==(192&(a=t[i+1]))&&(h=(31&f)<<6|63&a)>127&&(u=h);break;case 3:a=t[i+1],o=t[i+2],128==(192&a)&&128==(192&o)&&(h=(15&f)<<12|(63&a)<<6|63&o)>2047&&(h<55296||h>57343)&&(u=h);break;case 4:a=t[i+1],o=t[i+2],s=t[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(h=(15&f)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&h<1114112&&(u=h)}null===u?(u=65533,l=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=l}return function(t){var e=t.length;if(e<=N)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=N));return r}(n)}v.poolSize=8192,v._augment=function(t){return t.__proto__=v.prototype,t},v.from=function(t,e,r){return b(null,t,e,r)},v.TYPED_ARRAY_SUPPORT&&(v.prototype.__proto__=Uint8Array.prototype,v.__proto__=Uint8Array),v.alloc=function(t,e,r){return function(t,e,r,n){return m(e),e<=0?w(t,e):void 0!==r?"string"==typeof n?w(t,e).fill(r,n):w(t,e).fill(r):w(t,e)}(null,t,e,r)},v.allocUnsafe=function(t){return y(null,t)},v.allocUnsafeSlow=function(t){return y(null,t)},v.isBuffer=et,v.compare=function(t,e){if(!R(t)||!R(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i<a;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},v.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}},v.concat=function(t,e){if(!p(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return v.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=v.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var a=t[r];if(!R(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},v.byteLength=T,v.prototype._isBuffer=!0,v.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 e=0;e<t;e+=2)A(this,e,e+1);return this},v.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 e=0;e<t;e+=4)A(this,e,e+3),A(this,e+1,e+2);return this},v.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 e=0;e<t;e+=8)A(this,e,e+7),A(this,e+1,e+6),A(this,e+2,e+5),A(this,e+3,e+4);return this},v.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?D(this,0,t):L.apply(this,arguments)},v.prototype.equals=function(t){if(!R(t))throw new TypeError("Argument must be a Buffer");return this===t||0===v.compare(this,t)},v.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+">"},v.prototype.compare=function(t,e,r,n,i){if(!R(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(e>>>=0),s=Math.min(a,o),h=this.slice(n,i),f=t.slice(e,r),u=0;u<s;++u)if(h[u]!==f[u]){a=h[u],o=f[u];break}return a<o?-1:o<a?1:0},v.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},v.prototype.indexOf=function(t,e,r){return x(this,t,e,r,!0)},v.prototype.lastIndexOf=function(t,e,r){return x(this,t,e,r,!1)},v.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return O(this,t,e,r);case"utf8":case"utf-8":return C(this,t,e,r);case"ascii":return I(this,t,e,r);case"latin1":case"binary":return P(this,t,e,r);case"base64":return M(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},v.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var N=4096;function U(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function F(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function Y(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=e;a<r;++a)i+=$(t[a]);return i}function Z(t,e,r){for(var n=t.slice(e,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function j(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function H(t,e,r,n,i,a){if(!R(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<a)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function W(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,a=Math.min(t.length-r,2);i<a;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function q(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,a=Math.min(t.length-r,4);i<a;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function G(t,e,r,n,i,a){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function V(t,e,r,n,i){return i||G(t,0,r,4),c(t,e,r,n,23,4),r+4}function K(t,e,r,n,i){return i||G(t,0,r,8),c(t,e,r,n,52,8),r+8}v.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),v.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=v.prototype;else{var i=e-t;r=new v(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+t]}return r},v.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||j(t,e,this.length);for(var n=this[t],i=1,a=0;++a<e&&(i*=256);)n+=this[t+a]*i;return n},v.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||j(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},v.prototype.readUInt8=function(t,e){return e||j(t,1,this.length),this[t]},v.prototype.readUInt16LE=function(t,e){return e||j(t,2,this.length),this[t]|this[t+1]<<8},v.prototype.readUInt16BE=function(t,e){return e||j(t,2,this.length),this[t]<<8|this[t+1]},v.prototype.readUInt32LE=function(t,e){return e||j(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},v.prototype.readUInt32BE=function(t,e){return e||j(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},v.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||j(t,e,this.length);for(var n=this[t],i=1,a=0;++a<e&&(i*=256);)n+=this[t+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},v.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||j(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*e)),a},v.prototype.readInt8=function(t,e){return e||j(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},v.prototype.readInt16LE=function(t,e){e||j(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},v.prototype.readInt16BE=function(t,e){e||j(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},v.prototype.readInt32LE=function(t,e){return e||j(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},v.prototype.readInt32BE=function(t,e){return e||j(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},v.prototype.readFloatLE=function(t,e){return e||j(t,4,this.length),l(this,t,!0,23,4)},v.prototype.readFloatBE=function(t,e){return e||j(t,4,this.length),l(this,t,!1,23,4)},v.prototype.readDoubleLE=function(t,e){return e||j(t,8,this.length),l(this,t,!0,52,8)},v.prototype.readDoubleBE=function(t,e){return e||j(t,8,this.length),l(this,t,!1,52,8)},v.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||H(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[e]=255&t;++a<r&&(i*=256);)this[e+a]=t/i&255;return e+r},v.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||H(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},v.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||H(this,t,e,1,255,0),v.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},v.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||H(this,t,e,2,65535,0),v.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):W(this,t,e,!0),e+2},v.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||H(this,t,e,2,65535,0),v.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):W(this,t,e,!1),e+2},v.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||H(this,t,e,4,4294967295,0),v.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):q(this,t,e,!0),e+4},v.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||H(this,t,e,4,4294967295,0),v.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):q(this,t,e,!1),e+4},v.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);H(this,t,e,r,i-1,-i)}var a=0,o=1,s=0;for(this[e]=255&t;++a<r&&(o*=256);)t<0&&0===s&&0!==this[e+a-1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},v.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);H(this,t,e,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},v.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||H(this,t,e,1,127,-128),v.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},v.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||H(this,t,e,2,32767,-32768),v.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):W(this,t,e,!0),e+2},v.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||H(this,t,e,2,32767,-32768),v.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):W(this,t,e,!1),e+2},v.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||H(this,t,e,4,2147483647,-2147483648),v.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):q(this,t,e,!0),e+4},v.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||H(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),v.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):q(this,t,e,!1),e+4},v.prototype.writeFloatLE=function(t,e,r){return V(this,t,e,!0,r)},v.prototype.writeFloatBE=function(t,e,r){return V(this,t,e,!1,r)},v.prototype.writeDoubleLE=function(t,e,r){return K(this,t,e,!0,r)},v.prototype.writeDoubleBE=function(t,e,r){return K(this,t,e,!1,r)},v.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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-e<n-r&&(n=t.length-e+r);var i,a=n-r;if(this===t&&r<e&&e<n)for(i=a-1;i>=0;--i)t[i+e]=this[i+r];else if(a<1e3||!v.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+a),e);return a},v.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!v.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var a;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(a=e;a<r;++a)this[a]=t;else{var o=R(t)?t:J(new v(t,n).toString()),s=o.length;for(a=0;a<r-e;++a)this[a+e]=o[a%s]}return this};var X=/[^+\/0-9A-Za-z-_]/g;function $(t){return t<16?"0"+t.toString(16):t.toString(16)}function J(t,e){var r;e=e||1/0;for(var n=t.length,i=null,a=[],o=0;o<n;++o){if((r=t.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function Q(t){return function(t){var e,r,n,i,f,u;s||h();var l=t.length;if(l%4>0)throw new Error("Invalid string. Length must be a multiple of 4");f="="===t[l-2]?2:"="===t[l-1]?1:0,u=new o(3*l/4-f),n=f>0?l-4:l;var c=0;for(e=0,r=0;e<n;e+=4,r+=3)i=a[t.charCodeAt(e)]<<18|a[t.charCodeAt(e+1)]<<12|a[t.charCodeAt(e+2)]<<6|a[t.charCodeAt(e+3)],u[c++]=i>>16&255,u[c++]=i>>8&255,u[c++]=255&i;return 2===f?(i=a[t.charCodeAt(e)]<<2|a[t.charCodeAt(e+1)]>>4,u[c++]=255&i):1===f&&(i=a[t.charCodeAt(e)]<<10|a[t.charCodeAt(e+1)]<<4|a[t.charCodeAt(e+2)]>>2,u[c++]=i>>8&255,u[c++]=255&i),u}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(X,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function tt(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function et(t){return null!=t&&(!!t._isBuffer||rt(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&rt(t.slice(0,0))}(t))}function rt(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var nt,it=Object.freeze({INSPECT_MAX_BYTES:50,kMaxLength:_,Buffer:v,SlowBuffer:function(t){return+t!=t&&(t=0),v.alloc(+t)},isBuffer:et}),at=v,ot=[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];function st(t){if(!t)throw new Error('"version" cannot be null or undefined');if(1>t||40<t)throw new Error('"version" should be in range from 1 to 40');return 4*t+17}function ht(t){return ot[t]}function ft(t){for(var e=0;0!==t;)e++,t>>>=1;return e}function ut(){return void 0!==nt}function lt(t){return nt(t)}var ct={bit:1},dt={bit:0},pt={bit:3},_t={bit:2};function gt(t,e){if((r=t)&&void 0!==r.bit&&0<=r.bit&&4>r.bit)return t;var r;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return ct;case"m":case"medium":return dt;case"q":case"quartile":return pt;case"h":case"high":return _t;default:throw new Error("Unknown EC Level: ".concat(t))}}(t)}catch(t){return e}}function wt(){this.buffer=[],this.length=0}function vt(t){if(!t||1>t)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new at(t*t),this.data.fill(0),this.reservedBit=new at(t*t),this.reservedBit.fill(0)}function bt(t){for(var e=[],r=function(t){if(1===t)return[];for(var e=Math.floor(t/7)+2,r=st(t),n=145===r?26:2*Math.ceil((r-13)/(2*e-2)),i=[r-7],a=1;a<e-1;a++)i[a]=i[a-1]-n;return i.push(6),i.reverse()}(t),n=r.length,i=0;i<n;i++)for(var a=0;a<n;a++)(0!=i||0!=a)&&(0!=i||a!=n-1)&&(i!=n-1||0!=a)&&e.push([r[i],r[a]]);return e}wt.prototype={get:function(t){var e=Math.floor(t/8);return 1==(1&this.buffer[e]>>>7-t%8)},put:function(t,e){for(var r=0;r<e;r++)this.putBit(1==(1&t>>>e-r-1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},vt.prototype.set=function(t,e,r,n){var i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)},vt.prototype.get=function(t,e){return this.data[t*this.size+e]},vt.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r},vt.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var mt=7;var yt={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Et={N1:3,N2:3,N3:40,N4:10};function kt(t){return null!=(e=t)&&""!==e&&!isNaN(e)&&0<=e&&7>=e?parseInt(t,10):void 0;var e}function Rt(t){for(var e=t.size,r=0,n=0,i=0,a=null,o=null,s=0;s<e;s++){n=i=0,a=o=null;for(var h,f=0;f<e;f++)(h=t.get(s,f))===a?n++:(5<=n&&(r+=Et.N1+(n-5)),a=h,n=1),(h=t.get(f,s))===o?i++:(5<=i&&(r+=Et.N1+(i-5)),o=h,i=1);5<=n&&(r+=Et.N1+(n-5)),5<=i&&(r+=Et.N1+(i-5))}return r}function Tt(t){for(var e=t.size,r=0,n=0;n<e-1;n++)for(var i,a=0;a<e-1;a++)(4===(i=t.get(n,a)+t.get(n,a+1)+t.get(n+1,a)+t.get(n+1,a+1))||0===i)&&r++;return r*Et.N2}function Lt(t){for(var e=t.size,r=0,n=0,i=0,a=0;a<e;a++){n=i=0;for(var o=0;o<e;o++)n=2047&n<<1|t.get(a,o),10<=o&&(1488===n||93===n)&&r++,i=2047&i<<1|t.get(o,a),10<=o&&(1488===i||93===i)&&r++}return r*Et.N3}function At(t){for(var e=0,r=t.data.length,n=0;n<r;n++)e+=t.data[n];return Math.abs(Math.ceil(100*e/r/5)-10)*Et.N4}function xt(t,e,r){switch(t){case yt.PATTERN000:return 0==(e+r)%2;case yt.PATTERN001:return 0==e%2;case yt.PATTERN010:return 0==r%3;case yt.PATTERN011:return 0==(e+r)%3;case yt.PATTERN100:return 0==(Math.floor(e/2)+Math.floor(r/3))%2;case yt.PATTERN101:return 0==e*r%2+e*r%3;case yt.PATTERN110:return 0==(e*r%2+e*r%3)%2;case yt.PATTERN111:return 0==(e*r%3+(e+r)%2)%2;default:throw new Error("bad maskPattern:".concat(t))}}function St(t,e){for(var r=e.size,n=0;n<r;n++)for(var i=0;i<r;i++)e.isReserved(i,n)||e.xor(i,n,xt(t,i,n))}var Ot,Ct,It=[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],Pt=[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];function Mt(t,e){return e===ct?Pt[4*(t-1)+0]:e===dt?Pt[4*(t-1)+1]:e===pt?Pt[4*(t-1)+2]:e===_t?Pt[4*(t-1)+3]:void 0}function zt(t,e){return 0===t||0===e?0:Ot[Ct[t]+Ct[e]]}function Bt(t,e){var r=new at(t.length+e.length-1);r.fill(0);for(var n=0;n<t.length;n++)for(var i=0;i<e.length;i++)r[n+i]^=zt(t[n],e[i]);return r}function Dt(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}function Nt(t){return!isNaN(t)&&1<=t&&40>=t}at.alloc?(Ot=at.alloc(512),Ct=at.alloc(256)):(Ot=new at(512),Ct=new at(256)),function(){for(var t=1,e=0;255>e;e++)Ot[e]=t,Ct[t]=e,256&(t<<=1)&&(t^=285);for(e=255;512>e;e++)Ot[e]=Ot[e-255]}(),Dt.prototype.initialize=function(t){this.degree=t,this.genPoly=function(t){for(var e=new at([1]),r=0;r<t;r++)e=Bt(e,[1,(n=r,Ot[n])]);var n;return e}(this.degree)},Dt.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");var e=new at(this.degree);e.fill(0);var r=function(t,e){for(var r=new at(t);0<=r.length-e.length;){for(var n=r[0],i=0;i<e.length;i++)r[i]^=zt(e[i],n);for(var a=0;a<r.length&&0===r[a];)a++;r=r.slice(a)}return r}(at.concat([t,e],t.length+this.degree),this.genPoly),n=this.degree-r.length;if(0<n){var i=new at(this.degree);return i.fill(0),r.copy(i,n),i}return r};var Ut="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ut=Ut.replace(/u/g,"\\u");var Ft="(?:(?![A-Z0-9 $%*+\\-./:]|".concat(Ut,")(?:.|[\r\n]))+"),Yt=new RegExp(Ut,"g"),Zt=/[^A-Z0-9 $%*+\-.\/:]+/g,jt=new RegExp(Ft,"g"),Ht=/[0-9]+/g,Wt=new RegExp("[A-Z $%*+\\-./:]+","g"),qt=new RegExp("^".concat(Ut,"$")),Gt=/^[0-9]+$/,Vt=/^[A-Z0-9 $%*+\-.\/:]+$/;var Kt={id:"Numeric",bit:1,ccBits:[10,12,14]},Xt={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},$t={id:"Byte",bit:4,ccBits:[8,16,16]},Jt={id:"Kanji",bit:8,ccBits:[8,10,12]},Qt={bit:-1};function te(t,e){if(!t.ccBits)throw new Error("Invalid mode: ".concat(t));if(!Nt(e))throw new Error("Invalid version: ".concat(e));return 1<=e&&10>e?t.ccBits[0]:27>e?t.ccBits[1]:t.ccBits[2]}function ee(t){return e=t,Gt.test(e)?Kt:function(t){return Vt.test(t)}(t)?Xt:function(t){return qt.test(t)}(t)?Jt:$t;var e}function re(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")}function ne(t,e){if((r=t)&&r.bit&&r.ccBits)return t;var r;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Kt;case"alphanumeric":return Xt;case"kanji":return Jt;case"byte":return $t;default:throw new Error("Unknown mode: ".concat(t))}}(t)}catch(t){return e}}var ie=7973,ae=ft(ie);function oe(t,e){return te(t,e)+4}function se(t,e){var r=0;return t.forEach(function(t){var n=oe(t.mode,e);r+=n+t.getBitsLength()}),r}function he(t,e,r){if(!Nt(t))throw new Error("Invalid QR Code version");void 0===r&&(r=$t);var n=8*(ht(t)-Mt(t,e));if(r===Qt)return n;var i=n-oe(r,t);switch(r){case Kt:return Math.floor(i/10*3);case Xt:return Math.floor(i/11*2);case Jt:return Math.floor(i/13);case $t:default:return Math.floor(i/8)}}function fe(t,e){var n,i=gt(e,dt);if(r(t)){if(1<t.length)return function(t,e){for(var r=1;40>=r;r++)if(se(t,r)<=he(r,e,Qt))return r}(t,i);if(0===t.length)return 1;n=t[0]}else n=t;return function(t,e,r){for(var n=1;40>=n;n++)if(e<=he(n,r,t))return n}(n.mode,n.getLength(),i)}var ue=1335,le=21522,ce=ft(ue);function de(t,e){return t(e={exports:{}},e.exports),e.exports}var pe=de(function(t){var e={single_source_shortest_paths:function(t,r,n){var i={},a={};a[r]=0;var o,s,h,f,u,l,c,d=e.PriorityQueue.make();for(d.push(r,0);!d.empty();)for(h in s=(o=d.pop()).value,f=o.cost,u=t[s]||{})u.hasOwnProperty(h)&&(l=f+u[h],c=a[h],(void 0===a[h]||c>l)&&(a[h]=l,d.push(h,l),i[h]=s));if(void 0!==n&&void 0===a[n]){var p=["Could not find a path from ",r," to ",n,"."].join("");throw new Error(p)}return i},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e;n;)r.push(n),t[n],n=t[n];return r.reverse(),r},find_path:function(t,r,n){var i=e.single_source_shortest_paths(t,r,n);return e.extract_shortest_path_from_predecessor_list(i,n)},PriorityQueue:{make:function(t){var r,n=e.PriorityQueue,i={};for(r in t=t||{},n)n.hasOwnProperty(r)&&(i[r]=n[r]);return i.queue=[],i.sorter=t.sorter||n.default_sorter,i},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};t.exports=e});function _e(t){this.mode=Kt,this.data=t.toString()}_e.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},_e.prototype.getLength=function(){return this.data.length},_e.prototype.getBitsLength=function(){return _e.getBitsLength(this.data.length)},_e.prototype.write=function(t){var e,r,n;for(e=0;e+3<=this.data.length;e+=3)r=this.data.substr(e,3),n=parseInt(r,10),t.put(n,10);var i=this.data.length-e;0<i&&(r=this.data.substr(e),n=parseInt(r,10),t.put(n,3*i+1))};var ge=["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 we(t){this.mode=Xt,this.data=t}function ve(t){this.mode=$t,this.data=new at(t)}function be(t){this.mode=Jt,this.data=t}function me(t){return unescape(encodeURIComponent(t)).length}function ye(t,e,r){for(var n,i=[];null!==(n=t.exec(r));)i.push({data:n[0],index:n.index,mode:e,length:n[0].length});return i}function Ee(t){var e,r,n=ye(Ht,Kt,t),i=ye(Wt,Xt,t);return ut()?(e=ye(jt,$t,t),r=ye(Yt,Jt,t)):(e=ye(Zt,$t,t),r=[]),n.concat(i,e,r).sort(function(t,e){return t.index-e.index}).map(function(t){return{data:t.data,mode:t.mode,length:t.length}})}function ke(t,e){return e===Kt?_e.getBitsLength(t):e===Xt?we.getBitsLength(t):e===Jt?be.getBitsLength(t):e===$t?ve.getBitsLength(t):void 0}function Re(t,e){var r,n=ee(t);if((r=ne(e,n))!==$t&&r.bit<n.bit)throw new Error('"'.concat(t,'"')+" cannot be encoded with mode ".concat(re(r),".\n Suggested mode is: ").concat(re(n)));return r!==Jt||ut()||(r=$t),r===Kt?new _e(t):r===Xt?new we(t):r===Jt?new be(t):r===$t?new ve(t):void 0}function Te(t){return t.reduce(function(t,e){return"string"==typeof e?t.push(Re(e,null)):e.data&&t.push(Re(e.data,e.mode)),t},[])}function Le(t,e){for(var r=function(t,e){for(var r={},n={start:{}},i=["start"],a=0;a<t.length;a++){for(var o=t[a],s=[],h=0;h<o.length;h++){var f=o[h],u="".concat(a).concat(h);s.push(u),r[u]={node:f,lastCount:0},n[u]={};for(var l,c=0;c<i.length;c++)r[l=i[c]]&&r[l].node.mode===f.mode?(n[l][u]=ke(r[l].lastCount+f.length,f.mode)-ke(r[l].lastCount,f.mode),r[l].lastCount+=f.length):(r[l]&&(r[l].lastCount=f.length),n[l][u]=ke(f.length,f.mode)+4+te(f.mode,e))}i=s}for(c=0;c<i.length;c++)n[i[c]].end=0;return{map:n,table:r}}(function(t){for(var e,r=[],n=0;n<t.length;n++)switch(e=t[n],e.mode){case Kt:r.push([e,{data:e.data,mode:Xt,length:e.length},{data:e.data,mode:$t,length:e.length}]);break;case Xt:r.push([e,{data:e.data,mode:$t,length:e.length}]);break;case Jt:r.push([e,{data:e.data,mode:$t,length:me(e.data)}]);break;case $t:r.push([{data:e.data,mode:$t,length:me(e.data)}])}return r}(Ee(t)),e),n=pe.find_path(r.map,"start","end"),i=[],a=1;a<n.length-1;a++)i.push(r.table[n[a]].node);return Te(function(t){return t.reduce(function(t,e){var r=0<=t.length-1?t[t.length-1]:null;return r&&r.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)},[])}(i))}function Ae(t,e){for(var r=t.size,n=function(t){var e=st(t);return[[0,0],[e-mt,0],[0,e-mt]]}(e),i=0;i<n.length;i++)for(var a=n[i][0],o=n[i][1],s=-1;7>=s;s++)if(!(-1>=a+s||r<=a+s))for(var h=-1;7>=h;h++)-1>=o+h||r<=o+h||(0<=s&&6>=s&&(0==h||6==h)||0<=h&&6>=h&&(0==s||6==s)||2<=s&&4>=s&&2<=h&&4>=h?t.set(a+s,o+h,!0,!0):t.set(a+s,o+h,!1,!0))}function xe(t,e){for(var r,n,i,a=t.size,o=function(t){if(!Nt(t)||7>t)throw new Error("Invalid QR Code version");for(var e=t<<12;0<=ft(e)-ae;)e^=ie<<ft(e)-ae;return t<<12|e}(e),s=0;18>s;s++)r=Math.floor(s/3),n=s%3+a-8-3,i=1==(1&o>>s),t.set(r,n,i,!0),t.set(n,r,i,!0)}function Se(t,e,r){var n,i,a=t.size,o=function(t,e){for(var r=t.bit<<3|e,n=r<<10;0<=ft(n)-ce;)n^=ue<<ft(n)-ce;return(r<<10|n)^le}(e,r);for(n=0;15>n;n++)i=1==(1&o>>n),6>n?t.set(n,8,i,!0):8>n?t.set(n+1,8,i,!0):t.set(a-15+n,8,i,!0),8>n?t.set(8,a-n-1,i,!0):9>n?t.set(8,15-n-1+1,i,!0):t.set(8,15-n-1,i,!0);t.set(a-8,8,1,!0)}function Oe(t,e,r){var n=new wt;r.forEach(function(e){n.put(e.mode.bit,4),n.put(e.getLength(),te(e.mode,t)),e.write(n)});var i=8*(ht(t)-Mt(t,e));for(n.getLengthInBits()+4<=i&&n.put(0,4);0!=n.getLengthInBits()%8;)n.putBit(0);for(var a=(i-n.getLengthInBits())/8,o=0;o<a;o++)n.put(o%2?17:236,8);return function(t,e,r){for(var n,i=ht(e),a=Mt(e,r),o=function(t,e){return e===ct?It[4*(t-1)+0]:e===dt?It[4*(t-1)+1]:e===pt?It[4*(t-1)+2]:e===_t?It[4*(t-1)+3]:void 0}(e,r),s=Math.floor(i/o),h=Math.floor((i-a)/o),f=s-h,u=new Dt(f),l=0,c=Array(o),d=Array(o),p=0,_=new at(t.buffer),g=0;g<o;g++)n=g<o-i%o?h:h+1,c[g]=_.slice(l,l+n),d[g]=u.encode(c[g]),l+=n,p=Math.max(p,n);var w,v,b=new at(i),m=0;for(w=0;w<p;w++)for(v=0;v<o;v++)w<c[v].length&&(b[m++]=c[v][w]);for(w=0;w<f;w++)for(v=0;v<o;v++)b[m++]=d[v][w];return b}(n,t,e)}function Ce(t,e,n,i){var a;if(r(t))a=Te(t);else{if("string"!=typeof t)throw new Error("Invalid data");var o=e;o||(o=fe(function(t){return Te(Ee(t))}(t),n));a=Le(t,o||40)}var s=fe(a,n);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(e){if(e<s)throw new Error("".concat("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: ").concat(s,".\n"))}else e=s;var h=Oe(e,n,a),f=new vt(st(e));return Ae(f,e),function(t){for(var e,r=t.size,n=8;n<r-8;n++)e=0==n%2,t.set(n,6,e,!0),t.set(6,n,e,!0)}(f),function(t,e){for(var r=bt(e),n=0;n<r.length;n++)for(var i=r[n][0],a=r[n][1],o=-2;2>=o;o++)for(var s=-2;2>=s;s++)-2==o||2==o||-2==s||2==s||0==o&&0==s?t.set(i+o,a+s,!0,!0):t.set(i+o,a+s,!1,!0)}(f,e),Se(f,n,0),7<=e&&xe(f,e),function(t,e){for(var r=t.size,n=-1,i=r-1,a=7,o=0,s=r-1;0<s;s-=2)for(6==s&&s--;;){for(var h=0;2>h;h++)if(!t.isReserved(i,s-h)){var f=!1;o<e.length&&(f=1==(1&e[o]>>>a)),t.set(i,s-h,f),-1==--a&&(o++,a=7)}if(0>(i+=n)||r<=i){i-=n,n=-n;break}}}(f,h),isNaN(i)&&(i=function(t,e){for(var r=Object.keys(yt).length,n=0,i=1/0,a=0;a<r;a++){e(a),St(a,t);var o=Rt(t)+Tt(t)+Lt(t)+At(t);St(a,t),o<i&&(i=o,n=a)}return n}(f,Se.bind(null,f,n))),St(i,f),Se(f,n,i),{modules:f,version:e,errorCorrectionLevel:n,maskPattern:i,segments:a}}function Ie(t,e){if(void 0===t||""===t)throw new Error("No input text");var r,n,i,a,o=dt;return void 0!==e&&(o=gt(e.errorCorrectionLevel,dt),r=Nt(i=e.version)?parseInt(i,10):a,n=kt(e.maskPattern),e.toSJISFunc&&function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');nt=t}(e.toSJISFunc)),Ce(t,r,o,n)}function Pe(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw new Error("Color should be defined as hex string");var e=t.slice().replace("#","").split("");if(3>e.length||5===e.length||8<e.length)throw new Error("Invalid hex color: ".concat(t));(3===e.length||4===e.length)&&(e=Array.prototype.concat.apply([],e.map(function(t){return[t,t]}))),6===e.length&&e.push("F","F");var r=parseInt(e.join(""),16);return{r:255&r>>24,g:255&r>>16,b:255&r>>8,a:255&r,hex:"#".concat(e.slice(0,6).join(""))}}function Me(t){t||(t={}),t.color||(t.color={});var e=void 0===t.margin||null===t.margin||0>t.margin?4:t.margin,r=t.width&&21<=t.width?t.width:void 0,n=t.scale||4;return{width:r,scale:r?4:n,margin:e,color:{dark:Pe(t.color.dark||"#000000ff"),light:Pe(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}}function ze(t,e){return e.width&&e.width>=t+2*e.margin?e.width/(t+2*e.margin):e.scale}function Be(t,e){var r=t.a/255,n="".concat(e,'="').concat(t.hex,'"');return 1>r?"".concat(n," ").concat(e,'-opacity="').concat(r.toFixed(2).slice(1),'"'):n}function De(t,e,r){var n=t+e;return void 0!==r&&(n+=" ".concat(r)),n}we.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},we.prototype.getLength=function(){return this.data.length},we.prototype.getBitsLength=function(){return we.getBitsLength(this.data.length)},we.prototype.write=function(t){var e;for(e=0;e+2<=this.data.length;e+=2){var r=45*ge.indexOf(this.data[e]);r+=ge.indexOf(this.data[e+1]),t.put(r,11)}this.data.length%2&&t.put(ge.indexOf(this.data[e]),6)},ve.getBitsLength=function(t){return 8*t},ve.prototype.getLength=function(){return this.data.length},ve.prototype.getBitsLength=function(){return ve.getBitsLength(this.data.length)},ve.prototype.write=function(t){for(var e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)},be.getBitsLength=function(t){return 13*t},be.prototype.getLength=function(){return this.data.length},be.prototype.getBitsLength=function(){return be.getBitsLength(this.data.length)},be.prototype.write=function(t){var e;for(e=0;e<this.data.length;e++){var r=lt(this.data[e]);if(33088<=r&&40956>=r)r-=33088;else{if(!(57408<=r&&60351>=r))throw new Error("Invalid SJIS character: ".concat(this.data[e],"\n")+"Make sure your charset is UTF-8");r-=49472}r=192*(255&r>>>8)+(255&r),t.put(r,13)}};var Ne=Object.freeze({render:function(t,e,r){var n=Me(e),i=t.modules.size,a=t.modules.data,o=i+2*n.margin,s=n.color.light.a?"<path ".concat(Be(n.color.light,"fill"),' d="M0 0h').concat(o,"v").concat(o,'H0z"/>'):"",h="<path ".concat(Be(n.color.dark,"stroke"),' d="').concat(function(t,e,r){for(var n="",i=0,a=!1,o=0,s=0;s<t.length;s++){var h=Math.floor(s%e),f=Math.floor(s/e);h||a||(a=!0),t[s]?(o++,!(0<s&&0<h&&t[s-1])&&(n+=a?De("M",h+r,.5+f+r):De("m",i,0),i=0,a=!1),!(h+1<e&&t[s+1])&&(n+=De("h",o),o=0)):i++}return n}(a,i,n.margin),'"/>'),f="".concat('viewBox="0 0 ').concat(o," ").concat(o,'"'),u=n.width?'width="'.concat(n.width,'" height="').concat(n.width,'" '):"",l='<svg xmlns="http://www.w3.org/2000/svg" '.concat(u).concat(f,' shape-rendering="crispEdges">').concat(s).concat(h,"</svg>\n");return"function"==typeof r&&r(null,l),l}}),Ue={WW:" ",WB:"▄",BB:"█",BW:"▀"},Fe={BB:" ",BW:"▄",WW:"█",WB:"▀"};function Ye(t,e,r){return t&&e?r.BB:t&&!e?r.BW:!t&&e?r.WB:r.WW}var Ze=Object.freeze({render:function(t,e,r){var n=Me(e),i=Ue;("#ffffff"===n.color.dark.hex||"#000000"===n.color.light.hex)&&(i=Fe);var a=t.modules.size,o=t.modules.data,s="",h=Array(a+2*n.margin+1).join(i.WW);h=Array(n.margin/2+1).join("".concat(h,"\n"));var f=Array(n.margin+1).join(i.WW);s+=h;for(var u=0;u<a;u+=2){s+=f;for(var l=0;l<a;l++)s+=Ye(o[u*a+l],o[(u+1)*a+l],i);s+="".concat(f,"\n")}return s+=h.slice(0,-1),"function"==typeof r&&r(null,s),s}});function je(){throw new Error("setTimeout has not been defined")}function He(){throw new Error("clearTimeout has not been defined")}var We=je,qe=He;function Ge(t){if(We===setTimeout)return setTimeout(t,0);if((We===je||!We)&&setTimeout)return We=setTimeout,setTimeout(t,0);try{return We(t,0)}catch(e){try{return We.call(null,t,0)}catch(e){return We.call(this,t,0)}}}"function"==typeof n.setTimeout&&(We=setTimeout),"function"==typeof n.clearTimeout&&(qe=clearTimeout);var Ve,Ke=[],Xe=!1,$e=-1;function Je(){Xe&&Ve&&(Xe=!1,Ve.length?Ke=Ve.concat(Ke):$e=-1,Ke.length&&Qe())}function Qe(){if(!Xe){var t=Ge(Je);Xe=!0;for(var e=Ke.length;e;){for(Ve=Ke,Ke=[];++$e<e;)Ve&&Ve[$e].run();$e=-1,e=Ke.length}Ve=null,Xe=!1,function(t){if(qe===clearTimeout)return clearTimeout(t);if((qe===He||!qe)&&clearTimeout)return qe=clearTimeout,clearTimeout(t);try{qe(t)}catch(e){try{return qe.call(null,t)}catch(e){return qe.call(this,t)}}}(t)}}function tr(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Ke.push(new er(t,e)),1!==Ke.length||Xe||Ge(Qe)}function er(t,e){this.fun=t,this.array=e}er.prototype.run=function(){this.fun.apply(null,this.array)};var rr=n.performance||{},nr=(rr.now||rr.mozNow||rr.msNow||rr.oNow||rr.webkitNow,"function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}),ir=/%[sdj%]/g;function ar(t){if(!mr(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(ur(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,i=n.length,a=String(t).replace(ir,function(t){if("%%"===t)return"%";if(r>=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),o=n[r];r<i;o=n[++r])vr(o)||!kr(o)?a+=" "+o:a+=" "+ur(o);return a}function or(t,e){if(yr(n.process))return function(){return or(t,e).apply(this,arguments)};var r=!1;return function(){return r||(console.error(e),r=!0),t.apply(this,arguments)}}var sr,hr={};function fr(t){if(yr(sr)&&(sr=""),t=t.toUpperCase(),!hr[t])if(new RegExp("\\b"+t+"\\b","i").test(sr)){hr[t]=function(){var e=ar.apply(null,arguments);console.error("%s %d: %s",t,0,e)}}else hr[t]=function(){};return hr[t]}function ur(t,e){var r={seen:[],stylize:cr};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),wr(e)?r.showHidden=e:e&&Cr(r,e),yr(r.showHidden)&&(r.showHidden=!1),yr(r.depth)&&(r.depth=2),yr(r.colors)&&(r.colors=!1),yr(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=lr),dr(r,t,r.depth)}function lr(t,e){var r=ur.styles[e];return r?"["+ur.colors[r][0]+"m"+t+"["+ur.colors[r][1]+"m":t}function cr(t,e){return t}function dr(t,e,r){if(t.customInspect&&e&&Lr(e.inspect)&&e.inspect!==ur&&(!e.constructor||e.constructor.prototype!==e)){var n=e.inspect(r,t);return mr(n)||(n=dr(t,n,r)),n}var i=function(t,e){if(yr(e))return t.stylize("undefined","undefined");if(mr(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(br(e))return t.stylize(""+e,"number");if(wr(e))return t.stylize(""+e,"boolean");if(vr(e))return t.stylize("null","null")}(t,e);if(i)return i;var a=Object.keys(e),o=function(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(e)),Tr(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return pr(e);if(0===a.length){if(Lr(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if(Er(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Rr(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Tr(e))return pr(e)}var h,f="",u=!1,l=["{","}"];(gr(e)&&(u=!0,l=["[","]"]),Lr(e))&&(f=" [Function"+(e.name?": "+e.name:"")+"]");return Er(e)&&(f=" "+RegExp.prototype.toString.call(e)),Rr(e)&&(f=" "+Date.prototype.toUTCString.call(e)),Tr(e)&&(f=" "+pr(e)),0!==a.length||u&&0!=e.length?r<0?Er(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),h=u?function(t,e,r,n,i){for(var a=[],o=0,s=e.length;o<s;++o)Ir(e,String(o))?a.push(_r(t,e,r,n,String(o),!0)):a.push("");return i.forEach(function(i){i.match(/^\d+$/)||a.push(_r(t,e,r,n,i,!0))}),a}(t,e,r,o,a):a.map(function(n){return _r(t,e,r,o,n,u)}),t.seen.pop(),function(t,e,r){if(t.reduce(function(t,e){return e.indexOf("\n"),t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(h,f,l)):l[0]+f+l[1]}function pr(t){return"["+Error.prototype.toString.call(t)+"]"}function _r(t,e,r,n,i,a){var o,s,h;if((h=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=h.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):h.set&&(s=t.stylize("[Setter]","special")),Ir(n,i)||(o="["+i+"]"),s||(t.seen.indexOf(h.value)<0?(s=vr(r)?dr(t,h.value,null):dr(t,h.value,r-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n")):s=t.stylize("[Circular]","special")),yr(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function gr(t){return Array.isArray(t)}function wr(t){return"boolean"==typeof t}function vr(t){return null===t}function br(t){return"number"==typeof t}function mr(t){return"string"==typeof t}function yr(t){return void 0===t}function Er(t){return kr(t)&&"[object RegExp]"===xr(t)}function kr(t){return"object"==typeof t&&null!==t}function Rr(t){return kr(t)&&"[object Date]"===xr(t)}function Tr(t){return kr(t)&&("[object Error]"===xr(t)||t instanceof Error)}function Lr(t){return"function"==typeof t}function Ar(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function xr(t){return Object.prototype.toString.call(t)}function Sr(t){return t<10?"0"+t.toString(10):t.toString(10)}ur.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},ur.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Or=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Cr(t,e){if(!e||!kr(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function Ir(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Pr={inherits:nr,_extend:Cr,log:function(){var t,e;console.log("%s - %s",(t=new Date,e=[Sr(t.getHours()),Sr(t.getMinutes()),Sr(t.getSeconds())].join(":"),[t.getDate(),Or[t.getMonth()],e].join(" ")),ar.apply(null,arguments))},isBuffer:function(t){return et(t)},isPrimitive:Ar,isFunction:Lr,isError:Tr,isDate:Rr,isObject:kr,isRegExp:Er,isUndefined:yr,isSymbol:function(t){return"symbol"==typeof t},isString:mr,isNumber:br,isNullOrUndefined:function(t){return null==t},isNull:vr,isBoolean:wr,isArray:gr,inspect:ur,deprecate:or,format:ar,debuglog:fr};function Mr(){}function zr(){zr.init.call(this)}function Br(t){return void 0===t._maxListeners?zr.defaultMaxListeners:t._maxListeners}function Dr(t,e,r){if(e)t.call(r);else for(var n=t.length,i=Wr(t,n),a=0;a<n;++a)i[a].call(r)}function Nr(t,e,r,n){if(e)t.call(r,n);else for(var i=t.length,a=Wr(t,i),o=0;o<i;++o)a[o].call(r,n)}function Ur(t,e,r,n,i){if(e)t.call(r,n,i);else for(var a=t.length,o=Wr(t,a),s=0;s<a;++s)o[s].call(r,n,i)}function Fr(t,e,r,n,i,a){if(e)t.call(r,n,i,a);else for(var o=t.length,s=Wr(t,o),h=0;h<o;++h)s[h].call(r,n,i,a)}function Yr(t,e,r,n){if(e)t.apply(r,n);else for(var i=t.length,a=Wr(t,i),o=0;o<i;++o)a[o].apply(r,n)}function Zr(t,e,r,n){var i,a,o,s;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((a=t._events)?(a.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),a=t._events),o=a[e]):(a=t._events=new Mr,t._eventsCount=0),o){if("function"==typeof o?o=a[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),!o.warned&&(i=Br(t))&&i>0&&o.length>i){o.warned=!0;var h=new Error("Possible EventEmitte