(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[6839],{91915:t=>{self,t.exports=(()=>{var t={192:(t,e)=>{var r,i,n=function(){var t=function(t,e){var r=t,i=a[e],n=null,o=0,h=null,v=[],w={},_=function(t,e){n=function(t){for(var e=new Array(t),r=0;r=7&&S(t),null==h&&(h=A(r,i,v)),C(h,e)},y=function(t,e){for(var r=-1;r<=7;r+=1)if(!(t+r<=-1||o<=t+r))for(var i=-1;i<=7;i+=1)e+i<=-1||o<=e+i||(n[t+r][e+i]=0<=r&&r<=6&&(0==i||6==i)||0<=i&&i<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=i&&i<=4)},b=function(){for(var t=8;t>i&1);n[Math.floor(i/3)][i%3+o-8-3]=a}for(i=0;i<18;i+=1)a=!t&&1==(e>>i&1),n[i%3+o-8-3][Math.floor(i/3)]=a},M=function(t,e){for(var r=i<<3|e,a=s.getBCHTypeInfo(r),h=0;h<15;h+=1){var u=!t&&1==(a>>h&1);h<6?n[h][8]=u:h<8?n[h+1][8]=u:n[o-15+h][8]=u}for(h=0;h<15;h+=1)u=!t&&1==(a>>h&1),h<8?n[8][o-h-1]=u:h<9?n[8][15-h-1+1]=u:n[8][15-h-1]=u;n[o-8][8]=!t},C=function(t,e){for(var r=-1,i=o-1,a=7,h=0,u=s.getMaskFunction(e),c=o-1;c>0;c-=2)for(6==c&&(c-=1);;){for(var d=0;d<2;d+=1)if(null==n[i][c-d]){var l=!1;h>>a&1)),u(i,c-d)&&(l=!l),n[i][c-d]=l,-1==(a-=1)&&(h+=1,a=7)}if((i+=r)<0||o<=i){i-=r,r=-r;break}}},A=function(t,e,r){for(var i=c.getRSBlocks(t,e),n=d(),o=0;o8*h)throw"code length overflow. ("+n.getLengthInBits()+">"+8*h+")";for(n.getLengthInBits()+4<=8*h&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(!1);for(;!(n.getLengthInBits()>=8*h||(n.put(236,8),n.getLengthInBits()>=8*h));)n.put(17,8);return function(t,e){for(var r=0,i=0,n=0,o=new Array(e.length),a=new Array(e.length),h=0;h=0?f.getAt(p):0}}var v=0;for(l=0;li)&&(t=i,e=r)}return e}())},w.createTableTag=function(t,e){t=t||2;var r="";r+='',r+="";for(var i=0;i";for(var n=0;n';r+=""}return(r+="")+"
"},w.createSvgTag=function(t,e,r,i){var n={};"object"==typeof arguments[0]&&(t=(n=arguments[0]).cellSize,e=n.margin,r=n.alt,i=n.title),t=t||2,e=void 0===e?4*t:e,(r="string"==typeof r?{text:r}:r||{}).text=r.text||null,r.id=r.text?r.id||"qrcode-description":null,(i="string"==typeof i?{text:i}:i||{}).text=i.text||null,i.id=i.text?i.id||"qrcode-title":null;var o,a,s,h,u=w.getModuleCount()*t+2*e,c="";for(h="l"+t+",0 0,"+t+" -"+t+",0 0,-"+t+"z ",c+=''+O(i.text)+"":"",c+=r.text?''+O(r.text)+"":"",c+='',c+='"},w.createDataURL=function(t,e){t=t||2,e=void 0===e?4*t:e;var r=w.getModuleCount()*t+2*e,i=e,n=r-e;return m(r,r,(function(e,r){if(i<=e&&e"};var O=function(t){for(var e="",r=0;r":e+=">";break;case"&":e+="&";break;case'"':e+=""";break;default:e+=i}}return e};return w.createASCII=function(t,e){if((t=t||1)<2)return function(t){t=void 0===t?2:t;var e,r,i,n,o,a=1*w.getModuleCount()+2*t,s=t,h=a-t,u={"██":"█","█ ":"▀"," █":"▄"," ":" "},c={"██":"▀","█ ":"▀"," █":" "," ":" "},d="";for(e=0;e=h?c[o]:u[o];d+="\n"}return a%2&&t>0?d.substring(0,d.length-a-1)+Array(a+1).join("▀"):d.substring(0,d.length-1)}(e);t-=1,e=void 0===e?2*t:e;var r,i,n,o,a=w.getModuleCount()*t+2*e,s=e,h=a-e,u=Array(t+1).join("██"),c=Array(t+1).join(" "),d="",l="";for(r=0;r>>8),e.push(255&a)):e.push(i)}}return e}};var e,r,i,n,o,a={L:1,M:0,Q:3,H:2},s=(e=[[],[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]],r=1335,i=7973,o=function(t){for(var e=0;0!=t;)e+=1,t>>>=1;return e},(n={}).getBCHTypeInfo=function(t){for(var e=t<<10;o(e)-o(r)>=0;)e^=r<=0;)e^=i<5&&(r+=3+o-5)}for(i=0;i=256;)e-=255;return t[e]}}}();function u(t,e){if(void 0===t.length)throw t.length+"/"+e;var r=function(){for(var r=0;r>>7-e%8&1)},put:function(t,e){for(var i=0;i>>e-i-1&1))},getLengthInBits:function(){return e},putBit:function(r){var i=Math.floor(e/8);t.length<=i&&t.push(0),r&&(t[i]|=128>>>e%8),e+=1}};return r},l=function(t){var e=t,r={getMode:function(){return 1},getLength:function(t){return e.length},write:function(t){for(var r=e,n=0;n+2>>8&255)+(255&n),t.put(n,13),r+=2}if(r>>8)},writeBytes:function(t,r,i){r=r||0,i=i||t.length;for(var n=0;n0&&(e+=","),e+=t[r];return e+"]"}};return e},w=function(t){var e=t,r=0,i=0,n=0,o={read:function(){for(;n<8;){if(r>=e.length){if(0==n)return-1;throw"unexpected end of file./"+n}var t=e.charAt(r);if(r+=1,"="==t)return n=0,-1;t.match(/^\s$/)||(i=i<<6|a(t.charCodeAt(0)),n+=6)}var o=i>>>n-8&255;return n-=8,o}},a=function(t){if(65<=t&&t<=90)return t-65;if(97<=t&&t<=122)return t-97+26;if(48<=t&&t<=57)return t-48+52;if(43==t)return 62;if(47==t)return 63;throw"c:"+t};return o},m=function(t,e,r){for(var i=function(t,e){var r=t,i=e,n=new Array(t*e),o={setPixel:function(t,e,i){n[e*r+t]=i},write:function(t){t.writeString("GIF87a"),t.writeShort(r),t.writeShort(i),t.writeByte(128),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(255),t.writeByte(255),t.writeByte(255),t.writeString(","),t.writeShort(0),t.writeShort(0),t.writeShort(r),t.writeShort(i),t.writeByte(0);var e=a(2);t.writeByte(2);for(var n=0;e.length-n>255;)t.writeByte(255),t.writeBytes(e,n,255),n+=255;t.writeByte(e.length-n),t.writeBytes(e,n,e.length-n),t.writeByte(0),t.writeString(";")}},a=function(t){for(var e=1<>>e!=0)throw"length over";for(;u+e>=8;)h.writeByte(255&(t<>>=8-u,c=0,u=0;c|=t<0&&h.writeByte(c)}});l.write(e,i);var g=0,f=String.fromCharCode(n[g]);for(g+=1;g=6;)o(t>>>e-6),e-=6},n.flush=function(){if(e>0&&(o(t<<6-e),t=0,e=0),r%3!=0)for(var n=3-r%3,a=0;a>6,128|63&i):i<55296||i>=57344?e.push(224|i>>12,128|i>>6&63,128|63&i):(r++,i=65536+((1023&i)<<10|1023&t.charCodeAt(r)),e.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|63&i))}return e}(t)},void 0===(i="function"==typeof(r=function(){return n})?r.apply(e,[]):r)||(t.exports=i)}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i](o,o.exports,r),o.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var i={};return(()=>{"use strict";r.d(i,{default:()=>M});const t=t=>!!t&&"object"==typeof t&&!Array.isArray(t);function e(r,...i){if(!i.length)return r;const n=i.shift();return void 0!==n&&t(r)&&t(n)?(r=Object.assign({},r),Object.keys(n).forEach((i=>{const o=r[i],a=n[i];Array.isArray(o)&&Array.isArray(a)?r[i]=a:t(o)&&t(a)?r[i]=e(Object.assign({},o),a):r[i]=a})),e(r,...i)):r}function n(t,e){const r=document.createElement("a");r.download=e,r.href=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}function o(t){return new Promise((e=>{const r=new FileReader;r.onloadend=()=>e(r.result),r.readAsDataURL(t)}))}const a={L:.07,M:.15,Q:.25,H:.3};class s{constructor({svg:t,type:e}){this._svg=t,this._type=e}draw(t,e,r,i){let n;switch(this._type){case"dots":n=this._drawDot;break;case"classy":n=this._drawClassy;break;case"classy-rounded":n=this._drawClassyRounded;break;case"rounded":n=this._drawRounded;break;case"extra-rounded":n=this._drawExtraRounded;break;default:n=this._drawSquare}n.call(this,{x:t,y:e,size:r,getNeighbor:i})}_rotateFigure({x:t,y:e,size:r,rotation:i=0,draw:n}){var o;const a=t+r/2,s=e+r/2;n(),null===(o=this._element)||void 0===o||o.setAttribute("transform",`rotate(${180*i/Math.PI},${a},${s})`)}_basicDot(t){const{size:e,x:r,y:i}=t;this._rotateFigure(Object.assign(Object.assign({},t),{draw:()=>{this._element=document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(r+e/2)),this._element.setAttribute("cy",String(i+e/2)),this._element.setAttribute("r",String(e/2))}}))}_basicSquare(t){const{size:e,x:r,y:i}=t;this._rotateFigure(Object.assign(Object.assign({},t),{draw:()=>{this._element=document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(r)),this._element.setAttribute("y",String(i)),this._element.setAttribute("width",String(e)),this._element.setAttribute("height",String(e))}}))}_basicSideRounded(t){const{size:e,x:r,y:i}=t;this._rotateFigure(Object.assign(Object.assign({},t),{draw:()=>{this._element=document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${r} ${i}v ${e}h `+e/2+`a ${e/2} ${e/2}, 0, 0, 0, 0 ${-e}`)}}))}_basicCornerRounded(t){const{size:e,x:r,y:i}=t;this._rotateFigure(Object.assign(Object.assign({},t),{draw:()=>{this._element=document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${r} ${i}v ${e}h ${e}v `+-e/2+`a ${e/2} ${e/2}, 0, 0, 0, ${-e/2} ${-e/2}`)}}))}_basicCornerExtraRounded(t){const{size:e,x:r,y:i}=t;this._rotateFigure(Object.assign(Object.assign({},t),{draw:()=>{this._element=document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${r} ${i}v ${e}h ${e}a ${e} ${e}, 0, 0, 0, ${-e} ${-e}`)}}))}_basicCornersRounded(t){const{size:e,x:r,y:i}=t;this._rotateFigure(Object.assign(Object.assign({},t),{draw:()=>{this._element=document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${r} ${i}v `+e/2+`a ${e/2} ${e/2}, 0, 0, 0, ${e/2} ${e/2}h `+e/2+"v "+-e/2+`a ${e/2} ${e/2}, 0, 0, 0, ${-e/2} ${-e/2}`)}}))}_drawDot({x:t,y:e,size:r}){this._basicDot({x:t,y:e,size:r,rotation:0})}_drawSquare({x:t,y:e,size:r}){this._basicSquare({x:t,y:e,size:r,rotation:0})}_drawRounded({x:t,y:e,size:r,getNeighbor:i}){const n=i?+i(-1,0):0,o=i?+i(1,0):0,a=i?+i(0,-1):0,s=i?+i(0,1):0,h=n+o+a+s;if(0!==h)if(h>2||n&&o||a&&s)this._basicSquare({x:t,y:e,size:r,rotation:0});else{if(2===h){let i=0;return n&&a?i=Math.PI/2:a&&o?i=Math.PI:o&&s&&(i=-Math.PI/2),void this._basicCornerRounded({x:t,y:e,size:r,rotation:i})}if(1===h){let i=0;return a?i=Math.PI/2:o?i=Math.PI:s&&(i=-Math.PI/2),void this._basicSideRounded({x:t,y:e,size:r,rotation:i})}}else this._basicDot({x:t,y:e,size:r,rotation:0})}_drawExtraRounded({x:t,y:e,size:r,getNeighbor:i}){const n=i?+i(-1,0):0,o=i?+i(1,0):0,a=i?+i(0,-1):0,s=i?+i(0,1):0,h=n+o+a+s;if(0!==h)if(h>2||n&&o||a&&s)this._basicSquare({x:t,y:e,size:r,rotation:0});else{if(2===h){let i=0;return n&&a?i=Math.PI/2:a&&o?i=Math.PI:o&&s&&(i=-Math.PI/2),void this._basicCornerExtraRounded({x:t,y:e,size:r,rotation:i})}if(1===h){let i=0;return a?i=Math.PI/2:o?i=Math.PI:s&&(i=-Math.PI/2),void this._basicSideRounded({x:t,y:e,size:r,rotation:i})}}else this._basicDot({x:t,y:e,size:r,rotation:0})}_drawClassy({x:t,y:e,size:r,getNeighbor:i}){const n=i?+i(-1,0):0,o=i?+i(1,0):0,a=i?+i(0,-1):0,s=i?+i(0,1):0;0!==n+o+a+s?n||a?o||s?this._basicSquare({x:t,y:e,size:r,rotation:0}):this._basicCornerRounded({x:t,y:e,size:r,rotation:Math.PI/2}):this._basicCornerRounded({x:t,y:e,size:r,rotation:-Math.PI/2}):this._basicCornersRounded({x:t,y:e,size:r,rotation:Math.PI/2})}_drawClassyRounded({x:t,y:e,size:r,getNeighbor:i}){const n=i?+i(-1,0):0,o=i?+i(1,0):0,a=i?+i(0,-1):0,s=i?+i(0,1):0;0!==n+o+a+s?n||a?o||s?this._basicSquare({x:t,y:e,size:r,rotation:0}):this._basicCornerExtraRounded({x:t,y:e,size:r,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:t,y:e,size:r,rotation:-Math.PI/2}):this._basicCornersRounded({x:t,y:e,size:r,rotation:Math.PI/2})}}class h{constructor({svg:t,type:e}){this._svg=t,this._type=e}draw(t,e,r,i){let n;switch(this._type){case"square":n=this._drawSquare;break;case"extra-rounded":n=this._drawExtraRounded;break;default:n=this._drawDot}n.call(this,{x:t,y:e,size:r,rotation:i})}_rotateFigure({x:t,y:e,size:r,rotation:i=0,draw:n}){var o;const a=t+r/2,s=e+r/2;n(),null===(o=this._element)||void 0===o||o.setAttribute("transform",`rotate(${180*i/Math.PI},${a},${s})`)}_basicDot(t){const{size:e,x:r,y:i}=t,n=e/7;this._rotateFigure(Object.assign(Object.assign({},t),{draw:()=>{this._element=document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${r+e/2} ${i}a ${e/2} ${e/2} 0 1 0 0.1 0zm 0 ${n}a ${e/2-n} ${e/2-n} 0 1 1 -0.1 0Z`)}}))}_basicSquare(t){const{size:e,x:r,y:i}=t,n=e/7;this._rotateFigure(Object.assign(Object.assign({},t),{draw:()=>{this._element=document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${r} ${i}v ${e}h ${e}v `+-e+"z"+`M ${r+n} ${i+n}h `+(e-2*n)+"v "+(e-2*n)+"h "+(2*n-e)+"z")}}))}_basicExtraRounded(t){const{size:e,x:r,y:i}=t,n=e/7;this._rotateFigure(Object.assign(Object.assign({},t),{draw:()=>{this._element=document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${r} ${i+2.5*n}v `+2*n+`a ${2.5*n} ${2.5*n}, 0, 0, 0, ${2.5*n} ${2.5*n}h `+2*n+`a ${2.5*n} ${2.5*n}, 0, 0, 0, ${2.5*n} ${2.5*-n}v `+-2*n+`a ${2.5*n} ${2.5*n}, 0, 0, 0, ${2.5*-n} ${2.5*-n}h `+-2*n+`a ${2.5*n} ${2.5*n}, 0, 0, 0, ${2.5*-n} ${2.5*n}`+`M ${r+2.5*n} ${i+n}h `+2*n+`a ${1.5*n} ${1.5*n}, 0, 0, 1, ${1.5*n} ${1.5*n}v `+2*n+`a ${1.5*n} ${1.5*n}, 0, 0, 1, ${1.5*-n} ${1.5*n}h `+-2*n+`a ${1.5*n} ${1.5*n}, 0, 0, 1, ${1.5*-n} ${1.5*-n}v `+-2*n+`a ${1.5*n} ${1.5*n}, 0, 0, 1, ${1.5*n} ${1.5*-n}`)}}))}_drawDot({x:t,y:e,size:r,rotation:i}){this._basicDot({x:t,y:e,size:r,rotation:i})}_drawSquare({x:t,y:e,size:r,rotation:i}){this._basicSquare({x:t,y:e,size:r,rotation:i})}_drawExtraRounded({x:t,y:e,size:r,rotation:i}){this._basicExtraRounded({x:t,y:e,size:r,rotation:i})}}class u{constructor({svg:t,type:e}){this._svg=t,this._type=e}draw(t,e,r,i){let n;n="square"===this._type?this._drawSquare:this._drawDot,n.call(this,{x:t,y:e,size:r,rotation:i})}_rotateFigure({x:t,y:e,size:r,rotation:i=0,draw:n}){var o;const a=t+r/2,s=e+r/2;n(),null===(o=this._element)||void 0===o||o.setAttribute("transform",`rotate(${180*i/Math.PI},${a},${s})`)}_basicDot(t){const{size:e,x:r,y:i}=t;this._rotateFigure(Object.assign(Object.assign({},t),{draw:()=>{this._element=document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(r+e/2)),this._element.setAttribute("cy",String(i+e/2)),this._element.setAttribute("r",String(e/2))}}))}_basicSquare(t){const{size:e,x:r,y:i}=t;this._rotateFigure(Object.assign(Object.assign({},t),{draw:()=>{this._element=document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(r)),this._element.setAttribute("y",String(i)),this._element.setAttribute("width",String(e)),this._element.setAttribute("height",String(e))}}))}_drawDot({x:t,y:e,size:r,rotation:i}){this._basicDot({x:t,y:e,size:r,rotation:i})}_drawSquare({x:t,y:e,size:r,rotation:i}){this._basicSquare({x:t,y:e,size:r,rotation:i})}}const c="circle";var d=function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))};const l=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],g=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class f{constructor(t){this._element=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(t.width)),this._element.setAttribute("height",String(t.height)),this._defs=document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._options=t}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}drawQR(t){return d(this,void 0,void 0,(function*(){const e=t.getModuleCount(),r=Math.min(this._options.width,this._options.height)-2*this._options.margin,i=this._options.shape===c?r/Math.sqrt(2):r,n=Math.floor(i/e);let o={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=t,this._options.image){if(yield this.loadImage(),!this._image)return;const{imageOptions:t,qrOptions:r}=this._options,i=t.imageSize*a[r.errorCorrectionLevel],s=Math.floor(i*e*e),h=this._image instanceof SVGImageElement?this._image.width.baseVal.value:this._image.naturalWidth,u=this._image instanceof SVGImageElement?this._image.height.baseVal.value:this._image.naturalHeight;o=function({originalHeight:t,originalWidth:e,maxHiddenDots:r,maxHiddenAxisDots:i,dotSize:n}){const o={x:0,y:0},a={x:0,y:0};if(t<0||e<0||r<=0||n<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const s=t&&e?t/e:1;return o.x=Math.floor(Math.sqrt(r/s)),o.x<=0&&(o.x=1),i&&ir||i&&i{var i,n,a,s,h,u;return!(this._options.imageOptions.hideBackgroundDots&&t>=(e-o.hideXDots)/2&&t<(e+o.hideXDots)/2&&r>=(e-o.hideYDots)/2&&r<(e+o.hideYDots)/2||(null===(i=l[t])||void 0===i?void 0:i[r])||(null===(n=l[t-e+7])||void 0===n?void 0:n[r])||(null===(a=l[t])||void 0===a?void 0:a[r-e+7])||(null===(s=g[t])||void 0===s?void 0:s[r])||(null===(h=g[t-e+7])||void 0===h?void 0:h[r])||(null===(u=g[t])||void 0===u?void 0:u[r-e+7]))})),this.drawCorners(),this._options.image&&(yield this.drawImage({width:o.width,height:o.height,count:e,dotSize:n}))}))}drawBackground(){var t,e,r;const i=this._element,n=this._options;if(i){const i=null===(t=n.backgroundOptions)||void 0===t?void 0:t.gradient,o=null===(e=n.backgroundOptions)||void 0===e?void 0:e.color;if((i||o)&&this._createColor({options:i,color:o,additionalRotation:0,x:0,y:0,height:n.height,width:n.width,name:"background-color"}),null===(r=n.backgroundOptions)||void 0===r?void 0:r.round){const t=Math.min(n.width,n.height),e=document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id","clip-path-background-color"),this._defs.appendChild(this._backgroundClipPath),e.setAttribute("x",String((n.width-t)/2)),e.setAttribute("y",String((n.height-t)/2)),e.setAttribute("width",String(t)),e.setAttribute("height",String(t)),e.setAttribute("rx",String(t/2*n.backgroundOptions.round)),this._backgroundClipPath.appendChild(e)}}}drawDots(t){var e,r;if(!this._qr)throw"QR code is not defined";const i=this._options,n=this._qr.getModuleCount();if(n>i.width||n>i.height)throw"The canvas is too small.";const o=Math.min(i.width,i.height)-2*i.margin,a=i.shape===c?o/Math.sqrt(2):o,h=Math.floor(a/n),u=Math.floor((i.width-n*h)/2),d=Math.floor((i.height-n*h)/2),l=new s({svg:this._element,type:i.dotsOptions.type});this._dotsClipPath=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id","clip-path-dot-color"),this._dotsClipPath.style.transformOrigin="center",this._dotsClipPath.style.transform="rotate(90deg) scale(1, -1)",this._defs.appendChild(this._dotsClipPath),this._createColor({options:null===(e=i.dotsOptions)||void 0===e?void 0:e.gradient,color:i.dotsOptions.color,additionalRotation:0,x:0,y:0,height:i.height,width:i.width,name:"dot-color"});for(let e=0;e!(e+r<0||i+o<0||e+r>=n||i+o>=n)&&!(t&&!t(e+r,i+o))&&!!this._qr&&this._qr.isDark(e+r,i+o))),l._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(l._element));if(i.shape===c){const t=Math.floor((o/h-n)/2),e=n+2*t,r=u-t*h,i=d-t*h,a=[],s=Math.floor(e/2);for(let r=0;r=t-1&&r<=e-t&&i>=t-1&&i<=e-t||Math.sqrt((r-s)*(r-s)+(i-s)*(i-s))>s?a[r][i]=0:a[r][i]=this._qr.isDark(i-2*t<0?i:i>=n?i-2*t:i-t,r-2*t<0?r:r>=n?r-2*t:r-t)?1:0}for(let t=0;t{var i;return!!(null===(i=a[t+e])||void 0===i?void 0:i[n+r])})),l._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(l._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const t=this._element,e=this._options;if(!t)throw"Element code is not defined";const r=this._qr.getModuleCount(),i=Math.min(e.width,e.height)-2*e.margin,n=e.shape===c?i/Math.sqrt(2):i,o=Math.floor(n/r),a=7*o,d=3*o,f=Math.floor((e.width-r*o)/2),p=Math.floor((e.height-r*o)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach((([t,i,n])=>{var c,v,w,m,_,y,b,x,S,M,C,A;const O=f+t*o*(r-7),$=p+i*o*(r-7);let D=this._dotsClipPath,k=this._dotsClipPath;if(((null===(c=e.cornersSquareOptions)||void 0===c?void 0:c.gradient)||(null===(v=e.cornersSquareOptions)||void 0===v?void 0:v.color))&&(D=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),D.setAttribute("id",`clip-path-corners-square-color-${t}-${i}`),this._defs.appendChild(D),this._cornersSquareClipPath=this._cornersDotClipPath=k=D,this._createColor({options:null===(w=e.cornersSquareOptions)||void 0===w?void 0:w.gradient,color:null===(m=e.cornersSquareOptions)||void 0===m?void 0:m.color,additionalRotation:n,x:O,y:$,height:a,width:a,name:`corners-square-color-${t}-${i}`})),null===(_=e.cornersSquareOptions)||void 0===_?void 0:_.type){const t=new h({svg:this._element,type:e.cornersSquareOptions.type});t.draw(O,$,a,n),t._element&&D&&D.appendChild(t._element)}else{const t=new s({svg:this._element,type:e.dotsOptions.type});for(let e=0;e{var n;return!!(null===(n=l[e+t])||void 0===n?void 0:n[r+i])})),t._element&&D&&D.appendChild(t._element))}if(((null===(b=e.cornersDotOptions)||void 0===b?void 0:b.gradient)||(null===(x=e.cornersDotOptions)||void 0===x?void 0:x.color))&&(k=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),k.setAttribute("id",`clip-path-corners-dot-color-${t}-${i}`),this._defs.appendChild(k),this._cornersDotClipPath=k,this._createColor({options:null===(S=e.cornersDotOptions)||void 0===S?void 0:S.gradient,color:null===(M=e.cornersDotOptions)||void 0===M?void 0:M.color,additionalRotation:n,x:O+2*o,y:$+2*o,height:d,width:d,name:`corners-dot-color-${t}-${i}`})),null===(C=e.cornersDotOptions)||void 0===C?void 0:C.type){const t=new u({svg:this._element,type:e.cornersDotOptions.type});t.draw(O+2*o,$+2*o,d,n),t._element&&k&&k.appendChild(t._element)}else{const t=new s({svg:this._element,type:e.dotsOptions.type});for(let e=0;e{var n;return!!(null===(n=g[e+t])||void 0===n?void 0:n[r+i])})),t._element&&k&&k.appendChild(t._element))}}))}loadImage(){return new Promise(((t,e)=>{const r=this._options,i=new Image;if(!r.image)return e("Image is not defined");"string"==typeof r.imageOptions.crossOrigin&&(i.crossOrigin=r.imageOptions.crossOrigin),this._image=i,i.onload=()=>{t()},i.src=r.image}))}drawImage({width:t,height:e,count:r,dotSize:i}){return d(this,void 0,void 0,(function*(){const n=this._options,a=Math.floor((n.width-r*i)/2),s=Math.floor((n.height-r*i)/2),h=a+n.imageOptions.margin+(r*i-t)/2,u=s+n.imageOptions.margin+(r*i-e)/2,c=t-2*n.imageOptions.margin,d=e-2*n.imageOptions.margin,l=document.createElementNS("http://www.w3.org/2000/svg","image");l.setAttribute("x",String(h)),l.setAttribute("y",String(u)),l.setAttribute("width",`${c}px`),l.setAttribute("height",`${d}px`);const g=yield function(t){return e=this,void 0,i=function*(){return fetch(t).then((t=>t.blob())).then(o)},new((r=void 0)||(r=Promise))((function(t,n){function o(t){try{s(i.next(t))}catch(t){n(t)}}function a(t){try{s(i.throw(t))}catch(t){n(t)}}function s(e){var i;e.done?t(e.value):(i=e.value,i instanceof r?i:new r((function(t){t(i)}))).then(o,a)}s((i=i.apply(e,[])).next())}));var e,r,i}(n.image||"");l.setAttribute("href",g||""),this._element.appendChild(l)}))}_createColor({options:t,color:e,additionalRotation:r,x:i,y:n,height:o,width:a,name:s}){const h=a>o?a:o,u=document.createElementNS("http://www.w3.org/2000/svg","rect");if(u.setAttribute("x",String(i)),u.setAttribute("y",String(n)),u.setAttribute("height",String(o)),u.setAttribute("width",String(a)),u.setAttribute("clip-path",`url('#clip-path-${s}')`),t){let e;if("radial"===t.type)e=document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),e.setAttribute("id",s),e.setAttribute("gradientUnits","userSpaceOnUse"),e.setAttribute("fx",String(i+a/2)),e.setAttribute("fy",String(n+o/2)),e.setAttribute("cx",String(i+a/2)),e.setAttribute("cy",String(n+o/2)),e.setAttribute("r",String(h/2));else{const h=((t.rotation||0)+r)%(2*Math.PI),u=(h+2*Math.PI)%(2*Math.PI);let c=i+a/2,d=n+o/2,l=i+a/2,g=n+o/2;u>=0&&u<=.25*Math.PI||u>1.75*Math.PI&&u<=2*Math.PI?(c-=a/2,d-=o/2*Math.tan(h),l+=a/2,g+=o/2*Math.tan(h)):u>.25*Math.PI&&u<=.75*Math.PI?(d-=o/2,c-=a/2/Math.tan(h),g+=o/2,l+=a/2/Math.tan(h)):u>.75*Math.PI&&u<=1.25*Math.PI?(c+=a/2,d+=o/2*Math.tan(h),l-=a/2,g-=o/2*Math.tan(h)):u>1.25*Math.PI&&u<=1.75*Math.PI&&(d+=o/2,c+=a/2/Math.tan(h),g-=o/2,l-=a/2/Math.tan(h)),e=document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),e.setAttribute("id",s),e.setAttribute("gradientUnits","userSpaceOnUse"),e.setAttribute("x1",String(Math.round(c))),e.setAttribute("y1",String(Math.round(d))),e.setAttribute("x2",String(Math.round(l))),e.setAttribute("y2",String(Math.round(g)))}t.colorStops.forEach((({offset:t,color:r})=>{const i=document.createElementNS("http://www.w3.org/2000/svg","stop");i.setAttribute("offset",100*t+"%"),i.setAttribute("stop-color",r),e.appendChild(i)})),u.setAttribute("fill",`url('#${s}')`),this._defs.appendChild(e)}else e&&u.setAttribute("fill",e);this._element.appendChild(u)}}const p="canvas",v={};for(let t=0;t<=40;t++)v[t]=t;const w={type:p,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:v[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000"},backgroundOptions:{round:0,color:"#fff"}};function m(t){const e=Object.assign({},t);if(!e.colorStops||!e.colorStops.length)throw"Field 'colorStops' is required in gradient";return e.rotation?e.rotation=Number(e.rotation):e.rotation=0,e.colorStops=e.colorStops.map((t=>Object.assign(Object.assign({},t),{offset:Number(t.offset)}))),e}function _(t){const e=Object.assign({},t);return e.width=Number(e.width),e.height=Number(e.height),e.margin=Number(e.margin),e.imageOptions=Object.assign(Object.assign({},e.imageOptions),{hideBackgroundDots:Boolean(e.imageOptions.hideBackgroundDots),imageSize:Number(e.imageOptions.imageSize),margin:Number(e.imageOptions.margin)}),e.margin>Math.min(e.width,e.height)&&(e.margin=Math.min(e.width,e.height)),e.dotsOptions=Object.assign({},e.dotsOptions),e.dotsOptions.gradient&&(e.dotsOptions.gradient=m(e.dotsOptions.gradient)),e.cornersSquareOptions&&(e.cornersSquareOptions=Object.assign({},e.cornersSquareOptions),e.cornersSquareOptions.gradient&&(e.cornersSquareOptions.gradient=m(e.cornersSquareOptions.gradient))),e.cornersDotOptions&&(e.cornersDotOptions=Object.assign({},e.cornersDotOptions),e.cornersDotOptions.gradient&&(e.cornersDotOptions.gradient=m(e.cornersDotOptions.gradient))),e.backgroundOptions&&(e.backgroundOptions=Object.assign({},e.backgroundOptions),e.backgroundOptions.gradient&&(e.backgroundOptions.gradient=m(e.backgroundOptions.gradient))),e}var y=r(192),b=r.n(y),x=function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))};class S{constructor(t){this._options=t?_(e(w,t)):w,this.update()}static _clearContainer(t){t&&(t.innerHTML="")}_setupSvg(){if(!this._qr)return;const t=new f(this._options);this._svg=t.getElement(),this._svgDrawingPromise=t.drawQR(this._qr).then((()=>{var e;this._svg&&(null===(e=this._extension)||void 0===e||e.call(this,t.getElement(),this._options))}))}_setupCanvas(){var t;this._qr&&(this._canvas=document.createElement("canvas"),this._canvas.width=this._options.width,this._canvas.height=this._options.height,this._setupSvg(),this._canvasDrawingPromise=null===(t=this._svgDrawingPromise)||void 0===t?void 0:t.then((()=>{if(!this._svg)return;const t=this._svg,e=(new XMLSerializer).serializeToString(t),r="data:image/svg+xml;base64,"+btoa(e),i=new Image;return new Promise((t=>{i.onload=()=>{var e,r;null===(r=null===(e=this._canvas)||void 0===e?void 0:e.getContext("2d"))||void 0===r||r.drawImage(i,0,0),t()},i.src=r}))})))}_getElement(t="png"){return x(this,void 0,void 0,(function*(){if(!this._qr)throw"QR code is empty";return"svg"===t.toLowerCase()?(this._svg&&this._svgDrawingPromise||this._setupSvg(),yield this._svgDrawingPromise,this._svg):(this._canvas&&this._canvasDrawingPromise||this._setupCanvas(),yield this._canvasDrawingPromise,this._canvas)}))}update(t){S._clearContainer(this._container),this._options=t?_(e(this._options,t)):this._options,this._options.data&&(this._qr=b()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(t){switch(!0){case/^[0-9]*$/.test(t):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(t):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===p?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(t){if(t){if("function"!=typeof t.appendChild)throw"Container should be a single DOM node";this._options.type===p?this._canvas&&t.appendChild(this._canvas):this._svg&&t.appendChild(this._svg),this._container=t}}applyExtension(t){if(!t)throw"Extension function should be defined.";this._extension=t,this.update()}deleteExtension(){this._extension=void 0,this.update()}getRawData(t="png"){return x(this,void 0,void 0,(function*(){if(!this._qr)throw"QR code is empty";const e=yield this._getElement(t);if(!e)return null;if("svg"===t.toLowerCase()){const t=(new XMLSerializer).serializeToString(e);return new Blob(['\r\n'+t],{type:"image/svg+xml"})}return new Promise((r=>e.toBlob(r,`image/${t}`,1)))}))}download(t){return x(this,void 0,void 0,(function*(){if(!this._qr)throw"QR code is empty";let e="png",r="qr";"string"==typeof t?(e=t,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):"object"==typeof t&&null!==t&&(t.name&&(r=t.name),t.extension&&(e=t.extension));const i=yield this._getElement(e);if(i)if("svg"===e.toLowerCase()){let t=(new XMLSerializer).serializeToString(i);t='\r\n'+t,n("data:image/svg+xml;charset=utf-8,"+encodeURIComponent(t),`${r}.svg`)}else n(i.toDataURL(`image/${e}`),`${r}.${e}`)}))}}const M=S})(),i.default})()}}]); //# sourceMappingURL=6839.7574ee59f6159101b320.js.map