@devvit/client 0.13.0-next-2025-10-03-22-56-55-3c6373ae7.0 → 0.13.0-next-2025-10-06-17-22-07-430902c23.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,4 +1,4 @@
1
- var Ti=Object.create;var on=Object.defineProperty;var Ii=Object.getOwnPropertyDescriptor;var Oi=Object.getOwnPropertyNames;var _i=Object.getPrototypeOf,Ci=Object.prototype.hasOwnProperty;var _=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ri=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Oi(t))!Ci.call(e,i)&&i!==n&&on(e,i,{get:()=>t[i],enumerable:!(o=Ii(t,i))||o.enumerable});return e};var L=(e,t,n)=>(n=e!=null?Ti(_i(e)):{},Ri(t||!e||!e.__esModule?on(n,"default",{value:e,enumerable:!0}):n,e));var an=_((Po,sn)=>{"use strict";sn.exports=wi;function wi(e,t){for(var n=new Array(arguments.length-1),o=0,i=2,r=!0;i<arguments.length;)n[o++]=arguments[i++];return new Promise(function(d,a){n[o]=function(l){if(r)if(r=!1,l)a(l);else{for(var N=new Array(arguments.length-1),v=0;v<N.length;)N[v++]=arguments[v];d.apply(null,N)}};try{e.apply(t||null,n)}catch(u){r&&(r=!1,a(u))}})}});var ln=_(dn=>{"use strict";var ut=dn;ut.length=function(t){var n=t.length;if(!n)return 0;for(var o=0;--n%4>1&&t.charAt(n)==="=";)++o;return Math.ceil(t.length*3)/4-o};var Ke=new Array(64),fn=new Array(123);for(X=0;X<64;)fn[Ke[X]=X<26?X+65:X<52?X+71:X<62?X-4:X-59|43]=X++;var X;ut.encode=function(t,n,o){for(var i=null,r=[],s=0,d=0,a;n<o;){var u=t[n++];switch(d){case 0:r[s++]=Ke[u>>2],a=(u&3)<<4,d=1;break;case 1:r[s++]=Ke[a|u>>4],a=(u&15)<<2,d=2;break;case 2:r[s++]=Ke[a|u>>6],r[s++]=Ke[u&63],d=0;break}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,r)),s=0)}return d&&(r[s++]=Ke[a],r[s++]=61,d===1&&(r[s++]=61)),i?(s&&i.push(String.fromCharCode.apply(String,r.slice(0,s))),i.join("")):String.fromCharCode.apply(String,r.slice(0,s))};var un="invalid encoding";ut.decode=function(t,n,o){for(var i=o,r=0,s,d=0;d<t.length;){var a=t.charCodeAt(d++);if(a===61&&r>1)break;if((a=fn[a])===void 0)throw Error(un);switch(r){case 0:s=a,r=1;break;case 1:n[o++]=s<<2|(a&48)>>4,s=a,r=2;break;case 2:n[o++]=(s&15)<<4|(a&60)>>2,s=a,r=3;break;case 3:n[o++]=(s&3)<<6|a,r=0;break}}if(r===1)throw Error(un);return o-i};ut.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var pn=_((Mo,cn)=>{"use strict";cn.exports=ft;function ft(){this._listeners={}}ft.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};ft.prototype.off=function(t,n){if(t===void 0)this._listeners={};else if(n===void 0)this._listeners[t]=[];else for(var o=this._listeners[t],i=0;i<o.length;)o[i].fn===n?o.splice(i,1):++i;return this};ft.prototype.emit=function(t){var n=this._listeners[t];if(n){for(var o=[],i=1;i<arguments.length;)o.push(arguments[i++]);for(i=0;i<n.length;)n[i].fn.apply(n[i++].ctx,o)}return this}});var vn=_((Fo,En)=>{"use strict";En.exports=hn(hn);function hn(e){return typeof Float32Array<"u"?(function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function i(a,u,l){t[0]=a,u[l]=n[0],u[l+1]=n[1],u[l+2]=n[2],u[l+3]=n[3]}function r(a,u,l){t[0]=a,u[l]=n[3],u[l+1]=n[2],u[l+2]=n[1],u[l+3]=n[0]}e.writeFloatLE=o?i:r,e.writeFloatBE=o?r:i;function s(a,u){return n[0]=a[u],n[1]=a[u+1],n[2]=a[u+2],n[3]=a[u+3],t[0]}function d(a,u){return n[3]=a[u],n[2]=a[u+1],n[1]=a[u+2],n[0]=a[u+3],t[0]}e.readFloatLE=o?s:d,e.readFloatBE=o?d:s})():(function(){function t(o,i,r,s){var d=i<0?1:0;if(d&&(i=-i),i===0)o(1/i>0?0:2147483648,r,s);else if(isNaN(i))o(2143289344,r,s);else if(i>34028234663852886e22)o((d<<31|2139095040)>>>0,r,s);else if(i<11754943508222875e-54)o((d<<31|Math.round(i/1401298464324817e-60))>>>0,r,s);else{var a=Math.floor(Math.log(i)/Math.LN2),u=Math.round(i*Math.pow(2,-a)*8388608)&8388607;o((d<<31|a+127<<23|u)>>>0,r,s)}}e.writeFloatLE=t.bind(null,mn),e.writeFloatBE=t.bind(null,gn);function n(o,i,r){var s=o(i,r),d=(s>>31)*2+1,a=s>>>23&255,u=s&8388607;return a===255?u?NaN:d*(1/0):a===0?d*1401298464324817e-60*u:d*Math.pow(2,a-150)*(u+8388608)}e.readFloatLE=n.bind(null,Sn),e.readFloatBE=n.bind(null,yn)})(),typeof Float64Array<"u"?(function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function i(a,u,l){t[0]=a,u[l]=n[0],u[l+1]=n[1],u[l+2]=n[2],u[l+3]=n[3],u[l+4]=n[4],u[l+5]=n[5],u[l+6]=n[6],u[l+7]=n[7]}function r(a,u,l){t[0]=a,u[l]=n[7],u[l+1]=n[6],u[l+2]=n[5],u[l+3]=n[4],u[l+4]=n[3],u[l+5]=n[2],u[l+6]=n[1],u[l+7]=n[0]}e.writeDoubleLE=o?i:r,e.writeDoubleBE=o?r:i;function s(a,u){return n[0]=a[u],n[1]=a[u+1],n[2]=a[u+2],n[3]=a[u+3],n[4]=a[u+4],n[5]=a[u+5],n[6]=a[u+6],n[7]=a[u+7],t[0]}function d(a,u){return n[7]=a[u],n[6]=a[u+1],n[5]=a[u+2],n[4]=a[u+3],n[3]=a[u+4],n[2]=a[u+5],n[1]=a[u+6],n[0]=a[u+7],t[0]}e.readDoubleLE=o?s:d,e.readDoubleBE=o?d:s})():(function(){function t(o,i,r,s,d,a){var u=s<0?1:0;if(u&&(s=-s),s===0)o(0,d,a+i),o(1/s>0?0:2147483648,d,a+r);else if(isNaN(s))o(0,d,a+i),o(2146959360,d,a+r);else if(s>17976931348623157e292)o(0,d,a+i),o((u<<31|2146435072)>>>0,d,a+r);else{var l;if(s<22250738585072014e-324)l=s/5e-324,o(l>>>0,d,a+i),o((u<<31|l/4294967296)>>>0,d,a+r);else{var N=Math.floor(Math.log(s)/Math.LN2);N===1024&&(N=1023),l=s*Math.pow(2,-N),o(l*4503599627370496>>>0,d,a+i),o((u<<31|N+1023<<20|l*1048576&1048575)>>>0,d,a+r)}}}e.writeDoubleLE=t.bind(null,mn,0,4),e.writeDoubleBE=t.bind(null,gn,4,0);function n(o,i,r,s,d){var a=o(s,d+i),u=o(s,d+r),l=(u>>31)*2+1,N=u>>>20&2047,v=4294967296*(u&1048575)+a;return N===2047?v?NaN:l*(1/0):N===0?l*5e-324*v:l*Math.pow(2,N-1075)*(v+4503599627370496)}e.readDoubleLE=n.bind(null,Sn,0,4),e.readDoubleBE=n.bind(null,yn,4,0)})(),e}function mn(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function gn(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=e&255}function Sn(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function yn(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var Nn=_((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 Tn=_(bn=>{"use strict";var Et=bn;Et.length=function(t){for(var n=0,o=0,i=0;i<t.length;++i)o=t.charCodeAt(i),o<128?n+=1:o<2048?n+=2:(o&64512)===55296&&(t.charCodeAt(i+1)&64512)===56320?(++i,n+=4):n+=3;return n};Et.read=function(t,n,o){var i=o-n;if(i<1)return"";for(var r=null,s=[],d=0,a;n<o;)a=t[n++],a<128?s[d++]=a:a>191&&a<224?s[d++]=(a&31)<<6|t[n++]&63:a>239&&a<365?(a=((a&7)<<18|(t[n++]&63)<<12|(t[n++]&63)<<6|t[n++]&63)-65536,s[d++]=55296+(a>>10),s[d++]=56320+(a&1023)):s[d++]=(a&15)<<12|(t[n++]&63)<<6|t[n++]&63,d>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,s)),d=0);return r?(d&&r.push(String.fromCharCode.apply(String,s.slice(0,d))),r.join("")):String.fromCharCode.apply(String,s.slice(0,d))};Et.write=function(t,n,o){for(var i=o,r,s,d=0;d<t.length;++d)r=t.charCodeAt(d),r<128?n[o++]=r:r<2048?(n[o++]=r>>6|192,n[o++]=r&63|128):(r&64512)===55296&&((s=t.charCodeAt(d+1))&64512)===56320?(r=65536+((r&1023)<<10)+(s&1023),++d,n[o++]=r>>18|240,n[o++]=r>>12&63|128,n[o++]=r>>6&63|128,n[o++]=r&63|128):(n[o++]=r>>12|224,n[o++]=r>>6&63|128,n[o++]=r&63|128);return o-i}});var On=_((Bo,In)=>{"use strict";In.exports=xi;function xi(e,t,n){var o=n||8192,i=o>>>1,r=null,s=o;return function(a){if(a<1||a>i)return e(a);s+a>o&&(r=e(o),s=0);var u=t.call(r,s,s+=a);return s&7&&(s=(s|7)+1),u}}});var Cn=_((Uo,_n)=>{"use strict";_n.exports=C;var et=he();function C(e,t){this.lo=e>>>0,this.hi=t>>>0}var Le=C.zero=new C(0,0);Le.toNumber=function(){return 0};Le.zzEncode=Le.zzDecode=function(){return this};Le.length=function(){return 1};var ki=C.zeroHash="\0\0\0\0\0\0\0\0";C.fromNumber=function(t){if(t===0)return Le;var n=t<0;n&&(t=-t);var o=t>>>0,i=(t-o)/4294967296>>>0;return n&&(i=~i>>>0,o=~o>>>0,++o>4294967295&&(o=0,++i>4294967295&&(i=0))),new C(o,i)};C.from=function(t){if(typeof t=="number")return C.fromNumber(t);if(et.isString(t))if(et.Long)t=et.Long.fromString(t);else return C.fromNumber(parseInt(t,10));return t.low||t.high?new C(t.low>>>0,t.high>>>0):Le};C.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var n=~this.lo+1>>>0,o=~this.hi>>>0;return n||(o=o+1>>>0),-(n+o*4294967296)}return this.lo+this.hi*4294967296};C.prototype.toLong=function(t){return et.Long?new et.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var pe=String.prototype.charCodeAt;C.fromHash=function(t){return t===ki?Le:new C((pe.call(t,0)|pe.call(t,1)<<8|pe.call(t,2)<<16|pe.call(t,3)<<24)>>>0,(pe.call(t,4)|pe.call(t,5)<<8|pe.call(t,6)<<16|pe.call(t,7)<<24)>>>0)};C.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)};C.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};C.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};C.prototype.length=function(){var t=this.lo,n=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?n===0?t<16384?t<128?1:2:t<2097152?3:4:n<16384?n<128?5:6:n<2097152?7:8:o<128?9:10}});var he=_(vt=>{"use strict";var p=vt;p.asPromise=an();p.base64=ln();p.EventEmitter=pn();p.float=vn();p.inquire=Nn();p.utf8=Tn();p.pool=On();p.LongBits=Cn();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||vt;p.emptyArray=Object.freeze?Object.freeze([]):[];p.emptyObject=Object.freeze?Object.freeze({}):{};p.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};p.isString=function(t){return typeof t=="string"||t instanceof String};p.isObject=function(t){return t&&typeof t=="object"};p.isset=p.isSet=function(t,n){var o=t[n];return o!=null&&t.hasOwnProperty(n)?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(t){return typeof t=="number"?p.Buffer?p._Buffer_allocUnsafe(t):new p.Array(t):p.Buffer?p._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};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(t){return t?p.LongBits.from(t).toHash():p.LongBits.zeroHash};p.longFromHash=function(t,n){var o=p.LongBits.fromHash(t);return p.Long?p.Long.fromBits(o.lo,o.hi,n):o.toNumber(!!n)};function Rn(e,t,n){for(var o=Object.keys(t),i=0;i<o.length;++i)(e[o[i]]===void 0||!n)&&(e[o[i]]=t[o[i]]);return e}p.merge=Rn;p.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function wn(e){function t(n,o){if(!(this instanceof t))return new t(n,o);Object.defineProperty(this,"message",{get:function(){return n}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),o&&Rn(this,o)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,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}}),t}p.newError=wn;p.ProtocolError=wn("ProtocolError");p.oneOfGetter=function(t){for(var n={},o=0;o<t.length;++o)n[t[o]]=1;return function(){for(var i=Object.keys(this),r=i.length-1;r>-1;--r)if(n[i[r]]===1&&this[i[r]]!==void 0&&this[i[r]]!==null)return i[r]}};p.oneOfSetter=function(t){return function(n){for(var o=0;o<t.length;++o)t[o]!==n&&delete this[t[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(n,o){return new e(n,o)},p._Buffer_allocUnsafe=e.allocUnsafe||function(n){return new e(n)}}});var Ct=_((Jo,Pn)=>{"use strict";Pn.exports=m;var $=he(),Nt,dt=$.LongBits,xn=$.base64,kn=$.utf8;function tt(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function Tt(){}function Vi(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 tt(Tt,0,0),this.tail=this.head,this.states=null}var Vn=function(){return $.Buffer?function(){return(m.create=function(){return new Nt})()}:function(){return new m}};m.create=Vn();m.alloc=function(t){return new $.Array(t)};$.Array!==Array&&(m.alloc=$.pool(m.alloc,$.Array.prototype.subarray));m.prototype._push=function(t,n,o){return this.tail=this.tail.next=new tt(t,n,o),this.len+=n,this};function It(e,t,n){t[n]=e&255}function Pi(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function Ot(e,t){this.len=e,this.next=void 0,this.val=t}Ot.prototype=Object.create(tt.prototype);Ot.prototype.fn=Pi;m.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Ot((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};m.prototype.int32=function(t){return t<0?this._push(_t,10,dt.fromNumber(t)):this.uint32(t)};m.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function _t(e,t,n){for(;e.hi;)t[n++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=e.lo&127|128,e.lo=e.lo>>>7;t[n++]=e.lo}m.prototype.uint64=function(t){var n=dt.from(t);return this._push(_t,n.length(),n)};m.prototype.int64=m.prototype.uint64;m.prototype.sint64=function(t){var n=dt.from(t).zzEncode();return this._push(_t,n.length(),n)};m.prototype.bool=function(t){return this._push(It,1,t?1:0)};function bt(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}m.prototype.fixed32=function(t){return this._push(bt,4,t>>>0)};m.prototype.sfixed32=m.prototype.fixed32;m.prototype.fixed64=function(t){var n=dt.from(t);return this._push(bt,4,n.lo)._push(bt,4,n.hi)};m.prototype.sfixed64=m.prototype.fixed64;m.prototype.float=function(t){return this._push($.float.writeFloatLE,4,t)};m.prototype.double=function(t){return this._push($.float.writeDoubleLE,8,t)};var Ai=$.Array.prototype.set?function(t,n,o){n.set(t,o)}:function(t,n,o){for(var i=0;i<t.length;++i)n[o+i]=t[i]};m.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push(It,1,0);if($.isString(t)){var o=m.alloc(n=xn.length(t));xn.decode(t,o,0),t=o}return this.uint32(n)._push(Ai,n,t)};m.prototype.string=function(t){var n=kn.length(t);return n?this.uint32(n)._push(kn.write,n,t):this._push(It,1,0)};m.prototype.fork=function(){return this.states=new Vi(this),this.head=this.tail=new tt(Tt,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 tt(Tt,0,0),this.len=0),this};m.prototype.ldelim=function(){var t=this.head,n=this.tail,o=this.len;return this.reset().uint32(o),o&&(this.tail.next=t.next,this.tail=n,this.len+=o),this};m.prototype.finish=function(){for(var t=this.head.next,n=this.constructor.alloc(this.len),o=0;t;)t.fn(t.val,n,o),o+=t.len,t=t.next;return n};m._configure=function(e){Nt=e,m.create=Vn(),Nt._configure()}});var Fn=_((Wo,Mn)=>{"use strict";Mn.exports=ee;var An=Ct();(ee.prototype=Object.create(An.prototype)).constructor=ee;var me=he();function ee(){An.call(this)}ee._configure=function(){ee.alloc=me._Buffer_allocUnsafe,ee.writeBytesBuffer=me.Buffer&&me.Buffer.prototype instanceof Uint8Array&&me.Buffer.prototype.set.name==="set"?function(t,n,o){n.set(t,o)}:function(t,n,o){if(t.copy)t.copy(n,o,0,t.length);else for(var i=0;i<t.length;)n[o++]=t[i++]}};ee.prototype.bytes=function(t){me.isString(t)&&(t=me._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(ee.writeBytesBuffer,n,t),this};function Mi(e,t,n){e.length<40?me.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}ee.prototype.string=function(t){var n=me.Buffer.byteLength(t);return this.uint32(n),n&&this._push(Mi,n,t),this};ee._configure()});var xt=_(($o,Jn)=>{"use strict";Jn.exports=I;var Y=he(),wt,Un=Y.LongBits,Fi=Y.utf8;function Q(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function I(e){this.buf=e,this.pos=0,this.len=e.length}var Ln=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new I(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new I(t);throw Error("illegal buffer")},Dn=function(){return Y.Buffer?function(n){return(I.create=function(i){return Y.Buffer.isBuffer(i)?new wt(i):Ln(i)})(n)}:Ln};I.create=Dn();I.prototype._slice=Y.Array.prototype.subarray||Y.Array.prototype.slice;I.prototype.uint32=(function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,Q(this,10);return t}})();I.prototype.int32=function(){return this.uint32()|0};I.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function Rt(){var e=new Un(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*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;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Q(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw Q(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}I.prototype.bool=function(){return this.uint32()!==0};function lt(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}I.prototype.fixed32=function(){if(this.pos+4>this.len)throw Q(this,4);return lt(this.buf,this.pos+=4)};I.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Q(this,4);return lt(this.buf,this.pos+=4)|0};function Bn(){if(this.pos+8>this.len)throw Q(this,8);return new Un(lt(this.buf,this.pos+=4),lt(this.buf,this.pos+=4))}I.prototype.float=function(){if(this.pos+4>this.len)throw Q(this,4);var t=Y.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};I.prototype.double=function(){if(this.pos+8>this.len)throw Q(this,4);var t=Y.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};I.prototype.bytes=function(){var t=this.uint32(),n=this.pos,o=this.pos+t;if(o>this.len)throw Q(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(n,o);if(n===o){var i=Y.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,n,o)};I.prototype.string=function(){var t=this.bytes();return Fi.read(t,0,t.length)};I.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Q(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Q(this);while(this.buf[this.pos++]&128);return this};I.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};I._configure=function(e){wt=e,I.create=Dn(),wt._configure();var t=Y.Long?"toLong":"toNumber";Y.merge(I.prototype,{int64:function(){return Rt.call(this)[t](!1)},uint64:function(){return Rt.call(this)[t](!0)},sint64:function(){return Rt.call(this).zzDecode()[t](!1)},fixed64:function(){return Bn.call(this)[t](!0)},sfixed64:function(){return Bn.call(this)[t](!1)}})}});var qn=_((Go,Gn)=>{"use strict";Gn.exports=Be;var $n=xt();(Be.prototype=Object.create($n.prototype)).constructor=Be;var Wn=he();function Be(e){$n.call(this,e)}Be._configure=function(){Wn.Buffer&&(Be.prototype._slice=Wn.Buffer.prototype.slice)};Be.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};Be._configure()});var Hn=_((qo,Zn)=>{"use strict";Zn.exports=nt;var kt=he();(nt.prototype=Object.create(kt.EventEmitter.prototype)).constructor=nt;function nt(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");kt.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}nt.prototype.rpcCall=function e(t,n,o,i,r){if(!i)throw TypeError("request must be specified");var s=this;if(!r)return kt.asPromise(e,s,t,n,o,i);if(!s.rpcImpl){setTimeout(function(){r(Error("already ended"))},0);return}try{return s.rpcImpl(t,n[s.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(a,u){if(a)return s.emit("error",a,t),r(a);if(u===null){s.end(!0);return}if(!(u instanceof o))try{u=o[s.responseDelimited?"decodeDelimited":"decode"](u)}catch(l){return s.emit("error",l,t),r(l)}return s.emit("data",u,t),r(null,u)})}catch(d){s.emit("error",d,t),setTimeout(function(){r(d)},0);return}};nt.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var zn=_(Kn=>{"use strict";var Li=Kn;Li.Service=Hn()});var Yn=_((Ho,Xn)=>{"use strict";Xn.exports={}});var er=_(jn=>{"use strict";var V=jn;V.build="minimal";V.Writer=Ct();V.BufferWriter=Fn();V.Reader=xt();V.BufferReader=qn();V.util=he();V.rpc=zn();V.roots=Yn();V.configure=Qn;function Qn(){V.util._configure(),V.Writer._configure(V.BufferWriter),V.Reader._configure(V.BufferReader)}Qn()});var P=_((zo,tr)=>{"use strict";tr.exports=er()});var ct=L(P(),1);var c=new Map;var te;(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"})(te||(te={}));function Pt(e){switch(e){case 0:case"UNSPECIFIED":return te.UNSPECIFIED;case 1:case"INLINE_MODE":return te.INLINE_MODE;case 2:case"IMMERSIVE_MODE":return te.IMMERSIVE_MODE;case-1:case"UNRECOGNIZED":default:return te.UNRECOGNIZED}}function At(e){switch(e){case te.UNSPECIFIED:return 0;case te.INLINE_MODE:return 1;case te.IMMERSIVE_MODE:return 2;case te.UNRECOGNIZED:default:return-1}}function nr(){return{immersiveMode:0,entryUrl:void 0}}var Vt={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,t=ct.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),e.entryUrl!==void 0&&t.uint32(18).string(e.entryUrl),t},decode(e,t){let n=e instanceof ct.default.Reader?e:ct.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=nr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.immersiveMode=n.int32();continue;case 2:if(r!==18)break;i.entryUrl=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{immersiveMode:rr(e.immersiveMode)?Pt(e.immersiveMode):0,entryUrl:rr(e.entryUrl)?globalThis.String(e.entryUrl):void 0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=At(e.immersiveMode)),e.entryUrl!==void 0&&(t.entryUrl=e.entryUrl),t},create(e){return Vt.fromPartial(e??{})},fromPartial(e){let t=nr();return t.immersiveMode=e.immersiveMode??0,t.entryUrl=e.entryUrl??void 0,t}};c.set(Vt.$type,Vt);function rr(e){return e!=null}function pt(e,t){if(!e)throw Error(t)}var ge;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(ge||(ge={}));function Bi(e){return e.startsWith(ge.ACCOUNT)}function Ui(e){return e.startsWith(ge.LINK)}function Di(e){return e.startsWith(ge.SUBREDDIT)}function Ji(e){pt(Bi(e),`Expected account id to start with ${ge.ACCOUNT}, got ${e}}`)}function Wi(e){pt(Ui(e),`Expected link id to start with ${ge.LINK}, got ${e}}`)}function $i(e){pt(Di(e),`Expected subreddit id to start with ${ge.SUBREDDIT}, got ${e}}`)}function ir(e){return Ji(e),e}function or(e){return Wi(e),e}function sr(e){return $i(e),e}var ar="0.0.0";var Ue=class extends Error{};Ue.prototype.name="InvalidTokenError";function Gi(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let o=n.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function qi(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Gi(t)}catch{return atob(t)}}function ur(e,t){if(typeof e!="string")throw new Ue("Invalid token specified: must be a string");t||(t={});let n=t.header===!0?0:1,o=e.split(".")[n];if(typeof o!="string")throw new Ue(`Invalid token specified: missing part #${n+1}`);let i;try{i=qi(o)}catch(r){throw new Ue(`Invalid token specified: invalid base64 for part #${n+1} (${r.message})`)}try{return JSON.parse(i)}catch(r){throw new Ue(`Invalid token specified: invalid json for part #${n+1} (${r.message})`)}}var Zi=({search:e,hash:t})=>{let n=new URLSearchParams(e).get("context");if(n){let o=decodeURIComponent(n),i=JSON.parse(o),r=Hi(t),s=r?.webbitToken??new URLSearchParams(e).get("webbit_token"),d=s?Ki(s):void 0,a={subredditId:sr(i.subredditId),userId:i.userId?ir(i.userId):void 0,subredditName:i.subredditName,appName:i.appName,appVersion:i.appVersion,postId:or(i.postId),postData:d?.developerData};globalThis.devvit={context:a,entrypoints:r?.entrypoints??{},share:r?.shareParam?{userData:r?.shareParam.userData}:void 0,appPermissionState:r?.appPermissionState,webViewMode:r?.viewMode}}};globalThis.location&&Zi(globalThis.location);function Hi(e){let t=e?.slice(1);if(t)try{return JSON.parse(decodeURIComponent(t))}catch(n){console.error("Error parsing bridge context from hash",n);return}}function Ki(e){if(e===ar)return;let t;try{t=ur(e)}catch(o){console.error("Failed to parse jwt:",o);return}let n=t["devvit-post-data"];if(!(!n||Object.keys(n).length===0))return n}var zi=new Proxy({},{get:(e,t)=>globalThis.devvit.context[t],ownKeys(){return Object.keys(globalThis.devvit.context)},getOwnPropertyDescriptor(e,t){return{enumerable:!0,configurable:!0,value:globalThis.devvit.context[t]}}});var T=L(P(),1);var B=L(P(),1);var Je;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Je||(Je={}));function Xi(e){switch(e){case 0:case"NULL_VALUE":return Je.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return Je.UNRECOGNIZED}}function Yi(e){switch(e){case Je.NULL_VALUE:return 0;case Je.UNRECOGNIZED:default:return-1}}function Mt(){return{fields:{}}}var G={$type:"google.protobuf.Struct",encode(e,t=B.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&rt.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof B.default.Reader?e:B.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Mt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let s=rt.decode(n,n.uint32());s.value!==void 0&&(i.fields[s.key]=s.value);continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:dr(e.fields)?Object.entries(e.fields).reduce((t,[n,o])=>(t[n]=o,t),{}):{}}},toJSON(e){let t={};if(e.fields){let n=Object.entries(e.fields);n.length>0&&(t.fields={},n.forEach(([o,i])=>{t.fields[o]=i}))}return t},create(e){return G.fromPartial(e??{})},fromPartial(e){let t=Mt();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),{}),t},wrap(e){let t=Mt();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};c.set(G.$type,G);function fr(){return{key:"",value:void 0}}var rt={$type:"google.protobuf.Struct.FieldsEntry",encode(e,t=B.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&R.encode(R.wrap(e.value),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof B.default.Reader?e:B.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=fr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=R.unwrap(R.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:ze(e.key)?globalThis.String(e.key):"",value:ze(e?.value)?e.value:void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=e.value),t},create(e){return rt.fromPartial(e??{})},fromPartial(e){let t=fr();return t.key=e.key??"",t.value=e.value??void 0,t}};c.set(rt.$type,rt);function Ft(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var R={$type:"google.protobuf.Value",encode(e,t=B.default.Writer.create()){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&G.encode(G.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&De.encode(De.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof B.default.Reader?e:B.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ft();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.nullValue=n.int32();continue;case 2:if(r!==17)break;i.numberValue=n.double();continue;case 3:if(r!==26)break;i.stringValue=n.string();continue;case 4:if(r!==32)break;i.boolValue=n.bool();continue;case 5:if(r!==42)break;i.structValue=G.unwrap(G.decode(n,n.uint32()));continue;case 6:if(r!==50)break;i.listValue=De.unwrap(De.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{nullValue:ze(e.nullValue)?Xi(e.nullValue):void 0,numberValue:ze(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:ze(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:ze(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:dr(e.structValue)?e.structValue:void 0,listValue:globalThis.Array.isArray(e.listValue)?[...e.listValue]:void 0}},toJSON(e){let t={};return e.nullValue!==void 0&&(t.nullValue=Yi(e.nullValue)),e.numberValue!==void 0&&(t.numberValue=e.numberValue),e.stringValue!==void 0&&(t.stringValue=e.stringValue),e.boolValue!==void 0&&(t.boolValue=e.boolValue),e.structValue!==void 0&&(t.structValue=e.structValue),e.listValue!==void 0&&(t.listValue=e.listValue),t},create(e){return R.fromPartial(e??{})},fromPartial(e){let t=Ft();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=Ft();if(e===null)t.nullValue=Je.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new globalThis.Error("Unsupported any value type: "+typeof e);return t},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}};c.set(R.$type,R);function Lt(){return{values:[]}}var De={$type:"google.protobuf.ListValue",encode(e,t=B.default.Writer.create()){for(let n of e.values)R.encode(R.wrap(n),t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof B.default.Reader?e:B.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Lt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(R.unwrap(R.decode(n,n.uint32())));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?[...e.values]:[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values),t},create(e){return De.fromPartial(e??{})},fromPartial(e){let t=Lt();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=Lt();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};c.set(De.$type,De);function dr(e){return typeof e=="object"&&e!==null}function ze(e){return e!=null}var qe=L(P(),1);var E=L(P(),1);var q=null;try{q=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 y(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}y.prototype.__isLong__;Object.defineProperty(y.prototype,"__isLong__",{value:!0});function w(e){return(e&&e.__isLong__)===!0}function lr(e){var t=Math.clz32(e&-e);return e?31-t:t}y.isLong=w;var cr={},pr={};function We(e,t){var n,o,i;return t?(e>>>=0,(i=0<=e&&e<256)&&(o=pr[e],o)?o:(n=g(e,0,!0),i&&(pr[e]=n),n)):(e|=0,(i=-128<=e&&e<128)&&(o=cr[e],o)?o:(n=g(e,e<0?-1:0,!1),i&&(cr[e]=n),n))}y.fromInt=We;function Z(e,t){if(isNaN(e))return t?ie:j;if(t){if(e<0)return ie;if(e>=Sr)return vr}else{if(e<=-mr)return A;if(e+1>=mr)return Er}return e<0?Z(-e,t).neg():g(e%Ye|0,e/Ye|0,t)}y.fromNumber=Z;function g(e,t,n){return new y(e,t,n)}y.fromBits=g;var ht=Math.pow;function Ut(e,t,n){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(n=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?ie:j;if(n=n||10,n<2||36<n)throw RangeError("radix");var o;if((o=e.indexOf("-"))>0)throw Error("interior hyphen");if(o===0)return Ut(e.substring(1),t,n).neg();for(var i=Z(ht(n,8)),r=j,s=0;s<e.length;s+=8){var d=Math.min(8,e.length-s),a=parseInt(e.substring(s,s+d),n);if(d<8){var u=Z(ht(n,d));r=r.mul(u).add(Z(a))}else r=r.mul(i),r=r.add(Z(a))}return r.unsigned=t,r}y.fromString=Ut;function H(e,t){return typeof e=="number"?Z(e,t):typeof e=="string"?Ut(e,t):g(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}y.fromValue=H;var hr=65536,Qi=1<<24,Ye=hr*hr,Sr=Ye*Ye,mr=Sr/2,gr=We(Qi),j=We(0);y.ZERO=j;var ie=We(0,!0);y.UZERO=ie;var Xe=We(1);y.ONE=Xe;var yr=We(1,!0);y.UONE=yr;var Bt=We(-1);y.NEG_ONE=Bt;var Er=g(-1,2147483647,!1);y.MAX_VALUE=Er;var vr=g(-1,-1,!0);y.MAX_UNSIGNED_VALUE=vr;var A=g(0,-2147483648,!1);y.MIN_VALUE=A;var f=y.prototype;f.toInt=function(){return this.unsigned?this.low>>>0:this.low};f.toNumber=function(){return this.unsigned?(this.high>>>0)*Ye+(this.low>>>0):this.high*Ye+(this.low>>>0)};f.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(A)){var n=Z(t),o=this.div(n),i=o.mul(n).sub(this);return o.toString(t)+i.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var r=Z(ht(t,6),this.unsigned),s=this,d="";;){var a=s.div(r),u=s.sub(a.mul(r)).toInt()>>>0,l=u.toString(t);if(s=a,s.isZero())return l+d;for(;l.length<6;)l="0"+l;d=""+l+d}};f.getHighBits=function(){return this.high};f.getHighBitsUnsigned=function(){return this.high>>>0};f.getLowBits=function(){return this.low};f.getLowBitsUnsigned=function(){return this.low>>>0};f.getNumBitsAbs=function(){if(this.isNegative())return this.eq(A)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,n=31;n>0&&(t&1<<n)==0;n--);return this.high!=0?n+33:n+1};f.isSafeInteger=function(){var t=this.high>>21;return t?this.unsigned?!1:t===-1&&!(this.low===0&&this.high===-2097152):!0};f.isZero=function(){return this.high===0&&this.low===0};f.eqz=f.isZero;f.isNegative=function(){return!this.unsigned&&this.high<0};f.isPositive=function(){return this.unsigned||this.high>=0};f.isOdd=function(){return(this.low&1)===1};f.isEven=function(){return(this.low&1)===0};f.equals=function(t){return w(t)||(t=H(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};f.eq=f.equals;f.notEquals=function(t){return!this.eq(t)};f.neq=f.notEquals;f.ne=f.notEquals;f.lessThan=function(t){return this.comp(t)<0};f.lt=f.lessThan;f.lessThanOrEqual=function(t){return this.comp(t)<=0};f.lte=f.lessThanOrEqual;f.le=f.lessThanOrEqual;f.greaterThan=function(t){return this.comp(t)>0};f.gt=f.greaterThan;f.greaterThanOrEqual=function(t){return this.comp(t)>=0};f.gte=f.greaterThanOrEqual;f.ge=f.greaterThanOrEqual;f.compare=function(t){if(w(t)||(t=H(t)),this.eq(t))return 0;var n=this.isNegative(),o=t.isNegative();return n&&!o?-1:!n&&o?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};f.comp=f.compare;f.negate=function(){return!this.unsigned&&this.eq(A)?A:this.not().add(Xe)};f.neg=f.negate;f.add=function(t){w(t)||(t=H(t));var n=this.high>>>16,o=this.high&65535,i=this.low>>>16,r=this.low&65535,s=t.high>>>16,d=t.high&65535,a=t.low>>>16,u=t.low&65535,l=0,N=0,v=0,F=0;return F+=r+u,v+=F>>>16,F&=65535,v+=i+a,N+=v>>>16,v&=65535,N+=o+d,l+=N>>>16,N&=65535,l+=n+s,l&=65535,g(v<<16|F,l<<16|N,this.unsigned)};f.subtract=function(t){return w(t)||(t=H(t)),this.add(t.neg())};f.sub=f.subtract;f.multiply=function(t){if(this.isZero())return this;if(w(t)||(t=H(t)),q){var n=q.mul(this.low,this.high,t.low,t.high);return g(n,q.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?ie:j;if(this.eq(A))return t.isOdd()?A:j;if(t.eq(A))return this.isOdd()?A:j;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(gr)&&t.lt(gr))return Z(this.toNumber()*t.toNumber(),this.unsigned);var o=this.high>>>16,i=this.high&65535,r=this.low>>>16,s=this.low&65535,d=t.high>>>16,a=t.high&65535,u=t.low>>>16,l=t.low&65535,N=0,v=0,F=0,at=0;return at+=s*l,F+=at>>>16,at&=65535,F+=r*l,v+=F>>>16,F&=65535,F+=s*u,v+=F>>>16,F&=65535,v+=i*l,N+=v>>>16,v&=65535,v+=r*u,N+=v>>>16,v&=65535,v+=s*a,N+=v>>>16,v&=65535,N+=o*l+i*u+r*a+s*d,N&=65535,g(F<<16|at,N<<16|v,this.unsigned)};f.mul=f.multiply;f.divide=function(t){if(w(t)||(t=H(t)),t.isZero())throw Error("division by zero");if(q){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?q.div_u:q.div_s)(this.low,this.high,t.low,t.high);return g(n,q.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?ie:j;var o,i,r;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return ie;if(t.gt(this.shru(1)))return yr;r=ie}else{if(this.eq(A)){if(t.eq(Xe)||t.eq(Bt))return A;if(t.eq(A))return Xe;var s=this.shr(1);return o=s.div(t).shl(1),o.eq(j)?t.isNegative()?Xe:Bt:(i=this.sub(t.mul(o)),r=o.add(i.div(t)),r)}else if(t.eq(A))return this.unsigned?ie:j;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();r=j}for(i=this;i.gte(t);){o=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var d=Math.ceil(Math.log(o)/Math.LN2),a=d<=48?1:ht(2,d-48),u=Z(o),l=u.mul(t);l.isNegative()||l.gt(i);)o-=a,u=Z(o,this.unsigned),l=u.mul(t);u.isZero()&&(u=Xe),r=r.add(u),i=i.sub(l)}return r};f.div=f.divide;f.modulo=function(t){if(w(t)||(t=H(t)),q){var n=(this.unsigned?q.rem_u:q.rem_s)(this.low,this.high,t.low,t.high);return g(n,q.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};f.mod=f.modulo;f.rem=f.modulo;f.not=function(){return g(~this.low,~this.high,this.unsigned)};f.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};f.clz=f.countLeadingZeros;f.countTrailingZeros=function(){return this.low?lr(this.low):lr(this.high)+32};f.ctz=f.countTrailingZeros;f.and=function(t){return w(t)||(t=H(t)),g(this.low&t.low,this.high&t.high,this.unsigned)};f.or=function(t){return w(t)||(t=H(t)),g(this.low|t.low,this.high|t.high,this.unsigned)};f.xor=function(t){return w(t)||(t=H(t)),g(this.low^t.low,this.high^t.high,this.unsigned)};f.shiftLeft=function(t){return w(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?g(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):g(0,this.low<<t-32,this.unsigned)};f.shl=f.shiftLeft;f.shiftRight=function(t){return w(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?g(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):g(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};f.shr=f.shiftRight;f.shiftRightUnsigned=function(t){return w(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?g(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?g(this.high,0,this.unsigned):g(this.high>>>t-32,0,this.unsigned)};f.shru=f.shiftRightUnsigned;f.shr_u=f.shiftRightUnsigned;f.rotateLeft=function(t){var n;return w(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?g(this.high,this.low,this.unsigned):t<32?(n=32-t,g(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,g(this.high<<t|this.low>>>n,this.low<<t|this.high>>>n,this.unsigned))};f.rotl=f.rotateLeft;f.rotateRight=function(t){var n;return w(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?g(this.high,this.low,this.unsigned):t<32?(n=32-t,g(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,g(this.low<<n|this.high>>>t,this.high<<n|this.low>>>t,this.unsigned))};f.rotr=f.rotateRight;f.toSigned=function(){return this.unsigned?g(this.low,this.high,!1):this};f.toUnsigned=function(){return this.unsigned?this:g(this.low,this.high,!0)};f.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};f.toBytesLE=function(){var t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};f.toBytesBE=function(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};y.fromBytes=function(t,n,o){return o?y.fromBytesLE(t,n):y.fromBytesBE(t,n)};y.fromBytesLE=function(t,n){return new y(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};y.fromBytesBE=function(t,n){return new y(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)};typeof BigInt=="function"&&(y.fromBigInt=function(t,n){var o=Number(BigInt.asIntN(32,t)),i=Number(BigInt.asIntN(32,t>>BigInt(32)));return g(o,i,n)},y.fromValue=function(t,n){return typeof t=="bigint"?y.fromBigInt(t,n):H(t,n)},f.toBigInt=function(){var t=BigInt(this.low>>>0),n=BigInt(this.unsigned?this.high>>>0:this.high);return n<<BigInt(32)|t});var Dt=y;var $e=L(P(),1);function Nr(){return{seconds:0,nanos:0}}var Ge={$type:"google.protobuf.Timestamp",encode(e,t=$e.default.Writer.create()){return e.seconds!==0&&t.uint32(8).int64(e.seconds),e.nanos!==0&&t.uint32(16).int32(e.nanos),t},decode(e,t){let n=e instanceof $e.default.Reader?e:$e.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Nr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.seconds=ji(n.int64());continue;case 2:if(r!==16)break;i.nanos=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{seconds:br(e.seconds)?globalThis.Number(e.seconds):0,nanos:br(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let t={};return e.seconds!==0&&(t.seconds=Math.round(e.seconds)),e.nanos!==0&&(t.nanos=Math.round(e.nanos)),t},create(e){return Ge.fromPartial(e??{})},fromPartial(e){let t=Nr();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}};c.set(Ge.$type,Ge);function ji(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}$e.default.util.Long!==Dt&&($e.default.util.Long=Dt,$e.default.configure());function br(e){return e!=null}var ne;(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"})(ne||(ne={}));function Ht(e){switch(e){case 0:case"CONSENT_STATUS_UNKNOWN":return ne.CONSENT_STATUS_UNKNOWN;case 1:case"REVOKED":return ne.REVOKED;case 2:case"GRANTED":return ne.GRANTED;case-1:case"UNRECOGNIZED":default:return ne.UNRECOGNIZED}}function Kt(e){switch(e){case ne.CONSENT_STATUS_UNKNOWN:return 0;case ne.REVOKED:return 1;case ne.GRANTED:return 2;case ne.UNRECOGNIZED:default:return-1}}var K;(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"})(K||(K={}));function Vr(e){switch(e){case 0:case"SCOPE_UNKNOWN":return K.SCOPE_UNKNOWN;case 1:case"SUBMIT_POST":return K.SUBMIT_POST;case 2:case"SUBMIT_COMMENT":return K.SUBMIT_COMMENT;case 3:case"SUBSCRIBE_TO_SUBREDDIT":return K.SUBSCRIBE_TO_SUBREDDIT;case-1:case"UNRECOGNIZED":default:return K.UNRECOGNIZED}}function Pr(e){switch(e){case K.SCOPE_UNKNOWN:return 0;case K.SUBMIT_POST:return 1;case K.SUBMIT_COMMENT:return 2;case K.SUBSCRIBE_TO_SUBREDDIT:return 3;case K.UNRECOGNIZED:default:return-1}}function Tr(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}var Se={$type:"reddit.devvit.app_permission.v1.AppPermission",encode(e,t=E.default.Writer.create()){e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.subredditId!==""&&t.uint32(18).string(e.subredditId),t.uint32(26).fork();for(let n of e.scopes)t.int32(n);return t.ldelim(),e.consentStatus!==0&&t.uint32(32).int32(e.consentStatus),e.updatedAt!==void 0&&Ge.encode(eo(e.updatedAt),t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Tr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appSlug=n.string();continue;case 2:if(r!==18)break;i.subredditId=n.string();continue;case 3:if(r===24){i.scopes.push(n.int32());continue}if(r===26){let s=n.uint32()+n.pos;for(;n.pos<s;)i.scopes.push(n.int32());continue}break;case 4:if(r!==32)break;i.consentStatus=n.int32();continue;case 5:if(r!==42)break;i.updatedAt=Ar(Ge.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:x(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:x(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>Vr(t)):[],consentStatus:x(e.consentStatus)?Ht(e.consentStatus):0,updatedAt:x(e.updatedAt)?to(e.updatedAt):void 0}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.subredditId!==""&&(t.subredditId=e.subredditId),e.scopes?.length&&(t.scopes=e.scopes.map(n=>Pr(n))),e.consentStatus!==0&&(t.consentStatus=Kt(e.consentStatus)),e.updatedAt!==void 0&&(t.updatedAt=e.updatedAt.toISOString()),t},create(e){return Se.fromPartial(e??{})},fromPartial(e){let t=Tr();return t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t.consentStatus=e.consentStatus??0,t.updatedAt=e.updatedAt??void 0,t}};c.set(Se.$type,Se);function Ir(){return{appSlug:"",appName:""}}var ye={$type:"reddit.devvit.app_permission.v1.DevvitApp",encode(e,t=E.default.Writer.create()){return e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.appName!==""&&t.uint32(18).string(e.appName),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ir();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appSlug=n.string();continue;case 2:if(r!==18)break;i.appName=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:x(e.appSlug)?globalThis.String(e.appSlug):"",appName:x(e.appName)?globalThis.String(e.appName):""}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.appName!==""&&(t.appName=e.appName),t},create(e){return ye.fromPartial(e??{})},fromPartial(e){let t=Ir();return t.appSlug=e.appSlug??"",t.appName=e.appName??"",t}};c.set(ye.$type,ye);function Or(){return{userId:""}}var Jt={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdRequest",encode(e,t=E.default.Writer.create()){return e.userId!==""&&t.uint32(10).string(e.userId),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Or();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.userId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{userId:x(e.userId)?globalThis.String(e.userId):""}},toJSON(e){let t={};return e.userId!==""&&(t.userId=e.userId),t},create(e){return Jt.fromPartial(e??{})},fromPartial(e){let t=Or();return t.userId=e.userId??"",t}};c.set(Jt.$type,Jt);function _r(){return{appPermissions:[],devvitApps:[]}}var Wt={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,t=E.default.Writer.create()){for(let n of e.appPermissions)Se.encode(n,t.uint32(10).fork()).ldelim();for(let n of e.devvitApps)ye.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=_r();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appPermissions.push(Se.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.devvitApps.push(ye.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appPermissions:globalThis.Array.isArray(e?.appPermissions)?e.appPermissions.map(t=>Se.fromJSON(t)):[],devvitApps:globalThis.Array.isArray(e?.devvitApps)?e.devvitApps.map(t=>ye.fromJSON(t)):[]}},toJSON(e){let t={};return e.appPermissions?.length&&(t.appPermissions=e.appPermissions.map(n=>Se.toJSON(n))),e.devvitApps?.length&&(t.devvitApps=e.devvitApps.map(n=>ye.toJSON(n))),t},create(e){return Wt.fromPartial(e??{})},fromPartial(e){let t=_r();return t.appPermissions=e.appPermissions?.map(n=>Se.fromPartial(n))||[],t.devvitApps=e.devvitApps?.map(n=>ye.fromPartial(n))||[],t}};c.set(Wt.$type,Wt);function Cr(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}var $t={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionRequest",encode(e,t=E.default.Writer.create()){e.userId!==""&&t.uint32(10).string(e.userId),e.appSlug!==""&&t.uint32(18).string(e.appSlug),e.subredditId!==""&&t.uint32(26).string(e.subredditId),t.uint32(34).fork();for(let n of e.scopes)t.int32(n);return t.ldelim(),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Cr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.userId=n.string();continue;case 2:if(r!==18)break;i.appSlug=n.string();continue;case 3:if(r!==26)break;i.subredditId=n.string();continue;case 4:if(r===32){i.scopes.push(n.int32());continue}if(r===34){let s=n.uint32()+n.pos;for(;n.pos<s;)i.scopes.push(n.int32());continue}break}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{userId:x(e.userId)?globalThis.String(e.userId):"",appSlug:x(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:x(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>Vr(t)):[]}},toJSON(e){let t={};return e.userId!==""&&(t.userId=e.userId),e.appSlug!==""&&(t.appSlug=e.appSlug),e.subredditId!==""&&(t.subredditId=e.subredditId),e.scopes?.length&&(t.scopes=e.scopes.map(n=>Pr(n))),t},create(e){return $t.fromPartial(e??{})},fromPartial(e){let t=Cr();return t.userId=e.userId??"",t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t}};c.set($t.$type,$t);function Rr(){return{error:void 0}}var Gt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode(e,t=E.default.Writer.create()){return e.error!==void 0&&U.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Rr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.error=U.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:x(e.error)?U.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=U.toJSON(e.error)),t},create(e){return Gt.fromPartial(e??{})},fromPartial(e){let t=Rr();return t.error=e.error!==void 0&&e.error!==null?U.fromPartial(e.error):void 0,t}};c.set(Gt.$type,Gt);function wr(){return{appSlug:"",userId:"",subredditId:""}}var qt={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionRequest",encode(e,t=E.default.Writer.create()){return e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.userId!==""&&t.uint32(18).string(e.userId),e.subredditId!==""&&t.uint32(26).string(e.subredditId),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=wr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appSlug=n.string();continue;case 2:if(r!==18)break;i.userId=n.string();continue;case 3:if(r!==26)break;i.subredditId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:x(e.appSlug)?globalThis.String(e.appSlug):"",userId:x(e.userId)?globalThis.String(e.userId):"",subredditId:x(e.subredditId)?globalThis.String(e.subredditId):""}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.userId!==""&&(t.userId=e.userId),e.subredditId!==""&&(t.subredditId=e.subredditId),t},create(e){return qt.fromPartial(e??{})},fromPartial(e){let t=wr();return t.appSlug=e.appSlug??"",t.userId=e.userId??"",t.subredditId=e.subredditId??"",t}};c.set(qt.$type,qt);function xr(){return{error:void 0}}var Zt={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode(e,t=E.default.Writer.create()){return e.error!==void 0&&U.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=xr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.error=U.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:x(e.error)?U.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=U.toJSON(e.error)),t},create(e){return Zt.fromPartial(e??{})},fromPartial(e){let t=xr();return t.error=e.error!==void 0&&e.error!==null?U.fromPartial(e.error):void 0,t}};c.set(Zt.$type,Zt);function kr(){return{message:""}}var U={$type:"reddit.devvit.app_permission.v1.ErrorMessage",encode(e,t=E.default.Writer.create()){return e.message!==""&&t.uint32(10).string(e.message),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=kr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.message=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{message:x(e.message)?globalThis.String(e.message):""}},toJSON(e){let t={};return e.message!==""&&(t.message=e.message),t},create(e){return U.fromPartial(e??{})},fromPartial(e){let t=kr();return t.message=e.message??"",t}};c.set(U.$type,U);function eo(e){let t=Math.trunc(e.getTime()/1e3),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function Ar(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function to(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):Ar(Ge.fromJSON(e))}function x(e){return e!=null}function Mr(){return{postId:void 0,appSlug:void 0,subredditId:void 0}}var zt={$type:"devvit.ui.effects.v1alpha.CanRunAsUserEffect",encode(e,t=qe.default.Writer.create()){return e.postId!==void 0&&t.uint32(10).string(e.postId),e.appSlug!==void 0&&t.uint32(18).string(e.appSlug),e.subredditId!==void 0&&t.uint32(26).string(e.subredditId),t},decode(e,t){let n=e instanceof qe.default.Reader?e:qe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Mr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postId=n.string();continue;case 2:if(r!==18)break;i.appSlug=n.string();continue;case 3:if(r!==26)break;i.subredditId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{postId:mt(e.postId)?globalThis.String(e.postId):void 0,appSlug:mt(e.appSlug)?globalThis.String(e.appSlug):void 0,subredditId:mt(e.subredditId)?globalThis.String(e.subredditId):void 0}},toJSON(e){let t={};return e.postId!==void 0&&(t.postId=e.postId),e.appSlug!==void 0&&(t.appSlug=e.appSlug),e.subredditId!==void 0&&(t.subredditId=e.subredditId),t},create(e){return zt.fromPartial(e??{})},fromPartial(e){let t=Mr();return t.postId=e.postId??void 0,t.appSlug=e.appSlug??void 0,t.subredditId=e.subredditId??void 0,t}};c.set(zt.$type,zt);function Fr(){return{consentStatus:0}}var oe={$type:"devvit.ui.effects.v1alpha.ConsentStatusEvent",encode(e,t=qe.default.Writer.create()){return e.consentStatus!==0&&t.uint32(8).int32(e.consentStatus),t},decode(e,t){let n=e instanceof qe.default.Reader?e:qe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Fr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.consentStatus=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{consentStatus:mt(e.consentStatus)?Ht(e.consentStatus):0}},toJSON(e){let t={};return e.consentStatus!==0&&(t.consentStatus=Kt(e.consentStatus)),t},create(e){return oe.fromPartial(e??{})},fromPartial(e){let t=Fr();return t.consentStatus=e.consentStatus??0,t}};c.set(oe.$type,oe);function mt(e){return e!=null}var He=L(P(),1);var Ze=L(P(),1);var gt=L(P(),1);function Lr(){return{}}var St={$type:"google.protobuf.Empty",encode(e,t=gt.default.Writer.create()){return t},decode(e,t){let n=e instanceof gt.default.Reader?e:gt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Lr();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return St.fromPartial(e??{})},fromPartial(e){return Lr()}};c.set(St.$type,St);function Br(){return{channels:[]}}var Xt={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=Ze.default.Writer.create()){for(let n of e.channels)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof Ze.default.Reader?e:Ze.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Br();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.channels.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channels:globalThis.Array.isArray(e?.channels)?e.channels.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.channels?.length&&(t.channels=e.channels),t},create(e){return Xt.fromPartial(e??{})},fromPartial(e){let t=Br();return t.channels=e.channels?.map(n=>n)||[],t}};c.set(Xt.$type,Xt);function Ur(){return{channel:"",data:void 0}}var se={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=Ze.default.Writer.create()){return e.channel!==""&&t.uint32(10).string(e.channel),e.data!==void 0&&G.encode(G.wrap(e.data),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof Ze.default.Reader?e:Ze.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ur();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.channel=n.string();continue;case 2:if(r!==18)break;i.data=G.unwrap(G.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channel:ro(e.channel)?globalThis.String(e.channel):"",data:no(e.data)?e.data:void 0}},toJSON(e){let t={};return e.channel!==""&&(t.channel=e.channel),e.data!==void 0&&(t.data=e.data),t},create(e){return se.fromPartial(e??{})},fromPartial(e){let t=Ur();return t.channel=e.channel??"",t.data=e.data??void 0,t}};c.set(se.$type,se);function no(e){return typeof e=="object"&&e!==null}function ro(e){return e!=null}var Ee;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ee||(Ee={}));function io(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return Ee.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return Ee.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return Ee.UNRECOGNIZED}}function oo(e){switch(e){case Ee.REALTIME_SUBSCRIBED:return 0;case Ee.REALTIME_UNSUBSCRIBED:return 1;case Ee.UNRECOGNIZED:default:return-1}}function Dr(){return{subscriptionIds:[]}}var Yt={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=He.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof He.default.Reader?e:He.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Dr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.subscriptionIds.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{subscriptionIds:globalThis.Array.isArray(e?.subscriptionIds)?e.subscriptionIds.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.subscriptionIds?.length&&(t.subscriptionIds=e.subscriptionIds),t},create(e){return Yt.fromPartial(e??{})},fromPartial(e){let t=Dr();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};c.set(Yt.$type,Yt);function Jr(){return{event:void 0,status:void 0}}var ae={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=He.default.Writer.create()){return e.event!==void 0&&se.encode(e.event,t.uint32(10).fork()).ldelim(),e.status!==void 0&&t.uint32(16).int32(e.status),t},decode(e,t){let n=e instanceof He.default.Reader?e:He.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Jr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.event=se.decode(n,n.uint32());continue;case 2:if(r!==16)break;i.status=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{event:Wr(e.event)?se.fromJSON(e.event):void 0,status:Wr(e.status)?io(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=se.toJSON(e.event)),e.status!==void 0&&(t.status=oo(e.status)),t},create(e){return ae.fromPartial(e??{})},fromPartial(e){let t=Jr();return t.event=e.event!==void 0&&e.event!==null?se.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};c.set(ae.$type,ae);function Wr(e){return e!=null}var W=L(P(),1);var yt=L(P(),1);var S=L(P(),1);var O;(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"})(O||(O={}));function Qe(e){switch(e){case 0:case"STRING":return O.STRING;case 1:case"PARAGRAPH":return O.PARAGRAPH;case 2:case"NUMBER":return O.NUMBER;case 3:case"BOOLEAN":return O.BOOLEAN;case 4:case"LIST":return O.LIST;case 5:case"SELECTION":return O.SELECTION;case 6:case"GROUP":return O.GROUP;case 7:case"IMAGE":return O.IMAGE;case-1:case"UNRECOGNIZED":default:return O.UNRECOGNIZED}}function je(e){switch(e){case O.STRING:return 0;case O.PARAGRAPH:return 1;case O.NUMBER:return 2;case O.BOOLEAN:return 3;case O.LIST:return 4;case O.SELECTION:return 5;case O.GROUP:return 6;case O.IMAGE:return 7;case O.UNRECOGNIZED:default:return-1}}var D=L(P(),1);function $r(){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 b={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,t=D.default.Writer.create()){return e.fieldType!==0&&t.uint32(8).int32(e.fieldType),e.isSecret!==void 0&&t.uint32(800).bool(e.isSecret),e.stringValue!==void 0&&t.uint32(18).string(e.stringValue),e.numberValue!==void 0&&t.uint32(25).double(e.numberValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.listValue!==void 0&&ve.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&Ne.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&be.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof D.default.Reader?e:D.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=$r();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.fieldType=n.int32();continue;case 100:if(r!==800)break;i.isSecret=n.bool();continue;case 2:if(r!==18)break;i.stringValue=n.string();continue;case 3:if(r!==25)break;i.numberValue=n.double();continue;case 4:if(r!==32)break;i.boolValue=n.bool();continue;case 5:if(r!==42)break;i.listValue=ve.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionValue=Ne.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupValue=be.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldType:ue(e.fieldType)?Qe(e.fieldType):0,isSecret:ue(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:ue(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:ue(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:ue(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:ue(e.listValue)?ve.fromJSON(e.listValue):void 0,selectionValue:ue(e.selectionValue)?Ne.fromJSON(e.selectionValue):void 0,groupValue:ue(e.groupValue)?be.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=je(e.fieldType)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),e.stringValue!==void 0&&(t.stringValue=e.stringValue),e.numberValue!==void 0&&(t.numberValue=e.numberValue),e.boolValue!==void 0&&(t.boolValue=e.boolValue),e.listValue!==void 0&&(t.listValue=ve.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=Ne.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=be.toJSON(e.groupValue)),t},create(e){return b.fromPartial(e??{})},fromPartial(e){let t=$r();return t.fieldType=e.fieldType??0,t.isSecret=e.isSecret??void 0,t.stringValue=e.stringValue??void 0,t.numberValue=e.numberValue??void 0,t.boolValue=e.boolValue??void 0,t.listValue=e.listValue!==void 0&&e.listValue!==null?ve.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?Ne.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?be.fromPartial(e.groupValue):void 0,t}};c.set(b.$type,b);function Gr(){return{itemType:0,items:[]}}var ve={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=D.default.Writer.create()){e.itemType!==0&&t.uint32(8).int32(e.itemType);for(let n of e.items)b.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof D.default.Reader?e:D.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Gr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.items.push(b.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:ue(e.itemType)?Qe(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(t=>b.fromJSON(t)):[]}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=je(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>b.toJSON(n))),t},create(e){return ve.fromPartial(e??{})},fromPartial(e){let t=Gr();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>b.fromPartial(n))||[],t}};c.set(ve.$type,ve);function qr(){return{values:[]}}var Ne={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=D.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof D.default.Reader?e:D.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=qr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?e.values.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values),t},create(e){return Ne.fromPartial(e??{})},fromPartial(e){let t=qr();return t.values=e.values?.map(n=>n)||[],t}};c.set(Ne.$type,Ne);function Zr(){return{}}var be={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=D.default.Writer.create()){return t},decode(e,t){let n=e instanceof D.default.Reader?e:D.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Zr();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return be.fromPartial(e??{})},fromPartial(e){return Zr()}};c.set(be.$type,be);function ue(e){return e!=null}function Hr(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var M={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,t=S.default.Writer.create()){return e.fieldId!==""&&t.uint32(10).string(e.fieldId),e.fieldType!==0&&t.uint32(16).int32(e.fieldType),e.label!==""&&t.uint32(26).string(e.label),e.helpText!==void 0&&t.uint32(34).string(e.helpText),e.defaultValue!==void 0&&b.encode(e.defaultValue,t.uint32(42).fork()).ldelim(),e.required!==void 0&&t.uint32(48).bool(e.required),e.disabled!==void 0&&t.uint32(56).bool(e.disabled),e.fieldConfig!==void 0&&J.encode(e.fieldConfig,t.uint32(66).fork()).ldelim(),e.isSecret!==void 0&&t.uint32(72).bool(e.isSecret),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Hr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fieldId=n.string();continue;case 2:if(r!==16)break;i.fieldType=n.int32();continue;case 3:if(r!==26)break;i.label=n.string();continue;case 4:if(r!==34)break;i.helpText=n.string();continue;case 5:if(r!==42)break;i.defaultValue=b.decode(n,n.uint32());continue;case 6:if(r!==48)break;i.required=n.bool();continue;case 7:if(r!==56)break;i.disabled=n.bool();continue;case 8:if(r!==66)break;i.fieldConfig=J.decode(n,n.uint32());continue;case 9:if(r!==72)break;i.isSecret=n.bool();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldId:h(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:h(e.fieldType)?Qe(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)?b.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)?J.fromJSON(e.fieldConfig):void 0,isSecret:h(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let t={};return e.fieldId!==""&&(t.fieldId=e.fieldId),e.fieldType!==0&&(t.fieldType=je(e.fieldType)),e.label!==""&&(t.label=e.label),e.helpText!==void 0&&(t.helpText=e.helpText),e.defaultValue!==void 0&&(t.defaultValue=b.toJSON(e.defaultValue)),e.required!==void 0&&(t.required=e.required),e.disabled!==void 0&&(t.disabled=e.disabled),e.fieldConfig!==void 0&&(t.fieldConfig=J.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return M.fromPartial(e??{})},fromPartial(e){let t=Hr();return t.fieldId=e.fieldId??"",t.fieldType=e.fieldType??0,t.label=e.label??"",t.helpText=e.helpText??void 0,t.defaultValue=e.defaultValue!==void 0&&e.defaultValue!==null?b.fromPartial(e.defaultValue):void 0,t.required=e.required??void 0,t.disabled=e.disabled??void 0,t.fieldConfig=e.fieldConfig!==void 0&&e.fieldConfig!==null?J.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};c.set(M.$type,M);function Kr(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var J={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=S.default.Writer.create()){return e.stringConfig!==void 0&&Te.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&Ie.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&Oe.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&_e.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&Ce.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&Re.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&xe.encode(e.groupConfig,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Kr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.stringConfig=Te.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.paragraphConfig=Ie.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.numberConfig=Oe.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.booleanConfig=_e.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.listConfig=Ce.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionConfig=Re.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupConfig=xe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{stringConfig:h(e.stringConfig)?Te.fromJSON(e.stringConfig):void 0,paragraphConfig:h(e.paragraphConfig)?Ie.fromJSON(e.paragraphConfig):void 0,numberConfig:h(e.numberConfig)?Oe.fromJSON(e.numberConfig):void 0,booleanConfig:h(e.booleanConfig)?_e.fromJSON(e.booleanConfig):void 0,listConfig:h(e.listConfig)?Ce.fromJSON(e.listConfig):void 0,selectionConfig:h(e.selectionConfig)?Re.fromJSON(e.selectionConfig):void 0,groupConfig:h(e.groupConfig)?xe.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=Te.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=Ie.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=Oe.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=_e.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=Ce.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=Re.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=xe.toJSON(e.groupConfig)),t},create(e){return J.fromPartial(e??{})},fromPartial(e){let t=Kr();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?Te.fromPartial(e.stringConfig):void 0,t.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?Ie.fromPartial(e.paragraphConfig):void 0,t.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?Oe.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?_e.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?Ce.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?Re.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?xe.fromPartial(e.groupConfig):void 0,t}};c.set(J.$type,J);function zr(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var Te={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.String",encode(e,t=S.default.Writer.create()){return e.minLength!==void 0&&t.uint32(8).int32(e.minLength),e.maxLength!==void 0&&t.uint32(16).int32(e.maxLength),e.placeholder!==void 0&&t.uint32(26).string(e.placeholder),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=zr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.minLength=n.int32();continue;case 2:if(r!==16)break;i.maxLength=n.int32();continue;case 3:if(r!==26)break;i.placeholder=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},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 t={};return e.minLength!==void 0&&(t.minLength=Math.round(e.minLength)),e.maxLength!==void 0&&(t.maxLength=Math.round(e.maxLength)),e.placeholder!==void 0&&(t.placeholder=e.placeholder),t},create(e){return Te.fromPartial(e??{})},fromPartial(e){let t=zr();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(Te.$type,Te);function Xr(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var Ie={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Paragraph",encode(e,t=S.default.Writer.create()){return e.maxCharacters!==void 0&&t.uint32(8).int32(e.maxCharacters),e.lineHeight!==void 0&&t.uint32(16).int32(e.lineHeight),e.placeholder!==void 0&&t.uint32(26).string(e.placeholder),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Xr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.maxCharacters=n.int32();continue;case 2:if(r!==16)break;i.lineHeight=n.int32();continue;case 3:if(r!==26)break;i.placeholder=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},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 t={};return e.maxCharacters!==void 0&&(t.maxCharacters=Math.round(e.maxCharacters)),e.lineHeight!==void 0&&(t.lineHeight=Math.round(e.lineHeight)),e.placeholder!==void 0&&(t.placeholder=e.placeholder),t},create(e){return Ie.fromPartial(e??{})},fromPartial(e){let t=Xr();return t.maxCharacters=e.maxCharacters??void 0,t.lineHeight=e.lineHeight??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(Ie.$type,Ie);function Yr(){return{step:void 0,min:void 0,max:void 0}}var Oe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Number",encode(e,t=S.default.Writer.create()){return e.step!==void 0&&t.uint32(9).double(e.step),e.min!==void 0&&t.uint32(17).double(e.min),e.max!==void 0&&t.uint32(25).double(e.max),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Yr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==9)break;i.step=n.double();continue;case 2:if(r!==17)break;i.min=n.double();continue;case 3:if(r!==25)break;i.max=n.double();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},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 t={};return e.step!==void 0&&(t.step=e.step),e.min!==void 0&&(t.min=e.min),e.max!==void 0&&(t.max=e.max),t},create(e){return Oe.fromPartial(e??{})},fromPartial(e){let t=Yr();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};c.set(Oe.$type,Oe);function Qr(){return{}}var _e={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Boolean",encode(e,t=S.default.Writer.create()){return t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Qr();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return _e.fromPartial(e??{})},fromPartial(e){return Qr()}};c.set(_e.$type,_e);function jr(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var Ce={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.List",encode(e,t=S.default.Writer.create()){return e.itemType!==0&&t.uint32(8).int32(e.itemType),e.itemConfig!==void 0&&J.encode(e.itemConfig,t.uint32(18).fork()).ldelim(),e.minEntries!==void 0&&t.uint32(24).int32(e.minEntries),e.maxEntries!==void 0&&t.uint32(32).int32(e.maxEntries),e.entryLabel!==void 0&&t.uint32(42).string(e.entryLabel),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=jr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.itemConfig=J.decode(n,n.uint32());continue;case 3:if(r!==24)break;i.minEntries=n.int32();continue;case 4:if(r!==32)break;i.maxEntries=n.int32();continue;case 5:if(r!==42)break;i.entryLabel=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:h(e.itemType)?Qe(e.itemType):0,itemConfig:h(e.itemConfig)?J.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 t={};return e.itemType!==0&&(t.itemType=je(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=J.toJSON(e.itemConfig)),e.minEntries!==void 0&&(t.minEntries=Math.round(e.minEntries)),e.maxEntries!==void 0&&(t.maxEntries=Math.round(e.maxEntries)),e.entryLabel!==void 0&&(t.entryLabel=e.entryLabel),t},create(e){return Ce.fromPartial(e??{})},fromPartial(e){let t=jr();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?J.fromPartial(e.itemConfig):void 0,t.minEntries=e.minEntries??void 0,t.maxEntries=e.maxEntries??void 0,t.entryLabel=e.entryLabel??void 0,t}};c.set(Ce.$type,Ce);function ei(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var Re={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=S.default.Writer.create()){for(let n of e.choices)we.encode(n,t.uint32(10).fork()).ldelim();return e.multiSelect!==void 0&&t.uint32(16).bool(e.multiSelect),e.minSelections!==void 0&&t.uint32(24).int32(e.minSelections),e.maxSelections!==void 0&&t.uint32(32).int32(e.maxSelections),e.renderAsList!==void 0&&t.uint32(40).bool(e.renderAsList),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ei();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.choices.push(we.decode(n,n.uint32()));continue;case 2:if(r!==16)break;i.multiSelect=n.bool();continue;case 3:if(r!==24)break;i.minSelections=n.int32();continue;case 4:if(r!==32)break;i.maxSelections=n.int32();continue;case 5:if(r!==40)break;i.renderAsList=n.bool();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{choices:globalThis.Array.isArray(e?.choices)?e.choices.map(t=>we.fromJSON(t)):[],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 t={};return e.choices?.length&&(t.choices=e.choices.map(n=>we.toJSON(n))),e.multiSelect!==void 0&&(t.multiSelect=e.multiSelect),e.minSelections!==void 0&&(t.minSelections=Math.round(e.minSelections)),e.maxSelections!==void 0&&(t.maxSelections=Math.round(e.maxSelections)),e.renderAsList!==void 0&&(t.renderAsList=e.renderAsList),t},create(e){return Re.fromPartial(e??{})},fromPartial(e){let t=ei();return t.choices=e.choices?.map(n=>we.fromPartial(n))||[],t.multiSelect=e.multiSelect??void 0,t.minSelections=e.minSelections??void 0,t.maxSelections=e.maxSelections??void 0,t.renderAsList=e.renderAsList??void 0,t}};c.set(Re.$type,Re);function ti(){return{label:"",value:""}}var we={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection.Item",encode(e,t=S.default.Writer.create()){return e.label!==""&&t.uint32(10).string(e.label),e.value!==""&&t.uint32(18).string(e.value),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ti();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.label=n.string();continue;case 2:if(r!==18)break;i.value=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{label:h(e.label)?globalThis.String(e.label):"",value:h(e.value)?globalThis.String(e.value):""}},toJSON(e){let t={};return e.label!==""&&(t.label=e.label),e.value!==""&&(t.value=e.value),t},create(e){return we.fromPartial(e??{})},fromPartial(e){let t=ti();return t.label=e.label??"",t.value=e.value??"",t}};c.set(we.$type,we);function ni(){return{fields:[]}}var xe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,t=S.default.Writer.create()){for(let n of e.fields)M.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ni();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(M.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>M.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>M.toJSON(n))),t},create(e){return xe.fromPartial(e??{})},fromPartial(e){let t=ni();return t.fields=e.fields?.map(n=>M.fromPartial(n))||[],t}};c.set(xe.$type,xe);function h(e){return e!=null}function ri(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var fe={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=yt.default.Writer.create()){for(let n of e.fields)M.encode(n,t.uint32(10).fork()).ldelim();return e.title!==void 0&&t.uint32(18).string(e.title),e.shortDescription!==void 0&&t.uint32(26).string(e.shortDescription),e.acceptLabel!==void 0&&t.uint32(34).string(e.acceptLabel),e.cancelLabel!==void 0&&t.uint32(42).string(e.cancelLabel),e.id!==void 0&&t.uint32(50).string(e.id),t},decode(e,t){let n=e instanceof yt.default.Reader?e:yt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ri();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(M.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.title=n.string();continue;case 3:if(r!==26)break;i.shortDescription=n.string();continue;case 4:if(r!==34)break;i.acceptLabel=n.string();continue;case 5:if(r!==42)break;i.cancelLabel=n.string();continue;case 6:if(r!==50)break;i.id=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>M.fromJSON(t)):[],title:it(e.title)?globalThis.String(e.title):void 0,shortDescription:it(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:it(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:it(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:it(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>M.toJSON(n))),e.title!==void 0&&(t.title=e.title),e.shortDescription!==void 0&&(t.shortDescription=e.shortDescription),e.acceptLabel!==void 0&&(t.acceptLabel=e.acceptLabel),e.cancelLabel!==void 0&&(t.cancelLabel=e.cancelLabel),e.id!==void 0&&(t.id=e.id),t},create(e){return fe.fromPartial(e??{})},fromPartial(e){let t=ri();return t.fields=e.fields?.map(n=>M.fromPartial(n))||[],t.title=e.title??void 0,t.shortDescription=e.shortDescription??void 0,t.acceptLabel=e.acceptLabel??void 0,t.cancelLabel=e.cancelLabel??void 0,t.id=e.id??void 0,t}};c.set(fe.$type,fe);function it(e){return e!=null}function ii(){return{form:void 0}}var Qt={$type:"devvit.ui.effects.v1alpha.ShowFormEffect",encode(e,t=W.default.Writer.create()){return e.form!==void 0&&fe.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ii();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.form=fe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{form:st(e.form)?fe.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=fe.toJSON(e.form)),t},create(e){return Qt.fromPartial(e??{})},fromPartial(e){let t=ii();return t.form=e.form!==void 0&&e.form!==null?fe.fromPartial(e.form):void 0,t}};c.set(Qt.$type,Qt);function oi(){return{results:{},formId:void 0}}var de={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent",encode(e,t=W.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{ot.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),e.formId!==void 0&&t.uint32(18).string(e.formId),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=oi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let s=ot.decode(n,n.uint32());s.value!==void 0&&(i.results[s.key]=s.value);continue;case 2:if(r!==18)break;i.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{results:so(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=b.fromJSON(o),t),{}):{},formId:st(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let t={};if(e.results){let n=Object.entries(e.results);n.length>0&&(t.results={},n.forEach(([o,i])=>{t.results[o]=b.toJSON(i)}))}return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return de.fromPartial(e??{})},fromPartial(e){let t=oi();return t.results=Object.entries(e.results??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=b.fromPartial(i)),n),{}),t.formId=e.formId??void 0,t}};c.set(de.$type,de);function si(){return{key:"",value:void 0}}var ot={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=W.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&b.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=si();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=b.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:st(e.key)?globalThis.String(e.key):"",value:st(e.value)?b.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=b.toJSON(e.value)),t},create(e){return ot.fromPartial(e??{})},fromPartial(e){let t=si();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?b.fromPartial(e.value):void 0,t}};c.set(ot.$type,ot);function ai(){return{formId:void 0}}var le={$type:"devvit.ui.effects.v1alpha.FormCanceledEvent",encode(e,t=W.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ai();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{formId:st(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let t={};return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return le.fromPartial(e??{})},fromPartial(e){let t=ai();return t.formId=e.formId??void 0,t}};c.set(le.$type,le);function so(e){return typeof e=="object"&&e!==null}function st(e){return e!=null}var Me;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Me||(Me={}));function ao(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return Me.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return Me.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return Me.UNRECOGNIZED}}function uo(e){switch(e){case Me.WEBVIEW_VISIBLE:return 0;case Me.WEBVIEW_HIDDEN:return 1;case Me.UNRECOGNIZED:default:return-1}}function ui(){return{message:void 0,jsonString:""}}var ke={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=T.default.Writer.create()){return e.message!==void 0&&R.encode(R.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ui();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.message=R.unwrap(R.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.jsonString=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{message:k(e?.message)?e.message:void 0,jsonString:k(e.jsonString)?globalThis.String(e.jsonString):""}},toJSON(e){let t={};return e.message!==void 0&&(t.message=e.message),e.jsonString!==""&&(t.jsonString=e.jsonString),t},create(e){return ke.fromPartial(e??{})},fromPartial(e){let t=ui();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};c.set(ke.$type,ke);function fi(){return{visibility:0}}var Ve={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=T.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=fi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.visibility=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{visibility:k(e.visibility)?ao(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=uo(e.visibility)),t},create(e){return Ve.fromPartial(e??{})},fromPartial(e){let t=fi();return t.visibility=e.visibility??0,t}};c.set(Ve.$type,Ve);function di(){return{postMessage:void 0,fullScreen:void 0}}var jt={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=T.default.Writer.create()){return e.postMessage!==void 0&&ke.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&Ve.encode(e.fullScreen,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=di();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postMessage=ke.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.fullScreen=Ve.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{postMessage:k(e.postMessage)?ke.fromJSON(e.postMessage):void 0,fullScreen:k(e.fullScreen)?Ve.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=ke.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=Ve.toJSON(e.fullScreen)),t},create(e){return jt.fromPartial(e??{})},fromPartial(e){let t=di();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?ke.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?Ve.fromPartial(e.fullScreen):void 0,t}};c.set(jt.$type,jt);function li(){return{immersiveMode:0}}var Pe={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode(e,t=T.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=li();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.immersiveMode=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{immersiveMode:k(e.immersiveMode)?Pt(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=At(e.immersiveMode)),t},create(e){return Pe.fromPartial(e??{})},fromPartial(e){let t=li();return t.immersiveMode=e.immersiveMode??0,t}};c.set(Pe.$type,Pe);function ci(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,consentStatus:void 0}}var re={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=T.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&le.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&de.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&ae.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&Pe.encode(e.immersiveModeEvent,t.uint32(42).fork()).ldelim(),e.consentStatus!==void 0&&oe.encode(e.consentStatus,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ci();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.id=n.string();continue;case 2:if(r!==18)break;i.formCanceled=le.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.formSubmitted=de.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.realtimeEvent=ae.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.immersiveModeEvent=Pe.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.consentStatus=oe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{id:k(e.id)?globalThis.String(e.id):"",formCanceled:k(e.formCanceled)?le.fromJSON(e.formCanceled):void 0,formSubmitted:k(e.formSubmitted)?de.fromJSON(e.formSubmitted):void 0,realtimeEvent:k(e.realtimeEvent)?ae.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:k(e.immersiveModeEvent)?Pe.fromJSON(e.immersiveModeEvent):void 0,consentStatus:k(e.consentStatus)?oe.fromJSON(e.consentStatus):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=le.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=de.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=ae.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(t.immersiveModeEvent=Pe.toJSON(e.immersiveModeEvent)),e.consentStatus!==void 0&&(t.consentStatus=oe.toJSON(e.consentStatus)),t},create(e){return re.fromPartial(e??{})},fromPartial(e){let t=ci();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?le.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?de.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?ae.fromPartial(e.realtimeEvent):void 0,t.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?Pe.fromPartial(e.immersiveModeEvent):void 0,t.consentStatus=e.consentStatus!==void 0&&e.consentStatus!==null?oe.fromPartial(e.consentStatus):void 0,t}};c.set(re.$type,re);function pi(){return{data:void 0}}var en={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent",encode(e,t=T.default.Writer.create()){return e.data!==void 0&&Ae.encode(e.data,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=pi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.data=Ae.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{data:k(e.data)?Ae.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.data!==void 0&&(t.data=Ae.toJSON(e.data)),t},create(e){return en.fromPartial(e??{})},fromPartial(e){let t=pi();return t.data=e.data!==void 0&&e.data!==null?Ae.fromPartial(e.data):void 0,t}};c.set(en.$type,en);function hi(){return{type:"",data:void 0}}var Ae={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent.MessageData",encode(e,t=T.default.Writer.create()){return e.type!==""&&t.uint32(10).string(e.type),e.data!==void 0&&re.encode(e.data,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=hi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.type=n.string();continue;case 2:if(r!==18)break;i.data=re.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{type:k(e.type)?globalThis.String(e.type):"",data:k(e.data)?re.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.type!==""&&(t.type=e.type),e.data!==void 0&&(t.data=re.toJSON(e.data)),t},create(e){return Ae.fromPartial(e??{})},fromPartial(e){let t=hi();return t.type=e.type??"",t.data=e.data!==void 0&&e.data!==null?re.fromPartial(e.data):void 0,t}};c.set(Ae.$type,Ae);function k(e){return e!=null}var fo=[3,11],z=e=>new Promise(t=>{let n={scope:0,type:"devvit-internal"};if(e.realtimeSubscriptions?n.realtimeEffect=e.realtimeSubscriptions:e.immersiveMode?n.immersiveMode=e.immersiveMode:e.share?n.share=e.share:n.effect=e,e.showToast?n.showToast=e.showToast:e.navigateToUrl&&(n.navigateToUrl=e.navigateToUrl),fo.includes(e.type)){let o=self.crypto.randomUUID();n.id=o;let i=r=>{if(r.data?.type==="devvit-message"&&r.data?.data?.id===o){let s=re.fromJSON(r.data.data);t(s),window.removeEventListener("message",i)}};window.addEventListener("message",i),window.parent.postMessage(n,"*")}else window.parent.postMessage(n,"*"),t(void 0)});function lo(e){let t=typeof e=="string"?e:e.url;if(!URL.canParse(t))throw new TypeError(`Invalid URL: ${t}`);let n=new URL(t).toString();z({navigateToUrl:{url:n},type:5})}var Fe;(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"})(Fe||(Fe={}));var mi;(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"})(mi||(mi={}));var co=async()=>{let e=devvit.appPermissionState;if(!e)return!0;if(e.requestedScopes.length===0)return!1;switch(e.consentStatus){case Fe.REVOKED:return!1;case Fe.GRANTED:if(e.requestedScopes.every(n=>e.grantedScopes.includes(n)))return!0;break;case Fe.CONSENT_STATUS_UNKNOWN:case Fe.UNRECOGNIZED:break;default:{e.consentStatus;break}}return(await z({canRunAsUser:{postId:devvit.context.postId,appSlug:devvit.context.appName,subredditId:devvit.context.subredditId},type:11}))?.consentStatus?.consentStatus===Fe.GRANTED};var gi="$devvit_icon.png";async function po(e){if(e.data&&e.data.length>1024)throw Error(`data must be <= ${1024} characters but was ${e.data.length} characters`);let t=`${new URL(gi,location.origin)}`,n;try{n=await fetch(t,{method:"HEAD"})}catch{}await z({type:9,share:{appIconUri:n?.ok?t:void 0,userData:e.data,text:e.text,title:e.title}})}function ho(){return devvit.share?.userData}function tn(e,t=new Set){for(let n of e){if(n.type==="group"){tn(n.fields,t);continue}let o=n.name;if(t.has(o))throw new Error(`Duplicate field name: ${o}`);t.add(o)}mo(e)}function mo(e){for(let t of e)if(t.type==="string"&&t.isSecret&&t.scope!=="app")throw`Invalid setting: only app settings can be secrets. Add "scope: SettingScope.App" to field "${t.name}"`}function go(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 yi(e){return Object.keys(e).reduce((t,n)=>{let o=go(e[n]);return o!==void 0&&(t[n]=o),t},{})}function nn(e){return e.map(t=>{switch(t.type){case"string":return So(t);case"image":return yo(t);case"paragraph":return Eo(t);case"number":return vo(t);case"select":return No(t);case"boolean":return bo(t);case"group":return To(t);default:throw new Error("Unknown field type.")}})}function So(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 yo(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function Eo(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 vo(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 No(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 bo(e){return{defaultValue:{fieldType:3,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:3,helpText:e.helpText,label:e.label}}function To(e){return{fieldId:"",fieldType:6,fieldConfig:{groupConfig:{fields:nn(e.fields)}},label:e.label,helpText:e.helpText}}var Ei=1,Io=()=>(Ei++,`form.${Ei}`),Oo=async e=>{let t={fields:[],id:Io(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};tn(e.fields),t.fields=nn(e.fields);let n=await z({showForm:{form:t},type:3});return!n||!n.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:yi(n.formSubmitted.results)}};function _o(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?1:0}:t={text:e},z({showToast:{toast:t},type:4})}var ce;(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"})(ce||(ce={}));var rn=new Set,Co=()=>bi(devvit.webViewMode);function Ro(e,t){return vi(ce.IMMERSIVE_MODE,e,t)}function wo(e){return vi(ce.INLINE_MODE,e,void 0)}function xo(e){rn.add(e)}function ko(e){rn.delete(e)}async function vi(e,t,n){if(!t.isTrusted||t.type!=="click")throw console.error("Expanded mode effect ignored due to untrusted event"),new Error("Untrusted event");if(n!=null&&!devvit.entrypoints[n])throw Error(`no entrypoint named "${n}"; all entrypoints must appear in \`devvit.json\` \`post.entrypoints\``);await z({type:9,immersiveMode:{entryUrl:devvit.entrypoints[n??""],immersiveMode:e}})}function Ni(){addEventListener("message",e=>{let{type:t,data:n}=e.data;if(t!=="devvit-message"||!n?.immersiveModeEvent)return;devvit.webViewMode=n.immersiveModeEvent.immersiveMode;let o=bi(n.immersiveModeEvent.immersiveMode);rn.forEach(i=>i(o))})}function bi(e){switch(e){case ce.IMMERSIVE_MODE:return"expanded";case ce.INLINE_MODE:case ce.UNRECOGNIZED:case ce.UNSPECIFIED:case void 0:return"inline";default:throw Error(`${e} not a WebViewImmersiveMode`)}}Ni();export{xo as addWebViewModeListener,co as canRunAsUser,zi as context,wo as exitExpandedMode,ho as getShareData,Co as getWebViewMode,lo as navigateTo,ko as removeWebViewModeListener,Ro as requestExpandedMode,Oo as showForm,po as showShareSheet,_o as showToast};
1
+ var mi=Object.create;var tn=Object.defineProperty;var gi=Object.getOwnPropertyDescriptor;var Si=Object.getOwnPropertyNames;var yi=Object.getPrototypeOf,Ei=Object.prototype.hasOwnProperty;var _=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var vi=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Si(t))!Ei.call(e,i)&&i!==n&&tn(e,i,{get:()=>t[i],enumerable:!(o=gi(t,i))||o.enumerable});return e};var M=(e,t,n)=>(n=e!=null?mi(yi(e)):{},vi(t||!e||!e.__esModule?tn(n,"default",{value:e,enumerable:!0}):n,e));var rn=_((ro,nn)=>{"use strict";nn.exports=Ni;function Ni(e,t){for(var n=new Array(arguments.length-1),o=0,i=2,r=!0;i<arguments.length;)n[o++]=arguments[i++];return new Promise(function(d,a){n[o]=function(l){if(r)if(r=!1,l)a(l);else{for(var N=new Array(arguments.length-1),v=0;v<N.length;)N[v++]=arguments[v];d.apply(null,N)}};try{e.apply(t||null,n)}catch(u){r&&(r=!1,a(u))}})}});var un=_(an=>{"use strict";var st=an;st.length=function(t){var n=t.length;if(!n)return 0;for(var o=0;--n%4>1&&t.charAt(n)==="=";)++o;return Math.ceil(t.length*3)/4-o};var Ze=new Array(64),sn=new Array(123);for(X=0;X<64;)sn[Ze[X]=X<26?X+65:X<52?X+71:X<62?X-4:X-59|43]=X++;var X;st.encode=function(t,n,o){for(var i=null,r=[],s=0,d=0,a;n<o;){var u=t[n++];switch(d){case 0:r[s++]=Ze[u>>2],a=(u&3)<<4,d=1;break;case 1:r[s++]=Ze[a|u>>4],a=(u&15)<<2,d=2;break;case 2:r[s++]=Ze[a|u>>6],r[s++]=Ze[u&63],d=0;break}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,r)),s=0)}return d&&(r[s++]=Ze[a],r[s++]=61,d===1&&(r[s++]=61)),i?(s&&i.push(String.fromCharCode.apply(String,r.slice(0,s))),i.join("")):String.fromCharCode.apply(String,r.slice(0,s))};var on="invalid encoding";st.decode=function(t,n,o){for(var i=o,r=0,s,d=0;d<t.length;){var a=t.charCodeAt(d++);if(a===61&&r>1)break;if((a=sn[a])===void 0)throw Error(on);switch(r){case 0:s=a,r=1;break;case 1:n[o++]=s<<2|(a&48)>>4,s=a,r=2;break;case 2:n[o++]=(s&15)<<4|(a&60)>>2,s=a,r=3;break;case 3:n[o++]=(s&3)<<6|a,r=0;break}}if(r===1)throw Error(on);return o-i};st.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var dn=_((oo,fn)=>{"use strict";fn.exports=at;function at(){this._listeners={}}at.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};at.prototype.off=function(t,n){if(t===void 0)this._listeners={};else if(n===void 0)this._listeners[t]=[];else for(var o=this._listeners[t],i=0;i<o.length;)o[i].fn===n?o.splice(i,1):++i;return this};at.prototype.emit=function(t){var n=this._listeners[t];if(n){for(var o=[],i=1;i<arguments.length;)o.push(arguments[i++]);for(i=0;i<n.length;)n[i].fn.apply(n[i++].ctx,o)}return this}});var Sn=_((so,gn)=>{"use strict";gn.exports=ln(ln);function ln(e){return typeof Float32Array<"u"?(function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function i(a,u,l){t[0]=a,u[l]=n[0],u[l+1]=n[1],u[l+2]=n[2],u[l+3]=n[3]}function r(a,u,l){t[0]=a,u[l]=n[3],u[l+1]=n[2],u[l+2]=n[1],u[l+3]=n[0]}e.writeFloatLE=o?i:r,e.writeFloatBE=o?r:i;function s(a,u){return n[0]=a[u],n[1]=a[u+1],n[2]=a[u+2],n[3]=a[u+3],t[0]}function d(a,u){return n[3]=a[u],n[2]=a[u+1],n[1]=a[u+2],n[0]=a[u+3],t[0]}e.readFloatLE=o?s:d,e.readFloatBE=o?d:s})():(function(){function t(o,i,r,s){var d=i<0?1:0;if(d&&(i=-i),i===0)o(1/i>0?0:2147483648,r,s);else if(isNaN(i))o(2143289344,r,s);else if(i>34028234663852886e22)o((d<<31|2139095040)>>>0,r,s);else if(i<11754943508222875e-54)o((d<<31|Math.round(i/1401298464324817e-60))>>>0,r,s);else{var a=Math.floor(Math.log(i)/Math.LN2),u=Math.round(i*Math.pow(2,-a)*8388608)&8388607;o((d<<31|a+127<<23|u)>>>0,r,s)}}e.writeFloatLE=t.bind(null,cn),e.writeFloatBE=t.bind(null,pn);function n(o,i,r){var s=o(i,r),d=(s>>31)*2+1,a=s>>>23&255,u=s&8388607;return a===255?u?NaN:d*(1/0):a===0?d*1401298464324817e-60*u:d*Math.pow(2,a-150)*(u+8388608)}e.readFloatLE=n.bind(null,hn),e.readFloatBE=n.bind(null,mn)})(),typeof Float64Array<"u"?(function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function i(a,u,l){t[0]=a,u[l]=n[0],u[l+1]=n[1],u[l+2]=n[2],u[l+3]=n[3],u[l+4]=n[4],u[l+5]=n[5],u[l+6]=n[6],u[l+7]=n[7]}function r(a,u,l){t[0]=a,u[l]=n[7],u[l+1]=n[6],u[l+2]=n[5],u[l+3]=n[4],u[l+4]=n[3],u[l+5]=n[2],u[l+6]=n[1],u[l+7]=n[0]}e.writeDoubleLE=o?i:r,e.writeDoubleBE=o?r:i;function s(a,u){return n[0]=a[u],n[1]=a[u+1],n[2]=a[u+2],n[3]=a[u+3],n[4]=a[u+4],n[5]=a[u+5],n[6]=a[u+6],n[7]=a[u+7],t[0]}function d(a,u){return n[7]=a[u],n[6]=a[u+1],n[5]=a[u+2],n[4]=a[u+3],n[3]=a[u+4],n[2]=a[u+5],n[1]=a[u+6],n[0]=a[u+7],t[0]}e.readDoubleLE=o?s:d,e.readDoubleBE=o?d:s})():(function(){function t(o,i,r,s,d,a){var u=s<0?1:0;if(u&&(s=-s),s===0)o(0,d,a+i),o(1/s>0?0:2147483648,d,a+r);else if(isNaN(s))o(0,d,a+i),o(2146959360,d,a+r);else if(s>17976931348623157e292)o(0,d,a+i),o((u<<31|2146435072)>>>0,d,a+r);else{var l;if(s<22250738585072014e-324)l=s/5e-324,o(l>>>0,d,a+i),o((u<<31|l/4294967296)>>>0,d,a+r);else{var N=Math.floor(Math.log(s)/Math.LN2);N===1024&&(N=1023),l=s*Math.pow(2,-N),o(l*4503599627370496>>>0,d,a+i),o((u<<31|N+1023<<20|l*1048576&1048575)>>>0,d,a+r)}}}e.writeDoubleLE=t.bind(null,cn,0,4),e.writeDoubleBE=t.bind(null,pn,4,0);function n(o,i,r,s,d){var a=o(s,d+i),u=o(s,d+r),l=(u>>31)*2+1,N=u>>>20&2047,v=4294967296*(u&1048575)+a;return N===2047?v?NaN:l*(1/0):N===0?l*5e-324*v:l*Math.pow(2,N-1075)*(v+4503599627370496)}e.readDoubleLE=n.bind(null,hn,0,4),e.readDoubleBE=n.bind(null,mn,4,0)})(),e}function cn(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function pn(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=e&255}function hn(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function mn(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var yn=_((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 vn=_(En=>{"use strict";var gt=En;gt.length=function(t){for(var n=0,o=0,i=0;i<t.length;++i)o=t.charCodeAt(i),o<128?n+=1:o<2048?n+=2:(o&64512)===55296&&(t.charCodeAt(i+1)&64512)===56320?(++i,n+=4):n+=3;return n};gt.read=function(t,n,o){var i=o-n;if(i<1)return"";for(var r=null,s=[],d=0,a;n<o;)a=t[n++],a<128?s[d++]=a:a>191&&a<224?s[d++]=(a&31)<<6|t[n++]&63:a>239&&a<365?(a=((a&7)<<18|(t[n++]&63)<<12|(t[n++]&63)<<6|t[n++]&63)-65536,s[d++]=55296+(a>>10),s[d++]=56320+(a&1023)):s[d++]=(a&15)<<12|(t[n++]&63)<<6|t[n++]&63,d>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,s)),d=0);return r?(d&&r.push(String.fromCharCode.apply(String,s.slice(0,d))),r.join("")):String.fromCharCode.apply(String,s.slice(0,d))};gt.write=function(t,n,o){for(var i=o,r,s,d=0;d<t.length;++d)r=t.charCodeAt(d),r<128?n[o++]=r:r<2048?(n[o++]=r>>6|192,n[o++]=r&63|128):(r&64512)===55296&&((s=t.charCodeAt(d+1))&64512)===56320?(r=65536+((r&1023)<<10)+(s&1023),++d,n[o++]=r>>18|240,n[o++]=r>>12&63|128,n[o++]=r>>6&63|128,n[o++]=r&63|128):(n[o++]=r>>12|224,n[o++]=r>>6&63|128,n[o++]=r&63|128);return o-i}});var bn=_((uo,Nn)=>{"use strict";Nn.exports=bi;function bi(e,t,n){var o=n||8192,i=o>>>1,r=null,s=o;return function(a){if(a<1||a>i)return e(a);s+a>o&&(r=e(o),s=0);var u=t.call(r,s,s+=a);return s&7&&(s=(s|7)+1),u}}});var In=_((fo,Tn)=>{"use strict";Tn.exports=R;var Qe=he();function R(e,t){this.lo=e>>>0,this.hi=t>>>0}var Le=R.zero=new R(0,0);Le.toNumber=function(){return 0};Le.zzEncode=Le.zzDecode=function(){return this};Le.length=function(){return 1};var Ti=R.zeroHash="\0\0\0\0\0\0\0\0";R.fromNumber=function(t){if(t===0)return Le;var n=t<0;n&&(t=-t);var o=t>>>0,i=(t-o)/4294967296>>>0;return n&&(i=~i>>>0,o=~o>>>0,++o>4294967295&&(o=0,++i>4294967295&&(i=0))),new R(o,i)};R.from=function(t){if(typeof t=="number")return R.fromNumber(t);if(Qe.isString(t))if(Qe.Long)t=Qe.Long.fromString(t);else return R.fromNumber(parseInt(t,10));return t.low||t.high?new R(t.low>>>0,t.high>>>0):Le};R.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var n=~this.lo+1>>>0,o=~this.hi>>>0;return n||(o=o+1>>>0),-(n+o*4294967296)}return this.lo+this.hi*4294967296};R.prototype.toLong=function(t){return Qe.Long?new Qe.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var pe=String.prototype.charCodeAt;R.fromHash=function(t){return t===Ti?Le:new R((pe.call(t,0)|pe.call(t,1)<<8|pe.call(t,2)<<16|pe.call(t,3)<<24)>>>0,(pe.call(t,4)|pe.call(t,5)<<8|pe.call(t,6)<<16|pe.call(t,7)<<24)>>>0)};R.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)};R.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};R.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};R.prototype.length=function(){var t=this.lo,n=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?n===0?t<16384?t<128?1:2:t<2097152?3:4:n<16384?n<128?5:6:n<2097152?7:8:o<128?9:10}});var he=_(St=>{"use strict";var p=St;p.asPromise=rn();p.base64=un();p.EventEmitter=dn();p.float=Sn();p.inquire=yn();p.utf8=vn();p.pool=bn();p.LongBits=In();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||St;p.emptyArray=Object.freeze?Object.freeze([]):[];p.emptyObject=Object.freeze?Object.freeze({}):{};p.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};p.isString=function(t){return typeof t=="string"||t instanceof String};p.isObject=function(t){return t&&typeof t=="object"};p.isset=p.isSet=function(t,n){var o=t[n];return o!=null&&t.hasOwnProperty(n)?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(t){return typeof t=="number"?p.Buffer?p._Buffer_allocUnsafe(t):new p.Array(t):p.Buffer?p._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};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(t){return t?p.LongBits.from(t).toHash():p.LongBits.zeroHash};p.longFromHash=function(t,n){var o=p.LongBits.fromHash(t);return p.Long?p.Long.fromBits(o.lo,o.hi,n):o.toNumber(!!n)};function On(e,t,n){for(var o=Object.keys(t),i=0;i<o.length;++i)(e[o[i]]===void 0||!n)&&(e[o[i]]=t[o[i]]);return e}p.merge=On;p.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function _n(e){function t(n,o){if(!(this instanceof t))return new t(n,o);Object.defineProperty(this,"message",{get:function(){return n}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),o&&On(this,o)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,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}}),t}p.newError=_n;p.ProtocolError=_n("ProtocolError");p.oneOfGetter=function(t){for(var n={},o=0;o<t.length;++o)n[t[o]]=1;return function(){for(var i=Object.keys(this),r=i.length-1;r>-1;--r)if(n[i[r]]===1&&this[i[r]]!==void 0&&this[i[r]]!==null)return i[r]}};p.oneOfSetter=function(t){return function(n){for(var o=0;o<t.length;++o)t[o]!==n&&delete this[t[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(n,o){return new e(n,o)},p._Buffer_allocUnsafe=e.allocUnsafe||function(n){return new e(n)}}});var It=_((co,kn)=>{"use strict";kn.exports=m;var G=he(),yt,ut=G.LongBits,Rn=G.base64,Cn=G.utf8;function je(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function vt(){}function Ii(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 je(vt,0,0),this.tail=this.head,this.states=null}var Vn=function(){return G.Buffer?function(){return(m.create=function(){return new yt})()}:function(){return new m}};m.create=Vn();m.alloc=function(t){return new G.Array(t)};G.Array!==Array&&(m.alloc=G.pool(m.alloc,G.Array.prototype.subarray));m.prototype._push=function(t,n,o){return this.tail=this.tail.next=new je(t,n,o),this.len+=n,this};function Nt(e,t,n){t[n]=e&255}function Oi(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function bt(e,t){this.len=e,this.next=void 0,this.val=t}bt.prototype=Object.create(je.prototype);bt.prototype.fn=Oi;m.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new bt((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};m.prototype.int32=function(t){return t<0?this._push(Tt,10,ut.fromNumber(t)):this.uint32(t)};m.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Tt(e,t,n){for(;e.hi;)t[n++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=e.lo&127|128,e.lo=e.lo>>>7;t[n++]=e.lo}m.prototype.uint64=function(t){var n=ut.from(t);return this._push(Tt,n.length(),n)};m.prototype.int64=m.prototype.uint64;m.prototype.sint64=function(t){var n=ut.from(t).zzEncode();return this._push(Tt,n.length(),n)};m.prototype.bool=function(t){return this._push(Nt,1,t?1:0)};function Et(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}m.prototype.fixed32=function(t){return this._push(Et,4,t>>>0)};m.prototype.sfixed32=m.prototype.fixed32;m.prototype.fixed64=function(t){var n=ut.from(t);return this._push(Et,4,n.lo)._push(Et,4,n.hi)};m.prototype.sfixed64=m.prototype.fixed64;m.prototype.float=function(t){return this._push(G.float.writeFloatLE,4,t)};m.prototype.double=function(t){return this._push(G.float.writeDoubleLE,8,t)};var _i=G.Array.prototype.set?function(t,n,o){n.set(t,o)}:function(t,n,o){for(var i=0;i<t.length;++i)n[o+i]=t[i]};m.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push(Nt,1,0);if(G.isString(t)){var o=m.alloc(n=Rn.length(t));Rn.decode(t,o,0),t=o}return this.uint32(n)._push(_i,n,t)};m.prototype.string=function(t){var n=Cn.length(t);return n?this.uint32(n)._push(Cn.write,n,t):this._push(Nt,1,0)};m.prototype.fork=function(){return this.states=new Ii(this),this.head=this.tail=new je(vt,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 je(vt,0,0),this.len=0),this};m.prototype.ldelim=function(){var t=this.head,n=this.tail,o=this.len;return this.reset().uint32(o),o&&(this.tail.next=t.next,this.tail=n,this.len+=o),this};m.prototype.finish=function(){for(var t=this.head.next,n=this.constructor.alloc(this.len),o=0;t;)t.fn(t.val,n,o),o+=t.len,t=t.next;return n};m._configure=function(e){yt=e,m.create=Vn(),yt._configure()}});var Pn=_((po,xn)=>{"use strict";xn.exports=ee;var wn=It();(ee.prototype=Object.create(wn.prototype)).constructor=ee;var me=he();function ee(){wn.call(this)}ee._configure=function(){ee.alloc=me._Buffer_allocUnsafe,ee.writeBytesBuffer=me.Buffer&&me.Buffer.prototype instanceof Uint8Array&&me.Buffer.prototype.set.name==="set"?function(t,n,o){n.set(t,o)}:function(t,n,o){if(t.copy)t.copy(n,o,0,t.length);else for(var i=0;i<t.length;)n[o++]=t[i++]}};ee.prototype.bytes=function(t){me.isString(t)&&(t=me._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(ee.writeBytesBuffer,n,t),this};function Ri(e,t,n){e.length<40?me.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}ee.prototype.string=function(t){var n=me.Buffer.byteLength(t);return this.uint32(n),n&&this._push(Ri,n,t),this};ee._configure()});var Rt=_((ho,Bn)=>{"use strict";Bn.exports=I;var Y=he(),_t,Ln=Y.LongBits,Ci=Y.utf8;function Q(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function I(e){this.buf=e,this.pos=0,this.len=e.length}var Fn=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new I(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new I(t);throw Error("illegal buffer")},Mn=function(){return Y.Buffer?function(n){return(I.create=function(i){return Y.Buffer.isBuffer(i)?new _t(i):Fn(i)})(n)}:Fn};I.create=Mn();I.prototype._slice=Y.Array.prototype.subarray||Y.Array.prototype.slice;I.prototype.uint32=(function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,Q(this,10);return t}})();I.prototype.int32=function(){return this.uint32()|0};I.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function Ot(){var e=new Ln(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*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;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Q(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw Q(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}I.prototype.bool=function(){return this.uint32()!==0};function ft(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}I.prototype.fixed32=function(){if(this.pos+4>this.len)throw Q(this,4);return ft(this.buf,this.pos+=4)};I.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Q(this,4);return ft(this.buf,this.pos+=4)|0};function An(){if(this.pos+8>this.len)throw Q(this,8);return new Ln(ft(this.buf,this.pos+=4),ft(this.buf,this.pos+=4))}I.prototype.float=function(){if(this.pos+4>this.len)throw Q(this,4);var t=Y.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};I.prototype.double=function(){if(this.pos+8>this.len)throw Q(this,4);var t=Y.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};I.prototype.bytes=function(){var t=this.uint32(),n=this.pos,o=this.pos+t;if(o>this.len)throw Q(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(n,o);if(n===o){var i=Y.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,n,o)};I.prototype.string=function(){var t=this.bytes();return Ci.read(t,0,t.length)};I.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Q(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Q(this);while(this.buf[this.pos++]&128);return this};I.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};I._configure=function(e){_t=e,I.create=Mn(),_t._configure();var t=Y.Long?"toLong":"toNumber";Y.merge(I.prototype,{int64:function(){return Ot.call(this)[t](!1)},uint64:function(){return Ot.call(this)[t](!0)},sint64:function(){return Ot.call(this).zzDecode()[t](!1)},fixed64:function(){return An.call(this)[t](!0)},sfixed64:function(){return An.call(this)[t](!1)}})}});var Wn=_((mo,Jn)=>{"use strict";Jn.exports=Me;var Dn=Rt();(Me.prototype=Object.create(Dn.prototype)).constructor=Me;var Un=he();function Me(e){Dn.call(this,e)}Me._configure=function(){Un.Buffer&&(Me.prototype._slice=Un.Buffer.prototype.slice)};Me.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};Me._configure()});var $n=_((go,Gn)=>{"use strict";Gn.exports=et;var Ct=he();(et.prototype=Object.create(Ct.EventEmitter.prototype)).constructor=et;function et(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");Ct.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}et.prototype.rpcCall=function e(t,n,o,i,r){if(!i)throw TypeError("request must be specified");var s=this;if(!r)return Ct.asPromise(e,s,t,n,o,i);if(!s.rpcImpl){setTimeout(function(){r(Error("already ended"))},0);return}try{return s.rpcImpl(t,n[s.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(a,u){if(a)return s.emit("error",a,t),r(a);if(u===null){s.end(!0);return}if(!(u instanceof o))try{u=o[s.responseDelimited?"decodeDelimited":"decode"](u)}catch(l){return s.emit("error",l,t),r(l)}return s.emit("data",u,t),r(null,u)})}catch(d){s.emit("error",d,t),setTimeout(function(){r(d)},0);return}};et.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Zn=_(qn=>{"use strict";var Vi=qn;Vi.Service=$n()});var zn=_((yo,Hn)=>{"use strict";Hn.exports={}});var Yn=_(Xn=>{"use strict";var x=Xn;x.build="minimal";x.Writer=It();x.BufferWriter=Pn();x.Reader=Rt();x.BufferReader=Wn();x.util=he();x.rpc=Zn();x.roots=zn();x.configure=Kn;function Kn(){x.util._configure(),x.Writer._configure(x.BufferWriter),x.Reader._configure(x.BufferReader)}Kn()});var P=_((vo,Qn)=>{"use strict";Qn.exports=Yn()});var to=globalThis.devvit?.context;var T=M(P(),1);var B=M(P(),1);var c=new Map;var Ue;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ue||(Ue={}));function ki(e){switch(e){case 0:case"NULL_VALUE":return Ue.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return Ue.UNRECOGNIZED}}function wi(e){switch(e){case Ue.NULL_VALUE:return 0;case Ue.UNRECOGNIZED:default:return-1}}function Vt(){return{fields:{}}}var $={$type:"google.protobuf.Struct",encode(e,t=B.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&tt.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof B.default.Reader?e:B.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Vt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let s=tt.decode(n,n.uint32());s.value!==void 0&&(i.fields[s.key]=s.value);continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:er(e.fields)?Object.entries(e.fields).reduce((t,[n,o])=>(t[n]=o,t),{}):{}}},toJSON(e){let t={};if(e.fields){let n=Object.entries(e.fields);n.length>0&&(t.fields={},n.forEach(([o,i])=>{t.fields[o]=i}))}return t},create(e){return $.fromPartial(e??{})},fromPartial(e){let t=Vt();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),{}),t},wrap(e){let t=Vt();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};c.set($.$type,$);function jn(){return{key:"",value:void 0}}var tt={$type:"google.protobuf.Struct.FieldsEntry",encode(e,t=B.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&C.encode(C.wrap(e.value),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof B.default.Reader?e:B.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=jn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=C.unwrap(C.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:He(e.key)?globalThis.String(e.key):"",value:He(e?.value)?e.value:void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=e.value),t},create(e){return tt.fromPartial(e??{})},fromPartial(e){let t=jn();return t.key=e.key??"",t.value=e.value??void 0,t}};c.set(tt.$type,tt);function kt(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var C={$type:"google.protobuf.Value",encode(e,t=B.default.Writer.create()){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&$.encode($.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&Be.encode(Be.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof B.default.Reader?e:B.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=kt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.nullValue=n.int32();continue;case 2:if(r!==17)break;i.numberValue=n.double();continue;case 3:if(r!==26)break;i.stringValue=n.string();continue;case 4:if(r!==32)break;i.boolValue=n.bool();continue;case 5:if(r!==42)break;i.structValue=$.unwrap($.decode(n,n.uint32()));continue;case 6:if(r!==50)break;i.listValue=Be.unwrap(Be.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{nullValue:He(e.nullValue)?ki(e.nullValue):void 0,numberValue:He(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:He(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:He(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:er(e.structValue)?e.structValue:void 0,listValue:globalThis.Array.isArray(e.listValue)?[...e.listValue]:void 0}},toJSON(e){let t={};return e.nullValue!==void 0&&(t.nullValue=wi(e.nullValue)),e.numberValue!==void 0&&(t.numberValue=e.numberValue),e.stringValue!==void 0&&(t.stringValue=e.stringValue),e.boolValue!==void 0&&(t.boolValue=e.boolValue),e.structValue!==void 0&&(t.structValue=e.structValue),e.listValue!==void 0&&(t.listValue=e.listValue),t},create(e){return C.fromPartial(e??{})},fromPartial(e){let t=kt();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=kt();if(e===null)t.nullValue=Ue.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new globalThis.Error("Unsupported any value type: "+typeof e);return t},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}};c.set(C.$type,C);function wt(){return{values:[]}}var Be={$type:"google.protobuf.ListValue",encode(e,t=B.default.Writer.create()){for(let n of e.values)C.encode(C.wrap(n),t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof B.default.Reader?e:B.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=wt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(C.unwrap(C.decode(n,n.uint32())));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?[...e.values]:[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values),t},create(e){return Be.fromPartial(e??{})},fromPartial(e){let t=wt();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=wt();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};c.set(Be.$type,Be);function er(e){return typeof e=="object"&&e!==null}function He(e){return e!=null}var Ge=M(P(),1);var E=M(P(),1);var q=null;try{q=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 y(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}y.prototype.__isLong__;Object.defineProperty(y.prototype,"__isLong__",{value:!0});function V(e){return(e&&e.__isLong__)===!0}function tr(e){var t=Math.clz32(e&-e);return e?31-t:t}y.isLong=V;var nr={},rr={};function De(e,t){var n,o,i;return t?(e>>>=0,(i=0<=e&&e<256)&&(o=rr[e],o)?o:(n=g(e,0,!0),i&&(rr[e]=n),n)):(e|=0,(i=-128<=e&&e<128)&&(o=nr[e],o)?o:(n=g(e,e<0?-1:0,!1),i&&(nr[e]=n),n))}y.fromInt=De;function Z(e,t){if(isNaN(e))return t?ie:j;if(t){if(e<0)return ie;if(e>=ar)return dr}else{if(e<=-or)return F;if(e+1>=or)return fr}return e<0?Z(-e,t).neg():g(e%Ke|0,e/Ke|0,t)}y.fromNumber=Z;function g(e,t,n){return new y(e,t,n)}y.fromBits=g;var dt=Math.pow;function Pt(e,t,n){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(n=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?ie:j;if(n=n||10,n<2||36<n)throw RangeError("radix");var o;if((o=e.indexOf("-"))>0)throw Error("interior hyphen");if(o===0)return Pt(e.substring(1),t,n).neg();for(var i=Z(dt(n,8)),r=j,s=0;s<e.length;s+=8){var d=Math.min(8,e.length-s),a=parseInt(e.substring(s,s+d),n);if(d<8){var u=Z(dt(n,d));r=r.mul(u).add(Z(a))}else r=r.mul(i),r=r.add(Z(a))}return r.unsigned=t,r}y.fromString=Pt;function H(e,t){return typeof e=="number"?Z(e,t):typeof e=="string"?Pt(e,t):g(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}y.fromValue=H;var ir=65536,xi=1<<24,Ke=ir*ir,ar=Ke*Ke,or=ar/2,sr=De(xi),j=De(0);y.ZERO=j;var ie=De(0,!0);y.UZERO=ie;var ze=De(1);y.ONE=ze;var ur=De(1,!0);y.UONE=ur;var xt=De(-1);y.NEG_ONE=xt;var fr=g(-1,2147483647,!1);y.MAX_VALUE=fr;var dr=g(-1,-1,!0);y.MAX_UNSIGNED_VALUE=dr;var F=g(0,-2147483648,!1);y.MIN_VALUE=F;var f=y.prototype;f.toInt=function(){return this.unsigned?this.low>>>0:this.low};f.toNumber=function(){return this.unsigned?(this.high>>>0)*Ke+(this.low>>>0):this.high*Ke+(this.low>>>0)};f.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(F)){var n=Z(t),o=this.div(n),i=o.mul(n).sub(this);return o.toString(t)+i.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var r=Z(dt(t,6),this.unsigned),s=this,d="";;){var a=s.div(r),u=s.sub(a.mul(r)).toInt()>>>0,l=u.toString(t);if(s=a,s.isZero())return l+d;for(;l.length<6;)l="0"+l;d=""+l+d}};f.getHighBits=function(){return this.high};f.getHighBitsUnsigned=function(){return this.high>>>0};f.getLowBits=function(){return this.low};f.getLowBitsUnsigned=function(){return this.low>>>0};f.getNumBitsAbs=function(){if(this.isNegative())return this.eq(F)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,n=31;n>0&&(t&1<<n)==0;n--);return this.high!=0?n+33:n+1};f.isSafeInteger=function(){var t=this.high>>21;return t?this.unsigned?!1:t===-1&&!(this.low===0&&this.high===-2097152):!0};f.isZero=function(){return this.high===0&&this.low===0};f.eqz=f.isZero;f.isNegative=function(){return!this.unsigned&&this.high<0};f.isPositive=function(){return this.unsigned||this.high>=0};f.isOdd=function(){return(this.low&1)===1};f.isEven=function(){return(this.low&1)===0};f.equals=function(t){return V(t)||(t=H(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};f.eq=f.equals;f.notEquals=function(t){return!this.eq(t)};f.neq=f.notEquals;f.ne=f.notEquals;f.lessThan=function(t){return this.comp(t)<0};f.lt=f.lessThan;f.lessThanOrEqual=function(t){return this.comp(t)<=0};f.lte=f.lessThanOrEqual;f.le=f.lessThanOrEqual;f.greaterThan=function(t){return this.comp(t)>0};f.gt=f.greaterThan;f.greaterThanOrEqual=function(t){return this.comp(t)>=0};f.gte=f.greaterThanOrEqual;f.ge=f.greaterThanOrEqual;f.compare=function(t){if(V(t)||(t=H(t)),this.eq(t))return 0;var n=this.isNegative(),o=t.isNegative();return n&&!o?-1:!n&&o?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};f.comp=f.compare;f.negate=function(){return!this.unsigned&&this.eq(F)?F:this.not().add(ze)};f.neg=f.negate;f.add=function(t){V(t)||(t=H(t));var n=this.high>>>16,o=this.high&65535,i=this.low>>>16,r=this.low&65535,s=t.high>>>16,d=t.high&65535,a=t.low>>>16,u=t.low&65535,l=0,N=0,v=0,L=0;return L+=r+u,v+=L>>>16,L&=65535,v+=i+a,N+=v>>>16,v&=65535,N+=o+d,l+=N>>>16,N&=65535,l+=n+s,l&=65535,g(v<<16|L,l<<16|N,this.unsigned)};f.subtract=function(t){return V(t)||(t=H(t)),this.add(t.neg())};f.sub=f.subtract;f.multiply=function(t){if(this.isZero())return this;if(V(t)||(t=H(t)),q){var n=q.mul(this.low,this.high,t.low,t.high);return g(n,q.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?ie:j;if(this.eq(F))return t.isOdd()?F:j;if(t.eq(F))return this.isOdd()?F:j;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(sr)&&t.lt(sr))return Z(this.toNumber()*t.toNumber(),this.unsigned);var o=this.high>>>16,i=this.high&65535,r=this.low>>>16,s=this.low&65535,d=t.high>>>16,a=t.high&65535,u=t.low>>>16,l=t.low&65535,N=0,v=0,L=0,ot=0;return ot+=s*l,L+=ot>>>16,ot&=65535,L+=r*l,v+=L>>>16,L&=65535,L+=s*u,v+=L>>>16,L&=65535,v+=i*l,N+=v>>>16,v&=65535,v+=r*u,N+=v>>>16,v&=65535,v+=s*a,N+=v>>>16,v&=65535,N+=o*l+i*u+r*a+s*d,N&=65535,g(L<<16|ot,N<<16|v,this.unsigned)};f.mul=f.multiply;f.divide=function(t){if(V(t)||(t=H(t)),t.isZero())throw Error("division by zero");if(q){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?q.div_u:q.div_s)(this.low,this.high,t.low,t.high);return g(n,q.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?ie:j;var o,i,r;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return ie;if(t.gt(this.shru(1)))return ur;r=ie}else{if(this.eq(F)){if(t.eq(ze)||t.eq(xt))return F;if(t.eq(F))return ze;var s=this.shr(1);return o=s.div(t).shl(1),o.eq(j)?t.isNegative()?ze:xt:(i=this.sub(t.mul(o)),r=o.add(i.div(t)),r)}else if(t.eq(F))return this.unsigned?ie:j;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();r=j}for(i=this;i.gte(t);){o=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var d=Math.ceil(Math.log(o)/Math.LN2),a=d<=48?1:dt(2,d-48),u=Z(o),l=u.mul(t);l.isNegative()||l.gt(i);)o-=a,u=Z(o,this.unsigned),l=u.mul(t);u.isZero()&&(u=ze),r=r.add(u),i=i.sub(l)}return r};f.div=f.divide;f.modulo=function(t){if(V(t)||(t=H(t)),q){var n=(this.unsigned?q.rem_u:q.rem_s)(this.low,this.high,t.low,t.high);return g(n,q.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};f.mod=f.modulo;f.rem=f.modulo;f.not=function(){return g(~this.low,~this.high,this.unsigned)};f.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};f.clz=f.countLeadingZeros;f.countTrailingZeros=function(){return this.low?tr(this.low):tr(this.high)+32};f.ctz=f.countTrailingZeros;f.and=function(t){return V(t)||(t=H(t)),g(this.low&t.low,this.high&t.high,this.unsigned)};f.or=function(t){return V(t)||(t=H(t)),g(this.low|t.low,this.high|t.high,this.unsigned)};f.xor=function(t){return V(t)||(t=H(t)),g(this.low^t.low,this.high^t.high,this.unsigned)};f.shiftLeft=function(t){return V(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?g(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):g(0,this.low<<t-32,this.unsigned)};f.shl=f.shiftLeft;f.shiftRight=function(t){return V(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?g(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):g(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};f.shr=f.shiftRight;f.shiftRightUnsigned=function(t){return V(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?g(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?g(this.high,0,this.unsigned):g(this.high>>>t-32,0,this.unsigned)};f.shru=f.shiftRightUnsigned;f.shr_u=f.shiftRightUnsigned;f.rotateLeft=function(t){var n;return V(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?g(this.high,this.low,this.unsigned):t<32?(n=32-t,g(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,g(this.high<<t|this.low>>>n,this.low<<t|this.high>>>n,this.unsigned))};f.rotl=f.rotateLeft;f.rotateRight=function(t){var n;return V(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?g(this.high,this.low,this.unsigned):t<32?(n=32-t,g(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,g(this.low<<n|this.high>>>t,this.high<<n|this.low>>>t,this.unsigned))};f.rotr=f.rotateRight;f.toSigned=function(){return this.unsigned?g(this.low,this.high,!1):this};f.toUnsigned=function(){return this.unsigned?this:g(this.low,this.high,!0)};f.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};f.toBytesLE=function(){var t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};f.toBytesBE=function(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};y.fromBytes=function(t,n,o){return o?y.fromBytesLE(t,n):y.fromBytesBE(t,n)};y.fromBytesLE=function(t,n){return new y(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};y.fromBytesBE=function(t,n){return new y(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)};typeof BigInt=="function"&&(y.fromBigInt=function(t,n){var o=Number(BigInt.asIntN(32,t)),i=Number(BigInt.asIntN(32,t>>BigInt(32)));return g(o,i,n)},y.fromValue=function(t,n){return typeof t=="bigint"?y.fromBigInt(t,n):H(t,n)},f.toBigInt=function(){var t=BigInt(this.low>>>0),n=BigInt(this.unsigned?this.high>>>0:this.high);return n<<BigInt(32)|t});var Ft=y;var Je=M(P(),1);function lr(){return{seconds:0,nanos:0}}var We={$type:"google.protobuf.Timestamp",encode(e,t=Je.default.Writer.create()){return e.seconds!==0&&t.uint32(8).int64(e.seconds),e.nanos!==0&&t.uint32(16).int32(e.nanos),t},decode(e,t){let n=e instanceof Je.default.Reader?e:Je.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=lr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.seconds=Pi(n.int64());continue;case 2:if(r!==16)break;i.nanos=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{seconds:cr(e.seconds)?globalThis.Number(e.seconds):0,nanos:cr(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let t={};return e.seconds!==0&&(t.seconds=Math.round(e.seconds)),e.nanos!==0&&(t.nanos=Math.round(e.nanos)),t},create(e){return We.fromPartial(e??{})},fromPartial(e){let t=lr();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}};c.set(We.$type,We);function Pi(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}Je.default.util.Long!==Ft&&(Je.default.util.Long=Ft,Je.default.configure());function cr(e){return e!=null}var te;(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"})(te||(te={}));function Jt(e){switch(e){case 0:case"CONSENT_STATUS_UNKNOWN":return te.CONSENT_STATUS_UNKNOWN;case 1:case"REVOKED":return te.REVOKED;case 2:case"GRANTED":return te.GRANTED;case-1:case"UNRECOGNIZED":default:return te.UNRECOGNIZED}}function Wt(e){switch(e){case te.CONSENT_STATUS_UNKNOWN:return 0;case te.REVOKED:return 1;case te.GRANTED:return 2;case te.UNRECOGNIZED:default:return-1}}var z;(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"})(z||(z={}));function br(e){switch(e){case 0:case"SCOPE_UNKNOWN":return z.SCOPE_UNKNOWN;case 1:case"SUBMIT_POST":return z.SUBMIT_POST;case 2:case"SUBMIT_COMMENT":return z.SUBMIT_COMMENT;case 3:case"SUBSCRIBE_TO_SUBREDDIT":return z.SUBSCRIBE_TO_SUBREDDIT;case-1:case"UNRECOGNIZED":default:return z.UNRECOGNIZED}}function Tr(e){switch(e){case z.SCOPE_UNKNOWN:return 0;case z.SUBMIT_POST:return 1;case z.SUBMIT_COMMENT:return 2;case z.SUBSCRIBE_TO_SUBREDDIT:return 3;case z.UNRECOGNIZED:default:return-1}}function pr(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}var ge={$type:"reddit.devvit.app_permission.v1.AppPermission",encode(e,t=E.default.Writer.create()){e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.subredditId!==""&&t.uint32(18).string(e.subredditId),t.uint32(26).fork();for(let n of e.scopes)t.int32(n);return t.ldelim(),e.consentStatus!==0&&t.uint32(32).int32(e.consentStatus),e.updatedAt!==void 0&&We.encode(Fi(e.updatedAt),t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=pr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appSlug=n.string();continue;case 2:if(r!==18)break;i.subredditId=n.string();continue;case 3:if(r===24){i.scopes.push(n.int32());continue}if(r===26){let s=n.uint32()+n.pos;for(;n.pos<s;)i.scopes.push(n.int32());continue}break;case 4:if(r!==32)break;i.consentStatus=n.int32();continue;case 5:if(r!==42)break;i.updatedAt=Ir(We.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:k(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:k(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>br(t)):[],consentStatus:k(e.consentStatus)?Jt(e.consentStatus):0,updatedAt:k(e.updatedAt)?Ai(e.updatedAt):void 0}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.subredditId!==""&&(t.subredditId=e.subredditId),e.scopes?.length&&(t.scopes=e.scopes.map(n=>Tr(n))),e.consentStatus!==0&&(t.consentStatus=Wt(e.consentStatus)),e.updatedAt!==void 0&&(t.updatedAt=e.updatedAt.toISOString()),t},create(e){return ge.fromPartial(e??{})},fromPartial(e){let t=pr();return t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t.consentStatus=e.consentStatus??0,t.updatedAt=e.updatedAt??void 0,t}};c.set(ge.$type,ge);function hr(){return{appSlug:"",appName:""}}var Se={$type:"reddit.devvit.app_permission.v1.DevvitApp",encode(e,t=E.default.Writer.create()){return e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.appName!==""&&t.uint32(18).string(e.appName),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=hr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appSlug=n.string();continue;case 2:if(r!==18)break;i.appName=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:k(e.appSlug)?globalThis.String(e.appSlug):"",appName:k(e.appName)?globalThis.String(e.appName):""}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.appName!==""&&(t.appName=e.appName),t},create(e){return Se.fromPartial(e??{})},fromPartial(e){let t=hr();return t.appSlug=e.appSlug??"",t.appName=e.appName??"",t}};c.set(Se.$type,Se);function mr(){return{userId:""}}var At={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdRequest",encode(e,t=E.default.Writer.create()){return e.userId!==""&&t.uint32(10).string(e.userId),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=mr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.userId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{userId:k(e.userId)?globalThis.String(e.userId):""}},toJSON(e){let t={};return e.userId!==""&&(t.userId=e.userId),t},create(e){return At.fromPartial(e??{})},fromPartial(e){let t=mr();return t.userId=e.userId??"",t}};c.set(At.$type,At);function gr(){return{appPermissions:[],devvitApps:[]}}var Lt={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,t=E.default.Writer.create()){for(let n of e.appPermissions)ge.encode(n,t.uint32(10).fork()).ldelim();for(let n of e.devvitApps)Se.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=gr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appPermissions.push(ge.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.devvitApps.push(Se.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appPermissions:globalThis.Array.isArray(e?.appPermissions)?e.appPermissions.map(t=>ge.fromJSON(t)):[],devvitApps:globalThis.Array.isArray(e?.devvitApps)?e.devvitApps.map(t=>Se.fromJSON(t)):[]}},toJSON(e){let t={};return e.appPermissions?.length&&(t.appPermissions=e.appPermissions.map(n=>ge.toJSON(n))),e.devvitApps?.length&&(t.devvitApps=e.devvitApps.map(n=>Se.toJSON(n))),t},create(e){return Lt.fromPartial(e??{})},fromPartial(e){let t=gr();return t.appPermissions=e.appPermissions?.map(n=>ge.fromPartial(n))||[],t.devvitApps=e.devvitApps?.map(n=>Se.fromPartial(n))||[],t}};c.set(Lt.$type,Lt);function Sr(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}var Mt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionRequest",encode(e,t=E.default.Writer.create()){e.userId!==""&&t.uint32(10).string(e.userId),e.appSlug!==""&&t.uint32(18).string(e.appSlug),e.subredditId!==""&&t.uint32(26).string(e.subredditId),t.uint32(34).fork();for(let n of e.scopes)t.int32(n);return t.ldelim(),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Sr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.userId=n.string();continue;case 2:if(r!==18)break;i.appSlug=n.string();continue;case 3:if(r!==26)break;i.subredditId=n.string();continue;case 4:if(r===32){i.scopes.push(n.int32());continue}if(r===34){let s=n.uint32()+n.pos;for(;n.pos<s;)i.scopes.push(n.int32());continue}break}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{userId:k(e.userId)?globalThis.String(e.userId):"",appSlug:k(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:k(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>br(t)):[]}},toJSON(e){let t={};return e.userId!==""&&(t.userId=e.userId),e.appSlug!==""&&(t.appSlug=e.appSlug),e.subredditId!==""&&(t.subredditId=e.subredditId),e.scopes?.length&&(t.scopes=e.scopes.map(n=>Tr(n))),t},create(e){return Mt.fromPartial(e??{})},fromPartial(e){let t=Sr();return t.userId=e.userId??"",t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t}};c.set(Mt.$type,Mt);function yr(){return{error:void 0}}var Bt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode(e,t=E.default.Writer.create()){return e.error!==void 0&&U.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=yr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.error=U.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:k(e.error)?U.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=U.toJSON(e.error)),t},create(e){return Bt.fromPartial(e??{})},fromPartial(e){let t=yr();return t.error=e.error!==void 0&&e.error!==null?U.fromPartial(e.error):void 0,t}};c.set(Bt.$type,Bt);function Er(){return{appSlug:"",userId:"",subredditId:""}}var Ut={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionRequest",encode(e,t=E.default.Writer.create()){return e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.userId!==""&&t.uint32(18).string(e.userId),e.subredditId!==""&&t.uint32(26).string(e.subredditId),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Er();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appSlug=n.string();continue;case 2:if(r!==18)break;i.userId=n.string();continue;case 3:if(r!==26)break;i.subredditId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:k(e.appSlug)?globalThis.String(e.appSlug):"",userId:k(e.userId)?globalThis.String(e.userId):"",subredditId:k(e.subredditId)?globalThis.String(e.subredditId):""}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.userId!==""&&(t.userId=e.userId),e.subredditId!==""&&(t.subredditId=e.subredditId),t},create(e){return Ut.fromPartial(e??{})},fromPartial(e){let t=Er();return t.appSlug=e.appSlug??"",t.userId=e.userId??"",t.subredditId=e.subredditId??"",t}};c.set(Ut.$type,Ut);function vr(){return{error:void 0}}var Dt={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode(e,t=E.default.Writer.create()){return e.error!==void 0&&U.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=vr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.error=U.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:k(e.error)?U.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=U.toJSON(e.error)),t},create(e){return Dt.fromPartial(e??{})},fromPartial(e){let t=vr();return t.error=e.error!==void 0&&e.error!==null?U.fromPartial(e.error):void 0,t}};c.set(Dt.$type,Dt);function Nr(){return{message:""}}var U={$type:"reddit.devvit.app_permission.v1.ErrorMessage",encode(e,t=E.default.Writer.create()){return e.message!==""&&t.uint32(10).string(e.message),t},decode(e,t){let n=e instanceof E.default.Reader?e:E.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Nr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.message=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{message:k(e.message)?globalThis.String(e.message):""}},toJSON(e){let t={};return e.message!==""&&(t.message=e.message),t},create(e){return U.fromPartial(e??{})},fromPartial(e){let t=Nr();return t.message=e.message??"",t}};c.set(U.$type,U);function Fi(e){let t=Math.trunc(e.getTime()/1e3),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function Ir(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function Ai(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):Ir(We.fromJSON(e))}function k(e){return e!=null}function Or(){return{postId:void 0,appSlug:void 0,subredditId:void 0}}var Gt={$type:"devvit.ui.effects.v1alpha.CanRunAsUserEffect",encode(e,t=Ge.default.Writer.create()){return e.postId!==void 0&&t.uint32(10).string(e.postId),e.appSlug!==void 0&&t.uint32(18).string(e.appSlug),e.subredditId!==void 0&&t.uint32(26).string(e.subredditId),t},decode(e,t){let n=e instanceof Ge.default.Reader?e:Ge.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Or();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postId=n.string();continue;case 2:if(r!==18)break;i.appSlug=n.string();continue;case 3:if(r!==26)break;i.subredditId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{postId:lt(e.postId)?globalThis.String(e.postId):void 0,appSlug:lt(e.appSlug)?globalThis.String(e.appSlug):void 0,subredditId:lt(e.subredditId)?globalThis.String(e.subredditId):void 0}},toJSON(e){let t={};return e.postId!==void 0&&(t.postId=e.postId),e.appSlug!==void 0&&(t.appSlug=e.appSlug),e.subredditId!==void 0&&(t.subredditId=e.subredditId),t},create(e){return Gt.fromPartial(e??{})},fromPartial(e){let t=Or();return t.postId=e.postId??void 0,t.appSlug=e.appSlug??void 0,t.subredditId=e.subredditId??void 0,t}};c.set(Gt.$type,Gt);function _r(){return{consentStatus:0}}var oe={$type:"devvit.ui.effects.v1alpha.ConsentStatusEvent",encode(e,t=Ge.default.Writer.create()){return e.consentStatus!==0&&t.uint32(8).int32(e.consentStatus),t},decode(e,t){let n=e instanceof Ge.default.Reader?e:Ge.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=_r();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.consentStatus=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{consentStatus:lt(e.consentStatus)?Jt(e.consentStatus):0}},toJSON(e){let t={};return e.consentStatus!==0&&(t.consentStatus=Wt(e.consentStatus)),t},create(e){return oe.fromPartial(e??{})},fromPartial(e){let t=_r();return t.consentStatus=e.consentStatus??0,t}};c.set(oe.$type,oe);function lt(e){return e!=null}var qe=M(P(),1);var $e=M(P(),1);var ct=M(P(),1);function Rr(){return{}}var pt={$type:"google.protobuf.Empty",encode(e,t=ct.default.Writer.create()){return t},decode(e,t){let n=e instanceof ct.default.Reader?e:ct.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Rr();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return pt.fromPartial(e??{})},fromPartial(e){return Rr()}};c.set(pt.$type,pt);function Cr(){return{channels:[]}}var $t={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=$e.default.Writer.create()){for(let n of e.channels)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof $e.default.Reader?e:$e.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Cr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.channels.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channels:globalThis.Array.isArray(e?.channels)?e.channels.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.channels?.length&&(t.channels=e.channels),t},create(e){return $t.fromPartial(e??{})},fromPartial(e){let t=Cr();return t.channels=e.channels?.map(n=>n)||[],t}};c.set($t.$type,$t);function Vr(){return{channel:"",data:void 0}}var se={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=$e.default.Writer.create()){return e.channel!==""&&t.uint32(10).string(e.channel),e.data!==void 0&&$.encode($.wrap(e.data),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof $e.default.Reader?e:$e.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Vr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.channel=n.string();continue;case 2:if(r!==18)break;i.data=$.unwrap($.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channel:Mi(e.channel)?globalThis.String(e.channel):"",data:Li(e.data)?e.data:void 0}},toJSON(e){let t={};return e.channel!==""&&(t.channel=e.channel),e.data!==void 0&&(t.data=e.data),t},create(e){return se.fromPartial(e??{})},fromPartial(e){let t=Vr();return t.channel=e.channel??"",t.data=e.data??void 0,t}};c.set(se.$type,se);function Li(e){return typeof e=="object"&&e!==null}function Mi(e){return e!=null}var ye;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ye||(ye={}));function Bi(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return ye.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return ye.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return ye.UNRECOGNIZED}}function Ui(e){switch(e){case ye.REALTIME_SUBSCRIBED:return 0;case ye.REALTIME_UNSUBSCRIBED:return 1;case ye.UNRECOGNIZED:default:return-1}}function kr(){return{subscriptionIds:[]}}var qt={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=qe.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof qe.default.Reader?e:qe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=kr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.subscriptionIds.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{subscriptionIds:globalThis.Array.isArray(e?.subscriptionIds)?e.subscriptionIds.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.subscriptionIds?.length&&(t.subscriptionIds=e.subscriptionIds),t},create(e){return qt.fromPartial(e??{})},fromPartial(e){let t=kr();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};c.set(qt.$type,qt);function wr(){return{event:void 0,status:void 0}}var ae={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=qe.default.Writer.create()){return e.event!==void 0&&se.encode(e.event,t.uint32(10).fork()).ldelim(),e.status!==void 0&&t.uint32(16).int32(e.status),t},decode(e,t){let n=e instanceof qe.default.Reader?e:qe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=wr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.event=se.decode(n,n.uint32());continue;case 2:if(r!==16)break;i.status=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{event:xr(e.event)?se.fromJSON(e.event):void 0,status:xr(e.status)?Bi(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=se.toJSON(e.event)),e.status!==void 0&&(t.status=Ui(e.status)),t},create(e){return ae.fromPartial(e??{})},fromPartial(e){let t=wr();return t.event=e.event!==void 0&&e.event!==null?se.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};c.set(ae.$type,ae);function xr(e){return e!=null}var W=M(P(),1);var ht=M(P(),1);var S=M(P(),1);var O;(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"})(O||(O={}));function Xe(e){switch(e){case 0:case"STRING":return O.STRING;case 1:case"PARAGRAPH":return O.PARAGRAPH;case 2:case"NUMBER":return O.NUMBER;case 3:case"BOOLEAN":return O.BOOLEAN;case 4:case"LIST":return O.LIST;case 5:case"SELECTION":return O.SELECTION;case 6:case"GROUP":return O.GROUP;case 7:case"IMAGE":return O.IMAGE;case-1:case"UNRECOGNIZED":default:return O.UNRECOGNIZED}}function Ye(e){switch(e){case O.STRING:return 0;case O.PARAGRAPH:return 1;case O.NUMBER:return 2;case O.BOOLEAN:return 3;case O.LIST:return 4;case O.SELECTION:return 5;case O.GROUP:return 6;case O.IMAGE:return 7;case O.UNRECOGNIZED:default:return-1}}var D=M(P(),1);function Pr(){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 b={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,t=D.default.Writer.create()){return e.fieldType!==0&&t.uint32(8).int32(e.fieldType),e.isSecret!==void 0&&t.uint32(800).bool(e.isSecret),e.stringValue!==void 0&&t.uint32(18).string(e.stringValue),e.numberValue!==void 0&&t.uint32(25).double(e.numberValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.listValue!==void 0&&Ee.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&ve.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&Ne.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof D.default.Reader?e:D.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Pr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.fieldType=n.int32();continue;case 100:if(r!==800)break;i.isSecret=n.bool();continue;case 2:if(r!==18)break;i.stringValue=n.string();continue;case 3:if(r!==25)break;i.numberValue=n.double();continue;case 4:if(r!==32)break;i.boolValue=n.bool();continue;case 5:if(r!==42)break;i.listValue=Ee.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionValue=ve.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupValue=Ne.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldType:ue(e.fieldType)?Xe(e.fieldType):0,isSecret:ue(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:ue(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:ue(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:ue(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:ue(e.listValue)?Ee.fromJSON(e.listValue):void 0,selectionValue:ue(e.selectionValue)?ve.fromJSON(e.selectionValue):void 0,groupValue:ue(e.groupValue)?Ne.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=Ye(e.fieldType)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),e.stringValue!==void 0&&(t.stringValue=e.stringValue),e.numberValue!==void 0&&(t.numberValue=e.numberValue),e.boolValue!==void 0&&(t.boolValue=e.boolValue),e.listValue!==void 0&&(t.listValue=Ee.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=ve.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=Ne.toJSON(e.groupValue)),t},create(e){return b.fromPartial(e??{})},fromPartial(e){let t=Pr();return t.fieldType=e.fieldType??0,t.isSecret=e.isSecret??void 0,t.stringValue=e.stringValue??void 0,t.numberValue=e.numberValue??void 0,t.boolValue=e.boolValue??void 0,t.listValue=e.listValue!==void 0&&e.listValue!==null?Ee.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?ve.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?Ne.fromPartial(e.groupValue):void 0,t}};c.set(b.$type,b);function Fr(){return{itemType:0,items:[]}}var Ee={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=D.default.Writer.create()){e.itemType!==0&&t.uint32(8).int32(e.itemType);for(let n of e.items)b.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof D.default.Reader?e:D.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Fr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.items.push(b.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:ue(e.itemType)?Xe(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(t=>b.fromJSON(t)):[]}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Ye(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>b.toJSON(n))),t},create(e){return Ee.fromPartial(e??{})},fromPartial(e){let t=Fr();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>b.fromPartial(n))||[],t}};c.set(Ee.$type,Ee);function Ar(){return{values:[]}}var ve={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=D.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof D.default.Reader?e:D.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ar();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?e.values.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values),t},create(e){return ve.fromPartial(e??{})},fromPartial(e){let t=Ar();return t.values=e.values?.map(n=>n)||[],t}};c.set(ve.$type,ve);function Lr(){return{}}var Ne={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=D.default.Writer.create()){return t},decode(e,t){let n=e instanceof D.default.Reader?e:D.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Lr();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Ne.fromPartial(e??{})},fromPartial(e){return Lr()}};c.set(Ne.$type,Ne);function ue(e){return e!=null}function Mr(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var A={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,t=S.default.Writer.create()){return e.fieldId!==""&&t.uint32(10).string(e.fieldId),e.fieldType!==0&&t.uint32(16).int32(e.fieldType),e.label!==""&&t.uint32(26).string(e.label),e.helpText!==void 0&&t.uint32(34).string(e.helpText),e.defaultValue!==void 0&&b.encode(e.defaultValue,t.uint32(42).fork()).ldelim(),e.required!==void 0&&t.uint32(48).bool(e.required),e.disabled!==void 0&&t.uint32(56).bool(e.disabled),e.fieldConfig!==void 0&&J.encode(e.fieldConfig,t.uint32(66).fork()).ldelim(),e.isSecret!==void 0&&t.uint32(72).bool(e.isSecret),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Mr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fieldId=n.string();continue;case 2:if(r!==16)break;i.fieldType=n.int32();continue;case 3:if(r!==26)break;i.label=n.string();continue;case 4:if(r!==34)break;i.helpText=n.string();continue;case 5:if(r!==42)break;i.defaultValue=b.decode(n,n.uint32());continue;case 6:if(r!==48)break;i.required=n.bool();continue;case 7:if(r!==56)break;i.disabled=n.bool();continue;case 8:if(r!==66)break;i.fieldConfig=J.decode(n,n.uint32());continue;case 9:if(r!==72)break;i.isSecret=n.bool();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldId:h(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:h(e.fieldType)?Xe(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)?b.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)?J.fromJSON(e.fieldConfig):void 0,isSecret:h(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let t={};return e.fieldId!==""&&(t.fieldId=e.fieldId),e.fieldType!==0&&(t.fieldType=Ye(e.fieldType)),e.label!==""&&(t.label=e.label),e.helpText!==void 0&&(t.helpText=e.helpText),e.defaultValue!==void 0&&(t.defaultValue=b.toJSON(e.defaultValue)),e.required!==void 0&&(t.required=e.required),e.disabled!==void 0&&(t.disabled=e.disabled),e.fieldConfig!==void 0&&(t.fieldConfig=J.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return A.fromPartial(e??{})},fromPartial(e){let t=Mr();return t.fieldId=e.fieldId??"",t.fieldType=e.fieldType??0,t.label=e.label??"",t.helpText=e.helpText??void 0,t.defaultValue=e.defaultValue!==void 0&&e.defaultValue!==null?b.fromPartial(e.defaultValue):void 0,t.required=e.required??void 0,t.disabled=e.disabled??void 0,t.fieldConfig=e.fieldConfig!==void 0&&e.fieldConfig!==null?J.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};c.set(A.$type,A);function Br(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var J={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=S.default.Writer.create()){return e.stringConfig!==void 0&&be.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&Te.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&Ie.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&Oe.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&_e.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&Re.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&Ve.encode(e.groupConfig,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Br();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.stringConfig=be.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.paragraphConfig=Te.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.numberConfig=Ie.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.booleanConfig=Oe.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.listConfig=_e.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionConfig=Re.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupConfig=Ve.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{stringConfig:h(e.stringConfig)?be.fromJSON(e.stringConfig):void 0,paragraphConfig:h(e.paragraphConfig)?Te.fromJSON(e.paragraphConfig):void 0,numberConfig:h(e.numberConfig)?Ie.fromJSON(e.numberConfig):void 0,booleanConfig:h(e.booleanConfig)?Oe.fromJSON(e.booleanConfig):void 0,listConfig:h(e.listConfig)?_e.fromJSON(e.listConfig):void 0,selectionConfig:h(e.selectionConfig)?Re.fromJSON(e.selectionConfig):void 0,groupConfig:h(e.groupConfig)?Ve.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=be.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=Te.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=Ie.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=Oe.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=_e.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=Re.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=Ve.toJSON(e.groupConfig)),t},create(e){return J.fromPartial(e??{})},fromPartial(e){let t=Br();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?be.fromPartial(e.stringConfig):void 0,t.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?Te.fromPartial(e.paragraphConfig):void 0,t.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?Ie.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?Oe.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?_e.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?Re.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?Ve.fromPartial(e.groupConfig):void 0,t}};c.set(J.$type,J);function Ur(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var be={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.String",encode(e,t=S.default.Writer.create()){return e.minLength!==void 0&&t.uint32(8).int32(e.minLength),e.maxLength!==void 0&&t.uint32(16).int32(e.maxLength),e.placeholder!==void 0&&t.uint32(26).string(e.placeholder),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ur();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.minLength=n.int32();continue;case 2:if(r!==16)break;i.maxLength=n.int32();continue;case 3:if(r!==26)break;i.placeholder=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},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 t={};return e.minLength!==void 0&&(t.minLength=Math.round(e.minLength)),e.maxLength!==void 0&&(t.maxLength=Math.round(e.maxLength)),e.placeholder!==void 0&&(t.placeholder=e.placeholder),t},create(e){return be.fromPartial(e??{})},fromPartial(e){let t=Ur();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(be.$type,be);function Dr(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var Te={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Paragraph",encode(e,t=S.default.Writer.create()){return e.maxCharacters!==void 0&&t.uint32(8).int32(e.maxCharacters),e.lineHeight!==void 0&&t.uint32(16).int32(e.lineHeight),e.placeholder!==void 0&&t.uint32(26).string(e.placeholder),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Dr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.maxCharacters=n.int32();continue;case 2:if(r!==16)break;i.lineHeight=n.int32();continue;case 3:if(r!==26)break;i.placeholder=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},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 t={};return e.maxCharacters!==void 0&&(t.maxCharacters=Math.round(e.maxCharacters)),e.lineHeight!==void 0&&(t.lineHeight=Math.round(e.lineHeight)),e.placeholder!==void 0&&(t.placeholder=e.placeholder),t},create(e){return Te.fromPartial(e??{})},fromPartial(e){let t=Dr();return t.maxCharacters=e.maxCharacters??void 0,t.lineHeight=e.lineHeight??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(Te.$type,Te);function Jr(){return{step:void 0,min:void 0,max:void 0}}var Ie={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Number",encode(e,t=S.default.Writer.create()){return e.step!==void 0&&t.uint32(9).double(e.step),e.min!==void 0&&t.uint32(17).double(e.min),e.max!==void 0&&t.uint32(25).double(e.max),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Jr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==9)break;i.step=n.double();continue;case 2:if(r!==17)break;i.min=n.double();continue;case 3:if(r!==25)break;i.max=n.double();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},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 t={};return e.step!==void 0&&(t.step=e.step),e.min!==void 0&&(t.min=e.min),e.max!==void 0&&(t.max=e.max),t},create(e){return Ie.fromPartial(e??{})},fromPartial(e){let t=Jr();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};c.set(Ie.$type,Ie);function Wr(){return{}}var Oe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Boolean",encode(e,t=S.default.Writer.create()){return t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Wr();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Oe.fromPartial(e??{})},fromPartial(e){return Wr()}};c.set(Oe.$type,Oe);function Gr(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var _e={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.List",encode(e,t=S.default.Writer.create()){return e.itemType!==0&&t.uint32(8).int32(e.itemType),e.itemConfig!==void 0&&J.encode(e.itemConfig,t.uint32(18).fork()).ldelim(),e.minEntries!==void 0&&t.uint32(24).int32(e.minEntries),e.maxEntries!==void 0&&t.uint32(32).int32(e.maxEntries),e.entryLabel!==void 0&&t.uint32(42).string(e.entryLabel),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Gr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.itemConfig=J.decode(n,n.uint32());continue;case 3:if(r!==24)break;i.minEntries=n.int32();continue;case 4:if(r!==32)break;i.maxEntries=n.int32();continue;case 5:if(r!==42)break;i.entryLabel=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:h(e.itemType)?Xe(e.itemType):0,itemConfig:h(e.itemConfig)?J.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 t={};return e.itemType!==0&&(t.itemType=Ye(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=J.toJSON(e.itemConfig)),e.minEntries!==void 0&&(t.minEntries=Math.round(e.minEntries)),e.maxEntries!==void 0&&(t.maxEntries=Math.round(e.maxEntries)),e.entryLabel!==void 0&&(t.entryLabel=e.entryLabel),t},create(e){return _e.fromPartial(e??{})},fromPartial(e){let t=Gr();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?J.fromPartial(e.itemConfig):void 0,t.minEntries=e.minEntries??void 0,t.maxEntries=e.maxEntries??void 0,t.entryLabel=e.entryLabel??void 0,t}};c.set(_e.$type,_e);function $r(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var Re={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=S.default.Writer.create()){for(let n of e.choices)Ce.encode(n,t.uint32(10).fork()).ldelim();return e.multiSelect!==void 0&&t.uint32(16).bool(e.multiSelect),e.minSelections!==void 0&&t.uint32(24).int32(e.minSelections),e.maxSelections!==void 0&&t.uint32(32).int32(e.maxSelections),e.renderAsList!==void 0&&t.uint32(40).bool(e.renderAsList),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=$r();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.choices.push(Ce.decode(n,n.uint32()));continue;case 2:if(r!==16)break;i.multiSelect=n.bool();continue;case 3:if(r!==24)break;i.minSelections=n.int32();continue;case 4:if(r!==32)break;i.maxSelections=n.int32();continue;case 5:if(r!==40)break;i.renderAsList=n.bool();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{choices:globalThis.Array.isArray(e?.choices)?e.choices.map(t=>Ce.fromJSON(t)):[],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 t={};return e.choices?.length&&(t.choices=e.choices.map(n=>Ce.toJSON(n))),e.multiSelect!==void 0&&(t.multiSelect=e.multiSelect),e.minSelections!==void 0&&(t.minSelections=Math.round(e.minSelections)),e.maxSelections!==void 0&&(t.maxSelections=Math.round(e.maxSelections)),e.renderAsList!==void 0&&(t.renderAsList=e.renderAsList),t},create(e){return Re.fromPartial(e??{})},fromPartial(e){let t=$r();return t.choices=e.choices?.map(n=>Ce.fromPartial(n))||[],t.multiSelect=e.multiSelect??void 0,t.minSelections=e.minSelections??void 0,t.maxSelections=e.maxSelections??void 0,t.renderAsList=e.renderAsList??void 0,t}};c.set(Re.$type,Re);function qr(){return{label:"",value:""}}var Ce={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection.Item",encode(e,t=S.default.Writer.create()){return e.label!==""&&t.uint32(10).string(e.label),e.value!==""&&t.uint32(18).string(e.value),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=qr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.label=n.string();continue;case 2:if(r!==18)break;i.value=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{label:h(e.label)?globalThis.String(e.label):"",value:h(e.value)?globalThis.String(e.value):""}},toJSON(e){let t={};return e.label!==""&&(t.label=e.label),e.value!==""&&(t.value=e.value),t},create(e){return Ce.fromPartial(e??{})},fromPartial(e){let t=qr();return t.label=e.label??"",t.value=e.value??"",t}};c.set(Ce.$type,Ce);function Zr(){return{fields:[]}}var Ve={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,t=S.default.Writer.create()){for(let n of e.fields)A.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Zr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(A.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>A.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>A.toJSON(n))),t},create(e){return Ve.fromPartial(e??{})},fromPartial(e){let t=Zr();return t.fields=e.fields?.map(n=>A.fromPartial(n))||[],t}};c.set(Ve.$type,Ve);function h(e){return e!=null}function Hr(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var fe={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=ht.default.Writer.create()){for(let n of e.fields)A.encode(n,t.uint32(10).fork()).ldelim();return e.title!==void 0&&t.uint32(18).string(e.title),e.shortDescription!==void 0&&t.uint32(26).string(e.shortDescription),e.acceptLabel!==void 0&&t.uint32(34).string(e.acceptLabel),e.cancelLabel!==void 0&&t.uint32(42).string(e.cancelLabel),e.id!==void 0&&t.uint32(50).string(e.id),t},decode(e,t){let n=e instanceof ht.default.Reader?e:ht.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Hr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(A.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.title=n.string();continue;case 3:if(r!==26)break;i.shortDescription=n.string();continue;case 4:if(r!==34)break;i.acceptLabel=n.string();continue;case 5:if(r!==42)break;i.cancelLabel=n.string();continue;case 6:if(r!==50)break;i.id=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>A.fromJSON(t)):[],title:nt(e.title)?globalThis.String(e.title):void 0,shortDescription:nt(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:nt(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:nt(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:nt(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>A.toJSON(n))),e.title!==void 0&&(t.title=e.title),e.shortDescription!==void 0&&(t.shortDescription=e.shortDescription),e.acceptLabel!==void 0&&(t.acceptLabel=e.acceptLabel),e.cancelLabel!==void 0&&(t.cancelLabel=e.cancelLabel),e.id!==void 0&&(t.id=e.id),t},create(e){return fe.fromPartial(e??{})},fromPartial(e){let t=Hr();return t.fields=e.fields?.map(n=>A.fromPartial(n))||[],t.title=e.title??void 0,t.shortDescription=e.shortDescription??void 0,t.acceptLabel=e.acceptLabel??void 0,t.cancelLabel=e.cancelLabel??void 0,t.id=e.id??void 0,t}};c.set(fe.$type,fe);function nt(e){return e!=null}function zr(){return{form:void 0}}var Zt={$type:"devvit.ui.effects.v1alpha.ShowFormEffect",encode(e,t=W.default.Writer.create()){return e.form!==void 0&&fe.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=zr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.form=fe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{form:it(e.form)?fe.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=fe.toJSON(e.form)),t},create(e){return Zt.fromPartial(e??{})},fromPartial(e){let t=zr();return t.form=e.form!==void 0&&e.form!==null?fe.fromPartial(e.form):void 0,t}};c.set(Zt.$type,Zt);function Kr(){return{results:{},formId:void 0}}var de={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent",encode(e,t=W.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{rt.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),e.formId!==void 0&&t.uint32(18).string(e.formId),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Kr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let s=rt.decode(n,n.uint32());s.value!==void 0&&(i.results[s.key]=s.value);continue;case 2:if(r!==18)break;i.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{results:Di(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=b.fromJSON(o),t),{}):{},formId:it(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let t={};if(e.results){let n=Object.entries(e.results);n.length>0&&(t.results={},n.forEach(([o,i])=>{t.results[o]=b.toJSON(i)}))}return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return de.fromPartial(e??{})},fromPartial(e){let t=Kr();return t.results=Object.entries(e.results??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=b.fromPartial(i)),n),{}),t.formId=e.formId??void 0,t}};c.set(de.$type,de);function Xr(){return{key:"",value:void 0}}var rt={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=W.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&b.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Xr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=b.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:it(e.key)?globalThis.String(e.key):"",value:it(e.value)?b.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=b.toJSON(e.value)),t},create(e){return rt.fromPartial(e??{})},fromPartial(e){let t=Xr();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?b.fromPartial(e.value):void 0,t}};c.set(rt.$type,rt);function Yr(){return{formId:void 0}}var le={$type:"devvit.ui.effects.v1alpha.FormCanceledEvent",encode(e,t=W.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Yr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{formId:it(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let t={};return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return le.fromPartial(e??{})},fromPartial(e){let t=Yr();return t.formId=e.formId??void 0,t}};c.set(le.$type,le);function Di(e){return typeof e=="object"&&e!==null}function it(e){return e!=null}var mt=M(P(),1);var ne;(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"})(ne||(ne={}));function zt(e){switch(e){case 0:case"UNSPECIFIED":return ne.UNSPECIFIED;case 1:case"INLINE_MODE":return ne.INLINE_MODE;case 2:case"IMMERSIVE_MODE":return ne.IMMERSIVE_MODE;case-1:case"UNRECOGNIZED":default:return ne.UNRECOGNIZED}}function Kt(e){switch(e){case ne.UNSPECIFIED:return 0;case ne.INLINE_MODE:return 1;case ne.IMMERSIVE_MODE:return 2;case ne.UNRECOGNIZED:default:return-1}}function Qr(){return{immersiveMode:0,entryUrl:void 0}}var Ht={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,t=mt.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),e.entryUrl!==void 0&&t.uint32(18).string(e.entryUrl),t},decode(e,t){let n=e instanceof mt.default.Reader?e:mt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Qr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.immersiveMode=n.int32();continue;case 2:if(r!==18)break;i.entryUrl=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{immersiveMode:jr(e.immersiveMode)?zt(e.immersiveMode):0,entryUrl:jr(e.entryUrl)?globalThis.String(e.entryUrl):void 0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=Kt(e.immersiveMode)),e.entryUrl!==void 0&&(t.entryUrl=e.entryUrl),t},create(e){return Ht.fromPartial(e??{})},fromPartial(e){let t=Qr();return t.immersiveMode=e.immersiveMode??0,t.entryUrl=e.entryUrl??void 0,t}};c.set(Ht.$type,Ht);function jr(e){return e!=null}var Fe;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Fe||(Fe={}));function Ji(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return Fe.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return Fe.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return Fe.UNRECOGNIZED}}function Wi(e){switch(e){case Fe.WEBVIEW_VISIBLE:return 0;case Fe.WEBVIEW_HIDDEN:return 1;case Fe.UNRECOGNIZED:default:return-1}}function ei(){return{message:void 0,jsonString:""}}var ke={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=T.default.Writer.create()){return e.message!==void 0&&C.encode(C.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ei();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.message=C.unwrap(C.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.jsonString=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{message:w(e?.message)?e.message:void 0,jsonString:w(e.jsonString)?globalThis.String(e.jsonString):""}},toJSON(e){let t={};return e.message!==void 0&&(t.message=e.message),e.jsonString!==""&&(t.jsonString=e.jsonString),t},create(e){return ke.fromPartial(e??{})},fromPartial(e){let t=ei();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};c.set(ke.$type,ke);function ti(){return{visibility:0}}var we={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=T.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ti();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.visibility=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{visibility:w(e.visibility)?Ji(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=Wi(e.visibility)),t},create(e){return we.fromPartial(e??{})},fromPartial(e){let t=ti();return t.visibility=e.visibility??0,t}};c.set(we.$type,we);function ni(){return{postMessage:void 0,fullScreen:void 0}}var Xt={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=T.default.Writer.create()){return e.postMessage!==void 0&&ke.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&we.encode(e.fullScreen,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ni();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postMessage=ke.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.fullScreen=we.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{postMessage:w(e.postMessage)?ke.fromJSON(e.postMessage):void 0,fullScreen:w(e.fullScreen)?we.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=ke.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=we.toJSON(e.fullScreen)),t},create(e){return Xt.fromPartial(e??{})},fromPartial(e){let t=ni();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?ke.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?we.fromPartial(e.fullScreen):void 0,t}};c.set(Xt.$type,Xt);function ri(){return{immersiveMode:0}}var xe={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode(e,t=T.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ri();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.immersiveMode=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{immersiveMode:w(e.immersiveMode)?zt(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=Kt(e.immersiveMode)),t},create(e){return xe.fromPartial(e??{})},fromPartial(e){let t=ri();return t.immersiveMode=e.immersiveMode??0,t}};c.set(xe.$type,xe);function ii(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,consentStatus:void 0}}var re={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=T.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&le.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&de.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&ae.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&xe.encode(e.immersiveModeEvent,t.uint32(42).fork()).ldelim(),e.consentStatus!==void 0&&oe.encode(e.consentStatus,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ii();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.id=n.string();continue;case 2:if(r!==18)break;i.formCanceled=le.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.formSubmitted=de.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.realtimeEvent=ae.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.immersiveModeEvent=xe.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.consentStatus=oe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{id:w(e.id)?globalThis.String(e.id):"",formCanceled:w(e.formCanceled)?le.fromJSON(e.formCanceled):void 0,formSubmitted:w(e.formSubmitted)?de.fromJSON(e.formSubmitted):void 0,realtimeEvent:w(e.realtimeEvent)?ae.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:w(e.immersiveModeEvent)?xe.fromJSON(e.immersiveModeEvent):void 0,consentStatus:w(e.consentStatus)?oe.fromJSON(e.consentStatus):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=le.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=de.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=ae.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(t.immersiveModeEvent=xe.toJSON(e.immersiveModeEvent)),e.consentStatus!==void 0&&(t.consentStatus=oe.toJSON(e.consentStatus)),t},create(e){return re.fromPartial(e??{})},fromPartial(e){let t=ii();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?le.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?de.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?ae.fromPartial(e.realtimeEvent):void 0,t.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?xe.fromPartial(e.immersiveModeEvent):void 0,t.consentStatus=e.consentStatus!==void 0&&e.consentStatus!==null?oe.fromPartial(e.consentStatus):void 0,t}};c.set(re.$type,re);function oi(){return{data:void 0}}var Yt={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent",encode(e,t=T.default.Writer.create()){return e.data!==void 0&&Pe.encode(e.data,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=oi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.data=Pe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{data:w(e.data)?Pe.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.data!==void 0&&(t.data=Pe.toJSON(e.data)),t},create(e){return Yt.fromPartial(e??{})},fromPartial(e){let t=oi();return t.data=e.data!==void 0&&e.data!==null?Pe.fromPartial(e.data):void 0,t}};c.set(Yt.$type,Yt);function si(){return{type:"",data:void 0}}var Pe={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent.MessageData",encode(e,t=T.default.Writer.create()){return e.type!==""&&t.uint32(10).string(e.type),e.data!==void 0&&re.encode(e.data,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=si();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.type=n.string();continue;case 2:if(r!==18)break;i.data=re.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{type:w(e.type)?globalThis.String(e.type):"",data:w(e.data)?re.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.type!==""&&(t.type=e.type),e.data!==void 0&&(t.data=re.toJSON(e.data)),t},create(e){return Pe.fromPartial(e??{})},fromPartial(e){let t=si();return t.type=e.type??"",t.data=e.data!==void 0&&e.data!==null?re.fromPartial(e.data):void 0,t}};c.set(Pe.$type,Pe);function w(e){return e!=null}var Gi=[3,11],K=e=>new Promise(t=>{let n={scope:0,type:"devvit-internal"};if(e.realtimeSubscriptions?n.realtimeEffect=e.realtimeSubscriptions:e.immersiveMode?n.immersiveMode=e.immersiveMode:e.share?n.share=e.share:n.effect=e,e.showToast?n.showToast=e.showToast:e.navigateToUrl&&(n.navigateToUrl=e.navigateToUrl),Gi.includes(e.type)){let o=self.crypto.randomUUID();n.id=o;let i=r=>{if(r.data?.type==="devvit-message"&&r.data?.data?.id===o){let s=re.fromJSON(r.data.data);t(s),window.removeEventListener("message",i)}};window.addEventListener("message",i),window.parent.postMessage(n,"*")}else window.parent.postMessage(n,"*"),t(void 0)});function Ss(e){let t=typeof e=="string"?e:e.url;if(!URL.canParse(t))throw new TypeError(`Invalid URL: ${t}`);let n=new URL(t).toString();K({navigateToUrl:{url:n},type:5})}var Ae;(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"})(Ae||(Ae={}));var ai;(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"})(ai||(ai={}));var bs=async()=>{let e=devvit.appPermissionState;if(!e)return!0;if(e.requestedScopes.length===0)return!1;switch(e.consentStatus){case Ae.REVOKED:return!1;case Ae.GRANTED:if(e.requestedScopes.every(n=>e.grantedScopes.includes(n)))return!0;break;case Ae.CONSENT_STATUS_UNKNOWN:case Ae.UNRECOGNIZED:break;default:{e.consentStatus;break}}return(await K({canRunAsUser:{postId:devvit.context.postId,appSlug:devvit.context.appName,subredditId:devvit.context.subredditId},type:11}))?.consentStatus?.consentStatus===Ae.GRANTED};var ui="$devvit_icon.png";async function Vs(e){if(e.data&&e.data.length>1024)throw Error(`data must be <= ${1024} characters but was ${e.data.length} characters`);let t=`${new URL(ui,location.origin)}`,n;try{n=await fetch(t,{method:"HEAD"})}catch{}await K({type:9,share:{appIconUri:n?.ok?t:void 0,userData:e.data,text:e.text,title:e.title}})}function ks(){return devvit.share?.userData}function Qt(e,t=new Set){for(let n of e){if(n.type==="group"){Qt(n.fields,t);continue}let o=n.name;if(t.has(o))throw new Error(`Duplicate field name: ${o}`);t.add(o)}$i(e)}function $i(e){for(let t of e)if(t.type==="string"&&t.isSecret&&t.scope!=="app")throw`Invalid setting: only app settings can be secrets. Add "scope: SettingScope.App" to field "${t.name}"`}function qi(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 di(e){return Object.keys(e).reduce((t,n)=>{let o=qi(e[n]);return o!==void 0&&(t[n]=o),t},{})}function jt(e){return e.map(t=>{switch(t.type){case"string":return Zi(t);case"image":return Hi(t);case"paragraph":return zi(t);case"number":return Ki(t);case"select":return Xi(t);case"boolean":return Yi(t);case"group":return Qi(t);default:throw new Error("Unknown field type.")}})}function Zi(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 Hi(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function zi(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 Ki(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 Xi(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 Yi(e){return{defaultValue:{fieldType:3,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:3,helpText:e.helpText,label:e.label}}function Qi(e){return{fieldId:"",fieldType:6,fieldConfig:{groupConfig:{fields:jt(e.fields)}},label:e.label,helpText:e.helpText}}var li=1,ji=()=>(li++,`form.${li}`),Us=async e=>{let t={fields:[],id:ji(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};Qt(e.fields),t.fields=jt(e.fields);let n=await K({showForm:{form:t},type:3});return!n||!n.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:di(n.formSubmitted.results)}};function Ws(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?1:0}:t={text:e},K({showToast:{toast:t},type:4})}var ce;(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"})(ce||(ce={}));var en=new Set,Hs=()=>hi(devvit.webViewMode);function zs(e,t){return ci(ce.IMMERSIVE_MODE,e,t)}function Ks(e){return ci(ce.INLINE_MODE,e,void 0)}function Xs(e){en.add(e)}function Ys(e){en.delete(e)}async function ci(e,t,n){if(!t.isTrusted||t.type!=="click")throw console.error("Expanded mode effect ignored due to untrusted event"),new Error("Untrusted event");if(n!=null&&!devvit.entrypoints[n])throw Error(`no entrypoint named "${n}"; all entrypoints must appear in \`devvit.json\` \`post.entrypoints\``);await K({type:9,immersiveMode:{entryUrl:devvit.entrypoints[n??""],immersiveMode:e}})}function pi(){addEventListener("message",e=>{let{type:t,data:n}=e.data;if(t!=="devvit-message"||!n?.immersiveModeEvent)return;devvit.webViewMode=n.immersiveModeEvent.immersiveMode;let o=hi(n.immersiveModeEvent.immersiveMode);en.forEach(i=>i(o))})}function hi(e){switch(e){case ce.IMMERSIVE_MODE:return"expanded";case ce.INLINE_MODE:case ce.UNRECOGNIZED:case ce.UNSPECIFIED:case void 0:return"inline";default:throw Error(`${e} not a WebViewImmersiveMode`)}}pi();export{Xs as addWebViewModeListener,bs as canRunAsUser,to as context,Ks as exitExpandedMode,ks as getShareData,Hs as getWebViewMode,Ss as navigateTo,pi as registerListener,Ys as removeWebViewModeListener,zs as requestExpandedMode,Us as showForm,Vs as showShareSheet,Ws as showToast};
2
2
  /*! Bundled license information:
3
3
 
4
4
  long/index.js: