UNPKG

@forward-software/reveal.js-qrcodes

Version:

Custom plugin for Reveal.js to show QR Codes by adding a single class to HTML elements

2 lines (1 loc) 19.9 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).RevealQRCodes=e()}(this,(function(){"use strict";var t,e;!function(t){t[t.MODE_NUMBER=1]="MODE_NUMBER",t[t.MODE_ALPHA_NUM=2]="MODE_ALPHA_NUM",t[t.MODE_8BIT_BYTE=4]="MODE_8BIT_BYTE",t[t.MODE_KANJI=8]="MODE_KANJI"}(t||(t={})),function(t){t[t.PATTERN000=0]="PATTERN000",t[t.PATTERN001=1]="PATTERN001",t[t.PATTERN010=2]="PATTERN010",t[t.PATTERN011=3]="PATTERN011",t[t.PATTERN100=4]="PATTERN100",t[t.PATTERN101=5]="PATTERN101",t[t.PATTERN110=6]="PATTERN110",t[t.PATTERN111=7]="PATTERN111"}(e||(e={}));const r=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],o=1335,n=7973;function s(t){var e;return"number"!=typeof t||t<1||null===l[t]||"number"!=typeof l[t]?0:null!==(e=l[t])&&void 0!==e?e:0}function i(t){if("number"!=typeof t)return 0;for(;t<0;)t+=255;for(;t>=256;)t-=255;return a[t]}const a=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,1],l=[null,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175];class u{constructor(t,e){if(void 0===t.length)throw new Error(t.length+"/"+e);let r=0;for(;r<t.length&&0===t[r];)r++;this.num=new Array(t.length-r+e);for(let e=0;e<t.length-r;e++)this.num[e]=t[e+r]}get(t){return this.num[t]}getLength(){return this.num.length}multiply(t){const e=new Array(this.getLength()+t.getLength()-1);for(let r=0;r<this.getLength();r++)for(let o=0;o<t.getLength();o++)e[r+o]^=i(s(this.get(r))+s(t.get(o)));return new u(e,0)}mod(t){if(this.getLength()-t.getLength()<0)return this;const e=s(this.get(0))-s(t.get(0)),r=new Array(this.getLength());for(let t=0;t<this.getLength();t++)r[t]=this.get(t);for(let o=0;o<t.getLength();o++)r[o]^=i(s(t.get(o))+e);return new u(r,0).mod(t)}}function c(t){let e=0;for(;0!==t;)e++,t>>>=1;return e}function h(t,r,o){switch(t){case e.PATTERN000:return(r+o)%2==0;case e.PATTERN001:return r%2==0;case e.PATTERN010:return o%3==0;case e.PATTERN011:return(r+o)%3==0;case e.PATTERN100:return(Math.floor(r/2)+Math.floor(o/3))%2==0;case e.PATTERN101:return r*o%2+r*o%3==0;case e.PATTERN110:return(r*o%2+r*o%3)%2==0;case e.PATTERN111:return(r*o%3+(r+o)%2)%2==0;default:throw new Error(`bad maskPattern: ${t}`)}}function d(t){const e=t.getModuleCount();let r=0;for(let o=0;o<e;o++)for(let n=0;n<e;n++){let s=0;const i=t.isDark(o,n);for(let r=-1;r<=1;r++)if(!(o+r<0||e<=o+r))for(let a=-1;a<=1;a++)n+a<0||e<=n+a||0===r&&0===a||i===t.isDark(o+r,n+a)&&s++;s>5&&(r+=3+s-5)}for(let o=0;o<e-1;o++)for(let n=0;n<e-1;n++){let e=0;t.isDark(o,n)&&e++,t.isDark(o+1,n)&&e++,t.isDark(o,n+1)&&e++,t.isDark(o+1,n+1)&&e++,0!==e&&4!==e||(r+=3)}for(let o=0;o<e;o++)for(let n=0;n<e-6;n++)t.isDark(o,n)&&!t.isDark(o,n+1)&&t.isDark(o,n+2)&&t.isDark(o,n+3)&&t.isDark(o,n+4)&&!t.isDark(o,n+5)&&t.isDark(o,n+6)&&(r+=40);for(let o=0;o<e;o++)for(let n=0;n<e-6;n++)t.isDark(n,o)&&!t.isDark(n+1,o)&&t.isDark(n+2,o)&&t.isDark(n+3,o)&&t.isDark(n+4,o)&&!t.isDark(n+5,o)&&t.isDark(n+6,o)&&(r+=40);let o=0;for(let r=0;r<e;r++)for(let n=0;n<e;n++)t.isDark(n,r)&&o++;return r+=10*(Math.abs(100*o/e/e-50)/5),r}function f(t){return t>65536?[240|(1835008&t)>>>18,128|(258048&t)>>>12,128|(4032&t)>>>6,128|63&t]:t>2048?[224|(61440&t)>>>12,128|(4032&t)>>>6,128|63&t]:t>128?[192|(1984&t)>>>6,128|63&t]:[t]}function g(e){const r=function(t){const e=[];for(let r=0;r<t.length;r++){const o=f(t.charCodeAt(r));e.push(...o)}return e.length!==t.length&&e.unshift(239,187,191),e}(e);return{data:r,length:r.length,mode:t.MODE_8BIT_BYTE}}function m(e,r){const o={data:[],length:0};return r.reduce(((r,o)=>{let n=E(r,o.mode,4);return n=E(n,o.length,function(e,r){if(r>40)throw new Error(`type: ${r}`);if(1<=r&&r<10)switch(e.mode){case t.MODE_NUMBER:return 10;case t.MODE_ALPHA_NUM:return 9;case t.MODE_8BIT_BYTE:case t.MODE_KANJI:return 8;default:throw new Error(`mode: ${e.mode}`)}if(r<27)switch(e.mode){case t.MODE_NUMBER:return 12;case t.MODE_ALPHA_NUM:return 11;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 10;default:throw new Error(`mode: ${e.mode}`)}switch(e.mode){case t.MODE_NUMBER:return 14;case t.MODE_ALPHA_NUM:return 13;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 12;default:throw new Error(`mode: ${e.mode}`)}}(o,e)),function(t,e){return e.data.reduce(((t,e)=>E(t,e,8)),t)}(n,o)}),o)}function E(t,e,r){if(e<0||e>=1<<r)throw new Error(`Number ${e} is too large for ${r} bits`);let o=Object.assign({},t);for(let t=0;t<r;t++)o=p(o,1==(e>>>r-t-1&1));return o}function p(t,e){const r=Object.assign({},t),o=Math.floor(r.length/8);return r.data.length<=o&&(r.data=[...r.data,0]),e&&(r.data[o]|=128>>>r.length%8),r.length++,r}function A(t,e){const r=function(t,e){switch(e){case 1:return D[4*(t-1)+0];case 0:return D[4*(t-1)+1];case 3:return D[4*(t-1)+2];case 2:return D[4*(t-1)+3];default:return}}(t,e);if(!r)throw new Error("bad RS block @ type:"+t+"/errorCorrectLevel:"+e);const o=r.length/3,n=[];for(let t=0;t<o;t++){const e=r[3*t+0],o=r[3*t+1],s=r[3*t+2];for(let t=0;t<e;t++)n.push({dataCount:s,totalCount:o})}return n}const D=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];class T{constructor(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=[],this.moduleCount=0,this.dataCache=void 0,this.dataList=[]}static createData(t,e,r){const o=A(t,e),n=function(t){return t.reduce(((t,e)=>t+e.dataCount),0)}(o);let s=m(t,r);if(!function(t,e){return t.length<=8*e}(s,n))throw new Error(`code length overflow. (${s.length})`);return s=function(t,e){let r={data:[...(o=t).data],length:o.length};var o;for(r.length+4<=8*e&&(r=E(r,0,4));r.length%8!=0;)r=p(r,!1);for(;r.length<8*e&&(r=E(r,236,8),!(r.length>=8*e));)r=E(r,17,8);return r}(s,n),this.createBytes(s,o)}static createBytes(t,e){const{dcdata:r,ecdata:o,maxDcCount:n,maxEcCount:s}=this.prepareDataBlocks(t,e);return this.interleaveData(r,o,n,s,e)}static prepareDataBlocks(t,e){let r=0,o=0,n=0;const s=new Array(e.length),i=new Array(e.length);return e.forEach(((e,a)=>{const{dcCount:l,ecCount:u}=this.processBlock(e,t,r,a,s,i);o=Math.max(o,l),n=Math.max(n,u),r+=l})),{dcdata:s,ecdata:i,maxDcCount:o,maxEcCount:n}}static processBlock(t,e,r,o,n,s){const i=t.dataCount,a=t.totalCount-i;return n[o]=this.extractData(e,r,i),s[o]=this.generateErrorCorrection(n[o],a),{dcCount:i,ecCount:a}}static extractData(t,e,r){return Array.from({length:r},((r,o)=>255&function(t,e){if(e<0||e>=t.length)throw new Error("Index out of bounds");return t.data[e]}(t,o+e)))}static generateErrorCorrection(t,e){const r=function(t){let e=new u([1],0);for(let r=0;r<t;r++)e=e.multiply(new u([1,i(r)],0));return e}(e),o=new u(t,r.getLength()-1).mod(r);return Array.from({length:r.getLength()-1},((t,e)=>{const n=e+o.getLength()-(r.getLength()-1);return n>=0?o.get(n):0}))}static interleaveData(t,e,r,o,n){const s=n.reduce(((t,e)=>t+e.totalCount),0),i=new Array(s);let a=0;for(let e=0;e<r;e++)for(let r=0;r<n.length;r++)e<t[r].length&&(i[a++]=t[r][e]);for(let t=0;t<o;t++)for(let r=0;r<n.length;r++)t<e[r].length&&(i[a++]=e[r][t]);return i}addData(t){this.dataList.push(g(t)),this.dataCache=void 0}isDark(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(`${t},${e}`);return this.modules[t][e]||!1}getModuleCount(){return this.moduleCount}make(){this.makeImpl(!1,this.getBestMaskPattern())}makeImpl(t,e){this.initializeModules(),this.setupPatterns(t,e),this.mapData(this.getDataCache(),e)}initializeModules(){this.moduleCount=4*this.typeNumber+17,this.modules=Array(this.moduleCount).fill(null).map((()=>Array(this.moduleCount).fill(null)))}setupPatterns(t,e){this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),this.typeNumber>=7&&this.setupTypeNumber(t)}getDataCache(){return this.dataCache||(this.dataCache=T.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.dataCache}setupPositionProbePattern(t,e){for(let r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(let o=-1;o<=7;o++){if(e+o<=-1||this.moduleCount<=e+o)continue;const n=0<=r&&r<=6&&(0===o||6===o)||0<=o&&o<=6&&(0===r||6===r)||2<=r&&r<=4&&2<=o&&o<=4;this.modules[t+r][e+o]=n}}getBestMaskPattern(){let t=0,e=0;for(let r=0;r<8;r++){this.makeImpl(!0,r);const o=d(this);(0===r||t>o)&&(t=o,e=r)}return e}setupTimingPattern(){for(let t=8;t<this.moduleCount-8;t++)null==this.modules[t][6]&&(this.modules[t][6]=t%2==0);for(let t=8;t<this.moduleCount-8;t++)null==this.modules[6][t]&&(this.modules[6][t]=t%2==0)}setupPositionAdjustPattern(){const t=(e=this.typeNumber,r[e-1]);var e;t.forEach((e=>{t.forEach((t=>{if(null==this.modules[e][t])for(let r=-2;r<=2;r++)for(let o=-2;o<=2;o++)this.modules[e+r][t+o]=-2===r||2===r||-2===o||2===o||0===r&&0===o}))}))}setupTypeNumber(t){const e=function(t){let e=t<<12;for(;c(e)-c(n)>=0;)e^=n<<c(e)-c(n);return t<<12|e}(this.typeNumber);for(let r=0;r<18;r++){const o=!t&&1==(e>>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=o}for(let r=0;r<18;r++){const o=!t&&1==(e>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=o}}setupTypeInfo(t,e){const r=function(t){let e=t<<10;for(;c(e)-c(o)>=0;)e^=o<<c(e)-c(o);return 21522^(t<<10|e)}(this.errorCorrectLevel<<3|e);for(let e=0;e<15;e++){const o=!t&&1==(r>>e&1);e<6?this.modules[e][8]=o:e<8?this.modules[e+1][8]=o:this.modules[this.moduleCount-15+e][8]=o}for(let e=0;e<15;e++){const o=!t&&1==(r>>e&1);e<8?this.modules[8][this.moduleCount-e-1]=o:e<9?this.modules[8][15-e-1+1]=o:this.modules[8][15-e-1]=o}this.modules[this.moduleCount-8][8]=!t}mapData(t,e){let r=-1,o=this.moduleCount-1,n=7,s=0;for(let i=this.moduleCount-1;i>0;i-=2)for(6===i&&i--;;){for(let r=0;r<2;r++)if(null==this.modules[o][i-r]){const a=this.getNextBit(t,s,n),l=h(e,o,i-r);this.modules[o][i-r]=l?!a:a,n--,-1===n&&(s++,n=7)}if(o+=r,o<0||this.moduleCount<=o){o-=r,r=-r;break}}}getNextBit(t,e,r){return e<t.length&&1==(t[e]>>>r&1)}}const C=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],M={size:256,colorDark:"#000000",colorLight:"#ffffff",correctionLevel:"H"};class k{constructor(t,e){this.content=t,this.options=Object.assign(Object.assign({},M),e||{})}static from(t){return new k(t)}withOptions(t){return this.options=Object.assign(Object.assign({},M),t||{}),this}renderTo(t){const e=function(t,e,r){const o=new T(t,function(t){switch(t){case"L":return 1;case"M":return 0;case"Q":return 3;default:return 2}}(e));return o.addData(r),o.make(),o}(this.options.type||function(t,e){const r=function(t){let e=0;for(let r=0;r<t.length;r++){const o=t.charCodeAt(r);o<128?e+=1:o<2048?e+=2:o<65536?e+=3:o<2097152&&(e+=4)}return e}(t);let o=1;for(let t=0,n=C.length;t<=n;t++){let n=0;switch(e){case"L":n=C[t][0];break;case"M":n=C[t][1];break;case"Q":n=C[t][2];break;case"H":n=C[t][3]}if(r<=n)break;o++}if(o>C.length)throw new Error("Too long data");return o}(this.content,this.options.correctionLevel),this.options.correctionLevel,this.content);return t.draw(e,this.options)}clearFrom(t){return t.clear()}}function w(t){return"undefined"!=typeof CanvasRenderingContext2D?function(t){const e="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";let r=null,o=null,n=null,s=null;function i(t,r){if(null===s){const r=document.createElement("img"),o=()=>{s=!1},n=()=>{s=!0,t&&t()};r.onabort=o,r.onerror=o,r.onload=n,r.src=e}else!0===s&&t&&t()}function a(){r&&n&&(n.src=r.toDataURL("image/png"),n.style.display="block",r.style.display="none")}function l(){return!(!r||!o)&&(o.clearRect(0,0,r.width,r.height),!0)}function u(e,s){var u,c,h,d;r||(r=document.createElement("canvas"),r.width=null!==(u=s.size)&&void 0!==u?u:0,r.height=null!==(c=s.size)&&void 0!==c?c:0,t.appendChild(r)),o||(o=r.getContext("2d")),n||(n=document.createElement("img"),n.alt="Scan me!",n.style.display="none",t.appendChild(n));const f=e.getModuleCount(),g=(null!==(h=s.size)&&void 0!==h?h:0)/f,m=(null!==(d=s.size)&&void 0!==d?d:0)/f,E=Math.round(g),p=Math.round(m);l();for(let t=0;t<f;t++)for(let r=0;r<f;r++){const n=e.isDark(t,r),i=r*g,a=t*m;o.strokeStyle=n?s.colorDark:s.colorLight,o.lineWidth=1,o.fillStyle=n?s.colorDark:s.colorLight,o.fillRect(i,a,g,m),o.strokeRect(Math.floor(i)+.5,Math.floor(a)+.5,E,p),o.strokeRect(Math.ceil(i)-.5,Math.ceil(a)-.5,E,p)}const[A,D]=function(){const t=navigator.userAgent;if(/android/i.test(t)){const e=t.toString().match(/android ([0-9]\.[0-9])/i);if(e&&e[1]){const t=parseFloat(e[1]);return[!!t,t]}return[!0,0]}return[!1,-1]}();return(!A||D>=3)&&i(a),!0}return{draw:(t,e)=>u(t,e),clear:()=>l()}}(t):function(t){function e(e,r){const o=e.getModuleCount(),n=Math.floor(r.size/o),s=Math.floor(r.size/o),i=['<table style="border:0;border-collapse:collapse;">'];for(let t=0;t<o;t++){i.push("<tr>");for(let a=0;a<o;a++)i.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:'+n+"px;height:"+s+"px;background-color:"+(e.isDark(t,a)?r.colorDark:r.colorLight)+';"></td>');i.push("</tr>")}i.push("</table>"),t.innerHTML=i.join("");const a=t.childNodes[0],l=(r.size-a.offsetWidth)/2,u=(r.size-a.offsetHeight)/2;return l>0&&u>0&&(a.style.margin=u+"px "+l+"px"),!0}function r(){return t.innerHTML="",!0}return{draw:e,clear:r}}(t)}var L;!function(t){t[t.L=1]="L",t[t.M=0]="M",t[t.Q=3]="Q",t[t.H=2]="H"}(L||(L={})),L.H;const N={selector:".qrcode",size:256,colorDark:"#000000",colorLight:"#ffffff",correctionLevel:"H",configurations:{}};return()=>({id:"qrcodes",init:function(t){const e=t.getConfig(),r=Object.assign({},N,e.qrcodes);window.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll(r.selector).forEach((function(t){let e={text:t.dataset.text||t.href,size:t.dataset.size||r.size,colorDark:t.dataset.colorDark||r.colorDark,colorLight:t.dataset.colorLight||r.colorLight,correctionLevel:t.dataset.correctionLevel||r.correctionLevel};r.configurations[t.id]&&(e={...e,...r.configurations[t.id]}),k.from(e.text).withOptions({size:e.size,colorDark:e.colorDark,colorLight:e.colorLight,correctionLevel:e.correctionLevel}).renderTo(w(t))}))}))}})}));