@devvit/client 0.11.20-next-2025-07-25-17-24-54-9a691dab8.0 → 0.11.20-next-2025-07-28-12-50-32-fb5e880af.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.min.js CHANGED
@@ -1,2 +1,2 @@
1
- var xr=Object.create;var mt=Object.defineProperty;var Ar=Object.getOwnPropertyDescriptor;var Dr=Object.getOwnPropertyNames;var Br=Object.getPrototypeOf,Lr=Object.prototype.hasOwnProperty;var C=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var Mr=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Dr(n))!Lr.call(e,r)&&r!==t&&mt(e,r,{get:()=>n[r],enumerable:!(o=Ar(n,r))||o.enumerable});return e};var x=(e,n,t)=>(t=e!=null?xr(Br(e)):{},Mr(n||!e||!e.__esModule?mt(t,"default",{value:e,enumerable:!0}):t,e));var St=C((Mo,gt)=>{"use strict";gt.exports=Jr;function Jr(e,n){for(var t=new Array(arguments.length-1),o=0,r=2,i=!0;r<arguments.length;)t[o++]=arguments[r++];return new Promise(function(f,s){t[o]=function(c){if(i)if(i=!1,c)s(c);else{for(var N=new Array(arguments.length-1),y=0;y<N.length;)N[y++]=arguments[y];f.apply(null,N)}};try{e.apply(n||null,t)}catch(u){i&&(i=!1,s(u))}})}});var Et=C(bt=>{"use strict";var yn=bt;yn.length=function(n){var t=n.length;if(!t)return 0;for(var o=0;--t%4>1&&n.charAt(t)==="=";)++o;return Math.ceil(n.length*3)/4-o};var nn=new Array(64),vt=new Array(123);for(ee=0;ee<64;)vt[nn[ee]=ee<26?ee+65:ee<52?ee+71:ee<62?ee-4:ee-59|43]=ee++;var ee;yn.encode=function(n,t,o){for(var r=null,i=[],a=0,f=0,s;t<o;){var u=n[t++];switch(f){case 0:i[a++]=nn[u>>2],s=(u&3)<<4,f=1;break;case 1:i[a++]=nn[s|u>>4],s=(u&15)<<2,f=2;break;case 2:i[a++]=nn[s|u>>6],i[a++]=nn[u&63],f=0;break}a>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,i)),a=0)}return f&&(i[a++]=nn[s],i[a++]=61,f===1&&(i[a++]=61)),r?(a&&r.push(String.fromCharCode.apply(String,i.slice(0,a))),r.join("")):String.fromCharCode.apply(String,i.slice(0,a))};var yt="invalid encoding";yn.decode=function(n,t,o){for(var r=o,i=0,a,f=0;f<n.length;){var s=n.charCodeAt(f++);if(s===61&&i>1)break;if((s=vt[s])===void 0)throw Error(yt);switch(i){case 0:a=s,i=1;break;case 1:t[o++]=a<<2|(s&48)>>4,a=s,i=2;break;case 2:t[o++]=(a&15)<<4|(s&60)>>2,a=s,i=3;break;case 3:t[o++]=(a&3)<<6|s,i=0;break}}if(i===1)throw Error(yt);return o-r};yn.test=function(n){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(n)}});var Tt=C((Uo,Nt)=>{"use strict";Nt.exports=vn;function vn(){this._listeners={}}vn.prototype.on=function(n,t,o){return(this._listeners[n]||(this._listeners[n]=[])).push({fn:t,ctx:o||this}),this};vn.prototype.off=function(n,t){if(n===void 0)this._listeners={};else if(t===void 0)this._listeners[n]=[];else for(var o=this._listeners[n],r=0;r<o.length;)o[r].fn===t?o.splice(r,1):++r;return this};vn.prototype.emit=function(n){var t=this._listeners[n];if(t){for(var o=[],r=1;r<arguments.length;)o.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,o)}return this}});var Ft=C((Wo,_t)=>{"use strict";_t.exports=It(It);function It(e){return typeof Float32Array<"u"?function(){var n=new Float32Array([-0]),t=new Uint8Array(n.buffer),o=t[3]===128;function r(s,u,c){n[0]=s,u[c]=t[0],u[c+1]=t[1],u[c+2]=t[2],u[c+3]=t[3]}function i(s,u,c){n[0]=s,u[c]=t[3],u[c+1]=t[2],u[c+2]=t[1],u[c+3]=t[0]}e.writeFloatLE=o?r:i,e.writeFloatBE=o?i:r;function a(s,u){return t[0]=s[u],t[1]=s[u+1],t[2]=s[u+2],t[3]=s[u+3],n[0]}function f(s,u){return t[3]=s[u],t[2]=s[u+1],t[1]=s[u+2],t[0]=s[u+3],n[0]}e.readFloatLE=o?a:f,e.readFloatBE=o?f:a}():function(){function n(o,r,i,a){var f=r<0?1:0;if(f&&(r=-r),r===0)o(1/r>0?0:2147483648,i,a);else if(isNaN(r))o(2143289344,i,a);else if(r>34028234663852886e22)o((f<<31|2139095040)>>>0,i,a);else if(r<11754943508222875e-54)o((f<<31|Math.round(r/1401298464324817e-60))>>>0,i,a);else{var s=Math.floor(Math.log(r)/Math.LN2),u=Math.round(r*Math.pow(2,-s)*8388608)&8388607;o((f<<31|s+127<<23|u)>>>0,i,a)}}e.writeFloatLE=n.bind(null,Ot),e.writeFloatBE=n.bind(null,kt);function t(o,r,i){var a=o(r,i),f=(a>>31)*2+1,s=a>>>23&255,u=a&8388607;return s===255?u?NaN:f*(1/0):s===0?f*1401298464324817e-60*u:f*Math.pow(2,s-150)*(u+8388608)}e.readFloatLE=t.bind(null,Ct),e.readFloatBE=t.bind(null,Vt)}(),typeof Float64Array<"u"?function(){var n=new Float64Array([-0]),t=new Uint8Array(n.buffer),o=t[7]===128;function r(s,u,c){n[0]=s,u[c]=t[0],u[c+1]=t[1],u[c+2]=t[2],u[c+3]=t[3],u[c+4]=t[4],u[c+5]=t[5],u[c+6]=t[6],u[c+7]=t[7]}function i(s,u,c){n[0]=s,u[c]=t[7],u[c+1]=t[6],u[c+2]=t[5],u[c+3]=t[4],u[c+4]=t[3],u[c+5]=t[2],u[c+6]=t[1],u[c+7]=t[0]}e.writeDoubleLE=o?r:i,e.writeDoubleBE=o?i:r;function a(s,u){return t[0]=s[u],t[1]=s[u+1],t[2]=s[u+2],t[3]=s[u+3],t[4]=s[u+4],t[5]=s[u+5],t[6]=s[u+6],t[7]=s[u+7],n[0]}function f(s,u){return t[7]=s[u],t[6]=s[u+1],t[5]=s[u+2],t[4]=s[u+3],t[3]=s[u+4],t[2]=s[u+5],t[1]=s[u+6],t[0]=s[u+7],n[0]}e.readDoubleLE=o?a:f,e.readDoubleBE=o?f:a}():function(){function n(o,r,i,a,f,s){var u=a<0?1:0;if(u&&(a=-a),a===0)o(0,f,s+r),o(1/a>0?0:2147483648,f,s+i);else if(isNaN(a))o(0,f,s+r),o(2146959360,f,s+i);else if(a>17976931348623157e292)o(0,f,s+r),o((u<<31|2146435072)>>>0,f,s+i);else{var c;if(a<22250738585072014e-324)c=a/5e-324,o(c>>>0,f,s+r),o((u<<31|c/4294967296)>>>0,f,s+i);else{var N=Math.floor(Math.log(a)/Math.LN2);N===1024&&(N=1023),c=a*Math.pow(2,-N),o(c*4503599627370496>>>0,f,s+r),o((u<<31|N+1023<<20|c*1048576&1048575)>>>0,f,s+i)}}}e.writeDoubleLE=n.bind(null,Ot,0,4),e.writeDoubleBE=n.bind(null,kt,4,0);function t(o,r,i,a,f){var s=o(a,f+r),u=o(a,f+i),c=(u>>31)*2+1,N=u>>>20&2047,y=4294967296*(u&1048575)+s;return N===2047?y?NaN:c*(1/0):N===0?c*5e-324*y:c*Math.pow(2,N-1075)*(y+4503599627370496)}e.readDoubleLE=t.bind(null,Ct,0,4),e.readDoubleBE=t.bind(null,Vt,4,0)}(),e}function Ot(e,n,t){n[t]=e&255,n[t+1]=e>>>8&255,n[t+2]=e>>>16&255,n[t+3]=e>>>24}function kt(e,n,t){n[t]=e>>>24,n[t+1]=e>>>16&255,n[t+2]=e>>>8&255,n[t+3]=e&255}function Ct(e,n){return(e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24)>>>0}function Vt(e,n){return(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0}});var Rt=C((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}});var wt=C(Pt=>{"use strict";var Fn=Pt;Fn.length=function(n){for(var t=0,o=0,r=0;r<n.length;++r)o=n.charCodeAt(r),o<128?t+=1:o<2048?t+=2:(o&64512)===55296&&(n.charCodeAt(r+1)&64512)===56320?(++r,t+=4):t+=3;return t};Fn.read=function(n,t,o){var r=o-t;if(r<1)return"";for(var i=null,a=[],f=0,s;t<o;)s=n[t++],s<128?a[f++]=s:s>191&&s<224?a[f++]=(s&31)<<6|n[t++]&63:s>239&&s<365?(s=((s&7)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,a[f++]=55296+(s>>10),a[f++]=56320+(s&1023)):a[f++]=(s&15)<<12|(n[t++]&63)<<6|n[t++]&63,f>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,a)),f=0);return i?(f&&i.push(String.fromCharCode.apply(String,a.slice(0,f))),i.join("")):String.fromCharCode.apply(String,a.slice(0,f))};Fn.write=function(n,t,o){for(var r=o,i,a,f=0;f<n.length;++f)i=n.charCodeAt(f),i<128?t[o++]=i:i<2048?(t[o++]=i>>6|192,t[o++]=i&63|128):(i&64512)===55296&&((a=n.charCodeAt(f+1))&64512)===56320?(i=65536+((i&1023)<<10)+(a&1023),++f,t[o++]=i>>18|240,t[o++]=i>>12&63|128,t[o++]=i>>6&63|128,t[o++]=i&63|128):(t[o++]=i>>12|224,t[o++]=i>>6&63|128,t[o++]=i&63|128);return o-r}});var At=C((Go,xt)=>{"use strict";xt.exports=Ur;function Ur(e,n,t){var o=t||8192,r=o>>>1,i=null,a=o;return function(s){if(s<1||s>r)return e(s);a+s>o&&(i=e(o),a=0);var u=n.call(i,a,a+=s);return a&7&&(a=(a|7)+1),u}}});var Bt=C((qo,Dt)=>{"use strict";Dt.exports=V;var un=Se();function V(e,n){this.lo=e>>>0,this.hi=n>>>0}var qe=V.zero=new V(0,0);qe.toNumber=function(){return 0};qe.zzEncode=qe.zzDecode=function(){return this};qe.length=function(){return 1};var Wr=V.zeroHash="\0\0\0\0\0\0\0\0";V.fromNumber=function(n){if(n===0)return qe;var t=n<0;t&&(n=-n);var o=n>>>0,r=(n-o)/4294967296>>>0;return t&&(r=~r>>>0,o=~o>>>0,++o>4294967295&&(o=0,++r>4294967295&&(r=0))),new V(o,r)};V.from=function(n){if(typeof n=="number")return V.fromNumber(n);if(un.isString(n))if(un.Long)n=un.Long.fromString(n);else return V.fromNumber(parseInt(n,10));return n.low||n.high?new V(n.low>>>0,n.high>>>0):qe};V.prototype.toNumber=function(n){if(!n&&this.hi>>>31){var t=~this.lo+1>>>0,o=~this.hi>>>0;return t||(o=o+1>>>0),-(t+o*4294967296)}return this.lo+this.hi*4294967296};V.prototype.toLong=function(n){return un.Long?new un.Long(this.lo|0,this.hi|0,!!n):{low:this.lo|0,high:this.hi|0,unsigned:!!n}};var ge=String.prototype.charCodeAt;V.fromHash=function(n){return n===Wr?qe:new V((ge.call(n,0)|ge.call(n,1)<<8|ge.call(n,2)<<16|ge.call(n,3)<<24)>>>0,(ge.call(n,4)|ge.call(n,5)<<8|ge.call(n,6)<<16|ge.call(n,7)<<24)>>>0)};V.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};V.prototype.zzEncode=function(){var n=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^n)>>>0,this.lo=(this.lo<<1^n)>>>0,this};V.prototype.zzDecode=function(){var n=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^n)>>>0,this.hi=(this.hi>>>1^n)>>>0,this};V.prototype.length=function(){var n=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?t===0?n<16384?n<128?1:2:n<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:o<128?9:10}});var Se=C(Rn=>{"use strict";var p=Rn;p.asPromise=St();p.base64=Et();p.EventEmitter=Tt();p.float=Ft();p.inquire=Rt();p.utf8=wt();p.pool=At();p.LongBits=Bt();p.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);p.global=p.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Rn;p.emptyArray=Object.freeze?Object.freeze([]):[];p.emptyObject=Object.freeze?Object.freeze({}):{};p.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};p.isString=function(n){return typeof n=="string"||n instanceof String};p.isObject=function(n){return n&&typeof n=="object"};p.isset=p.isSet=function(n,t){var o=n[t];return o!=null&&n.hasOwnProperty(t)?typeof o!="object"||(Array.isArray(o)?o.length:Object.keys(o).length)>0:!1};p.Buffer=function(){try{var e=p.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}}();p._Buffer_from=null;p._Buffer_allocUnsafe=null;p.newBuffer=function(n){return typeof n=="number"?p.Buffer?p._Buffer_allocUnsafe(n):new p.Array(n):p.Buffer?p._Buffer_from(n):typeof Uint8Array>"u"?n:new Uint8Array(n)};p.Array=typeof Uint8Array<"u"?Uint8Array:Array;p.Long=p.global.dcodeIO&&p.global.dcodeIO.Long||p.global.Long||p.inquire("long");p.key2Re=/^true|false|0|1$/;p.key32Re=/^-?(?:0|[1-9][0-9]*)$/;p.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;p.longToHash=function(n){return n?p.LongBits.from(n).toHash():p.LongBits.zeroHash};p.longFromHash=function(n,t){var o=p.LongBits.fromHash(n);return p.Long?p.Long.fromBits(o.lo,o.hi,t):o.toNumber(!!t)};function Lt(e,n,t){for(var o=Object.keys(n),r=0;r<o.length;++r)(e[o[r]]===void 0||!t)&&(e[o[r]]=n[o[r]]);return e}p.merge=Lt;p.lcFirst=function(n){return n.charAt(0).toLowerCase()+n.substring(1)};function Mt(e){function n(t,o){if(!(this instanceof n))return new n(t,o);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,n):Object.defineProperty(this,"stack",{value:new Error().stack||""}),o&&Lt(this,o)}return n.prototype=Object.create(Error.prototype,{constructor:{value:n,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),n}p.newError=Mt;p.ProtocolError=Mt("ProtocolError");p.oneOfGetter=function(n){for(var t={},o=0;o<n.length;++o)t[n[o]]=1;return function(){for(var r=Object.keys(this),i=r.length-1;i>-1;--i)if(t[r[i]]===1&&this[r[i]]!==void 0&&this[r[i]]!==null)return r[i]}};p.oneOfSetter=function(n){return function(t){for(var o=0;o<n.length;++o)n[o]!==t&&delete this[n[o]]}};p.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};p._configure=function(){var e=p.Buffer;if(!e){p._Buffer_from=p._Buffer_allocUnsafe=null;return}p._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,o){return new e(t,o)},p._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}}});var Ln=C((Ho,$t)=>{"use strict";$t.exports=m;var H=Se(),Pn,bn=H.LongBits,Jt=H.base64,Ut=H.utf8;function dn(e,n,t){this.fn=e,this.len=n,this.next=void 0,this.val=t}function xn(){}function $r(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function m(){this.len=0,this.head=new dn(xn,0,0),this.tail=this.head,this.states=null}var Wt=function(){return H.Buffer?function(){return(m.create=function(){return new Pn})()}:function(){return new m}};m.create=Wt();m.alloc=function(n){return new H.Array(n)};H.Array!==Array&&(m.alloc=H.pool(m.alloc,H.Array.prototype.subarray));m.prototype._push=function(n,t,o){return this.tail=this.tail.next=new dn(n,t,o),this.len+=t,this};function An(e,n,t){n[t]=e&255}function Gr(e,n,t){for(;e>127;)n[t++]=e&127|128,e>>>=7;n[t]=e}function Dn(e,n){this.len=e,this.next=void 0,this.val=n}Dn.prototype=Object.create(dn.prototype);Dn.prototype.fn=Gr;m.prototype.uint32=function(n){return this.len+=(this.tail=this.tail.next=new Dn((n=n>>>0)<128?1:n<16384?2:n<2097152?3:n<268435456?4:5,n)).len,this};m.prototype.int32=function(n){return n<0?this._push(Bn,10,bn.fromNumber(n)):this.uint32(n)};m.prototype.sint32=function(n){return this.uint32((n<<1^n>>31)>>>0)};function Bn(e,n,t){for(;e.hi;)n[t++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)n[t++]=e.lo&127|128,e.lo=e.lo>>>7;n[t++]=e.lo}m.prototype.uint64=function(n){var t=bn.from(n);return this._push(Bn,t.length(),t)};m.prototype.int64=m.prototype.uint64;m.prototype.sint64=function(n){var t=bn.from(n).zzEncode();return this._push(Bn,t.length(),t)};m.prototype.bool=function(n){return this._push(An,1,n?1:0)};function wn(e,n,t){n[t]=e&255,n[t+1]=e>>>8&255,n[t+2]=e>>>16&255,n[t+3]=e>>>24}m.prototype.fixed32=function(n){return this._push(wn,4,n>>>0)};m.prototype.sfixed32=m.prototype.fixed32;m.prototype.fixed64=function(n){var t=bn.from(n);return this._push(wn,4,t.lo)._push(wn,4,t.hi)};m.prototype.sfixed64=m.prototype.fixed64;m.prototype.float=function(n){return this._push(H.float.writeFloatLE,4,n)};m.prototype.double=function(n){return this._push(H.float.writeDoubleLE,8,n)};var qr=H.Array.prototype.set?function(n,t,o){t.set(n,o)}:function(n,t,o){for(var r=0;r<n.length;++r)t[o+r]=n[r]};m.prototype.bytes=function(n){var t=n.length>>>0;if(!t)return this._push(An,1,0);if(H.isString(n)){var o=m.alloc(t=Jt.length(n));Jt.decode(n,o,0),n=o}return this.uint32(t)._push(qr,t,n)};m.prototype.string=function(n){var t=Ut.length(n);return t?this.uint32(t)._push(Ut.write,t,n):this._push(An,1,0)};m.prototype.fork=function(){return this.states=new $r(this),this.head=this.tail=new dn(xn,0,0),this.len=0,this};m.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new dn(xn,0,0),this.len=0),this};m.prototype.ldelim=function(){var n=this.head,t=this.tail,o=this.len;return this.reset().uint32(o),o&&(this.tail.next=n.next,this.tail=t,this.len+=o),this};m.prototype.finish=function(){for(var n=this.head.next,t=this.constructor.alloc(this.len),o=0;n;)n.fn(n.val,t,o),o+=n.len,n=n.next;return t};m._configure=function(e){Pn=e,m.create=Wt(),Pn._configure()}});var Zt=C((Ko,qt)=>{"use strict";qt.exports=re;var Gt=Ln();(re.prototype=Object.create(Gt.prototype)).constructor=re;var ye=Se();function re(){Gt.call(this)}re._configure=function(){re.alloc=ye._Buffer_allocUnsafe,re.writeBytesBuffer=ye.Buffer&&ye.Buffer.prototype instanceof Uint8Array&&ye.Buffer.prototype.set.name==="set"?function(n,t,o){t.set(n,o)}:function(n,t,o){if(n.copy)n.copy(t,o,0,n.length);else for(var r=0;r<n.length;)t[o++]=n[r++]}};re.prototype.bytes=function(n){ye.isString(n)&&(n=ye._Buffer_from(n,"base64"));var t=n.length>>>0;return this.uint32(t),t&&this._push(re.writeBytesBuffer,t,n),this};function Zr(e,n,t){e.length<40?ye.utf8.write(e,n,t):n.utf8Write?n.utf8Write(e,t):n.write(e,t)}re.prototype.string=function(n){var t=ye.Buffer.byteLength(n);return this.uint32(t),t&&this._push(Zr,t,n),this};re._configure()});var Un=C((zo,Qt)=>{"use strict";Qt.exports=O;var ne=Se(),Jn,zt=ne.LongBits,Hr=ne.utf8;function te(e,n){return RangeError("index out of range: "+e.pos+" + "+(n||1)+" > "+e.len)}function O(e){this.buf=e,this.pos=0,this.len=e.length}var Ht=typeof Uint8Array<"u"?function(n){if(n instanceof Uint8Array||Array.isArray(n))return new O(n);throw Error("illegal buffer")}:function(n){if(Array.isArray(n))return new O(n);throw Error("illegal buffer")},Xt=function(){return ne.Buffer?function(t){return(O.create=function(r){return ne.Buffer.isBuffer(r)?new Jn(r):Ht(r)})(t)}:Ht};O.create=Xt();O.prototype._slice=ne.Array.prototype.subarray||ne.Array.prototype.slice;O.prototype.uint32=function(){var n=4294967295;return function(){if(n=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(n=(n|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(n=(n|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(n=(n|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(n=(n|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return n;if((this.pos+=5)>this.len)throw this.pos=this.len,te(this,10);return n}}();O.prototype.int32=function(){return this.uint32()|0};O.prototype.sint32=function(){var n=this.uint32();return n>>>1^-(n&1)|0};function Mn(){var e=new zt(0,0),n=0;if(this.len-this.pos>4){for(;n<4;++n)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<n*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;n=0}else{for(;n<3;++n){if(this.pos>=this.len)throw te(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<n*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<n*7)>>>0,e}if(this.len-this.pos>4){for(;n<5;++n)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<n*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;n<5;++n){if(this.pos>=this.len)throw te(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<n*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}O.prototype.bool=function(){return this.uint32()!==0};function En(e,n){return(e[n-4]|e[n-3]<<8|e[n-2]<<16|e[n-1]<<24)>>>0}O.prototype.fixed32=function(){if(this.pos+4>this.len)throw te(this,4);return En(this.buf,this.pos+=4)};O.prototype.sfixed32=function(){if(this.pos+4>this.len)throw te(this,4);return En(this.buf,this.pos+=4)|0};function Kt(){if(this.pos+8>this.len)throw te(this,8);return new zt(En(this.buf,this.pos+=4),En(this.buf,this.pos+=4))}O.prototype.float=function(){if(this.pos+4>this.len)throw te(this,4);var n=ne.float.readFloatLE(this.buf,this.pos);return this.pos+=4,n};O.prototype.double=function(){if(this.pos+8>this.len)throw te(this,4);var n=ne.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,n};O.prototype.bytes=function(){var n=this.uint32(),t=this.pos,o=this.pos+n;if(o>this.len)throw te(this,n);if(this.pos+=n,Array.isArray(this.buf))return this.buf.slice(t,o);if(t===o){var r=ne.Buffer;return r?r.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,o)};O.prototype.string=function(){var n=this.bytes();return Hr.read(n,0,n.length)};O.prototype.skip=function(n){if(typeof n=="number"){if(this.pos+n>this.len)throw te(this,n);this.pos+=n}else do if(this.pos>=this.len)throw te(this);while(this.buf[this.pos++]&128);return this};O.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this};O._configure=function(e){Jn=e,O.create=Xt(),Jn._configure();var n=ne.Long?"toLong":"toNumber";ne.merge(O.prototype,{int64:function(){return Mn.call(this)[n](!1)},uint64:function(){return Mn.call(this)[n](!0)},sint64:function(){return Mn.call(this).zzDecode()[n](!1)},fixed64:function(){return Kt.call(this)[n](!0)},sfixed64:function(){return Kt.call(this)[n](!1)}})}});var ni=C((Xo,ei)=>{"use strict";ei.exports=Ze;var jt=Un();(Ze.prototype=Object.create(jt.prototype)).constructor=Ze;var Yt=Se();function Ze(e){jt.call(this,e)}Ze._configure=function(){Yt.Buffer&&(Ze.prototype._slice=Yt.Buffer.prototype.slice)};Ze.prototype.string=function(){var n=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+n,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+n,this.len))};Ze._configure()});var ii=C((Qo,ti)=>{"use strict";ti.exports=fn;var Wn=Se();(fn.prototype=Object.create(Wn.EventEmitter.prototype)).constructor=fn;function fn(e,n,t){if(typeof e!="function")throw TypeError("rpcImpl must be a function");Wn.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!n,this.responseDelimited=!!t}fn.prototype.rpcCall=function e(n,t,o,r,i){if(!r)throw TypeError("request must be specified");var a=this;if(!i)return Wn.asPromise(e,a,n,t,o,r);if(!a.rpcImpl){setTimeout(function(){i(Error("already ended"))},0);return}try{return a.rpcImpl(n,t[a.requestDelimited?"encodeDelimited":"encode"](r).finish(),function(s,u){if(s)return a.emit("error",s,n),i(s);if(u===null){a.end(!0);return}if(!(u instanceof o))try{u=o[a.responseDelimited?"decodeDelimited":"decode"](u)}catch(c){return a.emit("error",c,n),i(c)}return a.emit("data",u,n),i(null,u)})}catch(f){a.emit("error",f,n),setTimeout(function(){i(f)},0);return}};fn.prototype.end=function(n){return this.rpcImpl&&(n||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var oi=C(ri=>{"use strict";var Kr=ri;Kr.Service=ii()});var si=C((jo,ai)=>{"use strict";ai.exports={}});var fi=C(di=>{"use strict";var B=di;B.build="minimal";B.Writer=Ln();B.BufferWriter=Zt();B.Reader=Un();B.BufferReader=ni();B.util=Se();B.rpc=oi();B.roots=si();B.configure=ui;function ui(){B.util._configure(),B.Writer._configure(B.BufferWriter),B.Reader._configure(B.BufferReader)}ui()});var A=C((na,li)=>{"use strict";li.exports=fi()});var Di=C((va,Ai)=>{Ai.exports=b;var z=null;try{z=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function b(e,n,t){this.low=e|0,this.high=n|0,this.unsigned=!!t}b.prototype.__isLong__;Object.defineProperty(b.prototype,"__isLong__",{value:!0});function M(e){return(e&&e.__isLong__)===!0}b.isLong=M;var ki={},Ci={};function Xe(e,n){var t,o,r;return n?(e>>>=0,(r=0<=e&&e<256)&&(o=Ci[e],o)?o:(t=E(e,(e|0)<0?-1:0,!0),r&&(Ci[e]=t),t)):(e|=0,(r=-128<=e&&e<128)&&(o=ki[e],o)?o:(t=E(e,e<0?-1:0,!1),r&&(ki[e]=t),t))}b.fromInt=Xe;function X(e,n){if(isNaN(e))return n?ze:Q;if(n){if(e<0)return ze;if(e>=Ri)return xi}else{if(e<=-_i)return L;if(e+1>=_i)return wi}return e<0?X(-e,n).neg():E(e%on|0,e/on|0,n)}b.fromNumber=X;function E(e,n,t){return new b(e,n,t)}b.fromBits=E;var In=Math.pow;function Qn(e,n,t){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return Q;if(typeof n=="number"?(t=n,n=!1):n=!!n,t=t||10,t<2||36<t)throw RangeError("radix");var o;if((o=e.indexOf("-"))>0)throw Error("interior hyphen");if(o===0)return Qn(e.substring(1),n,t).neg();for(var r=X(In(t,8)),i=Q,a=0;a<e.length;a+=8){var f=Math.min(8,e.length-a),s=parseInt(e.substring(a,a+f),t);if(f<8){var u=X(In(t,f));i=i.mul(u).add(X(s))}else i=i.mul(r),i=i.add(X(s))}return i.unsigned=n,i}b.fromString=Qn;function ie(e,n){return typeof e=="number"?X(e,n):typeof e=="string"?Qn(e,n):E(e.low,e.high,typeof n=="boolean"?n:e.unsigned)}b.fromValue=ie;var Vi=65536,fo=1<<24,on=Vi*Vi,Ri=on*on,_i=Ri/2,Fi=Xe(fo),Q=Xe(0);b.ZERO=Q;var ze=Xe(0,!0);b.UZERO=ze;var rn=Xe(1);b.ONE=rn;var Pi=Xe(1,!0);b.UONE=Pi;var Xn=Xe(-1);b.NEG_ONE=Xn;var wi=E(-1,2147483647,!1);b.MAX_VALUE=wi;var xi=E(-1,-1,!0);b.MAX_UNSIGNED_VALUE=xi;var L=E(0,-2147483648,!1);b.MIN_VALUE=L;var d=b.prototype;d.toInt=function(){return this.unsigned?this.low>>>0:this.low};d.toNumber=function(){return this.unsigned?(this.high>>>0)*on+(this.low>>>0):this.high*on+(this.low>>>0)};d.toString=function(n){if(n=n||10,n<2||36<n)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(L)){var t=X(n),o=this.div(t),r=o.mul(t).sub(this);return o.toString(n)+r.toInt().toString(n)}else return"-"+this.neg().toString(n);for(var i=X(In(n,6),this.unsigned),a=this,f="";;){var s=a.div(i),u=a.sub(s.mul(i)).toInt()>>>0,c=u.toString(n);if(a=s,a.isZero())return c+f;for(;c.length<6;)c="0"+c;f=""+c+f}};d.getHighBits=function(){return this.high};d.getHighBitsUnsigned=function(){return this.high>>>0};d.getLowBits=function(){return this.low};d.getLowBitsUnsigned=function(){return this.low>>>0};d.getNumBitsAbs=function(){if(this.isNegative())return this.eq(L)?64:this.neg().getNumBitsAbs();for(var n=this.high!=0?this.high:this.low,t=31;t>0&&!(n&1<<t);t--);return this.high!=0?t+33:t+1};d.isZero=function(){return this.high===0&&this.low===0};d.eqz=d.isZero;d.isNegative=function(){return!this.unsigned&&this.high<0};d.isPositive=function(){return this.unsigned||this.high>=0};d.isOdd=function(){return(this.low&1)===1};d.isEven=function(){return(this.low&1)===0};d.equals=function(n){return M(n)||(n=ie(n)),this.unsigned!==n.unsigned&&this.high>>>31===1&&n.high>>>31===1?!1:this.high===n.high&&this.low===n.low};d.eq=d.equals;d.notEquals=function(n){return!this.eq(n)};d.neq=d.notEquals;d.ne=d.notEquals;d.lessThan=function(n){return this.comp(n)<0};d.lt=d.lessThan;d.lessThanOrEqual=function(n){return this.comp(n)<=0};d.lte=d.lessThanOrEqual;d.le=d.lessThanOrEqual;d.greaterThan=function(n){return this.comp(n)>0};d.gt=d.greaterThan;d.greaterThanOrEqual=function(n){return this.comp(n)>=0};d.gte=d.greaterThanOrEqual;d.ge=d.greaterThanOrEqual;d.compare=function(n){if(M(n)||(n=ie(n)),this.eq(n))return 0;var t=this.isNegative(),o=n.isNegative();return t&&!o?-1:!t&&o?1:this.unsigned?n.high>>>0>this.high>>>0||n.high===this.high&&n.low>>>0>this.low>>>0?-1:1:this.sub(n).isNegative()?-1:1};d.comp=d.compare;d.negate=function(){return!this.unsigned&&this.eq(L)?L:this.not().add(rn)};d.neg=d.negate;d.add=function(n){M(n)||(n=ie(n));var t=this.high>>>16,o=this.high&65535,r=this.low>>>16,i=this.low&65535,a=n.high>>>16,f=n.high&65535,s=n.low>>>16,u=n.low&65535,c=0,N=0,y=0,U=0;return U+=i+u,y+=U>>>16,U&=65535,y+=r+s,N+=y>>>16,y&=65535,N+=o+f,c+=N>>>16,N&=65535,c+=t+a,c&=65535,E(y<<16|U,c<<16|N,this.unsigned)};d.subtract=function(n){return M(n)||(n=ie(n)),this.add(n.neg())};d.sub=d.subtract;d.multiply=function(n){if(this.isZero())return Q;if(M(n)||(n=ie(n)),z){var t=z.mul(this.low,this.high,n.low,n.high);return E(t,z.get_high(),this.unsigned)}if(n.isZero())return Q;if(this.eq(L))return n.isOdd()?L:Q;if(n.eq(L))return this.isOdd()?L:Q;if(this.isNegative())return n.isNegative()?this.neg().mul(n.neg()):this.neg().mul(n).neg();if(n.isNegative())return this.mul(n.neg()).neg();if(this.lt(Fi)&&n.lt(Fi))return X(this.toNumber()*n.toNumber(),this.unsigned);var o=this.high>>>16,r=this.high&65535,i=this.low>>>16,a=this.low&65535,f=n.high>>>16,s=n.high&65535,u=n.low>>>16,c=n.low&65535,N=0,y=0,U=0,Sn=0;return Sn+=a*c,U+=Sn>>>16,Sn&=65535,U+=i*c,y+=U>>>16,U&=65535,U+=a*u,y+=U>>>16,U&=65535,y+=r*c,N+=y>>>16,y&=65535,y+=i*u,N+=y>>>16,y&=65535,y+=a*s,N+=y>>>16,y&=65535,N+=o*c+r*u+i*s+a*f,N&=65535,E(U<<16|Sn,N<<16|y,this.unsigned)};d.mul=d.multiply;d.divide=function(n){if(M(n)||(n=ie(n)),n.isZero())throw Error("division by zero");if(z){if(!this.unsigned&&this.high===-2147483648&&n.low===-1&&n.high===-1)return this;var t=(this.unsigned?z.div_u:z.div_s)(this.low,this.high,n.low,n.high);return E(t,z.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?ze:Q;var o,r,i;if(this.unsigned){if(n.unsigned||(n=n.toUnsigned()),n.gt(this))return ze;if(n.gt(this.shru(1)))return Pi;i=ze}else{if(this.eq(L)){if(n.eq(rn)||n.eq(Xn))return L;if(n.eq(L))return rn;var a=this.shr(1);return o=a.div(n).shl(1),o.eq(Q)?n.isNegative()?rn:Xn:(r=this.sub(n.mul(o)),i=o.add(r.div(n)),i)}else if(n.eq(L))return this.unsigned?ze:Q;if(this.isNegative())return n.isNegative()?this.neg().div(n.neg()):this.neg().div(n).neg();if(n.isNegative())return this.div(n.neg()).neg();i=Q}for(r=this;r.gte(n);){o=Math.max(1,Math.floor(r.toNumber()/n.toNumber()));for(var f=Math.ceil(Math.log(o)/Math.LN2),s=f<=48?1:In(2,f-48),u=X(o),c=u.mul(n);c.isNegative()||c.gt(r);)o-=s,u=X(o,this.unsigned),c=u.mul(n);u.isZero()&&(u=rn),i=i.add(u),r=r.sub(c)}return i};d.div=d.divide;d.modulo=function(n){if(M(n)||(n=ie(n)),z){var t=(this.unsigned?z.rem_u:z.rem_s)(this.low,this.high,n.low,n.high);return E(t,z.get_high(),this.unsigned)}return this.sub(this.div(n).mul(n))};d.mod=d.modulo;d.rem=d.modulo;d.not=function(){return E(~this.low,~this.high,this.unsigned)};d.and=function(n){return M(n)||(n=ie(n)),E(this.low&n.low,this.high&n.high,this.unsigned)};d.or=function(n){return M(n)||(n=ie(n)),E(this.low|n.low,this.high|n.high,this.unsigned)};d.xor=function(n){return M(n)||(n=ie(n)),E(this.low^n.low,this.high^n.high,this.unsigned)};d.shiftLeft=function(n){return M(n)&&(n=n.toInt()),(n&=63)===0?this:n<32?E(this.low<<n,this.high<<n|this.low>>>32-n,this.unsigned):E(0,this.low<<n-32,this.unsigned)};d.shl=d.shiftLeft;d.shiftRight=function(n){return M(n)&&(n=n.toInt()),(n&=63)===0?this:n<32?E(this.low>>>n|this.high<<32-n,this.high>>n,this.unsigned):E(this.high>>n-32,this.high>=0?0:-1,this.unsigned)};d.shr=d.shiftRight;d.shiftRightUnsigned=function(n){if(M(n)&&(n=n.toInt()),n&=63,n===0)return this;var t=this.high;if(n<32){var o=this.low;return E(o>>>n|t<<32-n,t>>>n,this.unsigned)}else return n===32?E(t,0,this.unsigned):E(t>>>n-32,0,this.unsigned)};d.shru=d.shiftRightUnsigned;d.shr_u=d.shiftRightUnsigned;d.toSigned=function(){return this.unsigned?E(this.low,this.high,!1):this};d.toUnsigned=function(){return this.unsigned?this:E(this.low,this.high,!0)};d.toBytes=function(n){return n?this.toBytesLE():this.toBytesBE()};d.toBytesLE=function(){var n=this.high,t=this.low;return[t&255,t>>>8&255,t>>>16&255,t>>>24,n&255,n>>>8&255,n>>>16&255,n>>>24]};d.toBytesBE=function(){var n=this.high,t=this.low;return[n>>>24,n>>>16&255,n>>>8&255,n&255,t>>>24,t>>>16&255,t>>>8&255,t&255]};b.fromBytes=function(n,t,o){return o?b.fromBytesLE(n,t):b.fromBytesBE(n,t)};b.fromBytesLE=function(n,t){return new b(n[0]|n[1]<<8|n[2]<<16|n[3]<<24,n[4]|n[5]<<8|n[6]<<16|n[7]<<24,t)};b.fromBytesBE=function(n,t){return new b(n[4]<<24|n[5]<<16|n[6]<<8|n[7],n[0]<<24|n[1]<<16|n[2]<<8|n[3],t)}});var I=x(A(),1);var W=x(A(),1);var l=new Map;var Ke;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ke||(Ke={}));function zr(e){switch(e){case 0:case"NULL_VALUE":return Ke.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return Ke.UNRECOGNIZED}}function Xr(e){switch(e){case Ke.NULL_VALUE:return 0;case Ke.UNRECOGNIZED:default:return-1}}function $n(){return{fields:{}}}var _={$type:"google.protobuf.Struct",encode(e,n=W.default.Writer.create()){return Object.entries(e.fields).forEach(([t,o])=>{o!==void 0&&ln.encode({key:t,value:o},n.uint32(10).fork()).ldelim()}),n},decode(e,n){let t=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=$n();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;let a=ln.decode(t,t.uint32());a.value!==void 0&&(r.fields[a.key]=a.value);continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{fields:pi(e.fields)?Object.entries(e.fields).reduce((n,[t,o])=>(n[t]=o,n),{}):{}}},toJSON(e){let n={};if(e.fields){let t=Object.entries(e.fields);t.length>0&&(n.fields={},t.forEach(([o,r])=>{n.fields[o]=r}))}return n},create(e){return _.fromPartial(e??{})},fromPartial(e){let n=$n();return n.fields=Object.entries(e.fields??{}).reduce((t,[o,r])=>(r!==void 0&&(t[o]=r),t),{}),n},wrap(e){let n=$n();if(e!==void 0)for(let t of Object.keys(e))n.fields[t]=e[t];return n},unwrap(e){let n={};if(e.fields)for(let t of Object.keys(e.fields))n[t]=e.fields[t];return n}};l.set(_.$type,_);function ci(){return{key:"",value:void 0}}var ln={$type:"google.protobuf.Struct.FieldsEntry",encode(e,n=W.default.Writer.create()){return e.key!==""&&n.uint32(10).string(e.key),e.value!==void 0&&F.encode(F.wrap(e.value),n.uint32(18).fork()).ldelim(),n},decode(e,n){let t=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ci();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.key=t.string();continue;case 2:if(i!==18)break;r.value=F.unwrap(F.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{key:tn(e.key)?globalThis.String(e.key):"",value:tn(e?.value)?e.value:void 0}},toJSON(e){let n={};return e.key!==""&&(n.key=e.key),e.value!==void 0&&(n.value=e.value),n},create(e){return ln.fromPartial(e??{})},fromPartial(e){let n=ci();return n.key=e.key??"",n.value=e.value??void 0,n}};l.set(ln.$type,ln);function Gn(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var F={$type:"google.protobuf.Value",encode(e,n=W.default.Writer.create()){return e.nullValue!==void 0&&n.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&n.uint32(17).double(e.numberValue),e.stringValue!==void 0&&n.uint32(26).string(e.stringValue),e.boolValue!==void 0&&n.uint32(32).bool(e.boolValue),e.structValue!==void 0&&_.encode(_.wrap(e.structValue),n.uint32(42).fork()).ldelim(),e.listValue!==void 0&&He.encode(He.wrap(e.listValue),n.uint32(50).fork()).ldelim(),n},decode(e,n){let t=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Gn();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.nullValue=t.int32();continue;case 2:if(i!==17)break;r.numberValue=t.double();continue;case 3:if(i!==26)break;r.stringValue=t.string();continue;case 4:if(i!==32)break;r.boolValue=t.bool();continue;case 5:if(i!==42)break;r.structValue=_.unwrap(_.decode(t,t.uint32()));continue;case 6:if(i!==50)break;r.listValue=He.unwrap(He.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{nullValue:tn(e.nullValue)?zr(e.nullValue):void 0,numberValue:tn(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:tn(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:tn(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:pi(e.structValue)?e.structValue:void 0,listValue:globalThis.Array.isArray(e.listValue)?[...e.listValue]:void 0}},toJSON(e){let n={};return e.nullValue!==void 0&&(n.nullValue=Xr(e.nullValue)),e.numberValue!==void 0&&(n.numberValue=e.numberValue),e.stringValue!==void 0&&(n.stringValue=e.stringValue),e.boolValue!==void 0&&(n.boolValue=e.boolValue),e.structValue!==void 0&&(n.structValue=e.structValue),e.listValue!==void 0&&(n.listValue=e.listValue),n},create(e){return F.fromPartial(e??{})},fromPartial(e){let n=Gn();return n.nullValue=e.nullValue??void 0,n.numberValue=e.numberValue??void 0,n.stringValue=e.stringValue??void 0,n.boolValue=e.boolValue??void 0,n.structValue=e.structValue??void 0,n.listValue=e.listValue??void 0,n},wrap(e){let n=Gn();if(e===null)n.nullValue=Ke.NULL_VALUE;else if(typeof e=="boolean")n.boolValue=e;else if(typeof e=="number")n.numberValue=e;else if(typeof e=="string")n.stringValue=e;else if(globalThis.Array.isArray(e))n.listValue=e;else if(typeof e=="object")n.structValue=e;else if(typeof e<"u")throw new globalThis.Error("Unsupported any value type: "+typeof e);return n},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};l.set(F.$type,F);function qn(){return{values:[]}}var He={$type:"google.protobuf.ListValue",encode(e,n=W.default.Writer.create()){for(let t of e.values)F.encode(F.wrap(t),n.uint32(10).fork()).ldelim();return n},decode(e,n){let t=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=qn();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.values.push(F.unwrap(F.decode(t,t.uint32())));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?[...e.values]:[]}},toJSON(e){let n={};return e.values?.length&&(n.values=e.values),n},create(e){return He.fromPartial(e??{})},fromPartial(e){let n=qn();return n.values=e.values?.map(t=>t)||[],n},wrap(e){let n=qn();return n.values=e??[],n},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};l.set(He.$type,He);function pi(e){return typeof e=="object"&&e!==null}function tn(e){return e!=null}var K;(function(e){e[e.CLIENT_UNSPECIFIED=0]="CLIENT_UNSPECIFIED",e[e.ANDROID=1]="ANDROID",e[e.IOS=2]="IOS",e[e.SHREDDIT=3]="SHREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(K||(K={}));function Qr(e){switch(e){case 0:case"CLIENT_UNSPECIFIED":return K.CLIENT_UNSPECIFIED;case 1:case"ANDROID":return K.ANDROID;case 2:case"IOS":return K.IOS;case 3:case"SHREDDIT":return K.SHREDDIT;case-1:case"UNRECOGNIZED":default:return K.UNRECOGNIZED}}function Yr(e){switch(e){case K.CLIENT_UNSPECIFIED:return 0;case K.ANDROID:return 1;case K.IOS:return 2;case K.SHREDDIT:return 3;case K.UNRECOGNIZED:default:return-1}}function hi(){return{postData:void 0,shareParam:void 0,webViewContext:void 0,webbitToken:"",devvitDebug:"",client:0,nativeVersion:void 0,shredditVersion:void 0}}var Zn={$type:"devvit.ui.effects.web_view.v1alpha.BridgeContext",encode(e,n=I.default.Writer.create()){return e.postData!==void 0&&ae.encode(e.postData,n.uint32(10).fork()).ldelim(),e.shareParam!==void 0&&Ee.encode(e.shareParam,n.uint32(18).fork()).ldelim(),e.webViewContext!==void 0&&oe.encode(e.webViewContext,n.uint32(26).fork()).ldelim(),e.webbitToken!==""&&n.uint32(34).string(e.webbitToken),e.devvitDebug!==""&&n.uint32(42).string(e.devvitDebug),e.client!==0&&n.uint32(48).int32(e.client),e.nativeVersion!==void 0&&ve.encode(e.nativeVersion,n.uint32(58).fork()).ldelim(),e.shredditVersion!==void 0&&be.encode(e.shredditVersion,n.uint32(66).fork()).ldelim(),n},decode(e,n){let t=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=hi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.postData=ae.decode(t,t.uint32());continue;case 2:if(i!==18)break;r.shareParam=Ee.decode(t,t.uint32());continue;case 3:if(i!==26)break;r.webViewContext=oe.decode(t,t.uint32());continue;case 4:if(i!==34)break;r.webbitToken=t.string();continue;case 5:if(i!==42)break;r.devvitDebug=t.string();continue;case 6:if(i!==48)break;r.client=t.int32();continue;case 7:if(i!==58)break;r.nativeVersion=ve.decode(t,t.uint32());continue;case 8:if(i!==66)break;r.shredditVersion=be.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{postData:v(e.postData)?ae.fromJSON(e.postData):void 0,shareParam:v(e.shareParam)?Ee.fromJSON(e.shareParam):void 0,webViewContext:v(e.webViewContext)?oe.fromJSON(e.webViewContext):void 0,webbitToken:v(e.webbitToken)?globalThis.String(e.webbitToken):"",devvitDebug:v(e.devvitDebug)?globalThis.String(e.devvitDebug):"",client:v(e.client)?Qr(e.client):0,nativeVersion:v(e.nativeVersion)?ve.fromJSON(e.nativeVersion):void 0,shredditVersion:v(e.shredditVersion)?be.fromJSON(e.shredditVersion):void 0}},toJSON(e){let n={};return e.postData!==void 0&&(n.postData=ae.toJSON(e.postData)),e.shareParam!==void 0&&(n.shareParam=Ee.toJSON(e.shareParam)),e.webViewContext!==void 0&&(n.webViewContext=oe.toJSON(e.webViewContext)),e.webbitToken!==""&&(n.webbitToken=e.webbitToken),e.devvitDebug!==""&&(n.devvitDebug=e.devvitDebug),e.client!==0&&(n.client=Yr(e.client)),e.nativeVersion!==void 0&&(n.nativeVersion=ve.toJSON(e.nativeVersion)),e.shredditVersion!==void 0&&(n.shredditVersion=be.toJSON(e.shredditVersion)),n},create(e){return Zn.fromPartial(e??{})},fromPartial(e){let n=hi();return n.postData=e.postData!==void 0&&e.postData!==null?ae.fromPartial(e.postData):void 0,n.shareParam=e.shareParam!==void 0&&e.shareParam!==null?Ee.fromPartial(e.shareParam):void 0,n.webViewContext=e.webViewContext!==void 0&&e.webViewContext!==null?oe.fromPartial(e.webViewContext):void 0,n.webbitToken=e.webbitToken??"",n.devvitDebug=e.devvitDebug??"",n.client=e.client??0,n.nativeVersion=e.nativeVersion!==void 0&&e.nativeVersion!==null?ve.fromPartial(e.nativeVersion):void 0,n.shredditVersion=e.shredditVersion!==void 0&&e.shredditVersion!==null?be.fromPartial(e.shredditVersion):void 0,n}};l.set(Zn.$type,Zn);function mi(){return{yyyy:0,release:0,attempt:0,number:0}}var ve={$type:"devvit.ui.effects.web_view.v1alpha.NativeClientVersion",encode(e,n=I.default.Writer.create()){return e.yyyy!==0&&n.uint32(8).int32(e.yyyy),e.release!==0&&n.uint32(16).int32(e.release),e.attempt!==0&&n.uint32(24).int32(e.attempt),e.number!==0&&n.uint32(32).int32(e.number),n},decode(e,n){let t=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=mi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.yyyy=t.int32();continue;case 2:if(i!==16)break;r.release=t.int32();continue;case 3:if(i!==24)break;r.attempt=t.int32();continue;case 4:if(i!==32)break;r.number=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{yyyy:v(e.yyyy)?globalThis.Number(e.yyyy):0,release:v(e.release)?globalThis.Number(e.release):0,attempt:v(e.attempt)?globalThis.Number(e.attempt):0,number:v(e.number)?globalThis.Number(e.number):0}},toJSON(e){let n={};return e.yyyy!==0&&(n.yyyy=Math.round(e.yyyy)),e.release!==0&&(n.release=Math.round(e.release)),e.attempt!==0&&(n.attempt=Math.round(e.attempt)),e.number!==0&&(n.number=Math.round(e.number)),n},create(e){return ve.fromPartial(e??{})},fromPartial(e){let n=mi();return n.yyyy=e.yyyy??0,n.release=e.release??0,n.attempt=e.attempt??0,n.number=e.number??0,n}};l.set(ve.$type,ve);function gi(){return{major:0,minor:0,patch:0,version:""}}var be={$type:"devvit.ui.effects.web_view.v1alpha.SemVer",encode(e,n=I.default.Writer.create()){return e.major!==0&&n.uint32(8).int32(e.major),e.minor!==0&&n.uint32(16).int32(e.minor),e.patch!==0&&n.uint32(24).int32(e.patch),e.version!==""&&n.uint32(34).string(e.version),n},decode(e,n){let t=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=gi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.major=t.int32();continue;case 2:if(i!==16)break;r.minor=t.int32();continue;case 3:if(i!==24)break;r.patch=t.int32();continue;case 4:if(i!==34)break;r.version=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{major:v(e.major)?globalThis.Number(e.major):0,minor:v(e.minor)?globalThis.Number(e.minor):0,patch:v(e.patch)?globalThis.Number(e.patch):0,version:v(e.version)?globalThis.String(e.version):""}},toJSON(e){let n={};return e.major!==0&&(n.major=Math.round(e.major)),e.minor!==0&&(n.minor=Math.round(e.minor)),e.patch!==0&&(n.patch=Math.round(e.patch)),e.version!==""&&(n.version=e.version),n},create(e){return be.fromPartial(e??{})},fromPartial(e){let n=gi();return n.major=e.major??0,n.minor=e.minor??0,n.patch=e.patch??0,n.version=e.version??"",n}};l.set(be.$type,be);function Si(){return{subredditId:"",subredditName:"",userId:"",appName:"",appVersion:"",postId:""}}var oe={$type:"devvit.ui.effects.web_view.v1alpha.WebViewContext",encode(e,n=I.default.Writer.create()){return e.subredditId!==""&&n.uint32(10).string(e.subredditId),e.subredditName!==""&&n.uint32(18).string(e.subredditName),e.userId!==""&&n.uint32(26).string(e.userId),e.appName!==""&&n.uint32(34).string(e.appName),e.appVersion!==""&&n.uint32(42).string(e.appVersion),e.postId!==""&&n.uint32(50).string(e.postId),n},decode(e,n){let t=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Si();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.subredditId=t.string();continue;case 2:if(i!==18)break;r.subredditName=t.string();continue;case 3:if(i!==26)break;r.userId=t.string();continue;case 4:if(i!==34)break;r.appName=t.string();continue;case 5:if(i!==42)break;r.appVersion=t.string();continue;case 6:if(i!==50)break;r.postId=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{subredditId:v(e.subredditId)?globalThis.String(e.subredditId):"",subredditName:v(e.subredditName)?globalThis.String(e.subredditName):"",userId:v(e.userId)?globalThis.String(e.userId):"",appName:v(e.appName)?globalThis.String(e.appName):"",appVersion:v(e.appVersion)?globalThis.String(e.appVersion):"",postId:v(e.postId)?globalThis.String(e.postId):""}},toJSON(e){let n={};return e.subredditId!==""&&(n.subredditId=e.subredditId),e.subredditName!==""&&(n.subredditName=e.subredditName),e.userId!==""&&(n.userId=e.userId),e.appName!==""&&(n.appName=e.appName),e.appVersion!==""&&(n.appVersion=e.appVersion),e.postId!==""&&(n.postId=e.postId),n},create(e){return oe.fromPartial(e??{})},fromPartial(e){let n=Si();return n.subredditId=e.subredditId??"",n.subredditName=e.subredditName??"",n.userId=e.userId??"",n.appName=e.appName??"",n.appVersion=e.appVersion??"",n.postId=e.postId??"",n}};l.set(oe.$type,oe);function yi(){return{developerData:void 0}}var ae={$type:"devvit.ui.effects.web_view.v1alpha.DevvitPostData",encode(e,n=I.default.Writer.create()){return e.developerData!==void 0&&_.encode(_.wrap(e.developerData),n.uint32(18).fork()).ldelim(),n},decode(e,n){let t=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=yi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 2:if(i!==18)break;r.developerData=_.unwrap(_.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{developerData:Ei(e.developerData)?e.developerData:void 0}},toJSON(e){let n={};return e.developerData!==void 0&&(n.developerData=e.developerData),n},create(e){return ae.fromPartial(e??{})},fromPartial(e){let n=yi();return n.developerData=e.developerData??void 0,n}};l.set(ae.$type,ae);function vi(){return{path:"",params:{},hash:""}}var Ee={$type:"devvit.ui.effects.web_view.v1alpha.ShareParam",encode(e,n=I.default.Writer.create()){return e.path!==""&&n.uint32(10).string(e.path),Object.entries(e.params).forEach(([t,o])=>{cn.encode({key:t,value:o},n.uint32(18).fork()).ldelim()}),e.hash!==""&&n.uint32(26).string(e.hash),n},decode(e,n){let t=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=vi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.path=t.string();continue;case 2:if(i!==18)break;let a=cn.decode(t,t.uint32());a.value!==void 0&&(r.params[a.key]=a.value);continue;case 3:if(i!==26)break;r.hash=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{path:v(e.path)?globalThis.String(e.path):"",params:Ei(e.params)?Object.entries(e.params).reduce((n,[t,o])=>(n[t]=String(o),n),{}):{},hash:v(e.hash)?globalThis.String(e.hash):""}},toJSON(e){let n={};if(e.path!==""&&(n.path=e.path),e.params){let t=Object.entries(e.params);t.length>0&&(n.params={},t.forEach(([o,r])=>{n.params[o]=r}))}return e.hash!==""&&(n.hash=e.hash),n},create(e){return Ee.fromPartial(e??{})},fromPartial(e){let n=vi();return n.path=e.path??"",n.params=Object.entries(e.params??{}).reduce((t,[o,r])=>(r!==void 0&&(t[o]=globalThis.String(r)),t),{}),n.hash=e.hash??"",n}};l.set(Ee.$type,Ee);function bi(){return{key:"",value:""}}var cn={$type:"devvit.ui.effects.web_view.v1alpha.ShareParam.ParamsEntry",encode(e,n=I.default.Writer.create()){return e.key!==""&&n.uint32(10).string(e.key),e.value!==""&&n.uint32(18).string(e.value),n},decode(e,n){let t=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=bi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.key=t.string();continue;case 2:if(i!==18)break;r.value=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{key:v(e.key)?globalThis.String(e.key):"",value:v(e.value)?globalThis.String(e.value):""}},toJSON(e){let n={};return e.key!==""&&(n.key=e.key),e.value!==""&&(n.value=e.value),n},create(e){return cn.fromPartial(e??{})},fromPartial(e){let n=bi();return n.key=e.key??"",n.value=e.value??"",n}};l.set(cn.$type,cn);function Ei(e){return typeof e=="object"&&e!==null}function v(e){return e!=null}function Nn(e,n){if(!e)throw Error(n)}var Ne;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(Ne||(Ne={}));function jr(e){return e.startsWith(Ne.ACCOUNT)}function eo(e){return e.startsWith(Ne.LINK)}function no(e){return e.startsWith(Ne.SUBREDDIT)}function to(e){Nn(jr(e),`Expected account id to start with ${Ne.ACCOUNT}, got ${e}}`)}function io(e){Nn(eo(e),`Expected link id to start with ${Ne.LINK}, got ${e}}`)}function ro(e){Nn(no(e),`Expected subreddit id to start with ${Ne.SUBREDDIT}, got ${e}}`)}function Ni(e){return to(e),e}function Ti(e){return io(e),e}function Ii(e){return ro(e),e}var oo=({search:e,hash:n})=>{let t=new URLSearchParams(e).get("context");if(t){let o=decodeURIComponent(t),r=oe.fromJSON(JSON.parse(o)),i=ao(n),a={subredditId:Ii(r.subredditId),userId:Ni(r.userId),subredditName:r.subredditName,appName:r.appName,appVersion:r.appVersion,postId:Ti(r.postId),postData:i?.developerData};globalThis.devvit={context:a}}};globalThis.location&&oo(globalThis.location);function ao(e){let n=e?.slice(1);if(n)try{return ae.fromJSON(JSON.parse(decodeURIComponent(n)))}catch(t){console.error("Error parsing post data from hash",t);return}}var so=new Proxy({},{get:(e,n)=>globalThis.devvit.context[n],ownKeys(){return Object.keys(globalThis.devvit.context)},getOwnPropertyDescriptor(e,n){return{enumerable:!0,configurable:!0,value:globalThis.devvit.context[n]}}});var Tn=x(A(),1);var se;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.INLINE_MODE=1]="INLINE_MODE",e[e.IMMERSIVE_MODE=2]="IMMERSIVE_MODE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(se||(se={}));function Kn(e){switch(e){case 0:case"UNSPECIFIED":return se.UNSPECIFIED;case 1:case"INLINE_MODE":return se.INLINE_MODE;case 2:case"IMMERSIVE_MODE":return se.IMMERSIVE_MODE;case-1:case"UNRECOGNIZED":default:return se.UNRECOGNIZED}}function zn(e){switch(e){case se.UNSPECIFIED:return 0;case se.INLINE_MODE:return 1;case se.IMMERSIVE_MODE:return 2;case se.UNRECOGNIZED:default:return-1}}function Oi(){return{immersiveMode:0}}var Hn={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,n=Tn.default.Writer.create()){return e.immersiveMode!==0&&n.uint32(8).int32(e.immersiveMode),n},decode(e,n){let t=e instanceof Tn.default.Reader?e:Tn.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Oi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.immersiveMode=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{immersiveMode:uo(e.immersiveMode)?Kn(e.immersiveMode):0}},toJSON(e){let n={};return e.immersiveMode!==0&&(n.immersiveMode=zn(e.immersiveMode)),n},create(e){return Hn.fromPartial(e??{})},fromPartial(e){let n=Oi();return n.immersiveMode=e.immersiveMode??0,n}};l.set(Hn.$type,Hn);function uo(e){return e!=null}var w=x(A(),1);var P=x(A(),1);var S=x(A(),1);var Yn=x(Di(),1),Qe=x(A(),1);function Bi(){return{seconds:0,nanos:0}}var Ye={$type:"google.protobuf.Timestamp",encode(e,n=Qe.default.Writer.create()){return e.seconds!==0&&n.uint32(8).int64(e.seconds),e.nanos!==0&&n.uint32(16).int32(e.nanos),n},decode(e,n){let t=e instanceof Qe.default.Reader?e:Qe.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Bi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.seconds=lo(t.int64());continue;case 2:if(i!==16)break;r.nanos=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{seconds:Li(e.seconds)?globalThis.Number(e.seconds):0,nanos:Li(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let n={};return e.seconds!==0&&(n.seconds=Math.round(e.seconds)),e.nanos!==0&&(n.nanos=Math.round(e.nanos)),n},create(e){return Ye.fromPartial(e??{})},fromPartial(e){let n=Bi();return n.seconds=e.seconds??0,n.nanos=e.nanos??0,n}};l.set(Ye.$type,Ye);function lo(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}Qe.default.util.Long!==Yn.default&&(Qe.default.util.Long=Yn.default,Qe.default.configure());function Li(e){return e!=null}var ue;(function(e){e[e.CONSENT_STATUS_UNKNOWN=0]="CONSENT_STATUS_UNKNOWN",e[e.REVOKED=1]="REVOKED",e[e.GRANTED=2]="GRANTED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ue||(ue={}));function ot(e){switch(e){case 0:case"CONSENT_STATUS_UNKNOWN":return ue.CONSENT_STATUS_UNKNOWN;case 1:case"REVOKED":return ue.REVOKED;case 2:case"GRANTED":return ue.GRANTED;case-1:case"UNRECOGNIZED":default:return ue.UNRECOGNIZED}}function at(e){switch(e){case ue.CONSENT_STATUS_UNKNOWN:return 0;case ue.REVOKED:return 1;case ue.GRANTED:return 2;case ue.UNRECOGNIZED:default:return-1}}var Y;(function(e){e[e.SCOPE_UNKNOWN=0]="SCOPE_UNKNOWN",e[e.SUBMIT_POST=1]="SUBMIT_POST",e[e.SUBMIT_COMMENT=2]="SUBMIT_COMMENT",e[e.SUBSCRIBE_TO_SUBREDDIT=3]="SUBSCRIBE_TO_SUBREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Y||(Y={}));function On(e){switch(e){case 0:case"SCOPE_UNKNOWN":return Y.SCOPE_UNKNOWN;case 1:case"SUBMIT_POST":return Y.SUBMIT_POST;case 2:case"SUBMIT_COMMENT":return Y.SUBMIT_COMMENT;case 3:case"SUBSCRIBE_TO_SUBREDDIT":return Y.SUBSCRIBE_TO_SUBREDDIT;case-1:case"UNRECOGNIZED":default:return Y.UNRECOGNIZED}}function kn(e){switch(e){case Y.SCOPE_UNKNOWN:return 0;case Y.SUBMIT_POST:return 1;case Y.SUBMIT_COMMENT:return 2;case Y.SUBSCRIBE_TO_SUBREDDIT:return 3;case Y.UNRECOGNIZED:default:return-1}}function Mi(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}var Te={$type:"reddit.devvit.app_permission.v1.AppPermission",encode(e,n=S.default.Writer.create()){e.appSlug!==""&&n.uint32(10).string(e.appSlug),e.subredditId!==""&&n.uint32(18).string(e.subredditId),n.uint32(26).fork();for(let t of e.scopes)n.int32(t);return n.ldelim(),e.consentStatus!==0&&n.uint32(32).int32(e.consentStatus),e.updatedAt!==void 0&&Ye.encode(co(e.updatedAt),n.uint32(42).fork()).ldelim(),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Mi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=t.string();continue;case 2:if(i!==18)break;r.subredditId=t.string();continue;case 3:if(i===24){r.scopes.push(t.int32());continue}if(i===26){let a=t.uint32()+t.pos;for(;t.pos<a;)r.scopes.push(t.int32());continue}break;case 4:if(i!==32)break;r.consentStatus=t.int32();continue;case 5:if(i!==42)break;r.updatedAt=Ki(Ye.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{appSlug:R(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:R(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(n=>On(n)):[],consentStatus:R(e.consentStatus)?ot(e.consentStatus):0,updatedAt:R(e.updatedAt)?po(e.updatedAt):void 0}},toJSON(e){let n={};return e.appSlug!==""&&(n.appSlug=e.appSlug),e.subredditId!==""&&(n.subredditId=e.subredditId),e.scopes?.length&&(n.scopes=e.scopes.map(t=>kn(t))),e.consentStatus!==0&&(n.consentStatus=at(e.consentStatus)),e.updatedAt!==void 0&&(n.updatedAt=e.updatedAt.toISOString()),n},create(e){return Te.fromPartial(e??{})},fromPartial(e){let n=Mi();return n.appSlug=e.appSlug??"",n.subredditId=e.subredditId??"",n.scopes=e.scopes?.map(t=>t)||[],n.consentStatus=e.consentStatus??0,n.updatedAt=e.updatedAt??void 0,n}};l.set(Te.$type,Te);function Ji(){return{appSlug:"",appName:""}}var Ie={$type:"reddit.devvit.app_permission.v1.DevvitApp",encode(e,n=S.default.Writer.create()){return e.appSlug!==""&&n.uint32(10).string(e.appSlug),e.appName!==""&&n.uint32(18).string(e.appName),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Ji();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=t.string();continue;case 2:if(i!==18)break;r.appName=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{appSlug:R(e.appSlug)?globalThis.String(e.appSlug):"",appName:R(e.appName)?globalThis.String(e.appName):""}},toJSON(e){let n={};return e.appSlug!==""&&(n.appSlug=e.appSlug),e.appName!==""&&(n.appName=e.appName),n},create(e){return Ie.fromPartial(e??{})},fromPartial(e){let n=Ji();return n.appSlug=e.appSlug??"",n.appName=e.appName??"",n}};l.set(Ie.$type,Ie);function Ui(){return{userId:""}}var jn={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdRequest",encode(e,n=S.default.Writer.create()){return e.userId!==""&&n.uint32(10).string(e.userId),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Ui();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.userId=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{userId:R(e.userId)?globalThis.String(e.userId):""}},toJSON(e){let n={};return e.userId!==""&&(n.userId=e.userId),n},create(e){return jn.fromPartial(e??{})},fromPartial(e){let n=Ui();return n.userId=e.userId??"",n}};l.set(jn.$type,jn);function Wi(){return{appPermissions:[],devvitApps:[]}}var et={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,n=S.default.Writer.create()){for(let t of e.appPermissions)Te.encode(t,n.uint32(10).fork()).ldelim();for(let t of e.devvitApps)Ie.encode(t,n.uint32(18).fork()).ldelim();return n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Wi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appPermissions.push(Te.decode(t,t.uint32()));continue;case 2:if(i!==18)break;r.devvitApps.push(Ie.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{appPermissions:globalThis.Array.isArray(e?.appPermissions)?e.appPermissions.map(n=>Te.fromJSON(n)):[],devvitApps:globalThis.Array.isArray(e?.devvitApps)?e.devvitApps.map(n=>Ie.fromJSON(n)):[]}},toJSON(e){let n={};return e.appPermissions?.length&&(n.appPermissions=e.appPermissions.map(t=>Te.toJSON(t))),e.devvitApps?.length&&(n.devvitApps=e.devvitApps.map(t=>Ie.toJSON(t))),n},create(e){return et.fromPartial(e??{})},fromPartial(e){let n=Wi();return n.appPermissions=e.appPermissions?.map(t=>Te.fromPartial(t))||[],n.devvitApps=e.devvitApps?.map(t=>Ie.fromPartial(t))||[],n}};l.set(et.$type,et);function $i(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}var nt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionRequest",encode(e,n=S.default.Writer.create()){e.userId!==""&&n.uint32(10).string(e.userId),e.appSlug!==""&&n.uint32(18).string(e.appSlug),e.subredditId!==""&&n.uint32(26).string(e.subredditId),n.uint32(34).fork();for(let t of e.scopes)n.int32(t);return n.ldelim(),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=$i();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.userId=t.string();continue;case 2:if(i!==18)break;r.appSlug=t.string();continue;case 3:if(i!==26)break;r.subredditId=t.string();continue;case 4:if(i===32){r.scopes.push(t.int32());continue}if(i===34){let a=t.uint32()+t.pos;for(;t.pos<a;)r.scopes.push(t.int32());continue}break}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{userId:R(e.userId)?globalThis.String(e.userId):"",appSlug:R(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:R(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(n=>On(n)):[]}},toJSON(e){let n={};return e.userId!==""&&(n.userId=e.userId),e.appSlug!==""&&(n.appSlug=e.appSlug),e.subredditId!==""&&(n.subredditId=e.subredditId),e.scopes?.length&&(n.scopes=e.scopes.map(t=>kn(t))),n},create(e){return nt.fromPartial(e??{})},fromPartial(e){let n=$i();return n.userId=e.userId??"",n.appSlug=e.appSlug??"",n.subredditId=e.subredditId??"",n.scopes=e.scopes?.map(t=>t)||[],n}};l.set(nt.$type,nt);function Gi(){return{error:void 0}}var tt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode(e,n=S.default.Writer.create()){return e.error!==void 0&&$.encode(e.error,n.uint32(10).fork()).ldelim(),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Gi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.error=$.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{error:R(e.error)?$.fromJSON(e.error):void 0}},toJSON(e){let n={};return e.error!==void 0&&(n.error=$.toJSON(e.error)),n},create(e){return tt.fromPartial(e??{})},fromPartial(e){let n=Gi();return n.error=e.error!==void 0&&e.error!==null?$.fromPartial(e.error):void 0,n}};l.set(tt.$type,tt);function qi(){return{appSlug:"",userId:"",subredditId:""}}var it={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionRequest",encode(e,n=S.default.Writer.create()){return e.appSlug!==""&&n.uint32(10).string(e.appSlug),e.userId!==""&&n.uint32(18).string(e.userId),e.subredditId!==""&&n.uint32(26).string(e.subredditId),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=qi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=t.string();continue;case 2:if(i!==18)break;r.userId=t.string();continue;case 3:if(i!==26)break;r.subredditId=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{appSlug:R(e.appSlug)?globalThis.String(e.appSlug):"",userId:R(e.userId)?globalThis.String(e.userId):"",subredditId:R(e.subredditId)?globalThis.String(e.subredditId):""}},toJSON(e){let n={};return e.appSlug!==""&&(n.appSlug=e.appSlug),e.userId!==""&&(n.userId=e.userId),e.subredditId!==""&&(n.subredditId=e.subredditId),n},create(e){return it.fromPartial(e??{})},fromPartial(e){let n=qi();return n.appSlug=e.appSlug??"",n.userId=e.userId??"",n.subredditId=e.subredditId??"",n}};l.set(it.$type,it);function Zi(){return{error:void 0}}var rt={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode(e,n=S.default.Writer.create()){return e.error!==void 0&&$.encode(e.error,n.uint32(10).fork()).ldelim(),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Zi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.error=$.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{error:R(e.error)?$.fromJSON(e.error):void 0}},toJSON(e){let n={};return e.error!==void 0&&(n.error=$.toJSON(e.error)),n},create(e){return rt.fromPartial(e??{})},fromPartial(e){let n=Zi();return n.error=e.error!==void 0&&e.error!==null?$.fromPartial(e.error):void 0,n}};l.set(rt.$type,rt);function Hi(){return{message:""}}var $={$type:"reddit.devvit.app_permission.v1.ErrorMessage",encode(e,n=S.default.Writer.create()){return e.message!==""&&n.uint32(10).string(e.message),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Hi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.message=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{message:R(e.message)?globalThis.String(e.message):""}},toJSON(e){let n={};return e.message!==""&&(n.message=e.message),n},create(e){return $.fromPartial(e??{})},fromPartial(e){let n=Hi();return n.message=e.message??"",n}};l.set($.$type,$);function co(e){let n=Math.trunc(e.getTime()/1e3),t=e.getTime()%1e3*1e6;return{seconds:n,nanos:t}}function Ki(e){let n=(e.seconds||0)*1e3;return n+=(e.nanos||0)/1e6,new globalThis.Date(n)}function po(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):Ki(Ye.fromJSON(e))}function R(e){return e!=null}function zi(){return{app:void 0,scopes:[],subreddit:void 0,redditor:void 0}}var st={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect",encode(e,n=P.default.Writer.create()){e.app!==void 0&&ke.encode(e.app,n.uint32(10).fork()).ldelim(),n.uint32(18).fork();for(let t of e.scopes)n.int32(t);return n.ldelim(),e.subreddit!==void 0&&Ce.encode(e.subreddit,n.uint32(26).fork()).ldelim(),e.redditor!==void 0&&Oe.encode(e.redditor,n.uint32(34).fork()).ldelim(),n},decode(e,n){let t=e instanceof P.default.Reader?e:P.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=zi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.app=ke.decode(t,t.uint32());continue;case 2:if(i===16){r.scopes.push(t.int32());continue}if(i===18){let a=t.uint32()+t.pos;for(;t.pos<a;)r.scopes.push(t.int32());continue}break;case 3:if(i!==26)break;r.subreddit=Ce.decode(t,t.uint32());continue;case 4:if(i!==34)break;r.redditor=Oe.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{app:D(e.app)?ke.fromJSON(e.app):void 0,scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(n=>On(n)):[],subreddit:D(e.subreddit)?Ce.fromJSON(e.subreddit):void 0,redditor:D(e.redditor)?Oe.fromJSON(e.redditor):void 0}},toJSON(e){let n={};return e.app!==void 0&&(n.app=ke.toJSON(e.app)),e.scopes?.length&&(n.scopes=e.scopes.map(t=>kn(t))),e.subreddit!==void 0&&(n.subreddit=Ce.toJSON(e.subreddit)),e.redditor!==void 0&&(n.redditor=Oe.toJSON(e.redditor)),n},create(e){return st.fromPartial(e??{})},fromPartial(e){let n=zi();return n.app=e.app!==void 0&&e.app!==null?ke.fromPartial(e.app):void 0,n.scopes=e.scopes?.map(t=>t)||[],n.subreddit=e.subreddit!==void 0&&e.subreddit!==null?Ce.fromPartial(e.subreddit):void 0,n.redditor=e.redditor!==void 0&&e.redditor!==null?Oe.fromPartial(e.redditor):void 0,n}};l.set(st.$type,st);function Xi(){return{id:"",icon:void 0,snoovatarIcon:void 0}}var Oe={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect.Redditor",encode(e,n=P.default.Writer.create()){return e.id!==""&&n.uint32(10).string(e.id),e.icon!==void 0&&n.uint32(18).string(e.icon),e.snoovatarIcon!==void 0&&n.uint32(26).string(e.snoovatarIcon),n},decode(e,n){let t=e instanceof P.default.Reader?e:P.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Xi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.id=t.string();continue;case 2:if(i!==18)break;r.icon=t.string();continue;case 3:if(i!==26)break;r.snoovatarIcon=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{id:D(e.id)?globalThis.String(e.id):"",icon:D(e.icon)?globalThis.String(e.icon):void 0,snoovatarIcon:D(e.snoovatarIcon)?globalThis.String(e.snoovatarIcon):void 0}},toJSON(e){let n={};return e.id!==""&&(n.id=e.id),e.icon!==void 0&&(n.icon=e.icon),e.snoovatarIcon!==void 0&&(n.snoovatarIcon=e.snoovatarIcon),n},create(e){return Oe.fromPartial(e??{})},fromPartial(e){let n=Xi();return n.id=e.id??"",n.icon=e.icon??void 0,n.snoovatarIcon=e.snoovatarIcon??void 0,n}};l.set(Oe.$type,Oe);function Qi(){return{appSlug:"",appName:"",termsAndConditionsUrl:void 0,privacyPolicyUrl:void 0}}var ke={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect.DevvitApp",encode(e,n=P.default.Writer.create()){return e.appSlug!==""&&n.uint32(10).string(e.appSlug),e.appName!==""&&n.uint32(18).string(e.appName),e.termsAndConditionsUrl!==void 0&&n.uint32(26).string(e.termsAndConditionsUrl),e.privacyPolicyUrl!==void 0&&n.uint32(34).string(e.privacyPolicyUrl),n},decode(e,n){let t=e instanceof P.default.Reader?e:P.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Qi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=t.string();continue;case 2:if(i!==18)break;r.appName=t.string();continue;case 3:if(i!==26)break;r.termsAndConditionsUrl=t.string();continue;case 4:if(i!==34)break;r.privacyPolicyUrl=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{appSlug:D(e.appSlug)?globalThis.String(e.appSlug):"",appName:D(e.appName)?globalThis.String(e.appName):"",termsAndConditionsUrl:D(e.termsAndConditionsUrl)?globalThis.String(e.termsAndConditionsUrl):void 0,privacyPolicyUrl:D(e.privacyPolicyUrl)?globalThis.String(e.privacyPolicyUrl):void 0}},toJSON(e){let n={};return e.appSlug!==""&&(n.appSlug=e.appSlug),e.appName!==""&&(n.appName=e.appName),e.termsAndConditionsUrl!==void 0&&(n.termsAndConditionsUrl=e.termsAndConditionsUrl),e.privacyPolicyUrl!==void 0&&(n.privacyPolicyUrl=e.privacyPolicyUrl),n},create(e){return ke.fromPartial(e??{})},fromPartial(e){let n=Qi();return n.appSlug=e.appSlug??"",n.appName=e.appName??"",n.termsAndConditionsUrl=e.termsAndConditionsUrl??void 0,n.privacyPolicyUrl=e.privacyPolicyUrl??void 0,n}};l.set(ke.$type,ke);function Yi(){return{id:"",name:"",isNsfw:void 0,icon:void 0}}var Ce={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect.Subreddit",encode(e,n=P.default.Writer.create()){return e.id!==""&&n.uint32(10).string(e.id),e.name!==""&&n.uint32(18).string(e.name),e.isNsfw!==void 0&&n.uint32(24).bool(e.isNsfw),e.icon!==void 0&&n.uint32(34).string(e.icon),n},decode(e,n){let t=e instanceof P.default.Reader?e:P.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Yi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.id=t.string();continue;case 2:if(i!==18)break;r.name=t.string();continue;case 3:if(i!==24)break;r.isNsfw=t.bool();continue;case 4:if(i!==34)break;r.icon=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{id:D(e.id)?globalThis.String(e.id):"",name:D(e.name)?globalThis.String(e.name):"",isNsfw:D(e.isNsfw)?globalThis.Boolean(e.isNsfw):void 0,icon:D(e.icon)?globalThis.String(e.icon):void 0}},toJSON(e){let n={};return e.id!==""&&(n.id=e.id),e.name!==""&&(n.name=e.name),e.isNsfw!==void 0&&(n.isNsfw=e.isNsfw),e.icon!==void 0&&(n.icon=e.icon),n},create(e){return Ce.fromPartial(e??{})},fromPartial(e){let n=Yi();return n.id=e.id??"",n.name=e.name??"",n.isNsfw=e.isNsfw??void 0,n.icon=e.icon??void 0,n}};l.set(Ce.$type,Ce);function ji(){return{consentStatus:0}}var de={$type:"devvit.ui.effects.v1alpha.AppPermissionsConsentSubmittedEvent",encode(e,n=P.default.Writer.create()){return e.consentStatus!==0&&n.uint32(8).int32(e.consentStatus),n},decode(e,n){let t=e instanceof P.default.Reader?e:P.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ji();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.consentStatus=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{consentStatus:D(e.consentStatus)?ot(e.consentStatus):0}},toJSON(e){let n={};return e.consentStatus!==0&&(n.consentStatus=at(e.consentStatus)),n},create(e){return de.fromPartial(e??{})},fromPartial(e){let n=ji();return n.consentStatus=e.consentStatus??0,n}};l.set(de.$type,de);function D(e){return e!=null}var en=x(A(),1);var je=x(A(),1);var Cn=x(A(),1);function er(){return{}}var Vn={$type:"google.protobuf.Empty",encode(e,n=Cn.default.Writer.create()){return n},decode(e,n){let t=e instanceof Cn.default.Reader?e:Cn.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=er();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Vn.fromPartial(e??{})},fromPartial(e){return er()}};l.set(Vn.$type,Vn);function nr(){return{channels:[]}}var ut={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,n=je.default.Writer.create()){for(let t of e.channels)n.uint32(10).string(t);return n},decode(e,n){let t=e instanceof je.default.Reader?e:je.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=nr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.channels.push(t.string());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{channels:globalThis.Array.isArray(e?.channels)?e.channels.map(n=>globalThis.String(n)):[]}},toJSON(e){let n={};return e.channels?.length&&(n.channels=e.channels),n},create(e){return ut.fromPartial(e??{})},fromPartial(e){let n=nr();return n.channels=e.channels?.map(t=>t)||[],n}};l.set(ut.$type,ut);function tr(){return{channel:"",data:void 0}}var fe={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,n=je.default.Writer.create()){return e.channel!==""&&n.uint32(10).string(e.channel),e.data!==void 0&&_.encode(_.wrap(e.data),n.uint32(18).fork()).ldelim(),n},decode(e,n){let t=e instanceof je.default.Reader?e:je.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=tr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.channel=t.string();continue;case 2:if(i!==18)break;r.data=_.unwrap(_.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{channel:mo(e.channel)?globalThis.String(e.channel):"",data:ho(e.data)?e.data:void 0}},toJSON(e){let n={};return e.channel!==""&&(n.channel=e.channel),e.data!==void 0&&(n.data=e.data),n},create(e){return fe.fromPartial(e??{})},fromPartial(e){let n=tr();return n.channel=e.channel??"",n.data=e.data??void 0,n}};l.set(fe.$type,fe);function ho(e){return typeof e=="object"&&e!==null}function mo(e){return e!=null}var Ve;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ve||(Ve={}));function go(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return Ve.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return Ve.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return Ve.UNRECOGNIZED}}function So(e){switch(e){case Ve.REALTIME_SUBSCRIBED:return 0;case Ve.REALTIME_UNSUBSCRIBED:return 1;case Ve.UNRECOGNIZED:default:return-1}}function ir(){return{subscriptionIds:[]}}var dt={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,n=en.default.Writer.create()){for(let t of e.subscriptionIds)n.uint32(10).string(t);return n},decode(e,n){let t=e instanceof en.default.Reader?e:en.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ir();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.subscriptionIds.push(t.string());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{subscriptionIds:globalThis.Array.isArray(e?.subscriptionIds)?e.subscriptionIds.map(n=>globalThis.String(n)):[]}},toJSON(e){let n={};return e.subscriptionIds?.length&&(n.subscriptionIds=e.subscriptionIds),n},create(e){return dt.fromPartial(e??{})},fromPartial(e){let n=ir();return n.subscriptionIds=e.subscriptionIds?.map(t=>t)||[],n}};l.set(dt.$type,dt);function rr(){return{event:void 0,status:void 0}}var le={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,n=en.default.Writer.create()){return e.event!==void 0&&fe.encode(e.event,n.uint32(10).fork()).ldelim(),e.status!==void 0&&n.uint32(16).int32(e.status),n},decode(e,n){let t=e instanceof en.default.Reader?e:en.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=rr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.event=fe.decode(t,t.uint32());continue;case 2:if(i!==16)break;r.status=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{event:or(e.event)?fe.fromJSON(e.event):void 0,status:or(e.status)?go(e.status):void 0}},toJSON(e){let n={};return e.event!==void 0&&(n.event=fe.toJSON(e.event)),e.status!==void 0&&(n.status=So(e.status)),n},create(e){return le.fromPartial(e??{})},fromPartial(e){let n=rr();return n.event=e.event!==void 0&&e.event!==null?fe.fromPartial(e.event):void 0,n.status=e.status??void 0,n}};l.set(le.$type,le);function or(e){return e!=null}var Z=x(A(),1);var _n=x(A(),1);var g=x(A(),1);var k;(function(e){e[e.STRING=0]="STRING",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.LIST=4]="LIST",e[e.SELECTION=5]="SELECTION",e[e.GROUP=6]="GROUP",e[e.IMAGE=7]="IMAGE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(k||(k={}));function an(e){switch(e){case 0:case"STRING":return k.STRING;case 1:case"PARAGRAPH":return k.PARAGRAPH;case 2:case"NUMBER":return k.NUMBER;case 3:case"BOOLEAN":return k.BOOLEAN;case 4:case"LIST":return k.LIST;case 5:case"SELECTION":return k.SELECTION;case 6:case"GROUP":return k.GROUP;case 7:case"IMAGE":return k.IMAGE;case-1:case"UNRECOGNIZED":default:return k.UNRECOGNIZED}}function sn(e){switch(e){case k.STRING:return 0;case k.PARAGRAPH:return 1;case k.NUMBER:return 2;case k.BOOLEAN:return 3;case k.LIST:return 4;case k.SELECTION:return 5;case k.GROUP:return 6;case k.IMAGE:return 7;case k.UNRECOGNIZED:default:return-1}}var G=x(A(),1);function ar(){return{fieldType:0,isSecret:void 0,stringValue:void 0,numberValue:void 0,boolValue:void 0,listValue:void 0,selectionValue:void 0,groupValue:void 0}}var T={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,n=G.default.Writer.create()){return e.fieldType!==0&&n.uint32(8).int32(e.fieldType),e.isSecret!==void 0&&n.uint32(800).bool(e.isSecret),e.stringValue!==void 0&&n.uint32(18).string(e.stringValue),e.numberValue!==void 0&&n.uint32(25).double(e.numberValue),e.boolValue!==void 0&&n.uint32(32).bool(e.boolValue),e.listValue!==void 0&&_e.encode(e.listValue,n.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&Fe.encode(e.selectionValue,n.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&Re.encode(e.groupValue,n.uint32(58).fork()).ldelim(),n},decode(e,n){let t=e instanceof G.default.Reader?e:G.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ar();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.fieldType=t.int32();continue;case 100:if(i!==800)break;r.isSecret=t.bool();continue;case 2:if(i!==18)break;r.stringValue=t.string();continue;case 3:if(i!==25)break;r.numberValue=t.double();continue;case 4:if(i!==32)break;r.boolValue=t.bool();continue;case 5:if(i!==42)break;r.listValue=_e.decode(t,t.uint32());continue;case 6:if(i!==50)break;r.selectionValue=Fe.decode(t,t.uint32());continue;case 7:if(i!==58)break;r.groupValue=Re.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{fieldType:ce(e.fieldType)?an(e.fieldType):0,isSecret:ce(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:ce(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:ce(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:ce(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:ce(e.listValue)?_e.fromJSON(e.listValue):void 0,selectionValue:ce(e.selectionValue)?Fe.fromJSON(e.selectionValue):void 0,groupValue:ce(e.groupValue)?Re.fromJSON(e.groupValue):void 0}},toJSON(e){let n={};return e.fieldType!==0&&(n.fieldType=sn(e.fieldType)),e.isSecret!==void 0&&(n.isSecret=e.isSecret),e.stringValue!==void 0&&(n.stringValue=e.stringValue),e.numberValue!==void 0&&(n.numberValue=e.numberValue),e.boolValue!==void 0&&(n.boolValue=e.boolValue),e.listValue!==void 0&&(n.listValue=_e.toJSON(e.listValue)),e.selectionValue!==void 0&&(n.selectionValue=Fe.toJSON(e.selectionValue)),e.groupValue!==void 0&&(n.groupValue=Re.toJSON(e.groupValue)),n},create(e){return T.fromPartial(e??{})},fromPartial(e){let n=ar();return n.fieldType=e.fieldType??0,n.isSecret=e.isSecret??void 0,n.stringValue=e.stringValue??void 0,n.numberValue=e.numberValue??void 0,n.boolValue=e.boolValue??void 0,n.listValue=e.listValue!==void 0&&e.listValue!==null?_e.fromPartial(e.listValue):void 0,n.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?Fe.fromPartial(e.selectionValue):void 0,n.groupValue=e.groupValue!==void 0&&e.groupValue!==null?Re.fromPartial(e.groupValue):void 0,n}};l.set(T.$type,T);function sr(){return{itemType:0,items:[]}}var _e={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,n=G.default.Writer.create()){e.itemType!==0&&n.uint32(8).int32(e.itemType);for(let t of e.items)T.encode(t,n.uint32(18).fork()).ldelim();return n},decode(e,n){let t=e instanceof G.default.Reader?e:G.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=sr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.itemType=t.int32();continue;case 2:if(i!==18)break;r.items.push(T.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{itemType:ce(e.itemType)?an(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(n=>T.fromJSON(n)):[]}},toJSON(e){let n={};return e.itemType!==0&&(n.itemType=sn(e.itemType)),e.items?.length&&(n.items=e.items.map(t=>T.toJSON(t))),n},create(e){return _e.fromPartial(e??{})},fromPartial(e){let n=sr();return n.itemType=e.itemType??0,n.items=e.items?.map(t=>T.fromPartial(t))||[],n}};l.set(_e.$type,_e);function ur(){return{values:[]}}var Fe={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,n=G.default.Writer.create()){for(let t of e.values)n.uint32(10).string(t);return n},decode(e,n){let t=e instanceof G.default.Reader?e:G.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ur();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.values.push(t.string());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?e.values.map(n=>globalThis.String(n)):[]}},toJSON(e){let n={};return e.values?.length&&(n.values=e.values),n},create(e){return Fe.fromPartial(e??{})},fromPartial(e){let n=ur();return n.values=e.values?.map(t=>t)||[],n}};l.set(Fe.$type,Fe);function dr(){return{}}var Re={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,n=G.default.Writer.create()){return n},decode(e,n){let t=e instanceof G.default.Reader?e:G.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=dr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Re.fromPartial(e??{})},fromPartial(e){return dr()}};l.set(Re.$type,Re);function ce(e){return e!=null}function fr(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var J={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,n=g.default.Writer.create()){return e.fieldId!==""&&n.uint32(10).string(e.fieldId),e.fieldType!==0&&n.uint32(16).int32(e.fieldType),e.label!==""&&n.uint32(26).string(e.label),e.helpText!==void 0&&n.uint32(34).string(e.helpText),e.defaultValue!==void 0&&T.encode(e.defaultValue,n.uint32(42).fork()).ldelim(),e.required!==void 0&&n.uint32(48).bool(e.required),e.disabled!==void 0&&n.uint32(56).bool(e.disabled),e.fieldConfig!==void 0&&q.encode(e.fieldConfig,n.uint32(66).fork()).ldelim(),e.isSecret!==void 0&&n.uint32(72).bool(e.isSecret),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=fr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fieldId=t.string();continue;case 2:if(i!==16)break;r.fieldType=t.int32();continue;case 3:if(i!==26)break;r.label=t.string();continue;case 4:if(i!==34)break;r.helpText=t.string();continue;case 5:if(i!==42)break;r.defaultValue=T.decode(t,t.uint32());continue;case 6:if(i!==48)break;r.required=t.bool();continue;case 7:if(i!==56)break;r.disabled=t.bool();continue;case 8:if(i!==66)break;r.fieldConfig=q.decode(t,t.uint32());continue;case 9:if(i!==72)break;r.isSecret=t.bool();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{fieldId:h(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:h(e.fieldType)?an(e.fieldType):0,label:h(e.label)?globalThis.String(e.label):"",helpText:h(e.helpText)?globalThis.String(e.helpText):void 0,defaultValue:h(e.defaultValue)?T.fromJSON(e.defaultValue):void 0,required:h(e.required)?globalThis.Boolean(e.required):void 0,disabled:h(e.disabled)?globalThis.Boolean(e.disabled):void 0,fieldConfig:h(e.fieldConfig)?q.fromJSON(e.fieldConfig):void 0,isSecret:h(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let n={};return e.fieldId!==""&&(n.fieldId=e.fieldId),e.fieldType!==0&&(n.fieldType=sn(e.fieldType)),e.label!==""&&(n.label=e.label),e.helpText!==void 0&&(n.helpText=e.helpText),e.defaultValue!==void 0&&(n.defaultValue=T.toJSON(e.defaultValue)),e.required!==void 0&&(n.required=e.required),e.disabled!==void 0&&(n.disabled=e.disabled),e.fieldConfig!==void 0&&(n.fieldConfig=q.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(n.isSecret=e.isSecret),n},create(e){return J.fromPartial(e??{})},fromPartial(e){let n=fr();return n.fieldId=e.fieldId??"",n.fieldType=e.fieldType??0,n.label=e.label??"",n.helpText=e.helpText??void 0,n.defaultValue=e.defaultValue!==void 0&&e.defaultValue!==null?T.fromPartial(e.defaultValue):void 0,n.required=e.required??void 0,n.disabled=e.disabled??void 0,n.fieldConfig=e.fieldConfig!==void 0&&e.fieldConfig!==null?q.fromPartial(e.fieldConfig):void 0,n.isSecret=e.isSecret??void 0,n}};l.set(J.$type,J);function lr(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var q={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,n=g.default.Writer.create()){return e.stringConfig!==void 0&&Pe.encode(e.stringConfig,n.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&we.encode(e.paragraphConfig,n.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&xe.encode(e.numberConfig,n.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&Ae.encode(e.booleanConfig,n.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&De.encode(e.listConfig,n.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&Be.encode(e.selectionConfig,n.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&Me.encode(e.groupConfig,n.uint32(58).fork()).ldelim(),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=lr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.stringConfig=Pe.decode(t,t.uint32());continue;case 2:if(i!==18)break;r.paragraphConfig=we.decode(t,t.uint32());continue;case 3:if(i!==26)break;r.numberConfig=xe.decode(t,t.uint32());continue;case 4:if(i!==34)break;r.booleanConfig=Ae.decode(t,t.uint32());continue;case 5:if(i!==42)break;r.listConfig=De.decode(t,t.uint32());continue;case 6:if(i!==50)break;r.selectionConfig=Be.decode(t,t.uint32());continue;case 7:if(i!==58)break;r.groupConfig=Me.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{stringConfig:h(e.stringConfig)?Pe.fromJSON(e.stringConfig):void 0,paragraphConfig:h(e.paragraphConfig)?we.fromJSON(e.paragraphConfig):void 0,numberConfig:h(e.numberConfig)?xe.fromJSON(e.numberConfig):void 0,booleanConfig:h(e.booleanConfig)?Ae.fromJSON(e.booleanConfig):void 0,listConfig:h(e.listConfig)?De.fromJSON(e.listConfig):void 0,selectionConfig:h(e.selectionConfig)?Be.fromJSON(e.selectionConfig):void 0,groupConfig:h(e.groupConfig)?Me.fromJSON(e.groupConfig):void 0}},toJSON(e){let n={};return e.stringConfig!==void 0&&(n.stringConfig=Pe.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(n.paragraphConfig=we.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(n.numberConfig=xe.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(n.booleanConfig=Ae.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(n.listConfig=De.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(n.selectionConfig=Be.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(n.groupConfig=Me.toJSON(e.groupConfig)),n},create(e){return q.fromPartial(e??{})},fromPartial(e){let n=lr();return n.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?Pe.fromPartial(e.stringConfig):void 0,n.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?we.fromPartial(e.paragraphConfig):void 0,n.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?xe.fromPartial(e.numberConfig):void 0,n.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?Ae.fromPartial(e.booleanConfig):void 0,n.listConfig=e.listConfig!==void 0&&e.listConfig!==null?De.fromPartial(e.listConfig):void 0,n.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?Be.fromPartial(e.selectionConfig):void 0,n.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?Me.fromPartial(e.groupConfig):void 0,n}};l.set(q.$type,q);function cr(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var Pe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.String",encode(e,n=g.default.Writer.create()){return e.minLength!==void 0&&n.uint32(8).int32(e.minLength),e.maxLength!==void 0&&n.uint32(16).int32(e.maxLength),e.placeholder!==void 0&&n.uint32(26).string(e.placeholder),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=cr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.minLength=t.int32();continue;case 2:if(i!==16)break;r.maxLength=t.int32();continue;case 3:if(i!==26)break;r.placeholder=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{minLength:h(e.minLength)?globalThis.Number(e.minLength):void 0,maxLength:h(e.maxLength)?globalThis.Number(e.maxLength):void 0,placeholder:h(e.placeholder)?globalThis.String(e.placeholder):void 0}},toJSON(e){let n={};return e.minLength!==void 0&&(n.minLength=Math.round(e.minLength)),e.maxLength!==void 0&&(n.maxLength=Math.round(e.maxLength)),e.placeholder!==void 0&&(n.placeholder=e.placeholder),n},create(e){return Pe.fromPartial(e??{})},fromPartial(e){let n=cr();return n.minLength=e.minLength??void 0,n.maxLength=e.maxLength??void 0,n.placeholder=e.placeholder??void 0,n}};l.set(Pe.$type,Pe);function pr(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var we={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Paragraph",encode(e,n=g.default.Writer.create()){return e.maxCharacters!==void 0&&n.uint32(8).int32(e.maxCharacters),e.lineHeight!==void 0&&n.uint32(16).int32(e.lineHeight),e.placeholder!==void 0&&n.uint32(26).string(e.placeholder),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=pr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.maxCharacters=t.int32();continue;case 2:if(i!==16)break;r.lineHeight=t.int32();continue;case 3:if(i!==26)break;r.placeholder=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{maxCharacters:h(e.maxCharacters)?globalThis.Number(e.maxCharacters):void 0,lineHeight:h(e.lineHeight)?globalThis.Number(e.lineHeight):void 0,placeholder:h(e.placeholder)?globalThis.String(e.placeholder):void 0}},toJSON(e){let n={};return e.maxCharacters!==void 0&&(n.maxCharacters=Math.round(e.maxCharacters)),e.lineHeight!==void 0&&(n.lineHeight=Math.round(e.lineHeight)),e.placeholder!==void 0&&(n.placeholder=e.placeholder),n},create(e){return we.fromPartial(e??{})},fromPartial(e){let n=pr();return n.maxCharacters=e.maxCharacters??void 0,n.lineHeight=e.lineHeight??void 0,n.placeholder=e.placeholder??void 0,n}};l.set(we.$type,we);function hr(){return{step:void 0,min:void 0,max:void 0}}var xe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Number",encode(e,n=g.default.Writer.create()){return e.step!==void 0&&n.uint32(9).double(e.step),e.min!==void 0&&n.uint32(17).double(e.min),e.max!==void 0&&n.uint32(25).double(e.max),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=hr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==9)break;r.step=t.double();continue;case 2:if(i!==17)break;r.min=t.double();continue;case 3:if(i!==25)break;r.max=t.double();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{step:h(e.step)?globalThis.Number(e.step):void 0,min:h(e.min)?globalThis.Number(e.min):void 0,max:h(e.max)?globalThis.Number(e.max):void 0}},toJSON(e){let n={};return e.step!==void 0&&(n.step=e.step),e.min!==void 0&&(n.min=e.min),e.max!==void 0&&(n.max=e.max),n},create(e){return xe.fromPartial(e??{})},fromPartial(e){let n=hr();return n.step=e.step??void 0,n.min=e.min??void 0,n.max=e.max??void 0,n}};l.set(xe.$type,xe);function mr(){return{}}var Ae={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Boolean",encode(e,n=g.default.Writer.create()){return n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=mr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Ae.fromPartial(e??{})},fromPartial(e){return mr()}};l.set(Ae.$type,Ae);function gr(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var De={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.List",encode(e,n=g.default.Writer.create()){return e.itemType!==0&&n.uint32(8).int32(e.itemType),e.itemConfig!==void 0&&q.encode(e.itemConfig,n.uint32(18).fork()).ldelim(),e.minEntries!==void 0&&n.uint32(24).int32(e.minEntries),e.maxEntries!==void 0&&n.uint32(32).int32(e.maxEntries),e.entryLabel!==void 0&&n.uint32(42).string(e.entryLabel),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=gr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.itemType=t.int32();continue;case 2:if(i!==18)break;r.itemConfig=q.decode(t,t.uint32());continue;case 3:if(i!==24)break;r.minEntries=t.int32();continue;case 4:if(i!==32)break;r.maxEntries=t.int32();continue;case 5:if(i!==42)break;r.entryLabel=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{itemType:h(e.itemType)?an(e.itemType):0,itemConfig:h(e.itemConfig)?q.fromJSON(e.itemConfig):void 0,minEntries:h(e.minEntries)?globalThis.Number(e.minEntries):void 0,maxEntries:h(e.maxEntries)?globalThis.Number(e.maxEntries):void 0,entryLabel:h(e.entryLabel)?globalThis.String(e.entryLabel):void 0}},toJSON(e){let n={};return e.itemType!==0&&(n.itemType=sn(e.itemType)),e.itemConfig!==void 0&&(n.itemConfig=q.toJSON(e.itemConfig)),e.minEntries!==void 0&&(n.minEntries=Math.round(e.minEntries)),e.maxEntries!==void 0&&(n.maxEntries=Math.round(e.maxEntries)),e.entryLabel!==void 0&&(n.entryLabel=e.entryLabel),n},create(e){return De.fromPartial(e??{})},fromPartial(e){let n=gr();return n.itemType=e.itemType??0,n.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?q.fromPartial(e.itemConfig):void 0,n.minEntries=e.minEntries??void 0,n.maxEntries=e.maxEntries??void 0,n.entryLabel=e.entryLabel??void 0,n}};l.set(De.$type,De);function Sr(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var Be={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,n=g.default.Writer.create()){for(let t of e.choices)Le.encode(t,n.uint32(10).fork()).ldelim();return e.multiSelect!==void 0&&n.uint32(16).bool(e.multiSelect),e.minSelections!==void 0&&n.uint32(24).int32(e.minSelections),e.maxSelections!==void 0&&n.uint32(32).int32(e.maxSelections),e.renderAsList!==void 0&&n.uint32(40).bool(e.renderAsList),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Sr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.choices.push(Le.decode(t,t.uint32()));continue;case 2:if(i!==16)break;r.multiSelect=t.bool();continue;case 3:if(i!==24)break;r.minSelections=t.int32();continue;case 4:if(i!==32)break;r.maxSelections=t.int32();continue;case 5:if(i!==40)break;r.renderAsList=t.bool();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{choices:globalThis.Array.isArray(e?.choices)?e.choices.map(n=>Le.fromJSON(n)):[],multiSelect:h(e.multiSelect)?globalThis.Boolean(e.multiSelect):void 0,minSelections:h(e.minSelections)?globalThis.Number(e.minSelections):void 0,maxSelections:h(e.maxSelections)?globalThis.Number(e.maxSelections):void 0,renderAsList:h(e.renderAsList)?globalThis.Boolean(e.renderAsList):void 0}},toJSON(e){let n={};return e.choices?.length&&(n.choices=e.choices.map(t=>Le.toJSON(t))),e.multiSelect!==void 0&&(n.multiSelect=e.multiSelect),e.minSelections!==void 0&&(n.minSelections=Math.round(e.minSelections)),e.maxSelections!==void 0&&(n.maxSelections=Math.round(e.maxSelections)),e.renderAsList!==void 0&&(n.renderAsList=e.renderAsList),n},create(e){return Be.fromPartial(e??{})},fromPartial(e){let n=Sr();return n.choices=e.choices?.map(t=>Le.fromPartial(t))||[],n.multiSelect=e.multiSelect??void 0,n.minSelections=e.minSelections??void 0,n.maxSelections=e.maxSelections??void 0,n.renderAsList=e.renderAsList??void 0,n}};l.set(Be.$type,Be);function yr(){return{label:"",value:""}}var Le={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection.Item",encode(e,n=g.default.Writer.create()){return e.label!==""&&n.uint32(10).string(e.label),e.value!==""&&n.uint32(18).string(e.value),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=yr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.label=t.string();continue;case 2:if(i!==18)break;r.value=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{label:h(e.label)?globalThis.String(e.label):"",value:h(e.value)?globalThis.String(e.value):""}},toJSON(e){let n={};return e.label!==""&&(n.label=e.label),e.value!==""&&(n.value=e.value),n},create(e){return Le.fromPartial(e??{})},fromPartial(e){let n=yr();return n.label=e.label??"",n.value=e.value??"",n}};l.set(Le.$type,Le);function vr(){return{fields:[]}}var Me={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,n=g.default.Writer.create()){for(let t of e.fields)J.encode(t,n.uint32(10).fork()).ldelim();return n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=vr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fields.push(J.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(n=>J.fromJSON(n)):[]}},toJSON(e){let n={};return e.fields?.length&&(n.fields=e.fields.map(t=>J.toJSON(t))),n},create(e){return Me.fromPartial(e??{})},fromPartial(e){let n=vr();return n.fields=e.fields?.map(t=>J.fromPartial(t))||[],n}};l.set(Me.$type,Me);function h(e){return e!=null}function br(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var pe={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,n=_n.default.Writer.create()){for(let t of e.fields)J.encode(t,n.uint32(10).fork()).ldelim();return e.title!==void 0&&n.uint32(18).string(e.title),e.shortDescription!==void 0&&n.uint32(26).string(e.shortDescription),e.acceptLabel!==void 0&&n.uint32(34).string(e.acceptLabel),e.cancelLabel!==void 0&&n.uint32(42).string(e.cancelLabel),e.id!==void 0&&n.uint32(50).string(e.id),n},decode(e,n){let t=e instanceof _n.default.Reader?e:_n.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=br();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fields.push(J.decode(t,t.uint32()));continue;case 2:if(i!==18)break;r.title=t.string();continue;case 3:if(i!==26)break;r.shortDescription=t.string();continue;case 4:if(i!==34)break;r.acceptLabel=t.string();continue;case 5:if(i!==42)break;r.cancelLabel=t.string();continue;case 6:if(i!==50)break;r.id=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(n=>J.fromJSON(n)):[],title:pn(e.title)?globalThis.String(e.title):void 0,shortDescription:pn(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:pn(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:pn(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:pn(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let n={};return e.fields?.length&&(n.fields=e.fields.map(t=>J.toJSON(t))),e.title!==void 0&&(n.title=e.title),e.shortDescription!==void 0&&(n.shortDescription=e.shortDescription),e.acceptLabel!==void 0&&(n.acceptLabel=e.acceptLabel),e.cancelLabel!==void 0&&(n.cancelLabel=e.cancelLabel),e.id!==void 0&&(n.id=e.id),n},create(e){return pe.fromPartial(e??{})},fromPartial(e){let n=br();return n.fields=e.fields?.map(t=>J.fromPartial(t))||[],n.title=e.title??void 0,n.shortDescription=e.shortDescription??void 0,n.acceptLabel=e.acceptLabel??void 0,n.cancelLabel=e.cancelLabel??void 0,n.id=e.id??void 0,n}};l.set(pe.$type,pe);function pn(e){return e!=null}function Er(){return{form:void 0}}var ft={$type:"devvit.ui.effects.v1alpha.ShowFormEffect",encode(e,n=Z.default.Writer.create()){return e.form!==void 0&&pe.encode(e.form,n.uint32(10).fork()).ldelim(),n},decode(e,n){let t=e instanceof Z.default.Reader?e:Z.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Er();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.form=pe.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{form:mn(e.form)?pe.fromJSON(e.form):void 0}},toJSON(e){let n={};return e.form!==void 0&&(n.form=pe.toJSON(e.form)),n},create(e){return ft.fromPartial(e??{})},fromPartial(e){let n=Er();return n.form=e.form!==void 0&&e.form!==null?pe.fromPartial(e.form):void 0,n}};l.set(ft.$type,ft);function Nr(){return{results:{},formId:void 0}}var he={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent",encode(e,n=Z.default.Writer.create()){return Object.entries(e.results).forEach(([t,o])=>{hn.encode({key:t,value:o},n.uint32(10).fork()).ldelim()}),e.formId!==void 0&&n.uint32(18).string(e.formId),n},decode(e,n){let t=e instanceof Z.default.Reader?e:Z.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Nr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;let a=hn.decode(t,t.uint32());a.value!==void 0&&(r.results[a.key]=a.value);continue;case 2:if(i!==18)break;r.formId=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{results:yo(e.results)?Object.entries(e.results).reduce((n,[t,o])=>(n[t]=T.fromJSON(o),n),{}):{},formId:mn(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let n={};if(e.results){let t=Object.entries(e.results);t.length>0&&(n.results={},t.forEach(([o,r])=>{n.results[o]=T.toJSON(r)}))}return e.formId!==void 0&&(n.formId=e.formId),n},create(e){return he.fromPartial(e??{})},fromPartial(e){let n=Nr();return n.results=Object.entries(e.results??{}).reduce((t,[o,r])=>(r!==void 0&&(t[o]=T.fromPartial(r)),t),{}),n.formId=e.formId??void 0,n}};l.set(he.$type,he);function Tr(){return{key:"",value:void 0}}var hn={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,n=Z.default.Writer.create()){return e.key!==""&&n.uint32(10).string(e.key),e.value!==void 0&&T.encode(e.value,n.uint32(18).fork()).ldelim(),n},decode(e,n){let t=e instanceof Z.default.Reader?e:Z.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Tr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.key=t.string();continue;case 2:if(i!==18)break;r.value=T.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{key:mn(e.key)?globalThis.String(e.key):"",value:mn(e.value)?T.fromJSON(e.value):void 0}},toJSON(e){let n={};return e.key!==""&&(n.key=e.key),e.value!==void 0&&(n.value=T.toJSON(e.value)),n},create(e){return hn.fromPartial(e??{})},fromPartial(e){let n=Tr();return n.key=e.key??"",n.value=e.value!==void 0&&e.value!==null?T.fromPartial(e.value):void 0,n}};l.set(hn.$type,hn);function Ir(){return{formId:void 0}}var me={$type:"devvit.ui.effects.v1alpha.FormCanceledEvent",encode(e,n=Z.default.Writer.create()){return e.formId!==void 0&&n.uint32(10).string(e.formId),n},decode(e,n){let t=e instanceof Z.default.Reader?e:Z.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Ir();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.formId=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{formId:mn(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let n={};return e.formId!==void 0&&(n.formId=e.formId),n},create(e){return me.fromPartial(e??{})},fromPartial(e){let n=Ir();return n.formId=e.formId??void 0,n}};l.set(me.$type,me);function yo(e){return typeof e=="object"&&e!==null}function mn(e){return e!=null}var $e;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})($e||($e={}));function vo(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return $e.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return $e.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return $e.UNRECOGNIZED}}function bo(e){switch(e){case $e.WEBVIEW_VISIBLE:return 0;case $e.WEBVIEW_HIDDEN:return 1;case $e.UNRECOGNIZED:default:return-1}}function Or(){return{message:void 0,jsonString:""}}var Je={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,n=w.default.Writer.create()){return e.message!==void 0&&F.encode(F.wrap(e.message),n.uint32(10).fork()).ldelim(),e.jsonString!==""&&n.uint32(18).string(e.jsonString),n},decode(e,n){let t=e instanceof w.default.Reader?e:w.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Or();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.message=F.unwrap(F.decode(t,t.uint32()));continue;case 2:if(i!==18)break;r.jsonString=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{message:j(e?.message)?e.message:void 0,jsonString:j(e.jsonString)?globalThis.String(e.jsonString):""}},toJSON(e){let n={};return e.message!==void 0&&(n.message=e.message),e.jsonString!==""&&(n.jsonString=e.jsonString),n},create(e){return Je.fromPartial(e??{})},fromPartial(e){let n=Or();return n.message=e.message??void 0,n.jsonString=e.jsonString??"",n}};l.set(Je.$type,Je);function kr(){return{visibility:0}}var Ue={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,n=w.default.Writer.create()){return e.visibility!==0&&n.uint32(8).int32(e.visibility),n},decode(e,n){let t=e instanceof w.default.Reader?e:w.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=kr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.visibility=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{visibility:j(e.visibility)?vo(e.visibility):0}},toJSON(e){let n={};return e.visibility!==0&&(n.visibility=bo(e.visibility)),n},create(e){return Ue.fromPartial(e??{})},fromPartial(e){let n=kr();return n.visibility=e.visibility??0,n}};l.set(Ue.$type,Ue);function Cr(){return{postMessage:void 0,fullScreen:void 0}}var lt={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,n=w.default.Writer.create()){return e.postMessage!==void 0&&Je.encode(e.postMessage,n.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&Ue.encode(e.fullScreen,n.uint32(18).fork()).ldelim(),n},decode(e,n){let t=e instanceof w.default.Reader?e:w.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Cr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.postMessage=Je.decode(t,t.uint32());continue;case 2:if(i!==18)break;r.fullScreen=Ue.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{postMessage:j(e.postMessage)?Je.fromJSON(e.postMessage):void 0,fullScreen:j(e.fullScreen)?Ue.fromJSON(e.fullScreen):void 0}},toJSON(e){let n={};return e.postMessage!==void 0&&(n.postMessage=Je.toJSON(e.postMessage)),e.fullScreen!==void 0&&(n.fullScreen=Ue.toJSON(e.fullScreen)),n},create(e){return lt.fromPartial(e??{})},fromPartial(e){let n=Cr();return n.postMessage=e.postMessage!==void 0&&e.postMessage!==null?Je.fromPartial(e.postMessage):void 0,n.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?Ue.fromPartial(e.fullScreen):void 0,n}};l.set(lt.$type,lt);function Vr(){return{immersiveMode:0}}var We={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode(e,n=w.default.Writer.create()){return e.immersiveMode!==0&&n.uint32(8).int32(e.immersiveMode),n},decode(e,n){let t=e instanceof w.default.Reader?e:w.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Vr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.immersiveMode=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{immersiveMode:j(e.immersiveMode)?Kn(e.immersiveMode):0}},toJSON(e){let n={};return e.immersiveMode!==0&&(n.immersiveMode=zn(e.immersiveMode)),n},create(e){return We.fromPartial(e??{})},fromPartial(e){let n=Vr();return n.immersiveMode=e.immersiveMode??0,n}};l.set(We.$type,We);function _r(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,appPermissionsConsentSubmitted:void 0}}var gn={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,n=w.default.Writer.create()){return e.id!==""&&n.uint32(10).string(e.id),e.formCanceled!==void 0&&me.encode(e.formCanceled,n.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&he.encode(e.formSubmitted,n.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&le.encode(e.realtimeEvent,n.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&We.encode(e.immersiveModeEvent,n.uint32(42).fork()).ldelim(),e.appPermissionsConsentSubmitted!==void 0&&de.encode(e.appPermissionsConsentSubmitted,n.uint32(50).fork()).ldelim(),n},decode(e,n){let t=e instanceof w.default.Reader?e:w.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=_r();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.id=t.string();continue;case 2:if(i!==18)break;r.formCanceled=me.decode(t,t.uint32());continue;case 3:if(i!==26)break;r.formSubmitted=he.decode(t,t.uint32());continue;case 4:if(i!==34)break;r.realtimeEvent=le.decode(t,t.uint32());continue;case 5:if(i!==42)break;r.immersiveModeEvent=We.decode(t,t.uint32());continue;case 6:if(i!==50)break;r.appPermissionsConsentSubmitted=de.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{id:j(e.id)?globalThis.String(e.id):"",formCanceled:j(e.formCanceled)?me.fromJSON(e.formCanceled):void 0,formSubmitted:j(e.formSubmitted)?he.fromJSON(e.formSubmitted):void 0,realtimeEvent:j(e.realtimeEvent)?le.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:j(e.immersiveModeEvent)?We.fromJSON(e.immersiveModeEvent):void 0,appPermissionsConsentSubmitted:j(e.appPermissionsConsentSubmitted)?de.fromJSON(e.appPermissionsConsentSubmitted):void 0}},toJSON(e){let n={};return e.id!==""&&(n.id=e.id),e.formCanceled!==void 0&&(n.formCanceled=me.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(n.formSubmitted=he.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(n.realtimeEvent=le.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(n.immersiveModeEvent=We.toJSON(e.immersiveModeEvent)),e.appPermissionsConsentSubmitted!==void 0&&(n.appPermissionsConsentSubmitted=de.toJSON(e.appPermissionsConsentSubmitted)),n},create(e){return gn.fromPartial(e??{})},fromPartial(e){let n=_r();return n.id=e.id??"",n.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?me.fromPartial(e.formCanceled):void 0,n.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?he.fromPartial(e.formSubmitted):void 0,n.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?le.fromPartial(e.realtimeEvent):void 0,n.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?We.fromPartial(e.immersiveModeEvent):void 0,n.appPermissionsConsentSubmitted=e.appPermissionsConsentSubmitted!==void 0&&e.appPermissionsConsentSubmitted!==null?de.fromPartial(e.appPermissionsConsentSubmitted):void 0,n}};l.set(gn.$type,gn);function j(e){return e!=null}var Fr=[3];var Ge=e=>new Promise(n=>{let t={scope:0,type:"devvit-internal"};if(e.realtimeSubscriptions?t.realtimeEffect=e.realtimeSubscriptions:t.effect=e,Fr.includes(e.type)){let o=self.crypto.randomUUID();t.id=o;let r=i=>{if(i.data?.type==="devvit-message"&&i.data?.data?.id===o){let a=gn.fromJSON(i.data.data);n(a),window.removeEventListener("message",r)}};window.addEventListener("message",r),window.parent.postMessage(t,"*")}else window.parent.postMessage(t,"*"),n(void 0)});var ct=new Set;function Eo(e){return Rr(2,e)}function No(e){return Rr(1,e)}function To(e){ct.add(e)}function Io(e){ct.delete(e)}async function Rr(e,n){if(!n.isTrusted)throw console.error("Immersive mode effect ignored due to untrusted event"),new Error("Untrusted event");await Ge({type:9,immersiveMode:{immersiveMode:e}})}typeof addEventListener=="function"&&addEventListener("message",e=>{let{type:n,data:t}=e.data;if(n!=="devvit-message"||!t.immersiveMode)return;let r=e.data.data?.immersiveMode?.immersiveMode===2?"immersive":"inline";ct.forEach(i=>i(r))});function Oo(e){let n;typeof e=="string"?n=new URL(e).toString():n=new URL(e.url).toString(),Ge({navigateToUrl:{url:n},type:5})}function pt(e,n=new Set){for(let t of e){if(t.type==="group"){pt(t.fields,n);continue}let o=t.name;if(n.has(o))throw new Error(`Duplicate field name: ${o}`);n.add(o)}ko(e)}function ko(e){for(let n of e)if(n.type==="string"&&n.isSecret&&n.scope!=="app")throw`Invalid setting: only app settings can be secrets. Add "scope: SettingScope.App" to field "${n.name}"`}function Co(e){switch(e.fieldType){case 0:return e.stringValue;case 7:return e.stringValue;case 1:return e.stringValue;case 2:return e.numberValue;case 3:return e.boolValue;case 5:return e.selectionValue?.values??[];default:return}}function Pr(e){return Object.keys(e).reduce((n,t)=>{let o=Co(e[t]);return o!==void 0&&(n[t]=o),n},{})}function ht(e){return e.map(n=>{switch(n.type){case"string":return Vo(n);case"image":return _o(n);case"paragraph":return Fo(n);case"number":return Ro(n);case"select":return Po(n);case"boolean":return wo(n);case"group":return xo(n);default:throw new Error("Unknown field type.")}})}function Vo(e){return{defaultValue:{fieldType:0,stringValue:e.defaultValue},disabled:e.disabled,fieldConfig:{stringConfig:{placeholder:e.placeholder}},fieldId:e.name,fieldType:0,helpText:e.helpText,label:e.label,required:e.required,isSecret:e.isSecret}}function _o(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function Fo(e){return{defaultValue:{fieldType:1,stringValue:e.defaultValue},disabled:e.disabled,fieldConfig:{paragraphConfig:{lineHeight:e.lineHeight,placeholder:e.placeholder}},fieldId:e.name,fieldType:1,helpText:e.helpText,label:e.label,required:e.required}}function Ro(e){return{defaultValue:{fieldType:2,numberValue:e.defaultValue},disabled:e.disabled,fieldConfig:{numberConfig:{}},fieldId:e.name,fieldType:2,helpText:e.helpText,label:e.label,required:e.required}}function Po(e){return{defaultValue:{fieldType:5,selectionValue:{values:e.defaultValue??[]}},disabled:e.disabled,fieldConfig:{selectionConfig:{choices:e.options,multiSelect:e.multiSelect}},fieldId:e.name,fieldType:5,helpText:e.helpText,label:e.label,required:e.required}}function wo(e){return{defaultValue:{fieldType:3,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:3,helpText:e.helpText,label:e.label}}function xo(e){return{fieldId:"",fieldType:6,fieldConfig:{groupConfig:{fields:ht(e.fields)}},label:e.label,helpText:e.helpText}}var wr=1,Ao=()=>(wr++,`form.${wr}`),Do=async e=>{let n={fields:[],id:Ao(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};pt(e.fields),n.fields=ht(e.fields);let t=await Ge({showForm:{form:n},type:3});return!t||!t.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:Pr(t.formSubmitted.results)}};function Bo(e){let n;e instanceof Object?n={text:e.text,appearance:e.appearance==="success"?1:0}:n={text:e},Ge({showToast:{toast:n},type:4})}export{To as addImmersiveModeChangeEventListener,so as context,No as exitImmersiveMode,Oo as navigateTo,Io as removeImmersiveModeChangeEventListener,Eo as requestImmersiveMode,Do as showForm,Bo as showToast};
1
+ var xr=Object.create;var mt=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var Ar=Object.getOwnPropertyNames;var Dr=Object.getPrototypeOf,Br=Object.prototype.hasOwnProperty;var C=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var Lr=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Ar(n))!Br.call(e,r)&&r!==t&&mt(e,r,{get:()=>n[r],enumerable:!(o=wr(n,r))||o.enumerable});return e};var w=(e,n,t)=>(t=e!=null?xr(Dr(e)):{},Lr(n||!e||!e.__esModule?mt(t,"default",{value:e,enumerable:!0}):t,e));var St=C((Mo,gt)=>{"use strict";gt.exports=Mr;function Mr(e,n){for(var t=new Array(arguments.length-1),o=0,r=2,i=!0;r<arguments.length;)t[o++]=arguments[r++];return new Promise(function(f,s){t[o]=function(c){if(i)if(i=!1,c)s(c);else{for(var E=new Array(arguments.length-1),y=0;y<E.length;)E[y++]=arguments[y];f.apply(null,E)}};try{e.apply(n||null,t)}catch(u){i&&(i=!1,s(u))}})}});var Nt=C(bt=>{"use strict";var yn=bt;yn.length=function(n){var t=n.length;if(!t)return 0;for(var o=0;--t%4>1&&n.charAt(t)==="=";)++o;return Math.ceil(n.length*3)/4-o};var nn=new Array(64),vt=new Array(123);for(ee=0;ee<64;)vt[nn[ee]=ee<26?ee+65:ee<52?ee+71:ee<62?ee-4:ee-59|43]=ee++;var ee;yn.encode=function(n,t,o){for(var r=null,i=[],a=0,f=0,s;t<o;){var u=n[t++];switch(f){case 0:i[a++]=nn[u>>2],s=(u&3)<<4,f=1;break;case 1:i[a++]=nn[s|u>>4],s=(u&15)<<2,f=2;break;case 2:i[a++]=nn[s|u>>6],i[a++]=nn[u&63],f=0;break}a>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,i)),a=0)}return f&&(i[a++]=nn[s],i[a++]=61,f===1&&(i[a++]=61)),r?(a&&r.push(String.fromCharCode.apply(String,i.slice(0,a))),r.join("")):String.fromCharCode.apply(String,i.slice(0,a))};var yt="invalid encoding";yn.decode=function(n,t,o){for(var r=o,i=0,a,f=0;f<n.length;){var s=n.charCodeAt(f++);if(s===61&&i>1)break;if((s=vt[s])===void 0)throw Error(yt);switch(i){case 0:a=s,i=1;break;case 1:t[o++]=a<<2|(s&48)>>4,a=s,i=2;break;case 2:t[o++]=(a&15)<<4|(s&60)>>2,a=s,i=3;break;case 3:t[o++]=(a&3)<<6|s,i=0;break}}if(i===1)throw Error(yt);return o-r};yn.test=function(n){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(n)}});var Tt=C((Uo,Et)=>{"use strict";Et.exports=vn;function vn(){this._listeners={}}vn.prototype.on=function(n,t,o){return(this._listeners[n]||(this._listeners[n]=[])).push({fn:t,ctx:o||this}),this};vn.prototype.off=function(n,t){if(n===void 0)this._listeners={};else if(t===void 0)this._listeners[n]=[];else for(var o=this._listeners[n],r=0;r<o.length;)o[r].fn===t?o.splice(r,1):++r;return this};vn.prototype.emit=function(n){var t=this._listeners[n];if(t){for(var o=[],r=1;r<arguments.length;)o.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,o)}return this}});var Ft=C((Wo,_t)=>{"use strict";_t.exports=It(It);function It(e){return typeof Float32Array<"u"?function(){var n=new Float32Array([-0]),t=new Uint8Array(n.buffer),o=t[3]===128;function r(s,u,c){n[0]=s,u[c]=t[0],u[c+1]=t[1],u[c+2]=t[2],u[c+3]=t[3]}function i(s,u,c){n[0]=s,u[c]=t[3],u[c+1]=t[2],u[c+2]=t[1],u[c+3]=t[0]}e.writeFloatLE=o?r:i,e.writeFloatBE=o?i:r;function a(s,u){return t[0]=s[u],t[1]=s[u+1],t[2]=s[u+2],t[3]=s[u+3],n[0]}function f(s,u){return t[3]=s[u],t[2]=s[u+1],t[1]=s[u+2],t[0]=s[u+3],n[0]}e.readFloatLE=o?a:f,e.readFloatBE=o?f:a}():function(){function n(o,r,i,a){var f=r<0?1:0;if(f&&(r=-r),r===0)o(1/r>0?0:2147483648,i,a);else if(isNaN(r))o(2143289344,i,a);else if(r>34028234663852886e22)o((f<<31|2139095040)>>>0,i,a);else if(r<11754943508222875e-54)o((f<<31|Math.round(r/1401298464324817e-60))>>>0,i,a);else{var s=Math.floor(Math.log(r)/Math.LN2),u=Math.round(r*Math.pow(2,-s)*8388608)&8388607;o((f<<31|s+127<<23|u)>>>0,i,a)}}e.writeFloatLE=n.bind(null,Ot),e.writeFloatBE=n.bind(null,kt);function t(o,r,i){var a=o(r,i),f=(a>>31)*2+1,s=a>>>23&255,u=a&8388607;return s===255?u?NaN:f*(1/0):s===0?f*1401298464324817e-60*u:f*Math.pow(2,s-150)*(u+8388608)}e.readFloatLE=t.bind(null,Ct),e.readFloatBE=t.bind(null,Vt)}(),typeof Float64Array<"u"?function(){var n=new Float64Array([-0]),t=new Uint8Array(n.buffer),o=t[7]===128;function r(s,u,c){n[0]=s,u[c]=t[0],u[c+1]=t[1],u[c+2]=t[2],u[c+3]=t[3],u[c+4]=t[4],u[c+5]=t[5],u[c+6]=t[6],u[c+7]=t[7]}function i(s,u,c){n[0]=s,u[c]=t[7],u[c+1]=t[6],u[c+2]=t[5],u[c+3]=t[4],u[c+4]=t[3],u[c+5]=t[2],u[c+6]=t[1],u[c+7]=t[0]}e.writeDoubleLE=o?r:i,e.writeDoubleBE=o?i:r;function a(s,u){return t[0]=s[u],t[1]=s[u+1],t[2]=s[u+2],t[3]=s[u+3],t[4]=s[u+4],t[5]=s[u+5],t[6]=s[u+6],t[7]=s[u+7],n[0]}function f(s,u){return t[7]=s[u],t[6]=s[u+1],t[5]=s[u+2],t[4]=s[u+3],t[3]=s[u+4],t[2]=s[u+5],t[1]=s[u+6],t[0]=s[u+7],n[0]}e.readDoubleLE=o?a:f,e.readDoubleBE=o?f:a}():function(){function n(o,r,i,a,f,s){var u=a<0?1:0;if(u&&(a=-a),a===0)o(0,f,s+r),o(1/a>0?0:2147483648,f,s+i);else if(isNaN(a))o(0,f,s+r),o(2146959360,f,s+i);else if(a>17976931348623157e292)o(0,f,s+r),o((u<<31|2146435072)>>>0,f,s+i);else{var c;if(a<22250738585072014e-324)c=a/5e-324,o(c>>>0,f,s+r),o((u<<31|c/4294967296)>>>0,f,s+i);else{var E=Math.floor(Math.log(a)/Math.LN2);E===1024&&(E=1023),c=a*Math.pow(2,-E),o(c*4503599627370496>>>0,f,s+r),o((u<<31|E+1023<<20|c*1048576&1048575)>>>0,f,s+i)}}}e.writeDoubleLE=n.bind(null,Ot,0,4),e.writeDoubleBE=n.bind(null,kt,4,0);function t(o,r,i,a,f){var s=o(a,f+r),u=o(a,f+i),c=(u>>31)*2+1,E=u>>>20&2047,y=4294967296*(u&1048575)+s;return E===2047?y?NaN:c*(1/0):E===0?c*5e-324*y:c*Math.pow(2,E-1075)*(y+4503599627370496)}e.readDoubleLE=t.bind(null,Ct,0,4),e.readDoubleBE=t.bind(null,Vt,4,0)}(),e}function Ot(e,n,t){n[t]=e&255,n[t+1]=e>>>8&255,n[t+2]=e>>>16&255,n[t+3]=e>>>24}function kt(e,n,t){n[t]=e>>>24,n[t+1]=e>>>16&255,n[t+2]=e>>>8&255,n[t+3]=e&255}function Ct(e,n){return(e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24)>>>0}function Vt(e,n){return(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0}});var Rt=C((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}});var xt=C(Pt=>{"use strict";var Fn=Pt;Fn.length=function(n){for(var t=0,o=0,r=0;r<n.length;++r)o=n.charCodeAt(r),o<128?t+=1:o<2048?t+=2:(o&64512)===55296&&(n.charCodeAt(r+1)&64512)===56320?(++r,t+=4):t+=3;return t};Fn.read=function(n,t,o){var r=o-t;if(r<1)return"";for(var i=null,a=[],f=0,s;t<o;)s=n[t++],s<128?a[f++]=s:s>191&&s<224?a[f++]=(s&31)<<6|n[t++]&63:s>239&&s<365?(s=((s&7)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,a[f++]=55296+(s>>10),a[f++]=56320+(s&1023)):a[f++]=(s&15)<<12|(n[t++]&63)<<6|n[t++]&63,f>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,a)),f=0);return i?(f&&i.push(String.fromCharCode.apply(String,a.slice(0,f))),i.join("")):String.fromCharCode.apply(String,a.slice(0,f))};Fn.write=function(n,t,o){for(var r=o,i,a,f=0;f<n.length;++f)i=n.charCodeAt(f),i<128?t[o++]=i:i<2048?(t[o++]=i>>6|192,t[o++]=i&63|128):(i&64512)===55296&&((a=n.charCodeAt(f+1))&64512)===56320?(i=65536+((i&1023)<<10)+(a&1023),++f,t[o++]=i>>18|240,t[o++]=i>>12&63|128,t[o++]=i>>6&63|128,t[o++]=i&63|128):(t[o++]=i>>12|224,t[o++]=i>>6&63|128,t[o++]=i&63|128);return o-r}});var At=C((Go,wt)=>{"use strict";wt.exports=Jr;function Jr(e,n,t){var o=t||8192,r=o>>>1,i=null,a=o;return function(s){if(s<1||s>r)return e(s);a+s>o&&(i=e(o),a=0);var u=n.call(i,a,a+=s);return a&7&&(a=(a|7)+1),u}}});var Bt=C((qo,Dt)=>{"use strict";Dt.exports=V;var un=Se();function V(e,n){this.lo=e>>>0,this.hi=n>>>0}var qe=V.zero=new V(0,0);qe.toNumber=function(){return 0};qe.zzEncode=qe.zzDecode=function(){return this};qe.length=function(){return 1};var Ur=V.zeroHash="\0\0\0\0\0\0\0\0";V.fromNumber=function(n){if(n===0)return qe;var t=n<0;t&&(n=-n);var o=n>>>0,r=(n-o)/4294967296>>>0;return t&&(r=~r>>>0,o=~o>>>0,++o>4294967295&&(o=0,++r>4294967295&&(r=0))),new V(o,r)};V.from=function(n){if(typeof n=="number")return V.fromNumber(n);if(un.isString(n))if(un.Long)n=un.Long.fromString(n);else return V.fromNumber(parseInt(n,10));return n.low||n.high?new V(n.low>>>0,n.high>>>0):qe};V.prototype.toNumber=function(n){if(!n&&this.hi>>>31){var t=~this.lo+1>>>0,o=~this.hi>>>0;return t||(o=o+1>>>0),-(t+o*4294967296)}return this.lo+this.hi*4294967296};V.prototype.toLong=function(n){return un.Long?new un.Long(this.lo|0,this.hi|0,!!n):{low:this.lo|0,high:this.hi|0,unsigned:!!n}};var ge=String.prototype.charCodeAt;V.fromHash=function(n){return n===Ur?qe:new V((ge.call(n,0)|ge.call(n,1)<<8|ge.call(n,2)<<16|ge.call(n,3)<<24)>>>0,(ge.call(n,4)|ge.call(n,5)<<8|ge.call(n,6)<<16|ge.call(n,7)<<24)>>>0)};V.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};V.prototype.zzEncode=function(){var n=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^n)>>>0,this.lo=(this.lo<<1^n)>>>0,this};V.prototype.zzDecode=function(){var n=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^n)>>>0,this.hi=(this.hi>>>1^n)>>>0,this};V.prototype.length=function(){var n=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?t===0?n<16384?n<128?1:2:n<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:o<128?9:10}});var Se=C(Rn=>{"use strict";var p=Rn;p.asPromise=St();p.base64=Nt();p.EventEmitter=Tt();p.float=Ft();p.inquire=Rt();p.utf8=xt();p.pool=At();p.LongBits=Bt();p.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);p.global=p.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Rn;p.emptyArray=Object.freeze?Object.freeze([]):[];p.emptyObject=Object.freeze?Object.freeze({}):{};p.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};p.isString=function(n){return typeof n=="string"||n instanceof String};p.isObject=function(n){return n&&typeof n=="object"};p.isset=p.isSet=function(n,t){var o=n[t];return o!=null&&n.hasOwnProperty(t)?typeof o!="object"||(Array.isArray(o)?o.length:Object.keys(o).length)>0:!1};p.Buffer=function(){try{var e=p.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}}();p._Buffer_from=null;p._Buffer_allocUnsafe=null;p.newBuffer=function(n){return typeof n=="number"?p.Buffer?p._Buffer_allocUnsafe(n):new p.Array(n):p.Buffer?p._Buffer_from(n):typeof Uint8Array>"u"?n:new Uint8Array(n)};p.Array=typeof Uint8Array<"u"?Uint8Array:Array;p.Long=p.global.dcodeIO&&p.global.dcodeIO.Long||p.global.Long||p.inquire("long");p.key2Re=/^true|false|0|1$/;p.key32Re=/^-?(?:0|[1-9][0-9]*)$/;p.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;p.longToHash=function(n){return n?p.LongBits.from(n).toHash():p.LongBits.zeroHash};p.longFromHash=function(n,t){var o=p.LongBits.fromHash(n);return p.Long?p.Long.fromBits(o.lo,o.hi,t):o.toNumber(!!t)};function Lt(e,n,t){for(var o=Object.keys(n),r=0;r<o.length;++r)(e[o[r]]===void 0||!t)&&(e[o[r]]=n[o[r]]);return e}p.merge=Lt;p.lcFirst=function(n){return n.charAt(0).toLowerCase()+n.substring(1)};function Mt(e){function n(t,o){if(!(this instanceof n))return new n(t,o);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,n):Object.defineProperty(this,"stack",{value:new Error().stack||""}),o&&Lt(this,o)}return n.prototype=Object.create(Error.prototype,{constructor:{value:n,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),n}p.newError=Mt;p.ProtocolError=Mt("ProtocolError");p.oneOfGetter=function(n){for(var t={},o=0;o<n.length;++o)t[n[o]]=1;return function(){for(var r=Object.keys(this),i=r.length-1;i>-1;--i)if(t[r[i]]===1&&this[r[i]]!==void 0&&this[r[i]]!==null)return r[i]}};p.oneOfSetter=function(n){return function(t){for(var o=0;o<n.length;++o)n[o]!==t&&delete this[n[o]]}};p.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};p._configure=function(){var e=p.Buffer;if(!e){p._Buffer_from=p._Buffer_allocUnsafe=null;return}p._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,o){return new e(t,o)},p._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}}});var Ln=C((Ho,$t)=>{"use strict";$t.exports=m;var H=Se(),Pn,bn=H.LongBits,Jt=H.base64,Ut=H.utf8;function dn(e,n,t){this.fn=e,this.len=n,this.next=void 0,this.val=t}function wn(){}function Wr(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function m(){this.len=0,this.head=new dn(wn,0,0),this.tail=this.head,this.states=null}var Wt=function(){return H.Buffer?function(){return(m.create=function(){return new Pn})()}:function(){return new m}};m.create=Wt();m.alloc=function(n){return new H.Array(n)};H.Array!==Array&&(m.alloc=H.pool(m.alloc,H.Array.prototype.subarray));m.prototype._push=function(n,t,o){return this.tail=this.tail.next=new dn(n,t,o),this.len+=t,this};function An(e,n,t){n[t]=e&255}function $r(e,n,t){for(;e>127;)n[t++]=e&127|128,e>>>=7;n[t]=e}function Dn(e,n){this.len=e,this.next=void 0,this.val=n}Dn.prototype=Object.create(dn.prototype);Dn.prototype.fn=$r;m.prototype.uint32=function(n){return this.len+=(this.tail=this.tail.next=new Dn((n=n>>>0)<128?1:n<16384?2:n<2097152?3:n<268435456?4:5,n)).len,this};m.prototype.int32=function(n){return n<0?this._push(Bn,10,bn.fromNumber(n)):this.uint32(n)};m.prototype.sint32=function(n){return this.uint32((n<<1^n>>31)>>>0)};function Bn(e,n,t){for(;e.hi;)n[t++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)n[t++]=e.lo&127|128,e.lo=e.lo>>>7;n[t++]=e.lo}m.prototype.uint64=function(n){var t=bn.from(n);return this._push(Bn,t.length(),t)};m.prototype.int64=m.prototype.uint64;m.prototype.sint64=function(n){var t=bn.from(n).zzEncode();return this._push(Bn,t.length(),t)};m.prototype.bool=function(n){return this._push(An,1,n?1:0)};function xn(e,n,t){n[t]=e&255,n[t+1]=e>>>8&255,n[t+2]=e>>>16&255,n[t+3]=e>>>24}m.prototype.fixed32=function(n){return this._push(xn,4,n>>>0)};m.prototype.sfixed32=m.prototype.fixed32;m.prototype.fixed64=function(n){var t=bn.from(n);return this._push(xn,4,t.lo)._push(xn,4,t.hi)};m.prototype.sfixed64=m.prototype.fixed64;m.prototype.float=function(n){return this._push(H.float.writeFloatLE,4,n)};m.prototype.double=function(n){return this._push(H.float.writeDoubleLE,8,n)};var Gr=H.Array.prototype.set?function(n,t,o){t.set(n,o)}:function(n,t,o){for(var r=0;r<n.length;++r)t[o+r]=n[r]};m.prototype.bytes=function(n){var t=n.length>>>0;if(!t)return this._push(An,1,0);if(H.isString(n)){var o=m.alloc(t=Jt.length(n));Jt.decode(n,o,0),n=o}return this.uint32(t)._push(Gr,t,n)};m.prototype.string=function(n){var t=Ut.length(n);return t?this.uint32(t)._push(Ut.write,t,n):this._push(An,1,0)};m.prototype.fork=function(){return this.states=new Wr(this),this.head=this.tail=new dn(wn,0,0),this.len=0,this};m.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new dn(wn,0,0),this.len=0),this};m.prototype.ldelim=function(){var n=this.head,t=this.tail,o=this.len;return this.reset().uint32(o),o&&(this.tail.next=n.next,this.tail=t,this.len+=o),this};m.prototype.finish=function(){for(var n=this.head.next,t=this.constructor.alloc(this.len),o=0;n;)n.fn(n.val,t,o),o+=n.len,n=n.next;return t};m._configure=function(e){Pn=e,m.create=Wt(),Pn._configure()}});var Zt=C((Ko,qt)=>{"use strict";qt.exports=re;var Gt=Ln();(re.prototype=Object.create(Gt.prototype)).constructor=re;var ye=Se();function re(){Gt.call(this)}re._configure=function(){re.alloc=ye._Buffer_allocUnsafe,re.writeBytesBuffer=ye.Buffer&&ye.Buffer.prototype instanceof Uint8Array&&ye.Buffer.prototype.set.name==="set"?function(n,t,o){t.set(n,o)}:function(n,t,o){if(n.copy)n.copy(t,o,0,n.length);else for(var r=0;r<n.length;)t[o++]=n[r++]}};re.prototype.bytes=function(n){ye.isString(n)&&(n=ye._Buffer_from(n,"base64"));var t=n.length>>>0;return this.uint32(t),t&&this._push(re.writeBytesBuffer,t,n),this};function qr(e,n,t){e.length<40?ye.utf8.write(e,n,t):n.utf8Write?n.utf8Write(e,t):n.write(e,t)}re.prototype.string=function(n){var t=ye.Buffer.byteLength(n);return this.uint32(t),t&&this._push(qr,t,n),this};re._configure()});var Un=C((zo,Qt)=>{"use strict";Qt.exports=O;var ne=Se(),Jn,zt=ne.LongBits,Zr=ne.utf8;function te(e,n){return RangeError("index out of range: "+e.pos+" + "+(n||1)+" > "+e.len)}function O(e){this.buf=e,this.pos=0,this.len=e.length}var Ht=typeof Uint8Array<"u"?function(n){if(n instanceof Uint8Array||Array.isArray(n))return new O(n);throw Error("illegal buffer")}:function(n){if(Array.isArray(n))return new O(n);throw Error("illegal buffer")},Xt=function(){return ne.Buffer?function(t){return(O.create=function(r){return ne.Buffer.isBuffer(r)?new Jn(r):Ht(r)})(t)}:Ht};O.create=Xt();O.prototype._slice=ne.Array.prototype.subarray||ne.Array.prototype.slice;O.prototype.uint32=function(){var n=4294967295;return function(){if(n=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(n=(n|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(n=(n|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(n=(n|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(n=(n|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return n;if((this.pos+=5)>this.len)throw this.pos=this.len,te(this,10);return n}}();O.prototype.int32=function(){return this.uint32()|0};O.prototype.sint32=function(){var n=this.uint32();return n>>>1^-(n&1)|0};function Mn(){var e=new zt(0,0),n=0;if(this.len-this.pos>4){for(;n<4;++n)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<n*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;n=0}else{for(;n<3;++n){if(this.pos>=this.len)throw te(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<n*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<n*7)>>>0,e}if(this.len-this.pos>4){for(;n<5;++n)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<n*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;n<5;++n){if(this.pos>=this.len)throw te(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<n*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}O.prototype.bool=function(){return this.uint32()!==0};function Nn(e,n){return(e[n-4]|e[n-3]<<8|e[n-2]<<16|e[n-1]<<24)>>>0}O.prototype.fixed32=function(){if(this.pos+4>this.len)throw te(this,4);return Nn(this.buf,this.pos+=4)};O.prototype.sfixed32=function(){if(this.pos+4>this.len)throw te(this,4);return Nn(this.buf,this.pos+=4)|0};function Kt(){if(this.pos+8>this.len)throw te(this,8);return new zt(Nn(this.buf,this.pos+=4),Nn(this.buf,this.pos+=4))}O.prototype.float=function(){if(this.pos+4>this.len)throw te(this,4);var n=ne.float.readFloatLE(this.buf,this.pos);return this.pos+=4,n};O.prototype.double=function(){if(this.pos+8>this.len)throw te(this,4);var n=ne.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,n};O.prototype.bytes=function(){var n=this.uint32(),t=this.pos,o=this.pos+n;if(o>this.len)throw te(this,n);if(this.pos+=n,Array.isArray(this.buf))return this.buf.slice(t,o);if(t===o){var r=ne.Buffer;return r?r.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,o)};O.prototype.string=function(){var n=this.bytes();return Zr.read(n,0,n.length)};O.prototype.skip=function(n){if(typeof n=="number"){if(this.pos+n>this.len)throw te(this,n);this.pos+=n}else do if(this.pos>=this.len)throw te(this);while(this.buf[this.pos++]&128);return this};O.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this};O._configure=function(e){Jn=e,O.create=Xt(),Jn._configure();var n=ne.Long?"toLong":"toNumber";ne.merge(O.prototype,{int64:function(){return Mn.call(this)[n](!1)},uint64:function(){return Mn.call(this)[n](!0)},sint64:function(){return Mn.call(this).zzDecode()[n](!1)},fixed64:function(){return Kt.call(this)[n](!0)},sfixed64:function(){return Kt.call(this)[n](!1)}})}});var ni=C((Xo,ei)=>{"use strict";ei.exports=Ze;var jt=Un();(Ze.prototype=Object.create(jt.prototype)).constructor=Ze;var Yt=Se();function Ze(e){jt.call(this,e)}Ze._configure=function(){Yt.Buffer&&(Ze.prototype._slice=Yt.Buffer.prototype.slice)};Ze.prototype.string=function(){var n=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+n,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+n,this.len))};Ze._configure()});var ii=C((Qo,ti)=>{"use strict";ti.exports=fn;var Wn=Se();(fn.prototype=Object.create(Wn.EventEmitter.prototype)).constructor=fn;function fn(e,n,t){if(typeof e!="function")throw TypeError("rpcImpl must be a function");Wn.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!n,this.responseDelimited=!!t}fn.prototype.rpcCall=function e(n,t,o,r,i){if(!r)throw TypeError("request must be specified");var a=this;if(!i)return Wn.asPromise(e,a,n,t,o,r);if(!a.rpcImpl){setTimeout(function(){i(Error("already ended"))},0);return}try{return a.rpcImpl(n,t[a.requestDelimited?"encodeDelimited":"encode"](r).finish(),function(s,u){if(s)return a.emit("error",s,n),i(s);if(u===null){a.end(!0);return}if(!(u instanceof o))try{u=o[a.responseDelimited?"decodeDelimited":"decode"](u)}catch(c){return a.emit("error",c,n),i(c)}return a.emit("data",u,n),i(null,u)})}catch(f){a.emit("error",f,n),setTimeout(function(){i(f)},0);return}};fn.prototype.end=function(n){return this.rpcImpl&&(n||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var oi=C(ri=>{"use strict";var Hr=ri;Hr.Service=ii()});var si=C((jo,ai)=>{"use strict";ai.exports={}});var fi=C(di=>{"use strict";var B=di;B.build="minimal";B.Writer=Ln();B.BufferWriter=Zt();B.Reader=Un();B.BufferReader=ni();B.util=Se();B.rpc=oi();B.roots=si();B.configure=ui;function ui(){B.util._configure(),B.Writer._configure(B.BufferWriter),B.Reader._configure(B.BufferReader)}ui()});var A=C((na,li)=>{"use strict";li.exports=fi()});var Di=C((va,Ai)=>{Ai.exports=b;var z=null;try{z=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function b(e,n,t){this.low=e|0,this.high=n|0,this.unsigned=!!t}b.prototype.__isLong__;Object.defineProperty(b.prototype,"__isLong__",{value:!0});function M(e){return(e&&e.__isLong__)===!0}b.isLong=M;var ki={},Ci={};function Xe(e,n){var t,o,r;return n?(e>>>=0,(r=0<=e&&e<256)&&(o=Ci[e],o)?o:(t=N(e,(e|0)<0?-1:0,!0),r&&(Ci[e]=t),t)):(e|=0,(r=-128<=e&&e<128)&&(o=ki[e],o)?o:(t=N(e,e<0?-1:0,!1),r&&(ki[e]=t),t))}b.fromInt=Xe;function X(e,n){if(isNaN(e))return n?ze:Q;if(n){if(e<0)return ze;if(e>=Ri)return wi}else{if(e<=-_i)return L;if(e+1>=_i)return xi}return e<0?X(-e,n).neg():N(e%on|0,e/on|0,n)}b.fromNumber=X;function N(e,n,t){return new b(e,n,t)}b.fromBits=N;var In=Math.pow;function Qn(e,n,t){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return Q;if(typeof n=="number"?(t=n,n=!1):n=!!n,t=t||10,t<2||36<t)throw RangeError("radix");var o;if((o=e.indexOf("-"))>0)throw Error("interior hyphen");if(o===0)return Qn(e.substring(1),n,t).neg();for(var r=X(In(t,8)),i=Q,a=0;a<e.length;a+=8){var f=Math.min(8,e.length-a),s=parseInt(e.substring(a,a+f),t);if(f<8){var u=X(In(t,f));i=i.mul(u).add(X(s))}else i=i.mul(r),i=i.add(X(s))}return i.unsigned=n,i}b.fromString=Qn;function ie(e,n){return typeof e=="number"?X(e,n):typeof e=="string"?Qn(e,n):N(e.low,e.high,typeof n=="boolean"?n:e.unsigned)}b.fromValue=ie;var Vi=65536,uo=1<<24,on=Vi*Vi,Ri=on*on,_i=Ri/2,Fi=Xe(uo),Q=Xe(0);b.ZERO=Q;var ze=Xe(0,!0);b.UZERO=ze;var rn=Xe(1);b.ONE=rn;var Pi=Xe(1,!0);b.UONE=Pi;var Xn=Xe(-1);b.NEG_ONE=Xn;var xi=N(-1,2147483647,!1);b.MAX_VALUE=xi;var wi=N(-1,-1,!0);b.MAX_UNSIGNED_VALUE=wi;var L=N(0,-2147483648,!1);b.MIN_VALUE=L;var d=b.prototype;d.toInt=function(){return this.unsigned?this.low>>>0:this.low};d.toNumber=function(){return this.unsigned?(this.high>>>0)*on+(this.low>>>0):this.high*on+(this.low>>>0)};d.toString=function(n){if(n=n||10,n<2||36<n)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(L)){var t=X(n),o=this.div(t),r=o.mul(t).sub(this);return o.toString(n)+r.toInt().toString(n)}else return"-"+this.neg().toString(n);for(var i=X(In(n,6),this.unsigned),a=this,f="";;){var s=a.div(i),u=a.sub(s.mul(i)).toInt()>>>0,c=u.toString(n);if(a=s,a.isZero())return c+f;for(;c.length<6;)c="0"+c;f=""+c+f}};d.getHighBits=function(){return this.high};d.getHighBitsUnsigned=function(){return this.high>>>0};d.getLowBits=function(){return this.low};d.getLowBitsUnsigned=function(){return this.low>>>0};d.getNumBitsAbs=function(){if(this.isNegative())return this.eq(L)?64:this.neg().getNumBitsAbs();for(var n=this.high!=0?this.high:this.low,t=31;t>0&&!(n&1<<t);t--);return this.high!=0?t+33:t+1};d.isZero=function(){return this.high===0&&this.low===0};d.eqz=d.isZero;d.isNegative=function(){return!this.unsigned&&this.high<0};d.isPositive=function(){return this.unsigned||this.high>=0};d.isOdd=function(){return(this.low&1)===1};d.isEven=function(){return(this.low&1)===0};d.equals=function(n){return M(n)||(n=ie(n)),this.unsigned!==n.unsigned&&this.high>>>31===1&&n.high>>>31===1?!1:this.high===n.high&&this.low===n.low};d.eq=d.equals;d.notEquals=function(n){return!this.eq(n)};d.neq=d.notEquals;d.ne=d.notEquals;d.lessThan=function(n){return this.comp(n)<0};d.lt=d.lessThan;d.lessThanOrEqual=function(n){return this.comp(n)<=0};d.lte=d.lessThanOrEqual;d.le=d.lessThanOrEqual;d.greaterThan=function(n){return this.comp(n)>0};d.gt=d.greaterThan;d.greaterThanOrEqual=function(n){return this.comp(n)>=0};d.gte=d.greaterThanOrEqual;d.ge=d.greaterThanOrEqual;d.compare=function(n){if(M(n)||(n=ie(n)),this.eq(n))return 0;var t=this.isNegative(),o=n.isNegative();return t&&!o?-1:!t&&o?1:this.unsigned?n.high>>>0>this.high>>>0||n.high===this.high&&n.low>>>0>this.low>>>0?-1:1:this.sub(n).isNegative()?-1:1};d.comp=d.compare;d.negate=function(){return!this.unsigned&&this.eq(L)?L:this.not().add(rn)};d.neg=d.negate;d.add=function(n){M(n)||(n=ie(n));var t=this.high>>>16,o=this.high&65535,r=this.low>>>16,i=this.low&65535,a=n.high>>>16,f=n.high&65535,s=n.low>>>16,u=n.low&65535,c=0,E=0,y=0,U=0;return U+=i+u,y+=U>>>16,U&=65535,y+=r+s,E+=y>>>16,y&=65535,E+=o+f,c+=E>>>16,E&=65535,c+=t+a,c&=65535,N(y<<16|U,c<<16|E,this.unsigned)};d.subtract=function(n){return M(n)||(n=ie(n)),this.add(n.neg())};d.sub=d.subtract;d.multiply=function(n){if(this.isZero())return Q;if(M(n)||(n=ie(n)),z){var t=z.mul(this.low,this.high,n.low,n.high);return N(t,z.get_high(),this.unsigned)}if(n.isZero())return Q;if(this.eq(L))return n.isOdd()?L:Q;if(n.eq(L))return this.isOdd()?L:Q;if(this.isNegative())return n.isNegative()?this.neg().mul(n.neg()):this.neg().mul(n).neg();if(n.isNegative())return this.mul(n.neg()).neg();if(this.lt(Fi)&&n.lt(Fi))return X(this.toNumber()*n.toNumber(),this.unsigned);var o=this.high>>>16,r=this.high&65535,i=this.low>>>16,a=this.low&65535,f=n.high>>>16,s=n.high&65535,u=n.low>>>16,c=n.low&65535,E=0,y=0,U=0,Sn=0;return Sn+=a*c,U+=Sn>>>16,Sn&=65535,U+=i*c,y+=U>>>16,U&=65535,U+=a*u,y+=U>>>16,U&=65535,y+=r*c,E+=y>>>16,y&=65535,y+=i*u,E+=y>>>16,y&=65535,y+=a*s,E+=y>>>16,y&=65535,E+=o*c+r*u+i*s+a*f,E&=65535,N(U<<16|Sn,E<<16|y,this.unsigned)};d.mul=d.multiply;d.divide=function(n){if(M(n)||(n=ie(n)),n.isZero())throw Error("division by zero");if(z){if(!this.unsigned&&this.high===-2147483648&&n.low===-1&&n.high===-1)return this;var t=(this.unsigned?z.div_u:z.div_s)(this.low,this.high,n.low,n.high);return N(t,z.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?ze:Q;var o,r,i;if(this.unsigned){if(n.unsigned||(n=n.toUnsigned()),n.gt(this))return ze;if(n.gt(this.shru(1)))return Pi;i=ze}else{if(this.eq(L)){if(n.eq(rn)||n.eq(Xn))return L;if(n.eq(L))return rn;var a=this.shr(1);return o=a.div(n).shl(1),o.eq(Q)?n.isNegative()?rn:Xn:(r=this.sub(n.mul(o)),i=o.add(r.div(n)),i)}else if(n.eq(L))return this.unsigned?ze:Q;if(this.isNegative())return n.isNegative()?this.neg().div(n.neg()):this.neg().div(n).neg();if(n.isNegative())return this.div(n.neg()).neg();i=Q}for(r=this;r.gte(n);){o=Math.max(1,Math.floor(r.toNumber()/n.toNumber()));for(var f=Math.ceil(Math.log(o)/Math.LN2),s=f<=48?1:In(2,f-48),u=X(o),c=u.mul(n);c.isNegative()||c.gt(r);)o-=s,u=X(o,this.unsigned),c=u.mul(n);u.isZero()&&(u=rn),i=i.add(u),r=r.sub(c)}return i};d.div=d.divide;d.modulo=function(n){if(M(n)||(n=ie(n)),z){var t=(this.unsigned?z.rem_u:z.rem_s)(this.low,this.high,n.low,n.high);return N(t,z.get_high(),this.unsigned)}return this.sub(this.div(n).mul(n))};d.mod=d.modulo;d.rem=d.modulo;d.not=function(){return N(~this.low,~this.high,this.unsigned)};d.and=function(n){return M(n)||(n=ie(n)),N(this.low&n.low,this.high&n.high,this.unsigned)};d.or=function(n){return M(n)||(n=ie(n)),N(this.low|n.low,this.high|n.high,this.unsigned)};d.xor=function(n){return M(n)||(n=ie(n)),N(this.low^n.low,this.high^n.high,this.unsigned)};d.shiftLeft=function(n){return M(n)&&(n=n.toInt()),(n&=63)===0?this:n<32?N(this.low<<n,this.high<<n|this.low>>>32-n,this.unsigned):N(0,this.low<<n-32,this.unsigned)};d.shl=d.shiftLeft;d.shiftRight=function(n){return M(n)&&(n=n.toInt()),(n&=63)===0?this:n<32?N(this.low>>>n|this.high<<32-n,this.high>>n,this.unsigned):N(this.high>>n-32,this.high>=0?0:-1,this.unsigned)};d.shr=d.shiftRight;d.shiftRightUnsigned=function(n){if(M(n)&&(n=n.toInt()),n&=63,n===0)return this;var t=this.high;if(n<32){var o=this.low;return N(o>>>n|t<<32-n,t>>>n,this.unsigned)}else return n===32?N(t,0,this.unsigned):N(t>>>n-32,0,this.unsigned)};d.shru=d.shiftRightUnsigned;d.shr_u=d.shiftRightUnsigned;d.toSigned=function(){return this.unsigned?N(this.low,this.high,!1):this};d.toUnsigned=function(){return this.unsigned?this:N(this.low,this.high,!0)};d.toBytes=function(n){return n?this.toBytesLE():this.toBytesBE()};d.toBytesLE=function(){var n=this.high,t=this.low;return[t&255,t>>>8&255,t>>>16&255,t>>>24,n&255,n>>>8&255,n>>>16&255,n>>>24]};d.toBytesBE=function(){var n=this.high,t=this.low;return[n>>>24,n>>>16&255,n>>>8&255,n&255,t>>>24,t>>>16&255,t>>>8&255,t&255]};b.fromBytes=function(n,t,o){return o?b.fromBytesLE(n,t):b.fromBytesBE(n,t)};b.fromBytesLE=function(n,t){return new b(n[0]|n[1]<<8|n[2]<<16|n[3]<<24,n[4]|n[5]<<8|n[6]<<16|n[7]<<24,t)};b.fromBytesBE=function(n,t){return new b(n[4]<<24|n[5]<<16|n[6]<<8|n[7],n[0]<<24|n[1]<<16|n[2]<<8|n[3],t)}});var I=w(A(),1);var W=w(A(),1);var l=new Map;var Ke;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ke||(Ke={}));function Kr(e){switch(e){case 0:case"NULL_VALUE":return Ke.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return Ke.UNRECOGNIZED}}function zr(e){switch(e){case Ke.NULL_VALUE:return 0;case Ke.UNRECOGNIZED:default:return-1}}function $n(){return{fields:{}}}var _={$type:"google.protobuf.Struct",encode(e,n=W.default.Writer.create()){return Object.entries(e.fields).forEach(([t,o])=>{o!==void 0&&ln.encode({key:t,value:o},n.uint32(10).fork()).ldelim()}),n},decode(e,n){let t=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=$n();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;let a=ln.decode(t,t.uint32());a.value!==void 0&&(r.fields[a.key]=a.value);continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{fields:pi(e.fields)?Object.entries(e.fields).reduce((n,[t,o])=>(n[t]=o,n),{}):{}}},toJSON(e){let n={};if(e.fields){let t=Object.entries(e.fields);t.length>0&&(n.fields={},t.forEach(([o,r])=>{n.fields[o]=r}))}return n},create(e){return _.fromPartial(e??{})},fromPartial(e){let n=$n();return n.fields=Object.entries(e.fields??{}).reduce((t,[o,r])=>(r!==void 0&&(t[o]=r),t),{}),n},wrap(e){let n=$n();if(e!==void 0)for(let t of Object.keys(e))n.fields[t]=e[t];return n},unwrap(e){let n={};if(e.fields)for(let t of Object.keys(e.fields))n[t]=e.fields[t];return n}};l.set(_.$type,_);function ci(){return{key:"",value:void 0}}var ln={$type:"google.protobuf.Struct.FieldsEntry",encode(e,n=W.default.Writer.create()){return e.key!==""&&n.uint32(10).string(e.key),e.value!==void 0&&F.encode(F.wrap(e.value),n.uint32(18).fork()).ldelim(),n},decode(e,n){let t=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ci();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.key=t.string();continue;case 2:if(i!==18)break;r.value=F.unwrap(F.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{key:tn(e.key)?globalThis.String(e.key):"",value:tn(e?.value)?e.value:void 0}},toJSON(e){let n={};return e.key!==""&&(n.key=e.key),e.value!==void 0&&(n.value=e.value),n},create(e){return ln.fromPartial(e??{})},fromPartial(e){let n=ci();return n.key=e.key??"",n.value=e.value??void 0,n}};l.set(ln.$type,ln);function Gn(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var F={$type:"google.protobuf.Value",encode(e,n=W.default.Writer.create()){return e.nullValue!==void 0&&n.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&n.uint32(17).double(e.numberValue),e.stringValue!==void 0&&n.uint32(26).string(e.stringValue),e.boolValue!==void 0&&n.uint32(32).bool(e.boolValue),e.structValue!==void 0&&_.encode(_.wrap(e.structValue),n.uint32(42).fork()).ldelim(),e.listValue!==void 0&&He.encode(He.wrap(e.listValue),n.uint32(50).fork()).ldelim(),n},decode(e,n){let t=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Gn();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.nullValue=t.int32();continue;case 2:if(i!==17)break;r.numberValue=t.double();continue;case 3:if(i!==26)break;r.stringValue=t.string();continue;case 4:if(i!==32)break;r.boolValue=t.bool();continue;case 5:if(i!==42)break;r.structValue=_.unwrap(_.decode(t,t.uint32()));continue;case 6:if(i!==50)break;r.listValue=He.unwrap(He.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{nullValue:tn(e.nullValue)?Kr(e.nullValue):void 0,numberValue:tn(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:tn(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:tn(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:pi(e.structValue)?e.structValue:void 0,listValue:globalThis.Array.isArray(e.listValue)?[...e.listValue]:void 0}},toJSON(e){let n={};return e.nullValue!==void 0&&(n.nullValue=zr(e.nullValue)),e.numberValue!==void 0&&(n.numberValue=e.numberValue),e.stringValue!==void 0&&(n.stringValue=e.stringValue),e.boolValue!==void 0&&(n.boolValue=e.boolValue),e.structValue!==void 0&&(n.structValue=e.structValue),e.listValue!==void 0&&(n.listValue=e.listValue),n},create(e){return F.fromPartial(e??{})},fromPartial(e){let n=Gn();return n.nullValue=e.nullValue??void 0,n.numberValue=e.numberValue??void 0,n.stringValue=e.stringValue??void 0,n.boolValue=e.boolValue??void 0,n.structValue=e.structValue??void 0,n.listValue=e.listValue??void 0,n},wrap(e){let n=Gn();if(e===null)n.nullValue=Ke.NULL_VALUE;else if(typeof e=="boolean")n.boolValue=e;else if(typeof e=="number")n.numberValue=e;else if(typeof e=="string")n.stringValue=e;else if(globalThis.Array.isArray(e))n.listValue=e;else if(typeof e=="object")n.structValue=e;else if(typeof e<"u")throw new globalThis.Error("Unsupported any value type: "+typeof e);return n},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};l.set(F.$type,F);function qn(){return{values:[]}}var He={$type:"google.protobuf.ListValue",encode(e,n=W.default.Writer.create()){for(let t of e.values)F.encode(F.wrap(t),n.uint32(10).fork()).ldelim();return n},decode(e,n){let t=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=qn();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.values.push(F.unwrap(F.decode(t,t.uint32())));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?[...e.values]:[]}},toJSON(e){let n={};return e.values?.length&&(n.values=e.values),n},create(e){return He.fromPartial(e??{})},fromPartial(e){let n=qn();return n.values=e.values?.map(t=>t)||[],n},wrap(e){let n=qn();return n.values=e??[],n},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};l.set(He.$type,He);function pi(e){return typeof e=="object"&&e!==null}function tn(e){return e!=null}var K;(function(e){e[e.CLIENT_UNSPECIFIED=0]="CLIENT_UNSPECIFIED",e[e.ANDROID=1]="ANDROID",e[e.IOS=2]="IOS",e[e.SHREDDIT=3]="SHREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(K||(K={}));function Xr(e){switch(e){case 0:case"CLIENT_UNSPECIFIED":return K.CLIENT_UNSPECIFIED;case 1:case"ANDROID":return K.ANDROID;case 2:case"IOS":return K.IOS;case 3:case"SHREDDIT":return K.SHREDDIT;case-1:case"UNRECOGNIZED":default:return K.UNRECOGNIZED}}function Qr(e){switch(e){case K.CLIENT_UNSPECIFIED:return 0;case K.ANDROID:return 1;case K.IOS:return 2;case K.SHREDDIT:return 3;case K.UNRECOGNIZED:default:return-1}}function hi(){return{postData:void 0,shareParam:void 0,webViewContext:void 0,webbitToken:"",devvitDebug:"",client:0,nativeVersion:void 0,shredditVersion:void 0}}var Zn={$type:"devvit.ui.effects.web_view.v1alpha.BridgeContext",encode(e,n=I.default.Writer.create()){return e.postData!==void 0&&ae.encode(e.postData,n.uint32(10).fork()).ldelim(),e.shareParam!==void 0&&Ne.encode(e.shareParam,n.uint32(18).fork()).ldelim(),e.webViewContext!==void 0&&oe.encode(e.webViewContext,n.uint32(26).fork()).ldelim(),e.webbitToken!==""&&n.uint32(34).string(e.webbitToken),e.devvitDebug!==""&&n.uint32(42).string(e.devvitDebug),e.client!==0&&n.uint32(48).int32(e.client),e.nativeVersion!==void 0&&ve.encode(e.nativeVersion,n.uint32(58).fork()).ldelim(),e.shredditVersion!==void 0&&be.encode(e.shredditVersion,n.uint32(66).fork()).ldelim(),n},decode(e,n){let t=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=hi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.postData=ae.decode(t,t.uint32());continue;case 2:if(i!==18)break;r.shareParam=Ne.decode(t,t.uint32());continue;case 3:if(i!==26)break;r.webViewContext=oe.decode(t,t.uint32());continue;case 4:if(i!==34)break;r.webbitToken=t.string();continue;case 5:if(i!==42)break;r.devvitDebug=t.string();continue;case 6:if(i!==48)break;r.client=t.int32();continue;case 7:if(i!==58)break;r.nativeVersion=ve.decode(t,t.uint32());continue;case 8:if(i!==66)break;r.shredditVersion=be.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{postData:v(e.postData)?ae.fromJSON(e.postData):void 0,shareParam:v(e.shareParam)?Ne.fromJSON(e.shareParam):void 0,webViewContext:v(e.webViewContext)?oe.fromJSON(e.webViewContext):void 0,webbitToken:v(e.webbitToken)?globalThis.String(e.webbitToken):"",devvitDebug:v(e.devvitDebug)?globalThis.String(e.devvitDebug):"",client:v(e.client)?Xr(e.client):0,nativeVersion:v(e.nativeVersion)?ve.fromJSON(e.nativeVersion):void 0,shredditVersion:v(e.shredditVersion)?be.fromJSON(e.shredditVersion):void 0}},toJSON(e){let n={};return e.postData!==void 0&&(n.postData=ae.toJSON(e.postData)),e.shareParam!==void 0&&(n.shareParam=Ne.toJSON(e.shareParam)),e.webViewContext!==void 0&&(n.webViewContext=oe.toJSON(e.webViewContext)),e.webbitToken!==""&&(n.webbitToken=e.webbitToken),e.devvitDebug!==""&&(n.devvitDebug=e.devvitDebug),e.client!==0&&(n.client=Qr(e.client)),e.nativeVersion!==void 0&&(n.nativeVersion=ve.toJSON(e.nativeVersion)),e.shredditVersion!==void 0&&(n.shredditVersion=be.toJSON(e.shredditVersion)),n},create(e){return Zn.fromPartial(e??{})},fromPartial(e){let n=hi();return n.postData=e.postData!==void 0&&e.postData!==null?ae.fromPartial(e.postData):void 0,n.shareParam=e.shareParam!==void 0&&e.shareParam!==null?Ne.fromPartial(e.shareParam):void 0,n.webViewContext=e.webViewContext!==void 0&&e.webViewContext!==null?oe.fromPartial(e.webViewContext):void 0,n.webbitToken=e.webbitToken??"",n.devvitDebug=e.devvitDebug??"",n.client=e.client??0,n.nativeVersion=e.nativeVersion!==void 0&&e.nativeVersion!==null?ve.fromPartial(e.nativeVersion):void 0,n.shredditVersion=e.shredditVersion!==void 0&&e.shredditVersion!==null?be.fromPartial(e.shredditVersion):void 0,n}};l.set(Zn.$type,Zn);function mi(){return{yyyy:0,release:0,attempt:0,number:0}}var ve={$type:"devvit.ui.effects.web_view.v1alpha.NativeClientVersion",encode(e,n=I.default.Writer.create()){return e.yyyy!==0&&n.uint32(8).int32(e.yyyy),e.release!==0&&n.uint32(16).int32(e.release),e.attempt!==0&&n.uint32(24).int32(e.attempt),e.number!==0&&n.uint32(32).int32(e.number),n},decode(e,n){let t=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=mi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.yyyy=t.int32();continue;case 2:if(i!==16)break;r.release=t.int32();continue;case 3:if(i!==24)break;r.attempt=t.int32();continue;case 4:if(i!==32)break;r.number=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{yyyy:v(e.yyyy)?globalThis.Number(e.yyyy):0,release:v(e.release)?globalThis.Number(e.release):0,attempt:v(e.attempt)?globalThis.Number(e.attempt):0,number:v(e.number)?globalThis.Number(e.number):0}},toJSON(e){let n={};return e.yyyy!==0&&(n.yyyy=Math.round(e.yyyy)),e.release!==0&&(n.release=Math.round(e.release)),e.attempt!==0&&(n.attempt=Math.round(e.attempt)),e.number!==0&&(n.number=Math.round(e.number)),n},create(e){return ve.fromPartial(e??{})},fromPartial(e){let n=mi();return n.yyyy=e.yyyy??0,n.release=e.release??0,n.attempt=e.attempt??0,n.number=e.number??0,n}};l.set(ve.$type,ve);function gi(){return{major:0,minor:0,patch:0,version:""}}var be={$type:"devvit.ui.effects.web_view.v1alpha.SemVer",encode(e,n=I.default.Writer.create()){return e.major!==0&&n.uint32(8).int32(e.major),e.minor!==0&&n.uint32(16).int32(e.minor),e.patch!==0&&n.uint32(24).int32(e.patch),e.version!==""&&n.uint32(34).string(e.version),n},decode(e,n){let t=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=gi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.major=t.int32();continue;case 2:if(i!==16)break;r.minor=t.int32();continue;case 3:if(i!==24)break;r.patch=t.int32();continue;case 4:if(i!==34)break;r.version=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{major:v(e.major)?globalThis.Number(e.major):0,minor:v(e.minor)?globalThis.Number(e.minor):0,patch:v(e.patch)?globalThis.Number(e.patch):0,version:v(e.version)?globalThis.String(e.version):""}},toJSON(e){let n={};return e.major!==0&&(n.major=Math.round(e.major)),e.minor!==0&&(n.minor=Math.round(e.minor)),e.patch!==0&&(n.patch=Math.round(e.patch)),e.version!==""&&(n.version=e.version),n},create(e){return be.fromPartial(e??{})},fromPartial(e){let n=gi();return n.major=e.major??0,n.minor=e.minor??0,n.patch=e.patch??0,n.version=e.version??"",n}};l.set(be.$type,be);function Si(){return{subredditId:"",subredditName:"",userId:"",appName:"",appVersion:"",postId:""}}var oe={$type:"devvit.ui.effects.web_view.v1alpha.WebViewContext",encode(e,n=I.default.Writer.create()){return e.subredditId!==""&&n.uint32(10).string(e.subredditId),e.subredditName!==""&&n.uint32(18).string(e.subredditName),e.userId!==""&&n.uint32(26).string(e.userId),e.appName!==""&&n.uint32(34).string(e.appName),e.appVersion!==""&&n.uint32(42).string(e.appVersion),e.postId!==""&&n.uint32(50).string(e.postId),n},decode(e,n){let t=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Si();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.subredditId=t.string();continue;case 2:if(i!==18)break;r.subredditName=t.string();continue;case 3:if(i!==26)break;r.userId=t.string();continue;case 4:if(i!==34)break;r.appName=t.string();continue;case 5:if(i!==42)break;r.appVersion=t.string();continue;case 6:if(i!==50)break;r.postId=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{subredditId:v(e.subredditId)?globalThis.String(e.subredditId):"",subredditName:v(e.subredditName)?globalThis.String(e.subredditName):"",userId:v(e.userId)?globalThis.String(e.userId):"",appName:v(e.appName)?globalThis.String(e.appName):"",appVersion:v(e.appVersion)?globalThis.String(e.appVersion):"",postId:v(e.postId)?globalThis.String(e.postId):""}},toJSON(e){let n={};return e.subredditId!==""&&(n.subredditId=e.subredditId),e.subredditName!==""&&(n.subredditName=e.subredditName),e.userId!==""&&(n.userId=e.userId),e.appName!==""&&(n.appName=e.appName),e.appVersion!==""&&(n.appVersion=e.appVersion),e.postId!==""&&(n.postId=e.postId),n},create(e){return oe.fromPartial(e??{})},fromPartial(e){let n=Si();return n.subredditId=e.subredditId??"",n.subredditName=e.subredditName??"",n.userId=e.userId??"",n.appName=e.appName??"",n.appVersion=e.appVersion??"",n.postId=e.postId??"",n}};l.set(oe.$type,oe);function yi(){return{developerData:void 0}}var ae={$type:"devvit.ui.effects.web_view.v1alpha.DevvitPostData",encode(e,n=I.default.Writer.create()){return e.developerData!==void 0&&_.encode(_.wrap(e.developerData),n.uint32(18).fork()).ldelim(),n},decode(e,n){let t=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=yi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 2:if(i!==18)break;r.developerData=_.unwrap(_.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{developerData:Ni(e.developerData)?e.developerData:void 0}},toJSON(e){let n={};return e.developerData!==void 0&&(n.developerData=e.developerData),n},create(e){return ae.fromPartial(e??{})},fromPartial(e){let n=yi();return n.developerData=e.developerData??void 0,n}};l.set(ae.$type,ae);function vi(){return{path:"",params:{},hash:""}}var Ne={$type:"devvit.ui.effects.web_view.v1alpha.ShareParam",encode(e,n=I.default.Writer.create()){return e.path!==""&&n.uint32(10).string(e.path),Object.entries(e.params).forEach(([t,o])=>{cn.encode({key:t,value:o},n.uint32(18).fork()).ldelim()}),e.hash!==""&&n.uint32(26).string(e.hash),n},decode(e,n){let t=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=vi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.path=t.string();continue;case 2:if(i!==18)break;let a=cn.decode(t,t.uint32());a.value!==void 0&&(r.params[a.key]=a.value);continue;case 3:if(i!==26)break;r.hash=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{path:v(e.path)?globalThis.String(e.path):"",params:Ni(e.params)?Object.entries(e.params).reduce((n,[t,o])=>(n[t]=String(o),n),{}):{},hash:v(e.hash)?globalThis.String(e.hash):""}},toJSON(e){let n={};if(e.path!==""&&(n.path=e.path),e.params){let t=Object.entries(e.params);t.length>0&&(n.params={},t.forEach(([o,r])=>{n.params[o]=r}))}return e.hash!==""&&(n.hash=e.hash),n},create(e){return Ne.fromPartial(e??{})},fromPartial(e){let n=vi();return n.path=e.path??"",n.params=Object.entries(e.params??{}).reduce((t,[o,r])=>(r!==void 0&&(t[o]=globalThis.String(r)),t),{}),n.hash=e.hash??"",n}};l.set(Ne.$type,Ne);function bi(){return{key:"",value:""}}var cn={$type:"devvit.ui.effects.web_view.v1alpha.ShareParam.ParamsEntry",encode(e,n=I.default.Writer.create()){return e.key!==""&&n.uint32(10).string(e.key),e.value!==""&&n.uint32(18).string(e.value),n},decode(e,n){let t=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=bi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.key=t.string();continue;case 2:if(i!==18)break;r.value=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{key:v(e.key)?globalThis.String(e.key):"",value:v(e.value)?globalThis.String(e.value):""}},toJSON(e){let n={};return e.key!==""&&(n.key=e.key),e.value!==""&&(n.value=e.value),n},create(e){return cn.fromPartial(e??{})},fromPartial(e){let n=bi();return n.key=e.key??"",n.value=e.value??"",n}};l.set(cn.$type,cn);function Ni(e){return typeof e=="object"&&e!==null}function v(e){return e!=null}function En(e,n){if(!e)throw Error(n)}var Ee;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(Ee||(Ee={}));function Yr(e){return e.startsWith(Ee.ACCOUNT)}function jr(e){return e.startsWith(Ee.LINK)}function eo(e){return e.startsWith(Ee.SUBREDDIT)}function no(e){En(Yr(e),`Expected account id to start with ${Ee.ACCOUNT}, got ${e}}`)}function to(e){En(jr(e),`Expected link id to start with ${Ee.LINK}, got ${e}}`)}function io(e){En(eo(e),`Expected subreddit id to start with ${Ee.SUBREDDIT}, got ${e}}`)}function Ei(e){return no(e),e}function Ti(e){return to(e),e}function Ii(e){return io(e),e}var ro=({search:e,hash:n})=>{let t=new URLSearchParams(e).get("context");if(t){let o=decodeURIComponent(t),r=oe.fromJSON(JSON.parse(o)),i=oo(n),a={subredditId:Ii(r.subredditId),userId:Ei(r.userId),subredditName:r.subredditName,appName:r.appName,appVersion:r.appVersion,postId:Ti(r.postId),postData:i?.developerData};globalThis.devvit={context:a}}};globalThis.location&&ro(globalThis.location);function oo(e){let n=e?.slice(1);if(n)try{return ae.fromJSON(JSON.parse(decodeURIComponent(n)))}catch(t){console.error("Error parsing post data from hash",t);return}}var ao=new Proxy({},{get:(e,n)=>globalThis.devvit.context[n],ownKeys(){return Object.keys(globalThis.devvit.context)},getOwnPropertyDescriptor(e,n){return{enumerable:!0,configurable:!0,value:globalThis.devvit.context[n]}}});var Tn=w(A(),1);var se;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.INLINE_MODE=1]="INLINE_MODE",e[e.IMMERSIVE_MODE=2]="IMMERSIVE_MODE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(se||(se={}));function Kn(e){switch(e){case 0:case"UNSPECIFIED":return se.UNSPECIFIED;case 1:case"INLINE_MODE":return se.INLINE_MODE;case 2:case"IMMERSIVE_MODE":return se.IMMERSIVE_MODE;case-1:case"UNRECOGNIZED":default:return se.UNRECOGNIZED}}function zn(e){switch(e){case se.UNSPECIFIED:return 0;case se.INLINE_MODE:return 1;case se.IMMERSIVE_MODE:return 2;case se.UNRECOGNIZED:default:return-1}}function Oi(){return{immersiveMode:0}}var Hn={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,n=Tn.default.Writer.create()){return e.immersiveMode!==0&&n.uint32(8).int32(e.immersiveMode),n},decode(e,n){let t=e instanceof Tn.default.Reader?e:Tn.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Oi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.immersiveMode=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{immersiveMode:so(e.immersiveMode)?Kn(e.immersiveMode):0}},toJSON(e){let n={};return e.immersiveMode!==0&&(n.immersiveMode=zn(e.immersiveMode)),n},create(e){return Hn.fromPartial(e??{})},fromPartial(e){let n=Oi();return n.immersiveMode=e.immersiveMode??0,n}};l.set(Hn.$type,Hn);function so(e){return e!=null}var x=w(A(),1);var P=w(A(),1);var S=w(A(),1);var Yn=w(Di(),1),Qe=w(A(),1);function Bi(){return{seconds:0,nanos:0}}var Ye={$type:"google.protobuf.Timestamp",encode(e,n=Qe.default.Writer.create()){return e.seconds!==0&&n.uint32(8).int64(e.seconds),e.nanos!==0&&n.uint32(16).int32(e.nanos),n},decode(e,n){let t=e instanceof Qe.default.Reader?e:Qe.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Bi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.seconds=fo(t.int64());continue;case 2:if(i!==16)break;r.nanos=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{seconds:Li(e.seconds)?globalThis.Number(e.seconds):0,nanos:Li(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let n={};return e.seconds!==0&&(n.seconds=Math.round(e.seconds)),e.nanos!==0&&(n.nanos=Math.round(e.nanos)),n},create(e){return Ye.fromPartial(e??{})},fromPartial(e){let n=Bi();return n.seconds=e.seconds??0,n.nanos=e.nanos??0,n}};l.set(Ye.$type,Ye);function fo(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}Qe.default.util.Long!==Yn.default&&(Qe.default.util.Long=Yn.default,Qe.default.configure());function Li(e){return e!=null}var ue;(function(e){e[e.CONSENT_STATUS_UNKNOWN=0]="CONSENT_STATUS_UNKNOWN",e[e.REVOKED=1]="REVOKED",e[e.GRANTED=2]="GRANTED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ue||(ue={}));function ot(e){switch(e){case 0:case"CONSENT_STATUS_UNKNOWN":return ue.CONSENT_STATUS_UNKNOWN;case 1:case"REVOKED":return ue.REVOKED;case 2:case"GRANTED":return ue.GRANTED;case-1:case"UNRECOGNIZED":default:return ue.UNRECOGNIZED}}function at(e){switch(e){case ue.CONSENT_STATUS_UNKNOWN:return 0;case ue.REVOKED:return 1;case ue.GRANTED:return 2;case ue.UNRECOGNIZED:default:return-1}}var Y;(function(e){e[e.SCOPE_UNKNOWN=0]="SCOPE_UNKNOWN",e[e.SUBMIT_POST=1]="SUBMIT_POST",e[e.SUBMIT_COMMENT=2]="SUBMIT_COMMENT",e[e.SUBSCRIBE_TO_SUBREDDIT=3]="SUBSCRIBE_TO_SUBREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Y||(Y={}));function On(e){switch(e){case 0:case"SCOPE_UNKNOWN":return Y.SCOPE_UNKNOWN;case 1:case"SUBMIT_POST":return Y.SUBMIT_POST;case 2:case"SUBMIT_COMMENT":return Y.SUBMIT_COMMENT;case 3:case"SUBSCRIBE_TO_SUBREDDIT":return Y.SUBSCRIBE_TO_SUBREDDIT;case-1:case"UNRECOGNIZED":default:return Y.UNRECOGNIZED}}function kn(e){switch(e){case Y.SCOPE_UNKNOWN:return 0;case Y.SUBMIT_POST:return 1;case Y.SUBMIT_COMMENT:return 2;case Y.SUBSCRIBE_TO_SUBREDDIT:return 3;case Y.UNRECOGNIZED:default:return-1}}function Mi(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}var Te={$type:"reddit.devvit.app_permission.v1.AppPermission",encode(e,n=S.default.Writer.create()){e.appSlug!==""&&n.uint32(10).string(e.appSlug),e.subredditId!==""&&n.uint32(18).string(e.subredditId),n.uint32(26).fork();for(let t of e.scopes)n.int32(t);return n.ldelim(),e.consentStatus!==0&&n.uint32(32).int32(e.consentStatus),e.updatedAt!==void 0&&Ye.encode(lo(e.updatedAt),n.uint32(42).fork()).ldelim(),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Mi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=t.string();continue;case 2:if(i!==18)break;r.subredditId=t.string();continue;case 3:if(i===24){r.scopes.push(t.int32());continue}if(i===26){let a=t.uint32()+t.pos;for(;t.pos<a;)r.scopes.push(t.int32());continue}break;case 4:if(i!==32)break;r.consentStatus=t.int32();continue;case 5:if(i!==42)break;r.updatedAt=Ki(Ye.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{appSlug:R(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:R(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(n=>On(n)):[],consentStatus:R(e.consentStatus)?ot(e.consentStatus):0,updatedAt:R(e.updatedAt)?co(e.updatedAt):void 0}},toJSON(e){let n={};return e.appSlug!==""&&(n.appSlug=e.appSlug),e.subredditId!==""&&(n.subredditId=e.subredditId),e.scopes?.length&&(n.scopes=e.scopes.map(t=>kn(t))),e.consentStatus!==0&&(n.consentStatus=at(e.consentStatus)),e.updatedAt!==void 0&&(n.updatedAt=e.updatedAt.toISOString()),n},create(e){return Te.fromPartial(e??{})},fromPartial(e){let n=Mi();return n.appSlug=e.appSlug??"",n.subredditId=e.subredditId??"",n.scopes=e.scopes?.map(t=>t)||[],n.consentStatus=e.consentStatus??0,n.updatedAt=e.updatedAt??void 0,n}};l.set(Te.$type,Te);function Ji(){return{appSlug:"",appName:""}}var Ie={$type:"reddit.devvit.app_permission.v1.DevvitApp",encode(e,n=S.default.Writer.create()){return e.appSlug!==""&&n.uint32(10).string(e.appSlug),e.appName!==""&&n.uint32(18).string(e.appName),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Ji();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=t.string();continue;case 2:if(i!==18)break;r.appName=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{appSlug:R(e.appSlug)?globalThis.String(e.appSlug):"",appName:R(e.appName)?globalThis.String(e.appName):""}},toJSON(e){let n={};return e.appSlug!==""&&(n.appSlug=e.appSlug),e.appName!==""&&(n.appName=e.appName),n},create(e){return Ie.fromPartial(e??{})},fromPartial(e){let n=Ji();return n.appSlug=e.appSlug??"",n.appName=e.appName??"",n}};l.set(Ie.$type,Ie);function Ui(){return{userId:""}}var jn={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdRequest",encode(e,n=S.default.Writer.create()){return e.userId!==""&&n.uint32(10).string(e.userId),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Ui();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.userId=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{userId:R(e.userId)?globalThis.String(e.userId):""}},toJSON(e){let n={};return e.userId!==""&&(n.userId=e.userId),n},create(e){return jn.fromPartial(e??{})},fromPartial(e){let n=Ui();return n.userId=e.userId??"",n}};l.set(jn.$type,jn);function Wi(){return{appPermissions:[],devvitApps:[]}}var et={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,n=S.default.Writer.create()){for(let t of e.appPermissions)Te.encode(t,n.uint32(10).fork()).ldelim();for(let t of e.devvitApps)Ie.encode(t,n.uint32(18).fork()).ldelim();return n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Wi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appPermissions.push(Te.decode(t,t.uint32()));continue;case 2:if(i!==18)break;r.devvitApps.push(Ie.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{appPermissions:globalThis.Array.isArray(e?.appPermissions)?e.appPermissions.map(n=>Te.fromJSON(n)):[],devvitApps:globalThis.Array.isArray(e?.devvitApps)?e.devvitApps.map(n=>Ie.fromJSON(n)):[]}},toJSON(e){let n={};return e.appPermissions?.length&&(n.appPermissions=e.appPermissions.map(t=>Te.toJSON(t))),e.devvitApps?.length&&(n.devvitApps=e.devvitApps.map(t=>Ie.toJSON(t))),n},create(e){return et.fromPartial(e??{})},fromPartial(e){let n=Wi();return n.appPermissions=e.appPermissions?.map(t=>Te.fromPartial(t))||[],n.devvitApps=e.devvitApps?.map(t=>Ie.fromPartial(t))||[],n}};l.set(et.$type,et);function $i(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}var nt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionRequest",encode(e,n=S.default.Writer.create()){e.userId!==""&&n.uint32(10).string(e.userId),e.appSlug!==""&&n.uint32(18).string(e.appSlug),e.subredditId!==""&&n.uint32(26).string(e.subredditId),n.uint32(34).fork();for(let t of e.scopes)n.int32(t);return n.ldelim(),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=$i();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.userId=t.string();continue;case 2:if(i!==18)break;r.appSlug=t.string();continue;case 3:if(i!==26)break;r.subredditId=t.string();continue;case 4:if(i===32){r.scopes.push(t.int32());continue}if(i===34){let a=t.uint32()+t.pos;for(;t.pos<a;)r.scopes.push(t.int32());continue}break}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{userId:R(e.userId)?globalThis.String(e.userId):"",appSlug:R(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:R(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(n=>On(n)):[]}},toJSON(e){let n={};return e.userId!==""&&(n.userId=e.userId),e.appSlug!==""&&(n.appSlug=e.appSlug),e.subredditId!==""&&(n.subredditId=e.subredditId),e.scopes?.length&&(n.scopes=e.scopes.map(t=>kn(t))),n},create(e){return nt.fromPartial(e??{})},fromPartial(e){let n=$i();return n.userId=e.userId??"",n.appSlug=e.appSlug??"",n.subredditId=e.subredditId??"",n.scopes=e.scopes?.map(t=>t)||[],n}};l.set(nt.$type,nt);function Gi(){return{error:void 0}}var tt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode(e,n=S.default.Writer.create()){return e.error!==void 0&&$.encode(e.error,n.uint32(10).fork()).ldelim(),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Gi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.error=$.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{error:R(e.error)?$.fromJSON(e.error):void 0}},toJSON(e){let n={};return e.error!==void 0&&(n.error=$.toJSON(e.error)),n},create(e){return tt.fromPartial(e??{})},fromPartial(e){let n=Gi();return n.error=e.error!==void 0&&e.error!==null?$.fromPartial(e.error):void 0,n}};l.set(tt.$type,tt);function qi(){return{appSlug:"",userId:"",subredditId:""}}var it={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionRequest",encode(e,n=S.default.Writer.create()){return e.appSlug!==""&&n.uint32(10).string(e.appSlug),e.userId!==""&&n.uint32(18).string(e.userId),e.subredditId!==""&&n.uint32(26).string(e.subredditId),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=qi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=t.string();continue;case 2:if(i!==18)break;r.userId=t.string();continue;case 3:if(i!==26)break;r.subredditId=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{appSlug:R(e.appSlug)?globalThis.String(e.appSlug):"",userId:R(e.userId)?globalThis.String(e.userId):"",subredditId:R(e.subredditId)?globalThis.String(e.subredditId):""}},toJSON(e){let n={};return e.appSlug!==""&&(n.appSlug=e.appSlug),e.userId!==""&&(n.userId=e.userId),e.subredditId!==""&&(n.subredditId=e.subredditId),n},create(e){return it.fromPartial(e??{})},fromPartial(e){let n=qi();return n.appSlug=e.appSlug??"",n.userId=e.userId??"",n.subredditId=e.subredditId??"",n}};l.set(it.$type,it);function Zi(){return{error:void 0}}var rt={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode(e,n=S.default.Writer.create()){return e.error!==void 0&&$.encode(e.error,n.uint32(10).fork()).ldelim(),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Zi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.error=$.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{error:R(e.error)?$.fromJSON(e.error):void 0}},toJSON(e){let n={};return e.error!==void 0&&(n.error=$.toJSON(e.error)),n},create(e){return rt.fromPartial(e??{})},fromPartial(e){let n=Zi();return n.error=e.error!==void 0&&e.error!==null?$.fromPartial(e.error):void 0,n}};l.set(rt.$type,rt);function Hi(){return{message:""}}var $={$type:"reddit.devvit.app_permission.v1.ErrorMessage",encode(e,n=S.default.Writer.create()){return e.message!==""&&n.uint32(10).string(e.message),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Hi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.message=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{message:R(e.message)?globalThis.String(e.message):""}},toJSON(e){let n={};return e.message!==""&&(n.message=e.message),n},create(e){return $.fromPartial(e??{})},fromPartial(e){let n=Hi();return n.message=e.message??"",n}};l.set($.$type,$);function lo(e){let n=Math.trunc(e.getTime()/1e3),t=e.getTime()%1e3*1e6;return{seconds:n,nanos:t}}function Ki(e){let n=(e.seconds||0)*1e3;return n+=(e.nanos||0)/1e6,new globalThis.Date(n)}function co(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):Ki(Ye.fromJSON(e))}function R(e){return e!=null}function zi(){return{app:void 0,scopes:[],subreddit:void 0,redditor:void 0}}var st={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect",encode(e,n=P.default.Writer.create()){e.app!==void 0&&ke.encode(e.app,n.uint32(10).fork()).ldelim(),n.uint32(18).fork();for(let t of e.scopes)n.int32(t);return n.ldelim(),e.subreddit!==void 0&&Ce.encode(e.subreddit,n.uint32(26).fork()).ldelim(),e.redditor!==void 0&&Oe.encode(e.redditor,n.uint32(34).fork()).ldelim(),n},decode(e,n){let t=e instanceof P.default.Reader?e:P.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=zi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.app=ke.decode(t,t.uint32());continue;case 2:if(i===16){r.scopes.push(t.int32());continue}if(i===18){let a=t.uint32()+t.pos;for(;t.pos<a;)r.scopes.push(t.int32());continue}break;case 3:if(i!==26)break;r.subreddit=Ce.decode(t,t.uint32());continue;case 4:if(i!==34)break;r.redditor=Oe.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{app:D(e.app)?ke.fromJSON(e.app):void 0,scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(n=>On(n)):[],subreddit:D(e.subreddit)?Ce.fromJSON(e.subreddit):void 0,redditor:D(e.redditor)?Oe.fromJSON(e.redditor):void 0}},toJSON(e){let n={};return e.app!==void 0&&(n.app=ke.toJSON(e.app)),e.scopes?.length&&(n.scopes=e.scopes.map(t=>kn(t))),e.subreddit!==void 0&&(n.subreddit=Ce.toJSON(e.subreddit)),e.redditor!==void 0&&(n.redditor=Oe.toJSON(e.redditor)),n},create(e){return st.fromPartial(e??{})},fromPartial(e){let n=zi();return n.app=e.app!==void 0&&e.app!==null?ke.fromPartial(e.app):void 0,n.scopes=e.scopes?.map(t=>t)||[],n.subreddit=e.subreddit!==void 0&&e.subreddit!==null?Ce.fromPartial(e.subreddit):void 0,n.redditor=e.redditor!==void 0&&e.redditor!==null?Oe.fromPartial(e.redditor):void 0,n}};l.set(st.$type,st);function Xi(){return{id:"",icon:void 0,snoovatarIcon:void 0}}var Oe={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect.Redditor",encode(e,n=P.default.Writer.create()){return e.id!==""&&n.uint32(10).string(e.id),e.icon!==void 0&&n.uint32(18).string(e.icon),e.snoovatarIcon!==void 0&&n.uint32(26).string(e.snoovatarIcon),n},decode(e,n){let t=e instanceof P.default.Reader?e:P.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Xi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.id=t.string();continue;case 2:if(i!==18)break;r.icon=t.string();continue;case 3:if(i!==26)break;r.snoovatarIcon=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{id:D(e.id)?globalThis.String(e.id):"",icon:D(e.icon)?globalThis.String(e.icon):void 0,snoovatarIcon:D(e.snoovatarIcon)?globalThis.String(e.snoovatarIcon):void 0}},toJSON(e){let n={};return e.id!==""&&(n.id=e.id),e.icon!==void 0&&(n.icon=e.icon),e.snoovatarIcon!==void 0&&(n.snoovatarIcon=e.snoovatarIcon),n},create(e){return Oe.fromPartial(e??{})},fromPartial(e){let n=Xi();return n.id=e.id??"",n.icon=e.icon??void 0,n.snoovatarIcon=e.snoovatarIcon??void 0,n}};l.set(Oe.$type,Oe);function Qi(){return{appSlug:"",appName:"",termsAndConditionsUrl:void 0,privacyPolicyUrl:void 0}}var ke={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect.DevvitApp",encode(e,n=P.default.Writer.create()){return e.appSlug!==""&&n.uint32(10).string(e.appSlug),e.appName!==""&&n.uint32(18).string(e.appName),e.termsAndConditionsUrl!==void 0&&n.uint32(26).string(e.termsAndConditionsUrl),e.privacyPolicyUrl!==void 0&&n.uint32(34).string(e.privacyPolicyUrl),n},decode(e,n){let t=e instanceof P.default.Reader?e:P.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Qi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=t.string();continue;case 2:if(i!==18)break;r.appName=t.string();continue;case 3:if(i!==26)break;r.termsAndConditionsUrl=t.string();continue;case 4:if(i!==34)break;r.privacyPolicyUrl=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{appSlug:D(e.appSlug)?globalThis.String(e.appSlug):"",appName:D(e.appName)?globalThis.String(e.appName):"",termsAndConditionsUrl:D(e.termsAndConditionsUrl)?globalThis.String(e.termsAndConditionsUrl):void 0,privacyPolicyUrl:D(e.privacyPolicyUrl)?globalThis.String(e.privacyPolicyUrl):void 0}},toJSON(e){let n={};return e.appSlug!==""&&(n.appSlug=e.appSlug),e.appName!==""&&(n.appName=e.appName),e.termsAndConditionsUrl!==void 0&&(n.termsAndConditionsUrl=e.termsAndConditionsUrl),e.privacyPolicyUrl!==void 0&&(n.privacyPolicyUrl=e.privacyPolicyUrl),n},create(e){return ke.fromPartial(e??{})},fromPartial(e){let n=Qi();return n.appSlug=e.appSlug??"",n.appName=e.appName??"",n.termsAndConditionsUrl=e.termsAndConditionsUrl??void 0,n.privacyPolicyUrl=e.privacyPolicyUrl??void 0,n}};l.set(ke.$type,ke);function Yi(){return{id:"",name:"",isNsfw:void 0,icon:void 0}}var Ce={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect.Subreddit",encode(e,n=P.default.Writer.create()){return e.id!==""&&n.uint32(10).string(e.id),e.name!==""&&n.uint32(18).string(e.name),e.isNsfw!==void 0&&n.uint32(24).bool(e.isNsfw),e.icon!==void 0&&n.uint32(34).string(e.icon),n},decode(e,n){let t=e instanceof P.default.Reader?e:P.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Yi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.id=t.string();continue;case 2:if(i!==18)break;r.name=t.string();continue;case 3:if(i!==24)break;r.isNsfw=t.bool();continue;case 4:if(i!==34)break;r.icon=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{id:D(e.id)?globalThis.String(e.id):"",name:D(e.name)?globalThis.String(e.name):"",isNsfw:D(e.isNsfw)?globalThis.Boolean(e.isNsfw):void 0,icon:D(e.icon)?globalThis.String(e.icon):void 0}},toJSON(e){let n={};return e.id!==""&&(n.id=e.id),e.name!==""&&(n.name=e.name),e.isNsfw!==void 0&&(n.isNsfw=e.isNsfw),e.icon!==void 0&&(n.icon=e.icon),n},create(e){return Ce.fromPartial(e??{})},fromPartial(e){let n=Yi();return n.id=e.id??"",n.name=e.name??"",n.isNsfw=e.isNsfw??void 0,n.icon=e.icon??void 0,n}};l.set(Ce.$type,Ce);function ji(){return{consentStatus:0}}var de={$type:"devvit.ui.effects.v1alpha.AppPermissionsConsentSubmittedEvent",encode(e,n=P.default.Writer.create()){return e.consentStatus!==0&&n.uint32(8).int32(e.consentStatus),n},decode(e,n){let t=e instanceof P.default.Reader?e:P.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ji();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.consentStatus=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{consentStatus:D(e.consentStatus)?ot(e.consentStatus):0}},toJSON(e){let n={};return e.consentStatus!==0&&(n.consentStatus=at(e.consentStatus)),n},create(e){return de.fromPartial(e??{})},fromPartial(e){let n=ji();return n.consentStatus=e.consentStatus??0,n}};l.set(de.$type,de);function D(e){return e!=null}var en=w(A(),1);var je=w(A(),1);var Cn=w(A(),1);function er(){return{}}var Vn={$type:"google.protobuf.Empty",encode(e,n=Cn.default.Writer.create()){return n},decode(e,n){let t=e instanceof Cn.default.Reader?e:Cn.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=er();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Vn.fromPartial(e??{})},fromPartial(e){return er()}};l.set(Vn.$type,Vn);function nr(){return{channels:[]}}var ut={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,n=je.default.Writer.create()){for(let t of e.channels)n.uint32(10).string(t);return n},decode(e,n){let t=e instanceof je.default.Reader?e:je.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=nr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.channels.push(t.string());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{channels:globalThis.Array.isArray(e?.channels)?e.channels.map(n=>globalThis.String(n)):[]}},toJSON(e){let n={};return e.channels?.length&&(n.channels=e.channels),n},create(e){return ut.fromPartial(e??{})},fromPartial(e){let n=nr();return n.channels=e.channels?.map(t=>t)||[],n}};l.set(ut.$type,ut);function tr(){return{channel:"",data:void 0}}var fe={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,n=je.default.Writer.create()){return e.channel!==""&&n.uint32(10).string(e.channel),e.data!==void 0&&_.encode(_.wrap(e.data),n.uint32(18).fork()).ldelim(),n},decode(e,n){let t=e instanceof je.default.Reader?e:je.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=tr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.channel=t.string();continue;case 2:if(i!==18)break;r.data=_.unwrap(_.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{channel:ho(e.channel)?globalThis.String(e.channel):"",data:po(e.data)?e.data:void 0}},toJSON(e){let n={};return e.channel!==""&&(n.channel=e.channel),e.data!==void 0&&(n.data=e.data),n},create(e){return fe.fromPartial(e??{})},fromPartial(e){let n=tr();return n.channel=e.channel??"",n.data=e.data??void 0,n}};l.set(fe.$type,fe);function po(e){return typeof e=="object"&&e!==null}function ho(e){return e!=null}var Ve;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ve||(Ve={}));function mo(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return Ve.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return Ve.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return Ve.UNRECOGNIZED}}function go(e){switch(e){case Ve.REALTIME_SUBSCRIBED:return 0;case Ve.REALTIME_UNSUBSCRIBED:return 1;case Ve.UNRECOGNIZED:default:return-1}}function ir(){return{subscriptionIds:[]}}var dt={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,n=en.default.Writer.create()){for(let t of e.subscriptionIds)n.uint32(10).string(t);return n},decode(e,n){let t=e instanceof en.default.Reader?e:en.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ir();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.subscriptionIds.push(t.string());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{subscriptionIds:globalThis.Array.isArray(e?.subscriptionIds)?e.subscriptionIds.map(n=>globalThis.String(n)):[]}},toJSON(e){let n={};return e.subscriptionIds?.length&&(n.subscriptionIds=e.subscriptionIds),n},create(e){return dt.fromPartial(e??{})},fromPartial(e){let n=ir();return n.subscriptionIds=e.subscriptionIds?.map(t=>t)||[],n}};l.set(dt.$type,dt);function rr(){return{event:void 0,status:void 0}}var le={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,n=en.default.Writer.create()){return e.event!==void 0&&fe.encode(e.event,n.uint32(10).fork()).ldelim(),e.status!==void 0&&n.uint32(16).int32(e.status),n},decode(e,n){let t=e instanceof en.default.Reader?e:en.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=rr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.event=fe.decode(t,t.uint32());continue;case 2:if(i!==16)break;r.status=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{event:or(e.event)?fe.fromJSON(e.event):void 0,status:or(e.status)?mo(e.status):void 0}},toJSON(e){let n={};return e.event!==void 0&&(n.event=fe.toJSON(e.event)),e.status!==void 0&&(n.status=go(e.status)),n},create(e){return le.fromPartial(e??{})},fromPartial(e){let n=rr();return n.event=e.event!==void 0&&e.event!==null?fe.fromPartial(e.event):void 0,n.status=e.status??void 0,n}};l.set(le.$type,le);function or(e){return e!=null}var Z=w(A(),1);var _n=w(A(),1);var g=w(A(),1);var k;(function(e){e[e.STRING=0]="STRING",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.LIST=4]="LIST",e[e.SELECTION=5]="SELECTION",e[e.GROUP=6]="GROUP",e[e.IMAGE=7]="IMAGE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(k||(k={}));function an(e){switch(e){case 0:case"STRING":return k.STRING;case 1:case"PARAGRAPH":return k.PARAGRAPH;case 2:case"NUMBER":return k.NUMBER;case 3:case"BOOLEAN":return k.BOOLEAN;case 4:case"LIST":return k.LIST;case 5:case"SELECTION":return k.SELECTION;case 6:case"GROUP":return k.GROUP;case 7:case"IMAGE":return k.IMAGE;case-1:case"UNRECOGNIZED":default:return k.UNRECOGNIZED}}function sn(e){switch(e){case k.STRING:return 0;case k.PARAGRAPH:return 1;case k.NUMBER:return 2;case k.BOOLEAN:return 3;case k.LIST:return 4;case k.SELECTION:return 5;case k.GROUP:return 6;case k.IMAGE:return 7;case k.UNRECOGNIZED:default:return-1}}var G=w(A(),1);function ar(){return{fieldType:0,isSecret:void 0,stringValue:void 0,numberValue:void 0,boolValue:void 0,listValue:void 0,selectionValue:void 0,groupValue:void 0}}var T={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,n=G.default.Writer.create()){return e.fieldType!==0&&n.uint32(8).int32(e.fieldType),e.isSecret!==void 0&&n.uint32(800).bool(e.isSecret),e.stringValue!==void 0&&n.uint32(18).string(e.stringValue),e.numberValue!==void 0&&n.uint32(25).double(e.numberValue),e.boolValue!==void 0&&n.uint32(32).bool(e.boolValue),e.listValue!==void 0&&_e.encode(e.listValue,n.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&Fe.encode(e.selectionValue,n.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&Re.encode(e.groupValue,n.uint32(58).fork()).ldelim(),n},decode(e,n){let t=e instanceof G.default.Reader?e:G.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ar();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.fieldType=t.int32();continue;case 100:if(i!==800)break;r.isSecret=t.bool();continue;case 2:if(i!==18)break;r.stringValue=t.string();continue;case 3:if(i!==25)break;r.numberValue=t.double();continue;case 4:if(i!==32)break;r.boolValue=t.bool();continue;case 5:if(i!==42)break;r.listValue=_e.decode(t,t.uint32());continue;case 6:if(i!==50)break;r.selectionValue=Fe.decode(t,t.uint32());continue;case 7:if(i!==58)break;r.groupValue=Re.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{fieldType:ce(e.fieldType)?an(e.fieldType):0,isSecret:ce(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:ce(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:ce(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:ce(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:ce(e.listValue)?_e.fromJSON(e.listValue):void 0,selectionValue:ce(e.selectionValue)?Fe.fromJSON(e.selectionValue):void 0,groupValue:ce(e.groupValue)?Re.fromJSON(e.groupValue):void 0}},toJSON(e){let n={};return e.fieldType!==0&&(n.fieldType=sn(e.fieldType)),e.isSecret!==void 0&&(n.isSecret=e.isSecret),e.stringValue!==void 0&&(n.stringValue=e.stringValue),e.numberValue!==void 0&&(n.numberValue=e.numberValue),e.boolValue!==void 0&&(n.boolValue=e.boolValue),e.listValue!==void 0&&(n.listValue=_e.toJSON(e.listValue)),e.selectionValue!==void 0&&(n.selectionValue=Fe.toJSON(e.selectionValue)),e.groupValue!==void 0&&(n.groupValue=Re.toJSON(e.groupValue)),n},create(e){return T.fromPartial(e??{})},fromPartial(e){let n=ar();return n.fieldType=e.fieldType??0,n.isSecret=e.isSecret??void 0,n.stringValue=e.stringValue??void 0,n.numberValue=e.numberValue??void 0,n.boolValue=e.boolValue??void 0,n.listValue=e.listValue!==void 0&&e.listValue!==null?_e.fromPartial(e.listValue):void 0,n.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?Fe.fromPartial(e.selectionValue):void 0,n.groupValue=e.groupValue!==void 0&&e.groupValue!==null?Re.fromPartial(e.groupValue):void 0,n}};l.set(T.$type,T);function sr(){return{itemType:0,items:[]}}var _e={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,n=G.default.Writer.create()){e.itemType!==0&&n.uint32(8).int32(e.itemType);for(let t of e.items)T.encode(t,n.uint32(18).fork()).ldelim();return n},decode(e,n){let t=e instanceof G.default.Reader?e:G.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=sr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.itemType=t.int32();continue;case 2:if(i!==18)break;r.items.push(T.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{itemType:ce(e.itemType)?an(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(n=>T.fromJSON(n)):[]}},toJSON(e){let n={};return e.itemType!==0&&(n.itemType=sn(e.itemType)),e.items?.length&&(n.items=e.items.map(t=>T.toJSON(t))),n},create(e){return _e.fromPartial(e??{})},fromPartial(e){let n=sr();return n.itemType=e.itemType??0,n.items=e.items?.map(t=>T.fromPartial(t))||[],n}};l.set(_e.$type,_e);function ur(){return{values:[]}}var Fe={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,n=G.default.Writer.create()){for(let t of e.values)n.uint32(10).string(t);return n},decode(e,n){let t=e instanceof G.default.Reader?e:G.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ur();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.values.push(t.string());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?e.values.map(n=>globalThis.String(n)):[]}},toJSON(e){let n={};return e.values?.length&&(n.values=e.values),n},create(e){return Fe.fromPartial(e??{})},fromPartial(e){let n=ur();return n.values=e.values?.map(t=>t)||[],n}};l.set(Fe.$type,Fe);function dr(){return{}}var Re={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,n=G.default.Writer.create()){return n},decode(e,n){let t=e instanceof G.default.Reader?e:G.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=dr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Re.fromPartial(e??{})},fromPartial(e){return dr()}};l.set(Re.$type,Re);function ce(e){return e!=null}function fr(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var J={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,n=g.default.Writer.create()){return e.fieldId!==""&&n.uint32(10).string(e.fieldId),e.fieldType!==0&&n.uint32(16).int32(e.fieldType),e.label!==""&&n.uint32(26).string(e.label),e.helpText!==void 0&&n.uint32(34).string(e.helpText),e.defaultValue!==void 0&&T.encode(e.defaultValue,n.uint32(42).fork()).ldelim(),e.required!==void 0&&n.uint32(48).bool(e.required),e.disabled!==void 0&&n.uint32(56).bool(e.disabled),e.fieldConfig!==void 0&&q.encode(e.fieldConfig,n.uint32(66).fork()).ldelim(),e.isSecret!==void 0&&n.uint32(72).bool(e.isSecret),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=fr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fieldId=t.string();continue;case 2:if(i!==16)break;r.fieldType=t.int32();continue;case 3:if(i!==26)break;r.label=t.string();continue;case 4:if(i!==34)break;r.helpText=t.string();continue;case 5:if(i!==42)break;r.defaultValue=T.decode(t,t.uint32());continue;case 6:if(i!==48)break;r.required=t.bool();continue;case 7:if(i!==56)break;r.disabled=t.bool();continue;case 8:if(i!==66)break;r.fieldConfig=q.decode(t,t.uint32());continue;case 9:if(i!==72)break;r.isSecret=t.bool();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{fieldId:h(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:h(e.fieldType)?an(e.fieldType):0,label:h(e.label)?globalThis.String(e.label):"",helpText:h(e.helpText)?globalThis.String(e.helpText):void 0,defaultValue:h(e.defaultValue)?T.fromJSON(e.defaultValue):void 0,required:h(e.required)?globalThis.Boolean(e.required):void 0,disabled:h(e.disabled)?globalThis.Boolean(e.disabled):void 0,fieldConfig:h(e.fieldConfig)?q.fromJSON(e.fieldConfig):void 0,isSecret:h(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let n={};return e.fieldId!==""&&(n.fieldId=e.fieldId),e.fieldType!==0&&(n.fieldType=sn(e.fieldType)),e.label!==""&&(n.label=e.label),e.helpText!==void 0&&(n.helpText=e.helpText),e.defaultValue!==void 0&&(n.defaultValue=T.toJSON(e.defaultValue)),e.required!==void 0&&(n.required=e.required),e.disabled!==void 0&&(n.disabled=e.disabled),e.fieldConfig!==void 0&&(n.fieldConfig=q.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(n.isSecret=e.isSecret),n},create(e){return J.fromPartial(e??{})},fromPartial(e){let n=fr();return n.fieldId=e.fieldId??"",n.fieldType=e.fieldType??0,n.label=e.label??"",n.helpText=e.helpText??void 0,n.defaultValue=e.defaultValue!==void 0&&e.defaultValue!==null?T.fromPartial(e.defaultValue):void 0,n.required=e.required??void 0,n.disabled=e.disabled??void 0,n.fieldConfig=e.fieldConfig!==void 0&&e.fieldConfig!==null?q.fromPartial(e.fieldConfig):void 0,n.isSecret=e.isSecret??void 0,n}};l.set(J.$type,J);function lr(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var q={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,n=g.default.Writer.create()){return e.stringConfig!==void 0&&Pe.encode(e.stringConfig,n.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&xe.encode(e.paragraphConfig,n.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&we.encode(e.numberConfig,n.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&Ae.encode(e.booleanConfig,n.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&De.encode(e.listConfig,n.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&Be.encode(e.selectionConfig,n.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&Me.encode(e.groupConfig,n.uint32(58).fork()).ldelim(),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=lr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.stringConfig=Pe.decode(t,t.uint32());continue;case 2:if(i!==18)break;r.paragraphConfig=xe.decode(t,t.uint32());continue;case 3:if(i!==26)break;r.numberConfig=we.decode(t,t.uint32());continue;case 4:if(i!==34)break;r.booleanConfig=Ae.decode(t,t.uint32());continue;case 5:if(i!==42)break;r.listConfig=De.decode(t,t.uint32());continue;case 6:if(i!==50)break;r.selectionConfig=Be.decode(t,t.uint32());continue;case 7:if(i!==58)break;r.groupConfig=Me.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{stringConfig:h(e.stringConfig)?Pe.fromJSON(e.stringConfig):void 0,paragraphConfig:h(e.paragraphConfig)?xe.fromJSON(e.paragraphConfig):void 0,numberConfig:h(e.numberConfig)?we.fromJSON(e.numberConfig):void 0,booleanConfig:h(e.booleanConfig)?Ae.fromJSON(e.booleanConfig):void 0,listConfig:h(e.listConfig)?De.fromJSON(e.listConfig):void 0,selectionConfig:h(e.selectionConfig)?Be.fromJSON(e.selectionConfig):void 0,groupConfig:h(e.groupConfig)?Me.fromJSON(e.groupConfig):void 0}},toJSON(e){let n={};return e.stringConfig!==void 0&&(n.stringConfig=Pe.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(n.paragraphConfig=xe.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(n.numberConfig=we.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(n.booleanConfig=Ae.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(n.listConfig=De.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(n.selectionConfig=Be.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(n.groupConfig=Me.toJSON(e.groupConfig)),n},create(e){return q.fromPartial(e??{})},fromPartial(e){let n=lr();return n.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?Pe.fromPartial(e.stringConfig):void 0,n.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?xe.fromPartial(e.paragraphConfig):void 0,n.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?we.fromPartial(e.numberConfig):void 0,n.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?Ae.fromPartial(e.booleanConfig):void 0,n.listConfig=e.listConfig!==void 0&&e.listConfig!==null?De.fromPartial(e.listConfig):void 0,n.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?Be.fromPartial(e.selectionConfig):void 0,n.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?Me.fromPartial(e.groupConfig):void 0,n}};l.set(q.$type,q);function cr(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var Pe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.String",encode(e,n=g.default.Writer.create()){return e.minLength!==void 0&&n.uint32(8).int32(e.minLength),e.maxLength!==void 0&&n.uint32(16).int32(e.maxLength),e.placeholder!==void 0&&n.uint32(26).string(e.placeholder),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=cr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.minLength=t.int32();continue;case 2:if(i!==16)break;r.maxLength=t.int32();continue;case 3:if(i!==26)break;r.placeholder=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{minLength:h(e.minLength)?globalThis.Number(e.minLength):void 0,maxLength:h(e.maxLength)?globalThis.Number(e.maxLength):void 0,placeholder:h(e.placeholder)?globalThis.String(e.placeholder):void 0}},toJSON(e){let n={};return e.minLength!==void 0&&(n.minLength=Math.round(e.minLength)),e.maxLength!==void 0&&(n.maxLength=Math.round(e.maxLength)),e.placeholder!==void 0&&(n.placeholder=e.placeholder),n},create(e){return Pe.fromPartial(e??{})},fromPartial(e){let n=cr();return n.minLength=e.minLength??void 0,n.maxLength=e.maxLength??void 0,n.placeholder=e.placeholder??void 0,n}};l.set(Pe.$type,Pe);function pr(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var xe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Paragraph",encode(e,n=g.default.Writer.create()){return e.maxCharacters!==void 0&&n.uint32(8).int32(e.maxCharacters),e.lineHeight!==void 0&&n.uint32(16).int32(e.lineHeight),e.placeholder!==void 0&&n.uint32(26).string(e.placeholder),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=pr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.maxCharacters=t.int32();continue;case 2:if(i!==16)break;r.lineHeight=t.int32();continue;case 3:if(i!==26)break;r.placeholder=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{maxCharacters:h(e.maxCharacters)?globalThis.Number(e.maxCharacters):void 0,lineHeight:h(e.lineHeight)?globalThis.Number(e.lineHeight):void 0,placeholder:h(e.placeholder)?globalThis.String(e.placeholder):void 0}},toJSON(e){let n={};return e.maxCharacters!==void 0&&(n.maxCharacters=Math.round(e.maxCharacters)),e.lineHeight!==void 0&&(n.lineHeight=Math.round(e.lineHeight)),e.placeholder!==void 0&&(n.placeholder=e.placeholder),n},create(e){return xe.fromPartial(e??{})},fromPartial(e){let n=pr();return n.maxCharacters=e.maxCharacters??void 0,n.lineHeight=e.lineHeight??void 0,n.placeholder=e.placeholder??void 0,n}};l.set(xe.$type,xe);function hr(){return{step:void 0,min:void 0,max:void 0}}var we={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Number",encode(e,n=g.default.Writer.create()){return e.step!==void 0&&n.uint32(9).double(e.step),e.min!==void 0&&n.uint32(17).double(e.min),e.max!==void 0&&n.uint32(25).double(e.max),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=hr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==9)break;r.step=t.double();continue;case 2:if(i!==17)break;r.min=t.double();continue;case 3:if(i!==25)break;r.max=t.double();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{step:h(e.step)?globalThis.Number(e.step):void 0,min:h(e.min)?globalThis.Number(e.min):void 0,max:h(e.max)?globalThis.Number(e.max):void 0}},toJSON(e){let n={};return e.step!==void 0&&(n.step=e.step),e.min!==void 0&&(n.min=e.min),e.max!==void 0&&(n.max=e.max),n},create(e){return we.fromPartial(e??{})},fromPartial(e){let n=hr();return n.step=e.step??void 0,n.min=e.min??void 0,n.max=e.max??void 0,n}};l.set(we.$type,we);function mr(){return{}}var Ae={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Boolean",encode(e,n=g.default.Writer.create()){return n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=mr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Ae.fromPartial(e??{})},fromPartial(e){return mr()}};l.set(Ae.$type,Ae);function gr(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var De={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.List",encode(e,n=g.default.Writer.create()){return e.itemType!==0&&n.uint32(8).int32(e.itemType),e.itemConfig!==void 0&&q.encode(e.itemConfig,n.uint32(18).fork()).ldelim(),e.minEntries!==void 0&&n.uint32(24).int32(e.minEntries),e.maxEntries!==void 0&&n.uint32(32).int32(e.maxEntries),e.entryLabel!==void 0&&n.uint32(42).string(e.entryLabel),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=gr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.itemType=t.int32();continue;case 2:if(i!==18)break;r.itemConfig=q.decode(t,t.uint32());continue;case 3:if(i!==24)break;r.minEntries=t.int32();continue;case 4:if(i!==32)break;r.maxEntries=t.int32();continue;case 5:if(i!==42)break;r.entryLabel=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{itemType:h(e.itemType)?an(e.itemType):0,itemConfig:h(e.itemConfig)?q.fromJSON(e.itemConfig):void 0,minEntries:h(e.minEntries)?globalThis.Number(e.minEntries):void 0,maxEntries:h(e.maxEntries)?globalThis.Number(e.maxEntries):void 0,entryLabel:h(e.entryLabel)?globalThis.String(e.entryLabel):void 0}},toJSON(e){let n={};return e.itemType!==0&&(n.itemType=sn(e.itemType)),e.itemConfig!==void 0&&(n.itemConfig=q.toJSON(e.itemConfig)),e.minEntries!==void 0&&(n.minEntries=Math.round(e.minEntries)),e.maxEntries!==void 0&&(n.maxEntries=Math.round(e.maxEntries)),e.entryLabel!==void 0&&(n.entryLabel=e.entryLabel),n},create(e){return De.fromPartial(e??{})},fromPartial(e){let n=gr();return n.itemType=e.itemType??0,n.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?q.fromPartial(e.itemConfig):void 0,n.minEntries=e.minEntries??void 0,n.maxEntries=e.maxEntries??void 0,n.entryLabel=e.entryLabel??void 0,n}};l.set(De.$type,De);function Sr(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var Be={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,n=g.default.Writer.create()){for(let t of e.choices)Le.encode(t,n.uint32(10).fork()).ldelim();return e.multiSelect!==void 0&&n.uint32(16).bool(e.multiSelect),e.minSelections!==void 0&&n.uint32(24).int32(e.minSelections),e.maxSelections!==void 0&&n.uint32(32).int32(e.maxSelections),e.renderAsList!==void 0&&n.uint32(40).bool(e.renderAsList),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Sr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.choices.push(Le.decode(t,t.uint32()));continue;case 2:if(i!==16)break;r.multiSelect=t.bool();continue;case 3:if(i!==24)break;r.minSelections=t.int32();continue;case 4:if(i!==32)break;r.maxSelections=t.int32();continue;case 5:if(i!==40)break;r.renderAsList=t.bool();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{choices:globalThis.Array.isArray(e?.choices)?e.choices.map(n=>Le.fromJSON(n)):[],multiSelect:h(e.multiSelect)?globalThis.Boolean(e.multiSelect):void 0,minSelections:h(e.minSelections)?globalThis.Number(e.minSelections):void 0,maxSelections:h(e.maxSelections)?globalThis.Number(e.maxSelections):void 0,renderAsList:h(e.renderAsList)?globalThis.Boolean(e.renderAsList):void 0}},toJSON(e){let n={};return e.choices?.length&&(n.choices=e.choices.map(t=>Le.toJSON(t))),e.multiSelect!==void 0&&(n.multiSelect=e.multiSelect),e.minSelections!==void 0&&(n.minSelections=Math.round(e.minSelections)),e.maxSelections!==void 0&&(n.maxSelections=Math.round(e.maxSelections)),e.renderAsList!==void 0&&(n.renderAsList=e.renderAsList),n},create(e){return Be.fromPartial(e??{})},fromPartial(e){let n=Sr();return n.choices=e.choices?.map(t=>Le.fromPartial(t))||[],n.multiSelect=e.multiSelect??void 0,n.minSelections=e.minSelections??void 0,n.maxSelections=e.maxSelections??void 0,n.renderAsList=e.renderAsList??void 0,n}};l.set(Be.$type,Be);function yr(){return{label:"",value:""}}var Le={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection.Item",encode(e,n=g.default.Writer.create()){return e.label!==""&&n.uint32(10).string(e.label),e.value!==""&&n.uint32(18).string(e.value),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=yr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.label=t.string();continue;case 2:if(i!==18)break;r.value=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{label:h(e.label)?globalThis.String(e.label):"",value:h(e.value)?globalThis.String(e.value):""}},toJSON(e){let n={};return e.label!==""&&(n.label=e.label),e.value!==""&&(n.value=e.value),n},create(e){return Le.fromPartial(e??{})},fromPartial(e){let n=yr();return n.label=e.label??"",n.value=e.value??"",n}};l.set(Le.$type,Le);function vr(){return{fields:[]}}var Me={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,n=g.default.Writer.create()){for(let t of e.fields)J.encode(t,n.uint32(10).fork()).ldelim();return n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=vr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fields.push(J.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(n=>J.fromJSON(n)):[]}},toJSON(e){let n={};return e.fields?.length&&(n.fields=e.fields.map(t=>J.toJSON(t))),n},create(e){return Me.fromPartial(e??{})},fromPartial(e){let n=vr();return n.fields=e.fields?.map(t=>J.fromPartial(t))||[],n}};l.set(Me.$type,Me);function h(e){return e!=null}function br(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var pe={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,n=_n.default.Writer.create()){for(let t of e.fields)J.encode(t,n.uint32(10).fork()).ldelim();return e.title!==void 0&&n.uint32(18).string(e.title),e.shortDescription!==void 0&&n.uint32(26).string(e.shortDescription),e.acceptLabel!==void 0&&n.uint32(34).string(e.acceptLabel),e.cancelLabel!==void 0&&n.uint32(42).string(e.cancelLabel),e.id!==void 0&&n.uint32(50).string(e.id),n},decode(e,n){let t=e instanceof _n.default.Reader?e:_n.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=br();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fields.push(J.decode(t,t.uint32()));continue;case 2:if(i!==18)break;r.title=t.string();continue;case 3:if(i!==26)break;r.shortDescription=t.string();continue;case 4:if(i!==34)break;r.acceptLabel=t.string();continue;case 5:if(i!==42)break;r.cancelLabel=t.string();continue;case 6:if(i!==50)break;r.id=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(n=>J.fromJSON(n)):[],title:pn(e.title)?globalThis.String(e.title):void 0,shortDescription:pn(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:pn(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:pn(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:pn(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let n={};return e.fields?.length&&(n.fields=e.fields.map(t=>J.toJSON(t))),e.title!==void 0&&(n.title=e.title),e.shortDescription!==void 0&&(n.shortDescription=e.shortDescription),e.acceptLabel!==void 0&&(n.acceptLabel=e.acceptLabel),e.cancelLabel!==void 0&&(n.cancelLabel=e.cancelLabel),e.id!==void 0&&(n.id=e.id),n},create(e){return pe.fromPartial(e??{})},fromPartial(e){let n=br();return n.fields=e.fields?.map(t=>J.fromPartial(t))||[],n.title=e.title??void 0,n.shortDescription=e.shortDescription??void 0,n.acceptLabel=e.acceptLabel??void 0,n.cancelLabel=e.cancelLabel??void 0,n.id=e.id??void 0,n}};l.set(pe.$type,pe);function pn(e){return e!=null}function Nr(){return{form:void 0}}var ft={$type:"devvit.ui.effects.v1alpha.ShowFormEffect",encode(e,n=Z.default.Writer.create()){return e.form!==void 0&&pe.encode(e.form,n.uint32(10).fork()).ldelim(),n},decode(e,n){let t=e instanceof Z.default.Reader?e:Z.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Nr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.form=pe.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{form:mn(e.form)?pe.fromJSON(e.form):void 0}},toJSON(e){let n={};return e.form!==void 0&&(n.form=pe.toJSON(e.form)),n},create(e){return ft.fromPartial(e??{})},fromPartial(e){let n=Nr();return n.form=e.form!==void 0&&e.form!==null?pe.fromPartial(e.form):void 0,n}};l.set(ft.$type,ft);function Er(){return{results:{},formId:void 0}}var he={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent",encode(e,n=Z.default.Writer.create()){return Object.entries(e.results).forEach(([t,o])=>{hn.encode({key:t,value:o},n.uint32(10).fork()).ldelim()}),e.formId!==void 0&&n.uint32(18).string(e.formId),n},decode(e,n){let t=e instanceof Z.default.Reader?e:Z.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Er();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;let a=hn.decode(t,t.uint32());a.value!==void 0&&(r.results[a.key]=a.value);continue;case 2:if(i!==18)break;r.formId=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{results:So(e.results)?Object.entries(e.results).reduce((n,[t,o])=>(n[t]=T.fromJSON(o),n),{}):{},formId:mn(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let n={};if(e.results){let t=Object.entries(e.results);t.length>0&&(n.results={},t.forEach(([o,r])=>{n.results[o]=T.toJSON(r)}))}return e.formId!==void 0&&(n.formId=e.formId),n},create(e){return he.fromPartial(e??{})},fromPartial(e){let n=Er();return n.results=Object.entries(e.results??{}).reduce((t,[o,r])=>(r!==void 0&&(t[o]=T.fromPartial(r)),t),{}),n.formId=e.formId??void 0,n}};l.set(he.$type,he);function Tr(){return{key:"",value:void 0}}var hn={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,n=Z.default.Writer.create()){return e.key!==""&&n.uint32(10).string(e.key),e.value!==void 0&&T.encode(e.value,n.uint32(18).fork()).ldelim(),n},decode(e,n){let t=e instanceof Z.default.Reader?e:Z.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Tr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.key=t.string();continue;case 2:if(i!==18)break;r.value=T.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{key:mn(e.key)?globalThis.String(e.key):"",value:mn(e.value)?T.fromJSON(e.value):void 0}},toJSON(e){let n={};return e.key!==""&&(n.key=e.key),e.value!==void 0&&(n.value=T.toJSON(e.value)),n},create(e){return hn.fromPartial(e??{})},fromPartial(e){let n=Tr();return n.key=e.key??"",n.value=e.value!==void 0&&e.value!==null?T.fromPartial(e.value):void 0,n}};l.set(hn.$type,hn);function Ir(){return{formId:void 0}}var me={$type:"devvit.ui.effects.v1alpha.FormCanceledEvent",encode(e,n=Z.default.Writer.create()){return e.formId!==void 0&&n.uint32(10).string(e.formId),n},decode(e,n){let t=e instanceof Z.default.Reader?e:Z.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Ir();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.formId=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{formId:mn(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let n={};return e.formId!==void 0&&(n.formId=e.formId),n},create(e){return me.fromPartial(e??{})},fromPartial(e){let n=Ir();return n.formId=e.formId??void 0,n}};l.set(me.$type,me);function So(e){return typeof e=="object"&&e!==null}function mn(e){return e!=null}var $e;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})($e||($e={}));function yo(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return $e.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return $e.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return $e.UNRECOGNIZED}}function vo(e){switch(e){case $e.WEBVIEW_VISIBLE:return 0;case $e.WEBVIEW_HIDDEN:return 1;case $e.UNRECOGNIZED:default:return-1}}function Or(){return{message:void 0,jsonString:""}}var Je={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,n=x.default.Writer.create()){return e.message!==void 0&&F.encode(F.wrap(e.message),n.uint32(10).fork()).ldelim(),e.jsonString!==""&&n.uint32(18).string(e.jsonString),n},decode(e,n){let t=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Or();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.message=F.unwrap(F.decode(t,t.uint32()));continue;case 2:if(i!==18)break;r.jsonString=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{message:j(e?.message)?e.message:void 0,jsonString:j(e.jsonString)?globalThis.String(e.jsonString):""}},toJSON(e){let n={};return e.message!==void 0&&(n.message=e.message),e.jsonString!==""&&(n.jsonString=e.jsonString),n},create(e){return Je.fromPartial(e??{})},fromPartial(e){let n=Or();return n.message=e.message??void 0,n.jsonString=e.jsonString??"",n}};l.set(Je.$type,Je);function kr(){return{visibility:0}}var Ue={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,n=x.default.Writer.create()){return e.visibility!==0&&n.uint32(8).int32(e.visibility),n},decode(e,n){let t=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=kr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.visibility=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{visibility:j(e.visibility)?yo(e.visibility):0}},toJSON(e){let n={};return e.visibility!==0&&(n.visibility=vo(e.visibility)),n},create(e){return Ue.fromPartial(e??{})},fromPartial(e){let n=kr();return n.visibility=e.visibility??0,n}};l.set(Ue.$type,Ue);function Cr(){return{postMessage:void 0,fullScreen:void 0}}var lt={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,n=x.default.Writer.create()){return e.postMessage!==void 0&&Je.encode(e.postMessage,n.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&Ue.encode(e.fullScreen,n.uint32(18).fork()).ldelim(),n},decode(e,n){let t=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Cr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.postMessage=Je.decode(t,t.uint32());continue;case 2:if(i!==18)break;r.fullScreen=Ue.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{postMessage:j(e.postMessage)?Je.fromJSON(e.postMessage):void 0,fullScreen:j(e.fullScreen)?Ue.fromJSON(e.fullScreen):void 0}},toJSON(e){let n={};return e.postMessage!==void 0&&(n.postMessage=Je.toJSON(e.postMessage)),e.fullScreen!==void 0&&(n.fullScreen=Ue.toJSON(e.fullScreen)),n},create(e){return lt.fromPartial(e??{})},fromPartial(e){let n=Cr();return n.postMessage=e.postMessage!==void 0&&e.postMessage!==null?Je.fromPartial(e.postMessage):void 0,n.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?Ue.fromPartial(e.fullScreen):void 0,n}};l.set(lt.$type,lt);function Vr(){return{immersiveMode:0}}var We={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode(e,n=x.default.Writer.create()){return e.immersiveMode!==0&&n.uint32(8).int32(e.immersiveMode),n},decode(e,n){let t=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Vr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.immersiveMode=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{immersiveMode:j(e.immersiveMode)?Kn(e.immersiveMode):0}},toJSON(e){let n={};return e.immersiveMode!==0&&(n.immersiveMode=zn(e.immersiveMode)),n},create(e){return We.fromPartial(e??{})},fromPartial(e){let n=Vr();return n.immersiveMode=e.immersiveMode??0,n}};l.set(We.$type,We);function _r(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,appPermissionsConsentSubmitted:void 0}}var gn={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,n=x.default.Writer.create()){return e.id!==""&&n.uint32(10).string(e.id),e.formCanceled!==void 0&&me.encode(e.formCanceled,n.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&he.encode(e.formSubmitted,n.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&le.encode(e.realtimeEvent,n.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&We.encode(e.immersiveModeEvent,n.uint32(42).fork()).ldelim(),e.appPermissionsConsentSubmitted!==void 0&&de.encode(e.appPermissionsConsentSubmitted,n.uint32(50).fork()).ldelim(),n},decode(e,n){let t=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=_r();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.id=t.string();continue;case 2:if(i!==18)break;r.formCanceled=me.decode(t,t.uint32());continue;case 3:if(i!==26)break;r.formSubmitted=he.decode(t,t.uint32());continue;case 4:if(i!==34)break;r.realtimeEvent=le.decode(t,t.uint32());continue;case 5:if(i!==42)break;r.immersiveModeEvent=We.decode(t,t.uint32());continue;case 6:if(i!==50)break;r.appPermissionsConsentSubmitted=de.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{id:j(e.id)?globalThis.String(e.id):"",formCanceled:j(e.formCanceled)?me.fromJSON(e.formCanceled):void 0,formSubmitted:j(e.formSubmitted)?he.fromJSON(e.formSubmitted):void 0,realtimeEvent:j(e.realtimeEvent)?le.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:j(e.immersiveModeEvent)?We.fromJSON(e.immersiveModeEvent):void 0,appPermissionsConsentSubmitted:j(e.appPermissionsConsentSubmitted)?de.fromJSON(e.appPermissionsConsentSubmitted):void 0}},toJSON(e){let n={};return e.id!==""&&(n.id=e.id),e.formCanceled!==void 0&&(n.formCanceled=me.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(n.formSubmitted=he.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(n.realtimeEvent=le.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(n.immersiveModeEvent=We.toJSON(e.immersiveModeEvent)),e.appPermissionsConsentSubmitted!==void 0&&(n.appPermissionsConsentSubmitted=de.toJSON(e.appPermissionsConsentSubmitted)),n},create(e){return gn.fromPartial(e??{})},fromPartial(e){let n=_r();return n.id=e.id??"",n.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?me.fromPartial(e.formCanceled):void 0,n.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?he.fromPartial(e.formSubmitted):void 0,n.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?le.fromPartial(e.realtimeEvent):void 0,n.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?We.fromPartial(e.immersiveModeEvent):void 0,n.appPermissionsConsentSubmitted=e.appPermissionsConsentSubmitted!==void 0&&e.appPermissionsConsentSubmitted!==null?de.fromPartial(e.appPermissionsConsentSubmitted):void 0,n}};l.set(gn.$type,gn);function j(e){return e!=null}var bo=[3],Ge=e=>new Promise(n=>{let t={scope:0,type:"devvit-internal"};if(e.realtimeSubscriptions?t.realtimeEffect=e.realtimeSubscriptions:t.effect=e,bo.includes(e.type)){let o=self.crypto.randomUUID();t.id=o;let r=i=>{if(i.data?.type==="devvit-message"&&i.data?.data?.id===o){let a=gn.fromJSON(i.data.data);n(a),window.removeEventListener("message",r)}};window.addEventListener("message",r),window.parent.postMessage(t,"*")}else window.parent.postMessage(t,"*"),n(void 0)});var ct=new Set;function No(e){return Fr(2,e)}function Eo(e){return Fr(1,e)}function To(e){ct.add(e)}function Io(e){ct.delete(e)}async function Fr(e,n){if(!n.isTrusted)throw console.error("Immersive mode effect ignored due to untrusted event"),new Error("Untrusted event");await Ge({type:9,immersiveMode:{immersiveMode:e}})}typeof addEventListener=="function"&&addEventListener("message",e=>{let{type:n,data:t}=e.data;if(n!=="devvit-message"||!t.immersiveMode)return;let r=e.data.data?.immersiveMode?.immersiveMode===2?"immersive":"inline";ct.forEach(i=>i(r))});function Oo(e){let n;typeof e=="string"?n=new URL(e).toString():n=new URL(e.url).toString(),Ge({navigateToUrl:{url:n},type:5})}function pt(e,n=new Set){for(let t of e){if(t.type==="group"){pt(t.fields,n);continue}let o=t.name;if(n.has(o))throw new Error(`Duplicate field name: ${o}`);n.add(o)}ko(e)}function ko(e){for(let n of e)if(n.type==="string"&&n.isSecret&&n.scope!=="app")throw`Invalid setting: only app settings can be secrets. Add "scope: SettingScope.App" to field "${n.name}"`}function Co(e){switch(e.fieldType){case 0:return e.stringValue;case 7:return e.stringValue;case 1:return e.stringValue;case 2:return e.numberValue;case 3:return e.boolValue;case 5:return e.selectionValue?.values??[];default:return}}function Rr(e){return Object.keys(e).reduce((n,t)=>{let o=Co(e[t]);return o!==void 0&&(n[t]=o),n},{})}function ht(e){return e.map(n=>{switch(n.type){case"string":return Vo(n);case"image":return _o(n);case"paragraph":return Fo(n);case"number":return Ro(n);case"select":return Po(n);case"boolean":return xo(n);case"group":return wo(n);default:throw new Error("Unknown field type.")}})}function Vo(e){return{defaultValue:{fieldType:0,stringValue:e.defaultValue},disabled:e.disabled,fieldConfig:{stringConfig:{placeholder:e.placeholder}},fieldId:e.name,fieldType:0,helpText:e.helpText,label:e.label,required:e.required,isSecret:e.isSecret}}function _o(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function Fo(e){return{defaultValue:{fieldType:1,stringValue:e.defaultValue},disabled:e.disabled,fieldConfig:{paragraphConfig:{lineHeight:e.lineHeight,placeholder:e.placeholder}},fieldId:e.name,fieldType:1,helpText:e.helpText,label:e.label,required:e.required}}function Ro(e){return{defaultValue:{fieldType:2,numberValue:e.defaultValue},disabled:e.disabled,fieldConfig:{numberConfig:{}},fieldId:e.name,fieldType:2,helpText:e.helpText,label:e.label,required:e.required}}function Po(e){return{defaultValue:{fieldType:5,selectionValue:{values:e.defaultValue??[]}},disabled:e.disabled,fieldConfig:{selectionConfig:{choices:e.options,multiSelect:e.multiSelect}},fieldId:e.name,fieldType:5,helpText:e.helpText,label:e.label,required:e.required}}function xo(e){return{defaultValue:{fieldType:3,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:3,helpText:e.helpText,label:e.label}}function wo(e){return{fieldId:"",fieldType:6,fieldConfig:{groupConfig:{fields:ht(e.fields)}},label:e.label,helpText:e.helpText}}var Pr=1,Ao=()=>(Pr++,`form.${Pr}`),Do=async e=>{let n={fields:[],id:Ao(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};pt(e.fields),n.fields=ht(e.fields);let t=await Ge({showForm:{form:n},type:3});return!t||!t.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:Rr(t.formSubmitted.results)}};function Bo(e){let n;e instanceof Object?n={text:e.text,appearance:e.appearance==="success"?1:0}:n={text:e},Ge({showToast:{toast:n},type:4})}export{To as addImmersiveModeChangeEventListener,ao as context,Eo as exitImmersiveMode,Oo as navigateTo,Io as removeImmersiveModeChangeEventListener,No as requestImmersiveMode,Do as showForm,Bo as showToast};
2
2
  //# sourceMappingURL=client.min.js.map