/* Copyright © 2024 Melbet - All Rights Reserved */ import{defineComponent as L,ref as B,onUpdated as U,h as I,onMounted as K}from"../../../../shared-assets/__shared_vue_deps_4ZTCVFCX.js";/*! * qrcode.vue v3.4.1 * A Vue.js component to generate QRCode. * © 2017-2023 @scopewu(https://github.com/scopewu) * MIT License. */var O=function(){return O=Object.assign||function(h){for(var f,s=1,c=arguments.length;sn.MAX_VERSION)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=e*4+17;for(var a=[],i=0;i7)throw new RangeError("Invalid value");var l,d;for(l=t;;l++){var m=n.getNumDataCodewords(l,r)*8,C=v.getTotalBits(e,l);if(C<=m){d=C;break}if(l>=o)throw new RangeError("Data too long")}for(var E=0,p=[n.Ecc.MEDIUM,n.Ecc.QUARTILE,n.Ecc.HIGH];E>>3]|=G<<7-(Q&7)}),new n(l,r,b,a)},n.prototype.getModule=function(e,r){return 0<=e&&e>>9)*1335;var a=(r<<10|t)^21522;c(a>>>15==0);for(var o=0;o<=5;o++)this.setFunctionModule(8,o,s(a,o));this.setFunctionModule(8,7,s(a,6)),this.setFunctionModule(8,8,s(a,7)),this.setFunctionModule(7,8,s(a,8));for(var o=9;o<15;o++)this.setFunctionModule(14-o,8,s(a,o));for(var o=0;o<8;o++)this.setFunctionModule(this.size-1-o,8,s(a,o));for(var o=8;o<15;o++)this.setFunctionModule(8,this.size-15+o,s(a,o));this.setFunctionModule(8,this.size-8,!0)},n.prototype.drawVersion=function(){if(!(this.version<7)){for(var e=this.version,r=0;r<12;r++)e=e<<1^(e>>>11)*7973;var t=this.version<<12|e;c(t>>>18==0);for(var r=0;r<18;r++){var o=s(t,r),a=this.size-11+r%3,i=Math.floor(r/3);this.setFunctionModule(a,i,o),this.setFunctionModule(i,a,o)}}},n.prototype.drawFinderPattern=function(e,r){for(var t=-4;t<=4;t++)for(var o=-4;o<=4;o++){var a=Math.max(Math.abs(o),Math.abs(t)),i=e+o,l=r+t;0<=i&&i=l)&&w.push(S[R])})},E=0;E=1;t-=2){t==6&&(t=5);for(var o=0;o>>3],7-(r&7)),r++)}}c(r==e.length*8)},n.prototype.applyMask=function(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(var r=0;r5&&e++):(this.finderPenaltyAddHistory(o,a),t||(e+=this.finderPenaltyCountPatterns(a)*n.PENALTY_N3),t=this.modules[r][i],o=1);e+=this.finderPenaltyTerminateAndCount(t,o,a)*n.PENALTY_N3}for(var i=0;i5&&e++):(this.finderPenaltyAddHistory(l,a),t||(e+=this.finderPenaltyCountPatterns(a)*n.PENALTY_N3),t=this.modules[r][i],l=1);e+=this.finderPenaltyTerminateAndCount(t,l,a)*n.PENALTY_N3}for(var r=0;rn.MAX_VERSION)throw new RangeError("Version number out of range");var r=(16*e+128)*e+64;if(e>=2){var t=Math.floor(e/7)+2;r-=(25*t-10)*t-55,e>=7&&(r-=36)}return c(208<=r&&r<=29648),r},n.getNumDataCodewords=function(e,r){return Math.floor(n.getNumRawDataModules(e)/8)-n.ECC_CODEWORDS_PER_BLOCK[r.ordinal][e]*n.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][e]},n.reedSolomonComputeDivisor=function(e){if(e<1||e>255)throw new RangeError("Degree out of range");for(var r=[],t=0;t>>8||r>>>8)throw new RangeError("Byte out of range");for(var t=0,o=7;o>=0;o--)t=t<<1^(t>>>7)*285,t^=(r>>>o&1)*e;return c(t>>>8==0),t},n.prototype.finderPenaltyCountPatterns=function(e){var r=e[1];c(r<=this.size*3);var t=r>0&&e[2]==r&&e[3]==r*3&&e[4]==r&&e[5]==r;return(t&&e[0]>=r*4&&e[6]>=r?1:0)+(t&&e[6]>=r*4&&e[0]>=r?1:0)},n.prototype.finderPenaltyTerminateAndCount=function(e,r,t){return e&&(this.finderPenaltyAddHistory(r,t),r=0),r+=this.size,this.finderPenaltyAddHistory(r,t),this.finderPenaltyCountPatterns(t)},n.prototype.finderPenaltyAddHistory=function(e,r){r[0]==0&&(e+=this.size),r.pop(),r.unshift(e)},n.MIN_VERSION=1,n.MAX_VERSION=40,n.PENALTY_N1=3,n.PENALTY_N2=3,n.PENALTY_N3=40,n.PENALTY_N4=10,n.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],n.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],n}();u.QrCode=h;function f(n,e,r){if(e<0||e>31||n>>>e)throw new RangeError("Value out of range");for(var t=e-1;t>=0;t--)r.push(n>>>t&1)}function s(n,e){return(n>>>e&1)!=0}function c(n){if(!n)throw new Error("Assertion error")}var v=function(){function n(e,r,t){if(this.mode=e,this.numChars=r,this.bitData=t,r<0)throw new RangeError("Invalid argument");this.bitData=t.slice()}return n.makeBytes=function(e){for(var r=[],t=0,o=e;t=1<-1}}}),X=L({name:"QRCodeSvg",props:D,setup:function(u){var h=B(0),f=B(""),s=function(){var c=u.value,v=u.level,n=u.margin,e=P.QrCode.encodeText(c,T[v]).getModules();h.value=e.length+n*2,f.value=H(e,n)};return s(),U(s),function(){return I("svg",{width:u.size,height:u.size,"shape-rendering":"crispEdges",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(h.value," ").concat(h.value)},[I("path",{fill:u.background,d:"M0,0 h".concat(h.value,"v").concat(h.value,"H0z")}),I("path",{fill:u.foreground,d:f.value})])}}}),J=L({name:"QRCodeCanvas",props:D,setup:function(u){var h=B(null),f=function(){var s=u.value,c=u.level,v=u.size,n=u.margin,e=u.background,r=u.foreground,t=h.value;if(t){var o=t.getContext("2d");if(o){var a=P.QrCode.encodeText(s,T[c]).getModules(),i=a.length+n*2,l=window.devicePixelRatio||1,d=v/i*l;t.height=t.width=v*l,o.scale(d,d),o.fillStyle=e,o.fillRect(0,0,i,i),o.fillStyle=r,W?o.fill(new Path2D(H(a,n))):a.forEach(function(m,C){m.forEach(function(E,p){E&&o.fillRect(p+n,C+n,1,1)})})}}};return K(f),U(f),function(){return I("canvas",{ref:h,style:{width:"".concat(u.size,"px"),height:"".concat(u.size,"px")}})}}}),Z=L({name:"Qrcode",render:function(){var u=this.$props,h=u.renderAs,f=u.value,s=u.size,c=u.margin,v=u.level,n=u.background,e=u.foreground,r=s>>>0,t=c>>>0,o=y(v)?v:k;return I(h==="svg"?X:J,{value:f,size:r,margin:t,level:o,background:n,foreground:e})},props:$});export{Z as QrcodeVue};