import{t as e}from"./rolldown-runtime-BYbx6iT9.js";import{C as t,D as n,Et as r,O as i,Q as a,R as o,S as s,W as c,Z as l,_t as u,b as d,ct as f,ht as p,in as m,k as h,m as g,q as _,st as v,w as y,x as b}from"./vue.runtime.esm-bundler-OsdSFvn7.js";import{_ as x,d as S,f as C,g as ee,h as te,m as w,p as T,v as ne}from"./index-DFPdDGyr.js";import{t as E}from"./_plugin-vue_export-helper-CXTkFu_Z.js";import{n as D,r as O,t as k}from"./publicSourceChannels-B0c-JYrL.js";var A=e(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),j=e((e=>{var t,n=[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];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),M=e((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),N=e(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),P=e(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),F=e((e=>{var t=j().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e{var t=j().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),L=e((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t{var t=M(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),z=e((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),B=e((e=>{var t=z();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i=0;){let e=r[0];for(let i=0;i{var n=B();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),H=e((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),U=e((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),W=e((e=>{var t=H(),n=U();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),G=e((e=>{var t=j(),n=R(),r=M(),i=W(),a=H(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<{var t=j(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<{var n=W();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),J=e(((e,t)=>{var n=W(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),Y=e(((e,t)=>{var n=W();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t{var n=W(),r=j();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+` Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Z=e(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),re=e((e=>{var t=W(),n=q(),r=J(),i=Y(),a=X(),o=U(),s=j(),c=Z();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r{var t=j(),n=M(),r=N(),i=P(),a=F(),o=I(),s=L(),c=R(),l=V(),u=G(),d=K(),f=W(),p=re();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),Q=e((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e=c&&n>=c&&e{var t=Q();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),oe=e((e=>{var t=Q();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1`:``,d=``,f=`viewBox="0 0 `+l+` `+l+`"`,p=``+u+d+` `;return typeof a==`function`&&a(null,p),p}})),se=e((e=>{var t=A(),n=ie(),r=ae(),i=oe();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),ce={class:`source-page`},le={class:`source-toolbar`},$={class:`toolbar-actions`},ue={class:`entry-url`},de={key:0,class:`qr-preview`},fe={class:`qr-label`},pe={class:`qr-url`},me=E(h({__name:`PublicSourceChannelManageView`,setup(e){let h=u([]),E=u(!1),A=u(!1),j=u(!1),M=u(null),N=u(!1),P=u(null),F=u(null),I=p({source_code:``,source_name:``,status:`enabled`}),L=d(()=>M.value?`编辑公开来源渠道`:`新增公开来源渠道`);function R(){M.value=null,I.source_code=``,I.source_name=``,I.status=`enabled`}async function z(){E.value=!0;try{h.value=await D()}catch(e){C.error(e instanceof Error?e.message:`加载公开来源渠道失败`)}finally{E.value=!1}}function B(){R(),j.value=!0}function V(e){M.value=e.id,I.source_code=e.source_code,I.source_name=e.source_name,I.status=e.status,j.value=!0}function H(){return/^[A-Za-z0-9_-]{2,64}$/.test(I.source_code.trim())?!I.source_name.trim()||I.source_name.trim().length>100?(C.warning(`渠道名称需为 1-100 个字符`),!1):!0:(C.warning(`渠道编码需为 2-64 位字母、数字、下划线或中划线`),!1)}async function U(){if(!H())return;A.value=!0;let e={source_code:I.source_code.trim(),source_name:I.source_name.trim(),status:I.status};try{M.value?await O(M.value,e):await k(e),C.success(`公开来源渠道已保存`),j.value=!1,await z()}catch(e){C.error(e instanceof Error?e.message:`保存公开来源渠道失败`)}finally{A.value=!1}}async function W(e){let t=e.status===`enabled`?`disabled`:`enabled`,n=t===`enabled`?`启用`:`停用`;try{await S.confirm(`确认${n}「${e.source_name}」?`,`${n}渠道`,{type:t===`enabled`?`info`:`warning`,confirmButtonText:n,cancelButtonText:`取消`}),await O(e.id,{status:t}),C.success(`渠道已${n}`),await z()}catch(e){e!==`cancel`&&e!==`close`&&C.error(e instanceof Error?e.message:`渠道${n}失败`)}}async function G(e){try{await navigator.clipboard.writeText(e.entry_url),C.success(`访问地址已复制`)}catch{C.error(`复制失败,请手动复制访问地址`)}}async function K(e,t,n=440){await(0,se.toCanvas)(t,e.entry_url,{width:n,margin:2,errorCorrectionLevel:`M`,color:{dark:`#111827`,light:`#ffffff`}})}async function q(e){P.value=e,N.value=!0,await o(),F.value&&await K(e,F.value,480)}function J(e,t,n,r){let i=r-32,a=22;e.textAlign=`center`,e.textBaseline=`middle`,e.fillStyle=`#111827`;do{if(e.font=`600 ${a}px sans-serif`,e.measureText(t).width<=i||a<=12)break;--a}while(a>12);e.fillText(t,r/2,n,i)}async function Y(e){let t=document.createElement(`canvas`);await K(e,t,720);let n=document.createElement(`canvas`);n.width=720,n.height=864;let r=n.getContext(`2d`);if(!r){C.error(`当前浏览器无法生成二维码图片`);return}r.fillStyle=`#ffffff`,r.fillRect(0,0,n.width,n.height),r.drawImage(t,0,0),J(r,`${e.source_name}专属报名二维码`,790,n.width);let i=document.createElement(`a`);i.download=`${e.source_code}-qrcode.png`,i.href=n.toDataURL(`image/png`),i.click()}async function X(e){let t=document.createElement(`canvas`);await K(e,t,720);let n=document.createElement(`a`);n.download=`${e.source_code}-qrcode-only.png`,n.href=t.toDataURL(`image/png`),n.click()}function Z(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}return c(()=>{z()}),(e,o)=>{let c=l(`el-button`),u=l(`el-table-column`),d=l(`el-tag`),p=l(`el-table`),S=l(`el-input`),C=l(`el-form-item`),D=l(`el-radio-button`),O=l(`el-radio-group`),k=l(`el-form`),M=l(`el-dialog`),R=a(`loading`);return _(),y(`section`,ce,[b(`div`,le,[o[11]||=b(`div`,null,[b(`h1`,null,`公开来源渠道`),b(`p`,null,`用于生成首页入口链接和二维码,仅在新用户注册时写入来源归因。`)],-1),b(`div`,$,[i(c,{icon:r(x),loading:E.value,onClick:z},{default:v(()=>[...o[9]||=[n(`刷新`,-1)]]),_:1},8,[`icon`,`loading`]),i(c,{type:`primary`,icon:r(ee),onClick:B},{default:v(()=>[...o[10]||=[n(`新增渠道`,-1)]]),_:1},8,[`icon`])])]),f((_(),s(p,{data:h.value,border:``,stripe:``,"empty-text":`暂无公开来源渠道`,class:`source-table`},{default:v(()=>[i(u,{prop:`source_name`,label:`渠道名称`,"min-width":`150`}),i(u,{prop:`source_code`,label:`渠道编码`,"min-width":`150`}),i(u,{label:`状态`,width:`100`},{default:v(({row:e})=>[i(d,{type:e.status===`enabled`?`success`:`info`},{default:v(()=>[n(m(e.status===`enabled`?`启用`:`停用`),1)]),_:2},1032,[`type`])]),_:1}),i(u,{label:`访问地址`,"min-width":`280`},{default:v(({row:e})=>[b(`div`,ue,[b(`span`,null,m(e.entry_url),1),i(c,{link:``,type:`primary`,icon:r(T),onClick:t=>G(e)},{default:v(()=>[...o[12]||=[n(` 复制 `,-1)]]),_:1},8,[`icon`,`onClick`])])]),_:1}),i(u,{label:`二维码`,width:`130`},{default:v(({row:e})=>[i(c,{size:`small`,onClick:t=>q(e)},{default:v(()=>[...o[13]||=[n(`查看`,-1)]]),_:1},8,[`onClick`])]),_:1}),i(u,{label:`创建时间`,"min-width":`170`},{default:v(({row:e})=>[n(m(Z(e.created_at)),1)]),_:1}),i(u,{label:`操作`,width:`230`,fixed:`right`},{default:v(({row:e})=>[i(c,{size:`small`,icon:r(te),onClick:t=>V(e)},{default:v(()=>[...o[14]||=[n(`编辑`,-1)]]),_:1},8,[`icon`,`onClick`]),i(c,{size:`small`,icon:r(ne),onClick:t=>W(e)},{default:v(()=>[n(m(e.status===`enabled`?`停用`:`启用`),1)]),_:2},1032,[`icon`,`onClick`]),i(c,{size:`small`,icon:r(w),onClick:t=>Y(e)},{default:v(()=>[...o[15]||=[n(`下载`,-1)]]),_:1},8,[`icon`,`onClick`]),i(c,{size:`small`,icon:r(w),onClick:t=>X(e)},{default:v(()=>[...o[16]||=[n(` 不含文字 `,-1)]]),_:1},8,[`icon`,`onClick`])]),_:1})]),_:1},8,[`data`])),[[R,E.value]]),i(M,{modelValue:j.value,"onUpdate:modelValue":o[4]||=e=>j.value=e,title:L.value,width:`520px`,"destroy-on-close":``},{footer:v(()=>[i(c,{onClick:o[3]||=e=>j.value=!1},{default:v(()=>[...o[19]||=[n(`取消`,-1)]]),_:1}),i(c,{type:`primary`,loading:A.value,onClick:U},{default:v(()=>[...o[20]||=[n(`保存`,-1)]]),_:1},8,[`loading`])]),default:v(()=>[i(k,{"label-width":`96px`,onSubmit:g(U,[`prevent`])},{default:v(()=>[i(C,{label:`渠道编码`,required:``},{default:v(()=>[i(S,{modelValue:I.source_code,"onUpdate:modelValue":o[0]||=e=>I.source_code=e,modelModifiers:{trim:!0},maxlength:`64`,placeholder:`例如 wx_menu、poster_001`},null,8,[`modelValue`])]),_:1}),i(C,{label:`渠道名称`,required:``},{default:v(()=>[i(S,{modelValue:I.source_name,"onUpdate:modelValue":o[1]||=e=>I.source_name=e,modelModifiers:{trim:!0},maxlength:`100`,placeholder:`例如 公众号菜单`},null,8,[`modelValue`])]),_:1}),i(C,{label:`状态`},{default:v(()=>[i(O,{modelValue:I.status,"onUpdate:modelValue":o[2]||=e=>I.status=e},{default:v(()=>[i(D,{label:`enabled`},{default:v(()=>[...o[17]||=[n(`启用`,-1)]]),_:1}),i(D,{label:`disabled`},{default:v(()=>[...o[18]||=[n(`停用`,-1)]]),_:1})]),_:1},8,[`modelValue`])]),_:1})]),_:1})]),_:1},8,[`modelValue`,`title`]),i(M,{modelValue:N.value,"onUpdate:modelValue":o[8]||=e=>N.value=e,title:`渠道二维码`,width:`640px`,"destroy-on-close":``},{footer:v(()=>[i(c,{onClick:o[5]||=e=>N.value=!1},{default:v(()=>[...o[21]||=[n(`关闭`,-1)]]),_:1}),P.value?(_(),s(c,{key:0,type:`primary`,icon:r(w),onClick:o[6]||=e=>Y(P.value)},{default:v(()=>[...o[22]||=[n(` 下载二维码 `,-1)]]),_:1},8,[`icon`])):t(``,!0),P.value?(_(),s(c,{key:1,icon:r(w),onClick:o[7]||=e=>X(P.value)},{default:v(()=>[...o[23]||=[n(` 不含文字 `,-1)]]),_:1},8,[`icon`])):t(``,!0)]),default:v(()=>[P.value?(_(),y(`div`,de,[b(`canvas`,{ref_key:`qrCanvasRef`,ref:F,width:`480`,height:`480`},null,512),b(`div`,fe,m(P.value.source_name)+`专属报名二维码`,1),b(`div`,pe,m(P.value.entry_url),1)])):t(``,!0)]),_:1},8,[`modelValue`])])}}}),[[`__scopeId`,`data-v-0fbad46c`]]);export{me as default};