@devvit/client 0.12.2-next-2025-10-21-18-16-15-f63fab740.0 → 0.12.2-next-2025-10-21-21-55-49-945ca7b05.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 Ei=Object.create;var rn=Object.defineProperty;var yi=Object.getOwnPropertyDescriptor;var vi=Object.getOwnPropertyNames;var Ni=Object.getPrototypeOf,bi=Object.prototype.hasOwnProperty;var O=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ti=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of vi(t))!bi.call(e,i)&&i!==n&&rn(e,i,{get:()=>t[i],enumerable:!(o=yi(t,i))||o.enumerable});return e};var M=(e,t,n)=>(n=e!=null?Ei(Ni(e)):{},Ti(t||!e||!e.__esModule?rn(n,"default",{value:e,enumerable:!0}):n,e));var sn=O((uo,on)=>{"use strict";on.exports=_i;function _i(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 dn=O(fn=>{"use strict";var ut=fn;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 He=new Array(64),un=new Array(123);for(X=0;X<64;)un[He[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++]=He[u>>2],a=(u&3)<<4,d=1;break;case 1:r[s++]=He[a|u>>4],a=(u&15)<<2,d=2;break;case 2:r[s++]=He[a|u>>6],r[s++]=He[u&63],d=0;break}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,r)),s=0)}return d&&(r[s++]=He[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 an="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=un[a])===void 0)throw Error(an);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(an);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 cn=O((lo,ln)=>{"use strict";ln.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 yn=O((co,En)=>{"use strict";En.exports=pn(pn);function pn(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,hn),e.writeFloatBE=t.bind(null,mn);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,gn),e.readFloatBE=n.bind(null,Sn)})(),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,hn,0,4),e.writeDoubleBE=t.bind(null,mn,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,gn,0,4),e.readDoubleBE=n.bind(null,Sn,4,0)})(),e}function hn(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 mn(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 gn(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Sn(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var vn=O((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 bn=O(Nn=>{"use strict";var Et=Nn;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 _n=O((ho,Tn)=>{"use strict";Tn.exports=Ii;function Ii(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 On=O((mo,In)=>{"use strict";In.exports=R;var je=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 Oi=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(je.isString(t))if(je.Long)t=je.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 je.Long?new je.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===Oi?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=O(yt=>{"use strict";var p=yt;p.asPromise=sn();p.base64=dn();p.EventEmitter=cn();p.float=yn();p.inquire=vn();p.utf8=bn();p.pool=_n();p.LongBits=On();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||yt;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 Cn(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=Cn;p.ProtocolError=Cn("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 Ot=O((So,Fn)=>{"use strict";Fn.exports=m;var G=he(),vt,dt=G.LongBits,Vn=G.base64,kn=G.utf8;function et(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function bt(){}function Ri(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 et(bt,0,0),this.tail=this.head,this.states=null}var wn=function(){return G.Buffer?function(){return(m.create=function(){return new vt})()}:function(){return new m}};m.create=wn();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 et(t,n,o),this.len+=n,this};function Tt(e,t,n){t[n]=e&255}function Ci(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function _t(e,t){this.len=e,this.next=void 0,this.val=t}_t.prototype=Object.create(et.prototype);_t.prototype.fn=Ci;m.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new _t((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(It,10,dt.fromNumber(t)):this.uint32(t)};m.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function It(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(It,n.length(),n)};m.prototype.int64=m.prototype.uint64;m.prototype.sint64=function(t){var n=dt.from(t).zzEncode();return this._push(It,n.length(),n)};m.prototype.bool=function(t){return this._push(Tt,1,t?1:0)};function Nt(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(Nt,4,t>>>0)};m.prototype.sfixed32=m.prototype.fixed32;m.prototype.fixed64=function(t){var n=dt.from(t);return this._push(Nt,4,n.lo)._push(Nt,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 Vi=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(Tt,1,0);if(G.isString(t)){var o=m.alloc(n=Vn.length(t));Vn.decode(t,o,0),t=o}return this.uint32(n)._push(Vi,n,t)};m.prototype.string=function(t){var n=kn.length(t);return n?this.uint32(n)._push(kn.write,n,t):this._push(Tt,1,0)};m.prototype.fork=function(){return this.states=new Ri(this),this.head=this.tail=new et(bt,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 et(bt,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){vt=e,m.create=wn(),vt._configure()}});var Pn=O((Eo,An)=>{"use strict";An.exports=te;var xn=Ot();(te.prototype=Object.create(xn.prototype)).constructor=te;var me=he();function te(){xn.call(this)}te._configure=function(){te.alloc=me._Buffer_allocUnsafe,te.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++]}};te.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(te.writeBytesBuffer,n,t),this};function ki(e,t,n){e.length<40?me.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}te.prototype.string=function(t){var n=me.Buffer.byteLength(t);return this.uint32(n),n&&this._push(ki,n,t),this};te._configure()});var Vt=O((yo,Dn)=>{"use strict";Dn.exports=_;var Y=he(),Ct,Bn=Y.LongBits,wi=Y.utf8;function Q(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function _(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 _(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new _(t);throw Error("illegal buffer")},Un=function(){return Y.Buffer?function(n){return(_.create=function(i){return Y.Buffer.isBuffer(i)?new Ct(i):Ln(i)})(n)}:Ln};_.create=Un();_.prototype._slice=Y.Array.prototype.subarray||Y.Array.prototype.slice;_.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}})();_.prototype.int32=function(){return this.uint32()|0};_.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function Rt(){var e=new Bn(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")}_.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}_.prototype.fixed32=function(){if(this.pos+4>this.len)throw Q(this,4);return lt(this.buf,this.pos+=4)};_.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Q(this,4);return lt(this.buf,this.pos+=4)|0};function Mn(){if(this.pos+8>this.len)throw Q(this,8);return new Bn(lt(this.buf,this.pos+=4),lt(this.buf,this.pos+=4))}_.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};_.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};_.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)};_.prototype.string=function(){var t=this.bytes();return wi.read(t,0,t.length)};_.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};_.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};_._configure=function(e){Ct=e,_.create=Un(),Ct._configure();var t=Y.Long?"toLong":"toNumber";Y.merge(_.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 Mn.call(this)[t](!0)},sfixed64:function(){return Mn.call(this)[t](!1)}})}});var $n=O((vo,Gn)=>{"use strict";Gn.exports=Me;var Wn=Vt();(Me.prototype=Object.create(Wn.prototype)).constructor=Me;var Jn=he();function Me(e){Wn.call(this,e)}Me._configure=function(){Jn.Buffer&&(Me.prototype._slice=Jn.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 Zn=O((No,qn)=>{"use strict";qn.exports=tt;var kt=he();(tt.prototype=Object.create(kt.EventEmitter.prototype)).constructor=tt;function tt(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}tt.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}};tt.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var zn=O(Hn=>{"use strict";var Fi=Hn;Fi.Service=Zn()});var Xn=O((To,Kn)=>{"use strict";Kn.exports={}});var jn=O(Qn=>{"use strict";var F=Qn;F.build="minimal";F.Writer=Ot();F.BufferWriter=Pn();F.Reader=Vt();F.BufferReader=$n();F.util=he();F.rpc=zn();F.roots=Xn();F.configure=Yn;function Yn(){F.util._configure(),F.Writer._configure(F.BufferWriter),F.Reader._configure(F.BufferReader)}Yn()});var x=O((Io,er)=>{"use strict";er.exports=jn()});var io=globalThis.devvit?.context;var Ze;(function(e){e[e.EFFECT_REALTIME_SUB=0]="EFFECT_REALTIME_SUB",e[e.EFFECT_RERENDER_UI=1]="EFFECT_RERENDER_UI",e[e.EFFECT_RELOAD_PART=2]="EFFECT_RELOAD_PART",e[e.EFFECT_SHOW_FORM=3]="EFFECT_SHOW_FORM",e[e.EFFECT_SHOW_TOAST=4]="EFFECT_SHOW_TOAST",e[e.EFFECT_NAVIGATE_TO_URL=5]="EFFECT_NAVIGATE_TO_URL",e[e.EFFECT_SET_INTERVALS=7]="EFFECT_SET_INTERVALS",e[e.EFFECT_CREATE_ORDER=8]="EFFECT_CREATE_ORDER",e[e.EFFECT_WEB_VIEW=9]="EFFECT_WEB_VIEW",e[e.EFFECT_CAN_RUN_AS_USER=11]="EFFECT_CAN_RUN_AS_USER",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ze||(Ze={}));var at;(function(e){e[e.CLIENT=0]="CLIENT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(at||(at={}));var T=M(x(),1);var B=M(x(),1);var c=new Map;var Ue;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ue||(Ue={}));function xi(e){switch(e){case 0:case"NULL_VALUE":return Ue.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return Ue.UNRECOGNIZED}}function Ai(e){switch(e){case Ue.NULL_VALUE:return 0;case Ue.UNRECOGNIZED:default:return-1}}function wt(){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&&nt.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=wt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let s=nt.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:nr(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=wt();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),{}),t},wrap(e){let t=wt();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 tr(){return{key:"",value:void 0}}var nt={$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=tr();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: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 nt.fromPartial(e??{})},fromPartial(e){let t=tr();return t.key=e.key??"",t.value=e.value??void 0,t}};c.set(nt.$type,nt);function Ft(){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=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=$.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: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:nr(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=Ai(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=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=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 xt(){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=xt();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=xt();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=xt();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 nr(e){return typeof e=="object"&&e!==null}function ze(e){return e!=null}var J=M(x(),1);var ct=M(x(),1);var S=M(x(),1);var I;(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"})(I||(I={}));function Ke(e){switch(e){case 0:case"STRING":return I.STRING;case 1:case"PARAGRAPH":return I.PARAGRAPH;case 2:case"NUMBER":return I.NUMBER;case 3:case"BOOLEAN":return I.BOOLEAN;case 4:case"LIST":return I.LIST;case 5:case"SELECTION":return I.SELECTION;case 6:case"GROUP":return I.GROUP;case 7:case"IMAGE":return I.IMAGE;case-1:case"UNRECOGNIZED":default:return I.UNRECOGNIZED}}function Xe(e){switch(e){case I.STRING:return 0;case I.PARAGRAPH:return 1;case I.NUMBER:return 2;case I.BOOLEAN:return 3;case I.LIST:return 4;case I.SELECTION:return 5;case I.GROUP:return 6;case I.IMAGE:return 7;case I.UNRECOGNIZED:default:return-1}}var U=M(x(),1);function rr(){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=U.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&&ge.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&Se.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&Ee.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof U.default.Reader?e:U.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!==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=ge.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionValue=Se.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupValue=Ee.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldType:oe(e.fieldType)?Ke(e.fieldType):0,isSecret:oe(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:oe(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:oe(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:oe(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:oe(e.listValue)?ge.fromJSON(e.listValue):void 0,selectionValue:oe(e.selectionValue)?Se.fromJSON(e.selectionValue):void 0,groupValue:oe(e.groupValue)?Ee.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=Xe(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=ge.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=Se.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=Ee.toJSON(e.groupValue)),t},create(e){return b.fromPartial(e??{})},fromPartial(e){let t=rr();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?ge.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?Se.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?Ee.fromPartial(e.groupValue):void 0,t}};c.set(b.$type,b);function ir(){return{itemType:0,items:[]}}var ge={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=U.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 U.default.Reader?e:U.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!==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:oe(e.itemType)?Ke(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=Xe(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>b.toJSON(n))),t},create(e){return ge.fromPartial(e??{})},fromPartial(e){let t=ir();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>b.fromPartial(n))||[],t}};c.set(ge.$type,ge);function or(){return{values:[]}}var Se={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=U.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof U.default.Reader?e:U.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.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 Se.fromPartial(e??{})},fromPartial(e){let t=or();return t.values=e.values?.map(n=>n)||[],t}};c.set(Se.$type,Se);function sr(){return{}}var Ee={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=U.default.Writer.create()){return t},decode(e,t){let n=e instanceof U.default.Reader?e:U.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=sr();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 Ee.fromPartial(e??{})},fromPartial(e){return sr()}};c.set(Ee.$type,Ee);function oe(e){return e!=null}function ar(){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&&D.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=ar();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=D.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)?Ke(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)?D.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=Xe(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=D.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return A.fromPartial(e??{})},fromPartial(e){let t=ar();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?D.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};c.set(A.$type,A);function ur(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var D={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=S.default.Writer.create()){return e.stringConfig!==void 0&&ye.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&ve.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&Ne.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&be.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&Te.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&_e.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&Oe.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=ur();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.stringConfig=ye.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.paragraphConfig=ve.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.numberConfig=Ne.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.booleanConfig=be.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.listConfig=Te.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionConfig=_e.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupConfig=Oe.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)?ye.fromJSON(e.stringConfig):void 0,paragraphConfig:h(e.paragraphConfig)?ve.fromJSON(e.paragraphConfig):void 0,numberConfig:h(e.numberConfig)?Ne.fromJSON(e.numberConfig):void 0,booleanConfig:h(e.booleanConfig)?be.fromJSON(e.booleanConfig):void 0,listConfig:h(e.listConfig)?Te.fromJSON(e.listConfig):void 0,selectionConfig:h(e.selectionConfig)?_e.fromJSON(e.selectionConfig):void 0,groupConfig:h(e.groupConfig)?Oe.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=ye.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=ve.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=Ne.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=be.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=Te.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=_e.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=Oe.toJSON(e.groupConfig)),t},create(e){return D.fromPartial(e??{})},fromPartial(e){let t=ur();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?ye.fromPartial(e.stringConfig):void 0,t.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?ve.fromPartial(e.paragraphConfig):void 0,t.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?Ne.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?be.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?Te.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?_e.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?Oe.fromPartial(e.groupConfig):void 0,t}};c.set(D.$type,D);function fr(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var ye={$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=fr();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 ye.fromPartial(e??{})},fromPartial(e){let t=fr();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(ye.$type,ye);function dr(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var ve={$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 ve.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(ve.$type,ve);function lr(){return{step:void 0,min:void 0,max:void 0}}var Ne={$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=lr();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 Ne.fromPartial(e??{})},fromPartial(e){let t=lr();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};c.set(Ne.$type,Ne);function cr(){return{}}var be={$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=cr();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 cr()}};c.set(be.$type,be);function pr(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var Te={$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&&D.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=pr();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=D.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)?Ke(e.itemType):0,itemConfig:h(e.itemConfig)?D.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=Xe(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=D.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 Te.fromPartial(e??{})},fromPartial(e){let t=pr();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?D.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(Te.$type,Te);function hr(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var _e={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=S.default.Writer.create()){for(let n of e.choices)Ie.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=hr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.choices.push(Ie.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=>Ie.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=>Ie.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 _e.fromPartial(e??{})},fromPartial(e){let t=hr();return t.choices=e.choices?.map(n=>Ie.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(_e.$type,_e);function mr(){return{label:"",value:""}}var Ie={$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=mr();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 Ie.fromPartial(e??{})},fromPartial(e){let t=mr();return t.label=e.label??"",t.value=e.value??"",t}};c.set(Ie.$type,Ie);function gr(){return{fields:[]}}var Oe={$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=gr();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 Oe.fromPartial(e??{})},fromPartial(e){let t=gr();return t.fields=e.fields?.map(n=>A.fromPartial(n))||[],t}};c.set(Oe.$type,Oe);function h(e){return e!=null}function Sr(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var se={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=ct.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 ct.default.Reader?e:ct.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.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:rt(e.title)?globalThis.String(e.title):void 0,shortDescription:rt(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:rt(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:rt(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:rt(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 se.fromPartial(e??{})},fromPartial(e){let t=Sr();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(se.$type,se);function rt(e){return e!=null}function Er(){return{form:void 0}}var At={$type:"devvit.ui.effect_types.v1alpha.ShowFormEffect",encode(e,t=J.default.Writer.create()){return e.form!==void 0&&se.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof J.default.Reader?e:J.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.form=se.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{form:ot(e.form)?se.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=se.toJSON(e.form)),t},create(e){return At.fromPartial(e??{})},fromPartial(e){let t=Er();return t.form=e.form!==void 0&&e.form!==null?se.fromPartial(e.form):void 0,t}};c.set(At.$type,At);function yr(){return{results:{},formId:void 0}}var ae={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent",encode(e,t=J.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{it.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 J.default.Reader?e:J.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;let s=it.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:Pi(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=b.fromJSON(o),t),{}):{},formId:ot(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 ae.fromPartial(e??{})},fromPartial(e){let t=yr();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(ae.$type,ae);function vr(){return{key:"",value:void 0}}var it={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=J.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 J.default.Reader?e:J.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.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:ot(e.key)?globalThis.String(e.key):"",value:ot(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 it.fromPartial(e??{})},fromPartial(e){let t=vr();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?b.fromPartial(e.value):void 0,t}};c.set(it.$type,it);function Nr(){return{formId:void 0}}var ue={$type:"devvit.ui.effect_types.v1alpha.FormCanceledEvent",encode(e,t=J.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof J.default.Reader?e:J.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.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{formId:ot(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 ue.fromPartial(e??{})},fromPartial(e){let t=Nr();return t.formId=e.formId??void 0,t}};c.set(ue.$type,ue);function Pi(e){return typeof e=="object"&&e!==null}function ot(e){return e!=null}var Ge=M(x(),1);var y=M(x(),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 E(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}E.prototype.__isLong__;Object.defineProperty(E.prototype,"__isLong__",{value:!0});function V(e){return(e&&e.__isLong__)===!0}function br(e){var t=Math.clz32(e&-e);return e?31-t:t}E.isLong=V;var Tr={},_r={};function De(e,t){var n,o,i;return t?(e>>>=0,(i=0<=e&&e<256)&&(o=_r[e],o)?o:(n=g(e,0,!0),i&&(_r[e]=n),n)):(e|=0,(i=-128<=e&&e<128)&&(o=Tr[e],o)?o:(n=g(e,e<0?-1:0,!1),i&&(Tr[e]=n),n))}E.fromInt=De;function Z(e,t){if(isNaN(e))return t?fe:j;if(t){if(e<0)return fe;if(e>=Cr)return wr}else{if(e<=-Or)return P;if(e+1>=Or)return kr}return e<0?Z(-e,t).neg():g(e%Qe|0,e/Qe|0,t)}E.fromNumber=Z;function g(e,t,n){return new E(e,t,n)}E.fromBits=g;var pt=Math.pow;function Lt(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?fe: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 Lt(e.substring(1),t,n).neg();for(var i=Z(pt(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(pt(n,d));r=r.mul(u).add(Z(a))}else r=r.mul(i),r=r.add(Z(a))}return r.unsigned=t,r}E.fromString=Lt;function H(e,t){return typeof e=="number"?Z(e,t):typeof e=="string"?Lt(e,t):g(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}E.fromValue=H;var Ir=65536,Li=1<<24,Qe=Ir*Ir,Cr=Qe*Qe,Or=Cr/2,Rr=De(Li),j=De(0);E.ZERO=j;var fe=De(0,!0);E.UZERO=fe;var Ye=De(1);E.ONE=Ye;var Vr=De(1,!0);E.UONE=Vr;var Pt=De(-1);E.NEG_ONE=Pt;var kr=g(-1,2147483647,!1);E.MAX_VALUE=kr;var wr=g(-1,-1,!0);E.MAX_UNSIGNED_VALUE=wr;var P=g(0,-2147483648,!1);E.MIN_VALUE=P;var f=E.prototype;f.toInt=function(){return this.unsigned?this.low>>>0:this.low};f.toNumber=function(){return this.unsigned?(this.high>>>0)*Qe+(this.low>>>0):this.high*Qe+(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(P)){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(pt(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(P)?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(P)?P:this.not().add(Ye)};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?fe:j;if(this.eq(P))return t.isOdd()?P:j;if(t.eq(P))return this.isOdd()?P: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(Rr)&&t.lt(Rr))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,st=0;return st+=s*l,L+=st>>>16,st&=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|st,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?fe:j;var o,i,r;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return fe;if(t.gt(this.shru(1)))return Vr;r=fe}else{if(this.eq(P)){if(t.eq(Ye)||t.eq(Pt))return P;if(t.eq(P))return Ye;var s=this.shr(1);return o=s.div(t).shl(1),o.eq(j)?t.isNegative()?Ye:Pt:(i=this.sub(t.mul(o)),r=o.add(i.div(t)),r)}else if(t.eq(P))return this.unsigned?fe: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:pt(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=Ye),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?br(this.low):br(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]};E.fromBytes=function(t,n,o){return o?E.fromBytesLE(t,n):E.fromBytesBE(t,n)};E.fromBytesLE=function(t,n){return new E(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};E.fromBytesBE=function(t,n){return new E(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"&&(E.fromBigInt=function(t,n){var o=Number(BigInt.asIntN(32,t)),i=Number(BigInt.asIntN(32,t>>BigInt(32)));return g(o,i,n)},E.fromValue=function(t,n){return typeof t=="bigint"?E.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 Mt=E;var Je=M(x(),1);function Fr(){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=Fr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.seconds=Mi(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:xr(e.seconds)?globalThis.Number(e.seconds):0,nanos:xr(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=Fr();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}};c.set(We.$type,We);function Mi(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!==Mt&&(Je.default.util.Long=Mt,Je.default.configure());function xr(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 $t(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 qt(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 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 Gr(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 $r(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 Ar(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}var Re={$type:"reddit.devvit.app_permission.v1.AppPermission",encode(e,t=y.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(Bi(e.updatedAt),t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof y.default.Reader?e:y.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.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=qr(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=>Gr(t)):[],consentStatus:k(e.consentStatus)?$t(e.consentStatus):0,updatedAt:k(e.updatedAt)?Ui(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=>$r(n))),e.consentStatus!==0&&(t.consentStatus=qt(e.consentStatus)),e.updatedAt!==void 0&&(t.updatedAt=e.updatedAt.toISOString()),t},create(e){return Re.fromPartial(e??{})},fromPartial(e){let t=Ar();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(Re.$type,Re);function Pr(){return{appSlug:"",appName:""}}var Ce={$type:"reddit.devvit.app_permission.v1.DevvitApp",encode(e,t=y.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 y.default.Reader?e:y.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.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 Ce.fromPartial(e??{})},fromPartial(e){let t=Pr();return t.appSlug=e.appSlug??"",t.appName=e.appName??"",t}};c.set(Ce.$type,Ce);function Lr(){return{userId:""}}var Bt={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdRequest",encode(e,t=y.default.Writer.create()){return e.userId!==""&&t.uint32(10).string(e.userId),t},decode(e,t){let n=e instanceof y.default.Reader?e:y.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!==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 Bt.fromPartial(e??{})},fromPartial(e){let t=Lr();return t.userId=e.userId??"",t}};c.set(Bt.$type,Bt);function Mr(){return{appPermissions:[],devvitApps:[]}}var Ut={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,t=y.default.Writer.create()){for(let n of e.appPermissions)Re.encode(n,t.uint32(10).fork()).ldelim();for(let n of e.devvitApps)Ce.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof y.default.Reader?e:y.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.appPermissions.push(Re.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.devvitApps.push(Ce.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=>Re.fromJSON(t)):[],devvitApps:globalThis.Array.isArray(e?.devvitApps)?e.devvitApps.map(t=>Ce.fromJSON(t)):[]}},toJSON(e){let t={};return e.appPermissions?.length&&(t.appPermissions=e.appPermissions.map(n=>Re.toJSON(n))),e.devvitApps?.length&&(t.devvitApps=e.devvitApps.map(n=>Ce.toJSON(n))),t},create(e){return Ut.fromPartial(e??{})},fromPartial(e){let t=Mr();return t.appPermissions=e.appPermissions?.map(n=>Re.fromPartial(n))||[],t.devvitApps=e.devvitApps?.map(n=>Ce.fromPartial(n))||[],t}};c.set(Ut.$type,Ut);function Br(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}var Dt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionRequest",encode(e,t=y.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 y.default.Reader?e:y.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.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=>Gr(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=>$r(n))),t},create(e){return Dt.fromPartial(e??{})},fromPartial(e){let t=Br();return t.userId=e.userId??"",t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t}};c.set(Dt.$type,Dt);function Ur(){return{error:void 0}}var Jt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode(e,t=y.default.Writer.create()){return e.error!==void 0&&W.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof y.default.Reader?e:y.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.error=W.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)?W.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=W.toJSON(e.error)),t},create(e){return Jt.fromPartial(e??{})},fromPartial(e){let t=Ur();return t.error=e.error!==void 0&&e.error!==null?W.fromPartial(e.error):void 0,t}};c.set(Jt.$type,Jt);function Dr(){return{appSlug:"",userId:"",subredditId:""}}var Wt={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionRequest",encode(e,t=y.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 y.default.Reader?e:y.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.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 Wt.fromPartial(e??{})},fromPartial(e){let t=Dr();return t.appSlug=e.appSlug??"",t.userId=e.userId??"",t.subredditId=e.subredditId??"",t}};c.set(Wt.$type,Wt);function Jr(){return{error:void 0}}var Gt={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode(e,t=y.default.Writer.create()){return e.error!==void 0&&W.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof y.default.Reader?e:y.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.error=W.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)?W.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=W.toJSON(e.error)),t},create(e){return Gt.fromPartial(e??{})},fromPartial(e){let t=Jr();return t.error=e.error!==void 0&&e.error!==null?W.fromPartial(e.error):void 0,t}};c.set(Gt.$type,Gt);function Wr(){return{message:""}}var W={$type:"reddit.devvit.app_permission.v1.ErrorMessage",encode(e,t=y.default.Writer.create()){return e.message!==""&&t.uint32(10).string(e.message),t},decode(e,t){let n=e instanceof y.default.Reader?e:y.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.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 W.fromPartial(e??{})},fromPartial(e){let t=Wr();return t.message=e.message??"",t}};c.set(W.$type,W);function Bi(e){let t=Math.trunc(e.getTime()/1e3),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function qr(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function Ui(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):qr(We.fromJSON(e))}function k(e){return e!=null}function Zr(){return{postId:void 0,appSlug:void 0,subredditId:void 0}}var Zt={$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=Zr();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:ht(e.postId)?globalThis.String(e.postId):void 0,appSlug:ht(e.appSlug)?globalThis.String(e.appSlug):void 0,subredditId:ht(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=Zr();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 Hr(){return{consentStatus:0}}var de={$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=Hr();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:ht(e.consentStatus)?$t(e.consentStatus):0}},toJSON(e){let t={};return e.consentStatus!==0&&(t.consentStatus=qt(e.consentStatus)),t},create(e){return de.fromPartial(e??{})},fromPartial(e){let t=Hr();return t.consentStatus=e.consentStatus??0,t}};c.set(de.$type,de);function ht(e){return e!=null}var qe=M(x(),1);var $e=M(x(),1);var mt=M(x(),1);function zr(){return{}}var gt={$type:"google.protobuf.Empty",encode(e,t=mt.default.Writer.create()){return 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=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 gt.fromPartial(e??{})},fromPartial(e){return zr()}};c.set(gt.$type,gt);function Kr(){return{channels:[]}}var Ht={$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=Kr();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 Ht.fromPartial(e??{})},fromPartial(e){let t=Kr();return t.channels=e.channels?.map(n=>n)||[],t}};c.set(Ht.$type,Ht);function Xr(){return{channel:"",data:void 0}}var le={$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=Xr();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:Ji(e.channel)?globalThis.String(e.channel):"",data:Di(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 le.fromPartial(e??{})},fromPartial(e){let t=Xr();return t.channel=e.channel??"",t.data=e.data??void 0,t}};c.set(le.$type,le);function Di(e){return typeof e=="object"&&e!==null}function Ji(e){return e!=null}var Ve;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ve||(Ve={}));function Wi(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return Ve.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return Ve.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return Ve.UNRECOGNIZED}}function Gi(e){switch(e){case Ve.REALTIME_SUBSCRIBED:return 0;case Ve.REALTIME_UNSUBSCRIBED:return 1;case Ve.UNRECOGNIZED:default:return-1}}function Yr(){return{subscriptionIds:[]}}var zt={$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=Yr();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 zt.fromPartial(e??{})},fromPartial(e){let t=Yr();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};c.set(zt.$type,zt);function Qr(){return{event:void 0,status:void 0}}var ce={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=qe.default.Writer.create()){return e.event!==void 0&&le.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=Qr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.event=le.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:jr(e.event)?le.fromJSON(e.event):void 0,status:jr(e.status)?Wi(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=le.toJSON(e.event)),e.status!==void 0&&(t.status=Gi(e.status)),t},create(e){return ce.fromPartial(e??{})},fromPartial(e){let t=Qr();return t.event=e.event!==void 0&&e.event!==null?le.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};c.set(ce.$type,ce);function jr(e){return e!=null}var St=M(x(),1);var re;(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"})(re||(re={}));function Xt(e){switch(e){case 0:case"UNSPECIFIED":return re.UNSPECIFIED;case 1:case"INLINE_MODE":return re.INLINE_MODE;case 2:case"IMMERSIVE_MODE":return re.IMMERSIVE_MODE;case-1:case"UNRECOGNIZED":default:return re.UNRECOGNIZED}}function Yt(e){switch(e){case re.UNSPECIFIED:return 0;case re.INLINE_MODE:return 1;case re.IMMERSIVE_MODE:return 2;case re.UNRECOGNIZED:default:return-1}}function ei(){return{immersiveMode:0,entryUrl:void 0}}var Kt={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,t=St.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 St.default.Reader?e:St.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!==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:ti(e.immersiveMode)?Xt(e.immersiveMode):0,entryUrl:ti(e.entryUrl)?globalThis.String(e.entryUrl):void 0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=Yt(e.immersiveMode)),e.entryUrl!==void 0&&(t.entryUrl=e.entryUrl),t},create(e){return Kt.fromPartial(e??{})},fromPartial(e){let t=ei();return t.immersiveMode=e.immersiveMode??0,t.entryUrl=e.entryUrl??void 0,t}};c.set(Kt.$type,Kt);function ti(e){return e!=null}var Ae;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ae||(Ae={}));function $i(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return Ae.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return Ae.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return Ae.UNRECOGNIZED}}function qi(e){switch(e){case Ae.WEBVIEW_VISIBLE:return 0;case Ae.WEBVIEW_HIDDEN:return 1;case Ae.UNRECOGNIZED:default:return-1}}function ni(){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=ni();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=ni();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};c.set(ke.$type,ke);function ri(){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=ri();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)?$i(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=qi(e.visibility)),t},create(e){return we.fromPartial(e??{})},fromPartial(e){let t=ri();return t.visibility=e.visibility??0,t}};c.set(we.$type,we);function ii(){return{postMessage:void 0,fullScreen:void 0}}var Qt={$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=ii();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 Qt.fromPartial(e??{})},fromPartial(e){let t=ii();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(Qt.$type,Qt);function oi(){return{immersiveMode:0}}var Fe={$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=oi();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)?Xt(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=Yt(e.immersiveMode)),t},create(e){return Fe.fromPartial(e??{})},fromPartial(e){let t=oi();return t.immersiveMode=e.immersiveMode??0,t}};c.set(Fe.$type,Fe);function si(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,consentStatus:void 0}}var ie={$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&&ue.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&ae.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&ce.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&Fe.encode(e.immersiveModeEvent,t.uint32(42).fork()).ldelim(),e.consentStatus!==void 0&&de.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=si();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=ue.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.formSubmitted=ae.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.realtimeEvent=ce.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.immersiveModeEvent=Fe.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.consentStatus=de.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)?ue.fromJSON(e.formCanceled):void 0,formSubmitted:w(e.formSubmitted)?ae.fromJSON(e.formSubmitted):void 0,realtimeEvent:w(e.realtimeEvent)?ce.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:w(e.immersiveModeEvent)?Fe.fromJSON(e.immersiveModeEvent):void 0,consentStatus:w(e.consentStatus)?de.fromJSON(e.consentStatus):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=ue.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=ae.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=ce.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(t.immersiveModeEvent=Fe.toJSON(e.immersiveModeEvent)),e.consentStatus!==void 0&&(t.consentStatus=de.toJSON(e.consentStatus)),t},create(e){return ie.fromPartial(e??{})},fromPartial(e){let t=si();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?ue.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?ae.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?ce.fromPartial(e.realtimeEvent):void 0,t.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?Fe.fromPartial(e.immersiveModeEvent):void 0,t.consentStatus=e.consentStatus!==void 0&&e.consentStatus!==null?de.fromPartial(e.consentStatus):void 0,t}};c.set(ie.$type,ie);function ai(){return{data:void 0}}var jt={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent",encode(e,t=T.default.Writer.create()){return e.data!==void 0&&xe.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=ai();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.data=xe.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)?xe.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.data!==void 0&&(t.data=xe.toJSON(e.data)),t},create(e){return jt.fromPartial(e??{})},fromPartial(e){let t=ai();return t.data=e.data!==void 0&&e.data!==null?xe.fromPartial(e.data):void 0,t}};c.set(jt.$type,jt);function ui(){return{type:"",data:void 0}}var xe={$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&&ie.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=ui();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=ie.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)?ie.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.type!==""&&(t.type=e.type),e.data!==void 0&&(t.data=ie.toJSON(e.data)),t},create(e){return xe.fromPartial(e??{})},fromPartial(e){let t=ui();return t.type=e.type??"",t.data=e.data!==void 0&&e.data!==null?ie.fromPartial(e.data):void 0,t}};c.set(xe.$type,xe);function w(e){return e!=null}var Zi=[Ze.EFFECT_SHOW_FORM,Ze.EFFECT_CAN_RUN_AS_USER],K=e=>new Promise(t=>{let n={scope:at.CLIENT,type:"devvit-internal"};if(e.realtimeSubscriptions?n.realtimeEffect=e.realtimeSubscriptions:e.immersiveMode?n.immersiveMode=e.immersiveMode:e.share?n.share=e.share:e.showToast?n.showToast=e.showToast:e.navigateToUrl?n.navigateToUrl=e.navigateToUrl:e.showForm&&(n.showForm=e.showForm),(e.showToast||e.navigateToUrl||e.showForm||e.type===Ze.EFFECT_CAN_RUN_AS_USER)&&(n.effect=e),Zi.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=ie.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 _s(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 Pe;(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"})(Pe||(Pe={}));var fi;(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"})(fi||(fi={}));var Vs=async()=>{let e=devvit.appPermissionState;if(!e)return!0;if(e.requestedScopes.length===0)return!1;switch(e.consentStatus){case Pe.REVOKED:return!1;case Pe.GRANTED:if(e.requestedScopes.every(n=>e.grantedScopes.includes(n)))return!0;break;case Pe.CONSENT_STATUS_UNKNOWN:case Pe.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===Pe.GRANTED};var di="$devvit_icon.png";async function Ls(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(di,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 Ms(){return devvit.share?.userData}function en(e,t=new Set){for(let n of e){if(n.type==="group"){en(n.fields,t);continue}let o=n.name;if(t.has(o))throw new Error(`Duplicate field name: ${o}`);t.add(o)}Hi(e)}function Hi(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 zi(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 ci(e){return Object.keys(e).reduce((t,n)=>{let o=zi(e[n]);return o!==void 0&&(t[n]=o),t},{})}function tn(e){return e.map(t=>{switch(t.type){case"string":return Ki(t);case"image":return Xi(t);case"paragraph":return Yi(t);case"number":return Qi(t);case"select":return ji(t);case"boolean":return eo(t);case"group":return to(t);default:throw new Error("Unknown field type.")}})}function Ki(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 Xi(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function Yi(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 Qi(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 ji(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 eo(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:tn(e.fields)}},label:e.label,helpText:e.helpText}}var pi=1,no=()=>(pi++,`form.${pi}`),Zs=async e=>{let t={fields:[],id:no(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};en(e.fields),t.fields=tn(e.fields);let n=await K({showForm:{form:t},type:3});return!n||!n.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:ci(n.formSubmitted.results)}};function Ks(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 ee;(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"})(ee||(ee={}));var hi="token";var nn=new Set,na=()=>Si(devvit.webViewMode);function ra(e,t){if(devvit.webViewMode===ee.IMMERSIVE_MODE)throw Error("web view is already expanded");return mi(ee.IMMERSIVE_MODE,e,t)}function ia(e){if(devvit.webViewMode===ee.INLINE_MODE)throw Error("web view is already inlined");return mi(ee.INLINE_MODE,e,void 0)}function oa(e){nn.add(e)}function sa(e){nn.delete(e)}async function mi(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\``);let o;if(n){let r=new URL(devvit.entrypoints[n]);r.searchParams.set(hi,devvit.token),o=`${r}`}await K({type:9,immersiveMode:{entryUrl:o,immersiveMode:e}})}function gi(){addEventListener("message",e=>{let{type:t,data:n}=e.data;if(t!=="devvit-message"||!n?.immersiveModeEvent)return;devvit.webViewMode=n.immersiveModeEvent.immersiveMode;let o=Si(n.immersiveModeEvent.immersiveMode);nn.forEach(i=>i(o))})}function Si(e){switch(e){case ee.IMMERSIVE_MODE:return"expanded";case ee.INLINE_MODE:case ee.UNRECOGNIZED:case ee.UNSPECIFIED:case void 0:return"inline";default:throw Error(`${e} not a WebViewImmersiveMode`)}}gi();export{oa as addWebViewModeListener,Vs as canRunAsUser,io as context,ia as exitExpandedMode,Ms as getShareData,na as getWebViewMode,_s as navigateTo,gi as registerListener,sa as removeWebViewModeListener,ra as requestExpandedMode,Zs as showForm,Ls as showShareSheet,Ks as showToast};
1
+ var Ri=Object.create;var fn=Object.defineProperty;var Ci=Object.getOwnPropertyDescriptor;var ki=Object.getOwnPropertyNames;var Vi=Object.getPrototypeOf,wi=Object.prototype.hasOwnProperty;var O=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Fi=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ki(t))!wi.call(e,i)&&i!==n&&fn(e,i,{get:()=>t[i],enumerable:!(o=Ci(t,i))||o.enumerable});return e};var x=(e,t,n)=>(n=e!=null?Ri(Vi(e)):{},Fi(t||!e||!e.__esModule?fn(n,"default",{value:e,enumerable:!0}):n,e));var cn=O((No,ln)=>{"use strict";ln.exports=xi;function xi(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(f,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];f.apply(null,N)}};try{e.apply(t||null,n)}catch(u){r&&(r=!1,a(u))}})}});var gn=O(mn=>{"use strict";var ht=mn;ht.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 Qe=new Array(64),hn=new Array(123);for(X=0;X<64;)hn[Qe[X]=X<26?X+65:X<52?X+71:X<62?X-4:X-59|43]=X++;var X;ht.encode=function(t,n,o){for(var i=null,r=[],s=0,f=0,a;n<o;){var u=t[n++];switch(f){case 0:r[s++]=Qe[u>>2],a=(u&3)<<4,f=1;break;case 1:r[s++]=Qe[a|u>>4],a=(u&15)<<2,f=2;break;case 2:r[s++]=Qe[a|u>>6],r[s++]=Qe[u&63],f=0;break}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,r)),s=0)}return f&&(r[s++]=Qe[a],r[s++]=61,f===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 pn="invalid encoding";ht.decode=function(t,n,o){for(var i=o,r=0,s,f=0;f<t.length;){var a=t.charCodeAt(f++);if(a===61&&r>1)break;if((a=hn[a])===void 0)throw Error(pn);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(pn);return o-i};ht.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var En=O((bo,Sn)=>{"use strict";Sn.exports=mt;function mt(){this._listeners={}}mt.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};mt.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};mt.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 In=O((_o,_n)=>{"use strict";_n.exports=yn(yn);function yn(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 f(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:f,e.readFloatBE=o?f:s})():(function(){function t(o,i,r,s){var f=i<0?1:0;if(f&&(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((f<<31|2139095040)>>>0,r,s);else if(i<11754943508222875e-54)o((f<<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((f<<31|a+127<<23|u)>>>0,r,s)}}e.writeFloatLE=t.bind(null,vn),e.writeFloatBE=t.bind(null,Nn);function n(o,i,r){var s=o(i,r),f=(s>>31)*2+1,a=s>>>23&255,u=s&8388607;return a===255?u?NaN:f*(1/0):a===0?f*1401298464324817e-60*u:f*Math.pow(2,a-150)*(u+8388608)}e.readFloatLE=n.bind(null,Tn),e.readFloatBE=n.bind(null,bn)})(),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 f(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:f,e.readDoubleBE=o?f:s})():(function(){function t(o,i,r,s,f,a){var u=s<0?1:0;if(u&&(s=-s),s===0)o(0,f,a+i),o(1/s>0?0:2147483648,f,a+r);else if(isNaN(s))o(0,f,a+i),o(2146959360,f,a+r);else if(s>17976931348623157e292)o(0,f,a+i),o((u<<31|2146435072)>>>0,f,a+r);else{var l;if(s<22250738585072014e-324)l=s/5e-324,o(l>>>0,f,a+i),o((u<<31|l/4294967296)>>>0,f,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,f,a+i),o((u<<31|N+1023<<20|l*1048576&1048575)>>>0,f,a+r)}}}e.writeDoubleLE=t.bind(null,vn,0,4),e.writeDoubleBE=t.bind(null,Nn,4,0);function n(o,i,r,s,f){var a=o(s,f+i),u=o(s,f+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,Tn,0,4),e.readDoubleBE=n.bind(null,bn,4,0)})(),e}function vn(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 Nn(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 Tn(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function bn(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var On=O((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 Cn=O(Rn=>{"use strict";var _t=Rn;_t.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};_t.read=function(t,n,o){var i=o-n;if(i<1)return"";for(var r=null,s=[],f=0,a;n<o;)a=t[n++],a<128?s[f++]=a:a>191&&a<224?s[f++]=(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[f++]=55296+(a>>10),s[f++]=56320+(a&1023)):s[f++]=(a&15)<<12|(t[n++]&63)<<6|t[n++]&63,f>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,s)),f=0);return r?(f&&r.push(String.fromCharCode.apply(String,s.slice(0,f))),r.join("")):String.fromCharCode.apply(String,s.slice(0,f))};_t.write=function(t,n,o){for(var i=o,r,s,f=0;f<t.length;++f)r=t.charCodeAt(f),r<128?n[o++]=r:r<2048?(n[o++]=r>>6|192,n[o++]=r&63|128):(r&64512)===55296&&((s=t.charCodeAt(f+1))&64512)===56320?(r=65536+((r&1023)<<10)+(s&1023),++f,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 Vn=O((Oo,kn)=>{"use strict";kn.exports=Ai;function Ai(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 Fn=O((Ro,wn)=>{"use strict";wn.exports=R;var it=Se();function R(e,t){this.lo=e>>>0,this.hi=t>>>0}var Je=R.zero=new R(0,0);Je.toNumber=function(){return 0};Je.zzEncode=Je.zzDecode=function(){return this};Je.length=function(){return 1};var Pi=R.zeroHash="\0\0\0\0\0\0\0\0";R.fromNumber=function(t){if(t===0)return Je;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(it.isString(t))if(it.Long)t=it.Long.fromString(t);else return R.fromNumber(parseInt(t,10));return t.low||t.high?new R(t.low>>>0,t.high>>>0):Je};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 it.Long?new it.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var ge=String.prototype.charCodeAt;R.fromHash=function(t){return t===Pi?Je:new R((ge.call(t,0)|ge.call(t,1)<<8|ge.call(t,2)<<16|ge.call(t,3)<<24)>>>0,(ge.call(t,4)|ge.call(t,5)<<8|ge.call(t,6)<<16|ge.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 Se=O(It=>{"use strict";var p=It;p.asPromise=cn();p.base64=gn();p.EventEmitter=En();p.float=In();p.inquire=On();p.utf8=Cn();p.pool=Vn();p.LongBits=Fn();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||It;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 xn(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=xn;p.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function An(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&&xn(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=An;p.ProtocolError=An("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 Ft=O((ko,Un)=>{"use strict";Un.exports=m;var G=Se(),Ot,gt=G.LongBits,Pn=G.base64,Ln=G.utf8;function ot(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function Ct(){}function Li(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 ot(Ct,0,0),this.tail=this.head,this.states=null}var Mn=function(){return G.Buffer?function(){return(m.create=function(){return new Ot})()}:function(){return new m}};m.create=Mn();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 ot(t,n,o),this.len+=n,this};function kt(e,t,n){t[n]=e&255}function Mi(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function Vt(e,t){this.len=e,this.next=void 0,this.val=t}Vt.prototype=Object.create(ot.prototype);Vt.prototype.fn=Mi;m.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Vt((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(wt,10,gt.fromNumber(t)):this.uint32(t)};m.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function wt(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=gt.from(t);return this._push(wt,n.length(),n)};m.prototype.int64=m.prototype.uint64;m.prototype.sint64=function(t){var n=gt.from(t).zzEncode();return this._push(wt,n.length(),n)};m.prototype.bool=function(t){return this._push(kt,1,t?1:0)};function Rt(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(Rt,4,t>>>0)};m.prototype.sfixed32=m.prototype.fixed32;m.prototype.fixed64=function(t){var n=gt.from(t);return this._push(Rt,4,n.lo)._push(Rt,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 Ui=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(kt,1,0);if(G.isString(t)){var o=m.alloc(n=Pn.length(t));Pn.decode(t,o,0),t=o}return this.uint32(n)._push(Ui,n,t)};m.prototype.string=function(t){var n=Ln.length(t);return n?this.uint32(n)._push(Ln.write,n,t):this._push(kt,1,0)};m.prototype.fork=function(){return this.states=new Li(this),this.head=this.tail=new ot(Ct,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 ot(Ct,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){Ot=e,m.create=Mn(),Ot._configure()}});var Jn=O((Vo,Dn)=>{"use strict";Dn.exports=te;var Bn=Ft();(te.prototype=Object.create(Bn.prototype)).constructor=te;var Ee=Se();function te(){Bn.call(this)}te._configure=function(){te.alloc=Ee._Buffer_allocUnsafe,te.writeBytesBuffer=Ee.Buffer&&Ee.Buffer.prototype instanceof Uint8Array&&Ee.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++]}};te.prototype.bytes=function(t){Ee.isString(t)&&(t=Ee._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(te.writeBytesBuffer,n,t),this};function Bi(e,t,n){e.length<40?Ee.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}te.prototype.string=function(t){var n=Ee.Buffer.byteLength(t);return this.uint32(n),n&&this._push(Bi,n,t),this};te._configure()});var Pt=O((wo,Zn)=>{"use strict";Zn.exports=_;var Y=Se(),At,$n=Y.LongBits,Di=Y.utf8;function Q(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function _(e){this.buf=e,this.pos=0,this.len=e.length}var Wn=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new _(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new _(t);throw Error("illegal buffer")},qn=function(){return Y.Buffer?function(n){return(_.create=function(i){return Y.Buffer.isBuffer(i)?new At(i):Wn(i)})(n)}:Wn};_.create=qn();_.prototype._slice=Y.Array.prototype.subarray||Y.Array.prototype.slice;_.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}})();_.prototype.int32=function(){return this.uint32()|0};_.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function xt(){var e=new $n(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")}_.prototype.bool=function(){return this.uint32()!==0};function St(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}_.prototype.fixed32=function(){if(this.pos+4>this.len)throw Q(this,4);return St(this.buf,this.pos+=4)};_.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Q(this,4);return St(this.buf,this.pos+=4)|0};function Gn(){if(this.pos+8>this.len)throw Q(this,8);return new $n(St(this.buf,this.pos+=4),St(this.buf,this.pos+=4))}_.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};_.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};_.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)};_.prototype.string=function(){var t=this.bytes();return Di.read(t,0,t.length)};_.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};_.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};_._configure=function(e){At=e,_.create=qn(),At._configure();var t=Y.Long?"toLong":"toNumber";Y.merge(_.prototype,{int64:function(){return xt.call(this)[t](!1)},uint64:function(){return xt.call(this)[t](!0)},sint64:function(){return xt.call(this).zzDecode()[t](!1)},fixed64:function(){return Gn.call(this)[t](!0)},sfixed64:function(){return Gn.call(this)[t](!1)}})}});var Xn=O((Fo,Kn)=>{"use strict";Kn.exports=We;var zn=Pt();(We.prototype=Object.create(zn.prototype)).constructor=We;var Hn=Se();function We(e){zn.call(this,e)}We._configure=function(){Hn.Buffer&&(We.prototype._slice=Hn.Buffer.prototype.slice)};We.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))};We._configure()});var Qn=O((xo,Yn)=>{"use strict";Yn.exports=st;var Lt=Se();(st.prototype=Object.create(Lt.EventEmitter.prototype)).constructor=st;function st(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");Lt.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}st.prototype.rpcCall=function e(t,n,o,i,r){if(!i)throw TypeError("request must be specified");var s=this;if(!r)return Lt.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(f){s.emit("error",f,t),setTimeout(function(){r(f)},0);return}};st.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var er=O(jn=>{"use strict";var Ji=jn;Ji.Service=Qn()});var nr=O((Po,tr)=>{"use strict";tr.exports={}});var or=O(ir=>{"use strict";var A=ir;A.build="minimal";A.Writer=Ft();A.BufferWriter=Jn();A.Reader=Pt();A.BufferReader=Xn();A.util=Se();A.rpc=er();A.roots=nr();A.configure=rr;function rr(){A.util._configure(),A.Writer._configure(A.BufferWriter),A.Reader._configure(A.BufferReader)}rr()});var F=O((Mo,sr)=>{"use strict";sr.exports=or()});var So=globalThis.devvit?.context;var Ye;(function(e){e[e.EFFECT_REALTIME_SUB=0]="EFFECT_REALTIME_SUB",e[e.EFFECT_RERENDER_UI=1]="EFFECT_RERENDER_UI",e[e.EFFECT_RELOAD_PART=2]="EFFECT_RELOAD_PART",e[e.EFFECT_SHOW_FORM=3]="EFFECT_SHOW_FORM",e[e.EFFECT_SHOW_TOAST=4]="EFFECT_SHOW_TOAST",e[e.EFFECT_NAVIGATE_TO_URL=5]="EFFECT_NAVIGATE_TO_URL",e[e.EFFECT_SET_INTERVALS=7]="EFFECT_SET_INTERVALS",e[e.EFFECT_CREATE_ORDER=8]="EFFECT_CREATE_ORDER",e[e.EFFECT_WEB_VIEW=9]="EFFECT_WEB_VIEW",e[e.EFFECT_CAN_RUN_AS_USER=11]="EFFECT_CAN_RUN_AS_USER",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ye||(Ye={}));var pt;(function(e){e[e.CLIENT=0]="CLIENT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(pt||(pt={}));var b=x(F(),1);var U=x(F(),1);var c=new Map;var $e;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})($e||($e={}));function Wi(e){switch(e){case 0:case"NULL_VALUE":return $e.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return $e.UNRECOGNIZED}}function Gi(e){switch(e){case $e.NULL_VALUE:return 0;case $e.UNRECOGNIZED:default:return-1}}function Mt(){return{fields:{}}}var $={$type:"google.protobuf.Struct",encode(e,t=U.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&at.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof U.default.Reader?e:U.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=at.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:ur(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=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($.$type,$);function ar(){return{key:"",value:void 0}}var at={$type:"google.protobuf.Struct.FieldsEntry",encode(e,t=U.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 U.default.Reader?e:U.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.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:je(e.key)?globalThis.String(e.key):"",value:je(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 at.fromPartial(e??{})},fromPartial(e){let t=ar();return t.key=e.key??"",t.value=e.value??void 0,t}};c.set(at.$type,at);function Ut(){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=U.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&&Ge.encode(Ge.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof U.default.Reader?e:U.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ut();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=Ge.unwrap(Ge.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{nullValue:je(e.nullValue)?Wi(e.nullValue):void 0,numberValue:je(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:je(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:je(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:ur(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=Gi(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=Ut();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=Ut();if(e===null)t.nullValue=$e.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 Bt(){return{values:[]}}var Ge={$type:"google.protobuf.ListValue",encode(e,t=U.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 U.default.Reader?e:U.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Bt();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 Ge.fromPartial(e??{})},fromPartial(e){let t=Bt();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=Bt();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};c.set(Ge.$type,Ge);function ur(e){return typeof e=="object"&&e!==null}function je(e){return e!=null}var re=x(F(),1);var ne;(function(e){e[e.STATUS_CANCELLED=0]="STATUS_CANCELLED",e[e.STATUS_SUCCESS=1]="STATUS_SUCCESS",e[e.STATUS_ERROR=2]="STATUS_ERROR",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ne||(ne={}));function $i(e){switch(e){case 0:case"STATUS_CANCELLED":return ne.STATUS_CANCELLED;case 1:case"STATUS_SUCCESS":return ne.STATUS_SUCCESS;case 2:case"STATUS_ERROR":return ne.STATUS_ERROR;case-1:case"UNRECOGNIZED":default:return ne.UNRECOGNIZED}}function qi(e){switch(e){case ne.STATUS_CANCELLED:return 0;case ne.STATUS_SUCCESS:return 1;case ne.STATUS_ERROR:return 2;case ne.UNRECOGNIZED:default:return-1}}function dr(){return{id:"",skus:[],metadata:{}}}var ye={$type:"devvit.ui.effect_types.v1alpha.CreateOrderEffect",encode(e,t=re.default.Writer.create()){e.id!==""&&t.uint32(10).string(e.id);for(let n of e.skus)t.uint32(18).string(n);return Object.entries(e.metadata).forEach(([n,o])=>{ut.encode({key:n,value:o},t.uint32(26).fork()).ldelim()}),t},decode(e,t){let n=e instanceof re.default.Reader?e:re.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.id=n.string();continue;case 2:if(r!==18)break;i.skus.push(n.string());continue;case 3:if(r!==26)break;let s=ut.decode(n,n.uint32());s.value!==void 0&&(i.metadata[s.key]=s.value);continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{id:ve(e.id)?globalThis.String(e.id):"",skus:globalThis.Array.isArray(e?.skus)?e.skus.map(t=>globalThis.String(t)):[],metadata:Zi(e.metadata)?Object.entries(e.metadata).reduce((t,[n,o])=>(t[n]=String(o),t),{}):{}}},toJSON(e){let t={};if(e.id!==""&&(t.id=e.id),e.skus?.length&&(t.skus=e.skus),e.metadata){let n=Object.entries(e.metadata);n.length>0&&(t.metadata={},n.forEach(([o,i])=>{t.metadata[o]=i}))}return t},create(e){return ye.fromPartial(e??{})},fromPartial(e){let t=dr();return t.id=e.id??"",t.skus=e.skus?.map(n=>n)||[],t.metadata=Object.entries(e.metadata??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=globalThis.String(i)),n),{}),t}};c.set(ye.$type,ye);function fr(){return{key:"",value:""}}var ut={$type:"devvit.ui.effect_types.v1alpha.CreateOrderEffect.MetadataEntry",encode(e,t=re.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==""&&t.uint32(18).string(e.value),t},decode(e,t){let n=e instanceof re.default.Reader?e:re.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=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:ve(e.key)?globalThis.String(e.key):"",value:ve(e.value)?globalThis.String(e.value):""}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==""&&(t.value=e.value),t},create(e){return ut.fromPartial(e??{})},fromPartial(e){let t=fr();return t.key=e.key??"",t.value=e.value??"",t}};c.set(ut.$type,ut);function lr(){return{errorMessage:void 0,orderId:void 0,order:void 0,status:0,errorCode:void 0}}var ae={$type:"devvit.ui.effect_types.v1alpha.OrderResultEvent",encode(e,t=re.default.Writer.create()){return e.errorMessage!==void 0&&t.uint32(18).string(e.errorMessage),e.orderId!==void 0&&t.uint32(26).string(e.orderId),e.order!==void 0&&ye.encode(e.order,t.uint32(34).fork()).ldelim(),e.status!==0&&t.uint32(40).int32(e.status),e.errorCode!==void 0&&t.uint32(48).int32(e.errorCode),t},decode(e,t){let n=e instanceof re.default.Reader?e:re.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 2:if(r!==18)break;i.errorMessage=n.string();continue;case 3:if(r!==26)break;i.orderId=n.string();continue;case 4:if(r!==34)break;i.order=ye.decode(n,n.uint32());continue;case 5:if(r!==40)break;i.status=n.int32();continue;case 6:if(r!==48)break;i.errorCode=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{errorMessage:ve(e.errorMessage)?globalThis.String(e.errorMessage):void 0,orderId:ve(e.orderId)?globalThis.String(e.orderId):void 0,order:ve(e.order)?ye.fromJSON(e.order):void 0,status:ve(e.status)?$i(e.status):0,errorCode:ve(e.errorCode)?globalThis.Number(e.errorCode):void 0}},toJSON(e){let t={};return e.errorMessage!==void 0&&(t.errorMessage=e.errorMessage),e.orderId!==void 0&&(t.orderId=e.orderId),e.order!==void 0&&(t.order=ye.toJSON(e.order)),e.status!==0&&(t.status=qi(e.status)),e.errorCode!==void 0&&(t.errorCode=Math.round(e.errorCode)),t},create(e){return ae.fromPartial(e??{})},fromPartial(e){let t=lr();return t.errorMessage=e.errorMessage??void 0,t.orderId=e.orderId??void 0,t.order=e.order!==void 0&&e.order!==null?ye.fromPartial(e.order):void 0,t.status=e.status??0,t.errorCode=e.errorCode??void 0,t}};c.set(ae.$type,ae);function Zi(e){return typeof e=="object"&&e!==null}function ve(e){return e!=null}var J=x(F(),1);var Et=x(F(),1);var S=x(F(),1);var I;(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"})(I||(I={}));function et(e){switch(e){case 0:case"STRING":return I.STRING;case 1:case"PARAGRAPH":return I.PARAGRAPH;case 2:case"NUMBER":return I.NUMBER;case 3:case"BOOLEAN":return I.BOOLEAN;case 4:case"LIST":return I.LIST;case 5:case"SELECTION":return I.SELECTION;case 6:case"GROUP":return I.GROUP;case 7:case"IMAGE":return I.IMAGE;case-1:case"UNRECOGNIZED":default:return I.UNRECOGNIZED}}function tt(e){switch(e){case I.STRING:return 0;case I.PARAGRAPH:return 1;case I.NUMBER:return 2;case I.BOOLEAN:return 3;case I.LIST:return 4;case I.SELECTION:return 5;case I.GROUP:return 6;case I.IMAGE:return 7;case I.UNRECOGNIZED:default:return-1}}var B=x(F(),1);function cr(){return{fieldType:0,isSecret:void 0,stringValue:void 0,numberValue:void 0,boolValue:void 0,listValue:void 0,selectionValue:void 0,groupValue:void 0}}var T={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,t=B.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&&Ne.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&Te.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 B.default.Reader?e:B.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!==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=Ne.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionValue=Te.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)?et(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)?Ne.fromJSON(e.listValue):void 0,selectionValue:ue(e.selectionValue)?Te.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=tt(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=Ne.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=Te.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=be.toJSON(e.groupValue)),t},create(e){return T.fromPartial(e??{})},fromPartial(e){let t=cr();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?Ne.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?Te.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?be.fromPartial(e.groupValue):void 0,t}};c.set(T.$type,T);function pr(){return{itemType:0,items:[]}}var Ne={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=B.default.Writer.create()){e.itemType!==0&&t.uint32(8).int32(e.itemType);for(let n of e.items)T.encode(n,t.uint32(18).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=pr();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(T.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)?et(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(t=>T.fromJSON(t)):[]}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=tt(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>T.toJSON(n))),t},create(e){return Ne.fromPartial(e??{})},fromPartial(e){let t=pr();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>T.fromPartial(n))||[],t}};c.set(Ne.$type,Ne);function hr(){return{values:[]}}var Te={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=B.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);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=hr();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 Te.fromPartial(e??{})},fromPartial(e){let t=hr();return t.values=e.values?.map(n=>n)||[],t}};c.set(Te.$type,Te);function mr(){return{}}var be={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=B.default.Writer.create()){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=mr();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 mr()}};c.set(be.$type,be);function ue(e){return e!=null}function gr(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var P={$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&&T.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&&D.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=gr();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=T.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=D.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)?et(e.fieldType):0,label:h(e.label)?globalThis.String(e.label):"",helpText:h(e.helpText)?globalThis.String(e.helpText):void 0,defaultValue:h(e.defaultValue)?T.fromJSON(e.defaultValue):void 0,required:h(e.required)?globalThis.Boolean(e.required):void 0,disabled:h(e.disabled)?globalThis.Boolean(e.disabled):void 0,fieldConfig:h(e.fieldConfig)?D.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=tt(e.fieldType)),e.label!==""&&(t.label=e.label),e.helpText!==void 0&&(t.helpText=e.helpText),e.defaultValue!==void 0&&(t.defaultValue=T.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=D.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return P.fromPartial(e??{})},fromPartial(e){let t=gr();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?T.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?D.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};c.set(P.$type,P);function Sr(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var D={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=S.default.Writer.create()){return e.stringConfig!==void 0&&_e.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&&Re.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&&ke.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&we.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=Sr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.stringConfig=_e.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=Re.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=ke.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupConfig=we.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)?_e.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)?Re.fromJSON(e.booleanConfig):void 0,listConfig:h(e.listConfig)?Ce.fromJSON(e.listConfig):void 0,selectionConfig:h(e.selectionConfig)?ke.fromJSON(e.selectionConfig):void 0,groupConfig:h(e.groupConfig)?we.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=_e.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=Re.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=Ce.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=ke.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=we.toJSON(e.groupConfig)),t},create(e){return D.fromPartial(e??{})},fromPartial(e){let t=Sr();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?_e.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?Re.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?ke.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?we.fromPartial(e.groupConfig):void 0,t}};c.set(D.$type,D);function Er(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var _e={$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=Er();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 _e.fromPartial(e??{})},fromPartial(e){let t=Er();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(_e.$type,_e);function yr(){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=yr();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=yr();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 vr(){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=vr();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=vr();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 Nr(){return{}}var Re={$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=Nr();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 Re.fromPartial(e??{})},fromPartial(e){return Nr()}};c.set(Re.$type,Re);function Tr(){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&&D.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=Tr();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=D.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)?et(e.itemType):0,itemConfig:h(e.itemConfig)?D.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=tt(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=D.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=Tr();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?D.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 br(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var ke={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=S.default.Writer.create()){for(let n of e.choices)Ve.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=br();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.choices.push(Ve.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=>Ve.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=>Ve.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 ke.fromPartial(e??{})},fromPartial(e){let t=br();return t.choices=e.choices?.map(n=>Ve.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(ke.$type,ke);function _r(){return{label:"",value:""}}var Ve={$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=_r();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 Ve.fromPartial(e??{})},fromPartial(e){let t=_r();return t.label=e.label??"",t.value=e.value??"",t}};c.set(Ve.$type,Ve);function Ir(){return{fields:[]}}var we={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,t=S.default.Writer.create()){for(let n of e.fields)P.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=Ir();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(P.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=>P.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>P.toJSON(n))),t},create(e){return we.fromPartial(e??{})},fromPartial(e){let t=Ir();return t.fields=e.fields?.map(n=>P.fromPartial(n))||[],t}};c.set(we.$type,we);function h(e){return e!=null}function Or(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var de={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=Et.default.Writer.create()){for(let n of e.fields)P.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 Et.default.Reader?e:Et.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.fields.push(P.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=>P.fromJSON(t)):[],title:dt(e.title)?globalThis.String(e.title):void 0,shortDescription:dt(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:dt(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:dt(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:dt(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>P.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 de.fromPartial(e??{})},fromPartial(e){let t=Or();return t.fields=e.fields?.map(n=>P.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(de.$type,de);function dt(e){return e!=null}function Rr(){return{form:void 0}}var Dt={$type:"devvit.ui.effect_types.v1alpha.ShowFormEffect",encode(e,t=J.default.Writer.create()){return e.form!==void 0&&de.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof J.default.Reader?e:J.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.form=de.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{form:lt(e.form)?de.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=de.toJSON(e.form)),t},create(e){return Dt.fromPartial(e??{})},fromPartial(e){let t=Rr();return t.form=e.form!==void 0&&e.form!==null?de.fromPartial(e.form):void 0,t}};c.set(Dt.$type,Dt);function Cr(){return{results:{},formId:void 0}}var fe={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent",encode(e,t=J.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{ft.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 J.default.Reader?e:J.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;let s=ft.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:Hi(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=T.fromJSON(o),t),{}):{},formId:lt(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]=T.toJSON(i)}))}return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return fe.fromPartial(e??{})},fromPartial(e){let t=Cr();return t.results=Object.entries(e.results??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=T.fromPartial(i)),n),{}),t.formId=e.formId??void 0,t}};c.set(fe.$type,fe);function kr(){return{key:"",value:void 0}}var ft={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=J.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&T.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof J.default.Reader?e:J.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.key=n.string();continue;case 2:if(r!==18)break;i.value=T.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:lt(e.key)?globalThis.String(e.key):"",value:lt(e.value)?T.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=T.toJSON(e.value)),t},create(e){return ft.fromPartial(e??{})},fromPartial(e){let t=kr();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?T.fromPartial(e.value):void 0,t}};c.set(ft.$type,ft);function Vr(){return{formId:void 0}}var le={$type:"devvit.ui.effect_types.v1alpha.FormCanceledEvent",encode(e,t=J.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof J.default.Reader?e:J.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.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{formId:lt(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=Vr();return t.formId=e.formId??void 0,t}};c.set(le.$type,le);function Hi(e){return typeof e=="object"&&e!==null}function lt(e){return e!=null}var ze=x(F(),1);var y=x(F(),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 E(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}E.prototype.__isLong__;Object.defineProperty(E.prototype,"__isLong__",{value:!0});function k(e){return(e&&e.__isLong__)===!0}function wr(e){var t=Math.clz32(e&-e);return e?31-t:t}E.isLong=k;var Fr={},xr={};function qe(e,t){var n,o,i;return t?(e>>>=0,(i=0<=e&&e<256)&&(o=xr[e],o)?o:(n=g(e,0,!0),i&&(xr[e]=n),n)):(e|=0,(i=-128<=e&&e<128)&&(o=Fr[e],o)?o:(n=g(e,e<0?-1:0,!1),i&&(Fr[e]=n),n))}E.fromInt=qe;function Z(e,t){if(isNaN(e))return t?ce:j;if(t){if(e<0)return ce;if(e>=Mr)return Dr}else{if(e<=-Pr)return L;if(e+1>=Pr)return Br}return e<0?Z(-e,t).neg():g(e%rt|0,e/rt|0,t)}E.fromNumber=Z;function g(e,t,n){return new E(e,t,n)}E.fromBits=g;var yt=Math.pow;function Wt(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?ce: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 Wt(e.substring(1),t,n).neg();for(var i=Z(yt(n,8)),r=j,s=0;s<e.length;s+=8){var f=Math.min(8,e.length-s),a=parseInt(e.substring(s,s+f),n);if(f<8){var u=Z(yt(n,f));r=r.mul(u).add(Z(a))}else r=r.mul(i),r=r.add(Z(a))}return r.unsigned=t,r}E.fromString=Wt;function H(e,t){return typeof e=="number"?Z(e,t):typeof e=="string"?Wt(e,t):g(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}E.fromValue=H;var Ar=65536,zi=1<<24,rt=Ar*Ar,Mr=rt*rt,Pr=Mr/2,Lr=qe(zi),j=qe(0);E.ZERO=j;var ce=qe(0,!0);E.UZERO=ce;var nt=qe(1);E.ONE=nt;var Ur=qe(1,!0);E.UONE=Ur;var Jt=qe(-1);E.NEG_ONE=Jt;var Br=g(-1,2147483647,!1);E.MAX_VALUE=Br;var Dr=g(-1,-1,!0);E.MAX_UNSIGNED_VALUE=Dr;var L=g(0,-2147483648,!1);E.MIN_VALUE=L;var d=E.prototype;d.toInt=function(){return this.unsigned?this.low>>>0:this.low};d.toNumber=function(){return this.unsigned?(this.high>>>0)*rt+(this.low>>>0):this.high*rt+(this.low>>>0)};d.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(L)){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(yt(t,6),this.unsigned),s=this,f="";;){var a=s.div(r),u=s.sub(a.mul(r)).toInt()>>>0,l=u.toString(t);if(s=a,s.isZero())return l+f;for(;l.length<6;)l="0"+l;f=""+l+f}};d.getHighBits=function(){return this.high};d.getHighBitsUnsigned=function(){return this.high>>>0};d.getLowBits=function(){return this.low};d.getLowBitsUnsigned=function(){return this.low>>>0};d.getNumBitsAbs=function(){if(this.isNegative())return this.eq(L)?64:this.neg().getNumBitsAbs();for(var 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};d.isSafeInteger=function(){var t=this.high>>21;return t?this.unsigned?!1:t===-1&&!(this.low===0&&this.high===-2097152):!0};d.isZero=function(){return this.high===0&&this.low===0};d.eqz=d.isZero;d.isNegative=function(){return!this.unsigned&&this.high<0};d.isPositive=function(){return this.unsigned||this.high>=0};d.isOdd=function(){return(this.low&1)===1};d.isEven=function(){return(this.low&1)===0};d.equals=function(t){return k(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};d.eq=d.equals;d.notEquals=function(t){return!this.eq(t)};d.neq=d.notEquals;d.ne=d.notEquals;d.lessThan=function(t){return this.comp(t)<0};d.lt=d.lessThan;d.lessThanOrEqual=function(t){return this.comp(t)<=0};d.lte=d.lessThanOrEqual;d.le=d.lessThanOrEqual;d.greaterThan=function(t){return this.comp(t)>0};d.gt=d.greaterThan;d.greaterThanOrEqual=function(t){return this.comp(t)>=0};d.gte=d.greaterThanOrEqual;d.ge=d.greaterThanOrEqual;d.compare=function(t){if(k(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};d.comp=d.compare;d.negate=function(){return!this.unsigned&&this.eq(L)?L:this.not().add(nt)};d.neg=d.negate;d.add=function(t){k(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,f=t.high&65535,a=t.low>>>16,u=t.low&65535,l=0,N=0,v=0,M=0;return M+=r+u,v+=M>>>16,M&=65535,v+=i+a,N+=v>>>16,v&=65535,N+=o+f,l+=N>>>16,N&=65535,l+=n+s,l&=65535,g(v<<16|M,l<<16|N,this.unsigned)};d.subtract=function(t){return k(t)||(t=H(t)),this.add(t.neg())};d.sub=d.subtract;d.multiply=function(t){if(this.isZero())return this;if(k(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?ce:j;if(this.eq(L))return t.isOdd()?L:j;if(t.eq(L))return this.isOdd()?L: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(Lr)&&t.lt(Lr))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,f=t.high>>>16,a=t.high&65535,u=t.low>>>16,l=t.low&65535,N=0,v=0,M=0,ct=0;return ct+=s*l,M+=ct>>>16,ct&=65535,M+=r*l,v+=M>>>16,M&=65535,M+=s*u,v+=M>>>16,M&=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*f,N&=65535,g(M<<16|ct,N<<16|v,this.unsigned)};d.mul=d.multiply;d.divide=function(t){if(k(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?ce:j;var o,i,r;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return ce;if(t.gt(this.shru(1)))return Ur;r=ce}else{if(this.eq(L)){if(t.eq(nt)||t.eq(Jt))return L;if(t.eq(L))return nt;var s=this.shr(1);return o=s.div(t).shl(1),o.eq(j)?t.isNegative()?nt:Jt:(i=this.sub(t.mul(o)),r=o.add(i.div(t)),r)}else if(t.eq(L))return this.unsigned?ce: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 f=Math.ceil(Math.log(o)/Math.LN2),a=f<=48?1:yt(2,f-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=nt),r=r.add(u),i=i.sub(l)}return r};d.div=d.divide;d.modulo=function(t){if(k(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))};d.mod=d.modulo;d.rem=d.modulo;d.not=function(){return g(~this.low,~this.high,this.unsigned)};d.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};d.clz=d.countLeadingZeros;d.countTrailingZeros=function(){return this.low?wr(this.low):wr(this.high)+32};d.ctz=d.countTrailingZeros;d.and=function(t){return k(t)||(t=H(t)),g(this.low&t.low,this.high&t.high,this.unsigned)};d.or=function(t){return k(t)||(t=H(t)),g(this.low|t.low,this.high|t.high,this.unsigned)};d.xor=function(t){return k(t)||(t=H(t)),g(this.low^t.low,this.high^t.high,this.unsigned)};d.shiftLeft=function(t){return k(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)};d.shl=d.shiftLeft;d.shiftRight=function(t){return k(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)};d.shr=d.shiftRight;d.shiftRightUnsigned=function(t){return k(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)};d.shru=d.shiftRightUnsigned;d.shr_u=d.shiftRightUnsigned;d.rotateLeft=function(t){var n;return k(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))};d.rotl=d.rotateLeft;d.rotateRight=function(t){var n;return k(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))};d.rotr=d.rotateRight;d.toSigned=function(){return this.unsigned?g(this.low,this.high,!1):this};d.toUnsigned=function(){return this.unsigned?this:g(this.low,this.high,!0)};d.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};d.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]};d.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]};E.fromBytes=function(t,n,o){return o?E.fromBytesLE(t,n):E.fromBytesBE(t,n)};E.fromBytesLE=function(t,n){return new E(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};E.fromBytesBE=function(t,n){return new E(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"&&(E.fromBigInt=function(t,n){var o=Number(BigInt.asIntN(32,t)),i=Number(BigInt.asIntN(32,t>>BigInt(32)));return g(o,i,n)},E.fromValue=function(t,n){return typeof t=="bigint"?E.fromBigInt(t,n):H(t,n)},d.toBigInt=function(){var t=BigInt(this.low>>>0),n=BigInt(this.unsigned?this.high>>>0:this.high);return n<<BigInt(32)|t});var Gt=E;var Ze=x(F(),1);function Jr(){return{seconds:0,nanos:0}}var He={$type:"google.protobuf.Timestamp",encode(e,t=Ze.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 Ze.default.Reader?e:Ze.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.seconds=Ki(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:Wr(e.seconds)?globalThis.Number(e.seconds):0,nanos:Wr(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 He.fromPartial(e??{})},fromPartial(e){let t=Jr();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}};c.set(He.$type,He);function Ki(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}Ze.default.util.Long!==Gt&&(Ze.default.util.Long=Gt,Ze.default.configure());function Wr(e){return e!=null}var ie;(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"})(ie||(ie={}));function Xt(e){switch(e){case 0:case"CONSENT_STATUS_UNKNOWN":return ie.CONSENT_STATUS_UNKNOWN;case 1:case"REVOKED":return ie.REVOKED;case 2:case"GRANTED":return ie.GRANTED;case-1:case"UNRECOGNIZED":default:return ie.UNRECOGNIZED}}function Yt(e){switch(e){case ie.CONSENT_STATUS_UNKNOWN:return 0;case ie.REVOKED:return 1;case ie.GRANTED:return 2;case ie.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 Qr(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 jr(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 Gr(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}var Fe={$type:"reddit.devvit.app_permission.v1.AppPermission",encode(e,t=y.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&&He.encode(Xi(e.updatedAt),t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof y.default.Reader?e:y.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.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=ei(He.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:V(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:V(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>Qr(t)):[],consentStatus:V(e.consentStatus)?Xt(e.consentStatus):0,updatedAt:V(e.updatedAt)?Yi(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=>jr(n))),e.consentStatus!==0&&(t.consentStatus=Yt(e.consentStatus)),e.updatedAt!==void 0&&(t.updatedAt=e.updatedAt.toISOString()),t},create(e){return Fe.fromPartial(e??{})},fromPartial(e){let t=Gr();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(Fe.$type,Fe);function $r(){return{appSlug:"",appName:""}}var xe={$type:"reddit.devvit.app_permission.v1.DevvitApp",encode(e,t=y.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 y.default.Reader?e:y.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.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:V(e.appSlug)?globalThis.String(e.appSlug):"",appName:V(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 xe.fromPartial(e??{})},fromPartial(e){let t=$r();return t.appSlug=e.appSlug??"",t.appName=e.appName??"",t}};c.set(xe.$type,xe);function qr(){return{userId:""}}var $t={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdRequest",encode(e,t=y.default.Writer.create()){return e.userId!==""&&t.uint32(10).string(e.userId),t},decode(e,t){let n=e instanceof y.default.Reader?e:y.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.userId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{userId:V(e.userId)?globalThis.String(e.userId):""}},toJSON(e){let t={};return e.userId!==""&&(t.userId=e.userId),t},create(e){return $t.fromPartial(e??{})},fromPartial(e){let t=qr();return t.userId=e.userId??"",t}};c.set($t.$type,$t);function Zr(){return{appPermissions:[],devvitApps:[]}}var qt={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,t=y.default.Writer.create()){for(let n of e.appPermissions)Fe.encode(n,t.uint32(10).fork()).ldelim();for(let n of e.devvitApps)xe.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof y.default.Reader?e:y.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.appPermissions.push(Fe.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.devvitApps.push(xe.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=>Fe.fromJSON(t)):[],devvitApps:globalThis.Array.isArray(e?.devvitApps)?e.devvitApps.map(t=>xe.fromJSON(t)):[]}},toJSON(e){let t={};return e.appPermissions?.length&&(t.appPermissions=e.appPermissions.map(n=>Fe.toJSON(n))),e.devvitApps?.length&&(t.devvitApps=e.devvitApps.map(n=>xe.toJSON(n))),t},create(e){return qt.fromPartial(e??{})},fromPartial(e){let t=Zr();return t.appPermissions=e.appPermissions?.map(n=>Fe.fromPartial(n))||[],t.devvitApps=e.devvitApps?.map(n=>xe.fromPartial(n))||[],t}};c.set(qt.$type,qt);function Hr(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}var Zt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionRequest",encode(e,t=y.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 y.default.Reader?e:y.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.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:V(e.userId)?globalThis.String(e.userId):"",appSlug:V(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:V(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>Qr(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=>jr(n))),t},create(e){return Zt.fromPartial(e??{})},fromPartial(e){let t=Hr();return t.userId=e.userId??"",t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t}};c.set(Zt.$type,Zt);function zr(){return{error:void 0}}var Ht={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode(e,t=y.default.Writer.create()){return e.error!==void 0&&W.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof y.default.Reader?e:y.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.error=W.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:V(e.error)?W.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=W.toJSON(e.error)),t},create(e){return Ht.fromPartial(e??{})},fromPartial(e){let t=zr();return t.error=e.error!==void 0&&e.error!==null?W.fromPartial(e.error):void 0,t}};c.set(Ht.$type,Ht);function Kr(){return{appSlug:"",userId:"",subredditId:""}}var zt={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionRequest",encode(e,t=y.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 y.default.Reader?e:y.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.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:V(e.appSlug)?globalThis.String(e.appSlug):"",userId:V(e.userId)?globalThis.String(e.userId):"",subredditId:V(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 zt.fromPartial(e??{})},fromPartial(e){let t=Kr();return t.appSlug=e.appSlug??"",t.userId=e.userId??"",t.subredditId=e.subredditId??"",t}};c.set(zt.$type,zt);function Xr(){return{error:void 0}}var Kt={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode(e,t=y.default.Writer.create()){return e.error!==void 0&&W.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof y.default.Reader?e:y.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=W.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:V(e.error)?W.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=W.toJSON(e.error)),t},create(e){return Kt.fromPartial(e??{})},fromPartial(e){let t=Xr();return t.error=e.error!==void 0&&e.error!==null?W.fromPartial(e.error):void 0,t}};c.set(Kt.$type,Kt);function Yr(){return{message:""}}var W={$type:"reddit.devvit.app_permission.v1.ErrorMessage",encode(e,t=y.default.Writer.create()){return e.message!==""&&t.uint32(10).string(e.message),t},decode(e,t){let n=e instanceof y.default.Reader?e:y.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.message=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{message:V(e.message)?globalThis.String(e.message):""}},toJSON(e){let t={};return e.message!==""&&(t.message=e.message),t},create(e){return W.fromPartial(e??{})},fromPartial(e){let t=Yr();return t.message=e.message??"",t}};c.set(W.$type,W);function Xi(e){let t=Math.trunc(e.getTime()/1e3),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function ei(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function Yi(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):ei(He.fromJSON(e))}function V(e){return e!=null}function ti(){return{postId:void 0,appSlug:void 0,subredditId:void 0}}var Qt={$type:"devvit.ui.effects.v1alpha.CanRunAsUserEffect",encode(e,t=ze.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 ze.default.Reader?e:ze.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.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:vt(e.postId)?globalThis.String(e.postId):void 0,appSlug:vt(e.appSlug)?globalThis.String(e.appSlug):void 0,subredditId:vt(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 Qt.fromPartial(e??{})},fromPartial(e){let t=ti();return t.postId=e.postId??void 0,t.appSlug=e.appSlug??void 0,t.subredditId=e.subredditId??void 0,t}};c.set(Qt.$type,Qt);function ni(){return{consentStatus:0}}var pe={$type:"devvit.ui.effects.v1alpha.ConsentStatusEvent",encode(e,t=ze.default.Writer.create()){return e.consentStatus!==0&&t.uint32(8).int32(e.consentStatus),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=ni();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:vt(e.consentStatus)?Xt(e.consentStatus):0}},toJSON(e){let t={};return e.consentStatus!==0&&(t.consentStatus=Yt(e.consentStatus)),t},create(e){return pe.fromPartial(e??{})},fromPartial(e){let t=ni();return t.consentStatus=e.consentStatus??0,t}};c.set(pe.$type,pe);function vt(e){return e!=null}var Xe=x(F(),1);var Ke=x(F(),1);var Nt=x(F(),1);function ri(){return{}}var Tt={$type:"google.protobuf.Empty",encode(e,t=Nt.default.Writer.create()){return t},decode(e,t){let n=e instanceof Nt.default.Reader?e:Nt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ri();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 Tt.fromPartial(e??{})},fromPartial(e){return ri()}};c.set(Tt.$type,Tt);function ii(){return{channels:[]}}var jt={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=Ke.default.Writer.create()){for(let n of e.channels)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof Ke.default.Reader?e:Ke.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.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 jt.fromPartial(e??{})},fromPartial(e){let t=ii();return t.channels=e.channels?.map(n=>n)||[],t}};c.set(jt.$type,jt);function oi(){return{channel:"",data:void 0}}var he={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=Ke.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 Ke.default.Reader?e:Ke.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.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:ji(e.channel)?globalThis.String(e.channel):"",data:Qi(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 he.fromPartial(e??{})},fromPartial(e){let t=oi();return t.channel=e.channel??"",t.data=e.data??void 0,t}};c.set(he.$type,he);function Qi(e){return typeof e=="object"&&e!==null}function ji(e){return e!=null}var Ae;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ae||(Ae={}));function eo(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return Ae.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return Ae.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return Ae.UNRECOGNIZED}}function to(e){switch(e){case Ae.REALTIME_SUBSCRIBED:return 0;case Ae.REALTIME_UNSUBSCRIBED:return 1;case Ae.UNRECOGNIZED:default:return-1}}function si(){return{subscriptionIds:[]}}var en={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=Xe.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof Xe.default.Reader?e:Xe.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.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 en.fromPartial(e??{})},fromPartial(e){let t=si();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};c.set(en.$type,en);function ai(){return{event:void 0,status:void 0}}var me={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=Xe.default.Writer.create()){return e.event!==void 0&&he.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 Xe.default.Reader?e:Xe.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.event=he.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:ui(e.event)?he.fromJSON(e.event):void 0,status:ui(e.status)?eo(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=he.toJSON(e.event)),e.status!==void 0&&(t.status=to(e.status)),t},create(e){return me.fromPartial(e??{})},fromPartial(e){let t=ai();return t.event=e.event!==void 0&&e.event!==null?he.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};c.set(me.$type,me);function ui(e){return e!=null}var bt=x(F(),1);var oe;(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"})(oe||(oe={}));function nn(e){switch(e){case 0:case"UNSPECIFIED":return oe.UNSPECIFIED;case 1:case"INLINE_MODE":return oe.INLINE_MODE;case 2:case"IMMERSIVE_MODE":return oe.IMMERSIVE_MODE;case-1:case"UNRECOGNIZED":default:return oe.UNRECOGNIZED}}function rn(e){switch(e){case oe.UNSPECIFIED:return 0;case oe.INLINE_MODE:return 1;case oe.IMMERSIVE_MODE:return 2;case oe.UNRECOGNIZED:default:return-1}}function di(){return{immersiveMode:0,entryUrl:void 0}}var tn={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,t=bt.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 bt.default.Reader?e:bt.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!==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:fi(e.immersiveMode)?nn(e.immersiveMode):0,entryUrl:fi(e.entryUrl)?globalThis.String(e.entryUrl):void 0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=rn(e.immersiveMode)),e.entryUrl!==void 0&&(t.entryUrl=e.entryUrl),t},create(e){return tn.fromPartial(e??{})},fromPartial(e){let t=di();return t.immersiveMode=e.immersiveMode??0,t.entryUrl=e.entryUrl??void 0,t}};c.set(tn.$type,tn);function fi(e){return e!=null}var Be;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Be||(Be={}));function no(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return Be.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return Be.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return Be.UNRECOGNIZED}}function ro(e){switch(e){case Be.WEBVIEW_VISIBLE:return 0;case Be.WEBVIEW_HIDDEN:return 1;case Be.UNRECOGNIZED:default:return-1}}function li(){return{message:void 0,jsonString:""}}var Pe={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=b.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 b.default.Reader?e:b.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!==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 Pe.fromPartial(e??{})},fromPartial(e){let t=li();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};c.set(Pe.$type,Pe);function ci(){return{visibility:0}}var Le={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=b.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),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=ci();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)?no(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=ro(e.visibility)),t},create(e){return Le.fromPartial(e??{})},fromPartial(e){let t=ci();return t.visibility=e.visibility??0,t}};c.set(Le.$type,Le);function pi(){return{postMessage:void 0,fullScreen:void 0}}var on={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=b.default.Writer.create()){return e.postMessage!==void 0&&Pe.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&Le.encode(e.fullScreen,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=pi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postMessage=Pe.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.fullScreen=Le.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)?Pe.fromJSON(e.postMessage):void 0,fullScreen:w(e.fullScreen)?Le.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=Pe.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=Le.toJSON(e.fullScreen)),t},create(e){return on.fromPartial(e??{})},fromPartial(e){let t=pi();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?Pe.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?Le.fromPartial(e.fullScreen):void 0,t}};c.set(on.$type,on);function hi(){return{immersiveMode:0}}var Me={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode(e,t=b.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),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=hi();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)?nn(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=rn(e.immersiveMode)),t},create(e){return Me.fromPartial(e??{})},fromPartial(e){let t=hi();return t.immersiveMode=e.immersiveMode??0,t}};c.set(Me.$type,Me);function mi(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,consentStatus:void 0,orderResult:void 0}}var se={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=b.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&&fe.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&me.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&Me.encode(e.immersiveModeEvent,t.uint32(42).fork()).ldelim(),e.consentStatus!==void 0&&pe.encode(e.consentStatus,t.uint32(58).fork()).ldelim(),e.orderResult!==void 0&&ae.encode(e.orderResult,t.uint32(66).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=mi();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=fe.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.realtimeEvent=me.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.immersiveModeEvent=Me.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.consentStatus=pe.decode(n,n.uint32());continue;case 8:if(r!==66)break;i.orderResult=ae.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)?fe.fromJSON(e.formSubmitted):void 0,realtimeEvent:w(e.realtimeEvent)?me.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:w(e.immersiveModeEvent)?Me.fromJSON(e.immersiveModeEvent):void 0,consentStatus:w(e.consentStatus)?pe.fromJSON(e.consentStatus):void 0,orderResult:w(e.orderResult)?ae.fromJSON(e.orderResult):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=fe.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=me.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(t.immersiveModeEvent=Me.toJSON(e.immersiveModeEvent)),e.consentStatus!==void 0&&(t.consentStatus=pe.toJSON(e.consentStatus)),e.orderResult!==void 0&&(t.orderResult=ae.toJSON(e.orderResult)),t},create(e){return se.fromPartial(e??{})},fromPartial(e){let t=mi();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?fe.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?me.fromPartial(e.realtimeEvent):void 0,t.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?Me.fromPartial(e.immersiveModeEvent):void 0,t.consentStatus=e.consentStatus!==void 0&&e.consentStatus!==null?pe.fromPartial(e.consentStatus):void 0,t.orderResult=e.orderResult!==void 0&&e.orderResult!==null?ae.fromPartial(e.orderResult):void 0,t}};c.set(se.$type,se);function gi(){return{data:void 0}}var sn={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent",encode(e,t=b.default.Writer.create()){return e.data!==void 0&&Ue.encode(e.data,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=gi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.data=Ue.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)?Ue.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.data!==void 0&&(t.data=Ue.toJSON(e.data)),t},create(e){return sn.fromPartial(e??{})},fromPartial(e){let t=gi();return t.data=e.data!==void 0&&e.data!==null?Ue.fromPartial(e.data):void 0,t}};c.set(sn.$type,sn);function Si(){return{type:"",data:void 0}}var Ue={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent.MessageData",encode(e,t=b.default.Writer.create()){return e.type!==""&&t.uint32(10).string(e.type),e.data!==void 0&&se.encode(e.data,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=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=se.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)?se.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.type!==""&&(t.type=e.type),e.data!==void 0&&(t.data=se.toJSON(e.data)),t},create(e){return Ue.fromPartial(e??{})},fromPartial(e){let t=Si();return t.type=e.type??"",t.data=e.data!==void 0&&e.data!==null?se.fromPartial(e.data):void 0,t}};c.set(Ue.$type,Ue);function w(e){return e!=null}var io=[Ye.EFFECT_SHOW_FORM,Ye.EFFECT_CAN_RUN_AS_USER],K=e=>new Promise(t=>{let n={scope:pt.CLIENT,type:"devvit-internal"};if(e.realtimeSubscriptions?n.realtimeEffect=e.realtimeSubscriptions:e.immersiveMode?n.immersiveMode=e.immersiveMode:e.share?n.share=e.share:e.showToast?n.showToast=e.showToast:e.navigateToUrl?n.navigateToUrl=e.navigateToUrl:e.showForm&&(n.showForm=e.showForm),(e.showToast||e.navigateToUrl||e.showForm||e.type===Ye.EFFECT_CAN_RUN_AS_USER)&&(n.effect=e),io.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=se.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 Bs(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 De;(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"})(De||(De={}));var Ei;(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"})(Ei||(Ei={}));var $s=async()=>{let e=devvit.appPermissionState;if(!e)return!0;if(e.requestedScopes.length===0)return!1;switch(e.consentStatus){case De.REVOKED:return!1;case De.GRANTED:if(e.requestedScopes.every(n=>e.grantedScopes.includes(n)))return!0;break;case De.CONSENT_STATUS_UNKNOWN:case De.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===De.GRANTED};var yi="$devvit_icon.png";async function Ys(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(yi,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 Qs(){return devvit.share?.userData}function an(e,t=new Set){for(let n of e){if(n.type==="group"){an(n.fields,t);continue}let o=n.name;if(t.has(o))throw new Error(`Duplicate field name: ${o}`);t.add(o)}oo(e)}function oo(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 so(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 Ni(e){return Object.keys(e).reduce((t,n)=>{let o=so(e[n]);return o!==void 0&&(t[n]=o),t},{})}function un(e){return e.map(t=>{switch(t.type){case"string":return ao(t);case"image":return uo(t);case"paragraph":return fo(t);case"number":return lo(t);case"select":return co(t);case"boolean":return po(t);case"group":return ho(t);default:throw new Error("Unknown field type.")}})}function ao(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 uo(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function fo(e){return{defaultValue:{fieldType:1,stringValue:e.defaultValue},disabled:e.disabled,fieldConfig:{paragraphConfig:{lineHeight:e.lineHeight,placeholder:e.placeholder}},fieldId:e.name,fieldType:1,helpText:e.helpText,label:e.label,required:e.required}}function lo(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 co(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 po(e){return{defaultValue:{fieldType:3,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:3,helpText:e.helpText,label:e.label}}function ho(e){return{fieldId:"",fieldType:6,fieldConfig:{groupConfig:{fields:un(e.fields)}},label:e.label,helpText:e.helpText}}var Ti=1,mo=()=>(Ti++,`form.${Ti}`),aa=async e=>{let t={fields:[],id:mo(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};an(e.fields),t.fields=un(e.fields);let n=await K({showForm:{form:t},type:3});return!n||!n.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:Ni(n.formSubmitted.results)}};function fa(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 ee;(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"})(ee||(ee={}));var bi="token";var dn=new Set,Sa=()=>Oi(devvit.webViewMode);function Ea(e,t){if(devvit.webViewMode===ee.IMMERSIVE_MODE)throw Error("web view is already expanded");return _i(ee.IMMERSIVE_MODE,e,t)}function ya(e){if(devvit.webViewMode===ee.INLINE_MODE)throw Error("web view is already inlined");return _i(ee.INLINE_MODE,e,void 0)}function va(e){dn.add(e)}function Na(e){dn.delete(e)}async function _i(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\``);let o;if(n){let r=new URL(devvit.entrypoints[n]);r.searchParams.set(bi,devvit.token),o=`${r}`}await K({type:9,immersiveMode:{entryUrl:o,immersiveMode:e}})}function Ii(){addEventListener("message",e=>{let{type:t,data:n}=e.data;if(t!=="devvit-message"||!n?.immersiveModeEvent)return;devvit.webViewMode=n.immersiveModeEvent.immersiveMode;let o=Oi(n.immersiveModeEvent.immersiveMode);dn.forEach(i=>i(o))})}function Oi(e){switch(e){case ee.IMMERSIVE_MODE:return"expanded";case ee.INLINE_MODE:case ee.UNRECOGNIZED:case ee.UNSPECIFIED:case void 0:return"inline";default:throw Error(`${e} not a WebViewImmersiveMode`)}}Ii();export{va as addWebViewModeListener,$s as canRunAsUser,So as context,ya as exitExpandedMode,Qs as getShareData,Sa as getWebViewMode,Bs as navigateTo,Ii as registerListener,Na as removeWebViewModeListener,Ea as requestExpandedMode,aa as showForm,Ys as showShareSheet,fa as showToast};
2
2
  /*! Bundled license information:
3
3
 
4
4
  long/index.js: