var $t=Object.defineProperty;var Et=Object.getOwnPropertySymbols;var Qt=Object.prototype.hasOwnProperty,Gt=Object.prototype.propertyIsEnumerable;var Bt=(t,e,i)=>e in t?$t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,pt=(t,e)=>{for(var i in e||(e={}))Qt.call(e,i)&&Bt(t,i,e[i]);if(Et)for(var i of Et(e))Gt.call(e,i)&&Bt(t,i,e[i]);return t};var nt=(t,e,i)=>new Promise((r,n)=>{var o=a=>{try{c(i.next(a))}catch(l){n(l)}},s=a=>{try{c(i.throw(a))}catch(l){n(l)}},c=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);c((i=i.apply(t,e)).next())});import{p as Q}from"./propTypes-D_I3dZnw.js";import{d as qt,a as bt,p as At,n as Wt,i as L,B as Xt,A as Zt,u as _,e as xt,F as te,y as ee,ad as ne,aA as Tt,V as oe}from"./index-AFhnwzwZ.js";import{d as re}from"./refresh-right-Du3ZsAuC.js";var Y={},ie=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},Mt={},M={};let dt;const se=[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];M.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};M.getSymbolTotalCodewords=function(e){return se[e]};M.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};M.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');dt=e};M.isKanjiModeEnabled=function(){return typeof dt!="undefined"};M.toSJIS=function(e){return dt(e)};var Z={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+i)}}t.isValid=function(r){return r&&typeof r.bit!="undefined"&&r.bit>=0&&r.bit<4},t.from=function(r,n){if(t.isValid(r))return r;try{return e(r)}catch(o){return n}}})(Z);function Pt(){this.buffer=[],this.length=0}Pt.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let i=0;i>>e-i-1&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 ae=Pt;function j(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)}j.prototype.set=function(t,e,i,r){const n=t*this.size+e;this.data[n]=i,r&&(this.reservedBit[n]=!0)};j.prototype.get=function(t,e){return this.data[t*this.size+e]};j.prototype.xor=function(t,e,i){this.data[t*this.size+e]^=i};j.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var ce=j,Rt={};(function(t){const e=M.getSymbolSize;t.getRowColCoords=function(r){if(r===1)return[];const n=Math.floor(r/7)+2,o=e(r),s=o===145?26:Math.ceil((o-13)/(2*n-2))*2,c=[o-7];for(let a=1;a=0&&n<=7},t.from=function(n){return t.isValid(n)?parseInt(n,10):void 0},t.getPenaltyN1=function(n){const o=n.size;let s=0,c=0,a=0,l=null,d=null;for(let p=0;p=5&&(s+=e.N1+(c-5)),l=w,c=1),w=n.get(C,p),w===d?a++:(a>=5&&(s+=e.N1+(a-5)),d=w,a=1)}c>=5&&(s+=e.N1+(c-5)),a>=5&&(s+=e.N1+(a-5))}return s},t.getPenaltyN2=function(n){const o=n.size;let s=0;for(let c=0;c=10&&(c===1488||c===93)&&s++,a=a<<1&2047|n.get(d,l),d>=10&&(a===1488||a===93)&&s++}return s*e.N3},t.getPenaltyN4=function(n){let o=0;const s=n.data.length;for(let a=0;a=0;){const s=o[0];for(let a=0;a0){const o=new Uint8Array(this.degree);return o.set(r,n),o}return r};var ue=gt,Ut={},D={},ht={};ht.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var P={};const kt="[0-9]+",fe="[A-Z $%*+\\-./:]+";let J="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";J=J.replace(/u/g,"\\u");const de="(?:(?![A-Z0-9 $%*+\\-./:]|"+J+`)(?:.|[\r ]))+`;P.KANJI=new RegExp(J,"g");P.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");P.BYTE=new RegExp(de,"g");P.NUMERIC=new RegExp(kt,"g");P.ALPHANUMERIC=new RegExp(fe,"g");const ge=new RegExp("^"+J+"$"),he=new RegExp("^"+kt+"$"),we=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");P.testKanji=function(e){return ge.test(e)};P.testNumeric=function(e){return he.test(e)};P.testAlphanumeric=function(e){return we.test(e)};(function(t){const e=ht,i=P;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(o,s){if(!o.ccBits)throw new Error("Invalid mode: "+o);if(!e.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?o.ccBits[0]:s<27?o.ccBits[1]:o.ccBits[2]},t.getBestModeForData=function(o){return i.testNumeric(o)?t.NUMERIC:i.testAlphanumeric(o)?t.ALPHANUMERIC:i.testKanji(o)?t.KANJI:t.BYTE},t.toString=function(o){if(o&&o.id)return o.id;throw new Error("Invalid mode")},t.isValid=function(o){return o&&o.bit&&o.ccBits};function r(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.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: "+n)}}t.from=function(o,s){if(t.isValid(o))return o;try{return r(o)}catch(c){return s}}})(D);(function(t){const e=M,i=x,r=Z,n=D,o=ht,s=7973,c=e.getBCHDigit(s);function a(C,w,y){for(let u=1;u<=40;u++)if(w<=t.getCapacity(u,y,C))return u}function l(C,w){return n.getCharCountIndicator(C,w)+4}function d(C,w){let y=0;return C.forEach(function(u){const E=l(u.mode,w);y+=E+u.getBitsLength()}),y}function p(C,w){for(let y=1;y<=40;y++)if(d(C,y)<=t.getCapacity(y,w,n.MIXED))return y}t.from=function(w,y){return o.isValid(w)?parseInt(w,10):y},t.getCapacity=function(w,y,u){if(!o.isValid(w))throw new Error("Invalid QR Code version");typeof u=="undefined"&&(u=n.BYTE);const E=e.getSymbolTotalCodewords(w),f=i.getTotalCodewordsCount(w,y),m=(E-f)*8;if(u===n.MIXED)return m;const h=m-l(u,w);switch(u){case n.NUMERIC:return Math.floor(h/10*3);case n.ALPHANUMERIC:return Math.floor(h/11*2);case n.KANJI:return Math.floor(h/13);case n.BYTE:default:return Math.floor(h/8)}},t.getBestVersionForData=function(w,y){let u;const E=r.from(y,r.M);if(Array.isArray(w)){if(w.length>1)return p(w,E);if(w.length===0)return 1;u=w[0]}else u=w;return a(u.mode,u.getLength(),E)},t.getEncodedBits=function(w){if(!o.isValid(w)||w<7)throw new Error("Invalid QR Code version");let y=w<<12;for(;e.getBCHDigit(y)-c>=0;)y^=s<=0;)n^=zt<0&&(r=this.data.substr(i),n=parseInt(r,10),e.put(n,o*3+1))};var ye=k;const Ee=D,ot=["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 F(t){this.mode=Ee.ALPHANUMERIC,this.data=t}F.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};F.prototype.getLength=function(){return this.data.length};F.prototype.getBitsLength=function(){return F.getBitsLength(this.data.length)};F.prototype.write=function(e){let i;for(i=0;i+2<=this.data.length;i+=2){let r=ot.indexOf(this.data[i])*45;r+=ot.indexOf(this.data[i+1]),e.put(r,11)}this.data.length%2&&e.put(ot.indexOf(this.data[i]),6)};var Be=F;const pe=D;function z(t){this.mode=pe.BYTE,typeof t=="string"?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}z.getBitsLength=function(e){return e*8};z.prototype.getLength=function(){return this.data.length};z.prototype.getBitsLength=function(){return z.getBitsLength(this.data.length)};z.prototype.write=function(t){for(let e=0,i=this.data.length;e=33088&&i<=40956)i-=33088;else if(i>=57408&&i<=60351)i-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` Make sure your charset is UTF-8`);i=(i>>>8&255)*192+(i&255),t.put(i,13)}};var Ie=V,Ht={exports:{}};(function(t){var e={single_source_shortest_paths:function(i,r,n){var o={},s={};s[r]=0;var c=e.PriorityQueue.make();c.push(r,0);for(var a,l,d,p,C,w,y,u,E;!c.empty();){a=c.pop(),l=a.value,p=a.cost,C=i[l]||{};for(d in C)C.hasOwnProperty(d)&&(w=C[d],y=p+w,u=s[d],E=typeof s[d]=="undefined",(E||u>y)&&(s[d]=y,c.push(d,y),o[d]=l))}if(typeof n!="undefined"&&typeof s[n]=="undefined"){var f=["Could not find a path from ",r," to ",n,"."].join("");throw new Error(f)}return o},extract_shortest_path_from_predecessor_list:function(i,r){for(var n=[],o=r;o;)n.push(o),i[o],o=i[o];return n.reverse(),n},find_path:function(i,r,n){var o=e.single_source_shortest_paths(i,r,n);return e.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(i){var r=e.PriorityQueue,n={},o;i=i||{};for(o in r)r.hasOwnProperty(o)&&(n[o]=r[o]);return n.queue=[],n.sorter=i.sorter||r.default_sorter,n},default_sorter:function(i,r){return i.cost-r.cost},push:function(i,r){var n={value:i,cost:r};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=e})(Ht);var Se=Ht.exports;(function(t){const e=D,i=ye,r=Be,n=be,o=Ie,s=P,c=M,a=Se;function l(f){return unescape(encodeURIComponent(f)).length}function d(f,m,h){const g=[];let B;for(;(B=f.exec(h))!==null;)g.push({data:B[0],index:B.index,mode:m,length:B[0].length});return g}function p(f){const m=d(s.NUMERIC,e.NUMERIC,f),h=d(s.ALPHANUMERIC,e.ALPHANUMERIC,f);let g,B;return c.isKanjiModeEnabled()?(g=d(s.BYTE,e.BYTE,f),B=d(s.KANJI,e.KANJI,f)):(g=d(s.BYTE_KANJI,e.BYTE,f),B=[]),m.concat(h,g,B).sort(function(A,N){return A.index-N.index}).map(function(A){return{data:A.data,mode:A.mode,length:A.length}})}function C(f,m){switch(m){case e.NUMERIC:return i.getBitsLength(f);case e.ALPHANUMERIC:return r.getBitsLength(f);case e.KANJI:return o.getBitsLength(f);case e.BYTE:return n.getBitsLength(f)}}function w(f){return f.reduce(function(m,h){const g=m.length-1>=0?m[m.length-1]:null;return g&&g.mode===h.mode?(m[m.length-1].data+=h.data,m):(m.push(h),m)},[])}function y(f){const m=[];for(let h=0;h=0&&c<=6&&(a===0||a===6)||a>=0&&a<=6&&(c===0||c===6)||c>=2&&c<=4&&a>=2&&a<=4?t.set(o+c,s+a,!0,!0):t.set(o+c,s+a,!1,!0))}}function Ue(t){const e=t.size;for(let i=8;i>c&1)===1,t.set(n,o,s,!0),t.set(o,n,s,!0)}function st(t,e,i){const r=t.size,n=ve.getEncodedBits(e,i);let o,s;for(o=0;o<15;o++)s=(n>>o&1)===1,o<6?t.set(o,8,s,!0):o<8?t.set(o+1,8,s,!0):t.set(r-15+o,8,s,!0),o<8?t.set(8,r-o-1,s,!0):o<9?t.set(8,15-o-1+1,s,!0):t.set(8,15-o-1,s,!0);t.set(r-8,8,1,!0)}function ze(t,e){const i=t.size;let r=-1,n=i-1,o=7,s=0;for(let c=i-1;c>0;c-=2)for(c===6&&c--;;){for(let a=0;a<2;a++)if(!t.isReserved(n,c-a)){let l=!1;s>>o&1)===1),t.set(n,c-a,l),o--,o===-1&&(s++,o=7)}if(n+=r,n<0||i<=n){n-=r,r=-r;break}}}function Ve(t,e,i){const r=new Ne;i.forEach(function(a){r.put(a.mode.bit,4),r.put(a.getLength(),De.getCharCountIndicator(a.mode,t)),a.write(r)});const n=et.getSymbolTotalCodewords(t),o=ut.getTotalCodewordsCount(t,e),s=(n-o)*8;for(r.getLengthInBits()+4<=s&&r.put(0,4);r.getLengthInBits()%8!==0;)r.putBit(0);const c=(s-r.getLengthInBits())/8;for(let a=0;a=7&&Fe(a,e),ze(a,s),isNaN(r)&&(r=lt.getBestMask(a,st.bind(null,a,i))),lt.applyMask(r,a),st(a,i,r),{modules:a,version:e,errorCorrectionLevel:i,maskPattern:r,segments:n}}Mt.create=function(e,i){if(typeof e=="undefined"||e==="")throw new Error("No input text");let r=rt.M,n,o;return typeof i!="undefined"&&(r=rt.from(i.errorCorrectionLevel,rt.M),n=X.from(i.version),o=lt.from(i.maskPattern),i.toSJISFunc&&et.setToSJISFunction(i.toSJISFunc)),Oe(e,n,r,o)};var Ot={},wt={};(function(t){function e(i){if(typeof i=="number"&&(i=i.toString()),typeof i!="string")throw new Error("Color should be defined as hex string");let r=i.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+i);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(o){return[o,o]}))),r.length===6&&r.push("F","F");const n=parseInt(r.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+r.slice(0,6).join("")}}t.getOptions=function(r){r||(r={}),r.color||(r.color={});const n=typeof r.margin=="undefined"||r.margin===null||r.margin<0?4:r.margin,o=r.width&&r.width>=21?r.width:void 0,s=r.scale||4;return{width:o,scale:o?4:s,margin:n,color:{dark:e(r.color.dark||"#000000ff"),light:e(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},t.getScale=function(r,n){return n.width&&n.width>=r+n.margin*2?n.width/(r+n.margin*2):n.scale},t.getImageWidth=function(r,n){const o=t.getScale(r,n);return Math.floor((r+n.margin*2)*o)},t.qrToImageData=function(r,n,o){const s=n.modules.size,c=n.modules.data,a=t.getScale(s,o),l=Math.floor((s+o.margin*2)*a),d=o.margin*a,p=[o.color.light,o.color.dark];for(let C=0;C=d&&w>=d&&C0&&a>0&&t[c-1]||(r+=o?at("M",a+i,.5+l+i):at("m",n,0),n=0,o=!1),a+1':"",l="',d='viewBox="0 0 '+c+" "+c+'"',C=''+a+l+` `;return typeof r=="function"&&r(null,C),C};const Ye=ie,ft=Mt,Jt=Ot,je=Kt;function mt(t,e,i,r,n){const o=[].slice.call(arguments,1),s=o.length,c=typeof o[s-1]=="function";if(!c&&!Ye())throw new Error("Callback required as last argument");if(c){if(s<2)throw new Error("Too few arguments provided");s===2?(n=i,i=e,e=r=void 0):s===3&&(e.getContext&&typeof n=="undefined"?(n=r,r=void 0):(n=r,r=i,i=e,e=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(i=e,e=r=void 0):s===2&&!e.getContext&&(r=i,i=e,e=void 0),new Promise(function(a,l){try{const d=ft.create(i,r);a(t(d,e,r))}catch(d){l(d)}})}try{const a=ft.create(i,r);n(null,t(a,e,r))}catch(a){n(a)}}Y.create=ft.create;Y.toCanvas=mt.bind(null,Jt.render);Y.toDataURL=mt.bind(null,Jt.renderToDataURL);Y.toString=mt.bind(null,function(t,e,i){return je.render(t,i)});const $e={tag:Q.string.validate(t=>["canvas","img"].includes(t)).def("canvas"),text:{type:[String,Array],default:null},options:{type:Object,default:()=>({})},width:Q.number.def(200),logo:{type:[String,Object],default:()=>""},disabled:Q.bool.def(!1),disabledText:Q.string.def("")},Qe=qt({name:"ReQrcode",props:$e,emits:["done","click","disabled-click"],setup(t,{emit:e}){const{toCanvas:i,toDataURL:r}=Y,n=bt(!0),o=bt(null),s=At(()=>String(t.text)),c=At(()=>({width:t.width+"px",height:t.width+"px"})),a=()=>nt(this,null,function*(){yield ee();const u=ne(t.options||{});if(t.tag==="canvas"){u.errorCorrectionLevel=u.errorCorrectionLevel||p(_(s));const E=yield d(_(s),u);u.scale=t.width===0?void 0:t.width/E*4;const f=yield i(_(o),_(s),u);if(t.logo){const m=yield l(f);e("done",m),n.value=!1}else e("done",f.toDataURL()),n.value=!1}else{const E=yield r(s.value,pt({errorCorrectionLevel:"H",width:t.width},u));_(o).src=E,e("done",E),n.value=!1}});Wt(()=>s.value,u=>{u&&a()},{deep:!0,immediate:!0});const l=u=>{const E=u.width,f=Object.assign({logoSize:.15,bgColor:"#ffffff",borderSize:.05,crossOrigin:"anonymous",borderRadius:8,logoRadius:0},Tt(t.logo)?{}:t.logo),{logoSize:m=.15,bgColor:h="#ffffff",borderSize:g=.05,crossOrigin:B="anonymous",borderRadius:b=8,logoRadius:A=0}=f,N=Tt(t.logo)?t.logo:t.logo.src,S=E*m,I=E*(1-m)/2,R=E*(m+g),U=E*(1-m-g)/2,T=u.getContext("2d");if(!T)return;C(T)(U,U,R,R,b),T.fillStyle=h,T.fill();const H=new Image;(B||A)&&H.setAttribute("crossOrigin",B),H.src=N;const Yt=O=>{T.drawImage(O,I,I,S,S)},jt=O=>{const $=document.createElement("canvas");$.width=I+S,$.height=I+S;const Ct=$.getContext("2d");if(!Ct||!T||(Ct.drawImage(O,I,I,S,S),C(T)(I,I,S,S,A),!T))return;const yt=T.createPattern($,"no-repeat");yt&&(T.fillStyle=yt,T.fill())};return new Promise(O=>{H.onload=()=>{A?jt(H):Yt(H),O(u.toDataURL())}})},d=(u,E)=>nt(this,null,function*(){const f=document.createElement("canvas");return yield i(f,u,E),f.width}),p=u=>u.length>36?"M":u.length>16?"Q":"H",C=u=>(E,f,m,h,g)=>{const B=Math.min(m,h);return g>B/2&&(g=B/2),u.beginPath(),u.moveTo(E+g,f),u.arcTo(E+m,f,E+m,f+h,g),u.arcTo(E+m,f+h,E,f+h,g),u.arcTo(E,f+h,E,f,g),u.arcTo(E,f,E+m,f,g),u.closePath(),u},w=()=>{e("click")},y=()=>{e("disabled-click")};return()=>L(te,null,[Xt(L("div",{class:"qrcode relative inline-block",style:_(c)},[t.tag==="canvas"?L("canvas",{ref:o,onClick:w},null):L("img",{ref:o,onClick:w},null),t.disabled&&L("div",{class:"qrcode--disabled absolute top-0 left-0 flex w-full h-full items-center justify-center",onClick:y},[L("div",{class:"absolute top-[50%] left-[50%] font-bold"},[L(xt("iconify-icon-offline"),{class:"cursor-pointer",icon:re,width:"30",color:"var(--el-color-primary)"},null),L("div",null,[t.disabledText])])])]),[[Zt("loading"),_(n)]])])}}),Ze=oe(Qe);export{Ze as R};