import{_ as t,e,h as i,s as r,l as s,S as a,m as n,x as o,r as h,n as c}from"./index-CZy-fyXs.js";function l(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}class d extends r{constructor(){super(...arguments),this.indeterminate=!1,this.progress=0,this.density=0,this.closed=!1}open(){this.closed=!1}close(){this.closed=!0}render(){const t={"mdc-circular-progress--closed":this.closed,"mdc-circular-progress--indeterminate":this.indeterminate},e=48+4*this.density,i={width:`${e}px`,height:`${e}px`};return o`
      <div
        class="mdc-circular-progress ${s(t)}"
        style="${a(i)}"
        role="progressbar"
        aria-label="${n(this.ariaLabel)}"
        aria-valuemin="0"
        aria-valuemax="1"
        aria-valuenow="${n(this.indeterminate?void 0:this.progress)}">
        ${this.renderDeterminateContainer()}
        ${this.renderIndeterminateContainer()}
      </div>`}renderDeterminateContainer(){const t=48+4*this.density,e=t/2,i=this.density>=-3?18+11*this.density/6:12.5+5*(this.density+3)/4,r=6.2831852*i,s=(1-this.progress)*r,a=this.density>=-3?4+this.density*(1/3):3+(this.density+3)*(1/6);return o`
      <div class="mdc-circular-progress__determinate-container">
        <svg class="mdc-circular-progress__determinate-circle-graphic"
             viewBox="0 0 ${t} ${t}">
          <circle class="mdc-circular-progress__determinate-track"
                  cx="${e}" cy="${e}" r="${i}"
                  stroke-width="${a}"></circle>
          <circle class="mdc-circular-progress__determinate-circle"
                  cx="${e}" cy="${e}" r="${i}"
                  stroke-dasharray="${6.2831852*i}"
                  stroke-dashoffset="${s}"
                  stroke-width="${a}"></circle>
        </svg>
      </div>`}renderIndeterminateContainer(){return o`
      <div class="mdc-circular-progress__indeterminate-container">
        <div class="mdc-circular-progress__spinner-layer">
          ${this.renderIndeterminateSpinnerLayer()}
        </div>
      </div>`}renderIndeterminateSpinnerLayer(){const t=48+4*this.density,e=t/2,i=this.density>=-3?18+11*this.density/6:12.5+5*(this.density+3)/4,r=6.2831852*i,s=.5*r,a=this.density>=-3?4+this.density*(1/3):3+(this.density+3)*(1/6);return o`
        <div class="mdc-circular-progress__circle-clipper mdc-circular-progress__circle-left">
          <svg class="mdc-circular-progress__indeterminate-circle-graphic"
               viewBox="0 0 ${t} ${t}">
            <circle cx="${e}" cy="${e}" r="${i}"
                    stroke-dasharray="${r}"
                    stroke-dashoffset="${s}"
                    stroke-width="${a}"></circle>
          </svg>
        </div>
        <div class="mdc-circular-progress__gap-patch">
          <svg class="mdc-circular-progress__indeterminate-circle-graphic"
               viewBox="0 0 ${t} ${t}">
            <circle cx="${e}" cy="${e}" r="${i}"
                    stroke-dasharray="${r}"
                    stroke-dashoffset="${s}"
                    stroke-width="${.8*a}"></circle>
          </svg>
        </div>
        <div class="mdc-circular-progress__circle-clipper mdc-circular-progress__circle-right">
          <svg class="mdc-circular-progress__indeterminate-circle-graphic"
               viewBox="0 0 ${t} ${t}">
            <circle cx="${e}" cy="${e}" r="${i}"
                    stroke-dasharray="${r}"
                    stroke-dashoffset="${s}"
                    stroke-width="${a}"></circle>
          </svg>
        </div>`}update(t){super.update(t),t.has("progress")&&(this.progress>1&&(this.progress=1),this.progress<0&&(this.progress=0))}}t([e({type:Boolean,reflect:!0})],d.prototype,"indeterminate",void 0),t([e({type:Number,reflect:!0})],d.prototype,"progress",void 0),t([e({type:Number,reflect:!0})],d.prototype,"density",void 0),t([e({type:Boolean,reflect:!0})],d.prototype,"closed",void 0),t([i,e({type:String,attribute:"aria-label"})],d.prototype,"ariaLabel",void 0);const _=h`.mdc-circular-progress__determinate-circle,.mdc-circular-progress__indeterminate-circle-graphic{stroke:#6200ee;stroke:var(--mdc-theme-primary, #6200ee)}.mdc-circular-progress__determinate-track{stroke:transparent}@keyframes mdc-circular-progress-container-rotate{to{transform:rotate(360deg)}}@keyframes mdc-circular-progress-spinner-layer-rotate{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes mdc-circular-progress-color-1-fade-in-out{from{opacity:.99}25%{opacity:.99}26%{opacity:0}89%{opacity:0}90%{opacity:.99}to{opacity:.99}}@keyframes mdc-circular-progress-color-2-fade-in-out{from{opacity:0}15%{opacity:0}25%{opacity:.99}50%{opacity:.99}51%{opacity:0}to{opacity:0}}@keyframes mdc-circular-progress-color-3-fade-in-out{from{opacity:0}40%{opacity:0}50%{opacity:.99}75%{opacity:.99}76%{opacity:0}to{opacity:0}}@keyframes mdc-circular-progress-color-4-fade-in-out{from{opacity:0}65%{opacity:0}75%{opacity:.99}90%{opacity:.99}to{opacity:0}}@keyframes mdc-circular-progress-left-spin{from{transform:rotate(265deg)}50%{transform:rotate(130deg)}to{transform:rotate(265deg)}}@keyframes mdc-circular-progress-right-spin{from{transform:rotate(-265deg)}50%{transform:rotate(-130deg)}to{transform:rotate(-265deg)}}.mdc-circular-progress{display:inline-flex;position:relative;direction:ltr;line-height:0;transition:opacity 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1)}.mdc-circular-progress__determinate-container,.mdc-circular-progress__indeterminate-circle-graphic,.mdc-circular-progress__indeterminate-container,.mdc-circular-progress__spinner-layer{position:absolute;width:100%;height:100%}.mdc-circular-progress__determinate-container{transform:rotate(-90deg)}.mdc-circular-progress__indeterminate-container{font-size:0;letter-spacing:0;white-space:nowrap;opacity:0}.mdc-circular-progress__determinate-circle-graphic,.mdc-circular-progress__indeterminate-circle-graphic{fill:transparent}.mdc-circular-progress__determinate-circle{transition:stroke-dashoffset 500ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-circular-progress__gap-patch{position:absolute;top:0;left:47.5%;box-sizing:border-box;width:5%;height:100%;overflow:hidden}.mdc-circular-progress__gap-patch .mdc-circular-progress__indeterminate-circle-graphic{left:-900%;width:2000%;transform:rotate(180deg)}.mdc-circular-progress__circle-clipper{display:inline-flex;position:relative;width:50%;height:100%;overflow:hidden}.mdc-circular-progress__circle-clipper .mdc-circular-progress__indeterminate-circle-graphic{width:200%}.mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{left:-100%}.mdc-circular-progress--indeterminate .mdc-circular-progress__determinate-container{opacity:0}.mdc-circular-progress--indeterminate .mdc-circular-progress__indeterminate-container{opacity:1}.mdc-circular-progress--indeterminate .mdc-circular-progress__indeterminate-container{animation:mdc-circular-progress-container-rotate 1568.2352941176ms linear infinite}.mdc-circular-progress--indeterminate .mdc-circular-progress__spinner-layer{animation:mdc-circular-progress-spinner-layer-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress--indeterminate .mdc-circular-progress__color-1{animation:mdc-circular-progress-spinner-layer-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both,mdc-circular-progress-color-1-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress--indeterminate .mdc-circular-progress__color-2{animation:mdc-circular-progress-spinner-layer-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both,mdc-circular-progress-color-2-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress--indeterminate .mdc-circular-progress__color-3{animation:mdc-circular-progress-spinner-layer-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both,mdc-circular-progress-color-3-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress--indeterminate .mdc-circular-progress__color-4{animation:mdc-circular-progress-spinner-layer-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both,mdc-circular-progress-color-4-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-left .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-left-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-right-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress--closed{opacity:0}:host{display:inline-flex}.mdc-circular-progress__determinate-track{stroke:transparent;stroke:var(--mdc-circular-progress-track-color, transparent)}`;let u=class extends d{};u.styles=[_],u=t([c("mwc-circular-progress")],u);const f=async t=>{import("./c.IhQGhYV4.js");const e=document.createElement("esphome-no-port-picked-dialog");return e.doTryAgain=t,document.body.append(e),!0};class p extends Error{}function g(t){let e=t.length;for(;--e>=0;)t[e]=0}const m=256,w=286,y=30,b=15,S=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),A=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),E=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),v=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),k=new Array(576);g(k);const T=new Array(60);g(T);const R=new Array(512);g(R);const x=new Array(256);g(x);const I=new Array(29);g(I);const B=new Array(y);function C(t,e,i,r,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=r,this.max_length=s,this.has_stree=t&&t.length}let D,z,U;function P(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}g(B);const F=t=>t<256?R[t]:R[256+(t>>>7)],M=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},L=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<<t.bi_valid&65535,M(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=i)},O=(t,e,i)=>{L(t,i[2*e],i[2*e+1])},H=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Z=(t,e,i)=>{const r=new Array(16);let s,a,n=0;for(s=1;s<=b;s++)n=n+i[s-1]<<1,r[s]=n;for(a=0;a<=e;a++){let e=t[2*a+1];0!==e&&(t[2*a]=H(r[e]++,e))}},N=t=>{let e;for(e=0;e<w;e++)t.dyn_ltree[2*e]=0;for(e=0;e<y;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},$=t=>{t.bi_valid>8?M(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},G=(t,e,i,r)=>{const s=2*e,a=2*i;return t[s]<t[a]||t[s]===t[a]&&r[e]<=r[i]},W=(t,e,i)=>{const r=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s<t.heap_len&&G(e,t.heap[s+1],t.heap[s],t.depth)&&s++,!G(e,r,t.heap[s],t.depth));)t.heap[i]=t.heap[s],i=s,s<<=1;t.heap[i]=r},j=(t,e,i)=>{let r,s,a,n,o=0;if(0!==t.sym_next)do{r=255&t.pending_buf[t.sym_buf+o++],r+=(255&t.pending_buf[t.sym_buf+o++])<<8,s=t.pending_buf[t.sym_buf+o++],0===r?O(t,s,e):(a=x[s],O(t,a+m+1,e),n=S[a],0!==n&&(s-=I[a],L(t,s,n)),r--,a=F(r),O(t,a,i),n=A[a],0!==n&&(r-=B[a],L(t,r,n)))}while(o<t.sym_next);O(t,256,e)},K=(t,e)=>{const i=e.dyn_tree,r=e.stat_desc.static_tree,s=e.stat_desc.has_stree,a=e.stat_desc.elems;let n,o,h,c=-1;for(t.heap_len=0,t.heap_max=573,n=0;n<a;n++)0!==i[2*n]?(t.heap[++t.heap_len]=c=n,t.depth[n]=0):i[2*n+1]=0;for(;t.heap_len<2;)h=t.heap[++t.heap_len]=c<2?++c:0,i[2*h]=1,t.depth[h]=0,t.opt_len--,s&&(t.static_len-=r[2*h+1]);for(e.max_code=c,n=t.heap_len>>1;n>=1;n--)W(t,i,n);h=a;do{n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],W(t,i,1),o=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=o,i[2*h]=i[2*n]+i[2*o],t.depth[h]=(t.depth[n]>=t.depth[o]?t.depth[n]:t.depth[o])+1,i[2*n+1]=i[2*o+1]=h,t.heap[1]=h++,W(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,r=e.max_code,s=e.stat_desc.static_tree,a=e.stat_desc.has_stree,n=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,h=e.stat_desc.max_length;let c,l,d,_,u,f,p=0;for(_=0;_<=b;_++)t.bl_count[_]=0;for(i[2*t.heap[t.heap_max]+1]=0,c=t.heap_max+1;c<573;c++)l=t.heap[c],_=i[2*i[2*l+1]+1]+1,_>h&&(_=h,p++),i[2*l+1]=_,l>r||(t.bl_count[_]++,u=0,l>=o&&(u=n[l-o]),f=i[2*l],t.opt_len+=f*(_+u),a&&(t.static_len+=f*(s[2*l+1]+u)));if(0!==p){do{for(_=h-1;0===t.bl_count[_];)_--;t.bl_count[_]--,t.bl_count[_+1]+=2,t.bl_count[h]--,p-=2}while(p>0);for(_=h;0!==_;_--)for(l=t.bl_count[_];0!==l;)d=t.heap[--c],d>r||(i[2*d+1]!==_&&(t.opt_len+=(_-i[2*d+1])*i[2*d],i[2*d+1]=_),l--)}})(t,e),Z(i,c,t.bl_count)},q=(t,e,i)=>{let r,s,a=-1,n=e[1],o=0,h=7,c=4;for(0===n&&(h=138,c=3),e[2*(i+1)+1]=65535,r=0;r<=i;r++)s=n,n=e[2*(r+1)+1],++o<h&&s===n||(o<c?t.bl_tree[2*s]+=o:0!==s?(s!==a&&t.bl_tree[2*s]++,t.bl_tree[32]++):o<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=0,a=s,0===n?(h=138,c=3):s===n?(h=6,c=3):(h=7,c=4))},J=(t,e,i)=>{let r,s,a=-1,n=e[1],o=0,h=7,c=4;for(0===n&&(h=138,c=3),r=0;r<=i;r++)if(s=n,n=e[2*(r+1)+1],!(++o<h&&s===n)){if(o<c)do{O(t,s,t.bl_tree)}while(0!=--o);else 0!==s?(s!==a&&(O(t,s,t.bl_tree),o--),O(t,16,t.bl_tree),L(t,o-3,2)):o<=10?(O(t,17,t.bl_tree),L(t,o-3,3)):(O(t,18,t.bl_tree),L(t,o-11,7));o=0,a=s,0===n?(h=138,c=3):s===n?(h=6,c=3):(h=7,c=4)}};let Y=!1;const V=(t,e,i,r)=>{L(t,0+(r?1:0),3),$(t),M(t,i),M(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};var X=t=>{Y||((()=>{let t,e,i,r,s;const a=new Array(16);for(i=0,r=0;r<28;r++)for(I[r]=i,t=0;t<1<<S[r];t++)x[i++]=r;for(x[i-1]=r,s=0,r=0;r<16;r++)for(B[r]=s,t=0;t<1<<A[r];t++)R[s++]=r;for(s>>=7;r<y;r++)for(B[r]=s<<7,t=0;t<1<<A[r]-7;t++)R[256+s++]=r;for(e=0;e<=b;e++)a[e]=0;for(t=0;t<=143;)k[2*t+1]=8,t++,a[8]++;for(;t<=255;)k[2*t+1]=9,t++,a[9]++;for(;t<=279;)k[2*t+1]=7,t++,a[7]++;for(;t<=287;)k[2*t+1]=8,t++,a[8]++;for(Z(k,287,a),t=0;t<y;t++)T[2*t+1]=5,T[2*t]=H(t,5);D=new C(k,S,257,w,b),z=new C(T,A,0,y,b),U=new C(new Array(0),E,0,19,7)})(),Y=!0),t.l_desc=new P(t.dyn_ltree,D),t.d_desc=new P(t.dyn_dtree,z),t.bl_desc=new P(t.bl_tree,U),t.bi_buf=0,t.bi_valid=0,N(t)},Q=(t,e,i,r)=>{let s,a,n=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<m;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),K(t,t.l_desc),K(t,t.d_desc),n=(t=>{let e;for(q(t,t.dyn_ltree,t.l_desc.max_code),q(t,t.dyn_dtree,t.d_desc.max_code),K(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*v[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=s&&(s=a)):s=a=i+5,i+4<=s&&-1!==e?V(t,e,i,r):4===t.strategy||a===s?(L(t,2+(r?1:0),3),j(t,k,T)):(L(t,4+(r?1:0),3),((t,e,i,r)=>{let s;for(L(t,e-257,5),L(t,i-1,5),L(t,r-4,4),s=0;s<r;s++)L(t,t.bl_tree[2*v[s]+1],3);J(t,t.dyn_ltree,e-1),J(t,t.dyn_dtree,i-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,n+1),j(t,t.dyn_ltree,t.dyn_dtree)),N(t),r&&$(t)},tt=(t,e,i)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(x[i]+m+1)]++,t.dyn_dtree[2*F(e)]++),t.sym_next===t.sym_end),et=t=>{L(t,2,3),O(t,256,k),(t=>{16===t.bi_valid?(M(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)},it={_tr_init:X,_tr_stored_block:V,_tr_flush_block:Q,_tr_tally:tt,_tr_align:et};var rt=(t,e,i,r)=>{let s=65535&t|0,a=t>>>16&65535|0,n=0;for(;0!==i;){n=i>2e3?2e3:i,i-=n;do{s=s+e[r++]|0,a=a+s|0}while(--n);s%=65521,a%=65521}return s|a<<16|0};const st=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var at=(t,e,i,r)=>{const s=st,a=r+i;t^=-1;for(let i=r;i<a;i++)t=t>>>8^s[255&(t^e[i])];return-1^t},nt={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ot={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:ht,_tr_stored_block:ct,_tr_flush_block:lt,_tr_tally:dt,_tr_align:_t}=it,{Z_NO_FLUSH:ut,Z_PARTIAL_FLUSH:ft,Z_FULL_FLUSH:pt,Z_FINISH:gt,Z_BLOCK:mt,Z_OK:wt,Z_STREAM_END:yt,Z_STREAM_ERROR:bt,Z_DATA_ERROR:St,Z_BUF_ERROR:At,Z_DEFAULT_COMPRESSION:Et,Z_FILTERED:vt,Z_HUFFMAN_ONLY:kt,Z_RLE:Tt,Z_FIXED:Rt,Z_DEFAULT_STRATEGY:xt,Z_UNKNOWN:It,Z_DEFLATED:Bt}=ot,Ct=258,Dt=262,zt=42,Ut=113,Pt=666,Ft=(t,e)=>(t.msg=nt[e],e),Mt=t=>2*t-(t>4?9:0),Lt=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Ot=t=>{let e,i,r,s=t.w_size;e=t.hash_size,r=e;do{i=t.head[--r],t.head[r]=i>=s?i-s:0}while(--e);e=s,r=e;do{i=t.prev[--r],t.prev[r]=i>=s?i-s:0}while(--e)};let Ht=(t,e,i)=>(e<<t.hash_shift^i)&t.hash_mask;const Zt=t=>{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},Nt=(t,e)=>{lt(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Zt(t.strm)},$t=(t,e)=>{t.pending_buf[t.pending++]=e},Gt=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Wt=(t,e,i,r)=>{let s=t.avail_in;return s>r&&(s=r),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=rt(t.adler,e,s,i):2===t.state.wrap&&(t.adler=at(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},jt=(t,e)=>{let i,r,s=t.max_chain_length,a=t.strstart,n=t.prev_length,o=t.nice_match;const h=t.strstart>t.w_size-Dt?t.strstart-(t.w_size-Dt):0,c=t.window,l=t.w_mask,d=t.prev,_=t.strstart+Ct;let u=c[a+n-1],f=c[a+n];t.prev_length>=t.good_match&&(s>>=2),o>t.lookahead&&(o=t.lookahead);do{if(i=e,c[i+n]===f&&c[i+n-1]===u&&c[i]===c[a]&&c[++i]===c[a+1]){a+=2,i++;do{}while(c[++a]===c[++i]&&c[++a]===c[++i]&&c[++a]===c[++i]&&c[++a]===c[++i]&&c[++a]===c[++i]&&c[++a]===c[++i]&&c[++a]===c[++i]&&c[++a]===c[++i]&&a<_);if(r=Ct-(_-a),a=_-Ct,r>n){if(t.match_start=e,n=r,r>=o)break;u=c[a+n-1],f=c[a+n]}}}while((e=d[e&l])>h&&0!=--s);return n<=t.lookahead?n:t.lookahead},Kt=t=>{const e=t.w_size;let i,r,s;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Dt)&&(t.window.set(t.window.subarray(e,e+e-r),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Ot(t),r+=e),0===t.strm.avail_in)break;if(i=Wt(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=Ht(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=Ht(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<Dt&&0!==t.strm.avail_in)},qt=(t,e)=>{let i,r,s,a=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,n=0,o=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_out<s)break;if(s=t.strm.avail_out-s,r=t.strstart-t.block_start,i>r+t.strm.avail_in&&(i=r+t.strm.avail_in),i>s&&(i=s),i<a&&(0===i&&e!==gt||e===ut||i!==r+t.strm.avail_in))break;n=e===gt&&i===r+t.strm.avail_in?1:0,ct(t,0,0,n),t.pending_buf[t.pending-4]=i,t.pending_buf[t.pending-3]=i>>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Zt(t.strm),r&&(r>i&&(r=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+r),t.strm.next_out),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r,t.block_start+=r,i-=r),i&&(Wt(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===n);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),n?4:e!==ut&&e!==gt&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(s=t.window_size-t.strstart,t.strm.avail_in>s&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(Wt(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water<t.strstart&&(t.high_water=t.strstart),s=t.bi_valid+42>>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,a=s>t.w_size?t.w_size:s,r=t.strstart-t.block_start,(r>=a||(r||e===gt)&&e!==ut&&0===t.strm.avail_in&&r<=s)&&(i=r>s?s:r,n=e===gt&&0===t.strm.avail_in&&i===r?1:0,ct(t,t.block_start,i,n),t.block_start+=i,Zt(t.strm)),n?3:1)},Jt=(t,e)=>{let i,r;for(;;){if(t.lookahead<Dt){if(Kt(t),t.lookahead<Dt&&e===ut)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(t.ins_h=Ht(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Dt&&(t.match_length=jt(t,i)),t.match_length>=3)if(r=dt(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=Ht(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Ht(t,t.ins_h,t.window[t.strstart+1]);else r=dt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(Nt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===gt?(Nt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Nt(t,!1),0===t.strm.avail_out)?1:2},Yt=(t,e)=>{let i,r,s;for(;;){if(t.lookahead<Dt){if(Kt(t),t.lookahead<Dt&&e===ut)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(t.ins_h=Ht(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length<t.max_lazy_match&&t.strstart-i<=t.w_size-Dt&&(t.match_length=jt(t,i),t.match_length<=5&&(t.strategy===vt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,r=dt(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=Ht(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,r&&(Nt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(r=dt(t,0,t.window[t.strstart-1]),r&&Nt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=dt(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===gt?(Nt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Nt(t,!1),0===t.strm.avail_out)?1:2};function Vt(t,e,i,r,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=r,this.func=s}const Xt=[new Vt(0,0,0,0,qt),new Vt(4,4,8,4,Jt),new Vt(4,5,16,8,Jt),new Vt(4,6,32,32,Jt),new Vt(4,4,16,16,Yt),new Vt(8,16,32,32,Yt),new Vt(8,16,128,128,Yt),new Vt(8,32,128,256,Yt),new Vt(32,128,258,1024,Yt),new Vt(32,258,258,4096,Yt)];function Qt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Bt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Lt(this.dyn_ltree),Lt(this.dyn_dtree),Lt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Lt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Lt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const te=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==zt&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Ut&&e.status!==Pt?1:0},ee=t=>{if(te(t))return Ft(t,bt);t.total_in=t.total_out=0,t.data_type=It;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?zt:Ut,t.adler=2===e.wrap?0:1,e.last_flush=-2,ht(e),wt},ie=t=>{const e=ee(t);return e===wt&&(t=>{t.window_size=2*t.w_size,Lt(t.head),t.max_lazy_match=Xt[t.level].max_lazy,t.good_match=Xt[t.level].good_length,t.nice_match=Xt[t.level].nice_length,t.max_chain_length=Xt[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0})(t.state),e},re=(t,e,i,r,s,a)=>{if(!t)return bt;let n=1;if(e===Et&&(e=6),r<0?(n=0,r=-r):r>15&&(n=2,r-=16),s<1||s>9||i!==Bt||r<8||r>15||e<0||e>9||a<0||a>Rt||8===r&&1!==n)return Ft(t,bt);8===r&&(r=9);const o=new Qt;return t.state=o,o.strm=t,o.status=zt,o.wrap=n,o.gzhead=null,o.w_bits=r,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=s+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<s+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=e,o.strategy=a,o.method=i,ie(t)};var se=(t,e)=>{if(te(t)||e>mt||e<0)return t?Ft(t,bt):bt;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Pt&&e!==gt)return Ft(t,0===t.avail_out?At:bt);const r=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Zt(t),0===t.avail_out)return i.last_flush=-1,wt}else if(0===t.avail_in&&Mt(e)<=Mt(r)&&e!==gt)return Ft(t,At);if(i.status===Pt&&0!==t.avail_in)return Ft(t,At);if(i.status===zt&&0===i.wrap&&(i.status=Ut),i.status===zt){let e=Bt+(i.w_bits-8<<4)<<8,r=-1;if(r=i.strategy>=kt||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=r<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Gt(i,e),0!==i.strstart&&(Gt(i,t.adler>>>16),Gt(i,65535&t.adler)),t.adler=1,i.status=Ut,Zt(t),0!==i.pending)return i.last_flush=-1,wt}if(57===i.status)if(t.adler=0,$t(i,31),$t(i,139),$t(i,8),i.gzhead)$t(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),$t(i,255&i.gzhead.time),$t(i,i.gzhead.time>>8&255),$t(i,i.gzhead.time>>16&255),$t(i,i.gzhead.time>>24&255),$t(i,9===i.level?2:i.strategy>=kt||i.level<2?4:0),$t(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&($t(i,255&i.gzhead.extra.length),$t(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=at(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if($t(i,0),$t(i,0),$t(i,0),$t(i,0),$t(i,0),$t(i,9===i.level?2:i.strategy>=kt||i.level<2?4:0),$t(i,3),i.status=Ut,Zt(t),0!==i.pending)return i.last_flush=-1,wt;if(69===i.status){if(i.gzhead.extra){let e=i.pending,r=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+r>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=at(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Zt(t),0!==i.pending)return i.last_flush=-1,wt;e=0,r-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+r),i.pending),i.pending+=r,i.gzhead.hcrc&&i.pending>e&&(t.adler=at(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,r=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>r&&(t.adler=at(t.adler,i.pending_buf,i.pending-r,r)),Zt(t),0!==i.pending)return i.last_flush=-1,wt;r=0}e=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,$t(i,e)}while(0!==e);i.gzhead.hcrc&&i.pending>r&&(t.adler=at(t.adler,i.pending_buf,i.pending-r,r)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,r=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>r&&(t.adler=at(t.adler,i.pending_buf,i.pending-r,r)),Zt(t),0!==i.pending)return i.last_flush=-1,wt;r=0}e=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,$t(i,e)}while(0!==e);i.gzhead.hcrc&&i.pending>r&&(t.adler=at(t.adler,i.pending_buf,i.pending-r,r))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Zt(t),0!==i.pending))return i.last_flush=-1,wt;$t(i,255&t.adler),$t(i,t.adler>>8&255),t.adler=0}if(i.status=Ut,Zt(t),0!==i.pending)return i.last_flush=-1,wt}if(0!==t.avail_in||0!==i.lookahead||e!==ut&&i.status!==Pt){let r=0===i.level?qt(i,e):i.strategy===kt?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Kt(t),0===t.lookahead)){if(e===ut)return 1;break}if(t.match_length=0,i=dt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(Nt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===gt?(Nt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Nt(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Tt?((t,e)=>{let i,r,s,a;const n=t.window;for(;;){if(t.lookahead<=Ct){if(Kt(t),t.lookahead<=Ct&&e===ut)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,r=n[s],r===n[++s]&&r===n[++s]&&r===n[++s])){a=t.strstart+Ct;do{}while(r===n[++s]&&r===n[++s]&&r===n[++s]&&r===n[++s]&&r===n[++s]&&r===n[++s]&&r===n[++s]&&r===n[++s]&&s<a);t.match_length=Ct-(a-s),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=dt(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=dt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(Nt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===gt?(Nt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Nt(t,!1),0===t.strm.avail_out)?1:2})(i,e):Xt[i.level].func(i,e);if(3!==r&&4!==r||(i.status=Pt),1===r||3===r)return 0===t.avail_out&&(i.last_flush=-1),wt;if(2===r&&(e===ft?_t(i):e!==mt&&(ct(i,0,0,!1),e===pt&&(Lt(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Zt(t),0===t.avail_out))return i.last_flush=-1,wt}return e!==gt?wt:i.wrap<=0?yt:(2===i.wrap?($t(i,255&t.adler),$t(i,t.adler>>8&255),$t(i,t.adler>>16&255),$t(i,t.adler>>24&255),$t(i,255&t.total_in),$t(i,t.total_in>>8&255),$t(i,t.total_in>>16&255),$t(i,t.total_in>>24&255)):(Gt(i,t.adler>>>16),Gt(i,65535&t.adler)),Zt(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?wt:yt)},ae=(t,e)=>{let i=e.length;if(te(t))return bt;const r=t.state,s=r.wrap;if(2===s||1===s&&r.status!==zt||r.lookahead)return bt;if(1===s&&(t.adler=rt(t.adler,e,i,0)),r.wrap=0,i>=r.w_size){0===s&&(Lt(r.head),r.strstart=0,r.block_start=0,r.insert=0);let t=new Uint8Array(r.w_size);t.set(e.subarray(i-r.w_size,i),0),e=t,i=r.w_size}const a=t.avail_in,n=t.next_in,o=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Kt(r);r.lookahead>=3;){let t=r.strstart,e=r.lookahead-2;do{r.ins_h=Ht(r,r.ins_h,r.window[t+3-1]),r.prev[t&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=t,t++}while(--e);r.strstart=t,r.lookahead=2,Kt(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,t.next_in=n,t.input=o,t.avail_in=a,r.wrap=s,wt},ne={deflateInit:(t,e)=>re(t,e,Bt,15,8,xt),deflateInit2:re,deflateReset:ie,deflateResetKeep:ee,deflateSetHeader:(t,e)=>te(t)||2!==t.state.wrap?bt:(t.state.gzhead=e,wt),deflate:se,deflateEnd:t=>{if(te(t))return bt;const e=t.state.status;return t.state=null,e===Ut?Ft(t,St):wt},deflateSetDictionary:ae,deflateInfo:"pako deflate (from Nodeca project)"};const oe=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var he={assign:function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)oe(i,e)&&(t[e]=i[e])}}return t},flattenChunks:t=>{let e=0;for(let i=0,r=t.length;i<r;i++)e+=t[i].length;const i=new Uint8Array(e);for(let e=0,r=0,s=t.length;e<s;e++){let s=t[e];i.set(s,r),r+=s.length}return i}};let ce=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){ce=!1}const le=new Uint8Array(256);for(let t=0;t<256;t++)le[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;le[254]=le[254]=1;var de={string2buf:t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,r,s,a,n=t.length,o=0;for(s=0;s<n;s++)i=t.charCodeAt(s),55296==(64512&i)&&s+1<n&&(r=t.charCodeAt(s+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),s++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(e=new Uint8Array(o),a=0,s=0;a<o;s++)i=t.charCodeAt(s),55296==(64512&i)&&s+1<n&&(r=t.charCodeAt(s+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),s++)),i<128?e[a++]=i:i<2048?(e[a++]=192|i>>>6,e[a++]=128|63&i):i<65536?(e[a++]=224|i>>>12,e[a++]=128|i>>>6&63,e[a++]=128|63&i):(e[a++]=240|i>>>18,e[a++]=128|i>>>12&63,e[a++]=128|i>>>6&63,e[a++]=128|63&i);return e},buf2string:(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let r,s;const a=new Array(2*i);for(s=0,r=0;r<i;){let e=t[r++];if(e<128){a[s++]=e;continue}let n=le[e];if(n>4)a[s++]=65533,r+=n-1;else{for(e&=2===n?31:3===n?15:7;n>1&&r<i;)e=e<<6|63&t[r++],n--;n>1?a[s++]=65533:e<65536?a[s++]=e:(e-=65536,a[s++]=55296|e>>10&1023,a[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&ce)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let r=0;r<e;r++)i+=String.fromCharCode(t[r]);return i})(a,s)},utf8border:(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+le[t[i]]>e?i:e}};var _e=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const ue=Object.prototype.toString,{Z_NO_FLUSH:fe,Z_SYNC_FLUSH:pe,Z_FULL_FLUSH:ge,Z_FINISH:me,Z_OK:we,Z_STREAM_END:ye,Z_DEFAULT_COMPRESSION:be,Z_DEFAULT_STRATEGY:Se,Z_DEFLATED:Ae}=ot;function Ee(t){this.options=he.assign({level:be,method:Ae,chunkSize:16384,windowBits:15,memLevel:8,strategy:Se},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _e,this.strm.avail_out=0;let i=ne.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==we)throw new Error(nt[i]);if(e.header&&ne.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?de.string2buf(e.dictionary):"[object ArrayBuffer]"===ue.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=ne.deflateSetDictionary(this.strm,t),i!==we)throw new Error(nt[i]);this._dict_set=!0}}Ee.prototype.push=function(t,e){const i=this.strm,r=this.options.chunkSize;let s,a;if(this.ended)return!1;for(a=e===~~e?e:!0===e?me:fe,"string"==typeof t?i.input=de.string2buf(t):"[object ArrayBuffer]"===ue.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),(a===pe||a===ge)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=ne.deflate(i,a),s===ye)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=ne.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===we;if(0!==i.avail_out){if(a>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Ee.prototype.onData=function(t){this.chunks.push(t)},Ee.prototype.onEnd=function(t){t===we&&(this.result=he.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var ve={deflate:function(t,e){const i=new Ee(e);if(i.push(t,!0),i.err)throw i.msg||nt[i.err];return i.result}};const ke=16209;var Te=function(t,e){let i,r,s,a,n,o,h,c,l,d,_,u,f,p,g,m,w,y,b,S,A,E,v,k;const T=t.state;i=t.next_in,v=t.input,r=i+(t.avail_in-5),s=t.next_out,k=t.output,a=s-(e-t.avail_out),n=s+(t.avail_out-257),o=T.dmax,h=T.wsize,c=T.whave,l=T.wnext,d=T.window,_=T.hold,u=T.bits,f=T.lencode,p=T.distcode,g=(1<<T.lenbits)-1,m=(1<<T.distbits)-1;t:do{u<15&&(_+=v[i++]<<u,u+=8,_+=v[i++]<<u,u+=8),w=f[_&g];e:for(;;){if(y=w>>>24,_>>>=y,u-=y,y=w>>>16&255,0===y)k[s++]=65535&w;else{if(!(16&y)){if(0==(64&y)){w=f[(65535&w)+(_&(1<<y)-1)];continue e}if(32&y){T.mode=16191;break t}t.msg="invalid literal/length code",T.mode=ke;break t}b=65535&w,y&=15,y&&(u<y&&(_+=v[i++]<<u,u+=8),b+=_&(1<<y)-1,_>>>=y,u-=y),u<15&&(_+=v[i++]<<u,u+=8,_+=v[i++]<<u,u+=8),w=p[_&m];i:for(;;){if(y=w>>>24,_>>>=y,u-=y,y=w>>>16&255,!(16&y)){if(0==(64&y)){w=p[(65535&w)+(_&(1<<y)-1)];continue i}t.msg="invalid distance code",T.mode=ke;break t}if(S=65535&w,y&=15,u<y&&(_+=v[i++]<<u,u+=8,u<y&&(_+=v[i++]<<u,u+=8)),S+=_&(1<<y)-1,S>o){t.msg="invalid distance too far back",T.mode=ke;break t}if(_>>>=y,u-=y,y=s-a,S>y){if(y=S-y,y>c&&T.sane){t.msg="invalid distance too far back",T.mode=ke;break t}if(A=0,E=d,0===l){if(A+=h-y,y<b){b-=y;do{k[s++]=d[A++]}while(--y);A=s-S,E=k}}else if(l<y){if(A+=h+l-y,y-=l,y<b){b-=y;do{k[s++]=d[A++]}while(--y);if(A=0,l<b){y=l,b-=y;do{k[s++]=d[A++]}while(--y);A=s-S,E=k}}}else if(A+=l-y,y<b){b-=y;do{k[s++]=d[A++]}while(--y);A=s-S,E=k}for(;b>2;)k[s++]=E[A++],k[s++]=E[A++],k[s++]=E[A++],b-=3;b&&(k[s++]=E[A++],b>1&&(k[s++]=E[A++]))}else{A=s-S;do{k[s++]=k[A++],k[s++]=k[A++],k[s++]=k[A++],b-=3}while(b>2);b&&(k[s++]=k[A++],b>1&&(k[s++]=k[A++]))}break}}break}}while(i<r&&s<n);b=u>>3,i-=b,u-=b<<3,_&=(1<<u)-1,t.next_in=i,t.next_out=s,t.avail_in=i<r?r-i+5:5-(i-r),t.avail_out=s<n?n-s+257:257-(s-n),T.hold=_,T.bits=u};const Re=15,xe=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Ie=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Be=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Ce=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var De=(t,e,i,r,s,a,n,o)=>{const h=o.bits;let c,l,d,_,u,f,p=0,g=0,m=0,w=0,y=0,b=0,S=0,A=0,E=0,v=0,k=null;const T=new Uint16Array(16),R=new Uint16Array(16);let x,I,B,C=null;for(p=0;p<=Re;p++)T[p]=0;for(g=0;g<r;g++)T[e[i+g]]++;for(y=h,w=Re;w>=1&&0===T[w];w--);if(y>w&&(y=w),0===w)return s[a++]=20971520,s[a++]=20971520,o.bits=1,0;for(m=1;m<w&&0===T[m];m++);for(y<m&&(y=m),A=1,p=1;p<=Re;p++)if(A<<=1,A-=T[p],A<0)return-1;if(A>0&&(0===t||1!==w))return-1;for(R[1]=0,p=1;p<Re;p++)R[p+1]=R[p]+T[p];for(g=0;g<r;g++)0!==e[i+g]&&(n[R[e[i+g]]++]=g);if(0===t?(k=C=n,f=20):1===t?(k=xe,C=Ie,f=257):(k=Be,C=Ce,f=0),v=0,g=0,p=m,u=a,b=y,S=0,d=-1,E=1<<y,_=E-1,1===t&&E>852||2===t&&E>592)return 1;for(;;){x=p-S,n[g]+1<f?(I=0,B=n[g]):n[g]>=f?(I=C[n[g]-f],B=k[n[g]-f]):(I=96,B=0),c=1<<p-S,l=1<<b,m=l;do{l-=c,s[u+(v>>S)+l]=x<<24|I<<16|B|0}while(0!==l);for(c=1<<p-1;v&c;)c>>=1;if(0!==c?(v&=c-1,v+=c):v=0,g++,0==--T[p]){if(p===w)break;p=e[i+n[g]]}if(p>y&&(v&_)!==d){for(0===S&&(S=y),u+=m,b=p-S,A=1<<b;b+S<w&&(A-=T[b+S],!(A<=0));)b++,A<<=1;if(E+=1<<b,1===t&&E>852||2===t&&E>592)return 1;d=v&_,s[d]=y<<24|b<<16|u-a|0}}return 0!==v&&(s[u+v]=p-S<<24|64<<16|0),o.bits=y,0};const{Z_FINISH:ze,Z_BLOCK:Ue,Z_TREES:Pe,Z_OK:Fe,Z_STREAM_END:Me,Z_NEED_DICT:Le,Z_STREAM_ERROR:Oe,Z_DATA_ERROR:He,Z_MEM_ERROR:Ze,Z_BUF_ERROR:Ne,Z_DEFLATED:$e}=ot,Ge=16180,We=16190,je=16191,Ke=16192,qe=16194,Je=16199,Ye=16200,Ve=16206,Xe=16209,Qe=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function ti(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const ei=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<Ge||e.mode>16211?1:0},ii=t=>{if(ei(t))return Oe;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Ge,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Fe},ri=t=>{if(ei(t))return Oe;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,ii(t)},si=(t,e)=>{let i;if(ei(t))return Oe;const r=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Oe:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,ri(t))},ai=(t,e)=>{if(!t)return Oe;const i=new ti;t.state=i,i.strm=t,i.window=null,i.mode=Ge;const r=si(t,e);return r!==Fe&&(t.state=null),r};let ni,oi,hi=!0;const ci=t=>{if(hi){ni=new Int32Array(512),oi=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(De(1,t.lens,0,288,ni,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;De(2,t.lens,0,32,oi,0,t.work,{bits:5}),hi=!1}t.lencode=ni,t.lenbits=9,t.distcode=oi,t.distbits=5},li=(t,e,i,r)=>{let s;const a=t.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),r>=a.wsize?(a.window.set(e.subarray(i-a.wsize,i),0),a.wnext=0,a.whave=a.wsize):(s=a.wsize-a.wnext,s>r&&(s=r),a.window.set(e.subarray(i-r,i-r+s),a.wnext),(r-=s)?(a.window.set(e.subarray(i-r,i),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=s,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=s))),0};var di=(t,e)=>{let i,r,s,a,n,o,h,c,l,d,_,u,f,p,g,m,w,y,b,S,A,E,v=0;const k=new Uint8Array(4);let T,R;const x=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ei(t)||!t.output||!t.input&&0!==t.avail_in)return Oe;i=t.state,i.mode===je&&(i.mode=Ke),n=t.next_out,s=t.output,h=t.avail_out,a=t.next_in,r=t.input,o=t.avail_in,c=i.hold,l=i.bits,d=o,_=h,E=Fe;t:for(;;)switch(i.mode){case Ge:if(0===i.wrap){i.mode=Ke;break}for(;l<16;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}if(2&i.wrap&&35615===c){0===i.wbits&&(i.wbits=15),i.check=0,k[0]=255&c,k[1]=c>>>8&255,i.check=at(i.check,k,2,0),c=0,l=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&c)<<8)+(c>>8))%31){t.msg="incorrect header check",i.mode=Xe;break}if((15&c)!==$e){t.msg="unknown compression method",i.mode=Xe;break}if(c>>>=4,l-=4,A=8+(15&c),0===i.wbits&&(i.wbits=A),A>15||A>i.wbits){t.msg="invalid window size",i.mode=Xe;break}i.dmax=1<<i.wbits,i.flags=0,t.adler=i.check=1,i.mode=512&c?16189:je,c=0,l=0;break;case 16181:for(;l<16;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}if(i.flags=c,(255&i.flags)!==$e){t.msg="unknown compression method",i.mode=Xe;break}if(57344&i.flags){t.msg="unknown header flags set",i.mode=Xe;break}i.head&&(i.head.text=c>>8&1),512&i.flags&&4&i.wrap&&(k[0]=255&c,k[1]=c>>>8&255,i.check=at(i.check,k,2,0)),c=0,l=0,i.mode=16182;case 16182:for(;l<32;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}i.head&&(i.head.time=c),512&i.flags&&4&i.wrap&&(k[0]=255&c,k[1]=c>>>8&255,k[2]=c>>>16&255,k[3]=c>>>24&255,i.check=at(i.check,k,4,0)),c=0,l=0,i.mode=16183;case 16183:for(;l<16;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}i.head&&(i.head.xflags=255&c,i.head.os=c>>8),512&i.flags&&4&i.wrap&&(k[0]=255&c,k[1]=c>>>8&255,i.check=at(i.check,k,2,0)),c=0,l=0,i.mode=16184;case 16184:if(1024&i.flags){for(;l<16;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}i.length=c,i.head&&(i.head.extra_len=c),512&i.flags&&4&i.wrap&&(k[0]=255&c,k[1]=c>>>8&255,i.check=at(i.check,k,2,0)),c=0,l=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(u=i.length,u>o&&(u=o),u&&(i.head&&(A=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(r.subarray(a,a+u),A)),512&i.flags&&4&i.wrap&&(i.check=at(i.check,r,u,a)),o-=u,a+=u,i.length-=u),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===o)break t;u=0;do{A=r[a+u++],i.head&&A&&i.length<65536&&(i.head.name+=String.fromCharCode(A))}while(A&&u<o);if(512&i.flags&&4&i.wrap&&(i.check=at(i.check,r,u,a)),o-=u,a+=u,A)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=16187;case 16187:if(4096&i.flags){if(0===o)break t;u=0;do{A=r[a+u++],i.head&&A&&i.length<65536&&(i.head.comment+=String.fromCharCode(A))}while(A&&u<o);if(512&i.flags&&4&i.wrap&&(i.check=at(i.check,r,u,a)),o-=u,a+=u,A)break t}else i.head&&(i.head.comment=null);i.mode=16188;case 16188:if(512&i.flags){for(;l<16;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}if(4&i.wrap&&c!==(65535&i.check)){t.msg="header crc mismatch",i.mode=Xe;break}c=0,l=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=je;break;case 16189:for(;l<32;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}t.adler=i.check=Qe(c),c=0,l=0,i.mode=We;case We:if(0===i.havedict)return t.next_out=n,t.avail_out=h,t.next_in=a,t.avail_in=o,i.hold=c,i.bits=l,Le;t.adler=i.check=1,i.mode=je;case je:if(e===Ue||e===Pe)break t;case Ke:if(i.last){c>>>=7&l,l-=7&l,i.mode=Ve;break}for(;l<3;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}switch(i.last=1&c,c>>>=1,l-=1,3&c){case 0:i.mode=16193;break;case 1:if(ci(i),i.mode=Je,e===Pe){c>>>=2,l-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=Xe}c>>>=2,l-=2;break;case 16193:for(c>>>=7&l,l-=7&l;l<32;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}if((65535&c)!=(c>>>16^65535)){t.msg="invalid stored block lengths",i.mode=Xe;break}if(i.length=65535&c,c=0,l=0,i.mode=qe,e===Pe)break t;case qe:i.mode=16195;case 16195:if(u=i.length,u){if(u>o&&(u=o),u>h&&(u=h),0===u)break t;s.set(r.subarray(a,a+u),n),o-=u,a+=u,h-=u,n+=u,i.length-=u;break}i.mode=je;break;case 16196:for(;l<14;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}if(i.nlen=257+(31&c),c>>>=5,l-=5,i.ndist=1+(31&c),c>>>=5,l-=5,i.ncode=4+(15&c),c>>>=4,l-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=Xe;break}i.have=0,i.mode=16197;case 16197:for(;i.have<i.ncode;){for(;l<3;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}i.lens[x[i.have++]]=7&c,c>>>=3,l-=3}for(;i.have<19;)i.lens[x[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,T={bits:i.lenbits},E=De(0,i.lens,0,19,i.lencode,0,i.work,T),i.lenbits=T.bits,E){t.msg="invalid code lengths set",i.mode=Xe;break}i.have=0,i.mode=16198;case 16198:for(;i.have<i.nlen+i.ndist;){for(;v=i.lencode[c&(1<<i.lenbits)-1],g=v>>>24,m=v>>>16&255,w=65535&v,!(g<=l);){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}if(w<16)c>>>=g,l-=g,i.lens[i.have++]=w;else{if(16===w){for(R=g+2;l<R;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}if(c>>>=g,l-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=Xe;break}A=i.lens[i.have-1],u=3+(3&c),c>>>=2,l-=2}else if(17===w){for(R=g+3;l<R;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}c>>>=g,l-=g,A=0,u=3+(7&c),c>>>=3,l-=3}else{for(R=g+7;l<R;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}c>>>=g,l-=g,A=0,u=11+(127&c),c>>>=7,l-=7}if(i.have+u>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=Xe;break}for(;u--;)i.lens[i.have++]=A}}if(i.mode===Xe)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=Xe;break}if(i.lenbits=9,T={bits:i.lenbits},E=De(1,i.lens,0,i.nlen,i.lencode,0,i.work,T),i.lenbits=T.bits,E){t.msg="invalid literal/lengths set",i.mode=Xe;break}if(i.distbits=6,i.distcode=i.distdyn,T={bits:i.distbits},E=De(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,T),i.distbits=T.bits,E){t.msg="invalid distances set",i.mode=Xe;break}if(i.mode=Je,e===Pe)break t;case Je:i.mode=Ye;case Ye:if(o>=6&&h>=258){t.next_out=n,t.avail_out=h,t.next_in=a,t.avail_in=o,i.hold=c,i.bits=l,Te(t,_),n=t.next_out,s=t.output,h=t.avail_out,a=t.next_in,r=t.input,o=t.avail_in,c=i.hold,l=i.bits,i.mode===je&&(i.back=-1);break}for(i.back=0;v=i.lencode[c&(1<<i.lenbits)-1],g=v>>>24,m=v>>>16&255,w=65535&v,!(g<=l);){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}if(m&&0==(240&m)){for(y=g,b=m,S=w;v=i.lencode[S+((c&(1<<y+b)-1)>>y)],g=v>>>24,m=v>>>16&255,w=65535&v,!(y+g<=l);){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}c>>>=y,l-=y,i.back+=y}if(c>>>=g,l-=g,i.back+=g,i.length=w,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=je;break}if(64&m){t.msg="invalid literal/length code",i.mode=Xe;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(R=i.extra;l<R;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}i.length+=c&(1<<i.extra)-1,c>>>=i.extra,l-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;v=i.distcode[c&(1<<i.distbits)-1],g=v>>>24,m=v>>>16&255,w=65535&v,!(g<=l);){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}if(0==(240&m)){for(y=g,b=m,S=w;v=i.distcode[S+((c&(1<<y+b)-1)>>y)],g=v>>>24,m=v>>>16&255,w=65535&v,!(y+g<=l);){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}c>>>=y,l-=y,i.back+=y}if(c>>>=g,l-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=Xe;break}i.offset=w,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(R=i.extra;l<R;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}i.offset+=c&(1<<i.extra)-1,c>>>=i.extra,l-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=Xe;break}i.mode=16204;case 16204:if(0===h)break t;if(u=_-h,i.offset>u){if(u=i.offset-u,u>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=Xe;break}u>i.wnext?(u-=i.wnext,f=i.wsize-u):f=i.wnext-u,u>i.length&&(u=i.length),p=i.window}else p=s,f=n-i.offset,u=i.length;u>h&&(u=h),h-=u,i.length-=u;do{s[n++]=p[f++]}while(--u);0===i.length&&(i.mode=Ye);break;case 16205:if(0===h)break t;s[n++]=i.length,h--,i.mode=Ye;break;case Ve:if(i.wrap){for(;l<32;){if(0===o)break t;o--,c|=r[a++]<<l,l+=8}if(_-=h,t.total_out+=_,i.total+=_,4&i.wrap&&_&&(t.adler=i.check=i.flags?at(i.check,s,_,n-_):rt(i.check,s,_,n-_)),_=h,4&i.wrap&&(i.flags?c:Qe(c))!==i.check){t.msg="incorrect data check",i.mode=Xe;break}c=0,l=0}i.mode=16207;case 16207:if(i.wrap&&i.flags){for(;l<32;){if(0===o)break t;o--,c+=r[a++]<<l,l+=8}if(4&i.wrap&&c!==(4294967295&i.total)){t.msg="incorrect length check",i.mode=Xe;break}c=0,l=0}i.mode=16208;case 16208:E=Me;break t;case Xe:E=He;break t;case 16210:return Ze;default:return Oe}return t.next_out=n,t.avail_out=h,t.next_in=a,t.avail_in=o,i.hold=c,i.bits=l,(i.wsize||_!==t.avail_out&&i.mode<Xe&&(i.mode<Ve||e!==ze))&&li(t,t.output,t.next_out,_-t.avail_out),d-=t.avail_in,_-=t.avail_out,t.total_in+=d,t.total_out+=_,i.total+=_,4&i.wrap&&_&&(t.adler=i.check=i.flags?at(i.check,s,_,t.next_out-_):rt(i.check,s,_,t.next_out-_)),t.data_type=i.bits+(i.last?64:0)+(i.mode===je?128:0)+(i.mode===Je||i.mode===qe?256:0),(0===d&&0===_||e===ze)&&E===Fe&&(E=Ne),E},_i={inflateReset:ri,inflateReset2:si,inflateResetKeep:ii,inflateInit:t=>ai(t,15),inflateInit2:ai,inflate:di,inflateEnd:t=>{if(ei(t))return Oe;let e=t.state;return e.window&&(e.window=null),t.state=null,Fe},inflateGetHeader:(t,e)=>{if(ei(t))return Oe;const i=t.state;return 0==(2&i.wrap)?Oe:(i.head=e,e.done=!1,Fe)},inflateSetDictionary:(t,e)=>{const i=e.length;let r,s,a;return ei(t)?Oe:(r=t.state,0!==r.wrap&&r.mode!==We?Oe:r.mode===We&&(s=1,s=rt(s,e,i,0),s!==r.check)?He:(a=li(t,e,i,i),a?(r.mode=16210,Ze):(r.havedict=1,Fe)))},inflateInfo:"pako inflate (from Nodeca project)"};var ui=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const fi=Object.prototype.toString,{Z_NO_FLUSH:pi,Z_FINISH:gi,Z_OK:mi,Z_STREAM_END:wi,Z_NEED_DICT:yi,Z_STREAM_ERROR:bi,Z_DATA_ERROR:Si,Z_MEM_ERROR:Ai}=ot;function Ei(t){this.options=he.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _e,this.strm.avail_out=0;let i=_i.inflateInit2(this.strm,e.windowBits);if(i!==mi)throw new Error(nt[i]);if(this.header=new ui,_i.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=de.string2buf(e.dictionary):"[object ArrayBuffer]"===fi.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=_i.inflateSetDictionary(this.strm,e.dictionary),i!==mi)))throw new Error(nt[i])}Ei.prototype.push=function(t,e){const i=this.strm,r=this.options.chunkSize,s=this.options.dictionary;let a,n,o;if(this.ended)return!1;for(n=e===~~e?e:!0===e?gi:pi,"[object ArrayBuffer]"===fi.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),a=_i.inflate(i,n),a===yi&&s&&(a=_i.inflateSetDictionary(i,s),a===mi?a=_i.inflate(i,n):a===Si&&(a=yi));i.avail_in>0&&a===wi&&i.state.wrap>0&&0!==t[i.next_in];)_i.inflateReset(i),a=_i.inflate(i,n);switch(a){case bi:case Si:case yi:case Ai:return this.onEnd(a),this.ended=!0,!1}if(o=i.avail_out,i.next_out&&(0===i.avail_out||a===wi))if("string"===this.options.to){let t=de.utf8border(i.output,i.next_out),e=i.next_out-t,s=de.buf2string(i.output,t);i.next_out=e,i.avail_out=r-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(a!==mi||0!==o){if(a===wi)return a=_i.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ei.prototype.onData=function(t){this.chunks.push(t)},Ei.prototype.onEnd=function(t){t===mi&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=he.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var vi={Inflate:Ei};const{deflate:ki}=ve,{Inflate:Ti}=vi;var Ri,xi,Ii=ki,Bi=Ti;class Ci{constructor(t,e=!1,i=!0){this.device=t,this.tracing=e,this.slipReaderEnabled=!1,this.baudrate=0,this.traceLog="",this.lastTraceTime=Date.now(),this.buffer=new Uint8Array(0),this.SLIP_END=192,this.SLIP_ESC=219,this.SLIP_ESC_END=220,this.SLIP_ESC_ESC=221,this._DTR_state=!1,this.slipReaderEnabled=i}getInfo(){const t=this.device.getInfo();return t.usbVendorId&&t.usbProductId?`WebSerial VendorID 0x${t.usbVendorId.toString(16)} ProductID 0x${t.usbProductId.toString(16)}`:""}getPid(){return this.device.getInfo().usbProductId}trace(t){const e=`${`TRACE ${(Date.now()-this.lastTraceTime).toFixed(3)}`} ${t}`;console.log(e),this.traceLog+=e+"\n"}async returnTrace(){try{await navigator.clipboard.writeText(this.traceLog),console.log("Text copied to clipboard!")}catch(t){console.error("Failed to copy text:",t)}}hexify(t){return Array.from(t).map((t=>t.toString(16).padStart(2,"0"))).join("").padEnd(16," ")}hexConvert(t,e=!0){if(e&&t.length>16){let e="",i=t;for(;i.length>0;){const t=i.slice(0,16),r=String.fromCharCode(...t).split("").map((t=>" "===t||t>=" "&&t<="~"&&"  "!==t?t:".")).join("");i=i.slice(16),e+=`\n    ${this.hexify(t.slice(0,8))} ${this.hexify(t.slice(8))} | ${r}`}return e}return this.hexify(t)}slipWriter(t){const e=[];e.push(192);for(let i=0;i<t.length;i++)219===t[i]?e.push(219,221):192===t[i]?e.push(219,220):e.push(t[i]);return e.push(192),new Uint8Array(e)}async write(t){const e=this.slipWriter(t);if(this.device.writable){const t=this.device.writable.getWriter();this.tracing&&(console.log("Write bytes"),this.trace(`Write ${e.length} bytes: ${this.hexConvert(e)}`)),await t.write(e),t.releaseLock()}}appendArray(t,e){const i=new Uint8Array(t.length+e.length);return i.set(t),i.set(e,t.length),i}async*readLoop(t){if(this.reader)try{for(;;){const e=new Promise(((e,i)=>setTimeout((()=>i(new Error("Read timeout exceeded"))),t))),i=await Promise.race([this.reader.read(),e]);if(null===i)break;const{value:r,done:s}=i;if(s||!r)break;yield r}}catch(t){console.error("Error reading from serial port:",t)}finally{this.buffer=new Uint8Array(0)}}async newRead(t,e){if(this.buffer.length>=t){const e=this.buffer.slice(0,t);return this.buffer=this.buffer.slice(t),e}for(;this.buffer.length<t;){const t=this.readLoop(e),{value:i,done:r}=await t.next();if(r||!i)break;this.buffer=this.appendArray(this.buffer,i)}const i=this.buffer.slice(0,t);return this.buffer=this.buffer.slice(t),i}async flushInput(){var t;this.reader&&!await this.reader.closed&&(await this.reader.cancel(),this.reader.releaseLock(),this.reader=null===(t=this.device.readable)||void 0===t?void 0:t.getReader())}async flushOutput(){var t,e;this.buffer=new Uint8Array(0),await(null===(t=this.device.writable)||void 0===t?void 0:t.getWriter().close()),null===(e=this.device.writable)||void 0===e||e.getWriter().releaseLock()}inWaiting(){return this.buffer.length}detectPanicHandler(t){const e=new TextDecoder("utf-8").decode(t),i=e.match(/G?uru Meditation Error: (?:Core \d panic'ed \(([a-zA-Z ]*)\))?/)||e.match(/F?atal exception \(\d+\): (?:([a-zA-Z ]*)?.*epc)?/);if(i){const t=i[1]||i[2];throw new Error("Guru Meditation Error detected"+(t?` (${t})`:""))}}async*read(t){var e;this.reader||(this.reader=null===(e=this.device.readable)||void 0===e?void 0:e.getReader());let i=null,r=!1,s=!1;for(;;){const e=this.inWaiting(),a=await this.newRead(e>0?e:1,t);if(!a||0===a.length){const t=null===i?s?"Serial data stream stopped: Possible serial noise or corruption.":"No serial data received.":"Packet content transfer stopped";throw this.trace(t),new Error(t)}this.trace(`Read ${a.length} bytes: ${this.hexConvert(a)}`);let n=0;for(;n<a.length;){const e=a[n++];if(null===i){if(e!==this.SLIP_END){this.trace(`Read invalid data: ${this.hexConvert(a)}`);const i=await this.newRead(this.inWaiting(),t);throw this.trace(`Remaining data in serial buffer: ${this.hexConvert(i)}`),this.detectPanicHandler(new Uint8Array([...a,...i||[]])),new Error(`Invalid head of packet (0x${e.toString(16)}): Possible serial noise or corruption.`)}i=new Uint8Array(0)}else if(r)if(r=!1,e===this.SLIP_ESC_END)i=this.appendArray(i,new Uint8Array([this.SLIP_END]));else{if(e!==this.SLIP_ESC_ESC){this.trace(`Read invalid data: ${this.hexConvert(a)}`);const i=await this.newRead(this.inWaiting(),t);throw this.trace(`Remaining data in serial buffer: ${this.hexConvert(i)}`),this.detectPanicHandler(new Uint8Array([...a,...i||[]])),new Error(`Invalid SLIP escape (0xdb, 0x${e.toString(16)})`)}i=this.appendArray(i,new Uint8Array([this.SLIP_ESC]))}else e===this.SLIP_ESC?r=!0:e===this.SLIP_END?(this.trace(`Received full packet: ${this.hexConvert(i)}`),this.buffer=this.appendArray(this.buffer,a.slice(n)),yield i,i=null,s=!0):i=this.appendArray(i,new Uint8Array([e]))}}}async*rawRead(){if(this.reader)try{for(;;){const{value:t,done:e}=await this.reader.read();if(e||!t)break;this.tracing&&(console.log("Raw Read bytes"),this.trace(`Read ${t.length} bytes: ${this.hexConvert(t)}`)),yield t}}catch(t){console.error("Error reading from serial port:",t)}finally{this.buffer=new Uint8Array(0)}}async setRTS(t){await this.device.setSignals({requestToSend:t}),await this.setDTR(this._DTR_state)}async setDTR(t){this._DTR_state=t,await this.device.setSignals({dataTerminalReady:t})}async connect(t=115200,e={}){var i;await this.device.open({baudRate:t,dataBits:null==e?void 0:e.dataBits,stopBits:null==e?void 0:e.stopBits,bufferSize:null==e?void 0:e.bufferSize,parity:null==e?void 0:e.parity,flowControl:null==e?void 0:e.flowControl}),this.baudrate=t,this.reader=null===(i=this.device.readable)||void 0===i?void 0:i.getReader()}async sleep(t){return new Promise((e=>setTimeout(e,t)))}async waitForUnlock(t){for(;this.device.readable&&this.device.readable.locked||this.device.writable&&this.device.writable.locked;)await this.sleep(t)}async disconnect(){var t,e;(null===(t=this.device.readable)||void 0===t?void 0:t.locked)&&await(null===(e=this.reader)||void 0===e?void 0:e.cancel()),await this.waitForUnlock(400),await this.device.close(),this.reader=void 0}}function Di(t){return new Promise((e=>setTimeout(e,t)))}class zi{constructor(t,e){this.resetDelay=e,this.transport=t}async reset(){await this.transport.setDTR(!1),await this.transport.setRTS(!0),await Di(100),await this.transport.setDTR(!0),await this.transport.setRTS(!1),await Di(this.resetDelay),await this.transport.setDTR(!1)}}class Ui{constructor(t){this.transport=t}async reset(){await this.transport.setRTS(!1),await this.transport.setDTR(!1),await Di(100),await this.transport.setDTR(!0),await this.transport.setRTS(!1),await Di(100),await this.transport.setRTS(!0),await this.transport.setDTR(!1),await this.transport.setRTS(!0),await Di(100),await this.transport.setRTS(!1),await this.transport.setDTR(!1)}}class Pi{constructor(t,e=!1){this.transport=t,this.usingUsbOtg=e,this.transport=t}async reset(){this.usingUsbOtg?(await Di(200),await this.transport.setRTS(!1),await Di(200)):(await Di(100),await this.transport.setRTS(!1))}}class Fi{constructor(t,e){this.transport=t,this.sequenceString=e,this.transport=t}async reset(){const t={D:async t=>await this.transport.setDTR(t),R:async t=>await this.transport.setRTS(t),W:async t=>await Di(t)};try{if(!function(t){const e=["D","R","W"],i=t.split("|");for(const t of i){const i=t[0],r=t.slice(1);if(!e.includes(i))return!1;if("D"===i||"R"===i){if("0"!==r&&"1"!==r)return!1}else if("W"===i){const t=parseInt(r);if(isNaN(t)||t<=0)return!1}}return!0}(this.sequenceString))return;const e=this.sequenceString.split("|");for(const i of e){const e=i[0],r=i.slice(1);"W"===e?await t.W(Number(r)):"D"!==e&&"R"!==e||await t[e]("1"===r)}}catch(t){throw new Error("Invalid custom reset sequence")}}}var Mi=l(xi?Ri:(xi=1,Ri=function(t){return atob(t)}));async function Li(t){let e;switch(t){case"ESP32":e=await import("./c.BLbsWvxO.js");break;case"ESP32-C2":e=await import("./c.wLQhZItC.js");break;case"ESP32-C3":e=await import("./c.DmSvHQKL.js");break;case"ESP32-C5":e=await import("./c.qLfkKOM9.js");break;case"ESP32-C6":e=await import("./c.ZuxjUVr4.js");break;case"ESP32-C61":e=await import("./c.DeKkw9vN.js");break;case"ESP32-H2":e=await import("./c.CZ4EIL3w.js");break;case"ESP32-P4":e=await import("./c.BvuBbdjO.js");break;case"ESP32-S2":e=await import("./c.CrsP1231.js");break;case"ESP32-S3":e=await import("./c.CiJyd6Fk.js");break;case"ESP8266":e=await import("./c.CQFcqJ_a.js")}if(e)return{bss_start:e.bss_start,data:e.data,data_start:e.data_start,entry:e.entry,text:e.text,text_start:e.text_start,decodedData:Oi(e.data),decodedText:Oi(e.text)}}function Oi(t){const e=Mi(t).split("").map((function(t){return t.charCodeAt(0)}));return new Uint8Array(e)}function Hi(t,e,i=255){const r=t.length%e;if(0!==r){const s=new Uint8Array(e-r).fill(i),a=new Uint8Array(t.length+s.length);return a.set(t),a.set(s,t.length),a}return t}class Zi{constructor(t){var e,i,r,s,a,n,o,h;this.ESP_RAM_BLOCK=6144,this.ESP_FLASH_BEGIN=2,this.ESP_FLASH_DATA=3,this.ESP_FLASH_END=4,this.ESP_MEM_BEGIN=5,this.ESP_MEM_END=6,this.ESP_MEM_DATA=7,this.ESP_WRITE_REG=9,this.ESP_READ_REG=10,this.ESP_SPI_ATTACH=13,this.ESP_CHANGE_BAUDRATE=15,this.ESP_FLASH_DEFL_BEGIN=16,this.ESP_FLASH_DEFL_DATA=17,this.ESP_FLASH_DEFL_END=18,this.ESP_SPI_FLASH_MD5=19,this.ESP_ERASE_FLASH=208,this.ESP_ERASE_REGION=209,this.ESP_READ_FLASH=210,this.ESP_RUN_USER_CODE=211,this.ESP_IMAGE_MAGIC=233,this.ESP_CHECKSUM_MAGIC=239,this.ROM_INVALID_RECV_MSG=5,this.DEFAULT_TIMEOUT=3e3,this.ERASE_REGION_TIMEOUT_PER_MB=3e4,this.ERASE_WRITE_TIMEOUT_PER_MB=4e4,this.MD5_TIMEOUT_PER_MB=8e3,this.CHIP_ERASE_TIMEOUT=12e4,this.FLASH_READ_TIMEOUT=1e5,this.MAX_TIMEOUT=2*this.CHIP_ERASE_TIMEOUT,this.CHIP_DETECT_MAGIC_REG_ADDR=1073745920,this.DETECTED_FLASH_SIZES={18:"256KB",19:"512KB",20:"1MB",21:"2MB",22:"4MB",23:"8MB",24:"16MB"},this.DETECTED_FLASH_SIZES_NUM={18:256,19:512,20:1024,21:2048,22:4096,23:8192,24:16384},this.USB_JTAG_SERIAL_PID=4097,this.romBaudrate=115200,this.debugLogging=!1,this.syncStubDetected=!1,this.flashSizeBytes=function(t){let e=-1;return-1!==t.indexOf("KB")?e=1024*parseInt(t.slice(0,t.indexOf("KB"))):-1!==t.indexOf("MB")&&(e=1024*parseInt(t.slice(0,t.indexOf("MB")))*1024),e},this.IS_STUB=!1,this.FLASH_WRITE_SIZE=16384,this.transport=t.transport,this.baudrate=t.baudrate,this.resetConstructors={classicReset:(t,e)=>new zi(t,e),customReset:(t,e)=>new Fi(t,e),hardReset:(t,e)=>new Pi(t,e),usbJTAGSerialReset:t=>new Ui(t)},t.serialOptions&&(this.serialOptions=t.serialOptions),t.romBaudrate&&(this.romBaudrate=t.romBaudrate),t.terminal&&(this.terminal=t.terminal,this.terminal.clean()),void 0!==t.debugLogging&&(this.debugLogging=t.debugLogging),t.port&&(this.transport=new Ci(t.port)),void 0!==t.enableTracing&&(this.transport.tracing=t.enableTracing),(null===(e=t.resetConstructors)||void 0===e?void 0:e.classicReset)&&(this.resetConstructors.classicReset=null===(i=t.resetConstructors)||void 0===i?void 0:i.classicReset),(null===(r=t.resetConstructors)||void 0===r?void 0:r.customReset)&&(this.resetConstructors.customReset=null===(s=t.resetConstructors)||void 0===s?void 0:s.customReset),(null===(a=t.resetConstructors)||void 0===a?void 0:a.hardReset)&&(this.resetConstructors.hardReset=null===(n=t.resetConstructors)||void 0===n?void 0:n.hardReset),(null===(o=t.resetConstructors)||void 0===o?void 0:o.usbJTAGSerialReset)&&(this.resetConstructors.usbJTAGSerialReset=null===(h=t.resetConstructors)||void 0===h?void 0:h.usbJTAGSerialReset),this.info("esptool.js"),this.info("Serial port "+this.transport.getInfo())}_sleep(t){return new Promise((e=>setTimeout(e,t)))}write(t,e=!0){this.terminal?e?this.terminal.writeLine(t):this.terminal.write(t):console.log(t)}error(t,e=!0){this.write(`Error: ${t}`,e)}info(t,e=!0){this.write(t,e)}debug(t,e=!0){this.debugLogging&&this.write(`Debug: ${t}`,e)}_shortToBytearray(t){return new Uint8Array([255&t,t>>8&255])}_intToByteArray(t){return new Uint8Array([255&t,t>>8&255,t>>16&255,t>>24&255])}_byteArrayToShort(t,e){return t|e>>8}_byteArrayToInt(t,e,i,r){return t|e<<8|i<<16|r<<24}_appendBuffer(t,e){const i=new Uint8Array(t.byteLength+e.byteLength);return i.set(new Uint8Array(t),0),i.set(new Uint8Array(e),t.byteLength),i.buffer}_appendArray(t,e){const i=new Uint8Array(t.length+e.length);return i.set(t,0),i.set(e,t.length),i}ui8ToBstr(t){let e="";for(let i=0;i<t.length;i++)e+=String.fromCharCode(t[i]);return e}bstrToUi8(t){const e=new Uint8Array(t.length);for(let i=0;i<t.length;i++)e[i]=t.charCodeAt(i);return e}async flushInput(){try{await this.transport.flushInput()}catch(t){this.error(t.message)}}async readPacket(t=null,e=this.DEFAULT_TIMEOUT){for(let i=0;i<100;i++){const{value:i}=await this.transport.read(e).next();if(!i||i.length<8)continue;const r=i[0];if(1!==r)continue;const s=i[1],a=this._byteArrayToInt(i[4],i[5],i[6],i[7]),n=i.slice(8);if(1==r){if(null==t||s==t)return[a,n];if(0!=n[0]&&n[1]==this.ROM_INVALID_RECV_MSG)throw await this.flushInput(),new p("unsupported command error")}}throw new p("invalid response")}async command(t=null,e=new Uint8Array(0),i=0,r=!0,s=this.DEFAULT_TIMEOUT){if(null!=t){this.transport.tracing&&this.transport.trace(`command op:0x${t.toString(16).padStart(2,"0")} data len=${e.length} wait_response=${r?1:0} timeout=${(s/1e3).toFixed(3)} data=${this.transport.hexConvert(e)}`);const a=new Uint8Array(8+e.length);let n;for(a[0]=0,a[1]=t,a[2]=this._shortToBytearray(e.length)[0],a[3]=this._shortToBytearray(e.length)[1],a[4]=this._intToByteArray(i)[0],a[5]=this._intToByteArray(i)[1],a[6]=this._intToByteArray(i)[2],a[7]=this._intToByteArray(i)[3],n=0;n<e.length;n++)a[8+n]=e[n];await this.transport.write(a)}return r?this.readPacket(t,s):[0,new Uint8Array(0)]}async readReg(t,e=this.DEFAULT_TIMEOUT){const i=this._intToByteArray(t);return(await this.command(this.ESP_READ_REG,i,void 0,void 0,e))[0]}async writeReg(t,e,i=4294967295,r=0,s=0){let a=this._appendArray(this._intToByteArray(t),this._intToByteArray(e));a=this._appendArray(a,this._intToByteArray(i)),a=this._appendArray(a,this._intToByteArray(r)),s>0&&(a=this._appendArray(a,this._intToByteArray(this.chip.UART_DATE_REG_ADDR)),a=this._appendArray(a,this._intToByteArray(0)),a=this._appendArray(a,this._intToByteArray(0)),a=this._appendArray(a,this._intToByteArray(s))),await this.checkCommand("write target memory",this.ESP_WRITE_REG,a)}async sync(){this.debug("Sync");const t=new Uint8Array(36);let e;for(t[0]=7,t[1]=7,t[2]=18,t[3]=32,e=0;e<32;e++)t[4+e]=85;try{let e=await this.command(8,t,void 0,void 0,100);this.syncStubDetected=0===e[0];for(let t=0;t<7;t++)e=await this.command(),this.syncStubDetected=this.syncStubDetected&&0===e[0];return e}catch(t){throw this.debug("Sync err "+t),t}}async _connectAttempt(t="default_reset",e){this.debug("_connect_attempt "+t),e&&await e.reset();const i=this.transport.inWaiting(),r=await this.transport.newRead(i>0?i:1,this.DEFAULT_TIMEOUT),s=Array.from(r,(t=>String.fromCharCode(t))).join("").match(/boot:(0x[0-9a-fA-F]+)(.*waiting for download)?/);let a=!1,n="",o=!1;s&&(a=!0,n=s[1],o=!!s[2]);let h="";for(let t=0;t<5;t++)try{this.debug(`Sync connect attempt ${t}`);const e=await this.sync();return this.debug(e[0].toString()),"success"}catch(t){this.debug(`Error at sync ${t}`),h=t instanceof Error?t.message:"string"==typeof t?t:JSON.stringify(t)}return a&&(h=`Wrong boot mode detected (${n}).\n        This chip needs to be in download mode.`,o&&(h="Download mode successfully detected, but getting no sync reply:\n           The serial TX path seems to be down.")),h}constructResetSequence(t){if("no_reset"!==t)if("usb_reset"===t||this.transport.getPid()===this.USB_JTAG_SERIAL_PID){if(this.resetConstructors.usbJTAGSerialReset)return this.debug("using USB JTAG Serial Reset"),[this.resetConstructors.usbJTAGSerialReset(this.transport)]}else{const t=50,e=t+500;if(this.resetConstructors.classicReset)return this.debug("using Classic Serial Reset"),[this.resetConstructors.classicReset(this.transport,t),this.resetConstructors.classicReset(this.transport,e)]}return[]}async connect(t="default_reset",e=7,i=!0){let r;this.info("Connecting...",!1),await this.transport.connect(this.romBaudrate,this.serialOptions);const s=this.constructResetSequence(t);for(let i=0;i<e;i++){const e=s.length>0?s[i%s.length]:null;if(r=await this._connectAttempt(t,e),"success"===r)break}if("success"!==r)throw new p("Failed to connect with the device");if(this.debug("Connect attempt successful."),this.info("\n\r",!1),i){const t=await this.readReg(this.CHIP_DETECT_MAGIC_REG_ADDR)>>>0;this.debug("Chip Magic "+t.toString(16));const e=await async function(t){switch(t){case 15736195:{const{ESP32ROM:t}=await import("./c.BTSwh_8C.js");return new t}case 203546735:case 1867591791:case 2084675695:{const{ESP32C2ROM:t}=await import("./c.D1br4c16.js");return new t}case 1763790959:case 456216687:case 1216438383:case 1130455151:{const{ESP32C3ROM:t}=await import("./c.Ds-5ut3a.js");return new t}case 752910447:{const{ESP32C6ROM:t}=await import("./c.C9VSI3dm.js");return new t}case 606167151:case 871374959:case 1333878895:{const{ESP32C61ROM:t}=await import("./c.BCuc9iMK.js");return new t}case 285294703:case 1675706479:case 1607549039:{const{ESP32C5ROM:t}=await import("./c.Duodu5fo.js");return new t}case 3619110528:case 2548236392:{const{ESP32H2ROM:t}=await import("./c.B_knSeDg.js");return new t}case 9:{const{ESP32S3ROM:t}=await import("./c.BRQgpq1r.js");return new t}case 1990:{const{ESP32S2ROM:t}=await import("./c.D2h8fT7H.js");return new t}case 4293968129:{const{ESP8266ROM:t}=await import("./c.Cvj22hzj.js");return new t}case 0:case 182303440:case 117676761:{const{ESP32P4ROM:t}=await import("./c.By3zwmU5.js");return new t}default:return null}}(t);if(null===this.chip)throw new p(`Unexpected CHIP magic value ${t}. Failed to autodetect chip type.`);this.chip=e}}async detectChip(t="default_reset"){await this.connect(t),this.info("Detecting chip type... ",!1),null!=this.chip?this.info(this.chip.CHIP_NAME):this.info("unknown!")}async checkCommand(t="",e=null,i=new Uint8Array(0),r=0,s=this.DEFAULT_TIMEOUT){this.debug("check_command "+t);const a=await this.command(e,i,r,void 0,s);return a[1].length>4?a[1]:a[0]}async memBegin(t,e,i,r){if(this.IS_STUB){const e=r,i=r+t,s=await Li(this.chip.CHIP_NAME);if(s){const t=[[s.bss_start||s.data_start,s.data_start+s.decodedData.length],[s.text_start,s.text_start+s.decodedText.length]];for(const[r,s]of t)if(e<s&&i>r)throw new p(`Software loader is resident at 0x${r.toString(16).padStart(8,"0")}-0x${s.toString(16).padStart(8,"0")}.\n            Can't load binary at overlapping address range 0x${e.toString(16).padStart(8,"0")}-0x${i.toString(16).padStart(8,"0")}.\n            Either change binary loading address, or use the no-stub option to disable the software loader.`)}}this.debug("mem_begin "+t+" "+e+" "+i+" "+r.toString(16));let s=this._appendArray(this._intToByteArray(t),this._intToByteArray(e));s=this._appendArray(s,this._intToByteArray(i)),s=this._appendArray(s,this._intToByteArray(r)),await this.checkCommand("enter RAM download mode",this.ESP_MEM_BEGIN,s)}checksum(t,e=this.ESP_CHECKSUM_MAGIC){for(let i=0;i<t.length;i++)e^=t[i];return e}async memBlock(t,e){let i=this._appendArray(this._intToByteArray(t.length),this._intToByteArray(e));i=this._appendArray(i,this._intToByteArray(0)),i=this._appendArray(i,this._intToByteArray(0)),i=this._appendArray(i,t);const r=this.checksum(t);await this.checkCommand("write to target RAM",this.ESP_MEM_DATA,i,r)}async memFinish(t){const e=0===t?1:0,i=this._appendArray(this._intToByteArray(e),this._intToByteArray(t));await this.checkCommand("leave RAM download mode",this.ESP_MEM_END,i,void 0,200)}async flashSpiAttach(t){const e=this._intToByteArray(t);await this.checkCommand("configure SPI flash pins",this.ESP_SPI_ATTACH,e)}timeoutPerMb(t,e){const i=t*(e/1e6);return i<3e3?3e3:i}async flashBegin(t,e){const i=Math.floor((t+this.FLASH_WRITE_SIZE-1)/this.FLASH_WRITE_SIZE),r=this.chip.getEraseSize(e,t),s=new Date,a=s.getTime();let n=3e3;0==this.IS_STUB&&(n=this.timeoutPerMb(this.ERASE_REGION_TIMEOUT_PER_MB,t)),this.debug("flash begin "+r+" "+i+" "+this.FLASH_WRITE_SIZE+" "+e+" "+t);let o=this._appendArray(this._intToByteArray(r),this._intToByteArray(i));o=this._appendArray(o,this._intToByteArray(this.FLASH_WRITE_SIZE)),o=this._appendArray(o,this._intToByteArray(e)),0==this.IS_STUB&&(o=this._appendArray(o,this._intToByteArray(0))),await this.checkCommand("enter Flash download mode",this.ESP_FLASH_BEGIN,o,void 0,n);const h=s.getTime();return 0!=t&&0==this.IS_STUB&&this.info("Took "+(h-a)/1e3+"."+(h-a)%1e3+"s to erase flash block"),i}async flashDeflBegin(t,e,i){const r=Math.floor((e+this.FLASH_WRITE_SIZE-1)/this.FLASH_WRITE_SIZE),s=Math.floor((t+this.FLASH_WRITE_SIZE-1)/this.FLASH_WRITE_SIZE),a=new Date,n=a.getTime();let o,h;this.IS_STUB?(o=t,h=this.DEFAULT_TIMEOUT):(o=s*this.FLASH_WRITE_SIZE,h=this.timeoutPerMb(this.ERASE_REGION_TIMEOUT_PER_MB,o)),this.info("Compressed "+t+" bytes to "+e+"...");let c=this._appendArray(this._intToByteArray(o),this._intToByteArray(r));c=this._appendArray(c,this._intToByteArray(this.FLASH_WRITE_SIZE)),c=this._appendArray(c,this._intToByteArray(i)),"ESP32-S2"!==this.chip.CHIP_NAME&&"ESP32-S3"!==this.chip.CHIP_NAME&&"ESP32-C3"!==this.chip.CHIP_NAME&&"ESP32-C2"!==this.chip.CHIP_NAME||!1!==this.IS_STUB||(c=this._appendArray(c,this._intToByteArray(0))),await this.checkCommand("enter compressed flash mode",this.ESP_FLASH_DEFL_BEGIN,c,void 0,h);const l=a.getTime();return 0!=t&&!1===this.IS_STUB&&this.info("Took "+(l-n)/1e3+"."+(l-n)%1e3+"s to erase flash block"),r}async flashBlock(t,e,i){let r=this._appendArray(this._intToByteArray(t.length),this._intToByteArray(e));r=this._appendArray(r,this._intToByteArray(0)),r=this._appendArray(r,this._intToByteArray(0)),r=this._appendArray(r,t);const s=this.checksum(t);await this.checkCommand("write to target Flash after seq "+e,this.ESP_FLASH_DATA,r,s,i)}async flashDeflBlock(t,e,i){let r=this._appendArray(this._intToByteArray(t.length),this._intToByteArray(e));r=this._appendArray(r,this._intToByteArray(0)),r=this._appendArray(r,this._intToByteArray(0)),r=this._appendArray(r,t);const s=this.checksum(t);this.debug("flash_defl_block "+t[0].toString(16)+" "+t[1].toString(16)),await this.checkCommand("write compressed data to flash after seq "+e,this.ESP_FLASH_DEFL_DATA,r,s,i)}async flashFinish(t=!1){const e=t?0:1,i=this._intToByteArray(e);await this.checkCommand("leave Flash mode",this.ESP_FLASH_END,i)}async flashDeflFinish(t=!1){const e=t?0:1,i=this._intToByteArray(e);await this.checkCommand("leave compressed flash mode",this.ESP_FLASH_DEFL_END,i)}async runSpiflashCommand(t,e,i){const r=this.chip.SPI_REG_BASE,s=r+0,a=r+this.chip.SPI_USR_OFFS,n=r+this.chip.SPI_USR1_OFFS,o=r+this.chip.SPI_USR2_OFFS,h=r+this.chip.SPI_W0_OFFS;let c;c=null!=this.chip.SPI_MOSI_DLEN_OFFS?async(t,e)=>{const i=r+this.chip.SPI_MOSI_DLEN_OFFS,s=r+this.chip.SPI_MISO_DLEN_OFFS;t>0&&await this.writeReg(i,t-1),e>0&&await this.writeReg(s,e-1)}:async(t,e)=>{const i=n,r=(0===e?0:e-1)<<8|(0===t?0:t-1)<<17;await this.writeReg(i,r)};const l=1<<18;if(i>32)throw new p("Reading more than 32 bits back from a SPI flash operation is unsupported");if(e.length>64)throw new p("Writing more than 64 bytes of data with one SPI command is unsupported");const d=8*e.length,_=await this.readReg(a),u=await this.readReg(o);let f,g=1<<31;i>0&&(g|=268435456),d>0&&(g|=134217728),await c(d,i),await this.writeReg(a,g);let m=7<<28|t;if(await this.writeReg(o,m),0==d)await this.writeReg(h,0);else{if(e.length%4!=0){const t=new Uint8Array(e.length%4);e=this._appendArray(e,t)}let t=h;for(f=0;f<e.length-4;f+=4)m=this._byteArrayToInt(e[f],e[f+1],e[f+2],e[f+3]),await this.writeReg(t,m),t+=4}for(await this.writeReg(s,l),f=0;f<10&&(m=await this.readReg(s)&l,0!=m);f++);if(10===f)throw new p("SPI command did not complete in time");const w=await this.readReg(h);return await this.writeReg(a,_),await this.writeReg(o,u),w}async readFlashId(){const t=new Uint8Array(0);return await this.runSpiflashCommand(159,t,24)}async eraseFlash(){this.info("Erasing flash (this may take a while)...");let t=new Date;const e=t.getTime(),i=await this.checkCommand("erase flash",this.ESP_ERASE_FLASH,void 0,void 0,this.CHIP_ERASE_TIMEOUT);t=new Date;const r=t.getTime();return this.info("Chip erase completed successfully in "+(r-e)/1e3+"s"),i}toHex(t){return Array.prototype.map.call(t,(t=>("00"+t.toString(16)).slice(-2))).join("")}async flashMd5sum(t,e){const i=this.timeoutPerMb(this.MD5_TIMEOUT_PER_MB,e);let r=this._appendArray(this._intToByteArray(t),this._intToByteArray(e));r=this._appendArray(r,this._intToByteArray(0)),r=this._appendArray(r,this._intToByteArray(0));let s=await this.checkCommand("calculate md5sum",this.ESP_SPI_FLASH_MD5,r,void 0,i);s instanceof Uint8Array&&s.length>16&&(s=s.slice(0,16));return this.toHex(s)}async readFlash(t,e,i=null){let r=this._appendArray(this._intToByteArray(t),this._intToByteArray(e));r=this._appendArray(r,this._intToByteArray(4096)),r=this._appendArray(r,this._intToByteArray(1024));const s=await this.checkCommand("read flash",this.ESP_READ_FLASH,r);if(0!=s)throw new p("Failed to read memory: "+s);let a=new Uint8Array(0);for(;a.length<e;){const{value:t}=await this.transport.read(this.FLASH_READ_TIMEOUT).next();if(!(t instanceof Uint8Array))throw new p("Failed to read memory: "+t);t.length>0&&(a=this._appendArray(a,t),await this.transport.write(this._intToByteArray(a.length)),i&&i(t,a.length,e))}return a}async runStub(){if(this.syncStubDetected)return this.info("Stub is already running. No upload is necessary."),this.chip;this.info("Uploading stub...");const t=await Li(this.chip.CHIP_NAME);if(void 0===t)throw this.debug("Error loading Stub json"),new Error("Error loading Stub json");const e=[t.decodedText,t.decodedData];for(let i=0;i<e.length;i++)if(e[i]){const r=0===i?t.text_start:t.data_start,s=e[i].length,a=Math.floor((s+this.ESP_RAM_BLOCK-1)/this.ESP_RAM_BLOCK);await this.memBegin(s,a,this.ESP_RAM_BLOCK,r);for(let t=0;t<a;t++){const r=t*this.ESP_RAM_BLOCK,s=r+this.ESP_RAM_BLOCK;await this.memBlock(e[i].slice(r,s),t)}}this.info("Running stub..."),await this.memFinish(t.entry);const{value:i}=await this.transport.read(this.DEFAULT_TIMEOUT).next(),r=String.fromCharCode(...i);if("OHAI"!==r)throw new p(`Failed to start stub. Unexpected response ${r}`);return this.info("Stub running..."),this.IS_STUB=!0,this.chip}async changeBaud(){this.info("Changing baudrate to "+this.baudrate);const t=this.IS_STUB?this.romBaudrate:0,e=this._appendArray(this._intToByteArray(this.baudrate),this._intToByteArray(t));await this.command(this.ESP_CHANGE_BAUDRATE,e),this.info("Changed"),await this.transport.disconnect(),await this._sleep(50),await this.transport.connect(this.baudrate,this.serialOptions)}async main(t="default_reset"){await this.detectChip(t);const e=await this.chip.getChipDescription(this);return this.info("Chip is "+e),this.info("Features: "+await this.chip.getChipFeatures(this)),this.info("Crystal is "+await this.chip.getCrystalFreq(this)+"MHz"),this.info("MAC: "+await this.chip.readMac(this)),await this.chip.readMac(this),void 0!==this.chip.postConnect&&await this.chip.postConnect(this),await this.runStub(),this.romBaudrate!==this.baudrate&&await this.changeBaud(),e}parseFlashSizeArg(t){if(void 0===this.chip.FLASH_SIZES[t])throw new p("Flash size "+t+" is not supported by this chip type. Supported sizes: "+this.chip.FLASH_SIZES);return this.chip.FLASH_SIZES[t]}_updateImageFlashParams(t,e,i,r,s){if(this.debug("_update_image_flash_params "+i+" "+r+" "+s),t.length<8)return t;if(e!=this.chip.BOOTLOADER_FLASH_OFFSET)return t;if("keep"===i&&"keep"===r&&"keep"===s)return this.info("Not changing the image"),t;const a=parseInt(t[0]);let n=parseInt(t[2]);const o=parseInt(t[3]);if(a!==this.ESP_IMAGE_MAGIC)return this.info("Warning: Image file at 0x"+e.toString(16)+" doesn't look like an image file, so not changing any flash settings."),t;if("keep"!==r){n={qio:0,qout:1,dio:2,dout:3}[r]}let h=15&o;if("keep"!==s){h={"40m":0,"26m":1,"20m":2,"80m":15}[s]}let c=240&o;"keep"!==i&&(c=this.parseFlashSizeArg(i));const l=n<<8|h+c;return this.info("Flash params set to "+l.toString(16)),parseInt(t[2])!==n<<8&&(t=t.substring(0,2)+(n<<8).toString()+t.substring(3)),parseInt(t[3])!==h+c&&(t=t.substring(0,3)+(h+c).toString()+t.substring(4)),t}async writeFlash(t){if(this.debug("EspLoader program"),"keep"!==t.flashSize){const e=this.flashSizeBytes(t.flashSize);for(let i=0;i<t.fileArray.length;i++)if(t.fileArray[i].data.length+t.fileArray[i].address>e)throw new p(`File ${i+1} doesn't fit in the available flash`)}let e,i;!0===this.IS_STUB&&!0===t.eraseAll&&await this.eraseFlash();for(let r=0;r<t.fileArray.length;r++){if(this.debug("Data Length "+t.fileArray[r].data.length),e=t.fileArray[r].data,this.debug("Image Length "+e.length),0===e.length){this.debug("Warning: File is empty");continue}e=this.ui8ToBstr(Hi(this.bstrToUi8(e),4)),i=t.fileArray[r].address,e=this._updateImageFlashParams(e,i,t.flashSize,t.flashMode,t.flashFreq);let s=null;t.calculateMD5Hash&&(s=t.calculateMD5Hash(e),this.debug("Image MD5 "+s));const a=e.length;let n;if(t.compress){const t=this.bstrToUi8(e);e=this.ui8ToBstr(Ii(t,{level:9})),n=await this.flashDeflBegin(a,e.length,i)}else n=await this.flashBegin(a,i);let o=0,h=0;const c=e.length;t.reportProgress&&t.reportProgress(r,0,c);let l=new Date;const d=l.getTime();let _=5e3;const u=new Bi({chunkSize:1});let f=0;for(u.onData=function(t){f+=t.byteLength};e.length>0;){this.debug("Write loop "+i+" "+o+" "+n),this.info("Writing at 0x"+(i+f).toString(16)+"... ("+Math.floor(100*(o+1)/n)+"%)");const s=this.bstrToUi8(e.slice(0,this.FLASH_WRITE_SIZE));if(!t.compress)throw new p("Yet to handle Non Compressed writes");{const t=f;u.push(s,!1);const e=f-t;let i=3e3;this.timeoutPerMb(this.ERASE_WRITE_TIMEOUT_PER_MB,e)>3e3&&(i=this.timeoutPerMb(this.ERASE_WRITE_TIMEOUT_PER_MB,e)),!1===this.IS_STUB&&(_=i),await this.flashDeflBlock(s,o,_),this.IS_STUB&&(_=i)}h+=s.length,e=e.slice(this.FLASH_WRITE_SIZE,e.length),o++,t.reportProgress&&t.reportProgress(r,h,c)}this.IS_STUB&&await this.readReg(this.CHIP_DETECT_MAGIC_REG_ADDR,_),l=new Date;const g=l.getTime()-d;if(t.compress&&this.info("Wrote "+a+" bytes ("+h+" compressed) at 0x"+i.toString(16)+" in "+g/1e3+" seconds."),s){const t=await this.flashMd5sum(i,a);if(new String(t).valueOf()!=new String(s).valueOf())throw this.info("File  md5: "+s),this.info("Flash md5: "+t),new p("MD5 of file does not match data in flash!");this.info("Hash of data verified.")}}this.info("Leaving..."),this.IS_STUB&&(await this.flashBegin(0,0),t.compress?await this.flashDeflFinish():await this.flashFinish())}async flashId(){this.debug("flash_id");const t=await this.readFlashId();this.info("Manufacturer: "+(255&t).toString(16));const e=t>>16&255;this.info("Device: "+(t>>8&255).toString(16)+e.toString(16)),this.info("Detected flash size: "+this.DETECTED_FLASH_SIZES[e])}async getFlashSize(){this.debug("flash_id");const t=await this.readFlashId()>>16&255;return this.DETECTED_FLASH_SIZES_NUM[t]}async softReset(t){if(this.IS_STUB){if("ESP8266"!=this.chip.CHIP_NAME)throw new p("Soft resetting is currently only supported on ESP8266");t?(await this.flashBegin(0,0),await this.flashFinish(!0)):await this.command(this.ESP_RUN_USER_CODE,void 0,void 0,!1)}else{if(t)return;await this.flashBegin(0,0),await this.flashFinish(!1)}}async after(t="hard_reset",e){switch(t){case"hard_reset":if(this.resetConstructors.hardReset){this.info("Hard resetting via RTS pin...");const t=this.resetConstructors.hardReset(this.transport,e);await t.reset()}break;case"soft_reset":this.info("Soft resetting..."),await this.softReset(!1);break;case"no_reset_stub":this.info("Staying in flasher stub.");break;default:this.info("Staying in bootloader."),this.IS_STUB&&this.softReset(!0)}}}const Ni=t=>{const e=new Ci(t);return new Zi({transport:e,baudrate:115200,romBaudrate:115200,enableTracing:!1})};export{Ni as c,f as o};
//# sourceMappingURL=c.BXDUBjgp.js.map
