@devvit/web-view-scripts 0.12.21 → 0.12.22-next-2026-04-27-18-55-47-e6bf16f1c.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/scripts/devvit.v1.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var ro=Object.create;var _n=Object.defineProperty;var io=Object.getOwnPropertyDescriptor;var oo=Object.getOwnPropertyNames;var so=Object.getPrototypeOf,uo=Object.prototype.hasOwnProperty;var ao=(e,t)=>()=>(e&&(t=e(e=0)),t);var O=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var fo=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of oo(t))!uo.call(e,i)&&i!==n&&_n(e,i,{get:()=>t[i],enumerable:!(o=io(t,i))||o.enumerable});return e};var A=(e,t,n)=>(n=e!=null?ro(so(e)):{},fo(t||!e||!e.__esModule?_n(n,"default",{value:e,enumerable:!0}):n,e));var m,a=ao(()=>{m={hash:"6ed408607",version:"0.12.21-dev"}});var An=O((xs,Vn)=>{"use strict";a();Vn.exports=Eo;function Eo(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(l,u){n[o]=function(p){if(r)if(r=!1,p)u(p);else{for(var T=new Array(arguments.length-1),b=0;b<T.length;)T[b++]=arguments[b];l.apply(null,T)}};try{e.apply(t||null,n)}catch(d){r&&(r=!1,u(d))}})}});var Mn=O(Un=>{"use strict";a();var Ct=Un;Ct.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 st=new Array(64),Ln=new Array(123);for(j=0;j<64;)Ln[st[j]=j<26?j+65:j<52?j+71:j<62?j-4:j-59|43]=j++;var j;Ct.encode=function(t,n,o){for(var i=null,r=[],s=0,l=0,u;n<o;){var d=t[n++];switch(l){case 0:r[s++]=st[d>>2],u=(d&3)<<4,l=1;break;case 1:r[s++]=st[u|d>>4],u=(d&15)<<2,l=2;break;case 2:r[s++]=st[u|d>>6],r[s++]=st[d&63],l=0;break}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,r)),s=0)}return l&&(r[s++]=st[u],r[s++]=61,l===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";Ct.decode=function(t,n,o){for(var i=o,r=0,s,l=0;l<t.length;){var u=t.charCodeAt(l++);if(u===61&&r>1)break;if((u=Ln[u])===void 0)throw Error(Pn);switch(r){case 0:s=u,r=1;break;case 1:n[o++]=s<<2|(u&48)>>4,s=u,r=2;break;case 2:n[o++]=(s&15)<<4|(u&60)>>2,s=u,r=3;break;case 3:n[o++]=(s&3)<<6|u,r=0;break}}if(r===1)throw Error(Pn);return o-i};Ct.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var Dn=O((Ls,Bn)=>{"use strict";a();Bn.exports=_t;function _t(){this._listeners={}}_t.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};_t.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};_t.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 Zn=O((Ms,Gn)=>{"use strict";a();Gn.exports=Jn(Jn);function Jn(e){return typeof Float32Array<"u"?(function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function i(u,d,p){t[0]=u,d[p]=n[0],d[p+1]=n[1],d[p+2]=n[2],d[p+3]=n[3]}function r(u,d,p){t[0]=u,d[p]=n[3],d[p+1]=n[2],d[p+2]=n[1],d[p+3]=n[0]}e.writeFloatLE=o?i:r,e.writeFloatBE=o?r:i;function s(u,d){return n[0]=u[d],n[1]=u[d+1],n[2]=u[d+2],n[3]=u[d+3],t[0]}function l(u,d){return n[3]=u[d],n[2]=u[d+1],n[1]=u[d+2],n[0]=u[d+3],t[0]}e.readFloatLE=o?s:l,e.readFloatBE=o?l:s})():(function(){function t(o,i,r,s){var l=i<0?1:0;if(l&&(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((l<<31|2139095040)>>>0,r,s);else if(i<11754943508222875e-54)o((l<<31|Math.round(i/1401298464324817e-60))>>>0,r,s);else{var u=Math.floor(Math.log(i)/Math.LN2),d=Math.round(i*Math.pow(2,-u)*8388608)&8388607;o((l<<31|u+127<<23|d)>>>0,r,s)}}e.writeFloatLE=t.bind(null,Fn),e.writeFloatBE=t.bind(null,Wn);function n(o,i,r){var s=o(i,r),l=(s>>31)*2+1,u=s>>>23&255,d=s&8388607;return u===255?d?NaN:l*(1/0):u===0?l*1401298464324817e-60*d:l*Math.pow(2,u-150)*(d+8388608)}e.readFloatLE=n.bind(null,qn),e.readFloatBE=n.bind(null,$n)})(),typeof Float64Array<"u"?(function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function i(u,d,p){t[0]=u,d[p]=n[0],d[p+1]=n[1],d[p+2]=n[2],d[p+3]=n[3],d[p+4]=n[4],d[p+5]=n[5],d[p+6]=n[6],d[p+7]=n[7]}function r(u,d,p){t[0]=u,d[p]=n[7],d[p+1]=n[6],d[p+2]=n[5],d[p+3]=n[4],d[p+4]=n[3],d[p+5]=n[2],d[p+6]=n[1],d[p+7]=n[0]}e.writeDoubleLE=o?i:r,e.writeDoubleBE=o?r:i;function s(u,d){return n[0]=u[d],n[1]=u[d+1],n[2]=u[d+2],n[3]=u[d+3],n[4]=u[d+4],n[5]=u[d+5],n[6]=u[d+6],n[7]=u[d+7],t[0]}function l(u,d){return n[7]=u[d],n[6]=u[d+1],n[5]=u[d+2],n[4]=u[d+3],n[3]=u[d+4],n[2]=u[d+5],n[1]=u[d+6],n[0]=u[d+7],t[0]}e.readDoubleLE=o?s:l,e.readDoubleBE=o?l:s})():(function(){function t(o,i,r,s,l,u){var d=s<0?1:0;if(d&&(s=-s),s===0)o(0,l,u+i),o(1/s>0?0:2147483648,l,u+r);else if(isNaN(s))o(0,l,u+i),o(2146959360,l,u+r);else if(s>17976931348623157e292)o(0,l,u+i),o((d<<31|2146435072)>>>0,l,u+r);else{var p;if(s<22250738585072014e-324)p=s/5e-324,o(p>>>0,l,u+i),o((d<<31|p/4294967296)>>>0,l,u+r);else{var T=Math.floor(Math.log(s)/Math.LN2);T===1024&&(T=1023),p=s*Math.pow(2,-T),o(p*4503599627370496>>>0,l,u+i),o((d<<31|T+1023<<20|p*1048576&1048575)>>>0,l,u+r)}}}e.writeDoubleLE=t.bind(null,Fn,0,4),e.writeDoubleBE=t.bind(null,Wn,4,0);function n(o,i,r,s,l){var u=o(s,l+i),d=o(s,l+r),p=(d>>31)*2+1,T=d>>>20&2047,b=4294967296*(d&1048575)+u;return T===2047?b?NaN:p*(1/0):T===0?p*5e-324*b:p*Math.pow(2,T-1075)*(b+4503599627370496)}e.readDoubleLE=n.bind(null,qn,0,4),e.readDoubleBE=n.bind(null,$n,4,0)})(),e}function Fn(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 Wn(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 qn(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function $n(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var Hn=O((exports,module)=>{"use strict";a();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 Kn=O(zn=>{"use strict";a();var Dt=zn;Dt.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};Dt.read=function(t,n,o){var i=o-n;if(i<1)return"";for(var r=null,s=[],l=0,u;n<o;)u=t[n++],u<128?s[l++]=u:u>191&&u<224?s[l++]=(u&31)<<6|t[n++]&63:u>239&&u<365?(u=((u&7)<<18|(t[n++]&63)<<12|(t[n++]&63)<<6|t[n++]&63)-65536,s[l++]=55296+(u>>10),s[l++]=56320+(u&1023)):s[l++]=(u&15)<<12|(t[n++]&63)<<6|t[n++]&63,l>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,s)),l=0);return r?(l&&r.push(String.fromCharCode.apply(String,s.slice(0,l))),r.join("")):String.fromCharCode.apply(String,s.slice(0,l))};Dt.write=function(t,n,o){for(var i=o,r,s,l=0;l<t.length;++l)r=t.charCodeAt(l),r<128?n[o++]=r:r<2048?(n[o++]=r>>6|192,n[o++]=r&63|128):(r&64512)===55296&&((s=t.charCodeAt(l+1))&64512)===56320?(r=65536+((r&1023)<<10)+(s&1023),++l,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 Qn=O((Ws,Xn)=>{"use strict";a();Xn.exports=yo;function yo(e,t,n){var o=n||8192,i=o>>>1,r=null,s=o;return function(u){if(u<1||u>i)return e(u);s+u>o&&(r=e(o),s=0);var d=t.call(r,s,s+=u);return s&7&&(s=(s|7)+1),d}}});var jn=O(($s,Yn)=>{"use strict";a();Yn.exports=k;var ht=be();function k(e,t){this.lo=e>>>0,this.hi=t>>>0}var Ze=k.zero=new k(0,0);Ze.toNumber=function(){return 0};Ze.zzEncode=Ze.zzDecode=function(){return this};Ze.length=function(){return 1};var vo=k.zeroHash="\0\0\0\0\0\0\0\0";k.fromNumber=function(t){if(t===0)return Ze;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 k(o,i)};k.from=function(t){if(typeof t=="number")return k.fromNumber(t);if(ht.isString(t))if(ht.Long)t=ht.Long.fromString(t);else return k.fromNumber(parseInt(t,10));return t.low||t.high?new k(t.low>>>0,t.high>>>0):Ze};k.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};k.prototype.toLong=function(t){return ht.Long?new ht.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var Ne=String.prototype.charCodeAt;k.fromHash=function(t){return t===vo?Ze:new k((Ne.call(t,0)|Ne.call(t,1)<<8|Ne.call(t,2)<<16|Ne.call(t,3)<<24)>>>0,(Ne.call(t,4)|Ne.call(t,5)<<8|Ne.call(t,6)<<16|Ne.call(t,7)<<24)>>>0)};k.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)};k.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};k.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};k.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 be=O(Jt=>{"use strict";a();var h=Jt;h.asPromise=An();h.base64=Mn();h.EventEmitter=Dn();h.float=Zn();h.inquire=Hn();h.utf8=Kn();h.pool=Qn();h.LongBits=jn();h.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);h.global=h.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Jt;h.emptyArray=Object.freeze?Object.freeze([]):[];h.emptyObject=Object.freeze?Object.freeze({}):{};h.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};h.isString=function(t){return typeof t=="string"||t instanceof String};h.isObject=function(t){return t&&typeof t=="object"};h.isset=h.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};h.Buffer=(function(){try{var e=h.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}})();h._Buffer_from=null;h._Buffer_allocUnsafe=null;h.newBuffer=function(t){return typeof t=="number"?h.Buffer?h._Buffer_allocUnsafe(t):new h.Array(t):h.Buffer?h._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};h.Array=typeof Uint8Array<"u"?Uint8Array:Array;h.Long=h.global.dcodeIO&&h.global.dcodeIO.Long||h.global.Long||h.inquire("long");h.key2Re=/^true|false|0|1$/;h.key32Re=/^-?(?:0|[1-9][0-9]*)$/;h.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;h.longToHash=function(t){return t?h.LongBits.from(t).toHash():h.LongBits.zeroHash};h.longFromHash=function(t,n){var o=h.LongBits.fromHash(t);return h.Long?h.Long.fromBits(o.lo,o.hi,n):o.toNumber(!!n)};function er(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}h.merge=er;h.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function tr(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&&er(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}h.newError=tr;h.ProtocolError=tr("ProtocolError");h.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]}};h.oneOfSetter=function(t){return function(n){for(var o=0;o<t.length;++o)t[o]!==n&&delete this[t[o]]}};h.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};h._configure=function(){var e=h.Buffer;if(!e){h._Buffer_from=h._Buffer_allocUnsafe=null;return}h._Buffer_from=e.from!==Uint8Array.from&&e.from||function(n,o){return new e(n,o)},h._Buffer_allocUnsafe=e.allocUnsafe||function(n){return new e(n)}}});var Ht=O((zs,or)=>{"use strict";a();or.exports=S;var H=be(),Ft,It=H.LongBits,nr=H.base64,rr=H.utf8;function mt(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function qt(){}function No(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function S(){this.len=0,this.head=new mt(qt,0,0),this.tail=this.head,this.states=null}var ir=function(){return H.Buffer?function(){return(S.create=function(){return new Ft})()}:function(){return new S}};S.create=ir();S.alloc=function(t){return new H.Array(t)};H.Array!==Array&&(S.alloc=H.pool(S.alloc,H.Array.prototype.subarray));S.prototype._push=function(t,n,o){return this.tail=this.tail.next=new mt(t,n,o),this.len+=n,this};function $t(e,t,n){t[n]=e&255}function bo(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function Gt(e,t){this.len=e,this.next=void 0,this.val=t}Gt.prototype=Object.create(mt.prototype);Gt.prototype.fn=bo;S.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Gt((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};S.prototype.int32=function(t){return t<0?this._push(Zt,10,It.fromNumber(t)):this.uint32(t)};S.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Zt(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}S.prototype.uint64=function(t){var n=It.from(t);return this._push(Zt,n.length(),n)};S.prototype.int64=S.prototype.uint64;S.prototype.sint64=function(t){var n=It.from(t).zzEncode();return this._push(Zt,n.length(),n)};S.prototype.bool=function(t){return this._push($t,1,t?1:0)};function Wt(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}S.prototype.fixed32=function(t){return this._push(Wt,4,t>>>0)};S.prototype.sfixed32=S.prototype.fixed32;S.prototype.fixed64=function(t){var n=It.from(t);return this._push(Wt,4,n.lo)._push(Wt,4,n.hi)};S.prototype.sfixed64=S.prototype.fixed64;S.prototype.float=function(t){return this._push(H.float.writeFloatLE,4,t)};S.prototype.double=function(t){return this._push(H.float.writeDoubleLE,8,t)};var To=H.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]};S.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push($t,1,0);if(H.isString(t)){var o=S.alloc(n=nr.length(t));nr.decode(t,o,0),t=o}return this.uint32(n)._push(To,n,t)};S.prototype.string=function(t){var n=rr.length(t);return n?this.uint32(n)._push(rr.write,n,t):this._push($t,1,0)};S.prototype.fork=function(){return this.states=new No(this),this.head=this.tail=new mt(qt,0,0),this.len=0,this};S.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 mt(qt,0,0),this.len=0),this};S.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};S.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};S._configure=function(e){Ft=e,S.create=ir(),Ft._configure()}});var ar=O((Xs,ur)=>{"use strict";a();ur.exports=re;var sr=Ht();(re.prototype=Object.create(sr.prototype)).constructor=re;var Te=be();function re(){sr.call(this)}re._configure=function(){re.alloc=Te._Buffer_allocUnsafe,re.writeBytesBuffer=Te.Buffer&&Te.Buffer.prototype instanceof Uint8Array&&Te.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++]}};re.prototype.bytes=function(t){Te.isString(t)&&(t=Te._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(re.writeBytesBuffer,n,t),this};function Ro(e,t,n){e.length<40?Te.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}re.prototype.string=function(t){var n=Te.Buffer.byteLength(t);return this.uint32(n),n&&this._push(Ro,n,t),this};re._configure()});var Xt=O((Ys,pr)=>{"use strict";a();pr.exports=_;var ee=be(),Kt,lr=ee.LongBits,Co=ee.utf8;function te(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 dr=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")},cr=function(){return ee.Buffer?function(n){return(_.create=function(i){return ee.Buffer.isBuffer(i)?new Kt(i):dr(i)})(n)}:dr};_.create=cr();_.prototype._slice=ee.Array.prototype.subarray||ee.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,te(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 zt(){var e=new lr(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 te(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 te(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 Ot(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 te(this,4);return Ot(this.buf,this.pos+=4)};_.prototype.sfixed32=function(){if(this.pos+4>this.len)throw te(this,4);return Ot(this.buf,this.pos+=4)|0};function fr(){if(this.pos+8>this.len)throw te(this,8);return new lr(Ot(this.buf,this.pos+=4),Ot(this.buf,this.pos+=4))}_.prototype.float=function(){if(this.pos+4>this.len)throw te(this,4);var t=ee.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};_.prototype.double=function(){if(this.pos+8>this.len)throw te(this,4);var t=ee.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 te(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(n,o);if(n===o){var i=ee.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 Co.read(t,0,t.length)};_.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw te(this,t);this.pos+=t}else do if(this.pos>=this.len)throw te(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){Kt=e,_.create=cr(),Kt._configure();var t=ee.Long?"toLong":"toNumber";ee.merge(_.prototype,{int64:function(){return zt.call(this)[t](!1)},uint64:function(){return zt.call(this)[t](!0)},sint64:function(){return zt.call(this).zzDecode()[t](!1)},fixed64:function(){return fr.call(this)[t](!0)},sfixed64:function(){return fr.call(this)[t](!1)}})}});var Sr=O((eu,gr)=>{"use strict";a();gr.exports=He;var mr=Xt();(He.prototype=Object.create(mr.prototype)).constructor=He;var hr=be();function He(e){mr.call(this,e)}He._configure=function(){hr.Buffer&&(He.prototype._slice=hr.Buffer.prototype.slice)};He.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))};He._configure()});var yr=O((nu,Er)=>{"use strict";a();Er.exports=gt;var Qt=be();(gt.prototype=Object.create(Qt.EventEmitter.prototype)).constructor=gt;function gt(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");Qt.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}gt.prototype.rpcCall=function e(t,n,o,i,r){if(!i)throw TypeError("request must be specified");var s=this;if(!r)return Qt.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(u,d){if(u)return s.emit("error",u,t),r(u);if(d===null){s.end(!0);return}if(!(d instanceof o))try{d=o[s.responseDelimited?"decodeDelimited":"decode"](d)}catch(p){return s.emit("error",p,t),r(p)}return s.emit("data",d,t),r(null,d)})}catch(l){s.emit("error",l,t),setTimeout(function(){r(l)},0);return}};gt.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Nr=O(vr=>{"use strict";a();var _o=vr;_o.Service=yr()});var Tr=O((su,br)=>{"use strict";a();br.exports={}});var _r=O(Cr=>{"use strict";a();var U=Cr;U.build="minimal";U.Writer=Ht();U.BufferWriter=ar();U.Reader=Xt();U.BufferReader=Sr();U.util=be();U.rpc=Nr();U.roots=Tr();U.configure=Rr;function Rr(){U.util._configure(),U.Writer._configure(U.BufferWriter),U.Reader._configure(U.BufferReader)}Rr()});var V=O((fu,Ir)=>{"use strict";a();Ir.exports=_r()});a();a();a();var In="clientVersion",Lt="devvit.v1.min.js",Ut="screenshot.v1.min.js",On=`https://webview.devvit.net/scripts/${Lt}`;function kn(e){if(e.currentScript&&"src"in e.currentScript)return new URL(e.currentScript.src).searchParams.get(In)??void 0}function wn(e){if(e.currentScript&&"src"in e.currentScript)return e.currentScript.src}a();a();var ot;(function(e){e[e.CLIENT_UNSPECIFIED=0]="CLIENT_UNSPECIFIED",e[e.ANDROID=1]="ANDROID",e[e.IOS=2]="IOS",e[e.SHREDDIT=3]="SHREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ot||(ot={}));var xn;(function(e){e[e.HEIGHT_UNSPECIFIED=0]="HEIGHT_UNSPECIFIED",e[e.REGULAR=1]="REGULAR",e[e.TALL=2]="TALL",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(xn||(xn={}));a();a();function Tt(e,t){if(!e)throw Error(t)}var ve;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(ve||(ve={}));function co(e){return!!e?.startsWith(ve.ACCOUNT)}function po(e){return!!e?.startsWith(ve.LINK)}function ho(e){return!!e?.startsWith(ve.SUBREDDIT)}function mo(e){Tt(co(e),`Expected account id to start with ${ve.ACCOUNT}, got ${e}`)}function go(e){Tt(po(e),`Expected link id to start with ${ve.LINK}, got ${e}`)}function So(e){Tt(ho(e),`Expected subreddit id to start with ${ve.SUBREDDIT}, got ${e}`)}function Rt(e){return mo(e),e}function Mt(e){return go(e),e}function Bt(e){return So(e),e}a();a();a();var Z;(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.EFFECT_TELEMETRY=12]="EFFECT_TELEMETRY",e[e.EFFECT_UPDATE_REQUEST_CONTEXT=13]="EFFECT_UPDATE_REQUEST_CONTEXT",e[e.EFFECT_SCREENSHOT_RESPONSE=14]="EFFECT_SCREENSHOT_RESPONSE",e[e.EFFECT_LOGIN_PROMPT=15]="EFFECT_LOGIN_PROMPT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Z||(Z={}));a();a();var pt;(function(e){e[e.CLIENT=0]="CLIENT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(pt||(pt={}));a();var C=A(V(),1);a();var F=A(V(),1);a();var c=new Map;var Ke;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ke||(Ke={}));function Io(e){switch(e){case 0:case"NULL_VALUE":return Ke.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return Ke.UNRECOGNIZED}}function Oo(e){switch(e){case Ke.NULL_VALUE:return 0;case Ke.UNRECOGNIZED:default:return-1}}function Yt(){return{fields:{}}}var z={$type:"google.protobuf.Struct",encode(e,t=F.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&St.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Yt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let s=St.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:kr(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 z.fromPartial(e??{})},fromPartial(e){let t=Yt();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),{}),t},wrap(e){let t=Yt();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(z.$type,z);function Or(){return{key:"",value:void 0}}var St={$type:"google.protobuf.Struct.FieldsEntry",encode(e,t=F.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&P.encode(P.wrap(e.value),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.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.key=n.string();continue;case 2:if(r!==18)break;i.value=P.unwrap(P.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:ut(e.key)?globalThis.String(e.key):"",value:ut(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 St.fromPartial(e??{})},fromPartial(e){let t=Or();return t.key=e.key??"",t.value=e.value??void 0,t}};c.set(St.$type,St);function jt(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var P={$type:"google.protobuf.Value",encode(e,t=F.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&&z.encode(z.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&ze.encode(ze.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=jt();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=z.unwrap(z.decode(n,n.uint32()));continue;case 6:if(r!==50)break;i.listValue=ze.unwrap(ze.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{nullValue:ut(e.nullValue)?Io(e.nullValue):void 0,numberValue:ut(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:ut(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:ut(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:kr(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=Oo(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 P.fromPartial(e??{})},fromPartial(e){let t=jt();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=jt();if(e===null)t.nullValue=Ke.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(P.$type,P);function en(){return{values:[]}}var ze={$type:"google.protobuf.ListValue",encode(e,t=F.default.Writer.create()){for(let n of e.values)P.encode(P.wrap(n),t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=en();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(P.unwrap(P.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 ze.fromPartial(e??{})},fromPartial(e){let t=en();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=en();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};c.set(ze.$type,ze);function kr(e){return typeof e=="object"&&e!==null}function ut(e){return e!=null}a();var je=A(V(),1);a();var N=A(V(),1);a();a();var K=null;try{K=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 v(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}v.prototype.__isLong__;Object.defineProperty(v.prototype,"__isLong__",{value:!0});function L(e){return(e&&e.__isLong__)===!0}function wr(e){var t=Math.clz32(e&-e);return e?31-t:t}v.isLong=L;var xr={},Vr={};function Xe(e,t){var n,o,i;return t?(e>>>=0,(i=0<=e&&e<256)&&(o=Vr[e],o)?o:(n=E(e,0,!0),i&&(Vr[e]=n),n)):(e|=0,(i=-128<=e&&e<128)&&(o=xr[e],o)?o:(n=E(e,e<0?-1:0,!1),i&&(xr[e]=n),n))}v.fromInt=Xe;function X(e,t){if(isNaN(e))return t?de:ne;if(t){if(e<0)return de;if(e>=Ur)return Dr}else{if(e<=-Pr)return M;if(e+1>=Pr)return Br}return e<0?X(-e,t).neg():E(e%dt|0,e/dt|0,t)}v.fromNumber=X;function E(e,t,n){return new v(e,t,n)}v.fromBits=E;var kt=Math.pow;function nn(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?de:ne;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 nn(e.substring(1),t,n).neg();for(var i=X(kt(n,8)),r=ne,s=0;s<e.length;s+=8){var l=Math.min(8,e.length-s),u=parseInt(e.substring(s,s+l),n);if(l<8){var d=X(kt(n,l));r=r.mul(d).add(X(u))}else r=r.mul(i),r=r.add(X(u))}return r.unsigned=t,r}v.fromString=nn;function Q(e,t){return typeof e=="number"?X(e,t):typeof e=="string"?nn(e,t):E(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}v.fromValue=Q;var Ar=65536,ko=1<<24,dt=Ar*Ar,Ur=dt*dt,Pr=Ur/2,Lr=Xe(ko),ne=Xe(0);v.ZERO=ne;var de=Xe(0,!0);v.UZERO=de;var at=Xe(1);v.ONE=at;var Mr=Xe(1,!0);v.UONE=Mr;var tn=Xe(-1);v.NEG_ONE=tn;var Br=E(-1,2147483647,!1);v.MAX_VALUE=Br;var Dr=E(-1,-1,!0);v.MAX_UNSIGNED_VALUE=Dr;var M=E(0,-2147483648,!1);v.MIN_VALUE=M;var f=v.prototype;f.toInt=function(){return this.unsigned?this.low>>>0:this.low};f.toNumber=function(){return this.unsigned?(this.high>>>0)*dt+(this.low>>>0):this.high*dt+(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(M)){var n=X(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=X(kt(t,6),this.unsigned),s=this,l="";;){var u=s.div(r),d=s.sub(u.mul(r)).toInt()>>>0,p=d.toString(t);if(s=u,s.isZero())return p+l;for(;p.length<6;)p="0"+p;l=""+p+l}};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(M)?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 L(t)||(t=Q(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(L(t)||(t=Q(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(M)?M:this.not().add(at)};f.neg=f.negate;f.add=function(t){L(t)||(t=Q(t));var n=this.high>>>16,o=this.high&65535,i=this.low>>>16,r=this.low&65535,s=t.high>>>16,l=t.high&65535,u=t.low>>>16,d=t.low&65535,p=0,T=0,b=0,J=0;return J+=r+d,b+=J>>>16,J&=65535,b+=i+u,T+=b>>>16,b&=65535,T+=o+l,p+=T>>>16,T&=65535,p+=n+s,p&=65535,E(b<<16|J,p<<16|T,this.unsigned)};f.subtract=function(t){return L(t)||(t=Q(t)),this.add(t.neg())};f.sub=f.subtract;f.multiply=function(t){if(this.isZero())return this;if(L(t)||(t=Q(t)),K){var n=K.mul(this.low,this.high,t.low,t.high);return E(n,K.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?de:ne;if(this.eq(M))return t.isOdd()?M:ne;if(t.eq(M))return this.isOdd()?M:ne;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 X(this.toNumber()*t.toNumber(),this.unsigned);var o=this.high>>>16,i=this.high&65535,r=this.low>>>16,s=this.low&65535,l=t.high>>>16,u=t.high&65535,d=t.low>>>16,p=t.low&65535,T=0,b=0,J=0,bt=0;return bt+=s*p,J+=bt>>>16,bt&=65535,J+=r*p,b+=J>>>16,J&=65535,J+=s*d,b+=J>>>16,J&=65535,b+=i*p,T+=b>>>16,b&=65535,b+=r*d,T+=b>>>16,b&=65535,b+=s*u,T+=b>>>16,b&=65535,T+=o*p+i*d+r*u+s*l,T&=65535,E(J<<16|bt,T<<16|b,this.unsigned)};f.mul=f.multiply;f.divide=function(t){if(L(t)||(t=Q(t)),t.isZero())throw Error("division by zero");if(K){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?K.div_u:K.div_s)(this.low,this.high,t.low,t.high);return E(n,K.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?de:ne;var o,i,r;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return de;if(t.gt(this.shru(1)))return Mr;r=de}else{if(this.eq(M)){if(t.eq(at)||t.eq(tn))return M;if(t.eq(M))return at;var s=this.shr(1);return o=s.div(t).shl(1),o.eq(ne)?t.isNegative()?at:tn:(i=this.sub(t.mul(o)),r=o.add(i.div(t)),r)}else if(t.eq(M))return this.unsigned?de:ne;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=ne}for(i=this;i.gte(t);){o=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var l=Math.ceil(Math.log(o)/Math.LN2),u=l<=48?1:kt(2,l-48),d=X(o),p=d.mul(t);p.isNegative()||p.gt(i);)o-=u,d=X(o,this.unsigned),p=d.mul(t);d.isZero()&&(d=at),r=r.add(d),i=i.sub(p)}return r};f.div=f.divide;f.modulo=function(t){if(L(t)||(t=Q(t)),K){var n=(this.unsigned?K.rem_u:K.rem_s)(this.low,this.high,t.low,t.high);return E(n,K.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};f.mod=f.modulo;f.rem=f.modulo;f.not=function(){return E(~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?wr(this.low):wr(this.high)+32};f.ctz=f.countTrailingZeros;f.and=function(t){return L(t)||(t=Q(t)),E(this.low&t.low,this.high&t.high,this.unsigned)};f.or=function(t){return L(t)||(t=Q(t)),E(this.low|t.low,this.high|t.high,this.unsigned)};f.xor=function(t){return L(t)||(t=Q(t)),E(this.low^t.low,this.high^t.high,this.unsigned)};f.shiftLeft=function(t){return L(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?E(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):E(0,this.low<<t-32,this.unsigned)};f.shl=f.shiftLeft;f.shiftRight=function(t){return L(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?E(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):E(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};f.shr=f.shiftRight;f.shiftRightUnsigned=function(t){return L(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?E(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?E(this.high,0,this.unsigned):E(this.high>>>t-32,0,this.unsigned)};f.shru=f.shiftRightUnsigned;f.shr_u=f.shiftRightUnsigned;f.rotateLeft=function(t){var n;return L(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?E(this.high,this.low,this.unsigned):t<32?(n=32-t,E(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,E(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 L(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?E(this.high,this.low,this.unsigned):t<32?(n=32-t,E(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,E(this.low<<n|this.high>>>t,this.high<<n|this.low>>>t,this.unsigned))};f.rotr=f.rotateRight;f.toSigned=function(){return this.unsigned?E(this.low,this.high,!1):this};f.toUnsigned=function(){return this.unsigned?this:E(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]};v.fromBytes=function(t,n,o){return o?v.fromBytesLE(t,n):v.fromBytesBE(t,n)};v.fromBytesLE=function(t,n){return new v(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};v.fromBytesBE=function(t,n){return new v(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"&&(v.fromBigInt=function(t,n){var o=Number(BigInt.asIntN(32,t)),i=Number(BigInt.asIntN(32,t>>BigInt(32)));return E(o,i,n)},v.fromValue=function(t,n){return typeof t=="bigint"?v.fromBigInt(t,n):Q(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 rn=v;var Qe=A(V(),1);function Jr(){return{seconds:0,nanos:0}}var Ye={$type:"google.protobuf.Timestamp",encode(e,t=Qe.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 Qe.default.Reader?e:Qe.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=wo(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:Fr(e.seconds)?globalThis.Number(e.seconds):0,nanos:Fr(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 Ye.fromPartial(e??{})},fromPartial(e){let t=Jr();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}};c.set(Ye.$type,Ye);function wo(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}Qe.default.util.Long!==rn&&(Qe.default.util.Long=rn,Qe.default.configure());function Fr(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 ln(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 cn(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 Y;(function(e){e[e.SCOPE_UNKNOWN=0]="SCOPE_UNKNOWN",e[e.SUBMIT_POST=1]="SUBMIT_POST",e[e.SUBMIT_COMMENT=2]="SUBMIT_COMMENT",e[e.SUBSCRIBE_TO_SUBREDDIT=3]="SUBSCRIBE_TO_SUBREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Y||(Y={}));function Qr(e){switch(e){case 0:case"SCOPE_UNKNOWN":return Y.SCOPE_UNKNOWN;case 1:case"SUBMIT_POST":return Y.SUBMIT_POST;case 2:case"SUBMIT_COMMENT":return Y.SUBMIT_COMMENT;case 3:case"SUBSCRIBE_TO_SUBREDDIT":return Y.SUBSCRIBE_TO_SUBREDDIT;case-1:case"UNRECOGNIZED":default:return Y.UNRECOGNIZED}}function Yr(e){switch(e){case Y.SCOPE_UNKNOWN:return 0;case Y.SUBMIT_POST:return 1;case Y.SUBMIT_COMMENT:return 2;case Y.SUBSCRIBE_TO_SUBREDDIT:return 3;case Y.UNRECOGNIZED:default:return-1}}function Wr(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}var Re={$type:"reddit.devvit.app_permission.v1.AppPermission",encode(e,t=N.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&&Ye.encode(xo(e.updatedAt),t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof N.default.Reader?e:N.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Wr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appSlug=n.string();continue;case 2:if(r!==18)break;i.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=jr(Ye.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:w(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:w(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>Qr(t)):[],consentStatus:w(e.consentStatus)?ln(e.consentStatus):0,updatedAt:w(e.updatedAt)?Vo(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=>Yr(n))),e.consentStatus!==0&&(t.consentStatus=cn(e.consentStatus)),e.updatedAt!==void 0&&(t.updatedAt=e.updatedAt.toISOString()),t},create(e){return Re.fromPartial(e??{})},fromPartial(e){let t=Wr();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 qr(){return{appSlug:"",appName:"",termsAndConditions:void 0,privacyPolicy:void 0}}var Ce={$type:"reddit.devvit.app_permission.v1.DevvitApp",encode(e,t=N.default.Writer.create()){return e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.appName!==""&&t.uint32(18).string(e.appName),e.termsAndConditions!==void 0&&t.uint32(26).string(e.termsAndConditions),e.privacyPolicy!==void 0&&t.uint32(34).string(e.privacyPolicy),t},decode(e,t){let n=e instanceof N.default.Reader?e:N.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.appSlug=n.string();continue;case 2:if(r!==18)break;i.appName=n.string();continue;case 3:if(r!==26)break;i.termsAndConditions=n.string();continue;case 4:if(r!==34)break;i.privacyPolicy=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:w(e.appSlug)?globalThis.String(e.appSlug):"",appName:w(e.appName)?globalThis.String(e.appName):"",termsAndConditions:w(e.termsAndConditions)?globalThis.String(e.termsAndConditions):void 0,privacyPolicy:w(e.privacyPolicy)?globalThis.String(e.privacyPolicy):void 0}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.appName!==""&&(t.appName=e.appName),e.termsAndConditions!==void 0&&(t.termsAndConditions=e.termsAndConditions),e.privacyPolicy!==void 0&&(t.privacyPolicy=e.privacyPolicy),t},create(e){return Ce.fromPartial(e??{})},fromPartial(e){let t=qr();return t.appSlug=e.appSlug??"",t.appName=e.appName??"",t.termsAndConditions=e.termsAndConditions??void 0,t.privacyPolicy=e.privacyPolicy??void 0,t}};c.set(Ce.$type,Ce);function $r(){return{userId:""}}var on={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdRequest",encode(e,t=N.default.Writer.create()){return e.userId!==""&&t.uint32(10).string(e.userId),t},decode(e,t){let n=e instanceof N.default.Reader?e:N.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.userId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{userId:w(e.userId)?globalThis.String(e.userId):""}},toJSON(e){let t={};return e.userId!==""&&(t.userId=e.userId),t},create(e){return on.fromPartial(e??{})},fromPartial(e){let t=$r();return t.userId=e.userId??"",t}};c.set(on.$type,on);function Gr(){return{appPermissions:[],devvitApps:[]}}var sn={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,t=N.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 N.default.Reader?e:N.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Gr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appPermissions.push(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 sn.fromPartial(e??{})},fromPartial(e){let t=Gr();return t.appPermissions=e.appPermissions?.map(n=>Re.fromPartial(n))||[],t.devvitApps=e.devvitApps?.map(n=>Ce.fromPartial(n))||[],t}};c.set(sn.$type,sn);function Zr(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}var un={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionRequest",encode(e,t=N.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 N.default.Reader?e:N.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.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:w(e.userId)?globalThis.String(e.userId):"",appSlug:w(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:w(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=>Yr(n))),t},create(e){return un.fromPartial(e??{})},fromPartial(e){let t=Zr();return t.userId=e.userId??"",t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t}};c.set(un.$type,un);function Hr(){return{error:void 0}}var an={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode(e,t=N.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 N.default.Reader?e:N.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.error=W.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:w(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 an.fromPartial(e??{})},fromPartial(e){let t=Hr();return t.error=e.error!==void 0&&e.error!==null?W.fromPartial(e.error):void 0,t}};c.set(an.$type,an);function zr(){return{appSlug:"",userId:"",subredditId:""}}var dn={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionRequest",encode(e,t=N.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 N.default.Reader?e:N.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.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:w(e.appSlug)?globalThis.String(e.appSlug):"",userId:w(e.userId)?globalThis.String(e.userId):"",subredditId:w(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 dn.fromPartial(e??{})},fromPartial(e){let t=zr();return t.appSlug=e.appSlug??"",t.userId=e.userId??"",t.subredditId=e.subredditId??"",t}};c.set(dn.$type,dn);function Kr(){return{error:void 0}}var fn={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode(e,t=N.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 N.default.Reader?e:N.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.error=W.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:w(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 fn.fromPartial(e??{})},fromPartial(e){let t=Kr();return t.error=e.error!==void 0&&e.error!==null?W.fromPartial(e.error):void 0,t}};c.set(fn.$type,fn);function Xr(){return{message:""}}var W={$type:"reddit.devvit.app_permission.v1.ErrorMessage",encode(e,t=N.default.Writer.create()){return e.message!==""&&t.uint32(10).string(e.message),t},decode(e,t){let n=e instanceof N.default.Reader?e:N.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.message=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{message:w(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=Xr();return t.message=e.message??"",t}};c.set(W.$type,W);function xo(e){let t=Math.trunc(e.getTime()/1e3),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function jr(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function Vo(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):jr(Ye.fromJSON(e))}function w(e){return e!=null}function ei(){return{postId:void 0,appSlug:void 0,subredditId:void 0}}var pn={$type:"devvit.ui.effect_types.v1alpha.CanRunAsUserEffect",encode(e,t=je.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 je.default.Reader?e:je.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ei();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.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:wt(e.postId)?globalThis.String(e.postId):void 0,appSlug:wt(e.appSlug)?globalThis.String(e.appSlug):void 0,subredditId:wt(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 pn.fromPartial(e??{})},fromPartial(e){let t=ei();return t.postId=e.postId??void 0,t.appSlug=e.appSlug??void 0,t.subredditId=e.subredditId??void 0,t}};c.set(pn.$type,pn);function ti(){return{consentStatus:0}}var fe={$type:"devvit.ui.effect_types.v1alpha.ConsentStatusEvent",encode(e,t=je.default.Writer.create()){return e.consentStatus!==0&&t.uint32(8).int32(e.consentStatus),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=ti();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:wt(e.consentStatus)?ln(e.consentStatus):0}},toJSON(e){let t={};return e.consentStatus!==0&&(t.consentStatus=cn(e.consentStatus)),t},create(e){return fe.fromPartial(e??{})},fromPartial(e){let t=ti();return t.consentStatus=e.consentStatus??0,t}};c.set(fe.$type,fe);function wt(e){return e!=null}a();var se=A(V(),1);var oe;(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"})(oe||(oe={}));function Ao(e){switch(e){case 0:case"STATUS_CANCELLED":return oe.STATUS_CANCELLED;case 1:case"STATUS_SUCCESS":return oe.STATUS_SUCCESS;case 2:case"STATUS_ERROR":return oe.STATUS_ERROR;case-1:case"UNRECOGNIZED":default:return oe.UNRECOGNIZED}}function Po(e){switch(e){case oe.STATUS_CANCELLED:return 0;case oe.STATUS_SUCCESS:return 1;case oe.STATUS_ERROR:return 2;case oe.UNRECOGNIZED:default:return-1}}function ni(){return{id:"",skus:[],metadata:{}}}var _e={$type:"devvit.ui.effect_types.v1alpha.CreateOrderEffect",encode(e,t=se.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])=>{Et.encode({key:n,value:o},t.uint32(26).fork()).ldelim()}),t},decode(e,t){let n=e instanceof se.default.Reader?e:se.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.id=n.string();continue;case 2:if(r!==18)break;i.skus.push(n.string());continue;case 3:if(r!==26)break;let s=Et.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:Ie(e.id)?globalThis.String(e.id):"",skus:globalThis.Array.isArray(e?.skus)?e.skus.map(t=>globalThis.String(t)):[],metadata:Lo(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 _e.fromPartial(e??{})},fromPartial(e){let t=ni();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(_e.$type,_e);function ri(){return{key:"",value:""}}var Et={$type:"devvit.ui.effect_types.v1alpha.CreateOrderEffect.MetadataEntry",encode(e,t=se.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 se.default.Reader?e:se.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ri();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.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:Ie(e.key)?globalThis.String(e.key):"",value:Ie(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 Et.fromPartial(e??{})},fromPartial(e){let t=ri();return t.key=e.key??"",t.value=e.value??"",t}};c.set(Et.$type,Et);function ii(){return{errorMessage:void 0,orderId:void 0,order:void 0,status:0,errorCode:void 0}}var le={$type:"devvit.ui.effect_types.v1alpha.OrderResultEvent",encode(e,t=se.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&&_e.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 se.default.Reader?e:se.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 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=_e.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:Ie(e.errorMessage)?globalThis.String(e.errorMessage):void 0,orderId:Ie(e.orderId)?globalThis.String(e.orderId):void 0,order:Ie(e.order)?_e.fromJSON(e.order):void 0,status:Ie(e.status)?Ao(e.status):0,errorCode:Ie(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=_e.toJSON(e.order)),e.status!==0&&(t.status=Po(e.status)),e.errorCode!==void 0&&(t.errorCode=Math.round(e.errorCode)),t},create(e){return le.fromPartial(e??{})},fromPartial(e){let t=ii();return t.errorMessage=e.errorMessage??void 0,t.orderId=e.orderId??void 0,t.order=e.order!==void 0&&e.order!==null?_e.fromPartial(e.order):void 0,t.status=e.status??0,t.errorCode=e.errorCode??void 0,t}};c.set(le.$type,le);function Lo(e){return typeof e=="object"&&e!==null}function Ie(e){return e!=null}a();var G=A(V(),1);a();var xt=A(V(),1);a();var y=A(V(),1);a();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 ft(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 lt(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}}a();var q=A(V(),1);function oi(){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 R={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,t=q.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&&Oe.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&ke.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&we.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof q.default.Reader?e:q.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.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=Oe.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionValue=ke.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupValue=we.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldType:ce(e.fieldType)?ft(e.fieldType):0,isSecret:ce(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:ce(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:ce(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:ce(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:ce(e.listValue)?Oe.fromJSON(e.listValue):void 0,selectionValue:ce(e.selectionValue)?ke.fromJSON(e.selectionValue):void 0,groupValue:ce(e.groupValue)?we.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=lt(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=Oe.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=ke.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=we.toJSON(e.groupValue)),t},create(e){return R.fromPartial(e??{})},fromPartial(e){let t=oi();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?Oe.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?ke.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?we.fromPartial(e.groupValue):void 0,t}};c.set(R.$type,R);function si(){return{itemType:0,items:[]}}var Oe={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=q.default.Writer.create()){e.itemType!==0&&t.uint32(8).int32(e.itemType);for(let n of e.items)R.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof q.default.Reader?e:q.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!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.items.push(R.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:ce(e.itemType)?ft(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(t=>R.fromJSON(t)):[]}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=lt(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>R.toJSON(n))),t},create(e){return Oe.fromPartial(e??{})},fromPartial(e){let t=si();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>R.fromPartial(n))||[],t}};c.set(Oe.$type,Oe);function ui(){return{values:[]}}var ke={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=q.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof q.default.Reader?e:q.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.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 ke.fromPartial(e??{})},fromPartial(e){let t=ui();return t.values=e.values?.map(n=>n)||[],t}};c.set(ke.$type,ke);function ai(){return{}}var we={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=q.default.Writer.create()){return t},decode(e,t){let n=e instanceof q.default.Reader?e:q.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ai();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 we.fromPartial(e??{})},fromPartial(e){return ai()}};c.set(we.$type,we);function ce(e){return e!=null}function di(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var B={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,t=y.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&&R.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&&$.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 y.default.Reader?e:y.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=di();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.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=R.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=$.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:g(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:g(e.fieldType)?ft(e.fieldType):0,label:g(e.label)?globalThis.String(e.label):"",helpText:g(e.helpText)?globalThis.String(e.helpText):void 0,defaultValue:g(e.defaultValue)?R.fromJSON(e.defaultValue):void 0,required:g(e.required)?globalThis.Boolean(e.required):void 0,disabled:g(e.disabled)?globalThis.Boolean(e.disabled):void 0,fieldConfig:g(e.fieldConfig)?$.fromJSON(e.fieldConfig):void 0,isSecret:g(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let t={};return e.fieldId!==""&&(t.fieldId=e.fieldId),e.fieldType!==0&&(t.fieldType=lt(e.fieldType)),e.label!==""&&(t.label=e.label),e.helpText!==void 0&&(t.helpText=e.helpText),e.defaultValue!==void 0&&(t.defaultValue=R.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=$.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return B.fromPartial(e??{})},fromPartial(e){let t=di();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?R.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?$.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};c.set(B.$type,B);function fi(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var $={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=y.default.Writer.create()){return e.stringConfig!==void 0&&xe.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&&Ae.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&Pe.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&Le.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&Ue.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&Be.encode(e.groupConfig,t.uint32(58).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=fi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.stringConfig=xe.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=Ae.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.booleanConfig=Pe.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.listConfig=Le.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionConfig=Ue.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupConfig=Be.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{stringConfig:g(e.stringConfig)?xe.fromJSON(e.stringConfig):void 0,paragraphConfig:g(e.paragraphConfig)?Ve.fromJSON(e.paragraphConfig):void 0,numberConfig:g(e.numberConfig)?Ae.fromJSON(e.numberConfig):void 0,booleanConfig:g(e.booleanConfig)?Pe.fromJSON(e.booleanConfig):void 0,listConfig:g(e.listConfig)?Le.fromJSON(e.listConfig):void 0,selectionConfig:g(e.selectionConfig)?Ue.fromJSON(e.selectionConfig):void 0,groupConfig:g(e.groupConfig)?Be.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=xe.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=Ve.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=Ae.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=Pe.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=Le.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=Ue.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=Be.toJSON(e.groupConfig)),t},create(e){return $.fromPartial(e??{})},fromPartial(e){let t=fi();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?xe.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?Ae.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?Pe.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?Le.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?Ue.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?Be.fromPartial(e.groupConfig):void 0,t}};c.set($.$type,$);function li(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var xe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.String",encode(e,t=y.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 y.default.Reader?e:y.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=li();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.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:g(e.minLength)?globalThis.Number(e.minLength):void 0,maxLength:g(e.maxLength)?globalThis.Number(e.maxLength):void 0,placeholder:g(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 xe.fromPartial(e??{})},fromPartial(e){let t=li();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(xe.$type,xe);function ci(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var Ve={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Paragraph",encode(e,t=y.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 y.default.Reader?e:y.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.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:g(e.maxCharacters)?globalThis.Number(e.maxCharacters):void 0,lineHeight:g(e.lineHeight)?globalThis.Number(e.lineHeight):void 0,placeholder:g(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=ci();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 pi(){return{step:void 0,min:void 0,max:void 0}}var Ae={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Number",encode(e,t=y.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 y.default.Reader?e:y.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!==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:g(e.step)?globalThis.Number(e.step):void 0,min:g(e.min)?globalThis.Number(e.min):void 0,max:g(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 Ae.fromPartial(e??{})},fromPartial(e){let t=pi();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};c.set(Ae.$type,Ae);function hi(){return{}}var Pe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Boolean",encode(e,t=y.default.Writer.create()){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=hi();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 Pe.fromPartial(e??{})},fromPartial(e){return hi()}};c.set(Pe.$type,Pe);function mi(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var Le={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.List",encode(e,t=y.default.Writer.create()){return e.itemType!==0&&t.uint32(8).int32(e.itemType),e.itemConfig!==void 0&&$.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 y.default.Reader?e:y.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!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.itemConfig=$.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:g(e.itemType)?ft(e.itemType):0,itemConfig:g(e.itemConfig)?$.fromJSON(e.itemConfig):void 0,minEntries:g(e.minEntries)?globalThis.Number(e.minEntries):void 0,maxEntries:g(e.maxEntries)?globalThis.Number(e.maxEntries):void 0,entryLabel:g(e.entryLabel)?globalThis.String(e.entryLabel):void 0}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=lt(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=$.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 Le.fromPartial(e??{})},fromPartial(e){let t=mi();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?$.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(Le.$type,Le);function gi(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var Ue={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=y.default.Writer.create()){for(let n of e.choices)Me.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 y.default.Reader?e:y.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.choices.push(Me.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=>Me.fromJSON(t)):[],multiSelect:g(e.multiSelect)?globalThis.Boolean(e.multiSelect):void 0,minSelections:g(e.minSelections)?globalThis.Number(e.minSelections):void 0,maxSelections:g(e.maxSelections)?globalThis.Number(e.maxSelections):void 0,renderAsList:g(e.renderAsList)?globalThis.Boolean(e.renderAsList):void 0}},toJSON(e){let t={};return e.choices?.length&&(t.choices=e.choices.map(n=>Me.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 Ue.fromPartial(e??{})},fromPartial(e){let t=gi();return t.choices=e.choices?.map(n=>Me.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(Ue.$type,Ue);function Si(){return{label:"",value:""}}var Me={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection.Item",encode(e,t=y.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 y.default.Reader?e:y.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.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:g(e.label)?globalThis.String(e.label):"",value:g(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 Me.fromPartial(e??{})},fromPartial(e){let t=Si();return t.label=e.label??"",t.value=e.value??"",t}};c.set(Me.$type,Me);function Ei(){return{fields:[]}}var Be={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,t=y.default.Writer.create()){for(let n of e.fields)B.encode(n,t.uint32(10).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=Ei();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(B.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=>B.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>B.toJSON(n))),t},create(e){return Be.fromPartial(e??{})},fromPartial(e){let t=Ei();return t.fields=e.fields?.map(n=>B.fromPartial(n))||[],t}};c.set(Be.$type,Be);function g(e){return e!=null}function yi(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var pe={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=xt.default.Writer.create()){for(let n of e.fields)B.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 xt.default.Reader?e:xt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=yi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(B.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=>B.fromJSON(t)):[],title:yt(e.title)?globalThis.String(e.title):void 0,shortDescription:yt(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:yt(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:yt(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:yt(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>B.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 pe.fromPartial(e??{})},fromPartial(e){let t=yi();return t.fields=e.fields?.map(n=>B.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(pe.$type,pe);function yt(e){return e!=null}function vi(){return{form:void 0}}var hn={$type:"devvit.ui.effect_types.v1alpha.ShowFormEffect",encode(e,t=G.default.Writer.create()){return e.form!==void 0&&pe.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof G.default.Reader?e:G.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=vi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.form=pe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{form:Nt(e.form)?pe.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=pe.toJSON(e.form)),t},create(e){return hn.fromPartial(e??{})},fromPartial(e){let t=vi();return t.form=e.form!==void 0&&e.form!==null?pe.fromPartial(e.form):void 0,t}};c.set(hn.$type,hn);function Ni(){return{results:{},formId:void 0}}var he={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent",encode(e,t=G.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{vt.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 G.default.Reader?e:G.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;let s=vt.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:Uo(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=R.fromJSON(o),t),{}):{},formId:Nt(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]=R.toJSON(i)}))}return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return he.fromPartial(e??{})},fromPartial(e){let t=Ni();return t.results=Object.entries(e.results??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=R.fromPartial(i)),n),{}),t.formId=e.formId??void 0,t}};c.set(he.$type,he);function bi(){return{key:"",value:void 0}}var vt={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=G.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&R.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof G.default.Reader?e:G.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=bi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=R.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:Nt(e.key)?globalThis.String(e.key):"",value:Nt(e.value)?R.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=R.toJSON(e.value)),t},create(e){return vt.fromPartial(e??{})},fromPartial(e){let t=bi();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?R.fromPartial(e.value):void 0,t}};c.set(vt.$type,vt);function Ti(){return{formId:void 0}}var me={$type:"devvit.ui.effect_types.v1alpha.FormCanceledEvent",encode(e,t=G.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof G.default.Reader?e:G.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.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{formId:Nt(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 me.fromPartial(e??{})},fromPartial(e){let t=Ti();return t.formId=e.formId??void 0,t}};c.set(me.$type,me);function Uo(e){return typeof e=="object"&&e!==null}function Nt(e){return e!=null}a();var et=A(V(),1);function Ri(){return{}}var mn={$type:"devvit.ui.effect_types.v1alpha.UpdateRequestContextEffect",encode(e,t=et.default.Writer.create()){return 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=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 mn.fromPartial(e??{})},fromPartial(e){return Ri()}};c.set(mn.$type,mn);function Ci(){return{signedRequestContext:""}}var ge={$type:"devvit.ui.effect_types.v1alpha.UpdateRequestContextEvent",encode(e,t=et.default.Writer.create()){return e.signedRequestContext!==""&&t.uint32(10).string(e.signedRequestContext),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=Ci();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.signedRequestContext=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{signedRequestContext:Mo(e.signedRequestContext)?globalThis.String(e.signedRequestContext):""}},toJSON(e){let t={};return e.signedRequestContext!==""&&(t.signedRequestContext=e.signedRequestContext),t},create(e){return ge.fromPartial(e??{})},fromPartial(e){let t=Ci();return t.signedRequestContext=e.signedRequestContext??"",t}};c.set(ge.$type,ge);function Mo(e){return e!=null}a();var nt=A(V(),1);a();var tt=A(V(),1);a();var Vt=A(V(),1);function _i(){return{}}var At={$type:"google.protobuf.Empty",encode(e,t=Vt.default.Writer.create()){return t},decode(e,t){let n=e instanceof Vt.default.Reader?e:Vt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=_i();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 At.fromPartial(e??{})},fromPartial(e){return _i()}};c.set(At.$type,At);function Ii(){return{channels:[]}}var gn={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=tt.default.Writer.create()){for(let n of e.channels)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof tt.default.Reader?e:tt.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 gn.fromPartial(e??{})},fromPartial(e){let t=Ii();return t.channels=e.channels?.map(n=>n)||[],t}};c.set(gn.$type,gn);function Oi(){return{channel:"",data:void 0}}var Se={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=tt.default.Writer.create()){return e.channel!==""&&t.uint32(10).string(e.channel),e.data!==void 0&&z.encode(z.wrap(e.data),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof tt.default.Reader?e:tt.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=z.unwrap(z.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channel:Do(e.channel)?globalThis.String(e.channel):"",data:Bo(e.data)?e.data:void 0}},toJSON(e){let t={};return e.channel!==""&&(t.channel=e.channel),e.data!==void 0&&(t.data=e.data),t},create(e){return Se.fromPartial(e??{})},fromPartial(e){let t=Oi();return t.channel=e.channel??"",t.data=e.data??void 0,t}};c.set(Se.$type,Se);function Bo(e){return typeof e=="object"&&e!==null}function Do(e){return e!=null}var De;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(De||(De={}));function Jo(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return De.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return De.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return De.UNRECOGNIZED}}function Fo(e){switch(e){case De.REALTIME_SUBSCRIBED:return 0;case De.REALTIME_UNSUBSCRIBED:return 1;case De.UNRECOGNIZED:default:return-1}}function ki(){return{subscriptionIds:[]}}var Sn={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=nt.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);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=ki();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 Sn.fromPartial(e??{})},fromPartial(e){let t=ki();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};c.set(Sn.$type,Sn);function wi(){return{event:void 0,status:void 0}}var Ee={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=nt.default.Writer.create()){return e.event!==void 0&&Se.encode(e.event,t.uint32(10).fork()).ldelim(),e.status!==void 0&&t.uint32(16).int32(e.status),t},decode(e,t){let n=e instanceof nt.default.Reader?e:nt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=wi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.event=Se.decode(n,n.uint32());continue;case 2:if(r!==16)break;i.status=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{event:xi(e.event)?Se.fromJSON(e.event):void 0,status:xi(e.status)?Jo(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=Se.toJSON(e.event)),e.status!==void 0&&(t.status=Fo(e.status)),t},create(e){return Ee.fromPartial(e??{})},fromPartial(e){let t=wi();return t.event=e.event!==void 0&&e.event!==null?Se.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};c.set(Ee.$type,Ee);function xi(e){return e!=null}a();var Pt=A(V(),1);var ue;(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"})(ue||(ue={}));function yn(e){switch(e){case 0:case"UNSPECIFIED":return ue.UNSPECIFIED;case 1:case"INLINE_MODE":return ue.INLINE_MODE;case 2:case"IMMERSIVE_MODE":return ue.IMMERSIVE_MODE;case-1:case"UNRECOGNIZED":default:return ue.UNRECOGNIZED}}function vn(e){switch(e){case ue.UNSPECIFIED:return 0;case ue.INLINE_MODE:return 1;case ue.IMMERSIVE_MODE:return 2;case ue.UNRECOGNIZED:default:return-1}}function Vi(){return{immersiveMode:0,entryUrl:void 0}}var En={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,t=Pt.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 Pt.default.Reader?e:Pt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Vi();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:Ai(e.immersiveMode)?yn(e.immersiveMode):0,entryUrl:Ai(e.entryUrl)?globalThis.String(e.entryUrl):void 0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=vn(e.immersiveMode)),e.entryUrl!==void 0&&(t.entryUrl=e.entryUrl),t},create(e){return En.fromPartial(e??{})},fromPartial(e){let t=Vi();return t.immersiveMode=e.immersiveMode??0,t.entryUrl=e.entryUrl??void 0,t}};c.set(En.$type,En);function Ai(e){return e!=null}a();var rt=A(V(),1);function Pi(){return{}}var ye={$type:"devvit.ui.effects.web_view.v1alpha.WebViewScreenshotRequestEvent",encode(e,t=rt.default.Writer.create()){return t},decode(e,t){let n=e instanceof rt.default.Reader?e:rt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Pi();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 ye.fromPartial(e??{})},fromPartial(e){return Pi()}};c.set(ye.$type,ye);function Li(){return{dataUrl:void 0,error:void 0}}var Nn={$type:"devvit.ui.effects.web_view.v1alpha.WebViewScreenshotResponseEffect",encode(e,t=rt.default.Writer.create()){return e.dataUrl!==void 0&&t.uint32(10).string(e.dataUrl),e.error!==void 0&&t.uint32(18).string(e.error),t},decode(e,t){let n=e instanceof rt.default.Reader?e:rt.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.dataUrl=n.string();continue;case 2:if(r!==18)break;i.error=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{dataUrl:Ui(e.dataUrl)?globalThis.String(e.dataUrl):void 0,error:Ui(e.error)?globalThis.String(e.error):void 0}},toJSON(e){let t={};return e.dataUrl!==void 0&&(t.dataUrl=e.dataUrl),e.error!==void 0&&(t.error=e.error),t},create(e){return Nn.fromPartial(e??{})},fromPartial(e){let t=Li();return t.dataUrl=e.dataUrl??void 0,t.error=e.error??void 0,t}};c.set(Nn.$type,Nn);function Ui(e){return e!=null}var $e;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})($e||($e={}));function Wo(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return $e.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return $e.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return $e.UNRECOGNIZED}}function qo(e){switch(e){case $e.WEBVIEW_VISIBLE:return 0;case $e.WEBVIEW_HIDDEN:return 1;case $e.UNRECOGNIZED:default:return-1}}function Mi(){return{message:void 0,jsonString:""}}var Je={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=C.default.Writer.create()){return e.message!==void 0&&P.encode(P.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.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.message=P.unwrap(P.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:x(e?.message)?e.message:void 0,jsonString:x(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 Je.fromPartial(e??{})},fromPartial(e){let t=Mi();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};c.set(Je.$type,Je);function Bi(){return{visibility:0}}var Fe={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=C.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Bi();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:x(e.visibility)?Wo(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=qo(e.visibility)),t},create(e){return Fe.fromPartial(e??{})},fromPartial(e){let t=Bi();return t.visibility=e.visibility??0,t}};c.set(Fe.$type,Fe);function Di(){return{postMessage:void 0,fullScreen:void 0}}var bn={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=C.default.Writer.create()){return e.postMessage!==void 0&&Je.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&Fe.encode(e.fullScreen,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Di();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postMessage=Je.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.fullScreen=Fe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{postMessage:x(e.postMessage)?Je.fromJSON(e.postMessage):void 0,fullScreen:x(e.fullScreen)?Fe.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=Je.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=Fe.toJSON(e.fullScreen)),t},create(e){return bn.fromPartial(e??{})},fromPartial(e){let t=Di();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?Je.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?Fe.fromPartial(e.fullScreen):void 0,t}};c.set(bn.$type,bn);function Ji(){return{immersiveMode:0}}var We={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode(e,t=C.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ji();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:x(e.immersiveMode)?yn(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=vn(e.immersiveMode)),t},create(e){return We.fromPartial(e??{})},fromPartial(e){let t=Ji();return t.immersiveMode=e.immersiveMode??0,t}};c.set(We.$type,We);function Fi(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,consentStatus:void 0,orderResult:void 0,updateRequestContext:void 0,screenshotRequest:void 0}}var ae={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=C.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&me.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&he.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&Ee.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&We.encode(e.immersiveModeEvent,t.uint32(42).fork()).ldelim(),e.consentStatus!==void 0&&fe.encode(e.consentStatus,t.uint32(58).fork()).ldelim(),e.orderResult!==void 0&&le.encode(e.orderResult,t.uint32(66).fork()).ldelim(),e.updateRequestContext!==void 0&&ge.encode(e.updateRequestContext,t.uint32(74).fork()).ldelim(),e.screenshotRequest!==void 0&&ye.encode(e.screenshotRequest,t.uint32(82).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Fi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.id=n.string();continue;case 2:if(r!==18)break;i.formCanceled=me.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.formSubmitted=he.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.realtimeEvent=Ee.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.immersiveModeEvent=We.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.consentStatus=fe.decode(n,n.uint32());continue;case 8:if(r!==66)break;i.orderResult=le.decode(n,n.uint32());continue;case 9:if(r!==74)break;i.updateRequestContext=ge.decode(n,n.uint32());continue;case 10:if(r!==82)break;i.screenshotRequest=ye.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{id:x(e.id)?globalThis.String(e.id):"",formCanceled:x(e.formCanceled)?me.fromJSON(e.formCanceled):void 0,formSubmitted:x(e.formSubmitted)?he.fromJSON(e.formSubmitted):void 0,realtimeEvent:x(e.realtimeEvent)?Ee.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:x(e.immersiveModeEvent)?We.fromJSON(e.immersiveModeEvent):void 0,consentStatus:x(e.consentStatus)?fe.fromJSON(e.consentStatus):void 0,orderResult:x(e.orderResult)?le.fromJSON(e.orderResult):void 0,updateRequestContext:x(e.updateRequestContext)?ge.fromJSON(e.updateRequestContext):void 0,screenshotRequest:x(e.screenshotRequest)?ye.fromJSON(e.screenshotRequest):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=me.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=he.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=Ee.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(t.immersiveModeEvent=We.toJSON(e.immersiveModeEvent)),e.consentStatus!==void 0&&(t.consentStatus=fe.toJSON(e.consentStatus)),e.orderResult!==void 0&&(t.orderResult=le.toJSON(e.orderResult)),e.updateRequestContext!==void 0&&(t.updateRequestContext=ge.toJSON(e.updateRequestContext)),e.screenshotRequest!==void 0&&(t.screenshotRequest=ye.toJSON(e.screenshotRequest)),t},create(e){return ae.fromPartial(e??{})},fromPartial(e){let t=Fi();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?me.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?he.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?Ee.fromPartial(e.realtimeEvent):void 0,t.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?We.fromPartial(e.immersiveModeEvent):void 0,t.consentStatus=e.consentStatus!==void 0&&e.consentStatus!==null?fe.fromPartial(e.consentStatus):void 0,t.orderResult=e.orderResult!==void 0&&e.orderResult!==null?le.fromPartial(e.orderResult):void 0,t.updateRequestContext=e.updateRequestContext!==void 0&&e.updateRequestContext!==null?ge.fromPartial(e.updateRequestContext):void 0,t.screenshotRequest=e.screenshotRequest!==void 0&&e.screenshotRequest!==null?ye.fromPartial(e.screenshotRequest):void 0,t}};c.set(ae.$type,ae);function Wi(){return{data:void 0}}var Tn={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent",encode(e,t=C.default.Writer.create()){return e.data!==void 0&&qe.encode(e.data,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Wi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.data=qe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{data:x(e.data)?qe.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.data!==void 0&&(t.data=qe.toJSON(e.data)),t},create(e){return Tn.fromPartial(e??{})},fromPartial(e){let t=Wi();return t.data=e.data!==void 0&&e.data!==null?qe.fromPartial(e.data):void 0,t}};c.set(Tn.$type,Tn);function qi(){return{type:"",data:void 0}}var qe={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent.MessageData",encode(e,t=C.default.Writer.create()){return e.type!==""&&t.uint32(10).string(e.type),e.data!==void 0&&ae.encode(e.data,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=qi();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=ae.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{type:x(e.type)?globalThis.String(e.type):"",data:x(e.data)?ae.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.type!==""&&(t.type=e.type),e.data!==void 0&&(t.data=ae.toJSON(e.data)),t},create(e){return qe.fromPartial(e??{})},fromPartial(e){let t=qi();return t.type=e.type??"",t.data=e.data!==void 0&&e.data!==null?ae.fromPartial(e.data):void 0,t}};c.set(qe.$type,qe);function x(e){return e!=null}var $i="devvit-internal",ct=(e,t)=>{let n={...e,realtimeEffect:e.realtime,id:t,scope:pt.CLIENT,type:$i};(e.showToast||e.navigateToUrl)&&(n.effect=e),parent.postMessage(n,"*")},Gi=e=>new Promise(t=>{let n={...e,realtimeEffect:e.realtime,scope:pt.CLIENT,type:$i};(e.showForm||e.type===Z.EFFECT_CAN_RUN_AS_USER)&&(n.effect=e);let o=crypto.randomUUID();n.id=o;let i=r=>{if(r.data?.type==="devvit-message"&&r.data?.data?.id===o){let s=ae.fromJSON(r.data.data);t(s),removeEventListener("message",i)}};addEventListener("message",i),parent.postMessage(n,"*")});a();var it=class extends Error{};it.prototype.name="InvalidTokenError";function $o(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let o=n.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function Go(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return $o(t)}catch{return atob(t)}}function Rn(e,t){if(typeof e!="string")throw new it("Invalid token specified: must be a string");t||(t={});let n=t.header===!0?0:1,o=e.split(".")[n];if(typeof o!="string")throw new it(`Invalid token specified: missing part #${n+1}`);let i;try{i=Go(o)}catch(r){throw new it(`Invalid token specified: invalid base64 for part #${n+1} (${r.message})`)}try{return JSON.parse(i)}catch(r){throw new it(`Invalid token specified: invalid json for part #${n+1} (${r.message})`)}}function Zi(e){if(e)try{return Rn(e)?.devvit}catch(t){throw Error("token decode failure",{cause:t})}}function Hi(){setInterval(Zo,6e4)}async function Zo(){let{exp:e}=Rn(globalThis.devvit.token);e&&e-Date.now()/1e3>300||await Cn()}async function Cn(){let e=await Gi({type:Z.EFFECT_UPDATE_REQUEST_CONTEXT,updateRequestContext:{}});if(!e?.updateRequestContext?.signedRequestContext){console.error("Failed to refresh token");return}zi(e.updateRequestContext.signedRequestContext)}var Ki=(e,t,n)=>{let o=Ko(n.name,t.hash),i=Xo(o),r=o?.appPermissionState;i?.name==="ANDROID"&&(i.version.yyyy<2026||i.version.yyyy===2026&&i.version.release<=5)&&(r=void 0);let s=Zi(o.signedRequestContext),l;if(s?l=Ho(s,i,o.postData):o.webViewContext&&(l=zo(o.webViewContext,i,o.postData)),!l)throw Error("no context");let u=o.webViewClientData;globalThis.devvit={context:l,dependencies:{client:kn(e),webViewScripts:m},entrypoints:u?.appConfig?.entrypoints??{},share:o?.shareParam?{userData:o?.shareParam.userData}:void 0,appPermissionState:r,token:o.signedRequestContext||o.webbitToken,webViewMode:o?.viewMode,startTime:o?.startTime??void 0,refreshToken:Cn}};function Xi(e){devvit.webViewMode=e}function zi(e){globalThis.devvit.token=e}function Ho(e,t,n){if(!e.app)throw Error("no RequestContext.app");if(!e.post)throw Error("no RequestContext.post");if(!e.subreddit)throw Error("no RequestContext.subreddit");return{appName:e.app.name,appSlug:e.app.slug,appVersion:e.app.version,client:t,commentId:void 0,loid:e.user?.devvitLoid??e.user?.devvit_loid,postAuthorId:Rt(e.post.author),postData:n?.developerData,postId:Mt(e.post.id),snoovatar:e.user?.snoovatar,subredditId:Bt(e.subreddit.id),subredditName:e.subreddit.name,userId:e.user?.id?Rt(e.user.id):void 0,username:e.user?.name}}function zo(e,t,n){return{appName:e.appName,appSlug:e.appName,appVersion:e.appVersion,client:t,commentId:void 0,loid:void 0,postData:n?.developerData,postAuthorId:void 0,postId:Mt(e.postId),snoovatar:void 0,subredditId:Bt(e.subredditId),subredditName:e.subredditName,userId:e.userId?Rt(e.userId):void 0,username:void 0}}function Ko(e,t){if(e)return JSON.parse(e);let n=t?.slice(1);if(!n)throw Error("no bridge context");return JSON.parse(decodeURIComponent(n))}function Xo(e){if(!(e.client!==ot.ANDROID&&e.client!==ot.IOS||!e.nativeVersion))return{name:e.client===ot.ANDROID?"ANDROID":"IOS",version:e.nativeVersion}}a();async function Qo(e,t,n,o,i){let r=new Request(o,i);return Yo(n,new URL(r.url))&&r.headers.set("Authorization",`Bearer ${e.token}`),await t(r)}function Qi(){globalThis.fetch=Qo.bind(void 0,globalThis.devvit,globalThis.fetch,location)}function Yo(e,t){return t.origin===e.origin}a();var jo=new URL(Ut,On).toString();function es(e){let t=e?.trim();if(t)try{let n=new URL(t);if(n.pathname.endsWith(`/${Lt}`))return new URL(Ut,n).toString()}catch{}return jo}async function ts(e,t){let n=e.data;if(n?.type!=="devvit-message"||n.data==null)return;let o=n.data;if(o.screenshotRequest==null||typeof o.id!="string")return;let i,r;try{let s=es(t),{captureScreenshot:l}=await import(s);i=await l()}catch(s){r=s instanceof Error?s.message:String(s)}ct({type:Z.EFFECT_SCREENSHOT_RESPONSE,screenshot:{dataUrl:i,error:r}},o.id)}function Yi(e){addEventListener("message",t=>{ts(t,e)})}a();var Ge,D;function to(){ds(),ns(),rs()}function ns(){addEventListener("load",()=>{let e=performance.timeOrigin,t=performance.now(),n=performance.timeOrigin+t,o={event:"web-view-loaded",timeStart:e,timeEnd:n,duration:t};ct({type:Z.EFFECT_TELEMETRY,telemetry:{event:o.event,loaded:o},analytics:o})})}function rs(){document.addEventListener("click",e=>{let{definition:t,elemTrackId:n}=is(e.target,e.isTrusted),o={event:"click",definition:t,elemTrackId:n};ct({type:Z.EFFECT_TELEMETRY,telemetry:{event:o.event,click:o},analytics:o})},{passive:!0})}function is(e,t){let n=os(e);if(!n)return{definition:"default",elemTrackId:void 0};let o="default";t&&globalThis.window.getComputedStyle(n)?.getPropertyValue("cursor")==="pointer"&&(o="strict");let i,r=n;for(;r;){if(i===void 0){let s=r.getAttribute("data-track-id");s?i=s:r.id&&(i=r.id)}if(t&&o==="default"&&ss(r)&&(o="strict"),i!==void 0&&(!t||o==="strict"))break;r=r.parentElement}return{definition:o,elemTrackId:i}}function os(e){if(!e||typeof e!="object"||!("nodeType"in e))return;let t=e;return t.nodeType===1?t:t.parentElement??void 0}function ss(e){return["A","BUTTON","CANVAS","INPUT","SELECT","TEXTAREA","LABEL"].includes(e.tagName)||["true","plaintext-only"].includes(e.getAttribute("contenteditable")??"")}function ji(){let e=performance.getEntriesByType("navigation")[0];if(!(!D||!e))return{spanName:"web_view_time_to_first_byte",timeStart:D+e.requestStart,timeEnd:D+e.responseStart}}function us(){let t=performance.getEntriesByType("paint").find(n=>n.name==="first-contentful-paint");if(!(!t||!D))return{spanName:"web_view_first_contentful_paint",timeStart:D,timeEnd:D+t.startTime}}function as(){if(D)return{spanName:"web_view_load",timeStart:D,timeEnd:D+performance.now()}}function eo(){let t=performance.getEntriesByType("navigation")[0].domInteractive;if(!(!D||!t))return{spanName:"web_view_time_to_interactive",timeStart:D,timeEnd:D+t}}function ds(){if(Ge=[],D=globalThis.devvit?.startTime,!D)return;if(document.readyState==="complete"){let t=ji();t&&Ge.push(t)}let e=new PerformanceObserver(t=>{for(let n of t.getEntries())if(n.name==="first-contentful-paint"){let o=us();o&&Ge.push(o),e.disconnect()}});if(e.observe({entryTypes:["paint"]}),document.readyState==="loading")globalThis.addEventListener("DOMContentLoaded",()=>{let t=eo();t&&Ge.push(t)});else{let t=eo();t&&Ge.push(t)}globalThis.addEventListener("load",()=>{let t=ji();t&&Ge.push(t);let n=as();n&&Ge.push(n),ct({type:Z.EFFECT_TELEMETRY,telemetry:{metrics:{metrics:Ge}}})})}a();function no(){addEventListener("message",fs)}function fs(e){e.data?.type==="devvit-message"&&e.data?.data?.immersiveModeEvent&&Xi(e.data.data.immersiveModeEvent.immersiveMode)}Ki(document,location,window);to();Qi();Yi(wn(document)??"");Hi();no();})();
|
|
1
|
+
"use strict";(()=>{var ro=Object.create;var _n=Object.defineProperty;var io=Object.getOwnPropertyDescriptor;var oo=Object.getOwnPropertyNames;var so=Object.getPrototypeOf,uo=Object.prototype.hasOwnProperty;var ao=(e,t)=>()=>(e&&(t=e(e=0)),t);var O=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var fo=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of oo(t))!uo.call(e,i)&&i!==n&&_n(e,i,{get:()=>t[i],enumerable:!(o=io(t,i))||o.enumerable});return e};var A=(e,t,n)=>(n=e!=null?ro(so(e)):{},fo(t||!e||!e.__esModule?_n(n,"default",{value:e,enumerable:!0}):n,e));var m,a=ao(()=>{m={hash:"e6bf16f",version:"0.12.22-dev"}});var An=O((xs,Vn)=>{"use strict";a();Vn.exports=Eo;function Eo(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(l,u){n[o]=function(p){if(r)if(r=!1,p)u(p);else{for(var T=new Array(arguments.length-1),b=0;b<T.length;)T[b++]=arguments[b];l.apply(null,T)}};try{e.apply(t||null,n)}catch(d){r&&(r=!1,u(d))}})}});var Mn=O(Un=>{"use strict";a();var Ct=Un;Ct.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 st=new Array(64),Ln=new Array(123);for(j=0;j<64;)Ln[st[j]=j<26?j+65:j<52?j+71:j<62?j-4:j-59|43]=j++;var j;Ct.encode=function(t,n,o){for(var i=null,r=[],s=0,l=0,u;n<o;){var d=t[n++];switch(l){case 0:r[s++]=st[d>>2],u=(d&3)<<4,l=1;break;case 1:r[s++]=st[u|d>>4],u=(d&15)<<2,l=2;break;case 2:r[s++]=st[u|d>>6],r[s++]=st[d&63],l=0;break}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,r)),s=0)}return l&&(r[s++]=st[u],r[s++]=61,l===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";Ct.decode=function(t,n,o){for(var i=o,r=0,s,l=0;l<t.length;){var u=t.charCodeAt(l++);if(u===61&&r>1)break;if((u=Ln[u])===void 0)throw Error(Pn);switch(r){case 0:s=u,r=1;break;case 1:n[o++]=s<<2|(u&48)>>4,s=u,r=2;break;case 2:n[o++]=(s&15)<<4|(u&60)>>2,s=u,r=3;break;case 3:n[o++]=(s&3)<<6|u,r=0;break}}if(r===1)throw Error(Pn);return o-i};Ct.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var Dn=O((Ls,Bn)=>{"use strict";a();Bn.exports=_t;function _t(){this._listeners={}}_t.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};_t.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};_t.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 Zn=O((Ms,Gn)=>{"use strict";a();Gn.exports=Jn(Jn);function Jn(e){return typeof Float32Array<"u"?(function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function i(u,d,p){t[0]=u,d[p]=n[0],d[p+1]=n[1],d[p+2]=n[2],d[p+3]=n[3]}function r(u,d,p){t[0]=u,d[p]=n[3],d[p+1]=n[2],d[p+2]=n[1],d[p+3]=n[0]}e.writeFloatLE=o?i:r,e.writeFloatBE=o?r:i;function s(u,d){return n[0]=u[d],n[1]=u[d+1],n[2]=u[d+2],n[3]=u[d+3],t[0]}function l(u,d){return n[3]=u[d],n[2]=u[d+1],n[1]=u[d+2],n[0]=u[d+3],t[0]}e.readFloatLE=o?s:l,e.readFloatBE=o?l:s})():(function(){function t(o,i,r,s){var l=i<0?1:0;if(l&&(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((l<<31|2139095040)>>>0,r,s);else if(i<11754943508222875e-54)o((l<<31|Math.round(i/1401298464324817e-60))>>>0,r,s);else{var u=Math.floor(Math.log(i)/Math.LN2),d=Math.round(i*Math.pow(2,-u)*8388608)&8388607;o((l<<31|u+127<<23|d)>>>0,r,s)}}e.writeFloatLE=t.bind(null,Fn),e.writeFloatBE=t.bind(null,Wn);function n(o,i,r){var s=o(i,r),l=(s>>31)*2+1,u=s>>>23&255,d=s&8388607;return u===255?d?NaN:l*(1/0):u===0?l*1401298464324817e-60*d:l*Math.pow(2,u-150)*(d+8388608)}e.readFloatLE=n.bind(null,qn),e.readFloatBE=n.bind(null,$n)})(),typeof Float64Array<"u"?(function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function i(u,d,p){t[0]=u,d[p]=n[0],d[p+1]=n[1],d[p+2]=n[2],d[p+3]=n[3],d[p+4]=n[4],d[p+5]=n[5],d[p+6]=n[6],d[p+7]=n[7]}function r(u,d,p){t[0]=u,d[p]=n[7],d[p+1]=n[6],d[p+2]=n[5],d[p+3]=n[4],d[p+4]=n[3],d[p+5]=n[2],d[p+6]=n[1],d[p+7]=n[0]}e.writeDoubleLE=o?i:r,e.writeDoubleBE=o?r:i;function s(u,d){return n[0]=u[d],n[1]=u[d+1],n[2]=u[d+2],n[3]=u[d+3],n[4]=u[d+4],n[5]=u[d+5],n[6]=u[d+6],n[7]=u[d+7],t[0]}function l(u,d){return n[7]=u[d],n[6]=u[d+1],n[5]=u[d+2],n[4]=u[d+3],n[3]=u[d+4],n[2]=u[d+5],n[1]=u[d+6],n[0]=u[d+7],t[0]}e.readDoubleLE=o?s:l,e.readDoubleBE=o?l:s})():(function(){function t(o,i,r,s,l,u){var d=s<0?1:0;if(d&&(s=-s),s===0)o(0,l,u+i),o(1/s>0?0:2147483648,l,u+r);else if(isNaN(s))o(0,l,u+i),o(2146959360,l,u+r);else if(s>17976931348623157e292)o(0,l,u+i),o((d<<31|2146435072)>>>0,l,u+r);else{var p;if(s<22250738585072014e-324)p=s/5e-324,o(p>>>0,l,u+i),o((d<<31|p/4294967296)>>>0,l,u+r);else{var T=Math.floor(Math.log(s)/Math.LN2);T===1024&&(T=1023),p=s*Math.pow(2,-T),o(p*4503599627370496>>>0,l,u+i),o((d<<31|T+1023<<20|p*1048576&1048575)>>>0,l,u+r)}}}e.writeDoubleLE=t.bind(null,Fn,0,4),e.writeDoubleBE=t.bind(null,Wn,4,0);function n(o,i,r,s,l){var u=o(s,l+i),d=o(s,l+r),p=(d>>31)*2+1,T=d>>>20&2047,b=4294967296*(d&1048575)+u;return T===2047?b?NaN:p*(1/0):T===0?p*5e-324*b:p*Math.pow(2,T-1075)*(b+4503599627370496)}e.readDoubleLE=n.bind(null,qn,0,4),e.readDoubleBE=n.bind(null,$n,4,0)})(),e}function Fn(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 Wn(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 qn(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function $n(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var Hn=O((exports,module)=>{"use strict";a();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 Kn=O(zn=>{"use strict";a();var Dt=zn;Dt.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};Dt.read=function(t,n,o){var i=o-n;if(i<1)return"";for(var r=null,s=[],l=0,u;n<o;)u=t[n++],u<128?s[l++]=u:u>191&&u<224?s[l++]=(u&31)<<6|t[n++]&63:u>239&&u<365?(u=((u&7)<<18|(t[n++]&63)<<12|(t[n++]&63)<<6|t[n++]&63)-65536,s[l++]=55296+(u>>10),s[l++]=56320+(u&1023)):s[l++]=(u&15)<<12|(t[n++]&63)<<6|t[n++]&63,l>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,s)),l=0);return r?(l&&r.push(String.fromCharCode.apply(String,s.slice(0,l))),r.join("")):String.fromCharCode.apply(String,s.slice(0,l))};Dt.write=function(t,n,o){for(var i=o,r,s,l=0;l<t.length;++l)r=t.charCodeAt(l),r<128?n[o++]=r:r<2048?(n[o++]=r>>6|192,n[o++]=r&63|128):(r&64512)===55296&&((s=t.charCodeAt(l+1))&64512)===56320?(r=65536+((r&1023)<<10)+(s&1023),++l,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 Qn=O((Ws,Xn)=>{"use strict";a();Xn.exports=yo;function yo(e,t,n){var o=n||8192,i=o>>>1,r=null,s=o;return function(u){if(u<1||u>i)return e(u);s+u>o&&(r=e(o),s=0);var d=t.call(r,s,s+=u);return s&7&&(s=(s|7)+1),d}}});var jn=O(($s,Yn)=>{"use strict";a();Yn.exports=k;var ht=be();function k(e,t){this.lo=e>>>0,this.hi=t>>>0}var Ze=k.zero=new k(0,0);Ze.toNumber=function(){return 0};Ze.zzEncode=Ze.zzDecode=function(){return this};Ze.length=function(){return 1};var vo=k.zeroHash="\0\0\0\0\0\0\0\0";k.fromNumber=function(t){if(t===0)return Ze;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 k(o,i)};k.from=function(t){if(typeof t=="number")return k.fromNumber(t);if(ht.isString(t))if(ht.Long)t=ht.Long.fromString(t);else return k.fromNumber(parseInt(t,10));return t.low||t.high?new k(t.low>>>0,t.high>>>0):Ze};k.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};k.prototype.toLong=function(t){return ht.Long?new ht.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var Ne=String.prototype.charCodeAt;k.fromHash=function(t){return t===vo?Ze:new k((Ne.call(t,0)|Ne.call(t,1)<<8|Ne.call(t,2)<<16|Ne.call(t,3)<<24)>>>0,(Ne.call(t,4)|Ne.call(t,5)<<8|Ne.call(t,6)<<16|Ne.call(t,7)<<24)>>>0)};k.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)};k.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};k.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};k.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 be=O(Jt=>{"use strict";a();var h=Jt;h.asPromise=An();h.base64=Mn();h.EventEmitter=Dn();h.float=Zn();h.inquire=Hn();h.utf8=Kn();h.pool=Qn();h.LongBits=jn();h.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);h.global=h.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Jt;h.emptyArray=Object.freeze?Object.freeze([]):[];h.emptyObject=Object.freeze?Object.freeze({}):{};h.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};h.isString=function(t){return typeof t=="string"||t instanceof String};h.isObject=function(t){return t&&typeof t=="object"};h.isset=h.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};h.Buffer=(function(){try{var e=h.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}})();h._Buffer_from=null;h._Buffer_allocUnsafe=null;h.newBuffer=function(t){return typeof t=="number"?h.Buffer?h._Buffer_allocUnsafe(t):new h.Array(t):h.Buffer?h._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};h.Array=typeof Uint8Array<"u"?Uint8Array:Array;h.Long=h.global.dcodeIO&&h.global.dcodeIO.Long||h.global.Long||h.inquire("long");h.key2Re=/^true|false|0|1$/;h.key32Re=/^-?(?:0|[1-9][0-9]*)$/;h.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;h.longToHash=function(t){return t?h.LongBits.from(t).toHash():h.LongBits.zeroHash};h.longFromHash=function(t,n){var o=h.LongBits.fromHash(t);return h.Long?h.Long.fromBits(o.lo,o.hi,n):o.toNumber(!!n)};function er(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}h.merge=er;h.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function tr(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&&er(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}h.newError=tr;h.ProtocolError=tr("ProtocolError");h.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]}};h.oneOfSetter=function(t){return function(n){for(var o=0;o<t.length;++o)t[o]!==n&&delete this[t[o]]}};h.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};h._configure=function(){var e=h.Buffer;if(!e){h._Buffer_from=h._Buffer_allocUnsafe=null;return}h._Buffer_from=e.from!==Uint8Array.from&&e.from||function(n,o){return new e(n,o)},h._Buffer_allocUnsafe=e.allocUnsafe||function(n){return new e(n)}}});var Ht=O((zs,or)=>{"use strict";a();or.exports=S;var H=be(),Ft,It=H.LongBits,nr=H.base64,rr=H.utf8;function mt(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function qt(){}function No(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function S(){this.len=0,this.head=new mt(qt,0,0),this.tail=this.head,this.states=null}var ir=function(){return H.Buffer?function(){return(S.create=function(){return new Ft})()}:function(){return new S}};S.create=ir();S.alloc=function(t){return new H.Array(t)};H.Array!==Array&&(S.alloc=H.pool(S.alloc,H.Array.prototype.subarray));S.prototype._push=function(t,n,o){return this.tail=this.tail.next=new mt(t,n,o),this.len+=n,this};function $t(e,t,n){t[n]=e&255}function bo(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function Gt(e,t){this.len=e,this.next=void 0,this.val=t}Gt.prototype=Object.create(mt.prototype);Gt.prototype.fn=bo;S.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Gt((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};S.prototype.int32=function(t){return t<0?this._push(Zt,10,It.fromNumber(t)):this.uint32(t)};S.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Zt(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}S.prototype.uint64=function(t){var n=It.from(t);return this._push(Zt,n.length(),n)};S.prototype.int64=S.prototype.uint64;S.prototype.sint64=function(t){var n=It.from(t).zzEncode();return this._push(Zt,n.length(),n)};S.prototype.bool=function(t){return this._push($t,1,t?1:0)};function Wt(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}S.prototype.fixed32=function(t){return this._push(Wt,4,t>>>0)};S.prototype.sfixed32=S.prototype.fixed32;S.prototype.fixed64=function(t){var n=It.from(t);return this._push(Wt,4,n.lo)._push(Wt,4,n.hi)};S.prototype.sfixed64=S.prototype.fixed64;S.prototype.float=function(t){return this._push(H.float.writeFloatLE,4,t)};S.prototype.double=function(t){return this._push(H.float.writeDoubleLE,8,t)};var To=H.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]};S.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push($t,1,0);if(H.isString(t)){var o=S.alloc(n=nr.length(t));nr.decode(t,o,0),t=o}return this.uint32(n)._push(To,n,t)};S.prototype.string=function(t){var n=rr.length(t);return n?this.uint32(n)._push(rr.write,n,t):this._push($t,1,0)};S.prototype.fork=function(){return this.states=new No(this),this.head=this.tail=new mt(qt,0,0),this.len=0,this};S.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 mt(qt,0,0),this.len=0),this};S.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};S.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};S._configure=function(e){Ft=e,S.create=ir(),Ft._configure()}});var ar=O((Xs,ur)=>{"use strict";a();ur.exports=re;var sr=Ht();(re.prototype=Object.create(sr.prototype)).constructor=re;var Te=be();function re(){sr.call(this)}re._configure=function(){re.alloc=Te._Buffer_allocUnsafe,re.writeBytesBuffer=Te.Buffer&&Te.Buffer.prototype instanceof Uint8Array&&Te.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++]}};re.prototype.bytes=function(t){Te.isString(t)&&(t=Te._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(re.writeBytesBuffer,n,t),this};function Ro(e,t,n){e.length<40?Te.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}re.prototype.string=function(t){var n=Te.Buffer.byteLength(t);return this.uint32(n),n&&this._push(Ro,n,t),this};re._configure()});var Xt=O((Ys,pr)=>{"use strict";a();pr.exports=_;var ee=be(),Kt,lr=ee.LongBits,Co=ee.utf8;function te(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 dr=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")},cr=function(){return ee.Buffer?function(n){return(_.create=function(i){return ee.Buffer.isBuffer(i)?new Kt(i):dr(i)})(n)}:dr};_.create=cr();_.prototype._slice=ee.Array.prototype.subarray||ee.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,te(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 zt(){var e=new lr(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 te(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 te(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 Ot(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 te(this,4);return Ot(this.buf,this.pos+=4)};_.prototype.sfixed32=function(){if(this.pos+4>this.len)throw te(this,4);return Ot(this.buf,this.pos+=4)|0};function fr(){if(this.pos+8>this.len)throw te(this,8);return new lr(Ot(this.buf,this.pos+=4),Ot(this.buf,this.pos+=4))}_.prototype.float=function(){if(this.pos+4>this.len)throw te(this,4);var t=ee.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};_.prototype.double=function(){if(this.pos+8>this.len)throw te(this,4);var t=ee.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 te(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(n,o);if(n===o){var i=ee.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 Co.read(t,0,t.length)};_.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw te(this,t);this.pos+=t}else do if(this.pos>=this.len)throw te(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){Kt=e,_.create=cr(),Kt._configure();var t=ee.Long?"toLong":"toNumber";ee.merge(_.prototype,{int64:function(){return zt.call(this)[t](!1)},uint64:function(){return zt.call(this)[t](!0)},sint64:function(){return zt.call(this).zzDecode()[t](!1)},fixed64:function(){return fr.call(this)[t](!0)},sfixed64:function(){return fr.call(this)[t](!1)}})}});var Sr=O((eu,gr)=>{"use strict";a();gr.exports=He;var mr=Xt();(He.prototype=Object.create(mr.prototype)).constructor=He;var hr=be();function He(e){mr.call(this,e)}He._configure=function(){hr.Buffer&&(He.prototype._slice=hr.Buffer.prototype.slice)};He.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))};He._configure()});var yr=O((nu,Er)=>{"use strict";a();Er.exports=gt;var Qt=be();(gt.prototype=Object.create(Qt.EventEmitter.prototype)).constructor=gt;function gt(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");Qt.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}gt.prototype.rpcCall=function e(t,n,o,i,r){if(!i)throw TypeError("request must be specified");var s=this;if(!r)return Qt.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(u,d){if(u)return s.emit("error",u,t),r(u);if(d===null){s.end(!0);return}if(!(d instanceof o))try{d=o[s.responseDelimited?"decodeDelimited":"decode"](d)}catch(p){return s.emit("error",p,t),r(p)}return s.emit("data",d,t),r(null,d)})}catch(l){s.emit("error",l,t),setTimeout(function(){r(l)},0);return}};gt.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Nr=O(vr=>{"use strict";a();var _o=vr;_o.Service=yr()});var Tr=O((su,br)=>{"use strict";a();br.exports={}});var _r=O(Cr=>{"use strict";a();var U=Cr;U.build="minimal";U.Writer=Ht();U.BufferWriter=ar();U.Reader=Xt();U.BufferReader=Sr();U.util=be();U.rpc=Nr();U.roots=Tr();U.configure=Rr;function Rr(){U.util._configure(),U.Writer._configure(U.BufferWriter),U.Reader._configure(U.BufferReader)}Rr()});var V=O((fu,Ir)=>{"use strict";a();Ir.exports=_r()});a();a();a();var In="clientVersion",Lt="devvit.v1.min.js",Ut="screenshot.v1.min.js",On=`https://webview.devvit.net/scripts/${Lt}`;function kn(e){if(e.currentScript&&"src"in e.currentScript)return new URL(e.currentScript.src).searchParams.get(In)??void 0}function wn(e){if(e.currentScript&&"src"in e.currentScript)return e.currentScript.src}a();a();var ot;(function(e){e[e.CLIENT_UNSPECIFIED=0]="CLIENT_UNSPECIFIED",e[e.ANDROID=1]="ANDROID",e[e.IOS=2]="IOS",e[e.SHREDDIT=3]="SHREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ot||(ot={}));var xn;(function(e){e[e.HEIGHT_UNSPECIFIED=0]="HEIGHT_UNSPECIFIED",e[e.REGULAR=1]="REGULAR",e[e.TALL=2]="TALL",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(xn||(xn={}));a();a();function Tt(e,t){if(!e)throw Error(t)}var ve;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(ve||(ve={}));function co(e){return!!e?.startsWith(ve.ACCOUNT)}function po(e){return!!e?.startsWith(ve.LINK)}function ho(e){return!!e?.startsWith(ve.SUBREDDIT)}function mo(e){Tt(co(e),`Expected account id to start with ${ve.ACCOUNT}, got ${e}`)}function go(e){Tt(po(e),`Expected link id to start with ${ve.LINK}, got ${e}`)}function So(e){Tt(ho(e),`Expected subreddit id to start with ${ve.SUBREDDIT}, got ${e}`)}function Rt(e){return mo(e),e}function Mt(e){return go(e),e}function Bt(e){return So(e),e}a();a();a();var Z;(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.EFFECT_TELEMETRY=12]="EFFECT_TELEMETRY",e[e.EFFECT_UPDATE_REQUEST_CONTEXT=13]="EFFECT_UPDATE_REQUEST_CONTEXT",e[e.EFFECT_SCREENSHOT_RESPONSE=14]="EFFECT_SCREENSHOT_RESPONSE",e[e.EFFECT_LOGIN_PROMPT=15]="EFFECT_LOGIN_PROMPT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Z||(Z={}));a();a();var pt;(function(e){e[e.CLIENT=0]="CLIENT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(pt||(pt={}));a();var C=A(V(),1);a();var F=A(V(),1);a();var c=new Map;var Ke;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ke||(Ke={}));function Io(e){switch(e){case 0:case"NULL_VALUE":return Ke.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return Ke.UNRECOGNIZED}}function Oo(e){switch(e){case Ke.NULL_VALUE:return 0;case Ke.UNRECOGNIZED:default:return-1}}function Yt(){return{fields:{}}}var z={$type:"google.protobuf.Struct",encode(e,t=F.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&St.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Yt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let s=St.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:kr(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 z.fromPartial(e??{})},fromPartial(e){let t=Yt();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),{}),t},wrap(e){let t=Yt();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(z.$type,z);function Or(){return{key:"",value:void 0}}var St={$type:"google.protobuf.Struct.FieldsEntry",encode(e,t=F.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&P.encode(P.wrap(e.value),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.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.key=n.string();continue;case 2:if(r!==18)break;i.value=P.unwrap(P.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:ut(e.key)?globalThis.String(e.key):"",value:ut(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 St.fromPartial(e??{})},fromPartial(e){let t=Or();return t.key=e.key??"",t.value=e.value??void 0,t}};c.set(St.$type,St);function jt(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var P={$type:"google.protobuf.Value",encode(e,t=F.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&&z.encode(z.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&ze.encode(ze.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=jt();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=z.unwrap(z.decode(n,n.uint32()));continue;case 6:if(r!==50)break;i.listValue=ze.unwrap(ze.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{nullValue:ut(e.nullValue)?Io(e.nullValue):void 0,numberValue:ut(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:ut(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:ut(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:kr(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=Oo(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 P.fromPartial(e??{})},fromPartial(e){let t=jt();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=jt();if(e===null)t.nullValue=Ke.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(P.$type,P);function en(){return{values:[]}}var ze={$type:"google.protobuf.ListValue",encode(e,t=F.default.Writer.create()){for(let n of e.values)P.encode(P.wrap(n),t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=en();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(P.unwrap(P.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 ze.fromPartial(e??{})},fromPartial(e){let t=en();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=en();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};c.set(ze.$type,ze);function kr(e){return typeof e=="object"&&e!==null}function ut(e){return e!=null}a();var je=A(V(),1);a();var N=A(V(),1);a();a();var K=null;try{K=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 v(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}v.prototype.__isLong__;Object.defineProperty(v.prototype,"__isLong__",{value:!0});function L(e){return(e&&e.__isLong__)===!0}function wr(e){var t=Math.clz32(e&-e);return e?31-t:t}v.isLong=L;var xr={},Vr={};function Xe(e,t){var n,o,i;return t?(e>>>=0,(i=0<=e&&e<256)&&(o=Vr[e],o)?o:(n=E(e,0,!0),i&&(Vr[e]=n),n)):(e|=0,(i=-128<=e&&e<128)&&(o=xr[e],o)?o:(n=E(e,e<0?-1:0,!1),i&&(xr[e]=n),n))}v.fromInt=Xe;function X(e,t){if(isNaN(e))return t?de:ne;if(t){if(e<0)return de;if(e>=Ur)return Dr}else{if(e<=-Pr)return M;if(e+1>=Pr)return Br}return e<0?X(-e,t).neg():E(e%dt|0,e/dt|0,t)}v.fromNumber=X;function E(e,t,n){return new v(e,t,n)}v.fromBits=E;var kt=Math.pow;function nn(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?de:ne;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 nn(e.substring(1),t,n).neg();for(var i=X(kt(n,8)),r=ne,s=0;s<e.length;s+=8){var l=Math.min(8,e.length-s),u=parseInt(e.substring(s,s+l),n);if(l<8){var d=X(kt(n,l));r=r.mul(d).add(X(u))}else r=r.mul(i),r=r.add(X(u))}return r.unsigned=t,r}v.fromString=nn;function Q(e,t){return typeof e=="number"?X(e,t):typeof e=="string"?nn(e,t):E(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}v.fromValue=Q;var Ar=65536,ko=1<<24,dt=Ar*Ar,Ur=dt*dt,Pr=Ur/2,Lr=Xe(ko),ne=Xe(0);v.ZERO=ne;var de=Xe(0,!0);v.UZERO=de;var at=Xe(1);v.ONE=at;var Mr=Xe(1,!0);v.UONE=Mr;var tn=Xe(-1);v.NEG_ONE=tn;var Br=E(-1,2147483647,!1);v.MAX_VALUE=Br;var Dr=E(-1,-1,!0);v.MAX_UNSIGNED_VALUE=Dr;var M=E(0,-2147483648,!1);v.MIN_VALUE=M;var f=v.prototype;f.toInt=function(){return this.unsigned?this.low>>>0:this.low};f.toNumber=function(){return this.unsigned?(this.high>>>0)*dt+(this.low>>>0):this.high*dt+(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(M)){var n=X(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=X(kt(t,6),this.unsigned),s=this,l="";;){var u=s.div(r),d=s.sub(u.mul(r)).toInt()>>>0,p=d.toString(t);if(s=u,s.isZero())return p+l;for(;p.length<6;)p="0"+p;l=""+p+l}};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(M)?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 L(t)||(t=Q(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(L(t)||(t=Q(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(M)?M:this.not().add(at)};f.neg=f.negate;f.add=function(t){L(t)||(t=Q(t));var n=this.high>>>16,o=this.high&65535,i=this.low>>>16,r=this.low&65535,s=t.high>>>16,l=t.high&65535,u=t.low>>>16,d=t.low&65535,p=0,T=0,b=0,J=0;return J+=r+d,b+=J>>>16,J&=65535,b+=i+u,T+=b>>>16,b&=65535,T+=o+l,p+=T>>>16,T&=65535,p+=n+s,p&=65535,E(b<<16|J,p<<16|T,this.unsigned)};f.subtract=function(t){return L(t)||(t=Q(t)),this.add(t.neg())};f.sub=f.subtract;f.multiply=function(t){if(this.isZero())return this;if(L(t)||(t=Q(t)),K){var n=K.mul(this.low,this.high,t.low,t.high);return E(n,K.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?de:ne;if(this.eq(M))return t.isOdd()?M:ne;if(t.eq(M))return this.isOdd()?M:ne;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 X(this.toNumber()*t.toNumber(),this.unsigned);var o=this.high>>>16,i=this.high&65535,r=this.low>>>16,s=this.low&65535,l=t.high>>>16,u=t.high&65535,d=t.low>>>16,p=t.low&65535,T=0,b=0,J=0,bt=0;return bt+=s*p,J+=bt>>>16,bt&=65535,J+=r*p,b+=J>>>16,J&=65535,J+=s*d,b+=J>>>16,J&=65535,b+=i*p,T+=b>>>16,b&=65535,b+=r*d,T+=b>>>16,b&=65535,b+=s*u,T+=b>>>16,b&=65535,T+=o*p+i*d+r*u+s*l,T&=65535,E(J<<16|bt,T<<16|b,this.unsigned)};f.mul=f.multiply;f.divide=function(t){if(L(t)||(t=Q(t)),t.isZero())throw Error("division by zero");if(K){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?K.div_u:K.div_s)(this.low,this.high,t.low,t.high);return E(n,K.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?de:ne;var o,i,r;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return de;if(t.gt(this.shru(1)))return Mr;r=de}else{if(this.eq(M)){if(t.eq(at)||t.eq(tn))return M;if(t.eq(M))return at;var s=this.shr(1);return o=s.div(t).shl(1),o.eq(ne)?t.isNegative()?at:tn:(i=this.sub(t.mul(o)),r=o.add(i.div(t)),r)}else if(t.eq(M))return this.unsigned?de:ne;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=ne}for(i=this;i.gte(t);){o=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var l=Math.ceil(Math.log(o)/Math.LN2),u=l<=48?1:kt(2,l-48),d=X(o),p=d.mul(t);p.isNegative()||p.gt(i);)o-=u,d=X(o,this.unsigned),p=d.mul(t);d.isZero()&&(d=at),r=r.add(d),i=i.sub(p)}return r};f.div=f.divide;f.modulo=function(t){if(L(t)||(t=Q(t)),K){var n=(this.unsigned?K.rem_u:K.rem_s)(this.low,this.high,t.low,t.high);return E(n,K.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};f.mod=f.modulo;f.rem=f.modulo;f.not=function(){return E(~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?wr(this.low):wr(this.high)+32};f.ctz=f.countTrailingZeros;f.and=function(t){return L(t)||(t=Q(t)),E(this.low&t.low,this.high&t.high,this.unsigned)};f.or=function(t){return L(t)||(t=Q(t)),E(this.low|t.low,this.high|t.high,this.unsigned)};f.xor=function(t){return L(t)||(t=Q(t)),E(this.low^t.low,this.high^t.high,this.unsigned)};f.shiftLeft=function(t){return L(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?E(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):E(0,this.low<<t-32,this.unsigned)};f.shl=f.shiftLeft;f.shiftRight=function(t){return L(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?E(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):E(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};f.shr=f.shiftRight;f.shiftRightUnsigned=function(t){return L(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?E(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?E(this.high,0,this.unsigned):E(this.high>>>t-32,0,this.unsigned)};f.shru=f.shiftRightUnsigned;f.shr_u=f.shiftRightUnsigned;f.rotateLeft=function(t){var n;return L(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?E(this.high,this.low,this.unsigned):t<32?(n=32-t,E(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,E(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 L(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?E(this.high,this.low,this.unsigned):t<32?(n=32-t,E(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,E(this.low<<n|this.high>>>t,this.high<<n|this.low>>>t,this.unsigned))};f.rotr=f.rotateRight;f.toSigned=function(){return this.unsigned?E(this.low,this.high,!1):this};f.toUnsigned=function(){return this.unsigned?this:E(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]};v.fromBytes=function(t,n,o){return o?v.fromBytesLE(t,n):v.fromBytesBE(t,n)};v.fromBytesLE=function(t,n){return new v(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};v.fromBytesBE=function(t,n){return new v(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"&&(v.fromBigInt=function(t,n){var o=Number(BigInt.asIntN(32,t)),i=Number(BigInt.asIntN(32,t>>BigInt(32)));return E(o,i,n)},v.fromValue=function(t,n){return typeof t=="bigint"?v.fromBigInt(t,n):Q(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 rn=v;var Qe=A(V(),1);function Jr(){return{seconds:0,nanos:0}}var Ye={$type:"google.protobuf.Timestamp",encode(e,t=Qe.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 Qe.default.Reader?e:Qe.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=wo(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:Fr(e.seconds)?globalThis.Number(e.seconds):0,nanos:Fr(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 Ye.fromPartial(e??{})},fromPartial(e){let t=Jr();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}};c.set(Ye.$type,Ye);function wo(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}Qe.default.util.Long!==rn&&(Qe.default.util.Long=rn,Qe.default.configure());function Fr(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 ln(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 cn(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 Y;(function(e){e[e.SCOPE_UNKNOWN=0]="SCOPE_UNKNOWN",e[e.SUBMIT_POST=1]="SUBMIT_POST",e[e.SUBMIT_COMMENT=2]="SUBMIT_COMMENT",e[e.SUBSCRIBE_TO_SUBREDDIT=3]="SUBSCRIBE_TO_SUBREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Y||(Y={}));function Qr(e){switch(e){case 0:case"SCOPE_UNKNOWN":return Y.SCOPE_UNKNOWN;case 1:case"SUBMIT_POST":return Y.SUBMIT_POST;case 2:case"SUBMIT_COMMENT":return Y.SUBMIT_COMMENT;case 3:case"SUBSCRIBE_TO_SUBREDDIT":return Y.SUBSCRIBE_TO_SUBREDDIT;case-1:case"UNRECOGNIZED":default:return Y.UNRECOGNIZED}}function Yr(e){switch(e){case Y.SCOPE_UNKNOWN:return 0;case Y.SUBMIT_POST:return 1;case Y.SUBMIT_COMMENT:return 2;case Y.SUBSCRIBE_TO_SUBREDDIT:return 3;case Y.UNRECOGNIZED:default:return-1}}function Wr(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}var Re={$type:"reddit.devvit.app_permission.v1.AppPermission",encode(e,t=N.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&&Ye.encode(xo(e.updatedAt),t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof N.default.Reader?e:N.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Wr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appSlug=n.string();continue;case 2:if(r!==18)break;i.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=jr(Ye.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:w(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:w(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>Qr(t)):[],consentStatus:w(e.consentStatus)?ln(e.consentStatus):0,updatedAt:w(e.updatedAt)?Vo(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=>Yr(n))),e.consentStatus!==0&&(t.consentStatus=cn(e.consentStatus)),e.updatedAt!==void 0&&(t.updatedAt=e.updatedAt.toISOString()),t},create(e){return Re.fromPartial(e??{})},fromPartial(e){let t=Wr();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 qr(){return{appSlug:"",appName:"",termsAndConditions:void 0,privacyPolicy:void 0}}var Ce={$type:"reddit.devvit.app_permission.v1.DevvitApp",encode(e,t=N.default.Writer.create()){return e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.appName!==""&&t.uint32(18).string(e.appName),e.termsAndConditions!==void 0&&t.uint32(26).string(e.termsAndConditions),e.privacyPolicy!==void 0&&t.uint32(34).string(e.privacyPolicy),t},decode(e,t){let n=e instanceof N.default.Reader?e:N.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.appSlug=n.string();continue;case 2:if(r!==18)break;i.appName=n.string();continue;case 3:if(r!==26)break;i.termsAndConditions=n.string();continue;case 4:if(r!==34)break;i.privacyPolicy=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:w(e.appSlug)?globalThis.String(e.appSlug):"",appName:w(e.appName)?globalThis.String(e.appName):"",termsAndConditions:w(e.termsAndConditions)?globalThis.String(e.termsAndConditions):void 0,privacyPolicy:w(e.privacyPolicy)?globalThis.String(e.privacyPolicy):void 0}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.appName!==""&&(t.appName=e.appName),e.termsAndConditions!==void 0&&(t.termsAndConditions=e.termsAndConditions),e.privacyPolicy!==void 0&&(t.privacyPolicy=e.privacyPolicy),t},create(e){return Ce.fromPartial(e??{})},fromPartial(e){let t=qr();return t.appSlug=e.appSlug??"",t.appName=e.appName??"",t.termsAndConditions=e.termsAndConditions??void 0,t.privacyPolicy=e.privacyPolicy??void 0,t}};c.set(Ce.$type,Ce);function $r(){return{userId:""}}var on={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdRequest",encode(e,t=N.default.Writer.create()){return e.userId!==""&&t.uint32(10).string(e.userId),t},decode(e,t){let n=e instanceof N.default.Reader?e:N.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.userId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{userId:w(e.userId)?globalThis.String(e.userId):""}},toJSON(e){let t={};return e.userId!==""&&(t.userId=e.userId),t},create(e){return on.fromPartial(e??{})},fromPartial(e){let t=$r();return t.userId=e.userId??"",t}};c.set(on.$type,on);function Gr(){return{appPermissions:[],devvitApps:[]}}var sn={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,t=N.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 N.default.Reader?e:N.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Gr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appPermissions.push(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 sn.fromPartial(e??{})},fromPartial(e){let t=Gr();return t.appPermissions=e.appPermissions?.map(n=>Re.fromPartial(n))||[],t.devvitApps=e.devvitApps?.map(n=>Ce.fromPartial(n))||[],t}};c.set(sn.$type,sn);function Zr(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}var un={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionRequest",encode(e,t=N.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 N.default.Reader?e:N.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.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:w(e.userId)?globalThis.String(e.userId):"",appSlug:w(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:w(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=>Yr(n))),t},create(e){return un.fromPartial(e??{})},fromPartial(e){let t=Zr();return t.userId=e.userId??"",t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t}};c.set(un.$type,un);function Hr(){return{error:void 0}}var an={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode(e,t=N.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 N.default.Reader?e:N.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.error=W.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:w(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 an.fromPartial(e??{})},fromPartial(e){let t=Hr();return t.error=e.error!==void 0&&e.error!==null?W.fromPartial(e.error):void 0,t}};c.set(an.$type,an);function zr(){return{appSlug:"",userId:"",subredditId:""}}var dn={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionRequest",encode(e,t=N.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 N.default.Reader?e:N.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.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:w(e.appSlug)?globalThis.String(e.appSlug):"",userId:w(e.userId)?globalThis.String(e.userId):"",subredditId:w(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 dn.fromPartial(e??{})},fromPartial(e){let t=zr();return t.appSlug=e.appSlug??"",t.userId=e.userId??"",t.subredditId=e.subredditId??"",t}};c.set(dn.$type,dn);function Kr(){return{error:void 0}}var fn={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode(e,t=N.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 N.default.Reader?e:N.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.error=W.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:w(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 fn.fromPartial(e??{})},fromPartial(e){let t=Kr();return t.error=e.error!==void 0&&e.error!==null?W.fromPartial(e.error):void 0,t}};c.set(fn.$type,fn);function Xr(){return{message:""}}var W={$type:"reddit.devvit.app_permission.v1.ErrorMessage",encode(e,t=N.default.Writer.create()){return e.message!==""&&t.uint32(10).string(e.message),t},decode(e,t){let n=e instanceof N.default.Reader?e:N.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.message=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{message:w(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=Xr();return t.message=e.message??"",t}};c.set(W.$type,W);function xo(e){let t=Math.trunc(e.getTime()/1e3),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function jr(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function Vo(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):jr(Ye.fromJSON(e))}function w(e){return e!=null}function ei(){return{postId:void 0,appSlug:void 0,subredditId:void 0}}var pn={$type:"devvit.ui.effect_types.v1alpha.CanRunAsUserEffect",encode(e,t=je.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 je.default.Reader?e:je.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ei();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.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:wt(e.postId)?globalThis.String(e.postId):void 0,appSlug:wt(e.appSlug)?globalThis.String(e.appSlug):void 0,subredditId:wt(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 pn.fromPartial(e??{})},fromPartial(e){let t=ei();return t.postId=e.postId??void 0,t.appSlug=e.appSlug??void 0,t.subredditId=e.subredditId??void 0,t}};c.set(pn.$type,pn);function ti(){return{consentStatus:0}}var fe={$type:"devvit.ui.effect_types.v1alpha.ConsentStatusEvent",encode(e,t=je.default.Writer.create()){return e.consentStatus!==0&&t.uint32(8).int32(e.consentStatus),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=ti();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:wt(e.consentStatus)?ln(e.consentStatus):0}},toJSON(e){let t={};return e.consentStatus!==0&&(t.consentStatus=cn(e.consentStatus)),t},create(e){return fe.fromPartial(e??{})},fromPartial(e){let t=ti();return t.consentStatus=e.consentStatus??0,t}};c.set(fe.$type,fe);function wt(e){return e!=null}a();var se=A(V(),1);var oe;(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"})(oe||(oe={}));function Ao(e){switch(e){case 0:case"STATUS_CANCELLED":return oe.STATUS_CANCELLED;case 1:case"STATUS_SUCCESS":return oe.STATUS_SUCCESS;case 2:case"STATUS_ERROR":return oe.STATUS_ERROR;case-1:case"UNRECOGNIZED":default:return oe.UNRECOGNIZED}}function Po(e){switch(e){case oe.STATUS_CANCELLED:return 0;case oe.STATUS_SUCCESS:return 1;case oe.STATUS_ERROR:return 2;case oe.UNRECOGNIZED:default:return-1}}function ni(){return{id:"",skus:[],metadata:{}}}var _e={$type:"devvit.ui.effect_types.v1alpha.CreateOrderEffect",encode(e,t=se.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])=>{Et.encode({key:n,value:o},t.uint32(26).fork()).ldelim()}),t},decode(e,t){let n=e instanceof se.default.Reader?e:se.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.id=n.string();continue;case 2:if(r!==18)break;i.skus.push(n.string());continue;case 3:if(r!==26)break;let s=Et.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:Ie(e.id)?globalThis.String(e.id):"",skus:globalThis.Array.isArray(e?.skus)?e.skus.map(t=>globalThis.String(t)):[],metadata:Lo(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 _e.fromPartial(e??{})},fromPartial(e){let t=ni();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(_e.$type,_e);function ri(){return{key:"",value:""}}var Et={$type:"devvit.ui.effect_types.v1alpha.CreateOrderEffect.MetadataEntry",encode(e,t=se.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 se.default.Reader?e:se.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ri();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.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:Ie(e.key)?globalThis.String(e.key):"",value:Ie(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 Et.fromPartial(e??{})},fromPartial(e){let t=ri();return t.key=e.key??"",t.value=e.value??"",t}};c.set(Et.$type,Et);function ii(){return{errorMessage:void 0,orderId:void 0,order:void 0,status:0,errorCode:void 0}}var le={$type:"devvit.ui.effect_types.v1alpha.OrderResultEvent",encode(e,t=se.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&&_e.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 se.default.Reader?e:se.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 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=_e.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:Ie(e.errorMessage)?globalThis.String(e.errorMessage):void 0,orderId:Ie(e.orderId)?globalThis.String(e.orderId):void 0,order:Ie(e.order)?_e.fromJSON(e.order):void 0,status:Ie(e.status)?Ao(e.status):0,errorCode:Ie(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=_e.toJSON(e.order)),e.status!==0&&(t.status=Po(e.status)),e.errorCode!==void 0&&(t.errorCode=Math.round(e.errorCode)),t},create(e){return le.fromPartial(e??{})},fromPartial(e){let t=ii();return t.errorMessage=e.errorMessage??void 0,t.orderId=e.orderId??void 0,t.order=e.order!==void 0&&e.order!==null?_e.fromPartial(e.order):void 0,t.status=e.status??0,t.errorCode=e.errorCode??void 0,t}};c.set(le.$type,le);function Lo(e){return typeof e=="object"&&e!==null}function Ie(e){return e!=null}a();var G=A(V(),1);a();var xt=A(V(),1);a();var y=A(V(),1);a();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 ft(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 lt(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}}a();var q=A(V(),1);function oi(){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 R={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,t=q.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&&Oe.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&ke.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&we.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof q.default.Reader?e:q.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.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=Oe.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionValue=ke.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupValue=we.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldType:ce(e.fieldType)?ft(e.fieldType):0,isSecret:ce(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:ce(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:ce(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:ce(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:ce(e.listValue)?Oe.fromJSON(e.listValue):void 0,selectionValue:ce(e.selectionValue)?ke.fromJSON(e.selectionValue):void 0,groupValue:ce(e.groupValue)?we.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=lt(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=Oe.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=ke.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=we.toJSON(e.groupValue)),t},create(e){return R.fromPartial(e??{})},fromPartial(e){let t=oi();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?Oe.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?ke.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?we.fromPartial(e.groupValue):void 0,t}};c.set(R.$type,R);function si(){return{itemType:0,items:[]}}var Oe={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=q.default.Writer.create()){e.itemType!==0&&t.uint32(8).int32(e.itemType);for(let n of e.items)R.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof q.default.Reader?e:q.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!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.items.push(R.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:ce(e.itemType)?ft(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(t=>R.fromJSON(t)):[]}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=lt(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>R.toJSON(n))),t},create(e){return Oe.fromPartial(e??{})},fromPartial(e){let t=si();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>R.fromPartial(n))||[],t}};c.set(Oe.$type,Oe);function ui(){return{values:[]}}var ke={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=q.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof q.default.Reader?e:q.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.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 ke.fromPartial(e??{})},fromPartial(e){let t=ui();return t.values=e.values?.map(n=>n)||[],t}};c.set(ke.$type,ke);function ai(){return{}}var we={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=q.default.Writer.create()){return t},decode(e,t){let n=e instanceof q.default.Reader?e:q.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ai();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 we.fromPartial(e??{})},fromPartial(e){return ai()}};c.set(we.$type,we);function ce(e){return e!=null}function di(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var B={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,t=y.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&&R.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&&$.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 y.default.Reader?e:y.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=di();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.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=R.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=$.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:g(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:g(e.fieldType)?ft(e.fieldType):0,label:g(e.label)?globalThis.String(e.label):"",helpText:g(e.helpText)?globalThis.String(e.helpText):void 0,defaultValue:g(e.defaultValue)?R.fromJSON(e.defaultValue):void 0,required:g(e.required)?globalThis.Boolean(e.required):void 0,disabled:g(e.disabled)?globalThis.Boolean(e.disabled):void 0,fieldConfig:g(e.fieldConfig)?$.fromJSON(e.fieldConfig):void 0,isSecret:g(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let t={};return e.fieldId!==""&&(t.fieldId=e.fieldId),e.fieldType!==0&&(t.fieldType=lt(e.fieldType)),e.label!==""&&(t.label=e.label),e.helpText!==void 0&&(t.helpText=e.helpText),e.defaultValue!==void 0&&(t.defaultValue=R.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=$.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return B.fromPartial(e??{})},fromPartial(e){let t=di();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?R.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?$.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};c.set(B.$type,B);function fi(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var $={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=y.default.Writer.create()){return e.stringConfig!==void 0&&xe.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&&Ae.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&Pe.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&Le.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&Ue.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&Be.encode(e.groupConfig,t.uint32(58).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=fi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.stringConfig=xe.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=Ae.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.booleanConfig=Pe.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.listConfig=Le.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionConfig=Ue.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupConfig=Be.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{stringConfig:g(e.stringConfig)?xe.fromJSON(e.stringConfig):void 0,paragraphConfig:g(e.paragraphConfig)?Ve.fromJSON(e.paragraphConfig):void 0,numberConfig:g(e.numberConfig)?Ae.fromJSON(e.numberConfig):void 0,booleanConfig:g(e.booleanConfig)?Pe.fromJSON(e.booleanConfig):void 0,listConfig:g(e.listConfig)?Le.fromJSON(e.listConfig):void 0,selectionConfig:g(e.selectionConfig)?Ue.fromJSON(e.selectionConfig):void 0,groupConfig:g(e.groupConfig)?Be.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=xe.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=Ve.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=Ae.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=Pe.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=Le.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=Ue.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=Be.toJSON(e.groupConfig)),t},create(e){return $.fromPartial(e??{})},fromPartial(e){let t=fi();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?xe.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?Ae.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?Pe.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?Le.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?Ue.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?Be.fromPartial(e.groupConfig):void 0,t}};c.set($.$type,$);function li(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var xe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.String",encode(e,t=y.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 y.default.Reader?e:y.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=li();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.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:g(e.minLength)?globalThis.Number(e.minLength):void 0,maxLength:g(e.maxLength)?globalThis.Number(e.maxLength):void 0,placeholder:g(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 xe.fromPartial(e??{})},fromPartial(e){let t=li();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(xe.$type,xe);function ci(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var Ve={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Paragraph",encode(e,t=y.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 y.default.Reader?e:y.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.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:g(e.maxCharacters)?globalThis.Number(e.maxCharacters):void 0,lineHeight:g(e.lineHeight)?globalThis.Number(e.lineHeight):void 0,placeholder:g(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=ci();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 pi(){return{step:void 0,min:void 0,max:void 0}}var Ae={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Number",encode(e,t=y.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 y.default.Reader?e:y.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!==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:g(e.step)?globalThis.Number(e.step):void 0,min:g(e.min)?globalThis.Number(e.min):void 0,max:g(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 Ae.fromPartial(e??{})},fromPartial(e){let t=pi();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};c.set(Ae.$type,Ae);function hi(){return{}}var Pe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Boolean",encode(e,t=y.default.Writer.create()){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=hi();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 Pe.fromPartial(e??{})},fromPartial(e){return hi()}};c.set(Pe.$type,Pe);function mi(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var Le={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.List",encode(e,t=y.default.Writer.create()){return e.itemType!==0&&t.uint32(8).int32(e.itemType),e.itemConfig!==void 0&&$.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 y.default.Reader?e:y.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!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.itemConfig=$.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:g(e.itemType)?ft(e.itemType):0,itemConfig:g(e.itemConfig)?$.fromJSON(e.itemConfig):void 0,minEntries:g(e.minEntries)?globalThis.Number(e.minEntries):void 0,maxEntries:g(e.maxEntries)?globalThis.Number(e.maxEntries):void 0,entryLabel:g(e.entryLabel)?globalThis.String(e.entryLabel):void 0}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=lt(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=$.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 Le.fromPartial(e??{})},fromPartial(e){let t=mi();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?$.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(Le.$type,Le);function gi(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var Ue={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=y.default.Writer.create()){for(let n of e.choices)Me.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 y.default.Reader?e:y.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.choices.push(Me.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=>Me.fromJSON(t)):[],multiSelect:g(e.multiSelect)?globalThis.Boolean(e.multiSelect):void 0,minSelections:g(e.minSelections)?globalThis.Number(e.minSelections):void 0,maxSelections:g(e.maxSelections)?globalThis.Number(e.maxSelections):void 0,renderAsList:g(e.renderAsList)?globalThis.Boolean(e.renderAsList):void 0}},toJSON(e){let t={};return e.choices?.length&&(t.choices=e.choices.map(n=>Me.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 Ue.fromPartial(e??{})},fromPartial(e){let t=gi();return t.choices=e.choices?.map(n=>Me.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(Ue.$type,Ue);function Si(){return{label:"",value:""}}var Me={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection.Item",encode(e,t=y.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 y.default.Reader?e:y.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.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:g(e.label)?globalThis.String(e.label):"",value:g(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 Me.fromPartial(e??{})},fromPartial(e){let t=Si();return t.label=e.label??"",t.value=e.value??"",t}};c.set(Me.$type,Me);function Ei(){return{fields:[]}}var Be={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,t=y.default.Writer.create()){for(let n of e.fields)B.encode(n,t.uint32(10).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=Ei();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(B.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=>B.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>B.toJSON(n))),t},create(e){return Be.fromPartial(e??{})},fromPartial(e){let t=Ei();return t.fields=e.fields?.map(n=>B.fromPartial(n))||[],t}};c.set(Be.$type,Be);function g(e){return e!=null}function yi(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var pe={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=xt.default.Writer.create()){for(let n of e.fields)B.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 xt.default.Reader?e:xt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=yi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(B.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=>B.fromJSON(t)):[],title:yt(e.title)?globalThis.String(e.title):void 0,shortDescription:yt(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:yt(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:yt(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:yt(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>B.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 pe.fromPartial(e??{})},fromPartial(e){let t=yi();return t.fields=e.fields?.map(n=>B.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(pe.$type,pe);function yt(e){return e!=null}function vi(){return{form:void 0}}var hn={$type:"devvit.ui.effect_types.v1alpha.ShowFormEffect",encode(e,t=G.default.Writer.create()){return e.form!==void 0&&pe.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof G.default.Reader?e:G.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=vi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.form=pe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{form:Nt(e.form)?pe.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=pe.toJSON(e.form)),t},create(e){return hn.fromPartial(e??{})},fromPartial(e){let t=vi();return t.form=e.form!==void 0&&e.form!==null?pe.fromPartial(e.form):void 0,t}};c.set(hn.$type,hn);function Ni(){return{results:{},formId:void 0}}var he={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent",encode(e,t=G.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{vt.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 G.default.Reader?e:G.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;let s=vt.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:Uo(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=R.fromJSON(o),t),{}):{},formId:Nt(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]=R.toJSON(i)}))}return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return he.fromPartial(e??{})},fromPartial(e){let t=Ni();return t.results=Object.entries(e.results??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=R.fromPartial(i)),n),{}),t.formId=e.formId??void 0,t}};c.set(he.$type,he);function bi(){return{key:"",value:void 0}}var vt={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=G.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&R.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof G.default.Reader?e:G.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=bi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=R.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:Nt(e.key)?globalThis.String(e.key):"",value:Nt(e.value)?R.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=R.toJSON(e.value)),t},create(e){return vt.fromPartial(e??{})},fromPartial(e){let t=bi();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?R.fromPartial(e.value):void 0,t}};c.set(vt.$type,vt);function Ti(){return{formId:void 0}}var me={$type:"devvit.ui.effect_types.v1alpha.FormCanceledEvent",encode(e,t=G.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof G.default.Reader?e:G.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.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{formId:Nt(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 me.fromPartial(e??{})},fromPartial(e){let t=Ti();return t.formId=e.formId??void 0,t}};c.set(me.$type,me);function Uo(e){return typeof e=="object"&&e!==null}function Nt(e){return e!=null}a();var et=A(V(),1);function Ri(){return{}}var mn={$type:"devvit.ui.effect_types.v1alpha.UpdateRequestContextEffect",encode(e,t=et.default.Writer.create()){return 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=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 mn.fromPartial(e??{})},fromPartial(e){return Ri()}};c.set(mn.$type,mn);function Ci(){return{signedRequestContext:""}}var ge={$type:"devvit.ui.effect_types.v1alpha.UpdateRequestContextEvent",encode(e,t=et.default.Writer.create()){return e.signedRequestContext!==""&&t.uint32(10).string(e.signedRequestContext),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=Ci();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.signedRequestContext=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{signedRequestContext:Mo(e.signedRequestContext)?globalThis.String(e.signedRequestContext):""}},toJSON(e){let t={};return e.signedRequestContext!==""&&(t.signedRequestContext=e.signedRequestContext),t},create(e){return ge.fromPartial(e??{})},fromPartial(e){let t=Ci();return t.signedRequestContext=e.signedRequestContext??"",t}};c.set(ge.$type,ge);function Mo(e){return e!=null}a();var nt=A(V(),1);a();var tt=A(V(),1);a();var Vt=A(V(),1);function _i(){return{}}var At={$type:"google.protobuf.Empty",encode(e,t=Vt.default.Writer.create()){return t},decode(e,t){let n=e instanceof Vt.default.Reader?e:Vt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=_i();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 At.fromPartial(e??{})},fromPartial(e){return _i()}};c.set(At.$type,At);function Ii(){return{channels:[]}}var gn={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=tt.default.Writer.create()){for(let n of e.channels)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof tt.default.Reader?e:tt.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 gn.fromPartial(e??{})},fromPartial(e){let t=Ii();return t.channels=e.channels?.map(n=>n)||[],t}};c.set(gn.$type,gn);function Oi(){return{channel:"",data:void 0}}var Se={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=tt.default.Writer.create()){return e.channel!==""&&t.uint32(10).string(e.channel),e.data!==void 0&&z.encode(z.wrap(e.data),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof tt.default.Reader?e:tt.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=z.unwrap(z.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channel:Do(e.channel)?globalThis.String(e.channel):"",data:Bo(e.data)?e.data:void 0}},toJSON(e){let t={};return e.channel!==""&&(t.channel=e.channel),e.data!==void 0&&(t.data=e.data),t},create(e){return Se.fromPartial(e??{})},fromPartial(e){let t=Oi();return t.channel=e.channel??"",t.data=e.data??void 0,t}};c.set(Se.$type,Se);function Bo(e){return typeof e=="object"&&e!==null}function Do(e){return e!=null}var De;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(De||(De={}));function Jo(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return De.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return De.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return De.UNRECOGNIZED}}function Fo(e){switch(e){case De.REALTIME_SUBSCRIBED:return 0;case De.REALTIME_UNSUBSCRIBED:return 1;case De.UNRECOGNIZED:default:return-1}}function ki(){return{subscriptionIds:[]}}var Sn={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=nt.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);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=ki();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 Sn.fromPartial(e??{})},fromPartial(e){let t=ki();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};c.set(Sn.$type,Sn);function wi(){return{event:void 0,status:void 0}}var Ee={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=nt.default.Writer.create()){return e.event!==void 0&&Se.encode(e.event,t.uint32(10).fork()).ldelim(),e.status!==void 0&&t.uint32(16).int32(e.status),t},decode(e,t){let n=e instanceof nt.default.Reader?e:nt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=wi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.event=Se.decode(n,n.uint32());continue;case 2:if(r!==16)break;i.status=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{event:xi(e.event)?Se.fromJSON(e.event):void 0,status:xi(e.status)?Jo(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=Se.toJSON(e.event)),e.status!==void 0&&(t.status=Fo(e.status)),t},create(e){return Ee.fromPartial(e??{})},fromPartial(e){let t=wi();return t.event=e.event!==void 0&&e.event!==null?Se.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};c.set(Ee.$type,Ee);function xi(e){return e!=null}a();var Pt=A(V(),1);var ue;(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"})(ue||(ue={}));function yn(e){switch(e){case 0:case"UNSPECIFIED":return ue.UNSPECIFIED;case 1:case"INLINE_MODE":return ue.INLINE_MODE;case 2:case"IMMERSIVE_MODE":return ue.IMMERSIVE_MODE;case-1:case"UNRECOGNIZED":default:return ue.UNRECOGNIZED}}function vn(e){switch(e){case ue.UNSPECIFIED:return 0;case ue.INLINE_MODE:return 1;case ue.IMMERSIVE_MODE:return 2;case ue.UNRECOGNIZED:default:return-1}}function Vi(){return{immersiveMode:0,entryUrl:void 0}}var En={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,t=Pt.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 Pt.default.Reader?e:Pt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Vi();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:Ai(e.immersiveMode)?yn(e.immersiveMode):0,entryUrl:Ai(e.entryUrl)?globalThis.String(e.entryUrl):void 0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=vn(e.immersiveMode)),e.entryUrl!==void 0&&(t.entryUrl=e.entryUrl),t},create(e){return En.fromPartial(e??{})},fromPartial(e){let t=Vi();return t.immersiveMode=e.immersiveMode??0,t.entryUrl=e.entryUrl??void 0,t}};c.set(En.$type,En);function Ai(e){return e!=null}a();var rt=A(V(),1);function Pi(){return{}}var ye={$type:"devvit.ui.effects.web_view.v1alpha.WebViewScreenshotRequestEvent",encode(e,t=rt.default.Writer.create()){return t},decode(e,t){let n=e instanceof rt.default.Reader?e:rt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Pi();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 ye.fromPartial(e??{})},fromPartial(e){return Pi()}};c.set(ye.$type,ye);function Li(){return{dataUrl:void 0,error:void 0}}var Nn={$type:"devvit.ui.effects.web_view.v1alpha.WebViewScreenshotResponseEffect",encode(e,t=rt.default.Writer.create()){return e.dataUrl!==void 0&&t.uint32(10).string(e.dataUrl),e.error!==void 0&&t.uint32(18).string(e.error),t},decode(e,t){let n=e instanceof rt.default.Reader?e:rt.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.dataUrl=n.string();continue;case 2:if(r!==18)break;i.error=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{dataUrl:Ui(e.dataUrl)?globalThis.String(e.dataUrl):void 0,error:Ui(e.error)?globalThis.String(e.error):void 0}},toJSON(e){let t={};return e.dataUrl!==void 0&&(t.dataUrl=e.dataUrl),e.error!==void 0&&(t.error=e.error),t},create(e){return Nn.fromPartial(e??{})},fromPartial(e){let t=Li();return t.dataUrl=e.dataUrl??void 0,t.error=e.error??void 0,t}};c.set(Nn.$type,Nn);function Ui(e){return e!=null}var $e;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})($e||($e={}));function Wo(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return $e.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return $e.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return $e.UNRECOGNIZED}}function qo(e){switch(e){case $e.WEBVIEW_VISIBLE:return 0;case $e.WEBVIEW_HIDDEN:return 1;case $e.UNRECOGNIZED:default:return-1}}function Mi(){return{message:void 0,jsonString:""}}var Je={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=C.default.Writer.create()){return e.message!==void 0&&P.encode(P.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.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.message=P.unwrap(P.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:x(e?.message)?e.message:void 0,jsonString:x(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 Je.fromPartial(e??{})},fromPartial(e){let t=Mi();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};c.set(Je.$type,Je);function Bi(){return{visibility:0}}var Fe={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=C.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Bi();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:x(e.visibility)?Wo(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=qo(e.visibility)),t},create(e){return Fe.fromPartial(e??{})},fromPartial(e){let t=Bi();return t.visibility=e.visibility??0,t}};c.set(Fe.$type,Fe);function Di(){return{postMessage:void 0,fullScreen:void 0}}var bn={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=C.default.Writer.create()){return e.postMessage!==void 0&&Je.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&Fe.encode(e.fullScreen,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Di();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postMessage=Je.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.fullScreen=Fe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{postMessage:x(e.postMessage)?Je.fromJSON(e.postMessage):void 0,fullScreen:x(e.fullScreen)?Fe.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=Je.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=Fe.toJSON(e.fullScreen)),t},create(e){return bn.fromPartial(e??{})},fromPartial(e){let t=Di();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?Je.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?Fe.fromPartial(e.fullScreen):void 0,t}};c.set(bn.$type,bn);function Ji(){return{immersiveMode:0}}var We={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode(e,t=C.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ji();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:x(e.immersiveMode)?yn(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=vn(e.immersiveMode)),t},create(e){return We.fromPartial(e??{})},fromPartial(e){let t=Ji();return t.immersiveMode=e.immersiveMode??0,t}};c.set(We.$type,We);function Fi(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,consentStatus:void 0,orderResult:void 0,updateRequestContext:void 0,screenshotRequest:void 0}}var ae={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=C.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&me.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&he.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&Ee.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&We.encode(e.immersiveModeEvent,t.uint32(42).fork()).ldelim(),e.consentStatus!==void 0&&fe.encode(e.consentStatus,t.uint32(58).fork()).ldelim(),e.orderResult!==void 0&&le.encode(e.orderResult,t.uint32(66).fork()).ldelim(),e.updateRequestContext!==void 0&&ge.encode(e.updateRequestContext,t.uint32(74).fork()).ldelim(),e.screenshotRequest!==void 0&&ye.encode(e.screenshotRequest,t.uint32(82).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Fi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.id=n.string();continue;case 2:if(r!==18)break;i.formCanceled=me.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.formSubmitted=he.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.realtimeEvent=Ee.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.immersiveModeEvent=We.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.consentStatus=fe.decode(n,n.uint32());continue;case 8:if(r!==66)break;i.orderResult=le.decode(n,n.uint32());continue;case 9:if(r!==74)break;i.updateRequestContext=ge.decode(n,n.uint32());continue;case 10:if(r!==82)break;i.screenshotRequest=ye.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{id:x(e.id)?globalThis.String(e.id):"",formCanceled:x(e.formCanceled)?me.fromJSON(e.formCanceled):void 0,formSubmitted:x(e.formSubmitted)?he.fromJSON(e.formSubmitted):void 0,realtimeEvent:x(e.realtimeEvent)?Ee.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:x(e.immersiveModeEvent)?We.fromJSON(e.immersiveModeEvent):void 0,consentStatus:x(e.consentStatus)?fe.fromJSON(e.consentStatus):void 0,orderResult:x(e.orderResult)?le.fromJSON(e.orderResult):void 0,updateRequestContext:x(e.updateRequestContext)?ge.fromJSON(e.updateRequestContext):void 0,screenshotRequest:x(e.screenshotRequest)?ye.fromJSON(e.screenshotRequest):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=me.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=he.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=Ee.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(t.immersiveModeEvent=We.toJSON(e.immersiveModeEvent)),e.consentStatus!==void 0&&(t.consentStatus=fe.toJSON(e.consentStatus)),e.orderResult!==void 0&&(t.orderResult=le.toJSON(e.orderResult)),e.updateRequestContext!==void 0&&(t.updateRequestContext=ge.toJSON(e.updateRequestContext)),e.screenshotRequest!==void 0&&(t.screenshotRequest=ye.toJSON(e.screenshotRequest)),t},create(e){return ae.fromPartial(e??{})},fromPartial(e){let t=Fi();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?me.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?he.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?Ee.fromPartial(e.realtimeEvent):void 0,t.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?We.fromPartial(e.immersiveModeEvent):void 0,t.consentStatus=e.consentStatus!==void 0&&e.consentStatus!==null?fe.fromPartial(e.consentStatus):void 0,t.orderResult=e.orderResult!==void 0&&e.orderResult!==null?le.fromPartial(e.orderResult):void 0,t.updateRequestContext=e.updateRequestContext!==void 0&&e.updateRequestContext!==null?ge.fromPartial(e.updateRequestContext):void 0,t.screenshotRequest=e.screenshotRequest!==void 0&&e.screenshotRequest!==null?ye.fromPartial(e.screenshotRequest):void 0,t}};c.set(ae.$type,ae);function Wi(){return{data:void 0}}var Tn={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent",encode(e,t=C.default.Writer.create()){return e.data!==void 0&&qe.encode(e.data,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Wi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.data=qe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{data:x(e.data)?qe.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.data!==void 0&&(t.data=qe.toJSON(e.data)),t},create(e){return Tn.fromPartial(e??{})},fromPartial(e){let t=Wi();return t.data=e.data!==void 0&&e.data!==null?qe.fromPartial(e.data):void 0,t}};c.set(Tn.$type,Tn);function qi(){return{type:"",data:void 0}}var qe={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent.MessageData",encode(e,t=C.default.Writer.create()){return e.type!==""&&t.uint32(10).string(e.type),e.data!==void 0&&ae.encode(e.data,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=qi();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=ae.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{type:x(e.type)?globalThis.String(e.type):"",data:x(e.data)?ae.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.type!==""&&(t.type=e.type),e.data!==void 0&&(t.data=ae.toJSON(e.data)),t},create(e){return qe.fromPartial(e??{})},fromPartial(e){let t=qi();return t.type=e.type??"",t.data=e.data!==void 0&&e.data!==null?ae.fromPartial(e.data):void 0,t}};c.set(qe.$type,qe);function x(e){return e!=null}var $i="devvit-internal",ct=(e,t)=>{let n={...e,realtimeEffect:e.realtime,id:t,scope:pt.CLIENT,type:$i};(e.showToast||e.navigateToUrl)&&(n.effect=e),parent.postMessage(n,"*")},Gi=e=>new Promise(t=>{let n={...e,realtimeEffect:e.realtime,scope:pt.CLIENT,type:$i};(e.showForm||e.type===Z.EFFECT_CAN_RUN_AS_USER)&&(n.effect=e);let o=crypto.randomUUID();n.id=o;let i=r=>{if(r.data?.type==="devvit-message"&&r.data?.data?.id===o){let s=ae.fromJSON(r.data.data);t(s),removeEventListener("message",i)}};addEventListener("message",i),parent.postMessage(n,"*")});a();var it=class extends Error{};it.prototype.name="InvalidTokenError";function $o(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let o=n.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function Go(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return $o(t)}catch{return atob(t)}}function Rn(e,t){if(typeof e!="string")throw new it("Invalid token specified: must be a string");t||(t={});let n=t.header===!0?0:1,o=e.split(".")[n];if(typeof o!="string")throw new it(`Invalid token specified: missing part #${n+1}`);let i;try{i=Go(o)}catch(r){throw new it(`Invalid token specified: invalid base64 for part #${n+1} (${r.message})`)}try{return JSON.parse(i)}catch(r){throw new it(`Invalid token specified: invalid json for part #${n+1} (${r.message})`)}}function Zi(e){if(e)try{return Rn(e)?.devvit}catch(t){throw Error("token decode failure",{cause:t})}}function Hi(){setInterval(Zo,6e4)}async function Zo(){let{exp:e}=Rn(globalThis.devvit.token);e&&e-Date.now()/1e3>300||await Cn()}async function Cn(){let e=await Gi({type:Z.EFFECT_UPDATE_REQUEST_CONTEXT,updateRequestContext:{}});if(!e?.updateRequestContext?.signedRequestContext){console.error("Failed to refresh token");return}zi(e.updateRequestContext.signedRequestContext)}var Ki=(e,t,n)=>{let o=Ko(n.name,t.hash),i=Xo(o),r=o?.appPermissionState;i?.name==="ANDROID"&&(i.version.yyyy<2026||i.version.yyyy===2026&&i.version.release<=5)&&(r=void 0);let s=Zi(o.signedRequestContext),l;if(s?l=Ho(s,i,o.postData):o.webViewContext&&(l=zo(o.webViewContext,i,o.postData)),!l)throw Error("no context");let u=o.webViewClientData;globalThis.devvit={context:l,dependencies:{client:kn(e),webViewScripts:m},entrypoints:u?.appConfig?.entrypoints??{},share:o?.shareParam?{userData:o?.shareParam.userData}:void 0,appPermissionState:r,token:o.signedRequestContext||o.webbitToken,webViewMode:o?.viewMode,startTime:o?.startTime??void 0,refreshToken:Cn}};function Xi(e){devvit.webViewMode=e}function zi(e){globalThis.devvit.token=e}function Ho(e,t,n){if(!e.app)throw Error("no RequestContext.app");if(!e.post)throw Error("no RequestContext.post");if(!e.subreddit)throw Error("no RequestContext.subreddit");return{appName:e.app.name,appSlug:e.app.slug,appVersion:e.app.version,client:t,commentId:void 0,loid:e.user?.devvitLoid??e.user?.devvit_loid,postAuthorId:Rt(e.post.author),postData:n?.developerData,postId:Mt(e.post.id),snoovatar:e.user?.snoovatar,subredditId:Bt(e.subreddit.id),subredditName:e.subreddit.name,userId:e.user?.id?Rt(e.user.id):void 0,username:e.user?.name}}function zo(e,t,n){return{appName:e.appName,appSlug:e.appName,appVersion:e.appVersion,client:t,commentId:void 0,loid:void 0,postData:n?.developerData,postAuthorId:void 0,postId:Mt(e.postId),snoovatar:void 0,subredditId:Bt(e.subredditId),subredditName:e.subredditName,userId:e.userId?Rt(e.userId):void 0,username:void 0}}function Ko(e,t){if(e)return JSON.parse(e);let n=t?.slice(1);if(!n)throw Error("no bridge context");return JSON.parse(decodeURIComponent(n))}function Xo(e){if(!(e.client!==ot.ANDROID&&e.client!==ot.IOS||!e.nativeVersion))return{name:e.client===ot.ANDROID?"ANDROID":"IOS",version:e.nativeVersion}}a();async function Qo(e,t,n,o,i){let r=new Request(o,i);return Yo(n,new URL(r.url))&&r.headers.set("Authorization",`Bearer ${e.token}`),await t(r)}function Qi(){globalThis.fetch=Qo.bind(void 0,globalThis.devvit,globalThis.fetch,location)}function Yo(e,t){return t.origin===e.origin}a();var jo=new URL(Ut,On).toString();function es(e){let t=e?.trim();if(t)try{let n=new URL(t);if(n.pathname.endsWith(`/${Lt}`))return new URL(Ut,n).toString()}catch{}return jo}async function ts(e,t){let n=e.data;if(n?.type!=="devvit-message"||n.data==null)return;let o=n.data;if(o.screenshotRequest==null||typeof o.id!="string")return;let i,r;try{let s=es(t),{captureScreenshot:l}=await import(s);i=await l()}catch(s){r=s instanceof Error?s.message:String(s)}ct({type:Z.EFFECT_SCREENSHOT_RESPONSE,screenshot:{dataUrl:i,error:r}},o.id)}function Yi(e){addEventListener("message",t=>{ts(t,e)})}a();var Ge,D;function to(){ds(),ns(),rs()}function ns(){addEventListener("load",()=>{let e=performance.timeOrigin,t=performance.now(),n=performance.timeOrigin+t,o={event:"web-view-loaded",timeStart:e,timeEnd:n,duration:t};ct({type:Z.EFFECT_TELEMETRY,telemetry:{event:o.event,loaded:o},analytics:o})})}function rs(){document.addEventListener("click",e=>{let{definition:t,elemTrackId:n}=is(e.target,e.isTrusted),o={event:"click",definition:t,elemTrackId:n};ct({type:Z.EFFECT_TELEMETRY,telemetry:{event:o.event,click:o},analytics:o})},{passive:!0})}function is(e,t){let n=os(e);if(!n)return{definition:"default",elemTrackId:void 0};let o="default";t&&globalThis.window.getComputedStyle(n)?.getPropertyValue("cursor")==="pointer"&&(o="strict");let i,r=n;for(;r;){if(i===void 0){let s=r.getAttribute("data-track-id");s?i=s:r.id&&(i=r.id)}if(t&&o==="default"&&ss(r)&&(o="strict"),i!==void 0&&(!t||o==="strict"))break;r=r.parentElement}return{definition:o,elemTrackId:i}}function os(e){if(!e||typeof e!="object"||!("nodeType"in e))return;let t=e;return t.nodeType===1?t:t.parentElement??void 0}function ss(e){return["A","BUTTON","CANVAS","INPUT","SELECT","TEXTAREA","LABEL"].includes(e.tagName)||["true","plaintext-only"].includes(e.getAttribute("contenteditable")??"")}function ji(){let e=performance.getEntriesByType("navigation")[0];if(!(!D||!e))return{spanName:"web_view_time_to_first_byte",timeStart:D+e.requestStart,timeEnd:D+e.responseStart}}function us(){let t=performance.getEntriesByType("paint").find(n=>n.name==="first-contentful-paint");if(!(!t||!D))return{spanName:"web_view_first_contentful_paint",timeStart:D,timeEnd:D+t.startTime}}function as(){if(D)return{spanName:"web_view_load",timeStart:D,timeEnd:D+performance.now()}}function eo(){let t=performance.getEntriesByType("navigation")[0].domInteractive;if(!(!D||!t))return{spanName:"web_view_time_to_interactive",timeStart:D,timeEnd:D+t}}function ds(){if(Ge=[],D=globalThis.devvit?.startTime,!D)return;if(document.readyState==="complete"){let t=ji();t&&Ge.push(t)}let e=new PerformanceObserver(t=>{for(let n of t.getEntries())if(n.name==="first-contentful-paint"){let o=us();o&&Ge.push(o),e.disconnect()}});if(e.observe({entryTypes:["paint"]}),document.readyState==="loading")globalThis.addEventListener("DOMContentLoaded",()=>{let t=eo();t&&Ge.push(t)});else{let t=eo();t&&Ge.push(t)}globalThis.addEventListener("load",()=>{let t=ji();t&&Ge.push(t);let n=as();n&&Ge.push(n),ct({type:Z.EFFECT_TELEMETRY,telemetry:{metrics:{metrics:Ge}}})})}a();function no(){addEventListener("message",fs)}function fs(e){e.data?.type==="devvit-message"&&e.data?.data?.immersiveModeEvent&&Xi(e.data.data.immersiveModeEvent.immersiveMode)}Ki(document,location,window);to();Qi();Yi(wn(document)??"");Hi();no();})();
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
long/index.js:
|