@cas-smartdesign/qrcode 3.0.2 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/doc.css +1 -1
- package/dist/docs/doc.mjs +39 -42
- package/dist/qrcode-with-externals.js +7 -7
- package/dist/qrcode-with-externals.js.map +4 -4
- package/dist/qrcode.mjs +1 -2
- package/dist/qrcode.mjs.map +1 -1
- package/npm-third-party-licenses.json +85 -80
- package/package.json +5 -5
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var window;(window||={})["@cas-smartdesign/qrcode"]=(()=>{var
|
|
2
|
-
]))+`;B.KANJI=new RegExp(V,"g");B.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");B.BYTE=new RegExp(
|
|
3
|
-
Make sure your charset is UTF-8`);e=(e>>>8&255)*192+(e&255),n.put(e,13)}};
|
|
4
|
-
Suggested mode is: `+f.toString(r));switch(e===f.KANJI&&!et.isKanjiModeEnabled()&&(e=f.BYTE),e){case f.NUMERIC:return new
|
|
1
|
+
var window;(window||={})["@cas-smartdesign/qrcode"]=(()=>{var Ve=Object.create;var j=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Je=Object.getOwnPropertyNames;var Ye=Object.getPrototypeOf,Oe=Object.prototype.hasOwnProperty;var d=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),je=(n,t)=>{for(var e in t)j(n,e,{get:t[e],enumerable:!0})},_t=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Je(t))!Oe.call(n,o)&&o!==e&&j(n,o,{get:()=>t[o],enumerable:!(r=Ke(t,o))||r.enumerable});return n};var Ge=(n,t,e)=>(e=n!=null?Ve(Ye(n)):{},_t(t||!n||!n.__esModule?j(e,"default",{value:n,enumerable:!0}):e,n)),Qe=n=>_t(j({},"__esModule",{value:!0}),n);var kt=d((Gn,Ft)=>{Ft.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var I=d(b=>{var at,$e=[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];b.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 t*4+17};b.getSymbolTotalCodewords=function(t){return $e[t]};b.getBCHDigit=function(n){let t=0;for(;n!==0;)t++,n>>>=1;return t};b.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');at=t};b.isKanjiModeEnabled=function(){return typeof at<"u"};b.toSJIS=function(t){return at(t)}});var Q=d(w=>{w.L={bit:1};w.M={bit:0};w.Q={bit:3};w.H={bit:2};function We(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return w.L;case"m":case"medium":return w.M;case"q":case"quartile":return w.Q;case"h":case"high":return w.H;default:throw new Error("Unknown EC Level: "+n)}}w.isValid=function(t){return t&&typeof t.bit<"u"&&t.bit>=0&&t.bit<4};w.from=function(t,e){if(w.isValid(t))return t;try{return We(t)}catch{return e}}});var Vt=d((Wn,Ht)=>{function zt(){this.buffer=[],this.length=0}zt.prototype={get:function(n){let t=Math.floor(n/8);return(this.buffer[t]>>>7-n%8&1)===1},put:function(n,t){for(let e=0;e<t;e++)this.putBit((n>>>t-e-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(n){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),n&&(this.buffer[t]|=128>>>this.length%8),this.length++}};Ht.exports=zt});var Jt=d((Zn,Kt)=>{function k(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n)}k.prototype.set=function(n,t,e,r){let o=n*this.size+t;this.data[o]=e,r&&(this.reservedBit[o]=!0)};k.prototype.get=function(n,t){return this.data[n*this.size+t]};k.prototype.xor=function(n,t,e){this.data[n*this.size+t]^=e};k.prototype.isReserved=function(n,t){return this.reservedBit[n*this.size+t]};Kt.exports=k});var Yt=d($=>{var Ze=I().getSymbolSize;$.getRowColCoords=function(t){if(t===1)return[];let e=Math.floor(t/7)+2,r=Ze(t),o=r===145?26:Math.ceil((r-13)/(2*e-2))*2,i=[r-7];for(let s=1;s<e-1;s++)i[s]=i[s-1]-o;return i.push(6),i.reverse()};$.getPositions=function(t){let e=[],r=$.getRowColCoords(t),o=r.length;for(let i=0;i<o;i++)for(let s=0;s<o;s++)i===0&&s===0||i===0&&s===o-1||i===o-1&&s===0||e.push([r[i],r[s]]);return e}});var Gt=d(jt=>{var Xe=I().getSymbolSize,Ot=7;jt.getPositions=function(t){let e=Xe(t);return[[0,0],[e-Ot,0],[0,e-Ot]]}});var Qt=d(g=>{g.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var P={N1:3,N2:3,N3:40,N4:10};g.isValid=function(t){return t!=null&&t!==""&&!isNaN(t)&&t>=0&&t<=7};g.from=function(t){return g.isValid(t)?parseInt(t,10):void 0};g.getPenaltyN1=function(t){let e=t.size,r=0,o=0,i=0,s=null,u=null;for(let c=0;c<e;c++){o=i=0,s=u=null;for(let a=0;a<e;a++){let l=t.get(c,a);l===s?o++:(o>=5&&(r+=P.N1+(o-5)),s=l,o=1),l=t.get(a,c),l===u?i++:(i>=5&&(r+=P.N1+(i-5)),u=l,i=1)}o>=5&&(r+=P.N1+(o-5)),i>=5&&(r+=P.N1+(i-5))}return r};g.getPenaltyN2=function(t){let e=t.size,r=0;for(let o=0;o<e-1;o++)for(let i=0;i<e-1;i++){let s=t.get(o,i)+t.get(o,i+1)+t.get(o+1,i)+t.get(o+1,i+1);(s===4||s===0)&&r++}return r*P.N2};g.getPenaltyN3=function(t){let e=t.size,r=0,o=0,i=0;for(let s=0;s<e;s++){o=i=0;for(let u=0;u<e;u++)o=o<<1&2047|t.get(s,u),u>=10&&(o===1488||o===93)&&r++,i=i<<1&2047|t.get(u,s),u>=10&&(i===1488||i===93)&&r++}return r*P.N3};g.getPenaltyN4=function(t){let e=0,r=t.data.length;for(let i=0;i<r;i++)e+=t.data[i];return Math.abs(Math.ceil(e*100/r/5)-10)*P.N4};function ve(n,t,e){switch(n){case g.Patterns.PATTERN000:return(t+e)%2===0;case g.Patterns.PATTERN001:return t%2===0;case g.Patterns.PATTERN010:return e%3===0;case g.Patterns.PATTERN011:return(t+e)%3===0;case g.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(e/3))%2===0;case g.Patterns.PATTERN101:return t*e%2+t*e%3===0;case g.Patterns.PATTERN110:return(t*e%2+t*e%3)%2===0;case g.Patterns.PATTERN111:return(t*e%3+(t+e)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}g.applyMask=function(t,e){let r=e.size;for(let o=0;o<r;o++)for(let i=0;i<r;i++)e.isReserved(i,o)||e.xor(i,o,ve(t,i,o))};g.getBestMask=function(t,e){let r=Object.keys(g.Patterns).length,o=0,i=1/0;for(let s=0;s<r;s++){e(s),g.applyMask(s,t);let u=g.getPenaltyN1(t)+g.getPenaltyN2(t)+g.getPenaltyN3(t)+g.getPenaltyN4(t);g.applyMask(s,t),u<i&&(i=u,o=s)}return o}});var ft=d(lt=>{var S=Q(),W=[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],Z=[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];lt.getBlocksCount=function(t,e){switch(e){case S.L:return W[(t-1)*4+0];case S.M:return W[(t-1)*4+1];case S.Q:return W[(t-1)*4+2];case S.H:return W[(t-1)*4+3];default:return}};lt.getTotalCodewordsCount=function(t,e){switch(e){case S.L:return Z[(t-1)*4+0];case S.M:return Z[(t-1)*4+1];case S.Q:return Z[(t-1)*4+2];case S.H:return Z[(t-1)*4+3];default:return}}});var $t=d(v=>{var z=new Uint8Array(512),X=new Uint8Array(256);(function(){let t=1;for(let e=0;e<255;e++)z[e]=t,X[t]=e,t<<=1,t&256&&(t^=285);for(let e=255;e<512;e++)z[e]=z[e-255]})();v.log=function(t){if(t<1)throw new Error("log("+t+")");return X[t]};v.exp=function(t){return z[t]};v.mul=function(t,e){return t===0||e===0?0:z[X[t]+X[e]]}});var Wt=d(H=>{var dt=$t();H.mul=function(t,e){let r=new Uint8Array(t.length+e.length-1);for(let o=0;o<t.length;o++)for(let i=0;i<e.length;i++)r[o+i]^=dt.mul(t[o],e[i]);return r};H.mod=function(t,e){let r=new Uint8Array(t);for(;r.length-e.length>=0;){let o=r[0];for(let s=0;s<e.length;s++)r[s]^=dt.mul(e[s],o);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r};H.generateECPolynomial=function(t){let e=new Uint8Array([1]);for(let r=0;r<t;r++)e=H.mul(e,new Uint8Array([1,dt.exp(r)]));return e}});var vt=d((or,Xt)=>{var Zt=Wt();function gt(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree)}gt.prototype.initialize=function(t){this.degree=t,this.genPoly=Zt.generateECPolynomial(this.degree)};gt.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");let e=new Uint8Array(t.length+this.degree);e.set(t);let r=Zt.mod(e,this.genPoly),o=this.degree-r.length;if(o>0){let i=new Uint8Array(this.degree);return i.set(r,o),i}return r};Xt.exports=gt});var ht=d(te=>{te.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}});var pt=d(B=>{var ee="[0-9]+",tn="[A-Z $%*+\\-./:]+",V="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";V=V.replace(/u/g,"\\u");var en="(?:(?![A-Z0-9 $%*+\\-./:]|"+V+`)(?:.|[\r
|
|
2
|
+
]))+`;B.KANJI=new RegExp(V,"g");B.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");B.BYTE=new RegExp(en,"g");B.NUMERIC=new RegExp(ee,"g");B.ALPHANUMERIC=new RegExp(tn,"g");var nn=new RegExp("^"+V+"$"),rn=new RegExp("^"+ee+"$"),on=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");B.testKanji=function(t){return nn.test(t)};B.testNumeric=function(t){return rn.test(t)};B.testAlphanumeric=function(t){return on.test(t)}});var N=d(p=>{var sn=ht(),mt=pt();p.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};p.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};p.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};p.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};p.MIXED={bit:-1};p.getCharCountIndicator=function(t,e){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!sn.isValid(e))throw new Error("Invalid version: "+e);return e>=1&&e<10?t.ccBits[0]:e<27?t.ccBits[1]:t.ccBits[2]};p.getBestModeForData=function(t){return mt.testNumeric(t)?p.NUMERIC:mt.testAlphanumeric(t)?p.ALPHANUMERIC:mt.testKanji(t)?p.KANJI:p.BYTE};p.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")};p.isValid=function(t){return t&&t.bit&&t.ccBits};function un(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"numeric":return p.NUMERIC;case"alphanumeric":return p.ALPHANUMERIC;case"kanji":return p.KANJI;case"byte":return p.BYTE;default:throw new Error("Unknown mode: "+n)}}p.from=function(t,e){if(p.isValid(t))return t;try{return un(t)}catch{return e}}});var se=d(R=>{var tt=I(),cn=ft(),ne=Q(),M=N(),wt=ht(),oe=7973,re=tt.getBCHDigit(oe);function an(n,t,e){for(let r=1;r<=40;r++)if(t<=R.getCapacity(r,e,n))return r}function ie(n,t){return M.getCharCountIndicator(n,t)+4}function ln(n,t){let e=0;return n.forEach(function(r){let o=ie(r.mode,t);e+=o+r.getBitsLength()}),e}function fn(n,t){for(let e=1;e<=40;e++)if(ln(n,e)<=R.getCapacity(e,t,M.MIXED))return e}R.from=function(t,e){return wt.isValid(t)?parseInt(t,10):e};R.getCapacity=function(t,e,r){if(!wt.isValid(t))throw new Error("Invalid QR Code version");typeof r>"u"&&(r=M.BYTE);let o=tt.getSymbolTotalCodewords(t),i=cn.getTotalCodewordsCount(t,e),s=(o-i)*8;if(r===M.MIXED)return s;let u=s-ie(r,t);switch(r){case M.NUMERIC:return Math.floor(u/10*3);case M.ALPHANUMERIC:return Math.floor(u/11*2);case M.KANJI:return Math.floor(u/13);case M.BYTE:default:return Math.floor(u/8)}};R.getBestVersionForData=function(t,e){let r,o=ne.from(e,ne.M);if(Array.isArray(t)){if(t.length>1)return fn(t,o);if(t.length===0)return 1;r=t[0]}else r=t;return an(r.mode,r.getLength(),o)};R.getEncodedBits=function(t){if(!wt.isValid(t)||t<7)throw new Error("Invalid QR Code version");let e=t<<12;for(;tt.getBCHDigit(e)-re>=0;)e^=oe<<tt.getBCHDigit(e)-re;return t<<12|e}});var le=d(ae=>{var Et=I(),ce=1335,dn=21522,ue=Et.getBCHDigit(ce);ae.getEncodedBits=function(t,e){let r=t.bit<<3|e,o=r<<10;for(;Et.getBCHDigit(o)-ue>=0;)o^=ce<<Et.getBCHDigit(o)-ue;return(r<<10|o)^dn}});var de=d((lr,fe)=>{var gn=N();function q(n){this.mode=gn.NUMERIC,this.data=n.toString()}q.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)};q.prototype.getLength=function(){return this.data.length};q.prototype.getBitsLength=function(){return q.getBitsLength(this.data.length)};q.prototype.write=function(t){let e,r,o;for(e=0;e+3<=this.data.length;e+=3)r=this.data.substr(e,3),o=parseInt(r,10),t.put(o,10);let i=this.data.length-e;i>0&&(r=this.data.substr(e),o=parseInt(r,10),t.put(o,i*3+1))};fe.exports=q});var he=d((fr,ge)=>{var hn=N(),yt=["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 _(n){this.mode=hn.ALPHANUMERIC,this.data=n}_.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};_.prototype.getLength=function(){return this.data.length};_.prototype.getBitsLength=function(){return _.getBitsLength(this.data.length)};_.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let r=yt.indexOf(this.data[e])*45;r+=yt.indexOf(this.data[e+1]),t.put(r,11)}this.data.length%2&&t.put(yt.indexOf(this.data[e]),6)};ge.exports=_});var me=d((dr,pe)=>{var pn=N();function D(n){this.mode=pn.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n)}D.getBitsLength=function(t){return t*8};D.prototype.getLength=function(){return this.data.length};D.prototype.getBitsLength=function(){return D.getBitsLength(this.data.length)};D.prototype.write=function(n){for(let t=0,e=this.data.length;t<e;t++)n.put(this.data[t],8)};pe.exports=D});var Ee=d((gr,we)=>{var mn=N(),wn=I();function U(n){this.mode=mn.KANJI,this.data=n}U.getBitsLength=function(t){return t*13};U.prototype.getLength=function(){return this.data.length};U.prototype.getBitsLength=function(){return U.getBitsLength(this.data.length)};U.prototype.write=function(n){let t;for(t=0;t<this.data.length;t++){let e=wn.toSJIS(this.data[t]);if(e>=33088&&e<=40956)e-=33088;else if(e>=57408&&e<=60351)e-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
|
|
3
|
+
Make sure your charset is UTF-8`);e=(e>>>8&255)*192+(e&255),n.put(e,13)}};we.exports=U});var ye=d((hr,Ct)=>{"use strict";var K={single_source_shortest_paths:function(n,t,e){var r={},o={};o[t]=0;var i=K.PriorityQueue.make();i.push(t,0);for(var s,u,c,a,l,m,h,E,A;!i.empty();){s=i.pop(),u=s.value,a=s.cost,l=n[u]||{};for(c in l)l.hasOwnProperty(c)&&(m=l[c],h=a+m,E=o[c],A=typeof o[c]>"u",(A||E>h)&&(o[c]=h,i.push(c,h),r[c]=u))}if(typeof e<"u"&&typeof o[e]>"u"){var T=["Could not find a path from ",t," to ",e,"."].join("");throw new Error(T)}return r},extract_shortest_path_from_predecessor_list:function(n,t){for(var e=[],r=t,o;r;)e.push(r),o=n[r],r=n[r];return e.reverse(),e},find_path:function(n,t,e){var r=K.single_source_shortest_paths(n,t,e);return K.extract_shortest_path_from_predecessor_list(r,e)},PriorityQueue:{make:function(n){var t=K.PriorityQueue,e={},r;n=n||{};for(r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e.queue=[],e.sorter=n.sorter||t.default_sorter,e},default_sorter:function(n,t){return n.cost-t.cost},push:function(n,t){var e={value:n,cost:t};this.queue.push(e),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof Ct<"u"&&(Ct.exports=K)});var Me=d(F=>{var f=N(),Ae=de(),Te=he(),Ie=me(),Se=Ee(),J=pt(),et=I(),En=ye();function Ce(n){return unescape(encodeURIComponent(n)).length}function Y(n,t,e){let r=[],o;for(;(o=n.exec(e))!==null;)r.push({data:o[0],index:o.index,mode:t,length:o[0].length});return r}function Ne(n){let t=Y(J.NUMERIC,f.NUMERIC,n),e=Y(J.ALPHANUMERIC,f.ALPHANUMERIC,n),r,o;return et.isKanjiModeEnabled()?(r=Y(J.BYTE,f.BYTE,n),o=Y(J.KANJI,f.KANJI,n)):(r=Y(J.BYTE_KANJI,f.BYTE,n),o=[]),t.concat(e,r,o).sort(function(s,u){return s.index-u.index}).map(function(s){return{data:s.data,mode:s.mode,length:s.length}})}function Bt(n,t){switch(t){case f.NUMERIC:return Ae.getBitsLength(n);case f.ALPHANUMERIC:return Te.getBitsLength(n);case f.KANJI:return Se.getBitsLength(n);case f.BYTE:return Ie.getBitsLength(n)}}function yn(n){return n.reduce(function(t,e){let r=t.length-1>=0?t[t.length-1]:null;return r&&r.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)},[])}function Cn(n){let t=[];for(let e=0;e<n.length;e++){let r=n[e];switch(r.mode){case f.NUMERIC:t.push([r,{data:r.data,mode:f.ALPHANUMERIC,length:r.length},{data:r.data,mode:f.BYTE,length:r.length}]);break;case f.ALPHANUMERIC:t.push([r,{data:r.data,mode:f.BYTE,length:r.length}]);break;case f.KANJI:t.push([r,{data:r.data,mode:f.BYTE,length:Ce(r.data)}]);break;case f.BYTE:t.push([{data:r.data,mode:f.BYTE,length:Ce(r.data)}])}}return t}function Bn(n,t){let e={},r={start:{}},o=["start"];for(let i=0;i<n.length;i++){let s=n[i],u=[];for(let c=0;c<s.length;c++){let a=s[c],l=""+i+c;u.push(l),e[l]={node:a,lastCount:0},r[l]={};for(let m=0;m<o.length;m++){let h=o[m];e[h]&&e[h].node.mode===a.mode?(r[h][l]=Bt(e[h].lastCount+a.length,a.mode)-Bt(e[h].lastCount,a.mode),e[h].lastCount+=a.length):(e[h]&&(e[h].lastCount=a.length),r[h][l]=Bt(a.length,a.mode)+4+f.getCharCountIndicator(a.mode,t))}}o=u}for(let i=0;i<o.length;i++)r[o[i]].end=0;return{map:r,table:e}}function Be(n,t){let e,r=f.getBestModeForData(n);if(e=f.from(t,r),e!==f.BYTE&&e.bit<r.bit)throw new Error('"'+n+'" cannot be encoded with mode '+f.toString(e)+`.
|
|
4
|
+
Suggested mode is: `+f.toString(r));switch(e===f.KANJI&&!et.isKanjiModeEnabled()&&(e=f.BYTE),e){case f.NUMERIC:return new Ae(n);case f.ALPHANUMERIC:return new Te(n);case f.KANJI:return new Se(n);case f.BYTE:return new Ie(n)}}F.fromArray=function(t){return t.reduce(function(e,r){return typeof r=="string"?e.push(Be(r,null)):r.data&&e.push(Be(r.data,r.mode)),e},[])};F.fromString=function(t,e){let r=Ne(t,et.isKanjiModeEnabled()),o=Cn(r),i=Bn(o,e),s=En.find_path(i.map,"start","end"),u=[];for(let c=1;c<s.length-1;c++)u.push(i.table[s[c]].node);return F.fromArray(yn(u))};F.rawSplit=function(t){return F.fromArray(Ne(t,et.isKanjiModeEnabled()))}});var Pe=d(be=>{var rt=I(),At=Q(),An=Vt(),Tn=Jt(),In=Yt(),Sn=Gt(),St=Qt(),Nt=ft(),Nn=vt(),nt=se(),Mn=le(),bn=N(),Tt=Me();function Pn(n,t){let e=n.size,r=Sn.getPositions(t);for(let o=0;o<r.length;o++){let i=r[o][0],s=r[o][1];for(let u=-1;u<=7;u++)if(!(i+u<=-1||e<=i+u))for(let c=-1;c<=7;c++)s+c<=-1||e<=s+c||(u>=0&&u<=6&&(c===0||c===6)||c>=0&&c<=6&&(u===0||u===6)||u>=2&&u<=4&&c>=2&&c<=4?n.set(i+u,s+c,!0,!0):n.set(i+u,s+c,!1,!0))}}function Rn(n){let t=n.size;for(let e=8;e<t-8;e++){let r=e%2===0;n.set(e,6,r,!0),n.set(6,e,r,!0)}}function Ln(n,t){let e=In.getPositions(t);for(let r=0;r<e.length;r++){let o=e[r][0],i=e[r][1];for(let s=-2;s<=2;s++)for(let u=-2;u<=2;u++)s===-2||s===2||u===-2||u===2||s===0&&u===0?n.set(o+s,i+u,!0,!0):n.set(o+s,i+u,!1,!0)}}function xn(n,t){let e=n.size,r=nt.getEncodedBits(t),o,i,s;for(let u=0;u<18;u++)o=Math.floor(u/3),i=u%3+e-8-3,s=(r>>u&1)===1,n.set(o,i,s,!0),n.set(i,o,s,!0)}function It(n,t,e){let r=n.size,o=Mn.getEncodedBits(t,e),i,s;for(i=0;i<15;i++)s=(o>>i&1)===1,i<6?n.set(i,8,s,!0):i<8?n.set(i+1,8,s,!0):n.set(r-15+i,8,s,!0),i<8?n.set(8,r-i-1,s,!0):i<9?n.set(8,15-i-1+1,s,!0):n.set(8,15-i-1,s,!0);n.set(r-8,8,1,!0)}function qn(n,t){let e=n.size,r=-1,o=e-1,i=7,s=0;for(let u=e-1;u>0;u-=2)for(u===6&&u--;;){for(let c=0;c<2;c++)if(!n.isReserved(o,u-c)){let a=!1;s<t.length&&(a=(t[s]>>>i&1)===1),n.set(o,u-c,a),i--,i===-1&&(s++,i=7)}if(o+=r,o<0||e<=o){o-=r,r=-r;break}}}function _n(n,t,e){let r=new An;e.forEach(function(c){r.put(c.mode.bit,4),r.put(c.getLength(),bn.getCharCountIndicator(c.mode,n)),c.write(r)});let o=rt.getSymbolTotalCodewords(n),i=Nt.getTotalCodewordsCount(n,t),s=(o-i)*8;for(r.getLengthInBits()+4<=s&&r.put(0,4);r.getLengthInBits()%8!==0;)r.putBit(0);let u=(s-r.getLengthInBits())/8;for(let c=0;c<u;c++)r.put(c%2?17:236,8);return Dn(r,n,t)}function Dn(n,t,e){let r=rt.getSymbolTotalCodewords(t),o=Nt.getTotalCodewordsCount(t,e),i=r-o,s=Nt.getBlocksCount(t,e),u=r%s,c=s-u,a=Math.floor(r/s),l=Math.floor(i/s),m=l+1,h=a-l,E=new Nn(h),A=0,T=new Array(s),xt=new Array(s),st=0,He=new Uint8Array(n.buffer);for(let x=0;x<s;x++){let ct=x<c?l:m;T[x]=He.slice(A,A+ct),xt[x]=E.encode(T[x]),A+=ct,st=Math.max(st,ct)}let ut=new Uint8Array(r),qt=0,y,C;for(y=0;y<st;y++)for(C=0;C<s;C++)y<T[C].length&&(ut[qt++]=T[C][y]);for(y=0;y<h;y++)for(C=0;C<s;C++)ut[qt++]=xt[C][y];return ut}function Un(n,t,e,r){let o;if(Array.isArray(n))o=Tt.fromArray(n);else if(typeof n=="string"){let a=t;if(!a){let l=Tt.rawSplit(n);a=nt.getBestVersionForData(l,e)}o=Tt.fromString(n,a||40)}else throw new Error("Invalid data");let i=nt.getBestVersionForData(o,e);if(!i)throw new Error("The amount of data is too big to be stored in a QR Code");if(!t)t=i;else if(t<i)throw new Error(`
|
|
5
5
|
The chosen QR Code version cannot contain this amount of data.
|
|
6
6
|
Minimum version required to store current data is: `+i+`.
|
|
7
|
-
`);let s=
|
|
8
|
-
`;return typeof r=="function"&&r(null,
|
|
7
|
+
`);let s=_n(t,e,o),u=rt.getSymbolSize(t),c=new Tn(u);return Pn(c,t),Rn(c),Ln(c,t),It(c,e,0),t>=7&&xn(c,t),qn(c,s),isNaN(r)&&(r=St.getBestMask(c,It.bind(null,c,e))),St.applyMask(r,c),It(c,e,r),{modules:c,version:t,errorCorrectionLevel:e,maskPattern:r,segments:o}}be.create=function(t,e){if(typeof t>"u"||t==="")throw new Error("No input text");let r=At.M,o,i;return typeof e<"u"&&(r=At.from(e.errorCorrectionLevel,At.M),o=nt.from(e.version),i=St.from(e.maskPattern),e.toSJISFunc&&rt.setToSJISFunction(e.toSJISFunc)),Un(t,o,r,i)}});var Mt=d(L=>{function Re(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let t=n.slice().replace("#","").split("");if(t.length<3||t.length===5||t.length>8)throw new Error("Invalid hex color: "+n);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(r){return[r,r]}))),t.length===6&&t.push("F","F");let e=parseInt(t.join(""),16);return{r:e>>24&255,g:e>>16&255,b:e>>8&255,a:e&255,hex:"#"+t.slice(0,6).join("")}}L.getOptions=function(t){t||(t={}),t.color||(t.color={});let e=typeof t.margin>"u"||t.margin===null||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:e,color:{dark:Re(t.color.dark||"#000000ff"),light:Re(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}};L.getScale=function(t,e){return e.width&&e.width>=t+e.margin*2?e.width/(t+e.margin*2):e.scale};L.getImageWidth=function(t,e){let r=L.getScale(t,e);return Math.floor((t+e.margin*2)*r)};L.qrToImageData=function(t,e,r){let o=e.modules.size,i=e.modules.data,s=L.getScale(o,r),u=Math.floor((o+r.margin*2)*s),c=r.margin*s,a=[r.color.light,r.color.dark];for(let l=0;l<u;l++)for(let m=0;m<u;m++){let h=(l*u+m)*4,E=r.color.light;if(l>=c&&m>=c&&l<u-c&&m<u-c){let A=Math.floor((l-c)/s),T=Math.floor((m-c)/s);E=a[i[A*o+T]?1:0]}t[h++]=E.r,t[h++]=E.g,t[h++]=E.b,t[h]=E.a}}});var Le=d(ot=>{var bt=Mt();function Fn(n,t,e){n.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=e,t.width=e,t.style.height=e+"px",t.style.width=e+"px"}function kn(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}ot.render=function(t,e,r){let o=r,i=e;typeof o>"u"&&(!e||!e.getContext)&&(o=e,e=void 0),e||(i=kn()),o=bt.getOptions(o);let s=bt.getImageWidth(t.modules.size,o),u=i.getContext("2d"),c=u.createImageData(s,s);return bt.qrToImageData(c.data,t,o),Fn(u,i,s),u.putImageData(c,0,0),i};ot.renderToDataURL=function(t,e,r){let o=r;typeof o>"u"&&(!e||!e.getContext)&&(o=e,e=void 0),o||(o={});let i=ot.render(t,e,o),s=o.type||"image/png",u=o.rendererOpts||{};return i.toDataURL(s,u.quality)}});var _e=d(qe=>{var zn=Mt();function xe(n,t){let e=n.a/255,r=t+'="'+n.hex+'"';return e<1?r+" "+t+'-opacity="'+e.toFixed(2).slice(1)+'"':r}function Pt(n,t,e){let r=n+t;return typeof e<"u"&&(r+=" "+e),r}function Hn(n,t,e){let r="",o=0,i=!1,s=0;for(let u=0;u<n.length;u++){let c=Math.floor(u%t),a=Math.floor(u/t);!c&&!i&&(i=!0),n[u]?(s++,u>0&&c>0&&n[u-1]||(r+=i?Pt("M",c+e,.5+a+e):Pt("m",o,0),o=0,i=!1),c+1<t&&n[u+1]||(r+=Pt("h",s),s=0)):o++}return r}qe.render=function(t,e,r){let o=zn.getOptions(e),i=t.modules.size,s=t.modules.data,u=i+o.margin*2,c=o.color.light.a?"<path "+xe(o.color.light,"fill")+' d="M0 0h'+u+"v"+u+'H0z"/>':"",a="<path "+xe(o.color.dark,"stroke")+' d="'+Hn(s,i,o.margin)+'"/>',l='viewBox="0 0 '+u+" "+u+'"',h='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+l+' shape-rendering="crispEdges">'+c+a+`</svg>
|
|
8
|
+
`;return typeof r=="function"&&r(null,h),h}});var Ue=d(O=>{var Vn=kt(),Rt=Pe(),De=Le(),Kn=_e();function Lt(n,t,e,r,o){let i=[].slice.call(arguments,1),s=i.length,u=typeof i[s-1]=="function";if(!u&&!Vn())throw new Error("Callback required as last argument");if(u){if(s<2)throw new Error("Too few arguments provided");s===2?(o=e,e=t,t=r=void 0):s===3&&(t.getContext&&typeof o>"u"?(o=r,r=void 0):(o=r,r=e,e=t,t=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(e=t,t=r=void 0):s===2&&!t.getContext&&(r=e,e=t,t=void 0),new Promise(function(c,a){try{let l=Rt.create(e,r);c(n(l,t,r))}catch(l){a(l)}})}try{let c=Rt.create(e,r);o(null,n(c,t,r))}catch(c){o(c)}}O.create=Rt.create;O.toCanvas=Lt.bind(null,De.render);O.toDataURL=Lt.bind(null,De.renderToDataURL);O.toString=Lt.bind(null,function(n,t,e){return Kn.render(n,e)})});var Yn={};je(Yn,{QRcode:()=>it});var Dt=class G extends HTMLElement{memoizedTemplate(){let t=this.is();if(G.TEMPLATE_CACHE[t])return G.TEMPLATE_CACHE[t];let e=this.template();return window.ShadyCSS&&window.ShadyCSS.prepareTemplate(e,this.is()),G.TEMPLATE_CACHE[t]=e,e}connectedCallback(){let t=this.memoizedTemplate();window.ShadyCSS&&window.ShadyCSS.styleElement(this),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(document.importNode(t.content,!0)),requestAnimationFrame(()=>this.dispatchEvent(new CustomEvent("ready"))))}whenReady(t){this.shadowRoot?t():this.addEventListener("ready",()=>t())}};Dt.TEMPLATE_CACHE={};var Ut=Dt;var Fe=Ge(Ue(),1),Jn=`<style>
|
|
9
9
|
:host {
|
|
10
10
|
display: flex;
|
|
11
11
|
}
|
|
@@ -19,5 +19,5 @@ Minimum version required to store current data is: `+i+`.
|
|
|
19
19
|
}
|
|
20
20
|
</style>
|
|
21
21
|
<div id="qr-code-container"></div>
|
|
22
|
-
`,
|
|
22
|
+
`,ke=class ze extends Ut{is(){return ze.ID}get data(){return this.getAttribute("data")}set data(t){this.setAttribute("data",t)}get margin(){return this.hasAttribute("margin")?parseInt(this.getAttribute("margin")):1}set margin(t){this.setAttribute("margin",t.toString())}static get observedAttributes(){return["data","margin"]}generate(){if(!this.data||!this.shadowRoot)return;let t=this.shadowRoot.getElementById("qr-code-container");Fe.toString(this.data,{margin:this.margin}).then(e=>t.innerHTML=e)}template(){let t=document.createElement("template");return t.innerHTML=Jn,t}constructor(){super()}connectedCallback(){super.connectedCallback(),this.generate()}attributeChangedCallback(){this.generate()}};ke.ID="sd-qrcode";var it=ke;customElements.get(it.ID)||customElements.define(it.ID,it);return Qe(Yn);})();
|
|
23
23
|
//# sourceMappingURL=qrcode-with-externals.js.map
|