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