import{d as Vt,af as $,r as Ct,e as At,M as qt,B as $t,o as ot,c as bt,j as Zt,N as Xt,Z as Bt,a as D,k as It,i as Wt,t as Gt,l as te,av as ee,a1 as ne,K as re,_ as oe,am as ie,at as se,aA as Tt}from"./index-03f5d926.js";import{_ as ae}from"./_plugin-vue_export-helper-1b428a4d.js";var O={},Mt={},L={};let it;const ue=[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];L.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 4*t+17},L.getSymbolTotalCodewords=function(t){return ue[t]},L.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e},L.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');it=t},L.isKanjiModeEnabled=function(){return it!==void 0},L.toSJIS=function(t){return it(t)};var S,Z={};function Pt(){this.buffer=[],this.length=0}(S=Z).L={bit:1},S.M={bit:0},S.Q={bit:3},S.H={bit:2},S.isValid=function(t){return t&&t.bit!==void 0&&t.bit>=0&&t.bit<4},S.from=function(t,e){if(S.isValid(t))return t;try{return function(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return S.L;case"m":case"medium":return S.M;case"q":case"quartile":return S.Q;case"h":case"high":return S.H;default:throw new Error("Unknown EC Level: "+r)}}(t)}catch{return e}},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 r=0;r>>e-r-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 ce=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,r,n){const i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)},j.prototype.get=function(t,e){return this.data[t*this.size+e]},j.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r},j.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var le=j,Nt={};(function(t){const e=L.getSymbolSize;t.getRowColCoords=function(r){if(r===1)return[];const n=Math.floor(r/7)+2,i=e(r),a=i===145?26:2*Math.ceil((i-13)/(2*n-2)),o=[i-7];for(let l=1;l=0&&o<=7},t.from=function(o){return t.isValid(o)?parseInt(o,10):void 0},t.getPenaltyN1=function(o){const l=o.size;let f=0,s=0,u=0,c=null,d=null;for(let w=0;w=5&&(f+=e+(s-5)),c=p,s=1),p=o.get(h,w),p===d?u++:(u>=5&&(f+=e+(u-5)),d=p,u=1)}s>=5&&(f+=e+(s-5)),u>=5&&(f+=e+(u-5))}return f},t.getPenaltyN2=function(o){const l=o.size;let f=0;for(let s=0;s=10&&(s===1488||s===93)&&f++,u=u<<1&2047|o.get(d,c),d>=10&&(u===1488||u===93)&&f++}return f*n},t.getPenaltyN4=function(o){let l=0;const f=o.data.length;for(let s=0;s=0;){const a=i[0];for(let l=0;l0){const i=new Uint8Array(this.degree);return i.set(r,n),i}return r};var de=st,Ut={},z={},kt={isValid:function(t){return!isNaN(t)&&t>=1&&t<=40}},U={};const zt="[0-9]+";let 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");const he="(?:(?![A-Z0-9 $%*+\\-./:]|"+V+`)(?:.|[\r ]))+`;U.KANJI=new RegExp(V,"g"),U.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),U.BYTE=new RegExp(he,"g"),U.NUMERIC=new RegExp(zt,"g"),U.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const ge=new RegExp("^"+V+"$"),pe=new RegExp("^"+zt+"$"),we=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");U.testKanji=function(t){return ge.test(t)},U.testNumeric=function(t){return pe.test(t)},U.testAlphanumeric=function(t){return we.test(t)},function(t){const e=kt,r=U;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(n,i){if(!n.ccBits)throw new Error("Invalid mode: "+n);if(!e.isValid(i))throw new Error("Invalid version: "+i);return i>=1&&i<10?n.ccBits[0]:i<27?n.ccBits[1]:n.ccBits[2]},t.getBestModeForData=function(n){return r.testNumeric(n)?t.NUMERIC:r.testAlphanumeric(n)?t.ALPHANUMERIC:r.testKanji(n)?t.KANJI:t.BYTE},t.toString=function(n){if(n&&n.id)return n.id;throw new Error("Invalid mode")},t.isValid=function(n){return n&&n.bit&&n.ccBits},t.from=function(n,i){if(t.isValid(n))return n;try{return function(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.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: "+a)}}(n)}catch{return i}}}(z),function(t){const e=L,r=X,n=Z,i=z,a=kt,o=e.getBCHDigit(7973);function l(s,u){return i.getCharCountIndicator(s,u)+4}function f(s,u){let c=0;return s.forEach(function(d){const w=l(d.mode,u);c+=w+d.getBitsLength()}),c}t.from=function(s,u){return a.isValid(s)?parseInt(s,10):u},t.getCapacity=function(s,u,c){if(!a.isValid(s))throw new Error("Invalid QR Code version");c===void 0&&(c=i.BYTE);const d=8*(e.getSymbolTotalCodewords(s)-r.getTotalCodewordsCount(s,u));if(c===i.MIXED)return d;const w=d-l(c,s);switch(c){case i.NUMERIC:return Math.floor(w/10*3);case i.ALPHANUMERIC:return Math.floor(w/11*2);case i.KANJI:return Math.floor(w/13);case i.BYTE:default:return Math.floor(w/8)}},t.getBestVersionForData=function(s,u){let c;const d=n.from(u,n.M);if(Array.isArray(s)){if(s.length>1)return function(w,h){for(let p=1;p<=40;p++)if(f(w,p)<=t.getCapacity(p,h,i.MIXED))return p}(s,d);if(s.length===0)return 1;c=s[0]}else c=s;return function(w,h,p){for(let g=1;g<=40;g++)if(h<=t.getCapacity(g,p,w))return g}(c.mode,c.getLength(),d)},t.getEncodedBits=function(s){if(!a.isValid(s)||s<7)throw new Error("Invalid QR Code version");let u=s<<12;for(;e.getBCHDigit(u)-o>=0;)u^=7973<=0;)n^=1335<0&&(r=this.data.substr(e),n=parseInt(r,10),t.put(n,3*i+1))};var ye=F;const Ee=z,ut=["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 H(t){this.mode=Ee.ALPHANUMERIC,this.data=t}H.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},H.prototype.getLength=function(){return this.data.length},H.prototype.getBitsLength=function(){return H.getBitsLength(this.data.length)},H.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let r=45*ut.indexOf(this.data[e]);r+=ut.indexOf(this.data[e+1]),t.put(r,11)}this.data.length%2&&t.put(ut.indexOf(this.data[e]),6)};var ve=H;const Ce=z;function K(t){this.mode=Ce.BYTE,this.data=typeof t=="string"?new TextEncoder().encode(t):new Uint8Array(t)}K.getBitsLength=function(t){return 8*t},K.prototype.getLength=function(){return this.data.length},K.prototype.getBitsLength=function(){return K.getBitsLength(this.data.length)},K.prototype.write=function(t){for(let e=0,r=this.data.length;e=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[e]+` Make sure your charset is UTF-8`);r-=49472}r=192*(r>>>8&255)+(255&r),t.put(r,13)}};var Ie=J,Ht={exports:{}};(function(t){var e={single_source_shortest_paths:function(r,n,i){var a={},o={};o[n]=0;var l,f,s,u,c,d,w,h=e.PriorityQueue.make();for(h.push(n,0);!h.empty();)for(s in f=(l=h.pop()).value,u=l.cost,c=r[f]||{})c.hasOwnProperty(s)&&(d=u+c[s],w=o[s],(o[s]===void 0||w>d)&&(o[s]=d,h.push(s,d),a[s]=f));if(i!==void 0&&o[i]===void 0){var p=["Could not find a path from ",n," to ",i,"."].join("");throw new Error(p)}return a},extract_shortest_path_from_predecessor_list:function(r,n){for(var i=[],a=n;a;)i.push(a),r[a],a=r[a];return i.reverse(),i},find_path:function(r,n,i){var a=e.single_source_shortest_paths(r,n,i);return e.extract_shortest_path_from_predecessor_list(a,i)},PriorityQueue:{make:function(r){var n,i=e.PriorityQueue,a={};for(n in r=r||{},i)i.hasOwnProperty(n)&&(a[n]=i[n]);return a.queue=[],a.sorter=r.sorter||i.default_sorter,a},default_sorter:function(r,n){return r.cost-n.cost},push:function(r,n){var i={value:r,cost:n};this.queue.push(i),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=e})(Ht);var Te=Ht.exports;(function(t){const e=z,r=ye,n=ve,i=Ae,a=Ie,o=U,l=L,f=Te;function s(h){return unescape(encodeURIComponent(h)).length}function u(h,p,g){const v=[];let m;for(;(m=h.exec(g))!==null;)v.push({data:m[0],index:m.index,mode:p,length:m[0].length});return v}function c(h){const p=u(o.NUMERIC,e.NUMERIC,h),g=u(o.ALPHANUMERIC,e.ALPHANUMERIC,h);let v,m;return l.isKanjiModeEnabled()?(v=u(o.BYTE,e.BYTE,h),m=u(o.KANJI,e.KANJI,h)):(v=u(o.BYTE_KANJI,e.BYTE,h),m=[]),p.concat(g,v,m).sort(function(E,y){return E.index-y.index}).map(function(E){return{data:E.data,mode:E.mode,length:E.length}})}function d(h,p){switch(p){case e.NUMERIC:return r.getBitsLength(h);case e.ALPHANUMERIC:return n.getBitsLength(h);case e.KANJI:return a.getBitsLength(h);case e.BYTE:return i.getBitsLength(h)}}function w(h,p){let g;const v=e.getBestModeForData(h);if(g=e.from(p,v),g!==e.BYTE&&g.bit=0?A[A.length-1]:null;return C&&C.mode===b.mode?(A[A.length-1].data+=b.data,A):(A.push(b),A)},[])}(E))},t.rawSplit=function(h){return t.fromArray(c(h,l.isKanjiModeEnabled()))}})(Ft);const nt=L,ct=Z,Me=ce,Pe=le,Ne=Nt,Re=Rt,lt=Lt,ft=X,Le=de,rt=Ut,xe=Dt,Se=z,dt=Ft;function ht(t,e,r){const n=t.size,i=xe.getEncodedBits(e,r);let a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?t.set(a,8,o,!0):a<8?t.set(a+1,8,o,!0):t.set(n-15+a,8,o,!0),a<8?t.set(8,n-a-1,o,!0):a<9?t.set(8,15-a-1+1,o,!0):t.set(8,15-a-1,o,!0);t.set(n-8,8,1,!0)}function Ue(t,e,r){const n=new Me;r.forEach(function(o){n.put(o.mode.bit,4),n.put(o.getLength(),Se.getCharCountIndicator(o.mode,t)),o.write(n)});const i=8*(nt.getSymbolTotalCodewords(t)-ft.getTotalCodewordsCount(t,e));for(n.getLengthInBits()+4<=i&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(0);const a=(i-n.getLengthInBits())/8;for(let o=0;o=0&&g<=6&&(v===0||v===6)||v>=0&&v<=6&&(g===0||g===6)||g>=2&&g<=4&&v>=2&&v<=4?s.set(h+g,p+v,!0,!0):s.set(h+g,p+v,!1,!0))}}(f,e),function(s){const u=s.size;for(let c=8;c=7&&function(s,u){const c=s.size,d=rt.getEncodedBits(u);let w,h,p;for(let g=0;g<18;g++)w=Math.floor(g/3),h=g%3+c-8-3,p=(d>>g&1)==1,s.set(w,h,p,!0),s.set(h,w,p,!0)}(f,e),function(s,u){const c=s.size;let d=-1,w=c-1,h=7,p=0;for(let g=c-1;g>0;g-=2)for(g===6&&g--;;){for(let v=0;v<2;v++)if(!s.isReserved(w,g-v)){let m=!1;p>>h&1)==1),s.set(w,g-v,m),h--,h===-1&&(p++,h=7)}if(w+=d,w<0||c<=w){w-=d,d=-d;break}}}(f,o),isNaN(n)&&(n=lt.getBestMask(f,ht.bind(null,f,r))),lt.applyMask(n,f),ht(f,r,n),{modules:f,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}Mt.create=function(t,e){if(t===void 0||t==="")throw new Error("No input text");let r,n,i=ct.M;return e!==void 0&&(i=ct.from(e.errorCorrectionLevel,ct.M),r=rt.from(e.version),n=lt.from(e.maskPattern),e.toSJISFunc&&nt.setToSJISFunction(e.toSJISFunc)),ke(t,r,i,n)};var Kt={},gt={};(function(t){function e(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let n=r.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+r);n.length!==3&&n.length!==4||(n=Array.prototype.concat.apply([],n.map(function(a){return[a,a]}))),n.length===6&&n.push("F","F");const i=parseInt(n.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:255&i,hex:"#"+n.slice(0,6).join("")}}t.getOptions=function(r){r||(r={}),r.color||(r.color={});const n=r.margin===void 0||r.margin===null||r.margin<0?4:r.margin,i=r.width&&r.width>=21?r.width:void 0,a=r.scale||4;return{width:i,scale:i?4:a,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+2*n.margin?n.width/(r+2*n.margin):n.scale},t.getImageWidth=function(r,n){const i=t.getScale(r,n);return Math.floor((r+2*n.margin)*i)},t.qrToImageData=function(r,n,i){const a=n.modules.size,o=n.modules.data,l=t.getScale(a,i),f=Math.floor((a+2*i.margin)*l),s=i.margin*l,u=[i.color.light,i.color.dark];for(let c=0;c=s&&d>=s&&c':"",f="0&&E>0&&c[m-1]||(h+=g?pt("M",E+w,.5+y+w):pt("m",p,0),p=0,g=!1),E+1',s='viewBox="0 0 '+o+" "+o+'"',u=''+l+f+` `;return typeof r=="function"&&r(null,u),u};const De=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},wt=Mt,Ot=Kt,_e=Jt;function mt(t,e,r,n,i){const a=[].slice.call(arguments,1),o=a.length,l=typeof a[o-1]=="function";if(!l&&!De())throw new Error("Callback required as last argument");if(!l){if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o!==2||e.getContext||(n=r,r=e,e=void 0),new Promise(function(f,s){try{const u=wt.create(r,n);f(t(u,e,n))}catch(u){s(u)}})}if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&i===void 0?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0));try{const f=wt.create(r,n);i(null,t(f,e,n))}catch(f){i(f)}}O.create=wt.create,O.toCanvas=mt.bind(null,Ot.render),O.toDataURL=mt.bind(null,Ot.renderToDataURL),O.toString=mt.bind(null,function(t,e,r){return _e.render(t,r)});const Fe={class:"absolute left-[50%] top-[50%] font-bold"},He=ae(Vt({name:"Qrcode",__name:"Qrcode",props:{tag:$.string.validate(t=>["canvas","img"].includes(t)).def("canvas"),text:{type:[String,Array],default:null},options:{type:Object,default:()=>({})},width:$.number.def(200),logo:{type:[String,Object],default:""},disabled:$.bool.def(!1),disabledText:$.string.def("")},emits:["done","click","disabled-click"],setup(t,{emit:e}){const r=t,n=e,{getPrefixCls:i}=ne(),a=i("qrcode"),{toCanvas:o,toDataURL:l}=O,f=Ct(!0),s=Ct(null),u=At(()=>String(r.text)),c=At(()=>({width:r.width+"px",height:r.width+"px"}));qt(()=>u.value,m=>{m&&(async()=>{await ie();const E=se(r.options||{});if(r.tag==="canvas"){E.errorCorrectionLevel=E.errorCorrectionLevel||h(D(u));const y=await w(D(u),E);E.scale=r.width===0?void 0:r.width/y*4;const A=await o(D(s),D(u),E);if(r.logo){const b=await d(A);n("done",b),f.value=!1}else n("done",A.toDataURL()),f.value=!1}else{const y=await l(u.value,{errorCorrectionLevel:"H",width:r.width,...E});D(s).src=y,n("done",y),f.value=!1}})()},{deep:!0,immediate:!0});const d=m=>{const E=m.width,y=Object.assign({logoSize:.15,bgColor:"#ffffff",borderSize:.05,crossOrigin:"anonymous",borderRadius:8,logoRadius:0},Tt(r.logo)?{}:r.logo),{logoSize:A=.15,bgColor:b="#ffffff",borderSize:C=.05,crossOrigin:R="anonymous",borderRadius:P=8,logoRadius:T=0}=y,N=Tt(r.logo)?r.logo:r.logo.src,M=E*A,B=E*(1-A)/2,x=E*(A+C),_=E*(1-A-C)/2,I=m.getContext("2d");if(!I)return;p(I)(_,_,x,x,P),I.fillStyle=b,I.fill();const Y=new Image;return(R||T)&&Y.setAttribute("crossOrigin",R),Y.src=N,new Promise(jt=>{Y.onload=()=>{var yt;T?(Qt=>{const q=document.createElement("canvas");q.width=B+M,q.height=B+M;const Et=q.getContext("2d");if(!Et||!I||(Et.drawImage(Qt,B,B,M,M),p(I)(B,B,M,M,T),!I))return;const vt=I.createPattern(q,"no-repeat");vt&&(I.fillStyle=vt,I.fill())})(Y):(yt=Y,I.drawImage(yt,B,B,M,M)),jt(m.toDataURL())}})},w=async(m,E)=>{const y=document.createElement("canvas");return await o(y,m,E),y.width},h=m=>m.length>36?"M":m.length>16?"Q":"H",p=m=>(E,y,A,b,C)=>{const R=Math.min(A,b);return C>R/2&&(C=R/2),m.beginPath(),m.moveTo(E+C,y),m.arcTo(E+A,y,E+A,y+b,C),m.arcTo(E+A,y+b,E,y+b,C),m.arcTo(E,y+b,E,y,C),m.arcTo(E,y,E+A,y,C),m.closePath(),m},g=()=>{n("click")},v=()=>{n("disabled-click")};return(m,E)=>{const y=oe,A=re;return $t((ot(),bt("div",{class:Bt([D(a),"relative inline-block"]),style:ee(c.value)},[(ot(),Zt(Xt(t.tag),{ref_key:"wrapRef",ref:s,onClick:g},null,512)),t.disabled?(ot(),bt("div",{key:0,class:Bt([`${D(a)}--disabled`,"absolute left-0 top-0 h-full w-full flex items-center justify-center"]),onClick:v},[It("div",Fe,[Wt(y,{size:30,color:"var(--el-color-primary)",icon:"ep:refresh-right"}),It("div",null,Gt(t.disabledText),1)])],2)):te("",!0)],6)),[[A,f.value]])}}}),[["__scopeId","data-v-b0d4f951"]]);export{He as Q};