@genome-spy/app 0.60.0 → 0.60.1

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/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  \r]`),n=e.charCodeAt(0);function r(f,h){var d,p,m=i(f,function(b,g){if(d)return d(b,g-1);p=b,d=h?F8(b,h):wy(b)});return m.columns=p||[],m}function i(f,h){var d=[],p=f.length,m=0,b=0,g,y=p<=0,v=!1;f.charCodeAt(p-1)===yl&&--p,f.charCodeAt(p-1)===e0&&--p;function w(){if(y)return Kd;if(v)return v=!1,yy;var E,k=m,M;if(f.charCodeAt(k)===Jd){for(;m++<p&&f.charCodeAt(m)!==Jd||f.charCodeAt(++m)===Jd;);return(E=m)>=p?y=!0:(M=f.charCodeAt(m++))===yl?v=!0:M===e0&&(v=!0,f.charCodeAt(m)===yl&&++m),f.slice(k+1,E-1).replace(/""/g,'"')}for(;m<p;){if((M=f.charCodeAt(E=m++))===yl)v=!0;else if(M===e0)v=!0,f.charCodeAt(m)===yl&&++m;else if(M!==n)continue;return f.slice(k,E)}return y=!0,f.slice(k,p)}for(;(g=w())!==Kd;){for(var S=[];g!==yy&&g!==Kd;)S.push(g),g=w();h&&(S=h(S,b++))==null||d.push(S)}return d}function o(f,h){return f.map(function(d){return h.map(function(p){return u(d[p])}).join(e)})}function s(f,h){return h==null&&(h=vy(f)),[h.map(u).join(e)].concat(o(f,h)).join(`
3
3
  `)}function a(f,h){return h==null&&(h=vy(f)),o(f,h).join(`
4
4
  `)}function l(f){return f.map(c).join(`
5
- `)}function c(f){return f.map(u).join(e)}function u(f){return f==null?"":f instanceof Date?P8(f):t.test(f+="")?'"'+f.replace(/"/g,'""')+'"':f}return{parse:r,parseRows:i,format:s,formatBody:a,formatRows:l,formatRow:c,formatValue:u}}var O8=xy(" "),L8=O8.parseRows;function N8(e){return e}function z8(e){if(e==null)return N8;var t,n,r=e.scale[0],i=e.scale[1],o=e.translate[0],s=e.translate[1];return function(a,l){l||(t=n=0);var c=2,u=a.length,f=new Array(u);for(f[0]=(t+=a[0])*r+o,f[1]=(n+=a[1])*i+s;c<u;)f[c]=a[c],++c;return f}}function U8(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}function H8(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return Ay(e,n)})}:Ay(e,t)}function Ay(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,o=Ey(e,t);return n==null&&r==null?{type:"Feature",properties:i,geometry:o}:r==null?{type:"Feature",id:n,properties:i,geometry:o}:{type:"Feature",id:n,bbox:r,properties:i,geometry:o}}function Ey(e,t){var n=z8(e.transform),r=e.arcs;function i(u,f){f.length&&f.pop();for(var h=r[u<0?~u:u],d=0,p=h.length;d<p;++d)f.push(n(h[d],d));u<0&&U8(f,p)}function o(u){return n(u)}function s(u){for(var f=[],h=0,d=u.length;h<d;++h)i(u[h],f);return f.length<2&&f.push(f[0]),f}function a(u){for(var f=s(u);f.length<4;)f.push(f[0]);return f}function l(u){return u.map(a)}function c(u){var f=u.type,h;switch(f){case"GeometryCollection":return{type:f,geometries:u.geometries.map(c)};case"Point":h=o(u.coordinates);break;case"MultiPoint":h=u.coordinates.map(o);break;case"LineString":h=s(u.arcs);break;case"MultiLineString":h=u.arcs.map(s);break;case"Polygon":h=l(u.arcs);break;case"MultiPolygon":h=u.arcs.map(l);break;default:return null}return{type:f,coordinates:h}}return c(t)}function G8(e,t){var n={},r={},i={},o=[],s=-1;t.forEach(function(c,u){var f=e.arcs[c<0?~c:c],h;f.length<3&&!f[1][0]&&!f[1][1]&&(h=t[++s],t[s]=c,t[u]=h)}),t.forEach(function(c){var u=a(c),f=u[0],h=u[1],d,p;if(d=i[f])if(delete i[d.end],d.push(c),d.end=h,p=r[h]){delete r[p.start];var m=p===d?d:d.concat(p);r[m.start=d.start]=i[m.end=p.end]=m}else r[d.start]=i[d.end]=d;else if(d=r[h])if(delete r[d.start],d.unshift(c),d.start=f,p=i[f]){delete i[p.end];var b=p===d?d:p.concat(d);r[b.start=p.start]=i[b.end=d.end]=b}else r[d.start]=i[d.end]=d;else d=[c],r[d.start=f]=i[d.end=h]=d});function a(c){var u=e.arcs[c<0?~c:c],f=u[0],h;return e.transform?(h=[0,0],u.forEach(function(d){h[0]+=d[0],h[1]+=d[1]})):h=u[u.length-1],c<0?[h,f]:[f,h]}function l(c,u){for(var f in c){var h=c[f];delete u[h.start],delete h.start,delete h.end,h.forEach(function(d){n[d<0?~d:d]=1}),o.push(h)}}return l(i,r),l(r,i),t.forEach(function(c){n[c<0?~c:c]||o.push([c])}),o}function j8(e){return Ey(e,V8.apply(this,arguments))}function V8(e,t,n){var r,i,o;if(arguments.length>1)r=q8(e,t,n);else for(i=0,r=new Array(o=e.arcs.length);i<o;++i)r[i]=i;return{type:"MultiLineString",arcs:G8(e,r)}}function q8(e,t,n){var r=[],i=[],o;function s(f){var h=f<0?~f:f;(i[h]||(i[h]=[])).push({i:f,g:o})}function a(f){f.forEach(s)}function l(f){f.forEach(a)}function c(f){f.forEach(l)}function u(f){switch(o=f,f.type){case"GeometryCollection":f.geometries.forEach(u);break;case"LineString":a(f.arcs);break;case"MultiLineString":case"Polygon":l(f.arcs);break;case"MultiPolygon":c(f.arcs);break}}return u(t),i.forEach(n==null?function(f){r.push(f[0].i)}:function(f){n(f[0].g,f[f.length-1].g)&&r.push(f[0].i)}),r}function wo(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function $8(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Ds(e){let t,n,r;e.length!==2?(t=wo,n=(a,l)=>wo(e(a),l),r=(a,l)=>e(a)-l):(t=e===wo||e===$8?e:W8,n=e,r=e);function i(a,l,c=0,u=a.length){if(c<u){if(t(l,l)!==0)return u;do{const f=c+u>>>1;n(a[f],l)<0?c=f+1:u=f}while(c<u)}return c}function o(a,l,c=0,u=a.length){if(c<u){if(t(l,l)!==0)return u;do{const f=c+u>>>1;n(a[f],l)<=0?c=f+1:u=f}while(c<u)}return c}function s(a,l,c=0,u=a.length){const f=i(a,l,c,u-1);return f>c&&r(a[f-1],l)>-r(a[f],l)?f-1:f}return{left:i,center:s,right:o}}function W8(){return 0}function Sy(e){return e===null?NaN:+e}function*Y8(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}const Cy=Ds(wo),Ur=Cy.right;Cy.left,Ds(Sy).center;function ky(e,t){let n=0;if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(i=+i)>=i&&++n}return n}function Q8(e,t){let n=0,r,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,o+=r*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(r=a-i,i+=r/++n,o+=r*(a-i))}if(n>1)return o/(n-1)}function Ju(e,t){let n,r;if(t===void 0)for(const i of e)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)));else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(n===void 0?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)))}return[n,r]}class Hr extends Map{constructor(t,n=K8){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(Ty(this,t))}has(t){return super.has(Ty(this,t))}set(t,n){return super.set(Z8(this,t),n)}delete(t){return super.delete(X8(this,t))}}function Ty({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Z8({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function X8({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function K8(e){return e!==null&&typeof e=="object"?e.valueOf():e}function wl(e){return e}function vl(e,...t){return t0(e,wl,wl,t)}function J8(e,...t){return t0(e,Array.from,wl,t)}function eT(e,t,...n){return t0(e,wl,t,n)}function t0(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);const a=new Hr,l=r[s++];let c=-1;for(const u of o){const f=l(u,++c,o),h=a.get(f);h?h.push(u):a.set(f,[u])}for(const[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function tT(e,t){return Array.from(t,n=>e[n])}function nT(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[n]=t;if(n&&n.length!==2||t.length>1){const r=Uint32Array.from(e,(i,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),r.sort((i,o)=>{for(const s of t){const a=ef(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>ef(n[i],n[o]))),tT(e,r)}return e.sort(Iy(n))}function Iy(e=wo){if(e===wo)return ef;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function ef(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}var rT=Array.prototype,iT=rT.slice;function n0(e){return()=>e}const oT=Math.sqrt(50),sT=Math.sqrt(10),aT=Math.sqrt(2);function tf(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=oT?10:o>=sT?5:o>=aT?2:1;let a,l,c;return i<0?(c=Math.pow(10,-i)/s,a=Math.round(e*c),l=Math.round(t*c),a/c<e&&++a,l/c>t&&--l,c=-c):(c=Math.pow(10,i)*s,a=Math.round(e/c),l=Math.round(t/c),a*c<e&&++a,l*c>t&&--l),l<a&&.5<=n&&n<2?tf(e,t,n*2):[a,l,c]}function xl(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const r=t<e,[i,o,s]=r?tf(t,e,n):tf(e,t,n);if(!(o>=i))return[];const a=o-i+1,l=new Array(a);if(r)if(s<0)for(let c=0;c<a;++c)l[c]=(o-c)/-s;else for(let c=0;c<a;++c)l[c]=(o-c)*s;else if(s<0)for(let c=0;c<a;++c)l[c]=(i+c)/-s;else for(let c=0;c<a;++c)l[c]=(i+c)*s;return l}function Rs(e,t,n){return t=+t,e=+e,n=+n,tf(e,t,n)[2]}function vo(e,t,n){t=+t,e=+e,n=+n;const r=t<e,i=r?Rs(t,e,n):Rs(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function lT(e,t,n){let r;for(;;){const i=Rs(e,t,n);if(i===r||i===0||!isFinite(i))return[e,t];i>0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}function cT(e){return Math.max(1,Math.ceil(Math.log(ky(e))/Math.LN2)+1)}function uT(){var e=wl,t=Ju,n=cT;function r(i){Array.isArray(i)||(i=Array.from(i));var o,s=i.length,a,l,c=new Array(s);for(o=0;o<s;++o)c[o]=e(i[o],o,i);var u=t(c),f=u[0],h=u[1],d=n(c,f,h);if(!Array.isArray(d)){const v=h,w=+d;if(t===Ju&&([f,h]=lT(f,h,w)),d=xl(f,h,w),d[0]<=f&&(l=Rs(f,h,w)),d[d.length-1]>=h)if(v>=h&&t===Ju){const S=Rs(f,h,w);isFinite(S)&&(S>0?h=(Math.floor(h/S)+1)*S:S<0&&(h=(Math.ceil(h*-S)+1)/-S))}else d.pop()}for(var p=d.length,m=0,b=p;d[m]<=f;)++m;for(;d[b-1]>h;)--b;(m||b<p)&&(d=d.slice(m,b),p=b-m);var g=new Array(p+1),y;for(o=0;o<=p;++o)y=g[o]=[],y.x0=o>0?d[o-1]:f,y.x1=o<p?d[o]:h;if(isFinite(l)){if(l>0)for(o=0;o<s;++o)(a=c[o])!=null&&f<=a&&a<=h&&g[Math.min(p,Math.floor((a-f)/l))].push(i[o]);else if(l<0){for(o=0;o<s;++o)if((a=c[o])!=null&&f<=a&&a<=h){const v=Math.floor((f-a)*l);g[Math.min(p,v+(d[v]<=a))].push(i[o])}}}else for(o=0;o<s;++o)(a=c[o])!=null&&f<=a&&a<=h&&g[Ur(d,a,0,p)].push(i[o]);return g}return r.value=function(i){return arguments.length?(e=typeof i=="function"?i:n0(i),r):e},r.domain=function(i){return arguments.length?(t=typeof i=="function"?i:n0([i[0],i[1]]),r):t},r.thresholds=function(i){return arguments.length?(n=typeof i=="function"?i:n0(Array.isArray(i)?iT.call(i):i),r):n},r}function r0(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function i0(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function _y(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?ef:Iy(i);r>n;){if(r-n>600){const l=r-n+1,c=t-n+1,u=Math.log(l),f=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),d=Math.max(n,Math.floor(t-c*f/l+h)),p=Math.min(r,Math.floor(t+(l-c)*f/l+h));_y(e,t,d,p,i)}const o=e[t];let s=n,a=r;for(Al(e,n,t),i(e[r],o)>0&&Al(e,n,r);s<a;){for(Al(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?Al(e,n,a):(++a,Al(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function Al(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function fT(e,t,n){if(e=Float64Array.from(Y8(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return i0(e);if(t>=1)return r0(e);var r,i=(r-1)*t,o=Math.floor(i),s=r0(_y(e,o).subarray(0,o+1)),a=i0(e.subarray(o+1));return s+(a-s)*(i-o)}}function o0(e,t,n=Sy){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,o=Math.floor(i),s=+n(e[o],o,e),a=+n(e[o+1],o+1,e);return s+(a-s)*(i-o)}}function hT(e,t){let n=0,r=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&(++n,r+=i);else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n}function dT(e,t){return fT(e,.5,t)}function wi(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r<i;)o[r]=e+r*n;return o}function El(e,t){let n=0;if(t===void 0)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function pT(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function nf(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Bs(e){return e=nf(Math.abs(e)),e?e[1]:NaN}function gT(e,t){return function(n,r){for(var i=n.length,o=[],s=0,a=e[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),o.push(n.substring(i-=a,i+a)),!((l+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function mT(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var bT=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Fs(e){if(!(t=bT.exec(e)))throw new Error("invalid format: "+e);var t;return new s0({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Fs.prototype=s0.prototype;function s0(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}s0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function yT(e){e:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+e[n])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Dy;function wT(e,t){var n=nf(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(Dy=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+nf(e,Math.max(0,t+o-1))[0]}function Ry(e,t){var n=nf(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const By={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:pT,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Ry(e*100,t),r:Ry,s:wT,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Fy(e){return e}var My=Array.prototype.map,Py=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function vT(e){var t=e.grouping===void 0||e.thousands===void 0?Fy:gT(My.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?Fy:mT(My.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"−":e.minus+"",l=e.nan===void 0?"NaN":e.nan+"";function c(f){f=Fs(f);var h=f.fill,d=f.align,p=f.sign,m=f.symbol,b=f.zero,g=f.width,y=f.comma,v=f.precision,w=f.trim,S=f.type;S==="n"?(y=!0,S="g"):By[S]||(v===void 0&&(v=12),w=!0,S="g"),(b||h==="0"&&d==="=")&&(b=!0,h="0",d="=");var E=m==="$"?n:m==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",k=m==="$"?r:/[%p]/.test(S)?s:"",M=By[S],D=/[defgprs%]/.test(S);v=v===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v));function B(I){var q=E,Z=k,ne,J,ce;if(S==="c")Z=M(I)+Z,I="";else{I=+I;var ae=I<0||1/I<0;if(I=isNaN(I)?l:M(Math.abs(I),v),w&&(I=yT(I)),ae&&+I==0&&p!=="+"&&(ae=!1),q=(ae?p==="("?p:a:p==="-"||p==="("?"":p)+q,Z=(S==="s"?Py[8+Dy/3]:"")+Z+(ae&&p==="("?")":""),D){for(ne=-1,J=I.length;++ne<J;)if(ce=I.charCodeAt(ne),48>ce||ce>57){Z=(ce===46?i+I.slice(ne+1):I.slice(ne))+Z,I=I.slice(0,ne);break}}}y&&!b&&(I=t(I,1/0));var we=q.length+I.length+Z.length,me=we<g?new Array(g-we+1).join(h):"";switch(y&&b&&(I=t(me+I,me.length?g-Z.length:1/0),me=""),d){case"<":I=q+I+Z+me;break;case"=":I=q+me+I+Z;break;case"^":I=me.slice(0,we=me.length>>1)+q+I+Z+me.slice(we);break;default:I=me+q+I+Z;break}return o(I)}return B.toString=function(){return f+""},B}function u(f,h){var d=c((f=Fs(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(Bs(h)/3)))*3,m=Math.pow(10,-p),b=Py[8+p/3];return function(g){return d(m*g)+b}}return{format:c,formatPrefix:u}}var rf,Ft,Oy;xT({thousands:",",grouping:[3],currency:["$",""]});function xT(e){return rf=vT(e),Ft=rf.format,Oy=rf.formatPrefix,rf}function AT(e){return Math.max(0,-Bs(Math.abs(e)))}function ET(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Bs(t)/3)))*3-Bs(Math.abs(e)))}function ST(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Bs(t)-Bs(e))+1}const a0=new Date,l0=new Date;function Mt(e,t,n,r){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{const s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{const l=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return l;let c;do l.push(c=new Date(+o)),t(o,a),e(o);while(c<o&&o<s);return l},i.filter=o=>Mt(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),n&&(i.count=(o,s)=>(a0.setTime(+o),l0.setTime(+s),e(a0),e(l0),Math.floor(n(a0,l0))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?s=>r(s)%o===0:s=>i.count(0,s)%o===0):i)),i}const Ms=Mt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Ms.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Mt(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Ms),Ms.range;const Gr=1e3,Ln=Gr*60,jr=Ln*60,Vr=jr*24,c0=Vr*7,Ly=Vr*30,u0=Vr*365,qr=Mt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Gr)},(e,t)=>(t-e)/Gr,e=>e.getUTCSeconds());qr.range;const of=Mt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Gr)},(e,t)=>{e.setTime(+e+t*Ln)},(e,t)=>(t-e)/Ln,e=>e.getMinutes());of.range;const sf=Mt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Ln)},(e,t)=>(t-e)/Ln,e=>e.getUTCMinutes());sf.range;const af=Mt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Gr-e.getMinutes()*Ln)},(e,t)=>{e.setTime(+e+t*jr)},(e,t)=>(t-e)/jr,e=>e.getHours());af.range;const lf=Mt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*jr)},(e,t)=>(t-e)/jr,e=>e.getUTCHours());lf.range;const vi=Mt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Ln)/Vr,e=>e.getDate()-1);vi.range;const xo=Mt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Vr,e=>e.getUTCDate()-1);xo.range;const Ny=Mt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Vr,e=>Math.floor(e/Vr));Ny.range;function Ao(e){return Mt(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Ln)/c0)}const Sl=Ao(0),cf=Ao(1),CT=Ao(2),kT=Ao(3),Ps=Ao(4),TT=Ao(5),IT=Ao(6);Sl.range,cf.range,CT.range,kT.range,Ps.range,TT.range,IT.range;function Eo(e){return Mt(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/c0)}const Cl=Eo(0),uf=Eo(1),_T=Eo(2),DT=Eo(3),Os=Eo(4),RT=Eo(5),BT=Eo(6);Cl.range,uf.range,_T.range,DT.range,Os.range,RT.range,BT.range;const kl=Mt(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());kl.range;const Tl=Mt(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Tl.range;const yr=Mt(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());yr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Mt(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),yr.range;const wr=Mt(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());wr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Mt(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),wr.range;function zy(e,t,n,r,i,o){const s=[[qr,1,Gr],[qr,5,5*Gr],[qr,15,15*Gr],[qr,30,30*Gr],[o,1,Ln],[o,5,5*Ln],[o,15,15*Ln],[o,30,30*Ln],[i,1,jr],[i,3,3*jr],[i,6,6*jr],[i,12,12*jr],[r,1,Vr],[r,2,2*Vr],[n,1,c0],[t,1,Ly],[t,3,3*Ly],[e,1,u0]];function a(c,u,f){const h=u<c;h&&([c,u]=[u,c]);const d=f&&typeof f.range=="function"?f:l(c,u,f),p=d?d.range(c,+u+1):[];return h?p.reverse():p}function l(c,u,f){const h=Math.abs(u-c)/f,d=Ds(([,,b])=>b).right(s,h);if(d===s.length)return e.every(vo(c/u0,u/u0,f));if(d===0)return Ms.every(Math.max(vo(c,u,f),1));const[p,m]=s[h/s[d-1][2]<s[d][2]/h?d-1:d];return p.every(m)}return[a,l]}const[FT,MT]=zy(wr,Tl,Cl,Ny,lf,sf),[PT,OT]=zy(yr,kl,Sl,vi,af,of),Il="year",_l="quarter",Dl="month",Rl="week",Bl="date",ff="day",f0="dayofyear",Fl="hours",Ml="minutes",Pl="seconds",hf="milliseconds";[Il,_l,Dl,Rl,Bl,ff,f0,Fl,Ml,Pl,hf].reduce((e,t,n)=>(e[t]=1+n,e),{});const LT={[Il]:yr,[_l]:kl.every(3),[Dl]:kl,[Rl]:Sl,[Bl]:vi,[ff]:vi,[f0]:vi,[Fl]:af,[Ml]:of,[Pl]:qr,[hf]:Ms},NT={[Il]:wr,[_l]:Tl.every(3),[Dl]:Tl,[Rl]:Cl,[Bl]:xo,[ff]:xo,[f0]:xo,[Fl]:lf,[Ml]:sf,[Pl]:qr,[hf]:Ms};function zT(e){return LT[e]}function UT(e){return NT[e]}function h0(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function d0(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Ol(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function Uy(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,o=e.days,s=e.shortDays,a=e.months,l=e.shortMonths,c=Ll(i),u=Nl(i),f=Ll(o),h=Nl(o),d=Ll(s),p=Nl(s),m=Ll(a),b=Nl(a),g=Ll(l),y=Nl(l),v={a:ae,A:we,b:me,B:U,c:null,d:$y,e:$y,f:cI,g:wI,G:xI,H:sI,I:aI,j:lI,L:Wy,m:uI,M:fI,p:Ae,q:Ce,Q:Jy,s:e2,S:hI,u:dI,U:pI,V:gI,w:mI,W:bI,x:null,X:null,y:yI,Y:vI,Z:AI,"%":Ky},w={a:H,A:ze,b:qe,B:Q,c:null,d:Qy,e:Qy,f:kI,g:OI,G:NI,H:EI,I:SI,j:CI,L:Zy,m:TI,M:II,p:X,q:re,Q:Jy,s:e2,S:_I,u:DI,U:RI,V:BI,w:FI,W:MI,x:null,X:null,y:PI,Y:LI,Z:zI,"%":Ky},S={a:B,A:I,b:q,B:Z,c:ne,d:Vy,e:Vy,f:nI,g:jy,G:Gy,H:qy,I:qy,j:KT,L:tI,m:XT,M:JT,p:D,q:ZT,Q:iI,s:oI,S:eI,u:qT,U:$T,V:WT,w:VT,W:YT,x:J,X:ce,y:jy,Y:Gy,Z:QT,"%":rI};v.x=E(n,v),v.X=E(r,v),v.c=E(t,v),w.x=E(n,w),w.X=E(r,w),w.c=E(t,w);function E(ie,ye){return function(L){var R=[],se=-1,pe=0,Re=ie.length,Te,Ie,Me;for(L instanceof Date||(L=new Date(+L));++se<Re;)ie.charCodeAt(se)===37&&(R.push(ie.slice(pe,se)),(Ie=Hy[Te=ie.charAt(++se)])!=null?Te=ie.charAt(++se):Ie=Te==="e"?" ":"0",(Me=ye[Te])&&(Te=Me(L,Ie)),R.push(Te),pe=se+1);return R.push(ie.slice(pe,se)),R.join("")}}function k(ie,ye){return function(L){var R=Ol(1900,void 0,1),se=M(R,ie,L+="",0),pe,Re;if(se!=L.length)return null;if("Q"in R)return new Date(R.Q);if("s"in R)return new Date(R.s*1e3+("L"in R?R.L:0));if(ye&&!("Z"in R)&&(R.Z=0),"p"in R&&(R.H=R.H%12+R.p*12),R.m===void 0&&(R.m="q"in R?R.q:0),"V"in R){if(R.V<1||R.V>53)return null;"w"in R||(R.w=1),"Z"in R?(pe=d0(Ol(R.y,0,1)),Re=pe.getUTCDay(),pe=Re>4||Re===0?uf.ceil(pe):uf(pe),pe=xo.offset(pe,(R.V-1)*7),R.y=pe.getUTCFullYear(),R.m=pe.getUTCMonth(),R.d=pe.getUTCDate()+(R.w+6)%7):(pe=h0(Ol(R.y,0,1)),Re=pe.getDay(),pe=Re>4||Re===0?cf.ceil(pe):cf(pe),pe=vi.offset(pe,(R.V-1)*7),R.y=pe.getFullYear(),R.m=pe.getMonth(),R.d=pe.getDate()+(R.w+6)%7)}else("W"in R||"U"in R)&&("w"in R||(R.w="u"in R?R.u%7:"W"in R?1:0),Re="Z"in R?d0(Ol(R.y,0,1)).getUTCDay():h0(Ol(R.y,0,1)).getDay(),R.m=0,R.d="W"in R?(R.w+6)%7+R.W*7-(Re+5)%7:R.w+R.U*7-(Re+6)%7);return"Z"in R?(R.H+=R.Z/100|0,R.M+=R.Z%100,d0(R)):h0(R)}}function M(ie,ye,L,R){for(var se=0,pe=ye.length,Re=L.length,Te,Ie;se<pe;){if(R>=Re)return-1;if(Te=ye.charCodeAt(se++),Te===37){if(Te=ye.charAt(se++),Ie=S[Te in Hy?ye.charAt(se++):Te],!Ie||(R=Ie(ie,L,R))<0)return-1}else if(Te!=L.charCodeAt(R++))return-1}return R}function D(ie,ye,L){var R=c.exec(ye.slice(L));return R?(ie.p=u.get(R[0].toLowerCase()),L+R[0].length):-1}function B(ie,ye,L){var R=d.exec(ye.slice(L));return R?(ie.w=p.get(R[0].toLowerCase()),L+R[0].length):-1}function I(ie,ye,L){var R=f.exec(ye.slice(L));return R?(ie.w=h.get(R[0].toLowerCase()),L+R[0].length):-1}function q(ie,ye,L){var R=g.exec(ye.slice(L));return R?(ie.m=y.get(R[0].toLowerCase()),L+R[0].length):-1}function Z(ie,ye,L){var R=m.exec(ye.slice(L));return R?(ie.m=b.get(R[0].toLowerCase()),L+R[0].length):-1}function ne(ie,ye,L){return M(ie,t,ye,L)}function J(ie,ye,L){return M(ie,n,ye,L)}function ce(ie,ye,L){return M(ie,r,ye,L)}function ae(ie){return s[ie.getDay()]}function we(ie){return o[ie.getDay()]}function me(ie){return l[ie.getMonth()]}function U(ie){return a[ie.getMonth()]}function Ae(ie){return i[+(ie.getHours()>=12)]}function Ce(ie){return 1+~~(ie.getMonth()/3)}function H(ie){return s[ie.getUTCDay()]}function ze(ie){return o[ie.getUTCDay()]}function qe(ie){return l[ie.getUTCMonth()]}function Q(ie){return a[ie.getUTCMonth()]}function X(ie){return i[+(ie.getUTCHours()>=12)]}function re(ie){return 1+~~(ie.getUTCMonth()/3)}return{format:function(ie){var ye=E(ie+="",v);return ye.toString=function(){return ie},ye},parse:function(ie){var ye=k(ie+="",!1);return ye.toString=function(){return ie},ye},utcFormat:function(ie){var ye=E(ie+="",w);return ye.toString=function(){return ie},ye},utcParse:function(ie){var ye=k(ie+="",!0);return ye.toString=function(){return ie},ye}}}var Hy={"-":"",_:" ",0:"0"},zt=/^\s*\d+/,HT=/^%/,GT=/[\\^$*+?|[\]().{}]/g;function Qe(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(t)+i:i)}function jT(e){return e.replace(GT,"\\$&")}function Ll(e){return new RegExp("^(?:"+e.map(jT).join("|")+")","i")}function Nl(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function VT(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function qT(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function $T(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function WT(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function YT(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Gy(e,t,n){var r=zt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function jy(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function QT(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function ZT(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function XT(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Vy(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function KT(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function qy(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function JT(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function eI(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function tI(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function nI(e,t,n){var r=zt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function rI(e,t,n){var r=HT.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function iI(e,t,n){var r=zt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function oI(e,t,n){var r=zt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function $y(e,t){return Qe(e.getDate(),t,2)}function sI(e,t){return Qe(e.getHours(),t,2)}function aI(e,t){return Qe(e.getHours()%12||12,t,2)}function lI(e,t){return Qe(1+vi.count(yr(e),e),t,3)}function Wy(e,t){return Qe(e.getMilliseconds(),t,3)}function cI(e,t){return Wy(e,t)+"000"}function uI(e,t){return Qe(e.getMonth()+1,t,2)}function fI(e,t){return Qe(e.getMinutes(),t,2)}function hI(e,t){return Qe(e.getSeconds(),t,2)}function dI(e){var t=e.getDay();return t===0?7:t}function pI(e,t){return Qe(Sl.count(yr(e)-1,e),t,2)}function Yy(e){var t=e.getDay();return t>=4||t===0?Ps(e):Ps.ceil(e)}function gI(e,t){return e=Yy(e),Qe(Ps.count(yr(e),e)+(yr(e).getDay()===4),t,2)}function mI(e){return e.getDay()}function bI(e,t){return Qe(cf.count(yr(e)-1,e),t,2)}function yI(e,t){return Qe(e.getFullYear()%100,t,2)}function wI(e,t){return e=Yy(e),Qe(e.getFullYear()%100,t,2)}function vI(e,t){return Qe(e.getFullYear()%1e4,t,4)}function xI(e,t){var n=e.getDay();return e=n>=4||n===0?Ps(e):Ps.ceil(e),Qe(e.getFullYear()%1e4,t,4)}function AI(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Qe(t/60|0,"0",2)+Qe(t%60,"0",2)}function Qy(e,t){return Qe(e.getUTCDate(),t,2)}function EI(e,t){return Qe(e.getUTCHours(),t,2)}function SI(e,t){return Qe(e.getUTCHours()%12||12,t,2)}function CI(e,t){return Qe(1+xo.count(wr(e),e),t,3)}function Zy(e,t){return Qe(e.getUTCMilliseconds(),t,3)}function kI(e,t){return Zy(e,t)+"000"}function TI(e,t){return Qe(e.getUTCMonth()+1,t,2)}function II(e,t){return Qe(e.getUTCMinutes(),t,2)}function _I(e,t){return Qe(e.getUTCSeconds(),t,2)}function DI(e){var t=e.getUTCDay();return t===0?7:t}function RI(e,t){return Qe(Cl.count(wr(e)-1,e),t,2)}function Xy(e){var t=e.getUTCDay();return t>=4||t===0?Os(e):Os.ceil(e)}function BI(e,t){return e=Xy(e),Qe(Os.count(wr(e),e)+(wr(e).getUTCDay()===4),t,2)}function FI(e){return e.getUTCDay()}function MI(e,t){return Qe(uf.count(wr(e)-1,e),t,2)}function PI(e,t){return Qe(e.getUTCFullYear()%100,t,2)}function OI(e,t){return e=Xy(e),Qe(e.getUTCFullYear()%100,t,2)}function LI(e,t){return Qe(e.getUTCFullYear()%1e4,t,4)}function NI(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Os(e):Os.ceil(e),Qe(e.getUTCFullYear()%1e4,t,4)}function zI(){return"+0000"}function Ky(){return"%"}function Jy(e){return+e}function e2(e){return Math.floor(+e/1e3)}var Ls,p0,t2,g0,n2;UI({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function UI(e){return Ls=Uy(e),p0=Ls.format,t2=Ls.parse,g0=Ls.utcFormat,n2=Ls.utcParse,Ls}function df(e){const t={};return n=>t[n]||(t[n]=e(n))}function r2(e,t,n){n=n||{},nn(n)||xt(`Invalid time multi-format specifier: ${n}`);const r=t(Pl),i=t(Ml),o=t(Fl),s=t(Bl),a=t(Rl),l=t(Dl),c=t(_l),u=t(Il),f=e(n[hf]||".%L"),h=e(n[Pl]||":%S"),d=e(n[Ml]||"%I:%M"),p=e(n[Fl]||"%I %p"),m=e(n[Bl]||n[ff]||"%a %d"),b=e(n[Rl]||"%b %d"),g=e(n[Dl]||"%B"),y=e(n[_l]||"%B"),v=e(n[Il]||"%Y");return w=>(r(w)<w?f:i(w)<w?h:o(w)<w?d:s(w)<w?p:l(w)<w?a(w)<w?m:b:u(w)<w?c(w)<w?g:y:v)(w)}function i2(e){const t=df(e.format),n=df(e.utcFormat);return{timeFormat:r=>lt(r)?t(r):r2(t,zT,r),utcFormat:r=>lt(r)?n(r):r2(n,UT,r),timeParse:df(e.parse),utcParse:df(e.utcParse)}}let m0;HI();function HI(){return m0=i2({format:p0,parse:t2,utcFormat:g0,utcParse:n2})}function GI(e){return i2(Uy(e))}function jI(e){return arguments.length?m0=GI(e):m0}const VI=/^(data:|([A-Za-z]+:)?\/\/)/,qI=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,$I=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,o2="file://";function WI(e,t){return n=>({options:n||{},sanitize:QI,load:YI,fileAccess:!1,file:ZI(),http:KI(e)})}async function YI(e,t){const n=await this.sanitize(e,t),r=n.href;return n.localFile?this.file(r):this.http(r,t)}async function QI(e,t){t=Xd({},this.options,t);const n=this.fileAccess,r={href:null};let i,o,s;const a=qI.test(e.replace($I,""));(e==null||typeof e!="string"||!a)&&xt("Sanitize failure, invalid URI: "+Xu(e));const l=VI.test(e);return(s=t.baseURL)&&!l&&(!e.startsWith("/")&&!s.endsWith("/")&&(e="/"+e),e=s+e),o=(i=e.startsWith(o2))||t.mode==="file"||t.mode!=="http"&&!l&&n,i?e=e.slice(o2.length):e.startsWith("//")&&(t.defaultProtocol==="file"?(e=e.slice(2),o=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(r,"localFile",{value:!!o}),r.href=e,t.target&&(r.target=t.target+""),t.rel&&(r.rel=t.rel+""),t.context==="image"&&t.crossOrigin&&(r.crossOrigin=t.crossOrigin+""),r}function ZI(e){return XI}async function XI(){xt("No file system access.")}function KI(e){return e?async function(t,n){const r=Xd({},this.options.http,n),i=n&&n.response,o=await e(t,r);return o.ok?kn(o[i])?o[i]():o.text():xt(o.status+""+o.statusText)}:JI}async function JI(){xt("No HTTP fetch method available.")}const e_=e=>e!=null&&e===e,t_=e=>e==="true"||e==="false"||e===!0||e===!1,n_=e=>!Number.isNaN(Date.parse(e)),s2=e=>!Number.isNaN(+e)&&!(e instanceof Date),r_=e=>s2(e)&&Number.isInteger(+e),a2={boolean:_8,integer:ml,number:ml,date:R8,string:B8,unknown:Wu},pf=[t_,r_,s2,n_],i_=["boolean","integer","number","date"];function l2(e,t){if(!e||!e.length)return"unknown";const n=e.length,r=pf.length,i=pf.map((o,s)=>s+1);for(let o=0,s=0,a,l;o<n;++o)for(l=t?e[o][t]:e[o],a=0;a<r;++a)if(i[a]&&e_(l)&&!pf[a](l)&&(i[a]=0,++s,s===pf.length))return"string";return i_[i.reduce((o,s)=>o===0?s:o,0)-1]}function o_(e,t){return t.reduce((n,r)=>(n[r]=l2(e,r),n),{})}function c2(e){const t=function(n,r){const i={delimiter:e};return b0(n,r?Xd(r,i):i)};return t.responseType="text",t}function b0(e,t){return t.header&&(e=t.header.map(Xu).join(t.delimiter)+`
5
+ `)}function c(f){return f.map(u).join(e)}function u(f){return f==null?"":f instanceof Date?P8(f):t.test(f+="")?'"'+f.replace(/"/g,'""')+'"':f}return{parse:r,parseRows:i,format:s,formatBody:a,formatRows:l,formatRow:c,formatValue:u}}var O8=xy(" "),L8=O8.parseRows;function N8(e){return e}function z8(e){if(e==null)return N8;var t,n,r=e.scale[0],i=e.scale[1],o=e.translate[0],s=e.translate[1];return function(a,l){l||(t=n=0);var c=2,u=a.length,f=new Array(u);for(f[0]=(t+=a[0])*r+o,f[1]=(n+=a[1])*i+s;c<u;)f[c]=a[c],++c;return f}}function U8(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}function H8(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return Ay(e,n)})}:Ay(e,t)}function Ay(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,o=Ey(e,t);return n==null&&r==null?{type:"Feature",properties:i,geometry:o}:r==null?{type:"Feature",id:n,properties:i,geometry:o}:{type:"Feature",id:n,bbox:r,properties:i,geometry:o}}function Ey(e,t){var n=z8(e.transform),r=e.arcs;function i(u,f){f.length&&f.pop();for(var h=r[u<0?~u:u],d=0,p=h.length;d<p;++d)f.push(n(h[d],d));u<0&&U8(f,p)}function o(u){return n(u)}function s(u){for(var f=[],h=0,d=u.length;h<d;++h)i(u[h],f);return f.length<2&&f.push(f[0]),f}function a(u){for(var f=s(u);f.length<4;)f.push(f[0]);return f}function l(u){return u.map(a)}function c(u){var f=u.type,h;switch(f){case"GeometryCollection":return{type:f,geometries:u.geometries.map(c)};case"Point":h=o(u.coordinates);break;case"MultiPoint":h=u.coordinates.map(o);break;case"LineString":h=s(u.arcs);break;case"MultiLineString":h=u.arcs.map(s);break;case"Polygon":h=l(u.arcs);break;case"MultiPolygon":h=u.arcs.map(l);break;default:return null}return{type:f,coordinates:h}}return c(t)}function G8(e,t){var n={},r={},i={},o=[],s=-1;t.forEach(function(c,u){var f=e.arcs[c<0?~c:c],h;f.length<3&&!f[1][0]&&!f[1][1]&&(h=t[++s],t[s]=c,t[u]=h)}),t.forEach(function(c){var u=a(c),f=u[0],h=u[1],d,p;if(d=i[f])if(delete i[d.end],d.push(c),d.end=h,p=r[h]){delete r[p.start];var m=p===d?d:d.concat(p);r[m.start=d.start]=i[m.end=p.end]=m}else r[d.start]=i[d.end]=d;else if(d=r[h])if(delete r[d.start],d.unshift(c),d.start=f,p=i[f]){delete i[p.end];var b=p===d?d:p.concat(d);r[b.start=p.start]=i[b.end=d.end]=b}else r[d.start]=i[d.end]=d;else d=[c],r[d.start=f]=i[d.end=h]=d});function a(c){var u=e.arcs[c<0?~c:c],f=u[0],h;return e.transform?(h=[0,0],u.forEach(function(d){h[0]+=d[0],h[1]+=d[1]})):h=u[u.length-1],c<0?[h,f]:[f,h]}function l(c,u){for(var f in c){var h=c[f];delete u[h.start],delete h.start,delete h.end,h.forEach(function(d){n[d<0?~d:d]=1}),o.push(h)}}return l(i,r),l(r,i),t.forEach(function(c){n[c<0?~c:c]||o.push([c])}),o}function j8(e){return Ey(e,V8.apply(this,arguments))}function V8(e,t,n){var r,i,o;if(arguments.length>1)r=q8(e,t,n);else for(i=0,r=new Array(o=e.arcs.length);i<o;++i)r[i]=i;return{type:"MultiLineString",arcs:G8(e,r)}}function q8(e,t,n){var r=[],i=[],o;function s(f){var h=f<0?~f:f;(i[h]||(i[h]=[])).push({i:f,g:o})}function a(f){f.forEach(s)}function l(f){f.forEach(a)}function c(f){f.forEach(l)}function u(f){switch(o=f,f.type){case"GeometryCollection":f.geometries.forEach(u);break;case"LineString":a(f.arcs);break;case"MultiLineString":case"Polygon":l(f.arcs);break;case"MultiPolygon":c(f.arcs);break}}return u(t),i.forEach(n==null?function(f){r.push(f[0].i)}:function(f){n(f[0].g,f[f.length-1].g)&&r.push(f[0].i)}),r}function wo(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function $8(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Ds(e){let t,n,r;e.length!==2?(t=wo,n=(a,l)=>wo(e(a),l),r=(a,l)=>e(a)-l):(t=e===wo||e===$8?e:W8,n=e,r=e);function i(a,l,c=0,u=a.length){if(c<u){if(t(l,l)!==0)return u;do{const f=c+u>>>1;n(a[f],l)<0?c=f+1:u=f}while(c<u)}return c}function o(a,l,c=0,u=a.length){if(c<u){if(t(l,l)!==0)return u;do{const f=c+u>>>1;n(a[f],l)<=0?c=f+1:u=f}while(c<u)}return c}function s(a,l,c=0,u=a.length){const f=i(a,l,c,u-1);return f>c&&r(a[f-1],l)>-r(a[f],l)?f-1:f}return{left:i,center:s,right:o}}function W8(){return 0}function Sy(e){return e===null?NaN:+e}function*Y8(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}const Cy=Ds(wo),Ur=Cy.right;Cy.left,Ds(Sy).center;function ky(e,t){let n=0;if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(i=+i)>=i&&++n}return n}function Q8(e,t){let n=0,r,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,o+=r*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(r=a-i,i+=r/++n,o+=r*(a-i))}if(n>1)return o/(n-1)}function Ju(e,t){let n,r;if(t===void 0)for(const i of e)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)));else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(n===void 0?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)))}return[n,r]}class Hr extends Map{constructor(t,n=K8){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(Ty(this,t))}has(t){return super.has(Ty(this,t))}set(t,n){return super.set(Z8(this,t),n)}delete(t){return super.delete(X8(this,t))}}function Ty({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Z8({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function X8({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function K8(e){return e!==null&&typeof e=="object"?e.valueOf():e}function wl(e){return e}function vl(e,...t){return t0(e,wl,wl,t)}function J8(e,...t){return t0(e,Array.from,wl,t)}function eT(e,t,...n){return t0(e,wl,t,n)}function t0(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);const a=new Hr,l=r[s++];let c=-1;for(const u of o){const f=l(u,++c,o),h=a.get(f);h?h.push(u):a.set(f,[u])}for(const[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function tT(e,t){return Array.from(t,n=>e[n])}function nT(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[n]=t;if(n&&n.length!==2||t.length>1){const r=Uint32Array.from(e,(i,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),r.sort((i,o)=>{for(const s of t){const a=ef(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>ef(n[i],n[o]))),tT(e,r)}return e.sort(Iy(n))}function Iy(e=wo){if(e===wo)return ef;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function ef(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}var rT=Array.prototype,iT=rT.slice;function n0(e){return()=>e}const oT=Math.sqrt(50),sT=Math.sqrt(10),aT=Math.sqrt(2);function tf(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=oT?10:o>=sT?5:o>=aT?2:1;let a,l,c;return i<0?(c=Math.pow(10,-i)/s,a=Math.round(e*c),l=Math.round(t*c),a/c<e&&++a,l/c>t&&--l,c=-c):(c=Math.pow(10,i)*s,a=Math.round(e/c),l=Math.round(t/c),a*c<e&&++a,l*c>t&&--l),l<a&&.5<=n&&n<2?tf(e,t,n*2):[a,l,c]}function xl(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const r=t<e,[i,o,s]=r?tf(t,e,n):tf(e,t,n);if(!(o>=i))return[];const a=o-i+1,l=new Array(a);if(r)if(s<0)for(let c=0;c<a;++c)l[c]=(o-c)/-s;else for(let c=0;c<a;++c)l[c]=(o-c)*s;else if(s<0)for(let c=0;c<a;++c)l[c]=(i+c)/-s;else for(let c=0;c<a;++c)l[c]=(i+c)*s;return l}function Rs(e,t,n){return t=+t,e=+e,n=+n,tf(e,t,n)[2]}function vo(e,t,n){t=+t,e=+e,n=+n;const r=t<e,i=r?Rs(t,e,n):Rs(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function lT(e,t,n){let r;for(;;){const i=Rs(e,t,n);if(i===r||i===0||!isFinite(i))return[e,t];i>0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}function cT(e){return Math.max(1,Math.ceil(Math.log(ky(e))/Math.LN2)+1)}function uT(){var e=wl,t=Ju,n=cT;function r(i){Array.isArray(i)||(i=Array.from(i));var o,s=i.length,a,l,c=new Array(s);for(o=0;o<s;++o)c[o]=e(i[o],o,i);var u=t(c),f=u[0],h=u[1],d=n(c,f,h);if(!Array.isArray(d)){const v=h,w=+d;if(t===Ju&&([f,h]=lT(f,h,w)),d=xl(f,h,w),d[0]<=f&&(l=Rs(f,h,w)),d[d.length-1]>=h)if(v>=h&&t===Ju){const S=Rs(f,h,w);isFinite(S)&&(S>0?h=(Math.floor(h/S)+1)*S:S<0&&(h=(Math.ceil(h*-S)+1)/-S))}else d.pop()}for(var p=d.length,m=0,b=p;d[m]<=f;)++m;for(;d[b-1]>h;)--b;(m||b<p)&&(d=d.slice(m,b),p=b-m);var g=new Array(p+1),y;for(o=0;o<=p;++o)y=g[o]=[],y.x0=o>0?d[o-1]:f,y.x1=o<p?d[o]:h;if(isFinite(l)){if(l>0)for(o=0;o<s;++o)(a=c[o])!=null&&f<=a&&a<=h&&g[Math.min(p,Math.floor((a-f)/l))].push(i[o]);else if(l<0){for(o=0;o<s;++o)if((a=c[o])!=null&&f<=a&&a<=h){const v=Math.floor((f-a)*l);g[Math.min(p,v+(d[v]<=a))].push(i[o])}}}else for(o=0;o<s;++o)(a=c[o])!=null&&f<=a&&a<=h&&g[Ur(d,a,0,p)].push(i[o]);return g}return r.value=function(i){return arguments.length?(e=typeof i=="function"?i:n0(i),r):e},r.domain=function(i){return arguments.length?(t=typeof i=="function"?i:n0([i[0],i[1]]),r):t},r.thresholds=function(i){return arguments.length?(n=typeof i=="function"?i:n0(Array.isArray(i)?iT.call(i):i),r):n},r}function r0(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function i0(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function _y(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?ef:Iy(i);r>n;){if(r-n>600){const l=r-n+1,c=t-n+1,u=Math.log(l),f=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),d=Math.max(n,Math.floor(t-c*f/l+h)),p=Math.min(r,Math.floor(t+(l-c)*f/l+h));_y(e,t,d,p,i)}const o=e[t];let s=n,a=r;for(Al(e,n,t),i(e[r],o)>0&&Al(e,n,r);s<a;){for(Al(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?Al(e,n,a):(++a,Al(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function Al(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function fT(e,t,n){if(e=Float64Array.from(Y8(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return i0(e);if(t>=1)return r0(e);var r,i=(r-1)*t,o=Math.floor(i),s=r0(_y(e,o).subarray(0,o+1)),a=i0(e.subarray(o+1));return s+(a-s)*(i-o)}}function o0(e,t,n=Sy){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,o=Math.floor(i),s=+n(e[o],o,e),a=+n(e[o+1],o+1,e);return s+(a-s)*(i-o)}}function hT(e,t){let n=0,r=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&(++n,r+=i);else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n}function dT(e,t){return fT(e,.5,t)}function wi(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r<i;)o[r]=e+r*n;return o}function El(e,t){let n=0;if(t===void 0)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function pT(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function nf(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Bs(e){return e=nf(Math.abs(e)),e?e[1]:NaN}function gT(e,t){return function(n,r){for(var i=n.length,o=[],s=0,a=e[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),o.push(n.substring(i-=a,i+a)),!((l+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function mT(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var bT=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Fs(e){if(!(t=bT.exec(e)))throw new Error("invalid format: "+e);var t;return new s0({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Fs.prototype=s0.prototype;function s0(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}s0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function yT(e){e:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+e[n])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Dy;function wT(e,t){var n=nf(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(Dy=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+nf(e,Math.max(0,t+o-1))[0]}function Ry(e,t){var n=nf(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const By={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:pT,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Ry(e*100,t),r:Ry,s:wT,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Fy(e){return e}var My=Array.prototype.map,Py=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function vT(e){var t=e.grouping===void 0||e.thousands===void 0?Fy:gT(My.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?Fy:mT(My.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"−":e.minus+"",l=e.nan===void 0?"NaN":e.nan+"";function c(f){f=Fs(f);var h=f.fill,d=f.align,p=f.sign,m=f.symbol,b=f.zero,g=f.width,y=f.comma,v=f.precision,w=f.trim,S=f.type;S==="n"?(y=!0,S="g"):By[S]||(v===void 0&&(v=12),w=!0,S="g"),(b||h==="0"&&d==="=")&&(b=!0,h="0",d="=");var E=m==="$"?n:m==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",k=m==="$"?r:/[%p]/.test(S)?s:"",M=By[S],D=/[defgprs%]/.test(S);v=v===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v));function B(I){var q=E,Z=k,te,J,ce;if(S==="c")Z=M(I)+Z,I="";else{I=+I;var ae=I<0||1/I<0;if(I=isNaN(I)?l:M(Math.abs(I),v),w&&(I=yT(I)),ae&&+I==0&&p!=="+"&&(ae=!1),q=(ae?p==="("?p:a:p==="-"||p==="("?"":p)+q,Z=(S==="s"?Py[8+Dy/3]:"")+Z+(ae&&p==="("?")":""),D){for(te=-1,J=I.length;++te<J;)if(ce=I.charCodeAt(te),48>ce||ce>57){Z=(ce===46?i+I.slice(te+1):I.slice(te))+Z,I=I.slice(0,te);break}}}y&&!b&&(I=t(I,1/0));var we=q.length+I.length+Z.length,me=we<g?new Array(g-we+1).join(h):"";switch(y&&b&&(I=t(me+I,me.length?g-Z.length:1/0),me=""),d){case"<":I=q+I+Z+me;break;case"=":I=q+me+I+Z;break;case"^":I=me.slice(0,we=me.length>>1)+q+I+Z+me.slice(we);break;default:I=me+q+I+Z;break}return o(I)}return B.toString=function(){return f+""},B}function u(f,h){var d=c((f=Fs(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(Bs(h)/3)))*3,m=Math.pow(10,-p),b=Py[8+p/3];return function(g){return d(m*g)+b}}return{format:c,formatPrefix:u}}var rf,Ft,Oy;xT({thousands:",",grouping:[3],currency:["$",""]});function xT(e){return rf=vT(e),Ft=rf.format,Oy=rf.formatPrefix,rf}function AT(e){return Math.max(0,-Bs(Math.abs(e)))}function ET(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Bs(t)/3)))*3-Bs(Math.abs(e)))}function ST(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Bs(t)-Bs(e))+1}const a0=new Date,l0=new Date;function Mt(e,t,n,r){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{const s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{const l=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return l;let c;do l.push(c=new Date(+o)),t(o,a),e(o);while(c<o&&o<s);return l},i.filter=o=>Mt(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),n&&(i.count=(o,s)=>(a0.setTime(+o),l0.setTime(+s),e(a0),e(l0),Math.floor(n(a0,l0))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?s=>r(s)%o===0:s=>i.count(0,s)%o===0):i)),i}const Ms=Mt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Ms.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Mt(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Ms),Ms.range;const Gr=1e3,Ln=Gr*60,jr=Ln*60,Vr=jr*24,c0=Vr*7,Ly=Vr*30,u0=Vr*365,qr=Mt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Gr)},(e,t)=>(t-e)/Gr,e=>e.getUTCSeconds());qr.range;const of=Mt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Gr)},(e,t)=>{e.setTime(+e+t*Ln)},(e,t)=>(t-e)/Ln,e=>e.getMinutes());of.range;const sf=Mt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Ln)},(e,t)=>(t-e)/Ln,e=>e.getUTCMinutes());sf.range;const af=Mt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Gr-e.getMinutes()*Ln)},(e,t)=>{e.setTime(+e+t*jr)},(e,t)=>(t-e)/jr,e=>e.getHours());af.range;const lf=Mt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*jr)},(e,t)=>(t-e)/jr,e=>e.getUTCHours());lf.range;const vi=Mt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Ln)/Vr,e=>e.getDate()-1);vi.range;const xo=Mt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Vr,e=>e.getUTCDate()-1);xo.range;const Ny=Mt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Vr,e=>Math.floor(e/Vr));Ny.range;function Ao(e){return Mt(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Ln)/c0)}const Sl=Ao(0),cf=Ao(1),CT=Ao(2),kT=Ao(3),Ps=Ao(4),TT=Ao(5),IT=Ao(6);Sl.range,cf.range,CT.range,kT.range,Ps.range,TT.range,IT.range;function Eo(e){return Mt(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/c0)}const Cl=Eo(0),uf=Eo(1),_T=Eo(2),DT=Eo(3),Os=Eo(4),RT=Eo(5),BT=Eo(6);Cl.range,uf.range,_T.range,DT.range,Os.range,RT.range,BT.range;const kl=Mt(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());kl.range;const Tl=Mt(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Tl.range;const yr=Mt(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());yr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Mt(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),yr.range;const wr=Mt(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());wr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Mt(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),wr.range;function zy(e,t,n,r,i,o){const s=[[qr,1,Gr],[qr,5,5*Gr],[qr,15,15*Gr],[qr,30,30*Gr],[o,1,Ln],[o,5,5*Ln],[o,15,15*Ln],[o,30,30*Ln],[i,1,jr],[i,3,3*jr],[i,6,6*jr],[i,12,12*jr],[r,1,Vr],[r,2,2*Vr],[n,1,c0],[t,1,Ly],[t,3,3*Ly],[e,1,u0]];function a(c,u,f){const h=u<c;h&&([c,u]=[u,c]);const d=f&&typeof f.range=="function"?f:l(c,u,f),p=d?d.range(c,+u+1):[];return h?p.reverse():p}function l(c,u,f){const h=Math.abs(u-c)/f,d=Ds(([,,b])=>b).right(s,h);if(d===s.length)return e.every(vo(c/u0,u/u0,f));if(d===0)return Ms.every(Math.max(vo(c,u,f),1));const[p,m]=s[h/s[d-1][2]<s[d][2]/h?d-1:d];return p.every(m)}return[a,l]}const[FT,MT]=zy(wr,Tl,Cl,Ny,lf,sf),[PT,OT]=zy(yr,kl,Sl,vi,af,of),Il="year",_l="quarter",Dl="month",Rl="week",Bl="date",ff="day",f0="dayofyear",Fl="hours",Ml="minutes",Pl="seconds",hf="milliseconds";[Il,_l,Dl,Rl,Bl,ff,f0,Fl,Ml,Pl,hf].reduce((e,t,n)=>(e[t]=1+n,e),{});const LT={[Il]:yr,[_l]:kl.every(3),[Dl]:kl,[Rl]:Sl,[Bl]:vi,[ff]:vi,[f0]:vi,[Fl]:af,[Ml]:of,[Pl]:qr,[hf]:Ms},NT={[Il]:wr,[_l]:Tl.every(3),[Dl]:Tl,[Rl]:Cl,[Bl]:xo,[ff]:xo,[f0]:xo,[Fl]:lf,[Ml]:sf,[Pl]:qr,[hf]:Ms};function zT(e){return LT[e]}function UT(e){return NT[e]}function h0(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function d0(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Ol(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function Uy(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,o=e.days,s=e.shortDays,a=e.months,l=e.shortMonths,c=Ll(i),u=Nl(i),f=Ll(o),h=Nl(o),d=Ll(s),p=Nl(s),m=Ll(a),b=Nl(a),g=Ll(l),y=Nl(l),v={a:ae,A:we,b:me,B:U,c:null,d:$y,e:$y,f:cI,g:wI,G:xI,H:sI,I:aI,j:lI,L:Wy,m:uI,M:fI,p:Ae,q:Ce,Q:Jy,s:e2,S:hI,u:dI,U:pI,V:gI,w:mI,W:bI,x:null,X:null,y:yI,Y:vI,Z:AI,"%":Ky},w={a:H,A:ze,b:qe,B:Q,c:null,d:Qy,e:Qy,f:kI,g:OI,G:NI,H:EI,I:SI,j:CI,L:Zy,m:TI,M:II,p:X,q:re,Q:Jy,s:e2,S:_I,u:DI,U:RI,V:BI,w:FI,W:MI,x:null,X:null,y:PI,Y:LI,Z:zI,"%":Ky},S={a:B,A:I,b:q,B:Z,c:te,d:Vy,e:Vy,f:nI,g:jy,G:Gy,H:qy,I:qy,j:KT,L:tI,m:XT,M:JT,p:D,q:ZT,Q:iI,s:oI,S:eI,u:qT,U:$T,V:WT,w:VT,W:YT,x:J,X:ce,y:jy,Y:Gy,Z:QT,"%":rI};v.x=E(n,v),v.X=E(r,v),v.c=E(t,v),w.x=E(n,w),w.X=E(r,w),w.c=E(t,w);function E(ie,ye){return function(L){var R=[],se=-1,pe=0,Re=ie.length,Te,Ie,Me;for(L instanceof Date||(L=new Date(+L));++se<Re;)ie.charCodeAt(se)===37&&(R.push(ie.slice(pe,se)),(Ie=Hy[Te=ie.charAt(++se)])!=null?Te=ie.charAt(++se):Ie=Te==="e"?" ":"0",(Me=ye[Te])&&(Te=Me(L,Ie)),R.push(Te),pe=se+1);return R.push(ie.slice(pe,se)),R.join("")}}function k(ie,ye){return function(L){var R=Ol(1900,void 0,1),se=M(R,ie,L+="",0),pe,Re;if(se!=L.length)return null;if("Q"in R)return new Date(R.Q);if("s"in R)return new Date(R.s*1e3+("L"in R?R.L:0));if(ye&&!("Z"in R)&&(R.Z=0),"p"in R&&(R.H=R.H%12+R.p*12),R.m===void 0&&(R.m="q"in R?R.q:0),"V"in R){if(R.V<1||R.V>53)return null;"w"in R||(R.w=1),"Z"in R?(pe=d0(Ol(R.y,0,1)),Re=pe.getUTCDay(),pe=Re>4||Re===0?uf.ceil(pe):uf(pe),pe=xo.offset(pe,(R.V-1)*7),R.y=pe.getUTCFullYear(),R.m=pe.getUTCMonth(),R.d=pe.getUTCDate()+(R.w+6)%7):(pe=h0(Ol(R.y,0,1)),Re=pe.getDay(),pe=Re>4||Re===0?cf.ceil(pe):cf(pe),pe=vi.offset(pe,(R.V-1)*7),R.y=pe.getFullYear(),R.m=pe.getMonth(),R.d=pe.getDate()+(R.w+6)%7)}else("W"in R||"U"in R)&&("w"in R||(R.w="u"in R?R.u%7:"W"in R?1:0),Re="Z"in R?d0(Ol(R.y,0,1)).getUTCDay():h0(Ol(R.y,0,1)).getDay(),R.m=0,R.d="W"in R?(R.w+6)%7+R.W*7-(Re+5)%7:R.w+R.U*7-(Re+6)%7);return"Z"in R?(R.H+=R.Z/100|0,R.M+=R.Z%100,d0(R)):h0(R)}}function M(ie,ye,L,R){for(var se=0,pe=ye.length,Re=L.length,Te,Ie;se<pe;){if(R>=Re)return-1;if(Te=ye.charCodeAt(se++),Te===37){if(Te=ye.charAt(se++),Ie=S[Te in Hy?ye.charAt(se++):Te],!Ie||(R=Ie(ie,L,R))<0)return-1}else if(Te!=L.charCodeAt(R++))return-1}return R}function D(ie,ye,L){var R=c.exec(ye.slice(L));return R?(ie.p=u.get(R[0].toLowerCase()),L+R[0].length):-1}function B(ie,ye,L){var R=d.exec(ye.slice(L));return R?(ie.w=p.get(R[0].toLowerCase()),L+R[0].length):-1}function I(ie,ye,L){var R=f.exec(ye.slice(L));return R?(ie.w=h.get(R[0].toLowerCase()),L+R[0].length):-1}function q(ie,ye,L){var R=g.exec(ye.slice(L));return R?(ie.m=y.get(R[0].toLowerCase()),L+R[0].length):-1}function Z(ie,ye,L){var R=m.exec(ye.slice(L));return R?(ie.m=b.get(R[0].toLowerCase()),L+R[0].length):-1}function te(ie,ye,L){return M(ie,t,ye,L)}function J(ie,ye,L){return M(ie,n,ye,L)}function ce(ie,ye,L){return M(ie,r,ye,L)}function ae(ie){return s[ie.getDay()]}function we(ie){return o[ie.getDay()]}function me(ie){return l[ie.getMonth()]}function U(ie){return a[ie.getMonth()]}function Ae(ie){return i[+(ie.getHours()>=12)]}function Ce(ie){return 1+~~(ie.getMonth()/3)}function H(ie){return s[ie.getUTCDay()]}function ze(ie){return o[ie.getUTCDay()]}function qe(ie){return l[ie.getUTCMonth()]}function Q(ie){return a[ie.getUTCMonth()]}function X(ie){return i[+(ie.getUTCHours()>=12)]}function re(ie){return 1+~~(ie.getUTCMonth()/3)}return{format:function(ie){var ye=E(ie+="",v);return ye.toString=function(){return ie},ye},parse:function(ie){var ye=k(ie+="",!1);return ye.toString=function(){return ie},ye},utcFormat:function(ie){var ye=E(ie+="",w);return ye.toString=function(){return ie},ye},utcParse:function(ie){var ye=k(ie+="",!0);return ye.toString=function(){return ie},ye}}}var Hy={"-":"",_:" ",0:"0"},zt=/^\s*\d+/,HT=/^%/,GT=/[\\^$*+?|[\]().{}]/g;function Qe(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(t)+i:i)}function jT(e){return e.replace(GT,"\\$&")}function Ll(e){return new RegExp("^(?:"+e.map(jT).join("|")+")","i")}function Nl(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function VT(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function qT(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function $T(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function WT(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function YT(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Gy(e,t,n){var r=zt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function jy(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function QT(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function ZT(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function XT(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Vy(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function KT(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function qy(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function JT(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function eI(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function tI(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function nI(e,t,n){var r=zt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function rI(e,t,n){var r=HT.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function iI(e,t,n){var r=zt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function oI(e,t,n){var r=zt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function $y(e,t){return Qe(e.getDate(),t,2)}function sI(e,t){return Qe(e.getHours(),t,2)}function aI(e,t){return Qe(e.getHours()%12||12,t,2)}function lI(e,t){return Qe(1+vi.count(yr(e),e),t,3)}function Wy(e,t){return Qe(e.getMilliseconds(),t,3)}function cI(e,t){return Wy(e,t)+"000"}function uI(e,t){return Qe(e.getMonth()+1,t,2)}function fI(e,t){return Qe(e.getMinutes(),t,2)}function hI(e,t){return Qe(e.getSeconds(),t,2)}function dI(e){var t=e.getDay();return t===0?7:t}function pI(e,t){return Qe(Sl.count(yr(e)-1,e),t,2)}function Yy(e){var t=e.getDay();return t>=4||t===0?Ps(e):Ps.ceil(e)}function gI(e,t){return e=Yy(e),Qe(Ps.count(yr(e),e)+(yr(e).getDay()===4),t,2)}function mI(e){return e.getDay()}function bI(e,t){return Qe(cf.count(yr(e)-1,e),t,2)}function yI(e,t){return Qe(e.getFullYear()%100,t,2)}function wI(e,t){return e=Yy(e),Qe(e.getFullYear()%100,t,2)}function vI(e,t){return Qe(e.getFullYear()%1e4,t,4)}function xI(e,t){var n=e.getDay();return e=n>=4||n===0?Ps(e):Ps.ceil(e),Qe(e.getFullYear()%1e4,t,4)}function AI(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Qe(t/60|0,"0",2)+Qe(t%60,"0",2)}function Qy(e,t){return Qe(e.getUTCDate(),t,2)}function EI(e,t){return Qe(e.getUTCHours(),t,2)}function SI(e,t){return Qe(e.getUTCHours()%12||12,t,2)}function CI(e,t){return Qe(1+xo.count(wr(e),e),t,3)}function Zy(e,t){return Qe(e.getUTCMilliseconds(),t,3)}function kI(e,t){return Zy(e,t)+"000"}function TI(e,t){return Qe(e.getUTCMonth()+1,t,2)}function II(e,t){return Qe(e.getUTCMinutes(),t,2)}function _I(e,t){return Qe(e.getUTCSeconds(),t,2)}function DI(e){var t=e.getUTCDay();return t===0?7:t}function RI(e,t){return Qe(Cl.count(wr(e)-1,e),t,2)}function Xy(e){var t=e.getUTCDay();return t>=4||t===0?Os(e):Os.ceil(e)}function BI(e,t){return e=Xy(e),Qe(Os.count(wr(e),e)+(wr(e).getUTCDay()===4),t,2)}function FI(e){return e.getUTCDay()}function MI(e,t){return Qe(uf.count(wr(e)-1,e),t,2)}function PI(e,t){return Qe(e.getUTCFullYear()%100,t,2)}function OI(e,t){return e=Xy(e),Qe(e.getUTCFullYear()%100,t,2)}function LI(e,t){return Qe(e.getUTCFullYear()%1e4,t,4)}function NI(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Os(e):Os.ceil(e),Qe(e.getUTCFullYear()%1e4,t,4)}function zI(){return"+0000"}function Ky(){return"%"}function Jy(e){return+e}function e2(e){return Math.floor(+e/1e3)}var Ls,p0,t2,g0,n2;UI({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function UI(e){return Ls=Uy(e),p0=Ls.format,t2=Ls.parse,g0=Ls.utcFormat,n2=Ls.utcParse,Ls}function df(e){const t={};return n=>t[n]||(t[n]=e(n))}function r2(e,t,n){n=n||{},nn(n)||xt(`Invalid time multi-format specifier: ${n}`);const r=t(Pl),i=t(Ml),o=t(Fl),s=t(Bl),a=t(Rl),l=t(Dl),c=t(_l),u=t(Il),f=e(n[hf]||".%L"),h=e(n[Pl]||":%S"),d=e(n[Ml]||"%I:%M"),p=e(n[Fl]||"%I %p"),m=e(n[Bl]||n[ff]||"%a %d"),b=e(n[Rl]||"%b %d"),g=e(n[Dl]||"%B"),y=e(n[_l]||"%B"),v=e(n[Il]||"%Y");return w=>(r(w)<w?f:i(w)<w?h:o(w)<w?d:s(w)<w?p:l(w)<w?a(w)<w?m:b:u(w)<w?c(w)<w?g:y:v)(w)}function i2(e){const t=df(e.format),n=df(e.utcFormat);return{timeFormat:r=>lt(r)?t(r):r2(t,zT,r),utcFormat:r=>lt(r)?n(r):r2(n,UT,r),timeParse:df(e.parse),utcParse:df(e.utcParse)}}let m0;HI();function HI(){return m0=i2({format:p0,parse:t2,utcFormat:g0,utcParse:n2})}function GI(e){return i2(Uy(e))}function jI(e){return arguments.length?m0=GI(e):m0}const VI=/^(data:|([A-Za-z]+:)?\/\/)/,qI=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,$I=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,o2="file://";function WI(e,t){return n=>({options:n||{},sanitize:QI,load:YI,fileAccess:!1,file:ZI(),http:KI(e)})}async function YI(e,t){const n=await this.sanitize(e,t),r=n.href;return n.localFile?this.file(r):this.http(r,t)}async function QI(e,t){t=Xd({},this.options,t);const n=this.fileAccess,r={href:null};let i,o,s;const a=qI.test(e.replace($I,""));(e==null||typeof e!="string"||!a)&&xt("Sanitize failure, invalid URI: "+Xu(e));const l=VI.test(e);return(s=t.baseURL)&&!l&&(!e.startsWith("/")&&!s.endsWith("/")&&(e="/"+e),e=s+e),o=(i=e.startsWith(o2))||t.mode==="file"||t.mode!=="http"&&!l&&n,i?e=e.slice(o2.length):e.startsWith("//")&&(t.defaultProtocol==="file"?(e=e.slice(2),o=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(r,"localFile",{value:!!o}),r.href=e,t.target&&(r.target=t.target+""),t.rel&&(r.rel=t.rel+""),t.context==="image"&&t.crossOrigin&&(r.crossOrigin=t.crossOrigin+""),r}function ZI(e){return XI}async function XI(){xt("No file system access.")}function KI(e){return e?async function(t,n){const r=Xd({},this.options.http,n),i=n&&n.response,o=await e(t,r);return o.ok?kn(o[i])?o[i]():o.text():xt(o.status+""+o.statusText)}:JI}async function JI(){xt("No HTTP fetch method available.")}const e_=e=>e!=null&&e===e,t_=e=>e==="true"||e==="false"||e===!0||e===!1,n_=e=>!Number.isNaN(Date.parse(e)),s2=e=>!Number.isNaN(+e)&&!(e instanceof Date),r_=e=>s2(e)&&Number.isInteger(+e),a2={boolean:_8,integer:ml,number:ml,date:R8,string:B8,unknown:Wu},pf=[t_,r_,s2,n_],i_=["boolean","integer","number","date"];function l2(e,t){if(!e||!e.length)return"unknown";const n=e.length,r=pf.length,i=pf.map((o,s)=>s+1);for(let o=0,s=0,a,l;o<n;++o)for(l=t?e[o][t]:e[o],a=0;a<r;++a)if(i[a]&&e_(l)&&!pf[a](l)&&(i[a]=0,++s,s===pf.length))return"string";return i_[i.reduce((o,s)=>o===0?s:o,0)-1]}function o_(e,t){return t.reduce((n,r)=>(n[r]=l2(e,r),n),{})}function c2(e){const t=function(n,r){const i={delimiter:e};return b0(n,r?Xd(r,i):i)};return t.responseType="text",t}function b0(e,t){return t.header&&(e=t.header.map(Xu).join(t.delimiter)+`
6
6
  `+e),xy(t.delimiter).parse(e+"")}b0.responseType="text";function s_(e){return typeof Buffer=="function"&&kn(Buffer.isBuffer)?Buffer.isBuffer(e):!1}function y0(e,t){const n=t&&t.property?$u(t.property):Wu;return nn(e)&&!s_(e)?a_(n(e),t):n(JSON.parse(e))}y0.responseType="json";function a_(e,t){return!Zt(e)&&T8(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}const l_={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function u2(e,t){let n,r,i,o;return e=y0(e,t),t&&t.feature?(n=H8,i=t.feature):t&&t.mesh?(n=j8,i=t.mesh,o=l_[t.filter]):xt("Missing TopoJSON feature or mesh parameter."),r=(r=e.objects[i])?n(e,r,o):xt("Invalid TopoJSON object: "+i),r&&r.features||[r]}u2.responseType="json";const w0={dsv:b0,csv:c2(","),tsv:c2(" "),json:y0,topojson:u2};function v0(e,t){return arguments.length>1?(w0[e]=t,this):_s(w0,e)?w0[e]:null}function x0(e,t,n,r){t=t||{};const i=v0(t.type||"json");return i||xt("Unknown data format type: "+t.type),e=i(e,t),t.parse&&c_(e,t.parse,n,r),_s(e,"columns")&&delete e.columns,e}function c_(e,t,n,r){if(!e.length)return;const i=jI();n=n||i.timeParse,r=r||i.utcParse;let o=e.columns||Object.keys(e[0]),s,a,l,c,u,f;t==="auto"&&(t=o_(e,o)),o=Object.keys(t);const h=o.map(d=>{const p=t[d];let m,b;if(p&&(p.startsWith("date:")||p.startsWith("utc:")))return m=p.split(/:(.+)?/,2),b=m[1],(b[0]==="'"&&b[b.length-1]==="'"||b[0]==='"'&&b[b.length-1]==='"')&&(b=b.slice(1,-1)),(m[0]==="utc"?r:n)(b);if(!a2[p])throw Error("Illegal format pattern: "+d+":"+p);return a2[p]});for(l=0,u=e.length,f=o.length;l<u;++l)for(s=e[l],c=0;c<f;++c)a=o[c],s[a]=h[c](s[a])}const u_=WI(typeof fetch<"u"&&fetch);/**
7
7
  * @license
8
8
  * Copyright 2019 Google LLC
@@ -1091,9 +1091,9 @@ bool setupPicking() {
1091
1091
  }`)}}else if(tg(M)){if(!d.has(E)){d.set(E,"multi");const B=sA+mc(E);l.push(`// Selection texture
1092
1092
  uniform highp usampler2D ${B};`);const I=this.getContext().glHelper,q=I.selectionTextures;this.selectionTextureOps.push(()=>{const J=k.getValue(E),ce=q.get(J);if(!ce)throw new Error(`Bug: no selection texture found for "${E}"!`);Ro(this.programInfo,{[B]:ce})});const Z=sA+E;l.push(`bool ${vc}${E}(bool empty) {
1093
1093
  return binarySearchTexture(${Z}, ${D}) || (empty && isEmptyBinarySearchTexture(${Z}));
1094
- }`),I.createSelectionTexture(M);const ne=k.createExpression(E);ne.addListener(()=>{const J=ne(null);I.createSelectionTexture(J),this.getContext().animator.requestRender()})}}else if(Ix(M)&&!d.has(E)){d.set(E,"interval");const B=[],I=[];for(const q of Object.keys(M.intervals)){if(!["x","y"].includes(q))continue;const Z=ph+mc(E)+`_${q}`,{attributeType:ne}=oa(this.unitView.getScaleResolution(q).scale,q);f.push(" // Selection parameter"),f.push(` uniform highp ${ne}[2] ${Z};`),N(this,hr).push(()=>{this.registerMarkUniformValue(Z,{expr:E},me=>me.intervals[q]??[1/0,-1/0])});const J=ia+q,ce=Z+"[0]",ae=Z+"[1]",we=Ux(q);if(this.encoding[we]){const me=ia+we,U=this.defaultHitTestMode;if(U=="endpoints")B.push(`((${ce} <= ${J} && ${J} <= ${ae}) || (${ce} <= ${me} && ${me} <= ${ae}))`);else if(U=="encloses")B.push(`(${ce} <= ${J} && ${me} <= ${ae})`);else if(U=="intersects")B.push(`(${ce} <= ${me} && ${J} <= ${ae})`);else throw new zi(`Unsupported hit test mode "${U}" for interval selection!`,this.unitView)}else B.push(`(${ce} <= ${J} && ${J} <= ${ae})`);I.push(`${ce} > ${ae}`)}l.push(`bool ${vc}${E}(bool empty) {
1094
+ }`),I.createSelectionTexture(M);const te=k.createExpression(E);te.addListener(()=>{const J=te(null);I.createSelectionTexture(J),this.getContext().animator.requestRender()})}}else if(Ix(M)&&!d.has(E)){d.set(E,"interval");const B=[],I=[];for(const q of Object.keys(M.intervals)){if(!["x","y"].includes(q))continue;const Z=ph+mc(E)+`_${q}`,{attributeType:te}=oa(this.unitView.getScaleResolution(q).scale,q);f.push(" // Selection parameter"),f.push(` uniform highp ${te}[2] ${Z};`),N(this,hr).push(()=>{this.registerMarkUniformValue(Z,{expr:E},me=>me.intervals[q]??[1/0,-1/0])});const J=ia+q,ce=Z+"[0]",ae=Z+"[1]",we=Ux(q);if(this.encoding[we]){const me=ia+we,U=this.defaultHitTestMode;if(U=="endpoints")B.push(`((${ce} <= ${J} && ${J} <= ${ae}) || (${ce} <= ${me} && ${me} <= ${ae}))`);else if(U=="encloses")B.push(`(${ce} <= ${J} && ${me} <= ${ae})`);else if(U=="intersects")B.push(`(${ce} <= ${me} && ${J} <= ${ae})`);else throw new zi(`Unsupported hit test mode "${U}" for interval selection!`,this.unitView)}else B.push(`(${ce} <= ${J} && ${J} <= ${ae})`);I.push(`${ce} > ${ae}`)}l.push(`bool ${vc}${E}(bool empty) {
1095
1095
  return ${B.join(" && ")} || (empty && (${I.join(" || ")}));
1096
- }`)}}const p=(S,E,k,M)=>{const D=E.channelDef;if(Gn(D))if(gn(D.value)){const{uniformName:B,uniformGlsl:I,accessorGlsl:q,adjuster:Z}=WM(S,k);l.push(q),f.push(I),N(this,hr).push(()=>{this.registerMarkUniformValue(B,D.value,Z)})}else l.push($M(S,k,D.value).accessorGlsl);else if(bc(D)){const{uniformName:B,uniformGlsl:I,accessorGlsl:q}=YM(S,M,k);f.push(I),l.push(q);const{largeHp:Z,discrete:ne}=oa(M,S),J=ne&&"domain"in M?ce=>M.domain().indexOf(ce):Z?Xx:ce=>+ce;N(this,hr).push(()=>{this.registerMarkUniformValue(B,D.datum,J)})}else if(Rr(D)){const B=u.get([D.field,!0]),{attributeGlsl:I,accessorGlsl:q}=qx(S,M,k,B!=null&&B.includes(S)?B:void 0);c.add(I),l.push(q)}else if(yc(D)){const{attributeGlsl:B,accessorGlsl:I}=qx(S,M,k);c.add(B),l.push(I)}else throw new zi(`Unsupported channel definition: ${JSON.stringify(D)}`,this.unitView)};for(const[S,E]of Object.entries(o)){if(!i.includes(S))continue;const{channelDef:k,accessors:M,scale:D}=E;for(let B=0;B<M.length;B++)p(S,M[B],B,D);if(D){const B=Tn(k)&&k.resolutionChannel||S,I=na(B)?this.unitView.getScaleResolution(B):null,{glsl:q,domainUniform:Z,domainUniformName:ne,rangeUniform:J,rangeUniformName:ce}=QM(S,D,k);l.push(q),f.push(Z),f.push(J),J&&N(this,hr).push(()=>{const ae=this.createMarkUniformSetter(ce),we=()=>ae(Jx(D,S));I.addEventListener("range",we),we()}),Z&&N(this,hr).push(()=>{const ae=this.createMarkUniformSetter(ne),we=()=>{const me=Qr(D.type)?[0,D.domain().length]:D.domain();ae(Zx(D.type)?tP(me):me)};I.addEventListener("domain",we),we()})}l.push(ZM(S,M))}const m=[...d.keys()].map(S=>`${vc}${S}(false)`);l.push(`bool isPointSelected() {
1096
+ }`)}}const p=(S,E,k,M)=>{const D=E.channelDef;if(Gn(D))if(gn(D.value)){const{uniformName:B,uniformGlsl:I,accessorGlsl:q,adjuster:Z}=WM(S,k);l.push(q),f.push(I),N(this,hr).push(()=>{this.registerMarkUniformValue(B,D.value,Z)})}else l.push($M(S,k,D.value).accessorGlsl);else if(bc(D)){const{uniformName:B,uniformGlsl:I,accessorGlsl:q}=YM(S,M,k);f.push(I),l.push(q);const{largeHp:Z,discrete:te}=oa(M,S),J=te&&"domain"in M?ce=>M.domain().indexOf(ce):Z?Xx:ce=>+ce;N(this,hr).push(()=>{this.registerMarkUniformValue(B,D.datum,J)})}else if(Rr(D)){const B=u.get([D.field,!0]),{attributeGlsl:I,accessorGlsl:q}=qx(S,M,k,B!=null&&B.includes(S)?B:void 0);c.add(I),l.push(q)}else if(yc(D)){const{attributeGlsl:B,accessorGlsl:I}=qx(S,M,k);c.add(B),l.push(I)}else throw new zi(`Unsupported channel definition: ${JSON.stringify(D)}`,this.unitView)};for(const[S,E]of Object.entries(o)){if(!i.includes(S))continue;const{channelDef:k,accessors:M,scale:D}=E;for(let B=0;B<M.length;B++)p(S,M[B],B,D);if(D){const B=Tn(k)&&k.resolutionChannel||S,I=na(B)?this.unitView.getScaleResolution(B):null,{glsl:q,domainUniform:Z,domainUniformName:te,rangeUniform:J,rangeUniformName:ce}=QM(S,D,k);l.push(q),f.push(Z),f.push(J),J&&N(this,hr).push(()=>{const ae=this.createMarkUniformSetter(ce),we=()=>ae(Jx(D,S));I.addEventListener("range",we),we()}),Z&&N(this,hr).push(()=>{const ae=this.createMarkUniformSetter(te),we=()=>{const me=Qr(D.type)?[0,D.domain().length]:D.domain();ae(Zx(D.type)?tP(me):me)};I.addEventListener("domain",we),we()})}l.push(ZM(S,M))}const m=[...d.keys()].map(S=>`${vc}${S}(false)`);l.push(`bool isPointSelected() {
1097
1097
  `+(this.encoders.uniqueId&&m.length>0?` return ${m.join(" || ")};`:" return false;")+`
1098
1098
  }`);const b=`precision highp float;
1099
1099
  precision highp int;`,g=S=>S.replace("#pragma markUniforms",f.join(`
@@ -2221,7 +2221,7 @@ chrM 16299`};function bO(e){if(!(e in vA))throw new Error(`Unknown assembly: ${e
2221
2221
  <div class="title">
2222
2222
  <strong>${a}</strong>
2223
2223
  </div>
2224
- `:"";return K`${l}${s}`}class la extends MA{constructor(t,n,r,i,o,s){super(t,n,r,i,o,s),this.spec=t}async initializeChildren(){}*[Symbol.iterator](){}replaceChild(t,n){throw new Error("Not implemented")}visit(t){let n;try{n=t(this)}catch(r){throw r.view=this,r}if(n===$o)return n;if(n!==BA){t.beforeChildren&&t.beforeChildren(this);for(const r of this){const i=r.visit(t);if(i===$o)return i}t.afterChildren&&t.afterChildren(this),t.postOrder&&t.postOrder(this)}}findDescendantByPath(t){for(const n of this)if(n.name===t[0]){if(t.length==1)return n;if(n instanceof la)return n.findDescendantByPath(t.slice(1))}}findChildByName(t){for(const n of this)if(n.name===t)return n}findDescendantByName(t){let n;return this.visit(r=>{if(r.name==t)return n=r,$o}),n}getDefaultResolution(t,n){return"shared"}}class Ui extends la{constructor(n,r,i,o,s,a){super(n,r,i,o,s,{layersChildren:!0,...a});be(this,fi,[]);this.spec=n,this.needsAxes={x:!0,y:!0}}async initializeChildren(){xe(this,fi,await Promise.all(this.spec.layer.map((n,r)=>this.context.createOrImportView(n,this,this,"grid"+r,i=>{if(!Eh(i)&&!Ah(i))throw new zi("LayerView accepts only unit or layer specs as children!",this)}))))}get children(){return N(this,fi).slice()}*[Symbol.iterator](){for(const n of N(this,fi))yield n}render(n,r,i={}){if(super.render(n,r,i),!!this.isConfiguredVisible()){n.pushView(this,r);for(const o of N(this,fi))o.render(n,r,i);n.popView(this)}}propagateInteractionEvent(n){this.handleInteractionEvent(void 0,n,!0);for(let r=N(this,fi).length-1;r>=0;r--)if(N(this,fi)[r].propagateInteractionEvent(n),n.stopped)return;this.handleInteractionEvent(void 0,n,!1)}}fi=new WeakMap;class c3{constructor(t,n){this.n=t,this.maxCols=n??1/0}get nRows(){return this.maxCols==1/0?1:Math.ceil(this.n/this.maxCols)}get nCols(){return Math.min(this.n,this.maxCols)}get rowIndices(){const t=[],n=this.nCols,r=this.nRows;for(let i=0;i<r;i++){const o=[];t.push(o);for(let s=0;s<n;s++){const a=i*n+s;a<this.n&&o.push(a)}}return t}get colIndices(){const t=[],n=this.nCols,r=this.nRows;for(let i=0;i<n;i++){const o=[];t.push(o);for(let s=0;s<r;s++){const a=s*n+i;a<this.n&&o.push(a)}}return t}getCellIndex(t,n){let r=0;if(this.maxCols==1/0)r=n==0?t:void 0;else{if(t>=this.maxCols)return;r=n*this.nCols+t}return r<this.n?r:void 0}getCellCoords(t){if(!(t<0||t>=this.n))return[t%this.nCols,Math.floor(t/this.nCols)]}}const kN="chromosome_ticks_and_labels",TN={x:"width",y:"height"};function Rg(e){return e=="x"?"y":"x"}const xh={x:["bottom","top"],y:["left","right"]},Bg=Object.fromEntries(Object.entries(xh).map(([e,t])=>t.map(n=>[n,e])).flat(1));function Hi(e){return Bg[e]}class Fg extends Ui{constructor(t,n,r,i,o,s){const a=n=="locus",l={...a?_N:u3,...IN(n,t),...t};super(a?DN(l,n):f3(l,n),r,i,o,`axis_${t.orient}`,{blockEncodingInheritance:!0,contributesToScaleDomain:!1,...s}),this.axisProps=l}getSize(){const t={px:this.getPerpendicularSize()},n={grow:1};return Bg[this.axisProps.orient]=="x"?new Kr(n,t):new Kr(t,n)}getPerpendicularSize(){return Mg(this.axisProps)}isPickingSupported(){return!1}}function Mg(e){const t=Hi(e.orient);let n=e.ticks&&e.tickSize||0;return e.labels&&(n+=e.labelPadding,t=="x"?n+=e.labelFontSize:n+=30),e.title&&(n+=e.titlePadding+e.titleFontSize),n=Math.min(e.maxExtent||1/0,Math.max(e.minExtent||0,n)),n}const u3={values:null,minExtent:20,maxExtent:1/0,offset:0,domain:!0,domainWidth:1,domainColor:"gray",domainDash:null,domainDashOffset:0,domainCap:"square",ticks:!0,tickSize:5,tickWidth:1,tickColor:"gray",tickDash:null,tickDashOffset:0,tickCap:"square",tickCount:null,tickMinStep:null,labels:!0,labelAlign:"center",labelBaseline:"middle",labelPadding:4,labelFontSize:10,labelLimit:180,labelColor:"black",format:null,titleColor:"black",titleFont:"sans-serif",titleFontSize:10,titlePadding:3};function IN(e,t){const n=t.orient,r=e=="nominal"||e=="ordinal";let i="center",o="middle",s=t.labelAngle??((n=="top"||n=="bottom")&&r?-90:0);switch(n){case"left":i="right";break;case"right":i="left";break;case"top":case"bottom":Math.abs(s)>30?(i=s>0==(n=="bottom")?"left":"right",o="middle"):o=n=="top"?"alphabetic":"top";break}return{labelAlign:i,labelAngle:s,labelBaseline:o}}function f3(e,t){const n={...e,extent:Mg(e)},r=Hi(n.orient),i=Rg(r),o=n.orient=="bottom"||n.orient=="right"?1:-1,s=n.orient=="bottom"||n.orient=="left"?1:0,a=()=>({name:"domain",data:{values:[{}]},mark:{type:"rule",clip:!1,strokeDash:n.domainDash,strokeCap:n.domainCap,color:n.domainColor,[i]:s,size:n.domainWidth}}),l=()=>({name:"labels",mark:{type:"text",clip:!1,align:n.labelAlign,angle:n.labelAngle,baseline:n.labelBaseline,[i+"Offset"]:(n.tickSize+n.labelPadding)*o,[i]:s,size:n.labelFontSize,color:n.labelColor,minBufferSize:1500},encoding:{[r]:{field:"value",type:t},text:{field:"label"}}}),c=()=>({name:"ticks",mark:{type:"rule",clip:!1,strokeDash:n.tickDash,strokeCap:n.tickCap,color:n.tickColor,size:n.tickWidth,minBufferSize:300},encoding:{[i]:{value:s},[i+"2"]:{value:s-n.tickSize/n.extent*(s?1:-1)}}}),u=()=>({name:"title",data:{values:[{}]},mark:{type:"text",clip:!1,align:"center",baseline:n.orient=="bottom"?"bottom":"top",angle:[0,90,0,-90][["top","right","bottom","left"].indexOf(n.orient)],text:n.title,color:n.titleColor,[r]:.5,[i]:1-s}}),f=()=>{const d={name:"ticks_and_labels",encoding:{[r]:{field:"value",type:t}},layer:[]};return n.ticks&&d.layer.push(c()),n.labels&&d.layer.push(l()),d},h={resolve:{scale:{[r]:"forced"}},[TN[Rg(r)]]:n.extent,data:{lazy:{type:"axisTicks",channel:r,axis:e}},layer:[]};return n.domain&&h.layer.push(a()),(n.ticks||n.labels)&&h.layer.push(f()),n.title&&h.layer.push(u()),h}const _N={...u3,chromTicks:!0,chromTickSize:18,chromTickWidth:1,chromTickColor:"#989898",chromTickDash:[4,2],chromTickDashOffset:1,chromLabels:!0,chromLabelFontSize:13,chromLabelFontWeight:"normal",chromLabelFontStyle:"normal",chromLabelColor:"black",chromLabelAlign:"left",chromLabelPadding:7};function DN(e,t){const n={...e,extent:Mg(e)},r=Hi(n.orient),i=Rg(r),o=n.orient=="bottom"||n.orient=="left"?1:0,s=()=>({name:"chromosome_ticks",mark:{type:"rule",strokeDash:e.chromTickDash,strokeDashOffset:e.chromTickDashOffset,[i]:o,[i+"2"]:o-n.chromTickSize/n.extent*(o?1:-1),color:e.chromTickColor,size:n.chromTickWidth}}),a=()=>{let u;switch(n.orient){case"top":u={y:0,angle:0,paddingX:4,dy:-n.chromLabelPadding,viewportEdgeFadeWidthLeft:20,viewportEdgeFadeWidthRight:20,viewportEdgeFadeDistanceRight:-10,viewportEdgeFadeDistanceLeft:-20};break;case"bottom":u={y:1,angle:0,paddingX:4,dy:n.chromLabelPadding+n.chromLabelFontSize*.73,viewportEdgeFadeWidthLeft:20,viewportEdgeFadeWidthRight:20,viewportEdgeFadeDistanceRight:-10,viewportEdgeFadeDistanceLeft:-20};break;case"left":u={x:1,angle:-90,paddingY:4,dy:-n.chromLabelPadding,viewportEdgeFadeWidthBottom:20,viewportEdgeFadeWidthTop:20,viewportEdgeFadeDistanceBottom:-20,viewportEdgeFadeDistanceTop:-10};break;case"right":u={x:0,angle:90,align:"right",paddingY:4,dy:-n.chromLabelPadding};break;default:u={}}return{name:"chromosome_labels",mark:{type:"text",size:n.chromLabelFontSize,font:n.chromLabelFont,fontWeight:n.chromLabelFontWeight,fontStyle:n.chromLabelFontStyle,color:n.chromLabelColor,align:e.chromLabelAlign,baseline:"alphabetic",clip:!1,...u},encoding:{[r+"2"]:{field:"continuousEnd",type:t},text:{field:"name"}}}};let l;switch(n.orient){case"bottom":case"top":l={};break;case"left":l={labelAngle:-90,labelAlign:"center",labelPadding:6};break;case"right":l={labelAngle:90,labelAlign:"center",labelPadding:6};break;default:l={}}const c=f3({...e,...l},t);if(e.chromTicks||e.chromLabels){const u={name:kN,data:{lazy:{type:"axisGenome",channel:Hi(n.orient)}},encoding:{[r]:{field:"continuousStart",type:t,band:0}},layer:[]};if(e.chromTicks&&u.layer.push(s()),e.chromLabels){u.layer.push(a());let f;c.layer.filter(h=>h.name=="ticks_and_labels").forEach(h=>h.layer.filter(d=>d.name=="labels").forEach(d=>{f=d.mark})),f&&(n.orient=="top"||n.orient=="bottom"?(f.viewportEdgeFadeWidthLeft=30,f.viewportEdgeFadeDistanceLeft=40):(f.viewportEdgeFadeWidthBottom=30,f.viewportEdgeFadeDistanceBottom=40))}c.layer.push(u)}return c}class RN{constructor(t){be(this,As);be(this,co,0);be(this,uo,0);xe(this,As,new Array(t))}push(t){N(this,As)[N(this,co)]=t,xe(this,co,(N(this,co)+1)%this.size),xe(this,uo,Math.min(N(this,uo)+1,this.size))}get(){const t=N(this,As);return N(this,uo)<this.size?t.slice(0,N(this,uo)):t.slice(N(this,co),this.size).concat(t.slice(0,N(this,co)))}get size(){return N(this,As).length}get length(){return N(this,uo)}}As=new WeakMap,co=new WeakMap,uo=new WeakMap;let Qo,h3=0;function d3(){return performance.now()-h3<50}function BN(e){return function(...t){h3=performance.now(),e(...t)}}function p3(e,t,n,r,i){if(n=BN(n),e.type=="wheel"){e.uiEvent.preventDefault();const o=e.uiEvent,s=o.deltaMode?120:1;if(!o.deltaX&&!o.deltaY)return;Qo==null||Qo.stop();let{x:a,y:l}=e.point;if(r){const c=r.mark.encoders;c.x&&!c.x2&&!c.x.constant&&(a=+c.x(r.datum)*t.width+t.x),c.y&&!c.y2&&!c.y.constant&&(l=(1-+c.y(r.datum))*t.height+t.y)}Math.abs(o.deltaX)<Math.abs(o.deltaY)?n({x:a,y:l,xDelta:0,yDelta:0,zDelta:o.deltaY*s/300}):n({x:a,y:l,xDelta:-o.deltaX*s,yDelta:0,zDelta:0})}else if(e.type=="mousedown"&&e.uiEvent.button===0){Qo&&Qo.stop();const o=new RN(30),s=e.uiEvent;s.preventDefault();let a=xn.fromMouseEvent(s);const l=f=>{const h=xn.fromMouseEvent(f);o.push({point:h,timestamp:performance.now()});const d=h.subtract(a);n({x:a.x,y:a.y,xDelta:d.x,yDelta:d.y,zDelta:0}),a=h},c=()=>{const h=performance.now(),d=o.get().filter(v=>h-v.timestamp<160);if(d.length<5||!i||FN(d))return;const p=d.at(-1),m=d[0],b=p.point.subtract(m.point).multiply(1/(p.timestamp-m.timestamp));let g=a.x,y=a.y;Qo=_g(i,v=>{n({x:v.x,y:v.y,xDelta:g-v.x,yDelta:y-v.y,zDelta:0}),g=v.x,y=v.y},150,.5,{x:g,y}),Qo({x:a.x-b.x*250,y:a.y-b.y*250})},u=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",u),c()};document.addEventListener("mouseup",u,!1),document.addEventListener("mousemove",l,!1)}}function FN(e){const t=e[Math.floor(e.length/2)],n=t.point.subtract(e[0].point).multiply(t.timestamp-e[0].timestamp),r=e.at(-1).point.subtract(t.point).multiply(e.at(-1).timestamp-t.timestamp),i=n.length;return r.length/i<.4}class MN extends Ui{constructor(t,n,r,i,o,s){const l={...n=="locus"?PN:g3,...t};super(zN(l,n),r,i,o,`axisGrid_${t.orient}`,{blockEncodingInheritance:!0,contributesToScaleDomain:!1,...s}),this.axisProps=l}getOrient(){return this.axisProps.orient}isPickingSupported(){return!1}}const g3={values:null,grid:!1,gridCap:"butt",gridColor:"lightgray",gridDash:null,gridOpacity:1,gridWidth:1,tickCount:null,tickMinStep:null},PN={...g3,chromGrid:!1,chromGridCap:"butt",chromGridColor:"gray",chromGridDash:[1,5],chromGridOpacity:1,chromGridWidth:1};function ON(e,t){const n=e,r=Hi(n.orient);return{name:"grid_lines",data:{lazy:{type:"axisTicks",channel:r,axis:e}},mark:{type:"rule",strokeDash:n.gridDash,strokeCap:n.gridCap,color:n.gridColor,size:n.gridWidth,opacity:n.gridOpacity,minBufferSize:300},encoding:{[r]:{field:"value",type:t}}}}function LN(e,t){const n=e,r=Hi(n.orient);return{name:"chromosome_lines",data:{lazy:{type:"axisGenome",channel:r}},mark:{type:"rule",strokeDash:n.chromGridDash,strokeCap:n.chromGridCap,color:n.chromGridColor,size:n.chromGridWidth,opacity:n.chromGridOpacity},encoding:{[r]:{field:"continuousStart",type:t,band:0}}}}function NN(e,t){const n=e,r=Hi(n.orient);return{name:"chromosome_fill",data:{lazy:{type:"axisGenome",channel:r}},mark:{type:"rect"},encoding:{[r]:{field:"continuousStart",type:t,band:0},[r+"2"]:{field:"continuousEnd",band:0},fill:{field:"odd",type:"nominal",scale:{domain:[!1,!0],range:[n.chromGridFillEven??"white",n.chromGridFillOdd??"white"]}},opacity:{field:"odd",type:"nominal",scale:{type:"ordinal",domain:[!1,!0],range:[n.chromGridFillEven?1:0,n.chromGridFillOdd?1:0]}}}}}function zN(e,t){const n={...e},r=[];return n.chromGrid&&(n.chromGridFillOdd||n.chromGridFillEven)&&r.push(NN(n,t)),n.chromGrid&&n.chromGridOpacity>0&&r.push(LN(n,t)),n.grid&&n.gridOpacity>0&&r.push(ON(n,t)),{name:"grid_layers",configurableVisibility:!1,resolve:{scale:{[Hi(e.orient)]:"forced",fill:"independent",opacity:"independent"}},layer:r}}const m3={anchor:"middle",frame:"group",offset:10,orient:"top",align:void 0,angle:0,baseline:"alphabetic",dx:0,dy:0,color:void 0,font:void 0,fontSize:12,fontStyle:"normal",fontWeight:"normal"},UN={orient:"left",anchor:"middle",align:"right",baseline:"middle",angle:0,fontSize:12},HN={orient:"top",anchor:"start",align:"left",baseline:"top",offset:-10,dx:10,fontSize:12},GN={start:0,middle:.5,end:1},jN={start:"left",middle:"center",end:"right"};function VN(e){if(!e)return;const t=lt(e)?{text:e}:e;if(!t.text||t.orient=="none")return;const n={"track-title":UN,overlay:HN}[t.style]??{},r={...m3,...n,...t};let i={},o={x:0,y:0};const s=GN[r.anchor??"middle"];switch(r.orient){case"top":o={x:s,y:1},i={baseline:"alphabetic",angle:0};break;case"right":o={x:1,y:1-s},i={baseline:"alphabetic",angle:90};break;case"bottom":o={x:s,y:0},i={baseline:"top",angle:0};break;case"left":o={x:0,y:s},i={baseline:"alphabetic",angle:-90};break}const a={...m3,...i,...n,...t},l={xOffset:0,yOffset:0};switch(r.orient){case"top":l.yOffset=-a.offset;break;case"right":l.xOffset=a.offset;break;case"bottom":l.yOffset=a.offset;break;case"left":l.xOffset=-a.offset;break}return{configurableVisibility:!1,data:{values:[{}]},mark:{type:"text",tooltip:null,clip:!1,...o,...l,text:a.text,align:a.align??jN[a.anchor],angle:a.angle,baseline:a.baseline,dx:a.dx,dy:a.dy,color:a.color,font:a.font,size:a.fontSize,fontStyle:a.fontStyle,fontWeight:a.fontWeight}}}class b3 extends St{constructor(n,r){const i={scrollbarSize:8,scrollbarPadding:2};super({data:{values:[{}]},mark:{type:"rect",fill:"#b0b0b0",fillOpacity:.6,stroke:"white",strokeWidth:1,strokeOpacity:1,cornerRadius:5,clip:!1},configurableVisibility:!1},n.layoutParent.context,n.layoutParent,n.view,"scrollbar-"+r,{blockEncodingInheritance:!0});be(this,sl);be(this,Mu,jn.ZERO);be(this,fo,0);be(this,Es,0);tn(this,"viewportOffset",0);this.config=i,xe(this,sl,r),this.interpolateViewportOffset=_g(this.context.animator,o=>{this.viewportOffset=o.x},50,.4,{x:this.viewportOffset}),this.addInteractionEventListener("mousedown",(o,s)=>{if(s.stopPropagation(),N(this,fo)<=0)return;const a=d=>r=="vertical"?d.clientY:d.clientX,l=s.uiEvent;l.preventDefault();const c=this.scrollOffset,u=a(l),f=d=>{const p=Xr(a(d)-u+c,0,N(this,fo));this.interpolateViewportOffset({x:p/N(this,fo)*N(this,Es)})},h=()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",h)};document.addEventListener("mouseup",h,!1),document.addEventListener("mousemove",f,!1)})}get scrollOffset(){return this.viewportOffset/N(this,Es)*N(this,fo)}render(n,r,i){super.render(n,N(this,Mu),i)}updateScrollbar(n,r){const i=this.config.scrollbarPadding,o=this.config.scrollbarSize,s=N(this,sl)=="horizontal"?"width":"height",a=Math.min(1,n[s]/r[s]),l=n[s]-2*i,c=a*l;xe(this,fo,l-c),xe(this,Es,r[s]-n[s]),this.viewportOffset=Xr(this.viewportOffset,0,N(this,Es)),xe(this,Mu,N(this,sl)=="vertical"?new jn(()=>n.x+n.width-o-i,()=>n.y+i+this.scrollOffset,()=>o,()=>c):new jn(()=>n.x+i+this.scrollOffset,()=>n.y+n.height-o-i,()=>c,()=>o))}}sl=new WeakMap,Mu=new WeakMap,fo=new WeakMap,Es=new WeakMap;class qN extends Ui{constructor(t,n,r={}){const i=n(),o=Object.keys(i.intervals);if(["x","y"].every(c=>!o.includes(c)))throw new Error("SelectionRect requires at least one of the channels 'x' or 'y' to be present in the selection.");const s={name:"selectionRect",configurableVisibility:!1,resolve:{scale:{x:"forced",y:"forced"}},data:{values:y3(n())},encoding:{},layer:[]};o.includes("x")&&(s.encoding.x={field:"_x",type:null,title:null},s.encoding.x2={field:"_x2"}),o.includes("y")&&(s.encoding.y={field:"_y",type:null,title:null},s.encoding.y2={field:"_y2"}),s.layer.push({name:"selectionRectRect",mark:{type:"rect",clip:!0,fill:"#808080",fillOpacity:.05,stroke:"black",strokeWidth:1,strokeOpacity:.2,...r}});const a=c=>{const u=t.view.getScaleResolution(c);return`format(datum._${c}2 - datum._${c}, '.3s')`+(u.type==="locus"?" + 'b'":"")},l=r.measure=="inside"?9:r.measure=="outside"?-9:0;o.includes("x")&&l!=0&&s.layer.push({name:"selectionRectTextX",mark:{type:"text",align:"center",paddingX:5,dy:l,tooltip:null},encoding:{text:{expr:a("x")},y:o.includes("y")?{field:"_y2",type:null,title:null}:{value:1},y2:null}}),o.includes("y")&&l!=0&&s.layer.push({name:"selectionRectTextY",mark:{type:"text",align:"center",paddingY:5,dy:l,tooltip:null,angle:-90},encoding:{text:{expr:a("y")},x2:null}}),super(s,t.layoutParent.context,t.layoutParent,t.view,"selectionRect",{blockEncodingInheritance:!0,contributesToScaleDomain:!1}),n.addListener(()=>{const c=n();this.context.dataFlow.findDataSourceByKey(this).updateDynamicData(y3(c))})}}function y3(e){const t=e.intervals.x,n=e.intervals.y;return!t&&!n?[]:[{_x:t==null?void 0:t[0],_x2:t==null?void 0:t[1],_y:n==null?void 0:n[0],_y2:n==null?void 0:n[1]}]}class Pg{constructor(t,n,r){be(this,Nd);if(this.layoutParent=n,this.view=t,this.serial=r,this.background=void 0,this.backgroundStroke=void 0,this.axes={},this.gridLines={},this.scrollbars={},this.selectionRect=void 0,this.title=void 0,this.coords=jn.ZERO,t.needsAxes.x||t.needsAxes.y){const i=t.spec,o="view"in i?i==null?void 0:i.view:void 0,s=w3(o);s&&(this.background=new St(s,n.context,n,t,"background"+r,{blockEncodingInheritance:!0}));const a=v3(o);a&&(this.backgroundStroke=new St(a,n.context,n,t,"backgroundStroke"+r,{blockEncodingInheritance:!0}));const l=VN(t.spec.title);if(l){const c=new St(l,n.context,n,t,"title"+r,{blockEncodingInheritance:!0});this.title=c}}t.spec.viewportWidth!=null&&(this.scrollbars.horizontal=new b3(this,"horizontal")),t.spec.viewportHeight!=null&&(this.scrollbars.vertical=new b3(this,"vertical")),he(this,Nd,Ok).call(this)}*getChildren(){this.background&&(yield this.background),this.backgroundStroke&&(yield this.backgroundStroke),this.title&&(yield this.title),yield*Object.values(this.axes),yield*Object.values(this.gridLines),yield this.view,yield*Object.values(this.scrollbars),this.selectionRect&&(yield this.selectionRect)}async createAxes(){const{view:t,axes:n,gridLines:r}=this,i=(a,l)=>{const c=a.getAxisProps();if(c===null)return;const u=c?{...c}:{};if(!u.orient){for(const f of xh[l])if(!n[f]){u.orient=f;break}if(!u.orient)throw new Error("No slots available for an axis! Perhaps a LayerView has more than two children?")}if(u.title??(u.title=a.getTitle()),!xh[l].includes(u.orient))throw new Error(`Invalid axis orientation "${u.orient}" on channel "${l}"!`);return u},o=async(a,l,c)=>{const u=i(a,l);if(u){if(n[u.orient])throw new Error(`An axis with the orient "${u.orient}" already exists!`);const f=new Fg(u,a.scaleResolution.type,this.layoutParent.context,this.layoutParent,c);n[u.orient]=f,await f.initializeChildren()}},s=async(a,l,c)=>{const u=i(a,l);if(u&&(u.grid||u.chromGrid)){const f=new MN(u,a.scaleResolution.type,this.layoutParent.context,this.layoutParent,c);r[u.orient]=f,await f.initializeChildren()}};for(const a of["x","y"])if(t.needsAxes[a]){const l=t.resolutions.axis[a];if(!l)continue;await o(l,a,t)}for(const a of["x","y"])if(t.needsAxes[a]&&t.getConfiguredOrDefaultResolution(a,"axis")!="excluded"){const l=t.getAxisResolution(a);if(!l)continue;await s(l,a,t)}if(t instanceof Ui){for(const a of t)for(const[l,c]of Object.entries(a.resolutions.axis)){const u=c.getAxisProps();u&&u.orient&&await o(c,l,a)}for(const a of t)for(const[l,c]of Object.entries(a.resolutions.axis)){const u=c.getAxisProps();u&&!u.orient&&await o(c,l,a)}}[...Object.values(n),...Object.values(r)].forEach(a=>a.visit(l=>{l instanceof St&&l.resolve("scale")}))}getOverhang(){const t=n=>{const r=this.axes[n];return r?Math.max(r.getPerpendicularSize()+(r.axisProps.offset??0),0):0};return new Vt(t("top"),t("right"),t("bottom"),t("left")).add(this.view.getOverhang())}getOverhangAndPadding(){return this.getOverhang().add(this.view.getPadding())}}Nd=new WeakSet,Ok=function(){const t=this.view,n=r=>{this.view.context.glHelper.canvas.style.cursor=r};for(const[r,i]of t.paramMediator.paramConfigs){if(!("select"in i))continue;const o=fh(i.select);if(!Dx(o))continue;const s=o.encodings,a=Object.fromEntries(s.map(v=>{const w=this.view.getScaleResolution(v),S=w==null?void 0:w.scale;if(!S||!Gt(S.type))throw new Error(`No continuous scale found for interval selection param "${r}" on channel "${v}"! Scale type is "${(S==null?void 0:S.type)??"none"}".`);return[v,w]}));if(this.selectionRect)throw new Error("Only one interval selection per container is currently allowed!");let l=!1,c=!1,u=!1,f=null;const h=(v,w)=>Object.fromEntries(s.map(S=>[S,[Math.min(v[S],w[S]),Math.max(v[S],w[S])]])),d=t.paramMediator.createExpression(r),p=t.paramMediator.getSetter(r);i.value&&p({type:"interval",intervals:i.value});const m=()=>{p(kx(s)),n(null)};this.selectionRect=new qN(this,d,o.mark),this.selectionRect.initializeChildren();const b=v=>{const w={x:0,y:0},S=t.coords.normalizePoint(v.x,v.y,!0);for(const E of s){const k=a[E].scale,M=k.invert(E=="x"?S.x:S.y);w[E]=M+(["index","locus"].includes(k.type)?.5:0)}return w},g=v=>{var M,D,B,I;const{intervals:w}=v,S=(q,Z,ne)=>{const J=(we,me)=>me==null?null:a[we].scale(me),ce=J("x",q)??ne,ae=J("y",Z)??ne;return t.coords.denormalizePoint(ce,ae,!0)},E=S((M=w.x)==null?void 0:M[0],(D=w.y)==null?void 0:D[0],0),k=S((B=w.x)==null?void 0:B[1],(I=w.y)==null?void 0:I[1],1);return jn.create(E.x,E.y,k.x-E.x,k.y-E.y)};t.addInteractionEventListener("mousedown",(v,w)=>{if(w.uiEvent.button!=0)return;if(f=l?g(d()):null,f)n("grabbing"),c=!0;else{const D=w.point;if(Rx(d())&&(c=!0),w.uiEvent.shiftKey)m(),u=!0;else if(Rx(d())){const B=(I,q)=>{t.removeInteractionEventListener("mouseup",B);const Z=q.point;D.subtract(Z).length<2&&m()};t.addInteractionEventListener("mouseup",B);return}}w.stopPropagation();const S=w.point,E=xn.fromMouseEvent(w.uiEvent).subtract(S),k=D=>{const B=xn.fromMouseEvent(D).subtract(E);let I;if(f){const q=B.subtract(S),Z=f.translate(q.x,q.y);I=h(b(new xn(Z.x,Z.y)),b(new xn(Z.x2,Z.y2)))}else I=h(b(S),b(B));for(const q of s){const Z=a[q],{zoomExtent:ne,scale:J}=Z,ce=I[q];if(["index","locus"].includes(J.type)&&(ce[0]=Math.ceil(ce[0]),ce[1]=Math.ceil(ce[1])),f){const ae=ce[1]-ce[0],we=ne[0],me=ne[1];ce[0]<we&&(ce[0]=we,ce[1]=we+ae),ce[1]>me&&(ce[1]=me,ce[0]=me-ae)}else ce[0]=Math.max(ne[0],ce[0]),ce[1]=Math.min(ne[1],ce[1]);ce[1]=Math.min(ne[1],ce[1])}p({type:"interval",intervals:I})},M=()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",M),u=!1,f&&(n("move"),f=null)};document.addEventListener("mousemove",k),document.addEventListener("mouseup",M)}),t.addInteractionEventListener("click",(v,w)=>{w.uiEvent.button==0&&c&&(w.stopPropagation(),c=!1)},!0);const y=v=>wM(d(),b(v));t.addInteractionEventListener("dblclick",(v,w)=>{y(w.point)&&(m(),w.stopPropagation())},!0),t.addInteractionEventListener("mousemove",(v,w)=>{y(w.point)?u||(l=!0,f||n("move")):(l=!1,f||n(null))})}};function w3(e){if(e!=null&&e.fill||e!=null&&e.fillOpacity||e!=null&&e.shadowOpacity)return{configurableVisibility:!1,data:{values:[{}]},mark:{color:e.fill,opacity:e.fillOpacity??(e.fill?1:0),type:"rect",clip:!1,tooltip:null,minHeight:1,minOpacity:0,shadowBlur:e.shadowBlur,shadowColor:e.shadowColor,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowOpacity:e.shadowOpacity}}}function v3(e){if(!(!e||!e.stroke||e.strokeWidth===0||e.strokeOpacity===0))return{configurableVisibility:!1,resolve:{scale:{x:"excluded",y:"excluded"},axis:{x:"excluded",y:"excluded"}},data:{values:[{x:0,y:0,x2:1,y2:0},{x:1,y:0,x2:1,y2:1},{x:1,y:1,x2:0,y2:1},{x:0,y:1,x2:0,y2:0}]},mark:{size:e.strokeWidth??1,color:e.stroke??"lightgray",strokeCap:"square",opacity:e.strokeOpacity??1,type:"rule",clip:!1,tooltip:null},encoding:{x:{field:"x",type:"quantitative",scale:null},y:{field:"y",type:"quantitative",scale:null},x2:{field:"x2"},y2:{field:"y2"}}}}class $N extends la{constructor(n,r,i,o,s,a,l){super(n,r,i,o,s,l);be(this,We);be(this,al,1/0);be(this,ll,10);be(this,Pn,[]);be(this,Ss,{});be(this,cl,0);this.spec=n,xe(this,ll,n.spacing??10),xe(this,al,a),xe(this,Pn,[]),this.wrappingFacet=!1}appendChild(n){n.layoutParent??(n.layoutParent=this),N(this,Pn).push(new Pg(n,this,N(this,cl))),Ek(this,cl)._++}setChildren(n){xe(this,Pn,[]);for(const r of n)this.appendChild(r)}replaceChild(n,r){const i=N(this,Pn).findIndex(o=>o.view==n);if(i>=0)N(this,Pn)[i]=new Pg(r,this,N(this,cl));else throw new Error("Not my child view!")}get children(){return N(this,Pn).map(n=>n.view)}get childCount(){return N(this,Pn).length}async createAxes(){const n=[];for(const r of ta){const i=this.resolutions.axis[r];if(i){const o=i.getAxisProps();if(o){const s={title:i.getTitle(),orient:xh[r][0],...o},a=new Fg(s,i.scaleResolution.type,this.context,this,this);n.push(a.initializeChildren()),N(this,Ss)[r]=a}}}return Promise.all([...n,...N(this,Pn).map(r=>r.createAxes())])}*[Symbol.iterator](){for(const n of N(this,Pn))yield*n.getChildren();for(const n of Object.values(N(this,Ss)))yield n}getOverhang(){return he(this,We,Nk).call(this).union(he(this,We,Gd).call(this))}getSize(){return this._cache("size",()=>new Kr(he(this,We,oy).call(this,"column"),he(this,We,oy).call(this,"row")).addPadding(he(this,We,Gd).call(this)))}render(n,r,i={}){if(super.render(n,r,i),!this.isConfiguredVisible())return;this.layoutParent||(r=r.shrink(this.getPadding())),r=r.shrink(he(this,We,Gd).call(this)),n.pushView(this,r);const o={devicePixelRatio:this.context.devicePixelRatio},s=Ic(he(this,We,iy).call(this,"column"),r.width,o),a=Ic(he(this,We,iy).call(this,"row"),r.height,o),l=new c3(N(this,We,Ts).length,N(this,al)??1/0),c=u=>Math.round(u*devicePixelRatio)/devicePixelRatio;for(const[u,f]of N(this,We,Ts).entries()){const{view:h,axes:d,gridLines:p,background:m,backgroundStroke:b,title:g,selectionRect:y}=f,[v,w]=l.getCellCoords(u),S=s[he(this,We,sy).call(this,"column",v)],E=a[he(this,We,sy).call(this,"row",w)],k=h.getViewportSize(),M=h.getSize(),D=h.getOverhang(),B=S.location-D.left,I=E.location-D.top,q=(Q,X)=>(Q[X].grow?(X=="width"?S:E).size:Q[X].px)+D[X],Z=q(k,"width"),ne=q(k,"height"),J=q(M,"width"),ce=q(M,"height"),ae=f.scrollbars.horizontal,we=f.scrollbars.vertical,me=ae?()=>c(ae.viewportOffset):()=>0,U=we?()=>c(we.viewportOffset):()=>0,Ae=new jn(()=>r.x+B,()=>r.y+I,()=>Z,()=>ne),Ce=h.isScrollable(),H=Ce?new jn(()=>r.x+B-me(),()=>r.y+I-U(),()=>J,()=>ce):Ae;f.coords=Ae;const ze=i.clipRect?Ae.intersect(i.clipRect):Ae;m==null||m.render(n,ze,{...i,clipRect:void 0});for(const Q of Object.values(p))Q.render(n,Ae,i);const qe=YN(h)||Ce;qe&&h.render(n,H,{...i,clipRect:ze}),b==null||b.render(n,ze,{...i,clipRect:void 0});for(const[Q,X]of Object.entries(d)){const re=Q=="left"||Q=="right"?"vertical":"horizontal",ie=f.scrollbars[re],ye=ie?Ae.modify(re=="vertical"?{y:()=>H.y,height:ce}:{x:()=>H.x,width:J}):Ae,L=Og(ye,Q,X);let R=i.clipRect;ie&&(R=L.intersect(R).intersect(ie?Ae.modify(re=="vertical"?{x:-1e5,width:2e5}:{y:-1e5,height:2e5}):void 0)),X.render(n,L,{...i,clipRect:R})}for(const Q of Object.values(N(this,Ss))){const re=Q.axisProps.orient;(re=="left"&&v==0||re=="right"&&v==l.nCols-1||re=="top"&&w==0||re=="bottom"&&w==l.nRows-1)&&Q.render(n,Og(Ae.shrink(f.view.getOverhang()),re,Q),i)}qe||h.render(n,H,i),y==null||y.render(n,H,i);for(const Q of Object.values(f.scrollbars))Q.updateScrollbar(Ae,H),Q.render(n,r,i);g==null||g.render(n,Ae,i)}n.popView(this)}propagateInteractionEvent(n){if(this.handleInteractionEvent(void 0,n,!0),n.stopped)return;const r=N(this,We,Ts).find(o=>o.coords.containsPoint(n.point.x,n.point.y));for(const o of Object.values((r==null?void 0:r.scrollbars)??{}))if(o.coords.containsPoint(n.point.x,n.point.y)&&(o.propagateInteractionEvent(n),n.stopped))return;const i=r==null?void 0:r.view;if(i){if(i.propagateInteractionEvent(n),n.stopped)return;(i instanceof St||i instanceof Ui)&&p3(n,r.coords,o=>he(this,We,zk).call(this,r.coords,r.view,o),this.context.getCurrentHover(),this.context.animator)}n.stopped||this.handleInteractionEvent(void 0,n,!1)}getDefaultResolution(n,r){return"independent"}}al=new WeakMap,ll=new WeakMap,Pn=new WeakMap,Ss=new WeakMap,cl=new WeakMap,We=new WeakSet,Ts=function(){return N(this,Pn).filter(n=>n.view.isConfiguredVisible())},Lk=function(){return new c3(N(this,We,Ts).length,N(this,al)??1/0)},Vu=function(n){const r=n=="column"?"width":"height",i=(o,s)=>o.map(a=>{const c=N(this,We,Ts)[a].getOverhangAndPadding();return n=="column"?s?c.right:c.left:s?c.bottom:c.top}).reduce((a,l)=>Math.max(a,l),0);return this._cache(`size/directionSizes/${n}`,()=>N(this,We,Lk)[n=="column"?"colIndices":"rowIndices"].map(o=>({axisBefore:i(o,0),axisAfter:i(o,1),view:OO(o.map(s=>N(this,We,Ts)[s].view.getViewportSize()[r]))})))},iy=function(n){const r=he(this,We,Vu).call(this,n),i=[];i.push(_c);for(const[o,s]of r.entries())o>0&&i.push({px:N(this,ll),grow:0}),(o==0||this.wrappingFacet)&&i.push(_c),i.push({px:s.axisBefore,grow:0}),i.push(s.view),i.push({px:s.axisAfter,grow:0}),(o==r.length-1||this.wrappingFacet)&&i.push(_c);return i},oy=function(n){let r=0,i=0;const o=n=="row"?this.spec.height:this.spec.width;if(o||o===0)return DA(o);const s=he(this,We,Vu).call(this,n);for(const[a,l]of s.entries())a>0&&(i+=N(this,ll)),(a==0||this.wrappingFacet)&&(i+=0),i+=l.axisBefore,i+=l.view.px??0,r+=l.view.grow??0,i+=l.axisAfter,(a==s.length-1||this.wrappingFacet)&&(i+=0);return{px:i,grow:r}},sy=function(n,r){return n=="row"&&this.wrappingFacet?1+6*r+2:2+4*r+1},Nk=function(){const n=he(this,We,Vu).call(this,"column"),r=he(this,We,Vu).call(this,"row");return!n.length||!r.length?Vt.zero():new Vt(r.at(0).axisBefore,n.at(-1).axisAfter,r.at(-1).axisAfter,n.at(0).axisBefore)},Gd=function(){const n=r=>{const i=Bg[r],o=N(this,Ss)[i];return(o==null?void 0:o.axisProps.orient)!==r?0:Math.max(o.getPerpendicularSize()+(o.axisProps.offset??0),0)};return new Vt(n("top"),n("right"),n("bottom"),n("left"))},zk=function(n,r,i){for(const[o,s]of Object.entries(WN(r))){if(s.size<=0)continue;const a=n.normalizePoint(i.x,i.y),l=n.normalizePoint(i.x+i.xDelta,i.y+i.yDelta),c={x:l.x-a.x,y:l.y-a.y};for(const u of s)u.zoom(2**i.zDelta,o=="y"?1-a[o]:a[o],o=="x"?c.x:-c.y)}this.context.animator.requestRender()};function WN(e){const t={x:new Set,y:new Set};return e.visit(n=>{for(const[r,i]of Object.entries(t)){const o=n.getScaleResolution(r);o&&o.isZoomable()&&i.add(o)}}),t}function YN(e){let t=!0;return e.visit(n=>{n instanceof St&&t&&(t=n.mark.properties.clip===!0)}),t}function Og(e,t,n){const r=n.axisProps,i=n.getPerpendicularSize();if(t=="bottom")return e.translate(0,e.height+r.offset).modify({height:i});if(t=="top")return e.translate(0,-i-r.offset).modify({height:i});if(t=="left")return e.translate(-i-r.offset,0).modify({width:i});if(t=="right")return e.translate(e.width+r.offset,0).modify({width:i})}class Zo extends $N{constructor(t,n,r,i,o){super(t,n,r,i,o,Lg(t)?t.columns:Sh(t)?1:1/0),this.spec=t}async initializeChildren(){const t=this.spec,n=Lg(t)?t.concat:Sh(t)?t.vconcat:t.hconcat;this.setChildren(await Promise.all(n.map((r,i)=>this.context.createOrImportView(r,this,this,"grid"+i)))),await this.createAxes()}getDefaultResolution(t,n){return n=="axis"?"independent":Sh(this.spec)&&t==="x"||E3(this.spec)&&t==="y"?"shared":"independent"}}const x3="viewRoot";class QN{constructor(t={}){be(this,ul,new Map);this.options={allowImport:!0,wrapRoot:!0,...t};const n=r=>(i,o,s,a,l)=>new r(i,o,s,a,i.name??l);this.addViewType(Eh,n(Ui)),this.addViewType(Ah,n(St)),this.addViewType(Sh,n(Zo)),this.addViewType(E3,n(Zo)),this.addViewType(Lg,n(Zo)),this.addViewType(S3,()=>{throw new Error("SampleView is not supported by the @genome-spy/core package. Use @genome-spy/app instead!")})}addViewType(t,n){N(this,ul).set(t,n)}createView(t,n,r,i,o){for(const[s,a]of N(this,ul))if(s(t))return a(t,n,r,i,o);throw new Error("Invalid spec, cannot figure out the view type from the properties: "+JSON.stringify([...Object.keys(t)]))}isViewSpec(t){const n=[...N(this,ul).keys()].filter(r=>r(t));if(n.length>1)throw new Error("Ambiguous spec. Cannot create a view!");return n.length==1}async createOrImportView(t,n,r,i,o,s){let a;if(KN(t)){let u;if("url"in t.import)if(this.options.allowImport)u=await iN(t,i.getBaseUrl(),n);else throw new zi("Importing views is not allowed!",r);else if("template"in t.import)u=A3(t.import.template,i);else throw new Error("Invalid import: "+JSON.stringify(t));s==null||s(u),ZN(u,t),a=u}else a=t;const l=u=>{var f;return(f=u==null?void 0:u.params)==null?void 0:f.some(h=>Fx(h)&&fh(h.select).type=="interval")};!i&&this.options.wrapRoot&&(Ah(a)||Eh(a)||l(a))&&o===x3&&(a={name:"implicitRoot",vconcat:[a]});const c=this.createView(a,n,r,i,o);return c instanceof la&&await c.initializeChildren(),c}}ul=new WeakMap;function A3(e,t){var r,i;const n=(i=(r=t.spec)==null?void 0:r.templates)==null?void 0:i[e];if(n)return structuredClone(n);if(t.dataParent)return A3(e,t.dataParent);throw new Error(`Cannot find template "${e}" in current view or its ancestors!`)}function ZN(e,t){t.name!=null&&(e.name=t.name);const n=Zt(t.params)?t.params:nn(t.params)?Object.entries(t.params).map(([r,i])=>({name:r,value:i})):[];if(n.length){e.params??(e.params=[]);for(const r of n){const i=e.params.findIndex(o=>o.name==r.name);i>=0&&(e.params[i]=r)}for(const r of n)e.params.some(i=>i.name==r.name)||e.params.push(r)}}function Ah(e){return"mark"in e&&(lt(e.mark)||nn(e.mark))}function Eh(e){return"layer"in e&&nn(e.layer)}function XN(e){return e&&(Ah(e)||Eh(e))&&"aggregateSamples"in e}function KN(e){return"import"in e}function Sh(e){return"vconcat"in e&&Zt(e.vconcat)}function E3(e){return"hconcat"in e&&Zt(e.hconcat)}function Lg(e){return"concat"in e&&Zt(e.concat)}function S3(e){return"samples"in e&&nn(e.samples)&&"spec"in e&&nn(e.spec)}function C3(e){const t=Math.floor(Math.random()*16777215).toString(16),n=[];for(const r of e.paramConfigs.values()){if(!rg(r))continue;const i=r.bind;if(!i||!("input"in i))continue;const o=r.name,s=e.getSetter(o),a=e.getValue(o),l=i.name??o,c=i.debounce?Yo(s,i.debounce,!1):s,u=`${t}-param-${o}`;if(i.input=="range")n.push(K`<label for=${u}>${l}</label>
2224
+ `:"";return K`${l}${s}`}class la extends MA{constructor(t,n,r,i,o,s){super(t,n,r,i,o,s),this.spec=t}async initializeChildren(){}*[Symbol.iterator](){}replaceChild(t,n){throw new Error("Not implemented")}visit(t){let n;try{n=t(this)}catch(r){throw r.view=this,r}if(n===$o)return n;if(n!==BA){t.beforeChildren&&t.beforeChildren(this);for(const r of this){const i=r.visit(t);if(i===$o)return i}t.afterChildren&&t.afterChildren(this),t.postOrder&&t.postOrder(this)}}findDescendantByPath(t){for(const n of this)if(n.name===t[0]){if(t.length==1)return n;if(n instanceof la)return n.findDescendantByPath(t.slice(1))}}findChildByName(t){for(const n of this)if(n.name===t)return n}findDescendantByName(t){let n;return this.visit(r=>{if(r.name==t)return n=r,$o}),n}getDefaultResolution(t,n){return"shared"}}class Ui extends la{constructor(n,r,i,o,s,a){super(n,r,i,o,s,{layersChildren:!0,...a});be(this,fi,[]);this.spec=n,this.needsAxes={x:!0,y:!0}}async initializeChildren(){xe(this,fi,await Promise.all(this.spec.layer.map((n,r)=>this.context.createOrImportView(n,this,this,"grid"+r,i=>{if(!Eh(i)&&!Ah(i))throw new zi("LayerView accepts only unit or layer specs as children!",this)}))))}get children(){return N(this,fi).slice()}*[Symbol.iterator](){for(const n of N(this,fi))yield n}render(n,r,i={}){if(super.render(n,r,i),!!this.isConfiguredVisible()){n.pushView(this,r);for(const o of N(this,fi))o.render(n,r,i);n.popView(this)}}propagateInteractionEvent(n){this.handleInteractionEvent(void 0,n,!0);for(let r=N(this,fi).length-1;r>=0;r--)if(N(this,fi)[r].propagateInteractionEvent(n),n.stopped)return;this.handleInteractionEvent(void 0,n,!1)}}fi=new WeakMap;class c3{constructor(t,n){this.n=t,this.maxCols=n??1/0}get nRows(){return this.maxCols==1/0?1:Math.ceil(this.n/this.maxCols)}get nCols(){return Math.min(this.n,this.maxCols)}get rowIndices(){const t=[],n=this.nCols,r=this.nRows;for(let i=0;i<r;i++){const o=[];t.push(o);for(let s=0;s<n;s++){const a=i*n+s;a<this.n&&o.push(a)}}return t}get colIndices(){const t=[],n=this.nCols,r=this.nRows;for(let i=0;i<n;i++){const o=[];t.push(o);for(let s=0;s<r;s++){const a=s*n+i;a<this.n&&o.push(a)}}return t}getCellIndex(t,n){let r=0;if(this.maxCols==1/0)r=n==0?t:void 0;else{if(t>=this.maxCols)return;r=n*this.nCols+t}return r<this.n?r:void 0}getCellCoords(t){if(!(t<0||t>=this.n))return[t%this.nCols,Math.floor(t/this.nCols)]}}const kN="chromosome_ticks_and_labels",TN={x:"width",y:"height"};function Rg(e){return e=="x"?"y":"x"}const xh={x:["bottom","top"],y:["left","right"]},Bg=Object.fromEntries(Object.entries(xh).map(([e,t])=>t.map(n=>[n,e])).flat(1));function Hi(e){return Bg[e]}class Fg extends Ui{constructor(t,n,r,i,o,s){const a=n=="locus",l={...a?_N:u3,...IN(n,t),...t};super(a?DN(l,n):f3(l,n),r,i,o,`axis_${t.orient}`,{blockEncodingInheritance:!0,contributesToScaleDomain:!1,...s}),this.axisProps=l}getSize(){const t={px:this.getPerpendicularSize()},n={grow:1};return Bg[this.axisProps.orient]=="x"?new Kr(n,t):new Kr(t,n)}getPerpendicularSize(){return Mg(this.axisProps)}isPickingSupported(){return!1}}function Mg(e){const t=Hi(e.orient);let n=e.ticks&&e.tickSize||0;return e.labels&&(n+=e.labelPadding,t=="x"?n+=e.labelFontSize:n+=30),e.title&&(n+=e.titlePadding+e.titleFontSize),n=Math.min(e.maxExtent||1/0,Math.max(e.minExtent||0,n)),n}const u3={values:null,minExtent:20,maxExtent:1/0,offset:0,domain:!0,domainWidth:1,domainColor:"gray",domainDash:null,domainDashOffset:0,domainCap:"square",ticks:!0,tickSize:5,tickWidth:1,tickColor:"gray",tickDash:null,tickDashOffset:0,tickCap:"square",tickCount:null,tickMinStep:null,labels:!0,labelAlign:"center",labelBaseline:"middle",labelPadding:4,labelFontSize:10,labelLimit:180,labelColor:"black",format:null,titleColor:"black",titleFont:"sans-serif",titleFontSize:10,titlePadding:3};function IN(e,t){const n=t.orient,r=e=="nominal"||e=="ordinal";let i="center",o="middle",s=t.labelAngle??((n=="top"||n=="bottom")&&r?-90:0);switch(n){case"left":i="right";break;case"right":i="left";break;case"top":case"bottom":Math.abs(s)>30?(i=s>0==(n=="bottom")?"left":"right",o="middle"):o=n=="top"?"alphabetic":"top";break}return{labelAlign:i,labelAngle:s,labelBaseline:o}}function f3(e,t){const n={...e,extent:Mg(e)},r=Hi(n.orient),i=Rg(r),o=n.orient=="bottom"||n.orient=="right"?1:-1,s=n.orient=="bottom"||n.orient=="left"?1:0,a=()=>({name:"domain",data:{values:[{}]},mark:{type:"rule",clip:!1,strokeDash:n.domainDash,strokeCap:n.domainCap,color:n.domainColor,[i]:s,size:n.domainWidth}}),l=()=>({name:"labels",mark:{type:"text",clip:!1,align:n.labelAlign,angle:n.labelAngle,baseline:n.labelBaseline,[i+"Offset"]:(n.tickSize+n.labelPadding)*o,[i]:s,size:n.labelFontSize,color:n.labelColor,minBufferSize:1500},encoding:{[r]:{field:"value",type:t},text:{field:"label"}}}),c=()=>({name:"ticks",mark:{type:"rule",clip:!1,strokeDash:n.tickDash,strokeCap:n.tickCap,color:n.tickColor,size:n.tickWidth,minBufferSize:300},encoding:{[i]:{value:s},[i+"2"]:{value:s-n.tickSize/n.extent*(s?1:-1)}}}),u=()=>({name:"title",data:{values:[{}]},mark:{type:"text",clip:!1,align:"center",baseline:n.orient=="bottom"?"bottom":"top",angle:[0,90,0,-90][["top","right","bottom","left"].indexOf(n.orient)],text:n.title,color:n.titleColor,[r]:.5,[i]:1-s}}),f=()=>{const d={name:"ticks_and_labels",encoding:{[r]:{field:"value",type:t}},layer:[]};return n.ticks&&d.layer.push(c()),n.labels&&d.layer.push(l()),d},h={resolve:{scale:{[r]:"forced"}},[TN[Rg(r)]]:n.extent,data:{lazy:{type:"axisTicks",channel:r,axis:e}},layer:[]};return n.domain&&h.layer.push(a()),(n.ticks||n.labels)&&h.layer.push(f()),n.title&&h.layer.push(u()),h}const _N={...u3,chromTicks:!0,chromTickSize:18,chromTickWidth:1,chromTickColor:"#989898",chromTickDash:[4,2],chromTickDashOffset:1,chromLabels:!0,chromLabelFontSize:13,chromLabelFontWeight:"normal",chromLabelFontStyle:"normal",chromLabelColor:"black",chromLabelAlign:"left",chromLabelPadding:7};function DN(e,t){const n={...e,extent:Mg(e)},r=Hi(n.orient),i=Rg(r),o=n.orient=="bottom"||n.orient=="left"?1:0,s=()=>({name:"chromosome_ticks",mark:{type:"rule",strokeDash:e.chromTickDash,strokeDashOffset:e.chromTickDashOffset,[i]:o,[i+"2"]:o-n.chromTickSize/n.extent*(o?1:-1),color:e.chromTickColor,size:n.chromTickWidth}}),a=()=>{let u;switch(n.orient){case"top":u={y:0,angle:0,paddingX:4,dy:-n.chromLabelPadding,viewportEdgeFadeWidthLeft:20,viewportEdgeFadeWidthRight:20,viewportEdgeFadeDistanceRight:-10,viewportEdgeFadeDistanceLeft:-20};break;case"bottom":u={y:1,angle:0,paddingX:4,dy:n.chromLabelPadding+n.chromLabelFontSize*.73,viewportEdgeFadeWidthLeft:20,viewportEdgeFadeWidthRight:20,viewportEdgeFadeDistanceRight:-10,viewportEdgeFadeDistanceLeft:-20};break;case"left":u={x:1,angle:-90,paddingY:4,dy:-n.chromLabelPadding,viewportEdgeFadeWidthBottom:20,viewportEdgeFadeWidthTop:20,viewportEdgeFadeDistanceBottom:-20,viewportEdgeFadeDistanceTop:-10};break;case"right":u={x:0,angle:90,align:"right",paddingY:4,dy:-n.chromLabelPadding};break;default:u={}}return{name:"chromosome_labels",mark:{type:"text",size:n.chromLabelFontSize,font:n.chromLabelFont,fontWeight:n.chromLabelFontWeight,fontStyle:n.chromLabelFontStyle,color:n.chromLabelColor,align:e.chromLabelAlign,baseline:"alphabetic",clip:!1,...u},encoding:{[r+"2"]:{field:"continuousEnd",type:t},text:{field:"name"}}}};let l;switch(n.orient){case"bottom":case"top":l={};break;case"left":l={labelAngle:-90,labelAlign:"center",labelPadding:6};break;case"right":l={labelAngle:90,labelAlign:"center",labelPadding:6};break;default:l={}}const c=f3({...e,...l},t);if(e.chromTicks||e.chromLabels){const u={name:kN,data:{lazy:{type:"axisGenome",channel:Hi(n.orient)}},encoding:{[r]:{field:"continuousStart",type:t,band:0}},layer:[]};if(e.chromTicks&&u.layer.push(s()),e.chromLabels){u.layer.push(a());let f;c.layer.filter(h=>h.name=="ticks_and_labels").forEach(h=>h.layer.filter(d=>d.name=="labels").forEach(d=>{f=d.mark})),f&&(n.orient=="top"||n.orient=="bottom"?(f.viewportEdgeFadeWidthLeft=30,f.viewportEdgeFadeDistanceLeft=40):(f.viewportEdgeFadeWidthBottom=30,f.viewportEdgeFadeDistanceBottom=40))}c.layer.push(u)}return c}class RN{constructor(t){be(this,As);be(this,co,0);be(this,uo,0);xe(this,As,new Array(t))}push(t){N(this,As)[N(this,co)]=t,xe(this,co,(N(this,co)+1)%this.size),xe(this,uo,Math.min(N(this,uo)+1,this.size))}get(){const t=N(this,As);return N(this,uo)<this.size?t.slice(0,N(this,uo)):t.slice(N(this,co),this.size).concat(t.slice(0,N(this,co)))}get size(){return N(this,As).length}get length(){return N(this,uo)}}As=new WeakMap,co=new WeakMap,uo=new WeakMap;let Qo,h3=0;function d3(){return performance.now()-h3<50}function BN(e){return function(...t){h3=performance.now(),e(...t)}}function p3(e,t,n,r,i){if(n=BN(n),e.type=="wheel"){e.uiEvent.preventDefault();const o=e.uiEvent,s=o.deltaMode?120:1;if(!o.deltaX&&!o.deltaY)return;Qo==null||Qo.stop();let{x:a,y:l}=e.point;if(r){const c=r.mark.encoders;c.x&&!c.x2&&!c.x.constant&&(a=+c.x(r.datum)*t.width+t.x),c.y&&!c.y2&&!c.y.constant&&(l=(1-+c.y(r.datum))*t.height+t.y)}Math.abs(o.deltaX)<Math.abs(o.deltaY)?n({x:a,y:l,xDelta:0,yDelta:0,zDelta:o.deltaY*s/300}):n({x:a,y:l,xDelta:-o.deltaX*s,yDelta:0,zDelta:0})}else if(e.type=="mousedown"&&e.uiEvent.button===0){Qo&&Qo.stop();const o=new RN(30),s=e.uiEvent;s.preventDefault();let a=xn.fromMouseEvent(s);const l=f=>{const h=xn.fromMouseEvent(f);o.push({point:h,timestamp:performance.now()});const d=h.subtract(a);n({x:a.x,y:a.y,xDelta:d.x,yDelta:d.y,zDelta:0}),a=h},c=()=>{const h=performance.now(),d=o.get().filter(v=>h-v.timestamp<160);if(d.length<5||!i||FN(d))return;const p=d.at(-1),m=d[0],b=p.point.subtract(m.point).multiply(1/(p.timestamp-m.timestamp));let g=a.x,y=a.y;Qo=_g(i,v=>{n({x:v.x,y:v.y,xDelta:g-v.x,yDelta:y-v.y,zDelta:0}),g=v.x,y=v.y},150,.5,{x:g,y}),Qo({x:a.x-b.x*250,y:a.y-b.y*250})},u=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",u),c()};document.addEventListener("mouseup",u,!1),document.addEventListener("mousemove",l,!1)}}function FN(e){const t=e[Math.floor(e.length/2)],n=t.point.subtract(e[0].point).multiply(t.timestamp-e[0].timestamp),r=e.at(-1).point.subtract(t.point).multiply(e.at(-1).timestamp-t.timestamp),i=n.length;return r.length/i<.4}class MN extends Ui{constructor(t,n,r,i,o,s){const l={...n=="locus"?PN:g3,...t};super(zN(l,n),r,i,o,`axisGrid_${t.orient}`,{blockEncodingInheritance:!0,contributesToScaleDomain:!1,...s}),this.axisProps=l}getOrient(){return this.axisProps.orient}isPickingSupported(){return!1}}const g3={values:null,grid:!1,gridCap:"butt",gridColor:"lightgray",gridDash:null,gridOpacity:1,gridWidth:1,tickCount:null,tickMinStep:null},PN={...g3,chromGrid:!1,chromGridCap:"butt",chromGridColor:"gray",chromGridDash:[1,5],chromGridOpacity:1,chromGridWidth:1};function ON(e,t){const n=e,r=Hi(n.orient);return{name:"grid_lines",data:{lazy:{type:"axisTicks",channel:r,axis:e}},mark:{type:"rule",strokeDash:n.gridDash,strokeCap:n.gridCap,color:n.gridColor,size:n.gridWidth,opacity:n.gridOpacity,minBufferSize:300},encoding:{[r]:{field:"value",type:t}}}}function LN(e,t){const n=e,r=Hi(n.orient);return{name:"chromosome_lines",data:{lazy:{type:"axisGenome",channel:r}},mark:{type:"rule",strokeDash:n.chromGridDash,strokeCap:n.chromGridCap,color:n.chromGridColor,size:n.chromGridWidth,opacity:n.chromGridOpacity},encoding:{[r]:{field:"continuousStart",type:t,band:0}}}}function NN(e,t){const n=e,r=Hi(n.orient);return{name:"chromosome_fill",data:{lazy:{type:"axisGenome",channel:r}},mark:{type:"rect"},encoding:{[r]:{field:"continuousStart",type:t,band:0},[r+"2"]:{field:"continuousEnd",band:0},fill:{field:"odd",type:"nominal",scale:{domain:[!1,!0],range:[n.chromGridFillEven??"white",n.chromGridFillOdd??"white"]}},opacity:{field:"odd",type:"nominal",scale:{type:"ordinal",domain:[!1,!0],range:[n.chromGridFillEven?1:0,n.chromGridFillOdd?1:0]}}}}}function zN(e,t){const n={...e},r=[];return n.chromGrid&&(n.chromGridFillOdd||n.chromGridFillEven)&&r.push(NN(n,t)),n.chromGrid&&n.chromGridOpacity>0&&r.push(LN(n,t)),n.grid&&n.gridOpacity>0&&r.push(ON(n,t)),{name:"grid_layers",configurableVisibility:!1,resolve:{scale:{[Hi(e.orient)]:"forced",fill:"independent",opacity:"independent"}},layer:r}}const m3={anchor:"middle",frame:"group",offset:10,orient:"top",align:void 0,angle:0,baseline:"alphabetic",dx:0,dy:0,color:void 0,font:void 0,fontSize:12,fontStyle:"normal",fontWeight:"normal"},UN={orient:"left",anchor:"middle",align:"right",baseline:"middle",angle:0,fontSize:12},HN={orient:"top",anchor:"start",align:"left",baseline:"top",offset:-10,dx:10,fontSize:12},GN={start:0,middle:.5,end:1},jN={start:"left",middle:"center",end:"right"};function VN(e){if(!e)return;const t=lt(e)?{text:e}:e;if(!t.text||t.orient=="none")return;const n={"track-title":UN,overlay:HN}[t.style]??{},r={...m3,...n,...t};let i={},o={x:0,y:0};const s=GN[r.anchor??"middle"];switch(r.orient){case"top":o={x:s,y:1},i={baseline:"alphabetic",angle:0};break;case"right":o={x:1,y:1-s},i={baseline:"alphabetic",angle:90};break;case"bottom":o={x:s,y:0},i={baseline:"top",angle:0};break;case"left":o={x:0,y:s},i={baseline:"alphabetic",angle:-90};break}const a={...m3,...i,...n,...t},l={xOffset:0,yOffset:0};switch(r.orient){case"top":l.yOffset=-a.offset;break;case"right":l.xOffset=a.offset;break;case"bottom":l.yOffset=a.offset;break;case"left":l.xOffset=-a.offset;break}return{configurableVisibility:!1,data:{values:[{}]},mark:{type:"text",tooltip:null,clip:!1,...o,...l,text:a.text,align:a.align??jN[a.anchor],angle:a.angle,baseline:a.baseline,dx:a.dx,dy:a.dy,color:a.color,font:a.font,size:a.fontSize,fontStyle:a.fontStyle,fontWeight:a.fontWeight}}}class b3 extends St{constructor(n,r){const i={scrollbarSize:8,scrollbarPadding:2};super({data:{values:[{}]},mark:{type:"rect",fill:"#b0b0b0",fillOpacity:.6,stroke:"white",strokeWidth:1,strokeOpacity:1,cornerRadius:5,clip:!1},configurableVisibility:!1},n.layoutParent.context,n.layoutParent,n.view,"scrollbar-"+r,{blockEncodingInheritance:!0});be(this,sl);be(this,Mu,jn.ZERO);be(this,fo,0);be(this,Es,0);tn(this,"viewportOffset",0);this.config=i,xe(this,sl,r),this.interpolateViewportOffset=_g(this.context.animator,o=>{this.viewportOffset=o.x},50,.4,{x:this.viewportOffset}),this.addInteractionEventListener("mousedown",(o,s)=>{if(s.stopPropagation(),N(this,fo)<=0)return;const a=d=>r=="vertical"?d.clientY:d.clientX,l=s.uiEvent;l.preventDefault();const c=this.scrollOffset,u=a(l),f=d=>{const p=Xr(a(d)-u+c,0,N(this,fo));this.interpolateViewportOffset({x:p/N(this,fo)*N(this,Es)})},h=()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",h)};document.addEventListener("mouseup",h,!1),document.addEventListener("mousemove",f,!1)})}get scrollOffset(){return this.viewportOffset/N(this,Es)*N(this,fo)}render(n,r,i){super.render(n,N(this,Mu),i)}updateScrollbar(n,r){const i=this.config.scrollbarPadding,o=this.config.scrollbarSize,s=N(this,sl)=="horizontal"?"width":"height",a=Math.min(1,n[s]/r[s]),l=n[s]-2*i,c=a*l;xe(this,fo,l-c),xe(this,Es,r[s]-n[s]),this.viewportOffset=Xr(this.viewportOffset,0,N(this,Es)),xe(this,Mu,N(this,sl)=="vertical"?new jn(()=>n.x+n.width-o-i,()=>n.y+i+this.scrollOffset,()=>o,()=>c):new jn(()=>n.x+i+this.scrollOffset,()=>n.y+n.height-o-i,()=>c,()=>o))}}sl=new WeakMap,Mu=new WeakMap,fo=new WeakMap,Es=new WeakMap;class qN extends Ui{constructor(t,n,r={}){const i=n(),o=Object.keys(i.intervals);if(["x","y"].every(c=>!o.includes(c)))throw new Error("SelectionRect requires at least one of the channels 'x' or 'y' to be present in the selection.");const s={name:"selectionRect",configurableVisibility:!1,resolve:{scale:{x:"forced",y:"forced"}},data:{values:y3(n())},encoding:{},layer:[]};o.includes("x")&&(s.encoding.x={field:"_x",type:null,title:null},s.encoding.x2={field:"_x2"}),o.includes("y")&&(s.encoding.y={field:"_y",type:null,title:null},s.encoding.y2={field:"_y2"}),s.layer.push({name:"selectionRectRect",mark:{type:"rect",clip:!0,fill:"#808080",fillOpacity:.05,stroke:"black",strokeWidth:1,strokeOpacity:.2,...r}});const a=c=>{const u=t.view.getScaleResolution(c);return`format(datum._${c}2 - datum._${c}, '.3s')`+(u.type==="locus"?" + 'b'":"")},l=r.measure=="inside"?9:r.measure=="outside"?-9:0;o.includes("x")&&l!=0&&s.layer.push({name:"selectionRectTextX",mark:{type:"text",align:"center",paddingX:5,dy:l,tooltip:null},encoding:{text:{expr:a("x")},y:o.includes("y")?{field:"_y2",type:null,title:null}:{value:1},y2:null}}),o.includes("y")&&l!=0&&s.layer.push({name:"selectionRectTextY",mark:{type:"text",align:"center",paddingY:5,dy:l,tooltip:null,angle:-90},encoding:{text:{expr:a("y")},x2:null}}),super(s,t.layoutParent.context,t.layoutParent,t.view,"selectionRect",{blockEncodingInheritance:!0,contributesToScaleDomain:!1}),n.addListener(()=>{const c=n();this.context.dataFlow.findDataSourceByKey(this).updateDynamicData(y3(c))})}}function y3(e){const t=e.intervals.x,n=e.intervals.y;return!t&&!n?[]:[{_x:t==null?void 0:t[0],_x2:t==null?void 0:t[1],_y:n==null?void 0:n[0],_y2:n==null?void 0:n[1]}]}class Pg{constructor(t,n,r){be(this,Nd);if(this.layoutParent=n,this.view=t,this.serial=r,this.background=void 0,this.backgroundStroke=void 0,this.axes={},this.gridLines={},this.scrollbars={},this.selectionRect=void 0,this.title=void 0,this.coords=jn.ZERO,t.needsAxes.x||t.needsAxes.y){const i=t.spec,o="view"in i?i==null?void 0:i.view:void 0,s=w3(o);s&&(this.background=new St(s,n.context,n,t,"background"+r,{blockEncodingInheritance:!0}));const a=v3(o);a&&(this.backgroundStroke=new St(a,n.context,n,t,"backgroundStroke"+r,{blockEncodingInheritance:!0}));const l=VN(t.spec.title);if(l){const c=new St(l,n.context,n,t,"title"+r,{blockEncodingInheritance:!0});this.title=c}}t.spec.viewportWidth!=null&&(this.scrollbars.horizontal=new b3(this,"horizontal")),t.spec.viewportHeight!=null&&(this.scrollbars.vertical=new b3(this,"vertical")),he(this,Nd,Ok).call(this)}*getChildren(){this.background&&(yield this.background),this.backgroundStroke&&(yield this.backgroundStroke),this.title&&(yield this.title),yield*Object.values(this.axes),yield*Object.values(this.gridLines),yield this.view,yield*Object.values(this.scrollbars),this.selectionRect&&(yield this.selectionRect)}async createAxes(){const{view:t,axes:n,gridLines:r}=this,i=(a,l)=>{const c=a.getAxisProps();if(c===null)return;const u=c?{...c}:{};if(!u.orient){for(const f of xh[l])if(!n[f]){u.orient=f;break}if(!u.orient)throw new Error("No slots available for an axis! Perhaps a LayerView has more than two children?")}if(u.title??(u.title=a.getTitle()),!xh[l].includes(u.orient))throw new Error(`Invalid axis orientation "${u.orient}" on channel "${l}"!`);return u},o=async(a,l,c)=>{const u=i(a,l);if(u){if(n[u.orient])throw new Error(`An axis with the orient "${u.orient}" already exists!`);const f=new Fg(u,a.scaleResolution.type,this.layoutParent.context,this.layoutParent,c);n[u.orient]=f,await f.initializeChildren()}},s=async(a,l,c)=>{const u=i(a,l);if(u&&(u.grid||u.chromGrid)){const f=new MN(u,a.scaleResolution.type,this.layoutParent.context,this.layoutParent,c);r[u.orient]=f,await f.initializeChildren()}};for(const a of["x","y"])if(t.needsAxes[a]){const l=t.resolutions.axis[a];if(!l)continue;await o(l,a,t)}for(const a of["x","y"])if(t.needsAxes[a]&&t.getConfiguredOrDefaultResolution(a,"axis")!="excluded"){const l=t.getAxisResolution(a);if(!l)continue;await s(l,a,t)}if(t instanceof Ui){for(const a of t)for(const[l,c]of Object.entries(a.resolutions.axis)){const u=c.getAxisProps();u&&u.orient&&await o(c,l,a)}for(const a of t)for(const[l,c]of Object.entries(a.resolutions.axis)){const u=c.getAxisProps();u&&!u.orient&&await o(c,l,a)}}[...Object.values(n),...Object.values(r)].forEach(a=>a.visit(l=>{l instanceof St&&l.resolve("scale")}))}getOverhang(){const t=n=>{const r=this.axes[n];return r?Math.max(r.getPerpendicularSize()+(r.axisProps.offset??0),0):0};return new Vt(t("top"),t("right"),t("bottom"),t("left")).add(this.view.getOverhang())}getOverhangAndPadding(){return this.getOverhang().add(this.view.getPadding())}}Nd=new WeakSet,Ok=function(){const t=this.view,n=r=>{this.view.context.glHelper.canvas.style.cursor=r};for(const[r,i]of t.paramMediator.paramConfigs){if(!("select"in i))continue;const o=fh(i.select);if(!Dx(o))continue;const s=o.encodings,a=Object.fromEntries(s.map(v=>{const w=this.view.getScaleResolution(v),S=w==null?void 0:w.scale;if(!S||!Gt(S.type))throw new Error(`No continuous scale found for interval selection param "${r}" on channel "${v}"! Scale type is "${(S==null?void 0:S.type)??"none"}".`);return[v,w]}));if(this.selectionRect)throw new Error("Only one interval selection per container is currently allowed!");let l=!1,c=!1,u=!1,f=null;const h=(v,w)=>Object.fromEntries(s.map(S=>[S,[Math.min(v[S],w[S]),Math.max(v[S],w[S])]])),d=t.paramMediator.createExpression(r),p=t.paramMediator.getSetter(r);i.value&&p({type:"interval",intervals:i.value});const m=()=>{p(kx(s)),n(null)};this.selectionRect=new qN(this,d,o.mark),this.selectionRect.initializeChildren();const b=v=>{const w={x:0,y:0},S=t.coords.normalizePoint(v.x,v.y,!0);for(const E of s){const k=a[E].scale,M=k.invert(E=="x"?S.x:S.y);w[E]=M+(["index","locus"].includes(k.type)?.5:0)}return w},g=v=>{var M,D,B,I;const{intervals:w}=v,S=(q,Z,te)=>{const J=(we,me)=>me==null?null:a[we].scale(me),ce=J("x",q)??te,ae=J("y",Z)??te;return t.coords.denormalizePoint(ce,ae,!0)},E=S((M=w.x)==null?void 0:M[0],(D=w.y)==null?void 0:D[0],0),k=S((B=w.x)==null?void 0:B[1],(I=w.y)==null?void 0:I[1],1);return jn.create(E.x,E.y,k.x-E.x,k.y-E.y)};t.addInteractionEventListener("mousedown",(v,w)=>{if(w.uiEvent.button!=0)return;if(f=l?g(d()):null,f)n("grabbing"),c=!0;else{const D=w.point;if(Rx(d())&&(c=!0),w.uiEvent.shiftKey)m(),u=!0;else if(Rx(d())){const I=(q,Z)=>{t.removeInteractionEventListener("mouseup",I);const te=Z.point;D.subtract(te).length<2&&m()};t.addInteractionEventListener("mouseup",I);return}else return}w.stopPropagation();const S=w.point,E=xn.fromMouseEvent(w.uiEvent).subtract(S),k=D=>{const B=xn.fromMouseEvent(D).subtract(E);let I;if(f){const q=B.subtract(S),Z=f.translate(q.x,q.y);I=h(b(new xn(Z.x,Z.y)),b(new xn(Z.x2,Z.y2)))}else I=h(b(S),b(B));for(const q of s){const Z=a[q],{zoomExtent:te,scale:J}=Z,ce=I[q];if(["index","locus"].includes(J.type)&&(ce[0]=Math.ceil(ce[0]),ce[1]=Math.ceil(ce[1])),f){const ae=ce[1]-ce[0],we=te[0],me=te[1];ce[0]<we&&(ce[0]=we,ce[1]=we+ae),ce[1]>me&&(ce[1]=me,ce[0]=me-ae)}else ce[0]=Math.max(te[0],ce[0]),ce[1]=Math.min(te[1],ce[1]);ce[1]=Math.min(te[1],ce[1])}p({type:"interval",intervals:I})},M=()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",M),u=!1,f&&(n("move"),f=null)};document.addEventListener("mousemove",k),document.addEventListener("mouseup",M)}),t.addInteractionEventListener("click",(v,w)=>{w.uiEvent.button==0&&c&&(w.stopPropagation(),c=!1)},!0);const y=v=>wM(d(),b(v));t.addInteractionEventListener("dblclick",(v,w)=>{y(w.point)&&(m(),w.stopPropagation())},!0),t.addInteractionEventListener("mousemove",(v,w)=>{y(w.point)?u||(l=!0,f||n("move")):(l=!1,f||n(null))})}};function w3(e){if(e!=null&&e.fill||e!=null&&e.fillOpacity||e!=null&&e.shadowOpacity)return{configurableVisibility:!1,data:{values:[{}]},mark:{color:e.fill,opacity:e.fillOpacity??(e.fill?1:0),type:"rect",clip:!1,tooltip:null,minHeight:1,minOpacity:0,shadowBlur:e.shadowBlur,shadowColor:e.shadowColor,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowOpacity:e.shadowOpacity}}}function v3(e){if(!(!e||!e.stroke||e.strokeWidth===0||e.strokeOpacity===0))return{configurableVisibility:!1,resolve:{scale:{x:"excluded",y:"excluded"},axis:{x:"excluded",y:"excluded"}},data:{values:[{x:0,y:0,x2:1,y2:0},{x:1,y:0,x2:1,y2:1},{x:1,y:1,x2:0,y2:1},{x:0,y:1,x2:0,y2:0}]},mark:{size:e.strokeWidth??1,color:e.stroke??"lightgray",strokeCap:"square",opacity:e.strokeOpacity??1,type:"rule",clip:!1,tooltip:null},encoding:{x:{field:"x",type:"quantitative",scale:null},y:{field:"y",type:"quantitative",scale:null},x2:{field:"x2"},y2:{field:"y2"}}}}class $N extends la{constructor(n,r,i,o,s,a,l){super(n,r,i,o,s,l);be(this,We);be(this,al,1/0);be(this,ll,10);be(this,Pn,[]);be(this,Ss,{});be(this,cl,0);this.spec=n,xe(this,ll,n.spacing??10),xe(this,al,a),xe(this,Pn,[]),this.wrappingFacet=!1}appendChild(n){n.layoutParent??(n.layoutParent=this),N(this,Pn).push(new Pg(n,this,N(this,cl))),Ek(this,cl)._++}setChildren(n){xe(this,Pn,[]);for(const r of n)this.appendChild(r)}replaceChild(n,r){const i=N(this,Pn).findIndex(o=>o.view==n);if(i>=0)N(this,Pn)[i]=new Pg(r,this,N(this,cl));else throw new Error("Not my child view!")}get children(){return N(this,Pn).map(n=>n.view)}get childCount(){return N(this,Pn).length}async createAxes(){const n=[];for(const r of ta){const i=this.resolutions.axis[r];if(i){const o=i.getAxisProps();if(o){const s={title:i.getTitle(),orient:xh[r][0],...o},a=new Fg(s,i.scaleResolution.type,this.context,this,this);n.push(a.initializeChildren()),N(this,Ss)[r]=a}}}return Promise.all([...n,...N(this,Pn).map(r=>r.createAxes())])}*[Symbol.iterator](){for(const n of N(this,Pn))yield*n.getChildren();for(const n of Object.values(N(this,Ss)))yield n}getOverhang(){return he(this,We,Nk).call(this).union(he(this,We,Gd).call(this))}getSize(){return this._cache("size",()=>new Kr(he(this,We,oy).call(this,"column"),he(this,We,oy).call(this,"row")).addPadding(he(this,We,Gd).call(this)))}render(n,r,i={}){if(super.render(n,r,i),!this.isConfiguredVisible())return;this.layoutParent||(r=r.shrink(this.getPadding())),r=r.shrink(he(this,We,Gd).call(this)),n.pushView(this,r);const o={devicePixelRatio:this.context.devicePixelRatio},s=Ic(he(this,We,iy).call(this,"column"),r.width,o),a=Ic(he(this,We,iy).call(this,"row"),r.height,o),l=new c3(N(this,We,Ts).length,N(this,al)??1/0),c=u=>Math.round(u*devicePixelRatio)/devicePixelRatio;for(const[u,f]of N(this,We,Ts).entries()){const{view:h,axes:d,gridLines:p,background:m,backgroundStroke:b,title:g,selectionRect:y}=f,[v,w]=l.getCellCoords(u),S=s[he(this,We,sy).call(this,"column",v)],E=a[he(this,We,sy).call(this,"row",w)],k=h.getViewportSize(),M=h.getSize(),D=h.getOverhang(),B=S.location-D.left,I=E.location-D.top,q=(Q,X)=>(Q[X].grow?(X=="width"?S:E).size:Q[X].px)+D[X],Z=q(k,"width"),te=q(k,"height"),J=q(M,"width"),ce=q(M,"height"),ae=f.scrollbars.horizontal,we=f.scrollbars.vertical,me=ae?()=>c(ae.viewportOffset):()=>0,U=we?()=>c(we.viewportOffset):()=>0,Ae=new jn(()=>r.x+B,()=>r.y+I,()=>Z,()=>te),Ce=h.isScrollable(),H=Ce?new jn(()=>r.x+B-me(),()=>r.y+I-U(),()=>J,()=>ce):Ae;f.coords=Ae;const ze=i.clipRect?Ae.intersect(i.clipRect):Ae;m==null||m.render(n,ze,{...i,clipRect:void 0});for(const Q of Object.values(p))Q.render(n,Ae,i);const qe=YN(h)||Ce;qe&&h.render(n,H,{...i,clipRect:ze}),b==null||b.render(n,ze,{...i,clipRect:void 0});for(const[Q,X]of Object.entries(d)){const re=Q=="left"||Q=="right"?"vertical":"horizontal",ie=f.scrollbars[re],ye=ie?Ae.modify(re=="vertical"?{y:()=>H.y,height:ce}:{x:()=>H.x,width:J}):Ae,L=Og(ye,Q,X);let R=i.clipRect;ie&&(R=L.intersect(R).intersect(ie?Ae.modify(re=="vertical"?{x:-1e5,width:2e5}:{y:-1e5,height:2e5}):void 0)),X.render(n,L,{...i,clipRect:R})}for(const Q of Object.values(N(this,Ss))){const re=Q.axisProps.orient;(re=="left"&&v==0||re=="right"&&v==l.nCols-1||re=="top"&&w==0||re=="bottom"&&w==l.nRows-1)&&Q.render(n,Og(Ae.shrink(f.view.getOverhang()),re,Q),i)}qe||h.render(n,H,i),y==null||y.render(n,H,i);for(const Q of Object.values(f.scrollbars))Q.updateScrollbar(Ae,H),Q.render(n,r,i);g==null||g.render(n,Ae,i)}n.popView(this)}propagateInteractionEvent(n){if(this.handleInteractionEvent(void 0,n,!0),n.stopped)return;const r=N(this,We,Ts).find(o=>o.coords.containsPoint(n.point.x,n.point.y));for(const o of Object.values((r==null?void 0:r.scrollbars)??{}))if(o.coords.containsPoint(n.point.x,n.point.y)&&(o.propagateInteractionEvent(n),n.stopped))return;const i=r==null?void 0:r.view;if(i){if(i.propagateInteractionEvent(n),n.stopped)return;(i instanceof St||i instanceof Ui)&&p3(n,r.coords,o=>he(this,We,zk).call(this,r.coords,r.view,o),this.context.getCurrentHover(),this.context.animator)}n.stopped||this.handleInteractionEvent(void 0,n,!1)}getDefaultResolution(n,r){return"independent"}}al=new WeakMap,ll=new WeakMap,Pn=new WeakMap,Ss=new WeakMap,cl=new WeakMap,We=new WeakSet,Ts=function(){return N(this,Pn).filter(n=>n.view.isConfiguredVisible())},Lk=function(){return new c3(N(this,We,Ts).length,N(this,al)??1/0)},Vu=function(n){const r=n=="column"?"width":"height",i=(o,s)=>o.map(a=>{const c=N(this,We,Ts)[a].getOverhangAndPadding();return n=="column"?s?c.right:c.left:s?c.bottom:c.top}).reduce((a,l)=>Math.max(a,l),0);return this._cache(`size/directionSizes/${n}`,()=>N(this,We,Lk)[n=="column"?"colIndices":"rowIndices"].map(o=>({axisBefore:i(o,0),axisAfter:i(o,1),view:OO(o.map(s=>N(this,We,Ts)[s].view.getViewportSize()[r]))})))},iy=function(n){const r=he(this,We,Vu).call(this,n),i=[];i.push(_c);for(const[o,s]of r.entries())o>0&&i.push({px:N(this,ll),grow:0}),(o==0||this.wrappingFacet)&&i.push(_c),i.push({px:s.axisBefore,grow:0}),i.push(s.view),i.push({px:s.axisAfter,grow:0}),(o==r.length-1||this.wrappingFacet)&&i.push(_c);return i},oy=function(n){let r=0,i=0;const o=n=="row"?this.spec.height:this.spec.width;if(o||o===0)return DA(o);const s=he(this,We,Vu).call(this,n);for(const[a,l]of s.entries())a>0&&(i+=N(this,ll)),(a==0||this.wrappingFacet)&&(i+=0),i+=l.axisBefore,i+=l.view.px??0,r+=l.view.grow??0,i+=l.axisAfter,(a==s.length-1||this.wrappingFacet)&&(i+=0);return{px:i,grow:r}},sy=function(n,r){return n=="row"&&this.wrappingFacet?1+6*r+2:2+4*r+1},Nk=function(){const n=he(this,We,Vu).call(this,"column"),r=he(this,We,Vu).call(this,"row");return!n.length||!r.length?Vt.zero():new Vt(r.at(0).axisBefore,n.at(-1).axisAfter,r.at(-1).axisAfter,n.at(0).axisBefore)},Gd=function(){const n=r=>{const i=Bg[r],o=N(this,Ss)[i];return(o==null?void 0:o.axisProps.orient)!==r?0:Math.max(o.getPerpendicularSize()+(o.axisProps.offset??0),0)};return new Vt(n("top"),n("right"),n("bottom"),n("left"))},zk=function(n,r,i){for(const[o,s]of Object.entries(WN(r))){if(s.size<=0)continue;const a=n.normalizePoint(i.x,i.y),l=n.normalizePoint(i.x+i.xDelta,i.y+i.yDelta),c={x:l.x-a.x,y:l.y-a.y};for(const u of s)u.zoom(2**i.zDelta,o=="y"?1-a[o]:a[o],o=="x"?c.x:-c.y)}this.context.animator.requestRender()};function WN(e){const t={x:new Set,y:new Set};return e.visit(n=>{for(const[r,i]of Object.entries(t)){const o=n.getScaleResolution(r);o&&o.isZoomable()&&i.add(o)}}),t}function YN(e){let t=!0;return e.visit(n=>{n instanceof St&&t&&(t=n.mark.properties.clip===!0)}),t}function Og(e,t,n){const r=n.axisProps,i=n.getPerpendicularSize();if(t=="bottom")return e.translate(0,e.height+r.offset).modify({height:i});if(t=="top")return e.translate(0,-i-r.offset).modify({height:i});if(t=="left")return e.translate(-i-r.offset,0).modify({width:i});if(t=="right")return e.translate(e.width+r.offset,0).modify({width:i})}class Zo extends $N{constructor(t,n,r,i,o){super(t,n,r,i,o,Lg(t)?t.columns:Sh(t)?1:1/0),this.spec=t}async initializeChildren(){const t=this.spec,n=Lg(t)?t.concat:Sh(t)?t.vconcat:t.hconcat;this.setChildren(await Promise.all(n.map((r,i)=>this.context.createOrImportView(r,this,this,"grid"+i)))),await this.createAxes()}getDefaultResolution(t,n){return n=="axis"?"independent":Sh(this.spec)&&t==="x"||E3(this.spec)&&t==="y"?"shared":"independent"}}const x3="viewRoot";class QN{constructor(t={}){be(this,ul,new Map);this.options={allowImport:!0,wrapRoot:!0,...t};const n=r=>(i,o,s,a,l)=>new r(i,o,s,a,i.name??l);this.addViewType(Eh,n(Ui)),this.addViewType(Ah,n(St)),this.addViewType(Sh,n(Zo)),this.addViewType(E3,n(Zo)),this.addViewType(Lg,n(Zo)),this.addViewType(S3,()=>{throw new Error("SampleView is not supported by the @genome-spy/core package. Use @genome-spy/app instead!")})}addViewType(t,n){N(this,ul).set(t,n)}createView(t,n,r,i,o){for(const[s,a]of N(this,ul))if(s(t))return a(t,n,r,i,o);throw new Error("Invalid spec, cannot figure out the view type from the properties: "+JSON.stringify([...Object.keys(t)]))}isViewSpec(t){const n=[...N(this,ul).keys()].filter(r=>r(t));if(n.length>1)throw new Error("Ambiguous spec. Cannot create a view!");return n.length==1}async createOrImportView(t,n,r,i,o,s){let a;if(KN(t)){let u;if("url"in t.import)if(this.options.allowImport)u=await iN(t,i.getBaseUrl(),n);else throw new zi("Importing views is not allowed!",r);else if("template"in t.import)u=A3(t.import.template,i);else throw new Error("Invalid import: "+JSON.stringify(t));s==null||s(u),ZN(u,t),a=u}else a=t;const l=u=>{var f;return(f=u==null?void 0:u.params)==null?void 0:f.some(h=>Fx(h)&&fh(h.select).type=="interval")};!i&&this.options.wrapRoot&&(Ah(a)||Eh(a)||l(a))&&o===x3&&(a={name:"implicitRoot",vconcat:[a]});const c=this.createView(a,n,r,i,o);return c instanceof la&&await c.initializeChildren(),c}}ul=new WeakMap;function A3(e,t){var r,i;const n=(i=(r=t.spec)==null?void 0:r.templates)==null?void 0:i[e];if(n)return structuredClone(n);if(t.dataParent)return A3(e,t.dataParent);throw new Error(`Cannot find template "${e}" in current view or its ancestors!`)}function ZN(e,t){t.name!=null&&(e.name=t.name);const n=Zt(t.params)?t.params:nn(t.params)?Object.entries(t.params).map(([r,i])=>({name:r,value:i})):[];if(n.length){e.params??(e.params=[]);for(const r of n){const i=e.params.findIndex(o=>o.name==r.name);i>=0&&(e.params[i]=r)}for(const r of n)e.params.some(i=>i.name==r.name)||e.params.push(r)}}function Ah(e){return"mark"in e&&(lt(e.mark)||nn(e.mark))}function Eh(e){return"layer"in e&&nn(e.layer)}function XN(e){return e&&(Ah(e)||Eh(e))&&"aggregateSamples"in e}function KN(e){return"import"in e}function Sh(e){return"vconcat"in e&&Zt(e.vconcat)}function E3(e){return"hconcat"in e&&Zt(e.hconcat)}function Lg(e){return"concat"in e&&Zt(e.concat)}function S3(e){return"samples"in e&&nn(e.samples)&&"spec"in e&&nn(e.spec)}function C3(e){const t=Math.floor(Math.random()*16777215).toString(16),n=[];for(const r of e.paramConfigs.values()){if(!rg(r))continue;const i=r.bind;if(!i||!("input"in i))continue;const o=r.name,s=e.getSetter(o),a=e.getValue(o),l=i.name??o,c=i.debounce?Yo(s,i.debounce,!1):s,u=`${t}-param-${o}`;if(i.input=="range")n.push(K`<label for=${u}>${l}</label>
2225
2225
  <div>
2226
2226
  <input
2227
2227
  id=${u}
@@ -3259,7 +3259,7 @@ svg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {
3259
3259
  ${E}
3260
3260
  </div>
3261
3261
  ${d()}`,u.content)}g(),(y=u.content.querySelector("select"))==null||y.focus()}function PG(e,t,n){const r=e.accessor;return t.map(i=>r(i,n))}function OG(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Gm(e,t,n,r){const i=r.actions,o=t.attribute,s=r.sampleHierarchy,a=r.provenance.storeHelper.getDispatcher(),l=[];e&&l.push({label:e,type:"header"});const c=(h,d,p)=>{const m=r.provenance.getActionInfo(h);return{label:m.title,icon:m.icon,callback:d?void 0:p??(()=>a(h))}},u=(...h)=>l.push(...h.map(d=>c(d)));u(i.sortBy({attribute:o}));const f=(t==null?void 0:t.type)??"identifier";return f!="quantitative"?(f!="identifier"&&u(i.groupByNominal({attribute:o})),l.push({icon:Gi,label:"Create custom groups...",callback:()=>MG(t,r)}),f!="identifier"&&(u(i.retainFirstOfEach({attribute:o})),l.push(c(i.retainFirstNCategories({attribute:o,n:void 0}),!1,()=>FG(t,r)))),u(i.filterByNominal({attribute:o,values:[n]}),i.filterByNominal({attribute:o,remove:!0,values:[n]})),f!="identifier"&&l.push(c(i.retainMatched({attribute:o}),!s.groupMetadata.length))):(u(i.groupToQuartiles({attribute:o})),l.push({icon:Gi,label:"Group by thresholds...",callback:()=>DG(t,r)}),LG(n)?u(i.filterByQuantitative({attribute:o,operator:"gte",operand:+n}),i.filterByQuantitative({attribute:o,operator:"lte",operand:+n})):u(i.removeUndefined({attribute:o}))),l.push({icon:Xo,label:"Advanced filter...",callback:()=>dH(t,r)}),l}function LG(e){return e!=null&&e!==""&&!(typeof e=="number"&&isNaN(e))}const Vn={UNDO:"@@redux-undo/UNDO",REDO:"@@redux-undo/REDO",JUMP_TO_FUTURE:"@@redux-undo/JUMP_TO_FUTURE",JUMP_TO_PAST:"@@redux-undo/JUMP_TO_PAST",JUMP:"@@redux-undo/JUMP",CLEAR_HISTORY:"@@redux-undo/CLEAR_HISTORY"},as={undo(){return{type:Vn.UNDO}},redo(){return{type:Vn.REDO}},jumpToFuture(e){return{type:Vn.JUMP_TO_FUTURE,index:e}},jumpToPast(e){return{type:Vn.JUMP_TO_PAST,index:e}},jump(e){return{type:Vn.JUMP,index:e}},clearHistory(){return{type:Vn.CLEAR_HISTORY}}};function LS(e,t=[]){return Array.isArray(e)?e:typeof e=="string"?[e]:t}function NG(e){return typeof e.present<"u"&&typeof e.future<"u"&&typeof e.past<"u"&&Array.isArray(e.future)&&Array.isArray(e.past)}function ls(e,t,n,r=null){return{past:e,present:t,future:n,group:r,_latestUnfiltered:t,index:e.length,limit:e.length+n.length+1}}let $h,qn;const jm={prevState:"#9E9E9E",action:"#03A9F4",nextState:"#4CAF50"};function zG(){qn={header:[],prev:[],action:[],next:[],msgs:[]}}function UG(){const{header:e,prev:t,next:n,action:r,msgs:i}=qn;console.group?(console.groupCollapsed(...e),console.log(...t),console.log(...r),console.log(...n),console.log(...i),console.groupEnd()):(console.log(...e),console.log(...t),console.log(...r),console.log(...n),console.log(...i))}function Vm(e,t,n){return[`%c${e}`,`color: ${t}; font-weight: bold`,n]}function HG(e,t){zG(),$h&&(console.group?(qn.header=["%credux-undo","font-style: italic","action",e.type],qn.action=Vm("action",jm.action,e),qn.prev=Vm("prev history",jm.prevState,t)):(qn.header=["redux-undo action",e.type],qn.action=["action",e],qn.prev=["prev history",t]))}function ar(e){$h&&(console.group?qn.next=Vm("next history",jm.nextState,e):qn.next=["next history",e],UG())}function cn(...e){$h&&(qn.msgs=qn.msgs.concat([...e,`
3262
- `]))}function GG(e){$h=e}function qm(e,t){const n=ls([],e,[]);return t&&(n._latestUnfiltered=null),n}function jG(e,t,n,r){const i=e.past.length+1;cn("inserting",t),cn("new free: ",n-i);const{past:o,_latestUnfiltered:s}=e,a=n&&n<=i,l=o.slice(a?1:0),c=s!=null?[...l,s]:l;return ls(c,t,[],r)}function NS(e,t){if(t<0||t>=e.future.length)return e;const{past:n,future:r,_latestUnfiltered:i}=e,o=[...n,i,...r.slice(0,t)],s=r[t],a=r.slice(t+1);return ls(o,s,a)}function zS(e,t){if(t<0||t>=e.past.length)return e;const{past:n,future:r,_latestUnfiltered:i}=e,o=n.slice(0,t),s=[...n.slice(t+1),i,...r],a=n[t];return ls(o,a,s)}function $m(e,t){return t>0?NS(e,t-1):t<0?zS(e,e.past.length+t):e}function VG(e,t){return t.indexOf(e)>-1?e:!e}function qG(e,t={}){GG(t.debug);const n={limit:void 0,filter:()=>!0,groupBy:()=>null,undoType:Vn.UNDO,redoType:Vn.REDO,jumpToPastType:Vn.JUMP_TO_PAST,jumpToFutureType:Vn.JUMP_TO_FUTURE,jumpType:Vn.JUMP,neverSkipReducer:!1,ignoreInitialState:!1,syncFilter:!1,...t,initTypes:LS(t.initTypes,["@@redux-undo/INIT"]),clearHistoryType:LS(t.clearHistoryType,[Vn.CLEAR_HISTORY])},r=n.neverSkipReducer?(o,s,...a)=>({...o,present:e(o.present,s,...a)}):o=>o;let i;return(o=i,s={},...a)=>{HG(s,o);let l=o;if(!i)if(cn("history is uninitialized"),o===void 0){const u=e(o,{type:"@@redux-undo/CREATE_HISTORY"},...a);return l=qm(u,n.ignoreInitialState),cn("do not set initialState on probe actions"),ar(l),l}else NG(o)?(l=i=n.ignoreInitialState?o:ls(o.past,o.present,o.future),cn("initialHistory initialized: initialState is a history",i)):(l=i=qm(o,n.ignoreInitialState),cn("initialHistory initialized: initialState is not a history",i));let c;switch(s.type){case void 0:return l;case n.undoType:return c=$m(l,-1),cn("perform undo"),ar(c),r(c,s,...a);case n.redoType:return c=$m(l,1),cn("perform redo"),ar(c),r(c,s,...a);case n.jumpToPastType:return c=zS(l,s.index),cn(`perform jumpToPast to ${s.index}`),ar(c),r(c,s,...a);case n.jumpToFutureType:return c=NS(l,s.index),cn(`perform jumpToFuture to ${s.index}`),ar(c),r(c,s,...a);case n.jumpType:return c=$m(l,s.index),cn(`perform jump to ${s.index}`),ar(c),r(c,s,...a);case VG(s.type,n.clearHistoryType):return c=qm(l.present,n.ignoreInitialState),cn("perform clearHistory"),ar(c),r(c,s,...a);default:if(c=e(l.present,s,...a),n.initTypes.some(f=>f===s.type))return cn("reset history due to init action"),ar(i),i;if(l._latestUnfiltered===c)return l;if(typeof n.filter=="function"&&!n.filter(s,c,l)){const f=ls(l.past,c,l.future,l.group);return n.syncFilter||(f._latestUnfiltered=l._latestUnfiltered),cn("filter ignored action, not storing it in past"),ar(f),f}const u=n.groupBy(s,c,l);if(u!=null&&u===l.group){const f=ls(l.past,c,l.future,l.group);return cn("groupBy grouped the action with the previous action"),ar(f),f}return l=jG(l,c,n.limit,u),cn("inserted new state into history"),ar(l),l}}}const US=Math.min,$c=Math.max,Wh=Math.round,Ji=e=>({x:e,y:e}),$G={left:"right",right:"left",bottom:"top",top:"bottom"},WG={start:"end",end:"start"};function Wm(e,t){return typeof e=="function"?e(t):e}function wa(e){return e.split("-")[0]}function Yh(e){return e.split("-")[1]}function YG(e){return e==="x"?"y":"x"}function HS(e){return e==="y"?"height":"width"}function Wc(e){return["top","bottom"].includes(wa(e))?"y":"x"}function GS(e){return YG(Wc(e))}function QG(e,t,n){n===void 0&&(n=!1);const r=Yh(e),i=GS(e),o=HS(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Qh(s)),[s,Qh(s)]}function ZG(e){const t=Qh(e);return[Ym(e),t,Ym(t)]}function Ym(e){return e.replace(/start|end/g,t=>WG[t])}function XG(e,t,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?o:s;default:return[]}}function KG(e,t,n,r){const i=Yh(e);let o=XG(wa(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Ym)))),o}function Qh(e){return e.replace(/left|right|bottom|top/g,t=>$G[t])}function JG(e){return{top:0,right:0,bottom:0,left:0,...e}}function ej(e){return typeof e!="number"?JG(e):{top:e,right:e,bottom:e,left:e}}function Zh(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function jS(e,t,n){let{reference:r,floating:i}=e;const o=Wc(t),s=GS(t),a=HS(s),l=wa(t),c=o==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let d;switch(l){case"top":d={x:u,y:r.y-i.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-i.width,y:f};break;default:d={x:r.x,y:r.y}}switch(Yh(t)){case"start":d[s]-=h*(n&&c?-1:1);break;case"end":d[s]+=h*(n&&c?-1:1);break}return d}const tj=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:f}=jS(c,r,l),h=r,d={},p=0;for(let m=0;m<a.length;m++){const{name:b,fn:g}=a[m],{x:y,y:v,data:w,reset:S}=await g({x:u,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:d,rects:c,platform:s,elements:{reference:e,floating:t}});u=y??u,f=v??f,d={...d,[b]:{...d[b],...w}},S&&p<=50&&(p++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(c=S.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):S.rects),{x:u,y:f}=jS(c,h,l)),m=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:d}};async function nj(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:d=0}=Wm(t,e),p=ej(d),b=a[h?f==="floating"?"reference":"floating":f],g=Zh(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(b)))==null||n?b:b.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),y=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,v=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),w=await(o.isElement==null?void 0:o.isElement(v))?await(o.getScale==null?void 0:o.getScale(v))||{x:1,y:1}:{x:1,y:1},S=Zh(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:v,strategy:l}):y);return{top:(g.top-S.top+p.top)/w.y,bottom:(S.bottom-g.bottom+p.bottom)/w.y,left:(g.left-S.left+p.left)/w.x,right:(S.right-g.right+p.right)/w.x}}const rj=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...b}=Wm(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const g=wa(i),y=Wc(a),v=wa(a)===a,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=h||(v||!m?[Qh(a)]:ZG(a)),E=p!=="none";!h&&E&&S.push(...KG(a,m,p,w));const k=[a,...S],M=await nj(t,b),D=[];let B=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&D.push(M[g]),f){const ne=QG(i,s,w);D.push(M[ne[0]],M[ne[1]])}if(B=[...B,{placement:i,overflows:D}],!D.every(ne=>ne<=0)){var I,q;const ne=(((I=o.flip)==null?void 0:I.index)||0)+1,J=k[ne];if(J)return{data:{index:ne,overflows:B},reset:{placement:J}};let ce=(q=B.filter(ae=>ae.overflows[0]<=0).sort((ae,we)=>ae.overflows[1]-we.overflows[1])[0])==null?void 0:q.placement;if(!ce)switch(d){case"bestFit":{var Z;const ae=(Z=B.filter(we=>{if(E){const me=Wc(we.placement);return me===y||me==="y"}return!0}).map(we=>[we.placement,we.overflows.filter(me=>me>0).reduce((me,U)=>me+U,0)]).sort((we,me)=>we[1]-me[1])[0])==null?void 0:Z[0];ae&&(ce=ae);break}case"initialPlacement":ce=a;break}if(i!==ce)return{reset:{placement:ce}}}return{}}}};async function ij(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=wa(n),a=Yh(n),l=Wc(n)==="y",c=["left","top"].includes(s)?-1:1,u=o&&l?-1:1,f=Wm(t,e);let{mainAxis:h,crossAxis:d,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof p=="number"&&(d=a==="end"?p*-1:p),l?{x:d*u,y:h*c}:{x:h*c,y:d*u}}const oj=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await ij(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}};function Xh(){return typeof window<"u"}function va(e){return VS(e)?(e.nodeName||"").toLowerCase():"#document"}function Bn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ii(e){var t;return(t=(VS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function VS(e){return Xh()?e instanceof Node||e instanceof Bn(e).Node:!1}function lr(e){return Xh()?e instanceof Element||e instanceof Bn(e).Element:!1}function Or(e){return Xh()?e instanceof HTMLElement||e instanceof Bn(e).HTMLElement:!1}function qS(e){return!Xh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Bn(e).ShadowRoot}function Yc(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=cr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function sj(e){return["table","td","th"].includes(va(e))}function Kh(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Qm(e){const t=Zm(),n=lr(e)?cr(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function aj(e){let t=eo(e);for(;Or(t)&&!xa(t);){if(Qm(t))return t;if(Kh(t))return null;t=eo(t)}return null}function Zm(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function xa(e){return["html","body","#document"].includes(va(e))}function cr(e){return Bn(e).getComputedStyle(e)}function Jh(e){return lr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function eo(e){if(va(e)==="html")return e;const t=e.assignedSlot||e.parentNode||qS(e)&&e.host||ii(e);return qS(t)?t.host:t}function $S(e){const t=eo(e);return xa(t)?e.ownerDocument?e.ownerDocument.body:e.body:Or(t)&&Yc(t)?t:$S(t)}function WS(e,t,n){var r;t===void 0&&(t=[]);const i=$S(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=Bn(i);return o?(Xm(s),t.concat(s,s.visualViewport||[],Yc(i)?i:[],[])):t.concat(i,WS(i,[]))}function Xm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function YS(e){const t=cr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Or(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=Wh(n)!==o||Wh(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function QS(e){return lr(e)?e:e.contextElement}function Aa(e){const t=QS(e);if(!Or(t))return Ji(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=YS(t);let s=(o?Wh(n.width):n.width)/r,a=(o?Wh(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const lj=Ji(0);function ZS(e){const t=Bn(e);return!Zm()||!t.visualViewport?lj:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cj(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Bn(e)?!1:t}function Qc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=QS(e);let s=Ji(1);t&&(r?lr(r)&&(s=Aa(r)):s=Aa(e));const a=cj(o,n,r)?ZS(o):Ji(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,u=i.width/s.x,f=i.height/s.y;if(o){const h=Bn(o),d=r&&lr(r)?Bn(r):r;let p=h,m=Xm(p);for(;m&&r&&d!==p;){const b=Aa(m),g=m.getBoundingClientRect(),y=cr(m),v=g.left+(m.clientLeft+parseFloat(y.paddingLeft))*b.x,w=g.top+(m.clientTop+parseFloat(y.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,f*=b.y,l+=v,c+=w,p=Bn(m),m=Xm(p)}}return Zh({width:u,height:f,x:l,y:c})}function uj(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=ii(r),a=t?Kh(t.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=Ji(1);const u=Ji(0),f=Or(r);if((f||!f&&!o)&&((va(r)!=="body"||Yc(s))&&(l=Jh(r)),Or(r))){const h=Qc(r);c=Aa(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}}function fj(e){return Array.from(e.getClientRects())}function Km(e,t){const n=Jh(e).scrollLeft;return t?t.left+n:Qc(ii(e)).left+n}function hj(e){const t=ii(e),n=Jh(e),r=e.ownerDocument.body,i=$c(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=$c(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Km(e);const a=-n.scrollTop;return cr(r).direction==="rtl"&&(s+=$c(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function dj(e,t){const n=Bn(e),r=ii(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const c=Zm();(!c||c&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function pj(e,t){const n=Qc(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Or(e)?Aa(e):Ji(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:s,height:a,x:l,y:c}}function XS(e,t,n){let r;if(t==="viewport")r=dj(e,n);else if(t==="document")r=hj(ii(e));else if(lr(t))r=pj(t,n);else{const i=ZS(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Zh(r)}function KS(e,t){const n=eo(e);return n===t||!lr(n)||xa(n)?!1:cr(n).position==="fixed"||KS(n,t)}function gj(e,t){const n=t.get(e);if(n)return n;let r=WS(e,[]).filter(a=>lr(a)&&va(a)!=="body"),i=null;const o=cr(e).position==="fixed";let s=o?eo(e):e;for(;lr(s)&&!xa(s);){const a=cr(s),l=Qm(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Yc(s)&&!l&&KS(e,s))?r=r.filter(u=>u!==s):i=a,s=eo(s)}return t.set(e,r),r}function mj(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Kh(t)?[]:gj(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const f=XS(t,u,i);return c.top=$c(f.top,c.top),c.right=US(f.right,c.right),c.bottom=US(f.bottom,c.bottom),c.left=$c(f.left,c.left),c},XS(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function bj(e){const{width:t,height:n}=YS(e);return{width:t,height:n}}function yj(e,t,n){const r=Or(t),i=ii(t),o=n==="fixed",s=Qc(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Ji(0);if(r||!r&&!o)if((va(t)!=="body"||Yc(i))&&(a=Jh(t)),r){const d=Qc(t,!0,o,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else i&&(l.x=Km(i));let c=0,u=0;if(i&&!r&&!o){const d=i.getBoundingClientRect();u=d.top+a.scrollTop,c=d.left+a.scrollLeft-Km(i,d)}const f=s.left+a.scrollLeft-l.x-c,h=s.top+a.scrollTop-l.y-u;return{x:f,y:h,width:s.width,height:s.height}}function Jm(e){return cr(e).position==="static"}function JS(e,t){if(!Or(e)||cr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ii(e)===n&&(n=n.ownerDocument.body),n}function e4(e,t){const n=Bn(e);if(Kh(e))return n;if(!Or(e)){let i=eo(e);for(;i&&!xa(i);){if(lr(i)&&!Jm(i))return i;i=eo(i)}return n}let r=JS(e,t);for(;r&&sj(r)&&Jm(r);)r=JS(r,t);return r&&xa(r)&&Jm(r)&&!Qm(r)?n:r||aj(e)||n}const wj=async function(e){const t=this.getOffsetParent||e4,n=this.getDimensions,r=await n(e.floating);return{reference:yj(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function vj(e){return cr(e).direction==="rtl"}const xj={convertOffsetParentRelativeRectToViewportRelativeRect:uj,getDocumentElement:ii,getClippingRect:mj,getOffsetParent:e4,getElementRects:wj,getClientRects:fj,getDimensions:bj,getScale:Aa,isElement:lr,isRTL:vj},Aj=oj,t4=rj,Ej=(e,t,n)=>{const r=new Map,i={platform:xj,...n},o={...i.platform,_c:r};return tj(e,t,{...i,platform:o})};let $n;const Ea=[],e1=Yo(e=>e(),150,!1),t1={type:"divider"};function Zc(e){if((e==null?void 0:e.type)=="contextmenu"){e.preventDefault();return}$n&&($n.remove(),$n=void 0,document.body.classList.remove(Io))}function n4(e){var t;if(!(e<1)){for(let n=e;n<Ea.length;n++)(t=Ea[n])==null||t.remove(),Ea[n]=void 0;for(const n of Ea[e-1].querySelectorAll("li.active"))n.classList.remove("active")}}const Sj=()=>K`<li class="menu-divider"></li>`,Cj=e=>K`
3262
+ `]))}function GG(e){$h=e}function qm(e,t){const n=ls([],e,[]);return t&&(n._latestUnfiltered=null),n}function jG(e,t,n,r){const i=e.past.length+1;cn("inserting",t),cn("new free: ",n-i);const{past:o,_latestUnfiltered:s}=e,a=n&&n<=i,l=o.slice(a?1:0),c=s!=null?[...l,s]:l;return ls(c,t,[],r)}function NS(e,t){if(t<0||t>=e.future.length)return e;const{past:n,future:r,_latestUnfiltered:i}=e,o=[...n,i,...r.slice(0,t)],s=r[t],a=r.slice(t+1);return ls(o,s,a)}function zS(e,t){if(t<0||t>=e.past.length)return e;const{past:n,future:r,_latestUnfiltered:i}=e,o=n.slice(0,t),s=[...n.slice(t+1),i,...r],a=n[t];return ls(o,a,s)}function $m(e,t){return t>0?NS(e,t-1):t<0?zS(e,e.past.length+t):e}function VG(e,t){return t.indexOf(e)>-1?e:!e}function qG(e,t={}){GG(t.debug);const n={limit:void 0,filter:()=>!0,groupBy:()=>null,undoType:Vn.UNDO,redoType:Vn.REDO,jumpToPastType:Vn.JUMP_TO_PAST,jumpToFutureType:Vn.JUMP_TO_FUTURE,jumpType:Vn.JUMP,neverSkipReducer:!1,ignoreInitialState:!1,syncFilter:!1,...t,initTypes:LS(t.initTypes,["@@redux-undo/INIT"]),clearHistoryType:LS(t.clearHistoryType,[Vn.CLEAR_HISTORY])},r=n.neverSkipReducer?(o,s,...a)=>({...o,present:e(o.present,s,...a)}):o=>o;let i;return(o=i,s={},...a)=>{HG(s,o);let l=o;if(!i)if(cn("history is uninitialized"),o===void 0){const u=e(o,{type:"@@redux-undo/CREATE_HISTORY"},...a);return l=qm(u,n.ignoreInitialState),cn("do not set initialState on probe actions"),ar(l),l}else NG(o)?(l=i=n.ignoreInitialState?o:ls(o.past,o.present,o.future),cn("initialHistory initialized: initialState is a history",i)):(l=i=qm(o,n.ignoreInitialState),cn("initialHistory initialized: initialState is not a history",i));let c;switch(s.type){case void 0:return l;case n.undoType:return c=$m(l,-1),cn("perform undo"),ar(c),r(c,s,...a);case n.redoType:return c=$m(l,1),cn("perform redo"),ar(c),r(c,s,...a);case n.jumpToPastType:return c=zS(l,s.index),cn(`perform jumpToPast to ${s.index}`),ar(c),r(c,s,...a);case n.jumpToFutureType:return c=NS(l,s.index),cn(`perform jumpToFuture to ${s.index}`),ar(c),r(c,s,...a);case n.jumpType:return c=$m(l,s.index),cn(`perform jump to ${s.index}`),ar(c),r(c,s,...a);case VG(s.type,n.clearHistoryType):return c=qm(l.present,n.ignoreInitialState),cn("perform clearHistory"),ar(c),r(c,s,...a);default:if(c=e(l.present,s,...a),n.initTypes.some(f=>f===s.type))return cn("reset history due to init action"),ar(i),i;if(l._latestUnfiltered===c)return l;if(typeof n.filter=="function"&&!n.filter(s,c,l)){const f=ls(l.past,c,l.future,l.group);return n.syncFilter||(f._latestUnfiltered=l._latestUnfiltered),cn("filter ignored action, not storing it in past"),ar(f),f}const u=n.groupBy(s,c,l);if(u!=null&&u===l.group){const f=ls(l.past,c,l.future,l.group);return cn("groupBy grouped the action with the previous action"),ar(f),f}return l=jG(l,c,n.limit,u),cn("inserted new state into history"),ar(l),l}}}const US=Math.min,$c=Math.max,Wh=Math.round,Ji=e=>({x:e,y:e}),$G={left:"right",right:"left",bottom:"top",top:"bottom"},WG={start:"end",end:"start"};function Wm(e,t){return typeof e=="function"?e(t):e}function wa(e){return e.split("-")[0]}function Yh(e){return e.split("-")[1]}function YG(e){return e==="x"?"y":"x"}function HS(e){return e==="y"?"height":"width"}function Wc(e){return["top","bottom"].includes(wa(e))?"y":"x"}function GS(e){return YG(Wc(e))}function QG(e,t,n){n===void 0&&(n=!1);const r=Yh(e),i=GS(e),o=HS(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Qh(s)),[s,Qh(s)]}function ZG(e){const t=Qh(e);return[Ym(e),t,Ym(t)]}function Ym(e){return e.replace(/start|end/g,t=>WG[t])}function XG(e,t,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?o:s;default:return[]}}function KG(e,t,n,r){const i=Yh(e);let o=XG(wa(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Ym)))),o}function Qh(e){return e.replace(/left|right|bottom|top/g,t=>$G[t])}function JG(e){return{top:0,right:0,bottom:0,left:0,...e}}function ej(e){return typeof e!="number"?JG(e):{top:e,right:e,bottom:e,left:e}}function Zh(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function jS(e,t,n){let{reference:r,floating:i}=e;const o=Wc(t),s=GS(t),a=HS(s),l=wa(t),c=o==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let d;switch(l){case"top":d={x:u,y:r.y-i.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-i.width,y:f};break;default:d={x:r.x,y:r.y}}switch(Yh(t)){case"start":d[s]-=h*(n&&c?-1:1);break;case"end":d[s]+=h*(n&&c?-1:1);break}return d}const tj=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:f}=jS(c,r,l),h=r,d={},p=0;for(let m=0;m<a.length;m++){const{name:b,fn:g}=a[m],{x:y,y:v,data:w,reset:S}=await g({x:u,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:d,rects:c,platform:s,elements:{reference:e,floating:t}});u=y??u,f=v??f,d={...d,[b]:{...d[b],...w}},S&&p<=50&&(p++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(c=S.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):S.rects),{x:u,y:f}=jS(c,h,l)),m=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:d}};async function nj(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:d=0}=Wm(t,e),p=ej(d),b=a[h?f==="floating"?"reference":"floating":f],g=Zh(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(b)))==null||n?b:b.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),y=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,v=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),w=await(o.isElement==null?void 0:o.isElement(v))?await(o.getScale==null?void 0:o.getScale(v))||{x:1,y:1}:{x:1,y:1},S=Zh(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:v,strategy:l}):y);return{top:(g.top-S.top+p.top)/w.y,bottom:(S.bottom-g.bottom+p.bottom)/w.y,left:(g.left-S.left+p.left)/w.x,right:(S.right-g.right+p.right)/w.x}}const rj=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...b}=Wm(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const g=wa(i),y=Wc(a),v=wa(a)===a,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=h||(v||!m?[Qh(a)]:ZG(a)),E=p!=="none";!h&&E&&S.push(...KG(a,m,p,w));const k=[a,...S],M=await nj(t,b),D=[];let B=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&D.push(M[g]),f){const te=QG(i,s,w);D.push(M[te[0]],M[te[1]])}if(B=[...B,{placement:i,overflows:D}],!D.every(te=>te<=0)){var I,q;const te=(((I=o.flip)==null?void 0:I.index)||0)+1,J=k[te];if(J)return{data:{index:te,overflows:B},reset:{placement:J}};let ce=(q=B.filter(ae=>ae.overflows[0]<=0).sort((ae,we)=>ae.overflows[1]-we.overflows[1])[0])==null?void 0:q.placement;if(!ce)switch(d){case"bestFit":{var Z;const ae=(Z=B.filter(we=>{if(E){const me=Wc(we.placement);return me===y||me==="y"}return!0}).map(we=>[we.placement,we.overflows.filter(me=>me>0).reduce((me,U)=>me+U,0)]).sort((we,me)=>we[1]-me[1])[0])==null?void 0:Z[0];ae&&(ce=ae);break}case"initialPlacement":ce=a;break}if(i!==ce)return{reset:{placement:ce}}}return{}}}};async function ij(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=wa(n),a=Yh(n),l=Wc(n)==="y",c=["left","top"].includes(s)?-1:1,u=o&&l?-1:1,f=Wm(t,e);let{mainAxis:h,crossAxis:d,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof p=="number"&&(d=a==="end"?p*-1:p),l?{x:d*u,y:h*c}:{x:h*c,y:d*u}}const oj=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await ij(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}};function Xh(){return typeof window<"u"}function va(e){return VS(e)?(e.nodeName||"").toLowerCase():"#document"}function Bn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ii(e){var t;return(t=(VS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function VS(e){return Xh()?e instanceof Node||e instanceof Bn(e).Node:!1}function lr(e){return Xh()?e instanceof Element||e instanceof Bn(e).Element:!1}function Or(e){return Xh()?e instanceof HTMLElement||e instanceof Bn(e).HTMLElement:!1}function qS(e){return!Xh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Bn(e).ShadowRoot}function Yc(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=cr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function sj(e){return["table","td","th"].includes(va(e))}function Kh(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Qm(e){const t=Zm(),n=lr(e)?cr(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function aj(e){let t=eo(e);for(;Or(t)&&!xa(t);){if(Qm(t))return t;if(Kh(t))return null;t=eo(t)}return null}function Zm(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function xa(e){return["html","body","#document"].includes(va(e))}function cr(e){return Bn(e).getComputedStyle(e)}function Jh(e){return lr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function eo(e){if(va(e)==="html")return e;const t=e.assignedSlot||e.parentNode||qS(e)&&e.host||ii(e);return qS(t)?t.host:t}function $S(e){const t=eo(e);return xa(t)?e.ownerDocument?e.ownerDocument.body:e.body:Or(t)&&Yc(t)?t:$S(t)}function WS(e,t,n){var r;t===void 0&&(t=[]);const i=$S(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=Bn(i);return o?(Xm(s),t.concat(s,s.visualViewport||[],Yc(i)?i:[],[])):t.concat(i,WS(i,[]))}function Xm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function YS(e){const t=cr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Or(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=Wh(n)!==o||Wh(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function QS(e){return lr(e)?e:e.contextElement}function Aa(e){const t=QS(e);if(!Or(t))return Ji(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=YS(t);let s=(o?Wh(n.width):n.width)/r,a=(o?Wh(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const lj=Ji(0);function ZS(e){const t=Bn(e);return!Zm()||!t.visualViewport?lj:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cj(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Bn(e)?!1:t}function Qc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=QS(e);let s=Ji(1);t&&(r?lr(r)&&(s=Aa(r)):s=Aa(e));const a=cj(o,n,r)?ZS(o):Ji(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,u=i.width/s.x,f=i.height/s.y;if(o){const h=Bn(o),d=r&&lr(r)?Bn(r):r;let p=h,m=Xm(p);for(;m&&r&&d!==p;){const b=Aa(m),g=m.getBoundingClientRect(),y=cr(m),v=g.left+(m.clientLeft+parseFloat(y.paddingLeft))*b.x,w=g.top+(m.clientTop+parseFloat(y.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,f*=b.y,l+=v,c+=w,p=Bn(m),m=Xm(p)}}return Zh({width:u,height:f,x:l,y:c})}function uj(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=ii(r),a=t?Kh(t.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=Ji(1);const u=Ji(0),f=Or(r);if((f||!f&&!o)&&((va(r)!=="body"||Yc(s))&&(l=Jh(r)),Or(r))){const h=Qc(r);c=Aa(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}}function fj(e){return Array.from(e.getClientRects())}function Km(e,t){const n=Jh(e).scrollLeft;return t?t.left+n:Qc(ii(e)).left+n}function hj(e){const t=ii(e),n=Jh(e),r=e.ownerDocument.body,i=$c(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=$c(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Km(e);const a=-n.scrollTop;return cr(r).direction==="rtl"&&(s+=$c(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function dj(e,t){const n=Bn(e),r=ii(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const c=Zm();(!c||c&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function pj(e,t){const n=Qc(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Or(e)?Aa(e):Ji(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:s,height:a,x:l,y:c}}function XS(e,t,n){let r;if(t==="viewport")r=dj(e,n);else if(t==="document")r=hj(ii(e));else if(lr(t))r=pj(t,n);else{const i=ZS(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Zh(r)}function KS(e,t){const n=eo(e);return n===t||!lr(n)||xa(n)?!1:cr(n).position==="fixed"||KS(n,t)}function gj(e,t){const n=t.get(e);if(n)return n;let r=WS(e,[]).filter(a=>lr(a)&&va(a)!=="body"),i=null;const o=cr(e).position==="fixed";let s=o?eo(e):e;for(;lr(s)&&!xa(s);){const a=cr(s),l=Qm(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Yc(s)&&!l&&KS(e,s))?r=r.filter(u=>u!==s):i=a,s=eo(s)}return t.set(e,r),r}function mj(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Kh(t)?[]:gj(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const f=XS(t,u,i);return c.top=$c(f.top,c.top),c.right=US(f.right,c.right),c.bottom=US(f.bottom,c.bottom),c.left=$c(f.left,c.left),c},XS(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function bj(e){const{width:t,height:n}=YS(e);return{width:t,height:n}}function yj(e,t,n){const r=Or(t),i=ii(t),o=n==="fixed",s=Qc(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Ji(0);if(r||!r&&!o)if((va(t)!=="body"||Yc(i))&&(a=Jh(t)),r){const d=Qc(t,!0,o,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else i&&(l.x=Km(i));let c=0,u=0;if(i&&!r&&!o){const d=i.getBoundingClientRect();u=d.top+a.scrollTop,c=d.left+a.scrollLeft-Km(i,d)}const f=s.left+a.scrollLeft-l.x-c,h=s.top+a.scrollTop-l.y-u;return{x:f,y:h,width:s.width,height:s.height}}function Jm(e){return cr(e).position==="static"}function JS(e,t){if(!Or(e)||cr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ii(e)===n&&(n=n.ownerDocument.body),n}function e4(e,t){const n=Bn(e);if(Kh(e))return n;if(!Or(e)){let i=eo(e);for(;i&&!xa(i);){if(lr(i)&&!Jm(i))return i;i=eo(i)}return n}let r=JS(e,t);for(;r&&sj(r)&&Jm(r);)r=JS(r,t);return r&&xa(r)&&Jm(r)&&!Qm(r)?n:r||aj(e)||n}const wj=async function(e){const t=this.getOffsetParent||e4,n=this.getDimensions,r=await n(e.floating);return{reference:yj(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function vj(e){return cr(e).direction==="rtl"}const xj={convertOffsetParentRelativeRectToViewportRelativeRect:uj,getDocumentElement:ii,getClippingRect:mj,getOffsetParent:e4,getElementRects:wj,getClientRects:fj,getDimensions:bj,getScale:Aa,isElement:lr,isRTL:vj},Aj=oj,t4=rj,Ej=(e,t,n)=>{const r=new Map,i={platform:xj,...n},o={...i.platform,_c:r};return tj(e,t,{...i,platform:o})};let $n;const Ea=[],e1=Yo(e=>e(),150,!1),t1={type:"divider"};function Zc(e){if((e==null?void 0:e.type)=="contextmenu"){e.preventDefault();return}$n&&($n.remove(),$n=void 0,document.body.classList.remove(Io))}function n4(e){var t;if(!(e<1)){for(let n=e;n<Ea.length;n++)(t=Ea[n])==null||t.remove(),Ea[n]=void 0;for(const n of Ea[e-1].querySelectorAll("li.active"))n.classList.remove("active")}}const Sj=()=>K`<li class="menu-divider"></li>`,Cj=e=>K`
3263
3263
  <li class="menu-header">${e.label||"-"}</li>
3264
3264
  `,kj=(e,t)=>K`
3265
3265
  <li>
@@ -3368,7 +3368,7 @@ svg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {
3368
3368
  />
3369
3369
  ${aV([123],()=>this._getSearchHelp())}
3370
3370
  </div>
3371
- `}}customElements.define("genome-spy-search-field",lV);function cV(e,t){return new Promise(n=>{let r=0;const i=700/e.length+30;function o(){t.value=e.substring(0,r),r>=e.length?setTimeout(n,500):(r++,setTimeout(o,Math.random()*i*2))}o()})}function y4(e){let t;return e.visit(n=>{for(const r of["x","y"]){const i=n.resolutions.scale[r];if(i&&i.type=="locus"&&i.isZoomable())return t=i,$o}}),t}const w4={version:"0.60.0"};/**
3371
+ `}}customElements.define("genome-spy-search-field",lV);function cV(e,t){return new Promise(n=>{let r=0;const i=700/e.length+30;function o(){t.value=e.substring(0,r),r>=e.length?setTimeout(n,500):(r++,setTimeout(o,Math.random()*i*2))}o()})}function y4(e){let t;return e.visit(n=>{for(const r of["x","y"]){const i=n.resolutions.scale[r];if(i&&i.type=="locus"&&i.isZoomable())return t=i,$o}}),t}const w4={version:"0.60.1"};/**
3372
3372
  * @license
3373
3373
  * Copyright 2020 Google LLC
3374
3374
  * SPDX-License-Identifier: BSD-3-Clause
@@ -3448,8 +3448,8 @@ svg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {
3448
3448
  * @license
3449
3449
  * Copyright 2017 Google LLC
3450
3450
  * SPDX-License-Identifier: BSD-3-Clause
3451
- */const S4=e=>!iH(e)&&typeof e.then=="function",C4=1073741823;class bV extends b4{constructor(){super(...arguments),this._$Cwt=C4,this._$Cbt=[],this._$CK=new gV(this),this._$CX=new mV}render(...t){return t.find(n=>!S4(n))??Xt}update(t,n){const r=this._$Cbt;let i=r.length;this._$Cbt=n;const o=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<n.length&&!(a>this._$Cwt);a++){const l=n[a];if(!S4(l))return this._$Cwt=a,l;a<i&&l===r[a]||(this._$Cwt=C4,i=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();const u=o.deref();if(u!==void 0){const f=u._$Cbt.indexOf(l);f>-1&&f<u._$Cwt&&(u._$Cwt=f,u.setValue(c))}}))}return Xt}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}const yV=To(bV),k4=document.createElement("i");function T4(e){const t="&"+e+";";k4.innerHTML=t;const n=k4.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function oi(e,t,n,r){const i=e.length;let o=0,s;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);o<r.length;)s=r.slice(o,o+1e4),s.unshift(t,0),e.splice(...s),o+=1e4,t+=1e4}function un(e,t){return e.length>0?(oi(e,e.length,0,t),e):t}const b1={}.hasOwnProperty;function wV(e){const t={};let n=-1;for(;++n<e.length;)vV(t,e[n]);return t}function vV(e,t){let n;for(n in t){const i=(b1.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let s;if(o)for(s in o){b1.call(i,s)||(i[s]=[]);const a=o[s];xV(i[s],Array.isArray(a)?a:a?[a]:[])}}}function xV(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);oi(e,0,0,r)}function AV(e){const t={};let n=-1;for(;++n<e.length;)EV(t,e[n]);return t}function EV(e,t){let n;for(n in t){const i=(b1.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let s;if(o)for(s in o)i[s]=o[s]}}function SV(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}const CV={'"':"quot","&":"amp","<":"lt",">":"gt"};function I4(e){return e.replace(/["&<>]/g,t);function t(n){return"&"+CV[n]+";"}}function Jc(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Lr=no(/[A-Za-z]/),Fn=no(/[\dA-Za-z]/),kV=no(/[#-'*+\--9=?A-Z^-~]/);function y1(e){return e!==null&&(e<32||e===127)}const w1=no(/\d/),TV=no(/[\dA-Fa-f]/),IV=no(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function An(e){return e!==null&&(e<0||e===32)}function Ke(e){return e===-2||e===-1||e===32}const _V=no(new RegExp("\\p{P}|\\p{S}","u")),DV=no(/\s/);function no(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function od(e,t){const n=I4(RV(e||""));if(!t)return n;const r=n.indexOf(":"),i=n.indexOf("?"),o=n.indexOf("#"),s=n.indexOf("/");return r<0||s>-1&&r>s||i>-1&&r>i||o>-1&&r>o||t.test(n.slice(0,r))?n:""}function RV(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let s="";if(o===37&&Fn(e.charCodeAt(n+1))&&Fn(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(s=String.fromCharCode(o));else if(o>55295&&o<57344){const a=e.charCodeAt(n+1);o<56320&&a>56319&&a<57344?(s=String.fromCharCode(o,a),i=1):s="�"}else s=String.fromCharCode(o);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}const _4={}.hasOwnProperty,D4=/^(https?|ircs?|mailto|xmpp)$/i,BV=/^https?$/i;function FV(e){const t=e||{};let n=!0;const r={},i=[[]],o=[],s=[],l=AV([{enter:{blockQuote:J,codeFenced:me,codeFencedFenceInfo:b,codeFencedFenceMeta:b,codeIndented:Ce,codeText:ee,content:hn,definition:pe,definitionDestinationString:Te,definitionLabelString:b,definitionTitleString:b,emphasis:ge,htmlFlow:T,htmlText:Y,image:ze,label:b,link:qe,listItemMarker:I,listItemValue:B,listOrdered:M,listUnordered:D,paragraph:ae,reference:b,resource:ie,resourceDestinationString:ye,resourceTitleString:b,setextHeading:nt,strong:$},exit:{atxHeading:Wt,atxHeadingSequence:Bt,autolinkEmail:W,autolinkProtocol:P,blockQuote:ce,characterEscapeValue:F,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:oe,codeFenced:H,codeFencedFence:Ae,codeFencedFenceInfo:U,codeFencedFenceMeta:k,codeFlowValue:C,codeIndented:H,codeText:_,codeTextData:F,data:F,definition:wt,definitionDestinationString:Ie,definitionLabelString:Re,definitionTitleString:Me,emphasis:ue,hardBreakEscape:z,hardBreakTrailing:z,htmlFlow:G,htmlFlowData:F,htmlText:G,htmlTextData:F,image:se,label:X,labelText:Q,lineEnding:A,link:se,listOrdered:q,listUnordered:Z,paragraph:we,reference:k,referenceString:re,resource:k,resourceDestinationString:L,resourceTitleString:R,setextHeading:Yt,setextHeadingLineSequence:st,setextHeadingText:Nt,strong:Be,thematicBreak:x}}].concat(t.htmlExtensions||[])),c={tightStack:s,definitions:r},u={lineEndingIfNeeded:S,options:t,encode:E,raw:v,tag:y,buffer:b,resume:g,setData:p,getData:m};let f=t.defaultLineEnding;return h;function h(j){let de=-1,ve=0;const Ee=[];let Ue=[],Tt=[];for(;++de<j.length;)!f&&(j[de][1].type==="lineEnding"||j[de][1].type==="lineEndingBlank")&&(f=j[de][2].sliceSerialize(j[de][1])),(j[de][1].type==="listOrdered"||j[de][1].type==="listUnordered")&&(j[de][0]==="enter"?Ee.push(de):d(j.slice(Ee.pop(),de))),j[de][1].type==="definition"&&(j[de][0]==="enter"?(Tt=un(Tt,j.slice(ve,de)),ve=de):(Ue=un(Ue,j.slice(ve,de+1)),ve=de+1));Ue=un(Ue,Tt),Ue=un(Ue,j.slice(ve)),de=-1;const V=Ue;for(l.enter.null&&l.enter.null.call(u);++de<j.length;){const Pe=l[V[de][0]],ct=V[de][1].type,rt=Pe[ct];_4.call(Pe,ct)&&rt&&rt.call(Object.assign({sliceSerialize:V[de][2].sliceSerialize},u),V[de][1])}return l.exit.null&&l.exit.null.call(u),i[0].join("")}function d(j){const de=j.length;let ve=0,Ee=0,Ue=!1,Tt;for(;++ve<de;){const V=j[ve];if(V[1]._container)Tt=void 0,V[0]==="enter"?Ee++:Ee--;else switch(V[1].type){case"listItemPrefix":{V[0]==="exit"&&(Tt=!0);break}case"linePrefix":break;case"lineEndingBlank":{V[0]==="enter"&&!Ee&&(Tt?Tt=void 0:Ue=!0);break}default:Tt=void 0}}j[0][1]._loose=Ue}function p(j,de){c[j]=de}function m(j){return c[j]}function b(){i.push([])}function g(){return i.pop().join("")}function y(j){n&&(p("lastWasTag",!0),i[i.length-1].push(j))}function v(j){p("lastWasTag"),i[i.length-1].push(j)}function w(){v(f||`
3452
- `)}function S(){const j=i[i.length-1],de=j[j.length-1],ve=de?de.charCodeAt(de.length-1):null;ve===10||ve===13||ve===null||w()}function E(j){return m("ignoreEncode")?j:I4(j)}function k(){g()}function M(j){s.push(!j._loose),S(),y("<ol"),p("expectFirstItem",!0)}function D(j){s.push(!j._loose),S(),y("<ul"),p("expectFirstItem",!0)}function B(j){if(m("expectFirstItem")){const de=Number.parseInt(this.sliceSerialize(j),10);de!==1&&y(' start="'+E(String(de))+'"')}}function I(){m("expectFirstItem")?y(">"):ne(),S(),y("<li>"),p("expectFirstItem"),p("lastWasTag")}function q(){ne(),s.pop(),w(),y("</ol>")}function Z(){ne(),s.pop(),w(),y("</ul>")}function ne(){m("lastWasTag")&&!m("slurpAllLineEndings")&&S(),y("</li>"),p("slurpAllLineEndings")}function J(){s.push(!1),S(),y("<blockquote>")}function ce(){s.pop(),S(),y("</blockquote>"),p("slurpAllLineEndings")}function ae(){s[s.length-1]||(S(),y("<p>")),p("slurpAllLineEndings")}function we(){s[s.length-1]?p("slurpAllLineEndings",!0):y("</p>")}function me(){S(),y("<pre><code"),p("fencesCount",0)}function U(){const j=g();y(' class="language-'+j+'"')}function Ae(){const j=m("fencesCount")||0;j||(y(">"),p("slurpOneLineEnding",!0)),p("fencesCount",j+1)}function Ce(){S(),y("<pre><code>")}function H(){const j=m("fencesCount");j!==void 0&&j<2&&c.tightStack.length>0&&!m("lastWasTag")&&w(),m("flowCodeSeenData")&&S(),y("</code></pre>"),j!==void 0&&j<2&&S(),p("flowCodeSeenData"),p("fencesCount"),p("slurpOneLineEnding")}function ze(){o.push({image:!0}),n=void 0}function qe(){o.push({})}function Q(j){o[o.length-1].labelId=this.sliceSerialize(j)}function X(){o[o.length-1].label=g()}function re(j){o[o.length-1].referenceId=this.sliceSerialize(j)}function ie(){b(),o[o.length-1].destination=""}function ye(){b(),p("ignoreEncode",!0)}function L(){o[o.length-1].destination=g(),p("ignoreEncode")}function R(){o[o.length-1].title=g()}function se(){let j=o.length-1;const de=o[j],ve=de.referenceId||de.labelId,Ee=de.destination===void 0?r[Jc(ve)]:de;for(n=!0;j--;)if(o[j].image){n=void 0;break}de.image?(y('<img src="'+od(Ee.destination,t.allowDangerousProtocol?void 0:BV)+'" alt="'),v(de.label),y('"')):y('<a href="'+od(Ee.destination,t.allowDangerousProtocol?void 0:D4)+'"'),y(Ee.title?' title="'+Ee.title+'"':""),de.image?y(" />"):(y(">"),v(de.label),y("</a>")),o.pop()}function pe(){b(),o.push({})}function Re(j){g(),o[o.length-1].labelId=this.sliceSerialize(j)}function Te(){b(),p("ignoreEncode",!0)}function Ie(){o[o.length-1].destination=g(),p("ignoreEncode")}function Me(){o[o.length-1].title=g()}function wt(){const j=o[o.length-1],de=Jc(j.labelId);g(),_4.call(r,de)||(r[de]=o[o.length-1]),o.pop()}function hn(){p("slurpAllLineEndings",!0)}function Bt(j){m("headingRank")||(p("headingRank",this.sliceSerialize(j).length),S(),y("<h"+m("headingRank")+">"))}function nt(){b(),p("slurpAllLineEndings")}function Nt(){p("slurpAllLineEndings",!0)}function Wt(){y("</h"+m("headingRank")+">"),p("headingRank")}function st(j){p("headingRank",this.sliceSerialize(j).charCodeAt(0)===61?1:2)}function Yt(){const j=g();S(),y("<h"+m("headingRank")+">"),v(j),y("</h"+m("headingRank")+">"),p("slurpAllLineEndings"),p("headingRank")}function F(j){v(E(this.sliceSerialize(j)))}function A(j){if(!m("slurpAllLineEndings")){if(m("slurpOneLineEnding")){p("slurpOneLineEnding");return}if(m("inCodeText")){v(" ");return}v(E(this.sliceSerialize(j)))}}function C(j){v(E(this.sliceSerialize(j))),p("flowCodeSeenData",!0)}function z(){y("<br />")}function T(){S(),Y()}function G(){p("ignoreEncode")}function Y(){t.allowDangerousHtml&&p("ignoreEncode",!0)}function ge(){y("<em>")}function $(){y("<strong>")}function ee(){p("inCodeText",!0),y("<code>")}function _(){p("inCodeText"),y("</code>")}function ue(){y("</em>")}function Be(){y("</strong>")}function x(){S(),y("<hr />")}function te(j){p("characterReferenceType",j.type)}function oe(j){let de=this.sliceSerialize(j);de=m("characterReferenceType")?SV(de,m("characterReferenceType")==="characterReferenceMarkerNumeric"?10:16):T4(de),v(E(de)),p("characterReferenceType")}function P(j){const de=this.sliceSerialize(j);y('<a href="'+od(de,t.allowDangerousProtocol?void 0:D4)+'">'),v(E(de)),y("</a>")}function W(j){const de=this.sliceSerialize(j);y('<a href="'+od("mailto:"+de)+'">'),v(E(de)),y("</a>")}}function ut(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return s;function s(l){return Ke(l)?(e.enter(n),a(l)):t(l)}function a(l){return Ke(l)&&o++<i?(e.consume(l),a):(e.exit(n),t(l))}}const MV={tokenize:PV};function PV(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),ut(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),o(a)}function o(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(a)}function s(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return He(a)?(e.consume(a),e.exit("chunkText"),o):(e.consume(a),s)}}const OV={tokenize:LV},R4={tokenize:NV};function LV(e){const t=this,n=[];let r=0,i,o,s;return a;function a(v){if(r<n.length){const w=n[r];return t.containerState=w[1],e.attempt(w[0].continuation,l,c)(v)}return c(v)}function l(v){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&y();const w=t.events.length;let S=w,E;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){E=t.events[S][1].end;break}g(r);let k=w;for(;k<t.events.length;)t.events[k][1].end=Object.assign({},E),k++;return oi(t.events,S+1,0,t.events.slice(w)),t.events.length=k,c(v)}return a(v)}function c(v){if(r===n.length){if(!i)return h(v);if(i.currentConstruct&&i.currentConstruct.concrete)return p(v);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(R4,u,f)(v)}function u(v){return i&&y(),g(r),h(v)}function f(v){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,p(v)}function h(v){return t.containerState={},e.attempt(R4,d,p)(v)}function d(v){return r++,n.push([t.currentConstruct,t.containerState]),h(v)}function p(v){if(v===null){i&&y(),g(0),e.consume(v);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:o,_tokenizer:i}),m(v)}function m(v){if(v===null){b(e.exit("chunkFlow"),!0),g(0),e.consume(v);return}return He(v)?(e.consume(v),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(v),m)}function b(v,w){const S=t.sliceStream(v);if(w&&S.push(null),v.previous=o,o&&(o.next=v),o=v,i.defineSkip(v.start),i.write(S),t.parser.lazy[v.start.line]){let E=i.events.length;for(;E--;)if(i.events[E][1].start.offset<s&&(!i.events[E][1].end||i.events[E][1].end.offset>s))return;const k=t.events.length;let M=k,D,B;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){if(D){B=t.events[M][1].end;break}D=!0}for(g(r),E=k;E<t.events.length;)t.events[E][1].end=Object.assign({},B),E++;oi(t.events,M+1,0,t.events.slice(k)),t.events.length=E}}function g(v){let w=n.length;for(;w-- >v;){const S=n[w];t.containerState=S[1],S[0].exit.call(t,e)}n.length=v}function y(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function NV(e,t,n){return ut(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function B4(e){if(e===null||An(e)||DV(e))return 1;if(_V(e))return 2}function v1(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const x1={name:"attention",tokenize:UV,resolveAll:zV};function zV(e,t){let n=-1,r,i,o,s,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f=Object.assign({},e[r][1].end),h=Object.assign({},e[n][1].start);F4(f,-l),F4(h,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},e[r][1].end)},a={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:h},o={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},i={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},a.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},a.end),c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=un(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=un(c,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",o,t]]),c=un(c,v1(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=un(c,[["exit",o,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=un(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,oi(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function UV(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=B4(r);let o;return s;function s(l){return o=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===o)return e.consume(l),a;const c=e.exit("attentionSequence"),u=B4(l),f=!u||u===2&&i||n.includes(l),h=!i||i===2&&u||n.includes(r);return c._open=!!(o===42?f:f&&(i||!h)),c._close=!!(o===42?h:h&&(u||!f)),t(l)}}function F4(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const HV={name:"autolink",tokenize:GV};function GV(e,t,n){let r=0;return i;function i(d){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(d){return Lr(d)?(e.consume(d),s):d===64?n(d):c(d)}function s(d){return d===43||d===45||d===46||Fn(d)?(r=1,a(d)):c(d)}function a(d){return d===58?(e.consume(d),r=0,l):(d===43||d===45||d===46||Fn(d))&&r++<32?(e.consume(d),a):(r=0,c(d))}function l(d){return d===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),t):d===null||d===32||d===60||y1(d)?n(d):(e.consume(d),l)}function c(d){return d===64?(e.consume(d),u):kV(d)?(e.consume(d),c):n(d)}function u(d){return Fn(d)?f(d):n(d)}function f(d){return d===46?(e.consume(d),r=0,u):d===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),t):h(d)}function h(d){if((d===45||Fn(d))&&r++<63){const p=d===45?h:f;return e.consume(d),p}return n(d)}}const sd={tokenize:jV,partial:!0};function jV(e,t,n){return r;function r(o){return Ke(o)?ut(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||He(o)?t(o):n(o)}}const M4={name:"blockQuote",tokenize:VV,continuation:{tokenize:qV},exit:$V};function VV(e,t,n){const r=this;return i;function i(s){if(s===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),o}return n(s)}function o(s){return Ke(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function qV(e,t,n){const r=this;return i;function i(s){return Ke(s)?ut(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):o(s)}function o(s){return e.attempt(M4,t,n)(s)}}function $V(e){e.exit("blockQuote")}const P4={name:"characterEscape",tokenize:WV};function WV(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return IV(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const O4={name:"characterReference",tokenize:YV};function YV(e,t,n){const r=this;let i=0,o,s;return a;function a(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),o=31,s=Fn,u(f))}function c(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,s=TV,u):(e.enter("characterReferenceValue"),o=7,s=w1,u(f))}function u(f){if(f===59&&i){const h=e.exit("characterReferenceValue");return s===Fn&&!T4(r.sliceSerialize(h))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(f)&&i++<o?(e.consume(f),u):n(f)}}const L4={tokenize:ZV,partial:!0},N4={name:"codeFenced",tokenize:QV,concrete:!0};function QV(e,t,n){const r=this,i={tokenize:S,partial:!0};let o=0,s=0,a;return l;function l(E){return c(E)}function c(E){const k=r.events[r.events.length-1];return o=k&&k[1].type==="linePrefix"?k[2].sliceSerialize(k[1],!0).length:0,a=E,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(E)}function u(E){return E===a?(s++,e.consume(E),u):s<3?n(E):(e.exit("codeFencedFenceSequence"),Ke(E)?ut(e,f,"whitespace")(E):f(E))}function f(E){return E===null||He(E)?(e.exit("codeFencedFence"),r.interrupt?t(E):e.check(L4,m,w)(E)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(E))}function h(E){return E===null||He(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(E)):Ke(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ut(e,d,"whitespace")(E)):E===96&&E===a?n(E):(e.consume(E),h)}function d(E){return E===null||He(E)?f(E):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(E))}function p(E){return E===null||He(E)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(E)):E===96&&E===a?n(E):(e.consume(E),p)}function m(E){return e.attempt(i,w,b)(E)}function b(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),g}function g(E){return o>0&&Ke(E)?ut(e,y,"linePrefix",o+1)(E):y(E)}function y(E){return E===null||He(E)?e.check(L4,m,w)(E):(e.enter("codeFlowValue"),v(E))}function v(E){return E===null||He(E)?(e.exit("codeFlowValue"),y(E)):(e.consume(E),v)}function w(E){return e.exit("codeFenced"),t(E)}function S(E,k,M){let D=0;return B;function B(J){return E.enter("lineEnding"),E.consume(J),E.exit("lineEnding"),I}function I(J){return E.enter("codeFencedFence"),Ke(J)?ut(E,q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):q(J)}function q(J){return J===a?(E.enter("codeFencedFenceSequence"),Z(J)):M(J)}function Z(J){return J===a?(D++,E.consume(J),Z):D>=s?(E.exit("codeFencedFenceSequence"),Ke(J)?ut(E,ne,"whitespace")(J):ne(J)):M(J)}function ne(J){return J===null||He(J)?(E.exit("codeFencedFence"),k(J)):M(J)}}}function ZV(e,t,n){const r=this;return i;function i(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const A1={name:"codeIndented",tokenize:KV},XV={tokenize:JV,partial:!0};function KV(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),ut(e,o,"linePrefix",5)(c)}function o(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):n(c)}function s(c){return c===null?l(c):He(c)?e.attempt(XV,s,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||He(c)?(e.exit("codeFlowValue"),s(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function JV(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):He(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):ut(e,o,"linePrefix",5)(s)}function o(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):He(s)?i(s):n(s)}}const eq={name:"codeText",tokenize:rq,resolve:tq,previous:nq};function tq(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function nq(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function rq(e,t,n){let r=0,i,o;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),a(f)}function a(f){return f===96?(e.consume(f),r++,a):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(o=e.enter("codeTextSequence"),i=0,u(f)):He(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(f))}function c(f){return f===null||f===32||f===96||He(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),c)}function u(f){return f===96?(e.consume(f),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(o.type="codeTextData",c(f))}}class iq{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&eu(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),eu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),eu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);eu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);eu(this.left,n.reverse())}}}function eu(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function z4(e){const t={};let n=-1,r,i,o,s,a,l,c;const u=new iq(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,o=0,o<l.length&&l[o][1].type==="lineEndingBlank"&&(o+=2),o<l.length&&l[o][1].type==="content"))for(;++o<l.length&&l[o][1].type!=="content";)l[o][1].type==="chunkText"&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,oq(u,n)),n=t[n],c=!0);else if(r[1]._container){for(o=n,i=void 0;o--&&(s=u.get(o),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=o);i&&(r[1].end=Object.assign({},u.get(i)[1].start),a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return oi(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function oq(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[],s=n._tokenizer||r.parser[n.contentType](n.start),a=s.events,l=[],c={};let u,f,h=-1,d=n,p=0,m=0;const b=[m];for(;d;){for(;e.get(++i)[1]!==d;);o.push(i),d._tokenizer||(u=r.sliceStream(d),d.next||u.push(null),f&&s.defineSkip(d.start),d._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),d._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=d,d=d.next}for(d=n;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(m=h+1,b.push(m),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(s.events=[],d?(d._tokenizer=void 0,d.previous=void 0):b.pop(),h=b.length;h--;){const g=a.slice(b[h],b[h+1]),y=o.pop();l.push([y,y+g.length-1]),e.splice(y,2,g)}for(l.reverse(),h=-1;++h<l.length;)c[p+l[h][0]]=p+l[h][1],p+=l[h][1]-l[h][0]-1;return c}const sq={tokenize:cq,resolve:lq},aq={tokenize:uq,partial:!0};function lq(e){return z4(e),e}function cq(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?o(a):He(a)?e.check(aq,s,o)(a):(e.consume(a),i)}function o(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function s(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function uq(e,t,n){const r=this;return i;function i(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ut(e,o,"linePrefix")}function o(s){if(s===null||He(s))return n(s);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function U4(e,t,n,r,i,o,s,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return f;function f(g){return g===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(g),e.exit(o),h):g===null||g===32||g===41||y1(g)?n(g):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(g))}function h(g){return g===62?(e.enter(o),e.consume(g),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),d(g))}function d(g){return g===62?(e.exit("chunkString"),e.exit(a),h(g)):g===null||g===60||He(g)?n(g):(e.consume(g),g===92?p:d)}function p(g){return g===60||g===62||g===92?(e.consume(g),d):d(g)}function m(g){return!u&&(g===null||g===41||An(g))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(g)):u<c&&g===40?(e.consume(g),u++,m):g===41?(e.consume(g),u--,m):g===null||g===32||g===40||y1(g)?n(g):(e.consume(g),g===92?b:m)}function b(g){return g===40||g===41||g===92?(e.consume(g),m):m(g)}}function H4(e,t,n,r,i,o){const s=this;let a=0,l;return c;function c(d){return e.enter(r),e.enter(i),e.consume(d),e.exit(i),e.enter(o),u}function u(d){return a>999||d===null||d===91||d===93&&!l||d===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):d===93?(e.exit(o),e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):He(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),f(d))}function f(d){return d===null||d===91||d===93||He(d)||a++>999?(e.exit("chunkString"),u(d)):(e.consume(d),l||(l=!Ke(d)),d===92?h:f)}function h(d){return d===91||d===92||d===93?(e.consume(d),a++,f):f(d)}}function G4(e,t,n,r,i,o){let s;return a;function a(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),s=h===40?41:h,l):n(h)}function l(h){return h===s?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(o),c(h))}function c(h){return h===s?(e.exit(o),l(s)):h===null?n(h):He(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),ut(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===s||h===null||He(h)?(e.exit("chunkString"),c(h)):(e.consume(h),h===92?f:u)}function f(h){return h===s||h===92?(e.consume(h),u):u(h)}}function tu(e,t){let n;return r;function r(i){return He(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ke(i)?ut(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const fq={name:"definition",tokenize:dq},hq={tokenize:pq,partial:!0};function dq(e,t,n){const r=this;let i;return o;function o(d){return e.enter("definition"),s(d)}function s(d){return H4.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function a(d){return i=Jc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(e.enter("definitionMarker"),e.consume(d),e.exit("definitionMarker"),l):n(d)}function l(d){return An(d)?tu(e,c)(d):c(d)}function c(d){return U4(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function u(d){return e.attempt(hq,f,f)(d)}function f(d){return Ke(d)?ut(e,h,"whitespace")(d):h(d)}function h(d){return d===null||He(d)?(e.exit("definition"),r.parser.defined.push(i),t(d)):n(d)}}function pq(e,t,n){return r;function r(a){return An(a)?tu(e,i)(a):n(a)}function i(a){return G4(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return Ke(a)?ut(e,s,"whitespace")(a):s(a)}function s(a){return a===null||He(a)?t(a):n(a)}}const gq={name:"hardBreakEscape",tokenize:mq};function mq(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return He(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const bq={name:"headingAtx",tokenize:wq,resolve:yq};function yq(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},oi(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function wq(e,t,n){let r=0;return i;function i(u){return e.enter("atxHeading"),o(u)}function o(u){return e.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&r++<6?(e.consume(u),s):u===null||An(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||He(u)?(e.exit("atxHeading"),t(u)):Ke(u)?ut(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||An(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const vq=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],j4=["pre","script","style","textarea"],xq={name:"htmlFlow",tokenize:Cq,resolveTo:Sq,concrete:!0},Aq={tokenize:Tq,partial:!0},Eq={tokenize:kq,partial:!0};function Sq(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Cq(e,t,n){const r=this;let i,o,s,a,l;return c;function c(H){return u(H)}function u(H){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(H),f}function f(H){return H===33?(e.consume(H),h):H===47?(e.consume(H),o=!0,m):H===63?(e.consume(H),i=3,r.interrupt?t:U):Lr(H)?(e.consume(H),s=String.fromCharCode(H),b):n(H)}function h(H){return H===45?(e.consume(H),i=2,d):H===91?(e.consume(H),i=5,a=0,p):Lr(H)?(e.consume(H),i=4,r.interrupt?t:U):n(H)}function d(H){return H===45?(e.consume(H),r.interrupt?t:U):n(H)}function p(H){const ze="CDATA[";return H===ze.charCodeAt(a++)?(e.consume(H),a===ze.length?r.interrupt?t:q:p):n(H)}function m(H){return Lr(H)?(e.consume(H),s=String.fromCharCode(H),b):n(H)}function b(H){if(H===null||H===47||H===62||An(H)){const ze=H===47,qe=s.toLowerCase();return!ze&&!o&&j4.includes(qe)?(i=1,r.interrupt?t(H):q(H)):vq.includes(s.toLowerCase())?(i=6,ze?(e.consume(H),g):r.interrupt?t(H):q(H)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(H):o?y(H):v(H))}return H===45||Fn(H)?(e.consume(H),s+=String.fromCharCode(H),b):n(H)}function g(H){return H===62?(e.consume(H),r.interrupt?t:q):n(H)}function y(H){return Ke(H)?(e.consume(H),y):B(H)}function v(H){return H===47?(e.consume(H),B):H===58||H===95||Lr(H)?(e.consume(H),w):Ke(H)?(e.consume(H),v):B(H)}function w(H){return H===45||H===46||H===58||H===95||Fn(H)?(e.consume(H),w):S(H)}function S(H){return H===61?(e.consume(H),E):Ke(H)?(e.consume(H),S):v(H)}function E(H){return H===null||H===60||H===61||H===62||H===96?n(H):H===34||H===39?(e.consume(H),l=H,k):Ke(H)?(e.consume(H),E):M(H)}function k(H){return H===l?(e.consume(H),l=null,D):H===null||He(H)?n(H):(e.consume(H),k)}function M(H){return H===null||H===34||H===39||H===47||H===60||H===61||H===62||H===96||An(H)?S(H):(e.consume(H),M)}function D(H){return H===47||H===62||Ke(H)?v(H):n(H)}function B(H){return H===62?(e.consume(H),I):n(H)}function I(H){return H===null||He(H)?q(H):Ke(H)?(e.consume(H),I):n(H)}function q(H){return H===45&&i===2?(e.consume(H),ce):H===60&&i===1?(e.consume(H),ae):H===62&&i===4?(e.consume(H),Ae):H===63&&i===3?(e.consume(H),U):H===93&&i===5?(e.consume(H),me):He(H)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Aq,Ce,Z)(H)):H===null||He(H)?(e.exit("htmlFlowData"),Z(H)):(e.consume(H),q)}function Z(H){return e.check(Eq,ne,Ce)(H)}function ne(H){return e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),J}function J(H){return H===null||He(H)?Z(H):(e.enter("htmlFlowData"),q(H))}function ce(H){return H===45?(e.consume(H),U):q(H)}function ae(H){return H===47?(e.consume(H),s="",we):q(H)}function we(H){if(H===62){const ze=s.toLowerCase();return j4.includes(ze)?(e.consume(H),Ae):q(H)}return Lr(H)&&s.length<8?(e.consume(H),s+=String.fromCharCode(H),we):q(H)}function me(H){return H===93?(e.consume(H),U):q(H)}function U(H){return H===62?(e.consume(H),Ae):H===45&&i===2?(e.consume(H),U):q(H)}function Ae(H){return H===null||He(H)?(e.exit("htmlFlowData"),Ce(H)):(e.consume(H),Ae)}function Ce(H){return e.exit("htmlFlow"),t(H)}}function kq(e,t,n){const r=this;return i;function i(s){return He(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):n(s)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function Tq(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(sd,t,n)}}const Iq={name:"htmlText",tokenize:_q};function _q(e,t,n){const r=this;let i,o,s;return a;function a(U){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(U),l}function l(U){return U===33?(e.consume(U),c):U===47?(e.consume(U),S):U===63?(e.consume(U),v):Lr(U)?(e.consume(U),M):n(U)}function c(U){return U===45?(e.consume(U),u):U===91?(e.consume(U),o=0,p):Lr(U)?(e.consume(U),y):n(U)}function u(U){return U===45?(e.consume(U),d):n(U)}function f(U){return U===null?n(U):U===45?(e.consume(U),h):He(U)?(s=f,ae(U)):(e.consume(U),f)}function h(U){return U===45?(e.consume(U),d):f(U)}function d(U){return U===62?ce(U):U===45?h(U):f(U)}function p(U){const Ae="CDATA[";return U===Ae.charCodeAt(o++)?(e.consume(U),o===Ae.length?m:p):n(U)}function m(U){return U===null?n(U):U===93?(e.consume(U),b):He(U)?(s=m,ae(U)):(e.consume(U),m)}function b(U){return U===93?(e.consume(U),g):m(U)}function g(U){return U===62?ce(U):U===93?(e.consume(U),g):m(U)}function y(U){return U===null||U===62?ce(U):He(U)?(s=y,ae(U)):(e.consume(U),y)}function v(U){return U===null?n(U):U===63?(e.consume(U),w):He(U)?(s=v,ae(U)):(e.consume(U),v)}function w(U){return U===62?ce(U):v(U)}function S(U){return Lr(U)?(e.consume(U),E):n(U)}function E(U){return U===45||Fn(U)?(e.consume(U),E):k(U)}function k(U){return He(U)?(s=k,ae(U)):Ke(U)?(e.consume(U),k):ce(U)}function M(U){return U===45||Fn(U)?(e.consume(U),M):U===47||U===62||An(U)?D(U):n(U)}function D(U){return U===47?(e.consume(U),ce):U===58||U===95||Lr(U)?(e.consume(U),B):He(U)?(s=D,ae(U)):Ke(U)?(e.consume(U),D):ce(U)}function B(U){return U===45||U===46||U===58||U===95||Fn(U)?(e.consume(U),B):I(U)}function I(U){return U===61?(e.consume(U),q):He(U)?(s=I,ae(U)):Ke(U)?(e.consume(U),I):D(U)}function q(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),i=U,Z):He(U)?(s=q,ae(U)):Ke(U)?(e.consume(U),q):(e.consume(U),ne)}function Z(U){return U===i?(e.consume(U),i=void 0,J):U===null?n(U):He(U)?(s=Z,ae(U)):(e.consume(U),Z)}function ne(U){return U===null||U===34||U===39||U===60||U===61||U===96?n(U):U===47||U===62||An(U)?D(U):(e.consume(U),ne)}function J(U){return U===47||U===62||An(U)?D(U):n(U)}function ce(U){return U===62?(e.consume(U),e.exit("htmlTextData"),e.exit("htmlText"),t):n(U)}function ae(U){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),we}function we(U){return Ke(U)?ut(e,me,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):me(U)}function me(U){return e.enter("htmlTextData"),s(U)}}const E1={name:"labelEnd",tokenize:Pq,resolveTo:Mq,resolveAll:Fq},Dq={tokenize:Oq},Rq={tokenize:Lq},Bq={tokenize:Nq};function Fq(e){let t=-1;for(;++t<e.length;){const n=e[t][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(e.splice(t+1,n.type==="labelImage"?4:2),n.type="data",t++)}return e}function Mq(e,t){let n=e.length,r=0,i,o,s,a;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=n);const l={type:e[o][1].type==="labelLink"?"link":"image",start:Object.assign({},e[o][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"label",start:Object.assign({},e[o][1].start),end:Object.assign({},e[s][1].end)},u={type:"labelText",start:Object.assign({},e[o+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return a=[["enter",l,t],["enter",c,t]],a=un(a,e.slice(o+1,o+r+3)),a=un(a,[["enter",u,t]]),a=un(a,v1(t.parser.constructs.insideSpan.null,e.slice(o+r+4,s-3),t)),a=un(a,[["exit",u,t],e[s-2],e[s-1],["exit",c,t]]),a=un(a,e.slice(s+1)),a=un(a,[["exit",l,t]]),oi(e,o,e.length,a),e}function Pq(e,t,n){const r=this;let i=r.events.length,o,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return a;function a(h){return o?o._inactive?f(h):(s=r.parser.defined.includes(Jc(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(Dq,u,s?u:f)(h):h===91?e.attempt(Rq,u,s?c:f)(h):s?u(h):f(h)}function c(h){return e.attempt(Bq,u,f)(h)}function u(h){return t(h)}function f(h){return o._balanced=!0,n(h)}}function Oq(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),i}function i(f){return An(f)?tu(e,o)(f):o(f)}function o(f){return f===41?u(f):U4(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return An(f)?tu(e,l)(f):u(f)}function a(f){return n(f)}function l(f){return f===34||f===39||f===40?G4(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):u(f)}function c(f){return An(f)?tu(e,u)(f):u(f)}function u(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function Lq(e,t,n){const r=this;return i;function i(a){return H4.call(r,e,o,s,"reference","referenceMarker","referenceString")(a)}function o(a){return r.parser.defined.includes(Jc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function Nq(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const zq={name:"labelStartImage",tokenize:Uq,resolveAll:E1.resolveAll};function Uq(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),o}function o(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Hq={name:"labelStartLink",tokenize:Gq,resolveAll:E1.resolveAll};function Gq(e,t,n){const r=this;return i;function i(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),o}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const S1={name:"lineEnding",tokenize:jq};function jq(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ut(e,t,"linePrefix")}}const ad={name:"thematicBreak",tokenize:Vq};function Vq(e,t,n){let r=0,i;return o;function o(c){return e.enter("thematicBreak"),s(c)}function s(c){return i=c,a(c)}function a(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||He(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Ke(c)?ut(e,a,"whitespace")(c):a(c))}}const En={name:"list",tokenize:Wq,continuation:{tokenize:Yq},exit:Zq},qq={tokenize:Xq,partial:!0},$q={tokenize:Qq,partial:!0};function Wq(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return a;function a(d){const p=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:w1(d)){if(r.containerState.type||(r.containerState.type=p,e.enter(p,{_container:!0})),p==="listUnordered")return e.enter("listItemPrefix"),d===42||d===45?e.check(ad,n,c)(d):c(d);if(!r.interrupt||d===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(d)}return n(d)}function l(d){return w1(d)&&++s<10?(e.consume(d),l):(!r.interrupt||s<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(e.exit("listItemValue"),c(d)):n(d)}function c(d){return e.enter("listItemMarker"),e.consume(d),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,e.check(sd,r.interrupt?n:u,e.attempt(qq,h,f))}function u(d){return r.containerState.initialBlankLine=!0,o++,h(d)}function f(d){return Ke(d)?(e.enter("listItemPrefixWhitespace"),e.consume(d),e.exit("listItemPrefixWhitespace"),h):n(d)}function h(d){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(d)}}function Yq(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(sd,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ut(e,t,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!Ke(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt($q,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,ut(e,e.attempt(En,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Qq(e,t,n){const r=this;return ut(e,i,"listItemIndent",r.containerState.size+1);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(o):n(o)}}function Zq(e){e.exit(this.containerState.type)}function Xq(e,t,n){const r=this;return ut(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const s=r.events[r.events.length-1];return!Ke(o)&&s&&s[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const V4={name:"setextUnderline",tokenize:Jq,resolveTo:Kq};function Kq(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const s={type:"setextHeading",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",s,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[o][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}function Jq(e,t,n){const r=this;let i;return o;function o(c){let u=r.events.length,f;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){f=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),i=c,s(c)):n(c)}function s(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Ke(c)?ut(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||He(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const e$={tokenize:t$};function t$(e){const t=this,n=e.attempt(sd,r,e.attempt(this.parser.constructs.flowInitial,i,ut(e,e.attempt(this.parser.constructs.flow,i,e.attempt(sq,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const n$={resolveAll:$4()},r$=q4("string"),i$=q4("text");function q4(e){return{tokenize:t,resolveAll:$4(e==="text"?o$:void 0)};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,s,a);return s;function s(u){return c(u)?o(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),o(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const f=i[u];let h=-1;if(f)for(;++h<f.length;){const d=f[h];if(!d.previous||d.previous.call(r,r.previous))return!0}return!1}}}function $4(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function o$(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,s=-1,a=0,l;for(;o--;){const c=i[o];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(c===-2)l=!0,a++;else if(c!==-1){o++;break}}if(a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-a,offset:r.end.offset-a,_index:r.start._index+o,_bufferIndex:o?s:r.start._bufferIndex+s},end:Object.assign({},r.end)};r.end=Object.assign({},c.start),r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}function s$(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const i={},o=[];let s=[],a=[];const l={consume:y,enter:v,exit:w,attempt:k(S),check:k(E),interrupt:k(E,{interrupt:!0})},c={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:d,sliceSerialize:h,now:p,defineSkip:m,write:f};let u=t.tokenize.call(c,l);return t.resolveAll&&o.push(t),c;function f(I){return s=un(s,I),b(),s[s.length-1]!==null?[]:(M(t,0),c.events=v1(o,c.events,c),c.events)}function h(I,q){return l$(d(I),q)}function d(I){return a$(s,I)}function p(){const{line:I,column:q,offset:Z,_index:ne,_bufferIndex:J}=r;return{line:I,column:q,offset:Z,_index:ne,_bufferIndex:J}}function m(I){i[I.line]=I.column,B()}function b(){let I;for(;r._index<s.length;){const q=s[r._index];if(typeof q=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<q.length;)g(q.charCodeAt(r._bufferIndex));else g(q)}}function g(I){u=u(I)}function y(I){He(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,B()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=I}function v(I,q){const Z=q||{};return Z.type=I,Z.start=p(),c.events.push(["enter",Z,c]),a.push(Z),Z}function w(I){const q=a.pop();return q.end=p(),c.events.push(["exit",q,c]),q}function S(I,q){M(I,q.from)}function E(I,q){q.restore()}function k(I,q){return Z;function Z(ne,J,ce){let ae,we,me,U;return Array.isArray(ne)?Ce(ne):"tokenize"in ne?Ce([ne]):Ae(ne);function Ae(Q){return X;function X(re){const ie=re!==null&&Q[re],ye=re!==null&&Q.null,L=[...Array.isArray(ie)?ie:ie?[ie]:[],...Array.isArray(ye)?ye:ye?[ye]:[]];return Ce(L)(re)}}function Ce(Q){return ae=Q,we=0,Q.length===0?ce:H(Q[we])}function H(Q){return X;function X(re){return U=D(),me=Q,Q.partial||(c.currentConstruct=Q),Q.name&&c.parser.constructs.disable.null.includes(Q.name)?qe():Q.tokenize.call(q?Object.assign(Object.create(c),q):c,l,ze,qe)(re)}}function ze(Q){return I(me,U),J}function qe(Q){return U.restore(),++we<ae.length?H(ae[we]):ce}}}function M(I,q){I.resolveAll&&!o.includes(I)&&o.push(I),I.resolve&&oi(c.events,q,c.events.length-q,I.resolve(c.events.slice(q),c)),I.resolveTo&&(c.events=I.resolveTo(c.events,c))}function D(){const I=p(),q=c.previous,Z=c.currentConstruct,ne=c.events.length,J=Array.from(a);return{restore:ce,from:ne};function ce(){r=I,c.previous=q,c.currentConstruct=Z,c.events.length=ne,a=J,B()}}function B(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function a$(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,o)];else{if(s=e.slice(n,i),r>-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}o>0&&s.push(e[i].slice(0,o))}return s}function l$(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let s;if(typeof o=="string")s=o;else switch(o){case-5:{s="\r";break}case-4:{s=`
3451
+ */const S4=e=>!iH(e)&&typeof e.then=="function",C4=1073741823;class bV extends b4{constructor(){super(...arguments),this._$Cwt=C4,this._$Cbt=[],this._$CK=new gV(this),this._$CX=new mV}render(...t){return t.find(n=>!S4(n))??Xt}update(t,n){const r=this._$Cbt;let i=r.length;this._$Cbt=n;const o=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<n.length&&!(a>this._$Cwt);a++){const l=n[a];if(!S4(l))return this._$Cwt=a,l;a<i&&l===r[a]||(this._$Cwt=C4,i=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();const u=o.deref();if(u!==void 0){const f=u._$Cbt.indexOf(l);f>-1&&f<u._$Cwt&&(u._$Cwt=f,u.setValue(c))}}))}return Xt}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}const yV=To(bV),k4=document.createElement("i");function T4(e){const t="&"+e+";";k4.innerHTML=t;const n=k4.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function oi(e,t,n,r){const i=e.length;let o=0,s;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);o<r.length;)s=r.slice(o,o+1e4),s.unshift(t,0),e.splice(...s),o+=1e4,t+=1e4}function un(e,t){return e.length>0?(oi(e,e.length,0,t),e):t}const b1={}.hasOwnProperty;function wV(e){const t={};let n=-1;for(;++n<e.length;)vV(t,e[n]);return t}function vV(e,t){let n;for(n in t){const i=(b1.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let s;if(o)for(s in o){b1.call(i,s)||(i[s]=[]);const a=o[s];xV(i[s],Array.isArray(a)?a:a?[a]:[])}}}function xV(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);oi(e,0,0,r)}function AV(e){const t={};let n=-1;for(;++n<e.length;)EV(t,e[n]);return t}function EV(e,t){let n;for(n in t){const i=(b1.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let s;if(o)for(s in o)i[s]=o[s]}}function SV(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}const CV={'"':"quot","&":"amp","<":"lt",">":"gt"};function I4(e){return e.replace(/["&<>]/g,t);function t(n){return"&"+CV[n]+";"}}function Jc(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Lr=no(/[A-Za-z]/),Fn=no(/[\dA-Za-z]/),kV=no(/[#-'*+\--9=?A-Z^-~]/);function y1(e){return e!==null&&(e<32||e===127)}const w1=no(/\d/),TV=no(/[\dA-Fa-f]/),IV=no(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function An(e){return e!==null&&(e<0||e===32)}function Ke(e){return e===-2||e===-1||e===32}const _V=no(new RegExp("\\p{P}|\\p{S}","u")),DV=no(/\s/);function no(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function od(e,t){const n=I4(RV(e||""));if(!t)return n;const r=n.indexOf(":"),i=n.indexOf("?"),o=n.indexOf("#"),s=n.indexOf("/");return r<0||s>-1&&r>s||i>-1&&r>i||o>-1&&r>o||t.test(n.slice(0,r))?n:""}function RV(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let s="";if(o===37&&Fn(e.charCodeAt(n+1))&&Fn(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(s=String.fromCharCode(o));else if(o>55295&&o<57344){const a=e.charCodeAt(n+1);o<56320&&a>56319&&a<57344?(s=String.fromCharCode(o,a),i=1):s="�"}else s=String.fromCharCode(o);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}const _4={}.hasOwnProperty,D4=/^(https?|ircs?|mailto|xmpp)$/i,BV=/^https?$/i;function FV(e){const t=e||{};let n=!0;const r={},i=[[]],o=[],s=[],l=AV([{enter:{blockQuote:J,codeFenced:me,codeFencedFenceInfo:b,codeFencedFenceMeta:b,codeIndented:Ce,codeText:ee,content:hn,definition:pe,definitionDestinationString:Te,definitionLabelString:b,definitionTitleString:b,emphasis:ge,htmlFlow:T,htmlText:Y,image:ze,label:b,link:qe,listItemMarker:I,listItemValue:B,listOrdered:M,listUnordered:D,paragraph:ae,reference:b,resource:ie,resourceDestinationString:ye,resourceTitleString:b,setextHeading:nt,strong:$},exit:{atxHeading:Wt,atxHeadingSequence:Bt,autolinkEmail:W,autolinkProtocol:P,blockQuote:ce,characterEscapeValue:F,characterReferenceMarkerHexadecimal:ne,characterReferenceMarkerNumeric:ne,characterReferenceValue:oe,codeFenced:H,codeFencedFence:Ae,codeFencedFenceInfo:U,codeFencedFenceMeta:k,codeFlowValue:C,codeIndented:H,codeText:_,codeTextData:F,data:F,definition:wt,definitionDestinationString:Ie,definitionLabelString:Re,definitionTitleString:Me,emphasis:ue,hardBreakEscape:z,hardBreakTrailing:z,htmlFlow:G,htmlFlowData:F,htmlText:G,htmlTextData:F,image:se,label:X,labelText:Q,lineEnding:A,link:se,listOrdered:q,listUnordered:Z,paragraph:we,reference:k,referenceString:re,resource:k,resourceDestinationString:L,resourceTitleString:R,setextHeading:Yt,setextHeadingLineSequence:st,setextHeadingText:Nt,strong:Be,thematicBreak:x}}].concat(t.htmlExtensions||[])),c={tightStack:s,definitions:r},u={lineEndingIfNeeded:S,options:t,encode:E,raw:v,tag:y,buffer:b,resume:g,setData:p,getData:m};let f=t.defaultLineEnding;return h;function h(j){let de=-1,ve=0;const Ee=[];let Ue=[],Tt=[];for(;++de<j.length;)!f&&(j[de][1].type==="lineEnding"||j[de][1].type==="lineEndingBlank")&&(f=j[de][2].sliceSerialize(j[de][1])),(j[de][1].type==="listOrdered"||j[de][1].type==="listUnordered")&&(j[de][0]==="enter"?Ee.push(de):d(j.slice(Ee.pop(),de))),j[de][1].type==="definition"&&(j[de][0]==="enter"?(Tt=un(Tt,j.slice(ve,de)),ve=de):(Ue=un(Ue,j.slice(ve,de+1)),ve=de+1));Ue=un(Ue,Tt),Ue=un(Ue,j.slice(ve)),de=-1;const V=Ue;for(l.enter.null&&l.enter.null.call(u);++de<j.length;){const Pe=l[V[de][0]],ct=V[de][1].type,rt=Pe[ct];_4.call(Pe,ct)&&rt&&rt.call(Object.assign({sliceSerialize:V[de][2].sliceSerialize},u),V[de][1])}return l.exit.null&&l.exit.null.call(u),i[0].join("")}function d(j){const de=j.length;let ve=0,Ee=0,Ue=!1,Tt;for(;++ve<de;){const V=j[ve];if(V[1]._container)Tt=void 0,V[0]==="enter"?Ee++:Ee--;else switch(V[1].type){case"listItemPrefix":{V[0]==="exit"&&(Tt=!0);break}case"linePrefix":break;case"lineEndingBlank":{V[0]==="enter"&&!Ee&&(Tt?Tt=void 0:Ue=!0);break}default:Tt=void 0}}j[0][1]._loose=Ue}function p(j,de){c[j]=de}function m(j){return c[j]}function b(){i.push([])}function g(){return i.pop().join("")}function y(j){n&&(p("lastWasTag",!0),i[i.length-1].push(j))}function v(j){p("lastWasTag"),i[i.length-1].push(j)}function w(){v(f||`
3452
+ `)}function S(){const j=i[i.length-1],de=j[j.length-1],ve=de?de.charCodeAt(de.length-1):null;ve===10||ve===13||ve===null||w()}function E(j){return m("ignoreEncode")?j:I4(j)}function k(){g()}function M(j){s.push(!j._loose),S(),y("<ol"),p("expectFirstItem",!0)}function D(j){s.push(!j._loose),S(),y("<ul"),p("expectFirstItem",!0)}function B(j){if(m("expectFirstItem")){const de=Number.parseInt(this.sliceSerialize(j),10);de!==1&&y(' start="'+E(String(de))+'"')}}function I(){m("expectFirstItem")?y(">"):te(),S(),y("<li>"),p("expectFirstItem"),p("lastWasTag")}function q(){te(),s.pop(),w(),y("</ol>")}function Z(){te(),s.pop(),w(),y("</ul>")}function te(){m("lastWasTag")&&!m("slurpAllLineEndings")&&S(),y("</li>"),p("slurpAllLineEndings")}function J(){s.push(!1),S(),y("<blockquote>")}function ce(){s.pop(),S(),y("</blockquote>"),p("slurpAllLineEndings")}function ae(){s[s.length-1]||(S(),y("<p>")),p("slurpAllLineEndings")}function we(){s[s.length-1]?p("slurpAllLineEndings",!0):y("</p>")}function me(){S(),y("<pre><code"),p("fencesCount",0)}function U(){const j=g();y(' class="language-'+j+'"')}function Ae(){const j=m("fencesCount")||0;j||(y(">"),p("slurpOneLineEnding",!0)),p("fencesCount",j+1)}function Ce(){S(),y("<pre><code>")}function H(){const j=m("fencesCount");j!==void 0&&j<2&&c.tightStack.length>0&&!m("lastWasTag")&&w(),m("flowCodeSeenData")&&S(),y("</code></pre>"),j!==void 0&&j<2&&S(),p("flowCodeSeenData"),p("fencesCount"),p("slurpOneLineEnding")}function ze(){o.push({image:!0}),n=void 0}function qe(){o.push({})}function Q(j){o[o.length-1].labelId=this.sliceSerialize(j)}function X(){o[o.length-1].label=g()}function re(j){o[o.length-1].referenceId=this.sliceSerialize(j)}function ie(){b(),o[o.length-1].destination=""}function ye(){b(),p("ignoreEncode",!0)}function L(){o[o.length-1].destination=g(),p("ignoreEncode")}function R(){o[o.length-1].title=g()}function se(){let j=o.length-1;const de=o[j],ve=de.referenceId||de.labelId,Ee=de.destination===void 0?r[Jc(ve)]:de;for(n=!0;j--;)if(o[j].image){n=void 0;break}de.image?(y('<img src="'+od(Ee.destination,t.allowDangerousProtocol?void 0:BV)+'" alt="'),v(de.label),y('"')):y('<a href="'+od(Ee.destination,t.allowDangerousProtocol?void 0:D4)+'"'),y(Ee.title?' title="'+Ee.title+'"':""),de.image?y(" />"):(y(">"),v(de.label),y("</a>")),o.pop()}function pe(){b(),o.push({})}function Re(j){g(),o[o.length-1].labelId=this.sliceSerialize(j)}function Te(){b(),p("ignoreEncode",!0)}function Ie(){o[o.length-1].destination=g(),p("ignoreEncode")}function Me(){o[o.length-1].title=g()}function wt(){const j=o[o.length-1],de=Jc(j.labelId);g(),_4.call(r,de)||(r[de]=o[o.length-1]),o.pop()}function hn(){p("slurpAllLineEndings",!0)}function Bt(j){m("headingRank")||(p("headingRank",this.sliceSerialize(j).length),S(),y("<h"+m("headingRank")+">"))}function nt(){b(),p("slurpAllLineEndings")}function Nt(){p("slurpAllLineEndings",!0)}function Wt(){y("</h"+m("headingRank")+">"),p("headingRank")}function st(j){p("headingRank",this.sliceSerialize(j).charCodeAt(0)===61?1:2)}function Yt(){const j=g();S(),y("<h"+m("headingRank")+">"),v(j),y("</h"+m("headingRank")+">"),p("slurpAllLineEndings"),p("headingRank")}function F(j){v(E(this.sliceSerialize(j)))}function A(j){if(!m("slurpAllLineEndings")){if(m("slurpOneLineEnding")){p("slurpOneLineEnding");return}if(m("inCodeText")){v(" ");return}v(E(this.sliceSerialize(j)))}}function C(j){v(E(this.sliceSerialize(j))),p("flowCodeSeenData",!0)}function z(){y("<br />")}function T(){S(),Y()}function G(){p("ignoreEncode")}function Y(){t.allowDangerousHtml&&p("ignoreEncode",!0)}function ge(){y("<em>")}function $(){y("<strong>")}function ee(){p("inCodeText",!0),y("<code>")}function _(){p("inCodeText"),y("</code>")}function ue(){y("</em>")}function Be(){y("</strong>")}function x(){S(),y("<hr />")}function ne(j){p("characterReferenceType",j.type)}function oe(j){let de=this.sliceSerialize(j);de=m("characterReferenceType")?SV(de,m("characterReferenceType")==="characterReferenceMarkerNumeric"?10:16):T4(de),v(E(de)),p("characterReferenceType")}function P(j){const de=this.sliceSerialize(j);y('<a href="'+od(de,t.allowDangerousProtocol?void 0:D4)+'">'),v(E(de)),y("</a>")}function W(j){const de=this.sliceSerialize(j);y('<a href="'+od("mailto:"+de)+'">'),v(E(de)),y("</a>")}}function ut(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return s;function s(l){return Ke(l)?(e.enter(n),a(l)):t(l)}function a(l){return Ke(l)&&o++<i?(e.consume(l),a):(e.exit(n),t(l))}}const MV={tokenize:PV};function PV(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),ut(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),o(a)}function o(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(a)}function s(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return He(a)?(e.consume(a),e.exit("chunkText"),o):(e.consume(a),s)}}const OV={tokenize:LV},R4={tokenize:NV};function LV(e){const t=this,n=[];let r=0,i,o,s;return a;function a(v){if(r<n.length){const w=n[r];return t.containerState=w[1],e.attempt(w[0].continuation,l,c)(v)}return c(v)}function l(v){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&y();const w=t.events.length;let S=w,E;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){E=t.events[S][1].end;break}g(r);let k=w;for(;k<t.events.length;)t.events[k][1].end=Object.assign({},E),k++;return oi(t.events,S+1,0,t.events.slice(w)),t.events.length=k,c(v)}return a(v)}function c(v){if(r===n.length){if(!i)return h(v);if(i.currentConstruct&&i.currentConstruct.concrete)return p(v);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(R4,u,f)(v)}function u(v){return i&&y(),g(r),h(v)}function f(v){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,p(v)}function h(v){return t.containerState={},e.attempt(R4,d,p)(v)}function d(v){return r++,n.push([t.currentConstruct,t.containerState]),h(v)}function p(v){if(v===null){i&&y(),g(0),e.consume(v);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:o,_tokenizer:i}),m(v)}function m(v){if(v===null){b(e.exit("chunkFlow"),!0),g(0),e.consume(v);return}return He(v)?(e.consume(v),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(v),m)}function b(v,w){const S=t.sliceStream(v);if(w&&S.push(null),v.previous=o,o&&(o.next=v),o=v,i.defineSkip(v.start),i.write(S),t.parser.lazy[v.start.line]){let E=i.events.length;for(;E--;)if(i.events[E][1].start.offset<s&&(!i.events[E][1].end||i.events[E][1].end.offset>s))return;const k=t.events.length;let M=k,D,B;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){if(D){B=t.events[M][1].end;break}D=!0}for(g(r),E=k;E<t.events.length;)t.events[E][1].end=Object.assign({},B),E++;oi(t.events,M+1,0,t.events.slice(k)),t.events.length=E}}function g(v){let w=n.length;for(;w-- >v;){const S=n[w];t.containerState=S[1],S[0].exit.call(t,e)}n.length=v}function y(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function NV(e,t,n){return ut(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function B4(e){if(e===null||An(e)||DV(e))return 1;if(_V(e))return 2}function v1(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const x1={name:"attention",tokenize:UV,resolveAll:zV};function zV(e,t){let n=-1,r,i,o,s,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f=Object.assign({},e[r][1].end),h=Object.assign({},e[n][1].start);F4(f,-l),F4(h,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},e[r][1].end)},a={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:h},o={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},i={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},a.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},a.end),c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=un(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=un(c,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",o,t]]),c=un(c,v1(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=un(c,[["exit",o,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=un(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,oi(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function UV(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=B4(r);let o;return s;function s(l){return o=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===o)return e.consume(l),a;const c=e.exit("attentionSequence"),u=B4(l),f=!u||u===2&&i||n.includes(l),h=!i||i===2&&u||n.includes(r);return c._open=!!(o===42?f:f&&(i||!h)),c._close=!!(o===42?h:h&&(u||!f)),t(l)}}function F4(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const HV={name:"autolink",tokenize:GV};function GV(e,t,n){let r=0;return i;function i(d){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(d){return Lr(d)?(e.consume(d),s):d===64?n(d):c(d)}function s(d){return d===43||d===45||d===46||Fn(d)?(r=1,a(d)):c(d)}function a(d){return d===58?(e.consume(d),r=0,l):(d===43||d===45||d===46||Fn(d))&&r++<32?(e.consume(d),a):(r=0,c(d))}function l(d){return d===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),t):d===null||d===32||d===60||y1(d)?n(d):(e.consume(d),l)}function c(d){return d===64?(e.consume(d),u):kV(d)?(e.consume(d),c):n(d)}function u(d){return Fn(d)?f(d):n(d)}function f(d){return d===46?(e.consume(d),r=0,u):d===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),t):h(d)}function h(d){if((d===45||Fn(d))&&r++<63){const p=d===45?h:f;return e.consume(d),p}return n(d)}}const sd={tokenize:jV,partial:!0};function jV(e,t,n){return r;function r(o){return Ke(o)?ut(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||He(o)?t(o):n(o)}}const M4={name:"blockQuote",tokenize:VV,continuation:{tokenize:qV},exit:$V};function VV(e,t,n){const r=this;return i;function i(s){if(s===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),o}return n(s)}function o(s){return Ke(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function qV(e,t,n){const r=this;return i;function i(s){return Ke(s)?ut(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):o(s)}function o(s){return e.attempt(M4,t,n)(s)}}function $V(e){e.exit("blockQuote")}const P4={name:"characterEscape",tokenize:WV};function WV(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return IV(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const O4={name:"characterReference",tokenize:YV};function YV(e,t,n){const r=this;let i=0,o,s;return a;function a(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),o=31,s=Fn,u(f))}function c(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,s=TV,u):(e.enter("characterReferenceValue"),o=7,s=w1,u(f))}function u(f){if(f===59&&i){const h=e.exit("characterReferenceValue");return s===Fn&&!T4(r.sliceSerialize(h))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(f)&&i++<o?(e.consume(f),u):n(f)}}const L4={tokenize:ZV,partial:!0},N4={name:"codeFenced",tokenize:QV,concrete:!0};function QV(e,t,n){const r=this,i={tokenize:S,partial:!0};let o=0,s=0,a;return l;function l(E){return c(E)}function c(E){const k=r.events[r.events.length-1];return o=k&&k[1].type==="linePrefix"?k[2].sliceSerialize(k[1],!0).length:0,a=E,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(E)}function u(E){return E===a?(s++,e.consume(E),u):s<3?n(E):(e.exit("codeFencedFenceSequence"),Ke(E)?ut(e,f,"whitespace")(E):f(E))}function f(E){return E===null||He(E)?(e.exit("codeFencedFence"),r.interrupt?t(E):e.check(L4,m,w)(E)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(E))}function h(E){return E===null||He(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(E)):Ke(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ut(e,d,"whitespace")(E)):E===96&&E===a?n(E):(e.consume(E),h)}function d(E){return E===null||He(E)?f(E):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(E))}function p(E){return E===null||He(E)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(E)):E===96&&E===a?n(E):(e.consume(E),p)}function m(E){return e.attempt(i,w,b)(E)}function b(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),g}function g(E){return o>0&&Ke(E)?ut(e,y,"linePrefix",o+1)(E):y(E)}function y(E){return E===null||He(E)?e.check(L4,m,w)(E):(e.enter("codeFlowValue"),v(E))}function v(E){return E===null||He(E)?(e.exit("codeFlowValue"),y(E)):(e.consume(E),v)}function w(E){return e.exit("codeFenced"),t(E)}function S(E,k,M){let D=0;return B;function B(J){return E.enter("lineEnding"),E.consume(J),E.exit("lineEnding"),I}function I(J){return E.enter("codeFencedFence"),Ke(J)?ut(E,q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):q(J)}function q(J){return J===a?(E.enter("codeFencedFenceSequence"),Z(J)):M(J)}function Z(J){return J===a?(D++,E.consume(J),Z):D>=s?(E.exit("codeFencedFenceSequence"),Ke(J)?ut(E,te,"whitespace")(J):te(J)):M(J)}function te(J){return J===null||He(J)?(E.exit("codeFencedFence"),k(J)):M(J)}}}function ZV(e,t,n){const r=this;return i;function i(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const A1={name:"codeIndented",tokenize:KV},XV={tokenize:JV,partial:!0};function KV(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),ut(e,o,"linePrefix",5)(c)}function o(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):n(c)}function s(c){return c===null?l(c):He(c)?e.attempt(XV,s,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||He(c)?(e.exit("codeFlowValue"),s(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function JV(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):He(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):ut(e,o,"linePrefix",5)(s)}function o(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):He(s)?i(s):n(s)}}const eq={name:"codeText",tokenize:rq,resolve:tq,previous:nq};function tq(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function nq(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function rq(e,t,n){let r=0,i,o;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),a(f)}function a(f){return f===96?(e.consume(f),r++,a):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(o=e.enter("codeTextSequence"),i=0,u(f)):He(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(f))}function c(f){return f===null||f===32||f===96||He(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),c)}function u(f){return f===96?(e.consume(f),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(o.type="codeTextData",c(f))}}class iq{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&eu(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),eu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),eu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);eu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);eu(this.left,n.reverse())}}}function eu(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function z4(e){const t={};let n=-1,r,i,o,s,a,l,c;const u=new iq(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,o=0,o<l.length&&l[o][1].type==="lineEndingBlank"&&(o+=2),o<l.length&&l[o][1].type==="content"))for(;++o<l.length&&l[o][1].type!=="content";)l[o][1].type==="chunkText"&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,oq(u,n)),n=t[n],c=!0);else if(r[1]._container){for(o=n,i=void 0;o--&&(s=u.get(o),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=o);i&&(r[1].end=Object.assign({},u.get(i)[1].start),a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return oi(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function oq(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[],s=n._tokenizer||r.parser[n.contentType](n.start),a=s.events,l=[],c={};let u,f,h=-1,d=n,p=0,m=0;const b=[m];for(;d;){for(;e.get(++i)[1]!==d;);o.push(i),d._tokenizer||(u=r.sliceStream(d),d.next||u.push(null),f&&s.defineSkip(d.start),d._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),d._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=d,d=d.next}for(d=n;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(m=h+1,b.push(m),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(s.events=[],d?(d._tokenizer=void 0,d.previous=void 0):b.pop(),h=b.length;h--;){const g=a.slice(b[h],b[h+1]),y=o.pop();l.push([y,y+g.length-1]),e.splice(y,2,g)}for(l.reverse(),h=-1;++h<l.length;)c[p+l[h][0]]=p+l[h][1],p+=l[h][1]-l[h][0]-1;return c}const sq={tokenize:cq,resolve:lq},aq={tokenize:uq,partial:!0};function lq(e){return z4(e),e}function cq(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?o(a):He(a)?e.check(aq,s,o)(a):(e.consume(a),i)}function o(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function s(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function uq(e,t,n){const r=this;return i;function i(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ut(e,o,"linePrefix")}function o(s){if(s===null||He(s))return n(s);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function U4(e,t,n,r,i,o,s,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return f;function f(g){return g===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(g),e.exit(o),h):g===null||g===32||g===41||y1(g)?n(g):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(g))}function h(g){return g===62?(e.enter(o),e.consume(g),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),d(g))}function d(g){return g===62?(e.exit("chunkString"),e.exit(a),h(g)):g===null||g===60||He(g)?n(g):(e.consume(g),g===92?p:d)}function p(g){return g===60||g===62||g===92?(e.consume(g),d):d(g)}function m(g){return!u&&(g===null||g===41||An(g))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(g)):u<c&&g===40?(e.consume(g),u++,m):g===41?(e.consume(g),u--,m):g===null||g===32||g===40||y1(g)?n(g):(e.consume(g),g===92?b:m)}function b(g){return g===40||g===41||g===92?(e.consume(g),m):m(g)}}function H4(e,t,n,r,i,o){const s=this;let a=0,l;return c;function c(d){return e.enter(r),e.enter(i),e.consume(d),e.exit(i),e.enter(o),u}function u(d){return a>999||d===null||d===91||d===93&&!l||d===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):d===93?(e.exit(o),e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):He(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),f(d))}function f(d){return d===null||d===91||d===93||He(d)||a++>999?(e.exit("chunkString"),u(d)):(e.consume(d),l||(l=!Ke(d)),d===92?h:f)}function h(d){return d===91||d===92||d===93?(e.consume(d),a++,f):f(d)}}function G4(e,t,n,r,i,o){let s;return a;function a(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),s=h===40?41:h,l):n(h)}function l(h){return h===s?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(o),c(h))}function c(h){return h===s?(e.exit(o),l(s)):h===null?n(h):He(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),ut(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===s||h===null||He(h)?(e.exit("chunkString"),c(h)):(e.consume(h),h===92?f:u)}function f(h){return h===s||h===92?(e.consume(h),u):u(h)}}function tu(e,t){let n;return r;function r(i){return He(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ke(i)?ut(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const fq={name:"definition",tokenize:dq},hq={tokenize:pq,partial:!0};function dq(e,t,n){const r=this;let i;return o;function o(d){return e.enter("definition"),s(d)}function s(d){return H4.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function a(d){return i=Jc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(e.enter("definitionMarker"),e.consume(d),e.exit("definitionMarker"),l):n(d)}function l(d){return An(d)?tu(e,c)(d):c(d)}function c(d){return U4(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function u(d){return e.attempt(hq,f,f)(d)}function f(d){return Ke(d)?ut(e,h,"whitespace")(d):h(d)}function h(d){return d===null||He(d)?(e.exit("definition"),r.parser.defined.push(i),t(d)):n(d)}}function pq(e,t,n){return r;function r(a){return An(a)?tu(e,i)(a):n(a)}function i(a){return G4(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return Ke(a)?ut(e,s,"whitespace")(a):s(a)}function s(a){return a===null||He(a)?t(a):n(a)}}const gq={name:"hardBreakEscape",tokenize:mq};function mq(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return He(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const bq={name:"headingAtx",tokenize:wq,resolve:yq};function yq(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},oi(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function wq(e,t,n){let r=0;return i;function i(u){return e.enter("atxHeading"),o(u)}function o(u){return e.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&r++<6?(e.consume(u),s):u===null||An(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||He(u)?(e.exit("atxHeading"),t(u)):Ke(u)?ut(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||An(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const vq=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],j4=["pre","script","style","textarea"],xq={name:"htmlFlow",tokenize:Cq,resolveTo:Sq,concrete:!0},Aq={tokenize:Tq,partial:!0},Eq={tokenize:kq,partial:!0};function Sq(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Cq(e,t,n){const r=this;let i,o,s,a,l;return c;function c(H){return u(H)}function u(H){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(H),f}function f(H){return H===33?(e.consume(H),h):H===47?(e.consume(H),o=!0,m):H===63?(e.consume(H),i=3,r.interrupt?t:U):Lr(H)?(e.consume(H),s=String.fromCharCode(H),b):n(H)}function h(H){return H===45?(e.consume(H),i=2,d):H===91?(e.consume(H),i=5,a=0,p):Lr(H)?(e.consume(H),i=4,r.interrupt?t:U):n(H)}function d(H){return H===45?(e.consume(H),r.interrupt?t:U):n(H)}function p(H){const ze="CDATA[";return H===ze.charCodeAt(a++)?(e.consume(H),a===ze.length?r.interrupt?t:q:p):n(H)}function m(H){return Lr(H)?(e.consume(H),s=String.fromCharCode(H),b):n(H)}function b(H){if(H===null||H===47||H===62||An(H)){const ze=H===47,qe=s.toLowerCase();return!ze&&!o&&j4.includes(qe)?(i=1,r.interrupt?t(H):q(H)):vq.includes(s.toLowerCase())?(i=6,ze?(e.consume(H),g):r.interrupt?t(H):q(H)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(H):o?y(H):v(H))}return H===45||Fn(H)?(e.consume(H),s+=String.fromCharCode(H),b):n(H)}function g(H){return H===62?(e.consume(H),r.interrupt?t:q):n(H)}function y(H){return Ke(H)?(e.consume(H),y):B(H)}function v(H){return H===47?(e.consume(H),B):H===58||H===95||Lr(H)?(e.consume(H),w):Ke(H)?(e.consume(H),v):B(H)}function w(H){return H===45||H===46||H===58||H===95||Fn(H)?(e.consume(H),w):S(H)}function S(H){return H===61?(e.consume(H),E):Ke(H)?(e.consume(H),S):v(H)}function E(H){return H===null||H===60||H===61||H===62||H===96?n(H):H===34||H===39?(e.consume(H),l=H,k):Ke(H)?(e.consume(H),E):M(H)}function k(H){return H===l?(e.consume(H),l=null,D):H===null||He(H)?n(H):(e.consume(H),k)}function M(H){return H===null||H===34||H===39||H===47||H===60||H===61||H===62||H===96||An(H)?S(H):(e.consume(H),M)}function D(H){return H===47||H===62||Ke(H)?v(H):n(H)}function B(H){return H===62?(e.consume(H),I):n(H)}function I(H){return H===null||He(H)?q(H):Ke(H)?(e.consume(H),I):n(H)}function q(H){return H===45&&i===2?(e.consume(H),ce):H===60&&i===1?(e.consume(H),ae):H===62&&i===4?(e.consume(H),Ae):H===63&&i===3?(e.consume(H),U):H===93&&i===5?(e.consume(H),me):He(H)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Aq,Ce,Z)(H)):H===null||He(H)?(e.exit("htmlFlowData"),Z(H)):(e.consume(H),q)}function Z(H){return e.check(Eq,te,Ce)(H)}function te(H){return e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),J}function J(H){return H===null||He(H)?Z(H):(e.enter("htmlFlowData"),q(H))}function ce(H){return H===45?(e.consume(H),U):q(H)}function ae(H){return H===47?(e.consume(H),s="",we):q(H)}function we(H){if(H===62){const ze=s.toLowerCase();return j4.includes(ze)?(e.consume(H),Ae):q(H)}return Lr(H)&&s.length<8?(e.consume(H),s+=String.fromCharCode(H),we):q(H)}function me(H){return H===93?(e.consume(H),U):q(H)}function U(H){return H===62?(e.consume(H),Ae):H===45&&i===2?(e.consume(H),U):q(H)}function Ae(H){return H===null||He(H)?(e.exit("htmlFlowData"),Ce(H)):(e.consume(H),Ae)}function Ce(H){return e.exit("htmlFlow"),t(H)}}function kq(e,t,n){const r=this;return i;function i(s){return He(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):n(s)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function Tq(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(sd,t,n)}}const Iq={name:"htmlText",tokenize:_q};function _q(e,t,n){const r=this;let i,o,s;return a;function a(U){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(U),l}function l(U){return U===33?(e.consume(U),c):U===47?(e.consume(U),S):U===63?(e.consume(U),v):Lr(U)?(e.consume(U),M):n(U)}function c(U){return U===45?(e.consume(U),u):U===91?(e.consume(U),o=0,p):Lr(U)?(e.consume(U),y):n(U)}function u(U){return U===45?(e.consume(U),d):n(U)}function f(U){return U===null?n(U):U===45?(e.consume(U),h):He(U)?(s=f,ae(U)):(e.consume(U),f)}function h(U){return U===45?(e.consume(U),d):f(U)}function d(U){return U===62?ce(U):U===45?h(U):f(U)}function p(U){const Ae="CDATA[";return U===Ae.charCodeAt(o++)?(e.consume(U),o===Ae.length?m:p):n(U)}function m(U){return U===null?n(U):U===93?(e.consume(U),b):He(U)?(s=m,ae(U)):(e.consume(U),m)}function b(U){return U===93?(e.consume(U),g):m(U)}function g(U){return U===62?ce(U):U===93?(e.consume(U),g):m(U)}function y(U){return U===null||U===62?ce(U):He(U)?(s=y,ae(U)):(e.consume(U),y)}function v(U){return U===null?n(U):U===63?(e.consume(U),w):He(U)?(s=v,ae(U)):(e.consume(U),v)}function w(U){return U===62?ce(U):v(U)}function S(U){return Lr(U)?(e.consume(U),E):n(U)}function E(U){return U===45||Fn(U)?(e.consume(U),E):k(U)}function k(U){return He(U)?(s=k,ae(U)):Ke(U)?(e.consume(U),k):ce(U)}function M(U){return U===45||Fn(U)?(e.consume(U),M):U===47||U===62||An(U)?D(U):n(U)}function D(U){return U===47?(e.consume(U),ce):U===58||U===95||Lr(U)?(e.consume(U),B):He(U)?(s=D,ae(U)):Ke(U)?(e.consume(U),D):ce(U)}function B(U){return U===45||U===46||U===58||U===95||Fn(U)?(e.consume(U),B):I(U)}function I(U){return U===61?(e.consume(U),q):He(U)?(s=I,ae(U)):Ke(U)?(e.consume(U),I):D(U)}function q(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),i=U,Z):He(U)?(s=q,ae(U)):Ke(U)?(e.consume(U),q):(e.consume(U),te)}function Z(U){return U===i?(e.consume(U),i=void 0,J):U===null?n(U):He(U)?(s=Z,ae(U)):(e.consume(U),Z)}function te(U){return U===null||U===34||U===39||U===60||U===61||U===96?n(U):U===47||U===62||An(U)?D(U):(e.consume(U),te)}function J(U){return U===47||U===62||An(U)?D(U):n(U)}function ce(U){return U===62?(e.consume(U),e.exit("htmlTextData"),e.exit("htmlText"),t):n(U)}function ae(U){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),we}function we(U){return Ke(U)?ut(e,me,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):me(U)}function me(U){return e.enter("htmlTextData"),s(U)}}const E1={name:"labelEnd",tokenize:Pq,resolveTo:Mq,resolveAll:Fq},Dq={tokenize:Oq},Rq={tokenize:Lq},Bq={tokenize:Nq};function Fq(e){let t=-1;for(;++t<e.length;){const n=e[t][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(e.splice(t+1,n.type==="labelImage"?4:2),n.type="data",t++)}return e}function Mq(e,t){let n=e.length,r=0,i,o,s,a;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=n);const l={type:e[o][1].type==="labelLink"?"link":"image",start:Object.assign({},e[o][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"label",start:Object.assign({},e[o][1].start),end:Object.assign({},e[s][1].end)},u={type:"labelText",start:Object.assign({},e[o+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return a=[["enter",l,t],["enter",c,t]],a=un(a,e.slice(o+1,o+r+3)),a=un(a,[["enter",u,t]]),a=un(a,v1(t.parser.constructs.insideSpan.null,e.slice(o+r+4,s-3),t)),a=un(a,[["exit",u,t],e[s-2],e[s-1],["exit",c,t]]),a=un(a,e.slice(s+1)),a=un(a,[["exit",l,t]]),oi(e,o,e.length,a),e}function Pq(e,t,n){const r=this;let i=r.events.length,o,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return a;function a(h){return o?o._inactive?f(h):(s=r.parser.defined.includes(Jc(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(Dq,u,s?u:f)(h):h===91?e.attempt(Rq,u,s?c:f)(h):s?u(h):f(h)}function c(h){return e.attempt(Bq,u,f)(h)}function u(h){return t(h)}function f(h){return o._balanced=!0,n(h)}}function Oq(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),i}function i(f){return An(f)?tu(e,o)(f):o(f)}function o(f){return f===41?u(f):U4(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return An(f)?tu(e,l)(f):u(f)}function a(f){return n(f)}function l(f){return f===34||f===39||f===40?G4(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):u(f)}function c(f){return An(f)?tu(e,u)(f):u(f)}function u(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function Lq(e,t,n){const r=this;return i;function i(a){return H4.call(r,e,o,s,"reference","referenceMarker","referenceString")(a)}function o(a){return r.parser.defined.includes(Jc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function Nq(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const zq={name:"labelStartImage",tokenize:Uq,resolveAll:E1.resolveAll};function Uq(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),o}function o(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Hq={name:"labelStartLink",tokenize:Gq,resolveAll:E1.resolveAll};function Gq(e,t,n){const r=this;return i;function i(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),o}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const S1={name:"lineEnding",tokenize:jq};function jq(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ut(e,t,"linePrefix")}}const ad={name:"thematicBreak",tokenize:Vq};function Vq(e,t,n){let r=0,i;return o;function o(c){return e.enter("thematicBreak"),s(c)}function s(c){return i=c,a(c)}function a(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||He(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Ke(c)?ut(e,a,"whitespace")(c):a(c))}}const En={name:"list",tokenize:Wq,continuation:{tokenize:Yq},exit:Zq},qq={tokenize:Xq,partial:!0},$q={tokenize:Qq,partial:!0};function Wq(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return a;function a(d){const p=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:w1(d)){if(r.containerState.type||(r.containerState.type=p,e.enter(p,{_container:!0})),p==="listUnordered")return e.enter("listItemPrefix"),d===42||d===45?e.check(ad,n,c)(d):c(d);if(!r.interrupt||d===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(d)}return n(d)}function l(d){return w1(d)&&++s<10?(e.consume(d),l):(!r.interrupt||s<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(e.exit("listItemValue"),c(d)):n(d)}function c(d){return e.enter("listItemMarker"),e.consume(d),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,e.check(sd,r.interrupt?n:u,e.attempt(qq,h,f))}function u(d){return r.containerState.initialBlankLine=!0,o++,h(d)}function f(d){return Ke(d)?(e.enter("listItemPrefixWhitespace"),e.consume(d),e.exit("listItemPrefixWhitespace"),h):n(d)}function h(d){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(d)}}function Yq(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(sd,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ut(e,t,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!Ke(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt($q,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,ut(e,e.attempt(En,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Qq(e,t,n){const r=this;return ut(e,i,"listItemIndent",r.containerState.size+1);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(o):n(o)}}function Zq(e){e.exit(this.containerState.type)}function Xq(e,t,n){const r=this;return ut(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const s=r.events[r.events.length-1];return!Ke(o)&&s&&s[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const V4={name:"setextUnderline",tokenize:Jq,resolveTo:Kq};function Kq(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const s={type:"setextHeading",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",s,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[o][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}function Jq(e,t,n){const r=this;let i;return o;function o(c){let u=r.events.length,f;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){f=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),i=c,s(c)):n(c)}function s(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Ke(c)?ut(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||He(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const e$={tokenize:t$};function t$(e){const t=this,n=e.attempt(sd,r,e.attempt(this.parser.constructs.flowInitial,i,ut(e,e.attempt(this.parser.constructs.flow,i,e.attempt(sq,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const n$={resolveAll:$4()},r$=q4("string"),i$=q4("text");function q4(e){return{tokenize:t,resolveAll:$4(e==="text"?o$:void 0)};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,s,a);return s;function s(u){return c(u)?o(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),o(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const f=i[u];let h=-1;if(f)for(;++h<f.length;){const d=f[h];if(!d.previous||d.previous.call(r,r.previous))return!0}return!1}}}function $4(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function o$(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,s=-1,a=0,l;for(;o--;){const c=i[o];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(c===-2)l=!0,a++;else if(c!==-1){o++;break}}if(a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-a,offset:r.end.offset-a,_index:r.start._index+o,_bufferIndex:o?s:r.start._bufferIndex+s},end:Object.assign({},r.end)};r.end=Object.assign({},c.start),r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}function s$(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const i={},o=[];let s=[],a=[];const l={consume:y,enter:v,exit:w,attempt:k(S),check:k(E),interrupt:k(E,{interrupt:!0})},c={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:d,sliceSerialize:h,now:p,defineSkip:m,write:f};let u=t.tokenize.call(c,l);return t.resolveAll&&o.push(t),c;function f(I){return s=un(s,I),b(),s[s.length-1]!==null?[]:(M(t,0),c.events=v1(o,c.events,c),c.events)}function h(I,q){return l$(d(I),q)}function d(I){return a$(s,I)}function p(){const{line:I,column:q,offset:Z,_index:te,_bufferIndex:J}=r;return{line:I,column:q,offset:Z,_index:te,_bufferIndex:J}}function m(I){i[I.line]=I.column,B()}function b(){let I;for(;r._index<s.length;){const q=s[r._index];if(typeof q=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<q.length;)g(q.charCodeAt(r._bufferIndex));else g(q)}}function g(I){u=u(I)}function y(I){He(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,B()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=I}function v(I,q){const Z=q||{};return Z.type=I,Z.start=p(),c.events.push(["enter",Z,c]),a.push(Z),Z}function w(I){const q=a.pop();return q.end=p(),c.events.push(["exit",q,c]),q}function S(I,q){M(I,q.from)}function E(I,q){q.restore()}function k(I,q){return Z;function Z(te,J,ce){let ae,we,me,U;return Array.isArray(te)?Ce(te):"tokenize"in te?Ce([te]):Ae(te);function Ae(Q){return X;function X(re){const ie=re!==null&&Q[re],ye=re!==null&&Q.null,L=[...Array.isArray(ie)?ie:ie?[ie]:[],...Array.isArray(ye)?ye:ye?[ye]:[]];return Ce(L)(re)}}function Ce(Q){return ae=Q,we=0,Q.length===0?ce:H(Q[we])}function H(Q){return X;function X(re){return U=D(),me=Q,Q.partial||(c.currentConstruct=Q),Q.name&&c.parser.constructs.disable.null.includes(Q.name)?qe():Q.tokenize.call(q?Object.assign(Object.create(c),q):c,l,ze,qe)(re)}}function ze(Q){return I(me,U),J}function qe(Q){return U.restore(),++we<ae.length?H(ae[we]):ce}}}function M(I,q){I.resolveAll&&!o.includes(I)&&o.push(I),I.resolve&&oi(c.events,q,c.events.length-q,I.resolve(c.events.slice(q),c)),I.resolveTo&&(c.events=I.resolveTo(c.events,c))}function D(){const I=p(),q=c.previous,Z=c.currentConstruct,te=c.events.length,J=Array.from(a);return{restore:ce,from:te};function ce(){r=I,c.previous=q,c.currentConstruct=Z,c.events.length=te,a=J,B()}}function B(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function a$(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,o)];else{if(s=e.slice(n,i),r>-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}o>0&&s.push(e[i].slice(0,o))}return s}function l$(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let s;if(typeof o=="string")s=o;else switch(o){case-5:{s="\r";break}case-4:{s=`
3453
3453
  `;break}case-3:{s=`\r
3454
3454
  `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&i)continue;s=" ";break}default:s=String.fromCharCode(o)}i=o===-2,r.push(s)}return r.join("")}const c$=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:{91:fq},disable:{null:[]},document:{42:En,43:En,45:En,48:En,49:En,50:En,51:En,52:En,53:En,54:En,55:En,56:En,57:En,62:M4},flow:{35:bq,42:ad,45:[V4,ad],60:xq,61:V4,95:ad,96:N4,126:N4},flowInitial:{[-2]:A1,[-1]:A1,32:A1},insideSpan:{null:[x1,n$]},string:{38:O4,92:P4},text:{[-5]:S1,[-4]:S1,[-3]:S1,33:zq,38:O4,42:x1,60:[HV,Iq],91:Hq,92:[gq,P4],93:E1,95:x1,96:eq}},Symbol.toStringTag,{value:"Module"}));function u$(e){const n=wV([c$,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:i(MV),document:i(OV),flow:i(e$),string:i(r$),text:i(i$)};return r;function i(o){return s;function s(a){return s$(r,o,a)}}}function f$(e){for(;!z4(e););return e}const W4=/[\0\t\n\r]/g;function h$(){let e=1,t="",n=!0,r;return i;function i(o,s,a){const l=[];let c,u,f,h,d;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(s||void 0).decode(o)),f=0,t="",n&&(o.charCodeAt(0)===65279&&f++,n=void 0);f<o.length;){if(W4.lastIndex=f,c=W4.exec(o),h=c&&c.index!==void 0?c.index:o.length,d=o.charCodeAt(h),!c){t=o.slice(f);break}if(d===10&&f===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<h&&(l.push(o.slice(f,h)),e+=h-f),d){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=h+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}function d$(e,t,n){return typeof t!="string"&&(n=t,t=void 0),FV(n)(f$(u$(n).document().write(h$()(e,t,!0))))}function p$(e,t={}){const n=d$(e),r=new DOMParser().parseFromString(`<!DOCTYPE html><html><body><div>${n}</div></body></html>`,"text/html");r.normalize(),Y4(r.body);for(const o of r.querySelectorAll("a[href]"))o.setAttribute("target","blank"),o.setAttribute("rel","noopener noreferrer"),o.setAttribute("href",qo(o.getAttribute("href"),t.baseUrl));for(const o of r.querySelectorAll("img[src]"))o.setAttribute("src",qo(o.getAttribute("src"),t.baseUrl));const i=r.body.removeChild(r.querySelector("body > div"));return i.className="markdown",i}function Y4(e){if(e.nodeType!==3){if(e.nodeType!==1||/^(script|iframe|object|embed|svg)$/i.test(e.tagName))return e.remove();for(let t=e.attributes.length;t--;){const n=e.attributes[t].name;/^(class|id|name|href|src|alt|align|valign|(on[a-z]+))$/i.test(n)||e.attributes.removeNamedItem(n)}for(let t=e.childNodes.length;t--;)Y4(e.childNodes[t])}}function Q4(e){e.stopPropagation(),e.preventDefault();const n=e.target.parentElement,r=n.parentElement,o=r.parentElement.querySelector(".panes"),s=[...r.children].findIndex(a=>a==n);for(const a of r.children)a.classList.remove("active-tab");for(const a of o.children)a.classList.remove("active-tab");r.children.item(s).classList.add("active-tab"),o.children.item(s).classList.add("active-tab")}function ld(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function g$(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var C1={exports:{}},Z4;function m$(){return Z4||(Z4=1,function(e){var t=function(){var n=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",o={};function s(l,c){if(!o[l]){o[l]={};for(var u=0;u<l.length;u++)o[l][l.charAt(u)]=u}return o[l][c]}var a={compressToBase64:function(l){if(l==null)return"";var c=a._compress(l,6,function(u){return r.charAt(u)});switch(c.length%4){default:case 0:return c;case 1:return c+"===";case 2:return c+"==";case 3:return c+"="}},decompressFromBase64:function(l){return l==null?"":l==""?null:a._decompress(l.length,32,function(c){return s(r,l.charAt(c))})},compressToUTF16:function(l){return l==null?"":a._compress(l,15,function(c){return n(c+32)})+" "},decompressFromUTF16:function(l){return l==null?"":l==""?null:a._decompress(l.length,16384,function(c){return l.charCodeAt(c)-32})},compressToUint8Array:function(l){for(var c=a.compress(l),u=new Uint8Array(c.length*2),f=0,h=c.length;f<h;f++){var d=c.charCodeAt(f);u[f*2]=d>>>8,u[f*2+1]=d%256}return u},decompressFromUint8Array:function(l){if(l==null)return a.decompress(l);for(var c=new Array(l.length/2),u=0,f=c.length;u<f;u++)c[u]=l[u*2]*256+l[u*2+1];var h=[];return c.forEach(function(d){h.push(n(d))}),a.decompress(h.join(""))},compressToEncodedURIComponent:function(l){return l==null?"":a._compress(l,6,function(c){return i.charAt(c)})},decompressFromEncodedURIComponent:function(l){return l==null?"":l==""?null:(l=l.replace(/ /g,"+"),a._decompress(l.length,32,function(c){return s(i,l.charAt(c))}))},compress:function(l){return a._compress(l,16,function(c){return n(c)})},_compress:function(l,c,u){if(l==null)return"";var f,h,d={},p={},m="",b="",g="",y=2,v=3,w=2,S=[],E=0,k=0,M;for(M=0;M<l.length;M+=1)if(m=l.charAt(M),Object.prototype.hasOwnProperty.call(d,m)||(d[m]=v++,p[m]=!0),b=g+m,Object.prototype.hasOwnProperty.call(d,b))g=b;else{if(Object.prototype.hasOwnProperty.call(p,g)){if(g.charCodeAt(0)<256){for(f=0;f<w;f++)E=E<<1,k==c-1?(k=0,S.push(u(E)),E=0):k++;for(h=g.charCodeAt(0),f=0;f<8;f++)E=E<<1|h&1,k==c-1?(k=0,S.push(u(E)),E=0):k++,h=h>>1}else{for(h=1,f=0;f<w;f++)E=E<<1|h,k==c-1?(k=0,S.push(u(E)),E=0):k++,h=0;for(h=g.charCodeAt(0),f=0;f<16;f++)E=E<<1|h&1,k==c-1?(k=0,S.push(u(E)),E=0):k++,h=h>>1}y--,y==0&&(y=Math.pow(2,w),w++),delete p[g]}else for(h=d[g],f=0;f<w;f++)E=E<<1|h&1,k==c-1?(k=0,S.push(u(E)),E=0):k++,h=h>>1;y--,y==0&&(y=Math.pow(2,w),w++),d[b]=v++,g=String(m)}if(g!==""){if(Object.prototype.hasOwnProperty.call(p,g)){if(g.charCodeAt(0)<256){for(f=0;f<w;f++)E=E<<1,k==c-1?(k=0,S.push(u(E)),E=0):k++;for(h=g.charCodeAt(0),f=0;f<8;f++)E=E<<1|h&1,k==c-1?(k=0,S.push(u(E)),E=0):k++,h=h>>1}else{for(h=1,f=0;f<w;f++)E=E<<1|h,k==c-1?(k=0,S.push(u(E)),E=0):k++,h=0;for(h=g.charCodeAt(0),f=0;f<16;f++)E=E<<1|h&1,k==c-1?(k=0,S.push(u(E)),E=0):k++,h=h>>1}y--,y==0&&(y=Math.pow(2,w),w++),delete p[g]}else for(h=d[g],f=0;f<w;f++)E=E<<1|h&1,k==c-1?(k=0,S.push(u(E)),E=0):k++,h=h>>1;y--,y==0&&(y=Math.pow(2,w),w++)}for(h=2,f=0;f<w;f++)E=E<<1|h&1,k==c-1?(k=0,S.push(u(E)),E=0):k++,h=h>>1;for(;;)if(E=E<<1,k==c-1){S.push(u(E));break}else k++;return S.join("")},decompress:function(l){return l==null?"":l==""?null:a._decompress(l.length,32768,function(c){return l.charCodeAt(c)})},_decompress:function(l,c,u){var f=[],h=4,d=4,p=3,m="",b=[],g,y,v,w,S,E,k,M={val:u(0),position:c,index:1};for(g=0;g<3;g+=1)f[g]=g;for(v=0,S=Math.pow(2,2),E=1;E!=S;)w=M.val&M.position,M.position>>=1,M.position==0&&(M.position=c,M.val=u(M.index++)),v|=(w>0?1:0)*E,E<<=1;switch(v){case 0:for(v=0,S=Math.pow(2,8),E=1;E!=S;)w=M.val&M.position,M.position>>=1,M.position==0&&(M.position=c,M.val=u(M.index++)),v|=(w>0?1:0)*E,E<<=1;k=n(v);break;case 1:for(v=0,S=Math.pow(2,16),E=1;E!=S;)w=M.val&M.position,M.position>>=1,M.position==0&&(M.position=c,M.val=u(M.index++)),v|=(w>0?1:0)*E,E<<=1;k=n(v);break;case 2:return""}for(f[3]=k,y=k,b.push(k);;){if(M.index>l)return"";for(v=0,S=Math.pow(2,p),E=1;E!=S;)w=M.val&M.position,M.position>>=1,M.position==0&&(M.position=c,M.val=u(M.index++)),v|=(w>0?1:0)*E,E<<=1;switch(k=v){case 0:for(v=0,S=Math.pow(2,8),E=1;E!=S;)w=M.val&M.position,M.position>>=1,M.position==0&&(M.position=c,M.val=u(M.index++)),v|=(w>0?1:0)*E,E<<=1;f[d++]=n(v),k=d-1,h--;break;case 1:for(v=0,S=Math.pow(2,16),E=1;E!=S;)w=M.val&M.position,M.position>>=1,M.position==0&&(M.position=c,M.val=u(M.index++)),v|=(w>0?1:0)*E,E<<=1;f[d++]=n(v),k=d-1,h--;break;case 2:return b.join("")}if(h==0&&(h=Math.pow(2,p),p++),f[k])m=f[k];else if(k===d)m=y+y.charAt(0);else return null;b.push(m),f[d++]=y+m.charAt(0),h--,y=m,h==0&&(h=Math.pow(2,p),p++)}}};return a}();e!=null?e.exports=t:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return t})}(C1)),C1.exports}var X4=m$();function b$(){const e=typeof process<"u"?require("util").TextEncoder:TextEncoder;return new e}let K4;function y$(){let e,t=[];for(let n=0;n<256;n++){e=n;for(let r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}function w$(e){K4??(K4=y$());let t=-1;const n=b$().encode(e);for(let r=0;r<n.length;r++)t=t>>>8^K4[(t^n[r])&255];return(t^-1)>>>0}function J4(e){return("00000000"+w$(e).toString(16)).slice(-8)}function eC(e){const t=X4.compressToEncodedURIComponent(JSON.stringify(e));return"#"+t+J4(t)}function v$(e){if(!e||e.length<10)throw new Error("The state string in the URL is too short.");const t=e.slice(1,-8),n=e.slice(-8);if(J4(t)!==n)throw new Error("The state string in the URL is corrupted.");return JSON.parse(X4.decompressFromEncodedURIComponent(t))}let cs;function x$(e){for(const t of e.genomeSpy.getNamedScaleResolutions().values())t.isZoomable()&&t.resetZoom();e.storeHelper.dispatch([...e.provenance.isUndoable()?[as.jumpToPast(0)]:[],Sa.actions.restoreDefaultVisibilities()])}async function k1(e,t){try{e.actions&&t.provenance.dispatchBookmark(e.actions),t.storeHelper.dispatch(Sa.actions.setViewSettings(e.viewSettings));const n=[];for(const[r,i]of Object.entries(e.scaleDomains??{})){const o=t.genomeSpy.getNamedScaleResolutions().get(r);o?n.push(o.zoomTo(i)):console.warn(`Cannot restore scale domain. Unknown name: ${r}`)}await Promise.all(n)}catch(n){console.error(n),Jt(K`<p>Cannot restore the state:</p>
3455
3455
  <p>${n}</p>`),t.provenance.activateState(0)}}async function nu(e,t,n={}){await k1(e,t),(cs||e.notes||n.mode=="shared"&&(e.name||e.notes))&&await A$(e,t,n)}async function A$(e,t,n={}){cs??(cs=Yi("tour",t.appContainer)),await E$(e,t,n)}async function E$(e,t,n){const r=n.database,i=r?await r.getNames():[],o=i.indexOf(e.name),s=r?` ${o+1} of ${i.length}`:"",a=`${n.mode=="shared"?"Shared bookmark":"Bookmark"}${s}: ${e.name??"Unnamed"}`,l=e.notes?p$(e.notes,{baseUrl:t.genomeSpy.spec.baseUrl}):K`<span class="no-notes">No notes provided</span>`,c=async()=>{if(cs==null||cs.close(),cs=void 0,n.mode=="tour"){const m=n.afterTourBookmark;if(typeof m=="string"){const b=await n.database.get(m);if(!b)throw new Error(`No such bookmark: ${m}`);k1(b,t)}else m===null||x$(t)}},u=async m=>{const b=await r.get(i[m]);nu(b,t,n),t.appContainer.querySelector("canvas").focus()},f=async()=>{if(await T1(t.localBookmarkDatabase,e,"add"))try{await t.localBookmarkDatabase.put(e)}catch(m){console.warn(m),Jt(`Cannot import bookmark: ${m}`)}},h=K` <button class="btn" @click=${c}>
@@ -3758,12 +3758,12 @@ ${JSON.stringify(h.stats.first,null,2)}</pre
3758
3758
  *
3759
3759
  * @author Feross Aboukhadijeh <https://feross.org>
3760
3760
  * @license MIT
3761
- */var sC;function iu(){return sC||(sC=1,function(e){const t=U$(),n=H$(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=y,e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=o(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{const F=new Uint8Array(1),A={foo:function(){return 42}};return Object.setPrototypeOf(A,Uint8Array.prototype),Object.setPrototypeOf(F,A),F.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function s(F){if(F>i)throw new RangeError('The value "'+F+'" is invalid for option "size"');const A=new Uint8Array(F);return Object.setPrototypeOf(A,a.prototype),A}function a(F,A,C){if(typeof F=="number"){if(typeof A=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(F)}return l(F,A,C)}a.poolSize=8192;function l(F,A,C){if(typeof F=="string")return h(F,A);if(ArrayBuffer.isView(F))return p(F);if(F==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof F);if(nt(F,ArrayBuffer)||F&&nt(F.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(nt(F,SharedArrayBuffer)||F&&nt(F.buffer,SharedArrayBuffer)))return m(F,A,C);if(typeof F=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const z=F.valueOf&&F.valueOf();if(z!=null&&z!==F)return a.from(z,A,C);const T=b(F);if(T)return T;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof F[Symbol.toPrimitive]=="function")return a.from(F[Symbol.toPrimitive]("string"),A,C);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof F)}a.from=function(F,A,C){return l(F,A,C)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function c(F){if(typeof F!="number")throw new TypeError('"size" argument must be of type number');if(F<0)throw new RangeError('The value "'+F+'" is invalid for option "size"')}function u(F,A,C){return c(F),F<=0?s(F):A!==void 0?typeof C=="string"?s(F).fill(A,C):s(F).fill(A):s(F)}a.alloc=function(F,A,C){return u(F,A,C)};function f(F){return c(F),s(F<0?0:g(F)|0)}a.allocUnsafe=function(F){return f(F)},a.allocUnsafeSlow=function(F){return f(F)};function h(F,A){if((typeof A!="string"||A==="")&&(A="utf8"),!a.isEncoding(A))throw new TypeError("Unknown encoding: "+A);const C=v(F,A)|0;let z=s(C);const T=z.write(F,A);return T!==C&&(z=z.slice(0,T)),z}function d(F){const A=F.length<0?0:g(F.length)|0,C=s(A);for(let z=0;z<A;z+=1)C[z]=F[z]&255;return C}function p(F){if(nt(F,Uint8Array)){const A=new Uint8Array(F);return m(A.buffer,A.byteOffset,A.byteLength)}return d(F)}function m(F,A,C){if(A<0||F.byteLength<A)throw new RangeError('"offset" is outside of buffer bounds');if(F.byteLength<A+(C||0))throw new RangeError('"length" is outside of buffer bounds');let z;return A===void 0&&C===void 0?z=new Uint8Array(F):C===void 0?z=new Uint8Array(F,A):z=new Uint8Array(F,A,C),Object.setPrototypeOf(z,a.prototype),z}function b(F){if(a.isBuffer(F)){const A=g(F.length)|0,C=s(A);return C.length===0||F.copy(C,0,0,A),C}if(F.length!==void 0)return typeof F.length!="number"||Nt(F.length)?s(0):d(F);if(F.type==="Buffer"&&Array.isArray(F.data))return d(F.data)}function g(F){if(F>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return F|0}function y(F){return+F!=F&&(F=0),a.alloc(+F)}a.isBuffer=function(A){return A!=null&&A._isBuffer===!0&&A!==a.prototype},a.compare=function(A,C){if(nt(A,Uint8Array)&&(A=a.from(A,A.offset,A.byteLength)),nt(C,Uint8Array)&&(C=a.from(C,C.offset,C.byteLength)),!a.isBuffer(A)||!a.isBuffer(C))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(A===C)return 0;let z=A.length,T=C.length;for(let G=0,Y=Math.min(z,T);G<Y;++G)if(A[G]!==C[G]){z=A[G],T=C[G];break}return z<T?-1:T<z?1:0},a.isEncoding=function(A){switch(String(A).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(A,C){if(!Array.isArray(A))throw new TypeError('"list" argument must be an Array of Buffers');if(A.length===0)return a.alloc(0);let z;if(C===void 0)for(C=0,z=0;z<A.length;++z)C+=A[z].length;const T=a.allocUnsafe(C);let G=0;for(z=0;z<A.length;++z){let Y=A[z];if(nt(Y,Uint8Array))G+Y.length>T.length?(a.isBuffer(Y)||(Y=a.from(Y)),Y.copy(T,G)):Uint8Array.prototype.set.call(T,Y,G);else if(a.isBuffer(Y))Y.copy(T,G);else throw new TypeError('"list" argument must be an Array of Buffers');G+=Y.length}return T};function v(F,A){if(a.isBuffer(F))return F.length;if(ArrayBuffer.isView(F)||nt(F,ArrayBuffer))return F.byteLength;if(typeof F!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof F);const C=F.length,z=arguments.length>2&&arguments[2]===!0;if(!z&&C===0)return 0;let T=!1;for(;;)switch(A){case"ascii":case"latin1":case"binary":return C;case"utf8":case"utf-8":return Ie(F).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C*2;case"hex":return C>>>1;case"base64":return hn(F).length;default:if(T)return z?-1:Ie(F).length;A=(""+A).toLowerCase(),T=!0}}a.byteLength=v;function w(F,A,C){let z=!1;if((A===void 0||A<0)&&(A=0),A>this.length||((C===void 0||C>this.length)&&(C=this.length),C<=0)||(C>>>=0,A>>>=0,C<=A))return"";for(F||(F="utf8");;)switch(F){case"hex":return me(this,A,C);case"utf8":case"utf-8":return ne(this,A,C);case"ascii":return ae(this,A,C);case"latin1":case"binary":return we(this,A,C);case"base64":return Z(this,A,C);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,A,C);default:if(z)throw new TypeError("Unknown encoding: "+F);F=(F+"").toLowerCase(),z=!0}}a.prototype._isBuffer=!0;function S(F,A,C){const z=F[A];F[A]=F[C],F[C]=z}a.prototype.swap16=function(){const A=this.length;if(A%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let C=0;C<A;C+=2)S(this,C,C+1);return this},a.prototype.swap32=function(){const A=this.length;if(A%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let C=0;C<A;C+=4)S(this,C,C+3),S(this,C+1,C+2);return this},a.prototype.swap64=function(){const A=this.length;if(A%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let C=0;C<A;C+=8)S(this,C,C+7),S(this,C+1,C+6),S(this,C+2,C+5),S(this,C+3,C+4);return this},a.prototype.toString=function(){const A=this.length;return A===0?"":arguments.length===0?ne(this,0,A):w.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(A){if(!a.isBuffer(A))throw new TypeError("Argument must be a Buffer");return this===A?!0:a.compare(this,A)===0},a.prototype.inspect=function(){let A="";const C=e.INSPECT_MAX_BYTES;return A=this.toString("hex",0,C).replace(/(.{2})/g,"$1 ").trim(),this.length>C&&(A+=" ... "),"<Buffer "+A+">"},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(A,C,z,T,G){if(nt(A,Uint8Array)&&(A=a.from(A,A.offset,A.byteLength)),!a.isBuffer(A))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof A);if(C===void 0&&(C=0),z===void 0&&(z=A?A.length:0),T===void 0&&(T=0),G===void 0&&(G=this.length),C<0||z>A.length||T<0||G>this.length)throw new RangeError("out of range index");if(T>=G&&C>=z)return 0;if(T>=G)return-1;if(C>=z)return 1;if(C>>>=0,z>>>=0,T>>>=0,G>>>=0,this===A)return 0;let Y=G-T,ge=z-C;const $=Math.min(Y,ge),ee=this.slice(T,G),_=A.slice(C,z);for(let ue=0;ue<$;++ue)if(ee[ue]!==_[ue]){Y=ee[ue],ge=_[ue];break}return Y<ge?-1:ge<Y?1:0};function E(F,A,C,z,T){if(F.length===0)return-1;if(typeof C=="string"?(z=C,C=0):C>2147483647?C=2147483647:C<-2147483648&&(C=-2147483648),C=+C,Nt(C)&&(C=T?0:F.length-1),C<0&&(C=F.length+C),C>=F.length){if(T)return-1;C=F.length-1}else if(C<0)if(T)C=0;else return-1;if(typeof A=="string"&&(A=a.from(A,z)),a.isBuffer(A))return A.length===0?-1:k(F,A,C,z,T);if(typeof A=="number")return A=A&255,typeof Uint8Array.prototype.indexOf=="function"?T?Uint8Array.prototype.indexOf.call(F,A,C):Uint8Array.prototype.lastIndexOf.call(F,A,C):k(F,[A],C,z,T);throw new TypeError("val must be string, number or Buffer")}function k(F,A,C,z,T){let G=1,Y=F.length,ge=A.length;if(z!==void 0&&(z=String(z).toLowerCase(),z==="ucs2"||z==="ucs-2"||z==="utf16le"||z==="utf-16le")){if(F.length<2||A.length<2)return-1;G=2,Y/=2,ge/=2,C/=2}function $(_,ue){return G===1?_[ue]:_.readUInt16BE(ue*G)}let ee;if(T){let _=-1;for(ee=C;ee<Y;ee++)if($(F,ee)===$(A,_===-1?0:ee-_)){if(_===-1&&(_=ee),ee-_+1===ge)return _*G}else _!==-1&&(ee-=ee-_),_=-1}else for(C+ge>Y&&(C=Y-ge),ee=C;ee>=0;ee--){let _=!0;for(let ue=0;ue<ge;ue++)if($(F,ee+ue)!==$(A,ue)){_=!1;break}if(_)return ee}return-1}a.prototype.includes=function(A,C,z){return this.indexOf(A,C,z)!==-1},a.prototype.indexOf=function(A,C,z){return E(this,A,C,z,!0)},a.prototype.lastIndexOf=function(A,C,z){return E(this,A,C,z,!1)};function M(F,A,C,z){C=Number(C)||0;const T=F.length-C;z?(z=Number(z),z>T&&(z=T)):z=T;const G=A.length;z>G/2&&(z=G/2);let Y;for(Y=0;Y<z;++Y){const ge=parseInt(A.substr(Y*2,2),16);if(Nt(ge))return Y;F[C+Y]=ge}return Y}function D(F,A,C,z){return Bt(Ie(A,F.length-C),F,C,z)}function B(F,A,C,z){return Bt(Me(A),F,C,z)}function I(F,A,C,z){return Bt(hn(A),F,C,z)}function q(F,A,C,z){return Bt(wt(A,F.length-C),F,C,z)}a.prototype.write=function(A,C,z,T){if(C===void 0)T="utf8",z=this.length,C=0;else if(z===void 0&&typeof C=="string")T=C,z=this.length,C=0;else if(isFinite(C))C=C>>>0,isFinite(z)?(z=z>>>0,T===void 0&&(T="utf8")):(T=z,z=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const G=this.length-C;if((z===void 0||z>G)&&(z=G),A.length>0&&(z<0||C<0)||C>this.length)throw new RangeError("Attempt to write outside buffer bounds");T||(T="utf8");let Y=!1;for(;;)switch(T){case"hex":return M(this,A,C,z);case"utf8":case"utf-8":return D(this,A,C,z);case"ascii":case"latin1":case"binary":return B(this,A,C,z);case"base64":return I(this,A,C,z);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,A,C,z);default:if(Y)throw new TypeError("Unknown encoding: "+T);T=(""+T).toLowerCase(),Y=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Z(F,A,C){return A===0&&C===F.length?t.fromByteArray(F):t.fromByteArray(F.slice(A,C))}function ne(F,A,C){C=Math.min(F.length,C);const z=[];let T=A;for(;T<C;){const G=F[T];let Y=null,ge=G>239?4:G>223?3:G>191?2:1;if(T+ge<=C){let $,ee,_,ue;switch(ge){case 1:G<128&&(Y=G);break;case 2:$=F[T+1],($&192)===128&&(ue=(G&31)<<6|$&63,ue>127&&(Y=ue));break;case 3:$=F[T+1],ee=F[T+2],($&192)===128&&(ee&192)===128&&(ue=(G&15)<<12|($&63)<<6|ee&63,ue>2047&&(ue<55296||ue>57343)&&(Y=ue));break;case 4:$=F[T+1],ee=F[T+2],_=F[T+3],($&192)===128&&(ee&192)===128&&(_&192)===128&&(ue=(G&15)<<18|($&63)<<12|(ee&63)<<6|_&63,ue>65535&&ue<1114112&&(Y=ue))}}Y===null?(Y=65533,ge=1):Y>65535&&(Y-=65536,z.push(Y>>>10&1023|55296),Y=56320|Y&1023),z.push(Y),T+=ge}return ce(z)}const J=4096;function ce(F){const A=F.length;if(A<=J)return String.fromCharCode.apply(String,F);let C="",z=0;for(;z<A;)C+=String.fromCharCode.apply(String,F.slice(z,z+=J));return C}function ae(F,A,C){let z="";C=Math.min(F.length,C);for(let T=A;T<C;++T)z+=String.fromCharCode(F[T]&127);return z}function we(F,A,C){let z="";C=Math.min(F.length,C);for(let T=A;T<C;++T)z+=String.fromCharCode(F[T]);return z}function me(F,A,C){const z=F.length;(!A||A<0)&&(A=0),(!C||C<0||C>z)&&(C=z);let T="";for(let G=A;G<C;++G)T+=Wt[F[G]];return T}function U(F,A,C){const z=F.slice(A,C);let T="";for(let G=0;G<z.length-1;G+=2)T+=String.fromCharCode(z[G]+z[G+1]*256);return T}a.prototype.slice=function(A,C){const z=this.length;A=~~A,C=C===void 0?z:~~C,A<0?(A+=z,A<0&&(A=0)):A>z&&(A=z),C<0?(C+=z,C<0&&(C=0)):C>z&&(C=z),C<A&&(C=A);const T=this.subarray(A,C);return Object.setPrototypeOf(T,a.prototype),T};function Ae(F,A,C){if(F%1!==0||F<0)throw new RangeError("offset is not uint");if(F+A>C)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(A,C,z){A=A>>>0,C=C>>>0,z||Ae(A,C,this.length);let T=this[A],G=1,Y=0;for(;++Y<C&&(G*=256);)T+=this[A+Y]*G;return T},a.prototype.readUintBE=a.prototype.readUIntBE=function(A,C,z){A=A>>>0,C=C>>>0,z||Ae(A,C,this.length);let T=this[A+--C],G=1;for(;C>0&&(G*=256);)T+=this[A+--C]*G;return T},a.prototype.readUint8=a.prototype.readUInt8=function(A,C){return A=A>>>0,C||Ae(A,1,this.length),this[A]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(A,C){return A=A>>>0,C||Ae(A,2,this.length),this[A]|this[A+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(A,C){return A=A>>>0,C||Ae(A,2,this.length),this[A]<<8|this[A+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(A,C){return A=A>>>0,C||Ae(A,4,this.length),(this[A]|this[A+1]<<8|this[A+2]<<16)+this[A+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(A,C){return A=A>>>0,C||Ae(A,4,this.length),this[A]*16777216+(this[A+1]<<16|this[A+2]<<8|this[A+3])},a.prototype.readBigUInt64LE=st(function(A){A=A>>>0,se(A,"offset");const C=this[A],z=this[A+7];(C===void 0||z===void 0)&&pe(A,this.length-8);const T=C+this[++A]*2**8+this[++A]*2**16+this[++A]*2**24,G=this[++A]+this[++A]*2**8+this[++A]*2**16+z*2**24;return BigInt(T)+(BigInt(G)<<BigInt(32))}),a.prototype.readBigUInt64BE=st(function(A){A=A>>>0,se(A,"offset");const C=this[A],z=this[A+7];(C===void 0||z===void 0)&&pe(A,this.length-8);const T=C*2**24+this[++A]*2**16+this[++A]*2**8+this[++A],G=this[++A]*2**24+this[++A]*2**16+this[++A]*2**8+z;return(BigInt(T)<<BigInt(32))+BigInt(G)}),a.prototype.readIntLE=function(A,C,z){A=A>>>0,C=C>>>0,z||Ae(A,C,this.length);let T=this[A],G=1,Y=0;for(;++Y<C&&(G*=256);)T+=this[A+Y]*G;return G*=128,T>=G&&(T-=Math.pow(2,8*C)),T},a.prototype.readIntBE=function(A,C,z){A=A>>>0,C=C>>>0,z||Ae(A,C,this.length);let T=C,G=1,Y=this[A+--T];for(;T>0&&(G*=256);)Y+=this[A+--T]*G;return G*=128,Y>=G&&(Y-=Math.pow(2,8*C)),Y},a.prototype.readInt8=function(A,C){return A=A>>>0,C||Ae(A,1,this.length),this[A]&128?(255-this[A]+1)*-1:this[A]},a.prototype.readInt16LE=function(A,C){A=A>>>0,C||Ae(A,2,this.length);const z=this[A]|this[A+1]<<8;return z&32768?z|4294901760:z},a.prototype.readInt16BE=function(A,C){A=A>>>0,C||Ae(A,2,this.length);const z=this[A+1]|this[A]<<8;return z&32768?z|4294901760:z},a.prototype.readInt32LE=function(A,C){return A=A>>>0,C||Ae(A,4,this.length),this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24},a.prototype.readInt32BE=function(A,C){return A=A>>>0,C||Ae(A,4,this.length),this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]},a.prototype.readBigInt64LE=st(function(A){A=A>>>0,se(A,"offset");const C=this[A],z=this[A+7];(C===void 0||z===void 0)&&pe(A,this.length-8);const T=this[A+4]+this[A+5]*2**8+this[A+6]*2**16+(z<<24);return(BigInt(T)<<BigInt(32))+BigInt(C+this[++A]*2**8+this[++A]*2**16+this[++A]*2**24)}),a.prototype.readBigInt64BE=st(function(A){A=A>>>0,se(A,"offset");const C=this[A],z=this[A+7];(C===void 0||z===void 0)&&pe(A,this.length-8);const T=(C<<24)+this[++A]*2**16+this[++A]*2**8+this[++A];return(BigInt(T)<<BigInt(32))+BigInt(this[++A]*2**24+this[++A]*2**16+this[++A]*2**8+z)}),a.prototype.readFloatLE=function(A,C){return A=A>>>0,C||Ae(A,4,this.length),n.read(this,A,!0,23,4)},a.prototype.readFloatBE=function(A,C){return A=A>>>0,C||Ae(A,4,this.length),n.read(this,A,!1,23,4)},a.prototype.readDoubleLE=function(A,C){return A=A>>>0,C||Ae(A,8,this.length),n.read(this,A,!0,52,8)},a.prototype.readDoubleBE=function(A,C){return A=A>>>0,C||Ae(A,8,this.length),n.read(this,A,!1,52,8)};function Ce(F,A,C,z,T,G){if(!a.isBuffer(F))throw new TypeError('"buffer" argument must be a Buffer instance');if(A>T||A<G)throw new RangeError('"value" argument is out of bounds');if(C+z>F.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(A,C,z,T){if(A=+A,C=C>>>0,z=z>>>0,!T){const ge=Math.pow(2,8*z)-1;Ce(this,A,C,z,ge,0)}let G=1,Y=0;for(this[C]=A&255;++Y<z&&(G*=256);)this[C+Y]=A/G&255;return C+z},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(A,C,z,T){if(A=+A,C=C>>>0,z=z>>>0,!T){const ge=Math.pow(2,8*z)-1;Ce(this,A,C,z,ge,0)}let G=z-1,Y=1;for(this[C+G]=A&255;--G>=0&&(Y*=256);)this[C+G]=A/Y&255;return C+z},a.prototype.writeUint8=a.prototype.writeUInt8=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,1,255,0),this[C]=A&255,C+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,2,65535,0),this[C]=A&255,this[C+1]=A>>>8,C+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,2,65535,0),this[C]=A>>>8,this[C+1]=A&255,C+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,4,4294967295,0),this[C+3]=A>>>24,this[C+2]=A>>>16,this[C+1]=A>>>8,this[C]=A&255,C+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,4,4294967295,0),this[C]=A>>>24,this[C+1]=A>>>16,this[C+2]=A>>>8,this[C+3]=A&255,C+4};function H(F,A,C,z,T){R(A,z,T,F,C,7);let G=Number(A&BigInt(4294967295));F[C++]=G,G=G>>8,F[C++]=G,G=G>>8,F[C++]=G,G=G>>8,F[C++]=G;let Y=Number(A>>BigInt(32)&BigInt(4294967295));return F[C++]=Y,Y=Y>>8,F[C++]=Y,Y=Y>>8,F[C++]=Y,Y=Y>>8,F[C++]=Y,C}function ze(F,A,C,z,T){R(A,z,T,F,C,7);let G=Number(A&BigInt(4294967295));F[C+7]=G,G=G>>8,F[C+6]=G,G=G>>8,F[C+5]=G,G=G>>8,F[C+4]=G;let Y=Number(A>>BigInt(32)&BigInt(4294967295));return F[C+3]=Y,Y=Y>>8,F[C+2]=Y,Y=Y>>8,F[C+1]=Y,Y=Y>>8,F[C]=Y,C+8}a.prototype.writeBigUInt64LE=st(function(A,C=0){return H(this,A,C,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=st(function(A,C=0){return ze(this,A,C,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(A,C,z,T){if(A=+A,C=C>>>0,!T){const $=Math.pow(2,8*z-1);Ce(this,A,C,z,$-1,-$)}let G=0,Y=1,ge=0;for(this[C]=A&255;++G<z&&(Y*=256);)A<0&&ge===0&&this[C+G-1]!==0&&(ge=1),this[C+G]=(A/Y>>0)-ge&255;return C+z},a.prototype.writeIntBE=function(A,C,z,T){if(A=+A,C=C>>>0,!T){const $=Math.pow(2,8*z-1);Ce(this,A,C,z,$-1,-$)}let G=z-1,Y=1,ge=0;for(this[C+G]=A&255;--G>=0&&(Y*=256);)A<0&&ge===0&&this[C+G+1]!==0&&(ge=1),this[C+G]=(A/Y>>0)-ge&255;return C+z},a.prototype.writeInt8=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,1,127,-128),A<0&&(A=255+A+1),this[C]=A&255,C+1},a.prototype.writeInt16LE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,2,32767,-32768),this[C]=A&255,this[C+1]=A>>>8,C+2},a.prototype.writeInt16BE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,2,32767,-32768),this[C]=A>>>8,this[C+1]=A&255,C+2},a.prototype.writeInt32LE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,4,2147483647,-2147483648),this[C]=A&255,this[C+1]=A>>>8,this[C+2]=A>>>16,this[C+3]=A>>>24,C+4},a.prototype.writeInt32BE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,4,2147483647,-2147483648),A<0&&(A=4294967295+A+1),this[C]=A>>>24,this[C+1]=A>>>16,this[C+2]=A>>>8,this[C+3]=A&255,C+4},a.prototype.writeBigInt64LE=st(function(A,C=0){return H(this,A,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=st(function(A,C=0){return ze(this,A,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function qe(F,A,C,z,T,G){if(C+z>F.length)throw new RangeError("Index out of range");if(C<0)throw new RangeError("Index out of range")}function Q(F,A,C,z,T){return A=+A,C=C>>>0,T||qe(F,A,C,4),n.write(F,A,C,z,23,4),C+4}a.prototype.writeFloatLE=function(A,C,z){return Q(this,A,C,!0,z)},a.prototype.writeFloatBE=function(A,C,z){return Q(this,A,C,!1,z)};function X(F,A,C,z,T){return A=+A,C=C>>>0,T||qe(F,A,C,8),n.write(F,A,C,z,52,8),C+8}a.prototype.writeDoubleLE=function(A,C,z){return X(this,A,C,!0,z)},a.prototype.writeDoubleBE=function(A,C,z){return X(this,A,C,!1,z)},a.prototype.copy=function(A,C,z,T){if(!a.isBuffer(A))throw new TypeError("argument should be a Buffer");if(z||(z=0),!T&&T!==0&&(T=this.length),C>=A.length&&(C=A.length),C||(C=0),T>0&&T<z&&(T=z),T===z||A.length===0||this.length===0)return 0;if(C<0)throw new RangeError("targetStart out of bounds");if(z<0||z>=this.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("sourceEnd out of bounds");T>this.length&&(T=this.length),A.length-C<T-z&&(T=A.length-C+z);const G=T-z;return this===A&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(C,z,T):Uint8Array.prototype.set.call(A,this.subarray(z,T),C),G},a.prototype.fill=function(A,C,z,T){if(typeof A=="string"){if(typeof C=="string"?(T=C,C=0,z=this.length):typeof z=="string"&&(T=z,z=this.length),T!==void 0&&typeof T!="string")throw new TypeError("encoding must be a string");if(typeof T=="string"&&!a.isEncoding(T))throw new TypeError("Unknown encoding: "+T);if(A.length===1){const Y=A.charCodeAt(0);(T==="utf8"&&Y<128||T==="latin1")&&(A=Y)}}else typeof A=="number"?A=A&255:typeof A=="boolean"&&(A=Number(A));if(C<0||this.length<C||this.length<z)throw new RangeError("Out of range index");if(z<=C)return this;C=C>>>0,z=z===void 0?this.length:z>>>0,A||(A=0);let G;if(typeof A=="number")for(G=C;G<z;++G)this[G]=A;else{const Y=a.isBuffer(A)?A:a.from(A,T),ge=Y.length;if(ge===0)throw new TypeError('The value "'+A+'" is invalid for argument "value"');for(G=0;G<z-C;++G)this[G+C]=Y[G%ge]}return this};const re={};function ie(F,A,C){re[F]=class extends C{constructor(){super(),Object.defineProperty(this,"message",{value:A.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${F}]`,this.stack,delete this.name}get code(){return F}set code(T){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:T,writable:!0})}toString(){return`${this.name} [${F}]: ${this.message}`}}}ie("ERR_BUFFER_OUT_OF_BOUNDS",function(F){return F?`${F} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ie("ERR_INVALID_ARG_TYPE",function(F,A){return`The "${F}" argument must be of type number. Received type ${typeof A}`},TypeError),ie("ERR_OUT_OF_RANGE",function(F,A,C){let z=`The value of "${F}" is out of range.`,T=C;return Number.isInteger(C)&&Math.abs(C)>2**32?T=ye(String(C)):typeof C=="bigint"&&(T=String(C),(C>BigInt(2)**BigInt(32)||C<-(BigInt(2)**BigInt(32)))&&(T=ye(T)),T+="n"),z+=` It must be ${A}. Received ${T}`,z},RangeError);function ye(F){let A="",C=F.length;const z=F[0]==="-"?1:0;for(;C>=z+4;C-=3)A=`_${F.slice(C-3,C)}${A}`;return`${F.slice(0,C)}${A}`}function L(F,A,C){se(A,"offset"),(F[A]===void 0||F[A+C]===void 0)&&pe(A,F.length-(C+1))}function R(F,A,C,z,T,G){if(F>C||F<A){const Y=typeof A=="bigint"?"n":"";let ge;throw A===0||A===BigInt(0)?ge=`>= 0${Y} and < 2${Y} ** ${(G+1)*8}${Y}`:ge=`>= -(2${Y} ** ${(G+1)*8-1}${Y}) and < 2 ** ${(G+1)*8-1}${Y}`,new re.ERR_OUT_OF_RANGE("value",ge,F)}L(z,T,G)}function se(F,A){if(typeof F!="number")throw new re.ERR_INVALID_ARG_TYPE(A,"number",F)}function pe(F,A,C){throw Math.floor(F)!==F?(se(F,C),new re.ERR_OUT_OF_RANGE("offset","an integer",F)):A<0?new re.ERR_BUFFER_OUT_OF_BOUNDS:new re.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${A}`,F)}const Re=/[^+/0-9A-Za-z-_]/g;function Te(F){if(F=F.split("=")[0],F=F.trim().replace(Re,""),F.length<2)return"";for(;F.length%4!==0;)F=F+"=";return F}function Ie(F,A){A=A||1/0;let C;const z=F.length;let T=null;const G=[];for(let Y=0;Y<z;++Y){if(C=F.charCodeAt(Y),C>55295&&C<57344){if(!T){if(C>56319){(A-=3)>-1&&G.push(239,191,189);continue}else if(Y+1===z){(A-=3)>-1&&G.push(239,191,189);continue}T=C;continue}if(C<56320){(A-=3)>-1&&G.push(239,191,189),T=C;continue}C=(T-55296<<10|C-56320)+65536}else T&&(A-=3)>-1&&G.push(239,191,189);if(T=null,C<128){if((A-=1)<0)break;G.push(C)}else if(C<2048){if((A-=2)<0)break;G.push(C>>6|192,C&63|128)}else if(C<65536){if((A-=3)<0)break;G.push(C>>12|224,C>>6&63|128,C&63|128)}else if(C<1114112){if((A-=4)<0)break;G.push(C>>18|240,C>>12&63|128,C>>6&63|128,C&63|128)}else throw new Error("Invalid code point")}return G}function Me(F){const A=[];for(let C=0;C<F.length;++C)A.push(F.charCodeAt(C)&255);return A}function wt(F,A){let C,z,T;const G=[];for(let Y=0;Y<F.length&&!((A-=2)<0);++Y)C=F.charCodeAt(Y),z=C>>8,T=C%256,G.push(T),G.push(z);return G}function hn(F){return t.toByteArray(Te(F))}function Bt(F,A,C,z){let T;for(T=0;T<z&&!(T+C>=A.length||T>=F.length);++T)A[T+C]=F[T];return T}function nt(F,A){return F instanceof A||F!=null&&F.constructor!=null&&F.constructor.name!=null&&F.constructor.name===A.name}function Nt(F){return F!==F}const Wt=function(){const F="0123456789abcdef",A=new Array(256);for(let C=0;C<16;++C){const z=C*16;for(let T=0;T<16;++T)A[z+T]=F[C]+F[T]}return A}();function st(F){return typeof BigInt>"u"?Yt:F}function Yt(){throw new Error("BigInt not supported")}}(I1)),I1}var ot=iu();const G$=Xe({__proto__:null,default:ld(ot)},[ot]),qt={},j$=Object.freeze(Object.defineProperty({__proto__:null,default:qt},Symbol.toStringTag,{value:"Module"}));function aC(e){return(typeof e=="object"&&e!==null&&"message"in e?e.message:`${e}`).replace(/\.$/,"")}class ur{async getBufferFromResponse(t){const n=await t.arrayBuffer();return ot.Buffer.from(n)}constructor(t,n={}){this.baseOverrides={},this.url=t;const r=n.fetch||globalThis.fetch.bind(globalThis);if(!r)throw new TypeError("no fetch function supplied, and none found in global environment");n.overrides&&(this.baseOverrides=n.overrides),this.fetchImplementation=r}async fetch(t,n){let r;try{r=await this.fetchImplementation(t,n)}catch(i){if(`${i}`.includes("Failed to fetch")){console.warn(`generic-filehandle: refetching ${t} to attempt to work around chrome CORS header caching bug`);try{r=await this.fetchImplementation(t,{...n,cache:"reload"})}catch(o){throw new Error(`${aC(o)} fetching ${t}`,{cause:o})}}else throw new Error(`${aC(i)} fetching ${t}`,{cause:i})}return r}async read(t,n=0,r,i=0,o={}){const{headers:s={},signal:a,overrides:l={}}=o;r<1/0?s.range=`bytes=${i}-${i+r}`:r===1/0&&i!==0&&(s.range=`bytes=${i}-`);const c=await this.fetch(this.url,{...this.baseOverrides,...l,headers:{...s,...l.headers,...this.baseOverrides.headers},method:"GET",redirect:"follow",mode:"cors",signal:a});if(!c.ok)throw new Error(`HTTP ${c.status} fetching ${this.url}`);if(c.status===200&&i===0||c.status===206){const u=await this.getBufferFromResponse(c),f=u.copy(t,n,0,Math.min(r,u.length)),h=c.headers.get("content-range"),d=/\/(\d+)$/.exec(h||"");return d!=null&&d[1]&&(this._stat={size:parseInt(d[1],10)}),{bytesRead:f,buffer:t}}throw c.status===200?new Error(`${this.url} fetch returned status 200, expected 206`):new Error(`HTTP ${c.status} fetching ${this.url}`)}async readFile(t={}){let n,r;typeof t=="string"?(n=t,r={}):(n=t.encoding,r=t,delete r.encoding);const{headers:i={},signal:o,overrides:s={}}=r,a=await this.fetch(this.url,{headers:i,method:"GET",redirect:"follow",mode:"cors",signal:o,...this.baseOverrides,...s});if(a.status!==200)throw new Error(`HTTP ${a.status} fetching ${this.url}`);if(n==="utf8")return a.text();if(n)throw new Error(`unsupported encoding: ${n}`);return this.getBufferFromResponse(a)}async stat(){if(!this._stat){const t=ot.Buffer.allocUnsafe(10);if(await this.read(t,0,10,0),!this._stat)throw new Error(`unable to determine size of file at ${this.url}`)}return this._stat}async close(){}}function lC(e){const t=new FileReader;return new Promise((n,r)=>{t.onerror=()=>{t.abort(),r(new Error("problem reading blob"))},t.onabort=()=>{r(new Error("blob reading was aborted"))},t.onload=()=>{t.result&&typeof t.result!="string"?n(t.result):r(new Error("unknown error reading blob"))},t.readAsArrayBuffer(e)})}function V$(e){const t=new FileReader;return new Promise((n,r)=>{t.onerror=()=>{t.abort(),r(new Error("problem reading blob"))},t.onabort=()=>{r(new Error("blob reading was aborted"))},t.onload=()=>{t.result&&typeof t.result=="string"?n(t.result):r(new Error("unknown error reading blob"))},t.readAsText(e)})}class q${constructor(t){this.blob=t,this.size=t.size}async read(t,n=0,r,i=0){if(!r)return{bytesRead:0,buffer:t};const o=i,s=o+r,a=await lC(this.blob.slice(o,s)),l=ot.Buffer.from(a);return{bytesRead:l.copy(t,n),buffer:l}}async readFile(t){const n=typeof t=="string"?t:t==null?void 0:t.encoding;if(n==="utf8")return V$(this.blob);if(n)throw new Error(`unsupported encoding: ${n}`);const r=await lC(this.blob);return ot.Buffer.from(r)}async stat(){return{size:this.size}}async close(){}}function cC(e,t={}){return new ur(e,t)}function $$(e,t,n,r={}){if(n!==void 0)return n;if(e!==void 0)return cC(e,r);if(t!==void 0)return new qt(t,r);throw new Error("no url, path, or filehandle provided, cannot open")}const ou=Object.freeze(Object.defineProperty({__proto__:null,BlobFile:q$,LocalFile:qt,RemoteFile:ur,fromUrl:cC,open:$$},Symbol.toStringTag,{value:"Module"}));var _1={},uC;function ro(){return uC||(uC=1,function(e){var t=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function n(o,s){return Object.prototype.hasOwnProperty.call(o,s)}e.assign=function(o){for(var s=Array.prototype.slice.call(arguments,1);s.length;){var a=s.shift();if(a){if(typeof a!="object")throw new TypeError(a+"must be non-object");for(var l in a)n(a,l)&&(o[l]=a[l])}}return o},e.shrinkBuf=function(o,s){return o.length===s?o:o.subarray?o.subarray(0,s):(o.length=s,o)};var r={arraySet:function(o,s,a,l,c){if(s.subarray&&o.subarray){o.set(s.subarray(a,a+l),c);return}for(var u=0;u<l;u++)o[c+u]=s[a+u]},flattenChunks:function(o){var s,a,l,c,u,f;for(l=0,s=0,a=o.length;s<a;s++)l+=o[s].length;for(f=new Uint8Array(l),c=0,s=0,a=o.length;s<a;s++)u=o[s],f.set(u,c),c+=u.length;return f}},i={arraySet:function(o,s,a,l,c){for(var u=0;u<l;u++)o[c+u]=s[a+u]},flattenChunks:function(o){return[].concat.apply([],o)}};e.setTyped=function(o){o?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,r)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(t)}(_1)),_1}var Ca={},fr={},us={},fC;function W$(){if(fC)return us;fC=1;var e=ro(),t=4,n=0,r=1,i=2;function o(T){for(var G=T.length;--G>=0;)T[G]=0}var s=0,a=1,l=2,c=3,u=258,f=29,h=256,d=h+1+f,p=30,m=19,b=2*d+1,g=15,y=16,v=7,w=256,S=16,E=17,k=18,M=[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],D=[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],B=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=512,Z=new Array((d+2)*2);o(Z);var ne=new Array(p*2);o(ne);var J=new Array(q);o(J);var ce=new Array(u-c+1);o(ce);var ae=new Array(f);o(ae);var we=new Array(p);o(we);function me(T,G,Y,ge,$){this.static_tree=T,this.extra_bits=G,this.extra_base=Y,this.elems=ge,this.max_length=$,this.has_stree=T&&T.length}var U,Ae,Ce;function H(T,G){this.dyn_tree=T,this.max_code=0,this.stat_desc=G}function ze(T){return T<256?J[T]:J[256+(T>>>7)]}function qe(T,G){T.pending_buf[T.pending++]=G&255,T.pending_buf[T.pending++]=G>>>8&255}function Q(T,G,Y){T.bi_valid>y-Y?(T.bi_buf|=G<<T.bi_valid&65535,qe(T,T.bi_buf),T.bi_buf=G>>y-T.bi_valid,T.bi_valid+=Y-y):(T.bi_buf|=G<<T.bi_valid&65535,T.bi_valid+=Y)}function X(T,G,Y){Q(T,Y[G*2],Y[G*2+1])}function re(T,G){var Y=0;do Y|=T&1,T>>>=1,Y<<=1;while(--G>0);return Y>>>1}function ie(T){T.bi_valid===16?(qe(T,T.bi_buf),T.bi_buf=0,T.bi_valid=0):T.bi_valid>=8&&(T.pending_buf[T.pending++]=T.bi_buf&255,T.bi_buf>>=8,T.bi_valid-=8)}function ye(T,G){var Y=G.dyn_tree,ge=G.max_code,$=G.stat_desc.static_tree,ee=G.stat_desc.has_stree,_=G.stat_desc.extra_bits,ue=G.stat_desc.extra_base,Be=G.stat_desc.max_length,x,te,oe,P,W,j,de=0;for(P=0;P<=g;P++)T.bl_count[P]=0;for(Y[T.heap[T.heap_max]*2+1]=0,x=T.heap_max+1;x<b;x++)te=T.heap[x],P=Y[Y[te*2+1]*2+1]+1,P>Be&&(P=Be,de++),Y[te*2+1]=P,!(te>ge)&&(T.bl_count[P]++,W=0,te>=ue&&(W=_[te-ue]),j=Y[te*2],T.opt_len+=j*(P+W),ee&&(T.static_len+=j*($[te*2+1]+W)));if(de!==0){do{for(P=Be-1;T.bl_count[P]===0;)P--;T.bl_count[P]--,T.bl_count[P+1]+=2,T.bl_count[Be]--,de-=2}while(de>0);for(P=Be;P!==0;P--)for(te=T.bl_count[P];te!==0;)oe=T.heap[--x],!(oe>ge)&&(Y[oe*2+1]!==P&&(T.opt_len+=(P-Y[oe*2+1])*Y[oe*2],Y[oe*2+1]=P),te--)}}function L(T,G,Y){var ge=new Array(g+1),$=0,ee,_;for(ee=1;ee<=g;ee++)ge[ee]=$=$+Y[ee-1]<<1;for(_=0;_<=G;_++){var ue=T[_*2+1];ue!==0&&(T[_*2]=re(ge[ue]++,ue))}}function R(){var T,G,Y,ge,$,ee=new Array(g+1);for(Y=0,ge=0;ge<f-1;ge++)for(ae[ge]=Y,T=0;T<1<<M[ge];T++)ce[Y++]=ge;for(ce[Y-1]=ge,$=0,ge=0;ge<16;ge++)for(we[ge]=$,T=0;T<1<<D[ge];T++)J[$++]=ge;for($>>=7;ge<p;ge++)for(we[ge]=$<<7,T=0;T<1<<D[ge]-7;T++)J[256+$++]=ge;for(G=0;G<=g;G++)ee[G]=0;for(T=0;T<=143;)Z[T*2+1]=8,T++,ee[8]++;for(;T<=255;)Z[T*2+1]=9,T++,ee[9]++;for(;T<=279;)Z[T*2+1]=7,T++,ee[7]++;for(;T<=287;)Z[T*2+1]=8,T++,ee[8]++;for(L(Z,d+1,ee),T=0;T<p;T++)ne[T*2+1]=5,ne[T*2]=re(T,5);U=new me(Z,M,h+1,d,g),Ae=new me(ne,D,0,p,g),Ce=new me(new Array(0),B,0,m,v)}function se(T){var G;for(G=0;G<d;G++)T.dyn_ltree[G*2]=0;for(G=0;G<p;G++)T.dyn_dtree[G*2]=0;for(G=0;G<m;G++)T.bl_tree[G*2]=0;T.dyn_ltree[w*2]=1,T.opt_len=T.static_len=0,T.last_lit=T.matches=0}function pe(T){T.bi_valid>8?qe(T,T.bi_buf):T.bi_valid>0&&(T.pending_buf[T.pending++]=T.bi_buf),T.bi_buf=0,T.bi_valid=0}function Re(T,G,Y,ge){pe(T),qe(T,Y),qe(T,~Y),e.arraySet(T.pending_buf,T.window,G,Y,T.pending),T.pending+=Y}function Te(T,G,Y,ge){var $=G*2,ee=Y*2;return T[$]<T[ee]||T[$]===T[ee]&&ge[G]<=ge[Y]}function Ie(T,G,Y){for(var ge=T.heap[Y],$=Y<<1;$<=T.heap_len&&($<T.heap_len&&Te(G,T.heap[$+1],T.heap[$],T.depth)&&$++,!Te(G,ge,T.heap[$],T.depth));)T.heap[Y]=T.heap[$],Y=$,$<<=1;T.heap[Y]=ge}function Me(T,G,Y){var ge,$,ee=0,_,ue;if(T.last_lit!==0)do ge=T.pending_buf[T.d_buf+ee*2]<<8|T.pending_buf[T.d_buf+ee*2+1],$=T.pending_buf[T.l_buf+ee],ee++,ge===0?X(T,$,G):(_=ce[$],X(T,_+h+1,G),ue=M[_],ue!==0&&($-=ae[_],Q(T,$,ue)),ge--,_=ze(ge),X(T,_,Y),ue=D[_],ue!==0&&(ge-=we[_],Q(T,ge,ue)));while(ee<T.last_lit);X(T,w,G)}function wt(T,G){var Y=G.dyn_tree,ge=G.stat_desc.static_tree,$=G.stat_desc.has_stree,ee=G.stat_desc.elems,_,ue,Be=-1,x;for(T.heap_len=0,T.heap_max=b,_=0;_<ee;_++)Y[_*2]!==0?(T.heap[++T.heap_len]=Be=_,T.depth[_]=0):Y[_*2+1]=0;for(;T.heap_len<2;)x=T.heap[++T.heap_len]=Be<2?++Be:0,Y[x*2]=1,T.depth[x]=0,T.opt_len--,$&&(T.static_len-=ge[x*2+1]);for(G.max_code=Be,_=T.heap_len>>1;_>=1;_--)Ie(T,Y,_);x=ee;do _=T.heap[1],T.heap[1]=T.heap[T.heap_len--],Ie(T,Y,1),ue=T.heap[1],T.heap[--T.heap_max]=_,T.heap[--T.heap_max]=ue,Y[x*2]=Y[_*2]+Y[ue*2],T.depth[x]=(T.depth[_]>=T.depth[ue]?T.depth[_]:T.depth[ue])+1,Y[_*2+1]=Y[ue*2+1]=x,T.heap[1]=x++,Ie(T,Y,1);while(T.heap_len>=2);T.heap[--T.heap_max]=T.heap[1],ye(T,G),L(Y,Be,T.bl_count)}function hn(T,G,Y){var ge,$=-1,ee,_=G[0*2+1],ue=0,Be=7,x=4;for(_===0&&(Be=138,x=3),G[(Y+1)*2+1]=65535,ge=0;ge<=Y;ge++)ee=_,_=G[(ge+1)*2+1],!(++ue<Be&&ee===_)&&(ue<x?T.bl_tree[ee*2]+=ue:ee!==0?(ee!==$&&T.bl_tree[ee*2]++,T.bl_tree[S*2]++):ue<=10?T.bl_tree[E*2]++:T.bl_tree[k*2]++,ue=0,$=ee,_===0?(Be=138,x=3):ee===_?(Be=6,x=3):(Be=7,x=4))}function Bt(T,G,Y){var ge,$=-1,ee,_=G[0*2+1],ue=0,Be=7,x=4;for(_===0&&(Be=138,x=3),ge=0;ge<=Y;ge++)if(ee=_,_=G[(ge+1)*2+1],!(++ue<Be&&ee===_)){if(ue<x)do X(T,ee,T.bl_tree);while(--ue!==0);else ee!==0?(ee!==$&&(X(T,ee,T.bl_tree),ue--),X(T,S,T.bl_tree),Q(T,ue-3,2)):ue<=10?(X(T,E,T.bl_tree),Q(T,ue-3,3)):(X(T,k,T.bl_tree),Q(T,ue-11,7));ue=0,$=ee,_===0?(Be=138,x=3):ee===_?(Be=6,x=3):(Be=7,x=4)}}function nt(T){var G;for(hn(T,T.dyn_ltree,T.l_desc.max_code),hn(T,T.dyn_dtree,T.d_desc.max_code),wt(T,T.bl_desc),G=m-1;G>=3&&T.bl_tree[I[G]*2+1]===0;G--);return T.opt_len+=3*(G+1)+5+5+4,G}function Nt(T,G,Y,ge){var $;for(Q(T,G-257,5),Q(T,Y-1,5),Q(T,ge-4,4),$=0;$<ge;$++)Q(T,T.bl_tree[I[$]*2+1],3);Bt(T,T.dyn_ltree,G-1),Bt(T,T.dyn_dtree,Y-1)}function Wt(T){var G=4093624447,Y;for(Y=0;Y<=31;Y++,G>>>=1)if(G&1&&T.dyn_ltree[Y*2]!==0)return n;if(T.dyn_ltree[9*2]!==0||T.dyn_ltree[10*2]!==0||T.dyn_ltree[13*2]!==0)return r;for(Y=32;Y<h;Y++)if(T.dyn_ltree[Y*2]!==0)return r;return n}var st=!1;function Yt(T){st||(R(),st=!0),T.l_desc=new H(T.dyn_ltree,U),T.d_desc=new H(T.dyn_dtree,Ae),T.bl_desc=new H(T.bl_tree,Ce),T.bi_buf=0,T.bi_valid=0,se(T)}function F(T,G,Y,ge){Q(T,(s<<1)+(ge?1:0),3),Re(T,G,Y)}function A(T){Q(T,a<<1,3),X(T,w,Z),ie(T)}function C(T,G,Y,ge){var $,ee,_=0;T.level>0?(T.strm.data_type===i&&(T.strm.data_type=Wt(T)),wt(T,T.l_desc),wt(T,T.d_desc),_=nt(T),$=T.opt_len+3+7>>>3,ee=T.static_len+3+7>>>3,ee<=$&&($=ee)):$=ee=Y+5,Y+4<=$&&G!==-1?F(T,G,Y,ge):T.strategy===t||ee===$?(Q(T,(a<<1)+(ge?1:0),3),Me(T,Z,ne)):(Q(T,(l<<1)+(ge?1:0),3),Nt(T,T.l_desc.max_code+1,T.d_desc.max_code+1,_+1),Me(T,T.dyn_ltree,T.dyn_dtree)),se(T),ge&&pe(T)}function z(T,G,Y){return T.pending_buf[T.d_buf+T.last_lit*2]=G>>>8&255,T.pending_buf[T.d_buf+T.last_lit*2+1]=G&255,T.pending_buf[T.l_buf+T.last_lit]=Y&255,T.last_lit++,G===0?T.dyn_ltree[Y*2]++:(T.matches++,G--,T.dyn_ltree[(ce[Y]+h+1)*2]++,T.dyn_dtree[ze(G)*2]++),T.last_lit===T.lit_bufsize-1}return us._tr_init=Yt,us._tr_stored_block=F,us._tr_flush_block=C,us._tr_tally=z,us._tr_align=A,us}var D1,hC;function dC(){if(hC)return D1;hC=1;function e(t,n,r,i){for(var o=t&65535|0,s=t>>>16&65535|0,a=0;r!==0;){a=r>2e3?2e3:r,r-=a;do o=o+n[i++]|0,s=s+o|0;while(--a);o%=65521,s%=65521}return o|s<<16|0}return D1=e,D1}var R1,pC;function gC(){if(pC)return R1;pC=1;function e(){for(var r,i=[],o=0;o<256;o++){r=o;for(var s=0;s<8;s++)r=r&1?3988292384^r>>>1:r>>>1;i[o]=r}return i}var t=e();function n(r,i,o,s){var a=t,l=s+o;r^=-1;for(var c=s;c<l;c++)r=r>>>8^a[(r^i[c])&255];return r^-1}return R1=n,R1}var B1,mC;function F1(){return mC||(mC=1,B1={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"}),B1}var bC;function Y$(){if(bC)return fr;bC=1;var e=ro(),t=W$(),n=dC(),r=gC(),i=F1(),o=0,s=1,a=3,l=4,c=5,u=0,f=1,h=-2,d=-3,p=-5,m=-1,b=1,g=2,y=3,v=4,w=0,S=2,E=8,k=9,M=15,D=8,B=29,I=256,q=I+1+B,Z=30,ne=19,J=2*q+1,ce=15,ae=3,we=258,me=we+ae+1,U=32,Ae=42,Ce=69,H=73,ze=91,qe=103,Q=113,X=666,re=1,ie=2,ye=3,L=4,R=3;function se(x,te){return x.msg=i[te],te}function pe(x){return(x<<1)-(x>4?9:0)}function Re(x){for(var te=x.length;--te>=0;)x[te]=0}function Te(x){var te=x.state,oe=te.pending;oe>x.avail_out&&(oe=x.avail_out),oe!==0&&(e.arraySet(x.output,te.pending_buf,te.pending_out,oe,x.next_out),x.next_out+=oe,te.pending_out+=oe,x.total_out+=oe,x.avail_out-=oe,te.pending-=oe,te.pending===0&&(te.pending_out=0))}function Ie(x,te){t._tr_flush_block(x,x.block_start>=0?x.block_start:-1,x.strstart-x.block_start,te),x.block_start=x.strstart,Te(x.strm)}function Me(x,te){x.pending_buf[x.pending++]=te}function wt(x,te){x.pending_buf[x.pending++]=te>>>8&255,x.pending_buf[x.pending++]=te&255}function hn(x,te,oe,P){var W=x.avail_in;return W>P&&(W=P),W===0?0:(x.avail_in-=W,e.arraySet(te,x.input,x.next_in,W,oe),x.state.wrap===1?x.adler=n(x.adler,te,W,oe):x.state.wrap===2&&(x.adler=r(x.adler,te,W,oe)),x.next_in+=W,x.total_in+=W,W)}function Bt(x,te){var oe=x.max_chain_length,P=x.strstart,W,j,de=x.prev_length,ve=x.nice_match,Ee=x.strstart>x.w_size-me?x.strstart-(x.w_size-me):0,Ue=x.window,Tt=x.w_mask,V=x.prev,Pe=x.strstart+we,ct=Ue[P+de-1],rt=Ue[P+de];x.prev_length>=x.good_match&&(oe>>=2),ve>x.lookahead&&(ve=x.lookahead);do if(W=te,!(Ue[W+de]!==rt||Ue[W+de-1]!==ct||Ue[W]!==Ue[P]||Ue[++W]!==Ue[P+1])){P+=2,W++;do;while(Ue[++P]===Ue[++W]&&Ue[++P]===Ue[++W]&&Ue[++P]===Ue[++W]&&Ue[++P]===Ue[++W]&&Ue[++P]===Ue[++W]&&Ue[++P]===Ue[++W]&&Ue[++P]===Ue[++W]&&Ue[++P]===Ue[++W]&&P<Pe);if(j=we-(Pe-P),P=Pe-we,j>de){if(x.match_start=te,de=j,j>=ve)break;ct=Ue[P+de-1],rt=Ue[P+de]}}while((te=V[te&Tt])>Ee&&--oe!==0);return de<=x.lookahead?de:x.lookahead}function nt(x){var te=x.w_size,oe,P,W,j,de;do{if(j=x.window_size-x.lookahead-x.strstart,x.strstart>=te+(te-me)){e.arraySet(x.window,x.window,te,te,0),x.match_start-=te,x.strstart-=te,x.block_start-=te,P=x.hash_size,oe=P;do W=x.head[--oe],x.head[oe]=W>=te?W-te:0;while(--P);P=te,oe=P;do W=x.prev[--oe],x.prev[oe]=W>=te?W-te:0;while(--P);j+=te}if(x.strm.avail_in===0)break;if(P=hn(x.strm,x.window,x.strstart+x.lookahead,j),x.lookahead+=P,x.lookahead+x.insert>=ae)for(de=x.strstart-x.insert,x.ins_h=x.window[de],x.ins_h=(x.ins_h<<x.hash_shift^x.window[de+1])&x.hash_mask;x.insert&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[de+ae-1])&x.hash_mask,x.prev[de&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=de,de++,x.insert--,!(x.lookahead+x.insert<ae)););}while(x.lookahead<me&&x.strm.avail_in!==0)}function Nt(x,te){var oe=65535;for(oe>x.pending_buf_size-5&&(oe=x.pending_buf_size-5);;){if(x.lookahead<=1){if(nt(x),x.lookahead===0&&te===o)return re;if(x.lookahead===0)break}x.strstart+=x.lookahead,x.lookahead=0;var P=x.block_start+oe;if((x.strstart===0||x.strstart>=P)&&(x.lookahead=x.strstart-P,x.strstart=P,Ie(x,!1),x.strm.avail_out===0)||x.strstart-x.block_start>=x.w_size-me&&(Ie(x,!1),x.strm.avail_out===0))return re}return x.insert=0,te===l?(Ie(x,!0),x.strm.avail_out===0?ye:L):(x.strstart>x.block_start&&(Ie(x,!1),x.strm.avail_out===0),re)}function Wt(x,te){for(var oe,P;;){if(x.lookahead<me){if(nt(x),x.lookahead<me&&te===o)return re;if(x.lookahead===0)break}if(oe=0,x.lookahead>=ae&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+ae-1])&x.hash_mask,oe=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart),oe!==0&&x.strstart-oe<=x.w_size-me&&(x.match_length=Bt(x,oe)),x.match_length>=ae)if(P=t._tr_tally(x,x.strstart-x.match_start,x.match_length-ae),x.lookahead-=x.match_length,x.match_length<=x.max_lazy_match&&x.lookahead>=ae){x.match_length--;do x.strstart++,x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+ae-1])&x.hash_mask,oe=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart;while(--x.match_length!==0);x.strstart++}else x.strstart+=x.match_length,x.match_length=0,x.ins_h=x.window[x.strstart],x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+1])&x.hash_mask;else P=t._tr_tally(x,0,x.window[x.strstart]),x.lookahead--,x.strstart++;if(P&&(Ie(x,!1),x.strm.avail_out===0))return re}return x.insert=x.strstart<ae-1?x.strstart:ae-1,te===l?(Ie(x,!0),x.strm.avail_out===0?ye:L):x.last_lit&&(Ie(x,!1),x.strm.avail_out===0)?re:ie}function st(x,te){for(var oe,P,W;;){if(x.lookahead<me){if(nt(x),x.lookahead<me&&te===o)return re;if(x.lookahead===0)break}if(oe=0,x.lookahead>=ae&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+ae-1])&x.hash_mask,oe=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart),x.prev_length=x.match_length,x.prev_match=x.match_start,x.match_length=ae-1,oe!==0&&x.prev_length<x.max_lazy_match&&x.strstart-oe<=x.w_size-me&&(x.match_length=Bt(x,oe),x.match_length<=5&&(x.strategy===b||x.match_length===ae&&x.strstart-x.match_start>4096)&&(x.match_length=ae-1)),x.prev_length>=ae&&x.match_length<=x.prev_length){W=x.strstart+x.lookahead-ae,P=t._tr_tally(x,x.strstart-1-x.prev_match,x.prev_length-ae),x.lookahead-=x.prev_length-1,x.prev_length-=2;do++x.strstart<=W&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+ae-1])&x.hash_mask,oe=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart);while(--x.prev_length!==0);if(x.match_available=0,x.match_length=ae-1,x.strstart++,P&&(Ie(x,!1),x.strm.avail_out===0))return re}else if(x.match_available){if(P=t._tr_tally(x,0,x.window[x.strstart-1]),P&&Ie(x,!1),x.strstart++,x.lookahead--,x.strm.avail_out===0)return re}else x.match_available=1,x.strstart++,x.lookahead--}return x.match_available&&(P=t._tr_tally(x,0,x.window[x.strstart-1]),x.match_available=0),x.insert=x.strstart<ae-1?x.strstart:ae-1,te===l?(Ie(x,!0),x.strm.avail_out===0?ye:L):x.last_lit&&(Ie(x,!1),x.strm.avail_out===0)?re:ie}function Yt(x,te){for(var oe,P,W,j,de=x.window;;){if(x.lookahead<=we){if(nt(x),x.lookahead<=we&&te===o)return re;if(x.lookahead===0)break}if(x.match_length=0,x.lookahead>=ae&&x.strstart>0&&(W=x.strstart-1,P=de[W],P===de[++W]&&P===de[++W]&&P===de[++W])){j=x.strstart+we;do;while(P===de[++W]&&P===de[++W]&&P===de[++W]&&P===de[++W]&&P===de[++W]&&P===de[++W]&&P===de[++W]&&P===de[++W]&&W<j);x.match_length=we-(j-W),x.match_length>x.lookahead&&(x.match_length=x.lookahead)}if(x.match_length>=ae?(oe=t._tr_tally(x,1,x.match_length-ae),x.lookahead-=x.match_length,x.strstart+=x.match_length,x.match_length=0):(oe=t._tr_tally(x,0,x.window[x.strstart]),x.lookahead--,x.strstart++),oe&&(Ie(x,!1),x.strm.avail_out===0))return re}return x.insert=0,te===l?(Ie(x,!0),x.strm.avail_out===0?ye:L):x.last_lit&&(Ie(x,!1),x.strm.avail_out===0)?re:ie}function F(x,te){for(var oe;;){if(x.lookahead===0&&(nt(x),x.lookahead===0)){if(te===o)return re;break}if(x.match_length=0,oe=t._tr_tally(x,0,x.window[x.strstart]),x.lookahead--,x.strstart++,oe&&(Ie(x,!1),x.strm.avail_out===0))return re}return x.insert=0,te===l?(Ie(x,!0),x.strm.avail_out===0?ye:L):x.last_lit&&(Ie(x,!1),x.strm.avail_out===0)?re:ie}function A(x,te,oe,P,W){this.good_length=x,this.max_lazy=te,this.nice_length=oe,this.max_chain=P,this.func=W}var C;C=[new A(0,0,0,0,Nt),new A(4,4,8,4,Wt),new A(4,5,16,8,Wt),new A(4,6,32,32,Wt),new A(4,4,16,16,st),new A(8,16,32,32,st),new A(8,16,128,128,st),new A(8,32,128,256,st),new A(32,128,258,1024,st),new A(32,258,258,4096,st)];function z(x){x.window_size=2*x.w_size,Re(x.head),x.max_lazy_match=C[x.level].max_lazy,x.good_match=C[x.level].good_length,x.nice_match=C[x.level].nice_length,x.max_chain_length=C[x.level].max_chain,x.strstart=0,x.block_start=0,x.lookahead=0,x.insert=0,x.match_length=x.prev_length=ae-1,x.match_available=0,x.ins_h=0}function T(){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=E,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 e.Buf16(J*2),this.dyn_dtree=new e.Buf16((2*Z+1)*2),this.bl_tree=new e.Buf16((2*ne+1)*2),Re(this.dyn_ltree),Re(this.dyn_dtree),Re(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new e.Buf16(ce+1),this.heap=new e.Buf16(2*q+1),Re(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new e.Buf16(2*q+1),Re(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function G(x){var te;return!x||!x.state?se(x,h):(x.total_in=x.total_out=0,x.data_type=S,te=x.state,te.pending=0,te.pending_out=0,te.wrap<0&&(te.wrap=-te.wrap),te.status=te.wrap?Ae:Q,x.adler=te.wrap===2?0:1,te.last_flush=o,t._tr_init(te),u)}function Y(x){var te=G(x);return te===u&&z(x.state),te}function ge(x,te){return!x||!x.state||x.state.wrap!==2?h:(x.state.gzhead=te,u)}function $(x,te,oe,P,W,j){if(!x)return h;var de=1;if(te===m&&(te=6),P<0?(de=0,P=-P):P>15&&(de=2,P-=16),W<1||W>k||oe!==E||P<8||P>15||te<0||te>9||j<0||j>v)return se(x,h);P===8&&(P=9);var ve=new T;return x.state=ve,ve.strm=x,ve.wrap=de,ve.gzhead=null,ve.w_bits=P,ve.w_size=1<<ve.w_bits,ve.w_mask=ve.w_size-1,ve.hash_bits=W+7,ve.hash_size=1<<ve.hash_bits,ve.hash_mask=ve.hash_size-1,ve.hash_shift=~~((ve.hash_bits+ae-1)/ae),ve.window=new e.Buf8(ve.w_size*2),ve.head=new e.Buf16(ve.hash_size),ve.prev=new e.Buf16(ve.w_size),ve.lit_bufsize=1<<W+6,ve.pending_buf_size=ve.lit_bufsize*4,ve.pending_buf=new e.Buf8(ve.pending_buf_size),ve.d_buf=1*ve.lit_bufsize,ve.l_buf=3*ve.lit_bufsize,ve.level=te,ve.strategy=j,ve.method=oe,Y(x)}function ee(x,te){return $(x,te,E,M,D,w)}function _(x,te){var oe,P,W,j;if(!x||!x.state||te>c||te<0)return x?se(x,h):h;if(P=x.state,!x.output||!x.input&&x.avail_in!==0||P.status===X&&te!==l)return se(x,x.avail_out===0?p:h);if(P.strm=x,oe=P.last_flush,P.last_flush=te,P.status===Ae)if(P.wrap===2)x.adler=0,Me(P,31),Me(P,139),Me(P,8),P.gzhead?(Me(P,(P.gzhead.text?1:0)+(P.gzhead.hcrc?2:0)+(P.gzhead.extra?4:0)+(P.gzhead.name?8:0)+(P.gzhead.comment?16:0)),Me(P,P.gzhead.time&255),Me(P,P.gzhead.time>>8&255),Me(P,P.gzhead.time>>16&255),Me(P,P.gzhead.time>>24&255),Me(P,P.level===9?2:P.strategy>=g||P.level<2?4:0),Me(P,P.gzhead.os&255),P.gzhead.extra&&P.gzhead.extra.length&&(Me(P,P.gzhead.extra.length&255),Me(P,P.gzhead.extra.length>>8&255)),P.gzhead.hcrc&&(x.adler=r(x.adler,P.pending_buf,P.pending,0)),P.gzindex=0,P.status=Ce):(Me(P,0),Me(P,0),Me(P,0),Me(P,0),Me(P,0),Me(P,P.level===9?2:P.strategy>=g||P.level<2?4:0),Me(P,R),P.status=Q);else{var de=E+(P.w_bits-8<<4)<<8,ve=-1;P.strategy>=g||P.level<2?ve=0:P.level<6?ve=1:P.level===6?ve=2:ve=3,de|=ve<<6,P.strstart!==0&&(de|=U),de+=31-de%31,P.status=Q,wt(P,de),P.strstart!==0&&(wt(P,x.adler>>>16),wt(P,x.adler&65535)),x.adler=1}if(P.status===Ce)if(P.gzhead.extra){for(W=P.pending;P.gzindex<(P.gzhead.extra.length&65535)&&!(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>W&&(x.adler=r(x.adler,P.pending_buf,P.pending-W,W)),Te(x),W=P.pending,P.pending===P.pending_buf_size));)Me(P,P.gzhead.extra[P.gzindex]&255),P.gzindex++;P.gzhead.hcrc&&P.pending>W&&(x.adler=r(x.adler,P.pending_buf,P.pending-W,W)),P.gzindex===P.gzhead.extra.length&&(P.gzindex=0,P.status=H)}else P.status=H;if(P.status===H)if(P.gzhead.name){W=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>W&&(x.adler=r(x.adler,P.pending_buf,P.pending-W,W)),Te(x),W=P.pending,P.pending===P.pending_buf_size)){j=1;break}P.gzindex<P.gzhead.name.length?j=P.gzhead.name.charCodeAt(P.gzindex++)&255:j=0,Me(P,j)}while(j!==0);P.gzhead.hcrc&&P.pending>W&&(x.adler=r(x.adler,P.pending_buf,P.pending-W,W)),j===0&&(P.gzindex=0,P.status=ze)}else P.status=ze;if(P.status===ze)if(P.gzhead.comment){W=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>W&&(x.adler=r(x.adler,P.pending_buf,P.pending-W,W)),Te(x),W=P.pending,P.pending===P.pending_buf_size)){j=1;break}P.gzindex<P.gzhead.comment.length?j=P.gzhead.comment.charCodeAt(P.gzindex++)&255:j=0,Me(P,j)}while(j!==0);P.gzhead.hcrc&&P.pending>W&&(x.adler=r(x.adler,P.pending_buf,P.pending-W,W)),j===0&&(P.status=qe)}else P.status=qe;if(P.status===qe&&(P.gzhead.hcrc?(P.pending+2>P.pending_buf_size&&Te(x),P.pending+2<=P.pending_buf_size&&(Me(P,x.adler&255),Me(P,x.adler>>8&255),x.adler=0,P.status=Q)):P.status=Q),P.pending!==0){if(Te(x),x.avail_out===0)return P.last_flush=-1,u}else if(x.avail_in===0&&pe(te)<=pe(oe)&&te!==l)return se(x,p);if(P.status===X&&x.avail_in!==0)return se(x,p);if(x.avail_in!==0||P.lookahead!==0||te!==o&&P.status!==X){var Ee=P.strategy===g?F(P,te):P.strategy===y?Yt(P,te):C[P.level].func(P,te);if((Ee===ye||Ee===L)&&(P.status=X),Ee===re||Ee===ye)return x.avail_out===0&&(P.last_flush=-1),u;if(Ee===ie&&(te===s?t._tr_align(P):te!==c&&(t._tr_stored_block(P,0,0,!1),te===a&&(Re(P.head),P.lookahead===0&&(P.strstart=0,P.block_start=0,P.insert=0))),Te(x),x.avail_out===0))return P.last_flush=-1,u}return te!==l?u:P.wrap<=0?f:(P.wrap===2?(Me(P,x.adler&255),Me(P,x.adler>>8&255),Me(P,x.adler>>16&255),Me(P,x.adler>>24&255),Me(P,x.total_in&255),Me(P,x.total_in>>8&255),Me(P,x.total_in>>16&255),Me(P,x.total_in>>24&255)):(wt(P,x.adler>>>16),wt(P,x.adler&65535)),Te(x),P.wrap>0&&(P.wrap=-P.wrap),P.pending!==0?u:f)}function ue(x){var te;return!x||!x.state?h:(te=x.state.status,te!==Ae&&te!==Ce&&te!==H&&te!==ze&&te!==qe&&te!==Q&&te!==X?se(x,h):(x.state=null,te===Q?se(x,d):u))}function Be(x,te){var oe=te.length,P,W,j,de,ve,Ee,Ue,Tt;if(!x||!x.state||(P=x.state,de=P.wrap,de===2||de===1&&P.status!==Ae||P.lookahead))return h;for(de===1&&(x.adler=n(x.adler,te,oe,0)),P.wrap=0,oe>=P.w_size&&(de===0&&(Re(P.head),P.strstart=0,P.block_start=0,P.insert=0),Tt=new e.Buf8(P.w_size),e.arraySet(Tt,te,oe-P.w_size,P.w_size,0),te=Tt,oe=P.w_size),ve=x.avail_in,Ee=x.next_in,Ue=x.input,x.avail_in=oe,x.next_in=0,x.input=te,nt(P);P.lookahead>=ae;){W=P.strstart,j=P.lookahead-(ae-1);do P.ins_h=(P.ins_h<<P.hash_shift^P.window[W+ae-1])&P.hash_mask,P.prev[W&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=W,W++;while(--j);P.strstart=W,P.lookahead=ae-1,nt(P)}return P.strstart+=P.lookahead,P.block_start=P.strstart,P.insert=P.lookahead,P.lookahead=0,P.match_length=P.prev_length=ae-1,P.match_available=0,x.next_in=Ee,x.input=Ue,x.avail_in=ve,P.wrap=de,u}return fr.deflateInit=ee,fr.deflateInit2=$,fr.deflateReset=Y,fr.deflateResetKeep=G,fr.deflateSetHeader=ge,fr.deflate=_,fr.deflateEnd=ue,fr.deflateSetDictionary=Be,fr.deflateInfo="pako deflate (from Nodeca project)",fr}var fs={},yC;function wC(){if(yC)return fs;yC=1;var e=ro(),t=!0,n=!0;try{String.fromCharCode.apply(null,[0])}catch{t=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{n=!1}for(var r=new e.Buf8(256),i=0;i<256;i++)r[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;r[254]=r[254]=1,fs.string2buf=function(s){var a,l,c,u,f,h=s.length,d=0;for(u=0;u<h;u++)l=s.charCodeAt(u),(l&64512)===55296&&u+1<h&&(c=s.charCodeAt(u+1),(c&64512)===56320&&(l=65536+(l-55296<<10)+(c-56320),u++)),d+=l<128?1:l<2048?2:l<65536?3:4;for(a=new e.Buf8(d),f=0,u=0;f<d;u++)l=s.charCodeAt(u),(l&64512)===55296&&u+1<h&&(c=s.charCodeAt(u+1),(c&64512)===56320&&(l=65536+(l-55296<<10)+(c-56320),u++)),l<128?a[f++]=l:l<2048?(a[f++]=192|l>>>6,a[f++]=128|l&63):l<65536?(a[f++]=224|l>>>12,a[f++]=128|l>>>6&63,a[f++]=128|l&63):(a[f++]=240|l>>>18,a[f++]=128|l>>>12&63,a[f++]=128|l>>>6&63,a[f++]=128|l&63);return a};function o(s,a){if(a<65534&&(s.subarray&&n||!s.subarray&&t))return String.fromCharCode.apply(null,e.shrinkBuf(s,a));for(var l="",c=0;c<a;c++)l+=String.fromCharCode(s[c]);return l}return fs.buf2binstring=function(s){return o(s,s.length)},fs.binstring2buf=function(s){for(var a=new e.Buf8(s.length),l=0,c=a.length;l<c;l++)a[l]=s.charCodeAt(l);return a},fs.buf2string=function(s,a){var l,c,u,f,h=a||s.length,d=new Array(h*2);for(c=0,l=0;l<h;){if(u=s[l++],u<128){d[c++]=u;continue}if(f=r[u],f>4){d[c++]=65533,l+=f-1;continue}for(u&=f===2?31:f===3?15:7;f>1&&l<h;)u=u<<6|s[l++]&63,f--;if(f>1){d[c++]=65533;continue}u<65536?d[c++]=u:(u-=65536,d[c++]=55296|u>>10&1023,d[c++]=56320|u&1023)}return o(d,c)},fs.utf8border=function(s,a){var l;for(a=a||s.length,a>s.length&&(a=s.length),l=a-1;l>=0&&(s[l]&192)===128;)l--;return l<0||l===0?a:l+r[s[l]]>a?l:a},fs}var M1,vC;function xC(){if(vC)return M1;vC=1;function e(){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}return M1=e,M1}var AC;function Q$(){if(AC)return Ca;AC=1;var e=Y$(),t=ro(),n=wC(),r=F1(),i=xC(),o=Object.prototype.toString,s=0,a=4,l=0,c=1,u=2,f=-1,h=0,d=8;function p(y){if(!(this instanceof p))return new p(y);this.options=t.assign({level:f,method:d,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},y||{});var v=this.options;v.raw&&v.windowBits>0?v.windowBits=-v.windowBits:v.gzip&&v.windowBits>0&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new i,this.strm.avail_out=0;var w=e.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(w!==l)throw new Error(r[w]);if(v.header&&e.deflateSetHeader(this.strm,v.header),v.dictionary){var S;if(typeof v.dictionary=="string"?S=n.string2buf(v.dictionary):o.call(v.dictionary)==="[object ArrayBuffer]"?S=new Uint8Array(v.dictionary):S=v.dictionary,w=e.deflateSetDictionary(this.strm,S),w!==l)throw new Error(r[w]);this._dict_set=!0}}p.prototype.push=function(y,v){var w=this.strm,S=this.options.chunkSize,E,k;if(this.ended)return!1;k=v===~~v?v:v===!0?a:s,typeof y=="string"?w.input=n.string2buf(y):o.call(y)==="[object ArrayBuffer]"?w.input=new Uint8Array(y):w.input=y,w.next_in=0,w.avail_in=w.input.length;do{if(w.avail_out===0&&(w.output=new t.Buf8(S),w.next_out=0,w.avail_out=S),E=e.deflate(w,k),E!==c&&E!==l)return this.onEnd(E),this.ended=!0,!1;(w.avail_out===0||w.avail_in===0&&(k===a||k===u))&&(this.options.to==="string"?this.onData(n.buf2binstring(t.shrinkBuf(w.output,w.next_out))):this.onData(t.shrinkBuf(w.output,w.next_out)))}while((w.avail_in>0||w.avail_out===0)&&E!==c);return k===a?(E=e.deflateEnd(this.strm),this.onEnd(E),this.ended=!0,E===l):(k===u&&(this.onEnd(l),w.avail_out=0),!0)},p.prototype.onData=function(y){this.chunks.push(y)},p.prototype.onEnd=function(y){y===l&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=t.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg};function m(y,v){var w=new p(v);if(w.push(y,!0),w.err)throw w.msg||r[w.err];return w.result}function b(y,v){return v=v||{},v.raw=!0,m(y,v)}function g(y,v){return v=v||{},v.gzip=!0,m(y,v)}return Ca.Deflate=p,Ca.deflate=m,Ca.deflateRaw=b,Ca.gzip=g,Ca}var ka={},Wn={},P1,EC;function Z$(){if(EC)return P1;EC=1;var e=30,t=12;return P1=function(r,i){var o,s,a,l,c,u,f,h,d,p,m,b,g,y,v,w,S,E,k,M,D,B,I,q,Z;o=r.state,s=r.next_in,q=r.input,a=s+(r.avail_in-5),l=r.next_out,Z=r.output,c=l-(i-r.avail_out),u=l+(r.avail_out-257),f=o.dmax,h=o.wsize,d=o.whave,p=o.wnext,m=o.window,b=o.hold,g=o.bits,y=o.lencode,v=o.distcode,w=(1<<o.lenbits)-1,S=(1<<o.distbits)-1;e:do{g<15&&(b+=q[s++]<<g,g+=8,b+=q[s++]<<g,g+=8),E=y[b&w];t:for(;;){if(k=E>>>24,b>>>=k,g-=k,k=E>>>16&255,k===0)Z[l++]=E&65535;else if(k&16){M=E&65535,k&=15,k&&(g<k&&(b+=q[s++]<<g,g+=8),M+=b&(1<<k)-1,b>>>=k,g-=k),g<15&&(b+=q[s++]<<g,g+=8,b+=q[s++]<<g,g+=8),E=v[b&S];n:for(;;){if(k=E>>>24,b>>>=k,g-=k,k=E>>>16&255,k&16){if(D=E&65535,k&=15,g<k&&(b+=q[s++]<<g,g+=8,g<k&&(b+=q[s++]<<g,g+=8)),D+=b&(1<<k)-1,D>f){r.msg="invalid distance too far back",o.mode=e;break e}if(b>>>=k,g-=k,k=l-c,D>k){if(k=D-k,k>d&&o.sane){r.msg="invalid distance too far back",o.mode=e;break e}if(B=0,I=m,p===0){if(B+=h-k,k<M){M-=k;do Z[l++]=m[B++];while(--k);B=l-D,I=Z}}else if(p<k){if(B+=h+p-k,k-=p,k<M){M-=k;do Z[l++]=m[B++];while(--k);if(B=0,p<M){k=p,M-=k;do Z[l++]=m[B++];while(--k);B=l-D,I=Z}}}else if(B+=p-k,k<M){M-=k;do Z[l++]=m[B++];while(--k);B=l-D,I=Z}for(;M>2;)Z[l++]=I[B++],Z[l++]=I[B++],Z[l++]=I[B++],M-=3;M&&(Z[l++]=I[B++],M>1&&(Z[l++]=I[B++]))}else{B=l-D;do Z[l++]=Z[B++],Z[l++]=Z[B++],Z[l++]=Z[B++],M-=3;while(M>2);M&&(Z[l++]=Z[B++],M>1&&(Z[l++]=Z[B++]))}}else if(k&64){r.msg="invalid distance code",o.mode=e;break e}else{E=v[(E&65535)+(b&(1<<k)-1)];continue n}break}}else if(k&64)if(k&32){o.mode=t;break e}else{r.msg="invalid literal/length code",o.mode=e;break e}else{E=y[(E&65535)+(b&(1<<k)-1)];continue t}break}}while(s<a&&l<u);M=g>>3,s-=M,g-=M<<3,b&=(1<<g)-1,r.next_in=s,r.next_out=l,r.avail_in=s<a?5+(a-s):5-(s-a),r.avail_out=l<u?257+(u-l):257-(l-u),o.hold=b,o.bits=g},P1}var O1,SC;function X$(){if(SC)return O1;SC=1;var e=ro(),t=15,n=852,r=592,i=0,o=1,s=2,a=[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],l=[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],c=[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],u=[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];return O1=function(h,d,p,m,b,g,y,v){var w=v.bits,S=0,E=0,k=0,M=0,D=0,B=0,I=0,q=0,Z=0,ne=0,J,ce,ae,we,me,U=null,Ae=0,Ce,H=new e.Buf16(t+1),ze=new e.Buf16(t+1),qe=null,Q=0,X,re,ie;for(S=0;S<=t;S++)H[S]=0;for(E=0;E<m;E++)H[d[p+E]]++;for(D=w,M=t;M>=1&&H[M]===0;M--);if(D>M&&(D=M),M===0)return b[g++]=1<<24|64<<16|0,b[g++]=1<<24|64<<16|0,v.bits=1,0;for(k=1;k<M&&H[k]===0;k++);for(D<k&&(D=k),q=1,S=1;S<=t;S++)if(q<<=1,q-=H[S],q<0)return-1;if(q>0&&(h===i||M!==1))return-1;for(ze[1]=0,S=1;S<t;S++)ze[S+1]=ze[S]+H[S];for(E=0;E<m;E++)d[p+E]!==0&&(y[ze[d[p+E]]++]=E);if(h===i?(U=qe=y,Ce=19):h===o?(U=a,Ae-=257,qe=l,Q-=257,Ce=256):(U=c,qe=u,Ce=-1),ne=0,E=0,S=k,me=g,B=D,I=0,ae=-1,Z=1<<D,we=Z-1,h===o&&Z>n||h===s&&Z>r)return 1;for(;;){X=S-I,y[E]<Ce?(re=0,ie=y[E]):y[E]>Ce?(re=qe[Q+y[E]],ie=U[Ae+y[E]]):(re=96,ie=0),J=1<<S-I,ce=1<<B,k=ce;do ce-=J,b[me+(ne>>I)+ce]=X<<24|re<<16|ie|0;while(ce!==0);for(J=1<<S-1;ne&J;)J>>=1;if(J!==0?(ne&=J-1,ne+=J):ne=0,E++,--H[S]===0){if(S===M)break;S=d[p+y[E]]}if(S>D&&(ne&we)!==ae){for(I===0&&(I=D),me+=k,B=S-I,q=1<<B;B+I<M&&(q-=H[B+I],!(q<=0));)B++,q<<=1;if(Z+=1<<B,h===o&&Z>n||h===s&&Z>r)return 1;ae=ne&we,b[ae]=D<<24|B<<16|me-g|0}}return ne!==0&&(b[me+ne]=S-I<<24|64<<16|0),v.bits=D,0},O1}var CC;function K$(){if(CC)return Wn;CC=1;var e=ro(),t=dC(),n=gC(),r=Z$(),i=X$(),o=0,s=1,a=2,l=4,c=5,u=6,f=0,h=1,d=2,p=-2,m=-3,b=-4,g=-5,y=8,v=1,w=2,S=3,E=4,k=5,M=6,D=7,B=8,I=9,q=10,Z=11,ne=12,J=13,ce=14,ae=15,we=16,me=17,U=18,Ae=19,Ce=20,H=21,ze=22,qe=23,Q=24,X=25,re=26,ie=27,ye=28,L=29,R=30,se=31,pe=32,Re=852,Te=592,Ie=15,Me=Ie;function wt($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function hn(){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 e.Buf16(320),this.work=new e.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Bt($){var ee;return!$||!$.state?p:(ee=$.state,$.total_in=$.total_out=ee.total=0,$.msg="",ee.wrap&&($.adler=ee.wrap&1),ee.mode=v,ee.last=0,ee.havedict=0,ee.dmax=32768,ee.head=null,ee.hold=0,ee.bits=0,ee.lencode=ee.lendyn=new e.Buf32(Re),ee.distcode=ee.distdyn=new e.Buf32(Te),ee.sane=1,ee.back=-1,f)}function nt($){var ee;return!$||!$.state?p:(ee=$.state,ee.wsize=0,ee.whave=0,ee.wnext=0,Bt($))}function Nt($,ee){var _,ue;return!$||!$.state||(ue=$.state,ee<0?(_=0,ee=-ee):(_=(ee>>4)+1,ee<48&&(ee&=15)),ee&&(ee<8||ee>15))?p:(ue.window!==null&&ue.wbits!==ee&&(ue.window=null),ue.wrap=_,ue.wbits=ee,nt($))}function Wt($,ee){var _,ue;return $?(ue=new hn,$.state=ue,ue.window=null,_=Nt($,ee),_!==f&&($.state=null),_):p}function st($){return Wt($,Me)}var Yt=!0,F,A;function C($){if(Yt){var ee;for(F=new e.Buf32(512),A=new e.Buf32(32),ee=0;ee<144;)$.lens[ee++]=8;for(;ee<256;)$.lens[ee++]=9;for(;ee<280;)$.lens[ee++]=7;for(;ee<288;)$.lens[ee++]=8;for(i(s,$.lens,0,288,F,0,$.work,{bits:9}),ee=0;ee<32;)$.lens[ee++]=5;i(a,$.lens,0,32,A,0,$.work,{bits:5}),Yt=!1}$.lencode=F,$.lenbits=9,$.distcode=A,$.distbits=5}function z($,ee,_,ue){var Be,x=$.state;return x.window===null&&(x.wsize=1<<x.wbits,x.wnext=0,x.whave=0,x.window=new e.Buf8(x.wsize)),ue>=x.wsize?(e.arraySet(x.window,ee,_-x.wsize,x.wsize,0),x.wnext=0,x.whave=x.wsize):(Be=x.wsize-x.wnext,Be>ue&&(Be=ue),e.arraySet(x.window,ee,_-ue,Be,x.wnext),ue-=Be,ue?(e.arraySet(x.window,ee,_-ue,ue,0),x.wnext=ue,x.whave=x.wsize):(x.wnext+=Be,x.wnext===x.wsize&&(x.wnext=0),x.whave<x.wsize&&(x.whave+=Be))),0}function T($,ee){var _,ue,Be,x,te,oe,P,W,j,de,ve,Ee,Ue,Tt,V=0,Pe,ct,rt,Qt,Fe,pi,At,Ve,Et=new e.Buf8(4),mr,On,Hu=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!$||!$.state||!$.output||!$.input&&$.avail_in!==0)return p;_=$.state,_.mode===ne&&(_.mode=J),te=$.next_out,Be=$.output,P=$.avail_out,x=$.next_in,ue=$.input,oe=$.avail_in,W=_.hold,j=_.bits,de=oe,ve=P,Ve=f;e:for(;;)switch(_.mode){case v:if(_.wrap===0){_.mode=J;break}for(;j<16;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(_.wrap&2&&W===35615){_.check=0,Et[0]=W&255,Et[1]=W>>>8&255,_.check=n(_.check,Et,2,0),W=0,j=0,_.mode=w;break}if(_.flags=0,_.head&&(_.head.done=!1),!(_.wrap&1)||(((W&255)<<8)+(W>>8))%31){$.msg="incorrect header check",_.mode=R;break}if((W&15)!==y){$.msg="unknown compression method",_.mode=R;break}if(W>>>=4,j-=4,At=(W&15)+8,_.wbits===0)_.wbits=At;else if(At>_.wbits){$.msg="invalid window size",_.mode=R;break}_.dmax=1<<At,$.adler=_.check=1,_.mode=W&512?q:ne,W=0,j=0;break;case w:for(;j<16;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(_.flags=W,(_.flags&255)!==y){$.msg="unknown compression method",_.mode=R;break}if(_.flags&57344){$.msg="unknown header flags set",_.mode=R;break}_.head&&(_.head.text=W>>8&1),_.flags&512&&(Et[0]=W&255,Et[1]=W>>>8&255,_.check=n(_.check,Et,2,0)),W=0,j=0,_.mode=S;case S:for(;j<32;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}_.head&&(_.head.time=W),_.flags&512&&(Et[0]=W&255,Et[1]=W>>>8&255,Et[2]=W>>>16&255,Et[3]=W>>>24&255,_.check=n(_.check,Et,4,0)),W=0,j=0,_.mode=E;case E:for(;j<16;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}_.head&&(_.head.xflags=W&255,_.head.os=W>>8),_.flags&512&&(Et[0]=W&255,Et[1]=W>>>8&255,_.check=n(_.check,Et,2,0)),W=0,j=0,_.mode=k;case k:if(_.flags&1024){for(;j<16;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}_.length=W,_.head&&(_.head.extra_len=W),_.flags&512&&(Et[0]=W&255,Et[1]=W>>>8&255,_.check=n(_.check,Et,2,0)),W=0,j=0}else _.head&&(_.head.extra=null);_.mode=M;case M:if(_.flags&1024&&(Ee=_.length,Ee>oe&&(Ee=oe),Ee&&(_.head&&(At=_.head.extra_len-_.length,_.head.extra||(_.head.extra=new Array(_.head.extra_len)),e.arraySet(_.head.extra,ue,x,Ee,At)),_.flags&512&&(_.check=n(_.check,ue,Ee,x)),oe-=Ee,x+=Ee,_.length-=Ee),_.length))break e;_.length=0,_.mode=D;case D:if(_.flags&2048){if(oe===0)break e;Ee=0;do At=ue[x+Ee++],_.head&&At&&_.length<65536&&(_.head.name+=String.fromCharCode(At));while(At&&Ee<oe);if(_.flags&512&&(_.check=n(_.check,ue,Ee,x)),oe-=Ee,x+=Ee,At)break e}else _.head&&(_.head.name=null);_.length=0,_.mode=B;case B:if(_.flags&4096){if(oe===0)break e;Ee=0;do At=ue[x+Ee++],_.head&&At&&_.length<65536&&(_.head.comment+=String.fromCharCode(At));while(At&&Ee<oe);if(_.flags&512&&(_.check=n(_.check,ue,Ee,x)),oe-=Ee,x+=Ee,At)break e}else _.head&&(_.head.comment=null);_.mode=I;case I:if(_.flags&512){for(;j<16;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(W!==(_.check&65535)){$.msg="header crc mismatch",_.mode=R;break}W=0,j=0}_.head&&(_.head.hcrc=_.flags>>9&1,_.head.done=!0),$.adler=_.check=0,_.mode=ne;break;case q:for(;j<32;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}$.adler=_.check=wt(W),W=0,j=0,_.mode=Z;case Z:if(_.havedict===0)return $.next_out=te,$.avail_out=P,$.next_in=x,$.avail_in=oe,_.hold=W,_.bits=j,d;$.adler=_.check=1,_.mode=ne;case ne:if(ee===c||ee===u)break e;case J:if(_.last){W>>>=j&7,j-=j&7,_.mode=ie;break}for(;j<3;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}switch(_.last=W&1,W>>>=1,j-=1,W&3){case 0:_.mode=ce;break;case 1:if(C(_),_.mode=Ce,ee===u){W>>>=2,j-=2;break e}break;case 2:_.mode=me;break;case 3:$.msg="invalid block type",_.mode=R}W>>>=2,j-=2;break;case ce:for(W>>>=j&7,j-=j&7;j<32;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if((W&65535)!==(W>>>16^65535)){$.msg="invalid stored block lengths",_.mode=R;break}if(_.length=W&65535,W=0,j=0,_.mode=ae,ee===u)break e;case ae:_.mode=we;case we:if(Ee=_.length,Ee){if(Ee>oe&&(Ee=oe),Ee>P&&(Ee=P),Ee===0)break e;e.arraySet(Be,ue,x,Ee,te),oe-=Ee,x+=Ee,P-=Ee,te+=Ee,_.length-=Ee;break}_.mode=ne;break;case me:for(;j<14;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(_.nlen=(W&31)+257,W>>>=5,j-=5,_.ndist=(W&31)+1,W>>>=5,j-=5,_.ncode=(W&15)+4,W>>>=4,j-=4,_.nlen>286||_.ndist>30){$.msg="too many length or distance symbols",_.mode=R;break}_.have=0,_.mode=U;case U:for(;_.have<_.ncode;){for(;j<3;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}_.lens[Hu[_.have++]]=W&7,W>>>=3,j-=3}for(;_.have<19;)_.lens[Hu[_.have++]]=0;if(_.lencode=_.lendyn,_.lenbits=7,mr={bits:_.lenbits},Ve=i(o,_.lens,0,19,_.lencode,0,_.work,mr),_.lenbits=mr.bits,Ve){$.msg="invalid code lengths set",_.mode=R;break}_.have=0,_.mode=Ae;case Ae:for(;_.have<_.nlen+_.ndist;){for(;V=_.lencode[W&(1<<_.lenbits)-1],Pe=V>>>24,ct=V>>>16&255,rt=V&65535,!(Pe<=j);){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(rt<16)W>>>=Pe,j-=Pe,_.lens[_.have++]=rt;else{if(rt===16){for(On=Pe+2;j<On;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(W>>>=Pe,j-=Pe,_.have===0){$.msg="invalid bit length repeat",_.mode=R;break}At=_.lens[_.have-1],Ee=3+(W&3),W>>>=2,j-=2}else if(rt===17){for(On=Pe+3;j<On;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}W>>>=Pe,j-=Pe,At=0,Ee=3+(W&7),W>>>=3,j-=3}else{for(On=Pe+7;j<On;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}W>>>=Pe,j-=Pe,At=0,Ee=11+(W&127),W>>>=7,j-=7}if(_.have+Ee>_.nlen+_.ndist){$.msg="invalid bit length repeat",_.mode=R;break}for(;Ee--;)_.lens[_.have++]=At}}if(_.mode===R)break;if(_.lens[256]===0){$.msg="invalid code -- missing end-of-block",_.mode=R;break}if(_.lenbits=9,mr={bits:_.lenbits},Ve=i(s,_.lens,0,_.nlen,_.lencode,0,_.work,mr),_.lenbits=mr.bits,Ve){$.msg="invalid literal/lengths set",_.mode=R;break}if(_.distbits=6,_.distcode=_.distdyn,mr={bits:_.distbits},Ve=i(a,_.lens,_.nlen,_.ndist,_.distcode,0,_.work,mr),_.distbits=mr.bits,Ve){$.msg="invalid distances set",_.mode=R;break}if(_.mode=Ce,ee===u)break e;case Ce:_.mode=H;case H:if(oe>=6&&P>=258){$.next_out=te,$.avail_out=P,$.next_in=x,$.avail_in=oe,_.hold=W,_.bits=j,r($,ve),te=$.next_out,Be=$.output,P=$.avail_out,x=$.next_in,ue=$.input,oe=$.avail_in,W=_.hold,j=_.bits,_.mode===ne&&(_.back=-1);break}for(_.back=0;V=_.lencode[W&(1<<_.lenbits)-1],Pe=V>>>24,ct=V>>>16&255,rt=V&65535,!(Pe<=j);){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(ct&&!(ct&240)){for(Qt=Pe,Fe=ct,pi=rt;V=_.lencode[pi+((W&(1<<Qt+Fe)-1)>>Qt)],Pe=V>>>24,ct=V>>>16&255,rt=V&65535,!(Qt+Pe<=j);){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}W>>>=Qt,j-=Qt,_.back+=Qt}if(W>>>=Pe,j-=Pe,_.back+=Pe,_.length=rt,ct===0){_.mode=re;break}if(ct&32){_.back=-1,_.mode=ne;break}if(ct&64){$.msg="invalid literal/length code",_.mode=R;break}_.extra=ct&15,_.mode=ze;case ze:if(_.extra){for(On=_.extra;j<On;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}_.length+=W&(1<<_.extra)-1,W>>>=_.extra,j-=_.extra,_.back+=_.extra}_.was=_.length,_.mode=qe;case qe:for(;V=_.distcode[W&(1<<_.distbits)-1],Pe=V>>>24,ct=V>>>16&255,rt=V&65535,!(Pe<=j);){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(!(ct&240)){for(Qt=Pe,Fe=ct,pi=rt;V=_.distcode[pi+((W&(1<<Qt+Fe)-1)>>Qt)],Pe=V>>>24,ct=V>>>16&255,rt=V&65535,!(Qt+Pe<=j);){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}W>>>=Qt,j-=Qt,_.back+=Qt}if(W>>>=Pe,j-=Pe,_.back+=Pe,ct&64){$.msg="invalid distance code",_.mode=R;break}_.offset=rt,_.extra=ct&15,_.mode=Q;case Q:if(_.extra){for(On=_.extra;j<On;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}_.offset+=W&(1<<_.extra)-1,W>>>=_.extra,j-=_.extra,_.back+=_.extra}if(_.offset>_.dmax){$.msg="invalid distance too far back",_.mode=R;break}_.mode=X;case X:if(P===0)break e;if(Ee=ve-P,_.offset>Ee){if(Ee=_.offset-Ee,Ee>_.whave&&_.sane){$.msg="invalid distance too far back",_.mode=R;break}Ee>_.wnext?(Ee-=_.wnext,Ue=_.wsize-Ee):Ue=_.wnext-Ee,Ee>_.length&&(Ee=_.length),Tt=_.window}else Tt=Be,Ue=te-_.offset,Ee=_.length;Ee>P&&(Ee=P),P-=Ee,_.length-=Ee;do Be[te++]=Tt[Ue++];while(--Ee);_.length===0&&(_.mode=H);break;case re:if(P===0)break e;Be[te++]=_.length,P--,_.mode=H;break;case ie:if(_.wrap){for(;j<32;){if(oe===0)break e;oe--,W|=ue[x++]<<j,j+=8}if(ve-=P,$.total_out+=ve,_.total+=ve,ve&&($.adler=_.check=_.flags?n(_.check,Be,ve,te-ve):t(_.check,Be,ve,te-ve)),ve=P,(_.flags?W:wt(W))!==_.check){$.msg="incorrect data check",_.mode=R;break}W=0,j=0}_.mode=ye;case ye:if(_.wrap&&_.flags){for(;j<32;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(W!==(_.total&4294967295)){$.msg="incorrect length check",_.mode=R;break}W=0,j=0}_.mode=L;case L:Ve=h;break e;case R:Ve=m;break e;case se:return b;case pe:default:return p}return $.next_out=te,$.avail_out=P,$.next_in=x,$.avail_in=oe,_.hold=W,_.bits=j,(_.wsize||ve!==$.avail_out&&_.mode<R&&(_.mode<ie||ee!==l))&&z($,$.output,$.next_out,ve-$.avail_out),de-=$.avail_in,ve-=$.avail_out,$.total_in+=de,$.total_out+=ve,_.total+=ve,_.wrap&&ve&&($.adler=_.check=_.flags?n(_.check,Be,ve,$.next_out-ve):t(_.check,Be,ve,$.next_out-ve)),$.data_type=_.bits+(_.last?64:0)+(_.mode===ne?128:0)+(_.mode===Ce||_.mode===ae?256:0),(de===0&&ve===0||ee===l)&&Ve===f&&(Ve=g),Ve}function G($){if(!$||!$.state)return p;var ee=$.state;return ee.window&&(ee.window=null),$.state=null,f}function Y($,ee){var _;return!$||!$.state||(_=$.state,!(_.wrap&2))?p:(_.head=ee,ee.done=!1,f)}function ge($,ee){var _=ee.length,ue,Be,x;return!$||!$.state||(ue=$.state,ue.wrap!==0&&ue.mode!==Z)?p:ue.mode===Z&&(Be=1,Be=t(Be,ee,_,0),Be!==ue.check)?m:(x=z($,ee,_,_),x?(ue.mode=se,b):(ue.havedict=1,f))}return Wn.inflateReset=nt,Wn.inflateReset2=Nt,Wn.inflateResetKeep=Bt,Wn.inflateInit=st,Wn.inflateInit2=Wt,Wn.inflate=T,Wn.inflateEnd=G,Wn.inflateGetHeader=Y,Wn.inflateSetDictionary=ge,Wn.inflateInfo="pako inflate (from Nodeca project)",Wn}var L1,kC;function TC(){return kC||(kC=1,L1={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_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}),L1}var N1,IC;function J$(){if(IC)return N1;IC=1;function e(){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}return N1=e,N1}var _C;function eW(){if(_C)return ka;_C=1;var e=K$(),t=ro(),n=wC(),r=TC(),i=F1(),o=xC(),s=J$(),a=Object.prototype.toString;function l(f){if(!(this instanceof l))return new l(f);this.options=t.assign({chunkSize:16384,windowBits:0,to:""},f||{});var h=this.options;h.raw&&h.windowBits>=0&&h.windowBits<16&&(h.windowBits=-h.windowBits,h.windowBits===0&&(h.windowBits=-15)),h.windowBits>=0&&h.windowBits<16&&!(f&&f.windowBits)&&(h.windowBits+=32),h.windowBits>15&&h.windowBits<48&&(h.windowBits&15||(h.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;var d=e.inflateInit2(this.strm,h.windowBits);if(d!==r.Z_OK)throw new Error(i[d]);if(this.header=new s,e.inflateGetHeader(this.strm,this.header),h.dictionary&&(typeof h.dictionary=="string"?h.dictionary=n.string2buf(h.dictionary):a.call(h.dictionary)==="[object ArrayBuffer]"&&(h.dictionary=new Uint8Array(h.dictionary)),h.raw&&(d=e.inflateSetDictionary(this.strm,h.dictionary),d!==r.Z_OK)))throw new Error(i[d])}l.prototype.push=function(f,h){var d=this.strm,p=this.options.chunkSize,m=this.options.dictionary,b,g,y,v,w,S=!1;if(this.ended)return!1;g=h===~~h?h:h===!0?r.Z_FINISH:r.Z_NO_FLUSH,typeof f=="string"?d.input=n.binstring2buf(f):a.call(f)==="[object ArrayBuffer]"?d.input=new Uint8Array(f):d.input=f,d.next_in=0,d.avail_in=d.input.length;do{if(d.avail_out===0&&(d.output=new t.Buf8(p),d.next_out=0,d.avail_out=p),b=e.inflate(d,r.Z_NO_FLUSH),b===r.Z_NEED_DICT&&m&&(b=e.inflateSetDictionary(this.strm,m)),b===r.Z_BUF_ERROR&&S===!0&&(b=r.Z_OK,S=!1),b!==r.Z_STREAM_END&&b!==r.Z_OK)return this.onEnd(b),this.ended=!0,!1;d.next_out&&(d.avail_out===0||b===r.Z_STREAM_END||d.avail_in===0&&(g===r.Z_FINISH||g===r.Z_SYNC_FLUSH))&&(this.options.to==="string"?(y=n.utf8border(d.output,d.next_out),v=d.next_out-y,w=n.buf2string(d.output,y),d.next_out=v,d.avail_out=p-v,v&&t.arraySet(d.output,d.output,y,v,0),this.onData(w)):this.onData(t.shrinkBuf(d.output,d.next_out))),d.avail_in===0&&d.avail_out===0&&(S=!0)}while((d.avail_in>0||d.avail_out===0)&&b!==r.Z_STREAM_END);return b===r.Z_STREAM_END&&(g=r.Z_FINISH),g===r.Z_FINISH?(b=e.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===r.Z_OK):(g===r.Z_SYNC_FLUSH&&(this.onEnd(r.Z_OK),d.avail_out=0),!0)},l.prototype.onData=function(f){this.chunks.push(f)},l.prototype.onEnd=function(f){f===r.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=t.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg};function c(f,h){var d=new l(h);if(d.push(f,!0),d.err)throw d.msg||i[d.err];return d.result}function u(f,h){return h=h||{},h.raw=!0,c(f,h)}return ka.Inflate=l,ka.inflate=c,ka.inflateRaw=u,ka.ungzip=c,ka}var z1,DC;function tW(){if(DC)return z1;DC=1;var e=ro().assign,t=Q$(),n=eW(),r=TC(),i={};return e(i,t,n,r),z1=i,z1}var ud=tW();async function io(e){try{let t,n=0,r=0;const i=[];let o=0,s;do{const l=e.subarray(n);if(s=new ud.Inflate,{strm:t}=s,s.push(l,ud.Z_SYNC_FLUSH),s.err)throw new Error(s.msg);n+=t.next_in,i[r]=s.result,o+=i[r].length,r+=1}while(t.avail_in);const a=new Uint8Array(o);for(let l=0,c=0;l<i.length;l++)a.set(i[l],c),c+=i[l].length;return ot.Buffer.from(a)}catch(t){throw/incorrect header check/.exec(`${t}`)?new Error("problem decompressing block: incorrect gzip header check"):t}}async function RC(e,t){try{let n;const{minv:r,maxv:i}=t;let o=r.blockPosition,s=r.dataPosition;const a=[],l=[],c=[];let u=0,f=0;do{const p=e.subarray(o-r.blockPosition),m=new ud.Inflate;if({strm:n}=m,m.push(p,ud.Z_SYNC_FLUSH),m.err)throw new Error(m.msg);const b=m.result;a.push(b);let g=b.length;l.push(o),c.push(s),a.length===1&&r.dataPosition&&(a[0]=a[0].subarray(r.dataPosition),g=a[0].length);const y=o;if(o+=n.next_in,s+=g,y>=i.blockPosition){a[f]=a[f].subarray(0,i.blockPosition===r.blockPosition?i.dataPosition-r.dataPosition+1:i.dataPosition+1),l.push(o),c.push(s),u+=a[f].length;break}u+=a[f].length,f++}while(n.avail_in);const h=new Uint8Array(u);for(let p=0,m=0;p<a.length;p++)h.set(a[p],m),m+=a[p].length;return{buffer:ot.Buffer.from(h),cpositions:l,dpositions:c}}catch(n){throw/incorrect header check/.exec(`${n}`)?new Error("problem decompressing block: incorrect gzip header check"):n}}var U1,BC;function nW(){if(BC)return U1;BC=1,U1=t;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function t(B,I,q){this.low=B|0,this.high=I|0,this.unsigned=!!q}t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0});function n(B){return(B&&B.__isLong__)===!0}t.isLong=n;var r={},i={};function o(B,I){var q,Z,ne;return I?(B>>>=0,(ne=0<=B&&B<256)&&(Z=i[B],Z)?Z:(q=a(B,(B|0)<0?-1:0,!0),ne&&(i[B]=q),q)):(B|=0,(ne=-128<=B&&B<128)&&(Z=r[B],Z)?Z:(q=a(B,B<0?-1:0,!1),ne&&(r[B]=q),q))}t.fromInt=o;function s(B,I){if(isNaN(B))return I?y:g;if(I){if(B<0)return y;if(B>=p)return k}else{if(B<=-9223372036854776e3)return M;if(B+1>=m)return E}return B<0?s(-B,I).neg():a(B%d|0,B/d|0,I)}t.fromNumber=s;function a(B,I,q){return new t(B,I,q)}t.fromBits=a;var l=Math.pow;function c(B,I,q){if(B.length===0)throw Error("empty string");if(B==="NaN"||B==="Infinity"||B==="+Infinity"||B==="-Infinity")return g;if(typeof I=="number"?(q=I,I=!1):I=!!I,q=q||10,q<2||36<q)throw RangeError("radix");var Z;if((Z=B.indexOf("-"))>0)throw Error("interior hyphen");if(Z===0)return c(B.substring(1),I,q).neg();for(var ne=s(l(q,8)),J=g,ce=0;ce<B.length;ce+=8){var ae=Math.min(8,B.length-ce),we=parseInt(B.substring(ce,ce+ae),q);if(ae<8){var me=s(l(q,ae));J=J.mul(me).add(s(we))}else J=J.mul(ne),J=J.add(s(we))}return J.unsigned=I,J}t.fromString=c;function u(B,I){return typeof B=="number"?s(B,I):typeof B=="string"?c(B,I):a(B.low,B.high,typeof I=="boolean"?I:B.unsigned)}t.fromValue=u;var f=65536,h=1<<24,d=f*f,p=d*d,m=p/2,b=o(h),g=o(0);t.ZERO=g;var y=o(0,!0);t.UZERO=y;var v=o(1);t.ONE=v;var w=o(1,!0);t.UONE=w;var S=o(-1);t.NEG_ONE=S;var E=a(-1,2147483647,!1);t.MAX_VALUE=E;var k=a(-1,-1,!0);t.MAX_UNSIGNED_VALUE=k;var M=a(0,-2147483648,!1);t.MIN_VALUE=M;var D=t.prototype;return D.toInt=function(){return this.unsigned?this.low>>>0:this.low},D.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},D.toString=function(I){if(I=I||10,I<2||36<I)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(M)){var q=s(I),Z=this.div(q),ne=Z.mul(q).sub(this);return Z.toString(I)+ne.toInt().toString(I)}else return"-"+this.neg().toString(I);for(var J=s(l(I,6),this.unsigned),ce=this,ae="";;){var we=ce.div(J),me=ce.sub(we.mul(J)).toInt()>>>0,U=me.toString(I);if(ce=we,ce.isZero())return U+ae;for(;U.length<6;)U="0"+U;ae=""+U+ae}},D.getHighBits=function(){return this.high},D.getHighBitsUnsigned=function(){return this.high>>>0},D.getLowBits=function(){return this.low},D.getLowBitsUnsigned=function(){return this.low>>>0},D.getNumBitsAbs=function(){if(this.isNegative())return this.eq(M)?64:this.neg().getNumBitsAbs();for(var I=this.high!=0?this.high:this.low,q=31;q>0&&!(I&1<<q);q--);return this.high!=0?q+33:q+1},D.isZero=function(){return this.high===0&&this.low===0},D.eqz=D.isZero,D.isNegative=function(){return!this.unsigned&&this.high<0},D.isPositive=function(){return this.unsigned||this.high>=0},D.isOdd=function(){return(this.low&1)===1},D.isEven=function(){return(this.low&1)===0},D.equals=function(I){return n(I)||(I=u(I)),this.unsigned!==I.unsigned&&this.high>>>31===1&&I.high>>>31===1?!1:this.high===I.high&&this.low===I.low},D.eq=D.equals,D.notEquals=function(I){return!this.eq(I)},D.neq=D.notEquals,D.ne=D.notEquals,D.lessThan=function(I){return this.comp(I)<0},D.lt=D.lessThan,D.lessThanOrEqual=function(I){return this.comp(I)<=0},D.lte=D.lessThanOrEqual,D.le=D.lessThanOrEqual,D.greaterThan=function(I){return this.comp(I)>0},D.gt=D.greaterThan,D.greaterThanOrEqual=function(I){return this.comp(I)>=0},D.gte=D.greaterThanOrEqual,D.ge=D.greaterThanOrEqual,D.compare=function(I){if(n(I)||(I=u(I)),this.eq(I))return 0;var q=this.isNegative(),Z=I.isNegative();return q&&!Z?-1:!q&&Z?1:this.unsigned?I.high>>>0>this.high>>>0||I.high===this.high&&I.low>>>0>this.low>>>0?-1:1:this.sub(I).isNegative()?-1:1},D.comp=D.compare,D.negate=function(){return!this.unsigned&&this.eq(M)?M:this.not().add(v)},D.neg=D.negate,D.add=function(I){n(I)||(I=u(I));var q=this.high>>>16,Z=this.high&65535,ne=this.low>>>16,J=this.low&65535,ce=I.high>>>16,ae=I.high&65535,we=I.low>>>16,me=I.low&65535,U=0,Ae=0,Ce=0,H=0;return H+=J+me,Ce+=H>>>16,H&=65535,Ce+=ne+we,Ae+=Ce>>>16,Ce&=65535,Ae+=Z+ae,U+=Ae>>>16,Ae&=65535,U+=q+ce,U&=65535,a(Ce<<16|H,U<<16|Ae,this.unsigned)},D.subtract=function(I){return n(I)||(I=u(I)),this.add(I.neg())},D.sub=D.subtract,D.multiply=function(I){if(this.isZero())return g;if(n(I)||(I=u(I)),e){var q=e.mul(this.low,this.high,I.low,I.high);return a(q,e.get_high(),this.unsigned)}if(I.isZero())return g;if(this.eq(M))return I.isOdd()?M:g;if(I.eq(M))return this.isOdd()?M:g;if(this.isNegative())return I.isNegative()?this.neg().mul(I.neg()):this.neg().mul(I).neg();if(I.isNegative())return this.mul(I.neg()).neg();if(this.lt(b)&&I.lt(b))return s(this.toNumber()*I.toNumber(),this.unsigned);var Z=this.high>>>16,ne=this.high&65535,J=this.low>>>16,ce=this.low&65535,ae=I.high>>>16,we=I.high&65535,me=I.low>>>16,U=I.low&65535,Ae=0,Ce=0,H=0,ze=0;return ze+=ce*U,H+=ze>>>16,ze&=65535,H+=J*U,Ce+=H>>>16,H&=65535,H+=ce*me,Ce+=H>>>16,H&=65535,Ce+=ne*U,Ae+=Ce>>>16,Ce&=65535,Ce+=J*me,Ae+=Ce>>>16,Ce&=65535,Ce+=ce*we,Ae+=Ce>>>16,Ce&=65535,Ae+=Z*U+ne*me+J*we+ce*ae,Ae&=65535,a(H<<16|ze,Ae<<16|Ce,this.unsigned)},D.mul=D.multiply,D.divide=function(I){if(n(I)||(I=u(I)),I.isZero())throw Error("division by zero");if(e){if(!this.unsigned&&this.high===-2147483648&&I.low===-1&&I.high===-1)return this;var q=(this.unsigned?e.div_u:e.div_s)(this.low,this.high,I.low,I.high);return a(q,e.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?y:g;var Z,ne,J;if(this.unsigned){if(I.unsigned||(I=I.toUnsigned()),I.gt(this))return y;if(I.gt(this.shru(1)))return w;J=y}else{if(this.eq(M)){if(I.eq(v)||I.eq(S))return M;if(I.eq(M))return v;var ce=this.shr(1);return Z=ce.div(I).shl(1),Z.eq(g)?I.isNegative()?v:S:(ne=this.sub(I.mul(Z)),J=Z.add(ne.div(I)),J)}else if(I.eq(M))return this.unsigned?y:g;if(this.isNegative())return I.isNegative()?this.neg().div(I.neg()):this.neg().div(I).neg();if(I.isNegative())return this.div(I.neg()).neg();J=g}for(ne=this;ne.gte(I);){Z=Math.max(1,Math.floor(ne.toNumber()/I.toNumber()));for(var ae=Math.ceil(Math.log(Z)/Math.LN2),we=ae<=48?1:l(2,ae-48),me=s(Z),U=me.mul(I);U.isNegative()||U.gt(ne);)Z-=we,me=s(Z,this.unsigned),U=me.mul(I);me.isZero()&&(me=v),J=J.add(me),ne=ne.sub(U)}return J},D.div=D.divide,D.modulo=function(I){if(n(I)||(I=u(I)),e){var q=(this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,I.low,I.high);return a(q,e.get_high(),this.unsigned)}return this.sub(this.div(I).mul(I))},D.mod=D.modulo,D.rem=D.modulo,D.not=function(){return a(~this.low,~this.high,this.unsigned)},D.and=function(I){return n(I)||(I=u(I)),a(this.low&I.low,this.high&I.high,this.unsigned)},D.or=function(I){return n(I)||(I=u(I)),a(this.low|I.low,this.high|I.high,this.unsigned)},D.xor=function(I){return n(I)||(I=u(I)),a(this.low^I.low,this.high^I.high,this.unsigned)},D.shiftLeft=function(I){return n(I)&&(I=I.toInt()),(I&=63)===0?this:I<32?a(this.low<<I,this.high<<I|this.low>>>32-I,this.unsigned):a(0,this.low<<I-32,this.unsigned)},D.shl=D.shiftLeft,D.shiftRight=function(I){return n(I)&&(I=I.toInt()),(I&=63)===0?this:I<32?a(this.low>>>I|this.high<<32-I,this.high>>I,this.unsigned):a(this.high>>I-32,this.high>=0?0:-1,this.unsigned)},D.shr=D.shiftRight,D.shiftRightUnsigned=function(I){if(n(I)&&(I=I.toInt()),I&=63,I===0)return this;var q=this.high;if(I<32){var Z=this.low;return a(Z>>>I|q<<32-I,q>>>I,this.unsigned)}else return I===32?a(q,0,this.unsigned):a(q>>>I-32,0,this.unsigned)},D.shru=D.shiftRightUnsigned,D.shr_u=D.shiftRightUnsigned,D.toSigned=function(){return this.unsigned?a(this.low,this.high,!1):this},D.toUnsigned=function(){return this.unsigned?this:a(this.low,this.high,!0)},D.toBytes=function(I){return I?this.toBytesLE():this.toBytesBE()},D.toBytesLE=function(){var I=this.high,q=this.low;return[q&255,q>>>8&255,q>>>16&255,q>>>24,I&255,I>>>8&255,I>>>16&255,I>>>24]},D.toBytesBE=function(){var I=this.high,q=this.low;return[I>>>24,I>>>16&255,I>>>8&255,I&255,q>>>24,q>>>16&255,q>>>8&255,q&255]},t.fromBytes=function(I,q,Z){return Z?t.fromBytesLE(I,q):t.fromBytesBE(I,q)},t.fromBytesLE=function(I,q){return new t(I[0]|I[1]<<8|I[2]<<16|I[3]<<24,I[4]|I[5]<<8|I[6]<<16|I[7]<<24,q)},t.fromBytesBE=function(I,q){return new t(I[4]<<24|I[5]<<16|I[6]<<8|I[7],I[0]<<24|I[1]<<16|I[2]<<8|I[3],q)},U1}var rW=nW();const fd=ld(rW),hd=1;class iW{constructor({filehandle:t,path:n}){if(t)this.filehandle=t;else if(n)this.filehandle=new qt(n);else throw new TypeError("either filehandle or path must be defined")}_readLongWithOverflow(t,n=0,r=!0){const i=fd.fromBytesLE(t.slice(n,n+8),r);if(i.greaterThan(Number.MAX_SAFE_INTEGER)||i.lessThan(Number.MIN_SAFE_INTEGER))throw new TypeError("integer overflow");return i.toNumber()}_getIndex(){return this.index||(this.index=this._readIndex()),this.index}async _readIndex(){let t=ot.Buffer.allocUnsafe(8);await this.filehandle.read(t,0,8,0);const n=this._readLongWithOverflow(t,0,!0);if(!n)return[[0,0]];const r=new Array(n+1);r[0]=[0,0];const i=8*2*n;if(i>Number.MAX_SAFE_INTEGER)throw new TypeError("integer overflow");t=ot.Buffer.allocUnsafe(i),await this.filehandle.read(t,0,i,8);for(let o=0;o<n;o+=1){const s=this._readLongWithOverflow(t,o*16),a=this._readLongWithOverflow(t,o*16+8);r[o+1]=[s,a]}return r}async getLastBlock(){const t=await this._getIndex();if(t.length)return t[t.length-1]}async getRelevantBlocksForRead(t,n){const r=n+t;if(t===0)return[];const i=await this._getIndex(),o=[],s=(h,d)=>{const p=h[hd],m=d?d[hd]:1/0;return p<=n&&m>n?0:p<n?-1:1};let a=0,l=i.length-1,c=Math.floor(i.length/2),u=s(i[c],i[c+1]);for(;u!==0;)u>0?l=c-1:u<0&&(a=c+1),c=Math.ceil((l-a)/2)+a,u=s(i[c],i[c+1]);o.push(i[c]);let f=c+1;for(;f<i.length&&(o.push(i[f]),!(i[f][hd]>=r));f+=1);return o[o.length-1][hd]<r&&o.push([]),o}}class FC{constructor({filehandle:t,path:n,gziFilehandle:r,gziPath:i}){if(t)this.filehandle=t;else if(n)this.filehandle=new qt(n);else throw new TypeError("either filehandle or path must be defined");if(!r&&!i&&!n)throw new TypeError("either gziFilehandle or gziPath must be defined");this.gzi=new iW({filehandle:r,path:!r&&!i&&n?i:`${n}.gzi`})}async stat(){const t=await this.filehandle.stat();return Object.assign(t,{size:await this.getUncompressedFileSize(),blocks:void 0,blksize:void 0})}async getUncompressedFileSize(){const[,t]=await this.gzi.getLastBlock(),{size:n}=await this.filehandle.stat(),r=ot.Buffer.allocUnsafe(4),{bytesRead:i}=await this.filehandle.read(r,0,4,n-28-4);if(i!==4)throw new Error("read error");const o=r.readUInt32LE(0);return t+o}async _readAndUncompressBlock(t,[n],[r]){let i=r;i||(i=(await this.filehandle.stat()).size);const o=i-n;return await this.filehandle.read(t,0,o,n),await io(t.slice(0,o))}async read(t,n,r,i){const o=await this.gzi.getRelevantBlocksForRead(r,i),s=ot.Buffer.allocUnsafe(32768*2);let a=n,l=0;for(let c=0;c<o.length-1;c+=1){const u=await this._readAndUncompressBlock(s,o[c],o[c+1]),[,f]=o[c],h=f>=i?0:i-f,d=Math.min(i+r,f+u.length)-f;h>=0&&h<u.length&&(u.copy(t,a,h,d),a+=d-h,l+=d-h)}return{bytesRead:l,buffer:t}}}function MC(e,t){return e.offset+e.lineBytes*Math.floor(t/e.lineLength)+t%e.lineLength}async function oW(e,t){const n=await e.readFile(t);if(!(n!=null&&n.length))throw new Error("No data read from FASTA index (FAI) file");let r=0,i;const o=n.toString("utf8").split(/\r?\n/).filter(s=>/\S/.test(s)).map(s=>s.split(" ")).filter(s=>s[0]!=="").map(s=>((!i||i.name!==s[0])&&(i={name:s[0],id:r},r+=1),{id:i.id,name:s[0],length:+s[1],start:0,end:+s[1],offset:+s[2],lineLength:+s[3],lineBytes:+s[4]}));return{name:Object.fromEntries(o.map(s=>[s.name,s])),id:Object.fromEntries(o.map(s=>[s.id,s]))}}class PC{constructor({fasta:t,fai:n,path:r,faiPath:i}){if(t)this.fasta=t;else if(r)this.fasta=new qt(r);else throw new Error("Need to pass filehandle for fasta or path to localfile");if(n)this.fai=n;else if(i)this.fai=new qt(i);else if(r)this.fai=new qt(`${r}.fai`);else throw new Error("Need to pass filehandle for or path to localfile")}async _getIndexes(t){return this.indexes||(this.indexes=oW(this.fai,t)),this.indexes}async getSequenceNames(t){return Object.keys((await this._getIndexes(t)).name)}async getSequenceSizes(t){const n={},r=await this._getIndexes(t);for(const i of Object.values(r.id))n[i.name]=i.length;return n}async getSequenceSize(t,n){var r;return(r=(await this._getIndexes(n)).name[t])===null||r===void 0?void 0:r.length}async hasReferenceSequence(t,n){return!!(await this._getIndexes(n)).name[t]}async getResiduesById(t,n,r,i){const o=(await this._getIndexes(i)).id[t];if(o)return this._fetchFromIndexEntry(o,n,r,i)}async getResiduesByName(t,n,r,i){const o=(await this._getIndexes(i)).name[t];if(o)return this._fetchFromIndexEntry(o,n,r,i)}async getSequence(t,n,r,i){return this.getResiduesByName(t,n,r,i)}async _fetchFromIndexEntry(t,n=0,r,i){let o=r;if(n<0)throw new TypeError("regionStart cannot be less than 0");if((o===void 0||o>t.length)&&(o=t.length),n>=o)return"";const s=MC(t,n),a=MC(t,o)-s,l=ot.Buffer.allocUnsafe(a);return await this.fasta.read(l,0,a,s,i),l.toString("utf8").replace(/\s+/g,"")}}class sW extends PC{constructor({fasta:t,path:n,fai:r,faiPath:i,gzi:o,gziPath:s}){super({fasta:t,path:n,fai:r,faiPath:i}),t&&o?this.fasta=new FC({filehandle:t,gziFilehandle:o}):n&&s&&(this.fasta=new FC({path:n,gziPath:s}))}}function OC(e){return e.split(">").filter(t=>/\S/.test(t)).map(t=>{const[n,...r]=t.split(`
3762
- `),[i,...o]=n.split(" "),s=r.join("").replace(/\s/g,"");return{id:i,description:o.join(" "),sequence:s}})}class aW{constructor({fasta:t,path:n}){if(t)this.fasta=t;else if(n)this.fasta=new qt(n);else throw new Error("Need to pass fasta or path");this.data=this.fasta.readFile().then(r=>{const i=r.toString("utf8");return OC(i)})}async fetch(t,n,r){const o=(await this.data).find(a=>a.id===t),s=r-n;if(!o)throw new Error(`no sequence with id ${t} exists`);return o.sequence.slice(n,s)}async getSequenceNames(){return(await this.data).map(n=>n.id)}}const lW=Object.freeze(Object.defineProperty({__proto__:null,BgzipIndexedFasta:sW,FetchableSmallFasta:aW,IndexedFasta:PC,parseSmallFasta:OC},Symbol.toStringTag,{value:"Module"})),LC=BigInt(32);function cW(e,t,n){const r=+!!n,i=+!n;return BigInt(e.getInt32(t,n)*i+e.getInt32(t+4,n)*r)<<LC|BigInt(e.getUint32(t,n)*r+e.getUint32(t+4,n)*i)}function uW(e,t,n){const r=e.getUint32(t,n),i=e.getUint32(t+4,n),o=+!!n,s=+!n;return BigInt(r*s+i*o)<<LC|BigInt(r*o+i*s)}"getBigInt64"in DataView||(DataView.prototype.getBigInt64=function(e,t){return cW(this,e,t)}),"getBigUint64"in DataView||(DataView.prototype.getBigUint64=function(e,t){return uW(this,e,t)});class fW{}class hW{constructor(){this.signals=new Set,this.abortController=new AbortController}addSignal(t=new fW){if(this.signal.aborted)throw new Error("cannot add a signal, already aborted!");this.signals.add(t),t.aborted?this.handleAborted(t):typeof t.addEventListener=="function"&&t.addEventListener("abort",()=>{this.handleAborted(t)})}handleAborted(t){this.signals.delete(t),this.signals.size===0&&this.abortController.abort()}get signal(){return this.abortController.signal}abort(){this.abortController.abort()}}class dW{constructor(){this.callbacks=new Set}addCallback(t=()=>{}){this.callbacks.add(t),t(this.currentMessage)}callback(t){this.currentMessage=t;for(const n of this.callbacks)n(t)}}class hs{constructor({fill:t,cache:n}){if(typeof t!="function")throw new TypeError("must pass a fill function");if(typeof n!="object")throw new TypeError("must pass a cache object");if(typeof n.get!="function"||typeof n.set!="function"||typeof n.delete!="function")throw new TypeError("cache must implement get(key), set(key, val), and and delete(key)");this.cache=n,this.fillCallback=t}static isAbortException(t){return t.name==="AbortError"||t.code==="ERR_ABORTED"||t.message==="AbortError: aborted"||t.message==="Error: aborted"}evict(t,n){this.cache.get(t)===n&&this.cache.delete(t)}fill(t,n,r,i){const o=new hW,s=new dW;s.addCallback(i);const a={aborter:o,promise:this.fillCallback(n,o.signal,l=>{s.callback(l)}),settled:!1,statusReporter:s,get aborted(){return this.aborter.signal.aborted}};a.aborter.addSignal(r),a.aborter.signal.addEventListener("abort",()=>{a.settled||this.evict(t,a)}),a.promise.then(()=>{a.settled=!0},()=>{a.settled=!0,this.evict(t,a)}).catch(l=>{throw console.error(l),l}),this.cache.set(t,a)}static checkSinglePromise(t,n){function r(){if(n!=null&&n.aborted)throw Object.assign(new Error("aborted"),{code:"ERR_ABORTED"})}return t.then(i=>(r(),i),i=>{throw r(),i})}has(t){return this.cache.has(t)}get(t,n,r,i){if(!r&&n instanceof AbortSignal)throw new TypeError("second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?");const o=this.cache.get(t);return o?o.aborted&&!o.settled?(this.evict(t,o),this.get(t,n,r,i)):o.settled?o.promise:(o.aborter.addSignal(r),o.statusReporter.addCallback(i),hs.checkSinglePromise(o.promise,r)):(this.fill(t,n,r,i),hs.checkSinglePromise(this.cache.get(t).promise,r))}delete(t){const n=this.cache.get(t);n&&(n.settled||n.aborter.abort(),this.cache.delete(t))}clear(){const t=this.cache.keys();let n=0;for(let r=t.next();!r.done;r=t.next())this.delete(r.value),n+=1;return n}}var H1,NC;function pW(){if(NC)return H1;NC=1;class e{constructor(n={}){if(!(n.maxSize&&n.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=n.maxSize,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(n,r){this.cache.set(n,r),this._size++,this._size>=this.maxSize&&(this._size=0,this.oldCache=this.cache,this.cache=new Map)}get(n){if(this.cache.has(n))return this.cache.get(n);if(this.oldCache.has(n)){const r=this.oldCache.get(n);return this.oldCache.delete(n),this._set(n,r),r}}set(n,r){return this.cache.has(n)?this.cache.set(n,r):this._set(n,r),this}has(n){return this.cache.has(n)||this.oldCache.has(n)}peek(n){if(this.cache.has(n))return this.cache.get(n);if(this.oldCache.has(n))return this.oldCache.get(n)}delete(n){const r=this.cache.delete(n);return r&&this._size--,this.oldCache.delete(n)||r}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(const[n]of this)yield n}*values(){for(const[,n]of this)yield n}*[Symbol.iterator](){for(const n of this.cache)yield n;for(const n of this.oldCache){const[r]=n;this.cache.has(r)||(yield n)}}get size(){let n=0;for(const r of this.oldCache.keys())this.cache.has(r)||n++;return this._size+n}}return H1=e,H1}var gW=pW();const dd=ld(gW);class Ta{constructor(t){this.ranges=t}get min(){return this.ranges[0].min}get max(){return this.ranges.at(-1).max}contains(t){for(const n of this.ranges)if(n.min<=t&&n.max>=t)return!0;return!1}isContiguous(){return this.ranges.length>1}getRanges(){return this.ranges.map(t=>new Ta([{min:t.min,max:t.max}]))}toString(){return this.ranges.map(t=>`[${t.min}-${t.max}]`).join(",")}union(t){const n=[...this.getRanges(),...t.getRanges()].sort((o,s)=>o.min<s.min?-1:o.min>s.min?1:o.max<s.max?-1:s.max>o.max?1:0),r=[];let i=n[0];for(const o of n)o.min>i.max+1?(r.push(i),i=o):o.max>i.max&&(i=new Ta([{min:i.min,max:o.max}]));return r.push(i),r.length===1?r[0]:new Ta(r)}}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function Ia(e){let t=e.length;for(;--t>=0;)e[t]=0}const mW=3,bW=258,zC=29,yW=256+1+zC,UC=30,wW=512,vW=new Array((yW+2)*2);Ia(vW);const xW=new Array(UC*2);Ia(xW);const AW=new Array(wW);Ia(AW);const EW=new Array(bW-mW+1);Ia(EW);const SW=new Array(zC);Ia(SW);const CW=new Array(UC);Ia(CW);var G1=(e,t,n,r)=>{let i=e&65535|0,o=e>>>16&65535|0,s=0;for(;n!==0;){s=n>2e3?2e3:n,n-=s;do i=i+t[r++]|0,o=o+i|0;while(--s);i%=65521,o%=65521}return i|o<<16|0};const kW=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},TW=new Uint32Array(kW());var Nr=(e,t,n,r)=>{const i=TW,o=r+n;e^=-1;for(let s=r;s<o;s++)e=e>>>8^i[(e^t[s])&255];return e^-1},j1={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"},HC={Z_NO_FLUSH:0,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_DEFLATED:8};const IW=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var _W=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)IW(n,r)&&(e[r]=n[r])}}return e},DW=e=>{let t=0;for(let r=0,i=e.length;r<i;r++)t+=e[r].length;const n=new Uint8Array(t);for(let r=0,i=0,o=e.length;r<o;r++){let s=e[r];n.set(s,i),i+=s.length}return n},GC={assign:_W,flattenChunks:DW};let jC=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{jC=!1}const su=new Uint8Array(256);for(let e=0;e<256;e++)su[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;su[254]=su[254]=1;var RW=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,o,s=e.length,a=0;for(i=0;i<s;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<s&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),a+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(a),o=0,i=0;o<a;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<s&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[o++]=n:n<2048?(t[o++]=192|n>>>6,t[o++]=128|n&63):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|n&63):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|n&63);return t};const BW=(e,t)=>{if(t<65534&&e.subarray&&jC)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n};var FW=(e,t)=>{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const o=new Array(n*2);for(i=0,r=0;r<n;){let s=e[r++];if(s<128){o[i++]=s;continue}let a=su[s];if(a>4){o[i++]=65533,r+=a-1;continue}for(s&=a===2?31:a===3?15:7;a>1&&r<n;)s=s<<6|e[r++]&63,a--;if(a>1){o[i++]=65533;continue}s<65536?o[i++]=s:(s-=65536,o[i++]=55296|s>>10&1023,o[i++]=56320|s&1023)}return BW(o,i)},MW=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+su[e[n]]>t?n:t},V1={string2buf:RW,buf2string:FW,utf8border:MW};function PW(){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}var OW=PW;const pd=16209,LW=16191;var NW=function(t,n){let r,i,o,s,a,l,c,u,f,h,d,p,m,b,g,y,v,w,S,E,k,M,D,B;const I=t.state;r=t.next_in,D=t.input,i=r+(t.avail_in-5),o=t.next_out,B=t.output,s=o-(n-t.avail_out),a=o+(t.avail_out-257),l=I.dmax,c=I.wsize,u=I.whave,f=I.wnext,h=I.window,d=I.hold,p=I.bits,m=I.lencode,b=I.distcode,g=(1<<I.lenbits)-1,y=(1<<I.distbits)-1;e:do{p<15&&(d+=D[r++]<<p,p+=8,d+=D[r++]<<p,p+=8),v=m[d&g];t:for(;;){if(w=v>>>24,d>>>=w,p-=w,w=v>>>16&255,w===0)B[o++]=v&65535;else if(w&16){S=v&65535,w&=15,w&&(p<w&&(d+=D[r++]<<p,p+=8),S+=d&(1<<w)-1,d>>>=w,p-=w),p<15&&(d+=D[r++]<<p,p+=8,d+=D[r++]<<p,p+=8),v=b[d&y];n:for(;;){if(w=v>>>24,d>>>=w,p-=w,w=v>>>16&255,w&16){if(E=v&65535,w&=15,p<w&&(d+=D[r++]<<p,p+=8,p<w&&(d+=D[r++]<<p,p+=8)),E+=d&(1<<w)-1,E>l){t.msg="invalid distance too far back",I.mode=pd;break e}if(d>>>=w,p-=w,w=o-s,E>w){if(w=E-w,w>u&&I.sane){t.msg="invalid distance too far back",I.mode=pd;break e}if(k=0,M=h,f===0){if(k+=c-w,w<S){S-=w;do B[o++]=h[k++];while(--w);k=o-E,M=B}}else if(f<w){if(k+=c+f-w,w-=f,w<S){S-=w;do B[o++]=h[k++];while(--w);if(k=0,f<S){w=f,S-=w;do B[o++]=h[k++];while(--w);k=o-E,M=B}}}else if(k+=f-w,w<S){S-=w;do B[o++]=h[k++];while(--w);k=o-E,M=B}for(;S>2;)B[o++]=M[k++],B[o++]=M[k++],B[o++]=M[k++],S-=3;S&&(B[o++]=M[k++],S>1&&(B[o++]=M[k++]))}else{k=o-E;do B[o++]=B[k++],B[o++]=B[k++],B[o++]=B[k++],S-=3;while(S>2);S&&(B[o++]=B[k++],S>1&&(B[o++]=B[k++]))}}else if(w&64){t.msg="invalid distance code",I.mode=pd;break e}else{v=b[(v&65535)+(d&(1<<w)-1)];continue n}break}}else if(w&64)if(w&32){I.mode=LW;break e}else{t.msg="invalid literal/length code",I.mode=pd;break e}else{v=m[(v&65535)+(d&(1<<w)-1)];continue t}break}}while(r<i&&o<a);S=p>>3,r-=S,p-=S<<3,d&=(1<<p)-1,t.next_in=r,t.next_out=o,t.avail_in=r<i?5+(i-r):5-(r-i),t.avail_out=o<a?257+(a-o):257-(o-a),I.hold=d,I.bits=p};const _a=15,VC=852,qC=592,$C=0,q1=1,WC=2,zW=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]),UW=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]),HW=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]),GW=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 au=(e,t,n,r,i,o,s,a)=>{const l=a.bits;let c=0,u=0,f=0,h=0,d=0,p=0,m=0,b=0,g=0,y=0,v,w,S,E,k,M=null,D;const B=new Uint16Array(_a+1),I=new Uint16Array(_a+1);let q=null,Z,ne,J;for(c=0;c<=_a;c++)B[c]=0;for(u=0;u<r;u++)B[t[n+u]]++;for(d=l,h=_a;h>=1&&B[h]===0;h--);if(d>h&&(d=h),h===0)return i[o++]=1<<24|64<<16|0,i[o++]=1<<24|64<<16|0,a.bits=1,0;for(f=1;f<h&&B[f]===0;f++);for(d<f&&(d=f),b=1,c=1;c<=_a;c++)if(b<<=1,b-=B[c],b<0)return-1;if(b>0&&(e===$C||h!==1))return-1;for(I[1]=0,c=1;c<_a;c++)I[c+1]=I[c]+B[c];for(u=0;u<r;u++)t[n+u]!==0&&(s[I[t[n+u]]++]=u);if(e===$C?(M=q=s,D=20):e===q1?(M=zW,q=UW,D=257):(M=HW,q=GW,D=0),y=0,u=0,c=f,k=o,p=d,m=0,S=-1,g=1<<d,E=g-1,e===q1&&g>VC||e===WC&&g>qC)return 1;for(;;){Z=c-m,s[u]+1<D?(ne=0,J=s[u]):s[u]>=D?(ne=q[s[u]-D],J=M[s[u]-D]):(ne=96,J=0),v=1<<c-m,w=1<<p,f=w;do w-=v,i[k+(y>>m)+w]=Z<<24|ne<<16|J|0;while(w!==0);for(v=1<<c-1;y&v;)v>>=1;if(v!==0?(y&=v-1,y+=v):y=0,u++,--B[c]===0){if(c===h)break;c=t[n+s[u]]}if(c>d&&(y&E)!==S){for(m===0&&(m=d),k+=f,p=c-m,b=1<<p;p+m<h&&(b-=B[p+m],!(b<=0));)p++,b<<=1;if(g+=1<<p,e===q1&&g>VC||e===WC&&g>qC)return 1;S=y&E,i[S]=d<<24|p<<16|k-o|0}}return y!==0&&(i[k+y]=c-m<<24|64<<16|0),a.bits=d,0};const jW=0,YC=1,QC=2,{Z_FINISH:ZC,Z_BLOCK:VW,Z_TREES:gd,Z_OK:ds,Z_STREAM_END:qW,Z_NEED_DICT:$W,Z_STREAM_ERROR:Yn,Z_DATA_ERROR:XC,Z_MEM_ERROR:KC,Z_BUF_ERROR:WW,Z_DEFLATED:JC}=HC,md=16180,e6=16181,t6=16182,n6=16183,r6=16184,i6=16185,o6=16186,s6=16187,a6=16188,l6=16189,bd=16190,si=16191,$1=16192,c6=16193,W1=16194,u6=16195,f6=16196,h6=16197,d6=16198,yd=16199,wd=16200,p6=16201,g6=16202,m6=16203,b6=16204,y6=16205,Y1=16206,w6=16207,v6=16208,yt=16209,x6=16210,A6=16211,YW=852,QW=592,ZW=15,E6=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function XW(){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 ps=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<md||t.mode>A6?1:0},S6=e=>{if(ps(e))return Yn;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=md,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(YW),t.distcode=t.distdyn=new Int32Array(QW),t.sane=1,t.back=-1,ds},C6=e=>{if(ps(e))return Yn;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,S6(e)},k6=(e,t)=>{let n;if(ps(e))return Yn;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Yn:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,C6(e))},T6=(e,t)=>{if(!e)return Yn;const n=new XW;e.state=n,n.strm=e,n.window=null,n.mode=md;const r=k6(e,t);return r!==ds&&(e.state=null),r},KW=e=>T6(e,ZW);let I6=!0,Q1,Z1;const JW=e=>{if(I6){Q1=new Int32Array(512),Z1=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(au(YC,e.lens,0,288,Q1,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;au(QC,e.lens,0,32,Z1,0,e.work,{bits:5}),I6=!1}e.lencode=Q1,e.lenbits=9,e.distcode=Z1,e.distbits=5},_6=(e,t,n,r)=>{let i;const o=e.state;return o.window===null&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),r>=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(t.subarray(n-r,n-r+i),o.wnext),r-=i,r?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0},eY=(e,t)=>{let n,r,i,o,s,a,l,c,u,f,h,d,p,m,b=0,g,y,v,w,S,E,k,M;const D=new Uint8Array(4);let B,I;const q=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ps(e)||!e.output||!e.input&&e.avail_in!==0)return Yn;n=e.state,n.mode===si&&(n.mode=$1),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,a=e.avail_in,c=n.hold,u=n.bits,f=a,h=l,M=ds;e:for(;;)switch(n.mode){case md:if(n.wrap===0){n.mode=$1;break}for(;u<16;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(n.wrap&2&&c===35615){n.wbits===0&&(n.wbits=15),n.check=0,D[0]=c&255,D[1]=c>>>8&255,n.check=Nr(n.check,D,2,0),c=0,u=0,n.mode=e6;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((c&255)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=yt;break}if((c&15)!==JC){e.msg="unknown compression method",n.mode=yt;break}if(c>>>=4,u-=4,k=(c&15)+8,n.wbits===0&&(n.wbits=k),k>15||k>n.wbits){e.msg="invalid window size",n.mode=yt;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=c&512?l6:si,c=0,u=0;break;case e6:for(;u<16;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(n.flags=c,(n.flags&255)!==JC){e.msg="unknown compression method",n.mode=yt;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=yt;break}n.head&&(n.head.text=c>>8&1),n.flags&512&&n.wrap&4&&(D[0]=c&255,D[1]=c>>>8&255,n.check=Nr(n.check,D,2,0)),c=0,u=0,n.mode=t6;case t6:for(;u<32;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}n.head&&(n.head.time=c),n.flags&512&&n.wrap&4&&(D[0]=c&255,D[1]=c>>>8&255,D[2]=c>>>16&255,D[3]=c>>>24&255,n.check=Nr(n.check,D,4,0)),c=0,u=0,n.mode=n6;case n6:for(;u<16;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}n.head&&(n.head.xflags=c&255,n.head.os=c>>8),n.flags&512&&n.wrap&4&&(D[0]=c&255,D[1]=c>>>8&255,n.check=Nr(n.check,D,2,0)),c=0,u=0,n.mode=r6;case r6:if(n.flags&1024){for(;u<16;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}n.length=c,n.head&&(n.head.extra_len=c),n.flags&512&&n.wrap&4&&(D[0]=c&255,D[1]=c>>>8&255,n.check=Nr(n.check,D,2,0)),c=0,u=0}else n.head&&(n.head.extra=null);n.mode=i6;case i6:if(n.flags&1024&&(d=n.length,d>a&&(d=a),d&&(n.head&&(k=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+d),k)),n.flags&512&&n.wrap&4&&(n.check=Nr(n.check,r,d,o)),a-=d,o+=d,n.length-=d),n.length))break e;n.length=0,n.mode=o6;case o6:if(n.flags&2048){if(a===0)break e;d=0;do k=r[o+d++],n.head&&k&&n.length<65536&&(n.head.name+=String.fromCharCode(k));while(k&&d<a);if(n.flags&512&&n.wrap&4&&(n.check=Nr(n.check,r,d,o)),a-=d,o+=d,k)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=s6;case s6:if(n.flags&4096){if(a===0)break e;d=0;do k=r[o+d++],n.head&&k&&n.length<65536&&(n.head.comment+=String.fromCharCode(k));while(k&&d<a);if(n.flags&512&&n.wrap&4&&(n.check=Nr(n.check,r,d,o)),a-=d,o+=d,k)break e}else n.head&&(n.head.comment=null);n.mode=a6;case a6:if(n.flags&512){for(;u<16;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(n.wrap&4&&c!==(n.check&65535)){e.msg="header crc mismatch",n.mode=yt;break}c=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=si;break;case l6:for(;u<32;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}e.adler=n.check=E6(c),c=0,u=0,n.mode=bd;case bd:if(n.havedict===0)return e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,n.hold=c,n.bits=u,$W;e.adler=n.check=1,n.mode=si;case si:if(t===VW||t===gd)break e;case $1:if(n.last){c>>>=u&7,u-=u&7,n.mode=Y1;break}for(;u<3;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}switch(n.last=c&1,c>>>=1,u-=1,c&3){case 0:n.mode=c6;break;case 1:if(JW(n),n.mode=yd,t===gd){c>>>=2,u-=2;break e}break;case 2:n.mode=f6;break;case 3:e.msg="invalid block type",n.mode=yt}c>>>=2,u-=2;break;case c6:for(c>>>=u&7,u-=u&7;u<32;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){e.msg="invalid stored block lengths",n.mode=yt;break}if(n.length=c&65535,c=0,u=0,n.mode=W1,t===gd)break e;case W1:n.mode=u6;case u6:if(d=n.length,d){if(d>a&&(d=a),d>l&&(d=l),d===0)break e;i.set(r.subarray(o,o+d),s),a-=d,o+=d,l-=d,s+=d,n.length-=d;break}n.mode=si;break;case f6:for(;u<14;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(n.nlen=(c&31)+257,c>>>=5,u-=5,n.ndist=(c&31)+1,c>>>=5,u-=5,n.ncode=(c&15)+4,c>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=yt;break}n.have=0,n.mode=h6;case h6:for(;n.have<n.ncode;){for(;u<3;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}n.lens[q[n.have++]]=c&7,c>>>=3,u-=3}for(;n.have<19;)n.lens[q[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,B={bits:n.lenbits},M=au(jW,n.lens,0,19,n.lencode,0,n.work,B),n.lenbits=B.bits,M){e.msg="invalid code lengths set",n.mode=yt;break}n.have=0,n.mode=d6;case d6:for(;n.have<n.nlen+n.ndist;){for(;b=n.lencode[c&(1<<n.lenbits)-1],g=b>>>24,y=b>>>16&255,v=b&65535,!(g<=u);){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(v<16)c>>>=g,u-=g,n.lens[n.have++]=v;else{if(v===16){for(I=g+2;u<I;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(c>>>=g,u-=g,n.have===0){e.msg="invalid bit length repeat",n.mode=yt;break}k=n.lens[n.have-1],d=3+(c&3),c>>>=2,u-=2}else if(v===17){for(I=g+3;u<I;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}c>>>=g,u-=g,k=0,d=3+(c&7),c>>>=3,u-=3}else{for(I=g+7;u<I;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}c>>>=g,u-=g,k=0,d=11+(c&127),c>>>=7,u-=7}if(n.have+d>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=yt;break}for(;d--;)n.lens[n.have++]=k}}if(n.mode===yt)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=yt;break}if(n.lenbits=9,B={bits:n.lenbits},M=au(YC,n.lens,0,n.nlen,n.lencode,0,n.work,B),n.lenbits=B.bits,M){e.msg="invalid literal/lengths set",n.mode=yt;break}if(n.distbits=6,n.distcode=n.distdyn,B={bits:n.distbits},M=au(QC,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,B),n.distbits=B.bits,M){e.msg="invalid distances set",n.mode=yt;break}if(n.mode=yd,t===gd)break e;case yd:n.mode=wd;case wd:if(a>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,n.hold=c,n.bits=u,NW(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,a=e.avail_in,c=n.hold,u=n.bits,n.mode===si&&(n.back=-1);break}for(n.back=0;b=n.lencode[c&(1<<n.lenbits)-1],g=b>>>24,y=b>>>16&255,v=b&65535,!(g<=u);){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(y&&!(y&240)){for(w=g,S=y,E=v;b=n.lencode[E+((c&(1<<w+S)-1)>>w)],g=b>>>24,y=b>>>16&255,v=b&65535,!(w+g<=u);){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}c>>>=w,u-=w,n.back+=w}if(c>>>=g,u-=g,n.back+=g,n.length=v,y===0){n.mode=y6;break}if(y&32){n.back=-1,n.mode=si;break}if(y&64){e.msg="invalid literal/length code",n.mode=yt;break}n.extra=y&15,n.mode=p6;case p6:if(n.extra){for(I=n.extra;u<I;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=g6;case g6:for(;b=n.distcode[c&(1<<n.distbits)-1],g=b>>>24,y=b>>>16&255,v=b&65535,!(g<=u);){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(!(y&240)){for(w=g,S=y,E=v;b=n.distcode[E+((c&(1<<w+S)-1)>>w)],g=b>>>24,y=b>>>16&255,v=b&65535,!(w+g<=u);){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}c>>>=w,u-=w,n.back+=w}if(c>>>=g,u-=g,n.back+=g,y&64){e.msg="invalid distance code",n.mode=yt;break}n.offset=v,n.extra=y&15,n.mode=m6;case m6:if(n.extra){for(I=n.extra;u<I;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=yt;break}n.mode=b6;case b6:if(l===0)break e;if(d=h-l,n.offset>d){if(d=n.offset-d,d>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=yt;break}d>n.wnext?(d-=n.wnext,p=n.wsize-d):p=n.wnext-d,d>n.length&&(d=n.length),m=n.window}else m=i,p=s-n.offset,d=n.length;d>l&&(d=l),l-=d,n.length-=d;do i[s++]=m[p++];while(--d);n.length===0&&(n.mode=wd);break;case y6:if(l===0)break e;i[s++]=n.length,l--,n.mode=wd;break;case Y1:if(n.wrap){for(;u<32;){if(a===0)break e;a--,c|=r[o++]<<u,u+=8}if(h-=l,e.total_out+=h,n.total+=h,n.wrap&4&&h&&(e.adler=n.check=n.flags?Nr(n.check,i,h,s-h):G1(n.check,i,h,s-h)),h=l,n.wrap&4&&(n.flags?c:E6(c))!==n.check){e.msg="incorrect data check",n.mode=yt;break}c=0,u=0}n.mode=w6;case w6:if(n.wrap&&n.flags){for(;u<32;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(n.wrap&4&&c!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=yt;break}c=0,u=0}n.mode=v6;case v6:M=qW;break e;case yt:M=XC;break e;case x6:return KC;case A6:default:return Yn}return e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,n.hold=c,n.bits=u,(n.wsize||h!==e.avail_out&&n.mode<yt&&(n.mode<Y1||t!==ZC))&&_6(e,e.output,e.next_out,h-e.avail_out),f-=e.avail_in,h-=e.avail_out,e.total_in+=f,e.total_out+=h,n.total+=h,n.wrap&4&&h&&(e.adler=n.check=n.flags?Nr(n.check,i,h,e.next_out-h):G1(n.check,i,h,e.next_out-h)),e.data_type=n.bits+(n.last?64:0)+(n.mode===si?128:0)+(n.mode===yd||n.mode===W1?256:0),(f===0&&h===0||t===ZC)&&M===ds&&(M=WW),M},tY=e=>{if(ps(e))return Yn;let t=e.state;return t.window&&(t.window=null),e.state=null,ds},nY=(e,t)=>{if(ps(e))return Yn;const n=e.state;return n.wrap&2?(n.head=t,t.done=!1,ds):Yn},rY=(e,t)=>{const n=t.length;let r,i,o;return ps(e)||(r=e.state,r.wrap!==0&&r.mode!==bd)?Yn:r.mode===bd&&(i=1,i=G1(i,t,n,0),i!==r.check)?XC:(o=_6(e,t,n,n),o?(r.mode=x6,KC):(r.havedict=1,ds))};var iY=C6,oY=k6,sY=S6,aY=KW,lY=T6,cY=eY,uY=tY,fY=nY,hY=rY,dY="pako inflate (from Nodeca project)",ai={inflateReset:iY,inflateReset2:oY,inflateResetKeep:sY,inflateInit:aY,inflateInit2:lY,inflate:cY,inflateEnd:uY,inflateGetHeader:fY,inflateSetDictionary:hY,inflateInfo:dY};function pY(){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}var gY=pY;const D6=Object.prototype.toString,{Z_NO_FLUSH:mY,Z_FINISH:bY,Z_OK:lu,Z_STREAM_END:X1,Z_NEED_DICT:K1,Z_STREAM_ERROR:yY,Z_DATA_ERROR:R6,Z_MEM_ERROR:wY}=HC;function vd(e){this.options=GC.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new OW,this.strm.avail_out=0;let n=ai.inflateInit2(this.strm,t.windowBits);if(n!==lu)throw new Error(j1[n]);if(this.header=new gY,ai.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=V1.string2buf(t.dictionary):D6.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=ai.inflateSetDictionary(this.strm,t.dictionary),n!==lu)))throw new Error(j1[n])}vd.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?bY:mY,D6.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=ai.inflate(n,s),o===K1&&i&&(o=ai.inflateSetDictionary(n,i),o===lu?o=ai.inflate(n,s):o===R6&&(o=K1));n.avail_in>0&&o===X1&&n.state.wrap>0&&e[n.next_in]!==0;)ai.inflateReset(n),o=ai.inflate(n,s);switch(o){case yY:case R6:case K1:case wY:return this.onEnd(o),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(n.avail_out===0||o===X1))if(this.options.to==="string"){let l=V1.utf8border(n.output,n.next_out),c=n.next_out-l,u=V1.buf2string(n.output,l);n.next_out=c,n.avail_out=r-c,c&&n.output.set(n.output.subarray(l,l+c),0),this.onData(u)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(o===lu&&a===0)){if(o===X1)return o=ai.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},vd.prototype.onData=function(e){this.chunks.push(e)},vd.prototype.onEnd=function(e){e===lu&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=GC.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function vY(e,t){const n=new vd(t);if(n.push(e),n.err)throw n.msg||j1[n.err];return n.result}function xY(e,t){return t=t||{},t.raw=!0,vY(e,t)}var AY=xY,EY={inflateRaw:AY};const{inflateRaw:SY}=EY;var CY=SY;function kY(e){return CY(e.subarray(2))}let TY=class extends Error{constructor(t){super(t),this.code="ERR_ABORTED"}};function IY(e){e.sort((i,o)=>i.offset-o.offset);const t=[];let n,r;for(const i of e)n&&r&&i.offset-r<=2e3?(n.length=n.length+i.length-r+i.offset,n.blocks.push(i)):t.push(n={blocks:[i],length:i.length,offset:i.offset}),r=n.offset+n.length;return t}function xd(e){if(e&&e.aborted)if(typeof DOMException>"u"){const t=new TY("aborted");throw t.code="ERR_ABORTED",t}else throw new DOMException("aborted","AbortError")}const J1=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function eb(e,t,n,r){return e<r&&t>=n}class B6{constructor(t,n,r,i,o,s){if(this.bbi=t,this.refsByName=n,this.cirTreeOffset=r,this.isBigEndian=i,this.isCompressed=o,this.blockType=s,this.featureCache=new hs({cache:new dd({maxSize:1e3}),fill:async(a,l)=>{const c=a.length,u=a.offset,{buffer:f}=await this.bbi.read(ot.Buffer.alloc(c),0,c,u,{signal:l});return f}}),!(r>=0))throw new Error("invalid cirTreeOffset!")}async readWigData(t,n,r,i,o){try{const{refsByName:s,bbi:a,cirTreeOffset:l,isBigEndian:c}=this,u=s[t];u===void 0&&i.complete();const f={chrId:u,start:n,end:r};this.cirTreePromise||(this.cirTreePromise=a.read(ot.Buffer.alloc(48),0,48,l,o));const{buffer:h}=await this.cirTreePromise,d=c?h.readUInt32BE(4):h.readUInt32LE(4);let p=[],m=0;const b=!0,g=(S,E,k)=>{try{const D=S.subarray(E),B=new DataView(D.buffer,D.byteOffset,D.length);let I=0;const q=B.getUint8(I);I+=2;const Z=B.getUint16(I,b);if(I+=2,q===1){const ne=[];for(let J=0;J<Z;J++){const ce=B.getUint32(I,b);I+=4;const ae=B.getUint32(I,b);I+=4;const we=B.getUint32(I,b);I+=4;const me=B.getUint32(I,b);I+=4;const U=Number(B.getBigUint64(I,b));I+=8;const Ae=Number(B.getBigUint64(I,b));I+=8,ne.push({startChrom:ce,startBase:ae,endBase:me,endChrom:we,blockOffset:U,blockSize:Ae,offset:I})}p=p.concat(ne.filter(J=>y(J)).map(J=>({offset:J.blockOffset,length:J.blockSize})))}else if(q===0){const ne=[];for(let ce=0;ce<Z;ce++){const ae=B.getUint32(I,b);I+=4;const we=B.getUint32(I,b);I+=4;const me=B.getUint32(I,b);I+=4;const U=B.getUint32(I,b);I+=4;const Ae=Number(B.getBigUint64(I,b));I+=8,ne.push({startChrom:ae,startBase:we,endChrom:me,endBase:U,blockOffset:Ae,offset:I})}const J=ne.filter(ce=>y(ce)).map(ce=>ce.blockOffset);J.length>0&&w(J,k+1)}}catch(M){i.error(M)}},y=S=>{const{startChrom:E,startBase:k,endChrom:M,endBase:D}=S;return(E<u||E===u&&k<=r)&&(M>u||M===u&&D>=n)},v=async(S,E,k)=>{try{const M=E.max-E.min,D=E.min,B=await this.featureCache.get(`${M}_${D}`,{length:M,offset:D},o==null?void 0:o.signal);for(const I of S)E.contains(I)&&(g(B,I-D,k),m-=1,m===0&&this.readFeatures(i,p,{...o,request:f}).catch(q=>{i.error(q)}))}catch(M){i.error(M)}},w=(S,E)=>{try{m+=S.length;const k=4+d*32;let M=new Ta([{min:S[0],max:S[0]+k}]);for(let D=1;D<S.length;D+=1){const B=new Ta([{min:S[D],max:S[D]+k}]);M=M.union(B)}M.getRanges().map(D=>v(S,D,E))}catch(k){i.error(k)}};w([Number(l)+48],1);return}catch(s){i.error(s)}}parseSummaryBlock(t,n,r){const i=[];let o=n;const s=new DataView(t.buffer,t.byteOffset,t.length);for(;o<t.byteLength;){const a=s.getUint32(o,!0);o+=4;const l=s.getUint32(o,!0);o+=4;const c=s.getUint32(o,!0);o+=4;const u=s.getUint32(o,!0);o+=4;const f=s.getFloat32(o,!0);o+=4;const h=s.getFloat32(o,!0);o+=4;const d=s.getFloat32(o,!0);o+=4,o+=4,(!r||a===r.chrId&&eb(l,c,r.start,r.end))&&i.push({start:l,end:c,maxScore:h,minScore:f,summary:!0,score:d/(u||1)})}return i}parseBigBedBlock(t,n,r,i){var o;const s=[];let a=n;const l=!0,c=t,u=new DataView(c.buffer,c.byteOffset,c.length);for(;a<t.byteLength;){const f=a,h=u.getUint32(a,l);a+=4;const d=u.getInt32(a,l);a+=4;const p=u.getInt32(a,l);a+=4;let m=a;for(;m<t.length&&t[m]!==0;m++);const b=t.subarray(a,m),g=(o=J1==null?void 0:J1.decode(b))!==null&&o!==void 0?o:b.toString();a=m+1,s.push({chromId:h,start:d,end:p,rest:g,uniqueId:`bb-${r+f}`})}return i?s.filter(f=>eb(f.start,f.end,i.start,i.end)):s}parseBigWigBlock(t,n,r){const i=t.subarray(n),o=new DataView(i.buffer,i.byteOffset,i.length);let s=0;s+=4;const a=o.getInt32(s,!0);s+=8;const l=o.getUint32(s,!0);s+=4;const c=o.getUint32(s,!0);s+=4;const u=o.getUint8(s);s+=2;const f=o.getUint16(s,!0);s+=2;const h=new Array(f);switch(u){case 1:{for(let d=0;d<f;d++){const p=o.getInt32(s,!0);s+=4;const m=o.getInt32(s,!0);s+=4;const b=o.getFloat32(s,!0);s+=4,h[d]={start:p,end:m,score:b}}break}case 2:{for(let d=0;d<f;d++){const p=o.getInt32(s,!0);s+=4;const m=o.getFloat32(s,!0);s+=4,h[d]={score:m,start:p,end:p+c}}break}case 3:{for(let d=0;d<f;d++){const p=o.getFloat32(s,!0);s+=4;const m=a+d*l;h[d]={score:p,start:m,end:m+c}}break}}return r?h.filter(d=>eb(d.start,d.end,r.start,r.end)):h}async readFeatures(t,n,r={}){try{const{blockType:i,isCompressed:o}=this,{signal:s,request:a}=r,l=IY(n);xd(s),await Promise.all(l.map(async c=>{xd(s);const{length:u,offset:f}=c,h=await this.featureCache.get(`${u}_${f}`,c,s);for(const d of c.blocks){xd(s);let p=Number(d.offset)-Number(c.offset),m=h;switch(o&&(m=kY(h.subarray(p)),p=0),xd(s),i){case"summary":{t.next(this.parseSummaryBlock(m,p,a));break}case"bigwig":{t.next(this.parseBigWigBlock(m,p,a));break}case"bigbed":{t.next(this.parseBigBedBlock(m,p,Number(d.offset)*256,a));break}default:console.warn(`Don't know what to do with ${i}`)}}})),t.complete()}catch(i){t.error(i)}}}var tb=function(e,t){return tb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},tb(e,t)};function nb(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");tb(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function _Y(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(u){try{c(r.next(u))}catch(f){s(f)}}function l(u){try{c(r.throw(u))}catch(f){s(f)}}function c(u){u.done?o(u.value):i(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})}function F6(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(u){return l([c,u])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){n.label=c[1];break}if(c[0]===6&&n.label<o[1]){n.label=o[1],o=c;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(c);break}o[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(u){c=[6,u],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function cu(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function rb(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function ib(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function Da(e){return this instanceof Da?(this.v=e,this):new Da(e)}function DY(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(d){return function(p){return Promise.resolve(p).then(d,f)}}function a(d,p){r[d]&&(i[d]=function(m){return new Promise(function(b,g){o.push([d,m,b,g])>1||l(d,m)})},p&&(i[d]=p(i[d])))}function l(d,p){try{c(r[d](p))}catch(m){h(o[0][3],m)}}function c(d){d.value instanceof Da?Promise.resolve(d.value.v).then(u,f):h(o[0][2],d)}function u(d){l("next",d)}function f(d){l("throw",d)}function h(d,p){d(p),o.shift(),o.length&&l(o[0][0],o[0][1])}}function RY(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof cu=="function"?cu(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(s){return new Promise(function(a,l){s=e[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}}typeof SuppressedError=="function"&&SuppressedError;function Lt(e){return typeof e=="function"}function M6(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var ob=M6(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription:
3761
+ */var sC;function iu(){return sC||(sC=1,function(e){const t=U$(),n=H$(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=y,e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=o(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{const F=new Uint8Array(1),A={foo:function(){return 42}};return Object.setPrototypeOf(A,Uint8Array.prototype),Object.setPrototypeOf(F,A),F.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function s(F){if(F>i)throw new RangeError('The value "'+F+'" is invalid for option "size"');const A=new Uint8Array(F);return Object.setPrototypeOf(A,a.prototype),A}function a(F,A,C){if(typeof F=="number"){if(typeof A=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(F)}return l(F,A,C)}a.poolSize=8192;function l(F,A,C){if(typeof F=="string")return h(F,A);if(ArrayBuffer.isView(F))return p(F);if(F==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof F);if(nt(F,ArrayBuffer)||F&&nt(F.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(nt(F,SharedArrayBuffer)||F&&nt(F.buffer,SharedArrayBuffer)))return m(F,A,C);if(typeof F=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const z=F.valueOf&&F.valueOf();if(z!=null&&z!==F)return a.from(z,A,C);const T=b(F);if(T)return T;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof F[Symbol.toPrimitive]=="function")return a.from(F[Symbol.toPrimitive]("string"),A,C);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof F)}a.from=function(F,A,C){return l(F,A,C)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function c(F){if(typeof F!="number")throw new TypeError('"size" argument must be of type number');if(F<0)throw new RangeError('The value "'+F+'" is invalid for option "size"')}function u(F,A,C){return c(F),F<=0?s(F):A!==void 0?typeof C=="string"?s(F).fill(A,C):s(F).fill(A):s(F)}a.alloc=function(F,A,C){return u(F,A,C)};function f(F){return c(F),s(F<0?0:g(F)|0)}a.allocUnsafe=function(F){return f(F)},a.allocUnsafeSlow=function(F){return f(F)};function h(F,A){if((typeof A!="string"||A==="")&&(A="utf8"),!a.isEncoding(A))throw new TypeError("Unknown encoding: "+A);const C=v(F,A)|0;let z=s(C);const T=z.write(F,A);return T!==C&&(z=z.slice(0,T)),z}function d(F){const A=F.length<0?0:g(F.length)|0,C=s(A);for(let z=0;z<A;z+=1)C[z]=F[z]&255;return C}function p(F){if(nt(F,Uint8Array)){const A=new Uint8Array(F);return m(A.buffer,A.byteOffset,A.byteLength)}return d(F)}function m(F,A,C){if(A<0||F.byteLength<A)throw new RangeError('"offset" is outside of buffer bounds');if(F.byteLength<A+(C||0))throw new RangeError('"length" is outside of buffer bounds');let z;return A===void 0&&C===void 0?z=new Uint8Array(F):C===void 0?z=new Uint8Array(F,A):z=new Uint8Array(F,A,C),Object.setPrototypeOf(z,a.prototype),z}function b(F){if(a.isBuffer(F)){const A=g(F.length)|0,C=s(A);return C.length===0||F.copy(C,0,0,A),C}if(F.length!==void 0)return typeof F.length!="number"||Nt(F.length)?s(0):d(F);if(F.type==="Buffer"&&Array.isArray(F.data))return d(F.data)}function g(F){if(F>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return F|0}function y(F){return+F!=F&&(F=0),a.alloc(+F)}a.isBuffer=function(A){return A!=null&&A._isBuffer===!0&&A!==a.prototype},a.compare=function(A,C){if(nt(A,Uint8Array)&&(A=a.from(A,A.offset,A.byteLength)),nt(C,Uint8Array)&&(C=a.from(C,C.offset,C.byteLength)),!a.isBuffer(A)||!a.isBuffer(C))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(A===C)return 0;let z=A.length,T=C.length;for(let G=0,Y=Math.min(z,T);G<Y;++G)if(A[G]!==C[G]){z=A[G],T=C[G];break}return z<T?-1:T<z?1:0},a.isEncoding=function(A){switch(String(A).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(A,C){if(!Array.isArray(A))throw new TypeError('"list" argument must be an Array of Buffers');if(A.length===0)return a.alloc(0);let z;if(C===void 0)for(C=0,z=0;z<A.length;++z)C+=A[z].length;const T=a.allocUnsafe(C);let G=0;for(z=0;z<A.length;++z){let Y=A[z];if(nt(Y,Uint8Array))G+Y.length>T.length?(a.isBuffer(Y)||(Y=a.from(Y)),Y.copy(T,G)):Uint8Array.prototype.set.call(T,Y,G);else if(a.isBuffer(Y))Y.copy(T,G);else throw new TypeError('"list" argument must be an Array of Buffers');G+=Y.length}return T};function v(F,A){if(a.isBuffer(F))return F.length;if(ArrayBuffer.isView(F)||nt(F,ArrayBuffer))return F.byteLength;if(typeof F!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof F);const C=F.length,z=arguments.length>2&&arguments[2]===!0;if(!z&&C===0)return 0;let T=!1;for(;;)switch(A){case"ascii":case"latin1":case"binary":return C;case"utf8":case"utf-8":return Ie(F).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C*2;case"hex":return C>>>1;case"base64":return hn(F).length;default:if(T)return z?-1:Ie(F).length;A=(""+A).toLowerCase(),T=!0}}a.byteLength=v;function w(F,A,C){let z=!1;if((A===void 0||A<0)&&(A=0),A>this.length||((C===void 0||C>this.length)&&(C=this.length),C<=0)||(C>>>=0,A>>>=0,C<=A))return"";for(F||(F="utf8");;)switch(F){case"hex":return me(this,A,C);case"utf8":case"utf-8":return te(this,A,C);case"ascii":return ae(this,A,C);case"latin1":case"binary":return we(this,A,C);case"base64":return Z(this,A,C);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,A,C);default:if(z)throw new TypeError("Unknown encoding: "+F);F=(F+"").toLowerCase(),z=!0}}a.prototype._isBuffer=!0;function S(F,A,C){const z=F[A];F[A]=F[C],F[C]=z}a.prototype.swap16=function(){const A=this.length;if(A%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let C=0;C<A;C+=2)S(this,C,C+1);return this},a.prototype.swap32=function(){const A=this.length;if(A%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let C=0;C<A;C+=4)S(this,C,C+3),S(this,C+1,C+2);return this},a.prototype.swap64=function(){const A=this.length;if(A%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let C=0;C<A;C+=8)S(this,C,C+7),S(this,C+1,C+6),S(this,C+2,C+5),S(this,C+3,C+4);return this},a.prototype.toString=function(){const A=this.length;return A===0?"":arguments.length===0?te(this,0,A):w.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(A){if(!a.isBuffer(A))throw new TypeError("Argument must be a Buffer");return this===A?!0:a.compare(this,A)===0},a.prototype.inspect=function(){let A="";const C=e.INSPECT_MAX_BYTES;return A=this.toString("hex",0,C).replace(/(.{2})/g,"$1 ").trim(),this.length>C&&(A+=" ... "),"<Buffer "+A+">"},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(A,C,z,T,G){if(nt(A,Uint8Array)&&(A=a.from(A,A.offset,A.byteLength)),!a.isBuffer(A))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof A);if(C===void 0&&(C=0),z===void 0&&(z=A?A.length:0),T===void 0&&(T=0),G===void 0&&(G=this.length),C<0||z>A.length||T<0||G>this.length)throw new RangeError("out of range index");if(T>=G&&C>=z)return 0;if(T>=G)return-1;if(C>=z)return 1;if(C>>>=0,z>>>=0,T>>>=0,G>>>=0,this===A)return 0;let Y=G-T,ge=z-C;const $=Math.min(Y,ge),ee=this.slice(T,G),_=A.slice(C,z);for(let ue=0;ue<$;++ue)if(ee[ue]!==_[ue]){Y=ee[ue],ge=_[ue];break}return Y<ge?-1:ge<Y?1:0};function E(F,A,C,z,T){if(F.length===0)return-1;if(typeof C=="string"?(z=C,C=0):C>2147483647?C=2147483647:C<-2147483648&&(C=-2147483648),C=+C,Nt(C)&&(C=T?0:F.length-1),C<0&&(C=F.length+C),C>=F.length){if(T)return-1;C=F.length-1}else if(C<0)if(T)C=0;else return-1;if(typeof A=="string"&&(A=a.from(A,z)),a.isBuffer(A))return A.length===0?-1:k(F,A,C,z,T);if(typeof A=="number")return A=A&255,typeof Uint8Array.prototype.indexOf=="function"?T?Uint8Array.prototype.indexOf.call(F,A,C):Uint8Array.prototype.lastIndexOf.call(F,A,C):k(F,[A],C,z,T);throw new TypeError("val must be string, number or Buffer")}function k(F,A,C,z,T){let G=1,Y=F.length,ge=A.length;if(z!==void 0&&(z=String(z).toLowerCase(),z==="ucs2"||z==="ucs-2"||z==="utf16le"||z==="utf-16le")){if(F.length<2||A.length<2)return-1;G=2,Y/=2,ge/=2,C/=2}function $(_,ue){return G===1?_[ue]:_.readUInt16BE(ue*G)}let ee;if(T){let _=-1;for(ee=C;ee<Y;ee++)if($(F,ee)===$(A,_===-1?0:ee-_)){if(_===-1&&(_=ee),ee-_+1===ge)return _*G}else _!==-1&&(ee-=ee-_),_=-1}else for(C+ge>Y&&(C=Y-ge),ee=C;ee>=0;ee--){let _=!0;for(let ue=0;ue<ge;ue++)if($(F,ee+ue)!==$(A,ue)){_=!1;break}if(_)return ee}return-1}a.prototype.includes=function(A,C,z){return this.indexOf(A,C,z)!==-1},a.prototype.indexOf=function(A,C,z){return E(this,A,C,z,!0)},a.prototype.lastIndexOf=function(A,C,z){return E(this,A,C,z,!1)};function M(F,A,C,z){C=Number(C)||0;const T=F.length-C;z?(z=Number(z),z>T&&(z=T)):z=T;const G=A.length;z>G/2&&(z=G/2);let Y;for(Y=0;Y<z;++Y){const ge=parseInt(A.substr(Y*2,2),16);if(Nt(ge))return Y;F[C+Y]=ge}return Y}function D(F,A,C,z){return Bt(Ie(A,F.length-C),F,C,z)}function B(F,A,C,z){return Bt(Me(A),F,C,z)}function I(F,A,C,z){return Bt(hn(A),F,C,z)}function q(F,A,C,z){return Bt(wt(A,F.length-C),F,C,z)}a.prototype.write=function(A,C,z,T){if(C===void 0)T="utf8",z=this.length,C=0;else if(z===void 0&&typeof C=="string")T=C,z=this.length,C=0;else if(isFinite(C))C=C>>>0,isFinite(z)?(z=z>>>0,T===void 0&&(T="utf8")):(T=z,z=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const G=this.length-C;if((z===void 0||z>G)&&(z=G),A.length>0&&(z<0||C<0)||C>this.length)throw new RangeError("Attempt to write outside buffer bounds");T||(T="utf8");let Y=!1;for(;;)switch(T){case"hex":return M(this,A,C,z);case"utf8":case"utf-8":return D(this,A,C,z);case"ascii":case"latin1":case"binary":return B(this,A,C,z);case"base64":return I(this,A,C,z);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,A,C,z);default:if(Y)throw new TypeError("Unknown encoding: "+T);T=(""+T).toLowerCase(),Y=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Z(F,A,C){return A===0&&C===F.length?t.fromByteArray(F):t.fromByteArray(F.slice(A,C))}function te(F,A,C){C=Math.min(F.length,C);const z=[];let T=A;for(;T<C;){const G=F[T];let Y=null,ge=G>239?4:G>223?3:G>191?2:1;if(T+ge<=C){let $,ee,_,ue;switch(ge){case 1:G<128&&(Y=G);break;case 2:$=F[T+1],($&192)===128&&(ue=(G&31)<<6|$&63,ue>127&&(Y=ue));break;case 3:$=F[T+1],ee=F[T+2],($&192)===128&&(ee&192)===128&&(ue=(G&15)<<12|($&63)<<6|ee&63,ue>2047&&(ue<55296||ue>57343)&&(Y=ue));break;case 4:$=F[T+1],ee=F[T+2],_=F[T+3],($&192)===128&&(ee&192)===128&&(_&192)===128&&(ue=(G&15)<<18|($&63)<<12|(ee&63)<<6|_&63,ue>65535&&ue<1114112&&(Y=ue))}}Y===null?(Y=65533,ge=1):Y>65535&&(Y-=65536,z.push(Y>>>10&1023|55296),Y=56320|Y&1023),z.push(Y),T+=ge}return ce(z)}const J=4096;function ce(F){const A=F.length;if(A<=J)return String.fromCharCode.apply(String,F);let C="",z=0;for(;z<A;)C+=String.fromCharCode.apply(String,F.slice(z,z+=J));return C}function ae(F,A,C){let z="";C=Math.min(F.length,C);for(let T=A;T<C;++T)z+=String.fromCharCode(F[T]&127);return z}function we(F,A,C){let z="";C=Math.min(F.length,C);for(let T=A;T<C;++T)z+=String.fromCharCode(F[T]);return z}function me(F,A,C){const z=F.length;(!A||A<0)&&(A=0),(!C||C<0||C>z)&&(C=z);let T="";for(let G=A;G<C;++G)T+=Wt[F[G]];return T}function U(F,A,C){const z=F.slice(A,C);let T="";for(let G=0;G<z.length-1;G+=2)T+=String.fromCharCode(z[G]+z[G+1]*256);return T}a.prototype.slice=function(A,C){const z=this.length;A=~~A,C=C===void 0?z:~~C,A<0?(A+=z,A<0&&(A=0)):A>z&&(A=z),C<0?(C+=z,C<0&&(C=0)):C>z&&(C=z),C<A&&(C=A);const T=this.subarray(A,C);return Object.setPrototypeOf(T,a.prototype),T};function Ae(F,A,C){if(F%1!==0||F<0)throw new RangeError("offset is not uint");if(F+A>C)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(A,C,z){A=A>>>0,C=C>>>0,z||Ae(A,C,this.length);let T=this[A],G=1,Y=0;for(;++Y<C&&(G*=256);)T+=this[A+Y]*G;return T},a.prototype.readUintBE=a.prototype.readUIntBE=function(A,C,z){A=A>>>0,C=C>>>0,z||Ae(A,C,this.length);let T=this[A+--C],G=1;for(;C>0&&(G*=256);)T+=this[A+--C]*G;return T},a.prototype.readUint8=a.prototype.readUInt8=function(A,C){return A=A>>>0,C||Ae(A,1,this.length),this[A]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(A,C){return A=A>>>0,C||Ae(A,2,this.length),this[A]|this[A+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(A,C){return A=A>>>0,C||Ae(A,2,this.length),this[A]<<8|this[A+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(A,C){return A=A>>>0,C||Ae(A,4,this.length),(this[A]|this[A+1]<<8|this[A+2]<<16)+this[A+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(A,C){return A=A>>>0,C||Ae(A,4,this.length),this[A]*16777216+(this[A+1]<<16|this[A+2]<<8|this[A+3])},a.prototype.readBigUInt64LE=st(function(A){A=A>>>0,se(A,"offset");const C=this[A],z=this[A+7];(C===void 0||z===void 0)&&pe(A,this.length-8);const T=C+this[++A]*2**8+this[++A]*2**16+this[++A]*2**24,G=this[++A]+this[++A]*2**8+this[++A]*2**16+z*2**24;return BigInt(T)+(BigInt(G)<<BigInt(32))}),a.prototype.readBigUInt64BE=st(function(A){A=A>>>0,se(A,"offset");const C=this[A],z=this[A+7];(C===void 0||z===void 0)&&pe(A,this.length-8);const T=C*2**24+this[++A]*2**16+this[++A]*2**8+this[++A],G=this[++A]*2**24+this[++A]*2**16+this[++A]*2**8+z;return(BigInt(T)<<BigInt(32))+BigInt(G)}),a.prototype.readIntLE=function(A,C,z){A=A>>>0,C=C>>>0,z||Ae(A,C,this.length);let T=this[A],G=1,Y=0;for(;++Y<C&&(G*=256);)T+=this[A+Y]*G;return G*=128,T>=G&&(T-=Math.pow(2,8*C)),T},a.prototype.readIntBE=function(A,C,z){A=A>>>0,C=C>>>0,z||Ae(A,C,this.length);let T=C,G=1,Y=this[A+--T];for(;T>0&&(G*=256);)Y+=this[A+--T]*G;return G*=128,Y>=G&&(Y-=Math.pow(2,8*C)),Y},a.prototype.readInt8=function(A,C){return A=A>>>0,C||Ae(A,1,this.length),this[A]&128?(255-this[A]+1)*-1:this[A]},a.prototype.readInt16LE=function(A,C){A=A>>>0,C||Ae(A,2,this.length);const z=this[A]|this[A+1]<<8;return z&32768?z|4294901760:z},a.prototype.readInt16BE=function(A,C){A=A>>>0,C||Ae(A,2,this.length);const z=this[A+1]|this[A]<<8;return z&32768?z|4294901760:z},a.prototype.readInt32LE=function(A,C){return A=A>>>0,C||Ae(A,4,this.length),this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24},a.prototype.readInt32BE=function(A,C){return A=A>>>0,C||Ae(A,4,this.length),this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]},a.prototype.readBigInt64LE=st(function(A){A=A>>>0,se(A,"offset");const C=this[A],z=this[A+7];(C===void 0||z===void 0)&&pe(A,this.length-8);const T=this[A+4]+this[A+5]*2**8+this[A+6]*2**16+(z<<24);return(BigInt(T)<<BigInt(32))+BigInt(C+this[++A]*2**8+this[++A]*2**16+this[++A]*2**24)}),a.prototype.readBigInt64BE=st(function(A){A=A>>>0,se(A,"offset");const C=this[A],z=this[A+7];(C===void 0||z===void 0)&&pe(A,this.length-8);const T=(C<<24)+this[++A]*2**16+this[++A]*2**8+this[++A];return(BigInt(T)<<BigInt(32))+BigInt(this[++A]*2**24+this[++A]*2**16+this[++A]*2**8+z)}),a.prototype.readFloatLE=function(A,C){return A=A>>>0,C||Ae(A,4,this.length),n.read(this,A,!0,23,4)},a.prototype.readFloatBE=function(A,C){return A=A>>>0,C||Ae(A,4,this.length),n.read(this,A,!1,23,4)},a.prototype.readDoubleLE=function(A,C){return A=A>>>0,C||Ae(A,8,this.length),n.read(this,A,!0,52,8)},a.prototype.readDoubleBE=function(A,C){return A=A>>>0,C||Ae(A,8,this.length),n.read(this,A,!1,52,8)};function Ce(F,A,C,z,T,G){if(!a.isBuffer(F))throw new TypeError('"buffer" argument must be a Buffer instance');if(A>T||A<G)throw new RangeError('"value" argument is out of bounds');if(C+z>F.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(A,C,z,T){if(A=+A,C=C>>>0,z=z>>>0,!T){const ge=Math.pow(2,8*z)-1;Ce(this,A,C,z,ge,0)}let G=1,Y=0;for(this[C]=A&255;++Y<z&&(G*=256);)this[C+Y]=A/G&255;return C+z},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(A,C,z,T){if(A=+A,C=C>>>0,z=z>>>0,!T){const ge=Math.pow(2,8*z)-1;Ce(this,A,C,z,ge,0)}let G=z-1,Y=1;for(this[C+G]=A&255;--G>=0&&(Y*=256);)this[C+G]=A/Y&255;return C+z},a.prototype.writeUint8=a.prototype.writeUInt8=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,1,255,0),this[C]=A&255,C+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,2,65535,0),this[C]=A&255,this[C+1]=A>>>8,C+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,2,65535,0),this[C]=A>>>8,this[C+1]=A&255,C+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,4,4294967295,0),this[C+3]=A>>>24,this[C+2]=A>>>16,this[C+1]=A>>>8,this[C]=A&255,C+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,4,4294967295,0),this[C]=A>>>24,this[C+1]=A>>>16,this[C+2]=A>>>8,this[C+3]=A&255,C+4};function H(F,A,C,z,T){R(A,z,T,F,C,7);let G=Number(A&BigInt(4294967295));F[C++]=G,G=G>>8,F[C++]=G,G=G>>8,F[C++]=G,G=G>>8,F[C++]=G;let Y=Number(A>>BigInt(32)&BigInt(4294967295));return F[C++]=Y,Y=Y>>8,F[C++]=Y,Y=Y>>8,F[C++]=Y,Y=Y>>8,F[C++]=Y,C}function ze(F,A,C,z,T){R(A,z,T,F,C,7);let G=Number(A&BigInt(4294967295));F[C+7]=G,G=G>>8,F[C+6]=G,G=G>>8,F[C+5]=G,G=G>>8,F[C+4]=G;let Y=Number(A>>BigInt(32)&BigInt(4294967295));return F[C+3]=Y,Y=Y>>8,F[C+2]=Y,Y=Y>>8,F[C+1]=Y,Y=Y>>8,F[C]=Y,C+8}a.prototype.writeBigUInt64LE=st(function(A,C=0){return H(this,A,C,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=st(function(A,C=0){return ze(this,A,C,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(A,C,z,T){if(A=+A,C=C>>>0,!T){const $=Math.pow(2,8*z-1);Ce(this,A,C,z,$-1,-$)}let G=0,Y=1,ge=0;for(this[C]=A&255;++G<z&&(Y*=256);)A<0&&ge===0&&this[C+G-1]!==0&&(ge=1),this[C+G]=(A/Y>>0)-ge&255;return C+z},a.prototype.writeIntBE=function(A,C,z,T){if(A=+A,C=C>>>0,!T){const $=Math.pow(2,8*z-1);Ce(this,A,C,z,$-1,-$)}let G=z-1,Y=1,ge=0;for(this[C+G]=A&255;--G>=0&&(Y*=256);)A<0&&ge===0&&this[C+G+1]!==0&&(ge=1),this[C+G]=(A/Y>>0)-ge&255;return C+z},a.prototype.writeInt8=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,1,127,-128),A<0&&(A=255+A+1),this[C]=A&255,C+1},a.prototype.writeInt16LE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,2,32767,-32768),this[C]=A&255,this[C+1]=A>>>8,C+2},a.prototype.writeInt16BE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,2,32767,-32768),this[C]=A>>>8,this[C+1]=A&255,C+2},a.prototype.writeInt32LE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,4,2147483647,-2147483648),this[C]=A&255,this[C+1]=A>>>8,this[C+2]=A>>>16,this[C+3]=A>>>24,C+4},a.prototype.writeInt32BE=function(A,C,z){return A=+A,C=C>>>0,z||Ce(this,A,C,4,2147483647,-2147483648),A<0&&(A=4294967295+A+1),this[C]=A>>>24,this[C+1]=A>>>16,this[C+2]=A>>>8,this[C+3]=A&255,C+4},a.prototype.writeBigInt64LE=st(function(A,C=0){return H(this,A,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=st(function(A,C=0){return ze(this,A,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function qe(F,A,C,z,T,G){if(C+z>F.length)throw new RangeError("Index out of range");if(C<0)throw new RangeError("Index out of range")}function Q(F,A,C,z,T){return A=+A,C=C>>>0,T||qe(F,A,C,4),n.write(F,A,C,z,23,4),C+4}a.prototype.writeFloatLE=function(A,C,z){return Q(this,A,C,!0,z)},a.prototype.writeFloatBE=function(A,C,z){return Q(this,A,C,!1,z)};function X(F,A,C,z,T){return A=+A,C=C>>>0,T||qe(F,A,C,8),n.write(F,A,C,z,52,8),C+8}a.prototype.writeDoubleLE=function(A,C,z){return X(this,A,C,!0,z)},a.prototype.writeDoubleBE=function(A,C,z){return X(this,A,C,!1,z)},a.prototype.copy=function(A,C,z,T){if(!a.isBuffer(A))throw new TypeError("argument should be a Buffer");if(z||(z=0),!T&&T!==0&&(T=this.length),C>=A.length&&(C=A.length),C||(C=0),T>0&&T<z&&(T=z),T===z||A.length===0||this.length===0)return 0;if(C<0)throw new RangeError("targetStart out of bounds");if(z<0||z>=this.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("sourceEnd out of bounds");T>this.length&&(T=this.length),A.length-C<T-z&&(T=A.length-C+z);const G=T-z;return this===A&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(C,z,T):Uint8Array.prototype.set.call(A,this.subarray(z,T),C),G},a.prototype.fill=function(A,C,z,T){if(typeof A=="string"){if(typeof C=="string"?(T=C,C=0,z=this.length):typeof z=="string"&&(T=z,z=this.length),T!==void 0&&typeof T!="string")throw new TypeError("encoding must be a string");if(typeof T=="string"&&!a.isEncoding(T))throw new TypeError("Unknown encoding: "+T);if(A.length===1){const Y=A.charCodeAt(0);(T==="utf8"&&Y<128||T==="latin1")&&(A=Y)}}else typeof A=="number"?A=A&255:typeof A=="boolean"&&(A=Number(A));if(C<0||this.length<C||this.length<z)throw new RangeError("Out of range index");if(z<=C)return this;C=C>>>0,z=z===void 0?this.length:z>>>0,A||(A=0);let G;if(typeof A=="number")for(G=C;G<z;++G)this[G]=A;else{const Y=a.isBuffer(A)?A:a.from(A,T),ge=Y.length;if(ge===0)throw new TypeError('The value "'+A+'" is invalid for argument "value"');for(G=0;G<z-C;++G)this[G+C]=Y[G%ge]}return this};const re={};function ie(F,A,C){re[F]=class extends C{constructor(){super(),Object.defineProperty(this,"message",{value:A.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${F}]`,this.stack,delete this.name}get code(){return F}set code(T){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:T,writable:!0})}toString(){return`${this.name} [${F}]: ${this.message}`}}}ie("ERR_BUFFER_OUT_OF_BOUNDS",function(F){return F?`${F} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ie("ERR_INVALID_ARG_TYPE",function(F,A){return`The "${F}" argument must be of type number. Received type ${typeof A}`},TypeError),ie("ERR_OUT_OF_RANGE",function(F,A,C){let z=`The value of "${F}" is out of range.`,T=C;return Number.isInteger(C)&&Math.abs(C)>2**32?T=ye(String(C)):typeof C=="bigint"&&(T=String(C),(C>BigInt(2)**BigInt(32)||C<-(BigInt(2)**BigInt(32)))&&(T=ye(T)),T+="n"),z+=` It must be ${A}. Received ${T}`,z},RangeError);function ye(F){let A="",C=F.length;const z=F[0]==="-"?1:0;for(;C>=z+4;C-=3)A=`_${F.slice(C-3,C)}${A}`;return`${F.slice(0,C)}${A}`}function L(F,A,C){se(A,"offset"),(F[A]===void 0||F[A+C]===void 0)&&pe(A,F.length-(C+1))}function R(F,A,C,z,T,G){if(F>C||F<A){const Y=typeof A=="bigint"?"n":"";let ge;throw A===0||A===BigInt(0)?ge=`>= 0${Y} and < 2${Y} ** ${(G+1)*8}${Y}`:ge=`>= -(2${Y} ** ${(G+1)*8-1}${Y}) and < 2 ** ${(G+1)*8-1}${Y}`,new re.ERR_OUT_OF_RANGE("value",ge,F)}L(z,T,G)}function se(F,A){if(typeof F!="number")throw new re.ERR_INVALID_ARG_TYPE(A,"number",F)}function pe(F,A,C){throw Math.floor(F)!==F?(se(F,C),new re.ERR_OUT_OF_RANGE("offset","an integer",F)):A<0?new re.ERR_BUFFER_OUT_OF_BOUNDS:new re.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${A}`,F)}const Re=/[^+/0-9A-Za-z-_]/g;function Te(F){if(F=F.split("=")[0],F=F.trim().replace(Re,""),F.length<2)return"";for(;F.length%4!==0;)F=F+"=";return F}function Ie(F,A){A=A||1/0;let C;const z=F.length;let T=null;const G=[];for(let Y=0;Y<z;++Y){if(C=F.charCodeAt(Y),C>55295&&C<57344){if(!T){if(C>56319){(A-=3)>-1&&G.push(239,191,189);continue}else if(Y+1===z){(A-=3)>-1&&G.push(239,191,189);continue}T=C;continue}if(C<56320){(A-=3)>-1&&G.push(239,191,189),T=C;continue}C=(T-55296<<10|C-56320)+65536}else T&&(A-=3)>-1&&G.push(239,191,189);if(T=null,C<128){if((A-=1)<0)break;G.push(C)}else if(C<2048){if((A-=2)<0)break;G.push(C>>6|192,C&63|128)}else if(C<65536){if((A-=3)<0)break;G.push(C>>12|224,C>>6&63|128,C&63|128)}else if(C<1114112){if((A-=4)<0)break;G.push(C>>18|240,C>>12&63|128,C>>6&63|128,C&63|128)}else throw new Error("Invalid code point")}return G}function Me(F){const A=[];for(let C=0;C<F.length;++C)A.push(F.charCodeAt(C)&255);return A}function wt(F,A){let C,z,T;const G=[];for(let Y=0;Y<F.length&&!((A-=2)<0);++Y)C=F.charCodeAt(Y),z=C>>8,T=C%256,G.push(T),G.push(z);return G}function hn(F){return t.toByteArray(Te(F))}function Bt(F,A,C,z){let T;for(T=0;T<z&&!(T+C>=A.length||T>=F.length);++T)A[T+C]=F[T];return T}function nt(F,A){return F instanceof A||F!=null&&F.constructor!=null&&F.constructor.name!=null&&F.constructor.name===A.name}function Nt(F){return F!==F}const Wt=function(){const F="0123456789abcdef",A=new Array(256);for(let C=0;C<16;++C){const z=C*16;for(let T=0;T<16;++T)A[z+T]=F[C]+F[T]}return A}();function st(F){return typeof BigInt>"u"?Yt:F}function Yt(){throw new Error("BigInt not supported")}}(I1)),I1}var ot=iu();const G$=Xe({__proto__:null,default:ld(ot)},[ot]),qt={},j$=Object.freeze(Object.defineProperty({__proto__:null,default:qt},Symbol.toStringTag,{value:"Module"}));function aC(e){return(typeof e=="object"&&e!==null&&"message"in e?e.message:`${e}`).replace(/\.$/,"")}class ur{async getBufferFromResponse(t){const n=await t.arrayBuffer();return ot.Buffer.from(n)}constructor(t,n={}){this.baseOverrides={},this.url=t;const r=n.fetch||globalThis.fetch.bind(globalThis);if(!r)throw new TypeError("no fetch function supplied, and none found in global environment");n.overrides&&(this.baseOverrides=n.overrides),this.fetchImplementation=r}async fetch(t,n){let r;try{r=await this.fetchImplementation(t,n)}catch(i){if(`${i}`.includes("Failed to fetch")){console.warn(`generic-filehandle: refetching ${t} to attempt to work around chrome CORS header caching bug`);try{r=await this.fetchImplementation(t,{...n,cache:"reload"})}catch(o){throw new Error(`${aC(o)} fetching ${t}`,{cause:o})}}else throw new Error(`${aC(i)} fetching ${t}`,{cause:i})}return r}async read(t,n=0,r,i=0,o={}){const{headers:s={},signal:a,overrides:l={}}=o;r<1/0?s.range=`bytes=${i}-${i+r}`:r===1/0&&i!==0&&(s.range=`bytes=${i}-`);const c=await this.fetch(this.url,{...this.baseOverrides,...l,headers:{...s,...l.headers,...this.baseOverrides.headers},method:"GET",redirect:"follow",mode:"cors",signal:a});if(!c.ok)throw new Error(`HTTP ${c.status} fetching ${this.url}`);if(c.status===200&&i===0||c.status===206){const u=await this.getBufferFromResponse(c),f=u.copy(t,n,0,Math.min(r,u.length)),h=c.headers.get("content-range"),d=/\/(\d+)$/.exec(h||"");return d!=null&&d[1]&&(this._stat={size:parseInt(d[1],10)}),{bytesRead:f,buffer:t}}throw c.status===200?new Error(`${this.url} fetch returned status 200, expected 206`):new Error(`HTTP ${c.status} fetching ${this.url}`)}async readFile(t={}){let n,r;typeof t=="string"?(n=t,r={}):(n=t.encoding,r=t,delete r.encoding);const{headers:i={},signal:o,overrides:s={}}=r,a=await this.fetch(this.url,{headers:i,method:"GET",redirect:"follow",mode:"cors",signal:o,...this.baseOverrides,...s});if(a.status!==200)throw new Error(`HTTP ${a.status} fetching ${this.url}`);if(n==="utf8")return a.text();if(n)throw new Error(`unsupported encoding: ${n}`);return this.getBufferFromResponse(a)}async stat(){if(!this._stat){const t=ot.Buffer.allocUnsafe(10);if(await this.read(t,0,10,0),!this._stat)throw new Error(`unable to determine size of file at ${this.url}`)}return this._stat}async close(){}}function lC(e){const t=new FileReader;return new Promise((n,r)=>{t.onerror=()=>{t.abort(),r(new Error("problem reading blob"))},t.onabort=()=>{r(new Error("blob reading was aborted"))},t.onload=()=>{t.result&&typeof t.result!="string"?n(t.result):r(new Error("unknown error reading blob"))},t.readAsArrayBuffer(e)})}function V$(e){const t=new FileReader;return new Promise((n,r)=>{t.onerror=()=>{t.abort(),r(new Error("problem reading blob"))},t.onabort=()=>{r(new Error("blob reading was aborted"))},t.onload=()=>{t.result&&typeof t.result=="string"?n(t.result):r(new Error("unknown error reading blob"))},t.readAsText(e)})}class q${constructor(t){this.blob=t,this.size=t.size}async read(t,n=0,r,i=0){if(!r)return{bytesRead:0,buffer:t};const o=i,s=o+r,a=await lC(this.blob.slice(o,s)),l=ot.Buffer.from(a);return{bytesRead:l.copy(t,n),buffer:l}}async readFile(t){const n=typeof t=="string"?t:t==null?void 0:t.encoding;if(n==="utf8")return V$(this.blob);if(n)throw new Error(`unsupported encoding: ${n}`);const r=await lC(this.blob);return ot.Buffer.from(r)}async stat(){return{size:this.size}}async close(){}}function cC(e,t={}){return new ur(e,t)}function $$(e,t,n,r={}){if(n!==void 0)return n;if(e!==void 0)return cC(e,r);if(t!==void 0)return new qt(t,r);throw new Error("no url, path, or filehandle provided, cannot open")}const ou=Object.freeze(Object.defineProperty({__proto__:null,BlobFile:q$,LocalFile:qt,RemoteFile:ur,fromUrl:cC,open:$$},Symbol.toStringTag,{value:"Module"}));var _1={},uC;function ro(){return uC||(uC=1,function(e){var t=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function n(o,s){return Object.prototype.hasOwnProperty.call(o,s)}e.assign=function(o){for(var s=Array.prototype.slice.call(arguments,1);s.length;){var a=s.shift();if(a){if(typeof a!="object")throw new TypeError(a+"must be non-object");for(var l in a)n(a,l)&&(o[l]=a[l])}}return o},e.shrinkBuf=function(o,s){return o.length===s?o:o.subarray?o.subarray(0,s):(o.length=s,o)};var r={arraySet:function(o,s,a,l,c){if(s.subarray&&o.subarray){o.set(s.subarray(a,a+l),c);return}for(var u=0;u<l;u++)o[c+u]=s[a+u]},flattenChunks:function(o){var s,a,l,c,u,f;for(l=0,s=0,a=o.length;s<a;s++)l+=o[s].length;for(f=new Uint8Array(l),c=0,s=0,a=o.length;s<a;s++)u=o[s],f.set(u,c),c+=u.length;return f}},i={arraySet:function(o,s,a,l,c){for(var u=0;u<l;u++)o[c+u]=s[a+u]},flattenChunks:function(o){return[].concat.apply([],o)}};e.setTyped=function(o){o?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,r)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(t)}(_1)),_1}var Ca={},fr={},us={},fC;function W$(){if(fC)return us;fC=1;var e=ro(),t=4,n=0,r=1,i=2;function o(T){for(var G=T.length;--G>=0;)T[G]=0}var s=0,a=1,l=2,c=3,u=258,f=29,h=256,d=h+1+f,p=30,m=19,b=2*d+1,g=15,y=16,v=7,w=256,S=16,E=17,k=18,M=[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],D=[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],B=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=512,Z=new Array((d+2)*2);o(Z);var te=new Array(p*2);o(te);var J=new Array(q);o(J);var ce=new Array(u-c+1);o(ce);var ae=new Array(f);o(ae);var we=new Array(p);o(we);function me(T,G,Y,ge,$){this.static_tree=T,this.extra_bits=G,this.extra_base=Y,this.elems=ge,this.max_length=$,this.has_stree=T&&T.length}var U,Ae,Ce;function H(T,G){this.dyn_tree=T,this.max_code=0,this.stat_desc=G}function ze(T){return T<256?J[T]:J[256+(T>>>7)]}function qe(T,G){T.pending_buf[T.pending++]=G&255,T.pending_buf[T.pending++]=G>>>8&255}function Q(T,G,Y){T.bi_valid>y-Y?(T.bi_buf|=G<<T.bi_valid&65535,qe(T,T.bi_buf),T.bi_buf=G>>y-T.bi_valid,T.bi_valid+=Y-y):(T.bi_buf|=G<<T.bi_valid&65535,T.bi_valid+=Y)}function X(T,G,Y){Q(T,Y[G*2],Y[G*2+1])}function re(T,G){var Y=0;do Y|=T&1,T>>>=1,Y<<=1;while(--G>0);return Y>>>1}function ie(T){T.bi_valid===16?(qe(T,T.bi_buf),T.bi_buf=0,T.bi_valid=0):T.bi_valid>=8&&(T.pending_buf[T.pending++]=T.bi_buf&255,T.bi_buf>>=8,T.bi_valid-=8)}function ye(T,G){var Y=G.dyn_tree,ge=G.max_code,$=G.stat_desc.static_tree,ee=G.stat_desc.has_stree,_=G.stat_desc.extra_bits,ue=G.stat_desc.extra_base,Be=G.stat_desc.max_length,x,ne,oe,P,W,j,de=0;for(P=0;P<=g;P++)T.bl_count[P]=0;for(Y[T.heap[T.heap_max]*2+1]=0,x=T.heap_max+1;x<b;x++)ne=T.heap[x],P=Y[Y[ne*2+1]*2+1]+1,P>Be&&(P=Be,de++),Y[ne*2+1]=P,!(ne>ge)&&(T.bl_count[P]++,W=0,ne>=ue&&(W=_[ne-ue]),j=Y[ne*2],T.opt_len+=j*(P+W),ee&&(T.static_len+=j*($[ne*2+1]+W)));if(de!==0){do{for(P=Be-1;T.bl_count[P]===0;)P--;T.bl_count[P]--,T.bl_count[P+1]+=2,T.bl_count[Be]--,de-=2}while(de>0);for(P=Be;P!==0;P--)for(ne=T.bl_count[P];ne!==0;)oe=T.heap[--x],!(oe>ge)&&(Y[oe*2+1]!==P&&(T.opt_len+=(P-Y[oe*2+1])*Y[oe*2],Y[oe*2+1]=P),ne--)}}function L(T,G,Y){var ge=new Array(g+1),$=0,ee,_;for(ee=1;ee<=g;ee++)ge[ee]=$=$+Y[ee-1]<<1;for(_=0;_<=G;_++){var ue=T[_*2+1];ue!==0&&(T[_*2]=re(ge[ue]++,ue))}}function R(){var T,G,Y,ge,$,ee=new Array(g+1);for(Y=0,ge=0;ge<f-1;ge++)for(ae[ge]=Y,T=0;T<1<<M[ge];T++)ce[Y++]=ge;for(ce[Y-1]=ge,$=0,ge=0;ge<16;ge++)for(we[ge]=$,T=0;T<1<<D[ge];T++)J[$++]=ge;for($>>=7;ge<p;ge++)for(we[ge]=$<<7,T=0;T<1<<D[ge]-7;T++)J[256+$++]=ge;for(G=0;G<=g;G++)ee[G]=0;for(T=0;T<=143;)Z[T*2+1]=8,T++,ee[8]++;for(;T<=255;)Z[T*2+1]=9,T++,ee[9]++;for(;T<=279;)Z[T*2+1]=7,T++,ee[7]++;for(;T<=287;)Z[T*2+1]=8,T++,ee[8]++;for(L(Z,d+1,ee),T=0;T<p;T++)te[T*2+1]=5,te[T*2]=re(T,5);U=new me(Z,M,h+1,d,g),Ae=new me(te,D,0,p,g),Ce=new me(new Array(0),B,0,m,v)}function se(T){var G;for(G=0;G<d;G++)T.dyn_ltree[G*2]=0;for(G=0;G<p;G++)T.dyn_dtree[G*2]=0;for(G=0;G<m;G++)T.bl_tree[G*2]=0;T.dyn_ltree[w*2]=1,T.opt_len=T.static_len=0,T.last_lit=T.matches=0}function pe(T){T.bi_valid>8?qe(T,T.bi_buf):T.bi_valid>0&&(T.pending_buf[T.pending++]=T.bi_buf),T.bi_buf=0,T.bi_valid=0}function Re(T,G,Y,ge){pe(T),qe(T,Y),qe(T,~Y),e.arraySet(T.pending_buf,T.window,G,Y,T.pending),T.pending+=Y}function Te(T,G,Y,ge){var $=G*2,ee=Y*2;return T[$]<T[ee]||T[$]===T[ee]&&ge[G]<=ge[Y]}function Ie(T,G,Y){for(var ge=T.heap[Y],$=Y<<1;$<=T.heap_len&&($<T.heap_len&&Te(G,T.heap[$+1],T.heap[$],T.depth)&&$++,!Te(G,ge,T.heap[$],T.depth));)T.heap[Y]=T.heap[$],Y=$,$<<=1;T.heap[Y]=ge}function Me(T,G,Y){var ge,$,ee=0,_,ue;if(T.last_lit!==0)do ge=T.pending_buf[T.d_buf+ee*2]<<8|T.pending_buf[T.d_buf+ee*2+1],$=T.pending_buf[T.l_buf+ee],ee++,ge===0?X(T,$,G):(_=ce[$],X(T,_+h+1,G),ue=M[_],ue!==0&&($-=ae[_],Q(T,$,ue)),ge--,_=ze(ge),X(T,_,Y),ue=D[_],ue!==0&&(ge-=we[_],Q(T,ge,ue)));while(ee<T.last_lit);X(T,w,G)}function wt(T,G){var Y=G.dyn_tree,ge=G.stat_desc.static_tree,$=G.stat_desc.has_stree,ee=G.stat_desc.elems,_,ue,Be=-1,x;for(T.heap_len=0,T.heap_max=b,_=0;_<ee;_++)Y[_*2]!==0?(T.heap[++T.heap_len]=Be=_,T.depth[_]=0):Y[_*2+1]=0;for(;T.heap_len<2;)x=T.heap[++T.heap_len]=Be<2?++Be:0,Y[x*2]=1,T.depth[x]=0,T.opt_len--,$&&(T.static_len-=ge[x*2+1]);for(G.max_code=Be,_=T.heap_len>>1;_>=1;_--)Ie(T,Y,_);x=ee;do _=T.heap[1],T.heap[1]=T.heap[T.heap_len--],Ie(T,Y,1),ue=T.heap[1],T.heap[--T.heap_max]=_,T.heap[--T.heap_max]=ue,Y[x*2]=Y[_*2]+Y[ue*2],T.depth[x]=(T.depth[_]>=T.depth[ue]?T.depth[_]:T.depth[ue])+1,Y[_*2+1]=Y[ue*2+1]=x,T.heap[1]=x++,Ie(T,Y,1);while(T.heap_len>=2);T.heap[--T.heap_max]=T.heap[1],ye(T,G),L(Y,Be,T.bl_count)}function hn(T,G,Y){var ge,$=-1,ee,_=G[0*2+1],ue=0,Be=7,x=4;for(_===0&&(Be=138,x=3),G[(Y+1)*2+1]=65535,ge=0;ge<=Y;ge++)ee=_,_=G[(ge+1)*2+1],!(++ue<Be&&ee===_)&&(ue<x?T.bl_tree[ee*2]+=ue:ee!==0?(ee!==$&&T.bl_tree[ee*2]++,T.bl_tree[S*2]++):ue<=10?T.bl_tree[E*2]++:T.bl_tree[k*2]++,ue=0,$=ee,_===0?(Be=138,x=3):ee===_?(Be=6,x=3):(Be=7,x=4))}function Bt(T,G,Y){var ge,$=-1,ee,_=G[0*2+1],ue=0,Be=7,x=4;for(_===0&&(Be=138,x=3),ge=0;ge<=Y;ge++)if(ee=_,_=G[(ge+1)*2+1],!(++ue<Be&&ee===_)){if(ue<x)do X(T,ee,T.bl_tree);while(--ue!==0);else ee!==0?(ee!==$&&(X(T,ee,T.bl_tree),ue--),X(T,S,T.bl_tree),Q(T,ue-3,2)):ue<=10?(X(T,E,T.bl_tree),Q(T,ue-3,3)):(X(T,k,T.bl_tree),Q(T,ue-11,7));ue=0,$=ee,_===0?(Be=138,x=3):ee===_?(Be=6,x=3):(Be=7,x=4)}}function nt(T){var G;for(hn(T,T.dyn_ltree,T.l_desc.max_code),hn(T,T.dyn_dtree,T.d_desc.max_code),wt(T,T.bl_desc),G=m-1;G>=3&&T.bl_tree[I[G]*2+1]===0;G--);return T.opt_len+=3*(G+1)+5+5+4,G}function Nt(T,G,Y,ge){var $;for(Q(T,G-257,5),Q(T,Y-1,5),Q(T,ge-4,4),$=0;$<ge;$++)Q(T,T.bl_tree[I[$]*2+1],3);Bt(T,T.dyn_ltree,G-1),Bt(T,T.dyn_dtree,Y-1)}function Wt(T){var G=4093624447,Y;for(Y=0;Y<=31;Y++,G>>>=1)if(G&1&&T.dyn_ltree[Y*2]!==0)return n;if(T.dyn_ltree[9*2]!==0||T.dyn_ltree[10*2]!==0||T.dyn_ltree[13*2]!==0)return r;for(Y=32;Y<h;Y++)if(T.dyn_ltree[Y*2]!==0)return r;return n}var st=!1;function Yt(T){st||(R(),st=!0),T.l_desc=new H(T.dyn_ltree,U),T.d_desc=new H(T.dyn_dtree,Ae),T.bl_desc=new H(T.bl_tree,Ce),T.bi_buf=0,T.bi_valid=0,se(T)}function F(T,G,Y,ge){Q(T,(s<<1)+(ge?1:0),3),Re(T,G,Y)}function A(T){Q(T,a<<1,3),X(T,w,Z),ie(T)}function C(T,G,Y,ge){var $,ee,_=0;T.level>0?(T.strm.data_type===i&&(T.strm.data_type=Wt(T)),wt(T,T.l_desc),wt(T,T.d_desc),_=nt(T),$=T.opt_len+3+7>>>3,ee=T.static_len+3+7>>>3,ee<=$&&($=ee)):$=ee=Y+5,Y+4<=$&&G!==-1?F(T,G,Y,ge):T.strategy===t||ee===$?(Q(T,(a<<1)+(ge?1:0),3),Me(T,Z,te)):(Q(T,(l<<1)+(ge?1:0),3),Nt(T,T.l_desc.max_code+1,T.d_desc.max_code+1,_+1),Me(T,T.dyn_ltree,T.dyn_dtree)),se(T),ge&&pe(T)}function z(T,G,Y){return T.pending_buf[T.d_buf+T.last_lit*2]=G>>>8&255,T.pending_buf[T.d_buf+T.last_lit*2+1]=G&255,T.pending_buf[T.l_buf+T.last_lit]=Y&255,T.last_lit++,G===0?T.dyn_ltree[Y*2]++:(T.matches++,G--,T.dyn_ltree[(ce[Y]+h+1)*2]++,T.dyn_dtree[ze(G)*2]++),T.last_lit===T.lit_bufsize-1}return us._tr_init=Yt,us._tr_stored_block=F,us._tr_flush_block=C,us._tr_tally=z,us._tr_align=A,us}var D1,hC;function dC(){if(hC)return D1;hC=1;function e(t,n,r,i){for(var o=t&65535|0,s=t>>>16&65535|0,a=0;r!==0;){a=r>2e3?2e3:r,r-=a;do o=o+n[i++]|0,s=s+o|0;while(--a);o%=65521,s%=65521}return o|s<<16|0}return D1=e,D1}var R1,pC;function gC(){if(pC)return R1;pC=1;function e(){for(var r,i=[],o=0;o<256;o++){r=o;for(var s=0;s<8;s++)r=r&1?3988292384^r>>>1:r>>>1;i[o]=r}return i}var t=e();function n(r,i,o,s){var a=t,l=s+o;r^=-1;for(var c=s;c<l;c++)r=r>>>8^a[(r^i[c])&255];return r^-1}return R1=n,R1}var B1,mC;function F1(){return mC||(mC=1,B1={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"}),B1}var bC;function Y$(){if(bC)return fr;bC=1;var e=ro(),t=W$(),n=dC(),r=gC(),i=F1(),o=0,s=1,a=3,l=4,c=5,u=0,f=1,h=-2,d=-3,p=-5,m=-1,b=1,g=2,y=3,v=4,w=0,S=2,E=8,k=9,M=15,D=8,B=29,I=256,q=I+1+B,Z=30,te=19,J=2*q+1,ce=15,ae=3,we=258,me=we+ae+1,U=32,Ae=42,Ce=69,H=73,ze=91,qe=103,Q=113,X=666,re=1,ie=2,ye=3,L=4,R=3;function se(x,ne){return x.msg=i[ne],ne}function pe(x){return(x<<1)-(x>4?9:0)}function Re(x){for(var ne=x.length;--ne>=0;)x[ne]=0}function Te(x){var ne=x.state,oe=ne.pending;oe>x.avail_out&&(oe=x.avail_out),oe!==0&&(e.arraySet(x.output,ne.pending_buf,ne.pending_out,oe,x.next_out),x.next_out+=oe,ne.pending_out+=oe,x.total_out+=oe,x.avail_out-=oe,ne.pending-=oe,ne.pending===0&&(ne.pending_out=0))}function Ie(x,ne){t._tr_flush_block(x,x.block_start>=0?x.block_start:-1,x.strstart-x.block_start,ne),x.block_start=x.strstart,Te(x.strm)}function Me(x,ne){x.pending_buf[x.pending++]=ne}function wt(x,ne){x.pending_buf[x.pending++]=ne>>>8&255,x.pending_buf[x.pending++]=ne&255}function hn(x,ne,oe,P){var W=x.avail_in;return W>P&&(W=P),W===0?0:(x.avail_in-=W,e.arraySet(ne,x.input,x.next_in,W,oe),x.state.wrap===1?x.adler=n(x.adler,ne,W,oe):x.state.wrap===2&&(x.adler=r(x.adler,ne,W,oe)),x.next_in+=W,x.total_in+=W,W)}function Bt(x,ne){var oe=x.max_chain_length,P=x.strstart,W,j,de=x.prev_length,ve=x.nice_match,Ee=x.strstart>x.w_size-me?x.strstart-(x.w_size-me):0,Ue=x.window,Tt=x.w_mask,V=x.prev,Pe=x.strstart+we,ct=Ue[P+de-1],rt=Ue[P+de];x.prev_length>=x.good_match&&(oe>>=2),ve>x.lookahead&&(ve=x.lookahead);do if(W=ne,!(Ue[W+de]!==rt||Ue[W+de-1]!==ct||Ue[W]!==Ue[P]||Ue[++W]!==Ue[P+1])){P+=2,W++;do;while(Ue[++P]===Ue[++W]&&Ue[++P]===Ue[++W]&&Ue[++P]===Ue[++W]&&Ue[++P]===Ue[++W]&&Ue[++P]===Ue[++W]&&Ue[++P]===Ue[++W]&&Ue[++P]===Ue[++W]&&Ue[++P]===Ue[++W]&&P<Pe);if(j=we-(Pe-P),P=Pe-we,j>de){if(x.match_start=ne,de=j,j>=ve)break;ct=Ue[P+de-1],rt=Ue[P+de]}}while((ne=V[ne&Tt])>Ee&&--oe!==0);return de<=x.lookahead?de:x.lookahead}function nt(x){var ne=x.w_size,oe,P,W,j,de;do{if(j=x.window_size-x.lookahead-x.strstart,x.strstart>=ne+(ne-me)){e.arraySet(x.window,x.window,ne,ne,0),x.match_start-=ne,x.strstart-=ne,x.block_start-=ne,P=x.hash_size,oe=P;do W=x.head[--oe],x.head[oe]=W>=ne?W-ne:0;while(--P);P=ne,oe=P;do W=x.prev[--oe],x.prev[oe]=W>=ne?W-ne:0;while(--P);j+=ne}if(x.strm.avail_in===0)break;if(P=hn(x.strm,x.window,x.strstart+x.lookahead,j),x.lookahead+=P,x.lookahead+x.insert>=ae)for(de=x.strstart-x.insert,x.ins_h=x.window[de],x.ins_h=(x.ins_h<<x.hash_shift^x.window[de+1])&x.hash_mask;x.insert&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[de+ae-1])&x.hash_mask,x.prev[de&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=de,de++,x.insert--,!(x.lookahead+x.insert<ae)););}while(x.lookahead<me&&x.strm.avail_in!==0)}function Nt(x,ne){var oe=65535;for(oe>x.pending_buf_size-5&&(oe=x.pending_buf_size-5);;){if(x.lookahead<=1){if(nt(x),x.lookahead===0&&ne===o)return re;if(x.lookahead===0)break}x.strstart+=x.lookahead,x.lookahead=0;var P=x.block_start+oe;if((x.strstart===0||x.strstart>=P)&&(x.lookahead=x.strstart-P,x.strstart=P,Ie(x,!1),x.strm.avail_out===0)||x.strstart-x.block_start>=x.w_size-me&&(Ie(x,!1),x.strm.avail_out===0))return re}return x.insert=0,ne===l?(Ie(x,!0),x.strm.avail_out===0?ye:L):(x.strstart>x.block_start&&(Ie(x,!1),x.strm.avail_out===0),re)}function Wt(x,ne){for(var oe,P;;){if(x.lookahead<me){if(nt(x),x.lookahead<me&&ne===o)return re;if(x.lookahead===0)break}if(oe=0,x.lookahead>=ae&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+ae-1])&x.hash_mask,oe=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart),oe!==0&&x.strstart-oe<=x.w_size-me&&(x.match_length=Bt(x,oe)),x.match_length>=ae)if(P=t._tr_tally(x,x.strstart-x.match_start,x.match_length-ae),x.lookahead-=x.match_length,x.match_length<=x.max_lazy_match&&x.lookahead>=ae){x.match_length--;do x.strstart++,x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+ae-1])&x.hash_mask,oe=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart;while(--x.match_length!==0);x.strstart++}else x.strstart+=x.match_length,x.match_length=0,x.ins_h=x.window[x.strstart],x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+1])&x.hash_mask;else P=t._tr_tally(x,0,x.window[x.strstart]),x.lookahead--,x.strstart++;if(P&&(Ie(x,!1),x.strm.avail_out===0))return re}return x.insert=x.strstart<ae-1?x.strstart:ae-1,ne===l?(Ie(x,!0),x.strm.avail_out===0?ye:L):x.last_lit&&(Ie(x,!1),x.strm.avail_out===0)?re:ie}function st(x,ne){for(var oe,P,W;;){if(x.lookahead<me){if(nt(x),x.lookahead<me&&ne===o)return re;if(x.lookahead===0)break}if(oe=0,x.lookahead>=ae&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+ae-1])&x.hash_mask,oe=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart),x.prev_length=x.match_length,x.prev_match=x.match_start,x.match_length=ae-1,oe!==0&&x.prev_length<x.max_lazy_match&&x.strstart-oe<=x.w_size-me&&(x.match_length=Bt(x,oe),x.match_length<=5&&(x.strategy===b||x.match_length===ae&&x.strstart-x.match_start>4096)&&(x.match_length=ae-1)),x.prev_length>=ae&&x.match_length<=x.prev_length){W=x.strstart+x.lookahead-ae,P=t._tr_tally(x,x.strstart-1-x.prev_match,x.prev_length-ae),x.lookahead-=x.prev_length-1,x.prev_length-=2;do++x.strstart<=W&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+ae-1])&x.hash_mask,oe=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart);while(--x.prev_length!==0);if(x.match_available=0,x.match_length=ae-1,x.strstart++,P&&(Ie(x,!1),x.strm.avail_out===0))return re}else if(x.match_available){if(P=t._tr_tally(x,0,x.window[x.strstart-1]),P&&Ie(x,!1),x.strstart++,x.lookahead--,x.strm.avail_out===0)return re}else x.match_available=1,x.strstart++,x.lookahead--}return x.match_available&&(P=t._tr_tally(x,0,x.window[x.strstart-1]),x.match_available=0),x.insert=x.strstart<ae-1?x.strstart:ae-1,ne===l?(Ie(x,!0),x.strm.avail_out===0?ye:L):x.last_lit&&(Ie(x,!1),x.strm.avail_out===0)?re:ie}function Yt(x,ne){for(var oe,P,W,j,de=x.window;;){if(x.lookahead<=we){if(nt(x),x.lookahead<=we&&ne===o)return re;if(x.lookahead===0)break}if(x.match_length=0,x.lookahead>=ae&&x.strstart>0&&(W=x.strstart-1,P=de[W],P===de[++W]&&P===de[++W]&&P===de[++W])){j=x.strstart+we;do;while(P===de[++W]&&P===de[++W]&&P===de[++W]&&P===de[++W]&&P===de[++W]&&P===de[++W]&&P===de[++W]&&P===de[++W]&&W<j);x.match_length=we-(j-W),x.match_length>x.lookahead&&(x.match_length=x.lookahead)}if(x.match_length>=ae?(oe=t._tr_tally(x,1,x.match_length-ae),x.lookahead-=x.match_length,x.strstart+=x.match_length,x.match_length=0):(oe=t._tr_tally(x,0,x.window[x.strstart]),x.lookahead--,x.strstart++),oe&&(Ie(x,!1),x.strm.avail_out===0))return re}return x.insert=0,ne===l?(Ie(x,!0),x.strm.avail_out===0?ye:L):x.last_lit&&(Ie(x,!1),x.strm.avail_out===0)?re:ie}function F(x,ne){for(var oe;;){if(x.lookahead===0&&(nt(x),x.lookahead===0)){if(ne===o)return re;break}if(x.match_length=0,oe=t._tr_tally(x,0,x.window[x.strstart]),x.lookahead--,x.strstart++,oe&&(Ie(x,!1),x.strm.avail_out===0))return re}return x.insert=0,ne===l?(Ie(x,!0),x.strm.avail_out===0?ye:L):x.last_lit&&(Ie(x,!1),x.strm.avail_out===0)?re:ie}function A(x,ne,oe,P,W){this.good_length=x,this.max_lazy=ne,this.nice_length=oe,this.max_chain=P,this.func=W}var C;C=[new A(0,0,0,0,Nt),new A(4,4,8,4,Wt),new A(4,5,16,8,Wt),new A(4,6,32,32,Wt),new A(4,4,16,16,st),new A(8,16,32,32,st),new A(8,16,128,128,st),new A(8,32,128,256,st),new A(32,128,258,1024,st),new A(32,258,258,4096,st)];function z(x){x.window_size=2*x.w_size,Re(x.head),x.max_lazy_match=C[x.level].max_lazy,x.good_match=C[x.level].good_length,x.nice_match=C[x.level].nice_length,x.max_chain_length=C[x.level].max_chain,x.strstart=0,x.block_start=0,x.lookahead=0,x.insert=0,x.match_length=x.prev_length=ae-1,x.match_available=0,x.ins_h=0}function T(){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=E,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 e.Buf16(J*2),this.dyn_dtree=new e.Buf16((2*Z+1)*2),this.bl_tree=new e.Buf16((2*te+1)*2),Re(this.dyn_ltree),Re(this.dyn_dtree),Re(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new e.Buf16(ce+1),this.heap=new e.Buf16(2*q+1),Re(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new e.Buf16(2*q+1),Re(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function G(x){var ne;return!x||!x.state?se(x,h):(x.total_in=x.total_out=0,x.data_type=S,ne=x.state,ne.pending=0,ne.pending_out=0,ne.wrap<0&&(ne.wrap=-ne.wrap),ne.status=ne.wrap?Ae:Q,x.adler=ne.wrap===2?0:1,ne.last_flush=o,t._tr_init(ne),u)}function Y(x){var ne=G(x);return ne===u&&z(x.state),ne}function ge(x,ne){return!x||!x.state||x.state.wrap!==2?h:(x.state.gzhead=ne,u)}function $(x,ne,oe,P,W,j){if(!x)return h;var de=1;if(ne===m&&(ne=6),P<0?(de=0,P=-P):P>15&&(de=2,P-=16),W<1||W>k||oe!==E||P<8||P>15||ne<0||ne>9||j<0||j>v)return se(x,h);P===8&&(P=9);var ve=new T;return x.state=ve,ve.strm=x,ve.wrap=de,ve.gzhead=null,ve.w_bits=P,ve.w_size=1<<ve.w_bits,ve.w_mask=ve.w_size-1,ve.hash_bits=W+7,ve.hash_size=1<<ve.hash_bits,ve.hash_mask=ve.hash_size-1,ve.hash_shift=~~((ve.hash_bits+ae-1)/ae),ve.window=new e.Buf8(ve.w_size*2),ve.head=new e.Buf16(ve.hash_size),ve.prev=new e.Buf16(ve.w_size),ve.lit_bufsize=1<<W+6,ve.pending_buf_size=ve.lit_bufsize*4,ve.pending_buf=new e.Buf8(ve.pending_buf_size),ve.d_buf=1*ve.lit_bufsize,ve.l_buf=3*ve.lit_bufsize,ve.level=ne,ve.strategy=j,ve.method=oe,Y(x)}function ee(x,ne){return $(x,ne,E,M,D,w)}function _(x,ne){var oe,P,W,j;if(!x||!x.state||ne>c||ne<0)return x?se(x,h):h;if(P=x.state,!x.output||!x.input&&x.avail_in!==0||P.status===X&&ne!==l)return se(x,x.avail_out===0?p:h);if(P.strm=x,oe=P.last_flush,P.last_flush=ne,P.status===Ae)if(P.wrap===2)x.adler=0,Me(P,31),Me(P,139),Me(P,8),P.gzhead?(Me(P,(P.gzhead.text?1:0)+(P.gzhead.hcrc?2:0)+(P.gzhead.extra?4:0)+(P.gzhead.name?8:0)+(P.gzhead.comment?16:0)),Me(P,P.gzhead.time&255),Me(P,P.gzhead.time>>8&255),Me(P,P.gzhead.time>>16&255),Me(P,P.gzhead.time>>24&255),Me(P,P.level===9?2:P.strategy>=g||P.level<2?4:0),Me(P,P.gzhead.os&255),P.gzhead.extra&&P.gzhead.extra.length&&(Me(P,P.gzhead.extra.length&255),Me(P,P.gzhead.extra.length>>8&255)),P.gzhead.hcrc&&(x.adler=r(x.adler,P.pending_buf,P.pending,0)),P.gzindex=0,P.status=Ce):(Me(P,0),Me(P,0),Me(P,0),Me(P,0),Me(P,0),Me(P,P.level===9?2:P.strategy>=g||P.level<2?4:0),Me(P,R),P.status=Q);else{var de=E+(P.w_bits-8<<4)<<8,ve=-1;P.strategy>=g||P.level<2?ve=0:P.level<6?ve=1:P.level===6?ve=2:ve=3,de|=ve<<6,P.strstart!==0&&(de|=U),de+=31-de%31,P.status=Q,wt(P,de),P.strstart!==0&&(wt(P,x.adler>>>16),wt(P,x.adler&65535)),x.adler=1}if(P.status===Ce)if(P.gzhead.extra){for(W=P.pending;P.gzindex<(P.gzhead.extra.length&65535)&&!(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>W&&(x.adler=r(x.adler,P.pending_buf,P.pending-W,W)),Te(x),W=P.pending,P.pending===P.pending_buf_size));)Me(P,P.gzhead.extra[P.gzindex]&255),P.gzindex++;P.gzhead.hcrc&&P.pending>W&&(x.adler=r(x.adler,P.pending_buf,P.pending-W,W)),P.gzindex===P.gzhead.extra.length&&(P.gzindex=0,P.status=H)}else P.status=H;if(P.status===H)if(P.gzhead.name){W=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>W&&(x.adler=r(x.adler,P.pending_buf,P.pending-W,W)),Te(x),W=P.pending,P.pending===P.pending_buf_size)){j=1;break}P.gzindex<P.gzhead.name.length?j=P.gzhead.name.charCodeAt(P.gzindex++)&255:j=0,Me(P,j)}while(j!==0);P.gzhead.hcrc&&P.pending>W&&(x.adler=r(x.adler,P.pending_buf,P.pending-W,W)),j===0&&(P.gzindex=0,P.status=ze)}else P.status=ze;if(P.status===ze)if(P.gzhead.comment){W=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>W&&(x.adler=r(x.adler,P.pending_buf,P.pending-W,W)),Te(x),W=P.pending,P.pending===P.pending_buf_size)){j=1;break}P.gzindex<P.gzhead.comment.length?j=P.gzhead.comment.charCodeAt(P.gzindex++)&255:j=0,Me(P,j)}while(j!==0);P.gzhead.hcrc&&P.pending>W&&(x.adler=r(x.adler,P.pending_buf,P.pending-W,W)),j===0&&(P.status=qe)}else P.status=qe;if(P.status===qe&&(P.gzhead.hcrc?(P.pending+2>P.pending_buf_size&&Te(x),P.pending+2<=P.pending_buf_size&&(Me(P,x.adler&255),Me(P,x.adler>>8&255),x.adler=0,P.status=Q)):P.status=Q),P.pending!==0){if(Te(x),x.avail_out===0)return P.last_flush=-1,u}else if(x.avail_in===0&&pe(ne)<=pe(oe)&&ne!==l)return se(x,p);if(P.status===X&&x.avail_in!==0)return se(x,p);if(x.avail_in!==0||P.lookahead!==0||ne!==o&&P.status!==X){var Ee=P.strategy===g?F(P,ne):P.strategy===y?Yt(P,ne):C[P.level].func(P,ne);if((Ee===ye||Ee===L)&&(P.status=X),Ee===re||Ee===ye)return x.avail_out===0&&(P.last_flush=-1),u;if(Ee===ie&&(ne===s?t._tr_align(P):ne!==c&&(t._tr_stored_block(P,0,0,!1),ne===a&&(Re(P.head),P.lookahead===0&&(P.strstart=0,P.block_start=0,P.insert=0))),Te(x),x.avail_out===0))return P.last_flush=-1,u}return ne!==l?u:P.wrap<=0?f:(P.wrap===2?(Me(P,x.adler&255),Me(P,x.adler>>8&255),Me(P,x.adler>>16&255),Me(P,x.adler>>24&255),Me(P,x.total_in&255),Me(P,x.total_in>>8&255),Me(P,x.total_in>>16&255),Me(P,x.total_in>>24&255)):(wt(P,x.adler>>>16),wt(P,x.adler&65535)),Te(x),P.wrap>0&&(P.wrap=-P.wrap),P.pending!==0?u:f)}function ue(x){var ne;return!x||!x.state?h:(ne=x.state.status,ne!==Ae&&ne!==Ce&&ne!==H&&ne!==ze&&ne!==qe&&ne!==Q&&ne!==X?se(x,h):(x.state=null,ne===Q?se(x,d):u))}function Be(x,ne){var oe=ne.length,P,W,j,de,ve,Ee,Ue,Tt;if(!x||!x.state||(P=x.state,de=P.wrap,de===2||de===1&&P.status!==Ae||P.lookahead))return h;for(de===1&&(x.adler=n(x.adler,ne,oe,0)),P.wrap=0,oe>=P.w_size&&(de===0&&(Re(P.head),P.strstart=0,P.block_start=0,P.insert=0),Tt=new e.Buf8(P.w_size),e.arraySet(Tt,ne,oe-P.w_size,P.w_size,0),ne=Tt,oe=P.w_size),ve=x.avail_in,Ee=x.next_in,Ue=x.input,x.avail_in=oe,x.next_in=0,x.input=ne,nt(P);P.lookahead>=ae;){W=P.strstart,j=P.lookahead-(ae-1);do P.ins_h=(P.ins_h<<P.hash_shift^P.window[W+ae-1])&P.hash_mask,P.prev[W&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=W,W++;while(--j);P.strstart=W,P.lookahead=ae-1,nt(P)}return P.strstart+=P.lookahead,P.block_start=P.strstart,P.insert=P.lookahead,P.lookahead=0,P.match_length=P.prev_length=ae-1,P.match_available=0,x.next_in=Ee,x.input=Ue,x.avail_in=ve,P.wrap=de,u}return fr.deflateInit=ee,fr.deflateInit2=$,fr.deflateReset=Y,fr.deflateResetKeep=G,fr.deflateSetHeader=ge,fr.deflate=_,fr.deflateEnd=ue,fr.deflateSetDictionary=Be,fr.deflateInfo="pako deflate (from Nodeca project)",fr}var fs={},yC;function wC(){if(yC)return fs;yC=1;var e=ro(),t=!0,n=!0;try{String.fromCharCode.apply(null,[0])}catch{t=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{n=!1}for(var r=new e.Buf8(256),i=0;i<256;i++)r[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;r[254]=r[254]=1,fs.string2buf=function(s){var a,l,c,u,f,h=s.length,d=0;for(u=0;u<h;u++)l=s.charCodeAt(u),(l&64512)===55296&&u+1<h&&(c=s.charCodeAt(u+1),(c&64512)===56320&&(l=65536+(l-55296<<10)+(c-56320),u++)),d+=l<128?1:l<2048?2:l<65536?3:4;for(a=new e.Buf8(d),f=0,u=0;f<d;u++)l=s.charCodeAt(u),(l&64512)===55296&&u+1<h&&(c=s.charCodeAt(u+1),(c&64512)===56320&&(l=65536+(l-55296<<10)+(c-56320),u++)),l<128?a[f++]=l:l<2048?(a[f++]=192|l>>>6,a[f++]=128|l&63):l<65536?(a[f++]=224|l>>>12,a[f++]=128|l>>>6&63,a[f++]=128|l&63):(a[f++]=240|l>>>18,a[f++]=128|l>>>12&63,a[f++]=128|l>>>6&63,a[f++]=128|l&63);return a};function o(s,a){if(a<65534&&(s.subarray&&n||!s.subarray&&t))return String.fromCharCode.apply(null,e.shrinkBuf(s,a));for(var l="",c=0;c<a;c++)l+=String.fromCharCode(s[c]);return l}return fs.buf2binstring=function(s){return o(s,s.length)},fs.binstring2buf=function(s){for(var a=new e.Buf8(s.length),l=0,c=a.length;l<c;l++)a[l]=s.charCodeAt(l);return a},fs.buf2string=function(s,a){var l,c,u,f,h=a||s.length,d=new Array(h*2);for(c=0,l=0;l<h;){if(u=s[l++],u<128){d[c++]=u;continue}if(f=r[u],f>4){d[c++]=65533,l+=f-1;continue}for(u&=f===2?31:f===3?15:7;f>1&&l<h;)u=u<<6|s[l++]&63,f--;if(f>1){d[c++]=65533;continue}u<65536?d[c++]=u:(u-=65536,d[c++]=55296|u>>10&1023,d[c++]=56320|u&1023)}return o(d,c)},fs.utf8border=function(s,a){var l;for(a=a||s.length,a>s.length&&(a=s.length),l=a-1;l>=0&&(s[l]&192)===128;)l--;return l<0||l===0?a:l+r[s[l]]>a?l:a},fs}var M1,vC;function xC(){if(vC)return M1;vC=1;function e(){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}return M1=e,M1}var AC;function Q$(){if(AC)return Ca;AC=1;var e=Y$(),t=ro(),n=wC(),r=F1(),i=xC(),o=Object.prototype.toString,s=0,a=4,l=0,c=1,u=2,f=-1,h=0,d=8;function p(y){if(!(this instanceof p))return new p(y);this.options=t.assign({level:f,method:d,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},y||{});var v=this.options;v.raw&&v.windowBits>0?v.windowBits=-v.windowBits:v.gzip&&v.windowBits>0&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new i,this.strm.avail_out=0;var w=e.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(w!==l)throw new Error(r[w]);if(v.header&&e.deflateSetHeader(this.strm,v.header),v.dictionary){var S;if(typeof v.dictionary=="string"?S=n.string2buf(v.dictionary):o.call(v.dictionary)==="[object ArrayBuffer]"?S=new Uint8Array(v.dictionary):S=v.dictionary,w=e.deflateSetDictionary(this.strm,S),w!==l)throw new Error(r[w]);this._dict_set=!0}}p.prototype.push=function(y,v){var w=this.strm,S=this.options.chunkSize,E,k;if(this.ended)return!1;k=v===~~v?v:v===!0?a:s,typeof y=="string"?w.input=n.string2buf(y):o.call(y)==="[object ArrayBuffer]"?w.input=new Uint8Array(y):w.input=y,w.next_in=0,w.avail_in=w.input.length;do{if(w.avail_out===0&&(w.output=new t.Buf8(S),w.next_out=0,w.avail_out=S),E=e.deflate(w,k),E!==c&&E!==l)return this.onEnd(E),this.ended=!0,!1;(w.avail_out===0||w.avail_in===0&&(k===a||k===u))&&(this.options.to==="string"?this.onData(n.buf2binstring(t.shrinkBuf(w.output,w.next_out))):this.onData(t.shrinkBuf(w.output,w.next_out)))}while((w.avail_in>0||w.avail_out===0)&&E!==c);return k===a?(E=e.deflateEnd(this.strm),this.onEnd(E),this.ended=!0,E===l):(k===u&&(this.onEnd(l),w.avail_out=0),!0)},p.prototype.onData=function(y){this.chunks.push(y)},p.prototype.onEnd=function(y){y===l&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=t.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg};function m(y,v){var w=new p(v);if(w.push(y,!0),w.err)throw w.msg||r[w.err];return w.result}function b(y,v){return v=v||{},v.raw=!0,m(y,v)}function g(y,v){return v=v||{},v.gzip=!0,m(y,v)}return Ca.Deflate=p,Ca.deflate=m,Ca.deflateRaw=b,Ca.gzip=g,Ca}var ka={},Wn={},P1,EC;function Z$(){if(EC)return P1;EC=1;var e=30,t=12;return P1=function(r,i){var o,s,a,l,c,u,f,h,d,p,m,b,g,y,v,w,S,E,k,M,D,B,I,q,Z;o=r.state,s=r.next_in,q=r.input,a=s+(r.avail_in-5),l=r.next_out,Z=r.output,c=l-(i-r.avail_out),u=l+(r.avail_out-257),f=o.dmax,h=o.wsize,d=o.whave,p=o.wnext,m=o.window,b=o.hold,g=o.bits,y=o.lencode,v=o.distcode,w=(1<<o.lenbits)-1,S=(1<<o.distbits)-1;e:do{g<15&&(b+=q[s++]<<g,g+=8,b+=q[s++]<<g,g+=8),E=y[b&w];t:for(;;){if(k=E>>>24,b>>>=k,g-=k,k=E>>>16&255,k===0)Z[l++]=E&65535;else if(k&16){M=E&65535,k&=15,k&&(g<k&&(b+=q[s++]<<g,g+=8),M+=b&(1<<k)-1,b>>>=k,g-=k),g<15&&(b+=q[s++]<<g,g+=8,b+=q[s++]<<g,g+=8),E=v[b&S];n:for(;;){if(k=E>>>24,b>>>=k,g-=k,k=E>>>16&255,k&16){if(D=E&65535,k&=15,g<k&&(b+=q[s++]<<g,g+=8,g<k&&(b+=q[s++]<<g,g+=8)),D+=b&(1<<k)-1,D>f){r.msg="invalid distance too far back",o.mode=e;break e}if(b>>>=k,g-=k,k=l-c,D>k){if(k=D-k,k>d&&o.sane){r.msg="invalid distance too far back",o.mode=e;break e}if(B=0,I=m,p===0){if(B+=h-k,k<M){M-=k;do Z[l++]=m[B++];while(--k);B=l-D,I=Z}}else if(p<k){if(B+=h+p-k,k-=p,k<M){M-=k;do Z[l++]=m[B++];while(--k);if(B=0,p<M){k=p,M-=k;do Z[l++]=m[B++];while(--k);B=l-D,I=Z}}}else if(B+=p-k,k<M){M-=k;do Z[l++]=m[B++];while(--k);B=l-D,I=Z}for(;M>2;)Z[l++]=I[B++],Z[l++]=I[B++],Z[l++]=I[B++],M-=3;M&&(Z[l++]=I[B++],M>1&&(Z[l++]=I[B++]))}else{B=l-D;do Z[l++]=Z[B++],Z[l++]=Z[B++],Z[l++]=Z[B++],M-=3;while(M>2);M&&(Z[l++]=Z[B++],M>1&&(Z[l++]=Z[B++]))}}else if(k&64){r.msg="invalid distance code",o.mode=e;break e}else{E=v[(E&65535)+(b&(1<<k)-1)];continue n}break}}else if(k&64)if(k&32){o.mode=t;break e}else{r.msg="invalid literal/length code",o.mode=e;break e}else{E=y[(E&65535)+(b&(1<<k)-1)];continue t}break}}while(s<a&&l<u);M=g>>3,s-=M,g-=M<<3,b&=(1<<g)-1,r.next_in=s,r.next_out=l,r.avail_in=s<a?5+(a-s):5-(s-a),r.avail_out=l<u?257+(u-l):257-(l-u),o.hold=b,o.bits=g},P1}var O1,SC;function X$(){if(SC)return O1;SC=1;var e=ro(),t=15,n=852,r=592,i=0,o=1,s=2,a=[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],l=[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],c=[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],u=[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];return O1=function(h,d,p,m,b,g,y,v){var w=v.bits,S=0,E=0,k=0,M=0,D=0,B=0,I=0,q=0,Z=0,te=0,J,ce,ae,we,me,U=null,Ae=0,Ce,H=new e.Buf16(t+1),ze=new e.Buf16(t+1),qe=null,Q=0,X,re,ie;for(S=0;S<=t;S++)H[S]=0;for(E=0;E<m;E++)H[d[p+E]]++;for(D=w,M=t;M>=1&&H[M]===0;M--);if(D>M&&(D=M),M===0)return b[g++]=1<<24|64<<16|0,b[g++]=1<<24|64<<16|0,v.bits=1,0;for(k=1;k<M&&H[k]===0;k++);for(D<k&&(D=k),q=1,S=1;S<=t;S++)if(q<<=1,q-=H[S],q<0)return-1;if(q>0&&(h===i||M!==1))return-1;for(ze[1]=0,S=1;S<t;S++)ze[S+1]=ze[S]+H[S];for(E=0;E<m;E++)d[p+E]!==0&&(y[ze[d[p+E]]++]=E);if(h===i?(U=qe=y,Ce=19):h===o?(U=a,Ae-=257,qe=l,Q-=257,Ce=256):(U=c,qe=u,Ce=-1),te=0,E=0,S=k,me=g,B=D,I=0,ae=-1,Z=1<<D,we=Z-1,h===o&&Z>n||h===s&&Z>r)return 1;for(;;){X=S-I,y[E]<Ce?(re=0,ie=y[E]):y[E]>Ce?(re=qe[Q+y[E]],ie=U[Ae+y[E]]):(re=96,ie=0),J=1<<S-I,ce=1<<B,k=ce;do ce-=J,b[me+(te>>I)+ce]=X<<24|re<<16|ie|0;while(ce!==0);for(J=1<<S-1;te&J;)J>>=1;if(J!==0?(te&=J-1,te+=J):te=0,E++,--H[S]===0){if(S===M)break;S=d[p+y[E]]}if(S>D&&(te&we)!==ae){for(I===0&&(I=D),me+=k,B=S-I,q=1<<B;B+I<M&&(q-=H[B+I],!(q<=0));)B++,q<<=1;if(Z+=1<<B,h===o&&Z>n||h===s&&Z>r)return 1;ae=te&we,b[ae]=D<<24|B<<16|me-g|0}}return te!==0&&(b[me+te]=S-I<<24|64<<16|0),v.bits=D,0},O1}var CC;function K$(){if(CC)return Wn;CC=1;var e=ro(),t=dC(),n=gC(),r=Z$(),i=X$(),o=0,s=1,a=2,l=4,c=5,u=6,f=0,h=1,d=2,p=-2,m=-3,b=-4,g=-5,y=8,v=1,w=2,S=3,E=4,k=5,M=6,D=7,B=8,I=9,q=10,Z=11,te=12,J=13,ce=14,ae=15,we=16,me=17,U=18,Ae=19,Ce=20,H=21,ze=22,qe=23,Q=24,X=25,re=26,ie=27,ye=28,L=29,R=30,se=31,pe=32,Re=852,Te=592,Ie=15,Me=Ie;function wt($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function hn(){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 e.Buf16(320),this.work=new e.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Bt($){var ee;return!$||!$.state?p:(ee=$.state,$.total_in=$.total_out=ee.total=0,$.msg="",ee.wrap&&($.adler=ee.wrap&1),ee.mode=v,ee.last=0,ee.havedict=0,ee.dmax=32768,ee.head=null,ee.hold=0,ee.bits=0,ee.lencode=ee.lendyn=new e.Buf32(Re),ee.distcode=ee.distdyn=new e.Buf32(Te),ee.sane=1,ee.back=-1,f)}function nt($){var ee;return!$||!$.state?p:(ee=$.state,ee.wsize=0,ee.whave=0,ee.wnext=0,Bt($))}function Nt($,ee){var _,ue;return!$||!$.state||(ue=$.state,ee<0?(_=0,ee=-ee):(_=(ee>>4)+1,ee<48&&(ee&=15)),ee&&(ee<8||ee>15))?p:(ue.window!==null&&ue.wbits!==ee&&(ue.window=null),ue.wrap=_,ue.wbits=ee,nt($))}function Wt($,ee){var _,ue;return $?(ue=new hn,$.state=ue,ue.window=null,_=Nt($,ee),_!==f&&($.state=null),_):p}function st($){return Wt($,Me)}var Yt=!0,F,A;function C($){if(Yt){var ee;for(F=new e.Buf32(512),A=new e.Buf32(32),ee=0;ee<144;)$.lens[ee++]=8;for(;ee<256;)$.lens[ee++]=9;for(;ee<280;)$.lens[ee++]=7;for(;ee<288;)$.lens[ee++]=8;for(i(s,$.lens,0,288,F,0,$.work,{bits:9}),ee=0;ee<32;)$.lens[ee++]=5;i(a,$.lens,0,32,A,0,$.work,{bits:5}),Yt=!1}$.lencode=F,$.lenbits=9,$.distcode=A,$.distbits=5}function z($,ee,_,ue){var Be,x=$.state;return x.window===null&&(x.wsize=1<<x.wbits,x.wnext=0,x.whave=0,x.window=new e.Buf8(x.wsize)),ue>=x.wsize?(e.arraySet(x.window,ee,_-x.wsize,x.wsize,0),x.wnext=0,x.whave=x.wsize):(Be=x.wsize-x.wnext,Be>ue&&(Be=ue),e.arraySet(x.window,ee,_-ue,Be,x.wnext),ue-=Be,ue?(e.arraySet(x.window,ee,_-ue,ue,0),x.wnext=ue,x.whave=x.wsize):(x.wnext+=Be,x.wnext===x.wsize&&(x.wnext=0),x.whave<x.wsize&&(x.whave+=Be))),0}function T($,ee){var _,ue,Be,x,ne,oe,P,W,j,de,ve,Ee,Ue,Tt,V=0,Pe,ct,rt,Qt,Fe,pi,At,Ve,Et=new e.Buf8(4),mr,On,Hu=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!$||!$.state||!$.output||!$.input&&$.avail_in!==0)return p;_=$.state,_.mode===te&&(_.mode=J),ne=$.next_out,Be=$.output,P=$.avail_out,x=$.next_in,ue=$.input,oe=$.avail_in,W=_.hold,j=_.bits,de=oe,ve=P,Ve=f;e:for(;;)switch(_.mode){case v:if(_.wrap===0){_.mode=J;break}for(;j<16;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(_.wrap&2&&W===35615){_.check=0,Et[0]=W&255,Et[1]=W>>>8&255,_.check=n(_.check,Et,2,0),W=0,j=0,_.mode=w;break}if(_.flags=0,_.head&&(_.head.done=!1),!(_.wrap&1)||(((W&255)<<8)+(W>>8))%31){$.msg="incorrect header check",_.mode=R;break}if((W&15)!==y){$.msg="unknown compression method",_.mode=R;break}if(W>>>=4,j-=4,At=(W&15)+8,_.wbits===0)_.wbits=At;else if(At>_.wbits){$.msg="invalid window size",_.mode=R;break}_.dmax=1<<At,$.adler=_.check=1,_.mode=W&512?q:te,W=0,j=0;break;case w:for(;j<16;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(_.flags=W,(_.flags&255)!==y){$.msg="unknown compression method",_.mode=R;break}if(_.flags&57344){$.msg="unknown header flags set",_.mode=R;break}_.head&&(_.head.text=W>>8&1),_.flags&512&&(Et[0]=W&255,Et[1]=W>>>8&255,_.check=n(_.check,Et,2,0)),W=0,j=0,_.mode=S;case S:for(;j<32;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}_.head&&(_.head.time=W),_.flags&512&&(Et[0]=W&255,Et[1]=W>>>8&255,Et[2]=W>>>16&255,Et[3]=W>>>24&255,_.check=n(_.check,Et,4,0)),W=0,j=0,_.mode=E;case E:for(;j<16;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}_.head&&(_.head.xflags=W&255,_.head.os=W>>8),_.flags&512&&(Et[0]=W&255,Et[1]=W>>>8&255,_.check=n(_.check,Et,2,0)),W=0,j=0,_.mode=k;case k:if(_.flags&1024){for(;j<16;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}_.length=W,_.head&&(_.head.extra_len=W),_.flags&512&&(Et[0]=W&255,Et[1]=W>>>8&255,_.check=n(_.check,Et,2,0)),W=0,j=0}else _.head&&(_.head.extra=null);_.mode=M;case M:if(_.flags&1024&&(Ee=_.length,Ee>oe&&(Ee=oe),Ee&&(_.head&&(At=_.head.extra_len-_.length,_.head.extra||(_.head.extra=new Array(_.head.extra_len)),e.arraySet(_.head.extra,ue,x,Ee,At)),_.flags&512&&(_.check=n(_.check,ue,Ee,x)),oe-=Ee,x+=Ee,_.length-=Ee),_.length))break e;_.length=0,_.mode=D;case D:if(_.flags&2048){if(oe===0)break e;Ee=0;do At=ue[x+Ee++],_.head&&At&&_.length<65536&&(_.head.name+=String.fromCharCode(At));while(At&&Ee<oe);if(_.flags&512&&(_.check=n(_.check,ue,Ee,x)),oe-=Ee,x+=Ee,At)break e}else _.head&&(_.head.name=null);_.length=0,_.mode=B;case B:if(_.flags&4096){if(oe===0)break e;Ee=0;do At=ue[x+Ee++],_.head&&At&&_.length<65536&&(_.head.comment+=String.fromCharCode(At));while(At&&Ee<oe);if(_.flags&512&&(_.check=n(_.check,ue,Ee,x)),oe-=Ee,x+=Ee,At)break e}else _.head&&(_.head.comment=null);_.mode=I;case I:if(_.flags&512){for(;j<16;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(W!==(_.check&65535)){$.msg="header crc mismatch",_.mode=R;break}W=0,j=0}_.head&&(_.head.hcrc=_.flags>>9&1,_.head.done=!0),$.adler=_.check=0,_.mode=te;break;case q:for(;j<32;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}$.adler=_.check=wt(W),W=0,j=0,_.mode=Z;case Z:if(_.havedict===0)return $.next_out=ne,$.avail_out=P,$.next_in=x,$.avail_in=oe,_.hold=W,_.bits=j,d;$.adler=_.check=1,_.mode=te;case te:if(ee===c||ee===u)break e;case J:if(_.last){W>>>=j&7,j-=j&7,_.mode=ie;break}for(;j<3;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}switch(_.last=W&1,W>>>=1,j-=1,W&3){case 0:_.mode=ce;break;case 1:if(C(_),_.mode=Ce,ee===u){W>>>=2,j-=2;break e}break;case 2:_.mode=me;break;case 3:$.msg="invalid block type",_.mode=R}W>>>=2,j-=2;break;case ce:for(W>>>=j&7,j-=j&7;j<32;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if((W&65535)!==(W>>>16^65535)){$.msg="invalid stored block lengths",_.mode=R;break}if(_.length=W&65535,W=0,j=0,_.mode=ae,ee===u)break e;case ae:_.mode=we;case we:if(Ee=_.length,Ee){if(Ee>oe&&(Ee=oe),Ee>P&&(Ee=P),Ee===0)break e;e.arraySet(Be,ue,x,Ee,ne),oe-=Ee,x+=Ee,P-=Ee,ne+=Ee,_.length-=Ee;break}_.mode=te;break;case me:for(;j<14;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(_.nlen=(W&31)+257,W>>>=5,j-=5,_.ndist=(W&31)+1,W>>>=5,j-=5,_.ncode=(W&15)+4,W>>>=4,j-=4,_.nlen>286||_.ndist>30){$.msg="too many length or distance symbols",_.mode=R;break}_.have=0,_.mode=U;case U:for(;_.have<_.ncode;){for(;j<3;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}_.lens[Hu[_.have++]]=W&7,W>>>=3,j-=3}for(;_.have<19;)_.lens[Hu[_.have++]]=0;if(_.lencode=_.lendyn,_.lenbits=7,mr={bits:_.lenbits},Ve=i(o,_.lens,0,19,_.lencode,0,_.work,mr),_.lenbits=mr.bits,Ve){$.msg="invalid code lengths set",_.mode=R;break}_.have=0,_.mode=Ae;case Ae:for(;_.have<_.nlen+_.ndist;){for(;V=_.lencode[W&(1<<_.lenbits)-1],Pe=V>>>24,ct=V>>>16&255,rt=V&65535,!(Pe<=j);){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(rt<16)W>>>=Pe,j-=Pe,_.lens[_.have++]=rt;else{if(rt===16){for(On=Pe+2;j<On;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(W>>>=Pe,j-=Pe,_.have===0){$.msg="invalid bit length repeat",_.mode=R;break}At=_.lens[_.have-1],Ee=3+(W&3),W>>>=2,j-=2}else if(rt===17){for(On=Pe+3;j<On;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}W>>>=Pe,j-=Pe,At=0,Ee=3+(W&7),W>>>=3,j-=3}else{for(On=Pe+7;j<On;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}W>>>=Pe,j-=Pe,At=0,Ee=11+(W&127),W>>>=7,j-=7}if(_.have+Ee>_.nlen+_.ndist){$.msg="invalid bit length repeat",_.mode=R;break}for(;Ee--;)_.lens[_.have++]=At}}if(_.mode===R)break;if(_.lens[256]===0){$.msg="invalid code -- missing end-of-block",_.mode=R;break}if(_.lenbits=9,mr={bits:_.lenbits},Ve=i(s,_.lens,0,_.nlen,_.lencode,0,_.work,mr),_.lenbits=mr.bits,Ve){$.msg="invalid literal/lengths set",_.mode=R;break}if(_.distbits=6,_.distcode=_.distdyn,mr={bits:_.distbits},Ve=i(a,_.lens,_.nlen,_.ndist,_.distcode,0,_.work,mr),_.distbits=mr.bits,Ve){$.msg="invalid distances set",_.mode=R;break}if(_.mode=Ce,ee===u)break e;case Ce:_.mode=H;case H:if(oe>=6&&P>=258){$.next_out=ne,$.avail_out=P,$.next_in=x,$.avail_in=oe,_.hold=W,_.bits=j,r($,ve),ne=$.next_out,Be=$.output,P=$.avail_out,x=$.next_in,ue=$.input,oe=$.avail_in,W=_.hold,j=_.bits,_.mode===te&&(_.back=-1);break}for(_.back=0;V=_.lencode[W&(1<<_.lenbits)-1],Pe=V>>>24,ct=V>>>16&255,rt=V&65535,!(Pe<=j);){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(ct&&!(ct&240)){for(Qt=Pe,Fe=ct,pi=rt;V=_.lencode[pi+((W&(1<<Qt+Fe)-1)>>Qt)],Pe=V>>>24,ct=V>>>16&255,rt=V&65535,!(Qt+Pe<=j);){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}W>>>=Qt,j-=Qt,_.back+=Qt}if(W>>>=Pe,j-=Pe,_.back+=Pe,_.length=rt,ct===0){_.mode=re;break}if(ct&32){_.back=-1,_.mode=te;break}if(ct&64){$.msg="invalid literal/length code",_.mode=R;break}_.extra=ct&15,_.mode=ze;case ze:if(_.extra){for(On=_.extra;j<On;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}_.length+=W&(1<<_.extra)-1,W>>>=_.extra,j-=_.extra,_.back+=_.extra}_.was=_.length,_.mode=qe;case qe:for(;V=_.distcode[W&(1<<_.distbits)-1],Pe=V>>>24,ct=V>>>16&255,rt=V&65535,!(Pe<=j);){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(!(ct&240)){for(Qt=Pe,Fe=ct,pi=rt;V=_.distcode[pi+((W&(1<<Qt+Fe)-1)>>Qt)],Pe=V>>>24,ct=V>>>16&255,rt=V&65535,!(Qt+Pe<=j);){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}W>>>=Qt,j-=Qt,_.back+=Qt}if(W>>>=Pe,j-=Pe,_.back+=Pe,ct&64){$.msg="invalid distance code",_.mode=R;break}_.offset=rt,_.extra=ct&15,_.mode=Q;case Q:if(_.extra){for(On=_.extra;j<On;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}_.offset+=W&(1<<_.extra)-1,W>>>=_.extra,j-=_.extra,_.back+=_.extra}if(_.offset>_.dmax){$.msg="invalid distance too far back",_.mode=R;break}_.mode=X;case X:if(P===0)break e;if(Ee=ve-P,_.offset>Ee){if(Ee=_.offset-Ee,Ee>_.whave&&_.sane){$.msg="invalid distance too far back",_.mode=R;break}Ee>_.wnext?(Ee-=_.wnext,Ue=_.wsize-Ee):Ue=_.wnext-Ee,Ee>_.length&&(Ee=_.length),Tt=_.window}else Tt=Be,Ue=ne-_.offset,Ee=_.length;Ee>P&&(Ee=P),P-=Ee,_.length-=Ee;do Be[ne++]=Tt[Ue++];while(--Ee);_.length===0&&(_.mode=H);break;case re:if(P===0)break e;Be[ne++]=_.length,P--,_.mode=H;break;case ie:if(_.wrap){for(;j<32;){if(oe===0)break e;oe--,W|=ue[x++]<<j,j+=8}if(ve-=P,$.total_out+=ve,_.total+=ve,ve&&($.adler=_.check=_.flags?n(_.check,Be,ve,ne-ve):t(_.check,Be,ve,ne-ve)),ve=P,(_.flags?W:wt(W))!==_.check){$.msg="incorrect data check",_.mode=R;break}W=0,j=0}_.mode=ye;case ye:if(_.wrap&&_.flags){for(;j<32;){if(oe===0)break e;oe--,W+=ue[x++]<<j,j+=8}if(W!==(_.total&4294967295)){$.msg="incorrect length check",_.mode=R;break}W=0,j=0}_.mode=L;case L:Ve=h;break e;case R:Ve=m;break e;case se:return b;case pe:default:return p}return $.next_out=ne,$.avail_out=P,$.next_in=x,$.avail_in=oe,_.hold=W,_.bits=j,(_.wsize||ve!==$.avail_out&&_.mode<R&&(_.mode<ie||ee!==l))&&z($,$.output,$.next_out,ve-$.avail_out),de-=$.avail_in,ve-=$.avail_out,$.total_in+=de,$.total_out+=ve,_.total+=ve,_.wrap&&ve&&($.adler=_.check=_.flags?n(_.check,Be,ve,$.next_out-ve):t(_.check,Be,ve,$.next_out-ve)),$.data_type=_.bits+(_.last?64:0)+(_.mode===te?128:0)+(_.mode===Ce||_.mode===ae?256:0),(de===0&&ve===0||ee===l)&&Ve===f&&(Ve=g),Ve}function G($){if(!$||!$.state)return p;var ee=$.state;return ee.window&&(ee.window=null),$.state=null,f}function Y($,ee){var _;return!$||!$.state||(_=$.state,!(_.wrap&2))?p:(_.head=ee,ee.done=!1,f)}function ge($,ee){var _=ee.length,ue,Be,x;return!$||!$.state||(ue=$.state,ue.wrap!==0&&ue.mode!==Z)?p:ue.mode===Z&&(Be=1,Be=t(Be,ee,_,0),Be!==ue.check)?m:(x=z($,ee,_,_),x?(ue.mode=se,b):(ue.havedict=1,f))}return Wn.inflateReset=nt,Wn.inflateReset2=Nt,Wn.inflateResetKeep=Bt,Wn.inflateInit=st,Wn.inflateInit2=Wt,Wn.inflate=T,Wn.inflateEnd=G,Wn.inflateGetHeader=Y,Wn.inflateSetDictionary=ge,Wn.inflateInfo="pako inflate (from Nodeca project)",Wn}var L1,kC;function TC(){return kC||(kC=1,L1={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_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}),L1}var N1,IC;function J$(){if(IC)return N1;IC=1;function e(){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}return N1=e,N1}var _C;function eW(){if(_C)return ka;_C=1;var e=K$(),t=ro(),n=wC(),r=TC(),i=F1(),o=xC(),s=J$(),a=Object.prototype.toString;function l(f){if(!(this instanceof l))return new l(f);this.options=t.assign({chunkSize:16384,windowBits:0,to:""},f||{});var h=this.options;h.raw&&h.windowBits>=0&&h.windowBits<16&&(h.windowBits=-h.windowBits,h.windowBits===0&&(h.windowBits=-15)),h.windowBits>=0&&h.windowBits<16&&!(f&&f.windowBits)&&(h.windowBits+=32),h.windowBits>15&&h.windowBits<48&&(h.windowBits&15||(h.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;var d=e.inflateInit2(this.strm,h.windowBits);if(d!==r.Z_OK)throw new Error(i[d]);if(this.header=new s,e.inflateGetHeader(this.strm,this.header),h.dictionary&&(typeof h.dictionary=="string"?h.dictionary=n.string2buf(h.dictionary):a.call(h.dictionary)==="[object ArrayBuffer]"&&(h.dictionary=new Uint8Array(h.dictionary)),h.raw&&(d=e.inflateSetDictionary(this.strm,h.dictionary),d!==r.Z_OK)))throw new Error(i[d])}l.prototype.push=function(f,h){var d=this.strm,p=this.options.chunkSize,m=this.options.dictionary,b,g,y,v,w,S=!1;if(this.ended)return!1;g=h===~~h?h:h===!0?r.Z_FINISH:r.Z_NO_FLUSH,typeof f=="string"?d.input=n.binstring2buf(f):a.call(f)==="[object ArrayBuffer]"?d.input=new Uint8Array(f):d.input=f,d.next_in=0,d.avail_in=d.input.length;do{if(d.avail_out===0&&(d.output=new t.Buf8(p),d.next_out=0,d.avail_out=p),b=e.inflate(d,r.Z_NO_FLUSH),b===r.Z_NEED_DICT&&m&&(b=e.inflateSetDictionary(this.strm,m)),b===r.Z_BUF_ERROR&&S===!0&&(b=r.Z_OK,S=!1),b!==r.Z_STREAM_END&&b!==r.Z_OK)return this.onEnd(b),this.ended=!0,!1;d.next_out&&(d.avail_out===0||b===r.Z_STREAM_END||d.avail_in===0&&(g===r.Z_FINISH||g===r.Z_SYNC_FLUSH))&&(this.options.to==="string"?(y=n.utf8border(d.output,d.next_out),v=d.next_out-y,w=n.buf2string(d.output,y),d.next_out=v,d.avail_out=p-v,v&&t.arraySet(d.output,d.output,y,v,0),this.onData(w)):this.onData(t.shrinkBuf(d.output,d.next_out))),d.avail_in===0&&d.avail_out===0&&(S=!0)}while((d.avail_in>0||d.avail_out===0)&&b!==r.Z_STREAM_END);return b===r.Z_STREAM_END&&(g=r.Z_FINISH),g===r.Z_FINISH?(b=e.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===r.Z_OK):(g===r.Z_SYNC_FLUSH&&(this.onEnd(r.Z_OK),d.avail_out=0),!0)},l.prototype.onData=function(f){this.chunks.push(f)},l.prototype.onEnd=function(f){f===r.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=t.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg};function c(f,h){var d=new l(h);if(d.push(f,!0),d.err)throw d.msg||i[d.err];return d.result}function u(f,h){return h=h||{},h.raw=!0,c(f,h)}return ka.Inflate=l,ka.inflate=c,ka.inflateRaw=u,ka.ungzip=c,ka}var z1,DC;function tW(){if(DC)return z1;DC=1;var e=ro().assign,t=Q$(),n=eW(),r=TC(),i={};return e(i,t,n,r),z1=i,z1}var ud=tW();async function io(e){try{let t,n=0,r=0;const i=[];let o=0,s;do{const l=e.subarray(n);if(s=new ud.Inflate,{strm:t}=s,s.push(l,ud.Z_SYNC_FLUSH),s.err)throw new Error(s.msg);n+=t.next_in,i[r]=s.result,o+=i[r].length,r+=1}while(t.avail_in);const a=new Uint8Array(o);for(let l=0,c=0;l<i.length;l++)a.set(i[l],c),c+=i[l].length;return ot.Buffer.from(a)}catch(t){throw/incorrect header check/.exec(`${t}`)?new Error("problem decompressing block: incorrect gzip header check"):t}}async function RC(e,t){try{let n;const{minv:r,maxv:i}=t;let o=r.blockPosition,s=r.dataPosition;const a=[],l=[],c=[];let u=0,f=0;do{const p=e.subarray(o-r.blockPosition),m=new ud.Inflate;if({strm:n}=m,m.push(p,ud.Z_SYNC_FLUSH),m.err)throw new Error(m.msg);const b=m.result;a.push(b);let g=b.length;l.push(o),c.push(s),a.length===1&&r.dataPosition&&(a[0]=a[0].subarray(r.dataPosition),g=a[0].length);const y=o;if(o+=n.next_in,s+=g,y>=i.blockPosition){a[f]=a[f].subarray(0,i.blockPosition===r.blockPosition?i.dataPosition-r.dataPosition+1:i.dataPosition+1),l.push(o),c.push(s),u+=a[f].length;break}u+=a[f].length,f++}while(n.avail_in);const h=new Uint8Array(u);for(let p=0,m=0;p<a.length;p++)h.set(a[p],m),m+=a[p].length;return{buffer:ot.Buffer.from(h),cpositions:l,dpositions:c}}catch(n){throw/incorrect header check/.exec(`${n}`)?new Error("problem decompressing block: incorrect gzip header check"):n}}var U1,BC;function nW(){if(BC)return U1;BC=1,U1=t;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function t(B,I,q){this.low=B|0,this.high=I|0,this.unsigned=!!q}t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0});function n(B){return(B&&B.__isLong__)===!0}t.isLong=n;var r={},i={};function o(B,I){var q,Z,te;return I?(B>>>=0,(te=0<=B&&B<256)&&(Z=i[B],Z)?Z:(q=a(B,(B|0)<0?-1:0,!0),te&&(i[B]=q),q)):(B|=0,(te=-128<=B&&B<128)&&(Z=r[B],Z)?Z:(q=a(B,B<0?-1:0,!1),te&&(r[B]=q),q))}t.fromInt=o;function s(B,I){if(isNaN(B))return I?y:g;if(I){if(B<0)return y;if(B>=p)return k}else{if(B<=-9223372036854776e3)return M;if(B+1>=m)return E}return B<0?s(-B,I).neg():a(B%d|0,B/d|0,I)}t.fromNumber=s;function a(B,I,q){return new t(B,I,q)}t.fromBits=a;var l=Math.pow;function c(B,I,q){if(B.length===0)throw Error("empty string");if(B==="NaN"||B==="Infinity"||B==="+Infinity"||B==="-Infinity")return g;if(typeof I=="number"?(q=I,I=!1):I=!!I,q=q||10,q<2||36<q)throw RangeError("radix");var Z;if((Z=B.indexOf("-"))>0)throw Error("interior hyphen");if(Z===0)return c(B.substring(1),I,q).neg();for(var te=s(l(q,8)),J=g,ce=0;ce<B.length;ce+=8){var ae=Math.min(8,B.length-ce),we=parseInt(B.substring(ce,ce+ae),q);if(ae<8){var me=s(l(q,ae));J=J.mul(me).add(s(we))}else J=J.mul(te),J=J.add(s(we))}return J.unsigned=I,J}t.fromString=c;function u(B,I){return typeof B=="number"?s(B,I):typeof B=="string"?c(B,I):a(B.low,B.high,typeof I=="boolean"?I:B.unsigned)}t.fromValue=u;var f=65536,h=1<<24,d=f*f,p=d*d,m=p/2,b=o(h),g=o(0);t.ZERO=g;var y=o(0,!0);t.UZERO=y;var v=o(1);t.ONE=v;var w=o(1,!0);t.UONE=w;var S=o(-1);t.NEG_ONE=S;var E=a(-1,2147483647,!1);t.MAX_VALUE=E;var k=a(-1,-1,!0);t.MAX_UNSIGNED_VALUE=k;var M=a(0,-2147483648,!1);t.MIN_VALUE=M;var D=t.prototype;return D.toInt=function(){return this.unsigned?this.low>>>0:this.low},D.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},D.toString=function(I){if(I=I||10,I<2||36<I)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(M)){var q=s(I),Z=this.div(q),te=Z.mul(q).sub(this);return Z.toString(I)+te.toInt().toString(I)}else return"-"+this.neg().toString(I);for(var J=s(l(I,6),this.unsigned),ce=this,ae="";;){var we=ce.div(J),me=ce.sub(we.mul(J)).toInt()>>>0,U=me.toString(I);if(ce=we,ce.isZero())return U+ae;for(;U.length<6;)U="0"+U;ae=""+U+ae}},D.getHighBits=function(){return this.high},D.getHighBitsUnsigned=function(){return this.high>>>0},D.getLowBits=function(){return this.low},D.getLowBitsUnsigned=function(){return this.low>>>0},D.getNumBitsAbs=function(){if(this.isNegative())return this.eq(M)?64:this.neg().getNumBitsAbs();for(var I=this.high!=0?this.high:this.low,q=31;q>0&&!(I&1<<q);q--);return this.high!=0?q+33:q+1},D.isZero=function(){return this.high===0&&this.low===0},D.eqz=D.isZero,D.isNegative=function(){return!this.unsigned&&this.high<0},D.isPositive=function(){return this.unsigned||this.high>=0},D.isOdd=function(){return(this.low&1)===1},D.isEven=function(){return(this.low&1)===0},D.equals=function(I){return n(I)||(I=u(I)),this.unsigned!==I.unsigned&&this.high>>>31===1&&I.high>>>31===1?!1:this.high===I.high&&this.low===I.low},D.eq=D.equals,D.notEquals=function(I){return!this.eq(I)},D.neq=D.notEquals,D.ne=D.notEquals,D.lessThan=function(I){return this.comp(I)<0},D.lt=D.lessThan,D.lessThanOrEqual=function(I){return this.comp(I)<=0},D.lte=D.lessThanOrEqual,D.le=D.lessThanOrEqual,D.greaterThan=function(I){return this.comp(I)>0},D.gt=D.greaterThan,D.greaterThanOrEqual=function(I){return this.comp(I)>=0},D.gte=D.greaterThanOrEqual,D.ge=D.greaterThanOrEqual,D.compare=function(I){if(n(I)||(I=u(I)),this.eq(I))return 0;var q=this.isNegative(),Z=I.isNegative();return q&&!Z?-1:!q&&Z?1:this.unsigned?I.high>>>0>this.high>>>0||I.high===this.high&&I.low>>>0>this.low>>>0?-1:1:this.sub(I).isNegative()?-1:1},D.comp=D.compare,D.negate=function(){return!this.unsigned&&this.eq(M)?M:this.not().add(v)},D.neg=D.negate,D.add=function(I){n(I)||(I=u(I));var q=this.high>>>16,Z=this.high&65535,te=this.low>>>16,J=this.low&65535,ce=I.high>>>16,ae=I.high&65535,we=I.low>>>16,me=I.low&65535,U=0,Ae=0,Ce=0,H=0;return H+=J+me,Ce+=H>>>16,H&=65535,Ce+=te+we,Ae+=Ce>>>16,Ce&=65535,Ae+=Z+ae,U+=Ae>>>16,Ae&=65535,U+=q+ce,U&=65535,a(Ce<<16|H,U<<16|Ae,this.unsigned)},D.subtract=function(I){return n(I)||(I=u(I)),this.add(I.neg())},D.sub=D.subtract,D.multiply=function(I){if(this.isZero())return g;if(n(I)||(I=u(I)),e){var q=e.mul(this.low,this.high,I.low,I.high);return a(q,e.get_high(),this.unsigned)}if(I.isZero())return g;if(this.eq(M))return I.isOdd()?M:g;if(I.eq(M))return this.isOdd()?M:g;if(this.isNegative())return I.isNegative()?this.neg().mul(I.neg()):this.neg().mul(I).neg();if(I.isNegative())return this.mul(I.neg()).neg();if(this.lt(b)&&I.lt(b))return s(this.toNumber()*I.toNumber(),this.unsigned);var Z=this.high>>>16,te=this.high&65535,J=this.low>>>16,ce=this.low&65535,ae=I.high>>>16,we=I.high&65535,me=I.low>>>16,U=I.low&65535,Ae=0,Ce=0,H=0,ze=0;return ze+=ce*U,H+=ze>>>16,ze&=65535,H+=J*U,Ce+=H>>>16,H&=65535,H+=ce*me,Ce+=H>>>16,H&=65535,Ce+=te*U,Ae+=Ce>>>16,Ce&=65535,Ce+=J*me,Ae+=Ce>>>16,Ce&=65535,Ce+=ce*we,Ae+=Ce>>>16,Ce&=65535,Ae+=Z*U+te*me+J*we+ce*ae,Ae&=65535,a(H<<16|ze,Ae<<16|Ce,this.unsigned)},D.mul=D.multiply,D.divide=function(I){if(n(I)||(I=u(I)),I.isZero())throw Error("division by zero");if(e){if(!this.unsigned&&this.high===-2147483648&&I.low===-1&&I.high===-1)return this;var q=(this.unsigned?e.div_u:e.div_s)(this.low,this.high,I.low,I.high);return a(q,e.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?y:g;var Z,te,J;if(this.unsigned){if(I.unsigned||(I=I.toUnsigned()),I.gt(this))return y;if(I.gt(this.shru(1)))return w;J=y}else{if(this.eq(M)){if(I.eq(v)||I.eq(S))return M;if(I.eq(M))return v;var ce=this.shr(1);return Z=ce.div(I).shl(1),Z.eq(g)?I.isNegative()?v:S:(te=this.sub(I.mul(Z)),J=Z.add(te.div(I)),J)}else if(I.eq(M))return this.unsigned?y:g;if(this.isNegative())return I.isNegative()?this.neg().div(I.neg()):this.neg().div(I).neg();if(I.isNegative())return this.div(I.neg()).neg();J=g}for(te=this;te.gte(I);){Z=Math.max(1,Math.floor(te.toNumber()/I.toNumber()));for(var ae=Math.ceil(Math.log(Z)/Math.LN2),we=ae<=48?1:l(2,ae-48),me=s(Z),U=me.mul(I);U.isNegative()||U.gt(te);)Z-=we,me=s(Z,this.unsigned),U=me.mul(I);me.isZero()&&(me=v),J=J.add(me),te=te.sub(U)}return J},D.div=D.divide,D.modulo=function(I){if(n(I)||(I=u(I)),e){var q=(this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,I.low,I.high);return a(q,e.get_high(),this.unsigned)}return this.sub(this.div(I).mul(I))},D.mod=D.modulo,D.rem=D.modulo,D.not=function(){return a(~this.low,~this.high,this.unsigned)},D.and=function(I){return n(I)||(I=u(I)),a(this.low&I.low,this.high&I.high,this.unsigned)},D.or=function(I){return n(I)||(I=u(I)),a(this.low|I.low,this.high|I.high,this.unsigned)},D.xor=function(I){return n(I)||(I=u(I)),a(this.low^I.low,this.high^I.high,this.unsigned)},D.shiftLeft=function(I){return n(I)&&(I=I.toInt()),(I&=63)===0?this:I<32?a(this.low<<I,this.high<<I|this.low>>>32-I,this.unsigned):a(0,this.low<<I-32,this.unsigned)},D.shl=D.shiftLeft,D.shiftRight=function(I){return n(I)&&(I=I.toInt()),(I&=63)===0?this:I<32?a(this.low>>>I|this.high<<32-I,this.high>>I,this.unsigned):a(this.high>>I-32,this.high>=0?0:-1,this.unsigned)},D.shr=D.shiftRight,D.shiftRightUnsigned=function(I){if(n(I)&&(I=I.toInt()),I&=63,I===0)return this;var q=this.high;if(I<32){var Z=this.low;return a(Z>>>I|q<<32-I,q>>>I,this.unsigned)}else return I===32?a(q,0,this.unsigned):a(q>>>I-32,0,this.unsigned)},D.shru=D.shiftRightUnsigned,D.shr_u=D.shiftRightUnsigned,D.toSigned=function(){return this.unsigned?a(this.low,this.high,!1):this},D.toUnsigned=function(){return this.unsigned?this:a(this.low,this.high,!0)},D.toBytes=function(I){return I?this.toBytesLE():this.toBytesBE()},D.toBytesLE=function(){var I=this.high,q=this.low;return[q&255,q>>>8&255,q>>>16&255,q>>>24,I&255,I>>>8&255,I>>>16&255,I>>>24]},D.toBytesBE=function(){var I=this.high,q=this.low;return[I>>>24,I>>>16&255,I>>>8&255,I&255,q>>>24,q>>>16&255,q>>>8&255,q&255]},t.fromBytes=function(I,q,Z){return Z?t.fromBytesLE(I,q):t.fromBytesBE(I,q)},t.fromBytesLE=function(I,q){return new t(I[0]|I[1]<<8|I[2]<<16|I[3]<<24,I[4]|I[5]<<8|I[6]<<16|I[7]<<24,q)},t.fromBytesBE=function(I,q){return new t(I[4]<<24|I[5]<<16|I[6]<<8|I[7],I[0]<<24|I[1]<<16|I[2]<<8|I[3],q)},U1}var rW=nW();const fd=ld(rW),hd=1;class iW{constructor({filehandle:t,path:n}){if(t)this.filehandle=t;else if(n)this.filehandle=new qt(n);else throw new TypeError("either filehandle or path must be defined")}_readLongWithOverflow(t,n=0,r=!0){const i=fd.fromBytesLE(t.slice(n,n+8),r);if(i.greaterThan(Number.MAX_SAFE_INTEGER)||i.lessThan(Number.MIN_SAFE_INTEGER))throw new TypeError("integer overflow");return i.toNumber()}_getIndex(){return this.index||(this.index=this._readIndex()),this.index}async _readIndex(){let t=ot.Buffer.allocUnsafe(8);await this.filehandle.read(t,0,8,0);const n=this._readLongWithOverflow(t,0,!0);if(!n)return[[0,0]];const r=new Array(n+1);r[0]=[0,0];const i=8*2*n;if(i>Number.MAX_SAFE_INTEGER)throw new TypeError("integer overflow");t=ot.Buffer.allocUnsafe(i),await this.filehandle.read(t,0,i,8);for(let o=0;o<n;o+=1){const s=this._readLongWithOverflow(t,o*16),a=this._readLongWithOverflow(t,o*16+8);r[o+1]=[s,a]}return r}async getLastBlock(){const t=await this._getIndex();if(t.length)return t[t.length-1]}async getRelevantBlocksForRead(t,n){const r=n+t;if(t===0)return[];const i=await this._getIndex(),o=[],s=(h,d)=>{const p=h[hd],m=d?d[hd]:1/0;return p<=n&&m>n?0:p<n?-1:1};let a=0,l=i.length-1,c=Math.floor(i.length/2),u=s(i[c],i[c+1]);for(;u!==0;)u>0?l=c-1:u<0&&(a=c+1),c=Math.ceil((l-a)/2)+a,u=s(i[c],i[c+1]);o.push(i[c]);let f=c+1;for(;f<i.length&&(o.push(i[f]),!(i[f][hd]>=r));f+=1);return o[o.length-1][hd]<r&&o.push([]),o}}class FC{constructor({filehandle:t,path:n,gziFilehandle:r,gziPath:i}){if(t)this.filehandle=t;else if(n)this.filehandle=new qt(n);else throw new TypeError("either filehandle or path must be defined");if(!r&&!i&&!n)throw new TypeError("either gziFilehandle or gziPath must be defined");this.gzi=new iW({filehandle:r,path:!r&&!i&&n?i:`${n}.gzi`})}async stat(){const t=await this.filehandle.stat();return Object.assign(t,{size:await this.getUncompressedFileSize(),blocks:void 0,blksize:void 0})}async getUncompressedFileSize(){const[,t]=await this.gzi.getLastBlock(),{size:n}=await this.filehandle.stat(),r=ot.Buffer.allocUnsafe(4),{bytesRead:i}=await this.filehandle.read(r,0,4,n-28-4);if(i!==4)throw new Error("read error");const o=r.readUInt32LE(0);return t+o}async _readAndUncompressBlock(t,[n],[r]){let i=r;i||(i=(await this.filehandle.stat()).size);const o=i-n;return await this.filehandle.read(t,0,o,n),await io(t.slice(0,o))}async read(t,n,r,i){const o=await this.gzi.getRelevantBlocksForRead(r,i),s=ot.Buffer.allocUnsafe(32768*2);let a=n,l=0;for(let c=0;c<o.length-1;c+=1){const u=await this._readAndUncompressBlock(s,o[c],o[c+1]),[,f]=o[c],h=f>=i?0:i-f,d=Math.min(i+r,f+u.length)-f;h>=0&&h<u.length&&(u.copy(t,a,h,d),a+=d-h,l+=d-h)}return{bytesRead:l,buffer:t}}}function MC(e,t){return e.offset+e.lineBytes*Math.floor(t/e.lineLength)+t%e.lineLength}async function oW(e,t){const n=await e.readFile(t);if(!(n!=null&&n.length))throw new Error("No data read from FASTA index (FAI) file");let r=0,i;const o=n.toString("utf8").split(/\r?\n/).filter(s=>/\S/.test(s)).map(s=>s.split(" ")).filter(s=>s[0]!=="").map(s=>((!i||i.name!==s[0])&&(i={name:s[0],id:r},r+=1),{id:i.id,name:s[0],length:+s[1],start:0,end:+s[1],offset:+s[2],lineLength:+s[3],lineBytes:+s[4]}));return{name:Object.fromEntries(o.map(s=>[s.name,s])),id:Object.fromEntries(o.map(s=>[s.id,s]))}}class PC{constructor({fasta:t,fai:n,path:r,faiPath:i}){if(t)this.fasta=t;else if(r)this.fasta=new qt(r);else throw new Error("Need to pass filehandle for fasta or path to localfile");if(n)this.fai=n;else if(i)this.fai=new qt(i);else if(r)this.fai=new qt(`${r}.fai`);else throw new Error("Need to pass filehandle for or path to localfile")}async _getIndexes(t){return this.indexes||(this.indexes=oW(this.fai,t)),this.indexes}async getSequenceNames(t){return Object.keys((await this._getIndexes(t)).name)}async getSequenceSizes(t){const n={},r=await this._getIndexes(t);for(const i of Object.values(r.id))n[i.name]=i.length;return n}async getSequenceSize(t,n){var r;return(r=(await this._getIndexes(n)).name[t])===null||r===void 0?void 0:r.length}async hasReferenceSequence(t,n){return!!(await this._getIndexes(n)).name[t]}async getResiduesById(t,n,r,i){const o=(await this._getIndexes(i)).id[t];if(o)return this._fetchFromIndexEntry(o,n,r,i)}async getResiduesByName(t,n,r,i){const o=(await this._getIndexes(i)).name[t];if(o)return this._fetchFromIndexEntry(o,n,r,i)}async getSequence(t,n,r,i){return this.getResiduesByName(t,n,r,i)}async _fetchFromIndexEntry(t,n=0,r,i){let o=r;if(n<0)throw new TypeError("regionStart cannot be less than 0");if((o===void 0||o>t.length)&&(o=t.length),n>=o)return"";const s=MC(t,n),a=MC(t,o)-s,l=ot.Buffer.allocUnsafe(a);return await this.fasta.read(l,0,a,s,i),l.toString("utf8").replace(/\s+/g,"")}}class sW extends PC{constructor({fasta:t,path:n,fai:r,faiPath:i,gzi:o,gziPath:s}){super({fasta:t,path:n,fai:r,faiPath:i}),t&&o?this.fasta=new FC({filehandle:t,gziFilehandle:o}):n&&s&&(this.fasta=new FC({path:n,gziPath:s}))}}function OC(e){return e.split(">").filter(t=>/\S/.test(t)).map(t=>{const[n,...r]=t.split(`
3762
+ `),[i,...o]=n.split(" "),s=r.join("").replace(/\s/g,"");return{id:i,description:o.join(" "),sequence:s}})}class aW{constructor({fasta:t,path:n}){if(t)this.fasta=t;else if(n)this.fasta=new qt(n);else throw new Error("Need to pass fasta or path");this.data=this.fasta.readFile().then(r=>{const i=r.toString("utf8");return OC(i)})}async fetch(t,n,r){const o=(await this.data).find(a=>a.id===t),s=r-n;if(!o)throw new Error(`no sequence with id ${t} exists`);return o.sequence.slice(n,s)}async getSequenceNames(){return(await this.data).map(n=>n.id)}}const lW=Object.freeze(Object.defineProperty({__proto__:null,BgzipIndexedFasta:sW,FetchableSmallFasta:aW,IndexedFasta:PC,parseSmallFasta:OC},Symbol.toStringTag,{value:"Module"})),LC=BigInt(32);function cW(e,t,n){const r=+!!n,i=+!n;return BigInt(e.getInt32(t,n)*i+e.getInt32(t+4,n)*r)<<LC|BigInt(e.getUint32(t,n)*r+e.getUint32(t+4,n)*i)}function uW(e,t,n){const r=e.getUint32(t,n),i=e.getUint32(t+4,n),o=+!!n,s=+!n;return BigInt(r*s+i*o)<<LC|BigInt(r*o+i*s)}"getBigInt64"in DataView||(DataView.prototype.getBigInt64=function(e,t){return cW(this,e,t)}),"getBigUint64"in DataView||(DataView.prototype.getBigUint64=function(e,t){return uW(this,e,t)});class fW{}class hW{constructor(){this.signals=new Set,this.abortController=new AbortController}addSignal(t=new fW){if(this.signal.aborted)throw new Error("cannot add a signal, already aborted!");this.signals.add(t),t.aborted?this.handleAborted(t):typeof t.addEventListener=="function"&&t.addEventListener("abort",()=>{this.handleAborted(t)})}handleAborted(t){this.signals.delete(t),this.signals.size===0&&this.abortController.abort()}get signal(){return this.abortController.signal}abort(){this.abortController.abort()}}class dW{constructor(){this.callbacks=new Set}addCallback(t=()=>{}){this.callbacks.add(t),t(this.currentMessage)}callback(t){this.currentMessage=t;for(const n of this.callbacks)n(t)}}class hs{constructor({fill:t,cache:n}){if(typeof t!="function")throw new TypeError("must pass a fill function");if(typeof n!="object")throw new TypeError("must pass a cache object");if(typeof n.get!="function"||typeof n.set!="function"||typeof n.delete!="function")throw new TypeError("cache must implement get(key), set(key, val), and and delete(key)");this.cache=n,this.fillCallback=t}static isAbortException(t){return t.name==="AbortError"||t.code==="ERR_ABORTED"||t.message==="AbortError: aborted"||t.message==="Error: aborted"}evict(t,n){this.cache.get(t)===n&&this.cache.delete(t)}fill(t,n,r,i){const o=new hW,s=new dW;s.addCallback(i);const a={aborter:o,promise:this.fillCallback(n,o.signal,l=>{s.callback(l)}),settled:!1,statusReporter:s,get aborted(){return this.aborter.signal.aborted}};a.aborter.addSignal(r),a.aborter.signal.addEventListener("abort",()=>{a.settled||this.evict(t,a)}),a.promise.then(()=>{a.settled=!0},()=>{a.settled=!0,this.evict(t,a)}).catch(l=>{throw console.error(l),l}),this.cache.set(t,a)}static checkSinglePromise(t,n){function r(){if(n!=null&&n.aborted)throw Object.assign(new Error("aborted"),{code:"ERR_ABORTED"})}return t.then(i=>(r(),i),i=>{throw r(),i})}has(t){return this.cache.has(t)}get(t,n,r,i){if(!r&&n instanceof AbortSignal)throw new TypeError("second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?");const o=this.cache.get(t);return o?o.aborted&&!o.settled?(this.evict(t,o),this.get(t,n,r,i)):o.settled?o.promise:(o.aborter.addSignal(r),o.statusReporter.addCallback(i),hs.checkSinglePromise(o.promise,r)):(this.fill(t,n,r,i),hs.checkSinglePromise(this.cache.get(t).promise,r))}delete(t){const n=this.cache.get(t);n&&(n.settled||n.aborter.abort(),this.cache.delete(t))}clear(){const t=this.cache.keys();let n=0;for(let r=t.next();!r.done;r=t.next())this.delete(r.value),n+=1;return n}}var H1,NC;function pW(){if(NC)return H1;NC=1;class e{constructor(n={}){if(!(n.maxSize&&n.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=n.maxSize,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(n,r){this.cache.set(n,r),this._size++,this._size>=this.maxSize&&(this._size=0,this.oldCache=this.cache,this.cache=new Map)}get(n){if(this.cache.has(n))return this.cache.get(n);if(this.oldCache.has(n)){const r=this.oldCache.get(n);return this.oldCache.delete(n),this._set(n,r),r}}set(n,r){return this.cache.has(n)?this.cache.set(n,r):this._set(n,r),this}has(n){return this.cache.has(n)||this.oldCache.has(n)}peek(n){if(this.cache.has(n))return this.cache.get(n);if(this.oldCache.has(n))return this.oldCache.get(n)}delete(n){const r=this.cache.delete(n);return r&&this._size--,this.oldCache.delete(n)||r}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(const[n]of this)yield n}*values(){for(const[,n]of this)yield n}*[Symbol.iterator](){for(const n of this.cache)yield n;for(const n of this.oldCache){const[r]=n;this.cache.has(r)||(yield n)}}get size(){let n=0;for(const r of this.oldCache.keys())this.cache.has(r)||n++;return this._size+n}}return H1=e,H1}var gW=pW();const dd=ld(gW);class Ta{constructor(t){this.ranges=t}get min(){return this.ranges[0].min}get max(){return this.ranges.at(-1).max}contains(t){for(const n of this.ranges)if(n.min<=t&&n.max>=t)return!0;return!1}isContiguous(){return this.ranges.length>1}getRanges(){return this.ranges.map(t=>new Ta([{min:t.min,max:t.max}]))}toString(){return this.ranges.map(t=>`[${t.min}-${t.max}]`).join(",")}union(t){const n=[...this.getRanges(),...t.getRanges()].sort((o,s)=>o.min<s.min?-1:o.min>s.min?1:o.max<s.max?-1:s.max>o.max?1:0),r=[];let i=n[0];for(const o of n)o.min>i.max+1?(r.push(i),i=o):o.max>i.max&&(i=new Ta([{min:i.min,max:o.max}]));return r.push(i),r.length===1?r[0]:new Ta(r)}}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function Ia(e){let t=e.length;for(;--t>=0;)e[t]=0}const mW=3,bW=258,zC=29,yW=256+1+zC,UC=30,wW=512,vW=new Array((yW+2)*2);Ia(vW);const xW=new Array(UC*2);Ia(xW);const AW=new Array(wW);Ia(AW);const EW=new Array(bW-mW+1);Ia(EW);const SW=new Array(zC);Ia(SW);const CW=new Array(UC);Ia(CW);var G1=(e,t,n,r)=>{let i=e&65535|0,o=e>>>16&65535|0,s=0;for(;n!==0;){s=n>2e3?2e3:n,n-=s;do i=i+t[r++]|0,o=o+i|0;while(--s);i%=65521,o%=65521}return i|o<<16|0};const kW=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},TW=new Uint32Array(kW());var Nr=(e,t,n,r)=>{const i=TW,o=r+n;e^=-1;for(let s=r;s<o;s++)e=e>>>8^i[(e^t[s])&255];return e^-1},j1={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"},HC={Z_NO_FLUSH:0,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_DEFLATED:8};const IW=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var _W=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)IW(n,r)&&(e[r]=n[r])}}return e},DW=e=>{let t=0;for(let r=0,i=e.length;r<i;r++)t+=e[r].length;const n=new Uint8Array(t);for(let r=0,i=0,o=e.length;r<o;r++){let s=e[r];n.set(s,i),i+=s.length}return n},GC={assign:_W,flattenChunks:DW};let jC=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{jC=!1}const su=new Uint8Array(256);for(let e=0;e<256;e++)su[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;su[254]=su[254]=1;var RW=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,o,s=e.length,a=0;for(i=0;i<s;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<s&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),a+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(a),o=0,i=0;o<a;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<s&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[o++]=n:n<2048?(t[o++]=192|n>>>6,t[o++]=128|n&63):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|n&63):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|n&63);return t};const BW=(e,t)=>{if(t<65534&&e.subarray&&jC)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n};var FW=(e,t)=>{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const o=new Array(n*2);for(i=0,r=0;r<n;){let s=e[r++];if(s<128){o[i++]=s;continue}let a=su[s];if(a>4){o[i++]=65533,r+=a-1;continue}for(s&=a===2?31:a===3?15:7;a>1&&r<n;)s=s<<6|e[r++]&63,a--;if(a>1){o[i++]=65533;continue}s<65536?o[i++]=s:(s-=65536,o[i++]=55296|s>>10&1023,o[i++]=56320|s&1023)}return BW(o,i)},MW=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+su[e[n]]>t?n:t},V1={string2buf:RW,buf2string:FW,utf8border:MW};function PW(){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}var OW=PW;const pd=16209,LW=16191;var NW=function(t,n){let r,i,o,s,a,l,c,u,f,h,d,p,m,b,g,y,v,w,S,E,k,M,D,B;const I=t.state;r=t.next_in,D=t.input,i=r+(t.avail_in-5),o=t.next_out,B=t.output,s=o-(n-t.avail_out),a=o+(t.avail_out-257),l=I.dmax,c=I.wsize,u=I.whave,f=I.wnext,h=I.window,d=I.hold,p=I.bits,m=I.lencode,b=I.distcode,g=(1<<I.lenbits)-1,y=(1<<I.distbits)-1;e:do{p<15&&(d+=D[r++]<<p,p+=8,d+=D[r++]<<p,p+=8),v=m[d&g];t:for(;;){if(w=v>>>24,d>>>=w,p-=w,w=v>>>16&255,w===0)B[o++]=v&65535;else if(w&16){S=v&65535,w&=15,w&&(p<w&&(d+=D[r++]<<p,p+=8),S+=d&(1<<w)-1,d>>>=w,p-=w),p<15&&(d+=D[r++]<<p,p+=8,d+=D[r++]<<p,p+=8),v=b[d&y];n:for(;;){if(w=v>>>24,d>>>=w,p-=w,w=v>>>16&255,w&16){if(E=v&65535,w&=15,p<w&&(d+=D[r++]<<p,p+=8,p<w&&(d+=D[r++]<<p,p+=8)),E+=d&(1<<w)-1,E>l){t.msg="invalid distance too far back",I.mode=pd;break e}if(d>>>=w,p-=w,w=o-s,E>w){if(w=E-w,w>u&&I.sane){t.msg="invalid distance too far back",I.mode=pd;break e}if(k=0,M=h,f===0){if(k+=c-w,w<S){S-=w;do B[o++]=h[k++];while(--w);k=o-E,M=B}}else if(f<w){if(k+=c+f-w,w-=f,w<S){S-=w;do B[o++]=h[k++];while(--w);if(k=0,f<S){w=f,S-=w;do B[o++]=h[k++];while(--w);k=o-E,M=B}}}else if(k+=f-w,w<S){S-=w;do B[o++]=h[k++];while(--w);k=o-E,M=B}for(;S>2;)B[o++]=M[k++],B[o++]=M[k++],B[o++]=M[k++],S-=3;S&&(B[o++]=M[k++],S>1&&(B[o++]=M[k++]))}else{k=o-E;do B[o++]=B[k++],B[o++]=B[k++],B[o++]=B[k++],S-=3;while(S>2);S&&(B[o++]=B[k++],S>1&&(B[o++]=B[k++]))}}else if(w&64){t.msg="invalid distance code",I.mode=pd;break e}else{v=b[(v&65535)+(d&(1<<w)-1)];continue n}break}}else if(w&64)if(w&32){I.mode=LW;break e}else{t.msg="invalid literal/length code",I.mode=pd;break e}else{v=m[(v&65535)+(d&(1<<w)-1)];continue t}break}}while(r<i&&o<a);S=p>>3,r-=S,p-=S<<3,d&=(1<<p)-1,t.next_in=r,t.next_out=o,t.avail_in=r<i?5+(i-r):5-(r-i),t.avail_out=o<a?257+(a-o):257-(o-a),I.hold=d,I.bits=p};const _a=15,VC=852,qC=592,$C=0,q1=1,WC=2,zW=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]),UW=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]),HW=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]),GW=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 au=(e,t,n,r,i,o,s,a)=>{const l=a.bits;let c=0,u=0,f=0,h=0,d=0,p=0,m=0,b=0,g=0,y=0,v,w,S,E,k,M=null,D;const B=new Uint16Array(_a+1),I=new Uint16Array(_a+1);let q=null,Z,te,J;for(c=0;c<=_a;c++)B[c]=0;for(u=0;u<r;u++)B[t[n+u]]++;for(d=l,h=_a;h>=1&&B[h]===0;h--);if(d>h&&(d=h),h===0)return i[o++]=1<<24|64<<16|0,i[o++]=1<<24|64<<16|0,a.bits=1,0;for(f=1;f<h&&B[f]===0;f++);for(d<f&&(d=f),b=1,c=1;c<=_a;c++)if(b<<=1,b-=B[c],b<0)return-1;if(b>0&&(e===$C||h!==1))return-1;for(I[1]=0,c=1;c<_a;c++)I[c+1]=I[c]+B[c];for(u=0;u<r;u++)t[n+u]!==0&&(s[I[t[n+u]]++]=u);if(e===$C?(M=q=s,D=20):e===q1?(M=zW,q=UW,D=257):(M=HW,q=GW,D=0),y=0,u=0,c=f,k=o,p=d,m=0,S=-1,g=1<<d,E=g-1,e===q1&&g>VC||e===WC&&g>qC)return 1;for(;;){Z=c-m,s[u]+1<D?(te=0,J=s[u]):s[u]>=D?(te=q[s[u]-D],J=M[s[u]-D]):(te=96,J=0),v=1<<c-m,w=1<<p,f=w;do w-=v,i[k+(y>>m)+w]=Z<<24|te<<16|J|0;while(w!==0);for(v=1<<c-1;y&v;)v>>=1;if(v!==0?(y&=v-1,y+=v):y=0,u++,--B[c]===0){if(c===h)break;c=t[n+s[u]]}if(c>d&&(y&E)!==S){for(m===0&&(m=d),k+=f,p=c-m,b=1<<p;p+m<h&&(b-=B[p+m],!(b<=0));)p++,b<<=1;if(g+=1<<p,e===q1&&g>VC||e===WC&&g>qC)return 1;S=y&E,i[S]=d<<24|p<<16|k-o|0}}return y!==0&&(i[k+y]=c-m<<24|64<<16|0),a.bits=d,0};const jW=0,YC=1,QC=2,{Z_FINISH:ZC,Z_BLOCK:VW,Z_TREES:gd,Z_OK:ds,Z_STREAM_END:qW,Z_NEED_DICT:$W,Z_STREAM_ERROR:Yn,Z_DATA_ERROR:XC,Z_MEM_ERROR:KC,Z_BUF_ERROR:WW,Z_DEFLATED:JC}=HC,md=16180,e6=16181,t6=16182,n6=16183,r6=16184,i6=16185,o6=16186,s6=16187,a6=16188,l6=16189,bd=16190,si=16191,$1=16192,c6=16193,W1=16194,u6=16195,f6=16196,h6=16197,d6=16198,yd=16199,wd=16200,p6=16201,g6=16202,m6=16203,b6=16204,y6=16205,Y1=16206,w6=16207,v6=16208,yt=16209,x6=16210,A6=16211,YW=852,QW=592,ZW=15,E6=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function XW(){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 ps=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<md||t.mode>A6?1:0},S6=e=>{if(ps(e))return Yn;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=md,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(YW),t.distcode=t.distdyn=new Int32Array(QW),t.sane=1,t.back=-1,ds},C6=e=>{if(ps(e))return Yn;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,S6(e)},k6=(e,t)=>{let n;if(ps(e))return Yn;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Yn:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,C6(e))},T6=(e,t)=>{if(!e)return Yn;const n=new XW;e.state=n,n.strm=e,n.window=null,n.mode=md;const r=k6(e,t);return r!==ds&&(e.state=null),r},KW=e=>T6(e,ZW);let I6=!0,Q1,Z1;const JW=e=>{if(I6){Q1=new Int32Array(512),Z1=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(au(YC,e.lens,0,288,Q1,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;au(QC,e.lens,0,32,Z1,0,e.work,{bits:5}),I6=!1}e.lencode=Q1,e.lenbits=9,e.distcode=Z1,e.distbits=5},_6=(e,t,n,r)=>{let i;const o=e.state;return o.window===null&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),r>=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(t.subarray(n-r,n-r+i),o.wnext),r-=i,r?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0},eY=(e,t)=>{let n,r,i,o,s,a,l,c,u,f,h,d,p,m,b=0,g,y,v,w,S,E,k,M;const D=new Uint8Array(4);let B,I;const q=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ps(e)||!e.output||!e.input&&e.avail_in!==0)return Yn;n=e.state,n.mode===si&&(n.mode=$1),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,a=e.avail_in,c=n.hold,u=n.bits,f=a,h=l,M=ds;e:for(;;)switch(n.mode){case md:if(n.wrap===0){n.mode=$1;break}for(;u<16;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(n.wrap&2&&c===35615){n.wbits===0&&(n.wbits=15),n.check=0,D[0]=c&255,D[1]=c>>>8&255,n.check=Nr(n.check,D,2,0),c=0,u=0,n.mode=e6;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((c&255)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=yt;break}if((c&15)!==JC){e.msg="unknown compression method",n.mode=yt;break}if(c>>>=4,u-=4,k=(c&15)+8,n.wbits===0&&(n.wbits=k),k>15||k>n.wbits){e.msg="invalid window size",n.mode=yt;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=c&512?l6:si,c=0,u=0;break;case e6:for(;u<16;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(n.flags=c,(n.flags&255)!==JC){e.msg="unknown compression method",n.mode=yt;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=yt;break}n.head&&(n.head.text=c>>8&1),n.flags&512&&n.wrap&4&&(D[0]=c&255,D[1]=c>>>8&255,n.check=Nr(n.check,D,2,0)),c=0,u=0,n.mode=t6;case t6:for(;u<32;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}n.head&&(n.head.time=c),n.flags&512&&n.wrap&4&&(D[0]=c&255,D[1]=c>>>8&255,D[2]=c>>>16&255,D[3]=c>>>24&255,n.check=Nr(n.check,D,4,0)),c=0,u=0,n.mode=n6;case n6:for(;u<16;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}n.head&&(n.head.xflags=c&255,n.head.os=c>>8),n.flags&512&&n.wrap&4&&(D[0]=c&255,D[1]=c>>>8&255,n.check=Nr(n.check,D,2,0)),c=0,u=0,n.mode=r6;case r6:if(n.flags&1024){for(;u<16;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}n.length=c,n.head&&(n.head.extra_len=c),n.flags&512&&n.wrap&4&&(D[0]=c&255,D[1]=c>>>8&255,n.check=Nr(n.check,D,2,0)),c=0,u=0}else n.head&&(n.head.extra=null);n.mode=i6;case i6:if(n.flags&1024&&(d=n.length,d>a&&(d=a),d&&(n.head&&(k=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+d),k)),n.flags&512&&n.wrap&4&&(n.check=Nr(n.check,r,d,o)),a-=d,o+=d,n.length-=d),n.length))break e;n.length=0,n.mode=o6;case o6:if(n.flags&2048){if(a===0)break e;d=0;do k=r[o+d++],n.head&&k&&n.length<65536&&(n.head.name+=String.fromCharCode(k));while(k&&d<a);if(n.flags&512&&n.wrap&4&&(n.check=Nr(n.check,r,d,o)),a-=d,o+=d,k)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=s6;case s6:if(n.flags&4096){if(a===0)break e;d=0;do k=r[o+d++],n.head&&k&&n.length<65536&&(n.head.comment+=String.fromCharCode(k));while(k&&d<a);if(n.flags&512&&n.wrap&4&&(n.check=Nr(n.check,r,d,o)),a-=d,o+=d,k)break e}else n.head&&(n.head.comment=null);n.mode=a6;case a6:if(n.flags&512){for(;u<16;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(n.wrap&4&&c!==(n.check&65535)){e.msg="header crc mismatch",n.mode=yt;break}c=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=si;break;case l6:for(;u<32;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}e.adler=n.check=E6(c),c=0,u=0,n.mode=bd;case bd:if(n.havedict===0)return e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,n.hold=c,n.bits=u,$W;e.adler=n.check=1,n.mode=si;case si:if(t===VW||t===gd)break e;case $1:if(n.last){c>>>=u&7,u-=u&7,n.mode=Y1;break}for(;u<3;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}switch(n.last=c&1,c>>>=1,u-=1,c&3){case 0:n.mode=c6;break;case 1:if(JW(n),n.mode=yd,t===gd){c>>>=2,u-=2;break e}break;case 2:n.mode=f6;break;case 3:e.msg="invalid block type",n.mode=yt}c>>>=2,u-=2;break;case c6:for(c>>>=u&7,u-=u&7;u<32;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){e.msg="invalid stored block lengths",n.mode=yt;break}if(n.length=c&65535,c=0,u=0,n.mode=W1,t===gd)break e;case W1:n.mode=u6;case u6:if(d=n.length,d){if(d>a&&(d=a),d>l&&(d=l),d===0)break e;i.set(r.subarray(o,o+d),s),a-=d,o+=d,l-=d,s+=d,n.length-=d;break}n.mode=si;break;case f6:for(;u<14;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(n.nlen=(c&31)+257,c>>>=5,u-=5,n.ndist=(c&31)+1,c>>>=5,u-=5,n.ncode=(c&15)+4,c>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=yt;break}n.have=0,n.mode=h6;case h6:for(;n.have<n.ncode;){for(;u<3;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}n.lens[q[n.have++]]=c&7,c>>>=3,u-=3}for(;n.have<19;)n.lens[q[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,B={bits:n.lenbits},M=au(jW,n.lens,0,19,n.lencode,0,n.work,B),n.lenbits=B.bits,M){e.msg="invalid code lengths set",n.mode=yt;break}n.have=0,n.mode=d6;case d6:for(;n.have<n.nlen+n.ndist;){for(;b=n.lencode[c&(1<<n.lenbits)-1],g=b>>>24,y=b>>>16&255,v=b&65535,!(g<=u);){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(v<16)c>>>=g,u-=g,n.lens[n.have++]=v;else{if(v===16){for(I=g+2;u<I;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(c>>>=g,u-=g,n.have===0){e.msg="invalid bit length repeat",n.mode=yt;break}k=n.lens[n.have-1],d=3+(c&3),c>>>=2,u-=2}else if(v===17){for(I=g+3;u<I;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}c>>>=g,u-=g,k=0,d=3+(c&7),c>>>=3,u-=3}else{for(I=g+7;u<I;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}c>>>=g,u-=g,k=0,d=11+(c&127),c>>>=7,u-=7}if(n.have+d>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=yt;break}for(;d--;)n.lens[n.have++]=k}}if(n.mode===yt)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=yt;break}if(n.lenbits=9,B={bits:n.lenbits},M=au(YC,n.lens,0,n.nlen,n.lencode,0,n.work,B),n.lenbits=B.bits,M){e.msg="invalid literal/lengths set",n.mode=yt;break}if(n.distbits=6,n.distcode=n.distdyn,B={bits:n.distbits},M=au(QC,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,B),n.distbits=B.bits,M){e.msg="invalid distances set",n.mode=yt;break}if(n.mode=yd,t===gd)break e;case yd:n.mode=wd;case wd:if(a>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,n.hold=c,n.bits=u,NW(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,a=e.avail_in,c=n.hold,u=n.bits,n.mode===si&&(n.back=-1);break}for(n.back=0;b=n.lencode[c&(1<<n.lenbits)-1],g=b>>>24,y=b>>>16&255,v=b&65535,!(g<=u);){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(y&&!(y&240)){for(w=g,S=y,E=v;b=n.lencode[E+((c&(1<<w+S)-1)>>w)],g=b>>>24,y=b>>>16&255,v=b&65535,!(w+g<=u);){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}c>>>=w,u-=w,n.back+=w}if(c>>>=g,u-=g,n.back+=g,n.length=v,y===0){n.mode=y6;break}if(y&32){n.back=-1,n.mode=si;break}if(y&64){e.msg="invalid literal/length code",n.mode=yt;break}n.extra=y&15,n.mode=p6;case p6:if(n.extra){for(I=n.extra;u<I;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=g6;case g6:for(;b=n.distcode[c&(1<<n.distbits)-1],g=b>>>24,y=b>>>16&255,v=b&65535,!(g<=u);){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(!(y&240)){for(w=g,S=y,E=v;b=n.distcode[E+((c&(1<<w+S)-1)>>w)],g=b>>>24,y=b>>>16&255,v=b&65535,!(w+g<=u);){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}c>>>=w,u-=w,n.back+=w}if(c>>>=g,u-=g,n.back+=g,y&64){e.msg="invalid distance code",n.mode=yt;break}n.offset=v,n.extra=y&15,n.mode=m6;case m6:if(n.extra){for(I=n.extra;u<I;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=yt;break}n.mode=b6;case b6:if(l===0)break e;if(d=h-l,n.offset>d){if(d=n.offset-d,d>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=yt;break}d>n.wnext?(d-=n.wnext,p=n.wsize-d):p=n.wnext-d,d>n.length&&(d=n.length),m=n.window}else m=i,p=s-n.offset,d=n.length;d>l&&(d=l),l-=d,n.length-=d;do i[s++]=m[p++];while(--d);n.length===0&&(n.mode=wd);break;case y6:if(l===0)break e;i[s++]=n.length,l--,n.mode=wd;break;case Y1:if(n.wrap){for(;u<32;){if(a===0)break e;a--,c|=r[o++]<<u,u+=8}if(h-=l,e.total_out+=h,n.total+=h,n.wrap&4&&h&&(e.adler=n.check=n.flags?Nr(n.check,i,h,s-h):G1(n.check,i,h,s-h)),h=l,n.wrap&4&&(n.flags?c:E6(c))!==n.check){e.msg="incorrect data check",n.mode=yt;break}c=0,u=0}n.mode=w6;case w6:if(n.wrap&&n.flags){for(;u<32;){if(a===0)break e;a--,c+=r[o++]<<u,u+=8}if(n.wrap&4&&c!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=yt;break}c=0,u=0}n.mode=v6;case v6:M=qW;break e;case yt:M=XC;break e;case x6:return KC;case A6:default:return Yn}return e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,n.hold=c,n.bits=u,(n.wsize||h!==e.avail_out&&n.mode<yt&&(n.mode<Y1||t!==ZC))&&_6(e,e.output,e.next_out,h-e.avail_out),f-=e.avail_in,h-=e.avail_out,e.total_in+=f,e.total_out+=h,n.total+=h,n.wrap&4&&h&&(e.adler=n.check=n.flags?Nr(n.check,i,h,e.next_out-h):G1(n.check,i,h,e.next_out-h)),e.data_type=n.bits+(n.last?64:0)+(n.mode===si?128:0)+(n.mode===yd||n.mode===W1?256:0),(f===0&&h===0||t===ZC)&&M===ds&&(M=WW),M},tY=e=>{if(ps(e))return Yn;let t=e.state;return t.window&&(t.window=null),e.state=null,ds},nY=(e,t)=>{if(ps(e))return Yn;const n=e.state;return n.wrap&2?(n.head=t,t.done=!1,ds):Yn},rY=(e,t)=>{const n=t.length;let r,i,o;return ps(e)||(r=e.state,r.wrap!==0&&r.mode!==bd)?Yn:r.mode===bd&&(i=1,i=G1(i,t,n,0),i!==r.check)?XC:(o=_6(e,t,n,n),o?(r.mode=x6,KC):(r.havedict=1,ds))};var iY=C6,oY=k6,sY=S6,aY=KW,lY=T6,cY=eY,uY=tY,fY=nY,hY=rY,dY="pako inflate (from Nodeca project)",ai={inflateReset:iY,inflateReset2:oY,inflateResetKeep:sY,inflateInit:aY,inflateInit2:lY,inflate:cY,inflateEnd:uY,inflateGetHeader:fY,inflateSetDictionary:hY,inflateInfo:dY};function pY(){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}var gY=pY;const D6=Object.prototype.toString,{Z_NO_FLUSH:mY,Z_FINISH:bY,Z_OK:lu,Z_STREAM_END:X1,Z_NEED_DICT:K1,Z_STREAM_ERROR:yY,Z_DATA_ERROR:R6,Z_MEM_ERROR:wY}=HC;function vd(e){this.options=GC.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new OW,this.strm.avail_out=0;let n=ai.inflateInit2(this.strm,t.windowBits);if(n!==lu)throw new Error(j1[n]);if(this.header=new gY,ai.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=V1.string2buf(t.dictionary):D6.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=ai.inflateSetDictionary(this.strm,t.dictionary),n!==lu)))throw new Error(j1[n])}vd.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?bY:mY,D6.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=ai.inflate(n,s),o===K1&&i&&(o=ai.inflateSetDictionary(n,i),o===lu?o=ai.inflate(n,s):o===R6&&(o=K1));n.avail_in>0&&o===X1&&n.state.wrap>0&&e[n.next_in]!==0;)ai.inflateReset(n),o=ai.inflate(n,s);switch(o){case yY:case R6:case K1:case wY:return this.onEnd(o),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(n.avail_out===0||o===X1))if(this.options.to==="string"){let l=V1.utf8border(n.output,n.next_out),c=n.next_out-l,u=V1.buf2string(n.output,l);n.next_out=c,n.avail_out=r-c,c&&n.output.set(n.output.subarray(l,l+c),0),this.onData(u)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(o===lu&&a===0)){if(o===X1)return o=ai.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},vd.prototype.onData=function(e){this.chunks.push(e)},vd.prototype.onEnd=function(e){e===lu&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=GC.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function vY(e,t){const n=new vd(t);if(n.push(e),n.err)throw n.msg||j1[n.err];return n.result}function xY(e,t){return t=t||{},t.raw=!0,vY(e,t)}var AY=xY,EY={inflateRaw:AY};const{inflateRaw:SY}=EY;var CY=SY;function kY(e){return CY(e.subarray(2))}let TY=class extends Error{constructor(t){super(t),this.code="ERR_ABORTED"}};function IY(e){e.sort((i,o)=>i.offset-o.offset);const t=[];let n,r;for(const i of e)n&&r&&i.offset-r<=2e3?(n.length=n.length+i.length-r+i.offset,n.blocks.push(i)):t.push(n={blocks:[i],length:i.length,offset:i.offset}),r=n.offset+n.length;return t}function xd(e){if(e&&e.aborted)if(typeof DOMException>"u"){const t=new TY("aborted");throw t.code="ERR_ABORTED",t}else throw new DOMException("aborted","AbortError")}const J1=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function eb(e,t,n,r){return e<r&&t>=n}class B6{constructor(t,n,r,i,o,s){if(this.bbi=t,this.refsByName=n,this.cirTreeOffset=r,this.isBigEndian=i,this.isCompressed=o,this.blockType=s,this.featureCache=new hs({cache:new dd({maxSize:1e3}),fill:async(a,l)=>{const c=a.length,u=a.offset,{buffer:f}=await this.bbi.read(ot.Buffer.alloc(c),0,c,u,{signal:l});return f}}),!(r>=0))throw new Error("invalid cirTreeOffset!")}async readWigData(t,n,r,i,o){try{const{refsByName:s,bbi:a,cirTreeOffset:l,isBigEndian:c}=this,u=s[t];u===void 0&&i.complete();const f={chrId:u,start:n,end:r};this.cirTreePromise||(this.cirTreePromise=a.read(ot.Buffer.alloc(48),0,48,l,o));const{buffer:h}=await this.cirTreePromise,d=c?h.readUInt32BE(4):h.readUInt32LE(4);let p=[],m=0;const b=!0,g=(S,E,k)=>{try{const D=S.subarray(E),B=new DataView(D.buffer,D.byteOffset,D.length);let I=0;const q=B.getUint8(I);I+=2;const Z=B.getUint16(I,b);if(I+=2,q===1){const te=[];for(let J=0;J<Z;J++){const ce=B.getUint32(I,b);I+=4;const ae=B.getUint32(I,b);I+=4;const we=B.getUint32(I,b);I+=4;const me=B.getUint32(I,b);I+=4;const U=Number(B.getBigUint64(I,b));I+=8;const Ae=Number(B.getBigUint64(I,b));I+=8,te.push({startChrom:ce,startBase:ae,endBase:me,endChrom:we,blockOffset:U,blockSize:Ae,offset:I})}p=p.concat(te.filter(J=>y(J)).map(J=>({offset:J.blockOffset,length:J.blockSize})))}else if(q===0){const te=[];for(let ce=0;ce<Z;ce++){const ae=B.getUint32(I,b);I+=4;const we=B.getUint32(I,b);I+=4;const me=B.getUint32(I,b);I+=4;const U=B.getUint32(I,b);I+=4;const Ae=Number(B.getBigUint64(I,b));I+=8,te.push({startChrom:ae,startBase:we,endChrom:me,endBase:U,blockOffset:Ae,offset:I})}const J=te.filter(ce=>y(ce)).map(ce=>ce.blockOffset);J.length>0&&w(J,k+1)}}catch(M){i.error(M)}},y=S=>{const{startChrom:E,startBase:k,endChrom:M,endBase:D}=S;return(E<u||E===u&&k<=r)&&(M>u||M===u&&D>=n)},v=async(S,E,k)=>{try{const M=E.max-E.min,D=E.min,B=await this.featureCache.get(`${M}_${D}`,{length:M,offset:D},o==null?void 0:o.signal);for(const I of S)E.contains(I)&&(g(B,I-D,k),m-=1,m===0&&this.readFeatures(i,p,{...o,request:f}).catch(q=>{i.error(q)}))}catch(M){i.error(M)}},w=(S,E)=>{try{m+=S.length;const k=4+d*32;let M=new Ta([{min:S[0],max:S[0]+k}]);for(let D=1;D<S.length;D+=1){const B=new Ta([{min:S[D],max:S[D]+k}]);M=M.union(B)}M.getRanges().map(D=>v(S,D,E))}catch(k){i.error(k)}};w([Number(l)+48],1);return}catch(s){i.error(s)}}parseSummaryBlock(t,n,r){const i=[];let o=n;const s=new DataView(t.buffer,t.byteOffset,t.length);for(;o<t.byteLength;){const a=s.getUint32(o,!0);o+=4;const l=s.getUint32(o,!0);o+=4;const c=s.getUint32(o,!0);o+=4;const u=s.getUint32(o,!0);o+=4;const f=s.getFloat32(o,!0);o+=4;const h=s.getFloat32(o,!0);o+=4;const d=s.getFloat32(o,!0);o+=4,o+=4,(!r||a===r.chrId&&eb(l,c,r.start,r.end))&&i.push({start:l,end:c,maxScore:h,minScore:f,summary:!0,score:d/(u||1)})}return i}parseBigBedBlock(t,n,r,i){var o;const s=[];let a=n;const l=!0,c=t,u=new DataView(c.buffer,c.byteOffset,c.length);for(;a<t.byteLength;){const f=a,h=u.getUint32(a,l);a+=4;const d=u.getInt32(a,l);a+=4;const p=u.getInt32(a,l);a+=4;let m=a;for(;m<t.length&&t[m]!==0;m++);const b=t.subarray(a,m),g=(o=J1==null?void 0:J1.decode(b))!==null&&o!==void 0?o:b.toString();a=m+1,s.push({chromId:h,start:d,end:p,rest:g,uniqueId:`bb-${r+f}`})}return i?s.filter(f=>eb(f.start,f.end,i.start,i.end)):s}parseBigWigBlock(t,n,r){const i=t.subarray(n),o=new DataView(i.buffer,i.byteOffset,i.length);let s=0;s+=4;const a=o.getInt32(s,!0);s+=8;const l=o.getUint32(s,!0);s+=4;const c=o.getUint32(s,!0);s+=4;const u=o.getUint8(s);s+=2;const f=o.getUint16(s,!0);s+=2;const h=new Array(f);switch(u){case 1:{for(let d=0;d<f;d++){const p=o.getInt32(s,!0);s+=4;const m=o.getInt32(s,!0);s+=4;const b=o.getFloat32(s,!0);s+=4,h[d]={start:p,end:m,score:b}}break}case 2:{for(let d=0;d<f;d++){const p=o.getInt32(s,!0);s+=4;const m=o.getFloat32(s,!0);s+=4,h[d]={score:m,start:p,end:p+c}}break}case 3:{for(let d=0;d<f;d++){const p=o.getFloat32(s,!0);s+=4;const m=a+d*l;h[d]={score:p,start:m,end:m+c}}break}}return r?h.filter(d=>eb(d.start,d.end,r.start,r.end)):h}async readFeatures(t,n,r={}){try{const{blockType:i,isCompressed:o}=this,{signal:s,request:a}=r,l=IY(n);xd(s),await Promise.all(l.map(async c=>{xd(s);const{length:u,offset:f}=c,h=await this.featureCache.get(`${u}_${f}`,c,s);for(const d of c.blocks){xd(s);let p=Number(d.offset)-Number(c.offset),m=h;switch(o&&(m=kY(h.subarray(p)),p=0),xd(s),i){case"summary":{t.next(this.parseSummaryBlock(m,p,a));break}case"bigwig":{t.next(this.parseBigWigBlock(m,p,a));break}case"bigbed":{t.next(this.parseBigBedBlock(m,p,Number(d.offset)*256,a));break}default:console.warn(`Don't know what to do with ${i}`)}}})),t.complete()}catch(i){t.error(i)}}}var tb=function(e,t){return tb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},tb(e,t)};function nb(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");tb(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function _Y(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(u){try{c(r.next(u))}catch(f){s(f)}}function l(u){try{c(r.throw(u))}catch(f){s(f)}}function c(u){u.done?o(u.value):i(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})}function F6(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(u){return l([c,u])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){n.label=c[1];break}if(c[0]===6&&n.label<o[1]){n.label=o[1],o=c;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(c);break}o[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(u){c=[6,u],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function cu(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function rb(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function ib(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function Da(e){return this instanceof Da?(this.v=e,this):new Da(e)}function DY(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(d){return function(p){return Promise.resolve(p).then(d,f)}}function a(d,p){r[d]&&(i[d]=function(m){return new Promise(function(b,g){o.push([d,m,b,g])>1||l(d,m)})},p&&(i[d]=p(i[d])))}function l(d,p){try{c(r[d](p))}catch(m){h(o[0][3],m)}}function c(d){d.value instanceof Da?Promise.resolve(d.value.v).then(u,f):h(o[0][2],d)}function u(d){l("next",d)}function f(d){l("throw",d)}function h(d,p){d(p),o.shift(),o.length&&l(o[0][0],o[0][1])}}function RY(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof cu=="function"?cu(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(s){return new Promise(function(a,l){s=e[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}}typeof SuppressedError=="function"&&SuppressedError;function Lt(e){return typeof e=="function"}function M6(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var ob=M6(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription:
3763
3763
  `+n.map(function(r,i){return i+1+") "+r.toString()}).join(`
3764
- `):"",this.name="UnsubscriptionError",this.errors=n}});function P6(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var sb=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=cu(s),l=a.next();!l.done;l=a.next()){var c=l.value;c.remove(this)}}catch(m){t={error:m}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}else s.remove(this);var u=this.initialTeardown;if(Lt(u))try{u()}catch(m){o=m instanceof ob?m.errors:[m]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var h=cu(f),d=h.next();!d.done;d=h.next()){var p=d.value;try{L6(p)}catch(m){o=o??[],m instanceof ob?o=ib(ib([],rb(o)),rb(m.errors)):o.push(m)}}}catch(m){r={error:m}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}}if(o)throw new ob(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)L6(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&P6(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&P6(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();sb.EMPTY;function O6(e){return e instanceof sb||e&&"closed"in e&&Lt(e.remove)&&Lt(e.add)&&Lt(e.unsubscribe)}function L6(e){Lt(e)?e():e.unsubscribe()}var BY={Promise:void 0},FY={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,ib([e,t],rb(n)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function N6(e){FY.setTimeout(function(){throw e})}function z6(){}function MY(e){e()}var ab=function(e){nb(t,e);function t(n){var r=e.call(this)||this;return r.isStopped=!1,n?(r.destination=n,O6(n)&&n.add(r)):r.destination=LY,r}return t.create=function(n,r,i){return new Ad(n,r,i)},t.prototype.next=function(n){this.isStopped||this._next(n)},t.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(sb),PY=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){Ed(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){Ed(r)}else Ed(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){Ed(n)}},e}(),Ad=function(e){nb(t,e);function t(n,r,i){var o=e.call(this)||this,s;return Lt(n)||!n?s={next:n??void 0,error:r??void 0,complete:i??void 0}:s=n,o.destination=new PY(s),o}return t}(ab);function Ed(e){N6(e)}function OY(e){throw e}var LY={closed:!0,next:z6,error:OY,complete:z6},lb=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function U6(e){return e}function NY(e){return e.length===0?U6:e.length===1?e[0]:function(n){return e.reduce(function(r,i){return i(r)},n)}}var Qn=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var i=this,o=UY(t)?t:new Ad(t,n,r);return MY(function(){var s=i,a=s.operator,l=s.source;o.add(a?a.call(o,l):l?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=H6(n),new n(function(i,o){var s=new Ad({next:function(a){try{t(a)}catch(l){o(l),s.unsubscribe()}},error:o,complete:i});r.subscribe(s)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[lb]=function(){return this},e.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return NY(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=H6(t),new t(function(r,i){var o;n.subscribe(function(s){return o=s},function(s){return i(s)},function(){return r(o)})})},e.create=function(t){return new e(t)},e}();function H6(e){var t;return(t=e??BY.Promise)!==null&&t!==void 0?t:Promise}function zY(e){return e&&Lt(e.next)&&Lt(e.error)&&Lt(e.complete)}function UY(e){return e&&e instanceof ab||zY(e)&&O6(e)}function HY(e){return Lt(e==null?void 0:e.lift)}function Ra(e){return function(t){if(HY(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function uu(e,t,n,r,i){return new GY(e,t,n,r,i)}var GY=function(e){nb(t,e);function t(n,r,i,o,s,a){var l=e.call(this,n)||this;return l.onFinalize=s,l.shouldUnsubscribe=a,l._next=r?function(c){try{r(c)}catch(u){n.error(u)}}:e.prototype._next,l._error=o?function(c){try{o(c)}catch(u){n.error(u)}finally{this.unsubscribe()}}:e.prototype._error,l._complete=i?function(){try{i()}catch(c){n.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,l}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t}(ab),jY=new Qn(function(e){return e.complete()});function VY(e){return e&&Lt(e.schedule)}function G6(e){return e[e.length-1]}function qY(e){return VY(G6(e))?e.pop():void 0}function $Y(e,t){return typeof G6(e)=="number"?e.pop():t}var j6=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function V6(e){return Lt(e==null?void 0:e.then)}function q6(e){return Lt(e[lb])}function $6(e){return Symbol.asyncIterator&&Lt(e==null?void 0:e[Symbol.asyncIterator])}function W6(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function WY(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Y6=WY();function Q6(e){return Lt(e==null?void 0:e[Y6])}function Z6(e){return DY(this,arguments,function(){var n,r,i,o;return F6(this,function(s){switch(s.label){case 0:n=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Da(n.read())];case 3:return r=s.sent(),i=r.value,o=r.done,o?[4,Da(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Da(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function X6(e){return Lt(e==null?void 0:e.getReader)}function Ba(e){if(e instanceof Qn)return e;if(e!=null){if(q6(e))return YY(e);if(j6(e))return QY(e);if(V6(e))return ZY(e);if($6(e))return K6(e);if(Q6(e))return XY(e);if(X6(e))return KY(e)}throw W6(e)}function YY(e){return new Qn(function(t){var n=e[lb]();if(Lt(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function QY(e){return new Qn(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function ZY(e){return new Qn(function(t){e.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,N6)})}function XY(e){return new Qn(function(t){var n,r;try{for(var i=cu(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(a){n={error:a}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()})}function K6(e){return new Qn(function(t){JY(e,t).catch(function(n){return t.error(n)})})}function KY(e){return K6(Z6(e))}function JY(e,t){var n,r,i,o;return _Y(this,void 0,void 0,function(){var s,a;return F6(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),n=RY(e),l.label=1;case 1:return[4,n.next()];case 2:if(r=l.sent(),!!r.done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=l.sent(),i={error:a},[3,11];case 6:return l.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function gs(e,t,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var o=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(o),!i)return o}function J6(e,t){return t===void 0&&(t=0),Ra(function(n,r){n.subscribe(uu(r,function(i){return gs(r,e,function(){return r.next(i)},t)},function(){return gs(r,e,function(){return r.complete()},t)},function(i){return gs(r,e,function(){return r.error(i)},t)}))})}function e5(e,t){return t===void 0&&(t=0),Ra(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function eQ(e,t){return Ba(e).pipe(e5(t),J6(t))}function tQ(e,t){return Ba(e).pipe(e5(t),J6(t))}function nQ(e,t){return new Qn(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}function rQ(e,t){return new Qn(function(n){var r;return gs(n,t,function(){r=e[Y6](),gs(n,t,function(){var i,o,s;try{i=r.next(),o=i.value,s=i.done}catch(a){n.error(a);return}s?n.complete():n.next(o)},0,!0)}),function(){return Lt(r==null?void 0:r.return)&&r.return()}})}function t5(e,t){if(!e)throw new Error("Iterable cannot be null");return new Qn(function(n){gs(n,t,function(){var r=e[Symbol.asyncIterator]();gs(n,t,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function iQ(e,t){return t5(Z6(e),t)}function oQ(e,t){if(e!=null){if(q6(e))return eQ(e,t);if(j6(e))return nQ(e,t);if(V6(e))return tQ(e,t);if($6(e))return t5(e,t);if(Q6(e))return rQ(e,t);if(X6(e))return iQ(e,t)}throw W6(e)}function sQ(e,t){return t?oQ(e,t):Ba(e)}var aQ=M6(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function n5(e,t){return new Promise(function(n,r){var i=new Ad({next:function(o){n(o),i.unsubscribe()},error:r,complete:function(){r(new aQ)}});e.subscribe(i)})}function r5(e,t){return Ra(function(n,r){var i=0;n.subscribe(uu(r,function(o){r.next(e.call(t,o,i++))}))})}function lQ(e,t,n,r,i,o,s,a){var l=[],c=0,u=0,f=!1,h=function(){f&&!l.length&&!c&&t.complete()},d=function(m){return c<r?p(m):l.push(m)},p=function(m){c++;var b=!1;Ba(n(m,u++)).subscribe(uu(t,function(g){t.next(g)},function(){b=!0},void 0,function(){if(b)try{c--;for(var g=function(){var y=l.shift();s||p(y)};l.length&&c<r;)g();h()}catch(y){t.error(y)}}))};return e.subscribe(uu(t,d,function(){f=!0,h()})),function(){}}function i5(e,t,n){return n===void 0&&(n=1/0),Lt(t)?i5(function(r,i){return r5(function(o,s){return t(r,o,i,s)})(Ba(e(r,i)))},n):(typeof t=="number"&&(n=t),Ra(function(r,i){return lQ(r,i,e,n)}))}function cQ(e){return e===void 0&&(e=1/0),i5(U6,e)}function uQ(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=qY(e),r=$Y(e,1/0),i=e;return i.length?i.length===1?Ba(i[0]):cQ(r)(sQ(i,n)):jY}function fQ(e,t,n,r,i){return function(o,s){var a=n,l=t,c=0;o.subscribe(uu(s,function(u){var f=c++;l=a?e(l,u,f):(a=!0,u)},function(){a&&s.next(l),s.complete()}))}}function o5(e,t){return Ra(fQ(e,t,arguments.length>=2,!1,!0))}var hQ=function(e,t){return e.push(t),e};function dQ(){return Ra(function(e,t){o5(hQ,[])(e).subscribe(t)})}const s5=-2003829722,cb=-2021002517;class a5{getHeader(t){return this.headerP||(this.headerP=this._getHeader(t).catch(n=>{throw this.headerP=void 0,n})),this.headerP}constructor(t){const{filehandle:n,renameRefSeqs:r=s=>s,path:i,url:o}=t;if(this.renameRefSeqs=r,n)this.bbi=n;else if(o)this.bbi=new ur(o);else if(i)this.bbi=new qt(i);else throw new Error("no file given")}async _getHeader(t){const n=await this._getMainHeader(t),r=await this._readChromTree(n,t);return{...n,...r}}async _getMainHeader(t,n=2e3){const{buffer:i}=await this.bbi.read(ot.Buffer.alloc(n),0,n,0,t),o=this._isBigEndian(i),s=i,a=new DataView(s.buffer,s.byteOffset,s.length);let l=0;const c=a.getInt32(l,!0);l+=4;const u=a.getUint16(l,!0);l+=2;const f=a.getUint16(l,!0);l+=2;const h=Number(a.getBigUint64(l,!0));l+=8;const d=Number(a.getBigUint64(l,!0));l+=8;const p=Number(a.getBigUint64(l,!0));l+=8;const m=a.getUint16(l,!0);l+=2;const b=a.getUint16(l,!0);l+=2;const g=Number(a.getBigUint64(l,!0));l+=8;const y=Number(a.getBigUint64(l,!0));l+=8;const v=a.getUint32(l,!0);l+=4;const w=Number(a.getBigUint64(l,!0));l+=8;const S=[];for(let M=0;M<f;M++){const D=a.getUint32(l,!0);l+=4;const B=a.getUint32(l,!0);l+=4;const I=Number(a.getBigUint64(l,!0));l+=8;const q=Number(a.getBigUint64(l,!0));l+=8,S.push({reductionLevel:D,reserved:B,dataOffset:I,indexOffset:q})}const E=c===cb?"bigbed":"bigwig";if(g>n||y>n-8*5)return this._getMainHeader(t,n*2);let k;if(y){const M=i.subarray(Number(y));let D=0;const B=new DataView(M.buffer,M.byteOffset,M.length),I=Number(B.getBigUint64(D,!0));D+=8;const q=B.getFloat64(D,!0);D+=8;const Z=B.getFloat64(D,!0);D+=8;const ne=B.getFloat64(D,!0);D+=8;const J=B.getFloat64(D,!0);D+=8,k={scoreMin:q,scoreMax:Z,scoreSum:ne,scoreSumSquares:J,basesCovered:I}}else throw new Error("no stats");return{zoomLevels:S,magic:c,extHeaderOffset:w,numZoomLevels:f,fieldCount:m,totalSummary:k,definedFieldCount:b,uncompressBufSize:v,asOffset:g,chromTreeOffset:h,totalSummaryOffset:y,unzoomedDataOffset:d,unzoomedIndexOffset:p,fileType:E,version:u,isBigEndian:o,autoSql:g?i.subarray(g,i.indexOf(0,g)).toString():""}}_isBigEndian(t){let n=t.readInt32LE(0);if(n===s5||n===cb)return!1;if(n=t.readInt32BE(0),n===s5||n===cb)return!0;throw new Error("not a BigWig/BigBed file")}async _readChromTree(t,n){const i=!t.isBigEndian,o=[],s={};let a=t.unzoomedDataOffset;const l=t.chromTreeOffset;for(;a%4!==0;)a+=1;const c=a-l,{buffer:u}=await this.bbi.read(ot.Buffer.alloc(c),0,c,Number(l),n),f=u,h=new DataView(f.buffer,f.byteOffset,f.length);let d=0;d+=4,d+=4;const p=h.getUint32(d,i);d+=4,d+=4,d+=8;const m=32,b=async g=>{let y=g;if(y>=u.length)throw new Error("reading beyond end of buffer");const v=h.getUint8(y);y+=2;const w=h.getUint16(y,i);if(y+=2,v)for(let S=0;S<w;S++){const E=u.subarray(y,y+p).toString().replaceAll("\0","");y+=p;const k=h.getUint32(y,i);y+=4;const M=h.getUint32(y,i);y+=4;const D={name:E,id:k,length:M};s[this.renameRefSeqs(E)]=k,o[k]=D}else{const S=[];for(let E=0;E<w;E++){y+=p;const k=Number(h.getBigUint64(y,i));y+=8,S.push(b(Number(k)-Number(l)))}await Promise.all(S)}};return await b(m),{refsByName:s,refsByNumber:o}}async getUnzoomedView(t){const{unzoomedIndexOffset:n,refsByName:r,uncompressBufSize:i,isBigEndian:o,fileType:s}=await this.getHeader(t);return new B6(this.bbi,r,n,o,i>0,s)}async getFeatureStream(t,n,r,i){await this.getHeader(i);const o=this.renameRefSeqs(t);let s;const{basesPerSpan:a,scale:l}=i||{};return a?s=await this.getView(1/a,i):l?s=await this.getView(l,i):s=await this.getView(1,i),new Qn(c=>{s.readWigData(o,n,r,c,i).catch(u=>{c.error(u)})})}async getFeatures(t,n,r,i){const o=await this.getFeatureStream(t,n,r,i);return(await n5(o.pipe(dQ()))).flat()}}class pQ extends a5{async getView(t,n){const{zoomLevels:r,refsByName:i,isBigEndian:o,uncompressBufSize:s}=await this.getHeader(n),a=1/t,l=r.length-1;for(let c=l;c>=0;c-=1){const u=r[c];if(u&&u.reductionLevel<=2*a)return new B6(this.bbi,i,u.indexOffset,o,s>0,"summary")}return this.getUnzoomedView(n)}}function gQ(e){return e.filter(t=>!!t)}class mQ extends a5{constructor(){super(...arguments),this.readIndicesCache=new hs({cache:new dd({maxSize:1}),fill:(t,n)=>this._readIndices({...t,signal:n})})}readIndices(t={}){const{signal:n,...r}=t;return this.readIndicesCache.get(JSON.stringify(r),t,n)}async getView(t,n){return this.getUnzoomedView(n)}async _readIndices(t){const{extHeaderOffset:n,isBigEndian:r}=await this.getHeader(t),{buffer:i}=await this.bbi.read(ot.Buffer.alloc(64),0,64,Number(n)),o=!r,s=i,a=new DataView(s.buffer,s.byteOffset,s.length);let l=0;l+=2;const c=a.getUint16(l,o);l+=2;const u=Number(a.getBigUint64(l,o));if(l+=8,c===0)return[];const f=20,h=f*c,{buffer:d}=await this.bbi.read(ot.Buffer.alloc(h),0,h,Number(u)),p=[];for(let m=0;m<c;m+=1){const b=d.subarray(m*f),g=new DataView(b.buffer,b.byteOffset,b.length);let y=0;const v=g.getInt16(y,o);y+=2;const w=g.getInt16(y,o);y+=2;const S=Number(g.getBigUint64(y,o));y+=12;const E=g.getInt16(y,o);p.push({type:v,fieldcount:w,offset:Number(S),field:E})}return p}async searchExtraIndexBlocks(t,n={}){const{isBigEndian:r}=await this.getHeader(n),i=await this.readIndices(n);if(i.length===0)return[];const o=i.map(async s=>{const{offset:a,field:l}=s,{buffer:c}=await this.bbi.read(ot.Buffer.alloc(32),0,32,a,n),u=!r,f=c,h=new DataView(f.buffer,f.byteOffset,f.length);let d=0;d+=4;const p=h.getInt32(d,u);d+=4;const m=h.getInt32(d,u);d+=4;const b=h.getInt32(d,u);d+=4,d+=8;const g=async v=>{const w=Number(v),S=4+p*(m+b),{buffer:E}=await this.bbi.read(ot.Buffer.alloc(S),0,S,w,n),k=E,M=new DataView(k.buffer,k.byteOffset,k.length);let D=0;const B=M.getInt8(D);D+=2;const I=M.getInt16(D,u);D+=2;const q=[];if(B===0){const Z=[];for(let J=0;J<I;J++){const ce=k.subarray(D,D+m).toString().replaceAll("\0","");D+=m;const ae=Number(M.getBigUint64(D,u));D+=8,Z.push({key:ce,offset:ae})}let ne=0;for(const{key:J,offset:ce}of Z){if(t.localeCompare(J)<0&&ne)return g(ne);ne=ce}return g(ne)}else if(B===1){for(let Z=0;Z<I;Z++){const ne=k.subarray(D,D+m).toString().replaceAll("\0","");D+=m;const J=Number(M.getBigUint64(D,u));D+=8;const ce=M.getUint32(D,u);D+=4;const ae=M.getUint32(D,u);D+=4,q.push({key:ne,offset:J,length:ce,reserved:ae})}for(const Z of q)if(Z.key===t)return{...Z,field:l};return}};return g(a+32)});return gQ(await Promise.all(o))}async searchExtraIndex(t,n={}){const r=await this.searchExtraIndexBlocks(t,n);if(r.length===0)return[];const i=await this.getUnzoomedView(n),o=r.map(a=>new Qn(l=>{i.readFeatures(l,[a],n).catch(c=>{l.error(c)})}).pipe(o5((l,c)=>l.concat(c)),r5(l=>{for(const c of l)c.field=a.field;return l})));return(await n5(uQ(...o))).filter(a=>{var l;return((l=a.rest)===null||l===void 0?void 0:l.split(" ")[(a.field||0)-3])===t})}}const l5=Object.freeze(Object.defineProperty({__proto__:null,BigBed:mQ,BigWig:pQ},Symbol.toStringTag,{value:"Module"}));var ub,c5;function bQ(){if(c5)return ub;c5=1;function e(r,i){function o(){this.constructor=r}o.prototype=i.prototype,r.prototype=new o}function t(r,i,o,s){this.message=r,this.expected=i,this.found=o,this.location=s,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)}e(t,Error),t.buildMessage=function(r,i){var o={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var d="",p;for(p=0;p<h.parts.length;p++)d+=h.parts[p]instanceof Array?l(h.parts[p][0])+"-"+l(h.parts[p][1]):l(h.parts[p]);return"["+(h.inverted?"^":"")+d+"]"},any:function(h){return"any character"},end:function(h){return"end of input"},other:function(h){return h.description}};function s(h){return h.charCodeAt(0).toString(16).toUpperCase()}function a(h){return h.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+s(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+s(d)})}function l(h){return h.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+s(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+s(d)})}function c(h){return o[h.type](h)}function u(h){var d=new Array(h.length),p,m;for(p=0;p<h.length;p++)d[p]=c(h[p]);if(d.sort(),d.length>0){for(p=1,m=1;p<d.length;p++)d[p-1]!==d[p]&&(d[m]=d[p],m++);d.length=m}switch(d.length){case 1:return d[0];case 2:return d[0]+" or "+d[1];default:return d.slice(0,-1).join(", ")+", or "+d[d.length-1]}}function f(h){return h?'"'+a(h)+'"':"end of input"}return"Expected "+u(r)+" but "+f(i)+" found."};function n(r,i){i=i!==void 0?i:{};var o={},s={declaration:bk},a=bk,l="(",c=Ve("(",!1),u=")",f=Ve(")",!1),h=function(O,le,Se,ke){return{type:O,name:le,comment:Se,fields:ke}},d="simple",p=Ve("simple",!1),m="object",b=Ve("object",!1),g="table",y=Ve("table",!1),v="auto",w=Ve("auto",!1),S="primary",E=Ve("primary",!1),k="index",M=Ve("index",!1),D="unique",B=Ve("unique",!1),I=function(O,le){return le},q=function(O,le){return O.name&&le.unshift(O),le},Z="#",ne=Ve("#",!1),J=";",ce=Ve(";",!1),ae=function(O,le,Se){return{type:O,name:le,comment:Se}},we="[",me=Ve("[",!1),U="]",Ae=Ve("]",!1),Ce=function(O,le,Se,ke){return{type:O,size:le,name:Se,comment:ke}},H=function(O,le,Se,ke){return{type:O,vals:le,name:Se,comment:ke}},ze=",",qe=Ve(",",!1),Q=function(O,le){return le.unshift(O),le},X="int",re=Ve("int",!1),ie="uint",ye=Ve("uint",!1),L="short",R=Ve("short",!1),se="ushort",pe=Ve("ushort",!1),Re="byte",Te=Ve("byte",!1),Ie="ubyte",Me=Ve("ubyte",!1),wt="float",hn=Ve("float",!1),Bt="char",nt=Ve("char",!1),Nt="string",Wt=Ve("string",!1),st="lstring",Yt=Ve("lstring",!1),F="enum",A=Ve("enum",!1),C="double",z=Ve("double",!1),T="bigint",G=Ve("bigint",!1),Y="set",ge=Ve("set",!1),$=function(O,le){return O+" "+le},ee=/^[a-zA-Z_]/,_=Et([["a","z"],["A","Z"],"_"],!1,!1),ue=/^[a-zA-Z0-9_]/,Be=Et([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),x=function(O){return At()},te=/^[^\n\r]/,oe=Et([`
3764
+ `):"",this.name="UnsubscriptionError",this.errors=n}});function P6(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var sb=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=cu(s),l=a.next();!l.done;l=a.next()){var c=l.value;c.remove(this)}}catch(m){t={error:m}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}else s.remove(this);var u=this.initialTeardown;if(Lt(u))try{u()}catch(m){o=m instanceof ob?m.errors:[m]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var h=cu(f),d=h.next();!d.done;d=h.next()){var p=d.value;try{L6(p)}catch(m){o=o??[],m instanceof ob?o=ib(ib([],rb(o)),rb(m.errors)):o.push(m)}}}catch(m){r={error:m}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}}if(o)throw new ob(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)L6(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&P6(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&P6(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();sb.EMPTY;function O6(e){return e instanceof sb||e&&"closed"in e&&Lt(e.remove)&&Lt(e.add)&&Lt(e.unsubscribe)}function L6(e){Lt(e)?e():e.unsubscribe()}var BY={Promise:void 0},FY={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,ib([e,t],rb(n)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function N6(e){FY.setTimeout(function(){throw e})}function z6(){}function MY(e){e()}var ab=function(e){nb(t,e);function t(n){var r=e.call(this)||this;return r.isStopped=!1,n?(r.destination=n,O6(n)&&n.add(r)):r.destination=LY,r}return t.create=function(n,r,i){return new Ad(n,r,i)},t.prototype.next=function(n){this.isStopped||this._next(n)},t.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(sb),PY=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){Ed(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){Ed(r)}else Ed(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){Ed(n)}},e}(),Ad=function(e){nb(t,e);function t(n,r,i){var o=e.call(this)||this,s;return Lt(n)||!n?s={next:n??void 0,error:r??void 0,complete:i??void 0}:s=n,o.destination=new PY(s),o}return t}(ab);function Ed(e){N6(e)}function OY(e){throw e}var LY={closed:!0,next:z6,error:OY,complete:z6},lb=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function U6(e){return e}function NY(e){return e.length===0?U6:e.length===1?e[0]:function(n){return e.reduce(function(r,i){return i(r)},n)}}var Qn=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var i=this,o=UY(t)?t:new Ad(t,n,r);return MY(function(){var s=i,a=s.operator,l=s.source;o.add(a?a.call(o,l):l?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=H6(n),new n(function(i,o){var s=new Ad({next:function(a){try{t(a)}catch(l){o(l),s.unsubscribe()}},error:o,complete:i});r.subscribe(s)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[lb]=function(){return this},e.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return NY(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=H6(t),new t(function(r,i){var o;n.subscribe(function(s){return o=s},function(s){return i(s)},function(){return r(o)})})},e.create=function(t){return new e(t)},e}();function H6(e){var t;return(t=e??BY.Promise)!==null&&t!==void 0?t:Promise}function zY(e){return e&&Lt(e.next)&&Lt(e.error)&&Lt(e.complete)}function UY(e){return e&&e instanceof ab||zY(e)&&O6(e)}function HY(e){return Lt(e==null?void 0:e.lift)}function Ra(e){return function(t){if(HY(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function uu(e,t,n,r,i){return new GY(e,t,n,r,i)}var GY=function(e){nb(t,e);function t(n,r,i,o,s,a){var l=e.call(this,n)||this;return l.onFinalize=s,l.shouldUnsubscribe=a,l._next=r?function(c){try{r(c)}catch(u){n.error(u)}}:e.prototype._next,l._error=o?function(c){try{o(c)}catch(u){n.error(u)}finally{this.unsubscribe()}}:e.prototype._error,l._complete=i?function(){try{i()}catch(c){n.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,l}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t}(ab),jY=new Qn(function(e){return e.complete()});function VY(e){return e&&Lt(e.schedule)}function G6(e){return e[e.length-1]}function qY(e){return VY(G6(e))?e.pop():void 0}function $Y(e,t){return typeof G6(e)=="number"?e.pop():t}var j6=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function V6(e){return Lt(e==null?void 0:e.then)}function q6(e){return Lt(e[lb])}function $6(e){return Symbol.asyncIterator&&Lt(e==null?void 0:e[Symbol.asyncIterator])}function W6(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function WY(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Y6=WY();function Q6(e){return Lt(e==null?void 0:e[Y6])}function Z6(e){return DY(this,arguments,function(){var n,r,i,o;return F6(this,function(s){switch(s.label){case 0:n=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Da(n.read())];case 3:return r=s.sent(),i=r.value,o=r.done,o?[4,Da(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Da(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function X6(e){return Lt(e==null?void 0:e.getReader)}function Ba(e){if(e instanceof Qn)return e;if(e!=null){if(q6(e))return YY(e);if(j6(e))return QY(e);if(V6(e))return ZY(e);if($6(e))return K6(e);if(Q6(e))return XY(e);if(X6(e))return KY(e)}throw W6(e)}function YY(e){return new Qn(function(t){var n=e[lb]();if(Lt(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function QY(e){return new Qn(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function ZY(e){return new Qn(function(t){e.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,N6)})}function XY(e){return new Qn(function(t){var n,r;try{for(var i=cu(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(a){n={error:a}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()})}function K6(e){return new Qn(function(t){JY(e,t).catch(function(n){return t.error(n)})})}function KY(e){return K6(Z6(e))}function JY(e,t){var n,r,i,o;return _Y(this,void 0,void 0,function(){var s,a;return F6(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),n=RY(e),l.label=1;case 1:return[4,n.next()];case 2:if(r=l.sent(),!!r.done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=l.sent(),i={error:a},[3,11];case 6:return l.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function gs(e,t,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var o=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(o),!i)return o}function J6(e,t){return t===void 0&&(t=0),Ra(function(n,r){n.subscribe(uu(r,function(i){return gs(r,e,function(){return r.next(i)},t)},function(){return gs(r,e,function(){return r.complete()},t)},function(i){return gs(r,e,function(){return r.error(i)},t)}))})}function e5(e,t){return t===void 0&&(t=0),Ra(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function eQ(e,t){return Ba(e).pipe(e5(t),J6(t))}function tQ(e,t){return Ba(e).pipe(e5(t),J6(t))}function nQ(e,t){return new Qn(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}function rQ(e,t){return new Qn(function(n){var r;return gs(n,t,function(){r=e[Y6](),gs(n,t,function(){var i,o,s;try{i=r.next(),o=i.value,s=i.done}catch(a){n.error(a);return}s?n.complete():n.next(o)},0,!0)}),function(){return Lt(r==null?void 0:r.return)&&r.return()}})}function t5(e,t){if(!e)throw new Error("Iterable cannot be null");return new Qn(function(n){gs(n,t,function(){var r=e[Symbol.asyncIterator]();gs(n,t,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function iQ(e,t){return t5(Z6(e),t)}function oQ(e,t){if(e!=null){if(q6(e))return eQ(e,t);if(j6(e))return nQ(e,t);if(V6(e))return tQ(e,t);if($6(e))return t5(e,t);if(Q6(e))return rQ(e,t);if(X6(e))return iQ(e,t)}throw W6(e)}function sQ(e,t){return t?oQ(e,t):Ba(e)}var aQ=M6(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function n5(e,t){return new Promise(function(n,r){var i=new Ad({next:function(o){n(o),i.unsubscribe()},error:r,complete:function(){r(new aQ)}});e.subscribe(i)})}function r5(e,t){return Ra(function(n,r){var i=0;n.subscribe(uu(r,function(o){r.next(e.call(t,o,i++))}))})}function lQ(e,t,n,r,i,o,s,a){var l=[],c=0,u=0,f=!1,h=function(){f&&!l.length&&!c&&t.complete()},d=function(m){return c<r?p(m):l.push(m)},p=function(m){c++;var b=!1;Ba(n(m,u++)).subscribe(uu(t,function(g){t.next(g)},function(){b=!0},void 0,function(){if(b)try{c--;for(var g=function(){var y=l.shift();s||p(y)};l.length&&c<r;)g();h()}catch(y){t.error(y)}}))};return e.subscribe(uu(t,d,function(){f=!0,h()})),function(){}}function i5(e,t,n){return n===void 0&&(n=1/0),Lt(t)?i5(function(r,i){return r5(function(o,s){return t(r,o,i,s)})(Ba(e(r,i)))},n):(typeof t=="number"&&(n=t),Ra(function(r,i){return lQ(r,i,e,n)}))}function cQ(e){return e===void 0&&(e=1/0),i5(U6,e)}function uQ(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=qY(e),r=$Y(e,1/0),i=e;return i.length?i.length===1?Ba(i[0]):cQ(r)(sQ(i,n)):jY}function fQ(e,t,n,r,i){return function(o,s){var a=n,l=t,c=0;o.subscribe(uu(s,function(u){var f=c++;l=a?e(l,u,f):(a=!0,u)},function(){a&&s.next(l),s.complete()}))}}function o5(e,t){return Ra(fQ(e,t,arguments.length>=2,!1,!0))}var hQ=function(e,t){return e.push(t),e};function dQ(){return Ra(function(e,t){o5(hQ,[])(e).subscribe(t)})}const s5=-2003829722,cb=-2021002517;class a5{getHeader(t){return this.headerP||(this.headerP=this._getHeader(t).catch(n=>{throw this.headerP=void 0,n})),this.headerP}constructor(t){const{filehandle:n,renameRefSeqs:r=s=>s,path:i,url:o}=t;if(this.renameRefSeqs=r,n)this.bbi=n;else if(o)this.bbi=new ur(o);else if(i)this.bbi=new qt(i);else throw new Error("no file given")}async _getHeader(t){const n=await this._getMainHeader(t),r=await this._readChromTree(n,t);return{...n,...r}}async _getMainHeader(t,n=2e3){const{buffer:i}=await this.bbi.read(ot.Buffer.alloc(n),0,n,0,t),o=this._isBigEndian(i),s=i,a=new DataView(s.buffer,s.byteOffset,s.length);let l=0;const c=a.getInt32(l,!0);l+=4;const u=a.getUint16(l,!0);l+=2;const f=a.getUint16(l,!0);l+=2;const h=Number(a.getBigUint64(l,!0));l+=8;const d=Number(a.getBigUint64(l,!0));l+=8;const p=Number(a.getBigUint64(l,!0));l+=8;const m=a.getUint16(l,!0);l+=2;const b=a.getUint16(l,!0);l+=2;const g=Number(a.getBigUint64(l,!0));l+=8;const y=Number(a.getBigUint64(l,!0));l+=8;const v=a.getUint32(l,!0);l+=4;const w=Number(a.getBigUint64(l,!0));l+=8;const S=[];for(let M=0;M<f;M++){const D=a.getUint32(l,!0);l+=4;const B=a.getUint32(l,!0);l+=4;const I=Number(a.getBigUint64(l,!0));l+=8;const q=Number(a.getBigUint64(l,!0));l+=8,S.push({reductionLevel:D,reserved:B,dataOffset:I,indexOffset:q})}const E=c===cb?"bigbed":"bigwig";if(g>n||y>n-8*5)return this._getMainHeader(t,n*2);let k;if(y){const M=i.subarray(Number(y));let D=0;const B=new DataView(M.buffer,M.byteOffset,M.length),I=Number(B.getBigUint64(D,!0));D+=8;const q=B.getFloat64(D,!0);D+=8;const Z=B.getFloat64(D,!0);D+=8;const te=B.getFloat64(D,!0);D+=8;const J=B.getFloat64(D,!0);D+=8,k={scoreMin:q,scoreMax:Z,scoreSum:te,scoreSumSquares:J,basesCovered:I}}else throw new Error("no stats");return{zoomLevels:S,magic:c,extHeaderOffset:w,numZoomLevels:f,fieldCount:m,totalSummary:k,definedFieldCount:b,uncompressBufSize:v,asOffset:g,chromTreeOffset:h,totalSummaryOffset:y,unzoomedDataOffset:d,unzoomedIndexOffset:p,fileType:E,version:u,isBigEndian:o,autoSql:g?i.subarray(g,i.indexOf(0,g)).toString():""}}_isBigEndian(t){let n=t.readInt32LE(0);if(n===s5||n===cb)return!1;if(n=t.readInt32BE(0),n===s5||n===cb)return!0;throw new Error("not a BigWig/BigBed file")}async _readChromTree(t,n){const i=!t.isBigEndian,o=[],s={};let a=t.unzoomedDataOffset;const l=t.chromTreeOffset;for(;a%4!==0;)a+=1;const c=a-l,{buffer:u}=await this.bbi.read(ot.Buffer.alloc(c),0,c,Number(l),n),f=u,h=new DataView(f.buffer,f.byteOffset,f.length);let d=0;d+=4,d+=4;const p=h.getUint32(d,i);d+=4,d+=4,d+=8;const m=32,b=async g=>{let y=g;if(y>=u.length)throw new Error("reading beyond end of buffer");const v=h.getUint8(y);y+=2;const w=h.getUint16(y,i);if(y+=2,v)for(let S=0;S<w;S++){const E=u.subarray(y,y+p).toString().replaceAll("\0","");y+=p;const k=h.getUint32(y,i);y+=4;const M=h.getUint32(y,i);y+=4;const D={name:E,id:k,length:M};s[this.renameRefSeqs(E)]=k,o[k]=D}else{const S=[];for(let E=0;E<w;E++){y+=p;const k=Number(h.getBigUint64(y,i));y+=8,S.push(b(Number(k)-Number(l)))}await Promise.all(S)}};return await b(m),{refsByName:s,refsByNumber:o}}async getUnzoomedView(t){const{unzoomedIndexOffset:n,refsByName:r,uncompressBufSize:i,isBigEndian:o,fileType:s}=await this.getHeader(t);return new B6(this.bbi,r,n,o,i>0,s)}async getFeatureStream(t,n,r,i){await this.getHeader(i);const o=this.renameRefSeqs(t);let s;const{basesPerSpan:a,scale:l}=i||{};return a?s=await this.getView(1/a,i):l?s=await this.getView(l,i):s=await this.getView(1,i),new Qn(c=>{s.readWigData(o,n,r,c,i).catch(u=>{c.error(u)})})}async getFeatures(t,n,r,i){const o=await this.getFeatureStream(t,n,r,i);return(await n5(o.pipe(dQ()))).flat()}}class pQ extends a5{async getView(t,n){const{zoomLevels:r,refsByName:i,isBigEndian:o,uncompressBufSize:s}=await this.getHeader(n),a=1/t,l=r.length-1;for(let c=l;c>=0;c-=1){const u=r[c];if(u&&u.reductionLevel<=2*a)return new B6(this.bbi,i,u.indexOffset,o,s>0,"summary")}return this.getUnzoomedView(n)}}function gQ(e){return e.filter(t=>!!t)}class mQ extends a5{constructor(){super(...arguments),this.readIndicesCache=new hs({cache:new dd({maxSize:1}),fill:(t,n)=>this._readIndices({...t,signal:n})})}readIndices(t={}){const{signal:n,...r}=t;return this.readIndicesCache.get(JSON.stringify(r),t,n)}async getView(t,n){return this.getUnzoomedView(n)}async _readIndices(t){const{extHeaderOffset:n,isBigEndian:r}=await this.getHeader(t),{buffer:i}=await this.bbi.read(ot.Buffer.alloc(64),0,64,Number(n)),o=!r,s=i,a=new DataView(s.buffer,s.byteOffset,s.length);let l=0;l+=2;const c=a.getUint16(l,o);l+=2;const u=Number(a.getBigUint64(l,o));if(l+=8,c===0)return[];const f=20,h=f*c,{buffer:d}=await this.bbi.read(ot.Buffer.alloc(h),0,h,Number(u)),p=[];for(let m=0;m<c;m+=1){const b=d.subarray(m*f),g=new DataView(b.buffer,b.byteOffset,b.length);let y=0;const v=g.getInt16(y,o);y+=2;const w=g.getInt16(y,o);y+=2;const S=Number(g.getBigUint64(y,o));y+=12;const E=g.getInt16(y,o);p.push({type:v,fieldcount:w,offset:Number(S),field:E})}return p}async searchExtraIndexBlocks(t,n={}){const{isBigEndian:r}=await this.getHeader(n),i=await this.readIndices(n);if(i.length===0)return[];const o=i.map(async s=>{const{offset:a,field:l}=s,{buffer:c}=await this.bbi.read(ot.Buffer.alloc(32),0,32,a,n),u=!r,f=c,h=new DataView(f.buffer,f.byteOffset,f.length);let d=0;d+=4;const p=h.getInt32(d,u);d+=4;const m=h.getInt32(d,u);d+=4;const b=h.getInt32(d,u);d+=4,d+=8;const g=async v=>{const w=Number(v),S=4+p*(m+b),{buffer:E}=await this.bbi.read(ot.Buffer.alloc(S),0,S,w,n),k=E,M=new DataView(k.buffer,k.byteOffset,k.length);let D=0;const B=M.getInt8(D);D+=2;const I=M.getInt16(D,u);D+=2;const q=[];if(B===0){const Z=[];for(let J=0;J<I;J++){const ce=k.subarray(D,D+m).toString().replaceAll("\0","");D+=m;const ae=Number(M.getBigUint64(D,u));D+=8,Z.push({key:ce,offset:ae})}let te=0;for(const{key:J,offset:ce}of Z){if(t.localeCompare(J)<0&&te)return g(te);te=ce}return g(te)}else if(B===1){for(let Z=0;Z<I;Z++){const te=k.subarray(D,D+m).toString().replaceAll("\0","");D+=m;const J=Number(M.getBigUint64(D,u));D+=8;const ce=M.getUint32(D,u);D+=4;const ae=M.getUint32(D,u);D+=4,q.push({key:te,offset:J,length:ce,reserved:ae})}for(const Z of q)if(Z.key===t)return{...Z,field:l};return}};return g(a+32)});return gQ(await Promise.all(o))}async searchExtraIndex(t,n={}){const r=await this.searchExtraIndexBlocks(t,n);if(r.length===0)return[];const i=await this.getUnzoomedView(n),o=r.map(a=>new Qn(l=>{i.readFeatures(l,[a],n).catch(c=>{l.error(c)})}).pipe(o5((l,c)=>l.concat(c)),r5(l=>{for(const c of l)c.field=a.field;return l})));return(await n5(uQ(...o))).filter(a=>{var l;return((l=a.rest)===null||l===void 0?void 0:l.split(" ")[(a.field||0)-3])===t})}}const l5=Object.freeze(Object.defineProperty({__proto__:null,BigBed:mQ,BigWig:pQ},Symbol.toStringTag,{value:"Module"}));var ub,c5;function bQ(){if(c5)return ub;c5=1;function e(r,i){function o(){this.constructor=r}o.prototype=i.prototype,r.prototype=new o}function t(r,i,o,s){this.message=r,this.expected=i,this.found=o,this.location=s,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)}e(t,Error),t.buildMessage=function(r,i){var o={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var d="",p;for(p=0;p<h.parts.length;p++)d+=h.parts[p]instanceof Array?l(h.parts[p][0])+"-"+l(h.parts[p][1]):l(h.parts[p]);return"["+(h.inverted?"^":"")+d+"]"},any:function(h){return"any character"},end:function(h){return"end of input"},other:function(h){return h.description}};function s(h){return h.charCodeAt(0).toString(16).toUpperCase()}function a(h){return h.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+s(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+s(d)})}function l(h){return h.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+s(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+s(d)})}function c(h){return o[h.type](h)}function u(h){var d=new Array(h.length),p,m;for(p=0;p<h.length;p++)d[p]=c(h[p]);if(d.sort(),d.length>0){for(p=1,m=1;p<d.length;p++)d[p-1]!==d[p]&&(d[m]=d[p],m++);d.length=m}switch(d.length){case 1:return d[0];case 2:return d[0]+" or "+d[1];default:return d.slice(0,-1).join(", ")+", or "+d[d.length-1]}}function f(h){return h?'"'+a(h)+'"':"end of input"}return"Expected "+u(r)+" but "+f(i)+" found."};function n(r,i){i=i!==void 0?i:{};var o={},s={declaration:bk},a=bk,l="(",c=Ve("(",!1),u=")",f=Ve(")",!1),h=function(O,le,Se,ke){return{type:O,name:le,comment:Se,fields:ke}},d="simple",p=Ve("simple",!1),m="object",b=Ve("object",!1),g="table",y=Ve("table",!1),v="auto",w=Ve("auto",!1),S="primary",E=Ve("primary",!1),k="index",M=Ve("index",!1),D="unique",B=Ve("unique",!1),I=function(O,le){return le},q=function(O,le){return O.name&&le.unshift(O),le},Z="#",te=Ve("#",!1),J=";",ce=Ve(";",!1),ae=function(O,le,Se){return{type:O,name:le,comment:Se}},we="[",me=Ve("[",!1),U="]",Ae=Ve("]",!1),Ce=function(O,le,Se,ke){return{type:O,size:le,name:Se,comment:ke}},H=function(O,le,Se,ke){return{type:O,vals:le,name:Se,comment:ke}},ze=",",qe=Ve(",",!1),Q=function(O,le){return le.unshift(O),le},X="int",re=Ve("int",!1),ie="uint",ye=Ve("uint",!1),L="short",R=Ve("short",!1),se="ushort",pe=Ve("ushort",!1),Re="byte",Te=Ve("byte",!1),Ie="ubyte",Me=Ve("ubyte",!1),wt="float",hn=Ve("float",!1),Bt="char",nt=Ve("char",!1),Nt="string",Wt=Ve("string",!1),st="lstring",Yt=Ve("lstring",!1),F="enum",A=Ve("enum",!1),C="double",z=Ve("double",!1),T="bigint",G=Ve("bigint",!1),Y="set",ge=Ve("set",!1),$=function(O,le){return O+" "+le},ee=/^[a-zA-Z_]/,_=Et([["a","z"],["A","Z"],"_"],!1,!1),ue=/^[a-zA-Z0-9_]/,Be=Et([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),x=function(O){return At()},ne=/^[^\n\r]/,oe=Et([`
3765
3765
  `,"\r"],!0,!1),P=function(O){return O.join("").replace(/^"/,"").replace(/"$/,"")},W=On("integer"),j=/^[0-9]/,de=Et([["0","9"]],!1,!1),ve=function(){return parseInt(At(),10)},Ee=On("whitespace"),Ue=/^[ \t\n\r]/,Tt=Et([" "," ",`
3766
- `,"\r"],!1,!1),V=0,Pe=0,ct=[{line:1,column:1}],rt=0,Qt=[],Fe=0,pi;if("startRule"in i){if(!(i.startRule in s))throw new Error(`Can't start parsing from rule "`+i.startRule+'".');a=s[i.startRule]}function At(){return r.substring(Pe,V)}function Ve(O,le){return{type:"literal",text:O,ignoreCase:le}}function Et(O,le,Se){return{type:"class",parts:O,inverted:le,ignoreCase:Se}}function mr(){return{type:"end"}}function On(O){return{type:"other",description:O}}function Hu(O){var le=ct[O],Se;if(le)return le;for(Se=O-1;!ct[Se];)Se--;for(le=ct[Se],le={line:le.line,column:le.column};Se<O;)r.charCodeAt(Se)===10?(le.line++,le.column=1):le.column++,Se++;return ct[O]=le,le}function mk(O,le){var Se=Hu(O),ke=Hu(le);return{start:{offset:O,line:Se.line,column:Se.column},end:{offset:le,line:ke.line,column:ke.column}}}function Ge(O){V<rt||(V>rt&&(rt=V,Qt=[]),Qt.push(O))}function vZ(O,le,Se){return new t(t.buildMessage(O,le),O,le,Se)}function bk(){var O,le,Se,ke,Oe,ft,vt,Jn,mo,gi,bo,mi,yo,bi;return O=V,le=Ye(),le!==o?(Se=yk(),Se!==o?(ke=Ye(),ke!==o?(Oe=wk(),Oe!==o?(ft=Ye(),ft!==o?(vt=Ud(),vt!==o?(Jn=Ye(),Jn!==o?(r.charCodeAt(V)===40?(mo=l,V++):(mo=o,Fe===0&&Ge(c)),mo!==o?(gi=Ye(),gi!==o?(bo=xZ(),bo!==o?(mi=Ye(),mi!==o?(r.charCodeAt(V)===41?(yo=u,V++):(yo=o,Fe===0&&Ge(f)),yo!==o?(bi=Ye(),bi!==o?(Pe=O,le=h(Se,Oe,vt,bo),O=le):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o),O}function yk(){var O;return r.substr(V,6)===d?(O=d,V+=6):(O=o,Fe===0&&Ge(p)),O===o&&(r.substr(V,6)===m?(O=m,V+=6):(O=o,Fe===0&&Ge(b)),O===o&&(r.substr(V,5)===g?(O=g,V+=5):(O=o,Fe===0&&Ge(y)))),O}function wk(){var O,le,Se,ke;return O=br(),O===o&&(O=V,le=br(),le!==o?(Se=vk(),Se!==o?(le=[le,Se],O=le):(V=O,O=o)):(V=O,O=o),O===o&&(O=V,le=br(),le!==o?(r.substr(V,4)===v?(Se=v,V+=4):(Se=o,Fe===0&&Ge(w)),Se!==o?(le=[le,Se],O=le):(V=O,O=o)):(V=O,O=o),O===o&&(O=V,le=br(),le!==o?(Se=vk(),Se!==o?(r.substr(V,4)===v?(ke=v,V+=4):(ke=o,Fe===0&&Ge(w)),ke!==o?(le=[le,Se,ke],O=le):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)))),O}function vk(){var O;return r.substr(V,7)===S?(O=S,V+=7):(O=o,Fe===0&&Ge(E)),O===o&&(r.substr(V,5)===k?(O=k,V+=5):(O=o,Fe===0&&Ge(M)),O===o&&(r.substr(V,6)===D?(O=D,V+=6):(O=o,Fe===0&&Ge(B)))),O}function Ud(){var O;return O=xk(),O===o&&(O=Ye()),O}function xZ(){var O,le,Se,ke,Oe,ft,vt;if(O=V,le=zb(),le!==o)if(Se=Ye(),Se!==o){for(ke=[],Oe=V,ft=Ye(),ft!==o?(vt=zb(),vt!==o?(Pe=Oe,ft=I(le,vt),Oe=ft):(V=Oe,Oe=o)):(V=Oe,Oe=o);Oe!==o;)ke.push(Oe),Oe=V,ft=Ye(),ft!==o?(vt=zb(),vt!==o?(Pe=Oe,ft=I(le,vt),Oe=ft):(V=Oe,Oe=o)):(V=Oe,Oe=o);ke!==o?(Oe=Ye(),Oe!==o?(Pe=O,le=q(le,ke),O=le):(V=O,O=o)):(V=O,O=o)}else V=O,O=o;else V=O,O=o;return O}function AZ(){var O;return r.charCodeAt(V)===35?(O=Z,V++):(O=o,Fe===0&&Ge(ne)),O}function EZ(){var O,le,Se,ke,Oe;return O=V,le=Ye(),le!==o?(Se=AZ(),Se!==o?(ke=xk(),ke!==o?(Oe=Ye(),Oe!==o?(le=[le,Se,ke,Oe],O=le):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o),O}function zb(){var O,le,Se,ke,Oe,ft,vt,Jn,mo,gi,bo,mi,yo,bi;return O=V,le=Ub(),le!==o?(Se=Ye(),Se!==o?(ke=br(),ke!==o?(Oe=Ye(),Oe!==o?(r.charCodeAt(V)===59?(ft=J,V++):(ft=o,Fe===0&&Ge(ce)),ft!==o?(vt=Ye(),vt!==o?(Jn=Ud(),Jn!==o?(Pe=O,le=ae(le,ke,Jn),O=le):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o),O===o&&(O=V,le=Ub(),le!==o?(Se=Ye(),Se!==o?(r.charCodeAt(V)===91?(ke=we,V++):(ke=o,Fe===0&&Ge(me)),ke!==o?(Oe=Ye(),Oe!==o?(ft=CZ(),ft!==o?(vt=Ye(),vt!==o?(r.charCodeAt(V)===93?(Jn=U,V++):(Jn=o,Fe===0&&Ge(Ae)),Jn!==o?(mo=Ye(),mo!==o?(gi=br(),gi!==o?(bo=Ye(),bo!==o?(r.charCodeAt(V)===59?(mi=J,V++):(mi=o,Fe===0&&Ge(ce)),mi!==o?(yo=Ye(),yo!==o?(bi=Ud(),bi!==o?(Pe=O,le=Ce(le,ft,gi,bi),O=le):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o),O===o&&(O=V,le=Ub(),le!==o?(Se=Ye(),Se!==o?(r.charCodeAt(V)===40?(ke=l,V++):(ke=o,Fe===0&&Ge(c)),ke!==o?(Oe=Ye(),Oe!==o?(ft=SZ(),ft!==o?(vt=Ye(),vt!==o?(r.charCodeAt(V)===41?(Jn=u,V++):(Jn=o,Fe===0&&Ge(f)),Jn!==o?(mo=Ye(),mo!==o?(gi=br(),gi!==o?(bo=Ye(),bo!==o?(r.charCodeAt(V)===59?(mi=J,V++):(mi=o,Fe===0&&Ge(ce)),mi!==o?(yo=Ye(),yo!==o?(bi=Ud(),bi!==o?(Pe=O,le=H(le,ft,gi,bi),O=le):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o),O===o&&(O=EZ()))),O}function SZ(){var O,le,Se,ke,Oe,ft,vt;if(O=V,le=br(),le!==o){for(Se=[],ke=V,r.charCodeAt(V)===44?(Oe=ze,V++):(Oe=o,Fe===0&&Ge(qe)),Oe!==o?(ft=Ye(),ft!==o?(vt=br(),vt!==o?(Pe=ke,Oe=I(le,vt),ke=Oe):(V=ke,ke=o)):(V=ke,ke=o)):(V=ke,ke=o);ke!==o;)Se.push(ke),ke=V,r.charCodeAt(V)===44?(Oe=ze,V++):(Oe=o,Fe===0&&Ge(qe)),Oe!==o?(ft=Ye(),ft!==o?(vt=br(),vt!==o?(Pe=ke,Oe=I(le,vt),ke=Oe):(V=ke,ke=o)):(V=ke,ke=o)):(V=ke,ke=o);Se!==o?(Pe=O,le=Q(le,Se),O=le):(V=O,O=o)}else V=O,O=o;return O}function Ub(){var O,le,Se,ke;return r.substr(V,3)===X?(O=X,V+=3):(O=o,Fe===0&&Ge(re)),O===o&&(r.substr(V,4)===ie?(O=ie,V+=4):(O=o,Fe===0&&Ge(ye)),O===o&&(r.substr(V,5)===L?(O=L,V+=5):(O=o,Fe===0&&Ge(R)),O===o&&(r.substr(V,6)===se?(O=se,V+=6):(O=o,Fe===0&&Ge(pe)),O===o&&(r.substr(V,4)===Re?(O=Re,V+=4):(O=o,Fe===0&&Ge(Te)),O===o&&(r.substr(V,5)===Ie?(O=Ie,V+=5):(O=o,Fe===0&&Ge(Me)),O===o&&(r.substr(V,5)===wt?(O=wt,V+=5):(O=o,Fe===0&&Ge(hn)),O===o&&(r.substr(V,4)===Bt?(O=Bt,V+=4):(O=o,Fe===0&&Ge(nt)),O===o&&(r.substr(V,6)===Nt?(O=Nt,V+=6):(O=o,Fe===0&&Ge(Wt)),O===o&&(r.substr(V,7)===st?(O=st,V+=7):(O=o,Fe===0&&Ge(Yt)),O===o&&(r.substr(V,4)===F?(O=F,V+=4):(O=o,Fe===0&&Ge(A)),O===o&&(r.substr(V,6)===C?(O=C,V+=6):(O=o,Fe===0&&Ge(z)),O===o&&(r.substr(V,6)===T?(O=T,V+=6):(O=o,Fe===0&&Ge(G)),O===o&&(r.substr(V,3)===Y?(O=Y,V+=3):(O=o,Fe===0&&Ge(ge)),O===o&&(O=V,le=yk(),le!==o?(Se=Ye(),Se!==o?(ke=wk(),ke!==o?(Pe=O,le=$(le,ke),O=le):(V=O,O=o)):(V=O,O=o)):(V=O,O=o))))))))))))))),O}function CZ(){var O;return O=kZ(),O===o&&(O=br()),O}function br(){var O,le,Se,ke,Oe;if(O=V,le=V,ee.test(r.charAt(V))?(Se=r.charAt(V),V++):(Se=o,Fe===0&&Ge(_)),Se!==o){for(ke=[],ue.test(r.charAt(V))?(Oe=r.charAt(V),V++):(Oe=o,Fe===0&&Ge(Be));Oe!==o;)ke.push(Oe),ue.test(r.charAt(V))?(Oe=r.charAt(V),V++):(Oe=o,Fe===0&&Ge(Be));ke!==o?(Se=[Se,ke],le=Se):(V=le,le=o)}else V=le,le=o;return le!==o&&(Pe=O,le=x()),O=le,O}function xk(){var O,le,Se;for(O=V,le=[],te.test(r.charAt(V))?(Se=r.charAt(V),V++):(Se=o,Fe===0&&Ge(oe));Se!==o;)le.push(Se),te.test(r.charAt(V))?(Se=r.charAt(V),V++):(Se=o,Fe===0&&Ge(oe));return le!==o&&(Pe=O,le=P(le)),O=le,O}function kZ(){var O,le,Se,ke;if(Fe++,O=V,le=Ye(),le!==o){if(Se=[],j.test(r.charAt(V))?(ke=r.charAt(V),V++):(ke=o,Fe===0&&Ge(de)),ke!==o)for(;ke!==o;)Se.push(ke),j.test(r.charAt(V))?(ke=r.charAt(V),V++):(ke=o,Fe===0&&Ge(de));else Se=o;Se!==o?(Pe=O,le=ve(),O=le):(V=O,O=o)}else V=O,O=o;return Fe--,O===o&&(le=o,Fe===0&&Ge(W)),O}function Ye(){var O,le;for(Fe++,O=[],Ue.test(r.charAt(V))?(le=r.charAt(V),V++):(le=o,Fe===0&&Ge(Tt));le!==o;)O.push(le),Ue.test(r.charAt(V))?(le=r.charAt(V),V++):(le=o,Fe===0&&Ge(Tt));return Fe--,O===o&&(le=o,Fe===0&&Ge(Ee)),O}if(pi=a(),pi!==o&&V===r.length)return pi;throw pi!==o&&V<r.length&&Ge(mr()),vZ(Qt,rt<r.length?r.charAt(rt):null,rt<r.length?mk(rt,rt+1):mk(rt,rt))}return ub={SyntaxError:t,parse:n},ub}var u5=bQ();const yQ=ld(u5),fb=Object.fromEntries(Object.entries(Object.freeze(Object.defineProperty({__proto__:null,bigChain:`table bigChain
3766
+ `,"\r"],!1,!1),V=0,Pe=0,ct=[{line:1,column:1}],rt=0,Qt=[],Fe=0,pi;if("startRule"in i){if(!(i.startRule in s))throw new Error(`Can't start parsing from rule "`+i.startRule+'".');a=s[i.startRule]}function At(){return r.substring(Pe,V)}function Ve(O,le){return{type:"literal",text:O,ignoreCase:le}}function Et(O,le,Se){return{type:"class",parts:O,inverted:le,ignoreCase:Se}}function mr(){return{type:"end"}}function On(O){return{type:"other",description:O}}function Hu(O){var le=ct[O],Se;if(le)return le;for(Se=O-1;!ct[Se];)Se--;for(le=ct[Se],le={line:le.line,column:le.column};Se<O;)r.charCodeAt(Se)===10?(le.line++,le.column=1):le.column++,Se++;return ct[O]=le,le}function mk(O,le){var Se=Hu(O),ke=Hu(le);return{start:{offset:O,line:Se.line,column:Se.column},end:{offset:le,line:ke.line,column:ke.column}}}function Ge(O){V<rt||(V>rt&&(rt=V,Qt=[]),Qt.push(O))}function vZ(O,le,Se){return new t(t.buildMessage(O,le),O,le,Se)}function bk(){var O,le,Se,ke,Oe,ft,vt,Jn,mo,gi,bo,mi,yo,bi;return O=V,le=Ye(),le!==o?(Se=yk(),Se!==o?(ke=Ye(),ke!==o?(Oe=wk(),Oe!==o?(ft=Ye(),ft!==o?(vt=Ud(),vt!==o?(Jn=Ye(),Jn!==o?(r.charCodeAt(V)===40?(mo=l,V++):(mo=o,Fe===0&&Ge(c)),mo!==o?(gi=Ye(),gi!==o?(bo=xZ(),bo!==o?(mi=Ye(),mi!==o?(r.charCodeAt(V)===41?(yo=u,V++):(yo=o,Fe===0&&Ge(f)),yo!==o?(bi=Ye(),bi!==o?(Pe=O,le=h(Se,Oe,vt,bo),O=le):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o),O}function yk(){var O;return r.substr(V,6)===d?(O=d,V+=6):(O=o,Fe===0&&Ge(p)),O===o&&(r.substr(V,6)===m?(O=m,V+=6):(O=o,Fe===0&&Ge(b)),O===o&&(r.substr(V,5)===g?(O=g,V+=5):(O=o,Fe===0&&Ge(y)))),O}function wk(){var O,le,Se,ke;return O=br(),O===o&&(O=V,le=br(),le!==o?(Se=vk(),Se!==o?(le=[le,Se],O=le):(V=O,O=o)):(V=O,O=o),O===o&&(O=V,le=br(),le!==o?(r.substr(V,4)===v?(Se=v,V+=4):(Se=o,Fe===0&&Ge(w)),Se!==o?(le=[le,Se],O=le):(V=O,O=o)):(V=O,O=o),O===o&&(O=V,le=br(),le!==o?(Se=vk(),Se!==o?(r.substr(V,4)===v?(ke=v,V+=4):(ke=o,Fe===0&&Ge(w)),ke!==o?(le=[le,Se,ke],O=le):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)))),O}function vk(){var O;return r.substr(V,7)===S?(O=S,V+=7):(O=o,Fe===0&&Ge(E)),O===o&&(r.substr(V,5)===k?(O=k,V+=5):(O=o,Fe===0&&Ge(M)),O===o&&(r.substr(V,6)===D?(O=D,V+=6):(O=o,Fe===0&&Ge(B)))),O}function Ud(){var O;return O=xk(),O===o&&(O=Ye()),O}function xZ(){var O,le,Se,ke,Oe,ft,vt;if(O=V,le=zb(),le!==o)if(Se=Ye(),Se!==o){for(ke=[],Oe=V,ft=Ye(),ft!==o?(vt=zb(),vt!==o?(Pe=Oe,ft=I(le,vt),Oe=ft):(V=Oe,Oe=o)):(V=Oe,Oe=o);Oe!==o;)ke.push(Oe),Oe=V,ft=Ye(),ft!==o?(vt=zb(),vt!==o?(Pe=Oe,ft=I(le,vt),Oe=ft):(V=Oe,Oe=o)):(V=Oe,Oe=o);ke!==o?(Oe=Ye(),Oe!==o?(Pe=O,le=q(le,ke),O=le):(V=O,O=o)):(V=O,O=o)}else V=O,O=o;else V=O,O=o;return O}function AZ(){var O;return r.charCodeAt(V)===35?(O=Z,V++):(O=o,Fe===0&&Ge(te)),O}function EZ(){var O,le,Se,ke,Oe;return O=V,le=Ye(),le!==o?(Se=AZ(),Se!==o?(ke=xk(),ke!==o?(Oe=Ye(),Oe!==o?(le=[le,Se,ke,Oe],O=le):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o),O}function zb(){var O,le,Se,ke,Oe,ft,vt,Jn,mo,gi,bo,mi,yo,bi;return O=V,le=Ub(),le!==o?(Se=Ye(),Se!==o?(ke=br(),ke!==o?(Oe=Ye(),Oe!==o?(r.charCodeAt(V)===59?(ft=J,V++):(ft=o,Fe===0&&Ge(ce)),ft!==o?(vt=Ye(),vt!==o?(Jn=Ud(),Jn!==o?(Pe=O,le=ae(le,ke,Jn),O=le):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o),O===o&&(O=V,le=Ub(),le!==o?(Se=Ye(),Se!==o?(r.charCodeAt(V)===91?(ke=we,V++):(ke=o,Fe===0&&Ge(me)),ke!==o?(Oe=Ye(),Oe!==o?(ft=CZ(),ft!==o?(vt=Ye(),vt!==o?(r.charCodeAt(V)===93?(Jn=U,V++):(Jn=o,Fe===0&&Ge(Ae)),Jn!==o?(mo=Ye(),mo!==o?(gi=br(),gi!==o?(bo=Ye(),bo!==o?(r.charCodeAt(V)===59?(mi=J,V++):(mi=o,Fe===0&&Ge(ce)),mi!==o?(yo=Ye(),yo!==o?(bi=Ud(),bi!==o?(Pe=O,le=Ce(le,ft,gi,bi),O=le):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o),O===o&&(O=V,le=Ub(),le!==o?(Se=Ye(),Se!==o?(r.charCodeAt(V)===40?(ke=l,V++):(ke=o,Fe===0&&Ge(c)),ke!==o?(Oe=Ye(),Oe!==o?(ft=SZ(),ft!==o?(vt=Ye(),vt!==o?(r.charCodeAt(V)===41?(Jn=u,V++):(Jn=o,Fe===0&&Ge(f)),Jn!==o?(mo=Ye(),mo!==o?(gi=br(),gi!==o?(bo=Ye(),bo!==o?(r.charCodeAt(V)===59?(mi=J,V++):(mi=o,Fe===0&&Ge(ce)),mi!==o?(yo=Ye(),yo!==o?(bi=Ud(),bi!==o?(Pe=O,le=H(le,ft,gi,bi),O=le):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o)):(V=O,O=o),O===o&&(O=EZ()))),O}function SZ(){var O,le,Se,ke,Oe,ft,vt;if(O=V,le=br(),le!==o){for(Se=[],ke=V,r.charCodeAt(V)===44?(Oe=ze,V++):(Oe=o,Fe===0&&Ge(qe)),Oe!==o?(ft=Ye(),ft!==o?(vt=br(),vt!==o?(Pe=ke,Oe=I(le,vt),ke=Oe):(V=ke,ke=o)):(V=ke,ke=o)):(V=ke,ke=o);ke!==o;)Se.push(ke),ke=V,r.charCodeAt(V)===44?(Oe=ze,V++):(Oe=o,Fe===0&&Ge(qe)),Oe!==o?(ft=Ye(),ft!==o?(vt=br(),vt!==o?(Pe=ke,Oe=I(le,vt),ke=Oe):(V=ke,ke=o)):(V=ke,ke=o)):(V=ke,ke=o);Se!==o?(Pe=O,le=Q(le,Se),O=le):(V=O,O=o)}else V=O,O=o;return O}function Ub(){var O,le,Se,ke;return r.substr(V,3)===X?(O=X,V+=3):(O=o,Fe===0&&Ge(re)),O===o&&(r.substr(V,4)===ie?(O=ie,V+=4):(O=o,Fe===0&&Ge(ye)),O===o&&(r.substr(V,5)===L?(O=L,V+=5):(O=o,Fe===0&&Ge(R)),O===o&&(r.substr(V,6)===se?(O=se,V+=6):(O=o,Fe===0&&Ge(pe)),O===o&&(r.substr(V,4)===Re?(O=Re,V+=4):(O=o,Fe===0&&Ge(Te)),O===o&&(r.substr(V,5)===Ie?(O=Ie,V+=5):(O=o,Fe===0&&Ge(Me)),O===o&&(r.substr(V,5)===wt?(O=wt,V+=5):(O=o,Fe===0&&Ge(hn)),O===o&&(r.substr(V,4)===Bt?(O=Bt,V+=4):(O=o,Fe===0&&Ge(nt)),O===o&&(r.substr(V,6)===Nt?(O=Nt,V+=6):(O=o,Fe===0&&Ge(Wt)),O===o&&(r.substr(V,7)===st?(O=st,V+=7):(O=o,Fe===0&&Ge(Yt)),O===o&&(r.substr(V,4)===F?(O=F,V+=4):(O=o,Fe===0&&Ge(A)),O===o&&(r.substr(V,6)===C?(O=C,V+=6):(O=o,Fe===0&&Ge(z)),O===o&&(r.substr(V,6)===T?(O=T,V+=6):(O=o,Fe===0&&Ge(G)),O===o&&(r.substr(V,3)===Y?(O=Y,V+=3):(O=o,Fe===0&&Ge(ge)),O===o&&(O=V,le=yk(),le!==o?(Se=Ye(),Se!==o?(ke=wk(),ke!==o?(Pe=O,le=$(le,ke),O=le):(V=O,O=o)):(V=O,O=o)):(V=O,O=o))))))))))))))),O}function CZ(){var O;return O=kZ(),O===o&&(O=br()),O}function br(){var O,le,Se,ke,Oe;if(O=V,le=V,ee.test(r.charAt(V))?(Se=r.charAt(V),V++):(Se=o,Fe===0&&Ge(_)),Se!==o){for(ke=[],ue.test(r.charAt(V))?(Oe=r.charAt(V),V++):(Oe=o,Fe===0&&Ge(Be));Oe!==o;)ke.push(Oe),ue.test(r.charAt(V))?(Oe=r.charAt(V),V++):(Oe=o,Fe===0&&Ge(Be));ke!==o?(Se=[Se,ke],le=Se):(V=le,le=o)}else V=le,le=o;return le!==o&&(Pe=O,le=x()),O=le,O}function xk(){var O,le,Se;for(O=V,le=[],ne.test(r.charAt(V))?(Se=r.charAt(V),V++):(Se=o,Fe===0&&Ge(oe));Se!==o;)le.push(Se),ne.test(r.charAt(V))?(Se=r.charAt(V),V++):(Se=o,Fe===0&&Ge(oe));return le!==o&&(Pe=O,le=P(le)),O=le,O}function kZ(){var O,le,Se,ke;if(Fe++,O=V,le=Ye(),le!==o){if(Se=[],j.test(r.charAt(V))?(ke=r.charAt(V),V++):(ke=o,Fe===0&&Ge(de)),ke!==o)for(;ke!==o;)Se.push(ke),j.test(r.charAt(V))?(ke=r.charAt(V),V++):(ke=o,Fe===0&&Ge(de));else Se=o;Se!==o?(Pe=O,le=ve(),O=le):(V=O,O=o)}else V=O,O=o;return Fe--,O===o&&(le=o,Fe===0&&Ge(W)),O}function Ye(){var O,le;for(Fe++,O=[],Ue.test(r.charAt(V))?(le=r.charAt(V),V++):(le=o,Fe===0&&Ge(Tt));le!==o;)O.push(le),Ue.test(r.charAt(V))?(le=r.charAt(V),V++):(le=o,Fe===0&&Ge(Tt));return Fe--,O===o&&(le=o,Fe===0&&Ge(Ee)),O}if(pi=a(),pi!==o&&V===r.length)return pi;throw pi!==o&&V<r.length&&Ge(mr()),vZ(Qt,rt<r.length?r.charAt(rt):null,rt<r.length?mk(rt,rt+1):mk(rt,rt))}return ub={SyntaxError:t,parse:n},ub}var u5=bQ();const yQ=ld(u5),fb=Object.fromEntries(Object.entries(Object.freeze(Object.defineProperty({__proto__:null,bigChain:`table bigChain
3767
3767
  "bigChain pairwise alignment"
3768
3768
  (
3769
3769
  string chrom; "Reference sequence chromosome or scaffold"
@@ -3922,9 +3922,9 @@ ${JSON.stringify(h.stats.first,null,2)}</pre
3922
3922
  float score; "Floating point score."
3923
3923
  char[1] leftStatus; "Gap/break annotation for preceding block"
3924
3924
  char[1] rightStatus; "Gap/break annotation for following block"
3925
- )`},Symbol.toStringTag,{value:"Module"}))).map(([e,t])=>[e,u5.parse(t.trim())]));function hb(e){const t=new Set(["uint","int","float","long"]);return{...e,fields:e.fields.map(n=>({...n,isArray:n.size&&n.type!=="char",arrayIsNumeric:n.size&&t.has(n.type),isNumeric:!n.size&&t.has(n.type)})).filter(n=>!!n.name)}}const wQ={".":0,"-":-1,"+":1};function vQ(e){var t;return e.length>=12&&!Number.isNaN(parseInt(e[9],10))&&((t=e[10])===null||t===void 0?void 0:t.split(",").filter(n=>!!n).length)===parseInt(e[9],10)}class xQ{constructor(t={}){if(t.autoSql)this.autoSql=hb(yQ.parse(t.autoSql));else if(t.type){if(!fb[t.type])throw new Error("Type not found");this.autoSql=hb(fb[t.type])}else this.autoSql=hb(fb.defaultBedSchema),this.attemptDefaultBed=!0}parseLine(t,n={}){const{autoSql:r}=this,{uniqueId:i}=n,o=Array.isArray(t)?t:t.split(" ");let s={};if(!this.attemptDefaultBed||this.attemptDefaultBed&&vQ(o))for(let a=0;a<r.fields.length;a++){const l=r.fields[a];let c=o[a];const{isNumeric:u,isArray:f,arrayIsNumeric:h,name:d}=l;if(c==null)break;if(c!=="."){if(u){const p=Number(c);c=Number.isNaN(p)?c:p}else f&&(c=c.split(","),c[c.length-1]===""&&c.pop(),h&&(c=c.map(Number)));s[d]=c}}else{const a=["chrom","chromStart","chromEnd","name"];s=Object.fromEntries(o.map((l,c)=>[a[c]||"field"+c,l])),s.chromStart=+s.chromStart,s.chromEnd=+s.chromEnd,Number.isNaN(Number.parseFloat(s.field4))||(s.score=+s.field4,delete s.field4),(s.field5==="+"||s.field5==="-")&&(s.strand=s.field5,delete s.field5)}return i&&(s.uniqueId=i),s.strand=wQ[s.strand]||0,s.chrom=decodeURIComponent(s.chrom),s}}const AQ=Object.freeze(Object.defineProperty({__proto__:null,default:xQ},Symbol.toStringTag,{value:"Module"}));let f5=class{constructor(t,n){this.blockPosition=t,this.dataPosition=n}toString(){return`${this.blockPosition}:${this.dataPosition}`}compareTo(t){return this.blockPosition-t.blockPosition||this.dataPosition-t.dataPosition}static min(...t){let n,r=0;for(;!n;r+=1)n=t[r];for(;r<t.length;r+=1)n.compareTo(t[r])>0&&(n=t[r]);return n}};function Fa(e,t=0,n=!1){if(n)throw new Error("big-endian virtual file offsets not implemented");return new f5(e[t+7]*1099511627776+e[t+6]*4294967296+e[t+5]*16777216+e[t+4]*65536+e[t+3]*256+e[t+2],e[t+1]<<8|e[t])}let db=class{constructor(t,n,r,i){this.minv=t,this.maxv=n,this.bin=r,this._fetchedSize=i}toUniqueString(){return`${this.minv.toString()}..${this.maxv.toString()} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`}toString(){return this.toUniqueString()}compareTo(t){return this.minv.compareTo(t.minv)||this.maxv.compareTo(t.maxv)||this.bin-t.bin}fetchedSize(){return this._fetchedSize!==void 0?this._fetchedSize:this.maxv.blockPosition+65536-this.minv.blockPosition}};function EQ(e){return new Promise(t=>setTimeout(t,e))}function SQ(e){if(e&&e.aborted)if(typeof DOMException>"u"){const t=new Error("aborted");throw t.code="ERR_ABORTED",t}else throw new DOMException("aborted","AbortError")}function CQ(e,t){return t.minv.blockPosition-e.maxv.blockPosition<65e3&&t.maxv.blockPosition-e.minv.blockPosition<5e6}function kQ(e={}){return"aborted"in e?{signal:e}:e}function h5(e,t){const n=[];let r;if(e.length===0)return e;e.sort((i,o)=>{const s=i.minv.blockPosition-o.minv.blockPosition;return s===0?i.minv.dataPosition-o.minv.dataPosition:s});for(const i of e)(!t||i.maxv.compareTo(t)>0)&&(r===void 0?(n.push(i),r=i):CQ(r,i)?i.maxv.compareTo(r.maxv)>0&&(r.maxv=i.maxv):(n.push(i),r=i));return n}function d5(e,t){return{lineCount:fd.fromBytesLE(Array.prototype.slice.call(e,t,t+8),!0).toNumber()}}function Sd(e,t){return e?e.compareTo(t)>0?t:e:t}function TQ(e,t=n=>n){let n=0,r=0;const i=[],o={};for(let s=0;s<e.length;s+=1)if(!e[s]){if(r<s){let a=e.toString("utf8",r,s);a=t(a),i[n]=a,o[a]=n}r=s+1,n+=1}return{refNameToId:o,refIdToName:i}}let p5=class{constructor({filehandle:t,renameRefSeq:n=r=>r}){this.filehandle=t,this.renameRefSeq=n}};const IQ=21578050;function _Q(e,t){return e-e%t}function DQ(e,t){return e-e%t+t}function RQ(e,t){return t-=1,[[0,0],[1+(e>>26),1+(t>>26)],[9+(e>>23),9+(t>>23)],[73+(e>>20),73+(t>>20)],[585+(e>>17),585+(t>>17)],[4681+(e>>14),4681+(t>>14)]]}class Ma extends p5{async lineCount(t,n){var r,i;return((i=(r=(await this.parse(n)).indices[t])===null||r===void 0?void 0:r.stats)===null||i===void 0?void 0:i.lineCount)||0}async _parse(t){const n=await this.filehandle.readFile(t);if(n.readUInt32LE(0)!==IQ)throw new Error("Not a BAI file");const r=n.readInt32LE(4),o=((1<<(5+1)*3)-1)/7;let s=8,a;const l=new Array(r);for(let c=0;c<r;c++){const u=n.readInt32LE(s);let f;s+=4;const h={};for(let m=0;m<u;m+=1){const b=n.readUInt32LE(s);if(s+=4,b===o+1)s+=4,f=d5(n,s+16),s+=32;else{if(b>o+1)throw new Error("bai index contains too many bins, please use CSI");{const g=n.readInt32LE(s);s+=4;const y=new Array(g);for(let v=0;v<g;v++){const w=Fa(n,s);s+=8;const S=Fa(n,s);s+=8,a=Sd(a,w),y[v]=new db(w,S,b)}h[b]=y}}}const d=n.readInt32LE(s);s+=4;const p=new Array(d);for(let m=0;m<d;m++){const b=Fa(n,s);s+=8,a=Sd(a,b),p[m]=b}l[c]={binIndex:h,linearIndex:p,stats:f}}return{bai:!0,firstDataLine:a,maxBlockSize:65536,indices:l,refCount:r}}async indexCov(t,n,r,i={}){const s=n!==void 0,l=(await this.parse(i)).indices[t];if(!l)return[];const{linearIndex:c=[],stats:u}=l;if(c.length===0)return[];const f=r===void 0?(c.length-1)*16384:DQ(r,16384),h=n===void 0?0:_Q(n,16384),d=s?new Array((f-h)/16384):new Array(c.length-1),p=c[c.length-1].blockPosition;if(f>(c.length-1)*16384)throw new Error("query outside of range of linear index");let m=c[h/16384].blockPosition;for(let b=h/16384,g=0;b<f/16384;b++,g++)d[g]={score:c[b+1].blockPosition-m,start:b*16384,end:b*16384+16384},m=c[b+1].blockPosition;return d.map(b=>({...b,score:b.score*((u==null?void 0:u.lineCount)||0)/p}))}async blocksForRange(t,n,r,i={}){n<0&&(n=0);const o=await this.parse(i);if(!o)return[];const s=o.indices[t];if(!s)return[];const a=RQ(n,r),l=[];for(const[d,p]of a)for(let m=d;m<=p;m++)if(s.binIndex[m]){const b=s.binIndex[m];for(const g of b)l.push(new db(g.minv,g.maxv,m))}const c=s.linearIndex.length;let u;const f=Math.min(n>>14,c-1),h=Math.min(r>>14,c-1);for(let d=f;d<=h;++d){const p=s.linearIndex[d];p&&(!u||p.compareTo(u)<0)&&(u=p)}return h5(l,u)}async parse(t={}){return this.setupP||(this.setupP=this._parse(t).catch(n=>{throw this.setupP=void 0,n})),this.setupP}async hasRefSeq(t,n={}){var r;return!!(!((r=(await this.parse(n)).indices[t])===null||r===void 0)&&r.binIndex)}}let pb=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];typeof Int32Array<"u"&&(pb=new Int32Array(pb));const BQ=(e,t)=>{let n=t===0?0:~~t^-1;for(let r=0;r<e.length;r++)n=pb[(n^e[r])&255]^n>>>8;return n^-1},g5=(e,t)=>ot.Buffer.from(e,t);function FQ(e,t){const n=(r,i)=>t(g5(r),i)>>>0;return n.signed=(r,i)=>t(g5(r),i),n.unsigned=n,n.model=e,n}const MQ=FQ("crc-32",BQ),PQ=21582659,OQ=38359875;function LQ(e,t){return e*2**t}function m5(e,t){return Math.floor(e/2**t)}let Cd=class extends p5{constructor(){super(...arguments),this.maxBinNumber=0,this.depth=0,this.minShift=0}async lineCount(t,n){var r,i;return((i=(r=(await this.parse(n)).indices[t])===null||r===void 0?void 0:r.stats)===null||i===void 0?void 0:i.lineCount)||0}async indexCov(){return[]}parseAuxData(t,n){const r=t.readInt32LE(n),i=r&65536?"zero-based-half-open":"1-based-closed",o={0:"generic",1:"SAM",2:"VCF"}[r&15];if(!o)throw new Error(`invalid Tabix preset format flags ${r}`);const s={ref:t.readInt32LE(n+4),start:t.readInt32LE(n+8),end:t.readInt32LE(n+12)},a=t.readInt32LE(n+16),l=a?String.fromCharCode(a):"",c=t.readInt32LE(n+20),u=t.readInt32LE(n+24);return{columnNumbers:s,coordinateType:i,metaValue:a,metaChar:l,skipLines:c,format:o,formatFlags:r,...TQ(t.subarray(n+28,n+28+u),this.renameRefSeq)}}async _parse(t){const n=await this.filehandle.readFile(t),r=await io(n);let i;if(r.readUInt32LE(0)===PQ)i=1;else if(r.readUInt32LE(0)===OQ)i=2;else throw new Error("Not a CSI file");this.minShift=r.readInt32LE(4),this.depth=r.readInt32LE(8),this.maxBinNumber=((1<<(this.depth+1)*3)-1)/7;const o=r.readInt32LE(12),s=o>=30?this.parseAuxData(r,16):void 0,a=r.readInt32LE(16+o);let l=16+o+4,c;const u=new Array(a);for(let f=0;f<a;f++){const h=r.readInt32LE(l);l+=4;const d={};let p;for(let m=0;m<h;m++){const b=r.readUInt32LE(l);if(l+=4,b>this.maxBinNumber)p=d5(r,l+28),l+=44;else{c=Sd(c,Fa(r,l)),l+=8;const g=r.readInt32LE(l);l+=4;const y=new Array(g);for(let v=0;v<g;v+=1){const w=Fa(r,l);l+=8;const S=Fa(r,l);l+=8,c=Sd(c,w),y[v]=new db(w,S,b)}d[b]=y}}u[f]={binIndex:d,stats:p}}return{csiVersion:i,firstDataLine:c,indices:u,refCount:a,csi:!0,maxBlockSize:65536,...s}}async blocksForRange(t,n,r,i={}){n<0&&(n=0);const s=(await this.parse(i)).indices[t];if(!s)return[];const a=this.reg2bins(n,r);if(a.length===0)return[];const l=[];for(const[c,u]of a)for(let f=c;f<=u;f++)if(s.binIndex[f]){const h=s.binIndex[f];for(const d of h)l.push(d)}return h5(l,new f5(0,0))}reg2bins(t,n){t-=1,t<1&&(t=1),n>2**50&&(n=2**34),n-=1;let r=0,i=0,o=this.minShift+this.depth*3;const s=[];for(;r<=this.depth;o-=3,i+=LQ(1,r*3),r+=1){const a=i+m5(t,o),l=i+m5(n,o);if(l-a+s.length>this.maxBinNumber)throw new Error(`query ${t}-${n} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);s.push([a,l])}return s}async parse(t={}){return this.setupP||(this.setupP=this._parse(t).catch(n=>{throw this.setupP=void 0,n})),this.setupP}async hasRefSeq(t,n={}){var r;return!!(!((r=(await this.parse(n)).indices[t])===null||r===void 0)&&r.binIndex)}};const Zn={BAM_FPAIRED:1,BAM_FPROPER_PAIR:2,BAM_FUNMAP:4,BAM_FMUNMAP:8,BAM_FREVERSE:16,BAM_FMREVERSE:32,BAM_FREAD1:64,BAM_FREAD2:128,BAM_FSECONDARY:256,BAM_FQCFAIL:512,BAM_FDUP:1024,BAM_FSUPPLEMENTARY:2048},b5="=ACMGRSVTWYHKDBN".split(""),fu="MIDNSHP=X???????".split("");class Pa{constructor(t){this.bytes=t.bytes,this.fileOffset=t.fileOffset}get byteArray(){return this.bytes.byteArray}get flags(){return(this.byteArray.readInt32LE(this.bytes.start+16)&4294901760)>>16}get ref_id(){return this.byteArray.readInt32LE(this.bytes.start+4)}get start(){return this.byteArray.readInt32LE(this.bytes.start+8)}get end(){return this.start+this.length_on_ref}get id(){return this.fileOffset}get mq(){const t=(this.bin_mq_nl&65280)>>8;return t===255?void 0:t}get score(){return this.mq}get qual(){if(this.isSegmentUnmapped())return;const t=this.b0+this.read_name_length+this.num_cigar_ops*4+this.num_seq_bytes;return this.byteArray.subarray(t,t+this.seq_length)}get strand(){return this.isReverseComplemented()?-1:1}get b0(){return this.bytes.start+36}get name(){return this.byteArray.toString("ascii",this.b0,this.b0+this.read_name_length-1)}get tags(){const{byteArray:t}=this.bytes;let n=this.b0+this.read_name_length+this.num_cigar_ops*4+this.num_seq_bytes+this.seq_length;const r=this.bytes.end,i={};for(;n<r;){const o=String.fromCharCode(t[n],t[n+1]),s=String.fromCharCode(t[n+2]);if(n+=3,s==="A")i[o]=String.fromCharCode(t[n]),n+=1;else if(s==="i")i[o]=t.readInt32LE(n),n+=4;else if(s==="I")i[o]=t.readUInt32LE(n),n+=4;else if(s==="c")i[o]=t.readInt8(n),n+=1;else if(s==="C")i[o]=t.readUInt8(n),n+=1;else if(s==="s")i[o]=t.readInt16LE(n),n+=2;else if(s==="S")i[o]=t.readUInt16LE(n),n+=2;else if(s==="f")i[o]=t.readFloatLE(n),n+=4;else if(s==="Z"||s==="H"){const a=[];for(;n<=r;){const l=t[n++];if(l!==0)a.push(String.fromCharCode(l));else break}i[o]=a.join("")}else if(s==="B"){const a=t[n++],l=String.fromCharCode(a),c=t.readInt32LE(n);if(n+=4,l==="i")if(o==="CG"){const u=[];for(let f=0;f<c;f++){const h=t.readInt32LE(n),d=h>>4,p=fu[h&15];u.push(d+p),n+=4}i[o]=u.join("")}else{const u=[];for(let f=0;f<c;f++)u.push(t.readInt32LE(n)),n+=4;i[o]=u}else if(l==="I")if(o==="CG"){const u=[];for(let f=0;f<c;f++){const h=t.readUInt32LE(n),d=h>>4,p=fu[h&15];u.push(d+p),n+=4}i[o]=u.join("")}else{const u=[];for(let f=0;f<c;f++)u.push(t.readUInt32LE(n)),n+=4;i[o]=u}else if(l==="s"){const u=[];for(let f=0;f<c;f++)u.push(t.readInt16LE(n)),n+=2;i[o]=u}else if(l==="S"){const u=[];for(let f=0;f<c;f++)u.push(t.readUInt16LE(n)),n+=2;i[o]=u}else if(l==="c"){const u=[];for(let f=0;f<c;f++)u.push(t.readInt8(n)),n+=1;i[o]=u}else if(l==="C"){const u=[];for(let f=0;f<c;f++)u.push(t.readUInt8(n)),n+=1;i[o]=u}else if(l==="f"){const u=[];for(let f=0;f<c;f++)u.push(t.readFloatLE(n)),n+=4;i[o]=u}}else{console.error("Unknown BAM tag type",s);break}}return i}isPaired(){return!!(this.flags&Zn.BAM_FPAIRED)}isProperlyPaired(){return!!(this.flags&Zn.BAM_FPROPER_PAIR)}isSegmentUnmapped(){return!!(this.flags&Zn.BAM_FUNMAP)}isMateUnmapped(){return!!(this.flags&Zn.BAM_FMUNMAP)}isReverseComplemented(){return!!(this.flags&Zn.BAM_FREVERSE)}isMateReverseComplemented(){return!!(this.flags&Zn.BAM_FMREVERSE)}isRead1(){return!!(this.flags&Zn.BAM_FREAD1)}isRead2(){return!!(this.flags&Zn.BAM_FREAD2)}isSecondary(){return!!(this.flags&Zn.BAM_FSECONDARY)}isFailedQc(){return!!(this.flags&Zn.BAM_FQCFAIL)}isDuplicate(){return!!(this.flags&Zn.BAM_FDUP)}isSupplementary(){return!!(this.flags&Zn.BAM_FSUPPLEMENTARY)}get cigarAndLength(){if(this.isSegmentUnmapped())return{length_on_ref:0,CIGAR:""};const t=this.num_cigar_ops;let n=this.b0+this.read_name_length;const r=[];let i=this.byteArray.readInt32LE(n),o=i>>4,s=fu[i&15];if(s==="S"&&o===this.seq_length)return n+=4,i=this.byteArray.readInt32LE(n),o=i>>4,s=fu[i&15],s!=="N"&&console.warn("CG tag with no N tag"),{CIGAR:this.tags.CG,length_on_ref:o};{let a=0;for(let l=0;l<t;++l)i=this.byteArray.readInt32LE(n),o=i>>4,s=fu[i&15],r.push(o+s),s!=="H"&&s!=="S"&&s!=="I"&&(a+=o),n+=4;return{CIGAR:r.join(""),length_on_ref:a}}}get length_on_ref(){return this.cigarAndLength.length_on_ref}get CIGAR(){return this.cigarAndLength.CIGAR}get num_cigar_ops(){return this.flag_nc&65535}get read_name_length(){return this.bin_mq_nl&255}get num_seq_bytes(){return this.seq_length+1>>1}get seq(){const{byteArray:t}=this.bytes,n=this.b0+this.read_name_length+this.num_cigar_ops*4,r=this.num_seq_bytes,i=this.seq_length,o=[];let s=0;for(let a=0;a<r;++a){const l=t[n+a];o.push(b5[(l&240)>>4]),s++,s<i&&(o.push(b5[l&15]),s++)}return o.join("")}get pair_orientation(){if(!this.isSegmentUnmapped()&&!this.isMateUnmapped()&&this.ref_id===this.next_refid){const t=this.isReverseComplemented()?"R":"F",n=this.isMateReverseComplemented()?"R":"F";let r=" ",i=" ";this.isRead1()?(r="1",i="2"):this.isRead2()&&(r="2",i="1");const o=[];return this.template_length>0?(o[0]=t,o[1]=r,o[2]=n,o[3]=i):(o[2]=t,o[3]=r,o[0]=n,o[1]=i),o.join("")}}get bin_mq_nl(){return this.byteArray.readInt32LE(this.bytes.start+12)}get flag_nc(){return this.byteArray.readInt32LE(this.bytes.start+16)}get seq_length(){return this.byteArray.readInt32LE(this.bytes.start+20)}get next_refid(){return this.byteArray.readInt32LE(this.bytes.start+24)}get next_pos(){return this.byteArray.readInt32LE(this.bytes.start+28)}get template_length(){return this.byteArray.readInt32LE(this.bytes.start+32)}toJSON(){const t={};for(const n of Object.keys(this))n.startsWith("_")||n==="bytes"||(t[n]=this[n]);return t}}function kd(e,t){const n=Object.getOwnPropertyDescriptor(e.prototype,t);if(!n)throw new Error("OH NO, NO PROPERTY DESCRIPTOR");const r=n.get;if(!r)throw new Error("OH NO, NOT A GETTER");Object.defineProperty(e.prototype,t,{get(){const i=r.call(this);return Object.defineProperty(this,t,{value:i}),i}})}kd(Pa,"tags"),kd(Pa,"cigarAndLength"),kd(Pa,"seq"),kd(Pa,"qual");function y5(e){const t=e.split(/\r?\n/),n=[];for(const r of t){const[i,...o]=r.split(/\t/);i&&n.push({tag:i.slice(1),data:o.map(s=>{const a=s.indexOf(":"),l=s.slice(0,a),c=s.slice(a+1);return{tag:l,value:c}})})}return n}const w5=21840194,v5=65536;async function NQ(e){let t=[];for await(const n of e)t=t.concat(n);return t}class zQ{read(){throw new Error("never called")}stat(){throw new Error("never called")}readFile(){throw new Error("never called")}close(){throw new Error("never called")}}class x5{constructor({bamFilehandle:t,bamPath:n,bamUrl:r,baiPath:i,baiFilehandle:o,baiUrl:s,csiPath:a,csiFilehandle:l,csiUrl:c,htsget:u,yieldThreadTime:f=100,renameRefSeqs:h=d=>d}){if(this.htsget=!1,this.featureCache=new hs({cache:new dd({maxSize:50}),fill:async(d,p)=>{const{chunk:m,opts:b}=d,{data:g,cpositions:y,dpositions:v}=await this._readChunk({chunk:m,opts:{...b,signal:p}});return this.readBamFeatures(g,y,v,m)}}),this.renameRefSeq=h,t)this.bam=t;else if(n)this.bam=new qt(n);else if(r)this.bam=new ur(r);else if(u)this.htsget=!0,this.bam=new zQ;else throw new Error("unable to initialize bam");if(l)this.index=new Cd({filehandle:l});else if(a)this.index=new Cd({filehandle:new qt(a)});else if(c)this.index=new Cd({filehandle:new ur(c)});else if(o)this.index=new Ma({filehandle:o});else if(i)this.index=new Ma({filehandle:new qt(i)});else if(s)this.index=new Ma({filehandle:new ur(s)});else if(n)this.index=new Ma({filehandle:new qt(`${n}.bai`)});else if(r)this.index=new Ma({filehandle:new ur(`${r}.bai`)});else if(u)this.htsget=!0;else throw new Error("unable to infer index format");this.yieldThreadTime=f}async getHeaderPre(t){const n=kQ(t);if(!this.index)return;const r=await this.index.parse(n),i=r.firstDataLine?r.firstDataLine.blockPosition+65535:void 0;let o;if(i){const u=i+v5,f=await this.bam.read(ot.Buffer.alloc(u),0,u,0,n);if(!f.bytesRead)throw new Error("Error reading header");o=f.buffer.subarray(0,Math.min(f.bytesRead,i))}else o=await this.bam.readFile(n);const s=await io(o);if(s.readInt32LE(0)!==w5)throw new Error("Not a BAM file");const a=s.readInt32LE(4);this.header=s.toString("utf8",8,8+a);const{chrToIndex:l,indexToChr:c}=await this._readRefSeqs(a+8,65535,n);return this.chrToIndex=l,this.indexToChr=c,y5(this.header)}getHeader(t){return this.headerP||(this.headerP=this.getHeaderPre(t).catch(n=>{throw this.headerP=void 0,n})),this.headerP}async getHeaderText(t={}){return await this.getHeader(t),this.header}async _readRefSeqs(t,n,r){if(t>n)return this._readRefSeqs(t,n*2,r);const i=n+v5,{bytesRead:o,buffer:s}=await this.bam.read(ot.Buffer.alloc(i),0,n,0,r);if(!o)throw new Error("Error reading refseqs from header");const a=await io(s.subarray(0,Math.min(o,n))),l=a.readInt32LE(t);let c=t+4;const u={},f=[];for(let h=0;h<l;h+=1){const d=a.readInt32LE(c),p=this.renameRefSeq(a.toString("utf8",c+4,c+4+d-1)),m=a.readInt32LE(c+d+4);if(u[p]=h,f.push({refName:p,length:m}),c=c+8+d,c>a.length)return console.warn(`BAM header is very big. Re-fetching ${n} bytes.`),this._readRefSeqs(t,n*2,r)}return{chrToIndex:u,indexToChr:f}}async getRecordsForRange(t,n,r,i){return NQ(this.streamRecordsForRange(t,n,r,i))}async*streamRecordsForRange(t,n,r,i){var o;await this.getHeader(i);const s=(o=this.chrToIndex)===null||o===void 0?void 0:o[t];if(s===void 0||!this.index)yield[];else{const a=await this.index.blocksForRange(s,n-1,r,i);yield*this._fetchChunkFeatures(a,s,n,r,i)}}async*_fetchChunkFeatures(t,n,r,i,o={}){const{viewAsPairs:s}=o,a=[];let l=!1;for(const c of t){const u=await this.featureCache.get(c.toString(),{chunk:c,opts:o},o.signal),f=[];for(const h of u)if(h.ref_id===n)if(h.start>=i){l=!0;break}else h.end>=r&&f.push(h);if(a.push(f),yield f,l)break}SQ(o.signal),s&&(yield this.fetchPairs(n,a,o))}async fetchPairs(t,n,r){const{pairAcrossChr:i,maxInsertSize:o=2e5}=r,s={},a={};n.map(h=>{const d={};for(const p of h){const m=p.name,b=p.id;d[m]||(d[m]=0),d[m]++,a[b]=1}for(const[p,m]of Object.entries(d))m===1&&(s[p]=!0)});const l=[];n.map(h=>{for(const d of h){const p=d.name,m=d.start,b=d.next_pos,g=d.next_refid;this.index&&s[p]&&(i||g===t&&Math.abs(m-b)<o)&&l.push(this.index.blocksForRange(g,b,b+1,r))}});const c=new Map,u=await Promise.all(l);for(const h of u.flat())c.has(h.toString())||c.set(h.toString(),h);return(await Promise.all([...c.values()].map(async h=>{const{data:d,cpositions:p,dpositions:m,chunk:b}=await this._readChunk({chunk:h,opts:r}),g=[];for(const y of await this.readBamFeatures(d,p,m,b))s[y.name]&&!a[y.id]&&g.push(y);return g}))).flat()}async _readRegion(t,n,r={}){const{bytesRead:i,buffer:o}=await this.bam.read(ot.Buffer.alloc(n),0,n,t,r);return o.subarray(0,Math.min(i,n))}async _readChunk({chunk:t,opts:n}){const r=await this._readRegion(t.minv.blockPosition,t.fetchedSize(),n),{buffer:i,cpositions:o,dpositions:s}=await RC(r,t);return{data:i,cpositions:o,dpositions:s,chunk:t}}async readBamFeatures(t,n,r,i){let o=0;const s=[];let a=0,l=+Date.now();for(;o+4<t.length;){const c=t.readInt32LE(o),u=o+4+c-1;if(r){for(;o+i.minv.dataPosition>=r[a++];);a--}if(u<t.length){const f=new Pa({bytes:{byteArray:t,start:o,end:u},fileOffset:n.length>0?n[a]*256+(o-r[a])+i.minv.dataPosition+1:MQ.signed(t.slice(o,u))});s.push(f),this.yieldThreadTime&&+Date.now()-l>this.yieldThreadTime&&(await EQ(1),l=+Date.now())}o=u+1}return s}async hasRefSeq(t){var n,r;const i=(n=this.chrToIndex)===null||n===void 0?void 0:n[t];return i===void 0?!1:(r=this.index)===null||r===void 0?void 0:r.hasRefSeq(i)}async lineCount(t){var n;const r=(n=this.chrToIndex)===null||n===void 0?void 0:n[t];return r===void 0||!this.index?0:this.index.lineCount(r)}async indexCov(t,n,r){var i;if(!this.index)return[];await this.index.parse();const o=(i=this.chrToIndex)===null||i===void 0?void 0:i[t];return o===void 0?[]:this.index.indexCov(o,n,r)}async blocksForRange(t,n,r,i){var o;if(!this.index)return[];await this.index.parse();const s=(o=this.chrToIndex)===null||o===void 0?void 0:o[t];return s===void 0?[]:this.index.blocksForRange(s,n,r,i)}}async function A5(e,t){const n=await Promise.all(e.map(async r=>{const{url:i,headers:o}=r;if(i.startsWith("data:"))return ot.Buffer.from(i.split(",")[1],"base64");{const{referer:s,...a}=o,l=await fetch(i,{...t,headers:{...t==null?void 0:t.headers,...a}});if(!l.ok)throw new Error(`HTTP ${l.status} fetching ${i}: ${await l.text()}`);return ot.Buffer.from(await l.arrayBuffer())}}));return ot.Buffer.concat(await Promise.all(n.map(r=>io(r))))}class UQ extends x5{constructor(t){super({htsget:!0}),this.baseUrl=t.baseUrl,this.trackId=t.trackId}async*streamRecordsForRange(t,n,r,i){var o;const a=`${`${this.baseUrl}/${this.trackId}`}?referenceName=${t}&start=${n}&end=${r}&format=BAM`,l=(o=this.chrToIndex)===null||o===void 0?void 0:o[t];if(l===void 0)yield[];else{const c=await fetch(a,{...i});if(!c.ok)throw new Error(`HTTP ${c.status} fetching ${a}: ${await c.text()}`);const u=await c.json(),f=await A5(u.htsget.urls.slice(1),i);yield*this._fetchChunkFeatures([{buffer:f,_fetchedSize:void 0,bin:0,compareTo(){return 0},toUniqueString(){return`${t}_${n}_${r}`},fetchedSize(){return 0},minv:{dataPosition:0,blockPosition:0,compareTo:()=>0},maxv:{dataPosition:Number.MAX_SAFE_INTEGER,blockPosition:0,compareTo:()=>0},toString(){return`${t}_${n}_${r}`}}],l,n,r,i)}}async _readChunk({chunk:t}){if(!t.buffer)throw new Error("expected chunk.buffer in htsget");return{data:t.buffer,cpositions:[],dpositions:[],chunk:t}}async getHeader(t={}){const n=`${this.baseUrl}/${this.trackId}?referenceName=na&class=header`,r=await fetch(n,t);if(!r.ok)throw new Error(`HTTP ${r.status} fetching ${n}: ${await r.text()}`);const i=await r.json(),o=await A5(i.htsget.urls,t);if(o.readInt32LE(0)!==w5)throw new Error("Not a BAM file");const s=o.readInt32LE(4),a=o.toString("utf8",8,8+s),l=y5(a),c=[],u={},f=l.filter(h=>h.tag==="SQ");for(const[h,d]of f.entries()){let p="",m=0;for(const b of d.data)b.tag==="SN"?p=b.value:b.tag==="LN"&&(m=+b.value);u[p]=h,c[h]={refName:p,length:m}}return this.chrToIndex=u,this.indexToChr=c,l}}const HQ=Object.freeze(Object.defineProperty({__proto__:null,BAI:Ma,BamFile:x5,BamRecord:Pa,CSI:Cd,HtsgetFile:UQ},Symbol.toStringTag,{value:"Module"}));function E5(e){if(e.greaterThan(Number.MAX_SAFE_INTEGER)||e.lessThan(Number.MIN_SAFE_INTEGER))throw new Error("integer overflow");return e.toNumber()}class GQ extends Error{}function hu(e){if(e&&e.aborted){if(typeof DOMException<"u")throw new DOMException("aborted","AbortError");{const t=new GQ("aborted");throw t.code="ERR_ABORTED",t}}}function jQ(e,t){return t.minv.blockPosition-e.maxv.blockPosition<65e3&&t.maxv.blockPosition-e.minv.blockPosition<5e6}function S5(e,t){const n=[];let r=null;return e.length===0?e:(e.sort(function(i,o){const s=i.minv.blockPosition-o.minv.blockPosition;return s!==0?s:i.minv.dataPosition-o.minv.dataPosition}),e.forEach(i=>{(!t||i.maxv.compareTo(t)>0)&&(r===null?(n.push(i),r=i):jQ(r,i)?i.maxv.compareTo(r.maxv)>0&&(r.maxv=i.maxv):(n.push(i),r=i))}),n)}class gb{constructor(t,n){this.blockPosition=t,this.dataPosition=n}toString(){return`${this.blockPosition}:${this.dataPosition}`}compareTo(t){return this.blockPosition-t.blockPosition||this.dataPosition-t.dataPosition}}function Oa(e,t=0,n=!1){if(n)throw new Error("big-endian virtual file offsets not implemented");return new gb(e[t+7]*1099511627776+e[t+6]*4294967296+e[t+5]*16777216+e[t+4]*65536+e[t+3]*256+e[t+2],e[t+1]<<8|e[t])}class Td{constructor(t,n,r,i=void 0){this.minv=t,this.maxv=n,this.bin=r,this._fetchedSize=i}toUniqueString(){return`${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`}toString(){return this.toUniqueString()}compareTo(t){return this.minv.compareTo(t.minv)||this.maxv.compareTo(t.maxv)||this.bin-t.bin}fetchedSize(){return this._fetchedSize!==void 0?this._fetchedSize:this.maxv.blockPosition+65536-this.minv.blockPosition}}class C5{constructor({filehandle:t,renameRefSeqs:n=r=>r}){this.filehandle=t,this.renameRefSeq=n}async getMetadata(t={}){const{indices:n,...r}=await this.parse(t);return r}_findFirstData(t,n){return t?t.compareTo(n)>0?n:t:n}async parse(t={}){return this.parseP||(this.parseP=this._parse(t).catch(n=>{throw this.parseP=void 0,n})),this.parseP}async hasRefSeq(t,n={}){var r;return!!(!((r=(await this.parse(n)).indices[t])===null||r===void 0)&&r.binIndex)}}const VQ=21578324,k5=14;function qQ(e,t){return e+=1,t-=1,[[0,0],[1+(e>>26),1+(t>>26)],[9+(e>>23),9+(t>>23)],[73+(e>>20),73+(t>>20)],[585+(e>>17),585+(t>>17)],[4681+(e>>14),4681+(t>>14)]]}class La extends C5{async lineCount(t,n={}){const r=await this.parse(n),i=r.refNameToId[t];if(i===void 0||!r.indices[i])return-1;const{stats:s}=r.indices[i];return s?s.lineCount:-1}async _parse(t={}){const n=await this.filehandle.readFile(t),r=await io(n);if(hu(t.signal),r.readUInt32LE(0)!==VQ)throw new Error("Not a TBI file");const i=r.readInt32LE(4),o=r.readInt32LE(8),s=o&65536?"zero-based-half-open":"1-based-closed",l={0:"generic",1:"SAM",2:"VCF"}[o&15];if(!l)throw new Error(`invalid Tabix preset format flags ${o}`);const c={ref:r.readInt32LE(12),start:r.readInt32LE(16),end:r.readInt32LE(20)},u=r.readInt32LE(24),f=5,h=((1<<(f+1)*3)-1)/7,d=2**(14+f*3),p=u?String.fromCharCode(u):null,m=r.readInt32LE(28),b=r.readInt32LE(32),{refNameToId:g,refIdToName:y}=this._parseNameBytes(r.slice(36,36+b));let v=36+b,w;return{indices:new Array(i).fill(0).map(()=>{const E=r.readInt32LE(v);v+=4;const k={};let M;for(let I=0;I<E;I+=1){const q=r.readUInt32LE(v);if(v+=4,q>h+1)throw new Error("tabix index contains too many bins, please use a CSI index");if(q===h+1){const Z=r.readInt32LE(v);v+=4,Z===2&&(M=this.parsePseudoBin(r,v)),v+=16*Z}else{const Z=r.readInt32LE(v);v+=4;const ne=new Array(Z);for(let J=0;J<Z;J+=1){const ce=Oa(r,v),ae=Oa(r,v+8);v+=16,w=this._findFirstData(w,ce),ne[J]=new Td(ce,ae,q)}k[q]=ne}}const D=r.readInt32LE(v);v+=4;const B=new Array(D);for(let I=0;I<D;I+=1)B[I]=Oa(r,v),v+=8,w=this._findFirstData(w,B[I]);return{binIndex:k,linearIndex:B,stats:M}}),metaChar:p,maxBinNumber:h,maxRefLength:d,skipLines:m,firstDataLine:w,columnNumbers:c,coordinateType:s,format:l,refIdToName:y,refNameToId:g,maxBlockSize:65536}}parsePseudoBin(t,n){return{lineCount:E5(fd.fromBytesLE(t.slice(n+16,n+24),!0))}}_parseNameBytes(t){let n=0,r=0;const i=[],o={};for(let s=0;s<t.length;s+=1)if(!t[s]){if(r<s){let a=t.toString("utf8",r,s);a=this.renameRefSeq(a),i[n]=a,o[a]=n}r=s+1,n+=1}return{refNameToId:o,refIdToName:i}}async blocksForRange(t,n,r,i={}){n<0&&(n=0);const o=await this.parse(i),s=o.refNameToId[t];if(s===void 0)return[];const a=o.indices[s];if(!a)return[];(a.linearIndex.length?a.linearIndex[n>>k5>=a.linearIndex.length?a.linearIndex.length-1:n>>k5]:new gb(0,0))||console.warn("querying outside of possible tabix range");const c=qQ(n,r),u=[];for(const[m,b]of c)for(let g=m;g<=b;g++)if(a.binIndex[g])for(const y of a.binIndex[g])u.push(new Td(y.minv,y.maxv,g));const f=a.linearIndex.length;let h=null;const d=Math.min(n>>14,f-1),p=Math.min(r>>14,f-1);for(let m=d;m<=p;++m){const b=a.linearIndex[m];b&&(!h||b.compareTo(h)<0)&&(h=b)}return S5(u,h)}}const $Q=21582659,WQ=38359875;function YQ(e,t){return e*2**t}function T5(e,t){return Math.floor(e/2**t)}class Id extends C5{constructor(t){super(t),this.maxBinNumber=0,this.depth=0,this.minShift=0}async lineCount(t,n={}){const r=await this.parse(n),i=r.refNameToId[t];if(i===void 0||!r.indices[i])return-1;const{stats:s}=r.indices[i];return s?s.lineCount:-1}indexCov(){throw new Error("CSI indexes do not support indexcov")}parseAuxData(t,n){const r=t.readInt32LE(n),i=r&65536?"zero-based-half-open":"1-based-closed",o={0:"generic",1:"SAM",2:"VCF"}[r&15];if(!o)throw new Error(`invalid Tabix preset format flags ${r}`);const s={ref:t.readInt32LE(n+4),start:t.readInt32LE(n+8),end:t.readInt32LE(n+12)},a=t.readInt32LE(n+16),l=a?String.fromCharCode(a):null,c=t.readInt32LE(n+20),u=t.readInt32LE(n+24),{refIdToName:f,refNameToId:h}=this._parseNameBytes(t.slice(n+28,n+28+u));return{refIdToName:f,refNameToId:h,skipLines:c,metaChar:l,columnNumbers:s,format:o,coordinateType:i}}_parseNameBytes(t){let n=0,r=0;const i=[],o={};for(let s=0;s<t.length;s+=1)if(!t[s]){if(r<s){let a=t.toString("utf8",r,s);a=this.renameRefSeq(a),i[n]=a,o[a]=n}r=s+1,n+=1}return{refNameToId:o,refIdToName:i}}async _parse(t={}){const n=await io(await this.filehandle.readFile(t));let r;if(n.readUInt32LE(0)===$Q)r=1;else if(n.readUInt32LE(0)===WQ)r=2;else throw new Error("Not a CSI file");this.minShift=n.readInt32LE(4),this.depth=n.readInt32LE(8),this.maxBinNumber=((1<<(this.depth+1)*3)-1)/7;const i=2**(this.minShift+this.depth*3),o=n.readInt32LE(12),s=o&&o>=30?this.parseAuxData(n,16):{refIdToName:[],refNameToId:{},metaChar:null,columnNumbers:{ref:0,start:1,end:2},coordinateType:"zero-based-half-open",format:"generic"},a=n.readInt32LE(16+o);let l,c=16+o+4;const u=new Array(a).fill(0).map(()=>{const f=n.readInt32LE(c);c+=4;const h={};let d;for(let p=0;p<f;p+=1){const m=n.readUInt32LE(c);if(m>this.maxBinNumber)d=this.parsePseudoBin(n,c+4),c+=48;else{const b=Oa(n,c+4);l=this._findFirstData(l,b);const g=n.readInt32LE(c+12);c+=16;const y=new Array(g);for(let v=0;v<g;v+=1){const w=Oa(n,c),S=Oa(n,c+8);c+=16,y[v]=new Td(w,S,m)}h[m]=y}}return{binIndex:h,stats:d}});return{...s,csi:!0,refCount:a,maxBlockSize:65536,firstDataLine:l,csiVersion:r,indices:u,depth:this.depth,maxBinNumber:this.maxBinNumber,maxRefLength:i}}parsePseudoBin(t,n){return{lineCount:E5(fd.fromBytesLE(t.slice(n+28,n+36),!0))}}async blocksForRange(t,n,r,i={}){n<0&&(n=0);const o=await this.parse(i),s=o.refNameToId[t];if(s===void 0)return[];const a=o.indices[s];if(!a)return[];const l=this.reg2bins(n,r),c=[];for(const[u,f]of l)for(let h=u;h<=f;h++)if(a.binIndex[h])for(const d of a.binIndex[h])c.push(new Td(d.minv,d.maxv,h));return S5(c,new gb(0,0))}reg2bins(t,n){t-=1,t<1&&(t=1),n>2**50&&(n=2**34),n-=1;let r=0,i=0,o=this.minShift+this.depth*3;const s=[];for(;r<=this.depth;o-=3,i+=YQ(1,r*3),r+=1){const a=i+T5(t,o),l=i+T5(n,o);if(l-a+s.length>this.maxBinNumber)throw new Error(`query ${t}-${n} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);s.push([a,l])}return s}}function QQ(e){return/^[\u0000-\u007F]*$/.test(e)}const Na=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;class ZQ{constructor({path:t,filehandle:n,url:r,tbiPath:i,tbiUrl:o,tbiFilehandle:s,csiPath:a,csiUrl:l,csiFilehandle:c,renameRefSeqs:u=h=>h,chunkCacheSize:f=5*2**20}){if(n)this.filehandle=n;else if(t)this.filehandle=new qt(t);else if(r)this.filehandle=new ur(r);else throw new TypeError("must provide either filehandle or path");if(s)this.index=new La({filehandle:s,renameRefSeqs:u});else if(c)this.index=new Id({filehandle:c,renameRefSeqs:u});else if(i)this.index=new La({filehandle:new qt(i),renameRefSeqs:u});else if(a)this.index=new Id({filehandle:new qt(a),renameRefSeqs:u});else if(t)this.index=new La({filehandle:new qt(`${t}.tbi`),renameRefSeqs:u});else if(l)this.index=new Id({filehandle:new ur(l)});else if(o)this.index=new La({filehandle:new ur(o)});else if(r)this.index=new La({filehandle:new ur(`${r}.tbi`)});else throw new TypeError("must provide one of tbiFilehandle, tbiPath, csiFilehandle, csiPath, tbiUrl, csiUrl");this.renameRefSeq=u,this.chunkCache=new hs({cache:new dd({maxSize:Math.floor(f/65536)}),fill:(h,d)=>this.readChunk(h,{signal:d})})}async getLines(t,n,r,i){var o,s;let a,l={},c;typeof i=="function"?c=i:(l=i,c=i.lineCallback,a=i.signal);const u=await this.index.getMetadata(l);hu(a);const f=n??0,h=r??u.maxRefLength;if(!(f<=h))throw new TypeError("invalid start and end coordinates. start must be less than or equal to end");if(f===h)return;const d=await this.index.blocksForRange(t,f,h,l);hu(a);for(const p of d){const{buffer:m,cpositions:b,dpositions:g}=await this.chunkCache.get(p.toString(),p,a);hu(a);let y=0,v=0;const w=(o=Na==null?void 0:Na.decode(m))!==null&&o!==void 0?o:m.toString(),S=m.length<5e8&&QQ(w);for(;y<w.length;){let E,k;if(S){if(k=w.indexOf(`
3925
+ )`},Symbol.toStringTag,{value:"Module"}))).map(([e,t])=>[e,u5.parse(t.trim())]));function hb(e){const t=new Set(["uint","int","float","long"]);return{...e,fields:e.fields.map(n=>({...n,isArray:n.size&&n.type!=="char",arrayIsNumeric:n.size&&t.has(n.type),isNumeric:!n.size&&t.has(n.type)})).filter(n=>!!n.name)}}const wQ={".":0,"-":-1,"+":1};function vQ(e){var t;return e.length>=12&&!Number.isNaN(parseInt(e[9],10))&&((t=e[10])===null||t===void 0?void 0:t.split(",").filter(n=>!!n).length)===parseInt(e[9],10)}class xQ{constructor(t={}){if(t.autoSql)this.autoSql=hb(yQ.parse(t.autoSql));else if(t.type){if(!fb[t.type])throw new Error("Type not found");this.autoSql=hb(fb[t.type])}else this.autoSql=hb(fb.defaultBedSchema),this.attemptDefaultBed=!0}parseLine(t,n={}){const{autoSql:r}=this,{uniqueId:i}=n,o=Array.isArray(t)?t:t.split(" ");let s={};if(!this.attemptDefaultBed||this.attemptDefaultBed&&vQ(o))for(let a=0;a<r.fields.length;a++){const l=r.fields[a];let c=o[a];const{isNumeric:u,isArray:f,arrayIsNumeric:h,name:d}=l;if(c==null)break;if(c!=="."){if(u){const p=Number(c);c=Number.isNaN(p)?c:p}else f&&(c=c.split(","),c[c.length-1]===""&&c.pop(),h&&(c=c.map(Number)));s[d]=c}}else{const a=["chrom","chromStart","chromEnd","name"];s=Object.fromEntries(o.map((l,c)=>[a[c]||"field"+c,l])),s.chromStart=+s.chromStart,s.chromEnd=+s.chromEnd,Number.isNaN(Number.parseFloat(s.field4))||(s.score=+s.field4,delete s.field4),(s.field5==="+"||s.field5==="-")&&(s.strand=s.field5,delete s.field5)}return i&&(s.uniqueId=i),s.strand=wQ[s.strand]||0,s.chrom=decodeURIComponent(s.chrom),s}}const AQ=Object.freeze(Object.defineProperty({__proto__:null,default:xQ},Symbol.toStringTag,{value:"Module"}));let f5=class{constructor(t,n){this.blockPosition=t,this.dataPosition=n}toString(){return`${this.blockPosition}:${this.dataPosition}`}compareTo(t){return this.blockPosition-t.blockPosition||this.dataPosition-t.dataPosition}static min(...t){let n,r=0;for(;!n;r+=1)n=t[r];for(;r<t.length;r+=1)n.compareTo(t[r])>0&&(n=t[r]);return n}};function Fa(e,t=0,n=!1){if(n)throw new Error("big-endian virtual file offsets not implemented");return new f5(e[t+7]*1099511627776+e[t+6]*4294967296+e[t+5]*16777216+e[t+4]*65536+e[t+3]*256+e[t+2],e[t+1]<<8|e[t])}let db=class{constructor(t,n,r,i){this.minv=t,this.maxv=n,this.bin=r,this._fetchedSize=i}toUniqueString(){return`${this.minv.toString()}..${this.maxv.toString()} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`}toString(){return this.toUniqueString()}compareTo(t){return this.minv.compareTo(t.minv)||this.maxv.compareTo(t.maxv)||this.bin-t.bin}fetchedSize(){return this._fetchedSize!==void 0?this._fetchedSize:this.maxv.blockPosition+65536-this.minv.blockPosition}};function EQ(e){return new Promise(t=>setTimeout(t,e))}function SQ(e){if(e&&e.aborted)if(typeof DOMException>"u"){const t=new Error("aborted");throw t.code="ERR_ABORTED",t}else throw new DOMException("aborted","AbortError")}function CQ(e,t){return t.minv.blockPosition-e.maxv.blockPosition<65e3&&t.maxv.blockPosition-e.minv.blockPosition<5e6}function kQ(e={}){return"aborted"in e?{signal:e}:e}function h5(e,t){const n=[];let r;if(e.length===0)return e;e.sort((i,o)=>{const s=i.minv.blockPosition-o.minv.blockPosition;return s===0?i.minv.dataPosition-o.minv.dataPosition:s});for(const i of e)(!t||i.maxv.compareTo(t)>0)&&(r===void 0?(n.push(i),r=i):CQ(r,i)?i.maxv.compareTo(r.maxv)>0&&(r.maxv=i.maxv):(n.push(i),r=i));return n}function d5(e,t){return{lineCount:fd.fromBytesLE(Array.prototype.slice.call(e,t,t+8),!0).toNumber()}}function Sd(e,t){return e?e.compareTo(t)>0?t:e:t}function TQ(e,t=n=>n){let n=0,r=0;const i=[],o={};for(let s=0;s<e.length;s+=1)if(!e[s]){if(r<s){let a=e.toString("utf8",r,s);a=t(a),i[n]=a,o[a]=n}r=s+1,n+=1}return{refNameToId:o,refIdToName:i}}let p5=class{constructor({filehandle:t,renameRefSeq:n=r=>r}){this.filehandle=t,this.renameRefSeq=n}};const IQ=21578050;function _Q(e,t){return e-e%t}function DQ(e,t){return e-e%t+t}function RQ(e,t){return t-=1,[[0,0],[1+(e>>26),1+(t>>26)],[9+(e>>23),9+(t>>23)],[73+(e>>20),73+(t>>20)],[585+(e>>17),585+(t>>17)],[4681+(e>>14),4681+(t>>14)]]}class Ma extends p5{async lineCount(t,n){var r,i;return((i=(r=(await this.parse(n)).indices[t])===null||r===void 0?void 0:r.stats)===null||i===void 0?void 0:i.lineCount)||0}async _parse(t){const n=await this.filehandle.readFile(t);if(n.readUInt32LE(0)!==IQ)throw new Error("Not a BAI file");const r=n.readInt32LE(4),o=((1<<(5+1)*3)-1)/7;let s=8,a;const l=new Array(r);for(let c=0;c<r;c++){const u=n.readInt32LE(s);let f;s+=4;const h={};for(let m=0;m<u;m+=1){const b=n.readUInt32LE(s);if(s+=4,b===o+1)s+=4,f=d5(n,s+16),s+=32;else{if(b>o+1)throw new Error("bai index contains too many bins, please use CSI");{const g=n.readInt32LE(s);s+=4;const y=new Array(g);for(let v=0;v<g;v++){const w=Fa(n,s);s+=8;const S=Fa(n,s);s+=8,a=Sd(a,w),y[v]=new db(w,S,b)}h[b]=y}}}const d=n.readInt32LE(s);s+=4;const p=new Array(d);for(let m=0;m<d;m++){const b=Fa(n,s);s+=8,a=Sd(a,b),p[m]=b}l[c]={binIndex:h,linearIndex:p,stats:f}}return{bai:!0,firstDataLine:a,maxBlockSize:65536,indices:l,refCount:r}}async indexCov(t,n,r,i={}){const s=n!==void 0,l=(await this.parse(i)).indices[t];if(!l)return[];const{linearIndex:c=[],stats:u}=l;if(c.length===0)return[];const f=r===void 0?(c.length-1)*16384:DQ(r,16384),h=n===void 0?0:_Q(n,16384),d=s?new Array((f-h)/16384):new Array(c.length-1),p=c[c.length-1].blockPosition;if(f>(c.length-1)*16384)throw new Error("query outside of range of linear index");let m=c[h/16384].blockPosition;for(let b=h/16384,g=0;b<f/16384;b++,g++)d[g]={score:c[b+1].blockPosition-m,start:b*16384,end:b*16384+16384},m=c[b+1].blockPosition;return d.map(b=>({...b,score:b.score*((u==null?void 0:u.lineCount)||0)/p}))}async blocksForRange(t,n,r,i={}){n<0&&(n=0);const o=await this.parse(i);if(!o)return[];const s=o.indices[t];if(!s)return[];const a=RQ(n,r),l=[];for(const[d,p]of a)for(let m=d;m<=p;m++)if(s.binIndex[m]){const b=s.binIndex[m];for(const g of b)l.push(new db(g.minv,g.maxv,m))}const c=s.linearIndex.length;let u;const f=Math.min(n>>14,c-1),h=Math.min(r>>14,c-1);for(let d=f;d<=h;++d){const p=s.linearIndex[d];p&&(!u||p.compareTo(u)<0)&&(u=p)}return h5(l,u)}async parse(t={}){return this.setupP||(this.setupP=this._parse(t).catch(n=>{throw this.setupP=void 0,n})),this.setupP}async hasRefSeq(t,n={}){var r;return!!(!((r=(await this.parse(n)).indices[t])===null||r===void 0)&&r.binIndex)}}let pb=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];typeof Int32Array<"u"&&(pb=new Int32Array(pb));const BQ=(e,t)=>{let n=t===0?0:~~t^-1;for(let r=0;r<e.length;r++)n=pb[(n^e[r])&255]^n>>>8;return n^-1},g5=(e,t)=>ot.Buffer.from(e,t);function FQ(e,t){const n=(r,i)=>t(g5(r),i)>>>0;return n.signed=(r,i)=>t(g5(r),i),n.unsigned=n,n.model=e,n}const MQ=FQ("crc-32",BQ),PQ=21582659,OQ=38359875;function LQ(e,t){return e*2**t}function m5(e,t){return Math.floor(e/2**t)}let Cd=class extends p5{constructor(){super(...arguments),this.maxBinNumber=0,this.depth=0,this.minShift=0}async lineCount(t,n){var r,i;return((i=(r=(await this.parse(n)).indices[t])===null||r===void 0?void 0:r.stats)===null||i===void 0?void 0:i.lineCount)||0}async indexCov(){return[]}parseAuxData(t,n){const r=t.readInt32LE(n),i=r&65536?"zero-based-half-open":"1-based-closed",o={0:"generic",1:"SAM",2:"VCF"}[r&15];if(!o)throw new Error(`invalid Tabix preset format flags ${r}`);const s={ref:t.readInt32LE(n+4),start:t.readInt32LE(n+8),end:t.readInt32LE(n+12)},a=t.readInt32LE(n+16),l=a?String.fromCharCode(a):"",c=t.readInt32LE(n+20),u=t.readInt32LE(n+24);return{columnNumbers:s,coordinateType:i,metaValue:a,metaChar:l,skipLines:c,format:o,formatFlags:r,...TQ(t.subarray(n+28,n+28+u),this.renameRefSeq)}}async _parse(t){const n=await this.filehandle.readFile(t),r=await io(n);let i;if(r.readUInt32LE(0)===PQ)i=1;else if(r.readUInt32LE(0)===OQ)i=2;else throw new Error("Not a CSI file");this.minShift=r.readInt32LE(4),this.depth=r.readInt32LE(8),this.maxBinNumber=((1<<(this.depth+1)*3)-1)/7;const o=r.readInt32LE(12),s=o>=30?this.parseAuxData(r,16):void 0,a=r.readInt32LE(16+o);let l=16+o+4,c;const u=new Array(a);for(let f=0;f<a;f++){const h=r.readInt32LE(l);l+=4;const d={};let p;for(let m=0;m<h;m++){const b=r.readUInt32LE(l);if(l+=4,b>this.maxBinNumber)p=d5(r,l+28),l+=44;else{c=Sd(c,Fa(r,l)),l+=8;const g=r.readInt32LE(l);l+=4;const y=new Array(g);for(let v=0;v<g;v+=1){const w=Fa(r,l);l+=8;const S=Fa(r,l);l+=8,c=Sd(c,w),y[v]=new db(w,S,b)}d[b]=y}}u[f]={binIndex:d,stats:p}}return{csiVersion:i,firstDataLine:c,indices:u,refCount:a,csi:!0,maxBlockSize:65536,...s}}async blocksForRange(t,n,r,i={}){n<0&&(n=0);const s=(await this.parse(i)).indices[t];if(!s)return[];const a=this.reg2bins(n,r);if(a.length===0)return[];const l=[];for(const[c,u]of a)for(let f=c;f<=u;f++)if(s.binIndex[f]){const h=s.binIndex[f];for(const d of h)l.push(d)}return h5(l,new f5(0,0))}reg2bins(t,n){t-=1,t<1&&(t=1),n>2**50&&(n=2**34),n-=1;let r=0,i=0,o=this.minShift+this.depth*3;const s=[];for(;r<=this.depth;o-=3,i+=LQ(1,r*3),r+=1){const a=i+m5(t,o),l=i+m5(n,o);if(l-a+s.length>this.maxBinNumber)throw new Error(`query ${t}-${n} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);s.push([a,l])}return s}async parse(t={}){return this.setupP||(this.setupP=this._parse(t).catch(n=>{throw this.setupP=void 0,n})),this.setupP}async hasRefSeq(t,n={}){var r;return!!(!((r=(await this.parse(n)).indices[t])===null||r===void 0)&&r.binIndex)}};const Zn={BAM_FPAIRED:1,BAM_FPROPER_PAIR:2,BAM_FUNMAP:4,BAM_FMUNMAP:8,BAM_FREVERSE:16,BAM_FMREVERSE:32,BAM_FREAD1:64,BAM_FREAD2:128,BAM_FSECONDARY:256,BAM_FQCFAIL:512,BAM_FDUP:1024,BAM_FSUPPLEMENTARY:2048},b5="=ACMGRSVTWYHKDBN".split(""),fu="MIDNSHP=X???????".split("");class Pa{constructor(t){this.bytes=t.bytes,this.fileOffset=t.fileOffset}get byteArray(){return this.bytes.byteArray}get flags(){return(this.byteArray.readInt32LE(this.bytes.start+16)&4294901760)>>16}get ref_id(){return this.byteArray.readInt32LE(this.bytes.start+4)}get start(){return this.byteArray.readInt32LE(this.bytes.start+8)}get end(){return this.start+this.length_on_ref}get id(){return this.fileOffset}get mq(){const t=(this.bin_mq_nl&65280)>>8;return t===255?void 0:t}get score(){return this.mq}get qual(){if(this.isSegmentUnmapped())return;const t=this.b0+this.read_name_length+this.num_cigar_ops*4+this.num_seq_bytes;return this.byteArray.subarray(t,t+this.seq_length)}get strand(){return this.isReverseComplemented()?-1:1}get b0(){return this.bytes.start+36}get name(){return this.byteArray.toString("ascii",this.b0,this.b0+this.read_name_length-1)}get tags(){const{byteArray:t}=this.bytes;let n=this.b0+this.read_name_length+this.num_cigar_ops*4+this.num_seq_bytes+this.seq_length;const r=this.bytes.end,i={};for(;n<r;){const o=String.fromCharCode(t[n],t[n+1]),s=String.fromCharCode(t[n+2]);if(n+=3,s==="A")i[o]=String.fromCharCode(t[n]),n+=1;else if(s==="i")i[o]=t.readInt32LE(n),n+=4;else if(s==="I")i[o]=t.readUInt32LE(n),n+=4;else if(s==="c")i[o]=t.readInt8(n),n+=1;else if(s==="C")i[o]=t.readUInt8(n),n+=1;else if(s==="s")i[o]=t.readInt16LE(n),n+=2;else if(s==="S")i[o]=t.readUInt16LE(n),n+=2;else if(s==="f")i[o]=t.readFloatLE(n),n+=4;else if(s==="Z"||s==="H"){const a=[];for(;n<=r;){const l=t[n++];if(l!==0)a.push(String.fromCharCode(l));else break}i[o]=a.join("")}else if(s==="B"){const a=t[n++],l=String.fromCharCode(a),c=t.readInt32LE(n);if(n+=4,l==="i")if(o==="CG"){const u=[];for(let f=0;f<c;f++){const h=t.readInt32LE(n),d=h>>4,p=fu[h&15];u.push(d+p),n+=4}i[o]=u.join("")}else{const u=[];for(let f=0;f<c;f++)u.push(t.readInt32LE(n)),n+=4;i[o]=u}else if(l==="I")if(o==="CG"){const u=[];for(let f=0;f<c;f++){const h=t.readUInt32LE(n),d=h>>4,p=fu[h&15];u.push(d+p),n+=4}i[o]=u.join("")}else{const u=[];for(let f=0;f<c;f++)u.push(t.readUInt32LE(n)),n+=4;i[o]=u}else if(l==="s"){const u=[];for(let f=0;f<c;f++)u.push(t.readInt16LE(n)),n+=2;i[o]=u}else if(l==="S"){const u=[];for(let f=0;f<c;f++)u.push(t.readUInt16LE(n)),n+=2;i[o]=u}else if(l==="c"){const u=[];for(let f=0;f<c;f++)u.push(t.readInt8(n)),n+=1;i[o]=u}else if(l==="C"){const u=[];for(let f=0;f<c;f++)u.push(t.readUInt8(n)),n+=1;i[o]=u}else if(l==="f"){const u=[];for(let f=0;f<c;f++)u.push(t.readFloatLE(n)),n+=4;i[o]=u}}else{console.error("Unknown BAM tag type",s);break}}return i}isPaired(){return!!(this.flags&Zn.BAM_FPAIRED)}isProperlyPaired(){return!!(this.flags&Zn.BAM_FPROPER_PAIR)}isSegmentUnmapped(){return!!(this.flags&Zn.BAM_FUNMAP)}isMateUnmapped(){return!!(this.flags&Zn.BAM_FMUNMAP)}isReverseComplemented(){return!!(this.flags&Zn.BAM_FREVERSE)}isMateReverseComplemented(){return!!(this.flags&Zn.BAM_FMREVERSE)}isRead1(){return!!(this.flags&Zn.BAM_FREAD1)}isRead2(){return!!(this.flags&Zn.BAM_FREAD2)}isSecondary(){return!!(this.flags&Zn.BAM_FSECONDARY)}isFailedQc(){return!!(this.flags&Zn.BAM_FQCFAIL)}isDuplicate(){return!!(this.flags&Zn.BAM_FDUP)}isSupplementary(){return!!(this.flags&Zn.BAM_FSUPPLEMENTARY)}get cigarAndLength(){if(this.isSegmentUnmapped())return{length_on_ref:0,CIGAR:""};const t=this.num_cigar_ops;let n=this.b0+this.read_name_length;const r=[];let i=this.byteArray.readInt32LE(n),o=i>>4,s=fu[i&15];if(s==="S"&&o===this.seq_length)return n+=4,i=this.byteArray.readInt32LE(n),o=i>>4,s=fu[i&15],s!=="N"&&console.warn("CG tag with no N tag"),{CIGAR:this.tags.CG,length_on_ref:o};{let a=0;for(let l=0;l<t;++l)i=this.byteArray.readInt32LE(n),o=i>>4,s=fu[i&15],r.push(o+s),s!=="H"&&s!=="S"&&s!=="I"&&(a+=o),n+=4;return{CIGAR:r.join(""),length_on_ref:a}}}get length_on_ref(){return this.cigarAndLength.length_on_ref}get CIGAR(){return this.cigarAndLength.CIGAR}get num_cigar_ops(){return this.flag_nc&65535}get read_name_length(){return this.bin_mq_nl&255}get num_seq_bytes(){return this.seq_length+1>>1}get seq(){const{byteArray:t}=this.bytes,n=this.b0+this.read_name_length+this.num_cigar_ops*4,r=this.num_seq_bytes,i=this.seq_length,o=[];let s=0;for(let a=0;a<r;++a){const l=t[n+a];o.push(b5[(l&240)>>4]),s++,s<i&&(o.push(b5[l&15]),s++)}return o.join("")}get pair_orientation(){if(!this.isSegmentUnmapped()&&!this.isMateUnmapped()&&this.ref_id===this.next_refid){const t=this.isReverseComplemented()?"R":"F",n=this.isMateReverseComplemented()?"R":"F";let r=" ",i=" ";this.isRead1()?(r="1",i="2"):this.isRead2()&&(r="2",i="1");const o=[];return this.template_length>0?(o[0]=t,o[1]=r,o[2]=n,o[3]=i):(o[2]=t,o[3]=r,o[0]=n,o[1]=i),o.join("")}}get bin_mq_nl(){return this.byteArray.readInt32LE(this.bytes.start+12)}get flag_nc(){return this.byteArray.readInt32LE(this.bytes.start+16)}get seq_length(){return this.byteArray.readInt32LE(this.bytes.start+20)}get next_refid(){return this.byteArray.readInt32LE(this.bytes.start+24)}get next_pos(){return this.byteArray.readInt32LE(this.bytes.start+28)}get template_length(){return this.byteArray.readInt32LE(this.bytes.start+32)}toJSON(){const t={};for(const n of Object.keys(this))n.startsWith("_")||n==="bytes"||(t[n]=this[n]);return t}}function kd(e,t){const n=Object.getOwnPropertyDescriptor(e.prototype,t);if(!n)throw new Error("OH NO, NO PROPERTY DESCRIPTOR");const r=n.get;if(!r)throw new Error("OH NO, NOT A GETTER");Object.defineProperty(e.prototype,t,{get(){const i=r.call(this);return Object.defineProperty(this,t,{value:i}),i}})}kd(Pa,"tags"),kd(Pa,"cigarAndLength"),kd(Pa,"seq"),kd(Pa,"qual");function y5(e){const t=e.split(/\r?\n/),n=[];for(const r of t){const[i,...o]=r.split(/\t/);i&&n.push({tag:i.slice(1),data:o.map(s=>{const a=s.indexOf(":"),l=s.slice(0,a),c=s.slice(a+1);return{tag:l,value:c}})})}return n}const w5=21840194,v5=65536;async function NQ(e){let t=[];for await(const n of e)t=t.concat(n);return t}class zQ{read(){throw new Error("never called")}stat(){throw new Error("never called")}readFile(){throw new Error("never called")}close(){throw new Error("never called")}}class x5{constructor({bamFilehandle:t,bamPath:n,bamUrl:r,baiPath:i,baiFilehandle:o,baiUrl:s,csiPath:a,csiFilehandle:l,csiUrl:c,htsget:u,yieldThreadTime:f=100,renameRefSeqs:h=d=>d}){if(this.htsget=!1,this.featureCache=new hs({cache:new dd({maxSize:50}),fill:async(d,p)=>{const{chunk:m,opts:b}=d,{data:g,cpositions:y,dpositions:v}=await this._readChunk({chunk:m,opts:{...b,signal:p}});return this.readBamFeatures(g,y,v,m)}}),this.renameRefSeq=h,t)this.bam=t;else if(n)this.bam=new qt(n);else if(r)this.bam=new ur(r);else if(u)this.htsget=!0,this.bam=new zQ;else throw new Error("unable to initialize bam");if(l)this.index=new Cd({filehandle:l});else if(a)this.index=new Cd({filehandle:new qt(a)});else if(c)this.index=new Cd({filehandle:new ur(c)});else if(o)this.index=new Ma({filehandle:o});else if(i)this.index=new Ma({filehandle:new qt(i)});else if(s)this.index=new Ma({filehandle:new ur(s)});else if(n)this.index=new Ma({filehandle:new qt(`${n}.bai`)});else if(r)this.index=new Ma({filehandle:new ur(`${r}.bai`)});else if(u)this.htsget=!0;else throw new Error("unable to infer index format");this.yieldThreadTime=f}async getHeaderPre(t){const n=kQ(t);if(!this.index)return;const r=await this.index.parse(n),i=r.firstDataLine?r.firstDataLine.blockPosition+65535:void 0;let o;if(i){const u=i+v5,f=await this.bam.read(ot.Buffer.alloc(u),0,u,0,n);if(!f.bytesRead)throw new Error("Error reading header");o=f.buffer.subarray(0,Math.min(f.bytesRead,i))}else o=await this.bam.readFile(n);const s=await io(o);if(s.readInt32LE(0)!==w5)throw new Error("Not a BAM file");const a=s.readInt32LE(4);this.header=s.toString("utf8",8,8+a);const{chrToIndex:l,indexToChr:c}=await this._readRefSeqs(a+8,65535,n);return this.chrToIndex=l,this.indexToChr=c,y5(this.header)}getHeader(t){return this.headerP||(this.headerP=this.getHeaderPre(t).catch(n=>{throw this.headerP=void 0,n})),this.headerP}async getHeaderText(t={}){return await this.getHeader(t),this.header}async _readRefSeqs(t,n,r){if(t>n)return this._readRefSeqs(t,n*2,r);const i=n+v5,{bytesRead:o,buffer:s}=await this.bam.read(ot.Buffer.alloc(i),0,n,0,r);if(!o)throw new Error("Error reading refseqs from header");const a=await io(s.subarray(0,Math.min(o,n))),l=a.readInt32LE(t);let c=t+4;const u={},f=[];for(let h=0;h<l;h+=1){const d=a.readInt32LE(c),p=this.renameRefSeq(a.toString("utf8",c+4,c+4+d-1)),m=a.readInt32LE(c+d+4);if(u[p]=h,f.push({refName:p,length:m}),c=c+8+d,c>a.length)return console.warn(`BAM header is very big. Re-fetching ${n} bytes.`),this._readRefSeqs(t,n*2,r)}return{chrToIndex:u,indexToChr:f}}async getRecordsForRange(t,n,r,i){return NQ(this.streamRecordsForRange(t,n,r,i))}async*streamRecordsForRange(t,n,r,i){var o;await this.getHeader(i);const s=(o=this.chrToIndex)===null||o===void 0?void 0:o[t];if(s===void 0||!this.index)yield[];else{const a=await this.index.blocksForRange(s,n-1,r,i);yield*this._fetchChunkFeatures(a,s,n,r,i)}}async*_fetchChunkFeatures(t,n,r,i,o={}){const{viewAsPairs:s}=o,a=[];let l=!1;for(const c of t){const u=await this.featureCache.get(c.toString(),{chunk:c,opts:o},o.signal),f=[];for(const h of u)if(h.ref_id===n)if(h.start>=i){l=!0;break}else h.end>=r&&f.push(h);if(a.push(f),yield f,l)break}SQ(o.signal),s&&(yield this.fetchPairs(n,a,o))}async fetchPairs(t,n,r){const{pairAcrossChr:i,maxInsertSize:o=2e5}=r,s={},a={};n.map(h=>{const d={};for(const p of h){const m=p.name,b=p.id;d[m]||(d[m]=0),d[m]++,a[b]=1}for(const[p,m]of Object.entries(d))m===1&&(s[p]=!0)});const l=[];n.map(h=>{for(const d of h){const p=d.name,m=d.start,b=d.next_pos,g=d.next_refid;this.index&&s[p]&&(i||g===t&&Math.abs(m-b)<o)&&l.push(this.index.blocksForRange(g,b,b+1,r))}});const c=new Map,u=await Promise.all(l);for(const h of u.flat())c.has(h.toString())||c.set(h.toString(),h);return(await Promise.all([...c.values()].map(async h=>{const{data:d,cpositions:p,dpositions:m,chunk:b}=await this._readChunk({chunk:h,opts:r}),g=[];for(const y of await this.readBamFeatures(d,p,m,b))s[y.name]&&!a[y.id]&&g.push(y);return g}))).flat()}async _readRegion(t,n,r={}){const{bytesRead:i,buffer:o}=await this.bam.read(ot.Buffer.alloc(n),0,n,t,r);return o.subarray(0,Math.min(i,n))}async _readChunk({chunk:t,opts:n}){const r=await this._readRegion(t.minv.blockPosition,t.fetchedSize(),n),{buffer:i,cpositions:o,dpositions:s}=await RC(r,t);return{data:i,cpositions:o,dpositions:s,chunk:t}}async readBamFeatures(t,n,r,i){let o=0;const s=[];let a=0,l=+Date.now();for(;o+4<t.length;){const c=t.readInt32LE(o),u=o+4+c-1;if(r){for(;o+i.minv.dataPosition>=r[a++];);a--}if(u<t.length){const f=new Pa({bytes:{byteArray:t,start:o,end:u},fileOffset:n.length>0?n[a]*256+(o-r[a])+i.minv.dataPosition+1:MQ.signed(t.slice(o,u))});s.push(f),this.yieldThreadTime&&+Date.now()-l>this.yieldThreadTime&&(await EQ(1),l=+Date.now())}o=u+1}return s}async hasRefSeq(t){var n,r;const i=(n=this.chrToIndex)===null||n===void 0?void 0:n[t];return i===void 0?!1:(r=this.index)===null||r===void 0?void 0:r.hasRefSeq(i)}async lineCount(t){var n;const r=(n=this.chrToIndex)===null||n===void 0?void 0:n[t];return r===void 0||!this.index?0:this.index.lineCount(r)}async indexCov(t,n,r){var i;if(!this.index)return[];await this.index.parse();const o=(i=this.chrToIndex)===null||i===void 0?void 0:i[t];return o===void 0?[]:this.index.indexCov(o,n,r)}async blocksForRange(t,n,r,i){var o;if(!this.index)return[];await this.index.parse();const s=(o=this.chrToIndex)===null||o===void 0?void 0:o[t];return s===void 0?[]:this.index.blocksForRange(s,n,r,i)}}async function A5(e,t){const n=await Promise.all(e.map(async r=>{const{url:i,headers:o}=r;if(i.startsWith("data:"))return ot.Buffer.from(i.split(",")[1],"base64");{const{referer:s,...a}=o,l=await fetch(i,{...t,headers:{...t==null?void 0:t.headers,...a}});if(!l.ok)throw new Error(`HTTP ${l.status} fetching ${i}: ${await l.text()}`);return ot.Buffer.from(await l.arrayBuffer())}}));return ot.Buffer.concat(await Promise.all(n.map(r=>io(r))))}class UQ extends x5{constructor(t){super({htsget:!0}),this.baseUrl=t.baseUrl,this.trackId=t.trackId}async*streamRecordsForRange(t,n,r,i){var o;const a=`${`${this.baseUrl}/${this.trackId}`}?referenceName=${t}&start=${n}&end=${r}&format=BAM`,l=(o=this.chrToIndex)===null||o===void 0?void 0:o[t];if(l===void 0)yield[];else{const c=await fetch(a,{...i});if(!c.ok)throw new Error(`HTTP ${c.status} fetching ${a}: ${await c.text()}`);const u=await c.json(),f=await A5(u.htsget.urls.slice(1),i);yield*this._fetchChunkFeatures([{buffer:f,_fetchedSize:void 0,bin:0,compareTo(){return 0},toUniqueString(){return`${t}_${n}_${r}`},fetchedSize(){return 0},minv:{dataPosition:0,blockPosition:0,compareTo:()=>0},maxv:{dataPosition:Number.MAX_SAFE_INTEGER,blockPosition:0,compareTo:()=>0},toString(){return`${t}_${n}_${r}`}}],l,n,r,i)}}async _readChunk({chunk:t}){if(!t.buffer)throw new Error("expected chunk.buffer in htsget");return{data:t.buffer,cpositions:[],dpositions:[],chunk:t}}async getHeader(t={}){const n=`${this.baseUrl}/${this.trackId}?referenceName=na&class=header`,r=await fetch(n,t);if(!r.ok)throw new Error(`HTTP ${r.status} fetching ${n}: ${await r.text()}`);const i=await r.json(),o=await A5(i.htsget.urls,t);if(o.readInt32LE(0)!==w5)throw new Error("Not a BAM file");const s=o.readInt32LE(4),a=o.toString("utf8",8,8+s),l=y5(a),c=[],u={},f=l.filter(h=>h.tag==="SQ");for(const[h,d]of f.entries()){let p="",m=0;for(const b of d.data)b.tag==="SN"?p=b.value:b.tag==="LN"&&(m=+b.value);u[p]=h,c[h]={refName:p,length:m}}return this.chrToIndex=u,this.indexToChr=c,l}}const HQ=Object.freeze(Object.defineProperty({__proto__:null,BAI:Ma,BamFile:x5,BamRecord:Pa,CSI:Cd,HtsgetFile:UQ},Symbol.toStringTag,{value:"Module"}));function E5(e){if(e.greaterThan(Number.MAX_SAFE_INTEGER)||e.lessThan(Number.MIN_SAFE_INTEGER))throw new Error("integer overflow");return e.toNumber()}class GQ extends Error{}function hu(e){if(e&&e.aborted){if(typeof DOMException<"u")throw new DOMException("aborted","AbortError");{const t=new GQ("aborted");throw t.code="ERR_ABORTED",t}}}function jQ(e,t){return t.minv.blockPosition-e.maxv.blockPosition<65e3&&t.maxv.blockPosition-e.minv.blockPosition<5e6}function S5(e,t){const n=[];let r=null;return e.length===0?e:(e.sort(function(i,o){const s=i.minv.blockPosition-o.minv.blockPosition;return s!==0?s:i.minv.dataPosition-o.minv.dataPosition}),e.forEach(i=>{(!t||i.maxv.compareTo(t)>0)&&(r===null?(n.push(i),r=i):jQ(r,i)?i.maxv.compareTo(r.maxv)>0&&(r.maxv=i.maxv):(n.push(i),r=i))}),n)}class gb{constructor(t,n){this.blockPosition=t,this.dataPosition=n}toString(){return`${this.blockPosition}:${this.dataPosition}`}compareTo(t){return this.blockPosition-t.blockPosition||this.dataPosition-t.dataPosition}}function Oa(e,t=0,n=!1){if(n)throw new Error("big-endian virtual file offsets not implemented");return new gb(e[t+7]*1099511627776+e[t+6]*4294967296+e[t+5]*16777216+e[t+4]*65536+e[t+3]*256+e[t+2],e[t+1]<<8|e[t])}class Td{constructor(t,n,r,i=void 0){this.minv=t,this.maxv=n,this.bin=r,this._fetchedSize=i}toUniqueString(){return`${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`}toString(){return this.toUniqueString()}compareTo(t){return this.minv.compareTo(t.minv)||this.maxv.compareTo(t.maxv)||this.bin-t.bin}fetchedSize(){return this._fetchedSize!==void 0?this._fetchedSize:this.maxv.blockPosition+65536-this.minv.blockPosition}}class C5{constructor({filehandle:t,renameRefSeqs:n=r=>r}){this.filehandle=t,this.renameRefSeq=n}async getMetadata(t={}){const{indices:n,...r}=await this.parse(t);return r}_findFirstData(t,n){return t?t.compareTo(n)>0?n:t:n}async parse(t={}){return this.parseP||(this.parseP=this._parse(t).catch(n=>{throw this.parseP=void 0,n})),this.parseP}async hasRefSeq(t,n={}){var r;return!!(!((r=(await this.parse(n)).indices[t])===null||r===void 0)&&r.binIndex)}}const VQ=21578324,k5=14;function qQ(e,t){return e+=1,t-=1,[[0,0],[1+(e>>26),1+(t>>26)],[9+(e>>23),9+(t>>23)],[73+(e>>20),73+(t>>20)],[585+(e>>17),585+(t>>17)],[4681+(e>>14),4681+(t>>14)]]}class La extends C5{async lineCount(t,n={}){const r=await this.parse(n),i=r.refNameToId[t];if(i===void 0||!r.indices[i])return-1;const{stats:s}=r.indices[i];return s?s.lineCount:-1}async _parse(t={}){const n=await this.filehandle.readFile(t),r=await io(n);if(hu(t.signal),r.readUInt32LE(0)!==VQ)throw new Error("Not a TBI file");const i=r.readInt32LE(4),o=r.readInt32LE(8),s=o&65536?"zero-based-half-open":"1-based-closed",l={0:"generic",1:"SAM",2:"VCF"}[o&15];if(!l)throw new Error(`invalid Tabix preset format flags ${o}`);const c={ref:r.readInt32LE(12),start:r.readInt32LE(16),end:r.readInt32LE(20)},u=r.readInt32LE(24),f=5,h=((1<<(f+1)*3)-1)/7,d=2**(14+f*3),p=u?String.fromCharCode(u):null,m=r.readInt32LE(28),b=r.readInt32LE(32),{refNameToId:g,refIdToName:y}=this._parseNameBytes(r.slice(36,36+b));let v=36+b,w;return{indices:new Array(i).fill(0).map(()=>{const E=r.readInt32LE(v);v+=4;const k={};let M;for(let I=0;I<E;I+=1){const q=r.readUInt32LE(v);if(v+=4,q>h+1)throw new Error("tabix index contains too many bins, please use a CSI index");if(q===h+1){const Z=r.readInt32LE(v);v+=4,Z===2&&(M=this.parsePseudoBin(r,v)),v+=16*Z}else{const Z=r.readInt32LE(v);v+=4;const te=new Array(Z);for(let J=0;J<Z;J+=1){const ce=Oa(r,v),ae=Oa(r,v+8);v+=16,w=this._findFirstData(w,ce),te[J]=new Td(ce,ae,q)}k[q]=te}}const D=r.readInt32LE(v);v+=4;const B=new Array(D);for(let I=0;I<D;I+=1)B[I]=Oa(r,v),v+=8,w=this._findFirstData(w,B[I]);return{binIndex:k,linearIndex:B,stats:M}}),metaChar:p,maxBinNumber:h,maxRefLength:d,skipLines:m,firstDataLine:w,columnNumbers:c,coordinateType:s,format:l,refIdToName:y,refNameToId:g,maxBlockSize:65536}}parsePseudoBin(t,n){return{lineCount:E5(fd.fromBytesLE(t.slice(n+16,n+24),!0))}}_parseNameBytes(t){let n=0,r=0;const i=[],o={};for(let s=0;s<t.length;s+=1)if(!t[s]){if(r<s){let a=t.toString("utf8",r,s);a=this.renameRefSeq(a),i[n]=a,o[a]=n}r=s+1,n+=1}return{refNameToId:o,refIdToName:i}}async blocksForRange(t,n,r,i={}){n<0&&(n=0);const o=await this.parse(i),s=o.refNameToId[t];if(s===void 0)return[];const a=o.indices[s];if(!a)return[];(a.linearIndex.length?a.linearIndex[n>>k5>=a.linearIndex.length?a.linearIndex.length-1:n>>k5]:new gb(0,0))||console.warn("querying outside of possible tabix range");const c=qQ(n,r),u=[];for(const[m,b]of c)for(let g=m;g<=b;g++)if(a.binIndex[g])for(const y of a.binIndex[g])u.push(new Td(y.minv,y.maxv,g));const f=a.linearIndex.length;let h=null;const d=Math.min(n>>14,f-1),p=Math.min(r>>14,f-1);for(let m=d;m<=p;++m){const b=a.linearIndex[m];b&&(!h||b.compareTo(h)<0)&&(h=b)}return S5(u,h)}}const $Q=21582659,WQ=38359875;function YQ(e,t){return e*2**t}function T5(e,t){return Math.floor(e/2**t)}class Id extends C5{constructor(t){super(t),this.maxBinNumber=0,this.depth=0,this.minShift=0}async lineCount(t,n={}){const r=await this.parse(n),i=r.refNameToId[t];if(i===void 0||!r.indices[i])return-1;const{stats:s}=r.indices[i];return s?s.lineCount:-1}indexCov(){throw new Error("CSI indexes do not support indexcov")}parseAuxData(t,n){const r=t.readInt32LE(n),i=r&65536?"zero-based-half-open":"1-based-closed",o={0:"generic",1:"SAM",2:"VCF"}[r&15];if(!o)throw new Error(`invalid Tabix preset format flags ${r}`);const s={ref:t.readInt32LE(n+4),start:t.readInt32LE(n+8),end:t.readInt32LE(n+12)},a=t.readInt32LE(n+16),l=a?String.fromCharCode(a):null,c=t.readInt32LE(n+20),u=t.readInt32LE(n+24),{refIdToName:f,refNameToId:h}=this._parseNameBytes(t.slice(n+28,n+28+u));return{refIdToName:f,refNameToId:h,skipLines:c,metaChar:l,columnNumbers:s,format:o,coordinateType:i}}_parseNameBytes(t){let n=0,r=0;const i=[],o={};for(let s=0;s<t.length;s+=1)if(!t[s]){if(r<s){let a=t.toString("utf8",r,s);a=this.renameRefSeq(a),i[n]=a,o[a]=n}r=s+1,n+=1}return{refNameToId:o,refIdToName:i}}async _parse(t={}){const n=await io(await this.filehandle.readFile(t));let r;if(n.readUInt32LE(0)===$Q)r=1;else if(n.readUInt32LE(0)===WQ)r=2;else throw new Error("Not a CSI file");this.minShift=n.readInt32LE(4),this.depth=n.readInt32LE(8),this.maxBinNumber=((1<<(this.depth+1)*3)-1)/7;const i=2**(this.minShift+this.depth*3),o=n.readInt32LE(12),s=o&&o>=30?this.parseAuxData(n,16):{refIdToName:[],refNameToId:{},metaChar:null,columnNumbers:{ref:0,start:1,end:2},coordinateType:"zero-based-half-open",format:"generic"},a=n.readInt32LE(16+o);let l,c=16+o+4;const u=new Array(a).fill(0).map(()=>{const f=n.readInt32LE(c);c+=4;const h={};let d;for(let p=0;p<f;p+=1){const m=n.readUInt32LE(c);if(m>this.maxBinNumber)d=this.parsePseudoBin(n,c+4),c+=48;else{const b=Oa(n,c+4);l=this._findFirstData(l,b);const g=n.readInt32LE(c+12);c+=16;const y=new Array(g);for(let v=0;v<g;v+=1){const w=Oa(n,c),S=Oa(n,c+8);c+=16,y[v]=new Td(w,S,m)}h[m]=y}}return{binIndex:h,stats:d}});return{...s,csi:!0,refCount:a,maxBlockSize:65536,firstDataLine:l,csiVersion:r,indices:u,depth:this.depth,maxBinNumber:this.maxBinNumber,maxRefLength:i}}parsePseudoBin(t,n){return{lineCount:E5(fd.fromBytesLE(t.slice(n+28,n+36),!0))}}async blocksForRange(t,n,r,i={}){n<0&&(n=0);const o=await this.parse(i),s=o.refNameToId[t];if(s===void 0)return[];const a=o.indices[s];if(!a)return[];const l=this.reg2bins(n,r),c=[];for(const[u,f]of l)for(let h=u;h<=f;h++)if(a.binIndex[h])for(const d of a.binIndex[h])c.push(new Td(d.minv,d.maxv,h));return S5(c,new gb(0,0))}reg2bins(t,n){t-=1,t<1&&(t=1),n>2**50&&(n=2**34),n-=1;let r=0,i=0,o=this.minShift+this.depth*3;const s=[];for(;r<=this.depth;o-=3,i+=YQ(1,r*3),r+=1){const a=i+T5(t,o),l=i+T5(n,o);if(l-a+s.length>this.maxBinNumber)throw new Error(`query ${t}-${n} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);s.push([a,l])}return s}}function QQ(e){return/^[\u0000-\u007F]*$/.test(e)}const Na=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;class ZQ{constructor({path:t,filehandle:n,url:r,tbiPath:i,tbiUrl:o,tbiFilehandle:s,csiPath:a,csiUrl:l,csiFilehandle:c,renameRefSeqs:u=h=>h,chunkCacheSize:f=5*2**20}){if(n)this.filehandle=n;else if(t)this.filehandle=new qt(t);else if(r)this.filehandle=new ur(r);else throw new TypeError("must provide either filehandle or path");if(s)this.index=new La({filehandle:s,renameRefSeqs:u});else if(c)this.index=new Id({filehandle:c,renameRefSeqs:u});else if(i)this.index=new La({filehandle:new qt(i),renameRefSeqs:u});else if(a)this.index=new Id({filehandle:new qt(a),renameRefSeqs:u});else if(t)this.index=new La({filehandle:new qt(`${t}.tbi`),renameRefSeqs:u});else if(l)this.index=new Id({filehandle:new ur(l)});else if(o)this.index=new La({filehandle:new ur(o)});else if(r)this.index=new La({filehandle:new ur(`${r}.tbi`)});else throw new TypeError("must provide one of tbiFilehandle, tbiPath, csiFilehandle, csiPath, tbiUrl, csiUrl");this.renameRefSeq=u,this.chunkCache=new hs({cache:new dd({maxSize:Math.floor(f/65536)}),fill:(h,d)=>this.readChunk(h,{signal:d})})}async getLines(t,n,r,i){var o,s;let a,l={},c;typeof i=="function"?c=i:(l=i,c=i.lineCallback,a=i.signal);const u=await this.index.getMetadata(l);hu(a);const f=n??0,h=r??u.maxRefLength;if(!(f<=h))throw new TypeError("invalid start and end coordinates. start must be less than or equal to end");if(f===h)return;const d=await this.index.blocksForRange(t,f,h,l);hu(a);for(const p of d){const{buffer:m,cpositions:b,dpositions:g}=await this.chunkCache.get(p.toString(),p,a);hu(a);let y=0,v=0;const w=(o=Na==null?void 0:Na.decode(m))!==null&&o!==void 0?o:m.toString(),S=m.length<5e8&&QQ(w);for(;y<w.length;){let E,k;if(S){if(k=w.indexOf(`
3926
3926
  `,y),k===-1)break;E=w.slice(y,k)}else{if(k=m.indexOf(`
3927
- `,y),k===-1)break;const B=m.slice(y,k);E=(s=Na==null?void 0:Na.decode(B))!==null&&s!==void 0?s:B.toString()}if(g){for(;y+p.minv.dataPosition>=g[v++];);v--}const{startCoordinate:M,overlaps:D}=this.checkLine(u,t,f,h,E);if(D)c(E,b[v]*256+(y-g[v])+p.minv.dataPosition+1);else if(M!==void 0&&M>=h)return;y=k+1}}}async getMetadata(t={}){return this.index.getMetadata(t)}async getHeaderBuffer(t={}){const{firstDataLine:n,metaChar:r,maxBlockSize:i}=await this.getMetadata(t);hu(t.signal);const o=((n==null?void 0:n.blockPosition)||0)+i,s=await this._readRegion(0,o,t),a=await io(s);if(r){let l=-1;const c=10,u=r.charCodeAt(0);for(let f=0;f<a.length&&!(f===l+1&&a[f]!==u);f+=1)a[f]===c&&(l=f);return a.subarray(0,l+1)}return a}async getHeader(t={}){return(await this.getHeaderBuffer(t)).toString("utf8")}async getReferenceSequenceNames(t={}){return(await this.getMetadata(t)).refIdToName}checkLine(t,n,r,i,o){const{columnNumbers:s,metaChar:a,coordinateType:l,format:c}=t;if(a&&o.startsWith(a))return{overlaps:!1};let{ref:u,start:f,end:h}=s;u||(u=0),f||(f=0),h||(h=0),c==="VCF"&&(h=8);const d=Math.max(u,f,h);let p=1,m=0,b="",g=-1/0;const y=o.length;for(let v=0;v<y+1;v++)if(o[v]===" "||v===y){if(p===u){if(this.renameRefSeq(o.slice(m,v))!==n)return{overlaps:!1}}else if(p===f){if(g=parseInt(o.slice(m,v),10),l==="1-based-closed"&&(g-=1),g>=i)return{startCoordinate:g,overlaps:!1};if((h===0||h===f)&&g+1<=r)return{startCoordinate:g,overlaps:!1}}else if(c==="VCF"&&p===4)b=o.slice(m,v);else if(p===h&&(c==="VCF"?this._getVcfEnd(g,b,o.slice(m,v)):Number.parseInt(o.slice(m,v),10))<=r)return{overlaps:!1};if(m=v+1,p+=1,p>d)break}return{startCoordinate:g,overlaps:!0}}_getVcfEnd(t,n,r){let i=t+n.length;const o=r.includes("SVTYPE=TRA");if(r[0]!=="."&&!o){let s=";";for(let a=0;a<r.length;a+=1){if(s===";"&&r.slice(a,a+4)==="END="){let l=r.indexOf(";",a);l===-1&&(l=r.length),i=parseInt(r.slice(a+4,l),10);break}s=r[a]}}else if(o)return t+1;return i}async lineCount(t,n={}){return this.index.lineCount(t,n)}async _readRegion(t,n,r={}){const i=ot.Buffer.alloc(n),{bytesRead:o,buffer:s}=await this.filehandle.read(i,0,n,t,r);return s.subarray(0,o)}async readChunk(t,n={}){const r=await this._readRegion(t.minv.blockPosition,t.fetchedSize(),n);return RC(r,t)}}const XQ=Object.freeze(Object.defineProperty({__proto__:null,CSI:Id,TBI:La,TabixIndexedFile:ZQ},Symbol.toStringTag,{value:"Module"}));var _d={exports:{}},I5;function mb(){if(I5)return _d.exports;I5=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(S,E,k){return Function.prototype.apply.call(S,E,k)},n;e&&typeof e.ownKeys=="function"?n=e.ownKeys:Object.getOwnPropertySymbols?n=function(S){return Object.getOwnPropertyNames(S).concat(Object.getOwnPropertySymbols(S))}:n=function(S){return Object.getOwnPropertyNames(S)};function r(w){console&&console.warn&&console.warn(w)}var i=Number.isNaN||function(S){return S!==S};function o(){o.init.call(this)}_d.exports=o,_d.exports.once=g,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(w){if(typeof w!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof w)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(w){if(typeof w!="number"||w<0||i(w))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+w+".");s=w}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(S){if(typeof S!="number"||S<0||i(S))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+S+".");return this._maxListeners=S,this};function l(w){return w._maxListeners===void 0?o.defaultMaxListeners:w._maxListeners}o.prototype.getMaxListeners=function(){return l(this)},o.prototype.emit=function(S){for(var E=[],k=1;k<arguments.length;k++)E.push(arguments[k]);var M=S==="error",D=this._events;if(D!==void 0)M=M&&D.error===void 0;else if(!M)return!1;if(M){var B;if(E.length>0&&(B=E[0]),B instanceof Error)throw B;var I=new Error("Unhandled error."+(B?" ("+B.message+")":""));throw I.context=B,I}var q=D[S];if(q===void 0)return!1;if(typeof q=="function")t(q,this,E);else for(var Z=q.length,ne=p(q,Z),k=0;k<Z;++k)t(ne[k],this,E);return!0};function c(w,S,E,k){var M,D,B;if(a(E),D=w._events,D===void 0?(D=w._events=Object.create(null),w._eventsCount=0):(D.newListener!==void 0&&(w.emit("newListener",S,E.listener?E.listener:E),D=w._events),B=D[S]),B===void 0)B=D[S]=E,++w._eventsCount;else if(typeof B=="function"?B=D[S]=k?[E,B]:[B,E]:k?B.unshift(E):B.push(E),M=l(w),M>0&&B.length>M&&!B.warned){B.warned=!0;var I=new Error("Possible EventEmitter memory leak detected. "+B.length+" "+String(S)+" listeners added. Use emitter.setMaxListeners() to increase limit");I.name="MaxListenersExceededWarning",I.emitter=w,I.type=S,I.count=B.length,r(I)}return w}o.prototype.addListener=function(S,E){return c(this,S,E,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(S,E){return c(this,S,E,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(w,S,E){var k={fired:!1,wrapFn:void 0,target:w,type:S,listener:E},M=u.bind(k);return M.listener=E,k.wrapFn=M,M}o.prototype.once=function(S,E){return a(E),this.on(S,f(this,S,E)),this},o.prototype.prependOnceListener=function(S,E){return a(E),this.prependListener(S,f(this,S,E)),this},o.prototype.removeListener=function(S,E){var k,M,D,B,I;if(a(E),M=this._events,M===void 0)return this;if(k=M[S],k===void 0)return this;if(k===E||k.listener===E)--this._eventsCount===0?this._events=Object.create(null):(delete M[S],M.removeListener&&this.emit("removeListener",S,k.listener||E));else if(typeof k!="function"){for(D=-1,B=k.length-1;B>=0;B--)if(k[B]===E||k[B].listener===E){I=k[B].listener,D=B;break}if(D<0)return this;D===0?k.shift():m(k,D),k.length===1&&(M[S]=k[0]),M.removeListener!==void 0&&this.emit("removeListener",S,I||E)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(S){var E,k,M;if(k=this._events,k===void 0)return this;if(k.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):k[S]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete k[S]),this;if(arguments.length===0){var D=Object.keys(k),B;for(M=0;M<D.length;++M)B=D[M],B!=="removeListener"&&this.removeAllListeners(B);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(E=k[S],typeof E=="function")this.removeListener(S,E);else if(E!==void 0)for(M=E.length-1;M>=0;M--)this.removeListener(S,E[M]);return this};function h(w,S,E){var k=w._events;if(k===void 0)return[];var M=k[S];return M===void 0?[]:typeof M=="function"?E?[M.listener||M]:[M]:E?b(M):p(M,M.length)}o.prototype.listeners=function(S){return h(this,S,!0)},o.prototype.rawListeners=function(S){return h(this,S,!1)},o.listenerCount=function(w,S){return typeof w.listenerCount=="function"?w.listenerCount(S):d.call(w,S)},o.prototype.listenerCount=d;function d(w){var S=this._events;if(S!==void 0){var E=S[w];if(typeof E=="function")return 1;if(E!==void 0)return E.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function p(w,S){for(var E=new Array(S),k=0;k<S;++k)E[k]=w[k];return E}function m(w,S){for(;S+1<w.length;S++)w[S]=w[S+1];w.pop()}function b(w){for(var S=new Array(w.length),E=0;E<S.length;++E)S[E]=w[E].listener||w[E];return S}function g(w,S){return new Promise(function(E,k){function M(B){w.removeListener(S,D),k(B)}function D(){typeof w.removeListener=="function"&&w.removeListener("error",M),E([].slice.call(arguments))}v(w,S,D,{once:!0}),S!=="error"&&y(w,M,{once:!0})})}function y(w,S,E){typeof w.on=="function"&&v(w,"error",S,E)}function v(w,S,E,k){if(typeof w.on=="function")k.once?w.once(S,E):w.on(S,E);else if(typeof w.addEventListener=="function")w.addEventListener(S,function M(D){k.once&&w.removeEventListener(S,M),E(D)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof w)}return _d.exports}var Dd={exports:{}},_5;function za(){return _5||(_5=1,typeof Object.create=="function"?Dd.exports=function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Dd.exports=function(t,n){if(n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}}),Dd.exports}var bb,D5;function R5(){return D5||(D5=1,bb=mb().EventEmitter),bb}const B5=g$(j$);var yb,F5;function KQ(){if(F5)return yb;F5=1;function e(p,m){var b=Object.keys(p);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(p);m&&(g=g.filter(function(y){return Object.getOwnPropertyDescriptor(p,y).enumerable})),b.push.apply(b,g)}return b}function t(p){for(var m=1;m<arguments.length;m++){var b=arguments[m]!=null?arguments[m]:{};m%2?e(Object(b),!0).forEach(function(g){n(p,g,b[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(b)):e(Object(b)).forEach(function(g){Object.defineProperty(p,g,Object.getOwnPropertyDescriptor(b,g))})}return p}function n(p,m,b){return m=s(m),m in p?Object.defineProperty(p,m,{value:b,enumerable:!0,configurable:!0,writable:!0}):p[m]=b,p}function r(p,m){if(!(p instanceof m))throw new TypeError("Cannot call a class as a function")}function i(p,m){for(var b=0;b<m.length;b++){var g=m[b];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(p,s(g.key),g)}}function o(p,m,b){return m&&i(p.prototype,m),Object.defineProperty(p,"prototype",{writable:!1}),p}function s(p){var m=a(p,"string");return typeof m=="symbol"?m:String(m)}function a(p,m){if(typeof p!="object"||p===null)return p;var b=p[Symbol.toPrimitive];if(b!==void 0){var g=b.call(p,m);if(typeof g!="object")return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(p)}var l=iu(),c=l.Buffer,u=B5,f=u.inspect,h=f&&f.custom||"inspect";function d(p,m,b){c.prototype.copy.call(p,m,b)}return yb=function(){function p(){r(this,p),this.head=null,this.tail=null,this.length=0}return o(p,[{key:"push",value:function(b){var g={data:b,next:null};this.length>0?this.tail.next=g:this.head=g,this.tail=g,++this.length}},{key:"unshift",value:function(b){var g={data:b,next:this.head};this.length===0&&(this.tail=g),this.head=g,++this.length}},{key:"shift",value:function(){if(this.length!==0){var b=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,b}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(b){if(this.length===0)return"";for(var g=this.head,y=""+g.data;g=g.next;)y+=b+g.data;return y}},{key:"concat",value:function(b){if(this.length===0)return c.alloc(0);for(var g=c.allocUnsafe(b>>>0),y=this.head,v=0;y;)d(y.data,g,v),v+=y.data.length,y=y.next;return g}},{key:"consume",value:function(b,g){var y;return b<this.head.data.length?(y=this.head.data.slice(0,b),this.head.data=this.head.data.slice(b)):b===this.head.data.length?y=this.shift():y=g?this._getString(b):this._getBuffer(b),y}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(b){var g=this.head,y=1,v=g.data;for(b-=v.length;g=g.next;){var w=g.data,S=b>w.length?w.length:b;if(S===w.length?v+=w:v+=w.slice(0,b),b-=S,b===0){S===w.length?(++y,g.next?this.head=g.next:this.head=this.tail=null):(this.head=g,g.data=w.slice(S));break}++y}return this.length-=y,v}},{key:"_getBuffer",value:function(b){var g=c.allocUnsafe(b),y=this.head,v=1;for(y.data.copy(g),b-=y.data.length;y=y.next;){var w=y.data,S=b>w.length?w.length:b;if(w.copy(g,g.length-b,0,S),b-=S,b===0){S===w.length?(++v,y.next?this.head=y.next:this.head=this.tail=null):(this.head=y,y.data=w.slice(S));break}++v}return this.length-=v,g}},{key:h,value:function(b,g){return f(this,t(t({},g),{},{depth:0,customInspect:!1}))}}]),p}(),yb}var wb,M5;function P5(){if(M5)return wb;M5=1;function e(s,a){var l=this,c=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return c||u?(a?a(s):s&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(i,this,s)):process.nextTick(i,this,s)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(s||null,function(f){!a&&f?l._writableState?l._writableState.errorEmitted?process.nextTick(n,l):(l._writableState.errorEmitted=!0,process.nextTick(t,l,f)):process.nextTick(t,l,f):a?(process.nextTick(n,l),a(f)):process.nextTick(n,l)}),this)}function t(s,a){i(s,a),n(s)}function n(s){s._writableState&&!s._writableState.emitClose||s._readableState&&!s._readableState.emitClose||s.emit("close")}function r(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function i(s,a){s.emit("error",a)}function o(s,a){var l=s._readableState,c=s._writableState;l&&l.autoDestroy||c&&c.autoDestroy?s.destroy(a):s.emit("error",a)}return wb={destroy:e,undestroy:r,errorOrDestroy:o},wb}var vb={},O5;function Ua(){if(O5)return vb;O5=1;function e(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,a.__proto__=l}var t={};function n(a,l,c){c||(c=Error);function u(h,d,p){return typeof l=="string"?l:l(h,d,p)}var f=function(h){e(d,h);function d(p,m,b){return h.call(this,u(p,m,b))||this}return d}(c);f.prototype.name=c.name,f.prototype.code=a,t[a]=f}function r(a,l){if(Array.isArray(a)){var c=a.length;return a=a.map(function(u){return String(u)}),c>2?"one of ".concat(l," ").concat(a.slice(0,c-1).join(", "),", or ")+a[c-1]:c===2?"one of ".concat(l," ").concat(a[0]," or ").concat(a[1]):"of ".concat(l," ").concat(a[0])}else return"of ".concat(l," ").concat(String(a))}function i(a,l,c){return a.substr(0,l.length)===l}function o(a,l,c){return(c===void 0||c>a.length)&&(c=a.length),a.substring(c-l.length,c)===l}function s(a,l,c){return typeof c!="number"&&(c=0),c+l.length>a.length?!1:a.indexOf(l,c)!==-1}return n("ERR_INVALID_OPT_VALUE",function(a,l){return'The value "'+l+'" is invalid for option "'+a+'"'},TypeError),n("ERR_INVALID_ARG_TYPE",function(a,l,c){var u;typeof l=="string"&&i(l,"not ")?(u="must not be",l=l.replace(/^not /,"")):u="must be";var f;if(o(a," argument"))f="The ".concat(a," ").concat(u," ").concat(r(l,"type"));else{var h=s(a,".")?"property":"argument";f='The "'.concat(a,'" ').concat(h," ").concat(u," ").concat(r(l,"type"))}return f+=". Received type ".concat(typeof c),f},TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",function(a){return"The "+a+" method is not implemented"}),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",function(a){return"Cannot call "+a+" after a stream was destroyed"}),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",function(a){return"Unknown encoding: "+a},TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),vb.codes=t,vb}var xb,L5;function N5(){if(L5)return xb;L5=1;var e=Ua().codes.ERR_INVALID_OPT_VALUE;function t(r,i,o){return r.highWaterMark!=null?r.highWaterMark:i?r[o]:null}function n(r,i,o,s){var a=t(i,s,o);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var l=s?o:"highWaterMark";throw new e(l,a)}return Math.floor(a)}return r.objectMode?16:16*1024}return xb={getHighWaterMark:n},xb}var Ab,z5;function JQ(){if(z5)return Ab;z5=1,Ab=e;function e(n,r){if(t("noDeprecation"))return n;var i=!1;function o(){if(!i){if(t("throwDeprecation"))throw new Error(r);t("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return n.apply(this,arguments)}return o}function t(n){try{if(!globalThis.localStorage)return!1}catch{return!1}var r=globalThis.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return Ab}var Eb,U5;function H5(){if(U5)return Eb;U5=1,Eb=M;function e(Q){var X=this;this.next=null,this.entry=null,this.finish=function(){qe(X,Q)}}var t;M.WritableState=E;var n={deprecate:JQ()},r=R5(),i=iu().Buffer,o=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function s(Q){return i.from(Q)}function a(Q){return i.isBuffer(Q)||Q instanceof o}var l=P5(),c=N5(),u=c.getHighWaterMark,f=Ua().codes,h=f.ERR_INVALID_ARG_TYPE,d=f.ERR_METHOD_NOT_IMPLEMENTED,p=f.ERR_MULTIPLE_CALLBACK,m=f.ERR_STREAM_CANNOT_PIPE,b=f.ERR_STREAM_DESTROYED,g=f.ERR_STREAM_NULL_VALUES,y=f.ERR_STREAM_WRITE_AFTER_END,v=f.ERR_UNKNOWN_ENCODING,w=l.errorOrDestroy;za()(M,r);function S(){}function E(Q,X,re){t=t||Ha(),Q=Q||{},typeof re!="boolean"&&(re=X instanceof t),this.objectMode=!!Q.objectMode,re&&(this.objectMode=this.objectMode||!!Q.writableObjectMode),this.highWaterMark=u(this,Q,"writableHighWaterMark",re),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var ie=Q.decodeStrings===!1;this.decodeStrings=!ie,this.defaultEncoding=Q.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ye){ce(X,ye)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Q.emitClose!==!1,this.autoDestroy=!!Q.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}E.prototype.getBuffer=function(){for(var X=this.bufferedRequest,re=[];X;)re.push(X),X=X.next;return re},function(){try{Object.defineProperty(E.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var k;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(k=Function.prototype[Symbol.hasInstance],Object.defineProperty(M,Symbol.hasInstance,{value:function(X){return k.call(this,X)?!0:this!==M?!1:X&&X._writableState instanceof E}})):k=function(X){return X instanceof this};function M(Q){t=t||Ha();var X=this instanceof t;if(!X&&!k.call(M,this))return new M(Q);this._writableState=new E(Q,this,X),this.writable=!0,Q&&(typeof Q.write=="function"&&(this._write=Q.write),typeof Q.writev=="function"&&(this._writev=Q.writev),typeof Q.destroy=="function"&&(this._destroy=Q.destroy),typeof Q.final=="function"&&(this._final=Q.final)),r.call(this)}M.prototype.pipe=function(){w(this,new m)};function D(Q,X){var re=new y;w(Q,re),process.nextTick(X,re)}function B(Q,X,re,ie){var ye;return re===null?ye=new g:typeof re!="string"&&!X.objectMode&&(ye=new h("chunk",["string","Buffer"],re)),ye?(w(Q,ye),process.nextTick(ie,ye),!1):!0}M.prototype.write=function(Q,X,re){var ie=this._writableState,ye=!1,L=!ie.objectMode&&a(Q);return L&&!i.isBuffer(Q)&&(Q=s(Q)),typeof X=="function"&&(re=X,X=null),L?X="buffer":X||(X=ie.defaultEncoding),typeof re!="function"&&(re=S),ie.ending?D(this,re):(L||B(this,ie,Q,re))&&(ie.pendingcb++,ye=q(this,ie,L,Q,X,re)),ye},M.prototype.cork=function(){this._writableState.corked++},M.prototype.uncork=function(){var Q=this._writableState;Q.corked&&(Q.corked--,!Q.writing&&!Q.corked&&!Q.bufferProcessing&&Q.bufferedRequest&&me(this,Q))},M.prototype.setDefaultEncoding=function(X){if(typeof X=="string"&&(X=X.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((X+"").toLowerCase())>-1))throw new v(X);return this._writableState.defaultEncoding=X,this},Object.defineProperty(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function I(Q,X,re){return!Q.objectMode&&Q.decodeStrings!==!1&&typeof X=="string"&&(X=i.from(X,re)),X}Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function q(Q,X,re,ie,ye,L){if(!re){var R=I(X,ie,ye);ie!==R&&(re=!0,ye="buffer",ie=R)}var se=X.objectMode?1:ie.length;X.length+=se;var pe=X.length<X.highWaterMark;if(pe||(X.needDrain=!0),X.writing||X.corked){var Re=X.lastBufferedRequest;X.lastBufferedRequest={chunk:ie,encoding:ye,isBuf:re,callback:L,next:null},Re?Re.next=X.lastBufferedRequest:X.bufferedRequest=X.lastBufferedRequest,X.bufferedRequestCount+=1}else Z(Q,X,!1,se,ie,ye,L);return pe}function Z(Q,X,re,ie,ye,L,R){X.writelen=ie,X.writecb=R,X.writing=!0,X.sync=!0,X.destroyed?X.onwrite(new b("write")):re?Q._writev(ye,X.onwrite):Q._write(ye,L,X.onwrite),X.sync=!1}function ne(Q,X,re,ie,ye){--X.pendingcb,re?(process.nextTick(ye,ie),process.nextTick(H,Q,X),Q._writableState.errorEmitted=!0,w(Q,ie)):(ye(ie),Q._writableState.errorEmitted=!0,w(Q,ie),H(Q,X))}function J(Q){Q.writing=!1,Q.writecb=null,Q.length-=Q.writelen,Q.writelen=0}function ce(Q,X){var re=Q._writableState,ie=re.sync,ye=re.writecb;if(typeof ye!="function")throw new p;if(J(re),X)ne(Q,re,ie,X,ye);else{var L=U(re)||Q.destroyed;!L&&!re.corked&&!re.bufferProcessing&&re.bufferedRequest&&me(Q,re),ie?process.nextTick(ae,Q,re,L,ye):ae(Q,re,L,ye)}}function ae(Q,X,re,ie){re||we(Q,X),X.pendingcb--,ie(),H(Q,X)}function we(Q,X){X.length===0&&X.needDrain&&(X.needDrain=!1,Q.emit("drain"))}function me(Q,X){X.bufferProcessing=!0;var re=X.bufferedRequest;if(Q._writev&&re&&re.next){var ie=X.bufferedRequestCount,ye=new Array(ie),L=X.corkedRequestsFree;L.entry=re;for(var R=0,se=!0;re;)ye[R]=re,re.isBuf||(se=!1),re=re.next,R+=1;ye.allBuffers=se,Z(Q,X,!0,X.length,ye,"",L.finish),X.pendingcb++,X.lastBufferedRequest=null,L.next?(X.corkedRequestsFree=L.next,L.next=null):X.corkedRequestsFree=new e(X),X.bufferedRequestCount=0}else{for(;re;){var pe=re.chunk,Re=re.encoding,Te=re.callback,Ie=X.objectMode?1:pe.length;if(Z(Q,X,!1,Ie,pe,Re,Te),re=re.next,X.bufferedRequestCount--,X.writing)break}re===null&&(X.lastBufferedRequest=null)}X.bufferedRequest=re,X.bufferProcessing=!1}M.prototype._write=function(Q,X,re){re(new d("_write()"))},M.prototype._writev=null,M.prototype.end=function(Q,X,re){var ie=this._writableState;return typeof Q=="function"?(re=Q,Q=null,X=null):typeof X=="function"&&(re=X,X=null),Q!=null&&this.write(Q,X),ie.corked&&(ie.corked=1,this.uncork()),ie.ending||ze(this,ie,re),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function U(Q){return Q.ending&&Q.length===0&&Q.bufferedRequest===null&&!Q.finished&&!Q.writing}function Ae(Q,X){Q._final(function(re){X.pendingcb--,re&&w(Q,re),X.prefinished=!0,Q.emit("prefinish"),H(Q,X)})}function Ce(Q,X){!X.prefinished&&!X.finalCalled&&(typeof Q._final=="function"&&!X.destroyed?(X.pendingcb++,X.finalCalled=!0,process.nextTick(Ae,Q,X)):(X.prefinished=!0,Q.emit("prefinish")))}function H(Q,X){var re=U(X);if(re&&(Ce(Q,X),X.pendingcb===0&&(X.finished=!0,Q.emit("finish"),X.autoDestroy))){var ie=Q._readableState;(!ie||ie.autoDestroy&&ie.endEmitted)&&Q.destroy()}return re}function ze(Q,X,re){X.ending=!0,H(Q,X),re&&(X.finished?process.nextTick(re):Q.once("finish",re)),X.ended=!0,Q.writable=!1}function qe(Q,X,re){var ie=Q.entry;for(Q.entry=null;ie;){var ye=ie.callback;X.pendingcb--,ye(re),ie=ie.next}X.corkedRequestsFree.next=Q}return Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(X){this._writableState&&(this._writableState.destroyed=X)}}),M.prototype.destroy=l.destroy,M.prototype._undestroy=l.undestroy,M.prototype._destroy=function(Q,X){X(Q)},Eb}var Sb,G5;function Ha(){if(G5)return Sb;G5=1;var e=Object.keys||function(c){var u=[];for(var f in c)u.push(f);return u};Sb=s;var t=Q5(),n=H5();za()(s,t);for(var r=e(n.prototype),i=0;i<r.length;i++){var o=r[i];s.prototype[o]||(s.prototype[o]=n.prototype[o])}function s(c){if(!(this instanceof s))return new s(c);t.call(this,c),n.call(this,c),this.allowHalfOpen=!0,c&&(c.readable===!1&&(this.readable=!1),c.writable===!1&&(this.writable=!1),c.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",a)))}Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function a(){this._writableState.ended||process.nextTick(l,this)}function l(c){c.end()}return Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(u){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=u,this._writableState.destroyed=u)}}),Sb}var Cb={},Rd={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var j5;function eZ(){return j5||(j5=1,function(e,t){var n=iu(),r=n.Buffer;function i(s,a){for(var l in s)a[l]=s[l]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=o);function o(s,a,l){return r(s,a,l)}o.prototype=Object.create(r.prototype),i(r,o),o.from=function(s,a,l){if(typeof s=="number")throw new TypeError("Argument must not be a number");return r(s,a,l)},o.alloc=function(s,a,l){if(typeof s!="number")throw new TypeError("Argument must be a number");var c=r(s);return a!==void 0?typeof l=="string"?c.fill(a,l):c.fill(a):c.fill(0),c},o.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return r(s)},o.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(s)}}(Rd,Rd.exports)),Rd.exports}var V5;function kb(){if(V5)return Cb;V5=1;var e=eZ().Buffer,t=e.isEncoding||function(g){switch(g=""+g,g&&g.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(g){if(!g)return"utf8";for(var y;;)switch(g){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return g;default:if(y)return;g=(""+g).toLowerCase(),y=!0}}function r(g){var y=n(g);if(typeof y!="string"&&(e.isEncoding===t||!t(g)))throw new Error("Unknown encoding: "+g);return y||g}Cb.StringDecoder=i;function i(g){this.encoding=r(g);var y;switch(this.encoding){case"utf16le":this.text=f,this.end=h,y=4;break;case"utf8":this.fillLast=l,y=4;break;case"base64":this.text=d,this.end=p,y=3;break;default:this.write=m,this.end=b;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(y)}i.prototype.write=function(g){if(g.length===0)return"";var y,v;if(this.lastNeed){if(y=this.fillLast(g),y===void 0)return"";v=this.lastNeed,this.lastNeed=0}else v=0;return v<g.length?y?y+this.text(g,v):this.text(g,v):y||""},i.prototype.end=u,i.prototype.text=c,i.prototype.fillLast=function(g){if(this.lastNeed<=g.length)return g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,g.length),this.lastNeed-=g.length};function o(g){return g<=127?0:g>>5===6?2:g>>4===14?3:g>>3===30?4:g>>6===2?-1:-2}function s(g,y,v){var w=y.length-1;if(w<v)return 0;var S=o(y[w]);return S>=0?(S>0&&(g.lastNeed=S-1),S):--w<v||S===-2?0:(S=o(y[w]),S>=0?(S>0&&(g.lastNeed=S-2),S):--w<v||S===-2?0:(S=o(y[w]),S>=0?(S>0&&(S===2?S=0:g.lastNeed=S-3),S):0))}function a(g,y,v){if((y[0]&192)!==128)return g.lastNeed=0,"�";if(g.lastNeed>1&&y.length>1){if((y[1]&192)!==128)return g.lastNeed=1,"�";if(g.lastNeed>2&&y.length>2&&(y[2]&192)!==128)return g.lastNeed=2,"�"}}function l(g){var y=this.lastTotal-this.lastNeed,v=a(this,g);if(v!==void 0)return v;if(this.lastNeed<=g.length)return g.copy(this.lastChar,y,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,y,0,g.length),this.lastNeed-=g.length}function c(g,y){var v=s(this,g,y);if(!this.lastNeed)return g.toString("utf8",y);this.lastTotal=v;var w=g.length-(v-this.lastNeed);return g.copy(this.lastChar,0,w),g.toString("utf8",y,w)}function u(g){var y=g&&g.length?this.write(g):"";return this.lastNeed?y+"�":y}function f(g,y){if((g.length-y)%2===0){var v=g.toString("utf16le",y);if(v){var w=v.charCodeAt(v.length-1);if(w>=55296&&w<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1],v.slice(0,-1)}return v}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=g[g.length-1],g.toString("utf16le",y,g.length-1)}function h(g){var y=g&&g.length?this.write(g):"";if(this.lastNeed){var v=this.lastTotal-this.lastNeed;return y+this.lastChar.toString("utf16le",0,v)}return y}function d(g,y){var v=(g.length-y)%3;return v===0?g.toString("base64",y):(this.lastNeed=3-v,this.lastTotal=3,v===1?this.lastChar[0]=g[g.length-1]:(this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1]),g.toString("base64",y,g.length-v))}function p(g){var y=g&&g.length?this.write(g):"";return this.lastNeed?y+this.lastChar.toString("base64",0,3-this.lastNeed):y}function m(g){return g.toString(this.encoding)}function b(g){return g&&g.length?this.write(g):""}return Cb}var Tb,q5;function Ib(){if(q5)return Tb;q5=1;var e=Ua().codes.ERR_STREAM_PREMATURE_CLOSE;function t(o){var s=!1;return function(){if(!s){s=!0;for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];o.apply(this,l)}}}function n(){}function r(o){return o.setHeader&&typeof o.abort=="function"}function i(o,s,a){if(typeof s=="function")return i(o,null,s);s||(s={}),a=t(a||n);var l=s.readable||s.readable!==!1&&o.readable,c=s.writable||s.writable!==!1&&o.writable,u=function(){o.writable||h()},f=o._writableState&&o._writableState.finished,h=function(){c=!1,f=!0,l||a.call(o)},d=o._readableState&&o._readableState.endEmitted,p=function(){l=!1,d=!0,c||a.call(o)},m=function(v){a.call(o,v)},b=function(){var v;if(l&&!d)return(!o._readableState||!o._readableState.ended)&&(v=new e),a.call(o,v);if(c&&!f)return(!o._writableState||!o._writableState.ended)&&(v=new e),a.call(o,v)},g=function(){o.req.on("finish",h)};return r(o)?(o.on("complete",h),o.on("abort",b),o.req?g():o.on("request",g)):c&&!o._writableState&&(o.on("end",u),o.on("close",u)),o.on("end",p),o.on("finish",h),s.error!==!1&&o.on("error",m),o.on("close",b),function(){o.removeListener("complete",h),o.removeListener("abort",b),o.removeListener("request",g),o.req&&o.req.removeListener("finish",h),o.removeListener("end",u),o.removeListener("close",u),o.removeListener("finish",h),o.removeListener("end",p),o.removeListener("error",m),o.removeListener("close",b)}}return Tb=i,Tb}var _b,$5;function tZ(){if($5)return _b;$5=1;var e;function t(v,w,S){return w=n(w),w in v?Object.defineProperty(v,w,{value:S,enumerable:!0,configurable:!0,writable:!0}):v[w]=S,v}function n(v){var w=r(v,"string");return typeof w=="symbol"?w:String(w)}function r(v,w){if(typeof v!="object"||v===null)return v;var S=v[Symbol.toPrimitive];if(S!==void 0){var E=S.call(v,w);if(typeof E!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return(w==="string"?String:Number)(v)}var i=Ib(),o=Symbol("lastResolve"),s=Symbol("lastReject"),a=Symbol("error"),l=Symbol("ended"),c=Symbol("lastPromise"),u=Symbol("handlePromise"),f=Symbol("stream");function h(v,w){return{value:v,done:w}}function d(v){var w=v[o];if(w!==null){var S=v[f].read();S!==null&&(v[c]=null,v[o]=null,v[s]=null,w(h(S,!1)))}}function p(v){process.nextTick(d,v)}function m(v,w){return function(S,E){v.then(function(){if(w[l]){S(h(void 0,!0));return}w[u](S,E)},E)}}var b=Object.getPrototypeOf(function(){}),g=Object.setPrototypeOf((e={get stream(){return this[f]},next:function(){var w=this,S=this[a];if(S!==null)return Promise.reject(S);if(this[l])return Promise.resolve(h(void 0,!0));if(this[f].destroyed)return new Promise(function(D,B){process.nextTick(function(){w[a]?B(w[a]):D(h(void 0,!0))})});var E=this[c],k;if(E)k=new Promise(m(E,this));else{var M=this[f].read();if(M!==null)return Promise.resolve(h(M,!1));k=new Promise(this[u])}return this[c]=k,k}},t(e,Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var w=this;return new Promise(function(S,E){w[f].destroy(null,function(k){if(k){E(k);return}S(h(void 0,!0))})})}),e),b),y=function(w){var S,E=Object.create(g,(S={},t(S,f,{value:w,writable:!0}),t(S,o,{value:null,writable:!0}),t(S,s,{value:null,writable:!0}),t(S,a,{value:null,writable:!0}),t(S,l,{value:w._readableState.endEmitted,writable:!0}),t(S,u,{value:function(M,D){var B=E[f].read();B?(E[c]=null,E[o]=null,E[s]=null,M(h(B,!1))):(E[o]=M,E[s]=D)},writable:!0}),S));return E[c]=null,i(w,function(k){if(k&&k.code!=="ERR_STREAM_PREMATURE_CLOSE"){var M=E[s];M!==null&&(E[c]=null,E[o]=null,E[s]=null,M(k)),E[a]=k;return}var D=E[o];D!==null&&(E[c]=null,E[o]=null,E[s]=null,D(h(void 0,!0))),E[l]=!0}),w.on("readable",p.bind(null,E)),E};return _b=y,_b}var Db,W5;function nZ(){return W5||(W5=1,Db=function(){throw new Error("Readable.from is not available in the browser")}),Db}var Rb,Y5;function Q5(){if(Y5)return Rb;Y5=1,Rb=D;var e;D.ReadableState=M,mb().EventEmitter;var t=function(R,se){return R.listeners(se).length},n=R5(),r=iu().Buffer,i=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(L){return r.from(L)}function s(L){return r.isBuffer(L)||L instanceof i}var a=B5,l;a&&a.debuglog?l=a.debuglog("stream"):l=function(){};var c=KQ(),u=P5(),f=N5(),h=f.getHighWaterMark,d=Ua().codes,p=d.ERR_INVALID_ARG_TYPE,m=d.ERR_STREAM_PUSH_AFTER_EOF,b=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,y,v,w;za()(D,n);var S=u.errorOrDestroy,E=["error","close","destroy","pause","resume"];function k(L,R,se){if(typeof L.prependListener=="function")return L.prependListener(R,se);!L._events||!L._events[R]?L.on(R,se):Array.isArray(L._events[R])?L._events[R].unshift(se):L._events[R]=[se,L._events[R]]}function M(L,R,se){e=e||Ha(),L=L||{},typeof se!="boolean"&&(se=R instanceof e),this.objectMode=!!L.objectMode,se&&(this.objectMode=this.objectMode||!!L.readableObjectMode),this.highWaterMark=h(this,L,"readableHighWaterMark",se),this.buffer=new c,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=L.emitClose!==!1,this.autoDestroy=!!L.autoDestroy,this.destroyed=!1,this.defaultEncoding=L.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,L.encoding&&(y||(y=kb().StringDecoder),this.decoder=new y(L.encoding),this.encoding=L.encoding)}function D(L){if(e=e||Ha(),!(this instanceof D))return new D(L);var R=this instanceof e;this._readableState=new M(L,this,R),this.readable=!0,L&&(typeof L.read=="function"&&(this._read=L.read),typeof L.destroy=="function"&&(this._destroy=L.destroy)),n.call(this)}Object.defineProperty(D.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(R){this._readableState&&(this._readableState.destroyed=R)}}),D.prototype.destroy=u.destroy,D.prototype._undestroy=u.undestroy,D.prototype._destroy=function(L,R){R(L)},D.prototype.push=function(L,R){var se=this._readableState,pe;return se.objectMode?pe=!0:typeof L=="string"&&(R=R||se.defaultEncoding,R!==se.encoding&&(L=r.from(L,R),R=""),pe=!0),B(this,L,R,!1,pe)},D.prototype.unshift=function(L){return B(this,L,null,!0,!1)};function B(L,R,se,pe,Re){l("readableAddChunk",R);var Te=L._readableState;if(R===null)Te.reading=!1,ce(L,Te);else{var Ie;if(Re||(Ie=q(Te,R)),Ie)S(L,Ie);else if(Te.objectMode||R&&R.length>0)if(typeof R!="string"&&!Te.objectMode&&Object.getPrototypeOf(R)!==r.prototype&&(R=o(R)),pe)Te.endEmitted?S(L,new g):I(L,Te,R,!0);else if(Te.ended)S(L,new m);else{if(Te.destroyed)return!1;Te.reading=!1,Te.decoder&&!se?(R=Te.decoder.write(R),Te.objectMode||R.length!==0?I(L,Te,R,!1):me(L,Te)):I(L,Te,R,!1)}else pe||(Te.reading=!1,me(L,Te))}return!Te.ended&&(Te.length<Te.highWaterMark||Te.length===0)}function I(L,R,se,pe){R.flowing&&R.length===0&&!R.sync?(R.awaitDrain=0,L.emit("data",se)):(R.length+=R.objectMode?1:se.length,pe?R.buffer.unshift(se):R.buffer.push(se),R.needReadable&&ae(L)),me(L,R)}function q(L,R){var se;return!s(R)&&typeof R!="string"&&R!==void 0&&!L.objectMode&&(se=new p("chunk",["string","Buffer","Uint8Array"],R)),se}D.prototype.isPaused=function(){return this._readableState.flowing===!1},D.prototype.setEncoding=function(L){y||(y=kb().StringDecoder);var R=new y(L);this._readableState.decoder=R,this._readableState.encoding=this._readableState.decoder.encoding;for(var se=this._readableState.buffer.head,pe="";se!==null;)pe+=R.write(se.data),se=se.next;return this._readableState.buffer.clear(),pe!==""&&this._readableState.buffer.push(pe),this._readableState.length=pe.length,this};var Z=1073741824;function ne(L){return L>=Z?L=Z:(L--,L|=L>>>1,L|=L>>>2,L|=L>>>4,L|=L>>>8,L|=L>>>16,L++),L}function J(L,R){return L<=0||R.length===0&&R.ended?0:R.objectMode?1:L!==L?R.flowing&&R.length?R.buffer.head.data.length:R.length:(L>R.highWaterMark&&(R.highWaterMark=ne(L)),L<=R.length?L:R.ended?R.length:(R.needReadable=!0,0))}D.prototype.read=function(L){l("read",L),L=parseInt(L,10);var R=this._readableState,se=L;if(L!==0&&(R.emittedReadable=!1),L===0&&R.needReadable&&((R.highWaterMark!==0?R.length>=R.highWaterMark:R.length>0)||R.ended))return l("read: emitReadable",R.length,R.ended),R.length===0&&R.ended?re(this):ae(this),null;if(L=J(L,R),L===0&&R.ended)return R.length===0&&re(this),null;var pe=R.needReadable;l("need readable",pe),(R.length===0||R.length-L<R.highWaterMark)&&(pe=!0,l("length less than watermark",pe)),R.ended||R.reading?(pe=!1,l("reading or ended",pe)):pe&&(l("do read"),R.reading=!0,R.sync=!0,R.length===0&&(R.needReadable=!0),this._read(R.highWaterMark),R.sync=!1,R.reading||(L=J(se,R)));var Re;return L>0?Re=X(L,R):Re=null,Re===null?(R.needReadable=R.length<=R.highWaterMark,L=0):(R.length-=L,R.awaitDrain=0),R.length===0&&(R.ended||(R.needReadable=!0),se!==L&&R.ended&&re(this)),Re!==null&&this.emit("data",Re),Re};function ce(L,R){if(l("onEofChunk"),!R.ended){if(R.decoder){var se=R.decoder.end();se&&se.length&&(R.buffer.push(se),R.length+=R.objectMode?1:se.length)}R.ended=!0,R.sync?ae(L):(R.needReadable=!1,R.emittedReadable||(R.emittedReadable=!0,we(L)))}}function ae(L){var R=L._readableState;l("emitReadable",R.needReadable,R.emittedReadable),R.needReadable=!1,R.emittedReadable||(l("emitReadable",R.flowing),R.emittedReadable=!0,process.nextTick(we,L))}function we(L){var R=L._readableState;l("emitReadable_",R.destroyed,R.length,R.ended),!R.destroyed&&(R.length||R.ended)&&(L.emit("readable"),R.emittedReadable=!1),R.needReadable=!R.flowing&&!R.ended&&R.length<=R.highWaterMark,Q(L)}function me(L,R){R.readingMore||(R.readingMore=!0,process.nextTick(U,L,R))}function U(L,R){for(;!R.reading&&!R.ended&&(R.length<R.highWaterMark||R.flowing&&R.length===0);){var se=R.length;if(l("maybeReadMore read 0"),L.read(0),se===R.length)break}R.readingMore=!1}D.prototype._read=function(L){S(this,new b("_read()"))},D.prototype.pipe=function(L,R){var se=this,pe=this._readableState;switch(pe.pipesCount){case 0:pe.pipes=L;break;case 1:pe.pipes=[pe.pipes,L];break;default:pe.pipes.push(L);break}pe.pipesCount+=1,l("pipe count=%d opts=%j",pe.pipesCount,R);var Re=(!R||R.end!==!1)&&L!==process.stdout&&L!==process.stderr,Te=Re?Me:Yt;pe.endEmitted?process.nextTick(Te):se.once("end",Te),L.on("unpipe",Ie);function Ie(F,A){l("onunpipe"),F===se&&A&&A.hasUnpiped===!1&&(A.hasUnpiped=!0,Bt())}function Me(){l("onend"),L.end()}var wt=Ae(se);L.on("drain",wt);var hn=!1;function Bt(){l("cleanup"),L.removeListener("close",Wt),L.removeListener("finish",st),L.removeListener("drain",wt),L.removeListener("error",Nt),L.removeListener("unpipe",Ie),se.removeListener("end",Me),se.removeListener("end",Yt),se.removeListener("data",nt),hn=!0,pe.awaitDrain&&(!L._writableState||L._writableState.needDrain)&&wt()}se.on("data",nt);function nt(F){l("ondata");var A=L.write(F);l("dest.write",A),A===!1&&((pe.pipesCount===1&&pe.pipes===L||pe.pipesCount>1&&ye(pe.pipes,L)!==-1)&&!hn&&(l("false write response, pause",pe.awaitDrain),pe.awaitDrain++),se.pause())}function Nt(F){l("onerror",F),Yt(),L.removeListener("error",Nt),t(L,"error")===0&&S(L,F)}k(L,"error",Nt);function Wt(){L.removeListener("finish",st),Yt()}L.once("close",Wt);function st(){l("onfinish"),L.removeListener("close",Wt),Yt()}L.once("finish",st);function Yt(){l("unpipe"),se.unpipe(L)}return L.emit("pipe",se),pe.flowing||(l("pipe resume"),se.resume()),L};function Ae(L){return function(){var se=L._readableState;l("pipeOnDrain",se.awaitDrain),se.awaitDrain&&se.awaitDrain--,se.awaitDrain===0&&t(L,"data")&&(se.flowing=!0,Q(L))}}D.prototype.unpipe=function(L){var R=this._readableState,se={hasUnpiped:!1};if(R.pipesCount===0)return this;if(R.pipesCount===1)return L&&L!==R.pipes?this:(L||(L=R.pipes),R.pipes=null,R.pipesCount=0,R.flowing=!1,L&&L.emit("unpipe",this,se),this);if(!L){var pe=R.pipes,Re=R.pipesCount;R.pipes=null,R.pipesCount=0,R.flowing=!1;for(var Te=0;Te<Re;Te++)pe[Te].emit("unpipe",this,{hasUnpiped:!1});return this}var Ie=ye(R.pipes,L);return Ie===-1?this:(R.pipes.splice(Ie,1),R.pipesCount-=1,R.pipesCount===1&&(R.pipes=R.pipes[0]),L.emit("unpipe",this,se),this)},D.prototype.on=function(L,R){var se=n.prototype.on.call(this,L,R),pe=this._readableState;return L==="data"?(pe.readableListening=this.listenerCount("readable")>0,pe.flowing!==!1&&this.resume()):L==="readable"&&!pe.endEmitted&&!pe.readableListening&&(pe.readableListening=pe.needReadable=!0,pe.flowing=!1,pe.emittedReadable=!1,l("on readable",pe.length,pe.reading),pe.length?ae(this):pe.reading||process.nextTick(H,this)),se},D.prototype.addListener=D.prototype.on,D.prototype.removeListener=function(L,R){var se=n.prototype.removeListener.call(this,L,R);return L==="readable"&&process.nextTick(Ce,this),se},D.prototype.removeAllListeners=function(L){var R=n.prototype.removeAllListeners.apply(this,arguments);return(L==="readable"||L===void 0)&&process.nextTick(Ce,this),R};function Ce(L){var R=L._readableState;R.readableListening=L.listenerCount("readable")>0,R.resumeScheduled&&!R.paused?R.flowing=!0:L.listenerCount("data")>0&&L.resume()}function H(L){l("readable nexttick read 0"),L.read(0)}D.prototype.resume=function(){var L=this._readableState;return L.flowing||(l("resume"),L.flowing=!L.readableListening,ze(this,L)),L.paused=!1,this};function ze(L,R){R.resumeScheduled||(R.resumeScheduled=!0,process.nextTick(qe,L,R))}function qe(L,R){l("resume",R.reading),R.reading||L.read(0),R.resumeScheduled=!1,L.emit("resume"),Q(L),R.flowing&&!R.reading&&L.read(0)}D.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Q(L){var R=L._readableState;for(l("flow",R.flowing);R.flowing&&L.read()!==null;);}D.prototype.wrap=function(L){var R=this,se=this._readableState,pe=!1;L.on("end",function(){if(l("wrapped end"),se.decoder&&!se.ended){var Ie=se.decoder.end();Ie&&Ie.length&&R.push(Ie)}R.push(null)}),L.on("data",function(Ie){if(l("wrapped data"),se.decoder&&(Ie=se.decoder.write(Ie)),!(se.objectMode&&Ie==null)&&!(!se.objectMode&&(!Ie||!Ie.length))){var Me=R.push(Ie);Me||(pe=!0,L.pause())}});for(var Re in L)this[Re]===void 0&&typeof L[Re]=="function"&&(this[Re]=function(Me){return function(){return L[Me].apply(L,arguments)}}(Re));for(var Te=0;Te<E.length;Te++)L.on(E[Te],this.emit.bind(this,E[Te]));return this._read=function(Ie){l("wrapped _read",Ie),pe&&(pe=!1,L.resume())},this},typeof Symbol=="function"&&(D.prototype[Symbol.asyncIterator]=function(){return v===void 0&&(v=tZ()),v(this)}),Object.defineProperty(D.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(D.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(D.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(R){this._readableState&&(this._readableState.flowing=R)}}),D._fromList=X,Object.defineProperty(D.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function X(L,R){if(R.length===0)return null;var se;return R.objectMode?se=R.buffer.shift():!L||L>=R.length?(R.decoder?se=R.buffer.join(""):R.buffer.length===1?se=R.buffer.first():se=R.buffer.concat(R.length),R.buffer.clear()):se=R.buffer.consume(L,R.decoder),se}function re(L){var R=L._readableState;l("endReadable",R.endEmitted),R.endEmitted||(R.ended=!0,process.nextTick(ie,R,L))}function ie(L,R){if(l("endReadableNT",L.endEmitted,L.length),!L.endEmitted&&L.length===0&&(L.endEmitted=!0,R.readable=!1,R.emit("end"),L.autoDestroy)){var se=R._writableState;(!se||se.autoDestroy&&se.finished)&&R.destroy()}}typeof Symbol=="function"&&(D.from=function(L,R){return w===void 0&&(w=nZ()),w(D,L,R)});function ye(L,R){for(var se=0,pe=L.length;se<pe;se++)if(L[se]===R)return se;return-1}return Rb}var Bb,Z5;function X5(){if(Z5)return Bb;Z5=1,Bb=a;var e=Ua().codes,t=e.ERR_METHOD_NOT_IMPLEMENTED,n=e.ERR_MULTIPLE_CALLBACK,r=e.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=e.ERR_TRANSFORM_WITH_LENGTH_0,o=Ha();za()(a,o);function s(u,f){var h=this._transformState;h.transforming=!1;var d=h.writecb;if(d===null)return this.emit("error",new n);h.writechunk=null,h.writecb=null,f!=null&&this.push(f),d(u);var p=this._readableState;p.reading=!1,(p.needReadable||p.length<p.highWaterMark)&&this._read(p.highWaterMark)}function a(u){if(!(this instanceof a))return new a(u);o.call(this,u),this._transformState={afterTransform:s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,u&&(typeof u.transform=="function"&&(this._transform=u.transform),typeof u.flush=="function"&&(this._flush=u.flush)),this.on("prefinish",l)}function l(){var u=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(f,h){c(u,f,h)}):c(this,null,null)}a.prototype.push=function(u,f){return this._transformState.needTransform=!1,o.prototype.push.call(this,u,f)},a.prototype._transform=function(u,f,h){h(new t("_transform()"))},a.prototype._write=function(u,f,h){var d=this._transformState;if(d.writecb=h,d.writechunk=u,d.writeencoding=f,!d.transforming){var p=this._readableState;(d.needTransform||p.needReadable||p.length<p.highWaterMark)&&this._read(p.highWaterMark)}},a.prototype._read=function(u){var f=this._transformState;f.writechunk!==null&&!f.transforming?(f.transforming=!0,this._transform(f.writechunk,f.writeencoding,f.afterTransform)):f.needTransform=!0},a.prototype._destroy=function(u,f){o.prototype._destroy.call(this,u,function(h){f(h)})};function c(u,f,h){if(f)return u.emit("error",f);if(h!=null&&u.push(h),u._writableState.length)throw new i;if(u._transformState.transforming)throw new r;return u.push(null)}return Bb}var Fb,K5;function rZ(){if(K5)return Fb;K5=1,Fb=t;var e=X5();za()(t,e);function t(n){if(!(this instanceof t))return new t(n);e.call(this,n)}return t.prototype._transform=function(n,r,i){i(null,n)},Fb}var Mb,J5;function iZ(){if(J5)return Mb;J5=1;var e;function t(h){var d=!1;return function(){d||(d=!0,h.apply(void 0,arguments))}}var n=Ua().codes,r=n.ERR_MISSING_ARGS,i=n.ERR_STREAM_DESTROYED;function o(h){if(h)throw h}function s(h){return h.setHeader&&typeof h.abort=="function"}function a(h,d,p,m){m=t(m);var b=!1;h.on("close",function(){b=!0}),e===void 0&&(e=Ib()),e(h,{readable:d,writable:p},function(y){if(y)return m(y);b=!0,m()});var g=!1;return function(y){if(!b&&!g){if(g=!0,s(h))return h.abort();if(typeof h.destroy=="function")return h.destroy();m(y||new i("pipe"))}}}function l(h){h()}function c(h,d){return h.pipe(d)}function u(h){return!h.length||typeof h[h.length-1]!="function"?o:h.pop()}function f(){for(var h=arguments.length,d=new Array(h),p=0;p<h;p++)d[p]=arguments[p];var m=u(d);if(Array.isArray(d[0])&&(d=d[0]),d.length<2)throw new r("streams");var b,g=d.map(function(y,v){var w=v<d.length-1,S=v>0;return a(y,w,S,function(E){b||(b=E),E&&g.forEach(l),!w&&(g.forEach(l),m(b))})});return d.reduce(c)}return Mb=f,Mb}var Pb,ek;function oZ(){if(ek)return Pb;ek=1,Pb=n;var e=mb().EventEmitter,t=za();t(n,e),n.Readable=Q5(),n.Writable=H5(),n.Duplex=Ha(),n.Transform=X5(),n.PassThrough=rZ(),n.finished=Ib(),n.pipeline=iZ(),n.Stream=n;function n(){e.call(this)}return n.prototype.pipe=function(r,i){var o=this;function s(d){r.writable&&r.write(d)===!1&&o.pause&&o.pause()}o.on("data",s);function a(){o.readable&&o.resume&&o.resume()}r.on("drain",a),!r._isStdio&&(!i||i.end!==!1)&&(o.on("end",c),o.on("close",u));var l=!1;function c(){l||(l=!0,r.end())}function u(){l||(l=!0,typeof r.destroy=="function"&&r.destroy())}function f(d){if(h(),e.listenerCount(this,"error")===0)throw d}o.on("error",f),r.on("error",f);function h(){o.removeListener("data",s),r.removeListener("drain",a),o.removeListener("end",c),o.removeListener("close",u),o.removeListener("error",f),r.removeListener("error",f),o.removeListener("end",h),o.removeListener("close",h),r.removeListener("close",h)}return o.on("end",h),o.on("close",h),r.on("close",h),r.emit("pipe",o),r},Pb}var tk=oZ(),sZ=kb();function du(e){return e.replace(/%([0-9A-Fa-f]{2})/g,(t,n)=>String.fromCharCode(parseInt(n,16)))}function nk(e,t){return String(t).replace(e,n=>`%${n.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)}function pu(e){return nk(/[\n;\r\t=%&,\x00-\x1f\x7f-\xff]/g,e)}function li(e){return nk(/[\n\r\t%\x00-\x1f\x7f-\xff]/g,e)}function rk(e){if(!(e&&e.length)||e===".")return{};const t={};return e.replace(/\r?\n$/,"").split(";").forEach(n=>{const r=n.split("=",2);if(!(r[1]&&r[1].length))return;r[0]=r[0].trim();let i=t[r[0].trim()];i||(i=[],t[r[0]]=i),i.push(...r[1].split(",").map(o=>o.trim()).map(du))}),t}function ik(e){const t=e.split(" ").map(r=>r==="."||r===""?null:r);return{seq_id:t[0]&&du(t[0]),source:t[1]&&du(t[1]),type:t[2]&&du(t[2]),start:t[3]===null?null:parseInt(t[3],10),end:t[4]===null?null:parseInt(t[4],10),score:t[5]===null?null:parseFloat(t[5]),strand:t[6],phase:t[7],attributes:t[8]===null?null:rk(t[8])}}function ok(e){const t=/^\s*##\s*(\S+)\s*(.*)/.exec(e);if(!t)return null;const[,n]=t;let[,,r]=t;const i={directive:n};if(r.length&&(r=r.replace(/\r?\n$/,""),i.value=r),n==="sequence-region"){const o=r.split(/\s+/,3);return{...i,seq_id:o[0],start:o[1]&&o[1].replace(/\D/g,""),end:o[2]&&o[2].replace(/\D/g,"")}}else if(n==="genome-build"){const[o,s]=r.split(/\s+/,2);return{...i,source:o,buildName:s}}return i}function sk(e){const t=[];return Object.entries(e).forEach(([n,r])=>{if(!r)return;let i;r.hasOwnProperty("toString")?i=pu(r.toString()):Array.isArray(r)?i=r.map(pu).join(","):i=pu(r),t.push(`${pu(n)}=${i}`)}),t.length?t.join(";"):"."}function aZ(e,t){const n=e.attributes===null||e.attributes===void 0?".":sk(e.attributes),i=`${[e.seq_id===null?".":li(e.seq_id),e.source===null?".":li(e.source),e.type===null?".":li(e.type),e.start===null?".":li(e.start),e.end===null?".":li(e.end),e.score===null?".":li(e.score),e.strand===null?".":li(e.strand),e.phase===null?".":li(e.phase),n].join(" ")}
3927
+ `,y),k===-1)break;const B=m.slice(y,k);E=(s=Na==null?void 0:Na.decode(B))!==null&&s!==void 0?s:B.toString()}if(g){for(;y+p.minv.dataPosition>=g[v++];);v--}const{startCoordinate:M,overlaps:D}=this.checkLine(u,t,f,h,E);if(D)c(E,b[v]*256+(y-g[v])+p.minv.dataPosition+1);else if(M!==void 0&&M>=h)return;y=k+1}}}async getMetadata(t={}){return this.index.getMetadata(t)}async getHeaderBuffer(t={}){const{firstDataLine:n,metaChar:r,maxBlockSize:i}=await this.getMetadata(t);hu(t.signal);const o=((n==null?void 0:n.blockPosition)||0)+i,s=await this._readRegion(0,o,t),a=await io(s);if(r){let l=-1;const c=10,u=r.charCodeAt(0);for(let f=0;f<a.length&&!(f===l+1&&a[f]!==u);f+=1)a[f]===c&&(l=f);return a.subarray(0,l+1)}return a}async getHeader(t={}){return(await this.getHeaderBuffer(t)).toString("utf8")}async getReferenceSequenceNames(t={}){return(await this.getMetadata(t)).refIdToName}checkLine(t,n,r,i,o){const{columnNumbers:s,metaChar:a,coordinateType:l,format:c}=t;if(a&&o.startsWith(a))return{overlaps:!1};let{ref:u,start:f,end:h}=s;u||(u=0),f||(f=0),h||(h=0),c==="VCF"&&(h=8);const d=Math.max(u,f,h);let p=1,m=0,b="",g=-1/0;const y=o.length;for(let v=0;v<y+1;v++)if(o[v]===" "||v===y){if(p===u){if(this.renameRefSeq(o.slice(m,v))!==n)return{overlaps:!1}}else if(p===f){if(g=parseInt(o.slice(m,v),10),l==="1-based-closed"&&(g-=1),g>=i)return{startCoordinate:g,overlaps:!1};if((h===0||h===f)&&g+1<=r)return{startCoordinate:g,overlaps:!1}}else if(c==="VCF"&&p===4)b=o.slice(m,v);else if(p===h&&(c==="VCF"?this._getVcfEnd(g,b,o.slice(m,v)):Number.parseInt(o.slice(m,v),10))<=r)return{overlaps:!1};if(m=v+1,p+=1,p>d)break}return{startCoordinate:g,overlaps:!0}}_getVcfEnd(t,n,r){let i=t+n.length;const o=r.includes("SVTYPE=TRA");if(r[0]!=="."&&!o){let s=";";for(let a=0;a<r.length;a+=1){if(s===";"&&r.slice(a,a+4)==="END="){let l=r.indexOf(";",a);l===-1&&(l=r.length),i=parseInt(r.slice(a+4,l),10);break}s=r[a]}}else if(o)return t+1;return i}async lineCount(t,n={}){return this.index.lineCount(t,n)}async _readRegion(t,n,r={}){const i=ot.Buffer.alloc(n),{bytesRead:o,buffer:s}=await this.filehandle.read(i,0,n,t,r);return s.subarray(0,o)}async readChunk(t,n={}){const r=await this._readRegion(t.minv.blockPosition,t.fetchedSize(),n);return RC(r,t)}}const XQ=Object.freeze(Object.defineProperty({__proto__:null,CSI:Id,TBI:La,TabixIndexedFile:ZQ},Symbol.toStringTag,{value:"Module"}));var _d={exports:{}},I5;function mb(){if(I5)return _d.exports;I5=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(S,E,k){return Function.prototype.apply.call(S,E,k)},n;e&&typeof e.ownKeys=="function"?n=e.ownKeys:Object.getOwnPropertySymbols?n=function(S){return Object.getOwnPropertyNames(S).concat(Object.getOwnPropertySymbols(S))}:n=function(S){return Object.getOwnPropertyNames(S)};function r(w){console&&console.warn&&console.warn(w)}var i=Number.isNaN||function(S){return S!==S};function o(){o.init.call(this)}_d.exports=o,_d.exports.once=g,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(w){if(typeof w!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof w)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(w){if(typeof w!="number"||w<0||i(w))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+w+".");s=w}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(S){if(typeof S!="number"||S<0||i(S))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+S+".");return this._maxListeners=S,this};function l(w){return w._maxListeners===void 0?o.defaultMaxListeners:w._maxListeners}o.prototype.getMaxListeners=function(){return l(this)},o.prototype.emit=function(S){for(var E=[],k=1;k<arguments.length;k++)E.push(arguments[k]);var M=S==="error",D=this._events;if(D!==void 0)M=M&&D.error===void 0;else if(!M)return!1;if(M){var B;if(E.length>0&&(B=E[0]),B instanceof Error)throw B;var I=new Error("Unhandled error."+(B?" ("+B.message+")":""));throw I.context=B,I}var q=D[S];if(q===void 0)return!1;if(typeof q=="function")t(q,this,E);else for(var Z=q.length,te=p(q,Z),k=0;k<Z;++k)t(te[k],this,E);return!0};function c(w,S,E,k){var M,D,B;if(a(E),D=w._events,D===void 0?(D=w._events=Object.create(null),w._eventsCount=0):(D.newListener!==void 0&&(w.emit("newListener",S,E.listener?E.listener:E),D=w._events),B=D[S]),B===void 0)B=D[S]=E,++w._eventsCount;else if(typeof B=="function"?B=D[S]=k?[E,B]:[B,E]:k?B.unshift(E):B.push(E),M=l(w),M>0&&B.length>M&&!B.warned){B.warned=!0;var I=new Error("Possible EventEmitter memory leak detected. "+B.length+" "+String(S)+" listeners added. Use emitter.setMaxListeners() to increase limit");I.name="MaxListenersExceededWarning",I.emitter=w,I.type=S,I.count=B.length,r(I)}return w}o.prototype.addListener=function(S,E){return c(this,S,E,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(S,E){return c(this,S,E,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(w,S,E){var k={fired:!1,wrapFn:void 0,target:w,type:S,listener:E},M=u.bind(k);return M.listener=E,k.wrapFn=M,M}o.prototype.once=function(S,E){return a(E),this.on(S,f(this,S,E)),this},o.prototype.prependOnceListener=function(S,E){return a(E),this.prependListener(S,f(this,S,E)),this},o.prototype.removeListener=function(S,E){var k,M,D,B,I;if(a(E),M=this._events,M===void 0)return this;if(k=M[S],k===void 0)return this;if(k===E||k.listener===E)--this._eventsCount===0?this._events=Object.create(null):(delete M[S],M.removeListener&&this.emit("removeListener",S,k.listener||E));else if(typeof k!="function"){for(D=-1,B=k.length-1;B>=0;B--)if(k[B]===E||k[B].listener===E){I=k[B].listener,D=B;break}if(D<0)return this;D===0?k.shift():m(k,D),k.length===1&&(M[S]=k[0]),M.removeListener!==void 0&&this.emit("removeListener",S,I||E)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(S){var E,k,M;if(k=this._events,k===void 0)return this;if(k.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):k[S]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete k[S]),this;if(arguments.length===0){var D=Object.keys(k),B;for(M=0;M<D.length;++M)B=D[M],B!=="removeListener"&&this.removeAllListeners(B);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(E=k[S],typeof E=="function")this.removeListener(S,E);else if(E!==void 0)for(M=E.length-1;M>=0;M--)this.removeListener(S,E[M]);return this};function h(w,S,E){var k=w._events;if(k===void 0)return[];var M=k[S];return M===void 0?[]:typeof M=="function"?E?[M.listener||M]:[M]:E?b(M):p(M,M.length)}o.prototype.listeners=function(S){return h(this,S,!0)},o.prototype.rawListeners=function(S){return h(this,S,!1)},o.listenerCount=function(w,S){return typeof w.listenerCount=="function"?w.listenerCount(S):d.call(w,S)},o.prototype.listenerCount=d;function d(w){var S=this._events;if(S!==void 0){var E=S[w];if(typeof E=="function")return 1;if(E!==void 0)return E.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function p(w,S){for(var E=new Array(S),k=0;k<S;++k)E[k]=w[k];return E}function m(w,S){for(;S+1<w.length;S++)w[S]=w[S+1];w.pop()}function b(w){for(var S=new Array(w.length),E=0;E<S.length;++E)S[E]=w[E].listener||w[E];return S}function g(w,S){return new Promise(function(E,k){function M(B){w.removeListener(S,D),k(B)}function D(){typeof w.removeListener=="function"&&w.removeListener("error",M),E([].slice.call(arguments))}v(w,S,D,{once:!0}),S!=="error"&&y(w,M,{once:!0})})}function y(w,S,E){typeof w.on=="function"&&v(w,"error",S,E)}function v(w,S,E,k){if(typeof w.on=="function")k.once?w.once(S,E):w.on(S,E);else if(typeof w.addEventListener=="function")w.addEventListener(S,function M(D){k.once&&w.removeEventListener(S,M),E(D)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof w)}return _d.exports}var Dd={exports:{}},_5;function za(){return _5||(_5=1,typeof Object.create=="function"?Dd.exports=function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Dd.exports=function(t,n){if(n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}}),Dd.exports}var bb,D5;function R5(){return D5||(D5=1,bb=mb().EventEmitter),bb}const B5=g$(j$);var yb,F5;function KQ(){if(F5)return yb;F5=1;function e(p,m){var b=Object.keys(p);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(p);m&&(g=g.filter(function(y){return Object.getOwnPropertyDescriptor(p,y).enumerable})),b.push.apply(b,g)}return b}function t(p){for(var m=1;m<arguments.length;m++){var b=arguments[m]!=null?arguments[m]:{};m%2?e(Object(b),!0).forEach(function(g){n(p,g,b[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(b)):e(Object(b)).forEach(function(g){Object.defineProperty(p,g,Object.getOwnPropertyDescriptor(b,g))})}return p}function n(p,m,b){return m=s(m),m in p?Object.defineProperty(p,m,{value:b,enumerable:!0,configurable:!0,writable:!0}):p[m]=b,p}function r(p,m){if(!(p instanceof m))throw new TypeError("Cannot call a class as a function")}function i(p,m){for(var b=0;b<m.length;b++){var g=m[b];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(p,s(g.key),g)}}function o(p,m,b){return m&&i(p.prototype,m),Object.defineProperty(p,"prototype",{writable:!1}),p}function s(p){var m=a(p,"string");return typeof m=="symbol"?m:String(m)}function a(p,m){if(typeof p!="object"||p===null)return p;var b=p[Symbol.toPrimitive];if(b!==void 0){var g=b.call(p,m);if(typeof g!="object")return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(p)}var l=iu(),c=l.Buffer,u=B5,f=u.inspect,h=f&&f.custom||"inspect";function d(p,m,b){c.prototype.copy.call(p,m,b)}return yb=function(){function p(){r(this,p),this.head=null,this.tail=null,this.length=0}return o(p,[{key:"push",value:function(b){var g={data:b,next:null};this.length>0?this.tail.next=g:this.head=g,this.tail=g,++this.length}},{key:"unshift",value:function(b){var g={data:b,next:this.head};this.length===0&&(this.tail=g),this.head=g,++this.length}},{key:"shift",value:function(){if(this.length!==0){var b=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,b}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(b){if(this.length===0)return"";for(var g=this.head,y=""+g.data;g=g.next;)y+=b+g.data;return y}},{key:"concat",value:function(b){if(this.length===0)return c.alloc(0);for(var g=c.allocUnsafe(b>>>0),y=this.head,v=0;y;)d(y.data,g,v),v+=y.data.length,y=y.next;return g}},{key:"consume",value:function(b,g){var y;return b<this.head.data.length?(y=this.head.data.slice(0,b),this.head.data=this.head.data.slice(b)):b===this.head.data.length?y=this.shift():y=g?this._getString(b):this._getBuffer(b),y}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(b){var g=this.head,y=1,v=g.data;for(b-=v.length;g=g.next;){var w=g.data,S=b>w.length?w.length:b;if(S===w.length?v+=w:v+=w.slice(0,b),b-=S,b===0){S===w.length?(++y,g.next?this.head=g.next:this.head=this.tail=null):(this.head=g,g.data=w.slice(S));break}++y}return this.length-=y,v}},{key:"_getBuffer",value:function(b){var g=c.allocUnsafe(b),y=this.head,v=1;for(y.data.copy(g),b-=y.data.length;y=y.next;){var w=y.data,S=b>w.length?w.length:b;if(w.copy(g,g.length-b,0,S),b-=S,b===0){S===w.length?(++v,y.next?this.head=y.next:this.head=this.tail=null):(this.head=y,y.data=w.slice(S));break}++v}return this.length-=v,g}},{key:h,value:function(b,g){return f(this,t(t({},g),{},{depth:0,customInspect:!1}))}}]),p}(),yb}var wb,M5;function P5(){if(M5)return wb;M5=1;function e(s,a){var l=this,c=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return c||u?(a?a(s):s&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(i,this,s)):process.nextTick(i,this,s)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(s||null,function(f){!a&&f?l._writableState?l._writableState.errorEmitted?process.nextTick(n,l):(l._writableState.errorEmitted=!0,process.nextTick(t,l,f)):process.nextTick(t,l,f):a?(process.nextTick(n,l),a(f)):process.nextTick(n,l)}),this)}function t(s,a){i(s,a),n(s)}function n(s){s._writableState&&!s._writableState.emitClose||s._readableState&&!s._readableState.emitClose||s.emit("close")}function r(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function i(s,a){s.emit("error",a)}function o(s,a){var l=s._readableState,c=s._writableState;l&&l.autoDestroy||c&&c.autoDestroy?s.destroy(a):s.emit("error",a)}return wb={destroy:e,undestroy:r,errorOrDestroy:o},wb}var vb={},O5;function Ua(){if(O5)return vb;O5=1;function e(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,a.__proto__=l}var t={};function n(a,l,c){c||(c=Error);function u(h,d,p){return typeof l=="string"?l:l(h,d,p)}var f=function(h){e(d,h);function d(p,m,b){return h.call(this,u(p,m,b))||this}return d}(c);f.prototype.name=c.name,f.prototype.code=a,t[a]=f}function r(a,l){if(Array.isArray(a)){var c=a.length;return a=a.map(function(u){return String(u)}),c>2?"one of ".concat(l," ").concat(a.slice(0,c-1).join(", "),", or ")+a[c-1]:c===2?"one of ".concat(l," ").concat(a[0]," or ").concat(a[1]):"of ".concat(l," ").concat(a[0])}else return"of ".concat(l," ").concat(String(a))}function i(a,l,c){return a.substr(0,l.length)===l}function o(a,l,c){return(c===void 0||c>a.length)&&(c=a.length),a.substring(c-l.length,c)===l}function s(a,l,c){return typeof c!="number"&&(c=0),c+l.length>a.length?!1:a.indexOf(l,c)!==-1}return n("ERR_INVALID_OPT_VALUE",function(a,l){return'The value "'+l+'" is invalid for option "'+a+'"'},TypeError),n("ERR_INVALID_ARG_TYPE",function(a,l,c){var u;typeof l=="string"&&i(l,"not ")?(u="must not be",l=l.replace(/^not /,"")):u="must be";var f;if(o(a," argument"))f="The ".concat(a," ").concat(u," ").concat(r(l,"type"));else{var h=s(a,".")?"property":"argument";f='The "'.concat(a,'" ').concat(h," ").concat(u," ").concat(r(l,"type"))}return f+=". Received type ".concat(typeof c),f},TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",function(a){return"The "+a+" method is not implemented"}),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",function(a){return"Cannot call "+a+" after a stream was destroyed"}),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",function(a){return"Unknown encoding: "+a},TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),vb.codes=t,vb}var xb,L5;function N5(){if(L5)return xb;L5=1;var e=Ua().codes.ERR_INVALID_OPT_VALUE;function t(r,i,o){return r.highWaterMark!=null?r.highWaterMark:i?r[o]:null}function n(r,i,o,s){var a=t(i,s,o);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var l=s?o:"highWaterMark";throw new e(l,a)}return Math.floor(a)}return r.objectMode?16:16*1024}return xb={getHighWaterMark:n},xb}var Ab,z5;function JQ(){if(z5)return Ab;z5=1,Ab=e;function e(n,r){if(t("noDeprecation"))return n;var i=!1;function o(){if(!i){if(t("throwDeprecation"))throw new Error(r);t("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return n.apply(this,arguments)}return o}function t(n){try{if(!globalThis.localStorage)return!1}catch{return!1}var r=globalThis.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return Ab}var Eb,U5;function H5(){if(U5)return Eb;U5=1,Eb=M;function e(Q){var X=this;this.next=null,this.entry=null,this.finish=function(){qe(X,Q)}}var t;M.WritableState=E;var n={deprecate:JQ()},r=R5(),i=iu().Buffer,o=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function s(Q){return i.from(Q)}function a(Q){return i.isBuffer(Q)||Q instanceof o}var l=P5(),c=N5(),u=c.getHighWaterMark,f=Ua().codes,h=f.ERR_INVALID_ARG_TYPE,d=f.ERR_METHOD_NOT_IMPLEMENTED,p=f.ERR_MULTIPLE_CALLBACK,m=f.ERR_STREAM_CANNOT_PIPE,b=f.ERR_STREAM_DESTROYED,g=f.ERR_STREAM_NULL_VALUES,y=f.ERR_STREAM_WRITE_AFTER_END,v=f.ERR_UNKNOWN_ENCODING,w=l.errorOrDestroy;za()(M,r);function S(){}function E(Q,X,re){t=t||Ha(),Q=Q||{},typeof re!="boolean"&&(re=X instanceof t),this.objectMode=!!Q.objectMode,re&&(this.objectMode=this.objectMode||!!Q.writableObjectMode),this.highWaterMark=u(this,Q,"writableHighWaterMark",re),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var ie=Q.decodeStrings===!1;this.decodeStrings=!ie,this.defaultEncoding=Q.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ye){ce(X,ye)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Q.emitClose!==!1,this.autoDestroy=!!Q.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}E.prototype.getBuffer=function(){for(var X=this.bufferedRequest,re=[];X;)re.push(X),X=X.next;return re},function(){try{Object.defineProperty(E.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var k;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(k=Function.prototype[Symbol.hasInstance],Object.defineProperty(M,Symbol.hasInstance,{value:function(X){return k.call(this,X)?!0:this!==M?!1:X&&X._writableState instanceof E}})):k=function(X){return X instanceof this};function M(Q){t=t||Ha();var X=this instanceof t;if(!X&&!k.call(M,this))return new M(Q);this._writableState=new E(Q,this,X),this.writable=!0,Q&&(typeof Q.write=="function"&&(this._write=Q.write),typeof Q.writev=="function"&&(this._writev=Q.writev),typeof Q.destroy=="function"&&(this._destroy=Q.destroy),typeof Q.final=="function"&&(this._final=Q.final)),r.call(this)}M.prototype.pipe=function(){w(this,new m)};function D(Q,X){var re=new y;w(Q,re),process.nextTick(X,re)}function B(Q,X,re,ie){var ye;return re===null?ye=new g:typeof re!="string"&&!X.objectMode&&(ye=new h("chunk",["string","Buffer"],re)),ye?(w(Q,ye),process.nextTick(ie,ye),!1):!0}M.prototype.write=function(Q,X,re){var ie=this._writableState,ye=!1,L=!ie.objectMode&&a(Q);return L&&!i.isBuffer(Q)&&(Q=s(Q)),typeof X=="function"&&(re=X,X=null),L?X="buffer":X||(X=ie.defaultEncoding),typeof re!="function"&&(re=S),ie.ending?D(this,re):(L||B(this,ie,Q,re))&&(ie.pendingcb++,ye=q(this,ie,L,Q,X,re)),ye},M.prototype.cork=function(){this._writableState.corked++},M.prototype.uncork=function(){var Q=this._writableState;Q.corked&&(Q.corked--,!Q.writing&&!Q.corked&&!Q.bufferProcessing&&Q.bufferedRequest&&me(this,Q))},M.prototype.setDefaultEncoding=function(X){if(typeof X=="string"&&(X=X.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((X+"").toLowerCase())>-1))throw new v(X);return this._writableState.defaultEncoding=X,this},Object.defineProperty(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function I(Q,X,re){return!Q.objectMode&&Q.decodeStrings!==!1&&typeof X=="string"&&(X=i.from(X,re)),X}Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function q(Q,X,re,ie,ye,L){if(!re){var R=I(X,ie,ye);ie!==R&&(re=!0,ye="buffer",ie=R)}var se=X.objectMode?1:ie.length;X.length+=se;var pe=X.length<X.highWaterMark;if(pe||(X.needDrain=!0),X.writing||X.corked){var Re=X.lastBufferedRequest;X.lastBufferedRequest={chunk:ie,encoding:ye,isBuf:re,callback:L,next:null},Re?Re.next=X.lastBufferedRequest:X.bufferedRequest=X.lastBufferedRequest,X.bufferedRequestCount+=1}else Z(Q,X,!1,se,ie,ye,L);return pe}function Z(Q,X,re,ie,ye,L,R){X.writelen=ie,X.writecb=R,X.writing=!0,X.sync=!0,X.destroyed?X.onwrite(new b("write")):re?Q._writev(ye,X.onwrite):Q._write(ye,L,X.onwrite),X.sync=!1}function te(Q,X,re,ie,ye){--X.pendingcb,re?(process.nextTick(ye,ie),process.nextTick(H,Q,X),Q._writableState.errorEmitted=!0,w(Q,ie)):(ye(ie),Q._writableState.errorEmitted=!0,w(Q,ie),H(Q,X))}function J(Q){Q.writing=!1,Q.writecb=null,Q.length-=Q.writelen,Q.writelen=0}function ce(Q,X){var re=Q._writableState,ie=re.sync,ye=re.writecb;if(typeof ye!="function")throw new p;if(J(re),X)te(Q,re,ie,X,ye);else{var L=U(re)||Q.destroyed;!L&&!re.corked&&!re.bufferProcessing&&re.bufferedRequest&&me(Q,re),ie?process.nextTick(ae,Q,re,L,ye):ae(Q,re,L,ye)}}function ae(Q,X,re,ie){re||we(Q,X),X.pendingcb--,ie(),H(Q,X)}function we(Q,X){X.length===0&&X.needDrain&&(X.needDrain=!1,Q.emit("drain"))}function me(Q,X){X.bufferProcessing=!0;var re=X.bufferedRequest;if(Q._writev&&re&&re.next){var ie=X.bufferedRequestCount,ye=new Array(ie),L=X.corkedRequestsFree;L.entry=re;for(var R=0,se=!0;re;)ye[R]=re,re.isBuf||(se=!1),re=re.next,R+=1;ye.allBuffers=se,Z(Q,X,!0,X.length,ye,"",L.finish),X.pendingcb++,X.lastBufferedRequest=null,L.next?(X.corkedRequestsFree=L.next,L.next=null):X.corkedRequestsFree=new e(X),X.bufferedRequestCount=0}else{for(;re;){var pe=re.chunk,Re=re.encoding,Te=re.callback,Ie=X.objectMode?1:pe.length;if(Z(Q,X,!1,Ie,pe,Re,Te),re=re.next,X.bufferedRequestCount--,X.writing)break}re===null&&(X.lastBufferedRequest=null)}X.bufferedRequest=re,X.bufferProcessing=!1}M.prototype._write=function(Q,X,re){re(new d("_write()"))},M.prototype._writev=null,M.prototype.end=function(Q,X,re){var ie=this._writableState;return typeof Q=="function"?(re=Q,Q=null,X=null):typeof X=="function"&&(re=X,X=null),Q!=null&&this.write(Q,X),ie.corked&&(ie.corked=1,this.uncork()),ie.ending||ze(this,ie,re),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function U(Q){return Q.ending&&Q.length===0&&Q.bufferedRequest===null&&!Q.finished&&!Q.writing}function Ae(Q,X){Q._final(function(re){X.pendingcb--,re&&w(Q,re),X.prefinished=!0,Q.emit("prefinish"),H(Q,X)})}function Ce(Q,X){!X.prefinished&&!X.finalCalled&&(typeof Q._final=="function"&&!X.destroyed?(X.pendingcb++,X.finalCalled=!0,process.nextTick(Ae,Q,X)):(X.prefinished=!0,Q.emit("prefinish")))}function H(Q,X){var re=U(X);if(re&&(Ce(Q,X),X.pendingcb===0&&(X.finished=!0,Q.emit("finish"),X.autoDestroy))){var ie=Q._readableState;(!ie||ie.autoDestroy&&ie.endEmitted)&&Q.destroy()}return re}function ze(Q,X,re){X.ending=!0,H(Q,X),re&&(X.finished?process.nextTick(re):Q.once("finish",re)),X.ended=!0,Q.writable=!1}function qe(Q,X,re){var ie=Q.entry;for(Q.entry=null;ie;){var ye=ie.callback;X.pendingcb--,ye(re),ie=ie.next}X.corkedRequestsFree.next=Q}return Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(X){this._writableState&&(this._writableState.destroyed=X)}}),M.prototype.destroy=l.destroy,M.prototype._undestroy=l.undestroy,M.prototype._destroy=function(Q,X){X(Q)},Eb}var Sb,G5;function Ha(){if(G5)return Sb;G5=1;var e=Object.keys||function(c){var u=[];for(var f in c)u.push(f);return u};Sb=s;var t=Q5(),n=H5();za()(s,t);for(var r=e(n.prototype),i=0;i<r.length;i++){var o=r[i];s.prototype[o]||(s.prototype[o]=n.prototype[o])}function s(c){if(!(this instanceof s))return new s(c);t.call(this,c),n.call(this,c),this.allowHalfOpen=!0,c&&(c.readable===!1&&(this.readable=!1),c.writable===!1&&(this.writable=!1),c.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",a)))}Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function a(){this._writableState.ended||process.nextTick(l,this)}function l(c){c.end()}return Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(u){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=u,this._writableState.destroyed=u)}}),Sb}var Cb={},Rd={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var j5;function eZ(){return j5||(j5=1,function(e,t){var n=iu(),r=n.Buffer;function i(s,a){for(var l in s)a[l]=s[l]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=o);function o(s,a,l){return r(s,a,l)}o.prototype=Object.create(r.prototype),i(r,o),o.from=function(s,a,l){if(typeof s=="number")throw new TypeError("Argument must not be a number");return r(s,a,l)},o.alloc=function(s,a,l){if(typeof s!="number")throw new TypeError("Argument must be a number");var c=r(s);return a!==void 0?typeof l=="string"?c.fill(a,l):c.fill(a):c.fill(0),c},o.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return r(s)},o.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(s)}}(Rd,Rd.exports)),Rd.exports}var V5;function kb(){if(V5)return Cb;V5=1;var e=eZ().Buffer,t=e.isEncoding||function(g){switch(g=""+g,g&&g.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(g){if(!g)return"utf8";for(var y;;)switch(g){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return g;default:if(y)return;g=(""+g).toLowerCase(),y=!0}}function r(g){var y=n(g);if(typeof y!="string"&&(e.isEncoding===t||!t(g)))throw new Error("Unknown encoding: "+g);return y||g}Cb.StringDecoder=i;function i(g){this.encoding=r(g);var y;switch(this.encoding){case"utf16le":this.text=f,this.end=h,y=4;break;case"utf8":this.fillLast=l,y=4;break;case"base64":this.text=d,this.end=p,y=3;break;default:this.write=m,this.end=b;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(y)}i.prototype.write=function(g){if(g.length===0)return"";var y,v;if(this.lastNeed){if(y=this.fillLast(g),y===void 0)return"";v=this.lastNeed,this.lastNeed=0}else v=0;return v<g.length?y?y+this.text(g,v):this.text(g,v):y||""},i.prototype.end=u,i.prototype.text=c,i.prototype.fillLast=function(g){if(this.lastNeed<=g.length)return g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,g.length),this.lastNeed-=g.length};function o(g){return g<=127?0:g>>5===6?2:g>>4===14?3:g>>3===30?4:g>>6===2?-1:-2}function s(g,y,v){var w=y.length-1;if(w<v)return 0;var S=o(y[w]);return S>=0?(S>0&&(g.lastNeed=S-1),S):--w<v||S===-2?0:(S=o(y[w]),S>=0?(S>0&&(g.lastNeed=S-2),S):--w<v||S===-2?0:(S=o(y[w]),S>=0?(S>0&&(S===2?S=0:g.lastNeed=S-3),S):0))}function a(g,y,v){if((y[0]&192)!==128)return g.lastNeed=0,"�";if(g.lastNeed>1&&y.length>1){if((y[1]&192)!==128)return g.lastNeed=1,"�";if(g.lastNeed>2&&y.length>2&&(y[2]&192)!==128)return g.lastNeed=2,"�"}}function l(g){var y=this.lastTotal-this.lastNeed,v=a(this,g);if(v!==void 0)return v;if(this.lastNeed<=g.length)return g.copy(this.lastChar,y,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,y,0,g.length),this.lastNeed-=g.length}function c(g,y){var v=s(this,g,y);if(!this.lastNeed)return g.toString("utf8",y);this.lastTotal=v;var w=g.length-(v-this.lastNeed);return g.copy(this.lastChar,0,w),g.toString("utf8",y,w)}function u(g){var y=g&&g.length?this.write(g):"";return this.lastNeed?y+"�":y}function f(g,y){if((g.length-y)%2===0){var v=g.toString("utf16le",y);if(v){var w=v.charCodeAt(v.length-1);if(w>=55296&&w<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1],v.slice(0,-1)}return v}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=g[g.length-1],g.toString("utf16le",y,g.length-1)}function h(g){var y=g&&g.length?this.write(g):"";if(this.lastNeed){var v=this.lastTotal-this.lastNeed;return y+this.lastChar.toString("utf16le",0,v)}return y}function d(g,y){var v=(g.length-y)%3;return v===0?g.toString("base64",y):(this.lastNeed=3-v,this.lastTotal=3,v===1?this.lastChar[0]=g[g.length-1]:(this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1]),g.toString("base64",y,g.length-v))}function p(g){var y=g&&g.length?this.write(g):"";return this.lastNeed?y+this.lastChar.toString("base64",0,3-this.lastNeed):y}function m(g){return g.toString(this.encoding)}function b(g){return g&&g.length?this.write(g):""}return Cb}var Tb,q5;function Ib(){if(q5)return Tb;q5=1;var e=Ua().codes.ERR_STREAM_PREMATURE_CLOSE;function t(o){var s=!1;return function(){if(!s){s=!0;for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];o.apply(this,l)}}}function n(){}function r(o){return o.setHeader&&typeof o.abort=="function"}function i(o,s,a){if(typeof s=="function")return i(o,null,s);s||(s={}),a=t(a||n);var l=s.readable||s.readable!==!1&&o.readable,c=s.writable||s.writable!==!1&&o.writable,u=function(){o.writable||h()},f=o._writableState&&o._writableState.finished,h=function(){c=!1,f=!0,l||a.call(o)},d=o._readableState&&o._readableState.endEmitted,p=function(){l=!1,d=!0,c||a.call(o)},m=function(v){a.call(o,v)},b=function(){var v;if(l&&!d)return(!o._readableState||!o._readableState.ended)&&(v=new e),a.call(o,v);if(c&&!f)return(!o._writableState||!o._writableState.ended)&&(v=new e),a.call(o,v)},g=function(){o.req.on("finish",h)};return r(o)?(o.on("complete",h),o.on("abort",b),o.req?g():o.on("request",g)):c&&!o._writableState&&(o.on("end",u),o.on("close",u)),o.on("end",p),o.on("finish",h),s.error!==!1&&o.on("error",m),o.on("close",b),function(){o.removeListener("complete",h),o.removeListener("abort",b),o.removeListener("request",g),o.req&&o.req.removeListener("finish",h),o.removeListener("end",u),o.removeListener("close",u),o.removeListener("finish",h),o.removeListener("end",p),o.removeListener("error",m),o.removeListener("close",b)}}return Tb=i,Tb}var _b,$5;function tZ(){if($5)return _b;$5=1;var e;function t(v,w,S){return w=n(w),w in v?Object.defineProperty(v,w,{value:S,enumerable:!0,configurable:!0,writable:!0}):v[w]=S,v}function n(v){var w=r(v,"string");return typeof w=="symbol"?w:String(w)}function r(v,w){if(typeof v!="object"||v===null)return v;var S=v[Symbol.toPrimitive];if(S!==void 0){var E=S.call(v,w);if(typeof E!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return(w==="string"?String:Number)(v)}var i=Ib(),o=Symbol("lastResolve"),s=Symbol("lastReject"),a=Symbol("error"),l=Symbol("ended"),c=Symbol("lastPromise"),u=Symbol("handlePromise"),f=Symbol("stream");function h(v,w){return{value:v,done:w}}function d(v){var w=v[o];if(w!==null){var S=v[f].read();S!==null&&(v[c]=null,v[o]=null,v[s]=null,w(h(S,!1)))}}function p(v){process.nextTick(d,v)}function m(v,w){return function(S,E){v.then(function(){if(w[l]){S(h(void 0,!0));return}w[u](S,E)},E)}}var b=Object.getPrototypeOf(function(){}),g=Object.setPrototypeOf((e={get stream(){return this[f]},next:function(){var w=this,S=this[a];if(S!==null)return Promise.reject(S);if(this[l])return Promise.resolve(h(void 0,!0));if(this[f].destroyed)return new Promise(function(D,B){process.nextTick(function(){w[a]?B(w[a]):D(h(void 0,!0))})});var E=this[c],k;if(E)k=new Promise(m(E,this));else{var M=this[f].read();if(M!==null)return Promise.resolve(h(M,!1));k=new Promise(this[u])}return this[c]=k,k}},t(e,Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var w=this;return new Promise(function(S,E){w[f].destroy(null,function(k){if(k){E(k);return}S(h(void 0,!0))})})}),e),b),y=function(w){var S,E=Object.create(g,(S={},t(S,f,{value:w,writable:!0}),t(S,o,{value:null,writable:!0}),t(S,s,{value:null,writable:!0}),t(S,a,{value:null,writable:!0}),t(S,l,{value:w._readableState.endEmitted,writable:!0}),t(S,u,{value:function(M,D){var B=E[f].read();B?(E[c]=null,E[o]=null,E[s]=null,M(h(B,!1))):(E[o]=M,E[s]=D)},writable:!0}),S));return E[c]=null,i(w,function(k){if(k&&k.code!=="ERR_STREAM_PREMATURE_CLOSE"){var M=E[s];M!==null&&(E[c]=null,E[o]=null,E[s]=null,M(k)),E[a]=k;return}var D=E[o];D!==null&&(E[c]=null,E[o]=null,E[s]=null,D(h(void 0,!0))),E[l]=!0}),w.on("readable",p.bind(null,E)),E};return _b=y,_b}var Db,W5;function nZ(){return W5||(W5=1,Db=function(){throw new Error("Readable.from is not available in the browser")}),Db}var Rb,Y5;function Q5(){if(Y5)return Rb;Y5=1,Rb=D;var e;D.ReadableState=M,mb().EventEmitter;var t=function(R,se){return R.listeners(se).length},n=R5(),r=iu().Buffer,i=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(L){return r.from(L)}function s(L){return r.isBuffer(L)||L instanceof i}var a=B5,l;a&&a.debuglog?l=a.debuglog("stream"):l=function(){};var c=KQ(),u=P5(),f=N5(),h=f.getHighWaterMark,d=Ua().codes,p=d.ERR_INVALID_ARG_TYPE,m=d.ERR_STREAM_PUSH_AFTER_EOF,b=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,y,v,w;za()(D,n);var S=u.errorOrDestroy,E=["error","close","destroy","pause","resume"];function k(L,R,se){if(typeof L.prependListener=="function")return L.prependListener(R,se);!L._events||!L._events[R]?L.on(R,se):Array.isArray(L._events[R])?L._events[R].unshift(se):L._events[R]=[se,L._events[R]]}function M(L,R,se){e=e||Ha(),L=L||{},typeof se!="boolean"&&(se=R instanceof e),this.objectMode=!!L.objectMode,se&&(this.objectMode=this.objectMode||!!L.readableObjectMode),this.highWaterMark=h(this,L,"readableHighWaterMark",se),this.buffer=new c,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=L.emitClose!==!1,this.autoDestroy=!!L.autoDestroy,this.destroyed=!1,this.defaultEncoding=L.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,L.encoding&&(y||(y=kb().StringDecoder),this.decoder=new y(L.encoding),this.encoding=L.encoding)}function D(L){if(e=e||Ha(),!(this instanceof D))return new D(L);var R=this instanceof e;this._readableState=new M(L,this,R),this.readable=!0,L&&(typeof L.read=="function"&&(this._read=L.read),typeof L.destroy=="function"&&(this._destroy=L.destroy)),n.call(this)}Object.defineProperty(D.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(R){this._readableState&&(this._readableState.destroyed=R)}}),D.prototype.destroy=u.destroy,D.prototype._undestroy=u.undestroy,D.prototype._destroy=function(L,R){R(L)},D.prototype.push=function(L,R){var se=this._readableState,pe;return se.objectMode?pe=!0:typeof L=="string"&&(R=R||se.defaultEncoding,R!==se.encoding&&(L=r.from(L,R),R=""),pe=!0),B(this,L,R,!1,pe)},D.prototype.unshift=function(L){return B(this,L,null,!0,!1)};function B(L,R,se,pe,Re){l("readableAddChunk",R);var Te=L._readableState;if(R===null)Te.reading=!1,ce(L,Te);else{var Ie;if(Re||(Ie=q(Te,R)),Ie)S(L,Ie);else if(Te.objectMode||R&&R.length>0)if(typeof R!="string"&&!Te.objectMode&&Object.getPrototypeOf(R)!==r.prototype&&(R=o(R)),pe)Te.endEmitted?S(L,new g):I(L,Te,R,!0);else if(Te.ended)S(L,new m);else{if(Te.destroyed)return!1;Te.reading=!1,Te.decoder&&!se?(R=Te.decoder.write(R),Te.objectMode||R.length!==0?I(L,Te,R,!1):me(L,Te)):I(L,Te,R,!1)}else pe||(Te.reading=!1,me(L,Te))}return!Te.ended&&(Te.length<Te.highWaterMark||Te.length===0)}function I(L,R,se,pe){R.flowing&&R.length===0&&!R.sync?(R.awaitDrain=0,L.emit("data",se)):(R.length+=R.objectMode?1:se.length,pe?R.buffer.unshift(se):R.buffer.push(se),R.needReadable&&ae(L)),me(L,R)}function q(L,R){var se;return!s(R)&&typeof R!="string"&&R!==void 0&&!L.objectMode&&(se=new p("chunk",["string","Buffer","Uint8Array"],R)),se}D.prototype.isPaused=function(){return this._readableState.flowing===!1},D.prototype.setEncoding=function(L){y||(y=kb().StringDecoder);var R=new y(L);this._readableState.decoder=R,this._readableState.encoding=this._readableState.decoder.encoding;for(var se=this._readableState.buffer.head,pe="";se!==null;)pe+=R.write(se.data),se=se.next;return this._readableState.buffer.clear(),pe!==""&&this._readableState.buffer.push(pe),this._readableState.length=pe.length,this};var Z=1073741824;function te(L){return L>=Z?L=Z:(L--,L|=L>>>1,L|=L>>>2,L|=L>>>4,L|=L>>>8,L|=L>>>16,L++),L}function J(L,R){return L<=0||R.length===0&&R.ended?0:R.objectMode?1:L!==L?R.flowing&&R.length?R.buffer.head.data.length:R.length:(L>R.highWaterMark&&(R.highWaterMark=te(L)),L<=R.length?L:R.ended?R.length:(R.needReadable=!0,0))}D.prototype.read=function(L){l("read",L),L=parseInt(L,10);var R=this._readableState,se=L;if(L!==0&&(R.emittedReadable=!1),L===0&&R.needReadable&&((R.highWaterMark!==0?R.length>=R.highWaterMark:R.length>0)||R.ended))return l("read: emitReadable",R.length,R.ended),R.length===0&&R.ended?re(this):ae(this),null;if(L=J(L,R),L===0&&R.ended)return R.length===0&&re(this),null;var pe=R.needReadable;l("need readable",pe),(R.length===0||R.length-L<R.highWaterMark)&&(pe=!0,l("length less than watermark",pe)),R.ended||R.reading?(pe=!1,l("reading or ended",pe)):pe&&(l("do read"),R.reading=!0,R.sync=!0,R.length===0&&(R.needReadable=!0),this._read(R.highWaterMark),R.sync=!1,R.reading||(L=J(se,R)));var Re;return L>0?Re=X(L,R):Re=null,Re===null?(R.needReadable=R.length<=R.highWaterMark,L=0):(R.length-=L,R.awaitDrain=0),R.length===0&&(R.ended||(R.needReadable=!0),se!==L&&R.ended&&re(this)),Re!==null&&this.emit("data",Re),Re};function ce(L,R){if(l("onEofChunk"),!R.ended){if(R.decoder){var se=R.decoder.end();se&&se.length&&(R.buffer.push(se),R.length+=R.objectMode?1:se.length)}R.ended=!0,R.sync?ae(L):(R.needReadable=!1,R.emittedReadable||(R.emittedReadable=!0,we(L)))}}function ae(L){var R=L._readableState;l("emitReadable",R.needReadable,R.emittedReadable),R.needReadable=!1,R.emittedReadable||(l("emitReadable",R.flowing),R.emittedReadable=!0,process.nextTick(we,L))}function we(L){var R=L._readableState;l("emitReadable_",R.destroyed,R.length,R.ended),!R.destroyed&&(R.length||R.ended)&&(L.emit("readable"),R.emittedReadable=!1),R.needReadable=!R.flowing&&!R.ended&&R.length<=R.highWaterMark,Q(L)}function me(L,R){R.readingMore||(R.readingMore=!0,process.nextTick(U,L,R))}function U(L,R){for(;!R.reading&&!R.ended&&(R.length<R.highWaterMark||R.flowing&&R.length===0);){var se=R.length;if(l("maybeReadMore read 0"),L.read(0),se===R.length)break}R.readingMore=!1}D.prototype._read=function(L){S(this,new b("_read()"))},D.prototype.pipe=function(L,R){var se=this,pe=this._readableState;switch(pe.pipesCount){case 0:pe.pipes=L;break;case 1:pe.pipes=[pe.pipes,L];break;default:pe.pipes.push(L);break}pe.pipesCount+=1,l("pipe count=%d opts=%j",pe.pipesCount,R);var Re=(!R||R.end!==!1)&&L!==process.stdout&&L!==process.stderr,Te=Re?Me:Yt;pe.endEmitted?process.nextTick(Te):se.once("end",Te),L.on("unpipe",Ie);function Ie(F,A){l("onunpipe"),F===se&&A&&A.hasUnpiped===!1&&(A.hasUnpiped=!0,Bt())}function Me(){l("onend"),L.end()}var wt=Ae(se);L.on("drain",wt);var hn=!1;function Bt(){l("cleanup"),L.removeListener("close",Wt),L.removeListener("finish",st),L.removeListener("drain",wt),L.removeListener("error",Nt),L.removeListener("unpipe",Ie),se.removeListener("end",Me),se.removeListener("end",Yt),se.removeListener("data",nt),hn=!0,pe.awaitDrain&&(!L._writableState||L._writableState.needDrain)&&wt()}se.on("data",nt);function nt(F){l("ondata");var A=L.write(F);l("dest.write",A),A===!1&&((pe.pipesCount===1&&pe.pipes===L||pe.pipesCount>1&&ye(pe.pipes,L)!==-1)&&!hn&&(l("false write response, pause",pe.awaitDrain),pe.awaitDrain++),se.pause())}function Nt(F){l("onerror",F),Yt(),L.removeListener("error",Nt),t(L,"error")===0&&S(L,F)}k(L,"error",Nt);function Wt(){L.removeListener("finish",st),Yt()}L.once("close",Wt);function st(){l("onfinish"),L.removeListener("close",Wt),Yt()}L.once("finish",st);function Yt(){l("unpipe"),se.unpipe(L)}return L.emit("pipe",se),pe.flowing||(l("pipe resume"),se.resume()),L};function Ae(L){return function(){var se=L._readableState;l("pipeOnDrain",se.awaitDrain),se.awaitDrain&&se.awaitDrain--,se.awaitDrain===0&&t(L,"data")&&(se.flowing=!0,Q(L))}}D.prototype.unpipe=function(L){var R=this._readableState,se={hasUnpiped:!1};if(R.pipesCount===0)return this;if(R.pipesCount===1)return L&&L!==R.pipes?this:(L||(L=R.pipes),R.pipes=null,R.pipesCount=0,R.flowing=!1,L&&L.emit("unpipe",this,se),this);if(!L){var pe=R.pipes,Re=R.pipesCount;R.pipes=null,R.pipesCount=0,R.flowing=!1;for(var Te=0;Te<Re;Te++)pe[Te].emit("unpipe",this,{hasUnpiped:!1});return this}var Ie=ye(R.pipes,L);return Ie===-1?this:(R.pipes.splice(Ie,1),R.pipesCount-=1,R.pipesCount===1&&(R.pipes=R.pipes[0]),L.emit("unpipe",this,se),this)},D.prototype.on=function(L,R){var se=n.prototype.on.call(this,L,R),pe=this._readableState;return L==="data"?(pe.readableListening=this.listenerCount("readable")>0,pe.flowing!==!1&&this.resume()):L==="readable"&&!pe.endEmitted&&!pe.readableListening&&(pe.readableListening=pe.needReadable=!0,pe.flowing=!1,pe.emittedReadable=!1,l("on readable",pe.length,pe.reading),pe.length?ae(this):pe.reading||process.nextTick(H,this)),se},D.prototype.addListener=D.prototype.on,D.prototype.removeListener=function(L,R){var se=n.prototype.removeListener.call(this,L,R);return L==="readable"&&process.nextTick(Ce,this),se},D.prototype.removeAllListeners=function(L){var R=n.prototype.removeAllListeners.apply(this,arguments);return(L==="readable"||L===void 0)&&process.nextTick(Ce,this),R};function Ce(L){var R=L._readableState;R.readableListening=L.listenerCount("readable")>0,R.resumeScheduled&&!R.paused?R.flowing=!0:L.listenerCount("data")>0&&L.resume()}function H(L){l("readable nexttick read 0"),L.read(0)}D.prototype.resume=function(){var L=this._readableState;return L.flowing||(l("resume"),L.flowing=!L.readableListening,ze(this,L)),L.paused=!1,this};function ze(L,R){R.resumeScheduled||(R.resumeScheduled=!0,process.nextTick(qe,L,R))}function qe(L,R){l("resume",R.reading),R.reading||L.read(0),R.resumeScheduled=!1,L.emit("resume"),Q(L),R.flowing&&!R.reading&&L.read(0)}D.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Q(L){var R=L._readableState;for(l("flow",R.flowing);R.flowing&&L.read()!==null;);}D.prototype.wrap=function(L){var R=this,se=this._readableState,pe=!1;L.on("end",function(){if(l("wrapped end"),se.decoder&&!se.ended){var Ie=se.decoder.end();Ie&&Ie.length&&R.push(Ie)}R.push(null)}),L.on("data",function(Ie){if(l("wrapped data"),se.decoder&&(Ie=se.decoder.write(Ie)),!(se.objectMode&&Ie==null)&&!(!se.objectMode&&(!Ie||!Ie.length))){var Me=R.push(Ie);Me||(pe=!0,L.pause())}});for(var Re in L)this[Re]===void 0&&typeof L[Re]=="function"&&(this[Re]=function(Me){return function(){return L[Me].apply(L,arguments)}}(Re));for(var Te=0;Te<E.length;Te++)L.on(E[Te],this.emit.bind(this,E[Te]));return this._read=function(Ie){l("wrapped _read",Ie),pe&&(pe=!1,L.resume())},this},typeof Symbol=="function"&&(D.prototype[Symbol.asyncIterator]=function(){return v===void 0&&(v=tZ()),v(this)}),Object.defineProperty(D.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(D.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(D.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(R){this._readableState&&(this._readableState.flowing=R)}}),D._fromList=X,Object.defineProperty(D.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function X(L,R){if(R.length===0)return null;var se;return R.objectMode?se=R.buffer.shift():!L||L>=R.length?(R.decoder?se=R.buffer.join(""):R.buffer.length===1?se=R.buffer.first():se=R.buffer.concat(R.length),R.buffer.clear()):se=R.buffer.consume(L,R.decoder),se}function re(L){var R=L._readableState;l("endReadable",R.endEmitted),R.endEmitted||(R.ended=!0,process.nextTick(ie,R,L))}function ie(L,R){if(l("endReadableNT",L.endEmitted,L.length),!L.endEmitted&&L.length===0&&(L.endEmitted=!0,R.readable=!1,R.emit("end"),L.autoDestroy)){var se=R._writableState;(!se||se.autoDestroy&&se.finished)&&R.destroy()}}typeof Symbol=="function"&&(D.from=function(L,R){return w===void 0&&(w=nZ()),w(D,L,R)});function ye(L,R){for(var se=0,pe=L.length;se<pe;se++)if(L[se]===R)return se;return-1}return Rb}var Bb,Z5;function X5(){if(Z5)return Bb;Z5=1,Bb=a;var e=Ua().codes,t=e.ERR_METHOD_NOT_IMPLEMENTED,n=e.ERR_MULTIPLE_CALLBACK,r=e.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=e.ERR_TRANSFORM_WITH_LENGTH_0,o=Ha();za()(a,o);function s(u,f){var h=this._transformState;h.transforming=!1;var d=h.writecb;if(d===null)return this.emit("error",new n);h.writechunk=null,h.writecb=null,f!=null&&this.push(f),d(u);var p=this._readableState;p.reading=!1,(p.needReadable||p.length<p.highWaterMark)&&this._read(p.highWaterMark)}function a(u){if(!(this instanceof a))return new a(u);o.call(this,u),this._transformState={afterTransform:s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,u&&(typeof u.transform=="function"&&(this._transform=u.transform),typeof u.flush=="function"&&(this._flush=u.flush)),this.on("prefinish",l)}function l(){var u=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(f,h){c(u,f,h)}):c(this,null,null)}a.prototype.push=function(u,f){return this._transformState.needTransform=!1,o.prototype.push.call(this,u,f)},a.prototype._transform=function(u,f,h){h(new t("_transform()"))},a.prototype._write=function(u,f,h){var d=this._transformState;if(d.writecb=h,d.writechunk=u,d.writeencoding=f,!d.transforming){var p=this._readableState;(d.needTransform||p.needReadable||p.length<p.highWaterMark)&&this._read(p.highWaterMark)}},a.prototype._read=function(u){var f=this._transformState;f.writechunk!==null&&!f.transforming?(f.transforming=!0,this._transform(f.writechunk,f.writeencoding,f.afterTransform)):f.needTransform=!0},a.prototype._destroy=function(u,f){o.prototype._destroy.call(this,u,function(h){f(h)})};function c(u,f,h){if(f)return u.emit("error",f);if(h!=null&&u.push(h),u._writableState.length)throw new i;if(u._transformState.transforming)throw new r;return u.push(null)}return Bb}var Fb,K5;function rZ(){if(K5)return Fb;K5=1,Fb=t;var e=X5();za()(t,e);function t(n){if(!(this instanceof t))return new t(n);e.call(this,n)}return t.prototype._transform=function(n,r,i){i(null,n)},Fb}var Mb,J5;function iZ(){if(J5)return Mb;J5=1;var e;function t(h){var d=!1;return function(){d||(d=!0,h.apply(void 0,arguments))}}var n=Ua().codes,r=n.ERR_MISSING_ARGS,i=n.ERR_STREAM_DESTROYED;function o(h){if(h)throw h}function s(h){return h.setHeader&&typeof h.abort=="function"}function a(h,d,p,m){m=t(m);var b=!1;h.on("close",function(){b=!0}),e===void 0&&(e=Ib()),e(h,{readable:d,writable:p},function(y){if(y)return m(y);b=!0,m()});var g=!1;return function(y){if(!b&&!g){if(g=!0,s(h))return h.abort();if(typeof h.destroy=="function")return h.destroy();m(y||new i("pipe"))}}}function l(h){h()}function c(h,d){return h.pipe(d)}function u(h){return!h.length||typeof h[h.length-1]!="function"?o:h.pop()}function f(){for(var h=arguments.length,d=new Array(h),p=0;p<h;p++)d[p]=arguments[p];var m=u(d);if(Array.isArray(d[0])&&(d=d[0]),d.length<2)throw new r("streams");var b,g=d.map(function(y,v){var w=v<d.length-1,S=v>0;return a(y,w,S,function(E){b||(b=E),E&&g.forEach(l),!w&&(g.forEach(l),m(b))})});return d.reduce(c)}return Mb=f,Mb}var Pb,ek;function oZ(){if(ek)return Pb;ek=1,Pb=n;var e=mb().EventEmitter,t=za();t(n,e),n.Readable=Q5(),n.Writable=H5(),n.Duplex=Ha(),n.Transform=X5(),n.PassThrough=rZ(),n.finished=Ib(),n.pipeline=iZ(),n.Stream=n;function n(){e.call(this)}return n.prototype.pipe=function(r,i){var o=this;function s(d){r.writable&&r.write(d)===!1&&o.pause&&o.pause()}o.on("data",s);function a(){o.readable&&o.resume&&o.resume()}r.on("drain",a),!r._isStdio&&(!i||i.end!==!1)&&(o.on("end",c),o.on("close",u));var l=!1;function c(){l||(l=!0,r.end())}function u(){l||(l=!0,typeof r.destroy=="function"&&r.destroy())}function f(d){if(h(),e.listenerCount(this,"error")===0)throw d}o.on("error",f),r.on("error",f);function h(){o.removeListener("data",s),r.removeListener("drain",a),o.removeListener("end",c),o.removeListener("close",u),o.removeListener("error",f),r.removeListener("error",f),o.removeListener("end",h),o.removeListener("close",h),r.removeListener("close",h)}return o.on("end",h),o.on("close",h),r.on("close",h),r.emit("pipe",o),r},Pb}var tk=oZ(),sZ=kb();function du(e){return e.replace(/%([0-9A-Fa-f]{2})/g,(t,n)=>String.fromCharCode(parseInt(n,16)))}function nk(e,t){return String(t).replace(e,n=>`%${n.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)}function pu(e){return nk(/[\n;\r\t=%&,\x00-\x1f\x7f-\xff]/g,e)}function li(e){return nk(/[\n\r\t%\x00-\x1f\x7f-\xff]/g,e)}function rk(e){if(!(e&&e.length)||e===".")return{};const t={};return e.replace(/\r?\n$/,"").split(";").forEach(n=>{const r=n.split("=",2);if(!(r[1]&&r[1].length))return;r[0]=r[0].trim();let i=t[r[0].trim()];i||(i=[],t[r[0]]=i),i.push(...r[1].split(",").map(o=>o.trim()).map(du))}),t}function ik(e){const t=e.split(" ").map(r=>r==="."||r===""?null:r);return{seq_id:t[0]&&du(t[0]),source:t[1]&&du(t[1]),type:t[2]&&du(t[2]),start:t[3]===null?null:parseInt(t[3],10),end:t[4]===null?null:parseInt(t[4],10),score:t[5]===null?null:parseFloat(t[5]),strand:t[6],phase:t[7],attributes:t[8]===null?null:rk(t[8])}}function ok(e){const t=/^\s*##\s*(\S+)\s*(.*)/.exec(e);if(!t)return null;const[,n]=t;let[,,r]=t;const i={directive:n};if(r.length&&(r=r.replace(/\r?\n$/,""),i.value=r),n==="sequence-region"){const o=r.split(/\s+/,3);return{...i,seq_id:o[0],start:o[1]&&o[1].replace(/\D/g,""),end:o[2]&&o[2].replace(/\D/g,"")}}else if(n==="genome-build"){const[o,s]=r.split(/\s+/,2);return{...i,source:o,buildName:s}}return i}function sk(e){const t=[];return Object.entries(e).forEach(([n,r])=>{if(!r)return;let i;r.hasOwnProperty("toString")?i=pu(r.toString()):Array.isArray(r)?i=r.map(pu).join(","):i=pu(r),t.push(`${pu(n)}=${i}`)}),t.length?t.join(";"):"."}function aZ(e,t){const n=e.attributes===null||e.attributes===void 0?".":sk(e.attributes),i=`${[e.seq_id===null?".":li(e.seq_id),e.source===null?".":li(e.source),e.type===null?".":li(e.type),e.start===null?".":li(e.start),e.end===null?".":li(e.end),e.score===null?".":li(e.score),e.strand===null?".":li(e.strand),e.phase===null?".":li(e.phase),n].join(" ")}
3928
3928
  `;return t[i]?"":(t[i]=!0,i)}function Bd(e,t){if(Array.isArray(e))return e.map(r=>Bd(r,t)).join("");const n=[aZ(e,t)];return lZ(e)&&n.push(...e.child_features.map(r=>Bd(r,t)),...e.derived_features.map(r=>Bd(r,t))),n.join("")}function ak(e){return Bd(e,{})}function lk(e){let t=`##${e.directive}`;return e.value&&(t+=` ${e.value}`),t+=`
3929
3929
  `,t}function ck(e){return`# ${e.comment}
3930
3930
  `}function Ob(e){return`>${e.id}${e.description?` ${e.description}`:""}