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