const e=require("../_util/type.js"),t=require("../locale/LocaleReceiver.js"),n=require("../theme/internal.js"),r=require("../config-provider/hooks/useConfigInject.js"),i=require("../button/index.js"),a=require("../spin/index.js"),o=require("./interface.js"),s=require("./QRCode.js"),c=require("./style/index.js");let l=require("vue"),u=require("@antsoo-lib/icons");var d=(0,l.defineComponent)({name:`AQrcode`,inheritAttrs:!1,props:o.qrcodeProps(),emits:[`refresh`],setup(e,{emit:o,attrs:d,expose:f}){let[p]=t.useLocaleReceiver(`QRCode`),{prefixCls:m}=r.default(`qrcode`,e),[h,g]=c.default(m),[,_]=n.useToken(),v=(0,l.ref)();f({toDataURL:(e,t)=>v.value?.toDataURL(e,t)});let y=(0,l.computed)(()=>{let{value:t,icon:n=``,size:r=160,iconSize:i=40,color:a=_.value.colorText,bgColor:o=`transparent`,errorLevel:s=`M`}=e,c={src:n,x:void 0,y:void 0,height:i,width:i,excavate:!0};return{value:t,size:r-(_.value.paddingSM+_.value.lineWidth)*2,level:s,bgColor:o,fgColor:a,imageSettings:n?c:void 0}});return()=>{let t=m.value;return h((0,l.createVNode)(`div`,{...d,style:[d.style,{width:`${e.size}px`,height:`${e.size}px`,backgroundColor:y.value.bgColor}],class:[g.value,t,{[`${t}-borderless`]:!e.bordered}]},[e.status!==`active`&&(0,l.createVNode)(`div`,{class:`${t}-mask`},[e.status===`loading`&&(0,l.createVNode)(a.default,null,null),e.status===`expired`&&(0,l.createVNode)(l.Fragment,null,[(0,l.createVNode)(`p`,{class:`${t}-expired`},[p.value.expired]),(0,l.createVNode)(i.default,{type:`link`,onClick:e=>o(`refresh`,e)},{default:()=>[p.value.refresh],icon:()=>(0,l.createVNode)(u.ReloadOutlined,null,null)})]),e.status===`scanned`&&(0,l.createVNode)(`p`,{class:`${t}-scanned`},[p.value.scanned])]),e.type===`canvas`?(0,l.createVNode)(s.QRCodeCanvas,{ref:v,...y.value},null):(0,l.createVNode)(s.QRCodeSVG,y.value,null)]))}}}),f=e.withInstall(d);exports.default=f;