@doubao-dev/cli 1.0.0-rc.2 → 1.0.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/preview.js CHANGED
@@ -1,9 +1,9 @@
1
- import{setTimeout as e}from"node:timers/promises";import{stripVTControlCharacters as t}from"node:util";import n from"node:fs/promises";import o from"node:os";import r from"node:path";import{pathToFileURL as i}from"node:url";import{__webpack_require__ as s}from"./rslib-runtime.js";import{node_modules_open as l}from"./open.js";import{getBuildStatus as d,dist_ve as a,schemas_string as u,pD as h,createPreview as p,chalk_source as c}from"./691.js";import{withProgress as f}from"./progress.js";s.add({"../../../node_modules/.pnpm/dijkstrajs@1.0.3/node_modules/dijkstrajs/dijkstra.js"(e){var t={single_source_shortest_paths:function(e,n,o){var r,i,s,l,d,a,u,h={},p={};p[n]=0;var c=t.PriorityQueue.make();for(c.push(n,0);!c.empty();)for(s in i=(r=c.pop()).value,l=r.cost,d=e[i]||{})d.hasOwnProperty(s)&&(a=l+d[s],u=p[s],(void 0===p[s]||u>a)&&(p[s]=a,c.push(s,a),h[s]=i));if(void 0!==o&&void 0===p[o])throw Error(["Could not find a path from ",n," to ",o,"."].join(""));return h},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],o=t;o;)n.push(o),e[o],o=e[o];return n.reverse(),n},find_path:function(e,n,o){var r=t.single_source_shortest_paths(e,n,o);return t.extract_shortest_path_from_predecessor_list(r,o)},PriorityQueue:{make:function(e){var n,o=t.PriorityQueue,r={};for(n in e=e||{},o)o.hasOwnProperty(n)&&(r[n]=o[n]);return r.queue=[],r.sorter=e.sorter||o.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){this.queue.push({value:e,cost:t}),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/bitmapper.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/interlace.js"),r=[function(){},function(e,t,n,o){if(o===t.length)throw Error("Ran out of data");let r=t[o];e[n]=r,e[n+1]=r,e[n+2]=r,e[n+3]=255},function(e,t,n,o){if(o+1>=t.length)throw Error("Ran out of data");let r=t[o];e[n]=r,e[n+1]=r,e[n+2]=r,e[n+3]=t[o+1]},function(e,t,n,o){if(o+2>=t.length)throw Error("Ran out of data");e[n]=t[o],e[n+1]=t[o+1],e[n+2]=t[o+2],e[n+3]=255},function(e,t,n,o){if(o+3>=t.length)throw Error("Ran out of data");e[n]=t[o],e[n+1]=t[o+1],e[n+2]=t[o+2],e[n+3]=t[o+3]}],i=[function(){},function(e,t,n,o){let r=t[0];e[n]=r,e[n+1]=r,e[n+2]=r,e[n+3]=o},function(e,t,n){let o=t[0];e[n]=o,e[n+1]=o,e[n+2]=o,e[n+3]=t[1]},function(e,t,n,o){e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2],e[n+3]=o},function(e,t,n){e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2],e[n+3]=t[3]}];t.dataToBitMap=function(e,t){let n,s,l,d,a,u,h=t.width,p=t.height,c=t.depth,f=t.bpp,m=t.interlace;8!==c&&(n=[],s=0,l={get:function(t){for(;n.length<t;)!function(){let t,o,r,i;if(s===e.length)throw Error("Ran out of data");let l=e[s];switch(s++,c){default:throw Error("unrecognised depth");case 16:r=e[s],s++,n.push((l<<8)+r);break;case 4:r=15&l,i=l>>4,n.push(i,r);break;case 2:t=3&l,o=l>>2&3,r=l>>4&3,i=l>>6&3,n.push(i,r,o,t);break;case 1:t=l>>4&1,o=l>>5&1,r=l>>6&1,i=l>>7&1,n.push(i,r,o,t,l>>3&1,l>>2&1,l>>1&1,1&l)}}();let o=n.slice(0,t);return n=n.slice(t),o},resetAfterLine:function(){n.length=0},end:function(){if(s!==e.length)throw Error("extra data found")}}),d=c<=8?Buffer.alloc(h*p*4):new Uint16Array(h*p*4);let _=Math.pow(2,c)-1,g=0;if(m)a=o.getImagePasses(h,p),u=o.getInterlaceIterator(h,p);else{let e=0;u=function(){let t=e;return e+=4,t},a=[{width:h,height:p}]}for(let t=0;t<a.length;t++)8===c?g=function(e,t,n,o,i,s){let l=e.width,d=e.height,a=e.index;for(let e=0;e<d;e++)for(let d=0;d<l;d++){let l=n(d,e,a);r[o](t,i,l,s),s+=o}return s}(a[t],d,u,f,e,g):function(e,t,n,o,r,s){let l=e.width,d=e.height,a=e.index;for(let e=0;e<d;e++){for(let d=0;d<l;d++){let l=r.get(o),u=n(d,e,a);i[o](t,l,u,s)}r.resetAfterLine()}}(a[t],d,u,f,l,_);if(8===c){if(g!==e.length)throw Error("extra data found")}else l.end();return d}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/bitpacker.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/constants.js");e.exports=function(e,t,n,r){let i=-1!==[o.COLORTYPE_COLOR_ALPHA,o.COLORTYPE_ALPHA].indexOf(r.colorType);if(r.colorType===r.inputColorType){let t,n=(new DataView(t=new ArrayBuffer(2)).setInt16(0,256,!0),256!==new Int16Array(t)[0]);if(8===r.bitDepth||16===r.bitDepth&&n)return e}let s=16!==r.bitDepth?e:new Uint16Array(e.buffer),l=255,d=o.COLORTYPE_TO_BPP_MAP[r.inputColorType];4!==d||r.inputHasAlpha||(d=3);let a=o.COLORTYPE_TO_BPP_MAP[r.colorType];16===r.bitDepth&&(l=65535,a*=2);let u=Buffer.alloc(t*n*a),h=0,p=0,c=r.bgColor||{};void 0===c.red&&(c.red=l),void 0===c.green&&(c.green=l),void 0===c.blue&&(c.blue=l);for(let e=0;e<n;e++)for(let e=0;e<t;e++){let e=function(){let e,t,n,d=l;switch(r.inputColorType){case o.COLORTYPE_COLOR_ALPHA:d=s[h+3],e=s[h],t=s[h+1],n=s[h+2];break;case o.COLORTYPE_COLOR:e=s[h],t=s[h+1],n=s[h+2];break;case o.COLORTYPE_ALPHA:d=s[h+1],t=e=s[h],n=e;break;case o.COLORTYPE_GRAYSCALE:t=e=s[h],n=e;break;default:throw Error("input color type:"+r.inputColorType+" is not supported at present")}return r.inputHasAlpha&&!i&&(d/=l,e=Math.min(Math.max(Math.round((1-d)*c.red+d*e),0),l),t=Math.min(Math.max(Math.round((1-d)*c.green+d*t),0),l),n=Math.min(Math.max(Math.round((1-d)*c.blue+d*n),0),l)),{red:e,green:t,blue:n,alpha:d}}();switch(r.colorType){case o.COLORTYPE_COLOR_ALPHA:case o.COLORTYPE_COLOR:8===r.bitDepth?(u[p]=e.red,u[p+1]=e.green,u[p+2]=e.blue,i&&(u[p+3]=e.alpha)):(u.writeUInt16BE(e.red,p),u.writeUInt16BE(e.green,p+2),u.writeUInt16BE(e.blue,p+4),i&&u.writeUInt16BE(e.alpha,p+6));break;case o.COLORTYPE_ALPHA:case o.COLORTYPE_GRAYSCALE:{let t=(e.red+e.green+e.blue)/3;8===r.bitDepth?(u[p]=t,i&&(u[p+1]=e.alpha)):(u.writeUInt16BE(t,p),i&&u.writeUInt16BE(e.alpha,p+2));break}default:throw Error("unrecognised color Type "+r.colorType)}h+=d,p+=a}return u}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/chunkstream.js"(e,t,n){let o=n("util"),r=n("stream"),i=e.exports=function(){r.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};o.inherits(i,r),i.prototype.read=function(e,t){this._reads.push({length:Math.abs(e),allowLess:e<0,func:t}),process.nextTick((function(){this._process(),this._paused&&this._reads&&this._reads.length>0&&(this._paused=!1,this.emit("drain"))}).bind(this))},i.prototype.write=function(e,t){let n;return this.writable?(n=Buffer.isBuffer(e)?e:Buffer.from(e,t||this._encoding),this._buffers.push(n),this._buffered+=n.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused):(this.emit("error",Error("Stream not writable")),!1)},i.prototype.end=function(e,t){e&&this.write(e,t),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},i.prototype.destroySoon=i.prototype.end,i.prototype._end=function(){this._reads.length>0&&this.emit("error",Error("Unexpected end of input")),this.destroy()},i.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},i.prototype._processReadAllowingLess=function(e){this._reads.shift();let t=this._buffers[0];t.length>e.length?(this._buffered-=e.length,this._buffers[0]=t.slice(e.length),e.func.call(this,t.slice(0,e.length))):(this._buffered-=t.length,this._buffers.shift(),e.func.call(this,t))},i.prototype._processRead=function(e){this._reads.shift();let t=0,n=0,o=Buffer.alloc(e.length);for(;t<e.length;){let r=this._buffers[n++],i=Math.min(r.length,e.length-t);r.copy(o,t,0,i),t+=i,i!==r.length&&(this._buffers[--n]=r.slice(i))}n>0&&this._buffers.splice(0,n),this._buffered-=e.length,e.func.call(this,o)},i.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){let e=this._reads[0];if(e.allowLess)this._processReadAllowingLess(e);else if(this._buffered>=e.length)this._processRead(e);else break}this._buffers&&!this.writable&&this._end()}catch(e){this.emit("error",e)}}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/constants.js"(e){e.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:0x49484452,TYPE_IEND:0x49454e44,TYPE_IDAT:0x49444154,TYPE_PLTE:0x504c5445,TYPE_tRNS:0x74524e53,TYPE_gAMA:0x67414d41,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/crc.js"(e){let t=[];for(let e=0;e<256;e++){let n=e;for(let e=0;e<8;e++)1&n?n=0xedb88320^n>>>1:n>>>=1;t[e]=n}let n=e.exports=function(){this._crc=-1};n.prototype.write=function(e){for(let n=0;n<e.length;n++)this._crc=t[(this._crc^e[n])&255]^this._crc>>>8;return!0},n.prototype.crc32=function(){return -1^this._crc},n.crc32=function(e){let n=-1;for(let o=0;o<e.length;o++)n=t[(n^e[o])&255]^n>>>8;return -1^n}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-pack.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/paeth-predictor.js"),r={0:function(e,t,n,o,r){for(let i=0;i<n;i++)o[r+i]=e[t+i]},1:function(e,t,n,o,r,i){for(let s=0;s<n;s++){let n=s>=i?e[t+s-i]:0,l=e[t+s]-n;o[r+s]=l}},2:function(e,t,n,o,r){for(let i=0;i<n;i++){let s=t>0?e[t+i-n]:0,l=e[t+i]-s;o[r+i]=l}},3:function(e,t,n,o,r,i){for(let s=0;s<n;s++){let l=s>=i?e[t+s-i]:0,d=t>0?e[t+s-n]:0,a=e[t+s]-(l+d>>1);o[r+s]=a}},4:function(e,t,n,r,i,s){for(let l=0;l<n;l++){let d=l>=s?e[t+l-s]:0,a=t>0?e[t+l-n]:0,u=t>0&&l>=s?e[t+l-(n+s)]:0,h=e[t+l]-o(d,a,u);r[i+l]=h}}},i={0:function(e,t,n){let o=0,r=t+n;for(let n=t;n<r;n++)o+=Math.abs(e[n]);return o},1:function(e,t,n,o){let r=0;for(let i=0;i<n;i++){let n=i>=o?e[t+i-o]:0;r+=Math.abs(e[t+i]-n)}return r},2:function(e,t,n){let o=0,r=t+n;for(let i=t;i<r;i++){let r=t>0?e[i-n]:0;o+=Math.abs(e[i]-r)}return o},3:function(e,t,n,o){let r=0;for(let i=0;i<n;i++){let s=i>=o?e[t+i-o]:0,l=t>0?e[t+i-n]:0;r+=Math.abs(e[t+i]-(s+l>>1))}return r},4:function(e,t,n,r){let i=0;for(let s=0;s<n;s++){let l=s>=r?e[t+s-r]:0,d=t>0?e[t+s-n]:0,a=t>0&&s>=r?e[t+s-(n+r)]:0;i+=Math.abs(e[t+s]-o(l,d,a))}return i}};e.exports=function(e,t,n,o,s){let l;if("filterType"in o&&-1!==o.filterType)if("number"==typeof o.filterType)l=[o.filterType];else throw Error("unrecognised filter types");else l=[0,1,2,3,4];16===o.bitDepth&&(s*=2);let d=t*s,a=0,u=0,h=Buffer.alloc((d+1)*n),p=l[0];for(let t=0;t<n;t++){if(l.length>1){let t=1/0;for(let n=0;n<l.length;n++){let o=i[l[n]](e,u,d,s);o<t&&(p=l[n],t=o)}}h[a]=p,a++,r[p](e,u,d,h,a,s),a+=d,u+=d}return h}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-parse-async.js"(e,t,n){let o=n("util"),r=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/chunkstream.js"),i=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-parse.js"),s=e.exports=function(e){r.call(this);let t=[],n=this;this._filter=new i(e,{read:this.read.bind(this),write:function(e){t.push(e)},complete:function(){n.emit("complete",Buffer.concat(t))}}),this._filter.start()};o.inherits(s,r)},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-parse-sync.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/sync-reader.js"),r=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-parse.js");t.process=function(e,t){let n=[],i=new o(e);return new r(t,{read:i.read.bind(i),write:function(e){n.push(e)},complete:function(){}}).start(),i.process(),Buffer.concat(n)}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-parse.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/interlace.js"),r=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/paeth-predictor.js");function i(e,t,n){let o=e*t;return 8!==n&&(o=Math.ceil(o/(8/n))),o}let s=e.exports=function(e,t){let n=e.width,r=e.height,s=e.interlace,l=e.bpp,d=e.depth;if(this.read=t.read,this.write=t.write,this.complete=t.complete,this._imageIndex=0,this._images=[],s){let e=o.getImagePasses(n,r);for(let t=0;t<e.length;t++)this._images.push({byteWidth:i(e[t].width,l,d),height:e[t].height,lineIndex:0})}else this._images.push({byteWidth:i(n,l,d),height:r,lineIndex:0});8===d?this._xComparison=l:16===d?this._xComparison=2*l:this._xComparison=1};s.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))},s.prototype._unFilterType1=function(e,t,n){let o=this._xComparison,r=o-1;for(let i=0;i<n;i++){let n=e[1+i],s=i>r?t[i-o]:0;t[i]=n+s}},s.prototype._unFilterType2=function(e,t,n){let o=this._lastLine;for(let r=0;r<n;r++){let n=e[1+r],i=o?o[r]:0;t[r]=n+i}},s.prototype._unFilterType3=function(e,t,n){let o=this._xComparison,r=o-1,i=this._lastLine;for(let s=0;s<n;s++){let n=e[1+s],l=i?i[s]:0,d=Math.floor(((s>r?t[s-o]:0)+l)/2);t[s]=n+d}},s.prototype._unFilterType4=function(e,t,n){let o=this._xComparison,i=o-1,s=this._lastLine;for(let l=0;l<n;l++){let n=e[1+l],d=s?s[l]:0,a=r(l>i?t[l-o]:0,d,l>i&&s?s[l-o]:0);t[l]=n+a}},s.prototype._reverseFilterLine=function(e){let t,n=e[0],o=this._images[this._imageIndex],r=o.byteWidth;if(0===n)t=e.slice(1,r+1);else switch(t=Buffer.alloc(r),n){case 1:this._unFilterType1(e,t,r);break;case 2:this._unFilterType2(e,t,r);break;case 3:this._unFilterType3(e,t,r);break;case 4:this._unFilterType4(e,t,r);break;default:throw Error("Unrecognised filter type - "+n)}this.write(t),o.lineIndex++,o.lineIndex>=o.height?(this._lastLine=null,this._imageIndex++,o=this._images[this._imageIndex]):this._lastLine=t,o?this.read(o.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/format-normaliser.js"(e){e.exports=function(e,t){let n=t.depth,o=t.width,r=t.height,i=t.colorType,s=t.transColor,l=t.palette,d=e;return 3===i?!function(e,t,n,o,r){let i=0;for(let s=0;s<o;s++)for(let o=0;o<n;o++){let n=r[e[i]];if(!n)throw Error("index "+e[i]+" not in palette");for(let e=0;e<4;e++)t[i+e]=n[e];i+=4}}(e,d,o,r,l):(s&&function(e,t,n,o,r){let i=0;for(let s=0;s<o;s++)for(let o=0;o<n;o++){let n=!1;if(1===r.length?r[0]===e[i]&&(n=!0):r[0]===e[i]&&r[1]===e[i+1]&&r[2]===e[i+2]&&(n=!0),n)for(let e=0;e<4;e++)t[i+e]=0;i+=4}}(e,d,o,r,s),8!==n&&(16===n&&(d=Buffer.alloc(o*r*4)),!function(e,t,n,o,r){let i=Math.pow(2,r)-1,s=0;for(let r=0;r<o;r++)for(let o=0;o<n;o++){for(let n=0;n<4;n++)t[s+n]=Math.floor(255*e[s+n]/i+.5);s+=4}}(e,d,o,r,n))),d}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/interlace.js"(e,t){let n=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];t.getImagePasses=function(e,t){let o=[],r=e%8,i=t%8,s=(e-r)/8,l=(t-i)/8;for(let e=0;e<n.length;e++){let t=n[e],d=s*t.x.length,a=l*t.y.length;for(let e=0;e<t.x.length;e++)if(t.x[e]<r)d++;else break;for(let e=0;e<t.y.length;e++)if(t.y[e]<i)a++;else break;d>0&&a>0&&o.push({width:d,height:a,index:e})}return o},t.getInterlaceIterator=function(e){return function(t,o,r){let i=t%n[r].x.length,s=(t-i)/n[r].x.length*8+n[r].x[i],l=o%n[r].y.length;return 4*s+((o-l)/n[r].y.length*8+n[r].y[l])*e*4}}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer-async.js"(e,t,n){let o=n("util"),r=n("stream"),i=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/constants.js"),s=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer.js"),l=e.exports=function(e){r.call(this),this._packer=new s(e||{}),this._deflate=this._packer.createDeflate(),this.readable=!0};o.inherits(l,r),l.prototype.pack=function(e,t,n,o){this.emit("data",Buffer.from(i.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(t,n)),o&&this.emit("data",this._packer.packGAMA(o));let r=this._packer.filterData(e,t,n);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",(function(e){this.emit("data",this._packer.packIDAT(e))}).bind(this)),this._deflate.on("end",(function(){this.emit("data",this._packer.packIEND()),this.emit("end")}).bind(this)),this._deflate.end(r)}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer-sync.js"(e,t,n){let o=!0,r=n("zlib");r.deflateSync||(o=!1);let i=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/constants.js"),s=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer.js");e.exports=function(e,t){if(!o)throw Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let n=new s(t||{}),l=[];l.push(Buffer.from(i.PNG_SIGNATURE)),l.push(n.packIHDR(e.width,e.height)),e.gamma&&l.push(n.packGAMA(e.gamma));let d=n.filterData(e.data,e.width,e.height),a=r.deflateSync(d,n.getDeflateOptions());if(d=null,!a||!a.length)throw Error("bad png - invalid compressed data response");return l.push(n.packIDAT(a)),l.push(n.packIEND()),Buffer.concat(l)}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/constants.js"),r=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/crc.js"),i=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/bitpacker.js"),s=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-pack.js"),l=n("zlib"),d=e.exports=function(e){if(this._options=e,e.deflateChunkSize=e.deflateChunkSize||32768,e.deflateLevel=null!=e.deflateLevel?e.deflateLevel:9,e.deflateStrategy=null!=e.deflateStrategy?e.deflateStrategy:3,e.inputHasAlpha=null==e.inputHasAlpha||e.inputHasAlpha,e.deflateFactory=e.deflateFactory||l.createDeflate,e.bitDepth=e.bitDepth||8,e.colorType="number"==typeof e.colorType?e.colorType:o.COLORTYPE_COLOR_ALPHA,e.inputColorType="number"==typeof e.inputColorType?e.inputColorType:o.COLORTYPE_COLOR_ALPHA,-1===[o.COLORTYPE_GRAYSCALE,o.COLORTYPE_COLOR,o.COLORTYPE_COLOR_ALPHA,o.COLORTYPE_ALPHA].indexOf(e.colorType))throw Error("option color type:"+e.colorType+" is not supported at present");if(-1===[o.COLORTYPE_GRAYSCALE,o.COLORTYPE_COLOR,o.COLORTYPE_COLOR_ALPHA,o.COLORTYPE_ALPHA].indexOf(e.inputColorType))throw Error("option input color type:"+e.inputColorType+" is not supported at present");if(8!==e.bitDepth&&16!==e.bitDepth)throw Error("option bit depth:"+e.bitDepth+" is not supported at present")};d.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},d.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},d.prototype.filterData=function(e,t,n){let r=i(e,t,n,this._options),l=o.COLORTYPE_TO_BPP_MAP[this._options.colorType];return s(r,t,n,this._options,l)},d.prototype._packChunk=function(e,t){let n=t?t.length:0,o=Buffer.alloc(n+12);return o.writeUInt32BE(n,0),o.writeUInt32BE(e,4),t&&t.copy(o,8),o.writeInt32BE(r.crc32(o.slice(4,o.length-4)),o.length-4),o},d.prototype.packGAMA=function(e){let t=Buffer.alloc(4);return t.writeUInt32BE(Math.floor(e*o.GAMMA_DIVISION),0),this._packChunk(o.TYPE_gAMA,t)},d.prototype.packIHDR=function(e,t){let n=Buffer.alloc(13);return n.writeUInt32BE(e,0),n.writeUInt32BE(t,4),n[8]=this._options.bitDepth,n[9]=this._options.colorType,n[10]=0,n[11]=0,n[12]=0,this._packChunk(o.TYPE_IHDR,n)},d.prototype.packIDAT=function(e){return this._packChunk(o.TYPE_IDAT,e)},d.prototype.packIEND=function(){return this._packChunk(o.TYPE_IEND,null)}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/paeth-predictor.js"(e){e.exports=function(e,t,n){let o=e+t-n,r=Math.abs(o-e),i=Math.abs(o-t),s=Math.abs(o-n);return r<=i&&r<=s?e:i<=s?t:n}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser-async.js"(e,t,n){let o=n("util"),r=n("zlib"),i=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/chunkstream.js"),s=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-parse-async.js"),l=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser.js"),d=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/bitmapper.js"),a=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/format-normaliser.js"),u=e.exports=function(e){i.call(this),this._parser=new l(e,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=e,this.writable=!0,this._parser.start()};o.inherits(u,i),u.prototype._handleError=function(e){this.emit("error",e),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",function(){})),this.errord=!0},u.prototype._inflateData=function(e){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=r.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{let e=((this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3)+1)*this._bitmapInfo.height,t=Math.max(e,r.Z_MIN_CHUNK);this._inflate=r.createInflate({chunkSize:t});let n=e,o=this.emit.bind(this,"error");this._inflate.on("error",function(e){n&&o(e)}),this._filter.on("complete",this._complete.bind(this));let i=this._filter.write.bind(this._filter);this._inflate.on("data",function(e){n&&(e.length>n&&(e=e.slice(0,n)),n-=e.length,i(e))}),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(e)},u.prototype._handleMetaData=function(e){this._metaData=e,this._bitmapInfo=Object.create(e),this._filter=new s(this._bitmapInfo)},u.prototype._handleTransColor=function(e){this._bitmapInfo.transColor=e},u.prototype._handlePalette=function(e){this._bitmapInfo.palette=e},u.prototype._simpleTransparency=function(){this._metaData.alpha=!0},u.prototype._headersFinished=function(){this.emit("metadata",this._metaData)},u.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"))},u.prototype._complete=function(e){let t;if(!this.errord){try{let n=d.dataToBitMap(e,this._bitmapInfo);t=a(n,this._bitmapInfo),n=null}catch(e){this._handleError(e);return}this.emit("parsed",t)}}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser-sync.js"(e,t,n){let o=!0,r=n("zlib"),i=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/sync-inflate.js");r.deflateSync||(o=!1);let s=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/sync-reader.js"),l=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-parse-sync.js"),d=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser.js"),a=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/bitmapper.js"),u=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/format-normaliser.js");e.exports=function(e,t){let n,h,p,c;if(!o)throw Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let f=[],m=new s(e);if(new d(t,{read:m.read.bind(m),error:function(e){n=e},metadata:function(e){h=e},gamma:function(e){p=e},palette:function(e){h.palette=e},transColor:function(e){h.transColor=e},inflateData:function(e){f.push(e)},simpleTransparency:function(){h.alpha=!0}}).start(),m.process(),n)throw n;let _=Buffer.concat(f);if(f.length=0,h.interlace)c=r.inflateSync(_);else{let e=((h.width*h.bpp*h.depth+7>>3)+1)*h.height;c=i(_,{chunkSize:e,maxLength:e})}if(_=null,!c||!c.length)throw Error("bad png - invalid inflate data response");let g=l.process(c,h);_=null;let b=a.dataToBitMap(g,h);g=null;let y=u(b,h);return h.data=y,h.gamma=p||0,h}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/constants.js"),r=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/crc.js"),i=e.exports=function(e,t){this._options=e,e.checkCRC=!1!==e.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[o.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[o.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[o.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[o.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[o.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[o.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=t.read,this.error=t.error,this.metadata=t.metadata,this.gamma=t.gamma,this.transColor=t.transColor,this.palette=t.palette,this.parsed=t.parsed,this.inflateData=t.inflateData,this.finished=t.finished,this.simpleTransparency=t.simpleTransparency,this.headersFinished=t.headersFinished||function(){}};i.prototype.start=function(){this.read(o.PNG_SIGNATURE.length,this._parseSignature.bind(this))},i.prototype._parseSignature=function(e){let t=o.PNG_SIGNATURE;for(let n=0;n<t.length;n++)if(e[n]!==t[n])return void this.error(Error("Invalid file signature"));this.read(8,this._parseChunkBegin.bind(this))},i.prototype._parseChunkBegin=function(e){let t=e.readUInt32BE(0),n=e.readUInt32BE(4),i="";for(let t=4;t<8;t++)i+=String.fromCharCode(e[t]);let s=!!(32&e[4]);return this._hasIHDR||n===o.TYPE_IHDR?(this._crc=new r,this._crc.write(Buffer.from(i)),this._chunks[n])?this._chunks[n](t):s?void this.read(t+4,this._skipChunk.bind(this)):void this.error(Error("Unsupported critical chunk type "+i)):void this.error(Error("Expected IHDR on beggining"))},i.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))},i.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))},i.prototype._parseChunkEnd=function(e){let t=e.readInt32BE(0),n=this._crc.crc32();this._options.checkCRC&&n!==t?this.error(Error("Crc error - "+t+" - "+n)):this._hasIEND||this.read(8,this._parseChunkBegin.bind(this))},i.prototype._handleIHDR=function(e){this.read(e,this._parseIHDR.bind(this))},i.prototype._parseIHDR=function(e){this._crc.write(e);let t=e.readUInt32BE(0),n=e.readUInt32BE(4),r=e[8],i=e[9],s=e[10],l=e[11],d=e[12];if(8!==r&&4!==r&&2!==r&&1!==r&&16!==r)return void this.error(Error("Unsupported bit depth "+r));if(!(i in o.COLORTYPE_TO_BPP_MAP))return void this.error(Error("Unsupported color type"));if(0!==s)return void this.error(Error("Unsupported compression method"));if(0!==l)return void this.error(Error("Unsupported filter method"));if(0!==d&&1!==d)return void this.error(Error("Unsupported interlace method"));this._colorType=i;let a=o.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=!0,this.metadata({width:t,height:n,depth:r,interlace:!!d,palette:!!(i&o.COLORTYPE_PALETTE),color:!!(i&o.COLORTYPE_COLOR),alpha:!!(i&o.COLORTYPE_ALPHA),bpp:a,colorType:i}),this._handleChunkEnd()},i.prototype._handlePLTE=function(e){this.read(e,this._parsePLTE.bind(this))},i.prototype._parsePLTE=function(e){this._crc.write(e);let t=Math.floor(e.length/3);for(let n=0;n<t;n++)this._palette.push([e[3*n],e[3*n+1],e[3*n+2],255]);this.palette(this._palette),this._handleChunkEnd()},i.prototype._handleTRNS=function(e){this.simpleTransparency(),this.read(e,this._parseTRNS.bind(this))},i.prototype._parseTRNS=function(e){if(this._crc.write(e),this._colorType===o.COLORTYPE_PALETTE_COLOR){if(0===this._palette.length)return void this.error(Error("Transparency chunk must be after palette"));if(e.length>this._palette.length)return void this.error(Error("More transparent colors than palette size"));for(let t=0;t<e.length;t++)this._palette[t][3]=e[t];this.palette(this._palette)}this._colorType===o.COLORTYPE_GRAYSCALE&&this.transColor([e.readUInt16BE(0)]),this._colorType===o.COLORTYPE_COLOR&&this.transColor([e.readUInt16BE(0),e.readUInt16BE(2),e.readUInt16BE(4)]),this._handleChunkEnd()},i.prototype._handleGAMA=function(e){this.read(e,this._parseGAMA.bind(this))},i.prototype._parseGAMA=function(e){this._crc.write(e),this.gamma(e.readUInt32BE(0)/o.GAMMA_DIVISION),this._handleChunkEnd()},i.prototype._handleIDAT=function(e){this._emittedHeadersFinished||(this._emittedHeadersFinished=!0,this.headersFinished()),this.read(-e,this._parseIDAT.bind(this,e))},i.prototype._parseIDAT=function(e,t){if(this._crc.write(t),this._colorType===o.COLORTYPE_PALETTE_COLOR&&0===this._palette.length)throw Error("Expected palette not found");this.inflateData(t);let n=e-t.length;n>0?this._handleIDAT(n):this._handleChunkEnd()},i.prototype._handleIEND=function(e){this.read(e,this._parseIEND.bind(this))},i.prototype._parseIEND=function(e){this._crc.write(e),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/png-sync.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser-sync.js"),r=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer-sync.js");t.read=function(e,t){return o(e,t||{})},t.write=function(e,t){return r(e,t)}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/png.js"(e,t,n){let o=n("util"),r=n("stream"),i=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser-async.js"),s=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer-async.js"),l=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/png-sync.js"),d=t.O=function(e){r.call(this),e=e||{},this.width=0|e.width,this.height=0|e.height,this.data=this.width>0&&this.height>0?Buffer.alloc(4*this.width*this.height):null,e.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new i(e),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",(function(e){this.data=e,this.emit("parsed",e)}).bind(this)),this._packer=new s(e),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};o.inherits(d,r),d.sync=l,d.prototype.pack=function(){return this.data&&this.data.length?process.nextTick((function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}).bind(this)):this.emit("error","No data provided"),this},d.prototype.parse=function(e,t){if(t){let e,n;e=(function(e){this.removeListener("error",n),this.data=e,t(null,this)}).bind(this),n=(function(n){this.removeListener("parsed",e),t(n,null)}).bind(this),this.once("parsed",e),this.once("error",n)}return this.end(e),this},d.prototype.write=function(e){return this._parser.write(e),!0},d.prototype.end=function(e){this._parser.end(e)},d.prototype._metadata=function(e){this.width=e.width,this.height=e.height,this.emit("metadata",e)},d.prototype._gamma=function(e){this.gamma=e},d.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},d.bitblt=function(e,t,n,o,r,i,s,l){if(o|=0,r|=0,i|=0,s|=0,l|=0,(n|=0)>e.width||o>e.height||n+r>e.width||o+i>e.height)throw Error("bitblt reading outside image");if(s>t.width||l>t.height||s+r>t.width||l+i>t.height)throw Error("bitblt writing outside image");for(let d=0;d<i;d++)e.data.copy(t.data,(l+d)*t.width+s<<2,(o+d)*e.width+n<<2,(o+d)*e.width+n+r<<2)},d.prototype.bitblt=function(e,t,n,o,r,i,s){return d.bitblt(this,e,t,n,o,r,i,s),this},d.adjustGamma=function(e){if(e.gamma){for(let t=0;t<e.height;t++)for(let n=0;n<e.width;n++){let o=e.width*t+n<<2;for(let t=0;t<3;t++){let n=e.data[o+t]/255;n=Math.pow(n,1/2.2/e.gamma),e.data[o+t]=Math.round(255*n)}}e.gamma=0}},d.prototype.adjustGamma=function(){d.adjustGamma(this)}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/sync-inflate.js"(e,t,n){let o=n("assert").ok,r=n("zlib"),i=n("util"),s=n("buffer").kMaxLength;function l(e){if(!(this instanceof l))return new l(e);e&&e.chunkSize<r.Z_MIN_CHUNK&&(e.chunkSize=r.Z_MIN_CHUNK),r.Inflate.call(this,e),this._offset=void 0===this._offset?this._outOffset:this._offset,this._buffer=this._buffer||this._outBuffer,e&&null!=e.maxLength&&(this._maxLength=e.maxLength)}function d(e,t){t&&process.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function a(e,t){var n=new l(t),o=e;if("string"==typeof o&&(o=Buffer.from(o)),!(o instanceof Buffer))throw TypeError("Not a string or buffer");let i=n._finishFlushFlag;return null==i&&(i=r.Z_FINISH),n._processChunk(o,i)}l.prototype._processChunk=function(e,t,n){let i,l;if("function"==typeof n)return r.Inflate._processChunk.call(this,e,t,n);let a=this,u=e&&e.length,h=this._chunkSize-this._offset,p=this._maxLength,c=0,f=[],m=0;this.on("error",function(e){i=e}),o(this._handle,"zlib binding closed");do l=(l=this._handle.writeSync(t,e,c,u,this._buffer,this._offset,h))||this._writeState;while(!this._hadError&&function(e,t){if(a._hadError)return;let n=h-t;if(o(n>=0,"have should not go down"),n>0){let e=a._buffer.slice(a._offset,a._offset+n);if(a._offset+=n,e.length>p&&(e=e.slice(0,p)),f.push(e),m+=e.length,0==(p-=e.length))return!1}return(0===t||a._offset>=a._chunkSize)&&(h=a._chunkSize,a._offset=0,a._buffer=Buffer.allocUnsafe(a._chunkSize)),0===t&&(c+=u-e,u=e,!0)}(l[0],l[1]));if(this._hadError)throw i;if(m>=s)throw d(this),RangeError("Cannot create final Buffer. It would be larger than 0x"+s.toString(16)+" bytes");let _=Buffer.concat(f,m);return d(this),_},i.inherits(l,r.Inflate),e.exports=t=a,t.Inflate=l,t.createInflate=function(e){return new l(e)},t.inflateSync=a},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/sync-reader.js"(e){let t=e.exports=function(e){this._buffer=e,this._reads=[]};t.prototype.read=function(e,t){this._reads.push({length:Math.abs(e),allowLess:e<0,func:t})},t.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){let e=this._reads[0];if(this._buffer.length&&(this._buffer.length>=e.length||e.allowLess)){this._reads.shift();let t=this._buffer;this._buffer=t.slice(e.length),e.func.call(this,t.slice(0,e.length))}else break}return this._reads.length>0?Error("There are some read requests waitng on finished stream"):this._buffer.length>0?Error("unrecognised content at end of stream"):void 0}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/browser.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js"),i=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/canvas.js"),s=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg-tag.js");function l(e,t,n,i,s){let l=[].slice.call(arguments,1),d=l.length,a="function"==typeof l[d-1];if(!a&&!o())throw Error("Callback required as last argument");if(a){if(d<2)throw Error("Too few arguments provided");2===d?(s=n,n=t,t=i=void 0):3===d&&(t.getContext&&void 0===s?(s=i,i=void 0):(s=i,i=n,n=t,t=void 0))}else{if(d<1)throw Error("Too few arguments provided");return 1===d?(n=t,t=i=void 0):2!==d||t.getContext||(i=n,n=t,t=void 0),new Promise(function(o,s){try{let s=r.create(n,i);o(e(s,t,i))}catch(e){s(e)}})}try{let o=r.create(n,i);s(null,e(o,t,i))}catch(e){s(e)}}r.create,l.bind(null,i.render),l.bind(null,i.renderToDataURL),l.bind(null,function(e,t,n){return s.render(e,n)})},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js"(e){e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alignment-pattern.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js").getSymbolSize;t.getRowColCoords=function(e){if(1===e)return[];let t=Math.floor(e/7)+2,n=o(e),r=145===n?26:2*Math.ceil((n-13)/(2*t-2)),i=[n-7];for(let e=1;e<t-1;e++)i[e]=i[e-1]-r;return i.push(6),i.reverse()},t.getPositions=function(e){let n=[],o=t.getRowColCoords(e),r=o.length;for(let e=0;e<r;e++)for(let t=0;t<r;t++)(0!==e||0!==t)&&(0!==e||t!==r-1)&&(e!==r-1||0!==t)&&n.push([o[e],o[t]]);return n}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"),r=["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 i(e){this.mode=o.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=45*r.indexOf(this.data[t]);n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},e.exports=i},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-buffer.js"(e){function t(){this.buffer=[],this.length=0}t.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++)this.putBit((e>>>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++}},e.exports=t},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-matrix.js"(e){function t(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)}t.prototype.set=function(e,t,n,o){let r=e*this.size+t;this.data[r]=n,o&&(this.reservedBit[r]=!0)},t.prototype.get=function(e,t){return this.data[e*this.size+t]},t.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},t.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},e.exports=t},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js");function r(e){this.mode=o.BYTE,"string"==typeof e?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return 8*e},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<n;t++)e.put(this.data[t],8)},e.exports=r},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js"),r=[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],i=[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];t.getBlocksCount=function(e,t){switch(t){case o.L:return r[(e-1)*4+0];case o.M:return r[(e-1)*4+1];case o.Q:return r[(e-1)*4+2];case o.H:return r[(e-1)*4+3];default:return}},t.getTotalCodewordsCount=function(e,t){switch(t){case o.L:return i[(e-1)*4+0];case o.M:return i[(e-1)*4+1];case o.Q:return i[(e-1)*4+2];case o.H:return i[(e-1)*4+3];default:return}}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js"(e,t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},t.from=function(e,n){if(t.isValid(e))return e;try{if("string"!=typeof e)throw Error("Param is not a string");switch(e.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 Error("Unknown EC Level: "+e)}}catch(e){return n}}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js").getSymbolSize;t.getPositions=function(e){let t=o(e);return[[0,0],[t-7,0],[0,t-7]]}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/format-info.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js"),r=o.getBCHDigit(1335);t.getEncodedBits=function(e,t){let n=e.bit<<3|t,i=n<<10;for(;o.getBCHDigit(i)-r>=0;)i^=1335<<o.getBCHDigit(i)-r;return(n<<10|i)^21522}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/galois-field.js"(e,t){let n=new Uint8Array(512),o=new Uint8Array(256),r=1;for(let e=0;e<255;e++)n[e]=r,o[r]=e,256&(r<<=1)&&(r^=285);for(let e=255;e<512;e++)n[e]=n[e-255];t.exp=function(e){return n[e]},t.mul=function(e,t){return 0===e||0===t?0:n[o[e]+o[t]]}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js");function i(e){this.mode=o.KANJI,this.data=e}i.getBitsLength=function(e){return 13*e},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<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");n=(n>>>8&255)*192+(255&n),e.put(n,13)}},e.exports=i},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mask-pattern.js"(e,t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};t.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){let t=e.size,n=0,o=0,r=0,i=null,s=null;for(let l=0;l<t;l++){o=r=0,i=s=null;for(let d=0;d<t;d++){let t=e.get(l,d);t===i?o++:(o>=5&&(n+=3+(o-5)),i=t,o=1),(t=e.get(d,l))===s?r++:(r>=5&&(n+=3+(r-5)),s=t,r=1)}o>=5&&(n+=3+(o-5)),r>=5&&(n+=3+(r-5))}return n},t.getPenaltyN2=function(e){let t=e.size,n=0;for(let o=0;o<t-1;o++)for(let r=0;r<t-1;r++){let t=e.get(o,r)+e.get(o,r+1)+e.get(o+1,r)+e.get(o+1,r+1);(4===t||0===t)&&n++}return 3*n},t.getPenaltyN3=function(e){let t=e.size,n=0,o=0,r=0;for(let i=0;i<t;i++){o=r=0;for(let s=0;s<t;s++)o=o<<1&2047|e.get(i,s),s>=10&&(1488===o||93===o)&&n++,r=r<<1&2047|e.get(s,i),s>=10&&(1488===r||93===r)&&n++}return 40*n},t.getPenaltyN4=function(e){let t=0,n=e.data.length;for(let o=0;o<n;o++)t+=e.data[o];return 10*Math.abs(Math.ceil(100*t/n/5)-10)},t.applyMask=function(e,n){let o=n.size;for(let r=0;r<o;r++)for(let i=0;i<o;i++)n.isReserved(i,r)||n.xor(i,r,function(e,n,o){switch(e){case t.Patterns.PATTERN000:return(n+o)%2==0;case t.Patterns.PATTERN001:return n%2==0;case t.Patterns.PATTERN010:return o%3==0;case t.Patterns.PATTERN011:return(n+o)%3==0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(o/3))%2==0;case t.Patterns.PATTERN101:return n*o%2+n*o%3==0;case t.Patterns.PATTERN110:return(n*o%2+n*o%3)%2==0;case t.Patterns.PATTERN111:return(n*o%3+(n+o)%2)%2==0;default:throw Error("bad maskPattern:"+e)}}(e,i,r))},t.getBestMask=function(e,n){let o=Object.keys(t.Patterns).length,r=0,i=1/0;for(let s=0;s<o;s++){n(s),t.applyMask(s,e);let o=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(s,e),o<i&&(i=o,r=s)}return r}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js");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(e,t){if(!e.ccBits)throw Error("Invalid mode: "+e);if(!o.isValid(t))throw Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},t.getBestModeForData=function(e){return r.testNumeric(e)?t.NUMERIC:r.testAlphanumeric(e)?t.ALPHANUMERIC:r.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(e){if(e&&e.id)return e.id;throw Error("Invalid mode")},t.isValid=function(e){return e&&e.bit&&e.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{if("string"!=typeof e)throw Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw Error("Unknown mode: "+e)}}catch(e){return n}}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js");function r(e){this.mode=o.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;for(t=0;t+3<=this.data.length;t+=3)n=parseInt(this.data.substr(t,3),10),e.put(n,10);let o=this.data.length-t;o>0&&(n=parseInt(this.data.substr(t),10),e.put(n,3*o+1))},e.exports=r},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/polynomial.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/galois-field.js");t.mul=function(e,t){let n=new Uint8Array(e.length+t.length-1);for(let r=0;r<e.length;r++)for(let i=0;i<t.length;i++)n[r+i]^=o.mul(e[r],t[i]);return n},t.mod=function(e,t){let n=new Uint8Array(e);for(;n.length-t.length>=0;){let e=n[0];for(let r=0;r<t.length;r++)n[r]^=o.mul(t[r],e);let r=0;for(;r<n.length&&0===n[r];)r++;n=n.slice(r)}return n},t.generateECPolynomial=function(e){let n=new Uint8Array([1]);for(let r=0;r<e;r++)n=t.mul(n,new Uint8Array([1,o.exp(r)]));return n}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js"),i=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-buffer.js"),s=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-matrix.js"),l=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alignment-pattern.js"),d=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js"),a=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mask-pattern.js"),u=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js"),h=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/reed-solomon-encoder.js"),p=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version.js"),c=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/format-info.js"),f=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"),m=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js");function _(e,t,n){let o,r,i=e.size,s=c.getEncodedBits(t,n);for(o=0;o<15;o++)r=(s>>o&1)==1,o<6?e.set(o,8,r,!0):o<8?e.set(o+1,8,r,!0):e.set(i-15+o,8,r,!0),o<8?e.set(8,i-o-1,r,!0):o<9?e.set(8,15-o-1+1,r,!0):e.set(8,15-o-1,r,!0);e.set(i-8,8,1,!0)}t.create=function(e,t){let n,c;if(void 0===e||""===e)throw Error("No input text");let g=r.M;return void 0!==t&&(g=r.from(t.errorCorrectionLevel,r.M),n=p.from(t.version),c=a.from(t.maskPattern),t.toSJISFunc&&o.setToSJISFunction(t.toSJISFunc)),function(e,t,n,r){let c;if(Array.isArray(e))c=m.fromArray(e);else if("string"==typeof e){let o=t;if(!o){let t=m.rawSplit(e);o=p.getBestVersionForData(t,n)}c=m.fromString(e,o||40)}else throw Error("Invalid data");let g=p.getBestVersionForData(c,n);if(!g)throw Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<g)throw Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+g+".\n")}else t=g;let b=function(e,t,n){let r=new i;n.forEach(function(t){r.put(t.mode.bit,4),r.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(r)});let s=(o.getSymbolTotalCodewords(e)-u.getTotalCodewordsCount(e,t))*8;for(r.getLengthInBits()+4<=s&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(0);let l=(s-r.getLengthInBits())/8;for(let e=0;e<l;e++)r.put(e%2?17:236,8);return function(e,t,n){let r,i,s=o.getSymbolTotalCodewords(t),l=s-u.getTotalCodewordsCount(t,n),d=u.getBlocksCount(t,n),a=s%d,p=d-a,c=Math.floor(s/d),f=Math.floor(l/d),m=f+1,_=c-f,g=new h(_),b=0,y=Array(d),j=Array(d),E=0,w=new Uint8Array(e.buffer);for(let e=0;e<d;e++){let t=e<p?f:m;y[e]=w.slice(b,b+t),j[e]=g.encode(y[e]),b+=t,E=Math.max(E,t)}let T=new Uint8Array(s),C=0;for(r=0;r<E;r++)for(i=0;i<d;i++)r<y[i].length&&(T[C++]=y[i][r]);for(r=0;r<_;r++)for(i=0;i<d;i++)T[C++]=j[i][r];return T}(r,e,t)}(t,n,c),y=new s(o.getSymbolSize(t));!function(e,t){let n=e.size,o=d.getPositions(t);for(let t=0;t<o.length;t++){let r=o[t][0],i=o[t][1];for(let t=-1;t<=7;t++)if(!(r+t<=-1)&&!(n<=r+t))for(let o=-1;o<=7;o++)i+o<=-1||n<=i+o||(t>=0&&t<=6&&(0===o||6===o)||o>=0&&o<=6&&(0===t||6===t)||t>=2&&t<=4&&o>=2&&o<=4?e.set(r+t,i+o,!0,!0):e.set(r+t,i+o,!1,!0))}}(y,t);let j=y.size;for(let e=8;e<j-8;e++){let t=e%2==0;y.set(e,6,t,!0),y.set(6,e,t,!0)}return!function(e,t){let n=l.getPositions(t);for(let t=0;t<n.length;t++){let o=n[t][0],r=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)-2===t||2===t||-2===n||2===n||0===t&&0===n?e.set(o+t,r+n,!0,!0):e.set(o+t,r+n,!1,!0)}}(y,t),_(y,n,0),t>=7&&function(e,t){let n,o,r,i=e.size,s=p.getEncodedBits(t);for(let t=0;t<18;t++)n=Math.floor(t/3),o=t%3+i-8-3,r=(s>>t&1)==1,e.set(n,o,r,!0),e.set(o,n,r,!0)}(y,t),!function(e,t){let n=e.size,o=-1,r=n-1,i=7,s=0;for(let l=n-1;l>0;l-=2)for(6===l&&l--;;){for(let n=0;n<2;n++)if(!e.isReserved(r,l-n)){let o=!1;s<t.length&&(o=(t[s]>>>i&1)==1),e.set(r,l-n,o),-1==--i&&(s++,i=7)}if((r+=o)<0||n<=r){r-=o,o=-o;break}}}(y,b),isNaN(r)&&(r=a.getBestMask(y,_.bind(null,y,n))),a.applyMask(r,y),_(y,n,r),{modules:y,version:t,errorCorrectionLevel:n,maskPattern:r,segments:c}}(e,n,g,c)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/reed-solomon-encoder.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/polynomial.js");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=o.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 n=o.mod(t,this.genPoly),r=this.degree-n.length;if(r>0){let e=new Uint8Array(this.degree);return e.set(n,r),e}return n},e.exports=r},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js"(e,t){let n="[0-9]+",o="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",r="(?:(?![A-Z0-9 $%*+\\-./:]|"+(o=o.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";t.KANJI=RegExp(o,"g"),t.BYTE_KANJI=RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=RegExp(r,"g"),t.NUMERIC=RegExp(n,"g"),t.ALPHANUMERIC=RegExp("[A-Z $%*+\\-./:]+","g");let i=RegExp("^"+o+"$"),s=RegExp("^"+n+"$"),l=RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(e){return i.test(e)},t.testNumeric=function(e){return s.test(e)},t.testAlphanumeric=function(e){return l.test(e)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js"),i=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js"),s=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js"),l=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js"),d=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js"),a=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js"),u=n("../../../node_modules/.pnpm/dijkstrajs@1.0.3/node_modules/dijkstrajs/dijkstra.js");function h(e){return unescape(encodeURIComponent(e)).length}function p(e,t,n){let o,r=[];for(;null!==(o=e.exec(n));)r.push({data:o[0],index:o.index,mode:t,length:o[0].length});return r}function c(e){let t,n,r=p(d.NUMERIC,o.NUMERIC,e),i=p(d.ALPHANUMERIC,o.ALPHANUMERIC,e);return a.isKanjiModeEnabled()?(t=p(d.BYTE,o.BYTE,e),n=p(d.KANJI,o.KANJI,e)):(t=p(d.BYTE_KANJI,o.BYTE,e),n=[]),r.concat(i,t,n).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,t){switch(t){case o.NUMERIC:return r.getBitsLength(e);case o.ALPHANUMERIC:return i.getBitsLength(e);case o.KANJI:return l.getBitsLength(e);case o.BYTE:return s.getBitsLength(e)}}function m(e,t){let n,d=o.getBestModeForData(e);if((n=o.from(t,d))!==o.BYTE&&n.bit<d.bit)throw Error('"'+e+'" cannot be encoded with mode '+o.toString(n)+".\n Suggested mode is: "+o.toString(d));switch(n===o.KANJI&&!a.isKanjiModeEnabled()&&(n=o.BYTE),n){case o.NUMERIC:return new r(e);case o.ALPHANUMERIC:return new i(e);case o.KANJI:return new l(e);case o.BYTE:return new s(e)}}t.fromArray=function(e){return e.reduce(function(e,t){return"string"==typeof t?e.push(m(t,null)):t.data&&e.push(m(t.data,t.mode)),e},[])},t.fromString=function(e,n){let r=function(e,t){let n={},r={start:{}},i=["start"];for(let s=0;s<e.length;s++){let l=e[s],d=[];for(let e=0;e<l.length;e++){let a=l[e],u=""+s+e;d.push(u),n[u]={node:a,lastCount:0},r[u]={};for(let e=0;e<i.length;e++){let s=i[e];n[s]&&n[s].node.mode===a.mode?(r[s][u]=f(n[s].lastCount+a.length,a.mode)-f(n[s].lastCount,a.mode),n[s].lastCount+=a.length):(n[s]&&(n[s].lastCount=a.length),r[s][u]=f(a.length,a.mode)+4+o.getCharCountIndicator(a.mode,t))}}i=d}for(let e=0;e<i.length;e++)r[i[e]].end=0;return{map:r,table:n}}(function(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];switch(r.mode){case o.NUMERIC:t.push([r,{data:r.data,mode:o.ALPHANUMERIC,length:r.length},{data:r.data,mode:o.BYTE,length:r.length}]);break;case o.ALPHANUMERIC:t.push([r,{data:r.data,mode:o.BYTE,length:r.length}]);break;case o.KANJI:t.push([r,{data:r.data,mode:o.BYTE,length:h(r.data)}]);break;case o.BYTE:t.push([{data:r.data,mode:o.BYTE,length:h(r.data)}])}}return t}(c(e,a.isKanjiModeEnabled())),n),i=u.find_path(r.map,"start","end"),s=[];for(let e=1;e<i.length-1;e++)s.push(r.table[i[e]].node);return t.fromArray(s.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.push(t),e},[]))},t.rawSplit=function(e){return t.fromArray(c(e,a.isKanjiModeEnabled()))}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js"(e,t){let n,o=[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];t.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 4*e+17},t.getSymbolTotalCodewords=function(e){return o[e]},t.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},t.setToSJISFunction=function(e){if("function"!=typeof e)throw Error('"toSJISFunc" is not a valid function.');n=e},t.isKanjiModeEnabled=function(){return void 0!==n},t.toSJIS=function(e){return n(e)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js"(e,t){t.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js"),i=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js"),s=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"),l=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js"),d=o.getBCHDigit(7973);function a(e,t){return s.getCharCountIndicator(e,t)+4}t.from=function(e,t){return l.isValid(e)?parseInt(e,10):t},t.getCapacity=function(e,t,n){if(!l.isValid(e))throw Error("Invalid QR Code version");void 0===n&&(n=s.BYTE);let i=(o.getSymbolTotalCodewords(e)-r.getTotalCodewordsCount(e,t))*8;if(n===s.MIXED)return i;let d=i-a(n,e);switch(n){case s.NUMERIC:return Math.floor(d/10*3);case s.ALPHANUMERIC:return Math.floor(d/11*2);case s.KANJI:return Math.floor(d/13);case s.BYTE:default:return Math.floor(d/8)}},t.getBestVersionForData=function(e,n){let o,r=i.from(n,i.M);if(Array.isArray(e)){if(e.length>1){for(let n=1;n<=40;n++)if(function(e,t){let n=0;return e.forEach(function(e){let o=a(e.mode,t);n+=o+e.getBitsLength()}),n}(e,n)<=t.getCapacity(n,r,s.MIXED))return n;return}if(0===e.length)return 1;o=e[0]}else o=e;return function(e,n,o){for(let r=1;r<=40;r++)if(n<=t.getCapacity(r,o,e))return r}(o.mode,o.getLength(),r)},t.getEncodedBits=function(e){if(!l.isValid(e)||e<7)throw Error("Invalid QR Code version");let t=e<<12;for(;o.getBCHDigit(t)-d>=0;)t^=7973<<o.getBCHDigit(t)-d;return e<<12|t}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/index.js"(e,t,n){e.exports=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/server.js")},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/canvas.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js");t.render=function(e,t,n){var r;let i=n,s=t;void 0!==i||t&&t.getContext||(i=t,t=void 0),t||(s=function(){try{return document.createElement("canvas")}catch(e){throw Error("You need to specify a canvas element")}}()),i=o.getOptions(i);let l=o.getImageWidth(e.modules.size,i),d=s.getContext("2d"),a=d.createImageData(l,l);return o.qrToImageData(a.data,e,i),r=s,d.clearRect(0,0,r.width,r.height),r.style||(r.style={}),r.height=l,r.width=l,r.style.height=l+"px",r.style.width=l+"px",d.putImageData(a,0,0),s},t.renderToDataURL=function(e,n,o){let r=o;void 0!==r||n&&n.getContext||(r=n,n=void 0),r||(r={});let i=t.render(e,n,r),s=r.type||"image/png",l=r.rendererOpts||{};return i.toDataURL(s,l.quality)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/png.js"(e,t,n){let o=n("fs"),r=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/png.js").O,i=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js");t.render=function(e,t){let n=i.getOptions(t),o=n.rendererOpts,s=i.getImageWidth(e.modules.size,n);o.width=s,o.height=s;let l=new r(o);return i.qrToImageData(l.data,e,n),l},t.renderToDataURL=function(e,n,o){void 0===o&&(o=n,n=void 0),t.renderToBuffer(e,n,function(e,t){e&&o(e);let n="data:image/png;base64,";n+=t.toString("base64"),o(null,n)})},t.renderToBuffer=function(e,n,o){void 0===o&&(o=n,n=void 0);let r=t.render(e,n),i=[];r.on("error",o),r.on("data",function(e){i.push(e)}),r.on("end",function(){o(null,Buffer.concat(i))}),r.pack()},t.renderToFile=function(e,n,r,i){void 0===i&&(i=r,r=void 0);let s=!1,l=(...e)=>{s||(s=!0,i.apply(null,e))},d=o.createWriteStream(e);d.on("error",l),d.on("close",l),t.renderToFileStream(d,n,r)},t.renderToFileStream=function(e,n,o){t.render(n,o).pack().pipe(e)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg-tag.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js");function r(e,t){let n=e.a/255,o=t+'="'+e.hex+'"';return n<1?o+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':o}function i(e,t,n){let o=e+t;return void 0!==n&&(o+=" "+n),o}t.render=function(e,t,n){let s=o.getOptions(t),l=e.modules.size,d=e.modules.data,a=l+2*s.margin,u=s.color.light.a?"<path "+r(s.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",h="<path "+r(s.color.dark,"stroke")+' d="'+function(e,t,n){let o="",r=0,s=!1,l=0;for(let d=0;d<e.length;d++){let a=Math.floor(d%t),u=Math.floor(d/t);a||s||(s=!0),e[d]?(l++,d>0&&a>0&&e[d-1]||(o+=s?i("M",a+n,.5+u+n):i("m",r,0),r=0,s=!1),a+1<t&&e[d+1]||(o+=i("h",l),l=0)):r++}return o}(d,l,s.margin)+'"/>',p='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+('viewBox="0 0 '+a+" ")+a+'" shape-rendering="crispEdges">'+u+h+"</svg>\n";return"function"==typeof n&&n(null,p),p}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg.js"(e,t,n){t.render=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg-tag.js").render,t.renderToFile=function(e,o,r,i){void 0===i&&(i=r,r=void 0);let s=n("fs"),l=t.render(o,r);s.writeFile(e,'<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'+l,i)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal/terminal.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal/terminal-small.js");t.render=function(e,t,n){return t&&t.small?r.render(e,t,n):o.render(e,t,n)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal/terminal-small.js"(e,t){let n="\x1b[37m",o="\x1b[30m",r="\x1b[0m",i="\x1b[47m"+o,s="\x1b[40m"+n,l=function(e,t,n,o){let r=t+1;return n>=r||o>=r||o<-1||n<-1?"0":n>=t||o>=t||o<0||n<0?"1":e[o*t+n]?"2":"1"},d=function(e,t,n,o){return l(e,t,n,o)+l(e,t,n,o+1)};t.render=function(e,t,l){var a,u;let h=e.modules.size,p=e.modules.data,c=!!(t&&t.inverse),f=t&&t.inverse?s:i,m={"00":r+" "+f,"01":r+(a=c?o:n)+"▄"+f,"02":r+(u=c?n:o)+"▄"+f,10:r+a+"▀"+f,11:" ",12:"▄",20:r+u+"▀"+f,21:"▀",22:"█"},_=r+"\n"+f,g=f;for(let e=-1;e<h+1;e+=2){for(let t=-1;t<h;t++)g+=m[d(p,h,t,e)];g+=m[d(p,h,h,e)]+_}return g+=r,"function"==typeof l&&l(null,g),g}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal/terminal.js"(e,t){t.render=function(e,t,n){let o=e.modules.size,r=e.modules.data,i="\x1b[47m \x1b[0m",s="",l=Array(o+3).join(i),d=[,,].join(i);s+=l+"\n";for(let e=0;e<o;++e){s+=i;for(let t=0;t<o;t++)s+=r[e*o+t]?"\x1b[40m \x1b[0m":i;s+=d+"\n"}return s+=l+"\n","function"==typeof n&&n(null,s),s}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utf8.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js"),r={WW:" ",WB:"▄",BB:"█",BW:"▀"},i={BB:" ",BW:"▄",WW:"█",WB:"▀"};t.render=function(e,t,n){let s=o.getOptions(t),l=r;("#ffffff"===s.color.dark.hex||"#000000"===s.color.light.hex)&&(l=i);let d=e.modules.size,a=e.modules.data,u="",h=Array(d+2*s.margin+1).join(l.WW);h=Array(s.margin/2+1).join(h+"\n");let p=Array(s.margin+1).join(l.WW);u+=h;for(let e=0;e<d;e+=2){u+=p;for(let t=0;t<d;t++){var c;let n=a[e*d+t],o=a[(e+1)*d+t];u+=(c=l,n&&o?c.BB:n&&!o?c.BW:!n&&o?c.WB:c.WW)}u+=p+"\n"}return u+=h.slice(0,-1),"function"==typeof n&&n(null,u),u},t.renderToFile=function(e,o,r,i){void 0===i&&(i=r,r=void 0);let s=n("fs"),l=t.render(o,r);s.writeFile(e,l,i)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js"(e,t){function n(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw Error("Invalid hex color: "+e);(3===t.length||4===t.length)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),6===t.length&&t.push("F","F");let n=parseInt(t.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+t.slice(0,6).join("")}}t.getOptions=function(e){e||(e={}),e.color||(e.color={});let t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,o=e.width&&e.width>=21?e.width:void 0,r=e.scale||4;return{width:o,scale:o?4:r,margin:t,color:{dark:n(e.color.dark||"#000000ff"),light:n(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},t.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},t.getImageWidth=function(e,n){let o=t.getScale(e,n);return Math.floor((e+2*n.margin)*o)},t.qrToImageData=function(e,n,o){let r=n.modules.size,i=n.modules.data,s=t.getScale(r,o),l=Math.floor((r+2*o.margin)*s),d=o.margin*s,a=[o.color.light,o.color.dark];for(let t=0;t<l;t++)for(let n=0;n<l;n++){let u=(t*l+n)*4,h=o.color.light;t>=d&&n>=d&&t<l-d&&n<l-d&&(h=a[+!!i[Math.floor((t-d)/s)*r+Math.floor((n-d)/s)]]),e[u++]=h.r,e[u++]=h.g,e[u++]=h.b,e[u]=h.a}}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/server.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js"),i=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/png.js"),s=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utf8.js"),l=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal.js"),d=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg.js");function a(e,t,n){if(void 0===e)throw Error("String required as first argument");if(void 0===n&&(n=t,t={}),"function"!=typeof n)if(o())t=n||{},n=null;else throw Error("Callback required as last argument");return{opts:t,cb:n}}function u(e,t,n){if(!n.cb)return new Promise(function(o,i){try{let s=r.create(t,n.opts);return e(s,n.opts,function(e,t){return e?i(e):o(t)})}catch(e){i(e)}});try{let o=r.create(t,n.opts);return e(o,n.opts,n.cb)}catch(e){n.cb(e)}}t.create=r.create,n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/browser.js"),t.toString=function(e,t,n){let o=a(e,t,n);return u(function(e){switch(e){case"svg":return d;case"terminal":return l;default:return s}}(o.opts?o.opts.type:void 0).render,e,o)},t.toDataURL=function(e,t,n){let o=a(e,t,n);return u(function(e){switch(e){case"svg":return d;case"txt":case"utf8":return s;default:return i}}(o.opts.type).renderToDataURL,e,o)}}});let m=s("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/index.js");async function _(e){let t=await m.toDataURL(e,{margin:4,scale:8,errorCorrectionLevel:"L"});return`<!doctype html>
1
+ import{setTimeout as e}from"node:timers/promises";import{stripVTControlCharacters as t}from"node:util";import n from"node:fs/promises";import o from"node:os";import r from"node:path";import{pathToFileURL as i}from"node:url";import{z as s}from"zod";import{__webpack_require__ as l}from"./rslib-runtime.js";import{node_modules_open as d}from"./open.js";import{dist_ve as a,createPreview as u,getBuildStatus as h,pluginIdentity as p,pD as c,isInteractive as f,error_errorMessage as m,chalk_source as _}from"./691.js";import{withProgress as g}from"./progress.js";l.add({"../../../node_modules/.pnpm/dijkstrajs@1.0.3/node_modules/dijkstrajs/dijkstra.js"(e){var t={single_source_shortest_paths:function(e,n,o){var r,i,s,l,d,a,u,h={},p={};p[n]=0;var c=t.PriorityQueue.make();for(c.push(n,0);!c.empty();)for(s in i=(r=c.pop()).value,l=r.cost,d=e[i]||{})d.hasOwnProperty(s)&&(a=l+d[s],u=p[s],(void 0===p[s]||u>a)&&(p[s]=a,c.push(s,a),h[s]=i));if(void 0!==o&&void 0===p[o])throw Error(["Could not find a path from ",n," to ",o,"."].join(""));return h},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],o=t;o;)n.push(o),e[o],o=e[o];return n.reverse(),n},find_path:function(e,n,o){var r=t.single_source_shortest_paths(e,n,o);return t.extract_shortest_path_from_predecessor_list(r,o)},PriorityQueue:{make:function(e){var n,o=t.PriorityQueue,r={};for(n in e=e||{},o)o.hasOwnProperty(n)&&(r[n]=o[n]);return r.queue=[],r.sorter=e.sorter||o.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){this.queue.push({value:e,cost:t}),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/bitmapper.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/interlace.js"),r=[function(){},function(e,t,n,o){if(o===t.length)throw Error("Ran out of data");let r=t[o];e[n]=r,e[n+1]=r,e[n+2]=r,e[n+3]=255},function(e,t,n,o){if(o+1>=t.length)throw Error("Ran out of data");let r=t[o];e[n]=r,e[n+1]=r,e[n+2]=r,e[n+3]=t[o+1]},function(e,t,n,o){if(o+2>=t.length)throw Error("Ran out of data");e[n]=t[o],e[n+1]=t[o+1],e[n+2]=t[o+2],e[n+3]=255},function(e,t,n,o){if(o+3>=t.length)throw Error("Ran out of data");e[n]=t[o],e[n+1]=t[o+1],e[n+2]=t[o+2],e[n+3]=t[o+3]}],i=[function(){},function(e,t,n,o){let r=t[0];e[n]=r,e[n+1]=r,e[n+2]=r,e[n+3]=o},function(e,t,n){let o=t[0];e[n]=o,e[n+1]=o,e[n+2]=o,e[n+3]=t[1]},function(e,t,n,o){e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2],e[n+3]=o},function(e,t,n){e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2],e[n+3]=t[3]}];t.dataToBitMap=function(e,t){let n,s,l,d,a,u,h=t.width,p=t.height,c=t.depth,f=t.bpp,m=t.interlace;8!==c&&(n=[],s=0,l={get:function(t){for(;n.length<t;)!function(){let t,o,r,i;if(s===e.length)throw Error("Ran out of data");let l=e[s];switch(s++,c){default:throw Error("unrecognised depth");case 16:r=e[s],s++,n.push((l<<8)+r);break;case 4:r=15&l,i=l>>4,n.push(i,r);break;case 2:t=3&l,o=l>>2&3,r=l>>4&3,i=l>>6&3,n.push(i,r,o,t);break;case 1:t=l>>4&1,o=l>>5&1,r=l>>6&1,i=l>>7&1,n.push(i,r,o,t,l>>3&1,l>>2&1,l>>1&1,1&l)}}();let o=n.slice(0,t);return n=n.slice(t),o},resetAfterLine:function(){n.length=0},end:function(){if(s!==e.length)throw Error("extra data found")}}),d=c<=8?Buffer.alloc(h*p*4):new Uint16Array(h*p*4);let _=Math.pow(2,c)-1,g=0;if(m)a=o.getImagePasses(h,p),u=o.getInterlaceIterator(h,p);else{let e=0;u=function(){let t=e;return e+=4,t},a=[{width:h,height:p}]}for(let t=0;t<a.length;t++)8===c?g=function(e,t,n,o,i,s){let l=e.width,d=e.height,a=e.index;for(let e=0;e<d;e++)for(let d=0;d<l;d++){let l=n(d,e,a);r[o](t,i,l,s),s+=o}return s}(a[t],d,u,f,e,g):function(e,t,n,o,r,s){let l=e.width,d=e.height,a=e.index;for(let e=0;e<d;e++){for(let d=0;d<l;d++){let l=r.get(o),u=n(d,e,a);i[o](t,l,u,s)}r.resetAfterLine()}}(a[t],d,u,f,l,_);if(8===c){if(g!==e.length)throw Error("extra data found")}else l.end();return d}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/bitpacker.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/constants.js");e.exports=function(e,t,n,r){let i=-1!==[o.COLORTYPE_COLOR_ALPHA,o.COLORTYPE_ALPHA].indexOf(r.colorType);if(r.colorType===r.inputColorType){let t,n=(new DataView(t=new ArrayBuffer(2)).setInt16(0,256,!0),256!==new Int16Array(t)[0]);if(8===r.bitDepth||16===r.bitDepth&&n)return e}let s=16!==r.bitDepth?e:new Uint16Array(e.buffer),l=255,d=o.COLORTYPE_TO_BPP_MAP[r.inputColorType];4!==d||r.inputHasAlpha||(d=3);let a=o.COLORTYPE_TO_BPP_MAP[r.colorType];16===r.bitDepth&&(l=65535,a*=2);let u=Buffer.alloc(t*n*a),h=0,p=0,c=r.bgColor||{};void 0===c.red&&(c.red=l),void 0===c.green&&(c.green=l),void 0===c.blue&&(c.blue=l);for(let e=0;e<n;e++)for(let e=0;e<t;e++){let e=function(){let e,t,n,d=l;switch(r.inputColorType){case o.COLORTYPE_COLOR_ALPHA:d=s[h+3],e=s[h],t=s[h+1],n=s[h+2];break;case o.COLORTYPE_COLOR:e=s[h],t=s[h+1],n=s[h+2];break;case o.COLORTYPE_ALPHA:d=s[h+1],t=e=s[h],n=e;break;case o.COLORTYPE_GRAYSCALE:t=e=s[h],n=e;break;default:throw Error("input color type:"+r.inputColorType+" is not supported at present")}return r.inputHasAlpha&&!i&&(d/=l,e=Math.min(Math.max(Math.round((1-d)*c.red+d*e),0),l),t=Math.min(Math.max(Math.round((1-d)*c.green+d*t),0),l),n=Math.min(Math.max(Math.round((1-d)*c.blue+d*n),0),l)),{red:e,green:t,blue:n,alpha:d}}();switch(r.colorType){case o.COLORTYPE_COLOR_ALPHA:case o.COLORTYPE_COLOR:8===r.bitDepth?(u[p]=e.red,u[p+1]=e.green,u[p+2]=e.blue,i&&(u[p+3]=e.alpha)):(u.writeUInt16BE(e.red,p),u.writeUInt16BE(e.green,p+2),u.writeUInt16BE(e.blue,p+4),i&&u.writeUInt16BE(e.alpha,p+6));break;case o.COLORTYPE_ALPHA:case o.COLORTYPE_GRAYSCALE:{let t=(e.red+e.green+e.blue)/3;8===r.bitDepth?(u[p]=t,i&&(u[p+1]=e.alpha)):(u.writeUInt16BE(t,p),i&&u.writeUInt16BE(e.alpha,p+2));break}default:throw Error("unrecognised color Type "+r.colorType)}h+=d,p+=a}return u}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/chunkstream.js"(e,t,n){let o=n("util"),r=n("stream"),i=e.exports=function(){r.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};o.inherits(i,r),i.prototype.read=function(e,t){this._reads.push({length:Math.abs(e),allowLess:e<0,func:t}),process.nextTick((function(){this._process(),this._paused&&this._reads&&this._reads.length>0&&(this._paused=!1,this.emit("drain"))}).bind(this))},i.prototype.write=function(e,t){let n;return this.writable?(n=Buffer.isBuffer(e)?e:Buffer.from(e,t||this._encoding),this._buffers.push(n),this._buffered+=n.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused):(this.emit("error",Error("Stream not writable")),!1)},i.prototype.end=function(e,t){e&&this.write(e,t),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},i.prototype.destroySoon=i.prototype.end,i.prototype._end=function(){this._reads.length>0&&this.emit("error",Error("Unexpected end of input")),this.destroy()},i.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},i.prototype._processReadAllowingLess=function(e){this._reads.shift();let t=this._buffers[0];t.length>e.length?(this._buffered-=e.length,this._buffers[0]=t.slice(e.length),e.func.call(this,t.slice(0,e.length))):(this._buffered-=t.length,this._buffers.shift(),e.func.call(this,t))},i.prototype._processRead=function(e){this._reads.shift();let t=0,n=0,o=Buffer.alloc(e.length);for(;t<e.length;){let r=this._buffers[n++],i=Math.min(r.length,e.length-t);r.copy(o,t,0,i),t+=i,i!==r.length&&(this._buffers[--n]=r.slice(i))}n>0&&this._buffers.splice(0,n),this._buffered-=e.length,e.func.call(this,o)},i.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){let e=this._reads[0];if(e.allowLess)this._processReadAllowingLess(e);else if(this._buffered>=e.length)this._processRead(e);else break}this._buffers&&!this.writable&&this._end()}catch(e){this.emit("error",e)}}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/constants.js"(e){e.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:0x49484452,TYPE_IEND:0x49454e44,TYPE_IDAT:0x49444154,TYPE_PLTE:0x504c5445,TYPE_tRNS:0x74524e53,TYPE_gAMA:0x67414d41,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/crc.js"(e){let t=[];for(let e=0;e<256;e++){let n=e;for(let e=0;e<8;e++)1&n?n=0xedb88320^n>>>1:n>>>=1;t[e]=n}let n=e.exports=function(){this._crc=-1};n.prototype.write=function(e){for(let n=0;n<e.length;n++)this._crc=t[(this._crc^e[n])&255]^this._crc>>>8;return!0},n.prototype.crc32=function(){return -1^this._crc},n.crc32=function(e){let n=-1;for(let o=0;o<e.length;o++)n=t[(n^e[o])&255]^n>>>8;return -1^n}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-pack.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/paeth-predictor.js"),r={0:function(e,t,n,o,r){for(let i=0;i<n;i++)o[r+i]=e[t+i]},1:function(e,t,n,o,r,i){for(let s=0;s<n;s++){let n=s>=i?e[t+s-i]:0,l=e[t+s]-n;o[r+s]=l}},2:function(e,t,n,o,r){for(let i=0;i<n;i++){let s=t>0?e[t+i-n]:0,l=e[t+i]-s;o[r+i]=l}},3:function(e,t,n,o,r,i){for(let s=0;s<n;s++){let l=s>=i?e[t+s-i]:0,d=t>0?e[t+s-n]:0,a=e[t+s]-(l+d>>1);o[r+s]=a}},4:function(e,t,n,r,i,s){for(let l=0;l<n;l++){let d=l>=s?e[t+l-s]:0,a=t>0?e[t+l-n]:0,u=t>0&&l>=s?e[t+l-(n+s)]:0,h=e[t+l]-o(d,a,u);r[i+l]=h}}},i={0:function(e,t,n){let o=0,r=t+n;for(let n=t;n<r;n++)o+=Math.abs(e[n]);return o},1:function(e,t,n,o){let r=0;for(let i=0;i<n;i++){let n=i>=o?e[t+i-o]:0;r+=Math.abs(e[t+i]-n)}return r},2:function(e,t,n){let o=0,r=t+n;for(let i=t;i<r;i++){let r=t>0?e[i-n]:0;o+=Math.abs(e[i]-r)}return o},3:function(e,t,n,o){let r=0;for(let i=0;i<n;i++){let s=i>=o?e[t+i-o]:0,l=t>0?e[t+i-n]:0;r+=Math.abs(e[t+i]-(s+l>>1))}return r},4:function(e,t,n,r){let i=0;for(let s=0;s<n;s++){let l=s>=r?e[t+s-r]:0,d=t>0?e[t+s-n]:0,a=t>0&&s>=r?e[t+s-(n+r)]:0;i+=Math.abs(e[t+s]-o(l,d,a))}return i}};e.exports=function(e,t,n,o,s){let l;if("filterType"in o&&-1!==o.filterType)if("number"==typeof o.filterType)l=[o.filterType];else throw Error("unrecognised filter types");else l=[0,1,2,3,4];16===o.bitDepth&&(s*=2);let d=t*s,a=0,u=0,h=Buffer.alloc((d+1)*n),p=l[0];for(let t=0;t<n;t++){if(l.length>1){let t=1/0;for(let n=0;n<l.length;n++){let o=i[l[n]](e,u,d,s);o<t&&(p=l[n],t=o)}}h[a]=p,a++,r[p](e,u,d,h,a,s),a+=d,u+=d}return h}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-parse-async.js"(e,t,n){let o=n("util"),r=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/chunkstream.js"),i=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-parse.js"),s=e.exports=function(e){r.call(this);let t=[],n=this;this._filter=new i(e,{read:this.read.bind(this),write:function(e){t.push(e)},complete:function(){n.emit("complete",Buffer.concat(t))}}),this._filter.start()};o.inherits(s,r)},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-parse-sync.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/sync-reader.js"),r=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-parse.js");t.process=function(e,t){let n=[],i=new o(e);return new r(t,{read:i.read.bind(i),write:function(e){n.push(e)},complete:function(){}}).start(),i.process(),Buffer.concat(n)}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-parse.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/interlace.js"),r=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/paeth-predictor.js");function i(e,t,n){let o=e*t;return 8!==n&&(o=Math.ceil(o/(8/n))),o}let s=e.exports=function(e,t){let n=e.width,r=e.height,s=e.interlace,l=e.bpp,d=e.depth;if(this.read=t.read,this.write=t.write,this.complete=t.complete,this._imageIndex=0,this._images=[],s){let e=o.getImagePasses(n,r);for(let t=0;t<e.length;t++)this._images.push({byteWidth:i(e[t].width,l,d),height:e[t].height,lineIndex:0})}else this._images.push({byteWidth:i(n,l,d),height:r,lineIndex:0});8===d?this._xComparison=l:16===d?this._xComparison=2*l:this._xComparison=1};s.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))},s.prototype._unFilterType1=function(e,t,n){let o=this._xComparison,r=o-1;for(let i=0;i<n;i++){let n=e[1+i],s=i>r?t[i-o]:0;t[i]=n+s}},s.prototype._unFilterType2=function(e,t,n){let o=this._lastLine;for(let r=0;r<n;r++){let n=e[1+r],i=o?o[r]:0;t[r]=n+i}},s.prototype._unFilterType3=function(e,t,n){let o=this._xComparison,r=o-1,i=this._lastLine;for(let s=0;s<n;s++){let n=e[1+s],l=i?i[s]:0,d=Math.floor(((s>r?t[s-o]:0)+l)/2);t[s]=n+d}},s.prototype._unFilterType4=function(e,t,n){let o=this._xComparison,i=o-1,s=this._lastLine;for(let l=0;l<n;l++){let n=e[1+l],d=s?s[l]:0,a=r(l>i?t[l-o]:0,d,l>i&&s?s[l-o]:0);t[l]=n+a}},s.prototype._reverseFilterLine=function(e){let t,n=e[0],o=this._images[this._imageIndex],r=o.byteWidth;if(0===n)t=e.slice(1,r+1);else switch(t=Buffer.alloc(r),n){case 1:this._unFilterType1(e,t,r);break;case 2:this._unFilterType2(e,t,r);break;case 3:this._unFilterType3(e,t,r);break;case 4:this._unFilterType4(e,t,r);break;default:throw Error("Unrecognised filter type - "+n)}this.write(t),o.lineIndex++,o.lineIndex>=o.height?(this._lastLine=null,this._imageIndex++,o=this._images[this._imageIndex]):this._lastLine=t,o?this.read(o.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/format-normaliser.js"(e){e.exports=function(e,t){let n=t.depth,o=t.width,r=t.height,i=t.colorType,s=t.transColor,l=t.palette,d=e;return 3===i?!function(e,t,n,o,r){let i=0;for(let s=0;s<o;s++)for(let o=0;o<n;o++){let n=r[e[i]];if(!n)throw Error("index "+e[i]+" not in palette");for(let e=0;e<4;e++)t[i+e]=n[e];i+=4}}(e,d,o,r,l):(s&&function(e,t,n,o,r){let i=0;for(let s=0;s<o;s++)for(let o=0;o<n;o++){let n=!1;if(1===r.length?r[0]===e[i]&&(n=!0):r[0]===e[i]&&r[1]===e[i+1]&&r[2]===e[i+2]&&(n=!0),n)for(let e=0;e<4;e++)t[i+e]=0;i+=4}}(e,d,o,r,s),8!==n&&(16===n&&(d=Buffer.alloc(o*r*4)),!function(e,t,n,o,r){let i=Math.pow(2,r)-1,s=0;for(let r=0;r<o;r++)for(let o=0;o<n;o++){for(let n=0;n<4;n++)t[s+n]=Math.floor(255*e[s+n]/i+.5);s+=4}}(e,d,o,r,n))),d}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/interlace.js"(e,t){let n=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];t.getImagePasses=function(e,t){let o=[],r=e%8,i=t%8,s=(e-r)/8,l=(t-i)/8;for(let e=0;e<n.length;e++){let t=n[e],d=s*t.x.length,a=l*t.y.length;for(let e=0;e<t.x.length;e++)if(t.x[e]<r)d++;else break;for(let e=0;e<t.y.length;e++)if(t.y[e]<i)a++;else break;d>0&&a>0&&o.push({width:d,height:a,index:e})}return o},t.getInterlaceIterator=function(e){return function(t,o,r){let i=t%n[r].x.length,s=(t-i)/n[r].x.length*8+n[r].x[i],l=o%n[r].y.length;return 4*s+((o-l)/n[r].y.length*8+n[r].y[l])*e*4}}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer-async.js"(e,t,n){let o=n("util"),r=n("stream"),i=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/constants.js"),s=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer.js"),l=e.exports=function(e){r.call(this),this._packer=new s(e||{}),this._deflate=this._packer.createDeflate(),this.readable=!0};o.inherits(l,r),l.prototype.pack=function(e,t,n,o){this.emit("data",Buffer.from(i.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(t,n)),o&&this.emit("data",this._packer.packGAMA(o));let r=this._packer.filterData(e,t,n);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",(function(e){this.emit("data",this._packer.packIDAT(e))}).bind(this)),this._deflate.on("end",(function(){this.emit("data",this._packer.packIEND()),this.emit("end")}).bind(this)),this._deflate.end(r)}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer-sync.js"(e,t,n){let o=!0,r=n("zlib");r.deflateSync||(o=!1);let i=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/constants.js"),s=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer.js");e.exports=function(e,t){if(!o)throw Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let n=new s(t||{}),l=[];l.push(Buffer.from(i.PNG_SIGNATURE)),l.push(n.packIHDR(e.width,e.height)),e.gamma&&l.push(n.packGAMA(e.gamma));let d=n.filterData(e.data,e.width,e.height),a=r.deflateSync(d,n.getDeflateOptions());if(d=null,!a||!a.length)throw Error("bad png - invalid compressed data response");return l.push(n.packIDAT(a)),l.push(n.packIEND()),Buffer.concat(l)}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/constants.js"),r=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/crc.js"),i=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/bitpacker.js"),s=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-pack.js"),l=n("zlib"),d=e.exports=function(e){if(this._options=e,e.deflateChunkSize=e.deflateChunkSize||32768,e.deflateLevel=null!=e.deflateLevel?e.deflateLevel:9,e.deflateStrategy=null!=e.deflateStrategy?e.deflateStrategy:3,e.inputHasAlpha=null==e.inputHasAlpha||e.inputHasAlpha,e.deflateFactory=e.deflateFactory||l.createDeflate,e.bitDepth=e.bitDepth||8,e.colorType="number"==typeof e.colorType?e.colorType:o.COLORTYPE_COLOR_ALPHA,e.inputColorType="number"==typeof e.inputColorType?e.inputColorType:o.COLORTYPE_COLOR_ALPHA,-1===[o.COLORTYPE_GRAYSCALE,o.COLORTYPE_COLOR,o.COLORTYPE_COLOR_ALPHA,o.COLORTYPE_ALPHA].indexOf(e.colorType))throw Error("option color type:"+e.colorType+" is not supported at present");if(-1===[o.COLORTYPE_GRAYSCALE,o.COLORTYPE_COLOR,o.COLORTYPE_COLOR_ALPHA,o.COLORTYPE_ALPHA].indexOf(e.inputColorType))throw Error("option input color type:"+e.inputColorType+" is not supported at present");if(8!==e.bitDepth&&16!==e.bitDepth)throw Error("option bit depth:"+e.bitDepth+" is not supported at present")};d.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},d.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},d.prototype.filterData=function(e,t,n){let r=i(e,t,n,this._options),l=o.COLORTYPE_TO_BPP_MAP[this._options.colorType];return s(r,t,n,this._options,l)},d.prototype._packChunk=function(e,t){let n=t?t.length:0,o=Buffer.alloc(n+12);return o.writeUInt32BE(n,0),o.writeUInt32BE(e,4),t&&t.copy(o,8),o.writeInt32BE(r.crc32(o.slice(4,o.length-4)),o.length-4),o},d.prototype.packGAMA=function(e){let t=Buffer.alloc(4);return t.writeUInt32BE(Math.floor(e*o.GAMMA_DIVISION),0),this._packChunk(o.TYPE_gAMA,t)},d.prototype.packIHDR=function(e,t){let n=Buffer.alloc(13);return n.writeUInt32BE(e,0),n.writeUInt32BE(t,4),n[8]=this._options.bitDepth,n[9]=this._options.colorType,n[10]=0,n[11]=0,n[12]=0,this._packChunk(o.TYPE_IHDR,n)},d.prototype.packIDAT=function(e){return this._packChunk(o.TYPE_IDAT,e)},d.prototype.packIEND=function(){return this._packChunk(o.TYPE_IEND,null)}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/paeth-predictor.js"(e){e.exports=function(e,t,n){let o=e+t-n,r=Math.abs(o-e),i=Math.abs(o-t),s=Math.abs(o-n);return r<=i&&r<=s?e:i<=s?t:n}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser-async.js"(e,t,n){let o=n("util"),r=n("zlib"),i=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/chunkstream.js"),s=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-parse-async.js"),l=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser.js"),d=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/bitmapper.js"),a=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/format-normaliser.js"),u=e.exports=function(e){i.call(this),this._parser=new l(e,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=e,this.writable=!0,this._parser.start()};o.inherits(u,i),u.prototype._handleError=function(e){this.emit("error",e),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",function(){})),this.errord=!0},u.prototype._inflateData=function(e){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=r.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{let e=((this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3)+1)*this._bitmapInfo.height,t=Math.max(e,r.Z_MIN_CHUNK);this._inflate=r.createInflate({chunkSize:t});let n=e,o=this.emit.bind(this,"error");this._inflate.on("error",function(e){n&&o(e)}),this._filter.on("complete",this._complete.bind(this));let i=this._filter.write.bind(this._filter);this._inflate.on("data",function(e){n&&(e.length>n&&(e=e.slice(0,n)),n-=e.length,i(e))}),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(e)},u.prototype._handleMetaData=function(e){this._metaData=e,this._bitmapInfo=Object.create(e),this._filter=new s(this._bitmapInfo)},u.prototype._handleTransColor=function(e){this._bitmapInfo.transColor=e},u.prototype._handlePalette=function(e){this._bitmapInfo.palette=e},u.prototype._simpleTransparency=function(){this._metaData.alpha=!0},u.prototype._headersFinished=function(){this.emit("metadata",this._metaData)},u.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"))},u.prototype._complete=function(e){let t;if(!this.errord){try{let n=d.dataToBitMap(e,this._bitmapInfo);t=a(n,this._bitmapInfo),n=null}catch(e){this._handleError(e);return}this.emit("parsed",t)}}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser-sync.js"(e,t,n){let o=!0,r=n("zlib"),i=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/sync-inflate.js");r.deflateSync||(o=!1);let s=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/sync-reader.js"),l=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/filter-parse-sync.js"),d=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser.js"),a=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/bitmapper.js"),u=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/format-normaliser.js");e.exports=function(e,t){let n,h,p,c;if(!o)throw Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let f=[],m=new s(e);if(new d(t,{read:m.read.bind(m),error:function(e){n=e},metadata:function(e){h=e},gamma:function(e){p=e},palette:function(e){h.palette=e},transColor:function(e){h.transColor=e},inflateData:function(e){f.push(e)},simpleTransparency:function(){h.alpha=!0}}).start(),m.process(),n)throw n;let _=Buffer.concat(f);if(f.length=0,h.interlace)c=r.inflateSync(_);else{let e=((h.width*h.bpp*h.depth+7>>3)+1)*h.height;c=i(_,{chunkSize:e,maxLength:e})}if(_=null,!c||!c.length)throw Error("bad png - invalid inflate data response");let g=l.process(c,h);_=null;let b=a.dataToBitMap(g,h);g=null;let y=u(b,h);return h.data=y,h.gamma=p||0,h}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/constants.js"),r=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/crc.js"),i=e.exports=function(e,t){this._options=e,e.checkCRC=!1!==e.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[o.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[o.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[o.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[o.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[o.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[o.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=t.read,this.error=t.error,this.metadata=t.metadata,this.gamma=t.gamma,this.transColor=t.transColor,this.palette=t.palette,this.parsed=t.parsed,this.inflateData=t.inflateData,this.finished=t.finished,this.simpleTransparency=t.simpleTransparency,this.headersFinished=t.headersFinished||function(){}};i.prototype.start=function(){this.read(o.PNG_SIGNATURE.length,this._parseSignature.bind(this))},i.prototype._parseSignature=function(e){let t=o.PNG_SIGNATURE;for(let n=0;n<t.length;n++)if(e[n]!==t[n])return void this.error(Error("Invalid file signature"));this.read(8,this._parseChunkBegin.bind(this))},i.prototype._parseChunkBegin=function(e){let t=e.readUInt32BE(0),n=e.readUInt32BE(4),i="";for(let t=4;t<8;t++)i+=String.fromCharCode(e[t]);let s=!!(32&e[4]);return this._hasIHDR||n===o.TYPE_IHDR?(this._crc=new r,this._crc.write(Buffer.from(i)),this._chunks[n])?this._chunks[n](t):s?void this.read(t+4,this._skipChunk.bind(this)):void this.error(Error("Unsupported critical chunk type "+i)):void this.error(Error("Expected IHDR on beggining"))},i.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))},i.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))},i.prototype._parseChunkEnd=function(e){let t=e.readInt32BE(0),n=this._crc.crc32();this._options.checkCRC&&n!==t?this.error(Error("Crc error - "+t+" - "+n)):this._hasIEND||this.read(8,this._parseChunkBegin.bind(this))},i.prototype._handleIHDR=function(e){this.read(e,this._parseIHDR.bind(this))},i.prototype._parseIHDR=function(e){this._crc.write(e);let t=e.readUInt32BE(0),n=e.readUInt32BE(4),r=e[8],i=e[9],s=e[10],l=e[11],d=e[12];if(8!==r&&4!==r&&2!==r&&1!==r&&16!==r)return void this.error(Error("Unsupported bit depth "+r));if(!(i in o.COLORTYPE_TO_BPP_MAP))return void this.error(Error("Unsupported color type"));if(0!==s)return void this.error(Error("Unsupported compression method"));if(0!==l)return void this.error(Error("Unsupported filter method"));if(0!==d&&1!==d)return void this.error(Error("Unsupported interlace method"));this._colorType=i;let a=o.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=!0,this.metadata({width:t,height:n,depth:r,interlace:!!d,palette:!!(i&o.COLORTYPE_PALETTE),color:!!(i&o.COLORTYPE_COLOR),alpha:!!(i&o.COLORTYPE_ALPHA),bpp:a,colorType:i}),this._handleChunkEnd()},i.prototype._handlePLTE=function(e){this.read(e,this._parsePLTE.bind(this))},i.prototype._parsePLTE=function(e){this._crc.write(e);let t=Math.floor(e.length/3);for(let n=0;n<t;n++)this._palette.push([e[3*n],e[3*n+1],e[3*n+2],255]);this.palette(this._palette),this._handleChunkEnd()},i.prototype._handleTRNS=function(e){this.simpleTransparency(),this.read(e,this._parseTRNS.bind(this))},i.prototype._parseTRNS=function(e){if(this._crc.write(e),this._colorType===o.COLORTYPE_PALETTE_COLOR){if(0===this._palette.length)return void this.error(Error("Transparency chunk must be after palette"));if(e.length>this._palette.length)return void this.error(Error("More transparent colors than palette size"));for(let t=0;t<e.length;t++)this._palette[t][3]=e[t];this.palette(this._palette)}this._colorType===o.COLORTYPE_GRAYSCALE&&this.transColor([e.readUInt16BE(0)]),this._colorType===o.COLORTYPE_COLOR&&this.transColor([e.readUInt16BE(0),e.readUInt16BE(2),e.readUInt16BE(4)]),this._handleChunkEnd()},i.prototype._handleGAMA=function(e){this.read(e,this._parseGAMA.bind(this))},i.prototype._parseGAMA=function(e){this._crc.write(e),this.gamma(e.readUInt32BE(0)/o.GAMMA_DIVISION),this._handleChunkEnd()},i.prototype._handleIDAT=function(e){this._emittedHeadersFinished||(this._emittedHeadersFinished=!0,this.headersFinished()),this.read(-e,this._parseIDAT.bind(this,e))},i.prototype._parseIDAT=function(e,t){if(this._crc.write(t),this._colorType===o.COLORTYPE_PALETTE_COLOR&&0===this._palette.length)throw Error("Expected palette not found");this.inflateData(t);let n=e-t.length;n>0?this._handleIDAT(n):this._handleChunkEnd()},i.prototype._handleIEND=function(e){this.read(e,this._parseIEND.bind(this))},i.prototype._parseIEND=function(e){this._crc.write(e),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/png-sync.js"(e,t,n){let o=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser-sync.js"),r=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer-sync.js");t.read=function(e,t){return o(e,t||{})},t.write=function(e,t){return r(e,t)}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/png.js"(e,t,n){let o=n("util"),r=n("stream"),i=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser-async.js"),s=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer-async.js"),l=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/png-sync.js"),d=t.O=function(e){r.call(this),e=e||{},this.width=0|e.width,this.height=0|e.height,this.data=this.width>0&&this.height>0?Buffer.alloc(4*this.width*this.height):null,e.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new i(e),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",(function(e){this.data=e,this.emit("parsed",e)}).bind(this)),this._packer=new s(e),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};o.inherits(d,r),d.sync=l,d.prototype.pack=function(){return this.data&&this.data.length?process.nextTick((function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}).bind(this)):this.emit("error","No data provided"),this},d.prototype.parse=function(e,t){if(t){let e,n;e=(function(e){this.removeListener("error",n),this.data=e,t(null,this)}).bind(this),n=(function(n){this.removeListener("parsed",e),t(n,null)}).bind(this),this.once("parsed",e),this.once("error",n)}return this.end(e),this},d.prototype.write=function(e){return this._parser.write(e),!0},d.prototype.end=function(e){this._parser.end(e)},d.prototype._metadata=function(e){this.width=e.width,this.height=e.height,this.emit("metadata",e)},d.prototype._gamma=function(e){this.gamma=e},d.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},d.bitblt=function(e,t,n,o,r,i,s,l){if(o|=0,r|=0,i|=0,s|=0,l|=0,(n|=0)>e.width||o>e.height||n+r>e.width||o+i>e.height)throw Error("bitblt reading outside image");if(s>t.width||l>t.height||s+r>t.width||l+i>t.height)throw Error("bitblt writing outside image");for(let d=0;d<i;d++)e.data.copy(t.data,(l+d)*t.width+s<<2,(o+d)*e.width+n<<2,(o+d)*e.width+n+r<<2)},d.prototype.bitblt=function(e,t,n,o,r,i,s){return d.bitblt(this,e,t,n,o,r,i,s),this},d.adjustGamma=function(e){if(e.gamma){for(let t=0;t<e.height;t++)for(let n=0;n<e.width;n++){let o=e.width*t+n<<2;for(let t=0;t<3;t++){let n=e.data[o+t]/255;n=Math.pow(n,1/2.2/e.gamma),e.data[o+t]=Math.round(255*n)}}e.gamma=0}},d.prototype.adjustGamma=function(){d.adjustGamma(this)}},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/sync-inflate.js"(e,t,n){let o=n("assert").ok,r=n("zlib"),i=n("util"),s=n("buffer").kMaxLength;function l(e){if(!(this instanceof l))return new l(e);e&&e.chunkSize<r.Z_MIN_CHUNK&&(e.chunkSize=r.Z_MIN_CHUNK),r.Inflate.call(this,e),this._offset=void 0===this._offset?this._outOffset:this._offset,this._buffer=this._buffer||this._outBuffer,e&&null!=e.maxLength&&(this._maxLength=e.maxLength)}function d(e,t){t&&process.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function a(e,t){var n=new l(t),o=e;if("string"==typeof o&&(o=Buffer.from(o)),!(o instanceof Buffer))throw TypeError("Not a string or buffer");let i=n._finishFlushFlag;return null==i&&(i=r.Z_FINISH),n._processChunk(o,i)}l.prototype._processChunk=function(e,t,n){let i,l;if("function"==typeof n)return r.Inflate._processChunk.call(this,e,t,n);let a=this,u=e&&e.length,h=this._chunkSize-this._offset,p=this._maxLength,c=0,f=[],m=0;this.on("error",function(e){i=e}),o(this._handle,"zlib binding closed");do l=(l=this._handle.writeSync(t,e,c,u,this._buffer,this._offset,h))||this._writeState;while(!this._hadError&&function(e,t){if(a._hadError)return;let n=h-t;if(o(n>=0,"have should not go down"),n>0){let e=a._buffer.slice(a._offset,a._offset+n);if(a._offset+=n,e.length>p&&(e=e.slice(0,p)),f.push(e),m+=e.length,0==(p-=e.length))return!1}return(0===t||a._offset>=a._chunkSize)&&(h=a._chunkSize,a._offset=0,a._buffer=Buffer.allocUnsafe(a._chunkSize)),0===t&&(c+=u-e,u=e,!0)}(l[0],l[1]));if(this._hadError)throw i;if(m>=s)throw d(this),RangeError("Cannot create final Buffer. It would be larger than 0x"+s.toString(16)+" bytes");let _=Buffer.concat(f,m);return d(this),_},i.inherits(l,r.Inflate),e.exports=t=a,t.Inflate=l,t.createInflate=function(e){return new l(e)},t.inflateSync=a},"../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/sync-reader.js"(e){let t=e.exports=function(e){this._buffer=e,this._reads=[]};t.prototype.read=function(e,t){this._reads.push({length:Math.abs(e),allowLess:e<0,func:t})},t.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){let e=this._reads[0];if(this._buffer.length&&(this._buffer.length>=e.length||e.allowLess)){this._reads.shift();let t=this._buffer;this._buffer=t.slice(e.length),e.func.call(this,t.slice(0,e.length))}else break}return this._reads.length>0?Error("There are some read requests waitng on finished stream"):this._buffer.length>0?Error("unrecognised content at end of stream"):void 0}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/browser.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js"),i=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/canvas.js"),s=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg-tag.js");function l(e,t,n,i,s){let l=[].slice.call(arguments,1),d=l.length,a="function"==typeof l[d-1];if(!a&&!o())throw Error("Callback required as last argument");if(a){if(d<2)throw Error("Too few arguments provided");2===d?(s=n,n=t,t=i=void 0):3===d&&(t.getContext&&void 0===s?(s=i,i=void 0):(s=i,i=n,n=t,t=void 0))}else{if(d<1)throw Error("Too few arguments provided");return 1===d?(n=t,t=i=void 0):2!==d||t.getContext||(i=n,n=t,t=void 0),new Promise(function(o,s){try{let s=r.create(n,i);o(e(s,t,i))}catch(e){s(e)}})}try{let o=r.create(n,i);s(null,e(o,t,i))}catch(e){s(e)}}r.create,l.bind(null,i.render),l.bind(null,i.renderToDataURL),l.bind(null,function(e,t,n){return s.render(e,n)})},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js"(e){e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alignment-pattern.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js").getSymbolSize;t.getRowColCoords=function(e){if(1===e)return[];let t=Math.floor(e/7)+2,n=o(e),r=145===n?26:2*Math.ceil((n-13)/(2*t-2)),i=[n-7];for(let e=1;e<t-1;e++)i[e]=i[e-1]-r;return i.push(6),i.reverse()},t.getPositions=function(e){let n=[],o=t.getRowColCoords(e),r=o.length;for(let e=0;e<r;e++)for(let t=0;t<r;t++)(0!==e||0!==t)&&(0!==e||t!==r-1)&&(e!==r-1||0!==t)&&n.push([o[e],o[t]]);return n}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"),r=["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 i(e){this.mode=o.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=45*r.indexOf(this.data[t]);n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},e.exports=i},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-buffer.js"(e){function t(){this.buffer=[],this.length=0}t.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++)this.putBit((e>>>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++}},e.exports=t},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-matrix.js"(e){function t(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)}t.prototype.set=function(e,t,n,o){let r=e*this.size+t;this.data[r]=n,o&&(this.reservedBit[r]=!0)},t.prototype.get=function(e,t){return this.data[e*this.size+t]},t.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},t.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},e.exports=t},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js");function r(e){this.mode=o.BYTE,"string"==typeof e?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return 8*e},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<n;t++)e.put(this.data[t],8)},e.exports=r},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js"),r=[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],i=[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];t.getBlocksCount=function(e,t){switch(t){case o.L:return r[(e-1)*4+0];case o.M:return r[(e-1)*4+1];case o.Q:return r[(e-1)*4+2];case o.H:return r[(e-1)*4+3];default:return}},t.getTotalCodewordsCount=function(e,t){switch(t){case o.L:return i[(e-1)*4+0];case o.M:return i[(e-1)*4+1];case o.Q:return i[(e-1)*4+2];case o.H:return i[(e-1)*4+3];default:return}}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js"(e,t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},t.from=function(e,n){if(t.isValid(e))return e;try{if("string"!=typeof e)throw Error("Param is not a string");switch(e.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 Error("Unknown EC Level: "+e)}}catch(e){return n}}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js").getSymbolSize;t.getPositions=function(e){let t=o(e);return[[0,0],[t-7,0],[0,t-7]]}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/format-info.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js"),r=o.getBCHDigit(1335);t.getEncodedBits=function(e,t){let n=e.bit<<3|t,i=n<<10;for(;o.getBCHDigit(i)-r>=0;)i^=1335<<o.getBCHDigit(i)-r;return(n<<10|i)^21522}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/galois-field.js"(e,t){let n=new Uint8Array(512),o=new Uint8Array(256),r=1;for(let e=0;e<255;e++)n[e]=r,o[r]=e,256&(r<<=1)&&(r^=285);for(let e=255;e<512;e++)n[e]=n[e-255];t.exp=function(e){return n[e]},t.mul=function(e,t){return 0===e||0===t?0:n[o[e]+o[t]]}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js");function i(e){this.mode=o.KANJI,this.data=e}i.getBitsLength=function(e){return 13*e},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<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");n=(n>>>8&255)*192+(255&n),e.put(n,13)}},e.exports=i},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mask-pattern.js"(e,t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};t.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){let t=e.size,n=0,o=0,r=0,i=null,s=null;for(let l=0;l<t;l++){o=r=0,i=s=null;for(let d=0;d<t;d++){let t=e.get(l,d);t===i?o++:(o>=5&&(n+=3+(o-5)),i=t,o=1),(t=e.get(d,l))===s?r++:(r>=5&&(n+=3+(r-5)),s=t,r=1)}o>=5&&(n+=3+(o-5)),r>=5&&(n+=3+(r-5))}return n},t.getPenaltyN2=function(e){let t=e.size,n=0;for(let o=0;o<t-1;o++)for(let r=0;r<t-1;r++){let t=e.get(o,r)+e.get(o,r+1)+e.get(o+1,r)+e.get(o+1,r+1);(4===t||0===t)&&n++}return 3*n},t.getPenaltyN3=function(e){let t=e.size,n=0,o=0,r=0;for(let i=0;i<t;i++){o=r=0;for(let s=0;s<t;s++)o=o<<1&2047|e.get(i,s),s>=10&&(1488===o||93===o)&&n++,r=r<<1&2047|e.get(s,i),s>=10&&(1488===r||93===r)&&n++}return 40*n},t.getPenaltyN4=function(e){let t=0,n=e.data.length;for(let o=0;o<n;o++)t+=e.data[o];return 10*Math.abs(Math.ceil(100*t/n/5)-10)},t.applyMask=function(e,n){let o=n.size;for(let r=0;r<o;r++)for(let i=0;i<o;i++)n.isReserved(i,r)||n.xor(i,r,function(e,n,o){switch(e){case t.Patterns.PATTERN000:return(n+o)%2==0;case t.Patterns.PATTERN001:return n%2==0;case t.Patterns.PATTERN010:return o%3==0;case t.Patterns.PATTERN011:return(n+o)%3==0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(o/3))%2==0;case t.Patterns.PATTERN101:return n*o%2+n*o%3==0;case t.Patterns.PATTERN110:return(n*o%2+n*o%3)%2==0;case t.Patterns.PATTERN111:return(n*o%3+(n+o)%2)%2==0;default:throw Error("bad maskPattern:"+e)}}(e,i,r))},t.getBestMask=function(e,n){let o=Object.keys(t.Patterns).length,r=0,i=1/0;for(let s=0;s<o;s++){n(s),t.applyMask(s,e);let o=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(s,e),o<i&&(i=o,r=s)}return r}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js");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(e,t){if(!e.ccBits)throw Error("Invalid mode: "+e);if(!o.isValid(t))throw Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},t.getBestModeForData=function(e){return r.testNumeric(e)?t.NUMERIC:r.testAlphanumeric(e)?t.ALPHANUMERIC:r.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(e){if(e&&e.id)return e.id;throw Error("Invalid mode")},t.isValid=function(e){return e&&e.bit&&e.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{if("string"!=typeof e)throw Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw Error("Unknown mode: "+e)}}catch(e){return n}}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js");function r(e){this.mode=o.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;for(t=0;t+3<=this.data.length;t+=3)n=parseInt(this.data.substr(t,3),10),e.put(n,10);let o=this.data.length-t;o>0&&(n=parseInt(this.data.substr(t),10),e.put(n,3*o+1))},e.exports=r},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/polynomial.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/galois-field.js");t.mul=function(e,t){let n=new Uint8Array(e.length+t.length-1);for(let r=0;r<e.length;r++)for(let i=0;i<t.length;i++)n[r+i]^=o.mul(e[r],t[i]);return n},t.mod=function(e,t){let n=new Uint8Array(e);for(;n.length-t.length>=0;){let e=n[0];for(let r=0;r<t.length;r++)n[r]^=o.mul(t[r],e);let r=0;for(;r<n.length&&0===n[r];)r++;n=n.slice(r)}return n},t.generateECPolynomial=function(e){let n=new Uint8Array([1]);for(let r=0;r<e;r++)n=t.mul(n,new Uint8Array([1,o.exp(r)]));return n}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js"),i=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-buffer.js"),s=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-matrix.js"),l=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alignment-pattern.js"),d=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js"),a=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mask-pattern.js"),u=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js"),h=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/reed-solomon-encoder.js"),p=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version.js"),c=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/format-info.js"),f=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"),m=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js");function _(e,t,n){let o,r,i=e.size,s=c.getEncodedBits(t,n);for(o=0;o<15;o++)r=(s>>o&1)==1,o<6?e.set(o,8,r,!0):o<8?e.set(o+1,8,r,!0):e.set(i-15+o,8,r,!0),o<8?e.set(8,i-o-1,r,!0):o<9?e.set(8,15-o-1+1,r,!0):e.set(8,15-o-1,r,!0);e.set(i-8,8,1,!0)}t.create=function(e,t){let n,c;if(void 0===e||""===e)throw Error("No input text");let g=r.M;return void 0!==t&&(g=r.from(t.errorCorrectionLevel,r.M),n=p.from(t.version),c=a.from(t.maskPattern),t.toSJISFunc&&o.setToSJISFunction(t.toSJISFunc)),function(e,t,n,r){let c;if(Array.isArray(e))c=m.fromArray(e);else if("string"==typeof e){let o=t;if(!o){let t=m.rawSplit(e);o=p.getBestVersionForData(t,n)}c=m.fromString(e,o||40)}else throw Error("Invalid data");let g=p.getBestVersionForData(c,n);if(!g)throw Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<g)throw Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+g+".\n")}else t=g;let b=function(e,t,n){let r=new i;n.forEach(function(t){r.put(t.mode.bit,4),r.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(r)});let s=(o.getSymbolTotalCodewords(e)-u.getTotalCodewordsCount(e,t))*8;for(r.getLengthInBits()+4<=s&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(0);let l=(s-r.getLengthInBits())/8;for(let e=0;e<l;e++)r.put(e%2?17:236,8);return function(e,t,n){let r,i,s=o.getSymbolTotalCodewords(t),l=s-u.getTotalCodewordsCount(t,n),d=u.getBlocksCount(t,n),a=s%d,p=d-a,c=Math.floor(s/d),f=Math.floor(l/d),m=f+1,_=c-f,g=new h(_),b=0,y=Array(d),j=Array(d),E=0,w=new Uint8Array(e.buffer);for(let e=0;e<d;e++){let t=e<p?f:m;y[e]=w.slice(b,b+t),j[e]=g.encode(y[e]),b+=t,E=Math.max(E,t)}let T=new Uint8Array(s),C=0;for(r=0;r<E;r++)for(i=0;i<d;i++)r<y[i].length&&(T[C++]=y[i][r]);for(r=0;r<_;r++)for(i=0;i<d;i++)T[C++]=j[i][r];return T}(r,e,t)}(t,n,c),y=new s(o.getSymbolSize(t));!function(e,t){let n=e.size,o=d.getPositions(t);for(let t=0;t<o.length;t++){let r=o[t][0],i=o[t][1];for(let t=-1;t<=7;t++)if(!(r+t<=-1)&&!(n<=r+t))for(let o=-1;o<=7;o++)i+o<=-1||n<=i+o||(t>=0&&t<=6&&(0===o||6===o)||o>=0&&o<=6&&(0===t||6===t)||t>=2&&t<=4&&o>=2&&o<=4?e.set(r+t,i+o,!0,!0):e.set(r+t,i+o,!1,!0))}}(y,t);let j=y.size;for(let e=8;e<j-8;e++){let t=e%2==0;y.set(e,6,t,!0),y.set(6,e,t,!0)}return!function(e,t){let n=l.getPositions(t);for(let t=0;t<n.length;t++){let o=n[t][0],r=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)-2===t||2===t||-2===n||2===n||0===t&&0===n?e.set(o+t,r+n,!0,!0):e.set(o+t,r+n,!1,!0)}}(y,t),_(y,n,0),t>=7&&function(e,t){let n,o,r,i=e.size,s=p.getEncodedBits(t);for(let t=0;t<18;t++)n=Math.floor(t/3),o=t%3+i-8-3,r=(s>>t&1)==1,e.set(n,o,r,!0),e.set(o,n,r,!0)}(y,t),!function(e,t){let n=e.size,o=-1,r=n-1,i=7,s=0;for(let l=n-1;l>0;l-=2)for(6===l&&l--;;){for(let n=0;n<2;n++)if(!e.isReserved(r,l-n)){let o=!1;s<t.length&&(o=(t[s]>>>i&1)==1),e.set(r,l-n,o),-1==--i&&(s++,i=7)}if((r+=o)<0||n<=r){r-=o,o=-o;break}}}(y,b),isNaN(r)&&(r=a.getBestMask(y,_.bind(null,y,n))),a.applyMask(r,y),_(y,n,r),{modules:y,version:t,errorCorrectionLevel:n,maskPattern:r,segments:c}}(e,n,g,c)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/reed-solomon-encoder.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/polynomial.js");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=o.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 n=o.mod(t,this.genPoly),r=this.degree-n.length;if(r>0){let e=new Uint8Array(this.degree);return e.set(n,r),e}return n},e.exports=r},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js"(e,t){let n="[0-9]+",o="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",r="(?:(?![A-Z0-9 $%*+\\-./:]|"+(o=o.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";t.KANJI=RegExp(o,"g"),t.BYTE_KANJI=RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=RegExp(r,"g"),t.NUMERIC=RegExp(n,"g"),t.ALPHANUMERIC=RegExp("[A-Z $%*+\\-./:]+","g");let i=RegExp("^"+o+"$"),s=RegExp("^"+n+"$"),l=RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(e){return i.test(e)},t.testNumeric=function(e){return s.test(e)},t.testAlphanumeric=function(e){return l.test(e)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js"),i=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js"),s=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js"),l=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js"),d=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js"),a=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js"),u=n("../../../node_modules/.pnpm/dijkstrajs@1.0.3/node_modules/dijkstrajs/dijkstra.js");function h(e){return unescape(encodeURIComponent(e)).length}function p(e,t,n){let o,r=[];for(;null!==(o=e.exec(n));)r.push({data:o[0],index:o.index,mode:t,length:o[0].length});return r}function c(e){let t,n,r=p(d.NUMERIC,o.NUMERIC,e),i=p(d.ALPHANUMERIC,o.ALPHANUMERIC,e);return a.isKanjiModeEnabled()?(t=p(d.BYTE,o.BYTE,e),n=p(d.KANJI,o.KANJI,e)):(t=p(d.BYTE_KANJI,o.BYTE,e),n=[]),r.concat(i,t,n).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,t){switch(t){case o.NUMERIC:return r.getBitsLength(e);case o.ALPHANUMERIC:return i.getBitsLength(e);case o.KANJI:return l.getBitsLength(e);case o.BYTE:return s.getBitsLength(e)}}function m(e,t){let n,d=o.getBestModeForData(e);if((n=o.from(t,d))!==o.BYTE&&n.bit<d.bit)throw Error('"'+e+'" cannot be encoded with mode '+o.toString(n)+".\n Suggested mode is: "+o.toString(d));switch(n===o.KANJI&&!a.isKanjiModeEnabled()&&(n=o.BYTE),n){case o.NUMERIC:return new r(e);case o.ALPHANUMERIC:return new i(e);case o.KANJI:return new l(e);case o.BYTE:return new s(e)}}t.fromArray=function(e){return e.reduce(function(e,t){return"string"==typeof t?e.push(m(t,null)):t.data&&e.push(m(t.data,t.mode)),e},[])},t.fromString=function(e,n){let r=function(e,t){let n={},r={start:{}},i=["start"];for(let s=0;s<e.length;s++){let l=e[s],d=[];for(let e=0;e<l.length;e++){let a=l[e],u=""+s+e;d.push(u),n[u]={node:a,lastCount:0},r[u]={};for(let e=0;e<i.length;e++){let s=i[e];n[s]&&n[s].node.mode===a.mode?(r[s][u]=f(n[s].lastCount+a.length,a.mode)-f(n[s].lastCount,a.mode),n[s].lastCount+=a.length):(n[s]&&(n[s].lastCount=a.length),r[s][u]=f(a.length,a.mode)+4+o.getCharCountIndicator(a.mode,t))}}i=d}for(let e=0;e<i.length;e++)r[i[e]].end=0;return{map:r,table:n}}(function(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];switch(r.mode){case o.NUMERIC:t.push([r,{data:r.data,mode:o.ALPHANUMERIC,length:r.length},{data:r.data,mode:o.BYTE,length:r.length}]);break;case o.ALPHANUMERIC:t.push([r,{data:r.data,mode:o.BYTE,length:r.length}]);break;case o.KANJI:t.push([r,{data:r.data,mode:o.BYTE,length:h(r.data)}]);break;case o.BYTE:t.push([{data:r.data,mode:o.BYTE,length:h(r.data)}])}}return t}(c(e,a.isKanjiModeEnabled())),n),i=u.find_path(r.map,"start","end"),s=[];for(let e=1;e<i.length-1;e++)s.push(r.table[i[e]].node);return t.fromArray(s.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.push(t),e},[]))},t.rawSplit=function(e){return t.fromArray(c(e,a.isKanjiModeEnabled()))}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js"(e,t){let n,o=[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];t.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 4*e+17},t.getSymbolTotalCodewords=function(e){return o[e]},t.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},t.setToSJISFunction=function(e){if("function"!=typeof e)throw Error('"toSJISFunc" is not a valid function.');n=e},t.isKanjiModeEnabled=function(){return void 0!==n},t.toSJIS=function(e){return n(e)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js"(e,t){t.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js"),i=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js"),s=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"),l=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js"),d=o.getBCHDigit(7973);function a(e,t){return s.getCharCountIndicator(e,t)+4}t.from=function(e,t){return l.isValid(e)?parseInt(e,10):t},t.getCapacity=function(e,t,n){if(!l.isValid(e))throw Error("Invalid QR Code version");void 0===n&&(n=s.BYTE);let i=(o.getSymbolTotalCodewords(e)-r.getTotalCodewordsCount(e,t))*8;if(n===s.MIXED)return i;let d=i-a(n,e);switch(n){case s.NUMERIC:return Math.floor(d/10*3);case s.ALPHANUMERIC:return Math.floor(d/11*2);case s.KANJI:return Math.floor(d/13);case s.BYTE:default:return Math.floor(d/8)}},t.getBestVersionForData=function(e,n){let o,r=i.from(n,i.M);if(Array.isArray(e)){if(e.length>1){for(let n=1;n<=40;n++)if(function(e,t){let n=0;return e.forEach(function(e){let o=a(e.mode,t);n+=o+e.getBitsLength()}),n}(e,n)<=t.getCapacity(n,r,s.MIXED))return n;return}if(0===e.length)return 1;o=e[0]}else o=e;return function(e,n,o){for(let r=1;r<=40;r++)if(n<=t.getCapacity(r,o,e))return r}(o.mode,o.getLength(),r)},t.getEncodedBits=function(e){if(!l.isValid(e)||e<7)throw Error("Invalid QR Code version");let t=e<<12;for(;o.getBCHDigit(t)-d>=0;)t^=7973<<o.getBCHDigit(t)-d;return e<<12|t}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/index.js"(e,t,n){e.exports=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/server.js")},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/canvas.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js");t.render=function(e,t,n){var r;let i=n,s=t;void 0!==i||t&&t.getContext||(i=t,t=void 0),t||(s=function(){try{return document.createElement("canvas")}catch(e){throw Error("You need to specify a canvas element")}}()),i=o.getOptions(i);let l=o.getImageWidth(e.modules.size,i),d=s.getContext("2d"),a=d.createImageData(l,l);return o.qrToImageData(a.data,e,i),r=s,d.clearRect(0,0,r.width,r.height),r.style||(r.style={}),r.height=l,r.width=l,r.style.height=l+"px",r.style.width=l+"px",d.putImageData(a,0,0),s},t.renderToDataURL=function(e,n,o){let r=o;void 0!==r||n&&n.getContext||(r=n,n=void 0),r||(r={});let i=t.render(e,n,r),s=r.type||"image/png",l=r.rendererOpts||{};return i.toDataURL(s,l.quality)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/png.js"(e,t,n){let o=n("fs"),r=n("../../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/png.js").O,i=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js");t.render=function(e,t){let n=i.getOptions(t),o=n.rendererOpts,s=i.getImageWidth(e.modules.size,n);o.width=s,o.height=s;let l=new r(o);return i.qrToImageData(l.data,e,n),l},t.renderToDataURL=function(e,n,o){void 0===o&&(o=n,n=void 0),t.renderToBuffer(e,n,function(e,t){e&&o(e);let n="data:image/png;base64,";n+=t.toString("base64"),o(null,n)})},t.renderToBuffer=function(e,n,o){void 0===o&&(o=n,n=void 0);let r=t.render(e,n),i=[];r.on("error",o),r.on("data",function(e){i.push(e)}),r.on("end",function(){o(null,Buffer.concat(i))}),r.pack()},t.renderToFile=function(e,n,r,i){void 0===i&&(i=r,r=void 0);let s=!1,l=(...e)=>{s||(s=!0,i.apply(null,e))},d=o.createWriteStream(e);d.on("error",l),d.on("close",l),t.renderToFileStream(d,n,r)},t.renderToFileStream=function(e,n,o){t.render(n,o).pack().pipe(e)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg-tag.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js");function r(e,t){let n=e.a/255,o=t+'="'+e.hex+'"';return n<1?o+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':o}function i(e,t,n){let o=e+t;return void 0!==n&&(o+=" "+n),o}t.render=function(e,t,n){let s=o.getOptions(t),l=e.modules.size,d=e.modules.data,a=l+2*s.margin,u=s.color.light.a?"<path "+r(s.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",h="<path "+r(s.color.dark,"stroke")+' d="'+function(e,t,n){let o="",r=0,s=!1,l=0;for(let d=0;d<e.length;d++){let a=Math.floor(d%t),u=Math.floor(d/t);a||s||(s=!0),e[d]?(l++,d>0&&a>0&&e[d-1]||(o+=s?i("M",a+n,.5+u+n):i("m",r,0),r=0,s=!1),a+1<t&&e[d+1]||(o+=i("h",l),l=0)):r++}return o}(d,l,s.margin)+'"/>',p='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+('viewBox="0 0 '+a+" ")+a+'" shape-rendering="crispEdges">'+u+h+"</svg>\n";return"function"==typeof n&&n(null,p),p}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg.js"(e,t,n){t.render=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg-tag.js").render,t.renderToFile=function(e,o,r,i){void 0===i&&(i=r,r=void 0);let s=n("fs"),l=t.render(o,r);s.writeFile(e,'<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'+l,i)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal/terminal.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal/terminal-small.js");t.render=function(e,t,n){return t&&t.small?r.render(e,t,n):o.render(e,t,n)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal/terminal-small.js"(e,t){let n="\x1b[37m",o="\x1b[30m",r="\x1b[0m",i="\x1b[47m"+o,s="\x1b[40m"+n,l=function(e,t,n,o){let r=t+1;return n>=r||o>=r||o<-1||n<-1?"0":n>=t||o>=t||o<0||n<0?"1":e[o*t+n]?"2":"1"},d=function(e,t,n,o){return l(e,t,n,o)+l(e,t,n,o+1)};t.render=function(e,t,l){var a,u;let h=e.modules.size,p=e.modules.data,c=!!(t&&t.inverse),f=t&&t.inverse?s:i,m={"00":r+" "+f,"01":r+(a=c?o:n)+"▄"+f,"02":r+(u=c?n:o)+"▄"+f,10:r+a+"▀"+f,11:" ",12:"▄",20:r+u+"▀"+f,21:"▀",22:"█"},_=r+"\n"+f,g=f;for(let e=-1;e<h+1;e+=2){for(let t=-1;t<h;t++)g+=m[d(p,h,t,e)];g+=m[d(p,h,h,e)]+_}return g+=r,"function"==typeof l&&l(null,g),g}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal/terminal.js"(e,t){t.render=function(e,t,n){let o=e.modules.size,r=e.modules.data,i="\x1b[47m \x1b[0m",s="",l=Array(o+3).join(i),d=[,,].join(i);s+=l+"\n";for(let e=0;e<o;++e){s+=i;for(let t=0;t<o;t++)s+=r[e*o+t]?"\x1b[40m \x1b[0m":i;s+=d+"\n"}return s+=l+"\n","function"==typeof n&&n(null,s),s}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utf8.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js"),r={WW:" ",WB:"▄",BB:"█",BW:"▀"},i={BB:" ",BW:"▄",WW:"█",WB:"▀"};t.render=function(e,t,n){let s=o.getOptions(t),l=r;("#ffffff"===s.color.dark.hex||"#000000"===s.color.light.hex)&&(l=i);let d=e.modules.size,a=e.modules.data,u="",h=Array(d+2*s.margin+1).join(l.WW);h=Array(s.margin/2+1).join(h+"\n");let p=Array(s.margin+1).join(l.WW);u+=h;for(let e=0;e<d;e+=2){u+=p;for(let t=0;t<d;t++){var c;let n=a[e*d+t],o=a[(e+1)*d+t];u+=(c=l,n&&o?c.BB:n&&!o?c.BW:!n&&o?c.WB:c.WW)}u+=p+"\n"}return u+=h.slice(0,-1),"function"==typeof n&&n(null,u),u},t.renderToFile=function(e,o,r,i){void 0===i&&(i=r,r=void 0);let s=n("fs"),l=t.render(o,r);s.writeFile(e,l,i)}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js"(e,t){function n(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw Error("Invalid hex color: "+e);(3===t.length||4===t.length)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),6===t.length&&t.push("F","F");let n=parseInt(t.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+t.slice(0,6).join("")}}t.getOptions=function(e){e||(e={}),e.color||(e.color={});let t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,o=e.width&&e.width>=21?e.width:void 0,r=e.scale||4;return{width:o,scale:o?4:r,margin:t,color:{dark:n(e.color.dark||"#000000ff"),light:n(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},t.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},t.getImageWidth=function(e,n){let o=t.getScale(e,n);return Math.floor((e+2*n.margin)*o)},t.qrToImageData=function(e,n,o){let r=n.modules.size,i=n.modules.data,s=t.getScale(r,o),l=Math.floor((r+2*o.margin)*s),d=o.margin*s,a=[o.color.light,o.color.dark];for(let t=0;t<l;t++)for(let n=0;n<l;n++){let u=(t*l+n)*4,h=o.color.light;t>=d&&n>=d&&t<l-d&&n<l-d&&(h=a[+!!i[Math.floor((t-d)/s)*r+Math.floor((n-d)/s)]]),e[u++]=h.r,e[u++]=h.g,e[u++]=h.b,e[u]=h.a}}},"../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/server.js"(e,t,n){let o=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js"),r=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js"),i=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/png.js"),s=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utf8.js"),l=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/terminal.js"),d=n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg.js");function a(e,t,n){if(void 0===e)throw Error("String required as first argument");if(void 0===n&&(n=t,t={}),"function"!=typeof n)if(o())t=n||{},n=null;else throw Error("Callback required as last argument");return{opts:t,cb:n}}function u(e,t,n){if(!n.cb)return new Promise(function(o,i){try{let s=r.create(t,n.opts);return e(s,n.opts,function(e,t){return e?i(e):o(t)})}catch(e){i(e)}});try{let o=r.create(t,n.opts);return e(o,n.opts,n.cb)}catch(e){n.cb(e)}}t.create=r.create,n("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/browser.js"),t.toString=function(e,t,n){let o=a(e,t,n);return u(function(e){switch(e){case"svg":return d;case"terminal":return l;default:return s}}(o.opts?o.opts.type:void 0).render,e,o)},t.toDataURL=function(e,t,n){let o=a(e,t,n);return u(function(e){switch(e){case"svg":return d;case"txt":case"utf8":return s;default:return i}}(o.opts.type).renderToDataURL,e,o)}}});let b=l("../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/index.js");async function y(e){let t=await b.toDataURL(e,{margin:4,scale:8,errorCorrectionLevel:"L"});return`<!doctype html>
2
2
  <html lang="zh-CN"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
3
3
  <title>豆包扫码</title>
4
4
  <style>body{margin:32px;font-family:system-ui,sans-serif;background:#f5f6f8;color:#1f2329;text-align:center}main{display:flex;flex-wrap:wrap;justify-content:center;gap:24px}section{padding:24px;background:white;border-radius:12px}h2{font-size:18px}img{display:block;width:360px;max-width:100%;height:auto}p{color:#586174}</style>
5
5
  <h1>使用豆包扫码</h1><p>使用手机豆包扫描下方二维码。</p>
6
- <main><section><img src="${t}" alt="豆包二维码"></section></main><p>二维码过期或重新生成后,请从终端重新打开此页。</p></html>`}async function g(e,t=!1){if(!t){let t=await m.toString(e,{type:"utf8",margin:4}),n=t.replace(/\n$/,"").split("\n");return{width:t.split("\n")[0].length,text:n.map(e=>`\x1b[30;47m${e}\x1b[0m`).join("\n")}}let{modules:n}=m.create(e),o=Array.from({length:n.size+8},(e,t)=>t-4);return{width:2*o.length,text:o.map(e=>{let t=o.map(t=>t>=0&&e>=0&&t<n.size&&e<n.size&&n.get(e,t)?"\x1b[30;40m██":"\x1b[30;47m ").join("");return`${t}\x1b[0m`}).join("\n")}}async function b(t,n){let{id:o,name:r}=t.plugin,i={...o?{ability_id:o}:{name:r},version:n},s=AbortSignal.timeout(6e5);u().regex(/^\d+\.\d+\.\d+$/,"版本号须为 x.y.z 格式").parse(n),await f("等待云构建",async()=>{for(;;){let t=await d(i,s);if("BUILD_SUCCEEDED"===t.artifact_status)return;if("BUILD_FAILED"===t.artifact_status){let e=t.artifact_build_error_info;throw Error(e?.error_info||e?.error_code||"云构建失败")}await e(2e3,void 0,{signal:s})}});let l=await p(i,s),a=l.preview?.preview_url;if(!a)throw Error("服务端未返回预览链接");await y({url:a,name:l.display_name||r,version:l.test_version||n,expiresAt:l.expires_at_ms})}async function y(e){let s,{url:d,name:u,version:p,expiresAt:f}=e,m=[`插件 ${u}`,`版本 ${p}`,...f?[`有效期至 ${new Date(Number(f)).toLocaleString("zh-CN",{hour12:!1})}(本地时间)`]:[]];if(console.log(`
7
- ${c.blue.bold("豆包扫码预览")}
8
- ${m.join("\n")}
9
- `),!process.stdin.isTTY||!process.stdout.isTTY){console.log(`预览链接:${d}`),console.log(t((await g(d)).text));return}let b={async open(e){let t=await _(e);s??=await n.mkdtemp(r.join(o.tmpdir(),"dbx-qr-"));let d=r.join(s,"index.html");await n.writeFile(d,t,{mode:384}),await l(i(d).href)},async close(){s&&(await n.rm(s,{recursive:!0,force:!0}),s=void 0)}},y=!1;try{for(;;){let e=await g(d,y);process.stdout.columns&&e.width+2>process.stdout.columns?console.log("终端宽度不足,请拉宽窗口或选择“在浏览器中查看二维码”。"):console.log(e.text.split("\n").map(e=>` ${e}`).join("\n")),console.log("\n请使用豆包扫码预览。若无法识别,可切换二维码大小或在浏览器中查看。");let t=await a({message:"请选择操作",options:[{value:"change-size",label:`切换为${y?"小":"大"}尺寸二维码`},{value:"open-web",label:"在浏览器中查看二维码"},{value:"back",label:"完成并退出"}]});if(h(t)||"back"===t)return;if("change-size"===t)y=!y;else try{await b.open(d)}catch(e){console.log(`无法打开二维码页面:${e instanceof Error?e.message:String(e)}`)}}}finally{await b.close()}}export{b as showPreview};
6
+ <main><section><img src="${t}" alt="豆包二维码"></section></main><p>二维码过期或重新生成后,请从终端重新打开此页。</p></html>`}async function j(e,t=!1){if(!t){let t=await b.toString(e,{type:"utf8",margin:4}),n=t.replace(/\n$/,"").split("\n");return{width:t.split("\n")[0].length,text:n.map(e=>`\x1b[30;47m${e}\x1b[0m`).join("\n")}}let{modules:n}=b.create(e),o=Array.from({length:n.size+8},(e,t)=>t-4);return{width:2*o.length,text:o.map(e=>{let t=o.map(t=>t>=0&&e>=0&&t<n.size&&e<n.size&&n.get(e,t)?"\x1b[30;40m██":"\x1b[30;47m ").join("");return`${t}\x1b[0m`}).join("\n")}}async function E(t,n){let{name:o}=t.plugin,r={...p(t.plugin),version:n},i=AbortSignal.timeout(6e5);s.string().regex(/^\d+\.\d+\.\d+$/,"版本号须为 x.y.z 格式").parse(n),await g("等待云构建",async()=>{for(;;){let t=await h(r,i);if("BUILD_SUCCEEDED"===t.artifact_status)return;if("BUILD_FAILED"===t.artifact_status){let e=t.artifact_build_error_info;throw Error(e?.error_info||e?.error_code||"云构建失败")}await e(2e3,void 0,{signal:i})}});let l=await u(r,i),d=l.preview?.preview_url;if(!d)throw Error("服务端未返回预览链接");await w({url:d,name:l.display_name||o,version:l.test_version||n,expiresAt:l.expires_at_ms})}async function w(e){let s,{url:l,name:u,version:h,expiresAt:p}=e,g=[`插件 ${u}`,`版本 ${h}`,...p?[`有效期至 ${new Date(Number(p)).toLocaleString("zh-CN",{hour12:!1})}(本地时间)`]:[]];if(console.log(`
7
+ ${_.blue.bold("豆包扫码预览")}
8
+ ${g.join("\n")}
9
+ `),!f()){console.log(`预览链接:${l}`),console.log(t((await j(l)).text));return}let b={async open(e){let t=await y(e);s??=await n.mkdtemp(r.join(o.tmpdir(),"dbx-qr-"));let l=r.join(s,"index.html");await n.writeFile(l,t,{mode:384}),await d(i(l).href)},async close(){s&&(await n.rm(s,{recursive:!0,force:!0}),s=void 0)}},E=!1;try{for(;;){let e=await j(l,E);process.stdout.columns&&e.width+2>process.stdout.columns?console.log("终端宽度不足,请拉宽窗口或选择“在浏览器中查看二维码”。"):console.log(e.text.split("\n").map(e=>` ${e}`).join("\n")),console.log("\n请使用豆包扫码预览。若无法识别,可切换二维码大小或在浏览器中查看。");let t=await a({message:"请选择操作",options:[{value:"change-size",label:`切换为${E?"小":"大"}尺寸二维码`},{value:"open-web",label:"在浏览器中查看二维码"},{value:"back",label:"完成并退出"}]});if(c(t)||"back"===t)return;if("change-size"===t)E=!E;else try{await b.open(l)}catch(e){console.log(`无法打开二维码页面:${m(e)}`)}}}finally{await b.close()}}export{E as showPreview};
@@ -1 +1 @@
1
- import{createDevServerHeader as e,terminal_blockGlyphsSafe as t,captureTerminalOutput as a,state_State as s,createQRCodeCard as n}from"./dist.js";import{error_errorMessage as i}from"./691.js";async function r(r,o){let l,c=[],d=new s([{name:"退出",commandId:"q",args:[]}]),m=new Set,p=r.states.createState({status:o.projectName,rows:[]}),u=new Set,g=!1,w=Promise.resolve(),f=(e,t=!1)=>y(()=>r.addMessage({type:"log",text:e,level:t?"error":"info"})),y=e=>{w=w.then(async()=>{g||await e()}).catch(e=>{g||(l=e,g=!0,o.onExit(!0))})},b=()=>Object.assign({},...c.map(e=>e.actions)),S=async(e,t)=>{let a=b()[e];if(!(g||!a||u.has(a))){u.add(a);try{await a.run({signal:AbortSignal.any([t,o.signal])})}finally{u.delete(a)}}},h=()=>{p.set({status:o.projectName,rows:c.flatMap(e=>[{label:e.title,text:e.message,status:e.status},...e.detail?[{label:"",text:e.detail,status:"detail"}]:[],...Object.entries(e.links??{}).map(([e,t])=>({label:e,text:t,status:"link"}))])})};await r.switchScene({id:"plugin-dev",compact:!0,commands:[{name:"q",description:"退出开发",callback:async()=>o.onExit(!1)}],headerComponent:e(p,!0),quickActions:d});let _=a({append(e,t){f(t,"error"===e)}}),$=()=>{g||(g=!0,o.onExit(!0))};return r.done.then($,e=>{l=e,$()}),{interactive:!0,addTarget(e,a){let s,i={title:a,status:"pending",message:"正在启动"};return c.push(i),h(),{log:{info:t=>f(`[${e}] ${t}`),success:t=>f(`[${e}] ${t}`),warn:t=>f(`[${e}] 警告:${t}`),error:t=>f(`[${e}] ${t}`,!0)},ui:{update(e){!g&&(Object.assign(i,e),h(),"actions"in e&&y(async()=>{let e=Object.entries(b()).filter(([e])=>"q"!==e);for(let[t,a]of e)m.has(t)||(await r.registerCommand({name:t,description:a.label,callback:(e,a)=>S(t,a)}),m.add(t));d.set([...e.map(([e,t])=>({name:t.label,commandId:e,args:[]})),{name:"退出",commandId:"q",args:[]}])}))},async select(e,t){let a;if(!g)return await r.showSelection(t.map(({value:e,label:t})=>({label:t,action:()=>{a=e}})),{title:e}),a},print:f,qr({action:e,...a}){y(async()=>{if(!a.active&&(!s||s.disposed))return;let i={...a,openCommand:e,blockGlyphsSafe:t()};s&&!s.disposed?s.set(i):(s=r.states.createState(i),await r.addMessage({type:"component",...n(s)}))})}}}},async close(){_.dispose(),await w,g=!0;try{await r.close()}finally{d.dispose()}if(l)throw Error(`开发界面失败:${i(l)}`,{cause:l})}}}export{r as createRatatuiDevUI};
1
+ import{blockGlyphsSafe as e,error_errorMessage as t,state_State as a}from"./691.js";import{createDevServerHeader as s,captureTerminalOutput as n,createQRCodeCard as i}from"./dist.js";async function r(r,o){let l,c=[],d=new a([{name:"退出",commandId:"q",args:[]}]),m=new Set,p=r.states.createState({status:o.projectName,rows:[]}),u=new Set,g=!1,w=Promise.resolve(),f=(e,t=!1)=>y(()=>r.addMessage({type:"log",text:e,level:t?"error":"info"})),y=e=>{w=w.then(async()=>{g||await e()}).catch(e=>{g||(l=e,g=!0,o.onExit(!0))})},b=()=>Object.assign({},...c.map(e=>e.actions)),S=async(e,t)=>{let a=b()[e];if(!(g||!a||u.has(a))){u.add(a);try{await a.run({signal:AbortSignal.any([t,o.signal])})}finally{u.delete(a)}}},h=()=>{p.set({status:o.projectName,rows:c.flatMap(e=>[{label:e.title,text:e.message,status:e.status},...e.detail?[{label:"",text:e.detail,status:"detail"}]:[],...Object.entries(e.links??{}).map(([e,t])=>({label:e,text:t,status:"link"}))])})};await r.switchScene({id:"plugin-dev",compact:!0,commands:[{name:"q",description:"退出开发",callback:async()=>o.onExit(!1)}],headerComponent:s(p,!0),quickActions:d});let _=n({append(e,t){f(t,"error"===e)}}),$=()=>{g||(g=!0,o.onExit(!0))};return r.done.then($,e=>{l=e,$()}),{interactive:!0,addTarget(t,a){let s,n={title:a,status:"pending",message:"正在启动"};return c.push(n),h(),{log:{info:e=>f(`[${t}] ${e}`),success:e=>f(`[${t}] ${e}`),warn:e=>f(`[${t}] 警告:${e}`),error:e=>f(`[${t}] ${e}`,!0)},ui:{update(e){!g&&(Object.assign(n,e),h(),"actions"in e&&y(async()=>{let e=Object.entries(b()).filter(([e])=>"q"!==e);for(let[t,a]of e)m.has(t)||(await r.registerCommand({name:t,description:a.label,callback:(e,a)=>S(t,a)}),m.add(t));d.set([...e.map(([e,t])=>({name:t.label,commandId:e,args:[]})),{name:"退出",commandId:"q",args:[]}])}))},async select(e,t){let a;if(!g)return await r.showSelection(t.map(({value:e,label:t})=>({label:t,action:()=>{a=e}})),{title:e}),a},print:f,qr({action:t,...a}){y(async()=>{if(!a.active&&(!s||s.disposed))return;let n={...a,openCommand:t,blockGlyphsSafe:e()};s&&!s.disposed?s.set(n):(s=r.states.createState(n),await r.addMessage({type:"component",...i(s)}))})}}}},async close(){_.dispose(),await w,g=!0;try{await r.close()}finally{d.dispose()}if(l)throw Error(`开发界面失败:${t(l)}`,{cause:l})}}}export{r as createRatatuiDevUI};
package/dist/session.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! LICENSE: session.js.LICENSE.txt */
2
- import{dirname as t,join as e,relative as i,resolve as s,sep as r}from"node:path";import{EventEmitter as a}from"node:events";import{existsSync as o,stat as n,unwatchFile as l,watch as h,watchFile as d}from"node:fs";import{lstat as c,open as f,readdir as p,realpath as m,stat as u}from"node:fs/promises";import{Readable as _}from"node:stream";import{type as w}from"node:os";import{fileURLToPath as g}from"node:url";import{callHook as y,dist_ye as v,dist_xe as b,collectHooks as P,log as E,pD as x,isInteractive as k,error_errorMessage as S}from"./691.js";import{ensureLogin as D}from"./command~1.js";import{uploadDraft as W}from"./draft.js";import*as I from"node:path";let R="files",C="directories",F="files_directories",z={root:".",fileFilter:t=>!0,directoryFilter:t=>!0,type:R,lstat:!1,depth:0x80000000,alwaysStat:!1,highWaterMark:4096};Object.freeze(z);let j="READDIRP_RECURSIVE_ERROR",M=new Set(["ENOENT","EPERM","EACCES","ELOOP",j]),T=[C,"all",F,R],A=new Set([C,"all",F]),N=new Set(["all",F,R]),$="win32"===process.platform,O=t=>!0,H=t=>{if(void 0===t)return O;if("function"==typeof t)return t;if("string"==typeof t){let e=t.trim();return t=>t.basename===e}if(Array.isArray(t)){let e=t.map(t=>t.trim());return t=>e.some(e=>t.basename===e)}return O};class U extends _{parents;reading;parent;_stat;_maxDepth;_wantsDir;_wantsFile;_wantsEverything;_root;_isDirent;_statsProp;_rdOptions;_fileFilter;_directoryFilter;constructor(t={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:t.highWaterMark});let e={...z,...t},{root:i,type:r}=e;this._fileFilter=H(e.fileFilter),this._directoryFilter=H(e.directoryFilter);let a=e.lstat?c:u;$?this._stat=t=>a(t,{bigint:!0}):this._stat=a,this._maxDepth=null!=e.depth&&Number.isSafeInteger(e.depth)?e.depth:z.depth,this._wantsDir=!!r&&A.has(r),this._wantsFile=!!r&&N.has(r),this._wantsEverything="all"===r,this._root=s(i),this._isDirent=!e.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(i,1)],this.reading=!1,this.parent=void 0}async _read(t){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&t>0;){let e=this.parent,i=e&&e.files;if(i&&i.length>0){let{path:s,depth:r}=e,a=i.splice(0,t).map(t=>this._formatEntry(t,s));for(let e of(await Promise.all(a))){if(!e)continue;if(this.destroyed)return;let i=await this._getEntryType(e);"directory"===i&&this._directoryFilter(e)?(r<=this._maxDepth&&this.parents.push(this._exploreDir(e.fullPath,r+1)),this._wantsDir&&(this.push(e),t--)):("file"===i||this._includeAsFile(e))&&this._fileFilter(e)&&this._wantsFile&&(this.push(e),t--)}}else{let t=this.parents.pop();if(!t){this.push(null);break}if(this.parent=await t,this.destroyed)return}}}catch(t){this.destroy(t)}finally{this.reading=!1}}}async _exploreDir(t,e){let i;try{i=await p(t,this._rdOptions)}catch(t){this._onError(t)}return{files:i,depth:e,path:t}}async _formatEntry(t,r){let a,o=this._isDirent?t.name:t;try{let n=s(e(r,o));(a={path:i(this._root,n),fullPath:n,basename:o})[this._statsProp]=this._isDirent?t:await this._stat(n)}catch(t){this._onError(t);return}return a}_onError(t){M.has(t.code)&&!this.destroyed?this.emit("warn",t):this.destroy(t)}async _getEntryType(t){if(!t&&this._statsProp in t)return"";let e=t[this._statsProp];if(e.isFile())return"file";if(e.isDirectory())return"directory";if(e&&e.isSymbolicLink()){let e=t.fullPath;try{let t=await m(e),i=await c(t);if(i.isFile())return"file";if(i.isDirectory()){let i=t.length;if(e.startsWith(t)&&e.substr(i,1)===r){let i=Error(`Circular symlink detected: "${e}" points to "${t}"`);return i.code=j,this._onError(i)}return"directory"}}catch(t){return this._onError(t),""}}}_includeAsFile(t){let e=t&&t[this._statsProp];return e&&this._wantsEverything&&!e.isDirectory()}}let K=()=>{},L=process.platform,G="win32"===L,V="darwin"===L,q="linux"===L,B="freebsd"===L,J="OS400"===w(),Q="all",X="ready",Y="add",Z="change",tt="addDir",te="unlink",ti="unlinkDir",ts="raw",tr="error",ta={lstat:c,stat:u},to="listeners",tn="errHandlers",tl="rawEmitters",th=[to,tn,tl],td=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),tc=(t,e)=>{t instanceof Set?t.forEach(e):e(t)},tf=(t,e,i)=>{let s=t[e];s instanceof Set||(t[e]=s=new Set([s])),s.add(i)},tp=(t,e,i)=>{let s=t[e];s instanceof Set?s.delete(i):s===i&&delete t[e]},tm=t=>t instanceof Set?0===t.size:!t,tu=new Map;function t_(t,e,i,s,r){try{return h(t,{persistent:e.persistent},(e,s)=>{i(t),r(e,s,{watchedPath:t}),s&&t!==s&&tw(I.resolve(t,s),to,I.join(t,s))})}catch(t){s(t);return}}let tw=(t,e,i,s,r)=>{let a=tu.get(t);a&&tc(a[e],t=>{t(i,s,r)})},tg=new Map;class ty{fsw;_boundHandleError;constructor(t){this.fsw=t,this._boundHandleError=e=>t._handleError(e)}_watchWithNodeFs(t,e){let i,s=this.fsw.options,r=I.dirname(t),a=I.basename(t);this.fsw._getWatchedDir(r).add(a);let o=I.resolve(t),n={persistent:s.persistent};if(e||(e=K),s.usePolling)n.interval=s.interval!==s.binaryInterval&&td.has(I.extname(a).slice(1).toLowerCase())?s.binaryInterval:s.interval,i=((t,e,i,s)=>{let{listener:r,rawEmitter:a}=s,o=tg.get(e),n=o&&o.options;return n&&(n.persistent<i.persistent||n.interval>i.interval)&&(l(e),o=void 0),o?(tf(o,to,r),tf(o,tl,a)):(o={listeners:r,rawEmitters:a,options:i,watcher:d(e,i,(i,s)=>{tc(o.rawEmitters,t=>{t(Z,e,{curr:i,prev:s})});let r=i.mtimeMs;(i.size!==s.size||r>s.mtimeMs||0===r)&&tc(o.listeners,e=>e(t,i))})},tg.set(e,o)),()=>{tp(o,to,r),tp(o,tl,a),tm(o.listeners)&&(tg.delete(e),l(e),o.options=o.watcher=void 0,Object.freeze(o))}})(t,o,n,{listener:e,rawEmitter:this.fsw._emitRaw});else i=((t,e,i,s)=>{let r,{listener:a,errHandler:o,rawEmitter:n}=s,l=tu.get(e);if(!i.persistent){if(!(r=t_(t,i,a,o,n)))return;return r.close.bind(r)}if(l)tf(l,to,a),tf(l,tn,o),tf(l,tl,n);else{if(!(r=t_(t,i,tw.bind(null,e,to),o,tw.bind(null,e,tl))))return;r.on(tr,async i=>{let s=tw.bind(null,e,tn);if(l&&(l.watcherUnusable=!0),G&&"EPERM"===i.code)try{let e=await f(t,"r");await e.close(),s(i)}catch(t){}else s(i)}),l={listeners:a,errHandlers:o,rawEmitters:n,watcher:r},tu.set(e,l)}return()=>{if(tp(l,to,a),tp(l,tn,o),tp(l,tl,n),tm(l.listeners)){let t;l.watcher.close(),tu.delete(e),th.forEach((t=l,e=>{let i=t[e];i instanceof Set?i.clear():delete t[e]})),l.watcher=void 0,Object.freeze(l)}}})(t,o,n,{listener:e,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return i}_handleFile(t,e,i){if(this.fsw.closed)return;let s=I.dirname(t),r=I.basename(t),a=this.fsw._getWatchedDir(s),o=e;if(a.has(r))return;let n=async(e,i)=>{if(this.fsw._throttle("watch",t,5))if(i&&0!==i.mtimeMs){if(a.has(r)){let e=i.atimeMs,s=i.mtimeMs;(!e||e<=s||s!==o.mtimeMs)&&this.fsw._emit(Z,t,i),o=i}}else try{let i=await u(t);if(this.fsw.closed)return;let s=i.atimeMs,r=i.mtimeMs;if((!s||s<=r||r!==o.mtimeMs)&&this.fsw._emit(Z,t,i),(V||q||B)&&o.ino!==i.ino){this.fsw._closeFile(e),o=i;let s=this._watchWithNodeFs(t,n);s&&this.fsw._addPathCloser(e,s)}else o=i}catch(t){this.fsw._remove(s,r)}},l=this._watchWithNodeFs(t,n);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(Y,t,0))return;this.fsw._emit(Y,t,e)}return l}async _handleSymlink(t,e,i,s){if(this.fsw.closed)return;let r=t.fullPath,a=this.fsw._getWatchedDir(e);if(!this.fsw.options.followSymlinks){let e;this.fsw._incrReadyCount();try{e=await m(i)}catch(t){return this.fsw._emitReady(),!0}if(this.fsw.closed)return;return a.has(s)?this.fsw._symlinkPaths.get(r)!==e&&(this.fsw._symlinkPaths.set(r,e),this.fsw._emit(Z,i,t.stats)):(a.add(s),this.fsw._symlinkPaths.set(r,e),this.fsw._emit(Y,i,t.stats)),this.fsw._emitReady(),!0}if(this.fsw._symlinkPaths.has(r))return!0;this.fsw._symlinkPaths.set(r,!0)}_handleRead(t,e,i,s,r,a,o){t=I.join(t,"");let n=s?`${t}:${s}`:t;if(!(o=this.fsw._throttle("readdir",n,1e3)))return;let l=this.fsw._getWatchedDir(i.path),h=new Set,d=this.fsw._readdirp(t,{fileFilter:t=>i.filterPath(t),directoryFilter:t=>i.filterDir(t)});if(d)return d.on("data",async o=>{if(this.fsw.closed){d=void 0;return}let n=o.path,c=I.join(t,n);if(h.add(n),!(o.stats.isSymbolicLink()&&await this._handleSymlink(o,t,c,n))){if(this.fsw.closed){d=void 0;return}n!==s&&(s||l.has(n))||(this.fsw._incrReadyCount(),c=I.join(r,I.relative(r,c)),this._addToNodeFs(c,e,i,a+1))}}).on(tr,this._boundHandleError),new Promise((e,n)=>{if(!d)return n();d.once("end",()=>{if(this.fsw.closed){d=void 0;return}let n=!!o&&o.clear();e(void 0),l.getChildren().filter(e=>e!==t&&!h.has(e)).forEach(e=>{this.fsw._remove(t,e)}),d=void 0,n&&this._handleRead(t,!1,i,s,r,a,o)})})}async _handleDir(t,e,i,s,r,a,o){let n,l,h=this.fsw._getWatchedDir(I.dirname(t)),d=h.has(I.basename(t));i&&this.fsw.options.ignoreInitial||r||d||this.fsw._emit(tt,t,e),h.add(I.basename(t)),this.fsw._getWatchedDir(t);let c=this.fsw.options.depth;if((null==c||s<=c)&&!this.fsw._symlinkPaths.has(o)){if(!r&&(await this._handleRead(t,i,a,r,t,s,n),this.fsw.closed))return;l=this._watchWithNodeFs(t,(e,i)=>{i&&0===i.mtimeMs||this._handleRead(e,!1,a,r,t,s,n)})}return l}async _addToNodeFs(t,e,i,s,r){let a=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return a(),!1;let o=this.fsw._getWatchHelpers(t);i&&(o.filterPath=t=>i.filterPath(t),o.filterDir=t=>i.filterDir(t));try{let i,n=await ta[o.statMethod](o.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(o.watchPath,n))return a(),!1;let l=this.fsw.options.followSymlinks;if(n.isDirectory()){let a=I.resolve(t),h=l?await m(t):t;if(this.fsw.closed||(i=await this._handleDir(o.watchPath,n,e,s,r,o,h),this.fsw.closed))return;a!==h&&void 0!==h&&this.fsw._symlinkPaths.set(a,h)}else if(n.isSymbolicLink()){let r=l?await m(t):t;if(this.fsw.closed)return;let a=I.dirname(o.watchPath);if(this.fsw._getWatchedDir(a).add(o.watchPath),this.fsw._emit(Y,o.watchPath,n),i=await this._handleDir(a,n,e,s,t,o,r),this.fsw.closed)return;void 0!==r&&this.fsw._symlinkPaths.set(I.resolve(t),r)}else i=this._handleFile(o.watchPath,n,e);return a(),i&&this.fsw._addPathCloser(t,i),!1}catch(e){if(this.fsw._handleError(e))return a(),t}}}let tv=/\\/g,tb=/\/\//g,tP=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,tE=/^\.[/\\]/;function tx(t){return Array.isArray(t)?t:[t]}let tk=t=>"object"==typeof t&&null!==t&&!(t instanceof RegExp);function tS(t,e,i){let s=function(t){if("string"!=typeof t)throw Error("string expected");t=(t=I.normalize(t)).replace(/\\/g,"/");let e=!1;return t.startsWith("//")&&(e=!0),t=t.replace(tb,"/"),e&&(t="/"+t),t}(e);for(let e=0;e<t.length;e++)if((0,t[e])(s,i))return!0;return!1}let tD=t=>{let e=tx(t).flat();if(!e.every(t=>"string"==typeof t))throw TypeError(`Non-string provided as watch path: ${e}`);return e.map(tI)},tW=t=>{let e=t.replace(tv,"/"),i=!1;return e.startsWith("//")&&(i=!0),e=e.replace(tb,"/"),i&&(e="/"+e),e},tI=t=>tW(I.normalize(tW(t))),tR=(t="")=>e=>"string"==typeof e?tI(I.isAbsolute(e)?e:I.join(t,e)):e,tC=Object.freeze(new Set);class tF{path;_removeWatcher;items;constructor(t,e){this.path=t,this._removeWatcher=e,this.items=new Set}add(t){let{items:e}=this;e&&"."!==t&&".."!==t&&e.add(t)}async remove(t){let{items:e}=this;if(!e||(e.delete(t),e.size>0))return;let i=this.path;try{await p(i)}catch(t){this._removeWatcher&&this._removeWatcher(I.dirname(i),I.basename(i))}}has(t){let{items:e}=this;if(e)return e.has(t)}getChildren(){let{items:t}=this;return t?[...t.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=K,this.items=tC,Object.freeze(this)}}class tz{fsw;path;watchPath;fullWatchPath;dirParts;followSymlinks;statMethod;constructor(t,e,i){this.fsw=i;let s=t;this.path=t=t.replace(tE,""),this.watchPath=s,this.fullWatchPath=I.resolve(s),this.dirParts=[],this.dirParts.forEach(t=>{t.length>1&&t.pop()}),this.followSymlinks=e,this.statMethod=e?"stat":"lstat"}entryPath(t){return I.join(this.watchPath,I.relative(this.watchPath,t.fullPath))}filterPath(t){let{stats:e}=t;if(e&&e.isSymbolicLink())return this.filterDir(t);let i=this.entryPath(t);return this.fsw._isntIgnored(i,e)&&this.fsw._hasReadPermissions(e)}filterDir(t){return this.fsw._isntIgnored(this.entryPath(t),t.stats)}}class tj extends a{closed;options;_closers;_ignoredPaths;_throttled;_streams;_symlinkPaths;_watched;_pendingWrites;_pendingUnlinks;_readyCount;_emitReady;_closePromise;_userIgnored;_readyEmitted;_emitRaw;_boundRemove;_nodeFsHandler;constructor(t={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let e=t.awaitWriteFinish,i={stabilityThreshold:2e3,pollInterval:100},s={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...t,ignored:t.ignored?tx(t.ignored):tx([]),awaitWriteFinish:!0===e?i:"object"==typeof e&&{...i,...e}};J&&(s.usePolling=!0),void 0===s.atomic&&(s.atomic=!s.usePolling);let r=process.env.CHOKIDAR_USEPOLLING;if(void 0!==r){let t=r.toLowerCase();"false"===t||"0"===t?s.usePolling=!1:"true"===t||"1"===t?s.usePolling=!0:s.usePolling=!!t}let a=process.env.CHOKIDAR_INTERVAL;a&&(s.interval=Number.parseInt(a,10));let o=0;this._emitReady=()=>{++o>=this._readyCount&&(this._emitReady=K,this._readyEmitted=!0,process.nextTick(()=>this.emit(X)))},this._emitRaw=(...t)=>this.emit(ts,...t),this._boundRemove=this._remove.bind(this),this.options=s,this._nodeFsHandler=new ty(this),Object.freeze(s)}_addIgnoredPath(t){if(tk(t)){for(let e of this._ignoredPaths)if(tk(e)&&e.path===t.path&&e.recursive===t.recursive)return}this._ignoredPaths.add(t)}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),"string"==typeof t)for(let e of this._ignoredPaths)tk(e)&&e.path===t&&this._ignoredPaths.delete(e)}add(t,e,i){let{cwd:s}=this.options;this.closed=!1,this._closePromise=void 0;let r=tD(t);return s&&(r=r.map(t=>I.isAbsolute(t)?t:I.join(s,t))),r.forEach(t=>{this._removeIgnoredPath(t)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=r.length,Promise.all(r.map(async t=>{let s=await this._nodeFsHandler._addToNodeFs(t,!i,void 0,0,e);return s&&this._emitReady(),s})).then(t=>{this.closed||t.forEach(t=>{t&&this.add(I.dirname(t),I.basename(e||t))})}),this}unwatch(t){if(this.closed)return this;let e=tD(t),{cwd:i}=this.options;return e.forEach(t=>{I.isAbsolute(t)||this._closers.has(t)||(i&&(t=I.join(i,t)),t=I.resolve(t)),this._closePath(t),this._addIgnoredPath(t),this._watched.has(t)&&this._addIgnoredPath({path:t,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let t=[];return this._closers.forEach(e=>e.forEach(e=>{let i=e();i instanceof Promise&&t.push(i)})),this._streams.forEach(t=>t.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(t=>t.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=t.length?Promise.all(t).then(()=>void 0):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((e,i)=>{t[(this.options.cwd?I.relative(this.options.cwd,i):i)||"."]=e.getChildren().sort()}),t}emitWithAll(t,e){this.emit(t,...e),t!==tr&&this.emit(Q,t,...e)}async _emit(t,e,i){let s;if(this.closed)return;let r=this.options;G&&(e=I.normalize(e)),r.cwd&&(e=I.relative(r.cwd,e));let a=[e];null!=i&&a.push(i);let o=r.awaitWriteFinish;if(o&&(s=this._pendingWrites.get(e)))return s.lastChange=new Date,this;if(r.atomic){if(t===te)return this._pendingUnlinks.set(e,[t,...a]),setTimeout(()=>{this._pendingUnlinks.forEach((t,e)=>{this.emit(...t),this.emit(Q,...t),this._pendingUnlinks.delete(e)})},"number"==typeof r.atomic?r.atomic:100),this;t===Y&&this._pendingUnlinks.has(e)&&(t=Z,this._pendingUnlinks.delete(e))}if(o&&(t===Y||t===Z)&&this._readyEmitted){let i=(e,i)=>{e?(t=tr,a[0]=e,this.emitWithAll(t,a)):i&&(a.length>1?a[1]=i:a.push(i),this.emitWithAll(t,a))};return this._awaitWriteFinish(e,o.stabilityThreshold,t,i),this}if(t===Z&&!this._throttle(Z,e,50))return this;if(r.alwaysStat&&void 0===i&&(t===Y||t===tt||t===Z)){let t,i=r.cwd?I.join(r.cwd,e):e;try{t=await u(i)}catch(t){}if(!t||this.closed)return;a.push(t)}return this.emitWithAll(t,a),this}_handleError(t){let e=t&&t.code;return t&&"ENOENT"!==e&&"ENOTDIR"!==e&&(!this.options.ignorePermissionErrors||"EPERM"!==e&&"EACCES"!==e)&&this.emit(tr,t),t||this.closed}_throttle(t,e,i){let s;this._throttled.has(t)||this._throttled.set(t,new Map);let r=this._throttled.get(t);if(!r)throw Error("invalid throttle");let a=r.get(e);if(a)return a.count++,!1;let o=()=>{let t=r.get(e),i=t?t.count:0;return r.delete(e),clearTimeout(s),t&&clearTimeout(t.timeoutObject),i},n={timeoutObject:s=setTimeout(o,i),clear:o,count:0};return r.set(e,n),n}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,e,i,s){let r,a=this.options.awaitWriteFinish;if("object"!=typeof a)return;let o=a.pollInterval,l=t;this.options.cwd&&!I.isAbsolute(t)&&(l=I.join(this.options.cwd,t));let h=new Date,d=this._pendingWrites;d.has(t)||(d.set(t,{lastChange:h,cancelWait:()=>(d.delete(t),clearTimeout(r),i)}),r=setTimeout(function i(a){n(l,(n,l)=>{if(n||!d.has(t)){n&&"ENOENT"!==n.code&&s(n);return}let h=Number(new Date);a&&l.size!==a.size&&(d.get(t).lastChange=h),h-d.get(t).lastChange>=e?(d.delete(t),s(void 0,l)):r=setTimeout(i,o,l)})},o))}_isIgnored(t,e){if(this.options.atomic&&tP.test(t))return!0;if(!this._userIgnored){let{cwd:t}=this.options,e=(this.options.ignored||[]).map(tR(t)),i=[...[...this._ignoredPaths].map(tR(t)),...e];this._userIgnored=function(t,e){if(null==t)throw TypeError("anymatch: specify first argument");let i=tx(t).map(t=>"function"==typeof t?t:"string"==typeof t?e=>t===e:t instanceof RegExp?e=>t.test(e):"object"==typeof t&&null!==t?e=>{if(t.path===e)return!0;if(t.recursive){let i=I.relative(t.path,e);return!!i&&!i.startsWith("..")&&!I.isAbsolute(i)}return!1}:()=>!1);return null==e?(t,e)=>tS(i,t,e):tS(i,e)}(i,void 0)}return this._userIgnored(t,e)}_isntIgnored(t,e){return!this._isIgnored(t,e)}_getWatchHelpers(t){return new tz(t,this.options.followSymlinks,this)}_getWatchedDir(t){let e=I.resolve(t);return this._watched.has(e)||this._watched.set(e,new tF(e,this._boundRemove)),this._watched.get(e)}_hasReadPermissions(t){return!!this.options.ignorePermissionErrors||!!(256&Number(t.mode))}_remove(t,e,i){let s=I.join(t,e),r=I.resolve(s);if(i=null!=i?i:this._watched.has(s)||this._watched.has(r),!this._throttle("remove",s,100))return;i||1!==this._watched.size||this.add(t,e,!0),this._getWatchedDir(s).getChildren().forEach(t=>this._remove(s,t));let a=this._getWatchedDir(t),o=a.has(e);a.remove(e),this._symlinkPaths.has(r)&&this._symlinkPaths.delete(r);let n=s;if(this.options.cwd&&(n=I.relative(this.options.cwd,s)),this.options.awaitWriteFinish&&this._pendingWrites.has(n)&&this._pendingWrites.get(n).cancelWait()===Y)return;this._watched.delete(s),this._watched.delete(r);let l=i?ti:te;o&&!this._isIgnored(s)&&this._emit(l,s),this._closePath(s)}_closePath(t){this._closeFile(t);let e=I.dirname(t);this._getWatchedDir(e).remove(I.basename(t))}_closeFile(t){let e=this._closers.get(t);e&&(e.forEach(t=>t()),this._closers.delete(t))}_addPathCloser(t,e){if(!e)return;let i=this._closers.get(t);i||(i=[],this._closers.set(t,i)),i.push(e)}_readdirp(t,e){if(this.closed)return;let i=function(t,e={}){let i=e.entryType||e.type;if("both"===i&&(i=F),i&&(e.type=i),t){if("string"!=typeof t)throw TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");else if(i&&!T.includes(i))throw Error(`readdirp: Invalid type passed. Use one of ${T.join(", ")}`)}else throw Error("readdirp: root argument is required. Usage: readdirp(root, options)");return e.root=t,new U(e)}(t,{type:Q,alwaysStat:!0,lstat:!0,...e,depth:0});return this._streams.add(i),i.once("close",()=>{i=void 0}),i.once("end",()=>{i&&(this._streams.delete(i),i=void 0)}),i}}async function tM(i){if(k())try{let{TUIManager:s}=await import("./dist.js"),{createRatatuiDevUI:r}=await import("./ratatui-ui.js"),a=e(t(g(import.meta.url)),"tui"),n=new s({nativeDirectory:o(a)?a:void 0});try{return await r(n,i)}catch(t){throw await n.close(),t}}catch(t){E.warn(`无法启动交互界面,改用日志模式:${S(t)}`)}return{interactive:!1,addTarget(t,e){let i={status:"pending",message:"正在启动"};return{log:{info:e=>E.info(`[${t}] ${e}`),success:e=>E.success(`[${t}] ${e}`),warn:e=>E.warn(`[${t}] ${e}`),error:e=>E.error(`[${t}] ${e}`)},ui:{update(t){let s={...i};for(let[r,a]of(Object.assign(i,t),(i.message!==s.message||i.status!==s.status)&&(0,({pending:E.info,success:E.success,error:E.error})[i.status])(`${e}:${i.message}`),Object.entries(i.links??{})))s.links?.[r]!==a&&E.info(`${r}:${a}`)},select:async()=>void 0,print:t=>console.log(t)}}},close(){}}}async function tT(t,e,r){let a,o=new AbortController,n=Promise.withResolvers(),l=(t=!1)=>{t&&(process.exitCode=130),o.abort(),n.resolve()},h={project:t,options:e,signal:o.signal},d=await tN(h,r.devTargets);if(!d)return;if(await D(k()),!t.plugin.id){E.info("未配置插件 ID,正在上传项目并创建平台草稿…");try{await W({project:t,options:{}},await P(r.exclude,{project:t},"draft"))}catch(t){throw Error(`插件初始化失败,未启动调试:${S(t)}`,{cause:t})}}let c=await P(r.exclude,{project:t},"dev"),f=()=>l(!0),p=()=>{process.exitCode=143,l()};process.on("SIGINT",f),process.on("SIGTERM",p);let m=await tM({signal:o.signal,onExit:l,projectName:t.plugin.name}),u=[],_=async t=>{for(let e of t.disposers.splice(0).reverse())try{await e()}catch(e){t.ctx.log.warn(`清理失败:${S(e)}`)}},w=(t,e)=>{o.signal.aborted||(t.ctx.ui.update({status:"error",message:"运行失败"}),t.ctx.log.error(S(e)))},g=t=>{t.changed.size&&t.ready&&!t.running&&!o.signal.aborted&&(t.running=(async()=>{try{for(;t.changed.size&&!o.signal.aborted;){let e=[...t.changed];t.changed.clear();try{await t.listener?.(e)}catch(e){w(t,e)}}}finally{t.running=void 0}})())};try{for(let e of d){let{name:r,title:a,label:o=a,watch:n=[]}=e.target,l={entry:e,paths:n.map(e=>i(t.root,s(t.root,e))),ready:!1,changed:new Set,disposers:[],ctx:{...h,...m.addTarget(r,o),interactive:m.interactive,packDevelopment:()=>t.pack({exclude:c}),onDispose:t=>l.disposers.push(t),onFilesChanged:t=>{l.listener=t}}};u.push(l)}let e=u.flatMap(({paths:t})=>t),r=function(t,e={}){let i=new tj(e);return i.add(t),i}(t.root,{ignoreInitial:!0,followSymlinks:!1,ignored:s=>{let r=i(t.root,s);return!!r&&!e.some(t=>tA(r,t)||tA(t,r))}});r.on("all",(e,s)=>{if(o.signal.aborted)return;let r=i(t.root,s);for(let t of u)t.paths.some(t=>tA(r,t))&&t.changed.add(r);clearTimeout(a),a=setTimeout(()=>u.forEach(g),400)}),r.on("error",n.reject);let l=Promise.all(u.map(async t=>{try{o.signal.throwIfAborted(),await t.entry.target.start(t.ctx),o.signal.throwIfAborted(),t.ready=!0,g(t)}catch(e){t.changed.clear(),w(t,e),await _(t)}}));try{await n.promise}finally{o.abort(),clearTimeout(a);try{await r.close()}finally{await l,await Promise.all(u.map(t=>t.running))}}}catch(t){if(t!==o.signal.reason&&!(t instanceof Error&&"AbortError"===t.name))throw t}finally{for(let t of(o.abort(),u.toReversed()))await _(t);try{await m.close()}finally{process.off("SIGINT",f),process.off("SIGTERM",p)}}}function tA(t,e){return!e||t===e||t.startsWith(`${e}${r}`)}async function tN(t,e){let{options:i}=t,s=[];for(let r of e){let{pluginName:e,target:a}=r,o=!a.appliesTo||await y({pluginName:e,callback:a.appliesTo},t);if(!o&&r.attribute&&i[r.attribute])throw Error(`[${e}] 当前项目不支持:${a.title}`);o&&s.push(r)}let r=s.filter(({attribute:t})=>t),a=({attribute:t})=>!!(t&&i[t]),o=new Set;if(r.length&&!i.plugin&&!r.some(a)&&k())for(let{target:t}of r){let e=await v({message:`是否同时启动${t.title}?`,initialValue:!1});if(x(e)){b("已取消调试。"),process.exitCode=130;return}e&&o.add(t.name)}let n=s.filter(t=>!t.attribute||a(t)||o.has(t.target.name));return n.some(({target:t})=>"app"===t.name)?n.filter(({target:t})=>"platform"!==t.name):n}export{tT as runSession};
2
+ import{dirname as t,join as e,relative as i,resolve as s,sep as r}from"node:path";import{EventEmitter as a}from"node:events";import{existsSync as o,stat as n,unwatchFile as l,watch as h,watchFile as d}from"node:fs";import{lstat as c,open as f,readdir as p,realpath as m,stat as u}from"node:fs/promises";import{Readable as _}from"node:stream";import{type as w}from"node:os";import{fileURLToPath as g}from"node:url";import{callHook as y,runtime as v,dist_ye as b,dist_xe as P,collectHooks as E,log as x,resolvePublicationType as k,pD as S,error_errorMessage as D,isInteractive as W,loadPackage as I}from"./691.js";import{ensureLogin as R}from"./command~1.js";import{uploadDraft as C}from"./draft.js";import*as F from"node:path";let z="files",j="directories",M="files_directories",T={root:".",fileFilter:t=>!0,directoryFilter:t=>!0,type:z,lstat:!1,depth:0x80000000,alwaysStat:!1,highWaterMark:4096};Object.freeze(T);let A="READDIRP_RECURSIVE_ERROR",N=new Set(["ENOENT","EPERM","EACCES","ELOOP",A]),$=[j,"all",M,z],O=new Set([j,"all",M]),H=new Set(["all",M,z]),U="win32"===process.platform,K=t=>!0,L=t=>{if(void 0===t)return K;if("function"==typeof t)return t;if("string"==typeof t){let e=t.trim();return t=>t.basename===e}if(Array.isArray(t)){let e=t.map(t=>t.trim());return t=>e.some(e=>t.basename===e)}return K};class G extends _{parents;reading;parent;_stat;_maxDepth;_wantsDir;_wantsFile;_wantsEverything;_root;_isDirent;_statsProp;_rdOptions;_fileFilter;_directoryFilter;constructor(t={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:t.highWaterMark});let e={...T,...t},{root:i,type:r}=e;this._fileFilter=L(e.fileFilter),this._directoryFilter=L(e.directoryFilter);let a=e.lstat?c:u;U?this._stat=t=>a(t,{bigint:!0}):this._stat=a,this._maxDepth=null!=e.depth&&Number.isSafeInteger(e.depth)?e.depth:T.depth,this._wantsDir=!!r&&O.has(r),this._wantsFile=!!r&&H.has(r),this._wantsEverything="all"===r,this._root=s(i),this._isDirent=!e.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(i,1)],this.reading=!1,this.parent=void 0}async _read(t){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&t>0;){let e=this.parent,i=e&&e.files;if(i&&i.length>0){let{path:s,depth:r}=e,a=i.splice(0,t).map(t=>this._formatEntry(t,s));for(let e of(await Promise.all(a))){if(!e)continue;if(this.destroyed)return;let i=await this._getEntryType(e);"directory"===i&&this._directoryFilter(e)?(r<=this._maxDepth&&this.parents.push(this._exploreDir(e.fullPath,r+1)),this._wantsDir&&(this.push(e),t--)):("file"===i||this._includeAsFile(e))&&this._fileFilter(e)&&this._wantsFile&&(this.push(e),t--)}}else{let t=this.parents.pop();if(!t){this.push(null);break}if(this.parent=await t,this.destroyed)return}}}catch(t){this.destroy(t)}finally{this.reading=!1}}}async _exploreDir(t,e){let i;try{i=await p(t,this._rdOptions)}catch(t){this._onError(t)}return{files:i,depth:e,path:t}}async _formatEntry(t,r){let a,o=this._isDirent?t.name:t;try{let n=s(e(r,o));(a={path:i(this._root,n),fullPath:n,basename:o})[this._statsProp]=this._isDirent?t:await this._stat(n)}catch(t){this._onError(t);return}return a}_onError(t){N.has(t.code)&&!this.destroyed?this.emit("warn",t):this.destroy(t)}async _getEntryType(t){if(!t&&this._statsProp in t)return"";let e=t[this._statsProp];if(e.isFile())return"file";if(e.isDirectory())return"directory";if(e&&e.isSymbolicLink()){let e=t.fullPath;try{let t=await m(e),i=await c(t);if(i.isFile())return"file";if(i.isDirectory()){let i=t.length;if(e.startsWith(t)&&e.substr(i,1)===r){let i=Error(`Circular symlink detected: "${e}" points to "${t}"`);return i.code=A,this._onError(i)}return"directory"}}catch(t){return this._onError(t),""}}}_includeAsFile(t){let e=t&&t[this._statsProp];return e&&this._wantsEverything&&!e.isDirectory()}}let V=()=>{},q=process.platform,B="win32"===q,J="darwin"===q,Q="linux"===q,X="freebsd"===q,Y="OS400"===w(),Z="all",tt="ready",te="add",ti="change",ts="addDir",tr="unlink",ta="unlinkDir",to="raw",tn="error",tl={lstat:c,stat:u},th="listeners",td="errHandlers",tc="rawEmitters",tf=[th,td,tc],tp=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),tm=(t,e)=>{t instanceof Set?t.forEach(e):e(t)},tu=(t,e,i)=>{let s=t[e];s instanceof Set||(t[e]=s=new Set([s])),s.add(i)},t_=(t,e,i)=>{let s=t[e];s instanceof Set?s.delete(i):s===i&&delete t[e]},tw=t=>t instanceof Set?0===t.size:!t,tg=new Map;function ty(t,e,i,s,r){try{return h(t,{persistent:e.persistent},(e,s)=>{i(t),r(e,s,{watchedPath:t}),s&&t!==s&&tv(F.resolve(t,s),th,F.join(t,s))})}catch(t){s(t);return}}let tv=(t,e,i,s,r)=>{let a=tg.get(t);a&&tm(a[e],t=>{t(i,s,r)})},tb=new Map;class tP{fsw;_boundHandleError;constructor(t){this.fsw=t,this._boundHandleError=e=>t._handleError(e)}_watchWithNodeFs(t,e){let i,s=this.fsw.options,r=F.dirname(t),a=F.basename(t);this.fsw._getWatchedDir(r).add(a);let o=F.resolve(t),n={persistent:s.persistent};if(e||(e=V),s.usePolling)n.interval=s.interval!==s.binaryInterval&&tp.has(F.extname(a).slice(1).toLowerCase())?s.binaryInterval:s.interval,i=((t,e,i,s)=>{let{listener:r,rawEmitter:a}=s,o=tb.get(e),n=o&&o.options;return n&&(n.persistent<i.persistent||n.interval>i.interval)&&(l(e),o=void 0),o?(tu(o,th,r),tu(o,tc,a)):(o={listeners:r,rawEmitters:a,options:i,watcher:d(e,i,(i,s)=>{tm(o.rawEmitters,t=>{t(ti,e,{curr:i,prev:s})});let r=i.mtimeMs;(i.size!==s.size||r>s.mtimeMs||0===r)&&tm(o.listeners,e=>e(t,i))})},tb.set(e,o)),()=>{t_(o,th,r),t_(o,tc,a),tw(o.listeners)&&(tb.delete(e),l(e),o.options=o.watcher=void 0,Object.freeze(o))}})(t,o,n,{listener:e,rawEmitter:this.fsw._emitRaw});else i=((t,e,i,s)=>{let r,{listener:a,errHandler:o,rawEmitter:n}=s,l=tg.get(e);if(!i.persistent){if(!(r=ty(t,i,a,o,n)))return;return r.close.bind(r)}if(l)tu(l,th,a),tu(l,td,o),tu(l,tc,n);else{if(!(r=ty(t,i,tv.bind(null,e,th),o,tv.bind(null,e,tc))))return;r.on(tn,async i=>{let s=tv.bind(null,e,td);if(l&&(l.watcherUnusable=!0),B&&"EPERM"===i.code)try{let e=await f(t,"r");await e.close(),s(i)}catch(t){}else s(i)}),l={listeners:a,errHandlers:o,rawEmitters:n,watcher:r},tg.set(e,l)}return()=>{if(t_(l,th,a),t_(l,td,o),t_(l,tc,n),tw(l.listeners)){let t;l.watcher.close(),tg.delete(e),tf.forEach((t=l,e=>{let i=t[e];i instanceof Set?i.clear():delete t[e]})),l.watcher=void 0,Object.freeze(l)}}})(t,o,n,{listener:e,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return i}_handleFile(t,e,i){if(this.fsw.closed)return;let s=F.dirname(t),r=F.basename(t),a=this.fsw._getWatchedDir(s),o=e;if(a.has(r))return;let n=async(e,i)=>{if(this.fsw._throttle("watch",t,5))if(i&&0!==i.mtimeMs){if(a.has(r)){let e=i.atimeMs,s=i.mtimeMs;(!e||e<=s||s!==o.mtimeMs)&&this.fsw._emit(ti,t,i),o=i}}else try{let i=await u(t);if(this.fsw.closed)return;let s=i.atimeMs,r=i.mtimeMs;if((!s||s<=r||r!==o.mtimeMs)&&this.fsw._emit(ti,t,i),(J||Q||X)&&o.ino!==i.ino){this.fsw._closeFile(e),o=i;let s=this._watchWithNodeFs(t,n);s&&this.fsw._addPathCloser(e,s)}else o=i}catch(t){this.fsw._remove(s,r)}},l=this._watchWithNodeFs(t,n);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(te,t,0))return;this.fsw._emit(te,t,e)}return l}async _handleSymlink(t,e,i,s){if(this.fsw.closed)return;let r=t.fullPath,a=this.fsw._getWatchedDir(e);if(!this.fsw.options.followSymlinks){let e;this.fsw._incrReadyCount();try{e=await m(i)}catch(t){return this.fsw._emitReady(),!0}if(this.fsw.closed)return;return a.has(s)?this.fsw._symlinkPaths.get(r)!==e&&(this.fsw._symlinkPaths.set(r,e),this.fsw._emit(ti,i,t.stats)):(a.add(s),this.fsw._symlinkPaths.set(r,e),this.fsw._emit(te,i,t.stats)),this.fsw._emitReady(),!0}if(this.fsw._symlinkPaths.has(r))return!0;this.fsw._symlinkPaths.set(r,!0)}_handleRead(t,e,i,s,r,a,o){t=F.join(t,"");let n=s?`${t}:${s}`:t;if(!(o=this.fsw._throttle("readdir",n,1e3)))return;let l=this.fsw._getWatchedDir(i.path),h=new Set,d=this.fsw._readdirp(t,{fileFilter:t=>i.filterPath(t),directoryFilter:t=>i.filterDir(t)});if(d)return d.on("data",async o=>{if(this.fsw.closed){d=void 0;return}let n=o.path,c=F.join(t,n);if(h.add(n),!(o.stats.isSymbolicLink()&&await this._handleSymlink(o,t,c,n))){if(this.fsw.closed){d=void 0;return}n!==s&&(s||l.has(n))||(this.fsw._incrReadyCount(),c=F.join(r,F.relative(r,c)),this._addToNodeFs(c,e,i,a+1))}}).on(tn,this._boundHandleError),new Promise((e,n)=>{if(!d)return n();d.once("end",()=>{if(this.fsw.closed){d=void 0;return}let n=!!o&&o.clear();e(void 0),l.getChildren().filter(e=>e!==t&&!h.has(e)).forEach(e=>{this.fsw._remove(t,e)}),d=void 0,n&&this._handleRead(t,!1,i,s,r,a,o)})})}async _handleDir(t,e,i,s,r,a,o){let n,l,h=this.fsw._getWatchedDir(F.dirname(t)),d=h.has(F.basename(t));i&&this.fsw.options.ignoreInitial||r||d||this.fsw._emit(ts,t,e),h.add(F.basename(t)),this.fsw._getWatchedDir(t);let c=this.fsw.options.depth;if((null==c||s<=c)&&!this.fsw._symlinkPaths.has(o)){if(!r&&(await this._handleRead(t,i,a,r,t,s,n),this.fsw.closed))return;l=this._watchWithNodeFs(t,(e,i)=>{i&&0===i.mtimeMs||this._handleRead(e,!1,a,r,t,s,n)})}return l}async _addToNodeFs(t,e,i,s,r){let a=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return a(),!1;let o=this.fsw._getWatchHelpers(t);i&&(o.filterPath=t=>i.filterPath(t),o.filterDir=t=>i.filterDir(t));try{let i,n=await tl[o.statMethod](o.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(o.watchPath,n))return a(),!1;let l=this.fsw.options.followSymlinks;if(n.isDirectory()){let a=F.resolve(t),h=l?await m(t):t;if(this.fsw.closed||(i=await this._handleDir(o.watchPath,n,e,s,r,o,h),this.fsw.closed))return;a!==h&&void 0!==h&&this.fsw._symlinkPaths.set(a,h)}else if(n.isSymbolicLink()){let r=l?await m(t):t;if(this.fsw.closed)return;let a=F.dirname(o.watchPath);if(this.fsw._getWatchedDir(a).add(o.watchPath),this.fsw._emit(te,o.watchPath,n),i=await this._handleDir(a,n,e,s,t,o,r),this.fsw.closed)return;void 0!==r&&this.fsw._symlinkPaths.set(F.resolve(t),r)}else i=this._handleFile(o.watchPath,n,e);return a(),i&&this.fsw._addPathCloser(t,i),!1}catch(e){if(this.fsw._handleError(e))return a(),t}}}let tE=/\\/g,tx=/\/\//g,tk=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,tS=/^\.[/\\]/;function tD(t){return Array.isArray(t)?t:[t]}let tW=t=>"object"==typeof t&&null!==t&&!(t instanceof RegExp);function tI(t,e,i){let s=function(t){if("string"!=typeof t)throw Error("string expected");t=(t=F.normalize(t)).replace(/\\/g,"/");let e=!1;return t.startsWith("//")&&(e=!0),t=t.replace(tx,"/"),e&&(t="/"+t),t}(e);for(let e=0;e<t.length;e++)if((0,t[e])(s,i))return!0;return!1}let tR=t=>{let e=tD(t).flat();if(!e.every(t=>"string"==typeof t))throw TypeError(`Non-string provided as watch path: ${e}`);return e.map(tF)},tC=t=>{let e=t.replace(tE,"/"),i=!1;return e.startsWith("//")&&(i=!0),e=e.replace(tx,"/"),i&&(e="/"+e),e},tF=t=>tC(F.normalize(tC(t))),tz=(t="")=>e=>"string"==typeof e?tF(F.isAbsolute(e)?e:F.join(t,e)):e,tj=Object.freeze(new Set);class tM{path;_removeWatcher;items;constructor(t,e){this.path=t,this._removeWatcher=e,this.items=new Set}add(t){let{items:e}=this;e&&"."!==t&&".."!==t&&e.add(t)}async remove(t){let{items:e}=this;if(!e||(e.delete(t),e.size>0))return;let i=this.path;try{await p(i)}catch(t){this._removeWatcher&&this._removeWatcher(F.dirname(i),F.basename(i))}}has(t){let{items:e}=this;if(e)return e.has(t)}getChildren(){let{items:t}=this;return t?[...t.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=V,this.items=tj,Object.freeze(this)}}class tT{fsw;path;watchPath;fullWatchPath;dirParts;followSymlinks;statMethod;constructor(t,e,i){this.fsw=i;let s=t;this.path=t=t.replace(tS,""),this.watchPath=s,this.fullWatchPath=F.resolve(s),this.dirParts=[],this.dirParts.forEach(t=>{t.length>1&&t.pop()}),this.followSymlinks=e,this.statMethod=e?"stat":"lstat"}entryPath(t){return F.join(this.watchPath,F.relative(this.watchPath,t.fullPath))}filterPath(t){let{stats:e}=t;if(e&&e.isSymbolicLink())return this.filterDir(t);let i=this.entryPath(t);return this.fsw._isntIgnored(i,e)&&this.fsw._hasReadPermissions(e)}filterDir(t){return this.fsw._isntIgnored(this.entryPath(t),t.stats)}}class tA extends a{closed;options;_closers;_ignoredPaths;_throttled;_streams;_symlinkPaths;_watched;_pendingWrites;_pendingUnlinks;_readyCount;_emitReady;_closePromise;_userIgnored;_readyEmitted;_emitRaw;_boundRemove;_nodeFsHandler;constructor(t={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let e=t.awaitWriteFinish,i={stabilityThreshold:2e3,pollInterval:100},s={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...t,ignored:t.ignored?tD(t.ignored):tD([]),awaitWriteFinish:!0===e?i:"object"==typeof e&&{...i,...e}};Y&&(s.usePolling=!0),void 0===s.atomic&&(s.atomic=!s.usePolling);let r=process.env.CHOKIDAR_USEPOLLING;if(void 0!==r){let t=r.toLowerCase();"false"===t||"0"===t?s.usePolling=!1:"true"===t||"1"===t?s.usePolling=!0:s.usePolling=!!t}let a=process.env.CHOKIDAR_INTERVAL;a&&(s.interval=Number.parseInt(a,10));let o=0;this._emitReady=()=>{++o>=this._readyCount&&(this._emitReady=V,this._readyEmitted=!0,process.nextTick(()=>this.emit(tt)))},this._emitRaw=(...t)=>this.emit(to,...t),this._boundRemove=this._remove.bind(this),this.options=s,this._nodeFsHandler=new tP(this),Object.freeze(s)}_addIgnoredPath(t){if(tW(t)){for(let e of this._ignoredPaths)if(tW(e)&&e.path===t.path&&e.recursive===t.recursive)return}this._ignoredPaths.add(t)}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),"string"==typeof t)for(let e of this._ignoredPaths)tW(e)&&e.path===t&&this._ignoredPaths.delete(e)}add(t,e,i){let{cwd:s}=this.options;this.closed=!1,this._closePromise=void 0;let r=tR(t);return s&&(r=r.map(t=>F.isAbsolute(t)?t:F.join(s,t))),r.forEach(t=>{this._removeIgnoredPath(t)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=r.length,Promise.all(r.map(async t=>{let s=await this._nodeFsHandler._addToNodeFs(t,!i,void 0,0,e);return s&&this._emitReady(),s})).then(t=>{this.closed||t.forEach(t=>{t&&this.add(F.dirname(t),F.basename(e||t))})}),this}unwatch(t){if(this.closed)return this;let e=tR(t),{cwd:i}=this.options;return e.forEach(t=>{F.isAbsolute(t)||this._closers.has(t)||(i&&(t=F.join(i,t)),t=F.resolve(t)),this._closePath(t),this._addIgnoredPath(t),this._watched.has(t)&&this._addIgnoredPath({path:t,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let t=[];return this._closers.forEach(e=>e.forEach(e=>{let i=e();i instanceof Promise&&t.push(i)})),this._streams.forEach(t=>t.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(t=>t.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=t.length?Promise.all(t).then(()=>void 0):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((e,i)=>{t[(this.options.cwd?F.relative(this.options.cwd,i):i)||"."]=e.getChildren().sort()}),t}emitWithAll(t,e){this.emit(t,...e),t!==tn&&this.emit(Z,t,...e)}async _emit(t,e,i){let s;if(this.closed)return;let r=this.options;B&&(e=F.normalize(e)),r.cwd&&(e=F.relative(r.cwd,e));let a=[e];null!=i&&a.push(i);let o=r.awaitWriteFinish;if(o&&(s=this._pendingWrites.get(e)))return s.lastChange=new Date,this;if(r.atomic){if(t===tr)return this._pendingUnlinks.set(e,[t,...a]),setTimeout(()=>{this._pendingUnlinks.forEach((t,e)=>{this.emit(...t),this.emit(Z,...t),this._pendingUnlinks.delete(e)})},"number"==typeof r.atomic?r.atomic:100),this;t===te&&this._pendingUnlinks.has(e)&&(t=ti,this._pendingUnlinks.delete(e))}if(o&&(t===te||t===ti)&&this._readyEmitted){let i=(e,i)=>{e?(t=tn,a[0]=e,this.emitWithAll(t,a)):i&&(a.length>1?a[1]=i:a.push(i),this.emitWithAll(t,a))};return this._awaitWriteFinish(e,o.stabilityThreshold,t,i),this}if(t===ti&&!this._throttle(ti,e,50))return this;if(r.alwaysStat&&void 0===i&&(t===te||t===ts||t===ti)){let t,i=r.cwd?F.join(r.cwd,e):e;try{t=await u(i)}catch(t){}if(!t||this.closed)return;a.push(t)}return this.emitWithAll(t,a),this}_handleError(t){let e=t&&t.code;return t&&"ENOENT"!==e&&"ENOTDIR"!==e&&(!this.options.ignorePermissionErrors||"EPERM"!==e&&"EACCES"!==e)&&this.emit(tn,t),t||this.closed}_throttle(t,e,i){let s;this._throttled.has(t)||this._throttled.set(t,new Map);let r=this._throttled.get(t);if(!r)throw Error("invalid throttle");let a=r.get(e);if(a)return a.count++,!1;let o=()=>{let t=r.get(e),i=t?t.count:0;return r.delete(e),clearTimeout(s),t&&clearTimeout(t.timeoutObject),i},n={timeoutObject:s=setTimeout(o,i),clear:o,count:0};return r.set(e,n),n}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,e,i,s){let r,a=this.options.awaitWriteFinish;if("object"!=typeof a)return;let o=a.pollInterval,l=t;this.options.cwd&&!F.isAbsolute(t)&&(l=F.join(this.options.cwd,t));let h=new Date,d=this._pendingWrites;d.has(t)||(d.set(t,{lastChange:h,cancelWait:()=>(d.delete(t),clearTimeout(r),i)}),r=setTimeout(function i(a){n(l,(n,l)=>{if(n||!d.has(t)){n&&"ENOENT"!==n.code&&s(n);return}let h=Number(new Date);a&&l.size!==a.size&&(d.get(t).lastChange=h),h-d.get(t).lastChange>=e?(d.delete(t),s(void 0,l)):r=setTimeout(i,o,l)})},o))}_isIgnored(t,e){if(this.options.atomic&&tk.test(t))return!0;if(!this._userIgnored){let{cwd:t}=this.options,e=(this.options.ignored||[]).map(tz(t)),i=[...[...this._ignoredPaths].map(tz(t)),...e];this._userIgnored=function(t,e){if(null==t)throw TypeError("anymatch: specify first argument");let i=tD(t).map(t=>"function"==typeof t?t:"string"==typeof t?e=>t===e:t instanceof RegExp?e=>t.test(e):"object"==typeof t&&null!==t?e=>{if(t.path===e)return!0;if(t.recursive){let i=F.relative(t.path,e);return!!i&&!i.startsWith("..")&&!F.isAbsolute(i)}return!1}:()=>!1);return null==e?(t,e)=>tI(i,t,e):tI(i,e)}(i,void 0)}return this._userIgnored(t,e)}_isntIgnored(t,e){return!this._isIgnored(t,e)}_getWatchHelpers(t){return new tT(t,this.options.followSymlinks,this)}_getWatchedDir(t){let e=F.resolve(t);return this._watched.has(e)||this._watched.set(e,new tM(e,this._boundRemove)),this._watched.get(e)}_hasReadPermissions(t){return!!this.options.ignorePermissionErrors||!!(256&Number(t.mode))}_remove(t,e,i){let s=F.join(t,e),r=F.resolve(s);if(i=null!=i?i:this._watched.has(s)||this._watched.has(r),!this._throttle("remove",s,100))return;i||1!==this._watched.size||this.add(t,e,!0),this._getWatchedDir(s).getChildren().forEach(t=>this._remove(s,t));let a=this._getWatchedDir(t),o=a.has(e);a.remove(e),this._symlinkPaths.has(r)&&this._symlinkPaths.delete(r);let n=s;if(this.options.cwd&&(n=F.relative(this.options.cwd,s)),this.options.awaitWriteFinish&&this._pendingWrites.has(n)&&this._pendingWrites.get(n).cancelWait()===te)return;this._watched.delete(s),this._watched.delete(r);let l=i?ta:tr;o&&!this._isIgnored(s)&&this._emit(l,s),this._closePath(s)}_closePath(t){this._closeFile(t);let e=F.dirname(t);this._getWatchedDir(e).remove(F.basename(t))}_closeFile(t){let e=this._closers.get(t);e&&(e.forEach(t=>t()),this._closers.delete(t))}_addPathCloser(t,e){if(!e)return;let i=this._closers.get(t);i||(i=[],this._closers.set(t,i)),i.push(e)}_readdirp(t,e){if(this.closed)return;let i=function(t,e={}){let i=e.entryType||e.type;if("both"===i&&(i=M),i&&(e.type=i),t){if("string"!=typeof t)throw TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");else if(i&&!$.includes(i))throw Error(`readdirp: Invalid type passed. Use one of ${$.join(", ")}`)}else throw Error("readdirp: root argument is required. Usage: readdirp(root, options)");return e.root=t,new G(e)}(t,{type:Z,alwaysStat:!0,lstat:!0,...e,depth:0});return this._streams.add(i),i.once("close",()=>{i=void 0}),i.once("end",()=>{i&&(this._streams.delete(i),i=void 0)}),i}}function tN(){return{interactive:!1,addTarget(t,e){let i={status:"pending",message:"正在启动"};return{log:{info:e=>x.info(`[${t}] ${e}`),success:e=>x.success(`[${t}] ${e}`),warn:e=>x.warn(`[${t}] ${e}`),error:e=>x.error(`[${t}] ${e}`)},ui:{update(t){let s={...i};for(let[r,a]of(Object.assign(i,t),(i.message!==s.message||i.status!==s.status)&&(0,({pending:x.info,success:x.success,error:x.error})[i.status])(`${e}:${i.message}`),Object.entries(i.links??{})))s.links?.[r]!==a&&x.info(`${r}:${a}`)},select:async()=>void 0,print:t=>console.log(t)}}},close(){}}}async function t$(i){if(W())try{let{TUIManager:s,getNativePackageName:r}=await import("./dist.js"),{createRatatuiDevUI:a}=await import("./ratatui-ui.js"),n=e(t(g(import.meta.url)),"tui");if(!o(n)){let e=await I({name:r(),version:v.version,title:"交互界面"},".",i.signal,{interactive:!0,log:x});n=t(g(e))}i.signal.throwIfAborted();let l=new s({nativeDirectory:n});try{return await a(l,i)}catch(t){throw await l.close(),t}}catch(t){i.signal.aborted||x.warn(`无法启动交互界面,改用日志模式:${D(t)}`)}return tN()}async function tO(t,e,r){let a,o=new AbortController,n=Promise.withResolvers(),l=(t=!1)=>{t&&(process.exitCode=130),o.abort(),n.resolve()},h={project:t,options:e,signal:o.signal},d=await tU(h,r.devTargets);if(!d)return;if(await R(W()),t.plugin.id)await k(t);else if(d.some(({target:t})=>"app"===t.name)){x.info("未配置插件 ID,正在上传项目并创建平台草稿…");try{await C({project:t,options:{}},await E(r.exclude,{project:t},"draft"))}catch(t){throw Error(`插件初始化失败,未启动调试:${D(t)}`,{cause:t})}}let c=await E(r.exclude,{project:t},"dev"),f=()=>l(!0),p=()=>{process.exitCode=143,l()};process.on("SIGINT",f),process.on("SIGTERM",p);let m=d.some(({target:t})=>"app"===t.name)?await t$({signal:o.signal,onExit:l,projectName:t.plugin.name}):tN(),u=[],_=async t=>{for(let e of t.disposers.splice(0).reverse())try{await e()}catch(e){t.ctx.log.warn(`清理失败:${D(e)}`)}},w=(t,e)=>{o.signal.aborted||(t.ctx.ui.update({status:"error",message:"运行失败"}),t.ctx.log.error(D(e)))},g=t=>{t.changed.size&&t.ready&&!t.running&&!o.signal.aborted&&(t.running=(async()=>{try{for(;t.changed.size&&!o.signal.aborted;){let e=[...t.changed];t.changed.clear();try{await t.listener?.(e)}catch(e){w(t,e)}}}finally{t.running=void 0}})())};try{for(let e of d){let{name:r,title:a,label:o=a,watch:n=[]}=e.target,l={entry:e,paths:n.map(e=>i(t.root,s(t.root,e))),ready:!1,changed:new Set,disposers:[],ctx:{...h,...m.addTarget(r,o),interactive:m.interactive,packDevelopment:()=>t.pack({exclude:c}),onDispose:t=>l.disposers.push(t),onFilesChanged:t=>{l.listener=t}}};u.push(l)}let e=u.flatMap(({paths:t})=>t),r=function(t,e={}){let i=new tA(e);return i.add(t),i}(t.root,{ignoreInitial:!0,followSymlinks:!1,ignored:s=>{let r=i(t.root,s);return!!r&&!e.some(t=>tH(r,t)||tH(t,r))}});r.on("all",(e,s)=>{if(o.signal.aborted)return;let r=i(t.root,s);for(let t of u)t.paths.some(t=>tH(r,t))&&t.changed.add(r);clearTimeout(a),a=setTimeout(()=>u.forEach(g),400)}),r.on("error",n.reject);let l=Promise.all(u.map(async t=>{try{o.signal.throwIfAborted(),await t.entry.target.start(t.ctx),o.signal.throwIfAborted(),t.ready=!0,g(t)}catch(e){t.changed.clear(),w(t,e),await _(t)}}));try{await n.promise}finally{o.abort(),clearTimeout(a);try{await r.close()}finally{await l,await Promise.all(u.map(t=>t.running))}}}catch(t){if(t!==o.signal.reason&&!(t instanceof Error&&"AbortError"===t.name))throw t}finally{for(let t of(o.abort(),u.toReversed()))await _(t);try{await m.close()}finally{process.off("SIGINT",f),process.off("SIGTERM",p)}}}function tH(t,e){return!e||t===e||t.startsWith(`${e}${r}`)}async function tU(t,e){let{options:i}=t,s=[];for(let r of e){let{pluginName:e,target:a}=r,o=!a.appliesTo||await y({pluginName:e,callback:a.appliesTo},t);if(!o&&r.attribute&&i[r.attribute])throw Error(`[${e}] 当前项目不支持:${a.title}`);o&&s.push(r)}let r=s.filter(({attribute:t})=>t),a=({attribute:t})=>!!(t&&i[t]),o=new Set;if(r.length&&!i.plugin&&!r.some(a)&&W())for(let{target:t}of r){let e=await b({message:`是否同时启动${t.title}?`,initialValue:!1});if(S(e)){P("已取消调试。"),process.exitCode=130;return}e&&o.add(t.name)}let n=s.filter(t=>!t.attribute||a(t)||o.has(t.target.name));return n.some(({target:t})=>"app"===t.name)?n.filter(({target:t})=>"platform"!==t.name):n}export{tO as runSession};