@devvit/client 0.11.19-next-2025-07-16-18-06-50-d44a16b48.0 → 0.11.19-next-2025-07-16-18-16-01-52404fd1d.0

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