var t={},e={},n={};let r;const o=[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];n.getSymbolSize=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},n.getSymbolTotalCodewords=function(t){return o[t]},n.getBCHDigit=function(t){let e=0;for(;0!==t;)e++,t>>>=1;return e},n.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');r=t},n.isKanjiModeEnabled=function(){return void 0!==r},n.toSJIS=function(t){return r(t)};var i,s={};function a(){this.buffer=[],this.length=0}(i=s).L={bit:1},i.M={bit:0},i.Q={bit:3},i.H={bit:2},i.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},i.from=function(t,e){if(i.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 i.L;case"m":case"medium":return i.M;case"q":case"quartile":return i.Q;case"h":case"high":return i.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(n){return e}},a.prototype={get:function(t){const e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(let n=0;n>>e-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var u=a;function c(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}c.prototype.set=function(t,e,n,r){const o=t*this.size+e;this.data[o]=n,r&&(this.reservedBit[o]=!0)},c.prototype.get=function(t,e){return this.data[t*this.size+e]},c.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n},c.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var l=c,f={};!function(t){const e=n.getSymbolSize;t.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,r=e(t),o=145===r?26:2*Math.ceil((r-13)/(2*n-2)),i=[r-7];for(let e=1;e=0&&t<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(t){const n=t.size;let r=0,o=0,i=0,s=null,a=null;for(let u=0;u=5&&(r+=e+(o-5)),s=n,o=1),n=t.get(c,u),n===a?i++:(i>=5&&(r+=e+(i-5)),a=n,i=1)}o>=5&&(r+=e+(o-5)),i>=5&&(r+=e+(i-5))}return r},t.getPenaltyN2=function(t){const e=t.size;let r=0;for(let n=0;n=10&&(1488===o||93===o)&&n++,i=i<<1&2047|t.get(s,r),s>=10&&(1488===i||93===i)&&n++}return n*r},t.getPenaltyN4=function(t){let e=0;const n=t.data.length;for(let r=0;r=0;){const t=r[0];for(let i=0;i0){const t=new Uint8Array(this.degree);return t.set(n,r),t}return n};var M=I,T={},N={},P={isValid:function(t){return!isNaN(t)&&t>=1&&t<=40}},b={};const R="[0-9]+";let L="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";L=L.replace(/u/g,"\\u");const U="(?:(?![A-Z0-9 $%*+\\-./:]|"+L+")(?:.|[\r\n]))+";b.KANJI=new RegExp(L,"g"),b.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),b.BYTE=new RegExp(U,"g"),b.NUMERIC=new RegExp(R,"g"),b.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const x=new RegExp("^"+L+"$"),S=new RegExp("^"+R+"$"),k=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");b.testKanji=function(t){return x.test(t)},b.testNumeric=function(t){return S.test(t)},b.testAlphanumeric=function(t){return k.test(t)},function(t){const e=P,n=b;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(t,n){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!e.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?t.ccBits[0]:n<27?t.ccBits[1]:t.ccBits[2]},t.getBestModeForData=function(e){return n.testNumeric(e)?t.NUMERIC:n.testAlphanumeric(e)?t.ALPHANUMERIC:n.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},t.isValid=function(t){return t&&t.bit&&t.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(r){return n}}}(N),function(t){const e=n,r=p,o=s,i=N,a=P,u=e.getBCHDigit(7973);function c(t,e){return i.getCharCountIndicator(t,e)+4}function l(t,e){let n=0;return t.forEach(function(t){const r=c(t.mode,e);n+=r+t.getBitsLength()}),n}t.from=function(t,e){return a.isValid(t)?parseInt(t,10):e},t.getCapacity=function(t,n,o){if(!a.isValid(t))throw new Error("Invalid QR Code version");void 0===o&&(o=i.BYTE);const s=8*(e.getSymbolTotalCodewords(t)-r.getTotalCodewordsCount(t,n));if(o===i.MIXED)return s;const u=s-c(o,t);switch(o){case i.NUMERIC:return Math.floor(u/10*3);case i.ALPHANUMERIC:return Math.floor(u/11*2);case i.KANJI:return Math.floor(u/13);case i.BYTE:default:return Math.floor(u/8)}},t.getBestVersionForData=function(e,n){let r;const s=o.from(n,o.M);if(Array.isArray(e)){if(e.length>1)return function(e,n){for(let r=1;r<=40;r++)if(l(e,r)<=t.getCapacity(r,n,i.MIXED))return r}(e,s);if(0===e.length)return 1;r=e[0]}else r=e;return function(e,n,r){for(let o=1;o<=40;o++)if(n<=t.getCapacity(o,r,e))return o}(r.mode,r.getLength(),s)},t.getEncodedBits=function(t){if(!a.isValid(t)||t<7)throw new Error("Invalid QR Code version");let n=t<<12;for(;e.getBCHDigit(n)-u>=0;)n^=7973<=0;)r^=1335<0&&(n=this.data.substr(e),r=parseInt(n,10),t.put(r,3*o+1))};var Y=K;const _=N,V=["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 j(t){this.mode=_.ALPHANUMERIC,this.data=t}j.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},j.prototype.getLength=function(){return this.data.length},j.prototype.getBitsLength=function(){return j.getBitsLength(this.data.length)},j.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let n=45*V.indexOf(this.data[e]);n+=V.indexOf(this.data[e+1]),t.put(n,11)}this.data.length%2&&t.put(V.indexOf(this.data[e]),6)};var O=j;const q=N;function Q(t){this.mode=q.BYTE,this.data="string"==typeof t?(new TextEncoder).encode(t):new Uint8Array(t)}Q.getBitsLength=function(t){return 8*t},Q.prototype.getLength=function(){return this.data.length},Q.prototype.getBitsLength=function(){return Q.getBitsLength(this.data.length)},Q.prototype.write=function(t){for(let e=0,n=this.data.length;e=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[e]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),t.put(n,13)}};var G,tt=W,et={exports:{}},nt=et.exports=G={single_source_shortest_paths:function(t,e,n){var r={},o={};o[e]=0;var i,s,a,u,c,l,f,h=G.PriorityQueue.make();for(h.push(e,0);!h.empty();)for(a in s=(i=h.pop()).value,u=i.cost,c=t[s]||{})c.hasOwnProperty(a)&&(l=u+c[a],f=o[a],(void 0===o[a]||f>l)&&(o[a]=l,h.push(a,l),r[a]=s));if(void 0!==n&&void 0===o[n]){var g=["Could not find a path from ",e," to ",n,"."].join("");throw new Error(g)}return r},extract_shortest_path_from_predecessor_list:function(t,e){for(var n=[],r=e;r;)n.push(r),t[r],r=t[r];return n.reverse(),n},find_path:function(t,e,n){var r=G.single_source_shortest_paths(t,e,n);return G.extract_shortest_path_from_predecessor_list(r,n)},PriorityQueue:{make:function(t){var e,n=G.PriorityQueue,r={};for(e in t=t||{},n)n.hasOwnProperty(e)&&(r[e]=n[e]);return r.queue=[],r.sorter=t.sorter||n.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var n={value:t,cost:e};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};!function(t){const e=N,r=Y,o=O,i=$,s=tt,a=b,u=n,c=nt;function l(t){return unescape(encodeURIComponent(t)).length}function f(t,e,n){const r=[];let o;for(;null!==(o=t.exec(n));)r.push({data:o[0],index:o.index,mode:e,length:o[0].length});return r}function h(t){const n=f(a.NUMERIC,e.NUMERIC,t),r=f(a.ALPHANUMERIC,e.ALPHANUMERIC,t);let o,i;u.isKanjiModeEnabled()?(o=f(a.BYTE,e.BYTE,t),i=f(a.KANJI,e.KANJI,t)):(o=f(a.BYTE_KANJI,e.BYTE,t),i=[]);return n.concat(r,o,i).sort(function(t,e){return t.index-e.index}).map(function(t){return{data:t.data,mode:t.mode,length:t.length}})}function g(t,n){switch(n){case e.NUMERIC:return r.getBitsLength(t);case e.ALPHANUMERIC:return o.getBitsLength(t);case e.KANJI:return s.getBitsLength(t);case e.BYTE:return i.getBitsLength(t)}}function d(t,n){let a;const c=e.getBestModeForData(t);if(a=e.from(n,c),a!==e.BYTE&&a.bit=0?t[t.length-1]:null;return n&&n.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)},[])}(a))},t.rawSplit=function(e){return t.fromArray(h(e,u.isKanjiModeEnabled()))}}(H);const rt=n,ot=s,it=u,st=l,at=f,ut=h,ct=d,lt=p,ft=M,ht=T,gt=F,dt=N,pt=H;function wt(t,e,n){const r=t.size,o=gt.getEncodedBits(e,n);let i,s;for(i=0;i<15;i++)s=1==(o>>i&1),i<6?t.set(i,8,s,!0):i<8?t.set(i+1,8,s,!0):t.set(r-15+i,8,s,!0),i<8?t.set(8,r-i-1,s,!0):i<9?t.set(8,15-i-1+1,s,!0):t.set(8,15-i-1,s,!0);t.set(r-8,8,1,!0)}function mt(t,e,n){const r=new it;n.forEach(function(e){r.put(e.mode.bit,4),r.put(e.getLength(),dt.getCharCountIndicator(e.mode,t)),e.write(r)});const o=8*(rt.getSymbolTotalCodewords(t)-lt.getTotalCodewordsCount(t,e));for(r.getLengthInBits()+4<=o&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(0);const i=(o-r.getLengthInBits())/8;for(let s=0;s=0&&r<=6&&(0===o||6===o)||o>=0&&o<=6&&(0===r||6===r)||r>=2&&r<=4&&o>=2&&o<=4?t.set(e+r,i+o,!0,!0):t.set(e+r,i+o,!1,!0))}}(u,e),function(t){const e=t.size;for(let n=8;n=7&&function(t,e){const n=t.size,r=ht.getEncodedBits(e);let o,i,s;for(let a=0;a<18;a++)o=Math.floor(a/3),i=a%3+n-8-3,s=1==(r>>a&1),t.set(o,i,s,!0),t.set(i,o,s,!0)}(u,e),function(t,e){const n=t.size;let r=-1,o=n-1,i=7,s=0;for(let a=n-1;a>0;a-=2)for(6===a&&a--;;){for(let n=0;n<2;n++)if(!t.isReserved(o,a-n)){let r=!1;s>>i&1)),t.set(o,a-n,r),i--,-1===i&&(s++,i=7)}if(o+=r,o<0||n<=o){o-=r,r=-r;break}}}(u,s),isNaN(r)&&(r=ct.getBestMask(u,wt.bind(null,u,n))),ct.applyMask(r,u),wt(u,n,r),{modules:u,version:e,errorCorrectionLevel:n,maskPattern:r,segments:o}}e.create=function(t,e){if(void 0===t||""===t)throw new Error("No input text");let n,r,o=ot.M;return void 0!==e&&(o=ot.from(e.errorCorrectionLevel,ot.M),n=ht.from(e.version),r=ct.from(e.maskPattern),e.toSJISFunc&&rt.setToSJISFunction(e.toSJISFunc)),Et(t,n,o,r)};var yt={},At={};!function(t){function e(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||5===e.length||e.length>8)throw new Error("Invalid hex color: "+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");const n=parseInt(e.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+e.slice(0,6).join("")}}t.getOptions=function(t){t||(t={}),t.color||(t.color={});const n=void 0===t.margin||null===t.margin||t.margin<0?4:t.margin,r=t.width&&t.width>=21?t.width:void 0,o=t.scale||4;return{width:r,scale:r?4:o,margin:n,color:{dark:e(t.color.dark||"#000000ff"),light:e(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},t.getScale=function(t,e){return e.width&&e.width>=t+2*e.margin?e.width/(t+2*e.margin):e.scale},t.getImageWidth=function(e,n){const r=t.getScale(e,n);return Math.floor((e+2*n.margin)*r)},t.qrToImageData=function(e,n,r){const o=n.modules.size,i=n.modules.data,s=t.getScale(o,r),a=Math.floor((o+2*r.margin)*s),u=r.margin*s,c=[r.color.light,r.color.dark];for(let t=0;t=u&&n>=u&&t':"",u="0&&u>0&&t[a-1]||(r+=i?It("M",u+n,.5+c+n):It("m",o,0),o=0,i=!1),u+1',c='viewBox="0 0 '+s+" "+s+'"',l=''+a+u+"\n";return"function"==typeof n&&n(null,l),l};const Mt=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},Tt=e,Nt=yt,Pt=vt;function bt(t,e,n,r,o){const i=[].slice.call(arguments,1),s=i.length,a="function"==typeof i[s-1];if(!a&&!Mt())throw new Error("Callback required as last argument");if(!a){if(s<1)throw new Error("Too few arguments provided");return 1===s?(n=e,e=r=void 0):2!==s||e.getContext||(r=n,n=e,e=void 0),new Promise(function(o,i){try{const i=Tt.create(n,r);o(t(i,e,r))}catch(s){i(s)}})}if(s<2)throw new Error("Too few arguments provided");2===s?(o=n,n=e,e=r=void 0):3===s&&(e.getContext&&void 0===o?(o=r,r=void 0):(o=r,r=n,n=e,e=void 0));try{const i=Tt.create(n,r);o(null,t(i,e,r))}catch(u){o(u)}}t.create=Tt.create,t.toCanvas=bt.bind(null,Nt.render),t.toDataURL=bt.bind(null,Nt.renderToDataURL),t.toString=bt.bind(null,function(t,e,n){return Pt.render(t,n)});export{t as b};