@devvit/client 0.12.1-next-2025-08-28-22-46-23-a75a7b355.0 → 0.12.1-next-2025-09-02-18-53-59-21f11c61a.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/effects/run-as-user.d.ts.map +1 -1
- package/effects/run-as-user.js +3 -0
- package/package.json +8 -8
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": 3890,
|
|
377
377
|
"imports": [
|
|
378
378
|
{
|
|
379
379
|
"path": "../../node_modules/protobufjs/minimal.js",
|
|
@@ -4949,7 +4949,7 @@
|
|
|
4949
4949
|
"format": "esm"
|
|
4950
4950
|
},
|
|
4951
4951
|
"../shared-types/dist/client/emit-effect.js": {
|
|
4952
|
-
"bytes":
|
|
4952
|
+
"bytes": 2714,
|
|
4953
4953
|
"imports": [
|
|
4954
4954
|
{
|
|
4955
4955
|
"path": "../protos/dist/types/devvit/ui/effects/web_view/v1alpha/immersive_mode.js",
|
|
@@ -4997,7 +4997,7 @@
|
|
|
4997
4997
|
"format": "esm"
|
|
4998
4998
|
},
|
|
4999
4999
|
"src/effects/run-as-user.ts": {
|
|
5000
|
-
"bytes":
|
|
5000
|
+
"bytes": 2014,
|
|
5001
5001
|
"imports": [
|
|
5002
5002
|
{
|
|
5003
5003
|
"path": "../protos/dist/json/reddit/devvit/app_permission/v1/app_permission.js",
|
|
@@ -5142,7 +5142,7 @@
|
|
|
5142
5142
|
"imports": [],
|
|
5143
5143
|
"exports": [],
|
|
5144
5144
|
"inputs": {},
|
|
5145
|
-
"bytes":
|
|
5145
|
+
"bytes": 471102
|
|
5146
5146
|
},
|
|
5147
5147
|
"dist/client.min.js": {
|
|
5148
5148
|
"imports": [],
|
|
@@ -5252,7 +5252,7 @@
|
|
|
5252
5252
|
"bytesInOutput": 6248
|
|
5253
5253
|
},
|
|
5254
5254
|
"../protos/dist/types/devvit/ui/effects/v1alpha/app_permission.js": {
|
|
5255
|
-
"bytesInOutput":
|
|
5255
|
+
"bytesInOutput": 1518
|
|
5256
5256
|
},
|
|
5257
5257
|
"../protos/dist/types/reddit/devvit/app_permission/v1/app_permission.js": {
|
|
5258
5258
|
"bytesInOutput": 11634
|
|
@@ -5285,7 +5285,7 @@
|
|
|
5285
5285
|
"bytesInOutput": 5338
|
|
5286
5286
|
},
|
|
5287
5287
|
"../shared-types/dist/client/emit-effect.js": {
|
|
5288
|
-
"bytesInOutput":
|
|
5288
|
+
"bytesInOutput": 589
|
|
5289
5289
|
},
|
|
5290
5290
|
"src/effects/immersive-mode.ts": {
|
|
5291
5291
|
"bytesInOutput": 571
|
|
@@ -5297,7 +5297,7 @@
|
|
|
5297
5297
|
"bytesInOutput": 411
|
|
5298
5298
|
},
|
|
5299
5299
|
"src/effects/run-as-user.ts": {
|
|
5300
|
-
"bytesInOutput":
|
|
5300
|
+
"bytesInOutput": 449
|
|
5301
5301
|
},
|
|
5302
5302
|
"../shared-types/dist/constants.js": {
|
|
5303
5303
|
"bytesInOutput": 26
|
|
@@ -5321,7 +5321,7 @@
|
|
|
5321
5321
|
"bytesInOutput": 140
|
|
5322
5322
|
}
|
|
5323
5323
|
},
|
|
5324
|
-
"bytes":
|
|
5324
|
+
"bytes": 104143
|
|
5325
5325
|
}
|
|
5326
5326
|
}
|
|
5327
5327
|
}
|
package/client.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var Ei=Object.create;var nn=Object.defineProperty;var vi=Object.getOwnPropertyDescriptor;var Ni=Object.getOwnPropertyNames;var bi=Object.getPrototypeOf,Ti=Object.prototype.hasOwnProperty;var _=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Oi=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ni(t))!Ti.call(e,i)&&i!==n&&nn(e,i,{get:()=>t[i],enumerable:!(o=vi(t,i))||o.enumerable});return e};var x=(e,t,n)=>(n=e!=null?Ei(bi(e)):{},Oi(t||!e||!e.__esModule?nn(n,"default",{value:e,enumerable:!0}):n,e));var dn=_((Wo,fn)=>{"use strict";fn.exports=Li;function Li(e,t){for(var n=new Array(arguments.length-1),o=0,i=2,r=!0;i<arguments.length;)n[o++]=arguments[i++];return new Promise(function(d,a){n[o]=function(l){if(r)if(r=!1,l)a(l);else{for(var N=new Array(arguments.length-1),y=0;y<N.length;)N[y++]=arguments[y];d.apply(null,N)}};try{e.apply(t||null,n)}catch(u){r&&(r=!1,a(u))}})}});var hn=_(pn=>{"use strict";var ut=pn;ut.length=function(t){var n=t.length;if(!n)return 0;for(var o=0;--n%4>1&&t.charAt(n)==="=";)++o;return Math.ceil(t.length*3)/4-o};var He=new Array(64),cn=new Array(123);for(X=0;X<64;)cn[He[X]=X<26?X+65:X<52?X+71:X<62?X-4:X-59|43]=X++;var X;ut.encode=function(t,n,o){for(var i=null,r=[],s=0,d=0,a;n<o;){var u=t[n++];switch(d){case 0:r[s++]=He[u>>2],a=(u&3)<<4,d=1;break;case 1:r[s++]=He[a|u>>4],a=(u&15)<<2,d=2;break;case 2:r[s++]=He[a|u>>6],r[s++]=He[u&63],d=0;break}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,r)),s=0)}return d&&(r[s++]=He[a],r[s++]=61,d===1&&(r[s++]=61)),i?(s&&i.push(String.fromCharCode.apply(String,r.slice(0,s))),i.join("")):String.fromCharCode.apply(String,r.slice(0,s))};var ln="invalid encoding";ut.decode=function(t,n,o){for(var i=o,r=0,s,d=0;d<t.length;){var a=t.charCodeAt(d++);if(a===61&&r>1)break;if((a=cn[a])===void 0)throw Error(ln);switch(r){case 0:s=a,r=1;break;case 1:n[o++]=s<<2|(a&48)>>4,s=a,r=2;break;case 2:n[o++]=(s&15)<<4|(a&60)>>2,s=a,r=3;break;case 3:n[o++]=(s&3)<<6|a,r=0;break}}if(r===1)throw Error(ln);return o-i};ut.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var gn=_((Go,mn)=>{"use strict";mn.exports=ft;function ft(){this._listeners={}}ft.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};ft.prototype.off=function(t,n){if(t===void 0)this._listeners={};else if(n===void 0)this._listeners[t]=[];else for(var o=this._listeners[t],i=0;i<o.length;)o[i].fn===n?o.splice(i,1):++i;return this};ft.prototype.emit=function(t){var n=this._listeners[t];if(n){for(var o=[],i=1;i<arguments.length;)o.push(arguments[i++]);for(i=0;i<n.length;)n[i].fn.apply(n[i++].ctx,o)}return this}});var Tn=_((qo,bn)=>{"use strict";bn.exports=Sn(Sn);function Sn(e){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function i(a,u,l){t[0]=a,u[l]=n[0],u[l+1]=n[1],u[l+2]=n[2],u[l+3]=n[3]}function r(a,u,l){t[0]=a,u[l]=n[3],u[l+1]=n[2],u[l+2]=n[1],u[l+3]=n[0]}e.writeFloatLE=o?i:r,e.writeFloatBE=o?r:i;function s(a,u){return n[0]=a[u],n[1]=a[u+1],n[2]=a[u+2],n[3]=a[u+3],t[0]}function d(a,u){return n[3]=a[u],n[2]=a[u+1],n[1]=a[u+2],n[0]=a[u+3],t[0]}e.readFloatLE=o?s:d,e.readFloatBE=o?d:s}():function(){function t(o,i,r,s){var d=i<0?1:0;if(d&&(i=-i),i===0)o(1/i>0?0:2147483648,r,s);else if(isNaN(i))o(2143289344,r,s);else if(i>34028234663852886e22)o((d<<31|2139095040)>>>0,r,s);else if(i<11754943508222875e-54)o((d<<31|Math.round(i/1401298464324817e-60))>>>0,r,s);else{var a=Math.floor(Math.log(i)/Math.LN2),u=Math.round(i*Math.pow(2,-a)*8388608)&8388607;o((d<<31|a+127<<23|u)>>>0,r,s)}}e.writeFloatLE=t.bind(null,yn),e.writeFloatBE=t.bind(null,En);function n(o,i,r){var s=o(i,r),d=(s>>31)*2+1,a=s>>>23&255,u=s&8388607;return a===255?u?NaN:d*(1/0):a===0?d*1401298464324817e-60*u:d*Math.pow(2,a-150)*(u+8388608)}e.readFloatLE=n.bind(null,vn),e.readFloatBE=n.bind(null,Nn)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function i(a,u,l){t[0]=a,u[l]=n[0],u[l+1]=n[1],u[l+2]=n[2],u[l+3]=n[3],u[l+4]=n[4],u[l+5]=n[5],u[l+6]=n[6],u[l+7]=n[7]}function r(a,u,l){t[0]=a,u[l]=n[7],u[l+1]=n[6],u[l+2]=n[5],u[l+3]=n[4],u[l+4]=n[3],u[l+5]=n[2],u[l+6]=n[1],u[l+7]=n[0]}e.writeDoubleLE=o?i:r,e.writeDoubleBE=o?r:i;function s(a,u){return n[0]=a[u],n[1]=a[u+1],n[2]=a[u+2],n[3]=a[u+3],n[4]=a[u+4],n[5]=a[u+5],n[6]=a[u+6],n[7]=a[u+7],t[0]}function d(a,u){return n[7]=a[u],n[6]=a[u+1],n[5]=a[u+2],n[4]=a[u+3],n[3]=a[u+4],n[2]=a[u+5],n[1]=a[u+6],n[0]=a[u+7],t[0]}e.readDoubleLE=o?s:d,e.readDoubleBE=o?d:s}():function(){function t(o,i,r,s,d,a){var u=s<0?1:0;if(u&&(s=-s),s===0)o(0,d,a+i),o(1/s>0?0:2147483648,d,a+r);else if(isNaN(s))o(0,d,a+i),o(2146959360,d,a+r);else if(s>17976931348623157e292)o(0,d,a+i),o((u<<31|2146435072)>>>0,d,a+r);else{var l;if(s<22250738585072014e-324)l=s/5e-324,o(l>>>0,d,a+i),o((u<<31|l/4294967296)>>>0,d,a+r);else{var N=Math.floor(Math.log(s)/Math.LN2);N===1024&&(N=1023),l=s*Math.pow(2,-N),o(l*4503599627370496>>>0,d,a+i),o((u<<31|N+1023<<20|l*1048576&1048575)>>>0,d,a+r)}}}e.writeDoubleLE=t.bind(null,yn,0,4),e.writeDoubleBE=t.bind(null,En,4,0);function n(o,i,r,s,d){var a=o(s,d+i),u=o(s,d+r),l=(u>>31)*2+1,N=u>>>20&2047,y=4294967296*(u&1048575)+a;return N===2047?y?NaN:l*(1/0):N===0?l*5e-324*y:l*Math.pow(2,N-1075)*(y+4503599627370496)}e.readDoubleLE=n.bind(null,vn,0,4),e.readDoubleBE=n.bind(null,Nn,4,0)}(),e}function yn(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 En(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 vn(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Nn(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var On=_((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 _n=_(In=>{"use strict";var St=In;St.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};St.read=function(t,n,o){var i=o-n;if(i<1)return"";for(var r=null,s=[],d=0,a;n<o;)a=t[n++],a<128?s[d++]=a:a>191&&a<224?s[d++]=(a&31)<<6|t[n++]&63:a>239&&a<365?(a=((a&7)<<18|(t[n++]&63)<<12|(t[n++]&63)<<6|t[n++]&63)-65536,s[d++]=55296+(a>>10),s[d++]=56320+(a&1023)):s[d++]=(a&15)<<12|(t[n++]&63)<<6|t[n++]&63,d>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,s)),d=0);return r?(d&&r.push(String.fromCharCode.apply(String,s.slice(0,d))),r.join("")):String.fromCharCode.apply(String,s.slice(0,d))};St.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 Fn=_((Ho,Cn)=>{"use strict";Cn.exports=Mi;function Mi(e,t,n){var o=n||8192,i=o>>>1,r=null,s=o;return function(a){if(a<1||a>i)return e(a);s+a>o&&(r=e(o),s=0);var u=t.call(r,s,s+=a);return s&7&&(s=(s|7)+1),u}}});var kn=_((Ko,Rn)=>{"use strict";Rn.exports=C;var je=pe();function C(e,t){this.lo=e>>>0,this.hi=t>>>0}var Be=C.zero=new C(0,0);Be.toNumber=function(){return 0};Be.zzEncode=Be.zzDecode=function(){return this};Be.length=function(){return 1};var Ui=C.zeroHash="\0\0\0\0\0\0\0\0";C.fromNumber=function(t){if(t===0)return Be;var n=t<0;n&&(t=-t);var o=t>>>0,i=(t-o)/4294967296>>>0;return n&&(i=~i>>>0,o=~o>>>0,++o>4294967295&&(o=0,++i>4294967295&&(i=0))),new C(o,i)};C.from=function(t){if(typeof t=="number")return C.fromNumber(t);if(je.isString(t))if(je.Long)t=je.Long.fromString(t);else return C.fromNumber(parseInt(t,10));return t.low||t.high?new C(t.low>>>0,t.high>>>0):Be};C.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var n=~this.lo+1>>>0,o=~this.hi>>>0;return n||(o=o+1>>>0),-(n+o*4294967296)}return this.lo+this.hi*4294967296};C.prototype.toLong=function(t){return je.Long?new je.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var ce=String.prototype.charCodeAt;C.fromHash=function(t){return t===Ui?Be:new C((ce.call(t,0)|ce.call(t,1)<<8|ce.call(t,2)<<16|ce.call(t,3)<<24)>>>0,(ce.call(t,4)|ce.call(t,5)<<8|ce.call(t,6)<<16|ce.call(t,7)<<24)>>>0)};C.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};C.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};C.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};C.prototype.length=function(){var t=this.lo,n=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?n===0?t<16384?t<128?1:2:t<2097152?3:4:n<16384?n<128?5:6:n<2097152?7:8:o<128?9:10}});var pe=_(yt=>{"use strict";var p=yt;p.asPromise=dn();p.base64=hn();p.EventEmitter=gn();p.float=Tn();p.inquire=On();p.utf8=_n();p.pool=Fn();p.LongBits=kn();p.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);p.global=p.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||yt;p.emptyArray=Object.freeze?Object.freeze([]):[];p.emptyObject=Object.freeze?Object.freeze({}):{};p.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};p.isString=function(t){return typeof t=="string"||t instanceof String};p.isObject=function(t){return t&&typeof t=="object"};p.isset=p.isSet=function(t,n){var o=t[n];return o!=null&&t.hasOwnProperty(n)?typeof o!="object"||(Array.isArray(o)?o.length:Object.keys(o).length)>0:!1};p.Buffer=function(){try{var e=p.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}}();p._Buffer_from=null;p._Buffer_allocUnsafe=null;p.newBuffer=function(t){return typeof t=="number"?p.Buffer?p._Buffer_allocUnsafe(t):new p.Array(t):p.Buffer?p._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};p.Array=typeof Uint8Array<"u"?Uint8Array:Array;p.Long=p.global.dcodeIO&&p.global.dcodeIO.Long||p.global.Long||p.inquire("long");p.key2Re=/^true|false|0|1$/;p.key32Re=/^-?(?:0|[1-9][0-9]*)$/;p.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;p.longToHash=function(t){return t?p.LongBits.from(t).toHash():p.LongBits.zeroHash};p.longFromHash=function(t,n){var o=p.LongBits.fromHash(t);return p.Long?p.Long.fromBits(o.lo,o.hi,n):o.toNumber(!!n)};function xn(e,t,n){for(var o=Object.keys(t),i=0;i<o.length;++i)(e[o[i]]===void 0||!n)&&(e[o[i]]=t[o[i]]);return e}p.merge=xn;p.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function wn(e){function t(n,o){if(!(this instanceof t))return new t(n,o);Object.defineProperty(this,"message",{get:function(){return n}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),o&&xn(this,o)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}p.newError=wn;p.ProtocolError=wn("ProtocolError");p.oneOfGetter=function(t){for(var n={},o=0;o<t.length;++o)n[t[o]]=1;return function(){for(var i=Object.keys(this),r=i.length-1;r>-1;--r)if(n[i[r]]===1&&this[i[r]]!==void 0&&this[i[r]]!==null)return i[r]}};p.oneOfSetter=function(t){return function(n){for(var o=0;o<t.length;++o)t[o]!==n&&delete this[t[o]]}};p.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};p._configure=function(){var e=p.Buffer;if(!e){p._Buffer_from=p._Buffer_allocUnsafe=null;return}p._Buffer_from=e.from!==Uint8Array.from&&e.from||function(n,o){return new e(n,o)},p._Buffer_allocUnsafe=e.allocUnsafe||function(n){return new e(n)}}});var It=_((Xo,Bn)=>{"use strict";Bn.exports=m;var $=pe(),Et,dt=$.LongBits,Vn=$.base64,Pn=$.utf8;function et(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function Nt(){}function Di(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function m(){this.len=0,this.head=new et(Nt,0,0),this.tail=this.head,this.states=null}var An=function(){return $.Buffer?function(){return(m.create=function(){return new Et})()}:function(){return new m}};m.create=An();m.alloc=function(t){return new $.Array(t)};$.Array!==Array&&(m.alloc=$.pool(m.alloc,$.Array.prototype.subarray));m.prototype._push=function(t,n,o){return this.tail=this.tail.next=new et(t,n,o),this.len+=n,this};function bt(e,t,n){t[n]=e&255}function Ji(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function Tt(e,t){this.len=e,this.next=void 0,this.val=t}Tt.prototype=Object.create(et.prototype);Tt.prototype.fn=Ji;m.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Tt((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(Ot,10,dt.fromNumber(t)):this.uint32(t)};m.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Ot(e,t,n){for(;e.hi;)t[n++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=e.lo&127|128,e.lo=e.lo>>>7;t[n++]=e.lo}m.prototype.uint64=function(t){var n=dt.from(t);return this._push(Ot,n.length(),n)};m.prototype.int64=m.prototype.uint64;m.prototype.sint64=function(t){var n=dt.from(t).zzEncode();return this._push(Ot,n.length(),n)};m.prototype.bool=function(t){return this._push(bt,1,t?1:0)};function vt(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(vt,4,t>>>0)};m.prototype.sfixed32=m.prototype.fixed32;m.prototype.fixed64=function(t){var n=dt.from(t);return this._push(vt,4,n.lo)._push(vt,4,n.hi)};m.prototype.sfixed64=m.prototype.fixed64;m.prototype.float=function(t){return this._push($.float.writeFloatLE,4,t)};m.prototype.double=function(t){return this._push($.float.writeDoubleLE,8,t)};var Wi=$.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(bt,1,0);if($.isString(t)){var o=m.alloc(n=Vn.length(t));Vn.decode(t,o,0),t=o}return this.uint32(n)._push(Wi,n,t)};m.prototype.string=function(t){var n=Pn.length(t);return n?this.uint32(n)._push(Pn.write,n,t):this._push(bt,1,0)};m.prototype.fork=function(){return this.states=new Di(this),this.head=this.tail=new et(Nt,0,0),this.len=0,this};m.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new et(Nt,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){Et=e,m.create=An(),Et._configure()}});var Un=_((Yo,Mn)=>{"use strict";Mn.exports=ee;var Ln=It();(ee.prototype=Object.create(Ln.prototype)).constructor=ee;var he=pe();function ee(){Ln.call(this)}ee._configure=function(){ee.alloc=he._Buffer_allocUnsafe,ee.writeBytesBuffer=he.Buffer&&he.Buffer.prototype instanceof Uint8Array&&he.Buffer.prototype.set.name==="set"?function(t,n,o){n.set(t,o)}:function(t,n,o){if(t.copy)t.copy(n,o,0,t.length);else for(var i=0;i<t.length;)n[o++]=t[i++]}};ee.prototype.bytes=function(t){he.isString(t)&&(t=he._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(ee.writeBytesBuffer,n,t),this};function $i(e,t,n){e.length<40?he.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}ee.prototype.string=function(t){var n=he.Buffer.byteLength(t);return this.uint32(n),n&&this._push($i,n,t),this};ee._configure()});var Ft=_((Qo,Gn)=>{"use strict";Gn.exports=O;var Y=pe(),Ct,Wn=Y.LongBits,Gi=Y.utf8;function Q(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function O(e){this.buf=e,this.pos=0,this.len=e.length}var Dn=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new O(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new O(t);throw Error("illegal buffer")},$n=function(){return Y.Buffer?function(n){return(O.create=function(i){return Y.Buffer.isBuffer(i)?new Ct(i):Dn(i)})(n)}:Dn};O.create=$n();O.prototype._slice=Y.Array.prototype.subarray||Y.Array.prototype.slice;O.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}}();O.prototype.int32=function(){return this.uint32()|0};O.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function _t(){var e=new Wn(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")}O.prototype.bool=function(){return this.uint32()!==0};function lt(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}O.prototype.fixed32=function(){if(this.pos+4>this.len)throw Q(this,4);return lt(this.buf,this.pos+=4)};O.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Q(this,4);return lt(this.buf,this.pos+=4)|0};function Jn(){if(this.pos+8>this.len)throw Q(this,8);return new Wn(lt(this.buf,this.pos+=4),lt(this.buf,this.pos+=4))}O.prototype.float=function(){if(this.pos+4>this.len)throw Q(this,4);var t=Y.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};O.prototype.double=function(){if(this.pos+8>this.len)throw Q(this,4);var t=Y.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};O.prototype.bytes=function(){var t=this.uint32(),n=this.pos,o=this.pos+t;if(o>this.len)throw Q(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(n,o);if(n===o){var i=Y.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,n,o)};O.prototype.string=function(){var t=this.bytes();return Gi.read(t,0,t.length)};O.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};O.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};O._configure=function(e){Ct=e,O.create=$n(),Ct._configure();var t=Y.Long?"toLong":"toNumber";Y.merge(O.prototype,{int64:function(){return _t.call(this)[t](!1)},uint64:function(){return _t.call(this)[t](!0)},sint64:function(){return _t.call(this).zzDecode()[t](!1)},fixed64:function(){return Jn.call(this)[t](!0)},sfixed64:function(){return Jn.call(this)[t](!1)}})}});var Kn=_((jo,Hn)=>{"use strict";Hn.exports=Le;var Zn=Ft();(Le.prototype=Object.create(Zn.prototype)).constructor=Le;var qn=pe();function Le(e){Zn.call(this,e)}Le._configure=function(){qn.Buffer&&(Le.prototype._slice=qn.Buffer.prototype.slice)};Le.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))};Le._configure()});var Xn=_((es,zn)=>{"use strict";zn.exports=tt;var Rt=pe();(tt.prototype=Object.create(Rt.EventEmitter.prototype)).constructor=tt;function tt(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");Rt.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}tt.prototype.rpcCall=function e(t,n,o,i,r){if(!i)throw TypeError("request must be specified");var s=this;if(!r)return Rt.asPromise(e,s,t,n,o,i);if(!s.rpcImpl){setTimeout(function(){r(Error("already ended"))},0);return}try{return s.rpcImpl(t,n[s.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(a,u){if(a)return s.emit("error",a,t),r(a);if(u===null){s.end(!0);return}if(!(u instanceof o))try{u=o[s.responseDelimited?"decodeDelimited":"decode"](u)}catch(l){return s.emit("error",l,t),r(l)}return s.emit("data",u,t),r(null,u)})}catch(d){s.emit("error",d,t),setTimeout(function(){r(d)},0);return}};tt.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Qn=_(Yn=>{"use strict";var qi=Yn;qi.Service=Xn()});var er=_((ns,jn)=>{"use strict";jn.exports={}});var rr=_(nr=>{"use strict";var w=nr;w.build="minimal";w.Writer=It();w.BufferWriter=Un();w.Reader=Ft();w.BufferReader=Kn();w.util=pe();w.rpc=Qn();w.roots=er();w.configure=tr;function tr(){w.util._configure(),w.Writer._configure(w.BufferWriter),w.Reader._configure(w.BufferReader)}tr()});var V=_((is,ir)=>{"use strict";ir.exports=rr()});var yr=_((ds,Sr)=>{Sr.exports=E;var q=null;try{q=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function E(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}E.prototype.__isLong__;Object.defineProperty(E.prototype,"__isLong__",{value:!0});function A(e){return(e&&e.__isLong__)===!0}E.isLong=A;var ur={},fr={};function Je(e,t){var n,o,i;return t?(e>>>=0,(i=0<=e&&e<256)&&(o=fr[e],o)?o:(n=v(e,(e|0)<0?-1:0,!0),i&&(fr[e]=n),n)):(e|=0,(i=-128<=e&&e<128)&&(o=ur[e],o)?o:(n=v(e,e<0?-1:0,!1),i&&(ur[e]=n),n))}E.fromInt=Je;function Z(e,t){if(isNaN(e))return t?De:H;if(t){if(e<0)return De;if(e>=pr)return gr}else{if(e<=-lr)return P;if(e+1>=lr)return mr}return e<0?Z(-e,t).neg():v(e%Xe|0,e/Xe|0,t)}E.fromNumber=Z;function v(e,t,n){return new E(e,t,n)}E.fromBits=v;var pt=Math.pow;function Lt(e,t,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return H;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 Lt(e.substring(1),t,n).neg();for(var i=Z(pt(n,8)),r=H,s=0;s<e.length;s+=8){var d=Math.min(8,e.length-s),a=parseInt(e.substring(s,s+d),n);if(d<8){var u=Z(pt(n,d));r=r.mul(u).add(Z(a))}else r=r.mul(i),r=r.add(Z(a))}return r.unsigned=t,r}E.fromString=Lt;function j(e,t){return typeof e=="number"?Z(e,t):typeof e=="string"?Lt(e,t):v(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}E.fromValue=j;var dr=65536,zi=1<<24,Xe=dr*dr,pr=Xe*Xe,lr=pr/2,cr=Je(zi),H=Je(0);E.ZERO=H;var De=Je(0,!0);E.UZERO=De;var ze=Je(1);E.ONE=ze;var hr=Je(1,!0);E.UONE=hr;var Bt=Je(-1);E.NEG_ONE=Bt;var mr=v(-1,2147483647,!1);E.MAX_VALUE=mr;var gr=v(-1,-1,!0);E.MAX_UNSIGNED_VALUE=gr;var P=v(0,-2147483648,!1);E.MIN_VALUE=P;var f=E.prototype;f.toInt=function(){return this.unsigned?this.low>>>0:this.low};f.toNumber=function(){return this.unsigned?(this.high>>>0)*Xe+(this.low>>>0):this.high*Xe+(this.low>>>0)};f.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(P)){var n=Z(t),o=this.div(n),i=o.mul(n).sub(this);return o.toString(t)+i.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var r=Z(pt(t,6),this.unsigned),s=this,d="";;){var a=s.div(r),u=s.sub(a.mul(r)).toInt()>>>0,l=u.toString(t);if(s=a,s.isZero())return l+d;for(;l.length<6;)l="0"+l;d=""+l+d}};f.getHighBits=function(){return this.high};f.getHighBitsUnsigned=function(){return this.high>>>0};f.getLowBits=function(){return this.low};f.getLowBitsUnsigned=function(){return this.low>>>0};f.getNumBitsAbs=function(){if(this.isNegative())return this.eq(P)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,n=31;n>0&&!(t&1<<n);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 A(t)||(t=j(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(A(t)||(t=j(t)),this.eq(t))return 0;var n=this.isNegative(),o=t.isNegative();return n&&!o?-1:!n&&o?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};f.comp=f.compare;f.negate=function(){return!this.unsigned&&this.eq(P)?P:this.not().add(ze)};f.neg=f.negate;f.add=function(t){A(t)||(t=j(t));var n=this.high>>>16,o=this.high&65535,i=this.low>>>16,r=this.low&65535,s=t.high>>>16,d=t.high&65535,a=t.low>>>16,u=t.low&65535,l=0,N=0,y=0,L=0;return L+=r+u,y+=L>>>16,L&=65535,y+=i+a,N+=y>>>16,y&=65535,N+=o+d,l+=N>>>16,N&=65535,l+=n+s,l&=65535,v(y<<16|L,l<<16|N,this.unsigned)};f.subtract=function(t){return A(t)||(t=j(t)),this.add(t.neg())};f.sub=f.subtract;f.multiply=function(t){if(this.isZero())return H;if(A(t)||(t=j(t)),q){var n=q.mul(this.low,this.high,t.low,t.high);return v(n,q.get_high(),this.unsigned)}if(t.isZero())return H;if(this.eq(P))return t.isOdd()?P:H;if(t.eq(P))return this.isOdd()?P:H;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(cr)&&t.lt(cr))return Z(this.toNumber()*t.toNumber(),this.unsigned);var o=this.high>>>16,i=this.high&65535,r=this.low>>>16,s=this.low&65535,d=t.high>>>16,a=t.high&65535,u=t.low>>>16,l=t.low&65535,N=0,y=0,L=0,st=0;return st+=s*l,L+=st>>>16,st&=65535,L+=r*l,y+=L>>>16,L&=65535,L+=s*u,y+=L>>>16,L&=65535,y+=i*l,N+=y>>>16,y&=65535,y+=r*u,N+=y>>>16,y&=65535,y+=s*a,N+=y>>>16,y&=65535,N+=o*l+i*u+r*a+s*d,N&=65535,v(L<<16|st,N<<16|y,this.unsigned)};f.mul=f.multiply;f.divide=function(t){if(A(t)||(t=j(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 v(n,q.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?De:H;var o,i,r;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return De;if(t.gt(this.shru(1)))return hr;r=De}else{if(this.eq(P)){if(t.eq(ze)||t.eq(Bt))return P;if(t.eq(P))return ze;var s=this.shr(1);return o=s.div(t).shl(1),o.eq(H)?t.isNegative()?ze:Bt:(i=this.sub(t.mul(o)),r=o.add(i.div(t)),r)}else if(t.eq(P))return this.unsigned?De:H;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=H}for(i=this;i.gte(t);){o=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var d=Math.ceil(Math.log(o)/Math.LN2),a=d<=48?1:pt(2,d-48),u=Z(o),l=u.mul(t);l.isNegative()||l.gt(i);)o-=a,u=Z(o,this.unsigned),l=u.mul(t);u.isZero()&&(u=ze),r=r.add(u),i=i.sub(l)}return r};f.div=f.divide;f.modulo=function(t){if(A(t)||(t=j(t)),q){var n=(this.unsigned?q.rem_u:q.rem_s)(this.low,this.high,t.low,t.high);return v(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 v(~this.low,~this.high,this.unsigned)};f.and=function(t){return A(t)||(t=j(t)),v(this.low&t.low,this.high&t.high,this.unsigned)};f.or=function(t){return A(t)||(t=j(t)),v(this.low|t.low,this.high|t.high,this.unsigned)};f.xor=function(t){return A(t)||(t=j(t)),v(this.low^t.low,this.high^t.high,this.unsigned)};f.shiftLeft=function(t){return A(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?v(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):v(0,this.low<<t-32,this.unsigned)};f.shl=f.shiftLeft;f.shiftRight=function(t){return A(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?v(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):v(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};f.shr=f.shiftRight;f.shiftRightUnsigned=function(t){if(A(t)&&(t=t.toInt()),t&=63,t===0)return this;var n=this.high;if(t<32){var o=this.low;return v(o>>>t|n<<32-t,n>>>t,this.unsigned)}else return t===32?v(n,0,this.unsigned):v(n>>>t-32,0,this.unsigned)};f.shru=f.shiftRightUnsigned;f.shr_u=f.shiftRightUnsigned;f.toSigned=function(){return this.unsigned?v(this.low,this.high,!1):this};f.toUnsigned=function(){return this.unsigned?this:v(this.low,this.high,!0)};f.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};f.toBytesLE=function(){var t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};f.toBytesBE=function(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};E.fromBytes=function(t,n,o){return o?E.fromBytesLE(t,n):E.fromBytesBE(t,n)};E.fromBytesLE=function(t,n){return new E(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};E.fromBytesBE=function(t,n){return new E(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)}});function at(e,t){if(!e)throw Error(t)}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 Ii(e){return e.startsWith(le.ACCOUNT)}function _i(e){return e.startsWith(le.LINK)}function Ci(e){return e.startsWith(le.SUBREDDIT)}function Fi(e){at(Ii(e),`Expected account id to start with ${le.ACCOUNT}, got ${e}}`)}function Ri(e){at(_i(e),`Expected link id to start with ${le.LINK}, got ${e}}`)}function ki(e){at(Ci(e),`Expected subreddit id to start with ${le.SUBREDDIT}, got ${e}}`)}function rn(e){return Fi(e),e}function on(e){return Ri(e),e}function sn(e){return ki(e),e}var an="0.0.0";var Ae=class extends Error{};Ae.prototype.name="InvalidTokenError";function xi(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 wi(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 xi(t)}catch{return atob(t)}}function un(e,t){if(typeof e!="string")throw new Ae("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 Ae(`Invalid token specified: missing part #${n+1}`);let i;try{i=wi(o)}catch(r){throw new Ae(`Invalid token specified: invalid base64 for part #${n+1} (${r.message})`)}try{return JSON.parse(i)}catch(r){throw new Ae(`Invalid token specified: invalid json for part #${n+1} (${r.message})`)}}var Vi=({search:e,hash:t})=>{let n=new URLSearchParams(e).get("context");if(n){let o=decodeURIComponent(n),i=JSON.parse(o),r=Pi(t),s=r?.webbitToken??new URLSearchParams(e).get("webbit_token"),d=s?Ai(s):void 0,a={subredditId:sn(i.subredditId),userId:i.userId?rn(i.userId):void 0,subredditName:i.subredditName,appName:i.appName,appVersion:i.appVersion,postId:on(i.postId),postData:d?.developerData};globalThis.devvit={context:a,share:r?.shareParam?{userData:r?.shareParam.userData}:void 0,appPermissionState:r?.appPermissionState}}};globalThis.location&&Vi(globalThis.location);function Pi(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 Ai(e){if(e===an)return;let t;try{t=un(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 Bi=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 ct=x(V(),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 xt(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 wt(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 or(){return{immersiveMode:0}}var kt={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,t=ct.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),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=or();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:Zi(e.immersiveMode)?xt(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=wt(e.immersiveMode)),t},create(e){return kt.fromPartial(e??{})},fromPartial(e){let t=or();return t.immersiveMode=e.immersiveMode??0,t}};c.set(kt.$type,kt);function Zi(e){return e!=null}var T=x(V(),1);var M=x(V(),1);var Ue;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ue||(Ue={}));function Hi(e){switch(e){case 0:case"NULL_VALUE":return Ue.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return Ue.UNRECOGNIZED}}function Ki(e){switch(e){case Ue.NULL_VALUE:return 0;case Ue.UNRECOGNIZED:default:return-1}}function Vt(){return{fields:{}}}var G={$type:"google.protobuf.Struct",encode(e,t=M.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&nt.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof M.default.Reader?e:M.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Vt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let s=nt.decode(n,n.uint32());s.value!==void 0&&(i.fields[s.key]=s.value);continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:ar(e.fields)?Object.entries(e.fields).reduce((t,[n,o])=>(t[n]=o,t),{}):{}}},toJSON(e){let t={};if(e.fields){let n=Object.entries(e.fields);n.length>0&&(t.fields={},n.forEach(([o,i])=>{t.fields[o]=i}))}return t},create(e){return G.fromPartial(e??{})},fromPartial(e){let t=Vt();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),{}),t},wrap(e){let t=Vt();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};c.set(G.$type,G);function sr(){return{key:"",value:void 0}}var nt={$type:"google.protobuf.Struct.FieldsEntry",encode(e,t=M.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&F.encode(F.wrap(e.value),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof M.default.Reader?e:M.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=sr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=F.unwrap(F.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:Ke(e.key)?globalThis.String(e.key):"",value:Ke(e?.value)?e.value:void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=e.value),t},create(e){return nt.fromPartial(e??{})},fromPartial(e){let t=sr();return t.key=e.key??"",t.value=e.value??void 0,t}};c.set(nt.$type,nt);function Pt(){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,t=M.default.Writer.create()){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&G.encode(G.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&Me.encode(Me.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof M.default.Reader?e:M.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Pt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.nullValue=n.int32();continue;case 2:if(r!==17)break;i.numberValue=n.double();continue;case 3:if(r!==26)break;i.stringValue=n.string();continue;case 4:if(r!==32)break;i.boolValue=n.bool();continue;case 5:if(r!==42)break;i.structValue=G.unwrap(G.decode(n,n.uint32()));continue;case 6:if(r!==50)break;i.listValue=Me.unwrap(Me.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{nullValue:Ke(e.nullValue)?Hi(e.nullValue):void 0,numberValue:Ke(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:Ke(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:Ke(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:ar(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=Ki(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 F.fromPartial(e??{})},fromPartial(e){let t=Pt();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=Pt();if(e===null)t.nullValue=Ue.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new globalThis.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};c.set(F.$type,F);function At(){return{values:[]}}var Me={$type:"google.protobuf.ListValue",encode(e,t=M.default.Writer.create()){for(let n of e.values)F.encode(F.wrap(n),t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof M.default.Reader?e:M.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=At();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(F.unwrap(F.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 Me.fromPartial(e??{})},fromPartial(e){let t=At();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=At();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};c.set(Me.$type,Me);function ar(e){return typeof e=="object"&&e!==null}function Ke(e){return e!=null}var Ge=x(V(),1);var S=x(V(),1);var Mt=x(yr(),1),We=x(V(),1);function Er(){return{seconds:0,nanos:0}}var $e={$type:"google.protobuf.Timestamp",encode(e,t=We.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 We.default.Reader?e:We.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Er();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.seconds=Xi(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:vr(e.seconds)?globalThis.Number(e.seconds):0,nanos:vr(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 $e.fromPartial(e??{})},fromPartial(e){let t=Er();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}};c.set($e.$type,$e);function Xi(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}We.default.util.Long!==Mt.default&&(We.default.util.Long=Mt.default,We.default.configure());function vr(e){return e!=null}var ne;(function(e){e[e.CONSENT_STATUS_UNKNOWN=0]="CONSENT_STATUS_UNKNOWN",e[e.REVOKED=1]="REVOKED",e[e.GRANTED=2]="GRANTED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ne||(ne={}));function qt(e){switch(e){case 0:case"CONSENT_STATUS_UNKNOWN":return ne.CONSENT_STATUS_UNKNOWN;case 1:case"REVOKED":return ne.REVOKED;case 2:case"GRANTED":return ne.GRANTED;case-1:case"UNRECOGNIZED":default:return ne.UNRECOGNIZED}}function Zt(e){switch(e){case ne.CONSENT_STATUS_UNKNOWN:return 0;case ne.REVOKED:return 1;case ne.GRANTED:return 2;case ne.UNRECOGNIZED:default:return-1}}var K;(function(e){e[e.SCOPE_UNKNOWN=0]="SCOPE_UNKNOWN",e[e.SUBMIT_POST=1]="SUBMIT_POST",e[e.SUBMIT_COMMENT=2]="SUBMIT_COMMENT",e[e.SUBSCRIBE_TO_SUBREDDIT=3]="SUBSCRIBE_TO_SUBREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(K||(K={}));function kr(e){switch(e){case 0:case"SCOPE_UNKNOWN":return K.SCOPE_UNKNOWN;case 1:case"SUBMIT_POST":return K.SUBMIT_POST;case 2:case"SUBMIT_COMMENT":return K.SUBMIT_COMMENT;case 3:case"SUBSCRIBE_TO_SUBREDDIT":return K.SUBSCRIBE_TO_SUBREDDIT;case-1:case"UNRECOGNIZED":default:return K.UNRECOGNIZED}}function xr(e){switch(e){case K.SCOPE_UNKNOWN:return 0;case K.SUBMIT_POST:return 1;case K.SUBMIT_COMMENT:return 2;case K.SUBSCRIBE_TO_SUBREDDIT:return 3;case K.UNRECOGNIZED:default:return-1}}function Nr(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}var me={$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&&$e.encode(Yi(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=Nr();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=wr($e.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:R(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:R(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>kr(t)):[],consentStatus:R(e.consentStatus)?qt(e.consentStatus):0,updatedAt:R(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=>xr(n))),e.consentStatus!==0&&(t.consentStatus=Zt(e.consentStatus)),e.updatedAt!==void 0&&(t.updatedAt=e.updatedAt.toISOString()),t},create(e){return me.fromPartial(e??{})},fromPartial(e){let t=Nr();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(me.$type,me);function br(){return{appSlug:"",appName:""}}var ge={$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=br();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:R(e.appSlug)?globalThis.String(e.appSlug):"",appName:R(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 ge.fromPartial(e??{})},fromPartial(e){let t=br();return t.appSlug=e.appSlug??"",t.appName=e.appName??"",t}};c.set(ge.$type,ge);function Tr(){return{userId:""}}var Ut={$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=Tr();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:R(e.userId)?globalThis.String(e.userId):""}},toJSON(e){let t={};return e.userId!==""&&(t.userId=e.userId),t},create(e){return Ut.fromPartial(e??{})},fromPartial(e){let t=Tr();return t.userId=e.userId??"",t}};c.set(Ut.$type,Ut);function Or(){return{appPermissions:[],devvitApps:[]}}var Dt={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,t=S.default.Writer.create()){for(let n of e.appPermissions)me.encode(n,t.uint32(10).fork()).ldelim();for(let n of e.devvitApps)ge.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=Or();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appPermissions.push(me.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.devvitApps.push(ge.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=>me.fromJSON(t)):[],devvitApps:globalThis.Array.isArray(e?.devvitApps)?e.devvitApps.map(t=>ge.fromJSON(t)):[]}},toJSON(e){let t={};return e.appPermissions?.length&&(t.appPermissions=e.appPermissions.map(n=>me.toJSON(n))),e.devvitApps?.length&&(t.devvitApps=e.devvitApps.map(n=>ge.toJSON(n))),t},create(e){return Dt.fromPartial(e??{})},fromPartial(e){let t=Or();return t.appPermissions=e.appPermissions?.map(n=>me.fromPartial(n))||[],t.devvitApps=e.devvitApps?.map(n=>ge.fromPartial(n))||[],t}};c.set(Dt.$type,Dt);function Ir(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}var Jt={$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=Ir();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:R(e.userId)?globalThis.String(e.userId):"",appSlug:R(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:R(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>kr(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=>xr(n))),t},create(e){return Jt.fromPartial(e??{})},fromPartial(e){let t=Ir();return t.userId=e.userId??"",t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t}};c.set(Jt.$type,Jt);function _r(){return{error:void 0}}var Wt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode(e,t=S.default.Writer.create()){return e.error!==void 0&&U.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=_r();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.error=U.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:R(e.error)?U.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=U.toJSON(e.error)),t},create(e){return Wt.fromPartial(e??{})},fromPartial(e){let t=_r();return t.error=e.error!==void 0&&e.error!==null?U.fromPartial(e.error):void 0,t}};c.set(Wt.$type,Wt);function Cr(){return{appSlug:"",userId:"",subredditId:""}}var $t={$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=Cr();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:R(e.appSlug)?globalThis.String(e.appSlug):"",userId:R(e.userId)?globalThis.String(e.userId):"",subredditId:R(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 $t.fromPartial(e??{})},fromPartial(e){let t=Cr();return t.appSlug=e.appSlug??"",t.userId=e.userId??"",t.subredditId=e.subredditId??"",t}};c.set($t.$type,$t);function Fr(){return{error:void 0}}var Gt={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode(e,t=S.default.Writer.create()){return e.error!==void 0&&U.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof 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.error=U.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:R(e.error)?U.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=U.toJSON(e.error)),t},create(e){return Gt.fromPartial(e??{})},fromPartial(e){let t=Fr();return t.error=e.error!==void 0&&e.error!==null?U.fromPartial(e.error):void 0,t}};c.set(Gt.$type,Gt);function Rr(){return{message:""}}var U={$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=Rr();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:R(e.message)?globalThis.String(e.message):""}},toJSON(e){let t={};return e.message!==""&&(t.message=e.message),t},create(e){return U.fromPartial(e??{})},fromPartial(e){let t=Rr();return t.message=e.message??"",t}};c.set(U.$type,U);function Yi(e){let t=Math.trunc(e.getTime()/1e3),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function wr(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):wr($e.fromJSON(e))}function R(e){return e!=null}function Vr(){return{}}var Ht={$type:"devvit.ui.effects.v1alpha.CanRunAsUserEffect",encode(e,t=Ge.default.Writer.create()){return t},decode(e,t){let n=e instanceof Ge.default.Reader?e:Ge.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=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 Ht.fromPartial(e??{})},fromPartial(e){return Vr()}};c.set(Ht.$type,Ht);function Pr(){return{consentStatus:0}}var ie={$type:"devvit.ui.effects.v1alpha.ConsentStatusEvent",encode(e,t=Ge.default.Writer.create()){return e.consentStatus!==0&&t.uint32(8).int32(e.consentStatus),t},decode(e,t){let n=e instanceof Ge.default.Reader?e:Ge.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Pr();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:ji(e.consentStatus)?qt(e.consentStatus):0}},toJSON(e){let t={};return e.consentStatus!==0&&(t.consentStatus=Zt(e.consentStatus)),t},create(e){return ie.fromPartial(e??{})},fromPartial(e){let t=Pr();return t.consentStatus=e.consentStatus??0,t}};c.set(ie.$type,ie);function ji(e){return e!=null}var Ze=x(V(),1);var qe=x(V(),1);var ht=x(V(),1);function Ar(){return{}}var mt={$type:"google.protobuf.Empty",encode(e,t=ht.default.Writer.create()){return 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=Ar();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 mt.fromPartial(e??{})},fromPartial(e){return Ar()}};c.set(mt.$type,mt);function Br(){return{channels:[]}}var Kt={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=qe.default.Writer.create()){for(let n of e.channels)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof qe.default.Reader?e:qe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Br();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.channels.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channels:globalThis.Array.isArray(e?.channels)?e.channels.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.channels?.length&&(t.channels=e.channels),t},create(e){return Kt.fromPartial(e??{})},fromPartial(e){let t=Br();return t.channels=e.channels?.map(n=>n)||[],t}};c.set(Kt.$type,Kt);function Lr(){return{channel:"",data:void 0}}var oe={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=qe.default.Writer.create()){return e.channel!==""&&t.uint32(10).string(e.channel),e.data!==void 0&&G.encode(G.wrap(e.data),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof qe.default.Reader?e:qe.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.channel=n.string();continue;case 2:if(r!==18)break;i.data=G.unwrap(G.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channel:to(e.channel)?globalThis.String(e.channel):"",data:eo(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 oe.fromPartial(e??{})},fromPartial(e){let t=Lr();return t.channel=e.channel??"",t.data=e.data??void 0,t}};c.set(oe.$type,oe);function eo(e){return typeof e=="object"&&e!==null}function to(e){return e!=null}var Se;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Se||(Se={}));function no(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return Se.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return Se.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return Se.UNRECOGNIZED}}function ro(e){switch(e){case Se.REALTIME_SUBSCRIBED:return 0;case Se.REALTIME_UNSUBSCRIBED:return 1;case Se.UNRECOGNIZED:default:return-1}}function Mr(){return{subscriptionIds:[]}}var zt={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=Ze.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof Ze.default.Reader?e:Ze.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Mr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.subscriptionIds.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{subscriptionIds:globalThis.Array.isArray(e?.subscriptionIds)?e.subscriptionIds.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.subscriptionIds?.length&&(t.subscriptionIds=e.subscriptionIds),t},create(e){return zt.fromPartial(e??{})},fromPartial(e){let t=Mr();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};c.set(zt.$type,zt);function Ur(){return{event:void 0,status:void 0}}var se={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=Ze.default.Writer.create()){return e.event!==void 0&&oe.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 Ze.default.Reader?e:Ze.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ur();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.event=oe.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:Dr(e.event)?oe.fromJSON(e.event):void 0,status:Dr(e.status)?no(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=oe.toJSON(e.event)),e.status!==void 0&&(t.status=ro(e.status)),t},create(e){return se.fromPartial(e??{})},fromPartial(e){let t=Ur();return t.event=e.event!==void 0&&e.event!==null?oe.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};c.set(se.$type,se);function Dr(e){return e!=null}var W=x(V(),1);var gt=x(V(),1);var g=x(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 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 Qe(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=x(V(),1);function Jr(){return{fieldType:0,isSecret:void 0,stringValue:void 0,numberValue:void 0,boolValue:void 0,listValue:void 0,selectionValue:void 0,groupValue:void 0}}var b={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,t=D.default.Writer.create()){return e.fieldType!==0&&t.uint32(8).int32(e.fieldType),e.isSecret!==void 0&&t.uint32(800).bool(e.isSecret),e.stringValue!==void 0&&t.uint32(18).string(e.stringValue),e.numberValue!==void 0&&t.uint32(25).double(e.numberValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.listValue!==void 0&&ye.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&Ee.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&ve.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=Jr();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=ye.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionValue=Ee.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupValue=ve.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldType:ae(e.fieldType)?Ye(e.fieldType):0,isSecret:ae(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:ae(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:ae(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:ae(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:ae(e.listValue)?ye.fromJSON(e.listValue):void 0,selectionValue:ae(e.selectionValue)?Ee.fromJSON(e.selectionValue):void 0,groupValue:ae(e.groupValue)?ve.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=Qe(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=ye.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=Ee.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=ve.toJSON(e.groupValue)),t},create(e){return b.fromPartial(e??{})},fromPartial(e){let t=Jr();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?ye.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?Ee.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?ve.fromPartial(e.groupValue):void 0,t}};c.set(b.$type,b);function Wr(){return{itemType:0,items:[]}}var ye={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=D.default.Writer.create()){e.itemType!==0&&t.uint32(8).int32(e.itemType);for(let n of e.items)b.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof D.default.Reader?e:D.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Wr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.items.push(b.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:ae(e.itemType)?Ye(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(t=>b.fromJSON(t)):[]}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Qe(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>b.toJSON(n))),t},create(e){return ye.fromPartial(e??{})},fromPartial(e){let t=Wr();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>b.fromPartial(n))||[],t}};c.set(ye.$type,ye);function $r(){return{values:[]}}var Ee={$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=$r();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 Ee.fromPartial(e??{})},fromPartial(e){let t=$r();return t.values=e.values?.map(n=>n)||[],t}};c.set(Ee.$type,Ee);function Gr(){return{}}var ve={$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=Gr();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 ve.fromPartial(e??{})},fromPartial(e){return Gr()}};c.set(ve.$type,ve);function ae(e){return e!=null}function qr(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var B={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,t=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&&b.encode(e.defaultValue,t.uint32(42).fork()).ldelim(),e.required!==void 0&&t.uint32(48).bool(e.required),e.disabled!==void 0&&t.uint32(56).bool(e.disabled),e.fieldConfig!==void 0&&J.encode(e.fieldConfig,t.uint32(66).fork()).ldelim(),e.isSecret!==void 0&&t.uint32(72).bool(e.isSecret),t},decode(e,t){let n=e instanceof 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.fieldId=n.string();continue;case 2:if(r!==16)break;i.fieldType=n.int32();continue;case 3:if(r!==26)break;i.label=n.string();continue;case 4:if(r!==34)break;i.helpText=n.string();continue;case 5:if(r!==42)break;i.defaultValue=b.decode(n,n.uint32());continue;case 6:if(r!==48)break;i.required=n.bool();continue;case 7:if(r!==56)break;i.disabled=n.bool();continue;case 8:if(r!==66)break;i.fieldConfig=J.decode(n,n.uint32());continue;case 9:if(r!==72)break;i.isSecret=n.bool();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldId:h(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:h(e.fieldType)?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)?b.fromJSON(e.defaultValue):void 0,required:h(e.required)?globalThis.Boolean(e.required):void 0,disabled:h(e.disabled)?globalThis.Boolean(e.disabled):void 0,fieldConfig:h(e.fieldConfig)?J.fromJSON(e.fieldConfig):void 0,isSecret:h(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let t={};return e.fieldId!==""&&(t.fieldId=e.fieldId),e.fieldType!==0&&(t.fieldType=Qe(e.fieldType)),e.label!==""&&(t.label=e.label),e.helpText!==void 0&&(t.helpText=e.helpText),e.defaultValue!==void 0&&(t.defaultValue=b.toJSON(e.defaultValue)),e.required!==void 0&&(t.required=e.required),e.disabled!==void 0&&(t.disabled=e.disabled),e.fieldConfig!==void 0&&(t.fieldConfig=J.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return B.fromPartial(e??{})},fromPartial(e){let t=qr();return t.fieldId=e.fieldId??"",t.fieldType=e.fieldType??0,t.label=e.label??"",t.helpText=e.helpText??void 0,t.defaultValue=e.defaultValue!==void 0&&e.defaultValue!==null?b.fromPartial(e.defaultValue):void 0,t.required=e.required??void 0,t.disabled=e.disabled??void 0,t.fieldConfig=e.fieldConfig!==void 0&&e.fieldConfig!==null?J.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};c.set(B.$type,B);function Zr(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var J={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=g.default.Writer.create()){return e.stringConfig!==void 0&&Ne.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&be.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&Te.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&Oe.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&Ie.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&_e.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&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=Zr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.stringConfig=Ne.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.paragraphConfig=be.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.numberConfig=Te.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.booleanConfig=Oe.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.listConfig=Ie.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionConfig=_e.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupConfig=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)?Ne.fromJSON(e.stringConfig):void 0,paragraphConfig:h(e.paragraphConfig)?be.fromJSON(e.paragraphConfig):void 0,numberConfig:h(e.numberConfig)?Te.fromJSON(e.numberConfig):void 0,booleanConfig:h(e.booleanConfig)?Oe.fromJSON(e.booleanConfig):void 0,listConfig:h(e.listConfig)?Ie.fromJSON(e.listConfig):void 0,selectionConfig:h(e.selectionConfig)?_e.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=Ne.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=be.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=Te.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=Oe.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=Ie.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=_e.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=Fe.toJSON(e.groupConfig)),t},create(e){return J.fromPartial(e??{})},fromPartial(e){let t=Zr();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?Ne.fromPartial(e.stringConfig):void 0,t.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?be.fromPartial(e.paragraphConfig):void 0,t.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?Te.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?Oe.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?Ie.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?_e.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?Fe.fromPartial(e.groupConfig):void 0,t}};c.set(J.$type,J);function Hr(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var Ne={$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=Hr();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 Ne.fromPartial(e??{})},fromPartial(e){let t=Hr();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(Ne.$type,Ne);function Kr(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var be={$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=Kr();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 be.fromPartial(e??{})},fromPartial(e){let t=Kr();return t.maxCharacters=e.maxCharacters??void 0,t.lineHeight=e.lineHeight??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(be.$type,be);function zr(){return{step:void 0,min:void 0,max:void 0}}var Te={$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 Te.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(Te.$type,Te);function Xr(){return{}}var Oe={$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=Xr();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 Oe.fromPartial(e??{})},fromPartial(e){return Xr()}};c.set(Oe.$type,Oe);function Yr(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var Ie={$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&&J.encode(e.itemConfig,t.uint32(18).fork()).ldelim(),e.minEntries!==void 0&&t.uint32(24).int32(e.minEntries),e.maxEntries!==void 0&&t.uint32(32).int32(e.maxEntries),e.entryLabel!==void 0&&t.uint32(42).string(e.entryLabel),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Yr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.itemConfig=J.decode(n,n.uint32());continue;case 3:if(r!==24)break;i.minEntries=n.int32();continue;case 4:if(r!==32)break;i.maxEntries=n.int32();continue;case 5:if(r!==42)break;i.entryLabel=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:h(e.itemType)?Ye(e.itemType):0,itemConfig:h(e.itemConfig)?J.fromJSON(e.itemConfig):void 0,minEntries:h(e.minEntries)?globalThis.Number(e.minEntries):void 0,maxEntries:h(e.maxEntries)?globalThis.Number(e.maxEntries):void 0,entryLabel:h(e.entryLabel)?globalThis.String(e.entryLabel):void 0}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Qe(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=J.toJSON(e.itemConfig)),e.minEntries!==void 0&&(t.minEntries=Math.round(e.minEntries)),e.maxEntries!==void 0&&(t.maxEntries=Math.round(e.maxEntries)),e.entryLabel!==void 0&&(t.entryLabel=e.entryLabel),t},create(e){return Ie.fromPartial(e??{})},fromPartial(e){let t=Yr();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?J.fromPartial(e.itemConfig):void 0,t.minEntries=e.minEntries??void 0,t.maxEntries=e.maxEntries??void 0,t.entryLabel=e.entryLabel??void 0,t}};c.set(Ie.$type,Ie);function Qr(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var _e={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=g.default.Writer.create()){for(let n of e.choices)Ce.encode(n,t.uint32(10).fork()).ldelim();return e.multiSelect!==void 0&&t.uint32(16).bool(e.multiSelect),e.minSelections!==void 0&&t.uint32(24).int32(e.minSelections),e.maxSelections!==void 0&&t.uint32(32).int32(e.maxSelections),e.renderAsList!==void 0&&t.uint32(40).bool(e.renderAsList),t},decode(e,t){let n=e instanceof 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.choices.push(Ce.decode(n,n.uint32()));continue;case 2:if(r!==16)break;i.multiSelect=n.bool();continue;case 3:if(r!==24)break;i.minSelections=n.int32();continue;case 4:if(r!==32)break;i.maxSelections=n.int32();continue;case 5:if(r!==40)break;i.renderAsList=n.bool();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{choices:globalThis.Array.isArray(e?.choices)?e.choices.map(t=>Ce.fromJSON(t)):[],multiSelect:h(e.multiSelect)?globalThis.Boolean(e.multiSelect):void 0,minSelections:h(e.minSelections)?globalThis.Number(e.minSelections):void 0,maxSelections:h(e.maxSelections)?globalThis.Number(e.maxSelections):void 0,renderAsList:h(e.renderAsList)?globalThis.Boolean(e.renderAsList):void 0}},toJSON(e){let t={};return e.choices?.length&&(t.choices=e.choices.map(n=>Ce.toJSON(n))),e.multiSelect!==void 0&&(t.multiSelect=e.multiSelect),e.minSelections!==void 0&&(t.minSelections=Math.round(e.minSelections)),e.maxSelections!==void 0&&(t.maxSelections=Math.round(e.maxSelections)),e.renderAsList!==void 0&&(t.renderAsList=e.renderAsList),t},create(e){return _e.fromPartial(e??{})},fromPartial(e){let t=Qr();return t.choices=e.choices?.map(n=>Ce.fromPartial(n))||[],t.multiSelect=e.multiSelect??void 0,t.minSelections=e.minSelections??void 0,t.maxSelections=e.maxSelections??void 0,t.renderAsList=e.renderAsList??void 0,t}};c.set(_e.$type,_e);function jr(){return{label:"",value:""}}var Ce={$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=jr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.label=n.string();continue;case 2:if(r!==18)break;i.value=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{label:h(e.label)?globalThis.String(e.label):"",value:h(e.value)?globalThis.String(e.value):""}},toJSON(e){let t={};return e.label!==""&&(t.label=e.label),e.value!==""&&(t.value=e.value),t},create(e){return Ce.fromPartial(e??{})},fromPartial(e){let t=jr();return t.label=e.label??"",t.value=e.value??"",t}};c.set(Ce.$type,Ce);function ei(){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)B.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=ei();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(B.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>B.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>B.toJSON(n))),t},create(e){return Fe.fromPartial(e??{})},fromPartial(e){let t=ei();return t.fields=e.fields?.map(n=>B.fromPartial(n))||[],t}};c.set(Fe.$type,Fe);function h(e){return e!=null}function ti(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var ue={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=gt.default.Writer.create()){for(let n of e.fields)B.encode(n,t.uint32(10).fork()).ldelim();return e.title!==void 0&&t.uint32(18).string(e.title),e.shortDescription!==void 0&&t.uint32(26).string(e.shortDescription),e.acceptLabel!==void 0&&t.uint32(34).string(e.acceptLabel),e.cancelLabel!==void 0&&t.uint32(42).string(e.cancelLabel),e.id!==void 0&&t.uint32(50).string(e.id),t},decode(e,t){let n=e instanceof gt.default.Reader?e:gt.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.fields.push(B.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.title=n.string();continue;case 3:if(r!==26)break;i.shortDescription=n.string();continue;case 4:if(r!==34)break;i.acceptLabel=n.string();continue;case 5:if(r!==42)break;i.cancelLabel=n.string();continue;case 6:if(r!==50)break;i.id=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>B.fromJSON(t)):[],title:rt(e.title)?globalThis.String(e.title):void 0,shortDescription:rt(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:rt(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:rt(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:rt(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>B.toJSON(n))),e.title!==void 0&&(t.title=e.title),e.shortDescription!==void 0&&(t.shortDescription=e.shortDescription),e.acceptLabel!==void 0&&(t.acceptLabel=e.acceptLabel),e.cancelLabel!==void 0&&(t.cancelLabel=e.cancelLabel),e.id!==void 0&&(t.id=e.id),t},create(e){return ue.fromPartial(e??{})},fromPartial(e){let t=ti();return t.fields=e.fields?.map(n=>B.fromPartial(n))||[],t.title=e.title??void 0,t.shortDescription=e.shortDescription??void 0,t.acceptLabel=e.acceptLabel??void 0,t.cancelLabel=e.cancelLabel??void 0,t.id=e.id??void 0,t}};c.set(ue.$type,ue);function rt(e){return e!=null}function ni(){return{form:void 0}}var Xt={$type:"devvit.ui.effects.v1alpha.ShowFormEffect",encode(e,t=W.default.Writer.create()){return e.form!==void 0&&ue.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ni();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.form=ue.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{form:ot(e.form)?ue.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=ue.toJSON(e.form)),t},create(e){return Xt.fromPartial(e??{})},fromPartial(e){let t=ni();return t.form=e.form!==void 0&&e.form!==null?ue.fromPartial(e.form):void 0,t}};c.set(Xt.$type,Xt);function ri(){return{results:{},formId:void 0}}var fe={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent",encode(e,t=W.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{it.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),e.formId!==void 0&&t.uint32(18).string(e.formId),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.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;let s=it.decode(n,n.uint32());s.value!==void 0&&(i.results[s.key]=s.value);continue;case 2:if(r!==18)break;i.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{results:io(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=b.fromJSON(o),t),{}):{},formId:ot(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let t={};if(e.results){let n=Object.entries(e.results);n.length>0&&(t.results={},n.forEach(([o,i])=>{t.results[o]=b.toJSON(i)}))}return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return fe.fromPartial(e??{})},fromPartial(e){let t=ri();return t.results=Object.entries(e.results??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=b.fromPartial(i)),n),{}),t.formId=e.formId??void 0,t}};c.set(fe.$type,fe);function ii(){return{key:"",value:void 0}}var it={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=W.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&b.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ii();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=b.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:ot(e.key)?globalThis.String(e.key):"",value:ot(e.value)?b.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=b.toJSON(e.value)),t},create(e){return it.fromPartial(e??{})},fromPartial(e){let t=ii();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?b.fromPartial(e.value):void 0,t}};c.set(it.$type,it);function oi(){return{formId:void 0}}var de={$type:"devvit.ui.effects.v1alpha.FormCanceledEvent",encode(e,t=W.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=oi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{formId:ot(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let t={};return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return de.fromPartial(e??{})},fromPartial(e){let t=oi();return t.formId=e.formId??void 0,t}};c.set(de.$type,de);function io(e){return typeof e=="object"&&e!==null}function ot(e){return e!=null}var Ve;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ve||(Ve={}));function oo(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return Ve.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return Ve.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return Ve.UNRECOGNIZED}}function so(e){switch(e){case Ve.WEBVIEW_VISIBLE:return 0;case Ve.WEBVIEW_HIDDEN:return 1;case Ve.UNRECOGNIZED:default:return-1}}function si(){return{message:void 0,jsonString:""}}var Re={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=T.default.Writer.create()){return e.message!==void 0&&F.encode(F.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=si();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.message=F.unwrap(F.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 Re.fromPartial(e??{})},fromPartial(e){let t=si();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};c.set(Re.$type,Re);function ai(){return{visibility:0}}var ke={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=T.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ai();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)?oo(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=so(e.visibility)),t},create(e){return ke.fromPartial(e??{})},fromPartial(e){let t=ai();return t.visibility=e.visibility??0,t}};c.set(ke.$type,ke);function ui(){return{postMessage:void 0,fullScreen:void 0}}var Yt={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=T.default.Writer.create()){return e.postMessage!==void 0&&Re.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&ke.encode(e.fullScreen,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ui();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postMessage=Re.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.fullScreen=ke.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)?Re.fromJSON(e.postMessage):void 0,fullScreen:k(e.fullScreen)?ke.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=Re.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=ke.toJSON(e.fullScreen)),t},create(e){return Yt.fromPartial(e??{})},fromPartial(e){let t=ui();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?Re.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?ke.fromPartial(e.fullScreen):void 0,t}};c.set(Yt.$type,Yt);function fi(){return{immersiveMode:0}}var xe={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode(e,t=T.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=fi();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)?xt(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=wt(e.immersiveMode)),t},create(e){return xe.fromPartial(e??{})},fromPartial(e){let t=fi();return t.immersiveMode=e.immersiveMode??0,t}};c.set(xe.$type,xe);function di(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,consentStatus:void 0}}var re={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=T.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&de.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&fe.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&se.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&xe.encode(e.immersiveModeEvent,t.uint32(42).fork()).ldelim(),e.consentStatus!==void 0&&ie.encode(e.consentStatus,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=di();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=de.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.formSubmitted=fe.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.realtimeEvent=se.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.immersiveModeEvent=xe.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.consentStatus=ie.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)?de.fromJSON(e.formCanceled):void 0,formSubmitted:k(e.formSubmitted)?fe.fromJSON(e.formSubmitted):void 0,realtimeEvent:k(e.realtimeEvent)?se.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:k(e.immersiveModeEvent)?xe.fromJSON(e.immersiveModeEvent):void 0,consentStatus:k(e.consentStatus)?ie.fromJSON(e.consentStatus):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=de.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=fe.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=se.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(t.immersiveModeEvent=xe.toJSON(e.immersiveModeEvent)),e.consentStatus!==void 0&&(t.consentStatus=ie.toJSON(e.consentStatus)),t},create(e){return re.fromPartial(e??{})},fromPartial(e){let t=di();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?de.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?fe.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?se.fromPartial(e.realtimeEvent):void 0,t.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?xe.fromPartial(e.immersiveModeEvent):void 0,t.consentStatus=e.consentStatus!==void 0&&e.consentStatus!==null?ie.fromPartial(e.consentStatus):void 0,t}};c.set(re.$type,re);function li(){return{data:void 0}}var Qt={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent",encode(e,t=T.default.Writer.create()){return e.data!==void 0&&we.encode(e.data,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=li();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.data=we.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{data:k(e.data)?we.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.data!==void 0&&(t.data=we.toJSON(e.data)),t},create(e){return Qt.fromPartial(e??{})},fromPartial(e){let t=li();return t.data=e.data!==void 0&&e.data!==null?we.fromPartial(e.data):void 0,t}};c.set(Qt.$type,Qt);function ci(){return{type:"",data:void 0}}var we={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent.MessageData",encode(e,t=T.default.Writer.create()){return e.type!==""&&t.uint32(10).string(e.type),e.data!==void 0&&re.encode(e.data,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ci();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.type=n.string();continue;case 2:if(r!==18)break;i.data=re.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{type:k(e.type)?globalThis.String(e.type):"",data:k(e.data)?re.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.type!==""&&(t.type=e.type),e.data!==void 0&&(t.data=re.toJSON(e.data)),t},create(e){return we.fromPartial(e??{})},fromPartial(e){let t=ci();return t.type=e.type??"",t.data=e.data!==void 0&&e.data!==null?re.fromPartial(e.data):void 0,t}};c.set(we.$type,we);function k(e){return e!=null}var ao=[3],z=e=>new Promise(t=>{let n={scope:0,type:"devvit-internal"};if(e.realtimeSubscriptions?n.realtimeEffect=e.realtimeSubscriptions:e.immersiveMode?n.immersiveMode=e.immersiveMode:e.share?n.share=e.share:n.effect=e,e.showToast&&(n.showToast=e.showToast),ao.includes(e.type)){let o=self.crypto.randomUUID();n.id=o;let i=r=>{if(r.data?.type==="devvit-message"&&r.data?.data?.id===o){let s=re.fromJSON(r.data.data);t(s),window.removeEventListener("message",i)}};window.addEventListener("message",i),window.parent.postMessage(n,"*")}else window.parent.postMessage(n,"*"),t(void 0)});var jt=new Set;function uo(e){return pi(2,e)}function fo(e){return pi(1,e)}function lo(e){jt.add(e)}function co(e){jt.delete(e)}async function pi(e,t){if(!t.isTrusted)throw console.error("Immersive mode effect ignored due to untrusted event"),new Error("Untrusted event");await z({type:9,immersiveMode:{immersiveMode:e}})}typeof addEventListener=="function"&&addEventListener("message",e=>{let{type:t,data:n}=e.data;if(t!=="devvit-message"||!n?.immersiveModeEvent)return;let i=e.data.data?.immersiveModeEvent?.immersiveMode===2?"immersive":"inline";jt.forEach(r=>r(i))});function po(e){let t=typeof e=="string"?e:e.url;if(!URL.canParse(t))throw new TypeError(`Invalid URL: ${t}`);let n=new URL(t).toString();z({navigateToUrl:{url:n},type:5})}var Pe;(function(e){e[e.CONSENT_STATUS_UNKNOWN=0]="CONSENT_STATUS_UNKNOWN",e[e.REVOKED=1]="REVOKED",e[e.GRANTED=2]="GRANTED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Pe||(Pe={}));var hi;(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"})(hi||(hi={}));var ho=async()=>{let e=devvit.appPermissionState;if(!e)return!0;if(e.requestedScopes.length===0)return!1;switch(e.consentStatus){case Pe.REVOKED:return!1;case Pe.GRANTED:if(e.requestedScopes.every(n=>e.grantedScopes.includes(n)))return!0;break;case Pe.CONSENT_STATUS_UNKNOWN:case Pe.UNRECOGNIZED:break;default:{e.consentStatus;break}}return(await z({type:11}))?.consentStatus?.consentStatus===Pe.GRANTED};var mi="$devvit_icon.png";async function mo(e){if(e.data&&e.data.length>1024)throw Error(`data must be <= ${1024} characters but was ${e.data.length} characters`);let t=`${new URL(mi,location.origin)}`,n;try{n=await fetch(t,{method:"HEAD"})}catch{}await z({type:9,share:{appIconUri:n?.ok?t:void 0,userData:e.data,text:e.text,title:e.title}})}function go(){return devvit.share?.userData}function en(e,t=new Set){for(let n of e){if(n.type==="group"){en(n.fields,t);continue}let o=n.name;if(t.has(o))throw new Error(`Duplicate field name: ${o}`);t.add(o)}So(e)}function So(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 yo(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 Si(e){return Object.keys(e).reduce((t,n)=>{let o=yo(e[n]);return o!==void 0&&(t[n]=o),t},{})}function tn(e){return e.map(t=>{switch(t.type){case"string":return Eo(t);case"image":return vo(t);case"paragraph":return No(t);case"number":return bo(t);case"select":return To(t);case"boolean":return Oo(t);case"group":return Io(t);default:throw new Error("Unknown field type.")}})}function Eo(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 vo(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function No(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 bo(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 To(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 Oo(e){return{defaultValue:{fieldType:3,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:3,helpText:e.helpText,label:e.label}}function Io(e){return{fieldId:"",fieldType:6,fieldConfig:{groupConfig:{fields:tn(e.fields)}},label:e.label,helpText:e.helpText}}var yi=1,_o=()=>(yi++,`form.${yi}`),Co=async e=>{let t={fields:[],id:_o(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};en(e.fields),t.fields=tn(e.fields);let n=await z({showForm:{form:t},type:3});return!n||!n.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:Si(n.formSubmitted.results)}};function Fo(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?1:0}:t={text:e},z({showToast:{toast:t},type:4})}export{lo as addImmersiveModeChangeEventListener,ho as canRunAsUser,Bi as context,fo as exitImmersiveMode,go as getShareData,po as navigateTo,co as removeImmersiveModeChangeEventListener,uo as requestImmersiveMode,Co as showForm,mo as showShareSheet,Fo as showToast};
|
|
1
|
+
var vi=Object.create;var nn=Object.defineProperty;var Ni=Object.getOwnPropertyDescriptor;var bi=Object.getOwnPropertyNames;var Ti=Object.getPrototypeOf,Ii=Object.prototype.hasOwnProperty;var _=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Oi=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of bi(t))!Ii.call(e,i)&&i!==n&&nn(e,i,{get:()=>t[i],enumerable:!(o=Ni(t,i))||o.enumerable});return e};var x=(e,t,n)=>(n=e!=null?vi(Ti(e)):{},Oi(t||!e||!e.__esModule?nn(n,"default",{value:e,enumerable:!0}):n,e));var dn=_((Wo,fn)=>{"use strict";fn.exports=Mi;function Mi(e,t){for(var n=new Array(arguments.length-1),o=0,i=2,r=!0;i<arguments.length;)n[o++]=arguments[i++];return new Promise(function(d,a){n[o]=function(l){if(r)if(r=!1,l)a(l);else{for(var N=new Array(arguments.length-1),y=0;y<N.length;)N[y++]=arguments[y];d.apply(null,N)}};try{e.apply(t||null,n)}catch(u){r&&(r=!1,a(u))}})}});var hn=_(pn=>{"use strict";var ut=pn;ut.length=function(t){var n=t.length;if(!n)return 0;for(var o=0;--n%4>1&&t.charAt(n)==="=";)++o;return Math.ceil(t.length*3)/4-o};var He=new Array(64),cn=new Array(123);for(X=0;X<64;)cn[He[X]=X<26?X+65:X<52?X+71:X<62?X-4:X-59|43]=X++;var X;ut.encode=function(t,n,o){for(var i=null,r=[],s=0,d=0,a;n<o;){var u=t[n++];switch(d){case 0:r[s++]=He[u>>2],a=(u&3)<<4,d=1;break;case 1:r[s++]=He[a|u>>4],a=(u&15)<<2,d=2;break;case 2:r[s++]=He[a|u>>6],r[s++]=He[u&63],d=0;break}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,r)),s=0)}return d&&(r[s++]=He[a],r[s++]=61,d===1&&(r[s++]=61)),i?(s&&i.push(String.fromCharCode.apply(String,r.slice(0,s))),i.join("")):String.fromCharCode.apply(String,r.slice(0,s))};var ln="invalid encoding";ut.decode=function(t,n,o){for(var i=o,r=0,s,d=0;d<t.length;){var a=t.charCodeAt(d++);if(a===61&&r>1)break;if((a=cn[a])===void 0)throw Error(ln);switch(r){case 0:s=a,r=1;break;case 1:n[o++]=s<<2|(a&48)>>4,s=a,r=2;break;case 2:n[o++]=(s&15)<<4|(a&60)>>2,s=a,r=3;break;case 3:n[o++]=(s&3)<<6|a,r=0;break}}if(r===1)throw Error(ln);return o-i};ut.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var gn=_((Go,mn)=>{"use strict";mn.exports=ft;function ft(){this._listeners={}}ft.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};ft.prototype.off=function(t,n){if(t===void 0)this._listeners={};else if(n===void 0)this._listeners[t]=[];else for(var o=this._listeners[t],i=0;i<o.length;)o[i].fn===n?o.splice(i,1):++i;return this};ft.prototype.emit=function(t){var n=this._listeners[t];if(n){for(var o=[],i=1;i<arguments.length;)o.push(arguments[i++]);for(i=0;i<n.length;)n[i].fn.apply(n[i++].ctx,o)}return this}});var Tn=_((qo,bn)=>{"use strict";bn.exports=Sn(Sn);function Sn(e){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function i(a,u,l){t[0]=a,u[l]=n[0],u[l+1]=n[1],u[l+2]=n[2],u[l+3]=n[3]}function r(a,u,l){t[0]=a,u[l]=n[3],u[l+1]=n[2],u[l+2]=n[1],u[l+3]=n[0]}e.writeFloatLE=o?i:r,e.writeFloatBE=o?r:i;function s(a,u){return n[0]=a[u],n[1]=a[u+1],n[2]=a[u+2],n[3]=a[u+3],t[0]}function d(a,u){return n[3]=a[u],n[2]=a[u+1],n[1]=a[u+2],n[0]=a[u+3],t[0]}e.readFloatLE=o?s:d,e.readFloatBE=o?d:s}():function(){function t(o,i,r,s){var d=i<0?1:0;if(d&&(i=-i),i===0)o(1/i>0?0:2147483648,r,s);else if(isNaN(i))o(2143289344,r,s);else if(i>34028234663852886e22)o((d<<31|2139095040)>>>0,r,s);else if(i<11754943508222875e-54)o((d<<31|Math.round(i/1401298464324817e-60))>>>0,r,s);else{var a=Math.floor(Math.log(i)/Math.LN2),u=Math.round(i*Math.pow(2,-a)*8388608)&8388607;o((d<<31|a+127<<23|u)>>>0,r,s)}}e.writeFloatLE=t.bind(null,yn),e.writeFloatBE=t.bind(null,En);function n(o,i,r){var s=o(i,r),d=(s>>31)*2+1,a=s>>>23&255,u=s&8388607;return a===255?u?NaN:d*(1/0):a===0?d*1401298464324817e-60*u:d*Math.pow(2,a-150)*(u+8388608)}e.readFloatLE=n.bind(null,vn),e.readFloatBE=n.bind(null,Nn)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function i(a,u,l){t[0]=a,u[l]=n[0],u[l+1]=n[1],u[l+2]=n[2],u[l+3]=n[3],u[l+4]=n[4],u[l+5]=n[5],u[l+6]=n[6],u[l+7]=n[7]}function r(a,u,l){t[0]=a,u[l]=n[7],u[l+1]=n[6],u[l+2]=n[5],u[l+3]=n[4],u[l+4]=n[3],u[l+5]=n[2],u[l+6]=n[1],u[l+7]=n[0]}e.writeDoubleLE=o?i:r,e.writeDoubleBE=o?r:i;function s(a,u){return n[0]=a[u],n[1]=a[u+1],n[2]=a[u+2],n[3]=a[u+3],n[4]=a[u+4],n[5]=a[u+5],n[6]=a[u+6],n[7]=a[u+7],t[0]}function d(a,u){return n[7]=a[u],n[6]=a[u+1],n[5]=a[u+2],n[4]=a[u+3],n[3]=a[u+4],n[2]=a[u+5],n[1]=a[u+6],n[0]=a[u+7],t[0]}e.readDoubleLE=o?s:d,e.readDoubleBE=o?d:s}():function(){function t(o,i,r,s,d,a){var u=s<0?1:0;if(u&&(s=-s),s===0)o(0,d,a+i),o(1/s>0?0:2147483648,d,a+r);else if(isNaN(s))o(0,d,a+i),o(2146959360,d,a+r);else if(s>17976931348623157e292)o(0,d,a+i),o((u<<31|2146435072)>>>0,d,a+r);else{var l;if(s<22250738585072014e-324)l=s/5e-324,o(l>>>0,d,a+i),o((u<<31|l/4294967296)>>>0,d,a+r);else{var N=Math.floor(Math.log(s)/Math.LN2);N===1024&&(N=1023),l=s*Math.pow(2,-N),o(l*4503599627370496>>>0,d,a+i),o((u<<31|N+1023<<20|l*1048576&1048575)>>>0,d,a+r)}}}e.writeDoubleLE=t.bind(null,yn,0,4),e.writeDoubleBE=t.bind(null,En,4,0);function n(o,i,r,s,d){var a=o(s,d+i),u=o(s,d+r),l=(u>>31)*2+1,N=u>>>20&2047,y=4294967296*(u&1048575)+a;return N===2047?y?NaN:l*(1/0):N===0?l*5e-324*y:l*Math.pow(2,N-1075)*(y+4503599627370496)}e.readDoubleLE=n.bind(null,vn,0,4),e.readDoubleBE=n.bind(null,Nn,4,0)}(),e}function yn(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 En(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 vn(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Nn(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var In=_((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 _n=_(On=>{"use strict";var St=On;St.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};St.read=function(t,n,o){var i=o-n;if(i<1)return"";for(var r=null,s=[],d=0,a;n<o;)a=t[n++],a<128?s[d++]=a:a>191&&a<224?s[d++]=(a&31)<<6|t[n++]&63:a>239&&a<365?(a=((a&7)<<18|(t[n++]&63)<<12|(t[n++]&63)<<6|t[n++]&63)-65536,s[d++]=55296+(a>>10),s[d++]=56320+(a&1023)):s[d++]=(a&15)<<12|(t[n++]&63)<<6|t[n++]&63,d>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,s)),d=0);return r?(d&&r.push(String.fromCharCode.apply(String,s.slice(0,d))),r.join("")):String.fromCharCode.apply(String,s.slice(0,d))};St.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 Fn=_((Ho,Cn)=>{"use strict";Cn.exports=Ui;function Ui(e,t,n){var o=n||8192,i=o>>>1,r=null,s=o;return function(a){if(a<1||a>i)return e(a);s+a>o&&(r=e(o),s=0);var u=t.call(r,s,s+=a);return s&7&&(s=(s|7)+1),u}}});var kn=_((Ko,Rn)=>{"use strict";Rn.exports=C;var je=pe();function C(e,t){this.lo=e>>>0,this.hi=t>>>0}var Be=C.zero=new C(0,0);Be.toNumber=function(){return 0};Be.zzEncode=Be.zzDecode=function(){return this};Be.length=function(){return 1};var Di=C.zeroHash="\0\0\0\0\0\0\0\0";C.fromNumber=function(t){if(t===0)return Be;var n=t<0;n&&(t=-t);var o=t>>>0,i=(t-o)/4294967296>>>0;return n&&(i=~i>>>0,o=~o>>>0,++o>4294967295&&(o=0,++i>4294967295&&(i=0))),new C(o,i)};C.from=function(t){if(typeof t=="number")return C.fromNumber(t);if(je.isString(t))if(je.Long)t=je.Long.fromString(t);else return C.fromNumber(parseInt(t,10));return t.low||t.high?new C(t.low>>>0,t.high>>>0):Be};C.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var n=~this.lo+1>>>0,o=~this.hi>>>0;return n||(o=o+1>>>0),-(n+o*4294967296)}return this.lo+this.hi*4294967296};C.prototype.toLong=function(t){return je.Long?new je.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var ce=String.prototype.charCodeAt;C.fromHash=function(t){return t===Di?Be:new C((ce.call(t,0)|ce.call(t,1)<<8|ce.call(t,2)<<16|ce.call(t,3)<<24)>>>0,(ce.call(t,4)|ce.call(t,5)<<8|ce.call(t,6)<<16|ce.call(t,7)<<24)>>>0)};C.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};C.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};C.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};C.prototype.length=function(){var t=this.lo,n=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?n===0?t<16384?t<128?1:2:t<2097152?3:4:n<16384?n<128?5:6:n<2097152?7:8:o<128?9:10}});var pe=_(yt=>{"use strict";var p=yt;p.asPromise=dn();p.base64=hn();p.EventEmitter=gn();p.float=Tn();p.inquire=In();p.utf8=_n();p.pool=Fn();p.LongBits=kn();p.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);p.global=p.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||yt;p.emptyArray=Object.freeze?Object.freeze([]):[];p.emptyObject=Object.freeze?Object.freeze({}):{};p.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};p.isString=function(t){return typeof t=="string"||t instanceof String};p.isObject=function(t){return t&&typeof t=="object"};p.isset=p.isSet=function(t,n){var o=t[n];return o!=null&&t.hasOwnProperty(n)?typeof o!="object"||(Array.isArray(o)?o.length:Object.keys(o).length)>0:!1};p.Buffer=function(){try{var e=p.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}}();p._Buffer_from=null;p._Buffer_allocUnsafe=null;p.newBuffer=function(t){return typeof t=="number"?p.Buffer?p._Buffer_allocUnsafe(t):new p.Array(t):p.Buffer?p._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};p.Array=typeof Uint8Array<"u"?Uint8Array:Array;p.Long=p.global.dcodeIO&&p.global.dcodeIO.Long||p.global.Long||p.inquire("long");p.key2Re=/^true|false|0|1$/;p.key32Re=/^-?(?:0|[1-9][0-9]*)$/;p.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;p.longToHash=function(t){return t?p.LongBits.from(t).toHash():p.LongBits.zeroHash};p.longFromHash=function(t,n){var o=p.LongBits.fromHash(t);return p.Long?p.Long.fromBits(o.lo,o.hi,n):o.toNumber(!!n)};function xn(e,t,n){for(var o=Object.keys(t),i=0;i<o.length;++i)(e[o[i]]===void 0||!n)&&(e[o[i]]=t[o[i]]);return e}p.merge=xn;p.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function wn(e){function t(n,o){if(!(this instanceof t))return new t(n,o);Object.defineProperty(this,"message",{get:function(){return n}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),o&&xn(this,o)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}p.newError=wn;p.ProtocolError=wn("ProtocolError");p.oneOfGetter=function(t){for(var n={},o=0;o<t.length;++o)n[t[o]]=1;return function(){for(var i=Object.keys(this),r=i.length-1;r>-1;--r)if(n[i[r]]===1&&this[i[r]]!==void 0&&this[i[r]]!==null)return i[r]}};p.oneOfSetter=function(t){return function(n){for(var o=0;o<t.length;++o)t[o]!==n&&delete this[t[o]]}};p.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};p._configure=function(){var e=p.Buffer;if(!e){p._Buffer_from=p._Buffer_allocUnsafe=null;return}p._Buffer_from=e.from!==Uint8Array.from&&e.from||function(n,o){return new e(n,o)},p._Buffer_allocUnsafe=e.allocUnsafe||function(n){return new e(n)}}});var Ot=_((Xo,Bn)=>{"use strict";Bn.exports=m;var $=pe(),Et,dt=$.LongBits,Vn=$.base64,Pn=$.utf8;function et(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function Nt(){}function Ji(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function m(){this.len=0,this.head=new et(Nt,0,0),this.tail=this.head,this.states=null}var An=function(){return $.Buffer?function(){return(m.create=function(){return new Et})()}:function(){return new m}};m.create=An();m.alloc=function(t){return new $.Array(t)};$.Array!==Array&&(m.alloc=$.pool(m.alloc,$.Array.prototype.subarray));m.prototype._push=function(t,n,o){return this.tail=this.tail.next=new et(t,n,o),this.len+=n,this};function bt(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 Tt(e,t){this.len=e,this.next=void 0,this.val=t}Tt.prototype=Object.create(et.prototype);Tt.prototype.fn=Wi;m.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Tt((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};m.prototype.int32=function(t){return t<0?this._push(It,10,dt.fromNumber(t)):this.uint32(t)};m.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function It(e,t,n){for(;e.hi;)t[n++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=e.lo&127|128,e.lo=e.lo>>>7;t[n++]=e.lo}m.prototype.uint64=function(t){var n=dt.from(t);return this._push(It,n.length(),n)};m.prototype.int64=m.prototype.uint64;m.prototype.sint64=function(t){var n=dt.from(t).zzEncode();return this._push(It,n.length(),n)};m.prototype.bool=function(t){return this._push(bt,1,t?1:0)};function vt(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(vt,4,t>>>0)};m.prototype.sfixed32=m.prototype.fixed32;m.prototype.fixed64=function(t){var n=dt.from(t);return this._push(vt,4,n.lo)._push(vt,4,n.hi)};m.prototype.sfixed64=m.prototype.fixed64;m.prototype.float=function(t){return this._push($.float.writeFloatLE,4,t)};m.prototype.double=function(t){return this._push($.float.writeDoubleLE,8,t)};var $i=$.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(bt,1,0);if($.isString(t)){var o=m.alloc(n=Vn.length(t));Vn.decode(t,o,0),t=o}return this.uint32(n)._push($i,n,t)};m.prototype.string=function(t){var n=Pn.length(t);return n?this.uint32(n)._push(Pn.write,n,t):this._push(bt,1,0)};m.prototype.fork=function(){return this.states=new Ji(this),this.head=this.tail=new et(Nt,0,0),this.len=0,this};m.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new et(Nt,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){Et=e,m.create=An(),Et._configure()}});var Un=_((Yo,Mn)=>{"use strict";Mn.exports=ee;var Ln=Ot();(ee.prototype=Object.create(Ln.prototype)).constructor=ee;var he=pe();function ee(){Ln.call(this)}ee._configure=function(){ee.alloc=he._Buffer_allocUnsafe,ee.writeBytesBuffer=he.Buffer&&he.Buffer.prototype instanceof Uint8Array&&he.Buffer.prototype.set.name==="set"?function(t,n,o){n.set(t,o)}:function(t,n,o){if(t.copy)t.copy(n,o,0,t.length);else for(var i=0;i<t.length;)n[o++]=t[i++]}};ee.prototype.bytes=function(t){he.isString(t)&&(t=he._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(ee.writeBytesBuffer,n,t),this};function Gi(e,t,n){e.length<40?he.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}ee.prototype.string=function(t){var n=he.Buffer.byteLength(t);return this.uint32(n),n&&this._push(Gi,n,t),this};ee._configure()});var Ft=_((Qo,Gn)=>{"use strict";Gn.exports=I;var Y=pe(),Ct,Wn=Y.LongBits,qi=Y.utf8;function Q(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function I(e){this.buf=e,this.pos=0,this.len=e.length}var Dn=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new I(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new I(t);throw Error("illegal buffer")},$n=function(){return Y.Buffer?function(n){return(I.create=function(i){return Y.Buffer.isBuffer(i)?new Ct(i):Dn(i)})(n)}:Dn};I.create=$n();I.prototype._slice=Y.Array.prototype.subarray||Y.Array.prototype.slice;I.prototype.uint32=function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,Q(this,10);return t}}();I.prototype.int32=function(){return this.uint32()|0};I.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function _t(){var e=new Wn(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Q(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw Q(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}I.prototype.bool=function(){return this.uint32()!==0};function lt(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}I.prototype.fixed32=function(){if(this.pos+4>this.len)throw Q(this,4);return lt(this.buf,this.pos+=4)};I.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Q(this,4);return lt(this.buf,this.pos+=4)|0};function Jn(){if(this.pos+8>this.len)throw Q(this,8);return new Wn(lt(this.buf,this.pos+=4),lt(this.buf,this.pos+=4))}I.prototype.float=function(){if(this.pos+4>this.len)throw Q(this,4);var t=Y.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};I.prototype.double=function(){if(this.pos+8>this.len)throw Q(this,4);var t=Y.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};I.prototype.bytes=function(){var t=this.uint32(),n=this.pos,o=this.pos+t;if(o>this.len)throw Q(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(n,o);if(n===o){var i=Y.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,n,o)};I.prototype.string=function(){var t=this.bytes();return qi.read(t,0,t.length)};I.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Q(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Q(this);while(this.buf[this.pos++]&128);return this};I.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this};I._configure=function(e){Ct=e,I.create=$n(),Ct._configure();var t=Y.Long?"toLong":"toNumber";Y.merge(I.prototype,{int64:function(){return _t.call(this)[t](!1)},uint64:function(){return _t.call(this)[t](!0)},sint64:function(){return _t.call(this).zzDecode()[t](!1)},fixed64:function(){return Jn.call(this)[t](!0)},sfixed64:function(){return Jn.call(this)[t](!1)}})}});var Kn=_((jo,Hn)=>{"use strict";Hn.exports=Le;var Zn=Ft();(Le.prototype=Object.create(Zn.prototype)).constructor=Le;var qn=pe();function Le(e){Zn.call(this,e)}Le._configure=function(){qn.Buffer&&(Le.prototype._slice=qn.Buffer.prototype.slice)};Le.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))};Le._configure()});var Xn=_((es,zn)=>{"use strict";zn.exports=tt;var Rt=pe();(tt.prototype=Object.create(Rt.EventEmitter.prototype)).constructor=tt;function tt(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");Rt.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}tt.prototype.rpcCall=function e(t,n,o,i,r){if(!i)throw TypeError("request must be specified");var s=this;if(!r)return Rt.asPromise(e,s,t,n,o,i);if(!s.rpcImpl){setTimeout(function(){r(Error("already ended"))},0);return}try{return s.rpcImpl(t,n[s.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(a,u){if(a)return s.emit("error",a,t),r(a);if(u===null){s.end(!0);return}if(!(u instanceof o))try{u=o[s.responseDelimited?"decodeDelimited":"decode"](u)}catch(l){return s.emit("error",l,t),r(l)}return s.emit("data",u,t),r(null,u)})}catch(d){s.emit("error",d,t),setTimeout(function(){r(d)},0);return}};tt.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Qn=_(Yn=>{"use strict";var Zi=Yn;Zi.Service=Xn()});var er=_((ns,jn)=>{"use strict";jn.exports={}});var rr=_(nr=>{"use strict";var w=nr;w.build="minimal";w.Writer=Ot();w.BufferWriter=Un();w.Reader=Ft();w.BufferReader=Kn();w.util=pe();w.rpc=Qn();w.roots=er();w.configure=tr;function tr(){w.util._configure(),w.Writer._configure(w.BufferWriter),w.Reader._configure(w.BufferReader)}tr()});var V=_((is,ir)=>{"use strict";ir.exports=rr()});var yr=_((ds,Sr)=>{Sr.exports=E;var q=null;try{q=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function E(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}E.prototype.__isLong__;Object.defineProperty(E.prototype,"__isLong__",{value:!0});function A(e){return(e&&e.__isLong__)===!0}E.isLong=A;var ur={},fr={};function Je(e,t){var n,o,i;return t?(e>>>=0,(i=0<=e&&e<256)&&(o=fr[e],o)?o:(n=v(e,(e|0)<0?-1:0,!0),i&&(fr[e]=n),n)):(e|=0,(i=-128<=e&&e<128)&&(o=ur[e],o)?o:(n=v(e,e<0?-1:0,!1),i&&(ur[e]=n),n))}E.fromInt=Je;function Z(e,t){if(isNaN(e))return t?De:H;if(t){if(e<0)return De;if(e>=pr)return gr}else{if(e<=-lr)return P;if(e+1>=lr)return mr}return e<0?Z(-e,t).neg():v(e%Xe|0,e/Xe|0,t)}E.fromNumber=Z;function v(e,t,n){return new E(e,t,n)}E.fromBits=v;var pt=Math.pow;function Lt(e,t,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return H;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 Lt(e.substring(1),t,n).neg();for(var i=Z(pt(n,8)),r=H,s=0;s<e.length;s+=8){var d=Math.min(8,e.length-s),a=parseInt(e.substring(s,s+d),n);if(d<8){var u=Z(pt(n,d));r=r.mul(u).add(Z(a))}else r=r.mul(i),r=r.add(Z(a))}return r.unsigned=t,r}E.fromString=Lt;function j(e,t){return typeof e=="number"?Z(e,t):typeof e=="string"?Lt(e,t):v(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}E.fromValue=j;var dr=65536,Xi=1<<24,Xe=dr*dr,pr=Xe*Xe,lr=pr/2,cr=Je(Xi),H=Je(0);E.ZERO=H;var De=Je(0,!0);E.UZERO=De;var ze=Je(1);E.ONE=ze;var hr=Je(1,!0);E.UONE=hr;var Bt=Je(-1);E.NEG_ONE=Bt;var mr=v(-1,2147483647,!1);E.MAX_VALUE=mr;var gr=v(-1,-1,!0);E.MAX_UNSIGNED_VALUE=gr;var P=v(0,-2147483648,!1);E.MIN_VALUE=P;var f=E.prototype;f.toInt=function(){return this.unsigned?this.low>>>0:this.low};f.toNumber=function(){return this.unsigned?(this.high>>>0)*Xe+(this.low>>>0):this.high*Xe+(this.low>>>0)};f.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(P)){var n=Z(t),o=this.div(n),i=o.mul(n).sub(this);return o.toString(t)+i.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var r=Z(pt(t,6),this.unsigned),s=this,d="";;){var a=s.div(r),u=s.sub(a.mul(r)).toInt()>>>0,l=u.toString(t);if(s=a,s.isZero())return l+d;for(;l.length<6;)l="0"+l;d=""+l+d}};f.getHighBits=function(){return this.high};f.getHighBitsUnsigned=function(){return this.high>>>0};f.getLowBits=function(){return this.low};f.getLowBitsUnsigned=function(){return this.low>>>0};f.getNumBitsAbs=function(){if(this.isNegative())return this.eq(P)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,n=31;n>0&&!(t&1<<n);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 A(t)||(t=j(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(A(t)||(t=j(t)),this.eq(t))return 0;var n=this.isNegative(),o=t.isNegative();return n&&!o?-1:!n&&o?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};f.comp=f.compare;f.negate=function(){return!this.unsigned&&this.eq(P)?P:this.not().add(ze)};f.neg=f.negate;f.add=function(t){A(t)||(t=j(t));var n=this.high>>>16,o=this.high&65535,i=this.low>>>16,r=this.low&65535,s=t.high>>>16,d=t.high&65535,a=t.low>>>16,u=t.low&65535,l=0,N=0,y=0,L=0;return L+=r+u,y+=L>>>16,L&=65535,y+=i+a,N+=y>>>16,y&=65535,N+=o+d,l+=N>>>16,N&=65535,l+=n+s,l&=65535,v(y<<16|L,l<<16|N,this.unsigned)};f.subtract=function(t){return A(t)||(t=j(t)),this.add(t.neg())};f.sub=f.subtract;f.multiply=function(t){if(this.isZero())return H;if(A(t)||(t=j(t)),q){var n=q.mul(this.low,this.high,t.low,t.high);return v(n,q.get_high(),this.unsigned)}if(t.isZero())return H;if(this.eq(P))return t.isOdd()?P:H;if(t.eq(P))return this.isOdd()?P:H;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(cr)&&t.lt(cr))return Z(this.toNumber()*t.toNumber(),this.unsigned);var o=this.high>>>16,i=this.high&65535,r=this.low>>>16,s=this.low&65535,d=t.high>>>16,a=t.high&65535,u=t.low>>>16,l=t.low&65535,N=0,y=0,L=0,st=0;return st+=s*l,L+=st>>>16,st&=65535,L+=r*l,y+=L>>>16,L&=65535,L+=s*u,y+=L>>>16,L&=65535,y+=i*l,N+=y>>>16,y&=65535,y+=r*u,N+=y>>>16,y&=65535,y+=s*a,N+=y>>>16,y&=65535,N+=o*l+i*u+r*a+s*d,N&=65535,v(L<<16|st,N<<16|y,this.unsigned)};f.mul=f.multiply;f.divide=function(t){if(A(t)||(t=j(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 v(n,q.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?De:H;var o,i,r;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return De;if(t.gt(this.shru(1)))return hr;r=De}else{if(this.eq(P)){if(t.eq(ze)||t.eq(Bt))return P;if(t.eq(P))return ze;var s=this.shr(1);return o=s.div(t).shl(1),o.eq(H)?t.isNegative()?ze:Bt:(i=this.sub(t.mul(o)),r=o.add(i.div(t)),r)}else if(t.eq(P))return this.unsigned?De:H;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=H}for(i=this;i.gte(t);){o=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var d=Math.ceil(Math.log(o)/Math.LN2),a=d<=48?1:pt(2,d-48),u=Z(o),l=u.mul(t);l.isNegative()||l.gt(i);)o-=a,u=Z(o,this.unsigned),l=u.mul(t);u.isZero()&&(u=ze),r=r.add(u),i=i.sub(l)}return r};f.div=f.divide;f.modulo=function(t){if(A(t)||(t=j(t)),q){var n=(this.unsigned?q.rem_u:q.rem_s)(this.low,this.high,t.low,t.high);return v(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 v(~this.low,~this.high,this.unsigned)};f.and=function(t){return A(t)||(t=j(t)),v(this.low&t.low,this.high&t.high,this.unsigned)};f.or=function(t){return A(t)||(t=j(t)),v(this.low|t.low,this.high|t.high,this.unsigned)};f.xor=function(t){return A(t)||(t=j(t)),v(this.low^t.low,this.high^t.high,this.unsigned)};f.shiftLeft=function(t){return A(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?v(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):v(0,this.low<<t-32,this.unsigned)};f.shl=f.shiftLeft;f.shiftRight=function(t){return A(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?v(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):v(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};f.shr=f.shiftRight;f.shiftRightUnsigned=function(t){if(A(t)&&(t=t.toInt()),t&=63,t===0)return this;var n=this.high;if(t<32){var o=this.low;return v(o>>>t|n<<32-t,n>>>t,this.unsigned)}else return t===32?v(n,0,this.unsigned):v(n>>>t-32,0,this.unsigned)};f.shru=f.shiftRightUnsigned;f.shr_u=f.shiftRightUnsigned;f.toSigned=function(){return this.unsigned?v(this.low,this.high,!1):this};f.toUnsigned=function(){return this.unsigned?this:v(this.low,this.high,!0)};f.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};f.toBytesLE=function(){var t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};f.toBytesBE=function(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};E.fromBytes=function(t,n,o){return o?E.fromBytesLE(t,n):E.fromBytesBE(t,n)};E.fromBytesLE=function(t,n){return new E(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};E.fromBytesBE=function(t,n){return new E(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)}});function at(e,t){if(!e)throw Error(t)}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 _i(e){return e.startsWith(le.ACCOUNT)}function Ci(e){return e.startsWith(le.LINK)}function Fi(e){return e.startsWith(le.SUBREDDIT)}function Ri(e){at(_i(e),`Expected account id to start with ${le.ACCOUNT}, got ${e}}`)}function ki(e){at(Ci(e),`Expected link id to start with ${le.LINK}, got ${e}}`)}function xi(e){at(Fi(e),`Expected subreddit id to start with ${le.SUBREDDIT}, got ${e}}`)}function rn(e){return Ri(e),e}function on(e){return ki(e),e}function sn(e){return xi(e),e}var an="0.0.0";var Ae=class extends Error{};Ae.prototype.name="InvalidTokenError";function wi(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 Vi(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 wi(t)}catch{return atob(t)}}function un(e,t){if(typeof e!="string")throw new Ae("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 Ae(`Invalid token specified: missing part #${n+1}`);let i;try{i=Vi(o)}catch(r){throw new Ae(`Invalid token specified: invalid base64 for part #${n+1} (${r.message})`)}try{return JSON.parse(i)}catch(r){throw new Ae(`Invalid token specified: invalid json for part #${n+1} (${r.message})`)}}var Pi=({search:e,hash:t})=>{let n=new URLSearchParams(e).get("context");if(n){let o=decodeURIComponent(n),i=JSON.parse(o),r=Ai(t),s=r?.webbitToken??new URLSearchParams(e).get("webbit_token"),d=s?Bi(s):void 0,a={subredditId:sn(i.subredditId),userId:i.userId?rn(i.userId):void 0,subredditName:i.subredditName,appName:i.appName,appVersion:i.appVersion,postId:on(i.postId),postData:d?.developerData};globalThis.devvit={context:a,share:r?.shareParam?{userData:r?.shareParam.userData}:void 0,appPermissionState:r?.appPermissionState}}};globalThis.location&&Pi(globalThis.location);function Ai(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 Bi(e){if(e===an)return;let t;try{t=un(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 Li=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 ct=x(V(),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 xt(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 wt(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 or(){return{immersiveMode:0}}var kt={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,t=ct.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),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=or();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:Hi(e.immersiveMode)?xt(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=wt(e.immersiveMode)),t},create(e){return kt.fromPartial(e??{})},fromPartial(e){let t=or();return t.immersiveMode=e.immersiveMode??0,t}};c.set(kt.$type,kt);function Hi(e){return e!=null}var T=x(V(),1);var M=x(V(),1);var Ue;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ue||(Ue={}));function Ki(e){switch(e){case 0:case"NULL_VALUE":return Ue.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return Ue.UNRECOGNIZED}}function zi(e){switch(e){case Ue.NULL_VALUE:return 0;case Ue.UNRECOGNIZED:default:return-1}}function Vt(){return{fields:{}}}var G={$type:"google.protobuf.Struct",encode(e,t=M.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&nt.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof M.default.Reader?e:M.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Vt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let s=nt.decode(n,n.uint32());s.value!==void 0&&(i.fields[s.key]=s.value);continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:ar(e.fields)?Object.entries(e.fields).reduce((t,[n,o])=>(t[n]=o,t),{}):{}}},toJSON(e){let t={};if(e.fields){let n=Object.entries(e.fields);n.length>0&&(t.fields={},n.forEach(([o,i])=>{t.fields[o]=i}))}return t},create(e){return G.fromPartial(e??{})},fromPartial(e){let t=Vt();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),{}),t},wrap(e){let t=Vt();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};c.set(G.$type,G);function sr(){return{key:"",value:void 0}}var nt={$type:"google.protobuf.Struct.FieldsEntry",encode(e,t=M.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&F.encode(F.wrap(e.value),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof M.default.Reader?e:M.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=sr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=F.unwrap(F.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:Ke(e.key)?globalThis.String(e.key):"",value:Ke(e?.value)?e.value:void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=e.value),t},create(e){return nt.fromPartial(e??{})},fromPartial(e){let t=sr();return t.key=e.key??"",t.value=e.value??void 0,t}};c.set(nt.$type,nt);function Pt(){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,t=M.default.Writer.create()){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&G.encode(G.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&Me.encode(Me.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof M.default.Reader?e:M.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Pt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.nullValue=n.int32();continue;case 2:if(r!==17)break;i.numberValue=n.double();continue;case 3:if(r!==26)break;i.stringValue=n.string();continue;case 4:if(r!==32)break;i.boolValue=n.bool();continue;case 5:if(r!==42)break;i.structValue=G.unwrap(G.decode(n,n.uint32()));continue;case 6:if(r!==50)break;i.listValue=Me.unwrap(Me.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{nullValue:Ke(e.nullValue)?Ki(e.nullValue):void 0,numberValue:Ke(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:Ke(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:Ke(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:ar(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=zi(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 F.fromPartial(e??{})},fromPartial(e){let t=Pt();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=Pt();if(e===null)t.nullValue=Ue.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new globalThis.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};c.set(F.$type,F);function At(){return{values:[]}}var Me={$type:"google.protobuf.ListValue",encode(e,t=M.default.Writer.create()){for(let n of e.values)F.encode(F.wrap(n),t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof M.default.Reader?e:M.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=At();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(F.unwrap(F.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 Me.fromPartial(e??{})},fromPartial(e){let t=At();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=At();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};c.set(Me.$type,Me);function ar(e){return typeof e=="object"&&e!==null}function Ke(e){return e!=null}var Ge=x(V(),1);var S=x(V(),1);var Mt=x(yr(),1),We=x(V(),1);function Er(){return{seconds:0,nanos:0}}var $e={$type:"google.protobuf.Timestamp",encode(e,t=We.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 We.default.Reader?e:We.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Er();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.seconds=Yi(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:vr(e.seconds)?globalThis.Number(e.seconds):0,nanos:vr(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 $e.fromPartial(e??{})},fromPartial(e){let t=Er();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}};c.set($e.$type,$e);function Yi(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}We.default.util.Long!==Mt.default&&(We.default.util.Long=Mt.default,We.default.configure());function vr(e){return e!=null}var ne;(function(e){e[e.CONSENT_STATUS_UNKNOWN=0]="CONSENT_STATUS_UNKNOWN",e[e.REVOKED=1]="REVOKED",e[e.GRANTED=2]="GRANTED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ne||(ne={}));function qt(e){switch(e){case 0:case"CONSENT_STATUS_UNKNOWN":return ne.CONSENT_STATUS_UNKNOWN;case 1:case"REVOKED":return ne.REVOKED;case 2:case"GRANTED":return ne.GRANTED;case-1:case"UNRECOGNIZED":default:return ne.UNRECOGNIZED}}function Zt(e){switch(e){case ne.CONSENT_STATUS_UNKNOWN:return 0;case ne.REVOKED:return 1;case ne.GRANTED:return 2;case ne.UNRECOGNIZED:default:return-1}}var K;(function(e){e[e.SCOPE_UNKNOWN=0]="SCOPE_UNKNOWN",e[e.SUBMIT_POST=1]="SUBMIT_POST",e[e.SUBMIT_COMMENT=2]="SUBMIT_COMMENT",e[e.SUBSCRIBE_TO_SUBREDDIT=3]="SUBSCRIBE_TO_SUBREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(K||(K={}));function kr(e){switch(e){case 0:case"SCOPE_UNKNOWN":return K.SCOPE_UNKNOWN;case 1:case"SUBMIT_POST":return K.SUBMIT_POST;case 2:case"SUBMIT_COMMENT":return K.SUBMIT_COMMENT;case 3:case"SUBSCRIBE_TO_SUBREDDIT":return K.SUBSCRIBE_TO_SUBREDDIT;case-1:case"UNRECOGNIZED":default:return K.UNRECOGNIZED}}function xr(e){switch(e){case K.SCOPE_UNKNOWN:return 0;case K.SUBMIT_POST:return 1;case K.SUBMIT_COMMENT:return 2;case K.SUBSCRIBE_TO_SUBREDDIT:return 3;case K.UNRECOGNIZED:default:return-1}}function Nr(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}var me={$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&&$e.encode(Qi(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=Nr();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=wr($e.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:R(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:R(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>kr(t)):[],consentStatus:R(e.consentStatus)?qt(e.consentStatus):0,updatedAt:R(e.updatedAt)?ji(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=>xr(n))),e.consentStatus!==0&&(t.consentStatus=Zt(e.consentStatus)),e.updatedAt!==void 0&&(t.updatedAt=e.updatedAt.toISOString()),t},create(e){return me.fromPartial(e??{})},fromPartial(e){let t=Nr();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(me.$type,me);function br(){return{appSlug:"",appName:""}}var ge={$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=br();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:R(e.appSlug)?globalThis.String(e.appSlug):"",appName:R(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 ge.fromPartial(e??{})},fromPartial(e){let t=br();return t.appSlug=e.appSlug??"",t.appName=e.appName??"",t}};c.set(ge.$type,ge);function Tr(){return{userId:""}}var Ut={$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=Tr();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:R(e.userId)?globalThis.String(e.userId):""}},toJSON(e){let t={};return e.userId!==""&&(t.userId=e.userId),t},create(e){return Ut.fromPartial(e??{})},fromPartial(e){let t=Tr();return t.userId=e.userId??"",t}};c.set(Ut.$type,Ut);function Ir(){return{appPermissions:[],devvitApps:[]}}var Dt={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,t=S.default.Writer.create()){for(let n of e.appPermissions)me.encode(n,t.uint32(10).fork()).ldelim();for(let n of e.devvitApps)ge.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=Ir();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appPermissions.push(me.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.devvitApps.push(ge.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=>me.fromJSON(t)):[],devvitApps:globalThis.Array.isArray(e?.devvitApps)?e.devvitApps.map(t=>ge.fromJSON(t)):[]}},toJSON(e){let t={};return e.appPermissions?.length&&(t.appPermissions=e.appPermissions.map(n=>me.toJSON(n))),e.devvitApps?.length&&(t.devvitApps=e.devvitApps.map(n=>ge.toJSON(n))),t},create(e){return Dt.fromPartial(e??{})},fromPartial(e){let t=Ir();return t.appPermissions=e.appPermissions?.map(n=>me.fromPartial(n))||[],t.devvitApps=e.devvitApps?.map(n=>ge.fromPartial(n))||[],t}};c.set(Dt.$type,Dt);function Or(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}var Jt={$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=Or();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:R(e.userId)?globalThis.String(e.userId):"",appSlug:R(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:R(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>kr(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=>xr(n))),t},create(e){return Jt.fromPartial(e??{})},fromPartial(e){let t=Or();return t.userId=e.userId??"",t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t}};c.set(Jt.$type,Jt);function _r(){return{error:void 0}}var Wt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode(e,t=S.default.Writer.create()){return e.error!==void 0&&U.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=_r();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.error=U.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:R(e.error)?U.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=U.toJSON(e.error)),t},create(e){return Wt.fromPartial(e??{})},fromPartial(e){let t=_r();return t.error=e.error!==void 0&&e.error!==null?U.fromPartial(e.error):void 0,t}};c.set(Wt.$type,Wt);function Cr(){return{appSlug:"",userId:"",subredditId:""}}var $t={$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=Cr();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:R(e.appSlug)?globalThis.String(e.appSlug):"",userId:R(e.userId)?globalThis.String(e.userId):"",subredditId:R(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 $t.fromPartial(e??{})},fromPartial(e){let t=Cr();return t.appSlug=e.appSlug??"",t.userId=e.userId??"",t.subredditId=e.subredditId??"",t}};c.set($t.$type,$t);function Fr(){return{error:void 0}}var Gt={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode(e,t=S.default.Writer.create()){return e.error!==void 0&&U.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof 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.error=U.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:R(e.error)?U.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=U.toJSON(e.error)),t},create(e){return Gt.fromPartial(e??{})},fromPartial(e){let t=Fr();return t.error=e.error!==void 0&&e.error!==null?U.fromPartial(e.error):void 0,t}};c.set(Gt.$type,Gt);function Rr(){return{message:""}}var U={$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=Rr();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:R(e.message)?globalThis.String(e.message):""}},toJSON(e){let t={};return e.message!==""&&(t.message=e.message),t},create(e){return U.fromPartial(e??{})},fromPartial(e){let t=Rr();return t.message=e.message??"",t}};c.set(U.$type,U);function Qi(e){let t=Math.trunc(e.getTime()/1e3),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function wr(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function ji(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):wr($e.fromJSON(e))}function R(e){return e!=null}function Vr(){return{postId:""}}var Ht={$type:"devvit.ui.effects.v1alpha.CanRunAsUserEffect",encode(e,t=Ge.default.Writer.create()){return e.postId!==""&&t.uint32(10).string(e.postId),t},decode(e,t){let n=e instanceof Ge.default.Reader?e:Ge.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Vr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{postId:Ar(e.postId)?globalThis.String(e.postId):""}},toJSON(e){let t={};return e.postId!==""&&(t.postId=e.postId),t},create(e){return Ht.fromPartial(e??{})},fromPartial(e){let t=Vr();return t.postId=e.postId??"",t}};c.set(Ht.$type,Ht);function Pr(){return{consentStatus:0}}var ie={$type:"devvit.ui.effects.v1alpha.ConsentStatusEvent",encode(e,t=Ge.default.Writer.create()){return e.consentStatus!==0&&t.uint32(8).int32(e.consentStatus),t},decode(e,t){let n=e instanceof Ge.default.Reader?e:Ge.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Pr();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:Ar(e.consentStatus)?qt(e.consentStatus):0}},toJSON(e){let t={};return e.consentStatus!==0&&(t.consentStatus=Zt(e.consentStatus)),t},create(e){return ie.fromPartial(e??{})},fromPartial(e){let t=Pr();return t.consentStatus=e.consentStatus??0,t}};c.set(ie.$type,ie);function Ar(e){return e!=null}var Ze=x(V(),1);var qe=x(V(),1);var ht=x(V(),1);function Br(){return{}}var mt={$type:"google.protobuf.Empty",encode(e,t=ht.default.Writer.create()){return 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=Br();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 mt.fromPartial(e??{})},fromPartial(e){return Br()}};c.set(mt.$type,mt);function Lr(){return{channels:[]}}var Kt={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=qe.default.Writer.create()){for(let n of e.channels)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof qe.default.Reader?e:qe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Lr();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 Kt.fromPartial(e??{})},fromPartial(e){let t=Lr();return t.channels=e.channels?.map(n=>n)||[],t}};c.set(Kt.$type,Kt);function Mr(){return{channel:"",data:void 0}}var oe={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=qe.default.Writer.create()){return e.channel!==""&&t.uint32(10).string(e.channel),e.data!==void 0&&G.encode(G.wrap(e.data),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof qe.default.Reader?e:qe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Mr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.channel=n.string();continue;case 2:if(r!==18)break;i.data=G.unwrap(G.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channel:to(e.channel)?globalThis.String(e.channel):"",data:eo(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 oe.fromPartial(e??{})},fromPartial(e){let t=Mr();return t.channel=e.channel??"",t.data=e.data??void 0,t}};c.set(oe.$type,oe);function eo(e){return typeof e=="object"&&e!==null}function to(e){return e!=null}var Se;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Se||(Se={}));function no(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return Se.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return Se.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return Se.UNRECOGNIZED}}function ro(e){switch(e){case Se.REALTIME_SUBSCRIBED:return 0;case Se.REALTIME_UNSUBSCRIBED:return 1;case Se.UNRECOGNIZED:default:return-1}}function Ur(){return{subscriptionIds:[]}}var zt={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=Ze.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof Ze.default.Reader?e:Ze.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ur();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.subscriptionIds.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{subscriptionIds:globalThis.Array.isArray(e?.subscriptionIds)?e.subscriptionIds.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.subscriptionIds?.length&&(t.subscriptionIds=e.subscriptionIds),t},create(e){return zt.fromPartial(e??{})},fromPartial(e){let t=Ur();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};c.set(zt.$type,zt);function Dr(){return{event:void 0,status:void 0}}var se={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=Ze.default.Writer.create()){return e.event!==void 0&&oe.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 Ze.default.Reader?e:Ze.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Dr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.event=oe.decode(n,n.uint32());continue;case 2:if(r!==16)break;i.status=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{event:Jr(e.event)?oe.fromJSON(e.event):void 0,status:Jr(e.status)?no(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=oe.toJSON(e.event)),e.status!==void 0&&(t.status=ro(e.status)),t},create(e){return se.fromPartial(e??{})},fromPartial(e){let t=Dr();return t.event=e.event!==void 0&&e.event!==null?oe.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};c.set(se.$type,se);function Jr(e){return e!=null}var W=x(V(),1);var gt=x(V(),1);var g=x(V(),1);var O;(function(e){e[e.STRING=0]="STRING",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.LIST=4]="LIST",e[e.SELECTION=5]="SELECTION",e[e.GROUP=6]="GROUP",e[e.IMAGE=7]="IMAGE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(O||(O={}));function Ye(e){switch(e){case 0:case"STRING":return O.STRING;case 1:case"PARAGRAPH":return O.PARAGRAPH;case 2:case"NUMBER":return O.NUMBER;case 3:case"BOOLEAN":return O.BOOLEAN;case 4:case"LIST":return O.LIST;case 5:case"SELECTION":return O.SELECTION;case 6:case"GROUP":return O.GROUP;case 7:case"IMAGE":return O.IMAGE;case-1:case"UNRECOGNIZED":default:return O.UNRECOGNIZED}}function Qe(e){switch(e){case O.STRING:return 0;case O.PARAGRAPH:return 1;case O.NUMBER:return 2;case O.BOOLEAN:return 3;case O.LIST:return 4;case O.SELECTION:return 5;case O.GROUP:return 6;case O.IMAGE:return 7;case O.UNRECOGNIZED:default:return-1}}var D=x(V(),1);function Wr(){return{fieldType:0,isSecret:void 0,stringValue:void 0,numberValue:void 0,boolValue:void 0,listValue:void 0,selectionValue:void 0,groupValue:void 0}}var b={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,t=D.default.Writer.create()){return e.fieldType!==0&&t.uint32(8).int32(e.fieldType),e.isSecret!==void 0&&t.uint32(800).bool(e.isSecret),e.stringValue!==void 0&&t.uint32(18).string(e.stringValue),e.numberValue!==void 0&&t.uint32(25).double(e.numberValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.listValue!==void 0&&ye.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&Ee.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&ve.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=Wr();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=ye.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionValue=Ee.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupValue=ve.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldType:ae(e.fieldType)?Ye(e.fieldType):0,isSecret:ae(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:ae(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:ae(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:ae(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:ae(e.listValue)?ye.fromJSON(e.listValue):void 0,selectionValue:ae(e.selectionValue)?Ee.fromJSON(e.selectionValue):void 0,groupValue:ae(e.groupValue)?ve.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=Qe(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=ye.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=Ee.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=ve.toJSON(e.groupValue)),t},create(e){return b.fromPartial(e??{})},fromPartial(e){let t=Wr();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?ye.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?Ee.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?ve.fromPartial(e.groupValue):void 0,t}};c.set(b.$type,b);function $r(){return{itemType:0,items:[]}}var ye={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=D.default.Writer.create()){e.itemType!==0&&t.uint32(8).int32(e.itemType);for(let n of e.items)b.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof D.default.Reader?e:D.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=$r();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.items.push(b.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:ae(e.itemType)?Ye(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(t=>b.fromJSON(t)):[]}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Qe(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>b.toJSON(n))),t},create(e){return ye.fromPartial(e??{})},fromPartial(e){let t=$r();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>b.fromPartial(n))||[],t}};c.set(ye.$type,ye);function Gr(){return{values:[]}}var Ee={$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=Gr();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 Ee.fromPartial(e??{})},fromPartial(e){let t=Gr();return t.values=e.values?.map(n=>n)||[],t}};c.set(Ee.$type,Ee);function qr(){return{}}var ve={$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=qr();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 ve.fromPartial(e??{})},fromPartial(e){return qr()}};c.set(ve.$type,ve);function ae(e){return e!=null}function Zr(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var B={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,t=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&&b.encode(e.defaultValue,t.uint32(42).fork()).ldelim(),e.required!==void 0&&t.uint32(48).bool(e.required),e.disabled!==void 0&&t.uint32(56).bool(e.disabled),e.fieldConfig!==void 0&&J.encode(e.fieldConfig,t.uint32(66).fork()).ldelim(),e.isSecret!==void 0&&t.uint32(72).bool(e.isSecret),t},decode(e,t){let n=e instanceof 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.fieldId=n.string();continue;case 2:if(r!==16)break;i.fieldType=n.int32();continue;case 3:if(r!==26)break;i.label=n.string();continue;case 4:if(r!==34)break;i.helpText=n.string();continue;case 5:if(r!==42)break;i.defaultValue=b.decode(n,n.uint32());continue;case 6:if(r!==48)break;i.required=n.bool();continue;case 7:if(r!==56)break;i.disabled=n.bool();continue;case 8:if(r!==66)break;i.fieldConfig=J.decode(n,n.uint32());continue;case 9:if(r!==72)break;i.isSecret=n.bool();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldId:h(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:h(e.fieldType)?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)?b.fromJSON(e.defaultValue):void 0,required:h(e.required)?globalThis.Boolean(e.required):void 0,disabled:h(e.disabled)?globalThis.Boolean(e.disabled):void 0,fieldConfig:h(e.fieldConfig)?J.fromJSON(e.fieldConfig):void 0,isSecret:h(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let t={};return e.fieldId!==""&&(t.fieldId=e.fieldId),e.fieldType!==0&&(t.fieldType=Qe(e.fieldType)),e.label!==""&&(t.label=e.label),e.helpText!==void 0&&(t.helpText=e.helpText),e.defaultValue!==void 0&&(t.defaultValue=b.toJSON(e.defaultValue)),e.required!==void 0&&(t.required=e.required),e.disabled!==void 0&&(t.disabled=e.disabled),e.fieldConfig!==void 0&&(t.fieldConfig=J.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return B.fromPartial(e??{})},fromPartial(e){let t=Zr();return t.fieldId=e.fieldId??"",t.fieldType=e.fieldType??0,t.label=e.label??"",t.helpText=e.helpText??void 0,t.defaultValue=e.defaultValue!==void 0&&e.defaultValue!==null?b.fromPartial(e.defaultValue):void 0,t.required=e.required??void 0,t.disabled=e.disabled??void 0,t.fieldConfig=e.fieldConfig!==void 0&&e.fieldConfig!==null?J.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};c.set(B.$type,B);function Hr(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var J={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=g.default.Writer.create()){return e.stringConfig!==void 0&&Ne.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&be.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&Te.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&Ie.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&Oe.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&_e.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&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=Hr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.stringConfig=Ne.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.paragraphConfig=be.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.numberConfig=Te.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.booleanConfig=Ie.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.listConfig=Oe.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionConfig=_e.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupConfig=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)?Ne.fromJSON(e.stringConfig):void 0,paragraphConfig:h(e.paragraphConfig)?be.fromJSON(e.paragraphConfig):void 0,numberConfig:h(e.numberConfig)?Te.fromJSON(e.numberConfig):void 0,booleanConfig:h(e.booleanConfig)?Ie.fromJSON(e.booleanConfig):void 0,listConfig:h(e.listConfig)?Oe.fromJSON(e.listConfig):void 0,selectionConfig:h(e.selectionConfig)?_e.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=Ne.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=be.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=Te.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=Ie.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=Oe.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=_e.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=Fe.toJSON(e.groupConfig)),t},create(e){return J.fromPartial(e??{})},fromPartial(e){let t=Hr();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?Ne.fromPartial(e.stringConfig):void 0,t.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?be.fromPartial(e.paragraphConfig):void 0,t.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?Te.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?Ie.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?Oe.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?_e.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?Fe.fromPartial(e.groupConfig):void 0,t}};c.set(J.$type,J);function Kr(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var Ne={$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=Kr();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 Ne.fromPartial(e??{})},fromPartial(e){let t=Kr();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(Ne.$type,Ne);function zr(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var be={$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=zr();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 be.fromPartial(e??{})},fromPartial(e){let t=zr();return t.maxCharacters=e.maxCharacters??void 0,t.lineHeight=e.lineHeight??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(be.$type,be);function Xr(){return{step:void 0,min:void 0,max:void 0}}var Te={$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=Xr();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 Te.fromPartial(e??{})},fromPartial(e){let t=Xr();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};c.set(Te.$type,Te);function Yr(){return{}}var Ie={$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=Yr();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 Ie.fromPartial(e??{})},fromPartial(e){return Yr()}};c.set(Ie.$type,Ie);function Qr(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var Oe={$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&&J.encode(e.itemConfig,t.uint32(18).fork()).ldelim(),e.minEntries!==void 0&&t.uint32(24).int32(e.minEntries),e.maxEntries!==void 0&&t.uint32(32).int32(e.maxEntries),e.entryLabel!==void 0&&t.uint32(42).string(e.entryLabel),t},decode(e,t){let n=e instanceof 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.itemType=n.int32();continue;case 2:if(r!==18)break;i.itemConfig=J.decode(n,n.uint32());continue;case 3:if(r!==24)break;i.minEntries=n.int32();continue;case 4:if(r!==32)break;i.maxEntries=n.int32();continue;case 5:if(r!==42)break;i.entryLabel=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:h(e.itemType)?Ye(e.itemType):0,itemConfig:h(e.itemConfig)?J.fromJSON(e.itemConfig):void 0,minEntries:h(e.minEntries)?globalThis.Number(e.minEntries):void 0,maxEntries:h(e.maxEntries)?globalThis.Number(e.maxEntries):void 0,entryLabel:h(e.entryLabel)?globalThis.String(e.entryLabel):void 0}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Qe(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=J.toJSON(e.itemConfig)),e.minEntries!==void 0&&(t.minEntries=Math.round(e.minEntries)),e.maxEntries!==void 0&&(t.maxEntries=Math.round(e.maxEntries)),e.entryLabel!==void 0&&(t.entryLabel=e.entryLabel),t},create(e){return Oe.fromPartial(e??{})},fromPartial(e){let t=Qr();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?J.fromPartial(e.itemConfig):void 0,t.minEntries=e.minEntries??void 0,t.maxEntries=e.maxEntries??void 0,t.entryLabel=e.entryLabel??void 0,t}};c.set(Oe.$type,Oe);function jr(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var _e={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=g.default.Writer.create()){for(let n of e.choices)Ce.encode(n,t.uint32(10).fork()).ldelim();return e.multiSelect!==void 0&&t.uint32(16).bool(e.multiSelect),e.minSelections!==void 0&&t.uint32(24).int32(e.minSelections),e.maxSelections!==void 0&&t.uint32(32).int32(e.maxSelections),e.renderAsList!==void 0&&t.uint32(40).bool(e.renderAsList),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.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.choices.push(Ce.decode(n,n.uint32()));continue;case 2:if(r!==16)break;i.multiSelect=n.bool();continue;case 3:if(r!==24)break;i.minSelections=n.int32();continue;case 4:if(r!==32)break;i.maxSelections=n.int32();continue;case 5:if(r!==40)break;i.renderAsList=n.bool();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{choices:globalThis.Array.isArray(e?.choices)?e.choices.map(t=>Ce.fromJSON(t)):[],multiSelect:h(e.multiSelect)?globalThis.Boolean(e.multiSelect):void 0,minSelections:h(e.minSelections)?globalThis.Number(e.minSelections):void 0,maxSelections:h(e.maxSelections)?globalThis.Number(e.maxSelections):void 0,renderAsList:h(e.renderAsList)?globalThis.Boolean(e.renderAsList):void 0}},toJSON(e){let t={};return e.choices?.length&&(t.choices=e.choices.map(n=>Ce.toJSON(n))),e.multiSelect!==void 0&&(t.multiSelect=e.multiSelect),e.minSelections!==void 0&&(t.minSelections=Math.round(e.minSelections)),e.maxSelections!==void 0&&(t.maxSelections=Math.round(e.maxSelections)),e.renderAsList!==void 0&&(t.renderAsList=e.renderAsList),t},create(e){return _e.fromPartial(e??{})},fromPartial(e){let t=jr();return t.choices=e.choices?.map(n=>Ce.fromPartial(n))||[],t.multiSelect=e.multiSelect??void 0,t.minSelections=e.minSelections??void 0,t.maxSelections=e.maxSelections??void 0,t.renderAsList=e.renderAsList??void 0,t}};c.set(_e.$type,_e);function ei(){return{label:"",value:""}}var Ce={$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=ei();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.label=n.string();continue;case 2:if(r!==18)break;i.value=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{label:h(e.label)?globalThis.String(e.label):"",value:h(e.value)?globalThis.String(e.value):""}},toJSON(e){let t={};return e.label!==""&&(t.label=e.label),e.value!==""&&(t.value=e.value),t},create(e){return Ce.fromPartial(e??{})},fromPartial(e){let t=ei();return t.label=e.label??"",t.value=e.value??"",t}};c.set(Ce.$type,Ce);function ti(){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)B.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=ti();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(B.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>B.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>B.toJSON(n))),t},create(e){return Fe.fromPartial(e??{})},fromPartial(e){let t=ti();return t.fields=e.fields?.map(n=>B.fromPartial(n))||[],t}};c.set(Fe.$type,Fe);function h(e){return e!=null}function ni(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var ue={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=gt.default.Writer.create()){for(let n of e.fields)B.encode(n,t.uint32(10).fork()).ldelim();return e.title!==void 0&&t.uint32(18).string(e.title),e.shortDescription!==void 0&&t.uint32(26).string(e.shortDescription),e.acceptLabel!==void 0&&t.uint32(34).string(e.acceptLabel),e.cancelLabel!==void 0&&t.uint32(42).string(e.cancelLabel),e.id!==void 0&&t.uint32(50).string(e.id),t},decode(e,t){let n=e instanceof gt.default.Reader?e:gt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ni();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(B.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.title=n.string();continue;case 3:if(r!==26)break;i.shortDescription=n.string();continue;case 4:if(r!==34)break;i.acceptLabel=n.string();continue;case 5:if(r!==42)break;i.cancelLabel=n.string();continue;case 6:if(r!==50)break;i.id=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>B.fromJSON(t)):[],title:rt(e.title)?globalThis.String(e.title):void 0,shortDescription:rt(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:rt(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:rt(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:rt(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>B.toJSON(n))),e.title!==void 0&&(t.title=e.title),e.shortDescription!==void 0&&(t.shortDescription=e.shortDescription),e.acceptLabel!==void 0&&(t.acceptLabel=e.acceptLabel),e.cancelLabel!==void 0&&(t.cancelLabel=e.cancelLabel),e.id!==void 0&&(t.id=e.id),t},create(e){return ue.fromPartial(e??{})},fromPartial(e){let t=ni();return t.fields=e.fields?.map(n=>B.fromPartial(n))||[],t.title=e.title??void 0,t.shortDescription=e.shortDescription??void 0,t.acceptLabel=e.acceptLabel??void 0,t.cancelLabel=e.cancelLabel??void 0,t.id=e.id??void 0,t}};c.set(ue.$type,ue);function rt(e){return e!=null}function ri(){return{form:void 0}}var Xt={$type:"devvit.ui.effects.v1alpha.ShowFormEffect",encode(e,t=W.default.Writer.create()){return e.form!==void 0&&ue.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ri();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.form=ue.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{form:ot(e.form)?ue.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=ue.toJSON(e.form)),t},create(e){return Xt.fromPartial(e??{})},fromPartial(e){let t=ri();return t.form=e.form!==void 0&&e.form!==null?ue.fromPartial(e.form):void 0,t}};c.set(Xt.$type,Xt);function ii(){return{results:{},formId:void 0}}var fe={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent",encode(e,t=W.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{it.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),e.formId!==void 0&&t.uint32(18).string(e.formId),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ii();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let s=it.decode(n,n.uint32());s.value!==void 0&&(i.results[s.key]=s.value);continue;case 2:if(r!==18)break;i.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{results:io(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=b.fromJSON(o),t),{}):{},formId:ot(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let t={};if(e.results){let n=Object.entries(e.results);n.length>0&&(t.results={},n.forEach(([o,i])=>{t.results[o]=b.toJSON(i)}))}return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return fe.fromPartial(e??{})},fromPartial(e){let t=ii();return t.results=Object.entries(e.results??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=b.fromPartial(i)),n),{}),t.formId=e.formId??void 0,t}};c.set(fe.$type,fe);function oi(){return{key:"",value:void 0}}var it={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=W.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&b.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=oi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=b.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:ot(e.key)?globalThis.String(e.key):"",value:ot(e.value)?b.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=b.toJSON(e.value)),t},create(e){return it.fromPartial(e??{})},fromPartial(e){let t=oi();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?b.fromPartial(e.value):void 0,t}};c.set(it.$type,it);function si(){return{formId:void 0}}var de={$type:"devvit.ui.effects.v1alpha.FormCanceledEvent",encode(e,t=W.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=si();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{formId:ot(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let t={};return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return de.fromPartial(e??{})},fromPartial(e){let t=si();return t.formId=e.formId??void 0,t}};c.set(de.$type,de);function io(e){return typeof e=="object"&&e!==null}function ot(e){return e!=null}var Ve;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ve||(Ve={}));function oo(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return Ve.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return Ve.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return Ve.UNRECOGNIZED}}function so(e){switch(e){case Ve.WEBVIEW_VISIBLE:return 0;case Ve.WEBVIEW_HIDDEN:return 1;case Ve.UNRECOGNIZED:default:return-1}}function ai(){return{message:void 0,jsonString:""}}var Re={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=T.default.Writer.create()){return e.message!==void 0&&F.encode(F.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ai();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.message=F.unwrap(F.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 Re.fromPartial(e??{})},fromPartial(e){let t=ai();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};c.set(Re.$type,Re);function ui(){return{visibility:0}}var ke={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=T.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ui();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)?oo(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=so(e.visibility)),t},create(e){return ke.fromPartial(e??{})},fromPartial(e){let t=ui();return t.visibility=e.visibility??0,t}};c.set(ke.$type,ke);function fi(){return{postMessage:void 0,fullScreen:void 0}}var Yt={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=T.default.Writer.create()){return e.postMessage!==void 0&&Re.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&ke.encode(e.fullScreen,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=fi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postMessage=Re.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.fullScreen=ke.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)?Re.fromJSON(e.postMessage):void 0,fullScreen:k(e.fullScreen)?ke.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=Re.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=ke.toJSON(e.fullScreen)),t},create(e){return Yt.fromPartial(e??{})},fromPartial(e){let t=fi();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?Re.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?ke.fromPartial(e.fullScreen):void 0,t}};c.set(Yt.$type,Yt);function di(){return{immersiveMode:0}}var xe={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode(e,t=T.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=di();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)?xt(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=wt(e.immersiveMode)),t},create(e){return xe.fromPartial(e??{})},fromPartial(e){let t=di();return t.immersiveMode=e.immersiveMode??0,t}};c.set(xe.$type,xe);function li(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,consentStatus:void 0}}var re={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=T.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&de.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&fe.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&se.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&xe.encode(e.immersiveModeEvent,t.uint32(42).fork()).ldelim(),e.consentStatus!==void 0&&ie.encode(e.consentStatus,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=li();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=de.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.formSubmitted=fe.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.realtimeEvent=se.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.immersiveModeEvent=xe.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.consentStatus=ie.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)?de.fromJSON(e.formCanceled):void 0,formSubmitted:k(e.formSubmitted)?fe.fromJSON(e.formSubmitted):void 0,realtimeEvent:k(e.realtimeEvent)?se.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:k(e.immersiveModeEvent)?xe.fromJSON(e.immersiveModeEvent):void 0,consentStatus:k(e.consentStatus)?ie.fromJSON(e.consentStatus):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=de.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=fe.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=se.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(t.immersiveModeEvent=xe.toJSON(e.immersiveModeEvent)),e.consentStatus!==void 0&&(t.consentStatus=ie.toJSON(e.consentStatus)),t},create(e){return re.fromPartial(e??{})},fromPartial(e){let t=li();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?de.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?fe.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?se.fromPartial(e.realtimeEvent):void 0,t.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?xe.fromPartial(e.immersiveModeEvent):void 0,t.consentStatus=e.consentStatus!==void 0&&e.consentStatus!==null?ie.fromPartial(e.consentStatus):void 0,t}};c.set(re.$type,re);function ci(){return{data:void 0}}var Qt={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent",encode(e,t=T.default.Writer.create()){return e.data!==void 0&&we.encode(e.data,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ci();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.data=we.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{data:k(e.data)?we.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.data!==void 0&&(t.data=we.toJSON(e.data)),t},create(e){return Qt.fromPartial(e??{})},fromPartial(e){let t=ci();return t.data=e.data!==void 0&&e.data!==null?we.fromPartial(e.data):void 0,t}};c.set(Qt.$type,Qt);function pi(){return{type:"",data:void 0}}var we={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent.MessageData",encode(e,t=T.default.Writer.create()){return e.type!==""&&t.uint32(10).string(e.type),e.data!==void 0&&re.encode(e.data,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=pi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.type=n.string();continue;case 2:if(r!==18)break;i.data=re.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{type:k(e.type)?globalThis.String(e.type):"",data:k(e.data)?re.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.type!==""&&(t.type=e.type),e.data!==void 0&&(t.data=re.toJSON(e.data)),t},create(e){return we.fromPartial(e??{})},fromPartial(e){let t=pi();return t.type=e.type??"",t.data=e.data!==void 0&&e.data!==null?re.fromPartial(e.data):void 0,t}};c.set(we.$type,we);function k(e){return e!=null}var ao=[3,11],z=e=>new Promise(t=>{let n={scope:0,type:"devvit-internal"};if(e.realtimeSubscriptions?n.realtimeEffect=e.realtimeSubscriptions:e.immersiveMode?n.immersiveMode=e.immersiveMode:e.share?n.share=e.share:n.effect=e,e.showToast&&(n.showToast=e.showToast),ao.includes(e.type)){let o=self.crypto.randomUUID();n.id=o;let i=r=>{if(r.data?.type==="devvit-message"&&r.data?.data?.id===o){let s=re.fromJSON(r.data.data);t(s),window.removeEventListener("message",i)}};window.addEventListener("message",i),window.parent.postMessage(n,"*")}else window.parent.postMessage(n,"*"),t(void 0)});var jt=new Set;function uo(e){return hi(2,e)}function fo(e){return hi(1,e)}function lo(e){jt.add(e)}function co(e){jt.delete(e)}async function hi(e,t){if(!t.isTrusted)throw console.error("Immersive mode effect ignored due to untrusted event"),new Error("Untrusted event");await z({type:9,immersiveMode:{immersiveMode:e}})}typeof addEventListener=="function"&&addEventListener("message",e=>{let{type:t,data:n}=e.data;if(t!=="devvit-message"||!n?.immersiveModeEvent)return;let i=e.data.data?.immersiveModeEvent?.immersiveMode===2?"immersive":"inline";jt.forEach(r=>r(i))});function po(e){let t=typeof e=="string"?e:e.url;if(!URL.canParse(t))throw new TypeError(`Invalid URL: ${t}`);let n=new URL(t).toString();z({navigateToUrl:{url:n},type:5})}var Pe;(function(e){e[e.CONSENT_STATUS_UNKNOWN=0]="CONSENT_STATUS_UNKNOWN",e[e.REVOKED=1]="REVOKED",e[e.GRANTED=2]="GRANTED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Pe||(Pe={}));var mi;(function(e){e[e.SCOPE_UNKNOWN=0]="SCOPE_UNKNOWN",e[e.SUBMIT_POST=1]="SUBMIT_POST",e[e.SUBMIT_COMMENT=2]="SUBMIT_COMMENT",e[e.SUBSCRIBE_TO_SUBREDDIT=3]="SUBSCRIBE_TO_SUBREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(mi||(mi={}));var ho=async()=>{let e=devvit.appPermissionState;if(!e)return!0;if(e.requestedScopes.length===0)return!1;switch(e.consentStatus){case Pe.REVOKED:return!1;case Pe.GRANTED:if(e.requestedScopes.every(n=>e.grantedScopes.includes(n)))return!0;break;case Pe.CONSENT_STATUS_UNKNOWN:case Pe.UNRECOGNIZED:break;default:{e.consentStatus;break}}return(await z({canRunAsUser:{postId:devvit.context.postId},type:11}))?.consentStatus?.consentStatus===Pe.GRANTED};var gi="$devvit_icon.png";async function mo(e){if(e.data&&e.data.length>1024)throw Error(`data must be <= ${1024} characters but was ${e.data.length} characters`);let t=`${new URL(gi,location.origin)}`,n;try{n=await fetch(t,{method:"HEAD"})}catch{}await z({type:9,share:{appIconUri:n?.ok?t:void 0,userData:e.data,text:e.text,title:e.title}})}function go(){return devvit.share?.userData}function en(e,t=new Set){for(let n of e){if(n.type==="group"){en(n.fields,t);continue}let o=n.name;if(t.has(o))throw new Error(`Duplicate field name: ${o}`);t.add(o)}So(e)}function So(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 yo(e){switch(e.fieldType){case 0:return e.stringValue;case 7:return e.stringValue;case 1:return e.stringValue;case 2:return e.numberValue;case 3:return e.boolValue;case 5:return e.selectionValue?.values??[];default:return}}function yi(e){return Object.keys(e).reduce((t,n)=>{let o=yo(e[n]);return o!==void 0&&(t[n]=o),t},{})}function tn(e){return e.map(t=>{switch(t.type){case"string":return Eo(t);case"image":return vo(t);case"paragraph":return No(t);case"number":return bo(t);case"select":return To(t);case"boolean":return Io(t);case"group":return Oo(t);default:throw new Error("Unknown field type.")}})}function Eo(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 vo(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function No(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 bo(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 To(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 Io(e){return{defaultValue:{fieldType:3,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:3,helpText:e.helpText,label:e.label}}function Oo(e){return{fieldId:"",fieldType:6,fieldConfig:{groupConfig:{fields:tn(e.fields)}},label:e.label,helpText:e.helpText}}var Ei=1,_o=()=>(Ei++,`form.${Ei}`),Co=async e=>{let t={fields:[],id:_o(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};en(e.fields),t.fields=tn(e.fields);let n=await z({showForm:{form:t},type:3});return!n||!n.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:yi(n.formSubmitted.results)}};function Fo(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?1:0}:t={text:e},z({showToast:{toast:t},type:4})}export{lo as addImmersiveModeChangeEventListener,ho as canRunAsUser,Li as context,fo as exitImmersiveMode,go as getShareData,po as navigateTo,co as removeImmersiveModeChangeEventListener,uo as requestImmersiveMode,Co as showForm,mo as showShareSheet,Fo as showToast};
|
|
2
2
|
//# sourceMappingURL=client.min.js.map
|