// Author Maasea Build: 2023/12/14 22:12:09 (()=>{(function(i){function e(){}function t(){}var r=String.fromCharCode,n={}.toString,s=n.call(i.SharedArrayBuffer),o=n(),a=i.Uint8Array,f=a||Array,l=a?ArrayBuffer:f,h=l.isView||function(b){return b&&"length"in b},y=n.call(l.prototype);l=t.prototype;var p=i.TextEncoder,c=new(a?Uint16Array:f)(32);e.prototype.decode=function(b){if(!h(b)){var A=n.call(b);if(A!==y&&A!==s&&A!==o)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");b=a?new f(b):b||[]}for(var N=A="",d=0,I=b.length|0,G=I-32|0,B,x,E=0,J=0,V,U=0,D=-1;d>4){case 15:if(V=b[d=d+1|0]&255,V>>6!==2||247>6===2?J+4|0:24,x=x+256&768;case 13:case 12:V=b[d=d+1|0]&255,E<<=6,E|=(x&31)<<6|V&63,J=J+7|0,d>6===2&&E>>J&&1114112>E?(x=E,E=E-65536|0,0<=E&&(D=(E>>10)+55296|0,x=(E&1023)+56320|0,31>U?(c[U]=D,U=U+1|0,D=-1):(V=D,D=x,x=V))):(x>>=8,d=d-x-1|0,x=65533),E=J=0,B=d<=G?32:I-d|0;default:c[U]=x;continue;case 11:case 10:case 9:case 8:}c[U]=65533}if(N+=r(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15],c[16],c[17],c[18],c[19],c[20],c[21],c[22],c[23],c[24],c[25],c[26],c[27],c[28],c[29],c[30],c[31]),32>U&&(N=N.slice(0,U-32|0)),d>>31,D=-1,N.length=B)N[I]=B;else{if(2047>=B)N[I]=192|B>>6;else{e:{if(55296<=B)if(56319>=B){var x=b.charCodeAt(d=d+1|0)|0;if(56320<=x&&57343>=x){if(B=(B<<10)+x-56613888|0,65535>18,N[I=I+1|0]=128|B>>12&63,N[I=I+1|0]=128|B>>6&63,N[I=I+1|0]=128|B&63;continue}break e}B=65533}else 57343>=B&&(B=65533);!G&&d<<1>12,N[I=I+1|0]=128|B>>6&63}N[I=I+1|0]=128|B&63}}return a?N.subarray(0,I):N.slice(0,I)},p||(i.TextDecoder=e,i.TextEncoder=t)})(globalThis);function Z(i){let e=typeof i;if(e=="object"){if(Array.isArray(i))return"array";if(i===null)return"null"}return e}function Be(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)}var L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),z=[];for(let i=0;i>4,o=s,n=2;break;case 2:t[r++]=(o&15)<<4|(s&60)>>2,o=s,n=3;break;case 3:t[r++]=(o&3)<<6|s,n=0;break}}if(n==1)throw Error("invalid base64 string.");return t.subarray(0,r)}function Fe(i){let e="",t=0,r,n=0;for(let s=0;s>2],n=(r&3)<<4,t=1;break;case 1:e+=L[n|r>>4],n=(r&15)<<2,t=2;break;case 2:e+=L[n|r>>6],e+=L[r&63],t=0;break}return t&&(e+=L[n],e+="=",t==1&&(e+="=")),e}var O;(function(i){i.symbol=Symbol.for("protobuf-ts/unknown"),i.onRead=(t,r,n,s,o)=>{(e(r)?r[i.symbol]:r[i.symbol]=[]).push({no:n,wireType:s,data:o})},i.onWrite=(t,r,n)=>{for(let{no:s,wireType:o,data:a}of i.list(r))n.tag(s,o).raw(a)},i.list=(t,r)=>{if(e(t)){let n=t[i.symbol];return r?n.filter(s=>s.no==r):n}return[]},i.last=(t,r)=>i.list(t,r).slice(-1)[0];let e=t=>t&&Array.isArray(t[i.symbol])})(O||(O={}));var g;(function(i){i[i.Varint=0]="Varint",i[i.Bit64=1]="Bit64",i[i.LengthDelimited=2]="LengthDelimited",i[i.StartGroup=3]="StartGroup",i[i.EndGroup=4]="EndGroup",i[i.Bit32=5]="Bit32"})(g||(g={}));function Ee(){let i=0,e=0;for(let r=0;r<28;r+=7){let n=this.buf[this.pos++];if(i|=(n&127)<>4,!(t&128))return this.assertBounds(),[i,e];for(let r=3;r<=31;r+=7){let n=this.buf[this.pos++];if(e|=(n&127)<>>s,a=!(!(o>>>7)&&e==0),f=(a?o|128:o)&255;if(t.push(f),!a)return}let r=i>>>28&15|(e&7)<<4,n=!!(e>>3);if(t.push((n?r|128:r)&255),!!n){for(let s=3;s<31;s=s+7){let o=e>>>s,a=!!(o>>>7),f=(a?o|128:o)&255;if(t.push(f),!a)return}t.push(e>>>31&1)}}var Q=(1<<16)*(1<<16);function de(i){let e=i[0]=="-";e&&(i=i.slice(1));let t=1e6,r=0,n=0;function s(o,a){let f=Number(i.slice(o,a));n*=t,r=r*t+f,r>=Q&&(n=n+(r/Q|0),r=r%Q)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),[e,r,n]}function ee(i,e){if(e<=2097151)return""+(Q*e+(i>>>0));let t=i&16777215,r=(i>>>24|e<<8)>>>0&16777215,n=e>>16&65535,s=t+r*6777216+n*6710656,o=r+n*8147497,a=n*2,f=1e7;s>=f&&(o+=Math.floor(s/f),s%=f),o>=f&&(a+=Math.floor(o/f),o%=f);function l(h,y){let p=h?String(h):"";return y?"0000000".slice(p.length)+p:p}return l(a,0)+l(o,a)+l(s,1)}function me(i,e){if(i>=0){for(;i>127;)e.push(i&127|128),i=i>>>7;e.push(i)}else{for(let t=0;t<9;t++)e.push(i&127|128),i=i>>7;e.push(1)}}function Re(){let i=this.buf[this.pos++],e=i&127;if(!(i&128))return this.assertBounds(),e;if(i=this.buf[this.pos++],e|=(i&127)<<7,!(i&128))return this.assertBounds(),e;if(i=this.buf[this.pos++],e|=(i&127)<<14,!(i&128))return this.assertBounds(),e;if(i=this.buf[this.pos++],e|=(i&127)<<21,!(i&128))return this.assertBounds(),e;i=this.buf[this.pos++],e|=(i&15)<<28;for(let t=5;i&128&&t<10;t++)i=this.buf[this.pos++];if(i&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function _e(){let i=new DataView(new ArrayBuffer(8));return globalThis.BigInt!==void 0&&typeof i.getBigInt64=="function"&&typeof i.getBigUint64=="function"&&typeof i.setBigInt64=="function"&&typeof i.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:i}:void 0}var k=_e();function Ae(i){if(!i)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}var Se=/^-?[0-9]+$/,te=(1<<16)*(1<<16),re=class{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*te+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}},T=class extends re{static from(e){if(k)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=k.C(e);case"number":if(e===0)return this.ZERO;e=k.C(e);case"bigint":if(!e)return this.ZERO;if(ek.UMAX)throw new Error("ulong too large");return k.V.setBigUint64(0,e,!0),new T(k.V.getInt32(0,!0),k.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Se.test(e))throw new Error("string is no integer");let[t,r,n]=de(e);if(t)throw new Error("signed value");return new T(r,n);case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new T(e,e/te)}throw new Error("unknown value "+typeof e)}toString(){return k?this.toBigInt().toString():ee(this.lo,this.hi)}toBigInt(){return Ae(k),k.V.setInt32(0,this.lo,!0),k.V.setInt32(4,this.hi,!0),k.V.getBigUint64(0,!0)}};T.ZERO=new T(0,0);var w=class extends re{static from(e){if(k)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=k.C(e);case"number":if(e===0)return this.ZERO;e=k.C(e);case"bigint":if(!e)return this.ZERO;if(ek.MAX)throw new Error("ulong too large");return k.V.setBigInt64(0,e,!0),new w(k.V.getInt32(0,!0),k.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Se.test(e))throw new Error("string is no integer");let[t,r,n]=de(e),s=new w(r,n);return t?s.negate():s;case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new w(e,e/te):new w(-e,-e/te).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&2147483648)!==0}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new w(t,e)}toString(){if(k)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+ee(e.lo,e.hi)}return ee(this.lo,this.hi)}toBigInt(){return Ae(k),k.V.setInt32(0,this.lo,!0),k.V.setInt32(4,this.hi,!0),k.V.getBigInt64(0,!0)}};w.ZERO=new w(0,0);var Ue={readUnknownField:!0,readerFactory:i=>new pe(i)};function Ve(i){return i?Object.assign(Object.assign({},Ue),i):Ue}var pe=class{constructor(e,t){this.varint64=Ee,this.uint32=Re,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,r=e&7;if(t<=0||r<0||r>5)throw new Error("illegal tag: field no "+t+" wire type "+r);return[t,r]}skip(e){let t=this.pos;switch(e){case g.Varint:for(;this.buf[this.pos++]&128;);break;case g.Bit64:this.pos+=4;case g.Bit32:this.pos+=4;break;case g.LengthDelimited:let r=this.uint32();this.pos+=r;break;case g.StartGroup:let n;for(;(n=this.tag()[1])!==g.EndGroup;)this.skip(n);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(t,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return new w(...this.varint64())}uint64(){return new T(...this.varint64())}sint64(){let[e,t]=this.varint64(),r=-(e&1);return e=(e>>>1|(t&1)<<31)^r,t=t>>>1^r,new w(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new T(this.sfixed32(),this.sfixed32())}sfixed64(){return new w(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};function m(i,e){if(!i)throw new Error(e)}var Ye=34028234663852886e22,Ze=-34028234663852886e22,ze=4294967295,Qe=2147483647,He=-2147483648;function M(i){if(typeof i!="number")throw new Error("invalid int 32: "+typeof i);if(!Number.isInteger(i)||i>Qe||ize||i<0)throw new Error("invalid uint 32: "+i)}function j(i){if(typeof i!="number")throw new Error("invalid float 32: "+typeof i);if(Number.isFinite(i)&&(i>Ye||inew ge};function Ce(i){return i?Object.assign(Object.assign({},De),i):De}var ge=class{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let n=0;n>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(W(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return M(e),me(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){j(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){W(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){M(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return M(e),e=(e<<1^e>>31)>>>0,me(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),n=w.from(e);return r.setInt32(0,n.lo,!0),r.setInt32(4,n.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),n=T.from(e);return r.setInt32(0,n.lo,!0),r.setInt32(4,n.hi,!0),this.raw(t)}int64(e){let t=w.from(e);return H(t.lo,t.hi,this.buf),this}sint64(e){let t=w.from(e),r=t.hi>>31,n=t.lo<<1^r,s=(t.hi<<1|t.lo>>>31)^r;return H(n,s,this.buf),this}uint64(e){let t=T.from(e);return H(t.lo,t.hi,this.buf),this}};var Le={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},Pe={ignoreUnknownFields:!1};function $e(i){return i?Object.assign(Object.assign({},Pe),i):Pe}function Me(i){return i?Object.assign(Object.assign({},Le),i):Le}var K=Symbol.for("protobuf-ts/message-type");function be(i){let e=!1,t=[];for(let r=0;r!n.includes(o))||!r&&n.some(o=>!s.known.includes(o)))return!1;if(t<1)return!0;for(let o of s.oneofs){let a=e[o];if(!qe(a))return!1;if(a.oneofKind===void 0)continue;let f=this.fields.find(l=>l.localName===a.oneofKind);if(!f||!this.field(a[a.oneofKind],f,r,t))return!1}for(let o of this.fields)if(o.oneof===void 0&&!this.field(e[o.localName],o,r,t))return!1;return!0}field(e,t,r,n){let s=t.repeat;switch(t.kind){case"scalar":return e===void 0?t.opt:s?this.scalars(e,t.T,n,t.L):this.scalar(e,t.T,t.L);case"enum":return e===void 0?t.opt:s?this.scalars(e,u.INT32,n):this.scalar(e,u.INT32);case"message":return e===void 0?!0:s?this.messages(e,t.T(),r,n):this.message(e,t.T(),r,n);case"map":if(typeof e!="object"||e===null)return!1;if(n<2)return!0;if(!this.mapKeys(e,t.K,n))return!1;switch(t.V.kind){case"scalar":return this.scalars(Object.values(e),t.V.T,n,t.V.L);case"enum":return this.scalars(Object.values(e),u.INT32,n);case"message":return this.messages(Object.values(e),t.V.T(),r,n)}break}return!0}message(e,t,r,n){return r?t.isAssignable(e,n):t.is(e,n)}messages(e,t,r,n){if(!Array.isArray(e))return!1;if(n<2)return!0;if(r){for(let s=0;sparseInt(s)),t,r);case u.BOOL:return this.scalars(n.slice(0,r).map(s=>s=="true"?!0:s=="false"?!1:s),t,r);default:return this.scalars(n,t,r,F.STRING)}}};function R(i,e){switch(e){case F.BIGINT:return i.toBigInt();case F.NUMBER:return i.toNumber();default:return i.toString()}}var ie=class{constructor(e){this.info=e}prepare(){var e;if(this.fMap===void 0){this.fMap={};let t=(e=this.info.fields)!==null&&e!==void 0?e:[];for(let r of t)this.fMap[r.name]=r,this.fMap[r.jsonName]=r,this.fMap[r.localName]=r}}assert(e,t,r){if(!e){let n=Z(r);throw(n=="number"||n=="boolean")&&(n=r.toString()),new Error(`Cannot parse JSON ${n} for ${this.info.typeName}#${t}`)}}read(e,t,r){this.prepare();let n=[];for(let[s,o]of Object.entries(e)){let a=this.fMap[s];if(!a){if(!r.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${s}`);continue}let f=a.localName,l;if(a.oneof){if(n.includes(a.oneof))throw new Error(`Multiple members of the oneof group "${a.oneof}" of ${this.info.typeName} are present in JSON.`);n.push(a.oneof),l=t[a.oneof]={oneofKind:f}}else l=t;if(a.kind=="map"){if(o===null)continue;this.assert(Be(o),a.name,o);let h=l[f];for(let[y,p]of Object.entries(o)){this.assert(p!==null,a.name+" map value",null);let c;switch(a.V.kind){case"message":c=a.V.T().internalJsonRead(p,r);break;case"enum":if(c=this.enum(a.V.T(),p,a.name,r.ignoreUnknownFields),c===!1)continue;break;case"scalar":c=this.scalar(p,a.V.T,a.V.L,a.name);break}this.assert(c!==void 0,a.name+" map value",p);let b=y;a.K==u.BOOL&&(b=b=="true"?!0:b=="false"?!1:b),b=this.scalar(b,a.K,F.STRING,a.name).toString(),h[b]=c}}else if(a.repeat){if(o===null)continue;this.assert(Array.isArray(o),a.name,o);let h=l[f];for(let y of o){this.assert(y!==null,a.name,null);let p;switch(a.kind){case"message":p=a.T().internalJsonRead(y,r);break;case"enum":if(p=this.enum(a.T(),y,a.name,r.ignoreUnknownFields),p===!1)continue;break;case"scalar":p=this.scalar(y,a.T,a.L,a.name);break}this.assert(p!==void 0,a.name,o),h.push(p)}}else switch(a.kind){case"message":if(o===null&&a.T().typeName!="google.protobuf.Value"){this.assert(a.oneof===void 0,a.name+" (oneof member)",null);continue}l[f]=a.T().internalJsonRead(o,r,l[f]);break;case"enum":let h=this.enum(a.T(),o,a.name,r.ignoreUnknownFields);if(h===!1)continue;l[f]=h;break;case"scalar":l[f]=this.scalar(o,a.T,a.L,a.name);break}}}enum(e,t,r,n){if(e[0]=="google.protobuf.NullValue"&&m(t===null,`Unable to parse field ${this.info.typeName}#${r}, enum ${e[0]} only accepts null.`),t===null)return 0;switch(typeof t){case"number":return m(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${r}, enum can only be integral number, got ${t}.`),t;case"string":let s=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(s=t.substring(e[2].length));let o=e[1][s];return typeof o>"u"&&n?!1:(m(typeof o=="number",`Unable to parse field ${this.info.typeName}#${r}, enum ${e[0]} has no value for "${t}".`),o)}m(!1,`Unable to parse field ${this.info.typeName}#${r}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,r,n){let s;try{switch(t){case u.DOUBLE:case u.FLOAT:if(e===null)return 0;if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""){s="empty string";break}if(typeof e=="string"&&e.trim().length!==e.length){s="extra whitespace";break}if(typeof e!="string"&&typeof e!="number")break;let o=Number(e);if(Number.isNaN(o)){s="not a number";break}if(!Number.isFinite(o)){s="too large or small";break}return t==u.FLOAT&&j(o),o;case u.INT32:case u.FIXED32:case u.SFIXED32:case u.SINT32:case u.UINT32:if(e===null)return 0;let a;if(typeof e=="number"?a=e:e===""?s="empty string":typeof e=="string"&&(e.trim().length!==e.length?s="extra whitespace":a=Number(e)),a===void 0)break;return t==u.UINT32?W(a):M(a),a;case u.INT64:case u.SFIXED64:case u.SINT64:if(e===null)return R(w.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return R(w.from(e),r);case u.FIXED64:case u.UINT64:if(e===null)return R(T.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return R(T.from(e),r);case u.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case u.STRING:if(e===null)return"";if(typeof e!="string"){s="extra whitespace";break}try{encodeURIComponent(e)}catch(f){f="invalid UTF8";break}return e;case u.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return Oe(e)}}catch(o){s=o.message}this.assert(!1,n+(s?" - "+s:""),e)}};var se=class{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}write(e,t){let r={},n=e;for(let s of this.fields){if(!s.oneof){let l=this.field(s,n[s.localName],t);l!==void 0&&(r[t.useProtoFieldName?s.name:s.jsonName]=l);continue}let o=n[s.oneof];if(o.oneofKind!==s.localName)continue;let a=s.kind=="scalar"||s.kind=="enum"?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t,f=this.field(s,o[s.localName],a);m(f!==void 0),r[t.useProtoFieldName?s.name:s.jsonName]=f}return r}field(e,t,r){let n;if(e.kind=="map"){m(typeof t=="object"&&t!==null);let s={};switch(e.V.kind){case"scalar":for(let[f,l]of Object.entries(t)){let h=this.scalar(e.V.T,l,e.name,!1,!0);m(h!==void 0),s[f.toString()]=h}break;case"message":let o=e.V.T();for(let[f,l]of Object.entries(t)){let h=this.message(o,l,e.name,r);m(h!==void 0),s[f.toString()]=h}break;case"enum":let a=e.V.T();for(let[f,l]of Object.entries(t)){m(l===void 0||typeof l=="number");let h=this.enum(a,l,e.name,!1,!0,r.enumAsInteger);m(h!==void 0),s[f.toString()]=h}break}(r.emitDefaultValues||Object.keys(s).length>0)&&(n=s)}else if(e.repeat){m(Array.isArray(t));let s=[];switch(e.kind){case"scalar":for(let f=0;f0||r.emitDefaultValues)&&(n=s)}else switch(e.kind){case"scalar":n=this.scalar(e.T,t,e.name,e.opt,r.emitDefaultValues);break;case"enum":n=this.enum(e.T(),t,e.name,e.opt,r.emitDefaultValues,r.enumAsInteger);break;case"message":n=this.message(e.T(),t,e.name,r);break}return n}enum(e,t,r,n,s,o){if(e[0]=="google.protobuf.NullValue")return null;if(t===void 0){m(n);return}if(!(t===0&&!s&&!n))return m(typeof t=="number"),m(Number.isInteger(t)),o||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}message(e,t,r,n){return t===void 0?n.emitDefaultValues?null:void 0:e.internalJsonWrite(t,n)}scalar(e,t,r,n,s){if(t===void 0){m(n);return}let o=s||n;switch(e){case u.INT32:case u.SFIXED32:case u.SINT32:return t===0?o?0:void 0:(M(t),t);case u.FIXED32:case u.UINT32:return t===0?o?0:void 0:(W(t),t);case u.FLOAT:j(t);case u.DOUBLE:return t===0?o?0:void 0:(m(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t);case u.STRING:return t===""?o?"":void 0:(m(typeof t=="string"),t);case u.BOOL:return t===!1?o?!1:void 0:(m(typeof t=="boolean"),t);case u.UINT64:case u.FIXED64:m(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let a=T.from(t);return a.isZero()&&!o?void 0:a.toString();case u.INT64:case u.SFIXED64:case u.SINT64:m(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let f=w.from(t);return f.isZero()&&!o?void 0:f.toString();case u.BYTES:return m(t instanceof Uint8Array),t.byteLength?Fe(t):o?"":void 0}}};function _(i,e=F.STRING){switch(i){case u.BOOL:return!1;case u.UINT64:case u.FIXED64:return R(T.ZERO,e);case u.INT64:case u.SFIXED64:case u.SINT64:return R(w.ZERO,e);case u.DOUBLE:case u.FLOAT:return 0;case u.BYTES:return new Uint8Array(0);case u.STRING:return"";default:return 0}}var oe=class{constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){let t=(e=this.info.fields)!==null&&e!==void 0?e:[];this.fieldNoToField=new Map(t.map(r=>[r.no,r]))}}read(e,t,r,n){this.prepare();let s=n===void 0?e.len:e.pos+n;for(;e.post.no-r.no)}}write(e,t,r){this.prepare();for(let s of this.fields){let o,a,f=s.repeat,l=s.localName;if(s.oneof){let h=e[s.oneof];if(h.oneofKind!==l)continue;o=h[l],a=!0}else o=e[l],a=!1;switch(s.kind){case"scalar":case"enum":let h=s.kind=="enum"?u.INT32:s.T;if(f)if(m(Array.isArray(o)),f==v.PACKED)this.packed(t,h,s.no,o);else for(let y of o)this.scalar(t,h,s.no,y,!0);else o===void 0?m(s.opt):this.scalar(t,h,s.no,o,a||s.opt);break;case"message":if(f){m(Array.isArray(o));for(let y of o)this.message(t,r,s.T(),s.no,y)}else this.message(t,r,s.T(),s.no,o);break;case"map":m(typeof o=="object"&&o!==null);for(let[y,p]of Object.entries(o))this.mapEntry(t,r,s,y,p);break}}let n=r.writeUnknownFields;n!==!1&&(n===!0?O.onWrite:n)(this.info.typeName,e,t)}mapEntry(e,t,r,n,s){e.tag(r.no,g.LengthDelimited),e.fork();let o=n;switch(r.K){case u.INT32:case u.FIXED32:case u.UINT32:case u.SFIXED32:case u.SINT32:o=Number.parseInt(n);break;case u.BOOL:m(n=="true"||n=="false"),o=n=="true";break}switch(this.scalar(e,r.K,1,o,!0),r.V.kind){case"scalar":this.scalar(e,r.V.T,2,s,!0);break;case"enum":this.scalar(e,u.INT32,2,s,!0);break;case"message":this.message(e,t,r.V.T(),2,s);break}e.join()}message(e,t,r,n,s){s!==void 0&&(r.internalBinaryWrite(s,e.tag(n,g.LengthDelimited).fork(),t),e.join())}scalar(e,t,r,n,s){let[o,a,f]=this.scalarInfo(t,n);(!f||s)&&(e.tag(r,o),e[a](n))}packed(e,t,r,n){if(!n.length)return;m(t!==u.BYTES&&t!==u.STRING),e.tag(r,g.LengthDelimited),e.fork();let[,s]=this.scalarInfo(t);for(let o=0;oye},{no:2,name:"browseId",kind:"scalar",T:9}])}create(e){let t={browseId:""};return globalThis.Object.defineProperty(t,K,{enumerable:!1,value:this}),e!==void 0&&C(this,t,e),t}internalBinaryRead(e,t,r,n){let s=n??this.create(),o=e.pos+t;for(;e.poswe}])}create(e){let t={};return globalThis.Object.defineProperty(t,K,{enumerable:!1,value:this}),e!==void 0&&C(this,t,e),t}internalBinaryRead(e,t,r,n){let s=n??this.create(),o=e.pos+t;for(;e.posIe}])}create(e){let t={params:[]};return globalThis.Object.defineProperty(t,K,{enumerable:!1,value:this}),e!==void 0&&C(this,t,e),t}internalBinaryRead(e,t,r,n){let s=n??this.create(),o=e.pos+t;for(;e.posnew le(e,t,r),Surge:(e,t,r)=>new ue(e,t,r)};var ce=class extends ${getFn(e,t,r){let n=ce.clientAdapter[t]||t;return super.getFn(e,n,r)}setFn(e,t,r,n){let s=ce.clientAdapter[t]||t;return super.setFn(e,s,r,n)}init(){try{this.request=this.createProxy($request),this.response=this.createProxy($response)}catch(e){this.log(e.toString())}}getVal(e){return $persistentStore.read(e)}setVal(e,t){$persistentStore.write(e,t)}msg(e=this.name,t="",r="",n){$notification.post(e,t,r,{url:n??""})}async fetch(e){return await new Promise((t,r)=>{let{method:n,body:s,bodyBytes:o,...a}=e,f=o??s,l=f instanceof Uint8Array;$httpClient[n.toLowerCase()]({...a,body:f,"binary-mode":l},(h,y,p)=>{h&&r(h);let c=l?"bodyBytes":"body";t({status:y.status||y.statusCode,headers:y.headers,[c]:p})})})}done(e){let t=e.response??e,r,n;t.bodyBytes?(r=t.bodyBytes,delete t.bodyBytes,n={...e},n.response?n.response.body=r:n.body=r):n=e,$done(n)}},ue=ce;ue.clientAdapter={bodyBytes:"body"};var P=class extends ${static transferBodyBytes(e,t){return e instanceof ArrayBuffer?t==="Uint8Array"?new Uint8Array(e):e:e instanceof Uint8Array&&t==="ArrayBuffer"?e.buffer.slice(e.byteOffset,e.byteLength+e.byteOffset):e}init(){try{this.request=this.createProxy($request),this.response=this.createProxy($response)}catch(e){this.log(e.toString())}}getFn(e,t,r){let n=P.clientAdapter[t]||t,s=super.getFn(e,n,r);return t==="bodyBytes"&&(s=P.transferBodyBytes(s,"Uint8Array")),s}setFn(e,t,r,n){let s=P.clientAdapter[t]||t,o=r;return t==="bodyBytes"&&(o=P.transferBodyBytes(o,"Uint8Array")),super.setFn(e,s,o,n)}getVal(e){return $prefs.valueForKey(e)?.replace(/\0/g,"")}setVal(e,t){$prefs.setValueForKey(e,t)}msg(e=this.name,t="",r="",n){$notify(e,t,r,{"open-url":n??""})}async fetch(e){return await new Promise(t=>{let r={url:"",method:"GET"};for(let[n,s]of Object.entries(e))n==="id"?r.sessionIndex=s:n==="bodyBytes"?r.bodyBytes=P.transferBodyBytes(s,"ArrayBuffer"):r[n]=s;e.bodyBytes&&delete r.body,$task.fetch(r).then(n=>{let s={status:200,headers:{}};for(let[o,a]of Object.entries(n))o==="sessionIndex"?s.id=a:o==="bodyBytes"?s.bodyBytes=P.transferBodyBytes(a,"Uint8Array"):o==="statusCode"?s.status=a:s[o]=a;t(s)})})}done(e){let t=e.response??e,r={};for(let[n,s]of Object.entries(t))n==="status"?r.status=`HTTP/1.1 ${s}`:n==="bodyBytes"?r.bodyBytes=P.transferBodyBytes(s,"ArrayBuffer"):r[n]=s;$done(r)}},le=P;le.clientAdapter={id:"sessionIndex",status:"statusCode"};var S=$.getInstance("YouTube",{debug:!1});var he=class{constructor(e,t){this.decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0});S.log(t),this.msgType=e,Object.assign(this,S.getJSON("YouTubeAdvertiseInfo",{whiteNo:[],blackNo:[],whiteEml:[],blackEml:["cell_divider.eml"]}))}fromBinary(e){return this.message=this.msgType.fromBinary(e),this}toBinary(){return this.msgType.toBinary(this.message)}save(){if(this.needSave){S.log("Update Config");let e={whiteNo:this.whiteNo,blackNo:this.blackNo,whiteEml:this.whiteEml,blackEml:this.blackEml};S.setJSON(e,"YouTubeAdvertiseInfo")}}done(e){this.save();let t=e.bodyBytes;this.needProcess&&(t=this.toBinary()),e.headers["Content-Encoding"]="identity",e.headers["Content-Length"]=(t?.length??0)?.toString(),S.done({response:{...e,bodyBytes:t}})}doneResponse(){this.save(),this.needProcess&&S.done({bodyBytes:this.toBinary()}),S.exit()}iterate(e={},t,r,n){let s=[];for(s.push(e);s.length;){let o=s.pop(),a=Object.keys(o);for(;a.length;){let f=a.pop();f===t?r(o,s):typeof o[f]=="object"&&(s.push(o[f]),typeof n=="function"&&n(o,s))}}}isAdvertise(e){let t=O.list(e)[0],r=t?this.handleFieldNo(t):this.handleFieldEml(e);return r&&(this.needProcess=!0),r}handleFieldNo(e){let t=e.no;if(this.whiteNo.includes(t))return!1;if(this.blackNo.includes(t))return!0;let n=this.decoder.decode(e.data).includes("pagead");return n?this.blackNo.push(t):this.whiteNo.push(t),this.needSave=!0,n}handleFieldEml(e){let t=!1,r=!0,n="";return this.iterate(e,"type",(s,o)=>{n=s.type.split("|")[0],this.whiteEml.includes(n)?t=!1:this.blackEml.includes(n)||/shorts(?!_pivot_item)/.test(n)?t=!0:r=!1,r&&(o.length=0)}),r||(this.iterate(e,"type",()=>{},(s,o)=>{let a=O.list(s);for(let f of a)if(f.data.length>1e3&&(t=this.decoder.decode(f.data).includes("pagead"),t)){o.length=0;break}}),t?this.blackEml.push(n):this.whiteEml.push(n),this.needSave=!0),t}};var Y=class extends he{constructor(e=ve,t="Request"){super(e,t)}pure(){return this.message.context.adSignalsInfo.params.length=0,this.needProcess=!0,this}};var et=new Y;try{let i=et.fromBinary(S.request.bodyBytes).pure().toBinary();S.done({bodyBytes:i})}catch(i){S.log(i.toString()),S.exit()}})();