(()=>{var yB=Object.create;var lA=Object.defineProperty;var _B=Object.getOwnPropertyDescriptor;var CB=Object.getOwnPropertyNames;var DB=Object.getPrototypeOf,FB=Object.prototype.hasOwnProperty;var go=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var he=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var SB=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of CB(t))!FB.call(e,i)&&i!==r&&lA(e,i,{get:()=>t[i],enumerable:!(n=_B(t,i))||n.enumerable});return e};var yn=(e,t,r)=>(r=e!=null?yB(DB(e)):{},SB(t||!e||!e.__esModule?lA(r,"default",{value:e,enumerable:!0}):r,e));var $A=he(f0=>{"use strict";f0.byteLength=UB;f0.toByteArray=HB;f0.fromByteArray=VB;var Ts=[],Wi=[],LB=typeof Uint8Array<"u"?Uint8Array:Array,R1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(mo=0,BA=R1.length;mo0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function UB(e){var t=PA(e),r=t[0],n=t[1];return(r+n)*3/4-n}function jB(e,t,r){return(t+r)*3/4-r}function HB(e){var t,r=PA(e),n=r[0],i=r[1],a=new LB(jB(e,n,i)),s=0,u=i>0?n-4:n,c;for(c=0;c>16&255,a[s++]=t>>8&255,a[s++]=t&255;return i===2&&(t=Wi[e.charCodeAt(c)]<<2|Wi[e.charCodeAt(c+1)]>>4,a[s++]=t&255),i===1&&(t=Wi[e.charCodeAt(c)]<<10|Wi[e.charCodeAt(c+1)]<<4|Wi[e.charCodeAt(c+2)]>>2,a[s++]=t>>8&255,a[s++]=t&255),a}function MB(e){return Ts[e>>18&63]+Ts[e>>12&63]+Ts[e>>6&63]+Ts[e&63]}function qB(e,t,r){for(var n,i=[],a=t;au?u:s+a));return n===1?(t=e[r-1],i.push(Ts[t>>2]+Ts[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Ts[t>>10]+Ts[t>>4&63]+Ts[t<<2&63]+"=")),i.join("")}});var xA=he(T1=>{T1.read=function(e,t,r,n,i){var a,s,u=i*8-n-1,c=(1<>1,d=-7,v=r?i-1:0,p=r?-1:1,h=e[t+v];for(v+=p,a=h&(1<<-d)-1,h>>=-d,d+=u;d>0;a=a*256+e[t+v],v+=p,d-=8);for(s=a&(1<<-d)-1,a>>=-d,d+=n;d>0;s=s*256+e[t+v],v+=p,d-=8);if(a===0)a=1-f;else{if(a===c)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,n),a=a-f}return(h?-1:1)*s*Math.pow(2,a-n)};T1.write=function(e,t,r,n,i,a){var s,u,c,f=a*8-i-1,d=(1<>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,w=n?1:-1,m=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+v>=1?t+=p/c:t+=p*Math.pow(2,1-v),t*c>=2&&(s++,c/=2),s+v>=d?(u=0,s=d):s+v>=1?(u=(t*c-1)*Math.pow(2,i),s=s+v):(u=t*Math.pow(2,v-1)*Math.pow(2,i),s=0));i>=8;e[r+h]=u&255,h+=w,u/=256,i-=8);for(s=s<0;e[r+h]=s&255,h+=w,s/=256,f-=8);e[r+h-w]|=m*128}});var p0=he(_c=>{"use strict";var O1=$A(),bc=xA(),RA=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;_c.Buffer=de;_c.SlowBuffer=XB;_c.INSPECT_MAX_BYTES=50;var h0=2147483647;_c.kMaxLength=h0;de.TYPED_ARRAY_SUPPORT=KB();!de.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 KB(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(de.prototype,"parent",{enumerable:!0,get:function(){if(de.isBuffer(this))return this.buffer}});Object.defineProperty(de.prototype,"offset",{enumerable:!0,get:function(){if(de.isBuffer(this))return this.byteOffset}});function xa(e){if(e>h0)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,de.prototype),t}function de(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return U1(e)}return NA(e,t,r)}de.poolSize=8192;function NA(e,t,r){if(typeof e=="string")return GB(e,t);if(ArrayBuffer.isView(e))return YB(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Os(e,ArrayBuffer)||e&&Os(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Os(e,SharedArrayBuffer)||e&&Os(e.buffer,SharedArrayBuffer)))return N1(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return de.from(n,t,r);let i=WB(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return de.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}de.from=function(e,t,r){return NA(e,t,r)};Object.setPrototypeOf(de.prototype,Uint8Array.prototype);Object.setPrototypeOf(de,Uint8Array);function LA(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function zB(e,t,r){return LA(e),e<=0?xa(e):t!==void 0?typeof r=="string"?xa(e).fill(t,r):xa(e).fill(t):xa(e)}de.alloc=function(e,t,r){return zB(e,t,r)};function U1(e){return LA(e),xa(e<0?0:j1(e)|0)}de.allocUnsafe=function(e){return U1(e)};de.allocUnsafeSlow=function(e){return U1(e)};function GB(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!de.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=UA(e,t)|0,n=xa(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function k1(e){let t=e.length<0?0:j1(e.length)|0,r=xa(t);for(let n=0;n=h0)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+h0.toString(16)+" bytes");return e|0}function XB(e){return+e!=e&&(e=0),de.alloc(+e)}de.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==de.prototype};de.compare=function(t,r){if(Os(t,Uint8Array)&&(t=de.from(t,t.offset,t.byteLength)),Os(r,Uint8Array)&&(r=de.from(r,r.offset,r.byteLength)),!de.isBuffer(t)||!de.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let n=t.length,i=r.length;for(let a=0,s=Math.min(n,i);ai.length?(de.isBuffer(s)||(s=de.from(s)),s.copy(i,a)):Uint8Array.prototype.set.call(i,s,a);else if(de.isBuffer(s))s.copy(i,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=s.length}return i};function UA(e,t){if(de.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Os(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return L1(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return YA(e).length;default:if(i)return n?-1:L1(e).length;t=(""+t).toLowerCase(),i=!0}}de.byteLength=UA;function ZB(e,t,r){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return u9(this,t,r);case"utf8":case"utf-8":return HA(this,t,r);case"ascii":return s9(this,t,r);case"latin1":case"binary":return a9(this,t,r);case"base64":return n9(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o9(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}de.prototype._isBuffer=!0;function vo(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}de.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(t+=" ... "),""};RA&&(de.prototype[RA]=de.prototype.inspect);de.prototype.compare=function(t,r,n,i,a){if(Os(t,Uint8Array)&&(t=de.from(t,t.offset,t.byteLength)),!de.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),r<0||n>t.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&r>=n)return 0;if(i>=a)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,a>>>=0,this===t)return 0;let s=a-i,u=n-r,c=Math.min(s,u),f=this.slice(i,a),d=t.slice(r,n);for(let v=0;v2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,M1(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof t=="string"&&(t=de.from(t,n)),de.isBuffer(t))return t.length===0?-1:TA(e,t,r,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):TA(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function TA(e,t,r,n,i){let a=1,s=e.length,u=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(d,v){return a===1?d[v]:d.readUInt16BE(v*a)}let f;if(i){let d=-1;for(f=r;fs&&(r=s-u),f=r;f>=0;f--){let d=!0;for(let v=0;vi&&(n=i)):n=i;let a=t.length;n>a/2&&(n=a/2);let s;for(s=0;s>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let a=this.length-r;if((n===void 0||n>a)&&(n=a),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return JB(this,t,r,n);case"utf8":case"utf-8":return QB(this,t,r,n);case"ascii":case"latin1":case"binary":return e9(this,t,r,n);case"base64":return t9(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r9(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};de.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function n9(e,t,r){return t===0&&r===e.length?O1.fromByteArray(e):O1.fromByteArray(e.slice(t,r))}function HA(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i239?4:a>223?3:a>191?2:1;if(i+u<=r){let c,f,d,v;switch(u){case 1:a<128&&(s=a);break;case 2:c=e[i+1],(c&192)===128&&(v=(a&31)<<6|c&63,v>127&&(s=v));break;case 3:c=e[i+1],f=e[i+2],(c&192)===128&&(f&192)===128&&(v=(a&15)<<12|(c&63)<<6|f&63,v>2047&&(v<55296||v>57343)&&(s=v));break;case 4:c=e[i+1],f=e[i+2],d=e[i+3],(c&192)===128&&(f&192)===128&&(d&192)===128&&(v=(a&15)<<18|(c&63)<<12|(f&63)<<6|d&63,v>65535&&v<1114112&&(s=v))}}s===null?(s=65533,u=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=u}return i9(n)}var OA=4096;function i9(e){let t=e.length;if(t<=OA)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nn)&&(r=n);let i="";for(let a=t;an&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}de.prototype.readUintLE=de.prototype.readUIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||Yr(t,r,this.length);let i=this[t],a=1,s=0;for(;++s>>0,r=r>>>0,n||Yr(t,r,this.length);let i=this[t+--r],a=1;for(;r>0&&(a*=256);)i+=this[t+--r]*a;return i};de.prototype.readUint8=de.prototype.readUInt8=function(t,r){return t=t>>>0,r||Yr(t,1,this.length),this[t]};de.prototype.readUint16LE=de.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||Yr(t,2,this.length),this[t]|this[t+1]<<8};de.prototype.readUint16BE=de.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||Yr(t,2,this.length),this[t]<<8|this[t+1]};de.prototype.readUint32LE=de.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||Yr(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};de.prototype.readUint32BE=de.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||Yr(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};de.prototype.readBigUInt64LE=_u(function(t){t=t>>>0,yc(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Xl(t,this.length-8);let i=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,a=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(a)<>>0,yc(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Xl(t,this.length-8);let i=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],a=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||Yr(t,r,this.length);let i=this[t],a=1,s=0;for(;++s=a&&(i-=Math.pow(2,8*r)),i};de.prototype.readIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||Yr(t,r,this.length);let i=r,a=1,s=this[t+--i];for(;i>0&&(a*=256);)s+=this[t+--i]*a;return a*=128,s>=a&&(s-=Math.pow(2,8*r)),s};de.prototype.readInt8=function(t,r){return t=t>>>0,r||Yr(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};de.prototype.readInt16LE=function(t,r){t=t>>>0,r||Yr(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};de.prototype.readInt16BE=function(t,r){t=t>>>0,r||Yr(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};de.prototype.readInt32LE=function(t,r){return t=t>>>0,r||Yr(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};de.prototype.readInt32BE=function(t,r){return t=t>>>0,r||Yr(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};de.prototype.readBigInt64LE=_u(function(t){t=t>>>0,yc(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Xl(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<>>0,yc(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Xl(t,this.length-8);let i=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<>>0,r||Yr(t,4,this.length),bc.read(this,t,!0,23,4)};de.prototype.readFloatBE=function(t,r){return t=t>>>0,r||Yr(t,4,this.length),bc.read(this,t,!1,23,4)};de.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||Yr(t,8,this.length),bc.read(this,t,!0,52,8)};de.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||Yr(t,8,this.length),bc.read(this,t,!1,52,8)};function ci(e,t,r,n,i,a){if(!de.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}de.prototype.writeUintLE=de.prototype.writeUIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;ci(this,t,r,n,u,0)}let a=1,s=0;for(this[r]=t&255;++s>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;ci(this,t,r,n,u,0)}let a=n-1,s=1;for(this[r+a]=t&255;--a>=0&&(s*=256);)this[r+a]=t/s&255;return r+n};de.prototype.writeUint8=de.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||ci(this,t,r,1,255,0),this[r]=t&255,r+1};de.prototype.writeUint16LE=de.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||ci(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};de.prototype.writeUint16BE=de.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||ci(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};de.prototype.writeUint32LE=de.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||ci(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};de.prototype.writeUint32BE=de.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||ci(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function MA(e,t,r,n,i){GA(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,r}function qA(e,t,r,n,i){GA(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r+7]=a,a=a>>8,e[r+6]=a,a=a>>8,e[r+5]=a,a=a>>8,e[r+4]=a;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s=s>>8,e[r+2]=s,s=s>>8,e[r+1]=s,s=s>>8,e[r]=s,r+8}de.prototype.writeBigUInt64LE=_u(function(t,r=0){return MA(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});de.prototype.writeBigUInt64BE=_u(function(t,r=0){return qA(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});de.prototype.writeIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let c=Math.pow(2,8*n-1);ci(this,t,r,n,c-1,-c)}let a=0,s=1,u=0;for(this[r]=t&255;++a>0)-u&255;return r+n};de.prototype.writeIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let c=Math.pow(2,8*n-1);ci(this,t,r,n,c-1,-c)}let a=n-1,s=1,u=0;for(this[r+a]=t&255;--a>=0&&(s*=256);)t<0&&u===0&&this[r+a+1]!==0&&(u=1),this[r+a]=(t/s>>0)-u&255;return r+n};de.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||ci(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};de.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||ci(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};de.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||ci(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};de.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||ci(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};de.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||ci(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};de.prototype.writeBigInt64LE=_u(function(t,r=0){return MA(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});de.prototype.writeBigInt64BE=_u(function(t,r=0){return qA(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function VA(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function KA(e,t,r,n,i){return t=+t,r=r>>>0,i||VA(e,t,r,4,34028234663852886e22,-34028234663852886e22),bc.write(e,t,r,n,23,4),r+4}de.prototype.writeFloatLE=function(t,r,n){return KA(this,t,r,!0,n)};de.prototype.writeFloatBE=function(t,r,n){return KA(this,t,r,!1,n)};function zA(e,t,r,n,i){return t=+t,r=r>>>0,i||VA(e,t,r,8,17976931348623157e292,-17976931348623157e292),bc.write(e,t,r,n,52,8),r+8}de.prototype.writeDoubleLE=function(t,r,n){return zA(this,t,r,!0,n)};de.prototype.writeDoubleBE=function(t,r,n){return zA(this,t,r,!1,n)};de.prototype.copy=function(t,r,n,i){if(!de.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let a;if(typeof t=="number")for(a=r;a2**32?i=kA(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=kA(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function kA(e){let t="",r=e.length,n=e[0]==="-"?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function c9(e,t,r){yc(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&Xl(t,e.length-(r+1))}function GA(e,t,r,n,i,a){if(e>r||e3?t===0||t===BigInt(0)?u=`>= 0${s} and < 2${s} ** ${(a+1)*8}${s}`:u=`>= -(2${s} ** ${(a+1)*8-1}${s}) and < 2 ** ${(a+1)*8-1}${s}`:u=`>= ${t}${s} and <= ${r}${s}`,new Ec.ERR_OUT_OF_RANGE("value",u,e)}c9(n,i,a)}function yc(e,t){if(typeof e!="number")throw new Ec.ERR_INVALID_ARG_TYPE(t,"number",e)}function Xl(e,t,r){throw Math.floor(e)!==e?(yc(e,r),new Ec.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new Ec.ERR_BUFFER_OUT_OF_BOUNDS:new Ec.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var l9=/[^+/0-9A-Za-z-_]/g;function f9(e){if(e=e.split("=")[0],e=e.trim().replace(l9,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function L1(e,t){t=t||1/0;let r,n=e.length,i=null,a=[];for(let s=0;s55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(s+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return a}function h9(e){let t=[];for(let r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function YA(e){return O1.toByteArray(f9(e))}function d0(e,t,r,n){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Os(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function M1(e){return e!==e}var p9=function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function _u(e){return typeof BigInt>"u"?g9:e}function g9(){throw new Error("BigInt not supported")}});var wE=he(_e=>{var Zl={};Zl.userAgent=!1;var Cc={},m9="11.1.0",v9="jsrsasign(all) 11.1.0 (2024-02-01) (c) 2010-2023 Kenji Urushima | kjur.github.io/jsrsasign/license";var Se=Se||function(e,t){var r={},n=r.lib={},i=n.Base=function(){function h(){}return{extend:function(w){h.prototype=this;var m=new h;return w&&m.mixIn(w),m.hasOwnProperty("init")||(m.init=function(){m.$super.init.apply(this,arguments)}),m.init.prototype=m,m.$super=this,m},create:function(){var w=this.extend();return w.init.apply(w,arguments),w},init:function(){},mixIn:function(w){for(var m in w)w.hasOwnProperty(m)&&(this[m]=w[m]);w.hasOwnProperty("toString")&&(this.toString=w.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),a=n.WordArray=i.extend({init:function(h,w){h=this.words=h||[],w!=t?this.sigBytes=w:this.sigBytes=h.length*4},toString:function(h){return(h||u).stringify(this)},concat:function(h){var w=this.words,m=h.words,y=this.sigBytes,g=h.sigBytes;if(this.clamp(),y%4)for(var b=0;b>>2]>>>24-b%4*8&255;w[y+b>>>2]|=D<<24-(y+b)%4*8}else for(var b=0;b>>2]=m[b>>>2];return this.sigBytes+=g,this},clamp:function(){var h=this.words,w=this.sigBytes;h[w>>>2]&=4294967295<<32-w%4*8,h.length=e.ceil(w/4)},clone:function(){var h=i.clone.call(this);return h.words=this.words.slice(0),h},random:function(h){for(var w=[],m=0;m>>2]>>>24-g%4*8&255;y.push((b>>>4).toString(16)),y.push((b&15).toString(16))}return y.join("")},parse:function(h){for(var w=h.length,m=[],y=0;y>>3]|=parseInt(h.substr(y,2),16)<<24-y%8*4;return new a.init(m,w/2)}},c=s.Latin1={stringify:function(h){for(var w=h.words,m=h.sigBytes,y=[],g=0;g>>2]>>>24-g%4*8&255;y.push(String.fromCharCode(b))}return y.join("")},parse:function(h){for(var w=h.length,m=[],y=0;y>>2]|=(h.charCodeAt(y)&255)<<24-y%4*8;return new a.init(m,w)}},f=s.Utf8={stringify:function(h){try{return decodeURIComponent(escape(c.stringify(h)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(h){return c.parse(unescape(encodeURIComponent(h)))}},d=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(h){typeof h=="string"&&(h=f.parse(h)),this._data.concat(h),this._nDataBytes+=h.sigBytes},_process:function(h){var w=this._data,m=w.words,y=w.sigBytes,g=this.blockSize,b=g*4,D=y/b;h?D=e.ceil(D):D=e.max((D|0)-this._minBufferSize,0);var C=D*g,F=e.min(C*4,y);if(C){for(var L=0;L>>2]&255}},t.BlockCipher=u.extend({cfg:u.cfg.extend({mode:v,padding:f}),reset:function(){u.reset.call(this);var y=this.cfg,m=y.iv,y=y.mode;if(this._xformMode==this._ENC_XFORM_MODE)var g=y.createEncryptor;else g=y.createDecryptor,this._minBufferSize=1;this._mode=g.call(y,this,m&&m.words)},_doProcessBlock:function(m,y){this._mode.processBlock(m,y)},_doFinalize:function(){var m=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){m.pad(this._data,this.blockSize);var y=this._process(!0)}else y=this._process(!0),m.unpad(y);return y},blockSize:4});var d=t.CipherParams=r.extend({init:function(m){this.mixIn(m)},toString:function(m){return(m||this.formatter).stringify(this)}}),v=(h.format={}).OpenSSL={stringify:function(m){var y=m.ciphertext;return m=m.salt,(m?n.create([1398893684,1701076831]).concat(m).concat(y):y).toString(a)},parse:function(m){m=a.parse(m);var y=m.words;if(y[0]==1398893684&&y[1]==1701076831){var g=n.create(y.slice(2,4));y.splice(0,4),m.sigBytes-=16}return d.create({ciphertext:m,salt:g})}},p=t.SerializableCipher=r.extend({cfg:r.extend({format:v}),encrypt:function(m,y,g,b){b=this.cfg.extend(b);var D=m.createEncryptor(g,b);return y=D.finalize(y),D=D.cfg,d.create({ciphertext:y,key:g,iv:D.iv,algorithm:m,mode:D.mode,padding:D.padding,blockSize:m.blockSize,formatter:b.format})},decrypt:function(m,y,g,b){return b=this.cfg.extend(b),y=this._parse(y,b.format),m.createDecryptor(g,b).finalize(y.ciphertext)},_parse:function(m,y){return typeof m=="string"?y.parse(m,this):m}}),h=(h.kdf={}).OpenSSL={execute:function(m,y,g,b){return b||(b=n.random(8)),m=s.create({keySize:y+g}).compute(m,b),g=n.create(m.words.slice(y),4*g),m.sigBytes=4*y,d.create({key:m,iv:g,salt:b})}},w=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:h}),encrypt:function(m,y,g,b){return b=this.cfg.extend(b),g=b.kdf.execute(g,m.keySize,m.ivSize),b.iv=g.iv,m=p.encrypt.call(this,m,y,g.key,b),m.mixIn(g),m},decrypt:function(m,y,g,b){return b=this.cfg.extend(b),y=this._parse(y,b.format),g=b.kdf.execute(g,m.keySize,m.ivSize,y.salt),b.iv=g.iv,p.decrypt.call(this,m,y,g.key,b)}})}();(function(){for(var e=Se,t=e.lib.BlockCipher,L=e.algo,r=[],n=[],i=[],a=[],s=[],u=[],c=[],f=[],d=[],v=[],p=[],h=0;256>h;h++)p[h]=128>h?h<<1:h<<1^283;for(var w=0,m=0,h=0;256>h;h++){var y=m^m<<1^m<<2^m<<3^m<<4,y=y>>>8^y&255^99;r[w]=y,n[y]=w;var g=p[w],b=p[g],D=p[b],C=257*p[y]^16843008*y;i[w]=C<<24|C>>>8,a[w]=C<<16|C>>>16,s[w]=C<<8|C>>>24,u[w]=C,C=16843009*D^65537*b^257*g^16843008*w,c[y]=C<<24|C>>>8,f[y]=C<<16|C>>>16,d[y]=C<<8|C>>>24,v[y]=C,w?(w=g^p[p[p[D^g]]],m^=p[p[m]]):w=m=1}var F=[0,1,2,4,8,16,32,64,128,27,54],L=L.AES=t.extend({_doReset:function(){for(var B=this._key,N=B.words,S=B.sigBytes/4,B=4*((this._nRounds=S+6)+1),O=this._keySchedule=[],x=0;x>>24]<<24|r[U>>>16&255]<<16|r[U>>>8&255]<<8|r[U&255]):(U=U<<8|U>>>24,U=r[U>>>24]<<24|r[U>>>16&255]<<16|r[U>>>8&255]<<8|r[U&255],U^=F[x/S|0]<<24),O[x]=O[x-S]^U}for(N=this._invKeySchedule=[],S=0;SS||4>=x?U:c[r[U>>>24]]^f[r[U>>>16&255]]^d[r[U>>>8&255]]^v[r[U&255]]},encryptBlock:function(N,S){this._doCryptBlock(N,S,this._keySchedule,i,a,s,u,r)},decryptBlock:function(N,S){var B=N[S+1];N[S+1]=N[S+3],N[S+3]=B,this._doCryptBlock(N,S,this._invKeySchedule,c,f,d,v,n),B=N[S+1],N[S+1]=N[S+3],N[S+3]=B},_doCryptBlock:function(N,S,B,O,x,U,G,H){for(var K=this._nRounds,Qe=N[S]^B[0],ut=N[S+1]^B[1],ot=N[S+2]^B[2],et=N[S+3]^B[3],Y=4,ne=1;ne>>24]^x[ut>>>16&255]^U[ot>>>8&255]^G[et&255]^B[Y++],Fe=O[ut>>>24]^x[ot>>>16&255]^U[et>>>8&255]^G[Qe&255]^B[Y++],xe=O[ot>>>24]^x[et>>>16&255]^U[Qe>>>8&255]^G[ut&255]^B[Y++],et=O[et>>>24]^x[Qe>>>16&255]^U[ut>>>8&255]^G[ot&255]^B[Y++],Qe=Ce,ut=Fe,ot=xe;Ce=(H[Qe>>>24]<<24|H[ut>>>16&255]<<16|H[ot>>>8&255]<<8|H[et&255])^B[Y++],Fe=(H[ut>>>24]<<24|H[ot>>>16&255]<<16|H[et>>>8&255]<<8|H[Qe&255])^B[Y++],xe=(H[ot>>>24]<<24|H[et>>>16&255]<<16|H[Qe>>>8&255]<<8|H[ut&255])^B[Y++],et=(H[et>>>24]<<24|H[Qe>>>16&255]<<16|H[ut>>>8&255]<<8|H[ot&255])^B[Y++],N[S]=Ce,N[S+1]=Fe,N[S+2]=xe,N[S+3]=et},keySize:8});e.AES=t._createHelper(L)})();(function(){function e(p,h){var w=(this._lBlock>>>p^this._rBlock)&h;this._rBlock^=w,this._lBlock^=w<>>p^this._lBlock)&h;this._lBlock^=w,this._rBlock^=w<w;w++){var m=s[w]-1;h[w]=p[m>>>5]>>>31-m%32&1}for(p=this._subKeys=[],m=0;16>m;m++){for(var y=p[m]=[],g=c[m],w=0;24>w;w++)y[w/6|0]|=h[(u[w]-1+g)%28]<<31-w%6,y[4+(w/6|0)]|=h[28+(u[w+24]-1+g)%28]<<31-w%6;for(y[0]=y[0]<<1|y[0]>>>31,w=1;7>w;w++)y[w]>>>=4*(w-1)+3;y[7]=y[7]<<5|y[7]>>>27}for(h=this._invSubKeys=[],w=0;16>w;w++)h[w]=p[15-w]},encryptBlock:function(p,h){this._doCryptBlock(p,h,this._subKeys)},decryptBlock:function(p,h){this._doCryptBlock(p,h,this._invSubKeys)},_doCryptBlock:function(p,h,w){this._lBlock=p[h],this._rBlock=p[h+1],e.call(this,4,252645135),e.call(this,16,65535),t.call(this,2,858993459),t.call(this,8,16711935),e.call(this,1,1431655765);for(var m=0;16>m;m++){for(var y=w[m],g=this._lBlock,b=this._rBlock,D=0,C=0;8>C;C++)D|=f[C][((b^y[C])&d[C])>>>0];this._lBlock=b,this._rBlock=g^D}w=this._lBlock,this._lBlock=this._rBlock,this._rBlock=w,e.call(this,1,1431655765),t.call(this,8,16711935),t.call(this,2,858993459),e.call(this,16,65535),e.call(this,4,252645135),p[h]=this._lBlock,p[h+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=i._createHelper(v),a=a.TripleDES=i.extend({_doReset:function(){var p=this._key.words;this._des1=v.createEncryptor(n.create(p.slice(0,2))),this._des2=v.createEncryptor(n.create(p.slice(2,4))),this._des3=v.createEncryptor(n.create(p.slice(4,6)))},encryptBlock:function(p,h){this._des1.encryptBlock(p,h),this._des2.decryptBlock(p,h),this._des3.encryptBlock(p,h)},decryptBlock:function(p,h){this._des3.decryptBlock(p,h),this._des2.encryptBlock(p,h),this._des1.decryptBlock(p,h)},keySize:6,ivSize:2,blockSize:2}),r.TripleDES=i._createHelper(a)})();(function(){var e=Se,t=e.lib.WordArray;e.enc.Base64={stringify:function(r){var n=r.words,i=r.sigBytes,a=this._map;r.clamp(),r=[];for(var s=0;s>>2]>>>24-8*(s%4)&255)<<16|(n[s+1>>>2]>>>24-8*((s+1)%4)&255)<<8|n[s+2>>>2]>>>24-8*((s+2)%4)&255,c=0;4>c&&s+.75*c>>6*(3-c)&63));if(n=a.charAt(64))for(;r.length%4;)r.push(n);return r.join("")},parse:function(r){var n=r.length,i=this._map,a=i.charAt(64);a&&(a=r.indexOf(a),a!=-1&&(n=a));for(var a=[],s=0,u=0;u>>6-2*(u%4);a[s>>>2]|=(c|f)<<24-8*(s%4),s++}return t.create(a,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();(function(e){function t(v,p,h,w,m,y,g){return v=v+(p&h|~p&w)+m+g,(v<>>32-y)+p}function r(v,p,h,w,m,y,g){return v=v+(p&w|h&~w)+m+g,(v<>>32-y)+p}function n(v,p,h,w,m,y,g){return v=v+(p^h^w)+m+g,(v<>>32-y)+p}function i(v,p,h,w,m,y,g){return v=v+(h^(p|~w))+m+g,(v<>>32-y)+p}for(var a=Se,c=a.lib,s=c.WordArray,u=c.Hasher,c=a.algo,f=[],d=0;64>d;d++)f[d]=4294967296*e.abs(e.sin(d+1))|0;c=c.MD5=u.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(v,p){for(var h=0;16>h;h++){var w=p+h,m=v[w];v[w]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360}var h=this._hash.words,w=v[p+0],m=v[p+1],y=v[p+2],g=v[p+3],b=v[p+4],D=v[p+5],C=v[p+6],F=v[p+7],L=v[p+8],N=v[p+9],S=v[p+10],B=v[p+11],O=v[p+12],x=v[p+13],U=v[p+14],G=v[p+15],H=h[0],ne=h[1],Y=h[2],K=h[3],H=t(H,ne,Y,K,w,7,f[0]),K=t(K,H,ne,Y,m,12,f[1]),Y=t(Y,K,H,ne,y,17,f[2]),ne=t(ne,Y,K,H,g,22,f[3]),H=t(H,ne,Y,K,b,7,f[4]),K=t(K,H,ne,Y,D,12,f[5]),Y=t(Y,K,H,ne,C,17,f[6]),ne=t(ne,Y,K,H,F,22,f[7]),H=t(H,ne,Y,K,L,7,f[8]),K=t(K,H,ne,Y,N,12,f[9]),Y=t(Y,K,H,ne,S,17,f[10]),ne=t(ne,Y,K,H,B,22,f[11]),H=t(H,ne,Y,K,O,7,f[12]),K=t(K,H,ne,Y,x,12,f[13]),Y=t(Y,K,H,ne,U,17,f[14]),ne=t(ne,Y,K,H,G,22,f[15]),H=r(H,ne,Y,K,m,5,f[16]),K=r(K,H,ne,Y,C,9,f[17]),Y=r(Y,K,H,ne,B,14,f[18]),ne=r(ne,Y,K,H,w,20,f[19]),H=r(H,ne,Y,K,D,5,f[20]),K=r(K,H,ne,Y,S,9,f[21]),Y=r(Y,K,H,ne,G,14,f[22]),ne=r(ne,Y,K,H,b,20,f[23]),H=r(H,ne,Y,K,N,5,f[24]),K=r(K,H,ne,Y,U,9,f[25]),Y=r(Y,K,H,ne,g,14,f[26]),ne=r(ne,Y,K,H,L,20,f[27]),H=r(H,ne,Y,K,x,5,f[28]),K=r(K,H,ne,Y,y,9,f[29]),Y=r(Y,K,H,ne,F,14,f[30]),ne=r(ne,Y,K,H,O,20,f[31]),H=n(H,ne,Y,K,D,4,f[32]),K=n(K,H,ne,Y,L,11,f[33]),Y=n(Y,K,H,ne,B,16,f[34]),ne=n(ne,Y,K,H,U,23,f[35]),H=n(H,ne,Y,K,m,4,f[36]),K=n(K,H,ne,Y,b,11,f[37]),Y=n(Y,K,H,ne,F,16,f[38]),ne=n(ne,Y,K,H,S,23,f[39]),H=n(H,ne,Y,K,x,4,f[40]),K=n(K,H,ne,Y,w,11,f[41]),Y=n(Y,K,H,ne,g,16,f[42]),ne=n(ne,Y,K,H,C,23,f[43]),H=n(H,ne,Y,K,N,4,f[44]),K=n(K,H,ne,Y,O,11,f[45]),Y=n(Y,K,H,ne,G,16,f[46]),ne=n(ne,Y,K,H,y,23,f[47]),H=i(H,ne,Y,K,w,6,f[48]),K=i(K,H,ne,Y,F,10,f[49]),Y=i(Y,K,H,ne,U,15,f[50]),ne=i(ne,Y,K,H,D,21,f[51]),H=i(H,ne,Y,K,O,6,f[52]),K=i(K,H,ne,Y,g,10,f[53]),Y=i(Y,K,H,ne,S,15,f[54]),ne=i(ne,Y,K,H,m,21,f[55]),H=i(H,ne,Y,K,L,6,f[56]),K=i(K,H,ne,Y,G,10,f[57]),Y=i(Y,K,H,ne,C,15,f[58]),ne=i(ne,Y,K,H,x,21,f[59]),H=i(H,ne,Y,K,b,6,f[60]),K=i(K,H,ne,Y,B,10,f[61]),Y=i(Y,K,H,ne,y,15,f[62]),ne=i(ne,Y,K,H,N,21,f[63]);h[0]=h[0]+H|0,h[1]=h[1]+ne|0,h[2]=h[2]+Y|0,h[3]=h[3]+K|0},_doFinalize:function(){var v=this._data,p=v.words,h=8*this._nDataBytes,w=8*v.sigBytes;p[w>>>5]|=128<<24-w%32;var m=e.floor(h/4294967296);for(p[(w+64>>>9<<4)+15]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360,p[(w+64>>>9<<4)+14]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360,v.sigBytes=4*(p.length+1),this._process(),v=this._hash,p=v.words,h=0;4>h;h++)w=p[h],p[h]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360;return v},clone:function(){var v=u.clone.call(this);return v._hash=this._hash.clone(),v}}),a.MD5=u._createHelper(c),a.HmacMD5=u._createHmacHelper(c)})(Math);(function(){var e=Se,i=e.lib,t=i.WordArray,r=i.Hasher,n=[],i=e.algo.SHA1=r.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(a,s){for(var u=this._hash.words,c=u[0],f=u[1],d=u[2],v=u[3],p=u[4],h=0;80>h;h++){if(16>h)n[h]=a[s+h]|0;else{var w=n[h-3]^n[h-8]^n[h-14]^n[h-16];n[h]=w<<1|w>>>31}w=(c<<5|c>>>27)+p+n[h],w=20>h?w+((f&d|~f&v)+1518500249):40>h?w+((f^d^v)+1859775393):60>h?w+((f&d|f&v|d&v)-1894007588):w+((f^d^v)-899497514),p=v,v=d,d=f<<30|f>>>2,f=c,c=w}u[0]=u[0]+c|0,u[1]=u[1]+f|0,u[2]=u[2]+d|0,u[3]=u[3]+v|0,u[4]=u[4]+p|0},_doFinalize:function(){var a=this._data,s=a.words,u=8*this._nDataBytes,c=8*a.sigBytes;return s[c>>>5]|=128<<24-c%32,s[(c+64>>>9<<4)+14]=Math.floor(u/4294967296),s[(c+64>>>9<<4)+15]=u,a.sigBytes=4*s.length,this._process(),this._hash},clone:function(){var a=r.clone.call(this);return a._hash=this._hash.clone(),a}});e.SHA1=r._createHelper(i),e.HmacSHA1=r._createHmacHelper(i)})();(function(e){for(var t=Se,h=t.lib,r=h.WordArray,n=h.Hasher,h=t.algo,i=[],a=[],s=function(m){return 4294967296*(m-(m|0))|0},u=2,c=0;64>c;){var f;e:{f=u;for(var d=e.sqrt(f),v=2;v<=d;v++)if(!(f%v)){f=!1;break e}f=!0}f&&(8>c&&(i[c]=s(e.pow(u,.5))),a[c]=s(e.pow(u,1/3)),c++),u++}var p=[],h=h.SHA256=n.extend({_doReset:function(){this._hash=new r.init(i.slice(0))},_doProcessBlock:function(w,m){for(var y=this._hash.words,g=y[0],b=y[1],D=y[2],C=y[3],F=y[4],L=y[5],N=y[6],S=y[7],B=0;64>B;B++){if(16>B)p[B]=w[m+B]|0;else{var O=p[B-15],x=p[B-2];p[B]=((O<<25|O>>>7)^(O<<14|O>>>18)^O>>>3)+p[B-7]+((x<<15|x>>>17)^(x<<13|x>>>19)^x>>>10)+p[B-16]}O=S+((F<<26|F>>>6)^(F<<21|F>>>11)^(F<<7|F>>>25))+(F&L^~F&N)+a[B]+p[B],x=((g<<30|g>>>2)^(g<<19|g>>>13)^(g<<10|g>>>22))+(g&b^g&D^b&D),S=N,N=L,L=F,F=C+O|0,C=D,D=b,b=g,g=O+x|0}y[0]=y[0]+g|0,y[1]=y[1]+b|0,y[2]=y[2]+D|0,y[3]=y[3]+C|0,y[4]=y[4]+F|0,y[5]=y[5]+L|0,y[6]=y[6]+N|0,y[7]=y[7]+S|0},_doFinalize:function(){var w=this._data,m=w.words,y=8*this._nDataBytes,g=8*w.sigBytes;return m[g>>>5]|=128<<24-g%32,m[(g+64>>>9<<4)+14]=e.floor(y/4294967296),m[(g+64>>>9<<4)+15]=y,w.sigBytes=4*m.length,this._process(),this._hash},clone:function(){var w=n.clone.call(this);return w._hash=this._hash.clone(),w}});t.SHA256=n._createHelper(h),t.HmacSHA256=n._createHmacHelper(h)})(Math);(function(){var e=Se,t=e.lib.WordArray,n=e.algo,r=n.SHA256,n=n.SHA224=r.extend({_doReset:function(){this._hash=new t.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var i=r._doFinalize.call(this);return i.sigBytes-=4,i}});e.SHA224=r._createHelper(n),e.HmacSHA224=r._createHmacHelper(n)})();(function(){function e(){return n.create.apply(n,arguments)}for(var t=Se,r=t.lib.Hasher,a=t.x64,n=a.Word,i=a.WordArray,a=t.algo,s=[e(1116352408,3609767458),e(1899447441,602891725),e(3049323471,3964484399),e(3921009573,2173295548),e(961987163,4081628472),e(1508970993,3053834265),e(2453635748,2937671579),e(2870763221,3664609560),e(3624381080,2734883394),e(310598401,1164996542),e(607225278,1323610764),e(1426881987,3590304994),e(1925078388,4068182383),e(2162078206,991336113),e(2614888103,633803317),e(3248222580,3479774868),e(3835390401,2666613458),e(4022224774,944711139),e(264347078,2341262773),e(604807628,2007800933),e(770255983,1495990901),e(1249150122,1856431235),e(1555081692,3175218132),e(1996064986,2198950837),e(2554220882,3999719339),e(2821834349,766784016),e(2952996808,2566594879),e(3210313671,3203337956),e(3336571891,1034457026),e(3584528711,2466948901),e(113926993,3758326383),e(338241895,168717936),e(666307205,1188179964),e(773529912,1546045734),e(1294757372,1522805485),e(1396182291,2643833823),e(1695183700,2343527390),e(1986661051,1014477480),e(2177026350,1206759142),e(2456956037,344077627),e(2730485921,1290863460),e(2820302411,3158454273),e(3259730800,3505952657),e(3345764771,106217008),e(3516065817,3606008344),e(3600352804,1432725776),e(4094571909,1467031594),e(275423344,851169720),e(430227734,3100823752),e(506948616,1363258195),e(659060556,3750685593),e(883997877,3785050280),e(958139571,3318307427),e(1322822218,3812723403),e(1537002063,2003034995),e(1747873779,3602036899),e(1955562222,1575990012),e(2024104815,1125592928),e(2227730452,2716904306),e(2361852424,442776044),e(2428436474,593698344),e(2756734187,3733110249),e(3204031479,2999351573),e(3329325298,3815920427),e(3391569614,3928383900),e(3515267271,566280711),e(3940187606,3454069534),e(4118630271,4000239992),e(116418474,1914138554),e(174292421,2731055270),e(289380356,3203993006),e(460393269,320620315),e(685471733,587496836),e(852142971,1086792851),e(1017036298,365543100),e(1126000580,2618297676),e(1288033470,3409855158),e(1501505948,4234509866),e(1607167915,987167468),e(1816402316,1246189591)],u=[],c=0;80>c;c++)u[c]=e();a=a.SHA512=r.extend({_doReset:function(){this._hash=new i.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(f,d){for(var b=this._hash.words,v=b[0],p=b[1],h=b[2],w=b[3],m=b[4],y=b[5],g=b[6],b=b[7],D=v.high,C=v.low,F=p.high,L=p.low,N=h.high,S=h.low,B=w.high,O=w.low,x=m.high,U=m.low,G=y.high,H=y.low,K=g.high,Y=g.low,ne=b.high,Ce=b.low,Fe=D,xe=C,et=F,Qe=L,ut=N,ot=S,Qr=B,er=O,Et=x,gr=U,rr=G,lt=H,Mt=K,tt=Y,qe=ne,nr=Ce,Ue=0;80>Ue;Ue++){var mr=u[Ue];if(16>Ue)var $t=mr.high=f[d+2*Ue]|0,De=mr.low=f[d+2*Ue+1]|0;else{var $t=u[Ue-15],De=$t.high,pt=$t.low,$t=(De>>>1|pt<<31)^(De>>>8|pt<<24)^De>>>7,pt=(pt>>>1|De<<31)^(pt>>>8|De<<24)^(pt>>>7|De<<25),Br=u[Ue-2],De=Br.high,_t=Br.low,Br=(De>>>19|_t<<13)^(De<<3|_t>>>29)^De>>>6,_t=(_t>>>19|De<<13)^(_t<<3|De>>>29)^(_t>>>6|De<<26),De=u[Ue-7],en=De.high,Zt=u[Ue-16],Ne=Zt.high,Zt=Zt.low,De=pt+De.low,$t=$t+en+(De>>>0>>0?1:0),De=De+_t,$t=$t+Br+(De>>>0<_t>>>0?1:0),De=De+Zt,$t=$t+Ne+(De>>>0>>0?1:0);mr.high=$t,mr.low=De}var en=Et&rr^~Et&Mt,Zt=gr<^~gr&tt,mr=Fe&et^Fe&ut^et&ut,qt=xe&Qe^xe&ot^Qe&ot,pt=(Fe>>>28|xe<<4)^(Fe<<30|xe>>>2)^(Fe<<25|xe>>>7),Br=(xe>>>28|Fe<<4)^(xe<<30|Fe>>>2)^(xe<<25|Fe>>>7),_t=s[Ue],Ei=_t.high,tn=_t.low,_t=nr+((gr>>>14|Et<<18)^(gr>>>18|Et<<14)^(gr<<23|Et>>>9)),Ne=qe+((Et>>>14|gr<<18)^(Et>>>18|gr<<14)^(Et<<23|gr>>>9))+(_t>>>0>>0?1:0),_t=_t+Zt,Ne=Ne+en+(_t>>>0>>0?1:0),_t=_t+tn,Ne=Ne+Ei+(_t>>>0>>0?1:0),_t=_t+De,Ne=Ne+$t+(_t>>>0>>0?1:0),De=Br+qt,mr=pt+mr+(De>>>0
>>0?1:0),qe=Mt,nr=tt,Mt=rr,tt=lt,rr=Et,lt=gr,gr=er+_t|0,Et=Qr+Ne+(gr>>>0>>0?1:0)|0,Qr=ut,er=ot,ut=et,ot=Qe,et=Fe,Qe=xe,xe=_t+De|0,Fe=Ne+mr+(xe>>>0<_t>>>0?1:0)|0}C=v.low=C+xe,v.high=D+Fe+(C>>>0>>0?1:0),L=p.low=L+Qe,p.high=F+et+(L>>>0>>0?1:0),S=h.low=S+ot,h.high=N+ut+(S>>>0>>0?1:0),O=w.low=O+er,w.high=B+Qr+(O>>>0>>0?1:0),U=m.low=U+gr,m.high=x+Et+(U>>>0>>0?1:0),H=y.low=H+lt,y.high=G+rr+(H>>>0>>0?1:0),Y=g.low=Y+tt,g.high=K+Mt+(Y>>>0>>0?1:0),Ce=b.low=Ce+nr,b.high=ne+qe+(Ce>>>0>>0?1:0)},_doFinalize:function(){var f=this._data,d=f.words,v=8*this._nDataBytes,p=8*f.sigBytes;return d[p>>>5]|=128<<24-p%32,d[(p+128>>>10<<5)+30]=Math.floor(v/4294967296),d[(p+128>>>10<<5)+31]=v,f.sigBytes=4*d.length,this._process(),this._hash.toX32()},clone:function(){var f=r.clone.call(this);return f._hash=this._hash.clone(),f},blockSize:32}),t.SHA512=r._createHelper(a),t.HmacSHA512=r._createHmacHelper(a)})();(function(){var e=Se,i=e.x64,t=i.Word,r=i.WordArray,i=e.algo,n=i.SHA512,i=i.SHA384=n.extend({_doReset:function(){this._hash=new r.init([new t.init(3418070365,3238371032),new t.init(1654270250,914150663),new t.init(2438529370,812702999),new t.init(355462360,4144912697),new t.init(1731405415,4290775857),new t.init(2394180231,1750603025),new t.init(3675008525,1694076839),new t.init(1203062813,3204075428)])},_doFinalize:function(){var a=n._doFinalize.call(this);return a.sigBytes-=16,a}});e.SHA384=n._createHelper(i),e.HmacSHA384=n._createHmacHelper(i)})();(function(){var e=Se,f=e.lib,t=f.WordArray,r=f.Hasher,f=e.algo,n=t.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),i=t.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),a=t.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),s=t.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=t.create([0,1518500249,1859775393,2400959708,2840853838]),c=t.create([1352829926,1548603684,1836072691,2053994217,0]),f=f.RIPEMD160=r.extend({_doReset:function(){this._hash=t.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(d,v){for(var p=0;16>p;p++){var h=v+p,w=d[h];d[h]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360}var h=this._hash.words,w=u.words,m=c.words,y=n.words,g=i.words,b=a.words,D=s.words,C,F,L,N,S,B,O,x,U,G;B=C=h[0],O=F=h[1],x=L=h[2],U=N=h[3],G=S=h[4];for(var H,p=0;80>p;p+=1)H=C+d[v+y[p]]|0,H=16>p?H+((F^L^N)+w[0]):32>p?H+((F&L|~F&N)+w[1]):48>p?H+(((F|~L)^N)+w[2]):64>p?H+((F&N|L&~N)+w[3]):H+((F^(L|~N))+w[4]),H|=0,H=H<>>32-b[p],H=H+S|0,C=S,S=N,N=L<<10|L>>>22,L=F,F=H,H=B+d[v+g[p]]|0,H=16>p?H+((O^(x|~U))+m[0]):32>p?H+((O&U|x&~U)+m[1]):48>p?H+(((O|~x)^U)+m[2]):64>p?H+((O&x|~O&U)+m[3]):H+((O^x^U)+m[4]),H|=0,H=H<>>32-D[p],H=H+G|0,B=G,G=U,U=x<<10|x>>>22,x=O,O=H;H=h[1]+L+U|0,h[1]=h[2]+N+G|0,h[2]=h[3]+S+B|0,h[3]=h[4]+C+O|0,h[4]=h[0]+F+x|0,h[0]=H},_doFinalize:function(){var d=this._data,v=d.words,p=8*this._nDataBytes,h=8*d.sigBytes;for(v[h>>>5]|=128<<24-h%32,v[(h+64>>>9<<4)+14]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,d.sigBytes=4*(v.length+1),this._process(),d=this._hash,v=d.words,p=0;5>p;p++)h=v[p],v[p]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;return d},clone:function(){var d=r.clone.call(this);return d._hash=this._hash.clone(),d}});e.RIPEMD160=r._createHelper(f),e.HmacRIPEMD160=r._createHmacHelper(f)})(Math);(function(){var e=Se,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(r,n){r=this._hasher=new r.init,typeof n=="string"&&(n=t.parse(n));var i=r.blockSize,a=4*i;n.sigBytes>a&&(n=r.finalize(n)),n.clamp();for(var s=this._oKey=n.clone(),u=this._iKey=n.clone(),c=s.words,f=u.words,d=0;d>6)+Dc.charAt(r&63);if(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=Dc.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=Dc.charAt(r>>2)+Dc.charAt((r&3)<<4)),z1)for(;(n.length&3)>0;)n+=z1;return n}function Sc(e){var t="",r,n=0,i,a;for(r=0;r>2),i=a&3,n=1):n==1?(t+=Ra(i<<2|a>>4),i=a&15,n=2):n==2?(t+=Ra(i),t+=Ra(a>>2),i=a&3,n=3):(t+=Ra(i<<2|a>>4),t+=Ra(a&15),n=0));return n==1&&(t+=Ra(i<<2)),t}function JA(e){var t=Sc(e),r,n=new Array;for(r=0;2*r=0;){var s=t*this[e++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=s&67108863}return i}function E9(e,t,r,n,i,a){for(var s=t&32767,u=t>>15;--a>=0;){var c=this[e]&32767,f=this[e++]>>15,d=u*c+f*s;c=s*c+((d&32767)<<15)+r[n]+(i&1073741823),i=(c>>>30)+(d>>>15)+u*f+(i>>>30),r[n++]=c&1073741823}return i}function b9(e,t,r,n,i,a){for(var s=t&16383,u=t>>14;--a>=0;){var c=this[e]&16383,f=this[e++]>>14,d=u*c+f*s;c=s*c+((d&16383)<<14)+r[n]+i,i=(c>>28)+(d>>14)+u*f,r[n++]=c&268435455}return i}WA&&Zl.appName=="Microsoft Internet Explorer"?(Q.prototype.am=E9,Du=30):WA&&Zl.appName!="Netscape"?(Q.prototype.am=A9,Du=26):(Q.prototype.am=b9,Du=28);Q.prototype.DB=Du;Q.prototype.DM=(1<=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function C9(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function Cu(e){var t=Ft();return t.fromInt(e),t}function D9(e,t){var r;if(t==16)r=4;else if(t==8)r=3;else if(t==256)r=8;else if(t==2)r=1;else if(t==32)r=5;else if(t==4)r=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var n=e.length,i=!1,a=0;--n>=0;){var s=r==8?e[n]&255:QA(e,n);if(s<0){e.charAt(n)=="-"&&(i=!0);continue}i=!1,a==0?this[this.t++]=s:a+r>this.DB?(this[this.t-1]|=(s&(1<>this.DB-a):this[this.t-1]|=s<=this.DB&&(a-=this.DB)}r==8&&e[0]&128&&(this.s=-1,a>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==e;)--this.t}function S9(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var r=(1<0)for(u>u)>0&&(i=!0,a=Ra(n));s>=0;)u>(u+=this.DB-t)):(n=this[s]>>(u-=t)&r,u<=0&&(u+=this.DB,--s)),n>0&&(i=!0),i&&(a+=Ra(n));return i?a:"0"}function I9(){var e=Ft();return Q.ZERO.subTo(this,e),e}function B9(){return this.s<0?this.negate():this}function P9(e){var t=this.s-e.s;if(t!=0)return t;var r=this.t;if(t=r-e.t,t!=0)return this.s<0?-t:t;for(;--r>=0;)if((t=this[r]-e[r])!=0)return t;return 0}function E0(e){var t=1,r;return(r=e>>>16)!=0&&(e=r,t+=16),(r=e>>8)!=0&&(e=r,t+=8),(r=e>>4)!=0&&(e=r,t+=4),(r=e>>2)!=0&&(e=r,t+=2),(r=e>>1)!=0&&(e=r,t+=1),t}function $9(){return this.t<=0?0:this.DB*(this.t-1)+E0(this[this.t-1]^this.s&this.DM)}function x9(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}function R9(e,t){for(var r=e;r=0;--u)t[u+a+1]=this[u]>>n|s,s=(this[u]&i)<=0;--u)t[u]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()}function O9(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t){t.t=0;return}var n=e%this.DB,i=this.DB-n,a=(1<>n;for(var s=r+1;s>n;n>0&&(t[this.t-r-1]|=(this.s&a)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()}function N9(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t[i]=0;for(i=0;i=0;)e[r]=0;for(r=0;r=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}function U9(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(c,a),i.lShiftTo(c,r)):(n.copyTo(a),i.copyTo(r));var f=a.t,d=a[f-1];if(d!=0){var v=d*(1<1?a[f-2]>>this.F2:0),p=this.FV/v,h=(1<=0&&(r[r.t++]=1,r.subTo(g,r)),Q.ONE.dlShiftTo(f,g),g.subTo(a,a);a.t=0;){var b=r[--m]==d?this.DM:Math.floor(r[m]*p+(r[m-1]+w)*h);if((r[m]+=a.am(0,b,r,y,0,f))0&&r.rShiftTo(c,r),s<0&&Q.ZERO.subTo(r,r)}}}function j9(e){var t=Ft();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(Q.ZERO)>0&&e.subTo(t,t),t}function wo(e){this.m=e}function H9(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function M9(e){return e}function q9(e){e.divRemTo(this.m,null,e)}function V9(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function K9(e,t){e.squareTo(t),this.reduce(t)}wo.prototype.convert=H9;wo.prototype.revert=M9;wo.prototype.reduce=q9;wo.prototype.mulTo=V9;wo.prototype.sqrTo=K9;function z9(){if(this.t<1)return 0;var e=this[0];if(!(e&1))return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function Ao(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function Y9(e){var t=Ft();return e.copyTo(t),this.reduce(t),t}function W9(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e[r]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function X9(e,t){e.squareTo(t),this.reduce(t)}function Z9(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Ao.prototype.convert=G9;Ao.prototype.revert=Y9;Ao.prototype.reduce=W9;Ao.prototype.mulTo=Z9;Ao.prototype.sqrTo=X9;function J9(){return(this.t>0?this[0]&1:this.s)==0}function Q9(e,t){if(e>4294967295||e<1)return Q.ONE;var r=Ft(),n=Ft(),i=t.convert(this),a=E0(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<0)t.mulTo(n,i,r);else{var s=r;r=n,n=s}return t.revert(r)}function e7(e,t){var r;return e<256||t.isEven()?r=new wo(t):r=new Ao(t),this.exp(e,r)}Q.prototype.copyTo=_9;Q.prototype.fromInt=C9;Q.prototype.fromString=D9;Q.prototype.clamp=F9;Q.prototype.dlShiftTo=x9;Q.prototype.drShiftTo=R9;Q.prototype.lShiftTo=T9;Q.prototype.rShiftTo=O9;Q.prototype.subTo=k9;Q.prototype.multiplyTo=N9;Q.prototype.squareTo=L9;Q.prototype.divRemTo=U9;Q.prototype.invDigit=z9;Q.prototype.isEven=J9;Q.prototype.exp=Q9;Q.prototype.toString=S9;Q.prototype.negate=I9;Q.prototype.abs=B9;Q.prototype.compareTo=P9;Q.prototype.bitLength=$9;Q.prototype.mod=j9;Q.prototype.modPowInt=e7;Q.ZERO=Cu(0);Q.ONE=Cu(1);function t7(){var e=Ft();return this.copyTo(e),e}function r7(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function i7(){return this.t==0?this.s:this[0]<<16>>16}function s7(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function a7(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function u7(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=Cu(r),i=Ft(),a=Ft(),s="";for(this.divRemTo(n,i,a);i.signum()>0;)s=(r+a.intValue()).toString(e).substr(1)+s,i.divRemTo(n,i,a);return a.intValue().toString(e)+s}function o7(e,t){this.fromInt(0),t==null&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,a=0,s=0,u=0;u=r&&(this.dMultiply(n),this.dAddOffset(s,0),a=0,s=0)}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(s,0)),i&&Q.ZERO.subTo(this,this)}function c7(e,t,r){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(Q.ONE.shiftLeft(e-1),J1,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(Q.ONE.shiftLeft(e-1),this);else{var n=new Array,i=e&7;n.length=(e>>3)+1,t.nextBytes(n),i>0?n[0]&=(1<0)for(r>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<=0;)r<8?(n=(this[e]&(1<>(r+=this.DB-8)):(n=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),n&128&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t}function f7(e){return this.compareTo(e)==0}function h7(e){return this.compareTo(e)<0?this:e}function d7(e){return this.compareTo(e)>0?this:e}function p7(e,t,r){var n,i,a=Math.min(e.t,this.t);for(n=0;n>=16,t+=16),e&255||(e>>=8,t+=8),e&15||(e>>=4,t+=4),e&3||(e>>=2,t+=2),e&1||++t,t}function C7(){for(var e=0;e=this.t?this.s!=0:(this[t]&1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()}function R7(e){var t=Ft();return this.addTo(e,t),t}function T7(e){var t=Ft();return this.subTo(e,t),t}function O7(e){var t=Ft();return this.multiplyTo(e,t),t}function k7(){var e=Ft();return this.squareTo(e),e}function N7(e){var t=Ft();return this.divRemTo(e,t,null),t}function L7(e){var t=Ft();return this.divRemTo(e,null,t),t}function U7(e){var t=Ft(),r=Ft();return this.divRemTo(e,t,r),new Array(t,r)}function j7(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function H7(e,t){if(e!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function Ql(){}function rE(e){return e}function M7(e,t,r){e.multiplyTo(t,r)}function q7(e,t){e.squareTo(t)}Ql.prototype.convert=rE;Ql.prototype.revert=rE;Ql.prototype.mulTo=M7;Ql.prototype.sqrTo=q7;function V7(e){return this.exp(e,new Ql)}function K7(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r[--n]=0;var i;for(i=r.t-this.t;n=0;)r[n]=0;for(n=Math.max(t-this.t,0);n2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=Ft();return e.copyTo(t),this.reduce(t),t}function Y7(e){return e}function W7(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function X7(e,t){e.squareTo(t),this.reduce(t)}function Z7(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Bc.prototype.convert=G7;Bc.prototype.revert=Y7;Bc.prototype.reduce=W7;Bc.prototype.mulTo=Z7;Bc.prototype.sqrTo=X7;function J7(e,t){var r=e.bitLength(),n,i=Cu(1),a;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?a=new wo(t):t.isEven()?a=new Bc(t):a=new Ao(t);var s=new Array,u=3,c=n-1,f=(1<1){var d=Ft();for(a.sqrTo(s[1],d);u<=f;)s[u]=Ft(),a.mulTo(d,s[u-2],s[u]),u+=2}var v=e.t-1,p,h=!0,w=Ft(),m;for(r=E0(e[v])-1;v>=0;){for(r>=c?p=e[v]>>r-c&f:(p=(e[v]&(1<0&&(p|=e[v-1]>>this.DB+r-c)),u=n;!(p&1);)p>>=1,--u;if((r-=u)<0&&(r+=this.DB,--v),h)s[p].copyTo(i),h=!1;else{for(;u>1;)a.sqrTo(i,w),a.sqrTo(w,i),u-=2;u>0?a.sqrTo(i,w):(m=i,i=w,w=m),a.mulTo(w,s[p],i)}for(;v>=0&&!(e[v]&1<0&&(t.rShiftTo(a,t),r.rShiftTo(a,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return a>0&&r.lShiftTo(a,r),r}function eP(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(t==0)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}function tP(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return Q.ZERO;for(var r=e.clone(),n=this.clone(),i=Cu(1),a=Cu(0),s=Cu(0),u=Cu(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),t?((!i.isEven()||!a.isEven())&&(i.addTo(this,i),a.subTo(e,a)),i.rShiftTo(1,i)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);for(;n.isEven();)n.rShiftTo(1,n),t?((!s.isEven()||!u.isEven())&&(s.addTo(this,s),u.subTo(e,u)),s.rShiftTo(1,s)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(s,i),a.subTo(u,a)):(n.subTo(r,n),t&&s.subTo(i,s),u.subTo(a,u))}if(n.compareTo(Q.ONE)!=0)return Q.ZERO;if(u.compareTo(e)>=0)return u.subtract(e);if(u.signum()<0)u.addTo(e,u);else return u;return u.signum()<0?u.add(e):u}var qn=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],rP=(1<<26)/qn[qn.length-1];function nP(e){var t,r=this.abs();if(r.t==1&&r[0]<=qn[qn.length-1]){for(t=0;t>1,e>qn.length&&(e=qn.length);for(var i=Ft(),a=0;a>8&255,Pi[Wr++]^=e>>16&255,Pi[Wr++]^=e>>24&255,Wr>=G1&&(Wr-=G1)}function eg(){oP(new Date().getTime())}if(Pi==null){if(Pi=new Array,Wr=0,Cc!==void 0&&(Cc.crypto!==void 0||Cc.msCrypto!==void 0)){if(q1=Cc.crypto||Cc.msCrypto,q1.getRandomValues)for(V1=new Uint8Array(32),q1.getRandomValues(V1),Xi=0;Xi<32;++Xi)Pi[Wr++]=V1[Xi];else if(Zl.appName=="Netscape"&&Zl.appVersion<"5")for(K1=Cc.crypto.random(32),Xi=0;Xi>>8,Pi[Wr++]=Xi&255;Wr=0,eg()}var Xi,q1,V1,K1;function cP(){if(g0==null){for(eg(),g0=uP(),g0.init(Pi),Wr=0;Wr0&&t.length>0)this.n=li(e,16),this.e=parseInt(t,16);else throw"Invalid RSA public key"}function hP(e){return e.modPowInt(this.e,this.n)}Je.prototype.doPublic=hP;Je.prototype.setPublic=fP;Je.prototype.type="RSA";function dP(e,t,r){if(this.isPrivate=!0,typeof e!="string")this.n=e,this.e=t,this.d=r;else if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=li(e,16),this.e=parseInt(t,16),this.d=li(r,16);else throw"Invalid RSA private key"}function pP(e,t,r,n,i,a,s,u){if(this.isPrivate=!0,this.isPublic=!1,e==null)throw"RSASetPrivateEx N == null";if(t==null)throw"RSASetPrivateEx E == null";if(e.length==0)throw"RSASetPrivateEx N.length == 0";if(t.length==0)throw"RSASetPrivateEx E.length == 0";if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=li(e,16),this.e=parseInt(t,16),this.d=li(r,16),this.p=li(n,16),this.q=li(i,16),this.dmp1=li(a,16),this.dmq1=li(s,16),this.coeff=li(u,16);else throw"Invalid RSA private key in RSASetPrivateEx"}function gP(e,t){var r=new Pc,n=e>>1;this.e=parseInt(t,16);for(var i=new Q(t,16),a=e/2-100,s=Q.ONE.shiftLeft(a);;){for(;this.p=new Q(e-n,1,r),!(this.p.subtract(Q.ONE).gcd(i).compareTo(Q.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new Q(n,1,r),!(this.q.subtract(Q.ONE).gcd(i).compareTo(Q.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var u=this.p;this.p=this.q,this.q=u}var c=this.q.subtract(this.p).abs();if(!(c.bitLength()0;--f){i=i.twice();var d=r.testBit(f),v=t.testBit(f);d!=v&&(i=i.add(d?this:n))}for(f=s.bitLength()-2;f>0;--f){u=u.twice();var p=s.testBit(f),h=a.testBit(f);p!=h&&(u=u.add(p?u:c))}return i}function RP(e,t,r){var n;e.bitLength()>r.bitLength()?n=e.bitLength()-1:n=r.bitLength()-1;for(var i=this.curve.getInfinity(),a=this.add(t);n>=0;)i=i.twice(),e.testBit(n)?r.testBit(n)?i=i.add(a):i=i.add(this):r.testBit(n)&&(i=i.add(t)),--n;return i}Rt.prototype.getX=DP;Rt.prototype.getY=FP;Rt.prototype.equals=SP;Rt.prototype.isInfinity=IP;Rt.prototype.negate=BP;Rt.prototype.add=PP;Rt.prototype.twice=$P;Rt.prototype.multiply=xP;Rt.prototype.multiplyTwo=RP;function Oa(e,t,r){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(r),this.infinity=new Rt(this,null,null)}function TP(){return this.q}function OP(){return this.a}function kP(){return this.b}function NP(e){return e==this?!0:this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function LP(){return this.infinity}function UP(e){return new jr(this.q,e)}function jP(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var t=e.substr(0,2),r=e.substr(2),n=this.fromBigInteger(new Q(f,16)),i=this.getA(),a=this.getB(),s=n.square().add(i).multiply(n).add(a),u=s.sqrt();return t=="03"&&(u=u.negate()),new Rt(this,n,u);case 4:case 6:case 7:var c=(e.length-2)/2,f=e.substr(2,c),d=e.substr(c+2,c);return new Rt(this,this.fromBigInteger(new Q(f,16)),this.fromBigInteger(new Q(d,16)));default:return null}}Oa.prototype.getQ=TP;Oa.prototype.getA=OP;Oa.prototype.getB=kP;Oa.prototype.equals=NP;Oa.prototype.getInfinity=LP;Oa.prototype.fromBigInteger=UP;Oa.prototype.decodePointHex=jP;jr.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};Rt.prototype.getEncoded=function(e){var t=function(a,s){var u=a.toByteArrayUnsigned();if(su.length;)u.unshift(0);return u},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=t(r,32);return e?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(t(n,32))),i};Rt.decodeFrom=function(e,t){var r=t[0],n=t.length-1,i=t.slice(1,1+n/2),a=t.slice(1+n/2,1+n);i.unshift(0),a.unshift(0);var s=new Q(i),u=new Q(a);return new Rt(e,e.fromBigInteger(s),e.fromBigInteger(u))};Rt.decodeFromHex=function(e,t){var r=t.substr(0,2),n=t.length-2,i=t.substr(2,n/2),a=t.substr(2+n/2,n/2),s=new Q(i,16),u=new Q(a,16);return new Rt(e,e.fromBigInteger(s),e.fromBigInteger(u))};Rt.prototype.add2D=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;if(this.x.equals(e.x))return this.y.equals(e.y)?this.twice():this.curve.getInfinity();var t=e.x.subtract(this.x),r=e.y.subtract(this.y),n=r.divide(t),i=n.square().subtract(this.x).subtract(e.x),a=n.multiply(this.x.subtract(i)).subtract(this.y);return new Rt(this.curve,i,a)};Rt.prototype.twice2D=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var e=this.curve.fromBigInteger(Q.valueOf(2)),t=this.curve.fromBigInteger(Q.valueOf(3)),r=this.x.square().multiply(t).add(this.curve.a).divide(this.y.multiply(e)),n=r.square().subtract(this.x.multiply(e)),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new Rt(this.curve,n,i)};Rt.prototype.multiply2D=function(e){if(this.isInfinity())return this;if(e.signum()==0)return this.curve.getInfinity();var t=e,r=t.multiply(new Q("3")),n=this.negate(),i=this,a;for(a=r.bitLength()-2;a>0;--a){i=i.twice();var s=r.testBit(a),u=t.testBit(a);s!=u&&(i=i.add2D(s?this:n))}return i};Rt.prototype.isOnCurve=function(){var e=this.getX().toBigInteger(),t=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),i=this.curve.getQ(),a=t.multiply(t).mod(i),s=e.multiply(e).multiply(e).add(r.multiply(e)).add(n).mod(i);return a.equals(s)};Rt.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};Rt.prototype.validate=function(){var e=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var t=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(t.compareTo(Q.ONE)<0||t.compareTo(e.subtract(Q.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(Q.ONE)<0||r.compareTo(e.subtract(Q.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(e).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};var nE=function(){var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)",t='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))',r='(?:"'+t+'*")',n=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+r+")","g"),i=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),a={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:` `,r:"\r",t:" "};function s(v,p,h){return p?a[p]:String.fromCharCode(parseInt(h,16))}var u=new String(""),c="\\",f={"{":Object,"[":Array},d=Object.hasOwnProperty;return function(v,p){var h=v.match(n),w,m=h[0],y=!1;m==="{"?w={}:m==="["?w=[]:(w=[],y=!0);for(var g,b=[w],D=1-y,C=h.length;D=0;)delete B[O[G]]}return p.call(N,S,B)};w=L({"":w},"")}return w}}();(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});A.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){return tf(e)},this.getPEMStringFromHex=function(e,t){return _n(e,t)},this.newObject=function(e){var t=A,r=t.asn1,n=r.ASN1Object,i=r.DERBoolean,a=r.DERInteger,s=r.DERBitString,u=r.DEROctetString,c=r.DERNull,f=r.DERObjectIdentifier,d=r.DEREnumerated,v=r.DERUTF8String,p=r.DERNumericString,h=r.DERPrintableString,w=r.DERTeletexString,m=r.DERIA5String,y=r.DERUTCTime,g=r.DERGeneralizedTime,b=r.DERVisibleString,D=r.DERBMPString,C=r.DERSequence,F=r.DERSet,L=r.DERTaggedObject,N=r.ASN1Util.newObject;if(e instanceof r.ASN1Object)return e;var S=Object.keys(e);if(S.length!=1)throw new Error("key of param shall be only one.");var B=S[0];if(":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+B+":")==-1)throw new Error("undefined key: "+B);if(B=="bool")return new i(e[B]);if(B=="int")return new a(e[B]);if(B=="bitstr")return new s(e[B]);if(B=="octstr")return new u(e[B]);if(B=="null")return new c(e[B]);if(B=="oid")return new f(e[B]);if(B=="enum")return new d(e[B]);if(B=="utf8str")return new v(e[B]);if(B=="numstr")return new p(e[B]);if(B=="prnstr")return new h(e[B]);if(B=="telstr")return new w(e[B]);if(B=="ia5str")return new m(e[B]);if(B=="utctime")return new y(e[B]);if(B=="gentime")return new g(e[B]);if(B=="visstr")return new b(e[B]);if(B=="bmpstr")return new D(e[B]);if(B=="asn1")return new n(e[B]);if(B=="seq"){for(var O=e[B],x=[],U=0;U"u"||this.hV==null)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n="+a.length+",v="+this.hV);var s=this.hV.length/2,u=s.toString(16);if(u.length%2==1&&(u="0"+u),s<128)return u;var c=u.length/2;if(c>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+s.toString(16));var f=128+c;return f.toString(16)+u},this.tohex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.getValueHex=function(){return this.tohex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(s){this.params=s},e!=null&&e.tlv!=null&&(this.hTLV=e.tlv,this.isModified=!1)};A.asn1.DERAbstractString=function(e){A.asn1.DERAbstractString.superclass.constructor.call(this);var t=null,r=null;this.getString=function(){return this.s},this.setString=function(n){this.hTLV=null,this.isModified=!0,this.s=n,this.hV=y0(this.s).toLowerCase()},this.setStringHex=function(n){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=n},this.getFreshValueHex=function(){return this.hV},typeof e<"u"&&(typeof e=="string"?this.setString(e):typeof e.str<"u"?this.setString(e.str):typeof e.hex<"u"&&this.setStringHex(e.hex))};pe(A.asn1.DERAbstractString,A.asn1.ASN1Object);A.asn1.DERAbstractTime=function(e){A.asn1.DERAbstractTime.superclass.constructor.call(this);var t=null,r=null;this.localDateToUTC=function(n){var i=n.getTime()+n.getTimezoneOffset()*6e4,a=new Date(i);return a},this.formatDate=function(n,i,a){var s=this.zeroPadding,u=this.localDateToUTC(n),c=String(u.getFullYear());i=="utc"&&(c=c.substr(2,2));var f=s(String(u.getMonth()+1),2),d=s(String(u.getDate()),2),v=s(String(u.getHours()),2),p=s(String(u.getMinutes()),2),h=s(String(u.getSeconds()),2),w=c+f+d+v+p+h;if(a===!0){var m=u.getMilliseconds();if(m!=0){var y=s(String(m),3);y=y.replace(/[0]+$/,""),w=w+"."+y}}return w+"Z"},this.zeroPadding=function(n,i){return n.length>=i?n:new Array(i-n.length+1).join("0")+n},this.setByParam=function(n){this.hV=null,this.hTLV=null,this.params=n},this.getString=function(){},this.setString=function(n){this.hTLV=null,this.isModified=!0,this.params==null&&(this.params={}),this.params.str=n},this.setByDate=function(n){this.hTLV=null,this.isModified=!0,this.params==null&&(this.params={}),this.params.date=n},this.setByDateValue=function(n,i,a,s,u,c){var f=new Date(Date.UTC(n,i-1,a,s,u,c,0));this.setByDate(f)},this.getFreshValueHex=function(){return this.hV}};pe(A.asn1.DERAbstractTime,A.asn1.ASN1Object);A.asn1.DERAbstractStructured=function(e){A.asn1.DERAbstractString.superclass.constructor.call(this);var t=null;this.setByASN1ObjectArray=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array=r},this.appendASN1Object=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array.push(r)},this.asn1Array=new Array,typeof e<"u"&&typeof e.array<"u"&&(this.asn1Array=e.array)};pe(A.asn1.DERAbstractStructured,A.asn1.ASN1Object);A.asn1.DERBoolean=function(e){A.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",e==!1?this.hTLV="010100":this.hTLV="0101ff"};pe(A.asn1.DERBoolean,A.asn1.ASN1Object);A.asn1.DERInteger=function(e){A.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.params=null;var t=tf;this.setByBigInteger=function(r){this.isModified=!0,this.params={bigint:r}},this.setByInteger=function(r){this.isModified=!0,this.params=r},this.setValueHex=function(r){this.isModified=!0,this.params={hex:r}},this.getFreshValueHex=function(){var r=this.params,n=null;if(r==null)throw new Error("value not set");if(typeof r=="object"&&r.hex!=null)return this.hV=r.hex,this.hV;if(typeof r=="number")n=new Q(String(r),10);else if(r.int!=null)n=new Q(String(r.int),10);else if(r.bigint!=null)n=r.bigint;else throw new Error("wrong parameter");return this.hV=t(n),this.hV},e!=null&&(this.params=e)};pe(A.asn1.DERInteger,A.asn1.ASN1Object);A.asn1.DERBitString=function(e){if(e!==void 0&&typeof e.obj<"u"){var t=A.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.tohex()}A.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(r){this.hTLV=null,this.isModified=!0,this.hV=r},this.setUnusedBitsAndHexValue=function(r,n){if(r<0||7=a)break}return n};ye.getNthChildIdx=function(e,t,r){var n=ye.getChildIdx(e,t);return n[r]};ye.getIdxbyList=function(e,t,r,n){var i=ye,a,s;return r.length==0?n!==void 0&&e.substr(t,2)!==n?-1:t:(a=r.shift(),s=i.getChildIdx(e,t),a>=s.length?-1:i.getIdxbyList(e,s[a],r,n))};ye.getIdxbyListEx=function(e,t,r,n){var i=ye,a,s;if(r.length==0)return n!==void 0&&e.substr(t,2)!==n?-1:t;a=r.shift(),s=i.getChildIdx(e,t);for(var u=0,c=0;c=e.length?null:i.getTLV(e,a)};ye.getTLVbyListEx=function(e,t,r,n){var i=ye,a=i.getIdxbyListEx(e,t,r,n);return a==-1?null:i.getTLV(e,a)};ye.getVbyList=function(e,t,r,n,i){var a=ye,s,u;return s=a.getIdxbyList(e,t,r,n),s==-1||s>=e.length?null:(u=a.getV(e,s),i===!0&&(u=u.substr(2)),u)};ye.getVbyListEx=function(e,t,r,n,i){var a=ye,s,u,c;return s=a.getIdxbyListEx(e,t,r,n),s==-1?null:(c=a.getV(e,s),e.substr(s,2)=="03"&&i!==!1&&(c=c.substr(2)),c)};ye.getInt=function(e,t,r){r==null&&(r=-1);try{var n=e.substr(t,2);if(n!="02"&&n!="03")return r;var i=ye.getV(e,t);return n=="02"?parseInt(i,16):hE(i)}catch{return r}};ye.getOID=function(e,t,r){r==null&&(r=null);try{if(e.substr(t,2)!="06")return r;var n=ye.getV(e,t);return S0(n)}catch{return r}};ye.getOIDName=function(e,t,r){r==null&&(r=null);try{var n=ye.getOID(e,t,r);if(n==r)return r;var i=A.asn1.x509.OID.oid2name(n);return i==""?n:i}catch{return r}};ye.getString=function(e,t,r){r==null&&(r=null);try{var n=ye.getV(e,t);return hi(n)}catch{return r}};ye.hextooidstr=function(e){var t=function(v,p){return v.length>=p?v:new Array(p-v.length+1).join("0")+v},r=[],n=e.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var a=e.substr(2),s=[],u=0;u0&&(d=d+"."+c.join(".")),d};ye.dump=function(e,t,r,n){var i=ye,a=i.getV,s=i.dump,u=i.getChildIdx,c=e;e instanceof A.asn1.ASN1Object&&(c=e.tohex());var f=function(N,S){if(N.length<=S*2)return N;var B=N.substr(0,S)+"..(total "+N.length/2+"bytes).."+N.substr(N.length-S,S);return B};t===void 0&&(t={ommit_long_octet:32}),r===void 0&&(r=0),n===void 0&&(n="");var d=t.ommit_long_octet,F=c.substr(r,2);if(F=="01"){var v=a(c,r);return v=="00"?n+`BOOLEAN FALSE `:n+`BOOLEAN TRUE `}if(F=="02"){var v=a(c,r);return n+"INTEGER "+f(v,d)+` `}if(F=="03"){var v=a(c,r);if(i.isASN1HEX(v.substr(2))){var p=n+`BITSTRING, encapsulates `;return p=p+s(v.substr(2),t,0,n+" "),p}else return n+"BITSTRING "+f(v,d)+` `}if(F=="04"){var v=a(c,r);if(i.isASN1HEX(v)){var p=n+`OCTETSTRING, encapsulates `;return p=p+s(v,t,0,n+" "),p}else return n+"OCTETSTRING "+f(v,d)+` `}if(F=="05")return n+`NULL `;if(F=="06"){var h=a(c,r),w=A.asn1.ASN1Util.oidHexToInt(h),m=A.asn1.x509.OID.oid2name(w),y=w.replace(/\./g," ");return m!=""?n+"ObjectIdentifier "+m+" ("+y+`) `:n+"ObjectIdentifier ("+y+`) `}if(F=="0a")return n+"ENUMERATED "+parseInt(a(c,r))+` `;if(F=="0c")return n+"UTF8String '"+jt(a(c,r))+`' `;if(F=="13")return n+"PrintableString '"+jt(a(c,r))+`' `;if(F=="14")return n+"TeletexString '"+jt(a(c,r))+`' `;if(F=="16")return n+"IA5String '"+jt(a(c,r))+`' `;if(F=="17")return n+"UTCTime "+jt(a(c,r))+` `;if(F=="18")return n+"GeneralizedTime "+jt(a(c,r))+` `;if(F=="1a")return n+"VisualString '"+jt(a(c,r))+`' `;if(F=="1e")return n+"BMPString '"+ig(a(c,r))+`' `;if(F=="30"){if(c.substr(r,4)=="3000")return n+`SEQUENCE {} `;var p=n+`SEQUENCE `,g=u(c,r),b=t;if((g.length==2||g.length==3)&&c.substr(g[0],2)=="06"&&c.substr(g[g.length-1],2)=="04"){var m=i.oidname(a(c,g[0])),D=JSON.parse(JSON.stringify(t));D.x509ExtName=m,b=D}for(var C=0;C4?{enum:{hex:g}}:{enum:parseInt(g,16)};if(m=="30"||m=="31")return y[h[m]]=w(e),y;if(m=="14"){var L=p(g);return y[h[m]]={str:L},y}else if(m=="1e"){var L=v(g);return y[h[m]]={str:L},y}else if(":0c:12:13:16:17:18:1a:".indexOf(m)!=-1){var L=d(g);return y[h[m]]={str:L},y}else if(m.match(/^8[0-9]$/)){var L=d(g);return L==null|L==""?{tag:{tag:m,explicit:!1,hex:g}}:L.match(/[\x00-\x1F\x7F-\x9F]/)!=null||L.match(/[\u0000-\u001F\u0080–\u009F]/)!=null?{tag:{tag:m,explicit:!1,hex:g}}:{tag:{tag:m,explicit:!1,str:L}}}else if(m.match(/^a[0-9]$/))try{if(!n(g))throw new Error("not encap");return{tag:{tag:m,explicit:!0,obj:r(g)}}}catch{return{tag:{tag:m,explicit:!0,hex:g}}}else{var N=new A.asn1.ASN1Object;N.hV=g;var S=N.getLengthHexFromValue();return{asn1:{tlv:m+S+g}}}}}};ye.isContextTag=function(e,t){e=e.toLowerCase();var r,n;try{r=parseInt(e,16)}catch{return-1}if(t===void 0)return(r&192)==128;try{var i=t.match(/^\[[0-9]+\]$/);return i==null||(n=parseInt(t.substr(1,t.length-1),10),n>31)?!1:(r&192)==128&&(r&31)==n}catch{return!1}};ye.isASN1HEX=function(e){var t=ye;if(e.length%2==1)return!1;var r=t.getVblen(e,0),n=e.substr(0,2),i=t.getL(e,0),a=e.length-n.length-i.length;return a==r*2};ye.checkStrictDER=function(e,t,r,n,i){var a=ye;if(r===void 0){if(typeof e!="string")throw new Error("not hex string");if(e=e.toLowerCase(),!A.lang.String.isHex(e))throw new Error("not hex string");r=e.length,n=e.length/2,n<128?i=1:i=Math.ceil(n.toString(16))+1}var s=a.getL(e,t);if(s.length>i*2)throw new Error("L of TLV too long: idx="+t);var u=a.getVblen(e,t);if(u>n)throw new Error("value of L too long than hex: idx="+t);var c=a.getTLV(e,t),f=c.length-2-a.getL(e,t).length;if(f!==u*2)throw new Error("V string length and L's value not the same:"+f+"/"+u*2);if(t===0&&e.length!=c.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+c.length);var d=e.substr(t,2);if(d==="02"){var v=a.getVidx(e,t);if(e.substr(v,2)=="00"&&e.charCodeAt(v+2)<56)throw new Error("not least zeros for DER INTEGER")}if(parseInt(d,16)&32){for(var p=a.getVblen(e,t),h=0,w=a.getChildIdx(e,t),m=0;m"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.x509>"u"||!A.asn1.x509)&&(A.asn1.x509={});A.asn1.x509.Certificate=function(e){A.asn1.x509.Certificate.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.DERBitString,i=r.DERSequence,a=r.x509,s=a.TBSCertificate,u=a.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(c){this.params=c},this.sign=function(){var c=this.params,f=c.sigalg;c.sigalg.name!=null&&(f=c.sigalg.name);var d=c.tbsobj.tohex(),v=new A.crypto.Signature({alg:f});v.init(c.cakey),v.updateHex(d),c.sighex=v.sign()},this.getPEM=function(){return _n(this.tohex(),"CERTIFICATE")},this.tohex=function(){var c=this.params;if((c.tbsobj==null||c.tbsobj==null)&&(c.tbsobj=new s(c)),c.sighex==null&&c.cakey!=null&&this.sign(),c.sighex==null)throw new Error("sighex or cakey parameter not defined");var f=[];f.push(c.tbsobj),f.push(new u({name:c.sigalg})),f.push(new n({hex:"00"+c.sighex}));var d=new i({array:f});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&(this.params=e)};pe(A.asn1.x509.Certificate,A.asn1.ASN1Object);A.asn1.x509.TBSCertificate=function(e){A.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.x509,i=r.DERTaggedObject,a=r.DERInteger,s=r.DERSequence,u=n.AlgorithmIdentifier,c=n.Time,f=n.X500Name,d=n.Extensions,v=n.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(p){this.params=p},this.tohex=function(){var p=[],h=this.params;if(h.version!=null||h.version!=1){var w=2;h.version!=null&&(w=h.version-1);var m=new i({obj:new a({int:w})});p.push(m)}p.push(new a(h.serial)),p.push(new u({name:h.sigalg})),p.push(new f(h.issuer)),p.push(new s({array:[new c(h.notbefore),new c(h.notafter)]})),p.push(new f(h.subject)),p.push(new v(vt.getKey(h.sbjpubkey))),h.ext!==void 0&&h.ext.length>0&&p.push(new i({tag:"a3",obj:new d(h.ext)}));var y=new A.asn1.DERSequence({array:p});return y.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(A.asn1.x509.TBSCertificate,A.asn1.ASN1Object);A.asn1.x509.Extensions=function(e){A.asn1.x509.Extensions.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.DERSequence,i=r.x509;this.aParam=[],this.setByParam=function(a){this.aParam=a},this.tohex=function(){for(var a=[],s=0;s-1&&u.push(new n({int:this.pathLen}));var c=new i({array:u});return this.asn1ExtnValue=c,this.asn1ExtnValue.tohex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,e!==void 0&&(e.cA!==void 0&&(this.cA=e.cA),e.pathLen!==void 0&&(this.pathLen=e.pathLen))};pe(A.asn1.x509.BasicConstraints,A.asn1.x509.Extension);A.asn1.x509.CRLDistributionPoints=function(e){A.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(i){for(var a=[],s=0;s0&&a.push(new r({array:s}))}var c=new r({array:a});return c.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};pe(A.asn1.x509.PolicyInformation,A.asn1.ASN1Object);A.asn1.x509.PolicyQualifierInfo=function(e){A.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=A.asn1,r=t.DERSequence,n=t.DERIA5String,i=t.DERObjectIdentifier,a=t.x509.UserNotice;this.params=null,this.tohex=function(){if(this.params.cps!==void 0){var s=new r({array:[new i({oid:"1.3.6.1.5.5.7.2.1"}),new n({str:this.params.cps})]});return s.tohex()}if(this.params.unotice!=null){var s=new r({array:[new i({oid:"1.3.6.1.5.5.7.2.2"}),new a(this.params.unotice)]});return s.tohex()}},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};pe(A.asn1.x509.PolicyQualifierInfo,A.asn1.ASN1Object);A.asn1.x509.UserNotice=function(e){A.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=A.asn1.DERSequence,r=A.asn1.DERInteger,n=A.asn1.x509.DisplayText,i=A.asn1.x509.NoticeReference;this.params=null,this.tohex=function(){var a=[];this.params.noticeref!==void 0&&a.push(new i(this.params.noticeref)),this.params.exptext!==void 0&&a.push(new n(this.params.exptext));var s=new t({array:a});return s.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};pe(A.asn1.x509.UserNotice,A.asn1.ASN1Object);A.asn1.x509.NoticeReference=function(e){A.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=A.asn1.DERSequence,r=A.asn1.DERInteger,n=A.asn1.x509.DisplayText;this.params=null,this.tohex=function(){var i=[];if(this.params.org!==void 0&&i.push(new n(this.params.org)),this.params.noticenum!==void 0){for(var a=[],s=this.params.noticenum,u=0;u0)for(var s=0;s0;i++){var a=t.shift();if(r===!0){var s=n.pop(),u=(s+","+a).replace(/\\,/g,",");n.push(u),r=!1}else n.push(a);a.substr(-1,1)==="\\"&&(r=!0)}return n=n.map(function(c){return c.replace("/","\\/")}),n.reverse(),"/"+n.join("/")};A.asn1.x509.X500Name.ldapToOneline=function(e){return A.asn1.x509.X500Name.ldapToCompat(e)};A.asn1.x509.RDN=function(e){A.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=A.asn1.x509.AttributeTypeAndValue;this.setByParam=function(r){r.rule!==void 0&&(this.sRule=r.rule),r.str!==void 0&&this.addByMultiValuedString(r.str),r.array!==void 0&&(this.paramArray=r.array)},this.addByString=function(r){this.asn1Array.push(new A.asn1.x509.AttributeTypeAndValue({str:r,rule:this.sRule}))},this.addByMultiValuedString=function(r){for(var n=A.asn1.x509.RDN.parseString(r),i=0;i0)for(var r=0;r0;i++){var a=t.shift();if(r===!0){var s=n.pop(),u=(s+"+"+a).replace(/\\\+/g,"+");n.push(u),r=!1}else n.push(a);a.substr(-1,1)==="\\"&&(r=!0)}for(var c=!1,f=[],i=0;n.length>0;i++){var a=n.shift();if(c===!0){var d=f.pop();if(a.match(/"$/)){var u=(d+"+"+a).replace(/^([^=]+)="(.*)"$/,"$1=$2");f.push(u),c=!1}else f.push(d+"+"+a)}else f.push(a);a.match(/^[^=]+="/)&&(c=!0)}return f};A.asn1.x509.AttributeTypeAndValue=function(e){A.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=A,r=t.asn1,n=r.DERSequence,i=r.DERUTF8String,a=r.DERPrintableString,s=r.DERTeletexString,u=r.DERIA5String,c=r.DERVisibleString,f=r.DERBMPString,d=t.lang.String.isMail,v=t.lang.String.isPrintable;this.setByParam=function(p){if(p.rule!==void 0&&(this.sRule=p.rule),p.ds!==void 0&&(this.dsType=p.ds),p.value===void 0&&p.str!==void 0){var h=p.str,w=h.match(/^([^=]+)=(.+)$/);if(w)this.sType=w[1],this.sValue=w[2];else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)}else this.sType=p.type,this.sValue=p.value},this.setByString=function(p,h){h!==void 0&&(this.sRule=h);var w=p.match(/^([^=]+)=(.+)$/);if(w)this.setByAttrTypeAndValueStr(w[1],w[2]);else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)},this._getDsType=function(){var p=this.sType,h=this.sValue,w=this.sRule;return w==="prn"?p=="CN"&&d(h)?"ia5":v(h)?"prn":"utf8":w==="utf8"?p=="CN"&&d(h)?"ia5":p=="C"?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(p,h,w){w!==void 0&&(this.sRule=w),this.sType=p,this.sValue=h},this.getValueObj=function(p,h){if(p=="utf8")return new i({str:h});if(p=="prn")return new a({str:h});if(p=="tel")return new s({str:h});if(p=="ia5")return new u({str:h});if(p=="vis")return new c({str:h});if(p=="bmp")return new f({str:h});throw new Error("unsupported directory string type: type="+p+" value="+h)},this.tohex=function(){this.dsType==null&&(this.dsType=this._getDsType());var p=A.asn1.x509.OID.atype2obj(this.sType),h=this.getValueObj(this.dsType,this.sValue),w=new n({array:[p,h]});return this.TLV=w.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(A.asn1.x509.AttributeTypeAndValue,A.asn1.ASN1Object);A.asn1.x509.SubjectPublicKeyInfo=function(e){A.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=null,r=null,n=A,i=n.asn1,a=i.DERInteger,s=i.DERBitString,u=i.DERObjectIdentifier,c=i.DERSequence,f=i.ASN1Util.newObject,d=i.x509,v=d.AlgorithmIdentifier,p=n.crypto,h=p.ECDSA,w=p.DSA;this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null)throw"algId and/or subjPubKey not set";var m=new c({array:[this.asn1AlgId,this.asn1SubjPKey]});return m},this.tohex=function(){var m=this.getASN1Object();return this.hTLV=m.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.setPubKey=function(m){try{if(m instanceof Je){var y=f({seq:[{int:{bigint:m.n}},{int:{int:m.e}}]}),g=y.tohex();this.asn1AlgId=new v({name:"rsaEncryption"}),this.asn1SubjPKey=new s({hex:"00"+g})}}catch{}try{if(m instanceof A.crypto.ECDSA){var b=new u({name:m.curveName});this.asn1AlgId=new v({name:"ecPublicKey",asn1params:b}),this.asn1SubjPKey=new s({hex:"00"+m.pubKeyHex})}}catch{}try{if(m instanceof A.crypto.DSA){var b=new f({seq:[{int:{bigint:m.p}},{int:{bigint:m.q}},{int:{bigint:m.g}}]});this.asn1AlgId=new v({name:"dsa",asn1params:b});var D=new a({bigint:m.y});this.asn1SubjPKey=new s({hex:"00"+D.tohex()})}}catch{}},e!==void 0&&this.setPubKey(e)};pe(A.asn1.x509.SubjectPublicKeyInfo,A.asn1.ASN1Object);A.asn1.x509.Time=function(e){A.asn1.x509.Time.superclass.constructor.call(this);var t=null,r=null,n=A,i=n.asn1,a=i.DERUTCTime,s=i.DERGeneralizedTime;this.params=null,this.type=null,this.setTimeParams=function(u){this.timeParams=u},this.setByParam=function(u){this.params=u},this.getType=function(u){return u.match(/^[0-9]{12}Z$/)?"utc":u.match(/^[0-9]{14}Z$/)?"gen":u.match(/^[0-9]{12}\.[0-9]+Z$/)?"utc":u.match(/^[0-9]{14}\.[0-9]+Z$/)?"gen":null},this.tohex=function(){var u=this.params,c=null;if(typeof u=="string"&&(u={str:u}),u!=null&&u.str&&(u.type==null||u.type==null)&&(u.type=this.getType(u.str)),u!=null&&u.str?(u.type=="utc"&&(c=new a(u.str)),u.type=="gen"&&(c=new s(u.str))):this.type=="gen"?c=new s:c=new a,c==null)throw new Error("wrong setting for Time");return this.TLV=c.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};A.asn1.x509.Time_bak=function(e){A.asn1.x509.Time_bak.superclass.constructor.call(this);var t=null,r=null,n=A,i=n.asn1,a=i.DERUTCTime,s=i.DERGeneralizedTime;this.setTimeParams=function(u){this.timeParams=u},this.tohex=function(){var u=null;return this.timeParams!=null?this.type=="utc"?u=new a(this.timeParams):u=new s(this.timeParams):this.type=="utc"?u=new a:u=new s,this.TLV=u.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},this.type="utc",e!==void 0&&(e.type!==void 0?this.type=e.type:e.str!==void 0&&(e.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),e.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=e)};pe(A.asn1.x509.Time,A.asn1.ASN1Object);A.asn1.x509.AlgorithmIdentifier=function(e){A.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=A,r=t.asn1,n=r.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.tohex=function(){if(this.nameAlg===null&&this.asn1Alg===null)throw new Error("algorithm not specified");if(this.nameAlg!==null){var a=null;for(var s in n)s===this.nameAlg&&(a=n[s]);if(a!==null)return this.hTLV=a,this.hTLV}this.nameAlg!==null&&this.asn1Alg===null&&(this.asn1Alg=r.x509.OID.name2obj(this.nameAlg));var u=[this.asn1Alg];this.asn1Params!==null&&u.push(this.asn1Params);var c=new r.DERSequence({array:u});return this.hTLV=c.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(e.name!==void 0&&(this.nameAlg=e.name),e.asn1params!==void 0&&(this.asn1Params=e.asn1params),e.paramempty!==void 0&&(this.paramEmpty=e.paramempty)),this.asn1Params===null&&this.paramEmpty===!1&&this.nameAlg!==null){this.nameAlg.name!==void 0&&(this.nameAlg=this.nameAlg.name);var i=this.nameAlg.toLowerCase();i.substr(-7,7)!=="withdsa"&&i.substr(-9,9)!=="withecdsa"&&(this.asn1Params=new r.DERNull)}};pe(A.asn1.x509.AlgorithmIdentifier,A.asn1.ASN1Object);A.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"};A.asn1.x509.GeneralName=function(e){A.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87",otherName:"a0"},r=A,n=r.asn1,i=n.x509,a=i.X500Name,s=i.OtherName,u=n.DERIA5String,c=n.DERPrintableString,f=n.DEROctetString,d=n.DERTaggedObject,v=n.ASN1Object,p=Error;this.params=null,this.setByParam=function(h){this.params=h},this.tohex=function(){var h=this.params,w,y,m,y=!1;if(h.other!==void 0)w="a0",m=new s(h.other);else if(h.rfc822!==void 0)w="81",m=new u({str:h.rfc822});else if(h.dns!==void 0)w="82",m=new u({str:h.dns});else if(h.dn!==void 0)w="a4",y=!0,typeof h.dn=="string"?m=new a({str:h.dn}):h.dn instanceof A.asn1.x509.X500Name?m=h.dn:m=new a(h.dn);else if(h.ldapdn!==void 0)w="a4",y=!0,m=new a({ldapstr:h.ldapdn});else if(h.certissuer!==void 0||h.certsubj!==void 0){w="a4",y=!0;var g,b,D=null;if(h.certsubj!==void 0?(g=!1,b=h.certsubj):(g=!0,b=h.certissuer),b.match(/^[0-9A-Fa-f]+$/)&&D==b,b.indexOf("-----BEGIN ")!=-1&&(D=dr(b)),D==null)throw new Error("certsubj/certissuer not cert");var C=new Ke;C.hex=D;var F;g?F=C.getIssuerHex():F=C.getSubjectHex(),m=new v,m.hTLV=F}else if(h.uri!==void 0)w="86",m=new u({str:h.uri});else if(h.ip!==void 0){w="87";var L,N=h.ip;try{if(N.match(/^[0-9a-f]+$/)){var S=N.length;if(S==8||S==16||S==32||S==64)L=N;else throw"err"}else L=ng(N)}catch(O){throw new p("malformed IP address: "+h.ip+":"+O.message)}m=new f({hex:L})}else throw new p("improper params");var B=new d({tag:w,explicit:y,obj:m});return B.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(A.asn1.x509.GeneralName,A.asn1.ASN1Object);A.asn1.x509.GeneralNames=function(e){A.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=null,r=A,n=r.asn1;this.setByParamArray=function(i){for(var a=0;a"u")throw"Name of ObjectIdentifier not defined: "+t;var r=this.name2oidList[t],n=new e({oid:r});return this.objCache[t]=n,n},this.atype2obj=function(t){if(this.objCache[t]!==void 0)return this.objCache[t];var r;if(t.match(/^\d+\.\d+\.[0-9.]+$/))r=t;else if(this.atype2oidList[t]!==void 0)r=this.atype2oidList[t];else if(this.name2oidList[t]!==void 0)r=this.name2oidList[t];else throw new Error("AttributeType name undefined: "+t);var n=new e({oid:r});return this.objCache[t]=n,n},this.registerOIDs=function(t){if(this.checkOIDs(t))for(var r in t)this.name2oidList[r]=t[r]},this.checkOIDs=function(t){try{var r=Object.keys(t);return r.length==0?!1:(r.map(function(n,i,a){var s=this[n];if(!s.match(/^[0-2]\.[0-9.]+$/))throw new Error("value is not OID")},t),!0)}catch{return!1}}};A.asn1.x509.OID.oid2name=function(e){var t=A.asn1.x509.OID.name2oidList;for(var r in t)if(t[r]==e)return r;return""};A.asn1.x509.OID.oid2atype=function(e){var t=A.asn1.x509.OID.atype2oidList;for(var r in t)if(t[r]==e)return r;return e};A.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=A.asn1.x509.OID.name2oidList;return t[e]===void 0?"":t[e]};A.asn1.x509.X509Util={};A.asn1.x509.X509Util.newCertPEM=function(e){var t=A.asn1.x509,r=t.TBSCertificate,n=t.Certificate,i=new n(e);return i.getPEM()};(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.cms>"u"||!A.asn1.cms)&&(A.asn1.cms={});A.asn1.cms.Attribute=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,a=n.DERSet,s=n.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(u){this.params=u},this.getValueArray=function(){throw new t("not yet implemented abstract")},this.tohex=function(){var u=new s({oid:this.typeOid}),c=new a({array:this.getValueArray()}),f=new i({array:[u,c]});return f.tohex()},this.getEncodedHex=function(){return this.tohex()}};pe(A.asn1.cms.Attribute,A.asn1.ASN1Object);A.asn1.cms.ContentType=function(e){var t=A,r=t.asn1;r.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){var n=new r.DERObjectIdentifier(this.params.type);return[n]},e!=null&&this.setByParam(e)};pe(A.asn1.cms.ContentType,A.asn1.cms.Attribute);A.asn1.cms.MessageDigest=function(e){var t=A,r=t.asn1,n=r.DEROctetString,i=r.cms;i.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){var a=new n(this.params);return[a]},e!=null&&this.setByParam(e)};pe(A.asn1.cms.MessageDigest,A.asn1.cms.Attribute);A.asn1.cms.SigningTime=function(e){var t=A,r=t.asn1;r.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){var n=new r.x509.Time(this.params);return[n]},e!=null&&this.setByParam(e)};pe(A.asn1.cms.SigningTime,A.asn1.cms.Attribute);A.asn1.cms.SigningCertificate=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,a=n.cms,s=a.ESSCertID,u=r.crypto;a.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(this.params==null||this.params==null||this.params.array==null)throw new t("parameter 'array' not specified");for(var c=this.params.array,f=[],d=0;d0){for(var w=a(p.valhex,h[0]),m=v(w,0),y=[],g=0;g1){var C=a(p.valhex,h[1]);p.polhex=C}delete p.valhex},this.setSignaturePolicyIdentifier=function(p){var h=v(p.valhex,0);if(h.length>0){var w=n.getOID(p.valhex,h[0]);p.oid=w}if(h.length>1){var m=new t,y=v(p.valhex,h[1]),g=a(p.valhex,y[0]),b=m.getAlgorithmIdentifierName(g);p.alg=b;var D=i(p.valhex,y[1]);p.hash=D}delete p.valhex},this.setSigningCertificateV2=function(p){var h=v(p.valhex,0);if(h.length>0){for(var w=a(p.valhex,h[0]),m=v(w,0),y=[],g=0;g1){var C=a(p.valhex,h[1]);p.polhex=C}delete p.valhex},this.getESSCertID=function(p){var h={},w=v(p,0);if(w.length>0){var m=i(p,w[0]);h.hash=m}if(w.length>1){var y=a(p,w[1]),g=this.getIssuerSerial(y);g.serial!=null&&(h.serial=g.serial),g.issuer!=null&&(h.issuer=g.issuer)}return h},this.getESSCertIDv2=function(p){var h={},w=v(p,0);if(w.length<1||3m+1){var b=a(p,w[m+1]),D=this.getIssuerSerial(b);h.issuer=D.issuer,h.serial=D.serial}return h},this.getIssuerSerial=function(p){var h={},w=v(p,0),m=a(p,w[0]),y=r.getGeneralNames(m),g=y[0].dn;h.issuer=g;var b=i(p,w[1]);return h.serial={hex:b},h},this.getCertificateSet=function(p){for(var h=v(p,0),w=[],m=0;m"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.tsp>"u"||!A.asn1.tsp)&&(A.asn1.tsp={});A.asn1.tsp.TimeStampToken=function(e){var t=A,r=t.asn1,n=r.tsp;n.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var i=new n.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=i.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.tsp.TimeStampToken,A.asn1.cms.SignedData);A.asn1.tsp.TSTInfo=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,a=n.DERInteger,s=n.DERBoolean,u=n.DERGeneralizedTime,c=n.DERObjectIdentifier,f=n.DERTaggedObject,d=n.tsp,v=d.MessageImprint,p=d.Accuracy,h=n.x509.X500Name,w=n.x509.GeneralName;if(d.TSTInfo.superclass.constructor.call(this),this.dVersion=new a({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerial=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.tohex=function(){var m=[this.dVersion];if(this.dPolicy==null)throw new Error("policy shall be specified.");if(m.push(this.dPolicy),this.dMessageImprint==null)throw new Error("messageImprint shall be specified.");if(m.push(this.dMessageImprint),this.dSerial==null)throw new Error("serialNumber shall be specified.");if(m.push(this.dSerial),this.dGenTime==null)throw new Error("genTime shall be specified.");m.push(this.dGenTime),this.dAccuracy!=null&&m.push(this.dAccuracy),this.dOrdering!=null&&m.push(this.dOrdering),this.dNonce!=null&&m.push(this.dNonce),this.dTsa!=null&&m.push(this.dTsa);var y=new i({array:m});return this.hTLV=y.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0){if(typeof e.policy=="string"){if(!e.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new c({oid:e.policy})}e.messageImprint!==void 0&&(this.dMessageImprint=new v(e.messageImprint)),e.serial!==void 0&&(this.dSerial=new a(e.serial)),e.genTime!==void 0&&(this.dGenTime=new u(e.genTime)),e.accuracy!==void 0&&(this.dAccuracy=new p(e.accuracy)),e.ordering!==void 0&&e.ordering==!0&&(this.dOrdering=new s),e.nonce!==void 0&&(this.dNonce=new a(e.nonce)),e.tsa!==void 0&&(this.dTsa=new f({tag:"a0",explicit:!0,obj:new w({dn:e.tsa})}))}};pe(A.asn1.tsp.TSTInfo,A.asn1.ASN1Object);A.asn1.tsp.Accuracy=function(e){var t=A,r=t.asn1,n=r.ASN1Util.newObject;r.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.tohex=function(){var i=this.params,a=[];return i.seconds!=null&&typeof i.seconds=="number"&&a.push({int:i.seconds}),i.millis!=null&&typeof i.millis=="number"&&a.push({tag:{tagi:"80",obj:{int:i.millis}}}),i.micros!=null&&typeof i.micros=="number"&&a.push({tag:{tagi:"81",obj:{int:i.micros}}}),n({seq:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.tsp.Accuracy,A.asn1.ASN1Object);A.asn1.tsp.MessageImprint=function(e){var t=A,r=t.asn1,n=r.DERSequence,i=r.DEROctetString,a=r.x509,s=a.AlgorithmIdentifier;r.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,c=new s({name:u.alg}),f=new i({hex:u.hash}),d=new n({array:[c,f]});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(A.asn1.tsp.MessageImprint,A.asn1.ASN1Object);A.asn1.tsp.TimeStampReq=function(e){var t=A,r=t.asn1,n=r.DERSequence,i=r.DERInteger,a=r.DERBoolean,s=r.ASN1Object,u=r.DERObjectIdentifier,c=r.tsp,f=c.MessageImprint;c.TimeStampReq.superclass.constructor.call(this),this.params=null,this.tohex=function(){var d=this.params,v=[];v.push(new i({int:1})),d.messageImprint instanceof A.asn1.ASN1Object?v.push(d.messageImprint):v.push(new f(d.messageImprint)),d.policy!=null&&v.push(new u(d.policy)),d.nonce!=null&&v.push(new i(d.nonce)),d.certreq==!0&&v.push(new a);var p=new n({array:v});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.tsp.TimeStampReq,A.asn1.ASN1Object);A.asn1.tsp.TimeStampResp=function(e){var t=A,r=t.asn1,n=r.DERSequence,i=r.ASN1Object,a=r.tsp,s=a.PKIStatusInfo;a.TimeStampResp.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,c=[];if(u.econtent!=null||u.tst!=null)if(u.statusinfo!=null?c.push(new s(u.statusinfo)):c.push(new s("granted")),u.econtent!=null)c.push(new a.TimeStampToken(u).getContentInfo());else if(u.tst instanceof r.ASN1Object)c.push(u.tst);else throw new Error("improper member tst value");else if(u.statusinfo!=null)c.push(new s(u.statusinfo));else throw new Error("parameter for token nor statusinfo not specified");var f=new n({array:c});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.tsp.TimeStampResp,A.asn1.ASN1Object);A.asn1.tsp.PKIStatusInfo=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,a=n.tsp,s=a.PKIStatus,u=a.PKIFreeText,c=a.PKIFailureInfo;a.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var f=this.params,d=[];if(typeof f=="string")d.push(new s(f));else{if(f.status==null)throw new t("property 'status' unspecified");d.push(new s(f.status)),f.statusstr!=null&&d.push(new u(f.statusstr)),f.failinfo!=null&&d.push(new c(f.failinfo))}var v=new i({array:d});return v.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.tsp.PKIStatusInfo,A.asn1.ASN1Object);A.asn1.tsp.PKIStatus=function(e){var t=Error,r=A,n=r.asn1,i=n.DERInteger,a=n.tsp;a.PKIStatus.superclass.constructor.call(this);var s={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};this.params=null,this.tohex=function(){var u=this.params,c,f;if(typeof u=="string")try{f=s[u]}catch{throw new t("undefined name: "+u)}else if(typeof u=="number")f=u;else throw new t("unsupported params");return new i({int:f}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.tsp.PKIStatus,A.asn1.ASN1Object);A.asn1.tsp.PKIFreeText=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,a=n.DERUTF8String,s=n.tsp;s.PKIFreeText.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params;if(!u instanceof Array)throw new t("wrong params: not array");for(var c=[],f=0;f=0;p--)v+=d[p];return v}else{if(typeof c=="string"&&u[c]!=null)return w0([c],u);if(typeof c=="object"&&c.length!=null)return w0(c,u);throw new t("wrong params")}},this.tohex=function(){var c=this.params,f=this.getBinValue();return new i({bin:f}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.tsp.PKIFailureInfo,A.asn1.ASN1Object);A.asn1.tsp.AbstractTSAAdapter=function(e){this.getTSTHex=function(t,r){throw"not implemented yet"}};A.asn1.tsp.SimpleTSAAdapter=function(e){var t=A,r=t.asn1,n=r.tsp,i=t.crypto.Util.hashHex;n.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(a,s){var u=i(a,s);this.params.econtent.content.messageImprint={alg:s,hash:u},this.params.econtent.content.serial={int:this.serial++};var c=Math.floor(Math.random()*1e9);this.params.econtent.content.nonce={int:c};var f=new n.TimeStampToken(this.params);return f.getContentInfoEncodedHex()},e!==void 0&&(this.params=e)};pe(A.asn1.tsp.SimpleTSAAdapter,A.asn1.tsp.AbstractTSAAdapter);A.asn1.tsp.FixedTSAAdapter=function(e){var t=A,r=t.asn1,n=r.tsp,i=t.crypto.Util.hashHex;n.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(a,s){var u=i(a,s);this.params.econtent.content.messageImprint={alg:s,hash:u};var c=new n.TimeStampToken(this.params);return c.getContentInfoEncodedHex()},e!==void 0&&(this.params=e)};pe(A.asn1.tsp.FixedTSAAdapter,A.asn1.tsp.AbstractTSAAdapter);A.asn1.tsp.TSPUtil=new function(){};A.asn1.tsp.TSPUtil.newTimeStampToken=function(e){return new A.asn1.tsp.TimeStampToken(e)};A.asn1.tsp.TSPUtil.parseTimeStampReq=function(e){var t=new A.asn1.tsp.TSPParser;return t.getTimeStampReq(e)};A.asn1.tsp.TSPUtil.parseMessageImprint=function(e){var t=new A.asn1.tsp.TSPParser;return t.getMessageImprint(e)};A.asn1.tsp.TSPParser=function(){var e=Error,t=Ke,r=new t,n=ye,i=n.getV,a=n.getTLV,s=n.getIdxbyList,u=n.getTLVbyListEx,c=n.getChildIdx,f=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],d={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(v){var p=c(v,0);if(p.length==1)return this.getPKIStatusInfo(a(v,p[0]));if(p.length>1){var h=this.getPKIStatusInfo(a(v,p[0])),w=a(v,p[1]),m=this.getToken(w);return m.statusinfo=h,m}},this.getToken=function(v){var p=new A.asn1.cms.CMSParser,h=p.getCMSSignedData(v);return this.setTSTInfo(h),h},this.setTSTInfo=function(v){var p=v.econtent;if(p.type=="tstinfo"){var h=p.content.hex,w=this.getTSTInfo(h);p.content=w}},this.getTSTInfo=function(v){var p={},h=c(v,0),w=i(v,h[1]);p.policy=S0(w);var m=a(v,h[2]);p.messageImprint=this.getMessageImprint(m);var y=i(v,h[3]);p.serial={hex:y};var g=i(v,h[4]);p.genTime={str:jt(g)};var b=0;if(h.length>5&&v.substr(h[5],2)=="30"){var D=a(v,h[5]);p.accuracy=this.getAccuracy(D),b++}if(h.length>5+b&&v.substr(h[5+b],2)=="01"){var C=i(v,h[5+b]);C=="ff"&&(p.ordering=!0),b++}if(h.length>5+b&&v.substr(h[5+b],2)=="02"){var F=i(v,h[5+b]);p.nonce={hex:F},b++}if(h.length>5+b&&v.substr(h[5+b],2)=="a0"){var L=a(v,h[5+b]);L="30"+L.substr(2),pGeneralNames=r.getGeneralNames(L);var N=pGeneralNames[0].dn;p.tsa=N,b++}if(h.length>5+b&&v.substr(h[5+b],2)=="a1"){var S=a(v,h[5+b]);S="30"+S.substr(2);var B=r.getExtParamArray(S);p.ext=B,b++}return p},this.getAccuracy=function(v){for(var p={},h=c(v,0),w=0;w1&&v.substr(h[1],2)=="30"){var g=a(v,h[1]);p.statusstr=this.getPKIFreeText(g),w++}if(h.length>w&&v.substr(h[1+w],2)=="03"){var b=a(v,h[1+w]);p.failinfo=this.getPKIFailureInfo(b)}return p},this.getPKIFreeText=function(v){for(var p=[],h=c(v,0),w=0;w"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.cades>"u"||!A.asn1.cades)&&(A.asn1.cades={});A.asn1.cades.SignaturePolicyIdentifier=function(e){var t=A,r=t.asn1,n=r.cades,i=n.SignaturePolicyId;n.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new i(this.params)]},this.setByParam=function(a){this.params=a},e!=null&&this.setByParam(e)};pe(A.asn1.cades.SignaturePolicyIdentifier,A.asn1.cms.Attribute);A.asn1.cades.SignaturePolicyId=function(e){var t=A,r=t.asn1,n=r.DERSequence,i=r.DERObjectIdentifier,a=r.x509,s=a.AlgorithmIdentifier,u=r.cades,c=u.SignaturePolicyId,f=u.OtherHashAlgAndValue;c.superclass.constructor.call(this),this.params=null,this.tohex=function(){var d=this.params,v=[];v.push(new i(d.oid)),v.push(new f(d));var p=new n({array:v});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(d){this.params=d},e!=null&&this.setByParam(e)};pe(A.asn1.cades.SignaturePolicyId,A.asn1.ASN1Object);A.asn1.cades.OtherHashAlgAndValue=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,a=n.DEROctetString,s=n.x509,u=s.AlgorithmIdentifier,c=n.cades,f=c.OtherHashAlgAndValue;f.superclass.constructor.call(this),this.params=null,this.tohex=function(){var d=this.params;if(d.alg==null)throw new t("property 'alg' not specified");if(d.hash==null&&d.cert==null)throw new t("property 'hash' nor 'cert' not specified");var v=null;if(d.hash!=null)v=d.hash;else if(d.cert!=null){if(typeof d.cert!="string")throw new t("cert not string");var p=d.cert;d.cert.indexOf("-----BEGIN")!=-1&&(p=dr(d.cert)),v=A.crypto.Util.hashHex(p,d.alg)}var h=[];h.push(new u({name:d.alg})),h.push(new a({hex:v}));var w=new i({array:h});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.cades.OtherHashAlgAndValue,A.asn1.ASN1Object);A.asn1.cades.OtherHashValue=function(e){A.asn1.cades.OtherHashValue.superclass.constructor.call(this);var t=Error,r=A,n=r.lang.String.isHex,i=r.asn1,a=i.DEROctetString,s=r.crypto.Util.hashHex;this.params=null,this.tohex=function(){var u=this.params;if(u.hash==null&&u.cert==null)throw new t("hash or cert not specified");var c=null;if(u.hash!=null)c=u.hash;else if(u.cert!=null){if(typeof u.cert!="string")throw new t("cert not string");var f=u.cert;u.cert.indexOf("-----BEGIN")!=-1&&(f=dr(u.cert)),c=A.crypto.Util.hashHex(f,"sha1")}return new a({hex:c}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.cades.OtherHashValue,A.asn1.ASN1Object);A.asn1.cades.SignatureTimeStamp=function(e){var t=Error,r=A,n=r.lang.String.isHex,i=r.asn1,a=i.ASN1Object,s=i.x509,u=i.cades;u.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var c=this.params;if(c.tst!=null)if(n(c.tst)){var f=new a;return f.hTLV=c.tst,[f]}else{if(c.tst instanceof a)return[c.tst];throw new t("params.tst has wrong value")}else if(c.res!=null){var d=c.res;if(d instanceof a&&(d=d.tohex()),typeof d!="string"||!n(d))throw new t("params.res has wrong value");var v=ye.getTLVbyList(d,0,[1]),f=new a;return f.hTLV=c.tst,[f]}},e!=null&&this.setByParam(e)};pe(A.asn1.cades.SignatureTimeStamp,A.asn1.cms.Attribute);A.asn1.cades.CompleteCertificateRefs=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,a=n.cades,s=a.OtherCertID,u=r.lang.String.isHex;a.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var c=this.params,f=[],d=0;d"u"||!A.asn1.csr)&&(A.asn1.csr={});A.asn1.csr.CertificationRequest=function(e){var t=A,r=t.asn1,n=r.DERBitString,i=r.DERSequence,a=r.csr,s=r.x509,u=a.CertificationRequestInfo;a.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(c){this.params=c},this.sign=function(){var c=new u(this.params).tohex(),f=new A.crypto.Signature({alg:this.params.sigalg});f.init(this.params.sbjprvkey),f.updateHex(c);var d=f.sign();this.params.sighex=d},this.getPEM=function(){return _n(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var c=this.params,f=new A.asn1.csr.CertificationRequestInfo(this.params),d=new A.asn1.x509.AlgorithmIdentifier({name:c.sigalg});if(c.sighex==null&&c.sbjprvkey!=null&&this.sign(),c.sighex==null)throw new Error("sighex or sbjprvkey parameter not defined");var v=new n({hex:"00"+c.sighex}),p=new i({array:[f,d,v]});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(A.asn1.csr.CertificationRequest,A.asn1.ASN1Object);A.asn1.csr.CertificationRequestInfo=function(e){var t=A,r=t.asn1,n=r.DERBitString,i=r.DERSequence,a=r.DERInteger,s=r.DERUTF8String,u=r.DERTaggedObject,c=r.ASN1Util.newObject,f=r.csr,d=r.x509,v=d.X500Name,p=d.Extensions,h=d.SubjectPublicKeyInfo,w=f.AttributeList;f.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(y){y!=null&&(this.params=y)},this.tohex=function(){var y=this.params,g=[];if(g.push(new a({int:0})),g.push(new v(y.subject)),g.push(new h(vt.getKey(y.sbjpubkey))),y.attrs!=null){var b=m(y.attrs),D=c({tag:{tage:"a0",obj:b}});g.push(D)}else if(y.extreq!=null){var C=new p(y.extreq),D=c({tag:{tage:"a0",obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[C]}]}}});g.push(D)}else g.push(new u({tag:"a0",explicit:!1,obj:new s({str:""})}));var F=new i({array:g});return F.tohex()},this.getEncodedHex=function(){return this.tohex()};function m(y){for(var g=Error,b=A.asn1.x509.Extensions,D=[],C=0;C"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.ocsp>"u"||!A.asn1.ocsp)&&(A.asn1.ocsp={});A.asn1.ocsp.DEFAULT_HASH="sha1";A.asn1.ocsp.OCSPResponse=function(e){A.asn1.ocsp.OCSPResponse.superclass.constructor.call(this);var t=A.asn1.DEREnumerated,r=A.asn1.ASN1Util.newObject,n=A.asn1.ocsp.ResponseBytes,i=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var a=this.params.resstatus;return typeof a=="number"?a:typeof a!="string"?-1:i.indexOf(a)},this.setByParam=function(a){this.params=a},this.tohex=function(){var a=this.params,s=this._getStatusCode();if(s==-1)throw new Error("responseStatus not supported: "+a.resstatus);if(s!=0)return r({seq:[{enum:{int:s}}]}).tohex();var u=new n(a);return r({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:u}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(A.asn1.ocsp.OCSPResponse,A.asn1.ASN1Object);A.asn1.ocsp.ResponseBytes=function(e){A.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var t=A.asn1,r=t.DERSequence,n=t.DERObjectIdentifier,i=t.DEROctetString,a=t.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(s){this.params=s},this.tohex=function(){var s=this.params;if(s.restype!="ocspBasic")throw new Error("not supported responseType: "+s.restype);var u=new a(s),c=[];c.push(new n({name:"ocspBasic"})),c.push(new i({hex:u.tohex()}));var f=new r({array:c});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(A.asn1.ocsp.ResponseBytes,A.asn1.ASN1Object);A.asn1.ocsp.BasicOCSPResponse=function(e){A.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var t=Error,r=A.asn1,n=r.ASN1Object,i=r.DERSequence,a=r.DERGeneralizedTime,s=r.DERTaggedObject,u=r.DERBitString,c=r.x509.Extensions,f=r.x509.AlgorithmIdentifier,d=r.ocsp,v=d.ResponderID;_SingleResponseList=d.SingleResponseList,_ResponseData=d.ResponseData,this.params=null,this.setByParam=function(p){this.params=p},this.sign=function(){var p=this.params,h=p.tbsresp.tohex(),w=new A.crypto.Signature({alg:p.sigalg});w.init(p.reskey),w.updateHex(h),p.sighex=w.sign()},this.tohex=function(){var p=this.params;p.tbsresp==null&&(p.tbsresp=new _ResponseData(p)),p.sighex==null&&p.reskey!=null&&this.sign();var h=[];if(h.push(p.tbsresp),h.push(new f({name:p.sigalg})),h.push(new u({hex:"00"+p.sighex})),p.certs!=null&&p.certs.length!=null){for(var w=[],m=0;m"u"||!A)&&(A={});(typeof A.lang>"u"||!A.lang)&&(A.lang={});A.lang.String=function(){};function iE(e){for(var t=new Array,r=0;r>6,c=128|s&63;return jt(u.toString(16)+c.toString(16))}var u=224|(a&240)>>4,c=128|(a&15)<<2|(s&192)>>6,f=128|s&63;return jt(u.toString(16)+c.toString(16)+f.toString(16))}var r=e.match(/.{4}/g),n=r.map(t);return n.join("")}function F0(e){for(var t=encodeURIComponent(e),r="",n=0;n"7"?"00"+e:e}function i$(e){e=e.replace(/^\s*\[\s*/,""),e=e.replace(/\s*\]\s*$/,""),e=e.replace(/\s*/g,"");try{var t=e.split(/,/).map(function(r,n,i){var a=parseInt(r);if(a<0||255t.length&&(r=t.length);for(var n=0;n0&&(f=f+"."+u.join(".")),f}catch{return null}}function fE(e){var t=new Q(String(e),10);return tf(t)}function tf(e){var t=e.toString(16);if(t.substr(0,1)!="-")return t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t),t;var r=t.substr(1),n=r.length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var i="",a=0;a=t?e:new Array(t-e.length+1).join(r)+e};function hE(e){if(e.length%2!=0||(e=e.toLowerCase(),e.match(/^[0-9a-f]+$/)==null))return-1;try{var t=e.substr(0,2);if(t=="00")return parseInt(e.substr(2),16);var r=parseInt(t,16);if(r>7)return-1;var n=e.substr(2),i=parseInt(n,16).toString(2);i=="0"&&(i="00000000"),i=i.slice(0,0-r);var a=parseInt(i,2);return a==NaN?-1:a}catch{return-1}}function dE(e){if(typeof e!="number"||e<0)return null;var t=Number(e).toString(2),r=8-t.length%8;r==8&&(r=0),t=t+v0("",r,"0");var n=parseInt(t,2).toString(16);n.length%2==1&&(n="0"+n);var i="0"+r;return i+n}function pE(e){if(typeof e!="string"||e.length%2!=0||!e.match(/^[0-9a-f]+$/))return null;try{var t=parseInt(e.substr(0,2),16);if(t<0||7=0;n--)a+=i[n];return a}function Yt(e,n,r){if(typeof e=="object"){for(var n=String(n).split("."),i=0;i"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:Se.algo.MD5,sha1:Se.algo.SHA1,sha224:Se.algo.SHA224,sha256:Se.algo.SHA256,sha384:Se.algo.SHA384,sha512:Se.algo.SHA512,ripemd160:Se.algo.RIPEMD160},this.getDigestInfoHex=function(e,t){if(typeof this.DIGESTINFOHEAD[t]>"u")throw"alg not supported in Util.DIGESTINFOHEAD: "+t;return this.DIGESTINFOHEAD[t]+e},this.getPaddedDigestInfoHex=function(e,t,r){var n=this.getDigestInfoHex(e,t),i=r/4;if(n.length+22>i)throw"key is too short for SigAlg: keylen="+r+","+t;for(var a="0001",s="00"+n,u="",c=i-a.length-s.length,f=0;f"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.ECDSA=function(e){var t="secp256r1",r=null,n=null,i=null,a=Error,s=Q,u=Rt,c=A.crypto.ECDSA,f=A.crypto.ECParameterDB,d=c.getName,v=ye,p=v.getVbyListEx,h=v.isASN1HEX,w=new Pc,m=null;this.type="EC",this.isPrivate=!1,this.isPublic=!1;function y(g,b,D,C){for(var F=Math.max(b.bitLength(),C.bitLength()),L=g.add2D(D),N=g.curve.getInfinity(),S=F-1;S>=0;--S)N=N.twice2D(),N.z=s.ONE,b.testBit(S)?C.testBit(S)?N=N.add2D(L):N=N.add2D(g):C.testBit(S)&&(N=N.add2D(D));return N}this.getBigRandom=function(g){return new s(g.bitLength(),w).mod(g.subtract(s.ONE)).add(s.ONE)},this.setNamedCurve=function(g){this.ecparams=f.getByName(g),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=g},this.setPrivateKeyHex=function(g){this.isPrivate=!0,this.prvKeyHex=g},this.setPublicKeyHex=function(g){this.isPublic=!0,this.pubKeyHex=g},this.getPublicKeyXYHex=function(){var g=this.pubKeyHex;if(g.substr(0,2)!=="04")throw"this method supports uncompressed format(04) only";var b=this.ecparams.keycharlen;if(g.length!==2+b*2)throw"malformed public key hex length";var D={};return D.x=g.substr(2,b),D.y=g.substr(2+b),D},this.getShortNISTPCurveName=function(){var g=this.curveName;return g==="secp256r1"||g==="NIST P-256"||g==="P-256"||g==="prime256v1"?"P-256":g==="secp384r1"||g==="NIST P-384"||g==="P-384"?"P-384":g==="secp521r1"||g==="NIST P-521"||g==="P-521"?"P-521":null},this.generateKeyPairHex=function(){var g=this.ecparams.n,b=this.getBigRandom(g),D=this.ecparams.keycharlen,C=("0000000000"+b.toString(16)).slice(-D);this.setPrivateKeyHex(C);var F=this.generatePublicKeyHex();return{ecprvhex:C,ecpubhex:F}},this.generatePublicKeyHex=function(){var g=new s(this.prvKeyHex,16),b=this.ecparams.G.multiply(g),D=b.getX().toBigInteger(),C=b.getY().toBigInteger(),F=this.ecparams.keycharlen,L=("0000000000"+D.toString(16)).slice(-F),N=("0000000000"+C.toString(16)).slice(-F),S="04"+L+N;return this.setPublicKeyHex(S),S},this.signWithMessageHash=function(g){return this.signHex(g,this.prvKeyHex)},this.signHex=function(g,b){var D=new s(b,16),C=this.ecparams.n,F=new s(g.substring(0,this.ecparams.keycharlen),16);do var L=this.getBigRandom(C),N=this.ecparams.G,S=N.multiply(L),B=S.getX().toBigInteger().mod(C);while(B.compareTo(s.ZERO)<=0);var O=L.modInverse(C).multiply(F.add(D.multiply(B))).mod(C);return c.biRSSigToASN1Sig(B,O)},this.sign=function(g,b){var D=b,C=this.ecparams.n,F=s.fromByteArrayUnsigned(g);do var L=this.getBigRandom(C),N=this.ecparams.G,S=N.multiply(L),B=S.getX().toBigInteger().mod(C);while(B.compareTo(Q.ZERO)<=0);var O=L.modInverse(C).multiply(F.add(D.multiply(B))).mod(C);return this.serializeSig(B,O)},this.verifyWithMessageHash=function(g,b){return this.verifyHex(g,b,this.pubKeyHex)},this.verifyHex=function(g,b,D){try{var C,F,L=c.parseSigHex(b);C=L.r,F=L.s;var N=u.decodeFromHex(this.ecparams.curve,D),S=new s(g.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(S,C,F,N)}catch{return!1}},this.verify=function(g,b,D){var C,F;if(Bitcoin.Util.isArray(b)){var L=this.parseSig(b);C=L.r,F=L.s}else if(typeof b=="object"&&b.r&&b.s)C=b.r,F=b.s;else throw"Invalid value for signature";var N;if(D instanceof Rt)N=D;else if(Bitcoin.Util.isArray(D))N=u.decodeFrom(this.ecparams.curve,D);else throw"Invalid format for pubkey value, must be byte array or ECPointFp";var S=s.fromByteArrayUnsigned(g);return this.verifyRaw(S,C,F,N)},this.verifyRaw=function(g,b,D,C){var F=this.ecparams.n,L=this.ecparams.G;if(b.compareTo(s.ONE)<0||b.compareTo(F)>=0||D.compareTo(s.ONE)<0||D.compareTo(F)>=0)return!1;var N=D.modInverse(F),S=g.multiply(N).mod(F),B=b.multiply(N).mod(F),O=L.multiply(S).add(C.multiply(B)),x=O.getX().toBigInteger().mod(F);return x.equals(b)},this.serializeSig=function(g,b){var D=g.toByteArraySigned(),C=b.toByteArraySigned(),F=[];return F.push(2),F.push(D.length),F=F.concat(D),F.push(2),F.push(C.length),F=F.concat(C),F.unshift(F.length),F.unshift(48),F},this.parseSig=function(g){var b;if(g[0]!=48)throw new Error("Signature not a valid DERSequence");if(b=2,g[b]!=2)throw new Error("First element in signature must be a DERInteger");var D=g.slice(b+2,b+2+g[b+1]);if(b+=2+g[b+1],g[b]!=2)throw new Error("Second element in signature must be a DERInteger");var C=g.slice(b+2,b+2+g[b+1]);b+=2+g[b+1];var F=s.fromByteArrayUnsigned(D),L=s.fromByteArrayUnsigned(C);return{r:F,s:L}},this.parseSigCompact=function(g){if(g.length!==65)throw"Signature has the wrong length";var b=g[0]-27;if(b<0||b>7)throw"Invalid signature type";var D=this.ecparams.n,C=s.fromByteArrayUnsigned(g.slice(1,33)).mod(D),F=s.fromByteArrayUnsigned(g.slice(33,65)).mod(D);return{r:C,s:F,i:b}},this.readPKCS5PrvKeyHex=function(g){if(h(g)===!1)throw new Error("not ASN.1 hex string");var b,D,C;try{b=p(g,0,["[0]",0],"06"),D=p(g,0,[1],"04");try{C=p(g,0,["[1]",0],"03")}catch{}}catch{throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=d(b),this.curveName===void 0)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(C),this.setPrivateKeyHex(D),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(g){if(h(g)===!1)throw new a("not ASN.1 hex string");var b,D,C,F;try{b=p(g,0,[1,0],"06"),D=p(g,0,[1,1],"06"),C=p(g,0,[2,0,1],"04");try{F=p(g,0,[2,0,"[1]",0],"03")}catch{}}catch{throw new a("malformed PKCS#8 plain ECC private key")}if(this.curveName=d(D),this.curveName===void 0)throw new a("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(F),this.setPrivateKeyHex(C),this.isPublic=!1},this.readPKCS8PubKeyHex=function(g){if(h(g)===!1)throw new a("not ASN.1 hex string");var b,D,C;try{b=p(g,0,[0,0],"06"),D=p(g,0,[0,1],"06"),C=p(g,0,[1],"03")}catch{throw new a("malformed PKCS#8 ECC public key")}if(this.curveName=d(D),this.curveName===null)throw new a("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(C)},this.readCertPubKeyHex=function(g,b){if(h(g)===!1)throw new a("not ASN.1 hex string");var D,C;try{D=p(g,0,[0,5,0,1],"06"),C=p(g,0,[0,5,1],"03")}catch{throw new a("malformed X.509 certificate ECC public key")}if(this.curveName=d(D),this.curveName===null)throw new a("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(C)},e!==void 0&&e.curve!==void 0&&(this.curveName=e.curve),this.curveName===void 0&&(this.curveName=t),this.setNamedCurve(this.curveName),e!==void 0&&(e.prv!==void 0&&this.setPrivateKeyHex(e.prv),e.pub!==void 0&&this.setPublicKeyHex(e.pub))};A.crypto.ECDSA.parseSigHex=function(e){var t=A.crypto.ECDSA.parseSigHexInHexRS(e),r=new Q(t.r,16),n=new Q(t.s,16);return{r,s:n}};A.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=ye,r=t.getChildIdx,n=t.getV;if(t.checkStrictDER(e,0),e.substr(0,2)!="30")throw new Error("signature is not a ASN.1 sequence");var i=r(e,0);if(i.length!=2)throw new Error("signature shall have two elements");var a=i[0],s=i[1];if(e.substr(a,2)!="02")throw new Error("1st item not ASN.1 integer");if(e.substr(s,2)!="02")throw new Error("2nd item not ASN.1 integer");var u=n(e,a),c=n(e,s);return{r:u,s:c}};A.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=A.crypto.ECDSA.parseSigHexInHexRS(e),r=t.r,n=t.s;if(r.length>=130&&r.length<=134){if(r.length%2!=0)throw Error("unknown ECDSA sig r length error");if(n.length%2!=0)throw Error("unknown ECDSA sig s length error");r.substr(0,2)=="00"&&(r=r.substr(2)),n.substr(0,2)=="00"&&(n=n.substr(2));var i=Math.max(r.length,n.length);return r=("000000"+r).slice(-i),n=("000000"+n).slice(-i),r+n}if(r.substr(0,2)=="00"&&r.length%32==2&&(r=r.substr(2)),n.substr(0,2)=="00"&&n.length%32==2&&(n=n.substr(2)),r.length%32==30&&(r="00"+r),n.length%32==30&&(n="00"+n),r.length%32!=0)throw Error("unknown ECDSA sig r length error");if(n.length%32!=0)throw Error("unknown ECDSA sig s length error");return r+n};A.crypto.ECDSA.concatSigToASN1Sig=function(e){if(e.length%4!=0)throw Error("unknown ECDSA concatinated r-s sig length error");var t=e.substr(0,e.length/2),r=e.substr(e.length/2);return A.crypto.ECDSA.hexRSSigToASN1Sig(t,r)};A.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var r=new Q(e,16),n=new Q(t,16);return A.crypto.ECDSA.biRSSigToASN1Sig(r,n)};A.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var r=A.asn1,n=new r.DERInteger({bigint:e}),i=new r.DERInteger({bigint:t}),a=new r.DERSequence({array:[n,i]});return a.tohex()};A.crypto.ECDSA.getName=function(e){return e==="2b8104001f"?"secp192k1":e==="2a8648ce3d030107"?"secp256r1":e==="2b8104000a"?"secp256k1":e==="2b81040021"?"secp224r1":e==="2b81040022"?"secp384r1":e==="2b81040023"?"secp521r1":"|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(e)!==-1?"secp256r1":"|secp256k1|".indexOf(e)!==-1?"secp256k1":"|secp224r1|NIST P-224|P-224|".indexOf(e)!==-1?"secp224r1":"|secp384r1|NIST P-384|P-384|".indexOf(e)!==-1?"secp384r1":"|secp521r1|NIST P-521|P-521|".indexOf(e)!==-1?"secp521r1":null};(typeof A>"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.ECParameterDB=new function(){var e={},t={};function r(n){return new Q(n,16)}this.getByName=function(n){var i=n;if(typeof t[i]<"u"&&(i=t[n]),typeof e[i]<"u")return e[i];throw"unregistered EC curve name: "+i},this.regist=function(n,i,a,s,u,c,f,d,v,p,h,w){e[n]={};var m=r(a),y=r(s),g=r(u),b=r(c),D=r(f),C=new Oa(m,y,g),F=C.decodePointHex("04"+d+v);e[n].name=n,e[n].keylen=i,e[n].keycharlen=Math.ceil(i/8)*2,e[n].curve=C,e[n].G=F,e[n].n=b,e[n].h=D,e[n].oid=h,e[n].info=w;for(var L=0;L"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.DSA=function(){var e=ye,t=e.getVbyList,r=e.getVbyListEx,n=e.isASN1HEX,i=Q;this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(a,s,u,c,f){this.isPrivate=!0,this.p=a,this.q=s,this.g=u,this.y=c,this.x=f},this.setPrivateHex=function(a,s,u,c,f){var d,v,p,h,w;d=new Q(a,16),v=new Q(s,16),p=new Q(u,16),typeof c=="string"&&c.length>1?h=new Q(c,16):h=null,w=new Q(f,16),this.setPrivate(d,v,p,h,w)},this.setPublic=function(a,s,u,c){this.isPublic=!0,this.p=a,this.q=s,this.g=u,this.y=c,this.x=null},this.setPublicHex=function(a,s,u,c){var f,d,v,p;f=new Q(a,16),d=new Q(s,16),v=new Q(u,16),p=new Q(c,16),this.setPublic(f,d,v,p)},this.signWithMessageHash=function(a){var s=this.p,u=this.q,c=this.g,f=this.y,d=this.x,v=A.crypto.Util.getRandomBigIntegerMinToMax(Q.ONE.add(Q.ONE),u.subtract(Q.ONE)),p=a.substr(0,u.bitLength()/4),h=new Q(p,16),w=c.modPow(v,s).mod(u),m=v.modInverse(u).multiply(h.add(d.multiply(w))).mod(u),y=A.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:w}},{int:{bigint:m}}]});return y},this.verifyWithMessageHash=function(a,s){var u=this.p,c=this.q,f=this.g,d=this.y,v=this.parseASN1Signature(s),p=v[0],h=v[1],w=a.substr(0,c.bitLength()/4),m=new Q(w,16);if(Q.ZERO.compareTo(p)>0||p.compareTo(c)>0||Q.ZERO.compareTo(h)>=0||h.compareTo(c)>0)throw"invalid DSA signature";var y=h.modInverse(c),g=m.multiply(y).mod(c),b=p.multiply(y).mod(c),D=f.modPow(g,u).multiply(d.modPow(b,u)).mod(u).mod(c);return D.compareTo(p)==0},this.parseASN1Signature=function(a){try{var s=new i(r(a,0,[0],"02"),16),u=new i(r(a,0,[1],"02"),16);return[s,u]}catch{throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(a){var s,u,c,f,d;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{s=r(a,0,[1],"02"),u=r(a,0,[2],"02"),c=r(a,0,[3],"02"),f=r(a,0,[4],"02"),d=r(a,0,[5],"02")}catch{throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(s,u,c,f,d)},this.readPKCS8PrvKeyHex=function(a){var s,u,c,f;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{s=r(a,0,[1,1,0],"02"),u=r(a,0,[1,1,1],"02"),c=r(a,0,[1,1,2],"02"),f=r(a,0,[2,0],"02")}catch{throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(s,u,c,null,f)},this.readPKCS8PubKeyHex=function(a){var s,u,c,f;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{s=r(a,0,[0,1,0],"02"),u=r(a,0,[0,1,1],"02"),c=r(a,0,[0,1,2],"02"),f=r(a,0,[1,0],"02")}catch{throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(s,u,c,f)},this.readCertPubKeyHex=function(a,s){var u,c,f,d;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{u=r(a,0,[0,5,0,1,0],"02"),c=r(a,0,[0,5,0,1,1],"02"),f=r(a,0,[0,5,0,1,2],"02"),d=r(a,0,[0,5,1,0],"02")}catch{throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(u,c,f,d)}};var vt=function(){var e=function(m,y,g){return n(Se.AES,m,y,g)},t=function(m,y,g){return n(Se.TripleDES,m,y,g)},r=function(m,y,g){return n(Se.DES,m,y,g)},n=function(m,y,g,b){var D=Se.enc.Hex.parse(y),C=Se.enc.Hex.parse(g),F=Se.enc.Hex.parse(b),L={};L.key=C,L.iv=F,L.ciphertext=D;var N=m.decrypt(L,C,{iv:F});return Se.enc.Hex.stringify(N)},i=function(m,y,g){return u(Se.AES,m,y,g)},a=function(m,y,g){return u(Se.TripleDES,m,y,g)},s=function(m,y,g){return u(Se.DES,m,y,g)},u=function(m,y,g,b){var D=Se.enc.Hex.parse(y),C=Se.enc.Hex.parse(g),F=Se.enc.Hex.parse(b),L=m.encrypt(D,C,{iv:F}),N=Se.enc.Hex.parse(L.toString()),S=Se.enc.Base64.stringify(N);return S},c={"AES-256-CBC":{proc:e,eproc:i,keylen:32,ivlen:16},"AES-192-CBC":{proc:e,eproc:i,keylen:24,ivlen:16},"AES-128-CBC":{proc:e,eproc:i,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:t,eproc:a,keylen:24,ivlen:8},"DES-CBC":{proc:r,eproc:s,keylen:8,ivlen:8}},f=function(m){return c[m].proc},d=function(m){var y=Se.lib.WordArray.random(m),g=Se.enc.Hex.stringify(y);return g},v=function(m){var y={},g=m.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));g&&(y.cipher=g[1],y.ivsalt=g[2]);var b=m.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));b&&(y.type=b[1]);var D=-1,C=0;m.indexOf(`\r \r `)!=-1&&(D=m.indexOf(`\r \r `),C=2),m.indexOf(` `)!=-1&&(D=m.indexOf(` `),C=1);var F=m.indexOf("-----END");if(D!=-1&&F!=-1){var L=m.substring(D+C*2,F-C);L=L.replace(/\s+/g,""),y.data=L}return y},p=function(m,y,g){for(var b=g.substring(0,16),D=Se.enc.Hex.parse(b),C=Se.enc.Utf8.parse(y),F=c[m].keylen+c[m].ivlen,L="",N=null;;){var S=Se.algo.MD5.create();if(N!=null&&S.update(N),S.update(C),S.update(D),N=S.finalize(),L=L+Se.enc.Hex.stringify(N),L.length>=F*2)break}var B={};return B.keyhex=L.substr(0,c[m].keylen*2),B.ivhex=L.substr(c[m].keylen*2,c[m].ivlen*2),B},h=function(m,y,g,b){var D=Se.enc.Base64.parse(m),C=Se.enc.Hex.stringify(D),F=c[y].proc,L=F(C,g,b);return L},w=function(m,y,g,b){var D=c[y].eproc,C=D(m,g,b);return C};return{version:"1.0.0",parsePKCS5PEM:function(m){return v(m)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(m,y,g){return p(m,y,g)},decryptKeyB64:function(m,y,g,b){return h(m,y,g,b)},getDecryptedKeyHex:function(m,y){var g=v(m),b=g.type,D=g.cipher,C=g.ivsalt,F=g.data,L=p(D,y,C),N=L.keyhex,S=h(F,D,N,C);return S},getEncryptedPKCS5PEMFromPrvKeyHex:function(m,y,g,b,D){var O="";if((typeof b>"u"||b==null)&&(b="AES-256-CBC"),typeof c[b]>"u")throw new Error("KEYUTIL unsupported algorithm: "+b);if(typeof D>"u"||D==null){var C=c[b].ivlen,F=d(C);D=F.toUpperCase()}var L=p(b,g,D),N=L.keyhex,S=w(y,b,N,D),B=S.replace(/(.{64})/g,`$1\r `),O="-----BEGIN "+m+` PRIVATE KEY-----\r `;return O+=`Proc-Type: 4,ENCRYPTED\r `,O+="DEK-Info: "+b+","+D+`\r `,O+=`\r `,O+=B,O+=`\r -----END `+m+` PRIVATE KEY-----\r `,O},getEncryptedPKCS8PEM:function(m,y,g){var b=this.getEncryptedPKCS8Hex(m,y,g);return _n(b,"ENCRYPTED PRIVATE KEY")},getEncryptedPKCS8Hex:function(m,y,g){var b;g==null||g==null?b={}:b=JSON.parse(JSON.stringify(g)),b.plain=m,this.initPBES2Param(b),this.encryptPBES2Param(b,y);var D=this.generatePBES2ASN1Param(b);return A.asn1.ASN1Util.newObject(D).tohex()},initPBES2Param:function(m){if(Yt(m,"encalg")==null&&(m.encalg="aes256-CBC"),Yt(m,"iter")==null&&(m.iter=2048),Yt(m,"prf")==null&&(m.prf="hmacWithSHA256"),Yt(m,"salt")==null&&(m.salt=Se.enc.Hex.stringify(Se.lib.WordArray.random(8))),Yt(m,"enciv")==null){var y;m.encalg=="des-EDE3-CBC"&&(y=8),m.encalg=="aes128-CBC"&&(y=16),m.encalg=="aes256-CBC"&&(y=16),m.enciv=Se.enc.Hex.stringify(Se.lib.WordArray.random(y))}},encryptPBES2Param:function(m,y){var g=vt.getDKFromPBES2Param(m,y);try{var b=A.crypto.Cipher.encrypt(m.plain,g,m.encalg,{iv:m.enciv})}catch{throw new Error("encrypt error: "+m.plain+" "+g+" "+m.encalg+" "+m.enciv)}m.enc=b},generatePBES2ASN1Param:function(m){var y={seq:[{seq:[{oid:"pkcs5PBES2"},{seq:[{seq:[{oid:"pkcs5PBKDF2"},{seq:[{octstr:{hex:m.salt}},{int:{hex:fE(m.iter)}}]}]},{seq:[{oid:m.encalg},{octstr:{hex:m.enciv}}]}]}]},{octstr:{hex:m.enc}}]};return m.prf!="hmacWithSHA1"&&y.seq[0].seq[1].seq[0].seq[1].seq.push({seq:[{oid:m.prf},{null:""}]}),y},parseHexOfEncryptedPKCS8:function(m){var y=ye,g=y.getChildIdx,b=y.getV,D={},C=g(m,0);if(C.length!=2)throw new Error("malformed format: SEQUENCE(0).items != 2: "+C.length);D.ciphertext=b(m,C[1]);var F=g(m,C[0]);if(F.length!=2)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+F.length);if(b(m,F[0])!="2a864886f70d01050d")throw new Error("this only supports pkcs5PBES2");var L=g(m,F[1]);if(F.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+L.length);var N=g(m,L[1]);if(N.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+N.length);if(b(m,N[0])!="2a864886f70d0307")throw"this only supports TripleDES";D.encryptionSchemeAlg="TripleDES",D.encryptionSchemeIV=b(m,N[1]);var S=g(m,L[0]);if(S.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+S.length);if(b(m,S[0])!="2a864886f70d01050c")throw new Error("this only supports pkcs5PBKDF2");var B=g(m,S[1]);if(B.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+B.length);D.pbkdf2Salt=b(m,B[0]);var O=b(m,B[1]);try{D.pbkdf2Iter=parseInt(O,16)}catch{throw new Error("malformed format pbkdf2Iter: "+O)}return D},getPBKDF2KeyHexFromParam:function(m,y){var g=Se.enc.Hex.parse(m.pbkdf2Salt),b=m.pbkdf2Iter,D=Se.PBKDF2(y,g,{keySize:192/32,iterations:b}),C=Se.enc.Hex.stringify(D);return C},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(m,y){var g=dr(m,"ENCRYPTED PRIVATE KEY"),b=this.parseHexOfEncryptedPKCS8(g),D=vt.getPBKDF2KeyHexFromParam(b,y),C={};C.ciphertext=Se.enc.Hex.parse(b.ciphertext);var F=Se.enc.Hex.parse(D),L=Se.enc.Hex.parse(b.encryptionSchemeIV),N=Se.TripleDES.decrypt(C,F,{iv:L}),S=Se.enc.Hex.stringify(N);return S},parsePBES2:function(m){var y=ye.parse(m);if(Yt(y,"seq.0.seq.0.oid")!="pkcs5PBES2"||Yt(y,"seq.0.seq.1.seq.0.seq.0.oid")!="pkcs5PBKDF2")throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var g=Yt(y,"seq.0.seq.1.seq.0.seq.1.seq");if(g==null)throw new Error("PBKDF2 parameter not found");var b=Yt(g,"0.octstr.hex"),D=Yt(g,"1.int.hex"),C=Yt(g,"2.seq.0.oid","hmacWithSHA1"),F=-1;try{F=parseInt(D,16)}catch{throw new Error("iter not proper value")}var L=Yt(y,"seq.0.seq.1.seq.1.seq.0.oid"),N=Yt(y,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),S=Yt(y,"seq.1.octstr.hex");if(L==null||N==null||S==null)throw new Error("encalg, enciv or enc is undefined");var B={salt:b,iter:F,prf:C,encalg:L,enciv:N,enc:S};return B},getDKFromPBES2Param:function(m,y){var g={hmacWithSHA1:Se.algo.SHA1,hmacWithSHA224:Se.algo.SHA224,hmacWithSHA256:Se.algo.SHA256,hmacWithSHA384:Se.algo.SHA384,hmacWithSHA512:Se.algo.SHA512},b={"des-EDE3-CBC":192/32,"aes128-CBC":128/32,"aes256-CBC":256/32},D=g[m.prf];if(D==null)throw new Error("unsupported prf");var C=b[m.encalg];if(C==null)throw new Error("unsupported encalg");var F=Se.enc.Hex.parse(m.salt),L=m.iter;try{var N=Se.PBKDF2(y,F,{keySize:C,iterations:L,hasher:D});return Se.enc.Hex.stringify(N)}catch(S){throw new Error("PBKDF2 error: "+S+" "+JSON.stringify(m)+" "+y)}},getPlainHexFromEncryptedPKCS8PEM:function(m,y){if(m.indexOf("BEGIN ENCRYPTED PRIVATE KEY")==-1)throw new Error("not Encrypted PKCS#8 PEM string");var g=dr(m),b;try{b=vt.parsePBES2(g)}catch(C){throw new Error("malformed PBES2 format: "+C.message)}var D=vt.getDKFromPBES2Param(b,y);return A.crypto.Cipher.decrypt(b.enc,D,b.encalg,{iv:b.enciv})},getKeyFromEncryptedPKCS8PEM:function(m,y){var g=this.getPlainHexFromEncryptedPKCS8PEM(m,y),b=this.getKeyFromPlainPrivatePKCS8Hex(g);return b},parsePlainPrivatePKCS8Hex:function(m){var y=ye,g=y.getChildIdx,b=y.getV,D={};if(D.algparam=null,m.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var C=g(m,0);if(C.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(m.substr(C[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var F=g(m,C[1]);if(F.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(m.substr(F[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(D.algoid=b(m,F[0]),m.substr(F[1],2)=="06"&&(D.algparam=b(m,F[1])),m.substr(C[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return D.keyidx=y.getVidx(m,C[2]),D},getKeyFromPlainPrivatePKCS8PEM:function(m){var y=dr(m,"PRIVATE KEY"),g=this.getKeyFromPlainPrivatePKCS8Hex(y);return g},getKeyFromPlainPrivatePKCS8Hex:function(m){var y=this.parsePlainPrivatePKCS8Hex(m),g;if(y.algoid=="2a864886f70d010101")g=new Je;else if(y.algoid=="2a8648ce380401")g=new A.crypto.DSA;else if(y.algoid=="2a8648ce3d0201")g=new A.crypto.ECDSA;else throw new Error("unsupported private key algorithm");return g.readPKCS8PrvKeyHex(m),g},_getKeyFromPublicPKCS8Hex:function(m){var y,g=ye.getVbyList(m,0,[0,0],"06");if(g==="2a864886f70d010101")y=new Je;else if(g==="2a8648ce380401")y=new A.crypto.DSA;else if(g==="2a8648ce3d0201")y=new A.crypto.ECDSA;else throw new Error("unsupported PKCS#8 public key hex");return y.readPKCS8PubKeyHex(m),y},parsePublicRawRSAKeyHex:function(m){var y=ye,g=y.getChildIdx,b=y.getV,D={};if(m.substr(0,2)!="30")throw new Error("malformed RSA key(code:001)");var C=g(m,0);if(C.length!=2)throw new Error("malformed RSA key(code:002)");if(m.substr(C[0],2)!="02")throw new Error("malformed RSA key(code:003)");if(D.n=b(m,C[0]),m.substr(C[1],2)!="02")throw new Error("malformed RSA key(code:004)");return D.e=b(m,C[1]),D},parsePublicPKCS8Hex:function(m){var y=ye,g=y.getChildIdx,b=y.getV,D={};D.algparam=null;var C=g(m,0);if(C.length!=2)throw new Error("outer DERSequence shall have 2 elements: "+C.length);var F=C[0];if(m.substr(F,2)!="30")throw new Error("malformed PKCS8 public key(code:001)");var L=g(m,F);if(L.length!=2)throw new Error("malformed PKCS8 public key(code:002)");if(m.substr(L[0],2)!="06")throw new Error("malformed PKCS8 public key(code:003)");if(D.algoid=b(m,L[0]),m.substr(L[1],2)=="06"?D.algparam=b(m,L[1]):m.substr(L[1],2)=="30"&&(D.algparam={},D.algparam.p=y.getVbyList(m,L[1],[0],"02"),D.algparam.q=y.getVbyList(m,L[1],[1],"02"),D.algparam.g=y.getVbyList(m,L[1],[2],"02")),m.substr(C[1],2)!="03")throw new Error("malformed PKCS8 public key(code:004)");return D.key=b(m,C[1]).substr(2),D}}}();vt.getKey=function(e,t,r){var n=ye,i=n.getChildIdx,a=n.getV,s=n.getVbyList,u=A.crypto,c=u.ECDSA,f=u.DSA,d=Je,v=dr,p=vt;if(typeof d<"u"&&e instanceof d||typeof c<"u"&&e instanceof c||typeof f<"u"&&e instanceof f)return e;if(e.curve!==void 0&&e.xy!==void 0&&e.d===void 0)return new c({pub:e.xy,curve:e.curve});if(e.curve!==void 0&&e.d!==void 0)return new c({prv:e.d,curve:e.curve});if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d===void 0){var h=new d;return h.setPublic(e.n,e.e),h}if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0&&e.p!==void 0&&e.q!==void 0&&e.dp!==void 0&&e.dq!==void 0&&e.co!==void 0&&e.qi===void 0){var h=new d;return h.setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),h}if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0&&e.p===void 0){var h=new d;return h.setPrivate(e.n,e.e,e.d),h}if(e.p!==void 0&&e.q!==void 0&&e.g!==void 0&&e.y!==void 0&&e.x===void 0){var h=new f;return h.setPublic(e.p,e.q,e.g,e.y),h}if(e.p!==void 0&&e.q!==void 0&&e.g!==void 0&&e.y!==void 0&&e.x!==void 0){var h=new f;return h.setPrivate(e.p,e.q,e.g,e.y,e.x),h}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d===void 0){var h=new d;return h.setPublic(ar(e.n),ar(e.e)),h}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0&&e.p!==void 0&&e.q!==void 0&&e.dp!==void 0&&e.dq!==void 0&&e.qi!==void 0){var h=new d;return h.setPrivateEx(ar(e.n),ar(e.e),ar(e.d),ar(e.p),ar(e.q),ar(e.dp),ar(e.dq),ar(e.qi)),h}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0){var h=new d;return h.setPrivate(ar(e.n),ar(e.e),ar(e.d)),h}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d===void 0){var w=new c({curve:e.crv}),m=w.ecparams.keycharlen,y=("0000000000"+ar(e.x)).slice(-m),g=("0000000000"+ar(e.y)).slice(-m),b="04"+y+g;return w.setPublicKeyHex(b),w}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d!==void 0){var w=new c({curve:e.crv}),m=w.ecparams.keycharlen,y=("0000000000"+ar(e.x)).slice(-m),g=("0000000000"+ar(e.y)).slice(-m),b="04"+y+g,D=("0000000000"+ar(e.d)).slice(-m);return w.setPublicKeyHex(b),w.setPrivateKeyHex(D),w}if(r==="pkcs5prv"){var C=e,n=ye,F,h;if(F=i(C,0),F.length===9)h=new d,h.readPKCS5PrvKeyHex(C);else if(F.length===6)h=new f,h.readPKCS5PrvKeyHex(C);else if(F.length>2&&C.substr(F[1],2)==="04")h=new c,h.readPKCS5PrvKeyHex(C);else throw new Error("unsupported PKCS#1/5 hexadecimal key");return h}if(r==="pkcs8prv"){var h=p.getKeyFromPlainPrivatePKCS8Hex(e);return h}if(r==="pkcs8pub")return p._getKeyFromPublicPKCS8Hex(e);if(r==="x509pub")return Ke.getPublicKeyFromCertHex(e);if(e.indexOf("-END CERTIFICATE-",0)!=-1||e.indexOf("-END X509 CERTIFICATE-",0)!=-1||e.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return Ke.getPublicKeyFromCertPEM(e);if(e.indexOf("-END PUBLIC KEY-")!=-1){var L=dr(e,"PUBLIC KEY");return p._getKeyFromPublicPKCS8Hex(L)}if(e.indexOf("-END RSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var N=v(e,"RSA PRIVATE KEY");return p.getKey(N,null,"pkcs5prv")}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var S=v(e,"DSA PRIVATE KEY"),B=s(S,0,[1],"02"),O=s(S,0,[2],"02"),x=s(S,0,[3],"02"),U=s(S,0,[4],"02"),G=s(S,0,[5],"02"),h=new f;return h.setPrivate(new Q(B,16),new Q(O,16),new Q(x,16),new Q(U,16),new Q(G,16)),h}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var N=v(e,"EC PRIVATE KEY");return p.getKey(N,null,"pkcs5prv")}if(e.indexOf("-END PRIVATE KEY-")!=-1)return p.getKeyFromPlainPrivatePKCS8PEM(e);if(e.indexOf("-END RSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var H=p.getDecryptedKeyHex(e,t),K=new Je;return K.readPKCS5PrvKeyHex(H),K}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var S=p.getDecryptedKeyHex(e,t),h=s(S,0,[1],"04"),Y=s(S,0,[2,0],"06"),ne=s(S,0,[3,0],"03").substr(2),Ce="";if(A.crypto.OID.oidhex2name[Y]!==void 0)Ce=A.crypto.OID.oidhex2name[Y];else throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+Y);var w=new c({curve:Ce});return w.setPublicKeyHex(ne),w.setPrivateKeyHex(h),w.isPublic=!1,w}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var S=p.getDecryptedKeyHex(e,t),B=s(S,0,[1],"02"),O=s(S,0,[2],"02"),x=s(S,0,[3],"02"),U=s(S,0,[4],"02"),G=s(S,0,[5],"02"),h=new f;return h.setPrivate(new Q(B,16),new Q(O,16),new Q(x,16),new Q(U,16),new Q(G,16)),h}if(e.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return p.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")};vt.generateKeypair=function(e,t){if(e=="RSA"){var r=t,n=new Je;n.generate(r,"10001"),n.isPrivate=!0,n.isPublic=!0;var i=new Je,a=n.n.toString(16),s=n.e.toString(16);i.setPublic(a,s),i.isPrivate=!1,i.isPublic=!0;var u={};return u.prvKeyObj=n,u.pubKeyObj=i,u}else if(e=="EC"){var c=t,f=new A.crypto.ECDSA({curve:c}),d=f.generateKeyPairHex(),n=new A.crypto.ECDSA({curve:c});n.setPublicKeyHex(d.ecpubhex),n.setPrivateKeyHex(d.ecprvhex),n.isPrivate=!0,n.isPublic=!1;var i=new A.crypto.ECDSA({curve:c});i.setPublicKeyHex(d.ecpubhex),i.isPrivate=!1,i.isPublic=!0;var u={};return u.prvKeyObj=n,u.pubKeyObj=i,u}else throw new Error("unknown algorithm: "+e)};vt.getPEM=function(e,t,r,n,i,a){var s=A,u=s.asn1,c=u.DERObjectIdentifier,f=u.DERInteger,d=u.ASN1Util.newObject,v=u.x509,p=v.SubjectPublicKeyInfo,h=s.crypto,w=h.DSA,m=h.ECDSA,y=Je;function g(K){var Y=d({seq:[{int:0},{int:{bigint:K.n}},{int:K.e},{int:{bigint:K.d}},{int:{bigint:K.p}},{int:{bigint:K.q}},{int:{bigint:K.dmp1}},{int:{bigint:K.dmq1}},{int:{bigint:K.coeff}}]});return Y}function b(K){var Y=d({seq:[{int:1},{octstr:{hex:K.prvKeyHex}},{tag:["a0",!0,{oid:{name:K.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+K.pubKeyHex}}]}]});return Y}function D(K){var Y=d({seq:[{int:0},{int:{bigint:K.p}},{int:{bigint:K.q}},{int:{bigint:K.g}},{int:{bigint:K.y}},{int:{bigint:K.x}}]});return Y}if((y!==void 0&&e instanceof y||w!==void 0&&e instanceof w||m!==void 0&&e instanceof m)&&e.isPublic==!0&&(t===void 0||t=="PKCS8PUB")){var C=new p(e),F=C.tohex();return _n(F,"PUBLIC KEY")}if(t=="PKCS1PRV"&&y!==void 0&&e instanceof y&&(r===void 0||r==null)&&e.isPrivate==!0){var C=g(e),F=C.tohex();return _n(F,"RSA PRIVATE KEY")}if(t=="PKCS1PRV"&&m!==void 0&&e instanceof m&&(r===void 0||r==null)&&e.isPrivate==!0){var L=new c({name:e.curveName}),N=L.tohex(),S=b(e),B=S.tohex(),O="";return O+=_n(N,"EC PARAMETERS"),O+=_n(B,"EC PRIVATE KEY"),O}if(t=="PKCS1PRV"&&w!==void 0&&e instanceof w&&(r===void 0||r==null)&&e.isPrivate==!0){var C=D(e),F=C.tohex();return _n(F,"DSA PRIVATE KEY")}if(t=="PKCS5PRV"&&y!==void 0&&e instanceof y&&r!==void 0&&r!=null&&e.isPrivate==!0){var C=g(e),F=C.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",F,r,n,a)}if(t=="PKCS5PRV"&&m!==void 0&&e instanceof m&&r!==void 0&&r!=null&&e.isPrivate==!0){var C=b(e),F=C.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",F,r,n,a)}if(t=="PKCS5PRV"&&w!==void 0&&e instanceof w&&r!==void 0&&r!=null&&e.isPrivate==!0){var C=D(e),F=C.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",F,r,n,a)}var x=function(K,Y){if(typeof Y=="string")return vt.getEncryptedPKCS8PEM(K,Y);if(typeof Y=="object"&&Yt(Y,"passcode")!=null){var ne=JSON.parse(JSON.stringify(Y)),Ce=ne.passcode;return delete ne.passcode,vt.getEncryptedPKCS8PEM(K,Ce,ne)}};if(t=="PKCS8PRV"&&y!=null&&e instanceof y&&e.isPrivate==!0){var U=g(e),G=U.tohex(),C=d({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:G}}]}),F=C.tohex();return r===void 0||r==null?_n(F,"PRIVATE KEY"):x(F,r)}if(t=="PKCS8PRV"&&m!==void 0&&e instanceof m&&e.isPrivate==!0){var H={seq:[{int:1},{octstr:{hex:e.prvKeyHex}}]};typeof e.pubKeyHex=="string"&&H.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]});var U=new d(H),G=U.tohex(),C=d({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:G}}]}),F=C.tohex();return r===void 0||r==null?_n(F,"PRIVATE KEY"):x(F,r)}if(t=="PKCS8PRV"&&w!==void 0&&e instanceof w&&e.isPrivate==!0){var U=new f({bigint:e.x}),G=U.tohex(),C=d({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:G}}]}),F=C.tohex();return r===void 0||r==null?_n(F,"PRIVATE KEY"):x(F,r)}throw new Error("unsupported object nor format")};vt.getKeyFromCSRPEM=function(e){var t=dr(e,"CERTIFICATE REQUEST"),r=vt.getKeyFromCSRHex(t);return r};vt.getKeyFromCSRHex=function(e){var t=vt.parseCSRHex(e),r=vt.getKey(t.p8pubkeyhex,null,"pkcs8pub");return r};vt.parseCSRHex=function(e){var t=ye,r=t.getChildIdx,n=t.getTLV,i={},a=e;if(a.substr(0,2)!="30")throw new Error("malformed CSR(code:001)");var s=r(a,0);if(s.length<1)throw new Error("malformed CSR(code:002)");if(a.substr(s[0],2)!="30")throw new Error("malformed CSR(code:003)");var u=r(a,s[0]);if(u.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=n(a,u[2]),i};vt.getKeyID=function(e){var t=vt,r=ye;typeof e=="string"&&e.indexOf("BEGIN ")!=-1&&(e=t.getKey(e));var n=dr(t.getPEM(e)),i=r.getIdxbyList(n,0,[1]),a=r.getV(n,i).substring(2);return A.crypto.Util.hashHex(a,"sha1")};vt.getJWK=function(e,t,r,n,i){var a,s={},u,c=A.crypto.Util.hashHex;if(typeof e=="string")a=vt.getKey(e),e.indexOf("CERTIFICATE")!=-1&&(u=dr(e));else if(typeof e=="object")e instanceof Ke?(a=e.getPublicKey(),u=e.hex):a=e;else throw new Error("unsupported keyinfo type");if(a instanceof Je&&a.isPrivate)s.kty="RSA",s.n=Ur(a.n.toString(16)),s.e=Ur(a.e.toString(16)),s.d=Ur(a.d.toString(16)),s.p=Ur(a.p.toString(16)),s.q=Ur(a.q.toString(16)),s.dp=Ur(a.dmp1.toString(16)),s.dq=Ur(a.dmq1.toString(16)),s.qi=Ur(a.coeff.toString(16));else if(a instanceof Je&&a.isPublic)s.kty="RSA",s.n=Ur(a.n.toString(16)),s.e=Ur(a.e.toString(16));else if(a instanceof A.crypto.ECDSA&&a.isPrivate){var f=a.getShortNISTPCurveName();if(f!=="P-256"&&f!=="P-384"&&f!=="P-521")throw new Error("unsupported curve name for JWT: "+f);var d=a.getPublicKeyXYHex();s.kty="EC",s.crv=f,s.x=Ur(d.x),s.y=Ur(d.y),s.d=Ur(a.prvKeyHex)}else if(a instanceof A.crypto.ECDSA&&a.isPublic){var f=a.getShortNISTPCurveName();if(f!=="P-256"&&f!=="P-384"&&f!=="P-521")throw new Error("unsupported curve name for JWT: "+f);var d=a.getPublicKeyXYHex();s.kty="EC",s.crv=f,s.x=Ur(d.x),s.y=Ur(d.y)}if(s.kty==null)throw new Error("unsupported keyinfo");return!a.isPrivate&&t!=!0&&(s.kid=A.jws.JWS.getJWKthumbprint(s)),u!=null&&r!=!0&&(s.x5c=[Ta(u)]),u!=null&&n!=!0&&(s.x5t=Fc(Ta(c(u,"sha1")))),u!=null&&i!=!0&&(s["x5t#S256"]=Fc(Ta(c(u,"sha256")))),s};vt.getJWKFromKey=function(e){return vt.getJWK(e,!0,!0,!0,!0)};Je.getPosArrayOfChildrenFromHex=function(e){return ye.getChildIdx(e,0)};Je.getHexValueArrayOfChildrenFromHex=function(e){var t=ye,r=t.getV,p=Je.getPosArrayOfChildrenFromHex(e),n=r(e,p[0]),i=r(e,p[1]),a=r(e,p[2]),s=r(e,p[3]),u=r(e,p[4]),c=r(e,p[5]),f=r(e,p[6]),d=r(e,p[7]),v=r(e,p[8]),p=new Array;return p.push(n,i,a,s,u,c,f,d,v),p};Je.prototype.readPrivateKeyFromPEMString=function(e){var t=dr(e),r=Je.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])};Je.prototype.readPKCS5PrvKeyHex=function(e){var t=Je.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])};Je.prototype.readPKCS8PrvKeyHex=function(e){var t,r,n,i,a,s,u,c,f=ye,d=f.getVbyListEx;if(f.isASN1HEX(e)===!1)throw new Error("not ASN.1 hex string");try{t=d(e,0,[2,0,1],"02"),r=d(e,0,[2,0,2],"02"),n=d(e,0,[2,0,3],"02"),i=d(e,0,[2,0,4],"02"),a=d(e,0,[2,0,5],"02"),s=d(e,0,[2,0,6],"02"),u=d(e,0,[2,0,7],"02"),c=d(e,0,[2,0,8],"02")}catch{throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,r,n,i,a,s,u,c)};Je.prototype.readPKCS5PubKeyHex=function(e){var t=ye,r=t.getV;if(t.isASN1HEX(e)===!1)throw new Error("keyHex is not ASN.1 hex string");var n=t.getChildIdx(e,0);if(n.length!==2||e.substr(n[0],2)!=="02"||e.substr(n[1],2)!=="02")throw new Error("wrong hex for PKCS#5 public key");var i=r(e,n[0]),a=r(e,n[1]);this.setPublic(i,a)};Je.prototype.readPKCS8PubKeyHex=function(e){var t=ye;if(t.isASN1HEX(e)===!1)throw new Error("not ASN.1 hex string");if(t.getTLVbyListEx(e,0,[0,0])!=="06092a864886f70d010101")throw new Error("not PKCS8 RSA public key");var r=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(r)};Je.prototype.readCertPubKeyHex=function(e,t){var r,n;r=new Ke,r.readCertHex(e),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)};var iV=new RegExp("[^0-9a-f]","gi");function gE(e,t){for(var r="",n=t/4-e.length,i=0;i>24,(i&16711680)>>16,(i&65280)>>8,i&255])))),i+=1;return n}Je.prototype.signPSS=function(e,t,r){var n=function(a){return A.crypto.Util.hashHex(a,t)},i=n(ks(e));return r===void 0&&(r=-1),this.signWithMessageHashPSS(i,t,r)};Je.prototype.signWithMessageHashPSS=function(e,t,r){var n=hi(e),i=n.length,a=this.n.bitLength()-1,s=Math.ceil(a/8),u,c=function(y){return A.crypto.Util.hashHex(y,t)};if(r===-1||r===void 0)r=i;else if(r===-2)r=s-i-2;else if(r<-2)throw new Error("invalid salt length");if(s0&&(f=new Array(r),new Pc().nextBytes(f),f=String.fromCharCode.apply(String,f));var d=hi(c(ks("\0\0\0\0\0\0\0\0"+n+f))),v=[];for(u=0;u>8*s-a&255;for(w[0]&=~m,u=0;un)return!1;var i=this.doPublic(r),a=i.toString(16);if(a.length+3!=n/4)return!1;var s=a.replace(/^1f+00/,""),u=vE(s);if(u.length==0)return!1;var c=u[0],f=u[1],d=function(p){return A.crypto.Util.hashString(p,c)},v=d(e);return f==v};Je.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=li(t,16);if(r.bitLength()>this.n.bitLength())return 0;var n=this.doPublic(r),i=n.toString(16).replace(/^1f+00/,""),a=vE(i);if(a.length==0)return!1;var s=a[0],u=a[1];return u==e};Je.prototype.verifyPSS=function(e,t,r,n){var i=function(s){return A.crypto.Util.hashHex(s,r)},a=i(ks(e));return n===void 0&&(n=-1),this.verifyWithMessageHashPSS(a,t,r,n)};Je.prototype.verifyWithMessageHashPSS=function(e,t,r,n){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=new Q(t,16),a=function(b){return A.crypto.Util.hashHex(b,r)},s=hi(e),u=s.length,c=this.n.bitLength()-1,f=Math.ceil(c/8),d;if(n===-1||n===void 0)n=u;else if(n===-2)n=f-u-2;else if(n<-2)throw new Error("invalid salt length");if(f>8*f-c&255;if(p.charCodeAt(0)&w)throw new Error("bits beyond keysize not zero");var m=mE(h,p.length,a),y=[];for(d=0;d0?B:void 0}catch{return}},this._asn1ToNoticeRef=function(S){try{for(var B={},O=Yt(S,"seq"),x=0;x0?B:void 0}catch{return}},this._asn1ToNoticeNum=function(S){try{for(var B=Yt(S,"seq"),O=[],x=0;x1){var G=s(S,U[1]),H=this.getGeneralName(G);H.uri!=null&&(x.uri=H.uri)}if(U.length>2){var K=s(S,U[2]);K=="0101ff"&&(x.reqauth=!0),K=="010100"&&(x.reqauth=!1)}return x},this.getExtSubjectDirectoryAttributes=function(S,B){if(S===void 0&&B===void 0){var O=this.getExtInfo("subjectDirectoryAttributes");if(O===void 0)return;S=s(this.hex,O.vidx),B=O.critical}var x={extname:"subjectDirectoryAttributes"};B&&(x.critical=!0);try{for(var U=a(S),G=[],H=0;H0&&(B.ext=this.getExtParamArray()),B.sighex=this.getSignatureValueHex(),S.tbshex==!0&&(B.tbshex=f(this.hex,0,[0])),S.nodnarray==!0&&(delete B.issuer.array,delete B.subject.array),B},this.getExtParamArray=function(S){if(S==null){var B=p(this.hex,0,[0,"[3]"]);B!=-1&&(S=d(this.hex,0,[0,"[3]",0],"30"))}for(var O=[],x=r(S,0),U=0;U"u"||!A)&&(A={});(typeof A.jws>"u"||!A.jws)&&(A.jws={});A.jws.JWS=function(){var e=A,t=e.jws.JWS,r=t.isSafeJSONString;this.parseJWS=function(n,i){if(!(this.parsedJWS!==void 0&&(i||this.parsedJWS.sigvalH!==void 0))){var a=n.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(a==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var s=a[1],u=a[2],c=a[3],f=s+"."+u;if(this.parsedJWS={},this.parsedJWS.headB64U=s,this.parsedJWS.payloadB64U=u,this.parsedJWS.sigvalB64U=c,this.parsedJWS.si=f,!i){var d=ar(c),v=li(d,16);this.parsedJWS.sigvalH=d,this.parsedJWS.sigvalBI=v}var p=os(s),h=os(u);if(this.parsedJWS.headS=p,this.parsedJWS.payloadS=h,!r(p,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+p}}};A.jws.JWS.sign=function(e,t,r,n,i){var a=A,s=a.jws,u=s.JWS,c=u.readSafeJSONString,f=u.isSafeJSONString,d=a.crypto,v=d.ECDSA,p=d.Mac,h=d.Signature,w=JSON,m,y,g;if(typeof t!="string"&&typeof t!="object")throw"spHeader must be JSON string or object: "+t;if(typeof t=="object"&&(y=t,m=w.stringify(y)),typeof t=="string"){if(m=t,!f(m))throw"JWS Head is not safe JSON string: "+m;y=c(m)}if(g=r,typeof r=="object"&&(g=w.stringify(r)),(e==""||e==null)&&y.alg!==void 0&&(e=y.alg),e!=""&&e!=null&&y.alg===void 0&&(y.alg=e,m=w.stringify(y)),e!==y.alg)throw"alg and sHeader.alg doesn't match: "+e+"!="+y.alg;var b=null;if(u.jwsalg2sigalg[e]===void 0)throw"unsupported alg name: "+e;b=u.jwsalg2sigalg[e];var D=Jl(m),C=Jl(g),F=D+"."+C,L="";if(b.substr(0,4)=="Hmac"){if(n===void 0)throw"mac key shall be specified for HS* alg";var N=new p({alg:b,prov:"cryptojs",pass:n});N.updateString(F),L=N.doFinal()}else if(b.indexOf("withECDSA")!=-1){var S=new h({alg:b});S.init(n,i),S.updateString(F);var B=S.sign();L=A.crypto.ECDSA.asn1SigToConcatSig(B)}else if(b!="none"){var S=new h({alg:b});S.init(n,i),S.updateString(F),L=S.sign()}var O=Ur(L);return F+"."+O};A.jws.JWS.verify=function(e,t,r){var n=A,i=n.jws,a=i.JWS,s=a.readSafeJSONString,u=n.crypto,c=u.ECDSA,f=u.Mac,d=u.Signature,v;if(typeof Je!==void 0&&(v=Je),!sg(e))return!1;var p=e.split(".");if(p.length!==3)return!1;var h=p[0],w=p[1],m=h+"."+w,y=ar(p[2]),g=s(os(p[0])),b=null,D=null;if(g.alg===void 0)throw"algorithm not specified in header";if(b=g.alg,D=b.substr(0,2),r!=null&&Object.prototype.toString.call(r)==="[object Array]"&&r.length>0){var C=":"+r.join(":")+":";if(C.indexOf(":"+b+":")==-1)throw"algorithm '"+b+"' not accepted in the list"}if(b!="none"&&t===null)throw"key shall be specified to verify.";if(typeof t=="string"&&t.indexOf("-----BEGIN ")!=-1&&(t=vt.getKey(t)),(D=="RS"||D=="PS")&&!(t instanceof v))throw"key shall be a RSAKey obj for RS* and PS* algs";if(D=="ES"&&!(t instanceof c))throw"key shall be a ECDSA obj for ES* algs";b=="none";var F=null;if(a.jwsalg2sigalg[g.alg]===void 0)throw"unsupported alg name: "+b;if(F=a.jwsalg2sigalg[b],F=="none")throw"not supported";if(F.substr(0,4)=="Hmac"){var L=null;if(t===void 0)throw"hexadecimal key shall be specified for HMAC";var N=new f({alg:F,pass:t});return N.updateString(m),L=N.doFinal(),y==L}else if(F.indexOf("withECDSA")!=-1){var S=null;try{S=c.concatSigToASN1Sig(y)}catch{return!1}var B=new d({alg:F});return B.init(t),B.updateString(m),B.verify(S)}else{var B=new d({alg:F});return B.init(t),B.updateString(m),B.verify(y)}};A.jws.JWS.parse=function(e){var t=e.split("."),r={},n,i,a;if(t.length!=2&&t.length!=3)throw"malformed sJWS: wrong number of '.' splitted elements";return n=t[0],i=t[1],t.length==3&&(a=t[2]),r.headerObj=A.jws.JWS.readSafeJSONString(os(n)),r.payloadObj=A.jws.JWS.readSafeJSONString(os(i)),r.headerPP=JSON.stringify(r.headerObj,null," "),r.payloadObj==null?r.payloadPP=os(i):r.payloadPP=JSON.stringify(r.payloadObj,null," "),a!==void 0&&(r.sigHex=ar(a)),r};A.jws.JWS.verifyJWT=function(e,t,r){var n=A,i=n.jws,a=i.JWS,s=a.readSafeJSONString,u=a.inArray,c=a.includedArray;if(!sg(e))return!1;var f=e.split(".");if(f.length!=3)return!1;var d=f[0],v=f[1],p=d+"."+v,h=ar(f[2]),w=s(os(d)),m=s(os(v));if(w.alg===void 0)return!1;if(r.alg===void 0)throw"acceptField.alg shall be specified";if(!u(w.alg,r.alg)||m.iss!==void 0&&typeof r.iss=="object"&&!u(m.iss,r.iss)||m.sub!==void 0&&typeof r.sub=="object"&&!u(m.sub,r.sub))return!1;if(m.aud!==void 0&&typeof r.aud=="object"){if(typeof m.aud=="string"){if(!u(m.aud,r.aud))return!1}else if(typeof m.aud=="object"&&!c(m.aud,r.aud))return!1}var y=i.IntDate.getNow();return r.verifyAt!==void 0&&typeof r.verifyAt=="number"&&(y=r.verifyAt),(r.gracePeriod===void 0||typeof r.gracePeriod!="number")&&(r.gracePeriod=0),!(m.exp!==void 0&&typeof m.exp=="number"&&m.exp+r.gracePeriod"u"||!A)&&(A={});(typeof A.jws>"u"||!A.jws)&&(A.jws={});A.jws.JWSJS=function(){var e=A,t=e.jws,r=t.JWS,n=r.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(i){this.init();var a=i.split(".");if(a.length!=3)throw"malformed input JWS";this.aHeader.push(a[0]),this.sPayload=a[1],this.aSignature.push(a[2])},this.addSignature=function(i,a,s,u){if(this.sPayload===void 0||this.sPayload===null)throw"there's no JSON-JS signature to add.";var c=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var f=A.jws.JWS.sign(i,a,this.sPayload,s,u),d=f.split("."),v=d[0],p=d[2];this.aHeader.push(d[0]),this.aSignature.push(d[2])}catch(h){throw this.aHeader.length>c&&this.aHeader.pop(),this.aSignature.length>c&&this.aSignature.pop(),"addSignature failed: "+h}},this.verifyAll=function(i){if(this.aHeader.length!==i.length||this.aSignature.length!==i.length)return!1;for(var a=0;a0)this.aHeader=i.headers;else throw"malformed header";if(typeof i.payload=="string")this.sPayload=i.payload;else throw"malformed signatures";if(i.signatures.length>0)this.aSignature=i.signatures;else throw"malformed signatures"}catch(s){throw"malformed JWS-JS JSON object: "+s}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return this.aHeader.length==0?1:0}};_e.SecureRandom=Pc;_e.rng_seed_time=eg;_e.BigInteger=Q;_e.RSAKey=Je;_e.ECDSA=A.crypto.ECDSA;_e.DSA=A.crypto.DSA;_e.Signature=A.crypto.Signature;_e.MessageDigest=A.crypto.MessageDigest;_e.Mac=A.crypto.Mac;_e.KEYUTIL=vt;_e.ASN1HEX=ye;_e.X509=Ke;_e.X509CRL=u$;_e.CryptoJS=Se;_e.b64tohex=Sc;_e.b64toBA=JA;_e.ECFieldElementFp=jr;_e.ECPointFp=Rt;_e.ECCurveFp=Oa;_e.stoBA=iE;_e.BAtos=sE;_e.BAtohex=b0;_e.stohex=fi;_e.stob64=HP;_e.stob64u=MP;_e.b64utos=qP;_e.b64tob64u=Fc;_e.b64utob64=ef;_e.hex2b64=Ta;_e.hextob64u=Ur;_e.b64utohex=ar;_e.utf8tob64u=Jl;_e.b64utoutf8=os;_e.utf8tob64=VP;_e.b64toutf8=KP;_e.utf8tohex=y0;_e.hextoutf8=jt;_e.hextorstr=hi;_e.rstrtohex=ks;_e.hextob64=tg;_e.hextob64nl=YP;_e.b64nltohex=aE;_e.hextopem=_n;_e.pemtohex=dr;_e.hextoArrayBuffer=ZP;_e.ArrayBuffertohex=JP;_e.zulutomsec=rg;_e.msectozulu=QP;_e.zulutosec=uE;_e.zulutodate=e$;_e.datetozulu=t$;_e.uricmptohex=C0;_e.hextouricmp=D0;_e.ipv6tohex=Y1;_e.hextoipv6=W1;_e.hextoip=m0;_e.iptohex=ng;_e.ucs2hextoutf8=ig;_e.encodeURIComponentAll=F0;_e.newline_toUnix=r$;_e.newline_toDos=n$;_e.hextoposhex=X1;_e.intarystrtohex=i$;_e.strdiffidx=s$;_e.oidtohex=lE;_e.hextooid=S0;_e.strpad=v0;_e.bitstrtoint=hE;_e.inttobitstr=dE;_e.bitstrtobinstr=pE;_e.binstrtobitstr=a$;_e.isBase64URLDot=sg;_e.namearraytobinstr=w0;_e.extendClass=pe;_e.foldnl=_0;_e.b64topem=WP;_e.pemtob64=XP;_e.timeogen=oE;_e.aryval=Yt;_e.inttohex=fE;_e.twoscompl=tf;_e.KJUR=A;_e.crypto=A.crypto;_e.asn1=A.asn1;_e.jws=A.jws;_e.lang=A.lang;_e.VERSION=m9;_e.VERSION_FULL=v9});var bo=he((uV,Eo)=>{"use strict";function EE(e){return typeof e>"u"||e===null}function c$(e){return typeof e=="object"&&e!==null}function l$(e){return Array.isArray(e)?e:EE(e)?[]:[e]}function f$(e,t){var r,n,i,a;if(t)for(a=Object.keys(t),r=0,n=a.length;r{"use strict";function rf(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}rf.prototype=Object.create(Error.prototype);rf.prototype.constructor=rf;rf.prototype.toString=function(t){var r=this.name+": ";return r+=this.reason||"(unknown reason)",!t&&this.mark&&(r+=" "+this.mark.toString()),r};bE.exports=rf});var CE=he((cV,_E)=>{"use strict";var yE=bo();function ug(e,t,r,n,i){this.name=e,this.buffer=t,this.position=r,this.line=n,this.column=i}ug.prototype.getSnippet=function(t,r){var n,i,a,s,u;if(!this.buffer)return null;for(t=t||4,r=r||75,n="",i=this.position;i>0&&`\0\r \x85\u2028\u2029`.indexOf(this.buffer.charAt(i-1))===-1;)if(i-=1,this.position-i>r/2-1){n=" ... ",i+=5;break}for(a="",s=this.position;sr/2-1){a=" ... ",s-=5;break}return u=this.buffer.slice(i,s),yE.repeat(" ",t)+n+u+a+` `+yE.repeat(" ",t+this.position-i+n.length)+"^"};ug.prototype.toString=function(t){var r,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),t||(r=this.getSnippet(),r&&(n+=`: `+r)),n};_E.exports=ug});var Hr=he((lV,FE)=>{"use strict";var DE=$c(),p$=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],g$=["scalar","sequence","mapping"];function m$(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(n){t[String(n)]=r})}),t}function v$(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(p$.indexOf(r)===-1)throw new DE('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(r){return r},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=m$(t.styleAliases||null),g$.indexOf(this.kind)===-1)throw new DE('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}FE.exports=v$});var yo=he((fV,IE)=>{"use strict";var SE=bo(),I0=$c(),w$=Hr();function og(e,t,r){var n=[];return e.include.forEach(function(i){r=og(i,t,r)}),e[t].forEach(function(i){r.forEach(function(a,s){a.tag===i.tag&&a.kind===i.kind&&n.push(s)}),r.push(i)}),r.filter(function(i,a){return n.indexOf(a)===-1})}function A$(){var e={scalar:{},sequence:{},mapping:{},fallback:{}},t,r;function n(i){e[i.kind][i.tag]=e.fallback[i.tag]=i}for(t=0,r=arguments.length;t{"use strict";var E$=Hr();BE.exports=new E$("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}})});var xE=he((dV,$E)=>{"use strict";var b$=Hr();$E.exports=new b$("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}})});var TE=he((pV,RE)=>{"use strict";var y$=Hr();RE.exports=new y$("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}})});var B0=he((gV,OE)=>{"use strict";var _$=yo();OE.exports=new _$({explicit:[PE(),xE(),TE()]})});var NE=he((mV,kE)=>{"use strict";var C$=Hr();function D$(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function F$(){return null}function S$(e){return e===null}kE.exports=new C$("tag:yaml.org,2002:null",{kind:"scalar",resolve:D$,construct:F$,predicate:S$,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var UE=he((vV,LE)=>{"use strict";var I$=Hr();function B$(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function P$(e){return e==="true"||e==="True"||e==="TRUE"}function $$(e){return Object.prototype.toString.call(e)==="[object Boolean]"}LE.exports=new I$("tag:yaml.org,2002:bool",{kind:"scalar",resolve:B$,construct:P$,predicate:$$,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})});var HE=he((wV,jE)=>{"use strict";var x$=bo(),R$=Hr();function T$(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function O$(e){return 48<=e&&e<=55}function k$(e){return 48<=e&&e<=57}function N$(e){if(e===null)return!1;var t=e.length,r=0,n=!1,i;if(!t)return!1;if(i=e[r],(i==="-"||i==="+")&&(i=e[++r]),i==="0"){if(r+1===t)return!0;if(i=e[++r],i==="b"){for(r++;r=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var VE=he((AV,qE)=>{"use strict";var ME=bo(),j$=Hr(),H$=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function M$(e){return!(e===null||!H$.test(e)||e[e.length-1]==="_")}function q$(e){var t,r,n,i;return t=e.replace(/_/g,"").toLowerCase(),r=t[0]==="-"?-1:1,i=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:t.indexOf(":")>=0?(t.split(":").forEach(function(a){i.unshift(parseFloat(a,10))}),t=0,n=1,i.forEach(function(a){t+=a*n,n*=60}),r*t):r*parseFloat(t,10)}var V$=/^[-+]?[0-9]+e/;function K$(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(ME.isNegativeZero(e))return"-0.0";return r=e.toString(10),V$.test(r)?r.replace("e",".e"):r}function z$(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||ME.isNegativeZero(e))}qE.exports=new j$("tag:yaml.org,2002:float",{kind:"scalar",resolve:M$,construct:q$,predicate:z$,represent:K$,defaultStyle:"lowercase"})});var cg=he((EV,KE)=>{"use strict";var G$=yo();KE.exports=new G$({include:[B0()],implicit:[NE(),UE(),HE(),VE()]})});var lg=he((bV,zE)=>{"use strict";var Y$=yo();zE.exports=new Y$({include:[cg()]})});var XE=he((yV,WE)=>{"use strict";var W$=Hr(),GE=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),YE=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function X$(e){return e===null?!1:GE.exec(e)!==null||YE.exec(e)!==null}function Z$(e){var t,r,n,i,a,s,u,c=0,f=null,d,v,p;if(t=GE.exec(e),t===null&&(t=YE.exec(e)),t===null)throw new Error("Date resolve error");if(r=+t[1],n=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(r,n,i));if(a=+t[4],s=+t[5],u=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(d=+t[10],v=+(t[11]||0),f=(d*60+v)*6e4,t[9]==="-"&&(f=-f)),p=new Date(Date.UTC(r,n,i,a,s,u,c)),f&&p.setTime(p.getTime()-f),p}function J$(e){return e.toISOString()}WE.exports=new W$("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:X$,construct:Z$,instanceOf:Date,represent:J$})});var JE=he((_V,ZE)=>{"use strict";var Q$=Hr();function ex(e){return e==="<<"||e===null}ZE.exports=new Q$("tag:yaml.org,2002:merge",{kind:"scalar",resolve:ex})});var tb=he((CV,eb)=>{"use strict";var _o;try{QE=go,_o=QE("buffer").Buffer}catch{}var QE,tx=Hr(),fg=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= \r`;function rx(e){if(e===null)return!1;var t,r,n=0,i=e.length,a=fg;for(r=0;r64)){if(t<0)return!1;n+=6}return n%8===0}function nx(e){var t,r,n=e.replace(/[\r\n=]/g,""),i=n.length,a=fg,s=0,u=[];for(t=0;t>16&255),u.push(s>>8&255),u.push(s&255)),s=s<<6|a.indexOf(n.charAt(t));return r=i%4*6,r===0?(u.push(s>>16&255),u.push(s>>8&255),u.push(s&255)):r===18?(u.push(s>>10&255),u.push(s>>2&255)):r===12&&u.push(s>>4&255),_o?_o.from?_o.from(u):new _o(u):u}function ix(e){var t="",r=0,n,i,a=e.length,s=fg;for(n=0;n>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]),r=(r<<8)+e[n];return i=a%3,i===0?(t+=s[r>>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]):i===2?(t+=s[r>>10&63],t+=s[r>>4&63],t+=s[r<<2&63],t+=s[64]):i===1&&(t+=s[r>>2&63],t+=s[r<<4&63],t+=s[64],t+=s[64]),t}function sx(e){return _o&&_o.isBuffer(e)}eb.exports=new tx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:rx,construct:nx,predicate:sx,represent:ix})});var nb=he((FV,rb)=>{"use strict";var ax=Hr(),ux=Object.prototype.hasOwnProperty,ox=Object.prototype.toString;function cx(e){if(e===null)return!0;var t=[],r,n,i,a,s,u=e;for(r=0,n=u.length;r{"use strict";var fx=Hr(),hx=Object.prototype.toString;function dx(e){if(e===null)return!0;var t,r,n,i,a,s=e;for(a=new Array(s.length),t=0,r=s.length;t{"use strict";var gx=Hr(),mx=Object.prototype.hasOwnProperty;function vx(e){if(e===null)return!0;var t,r=e;for(t in r)if(mx.call(r,t)&&r[t]!==null)return!1;return!0}function wx(e){return e!==null?e:{}}ab.exports=new gx("tag:yaml.org,2002:set",{kind:"mapping",resolve:vx,construct:wx})});var Rc=he((BV,ob)=>{"use strict";var Ax=yo();ob.exports=new Ax({include:[lg()],implicit:[XE(),JE()],explicit:[tb(),nb(),sb(),ub()]})});var lb=he((PV,cb)=>{"use strict";var Ex=Hr();function bx(){return!0}function yx(){}function _x(){return""}function Cx(e){return typeof e>"u"}cb.exports=new Ex("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:bx,construct:yx,predicate:Cx,represent:_x})});var hb=he(($V,fb)=>{"use strict";var Dx=Hr();function Fx(e){if(e===null||e.length===0)return!1;var t=e,r=/\/([gim]*)$/.exec(e),n="";return!(t[0]==="/"&&(r&&(n=r[1]),n.length>3||t[t.length-n.length-1]!=="/"))}function Sx(e){var t=e,r=/\/([gim]*)$/.exec(e),n="";return t[0]==="/"&&(r&&(n=r[1]),t=t.slice(1,t.length-n.length-1)),new RegExp(t,n)}function Ix(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}function Bx(e){return Object.prototype.toString.call(e)==="[object RegExp]"}fb.exports=new Dx("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:Fx,construct:Sx,predicate:Bx,represent:Ix})});var gb=he((xV,pb)=>{"use strict";var P0;try{db=go,P0=db("esprima")}catch{typeof window<"u"&&(P0=window.esprima)}var db,Px=Hr();function $x(e){if(e===null)return!1;try{var t="("+e+")",r=P0.parse(t,{range:!0});return!(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")}catch{return!1}}function xx(e){var t="("+e+")",r=P0.parse(t,{range:!0}),n=[],i;if(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")throw new Error("Failed to resolve function");return r.body[0].expression.params.forEach(function(a){n.push(a.name)}),i=r.body[0].expression.body.range,r.body[0].expression.body.type==="BlockStatement"?new Function(n,t.slice(i[0]+1,i[1]-1)):new Function(n,"return "+t.slice(i[0],i[1]))}function Rx(e){return e.toString()}function Tx(e){return Object.prototype.toString.call(e)==="[object Function]"}pb.exports=new Px("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:$x,construct:xx,predicate:Tx,represent:Rx})});var nf=he((TV,vb)=>{"use strict";var mb=yo();vb.exports=mb.DEFAULT=new mb({include:[Rc()],explicit:[lb(),hb(),gb()]})});var kb=he((OV,sf)=>{"use strict";var ka=bo(),Cb=$c(),Ox=CE(),Db=Rc(),kx=nf(),Su=Object.prototype.hasOwnProperty,$0=1,Fb=2,Sb=3,x0=4,hg=1,Nx=2,wb=3,Lx=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Ux=/[\x85\u2028\u2029]/,jx=/[,\[\]\{\}]/,Ib=/^(?:!|!!|![a-z\-]+!)$/i,Bb=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Ab(e){return Object.prototype.toString.call(e)}function Ns(e){return e===10||e===13}function Do(e){return e===9||e===32}function di(e){return e===9||e===32||e===10||e===13}function Tc(e){return e===44||e===91||e===93||e===123||e===125}function Hx(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function Mx(e){return e===120?2:e===117?4:e===85?8:0}function qx(e){return 48<=e&&e<=57?e-48:-1}function Eb(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?` `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function Vx(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var Pb=new Array(256),$b=new Array(256);for(Co=0;Co<256;Co++)Pb[Co]=Eb(Co)?1:0,$b[Co]=Eb(Co);var Co;function Kx(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||kx,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function xb(e,t){return new Cb(t,new Ox(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function Ge(e,t){throw xb(e,t)}function R0(e,t){e.onWarning&&e.onWarning.call(null,xb(e,t))}var bb={YAML:function(t,r,n){var i,a,s;t.version!==null&&Ge(t,"duplication of %YAML directive"),n.length!==1&&Ge(t,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&Ge(t,"ill-formed argument of the YAML directive"),a=parseInt(i[1],10),s=parseInt(i[2],10),a!==1&&Ge(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&R0(t,"unsupported YAML version of the document")},TAG:function(t,r,n){var i,a;n.length!==2&&Ge(t,"TAG directive accepts exactly two arguments"),i=n[0],a=n[1],Ib.test(i)||Ge(t,"ill-formed tag handle (first argument) of the TAG directive"),Su.call(t.tagMap,i)&&Ge(t,'there is a previously declared suffix for "'+i+'" tag handle'),Bb.test(a)||Ge(t,"ill-formed tag prefix (second argument) of the TAG directive"),t.tagMap[i]=a}};function Fu(e,t,r,n){var i,a,s,u;if(t1&&(e.result+=ka.repeat(` `,t-1))}function zx(e,t,r){var n,i,a,s,u,c,f,d,v=e.kind,p=e.result,h;if(h=e.input.charCodeAt(e.position),di(h)||Tc(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(i=e.input.charCodeAt(e.position+1),di(i)||r&&Tc(i)))return!1;for(e.kind="scalar",e.result="",a=s=e.position,u=!1;h!==0;){if(h===58){if(i=e.input.charCodeAt(e.position+1),di(i)||r&&Tc(i))break}else if(h===35){if(n=e.input.charCodeAt(e.position-1),di(n))break}else{if(e.position===e.lineStart&&T0(e)||r&&Tc(h))break;if(Ns(h))if(c=e.line,f=e.lineStart,d=e.lineIndent,Rr(e,!1,-1),e.lineIndent>=t){u=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=c,e.lineStart=f,e.lineIndent=d;break}}u&&(Fu(e,a,s,!1),pg(e,e.line-c),a=s=e.position,u=!1),Do(h)||(s=e.position+1),h=e.input.charCodeAt(++e.position)}return Fu(e,a,s,!1),e.result?!0:(e.kind=v,e.result=p,!1)}function Gx(e,t){var r,n,i;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(Fu(e,n,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)n=e.position,e.position++,i=e.position;else return!0;else Ns(r)?(Fu(e,n,i,!0),pg(e,Rr(e,!1,t)),n=i=e.position):e.position===e.lineStart&&T0(e)?Ge(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);Ge(e,"unexpected end of the stream within a single quoted scalar")}function Yx(e,t){var r,n,i,a,s,u;if(u=e.input.charCodeAt(e.position),u!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;(u=e.input.charCodeAt(e.position))!==0;){if(u===34)return Fu(e,r,e.position,!0),e.position++,!0;if(u===92){if(Fu(e,r,e.position,!0),u=e.input.charCodeAt(++e.position),Ns(u))Rr(e,!1,t);else if(u<256&&Pb[u])e.result+=$b[u],e.position++;else if((s=Mx(u))>0){for(i=s,a=0;i>0;i--)u=e.input.charCodeAt(++e.position),(s=Hx(u))>=0?a=(a<<4)+s:Ge(e,"expected hexadecimal character");e.result+=Vx(a),e.position++}else Ge(e,"unknown escape sequence");r=n=e.position}else Ns(u)?(Fu(e,r,n,!0),pg(e,Rr(e,!1,t)),r=n=e.position):e.position===e.lineStart&&T0(e)?Ge(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}Ge(e,"unexpected end of the stream within a double quoted scalar")}function Wx(e,t){var r=!0,n,i=e.tag,a,s=e.anchor,u,c,f,d,v,p={},h,w,m,y;if(y=e.input.charCodeAt(e.position),y===91)c=93,v=!1,a=[];else if(y===123)c=125,v=!0,a={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),y=e.input.charCodeAt(++e.position);y!==0;){if(Rr(e,!0,t),y=e.input.charCodeAt(e.position),y===c)return e.position++,e.tag=i,e.anchor=s,e.kind=v?"mapping":"sequence",e.result=a,!0;r||Ge(e,"missed comma between flow collection entries"),w=h=m=null,f=d=!1,y===63&&(u=e.input.charCodeAt(e.position+1),di(u)&&(f=d=!0,e.position++,Rr(e,!0,t))),n=e.line,kc(e,t,$0,!1,!0),w=e.tag,h=e.result,Rr(e,!0,t),y=e.input.charCodeAt(e.position),(d||e.line===n)&&y===58&&(f=!0,y=e.input.charCodeAt(++e.position),Rr(e,!0,t),kc(e,t,$0,!1,!0),m=e.result),v?Oc(e,a,p,w,h,m):f?a.push(Oc(e,null,p,w,h,m)):a.push(h),Rr(e,!0,t),y=e.input.charCodeAt(e.position),y===44?(r=!0,y=e.input.charCodeAt(++e.position)):r=!1}Ge(e,"unexpected end of the stream within a flow collection")}function Xx(e,t){var r,n,i=hg,a=!1,s=!1,u=t,c=0,f=!1,d,v;if(v=e.input.charCodeAt(e.position),v===124)n=!1;else if(v===62)n=!0;else return!1;for(e.kind="scalar",e.result="";v!==0;)if(v=e.input.charCodeAt(++e.position),v===43||v===45)hg===i?i=v===43?wb:Nx:Ge(e,"repeat of a chomping mode identifier");else if((d=qx(v))>=0)d===0?Ge(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?Ge(e,"repeat of an indentation width identifier"):(u=t+d-1,s=!0);else break;if(Do(v)){do v=e.input.charCodeAt(++e.position);while(Do(v));if(v===35)do v=e.input.charCodeAt(++e.position);while(!Ns(v)&&v!==0)}for(;v!==0;){for(dg(e),e.lineIndent=0,v=e.input.charCodeAt(e.position);(!s||e.lineIndentu&&(u=e.lineIndent),Ns(v)){c++;continue}if(e.lineIndentt)&&c!==0)Ge(e,"bad indentation of a sequence entry");else if(e.lineIndentt)&&(kc(e,t,x0,!0,i)&&(w?p=e.result:h=e.result),w||(Oc(e,f,d,v,p,h,a,s),v=p=h=null),Rr(e,!0,-1),y=e.input.charCodeAt(e.position)),e.lineIndent>t&&y!==0)Ge(e,"bad indentation of a mapping entry");else if(e.lineIndentt?c=1:e.lineIndent===t?c=0:e.lineIndentt?c=1:e.lineIndent===t?c=0:e.lineIndent tag; it should be "scalar", not "'+e.kind+'"'),v=0,p=e.implicitTypes.length;v tag; it should be "'+h.kind+'", not "'+e.kind+'"'),h.resolve(e.result)?(e.result=h.construct(e.result),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):Ge(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):Ge(e,"unknown tag !<"+e.tag+">");return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||d}function tR(e){var t=e.position,r,n,i,a=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};(s=e.input.charCodeAt(e.position))!==0&&(Rr(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(a=!0,s=e.input.charCodeAt(++e.position),r=e.position;s!==0&&!di(s);)s=e.input.charCodeAt(++e.position);for(n=e.input.slice(r,e.position),i=[],n.length<1&&Ge(e,"directive name must not be less than one character in length");s!==0;){for(;Do(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!Ns(s));break}if(Ns(s))break;for(r=e.position;s!==0&&!di(s);)s=e.input.charCodeAt(++e.position);i.push(e.input.slice(r,e.position))}s!==0&&dg(e),Su.call(bb,n)?bb[n](e,n,i):R0(e,'unknown document directive "'+n+'"')}if(Rr(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,Rr(e,!0,-1)):a&&Ge(e,"directives end mark is expected"),kc(e,e.lineIndent-1,x0,!1,!0),Rr(e,!0,-1),e.checkLineBreaks&&Ux.test(e.input.slice(t,e.position))&&R0(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&T0(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Rr(e,!0,-1));return}if(e.position"u"&&(r=t,t=null);var n=Rb(e,r);if(typeof t!="function")return n;for(var i=0,a=n.length;i"u"&&(r=t,t=null),Tb(e,t,ka.extend({schema:Db},r))}function nR(e,t){return Ob(e,ka.extend({schema:Db},t))}sf.exports.loadAll=Tb;sf.exports.load=Ob;sf.exports.safeLoadAll=rR;sf.exports.safeLoad=nR});var sy=he((kV,wg)=>{"use strict";var uf=bo(),of=$c(),iR=nf(),sR=Rc(),Vb=Object.prototype.toString,Kb=Object.prototype.hasOwnProperty,aR=9,af=10,uR=13,oR=32,cR=33,lR=34,zb=35,fR=37,hR=38,dR=39,pR=42,Gb=44,gR=45,Yb=58,mR=61,vR=62,wR=63,AR=64,Wb=91,Xb=93,ER=96,Zb=123,bR=124,Jb=125,Cn={};Cn[0]="\\0";Cn[7]="\\a";Cn[8]="\\b";Cn[9]="\\t";Cn[10]="\\n";Cn[11]="\\v";Cn[12]="\\f";Cn[13]="\\r";Cn[27]="\\e";Cn[34]='\\"';Cn[92]="\\\\";Cn[133]="\\N";Cn[160]="\\_";Cn[8232]="\\L";Cn[8233]="\\P";var yR=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function _R(e,t){var r,n,i,a,s,u,c;if(t===null)return{};for(r={},n=Object.keys(t),i=0,a=n.length;i0?e.charCodeAt(a-1):null,p=p&&Ub(s,u)}else{for(a=0;an&&e[v+1]!==" ",v=a);else if(!Nc(s))return O0;u=a>0?e.charCodeAt(a-1):null,p=p&&Ub(s,u)}f=f||d&&a-v-1>n&&e[v+1]!==" "}return!c&&!f?p&&!i(e)?ey:ty:r>9&&Qb(e)?O0:f?ny:ry}function BR(e,t,r,n){e.dump=function(){if(t.length===0)return"''";if(!e.noCompatMode&&yR.indexOf(t)!==-1)return"'"+t+"'";var i=e.indent*Math.max(1,r),a=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),s=n||e.flowLevel>-1&&r>=e.flowLevel;function u(c){return DR(e,c)}switch(IR(t,s,e.indent,a,u)){case ey:return t;case ty:return"'"+t.replace(/'/g,"''")+"'";case ry:return"|"+jb(t,e.indent)+Hb(Lb(t,i));case ny:return">"+jb(t,e.indent)+Hb(Lb(PR(t,a),i));case O0:return'"'+$R(t,a)+'"';default:throw new of("impossible error: invalid scalar style")}}()}function jb(e,t){var r=Qb(e)?String(t):"",n=e[e.length-1]===` `,i=n&&(e[e.length-2]===` `||e===` `),a=i?"+":n?"":"-";return r+a+` `}function Hb(e){return e[e.length-1]===` `?e.slice(0,-1):e}function PR(e,t){for(var r=/(\n+)([^\n]*)/g,n=function(){var f=e.indexOf(` `);return f=f!==-1?f:e.length,r.lastIndex=f,Mb(e.slice(0,f),t)}(),i=e[0]===` `||e[0]===" ",a,s;s=r.exec(e);){var u=s[1],c=s[2];a=c[0]===" ",n+=u+(!i&&!a&&c!==""?` `:"")+Mb(c,t),i=a}return n}function Mb(e,t){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,n,i=0,a,s=0,u=0,c="";n=r.exec(e);)u=n.index,u-i>t&&(a=s>i?s:u,c+=` `+e.slice(i,a),i=a+1),s=u;return c+=` `,e.length-i>t&&s>i?c+=e.slice(i,s)+` `+e.slice(s+1):c+=e.slice(i),c.slice(1)}function $R(e){for(var t="",r,n,i,a=0;a=55296&&r<=56319&&(n=e.charCodeAt(a+1),n>=56320&&n<=57343)){t+=Nb((r-55296)*1024+n-56320+65536),a++;continue}i=Cn[r],t+=!i&&Nc(r)?e[a]:i||Nb(r)}return t}function xR(e,t,r){var n="",i=e.tag,a,s;for(a=0,s=r.length;a1024&&(d+="? "),d+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Fo(e,t,f,!1,!1)&&(d+=e.dump,n+=d));e.tag=i,e.dump="{"+n+"}"}function OR(e,t,r,n){var i="",a=e.tag,s=Object.keys(r),u,c,f,d,v,p;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new of("sortKeys must be a boolean or a function");for(u=0,c=s.length;u1024,v&&(e.dump&&af===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,v&&(p+=gg(e,t)),Fo(e,t+1,d,!0,v)&&(e.dump&&af===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,i+=p));e.tag=a,e.dump=i||"{}"}function qb(e,t,r){var n,i,a,s,u,c;for(i=r?e.explicitTypes:e.implicitTypes,a=0,s=i.length;a tag resolver accepts not "'+c+'" style');e.dump=n}return!0}return!1}function Fo(e,t,r,n,i,a){e.tag=null,e.dump=r,qb(e,r,!1)||qb(e,r,!0);var s=Vb.call(e.dump);n&&(n=e.flowLevel<0||e.flowLevel>t);var u=s==="[object Object]"||s==="[object Array]",c,f;if(u&&(c=e.duplicates.indexOf(r),f=c!==-1),(e.tag!==null&&e.tag!=="?"||f||e.indent!==2&&t>0)&&(i=!1),f&&e.usedDuplicates[c])e.dump="*ref_"+c;else{if(u&&f&&!e.usedDuplicates[c]&&(e.usedDuplicates[c]=!0),s==="[object Object]")n&&Object.keys(e.dump).length!==0?(OR(e,t,e.dump,i),f&&(e.dump="&ref_"+c+e.dump)):(TR(e,t,e.dump),f&&(e.dump="&ref_"+c+" "+e.dump));else if(s==="[object Array]"){var d=e.noArrayIndent&&t>0?t-1:t;n&&e.dump.length!==0?(RR(e,d,e.dump,i),f&&(e.dump="&ref_"+c+e.dump)):(xR(e,d,e.dump),f&&(e.dump="&ref_"+c+" "+e.dump))}else if(s==="[object String]")e.tag!=="?"&&BR(e,e.dump,t,a);else{if(e.skipInvalid)return!1;throw new of("unacceptable kind of an object to dump "+s)}e.tag!==null&&e.tag!=="?"&&(e.dump="!<"+e.tag+"> "+e.dump)}return!0}function kR(e,t){var r=[],n=[],i,a;for(mg(e,r,n),i=0,a=n.length;i{"use strict";var k0=kb(),ay=sy();function N0(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}yr.exports.Type=Hr();yr.exports.Schema=yo();yr.exports.FAILSAFE_SCHEMA=B0();yr.exports.JSON_SCHEMA=cg();yr.exports.CORE_SCHEMA=lg();yr.exports.DEFAULT_SAFE_SCHEMA=Rc();yr.exports.DEFAULT_FULL_SCHEMA=nf();yr.exports.load=k0.load;yr.exports.loadAll=k0.loadAll;yr.exports.safeLoad=k0.safeLoad;yr.exports.safeLoadAll=k0.safeLoadAll;yr.exports.dump=ay.dump;yr.exports.safeDump=ay.safeDump;yr.exports.YAMLException=$c();yr.exports.MINIMAL_SCHEMA=B0();yr.exports.SAFE_SCHEMA=Rc();yr.exports.DEFAULT_SCHEMA=nf();yr.exports.scan=N0("scan");yr.exports.parse=N0("parse");yr.exports.compose=N0("compose");yr.exports.addConstructor=N0("addConstructor")});var cy=he((LV,oy)=>{"use strict";var LR=uy();oy.exports=LR});var fy=he((UV,ly)=>{"use strict";var L0=cy();ly.exports={safeLoad:L0.safeLoad,load:L0.load,safeDump:L0.safeDump,dump:L0.dump}});var bg=he(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});Uc.isCorrect=Uc.isInSubnet=void 0;function XR(e){return this.subnetMask{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.RE_SUBNET_STRING=Hs.RE_ADDRESS=Hs.GROUPS=Hs.BITS=void 0;Hs.BITS=32;Hs.GROUPS=4;Hs.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g;Hs.RE_SUBNET_STRING=/\/\d{1,2}$/});var z0=he(K0=>{"use strict";Object.defineProperty(K0,"__esModule",{value:!0});K0.AddressError=void 0;var _g=class extends Error{constructor(t,r){super(t),this.name="AddressError",r!==null&&(this.parseMessage=r)}};K0.AddressError=_g});var Cg=he((G0,Ay)=>{(function(){var e,t=0xdeadbeefcafe,r=(t&16777215)==15715070;function n(R,k,V){R!=null&&(typeof R=="number"?this.fromNumber(R,k,V):k==null&&typeof R!="string"?this.fromString(R,256):this.fromString(R,k))}function i(){return new n(null)}function a(R,k,V,J,ve,Ee){for(;--Ee>=0;){var Ie=k*this[R++]+V[J]+ve;ve=Math.floor(Ie/67108864),V[J++]=Ie&67108863}return ve}function s(R,k,V,J,ve,Ee){for(var Ie=k&32767,Re=k>>15;--Ee>=0;){var Vt=this[R]&32767,Ar=this[R++]>>15,un=Re*Vt+Ar*Ie;Vt=Ie*Vt+((un&32767)<<15)+V[J]+(ve&1073741823),ve=(Vt>>>30)+(un>>>15)+Re*Ar+(ve>>>30),V[J++]=Vt&1073741823}return ve}function u(R,k,V,J,ve,Ee){for(var Ie=k&16383,Re=k>>14;--Ee>=0;){var Vt=this[R]&16383,Ar=this[R++]>>14,un=Re*Vt+Ar*Ie;Vt=Ie*Vt+((un&16383)<<14)+V[J]+ve,ve=(Vt>>28)+(un>>14)+Re*Ar,V[J++]=Vt&268435455}return ve}var c=typeof navigator<"u";c&&r&&navigator.appName=="Microsoft Internet Explorer"?(n.prototype.am=s,e=30):c&&r&&navigator.appName!="Netscape"?(n.prototype.am=a,e=26):(n.prototype.am=u,e=28),n.prototype.DB=e,n.prototype.DM=(1<=0;--k)R[k]=this[k];R.t=this.t,R.s=this.s}function g(R){this.t=1,this.s=R<0?-1:0,R>0?this[0]=R:R<-1?this[0]=R+this.DV:this.t=0}function b(R){var k=i();return k.fromInt(R),k}function D(R,k){var V;if(k==16)V=4;else if(k==8)V=3;else if(k==256)V=8;else if(k==2)V=1;else if(k==32)V=5;else if(k==4)V=2;else{this.fromRadix(R,k);return}this.t=0,this.s=0;for(var J=R.length,ve=!1,Ee=0;--J>=0;){var Ie=V==8?R[J]&255:m(R,J);if(Ie<0){R.charAt(J)=="-"&&(ve=!0);continue}ve=!1,Ee==0?this[this.t++]=Ie:Ee+V>this.DB?(this[this.t-1]|=(Ie&(1<>this.DB-Ee):this[this.t-1]|=Ie<=this.DB&&(Ee-=this.DB)}V==8&&R[0]&128&&(this.s=-1,Ee>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==R;)--this.t}function F(R){if(this.s<0)return"-"+this.negate().toString(R);var k;if(R==16)k=4;else if(R==8)k=3;else if(R==2)k=1;else if(R==32)k=5;else if(R==4)k=2;else return this.toRadix(R);var V=(1<0)for(Re>Re)>0&&(ve=!0,Ee=w(J));Ie>=0;)Re>(Re+=this.DB-k)):(J=this[Ie]>>(Re-=k)&V,Re<=0&&(Re+=this.DB,--Ie)),J>0&&(ve=!0),ve&&(Ee+=w(J));return ve?Ee:"0"}function L(){var R=i();return n.ZERO.subTo(this,R),R}function N(){return this.s<0?this.negate():this}function S(R){var k=this.s-R.s;if(k!=0)return k;var V=this.t;if(k=V-R.t,k!=0)return this.s<0?-k:k;for(;--V>=0;)if((k=this[V]-R[V])!=0)return k;return 0}function B(R){var k=1,V;return(V=R>>>16)!=0&&(R=V,k+=16),(V=R>>8)!=0&&(R=V,k+=8),(V=R>>4)!=0&&(R=V,k+=4),(V=R>>2)!=0&&(R=V,k+=2),(V=R>>1)!=0&&(R=V,k+=1),k}function O(){return this.t<=0?0:this.DB*(this.t-1)+B(this[this.t-1]^this.s&this.DM)}function x(R,k){var V;for(V=this.t-1;V>=0;--V)k[V+R]=this[V];for(V=R-1;V>=0;--V)k[V]=0;k.t=this.t+R,k.s=this.s}function U(R,k){for(var V=R;V=0;--Re)k[Re+Ee+1]=this[Re]>>J|Ie,Ie=(this[Re]&ve)<=0;--Re)k[Re]=0;k[Ee]=Ie,k.t=this.t+Ee+1,k.s=this.s,k.clamp()}function H(R,k){k.s=this.s;var V=Math.floor(R/this.DB);if(V>=this.t){k.t=0;return}var J=R%this.DB,ve=this.DB-J,Ee=(1<>J;for(var Ie=V+1;Ie>J;J>0&&(k[this.t-V-1]|=(this.s&Ee)<>=this.DB;if(R.t>=this.DB;J+=this.s}else{for(J+=this.s;V>=this.DB;J-=R.s}k.s=J<0?-1:0,J<-1?k[V++]=this.DV+J:J>0&&(k[V++]=J),k.t=V,k.clamp()}function Y(R,k){var V=this.abs(),J=R.abs(),ve=V.t;for(k.t=ve+J.t;--ve>=0;)k[ve]=0;for(ve=0;ve=0;)R[V]=0;for(V=0;V=k.DV&&(R[V+k.t]-=k.DV,R[V+k.t+1]=1)}R.t>0&&(R[R.t-1]+=k.am(V,k[V],R,2*V,0,1)),R.s=0,R.clamp()}function Ce(R,k,V){var J=R.abs();if(!(J.t<=0)){var ve=this.abs();if(ve.t0?(J.lShiftTo(Vt,Ee),ve.lShiftTo(Vt,V)):(J.copyTo(Ee),ve.copyTo(V));var Ar=Ee.t,un=Ee[Ar-1];if(un!=0){var on=un*(1<1?Ee[Ar-2]>>this.F2:0),bi=this.FV/on,gu=(1<=0&&(V[V.t++]=1,V.subTo(Hi,V)),n.ONE.dlShiftTo(Ar,Hi),Hi.subTo(Ee,Ee);Ee.t=0;){var no=V[--cn]==un?this.DM:Math.floor(V[cn]*bi+(V[cn-1]+Nn)*gu);if((V[cn]+=Ee.am(0,no,V,mu,0,Ar))0&&V.rShiftTo(Vt,V),Ie<0&&n.ZERO.subTo(V,V)}}}function Fe(R){var k=i();return this.abs().divRemTo(R,null,k),this.s<0&&k.compareTo(n.ZERO)>0&&R.subTo(k,k),k}function xe(R){this.m=R}function et(R){return R.s<0||R.compareTo(this.m)>=0?R.mod(this.m):R}function Qe(R){return R}function ut(R){R.divRemTo(this.m,null,R)}function ot(R,k,V){R.multiplyTo(k,V),this.reduce(V)}function Qr(R,k){R.squareTo(k),this.reduce(k)}xe.prototype.convert=et,xe.prototype.revert=Qe,xe.prototype.reduce=ut,xe.prototype.mulTo=ot,xe.prototype.sqrTo=Qr;function er(){if(this.t<1)return 0;var R=this[0];if(!(R&1))return 0;var k=R&3;return k=k*(2-(R&15)*k)&15,k=k*(2-(R&255)*k)&255,k=k*(2-((R&65535)*k&65535))&65535,k=k*(2-R*k%this.DV)%this.DV,k>0?this.DV-k:-k}function Et(R){this.m=R,this.mp=R.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(k,k),k}function rr(R){var k=i();return R.copyTo(k),this.reduce(k),k}function lt(R){for(;R.t<=this.mt2;)R[R.t++]=0;for(var k=0;k>15)*this.mpl&this.um)<<15)&R.DM;for(V=k+this.m.t,R[V]+=this.m.am(0,J,R,k,0,this.m.t);R[V]>=R.DV;)R[V]-=R.DV,R[++V]++}R.clamp(),R.drShiftTo(this.m.t,R),R.compareTo(this.m)>=0&&R.subTo(this.m,R)}function Mt(R,k){R.squareTo(k),this.reduce(k)}function tt(R,k,V){R.multiplyTo(k,V),this.reduce(V)}Et.prototype.convert=gr,Et.prototype.revert=rr,Et.prototype.reduce=lt,Et.prototype.mulTo=tt,Et.prototype.sqrTo=Mt;function qe(){return(this.t>0?this[0]&1:this.s)==0}function nr(R,k){if(R>4294967295||R<1)return n.ONE;var V=i(),J=i(),ve=k.convert(this),Ee=B(R)-1;for(ve.copyTo(V);--Ee>=0;)if(k.sqrTo(V,J),(R&1<0)k.mulTo(J,ve,V);else{var Ie=V;V=J,J=Ie}return k.revert(V)}function Ue(R,k){var V;return R<256||k.isEven()?V=new xe(k):V=new Et(k),this.exp(R,V)}n.prototype.copyTo=y,n.prototype.fromInt=g,n.prototype.fromString=D,n.prototype.clamp=C,n.prototype.dlShiftTo=x,n.prototype.drShiftTo=U,n.prototype.lShiftTo=G,n.prototype.rShiftTo=H,n.prototype.subTo=K,n.prototype.multiplyTo=Y,n.prototype.squareTo=ne,n.prototype.divRemTo=Ce,n.prototype.invDigit=er,n.prototype.isEven=qe,n.prototype.exp=nr,n.prototype.toString=F,n.prototype.negate=L,n.prototype.abs=N,n.prototype.compareTo=S,n.prototype.bitLength=O,n.prototype.mod=Fe,n.prototype.modPowInt=Ue,n.ZERO=b(0),n.ONE=b(1);function $t(){var R=i();return this.copyTo(R),R}function en(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function qt(){return this.t==0?this.s:this[0]<<16>>16}function pt(R){return Math.floor(Math.LN2*this.DB/Math.log(R))}function Br(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Ei(R){if(R==null&&(R=10),this.signum()==0||R<2||R>36)return"0";var k=this.chunkSize(R),V=Math.pow(R,k),J=b(V),ve=i(),Ee=i(),Ie="";for(this.divRemTo(J,ve,Ee);ve.signum()>0;)Ie=(V+Ee.intValue()).toString(R).substr(1)+Ie,ve.divRemTo(J,ve,Ee);return Ee.intValue().toString(R)+Ie}function tn(R,k){this.fromInt(0),k==null&&(k=10);for(var V=this.chunkSize(k),J=Math.pow(k,V),ve=!1,Ee=0,Ie=0,Re=0;Re=V&&(this.dMultiply(J),this.dAddOffset(Ie,0),Ee=0,Ie=0)}Ee>0&&(this.dMultiply(Math.pow(k,Ee)),this.dAddOffset(Ie,0)),ve&&n.ZERO.subTo(this,this)}function _t(R,k,V){if(typeof k=="number")if(R<2)this.fromInt(1);else for(this.fromNumber(R,V),this.testBit(R-1)||this.bitwiseTo(n.ONE.shiftLeft(R-1),ge,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(k);)this.dAddOffset(2,0),this.bitLength()>R&&this.subTo(n.ONE.shiftLeft(R-1),this);else{var J=new Array,ve=R&7;J.length=(R>>3)+1,k.nextBytes(J),ve>0?J[0]&=(1<0)for(V>V)!=(this.s&this.DM)>>V&&(k[ve++]=J|this.s<=0;)V<8?(J=(this[R]&(1<>(V+=this.DB-8)):(J=this[R]>>(V-=8)&255,V<=0&&(V+=this.DB,--R)),J&128&&(J|=-256),ve==0&&(this.s&128)!=(J&128)&&++ve,(ve>0||J!=this.s)&&(k[ve++]=J);return k}function De(R){return this.compareTo(R)==0}function mr(R){return this.compareTo(R)<0?this:R}function rn(R){return this.compareTo(R)>0?this:R}function rt(R,k,V){var J,ve,Ee=Math.min(R.t,this.t);for(J=0;J>=16,k+=16),R&255||(R>>=8,k+=8),R&15||(R>>=4,k+=4),R&3||(R>>=2,k+=2),R&1||++k,k}function xt(){for(var R=0;R=this.t?this.s!=0:(this[k]&1<>=this.DB;if(R.t>=this.DB;J+=this.s}else{for(J+=this.s;V>=this.DB;J+=R.s}k.s=J<0?-1:0,J>0?k[V++]=J:J<-1&&(k[V++]=this.DV+J),k.t=V,k.clamp()}function ga(R){var k=i();return this.addTo(R,k),k}function te(R){var k=i();return this.subTo(R,k),k}function le(R){var k=i();return this.multiplyTo(R,k),k}function ke(){var R=i();return this.squareTo(R),R}function Te(R){var k=i();return this.divRemTo(R,k,null),k}function Me(R){var k=i();return this.divRemTo(R,null,k),k}function nt(R){var k=i(),V=i();return this.divRemTo(R,k,V),new Array(k,V)}function ct(R){this[this.t]=this.am(0,R-1,this,0,0,this.t),++this.t,this.clamp()}function Dr(R,k){if(R!=0){for(;this.t<=k;)this[this.t++]=0;for(this[k]+=R;this[k]>=this.DV;)this[k]-=this.DV,++k>=this.t&&(this[this.t++]=0),++this[k]}}function Nt(){}function Jn(R){return R}function ji(R,k,V){R.multiplyTo(k,V)}function sn(R,k){R.squareTo(k)}Nt.prototype.convert=Jn,Nt.prototype.revert=Jn,Nt.prototype.mulTo=ji,Nt.prototype.sqrTo=sn;function wn(R){return this.exp(R,new Nt)}function vr(R,k,V){var J=Math.min(this.t+R.t,k);for(V.s=0,V.t=J;J>0;)V[--J]=0;var ve;for(ve=V.t-this.t;J=0;)V[J]=0;for(J=Math.max(k-this.t,0);J2*this.m.t)return R.mod(this.m);if(R.compareTo(this.m)<0)return R;var k=i();return R.copyTo(k),this.reduce(k),k}function Is(R){return R}function Rn(R){for(R.drShiftTo(this.m.t-1,this.r2),R.t>this.m.t+1&&(R.t=this.m.t+1,R.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);R.compareTo(this.r2)<0;)R.dAddOffset(1,this.m.t+1);for(R.subTo(this.r2,R);R.compareTo(this.m)>=0;)R.subTo(this.m,R)}function Pt(R,k){R.squareTo(k),this.reduce(k)}function wr(R,k,V){R.multiplyTo(k,V),this.reduce(V)}Nr.prototype.convert=Xu,Nr.prototype.revert=Is,Nr.prototype.reduce=Rn,Nr.prototype.mulTo=wr,Nr.prototype.sqrTo=Pt;function Xe(R,k){var V=R.bitLength(),J,ve=b(1),Ee;if(V<=0)return ve;V<18?J=1:V<48?J=3:V<144?J=4:V<768?J=5:J=6,V<8?Ee=new xe(k):k.isEven()?Ee=new Nr(k):Ee=new Et(k);var Ie=new Array,Re=3,Vt=J-1,Ar=(1<1){var un=i();for(Ee.sqrTo(Ie[1],un);Re<=Ar;)Ie[Re]=i(),Ee.mulTo(un,Ie[Re-2],Ie[Re]),Re+=2}var on=R.t-1,bi,gu=!0,Nn=i(),cn;for(V=B(R[on])-1;on>=0;){for(V>=Vt?bi=R[on]>>V-Vt&Ar:(bi=(R[on]&(1<0&&(bi|=R[on-1]>>this.DB+V-Vt)),Re=J;!(bi&1);)bi>>=1,--Re;if((V-=Re)<0&&(V+=this.DB,--on),gu)Ie[bi].copyTo(ve),gu=!1;else{for(;Re>1;)Ee.sqrTo(ve,Nn),Ee.sqrTo(Nn,ve),Re-=2;Re>0?Ee.sqrTo(ve,Nn):(cn=ve,ve=Nn,Nn=cn),Ee.mulTo(Nn,Ie[bi],ve)}for(;on>=0&&!(R[on]&1<0&&(k.rShiftTo(Ee,k),V.rShiftTo(Ee,V));k.signum()>0;)(ve=k.getLowestSetBit())>0&&k.rShiftTo(ve,k),(ve=V.getLowestSetBit())>0&&V.rShiftTo(ve,V),k.compareTo(V)>=0?(k.subTo(V,k),k.rShiftTo(1,k)):(V.subTo(k,V),V.rShiftTo(1,V));return Ee>0&&V.lShiftTo(Ee,V),V}function Kr(R){if(R<=0)return 0;var k=this.DV%R,V=this.s<0?R-1:0;if(this.t>0)if(k==0)V=this[0]%R;else for(var J=this.t-1;J>=0;--J)V=(k*V+this[J])%R;return V}function sr(R){var k=R.isEven();if(this.isEven()&&k||R.signum()==0)return n.ZERO;for(var V=R.clone(),J=this.clone(),ve=b(1),Ee=b(0),Ie=b(0),Re=b(1);V.signum()!=0;){for(;V.isEven();)V.rShiftTo(1,V),k?((!ve.isEven()||!Ee.isEven())&&(ve.addTo(this,ve),Ee.subTo(R,Ee)),ve.rShiftTo(1,ve)):Ee.isEven()||Ee.subTo(R,Ee),Ee.rShiftTo(1,Ee);for(;J.isEven();)J.rShiftTo(1,J),k?((!Ie.isEven()||!Re.isEven())&&(Ie.addTo(this,Ie),Re.subTo(R,Re)),Ie.rShiftTo(1,Ie)):Re.isEven()||Re.subTo(R,Re),Re.rShiftTo(1,Re);V.compareTo(J)>=0?(V.subTo(J,V),k&&ve.subTo(Ie,ve),Ee.subTo(Re,Ee)):(J.subTo(V,J),k&&Ie.subTo(ve,Ie),Re.subTo(Ee,Re))}if(J.compareTo(n.ONE)!=0)return n.ZERO;if(Re.compareTo(R)>=0)return Re.subtract(R);if(Re.signum()<0)Re.addTo(R,Re);else return Re;return Re.signum()<0?Re.add(R):Re}var Lt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Tn=(1<<26)/Lt[Lt.length-1];function Qn(R){var k,V=this.abs();if(V.t==1&&V[0]<=Lt[Lt.length-1]){for(k=0;k>1,R>Lt.length&&(R=Lt.length);for(var ve=i(),Ee=0;Ee>8&255,Pr[or++]^=R>>16&255,Pr[or++]^=R>>24&255,or>=kn&&(or-=kn)}function Zu(){Fl(new Date().getTime())}if(Pr==null){Pr=new Array,or=0;var zr;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var Ju=new Uint8Array(32);for(window.crypto.getRandomValues(Ju),zr=0;zr<32;++zr)Pr[or++]=Ju[zr]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var Yo=window.crypto.random(32);for(zr=0;zr>>8,Pr[or++]=zr&255;or=0,Zu()}function Wo(){if(On==null){for(Zu(),On=ro(),On.init(Pr),or=0;or{(function(){"use strict";var e={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(s){return n(a(s),arguments)}function r(s,u){return t.apply(null,[s].concat(u||[]))}function n(s,u){var c=1,f=s.length,d,v="",p,h,w,m,y,g,b,D;for(p=0;p=0),w.type){case"b":d=parseInt(d,10).toString(2);break;case"c":d=String.fromCharCode(parseInt(d,10));break;case"d":case"i":d=parseInt(d,10);break;case"j":d=JSON.stringify(d,null,w.width?parseInt(w.width):0);break;case"e":d=w.precision?parseFloat(d).toExponential(w.precision):parseFloat(d).toExponential();break;case"f":d=w.precision?parseFloat(d).toFixed(w.precision):parseFloat(d);break;case"g":d=w.precision?String(Number(d.toPrecision(w.precision))):parseFloat(d);break;case"o":d=(parseInt(d,10)>>>0).toString(8);break;case"s":d=String(d),d=w.precision?d.substring(0,w.precision):d;break;case"t":d=String(!!d),d=w.precision?d.substring(0,w.precision):d;break;case"T":d=Object.prototype.toString.call(d).slice(8,-1).toLowerCase(),d=w.precision?d.substring(0,w.precision):d;break;case"u":d=parseInt(d,10)>>>0;break;case"v":d=d.valueOf(),d=w.precision?d.substring(0,w.precision):d;break;case"x":d=(parseInt(d,10)>>>0).toString(16);break;case"X":d=(parseInt(d,10)>>>0).toString(16).toUpperCase();break}e.json.test(w.type)?v+=d:(e.number.test(w.type)&&(!b||w.sign)?(D=b?"+":"-",d=d.toString().replace(e.sign,"")):D="",y=w.pad_char?w.pad_char==="0"?"0":w.pad_char.charAt(1):" ",g=w.width-(D+d).length,m=w.width&&g>0?y.repeat(g):"",v+=w.align?D+d+m:y==="0"?D+m+d:m+D+d)}return v}var i=Object.create(null);function a(s){if(i[s])return i[s];for(var u=s,c,f=[],d=0;u;){if((c=e.text.exec(u))!==null)f.push(c[0]);else if((c=e.modulo.exec(u))!==null)f.push("%");else if((c=e.placeholder.exec(u))!==null){if(c[2]){d|=1;var v=[],p=c[2],h=[];if((h=e.key.exec(p))!==null)for(v.push(h[1]);(p=p.substring(h[0].length))!=="";)if((h=e.key_access.exec(p))!==null)v.push(h[1]);else if((h=e.index_access.exec(p))!==null)v.push(h[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");c[2]=v}else d|=2;if(d===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");f.push({placeholder:c[0],param_no:c[1],keys:c[2],sign:c[3],pad_char:c[4],align:c[5],width:c[6],precision:c[7],type:c[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");u=u.substring(c[0].length)}return i[s]=f}typeof Y0<"u"&&(Y0.sprintf=t,Y0.vsprintf=r),typeof window<"u"&&(window.sprintf=t,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:r}}))})()});var Fg=he(Ms=>{"use strict";var JR=Ms&&Ms.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),QR=Ms&&Ms.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),yy=Ms&&Ms.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&JR(t,e,r);return QR(t,e),t};Object.defineProperty(Ms,"__esModule",{value:!0});Ms.Address4=void 0;var Ey=yy(bg()),ls=yy(yg()),by=z0(),hf=Cg(),jc=ff(),Dg=class e{constructor(t){this.groups=ls.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=Ey.isCorrect(ls.BITS),this.isInSubnet=Ey.isInSubnet,this.address=t;let r=ls.RE_SUBNET_STRING.exec(t);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>ls.BITS)throw new by.AddressError("Invalid subnet mask.");t=t.replace(ls.RE_SUBNET_STRING,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new e(t),!0}catch{return!1}}parse(t){let r=t.split(".");if(!t.match(ls.RE_ADDRESS))throw new by.AddressError("Invalid IPv4 address.");return r}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromHex(t){let r=t.replace(/:/g,"").padStart(8,"0"),n=[],i;for(i=0;i<8;i+=2){let a=r.slice(i,i+2);n.push(parseInt(a,16))}return new e(n.join("."))}static fromInteger(t){return e.fromHex(t.toString(16))}static fromArpa(t){let n=t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new e(n)}toHex(){return this.parsedAddress.map(t=>(0,jc.sprintf)("%02x",parseInt(t,10))).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],r;for(r=0;r(0,jc.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new hf.BigInteger(this.mask()+"0".repeat(ls.BITS-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new hf.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new hf.BigInteger(this.mask()+"1".repeat(ls.BITS-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new hf.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))}static fromBigInteger(t){return e.fromInteger(parseInt(t.toString(),10))}mask(t){return t===void 0&&(t=this.subnetMask),this.getBitsBase2(0,t)}getBitsBase2(t,r){return this.binaryZeroPad().slice(t,r)}reverseForm(t){t||(t={});let r=this.correctForm().split(".").reverse().join(".");return t.omitSuffix?r:(0,jc.sprintf)("%s.in-addr.arpa.",r)}isMulticast(){return this.isInSubnet(new e("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(ls.BITS,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(ls.RE_ADDRESS,(0,jc.sprintf)('%s.%s',t.slice(0,2).join("."),t.slice(2,4).join(".")))}};Ms.Address4=Dg});var Sg=he(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.RE_URL_WITH_PORT=_r.RE_URL=_r.RE_ZONE_STRING=_r.RE_SUBNET_STRING=_r.RE_BAD_ADDRESS=_r.RE_BAD_CHARACTERS=_r.TYPES=_r.SCOPES=_r.GROUPS=_r.BITS=void 0;_r.BITS=128;_r.GROUPS=8;_r.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"};_r.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"};_r.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi;_r.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi;_r.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/;_r.RE_ZONE_STRING=/%.*$/;_r.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/);_r.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)});var Ig=he(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.simpleGroup=qs.spanLeadingZeroes=qs.spanAll=qs.spanAllZeroes=void 0;var _y=ff();function Cy(e){return e.replace(/(0+)/g,'$1')}qs.spanAllZeroes=Cy;function eT(e,t=0){return e.split("").map((n,i)=>(0,_y.sprintf)('%s',n,i+t,Cy(n))).join("")}qs.spanAll=eT;function Dy(e){return e.replace(/^(0+)/,'$1')}function tT(e){return e.split(":").map(r=>Dy(r)).join(":")}qs.spanLeadingZeroes=tT;function rT(e,t=0){return e.split(":").map((n,i)=>/group-v4/.test(n)?n:(0,_y.sprintf)('%s',i+t,Dy(n)))}qs.simpleGroup=rT});var Fy=he(Xr=>{"use strict";var nT=Xr&&Xr.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),iT=Xr&&Xr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),sT=Xr&&Xr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&nT(t,e,r);return iT(t,e),t};Object.defineProperty(Xr,"__esModule",{value:!0});Xr.possibleElisions=Xr.simpleRegularExpression=Xr.ADDRESS_BOUNDARY=Xr.padGroup=Xr.groupPossibilities=void 0;var aT=sT(Sg()),Hc=ff();function X0(e){return(0,Hc.sprintf)("(%s)",e.join("|"))}Xr.groupPossibilities=X0;function W0(e){return e.length<4?(0,Hc.sprintf)("0{0,%d}%s",4-e.length,e):e}Xr.padGroup=W0;Xr.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";function uT(e){let t=[];e.forEach((n,i)=>{parseInt(n,16)===0&&t.push(i)});let r=t.map(n=>e.map((i,a)=>{if(a===n){let s=a===0||a===aT.GROUPS-1?":":"";return X0([W0(i),s])}return W0(i)}).join(":"));return r.push(e.map(W0).join(":")),X0(r)}Xr.simpleRegularExpression=uT;function oT(e,t,r){let n=t?"":":",i=r?"":":",a=[];!t&&!r&&a.push("::"),t&&r&&a.push(""),(r&&!t||!r&&t)&&a.push(":"),a.push((0,Hc.sprintf)("%s(:0{1,4}){1,%d}",n,e-1)),a.push((0,Hc.sprintf)("(0{1,4}:){1,%d}%s",e-1,i)),a.push((0,Hc.sprintf)("(0{1,4}:){%d}0{1,4}",e-1));for(let s=1;s{"use strict";var cT=Vs&&Vs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),lT=Vs&&Vs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),J0=Vs&&Vs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&cT(t,e,r);return lT(t,e),t};Object.defineProperty(Vs,"__esModule",{value:!0});Vs.Address6=void 0;var Sy=J0(bg()),Bg=J0(yg()),tr=J0(Sg()),Pg=J0(Ig()),Po=Fg(),$o=Fy(),ja=z0(),Vn=Cg(),Kn=ff();function Z0(e){if(!e)throw new Error("Assertion failed.")}function fT(e){let t=/(\d+)(\d{3})/;for(;t.test(e);)e=e.replace(t,"$1,$2");return e}function hT(e){return e=e.replace(/^(0{1,})([1-9]+)$/,'$1$2'),e=e.replace(/^(0{1,})(0)$/,'$1$2'),e}function dT(e,t){let r=[],n=[],i;for(i=0;it[1]&&n.push(e[i]);return r.concat(["compact"]).concat(n)}function Iy(e){return(0,Kn.sprintf)("%04x",parseInt(e,16))}function By(e){return e&255}var $g=class e{constructor(t,r){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=Sy.isInSubnet,this.isCorrect=Sy.isCorrect(tr.BITS),r===void 0?this.groups=tr.GROUPS:this.groups=r,this.address=t;let n=tr.RE_SUBNET_STRING.exec(t);if(n){if(this.parsedSubnet=n[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>tr.BITS)throw new ja.AddressError("Invalid subnet mask.");t=t.replace(tr.RE_SUBNET_STRING,"")}else if(/\//.test(t))throw new ja.AddressError("Invalid subnet mask.");let i=tr.RE_ZONE_STRING.exec(t);i&&(this.zone=i[0],t=t.replace(tr.RE_ZONE_STRING,"")),this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new e(t),!0}catch{return!1}}static fromBigInteger(t){let r=t.toString(16).padStart(32,"0"),n=[],i;for(i=0;i65536)&&(n=null)):n=null,{address:new e(r),port:n}}static fromAddress4(t){let r=new Po.Address4(t),n=tr.BITS-(Bg.BITS-r.subnetMask);return new e(`::ffff:${r.correctForm()}/${n}`)}static fromArpa(t){let r=t.replace(/(\.ip6\.arpa)?\.$/,""),n=7;if(r.length!==63)throw new ja.AddressError("Invalid 'ip6.arpa' form.");let i=r.split(".").reverse();for(let a=n;a>0;a--){let s=a*4;i.splice(s,0,":")}return r=i.join(""),new e(r)}microsoftTranscription(){return(0,Kn.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let r=tr.BITS-this.subnetMask,n=Math.abs(t-tr.BITS),i=r-n;return i<0?"0":fT(new Vn.BigInteger("2",10).pow(i).toString(10))}_startAddress(){return new Vn.BigInteger(this.mask()+"0".repeat(tr.BITS-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new Vn.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new Vn.BigInteger(this.mask()+"1".repeat(tr.BITS-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new Vn.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=tr.SCOPES[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(tr.TYPES))if(this.isInSubnet(new e(t)))return tr.TYPES[t];return"Global unicast"}getBits(t,r){return new Vn.BigInteger(this.getBitsBase2(t,r),2)}getBitsBase2(t,r){return this.binaryZeroPad().slice(t,r)}getBitsBase16(t,r){let n=r-t;if(n%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(t,r).toString(16).padStart(n/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,tr.BITS)}reverseForm(t){t||(t={});let r=Math.floor(this.subnetMask/4),n=this.canonicalForm().replace(/:/g,"").split("").slice(0,r).reverse().join(".");return r>0?t.omitSuffix?n:(0,Kn.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,r=[],n=0,i=[];for(t=0;t0&&(n>1&&i.push([t-n,t-1]),n=0)}n>1&&i.push([this.parsedAddress.length-n,this.parsedAddress.length-1]);let a=i.map(u=>u[1]-u[0]+1);if(i.length>0){let u=a.indexOf(Math.max(...a));r=dT(this.parsedAddress,i[u])}else r=this.parsedAddress;for(t=0;t1?"s":"",r.join("")),t.replace(tr.RE_BAD_CHARACTERS,'$1'));let n=t.match(tr.RE_BAD_ADDRESS);if(n)throw new ja.AddressError((0,Kn.sprintf)("Address failed regex: %s",n.join("")),t.replace(tr.RE_BAD_ADDRESS,'$1'));let i=[],a=t.split("::");if(a.length===2){let s=a[0].split(":"),u=a[1].split(":");s.length===1&&s[0]===""&&(s=[]),u.length===1&&u[0]===""&&(u=[]);let c=this.groups-(s.length+u.length);if(!c)throw new ja.AddressError("Error parsing groups");this.elidedGroups=c,this.elisionBegin=s.length,this.elisionEnd=s.length+this.elidedGroups,i=i.concat(s);for(let f=0;f(0,Kn.sprintf)("%x",parseInt(s,16))),i.length!==this.groups)throw new ja.AddressError("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(Iy).join(":")}decimal(){return this.parsedAddress.map(t=>(0,Kn.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new Vn.BigInteger(this.parsedAddress.map(Iy).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return Po.Address4.fromHex(new Vn.BigInteger(t.slice(96,128).join(""),2).toString(16))}to4in6(){let t=this.to4(),n=new e(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),i="";return/:$/.test(n)||(i=":"),n+i+t.address}inspectTeredo(){let t=this.getBitsBase16(0,32),r=this.getBits(80,96).xor(new Vn.BigInteger("ffff",16)).toString(),n=Po.Address4.fromHex(this.getBitsBase16(32,64)),i=Po.Address4.fromHex(this.getBits(96,128).xor(new Vn.BigInteger("ffffffff",16)).toString(16)),a=this.getBits(64,80),s=this.getBitsBase2(64,80),u=a.testBit(15),c=a.testBit(14),f=a.testBit(8),d=a.testBit(9),v=new Vn.BigInteger(s.slice(2,6)+s.slice(8,16),2).toString(10);return{prefix:(0,Kn.sprintf)("%s:%s",t.slice(0,4),t.slice(4,8)),server4:n.address,client4:i.address,flags:s,coneNat:u,microsoft:{reserved:c,universalLocal:d,groupIndividual:f,nonce:v},udpPort:r}}inspect6to4(){let t=this.getBitsBase16(0,16),r=Po.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:(0,Kn.sprintf)("%s",t.slice(0,4)),gateway:r.address}}to6to4(){if(!this.is4())return null;let t=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new e(t)}toByteArray(){let t=this.bigInteger().toByteArray();return t.length===17&&t[0]===0?t.slice(1):t}toUnsignedByteArray(){return this.toByteArray().map(By)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(By))}static fromUnsignedByteArray(t){let r=new Vn.BigInteger("256",10),n=new Vn.BigInteger("0",10),i=new Vn.BigInteger("1",10);for(let a=t.length-1;a>=0;a--)n=n.add(i.multiply(new Vn.BigInteger(t[a].toString(10),10))),i=i.multiply(r);return e.fromBigInteger(n)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000"}isMulticast(){return this.getType()==="Multicast"}is4(){return this.v4}isTeredo(){return this.isInSubnet(new e("2001::/32"))}is6to4(){return this.isInSubnet(new e("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(t){return t===void 0?t="":t=(0,Kn.sprintf)(":%s",t),(0,Kn.sprintf)("http://[%s]%s/",this.correctForm(),t)}link(t){t||(t={}),t.className===void 0&&(t.className=""),t.prefix===void 0&&(t.prefix="/#address="),t.v4===void 0&&(t.v4=!1);let r=this.correctForm;return t.v4&&(r=this.to4in6),t.className?(0,Kn.sprintf)('%2$s',t.prefix,r.call(this),t.className):(0,Kn.sprintf)('%2$s',t.prefix,r.call(this))}group(){if(this.elidedGroups===0)return Pg.simpleGroup(this.address).join(":");Z0(typeof this.elidedGroups=="number"),Z0(typeof this.elisionBegin=="number");let t=[],[r,n]=this.address.split("::");r.length?t.push(...Pg.simpleGroup(r)):t.push("");let i=["hover-group"];for(let a=this.elisionBegin;a',i.join(" "))),n.length?t.push(...Pg.simpleGroup(n,this.elisionEnd)):t.push(""),this.is4()&&(Z0(this.address4 instanceof Po.Address4),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let r=[],n=new e(this.correctForm());if(n.elidedGroups===0)r.push((0,$o.simpleRegularExpression)(n.parsedAddress));else if(n.elidedGroups===tr.GROUPS)r.push((0,$o.possibleElisions)(tr.GROUPS));else{let i=n.address.split("::");i[0].length&&r.push((0,$o.simpleRegularExpression)(i[0].split(":"))),Z0(typeof n.elidedGroups=="number"),r.push((0,$o.possibleElisions)(n.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&r.push((0,$o.simpleRegularExpression)(i[1].split(":"))),r=[r.join(":")]}return t||(r=["(?=^|",$o.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...r,")(?=[^\\w\\:]|",$o.ADDRESS_BOUNDARY,"|$)"]),r.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};Vs.Address6=$g});var $y=he(Bn=>{"use strict";var pT=Bn&&Bn.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),gT=Bn&&Bn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),mT=Bn&&Bn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&pT(t,e,r);return gT(t,e),t};Object.defineProperty(Bn,"__esModule",{value:!0});Bn.v6=Bn.AddressError=Bn.Address6=Bn.Address4=void 0;var vT=Fg();Object.defineProperty(Bn,"Address4",{enumerable:!0,get:function(){return vT.Address4}});var wT=Py();Object.defineProperty(Bn,"Address6",{enumerable:!0,get:function(){return wT.Address6}});var AT=z0();Object.defineProperty(Bn,"AddressError",{enumerable:!0,get:function(){return AT.AddressError}});var ET=mT(Ig());Bn.v6={helpers:ET}});var Oy=he(Ty=>{"use strict";(function(e){function t(){}function r(){}var n=String.fromCharCode,i={}.toString,a=i.call(e.SharedArrayBuffer),s=i(),u=e.Uint8Array,c=u||Array,f=u?ArrayBuffer:c,d=f.isView||function(w){return w&&"length"in w},v=i.call(f.prototype);f=r.prototype;var p=e.TextEncoder,h=new(u?Uint16Array:c)(32);t.prototype.decode=function(w){if(!d(w)){var m=i.call(w);if(m!==v&&m!==a&&m!==s)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");w=u?new c(w):w||[]}for(var y=m="",g=0,b=w.length|0,D=b-32|0,C,F,L=0,N=0,S,B=0,O=-1;g>4){case 15:if(S=w[g=g+1|0]&255,S>>6!==2||247>6===2?N+4|0:24,F=F+256&768;case 13:case 12:S=w[g=g+1|0]&255,L<<=6,L|=(F&31)<<6|S&63,N=N+7|0,g>6===2&&L>>N&&1114112>L?(F=L,L=L-65536|0,0<=L&&(O=(L>>10)+55296|0,F=(L&1023)+56320|0,31>B?(h[B]=O,B=B+1|0,O=-1):(S=O,O=F,F=S))):(F>>=8,g=g-F-1|0,F=65533),L=N=0,C=g<=D?32:b-g|0;default:h[B]=F;continue;case 11:case 10:case 9:case 8:}h[B]=65533}if(y+=n(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15],h[16],h[17],h[18],h[19],h[20],h[21],h[22],h[23],h[24],h[25],h[26],h[27],h[28],h[29],h[30],h[31]),32>B&&(y=y.slice(0,B-32|0)),g>>31,O=-1,y.length=C)y[b]=C;else{if(2047>=C)y[b]=192|C>>6;else{e:{if(55296<=C)if(56319>=C){var F=w.charCodeAt(g=g+1|0)|0;if(56320<=F&&57343>=F){if(C=(C<<10)+F-56613888|0,65535>18,y[b=b+1|0]=128|C>>12&63,y[b=b+1|0]=128|C>>6&63,y[b=b+1|0]=128|C&63;continue}break e}C=65533}else 57343>=C&&(C=65533);!D&&g<<1>12,y[b=b+1|0]=128|C>>6&63}y[b=b+1|0]=128|C&63}}return u?y.subarray(0,b):y.slice(0,b)},p||(e.TextDecoder=t,e.TextEncoder=r)})(typeof global>"u"?typeof self>"u"?Ty:self:global)});var Ky=he(Lg=>{"use strict";Lg.toString=function(e){switch(e){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+e};Lg.toType=function(e){switch(e.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}return e.toUpperCase().startsWith("UNKNOWN_")?parseInt(e.slice(8)):0}});var zy=he(Ug=>{"use strict";Ug.toString=function(e){switch(e){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+e};Ug.toRcode=function(e){switch(e.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}});var Gy=he(jg=>{"use strict";jg.toString=function(e){switch(e){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+e};jg.toOpcode=function(e){switch(e.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}});var Yy=he(Hg=>{"use strict";Hg.toString=function(e){switch(e){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+e};Hg.toClass=function(e){switch(e.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var Wy=he(Mg=>{"use strict";Mg.toString=function(e){switch(e){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return e<0?null:`OPTION_${e}`};Mg.toCode=function(e){if(typeof e=="number")return e;if(!e)return-1;switch(e.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let t=e.match(/_(\d+)$/);return t?parseInt(t[1],10):-1}});var Jy=he((Zy,qg)=>{var Xy=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=v,e.encode=d,e.familyOf=f,e.name=void 0,e.sizeOf=c,e.v6=e.v4=void 0;let t=/^(\d{1,3}\.){3,3}\d{1,3}$/,r=4,n=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,i=16,a={name:"v4",size:r,isFormat:p=>t.test(p),encode(p,h,w){w=~~w,h=h||new Uint8Array(w+r);let m=p.length,y=0;for(let g=0;gp.length>0&&n.test(p),encode(p,h,w){w=~~w;let m=w+i,y=-1,g=0,b=0,D=!0,C=!1;h=h||new Uint8Array(w+i);for(let F=0;F>8),w=97?L-=87:L>=65?L-=55:(L-=48,b=b*10+L),g=(g<<4)+L)}if(D===!1)C===!0?(w>8),w=y+2;F--)h[F]=h[F-2];h[y]=0,h[y+1]=0,y=w}if(y!==w&&y!==-1)for(w>m-2&&(w=m-2);m>y;)h[--m]=wy?h[--w]:0;else for(;w{"use strict";var He=p0().Buffer,Ja=Ky(),zT=zy(),GT=Gy(),cd=Yy(),Vg=Wy(),xo=Jy(),YT=0,Qy=32768,Kg=32768,WT=~Kg,e_=32768,XT=~e_,Pe=je.name={};Pe.encode=function(e,t,r,{mail:n=!1}={}){t||(t=He.alloc(Pe.encodingLength(e))),r||(r=0);let i=r,a=e.replace(/^\.|\.$/gm,"");if(a.length){let s=[];if(n){let u="";a.split(".").forEach(c=>{c.endsWith("\\")?u+=(u.length?".":"")+c.slice(0,-1):s.length===0&&u.length?s.push(u+"."+c):s.push(c)})}else s=a.split(".");for(let u=0;u=e.length)throw new Error("Cannot decode name (buffer overflow)");let c=e[t++];if(s+=u?0:1,c===0)break;if(c&192)if((c&192)===192){if(t+1>e.length)throw new Error("Cannot decode name (buffer overflow)");let f=e.readUInt16BE(t-1)-49152;if(f>=i)throw new Error("Cannot decode name (bad pointer)");t=f,i=f,s+=u?0:1,u=!0}else throw new Error("Cannot decode name (bad label)");else{if(t+c>e.length)throw new Error("Cannot decode name (buffer overflow)");if(a+=c+1,a>254)throw new Error("Cannot decode name (name too long)");let f=e.toString("utf-8",t,t+c);r&&(f=f.replace(/\./g,"\\.")),n.push(f),t+=c,s+=u?0:c}}return Pe.decode.bytes=s,n.length===0?".":n.join(".")};Pe.decode.bytes=0;Pe.encodingLength=function(e){return e==="."||e===".."?1:He.byteLength(e.replace(/^\.|\.$/gm,""))+2};var mt={};mt.encode=function(e,t,r){t||(t=He.alloc(mt.encodingLength(e))),r||(r=0);let n=t.write(e,r+1);return t[r]=n,mt.encode.bytes=n+1,t};mt.encode.bytes=0;mt.decode=function(e,t){t||(t=0);let r=e[t],n=e.toString("utf-8",t+1,t+1+r);return mt.decode.bytes=r+1,n};mt.decode.bytes=0;mt.encodingLength=function(e){return He.byteLength(e)+1};var gs={};gs.encode=function(e,t,r){t||(t=gs.encodingLength(e)),r||(r=0);let n=(e.flags||0)&32767,i=e.type==="response"?Qy:YT;return t.writeUInt16BE(e.id||0,r),t.writeUInt16BE(n|i,r+2),t.writeUInt16BE(e.questions.length,r+4),t.writeUInt16BE(e.answers.length,r+6),t.writeUInt16BE(e.authorities.length,r+8),t.writeUInt16BE(e.additionals.length,r+10),t};gs.encode.bytes=12;gs.decode=function(e,t){if(t||(t=0),e.length<12)throw new Error("Header must be 12 bytes");let r=e.readUInt16BE(t+2);return{id:e.readUInt16BE(t),type:r&Qy?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:GT.toString(r>>11&15),flag_aa:(r>>10&1)===1,flag_tc:(r>>9&1)===1,flag_rd:(r>>8&1)===1,flag_ra:(r>>7&1)===1,flag_z:(r>>6&1)===1,flag_ad:(r>>5&1)===1,flag_cd:(r>>4&1)===1,rcode:zT.toString(r&15),questions:new Array(e.readUInt16BE(t+4)),answers:new Array(e.readUInt16BE(t+6)),authorities:new Array(e.readUInt16BE(t+8)),additionals:new Array(e.readUInt16BE(t+10))}};gs.decode.bytes=12;gs.encodingLength=function(){return 12};var qa=je.unknown={};qa.encode=function(e,t,r){return t||(t=He.alloc(qa.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.length,r),e.copy(t,r+2),qa.encode.bytes=e.length+2,t};qa.encode.bytes=0;qa.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=e.slice(t+2,t+2+r);return qa.decode.bytes=r+2,n};qa.decode.bytes=0;qa.encodingLength=function(e){return e.length+2};var Va=je.ns={};Va.encode=function(e,t,r){return t||(t=He.alloc(Va.encodingLength(e))),r||(r=0),Pe.encode(e,t,r+2),t.writeUInt16BE(Pe.encode.bytes,r),Va.encode.bytes=Pe.encode.bytes+2,t};Va.encode.bytes=0;Va.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=Pe.decode(e,t+2);return Va.decode.bytes=r+2,n};Va.decode.bytes=0;Va.encodingLength=function(e){return Pe.encodingLength(e)+2};var Ka=je.soa={};Ka.encode=function(e,t,r){t||(t=He.alloc(Ka.encodingLength(e))),r||(r=0);let n=r;return r+=2,Pe.encode(e.mname,t,r),r+=Pe.encode.bytes,Pe.encode(e.rname,t,r,{mail:!0}),r+=Pe.encode.bytes,t.writeUInt32BE(e.serial||0,r),r+=4,t.writeUInt32BE(e.refresh||0,r),r+=4,t.writeUInt32BE(e.retry||0,r),r+=4,t.writeUInt32BE(e.expire||0,r),r+=4,t.writeUInt32BE(e.minimum||0,r),r+=4,t.writeUInt16BE(r-n-2,n),Ka.encode.bytes=r-n,t};Ka.encode.bytes=0;Ka.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.mname=Pe.decode(e,t),t+=Pe.decode.bytes,n.rname=Pe.decode(e,t,{mail:!0}),t+=Pe.decode.bytes,n.serial=e.readUInt32BE(t),t+=4,n.refresh=e.readUInt32BE(t),t+=4,n.retry=e.readUInt32BE(t),t+=4,n.expire=e.readUInt32BE(t),t+=4,n.minimum=e.readUInt32BE(t),t+=4,Ka.decode.bytes=t-r,n};Ka.decode.bytes=0;Ka.encodingLength=function(e){return 22+Pe.encodingLength(e.mname)+Pe.encodingLength(e.rname)};var za=je.txt={};za.encode=function(e,t,r){Array.isArray(e)||(e=[e]);for(let i=0;i0;){let a=e[t++];if(--n,n0&&(r.timeout=e.readUInt16BE(t),t+=2);break;case 14:r.tags=[];for(let a=0;a0;)n[a++]=pi.decode(e,t),t+=pi.decode.bytes,i-=pi.decode.bytes;return Ri.decode.bytes=t-r,n};Ri.decode.bytes=0;Ri.encodingLength=function(e){return 2+Gc(e||[],pi)};var zn=je.dnskey={};zn.PROTOCOL_DNSSEC=3;zn.ZONE_KEY=128;zn.SECURE_ENTRYPOINT=32768;zn.encode=function(e,t,r){t||(t=He.alloc(zn.encodingLength(e))),r||(r=0);let n=r,i=e.key;if(!He.isBuffer(i))throw new Error("Key must be a Buffer");return r+=2,t.writeUInt16BE(e.flags,r),r+=2,t.writeUInt8(zn.PROTOCOL_DNSSEC,r),r+=1,t.writeUInt8(e.algorithm,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,zn.encode.bytes=r-n,t.writeUInt16BE(zn.encode.bytes-2,n),t};zn.encode.bytes=0;zn.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);if(t+=2,n.flags=e.readUInt16BE(t),t+=2,e.readUInt8(t)!==zn.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return t+=1,n.algorithm=e.readUInt8(t),t+=1,n.key=e.slice(t,r+i+2),t+=n.key.length,zn.decode.bytes=t-r,n};zn.decode.bytes=0;zn.encodingLength=function(e){return 6+He.byteLength(e.key)};var zs=je.rrsig={};zs.encode=function(e,t,r){t||(t=He.alloc(zs.encodingLength(e))),r||(r=0);let n=r,i=e.signature;if(!He.isBuffer(i))throw new Error("Signature must be a Buffer");return r+=2,t.writeUInt16BE(Ja.toType(e.typeCovered),r),r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.labels,r),r+=1,t.writeUInt32BE(e.originalTTL,r),r+=4,t.writeUInt32BE(e.expiration,r),r+=4,t.writeUInt32BE(e.inception,r),r+=4,t.writeUInt16BE(e.keyTag,r),r+=2,Pe.encode(e.signersName,t,r),r+=Pe.encode.bytes,i.copy(t,r,0,i.length),r+=i.length,zs.encode.bytes=r-n,t.writeUInt16BE(zs.encode.bytes-2,n),t};zs.encode.bytes=0;zs.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.typeCovered=Ja.toString(e.readUInt16BE(t)),t+=2,n.algorithm=e.readUInt8(t),t+=1,n.labels=e.readUInt8(t),t+=1,n.originalTTL=e.readUInt32BE(t),t+=4,n.expiration=e.readUInt32BE(t),t+=4,n.inception=e.readUInt32BE(t),t+=4,n.keyTag=e.readUInt16BE(t),t+=2,n.signersName=Pe.decode(e,t),t+=Pe.decode.bytes,n.signature=e.slice(t,r+i+2),t+=n.signature.length,zs.decode.bytes=t-r,n};zs.decode.bytes=0;zs.encodingLength=function(e){return 20+Pe.encodingLength(e.signersName)+He.byteLength(e.signature)};var Gs=je.rp={};Gs.encode=function(e,t,r){t||(t=He.alloc(Gs.encodingLength(e))),r||(r=0);let n=r;return r+=2,Pe.encode(e.mbox||".",t,r,{mail:!0}),r+=Pe.encode.bytes,Pe.encode(e.txt||".",t,r),r+=Pe.encode.bytes,Gs.encode.bytes=r-n,t.writeUInt16BE(Gs.encode.bytes-2,n),t};Gs.encode.bytes=0;Gs.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.mbox=Pe.decode(e,t,{mail:!0})||".",t+=Pe.decode.bytes,n.txt=Pe.decode(e,t)||".",t+=Pe.decode.bytes,Gs.decode.bytes=t-r,n};Gs.decode.bytes=0;Gs.encodingLength=function(e){return 2+Pe.encodingLength(e.mbox||".")+Pe.encodingLength(e.txt||".")};var Jr={};Jr.encode=function(e,t,r){t||(t=He.alloc(Jr.encodingLength(e))),r||(r=0);let n=r;for(var i=[],a=0;a>8]===void 0&&(i[s>>8]=[]),i[s>>8][s>>3&31]|=1<<7-(s&7)}for(a=0;a>8]=Math.max(t[n>>8]||0,n&255)}var i=0;for(r=0;r>15&1)===1,r.options=Ri.decode(e,t+8),t+=8+Ri.decode.bytes;else{let i=e.readUInt16BE(t+2);r.ttl=e.readUInt32BE(t+4),r.class=cd.toString(i&WT),r.flush=!!(i&Kg);let a=zg(r.type);r.data=a.decode(e,t+8),t+=8+a.decode.bytes}return dn.decode.bytes=t-n,r};dn.decode.bytes=0;dn.encodingLength=function(e){let t=e.data!==null&&e.data!==void 0?e.data:e.options;return Pe.encodingLength(e.name)+8+zg(e.type).encodingLength(t)};var ps=je.question={};ps.encode=function(e,t,r){t||(t=He.alloc(ps.encodingLength(e))),r||(r=0);let n=r;return Pe.encode(e.name,t,r),r+=Pe.encode.bytes,t.writeUInt16BE(Ja.toType(e.type),r),r+=2,t.writeUInt16BE(cd.toClass(e.class===void 0?"IN":e.class),r),r+=2,ps.encode.bytes=r-n,e};ps.encode.bytes=0;ps.decode=function(e,t){t||(t=0);let r=t,n={};return n.name=Pe.decode(e,t),t+=Pe.decode.bytes,n.type=Ja.toString(e.readUInt16BE(t)),t+=2,n.class=cd.toString(e.readUInt16BE(t)),t+=2,!!(n.class&e_)&&(n.class&=XT),ps.decode.bytes=t-r,n};ps.decode.bytes=0;ps.encodingLength=function(e){return Pe.encodingLength(e.name)+4};je.AUTHORITATIVE_ANSWER=1024;je.TRUNCATED_RESPONSE=512;je.RECURSION_DESIRED=256;je.RECURSION_AVAILABLE=128;je.AUTHENTIC_DATA=32;je.CHECKING_DISABLED=16;je.DNSSEC_OK=32768;je.encode=function(e,t,r){let n=!t;n&&(t=He.alloc(je.encodingLength(e))),r||(r=0);let i=r;return e.questions||(e.questions=[]),e.answers||(e.answers=[]),e.authorities||(e.authorities=[]),e.additionals||(e.additionals=[]),gs.encode(e,t,r),r+=gs.encode.bytes,r=vf(e.questions,ps,t,r),r=vf(e.answers,dn,t,r),r=vf(e.authorities,dn,t,r),r=vf(e.additionals,dn,t,r),je.encode.bytes=r-i,n&&je.encode.bytes!==t.length?t.slice(0,je.encode.bytes):t};je.encode.bytes=0;je.decode=function(e,t){t||(t=0);let r=t,n=gs.decode(e,t);return t+=gs.decode.bytes,t=od(n.questions,ps,e,t),t=od(n.answers,dn,e,t),t=od(n.authorities,dn,e,t),t=od(n.additionals,dn,e,t),je.decode.bytes=t-r,n};je.decode.bytes=0;je.encodingLength=function(e){return gs.encodingLength(e)+Gc(e.questions||[],ps)+Gc(e.answers||[],dn)+Gc(e.authorities||[],dn)+Gc(e.additionals||[],dn)};je.streamEncode=function(e){let t=je.encode(e),r=He.alloc(2);r.writeUInt16BE(t.byteLength);let n=He.concat([r,t]);return je.streamEncode.bytes=n.byteLength,n};je.streamEncode.bytes=0;je.streamDecode=function(e){let t=e.readUInt16BE(0);if(e.byteLength{(function(){var e,t="4.17.21",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",a="Invalid `variable` option passed into `_.template`",s="__lodash_hash_undefined__",u=500,c="__lodash_placeholder__",f=1,d=2,v=4,p=1,h=2,w=1,m=2,y=4,g=8,b=16,D=32,C=64,F=128,L=256,N=512,S=30,B="...",O=800,x=16,U=1,G=2,H=3,K=1/0,Y=9007199254740991,ne=17976931348623157e292,Ce=NaN,Fe=4294967295,xe=Fe-1,et=Fe>>>1,Qe=[["ary",F],["bind",w],["bindKey",m],["curry",g],["curryRight",b],["flip",N],["partial",D],["partialRight",C],["rearg",L]],ut="[object Arguments]",ot="[object Array]",Qr="[object AsyncFunction]",er="[object Boolean]",Et="[object Date]",gr="[object DOMException]",rr="[object Error]",lt="[object Function]",Mt="[object GeneratorFunction]",tt="[object Map]",qe="[object Number]",nr="[object Null]",Ue="[object Object]",$t="[object Promise]",en="[object Proxy]",Zt="[object RegExp]",qt="[object Set]",pt="[object String]",Br="[object Symbol]",Ei="[object Undefined]",tn="[object WeakMap]",_t="[object WeakSet]",Ne="[object ArrayBuffer]",De="[object DataView]",mr="[object Float32Array]",rn="[object Float64Array]",rt="[object Int8Array]",pa="[object Int16Array]",nn="[object Int32Array]",ge="[object Uint8Array]",_s="[object Uint8ClampedArray]",It="[object Uint16Array]",Vr="[object Uint32Array]",rs=/\b__p \+= '';/g,lu=/\b(__p \+=) '' \+/g,Cs=/(__e\(.*?\)|\b__t\)) \+\n'';/g,fu=/&(?:amp|lt|gt|quot|#39);/g,Ds=/[&<>"']/g,ns=RegExp(fu.source),xt=RegExp(Ds.source),Zn=/<%-([\s\S]+?)%>/g,hu=/<%([\s\S]+?)%>/g,du=/<%=([\s\S]+?)%>/g,pu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fs=/^\w*$/,Yu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ss=/[\\^$.*+?()[\]{}|]/g,Wu=RegExp(Ss.source),ga=/^\s+/,te=/\s/,le=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ke=/\{\n\/\* \[wrapped with (.+)\] \*/,Te=/,? & /,Me=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,nt=/[()=,{}\[\]\/\s]/,ct=/\\(\\)?/g,Dr=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Nt=/\w*$/,Jn=/^[-+]0x[0-9a-f]+$/i,ji=/^0b[01]+$/i,sn=/^\[object .+?Constructor\]$/,wn=/^0o[0-7]+$/i,vr=/^(?:0|[1-9]\d*)$/,an=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Nr=/($^)/,Xu=/['\n\r\u2028\u2029\\]/g,Is="\\ud800-\\udfff",Rn="\\u0300-\\u036f",Pt="\\ufe20-\\ufe2f",wr="\\u20d0-\\u20ff",Xe=Rn+Pt+wr,ir="\\u2700-\\u27bf",Kr="a-z\\xdf-\\xf6\\xf8-\\xff",sr="\\xac\\xb1\\xd7\\xf7",Lt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Tn="\\u2000-\\u206f",Qn=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ei="A-Z\\xc0-\\xd6\\xd8-\\xde",On="\\ufe0e\\ufe0f",Pr=sr+Lt+Tn+Qn,or="['\u2019]",Fl="["+Is+"]",Zu="["+Pr+"]",zr="["+Xe+"]",Ju="\\d+",Yo="["+ir+"]",Wo="["+Kr+"]",Qu="[^"+Is+Pr+Ju+ir+Kr+ei+"]",Bs="\\ud83c[\\udffb-\\udfff]",eo="(?:"+zr+"|"+Bs+")",Xo="[^"+Is+"]",to="(?:\\ud83c[\\udde6-\\uddff]){2}",ro="[\\ud800-\\udbff][\\udc00-\\udfff]",kn="["+ei+"]",R="\\u200d",k="(?:"+Wo+"|"+Qu+")",V="(?:"+kn+"|"+Qu+")",J="(?:"+or+"(?:d|ll|m|re|s|t|ve))?",ve="(?:"+or+"(?:D|LL|M|RE|S|T|VE))?",Ee=eo+"?",Ie="["+On+"]?",Re="(?:"+R+"(?:"+[Xo,to,ro].join("|")+")"+Ie+Ee+")*",Vt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ar="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",un=Ie+Ee+Re,on="(?:"+[Yo,to,ro].join("|")+")"+un,bi="(?:"+[Xo+zr+"?",zr,to,ro,Fl].join("|")+")",gu=RegExp(or,"g"),Nn=RegExp(zr,"g"),cn=RegExp(Bs+"(?="+Bs+")|"+bi+un,"g"),mu=RegExp([kn+"?"+Wo+"+"+J+"(?="+[Zu,kn,"$"].join("|")+")",V+"+"+ve+"(?="+[Zu,kn+k,"$"].join("|")+")",kn+"?"+k+"+"+J,kn+"+"+ve,Ar,Vt,Ju,on].join("|"),"g"),Hi=RegExp("["+R+Is+Xe+On+"]"),no=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,hp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],dp=-1,Jt={};Jt[mr]=Jt[rn]=Jt[rt]=Jt[pa]=Jt[nn]=Jt[ge]=Jt[_s]=Jt[It]=Jt[Vr]=!0,Jt[ut]=Jt[ot]=Jt[Ne]=Jt[er]=Jt[De]=Jt[Et]=Jt[rr]=Jt[lt]=Jt[tt]=Jt[qe]=Jt[Ue]=Jt[Zt]=Jt[qt]=Jt[pt]=Jt[tn]=!1;var Gt={};Gt[ut]=Gt[ot]=Gt[Ne]=Gt[De]=Gt[er]=Gt[Et]=Gt[mr]=Gt[rn]=Gt[rt]=Gt[pa]=Gt[nn]=Gt[tt]=Gt[qe]=Gt[Ue]=Gt[Zt]=Gt[qt]=Gt[pt]=Gt[Br]=Gt[ge]=Gt[_s]=Gt[It]=Gt[Vr]=!0,Gt[rr]=Gt[lt]=Gt[tn]=!1;var pp={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},gp={"&":"&","<":"<",">":">",'"':""","'":"'"},mp={"&":"&","<":"<",">":">",""":'"',"'":"'"},vp={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},wp=parseFloat,Ap=parseInt,mh=typeof global=="object"&&global&&global.Object===Object&&global,Ep=typeof self=="object"&&self&&self.Object===Object&&self,$r=mh||Ep||Function("return this")(),Sl=typeof Wc=="object"&&Wc&&!Wc.nodeType&&Wc,ma=Sl&&typeof wf=="object"&&wf&&!wf.nodeType&&wf,vh=ma&&ma.exports===Sl,Il=vh&&mh.process,ti=function(){try{var re=ma&&ma.require&&ma.require("util").types;return re||Il&&Il.binding&&Il.binding("util")}catch{}}(),wh=ti&&ti.isArrayBuffer,Ah=ti&&ti.isDate,Eh=ti&&ti.isMap,bh=ti&&ti.isRegExp,yh=ti&&ti.isSet,_h=ti&&ti.isTypedArray;function Ln(re,fe,oe){switch(oe.length){case 0:return re.call(fe);case 1:return re.call(fe,oe[0]);case 2:return re.call(fe,oe[0],oe[1]);case 3:return re.call(fe,oe[0],oe[1],oe[2])}return re.apply(fe,oe)}function bp(re,fe,oe,Oe){for(var Ze=-1,Ct=re==null?0:re.length;++Ze-1}function io(re,fe,oe){for(var Oe=-1,Ze=re==null?0:re.length;++Oe-1;);return oe}function Sh(re,fe){for(var oe=re.length;oe--&&vu(fe,re[oe],0)>-1;);return oe}function Ih(re,fe){for(var oe=re.length,Oe=0;oe--;)re[oe]===fe&&++Oe;return Oe}var Tl=me(pp),Cp=me(gp);function Bh(re){return"\\"+vp[re]}function Dp(re,fe){return re==null?e:re[fe]}function wa(re){return Hi.test(re)}function Fp(re){return no.test(re)}function Sp(re){for(var fe,oe=[];!(fe=re.next()).done;)oe.push(fe.value);return oe}function Ol(re){var fe=-1,oe=Array(re.size);return re.forEach(function(Oe,Ze){oe[++fe]=[Ze,Oe]}),oe}function ln(re,fe){return function(oe){return re(fe(oe))}}function Ci(re,fe){for(var oe=-1,Oe=re.length,Ze=0,Ct=[];++oe-1}function GD(o,l){var E=this.__data__,I=Hh(E,o);return I<0?(++this.size,E.push([o,l])):E[I][1]=l,this}_a.prototype.clear=qD,_a.prototype.delete=VD,_a.prototype.get=KD,_a.prototype.has=zD,_a.prototype.set=GD;function Ca(o){var l=-1,E=o==null?0:o.length;for(this.clear();++l=l?o:l)),o}function Ki(o,l,E,I,T,q){var W,Z=l&f,ie=l&d,we=l&v;if(E&&(W=T?E(o,I,T,q):E(o)),W!==e)return W;if(!hr(o))return o;var Ae=st(o);if(Ae){if(W=Z5(o),!Z)return si(o,W)}else{var be=bn(o),Be=be==lt||be==Mt;if(yu(o))return tw(o,Z);if(be==Ue||be==ut||Be&&!T){if(W=ie||Be?{}:Ew(o),!Z)return ie?j5(o,c5(W,o)):U5(o,$2(W,o))}else{if(!Gt[be])return T?o:{};W=J5(o,be,Z)}}q||(q=new ss);var Le=q.get(o);if(Le)return Le;q.set(o,W),Ww(o)?o.forEach(function(We){W.add(Ki(We,l,E,We,o,q))}):Gw(o)&&o.forEach(function(We,wt){W.set(wt,Ki(We,l,E,wt,o,q))});var Ye=we?ie?a1:s1:ie?ui:Gr,ht=Ae?e:Ye(o);return ri(ht||o,function(We,wt){ht&&(wt=We,We=o[wt]),jl(W,wt,Ki(We,l,E,wt,o,q))}),W}function l5(o){var l=Gr(o);return function(E){return x2(E,o,l)}}function x2(o,l,E){var I=E.length;if(o==null)return!I;for(o=Kt(o);I--;){var T=E[I],q=l[T],W=o[T];if(W===e&&!(T in o)||!q(W))return!1}return!0}function R2(o,l,E){if(typeof o!="function")throw new ii(i);return Gl(function(){o.apply(e,E)},l)}function Hl(o,l,E,I){var T=-1,q=Un,W=!0,Z=o.length,ie=[],we=l.length;if(!Z)return ie;E&&(l=ee(l,An(E))),I?(q=io,W=!1):l.length>=r&&(q=ao,W=!1,l=new oo(l));e:for(;++TT?0:T+E),I=I===e||I>T?T:ft(I),I<0&&(I+=T),I=E>I?0:Zw(I);E0&&E(Z)?l>1?fn(Z,l-1,E,I,T):_i(T,Z):I||(T[T.length]=Z)}return T}var Hp=uw(),k2=uw(!0);function $s(o,l){return o&&Hp(o,l,Gr)}function Mp(o,l){return o&&k2(o,l,Gr)}function qh(o,l){return yi(l,function(E){return Ba(o[E])})}function lo(o,l){l=Eu(l,o);for(var E=0,I=l.length;o!=null&&El}function d5(o,l){return o!=null&&Bt.call(o,l)}function p5(o,l){return o!=null&&l in Kt(o)}function g5(o,l,E){return o>=En(l,E)&&o=120&&Ae.length>=120)?new oo(W&&Ae):e}Ae=o[0];var be=-1,Be=Z[0];e:for(;++be-1;)Z!==o&&Tt.call(Z,ie,1),Tt.call(o,ie,1);return o}function G2(o,l){for(var E=o?l.length:0,I=E-1;E--;){var T=l[E];if(E==I||T!==q){var q=T;Ia(T)?Tt.call(o,T,1):Jp(o,T)}}return o}function Wp(o,l){return o+ae(S2()*(l-o+1))}function I5(o,l,E,I){for(var T=-1,q=Lr(z((l-o)/(E||1)),0),W=oe(q);q--;)W[I?q:++T]=o,o+=E;return W}function Xp(o,l){var E="";if(!o||l<1||l>Y)return E;do l%2&&(E+=o),l=ae(l/2),l&&(o+=o);while(l);return E}function gt(o,l){return d1(_w(o,l,oi),o+"")}function B5(o){return P2(vc(o))}function P5(o,l){var E=vc(o);return e0(E,co(l,0,E.length))}function Vl(o,l,E,I){if(!hr(o))return o;l=Eu(l,o);for(var T=-1,q=l.length,W=q-1,Z=o;Z!=null&&++TT?0:T+l),E=E>T?T:E,E<0&&(E+=T),T=l>E?0:E-l>>>0,l>>>=0;for(var q=oe(T);++I>>1,W=o[q];W!==null&&!Si(W)&&(E?W<=l:W=r){var we=l?null:V5(o);if(we)return Di(we);W=!1,T=ao,ie=new oo}else ie=l?[]:Z;e:for(;++I=I?o:zi(o,l,E)}var ew=_||function(o){return $r.clearTimeout(o)};function tw(o,l){if(l)return o.slice();var E=o.length,I=Th?Th(E):new o.constructor(E);return o.copy(I),I}function r1(o){var l=new o.constructor(o.byteLength);return new uc(l).set(new uc(o)),l}function O5(o,l){var E=l?r1(o.buffer):o.buffer;return new o.constructor(E,o.byteOffset,o.byteLength)}function k5(o){var l=new o.constructor(o.source,Nt.exec(o));return l.lastIndex=o.lastIndex,l}function N5(o){return Ul?Kt(Ul.call(o)):{}}function rw(o,l){var E=l?r1(o.buffer):o.buffer;return new o.constructor(E,o.byteOffset,o.length)}function nw(o,l){if(o!==l){var E=o!==e,I=o===null,T=o===o,q=Si(o),W=l!==e,Z=l===null,ie=l===l,we=Si(l);if(!Z&&!we&&!q&&o>l||q&&W&&ie&&!Z&&!we||I&&W&&ie||!E&&ie||!T)return 1;if(!I&&!q&&!we&&o=Z)return ie;var we=E[I];return ie*(we=="desc"?-1:1)}}return o.index-l.index}function iw(o,l,E,I){for(var T=-1,q=o.length,W=E.length,Z=-1,ie=l.length,we=Lr(q-W,0),Ae=oe(ie+we),be=!I;++Z1?E[T-1]:e,W=T>2?E[2]:e;for(q=o.length>3&&typeof q=="function"?(T--,q):e,W&&Hn(E[0],E[1],W)&&(q=T<3?e:q,T=1),l=Kt(l);++I-1?T[q?l[W]:W]:e}}function lw(o){return Sa(function(l){var E=l.length,I=E,T=Vi.prototype.thru;for(o&&l.reverse();I--;){var q=l[I];if(typeof q!="function")throw new ii(i);if(T&&!W&&Jh(q)=="wrapper")var W=new Vi([],!0)}for(I=W?I:E;++I1&&Dt.reverse(),Ae&&ieZ))return!1;var we=q.get(o),Ae=q.get(l);if(we&&Ae)return we==l&&Ae==o;var be=-1,Be=!0,Le=E&h?new oo:e;for(q.set(o,l),q.set(l,o);++be1?"& ":"")+l[I],l=l.join(E>2?", ":" "),o.replace(le,`{ /* [wrapped with `+l+`] */ `)}function e8(o){return st(o)||po(o)||!!(Nh&&o&&o[Nh])}function Ia(o,l){var E=typeof o;return l=l??Y,!!l&&(E=="number"||E!="symbol"&&vr.test(o))&&o>-1&&o%1==0&&o0){if(++l>=O)return arguments[0]}else l=0;return o.apply(e,arguments)}}function e0(o,l){var E=-1,I=o.length,T=I-1;for(l=l===e?I:l;++E1?o[l-1]:e;return E=typeof E=="function"?(o.pop(),E):e,Ow(o,E)});function kw(o){var l=M(o);return l.__chain__=!0,l}function fF(o,l){return l(o),o}function t0(o,l){return l(o)}var hF=Sa(function(o){var l=o.length,E=l?o[0]:0,I=this.__wrapped__,T=function(q){return jp(q,o)};return l>1||this.__actions__.length||!(I instanceof bt)||!Ia(E)?this.thru(T):(I=I.slice(E,+E+(l?1:0)),I.__actions__.push({func:t0,args:[T],thisArg:e}),new Vi(I,this.__chain__).thru(function(q){return l&&!q.length&&q.push(e),q}))});function dF(){return kw(this)}function pF(){return new Vi(this.value(),this.__chain__)}function gF(){this.__values__===e&&(this.__values__=Xw(this.value()));var o=this.__index__>=this.__values__.length,l=o?e:this.__values__[this.__index__++];return{done:o,value:l}}function mF(){return this}function vF(o){for(var l,E=this;E instanceof jh;){var I=Bw(E);I.__index__=0,I.__values__=e,l?T.__wrapped__=I:l=I;var T=I;E=E.__wrapped__}return T.__wrapped__=o,l}function wF(){var o=this.__wrapped__;if(o instanceof bt){var l=o;return this.__actions__.length&&(l=new bt(this)),l=l.reverse(),l.__actions__.push({func:t0,args:[p1],thisArg:e}),new Vi(l,this.__chain__)}return this.thru(p1)}function AF(){return J2(this.__wrapped__,this.__actions__)}var EF=Gh(function(o,l,E){Bt.call(o,E)?++o[E]:Da(o,E,1)});function bF(o,l,E){var I=st(o)?it:f5;return E&&Hn(o,l,E)&&(l=e),I(o,ze(l,3))}function yF(o,l){var E=st(o)?yi:O2;return E(o,ze(l,3))}var _F=cw(Pw),CF=cw($w);function DF(o,l){return fn(r0(o,l),1)}function FF(o,l){return fn(r0(o,l),K)}function SF(o,l,E){return E=E===e?1:ft(E),fn(r0(o,l),E)}function Nw(o,l){var E=st(o)?ri:wu;return E(o,ze(l,3))}function Lw(o,l){var E=st(o)?P:T2;return E(o,ze(l,3))}var IF=Gh(function(o,l,E){Bt.call(o,E)?o[E].push(l):Da(o,E,[l])});function BF(o,l,E,I){o=ai(o)?o:vc(o),E=E&&!I?ft(E):0;var T=o.length;return E<0&&(E=Lr(T+E,0)),u0(o)?E<=T&&o.indexOf(l,E)>-1:!!T&&vu(o,l,E)>-1}var PF=gt(function(o,l,E){var I=-1,T=typeof l=="function",q=ai(o)?oe(o.length):[];return wu(o,function(W){q[++I]=T?Ln(l,W,E):Ml(W,l,E)}),q}),$F=Gh(function(o,l,E){Da(o,E,l)});function r0(o,l){var E=st(o)?ee:H2;return E(o,ze(l,3))}function xF(o,l,E,I){return o==null?[]:(st(l)||(l=l==null?[]:[l]),E=I?e:E,st(E)||(E=E==null?[]:[E]),K2(o,l,E))}var RF=Gh(function(o,l,E){o[E?0:1].push(l)},function(){return[[],[]]});function TF(o,l,E){var I=st(o)?Bl:Dh,T=arguments.length<3;return I(o,ze(l,4),E,T,wu)}function OF(o,l,E){var I=st(o)?D2:Dh,T=arguments.length<3;return I(o,ze(l,4),E,T,T2)}function kF(o,l){var E=st(o)?yi:O2;return E(o,s0(ze(l,3)))}function NF(o){var l=st(o)?P2:B5;return l(o)}function LF(o,l,E){(E?Hn(o,l,E):l===e)?l=1:l=ft(l);var I=st(o)?a5:P5;return I(o,l)}function UF(o){var l=st(o)?u5:x5;return l(o)}function jF(o){if(o==null)return 0;if(ai(o))return u0(o)?Aa(o):o.length;var l=bn(o);return l==tt||l==qt?o.size:zp(o).length}function HF(o,l,E){var I=st(o)?Ch:R5;return E&&Hn(o,l,E)&&(l=e),I(o,ze(l,3))}var MF=gt(function(o,l){if(o==null)return[];var E=l.length;return E>1&&Hn(o,l[0],l[1])?l=[]:E>2&&Hn(l[0],l[1],l[2])&&(l=[l[0]]),K2(o,fn(l,1),[])}),n0=j||function(){return $r.Date.now()};function qF(o,l){if(typeof l!="function")throw new ii(i);return o=ft(o),function(){if(--o<1)return l.apply(this,arguments)}}function Uw(o,l,E){return l=E?e:l,l=o&&l==null?o.length:l,Fa(o,F,e,e,e,e,l)}function jw(o,l){var E;if(typeof l!="function")throw new ii(i);return o=ft(o),function(){return--o>0&&(E=l.apply(this,arguments)),o<=1&&(l=e),E}}var m1=gt(function(o,l,E){var I=w;if(E.length){var T=Ci(E,gc(m1));I|=D}return Fa(o,I,l,E,T)}),Hw=gt(function(o,l,E){var I=w|m;if(E.length){var T=Ci(E,gc(Hw));I|=D}return Fa(l,I,o,E,T)});function Mw(o,l,E){l=E?e:l;var I=Fa(o,g,e,e,e,e,e,l);return I.placeholder=Mw.placeholder,I}function qw(o,l,E){l=E?e:l;var I=Fa(o,b,e,e,e,e,e,l);return I.placeholder=qw.placeholder,I}function Vw(o,l,E){var I,T,q,W,Z,ie,we=0,Ae=!1,be=!1,Be=!0;if(typeof o!="function")throw new ii(i);l=Yi(l)||0,hr(E)&&(Ae=!!E.leading,be="maxWait"in E,q=be?Lr(Yi(E.maxWait)||0,l):q,Be="trailing"in E?!!E.trailing:Be);function Le(Sr){var us=I,$a=T;return I=T=e,we=Sr,W=o.apply($a,us),W}function Ye(Sr){return we=Sr,Z=Gl(wt,l),Ae?Le(Sr):W}function ht(Sr){var us=Sr-ie,$a=Sr-we,cA=l-us;return be?En(cA,q-$a):cA}function We(Sr){var us=Sr-ie,$a=Sr-we;return ie===e||us>=l||us<0||be&&$a>=q}function wt(){var Sr=n0();if(We(Sr))return Dt(Sr);Z=Gl(wt,ht(Sr))}function Dt(Sr){return Z=e,Be&&I?Le(Sr):(I=T=e,W)}function Ii(){Z!==e&&ew(Z),we=0,I=ie=T=Z=e}function Mn(){return Z===e?W:Dt(n0())}function Bi(){var Sr=n0(),us=We(Sr);if(I=arguments,T=this,ie=Sr,us){if(Z===e)return Ye(ie);if(be)return ew(Z),Z=Gl(wt,l),Le(ie)}return Z===e&&(Z=Gl(wt,l)),W}return Bi.cancel=Ii,Bi.flush=Mn,Bi}var VF=gt(function(o,l){return R2(o,1,l)}),KF=gt(function(o,l,E){return R2(o,Yi(l)||0,E)});function zF(o){return Fa(o,N)}function i0(o,l){if(typeof o!="function"||l!=null&&typeof l!="function")throw new ii(i);var E=function(){var I=arguments,T=l?l.apply(this,I):I[0],q=E.cache;if(q.has(T))return q.get(T);var W=o.apply(this,I);return E.cache=q.set(T,W)||q,W};return E.cache=new(i0.Cache||Ca),E}i0.Cache=Ca;function s0(o){if(typeof o!="function")throw new ii(i);return function(){var l=arguments;switch(l.length){case 0:return!o.call(this);case 1:return!o.call(this,l[0]);case 2:return!o.call(this,l[0],l[1]);case 3:return!o.call(this,l[0],l[1],l[2])}return!o.apply(this,l)}}function GF(o){return jw(2,o)}var YF=T5(function(o,l){l=l.length==1&&st(l[0])?ee(l[0],An(ze())):ee(fn(l,1),An(ze()));var E=l.length;return gt(function(I){for(var T=-1,q=En(I.length,E);++T=l}),po=L2(function(){return arguments}())?L2:function(o){return br(o)&&Bt.call(o,"callee")&&!kh.call(o,"callee")},st=oe.isArray,cS=wh?An(wh):v5;function ai(o){return o!=null&&a0(o.length)&&!Ba(o)}function Fr(o){return br(o)&&ai(o)}function lS(o){return o===!0||o===!1||br(o)&&jn(o)==er}var yu=zt||I1,fS=Ah?An(Ah):w5;function hS(o){return br(o)&&o.nodeType===1&&!Yl(o)}function dS(o){if(o==null)return!0;if(ai(o)&&(st(o)||typeof o=="string"||typeof o.splice=="function"||yu(o)||mc(o)||po(o)))return!o.length;var l=bn(o);if(l==tt||l==qt)return!o.size;if(zl(o))return!zp(o).length;for(var E in o)if(Bt.call(o,E))return!1;return!0}function pS(o,l){return ql(o,l)}function gS(o,l,E){E=typeof E=="function"?E:e;var I=E?E(o,l):e;return I===e?ql(o,l,e,E):!!I}function w1(o){if(!br(o))return!1;var l=jn(o);return l==rr||l==gr||typeof o.message=="string"&&typeof o.name=="string"&&!Yl(o)}function mS(o){return typeof o=="number"&&Er(o)}function Ba(o){if(!hr(o))return!1;var l=jn(o);return l==lt||l==Mt||l==Qr||l==en}function zw(o){return typeof o=="number"&&o==ft(o)}function a0(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=Y}function hr(o){var l=typeof o;return o!=null&&(l=="object"||l=="function")}function br(o){return o!=null&&typeof o=="object"}var Gw=Eh?An(Eh):E5;function vS(o,l){return o===l||Kp(o,l,o1(l))}function wS(o,l,E){return E=typeof E=="function"?E:e,Kp(o,l,o1(l),E)}function AS(o){return Yw(o)&&o!=+o}function ES(o){if(n8(o))throw new Ze(n);return U2(o)}function bS(o){return o===null}function yS(o){return o==null}function Yw(o){return typeof o=="number"||br(o)&&jn(o)==qe}function Yl(o){if(!br(o)||jn(o)!=Ue)return!1;var l=oc(o);if(l===null)return!0;var E=Bt.call(l,"constructor")&&l.constructor;return typeof E=="function"&&E instanceof E&&nc.call(E)==Tp}var A1=bh?An(bh):b5;function _S(o){return zw(o)&&o>=-Y&&o<=Y}var Ww=yh?An(yh):y5;function u0(o){return typeof o=="string"||!st(o)&&br(o)&&jn(o)==pt}function Si(o){return typeof o=="symbol"||br(o)&&jn(o)==Br}var mc=_h?An(_h):_5;function CS(o){return o===e}function DS(o){return br(o)&&bn(o)==tn}function FS(o){return br(o)&&jn(o)==_t}var SS=Zh(Gp),IS=Zh(function(o,l){return o<=l});function Xw(o){if(!o)return[];if(ai(o))return u0(o)?ni(o):si(o);if(ba&&o[ba])return Sp(o[ba]());var l=bn(o),E=l==tt?Ol:l==qt?Di:vc;return E(o)}function Pa(o){if(!o)return o===0?o:0;if(o=Yi(o),o===K||o===-K){var l=o<0?-1:1;return l*ne}return o===o?o:0}function ft(o){var l=Pa(o),E=l%1;return l===l?E?l-E:l:0}function Zw(o){return o?co(ft(o),0,Fe):0}function Yi(o){if(typeof o=="number")return o;if(Si(o))return Ce;if(hr(o)){var l=typeof o.valueOf=="function"?o.valueOf():o;o=hr(l)?l+"":l}if(typeof o!="string")return o===0?o:+o;o=Rl(o);var E=ji.test(o);return E||wn.test(o)?Ap(o.slice(2),E?2:8):Jn.test(o)?Ce:+o}function Jw(o){return xs(o,ui(o))}function BS(o){return o?co(ft(o),-Y,Y):o===0?o:0}function Ut(o){return o==null?"":Fi(o)}var PS=dc(function(o,l){if(zl(l)||ai(l)){xs(l,Gr(l),o);return}for(var E in l)Bt.call(l,E)&&jl(o,E,l[E])}),Qw=dc(function(o,l){xs(l,ui(l),o)}),o0=dc(function(o,l,E,I){xs(l,ui(l),o,I)}),$S=dc(function(o,l,E,I){xs(l,Gr(l),o,I)}),xS=Sa(jp);function RS(o,l){var E=hc(o);return l==null?E:$2(E,l)}var TS=gt(function(o,l){o=Kt(o);var E=-1,I=l.length,T=I>2?l[2]:e;for(T&&Hn(l[0],l[1],T)&&(I=1);++E1),q}),xs(o,a1(o),E),I&&(E=Ki(E,f|d|v,K5));for(var T=l.length;T--;)Jp(E,l[T]);return E});function JS(o,l){return tA(o,s0(ze(l)))}var QS=Sa(function(o,l){return o==null?{}:F5(o,l)});function tA(o,l){if(o==null)return{};var E=ee(a1(o),function(I){return[I]});return l=ze(l),z2(o,E,function(I,T){return l(I,T[0])})}function eI(o,l,E){l=Eu(l,o);var I=-1,T=l.length;for(T||(T=1,o=e);++Il){var I=o;o=l,l=I}if(E||o%1||l%1){var T=S2();return En(o+T*(l-o+wp("1e-"+((T+"").length-1))),l)}return Wp(o,l)}var fI=pc(function(o,l,E){return l=l.toLowerCase(),o+(E?iA(l):l)});function iA(o){return y1(Ut(o).toLowerCase())}function sA(o){return o=Ut(o),o&&o.replace(an,Tl).replace(Nn,"")}function hI(o,l,E){o=Ut(o),l=Fi(l);var I=o.length;E=E===e?I:co(ft(E),0,I);var T=E;return E-=l.length,E>=0&&o.slice(E,T)==l}function dI(o){return o=Ut(o),o&&xt.test(o)?o.replace(Ds,Cp):o}function pI(o){return o=Ut(o),o&&Wu.test(o)?o.replace(Ss,"\\$&"):o}var gI=pc(function(o,l,E){return o+(E?"-":"")+l.toLowerCase()}),mI=pc(function(o,l,E){return o+(E?" ":"")+l.toLowerCase()}),vI=ow("toLowerCase");function wI(o,l,E){o=Ut(o),l=ft(l);var I=l?Aa(o):0;if(!l||I>=l)return o;var T=(l-I)/2;return Xh(ae(T),E)+o+Xh(z(T),E)}function AI(o,l,E){o=Ut(o),l=ft(l);var I=l?Aa(o):0;return l&&I>>0,E?(o=Ut(o),o&&(typeof l=="string"||l!=null&&!A1(l))&&(l=Fi(l),!l&&wa(o))?bu(ni(o),0,E):o.split(l,E)):[]}var FI=pc(function(o,l,E){return o+(E?" ":"")+y1(l)});function SI(o,l,E){return o=Ut(o),E=E==null?0:co(ft(E),0,o.length),l=Fi(l),o.slice(E,E+l.length)==l}function II(o,l,E){var I=M.templateSettings;E&&Hn(o,l,E)&&(l=e),o=Ut(o),l=o0({},l,I,gw);var T=o0({},l.imports,I.imports,gw),q=Gr(T),W=so(T,q),Z,ie,we=0,Ae=l.interpolate||Nr,be="__p += '",Be=tc((l.escape||Nr).source+"|"+Ae.source+"|"+(Ae===du?Dr:Nr).source+"|"+(l.evaluate||Nr).source+"|$","g"),Le="//# sourceURL="+(Bt.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++dp+"]")+` `;o.replace(Be,function(We,wt,Dt,Ii,Mn,Bi){return Dt||(Dt=Ii),be+=o.slice(we,Bi).replace(Xu,Bh),wt&&(Z=!0,be+=`' + __e(`+wt+`) + '`),Mn&&(ie=!0,be+=`'; `+Mn+`; __p += '`),Dt&&(be+=`' + ((__t = (`+Dt+`)) == null ? '' : __t) + '`),we=Bi+We.length,We}),be+=`'; `;var Ye=Bt.call(l,"variable")&&l.variable;if(!Ye)be=`with (obj) { `+be+` } `;else if(nt.test(Ye))throw new Ze(a);be=(ie?be.replace(rs,""):be).replace(lu,"$1").replace(Cs,"$1;"),be="function("+(Ye||"obj")+`) { `+(Ye?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(Z?", __e = _.escape":"")+(ie?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+be+`return __p }`;var ht=uA(function(){return Ct(q,Le+"return "+be).apply(e,W)});if(ht.source=be,w1(ht))throw ht;return ht}function BI(o){return Ut(o).toLowerCase()}function PI(o){return Ut(o).toUpperCase()}function $I(o,l,E){if(o=Ut(o),o&&(E||l===e))return Rl(o);if(!o||!(l=Fi(l)))return o;var I=ni(o),T=ni(l),q=Jo(I,T),W=Sh(I,T)+1;return bu(I,q,W).join("")}function xI(o,l,E){if(o=Ut(o),o&&(E||l===e))return o.slice(0,ec(o)+1);if(!o||!(l=Fi(l)))return o;var I=ni(o),T=Sh(I,ni(l))+1;return bu(I,0,T).join("")}function RI(o,l,E){if(o=Ut(o),o&&(E||l===e))return o.replace(ga,"");if(!o||!(l=Fi(l)))return o;var I=ni(o),T=Jo(I,ni(l));return bu(I,T).join("")}function TI(o,l){var E=S,I=B;if(hr(l)){var T="separator"in l?l.separator:T;E="length"in l?ft(l.length):E,I="omission"in l?Fi(l.omission):I}o=Ut(o);var q=o.length;if(wa(o)){var W=ni(o);q=W.length}if(E>=q)return o;var Z=E-Aa(I);if(Z<1)return I;var ie=W?bu(W,0,Z).join(""):o.slice(0,Z);if(T===e)return ie+I;if(W&&(Z+=ie.length-Z),A1(T)){if(o.slice(Z).search(T)){var we,Ae=ie;for(T.global||(T=tc(T.source,Ut(Nt.exec(T))+"g")),T.lastIndex=0;we=T.exec(Ae);)var be=we.index;ie=ie.slice(0,be===e?Z:be)}}else if(o.indexOf(Fi(T),Z)!=Z){var Be=ie.lastIndexOf(T);Be>-1&&(ie=ie.slice(0,Be))}return ie+I}function OI(o){return o=Ut(o),o&&ns.test(o)?o.replace(fu,$h):o}var kI=pc(function(o,l,E){return o+(E?" ":"")+l.toUpperCase()}),y1=ow("toUpperCase");function aA(o,l,E){return o=Ut(o),l=E?e:l,l===e?Fp(o)?Pp(o):Pl(o):o.match(l)||[]}var uA=gt(function(o,l){try{return Ln(o,e,l)}catch(E){return w1(E)?E:new Ze(E)}}),NI=Sa(function(o,l){return ri(l,function(E){E=Rs(E),Da(o,E,m1(o[E],o))}),o});function LI(o){var l=o==null?0:o.length,E=ze();return o=l?ee(o,function(I){if(typeof I[1]!="function")throw new ii(i);return[E(I[0]),I[1]]}):[],gt(function(I){for(var T=-1;++TY)return[];var E=Fe,I=En(o,Fe);l=ze(l),o-=Fe;for(var T=xl(I,l);++E0||l<0)?new bt(E):(o<0?E=E.takeRight(-o):o&&(E=E.drop(o)),l!==e&&(l=ft(l),E=l<0?E.dropRight(-l):E.take(l-o)),E)},bt.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},bt.prototype.toArray=function(){return this.take(Fe)},$s(bt.prototype,function(o,l){var E=/^(?:filter|find|map|reject)|While$/.test(l),I=/^(?:head|last)$/.test(l),T=M[I?"take"+(l=="last"?"Right":""):l],q=I||/^find/.test(l);T&&(M.prototype[l]=function(){var W=this.__wrapped__,Z=I?[1]:arguments,ie=W instanceof bt,we=Z[0],Ae=ie||st(W),be=function(wt){var Dt=T.apply(M,_i([wt],Z));return I&&Be?Dt[0]:Dt};Ae&&E&&typeof we=="function"&&we.length!=1&&(ie=Ae=!1);var Be=this.__chain__,Le=!!this.__actions__.length,Ye=q&&!Be,ht=ie&&!Le;if(!q&&Ae){W=ht?W:new bt(this);var We=o.apply(W,Z);return We.__actions__.push({func:t0,args:[be],thisArg:e}),new Vi(We,Be)}return Ye&&ht?o.apply(this,Z):(We=this.thru(be),Ye?I?We.value()[0]:We.value():We)})}),ri(["pop","push","shift","sort","splice","unshift"],function(o){var l=rc[o],E=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",I=/^(?:pop|shift)$/.test(o);M.prototype[o]=function(){var T=arguments;if(I&&!this.__chain__){var q=this.value();return l.apply(st(q)?q:[],T)}return this[E](function(W){return l.apply(st(W)?W:[],T)})}}),$s(bt.prototype,function(o,l){var E=M[l];if(E){var I=E.name+"";Bt.call(fc,I)||(fc[I]=[]),fc[I].push({name:l,func:E})}}),fc[Yh(e,m).name]=[{name:"wrapper",func:e}],bt.prototype.clone=OD,bt.prototype.reverse=kD,bt.prototype.value=ND,M.prototype.at=hF,M.prototype.chain=dF,M.prototype.commit=pF,M.prototype.next=gF,M.prototype.plant=vF,M.prototype.reverse=wF,M.prototype.toJSON=M.prototype.valueOf=M.prototype.value=AF,M.prototype.first=M.prototype.head,ba&&(M.prototype[ba]=mF),M},qi=$p();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($r._=qi,define(function(){return qi})):ma?((ma.exports=qi)._=qi,Sl._=qi):$r._=qi}).call(Wc)});var im=he((DG,nm)=>{var g_=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);g_?(tm=new Uint8Array(16),nm.exports=function(){return g_(tm),tm}):(rm=new Array(16),nm.exports=function(){for(var t=0,r;t<16;t++)t&3||(r=Math.random()*4294967296),rm[t]=r>>>((t&3)<<3)&255;return rm});var tm,rm});var sm=he((FG,v_)=>{var m_=[];for(bf=0;bf<256;++bf)m_[bf]=(bf+256).toString(16).substr(1);var bf;function ek(e,t){var r=t||0,n=m_;return[n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]]].join("")}v_.exports=ek});var E_=he((SG,A_)=>{var tk=im(),rk=sm(),w_,am,um=0,om=0;function nk(e,t,r){var n=t&&r||0,i=t||[];e=e||{};var a=e.node||w_,s=e.clockseq!==void 0?e.clockseq:am;if(a==null||s==null){var u=tk();a==null&&(a=w_=[u[0]|1,u[1],u[2],u[3],u[4],u[5]]),s==null&&(s=am=(u[6]<<8|u[7])&16383)}var c=e.msecs!==void 0?e.msecs:new Date().getTime(),f=e.nsecs!==void 0?e.nsecs:om+1,d=c-um+(f-om)/1e4;if(d<0&&e.clockseq===void 0&&(s=s+1&16383),(d<0||c>um)&&e.nsecs===void 0&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");um=c,om=f,am=s,c+=122192928e5;var v=((c&268435455)*1e4+f)%4294967296;i[n++]=v>>>24&255,i[n++]=v>>>16&255,i[n++]=v>>>8&255,i[n++]=v&255;var p=c/4294967296*1e4&268435455;i[n++]=p>>>8&255,i[n++]=p&255,i[n++]=p>>>24&15|16,i[n++]=p>>>16&255,i[n++]=s>>>8|128,i[n++]=s&255;for(var h=0;h<6;++h)i[n+h]=a[h];return t||rk(i)}A_.exports=nk});var y_=he((IG,b_)=>{var ik=im(),sk=sm();function ak(e,t,r){var n=t&&r||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||ik)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t)for(var a=0;a<16;++a)t[n+a]=i[a];return t||sk(i)}b_.exports=ak});var D_=he((BG,C_)=>{var uk=E_(),__=y_(),cm=__;cm.v1=uk;cm.v4=__;C_.exports=cm});var md=he((PG,S_)=>{var{v4:ok}=D_();function F_(){return ok().replace(/-/g,"")}var lm=F_;function fm(){return lm()}fm.setFactory=e=>{lm=e};fm.reset=()=>{lm=F_};S_.exports=fm});var eu=he(($G,I_)=>{var ck=Symbol("_options"),lk=Symbol("_cache"),fk=Symbol("_state"),hk=Symbol("_objectId"),dk=Symbol("_conflicts"),pk=Symbol("_change"),gk=Symbol("_elemIds");I_.exports={OPTIONS:ck,CACHE:lk,STATE:fk,OBJECT_ID:hk,CONFLICTS:dk,CHANGE:pk,ELEM_IDS:gk}});var ms=he((xG,P_)=>{function B_(e){return typeof e=="object"&&e!==null}function mk(e){if(!B_(e))return{};let t={};for(let r of Object.keys(e))t[r]=e[r];return t}function vk(e){let t=/^(\d+)@(.*)$/.exec(e||"");if(!t)throw new RangeError(`Not a valid opId: ${e}`);return{counter:parseInt(t[1],10),actorId:t[2]}}function wk(e,t){if(!(e instanceof Uint8Array)||!(t instanceof Uint8Array))throw new TypeError("equalBytes can only compare Uint8Arrays");if(e.byteLength!==t.byteLength)return!1;for(let r=0;r{var{OBJECT_ID:Oo}=eu(),{isObject:Ek}=ms(),_f=class{constructor(t){if(typeof t=="string"){let r=[...t].map(n=>({value:n}));return yf(void 0,r)}else if(Array.isArray(t)){let r=t.map(n=>({value:n}));return yf(void 0,r)}else{if(t===void 0)return yf(void 0,[]);throw new TypeError(`Unsupported initial value for Text: ${t}`)}}get length(){return this.elems.length}get(t){let r=this.elems[t].value;if(this.context&&Ek(r)){let n=r[Oo],i=this.path.concat([{key:t,objectId:n}]);return this.context.instantiateObject(i,n)}else return r}getElemId(t){return this.elems[t].elemId}[Symbol.iterator](){let t=this.elems,r=-1;return{next(){return r+=1,r0&&(t.push(r),r=""),t.push(n.value));return r.length>0&&t.push(r),t}toJSON(){return this.toString()}getWriteable(t,r){if(!this[Oo])throw new RangeError("getWriteable() requires the objectId to be set");let n=yf(this[Oo],this.elems);return n.context=t,n.path=r,n}set(t,r){if(this.context)this.context.setListIndex(this.path,t,r);else if(!this[Oo])this.elems[t].value=r;else throw new TypeError("Automerge.Text object cannot be modified outside of a change block");return this}insertAt(t,...r){if(this.context)this.context.splice(this.path,t,0,r);else if(!this[Oo])this.elems.splice(t,0,...r.map(n=>({value:n})));else throw new TypeError("Automerge.Text object cannot be modified outside of a change block");return this}deleteAt(t,r=1){if(this.context)this.context.splice(this.path,t,r,[]);else if(!this[Oo])this.elems.splice(t,r);else throw new TypeError("Automerge.Text object cannot be modified outside of a change block");return this}};for(let e of["concat","every","filter","find","findIndex","forEach","includes","indexOf","join","lastIndexOf","map","reduce","reduceRight","slice","some","toLocaleString"])_f.prototype[e]=function(...t){return[...this][e](...t)};function yf(e,t){let r=Object.create(_f.prototype);return r[Oo]=e,r.elems=t,r}$_.exports={Text:_f,instantiateText:yf}});var Ff=he((TG,T_)=>{var{OBJECT_ID:ko,CONFLICTS:bk}=eu(),{isObject:vd,copyObject:x_}=ms();function hm(e,t,r){for(let n of e)if(t[n]!==r[n]){if(typeof t[n]=="number"&&typeof r[n]=="number")return t[n]-r[n];{let i=""+t[n],a=""+r[n];if(i===a)continue;return i{let r=this.entries[t];return vd(r)&&r.id===t})}get count(){return this.ids.length}get rows(){return this.ids.map(t=>this.byId(t))}filter(t,r){return this.rows.filter(t,r)}find(t,r){return this.rows.find(t,r)}map(t,r){return this.rows.map(t,r)}sort(t){if(typeof t=="function")return this.rows.sort(t);if(typeof t=="string")return this.rows.sort((r,n)=>hm([t],r,n));if(Array.isArray(t))return this.rows.sort((r,n)=>hm(t,r,n));if(t===void 0)return this.rows.sort((r,n)=>hm(["id"],r,n));throw new TypeError(`Unsupported sorting argument: ${t}`)}[Symbol.iterator](){let t=this.rows,r=-1;return{next(){return r+=1,r{var wd=class{constructor(t){this.value=t||0,Object.freeze(this)}valueOf(){return this.value}toString(){return this.valueOf().toString()}toJSON(){return this.value}},pm=class extends wd{increment(t){return t=typeof t=="number"?t:1,this.context.increment(this.path,this.key,t),this.value+=t,this.value}decrement(t){return this.increment(typeof t=="number"?-t:-1)}};function yk(e,t,r,n,i){let a=Object.create(pm.prototype);return a.value=e,a.context=t,a.path=r,a.objectId=n,a.key=i,a}O_.exports={Counter:wd,getWriteableCounter:yk}});var gm=he((kG,U_)=>{var{isObject:_k,copyObject:k_,parseOpId:bd}=ms(),{OBJECT_ID:Sf,CONFLICTS:No,ELEM_IDS:Ed}=eu(),{instantiateText:Ck}=Cf(),{instantiateTable:Dk}=Ff(),{Counter:Fk}=Ad();function tu(e,t,r){return e.objectId?(t&&t[Sf]!==e.objectId&&(t=void 0),L_(e,t,r)):e.datatype==="timestamp"?new Date(e.value):e.datatype==="counter"?new Fk(e.value):e.value}function Sk(e,t){let r=/^(\d+)@(.*)$/,n=r.test(e)?bd(e):{counter:0,actorId:e},i=r.test(t)?bd(t):{counter:0,actorId:t};return n.counteri.counter?1:n.actorIdi.actorId?1:0}function Ik(e,t,r,n){if(e)for(let i of Object.keys(e)){let a={},s=Object.keys(e[i]).sort(Sk).reverse();for(let u of s){let c=e[i][u];r[i]&&r[i][u]?a[u]=tu(c,r[i][u],n):a[u]=tu(c,void 0,n)}s.length===0?(delete t[i],delete r[i]):(t[i]=a[s[0]],r[i]=a)}}function N_(e,t){let r=k_(e),n=k_(e?e[No]:void 0);return Object.defineProperty(r,Sf,{value:t}),Object.defineProperty(r,No,{value:n}),r}function Bk(e,t,r){let n=e.objectId;r[n]||(r[n]=N_(t,n));let i=r[n];return Ik(e.props,i,i[No],r),i}function Pk(e,t,r){let n=e.objectId;r[n]||(r[n]=t?t._clone():Dk(n));let i=r[n];for(let a of Object.keys(e.props||{})){let s=Object.keys(e.props[a]);if(s.length===0)i.remove(a);else if(s.length===1){let u=e.props[a][s[0]];i._set(a,tu(u,i.byId(a),r),s[0])}else throw new RangeError("Conflicts are not supported on properties of a table")}return i}function $k(e,t){let r=e?e.slice():[],n=e&&e[No]?e[No].slice():[],i=e&&e[Ed]?e[Ed].slice():[];return Object.defineProperty(r,Sf,{value:t}),Object.defineProperty(r,No,{value:n}),Object.defineProperty(r,Ed,{value:i}),r}function xk(e,t,r){let n=e.objectId;r[n]||(r[n]=$k(t,n));let i=r[n],a=i[No],s=i[Ed];for(let u=0;u{let y=`${f.counter+m}@${f.actorId}`;w=tu({value:w,datatype:h},void 0,r),v.push(w),p.push({[y]:{value:w,datatype:h,type:"value"}}),d.push(y)}),i.splice(c.index,0,...v),a.splice(c.index,0,...p),s.splice(c.index,0,...d)}else c.action==="remove"&&(i.splice(c.index,c.count),a.splice(c.index,c.count),s.splice(c.index,c.count))}return i}function Rk(e,t,r){let n=e.objectId,i;r[n]?i=r[n].elems:t?i=t.elems.slice():i=[];for(let a of e.edits)if(a.action==="insert"){let s=tu(a.value,void 0,r),u={elemId:a.elemId,pred:[a.opId],value:s};i.splice(a.index,0,u)}else if(a.action==="multi-insert"){let s=bd(a.elemId),u=a.datatype,c=a.values.map((f,d)=>{f=tu({datatype:u,value:f},void 0,r);let v=`${s.counter+d}@${s.actorId}`;return{elemId:v,pred:[v],value:f}});i.splice(a.index,0,...c)}else if(a.action==="update"){let s=i[a.index].elemId,u=tu(a.value,i[a.index].value,r);i[a.index]={elemId:s,pred:[a.opId],value:u}}else a.action==="remove"&&i.splice(a.index,a.count);return r[n]=Ck(n,i),r[n]}function L_(e,t,r){if(_k(t)&&(!e.props||Object.keys(e.props).length===0)&&(!e.edits||e.edits.length===0)&&!r[e.objectId])return t;if(e.type==="map")return Bk(e,t,r);if(e.type==="table")return Pk(e,t,r);if(e.type==="list")return xk(e,t,r);if(e.type==="text")return Rk(e,t,r);throw new TypeError(`Unknown object type: ${e.type}`)}function Tk(e){if(e[Sf]!=="_root")throw new RangeError(`Not the root object: ${e[Sf]}`);return N_(e,"_root")}U_.exports={interpretPatch:L_,cloneRootObject:Tk}});var M_=he((NG,H_)=>{var{OBJECT_ID:Lo,CHANGE:yd,STATE:Ok}=eu(),{createArrayOfNulls:kk}=ms(),{Text:Nk}=Cf(),{Table:Lk}=Ff();function ea(e){if(typeof e=="string"&&/^[0-9]+$/.test(e)&&(e=parseInt(e,10)),typeof e!="number")throw new TypeError("A list index must be a number, but you passed "+JSON.stringify(e));if(e<0||isNaN(e)||e===1/0||e===-1/0)throw new RangeError("A list index must be positive, but you passed "+e);return e}function Uk(e,t,r){let n={deleteAt(i,a){return e.splice(r,ea(i),a||1,[]),this},fill(i,a,s){let u=e.getObject(t);for(let c=ea(a||0);cu.length-i)&&(a=u.length-i);let c=[];for(let f=0;fa[i]()}for(let i of["concat","every","filter","find","findIndex","forEach","includes","join","lastIndexOf","map","reduce","reduceRight","slice","some","toLocaleString","toString"])n[i]=(...a)=>e.getObject(t).map((u,c)=>e.getObjectField(r,t,c))[i](...a);return n}var jk={get(e,t){let{context:r,objectId:n,path:i}=e;return t===Lo?n:t===yd?r:t===Ok?{actorId:r.actorId}:r.getObjectField(i,n,t)},set(e,t,r){let{context:n,path:i,readonly:a}=e;if(Array.isArray(a)&&a.indexOf(t)>=0)throw new RangeError(`Object property "${t}" cannot be modified`);return n.setMapKey(i,t,r),!0},deleteProperty(e,t){let{context:r,path:n,readonly:i}=e;if(Array.isArray(i)&&i.indexOf(t)>=0)throw new RangeError(`Object property "${t}" cannot be modified`);return r.deleteMapKey(n,t),!0},has(e,t){let{context:r,objectId:n}=e;return[Lo,yd].includes(t)||t in r.getObject(n)},getOwnPropertyDescriptor(e,t){let{context:r,objectId:n}=e,i=r.getObject(n);if(t in i)return{configurable:!0,enumerable:!0,value:r.getObjectField(n,t)}},ownKeys(e){let{context:t,objectId:r}=e;return Object.keys(t.getObject(r))}},Hk={get(e,t){let[r,n,i]=e;return t===Symbol.iterator?r.getObject(n)[Symbol.iterator]:t===Lo?n:t===yd?r:t==="length"?r.getObject(n).length:typeof t=="string"&&/^[0-9]+$/.test(t)?r.getObjectField(i,n,ea(t)):Uk(r,n,i)[t]},set(e,t,r){let[n,i,a]=e;if(t==="length"){if(typeof r!="number")throw new RangeError("Invalid array length");let s=n.getObject(i).length;s>r?n.splice(a,r,s-r,[]):n.splice(a,s,0,kk(r-s))}else n.setListIndex(a,ea(t),r);return!0},deleteProperty(e,t){let[r,,n]=e;return r.splice(n,ea(t),1,[]),!0},has(e,t){let[r,n]=e;return typeof t=="string"&&/^[0-9]+$/.test(t)?ea(t){var mm=class{constructor(t){if(!(Number.isInteger(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER))throw new RangeError(`Value ${t} cannot be a uint`);this.value=t,Object.freeze(this)}},vm=class{constructor(t){if(!(Number.isInteger(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=0))throw new RangeError(`Value ${t} cannot be a uint`);this.value=t,Object.freeze(this)}},wm=class{constructor(t){if(typeof t!="number")throw new RangeError(`Value ${t} cannot be a float64`);this.value=t||0,Object.freeze(this)}};q_.exports={Int:mm,Uint:vm,Float64:wm}});var G_=he((UG,z_)=>{var{CACHE:Kk,OBJECT_ID:_d,CONFLICTS:Uo,ELEM_IDS:V_,STATE:zk}=eu(),{interpretPatch:Gk}=gm(),{Text:Pf}=Cf(),{Table:$f}=Ff(),{Counter:Tu,getWriteableCounter:Yk}=Ad(),{Int:Em,Uint:bm,Float64:ym}=Am(),{isObject:If,parseOpId:K_,createArrayOfNulls:Wk}=ms(),Xk=md(),_m=class{constructor(t,r,n){this.actorId=r,this.nextOpNum=t[zk].maxOp+1,this.cache=t[Kk],this.updated={},this.ops=[],this.applyPatch=n||Gk}addOp(t){this.ops.push(t),t.action==="set"&&t.values?this.nextOpNum+=t.values.length:t.action==="del"&&t.multiOp?this.nextOpNum+=t.multiOp:this.nextOpNum+=1}nextOpId(){return`${this.nextOpNum}@${this.actorId}`}getValueDescription(t){if(!["object","boolean","number","string"].includes(typeof t))throw new TypeError(`Unsupported type of value: ${typeof t}`);if(If(t)){if(t instanceof Date)return{type:"value",value:t.getTime(),datatype:"timestamp"};if(t instanceof Em)return{type:"value",value:t.value,datatype:"int"};if(t instanceof bm)return{type:"value",value:t.value,datatype:"uint"};if(t instanceof ym)return{type:"value",value:t.value,datatype:"float64"};if(t instanceof Tu)return{type:"value",value:t.value,datatype:"counter"};{let r=t[_d],n=this.getObjectType(r);if(!r)throw new RangeError(`Object ${JSON.stringify(t)} has no objectId`);return n==="list"||n==="text"?{objectId:r,type:n,edits:[]}:{objectId:r,type:n,props:{}}}}else return typeof t=="number"?Number.isInteger(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER?{type:"value",value:t,datatype:"int"}:{type:"value",value:t,datatype:"float64"}:{type:"value",value:t}}getValuesDescriptions(t,r,n){if(r instanceof $f){let i=r.byId(n),a=r.opIds[n];return i?{[a]:this.getValueDescription(i)}:{}}else if(r instanceof Pf){let i=r.get(n),a=r.getElemId(n);return i?{[a]:this.getValueDescription(i)}:{}}else{let i=r[Uo][n],a={};if(!i)throw new RangeError(`No children at key ${n} of path ${JSON.stringify(t)}`);for(let s of Object.keys(i))a[s]=this.getValueDescription(i[s]);return a}}getPropertyValue(t,r,n){return t instanceof $f?t.byId(r):t instanceof Pf?t.get(r):t[Uo][r][n]}getSubpatch(t,r){if(r.length==0)return t;let n=t,i=this.getObject("_root");for(let a of r){let s=this.getValuesDescriptions(r,i,a.key);if(n.props)n.props[a.key]||(n.props[a.key]=s);else if(n.edits)for(let c of Object.keys(s))n.edits.push({action:"update",index:a.key,opId:c,value:s[c]});let u=null;for(let c of Object.keys(s))s[c].objectId===a.objectId&&(u=c);if(!u)throw new RangeError(`Cannot find path object with objectId ${a.objectId}`);n=s[u],i=this.getPropertyValue(i,a.key,u)}return n}getObject(t){let r=this.updated[t]||this.cache[t];if(!r)throw new RangeError(`Target object does not exist: ${t}`);return r}getObjectType(t){if(t==="_root")return"map";let r=this.getObject(t);return r instanceof Pf?"text":r instanceof $f?"table":Array.isArray(r)?"list":"map"}getObjectField(t,r,n){if(!["string","number"].includes(typeof n))return;let i=this.getObject(r);if(i[n]instanceof Tu)return Yk(i[n].value,this,t,r,n);if(If(i[n])){let a=i[n][_d],s=t.concat([{key:n,objectId:a}]);return this.instantiateObject(s,a)}else return i[n]}createNestedObjects(t,r,n,i,a,s){if(n[_d])throw new RangeError("Cannot create a reference to an existing document object");let u=this.nextOpId();if(n instanceof Pf){this.addOp(s?{action:"makeText",obj:t,elemId:s,insert:i,pred:a}:{action:"makeText",obj:t,key:r,insert:i,pred:a});let c={objectId:u,type:"text",edits:[]};return this.insertListItems(c,0,[...n],!0),c}else if(n instanceof $f){if(n.count>0)throw new RangeError("Assigning a non-empty Table object is not supported");return this.addOp(s?{action:"makeTable",obj:t,elemId:s,insert:i,pred:a}:{action:"makeTable",obj:t,key:r,insert:i,pred:a}),{objectId:u,type:"table",props:{}}}else if(Array.isArray(n)){this.addOp(s?{action:"makeList",obj:t,elemId:s,insert:i,pred:a}:{action:"makeList",obj:t,key:r,insert:i,pred:a});let c={objectId:u,type:"list",edits:[]};return this.insertListItems(c,0,n,!0),c}else{this.addOp(s?{action:"makeMap",obj:t,elemId:s,insert:i,pred:a}:{action:"makeMap",obj:t,key:r,insert:i,pred:a});let c={};for(let f of Object.keys(n).sort()){let d=this.nextOpId(),v=this.setValue(u,f,n[f],!1,[]);c[f]={[d]:v}}return{objectId:u,type:"map",props:c}}}setValue(t,r,n,i,a,s){if(!t)throw new RangeError("setValue needs an objectId");if(r==="")throw new RangeError("The key of a map entry must not be an empty string");if(If(n)&&!(n instanceof Date)&&!(n instanceof Tu)&&!(n instanceof Em)&&!(n instanceof bm)&&!(n instanceof ym))return this.createNestedObjects(t,r,n,i,a,s);{let u=this.getValueDescription(n),c={action:"set",obj:t,insert:i,value:u.value,pred:a};return s?c.elemId=s:c.key=r,u.datatype&&(c.datatype=u.datatype),this.addOp(c),u}}applyAtPath(t,r){let n={objectId:"_root",type:"map",props:{}};r(this.getSubpatch(n,t)),this.applyPatch(n,this.cache._root,this.updated)}setMapKey(t,r,n){if(typeof r!="string")throw new RangeError(`The key of a map entry must be a string, not ${typeof r}`);let i=t.length===0?"_root":t[t.length-1].objectId,a=this.getObject(i);if(a[r]instanceof Tu)throw new RangeError("Cannot overwrite a Counter object; use .increment() or .decrement() to change its value.");(a[r]!==n||Object.keys(a[Uo][r]||{}).length>1||n===void 0)&&this.applyAtPath(t,s=>{let u=Bf(a,r),c=this.nextOpId(),f=this.setValue(i,r,n,!1,u);s.props[r]={[c]:f}})}deleteMapKey(t,r){let n=t.length===0?"_root":t[t.length-1].objectId,i=this.getObject(n);if(i[r]!==void 0){let a=Bf(i,r);this.addOp({action:"del",obj:n,key:r,insert:!1,pred:a}),this.applyAtPath(t,s=>{s.props[r]={}})}}insertListItems(t,r,n,i){let a=i?[]:this.getObject(t.objectId);if(r<0||r>a.length)throw new RangeError(`List index ${r} is out of bounds for list of length ${a.length}`);if(n.length===0)return;let s=Cd(a,r,!0),u=n.every(d=>typeof d=="string"||typeof d=="number"||typeof d=="boolean"||d===null||If(d)&&(d instanceof Date||d instanceof Tu||d instanceof Em||d instanceof bm||d instanceof ym)),c=u?n.map(d=>this.getValueDescription(d)):[],f=c.every(d=>d.datatype===c[0].datatype);if(u&&f&&n.length>1){let d=this.nextOpId(),v=c[0].datatype,p=c.map(m=>m.value),h={action:"set",obj:t.objectId,elemId:s,insert:!0,values:p,pred:[]},w={action:"multi-insert",elemId:d,index:r,values:p};v&&(h.datatype=v,w.datatype=v),this.addOp(h),t.edits.push(w)}else for(let d=0;d=a.length){let s=Wk(r-a.length);return s.push(n),this.splice(t,a.length,0,s)}if(a[r]instanceof Tu)throw new RangeError("Cannot overwrite a Counter object; use .increment() or .decrement() to change its value.");(a[r]!==n||Object.keys(a[Uo][r]||{}).length>1||n===void 0)&&this.applyAtPath(t,s=>{let u=Bf(a,r),c=this.nextOpId(),f=this.setValue(i,r,n,!1,u,Cd(a,r));s.edits.push({action:"update",index:r,opId:c,value:f})})}splice(t,r,n,i){let a=t.length===0?"_root":t[t.length-1].objectId,s=this.getObject(a);if(r<0||n<0||r>s.length-n)throw new RangeError(`${n} deletions starting at index ${r} are out of bounds for list of length ${s.length}`);if(n===0&&i.length===0)return;let u={diffs:{objectId:"_root",type:"map",props:{}}},c=this.getSubpatch(u.diffs,t);if(n>0){let f,d,v;for(let p=0;p0&&this.insertListItems(c,r,i,!1),this.applyPatch(u.diffs,this.cache._root,this.updated)}addTableRow(t,r){if(!If(r)||Array.isArray(r))throw new TypeError("A table row must be an object");if(r[_d])throw new TypeError("Cannot reuse an existing object as table row");if(r.id)throw new TypeError('A table row must not have an "id" property; it is generated automatically');let n=Xk(),i=this.setValue(t[t.length-1].objectId,n,r,!1,[]);return this.applyAtPath(t,a=>{a.props[n]={[i.objectId]:i}}),n}deleteTableRow(t,r,n){let i=t[t.length-1].objectId;this.getObject(i).byId(r)&&(this.addOp({action:"del",obj:i,key:r,insert:!1,pred:[n]}),this.applyAtPath(t,s=>{s.props[r]={}}))}increment(t,r,n){let i=t.length===0?"_root":t[t.length-1].objectId,a=this.getObject(i);if(!(a[r]instanceof Tu))throw new TypeError("Only counter values can be incremented");let s=this.getObjectType(i),u=a[r].value+n,c=this.nextOpId(),f=Bf(a,r);if(s==="list"||s==="text"){let d=Cd(a,r,!1);this.addOp({action:"inc",obj:i,elemId:d,value:n,insert:!1,pred:f})}else this.addOp({action:"inc",obj:i,key:r,value:n,insert:!1,pred:f});this.applyAtPath(t,d=>{s==="list"||s==="text"?d.edits.push({action:"update",index:r,opId:c,value:{value:u,datatype:"counter"}}):d.props[r]={[c]:{value:u,datatype:"counter"}}})}};function Bf(e,t){return e instanceof $f?[e.opIds[t]]:e instanceof Pf?e.elems[t].pred:e[Uo]?e[Uo][t]?Object.keys(e[Uo][t]):[]:[]}function Cd(e,t,r=!1){if(r){if(t===0)return"_head";t-=1}if(e[V_])return e[V_][t];if(e.getElemId)return e.getElemId(t);throw new RangeError(`Cannot find elemId at list index ${t}`)}z_.exports={Context:_m}});var W_=he((jG,Y_)=>{var{OBJECT_ID:Zk,CONFLICTS:Gn}=eu(),Cm=class{constructor(){this.observers={}}patchCallback(t,r,n,i,a){this._objectUpdate(t.diffs,r,n,i,a)}_objectUpdate(t,r,n,i,a){if(t.objectId){if(this.observers[t.objectId])for(let s of this.observers[t.objectId])s(t,r,n,i,a);if(t.type==="map"&&t.props)for(let s of Object.keys(t.props))for(let u of Object.keys(t.props[s]))this._objectUpdate(t.props[s][u],r&&r[Gn]&&r[Gn][s]&&r[Gn][s][u],n&&n[Gn]&&n[Gn][s]&&n[Gn][s][u],i,a);else if(t.type==="table"&&t.props)for(let s of Object.keys(t.props))for(let u of Object.keys(t.props[s]))this._objectUpdate(t.props[s][u],r&&r.byId(s),n&&n.byId(s),i,a);else if(t.type==="list"&&t.edits){let s=0;for(let u of t.edits)u.action==="insert"?(s-=1,this._objectUpdate(u.value,void 0,n&&n[Gn]&&n[Gn][u.index]&&n[Gn][u.index][u.elemId],i,a)):u.action==="multi-insert"?s-=u.values.length:u.action==="update"?this._objectUpdate(u.value,r&&r[Gn]&&r[Gn][u.index+s]&&r[Gn][u.index+s][u.opId],n&&n[Gn]&&n[Gn][u.index]&&n[Gn][u.index][u.opId],i,a):u.action==="remove"&&(s+=u.count)}else if(t.type==="text"&&t.edits){let s=0;for(let u of t.edits)u.action==="insert"?(s-=1,this._objectUpdate(u.value,void 0,n&&n.get(u.index),i,a)):u.action==="multi-insert"?s-=u.values.length:u.action==="update"?this._objectUpdate(u.value,r&&r.get(u.index+s),n&&n.get(u.index),i,a):u.action==="remove"&&(s+=u.count)}}}observe(t,r){let n=t[Zk];if(!n)throw new TypeError("The observed object must be part of an Automerge document");this.observers[n]||(this.observers[n]=[]),this.observers[n].push(r)}};Y_.exports={Observable:Cm}});var iC=he((HG,nC)=>{var{OPTIONS:ta,CACHE:Zc,STATE:ra,OBJECT_ID:Qc,CONFLICTS:Jc,CHANGE:X_,ELEM_IDS:Jk}=eu(),{isObject:Sm,copyObject:Dm}=ms(),Qk=md(),{interpretPatch:eN,cloneRootObject:tN}=gm(),{rootObjectProxy:rN}=M_(),{Context:Z_}=G_(),{Text:Im}=Cf(),{Table:J_}=Ff(),{Counter:nN}=Ad(),{Float64:iN,Int:sN,Uint:aN}=Am(),{Observable:uN}=W_();function Q_(e){if(typeof e!="string")throw new TypeError(`Unsupported type of actorId: ${typeof e}`);if(!/^[0-9a-f]+$/.test(e))throw new RangeError("actorId must consist only of lowercase hex digits");if(e.length%2!==0)throw new RangeError("actorId must consist of an even number of digits")}function Dd(e,t,r){let n=t._root;if(n||(n=tN(e[Zc]._root),t._root=n),Object.defineProperty(n,ta,{value:e[ta]}),Object.defineProperty(n,Zc,{value:t}),Object.defineProperty(n,ra,{value:r}),e[ta].freeze)for(let i of Object.keys(t))t[i]instanceof J_?t[i]._freeze():t[i]instanceof Im?(Object.freeze(t[i].elems),Object.freeze(t[i])):(Object.freeze(t[i]),Object.freeze(t[i][Jc]));for(let i of Object.keys(e[Zc]))t[i]||(t[i]=e[Zc][i]);return e[ta].freeze&&Object.freeze(t),n}function eC(e,t,r){let n=el(e);if(!n)throw new Error("Actor ID must be initialized with setActorId() before making a change");let i=Dm(e[ra]);i.seq+=1;let a={actor:n,seq:i.seq,startOp:i.maxOp+1,deps:i.deps,time:r&&typeof r.time=="number"?r.time:Math.round(new Date().getTime()/1e3),message:r&&typeof r.message=="string"?r.message:"",ops:t.ops};if(e[ta].backend){let[s,u,c]=e[ta].backend.applyLocalChange(i.backendState,a);i.backendState=s,i.lastLocalChange=c;let f=Fm(e,u,i,!0),d=r&&r.patchCallback||e[ta].patchCallback;return d&&d(u,e,f,!0,[c]),[f,a]}else{let s={actor:n,seq:a.seq,before:e};return i.requests=i.requests.concat([s]),i.maxOp=i.maxOp+oN(a.ops),i.deps=[],[Dd(e,t?t.updated:{},i),a]}}function oN(e){let t=0;for(let r of e)r.action==="set"&&r.values?t+=r.values.length:t+=1;return t}function cN(e){return e[ra]&&e[ra].lastLocalChange?e[ra].lastLocalChange:null}function Fm(e,t,r,n){let i=el(e),a={};if(eN(t.diffs,e,a),n){if(!t.clock)throw new RangeError("patch is missing clock field");t.clock[i]&&t.clock[i]>r.seq&&(r.seq=t.clock[i]),r.clock=t.clock,r.deps=t.deps,r.maxOp=Math.max(r.maxOp,t.maxOp)}return Dd(e,a,r)}function tC(e){if(typeof e=="string")e={actorId:e};else if(typeof e>"u")e={};else if(!Sm(e))throw new TypeError(`Unsupported value for init() options: ${e}`);if(e.deferActorId||(e.actorId===void 0&&(e.actorId=Qk()),Q_(e.actorId)),e.observable){let i=e.patchCallback,a=e.observable;e.patchCallback=(s,u,c,f,d)=>{i&&i(s,u,c,f,d),a.patchCallback(s,u,c,f,d)}}let t={},r={_root:t},n={seq:0,maxOp:0,requests:[],clock:{},deps:[]};return e.backend&&(n.backendState=e.backend.init(),n.lastLocalChange=null),Object.defineProperty(t,Qc,{value:"_root"}),Object.defineProperty(t,ta,{value:Object.freeze(e)}),Object.defineProperty(t,Jc,{value:Object.freeze({})}),Object.defineProperty(t,Zc,{value:Object.freeze(r)}),Object.defineProperty(t,ra,{value:Object.freeze(n)}),Object.freeze(t)}function lN(e,t){return rC(tC(t),"Initialization",r=>Object.assign(r,e))}function rC(e,t,r){if(e[Qc]!=="_root")throw new TypeError("The first argument to Automerge.change must be the document root");if(e[X_])throw new TypeError("Calls to Automerge.change cannot be nested");if(typeof t=="function"&&r===void 0&&([t,r]=[r,t]),typeof t=="string"&&(t={message:t}),t!==void 0&&!Sm(t))throw new TypeError("Unsupported type of options");let n=el(e);if(!n)throw new Error("Actor ID must be initialized with setActorId() before making a change");let i=new Z_(e,n);return r(rN(i)),Object.keys(i.updated).length===0?[e,null]:eC(e,i,t)}function fN(e,t){if(e[Qc]!=="_root")throw new TypeError("The first argument to Automerge.emptyChange must be the document root");if(typeof t=="string"&&(t={message:t}),t!==void 0&&!Sm(t))throw new TypeError("Unsupported type of options");let r=el(e);if(!r)throw new Error("Actor ID must be initialized with setActorId() before making a change");return eC(e,new Z_(e,r),t)}function hN(e,t,r=void 0){if(e[Qc]!=="_root")throw new TypeError("The first argument to Frontend.applyPatch must be the document root");let n=Dm(e[ra]);if(e[ta].backend){if(!r)throw new RangeError("applyPatch must be called with the updated backend state");return n.backendState=r,Fm(e,t,n,!0)}let i;if(n.requests.length>0)if(i=n.requests[0].before,t.actor===el(e)){if(n.requests[0].seq!==t.seq)throw new RangeError(`Mismatched sequence number: patch ${t.seq} does not match next request ${n.requests[0].seq}`);n.requests=n.requests.slice(1)}else n.requests=n.requests.slice();else i=e,n.requests=[];let a=Fm(i,t,n,!0);return n.requests.length===0?a:(n.requests[0]=Dm(n.requests[0]),n.requests[0].before=a,Dd(e,{},n))}function dN(e){return e[Qc]}function pN(e,t){if(e[X_])throw new TypeError("Cannot use getObjectById in a change callback");return e[Zc][t]}function el(e){return e[ra].actorId||e[ta].actorId}function gN(e,t){Q_(t);let r=Object.assign({},e[ra],{actorId:t});return Dd(e,{},r)}function mN(e,t){if(e[Jc]&&e[Jc][t]&&Object.keys(e[Jc][t]).length>1)return e[Jc][t]}function vN(e,t=null,r="first"){if(e[Qc]!=="_root"){let n=Array.isArray(e)?". Note: Automerge.applyChanges now returns an array.":"";throw t?new TypeError(`The ${r} argument to Automerge.${t} must be the document root${n}`):new TypeError(`Argument is not an Automerge document root${n}`)}return e[ra].backendState}function wN(e){return e instanceof Im?e.elems.map(t=>t.elemId):e[Jk]}nC.exports={init:tC,from:lN,change:rC,emptyChange:fN,applyPatch:hN,getObjectId:dN,getObjectById:pN,getActorId:el,setActorId:gN,getConflicts:mN,getLastLocalChange:cN,getBackendState:vN,getElementIds:wN,Text:Im,Table:J_,Counter:nN,Observable:uN,Float64:iN,Int:sN,Uint:aN}});var DC=he((MG,nl)=>{"use strict";function rl(e){let t=e.length;for(;--t>=0;)e[t]=0}var AN=0,lC=1,EN=2,bN=3,yN=258,Om=29,Nf=256,Rf=Nf+1+Om,tl=30,km=19,fC=2*Rf+1,jo=15,Bm=16,_N=7,Nm=256,hC=16,dC=17,pC=18,Rm=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Fd=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),CN=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),gC=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),DN=512,ru=new Array((Rf+2)*2);rl(ru);var xf=new Array(tl*2);rl(xf);var Tf=new Array(DN);rl(Tf);var Of=new Array(yN-bN+1);rl(Of);var Lm=new Array(Om);rl(Lm);var Sd=new Array(tl);rl(Sd);function Pm(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}var mC,vC,wC;function $m(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}var AC=e=>e<256?Tf[e]:Tf[256+(e>>>7)],kf=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},gi=(e,t,r)=>{e.bi_valid>Bm-r?(e.bi_buf|=t<>Bm-e.bi_valid,e.bi_valid+=r-Bm):(e.bi_buf|=t<{gi(e,r[t*2],r[t*2+1])},EC=(e,t)=>{let r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1},FN=e=>{e.bi_valid===16?(kf(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},SN=(e,t)=>{let r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,u=t.stat_desc.extra_base,c=t.stat_desc.max_length,f,d,v,p,h,w,m=0;for(p=0;p<=jo;p++)e.bl_count[p]=0;for(r[e.heap[e.heap_max]*2+1]=0,f=e.heap_max+1;fc&&(p=c,m++),r[d*2+1]=p,!(d>n)&&(e.bl_count[p]++,h=0,d>=u&&(h=s[d-u]),w=r[d*2],e.opt_len+=w*(p+h),a&&(e.static_len+=w*(i[d*2+1]+h)));if(m!==0){do{for(p=c-1;e.bl_count[p]===0;)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[c]--,m-=2}while(m>0);for(p=c;p!==0;p--)for(d=e.bl_count[p];d!==0;)v=e.heap[--f],!(v>n)&&(r[v*2+1]!==p&&(e.opt_len+=(p-r[v*2+1])*r[v*2],r[v*2+1]=p),d--)}},bC=(e,t,r)=>{let n=new Array(jo+1),i=0,a,s;for(a=1;a<=jo;a++)i=i+r[a-1]<<1,n[a]=i;for(s=0;s<=t;s++){let u=e[s*2+1];u!==0&&(e[s*2]=EC(n[u]++,u))}},IN=()=>{let e,t,r,n,i,a=new Array(jo+1);for(r=0,n=0;n>=7;n{let t;for(t=0;t{e.bi_valid>8?kf(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},sC=(e,t,r,n)=>{let i=t*2,a=r*2;return e[i]{let n=e.heap[r],i=r<<1;for(;i<=e.heap_len&&(i{let n,i,a=0,s,u;if(e.sym_next!==0)do n=e.pending_buf[e.sym_buf+a++]&255,n+=(e.pending_buf[e.sym_buf+a++]&255)<<8,i=e.pending_buf[e.sym_buf+a++],n===0?na(e,i,t):(s=Of[i],na(e,s+Nf+1,t),u=Rm[s],u!==0&&(i-=Lm[s],gi(e,i,u)),n--,s=AC(n),na(e,s,r),u=Fd[s],u!==0&&(n-=Sd[s],gi(e,n,u)));while(a{let r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,s,u,c=-1,f;for(e.heap_len=0,e.heap_max=fC,s=0;s>1;s>=1;s--)xm(e,r,s);f=a;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],xm(e,r,1),u=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=u,r[f*2]=r[s*2]+r[u*2],e.depth[f]=(e.depth[s]>=e.depth[u]?e.depth[s]:e.depth[u])+1,r[s*2+1]=r[u*2+1]=f,e.heap[1]=f++,xm(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],SN(e,t),bC(r,c,e.bl_count)},uC=(e,t,r)=>{let n,i=-1,a,s=t[0*2+1],u=0,c=7,f=4;for(s===0&&(c=138,f=3),t[(r+1)*2+1]=65535,n=0;n<=r;n++)a=s,s=t[(n+1)*2+1],!(++u{let n,i=-1,a,s=t[0*2+1],u=0,c=7,f=4;for(s===0&&(c=138,f=3),n=0;n<=r;n++)if(a=s,s=t[(n+1)*2+1],!(++u{let t;for(uC(e,e.dyn_ltree,e.l_desc.max_code),uC(e,e.dyn_dtree,e.d_desc.max_code),Tm(e,e.bl_desc),t=km-1;t>=3&&e.bl_tree[gC[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},PN=(e,t,r,n)=>{let i;for(gi(e,t-257,5),gi(e,r-1,5),gi(e,n-4,4),i=0;i{let t=4093624447,r;for(r=0;r<=31;r++,t>>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return 0;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return 1;for(r=32;r{cC||(IN(),cC=!0),e.l_desc=new $m(e.dyn_ltree,mC),e.d_desc=new $m(e.dyn_dtree,vC),e.bl_desc=new $m(e.bl_tree,wC),e.bi_buf=0,e.bi_valid=0,yC(e)},CC=(e,t,r,n)=>{gi(e,(AN<<1)+(n?1:0),3),_C(e),kf(e,r),kf(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r},RN=e=>{gi(e,lC<<1,3),na(e,Nm,ru),FN(e)},TN=(e,t,r,n)=>{let i,a,s=0;e.level>0?(e.strm.data_type===2&&(e.strm.data_type=$N(e)),Tm(e,e.l_desc),Tm(e,e.d_desc),s=BN(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&t!==-1?CC(e,t,r,n):e.strategy===4||a===i?(gi(e,(lC<<1)+(n?1:0),3),aC(e,ru,xf)):(gi(e,(EN<<1)+(n?1:0),3),PN(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),aC(e,e.dyn_ltree,e.dyn_dtree)),yC(e),n&&_C(e)},ON=(e,t,r)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(Of[r]+Nf+1)*2]++,e.dyn_dtree[AC(t)*2]++),e.sym_next===e.sym_end);nl.exports._tr_init=xN;nl.exports._tr_stored_block=CC;nl.exports._tr_flush_block=TN;nl.exports._tr_tally=ON;nl.exports._tr_align=RN});var Um=he((qG,FC)=>{"use strict";var kN=(e,t,r,n)=>{let i=e&65535|0,a=e>>>16&65535|0,s=0;for(;r!==0;){s=r>2e3?2e3:r,r-=s;do i=i+t[n++]|0,a=a+i|0;while(--s);i%=65521,a%=65521}return i|a<<16|0};FC.exports=kN});var jm=he((VG,SC)=>{"use strict";var NN=()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t},LN=new Uint32Array(NN()),UN=(e,t,r,n)=>{let i=LN,a=n+r;e^=-1;for(let s=n;s>>8^i[(e^t[s])&255];return e^-1};SC.exports=UN});var Id=he((KG,IC)=>{"use strict";IC.exports={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"}});var Ou=he((zG,BC)=>{"use strict";BC.exports={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_MEM_ERROR:-4,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}});var UC=he((GG,oa)=>{"use strict";var{_tr_init:jN,_tr_stored_block:qm,_tr_flush_block:HN,_tr_tally:Uu,_tr_align:MN}=DC(),RC=Um(),ku=jm(),qN=Id(),{Z_NO_FLUSH:ju,Z_PARTIAL_FLUSH:VN,Z_FULL_FLUSH:KN,Z_FINISH:Ji,Z_BLOCK:PC,Z_OK:pn,Z_STREAM_END:$C,Z_STREAM_ERROR:sa,Z_DATA_ERROR:zN,Z_BUF_ERROR:Hm,Z_DEFAULT_COMPRESSION:GN,Z_FILTERED:YN,Z_HUFFMAN_ONLY:Bd,Z_RLE:WN,Z_FIXED:XN,Z_DEFAULT_STRATEGY:ZN,Z_UNKNOWN:JN,Z_DEFLATED:Pd}=Ou(),QN=9,eL=15,tL=8,rL=29,nL=256,Vm=nL+1+rL,iL=30,sL=19,aL=2*Vm+1,uL=15,St=3,Lu=258,aa=Lu+St+1,oL=32,sl=42,Xm=57,Km=69,zm=73,Gm=91,Ym=103,Ho=113,Uf=666,Yn=1,ul=2,qo=3,ol=4,cL=3,Mo=(e,t)=>(e.msg=qN[t],t),xC=e=>e*2-(e>4?9:0),Nu=e=>{let t=e.length;for(;--t>=0;)e[t]=0},lL=e=>{let t,r,n,i=e.w_size;t=e.hash_size,n=t;do r=e.head[--n],e.head[n]=r>=i?r-i:0;while(--t);t=i,n=t;do r=e.prev[--n],e.prev[n]=r>=i?r-i:0;while(--t)},fL=(e,t,r)=>(t<{let t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))},Ni=(e,t)=>{HN(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ki(e.strm)},Ot=(e,t)=>{e.pending_buf[e.pending++]=t},Lf=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},Wm=(e,t,r,n)=>{let i=e.avail_in;return i>n&&(i=n),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),r),e.state.wrap===1?e.adler=RC(e.adler,t,i,r):e.state.wrap===2&&(e.adler=ku(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)},TC=(e,t)=>{let r=e.max_chain_length,n=e.strstart,i,a,s=e.prev_length,u=e.nice_match,c=e.strstart>e.w_size-aa?e.strstart-(e.w_size-aa):0,f=e.window,d=e.w_mask,v=e.prev,p=e.strstart+Lu,h=f[n+s-1],w=f[n+s];e.prev_length>=e.good_match&&(r>>=2),u>e.lookahead&&(u=e.lookahead);do if(i=t,!(f[i+s]!==w||f[i+s-1]!==h||f[i]!==f[n]||f[++i]!==f[n+1])){n+=2,i++;do;while(f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&ns){if(e.match_start=t,s=a,a>=u)break;h=f[n+s-1],w=f[n+s]}}while((t=v[t&d])>c&&--r!==0);return s<=e.lookahead?s:e.lookahead},al=e=>{let t=e.w_size,r,n,i;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-aa)&&(e.window.set(e.window.subarray(t,t+t-n),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),lL(e),n+=t),e.strm.avail_in===0)break;if(r=Wm(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=r,e.lookahead+e.insert>=St)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Hu(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Hu(e,e.ins_h,e.window[i+St-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let r=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,n,i,a,s=0,u=e.strm.avail_in;do{if(n=65535,a=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(n=i+e.strm.avail_in),n>a&&(n=a),n>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,ki(e.strm),i&&(i>n&&(i=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,n-=i),n&&(Wm(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(s===0);return u-=e.strm.avail_in,u&&(u>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=u&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-u,e.strm.next_in),e.strstart),e.strstart+=u,e.insert+=u>e.w_size-e.insert?e.w_size-e.insert:u),e.block_start=e.strstart),e.high_watera&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(Wm(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,r=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=r||(i||t===Ji)&&t!==ju&&e.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,s=t===Ji&&e.strm.avail_in===0&&n===i?1:0,qm(e,e.block_start,n,s),e.block_start+=n,ki(e.strm)),s?qo:Yn)},Mm=(e,t)=>{let r,n;for(;;){if(e.lookahead=St&&(e.ins_h=Hu(e,e.ins_h,e.window[e.strstart+St-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-aa&&(e.match_length=TC(e,r)),e.match_length>=St)if(n=Uu(e,e.strstart-e.match_start,e.match_length-St),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=St){e.match_length--;do e.strstart++,e.ins_h=Hu(e,e.ins_h,e.window[e.strstart+St-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Hu(e,e.ins_h,e.window[e.strstart+1]);else n=Uu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(Ni(e,!1),e.strm.avail_out===0))return Yn}return e.insert=e.strstart{let r,n,i;for(;;){if(e.lookahead=St&&(e.ins_h=Hu(e,e.ins_h,e.window[e.strstart+St-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=St-1,r!==0&&e.prev_length4096)&&(e.match_length=St-1)),e.prev_length>=St&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-St,n=Uu(e,e.strstart-1-e.prev_match,e.prev_length-St),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Hu(e,e.ins_h,e.window[e.strstart+St-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=St-1,e.strstart++,n&&(Ni(e,!1),e.strm.avail_out===0))return Yn}else if(e.match_available){if(n=Uu(e,0,e.window[e.strstart-1]),n&&Ni(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return Yn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=Uu(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let r,n,i,a,s=e.window;for(;;){if(e.lookahead<=Lu){if(al(e),e.lookahead<=Lu&&t===ju)return Yn;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=St&&e.strstart>0&&(i=e.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){a=e.strstart+Lu;do;while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=St?(r=Uu(e,1,e.match_length-St),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Uu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Ni(e,!1),e.strm.avail_out===0))return Yn}return e.insert=0,t===Ji?(Ni(e,!0),e.strm.avail_out===0?qo:ol):e.sym_next&&(Ni(e,!1),e.strm.avail_out===0)?Yn:ul},dL=(e,t)=>{let r;for(;;){if(e.lookahead===0&&(al(e),e.lookahead===0)){if(t===ju)return Yn;break}if(e.match_length=0,r=Uu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Ni(e,!1),e.strm.avail_out===0))return Yn}return e.insert=0,t===Ji?(Ni(e,!0),e.strm.avail_out===0?qo:ol):e.sym_next&&(Ni(e,!1),e.strm.avail_out===0)?Yn:ul};function ia(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}var jf=[new ia(0,0,0,0,OC),new ia(4,4,8,4,Mm),new ia(4,5,16,8,Mm),new ia(4,6,32,32,Mm),new ia(4,4,16,16,il),new ia(8,16,32,32,il),new ia(8,16,128,128,il),new ia(8,32,128,256,il),new ia(32,128,258,1024,il),new ia(32,258,258,4096,il)],pL=e=>{e.window_size=2*e.w_size,Nu(e.head),e.max_lazy_match=jf[e.level].max_lazy,e.good_match=jf[e.level].good_length,e.nice_match=jf[e.level].nice_length,e.max_chain_length=jf[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=St-1,e.match_available=0,e.ins_h=0};function gL(){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=Pd,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(aL*2),this.dyn_dtree=new Uint16Array((2*iL+1)*2),this.bl_tree=new Uint16Array((2*sL+1)*2),Nu(this.dyn_ltree),Nu(this.dyn_dtree),Nu(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(uL+1),this.heap=new Uint16Array(2*Vm+1),Nu(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Vm+1),Nu(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Hf=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.status!==sl&&t.status!==Xm&&t.status!==Km&&t.status!==zm&&t.status!==Gm&&t.status!==Ym&&t.status!==Ho&&t.status!==Uf?1:0},kC=e=>{if(Hf(e))return Mo(e,sa);e.total_in=e.total_out=0,e.data_type=JN;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Xm:t.wrap?sl:Ho,e.adler=t.wrap===2?0:1,t.last_flush=-2,jN(t),pn},NC=e=>{let t=kC(e);return t===pn&&pL(e.state),t},mL=(e,t)=>Hf(e)||e.state.wrap!==2?sa:(e.state.gzhead=t,pn),LC=(e,t,r,n,i,a)=>{if(!e)return sa;let s=1;if(t===GN&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>QN||r!==Pd||n<8||n>15||t<0||t>9||a<0||a>XN||n===8&&s!==1)return Mo(e,sa);n===8&&(n=9);let u=new gL;return e.state=u,u.strm=e,u.status=sl,u.wrap=s,u.gzhead=null,u.w_bits=n,u.w_size=1<LC(e,t,Pd,eL,tL,ZN),wL=(e,t)=>{if(Hf(e)||t>PC||t<0)return e?Mo(e,sa):sa;let r=e.state;if(!e.output||e.avail_in!==0&&!e.input||r.status===Uf&&t!==Ji)return Mo(e,e.avail_out===0?Hm:sa);let n=r.last_flush;if(r.last_flush=t,r.pending!==0){if(ki(e),e.avail_out===0)return r.last_flush=-1,pn}else if(e.avail_in===0&&xC(t)<=xC(n)&&t!==Ji)return Mo(e,Hm);if(r.status===Uf&&e.avail_in!==0)return Mo(e,Hm);if(r.status===sl&&r.wrap===0&&(r.status=Ho),r.status===sl){let i=Pd+(r.w_bits-8<<4)<<8,a=-1;if(r.strategy>=Bd||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,i|=a<<6,r.strstart!==0&&(i|=oL),i+=31-i%31,Lf(r,i),r.strstart!==0&&(Lf(r,e.adler>>>16),Lf(r,e.adler&65535)),e.adler=1,r.status=Ho,ki(e),r.pending!==0)return r.last_flush=-1,pn}if(r.status===Xm){if(e.adler=0,Ot(r,31),Ot(r,139),Ot(r,8),r.gzhead)Ot(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Ot(r,r.gzhead.time&255),Ot(r,r.gzhead.time>>8&255),Ot(r,r.gzhead.time>>16&255),Ot(r,r.gzhead.time>>24&255),Ot(r,r.level===9?2:r.strategy>=Bd||r.level<2?4:0),Ot(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(Ot(r,r.gzhead.extra.length&255),Ot(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=ku(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=Km;else if(Ot(r,0),Ot(r,0),Ot(r,0),Ot(r,0),Ot(r,0),Ot(r,r.level===9?2:r.strategy>=Bd||r.level<2?4:0),Ot(r,cL),r.status=Ho,ki(e),r.pending!==0)return r.last_flush=-1,pn}if(r.status===Km){if(r.gzhead.extra){let i=r.pending,a=(r.gzhead.extra.length&65535)-r.gzindex;for(;r.pending+a>r.pending_buf_size;){let u=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+u),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>i&&(e.adler=ku(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex+=u,ki(e),r.pending!==0)return r.last_flush=-1,pn;i=0,a-=u}let s=new Uint8Array(r.gzhead.extra);r.pending_buf.set(s.subarray(r.gzindex,r.gzindex+a),r.pending),r.pending+=a,r.gzhead.hcrc&&r.pending>i&&(e.adler=ku(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=zm}if(r.status===zm){if(r.gzhead.name){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=ku(e.adler,r.pending_buf,r.pending-i,i)),ki(e),r.pending!==0)return r.last_flush=-1,pn;i=0}r.gzindexi&&(e.adler=ku(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=Gm}if(r.status===Gm){if(r.gzhead.comment){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=ku(e.adler,r.pending_buf,r.pending-i,i)),ki(e),r.pending!==0)return r.last_flush=-1,pn;i=0}r.gzindexi&&(e.adler=ku(e.adler,r.pending_buf,r.pending-i,i))}r.status=Ym}if(r.status===Ym){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(ki(e),r.pending!==0))return r.last_flush=-1,pn;Ot(r,e.adler&255),Ot(r,e.adler>>8&255),e.adler=0}if(r.status=Ho,ki(e),r.pending!==0)return r.last_flush=-1,pn}if(e.avail_in!==0||r.lookahead!==0||t!==ju&&r.status!==Uf){let i=r.level===0?OC(r,t):r.strategy===Bd?dL(r,t):r.strategy===WN?hL(r,t):jf[r.level].func(r,t);if((i===qo||i===ol)&&(r.status=Uf),i===Yn||i===qo)return e.avail_out===0&&(r.last_flush=-1),pn;if(i===ul&&(t===VN?MN(r):t!==PC&&(qm(r,0,0,!1),t===KN&&(Nu(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),ki(e),e.avail_out===0))return r.last_flush=-1,pn}return t!==Ji?pn:r.wrap<=0?$C:(r.wrap===2?(Ot(r,e.adler&255),Ot(r,e.adler>>8&255),Ot(r,e.adler>>16&255),Ot(r,e.adler>>24&255),Ot(r,e.total_in&255),Ot(r,e.total_in>>8&255),Ot(r,e.total_in>>16&255),Ot(r,e.total_in>>24&255)):(Lf(r,e.adler>>>16),Lf(r,e.adler&65535)),ki(e),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?pn:$C)},AL=e=>{if(Hf(e))return sa;let t=e.state.status;return e.state=null,t===Ho?Mo(e,zN):pn},EL=(e,t)=>{let r=t.length;if(Hf(e))return sa;let n=e.state,i=n.wrap;if(i===2||i===1&&n.status!==sl||n.lookahead)return sa;if(i===1&&(e.adler=RC(e.adler,t,r,0)),n.wrap=0,r>=n.w_size){i===0&&(Nu(n.head),n.strstart=0,n.block_start=0,n.insert=0);let c=new Uint8Array(n.w_size);c.set(t.subarray(r-n.w_size,r),0),t=c,r=n.w_size}let a=e.avail_in,s=e.next_in,u=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,al(n);n.lookahead>=St;){let c=n.strstart,f=n.lookahead-(St-1);do n.ins_h=Hu(n,n.ins_h,n.window[c+St-1]),n.prev[c&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=c,c++;while(--f);n.strstart=c,n.lookahead=St-1,al(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=St-1,n.match_available=0,e.next_in=s,e.input=u,e.avail_in=a,n.wrap=i,pn};oa.exports.deflateInit=vL;oa.exports.deflateInit2=LC;oa.exports.deflateReset=NC;oa.exports.deflateResetKeep=kC;oa.exports.deflateSetHeader=mL;oa.exports.deflate=wL;oa.exports.deflateEnd=AL;oa.exports.deflateSetDictionary=EL;oa.exports.deflateInfo="pako deflate (from Nodeca project)"});var Jm=he((YG,Zm)=>{"use strict";var bL=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);Zm.exports.assign=function(e){let t=Array.prototype.slice.call(arguments,1);for(;t.length;){let r=t.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(let n in r)bL(r,n)&&(e[n]=r[n])}}return e};Zm.exports.flattenChunks=e=>{let t=0;for(let n=0,i=e.length;n{"use strict";var jC=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{jC=!1}var Mf=new Uint8Array(256);for(let e=0;e<256;e++)Mf[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Mf[254]=Mf[254]=1;$d.exports.string2buf=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,r,n,i,a,s=e.length,u=0;for(i=0;i>>6,t[a++]=128|r&63):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|r&63):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|r&63);return t};var yL=(e,t)=>{if(t<65534&&e.subarray&&jC)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let n=0;n{let r=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let n,i,a=new Array(r*2);for(i=0,n=0;n4){a[i++]=65533,n+=u-1;continue}for(s&=u===2?31:u===3?15:7;u>1&&n1){a[i++]=65533;continue}s<65536?a[i++]=s:(s-=65536,a[i++]=55296|s>>10&1023,a[i++]=56320|s&1023)}return yL(a,i)};$d.exports.utf8border=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let r=t-1;for(;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+Mf[e[r]]>t?r:t}});var ev=he((XG,HC)=>{"use strict";function _L(){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}HC.exports=_L});var KC=he((ZG,cl)=>{"use strict";var qf=UC(),MC=Jm(),qC=Qm(),tv=Id(),CL=ev(),VC=Object.prototype.toString,{Z_NO_FLUSH:DL,Z_SYNC_FLUSH:FL,Z_FULL_FLUSH:SL,Z_FINISH:IL,Z_OK:xd,Z_STREAM_END:BL,Z_DEFAULT_COMPRESSION:PL,Z_DEFAULT_STRATEGY:$L,Z_DEFLATED:xL}=Ou();function Vf(e){this.options=MC.assign({level:PL,method:xL,chunkSize:16384,windowBits:15,memLevel:8,strategy:$L},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new CL,this.strm.avail_out=0;let r=qf.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==xd)throw new Error(tv[r]);if(t.header&&qf.deflateSetHeader(this.strm,t.header),t.dictionary){let n;if(typeof t.dictionary=="string"?n=qC.string2buf(t.dictionary):VC.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,r=qf.deflateSetDictionary(this.strm,n),r!==xd)throw new Error(tv[r]);this._dict_set=!0}}Vf.prototype.push=function(e,t){let r=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?IL:DL,typeof e=="string"?r.input=qC.string2buf(e):VC.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){if(r.avail_out===0&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(a===FL||a===SL)&&r.avail_out<=6){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(i=qf.deflate(r,a),i===BL)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=qf.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===xd;if(r.avail_out===0){this.onData(r.output);continue}if(a>0&&r.next_out>0){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(r.avail_in===0)break}return!0};Vf.prototype.onData=function(e){this.chunks.push(e)};Vf.prototype.onEnd=function(e){e===xd&&(this.result=MC.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function rv(e,t){let r=new Vf(t);if(r.push(e,!0),r.err)throw r.msg||tv[r.err];return r.result}function RL(e,t){return t=t||{},t.raw=!0,rv(e,t)}function TL(e,t){return t=t||{},t.gzip=!0,rv(e,t)}cl.exports.Deflate=Vf;cl.exports.deflate=rv;cl.exports.deflateRaw=RL;cl.exports.gzip=TL;cl.exports.constants=Ou()});var GC=he((JG,zC)=>{"use strict";zC.exports=function(t,r){let n,i,a,s,u,c,f,d,v,p,h,w,m,y,g,b,D,C,F,L,N,S,B,O,x=t.state;n=t.next_in,B=t.input,i=n+(t.avail_in-5),a=t.next_out,O=t.output,s=a-(r-t.avail_out),u=a+(t.avail_out-257),c=x.dmax,f=x.wsize,d=x.whave,v=x.wnext,p=x.window,h=x.hold,w=x.bits,m=x.lencode,y=x.distcode,g=(1<>>24,h>>>=C,w-=C,C=D>>>16&255,C===0)O[a++]=D&65535;else if(C&16){F=D&65535,C&=15,C&&(w>>=C,w-=C),w<15&&(h+=B[n++]<>>24,h>>>=C,w-=C,C=D>>>16&255,C&16){if(L=D&65535,C&=15,wc){t.msg="invalid distance too far back",x.mode=16209;break e}if(h>>>=C,w-=C,C=a-s,L>C){if(C=L-C,C>d&&x.sane){t.msg="invalid distance too far back",x.mode=16209;break e}if(N=0,S=p,v===0){if(N+=f-C,C2;)O[a++]=S[N++],O[a++]=S[N++],O[a++]=S[N++],F-=3;F&&(O[a++]=S[N++],F>1&&(O[a++]=S[N++]))}else{N=a-L;do O[a++]=O[N++],O[a++]=O[N++],O[a++]=O[N++],F-=3;while(F>2);F&&(O[a++]=O[N++],F>1&&(O[a++]=O[N++]))}}else if(C&64){t.msg="invalid distance code",x.mode=16209;break e}else{D=y[(D&65535)+(h&(1<>3,n-=F,w-=F<<3,h&=(1<{"use strict";var OL=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]),kL=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]),NL=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]),LL=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]),UL=(e,t,r,n,i,a,s,u)=>{let c=u.bits,f=0,d=0,v=0,p=0,h=0,w=0,m=0,y=0,g=0,b=0,D,C,F,L,N,S=null,B,O=new Uint16Array(16),x=new Uint16Array(16),U=null,G,H,K;for(f=0;f<=15;f++)O[f]=0;for(d=0;d=1&&O[p]===0;p--);if(h>p&&(h=p),p===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,u.bits=1,0;for(v=1;v0&&(e===0||p!==1))return-1;for(x[1]=0,f=1;f<15;f++)x[f+1]=x[f]+O[f];for(d=0;d852||e===2&&g>592)return 1;for(;;){G=f-m,s[d]+1=B?(H=U[s[d]-B],K=S[s[d]-B]):(H=96,K=0),D=1<>m)+C]=G<<24|H<<16|K|0;while(C!==0);for(D=1<>=1;if(D!==0?(b&=D-1,b+=D):b=0,d++,--O[f]===0){if(f===p)break;f=t[r+s[d]]}if(f>h&&(b&L)!==F){for(m===0&&(m=h),N+=v,w=f-m,y=1<852||e===2&&g>592)return 1;F=b&L,i[F]=h<<24|w<<16|N-a|0}}return b!==0&&(i[N+b]=f-m<<24|64<<16|0),u.bits=h,0};YC.exports=UL});var P6=he((eY,vs)=>{"use strict";var ov=Um(),ca=jm(),jL=GC(),Kf=WC(),HL=0,b6=1,y6=2,{Z_FINISH:XC,Z_BLOCK:ML,Z_TREES:Rd,Z_OK:Vo,Z_STREAM_END:qL,Z_NEED_DICT:VL,Z_STREAM_ERROR:Qi,Z_DATA_ERROR:_6,Z_MEM_ERROR:cv,Z_BUF_ERROR:KL,Z_DEFLATED:ZC}=Ou(),Nd=16180,JC=16181,QC=16182,e6=16183,t6=16184,r6=16185,n6=16186,i6=16187,s6=16188,a6=16189,kd=16190,nu=16191,nv=16192,u6=16193,iv=16194,o6=16195,c6=16196,l6=16197,f6=16198,Td=16199,Od=16200,h6=16201,d6=16202,p6=16203,g6=16204,m6=16205,sv=16206,v6=16207,w6=16208,cr=16209,lv=16210,C6=16211,zL=852,GL=592,YL=15,WL=YL,A6=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function XL(){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}var Ko=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.modeC6?1:0},D6=e=>{if(Ko(e))return Qi;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Nd,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(zL),t.distcode=t.distdyn=new Int32Array(GL),t.sane=1,t.back=-1,Vo},F6=e=>{if(Ko(e))return Qi;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,D6(e)},S6=(e,t)=>{let r;if(Ko(e))return Qi;let n=e.state;return t<0?(r=0,t=-t):(r=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Qi:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,F6(e))},I6=(e,t)=>{if(!e)return Qi;let r=new XL;e.state=r,r.strm=e,r.window=null,r.mode=Nd;let n=S6(e,t);return n!==Vo&&(e.state=null),n},ZL=e=>I6(e,WL),E6=!0,av,uv,JL=e=>{if(E6){av=new Int32Array(512),uv=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(Kf(b6,e.lens,0,288,av,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Kf(y6,e.lens,0,32,uv,0,e.work,{bits:5}),E6=!1}e.lencode=av,e.lenbits=9,e.distcode=uv,e.distbits=5},B6=(e,t,r,n)=>{let i,a=e.state;return a.window===null&&(a.wsize=1<=a.wsize?(a.window.set(t.subarray(r-a.wsize,r),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),a.window.set(t.subarray(r-n,r-n+i),a.wnext),n-=i,n?(a.window.set(t.subarray(r-n,r),0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave{let r,n,i,a,s,u,c,f,d,v,p,h,w,m,y=0,g,b,D,C,F,L,N,S,B=new Uint8Array(4),O,x,U=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ko(e)||!e.output||!e.input&&e.avail_in!==0)return Qi;r=e.state,r.mode===nu&&(r.mode=nv),s=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,n=e.input,u=e.avail_in,f=r.hold,d=r.bits,v=u,p=c,S=Vo;e:for(;;)switch(r.mode){case Nd:if(r.wrap===0){r.mode=nv;break}for(;d<16;){if(u===0)break e;u--,f+=n[a++]<>>8&255,r.check=ca(r.check,B,2,0),f=0,d=0,r.mode=JC;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((f&255)<<8)+(f>>8))%31){e.msg="incorrect header check",r.mode=cr;break}if((f&15)!==ZC){e.msg="unknown compression method",r.mode=cr;break}if(f>>>=4,d-=4,N=(f&15)+8,r.wbits===0&&(r.wbits=N),N>15||N>r.wbits){e.msg="invalid window size",r.mode=cr;break}r.dmax=1<>8&1),r.flags&512&&r.wrap&4&&(B[0]=f&255,B[1]=f>>>8&255,r.check=ca(r.check,B,2,0)),f=0,d=0,r.mode=QC;case QC:for(;d<32;){if(u===0)break e;u--,f+=n[a++]<>>8&255,B[2]=f>>>16&255,B[3]=f>>>24&255,r.check=ca(r.check,B,4,0)),f=0,d=0,r.mode=e6;case e6:for(;d<16;){if(u===0)break e;u--,f+=n[a++]<>8),r.flags&512&&r.wrap&4&&(B[0]=f&255,B[1]=f>>>8&255,r.check=ca(r.check,B,2,0)),f=0,d=0,r.mode=t6;case t6:if(r.flags&1024){for(;d<16;){if(u===0)break e;u--,f+=n[a++]<>>8&255,r.check=ca(r.check,B,2,0)),f=0,d=0}else r.head&&(r.head.extra=null);r.mode=r6;case r6:if(r.flags&1024&&(h=r.length,h>u&&(h=u),h&&(r.head&&(N=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(a,a+h),N)),r.flags&512&&r.wrap&4&&(r.check=ca(r.check,n,h,a)),u-=h,a+=h,r.length-=h),r.length))break e;r.length=0,r.mode=n6;case n6:if(r.flags&2048){if(u===0)break e;h=0;do N=n[a+h++],r.head&&N&&r.length<65536&&(r.head.name+=String.fromCharCode(N));while(N&&h>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=nu;break;case a6:for(;d<32;){if(u===0)break e;u--,f+=n[a++]<>>=d&7,d-=d&7,r.mode=sv;break}for(;d<3;){if(u===0)break e;u--,f+=n[a++]<>>=1,d-=1,f&3){case 0:r.mode=u6;break;case 1:if(JL(r),r.mode=Td,t===Rd){f>>>=2,d-=2;break e}break;case 2:r.mode=c6;break;case 3:e.msg="invalid block type",r.mode=cr}f>>>=2,d-=2;break;case u6:for(f>>>=d&7,d-=d&7;d<32;){if(u===0)break e;u--,f+=n[a++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=cr;break}if(r.length=f&65535,f=0,d=0,r.mode=iv,t===Rd)break e;case iv:r.mode=o6;case o6:if(h=r.length,h){if(h>u&&(h=u),h>c&&(h=c),h===0)break e;i.set(n.subarray(a,a+h),s),u-=h,a+=h,c-=h,s+=h,r.length-=h;break}r.mode=nu;break;case c6:for(;d<14;){if(u===0)break e;u--,f+=n[a++]<>>=5,d-=5,r.ndist=(f&31)+1,f>>>=5,d-=5,r.ncode=(f&15)+4,f>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=cr;break}r.have=0,r.mode=l6;case l6:for(;r.have>>=3,d-=3}for(;r.have<19;)r.lens[U[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,O={bits:r.lenbits},S=Kf(HL,r.lens,0,19,r.lencode,0,r.work,O),r.lenbits=O.bits,S){e.msg="invalid code lengths set",r.mode=cr;break}r.have=0,r.mode=f6;case f6:for(;r.have>>24,b=y>>>16&255,D=y&65535,!(g<=d);){if(u===0)break e;u--,f+=n[a++]<>>=g,d-=g,r.lens[r.have++]=D;else{if(D===16){for(x=g+2;d>>=g,d-=g,r.have===0){e.msg="invalid bit length repeat",r.mode=cr;break}N=r.lens[r.have-1],h=3+(f&3),f>>>=2,d-=2}else if(D===17){for(x=g+3;d>>=g,d-=g,N=0,h=3+(f&7),f>>>=3,d-=3}else{for(x=g+7;d>>=g,d-=g,N=0,h=11+(f&127),f>>>=7,d-=7}if(r.have+h>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=cr;break}for(;h--;)r.lens[r.have++]=N}}if(r.mode===cr)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=cr;break}if(r.lenbits=9,O={bits:r.lenbits},S=Kf(b6,r.lens,0,r.nlen,r.lencode,0,r.work,O),r.lenbits=O.bits,S){e.msg="invalid literal/lengths set",r.mode=cr;break}if(r.distbits=6,r.distcode=r.distdyn,O={bits:r.distbits},S=Kf(y6,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,O),r.distbits=O.bits,S){e.msg="invalid distances set",r.mode=cr;break}if(r.mode=Td,t===Rd)break e;case Td:r.mode=Od;case Od:if(u>=6&&c>=258){e.next_out=s,e.avail_out=c,e.next_in=a,e.avail_in=u,r.hold=f,r.bits=d,jL(e,p),s=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,n=e.input,u=e.avail_in,f=r.hold,d=r.bits,r.mode===nu&&(r.back=-1);break}for(r.back=0;y=r.lencode[f&(1<>>24,b=y>>>16&255,D=y&65535,!(g<=d);){if(u===0)break e;u--,f+=n[a++]<>C)],g=y>>>24,b=y>>>16&255,D=y&65535,!(C+g<=d);){if(u===0)break e;u--,f+=n[a++]<>>=C,d-=C,r.back+=C}if(f>>>=g,d-=g,r.back+=g,r.length=D,b===0){r.mode=m6;break}if(b&32){r.back=-1,r.mode=nu;break}if(b&64){e.msg="invalid literal/length code",r.mode=cr;break}r.extra=b&15,r.mode=h6;case h6:if(r.extra){for(x=r.extra;d>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=d6;case d6:for(;y=r.distcode[f&(1<>>24,b=y>>>16&255,D=y&65535,!(g<=d);){if(u===0)break e;u--,f+=n[a++]<>C)],g=y>>>24,b=y>>>16&255,D=y&65535,!(C+g<=d);){if(u===0)break e;u--,f+=n[a++]<>>=C,d-=C,r.back+=C}if(f>>>=g,d-=g,r.back+=g,b&64){e.msg="invalid distance code",r.mode=cr;break}r.offset=D,r.extra=b&15,r.mode=p6;case p6:if(r.extra){for(x=r.extra;d>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=cr;break}r.mode=g6;case g6:if(c===0)break e;if(h=p-c,r.offset>h){if(h=r.offset-h,h>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=cr;break}h>r.wnext?(h-=r.wnext,w=r.wsize-h):w=r.wnext-h,h>r.length&&(h=r.length),m=r.window}else m=i,w=s-r.offset,h=r.length;h>c&&(h=c),c-=h,r.length-=h;do i[s++]=m[w++];while(--h);r.length===0&&(r.mode=Od);break;case m6:if(c===0)break e;i[s++]=r.length,c--,r.mode=Od;break;case sv:if(r.wrap){for(;d<32;){if(u===0)break e;u--,f|=n[a++]<{if(Ko(e))return Qi;let t=e.state;return t.window&&(t.window=null),e.state=null,Vo},tU=(e,t)=>{if(Ko(e))return Qi;let r=e.state;return r.wrap&2?(r.head=t,t.done=!1,Vo):Qi},rU=(e,t)=>{let r=t.length,n,i,a;return Ko(e)||(n=e.state,n.wrap!==0&&n.mode!==kd)?Qi:n.mode===kd&&(i=1,i=ov(i,t,r,0),i!==n.check)?_6:(a=B6(e,t,r,r),a?(n.mode=lv,cv):(n.havedict=1,Vo))};vs.exports.inflateReset=F6;vs.exports.inflateReset2=S6;vs.exports.inflateResetKeep=D6;vs.exports.inflateInit=ZL;vs.exports.inflateInit2=I6;vs.exports.inflate=QL;vs.exports.inflateEnd=eU;vs.exports.inflateGetHeader=tU;vs.exports.inflateSetDictionary=rU;vs.exports.inflateInfo="pako inflate (from Nodeca project)"});var x6=he((tY,$6)=>{"use strict";function nU(){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}$6.exports=nU});var k6=he((rY,ll)=>{"use strict";var iu=P6(),T6=Jm(),dv=Qm(),pv=Id(),iU=ev(),sU=x6(),O6=Object.prototype.toString,{Z_NO_FLUSH:aU,Z_FINISH:uU,Z_OK:zf,Z_STREAM_END:fv,Z_NEED_DICT:hv,Z_STREAM_ERROR:oU,Z_DATA_ERROR:R6,Z_MEM_ERROR:cU}=Ou();function Gf(e){this.options=T6.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});let 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 iU,this.strm.avail_out=0;let r=iu.inflateInit2(this.strm,t.windowBits);if(r!==zf)throw new Error(pv[r]);if(this.header=new sU,iu.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=dv.string2buf(t.dictionary):O6.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=iu.inflateSetDictionary(this.strm,t.dictionary),r!==zf)))throw new Error(pv[r])}Gf.prototype.push=function(e,t){let r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,s,u;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?uU:aU,O6.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(r.avail_out===0&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),a=iu.inflate(r,s),a===hv&&i&&(a=iu.inflateSetDictionary(r,i),a===zf?a=iu.inflate(r,s):a===R6&&(a=hv));r.avail_in>0&&a===fv&&r.state.wrap>0&&e[r.next_in]!==0;)iu.inflateReset(r),a=iu.inflate(r,s);switch(a){case oU:case R6:case hv:case cU:return this.onEnd(a),this.ended=!0,!1}if(u=r.avail_out,r.next_out&&(r.avail_out===0||a===fv))if(this.options.to==="string"){let c=dv.utf8border(r.output,r.next_out),f=r.next_out-c,d=dv.buf2string(r.output,c);r.next_out=f,r.avail_out=n-f,f&&r.output.set(r.output.subarray(c,c+f),0),this.onData(d)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(!(a===zf&&u===0)){if(a===fv)return a=iu.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};Gf.prototype.onData=function(e){this.chunks.push(e)};Gf.prototype.onEnd=function(e){e===zf&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=T6.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function gv(e,t){let r=new Gf(t);if(r.push(e),r.err)throw r.msg||pv[r.err];return r.result}function lU(e,t){return t=t||{},t.raw=!0,gv(e,t)}ll.exports.Inflate=Gf;ll.exports.inflate=gv;ll.exports.inflateRaw=lU;ll.exports.ungzip=gv;ll.exports.constants=Ou()});var N6=he((nY,la)=>{"use strict";var{Deflate:fU,deflate:hU,deflateRaw:dU,gzip:pU}=KC(),{Inflate:gU,inflate:mU,inflateRaw:vU,ungzip:wU}=k6(),AU=Ou();la.exports.Deflate=fU;la.exports.deflate=hU;la.exports.deflateRaw=dU;la.exports.gzip=pU;la.exports.Inflate=gU;la.exports.inflate=mU;la.exports.inflateRaw=vU;la.exports.ungzip=wU;la.exports.constants=AU});var Ev=he((iY,M6)=>{var EU=new TextEncoder,bU=new TextDecoder("utf-8");function mv(e){return EU.encode(e)}function vv(e){return bU.decode(e)}function U6(e){if(typeof e!="string")throw new TypeError("value is not a string");if(!/^([0-9a-f][0-9a-f])*$/.test(e))throw new RangeError("value is not hexadecimal");return e===""?new Uint8Array(0):new Uint8Array(e.match(/../g).map(t=>parseInt(t,16)))}var L6=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],j6=new Array(256);for(let e=0;e<256;e++)j6[e]=`${L6[e>>>4&15]}${L6[e&15]}`;function H6(e){let t="",r=e.byteLength;for(let n=0;n=this.buf.byteLength&&this.grow(),this.buf[this.offset]=t,this.offset+=1}appendUint32(t){if(!Number.isInteger(t))throw new RangeError("value is not an integer");if(t<0||t>4294967295)throw new RangeError("number out of range");let r=Math.max(1,Math.ceil((32-Math.clz32(t))/7));this.offset+r>this.buf.byteLength&&this.grow();for(let n=0;n>>=7;return this.offset+=r,r}appendInt32(t){if(!Number.isInteger(t))throw new RangeError("value is not an integer");if(t<-2147483648||t>2147483647)throw new RangeError("number out of range");let r=Math.ceil((33-Math.clz32(t>=0?t:-t-1))/7);this.offset+r>this.buf.byteLength&&this.grow();for(let n=0;n>=7;return this.offset+=r,r}appendUint53(t){if(!Number.isInteger(t))throw new RangeError("value is not an integer");if(t<0||t>Number.MAX_SAFE_INTEGER)throw new RangeError("number out of range");let r=Math.floor(t/4294967296),n=(t&4294967295)>>>0;return this.appendUint64(r,n)}appendInt53(t){if(!Number.isInteger(t))throw new RangeError("value is not an integer");if(tNumber.MAX_SAFE_INTEGER)throw new RangeError("number out of range");let r=Math.floor(t/4294967296),n=(t&4294967295)>>>0;return this.appendInt64(r,n)}appendUint64(t,r){if(!Number.isInteger(t)||!Number.isInteger(r))throw new RangeError("value is not an integer");if(t<0||t>4294967295||r<0||r>4294967295)throw new RangeError("number out of range");if(t===0)return this.appendUint32(r);let n=Math.ceil((64-Math.clz32(t))/7);this.offset+n>this.buf.byteLength&&this.grow();for(let i=0;i<4;i++)this.buf[this.offset+i]=r&127|128,r>>>=7;this.buf[this.offset+4]=r&15|(t&7)<<4|(n===5?0:128),t>>>=3;for(let i=5;i>>=7;return this.offset+=n,n}appendInt64(t,r){if(!Number.isInteger(t)||!Number.isInteger(r))throw new RangeError("value is not an integer");if(t<-2147483648||t>2147483647||r<-2147483648||r>4294967295)throw new RangeError("number out of range");if(r>>>=0,t===0&&r<=2147483647)return this.appendInt32(r);if(t===-1&&r>=2147483648)return this.appendInt32(r-4294967296);let n=Math.ceil((65-Math.clz32(t>=0?t:-t-1))/7);this.offset+n>this.buf.byteLength&&this.grow();for(let i=0;i<4;i++)this.buf[this.offset+i]=r&127|128,r>>>=7;this.buf[this.offset+4]=r&15|(t&7)<<4|(n===5?0:128),t>>=3;for(let i=5;i>=7;return this.offset+=n,n}appendRawBytes(t){return this.offset+t.byteLength>this.buf.byteLength&&this.grow(this.offset+t.byteLength),this.buf.set(t,this.offset),this.offset+=t.byteLength,t.byteLength}appendRawString(t){if(typeof t!="string")throw new TypeError("value is not a string");return this.appendRawBytes(mv(t))}appendPrefixedBytes(t){return this.appendUint53(t.byteLength),this.appendRawBytes(t),this}appendPrefixedString(t){if(typeof t!="string")throw new TypeError("value is not a string");return this.appendPrefixedBytes(mv(t)),this}appendHexString(t){return this.appendPrefixedBytes(U6(t)),this}finish(){}},Wf=class{constructor(t){if(!(t instanceof Uint8Array))throw new TypeError(`Not a byte array: ${t}`);this.buf=t,this.offset=0}get done(){return this.offset===this.buf.byteLength}reset(){this.offset=0}skip(t){if(this.offset+t>this.buf.byteLength)throw new RangeError("cannot skip beyond end of buffer");this.offset+=t}readByte(){return this.offset+=1,this.buf[this.offset-1]}readUint32(){let t=0,r=0;for(;this.offset>>0,r+=7,this.offset++,!(n&128))return t}throw new RangeError("buffer ended with incomplete number")}readInt32(){let t=0,r=0;for(;this.offset28?t:t|-1<2097151)throw new RangeError("number out of range");return r*4294967296+t}readInt53(){let{low32:t,high32:r}=this.readInt64();if(r<-2097152||r===-2097152&&t===0||r>2097151)throw new RangeError("number out of range");return r*4294967296+t}readUint64(){let t=0,r=0,n=0;for(;this.offset>>0,n===28&&(r=(i&112)>>>4),n+=7,this.offset++,!(i&128))return{high32:r,low32:t}}for(n=3;this.offset>>0,n+=7,this.offset++,!(i&128))return{high32:r,low32:t}}throw new RangeError("buffer ended with incomplete number")}readInt64(){let t=0,r=0,n=0;for(;this.offset>>0,n===28&&(r=(i&112)>>>4),n+=7,this.offset++,!(i&128))return i&64&&(n<32&&(t=(t|-1<>>0),r|=-1<this.buf.byteLength)throw new RangeError("subarray exceeds buffer size");return this.offset+=t,this.buf.subarray(r,this.offset)}readRawString(t){return vv(this.readRawBytes(t))}readPrefixedBytes(){return this.readRawBytes(this.readUint53())}readPrefixedString(){return vv(this.readPrefixedBytes())}readHexString(){return H6(this.readPrefixedBytes())}},Ld=class extends Yf{constructor(t){super(),this.type=t,this.state="empty",this.lastValue=void 0,this.count=0,this.literal=[]}appendValue(t,r=1){this._appendValue(t,r)}_appendValue(t,r=1){r<=0||(this.state==="empty"?(this.state=t===null?"nulls":r===1?"loneValue":"repetition",this.lastValue=t,this.count=r):this.state==="loneValue"?t===null?(this.flush(),this.state="nulls",this.count=r):t===this.lastValue?(this.state="repetition",this.count=1+r):r>1?(this.flush(),this.state="repetition",this.count=r,this.lastValue=t):(this.state="literal",this.literal=[this.lastValue],this.lastValue=t):this.state==="repetition"?t===null?(this.flush(),this.state="nulls",this.count=r):t===this.lastValue?this.count+=r:r>1?(this.flush(),this.state="repetition",this.count=r,this.lastValue=t):(this.flush(),this.state="loneValue",this.lastValue=t):this.state==="literal"?t===null?(this.literal.push(this.lastValue),this.flush(),this.state="nulls",this.count=r):t===this.lastValue?(this.flush(),this.state="repetition",this.count=1+r):r>1?(this.literal.push(this.lastValue),this.flush(),this.state="repetition",this.count=r,this.lastValue=t):(this.literal.push(this.lastValue),this.lastValue=t):this.state==="nulls"&&(t===null?this.count+=r:r>1?(this.flush(),this.state="repetition",this.count=r,this.lastValue=t):(this.flush(),this.state="loneValue",this.lastValue=t)))}copyFrom(t,r={}){let{count:n,sumValues:i,sumShift:a}=r;if(!(t instanceof Xf)||t.type!==this.type)throw new TypeError("incompatible type of decoder");let s=typeof n=="number"?n:Number.MAX_SAFE_INTEGER,u=0,c=0;if(n&&s>0&&t.done)throw new RangeError(`cannot copy ${n} values`);if(s===0||t.done)return i?{nonNullValues:u,sum:c}:{nonNullValues:u};let f=t.readValue();if(f===null){let v=Math.min(t.count+1,s);if(s-=v,t.count-=v-1,this.appendValue(null,v),n&&s>0&&t.done)throw new RangeError(`cannot copy ${n} values`);if(s===0||t.done)return i?{nonNullValues:u,sum:c}:{nonNullValues:u};if(f=t.readValue(),f===null)throw new RangeError("null run must be followed by non-null value")}if(this.appendValue(f),s--,u++,i&&(c+=a?f>>>a:f),n&&s>0&&t.done)throw new RangeError(`cannot copy ${n} values`);if(s===0||t.done)return i?{nonNullValues:u,sum:c}:{nonNullValues:u};let d=t.count>0;for(;s>0&&!t.done;){d||t.readRecord();let v=Math.min(t.count,s);if(t.count-=v,t.state==="literal"){u+=v;for(let p=0;p>>a:h)}}else if(t.state==="repetition"){u+=v,i&&(c+=v*(a?t.lastValue>>>a:t.lastValue));let p=t.lastValue;if(this._appendValue(p),v>1){if(this._appendValue(p),this.state!=="repetition")throw new RangeError(`Unexpected state ${this.state}`);this.count+=v-2}}else if(t.state==="nulls"){if(this._appendValue(null),this.state!=="nulls")throw new RangeError(`Unexpected state ${this.state}`);this.count+=v-1}d=!1,s-=v}if(n&&s>0&&t.done)throw new RangeError(`cannot copy ${n} values`);return i?{nonNullValues:u,sum:c}:{nonNullValues:u}}flush(){if(this.state==="loneValue")this.appendInt32(-1),this.appendRawValue(this.lastValue);else if(this.state==="repetition")this.appendInt53(this.count),this.appendRawValue(this.lastValue);else if(this.state==="literal"){this.appendInt53(-this.literal.length);for(let t of this.literal)this.appendRawValue(t)}else this.state==="nulls"&&(this.appendInt32(0),this.appendUint53(this.count));this.state="empty"}appendRawValue(t){if(this.type==="int")this.appendInt53(t);else if(this.type==="uint")this.appendUint53(t);else if(this.type==="utf8")this.appendPrefixedString(t);else throw new RangeError(`Unknown RLEEncoder datatype: ${this.type}`)}finish(){this.state==="literal"&&this.literal.push(this.lastValue),(this.state!=="nulls"||this.offset>0)&&this.flush()}},Xf=class extends Wf{constructor(t,r){super(r),this.type=t,this.lastValue=void 0,this.count=0,this.state=void 0}get done(){return this.count===0&&this.offset===this.buf.byteLength}reset(){this.offset=0,this.lastValue=void 0,this.count=0,this.state=void 0}readValue(){if(this.done)return null;if(this.count===0&&this.readRecord(),this.count-=1,this.state==="literal"){let t=this.readRawValue();if(t===this.lastValue)throw new RangeError("Repetition of values is not allowed in literal");return this.lastValue=t,t}else return this.lastValue}skipValues(t){for(;t>0&&!this.done;){this.count===0&&(this.count=this.readInt53(),this.count>0?(this.lastValue=this.count<=t?this.skipRawValues(1):this.readRawValue(),this.state="repetition"):this.count<0?(this.count=-this.count,this.state="literal"):(this.count=this.readUint53(),this.lastValue=null,this.state="nulls"));let r=Math.min(t,this.count);this.state==="literal"&&this.skipRawValues(r),t-=r,this.count-=r}}readRecord(){if(this.count=this.readInt53(),this.count>1){let t=this.readRawValue();if((this.state==="repetition"||this.state==="literal")&&this.lastValue===t)throw new RangeError("Successive repetitions with the same value are not allowed");this.state="repetition",this.lastValue=t}else{if(this.count===1)throw new RangeError("Repetition count of 1 is not allowed, use a literal instead");if(this.count<0){if(this.count=-this.count,this.state==="literal")throw new RangeError("Successive literals are not allowed");this.state="literal"}else{if(this.state==="nulls")throw new RangeError("Successive null runs are not allowed");if(this.count=this.readUint53(),this.count===0)throw new RangeError("Zero-length null runs are not allowed");this.lastValue=null,this.state="nulls"}}}readRawValue(){if(this.type==="int")return this.readInt53();if(this.type==="uint")return this.readUint53();if(this.type==="utf8")return this.readPrefixedString();throw new RangeError(`Unknown RLEDecoder datatype: ${this.type}`)}skipRawValues(t){if(this.type==="utf8")for(let r=0;r0&&this.offset0)throw new RangeError("cannot skip beyond end of buffer")}}},wv=class extends Ld{constructor(){super("int"),this.absoluteValue=0}appendValue(t,r=1){r<=0||(typeof t=="number"?(super.appendValue(t-this.absoluteValue,1),this.absoluteValue=t,r>1&&super.appendValue(0,r-1)):super.appendValue(t,r))}copyFrom(t,r={}){if(r.sumValues)throw new RangeError("unsupported options for DeltaEncoder.copyFrom()");if(!(t instanceof Ud))throw new TypeError("incompatible type of decoder");let n=r.count;if(n>0&&t.done)throw new RangeError(`cannot copy ${n} values`);if(n===0||t.done)return;let i=t.readValue(),a=0;if(this.appendValue(i),i===null){if(a=t.count+1,n!==void 0&&na&&t.done)throw new RangeError(`cannot copy ${n} values`);if(n===a||t.done)return;t.count===0&&this.appendValue(t.readValue())}n!==void 0&&(n-=a+1);let{nonNullValues:s,sum:u}=super.copyFrom(t,{count:n,sumValues:!0});s>0&&(this.absoluteValue=u,t.absoluteValue=u)}},Ud=class extends Xf{constructor(t){super("int",t),this.absoluteValue=0}reset(){this.offset=0,this.lastValue=void 0,this.count=0,this.state=void 0,this.absoluteValue=0}readValue(){let t=super.readValue();return t===null?null:(this.absoluteValue+=t,this.absoluteValue)}skipValues(t){for(;t>0&&!this.done;){this.count===0&&this.readRecord();let r=Math.min(t,this.count);if(this.state==="literal")for(let n=0;n0&&t.done)throw new RangeError(`cannot copy ${n} values`);if(i===0||t.done)return;this.appendValue(t.readValue()),i--;let a=Math.min(t.count,i);for(this.count+=a,t.count-=a,i-=a;i>0&&!t.done;){if(t.count=t.readUint53(),t.count===0)throw new RangeError("Zero-length runs are not allowed");t.lastValue=!t.lastValue,this.appendUint53(this.count);let s=Math.min(t.count,i);this.count=s,this.lastValue=t.lastValue,t.count-=s,i-=s}if(n&&i>0&&t.done)throw new RangeError(`cannot copy ${n} values`)}finish(){this.count>0&&(this.appendUint53(this.count),this.count=0)}},jd=class extends Wf{constructor(t){super(t),this.lastValue=!0,this.firstRun=!0,this.count=0}get done(){return this.count===0&&this.offset===this.buf.byteLength}reset(){this.offset=0,this.lastValue=!0,this.firstRun=!0,this.count=0}readValue(){if(this.done)return!1;for(;this.count===0;){if(this.count=this.readUint53(),this.lastValue=!this.lastValue,this.count===0&&!this.firstRun)throw new RangeError("Zero-length runs are not allowed");this.firstRun=!1}return this.count-=1,this.lastValue}skipValues(t){for(;t>0&&!this.done;){if(this.count===0){if(this.count=this.readUint53(),this.lastValue=!this.lastValue,this.count===0&&!this.firstRun)throw new RangeError("Zero-length runs are not allowed");this.firstRun=!1}this.count{(function(e,t){var r={};t(r);var n=r.default;for(var i in r)n[i]=r[i];typeof Hd=="object"&&typeof Hd.exports=="object"?Hd.exports=n:typeof define=="function"&&define.amd?define(function(){return n}):e.sha256=n})(q6,function(e){"use strict";e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function r(v,p,h,w,m){for(var y,g,b,D,C,F,L,N,S,B,O,x,U;m>=64;){for(y=p[0],g=p[1],b=p[2],D=p[3],C=p[4],F=p[5],L=p[6],N=p[7],B=0;B<16;B++)O=w+B*4,v[B]=(h[O]&255)<<24|(h[O+1]&255)<<16|(h[O+2]&255)<<8|h[O+3]&255;for(B=16;B<64;B++)S=v[B-2],x=(S>>>17|S<<15)^(S>>>19|S<<13)^S>>>10,S=v[B-15],U=(S>>>7|S<<25)^(S>>>18|S<<14)^S>>>3,v[B]=(x+v[B-7]|0)+(U+v[B-16]|0);for(B=0;B<64;B++)x=(((C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7))+(C&F^~C&L)|0)+(N+(t[B]+v[B]|0)|0)|0,U=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&g^y&b^g&b)|0,N=L,L=F,F=C,C=D+x|0,D=b,b=g,g=y,y=x+U|0;p[0]+=y,p[1]+=g,p[2]+=b,p[3]+=D,p[4]+=C,p[5]+=F,p[6]+=L,p[7]+=N,w+=64,m-=64}return w}var n=function(){function v(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return v.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},v.prototype.clean=function(){for(var p=0;p0){for(;this.bufferLength<64&&h>0;)this.buffer[this.bufferLength++]=p[w++],h--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(h>=64&&(w=r(this.temp,this.state,p,w,h),h%=64);h>0;)this.buffer[this.bufferLength++]=p[w++],h--;return this},v.prototype.finish=function(p){if(!this.finished){var h=this.bytesHashed,w=this.bufferLength,m=h/536870912|0,y=h<<3,g=h%64<56?64:128;this.buffer[w]=128;for(var b=w+1;b>>24&255,this.buffer[g-7]=m>>>16&255,this.buffer[g-6]=m>>>8&255,this.buffer[g-5]=m>>>0&255,this.buffer[g-4]=y>>>24&255,this.buffer[g-3]=y>>>16&255,this.buffer[g-2]=y>>>8&255,this.buffer[g-1]=y>>>0&255,r(this.temp,this.state,this.buffer,0,g),this.finished=!0}for(var b=0;b<8;b++)p[b*4+0]=this.state[b]>>>24&255,p[b*4+1]=this.state[b]>>>16&255,p[b*4+2]=this.state[b]>>>8&255,p[b*4+3]=this.state[b]>>>0&255;return this},v.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},v.prototype._saveState=function(p){for(var h=0;hthis.blockSize)new n().update(p).finish(h).clean();else for(var w=0;w1&&p.update(v),h&&p.update(h),p.update(w),p.finish(v),w[0]++}var c=new Uint8Array(e.digestLength);function f(v,p,h,w){p===void 0&&(p=c),w===void 0&&(w=32);for(var m=new Uint8Array([1]),y=s(p,v),g=new i(y),b=new Uint8Array(g.digestLength),D=b.length,C=new Uint8Array(w),F=0;F>>24&255,g[1]=L>>>16&255,g[2]=L>>>8&255,g[3]=L>>>0&255,m.reset(),m.update(p),m.update(g),m.finish(D);for(var N=0;N{var Vd=N6(),{copyObject:K6,parseOpId:su,equalBytes:z6}=ms(),{utf8ToString:yU,hexStringToBytes:J6,bytesToHexString:Kd,Encoder:dl,Decoder:vi,RLEEncoder:mi,RLEDecoder:G6,DeltaEncoder:fl,DeltaDecoder:_U,BooleanEncoder:Q6,BooleanDecoder:CU}=Ev(),{Hash:e4}=V6(),hl=new Uint8Array([133,111,74,131]),Dv=0,pl=1,Qf=2,t4=256,dt={GROUP_CARD:0,ACTOR_ID:1,INT_RLE:2,INT_DELTA:3,BOOLEAN:4,STRING_RLE:5,VALUE_LEN:6,VALUE_RAW:7},Jf=8,Xt={NULL:0,FALSE:1,TRUE:2,LEB128_UINT:3,LEB128_INT:4,IEEE754:5,UTF8:6,BYTES:7,COUNTER:8,TIMESTAMP:9,MIN_UNKNOWN:10,MAX_UNKNOWN:15},Zf=["makeMap","set","makeList","del","makeText","inc","makeTable","link"],DU={makeMap:"map",makeList:"list",makeText:"text",makeTable:"table"},r4=[{columnName:"objActor",columnId:0|dt.ACTOR_ID},{columnName:"objCtr",columnId:0|dt.INT_RLE},{columnName:"keyActor",columnId:16|dt.ACTOR_ID},{columnName:"keyCtr",columnId:16|dt.INT_DELTA},{columnName:"keyStr",columnId:16|dt.STRING_RLE},{columnName:"idActor",columnId:32|dt.ACTOR_ID},{columnName:"idCtr",columnId:32|dt.INT_DELTA},{columnName:"insert",columnId:48|dt.BOOLEAN},{columnName:"action",columnId:64|dt.INT_RLE},{columnName:"valLen",columnId:80|dt.VALUE_LEN},{columnName:"valRaw",columnId:80|dt.VALUE_RAW},{columnName:"chldActor",columnId:96|dt.ACTOR_ID},{columnName:"chldCtr",columnId:96|dt.INT_DELTA}],Fv=r4.concat([{columnName:"predNum",columnId:112|dt.GROUP_CARD},{columnName:"predActor",columnId:112|dt.ACTOR_ID},{columnName:"predCtr",columnId:112|dt.INT_DELTA}]),Sv=r4.concat([{columnName:"succNum",columnId:128|dt.GROUP_CARD},{columnName:"succActor",columnId:128|dt.ACTOR_ID},{columnName:"succCtr",columnId:128|dt.INT_DELTA}]),n4=[{columnName:"actor",columnId:0|dt.ACTOR_ID},{columnName:"seq",columnId:0|dt.INT_DELTA},{columnName:"maxOp",columnId:16|dt.INT_DELTA},{columnName:"time",columnId:32|dt.INT_DELTA},{columnName:"message",columnId:48|dt.STRING_RLE},{columnName:"depsNum",columnId:64|dt.GROUP_CARD},{columnName:"depsIndex",columnId:64|dt.INT_DELTA},{columnName:"extraLen",columnId:80|dt.VALUE_LEN},{columnName:"extraRaw",columnId:80|dt.VALUE_RAW}];function Md(e,t){if(!e||!e.actorId)return e;let r=e.counter,n=t.indexOf(e.actorId);if(n<0)throw new RangeError("missing actorId");return{counter:r,actorNum:n,actorId:e.actorId}}function bv(e,t){return e.countert.counter?1:e.actorIdt.actorId?1:0}function FU(e,t){let r={},n=[];for(let a of e)a=K6(a),r[a.actor]=!0,a.ops=TU(a.ops,a.startOp,a.actor),a.ops=a.ops.map(s=>{s=K6(s),s.obj!=="_root"&&(s.obj=su(s.obj)),s.elemId&&s.elemId!=="_head"&&(s.elemId=su(s.elemId)),s.child&&(s.child=su(s.child)),s.pred&&(s.pred=s.pred.map(su)),s.obj.actorId&&(r[s.obj.actorId]=!0),s.elemId&&s.elemId.actorId&&(r[s.elemId.actorId]=!0),s.child&&s.child.actorId&&(r[s.child.actorId]=!0);for(let u of s.pred)r[u.actorId]=!0;return s}),n.push(a);let i=Object.keys(r).sort();t&&(i=[e[0].actor].concat(i.filter(a=>a!==e[0].actor)));for(let a of n){a.actorNum=i.indexOf(a.actor);for(let s=0;sMd(c,i))}}return{changes:n,actorIds:i}}function SU(e,t){if(e.obj==="_root")t.objActor.appendValue(null),t.objCtr.appendValue(null);else if(e.obj.actorNum>=0&&e.obj.counter>0)t.objActor.appendValue(e.obj.actorNum),t.objCtr.appendValue(e.obj.counter);else throw new RangeError(`Unexpected objectId reference: ${JSON.stringify(e.obj)}`)}function IU(e,t){if(e.key)t.keyActor.appendValue(null),t.keyCtr.appendValue(null),t.keyStr.appendValue(e.key);else if(e.elemId==="_head"&&e.insert)t.keyActor.appendValue(null),t.keyCtr.appendValue(0),t.keyStr.appendValue(null);else if(e.elemId&&e.elemId.actorNum>=0&&e.elemId.counter>0)t.keyActor.appendValue(e.elemId.actorNum),t.keyCtr.appendValue(e.elemId.counter),t.keyStr.appendValue(null);else throw new RangeError(`Unexpected operation key: ${JSON.stringify(e)}`)}function BU(e,t){let r=Zf.indexOf(e.action);if(r>=0)t.action.appendValue(r);else if(typeof e.action=="number")t.action.appendValue(e.action);else throw new RangeError(`Unexpected operation action: ${e.action}`)}function PU(e){switch(e.datatype){case"counter":return[Xt.COUNTER,e.value];case"timestamp":return[Xt.TIMESTAMP,e.value];case"uint":return[Xt.LEB128_UINT,e.value];case"int":return[Xt.LEB128_INT,e.value];case"float64":{let t=new ArrayBuffer(8);return new DataView(t).setFloat64(0,e.value,!0),[Xt.IEEE754,new Uint8Array(t)]}default:if(Number.isInteger(e.value)&&e.value<=Number.MAX_SAFE_INTEGER&&e.value>=Number.MIN_SAFE_INTEGER)return[Xt.LEB128_INT,e.value];{let t=new ArrayBuffer(8);return new DataView(t).setFloat64(0,e.value,!0),[Xt.IEEE754,new Uint8Array(t)]}}}function $U(e,t){if(e.action!=="set"&&e.action!=="inc"||e.value===null)t.valLen.appendValue(Xt.NULL);else if(e.value===!1)t.valLen.appendValue(Xt.FALSE);else if(e.value===!0)t.valLen.appendValue(Xt.TRUE);else if(typeof e.value=="string"){let r=t.valRaw.appendRawString(e.value);t.valLen.appendValue(r<<4|Xt.UTF8)}else if(ArrayBuffer.isView(e.value)){let r=t.valRaw.appendRawBytes(new Uint8Array(e.value.buffer));t.valLen.appendValue(r<<4|Xt.BYTES)}else if(typeof e.value=="number"){let[r,n]=PU(e),i;r===Xt.LEB128_UINT?i=t.valRaw.appendUint53(n):r===Xt.IEEE754?i=t.valRaw.appendRawBytes(n):i=t.valRaw.appendInt53(n),t.valLen.appendValue(i<<4|r)}else if(typeof e.datatype=="number"&&e.datatype>=Xt.MIN_UNKNOWN&&e.datatype<=Xt.MAX_UNKNOWN&&e.value instanceof Uint8Array){let r=t.valRaw.appendRawBytes(e.value);t.valLen.appendValue(r<<4|e.datatype)}else throw e.datatype?new RangeError(`Unknown datatype ${e.datatype} for value ${e.value}`):new RangeError(`Unsupported value in operation: ${e.value}`)}function i4(e,t){if(e===Xt.NULL)return{value:null};if(e===Xt.FALSE)return{value:!1};if(e===Xt.TRUE)return{value:!0};if(e%16===Xt.UTF8)return{value:yU(t)};if(e%16===Xt.LEB128_UINT)return{value:new vi(t).readUint53(),datatype:"uint"};if(e%16===Xt.LEB128_INT)return{value:new vi(t).readInt53(),datatype:"int"};if(e%16===Xt.IEEE754){let r=new DataView(t.buffer,t.byteOffset,t.byteLength);if(t.byteLength===8)return{value:r.getFloat64(0,!0),datatype:"float64"};throw new RangeError(`Invalid length for floating point number: ${t.byteLength}`)}else return e%16===Xt.COUNTER?{value:new vi(t).readInt53(),datatype:"counter"}:e%16===Xt.TIMESTAMP?{value:new vi(t).readInt53(),datatype:"timestamp"}:{value:t,datatype:e%16}}function Y6(e,t,r,n){let{columnId:i,columnName:a,decoder:s}=e[t];if(i%8===dt.VALUE_LEN&&t+1>4),{value:f,datatype:d}=i4(u,c);return n[a]=f,d&&(n[a+"_datatype"]=d),2}else if(i%8===dt.ACTOR_ID){let u=s.readValue();if(u===null)n[a]=null;else{if(!r[u])throw new RangeError(`No actor index ${u}`);n[a]=r[u]}}else n[a]=s.readValue();return 1}function xU(e,t){let r={objActor:new mi("uint"),objCtr:new mi("uint"),keyActor:new mi("uint"),keyCtr:new fl,keyStr:new mi("utf8"),insert:new Q6,action:new mi("uint"),valLen:new mi("uint"),valRaw:new dl,chldActor:new mi("uint"),chldCtr:new fl};t?(r.idActor=new mi("uint"),r.idCtr=new fl,r.succNum=new mi("uint"),r.succActor=new mi("uint"),r.succCtr=new fl):(r.predNum=new mi("uint"),r.predCtr=new fl,r.predActor=new mi("uint"));for(let i of e)if(SU(i,r),IU(i,r),r.insert.appendValue(!!i.insert),BU(i,r),$U(i,r),i.child&&i.child.counter?(r.chldActor.appendValue(i.child.actorNum),r.chldCtr.appendValue(i.child.counter)):(r.chldActor.appendValue(null),r.chldCtr.appendValue(null)),t){r.idActor.appendValue(i.id.actorNum),r.idCtr.appendValue(i.id.counter),r.succNum.appendValue(i.succ.length),i.succ.sort(bv);for(let a=0;ai.columnId-a.columnId)}function RU(e,t){return t===void 0?typeof e=="string"||typeof e=="boolean"||e===null:typeof e=="number"}function TU(e,t,r){let n=t,i=[];for(let a of e)if(a.action==="set"&&a.values&&a.insert){if(a.pred.length!==0)throw new RangeError("multi-insert pred must be empty");let s=a.elemId,u=a.datatype;for(let c of a.values){if(!RU(c,u))throw new RangeError(`Decode failed: bad value/datatype association (${c},${u})`);i.push({action:"set",obj:a.obj,elemId:s,datatype:u,value:c,pred:[],insert:!0}),s=`${n}@${r}`,n+=1}}else if(a.action==="del"&&a.multiOp>1){if(a.pred.length!==1)throw new RangeError("multiOp deletion must have exactly one pred");let s=su(a.elemId),u=su(a.pred[0]);for(let c=0;c`${c.succCtr}@${c.succActor}`),W6(n.succNum.map(c=>({counter:c.succCtr,actorId:c.succActor})))):(u.pred=n.predNum.map(c=>`${c.predCtr}@${c.predActor}`),W6(n.predNum.map(c=>({counter:c.predCtr,actorId:c.predActor})))),r.push(u)}return r}function W6(e){let t=null;for(let r of e){if(t&&bv(t,r)!==-1)throw new RangeError("operation IDs are not in ascending order");t=r}}function OU(e){return(e&7)===dt.INT_DELTA?new fl:(e&7)===dt.BOOLEAN?new Q6:(e&7)===dt.STRING_RLE?new mi("utf8"):(e&7)===dt.VALUE_RAW?new dl:new mi("uint")}function qd(e,t){return(e&7)===dt.INT_DELTA?new _U(t):(e&7)===dt.BOOLEAN?new CU(t):(e&7)===dt.STRING_RLE?new G6("utf8",t):(e&7)===dt.VALUE_RAW?new vi(t):new G6("uint",t)}function a4(e,t){let r=new Uint8Array(0),n=[],i=0,a=0;for(;i!i.decoder.done);){let i={},a=0;for(;a>4,c=1;for(;a+c>4===u;)c++;if(s%8===dt.GROUP_CARD){let f=[],d=e[a].decoder.readValue();for(let v=0;v>>0,r=-1,n=[],i=e.readUint53();for(let a=0;an.encoder.buffer.byteLength>0);e.appendUint53(r.length);for(let n of r)e.appendUint53(n.columnId),e.appendUint53(n.encoder.buffer.byteLength)}function u4(e){let t=e.readUint53(),r=[];for(let s=0;s{if(!Array.isArray(n.deps))throw new TypeError("deps is not an array");u.appendUint53(n.deps.length);for(let f of n.deps.slice().sort())u.appendRawBytes(J6(f));u.appendHexString(n.actor),u.appendUint53(n.seq),u.appendUint53(n.startOp),u.appendInt53(n.time),u.appendPrefixedString(n.message||""),u.appendUint53(r.length-1);for(let f of r.slice(1))u.appendHexString(f);let c=xU(n.ops,!1);Cv(u,c);for(let f of c)u.appendRawBytes(f.encoder.buffer);n.extraBytes&&u.appendRawBytes(n.extraBytes)}),s=Kd(i);if(e.hash&&e.hash!==s)throw new RangeError(`Change hash does not match encoding: ${e.hash} != ${s}`);return a.byteLength>=t4?NU(a):a}function l4(e){e[8]===Qf&&(e=f4(e));let t=new vi(e),r=gl(t,!0),n=new vi(r.chunkData);if(!t.done)throw new RangeError("Encoded change has trailing data");if(r.chunkType!==pl)throw new RangeError(`Unexpected chunk type: ${r.chunkType}`);let i=u4(n),a=_v(n);for(let s=0;sn.counter?1:r.actorIdn.actorId?1:0}function jU(e,t){let r={};for(let i of e){if(i.ops=[],r[i.actor]||(r[i.actor]=[]),i.seq!==r[i.actor].length+1)throw new RangeError(`Expected seq = ${r[i.actor].length+1}, got ${i.seq}`);if(i.seq>1&&r[i.actor][i.seq-2].maxOp>i.maxOp)throw new RangeError("maxOp must increase monotonically per actor");r[i.actor].push(i)}let n={};for(let i of t){if(i.action==="del")throw new RangeError("document should not contain del operations");i.pred=n[i.id]?n[i.id].pred:[],n[i.id]=i;for(let a of i.succ){if(!n[a])if(i.elemId){let s=i.insert?i.id:i.elemId;n[a]={id:a,action:"del",obj:i.obj,elemId:s,pred:[]}}else n[a]={id:a,action:"del",obj:i.obj,key:i.key,pred:[]};n[a].pred.push(i.id)}delete i.succ}for(let i of Object.values(n))i.action==="del"&&t.push(i);for(let i of t){let{counter:a,actorId:s}=su(i.id),u=r[s],c=0,f=u.length;for(;c=u.length)throw new RangeError(`Operation ID ${i.id} outside of allowed range`);u[c].ops.push(i)}for(let i of e){i.ops.sort((a,s)=>UU(a.id,s.id)),i.startOp=i.maxOp-i.ops.length+1,delete i.maxOp;for(let a=0;af.depsIndex)){if(!e[c]||!e[c].hash)throw new RangeError(`No hash for index ${c} while processing index ${s}`);let f=e[c].hash;u.deps.push(f),r[f]&&delete r[f]}if(u.deps.sort(),delete u.depsNum,u.extraLen_datatype!==Xt.BYTES)throw new RangeError(`Bad datatype for extra bytes: ${Xt.BYTES}`);u.extraBytes=u.extraLen,delete u.extraLen_datatype,e[s]=Iv(c4(u)),r[e[s].hash]=!0}let n=Object.keys(r).sort(),i=n.length===t.length,a=0;for(;i&&a{u.appendUint53(n.length);for(let c of n)u.appendHexString(c);u.appendUint53(i.length);for(let c of i.sort())u.appendRawBytes(J6(c));Cv(u,t),Cv(u,r);for(let c of t)u.appendRawBytes(c.encoder.buffer);for(let c of r)u.appendRawBytes(c.encoder.buffer);for(let c of a)u.appendUint53(c);s&&u.appendRawBytes(s)}).bytes}function d4(e){let t=new vi(e),r=gl(t,!0),n=new vi(r.chunkData);if(!t.done)throw new RangeError("Encoded document has trailing data");if(r.chunkType!==Dv)throw new RangeError(`Unexpected chunk type: ${r.chunkType}`);let i=[],a=n.readUint53();for(let p=0;p=t4&&(e.encoder={buffer:Vd.deflateRaw(e.encoder.buffer)},e.columnId|=Jf)}function Z6(e){e.columnId&Jf&&(e.buffer=Vd.inflateRaw(e.buffer),e.columnId^=Jf)}g4.exports={COLUMN_TYPE:dt,VALUE_TYPE:Xt,ACTIONS:Zf,OBJECT_TYPE:DU,DOC_OPS_COLUMNS:Sv,CHANGE_COLUMNS:Fv,DOCUMENT_COLUMNS:n4,encoderByColumnId:OU,decoderByColumnId:qd,makeDecoders:a4,decodeValue:i4,splitContainers:h4,encodeChange:c4,decodeChangeColumns:l4,decodeChange:Iv,decodeChangeMeta:kU,decodeChanges:LU,encodeDocumentHeader:MU,decodeDocumentHeader:d4,decodeDocument:p4}});var x4=he((aY,$4)=>{var{parseOpId:Yd,copyObject:Wd}=ms(),{COLUMN_TYPE:vn,VALUE_TYPE:Pv,ACTIONS:au,OBJECT_TYPE:m4,DOC_OPS_COLUMNS:v4,CHANGE_COLUMNS:Ht,DOCUMENT_COLUMNS:ws,encoderByColumnId:El,decoderByColumnId:Lv,makeDecoders:th,decodeValue:zd,encodeChange:qU,decodeChangeColumns:VU,decodeChangeMeta:KU,decodeChanges:zU,decodeDocumentHeader:GU,encodeDocumentHeader:YU}=eh(),nh=600,WU=10,_4=7,C4=Math.floor(WU*nh/8),Cr=0,pr=1,gn=2,mn=3,At=4,$n=5,ur=6,xn=7,Or=8,Mu=9,zo=10,qu=13,ml=14,vl=15,As=13,$v=14,wl=15,w4=Ht.filter(e=>["predNum","predActor","predCtr"].includes(e.columnName)).map(e=>e.columnId);function xv(e,t,r){if(t.length===1)e[t[0]]=r;else{let n=Object.assign({},e[t[0]]);xv(n,t.slice(1),r),e[t[0]]=n}}function A4(e,t,r,n){for(let H of t)H.decoder.reset();let{objActor:i,objCtr:a,keyActor:s,keyCtr:u,keyStr:c,idActor:f,idCtr:d,insert:v}=e,[p,h,,,w,m,y,g,b,,,,,D]=t.map(H=>H.decoder),C=0,F=0,L=!1,N=null,S=null,B=null,O=null,x=null,U=null,G=0;if(a!==null&&!n)for(;(!h.done||!p.done||!b.done)&&(S=h.readValue(),N=r[p.readValue()],b.skipValues(1),S===null||!N||S0&&s!==null){for(C+=1;!y.done&&!m.done&&(O!==u||B!==s)&&(U&&(L=!1),G===0&&!L&&(F+=1,L=!0),O=y.readValue(),B=r[m.readValue()],S=h.readValue(),N=r[p.readValue()],U=g.readValue(),G=D.readValue(),S===a&&N===i);)C+=1;if(S!==a||N!==i||O!==u||B!==s||!U)return{found:!1,skipCount:C,visibleCount:F};if(U&&(L=!1),G===0&&!L&&(F+=1,L=!0),y.done||m.done)return{found:!0,skipCount:C,visibleCount:F};O=y.readValue(),B=r[m.readValue()],S=h.readValue(),N=r[p.readValue()],U=g.readValue(),G=D.readValue()}for(;(!U||O>d||O===d&&B>f)&&S===a&&N===i&&(C+=1,U&&(L=!1),G===0&&!L&&(F+=1,L=!0),!y.done&&!m.done);)O=y.readValue(),B=r[m.readValue()],S=h.readValue(),N=r[p.readValue()],U=g.readValue(),G=D.readValue()}else if(u!==null&&u>0&&s!==null){for(;(!U||O!==u||B!==s)&&S===a&&N===i&&(C+=1,U&&(L=!1),G===0&&!L&&(F+=1,L=!0),!y.done&&!m.done);)O=y.readValue(),B=r[m.readValue()],S=h.readValue(),N=r[p.readValue()],U=g.readValue(),G=D.readValue();if(S!==a||N!==i||O!==u||B!==s||!U)return{found:!1,skipCount:C,visibleCount:F}}return{found:!0,skipCount:C,visibleCount:F}}function E4(e,t,r,n){let i=e.blocks[t],a=e.blocks[t+1];return i.lastObjectActor!==r||i.lastObjectCtr!==n||i.numVisible===void 0?0:i.lastVisibleActor===a.firstVisibleActor&&i.lastVisibleActor!==void 0&&i.lastVisibleCtr===a.firstVisibleCtr&&i.lastVisibleCtr!==void 0?i.numVisible-1:i.numVisible}function D4(e,t){let{objActor:r,objActorNum:n,objCtr:i,keyActor:a,keyCtr:s,keyStr:u}=t,c=0,f=0;if(i!==null)for(;ci)throw new RangeError(`Reference element not found: ${s}@${a}`);f+=E4(e,c,n,i),c++}let{found:h,skipCount:w,visibleCount:m}=A4(t,e.blocks[c].columns,e.actorIds,p);if(c===e.blocks.length-1||e.blocks[c].lastObjectActor!==n||e.blocks[c].lastObjectCtr!==i){if(h)return{blockIndex:c,skipCount:w,visibleCount:f+m};throw new RangeError(`Reference element not found: ${s}@${a}`)}else if(h&&w>>0)%n;for(let u=0;u<_4;u++)e[i>>>3]|=1<<(i&7),i=(i+a)%n,a=(a+s)%n}function S4(e,t,r){let n=8*e.byteLength,i=r%n,a=t%n,s=((r^t)*16777619>>>0)%n;for(let u=0;u<_4;u++){if(!(e[i>>>3]&1<<(i&7)))return!1;i=(i+a)%n,a=(a+s)%n}return!0}function I4(e){e.bloom=new Uint8Array(C4),e.numOps=0,e.lastKey=void 0,e.numVisible=void 0,e.lastObjectActor=void 0,e.lastObjectCtr=void 0,e.firstVisibleActor=void 0,e.firstVisibleCtr=void 0,e.lastVisibleActor=void 0,e.lastVisibleCtr=void 0;for(let d of e.columns)d.decoder.reset();let[t,r,n,i,a,s,u,c,,,,,,f]=e.columns.map(d=>d.decoder);for(;!u.done;){e.numOps+=1;let d=t.readValue(),v=r.readValue(),p=n.readValue(),h=i.readValue(),w=a.readValue(),m=s.readValue(),y=u.readValue(),g=c.readValue(),b=f.readValue();if((e.lastObjectActor!==d||e.lastObjectCtr!==v)&&(e.numVisible=0,e.lastObjectActor=d,e.lastObjectCtr=v),w!==null)e.lastKey=w;else if(g||h!==null){e.lastKey=void 0;let D=g?m:p,C=g?y:h;F4(e.bloom,D,C),b===0&&(e.firstVisibleActor===void 0&&(e.firstVisibleActor=D),e.firstVisibleCtr===void 0&&(e.firstVisibleCtr=C),(e.lastVisibleActor!==D||e.lastVisibleCtr!==C)&&(e.numVisible+=1,e.lastVisibleActor=D,e.lastVisibleCtr=C))}}}function Bv(e,t,r,n){if(t[At]!==null)e.lastObjectCtr===t[pr]&&e.lastObjectActor===t[Cr]&&(e.lastKey===void 0||e.lastKey({columnId:f.columnId,encoder:El(f.columnId)}));bl(s,e.columns,a);let c={columns:s.map(f=>{let d=Lv(f.columnId,f.encoder.buffer);return{columnId:f.columnId,decoder:d}})};I4(c),r.push(c),n+=a}return r}function XU(e){let t=e[0].columns.map(r=>({columnId:r.columnId,encoder:El(r.columnId)}));for(let r of e){for(let n of r.columns)n.decoder.reset();bl(t,r.columns,r.numOps)}return t}function bl(e,t,r){if(r===0)return;let n=0,i=-1,a=0,s=-1,u=0;for(let c of e){for(;n0&&(f=t[n].decoder);let d=c.columnId>>4===i?a:r;if(c.columnId%8===vn.GROUP_CARD)i=c.columnId>>4,f?a=c.encoder.copyFrom(f,{count:r,sumValues:!0}).sum:(c.encoder.appendValue(0,r),a=0);else if(c.columnId%8===vn.VALUE_LEN)if(f){if(n+1===t.length||t[n+1].columnId!==c.columnId+1)throw new RangeError("VALUE_LEN column without accompanying VALUE_RAW column");s=c.columnId+1,u=c.encoder.copyFrom(f,{count:d,sumValues:!0,sumShift:4}).sum}else c.encoder.appendValue(null,d),s=c.columnId+1,u=0;else if(c.columnId%8===vn.VALUE_RAW){if(c.columnId!==s)throw new RangeError("VALUE_RAW column without accompanying VALUE_LEN column");u>0&&c.encoder.appendRawBytes(f.readRawBytes(u))}else if(f)c.encoder.copyFrom(f,{count:d});else{let v=c.columnId%8===vn.BOOLEAN?!1:null;c.encoder.appendValue(v,d)}}}function Rv(e,t){let r=[],n,i=-1,a=0,s=-1,u=0;for(let c of e){if(c.columnId%8===vn.VALUE_RAW){if(c.columnId!==s)throw new RangeError("unexpected VALUE_RAW column");n=c.decoder.readRawBytes(u)}else if(c.columnId%8===vn.GROUP_CARD)i=c.columnId>>4,a=c.decoder.readValue()||0,n=a;else if(c.columnId>>4===i){n=[],c.columnId%8===vn.VALUE_LEN&&(s=c.columnId+1,u=0);for(let f=0;f>>4),n.push(d)}}else n=c.decoder.readValue(),c.columnId%8===vn.ACTOR_ID&&t&&typeof n=="number"&&(n=t[n]),c.columnId%8===vn.VALUE_LEN&&(s=c.columnId+1,u=n>>>4);r.push(n)}return r}function Gd(e,t,r){let n=0,i=-1,a=0;for(let s of e){for(;n>4,a=u,s.encoder.appendValue(u);else if(s.columnId>>4===i){if(!Array.isArray(u)||u.length!==a)throw new RangeError("bad group value");for(let c of u)s.encoder.appendValue(c)}else s.columnId%8===vn.VALUE_RAW?u&&s.encoder.appendRawBytes(u):s.encoder.appendValue(u)}else if(s.columnId%8===vn.GROUP_CARD)i=s.columnId>>4,a=0,s.encoder.appendValue(0);else if(s.columnId%8!==vn.VALUE_RAW){let u=s.columnId>>4===i?a:1,c=null;s.columnId%8===vn.BOOLEAN&&(c=!1),s.columnId%8===vn.VALUE_LEN&&(c=0),s.encoder.appendValue(c,u)}}}function Tv(e,t){let r=e.blocks[t];if(r.columns[Or].decoder.done){if(t===e.blocks.length-1)return{docOp:null,blockIndex:t};t+=1,r=e.blocks[t];for(let n of r.columns)n.decoder.reset();return{docOp:Rv(r.columns),blockIndex:t}}else return{docOp:Rv(r.columns),blockIndex:t}}function P4(e,t){for(;t.changeIndexe.maxOp&&(e.maxOp=t.opCtr),t.opCtr+=1;let r=t.nextOp;if(r[pr]===null&&r[Cr]!==null||r[pr]!==null&&r[Cr]===null)throw new RangeError(`Mismatched object reference: (${r[pr]}, ${r[Cr]})`);if(r[mn]===null&&r[gn]!==null||r[mn]===0&&r[gn]!==null||r[mn]>0&&r[gn]===null)throw new RangeError(`Mismatched operation key: (${r[mn]}, ${r[gn]})`)}function Al(e,t){return t==="list"||t==="text"?{objectId:e,type:t,edits:[]}:{objectId:e,type:t,props:{}}}function b4(e,t,r=1){let n=Yd(e),i=Yd(t);return n.actorId===i.actorId&&n.counter+r===i.counter}function rh(e,t){if(e.length===0){e.push(t);return}let r=e[e.length-1];r.action==="insert"&&t.action==="insert"&&r.index===t.index-1&&r.value.type==="value"&&t.value.type==="value"&&r.elemId===r.opId&&t.elemId===t.opId&&b4(r.elemId,t.elemId,1)&&r.value.datatype===t.value.datatype&&typeof r.value.value==typeof t.value.value?(r.action="multi-insert",t.value.datatype&&(r.datatype=t.value.datatype),r.values=[r.value.value,t.value.value],delete r.value,delete r.opId):r.action==="multi-insert"&&t.action==="insert"&&r.index+r.values.length===t.index&&t.value.type==="value"&&t.elemId===t.opId&&b4(r.elemId,t.elemId,r.values.length)&&r.datatype===t.value.datatype&&typeof r.values[0]==typeof t.value.value?r.values.push(t.value.value):r.action==="remove"&&t.action==="remove"&&r.index===t.index?r.count+=t.count:e.push(t)}function Ov(e,t,r,n,i,a){let s=!1;if(a)for(;!s&&e.length>0;){let u=e[e.length-1];if((u.action==="insert"||u.action==="update")&&u.index===t)e.pop(),s=u.action==="insert";else if(u.action==="multi-insert"&&u.index+u.values.length-1===t)u.values.pop(),s=!0;else break}s?rh(e,{action:"insert",index:t,elemId:r,opId:n,value:i}):rh(e,{action:"update",index:t,opId:n,value:i})}function ZU(e,t,r){let n=[];for(;e.length>0;){let a=e[e.length-1];if(a.action==="insert"){if(a.index!==t)throw new RangeError("last edit has unexpected index");n.unshift(e.pop());break}else if(a.action==="update"){if(a.index!==t)throw new RangeError("last edit has unexpected index");n.unshift(e.pop())}else throw new RangeError("last edit has unexpected action")}let i=!0;for(let a of n)Ov(e,t,r,a.opId,a.value,i),i=!1}function kv(e,t,r,n,i,a,s,u){let c=!t,f=n[Or]0;m||(a[h].visibleOps.push(n),a[h].hasChild=a[h].hasChild||n[Or]%2===0);let y=i.objectMeta[r].children[h];if(a[h].hasChild||y&&Object.keys(y).length>0){let C={};for(let F of a[h].visibleOps){let L=`${F[ur]}@${i.actorIds[F[$n]]}`;if(au[F[Or]]==="set")C[L]=Object.assign({type:"value"},zd(F[Mu],F[zo]));else if(F[Or]%2===0){let N=F[Or]1?C.count-=1:D.edits.pop(),a[h].action="update",Ov(D.edits,s,h,g,b,!0),t&&t.lastObjectActor===n[Cr]&&t.lastObjectCtr===n[pr]&&(t.numVisible+=1)}else Ov(D.edits,s,h,g,b,!a[h].action),a[h].action||(a[h].action="update");else u===0&&!a[h].action&&(a[h].action="remove",rh(D.edits,{action:"remove",index:s,count:1}),t&&t.lastObjectActor===n[Cr]&&t.lastObjectCtr===n[pr]&&(t.numVisible-=1));else(b||!c)&&((w||!D.props[n[At]])&&(D.props[n[At]]={}),b&&(D.props[n[At]][g]=b))}function JU(e,t,r,n,i,a,s){let u=n.nextOp,c=u[xn],f=u[Cr],d=u[pr],v=f===null?"_root":`${d}@${i.actorIds[f]}`,p=n.actorIndex,h=i.actorIds[p],w=!1,m=!1,y={},g;({docOp:g,blockIndex:s}=Tv(i,s));let b=g===null?0:1,D=g===null?0:g[As],C=null,F=[],L=[],N=[],S=null;for(n.objectIds.add(v);;){if(F.length===0){w=!1;let H=n.nextOp;for(;!n.done&&H[$n]===p&&H[xn]===c&&H[Cr]===u[Cr]&&H[pr]===u[pr];){let K=F.length>0?F[F.length-1]:null,Y=!1;for(let ne=0;ne0&&(C=F[0]);let B=g&&g[Cr]===C[Cr]&&g[pr]===C[pr],O=g&&g[At]!==null&&g[At]===C[At],x=g&&g[At]===null&&C[At]===null&&(!g[xn]&&g[gn]===C[gn]&&g[mn]===C[mn]||g[xn]&&g[$n]===C[gn]&&g[ur]===C[mn]);if(F.length===0&&!(B&&(O||x)))break;let U=!1,G=0;if(c||!B||g[At]===null&&C[At]!==null||g[At]!==null&&C[At]!==null&&C[At]=0;H--){let K=!0;for(let Y=0;Y0){for(let H=0;H({columnId:B.columnId,encoder:El(B.columnId)}));bl(C,g.columns,m);let{blockIndex:F,docOpsConsumed:L}=JU(e,D,C,t,r,y,w),N=r.blocks[F],S=-m-L;for(let B=w;B<=F;B++)S+=r.blocks[B].numOps;bl(C,N.columns,S),D.numOps+=S;for(let B of N.columns)if(!B.decoder.done)throw new RangeError(`excess ops in column ${B.columnId}`);if(D.columns=C.map(B=>{let O=Lv(B.columnId,B.encoder.buffer);return{columnId:B.columnId,decoder:O}}),w===F&&D.numOps<=nh)S>0&&g.lastVisibleActor!==void 0&&g.lastVisibleCtr!==void 0&&(D.lastVisibleActor=g.lastVisibleActor,D.lastVisibleCtr=g.lastVisibleCtr),r.blocks[w]=D;else{let B=B4(D);r.blocks.splice(w,F-w+1,...B)}}function ej(e,t){if(t[Cr].columnId!==Ht[Cr].columnId||Ht[Cr].columnName!=="objActor"||t[pr].columnId!==Ht[pr].columnId||Ht[pr].columnName!=="objCtr"||t[gn].columnId!==Ht[gn].columnId||Ht[gn].columnName!=="keyActor"||t[mn].columnId!==Ht[mn].columnId||Ht[mn].columnName!=="keyCtr"||t[At].columnId!==Ht[At].columnId||Ht[At].columnName!=="keyStr"||t[$n].columnId!==Ht[$n].columnId||Ht[$n].columnName!=="idActor"||t[ur].columnId!==Ht[ur].columnId||Ht[ur].columnName!=="idCtr"||t[xn].columnId!==Ht[xn].columnId||Ht[xn].columnName!=="insert"||t[Or].columnId!==Ht[Or].columnId||Ht[Or].columnName!=="action"||t[Mu].columnId!==Ht[Mu].columnId||Ht[Mu].columnName!=="valLen"||t[zo].columnId!==Ht[zo].columnId||Ht[zo].columnName!=="valRaw"||t[qu].columnId!==Ht[qu].columnId||Ht[qu].columnName!=="predNum"||t[ml].columnId!==Ht[ml].columnId||Ht[ml].columnName!=="predActor"||t[vl].columnId!==Ht[vl].columnId||Ht[vl].columnName!=="predCtr")throw new RangeError("unexpected columnId");let r=e.blocks[0].columns;if(!t.every(n=>w4.includes(n.columnId)||r.find(i=>i.columnId===n.columnId))){let n=r.map(i=>({columnId:i.columnId}));for(let i of t){let{columnId:a}=i;!w4.includes(a)&&!r.find(s=>s.columnId===a)&&n.push({columnId:a})}n.sort((i,a)=>i.columnId-a.columnId);for(let i=0;i({columnId:s.columnId,buffer:s.decoder.buf})),n),e.blocks[i]=a}}}function tj(e,t){if(e.indexOf(t.actorIds[0])<0){if(t.seq!==1)throw new RangeError(`Seq ${t.seq} is the first change for actor ${t.actorIds[0]}`);e=e.concat([t.actorIds[0]])}let r=[];for(let n of t.actorIds){let i=e.indexOf(n);if(i<0)throw new RangeError(`actorId ${n} is not known to document`);r.push(i)}return{actorIds:e,actorTable:r}}function rj(e,t,r){for(let n of t){let i=r.objectMeta[n],a=null,s=!1;for(;;){let u=a&&Object.keys(i.children[a.parentKey]).length>0;if(e[n]||(e[n]=Al(n,i.type)),a&&u)if(i.type==="list"||i.type==="text"){for(let c of e[n].edits)c.opId&&i.children[a.parentKey][c.opId]&&(s=!0);if(!s){let c=Yd(n),f=Yd(a.parentKey),d={objActor:c.actorId,objCtr:c.counter,keyActor:f.actorId,keyCtr:f.counter,objActorNum:r.actorIds.indexOf(c.actorId),keyActorNum:r.actorIds.indexOf(f.actorId),keyStr:null,insert:!1,objId:n},{visibleCount:v}=D4(r,d);for(let[p,h]of Object.entries(i.children[a.parentKey])){let w=h;h.objectId&&(e[h.objectId]||(e[h.objectId]=Al(h.objectId,h.type)),w=e[h.objectId]);let m={action:"update",index:v,opId:p,value:w};rh(e[n].edits,m)}}}else{e[n].props[a.parentKey]||(e[n].props[a.parentKey]={});let c=e[n].props[a.parentKey];for(let[f,d]of Object.entries(i.children[a.parentKey]))c[f]?s=!0:d.objectId?(e[d.objectId]||(e[d.objectId]=Al(d.objectId,d.type)),c[f]=e[d.objectId]):c[f]=d}if(s||!i.parentObj||a&&!u)break;a=i,n=i.parentObj,i=r.objectMeta[n]}}return e}function nj(e,t,r,n,i){let a=new Set(r.heads),s=new Set,u=Wd(r.clock),c=[],f=[];for(let d of t){if(r.changeIndexByHash[d.hash]!==void 0||s.has(d.hash))continue;let v=(u[d.actor]||0)+1,p=!0;for(let h of d.deps){let w=r.changeIndexByHash[h];(w===void 0||w===-1)&&!s.has(h)&&(p=!1)}if(!p)f.push(d);else if(d.seqv)throw new RangeError(`Skipped sequence number ${v} for actor ${d.actor}`);u[d.actor]=d.seq,s.add(d.hash);for(let h of d.deps)a.delete(h);a.add(d.hash),c.push(d)}}if(c.length>0){let d={changes:c,changeIndex:-1,objectIds:n};for(P4(r,d);!d.done;)QU(e,d,r);r.heads=[...a].sort(),r.clock=u}return[c,f]}function y4(e){for(let d of e.blocks[0].columns)d.decoder.reset();let t={},r=null,n=0,i={_root:{objectId:"_root",type:"map",props:{}}},a=null,s=null,u="_root",c=!1,f=0;for(;{docOp:r,blockIndex:n}=Tv(e,n),r!==null;){(r[Cr]!==a||r[pr]!==s)&&(u=`${r[pr]}@${e.actorIds[r[Cr]]}`,a=r[Cr],s=r[pr],t={},f=0,c=!1),r[xn]&&c&&(c=!1,f++),r[As]===0&&(c=!0),r[ur]>e.maxOp&&(e.maxOp=r[ur]);for(let d=0;de.maxOp&&(e.maxOp=r[wl][d]);kv(i,null,u,r,e,t,f,r[As])}return i._root}function ij(e){let t=th(e.changesColumns,ws),r=t[0].decoder,n=t[1].decoder,i=t[5].decoder,a=t[6].decoder;if(t[0].columnId!==ws[0].columnId||ws[0].columnName!=="actor"||t[1].columnId!==ws[1].columnId||ws[1].columnName!=="seq"||t[5].columnId!==ws[5].columnId||ws[5].columnName!=="depsNum"||t[6].columnId!==ws[6].columnId||ws[6].columnName!=="depsIndex")throw new RangeError("unexpected columnId");let s=0,u={},c=[],f=new Set;for(;!r.done;){let p=r.readValue(),h=n.readValue(),w=i.readValue(),m=e.actorIds[p];if(h!==1&&h!==u[m]+1)throw new RangeError(`Expected seq ${u[m]+1}, got ${h} for actor ${m}`);c.push(p),u[m]=h,f.add(s);for(let y=0;ye.actorIds[c[p]]).sort();for(let p of t)p.decoder.reset();let v=t.map(p=>({columnId:p.columnId,encoder:El(p.columnId)}));return bl(v,t,s),{clock:u,headActors:d,encoders:v,numChanges:s}}function sj(e,t,r,n){Gd(e,ws,[r.indexOf(t.actor),t.seq,t.maxOp,t.time,t.message,t.deps.length,t.deps.map(i=>n[i]),t.extraBytes?t.extraBytes.byteLength<<4|Pv.BYTES:Pv.BYTES,t.extraBytes])}var Nv=class e{constructor(t){if(this.maxOp=0,this.haveHashGraph=!1,this.changes=[],this.changeIndexByHash={},this.dependenciesByHash={},this.dependentsByHash={},this.hashesByActor={},this.actorIds=[],this.heads=[],this.clock={},this.queue=[],this.objectMeta={_root:{parentObj:null,parentKey:null,opId:null,type:"map",children:{}}},t){let r=GU(t),{clock:n,headActors:i,encoders:a,numChanges:s}=ij(r);if(this.binaryDoc=t,this.changes=new Array(s),this.actorIds=r.actorIds,this.heads=r.heads,this.clock=n,this.changesEncoders=a,this.extraBytes=r.extraBytes,r.heads.length===1&&i.length===1&&(this.hashesByActor[i[0]]=[],this.hashesByActor[i[0]][n[i[0]]-1]=r.heads[0]),r.heads.length===r.headsIndexes.length)for(let c=0;cnh&&(this.blocks=B4(this.blocks[0]));let u={blocks:this.blocks,actorIds:this.actorIds,objectMeta:this.objectMeta,maxOp:0};this.initPatch=y4(u),this.maxOp=u.maxOp}else this.haveHashGraph=!0,this.changesEncoders=ws.map(r=>({columnId:r.columnId,encoder:El(r.columnId)})),this.blocks=[{columns:th([],v4),bloom:new Uint8Array(C4),numOps:0,lastKey:void 0,numVisible:void 0,lastObjectActor:void 0,lastObjectCtr:void 0,firstVisibleActor:void 0,firstVisibleCtr:void 0,lastVisibleActor:void 0,lastVisibleCtr:void 0}]}clone(){let t=new e;return t.maxOp=this.maxOp,t.haveHashGraph=this.haveHashGraph,t.changes=this.changes.slice(),t.changeIndexByHash=Wd(this.changeIndexByHash),t.dependenciesByHash=Wd(this.dependenciesByHash),t.dependentsByHash=Object.entries(this.dependentsByHash).reduce((r,[n,i])=>(r[n]=i.slice(),r),{}),t.hashesByActor=Object.entries(this.hashesByActor).reduce((r,[n,i])=>(r[n]=i.slice(),r),{}),t.actorIds=this.actorIds,t.heads=this.heads,t.clock=this.clock,t.blocks=this.blocks,t.objectMeta=this.objectMeta,t.queue=this.queue,t}applyChanges(t,r=!1){let n=t.map(d=>{let v=VU(d);return v.buffer=d,v}),i={_root:{objectId:"_root",type:"map",props:{}}},a={maxOp:this.maxOp,changeIndexByHash:this.changeIndexByHash,actorIds:this.actorIds,heads:this.heads,clock:this.clock,blocks:this.blocks.slice(),objectMeta:Object.assign({},this.objectMeta)},s=this.queue.length===0?n:n.concat(this.queue),u=[],c=new Set;for(;;){let[d,v]=nj(i,s,a,c,this.haveHashGraph);s=v;for(let p=0;p0&&(u=u.concat(d)),s.length===0)break;if(d.length===0){if(this.haveHashGraph)break;this.computeHashGraph(),a.changeIndexByHash=this.changeIndexByHash}}rj(i,c,a);for(let d of u){this.changes.push(d.buffer),this.hashesByActor[d.actor]||(this.hashesByActor[d.actor]=[]),this.hashesByActor[d.actor][d.seq-1]=d.hash,this.changeIndexByHash[d.hash]=this.changes.length-1,this.dependenciesByHash[d.hash]=d.deps,this.dependentsByHash[d.hash]=[];for(let v of d.deps)this.dependentsByHash[v]||(this.dependentsByHash[v]=[]),this.dependentsByHash[v].push(d.hash);sj(this.changesEncoders,d,a.actorIds,this.changeIndexByHash)}this.maxOp=a.maxOp,this.actorIds=a.actorIds,this.heads=a.heads,this.clock=a.clock,this.blocks=a.blocks,this.objectMeta=a.objectMeta,this.queue=s,this.binaryDoc=null,this.initPatch=null;let f={maxOp:this.maxOp,clock:this.clock,deps:this.heads,pendingChanges:this.queue.length,diffs:i._root};return r&&n.length===1&&(f.actor=n[0].actor,f.seq=n[0].seq),f}computeHashGraph(){let t=this.save();this.haveHashGraph=!0,this.changes=[],this.changeIndexByHash={},this.dependenciesByHash={},this.dependentsByHash={},this.hashesByActor={},this.clock={};for(let r of zU([t])){let n=qU(r);this.changes.push(n),this.changeIndexByHash[r.hash]=this.changes.length-1,this.dependenciesByHash[r.hash]=r.deps,this.dependentsByHash[r.hash]=[];for(let a of r.deps)this.dependentsByHash[a].push(r.hash);r.seq===1&&(this.hashesByActor[r.actor]=[]),this.hashesByActor[r.actor].push(r.hash);let i=(this.clock[r.actor]||0)+1;if(r.seq!==i)throw new RangeError(`Expected seq ${i}, got seq ${r.seq} from actor ${r.actor}`);this.clock[r.actor]=r.seq}}getChanges(t){if(this.haveHashGraph||this.computeHashGraph(),t.length===0)return this.changes.slice();let r=[],n={},i=[];for(let a of t){n[a]=!0;let s=this.dependentsByHash[a];if(!s)throw new RangeError(`hash not found: ${a}`);r.push(...s)}for(;r.length>0;){let a=r.pop();if(n[a]=!0,i.push(a),!this.dependenciesByHash[a].every(s=>n[s]))break;r.push(...this.dependentsByHash[a])}if(r.length===0&&this.heads.every(a=>n[a]))return i.map(a=>this.changes[this.changeIndexByHash[a]]);for(r=t.slice(),n={};r.length>0;){let a=r.pop();if(!n[a]){let s=this.dependenciesByHash[a];if(!s)throw new RangeError(`hash not found: ${a}`);r.push(...s),n[a]=!0}}return this.changes.filter(a=>!n[KU(a,!0).hash])}getChangesAdded(t){this.haveHashGraph||this.computeHashGraph();let r=this.heads.slice(),n={},i=[];for(;r.length>0;){let a=r.pop();!n[a]&&t.changeIndexByHash[a]===void 0&&(n[a]=!0,i.push(a),r.push(...this.dependenciesByHash[a]))}return i.reverse().map(a=>this.changes[this.changeIndexByHash[a]])}getChangeByHash(t){return this.haveHashGraph||this.computeHashGraph(),this.changes[this.changeIndexByHash[t]]}getMissingDeps(t=[]){this.haveHashGraph||this.computeHashGraph();let r=new Set(t),n=new Set;for(let a of this.queue){n.add(a.hash);for(let s of a.deps)r.add(s)}let i=[];for(let a of r)this.changeIndexByHash[a]===void 0&&!n.has(a)&&i.push(a);return i.sort()}save(){if(this.binaryDoc)return this.binaryDoc;let t=this.changesEncoders.map(n=>({columnId:n.columnId,encoder:El(n.columnId)})),r=this.changesEncoders.map(n=>{let i=Lv(n.columnId,n.encoder.buffer);return{columnId:n.columnId,decoder:i}});return bl(t,r,this.changes.length),this.binaryDoc=YU({changesColumns:this.changesEncoders,opsColumns:XU(this.blocks),actorIds:this.actorIds,heads:this.heads,headsIndexes:this.heads.map(n=>this.changeIndexByHash[n]),extraBytes:this.extraBytes}),this.changesEncoders=t,this.binaryDoc}getPatch(){let t={_root:{parentObj:null,parentKey:null,opId:null,type:"map",children:{}}},r={blocks:this.blocks,actorIds:this.actorIds,objectMeta:t,maxOp:0},n=this.initPatch?this.initPatch:y4(r);return{maxOp:this.maxOp,clock:this.clock,deps:this.heads,pendingChanges:this.queue.length,diffs:n}}};$4.exports={MAX_BLOCK_SIZE:nh,BackendDoc:Nv,bloomFilterContains:S4}});var T4=he((uY,R4)=>{function aj(e){if(e.frozen)throw new Error("Attempting to use an outdated Automerge document that has already been updated. Please use the latest document state, or call Automerge.clone() if you really need to use this old document state.");return e.state}R4.exports={backendState:aj}});var Uv=he((oY,L4)=>{var{encodeChange:uj}=eh(),{BackendDoc:k4}=x4(),{backendState:Es}=T4();function oj(){return{state:new k4,heads:[]}}function cj(e){return{state:Es(e).clone(),heads:e.heads}}function lj(e){e.state=null,e.frozen=!0}function fj(e,t){let r=Es(e),n=r.applyChanges(t);return e.frozen=!0,[{state:r,heads:r.heads},n]}function O4(e,t,r){if(e.hashesByActor[t]&&e.hashesByActor[t][r]||!e.haveHashGraph&&(e.computeHashGraph(),e.hashesByActor[t]&&e.hashesByActor[t][r]))return e.hashesByActor[t][r];throw new RangeError(`Unknown change: actorId = ${t}, seq = ${r+1}`)}function hj(e,t){let r=Es(e);if(t.seq<=r.clock[t.actor])throw new RangeError("Change request has already been applied");if(t.seq>1){let s=O4(r,t.actor,t.seq-2);if(!s)throw new RangeError(`Cannot find hash of localChange before seq=${t.seq}`);let u={[s]:!0};for(let c of t.deps)u[c]=!0;t.deps=Object.keys(u).sort()}let n=uj(t),i=r.applyChanges([n],!0);e.frozen=!0;let a=O4(r,t.actor,t.seq-1);return i.deps=i.deps.filter(s=>s!==a),[{state:r,heads:r.heads},i,n]}function dj(e){return Es(e).save()}function pj(e){let t=new k4(e);return{state:t,heads:t.heads}}function gj(e,t){let r=Es(e);return r.applyChanges(t),e.frozen=!0,{state:r,heads:r.heads}}function mj(e){return Es(e).getPatch()}function vj(e){return e.heads}function wj(e){return N4(e,[])}function N4(e,t){if(!Array.isArray(t))throw new TypeError("Pass an array of hashes to Backend.getChanges()");return Es(e).getChanges(t)}function Aj(e,t){return Es(t).getChangesAdded(Es(e))}function Ej(e,t){return Es(e).getChangeByHash(t)}function bj(e,t=[]){return Es(e).getMissingDeps(t)}L4.exports={init:oj,clone:cj,free:lj,applyChanges:fj,applyLocalChange:hj,save:dj,load:pj,loadChanges:gj,getPatch:mj,getHeads:vj,getAllChanges:wj,getChanges:N4,getChangesAdded:Aj,getChangeByHash:Ej,getMissingDeps:bj}});var z4=he((cY,K4)=>{var bs=Uv(),{hexStringToBytes:U4,bytesToHexString:yj,Encoder:Mv,Decoder:qv}=Ev(),{decodeChangeMeta:Jd}=eh(),{copyObject:_j}=ms(),j4=32,H4=66,M4=67,Cj=10,Dj=7,ih=class{constructor(t){if(Array.isArray(t)){this.numEntries=t.length,this.numBitsPerEntry=Cj,this.numProbes=Dj,this.bits=new Uint8Array(Math.ceil(this.numEntries*this.numBitsPerEntry/8));for(let r of t)this.addHash(r)}else if(t instanceof Uint8Array)if(t.byteLength===0)this.numEntries=0,this.numBitsPerEntry=0,this.numProbes=0,this.bits=t;else{let r=new qv(t);this.numEntries=r.readUint32(),this.numBitsPerEntry=r.readUint32(),this.numProbes=r.readUint32(),this.bits=r.readRawBytes(Math.ceil(this.numEntries*this.numBitsPerEntry/8))}else throw new TypeError("invalid argument")}get bytes(){if(this.numEntries===0)return new Uint8Array(0);let t=new Mv;return t.appendUint32(this.numEntries),t.appendUint32(this.numBitsPerEntry),t.appendUint32(this.numProbes),t.appendRawBytes(this.bits),t.buffer}getProbes(t){let r=U4(t),n=8*this.bits.byteLength;if(r.byteLength!==32)throw new RangeError(`Not a 256-bit hash: ${t}`);let i=((r[0]|r[1]<<8|r[2]<<16|r[3]<<24)>>>0)%n,a=((r[4]|r[5]<<8|r[6]<<16|r[7]<<24)>>>0)%n,s=((r[8]|r[9]<<8|r[10]<<16|r[11]<<24)>>>0)%n,u=[i];for(let c=1;c>>3]|=1<<(r&7)}containsHash(t){if(this.numEntries===0)return!1;for(let r of this.getProbes(t))if(!(this.bits[r>>>3]&1<<(r&7)))return!1;return!0}};function Xd(e,t){if(!Array.isArray(t))throw new TypeError("hashes must be an array");e.appendUint32(t.length);for(let r=0;r0&&t[r-1]>=t[r])throw new RangeError("hashes must be sorted");let n=U4(t[r]);if(n.byteLength!==j4)throw new TypeError("heads hashes must be 256 bits");e.appendRawBytes(n)}}function Zd(e){let t=e.readUint32(),r=[];for(let n=0;nJd(i,!0).hash);return{lastSync:t,bloom:new ih(n).bytes}}function Bj(e,t,r){if(t.length===0)return r.map(v=>bs.getChangeByHash(e,v)).filter(v=>v!==void 0);let n={},i=[];for(let v of t){for(let p of v.lastSync)n[p]=!0;i.push(new ih(v.bloom))}let a=bs.getChanges(e,Object.keys(n)).map(v=>Jd(v,!0)),s={},u={},c={};for(let v of a){s[v.hash]=!0;for(let p of v.deps)u[p]||(u[p]=[]),u[p].push(v.hash);i.every(p=>!p.containsHash(v.hash))&&(c[v.hash]=!0)}let f=Object.keys(c);for(;f.length>0;){let v=f.pop();if(u[v])for(let p of u[v])c[p]||(c[p]=!0,f.push(p))}let d=[];for(let v of r)if(c[v]=!0,!s[v]){let p=bs.getChangeByHash(e,v);p&&d.push(p)}for(let v of a)c[v.hash]&&d.push(v.change);return d}function V4(){return{sharedHeads:[],lastSentHeads:[],theirHeads:null,theirNeed:null,theirHave:null,sentHashes:{}}}function Hv(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])}function Pj(e,t){if(!e)throw new Error("generateSyncMessage called with no Automerge document");if(!t)throw new Error("generateSyncMessage requires a syncState, which can be created with initSyncState()");let{sharedHeads:r,lastSentHeads:n,theirHeads:i,theirNeed:a,theirHave:s,sentHashes:u}=t,c=bs.getHeads(e),f=bs.getMissingDeps(e,i||[]),d=[];if((!i||f.every(m=>i.includes(m)))&&(d=[Ij(e,r)]),s&&s.length>0&&!s[0].lastSync.every(y=>bs.getChangeByHash(e,y))){let y={heads:c,need:[],have:[{lastSync:[],bloom:new Uint8Array(0)}],changes:[]};return[t,jv(y)]}let v=Array.isArray(s)&&Array.isArray(a)?Bj(e,s,a):[],p=Array.isArray(n)&&Hv(c,n),h=Array.isArray(i)&&Hv(c,i);if(p&&h&&v.length===0)return[t,null];v=v.filter(m=>!u[Jd(m,!0).hash]);let w={heads:c,have:d,need:f,changes:v};if(v.length>0){u=_j(u);for(let m of v)u[Jd(m,!0).hash]=!0}return t=Object.assign({},t,{lastSentHeads:c,sentHashes:u}),[t,jv(w)]}function $j(e,t,r){let n=t.filter(s=>!e.includes(s)),i=r.filter(s=>t.includes(s));return[...new Set([...n,...i])].sort()}function xj(e,t,r){if(!e)throw new Error("generateSyncMessage called with no Automerge document");if(!t)throw new Error("generateSyncMessage requires a syncState, which can be created with initSyncState()");let{sharedHeads:n,lastSentHeads:i,sentHashes:a}=t,s=null,u=q4(r),c=bs.getHeads(e);u.changes.length>0&&([e,s]=bs.applyChanges(e,u.changes),n=$j(c,bs.getHeads(e),n)),u.changes.length===0&&Hv(u.heads,c)&&(i=u.heads);let f=u.heads.filter(v=>bs.getChangeByHash(e,v));f.length===u.heads.length?(n=u.heads,u.heads.length===0&&(i=[],a=[])):n=[...new Set(f.concat(n))].sort();let d={sharedHeads:n,lastSentHeads:i,theirHave:u.have,theirHeads:u.heads,theirNeed:u.need,sentHashes:a};return[e,d,s]}K4.exports={receiveSyncMessage:xj,generateSyncMessage:Pj,encodeSyncMessage:jv,decodeSyncMessage:q4,initSyncState:V4,encodeSyncState:Fj,decodeSyncState:Sj,BloomFilter:ih}});var Y4=he((lY,G4)=>{var{init:Rj,clone:Tj,free:Oj,applyChanges:kj,applyLocalChange:Nj,save:Lj,load:Uj,loadChanges:jj,getPatch:Hj,getHeads:Mj,getAllChanges:qj,getChanges:Vj,getChangesAdded:Kj,getChangeByHash:zj,getMissingDeps:Gj}=Uv(),{receiveSyncMessage:Yj,generateSyncMessage:Wj,encodeSyncMessage:Xj,decodeSyncMessage:Zj,encodeSyncState:Jj,decodeSyncState:Qj,initSyncState:eH}=z4();G4.exports={init:Rj,clone:Tj,free:Oj,applyChanges:kj,applyLocalChange:Nj,save:Lj,load:Uj,loadChanges:jj,getPatch:Hj,getHeads:Mj,getAllChanges:qj,getChanges:Vj,getChangesAdded:Kj,getChangeByHash:zj,getMissingDeps:Gj,receiveSyncMessage:Yj,generateSyncMessage:Wj,encodeSyncMessage:Xj,decodeSyncMessage:Zj,encodeSyncState:Jj,decodeSyncState:Qj,initSyncState:eH}});var t3=he((fY,Kv)=>{var tH=md(),qr=iC(),{OPTIONS:W4}=eu(),{encodeChange:rH,decodeChange:X4}=eh(),{isObject:Vv}=ms(),Ir=Y4();function sh(e){if(typeof e=="string")e={actorId:e};else if(typeof e>"u")e={};else if(!Vv(e))throw new TypeError(`Unsupported options for init(): ${e}`);return qr.init(Object.assign({backend:Ir},e))}function nH(e,t){let r={message:"Initialization"};return Z4(sh(t),r,n=>Object.assign(n,e))}function Z4(e,t,r){let[n]=qr.change(e,t,r);return n}function iH(e,t){let[r]=qr.emptyChange(e,t);return r}function sH(e,t={}){let r=Ir.clone(qr.getBackendState(e,"clone"));return Qd(sh(t),Ir.getPatch(r),r,[],t)}function aH(e){Ir.free(qr.getBackendState(e,"free"))}function uH(e,t={}){let r=Ir.load(e);return Qd(sh(t),Ir.getPatch(r),r,[e],t)}function oH(e){return Ir.save(qr.getBackendState(e,"save"))}function cH(e,t){let r=qr.getBackendState(e,"merge"),n=qr.getBackendState(t,"merge","second"),i=Ir.getChangesAdded(r,n),[a]=Q4(e,i);return a}function lH(e,t){let r=qr.getBackendState(e,"getChanges"),n=qr.getBackendState(t,"getChanges","second");return Ir.getChanges(n,Ir.getHeads(r))}function J4(e){return Ir.getAllChanges(qr.getBackendState(e,"getAllChanges"))}function Qd(e,t,r,n,i){let a=qr.applyPatch(e,t,r),s=i.patchCallback||e[W4].patchCallback;return s&&s(t,e,a,!1,n),a}function Q4(e,t,r={}){let n=qr.getBackendState(e,"applyChanges"),[i,a]=Ir.applyChanges(n,t);return[Qd(e,a,i,t,r),a]}function e3(e,t){if(!Vv(e)||!Vv(t))return e===t;let r=Object.keys(e).sort(),n=Object.keys(t).sort();if(r.length!==n.length)return!1;for(let i=0;i({get change(){return X4(n)},get snapshot(){let a=Ir.loadChanges(Ir.init(),r.slice(0,i+1));return qr.applyPatch(sh(t),Ir.getPatch(a),a)}}))}function hH(e,t){let r=qr.getBackendState(e,"generateSyncMessage");return Ir.generateSyncMessage(r,t)}function dH(e,t,r){let n=qr.getBackendState(e,"receiveSyncMessage"),[i,a,s]=Ir.receiveSyncMessage(n,t,r);if(!s)return[e,a,s];let u=null;return e[W4].patchCallback&&(u=Ir.decodeSyncMessage(r).changes),[Qd(e,s,i,u,{}),a,s]}function pH(){return Ir.initSyncState()}function gH(e){Ir=e}Kv.exports={init:sh,from:nH,change:Z4,emptyChange:iH,clone:sH,free:aH,load:uH,save:oH,merge:cH,getChanges:lH,getAllChanges:J4,applyChanges:Q4,encodeChange:rH,decodeChange:X4,equals:e3,getHistory:fH,uuid:tH,Frontend:qr,setDefaultBackend:gH,generateSyncMessage:hH,receiveSyncMessage:dH,initSyncState:pH,get Backend(){return Ir}};for(let e of["getObjectId","getObjectById","getActorId","setActorId","getConflicts","getLastLocalChange","Text","Table","Counter","Observable","Int","Uint","Float64"])Kv.exports[e]=qr[e]});var np=he((XY,o3)=>{"use strict";var GH=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Wv=class e extends Error{constructor(t,r,n){super(t),GH(this,e.prototype),this.name="GrammarError",this.location=r,n===void 0&&(n=[]),this.diagnostics=n,this.stage=null,this.problems=[["error",t,r,n]]}toString(){let t=super.toString();this.location&&(t+=` at `,this.location.source!==void 0&&this.location.source!==null&&(t+=`${this.location.source}:`),t+=`${this.location.start.line}:${this.location.start.column}`);for(let r of this.diagnostics)t+=` from `,r.location.source!==void 0&&r.location.source!==null&&(t+=`${r.location.source}:`),t+=`${r.location.start.line}:${r.location.start.column}: ${r.message}`;return t}format(t){let r=t.map(({source:a,text:s})=>({source:a,text:s.split(/\r\n|\n|\r/g)}));function n(a,s,u=""){let c="",f=r.find(({source:v})=>v===a.source),d=a.start;if(f){let v=a.end,p=f.text[d.line-1],w=(d.line===v.line?v.column:p.length+1)-d.column||1;u&&(c+=` note: ${u}`),c+=` --> ${a.source}:${d.line}:${d.column} ${"".padEnd(s)} | ${d.line.toString().padStart(s)} | ${p} ${"".padEnd(s)} | ${"".padEnd(d.column-1)}${"".padEnd(w,"^")}`}else c+=` at ${a.source}:${d.line}:${d.column}`,u&&(c+=`: ${u}`);return c}function i(a,s,u,c=[]){let f;u?f=c.reduce((v,{location:p})=>Math.max(v,p.start.line),u.start.line):f=Math.max.apply(null,c.map(v=>v.location.start.line)),f=f.toString().length;let d=`${a}: ${s}`;u&&(d+=n(u,f));for(let v of c)d+=n(v.location,f,v.message);return d}return this.problems.filter(a=>a[0]!=="info").map(a=>i(...a)).join(` `)}};o3.exports=Wv});var es=he((ZY,c3)=>{"use strict";var YH={build(e){function t(s,...u){return e[s.type](s,...u)}function r(){}function n(s,...u){return t(s.expression,...u)}function i(s){return function(u,...c){u[s].forEach(f=>t(f,...c))}}let a={grammar(s,...u){s.topLevelInitializer&&t(s.topLevelInitializer,...u),s.initializer&&t(s.initializer,...u),s.rules.forEach(c=>t(c,...u))},top_level_initializer:r,initializer:r,rule:n,named:n,choice:i("alternatives"),action:n,sequence:i("elements"),labeled:n,text:n,simple_and:n,simple_not:n,optional:n,zero_or_more:n,one_or_more:n,group:n,semantic_and:r,semantic_not:r,rule_ref:r,literal:r,class:r,any:r};return Object.keys(a).forEach(s=>{Object.prototype.hasOwnProperty.call(e,s)||(e[s]=a[s])}),t}};c3.exports=YH});var Vu=he((JY,f3)=>{"use strict";var WH=es(),l3={findRule(e,t){for(let r=0;r{"use strict";var XH={PUSH:0,PUSH_EMPTY_STRING:35,PUSH_UNDEFINED:1,PUSH_NULL:2,PUSH_FAILED:3,PUSH_EMPTY_ARRAY:4,PUSH_CURR_POS:5,POP:6,POP_CURR_POS:7,POP_N:8,NIP:9,APPEND:10,WRAP:11,TEXT:12,PLUCK:36,IF:13,IF_ERROR:14,IF_NOT_ERROR:15,WHILE_NOT_ERROR:16,MATCH_ANY:17,MATCH_STRING:18,MATCH_STRING_IC:19,MATCH_CHAR_CLASS:20,MATCH_REGEXP:20,ACCEPT_N:21,ACCEPT_STRING:22,FAIL:23,LOAD_SAVED_POS:24,UPDATE_SAVED_POS:25,CALL:26,RULE:27,SILENT_FAILS_ON:28,SILENT_FAILS_OFF:29};h3.exports=XH});var Zv=he((eW,d3)=>{"use strict";var ZH=es(),JH=Vu(),QH=np(),ch=1,Go=0,lh=-1;function ip(e){function t(s){return s.match=Go}function r(s){return a(s.expression),s.match=ch}function n(s){return s.match=a(s.expression)}function i(s,u){let c=s.length,f=0,d=0;for(let v=0;v0?lh:Go}let a=ZH.build({rule(s){let u,c=0;if(typeof s.match>"u"){s.match=Go;do if(u=s.match,s.match=a(s.expression),++c>6)throw new QH("Infinity cycle detected when trying to evaluate node match result",s.location);while(u!==s.match)}return s.match},named:n,choice(s){return s.match=i(s.alternatives,!0)},action:n,sequence(s){return s.match=i(s.elements,!1)},labeled:n,text:n,simple_and:n,simple_not(s){return s.match=-a(s.expression)},optional:r,zero_or_more:r,one_or_more:n,group:n,semantic_and:t,semantic_not:t,rule_ref(s){let u=JH.findRule(e,s.name);return s.match=a(u)},literal(s){let u=s.value.length===0?ch:Go;return s.match=u},class(s){let u=s.parts.length===0?lh:Go;return s.match=u},any:t});a(e)}ip.ALWAYS_MATCH=ch;ip.SOMETIMES_MATCH=Go;ip.NEVER_MATCH=lh;d3.exports=ip});var g3=he((tW,p3)=>{"use strict";var eM=Vu(),$e=Xv(),tM=es(),{ALWAYS_MATCH:_l,SOMETIMES_MATCH:Jv,NEVER_MATCH:Qv}=Zv();function rM(e){let t=[],r=[],n=[],i=[];function a(b){let D=t.indexOf(b);return D===-1?t.push(b)-1:D}function s(b){let D={value:b.parts,inverted:b.inverted,ignoreCase:b.ignoreCase},C=JSON.stringify(D),F=r.findIndex(L=>JSON.stringify(L)===C);return F===-1?r.push(D)-1:F}function u(b){let D=JSON.stringify(b),C=n.findIndex(F=>JSON.stringify(F)===D);return C===-1?n.push(b)-1:C}function c(b,D,C){let F={predicate:b,params:D,body:C.code,location:C.codeLocation},L=JSON.stringify(F),N=i.findIndex(S=>JSON.stringify(S)===L);return N===-1?i.push(F)-1:N}function f(b){let D={};return Object.keys(b).forEach(C=>{D[C]=b[C]}),D}function d(b,...D){return b.concat(...D)}function v(b,D,C,F){return b===_l?C:b===Qv?F:D.concat([C.length,F.length],C,F)}function p(b,D){return b.concat([D.length],D)}function h(b,D,C,F){let L=Object.keys(C).map(N=>F-C[N]);return[$e.CALL,b,D,L.length].concat(L)}function w(b,D,C){let F=b.match|0;return d([$e.PUSH_CURR_POS],[$e.SILENT_FAILS_ON],g(b,{sp:C.sp+1,env:f(C.env),action:null}),[$e.SILENT_FAILS_OFF],v(D?-F:F,[D?$e.IF_ERROR:$e.IF_NOT_ERROR],d([$e.POP],[D?$e.POP:$e.POP_CURR_POS],[$e.PUSH_UNDEFINED]),d([$e.POP],[D?$e.POP_CURR_POS:$e.POP],[$e.PUSH_FAILED])))}function m(b,D,C){let F=c(!0,Object.keys(C.env),b);return d([$e.UPDATE_SAVED_POS],h(F,0,C.env,C.sp),v(b.match|0,[$e.IF],d([$e.POP],D?[$e.PUSH_FAILED]:[$e.PUSH_UNDEFINED]),d([$e.POP],D?[$e.PUSH_UNDEFINED]:[$e.PUSH_FAILED])))}function y(b){return p([$e.WHILE_NOT_ERROR],d([$e.APPEND],b))}let g=tM.build({grammar(b){b.rules.forEach(g),b.literals=t,b.classes=r,b.expectations=n,b.functions=i},rule(b){b.bytecode=g(b.expression,{sp:-1,env:{},pluck:[],action:null})},named(b,D){let C=b.match|0,F=C===Qv?null:u({type:"rule",value:b.name});return d([$e.SILENT_FAILS_ON],g(b.expression,D),[$e.SILENT_FAILS_OFF],v(C,[$e.IF_ERROR],[$e.FAIL,F],[]))},choice(b,D){function C(F,L){let N=F[0].match|0,S=g(F[0],{sp:L.sp,env:f(L.env),action:null});return N===_l?S:d(S,F.length>1?v(Jv,[$e.IF_ERROR],d([$e.POP],C(F.slice(1),L)),[]):[])}return C(b.alternatives,D)},action(b,D){let C=f(D.env),F=b.expression.type!=="sequence"||b.expression.elements.length===0,L=g(b.expression,{sp:D.sp+(F?1:0),env:C,action:b}),N=b.expression.match|0,S=F&&N!==Qv?c(!1,Object.keys(C),b):null;return F?d([$e.PUSH_CURR_POS],L,v(N,[$e.IF_NOT_ERROR],d([$e.LOAD_SAVED_POS,1],h(S,1,C,D.sp+2)),[]),[$e.NIP]):L},sequence(b,D){function C(F,L){if(F.length>0){let N=b.elements.length-F.length+1;return d(g(F[0],{sp:L.sp,env:L.env,pluck:L.pluck,action:null}),v(F[0].match|0,[$e.IF_NOT_ERROR],C(F.slice(1),{sp:L.sp+1,env:L.env,pluck:L.pluck,action:L.action}),d(N>1?[$e.POP_N,N]:[$e.POP],[$e.POP_CURR_POS],[$e.PUSH_FAILED])))}else{if(L.pluck.length>0)return d([$e.PLUCK,b.elements.length+1,L.pluck.length],L.pluck.map(N=>L.sp-N));if(L.action){let N=c(!1,Object.keys(L.env),L.action);return d([$e.LOAD_SAVED_POS,b.elements.length],h(N,b.elements.length+1,L.env,L.sp))}else return d([$e.WRAP,b.elements.length],[$e.NIP])}}return d([$e.PUSH_CURR_POS],C(b.elements,{sp:D.sp+1,env:D.env,pluck:[],action:D.action}))},labeled(b,D){let C=D.env,F=b.label,L=D.sp+1;return F&&(C=f(D.env),D.env[b.label]=L),b.pick&&D.pluck.push(L),g(b.expression,{sp:D.sp,env:C,action:null})},text(b,D){return d([$e.PUSH_CURR_POS],g(b.expression,{sp:D.sp+1,env:f(D.env),action:null}),v(b.match|0,[$e.IF_NOT_ERROR],d([$e.POP],[$e.TEXT]),[$e.NIP]))},simple_and(b,D){return w(b.expression,!1,D)},simple_not(b,D){return w(b.expression,!0,D)},optional(b,D){return d(g(b.expression,{sp:D.sp,env:f(D.env),action:null}),v(-(b.expression.match|0),[$e.IF_ERROR],d([$e.POP],[$e.PUSH_NULL]),[]))},zero_or_more(b,D){let C=g(b.expression,{sp:D.sp+1,env:f(D.env),action:null});return d([$e.PUSH_EMPTY_ARRAY],C,y(C),[$e.POP])},one_or_more(b,D){let C=g(b.expression,{sp:D.sp+1,env:f(D.env),action:null});return d([$e.PUSH_EMPTY_ARRAY],C,v(b.expression.match|0,[$e.IF_NOT_ERROR],d(y(C),[$e.POP]),d([$e.POP],[$e.POP],[$e.PUSH_FAILED])))},group(b,D){return g(b.expression,{sp:D.sp,env:f(D.env),action:null})},semantic_and(b,D){return m(b,!1,D)},semantic_not(b,D){return m(b,!0,D)},rule_ref(b){return[$e.RULE,eM.indexOfRule(e,b.name)]},literal(b){if(b.value.length>0){let D=b.match|0,F=D===Jv||D===_l&&!b.ignoreCase?a(b.ignoreCase?b.value.toLowerCase():b.value):null,L=D!==_l?u({type:"literal",value:b.value,ignoreCase:b.ignoreCase}):null;return v(D,b.ignoreCase?[$e.MATCH_STRING_IC,F]:[$e.MATCH_STRING,F],b.ignoreCase?[$e.ACCEPT_N,b.value.length]:[$e.ACCEPT_STRING,F],[$e.FAIL,L])}return[$e.PUSH_EMPTY_STRING]},class(b){let D=b.match|0,C=D===Jv?s(b):null,F=D!==_l?u({type:"class",value:b.parts,inverted:b.inverted,ignoreCase:b.ignoreCase}):null;return v(D,[$e.MATCH_CHAR_CLASS,C],[$e.ACCEPT_N,1],[$e.FAIL,F])},any(b){let D=b.match|0,C=D!==_l?u({type:"any"}):null;return v(D,[$e.MATCH_ANY],[$e.ACCEPT_N,1],[$e.FAIL,C])}});g(e)}p3.exports=rM});var v3=he((rW,m3)=>{"use strict";var e2=class{constructor(t,r,n){this.sp=-1,this.maxSp=-1,this.varName=r,this.ruleName=t,this.type=n}name(t){if(t<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack underflow: attempt to use a variable '${this.varName}' at an index ${t}`);return this.varName+t}push(t){let r=this.name(++this.sp)+" = "+t+";";return this.sp>this.maxSp&&(this.maxSp=this.sp),r}pop(t){return t!==void 0?(this.sp-=t,Array.from({length:t},(r,n)=>this.name(this.sp+1+n))):this.name(this.sp--)}top(){return this.name(this.sp)}index(t){if(t<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack overflow: attempt to get a variable at a negative index ${t}`);return this.name(this.sp-t)}result(){if(this.maxSp<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack is empty, can't get the result'`);return this.name(0)}defines(){return this.maxSp<0?"":this.type+" "+Array.from({length:this.maxSp+1},(t,r)=>this.name(r)).join(", ")+";"}checkedIf(t,r,n){let i=this.sp;if(r(),n){let a=this.sp;if(this.sp=i,n(),a!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+t+": Branches of a condition can't move the stack pointer differently (before: "+i+", after then: "+a+", after else: "+this.sp+").")}}checkedLoop(t,r){let n=this.sp;if(r(),n!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+t+": Body of a loop can't move the stack pointer (before: "+n+", after: "+this.sp+").")}};m3.exports=e2});var t2=he((nW,w3)=>{"use strict";w3.exports="2.0.1"});var A3=he(sp=>{"use strict";function ou(e){return e.charCodeAt(0).toString(16).toUpperCase()}sp.hex=ou;function nM(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+ou(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+ou(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+ou(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+ou(t))}sp.stringEscape=nM;function iM(e){return e.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+ou(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+ou(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+ou(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+ou(t))}sp.regexpClassEscape=iM});var y3=he(b3=>{var E3="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");b3.encode=function(e){if(0<=e&&e{var sM=y3(),_3=5,C3=1<<_3,aM=C3-1,uM=C3;function oM(e){return e<0?(-e<<1)+1:(e<<1)+0}D3.encode=function(t){let r="",n,i=oM(t);do n=i&aM,i>>>=_3,i>0&&(n|=uM),r+=sM.encode(n);while(i>0);return r}});var up=he(zu=>{function cM(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}zu.getArg=cM;var I3=function(){return!("__proto__"in Object.create(null))}();function B3(e){return e}function lM(e){return P3(e)?"$"+e:e}zu.toSetString=I3?B3:lM;function fM(e){return P3(e)?e.slice(1):e}zu.fromSetString=I3?B3:fM;function P3(e){if(!e)return!1;let t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(let r=t-10;r>=0;r--)if(e.charCodeAt(r)!==36)return!1;return!0}function S3(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function hM(e,t){let r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=S3(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:S3(e.name,t.name)}zu.compareByGeneratedPositionsInflated=hM;var r2="http:",fh=`${r2}//host`;function $3(e){return t=>{let r=hh(t),n=n2(t),i=new URL(t,n);e(i);let a=i.toString();return r==="absolute"?a:r==="scheme-relative"?a.slice(r2.length):r==="path-absolute"?a.slice(fh.length):i2(n,a)}}function Ku(e,t){return new URL(e,t).toString()}function dM(e,t){let r=0;do{let n=e+r++;if(t.indexOf(n)===-1)return n}while(!0)}function n2(e){let t=e.split("..").length-1,r=dM("p",e),n=`${fh}/`;for(let i=0;i0&&!n[n.length-1]&&n.pop();r.length>0&&n.length>0&&r[0]===n[0];)r.shift(),n.shift();return n.map(()=>"..").concat(r).join("/")+t.search+t.hash}var gM=$3(e=>{e.pathname=e.pathname.replace(/\/?$/,"/")}),ap=$3(e=>{});zu.normalize=ap;function mM(e,t){let r=hh(t),n=hh(e);if(e=gM(e),r==="absolute")return Ku(t,void 0);if(n==="absolute")return Ku(t,e);if(r==="scheme-relative")return ap(t);if(n==="scheme-relative")return Ku(t,Ku(e,fh)).slice(r2.length);if(r==="path-absolute")return ap(t);if(n==="path-absolute")return Ku(t,Ku(e,fh)).slice(fh.length);let i=n2(t+e),a=Ku(t,Ku(e,i));return i2(i,a)}zu.join=mM;function vM(e,t){let r=wM(e,t);return typeof r=="string"?r:ap(t)}zu.relative=vM;function wM(e,t){if(hh(e)!==hh(t))return null;let n=n2(e+t),i=new URL(e,n),a=new URL(t,n);try{new URL("",a.toString())}catch{return null}return a.protocol!==i.protocol||a.user!==i.user||a.password!==i.password||a.hostname!==i.hostname||a.port!==i.port?null:i2(i,a)}});var R3=he(x3=>{var s2=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){let n=new e;for(let i=0,a=t.length;i=0)return r;throw new Error('"'+t+'" is not in the set.')}at(t){if(t>=0&&t{var T3=up();function AM(e,t){let r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,a=t.generatedColumn;return n>r||n==r&&a>=i||T3.compareByGeneratedPositionsInflated(e,t)<=0}var a2=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(t,r){this._array.forEach(t,r)}add(t){AM(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))}toArray(){return this._sorted||(this._array.sort(T3.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};O3.MappingList=a2});var u2=he(N3=>{var dh=F3(),kr=up(),op=R3().ArraySet,EM=k3().MappingList,cp=class e{constructor(t){t||(t={}),this._file=kr.getArg(t,"file",null),this._sourceRoot=kr.getArg(t,"sourceRoot",null),this._skipValidation=kr.getArg(t,"skipValidation",!1),this._sources=new op,this._names=new op,this._mappings=new EM,this._sourcesContents=null}static fromSourceMap(t){let r=t.sourceRoot,n=new e({file:t.file,sourceRoot:r});return t.eachMapping(function(i){let a={generated:{line:i.generatedLine,column:i.generatedColumn}};i.source!=null&&(a.source=i.source,r!=null&&(a.source=kr.relative(r,a.source)),a.original={line:i.originalLine,column:i.originalColumn},i.name!=null&&(a.name=i.name)),n.addMapping(a)}),t.sources.forEach(function(i){let a=i;r!=null&&(a=kr.relative(r,i)),n._sources.has(a)||n._sources.add(a);let s=t.sourceContentFor(i);s!=null&&n.setSourceContent(i,s)}),n}addMapping(t){let r=kr.getArg(t,"generated"),n=kr.getArg(t,"original",null),i=kr.getArg(t,"source",null),a=kr.getArg(t,"name",null);this._skipValidation||this._validateMapping(r,n,i,a),i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),a!=null&&(a=String(a),this._names.has(a)||this._names.add(a)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n&&n.line,originalColumn:n&&n.column,source:i,name:a})}setSourceContent(t,r){let n=t;this._sourceRoot!=null&&(n=kr.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[kr.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[kr.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))}applySourceMap(t,r,n){let i=r;if(r==null){if(t.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);i=t.file}let a=this._sourceRoot;a!=null&&(i=kr.relative(a,i));let s=this._mappings.toArray().length>0?new op:this._sources,u=new op;this._mappings.unsortedForEach(function(c){if(c.source===i&&c.originalLine!=null){let v=t.originalPositionFor({line:c.originalLine,column:c.originalColumn});v.source!=null&&(c.source=v.source,n!=null&&(c.source=kr.join(n,c.source)),a!=null&&(c.source=kr.relative(a,c.source)),c.originalLine=v.line,c.originalColumn=v.column,v.name!=null&&(c.name=v.name))}let f=c.source;f!=null&&!s.has(f)&&s.add(f);let d=c.name;d!=null&&!u.has(d)&&u.add(d)},this),this._sources=s,this._names=u,t.sources.forEach(function(c){let f=t.sourceContentFor(c);f!=null&&(n!=null&&(c=kr.join(n,c)),a!=null&&(c=kr.relative(a,c)),this.setSourceContent(c,f))},this)}_validateMapping(t,r,n,i){if(r&&typeof r.line!="number"&&typeof r.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0&&!r&&!n&&!i)){if(!(t&&"line"in t&&"column"in t&&r&&"line"in r&&"column"in r&&t.line>0&&t.column>=0&&r.line>0&&r.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:n,original:r,name:i}))}}_serializeMappings(){let t=0,r=1,n=0,i=0,a=0,s=0,u="",c,f,d,v,p=this._mappings.toArray();for(let h=0,w=p.length;h0){if(!kr.compareByGeneratedPositionsInflated(f,p[h-1]))continue;c+=","}c+=dh.encode(f.generatedColumn-t),t=f.generatedColumn,f.source!=null&&(v=this._sources.indexOf(f.source),c+=dh.encode(v-s),s=v,c+=dh.encode(f.originalLine-1-i),i=f.originalLine-1,c+=dh.encode(f.originalColumn-n),n=f.originalColumn,f.name!=null&&(d=this._names.indexOf(f.name),c+=dh.encode(d-a),a=d)),u+=c}return u}_generateSourcesContent(t,r){return t.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=kr.relative(r,n));let i=kr.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]:null},this)}toJSON(){let t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(t.file=this._file),this._sourceRoot!=null&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t}toString(){return JSON.stringify(this.toJSON())}};cp.prototype._version=3;N3.SourceMapGenerator=cp});var U3=he(L3=>{var bM=u2().SourceMapGenerator,lp=up(),yM=/(\r?\n)/,_M=10,Cl="$$$isSourceNode$$$",o2=class e{constructor(t,r,n,i,a){this.children=[],this.sourceContents={},this.line=t??null,this.column=r??null,this.source=n??null,this.name=a??null,this[Cl]=!0,i!=null&&this.add(i)}static fromStringWithSourceMap(t,r,n){let i=new e,a=t.split(yM),s=0,u=function(){let h=m(),w=m()||"";return h+w;function m(){return s=0;r--)this.prepend(t[r]);else if(t[Cl]||typeof t=="string")this.children.unshift(t);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);return this}walk(t){let r;for(let n=0,i=this.children.length;n0){for(r=[],n=0;n{c2.SourceMapGenerator=u2().SourceMapGenerator;c2.SourceNode=U3().SourceNode});var V3=he((dW,q3)=>{"use strict";var CM=Vu(),kt=Xv(),DM=v3(),FM=t2(),{stringEscape:Ui,regexpClassEscape:l2}=A3(),{SourceNode:ts}=j3();function M3(e,t,r){let n=t.start.line,i=t.start.column-1,a=e.split(` `);return a.length===1?new ts(n,i,t.source,e,r):new ts(null,null,t.source,a.map((s,u)=>new ts(n+u,u===0?i:0,t.source,u===a.length-1?s:[s,` `],r)))}function H3(e,t,r,n,i){return r?new ts(null,null,r.source,[e,M3(t,r,i),new ts(r.end.line,r.end.column-1,r.source,n)]):new ts(null,null,null,[e,t,n])}function SM(e,t){function r(m){return m instanceof ts?m:m.replace(/^(.+)$/gm," $1")}function n(m){return"peg$c"+m}function i(m){return"peg$r"+m}function a(m){return"peg$e"+m}function s(m){return"peg$f"+m}function u(m){return"peg$parse"+m}function c(){function m(D){return'"'+Ui(D)+'"'}function y(D){return"/^["+(D.inverted?"^":"")+D.value.map(C=>Array.isArray(C)?l2(C[0])+"-"+l2(C[1]):l2(C)).join("")+"]/"+(D.ignoreCase?"i":"")}function g(D){switch(D.type){case"rule":return'peg$otherExpectation("'+Ui(D.value)+'")';case"literal":return'peg$literalExpectation("'+Ui(D.value)+'", '+D.ignoreCase+")";case"class":return"peg$classExpectation(["+D.value.map(F=>Array.isArray(F)?'["'+Ui(F[0])+'", "'+Ui(F[1])+'"]':'"'+Ui(F)+'"').join(", ")+"], "+D.inverted+", "+D.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(D)+")")}}function b(D,C){return H3(` var ${s(C)} = function(${D.params.join(", ")}) {`,D.body,D.location,"};")}return new ts(null,null,t.grammarSource,[e.literals.map((D,C)=>" var "+n(C)+" = "+m(D)+";").concat("",e.classes.map((D,C)=>" var "+i(C)+" = "+y(D)+";")).concat("",e.expectations.map((D,C)=>" var "+a(C)+" = "+g(D)+";")).concat("").join(` `),e.functions.map(b)])}function f(m,y){let g=[];return g.push(""),t.trace&&g.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+m+","," location: peg$computeLocation(startPos, startPos)","});",""),t.cache&&(g.push("var key = peg$currPos * "+e.rules.length+" + "+y+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),t.trace&&g.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+m+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+m+","," location: peg$computeLocation(startPos, startPos)"," });","}",""),g.push(" return cached.result;","}","")),g}function d(m,y){let g=[];return t.cache&&g.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+y+" };"),t.trace&&g.push("","if ("+y+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+m+","," result: "+y+","," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+m+","," location: peg$computeLocation(startPos, startPos)"," });","}"),g.push("","return "+y+";"),g}function v(m){let y=[],g=new DM(m.name,"s","var");function b(C){let F=0,L=C.length,N=[],S;function B(U,G){let H=G+3,K=C[F+H-2],Y=C[F+H-1],ne,Ce;g.checkedIf(F,()=>{F+=H,ne=b(C.slice(F,F+K)),F+=K},Y>0?()=>{Ce=b(C.slice(F,F+Y)),F+=Y}:null),N.push("if ("+U+") {"),N.push(...ne.map(r)),Y>0&&(N.push("} else {"),N.push(...Ce.map(r))),N.push("}")}function O(U){let H=C[F+2-1],K;g.checkedLoop(F,()=>{F+=2,K=b(C.slice(F,F+H)),F+=H}),N.push("while ("+U+") {"),N.push(...K.map(r)),N.push("}")}function x(){let G=C[F+4-1],H=s(C[F+1])+"("+C.slice(F+4,F+4+G).map(K=>g.index(K)).join(", ")+")";g.pop(C[F+2]),N.push(g.push(H)),F+=4+G}for(;Fg.index(K)).join(", ")} ]`,g.pop(C[F+1]),N.push(g.push(S)),F+=H;break}case kt.IF:B(g.top(),0);break;case kt.IF_ERROR:B(g.top()+" === peg$FAILED",0);break;case kt.IF_NOT_ERROR:B(g.top()+" !== peg$FAILED",0);break;case kt.WHILE_NOT_ERROR:O(g.top()+" !== peg$FAILED");break;case kt.MATCH_ANY:B("input.length > peg$currPos",0);break;case kt.MATCH_STRING:B(e.literals[C[F+1]].length>1?"input.substr(peg$currPos, "+e.literals[C[F+1]].length+") === "+n(C[F+1]):"input.charCodeAt(peg$currPos) === "+e.literals[C[F+1]].charCodeAt(0),1);break;case kt.MATCH_STRING_IC:B("input.substr(peg$currPos, "+e.literals[C[F+1]].length+").toLowerCase() === "+n(C[F+1]),1);break;case kt.MATCH_CHAR_CLASS:B(i(C[F+1])+".test(input.charAt(peg$currPos))",1);break;case kt.ACCEPT_N:N.push(g.push(C[F+1]>1?"input.substr(peg$currPos, "+C[F+1]+")":"input.charAt(peg$currPos)")),N.push(C[F+1]>1?"peg$currPos += "+C[F+1]+";":"peg$currPos++;"),F+=2;break;case kt.ACCEPT_STRING:N.push(g.push(n(C[F+1]))),N.push(e.literals[C[F+1]].length>1?"peg$currPos += "+e.literals[C[F+1]].length+";":"peg$currPos++;"),F+=2;break;case kt.FAIL:N.push(g.push("peg$FAILED")),N.push("if (peg$silentFails === 0) { peg$fail("+a(C[F+1])+"); }"),F+=2;break;case kt.LOAD_SAVED_POS:N.push("peg$savedPos = "+g.index(C[F+1])+";"),F+=2;break;case kt.UPDATE_SAVED_POS:N.push("peg$savedPos = peg$currPos;"),F++;break;case kt.CALL:x();break;case kt.RULE:N.push(g.push(u(e.rules[C[F+1]].name)+"()")),F+=2;break;case kt.SILENT_FAILS_ON:N.push("peg$silentFails++;"),F++;break;case kt.SILENT_FAILS_OFF:N.push("peg$silentFails--;"),F++;break;default:throw new Error("Invalid opcode: "+C[F]+".")}return N}let D=b(m.bytecode);return y.push(H3(" function ",u(m.name),m.nameLocation,`() { `,m.name)),t.trace&&y.push(" var startPos = peg$currPos;"),y.push(r(g.defines())),y.push(...f('"'+Ui(m.name)+'"',CM.indexOfRule(e,m.name)).map(r)),y.push(...D.map(r)),y.push(...d('"'+Ui(m.name)+'"',g.result()).map(r)),y.push("}"),y}function p(m){return m.codeLocation?M3(m.code,m.codeLocation,"$"+m.type):m.code}function h(){let m=[];e.topLevelInitializer&&(m.push(p(e.topLevelInitializer)),m.push("")),m.push("function peg$subclass(child, parent) {"," function C() { this.constructor = child; }"," C.prototype = parent.prototype;"," child.prototype = new C();","}","","function peg$SyntaxError(message, expected, found, location) {"," var self = Error.call(this, message);"," // istanbul ignore next Check is a necessary evil to support older environments"," if (Object.setPrototypeOf) {"," Object.setPrototypeOf(self, peg$SyntaxError.prototype);"," }"," self.expected = expected;"," self.found = found;"," self.location = location;",' self.name = "SyntaxError";'," return self;","}","","peg$subclass(peg$SyntaxError, Error);","","function peg$padEnd(str, targetLength, padString) {",' padString = padString || " ";'," if (str.length > targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var loc = this.location.source + ":" + s.line + ":" + s.column;'," if (src) {"," var e = this.location.end;",` var filler = peg$padEnd("", s.line.toString().length, ' ');`," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --> " + loc + "\\n"',' + filler + " |\\n"',' + s.line + " | " + line + "\\n"',` + filler + " | " + peg$padEnd("", s.column - 1, ' ')`,' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .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(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .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(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&m.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");let y="{ "+t.allowedStartRules.map(b=>b+": "+u(b)).join(", ")+" }",g=u(t.allowedStartRules[0]);return m.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+y+";"," var peg$startRuleFunction = "+g+";","",c(),""," var peg$currPos = 0;"," var peg$savedPos = 0;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = 0;"," var peg$maxFailExpected = [];"," var peg$silentFails = 0;",""),t.cache&&m.push(" var peg$resultsCache = {};",""),t.trace&&m.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),m.push(" var peg$result;","",' if ("startRule" in options) {'," if (!(options.startRule in peg$startRuleFunctions)) {",` throw new Error("Can't start parsing from rule \\"" + options.startRule + "\\".");`," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," p = pos - 1;"," while (!peg$posDetailsCache[p]) {"," p--;"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," return {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.rules.forEach(b=>{m.push(...v(b).map(r)),m.push("")}),e.initializer&&(m.push(p(e.initializer)),m.push("")),m.push(" peg$result = peg$startRuleFunction();",""," if (peg$result !== peg$FAILED && peg$currPos === input.length) {"," return peg$result;"," } else {"," if (peg$result !== peg$FAILED && peg$currPos < input.length) {"," peg$fail(peg$endExpectation());"," }",""," throw peg$buildStructuredError("," peg$maxFailExpected,"," peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,"," peg$maxFailPos < input.length"," ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)"," : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)"," );"," }","}"),new ts(null,null,t.grammarSource,m.map(b=>b instanceof ts?b:b+` `))}function w(m){function y(){return[`// Generated by Peggy ${FM}.`,"//","// https://peggyjs.org/"]}function g(){return t.trace?["{"," SyntaxError: peg$SyntaxError,"," DefaultTracer: peg$DefaultTracer,"," parse: peg$parse","}"].join(` `):["{"," SyntaxError: peg$SyntaxError,"," parse: peg$parse","}"].join(` `)}let D={bare(){return[...y(),"(function() {",' "use strict";',"",m,"",r("return "+g()+";"),"})()"]},commonjs(){let C=Object.keys(t.dependencies),F=y();return F.push("",'"use strict";',""),C.length>0&&(C.forEach(L=>{F.push("var "+L+' = require("'+Ui(t.dependencies[L])+'");')}),F.push("")),F.push(m,"","module.exports = "+g()+";"),F},es(){let C=Object.keys(t.dependencies),F=y();return F.push(""),C.length>0&&(C.forEach(L=>{F.push("import "+L+' from "'+Ui(t.dependencies[L])+'";')}),F.push("")),F.push(m,"","export {"," peg$SyntaxError as SyntaxError,",t.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),F},amd(){let C=Object.keys(t.dependencies),L="["+C.map(S=>t.dependencies[S]).map(S=>'"'+Ui(S)+'"').join(", ")+"]",N=C.join(", ");return[...y(),"define("+L+", function("+N+") {",' "use strict";',"",m,"",r("return "+g()+";"),"});"]},globals(){return[...y(),"(function(root) {",' "use strict";',"",m,"",r("root."+t.exportVar+" = "+g()+";"),"})(this);"]},umd(){let C=Object.keys(t.dependencies),F=C.map(O=>t.dependencies[O]),L="["+F.map(O=>'"'+Ui(O)+'"').join(", ")+"]",N=F.map(O=>'require("'+Ui(O)+'")').join(", "),S=C.join(", "),B=y();return B.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+L+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+N+");"),t.exportVar!==null&&B.push(" } else {"," root."+t.exportVar+" = factory();"),B.push(" }","})(this, function("+S+") {",' "use strict";',"",m,"",r("return "+g()+";"),"});"),B}}[t.format]();return new ts(null,null,t.grammarSource,D.map(C=>C instanceof ts?C:C+` `))}e.code=w(h())}q3.exports=SM});var z3=he((pW,K3)=>{"use strict";var IM=Vu(),BM=es();function PM(e,t,r){function n(s){return s.type==="rule"&&s.expression.type==="rule_ref"}function i(s,u,c){BM.build({rule_ref(d){d.name===u&&(d.name=c,r.info(`Proxy rule "${u}" replaced by the rule "${c}"`,d.location,[{message:"This rule will be used",location:IM.findRule(s,c).nameLocation}]))}})(s)}let a=[];e.rules.forEach((s,u)=>{n(s)&&(i(e,s.name,s.expression.name),t.allowedStartRules.indexOf(s.name)===-1&&a.push(u))}),a.reverse(),a.forEach(s=>{e.rules.splice(s,1)})}K3.exports=PM});var Y3=he((gW,G3)=>{"use strict";var $M=es();function xM(e,t,r){function n(s){let u={};return Object.keys(s).forEach(c=>{u[c]=s[c]}),u}function i(s,u){a(s.expression,n(u))}let a=$M.build({rule(s){a(s.expression,{})},choice(s,u){s.alternatives.forEach(c=>{a(c,n(u))})},action:i,labeled(s,u){let c=s.label;c&&Object.prototype.hasOwnProperty.call(u,c)&&r.error(`Label "${s.label}" is already defined`,s.labelLocation,[{message:"Original label location",location:u[c]}]),a(s.expression,u),u[s.label]=s.labelLocation},text:i,simple_and:i,simple_not:i,optional:i,zero_or_more:i,one_or_more:i,group:i});a(e)}G3.exports=xM});var X3=he((mW,W3)=>{"use strict";var RM=es();function TM(e,t,r){let n={};RM.build({rule(a){if(Object.prototype.hasOwnProperty.call(n,a.name)){r.error(`Rule "${a.name}" is already defined`,a.nameLocation,[{message:"Original rule location",location:n[a.name]}]);return}n[a.name]=a.nameLocation}})(e)}W3.exports=TM});var Q3=he((vW,J3)=>{"use strict";var Z3=Vu(),OM=es();function kM(e,t,r){let n=[],i=[],a=OM.build({rule(s){n.push(s.name),a(s.expression),n.pop()},sequence(s){s.elements.every(u=>(a(u),!Z3.alwaysConsumesOnSuccess(e,u)))},rule_ref(s){i.push(s);let u=Z3.findRule(e,s.name);if(n.indexOf(s.name)!==-1){n.push(s.name),r.error("Possible infinite loop when parsing (left recursion: "+n.join(" -> ")+")",u.nameLocation,i.map((c,f,d)=>({message:f+1!==d.length?`Step ${f+1}: call of the rule "${c.name}" without input consumption`:`Step ${f+1}: call itself without input consumption - left recursion`,location:c.location})));return}u&&a(u),i.pop()}});a(e)}J3.exports=kM});var rD=he((wW,tD)=>{"use strict";var eD=Vu(),NM=es();function LM(e,t,r){NM.build({zero_or_more(i){eD.alwaysConsumesOnSuccess(e,i.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",i.location)},one_or_more(i){eD.alwaysConsumesOnSuccess(e,i.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",i.location)}})(e)}tD.exports=LM});var iD=he((AW,nD)=>{"use strict";var UM=Vu(),jM=es();function HM(e,t,r){jM.build({rule_ref(i){UM.findRule(e,i.name)||r.error(`Rule "${i.name}" is not defined`,i.location)}})(e)}nD.exports=HM});var aD=he((EW,sD)=>{"use strict";var MM=es();function qM(e,t,r){let n=MM.build({action(i){n(i.expression,i)},labeled(i,a){i.pick&&a&&r.error('"@" cannot be used with an action block',i.labelLocation,[{message:"Action block location",location:a.codeLocation}]),n(i.expression)}});n(e)}sD.exports=qM});var oD=he((bW,uD)=>{"use strict";var VM=np(),f2=class{constructor(t){t=typeof t<"u"?t:{},typeof t.error=="function"&&(this.error=t.error),typeof t.warning=="function"&&(this.warning=t.warning),typeof t.info=="function"&&(this.info=t.info)}error(){}warning(){}info(){}},h2=class{constructor(t){this._callbacks=new f2(t),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}error(...t){++this.errors,this._firstError===null&&(this._firstError=new VM(...t),this._firstError.stage=this.stage,this._firstError.problems=this.problems),this.problems.push(["error",...t]),this._callbacks.error(this.stage,...t)}warning(...t){this.problems.push(["warning",...t]),this._callbacks.warning(this.stage,...t)}info(...t){this.problems.push(["info",...t]),this._callbacks.info(this.stage,...t)}checkErrors(){if(this.errors!==0)throw this._firstError}};uD.exports=h2});var cD=he((exports,module)=>{"use strict";var generateBytecode=g3(),generateJS=V3(),inferenceMatchResult=Zv(),removeProxyRules=z3(),reportDuplicateLabels=Y3(),reportDuplicateRules=X3(),reportInfiniteRecursion=Q3(),reportInfiniteRepetition=rD(),reportUndefinedRules=iD(),reportIncorrectPlucking=aD(),Session=oD(),visitor=es();function processOptions(e,t){let r={};return Object.keys(e).forEach(n=>{r[n]=e[n]}),Object.keys(t).forEach(n=>{Object.prototype.hasOwnProperty.call(r,n)||(r[n]=t[n])}),r}var compiler={visitor,passes:{check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRecursion,reportInfiniteRepetition,reportIncorrectPlucking],transform:[removeProxyRules,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile(ast,passes,options){if(options=options!==void 0?options:{},options=processOptions(options,{allowedStartRules:[ast.rules[0].name],cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");if(options.allowedStartRules.length===0)throw new Error("Must have at least one start rule");let allRules=ast.rules.map(e=>e.name);for(let e of options.allowedStartRules)if(allRules.indexOf(e)===-1)throw new Error(`Unknown start rule "${e}"`);let session=new Session(options);switch(Object.keys(passes).forEach(e=>{session.stage=e,session.info(`Process stage ${e}`),passes[e].forEach(t=>{session.info(`Process pass ${e}.${t.name}`),t(ast,options,session)}),session.checkErrors()}),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;default:throw new Error("Invalid output format: "+options.output+".")}}};module.exports=compiler});var fD=he((yW,lD)=>{"use strict";var KM={$:"text","&":"simple_and","!":"simple_not"},zM={"?":"optional","*":"zero_or_more","+":"one_or_more"},GM={"&":"semantic_and","!":"semantic_not"};function YM(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function Gu(e,t,r,n){var i=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(i,Gu.prototype),i.expected=t,i.found=r,i.location=n,i.name="SyntaxError",i}YM(Gu,Error);function d2(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,r+=r.repeat(t),e+r.slice(0,t))}Gu.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var r=null,n;for(n=0;n `+a+` `+u+` | `+i.line+" | "+c+` `+u+" | "+d2("",i.column-1," ")+d2("",d,"^")}else t+=` at `+a}return t};Gu.buildMessage=function(e,t){var r={literal:function(f){return'"'+i(f.text)+'"'},class:function(f){var d=f.parts.map(function(v){return Array.isArray(v)?a(v[0])+"-"+a(v[1]):a(v)});return"["+(f.inverted?"^":"")+d.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(f){return f.description}};function n(f){return f.charCodeAt(0).toString(16).toUpperCase()}function i(f){return f.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"+n(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+n(d)})}function a(f){return f.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"+n(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+n(d)})}function s(f){return r[f.type](f)}function u(f){var d=f.map(s),v,p;if(d.sort(),d.length>0){for(v=1,p=1;v0?{type:"choice",alternatives:[_].concat(j),location:lr()}:_},Hi=function(_,j){return j!==null?{type:"action",expression:_,code:j[0],codeLocation:j[1],location:lr()}:_},no=function(_,j){return j.length>0||_.type==="labeled"&&_.pick?{type:"sequence",elements:[_].concat(j),location:lr()}:_},hp=function(_,j,X){return X.type.startsWith("semantic_")&&Pl('"@" cannot be used on a semantic predicate',_),{type:"labeled",label:j!==null?j[0]:null,labelLocation:j!==null?j[1]:_,pick:!0,expression:X,location:lr()}},dp=function(_,j){return{type:"labeled",label:_[0],labelLocation:_[1],expression:j,location:lr()}},Jt=function(){return lr()},Gt=function(_){return cc.indexOf(_[0])>=0&&Pl(`Label can't be a reserved word "${_[0]}"`,_[1]),_},pp=function(_,j){return{type:KM[_],expression:j,location:lr()}},gp=function(_,j){return{type:zM[j],expression:_,location:lr()}},mp=function(_){return _.type==="labeled"||_.type==="sequence"?{type:"group",expression:_,location:lr()}:_},vp=function(_){return{type:"rule_ref",name:_[0],location:lr()}},wp=function(_,j){return{type:GM[_],code:j[0],codeLocation:j[1],location:lr()}},Ap=function(_,j){return[_+j.join(""),lr()]},mh=function(_,j){return{type:"literal",value:_,ignoreCase:j!==null,location:lr()}},Ep=function(_){return _.join("")},$r=function(_){return _.join("")},Sl=function(_,j,X){return{type:"class",parts:j.filter(z=>z!==""),inverted:_!==null,ignoreCase:X!==null,location:lr()}},ma=function(_,j){return _.charCodeAt(0)>j.charCodeAt(0)&&Pl("Invalid character range: "+Bl()+"."),[_,j]},vh=function(){return""},Il=function(){return"\0"},ti=function(){return"\b"},wh=function(){return"\f"},Ah=function(){return` `},Eh=function(){return"\r"},bh=function(){return" "},yh=function(){return"\v"},_h=function(_){return String.fromCharCode(parseInt(_,16))},Ln=function(_){return String.fromCharCode(parseInt(_,16))},bp=function(){return{type:"any",location:lr()}},ri=function(_){return[_,lr()]},P=0,it=0,yi=[{line:1,column:1}],Un=0,io=[],ee=0,_i;if("startRule"in t){if(!(t.startRule in i))throw new Error(`Can't start parsing from rule "`+t.startRule+'".');a=i[t.startRule]}function Bl(){return e.substring(it,P)}function D2(){return it}function Ch(){return{source:n,start:it,end:P}}function lr(){return va(it,P)}function F2(_,j){throw j=j!==void 0?j:va(it,P),Fh([Mi(_)],e.substring(it,P),j)}function Pl(_,j){throw j=j!==void 0?j:va(it,P),Dh(_,j)}function Ve(_,j){return{type:"literal",text:_,ignoreCase:j}}function xr(_,j,X){return{type:"class",parts:_,inverted:j,ignoreCase:X}}function vu(){return{type:"any"}}function yp(){return{type:"end"}}function Mi(_){return{type:"other",description:_}}function $l(_){var j=yi[_],X;if(j)return j;for(X=_-1;!yi[X];)X--;for(j=yi[X],j={line:j.line,column:j.column};X<_;)e.charCodeAt(X)===10?(j.line++,j.column=1):j.column++,X++;return yi[_]=j,j}function va(_,j){var X=$l(_),z=$l(j);return{source:n,start:{offset:_,line:X.line,column:X.column},end:{offset:j,line:z.line,column:z.column}}}function me(_){PUn&&(Un=P,io=[]),io.push(_))}function Dh(_,j){return new Gu(_,null,null,j)}function Fh(_,j,X){return new Gu(Gu.buildMessage(_,j),_,j,X)}function Zo(){var _,j,X,z,ae,ce,zt,Er;if(_=P,j=Tt(),X=P,z=xl(),z!==r?(ae=Tt(),X=z):(P=X,X=r),X===r&&(X=null),z=P,ae=_p(),ae!==r?(ce=Tt(),z=ae):(P=z,z=r),z===r&&(z=null),ae=[],ce=P,zt=Rl(),zt!==r?(Er=Tt(),ce=zt):(P=ce,ce=r),ce!==r)for(;ce!==r;)ae.push(ce),ce=P,zt=Rl(),zt!==r?(Er=Tt(),ce=zt):(P=ce,ce=r);else ae=r;return ae!==r?(it=_,_=bi(X,z,ae)):(P=_,_=r),_}function xl(){var _,j,X,z,ae;return _=P,e.charCodeAt(P)===123?(j=s,P++):(j=r,ee===0&&me(Vr)),j!==r?(X=Bt(),X!==r?(e.charCodeAt(P)===125?(z=u,P++):(z=r,ee===0&&me(rs)),z!==r?(ae=ba(),ae!==r?(it=_,_=gu(X)):(P=_,_=r)):(P=_,_=r)):(P=_,_=r)):(P=_,_=r),_}function _p(){var _,j,X;return _=P,j=Bt(),j!==r?(X=ba(),X!==r?(it=_,_=Nn(j)):(P=_,_=r)):(P=_,_=r),_}function Rl(){var _,j,X,z,ae,ce,zt,Er;return _=P,j=ec(),j!==r?(X=Tt(),z=P,ae=qi(),ae!==r?(ce=Tt(),z=ae):(P=z,z=r),z===r&&(z=null),e.charCodeAt(P)===61?(ae=c,P++):(ae=r,ee===0&&me(lu)),ae!==r?(ce=Tt(),zt=An(),zt!==r?(Er=ba(),Er!==r?(it=_,_=cn(j,z,zt)):(P=_,_=r)):(P=_,_=r)):(P=_,_=r)):(P=_,_=r),_}function An(){var _,j,X,z,ae,ce,zt,Er;if(_=P,j=so(),j!==r){for(X=[],z=P,ae=Tt(),e.charCodeAt(P)===47?(ce=f,P++):(ce=r,ee===0&&me(Cs)),ce!==r?(zt=Tt(),Er=so(),Er!==r?z=Er:(P=z,z=r)):(P=z,z=r);z!==r;)X.push(z),z=P,ae=Tt(),e.charCodeAt(P)===47?(ce=f,P++):(ce=r,ee===0&&me(Cs)),ce!==r?(zt=Tt(),Er=so(),Er!==r?z=Er:(P=z,z=r)):(P=z,z=r);it=_,_=mu(j,X)}else P=_,_=r;return _}function so(){var _,j,X,z,ae;return _=P,j=ao(),j!==r?(X=P,z=Tt(),ae=Bt(),ae!==r?X=ae:(P=X,X=r),X===r&&(X=null),it=_,_=Hi(j,X)):(P=_,_=r),_}function ao(){var _,j,X,z,ae,ce;if(_=P,j=Jo(),j!==r){for(X=[],z=P,ae=Tt(),ce=Jo(),ce!==r?z=ce:(P=z,z=r);z!==r;)X.push(z),z=P,ae=Tt(),ce=Jo(),ce!==r?z=ce:(P=z,z=r);it=_,_=no(j,X)}else P=_,_=r;return _}function Jo(){var _,j,X,z;return _=P,j=Sh(),j!==r?(X=Ih(),X===r&&(X=null),z=Tl(),z!==r?(it=_,_=hp(j,X,z)):(P=_,_=r)):(P=_,_=r),_===r&&(_=P,j=Ih(),j!==r?(X=Tt(),z=Tl(),z!==r?(it=_,_=dp(j,z)):(P=_,_=r)):(P=_,_=r),_===r&&(_=Tl())),_}function Sh(){var _,j;return _=P,e.charCodeAt(P)===64?(j=d,P++):(j=r,ee===0&&me(fu)),j!==r&&(it=_,j=Jt()),_=j,_}function Ih(){var _,j,X,z;return _=P,j=ec(),j!==r?(X=Tt(),e.charCodeAt(P)===58?(z=v,P++):(z=r,ee===0&&me(Ds)),z!==r?(it=_,_=Gt(j)):(P=_,_=r)):(P=_,_=r),_}function Tl(){var _,j,X,z;return _=P,j=Cp(),j!==r?(X=Tt(),z=Bh(),z!==r?(it=_,_=pp(j,z)):(P=_,_=r)):(P=_,_=r),_===r&&(_=Bh()),_}function Cp(){var _;return e.charCodeAt(P)===36?(_=p,P++):(_=r,ee===0&&me(ns)),_===r&&(e.charCodeAt(P)===38?(_=h,P++):(_=r,ee===0&&me(xt)),_===r&&(e.charCodeAt(P)===33?(_=w,P++):(_=r,ee===0&&me(Zn)))),_}function Bh(){var _,j,X,z;return _=P,j=wa(),j!==r?(X=Tt(),z=Dp(),z!==r?(it=_,_=gp(j,z)):(P=_,_=r)):(P=_,_=r),_===r&&(_=wa()),_}function Dp(){var _;return e.charCodeAt(P)===63?(_=m,P++):(_=r,ee===0&&me(hu)),_===r&&(e.charCodeAt(P)===42?(_=y,P++):(_=r,ee===0&&me(du)),_===r&&(e.charCodeAt(P)===43?(_=g,P++):(_=r,ee===0&&me(pu)))),_}function wa(){var _,j,X,z,ae,ce;return _=$p(),_===r&&(_=oe(),_===r&&(_=nc(),_===r&&(_=Fp(),_===r&&(_=Sp(),_===r&&(_=P,e.charCodeAt(P)===40?(j=b,P++):(j=r,ee===0&&me(Fs)),j!==r?(X=Tt(),z=An(),z!==r?(ae=Tt(),e.charCodeAt(P)===41?(ce=D,P++):(ce=r,ee===0&&me(Yu)),ce!==r?(it=_,_=mp(z)):(P=_,_=r)):(P=_,_=r)):(P=_,_=r)))))),_}function Fp(){var _,j,X,z,ae,ce,zt,Er;return _=P,j=ec(),j!==r?(X=P,ee++,z=P,ae=Tt(),ce=P,zt=qi(),zt!==r?(Er=Tt(),zt=[zt,Er],ce=zt):(P=ce,ce=r),ce===r&&(ce=null),e.charCodeAt(P)===61?(zt=c,P++):(zt=r,ee===0&&me(lu)),zt!==r?(ae=[ae,ce,zt],z=ae):(P=z,z=r),ee--,z===r?X=void 0:(P=X,X=r),X!==r?(it=_,_=vp(j)):(P=_,_=r)):(P=_,_=r),_}function Sp(){var _,j,X,z;return _=P,j=Ol(),j!==r?(X=Tt(),z=Bt(),z!==r?(it=_,_=wp(j,z)):(P=_,_=r)):(P=_,_=r),_}function Ol(){var _;return e.charCodeAt(P)===38?(_=h,P++):(_=r,ee===0&&me(xt)),_===r&&(e.charCodeAt(P)===33?(_=w,P++):(_=r,ee===0&&me(Zn))),_}function ln(){var _;return e.length>P?(_=e.charAt(P),P++):(_=r,ee===0&&me(Ss)),_}function Ci(){var _,j;return ee++,e.charCodeAt(P)===9?(_=C,P++):(_=r,ee===0&&me(ga)),_===r&&(e.charCodeAt(P)===11?(_=F,P++):(_=r,ee===0&&me(te)),_===r&&(e.charCodeAt(P)===12?(_=L,P++):(_=r,ee===0&&me(le)),_===r&&(e.charCodeAt(P)===32?(_=N,P++):(_=r,ee===0&&me(ke)),_===r&&(e.charCodeAt(P)===160?(_=S,P++):(_=r,ee===0&&me(Te)),_===r&&(e.charCodeAt(P)===65279?(_=B,P++):(_=r,ee===0&&me(Me)),_===r&&(_=kh())))))),ee--,_===r&&(j=r,ee===0&&me(Wu)),_}function Di(){var _;return pt.test(e.charAt(P))?(_=e.charAt(P),P++):(_=r,ee===0&&me(nt)),_}function Qo(){var _,j;return ee++,e.charCodeAt(P)===10?(_=O,P++):(_=r,ee===0&&me(Dr)),_===r&&(e.substr(P,2)===x?(_=x,P+=2):(_=r,ee===0&&me(Nt)),_===r&&(e.charCodeAt(P)===13?(_=U,P++):(_=r,ee===0&&me(Jn)),_===r&&(e.charCodeAt(P)===8232?(_=G,P++):(_=r,ee===0&&me(ji)),_===r&&(e.charCodeAt(P)===8233?(_=H,P++):(_=r,ee===0&&me(sn)))))),ee--,_===r&&(j=r,ee===0&&me(ct)),_}function Ph(){var _,j;return ee++,_=Ip(),_===r&&(_=ni()),ee--,_===r&&(j=r,ee===0&&me(wn)),_}function Ip(){var _,j,X,z,ae,ce;if(_=P,e.substr(P,2)===K?(j=K,P+=2):(j=r,ee===0&&me(vr)),j!==r){for(X=[],z=P,ae=P,ee++,e.substr(P,2)===Y?(ce=Y,P+=2):(ce=r,ee===0&&me(an)),ee--,ce===r?ae=void 0:(P=ae,ae=r),ae!==r?(ce=ln(),ce!==r?(ae=[ae,ce],z=ae):(P=z,z=r)):(P=z,z=r);z!==r;)X.push(z),z=P,ae=P,ee++,e.substr(P,2)===Y?(ce=Y,P+=2):(ce=r,ee===0&&me(an)),ee--,ce===r?ae=void 0:(P=ae,ae=r),ae!==r?(ce=ln(),ce!==r?(ae=[ae,ce],z=ae):(P=z,z=r)):(P=z,z=r);e.substr(P,2)===Y?(z=Y,P+=2):(z=r,ee===0&&me(an)),z!==r?(j=[j,X,z],_=j):(P=_,_=r)}else P=_,_=r;return _}function Aa(){var _,j,X,z,ae,ce;if(_=P,e.substr(P,2)===K?(j=K,P+=2):(j=r,ee===0&&me(vr)),j!==r){for(X=[],z=P,ae=P,ee++,e.substr(P,2)===Y?(ce=Y,P+=2):(ce=r,ee===0&&me(an)),ce===r&&(ce=Di()),ee--,ce===r?ae=void 0:(P=ae,ae=r),ae!==r?(ce=ln(),ce!==r?(ae=[ae,ce],z=ae):(P=z,z=r)):(P=z,z=r);z!==r;)X.push(z),z=P,ae=P,ee++,e.substr(P,2)===Y?(ce=Y,P+=2):(ce=r,ee===0&&me(an)),ce===r&&(ce=Di()),ee--,ce===r?ae=void 0:(P=ae,ae=r),ae!==r?(ce=ln(),ce!==r?(ae=[ae,ce],z=ae):(P=z,z=r)):(P=z,z=r);e.substr(P,2)===Y?(z=Y,P+=2):(z=r,ee===0&&me(an)),z!==r?(j=[j,X,z],_=j):(P=_,_=r)}else P=_,_=r;return _}function ni(){var _,j,X,z,ae,ce;if(_=P,e.substr(P,2)===ne?(j=ne,P+=2):(j=r,ee===0&&me(Nr)),j!==r){for(X=[],z=P,ae=P,ee++,ce=Di(),ee--,ce===r?ae=void 0:(P=ae,ae=r),ae!==r?(ce=ln(),ce!==r?(ae=[ae,ce],z=ae):(P=z,z=r)):(P=z,z=r);z!==r;)X.push(z),z=P,ae=P,ee++,ce=Di(),ee--,ce===r?ae=void 0:(P=ae,ae=r),ae!==r?(ce=ln(),ce!==r?(ae=[ae,ce],z=ae):(P=z,z=r)):(P=z,z=r);j=[j,X],_=j}else P=_,_=r;return _}function ec(){var _,j,X,z;if(ee++,_=P,j=$h(),j!==r){for(X=[],z=xh();z!==r;)X.push(z),z=xh();it=_,_=Ap(j,X)}else P=_,_=r;return ee--,_===r&&(j=r,ee===0&&me(Xu)),_}function $h(){var _,j,X;return _=Bp(),_===r&&(e.charCodeAt(P)===36?(_=p,P++):(_=r,ee===0&&me(ns)),_===r&&(e.charCodeAt(P)===95?(_=Ce,P++):(_=r,ee===0&&me(Is)),_===r&&(_=P,e.charCodeAt(P)===92?(j=Fe,P++):(j=r,ee===0&&me(Rn)),j!==r?(X=Rh(),X!==r?_=X:(P=_,_=r)):(P=_,_=r)))),_}function xh(){var _;return _=$h(),_===r&&(_=Pp(),_===r&&(_=Th(),_===r&&(_=Oh(),_===r&&(e.charCodeAt(P)===8204?(_=xe,P++):(_=r,ee===0&&me(Pt)),_===r&&(e.charCodeAt(P)===8205?(_=et,P++):(_=r,ee===0&&me(wr))))))),_}function Bp(){var _;return _=ac(),_===r&&(_=sc(),_===r&&(_=kp(),_===r&&(_=Tp(),_===r&&(_=Op(),_===r&&(_=oc()))))),_}function Pp(){var _;return _=uc(),_===r&&(_=Ps()),_}function $p(){var _,j,X;return ee++,_=P,j=qi(),j!==r?(e.charCodeAt(P)===105?(X=Qe,P++):(X=r,ee===0&&me(ir)),X===r&&(X=null),it=_,_=mh(j,X)):(P=_,_=r),ee--,_===r&&(j=r,ee===0&&me(Xe)),_}function qi(){var _,j,X,z;if(ee++,_=P,e.charCodeAt(P)===34?(j=ut,P++):(j=r,ee===0&&me(sr)),j!==r){for(X=[],z=re();z!==r;)X.push(z),z=re();e.charCodeAt(P)===34?(z=ut,P++):(z=r,ee===0&&me(sr)),z!==r?(it=_,_=Ep(X)):(P=_,_=r)}else P=_,_=r;if(_===r)if(_=P,e.charCodeAt(P)===39?(j=ot,P++):(j=r,ee===0&&me(Lt)),j!==r){for(X=[],z=fe();z!==r;)X.push(z),z=fe();e.charCodeAt(P)===39?(z=ot,P++):(z=r,ee===0&&me(Lt)),z!==r?(it=_,_=$r(X)):(P=_,_=r)}else P=_,_=r;return ee--,_===r&&(j=r,ee===0&&me(Kr)),_}function re(){var _,j,X,z;return _=P,j=P,X=P,ee++,e.charCodeAt(P)===34?(z=ut,P++):(z=r,ee===0&&me(sr)),z===r&&(e.charCodeAt(P)===92?(z=Fe,P++):(z=r,ee===0&&me(Rn)),z===r&&(z=Di())),ee--,z===r?X=void 0:(P=X,X=r),X!==r?(z=ln(),z!==r?(X=[X,z],j=X):(P=j,j=r)):(P=j,j=r),j!==r?_=e.substring(_,P):_=j,_===r&&(_=P,e.charCodeAt(P)===92?(j=Fe,P++):(j=r,ee===0&&me(Rn)),j!==r?(X=fr(),X!==r?_=X:(P=_,_=r)):(P=_,_=r),_===r&&(_=Ct())),_}function fe(){var _,j,X,z;return _=P,j=P,X=P,ee++,e.charCodeAt(P)===39?(z=ot,P++):(z=r,ee===0&&me(Lt)),z===r&&(e.charCodeAt(P)===92?(z=Fe,P++):(z=r,ee===0&&me(Rn)),z===r&&(z=Di())),ee--,z===r?X=void 0:(P=X,X=r),X!==r?(z=ln(),z!==r?(X=[X,z],j=X):(P=j,j=r)):(P=j,j=r),j!==r?_=e.substring(_,P):_=j,_===r&&(_=P,e.charCodeAt(P)===92?(j=Fe,P++):(j=r,ee===0&&me(Rn)),j!==r?(X=fr(),X!==r?_=X:(P=_,_=r)):(P=_,_=r),_===r&&(_=Ct())),_}function oe(){var _,j,X,z,ae,ce;if(ee++,_=P,e.charCodeAt(P)===91?(j=Qr,P++):(j=r,ee===0&&me(Qn)),j!==r){for(e.charCodeAt(P)===94?(X=er,P++):(X=r,ee===0&&me(ei)),X===r&&(X=null),z=[],ae=Oe(),ae===r&&(ae=Ze());ae!==r;)z.push(ae),ae=Oe(),ae===r&&(ae=Ze());e.charCodeAt(P)===93?(ae=Et,P++):(ae=r,ee===0&&me(On)),ae!==r?(e.charCodeAt(P)===105?(ce=Qe,P++):(ce=r,ee===0&&me(ir)),ce===r&&(ce=null),it=_,_=Sl(X,z,ce)):(P=_,_=r)}else P=_,_=r;return ee--,_===r&&(j=r,ee===0&&me(Tn)),_}function Oe(){var _,j,X,z;return _=P,j=Ze(),j!==r?(e.charCodeAt(P)===45?(X=gr,P++):(X=r,ee===0&&me(Pr)),X!==r?(z=Ze(),z!==r?(it=_,_=ma(j,z)):(P=_,_=r)):(P=_,_=r)):(P=_,_=r),_}function Ze(){var _,j,X,z;return _=P,j=P,X=P,ee++,e.charCodeAt(P)===93?(z=Et,P++):(z=r,ee===0&&me(On)),z===r&&(e.charCodeAt(P)===92?(z=Fe,P++):(z=r,ee===0&&me(Rn)),z===r&&(z=Di())),ee--,z===r?X=void 0:(P=X,X=r),X!==r?(z=ln(),z!==r?(X=[X,z],j=X):(P=j,j=r)):(P=j,j=r),j!==r?_=e.substring(_,P):_=j,_===r&&(_=P,e.charCodeAt(P)===92?(j=Fe,P++):(j=r,ee===0&&me(Rn)),j!==r?(X=fr(),X!==r?_=X:(P=_,_=r)):(P=_,_=r),_===r&&(_=Ct())),_}function Ct(){var _,j,X;return _=P,e.charCodeAt(P)===92?(j=Fe,P++):(j=r,ee===0&&me(Rn)),j!==r?(X=Qo(),X!==r?(it=_,_=vh()):(P=_,_=r)):(P=_,_=r),_}function fr(){var _,j,X,z;return _=Kt(),_===r&&(_=P,e.charCodeAt(P)===48?(j=rr,P++):(j=r,ee===0&&me(or)),j!==r?(X=P,ee++,z=Ea(),ee--,z===r?X=void 0:(P=X,X=r),X!==r?(it=_,_=Il()):(P=_,_=r)):(P=_,_=r),_===r&&(_=rc(),_===r&&(_=Rh()))),_}function Kt(){var _;return _=tc(),_===r&&(_=xp()),_}function tc(){var _,j;return e.charCodeAt(P)===39?(_=ot,P++):(_=r,ee===0&&me(Lt)),_===r&&(e.charCodeAt(P)===34?(_=ut,P++):(_=r,ee===0&&me(sr)),_===r&&(e.charCodeAt(P)===92?(_=Fe,P++):(_=r,ee===0&&me(Rn)),_===r&&(_=P,e.charCodeAt(P)===98?(j=lt,P++):(j=r,ee===0&&me(Fl)),j!==r&&(it=_,j=ti()),_=j,_===r&&(_=P,e.charCodeAt(P)===102?(j=Mt,P++):(j=r,ee===0&&me(Zu)),j!==r&&(it=_,j=wh()),_=j,_===r&&(_=P,e.charCodeAt(P)===110?(j=tt,P++):(j=r,ee===0&&me(zr)),j!==r&&(it=_,j=Ah()),_=j,_===r&&(_=P,e.charCodeAt(P)===114?(j=qe,P++):(j=r,ee===0&&me(Ju)),j!==r&&(it=_,j=Eh()),_=j,_===r&&(_=P,e.charCodeAt(P)===116?(j=nr,P++):(j=r,ee===0&&me(Yo)),j!==r&&(it=_,j=bh()),_=j,_===r&&(_=P,e.charCodeAt(P)===118?(j=Ue,P++):(j=r,ee===0&&me(Wo)),j!==r&&(it=_,j=yh()),_=j)))))))),_}function xp(){var _,j,X,z;return _=P,j=P,X=P,ee++,z=ii(),z===r&&(z=Di()),ee--,z===r?X=void 0:(P=X,X=r),X!==r?(z=ln(),z!==r?(X=[X,z],j=X):(P=j,j=r)):(P=j,j=r),j!==r?_=e.substring(_,P):_=j,_}function ii(){var _;return _=tc(),_===r&&(_=Ea(),_===r&&(e.charCodeAt(P)===120?(_=$t,P++):(_=r,ee===0&&me(Qu)),_===r&&(e.charCodeAt(P)===117?(_=en,P++):(_=r,ee===0&&me(Bs))))),_}function rc(){var _,j,X,z,ae,ce;return _=P,e.charCodeAt(P)===120?(j=$t,P++):(j=r,ee===0&&me(Qu)),j!==r?(X=P,z=P,ae=is(),ae!==r?(ce=is(),ce!==r?(ae=[ae,ce],z=ae):(P=z,z=r)):(P=z,z=r),z!==r?X=e.substring(X,P):X=z,X!==r?(it=_,_=_h(X)):(P=_,_=r)):(P=_,_=r),_}function Rh(){var _,j,X,z,ae,ce,zt,Er;return _=P,e.charCodeAt(P)===117?(j=en,P++):(j=r,ee===0&&me(Bs)),j!==r?(X=P,z=P,ae=is(),ae!==r?(ce=is(),ce!==r?(zt=is(),zt!==r?(Er=is(),Er!==r?(ae=[ae,ce,zt,Er],z=ae):(P=z,z=r)):(P=z,z=r)):(P=z,z=r)):(P=z,z=r),z!==r?X=e.substring(X,P):X=z,X!==r?(it=_,_=Ln(X)):(P=_,_=r)):(P=_,_=r),_}function Ea(){var _;return Br.test(e.charAt(P))?(_=e.charAt(P),P++):(_=r,ee===0&&me(eo)),_}function is(){var _;return Ei.test(e.charAt(P))?(_=e.charAt(P),P++):(_=r,ee===0&&me(Xo)),_}function nc(){var _,j;return _=P,e.charCodeAt(P)===46?(j=Zt,P++):(j=r,ee===0&&me(to)),j!==r&&(it=_,j=bp()),_=j,_}function Bt(){var _,j,X,z;return ee++,_=P,e.charCodeAt(P)===123?(j=s,P++):(j=r,ee===0&&me(Vr)),j!==r?(X=Rp(),e.charCodeAt(P)===125?(z=u,P++):(z=r,ee===0&&me(rs)),z!==r?_=X:(P=_,_=r)):(P=_,_=r),ee--,_===r&&(j=r,ee===0&&me(ro)),_}function Rp(){var _,j;return _=P,j=ic(),it=_,j=ri(j),_=j,_}function ic(){var _,j,X,z,ae,ce;if(_=P,j=[],X=[],z=P,ae=P,ee++,tn.test(e.charAt(P))?(ce=e.charAt(P),P++):(ce=r,ee===0&&me(kn)),ee--,ce===r?ae=void 0:(P=ae,ae=r),ae!==r?(ce=ln(),ce!==r?(ae=[ae,ce],z=ae):(P=z,z=r)):(P=z,z=r),z!==r)for(;z!==r;)X.push(z),z=P,ae=P,ee++,tn.test(e.charAt(P))?(ce=e.charAt(P),P++):(ce=r,ee===0&&me(kn)),ee--,ce===r?ae=void 0:(P=ae,ae=r),ae!==r?(ce=ln(),ce!==r?(ae=[ae,ce],z=ae):(P=z,z=r)):(P=z,z=r);else X=r;for(X===r&&(X=P,e.charCodeAt(P)===123?(z=s,P++):(z=r,ee===0&&me(Vr)),z!==r?(ae=ic(),e.charCodeAt(P)===125?(ce=u,P++):(ce=r,ee===0&&me(rs)),ce!==r?(z=[z,ae,ce],X=z):(P=X,X=r)):(P=X,X=r));X!==r;){if(j.push(X),X=[],z=P,ae=P,ee++,tn.test(e.charAt(P))?(ce=e.charAt(P),P++):(ce=r,ee===0&&me(kn)),ee--,ce===r?ae=void 0:(P=ae,ae=r),ae!==r?(ce=ln(),ce!==r?(ae=[ae,ce],z=ae):(P=z,z=r)):(P=z,z=r),z!==r)for(;z!==r;)X.push(z),z=P,ae=P,ee++,tn.test(e.charAt(P))?(ce=e.charAt(P),P++):(ce=r,ee===0&&me(kn)),ee--,ce===r?ae=void 0:(P=ae,ae=r),ae!==r?(ce=ln(),ce!==r?(ae=[ae,ce],z=ae):(P=z,z=r)):(P=z,z=r);else X=r;X===r&&(X=P,e.charCodeAt(P)===123?(z=s,P++):(z=r,ee===0&&me(Vr)),z!==r?(ae=ic(),e.charCodeAt(P)===125?(ce=u,P++):(ce=r,ee===0&&me(rs)),ce!==r?(z=[z,ae,ce],X=z):(P=X,X=r)):(P=X,X=r))}return _=e.substring(_,P),_}function sc(){var _;return _t.test(e.charAt(P))?(_=e.charAt(P),P++):(_=r,ee===0&&me(R)),_}function Tp(){var _;return Ne.test(e.charAt(P))?(_=e.charAt(P),P++):(_=r,ee===0&&me(k)),_}function Op(){var _;return De.test(e.charAt(P))?(_=e.charAt(P),P++):(_=r,ee===0&&me(V)),_}function kp(){var _;return mr.test(e.charAt(P))?(_=e.charAt(P),P++):(_=r,ee===0&&me(J)),_}function ac(){var _;return rn.test(e.charAt(P))?(_=e.charAt(P),P++):(_=r,ee===0&&me(ve)),_}function Ps(){var _;return rt.test(e.charAt(P))?(_=e.charAt(P),P++):(_=r,ee===0&&me(Ee)),_}function uc(){var _;return pa.test(e.charAt(P))?(_=e.charAt(P),P++):(_=r,ee===0&&me(Ie)),_}function Th(){var _;return nn.test(e.charAt(P))?(_=e.charAt(P),P++):(_=r,ee===0&&me(Re)),_}function oc(){var _;return ge.test(e.charAt(P))?(_=e.charAt(P),P++):(_=r,ee===0&&me(Vt)),_}function Oh(){var _;return _s.test(e.charAt(P))?(_=e.charAt(P),P++):(_=r,ee===0&&me(Ar)),_}function kh(){var _;return It.test(e.charAt(P))?(_=e.charAt(P),P++):(_=r,ee===0&&me(un)),_}function Tt(){var _,j;for(_=[],j=Ci(),j===r&&(j=Qo(),j===r&&(j=Ph()));j!==r;)_.push(j),j=Ci(),j===r&&(j=Qo(),j===r&&(j=Ph()));return _}function Nh(){var _,j;for(_=[],j=Ci(),j===r&&(j=Aa());j!==r;)_.push(j),j=Ci(),j===r&&(j=Aa());return _}function ba(){var _,j,X,z;return _=P,j=Tt(),e.charCodeAt(P)===59?(X=qt,P++):(X=r,ee===0&&me(on)),X!==r?(j=[j,X],_=j):(P=_,_=r),_===r&&(_=P,j=Nh(),X=ni(),X===r&&(X=null),z=Qo(),z!==r?(j=[j,X,z],_=j):(P=_,_=r),_===r&&(_=P,j=Tt(),X=ya(),X!==r?(j=[j,X],_=j):(P=_,_=r))),_}function ya(){var _,j;return _=P,ee++,e.length>P?(j=e.charAt(P),P++):(j=r,ee===0&&me(Ss)),ee--,j===r?_=void 0:(P=_,_=r),_}let cc=t.reservedWords||[];if(_i=a(),_i!==r&&P===e.length)return _i;throw _i!==r&&P{"use strict";var XM=np(),ZM=cD(),JM=fD(),QM=t2(),eq=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await"],ph={VERSION:QM,RESERVED_WORDS:eq,GrammarError:XM,parser:JM,compiler:ZM,generate(e,t){t=t!==void 0?t:{};function r(a){let s={};return Object.keys(a).forEach(u=>{s[u]=a[u].slice()}),s}let n="plugins"in t?t.plugins:[],i={parser:ph.parser,passes:r(ph.compiler.passes),reservedWords:ph.RESERVED_WORDS.slice()};return n.forEach(a=>{a.use(i,t)}),ph.compiler.compile(i.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:i.reservedWords}),i.passes,t)}};hD.exports=ph});var b2=he((A2,E2)=>{(function(e,t){typeof A2=="object"&&typeof E2<"u"?E2.exports=t():typeof define=="function"&&define.amd?define(t):e.JSON5=t()})(A2,function(){"use strict";function e(te,le){return le={exports:{}},te(le,le.exports),le.exports}var t=e(function(te){var le=te.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=le)}),r=e(function(te){var le=te.exports={version:"2.6.5"};typeof __e=="number"&&(__e=le)}),n=r.version,i=function(te){return typeof te=="object"?te!==null:typeof te=="function"},a=function(te){if(!i(te))throw TypeError(te+" is not an object!");return te},s=function(te){try{return!!te()}catch{return!0}},u=!s(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7}),c=t.document,f=i(c)&&i(c.createElement),d=function(te){return f?c.createElement(te):{}},v=!u&&!s(function(){return Object.defineProperty(d("div"),"a",{get:function(){return 7}}).a!=7}),p=function(te,le){if(!i(te))return te;var ke,Te;if(le&&typeof(ke=te.toString)=="function"&&!i(Te=ke.call(te))||typeof(ke=te.valueOf)=="function"&&!i(Te=ke.call(te))||!le&&typeof(ke=te.toString)=="function"&&!i(Te=ke.call(te)))return Te;throw TypeError("Can't convert object to primitive value")},h=Object.defineProperty,w=u?Object.defineProperty:function(le,ke,Te){if(a(le),ke=p(ke,!0),a(Te),v)try{return h(le,ke,Te)}catch{}if("get"in Te||"set"in Te)throw TypeError("Accessors not supported!");return"value"in Te&&(le[ke]=Te.value),le},m={f:w},y=function(te,le){return{enumerable:!(te&1),configurable:!(te&2),writable:!(te&4),value:le}},g=u?function(te,le,ke){return m.f(te,le,y(1,ke))}:function(te,le,ke){return te[le]=ke,te},b={}.hasOwnProperty,D=function(te,le){return b.call(te,le)},C=0,F=Math.random(),L=function(te){return"Symbol(".concat(te===void 0?"":te,")_",(++C+F).toString(36))},N=!1,S=e(function(te){var le="__core-js_shared__",ke=t[le]||(t[le]={});(te.exports=function(Te,Me){return ke[Te]||(ke[Te]=Me!==void 0?Me:{})})("versions",[]).push({version:r.version,mode:N?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),B=S("native-function-to-string",Function.toString),O=e(function(te){var le=L("src"),ke="toString",Te=(""+B).split(ke);r.inspectSource=function(Me){return B.call(Me)},(te.exports=function(Me,nt,ct,Dr){var Nt=typeof ct=="function";Nt&&(D(ct,"name")||g(ct,"name",nt)),Me[nt]!==ct&&(Nt&&(D(ct,le)||g(ct,le,Me[nt]?""+Me[nt]:Te.join(String(nt)))),Me===t?Me[nt]=ct:Dr?Me[nt]?Me[nt]=ct:g(Me,nt,ct):(delete Me[nt],g(Me,nt,ct)))})(Function.prototype,ke,function(){return typeof this=="function"&&this[le]||B.call(this)})}),x=function(te){if(typeof te!="function")throw TypeError(te+" is not a function!");return te},U=function(te,le,ke){if(x(te),le===void 0)return te;switch(ke){case 1:return function(Te){return te.call(le,Te)};case 2:return function(Te,Me){return te.call(le,Te,Me)};case 3:return function(Te,Me,nt){return te.call(le,Te,Me,nt)}}return function(){return te.apply(le,arguments)}},G="prototype",H=function(te,le,ke){var Te=te&H.F,Me=te&H.G,nt=te&H.S,ct=te&H.P,Dr=te&H.B,Nt=Me?t:nt?t[le]||(t[le]={}):(t[le]||{})[G],Jn=Me?r:r[le]||(r[le]={}),ji=Jn[G]||(Jn[G]={}),sn,wn,vr,an;Me&&(ke=le);for(sn in ke)wn=!Te&&Nt&&Nt[sn]!==void 0,vr=(wn?Nt:ke)[sn],an=Dr&&wn?U(vr,t):ct&&typeof vr=="function"?U(Function.call,vr):vr,Nt&&O(Nt,sn,vr,te&H.U),Jn[sn]!=vr&&g(Jn,sn,an),ct&&ji[sn]!=vr&&(ji[sn]=vr)};t.core=r,H.F=1,H.G=2,H.S=4,H.P=8,H.B=16,H.W=32,H.U=64,H.R=128;var K=H,Y=Math.ceil,ne=Math.floor,Ce=function(te){return isNaN(te=+te)?0:(te>0?ne:Y)(te)},Fe=function(te){if(te==null)throw TypeError("Can't call method on "+te);return te},xe=function(te){return function(le,ke){var Te=String(Fe(le)),Me=Ce(ke),nt=Te.length,ct,Dr;return Me<0||Me>=nt?te?"":void 0:(ct=Te.charCodeAt(Me),ct<55296||ct>56319||Me+1===nt||(Dr=Te.charCodeAt(Me+1))<56320||Dr>57343?te?Te.charAt(Me):ct:te?Te.slice(Me,Me+2):(ct-55296<<10)+(Dr-56320)+65536)}},et=xe(!1);K(K.P,"String",{codePointAt:function(le){return et(this,le)}});var Qe=r.String.codePointAt,ut=Math.max,ot=Math.min,Qr=function(te,le){return te=Ce(te),te<0?ut(te+le,0):ot(te,le)},er=String.fromCharCode,Et=String.fromCodePoint;K(K.S+K.F*(!!Et&&Et.length!=1),"String",{fromCodePoint:function(le){for(var ke=arguments,Te=[],Me=arguments.length,nt=0,ct;Me>nt;){if(ct=+ke[nt++],Qr(ct,1114111)!==ct)throw RangeError(ct+" is not a valid code point");Te.push(ct<65536?er(ct):er(((ct-=65536)>>10)+55296,ct%1024+56320))}return Te.join("")}});var gr=r.String.fromCodePoint,rr=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,lt=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,Mt=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,tt={Space_Separator:rr,ID_Start:lt,ID_Continue:Mt},qe={isSpaceSeparator:function(le){return typeof le=="string"&&tt.Space_Separator.test(le)},isIdStartChar:function(le){return typeof le=="string"&&(le>="a"&&le<="z"||le>="A"&&le<="Z"||le==="$"||le==="_"||tt.ID_Start.test(le))},isIdContinueChar:function(le){return typeof le=="string"&&(le>="a"&&le<="z"||le>="A"&&le<="Z"||le>="0"&&le<="9"||le==="$"||le==="_"||le==="\u200C"||le==="\u200D"||tt.ID_Continue.test(le))},isDigit:function(le){return typeof le=="string"&&/[0-9]/.test(le)},isHexDigit:function(le){return typeof le=="string"&&/[0-9A-Fa-f]/.test(le)}},nr,Ue,$t,en,Zt,qt,pt,Br,Ei,tn=function(le,ke){nr=String(le),Ue="start",$t=[],en=0,Zt=1,qt=0,pt=void 0,Br=void 0,Ei=void 0;do pt=pa(),fu[Ue]();while(pt.type!=="eof");return typeof ke=="function"?_t({"":Ei},"",ke):Ei};function _t(te,le,ke){var Te=te[le];if(Te!=null&&typeof Te=="object")if(Array.isArray(Te))for(var Me=0;Me0;){var ke=nn();if(!qe.isHexDigit(ke))throw xt(ge());te+=ge()}return String.fromCodePoint(parseInt(te,16))}var fu={start:function(){if(pt.type==="eof")throw Zn();Ds()},beforePropertyName:function(){switch(pt.type){case"identifier":case"string":Br=pt.value,Ue="afterPropertyName";return;case"punctuator":ns();return;case"eof":throw Zn()}},afterPropertyName:function(){if(pt.type==="eof")throw Zn();Ue="beforePropertyValue"},beforePropertyValue:function(){if(pt.type==="eof")throw Zn();Ds()},beforeArrayValue:function(){if(pt.type==="eof")throw Zn();if(pt.type==="punctuator"&&pt.value==="]"){ns();return}Ds()},afterPropertyValue:function(){if(pt.type==="eof")throw Zn();switch(pt.value){case",":Ue="beforePropertyName";return;case"}":ns()}},afterArrayValue:function(){if(pt.type==="eof")throw Zn();switch(pt.value){case",":Ue="beforeArrayValue";return;case"]":ns()}},end:function(){}};function Ds(){var te;switch(pt.type){case"punctuator":switch(pt.value){case"{":te={};break;case"[":te=[];break}break;case"null":case"boolean":case"numeric":case"string":te=pt.value;break}if(Ei===void 0)Ei=te;else{var le=$t[$t.length-1];Array.isArray(le)?le.push(te):Object.defineProperty(le,Br,{value:te,writable:!0,enumerable:!0,configurable:!0})}if(te!==null&&typeof te=="object")$t.push(te),Array.isArray(te)?Ue="beforeArrayValue":Ue="beforePropertyName";else{var ke=$t[$t.length-1];ke==null?Ue="end":Array.isArray(ke)?Ue="afterArrayValue":Ue="afterPropertyValue"}}function ns(){$t.pop();var te=$t[$t.length-1];te==null?Ue="end":Array.isArray(te)?Ue="afterArrayValue":Ue="afterPropertyValue"}function xt(te){return Fs(te===void 0?"JSON5: invalid end of input at "+Zt+":"+qt:"JSON5: invalid character '"+pu(te)+"' at "+Zt+":"+qt)}function Zn(){return Fs("JSON5: invalid end of input at "+Zt+":"+qt)}function hu(){return qt-=5,Fs("JSON5: invalid identifier character at "+Zt+":"+qt)}function du(te){console.warn("JSON5: '"+pu(te)+"' in strings is not valid ECMAScript; consider escaping")}function pu(te){var le={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(le[te])return le[te];if(te<" "){var ke=te.charCodeAt(0).toString(16);return"\\x"+("00"+ke).substring(ke.length)}return te}function Fs(te){var le=new SyntaxError(te);return le.lineNumber=Zt,le.columnNumber=qt,le}var Yu=function(le,ke,Te){var Me=[],nt="",ct,Dr,Nt="",Jn;if(ke!=null&&typeof ke=="object"&&!Array.isArray(ke)&&(Te=ke.space,Jn=ke.quote,ke=ke.replacer),typeof ke=="function")Dr=ke;else if(Array.isArray(ke)){ct=[];for(var ji=0,sn=ke;ji0&&(Te=Math.min(10,Math.floor(Te)),Nt=" ".substr(0,Te)):typeof Te=="string"&&(Nt=Te.substr(0,10)),an("",{"":le});function an(Pt,wr){var Xe=wr[Pt];switch(Xe!=null&&(typeof Xe.toJSON5=="function"?Xe=Xe.toJSON5(Pt):typeof Xe.toJSON=="function"&&(Xe=Xe.toJSON(Pt))),Dr&&(Xe=Dr.call(wr,Pt,Xe)),Xe instanceof Number?Xe=Number(Xe):Xe instanceof String?Xe=String(Xe):Xe instanceof Boolean&&(Xe=Xe.valueOf()),Xe){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof Xe=="string")return Nr(Xe,!1);if(typeof Xe=="number")return String(Xe);if(typeof Xe=="object")return Array.isArray(Xe)?Rn(Xe):Xu(Xe)}function Nr(Pt){for(var wr={"'":.1,'"':.2},Xe={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},ir="",Kr=0;Kr=0)throw TypeError("Converting circular structure to JSON5");Me.push(Pt);var wr=nt;nt=nt+Nt;for(var Xe=ct||Object.keys(Pt),ir=[],Kr=0,sr=Xe;Kr=0)throw TypeError("Converting circular structure to JSON5");Me.push(Pt);var wr=nt;nt=nt+Nt;for(var Xe=[],ir=0;ir{let t={};return e.forEach((r,n)=>t[r]=n),t})(Wl),PB=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,hn=String.fromCharCode.bind(String),dA=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),vA=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),wA=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),AA=e=>{let t,r,n,i,a="",s=e.length%3;for(let u=0;u255||(n=e.charCodeAt(u++))>255||(i=e.charCodeAt(u++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|i,a+=Wl[t>>18&63]+Wl[t>>12&63]+Wl[t>>6&63]+Wl[t&63]}return s?a.slice(0,s-3)+"===".substring(s):a},$1=typeof btoa=="function"?e=>btoa(e):Ac?e=>Buffer.from(e,"binary").toString("base64"):AA,B1=Ac?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,i=e.length;nt?vA(B1(e)):B1(e),$B=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?hn(192|t>>>6)+hn(128|t&63):hn(224|t>>>12&15)+hn(128|t>>>6&63)+hn(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return hn(240|t>>>18&7)+hn(128|t>>>12&63)+hn(128|t>>>6&63)+hn(128|t&63)}},xB=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,EA=e=>e.replace(xB,$B),pA=Ac?e=>Buffer.from(e,"utf8").toString("base64"):hA?e=>B1(hA.encode(e)):e=>$1(EA(e)),wc=(e,t=!1)=>t?vA(pA(e)):pA(e),gA=e=>wc(e,!0),RB=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,TB=e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return hn((r>>>10)+55296)+hn((r&1023)+56320);case 3:return hn((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return hn((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},bA=e=>e.replace(RB,TB),yA=e=>{if(e=e.replace(/\s+/g,""),!PB.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r="",n,i;for(let a=0;a>16&255):i===64?hn(t>>16&255,t>>8&255):hn(t>>16&255,t>>8&255,t&255);return r},x1=typeof atob=="function"?e=>atob(wA(e)):Ac?e=>Buffer.from(e,"base64").toString("binary"):yA,_A=Ac?e=>dA(Buffer.from(e,"base64")):e=>dA(x1(e).split("").map(t=>t.charCodeAt(0))),CA=e=>_A(DA(e)),OB=Ac?e=>Buffer.from(e,"base64").toString("utf8"):fA?e=>fA.decode(_A(e)):e=>bA(x1(e)),DA=e=>wA(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),P1=e=>OB(DA(e)),kB=e=>{if(typeof e!="string")return!1;let t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},FA=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),SA=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,FA(r));e("fromBase64",function(){return P1(this)}),e("toBase64",function(t){return wc(this,t)}),e("toBase64URI",function(){return wc(this,!0)}),e("toBase64URL",function(){return wc(this,!0)}),e("toUint8Array",function(){return CA(this)})},IA=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,FA(r));e("toBase64",function(t){return l0(this,t)}),e("toBase64URI",function(){return l0(this,!0)}),e("toBase64URL",function(){return l0(this,!0)})},NB=()=>{SA(),IA()},yt={version:mA,VERSION:IB,atob:x1,atobPolyfill:yA,btoa:$1,btoaPolyfill:AA,fromBase64:P1,toBase64:wc,encode:wc,encodeURI:gA,encodeURL:gA,utob:EA,btou:bA,decode:P1,isValid:kB,fromUint8Array:l0,toUint8Array:CA,extendString:SA,extendUint8Array:IA,extendBuiltins:NB};var fp=yn(p0());var ag=yn(wE());function o$(e){let t=ag.default.pemtohex(e);return ag.default.KJUR.crypto.Util.hashHex(t,"sha256").match(/.{2}/g).join(":").toUpperCase()}var AE={generateFingerprint:o$};var lf=yn(fy());function dy(e,t,...r){try{return e(t,...r)}catch{return e(py(e(t.replace(/!\s*/g,"__SubStoreJSYAMLString__"),...r)).replace(/__SubStoreJSYAMLString__/g,""),...r)}}function cf(e,...t){return dy(lf.default.safeLoad,JSON.parse(JSON.stringify(e)),...t)}function UR(e,...t){return dy(lf.default.load,JSON.parse(JSON.stringify(e)),...t)}function hy(e,...t){return lf.default.safeDump(JSON.parse(JSON.stringify(e)),...t)}function py(e,...t){return lf.default.dump(JSON.parse(JSON.stringify(e)),...t)}var Ls={safeLoad:cf,load:UR,safeDump:hy,dump:py,parse:cf,stringify:hy};var Na="settings",Ag="subs",gy="collections",Lc="files",U0="modules";var my="rules";var So="#sub-store-cached-resource",Io="#sub-store-cached-headers-resource",j0="#sub-store-chr-expiration-time";var Bo="#sub-store-cached-script-resource",H0="#sub-store-csr-expiration-time";var Iu=typeof $task<"u",La=typeof $loon<"u",Bu=typeof $httpClient<"u"&&!La,Us=eval('typeof process !== "undefined"'),vy=typeof $environment<"u"&&$environment["stash-version"],wy=typeof $rocket<"u",jR=typeof egern=="object",HR=typeof $native<"u",Pu=typeof $Plugins<"u";function M0(e){return e!==null&&typeof e=="object"&&[null,Object.prototype].includes(Object.getPrototypeOf(e))}function MR(e){let[t,r,n,i,a,s,u]=e.match(/^socks5:\/\/(?:(.*?):(.*?)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/);if(a)a=parseInt(a,10);else throw $.error(`port is not present in line: ${e}`),new Error(`port is not present in line: ${e}`);return{type:5,host:i,port:a,userId:r!=null?decodeURIComponent(r):void 0,password:n!=null?decodeURIComponent(n):void 0}}var q0=class{constructor(name="untitled",debug=!1){if(this.name=name,this.debug=debug,this.http=Ua(),this.env=js(),Us){let dotenv=eval('require("dotenv")');dotenv.config()}this.node=(()=>{if(Us){let fs=eval("require('fs')");return{fs}}else return null})(),this.initCache();let delay=(e,t)=>new Promise(function(r){setTimeout(r.bind(null,t),e)});Promise.prototype.delay=async function(e){let t=await this;return await delay(e,t)}}initCache(){if(Iu&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}")),(La||Bu)&&(this.cache=JSON.parse($persistentStore.read(this.name)||"{}")),Pu&&(this.cache=JSON.parse($Plugins.SubStoreCache.get(this.name)||"{}")),Us){let basePath=eval("process.env.SUB_STORE_DATA_BASE_PATH")||".",rootPath=`${basePath}/root.json`,backupRootPath=`${basePath}/root_${Date.now()}.json`;if(this.log(`Root path: ${rootPath}`),this.node.fs.existsSync(rootPath))try{this.root=JSON.parse(this.node.fs.readFileSync(`${rootPath}`))}catch(e){this.node.fs.copyFileSync(rootPath,backupRootPath),this.error(`Failed to parse ${rootPath}: ${e.message}. Backup created at ${backupRootPath}`)}M0(this.root)||(this.node.fs.writeFileSync(rootPath,JSON.stringify({}),{flag:"w"}),this.root={});let fpath=`${basePath}/${this.name}.json`,backupPath=`${basePath}/${this.name}_${Date.now()}.json`;if(this.log(`Data path: ${fpath}`),this.node.fs.existsSync(fpath))try{if(this.cache=JSON.parse(this.node.fs.readFileSync(`${fpath}`,"utf-8")),!M0(this.cache))throw new Error("Invalid Data")}catch{try{let t=yt.decode(this.node.fs.readFileSync(`${fpath}`,"utf-8"));if(this.cache=JSON.parse(t),this.node.fs.writeFileSync(fpath,t,{flag:"w"}),!M0(this.cache))throw new Error("Invalid Data")}catch(t){this.node.fs.copyFileSync(fpath,backupPath),this.error(`Failed to parse ${fpath}: ${t.message}. Backup created at ${backupPath}`)}}M0(this.cache)||(this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"w"}),this.cache={})}}persistCache(){let data=JSON.stringify(this.cache,null,2);if(Iu&&$prefs.setValueForKey(data,this.name),(La||Bu)&&$persistentStore.write(data,this.name),Pu&&$Plugins.SubStoreCache.set(this.name,data),Us){let basePath=eval("process.env.SUB_STORE_DATA_BASE_PATH")||".";this.node.fs.writeFileSync(`${basePath}/${this.name}.json`,data,{flag:"w"},e=>console.log(e)),this.node.fs.writeFileSync(`${basePath}/root.json`,JSON.stringify(this.root,null,2),{flag:"w"},e=>console.log(e))}}write(e,t){if(this.log(`SET ${t}`),t.indexOf("#")!==-1){if(t=t.substr(1),Bu||La)return $persistentStore.write(e,t);if(Iu)return $prefs.setValueForKey(e,t);if(Us&&(this.root[t]=e),Pu)return $Plugins.SubStoreCache.set(t,e)}else this.cache[t]=e;this.persistCache()}read(e){if(this.log(`READ ${e}`),e.indexOf("#")!==-1){if(e=e.substr(1),Bu||La)return $persistentStore.read(e);if(Iu)return $prefs.valueForKey(e);if(Us)return this.root[e];if(Pu)return $Plugins.SubStoreCache.get(e)}else return this.cache[e]}delete(e){if(this.log(`DELETE ${e}`),e.indexOf("#")!==-1){if(e=e.substr(1),Bu||La)return $persistentStore.write(null,e);if(Iu)return $prefs.removeValueForKey(e);if(Us&&delete this.root[e],Pu)return $Plugins.SubStoreCache.remove(e)}else delete this.cache[e];this.persistCache()}notify(title,subtitle="",content="",options={}){let openURL=options["open-url"],mediaURL=options["media-url"];if(Iu&&$notify(title,subtitle,content,options),Bu&&$notification.post(title,subtitle,content+`${mediaURL?` \u591A\u5A92\u4F53:`+mediaURL:""}`,{url:openURL}),La){let e={};openURL&&(e.openUrl=openURL),mediaURL&&(e.mediaUrl=mediaURL),JSON.stringify(e)==="{}"?$notification.post(title,subtitle,content):$notification.post(title,subtitle,content,e)}if(Us){let content_=content+(openURL?` \u70B9\u51FB\u8DF3\u8F6C: ${openURL}`:"")+(mediaURL?` \u591A\u5A92\u4F53: ${mediaURL}`:"");console.log(`${title} ${subtitle} ${content_} `);let push=eval("process.env.SUB_STORE_PUSH_SERVICE");if(push)if(/^https?:\/\//.test(push)){let e=push.replace("[\u63A8\u9001\u6807\u9898]",encodeURIComponent(title||"Sub-Store")).replace("[\u63A8\u9001\u5185\u5BB9]",encodeURIComponent([subtitle,content_].map(r=>r).join(` `)));Ua().get({url:e}).then(r=>{console.log(`[Push Service] URL: ${e} RES: ${r.statusCode} ${r.body}`)}).catch(r=>{console.log(`[Push Service] URL: ${e} ERROR: ${r}`)})}else{let{execFile}=eval('require("child_process")');execFile("shoutrrr",["send","--url",push,"--message",`${title} ${subtitle} ${content_}`],(e,t,r)=>{if(e){console.log(`[Push Service] URL: ${push} ERROR: ${e}`);return}r&&console.log(`[Push Service] URL: ${push} stderr: ${r}`),console.log(`[Push Service] URL: ${push} stdout: ${t}`)})}}Pu&&$Plugins.Notify(title,subtitle+` `+content)}log(e){this.debug&&console.log(`[${this.name}] LOG: ${e}`)}info(e){console.log(`[${this.name}] INFO: ${e}`)}error(e){console.log(`[${this.name}] ERROR: ${e}`)}wait(e){return new Promise(t=>setTimeout(t,e))}done(e={}){Iu||La||Bu||Pu?$done(e):Us&&typeof $context<"u"&&($context.headers=e.headers,$context.statusCode=e.statusCode,$context.body=e.body)}};function js(){return{isQX:Iu,isLoon:La,isSurge:Bu,isNode:Us,isStash:vy,isShadowRocket:wy,isEgern:jR,isLanceX:HR,isGUIforCores:Pu}}function Ua(defaultOptions={baseURL:""}){let{isQX,isLoon,isSurge,isNode,isGUIforCores}=js(),methods=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],URL_REGEX=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;function send(method,options){options=typeof options=="string"?{url:options}:options;let baseURL=defaultOptions.baseURL;baseURL&&!URL_REGEX.test(options.url||"")&&(options.url=baseURL?baseURL+options.url:options.url),options={...defaultOptions,...options};let timeout=options.timeout,events={onRequest:()=>{},onResponse:e=>e,onTimeout:()=>{},...options.events};if(events.onRequest(method,options),options.node&&isSurge){let e=$environment["surge-build"];e&&parseInt(e)>=2407&&(options["policy-descriptor"]=options.node,delete options.node)}let worker;isQX?worker=$task.fetch({method,url:options.url,headers:options.headers,body:options.body,opts:options.opts}):isLoon||isSurge||isNode?worker=new Promise(async(resolve,reject)=>{let body=options.body,opts=JSON.parse(JSON.stringify(options));if(opts.body=body,opts.timeout=opts.timeout||8e3,opts.timeout&&(opts.timeout++,isNaN(opts.timeout)&&(opts.timeout=8e3),!isNode)){let e="ms";(isSurge||vy||wy)&&(opts.timeout=Math.ceil(opts.timeout/1e3),e="s")}if(isNode){let undici=eval("require('undici')"),{socksDispatcher}=eval("require('fetch-socks')"),{ProxyAgent,EnvHttpProxyAgent,request,interceptors}=undici,agentOpts={connect:{rejectUnauthorized:!(opts.strictSSL===!1||opts.insecure===!0||opts.rejectUnauthorized===!1)},bodyTimeout:opts.timeout,headersTimeout:opts.timeout,maxHeaderSize:eval("process.env.SUB_STORE_MAX_HEADER_SIZE")||32*1024},tlsOptions={rejectUnauthorized:agentOpts.connect.rejectUnauthorized};opts.tls={...opts.tls||{},...tlsOptions};try{let url=new URL(opts.url);(url.username||url.password)&&(opts.headers={...opts.headers||{},Authorization:`Basic ${Buffer.from(`${url.username||""}:${url.password||""}`).toString("base64")}`});let dispatcher;if(!opts.proxy){let allProxy=eval("process.env.all_proxy")||eval("process.env.ALL_PROXY");allProxy&&/^socks5:\/\//.test(allProxy)&&(opts.proxy=allProxy)}opts.proxy?/^socks5:\/\//.test(opts.proxy)?dispatcher=socksDispatcher(MR(opts.proxy),{...agentOpts,requestTls:tlsOptions}):dispatcher=new ProxyAgent({...agentOpts,uri:opts.proxy,requestTls:tlsOptions}):dispatcher=new EnvHttpProxyAgent({...agentOpts,requestTls:tlsOptions});let response=await request(opts.url,{...opts,method:method.toUpperCase(),dispatcher:dispatcher.compose(interceptors.redirect({maxRedirections:3,throwOnMaxRedirects:!0}))});resolve({statusCode:response.statusCode,headers:response.headers,body:opts.encoding===null?await response.body.arrayBuffer():await response.body.text()})}catch(e){reject(e)}}else $httpClient[method.toLowerCase()](opts,(e,t,r)=>{e?reject(e):resolve({statusCode:t.status||t.statusCode,headers:t.headers,body:r})})}):isGUIforCores&&(worker=new Promise(async(e,t)=>{try{let r=await $Plugins.Requests({method,url:options.url,headers:options.headers,body:options.body,autoTransformBody:!1,options:{Proxy:options.proxy,Timeout:options.timeout?options.timeout/1e3:15}});e({statusCode:r.status,headers:r.headers,body:r.body})}catch(r){t(r)}}));let timeoutid,timer=timeout?new Promise((e,t)=>{timeoutid=setTimeout(()=>(events.onTimeout(),t(`${method} URL: ${options.url} exceeds the timeout ${timeout} ms`)),timeout)}):null;return(timer?Promise.race([timer,worker]).then(e=>(typeof clearTimeout<"u"&&clearTimeout(timeoutid),e)):worker).then(e=>events.onResponse(e))}let http={};return methods.forEach(e=>http[e.toLowerCase()]=t=>send(e,t)),http}var Eg=0;function cs(e){return VR(qR(KR(e)))}function qR(e){return GR(YR(zR(e),e.length*8))}function VR(e){try{}catch{Eg=0}for(var t=Eg?"0123456789ABCDEF":"0123456789abcdef",r="",n,i=0;i>>4&15)+t.charAt(n&15);return r}function KR(e){for(var t="",r=-1,n,i;++r>>6&31,128|n&63):n<=65535?t+=String.fromCharCode(224|n>>>12&15,128|n>>>6&63,128|n&63):n<=2097151&&(t+=String.fromCharCode(240|n>>>18&7,128|n>>>12&63,128|n>>>6&63,128|n&63));return t}function zR(e){for(var t=Array(e.length>>2),r=0;r>5]|=(e.charCodeAt(r/8)&255)<>5]>>>r%32&255);return t}function YR(e,t){e[t>>5]|=128<>>9<<4)+14]=t;for(var r=1732584193,n=-271733879,i=-1732584194,a=271733878,s=0;s>16)+(t>>16)+(r>>16);return n<<16|r&65535}function WR(e,t){return e<>>32-t}var Q0=yn($y()),bT=/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/,yT=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;function Tr(e){return bT.test(e)}function Mr(e){return yT.test(e)}function xy(e){return/^((6553[0-5])|(655[0-2][0-9])|(65[0-4][0-9]{2})|(6[0-4][0-9]{3})|([1-5][0-9]{4})|([0-5]{0,5})|([0-9]{1,4}))$/.test(e)}function Ks(e){return typeof e=="string"&&e.trim().length>0}function Qt(e,t){return Ks(e)?e:t}function Mc(e){return typeof e<"u"&&e!==null}function qc(e,t){return Mc(e)?e:t}function Ha(e){return e?/^.+?\s*?=\s*?.+?\s*?,.+?/.test(e)?{"policy-descriptor":e}:{policy:e}:{}}function _T(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function df(e){let t=e.split(/,|\//),r=t[Math.floor(Math.random()*t.length)];if(r.includes("-")){let[n,i]=r.split("-").map(Number);return _T(n,i)}else return Number(r)}function Ry(e){return Number.isSafeInteger(e)?String(e):BigInt(e).toString()}function ed(e){return typeof e=="string"&&/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(e)}var nK=yn(Oy());var CT=new q0("sub-store"),se=CT;var xg=class{constructor(t){this.expires=t,se.read(So)||se.write("{}",So);try{this.resourceCache=JSON.parse(se.read(So))}catch(r){se.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${So} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${r?.message??r}`),this.resourceCache={},se.write("{}",So)}this._cleanup()}_cleanup(){let t=!1;Object.entries(this.resourceCache).forEach(r=>{let[n,i]=r;i.time||(delete this.resourceCache[n],se.delete(`#${n}`),t=!0),new Date().getTime()-i.time>this.expires&&(delete this.resourceCache[n],t=!0)}),t&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){se.write(JSON.stringify(this.resourceCache),So)}get(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()-r<=this.expires?this.resourceCache[t].data:null}set(t,r){this.resourceCache[t]={time:new Date().getTime(),data:r},this._persist()}},Zr=new xg(36e5);var Rg=class{constructor(){this.expires=FT(),se.read(Io)||se.write("{}",Io);try{this.resourceCache=JSON.parse(se.read(Io))}catch(t){se.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Io} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},se.write("{}",Io)}this._cleanup()}_cleanup(){let t=!1;Object.entries(this.resourceCache).forEach(r=>{let[n,i]=r;i.time||(delete this.resourceCache[n],se.delete(`#${n}`),t=!0),new Date().getTime()-i.time>this.expires&&(delete this.resourceCache[n],t=!0)}),t&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){se.write(JSON.stringify(this.resourceCache),Io)}get(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()-r<=this.expires?this.resourceCache[t].data:null}gettime(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()-r<=this.expires?this.resourceCache[t].time:null}set(t,r){this.resourceCache[t]={time:new Date().getTime(),data:r},this._persist()}};function FT(){se.read(j0)||se.write("6e4",j0);let e=6e4;if(se.env.isLoon){let t={"1\u5206\u949F":6e4,"5\u5206\u949F":3e5,"10\u5206\u949F":6e5,"30\u5206\u949F":18e5,"1\u5C0F\u65F6":36e5,"2\u5C0F\u65F6":72e5,"3\u5C0F\u65F6":108e5,"6\u5C0F\u65F6":216e5,"12\u5C0F\u65F6":432e5,"24\u5C0F\u65F6":864e5,"48\u5C0F\u65F6":1728e5,"72\u5C0F\u65F6":2592e5,\u53C2\u6570\u4F20\u5165:"readcachets"},r=se.read("#\u54CD\u5E94\u5934\u7F13\u5B58\u6709\u6548\u671F");return r in t&&(e=t[r],e==="readcachets"&&(e=r)),e}else return e=se.read(j0),e}var pf=new Rg;function Vc(e){let t=Object.keys(e),r="",n="";for(let i of t){let a=i.toLowerCase();a==="subscription-userinfo"?r=e[i]:a==="profile-web-page-url"&&(n=e[i])}return`${r||""}${n?`; app_url=${encodeURIComponent(n)}`:""}`}async function td(rawUrl,ua,timeout,customProxy,flowUrl){let url=flowUrl||rawUrl||"",$arguments={},rawArgs=url.split("#");if(url=url.split("#")[0],rawArgs.length>1)try{$arguments=JSON.parse(decodeURIComponent(rawArgs[1]))}catch{for(let t of rawArgs[1].split("&")){let r=t.split("=")[0],n=t.split("=")[1];$arguments[r]=n==null||n===""?!0:decodeURIComponent(n)}}if($arguments?.noFlow||!/^https?/.test(url))return;let{isStash,isLoon,isShadowRocket,isQX}=js(),insecure=$arguments?.insecure?se.env.isNode?{strictSSL:!1}:{insecure:!0}:void 0,{defaultProxy,defaultFlowUserAgent,defaultTimeout}=se.read(Na),proxy=customProxy||defaultProxy;se.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY"));let userAgent=ua||defaultFlowUserAgent||"clash.meta/v1.19.16",requestTimeout=timeout||defaultTimeout||8e3,id=cs(userAgent+url),cached=pf.get(id),flowInfo;if(!$arguments?.noCache&&cached)se.info(`\u4F7F\u7528\u7F13\u5B58\u7684\u6D41\u91CF\u4FE1\u606F: ${url}, ${userAgent}`),flowInfo=cached;else{let e=Ua();if(flowUrl){se.info(`\u4F7F\u7528 GET \u65B9\u6CD5\u4ECE\u54CD\u5E94\u4F53\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${flowUrl}, User-Agent: ${userAgent||""}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{body:t,statusCode:r}=await e.get({url:flowUrl,headers:{"User-Agent":userAgent},timeout:requestTimeout,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?Ha(proxy):{},...insecure||{}});if(r<200||r>=400)throw new Error(`statusCode: ${r}`);flowInfo=t}else{try{se.info(`\u4F7F\u7528 HEAD \u65B9\u6CD5\u4ECE\u54CD\u5E94\u5934\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${url}, User-Agent: ${userAgent||""}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{headers:t}=await e.head({url:url.split(/[\r\n]+/).map(r=>r.trim()).filter(r=>r.length)[0],headers:{"User-Agent":userAgent,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},timeout:requestTimeout,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?Ha(proxy):{},...insecure||{}});flowInfo=Vc(t)}catch(t){se.error(`\u4F7F\u7528 HEAD \u65B9\u6CD5\u4ECE\u54CD\u5E94\u5934\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u5931\u8D25: ${url}, User-Agent: ${userAgent||""}, Insecure: ${!!insecure}, Proxy: ${proxy}: ${t.message??t}`)}if(!flowInfo){se.info(`\u4F7F\u7528 GET \u65B9\u6CD5\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${url}, User-Agent: ${userAgent||""}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{headers:t}=await e.get({url:url.split(/[\r\n]+/).map(r=>r.trim()).filter(r=>r.length)[0],headers:{"User-Agent":userAgent,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},timeout:requestTimeout,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?Ha(proxy):{},...insecure||{}});flowInfo=Vc(t)}}flowInfo&&(flowInfo=flowInfo.trim()),flowInfo&&pf.set(id,flowInfo)}return flowInfo}function rd(e){if(!e)return;let t=e.match(/upload=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),r=t==null?0:Number(t[1]+t[2]),n=e.match(/download=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),i=Number(n[1]+n[2]),a=e.match(/total=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),s=Number(a[1]+a[2]),u=e.match(/expire=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),c=u?Number(u[1]+u[2]):void 0,f=e.match(/reset_day=([0-9]+)/),d=f?Number(f[1]):void 0,v=e.match(/app_url=(.*?)\s*?(;|$)/),p=v?decodeURIComponent(v[1]):void 0,h=e.match(/plan_name=(.*?)\s*?(;|$)/),w=h?decodeURIComponent(h[1]):void 0;return{expires:c,total:s,usage:{upload:r,download:i},remainingDays:d,appUrl:p,planName:w}}function gf(e,t="B"){let r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],n=r.indexOf(t);return e<1024||n===r.length-1?{value:(Math.round(e*100)/100).toString(),unit:t}:gf(e/1024,r[++n])}function nd(e){if(!e)throw new Error("\u6CA1\u6709\u6D41\u91CF\u4FE1\u606F");if(e?.expires&&e.expires*1e3a.getTime())throw new Error("\u5F00\u59CB\u65E5\u671F\u5E94\u65E9\u4E8E\u73B0\u5728");let s=new Date(r);for(s.setDate(s.getDate()+n);s31)throw new Error("\u6708\u91CD\u7F6E\u65E5\u5E94\u4E3A 1-31 \u4E4B\u95F4\u7684\u6574\u6570");let i=new Date,a=i.getDate(),s=i.getMonth(),u=i.getFullYear(),c;return t>a?c=0:c=new Date(u,s+1,0).getDate(),c-a+t}}catch(t){se.error(`getRmainingDays failed: ${t.message??t}`)}}function Ny(e){try{let t=new Map;return e.split(";").map(r=>r.trim()).filter(Boolean).forEach(r=>{let n=r.indexOf("=");if(n===-1)return;let i=r.slice(0,n).trim(),a=r.slice(n+1).trim();if(!t.has(i))try{let s=decodeURIComponent(a);if(["upload","download","total","expire"].includes(i))try{s=Number(s).toFixed(0),["expire"].includes(i)&&s<=0&&(s="")}catch(u){se.error(`Failed to convert value for key "${i}=${a}": ${u.message??u}`)}t.set(i,s)}catch{t.set(i,a)}}),Array.from(t.entries()).map(([r,n])=>`${r}=${encodeURIComponent(n)}`).join("; ")}catch(t){return se.error(`normalizeFlowHeader failed: ${t.message??t}`),e}}function hs(e,t,r="name"){return e.find(n=>n[r]===t)}function ST(){return{name:"HTML",test:n=>/^/.test(n),parse:()=>""}}function IT(){return{name:"Clash Provider",test:n=>/^payload:/gm.exec(n).index>=0,parse:n=>n.replace("payload:","").replace(/^\s*-\s*/gm,"")}}var Ly=[ST(),IT()];function BT(){return{type:"SINGLE",func:r=>["URL-REGEX","DEST-PORT","SRC-IP","IN-PORT","PROTOCOL","GEOSITE","GEOIP"].indexOf(r.type)!==-1?null:`${{"DOMAIN-KEYWORD":"HOST-KEYWORD","DOMAIN-SUFFIX":"HOST-SUFFIX",DOMAIN:"HOST","IP-CIDR6":"IP6-CIDR"}[r.type]||r.type},${r.content},SUB-STORE`}}function Uy(){return{type:"SINGLE",func:r=>{if(["GEOSITE","GEOIP"].indexOf(r.type)!==-1)return null;let i=`${r.type},${r.content}`;return["IP-CIDR","IP-CIDR6"].includes(r.type)&&(i+=r.options?.length>0?`,${r.options.join(",")}`:""),i}}}function PT(){return{type:"SINGLE",func:r=>["SRC-IP","GEOSITE","GEOIP"].indexOf(r.type)!==-1?null:(["IP-CIDR","IP-CIDR6"].includes(r.type)&&r.options&&(r.options=r.options.filter(i=>["no-resolve"].includes(i))),Uy().func(r))}}function $T(){return{type:"ALL",func:r=>{let n={"DEST-PORT":"DST-PORT","SRC-IP":"SRC-IP-CIDR","IN-PORT":"SRC-PORT"},i={payload:r.map(a=>{let s=`${n[a.type]||a.type},${a.content}`;return["IP-CIDR","IP-CIDR6","GEOIP"].includes(a.type)&&(a.options&&(a.options=a.options.filter(u=>["no-resolve"].includes(u))),s+=a.options?.length>0?`,${a.options.join(",")}`:""),s})};return Ls.dump(i)}}}var jy={QX:BT(),Surge:Uy(),Loon:PT(),Clash:$T()};var xT=[[/^(DOMAIN|host|HOST)$/,"DOMAIN"],[/^(DOMAIN-KEYWORD|host-keyword|HOST-KEYWORD)$/,"DOMAIN-KEYWORD"],[/^(DOMAIN-SUFFIX|host-suffix|HOST-SUFFIX)$/,"DOMAIN-SUFFIX"],[/^USER-AGENT$/i,"USER-AGENT"],[/^PROCESS-NAME$/,"PROCESS-NAME"],[/^(DEST-PORT|DST-PORT)$/,"DST-PORT"],[/^SRC-IP(-CIDR)?$/,"SRC-IP"],[/^(IN|SRC)-PORT$/,"IN-PORT"],[/^PROTOCOL$/,"PROTOCOL"],[/^IP-CIDR$/i,"IP-CIDR"],[/^(IP-CIDR6|ip6-cidr|IP6-CIDR)$/,"IP-CIDR6"],[/^GEOIP$/i,"GEOIP"],[/^GEOSITE$/i,"GEOSITE"]];function RT(){return{name:"Universal Rule Parser",test:()=>!0,parse:n=>{let i=n.split(` `),a=[];for(let s of i)if(s=s.trim(),s.length!==0&&!/\s*#/.test(s))try{let u=s.split(",").map(d=>d.trim()),c=u[0],f=!1;for(let d of xT)if(d[0].test(c)){f=!0;let p={type:d[1],content:u[1]};["IP-CIDR","IP-CIDR6","GEOIP"].includes(p.type)&&(p.options=u.slice(2)),a.push(p)}if(!f)throw new Error("Invalid rule type: "+c)}catch(u){console.log(`Failed to parse line: ${s} Reason: ${u}`)}return a}}}var Hy=[RT()];var Ma=function(){function e(n){for(let i of Ly)try{if(i.test(n))return se.info(`Pre-processor [${i.name}] activated`),i.parse(n)}catch(a){se.error(`Parser [${i.name}] failed Reason: ${a}`)}return n}function t(n){n=e(n);for(let i of Hy){let a;try{a=i.test(n)}catch{a=!1}if(a)return se.info(`Rule parser [${i.name}] is activated!`),i.parse(n)}}function r(n,i){let a=jy[i];if(!a)throw new Error(`Target platform: ${i} is not supported!`);if(typeof a.type>"u"||a.type==="SINGLE")return n.map(s=>{try{return a.func(s)}catch(u){return console.log(`ERROR: cannot produce rule: ${JSON.stringify(s)} Reason: ${u}`),""}}).filter(s=>s.length>0).join(` `);if(a.type==="ALL")return a.func(n)}return{parse:t,produce:r}}();var Kc=class{constructor({token,key,syncPlatform}){let{isStash,isLoon,isShadowRocket,isQX}=js(),{defaultProxy,defaultTimeout:timeout,githubProxy}=se.read(Na),proxy=defaultProxy;se.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY")),syncPlatform==="gitlab"?(this.headers={"PRIVATE-TOKEN":`${token}`,"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.141 Safari/537.36"},this.http=Ua({baseURL:"https://gitlab.com/api/v4",headers:{...this.headers,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?Ha(proxy):{},timeout:timeout||8e3,events:{onResponse:e=>{if(/^[45]/.test(String(e.statusCode))){let t=JSON.parse(e.body);return Promise.reject(`ERROR: ${t.message?.error??t.message}`)}else return e}}})):(this.headers={Authorization:`token ${token}`,"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.141 Safari/537.36"},this.http=Ua({baseURL:`${githubProxy?`${githubProxy}/`:""}https://api.github.com`,headers:{...this.headers,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?Ha(proxy):{},timeout:timeout||8e3,events:{onResponse:e=>/^[45]/.test(String(e.statusCode))?Promise.reject(`ERROR: ${JSON.parse(e.body).message}`):e}})),this.key=key,this.syncPlatform=syncPlatform}async locate(){return this.syncPlatform==="gitlab"?this.http.get("/snippets").then(e=>{let t=JSON.parse(e.body);for(let r of t)if(r.title===this.key)return r}):this.http.get("/gists?per_page=100&page=1").then(e=>{let t=JSON.parse(e.body);se.info(`\u83B7\u53D6\u5230\u5F53\u524D GitHub \u7528\u6237\u7684 gist: ${t.length} \u4E2A`);for(let r of t)if(r.description===this.key)return r})}async upload(e){if(Object.keys(e).length===0)return Promise.reject("\u672A\u63D0\u4F9B\u9700\u4E0A\u4F20\u7684\u6587\u4EF6");let t=await this.locate(),r=e;if(t?.id){this.syncPlatform==="gitlab"&&(t.files=t.files.reduce((a,s)=>(a[s.path]=s,a),{}));let n=[],i={...t.files};return Object.keys(r).map(a=>{i[a]?r[a].content==null||r[a].content===""?(delete i[a],n.push({action:"delete",file_path:a})):(i[a]=r[a],n.push({action:"update",file_path:a,content:r[a].content})):r[a].content==null||r[a].content===""?(delete i[a],delete r[a]):(i[a]=r[a],n.push({action:"create",file_path:a,content:r[a].content}))}),this.syncPlatform==="gitlab"?Object.keys(i).length===0?Promise.reject("\u672C\u6B21\u64CD\u4F5C\u5C06\u5BFC\u81F4\u6240\u6709\u6587\u4EF6\u7684\u5185\u5BB9\u90FD\u4E3A\u7A7A, \u65E0\u6CD5\u66F4\u65B0 snippet"):Object.keys(i).length>10?Promise.reject("\u672C\u6B21\u64CD\u4F5C\u5C06\u5BFC\u81F4 snippet \u7684\u6587\u4EF6\u6570\u8D85\u8FC7 10, \u65E0\u6CD5\u66F4\u65B0 snippet"):(r=n,this.http.put({headers:{...this.headers,"Content-Type":"application/json"},url:`/snippets/${t.id}`,body:JSON.stringify({files:r})})):Object.keys(i).length===0?Promise.reject("\u672C\u6B21\u64CD\u4F5C\u5C06\u5BFC\u81F4\u6240\u6709\u6587\u4EF6\u7684\u5185\u5BB9\u90FD\u4E3A\u7A7A, \u65E0\u6CD5\u66F4\u65B0 gist"):this.http.patch({url:`/gists/${t.id}`,body:JSON.stringify({files:r})})}else return r=Object.entries(r).reduce((n,[i,a])=>(a.content!==null&&a.content!==""&&(n[i]=a),n),{}),this.syncPlatform==="gitlab"?Object.keys(r).length===0?Promise.reject("\u6240\u6709\u6587\u4EF6\u7684\u5185\u5BB9\u90FD\u4E3A\u7A7A, \u65E0\u6CD5\u521B\u5EFA snippet"):(r=Object.keys(r).map(n=>({file_path:n,content:r[n].content})),this.http.post({headers:{...this.headers,"Content-Type":"application/json"},url:"/snippets",body:JSON.stringify({title:this.key,visibility:"private",files:r})})):Object.keys(r).length===0?Promise.reject("\u6240\u6709\u6587\u4EF6\u7684\u5185\u5BB9\u90FD\u4E3A\u7A7A, \u65E0\u6CD5\u521B\u5EFA gist"):this.http.post({url:"/gists",body:JSON.stringify({description:this.key,public:!1,files:r})})}async download(e){let t=await this.locate();if(t?.id)try{let{files:r}=await this.http.get(`/gists/${t.id}`).then(i=>JSON.parse(i.body)),n=r[e].raw_url;return await this.http.get(n).then(i=>i.body)}catch(r){return Promise.reject(r)}else return Promise.reject(`\u627E\u4E0D\u5230 Sub-Store Gist (${this.key})`)}};async function xu({type:e,name:t,platform:r,url:n,ua:i,content:a,mergeSources:s,ignoreFailedRemoteSub:u,ignoreFailedRemoteFile:c,produceType:f,produceOpts:d={},subscription:v,awaitCustomCache:p,$options:h,proxy:w,noCache:m,all:y}){if(r=r||"JSON",["subscription","sub"].includes(e)){let g;if(t){let F=se.read(Ag);if(g=hs(F,t),!g)throw new Error(`\u627E\u4E0D\u5230\u8BA2\u9605 ${t}`)}else if(v)g=v;else throw new Error("\u672A\u63D0\u4F9B\u8BA2\u9605\u540D\u79F0\u6216\u8BA2\u9605\u6570\u636E");let b;if(a&&!["localFirst","remoteFirst"].includes(s))b=a;else if(n){let F={};b=await Promise.all(n.split(/[\r\n]+/).map(N=>N.trim()).filter(N=>N.length).map(async N=>{try{return await Pn(N,i||g.ua,void 0,w||g.proxy,void 0,p,m||g.noCache,!0)}catch(S){return F[N]=S,se.error(`\u8BA2\u9605 ${g.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${N} \u53D1\u751F\u9519\u8BEF: ${S}`),""}}));let L=g.ignoreFailedRemoteSub;if(u!=null&&u!==""&&(L=u),Object.keys(F).length>0)if(L)L==="enabled"&&se.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${g.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(F).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${g.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(F).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);s==="localFirst"?b.unshift(a):s==="remoteFirst"&&b.push(a)}else if(g.source==="local"&&!["localFirst","remoteFirst"].includes(g.mergeSources))b=g.content;else{let F={};b=await Promise.all(g.url.split(/[\r\n]+/).map(N=>N.trim()).filter(N=>N.length).map(async N=>{try{return await Pn(N,i||g.ua,void 0,w||g.proxy,void 0,p,m||g.noCache,!0)}catch(S){return F[N]=S,se.error(`\u8BA2\u9605 ${g.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${N} \u53D1\u751F\u9519\u8BEF: ${S}`),""}}));let L=g.ignoreFailedRemoteSub;if(u!=null&&u!==""&&(L=u),Object.keys(F).length>0)if(L)L==="enabled"&&se.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${g.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(F).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${g.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(F).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);g.mergeSources==="localFirst"?b.unshift(g.content):g.mergeSources==="remoteFirst"&&b.push(g.content)}if(f==="raw")return JSON.stringify((Array.isArray(b)?b:[b]).flat());let D=(Array.isArray(b)?b:[b]).map(F=>Wt.parse(F)).flat();if(D.forEach(F=>{F._subName=g.name,F._subDisplayName=g.displayName}),D=await Wt.process(D,g.process||[],r,{[g.name]:g},h),D.length===0)throw new Error(`\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let C={};for(let F of D){if(C[F.name]){se.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${F.name}\uFF01`,"\u8BF7\u4ED4\u7EC6\u68C0\u6D4B\u914D\u7F6E\uFF01",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"});break}C[F.name]=!0}return Wt.produce(D,r,f,d)}else if(["collection","col"].includes(e)){let g=se.read(Ag),b=se.read(gy),D=hs(b,t);if(!D)throw new Error(`\u627E\u4E0D\u5230\u7EC4\u5408\u8BA2\u9605 ${t}`);let C=[...D.subscriptions],F=D.subscriptionTags;Array.isArray(F)&&F.length>0&&g.forEach(U=>{Array.isArray(U.tag)&&U.tag.length>0&&!C.includes(U.name)&&U.tag.some(G=>F.includes(G))&&C.push(U.name)});let L={},N={},S=0;await Promise.all(C.map(async U=>{let G=hs(g,U),H=G.passThroughUA,K=G.ua;H&&(se.info(`\u8BA2\u9605\u5F00\u542F\u4E86\u900F\u4F20 User-Agent, \u4F7F\u7528\u8BF7\u6C42\u7684 User-Agent: ${i}`),K=i);try{se.info(`\u6B63\u5728\u5904\u7406\u5B50\u8BA2\u9605\uFF1A${G.name}...`);let Y;if(G.source==="local"&&!["localFirst","remoteFirst"].includes(G.mergeSources))Y=G.content;else{let Ce={};if(Y=await await Promise.all(G.url.split(/[\r\n]+/).map(Fe=>Fe.trim()).filter(Fe=>Fe.length).map(async Fe=>{try{return await Pn(Fe,K,void 0,w||G.proxy||D.proxy,void 0,void 0,m||G.noCache,!0)}catch(xe){return Ce[Fe]=xe,se.error(`\u8BA2\u9605 ${G.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Fe} \u53D1\u751F\u9519\u8BEF: ${xe}`),""}})),Object.keys(Ce).length>0)if(G.ignoreFailedRemoteSub)G.ignoreFailedRemoteSub==="enabled"&&se.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${G.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(Ce).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${G.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(Ce).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);G.mergeSources==="localFirst"?Y.unshift(G.content):G.mergeSources==="remoteFirst"&&Y.push(G.content)}let ne=(Array.isArray(Y)?Y:[Y]).map(Ce=>Wt.parse(Ce)).flat();ne.forEach(Ce=>{Ce._subName=G.name,Ce._subDisplayName=G.displayName,Ce._collectionName=D.name,Ce._collectionDisplayName=D.displayName}),ne=await Wt.process(ne,G.process||[],r,{[G.name]:G,_collection:D,$options:h}),L[U]=ne,S++,se.info(`\u2705 \u5B50\u8BA2\u9605\uFF1A${G.name}\u52A0\u8F7D\u6210\u529F\uFF0C\u8FDB\u5EA6--${100*(S/C.length).toFixed(1)}% `)}catch(Y){S++,N[U]=Y,se.error(`\u274C \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u4E2D\u7684\u5B50\u8BA2\u9605: ${G.name}\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${Y}\uFF01\u8FDB\u5EA6--${100*(S/C.length).toFixed(1)}%`)}}));let B=D.ignoreFailedRemoteSub;if(u!=null&&u!==""&&(B=u),Object.keys(N).length>0)if(B)B==="enabled"&&se.notify("\u{1F30D} Sub-Store \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${D.name}`,`\u5B50\u8BA2\u9605 ${Object.keys(N).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${D.name} \u7684\u5B50\u8BA2\u9605 ${Object.keys(N).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);let O=Array.prototype.concat.apply([],C.map(U=>L[U]||[]));if(O.forEach(U=>{U._collectionName=D.name,U._collectionDisplayName=D.displayName}),O=await Wt.process(O,D.process||[],r,{_collection:D},h),O.length===0)throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let x={};for(let U of O){if(x[U.name]){se.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u7EC4\u5408\u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${U.name}\uFF01`,"\u8BF7\u4ED4\u7EC6\u68C0\u6D4B\u914D\u7F6E\uFF01",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"});break}x[U.name]=!0}return Wt.produce(O,r,f,d)}else if(e==="rule"){let g=se.read(my),b=hs(g,t);if(!b)throw new Error(`\u627E\u4E0D\u5230\u89C4\u5219 ${t}`);let D=[];for(let C=0;CB.trim()).filter(B=>B.length).map(async B=>{try{return await Pn(B,i||b.ua,void 0,b.proxy||w,void 0,void 0,m)}catch(O){return N[B]=O,se.error(`\u6587\u4EF6 ${b.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${B} \u53D1\u751F\u9519\u8BEF: ${O}`),""}}));let S=b.ignoreFailedRemoteFile;if(c!=null&&c!==""&&(S=c),!S&&Object.keys(N).length>0)throw new Error(`\u6587\u4EF6 ${b.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(N).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);s==="localFirst"?D.unshift(a):s==="remoteFirst"&&D.push(a)}else if(b.source==="local"&&!["localFirst","remoteFirst"].includes(b.mergeSources))D=b.content;else{let N={};D=await Promise.all(b.url.split(/[\r\n]+/).map(B=>B.trim()).filter(B=>B.length).map(async B=>{try{return await Pn(B,i||b.ua,void 0,b.proxy||w,void 0,void 0,m)}catch(O){return N[B]=O,se.error(`\u6587\u4EF6 ${b.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${B} \u53D1\u751F\u9519\u8BEF: ${O}`),""}}));let S=b.ignoreFailedRemoteFile;if(c!=null&&c!==""&&(S=c),Object.keys(N).length>0)if(S)S==="enabled"&&se.notify("\u{1F30D} Sub-Store \u5904\u7406\u6587\u4EF6\u5931\u8D25",`\u274C ${b.name}`,`\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(N).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u6587\u4EF6 ${b.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(N).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);b.mergeSources==="localFirst"?D.unshift(b.content):b.mergeSources==="remoteFirst"&&D.push(b.content)}if(f==="raw")return JSON.stringify((Array.isArray(D)?D:[D]).flat());let C=(Array.isArray(D)?D:[D]).flat(),F=C.filter(N=>N!=null&&N!=="").join(` `),L=Array.isArray(b.process)&&b.process.length>0?await Wt.process({$files:C,$content:F,$options:h,$file:b},b.process):{$content:F,$files:C,$options:h};return(y?L:L?.$content)??""}}function UT(){return{name:"HTML",test:n=>/^/.test(n),parse:()=>""}}function jT(){let e="Base64 Pre-processor",t=["dm1lc3M","c3NyOi8v","c29ja3M6Ly","dHJvamFu","c3M6Ly","c3NkOi8v","c2hhZG93","aHR0c","dmxlc3M=","aHlzdGVyaWEy","aHkyOi8v","d2lyZWd1YXJkOi8v","d2c6Ly8=","dHVpYzovLw=="];return{name:e,test:function(i){return!/^\w+:\/\/\w+/im.test(i)&&t.some(a=>i.indexOf(a)!==-1)},parse:function(i){let a=yt.decode(i);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(a)?a:(se.error("Base64 Pre-processor error: decoded line does not start with protocol"),i)}}}function HT(){return{name:"Fallback Base64 Pre-processor",test:function(n){return!0},parse:function(n){let i=yt.decode(n);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(i)?i:(se.error("Fallback Base64 Pre-processor error: decoded line does not start with protocol"),n)}}}function MT(){return{name:"Clash Pre-processor",test:function(n){if(!/proxies/.test(n))return!1;let i=cf(n);return i.proxies&&Array.isArray(i.proxies)},parse:function(n,i){let a=n.replace(/short-id:([ \t]*[^#\n,}]*)/g,(c,f)=>{let d=f.trim();return!d||d===""?'short-id: ""':/^(['"]).*\1$/.test(d)?`short-id: ${d}`:["null"].includes(d)?`short-id: ${d}`:`short-id: "${d}"`}),{proxies:s,"global-client-fingerprint":u}=cf(a);return(i?`proxies: `:"")+s.map(c=>(u&&!c["client-fingerprint"]&&(c["client-fingerprint"]=u),`${i?" - ":""}${JSON.stringify(c)} `)).join("")}}}function qT(){return{name:"SSD Pre-processor",test:function(n){return n.indexOf("ssd://")===0},parse:function(n){let i=[],a=JSON.parse(yt.decode(n.split("ssd://")[1])),s=a.port,u=a.encryption,c=a.password,f=a.servers;for(let d=0;de.name==="Clash Pre-processor"),Tg=new Map;async function Pn(rawUrl="",ua,timeout,customProxy,skipCustomCache,awaitCustomCache,noCache,preprocess){let $arguments={},url=rawUrl.replace(/#noFlow$/,""),rawArgs=url.split("#");if(url=url.split("#")[0],rawArgs.length>1)try{$arguments=JSON.parse(decodeURIComponent(rawArgs[1]))}catch{for(let t of rawArgs[1].split("&")){let r=t.split("=")[0],n=t.split("=")[1];$arguments[r]=n==null||n===""?!0:decodeURIComponent(n)}}let{isNode,isStash,isLoon,isShadowRocket,isQX}=js(),{defaultProxy,defaultUserAgent,defaultTimeout,cacheThreshold:defaultCacheThreshold}=se.read(Na),cacheThreshold=defaultCacheThreshold||1024,proxy=customProxy||defaultProxy;se.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY"));let userAgent=ua||defaultUserAgent||"clash.meta",requestTimeout=timeout||defaultTimeout||8e3,id=cs(userAgent+url);$arguments?.cacheKey===!0&&(se.error("\u4F7F\u7528\u81EA\u5B9A\u4E49\u7F13\u5B58\u65F6 cacheKey \u7684\u503C\u4E0D\u80FD\u4E3A\u7A7A"),$arguments.cacheKey=void 0);let customCacheKey=$arguments?.cacheKey?`#sub-store-cached-custom-${$arguments?.cacheKey}`:void 0;if(customCacheKey&&!skipCustomCache){let e=se.read(customCacheKey),t=Zr.get(id);if(!noCache&&!$arguments?.noCache&&t)return se.info(`\u4E50\u89C2\u7F13\u5B58: URL ${url} \u5B58\u5728\u6709\u6548\u7684\u5E38\u89C4\u7F13\u5B58 \u4F7F\u7528\u5E38\u89C4\u7F13\u5B58\u4EE5\u907F\u514D\u91CD\u590D\u8BF7\u6C42`),t;if(e){if(awaitCustomCache){se.info(`\u4E50\u89C2\u7F13\u5B58: URL ${url} \u672C\u6B21\u8FDB\u884C\u8BF7\u6C42 \u5C1D\u8BD5\u66F4\u65B0\u7F13\u5B58`);try{await Pn(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess)}catch(r){se.error(`\u4E50\u89C2\u7F13\u5B58: URL ${url} \u66F4\u65B0\u7F13\u5B58\u53D1\u751F\u9519\u8BEF ${r.message??r}`),se.info("\u4F7F\u7528\u4E50\u89C2\u7F13\u5B58\u7684\u6570\u636E\u5237\u65B0\u7F13\u5B58, \u9632\u6B62\u540E\u7EED\u8BF7\u6C42"),Zr.set(id,e)}}else se.info(`\u4E50\u89C2\u7F13\u5B58: URL ${url} \u672C\u6B21\u8FD4\u56DE\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey} \u5E76\u8FDB\u884C\u8BF7\u6C42 \u5C1D\u8BD5\u5F02\u6B65\u66F4\u65B0\u7F13\u5B58`),Pn(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess).catch(r=>{se.error(`\u4E50\u89C2\u7F13\u5B58: URL ${url} \u5F02\u6B65\u66F4\u65B0\u7F13\u5B58\u53D1\u751F\u9519\u8BEF ${r.message??r}`)});return e}}let downloadUrlMatch=url.split("#")[0].match(/^\/api\/(file|module)\/(.+)/);if(downloadUrlMatch){let e="";try{e=downloadUrlMatch?.[1];let t=downloadUrlMatch?.[2];if(t==null)throw new Error(`\u672C\u5730 ${e} URL \u65E0\u6548: ${url}`);t=decodeURIComponent(t);let r=e==="module"?U0:Lc,n=hs(se.read(r),t);if(!n)throw new Error(`\u627E\u4E0D\u5230 ${e}: ${t}`);return e==="module"?n.content:await xu({type:"file",name:t})}catch(t){throw se.error(`Error when loading ${e}: ${url.split("#")[0]}. Reason: ${t}`),new Error(`\u65E0\u6CD5\u52A0\u8F7D ${e}: ${url}`)}}else if(url?.startsWith("/"))try{let fs=eval('require("fs")');return fs.readFileSync(url.split("#")[0],"utf8")}catch(e){throw se.error(`Error when reading local file: ${url.split("#")[0]}. Reason: ${e}`),new Error(`\u65E0\u6CD5\u4ECE\u8BE5\u8DEF\u5F84\u8BFB\u53D6\u6587\u672C\u5185\u5BB9: ${url}`)}if(!isNode&&Tg.has(id))return Tg.get(id);let http=Ua({headers:{"User-Agent":userAgent,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},timeout:requestTimeout}),result,cached=Zr.get(id);if(!noCache&&!$arguments?.noCache&&cached)se.info(`\u4F7F\u7528\u7F13\u5B58: ${url}, ${userAgent}`),result=cached,customCacheKey&&(se.info(`URL ${url} \u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),se.write(cached,customCacheKey));else{let e=$arguments?.insecure?isNode?{strictSSL:!1}:{insecure:!0}:void 0;se.info(`Downloading... User-Agent: ${userAgent} Timeout: ${requestTimeout} Proxy: ${proxy} Insecure: ${!!e} Preprocess: ${preprocess} URL: ${url}`);try{let{body:t,headers:r,statusCode:n}=await http.get({url,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?Ha(proxy):{},...e||{}});if(se.info(`statusCode: ${n}`),n<200||n>=400)throw new Error(`statusCode: ${n}`);if(r){let a=Vc(r);a&&pf.set(id,a)}if(t.replace(/\s/g,"").length===0)throw new Error(new Error("\u8FDC\u7A0B\u8D44\u6E90\u5185\u5BB9\u4E3A\u7A7A"));if(preprocess)try{My.test(t)&&(t=My.parse(t,!0))}catch(a){se.error(`Clash Pre-processor error: ${a}`)}let i=!0;if(cacheThreshold){let a=t.length/1024;a>cacheThreshold&&(se.info(`\u8D44\u6E90\u5927\u5C0F ${a.toFixed(2)} KB \u8D85\u8FC7\u4E86 ${cacheThreshold} KB, \u4E0D\u7F13\u5B58`),i=!1)}if(preprocess)try{let a=Wt.parse(t);(!Array.isArray(a)||a.length===0)&&(se.error(`URL ${url} \u4E0D\u5305\u542B\u6709\u6548\u8282\u70B9, \u4E0D\u7F13\u5B58`),i=!1)}catch(a){se.error(`URL ${url} \u5C1D\u8BD5\u89E3\u6790\u8282\u70B9\u5931\u8D25 ${a.message??a}, \u4E0D\u7F13\u5B58`),i=!1}i&&(Zr.set(id,t),customCacheKey&&(se.info(`URL ${url} \u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),se.write(t,customCacheKey))),result=t}catch(t){if(customCacheKey){let r=se.read(customCacheKey);if(r)return se.info(`\u65E0\u6CD5\u4E0B\u8F7D URL ${url}: ${t.message??t} \u4F7F\u7528\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),r}throw new Error(`\u65E0\u6CD5\u4E0B\u8F7D URL ${url}: ${t.message??t}`)}}return $arguments?.validCheck&&await nd(rd(await td(url,$arguments.flowUserAgent,void 0,proxy,$arguments.flowUrl))),isNode||Tg.set(id,result),result}async function qy(url,file){let undici=eval("require('undici')"),fs=eval("require('fs')"),{pipeline}=eval("require('stream/promises')"),{Agent,interceptors,request}=undici;se.info(`Downloading file... URL: ${url} File: ${file}`);let{body,statusCode}=await request(url,{dispatcher:new Agent().compose(interceptors.redirect({maxRedirections:3,throwOnRedirect:!0}))});if(statusCode!==200)throw new Error(`Failed to download file from ${url}`);let fileStream=fs.createWriteStream(file);return await pipeline(body,fileStream),se.info(`File downloaded from ${url} to ${file}`),file}var Og=class{constructor(){this.expires=KT(),se.read(Bo)||se.write("{}",Bo);try{this.resourceCache=JSON.parse(se.read(Bo))}catch(t){se.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Bo} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},se.write("{}",Bo)}this._cleanup()}_cleanup(t,r){let n=!1;Object.entries(this.resourceCache).forEach(i=>{let[a,s]=i;s.time||(delete this.resourceCache[a],se.delete(`#${a}`),n=!0),(new Date().getTime()-s.time>(r??this.expires)||t&&a.startsWith(t))&&(delete this.resourceCache[a],n=!0)}),n&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){se.write(JSON.stringify(this.resourceCache),Bo)}get(t,r,n){let i=this.resourceCache[t]&&this.resourceCache[t].time;if(i){if(new Date().getTime()-i<=(r??this.expires))return this.resourceCache[t].data;n&&(delete this.resourceCache[t],this._persist())}return null}gettime(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()-r<=this.expires?this.resourceCache[t].time:null}set(t,r){this.resourceCache[t]={time:new Date().getTime(),data:r},this._persist()}};function KT(){se.read(H0)||se.write("1728e5",H0);let e=1728e5;if(se.env.isLoon){let t={"1\u5206\u949F":6e4,"5\u5206\u949F":3e5,"10\u5206\u949F":6e5,"30\u5206\u949F":18e5,"1\u5C0F\u65F6":36e5,"2\u5C0F\u65F6":72e5,"3\u5C0F\u65F6":108e5,"6\u5C0F\u65F6":216e5,"12\u5C0F\u65F6":432e5,"24\u5C0F\u65F6":864e5,"48\u5C0F\u65F6":1728e5,"72\u5C0F\u65F6":2592e5,\u53C2\u6570\u4F20\u5165:"readcachets"},r=se.read("#\u8282\u70B9\u7F13\u5B58\u6709\u6548\u671F");return r in t&&(e=t[r],e==="readcachets"&&(e=r)),e}else return e=se.read(H0),e}var kg=new Og;function ad(e,t){return[...Array(e).keys()].map(()=>t)}var Ng={"\u{1F3F3}\uFE0F\u200D\u{1F308}":["EXP","BAND"],"\u{1F1F8}\u{1F1F1}":["TEST","SOS"],"\u{1F1F2}\u{1F1F5}":["MP","MNP"],"\u{1F1F8}\u{1F1F4}":["SO","SOM"],"\u{1F1E6}\u{1F1F6}":["AQ","ATA"],"\u{1F1E6}\u{1F1EC}":["AG","ATG"],"\u{1F1EC}\u{1F1F1}":["GL","GRL"],"\u{1F1FF}\u{1F1FC}":["ZW","ZWE"],"\u{1F1E6}\u{1F1FC}":["AW","ABW"],"\u{1F1F2}\u{1F1F1}":["ML","MLI"],"\u{1F1E6}\u{1F1E9}":["AD","AND"],"\u{1F1E6}\u{1F1EA}":["AE","ARE"],"\u{1F1E6}\u{1F1EB}":["AF","AFG"],"\u{1F1E6}\u{1F1F1}":["AL","ALB"],"\u{1F1E6}\u{1F1F2}":["AM","ARM"],"\u{1F1E6}\u{1F1F7}":["AR","ARG"],"\u{1F1E6}\u{1F1F9}":["AT","AUT"],"\u{1F1E6}\u{1F1FA}":["AU","AUS"],"\u{1F1E6}\u{1F1FF}":["AZ","AZE"],"\u{1F1E7}\u{1F1E6}":["BA","BIH"],"\u{1F1E7}\u{1F1E9}":["BD","BGD"],"\u{1F1E7}\u{1F1EA}":["BE","BEL"],"\u{1F1E7}\u{1F1EC}":["BG","BGR"],"\u{1F1E7}\u{1F1ED}":["BH","BHR"],"\u{1F1E7}\u{1F1F4}":["BO","BOL"],"\u{1F1E7}\u{1F1F3}":["BN","BRN"],"\u{1F1E7}\u{1F1F7}":["BR","BRA"],"\u{1F1E7}\u{1F1F9}":["BT","BTN"],"\u{1F1E7}\u{1F1FE}":["BY","BLR"],"\u{1F1E8}\u{1F1E6}":["CA","CAN"],"\u{1F1E8}\u{1F1ED}":["CH","CHE"],"\u{1F1E8}\u{1F1F1}":["CL","CHL"],"\u{1F1E8}\u{1F1F4}":["CO","COL"],"\u{1F1E8}\u{1F1F7}":["CR","CRI"],"\u{1F1E8}\u{1F1FE}":["CY","CYP"],"\u{1F1E8}\u{1F1FF}":["CZ","CZE"],"\u{1F1E9}\u{1F1EA}":["DE","DEU"],"\u{1F1E9}\u{1F1F0}":["DK","DNK"],"\u{1F1E9}\u{1F1FF}":["DZ","DZA"],"\u{1F1EA}\u{1F1E8}":["EC","ECU"],"\u{1F1EA}\u{1F1EA}":["EE","EST"],"\u{1F1EA}\u{1F1EC}":["EG","EGY"],"\u{1F1EA}\u{1F1F8}":["ES","ESP"],"\u{1F1EA}\u{1F1FA}":["EU"],"\u{1F1EB}\u{1F1EE}":["FI","FIN"],"\u{1F1EB}\u{1F1F7}":["FR","FRA"],"\u{1F1EC}\u{1F1E7}":["GB","GBR","UK"],"\u{1F1EC}\u{1F1EA}":["GE","GEO"],"\u{1F1EC}\u{1F1F7}":["GR","GRC"],"\u{1F1EC}\u{1F1F9}":["GT","GTM"],"\u{1F1EC}\u{1F1FA}":["GU","GUM"],"\u{1F1ED}\u{1F1F0}":["HK","HKG","HKT","HKBN","HGC","WTT","CMI"],"\u{1F1ED}\u{1F1F7}":["HR","HRV"],"\u{1F1ED}\u{1F1FA}":["HU","HUN"],"\u{1F1EE}\u{1F1F6}":["IQ","IRQ"],"\u{1F1EF}\u{1F1F4}":["JO","JOR"],"\u{1F1EF}\u{1F1F5}":["JP","JPN","TYO"],"\u{1F1F0}\u{1F1EA}":["KE","KEN"],"\u{1F1F0}\u{1F1EC}":["KG","KGZ"],"\u{1F1F0}\u{1F1ED}":["KH","KGZ"],"\u{1F1F0}\u{1F1F5}":["KP","PRK"],"\u{1F1F0}\u{1F1F7}":["KR","KOR","SEL"],"\u{1F1F0}\u{1F1FF}":["KZ","KAZ"],"\u{1F1EE}\u{1F1E9}":["ID","IDN"],"\u{1F1EE}\u{1F1EA}":["IE","IRL"],"\u{1F1EE}\u{1F1F1}":["IL","ISR"],"\u{1F1EE}\u{1F1F2}":["IM","IMN"],"\u{1F1EE}\u{1F1F3}":["IN","IND"],"\u{1F1EE}\u{1F1F7}":["IR","IRN"],"\u{1F1EE}\u{1F1F8}":["IS","ISL"],"\u{1F1EE}\u{1F1F9}":["IT","ITA"],"\u{1F1F1}\u{1F1E6}":["LA","LAO"],"\u{1F1F1}\u{1F1F0}":["LK","LKA"],"\u{1F1F1}\u{1F1F9}":["LT","LTU"],"\u{1F1F1}\u{1F1FA}":["LU","LUX"],"\u{1F1F1}\u{1F1FB}":["LV","LVA"],"\u{1F1F2}\u{1F1E6}":["MA","MAR"],"\u{1F1F2}\u{1F1E9}":["MD","MDA"],"\u{1F1F3}\u{1F1EC}":["NG","NGA"],"\u{1F1F2}\u{1F1F2}":["MM","MMR"],"\u{1F1F2}\u{1F1F0}":["MK","MKD"],"\u{1F1F2}\u{1F1F3}":["MN","MNG"],"\u{1F1F2}\u{1F1F4}":["MO","MAC","CTM"],"\u{1F1F2}\u{1F1F9}":["MT","MLT"],"\u{1F1F2}\u{1F1FD}":["MX","MEX"],"\u{1F1F2}\u{1F1FE}":["MY","MYS"],"\u{1F1F3}\u{1F1F1}":["NL","NLD","AMS"],"\u{1F1F3}\u{1F1F4}":["NO","NOR"],"\u{1F1F3}\u{1F1F5}":["NP","NPL"],"\u{1F1F3}\u{1F1FF}":["NZ","NZL"],"\u{1F1F4}\u{1F1F2}":["OM","OMN"],"\u{1F1F5}\u{1F1E6}":["PA","PAN"],"\u{1F1F5}\u{1F1EA}":["PE","PER"],"\u{1F1F5}\u{1F1ED}":["PH","PHL"],"\u{1F1F5}\u{1F1F0}":["PK","PAK"],"\u{1F1F5}\u{1F1F1}":["PL","POL"],"\u{1F1F5}\u{1F1F7}":["PR","PRI"],"\u{1F1F5}\u{1F1F9}":["PT","PRT"],"\u{1F1F5}\u{1F1FE}":["PY","PRY"],"\u{1F1F5}\u{1F1EC}":["PG","PNG"],"\u{1F1F6}\u{1F1E6}":["QA","QAT"],"\u{1F1F7}\u{1F1F4}":["RO","ROU"],"\u{1F1F7}\u{1F1F8}":["RS","SRB"],"\u{1F1F7}\u{1F1EA}":["RE","REU"],"\u{1F1F7}\u{1F1FA}":["RU","RUS"],"\u{1F1F8}\u{1F1E6}":["SA","SAU"],"\u{1F1FC}\u{1F1F8}":["WS","WSM"],"\u{1F1F8}\u{1F1EA}":["SE","SWE"],"\u{1F1F8}\u{1F1EC}":["SG","SGP"],"\u{1F1F8}\u{1F1EE}":["SI","SVN"],"\u{1F1F8}\u{1F1F0}":["SK","SVK"],"\u{1F1F9}\u{1F1EC}":["TG","TGO"],"\u{1F1F9}\u{1F1ED}":["TH","THA"],"\u{1F1F9}\u{1F1F3}":["TN","TUN"],"\u{1F1F9}\u{1F1F7}":["TR","TUR"],"\u{1F1F9}\u{1F1FC}":["TW","TWN","CHT","HINET","ROC"],"\u{1F1FA}\u{1F1E6}":["UA","UKR"],"\u{1F1FA}\u{1F1F8}":["US","USA","LAX","SFO","SJC"],"\u{1F1FA}\u{1F1FE}":["UY","URY"],"\u{1F1FB}\u{1F1E6}":["VA","VAT"],"\u{1F1FB}\u{1F1EA}":["VE","VEN"],"\u{1F1FB}\u{1F1F3}":["VN","VNM"],"\u{1F1FF}\u{1F1E6}":["ZA","ZAF","JNB"],"\u{1F1E8}\u{1F1F3}":["CN","CHN","BACK"]};function zc(e){let t={"\u{1F3F3}\uFE0F\u200D\u{1F308}":["\u6D41\u91CF","\u65F6\u95F4","\u8FC7\u671F","Bandwidth","Expire"],"\u{1F1F8}\u{1F1F1}":["\u5E94\u6025","\u6D4B\u8BD5\u8282\u70B9"],"\u{1F1F2}\u{1F1F5}":["\u5317\u9A6C\u91CC\u4E9A\u7EB3","Northern Mariana Islands","Saipan","\u585E\u73ED"],"\u{1F1F8}\u{1F1F4}":["Somalia","\u7D22\u9A6C\u91CC","\u6469\u52A0\u8FEA\u6C99","Mogadishu"],"\u{1F1E6}\u{1F1F6}":["Antarctica","\u5357\u6781\u6D32","\u5357\u6781"],"\u{1F1E6}\u{1F1EC}":["Antigua and Barbuda","\u5B89\u63D0\u74DC\u548C\u5DF4\u5E03\u8FBE"],"\u{1F1EC}\u{1F1F1}":["Greenland","\u683C\u9675\u5170\u5C9B","\u683C\u9675\u5170"],"\u{1F1FF}\u{1F1FC}":["Zimbabwe","\u6D25\u5DF4\u5E03\u97E6"],"\u{1F1E6}\u{1F1FC}":["Aruba","\u963F\u9C81\u5DF4"],"\u{1F1F2}\u{1F1F1}":["Mali","\u9A6C\u91CC"],"\u{1F1E6}\u{1F1E9}":["Andorra","\u5B89\u9053\u5C14"],"\u{1F1E6}\u{1F1EA}":["United Arab Emirates","\u963F\u8054\u914B","\u8FEA\u62DC","Dubai"],"\u{1F1E6}\u{1F1EB}":["Afghanistan","\u963F\u5BCC\u6C57"],"\u{1F1E6}\u{1F1F1}":["Albania","\u963F\u5C14\u5DF4\u5C3C\u4E9A","\u963F\u723E\u5DF4\u5C3C\u4E9E"],"\u{1F1E6}\u{1F1F2}":["Armenia","\u4E9A\u7F8E\u5C3C\u4E9A"],"\u{1F1E6}\u{1F1F7}":["Argentina","\u963F\u6839\u5EF7"],"\u{1F1E6}\u{1F1F9}":["Austria","\u5965\u5730\u5229","\u5967\u5730\u5229","\u7EF4\u4E5F\u7EB3"],"\u{1F1FC}\u{1F1F8}":["Samoa","\u8428\u6469\u4E9A","\u85A9\u6469\u4E9E"],"\u{1F1E6}\u{1F1FA}":["Australia","\u6FB3\u5927\u5229\u4E9A","\u6FB3\u6D32","\u58A8\u5C14\u672C","\u6089\u5C3C","\u571F\u6FB3","\u4EAC\u6FB3","\u5EE3\u6FB3","\u6EEC\u6FB3","\u6CAA\u6FB3","\u5E7F\u6FB3","Sydney"],"\u{1F1E6}\u{1F1FF}":["Azerbaijan","\u963F\u585E\u62DC\u7586"],"\u{1F1E7}\u{1F1E6}":["Bosnia and Herzegovina","\u6CE2\u9ED1\u5171\u548C\u56FD","\u6CE2\u9ED1"],"\u{1F1E7}\u{1F1E9}":["Bangladesh","\u5B5F\u52A0\u62C9\u56FD","\u5B5F\u52A0\u62C9"],"\u{1F1E7}\u{1F1EA}":["Belgium","\u6BD4\u5229\u65F6","\u6BD4\u5229\u6642"],"\u{1F1E7}\u{1F1EC}":["Bulgaria","\u4FDD\u52A0\u5229\u4E9A","\u4FDD\u52A0\u5229\u4E9E"],"\u{1F1E7}\u{1F1ED}":["Bahrain","\u5DF4\u6797"],"\u{1F1E7}\u{1F1F7}":["Brazil","\u5DF4\u897F","\u5723\u4FDD\u7F57"],"\u{1F1E7}\u{1F1F3}":["Brunei","\u6587\u83B1","\u6C76\u840A"],"\u{1F1E7}\u{1F1FE}":["Belarus","\u767D\u4FC4\u7F57\u65AF","\u767D\u4FC4"],"\u{1F1E7}\u{1F1F4}":["Bolivia","\u73BB\u5229\u7EF4\u4E9A"],"\u{1F1E7}\u{1F1F9}":["Bhutan","\u4E0D\u4E39","\u4E0D\u4E39\u738B\u56FD"],"\u{1F1E8}\u{1F1E6}":["Canada","\u52A0\u62FF\u5927","\u8499\u7279\u5229\u5C14","\u6E29\u54E5\u534E","\u6953\u8449","\u67AB\u53F6","\u6ED1\u94C1\u5362","\u591A\u4F26\u591A","Waterloo","Toronto"],"\u{1F1E8}\u{1F1ED}":["Switzerland","\u745E\u58EB","\u82CF\u9ECE\u4E16","Zurich"],"\u{1F1E8}\u{1F1F1}":["Chile","\u667A\u5229"],"\u{1F1E8}\u{1F1F4}":["Colombia","\u54E5\u4F26\u6BD4\u4E9A"],"\u{1F1E8}\u{1F1F7}":["Costa Rica","\u54E5\u65AF\u8FBE\u9ECE\u52A0"],"\u{1F1E8}\u{1F1FE}":["Cyprus","\u585E\u6D66\u8DEF\u65AF"],"\u{1F1E8}\u{1F1FF}":["Czechia","\u6377\u514B","Czech","Czech Republic"],"\u{1F1E9}\u{1F1EA}":["German","\u5FB7\u56FD","\u5FB7\u570B","\u4EAC\u5FB7","\u6EEC\u5FB7","\u5EE3\u5FB7","\u6CAA\u5FB7","\u5E7F\u5FB7","\u6CD5\u5170\u514B\u798F","Frankfurt","\u5FB7\u610F\u5FD7"],"\u{1F1E9}\u{1F1F0}":["Denmark","\u4E39\u9EA6","\u4E39\u9EA5"],"\u{1F1E9}\u{1F1FF}":["Algeria","\u963F\u5C14\u53CA\u5229\u4E9A","\u963F\u723E\u53CA\u5229\u4E9E"],"\u{1F1EA}\u{1F1E8}":["Ecuador","\u5384\u74DC\u591A\u5C14"],"\u{1F1EA}\u{1F1EA}":["Estonia","\u7231\u6C99\u5C3C\u4E9A"],"\u{1F1EA}\u{1F1EC}":["Egypt","\u57C3\u53CA"],"\u{1F1EA}\u{1F1F8}":["Spain","\u897F\u73ED\u7259"],"\u{1F1EA}\u{1F1FA}":["European Union","\u6B27\u76DF","\u6B27\u7F57\u5DF4"],"\u{1F1EB}\u{1F1EE}":["Finland","\u82AC\u5170","\u82AC\u862D","\u8D6B\u5C14\u8F9B\u57FA"],"\u{1F1EB}\u{1F1F7}":["France","\u6CD5\u56FD","\u6CD5\u570B","\u5DF4\u9ECE"],"\u{1F1EC}\u{1F1E7}":["Great Britain","\u82F1\u56FD","England","United Kingdom","\u4F26\u6566","\u82F1","London"],"\u{1F1EC}\u{1F1EA}":["Georgia","\u683C\u9C81\u5409\u4E9A","\u683C\u9B6F\u5409\u4E9E"],"\u{1F1EC}\u{1F1F7}":["Greece","\u5E0C\u814A","\u5E0C\u81D8"],"\u{1F1EC}\u{1F1FA}":["Guam","\u5173\u5C9B","\u95DC\u5CF6"],"\u{1F1EC}\u{1F1F9}":["Guatemala","\u5371\u5730\u9A6C\u62C9"],"\u{1F1ED}\u{1F1F0}":["Hongkong","\u9999\u6E2F","Hong Kong","HongKong","HONG KONG","\u6DF1\u6E2F","\u6CAA\u6E2F","\u547C\u6E2F","\u7A57\u6E2F","\u4EAC\u6E2F","\u6E2F"],"\u{1F1ED}\u{1F1F7}":["Croatia","\u514B\u7F57\u5730\u4E9A","\u514B\u7F85\u5730\u4E9E"],"\u{1F1ED}\u{1F1FA}":["Hungary","\u5308\u7259\u5229"],"\u{1F1EE}\u{1F1F6}":["Iraq","\u4F0A\u62C9\u514B","\u5DF4\u683C\u8FBE","Baghdad"],"\u{1F1EF}\u{1F1F4}":["Jordan","\u7EA6\u65E6"],"\u{1F1EF}\u{1F1F5}":["Japan","\u65E5\u672C","\u4E1C\u4EAC","\u5927\u962A","\u57FC\u7389","\u6CAA\u65E5","\u7A57\u65E5","\u5DDD\u65E5","\u4E2D\u65E5","\u6CC9\u65E5","\u676D\u65E5","\u6DF1\u65E5","\u8FBD\u65E5","\u5E7F\u65E5","\u5927\u5742","Osaka","Tokyo"],"\u{1F1F0}\u{1F1EA}":["Kenya","\u80AF\u5C3C\u4E9A"],"\u{1F1F0}\u{1F1EC}":["Kyrgyzstan","\u5409\u5C14\u5409\u65AF\u65AF\u5766"],"\u{1F1F0}\u{1F1ED}":["Cambodia","\u67EC\u57D4\u5BE8"],"\u{1F1F0}\u{1F1F5}":["North Korea","\u671D\u9C9C"],"\u{1F1F0}\u{1F1F7}":["Korea","\u97E9\u56FD","\u97D3\u570B","\u97E9","\u97D3","\u9996\u5C14","\u6625\u5DDD","Chuncheon","Seoul"],"\u{1F1F0}\u{1F1FF}":["Kazakhstan","\u54C8\u8428\u514B\u65AF\u5766","\u54C8\u8428\u514B"],"\u{1F1EE}\u{1F1E9}":["Indonesia","\u5370\u5C3C","\u5370\u5EA6\u5C3C\u897F\u4E9A","\u96C5\u52A0\u8FBE"],"\u{1F1EE}\u{1F1EA}":["Ireland","\u7231\u5C14\u5170","\u611B\u723E\u862D","\u90FD\u67CF\u6797"],"\u{1F1EE}\u{1F1F1}":["Israel","\u4EE5\u8272\u5217"],"\u{1F1EE}\u{1F1F2}":["Isle of Man","\u9A6C\u6069\u5C9B","\u99AC\u6069\u5CF6"],"\u{1F1EE}\u{1F1F3}":["India","\u5370\u5EA6","\u5B5F\u4E70","MFumbai","Mumbai"],"\u{1F1EE}\u{1F1F7}":["Iran","\u4F0A\u6717"],"\u{1F1EE}\u{1F1F8}":["Iceland","\u51B0\u5C9B","\u51B0\u5CF6"],"\u{1F1EE}\u{1F1F9}":["Italy","\u610F\u5927\u5229","\u7FA9\u5927\u5229","\u7C73\u5170","Nachash"],"\u{1F1F1}\u{1F1F0}":["Sri Lanka","\u65AF\u91CC\u5170\u5361","\u65AF\u91CC\u862D\u5361"],"\u{1F1F1}\u{1F1E6}":["Laos","\u8001\u631D","\u8001\u64BE"],"\u{1F1F1}\u{1F1F9}":["Lithuania","\u7ACB\u9676\u5B9B"],"\u{1F1F1}\u{1F1FA}":["Luxembourg","\u5362\u68EE\u5821"],"\u{1F1F1}\u{1F1FB}":["Latvia","\u62C9\u8131\u7EF4\u4E9A","Latvija"],"\u{1F1F2}\u{1F1E6}":["Morocco","\u6469\u6D1B\u54E5"],"\u{1F1F2}\u{1F1E9}":["Moldova","\u6469\u5C14\u591A\u74E6","\u6469\u723E\u591A\u74E6"],"\u{1F1F2}\u{1F1F2}":["Myanmar","\u7F05\u7538","\u7DEC\u7538"],"\u{1F1F3}\u{1F1EC}":["Nigeria","\u5C3C\u65E5\u5229\u4E9A","\u5C3C\u65E5\u5229\u4E9E"],"\u{1F1F2}\u{1F1F0}":["Macedonia","\u9A6C\u5176\u987F","\u99AC\u5176\u9813"],"\u{1F1F2}\u{1F1F3}":["Mongolia","\u8499\u53E4"],"\u{1F1F2}\u{1F1F4}":["Macao","\u6FB3\u95E8","\u6FB3\u9580","CTM"],"\u{1F1F2}\u{1F1F9}":["Malta","\u9A6C\u8033\u4ED6"],"\u{1F1F2}\u{1F1FD}":["Mexico","\u58A8\u897F\u54E5"],"\u{1F1F2}\u{1F1FE}":["Malaysia","\u9A6C\u6765","\u99AC\u4F86","\u5409\u9686\u5761","\u5927\u99AC"],"\u{1F1F3}\u{1F1F1}":["Netherlands","\u8377\u5170","\u8377\u862D","\u5C3C\u5FB7\u862D","\u963F\u59C6\u65AF\u7279\u4E39","Amsterdam"],"\u{1F1F3}\u{1F1F4}":["Norway","\u632A\u5A01"],"\u{1F1F3}\u{1F1F5}":["Nepal","\u5C3C\u6CCA\u5C14"],"\u{1F1F3}\u{1F1FF}":["New Zealand","\u65B0\u897F\u5170","\u65B0\u897F\u862D"],"\u{1F1F4}\u{1F1F2}":["Oman","\u963F\u66FC","\u9A6C\u65AF\u5580\u7279"],"\u{1F1F5}\u{1F1E6}":["Panama","\u5DF4\u62FF\u9A6C"],"\u{1F1F5}\u{1F1EA}":["Peru","\u79D8\u9C81","\u7955\u9B6F"],"\u{1F1F5}\u{1F1ED}":["Philippines","\u83F2\u5F8B\u5BBE","\u83F2\u5F8B\u8CD3"],"\u{1F1F5}\u{1F1F0}":["Pakistan","\u5DF4\u57FA\u65AF\u5766"],"\u{1F1F5}\u{1F1F1}":["Poland","\u6CE2\u5170","\u6CE2\u862D","\u534E\u6C99","Warsaw"],"\u{1F1F5}\u{1F1F7}":["Puerto Rico","\u6CE2\u591A\u9ECE\u5404"],"\u{1F1F5}\u{1F1F9}":["Portugal","\u8461\u8404\u7259"],"\u{1F1F5}\u{1F1EC}":["Papua New Guinea","\u5DF4\u5E03\u4E9A\u65B0\u51E0\u5185\u4E9A"],"\u{1F1F5}\u{1F1FE}":["Paraguay","\u5DF4\u62C9\u572D"],"\u{1F1F6}\u{1F1E6}":["Qatar","\u5361\u5854\u5C14","\u5361\u5854\u723E"],"\u{1F1F7}\u{1F1F4}":["Romania","\u7F57\u9A6C\u5C3C\u4E9A"],"\u{1F1F7}\u{1F1F8}":["Serbia","\u585E\u5C14\u7EF4\u4E9A"],"\u{1F1F7}\u{1F1EA}":["R\xE9union","\u7559\u5C3C\u6C6A","\u6CD5\u5C5E\u7559\u5C3C\u6C6A"],"\u{1F1F7}\u{1F1FA}":["Russia","\u4FC4\u7F57\u65AF","\u4FC4\u56FD","\u4FC4\u7F85\u65AF","\u4F2F\u529B","\u83AB\u65AF\u79D1","\u5723\u5F7C\u5F97\u5821","\u897F\u4F2F\u5229\u4E9A","\u4EAC\u4FC4","\u676D\u4FC4","\u5EE3\u4FC4","\u6EEC\u4FC4","\u5E7F\u4FC4","\u6CAA\u4FC4","Moscow"],"\u{1F1F8}\u{1F1E6}":["Saudi","\u6C99\u7279\u963F\u62C9\u4F2F","\u6C99\u7279","Riyadh","\u5229\u96C5\u5F97"],"\u{1F1F8}\u{1F1EA}":["Sweden","\u745E\u5178","\u65AF\u5FB7\u54E5\u5C14\u6469","Stockholm"],"\u{1F1F8}\u{1F1EC}":["Singapore","\u65B0\u52A0\u5761","\u72EE\u57CE","\u6CAA\u65B0","\u4EAC\u65B0","\u4E2D\u65B0","\u6CC9\u65B0","\u7A57\u65B0","\u6DF1\u65B0","\u676D\u65B0","\u5E7F\u65B0","\u5EE3\u65B0","\u6EEC\u65B0"],"\u{1F1F8}\u{1F1EE}":["Slovenia","\u65AF\u6D1B\u6587\u5C3C\u4E9A"],"\u{1F1F8}\u{1F1F0}":["Slovakia","\u65AF\u6D1B\u4F10\u514B"],"\u{1F1F9}\u{1F1EC}":["Togo","\u591A\u54E5","\u6D1B\u7F8E","Lom\xE9","Lome"],"\u{1F1F9}\u{1F1ED}":["Thailand","\u6CF0\u56FD","\u6CF0\u570B","\u66FC\u8C37"],"\u{1F1F9}\u{1F1F3}":["Tunisia","\u7A81\u5C3C\u65AF"],"\u{1F1F9}\u{1F1F7}":["Turkey","\u571F\u8033\u5176","\u4F0A\u65AF\u5766\u5E03\u5C14","Istanbul"],"\u{1F1F9}\u{1F1FC}":["Taiwan","\u53F0\u6E7E","\u81FA\u7063","\u53F0\u7063","\u4E2D\u83EF\u6C11\u570B","\u4E2D\u534E\u6C11\u56FD","\u53F0\u5317","\u53F0\u4E2D","\u65B0\u5317","\u5F70\u5316","\u53F0","\u81FA","Taipei","Tai Wan"],"\u{1F1FA}\u{1F1E6}":["Ukraine","\u4E4C\u514B\u5170","\u70CF\u514B\u862D"],"\u{1F1FA}\u{1F1F8}":["United States","\u7F8E\u56FD","America","\u7F8E","\u4EAC\u7F8E","\u6CE2\u7279\u5170","\u8FBE\u62C9\u65AF","\u4FC4\u52D2\u5188","Oregon","\u51E4\u51F0\u57CE","\u8D39\u5229\u8499","\u7845\u8C37","\u77FD\u8C37","\u62C9\u65AF\u7EF4\u52A0\u65AF","\u6D1B\u6749\u77F6","\u5723\u4F55\u585E","\u5723\u514B\u62C9\u62C9","\u897F\u96C5\u56FE","\u829D\u52A0\u54E5","\u6CAA\u7F8E","\u54E5\u4F26\u5E03","\u7EBD\u7EA6","New York","Los Angeles","San Jose","Sillicon Valley","Michigan","\u4FC4\u4EA5\u4FC4","Ohio","\u9A6C\u7EB3\u8428\u65AF","Manassas","\u5F17\u5409\u5C3C\u4E9A","Virginia"],"\u{1F1FA}\u{1F1FE}":["Uruguay","\u4E4C\u62C9\u572D"],"\u{1F1FB}\u{1F1E6}":["Vatican","Vatican City","Holy See","\u68B5\u8482\u5188","\u68B5\u8482\u5CA1"],"\u{1F1FB}\u{1F1EA}":["Venezuela","\u59D4\u5185\u745E\u62C9"],"\u{1F1FB}\u{1F1F3}":["Vietnam","\u8D8A\u5357","\u80E1\u5FD7\u660E"],"\u{1F1FF}\u{1F1E6}":["South Africa","\u5357\u975E"],"\u{1F1E8}\u{1F1F3}":["China","\u4E2D\u56FD","\u4E2D\u570B","\u56DE\u56FD","\u56DE\u570B","\u56FD\u5185","\u570B\u5167","\u534E\u4E1C","\u534E\u897F","\u534E\u5357","\u534E\u5317","\u534E\u4E2D","\u6C5F\u82CF","\u5317\u4EAC","\u4E0A\u6D77","\u5E7F\u5DDE","\u6DF1\u5733","\u676D\u5DDE","\u5F90\u5DDE","\u9752\u5C9B","\u5B81\u6CE2","\u9547\u6C5F"]},r=e.match(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]/)?.[0]||"\u{1F3F4}\u200D\u2620\uFE0F";for(let n of Object.keys(t))if(t[n].some(a=>RegExp(`${a}`,"i").test(e)))return/内蒙古/.test(e)&&["\u{1F1F2}\u{1F1F3}"].includes(n)?r="\u{1F1E8}\u{1F1F3}":r=n;for(let n of Object.keys(Ng))if(Ng[n].some(a=>RegExp(`(^|[^a-zA-Z])${a}([^a-zA-Z]|$)`).test(e))&&!(n=="\u{1F1E8}\u{1F1F3}"&&RegExp("(^|[^a-zA-Z])CN2([^a-zA-Z]|$)").test(e)))return r=n;return r}function Vy(e){return Ng[zc(e)]?.[0]}function mf(e){return e.replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]|🏴‍☠️|🏳️‍🌈/g,"").trim()}var ud=class{constructor({country,asn}={}){if(se.env.isNode){let Reader=eval('require("@maxmind/geoip2-node")').Reader,fs=eval("require('fs')"),countryFile=country||eval("process.env.SUB_STORE_MMDB_COUNTRY_PATH"),asnFile=asn||eval("process.env.SUB_STORE_MMDB_ASN_PATH");if(countryFile&&(this.countryReader=Reader.openBuffer(fs.readFileSync(countryFile))),asnFile){if(!fs.existsSync(asnFile))throw new Error("GeoLite2 ASN MMDB does not exist");this.asnReader=Reader.openBuffer(fs.readFileSync(asnFile))}}}geoip(e){return this.countryReader?.country(e)?.country?.isoCode}ipaso(e){return this.asnReader?.asn(e)?.autonomousSystemOrganization}ipasn(e){return this.asnReader?.asn(e)?.autonomousSystemNumber}};var ld=yn(t_()),Gg=yn(p0());async function Yc({url:e,domain:t,type:r="A",timeout:n,edns:i}){let a=ld.default.encode({type:"query",id:0,flags:ld.default.RECURSION_DESIRED,questions:[{type:r,name:t}],additionals:[{type:"OPT",name:".",udpPayloadSize:4096,flags:0,options:[{code:"CLIENT_SUBNET",ip:i,sourcePrefixLength:Tr(i)?24:56,scopePrefixLength:0}]}]}),u=Gg.Buffer.from(a).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),c=await se.http.get({url:`${e}?dns=${encodeURIComponent(u)}`,headers:{Accept:"application/dns-message"},"binary-mode":!0,encoding:null,timeout:n});return ld.default.decode(Gg.Buffer.from(se.env.isQX?c.bodyBytes:c.body))}var Xg=yn(Yg());var fd="2.20.58";var{isNode:r_,isQX:eO,isLoon:tO,isSurge:rO,isStash:nO,isShadowRocket:iO,isLanceX:sO,isEgern:aO,isGUIforCores:uO}=js(),Qs="Node";r_&&(Qs="Node");eO&&(Qs="QX");tO&&(Qs="Loon");rO&&(Qs="Surge");nO&&(Qs="Stash");iO&&(Qs="Shadowrocket");aO&&(Qs="Egern");sO&&(Qs="LanceX");uO&&(Qs="GUI.for.Cores");var Ro={},oO={};try{if(typeof $environment<"u"&&(Ro.env=$environment),typeof $loon<"u"&&(Ro.loon=$loon),typeof $script<"u"&&(Ro.script=$script),typeof $Plugin<"u"&&(Ro.plugin=$Plugin),r_){Ro.node={version:eval("process.version"),argv:eval("process.argv"),filename:eval("__filename"),dirname:eval("__dirname"),env:{}};let env=eval("process.env");for(let e in env)/^SUB_STORE_/.test(e)&&(Ro.node.env[e]=env[e])}}catch(e){}var Af={backend:Qs,version:fd,feature:oO,meta:Ro};function cO(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Ef(e){return e.startsWith("<")&&e.endsWith(">")?e.slice(1,-1):e}function i_(e,t){let r=typeof t=="string"?JSON.parse(t):t;for(let n in r)if(cO(r[n]))if(n.endsWith("!")){let i=Ef(n.slice(0,-1));e[i]=r[n]}else{let i=Ef(n);e[i]||Object.assign(e,{[i]:{}}),i_(e[i],r[i])}else if(Array.isArray(r[n]))if(n.startsWith("+")){let i=Ef(n.slice(1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...r[n],...e[i]]}else if(n.endsWith("+")){let i=Ef(n.slice(0,-1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...e[i],...r[n]]}else{let i=Ef(n);Object.assign(e,{[i]:r[n]})}else Object.assign(e,{[n]:r[n]});return e}function lO({rule:e}){return{name:"Conditional Filter",func:t=>t.map(r=>hd(e,r))}}function hd(e,t){if(!e.operator)switch(e.proposition){case"IN":return e.value.indexOf(t[e.attr])!==-1;case"CONTAINS":return typeof t[e.attr]!="string"?!1:t[e.attr].indexOf(e.value)!==-1;case"EQUALS":return t[e.attr]===e.value;case"EXISTS":return t[e.attr]!==null||typeof t[e.attr]<"u";default:throw new Error(`Unknown proposition: ${e.proposition}`)}switch(e.operator){case"AND":return e.child.every(r=>hd(r,t));case"OR":return e.child.some(r=>hd(r,t));case"NOT":return!hd(e.child,t);default:throw new Error(`Unknown operator: ${e.operator}`)}}function fO(e){return{name:"Quick Setting Operator",func:r=>{if(t(e.useless)){let i=o_().func(r);r=r.filter((a,s)=>i[s]&&a.port>0&&a.port<=65535)}return r.map(n=>(n.udp=t(e.udp,n.udp),n.tfo=t(e.tfo,n.tfo),n["fast-open"]=t(e.tfo,n["fast-open"]),n["skip-cert-verify"]=t(e.scert,n["skip-cert-verify"]),n.type==="vmess"&&(n.aead=t(e["vmess aead"],n.aead)),n))}};function t(r,n){switch(r){case"ENABLED":return!0;case"DISABLED":return!1;default:return n}}}function hO({mode:e,tw:t}){return{name:"Flag Operator",func:r=>r.map(n=>{if(e==="remove")n.name=mf(n.name);else{let i=zc(n.name);n.name=mf(n.name),n.name=i+" "+n.name,t=="ws"?n.name=n.name.replace(/🇹🇼/g,"\u{1F1FC}\u{1F1F8}"):t=="tw"||(n.name=n.name.replace(/🇹🇼/g,"\u{1F1E8}\u{1F1F3}"))}return n})}}function dO(e){let{action:t,template:r,link:n,position:i}={action:"rename",template:"0 1 2 3 4 5 6 7 8 9",link:"-",position:"back",...e};return{name:"Handle Duplicate Operator",func:a=>{if(t==="delete"){let s={};return a.filter(u=>s[u.name]?!1:(s[u.name]=!0,!0))}else if(t==="rename"){let s=r.split(" "),u={},c=0;a.forEach(d=>{typeof u[d.name]>"u"?u[d.name]=1:u[d.name]++,c=Math.max(u[d.name].toString().length,c)});let f={};return a.map(d=>{if(u[d.name]>1){typeof f[d.name]>"u"&&(f[d.name]=1);let v="",p=f[d.name]++,h=0;for(;p>0;)v=s[p%10]+v,p=parseInt(p/10),h++;for(;h++{switch(e){case"asc":case"desc":return t.sort((r,n)=>{let i=r.name>n.name?1:-1;return i*=e==="desc"?-1:1,i});case"random":return DO(t);default:throw new Error("Unknown sort option: "+e)}}}}function gO(e){let t=e.order||"asc",r=e.expressions;return Array.isArray(e)&&(r=e),Array.isArray(r)||(r=[]),{name:"Regex Sort Operator",func:n=>(r=r.map(i=>Zg(i)),n.sort((i,a)=>{let s=n_(r,i.name),u=n_(r,a.name);return s&&!u?-1:u&&!s?1:s&&u?st.map(r=>{for(let{expr:n,now:i}of e)r.name=r.name.replace(Zg(n,"g"),i).trim();return r})}}function mO(e){let t=e.map(r=>({expr:r,now:""}));return{name:"Regex Delete Operator",func:s_(t).func}}function vO(e,t,r,n,i){return{name:"Script Operator",func:async a=>{let s=a;if(s?.$file?.type==="mihomoProfile")try{let u=Ls.safeLoad(e),c;if(s?.$content)try{c=Ls.safeLoad(s?.$content)}catch(f){se.error(f.message??f)}if(typeof u!="object")throw new Error("patch is not an object");return s.$content=Wt.yaml.safeDump(i_(c||(s?.$file?.sourceType==="none"?{}:{proxies:await xu({type:s?.$file?.sourceType||"collection",name:s?.$file?.sourceName,platform:"mihomo",produceType:"internal",produceOpts:{"delete-underscore-fields":!0}})}),u)),s}catch{}return await async function(){s=dd("operator",e,r,i)(a,t,{source:n,...Af})}(),s},nodeFunc:async a=>{let s=a;return await async function(){s=dd("operator",`async function operator(input = []) { if (input && (input.$files || input.$content)) { let { $content, $files, $options, $file } = input if($file.type === 'mihomoProfile') { ${e} if(typeof main === 'function') { let config; if ($content) { try { config = ProxyUtils.yaml.safeLoad($content); } catch (e) { console.log(e.message ?? e); } } $content = ProxyUtils.yaml.safeDump(await main(config || ($file.sourceType === 'none' ? {} : { proxies: await produceArtifact({ type: $file.sourceType || 'collection', name: $file.sourceName, platform: 'mihomo', produceType: 'internal', produceOpts: { 'delete-underscore-fields': true } }), }))) } } else { ${e} } return { $content, $files, $options, $file } } else { let proxies = input let list = [] for await (let $server of proxies) { ${e} list.push($server) } return list } }`,r,i)(a,t,{source:n,...Af})}(),s}}}function wO(e){let t,r;try{let n=e.split(":");r=parseInt(n[2],16);let i=parseInt(n[3],16),a=parseInt(n[4],16),s=i>>8,u=i&255,c=a>>8,f=a&255;if(t=`${s}.${u}.${c}.${f}`,r<=0||r>65535)throw new Error(`Invalid port number: ${r}`);if(!Tr(t))throw new Error(`Invalid IP address: ${t}`)}catch(n){se.error(`IP4P \u89E3\u6790\u5931\u8D25: ${n}`)}return{server:t,port:r}}var a_={Custom:async function(e,t,r,n,i,a){let s=cs(`CUSTOM:${a}:${e}:${t}`),u=Zr.get(s);if(!r&&u)return u;let c=t==="IPv6"?"AAAA":"A",f=await Yc({url:a,domain:e,type:c,timeout:n,edns:i}),{answers:d}=f;if(!Array.isArray(d)||d.length===0)throw new Error("No answers");let v=d.filter(p=>p?.type===c).map(p=>p?.data).filter(p=>p);if(v.length===0)throw new Error("No answers");return Zr.set(s,v),v},Google:async function(e,t,r,n,i){let a=cs(`GOOGLE:${e}:${t}`),s=Zr.get(a);if(!r&&s)return s;let u=t==="IPv6"?"AAAA":"A",c=await Yc({url:"https://8.8.4.4/dns-query",domain:e,type:u,timeout:n,edns:i}),{answers:f}=c;if(!Array.isArray(f)||f.length===0)throw new Error("No answers");let d=f.filter(v=>v?.type===u).map(v=>v?.data).filter(v=>v);if(d.length===0)throw new Error("No answers");return Zr.set(a,d),d},"IP-API":async function(e,t,r,n){if(["IPv6"].includes(t))throw new Error(`\u57DF\u540D\u89E3\u6790\u670D\u52A1\u63D0\u4F9B\u65B9 IP-API \u4E0D\u652F\u6301 ${t}`);let i=cs(`IP-API:${e}`),a=Zr.get(i);if(!r&&a)return a;let s=await se.http.get({url:`http://ip-api.com/json/${encodeURIComponent(e)}?lang=zh-CN`,timeout:n}),u=JSON.parse(s.body);if(u.status!=="success")throw new Error(`Status is ${u.status}`);if(!u.query||u.query===0)throw new Error("No answers");let c=[u.query];if(c.length===0)throw new Error("No answers");return Zr.set(i,c),c},Cloudflare:async function(e,t,r,n,i){let a=cs(`CLOUDFLARE:${e}:${t}`),s=Zr.get(a);if(!r&&s)return s;let u=t==="IPv6"?"AAAA":"A",c=await Yc({url:"https://1.0.0.1/dns-query",domain:e,type:u,timeout:n,edns:i}),{answers:f}=c;if(!Array.isArray(f)||f.length===0)throw new Error("No answers");let d=f.filter(v=>v?.type===u).map(v=>v?.data).filter(v=>v);if(d.length===0)throw new Error("No answers");return Zr.set(a,d),d},Ali:async function(e,t,r,n,i){let a=cs(`ALI:${e}:${t}`),s=Zr.get(a);if(!r&&s)return s;let u=await se.http.get({url:`http://223.6.6.6/resolve?edns_client_subnet=${i}/${Tr(i)?24:56}&name=${encodeURIComponent(e)}&type=${t==="IPv6"?"AAAA":"A"}&short=1`,headers:{accept:"application/dns-json"},timeout:n}),c=JSON.parse(u.body);if(!Array.isArray(c)||c.length===0)throw new Error("No answers");let f=c;if(f.length===0)throw new Error("No answers");return Zr.set(a,f),f},Tencent:async function(e,t,r,n,i){let a=cs(`TENCENT:${e}:${t}`),s=Zr.get(a);if(!r&&s)return s;let c=(await se.http.get({url:`http://119.28.28.28/d?ip=${i}&type=${t==="IPv6"?"AAAA":"A"}&dn=${encodeURIComponent(e)}`,headers:{accept:"application/dns-json"},timeout:n})).body.split(";").map(d=>d.split(",")[0]);if(c.length===0||String(c)==="0")throw new Error("No answers");let f=c;if(f.length===0)throw new Error("No answers");return Zr.set(a,f),f}};function u_({provider:e,type:t,filter:r,cache:n,url:i,timeout:a,edns:s}){if(["IPv6","IP4P"].includes(t)&&["IP-API"].includes(e))throw new Error(`\u57DF\u540D\u89E3\u6790\u670D\u52A1\u63D0\u4F9B\u65B9 ${e} \u4E0D\u652F\u6301 ${t}`);let{defaultTimeout:u}=se.read(Na),c=a||u||8e3,f=["IPv6","IP4P"].includes(t)?"IPv6":"IPv4",d=a_[e];if(!d)throw new Error(`\u627E\u4E0D\u5230\u57DF\u540D\u89E3\u6790\u670D\u52A1\u63D0\u4F9B\u65B9: ${e}`);let v=s||"223.6.6.6";if(!To(v))throw new Error("\u57DF\u540D\u89E3\u6790 EDNS \u5E94\u4E3A IP");return se.info(`Domain Resolver: [${t}] ${e} ${v||""} ${i||""}`),{name:"Resolve Domain Operator",func:async p=>{p.forEach((g,b)=>{!g["_no-resolve"]&&g["no-resolve"]&&(p[b]["_no-resolve"]=g["no-resolve"])});let h={},w=15,m=[...new Set(p.filter(g=>!To(g.server)&&!g["_no-resolve"]).map(g=>g.server))],y=Math.ceil(m.length/w);for(let g=0;g{h[D]=C,se.info(`Successfully resolved domain: ${D} \u279F ${C}`)}).catch(C=>{se.error(`Failed to resolve domain: ${D} with resolver [${e}]: ${C}`)}));await Promise.all(b)}return p.forEach(g=>{if(!g["_no-resolve"])if(h[g.server]){g._resolved_ips=h[g.server];let b=Array.isArray(h[g.server])?h[g.server][Math.floor(Math.random()*h[g.server].length)]:h[g.server];if(f==="IPv6"&&Mr(b)){try{b=new Q0.Address6(b).correctForm()}catch(D){se.error(`Failed to parse IPv6 address: ${b}: ${D}`)}if(/^2001::[^:]+:[^:]+:[^:]+$/.test(b)){g._IP4P=b;let{server:D,port:C}=wO(b);D&&C?(g._domain=g.server,g.server=D,g.port=C,g.resolved=!0,g._IPv4=g.server,To(g._IP)||(g._IP=g.server)):g.resolved||(g.resolved=!1)}else g._domain=g.server,g.server=b,g.resolved=!0,g[`_${f}`]=g.server,To(g._IP)||(g._IP=g.server)}else g._domain=g.server,g.server=b,g.resolved=!0,g[`_${f}`]=g.server,To(g._IP)||(g._IP=g.server)}else g.resolved||(g.resolved=!1)}),p.filter(g=>r==="removeFailed"?To(g.server)||g["_no-resolve"]||g.resolved:r==="IPOnly"?To(g.server):r==="IPv4Only"?Tr(g.server):r==="IPv6Only"?Mr(g.server):!0)}}}function To(e){return Tr(e)||Mr(e)}u_.resolver=a_;function Wg(e){var t=/^[\x00-\x7F]+$/;return t.test(e)}function o_(){return{name:"Useless Filter",func:e=>e.map(t=>{if(t.cipher&&!Wg(t.cipher))return!1;if(t.password&&!Wg(t.password))return!1;if(t.network){let r=t[`${t.network}-opts`]?.headers?.Host||t[`${t.network}-opts`]?.headers?.host;if(r=Array.isArray(r)?r:[r],r.some(n=>n&&!Wg(n)))return!1}return!/网址|流量|时间|应急|过期|Bandwidth|expire/.test(t.name)})}}function AO(e){let t=e?.value||e;Array.isArray(t)||(t=[]);let r=e?.keep??!0,n={HK:"\u{1F1ED}\u{1F1F0}",TW:"\u{1F1F9}\u{1F1FC}",US:"\u{1F1FA}\u{1F1F8}",SG:"\u{1F1F8}\u{1F1EC}",JP:"\u{1F1EF}\u{1F1F5}",UK:"\u{1F1EC}\u{1F1E7}",DE:"\u{1F1E9}\u{1F1EA}",KR:"\u{1F1F0}\u{1F1F7}"};return{name:"Region Filter",func:i=>i.map(a=>{let s=zc(a.name),u=t.some(c=>n[c]===s);return r?u:!u})}}function EO({regex:e=[],keep:t=!0}){return{name:"Regex Filter",func:r=>r.map(n=>{let i=e.some(a=>Zg(a).test(n.name));return t?i:!i})}}function Zg(e,...t){return t=t.join(""),e.startsWith("(?i)")?(e=e.substring(4),new RegExp(e,"i"+t)):new RegExp(e,t)}function bO(e){let t=e?.value||e;Array.isArray(t)||(t=[]);let r=e?.keep??!0;return{name:"Type Filter",func:n=>n.map(i=>{let a=t.some(s=>i.type===s);return r?a:!a})}}function yO(e,t,r,n,i){return{name:"Script Filter",func:async a=>{let s=ad(a.length,!0);return await async function(){s=dd("filter",e,r,i)(a,t,{source:n,...Af})}(),s},nodeFunc:async a=>{let s=ad(a.length,!0);return await async function(){s=dd("filter",`async function filter(input = []) { let proxies = input let list = [] const fn = async ($server) => { ${e} } for await (let $server of proxies) { list.push(await fn($server)) } return list }`,r,i)(a,t,{source:n,...Af})}(),s}}}var pd={"Useless Filter":o_,"Region Filter":AO,"Regex Filter":EO,"Type Filter":bO,"Script Filter":yO,"Conditional Filter":lO,"Quick Setting Operator":fO,"Flag Operator":hO,"Sort Operator":pO,"Regex Sort Operator":gO,"Regex Rename Operator":s_,"Regex Delete Operator":mO,"Script Operator":vO,"Handle Duplicate Operator":dO,"Resolve Domain Operator":u_};async function _O(e,t){let r=ad(t.length,!0);try{r=await e.func(t)}catch(n){let i="",a=`${n.message??n}`;a.includes("$server is not defined")?i="":(se.error(`Cannot apply filter ${e.name}(function filter)! Reason: ${n}`),i=`\u6267\u884C function filter \u5931\u8D25 ${a}; `);try{r=await e.nodeFunc(t)}catch(s){se.error(`Cannot apply filter ${e.name}(shortcut script)! Reason: ${s}`);let u="",c=`${s.message??s}`;throw i&&c===a?(u="",i=`\u6267\u884C\u5931\u8D25 ${a}`):u=`\u6267\u884C\u5FEB\u6377\u8FC7\u6EE4\u811A\u672C \u5931\u8D25 ${c}`,new Error(`\u811A\u672C\u8FC7\u6EE4 ${i}${u}`)}}return t.filter((n,i)=>r[i])}async function CO(e,t){let r=FO(t);try{let n=await e.func(r);n&&(r=n)}catch(n){let i="",a=`${n.message??n}`;a.includes("$server is not defined")||a.includes("$content is not defined")||a.includes("$files is not defined")||r?.$files||r?.$content?i="":(se.error(`Cannot apply operator ${e.name}(function operator)! Reason: ${n}`),i=`\u6267\u884C function operator \u5931\u8D25 ${a}; `);try{let s=await e.nodeFunc(r);s&&(r=s)}catch(s){se.error(`Cannot apply operator ${e.name}(shortcut script)! Reason: ${s}`);let u="",c=`${s.message??s}`;throw i&&c===a?(u="",i=`\u6267\u884C\u5931\u8D25 ${a}`):u=`\u6267\u884C\u5FEB\u6377\u811A\u672C \u5931\u8D25 ${c}`,new Error(`\u811A\u672C\u64CD\u4F5C ${i}${u}`)}}return r}async function c_(e,t){if(e.name.indexOf("Filter")!==-1)return _O(e,t);if(e.name.indexOf("Operator")!==-1)return CO(e,t)}function DO(e){let t=e.length,r,n;for(;t!==0;)n=Math.floor(Math.random()*t),t-=1,r=e[t],e[t]=e[n],e[n]=r;return e}function FO(e){return JSON.parse(JSON.stringify(e))}function dd(name,script,$arguments,$options){let flowUtils={getFlowField:Vc,getFlowHeaders:td,parseFlowHeaders:rd,flowTransfer:gf,validCheck:nd,getRmainingDays:ky,normalizeFlowHeader:Ny};return se.env.isLoon?new Function("$arguments","$options","$substore","lodash","$persistentStore","$httpClient","$notification","ProxyUtils","yaml","Buffer","b64d","b64e","scriptResourceCache","flowUtils","produceArtifact","require",`${script} return ${name}`)($arguments,$options,se,Xg.default,$persistentStore,$httpClient,$notification,Wt,Wt.yaml,Wt.Buffer,Wt.Base64.decode,Wt.Base64.encode,kg,flowUtils,xu,eval('typeof require !== "undefined"')?go:void 0):new Function("$arguments","$options","$substore","lodash","ProxyUtils","yaml","Buffer","b64d","b64e","scriptResourceCache","flowUtils","produceArtifact","require",`${script} return ${name}`)($arguments,$options,se,Xg.default,Wt,Wt.yaml,Wt.Buffer,Wt.Base64.decode,Wt.Base64.encode,kg,flowUtils,xu,eval('typeof require !== "undefined"')?go:void 0)}var l_=yn(Yg()),at=class{constructor(t){this.proxy=t,this.output=[]}append(t){if(typeof t>"u")throw new Error("required field is missing");this.output.push(t)}appendIfPresent(t,r){ue(this.proxy,r)&&this.append(t)}toString(){return this.output.join("")}};function ue(e,t){let r=l_.default.get(e,t);return typeof r<"u"&&r!==null}var f_="Surge",Ti={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function Xc(){return{produce:(t,r,n={})=>{switch(t.name=t.name.replace(/=|,/g,""),t.ports&&(t.ports=String(t.ports)),t.type){case"ss":return SO(t,n["include-unsupported-proxy"]);case"trojan":return IO(t);case"vmess":return PO(t,n["include-unsupported-proxy"]);case"http":return xO(t);case"direct":return RO(t);case"socks5":return TO(t);case"snell":return OO(t);case"tuic":return kO(t);case"wireguard-surge":return LO(t);case"hysteria2":return UO(t);case"ssh":return $O(t)}if(n["include-unsupported-proxy"]&&t.type==="wireguard")return NO(t);if(n["include-unsupported-proxy"]&&t.type==="anytls"){if(t.network&&(!["tcp"].includes(t.network)||["tcp"].includes(t.network)&&t["reality-opts"]))throw new Error(`Platform ${f_} does not support proxy type ${t.type} with network or reality`);return BO(t)}throw new Error(`Platform ${f_} does not support proxy type: ${t.type}`)}}}function SO(e){let t=new at(e);if(t.append(`${e.name}=${e.type},${e.server},${e.port}`),e.cipher||(e.cipher="none"),!["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","cast5-cfb","des-cfb","idea-cfb","rc2-cfb","seed-cfb","salsa20","chacha20","chacha20-ietf","none","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(e.cipher))throw new Error(`cipher ${e.cipher} is not supported`);t.append(`,encrypt-method=${e.cipher}`),t.appendIfPresent(`,password="${e.password}"`,"password");let r=Ti[e["ip-version"]]||e["ip-version"];if(t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),ue(e,"plugin")){if(e.plugin==="obfs")t.append(`,obfs=${e["plugin-opts"].mode}`),t.appendIfPresent(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),t.appendIfPresent(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path");else if(!["shadow-tls"].includes(e.plugin))throw new Error(`plugin ${e.plugin} is not supported`)}if(t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,interface=${e.interface}`,"interface"),ue(e,"shadow-tls-password"))t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni"),t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port");else if(["shadow-tls"].includes(e.plugin)&&e["plugin-opts"]){let n=e["plugin-opts"].password,i=e["plugin-opts"].host,a=e["plugin-opts"].version;if(n){if(t.append(`,shadow-tls-password=${n}`),i&&t.append(`,shadow-tls-sni=${i}`),a){if(a<2)throw new Error(`shadow-tls version ${a} is not supported`);t.append(`,shadow-tls-version=${a}`)}t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port")}}return t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function IO(e){let t=new at(e);t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password");let r=Ti[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),h_(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,interface=${e.interface}`,"interface"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function BO(e){let t=new at(e);t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password");let r=Ti[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,interface=${e.interface}`,"interface"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),t.toString()}function PO(e,t){let r=new at(e);r.append(`${e.name}=${e.type},${e.server},${e.port}`),r.appendIfPresent(`,username=${e.uuid}`,"uuid");let n=Ti[e["ip-version"]]||e["ip-version"];return r.appendIfPresent(`,ip-version=${n}`,"ip-version"),r.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),h_(r,e,t),ue(e,"aead")?r.append(`,vmess-aead=${e.aead}`):r.append(`,vmess-aead=${e.alterId===0}`),r.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),r.appendIfPresent(`,tls=${e.tls}`,"tls"),r.appendIfPresent(`,sni=${e.sni}`,"sni"),r.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),r.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),r.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),r.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),r.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),r.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),r.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),r.appendIfPresent(`,tos=${e.tos}`,"tos"),r.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),r.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),r.appendIfPresent(`,interface=${e.interface}`,"interface"),ue(e,"shadow-tls-password")&&(r.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),r.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),r.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),r.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),r.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),r.toString()}function $O(e){let t=new at(e);t.append(`${e.name}=ssh,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),t.appendIfPresent(`,private-key=${e["keystore-private-key"]}`,"keystore-private-key"),t.appendIfPresent(`,idle-timeout=${e["idle-timeout"]}`,"idle-timeout"),t.appendIfPresent(`,server-fingerprint="${e["server-fingerprint"]}"`,"server-fingerprint");let r=Ti[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,interface=${e.interface}`,"interface"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function xO(e){if(e.headers&&Object.keys(e.headers).length>0)throw new Error("headers is unsupported");let t=new at(e),r=e.tls?"https":"http";t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password");let n=Ti[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${n}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,interface=${e.interface}`,"interface"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function RO(e){let t=new at(e);t.append(`${e.name}=direct`);let n=Ti[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${n}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,interface=${e.interface}`,"interface"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function TO(e){let t=new at(e),r=e.tls?"socks5-tls":"socks5";t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password");let n=Ti[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${n}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),e.tfo&&se.info("Option tfo is not supported by Surge, thus omitted"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,interface=${e.interface}`,"interface"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function OO(e){let t=new at(e);t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,version=${e.version}`,"version"),t.appendIfPresent(`,psk=${e.psk}`,"psk");let r=Ti[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,obfs=${e["obfs-opts"]?.mode}`,"obfs-opts.mode"),t.appendIfPresent(`,obfs-host=${e["obfs-opts"]?.host}`,"obfs-opts.host"),t.appendIfPresent(`,obfs-uri=${e["obfs-opts"]?.path}`,"obfs-opts.path"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,interface=${e.interface}`,"interface"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),t.toString()}function kO(e){let t=new at(e),r=e.type;(!e.token||e.token.length===0)&&(r="tuic-v5"),t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,uuid=${e.uuid}`,"uuid"),t.appendIfPresent(`,password="${e.password}"`,"password"),t.appendIfPresent(`,token=${e.token}`,"token"),t.appendIfPresent(`,alpn=${Array.isArray(e.alpn)?e.alpn[0]:e.alpn}`,"alpn"),ue(e,"ports")&&t.append(`,port-hopping="${e.ports.replace(/,/g,";")}"`),t.appendIfPresent(`,port-hopping-interval=${e["hop-interval"]}`,"hop-interval");let n=Ti[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${n}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),ue(e,"tfo")?t.append(`,tfo=${e.tfo}`):ue(e,"fast-open")&&t.append(`,tfo=${e["fast-open"]}`),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,interface=${e.interface}`,"interface"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.appendIfPresent(`,ecn=${e.ecn}`,"ecn"),t.toString()}function NO(e){Array.isArray(e.peers)&&e.peers.length>0&&(e.server=e.peers[0].server,e.port=e.peers[0].port,e.ip=e.peers[0].ip,e.ipv6=e.peers[0].ipv6,e["public-key"]=e.peers[0]["public-key"],e["preshared-key"]=e.peers[0]["pre-shared-key"],e["allowed-ips"]=e.peers[0]["allowed-ips"],e.reserved=e.peers[0].reserved);let t=new at(e);t.append(`# > WireGuard Proxy ${e.name} # ${e.name}=wireguard`),e["section-name"]=Qt(e["section-name"],e.name),t.appendIfPresent(`,section-name=${e["section-name"]}`,"section-name"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert");let r=Ti[e["ip-version"]]||e["ip-version"];t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,interface=${e.interface}`,"interface"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.append(` # > WireGuard Section ${e.name} [WireGuard ${e["section-name"]}] private-key = ${e["private-key"]}`),t.appendIfPresent(` self-ip = ${e.ip}`,"ip"),t.appendIfPresent(` self-ip-v6 = ${e.ipv6}`,"ipv6"),e.dns&&(Array.isArray(e.dns)&&(e.dns=e.dns.join(", ")),t.append(` dns-server = ${e.dns}`)),t.appendIfPresent(` mtu = ${e.mtu}`,"mtu"),r==="prefer-v6"&&t.append(` prefer-ipv6 = true`);let n=Array.isArray(e["allowed-ips"])?e["allowed-ips"].join(","):e["allowed-ips"],i=Array.isArray(e.reserved)?e.reserved.join("/"):e.reserved,a=e["preshared-key"]??e["pre-shared-key"],s={"public-key":e["public-key"],"allowed-ips":n?`"${n}"`:void 0,endpoint:`${e.server}:${e.port}`,keepalive:e["persistent-keepalive"]||e.keepalive,"client-id":i,"preshared-key":a};return t.append(` peer = (${Object.keys(s).filter(u=>s[u]!=null).map(u=>`${u} = ${s[u]}`).join(", ")})`),t.toString()}function LO(e){let t=new at(e);t.append(`${e.name}=wireguard`),t.appendIfPresent(`,section-name=${e["section-name"]}`,"section-name"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert");let r=Ti[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,interface=${e.interface}`,"interface"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function UO(e){if(e.obfs||e["obfs-password"])throw new Error("obfs is unsupported");let t=new at(e);t.append(`${e.name}=hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),ue(e,"ports")&&t.append(`,port-hopping="${e.ports.replace(/,/g,";")}"`),t.appendIfPresent(`,port-hopping-interval=${e["hop-interval"]}`,"hop-interval");let r=Ti[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),ue(e,"tfo")?t.append(`,tfo=${e.tfo}`):ue(e,"fast-open")&&t.append(`,tfo=${e["fast-open"]}`),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,interface=${e.interface}`,"interface"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.appendIfPresent(`,download-bandwidth=${`${e.down}`.match(/\d+/)?.[0]||0}`,"down"),t.appendIfPresent(`,ecn=${e.ecn}`,"ecn"),t.toString()}function h_(e,t,r){if(ue(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),ue(t,"ws-opts")&&(e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),ue(t,"ws-opts.headers"))){let n=t["ws-opts"].headers,i=Object.keys(n).map(a=>{let s=n[a];return s=`"${s}"`,`${a}:${s}`}).join("|");Ks(i)&&e.append(`,ws-headers=${i}`)}}else if(r&&["http"].includes(t.network))se.info(`Include Unsupported Proxy: network ${t.network} -> tcp`);else throw new Error(`network ${t.network} is unsupported`)}var jO={dual:"dual","v4-only":"ipv4","v6-only":"ipv6","prefer-v4":"ipv4-prefer","prefer-v6":"ipv6-prefer"};function Oi(){return{type:"ALL",produce:(r,n,i={})=>{let a=r.filter(s=>i["include-unsupported-proxy"]?!0:s.type==="snell"&&s.version>=4||["juicity","naive"].includes(s.type)||["ss"].includes(s.type)&&!["aes-128-ctr","aes-192-ctr","aes-256-ctr","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-gcm","aes-192-gcm","aes-256-gcm","aes-128-ccm","aes-192-ccm","aes-256-ccm","aes-128-gcm-siv","aes-256-gcm-siv","chacha20-ietf","chacha20","xchacha20","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","chacha8-ietf-poly1305","xchacha8-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm","2022-blake3-chacha20-poly1305","lea-128-gcm","lea-192-gcm","lea-256-gcm","rabbit128-poly1305","aegis-128l","aegis-256","aez-384","deoxys-ii-256-128","rc4-md5","none"].includes(s.cipher)||["anytls"].includes(s.type)&&s.network&&(!["tcp"].includes(s.network)||["tcp"].includes(s.network)&&s["reality-opts"])?!1:!["xhttp"].includes(s.network)).map(s=>{if(s.type==="vmess"?(ue(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ue(s,"sni")&&(s.servername=s.sni,delete s.sni),ue(s,"cipher")&&!["auto","none","zero","aes-128-gcm","chacha20-poly1305"].includes(s.cipher)&&(s.cipher="auto")):s.type==="tuic"?(ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo),(!s.token||s.token.length===0)&&!ue(s,"version")&&(s.version=5)):s.type==="hysteria"?(ue(s,"auth_str")&&!ue(s,"auth-str")&&(s["auth-str"]=s.auth_str),ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo)):s.type==="wireguard"?(s.keepalive=s.keepalive??s["persistent-keepalive"],s["persistent-keepalive"]=s.keepalive,s["preshared-key"]=s["preshared-key"]??s["pre-shared-key"],s["pre-shared-key"]=s["preshared-key"]):s.type==="snell"&&s.version<3?delete s.udp:s.type==="vless"?ue(s,"sni")&&(s.servername=s.sni,delete s.sni):s.type==="ss"&&ue(s,"shadow-tls-password")&&!ue(s,"plugin")&&(s.plugin="shadow-tls",s["plugin-opts"]={host:s["shadow-tls-sni"],password:s["shadow-tls-password"],version:s["shadow-tls-version"]},delete s["shadow-tls-password"],delete s["shadow-tls-sni"],delete s["shadow-tls-version"]),["vmess","vless"].includes(s.type)&&s.network==="http"){let u=s["http-opts"]?.path;ue(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let c=s["http-opts"]?.headers?.Host;ue(s,"http-opts.headers.Host")&&!Array.isArray(c)&&(s["http-opts"].headers.Host=[c])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let u=s["h2-opts"]?.path;ue(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let c=s["h2-opts"]?.headers?.host;ue(s,"h2-opts.headers.Host")&&!Array.isArray(c)&&(s["h2-opts"].headers.host=[c])}if(["ws"].includes(s.network)){let u=s[`${s.network}-opts`]?.path;if(u){let c=/^(.*?)(?:\?ed=(\d+))?$/,[f,d="",v=""]=c.exec(u);s[`${s.network}-opts`].path=d,v!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(v,10))}else s[`${s.network}-opts`]=s[`${s.network}-opts`]||{},s[`${s.network}-opts`].path="/"}if(s["plugin-opts"]?.tls&&ue(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","naive"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s.fingerprint=s["tls-fingerprint"]),delete s["tls-fingerprint"],s["underlying-proxy"]&&(s["dialer-proxy"]=s["underlying-proxy"]),delete s["underlying-proxy"],ue(s,"tls")&&typeof s.tls!="boolean"&&delete s.tls,delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],n!=="internal"||i["delete-underscore-fields"])for(let u in s)(s[u]==null||/^_/i.test(u))&&delete s[u];return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s["ip-version"]&&(s["ip-version"]=jO[s["ip-version"]]||s["ip-version"]),s});return n==="internal"?a:`proxies: `+a.map(s=>" - "+JSON.stringify(s)+` `).join("")}}}var d_="SurgeMac",HO=Xc();function Jg(){return{produce:(t,r,n={})=>{switch(t.type){case"external":return p_(t);default:try{return HO.produce(t,r,n)}catch{if(n.useMihomoExternal)return se.log(`${t.name} is not supported on ${d_}, try to use Mihomo(SurgeMac - External Proxy Program) instead`),MO(t,r,n);throw new Error("Surge for macOS \u53EF\u624B\u52A8\u6307\u5B9A\u94FE\u63A5\u53C2\u6570 target=SurgeMac \u6216\u5728 \u540C\u6B65\u914D\u7F6E \u4E2D\u6307\u5B9A SurgeMac \u6765\u542F\u7528 mihomo \u652F\u63F4 Surge \u672C\u8EAB\u4E0D\u652F\u6301\u7684\u534F\u8BAE")}}}}}function p_(e){let t=new at(e);if(!e.exec||!e["local-port"])throw new Error(`${e.type}: exec and local-port are required`);return t.append(`${e.name}=external,exec="${e.exec}",local-port=${e["local-port"]}`),Array.isArray(e.args)&&e.args.map(r=>{t.append(`,args="${r}"`)}),Array.isArray(e.addresses)&&e.addresses.map(r=>{t.append(`,addresses=${r}`)}),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),ue(e,"tfo")?t.append(`,tfo=${e.tfo}`):ue(e,"fast-open")&&t.append(`,tfo=${e["fast-open"]}`),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function MO(e,t,r){let n=Oi().produce([e],"internal")?.[0];if(n){let i=r?.localPort||e._localPort||65535,a=!["ipv4","v4-only"].includes(e["ip-version"]),s={name:e.name,type:"external",exec:e._exec||"/usr/local/bin/mihomo","local-port":i,args:["-config",yt.encode(JSON.stringify({"mixed-port":i,ipv6:a,mode:"global",dns:{enable:!0,ipv6:a,"default-nameserver":r?.defaultNameserver||e._defaultNameserver||["180.76.76.76","52.80.52.52","119.28.28.28","223.6.6.6"],nameserver:r?.nameserver||e._nameserver||["https://doh.pub/dns-query","https://dns.alidns.com/dns-query","https://doh-pure.onedns.net/dns-query"]},proxies:[{...n,name:"proxy"}],"proxy-groups":[{name:"GLOBAL",type:"select",proxies:["proxy"]}]}))],addresses:[]};return qO(e.server)?s.addresses.push(e.server):se.log(`Platform ${d_}, proxy type ${e.type}: addresses should be an IP address, but got ${e.server}`),r.localPort=i-1,p_(s)}}function qO(e){return Tr(e)||Mr(e)}function Qg(){return{type:"ALL",produce:(r,n,i={})=>{let a=r.filter(s=>i["include-unsupported-proxy"]?!0:!["ss","ssr","vmess","vless","socks5","http","snell","trojan","wireguard"].includes(s.type)||s.type==="ss"&&!["aes-128-gcm","aes-192-gcm","aes-256-gcm","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","rc4-md5","chacha20-ietf","xchacha20","chacha20-ietf-poly1305","xchacha20-ietf-poly1305"].includes(s.cipher)||s.type==="snell"&&s.version>=4||s.type==="vless"&&(typeof s.flow<"u"||s["reality-opts"])?!1:s["underlying-proxy"]||s["dialer-proxy"]?(se.error(`Clash \u4E0D\u652F\u6301\u524D\u7F6E\u4EE3\u7406\u5B57\u6BB5. \u5DF2\u8FC7\u6EE4\u8282\u70B9 ${s.name}`),!1):!0).map(s=>{if(s.type==="vmess"?(ue(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ue(s,"sni")&&(s.servername=s.sni,delete s.sni),ue(s,"cipher")&&!["auto","aes-128-gcm","chacha20-poly1305","none"].includes(s.cipher)&&(s.cipher="auto")):s.type==="wireguard"?(s.keepalive=s.keepalive??s["persistent-keepalive"],s["persistent-keepalive"]=s.keepalive,s["preshared-key"]=s["preshared-key"]??s["pre-shared-key"],s["pre-shared-key"]=s["preshared-key"]):s.type==="snell"&&s.version<3?delete s.udp:s.type==="vless"&&ue(s,"sni")&&(s.servername=s.sni,delete s.sni),["vmess","vless"].includes(s.type)&&s.network==="http"){let u=s["http-opts"]?.path;ue(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let c=s["http-opts"]?.headers?.Host;ue(s,"http-opts.headers.Host")&&!Array.isArray(c)&&(s["http-opts"].headers.Host=[c])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let u=s["h2-opts"]?.path;ue(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let c=s["h2-opts"]?.headers?.host;ue(s,"h2-opts.headers.Host")&&!Array.isArray(c)&&(s["h2-opts"].headers.host=[c])}if(["ws"].includes(s.network)){let u=s[`${s.network}-opts`]?.path;if(u){let c=/^(.*?)(?:\?ed=(\d+))?$/,[f,d="",v=""]=c.exec(u);s[`${s.network}-opts`].path=d,v!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(v,10))}else s[`${s.network}-opts`]=s[`${s.network}-opts`]||{},s[`${s.network}-opts`].path="/"}if(s["plugin-opts"]?.tls&&ue(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","naive"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s.fingerprint=s["tls-fingerprint"]),delete s["tls-fingerprint"],ue(s,"tls")&&typeof s.tls!="boolean"&&delete s.tls,delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],n!=="internal")for(let u in s)(s[u]==null||/^_/i.test(u))&&delete s[u];return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s});return n==="internal"?a:`proxies: `+a.map(s=>" - "+JSON.stringify(s)+` `).join("")}}}function gd(){return{type:"ALL",produce:(r,n,i={})=>{let a=r.filter(s=>!["ss","ssr","vmess","socks5","http","snell","trojan","tuic","vless","wireguard","hysteria","hysteria2","ssh","juicity"].includes(s.type)||s.type==="ss"&&!["aes-128-gcm","aes-192-gcm","aes-256-gcm","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","rc4-md5","chacha20-ietf","xchacha20","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(s.cipher)||s.type==="snell"&&s.version>=4||s.type==="vless"&&s["reality-opts"]&&!["xtls-rprx-vision"].includes(s.flow)?!1:s["underlying-proxy"]||s["dialer-proxy"]?(se.error(`Stash \u6682\u4E0D\u652F\u6301\u524D\u7F6E\u4EE3\u7406\u5B57\u6BB5. \u5DF2\u8FC7\u6EE4\u8282\u70B9 ${s.name}. \u8BF7\u4F7F\u7528 \u4EE3\u7406\u7684\u8F6C\u53D1\u94FE https://stash.wiki/proxy-protocols/proxy-groups#relay`),!1):!0).map(s=>{if(s.type==="vmess"?(ue(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ue(s,"sni")&&(s.servername=s.sni,delete s.sni),ue(s,"cipher")&&!["auto","aes-128-gcm","chacha20-poly1305","none"].includes(s.cipher)&&(s.cipher="auto")):s.type==="tuic"?(ue(s,"alpn")?s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]:s.alpn=["h3"],ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),(!s.token||s.token.length===0)&&!ue(s,"version")&&(s.version=5)):s.type==="hysteria"?(ue(s,"auth_str")&&!ue(s,"auth-str")&&(s["auth-str"]=s.auth_str),ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),ue(s,"down")&&!ue(s,"down-speed")&&(s["down-speed"]=s.down,delete s.down),ue(s,"up")&&!ue(s,"up-speed")&&(s["up-speed"]=s.up,delete s.up),ue(s,"down-speed")&&(s["down-speed"]=`${s["down-speed"]}`.match(/\d+/)?.[0]||0),ue(s,"up-speed")&&(s["up-speed"]=`${s["up-speed"]}`.match(/\d+/)?.[0]||0)):s.type==="hysteria2"?(ue(s,"password")&&!ue(s,"auth")&&(s.auth=s.password,delete s.password),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),ue(s,"down")&&!ue(s,"down-speed")&&(s["down-speed"]=s.down,delete s.down),ue(s,"up")&&!ue(s,"up-speed")&&(s["up-speed"]=s.up,delete s.up),ue(s,"down-speed")&&(s["down-speed"]=`${s["down-speed"]}`.match(/\d+/)?.[0]||0),ue(s,"up-speed")&&(s["up-speed"]=`${s["up-speed"]}`.match(/\d+/)?.[0]||0)):s.type==="wireguard"?(s.keepalive=s.keepalive??s["persistent-keepalive"],s["persistent-keepalive"]=s.keepalive,s["preshared-key"]=s["preshared-key"]??s["pre-shared-key"],s["pre-shared-key"]=s["preshared-key"]):s.type==="snell"&&s.version<3?delete s.udp:s.type==="vless"&&ue(s,"sni")&&(s.servername=s.sni,delete s.sni),["vmess","vless"].includes(s.type)&&s.network==="http"){let u=s["http-opts"]?.path;ue(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let c=s["http-opts"]?.headers?.Host;ue(s,"http-opts.headers.Host")&&!Array.isArray(c)&&(s["http-opts"].headers.Host=[c])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let u=s["h2-opts"]?.path;ue(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let c=s["h2-opts"]?.headers?.host;ue(s,"h2-opts.headers.Host")&&!Array.isArray(c)&&(s["h2-opts"].headers.host=[c])}if(["ws"].includes(s.network)){let u=s[`${s.network}-opts`]?.path;if(u){let c=/^(.*?)(?:\?ed=(\d+))?$/,[f,d="",v=""]=c.exec(u);s[`${s.network}-opts`].path=d,v!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(v,10))}else s[`${s.network}-opts`]=s[`${s.network}-opts`]||{},s[`${s.network}-opts`].path="/"}if(s["plugin-opts"]?.tls&&ue(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","naive"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s["server-cert-fingerprint"]=s["tls-fingerprint"]),delete s["tls-fingerprint"],ue(s,"tls")&&typeof s.tls!="boolean"&&delete s.tls,s["test-url"]&&(s["benchmark-url"]=s["test-url"],delete s["test-url"]),s["test-timeout"]&&(s["benchmark-timeout"]=s["test-timeout"],delete s["test-timeout"]),delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],n!=="internal")for(let u in s)(s[u]==null||/^_/i.test(u))&&delete s[u];return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s});return n==="internal"?a:`proxies: `+a.map(s=>" - "+JSON.stringify(s)+` `).join("")}}}var VO="Loon",Qa={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function em(){return{produce:(t,r,n={})=>{switch(t.type){case"ss":return KO(t);case"ssr":return zO(t);case"trojan":return GO(t);case"vmess":return YO(t,n["include-unsupported-proxy"]);case"vless":return WO(t,n["include-unsupported-proxy"]);case"http":return XO(t);case"socks5":return ZO(t);case"wireguard":return JO(t);case"hysteria2":return QO(t)}throw new Error(`Platform ${VO} does not support proxy type: ${t.type}`)}}}function KO(e){let t=new at(e);if(!["rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","salsa20","chacha20","chacha20-ietf","aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(e.cipher))throw new Error(`cipher ${e.cipher} is not supported`);if(t.append(`${e.name}=shadowsocks,${e.server},${e.port},${e.cipher},"${e.password}"`),ue(e,"plugin")){if(e.plugin==="obfs"){if(e["plugin-opts"]?.mode&&e.cipher.startsWith("2022-"))throw new Error(`${e.cipher} ${e.plugin} is not supported`);t.append(`,obfs-name=${e["plugin-opts"].mode}`),t.appendIfPresent(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),t.appendIfPresent(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path")}else if(!["shadow-tls"].includes(e.plugin))throw new Error(`plugin ${e.plugin} is not supported`)}if(ue(e,"shadow-tls-password"))t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni"),t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port");else if(["shadow-tls"].includes(e.plugin)&&e["plugin-opts"]){let n=e["plugin-opts"].password,i=e["plugin-opts"].host,a=e["plugin-opts"].version;if(n){if(t.append(`,shadow-tls-password=${n}`),i&&t.append(`,shadow-tls-sni=${i}`),a){if(a<2)throw new Error(`shadow-tls version ${a} is not supported`);t.append(`,shadow-tls-version=${a}`)}t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port")}}t.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true");let r=Qa[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function zO(e){let t=new at(e);if(t.append(`${e.name}=shadowsocksr,${e.server},${e.port},${e.cipher},"${e.password}"`),t.append(`,protocol=${e.protocol}`),t.appendIfPresent(`,protocol-param=${e["protocol-param"]}`,"protocol-param"),t.appendIfPresent(`,obfs=${e.obfs}`,"obfs"),t.appendIfPresent(`,obfs-param=${e["obfs-param"]}`,"obfs-param"),ue(e,"shadow-tls-password"))t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni"),t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port");else if(["shadow-tls"].includes(e.plugin)&&e["plugin-opts"]){let n=e["plugin-opts"].password,i=e["plugin-opts"].host,a=e["plugin-opts"].version;if(n){if(t.append(`,shadow-tls-password=${n}`),i&&t.append(`,shadow-tls-sni=${i}`),a){if(a<2)throw new Error(`shadow-tls version ${a} is not supported`);t.append(`,shadow-tls-version=${a}`)}t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port")}}t.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true");let r=Qa[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function GO(e){let t=new at(e);if(t.append(`${e.name}=trojan,${e.server},${e.port},"${e.password}"`),e.network==="tcp"&&delete e.network,ue(e,"network"))if(e.network==="ws")t.append(",transport=ws"),t.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),t.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else throw new Error(`network ${e.network} is unsupported`);t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tls-name=${e.sni}`,"sni"),t.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),t.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true");let r=Qa[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function YO(e){let t=!!e["reality-opts"],r=new at(e);if(r.append(`${e.name}=vmess,${e.server},${e.port},${e.cipher},"${e.uuid}"`),e.network==="tcp"&&delete e.network,ue(e,"network"))if(e.network==="ws")r.append(",transport=ws"),r.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),r.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(e.network==="http"){r.append(",transport=http");let i=e["http-opts"]?.path,a=e["http-opts"]?.headers?.Host;r.appendIfPresent(`,path=${Array.isArray(i)?i[0]:i}`,"http-opts.path"),r.appendIfPresent(`,host=${Array.isArray(a)?a[0]:a}`,"http-opts.headers.Host")}else throw new Error(`network ${e.network} is unsupported`);else r.append(",transport=tcp");r.appendIfPresent(`,over-tls=${e.tls}`,"tls"),r.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t?(r.appendIfPresent(`,sni=${e.sni}`,"sni"),r.appendIfPresent(`,public-key="${e["reality-opts"]["public-key"]}"`,"reality-opts.public-key"),r.appendIfPresent(`,short-id=${e["reality-opts"]["short-id"]}`,"reality-opts.short-id")):(r.appendIfPresent(`,tls-name=${e.sni}`,"sni"),r.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),r.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256")),ue(e,"aead")?r.append(`,alterId=${e.aead?0:1}`):r.append(`,alterId=${e.alterId}`),r.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?r.append(",block-quic=true"):e["block-quic"]==="off"&&r.append(",block-quic=false"),e.udp&&r.append(",udp=true");let n=Qa[e["ip-version"]]||e["ip-version"];return r.appendIfPresent(`,ip-mode=${n}`,"ip-version"),r.toString()}function WO(e){let t=!1,r=!!e["reality-opts"];if(typeof e.flow<"u")if(["xtls-rprx-vision"].includes(e.flow))t=!0;else throw new Error(`VLESS flow(${e.flow}) is not supported`);let n=new at(e);if(n.append(`${e.name}=vless,${e.server},${e.port},"${e.uuid}"`),e.network==="tcp"&&delete e.network,ue(e,"network"))if(e.network==="ws")n.append(",transport=ws"),n.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),n.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(e.network==="http"){n.append(",transport=http");let a=e["http-opts"]?.path,s=e["http-opts"]?.headers?.Host;n.appendIfPresent(`,path=${Array.isArray(a)?a[0]:a}`,"http-opts.path"),n.appendIfPresent(`,host=${Array.isArray(s)?s[0]:s}`,"http-opts.headers.Host")}else throw new Error(`network ${e.network} is unsupported`);else n.append(",transport=tcp");n.appendIfPresent(`,over-tls=${e.tls}`,"tls"),n.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t&&n.appendIfPresent(`,flow=${e.flow}`,"flow"),r?(n.appendIfPresent(`,sni=${e.sni}`,"sni"),n.appendIfPresent(`,public-key="${e["reality-opts"]["public-key"]}"`,"reality-opts.public-key"),n.appendIfPresent(`,short-id=${e["reality-opts"]["short-id"]}`,"reality-opts.short-id")):(n.appendIfPresent(`,tls-name=${e.sni}`,"sni"),n.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256")),n.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?n.append(",block-quic=true"):e["block-quic"]==="off"&&n.append(",block-quic=false"),e.udp&&n.append(",udp=true");let i=Qa[e["ip-version"]]||e["ip-version"];return n.appendIfPresent(`,ip-mode=${i}`,"ip-version"),n.toString()}function XO(e){let t=new at(e),r=e.tls?"https":"http";t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,"${e.password}"`,"password"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false");let n=Qa[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${n}`,"ip-version"),t.toString()}function ZO(e){let t=new at(e);t.append(`${e.name}=socks5,${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,"${e.password}"`,"password"),t.appendIfPresent(`,over-tls=${e.tls}`,"tls"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true");let r=Qa[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function JO(e){Array.isArray(e.peers)&&e.peers.length>0&&(e.server=e.peers[0].server,e.port=e.peers[0].port,e.ip=e.peers[0].ip,e.ipv6=e.peers[0].ipv6,e["public-key"]=e.peers[0]["public-key"],e["preshared-key"]=e.peers[0]["pre-shared-key"],e["allowed-ips"]=e.peers[0]["allowed-ips"],e.reserved=e.peers[0].reserved);let t=new at(e);if(t.append(`${e.name}=wireguard`),t.appendIfPresent(`,interface-ip=${e.ip}`,"ip"),t.appendIfPresent(`,interface-ipv6=${e.ipv6}`,"ipv6"),t.appendIfPresent(`,private-key="${e["private-key"]}"`,"private-key"),t.appendIfPresent(`,mtu=${e.mtu}`,"mtu"),e.dns&&Array.isArray(e.dns)){e.dnsv6=e.dns.find(u=>Mr(u));let s=e.dns.find(u=>Tr(u));s||(s=e.dns.find(u=>!Tr(u)&&!Mr(u))),e.dns=s}t.appendIfPresent(`,dns=${e.dns}`,"dns"),t.appendIfPresent(`,dnsv6=${e.dnsv6}`,"dnsv6"),t.appendIfPresent(`,keepalive=${e["persistent-keepalive"]}`,"persistent-keepalive"),t.appendIfPresent(`,keepalive=${e.keepalive}`,"keepalive");let r=Array.isArray(e["allowed-ips"])?e["allowed-ips"].join(","):e["allowed-ips"],n=Array.isArray(e.reserved)?e.reserved.join(","):e.reserved;n&&(n=`,reserved=[${n}]`);let i=e["preshared-key"]??e["pre-shared-key"];i&&(i=`,preshared-key="${i}"`),t.append(`,peers=[{public-key="${e["public-key"]}",allowed-ips="${r??"0.0.0.0/0,::/0"}",endpoint=${e.server}:${e.port}${n??""}${i??""}}]`);let a=Qa[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${a}`,"ip-version"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),t.toString()}function QO(e){if(e["obfs-password"]&&e.obfs!="salamander")throw new Error("only salamander obfs is supported");let t=new at(e);t.append(`${e.name}=Hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,"${e.password}"`,"password"),t.appendIfPresent(`,tls-name=${e.sni}`,"sni"),t.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),e["obfs-password"]&&e.obfs=="salamander"&&t.append(`,salamander-password=${e["obfs-password"]}`),t.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true"),t.appendIfPresent(`,download-bandwidth=${`${e.down}`.match(/\d+/)?.[0]||0}`,"down"),t.appendIfPresent(`,ecn=${e.ecn}`,"ecn");let r=Qa[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}var pY=yn(t3());function r3(e){let t="none",r=e["reality-opts"],n="",i="",a="";if(r){t="reality";let C=e["reality-opts"]?.["public-key"];C&&(i=`&pbk=${encodeURIComponent(C)}`);let F=e["reality-opts"]?.["short-id"];F&&(n=`&sid=${encodeURIComponent(F)}`);let L=e["reality-opts"]?.["_spider-x"];L&&(a=`&spx=${encodeURIComponent(L)}`)}else e.tls&&(t="tls");let s="";e.alpn&&(s=`&alpn=${encodeURIComponent(Array.isArray(e.alpn)?e.alpn:e.alpn.join(","))}`);let u="";e["skip-cert-verify"]&&(u="&allowInsecure=1");let c="";e.sni&&(c=`&sni=${encodeURIComponent(e.sni)}`);let f="";e["client-fingerprint"]&&(f=`&fp=${encodeURIComponent(e["client-fingerprint"])}`);let d="";e.flow&&(d=`&flow=${encodeURIComponent(e.flow)}`);let v="";e._extra&&(v=`&extra=${encodeURIComponent(e._extra)}`);let p="";e._mode&&(p=`&mode=${encodeURIComponent(e._mode)}`);let h="";e._pqv&&(h=`&pqv=${encodeURIComponent(e._pqv)}`);let w="";e.encryption&&(w=`&encryption=${encodeURIComponent(e.encryption)}`);let m=e.network;e.network==="ws"&&e["ws-opts"]?.["v2ray-http-upgrade"]&&(m="httpupgrade");let y=`&type=${encodeURIComponent(m)}`;if(["grpc"].includes(e.network)){y+=`&mode=${encodeURIComponent(e[`${e.network}-opts`]?.["_grpc-type"]||"gun")}`;let C=e[`${e.network}-opts`]?.["_grpc-authority"];C&&(y+=`&authority=${encodeURIComponent(C)}`)}let g=e[`${e.network}-opts`]?.[`${e.network}-service-name`],b=e[`${e.network}-opts`]?.path,D=e[`${e.network}-opts`]?.headers?.Host;return b&&(y+=`&path=${encodeURIComponent(Array.isArray(b)?b[0]:b)}`),D&&(y+=`&host=${encodeURIComponent(Array.isArray(D)?D[0]:D)}`),g&&(y+=`&serviceName=${encodeURIComponent(g)}`),e.network==="kcp"&&(e.seed&&(y+=`&seed=${encodeURIComponent(e.seed)}`),e.headerType&&(y+=`&headerType=${encodeURIComponent(e.headerType)}`)),`vless://${e.uuid}@${e.server}:${e.port}?security=${encodeURIComponent(t)}${y}${s}${u}${c}${f}${d}${n}${a}${i}${p}${v}${h}${w}#${encodeURIComponent(e.name)}`}function yl(){return{type:"SINGLE",produce:r=>{let n="";delete r.subName,delete r.collectionName,delete r.id,delete r.resolved,delete r["no-resolve"];for(let i in r)r[i]==null&&delete r[i];switch(["trojan","tuic","hysteria","hysteria2","juicity","anytls"].includes(r.type)&&delete r.tls,!["vmess"].includes(r.type)&&r.server&&Mr(r.server)&&(r.server=`[${r.server}]`),r.type){case"socks5":n=`socks://${encodeURIComponent(yt.encode(`${r.username??""}:${r.password??""}`))}@${r.server}:${r.port}#${r.name}`;break;case"ss":let i=`${r.cipher}:${r.password}`;if(n=`ss://${r.cipher?.startsWith("2022-blake3-")?`${encodeURIComponent(r.cipher)}:${encodeURIComponent(r.password)}`:yt.encode(i)}@${r.server}:${r.port}${r.plugin?"/":""}`,r.plugin){n+="?plugin=";let x=r["plugin-opts"];switch(r.plugin){case"obfs":n+=encodeURIComponent(`simple-obfs;obfs=${x.mode}${x.host?";obfs-host="+x.host:""}`);break;case"v2ray-plugin":n+=encodeURIComponent(`v2ray-plugin;obfs=${x.mode}${x.host?";obfs-host"+x.host:""}${x.tls?";tls":""}`);break;case"shadow-tls":n+=encodeURIComponent(`shadow-tls;host=${x.host};password=${x.password};version=${x.version}`);break;default:throw new Error(`Unsupported plugin option: ${r.plugin}`)}}r["udp-over-tcp"]&&(n=`${n}${r.plugin?"&":"?"}uot=1`),r.tfo&&(n=`${n}${r.plugin||r["udp-over-tcp"]?"&":"?"}tfo=1`),n+=`#${encodeURIComponent(r.name)}`;break;case"ssr":n=`${r.server}:${r.port}:${r.protocol}:${r.cipher}:${r.obfs}:${yt.encode(r.password)}/`,n+=`?remarks=${yt.encode(r.name)}${r["obfs-param"]?"&obfsparam="+yt.encode(r["obfs-param"]):""}${r["protocol-param"]?"&protocolparam="+yt.encode(r["protocol-param"]):""}`,n="ssr://"+yt.encode(n);break;case"vmess":let a="",s=r.network||"tcp";if(r.network==="http"?(s="tcp",a="http"):r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(s="httpupgrade"),n={v:"2",ps:r.name,add:r.server,port:`${r.port}`,id:r.uuid,aid:`${r.alterId||0}`,scy:r.cipher,net:s,type:a,tls:r.tls?"tls":"",alpn:Array.isArray(r.alpn)?r.alpn.join(","):r.alpn,fp:r["client-fingerprint"]},r.tls&&r.sni&&(n.sni=r.sni),r.network){let x=r[`${r.network}-opts`]?.path,U=r[`${r.network}-opts`]?.headers?.Host;["grpc"].includes(r.network)?(n.path=r[`${r.network}-opts`]?.["grpc-service-name"],n.type=r[`${r.network}-opts`]?.["_grpc-type"]||"gun",n.host=r[`${r.network}-opts`]?.["_grpc-authority"]):["kcp","quic"].includes(r.network)?(n.type=r[`${r.network}-opts`]?.[`_${r.network}-type`]||"none",n.host=r[`${r.network}-opts`]?.[`_${r.network}-host`],n.path=r[`${r.network}-opts`]?.[`_${r.network}-path`]):(x&&(n.path=Array.isArray(x)?x[0]:x),U&&(n.host=Array.isArray(U)?U[0]:U))}n="vmess://"+yt.encode(JSON.stringify(n));break;case"vless":n=r3(r);break;case"trojan":let u="";if(r.network){let x=r.network;if(r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(x="httpupgrade"),u=`&type=${encodeURIComponent(x)}`,["grpc"].includes(r.network)){let H=r[`${r.network}-opts`]?.[`${r.network}-service-name`],K=r[`${r.network}-opts`]?.["_grpc-authority"];H&&(u+=`&serviceName=${encodeURIComponent(H)}`),K&&(u+=`&authority=${encodeURIComponent(K)}`),u+=`&mode=${encodeURIComponent(r[`${r.network}-opts`]?.["_grpc-type"]||"gun")}`}let U=r[`${r.network}-opts`]?.path,G=r[`${r.network}-opts`]?.headers?.Host;U&&(u+=`&path=${encodeURIComponent(Array.isArray(U)?U[0]:U)}`),G&&(u+=`&host=${encodeURIComponent(Array.isArray(G)?G[0]:G)}`)}let c="";r["client-fingerprint"]&&(c=`&fp=${encodeURIComponent(r["client-fingerprint"])}`);let f="";r.alpn&&(f=`&alpn=${encodeURIComponent(Array.isArray(r.alpn)?r.alpn:r.alpn.join(","))}`);let d=r["reality-opts"],v="",p="",h="",w="",m="",y="";if(d){w="&security=reality";let x=r["reality-opts"]?.["public-key"];x&&(p=`&pbk=${encodeURIComponent(x)}`);let U=r["reality-opts"]?.["short-id"];U&&(v=`&sid=${encodeURIComponent(U)}`);let G=r["reality-opts"]?.["_spider-x"];G&&(h=`&spx=${encodeURIComponent(G)}`),r._extra&&(y=`&extra=${encodeURIComponent(r._extra)}`),r._mode&&(m=`&mode=${encodeURIComponent(r._mode)}`)}n=`trojan://${r.password}@${r.server}:${r.port}?sni=${encodeURIComponent(r.sni||r.server)}${r["skip-cert-verify"]?"&allowInsecure=1":""}${u}${f}${c}${w}${v}${p}${h}${m}${y}#${encodeURIComponent(r.name)}`;break;case"hysteria2":let g=[];r["hop-interval"]&&g.push(`hop-interval=${r["hop-interval"]}`),r.keepalive&&g.push(`keepalive=${r.keepalive}`),r["skip-cert-verify"]&&g.push("insecure=1"),r.obfs&&(g.push(`obfs=${encodeURIComponent(r.obfs)}`),r["obfs-password"]&&g.push(`obfs-password=${encodeURIComponent(r["obfs-password"])}`)),r.sni&&g.push(`sni=${encodeURIComponent(r.sni)}`),r.ports&&g.push(`mport=${r.ports}`),r["tls-fingerprint"]&&g.push(`pinSHA256=${encodeURIComponent(r["tls-fingerprint"])}`),r.tfo&&g.push("fastopen=1"),n=`hysteria2://${encodeURIComponent(r.password)}@${r.server}:${r.port}?${g.join("&")}#${encodeURIComponent(r.name)}`;break;case"hysteria":let b=[];Object.keys(r).forEach(x=>{if(!["name","type","server","port"].includes(x)){let U=x.replace(/-/,"_");["alpn"].includes(x)?r[x]&&b.push(`${U}=${encodeURIComponent(Array.isArray(r[x])?r[x][0]:r[x])}`):["skip-cert-verify"].includes(x)?r[x]&&b.push("insecure=1"):["tfo","fast-open"].includes(x)?r[x]&&!b.includes("fastopen=1")&&b.push("fastopen=1"):["ports"].includes(x)?b.push(`mport=${r[x]}`):["auth-str"].includes(x)?b.push(`auth=${r[x]}`):["up"].includes(x)?b.push(`upmbps=${r[x]}`):["down"].includes(x)?b.push(`downmbps=${r[x]}`):["_obfs"].includes(x)?b.push(`obfs=${r[x]}`):["obfs"].includes(x)?b.push(`obfsParam=${r[x]}`):["sni"].includes(x)?b.push(`peer=${r[x]}`):r[x]&&!/^_/i.test(x)&&b.push(`${U}=${encodeURIComponent(r[x])}`)}}),n=`hysteria://${r.server}:${r.port}?${b.join("&")}#${encodeURIComponent(r.name)}`;break;case"tuic":if(!r.token||r.token.length===0){let x=[];Object.keys(r).forEach(U=>{if(!["name","type","uuid","password","server","port","tls"].includes(U)){let G=U.replace(/-/,"_");["alpn"].includes(U)?r[U]&&x.push(`${G}=${encodeURIComponent(Array.isArray(r[U])?r[U][0]:r[U])}`):["skip-cert-verify"].includes(U)?r[U]&&x.push("allow_insecure=1"):["tfo","fast-open"].includes(U)?r[U]&&!x.includes("fast_open=1")&&x.push("fast_open=1"):["disable-sni","reduce-rtt"].includes(U)&&r[U]?x.push(`${G.replace(/-/g,"_")}=1`):["congestion-controller"].includes(U)?x.push(`congestion_control=${r[U]}`):r[U]&&!/^_/i.test(U)&&x.push(`${G.replace(/-/g,"_")}=${encodeURIComponent(r[U])}`)}}),n=`tuic://${encodeURIComponent(r.uuid)}:${encodeURIComponent(r.password)}@${r.server}:${r.port}?${x.join("&")}#${encodeURIComponent(r.name)}`}break;case"anytls":n=r3({...r,uuid:r.password,network:r.network||"tcp"}).replace("vless","anytls");let D=[];Object.keys(r).forEach(x=>{if(!["name","type","password","server","port","tls"].includes(x)){let U=x.replace(/-/,"_");["alpn"].includes(x)?r[x]&&D.push(`${U}=${encodeURIComponent(Array.isArray(r[x])?r[x][0]:r[x])}`):["skip-cert-verify"].includes(x)?r[x]&&D.push("insecure=1"):["udp"].includes(x)?r[x]&&D.push("udp=1"):r[x]&&!/^_|client-fingerprint/i.test(x)&&["number","string","boolean"].includes(typeof r[x])&&D.push(`${U.replace(/-/g,"_")}=${encodeURIComponent(r[x])}`)}});let C=n.split("?"),F=C[0],L={};C.length>1&&C[1].split("#")[0].split("&").forEach(G=>{let[H,K]=G.split("=");H&&(L[H]=K)}),D.forEach(x=>{let[U,G]=x.split("=");U&&(L[U]=G)});let N=Object.keys(L).map(x=>`${x}=${L[x]}`).join("&"),S=n.match(/#(.*)$/),B=S?`#${S[1]}`:"";n=`${F}?${N}${B}`;break;case"wireguard":let O=[];Object.keys(r).forEach(x=>{["name","type","server","port","ip","ipv6","private-key"].includes(x)||(["public-key"].includes(x)?O.push(`publickey=${r[x]}`):["udp"].includes(x)?r[x]&&O.push(`${x}=1`):r[x]&&!/^_/i.test(x)&&O.push(`${x}=${encodeURIComponent(r[x])}`))}),r.ip&&r.ipv6?O.push(`address=${r.ip}/32,${r.ipv6}/128`):r.ip?O.push(`address=${r.ip}/32`):r.ipv6&&O.push(`address=${r.ipv6}/128`),n=`wireguard://${encodeURIComponent(r["private-key"])}@${r.server}:${r.port}/?${O.join("&")}#${encodeURIComponent(r.name)}`;break}return n}}}var mH=yl();function ah(){return{type:"ALL",produce:r=>{let n=[];return r.map(i=>{try{n.push(mH.produce(i))}catch(a){se.error(`Cannot produce proxy: ${JSON.stringify(i,null,2)} Reason: ${a}`)}}),yt.encode(n.join(` `))}}}var zv="QX";function uh(){let e=(t,r,n={})=>{switch(t.type){case"ss":return vH(t);case"ssr":return wH(t);case"trojan":return AH(t);case"vmess":return EH(t);case"http":return yH(t);case"socks5":return _H(t);case"vless":return bH(t)}throw new Error(`Platform ${zv} does not support proxy type: ${t.type}`)};return{produce:(t,r,n={})=>{console.log(n);let i=e(t,r,n);if(n["include-unsupported-proxy"]){if(t.flow&&t.flow!=="xtls-rprx-vision")throw new Error(`Platform ${zv} does not support flow ${t.flow}`);t["reality-opts"]&&(t["reality-opts"]["public-key"]&&(i=`${i},reality-base64-pubkey=${t["reality-opts"]["public-key"]}`),t["reality-opts"]["short-id"]&&(i=`${i},reality-hex-shortid=${t["reality-opts"]["short-id"]}`))}else if(typeof t.flow<"u"||t["reality-opts"])throw new Error(`Platform ${zv} does not support XTLS/REALITY`);return i}}}function vH(e){let t=new at(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(e.cipher||(e.cipher="none"),!["none","rc4-md5","rc4-md5-6","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","cast5-cfb","des-cfb","rc2-cfb","salsa20","chacha20","chacha20-ietf","aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(e.cipher))throw new Error(`cipher ${e.cipher} is not supported`);if(r(`shadowsocks=${e.server}:${e.port}`),r(`,method=${e.cipher}`),r(`,password=${e.password}`),Li(e)&&(e.tls=!0),ue(e,"plugin")){if(e.plugin==="obfs"){let i=e["plugin-opts"];r(`,obfs=${i.mode}`)}else if(e.plugin==="v2ray-plugin"&&e["plugin-opts"].mode==="websocket")e["plugin-opts"].tls?r(",obfs=wss"):r(",obfs=ws");else throw new Error("plugin is not supported");n(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),n(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path")}return Li(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),e._ssr_python_uot?r(",udp-over-tcp=true"):e["udp-over-tcp"]&&(!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?r(",udp-over-tcp=sp.v1"):e["udp-over-tcp-version"]===2&&r(",udp-over-tcp=sp.v2")),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function wH(e){let t=new at(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);return r(`shadowsocks=${e.server}:${e.port}`),r(`,method=${e.cipher}`),r(`,password=${e.password}`),r(`,ssr-protocol=${e.protocol}`),n(`,ssr-protocol-param=${e["protocol-param"]}`,"protocol-param"),n(`,obfs=${e.obfs}`,"obfs"),n(`,obfs-host=${e["obfs-param"]}`,"obfs-param"),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function AH(e){let t=new at(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(r(`trojan=${e.server}:${e.port}`),r(`,password=${e.password}`),ue(e,"network"))if(e.network==="ws")Li(e)?r(",obfs=wss"):r(",obfs=ws"),n(`,obfs-uri=${e["ws-opts"]?.path}`,"ws-opts.path"),n(`,obfs-host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else throw new Error(`network ${e.network} is unsupported`);return e.network!=="ws"&&Li(e)&&r(",over-tls=true"),Li(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function EH(e){let t=new at(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);r(`vmess=${e.server}:${e.port}`);let i;if(e.cipher==="auto"?i="chacha20-ietf-poly1305":i=e.cipher,r(`,method=${i}`),r(`,password=${e.uuid}`),Li(e)&&(e.tls=!0),ue(e,"network")){if(e.network==="ws")e.tls?r(",obfs=wss"):r(",obfs=ws");else if(e.network==="http")r(",obfs=http");else throw new Error(`network ${e.network} is unsupported`);let a=e[`${e.network}-opts`]?.path,s=e[`${e.network}-opts`]?.headers?.Host;n(`,obfs-uri=${Array.isArray(a)?a[0]:a}`,`${e.network}-opts.path`),n(`,obfs-host=${Array.isArray(s)?s[0]:s}`,`${e.network}-opts.headers.Host`)}else e.tls&&r(",obfs=over-tls");return Li(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),ue(e,"aead")?r(`,aead=${e.aead}`):r(`,aead=${e.alterId===0}`),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function bH(e){let t=new at(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(r(`vless=${e.server}:${e.port}`),r(",method=none"),r(`,password=${e.uuid}`),Li(e)&&(e.tls=!0),ue(e,"network")){if(e.network==="ws")e.tls?r(",obfs=wss"):r(",obfs=ws");else if(e.network==="http")r(",obfs=http");else if(["tcp"].includes(e.network))e.tls&&r(",obfs=over-tls");else if(!["tcp"].includes(e.network))throw new Error(`network ${e.network} is unsupported`);let a=e[`${e.network}-opts`]?.path,s=e[`${e.network}-opts`]?.headers?.Host;n(`,obfs-uri=${Array.isArray(a)?a[0]:a}`,`${e.network}-opts.path`),n(`,obfs-host=${Array.isArray(s)?s[0]:s}`,`${e.network}-opts.headers.Host`)}else e.tls&&r(",obfs=over-tls");return Li(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),n(`,vless-flow=${e.flow}`,"flow"),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function yH(e){let t=new at(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);return r(`http=${e.server}:${e.port}`),n(`,username=${e.username}`,"username"),n(`,password=${e.password}`,"password"),Li(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),Li(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function _H(e){let t=new at(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);return r(`socks5=${e.server}:${e.port}`),n(`,username=${e.username}`,"username"),n(`,password=${e.password}`,"password"),Li(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),Li(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function Li(e){return e.tls}function oh(){return{type:"ALL",produce:(r,n,i={})=>{let a=r.filter(s=>i["include-unsupported-proxy"]?!0:s.type==="snell"&&s.version>=4?!1:!["mieru","sudoku","naive"].includes(s.type)).map(s=>{if(s.type==="vmess")ue(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ue(s,"sni")&&(s.servername=s.sni,delete s.sni),ue(s,"cipher")&&!["auto","none","zero","aes-128-gcm","chacha20-poly1305"].includes(s.cipher)&&(s.cipher="auto");else if(s.type==="tuic")ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo),(!s.token||s.token.length===0)&&!ue(s,"version")&&(s.version=5);else if(s.type==="hysteria")ue(s,"auth_str")&&!ue(s,"auth-str")&&(s["auth-str"]=s.auth_str),ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo);else if(s.type==="hysteria2")ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo);else if(s.type==="wireguard")s.keepalive=s.keepalive??s["persistent-keepalive"],s["persistent-keepalive"]=s.keepalive,s["preshared-key"]=s["preshared-key"]??s["pre-shared-key"],s["pre-shared-key"]=s["preshared-key"];else if(s.type==="snell"&&s.version<3)delete s.udp;else if(s.type==="vless")ue(s,"sni")&&(s.servername=s.sni,delete s.sni);else if(s.type==="ss")ue(s,"shadow-tls-password")&&!ue(s,"plugin")&&(s.plugin="shadow-tls",s["plugin-opts"]={host:s["shadow-tls-sni"],password:s["shadow-tls-password"],version:s["shadow-tls-version"]},delete s["shadow-tls-password"],delete s["shadow-tls-sni"],delete s["shadow-tls-version"]);else{if(["anytls"].includes(s.type)&&s.network&&(!["tcp"].includes(s.network)||["tcp"].includes(s.network)&&s["reality-opts"]))return!1;if(["xhttp"].includes(s.network))return!1}if(["vmess","vless"].includes(s.type)&&s.network==="http"){let u=s["http-opts"]?.path;ue(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let c=s["http-opts"]?.headers?.Host;ue(s,"http-opts.headers.Host")&&!Array.isArray(c)&&(s["http-opts"].headers.Host=[c])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let u=s["h2-opts"]?.path;ue(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let c=s["h2-opts"]?.headers?.host;ue(s,"h2-opts.headers.Host")&&!Array.isArray(c)&&(s["h2-opts"].headers.host=[c])}if(["ws"].includes(s.network)){let u=s[`${s.network}-opts`]?.path;if(u){let c=/^(.*?)(?:\?ed=(\d+))?$/,[f,d="",v=""]=c.exec(u);s[`${s.network}-opts`].path=d,v!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(v,10))}else s[`${s.network}-opts`]=s[`${s.network}-opts`]||{},s[`${s.network}-opts`].path="/"}if(s["plugin-opts"]?.tls&&ue(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","naive"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s.fingerprint=s["tls-fingerprint"]),delete s["tls-fingerprint"],s["underlying-proxy"]&&(s["dialer-proxy"]=s["underlying-proxy"]),delete s["underlying-proxy"],ue(s,"tls")&&typeof s.tls!="boolean"&&delete s.tls,delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],n!=="internal")for(let u in s)(s[u]==null||/^_/i.test(u))&&delete s[u];return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s});return n==="internal"?a:`proxies: `+a.map(s=>" - "+JSON.stringify(s)+` `).join("")}}}var CH="Surfboard";function ep(){return{produce:t=>{switch(t.name=t.name.replace(/=|,/g,""),t.type){case"ss":return DH(t);case"trojan":return FH(t);case"vmess":return SH(t);case"http":return IH(t);case"socks5":return BH(t);case"wireguard-surge":return PH(t)}throw new Error(`Platform ${CH} does not support proxy type: ${t.type}`)}}}function DH(e){let t=new at(e);if(t.append(`${e.name}=${e.type},${e.server},${e.port}`),!["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","salsa20","chacha20","chacha20-ietf"].includes(e.cipher))throw new Error(`cipher ${e.cipher} is not supported`);if(t.append(`,encrypt-method=${e.cipher}`),t.appendIfPresent(`,password=${e.password}`,"password"),ue(e,"plugin"))if(e.plugin==="obfs")t.append(`,obfs=${e["plugin-opts"].mode}`),t.appendIfPresent(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),t.appendIfPresent(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path");else throw new Error(`plugin ${e.plugin} is not supported`);return t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function FH(e){let t=new at(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password=${e.password}`,"password"),n3(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function SH(e){let t=new at(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,username=${e.uuid}`,"uuid"),n3(t,e),ue(e,"aead")?t.append(`,vmess-aead=${e.aead}`):t.append(`,vmess-aead=${e.alterId===0}`),t.appendIfPresent(`,tls=${e.tls}`,"tls"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function IH(e){let t=new at(e),r=e.tls?"https":"http";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,${e.password}`,"password"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function BH(e){let t=new at(e),r=e.tls?"socks5-tls":"socks5";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,${e.password}`,"password"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function PH(e){let t=new at(e);return t.append(`${e.name}=wireguard`),t.appendIfPresent(`,section-name=${e["section-name"]}`,"section-name"),t.toString()}function n3(e,t){if(ue(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),ue(t,"ws-opts")&&(e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),ue(t,"ws-opts.headers"))){let r=t["ws-opts"].headers,n=Object.keys(r).map(i=>{let a=r[i];return["Host"].includes(i)&&(a=`"${a}"`),`${i}:${a}`}).join("|");Ks(n)&&e.append(`,ws-headers=${n}`)}}else throw new Error(`network ${t.network} is unsupported`)}var $H={ipv4:"ipv4_only",ipv6:"ipv6_only","v4-only":"ipv4_only","v6-only":"ipv6_only","ipv4-prefer":"prefer_ipv4","ipv6-prefer":"prefer_ipv6","prefer-v4":"prefer_ipv4","prefer-v6":"prefer_ipv6"},Wn=(e,t)=>{let r=$H[e["ip-version"]];e._dns_server&&r&&(t.domain_resolver={server:e._dns_server,strategy:r})},Xn=(e,t)=>{t.detour=e["dialer-proxy"]||e.detour},fa=(e,t)=>{["tcp","udp"].includes(e._network)&&(t.network=e._network)},wi=(e,t)=>{t.tcp_fast_open=!1,e.tfo&&(t.tcp_fast_open=!0),e.tcp_fast_open&&(t.tcp_fast_open=!0),e["tcp-fast-open"]&&(t.tcp_fast_open=!0),t.tcp_fast_open||delete t.tcp_fast_open},ys=(e,t)=>{!e||!e.enabled||(t.multiplex={enabled:!0},t.multiplex.protocol=e.protocol,e["max-connections"]&&(t.multiplex.max_connections=parseInt(`${e["max-connections"]}`,10)),e["max-streams"]&&(t.multiplex.max_streams=parseInt(`${e["max-streams"]}`,10)),e["min-streams"]&&(t.multiplex.min_streams=parseInt(`${e["min-streams"]}`,10)),e.padding&&(t.multiplex.padding=!0),(e["brutal-opts"]?.up||e["brutal-opts"]?.down)&&(t.multiplex.brutal={enabled:!0},e["brutal-opts"]?.up&&(t.multiplex.brutal.up_mbps=parseInt(`${e["brutal-opts"]?.up}`,10)),e["brutal-opts"]?.down&&(t.multiplex.brutal.down_mbps=parseInt(`${e["brutal-opts"]?.down}`,10))))},Gv=(e,t)=>{let r={type:"ws",headers:{}};if(e["ws-opts"]){let{path:n="",headers:i={},"max-early-data":a,"early-data-header-name":s}=e["ws-opts"];if(r.early_data_header_name=s,r.max_early_data=a?parseInt(a,10):void 0,n!==""&&(r.path=`${n}`),Object.keys(i).length>0){let u={};for(let f of Object.keys(i)){let d=i[f];d!==""&&(Array.isArray(d)||(d=[`${d}`]),d.length>0&&(u[f]=d))}let{Host:c}=u;if(c.length===1)for(let f of`Host:${c[0]}`.split(` `)){let[d,v]=f.split(":");v.trim()!==""&&(u[d.trim()]=v.trim().split(","))}r.headers=u}}if(e["ws-headers"]){let n={};for(let a of Object.keys(e["ws-headers"])){let s=e["ws-headers"][a];s!==""&&(Array.isArray(s)||(s=[`${s}`]),s.length>0&&(n[a]=s))}let{Host:i}=n;if(i.length===1)for(let a of`Host:${i[0]}`.split(` `)){let[s,u]=a.split(":");u.trim()!==""&&(n[s.trim()]=u.trim().split(","))}for(let a of Object.keys(n))r.headers[a]=n[a]}if(e["ws-path"]&&e["ws-path"]!==""&&(r.path=`${e["ws-path"]}`),r.path){let n=/^(.*?)(?:\?ed=(\d+))?$/,[i,a="",s=""]=n.exec(r.path);r.path=a,s!==""&&(r.early_data_header_name="Sec-WebSocket-Protocol",r.max_early_data=parseInt(s,10))}t.tls.insecure&&(t.tls.server_name=r.headers.Host[0]),e["ws-opts"]&&e["ws-opts"]["v2ray-http-upgrade"]&&(r.type="httpupgrade",r.headers.Host&&(r.host=r.headers.Host[0],delete r.headers.Host),r.max_early_data&&delete r.max_early_data,r.early_data_header_name&&delete r.early_data_header_name);for(let n of Object.keys(r.headers)){let i=r.headers[n];i.length===1&&(r.headers[n]=i[0])}t.transport=r},i3=(e,t)=>{let r={type:"http",headers:{}};if(e["http-opts"]){let{method:n="",path:i="",headers:a={}}=e["http-opts"];n!==""&&(r.method=n),Array.isArray(i)?r.path=`${i[0]}`:i!==""&&(r.path=`${i}`);for(let s of Object.keys(a)){let u=a[s];if(u!==""){if(s.toLowerCase()==="host"){let c=u;Array.isArray(c)||(c=`${c}`.split(",").map(f=>f.trim())),c.length>0&&(r.host=c);continue}Array.isArray(u)||(u=`${u}`.split(",").map(c=>c.trim())),u.length>0&&(r.headers[s]=u)}}}if(e["http-host"]&&e["http-host"]!==""){let n=e["http-host"];Array.isArray(n)||(n=`${n}`.split(",").map(i=>i.trim())),n.length>0&&(r.host=n)}if(e["http-path"]&&e["http-path"]!==""){let n=e["http-path"];Array.isArray(n)?r.path=`${n[0]}`:n!==""&&(r.path=`${n}`)}t.tls.insecure&&(t.tls.server_name=r.host[0]),r.host?.length===1&&(r.host=r.host[0]);for(let n of Object.keys(r.headers)){let i=r.headers[n];i.length===1&&(r.headers[n]=i[0])}t.transport=r},s3=(e,t)=>{let r={type:"http"};if(e["h2-opts"]){let{host:n="",path:i=""}=e["h2-opts"];i!==""&&(r.path=`${i}`),n!==""&&(Array.isArray(n)||(n=`${n}`.split(",").map(a=>a.trim())),n.length>0&&(r.host=n))}if(e["h2-host"]&&e["h2-host"]!==""){let n=e["h2-host"];Array.isArray(n)||(n=`${n}`.split(",").map(i=>i.trim())),n.length>0&&(r.host=n)}e["h2-path"]&&e["h2-path"]!==""&&(r.path=`${e["h2-path"]}`),t.tls.enabled=!0,t.tls.insecure&&(t.tls.server_name=r.host[0]),r.host.length===1&&(r.host=r.host[0]),t.transport=r},Yv=(e,t)=>{let r={type:"grpc"};if(e["grpc-opts"]){let n=e["grpc-opts"]["grpc-service-name"];n!=null&&n!==""&&(r.service_name=`${n}`)}t.transport=r},uu=(e,t)=>{e.tls&&(t.tls.enabled=!0),e.servername&&e.servername!==""&&(t.tls.server_name=e.servername),e.peer&&e.peer!==""&&(t.tls.server_name=e.peer),e.sni&&e.sni!==""&&(t.tls.server_name=e.sni),e["skip-cert-verify"]&&(t.tls.insecure=!0),e.insecure&&(t.tls.insecure=!0),e["disable-sni"]&&(t.tls.disable_sni=!0),typeof e.alpn=="string"?t.tls.alpn=[e.alpn]:Array.isArray(e.alpn)&&(t.tls.alpn=e.alpn),e.ca&&(t.tls.certificate_path=`${e.ca}`),e.ca_str&&(t.tls.certificate=[e.ca_str]),e["ca-str"]&&(t.tls.certificate=[e["ca-str"]]),e["reality-opts"]&&(t.tls.reality={enabled:!0},e["reality-opts"]["public-key"]&&(t.tls.reality.public_key=e["reality-opts"]["public-key"]),e["reality-opts"]["short-id"]&&(t.tls.reality.short_id=e["reality-opts"]["short-id"]),t.tls.utls={enabled:!0}),!["hysteria","hysteria2","tuic"].includes(e.type)&&e["client-fingerprint"]&&e["client-fingerprint"]!==""&&(t.tls.utls={enabled:!0,fingerprint:e["client-fingerprint"]}),e._fragment&&(t.tls.fragment=!!e._fragment),e._fragment_fallback_delay&&(t.tls.fragment_fallback_delay=e._fragment_fallback_delay),e._record_fragment&&(t.tls.record_fragment=!!e._record_fragment),e._certificate&&(t.tls.certificate=e._certificate),e._certificate_path&&(t.tls.certificate_path=e._certificate_path),e._certificate_public_key_sha256&&(t.tls.certificate_public_key_sha256=e._certificate_public_key_sha256),e._client_certificate&&(t.tls.client_certificate=e._client_certificate),e._client_certificate_path&&(t.tls.client_certificate_path=e._client_certificate_path),e._client_key&&(t.tls.client_key=e._client_key),e._client_key_path&&(t.tls.client_key_path=e._client_key_path),t.tls.enabled||delete t.tls},xH=(e={})=>{let t={tag:e.name,type:"ssh",server:e.server,server_port:parseInt(`${e.port}`,10)};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e.username&&(t.user=e.username),e.password&&(t.password=e.password),e.privateKey&&(t.private_key_path=e.privateKey),e["private-key"]&&(t.private_key_path=e["private-key"]),e["private-key-passphrase"]&&(t.private_key_passphrase=e["private-key-passphrase"]),e["server-fingerprint"]&&(t.host_key=[e["server-fingerprint"]],t.host_key_algorithms=[e["server-fingerprint"].split(" ")[0]]),e["host-key"]&&(t.host_key=e["host-key"]),e["host-key-algorithms"]&&(t.host_key_algorithms=e["host-key-algorithms"]),e["fast-open"]&&(t.udp_fragment=!0),wi(e,t),Xn(e,t),Wn(e,t),t},RH=(e={})=>{let t={tag:e.name,type:"http",server:e.server,server_port:parseInt(`${e.port}`,10),tls:{enabled:!1,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";if(e.username&&(t.username=e.username),e.password&&(t.password=e.password),e.headers){t.headers={};for(let r of Object.keys(e.headers))t.headers[r]=`${e.headers[r]}`;Object.keys(t.headers).length===0&&delete t.headers}return e["fast-open"]&&(t.udp_fragment=!0),wi(e,t),Xn(e,t),uu(e,t),Wn(e,t),t},TH=(e={})=>{let t={tag:e.name,type:"socks",server:e.server,server_port:parseInt(`${e.port}`,10),version:"5"};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e.username&&(t.username=e.username),e.password&&(t.password=e.password),e.uot&&(t.udp_over_tcp=!0),e["udp-over-tcp"]&&(t.udp_over_tcp={enabled:!0,version:!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?1:2}),e["fast-open"]&&(t.udp_fragment=!0),fa(e,t),wi(e,t),Xn(e,t),Wn(e,t),t},OH=(e={})=>{let t={tag:e.name,type:"shadowsocks",method:e.cipher,password:e.password,detour:`${e.name}_shadowtls`};e.uot&&(t.udp_over_tcp=!0),e["udp-over-tcp"]&&(t.udp_over_tcp={enabled:!0,version:!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?1:2});let r={tag:`${e.name}_shadowtls`,type:"shadowtls",server:e.server,server_port:parseInt(`${e.port}`,10),version:e["plugin-opts"].version,password:e["plugin-opts"].password,tls:{enabled:!0,server_name:e["plugin-opts"].host,utls:{enabled:!0,fingerprint:e["client-fingerprint"]}}};if(r.server_port<0||r.server_port>65535)throw"\u7AEF\u53E3\u503C\u975E\u6CD5";return e["fast-open"]===!0&&(r.udp_fragment=!0),wi(e,r),Xn(e,r),ys(e.smux,t),Wn(e,r),{type:"ss-with-st",ssPart:t,stPart:r}},kH=(e={})=>{let t={tag:e.name,type:"shadowsocks",server:e.server,server_port:parseInt(`${e.port}`,10),method:e.cipher,password:e.password};if(t.server_port<0||t.server_port>65535)throw"invalid port";if(e.uot&&(t.udp_over_tcp=!0),e["udp-over-tcp"]&&(t.udp_over_tcp={enabled:!0,version:!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?1:2}),e["fast-open"]&&(t.udp_fragment=!0),fa(e,t),wi(e,t),Xn(e,t),ys(e.smux,t),Wn(e,t),e.plugin){let r=[];e.plugin==="obfs"&&(t.plugin="obfs-local",t.plugin_opts="",e["obfs-host"]&&(e["plugin-opts"].host=e["obfs-host"]),Object.keys(e["plugin-opts"]).forEach(n=>{switch(n){case"mode":r.push(`obfs=${e["plugin-opts"].mode}`);break;case"host":r.push(`obfs-host=${e["plugin-opts"].host}`);break;default:r.push(`${n}=${e["plugin-opts"][n]}`);break}})),e.plugin==="v2ray-plugin"&&(t.plugin="v2ray-plugin",e["ws-host"]&&(e["plugin-opts"].host=e["ws-host"]),e["ws-path"]&&(e["plugin-opts"].path=e["ws-path"]),Object.keys(e["plugin-opts"]).forEach(n=>{switch(n){case"tls":e["plugin-opts"].tls&&r.push("tls");break;case"host":r.push(`host=${e["plugin-opts"].host}`);break;case"path":r.push(`path=${e["plugin-opts"].path}`);break;case"headers":r.push(`headers=${JSON.stringify(e["plugin-opts"].headers)}`);break;case"mux":e["plugin-opts"].mux&&(t.multiplex={enabled:!0});break;default:r.push(`${n}=${e["plugin-opts"][n]}`)}})),t.plugin_opts=r.join(";")}return t},NH=(e={})=>{let t={tag:e.name,type:"shadowsocksr",server:e.server,server_port:parseInt(`${e.port}`,10),method:e.cipher,password:e.password,obfs:e.obfs,protocol:e.protocol};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e["obfs-param"]&&(t.obfs_param=e["obfs-param"]),e["protocol-param"]&&e["protocol-param"]!==""&&(t.protocol_param=e["protocol-param"]),e["fast-open"]&&(t.udp_fragment=!0),wi(e,t),Xn(e,t),ys(e.smux,t),Wn(e,t),t},LH=(e={})=>{let t={tag:e.name,type:"vmess",server:e.server,server_port:parseInt(`${e.port}`,10),uuid:e.uuid,security:e.cipher,alter_id:parseInt(`${e.alterId}`,10),tls:{enabled:!1,server_name:e.server,insecure:!1}};if(["auto","none","zero","aes-128-gcm","chacha20-poly1305","aes-128-ctr"].indexOf(t.security)===-1&&(t.security="auto"),t.server_port<0||t.server_port>65535)throw"invalid port";return e.xudp&&(t.packet_encoding="xudp"),e["fast-open"]&&(t.udp_fragment=!0),e.network==="ws"&&Gv(e,t),e.network==="h2"&&s3(e,t),e.network==="http"&&i3(e,t),e.network==="grpc"&&Yv(e,t),fa(e,t),wi(e,t),Xn(e,t),uu(e,t),ys(e.smux,t),Wn(e,t),t},UH=(e={})=>{let t={tag:e.name,type:"vless",server:e.server,server_port:parseInt(`${e.port}`,10),uuid:e.uuid,tls:{enabled:!1,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e.xudp&&(t.packet_encoding="xudp"),e["fast-open"]&&(t.udp_fragment=!0),e.flow!=null&&(t.flow=e.flow),e.network==="ws"&&Gv(e,t),e.network==="h2"&&s3(e,t),e.network==="http"&&i3(e,t),e.network==="grpc"&&Yv(e,t),fa(e,t),wi(e,t),Xn(e,t),ys(e.smux,t),uu(e,t),Wn(e,t),t},jH=(e={})=>{let t={tag:e.name,type:"trojan",server:e.server,server_port:parseInt(`${e.port}`,10),password:e.password,tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e["fast-open"]&&(t.udp_fragment=!0),e.network==="grpc"&&Yv(e,t),e.network==="ws"&&Gv(e,t),fa(e,t),wi(e,t),Xn(e,t),uu(e,t),ys(e.smux,t),Wn(e,t),t},HH=(e={})=>{let t={tag:e.name,type:"naive",server:e.server,server_port:parseInt(`${e.port}`,10),tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";e.username&&(t.username=e.username),e.password&&(t.password=e.password),e.uot&&(t.udp_over_tcp=!0),e["udp-over-tcp"]&&(t.udp_over_tcp={enabled:!0,version:!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?1:2});let r=parseInt(`${e["insecure-concurrency"]}`,10);return Number.isInteger(r)&&r>=0&&(t.insecure_concurrency=r),e["extra-headers"]&&(t.extra_headers=e["extra-headers"]),e.quic&&(t.quic=!!e.quic),e["quic-congestion-control"]&&(t.quic_congestion_control=e["quic-congestion-control"]),e["fast-open"]&&(t.udp_fragment=!0),wi(e,t),Xn(e,t),uu(e,t),ys(e.smux,t),Wn(e,t),t.tls?.insecure&&(se.info("Platform sing-box: insecure is not supported on naive outbound"),delete t.tls.insecure),t},MH=(e={})=>{let t={tag:e.name,type:"hysteria",server:e.server,server_port:parseInt(`${e.port}`,10),disable_mtu_discovery:!1,tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";e["hop-interval"]&&(t.hop_interval=/^\d+$/.test(e["hop-interval"])?`${e["hop-interval"]}s`:e["hop-interval"]),e.ports&&(t.server_ports=e.ports.split(/\s*,\s*/).map(n=>{let i=n.replace(/\s*-\s*/g,":");return i.includes(":")?i:`${i}:${i}`})),e.auth_str&&(t.auth_str=`${e.auth_str}`),e["auth-str"]&&(t.auth_str=`${e["auth-str"]}`),e["fast-open"]&&(t.udp_fragment=!0);let r=new RegExp("^[0-9]+[ ]*[KMGT]*[Bb]ps$");return r.test(`${e.up}`)&&!`${e.up}`.endsWith("Mbps")?t.up=`${e.up}`:t.up_mbps=parseInt(`${e.up}`,10),r.test(`${e.down}`)&&!`${e.down}`.endsWith("Mbps")?t.down=`${e.down}`:t.down_mbps=parseInt(`${e.down}`,10),e.obfs&&(t.obfs=e.obfs),e.recv_window_conn&&(t.recv_window_conn=e.recv_window_conn),e["recv-window-conn"]&&(t.recv_window_conn=e["recv-window-conn"]),e.recv_window&&(t.recv_window=e.recv_window),e["recv-window"]&&(t.recv_window=e["recv-window"]),e.disable_mtu_discovery&&(typeof e.disable_mtu_discovery=="boolean"?t.disable_mtu_discovery=e.disable_mtu_discovery:e.disable_mtu_discovery===1&&(t.disable_mtu_discovery=!0)),fa(e,t),uu(e,t),Xn(e,t),wi(e,t),ys(e.smux,t),Wn(e,t),t},qH=(e={})=>{let t={tag:e.name,type:"hysteria2",server:e.server,server_port:parseInt(`${e.port}`,10),password:e.password,obfs:{},tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e["hop-interval"]&&(t.hop_interval=/^\d+$/.test(e["hop-interval"])?`${e["hop-interval"]}s`:e["hop-interval"]),e.ports&&(t.server_ports=e.ports.split(/\s*,\s*/).map(r=>{let n=r.replace(/\s*-\s*/g,":");return n.includes(":")?n:`${n}:${n}`})),e.up&&(t.up_mbps=parseInt(`${e.up}`,10)),e.down&&(t.down_mbps=parseInt(`${e.down}`,10)),e.obfs==="salamander"&&(t.obfs.type="salamander"),e["obfs-password"]&&(t.obfs.password=e["obfs-password"]),t.obfs.type||delete t.obfs,fa(e,t),uu(e,t),wi(e,t),Xn(e,t),ys(e.smux,t),Wn(e,t),t},VH=(e={})=>{let t={tag:e.name,type:"tuic",server:e.server,server_port:parseInt(`${e.port}`,10),uuid:e.uuid,password:e.password,tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e["fast-open"]&&(t.udp_fragment=!0),e["congestion-controller"]&&e["congestion-controller"]!=="cubic"&&(t.congestion_control=e["congestion-controller"]),e["udp-relay-mode"]&&e["udp-relay-mode"]!=="native"&&(t.udp_relay_mode=e["udp-relay-mode"]),e["reduce-rtt"]&&(t.zero_rtt_handshake=!0),e["udp-over-stream"]&&(t.udp_over_stream=!0),e["heartbeat-interval"]&&(t.heartbeat=`${e["heartbeat-interval"]}ms`),fa(e,t),wi(e,t),Xn(e,t),uu(e,t),ys(e.smux,t),Wn(e,t),t},KH=(e={})=>{let t={tag:e.name,type:"anytls",server:e.server,server_port:parseInt(`${e.port}`,10),password:e.password,tls:{enabled:!0,server_name:e.server,insecure:!1}};return/^\d+$/.test(e["idle-session-check-interval"])&&(t.idle_session_check_interval=`${e["idle-session-check-interval"]}s`),/^\d+$/.test(e["idle-session-timeout"])&&(t.idle_session_timeout=`${e["idle-session-timeout"]}s`),/^\d+$/.test(e["min-idle-session"])&&(t.min_idle_session=parseInt(`${e["min-idle-session"]}`,10)),fa(e,t),Xn(e,t),uu(e,t),Wn(e,t),t},zH=(e={})=>{let t=["ip","ipv6"].map(n=>e[n]).map(n=>{if(Tr(n))return`${n}/32`;if(Mr(n))return`${n}/128`}).filter(n=>n),r={tag:e.name,type:"wireguard",server:e.server,server_port:parseInt(`${e.port}`,10),local_address:t,private_key:e["private-key"],peer_public_key:e["public-key"],pre_shared_key:e["pre-shared-key"],reserved:[]};if(r.server_port<0||r.server_port>65535)throw"invalid port";if(e["fast-open"]&&(r.udp_fragment=!0),typeof e.reserved=="string")r.reserved=e.reserved;else if(Array.isArray(e.reserved))for(let n of e.reserved)r.reserved.push(n);else delete r.reserved;if(e.peers&&e.peers.length>0){r.peers=[];for(let n of e.peers){let i={server:n.server,server_port:parseInt(`${n.port}`,10),public_key:n["public-key"],allowed_ips:n["allowed-ips"]||n.allowed_ips,reserved:[]};if(typeof n.reserved=="string")i.reserved.push(n.reserved);else if(Array.isArray(n.reserved))for(let a of n.reserved)i.reserved.push(a);else delete i.reserved;n["pre-shared-key"]&&(i.pre_shared_key=n["pre-shared-key"]),r.peers.push(i)}}return fa(e,r),wi(e,r),Xn(e,r),ys(e.smux,r),Wn(e,r),r};function tp(){return{type:"ALL",produce:(r,n,i={})=>{let a=[];return Oi().produce(r,"internal",{"include-unsupported-proxy":!0}).map(s=>{try{switch(s.type){case"ssh":a.push(xH(s));break;case"http":a.push(RH(s));break;case"socks5":if(s.tls)throw new Error(`Platform sing-box does not support proxy type: ${s.type} with tls`);a.push(TH(s));break;case"ss":if(s.plugin==="shadow-tls"){let{ssPart:u,stPart:c}=OH(s);a.push(u),a.push(c)}else a.push(kH(s));break;case"ssr":if(i["include-unsupported-proxy"])a.push(NH(s));else throw new Error(`Platform sing-box does not support proxy type: ${s.type}`);break;case"vmess":if(!s.network||["tcp","ws","grpc","h2","http"].includes(s.network))a.push(LH(s));else throw new Error(`Platform sing-box does not support proxy type: ${s.type} with network ${s.network}`);break;case"vless":if(!s.flow||["xtls-rprx-vision"].includes(s.flow))a.push(UH(s));else throw new Error(`Platform sing-box does not support proxy type: ${s.type} with flow ${s.flow}`);break;case"trojan":if(!s.flow)a.push(jH(s));else throw new Error(`Platform sing-box does not support proxy type: ${s.type} with flow ${s.flow}`);break;case"naive":a.push(HH(s));break;case"hysteria":a.push(MH(s));break;case"hysteria2":a.push(qH(s,i["include-unsupported-proxy"]));break;case"tuic":if(!s.token||s.token.length===0)a.push(VH(s));else throw new Error("Platform sing-box does not support proxy type: TUIC v4");break;case"wireguard":a.push(zH(s));break;case"anytls":a.push(KH(s));break;default:throw new Error(`Platform sing-box does not support proxy type: ${s.type}`)}}catch(u){se.error(u.message??u)}}),n==="internal"?a:JSON.stringify({outbounds:a},null,2)}}}function rp(){return{type:"ALL",produce:(r,n,i={})=>{let a=r.filter(s=>!(!["http","https","socks5","ss","trojan","hysteria2","vless","vmess","tuic"].includes(s.type)||s.type==="ss"&&(s.plugin==="obfs"&&!["http","tls"].includes(s["plugin-opts"]?.mode)||!["chacha20-ietf-poly1305","chacha20-poly1305","aes-256-gcm","aes-128-gcm","none","tbale","rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","cast5-cfb","des-cfb","idea-cfb","rc2-cfb","seed-cfb","salsa20","chacha20","chacha20-ietf","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(s.cipher))||s.type==="vmess"&&!["http","ws","tcp"].includes(s.network)&&s.network||s.type==="trojan"&&!["http","ws","tcp"].includes(s.network)&&s.network||s.type==="vless"&&!["http","ws","tcp"].includes(s.network)&&s.network||s.type==="tuic"&&s.token&&s.token.length!==0)).map(s=>{let u={...s},c;s.tls&&!s.sni&&(s.sni=s.server);let f=s.prev_hop||s["underlying-proxy"]||s["dialer-proxy"]||s.detour;if(s.type==="http")s={type:s.tls?"https":"http",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,tfo:s.tfo||s["fast-open"],next_hop:s.next_hop,...s.tls?{sni:s.sni,skip_tls_verify:s["skip-cert-verify"]}:{}};else if(s.type==="socks5")s={type:"socks5",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,tfo:s.tfo||s["fast-open"],udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop};else if(s.type==="ss")s={type:"shadowsocks",name:s.name,method:s.cipher==="chacha20-ietf-poly1305"?"chacha20-poly1305":s.cipher,server:s.server,port:s.port,password:s.password,tfo:s.tfo||s["fast-open"],udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop},u.plugin==="obfs"&&(s.obfs=u["plugin-opts"].mode,s.obfs_host=u["plugin-opts"].host,s.obfs_uri=u["plugin-opts"].path);else if(s.type==="hysteria2")s={type:"hysteria2",name:s.name,server:s.server,port:s.port,auth:s.password,tfo:s.tfo||s["fast-open"],udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop,sni:s.sni,skip_tls_verify:s["skip-cert-verify"],port_hopping:s.ports,port_hopping_interval:s["hop-interval"]},u["obfs-password"]&&u.obfs=="salamander"&&(s.obfs="salamander",s.obfs_password=u["obfs-password"]);else if(s.type==="tuic")s={type:"tuic",name:s.name,server:s.server,port:s.port,uuid:s.uuid,password:s.password,next_hop:s.next_hop,sni:s.sni,alpn:Array.isArray(s.alpn)?s.alpn:[s.alpn||"h3"],skip_tls_verify:s["skip-cert-verify"],port_hopping:s.ports,port_hopping_interval:s["hop-interval"]};else if(s.type==="trojan")s.network==="ws"&&(s.websocket={path:s["ws-opts"]?.path,host:s["ws-opts"]?.headers?.Host}),s={type:"trojan",name:s.name,server:s.server,port:s.port,password:s.password,tfo:s.tfo||s["fast-open"],udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop,sni:s.sni,skip_tls_verify:s["skip-cert-verify"],websocket:s.websocket};else if(s.type==="vmess"){let d=s.cipher;d&&!["auto","none","zero","aes-128-gcm","chacha20-poly1305"].includes(d)&&(d="auto"),s.network==="ws"?s.transport={[s.tls?"wss":"ws"]:{path:s["ws-opts"]?.path,headers:{Host:s["ws-opts"]?.headers?.Host},sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0}}:s.network==="http"?s.transport={http1:{method:s["http-opts"]?.method,path:Array.isArray(s["http-opts"]?.path)?s["http-opts"]?.path[0]:s["http-opts"]?.path,headers:{Host:Array.isArray(s["http-opts"]?.headers?.Host)?s["http-opts"]?.headers?.Host[0]:s["http-opts"]?.headers?.Host},skip_tls_verify:s["skip-cert-verify"]}}:s.network==="h2"?s.transport={http2:{method:s["h2-opts"]?.method,path:Array.isArray(s["h2-opts"]?.path)?s["h2-opts"]?.path[0]:s["h2-opts"]?.path,headers:{Host:Array.isArray(s["h2-opts"]?.headers?.Host)?s["h2-opts"]?.headers?.Host[0]:s["h2-opts"]?.headers?.Host},skip_tls_verify:s["skip-cert-verify"]}}:(s.network==="tcp"||!s.network)&&s.tls&&(s.transport={tls:{sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0}});let v;(ue(s,"aead")&&!s.aead||s.alterId!==0)&&(v=!0),s={type:"vmess",name:s.name,server:s.server,port:s.port,user_id:s.uuid,security:d,tfo:s.tfo||s["fast-open"],legacy:v,udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop,transport:s.transport}}else if(s.type==="vless"){if(s.network==="ws")s.transport={[s.tls?"wss":"ws"]:{path:s["ws-opts"]?.path,headers:{Host:s["ws-opts"]?.headers?.Host},sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0}};else if(s.network==="http")s.transport={http:{method:s["http-opts"]?.method,path:Array.isArray(s["http-opts"]?.path)?s["http-opts"]?.path[0]:s["http-opts"]?.path,headers:{Host:Array.isArray(s["http-opts"]?.headers?.Host)?s["http-opts"]?.headers?.Host[0]:s["http-opts"]?.headers?.Host},skip_tls_verify:s["skip-cert-verify"]}};else if(s.network==="tcp"||!s.network){let d;if((s["reality-opts"]?.["short-id"]||s["reality-opts"]?.["public-key"])&&(d={short_id:s["reality-opts"]["short-id"],public_key:s["reality-opts"]["public-key"]}),s.transport={[s.tls?"tls":"tcp"]:{sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0,reality:d}},typeof s.flow<"u"&&!["xtls-rprx-vision"].includes(s.flow))throw new Error(`VLESS flow(${s.flow}) is not supported`);c=s.flow}s={type:"vless",name:s.name,server:s.server,port:s.port,user_id:s.uuid,security:s.cipher,tfo:s.tfo||s["fast-open"],udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop,transport:s.transport,flow:c}}if(["http","https","socks5","ss","trojan","vless","vmess"].includes(u.type)){if(ue(u,"shadow-tls-password")){if(u["shadow-tls-version"]!=3)throw new Error(`shadow-tls version ${u["shadow-tls-version"]} is not supported`);s.shadow_tls={password:u["shadow-tls-password"],sni:u["shadow-tls-sni"]}}else if(["shadow-tls"].includes(u.plugin)&&u["plugin-opts"]){if(u["plugin-opts"].version!=3)throw new Error(`shadow-tls version ${u["plugin-opts"].version} is not supported`);s.shadow_tls={password:u["plugin-opts"].password,sni:u["plugin-opts"].host}}}if(["socks5","ss","trojan","vless","vmess"].includes(u.type)&&(["on","true",!0,"1",1].includes(u["block-quic"])?s.block_quic=!0:["off","false",!1,"0",0].includes(u["block-quic"])&&(s.block_quic=!1)),["ss"].includes(u.type)&&s.shadow_tls&&u["udp-port"]>0&&u["udp-port"]<=65535&&(s.udp_port=u["udp-port"]),delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],s.transport){for(let d in s.transport)(Object.keys(s.transport[d]).length===0||Object.values(s.transport[d]).every(v=>v==null))&&delete s.transport[d];Object.keys(s.transport).length===0&&delete s.transport}if(n!=="internal")for(let d in s)(s[d]==null||/^_/i.test(d))&&delete s[d];return{[s.type]:{...s,type:void 0,prev_hop:f}}});return n==="internal"?a:`proxies: `+a.map(s=>" - "+JSON.stringify(s)+` `).join("")}}}function a3(){return{type:"ALL",produce:(r,n)=>n==="internal"?r:JSON.stringify(r,null,2)}}var u3={qx:uh(),QX:uh(),QuantumultX:uh(),surge:Xc(),Surge:Xc(),SurgeMac:Jg(),Loon:em(),Clash:Qg(),meta:Oi(),clashmeta:Oi(),"clash.meta":Oi(),"Clash.Meta":Oi(),ClashMeta:Oi(),mihomo:Oi(),Mihomo:Oi(),uri:yl(),URI:yl(),v2:ah(),v2ray:ah(),V2Ray:ah(),json:a3(),JSON:a3(),stash:gd(),Stash:gd(),shadowrocket:oh(),Shadowrocket:oh(),ShadowRocket:oh(),surfboard:ep(),Surfboard:ep(),singbox:tp(),"sing-box":tp(),egern:rp(),Egern:rp()};var dD=yn(gh()),tq=String.raw` // global initializer {{ function $set(obj, path, value) { if (Object(obj) !== obj) return obj; if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []; path .slice(0, -1) .reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[ path[path.length - 1] ] = value; return obj; } }} // per-parser initializer { const proxy = {}; const obfs = {}; const $ = {}; function handleWebsocket() { if (obfs.type === "ws") { proxy.network = "ws"; $set(proxy, "ws-opts.path", obfs.path); $set(proxy, "ws-opts.headers", obfs['ws-headers']); if (proxy['ws-opts'] && proxy['ws-opts']['headers'] && proxy['ws-opts']['headers'].Host) { proxy['ws-opts']['headers'].Host = proxy['ws-opts']['headers'].Host.replace(/^"(.*)"$/, '$1') } } } function handleShadowTLS() { if (proxy['shadow-tls-password'] && !proxy['shadow-tls-version']) { proxy['shadow-tls-version'] = 2; } } } start = (anytls/shadowsocks/vmess/trojan/https/http/snell/socks5/socks5_tls/tuic/tuic_v5/wireguard/hysteria2/ssh/direct) { return proxy; } shadowsocks = tag equals "ss" address (method/passwordk/obfs/obfs_host/obfs_uri/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/udp_port/others)* { proxy.type = "ss"; // handle obfs if (obfs.type == "http" || obfs.type === "tls") { proxy.plugin = "obfs"; $set(proxy, "plugin-opts.mode", obfs.type); $set(proxy, "plugin-opts.host", obfs.host); $set(proxy, "plugin-opts.path", obfs.path); } handleShadowTLS(); } vmess = tag equals "vmess" address (vmess_uuid/vmess_aead/ws/ws_path/ws_headers/method/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls/sni/tls_fingerprint/tls_verification/fast_open/tfo/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "vmess"; proxy.cipher = proxy.cipher || "none"; // Surfboard 与 Surge 默认不一致, 不管 Surfboard https://getsurfboard.com/docs/profile-format/proxy/external-proxy/vmess if (proxy.aead) { proxy.alterId = 0; } else { proxy.alterId = 1; } handleWebsocket(); handleShadowTLS(); } trojan = tag equals "trojan" address (passwordk/ws/ws_path/ws_headers/tls/sni/tls_fingerprint/tls_verification/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "trojan"; handleWebsocket(); handleShadowTLS(); } https = tag equals "https" address (username password)? (usernamek passwordk)? (sni/tls_fingerprint/tls_verification/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "http"; proxy.tls = true; handleShadowTLS(); } http = tag equals "http" address (username password)? (usernamek passwordk)? (ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "http"; handleShadowTLS(); } ssh = tag equals "ssh" address (username password)? (usernamek passwordk)? (server_fingerprint/idle_timeout/private_key/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "ssh"; handleShadowTLS(); } snell = tag equals "snell" address (snell_version/snell_psk/obfs/obfs_host/obfs_uri/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/udp_relay/reuse/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "snell"; // handle obfs if (obfs.type == "http" || obfs.type === "tls") { $set(proxy, "obfs-opts.mode", obfs.type); $set(proxy, "obfs-opts.host", obfs.host); $set(proxy, "obfs-opts.path", obfs.path); } handleShadowTLS(); } tuic = tag equals "tuic" address (alpn/token/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls_fingerprint/tls_verification/sni/fast_open/tfo/ecn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/port_hopping_interval/others)* { proxy.type = "tuic"; handleShadowTLS(); } tuic_v5 = tag equals "tuic-v5" address (alpn/passwordk/uuidk/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls_fingerprint/tls_verification/sni/fast_open/tfo/ecn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/port_hopping_interval/others)* { proxy.type = "tuic"; proxy.version = 5; handleShadowTLS(); } wireguard = tag equals "wireguard" (section_name/no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "wireguard-surge"; handleShadowTLS(); } hysteria2 = tag equals "hysteria2" address (no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/sni/tls_verification/passwordk/tls_fingerprint/download_bandwidth/ecn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/port_hopping_interval/others)* { proxy.type = "hysteria2"; handleShadowTLS(); } socks5 = tag equals "socks5" address (username password)? (usernamek passwordk)? (udp_relay/no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "socks5"; handleShadowTLS(); } socks5_tls = tag equals "socks5-tls" address (username password)? (usernamek passwordk)? (udp_relay/no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/sni/tls_fingerprint/tls_verification/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "socks5"; proxy.tls = true; handleShadowTLS(); } anytls = tag equals "anytls" address (passwordk/reuse/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls_fingerprint/tls_verification/sni/fast_open/tfo/block_quic/others)* { proxy.type = "anytls"; proxy.tls = true; } direct = tag equals "direct" (udp_relay/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/block_quic/others)* { proxy.type = "direct"; } address = comma server:server comma port:port { proxy.server = server; proxy.port = port; } server = ip/domain ip = & { const start = peg$currPos; let j = start; while (j < input.length) { if (input[j] === ",") break; j++; } peg$currPos = j; $.ip = input.substring(start, j).trim(); return true; } { return $.ip; } domain = match:[0-9a-zA-z-_.]+ { const domain = match.join(""); if (/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/.test(domain)) { return domain; } } port = digits:[0-9]+ { const port = parseInt(digits.join(""), 10); if (port >= 0 && port <= 65535) { return port; } } port_hopping_interval = comma "port-hopping-interval" equals match:$[0-9]+ { proxy["hop-interval"] = parseInt(match.trim()); } username = & { let j = peg$currPos; let start, end; let first = true; while (j < input.length) { if (input[j] === ',') { if (first) { start = j + 1; first = false; } else { end = j; break; } } j++; } const match = input.substring(start, end); if (match.indexOf("=") === -1) { $.username = match; peg$currPos = end; return true; } } { proxy.username = $.username.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); } password = comma match:[^,]+ { proxy.password = match.join("").replace(/^"(.*)"$/, '$1').replace(/^'(.*?)'$/, '$1'); } tls = comma "tls" equals flag:bool { proxy.tls = flag; } sni = comma "sni" equals sni:("off"/domain) { if (sni === "off") { proxy["disable-sni"] = true; } else { proxy.sni = sni; } } tls_verification = comma "skip-cert-verify" equals flag:bool { proxy["skip-cert-verify"] = flag; } tls_fingerprint = comma "server-cert-fingerprint-sha256" equals tls_fingerprint:$[^,]+ { proxy["tls-fingerprint"] = tls_fingerprint.trim(); } snell_psk = comma "psk" equals match:[^,]+ { proxy.psk = match.join(""); } snell_version = comma "version" equals match:$[0-9]+ { proxy.version = parseInt(match.trim()); } usernamek = comma "username" equals match:[^,]+ { proxy.username = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); } passwordk = comma "password" equals match:[^,]+ { proxy.password = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); } vmess_uuid = comma "username" equals match:[^,]+ { proxy.uuid = match.join(""); } vmess_aead = comma "vmess-aead" equals flag:bool { proxy.aead = flag; } method = comma "encrypt-method" equals cipher:cipher { proxy.cipher = cipher; } cipher = ("aes-128-cfb"/"aes-128-ctr"/"aes-128-gcm"/"aes-192-cfb"/"aes-192-ctr"/"aes-192-gcm"/"aes-256-cfb"/"aes-256-ctr"/"aes-256-gcm"/"bf-cfb"/"camellia-128-cfb"/"camellia-192-cfb"/"camellia-256-cfb"/"cast5-cfb"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"des-cfb"/"idea-cfb"/"none"/"rc2-cfb"/"rc4-md5"/"rc4"/"salsa20"/"seed-cfb"/"xchacha20-ietf-poly1305"/"2022-blake3-aes-128-gcm"/"2022-blake3-aes-256-gcm"); ws = comma "ws" equals flag:bool { obfs.type = "ws"; } ws_headers = comma "ws-headers" equals headers:$[^,]+ { const pairs = headers.split("|"); const result = {}; pairs.forEach(pair => { const [key, value] = pair.trim().split(":"); result[key.trim()] = value.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }) obfs["ws-headers"] = result; } ws_path = comma "ws-path" equals path:uri { obfs.path = path.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); } obfs = comma "obfs" equals type:("http"/"tls") { obfs.type = type; } obfs_host = comma "obfs-host" equals host:domain { obfs.host = host; }; obfs_uri = comma "obfs-uri" equals path:uri { obfs.path = path } uri = $[^,]+ udp_relay = comma "udp-relay" equals flag:bool { proxy.udp = flag; } fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; } reuse = comma "reuse" equals flag:bool { proxy.reuse = flag; } ecn = comma "ecn" equals flag:bool { proxy.ecn = flag; } tfo = comma "tfo" equals flag:bool { proxy.tfo = flag; } ip_version = comma "ip-version" equals match:[^,]+ { proxy["ip-version"] = match.join(""); } section_name = comma "section-name" equals match:[^,]+ { proxy["section-name"] = match.join(""); } no_error_alert = comma "no-error-alert" equals match:[^,]+ { proxy["no-error-alert"] = match.join(""); } underlying_proxy = comma "underlying-proxy" equals match:[^,]+ { proxy["underlying-proxy"] = match.join(""); } download_bandwidth = comma "download-bandwidth" equals match:[^,]+ { proxy.down = match.join(""); } test_url = comma "test-url" equals match:[^,]+ { proxy["test-url"] = match.join(""); } test_udp = comma "test-udp" equals match:[^,]+ { proxy["test-udp"] = match.join(""); } test_timeout = comma "test-timeout" equals match:$[0-9]+ { proxy["test-timeout"] = parseInt(match.trim()); } tos = comma "tos" equals match:$[0-9]+ { proxy.tos = parseInt(match.trim()); } interface = comma "interface" equals match:[^,]+ { proxy.interface = match.join(""); } allow_other_interface = comma "allow-other-interface" equals flag:bool { proxy["allow-other-interface"] = flag; } hybrid = comma "hybrid" equals flag:bool { proxy.hybrid = flag; } idle_timeout = comma "idle-timeout" equals match:$[0-9]+ { proxy["idle-timeout"] = parseInt(match.trim()); } private_key = comma "private-key" equals match:[^,]+ { proxy["keystore-private-key"] = match.join("").replace(/^"(.*)"$/, '$1'); } server_fingerprint = comma "server-fingerprint" equals match:[^,]+ { proxy["server-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); } block_quic = comma "block-quic" equals match:[^,]+ { proxy["block-quic"] = match.join(""); } udp_port = comma "udp-port" equals match:$[0-9]+ { proxy["udp-port"] = parseInt(match.trim()); } shadow_tls_version = comma "shadow-tls-version" equals match:$[0-9]+ { proxy["shadow-tls-version"] = parseInt(match.trim()); } shadow_tls_sni = comma "shadow-tls-sni" equals match:[^,]+ { proxy["shadow-tls-sni"] = match.join(""); } shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { proxy["shadow-tls-password"] = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); } token = comma "token" equals match:[^,]+ { proxy.token = match.join(""); } alpn = comma "alpn" equals match:[^,]+ { proxy.alpn = match.join(""); } uuidk = comma "uuid" equals match:[^,]+ { proxy.uuid = match.join(""); } tag = match:[^=,]* { proxy.name = match.join("").trim(); } comma = _ "," _ equals = _ "=" _ _ = [ \r\t]* bool = b:("true"/"false") { return b === "true" } others = comma [^=,]+ equals [^=,]+ `,p2;function Ai(){return p2||(p2=dD.generate(tq)),p2}var pD=yn(gh()),rq=String.raw` // global initializer {{ function $set(obj, path, value) { if (Object(obj) !== obj) return obj; if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []; path .slice(0, -1) .reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[ path[path.length - 1] ] = value; return obj; } }} // per-parser initializer { const proxy = {}; const obfs = {}; const transport = {}; const $ = {}; function handleTransport() { if (transport.type === "tcp") { /* do nothing */ } else if (transport.type === "ws") { proxy.network = "ws"; $set(proxy, "ws-opts.path", transport.path); $set(proxy, "ws-opts.headers.Host", transport.host); } else if (transport.type === "http") { proxy.network = "http"; $set(proxy, "http-opts.path", transport.path); $set(proxy, "http-opts.headers.Host", transport.host); } } } start = (shadowsocksr/shadowsocks/vmess/vless/trojan/https/http/socks5/hysteria2) { return proxy; } shadowsocksr = tag equals "shadowsocksr"i address method password (ssr_protocol/ssr_protocol_param/obfs_ssr/obfs_ssr_param/obfs_host/obfs_uri/fast_open/udp_relay/udp_port/shadow_tls_version/shadow_tls_sni/shadow_tls_password/ip_mode/block_quic/others)*{ proxy.type = "ssr"; // handle ssr obfs proxy.obfs = obfs.type; } shadowsocks = tag equals "shadowsocks"i address method password (obfs_typev obfs_hostv)? (obfs_ss/obfs_host/obfs_uri/fast_open/udp_relay/udp_port/shadow_tls_version/shadow_tls_sni/shadow_tls_password/ip_mode/block_quic/others)* { proxy.type = "ss"; // handle ss obfs if (obfs.type == "http" || obfs.type === "tls") { proxy.plugin = "obfs"; $set(proxy, "plugin-opts.mode", obfs.type); $set(proxy, "plugin-opts.host", obfs.host); $set(proxy, "plugin-opts.path", obfs.path); } } vmess = tag equals "vmess"i address method uuid (transport/transport_host/transport_path/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/vmess_alterId/fast_open/udp_relay/ip_mode/public_key/short_id/block_quic/others)* { proxy.type = "vmess"; proxy.cipher = proxy.cipher || "none"; proxy.alterId = proxy.alterId || 0; handleTransport(); } vless = tag equals "vless"i address uuid (transport/transport_host/transport_path/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/flow/public_key/short_id/block_quic/others)* { proxy.type = "vless"; handleTransport(); } trojan = tag equals "trojan"i address password (transport/transport_host/transport_path/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/block_quic/others)* { proxy.type = "trojan"; handleTransport(); } hysteria2 = tag equals "hysteria2"i address password (tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/udp_relay/fast_open/download_bandwidth/salamander_password/ecn/ip_mode/block_quic/others)* { proxy.type = "hysteria2"; } https = tag equals "https"i address (username password)? (tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/block_quic/others)* { proxy.type = "http"; proxy.tls = true; } http = tag equals "http"i address (username password)? (fast_open/udp_relay/ip_mode/block_quic/others)* { proxy.type = "http"; } socks5 = tag equals "socks5"i address (username password)? (over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/block_quic/others)* { proxy.type = "socks5"; } address = comma server:server comma port:port { proxy.server = server; proxy.port = port; } server = ip/domain ip = & { const start = peg$currPos; let j = start; while (j < input.length) { if (input[j] === ",") break; j++; } peg$currPos = j; $.ip = input.substring(start, j).trim(); return true; } { return $.ip; } domain = match:[0-9a-zA-z-_.]+ { const domain = match.join(""); if (/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/.test(domain)) { return domain; } throw new Error("Invalid domain: " + domain); } port = digits:[0-9]+ { const port = parseInt(digits.join(""), 10); if (port >= 0 && port <= 65535) { return port; } throw new Error("Invalid port number: " + port); } method = comma cipher:cipher { proxy.cipher = cipher; } cipher = ("aes-128-cfb"/"aes-128-ctr"/"aes-128-gcm"/"aes-192-cfb"/"aes-192-ctr"/"aes-192-gcm"/"aes-256-cfb"/"aes-256-ctr"/"aes-256-gcm"/"auto"/"bf-cfb"/"camellia-128-cfb"/"camellia-192-cfb"/"camellia-256-cfb"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"none"/"rc4-md5"/"rc4"/"salsa20"/"xchacha20-ietf-poly1305"/"2022-blake3-aes-128-gcm"/"2022-blake3-aes-256-gcm"); username = & { let j = peg$currPos; let start, end; let first = true; while (j < input.length) { if (input[j] === ',') { if (first) { start = j + 1; first = false; } else { end = j; break; } } j++; } const match = input.substring(start, end); if (match.indexOf("=") === -1) { $.username = match; peg$currPos = end; return true; } } { proxy.username = $.username; } password = comma '"' match:[^"]* '"' { proxy.password = match.join(""); } uuid = comma '"' match:[^"]+ '"' { proxy.uuid = match.join(""); } obfs_typev = comma type:("http"/"tls") { obfs.type = type; } obfs_hostv = comma match:[^,]+ { obfs.host = match.join(""); } obfs_ss = comma "obfs-name" equals type:("http"/"tls") { obfs.type = type; } obfs_ssr = comma "obfs" equals type:("plain"/"http_simple"/"http_post"/"random_head"/"tls1.2_ticket_auth"/"tls1.2_ticket_fastauth") { obfs.type = type; } obfs_ssr_param = comma "obfs-param" equals match:$[^,]+ { proxy["obfs-param"] = match; } obfs_host = comma "obfs-host" equals host:domain { obfs.host = host; } obfs_uri = comma "obfs-uri" equals uri:uri { obfs.path = uri; } uri = $[^,]+ transport = comma "transport" equals type:("tcp"/"ws"/"http") { transport.type = type; } transport_host = comma "host" equals host:domain { transport.host = host; } transport_path = comma "path" equals path:uri { transport.path = path; } ssr_protocol = comma "protocol" equals protocol:("origin"/"auth_sha1_v4"/"auth_aes128_md5"/"auth_aes128_sha1"/"auth_chain_a"/"auth_chain_b") { proxy.protocol = protocol; } ssr_protocol_param = comma "protocol-param" equals param:$[^=,]+ { proxy["protocol-param"] = param; } vmess_alterId = comma "alterId" equals alterId:$[0-9]+ { proxy.alterId = parseInt(alterId); } udp_port = comma "udp-port" equals match:$[0-9]+ { proxy["udp-port"] = parseInt(match.trim()); } shadow_tls_version = comma "shadow-tls-version" equals match:$[0-9]+ { proxy["shadow-tls-version"] = parseInt(match.trim()); } shadow_tls_sni = comma "shadow-tls-sni" equals match:[^,]+ { proxy["shadow-tls-sni"] = match.join(""); } shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { proxy["shadow-tls-password"] = match.join(""); } over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; } tls_name = comma sni:("tls-name") equals host:domain { proxy.sni = host; } sni = comma sni:("sni") equals host:domain { proxy.sni = host; } tls_verification = comma "skip-cert-verify" equals flag:bool { proxy["skip-cert-verify"] = flag; } tls_cert_sha256 = comma "tls-cert-sha256" equals match:[^,]+ { proxy["tls-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); } tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals match:[^,]+ { proxy["tls-pubkey-sha256"] = match.join("").replace(/^"(.*)"$/, '$1'); } flow = comma "flow" equals match:[^,]+ { proxy["flow"] = match.join("").replace(/^"(.*)"$/, '$1'); } public_key = comma "public-key" equals match:[^,]+ { proxy["reality-opts"] = proxy["reality-opts"] || {}; proxy["reality-opts"]["public-key"] = match.join("").replace(/^"(.*)"$/, '$1'); } short_id = comma "short-id" equals match:[^,]+ { proxy["reality-opts"] = proxy["reality-opts"] || {}; proxy["reality-opts"]["short-id"] = match.join("").replace(/^"(.*)"$/, '$1'); } fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; } udp_relay = comma "udp" equals flag:bool { proxy.udp = flag; } ip_mode = comma "ip-mode" equals match:[^,]+ { proxy["ip-version"] = match.join(""); } ecn = comma "ecn" equals flag:bool { proxy.ecn = flag; } download_bandwidth = comma "download-bandwidth" equals match:[^,]+ { proxy.down = match.join(""); } salamander_password = comma "salamander-password" equals match:[^,]+ { proxy['obfs-password'] = match.join(""); proxy.obfs = 'salamander'; } block_quic = comma "block-quic" equals flag:bool { if(flag) proxy["block-quic"] = "on"; else proxy["block-quic"] = "off"; } tag = match:[^=,]* { proxy.name = match.join("").trim(); } comma = _ "," _ equals = _ "=" _ _ = [ \r\t]* bool = b:("true"/"false") { return b === "true" } others = comma [^=,]+ equals [^=,]+ `,g2;function ha(){return g2||(g2=pD.generate(rq)),g2}var gD=yn(gh()),nq=String.raw` // global initializer {{ function $set(obj, path, value) { if (Object(obj) !== obj) return obj; if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []; path .slice(0, -1) .reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[ path[path.length - 1] ] = value; return obj; } }} // per-parse initializer { const proxy = {}; const obfs = {}; const $ = {}; function handleObfs() { if (obfs.type === "ws" || obfs.type === "wss") { proxy.network = "ws"; if (obfs.type === 'wss') { proxy.tls = true; } $set(proxy, "ws-opts.path", obfs.path); $set(proxy, "ws-opts.headers.Host", obfs.host); } else if (obfs.type === "over-tls") { proxy.tls = true; } else if (obfs.type === "http") { proxy.network = "http"; $set(proxy, "http-opts.path", obfs.path); $set(proxy, "http-opts.headers.Host", obfs.host); } } } start = (trojan/shadowsocks/vmess/vless/http/socks5) { return proxy } trojan = "trojan" equals address (password/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/obfs/obfs_host/obfs_uri/tag/udp_relay/udp_over_tcp/fast_open/server_check_url/reality_base64_pubkey/reality_hex_shortid/others)* { proxy.type = "trojan"; handleObfs(); } shadowsocks = "shadowsocks" equals address (password/method/obfs_ssr/obfs_ss/obfs_host/obfs_uri/ssr_protocol/ssr_protocol_param/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/udp_relay/udp_over_tcp_new/fast_open/tag/server_check_url/reality_base64_pubkey/reality_hex_shortid/others)* { if (proxy.protocol || proxy.type === "ssr") { proxy.type = "ssr"; if (!proxy.protocol) { proxy.protocol = "origin"; } // handle ssr obfs if (obfs.host) proxy["obfs-param"] = obfs.host; if (obfs.type) proxy.obfs = obfs.type; } else { proxy.type = "ss"; // handle ss obfs if (obfs.type == "http" || obfs.type === "tls") { proxy.plugin = "obfs"; $set(proxy, "plugin-opts", { mode: obfs.type }); } else if (obfs.type === "ws" || obfs.type === "wss") { proxy.plugin = "v2ray-plugin"; $set(proxy, "plugin-opts.mode", "websocket"); if (obfs.type === "wss") { $set(proxy, "plugin-opts.tls", true); } } else if (obfs.type === 'over-tls') { throw new Error('ss over-tls is not supported'); } if (obfs.type) { $set(proxy, "plugin-opts.host", obfs.host); $set(proxy, "plugin-opts.path", obfs.path); } } } vmess = "vmess" equals address (uuid/method/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/obfs/obfs_host/obfs_uri/udp_relay/udp_over_tcp/fast_open/aead/server_check_url/reality_base64_pubkey/reality_hex_shortid/others)* { proxy.type = "vmess"; proxy.cipher = proxy.cipher || "none"; if (proxy.aead === false) { proxy.alterId = 1; } else { proxy.alterId = 0; } handleObfs(); } vless = "vless" equals address (uuid/method/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/obfs/obfs_host/obfs_uri/udp_relay/udp_over_tcp/fast_open/aead/server_check_url/reality_base64_pubkey/reality_hex_shortid/vless_flow/others)* { proxy.type = "vless"; proxy.cipher = proxy.cipher || "none"; handleObfs(); } http = "http" equals address (username/password/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/fast_open/udp_relay/udp_over_tcp/server_check_url/reality_base64_pubkey/reality_hex_shortid/others)*{ proxy.type = "http"; } socks5 = "socks5" equals address (username/password/password/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/fast_open/udp_relay/udp_over_tcp/server_check_url/reality_base64_pubkey/reality_hex_shortid/others)* { proxy.type = "socks5"; } address = server:server ":" port:port { proxy.server = server; proxy.port = port; } server = ip/domain domain = match:[0-9a-zA-z-_.]+ { const domain = match.join(""); if (/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/.test(domain)) { return domain; } } ip = & { const start = peg$currPos; let end; let j = start; while (j < input.length) { if (input[j] === ",") break; if (input[j] === ":") end = j; j++; } peg$currPos = end || j; $.ip = input.substring(start, end).trim(); return true; } { return $.ip; } port = digits:[0-9]+ { const port = parseInt(digits.join(""), 10); if (port >= 0 && port <= 65535) { return port; } } username = comma "username" equals username:[^,]+ { proxy.username = username.join("").trim(); } password = comma "password" equals password:[^,]+ { proxy.password = password.join("").trim(); } uuid = comma "password" equals uuid:[^,]+ { proxy.uuid = uuid.join("").trim(); } method = comma "method" equals cipher:cipher { proxy.cipher = cipher; }; cipher = ("aes-128-cfb"/"aes-128-ctr"/"aes-128-gcm"/"aes-192-cfb"/"aes-192-ctr"/"aes-192-gcm"/"aes-256-cfb"/"aes-256-ctr"/"aes-256-gcm"/"bf-cfb"/"cast5-cfb"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"des-cfb"/"none"/"rc2-cfb"/"rc4-md5-6"/"rc4-md5"/"salsa20"/"xchacha20-ietf-poly1305"/"2022-blake3-aes-128-gcm"/"2022-blake3-aes-256-gcm"); aead = comma "aead" equals flag:bool { proxy.aead = flag; } udp_relay = comma "udp-relay" equals flag:bool { proxy.udp = flag; } udp_over_tcp = comma "udp-over-tcp" equals flag:bool { throw new Error("UDP over TCP is not supported"); } udp_over_tcp_new = comma "udp-over-tcp" equals param:$[^=,]+ { if (param === "sp.v1") { proxy["udp-over-tcp"] = true; proxy["udp-over-tcp-version"] = 1; } else if (param === "sp.v2") { proxy["udp-over-tcp"] = true; proxy["udp-over-tcp-version"] = 2; } else if (param === "true") { proxy["_ssr_python_uot"] = true; } else { throw new Error("Invalid value for udp-over-tcp"); } } fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; } over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; } tls_host = comma "tls-host" equals sni:domain { proxy.sni = sni; } tls_verification = comma "tls-verification" equals flag:bool { proxy["skip-cert-verify"] = !flag; } tls_fingerprint = comma "tls-cert-sha256" equals tls_fingerprint:$[^,]+ { proxy["tls-fingerprint"] = tls_fingerprint.trim(); } tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals param:$[^=,]+ { proxy["tls-pubkey-sha256"] = param; } tls_alpn = comma "tls-alpn" equals param:$[^=,]+ { proxy["tls-alpn"] = param; } tls_no_session_ticket = comma "tls-no-session-ticket" equals flag:bool { proxy["tls-no-session-ticket"] = flag; } tls_no_session_reuse = comma "tls-no-session-reuse" equals flag:bool { proxy["tls-no-session-reuse"] = flag; } obfs_ss = comma "obfs" equals type:("http"/"tls"/"wss"/"ws"/"over-tls") { obfs.type = type; return type; } obfs_ssr = comma "obfs" equals type:("plain"/"http_simple"/"http_post"/"random_head"/"tls1.2_ticket_auth"/"tls1.2_ticket_fastauth") { proxy.type = "ssr"; obfs.type = type; return type; } obfs = comma "obfs" equals type:("wss"/"ws"/"over-tls"/"http") { obfs.type = type; return type; }; obfs_host = comma "obfs-host" equals host:domain { obfs.host = host; } obfs_uri = comma "obfs-uri" equals uri:uri { obfs.path = uri; } ssr_protocol = comma "ssr-protocol" equals protocol:("origin"/"auth_sha1_v4"/"auth_aes128_md5"/"auth_aes128_sha1"/"auth_chain_a"/"auth_chain_b") { proxy.protocol = protocol; return protocol; } ssr_protocol_param = comma "ssr-protocol-param" equals param:$[^=,]+ { proxy["protocol-param"] = param; } reality_base64_pubkey = comma "reality-base64-pubkey" equals param:$[^=,]+ { $set(proxy, "reality-opts.public-key", param); } reality_hex_shortid = comma "reality-hex-shortid" equals param:$[^=,]+ { $set(proxy, "reality-opts.short-id", param); } vless_flow = comma "vless-flow" equals param:$[^=,]+ { proxy["flow"] = param; } server_check_url = comma "server_check_url" equals param:$[^=,]+ { proxy["test-url"] = param; } uri = $[^,]+ tag = comma "tag" equals tag:[^=,]+ { proxy.name = tag.join(""); } others = comma [^=,]+ equals [^=,]+ comma = _ "," _ equals = _ "=" _ _ = [ \r\t]* bool = b:("true"/"false") { return b === "true" } `,m2;function cu(){return m2||(m2=gD.generate(nq)),m2}var mD=yn(gh()),iq=String.raw` // global initializer {{ function $set(obj, path, value) { if (Object(obj) !== obj) return obj; if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []; path .slice(0, -1) .reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[ path[path.length - 1] ] = value; return obj; } function toBool(str) { if (typeof str === 'undefined' || str === null) return undefined; return /(TRUE)|1/i.test(str); } }} { const proxy = {}; const obfs = {}; const $ = {}; const params = {}; } start = (trojan) { return proxy } trojan = "trojan://" password:password "@" server:server ":" port:port "/"? params? name:name?{ proxy.type = "trojan"; proxy.password = password; proxy.server = server; proxy.port = port; proxy.name = name; // name may be empty if (!proxy.name) { proxy.name = server + ":" + port; } }; password = match:$[^@]+ { return decodeURIComponent(match); }; server = ip/domain; domain = match:[0-9a-zA-z-_.]+ { const domain = match.join(""); if (/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/.test(domain)) { return domain; } } ip = & { const start = peg$currPos; let end; let j = start; while (j < input.length) { if (input[j] === ",") break; if (input[j] === ":") end = j; j++; } peg$currPos = end || j; $.ip = input.substring(start, end).trim(); return true; } { return $.ip; } port = digits:[0-9]+ { const port = parseInt(digits.join(""), 10); if (port >= 0 && port <= 65535) { return port; } else { throw new Error("Invalid port: " + port); } } params = "?" head:param tail:("&"@param)* { for (const [key, value] of Object.entries(params)) { params[key] = decodeURIComponent(value); } proxy["skip-cert-verify"] = toBool(params["allowInsecure"]); proxy.sni = params["sni"] || params["peer"]; proxy['client-fingerprint'] = params.fp; proxy.alpn = params.alpn ? decodeURIComponent(params.alpn).split(',') : undefined; if (toBool(params["ws"])) { proxy.network = "ws"; $set(proxy, "ws-opts.path", params["wspath"]); } if (params["type"]) { let httpupgrade proxy.network = params["type"] if(proxy.network === 'httpupgrade') { proxy.network = 'ws' httpupgrade = true } if (['grpc'].includes(proxy.network)) { proxy[proxy.network + '-opts'] = { 'grpc-service-name': params["serviceName"], '_grpc-type': params["mode"], '_grpc-authority': params["authority"], }; } else { if (params["path"]) { $set(proxy, proxy.network+"-opts.path", decodeURIComponent(params["path"])); } if (params["host"]) { $set(proxy, proxy.network+"-opts.headers.Host", decodeURIComponent(params["host"])); } if (httpupgrade) { $set(proxy, proxy.network+"-opts.v2ray-http-upgrade", true); $set(proxy, proxy.network+"-opts.v2ray-http-upgrade-fast-open", true); } } if (['reality'].includes(params.security)) { const opts = {}; if (params.pbk) { opts['public-key'] = params.pbk; } if (params.sid) { opts['short-id'] = params.sid; } if (params.spx) { opts['_spider-x'] = params.spx; } if (params.mode) { proxy._mode = params.mode; } if (params.extra) { proxy._extra = params.extra; } if (Object.keys(opts).length > 0) { $set(proxy, params.security+"-opts", opts); } } } proxy.udp = toBool(params["udp"]); proxy.tfo = toBool(params["tfo"]); } param = kv/single; kv = key:$[a-z]i+ "=" value:$[^&#]i* { params[key] = value; } single = key:$[a-z]i+ { params[key] = true; }; name = "#" + match:$.* { return decodeURIComponent(match); } `,v2;function w2(){return v2||(v2=mD.generate(iq)),v2}var y2=yn(b2());function vD(e){let[t,r]=e.match(/,\s*?port-hopping\s*?=\s*?["']?\s*?((\d+(-\d+)?)([,;]\d+(-\d+)?)*)\s*?["']?\s*?/)||[];return{port_hopping:r?r.replace(/;/g,","):void 0,line:t?e.replace(t,""):e}}function sq(){return{name:"URI PROXY Parser",test:n=>/^(socks5\+tls|socks5|http|https):\/\//.test(n),parse:n=>{let[i,a,s,u,c,f,d,v,p]=n.match(/^(socks5|http|http)(\+tls|s)?:\/\/(?:(.*?):(.*?)@)?(.*?)(?::(\d+?))?\/?(\?.*?)?(?:#(.*?))?$/);if(d)d=parseInt(d,10);else{if(s)d=443;else if(a==="http")d=80;else throw se.error(`port is not present in line: ${n}`),new Error(`port is not present in line: ${n}`);se.info(`port is not present in line: ${n}, set to ${d}`)}return{name:p!=null?decodeURIComponent(p):`${a} ${f}:${d}`,type:a,tls:!!s,server:f,port:d,username:u!=null?decodeURIComponent(u):void 0,password:c!=null?decodeURIComponent(c):void 0}}}}function aq(){return{name:"URI SOCKS Parser",test:n=>/^socks:\/\//.test(n),parse:n=>{let[i,a,s,u,c,f,d]=n.match(/^(socks)?:\/\/(?:(.*)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/);if(c)c=parseInt(c,10);else throw se.error(`port is not present in line: ${n}`),new Error(`port is not present in line: ${n}`);let v,p;if(s){let w=yt.decode(decodeURIComponent(s)).split(":");v=w[0],p=w[1]}return{name:d!=null?decodeURIComponent(d):`${a} ${u}:${c}`,type:"socks5",server:u,port:c,username:v,password:p}}}}function uq(){return{name:"URI SS Parser",test:n=>/^ss:\/\//.test(n),parse:n=>{let i=n.split("ss://")[1],a=n.split("#")[1],s={type:"ss"};i=i.split("#")[0];let u=i.match(/@([^/?]*)(\/|\?|$)/),c=decodeURIComponent(i.split("@")[0]),f;c?.startsWith("2022-blake3-")?f=c:f=yt.decode(c);let d="";if(u)i.includes("?")&&(d=i.match(/(\?.*)$/)[1]);else{if(i.includes("?")){let y=i.match(/^(.*)(\?.*)$/);i=y[1],d=y[2]}if(i=yt.decode(i),d){if(/(&|\?)v2ray-plugin=/.test(d)){let g=d.match(/(&|\?)v2ray-plugin=(.*?)(&|$)/)[2];g&&(s.plugin="v2ray-plugin",s["plugin-opts"]=JSON.parse(yt.decode(g)))}i=`${i}${d}`}f=i.match(/(^.*)@/)?.[1],u=i.match(/@([^/@]*)(\/|$)/)}let v=u[1],p=v.lastIndexOf(":");s.server=v.substring(0,p),s.port=`${v.substring(p+1)}`.match(/\d+/)?.[0];let h=f.match(/(^.*?):(.*$)/);s.cipher=h?.[1],s.password=h?.[2];let w=i.match(/[?&]plugin=([^&]+)/),m=i.match(/[?&]shadow-tls=([^&]+)/);if(w){let y=("plugin="+decodeURIComponent(w[1])).split(";"),g={};for(let b of y){let[D,C]=b.split("=");D&&(g[D]=C||!0)}switch(g.plugin){case"obfs-local":case"simple-obfs":s.plugin="obfs",s["plugin-opts"]={mode:g.obfs,host:Qt(g["obfs-host"])};break;case"v2ray-plugin":s.plugin="v2ray-plugin",s["plugin-opts"]={mode:"websocket",host:Qt(g["obfs-host"]),path:Qt(g.path),tls:qc(g.tls)};break;case"shadow-tls":{s.plugin="shadow-tls";let b=Qt(g.version);s["plugin-opts"]={host:Qt(g.host),password:Qt(g.password),version:b?parseInt(b,10):void 0};break}default:throw new Error(`Unsupported plugin option: ${g.plugin}`)}}if(m){let y=JSON.parse(yt.decode(m[1])),g=Qt(y.version),b=Qt(y.address),D=Qt(y.port);s.plugin="shadow-tls",s["plugin-opts"]={host:Qt(y.host),password:Qt(y.password),version:g?parseInt(g,10):void 0},b&&(s.server=b),D&&(s.port=parseInt(D,10))}return/(&|\?)uot=(1|true)/i.test(d)&&(s["udp-over-tcp"]=!0),/(&|\?)tfo=(1|true)/i.test(d)&&(s.tfo=!0),a!=null&&(a=decodeURIComponent(a)),s.name=a??`SS ${s.server}:${s.port}`,s}}}function oq(){return{name:"URI SSR Parser",test:n=>/^ssr:\/\//.test(n),parse:n=>{n=yt.decode(n.split("ssr://")[1]);let i=n.indexOf(":origin");i===-1&&(i=n.indexOf(":auth_"));let a=n.substring(0,i),s=a.substring(0,a.lastIndexOf(":")),u=a.substring(a.lastIndexOf(":")+1),c=n.substring(i+1).split("/?")[0].split(":"),f={type:"ssr",server:s,port:u,protocol:c[0],cipher:c[1],obfs:c[2],password:yt.decode(c[3])},d={};if(n=n.split("/?")[1].split("&"),n.length>1)for(let v of n){let[p,h]=v.split("=");h=h.trim(),h.length>0&&h!=="(null)"&&(d[p]=h)}return f={...f,name:d.remarks?yt.decode(d.remarks):f.server,"protocol-param":Qt(yt.decode(d.protoparam||"").replace(/\s/g,"")),"obfs-param":Qt(yt.decode(d.obfsparam||"").replace(/\s/g,""))},f}}}function cq(){return{name:"URI VMess Parser",test:n=>/^vmess:\/\//.test(n),parse:n=>{n=n.split("vmess://")[1];let i=yt.decode(n.replace(/\?.*?$/,""));if(/=\s*vmess/.test(i)){let a=i.split(",").map(c=>c.trim()),s={};for(let c of a)if(c.indexOf("=")!==-1){let[f,d]=c.split("=");s[f.trim()]=d.trim()}let u={name:a[0].split("=")[0].trim(),type:"vmess",server:a[1],port:a[2],cipher:Qt(a[3],"auto"),uuid:a[4].match(/^"(.*)"$/)[1],tls:s.obfs==="wss",udp:qc(s["udp-relay"]),tfo:qc(s["fast-open"]),"skip-cert-verify":Mc(s["tls-verification"])?!s["tls-verification"]:void 0};if(Mc(s.obfs))if(s.obfs==="ws"||s.obfs==="wss"){u.network="ws",u["ws-opts"].path=(Qt(s["obfs-path"])||'"/"').match(/^"(.*)"$/)[1];let c=s["obfs-header"];c&&c.indexOf("Host")!==-1&&(c=c.match(/Host:\s*([a-zA-Z0-9-.]*)/)[1]),Ks(c)&&(u["ws-opts"].headers={Host:c})}else throw new Error(`Unsupported obfs: ${s.obfs}`);return u}else{let a={};try{a=JSON.parse(i)}catch{let[v,p,h]=/(^[^?]+?)\/?\?(.*)$/.exec(n);i=yt.decode(p);for(let D of h.split("&")){let[C,F]=D.split("="),L=F;L=decodeURIComponent(F),L.indexOf(",")===-1?a[C]=L:a[C]=L.split(",")}let[w,m,y,g,b]=/(^[^:]+?):([^:]+?)@(.*):(\d+)$/.exec(i);a.scy=m,a.id=y,a.port=b,a.add=g}let s=a.add,u=parseInt(qc(a.port),10),c={name:a.ps??a.remarks??a.remark??`VMess ${s}:${u}`,type:"vmess",server:s,port:u,cipher:["auto","aes-128-gcm","chacha20-poly1305","none"].includes(a.scy)?a.scy:"auto",uuid:a.id,alterId:parseInt(qc(a.aid??a.alterId,0),10),tls:["tls",!0,1,"1"].includes(a.tls),"skip-cert-verify":Mc(a.verify_cert)?!a.verify_cert:void 0};!c["skip-cert-verify"]&&Mc(a.allowInsecure)&&(c["skip-cert-verify"]=/(TRUE)|1/i.test(a.allowInsecure)),c.tls&&(a.sni&&a.sni!==""?c.sni=a.sni:a.peer&&a.peer!==""&&(c.sni=a.peer));let f=!1;if(a.net==="ws"||a.obfs==="websocket"?c.network="ws":["http"].includes(a.net)||["http"].includes(a.obfs)||["http"].includes(a.type)?c.network="http":["grpc","kcp","quic"].includes(a.net)?c.network=a.net:a.net==="httpupgrade"||c.network==="httpupgrade"?(c.network="ws",f=!0):(a.net==="h2"||c.network==="h2")&&(c.network="h2"),c.network){let d=a.host??a.obfsParam;try{let h=JSON.parse(d)?.Host;h&&(d=h)}catch{}let v=a.path;if(["ws"].includes(c.network)&&(v=v||"/"),c.network==="http"&&(d&&(d=d.split(",").map(p=>p.trim()),d=Array.isArray(d)?d[0]:d),v?v=Array.isArray(v)?v[0]:v:v="/"),v||d||["kcp","quic"].includes(c.network))if(["grpc"].includes(c.network))c[`${c.network}-opts`]={"grpc-service-name":Qt(v),"_grpc-type":Qt(a.type),"_grpc-authority":Qt(a.authority)};else if(["kcp","quic"].includes(c.network))c[`${c.network}-opts`]={[`_${c.network}-type`]:Qt(a.type),[`_${c.network}-host`]:Qt(Qt(d)),[`_${c.network}-path`]:Qt(v)};else{let p={path:Qt(v),headers:{Host:Qt(d)}};f&&(p["v2ray-http-upgrade"]=!0,p["v2ray-http-upgrade-fast-open"]=!0),c[`${c.network}-opts`]=p}else delete c.network}return c["client-fingerprint"]=a.fp,c.alpn=a.alpn?a.alpn.split(","):void 0,c}}}}function wD(){return{name:"URI VLESS Parser",test:n=>/^vless:\/\//.test(n),parse:n=>{n=n.split("vless://")[1];let i,a=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);if(!a){let[y,g,b]=/^(.*?)(\?.*?$)/.exec(n);n=`${yt.decode(g)}${b}`,a=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n),i=!0}let[s,u,c,f,d,v="",p]=a;i&&(u=u.replace(/^.*?:/g,"")),f=parseInt(`${f}`,10),u=decodeURIComponent(u),p!=null&&(p=decodeURIComponent(p));let h={type:"vless",name:p,server:c,port:f,uuid:u},w={};for(let y of v.split("&"))if(y){let[g,b]=y.split("="),D=b;D=decodeURIComponent(b),w[g]=D}if(h.name=p??w.remarks??w.remark??`VLESS ${c}:${f}`,h.tls=w.security&&w.security!=="none",i&&/TRUE|1/i.test(w.tls)&&(h.tls=!0,w.security=w.security??"reality"),h.sni=w.sni||w.peer,h.flow=w.flow,!h.flow&&i&&w.xtls){let y=[void 0,"xtls-rprx-direct","xtls-rprx-vision"][w.xtls];y&&(h.flow=y)}if(h["client-fingerprint"]=w.fp,h.alpn=w.alpn?w.alpn.split(","):void 0,h["skip-cert-verify"]=/(TRUE)|1/i.test(w.allowInsecure),["reality"].includes(w.security)){let y={};w.pbk&&(y["public-key"]=w.pbk),w.sid&&(y["short-id"]=w.sid),w.spx&&(y["_spider-x"]=w.spx),Object.keys(y).length>0&&(h[`${w.security}-opts`]=y)}let m=!1;if(h.network=w.type,h.network==="tcp"&&w.headerType==="http"?h.network="http":h.network==="httpupgrade"&&(h.network="ws",m=!0),!h.network&&i&&w.obfs&&(h.network=w.obfs,["none"].includes(h.network)&&(h.network="tcp")),["websocket"].includes(h.network)&&(h.network="ws"),h.network&&!["tcp","none"].includes(h.network)){let y={},g=w.host??w.obfsParam;if(g)if(w.obfsParam)try{let b=JSON.parse(g);y.headers=b}catch{y.headers={Host:g}}else y.headers={Host:g};w.serviceName?(y[`${h.network}-service-name`]=w.serviceName,["grpc"].includes(h.network)&&w.authority&&(y["_grpc-authority"]=w.authority)):i&&w.path&&(["ws","http","h2"].includes(h.network)||(y[`${h.network}-service-name`]=w.path,delete w.path)),w.path&&(y.path=w.path),["grpc"].includes(h.network)&&(y["_grpc-type"]=w.mode||"gun"),m&&(y["v2ray-http-upgrade"]=!0,y["v2ray-http-upgrade-fast-open"]=!0),Object.keys(y).length>0&&(h[`${h.network}-opts`]=y),h.network==="kcp"&&(w.seed&&(h.seed=w.seed),h.headerType=w.headerType||"none"),w.mode&&(h._mode=w.mode),w.extra&&(h._extra=w.extra)}return w.encryption&&(h.encryption=w.encryption),w.pqv&&(h._pqv=w.pqv),h}}}function lq(){return{name:"URI AnyTLS Parser",test:n=>/^anytls:\/\//.test(n),parse:n=>{let i=wD().parse(n.replace("anytls","vless"));n=n.split(/anytls:\/\//)[1];let[a,s,u,c,f="",d]=/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(n);s=decodeURIComponent(s),c=parseInt(`${c}`,10),isNaN(c)&&(c=443),s=decodeURIComponent(s),d!=null&&(d=decodeURIComponent(d)),d=d??`AnyTLS ${u}:${c}`;let v={...i,uuid:void 0,type:"anytls",name:d,server:u,port:c,password:s};for(let p of f.split("&"))if(p){let[h,w]=p.split("=");h=h.replace(/_/g,"-"),w=decodeURIComponent(w),["alpn"].includes(h)?v[h]=w?w.split(","):void 0:["insecure"].includes(h)?v["skip-cert-verify"]=/(TRUE)|1/i.test(w):["udp"].includes(h)?v[h]=/(TRUE)|1/i.test(w):Object.keys(v).includes(h)||(v[h]=w)}return["tcp"].includes(v.network)&&!v["reality-opts"]&&(delete v.network,delete v.security),v}}}function fq(){return{name:"URI Hysteria2 Parser",test:n=>/^(hysteria2|hy2):\/\//.test(n),parse:n=>{n=n.split(/(hysteria2|hy2):\/\//)[2];let i,[a,s,u,c,f,d,v,p,h,w,m="",y]=/^(.*?)@(.*?)(:((\d+(-\d+)?)([,;]\d+(-\d+)?)*))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);/^\d+$/.test(f)?(f=parseInt(`${f}`,10),isNaN(f)&&(f=443)):f?(i=f,f=df(i)):f=443,s=decodeURIComponent(s),y!=null&&(y=decodeURIComponent(y)),y=y??`Hysteria2 ${u}:${f}`;let g={type:"hysteria2",name:y,server:u,port:f,ports:i,password:s},b={};for(let F of m.split("&"))if(F){let[L,N]=F.split("="),S=N;S=decodeURIComponent(N),b[L]=S}g.sni=b.sni,!g.sni&&b.peer&&(g.sni=b.peer),b.obfs&&b.obfs!=="none"&&(g.obfs=b.obfs),b.mport&&(g.ports=b.mport),g["obfs-password"]=b["obfs-password"],g["skip-cert-verify"]=/(TRUE)|1/i.test(b.insecure),g.tfo=/(TRUE)|1/i.test(b.fastopen),g["tls-fingerprint"]=b.pinSHA256;let D=b["hop-interval"]||b.hop_interval;/^\d+$/.test(D)&&(g["hop-interval"]=parseInt(`${D}`,10));let C=b.keepalive;return/^\d+$/.test(C)&&(g.keepalive=parseInt(`${C}`,10)),g}}}function hq(){return{name:"URI Hysteria Parser",test:n=>/^(hysteria|hy):\/\//.test(n),parse:n=>{n=n.split(/(hysteria|hy):\/\//)[2];let[i,a,s,u,c,f="",d]=/^(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);u=parseInt(`${u}`,10),isNaN(u)&&(u=443),d!=null&&(d=decodeURIComponent(d)),d=d??`Hysteria ${a}:${u}`;let v={type:"hysteria",name:d,server:a,port:u},p={};for(let h of f.split("&"))if(h){let[w,m]=h.split("=");w=w.replace(/_/,"-"),m=decodeURIComponent(m),["alpn"].includes(w)?v[w]=m?m.split(","):void 0:["insecure"].includes(w)?v["skip-cert-verify"]=/(TRUE)|1/i.test(m):["auth"].includes(w)?v["auth-str"]=m:["mport"].includes(w)?v.ports=m:["obfsParam"].includes(w)?v.obfs=m:["upmbps"].includes(w)?v.up=m:["downmbps"].includes(w)?v.down=m:["obfs"].includes(w)?v._obfs=m||"":["fast-open","peer"].includes(w)?p[w]=m:Object.keys(v).includes(w)||(v[w]=m)}return!v.sni&&p.peer&&(v.sni=p.peer),!v["fast-open"]&&p.fastopen&&(v["fast-open"]=!0),v.protocol||(v.protocol="udp"),v}}}function dq(){return{name:"URI TUIC Parser",test:n=>/^tuic:\/\//.test(n),parse:n=>{n=n.split(/tuic:\/\//)[1];let[i,a,s,u,c="",f]=/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(n);a=decodeURIComponent(a);let[d,...v]=a.split(":"),p=v.join(":");u=parseInt(`${u}`,10),isNaN(u)&&(u=443),p=decodeURIComponent(p),f!=null&&(f=decodeURIComponent(f)),f=f??`TUIC ${s}:${u}`;let h={type:"tuic",name:f,server:s,port:u,password:p,uuid:d};for(let w of c.split("&"))if(w){let[m,y]=w.split("=");m=m.replace(/_/g,"-"),y=decodeURIComponent(y),["alpn"].includes(m)?h[m]=y?y.split(","):void 0:["allow-insecure","insecure"].includes(m)?h["skip-cert-verify"]=/(TRUE)|1/i.test(y):["fast-open"].includes(m)?h.tfo=!0:["disable-sni","reduce-rtt"].includes(m)?h[m]=/(TRUE)|1/i.test(y):m==="congestion-control"?(h["congestion-controller"]=y,delete h[m]):Object.keys(h).includes(m)||(h[m]=y)}return h}}}function pq(){return{name:"URI WireGuard Parser",test:n=>/^(wireguard|wg):\/\//.test(n),parse:n=>{n=n.split(/(wireguard|wg):\/\//)[2];let[i,a,s,u,c,f,d,v="",p]=/^((.*?)@)?(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);f=parseInt(`${f}`,10),isNaN(f)&&(f=51820),s=decodeURIComponent(s),p!=null&&(p=decodeURIComponent(p)),p=p??`WireGuard ${u}:${f}`;let h={type:"wireguard",name:p,server:u,port:f,"private-key":s,udp:!0};for(let w of v.split("&"))if(w){let[m,y]=w.split("=");if(m=m.replace(/_/,"-"),y=decodeURIComponent(y),["reserved"].includes(m)){let g=y.split(",").map(b=>parseInt(b.trim(),10)).filter(b=>Number.isInteger(b));g.length===3&&(h[m]=g)}else if(["address","ip"].includes(m))y.split(",").map(g=>{let b=g.trim().replace(/\/\d+$/,"").replace(/^\[/,"").replace(/\]$/,"");Tr(b)?h.ip=b:Mr(b)&&(h.ipv6=b)});else if(["mtu"].includes(m)){let g=parseInt(y.trim(),10);Number.isInteger(g)&&(h[m]=g)}else/publickey/i.test(m)?h["public-key"]=y:/privatekey/i.test(m)?h["private-key"]=y:["udp"].includes(m)?h[m]=/(TRUE)|1/i.test(y):[...Object.keys(h),"flag"].includes(m)||(h[m]=y)}return h}}}function gq(){return{name:"URI Trojan Parser",test:n=>/^trojan:\/\//.test(n),parse:n=>{let i=/^(trojan:\/\/.*?@.*?)(:(\d+))?\/?(\?.*?)?$/.exec(n);i?.[2]||(n=n.replace(i[1],`${i[1]}:443`));let[s,u]=n.split(/#(.+)/,2),f=w2().parse(s);if(Ks(u))try{f.name=decodeURIComponent(u)}catch(d){console.log(d)}return f}}}function mq(){return{name:"Clash Parser",test:n=>{let i;try{i=y2.default.parse(n)}catch{i=Ls.parse(n)}return!!i?.type},parse:n=>{let i;try{i=y2.default.parse(n)}catch{i=Ls.parse(n)}if(!["naive","anytls","mieru","sudoku","juicity","ss","ssr","vmess","socks5","http","snell","trojan","tuic","vless","hysteria","hysteria2","wireguard","ssh","direct"].includes(i.type))throw new Error(`Clash does not support proxy with type: ${i.type}`);return["vmess","vless"].includes(i.type)&&(i.sni=i.servername,delete i.servername),i["server-cert-fingerprint"]&&(i["tls-fingerprint"]=i["server-cert-fingerprint"]),i.fingerprint&&(i["tls-fingerprint"]=i.fingerprint),i["dialer-proxy"]&&(i["underlying-proxy"]=i["dialer-proxy"]),i["benchmark-url"]&&(i["test-url"]=i["benchmark-url"]),i["benchmark-timeout"]&&(i["test-timeout"]=i["benchmark-timeout"]),i}}}function vq(){return{name:"QX SS Parser",test:n=>/^shadowsocks\s*=/.test(n.split(",")[0].trim())&&n.indexOf("ssr-protocol")===-1,parse:n=>cu().parse(n)}}function wq(){return{name:"QX SSR Parser",test:n=>/^shadowsocks\s*=/.test(n.split(",")[0].trim())&&n.indexOf("ssr-protocol")!==-1,parse:n=>cu().parse(n)}}function Aq(){return{name:"QX VMess Parser",test:n=>/^vmess\s*=/.test(n.split(",")[0].trim()),parse:n=>cu().parse(n)}}function Eq(){return{name:"QX VLESS Parser",test:n=>/^vless\s*=/.test(n.split(",")[0].trim()),parse:n=>cu().parse(n)}}function bq(){return{name:"QX Trojan Parser",test:n=>/^trojan\s*=/.test(n.split(",")[0].trim()),parse:n=>cu().parse(n)}}function yq(){return{name:"QX HTTP Parser",test:n=>/^http\s*=/.test(n.split(",")[0].trim()),parse:n=>cu().parse(n)}}function _q(){return{name:"QX Socks5 Parser",test:n=>/^socks5\s*=/.test(n.split(",")[0].trim()),parse:n=>cu().parse(n)}}function Cq(){return{name:"Loon SS Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocks",parse:n=>ha().parse(n)}}function Dq(){return{name:"Loon SSR Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocksr",parse:n=>ha().parse(n)}}function Fq(){return{name:"Loon VMess Parser",test:n=>/^.*=\s*vmess/i.test(n.split(",")[0])&&n.indexOf("username")===-1,parse:n=>ha().parse(n)}}function Sq(){return{name:"Loon Vless Parser",test:n=>/^.*=\s*vless/i.test(n.split(",")[0]),parse:n=>ha().parse(n)}}function Iq(){return{name:"Loon Trojan Parser",test:n=>/^.*=\s*trojan/i.test(n.split(",")[0]),parse:n=>ha().parse(n)}}function Bq(){return{name:"Loon Hysteria2 Parser",test:n=>/^.*=\s*Hysteria2/i.test(n.split(",")[0]),parse:n=>ha().parse(n)}}function Pq(){return{name:"Loon HTTP Parser",test:n=>/^.*=\s*http/i.test(n.split(",")[0]),parse:n=>ha().parse(n)}}function $q(){return{name:"Loon SOCKS5 Parser",test:n=>/^.*=\s*socks5/i.test(n.split(",")[0]),parse:n=>ha().parse(n)}}function xq(){return{name:"Loon WireGuard Parser",test:n=>/^.*=\s*wireguard/i.test(n.split(",")[0]),parse:n=>{let i=n.match(/(^.*?)\s*?=\s*?wireguard\s*?,.+?\s*?=\s*?.+?/i)?.[1];n=n.replace(i,"").replace(/^\s*?=\s*?wireguard\s*/i,"");let a=n.match(/,\s*?peers\s*?=\s*?\[\s*?\{\s*?(.+?)\s*?\}\s*?\]/i)?.[1],s=a.match(/(,|^)\s*?endpoint\s*?=\s*?"?(.+?):(\d+)"?\s*?(,|$)/i),u=s?.[2],c=parseInt(s?.[3],10),f=n.match(/(,|^)\s*?mtu\s*?=\s*?"?(\d+?)"?\s*?(,|$)/i)?.[2];f&&(f=parseInt(f,10));let d=n.match(/(,|^)\s*?keepalive\s*?=\s*?"?(\d+?)"?\s*?(,|$)/i)?.[2];d&&(d=parseInt(d,10));let v=a.match(/(,|^)\s*?reserved\s*?=\s*?"?(\[\s*?.+?\s*?\])"?\s*?(,|$)/i)?.[2];v&&(v=JSON.parse(v));let p,h=n.match(/(,|^)\s*?dns\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],w=n.match(/(,|^)\s*?dnsv6\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2];(h||w)&&(p=[],h&&p.push(h),w&&p.push(w));let m=a.match(/(,|^)\s*?allowed-ips\s*?=\s*?"(.+?)"\s*?(,|$)/i)?.[2]?.split(",").map(F=>F.trim()),y=a.match(/(,|^)\s*?preshared-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],g=n.match(/(,|^)\s*?interface-ip\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],b=n.match(/(,|^)\s*?interface-ipv6\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],D=a.match(/(,|^)\s*?public-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],C={type:"wireguard",name:i,server:u,port:c,ip:g,ipv6:b,"private-key":n.match(/(,|^)\s*?private-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],"public-key":D,mtu:f,keepalive:d,reserved:v,"allowed-ips":m,"preshared-key":y,dns:p,udp:!0,peers:[{server:u,port:c,ip:g,ipv6:b,"public-key":D,"pre-shared-key":y,"allowed-ips":m,reserved:v}]};return Array.isArray(C.dns)&&C.dns.length>0&&(C["remote-dns-resolve"]=!0),C}}}function Rq(){return{name:"Surge Direct Parser",test:n=>/^.*=\s*direct/.test(n.split(",")[0]),parse:n=>Ai().parse(n)}}function Tq(){return{name:"Surge Anytls Parser",test:n=>/^.*=\s*anytls/.test(n.split(",")[0]),parse:n=>Ai().parse(n)}}function Oq(){return{name:"Surge SSH Parser",test:n=>/^.*=\s*ssh/.test(n.split(",")[0]),parse:n=>Ai().parse(n)}}function kq(){return{name:"Surge SS Parser",test:n=>/^.*=\s*ss/.test(n.split(",")[0]),parse:n=>Ai().parse(n)}}function Nq(){return{name:"Surge VMess Parser",test:n=>/^.*=\s*vmess/.test(n.split(",")[0])&&n.indexOf("username")!==-1,parse:n=>Ai().parse(n)}}function Lq(){return{name:"Surge Trojan Parser",test:n=>/^.*=\s*trojan/.test(n.split(",")[0]),parse:n=>Ai().parse(n)}}function Uq(){return{name:"Surge HTTP Parser",test:n=>/^.*=\s*https?/.test(n.split(",")[0]),parse:n=>Ai().parse(n)}}function jq(){return{name:"Surge Socks5 Parser",test:n=>/^.*=\s*socks5(-tls)?/.test(n.split(",")[0]),parse:n=>Ai().parse(n)}}function Hq(){return{name:"Surge External Parser",test:n=>/^.*=\s*external/.test(n.split(",")[0]),parse:n=>{let i=/^\s*(.*?)\s*?=\s*?external\s*?,\s*(.*?)\s*$/.exec(n),[a,s,u]=i;n=u;let c=/(,|^)\s*?exec\s*?=\s*"(.*?)"\s*?(,|$)/.exec(n)?.[2];c||(c=/(,|^)\s*?exec\s*?=\s*(.*?)\s*?(,|$)/.exec(n)?.[2]);let f=/(,|^)\s*?local-port\s*?=\s*"(.*?)"\s*?(,|$)/.exec(n)?.[2];f||(f=/(,|^)\s*?local-port\s*?=\s*(.*?)\s*?(,|$)/.exec(n)?.[2]);let d=/(,|^)\s*?args\s*?=\s*("(.*?)"|(.*?))(?=\s*?(,|$))/g,v,p=[];for(;(v=d.exec(n))!==null;)v[3]!=null?p.push(v[3]):v[4]!=null&&p.push(v[4]);let h=/(,|^)\s*?addresses\s*?=\s*("(.*?)"|(.*?))(?=\s*?(,|$))/g,w,m=[];for(;(w=h.exec(n))!==null;){let g;w[3]!=null?g=w[3]:w[4]!=null&&(g=w[4]),g!=null&&(g=`${g}`.trim().replace(/^\[/,"").replace(/\]$/,"")),zq(g)&&m.push(g)}return{type:"external",name:s,exec:c,"local-port":f,args:p,addresses:m}}}}function Mq(){return{name:"Surge Snell Parser",test:n=>/^.*=\s*snell/.test(n.split(",")[0]),parse:n=>Ai().parse(n)}}function qq(){return{name:"Surge Tuic Parser",test:n=>/^.*=\s*tuic(-v5)?/.test(n.split(",")[0]),parse:n=>{let{port_hopping:i,line:a}=vD(n),s=Ai().parse(a);return s.ports=i,s}}}function Vq(){return{name:"Surge WireGuard Parser",test:n=>/^.*=\s*wireguard/.test(n.split(",")[0]),parse:n=>Ai().parse(n)}}function Kq(){return{name:"Surge Hysteria2 Parser",test:n=>/^.*=\s*hysteria2/.test(n.split(",")[0]),parse:n=>{let{port_hopping:i,line:a}=vD(n),s=Ai().parse(a);return s.ports=i,s}}}function zq(e){return Tr(e)||Mr(e)}var AD=[sq(),aq(),uq(),oq(),cq(),wD(),dq(),pq(),hq(),fq(),gq(),lq(),mq(),Rq(),Tq(),Oq(),kq(),Nq(),Lq(),Uq(),Mq(),qq(),Vq(),Kq(),jq(),Hq(),Cq(),Dq(),Fq(),Sq(),Bq(),Iq(),Pq(),$q(),xq(),vq(),wq(),Aq(),Eq(),bq(),yq(),_q()];var _D=yn(b2());function Gq(e){for(let t of sd)try{if(t.test(e))return se.info(`Pre-processor [${t.name}] activated`),t.parse(e)}catch(r){se.error(`Parser [${t.name}] failed Reason: ${r}`)}return e}function Yq(e){e=Gq(e);let t=e.split(` `),r=[],n;for(let i of t){if(i=i.trim(),i.length===0)continue;let a=!1;if(n){let[s,u]=ED(n,i);u||(r.push(yD(s)),a=!0)}if(!a)for(let s of AD){let[u,c]=ED(s,i);if(!c){r.push(yD(u)),n=s,a=!0,se.info(`${s.name} is activated`);break}}a||se.error(`Failed to parse line: ${i}`)}return r.filter(i=>(["vless","vmess"].includes(i.type)&&(ed(i.uuid)||se.info(`UUID may be invalid: ${i.name} ${i.uuid}`)),!0))}async function Wq(proxies,operators=[],targetPlatform,source,$options){for(let item of operators){if(item.disabled){se.log(`Skipping disabled operator: "${item.type}" with arguments: >>> ${JSON.stringify(item.args,null,2)||"None"}`);continue}let script,$arguments={};if(item.type.indexOf("Script")!==-1){let{mode,content}=item.args;if(mode==="link"){let url=content||"",rawArgs=url.split("#");if(rawArgs.length>1)try{$arguments=JSON.parse(decodeURIComponent(rawArgs[1]))}catch{for(let t of rawArgs[1].split("&")){let r=t.split("=")[0],n=t.split("=")[1];$arguments[r]=n==null||n===""?!0:decodeURIComponent(n)}}url=`${url.split("#")[0]}${rawArgs[2]?`#${rawArgs[2]}`:$arguments?.noCache!=null||$arguments?.insecure!=null?`#${rawArgs[1]}`:""}`;let downloadUrlMatch=url.split("#")[0].match(/^\/api\/(file|module)\/(.+)/);if(downloadUrlMatch){let e="";try{e=downloadUrlMatch?.[1];let t=downloadUrlMatch?.[2];if(t==null)throw new Error(`\u672C\u5730 ${e} URL \u65E0\u6548: ${url}`);t=decodeURIComponent(t);let r=e==="module"?U0:Lc,n=hs(se.read(r),t);if(!n)throw new Error(`\u627E\u4E0D\u5230 ${e}: ${t}`);e==="module"?script=n.content:script=await xu({type:"file",name:t})}catch(t){throw se.error(`Error when loading ${e}: ${item.args.content}. Reason: ${t}`),new Error(`\u65E0\u6CD5\u52A0\u8F7D ${e}: ${url}`)}}else if(url?.startsWith("/"))try{let fs=eval('require("fs")');script=fs.readFileSync(url.split("#")[0],"utf8")}catch(e){throw se.error(`Error when reading local script: ${item.args.content}. Reason: ${e}`),new Error(`\u65E0\u6CD5\u4ECE\u8BE5\u8DEF\u5F84\u8BFB\u53D6\u811A\u672C\u6587\u4EF6: ${url}`)}else try{script=await Pn(url)}catch(e){throw se.error(`Error when downloading remote script: ${item.args.content}. Reason: ${e}`),new Error(`\u65E0\u6CD5\u4E0B\u8F7D\u811A\u672C: ${url}`)}}else script=content,$arguments=item.args.arguments||{}}if(!pd[item.type]){se.error(`Unknown operator: "${item.type}"`);continue}se.log(`Applying "${item.type}" with arguments: >>> ${JSON.stringify(item.args,null,2)||"None"}`);let processor;item.type.indexOf("Script")!==-1?processor=pd[item.type](script,targetPlatform,$arguments,source,$options):processor=pd[item.type](item.args||{}),proxies=await c_(processor,proxies)}return proxies}function Xq(e,t,r,n={}){let i=u3[t];if(!i)throw new Error(`Target platform: ${t} is not supported!`);let a=/Surge|SurgeMac|Shadowrocket/i.test(t);if(e=e.filter(s=>s.supported&&s.supported[t]===!1?!1:(["vless","vmess"].includes(s.type)&&(ed(s.uuid)||se.info(`UUID may be invalid: ${s.name} ${s.uuid}`)),!0)),e=e.map(s=>(s._resolved=s.resolved,Ks(s.name)||(s.name=`${s.type} ${s.server}:${s.port}`),s["disable-sni"]&&(a?s.sni="off":["tuic"].includes(s.type)||(se.error(`Target platform ${t} does not support sni off. Proxy's fields (sni, tls-fingerprint and skip-cert-verify) will be modified.`),s.sni="",s["skip-cert-verify"]=!0,delete s["tls-fingerprint"])),s.ports&&(s.ports=String(s.ports),["ClashMeta"].includes(t)||(s.ports=s.ports.replace(/\//g,",")),s.port||(s.port=df(s.ports))),s)),se.log(`Producing proxies for target: ${t}`),typeof i.type>"u"||i.type==="SINGLE"){let s=e.map(u=>{try{return i.produce(u,r,n)}catch(c){return se.error(`Cannot produce proxy: ${JSON.stringify(u,null,2)} Reason: ${c}`),""}}).filter(u=>u.length>0);return s=r==="internal"?s:s.join(` `),t.startsWith("Surge")&&e.length>0&&e.every(u=>u.type==="wireguard")&&(s=`#!name=${e[0]?._subName} #!desc=${e[0]?._desc??""} #!category=${e[0]?._category??""} ${s}`),s}else if(i.type==="ALL")return i.produce(e,r,n)}var Wt={parse:Yq,process:Wq,produce:Xq,ipAddress:Q0,getRandomPort:df,isIPv4:Tr,isIPv6:Mr,isIP:_2,yaml:Ls,getFlag:zc,removeFlag:mf,getISO:Vy,MMDB:ud,Gist:Kc,download:Pn,downloadFile:qy,isValidUUID:ed,doh:Yc,Buffer:fp.Buffer,Base64:yt,JSON5:_D.default};function ED(e,t){if(!Zq(e,t))return[null,new Error("Parser mismatch")];try{return[e.parse(t),null]}catch(r){return[null,r]}}function Zq(e,t){try{return e.test(t)}catch{return!1}}function bD(e){if(typeof e=="string"||typeof e=="number"){if(e=String(e).trim(),e==="")return"/";if(!e.startsWith("/"))return"/"+e}return e}function yD(e){typeof e.cipher=="string"&&(e.cipher=e.cipher.toLowerCase()),typeof e.password=="number"&&(e.password=Ry(e.password)),["ss"].includes(e.type)&&e.cipher==="none"&&!e.password&&(e.password=""),e.interface&&(e["interface-name"]=e.interface,delete e.interface),xy(e.port)&&(e.port=parseInt(e.port,10)),e.server&&(e.server=`${e.server}`.trim().replace(/^\[/,"").replace(/\]$/,"")),e.network==="ws"&&(!e["ws-opts"]&&(e["ws-path"]||e["ws-headers"])&&(e["ws-opts"]={},e["ws-path"]&&(e["ws-opts"].path=e["ws-path"]),e["ws-headers"]&&(e["ws-opts"].headers=e["ws-headers"])),delete e["ws-path"],delete e["ws-headers"]);let t=e[`${e.network}-opts`]?.path;if(Array.isArray(t)?e[`${e.network}-opts`].path=t.map(n=>bD(n)):t!=null&&(e[`${e.network}-opts`].path=bD(t)),e.type==="trojan"&&e.network==="tcp"&&delete e.network,["vless"].includes(e.type)&&(e.network||(e.network="tcp")),["trojan","tuic","hysteria","hysteria2","juicity","anytls","naive"].includes(e.type)&&(e.tls=!0),e.network){let n=e[`${e.network}-opts`]?.headers?.Host,i=e[`${e.network}-opts`]?.headers?.host;e.network==="h2"?!i&&n&&(e[`${e.network}-opts`].headers.host=n,delete e[`${e.network}-opts`].headers.Host):i&&!n&&(e[`${e.network}-opts`].headers.Host=i,delete e[`${e.network}-opts`].headers.host)}if(e.network==="h2"){let n=e["h2-opts"]?.headers?.host,i=e["h2-opts"]?.path;n&&!Array.isArray(n)&&(e["h2-opts"].headers.host=[n]),Array.isArray(i)&&(e["h2-opts"].path=i[0])}if(!e.tls&&["ws","http"].includes(e.network)&&!e[`${e.network}-opts`]?.headers?.Host&&!_2(e.server)&&(e[`${e.network}-opts`]=e[`${e.network}-opts`]||{},e[`${e.network}-opts`].headers=e[`${e.network}-opts`].headers||{},e[`${e.network}-opts`].headers.Host=["vmess","vless"].includes(e.type)&&e.network==="http"?[e.server]:e.server),["vmess","vless"].includes(e.type)&&e.network==="http"){let n=e[`${e.network}-opts`]?.path,i=e[`${e.network}-opts`]?.headers?.Host;i&&!Array.isArray(i)&&(e[`${e.network}-opts`].headers.Host=[i]),n&&!Array.isArray(n)&&(e[`${e.network}-opts`].path=[n])}if(e.tls&&!e.sni&&(_2(e.server)||(e.sni=e.server),!e.sni&&e.network)){let n=e[`${e.network}-opts`]?.headers?.Host;n=Array.isArray(n)?n[0]:n,n&&(e.sni=n)}if(e.ports?e.ports=String(e.ports).replace(/\//g,","):delete e.ports,["hysteria2"].includes(e.type)&&e.obfs&&!["salamander"].includes(e.obfs)&&!e["obfs-password"]&&(e["obfs-password"]=e.obfs,e.obfs="salamander"),["hysteria2"].includes(e.type)&&!e["obfs-password"]&&e.obfs_password&&(e["obfs-password"]=e.obfs_password,delete e.obfs_password),["vless"].includes(e.type)&&(e["reality-opts"]&&Object.keys(e["reality-opts"]).length===0&&delete e["reality-opts"],e["grpc-opts"]&&Object.keys(e["grpc-opts"]).length===0&&delete e["grpc-opts"],!e["reality-opts"]&&!e.flow&&delete e.flow,["http"].includes(e.network)&&(e[`${e.network}-opts`]?.path||(e[`${e.network}-opts`]||(e[`${e.network}-opts`]={}),e[`${e.network}-opts`].path=["/"]))),typeof e.name!="string")if(/^\d+$/.test(e.name))e.name=`${e.name}`;else try{e.name?.data?e.name=fp.Buffer.from(e.name.data).toString("utf8"):e.name=fp.Buffer.from(e.name).toString("utf8")}catch(n){se.error(`proxy.name decode failed Reason: ${n}`),e.name=`${e.type} ${e.server}:${e.port}`}["ws","http","h2"].includes(e.network)&&(["ws","h2"].includes(e.network)&&!e[`${e.network}-opts`]?.path?(e[`${e.network}-opts`]=e[`${e.network}-opts`]||{},e[`${e.network}-opts`].path="/"):e.network==="http"&&(!Array.isArray(e[`${e.network}-opts`]?.path)||e[`${e.network}-opts`]?.path.every(n=>!n))&&(e[`${e.network}-opts`]=e[`${e.network}-opts`]||{},e[`${e.network}-opts`].path=["/"])),["","off"].includes(e.sni)&&(e["disable-sni"]=!0);let r=e.ca_str;e["ca-str"]?r=e["ca-str"]:r&&(delete e.ca_str,e["ca-str"]=r);try{se.env.isNode&&!r&&e._ca&&(r=se.node.fs.readFileSync(e._ca,{encoding:"utf8"}))}catch(n){se.error(`Read ca file failed Reason: ${n}`)}return!e["tls-fingerprint"]&&r&&(e["tls-fingerprint"]=AE.generateFingerprint(r)),["ss"].includes(e.type)&&ue(e,"shadow-tls-password")&&(e.plugin="shadow-tls",e["plugin-opts"]={host:e["shadow-tls-sni"],password:e["shadow-tls-password"],version:e["shadow-tls-version"]},delete e["shadow-tls-sni"],delete e["shadow-tls-password"],delete e["shadow-tls-version"]),e}function _2(e){return Tr(e)||Mr(e)}var da="",C2=typeof $resource<"u"?$resource:"",CD=typeof $resourceType<"u"?$resourceType:"",Dl=typeof $resourceUrl<"u"?$resourceUrl:"";(async()=>{console.log(` \u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505 Sub-Store -- v${fd} Loon -- ${$loon} \u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505 `);let e=$loon.match(/\((\d+)\)$/)?.[1],t;typeof $argument<"u"?t=Object.fromEntries($argument.split("&").map(n=>n.split("="))):t={},console.log(`arg: ${JSON.stringify(t)}`);let r={PROXY:1,RULE:2};if(t.resourceUrlOnly||(da=C2),CD===r.PROXY){if(!t.resourceUrlOnly)try{let n=Wt.parse(C2);da=Wt.produce(n,"Loon",void 0,{"include-unsupported-proxy":t?.includeUnsupportedProxy||e>=842})}catch(n){console.log("\u89E3\u6790\u5668: \u4F7F\u7528 resource \u51FA\u73B0\u9519\u8BEF"),console.log(n.message??n)}if((!da||/^\s*$/.test(da))&&Dl){console.log(`\u89E3\u6790\u5668: \u5C1D\u8BD5\u4ECE ${Dl} \u83B7\u53D6\u8BA2\u9605`);try{let n=await Pn(Dl,t?.ua,t?.timeout,void 0,void 0,void 0,void 0,!0),i=Wt.parse(n);da=Wt.produce(i,"Loon",void 0,{"include-unsupported-proxy":t?.includeUnsupportedProxy||e>=842})}catch(n){console.log(n.message??n)}}}else if(CD===r.RULE){if(!t.resourceUrlOnly)try{let n=Ma.parse(C2);da=Ma.produce(n,"Loon")}catch(n){console.log(n.message??n)}if((!da||/^\s*$/.test(da))&&Dl){console.log(`\u89E3\u6790\u5668: \u5C1D\u8BD5\u4ECE ${Dl} \u83B7\u53D6\u89C4\u5219`);try{let n=await Pn(Dl,t?.ua,t?.timeout),i=Ma.parse(n);da=Ma.produce(i,"Loon")}catch(n){console.log(n.message??n)}}}})().catch(async e=>{console.log("\u89E3\u6790\u5668: \u51FA\u73B0\u9519\u8BEF"),console.log(e.message??e)}).finally(()=>{$done(da||"")});})(); /*! Bundled license information: ieee754/index.js: (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) buffer/index.js: (*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT *) jsrsasign/lib/jsrsasign.js: (*! CryptoJS v3.1.2 core-fix.js * code.google.com/p/crypto-js * (c) 2009-2013 by Jeff Mott. All rights reserved. * code.google.com/p/crypto-js/wiki/License * THIS IS FIX of 'core.js' to fix Hmac issue. * https://code.google.com/p/crypto-js/issues/detail?id=84 * https://crypto-js.googlecode.com/svn-history/r667/branches/3.x/src/core.js *) (*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ *) (*! (c) Tom Wu, Kenji Urushima | http://www-cs-students.stanford.edu/~tjw/jsbn/ *) (*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib *) (*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval *) lodash/lodash.js: (** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors *) */