@devvit/client 0.11.19-next-2025-07-10-21-55-12-58d180e2e.0 → 0.11.19-next-2025-07-14-14-22-12-c32c54785.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 +29 -5
- package/client.min.js +1 -1
- package/client.min.js.map +4 -4
- package/package.json +10 -10
package/client-meta.min.json
CHANGED
|
@@ -4829,8 +4829,24 @@
|
|
|
4829
4829
|
],
|
|
4830
4830
|
"format": "esm"
|
|
4831
4831
|
},
|
|
4832
|
+
"../protos/dist/types/devvit/ui/effects/web_view/v1alpha/immersive_mode.js": {
|
|
4833
|
+
"bytes": 3478,
|
|
4834
|
+
"imports": [
|
|
4835
|
+
{
|
|
4836
|
+
"path": "../../node_modules/protobufjs/minimal.js",
|
|
4837
|
+
"kind": "import-statement",
|
|
4838
|
+
"original": "protobufjs/minimal.js"
|
|
4839
|
+
},
|
|
4840
|
+
{
|
|
4841
|
+
"path": "../protos/dist/types/typeRegistry.js",
|
|
4842
|
+
"kind": "import-statement",
|
|
4843
|
+
"original": "../../../../../typeRegistry.js"
|
|
4844
|
+
}
|
|
4845
|
+
],
|
|
4846
|
+
"format": "esm"
|
|
4847
|
+
},
|
|
4832
4848
|
"../protos/dist/types/devvit/ui/events/v1alpha/web_view.js": {
|
|
4833
|
-
"bytes":
|
|
4849
|
+
"bytes": 16141,
|
|
4834
4850
|
"imports": [
|
|
4835
4851
|
{
|
|
4836
4852
|
"path": "../../node_modules/protobufjs/minimal.js",
|
|
@@ -4856,6 +4872,11 @@
|
|
|
4856
4872
|
"path": "../protos/dist/types/devvit/ui/effects/v1alpha/show_form.js",
|
|
4857
4873
|
"kind": "import-statement",
|
|
4858
4874
|
"original": "../../effects/v1alpha/show_form.js"
|
|
4875
|
+
},
|
|
4876
|
+
{
|
|
4877
|
+
"path": "../protos/dist/types/devvit/ui/effects/web_view/v1alpha/immersive_mode.js",
|
|
4878
|
+
"kind": "import-statement",
|
|
4879
|
+
"original": "../../effects/web_view/v1alpha/immersive_mode.js"
|
|
4859
4880
|
}
|
|
4860
4881
|
],
|
|
4861
4882
|
"format": "esm"
|
|
@@ -4992,7 +5013,7 @@
|
|
|
4992
5013
|
"imports": [],
|
|
4993
5014
|
"exports": [],
|
|
4994
5015
|
"inputs": {},
|
|
4995
|
-
"bytes":
|
|
5016
|
+
"bytes": 340898
|
|
4996
5017
|
},
|
|
4997
5018
|
"dist/client.min.js": {
|
|
4998
5019
|
"imports": [],
|
|
@@ -5084,7 +5105,7 @@
|
|
|
5084
5105
|
"bytesInOutput": 0
|
|
5085
5106
|
},
|
|
5086
5107
|
"../protos/dist/types/devvit/ui/events/v1alpha/web_view.js": {
|
|
5087
|
-
"bytesInOutput":
|
|
5108
|
+
"bytesInOutput": 6675
|
|
5088
5109
|
},
|
|
5089
5110
|
"../protos/dist/types/devvit/ui/effects/v1alpha/realtime_subscriptions.js": {
|
|
5090
5111
|
"bytesInOutput": 2445
|
|
@@ -5102,7 +5123,7 @@
|
|
|
5102
5123
|
"bytesInOutput": 2203
|
|
5103
5124
|
},
|
|
5104
5125
|
"../protos/dist/types/devvit/ui/form_builder/v1alpha/field.js": {
|
|
5105
|
-
"bytesInOutput":
|
|
5126
|
+
"bytesInOutput": 16434
|
|
5106
5127
|
},
|
|
5107
5128
|
"../protos/dist/types/devvit/ui/form_builder/v1alpha/type.js": {
|
|
5108
5129
|
"bytesInOutput": 884
|
|
@@ -5110,6 +5131,9 @@
|
|
|
5110
5131
|
"../protos/dist/types/devvit/ui/form_builder/v1alpha/value.js": {
|
|
5111
5132
|
"bytesInOutput": 5301
|
|
5112
5133
|
},
|
|
5134
|
+
"../protos/dist/types/devvit/ui/effects/web_view/v1alpha/immersive_mode.js": {
|
|
5135
|
+
"bytesInOutput": 1380
|
|
5136
|
+
},
|
|
5113
5137
|
"src/effects/constants.ts": {
|
|
5114
5138
|
"bytesInOutput": 11
|
|
5115
5139
|
},
|
|
@@ -5138,7 +5162,7 @@
|
|
|
5138
5162
|
"bytesInOutput": 141
|
|
5139
5163
|
}
|
|
5140
5164
|
},
|
|
5141
|
-
"bytes":
|
|
5165
|
+
"bytes": 77713
|
|
5142
5166
|
}
|
|
5143
5167
|
}
|
|
5144
5168
|
}
|
package/client.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var Qn=Object.create;var dt=Object.defineProperty;var Yn=Object.getOwnPropertyDescriptor;var Xn=Object.getOwnPropertyNames;var jn=Object.getPrototypeOf,er=Object.prototype.hasOwnProperty;var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var tr=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xn(t))!er.call(e,i)&&i!==n&&dt(e,i,{get:()=>t[i],enumerable:!(o=Yn(t,i))||o.enumerable});return e};var P=(e,t,n)=>(n=e!=null?Qn(jn(e)):{},tr(t||!e||!e.__esModule?dt(n,"default",{value:e,enumerable:!0}):n,e));var ct=b((Mr,st)=>{"use strict";st.exports=nr;function nr(e,t){for(var n=new Array(arguments.length-1),o=0,i=2,r=!0;i<arguments.length;)n[o++]=arguments[i++];return new Promise(function(l,u){n[o]=function(s){if(r)if(r=!1,s)u(s);else{for(var _=new Array(arguments.length-1),se=0;se<_.length;)_[se++]=arguments[se];l.apply(null,_)}};try{e.apply(t||null,n)}catch(f){r&&(r=!1,u(f))}})}});var yt=b(mt=>{"use strict";var Le=mt;Le.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 be=new Array(64),ht=new Array(123);for(R=0;R<64;)ht[be[R]=R<26?R+65:R<52?R+71:R<62?R-4:R-59|43]=R++;var R;Le.encode=function(t,n,o){for(var i=null,r=[],a=0,l=0,u;n<o;){var f=t[n++];switch(l){case 0:r[a++]=be[f>>2],u=(f&3)<<4,l=1;break;case 1:r[a++]=be[u|f>>4],u=(f&15)<<2,l=2;break;case 2:r[a++]=be[u|f>>6],r[a++]=be[f&63],l=0;break}a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,r)),a=0)}return l&&(r[a++]=be[u],r[a++]=61,l===1&&(r[a++]=61)),i?(a&&i.push(String.fromCharCode.apply(String,r.slice(0,a))),i.join("")):String.fromCharCode.apply(String,r.slice(0,a))};var pt="invalid encoding";Le.decode=function(t,n,o){for(var i=o,r=0,a,l=0;l<t.length;){var u=t.charCodeAt(l++);if(u===61&&r>1)break;if((u=ht[u])===void 0)throw Error(pt);switch(r){case 0:a=u,r=1;break;case 1:n[o++]=a<<2|(u&48)>>4,a=u,r=2;break;case 2:n[o++]=(a&15)<<4|(u&60)>>2,a=u,r=3;break;case 3:n[o++]=(a&3)<<6|u,r=0;break}}if(r===1)throw Error(pt);return o-i};Le.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var St=b(($r,gt)=>{"use strict";gt.exports=Be;function Be(){this._listeners={}}Be.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};Be.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};Be.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 Ct=b((Gr,Vt)=>{"use strict";Vt.exports=bt(bt);function bt(e){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function i(u,f,s){t[0]=u,f[s]=n[0],f[s+1]=n[1],f[s+2]=n[2],f[s+3]=n[3]}function r(u,f,s){t[0]=u,f[s]=n[3],f[s+1]=n[2],f[s+2]=n[1],f[s+3]=n[0]}e.writeFloatLE=o?i:r,e.writeFloatBE=o?r:i;function a(u,f){return n[0]=u[f],n[1]=u[f+1],n[2]=u[f+2],n[3]=u[f+3],t[0]}function l(u,f){return n[3]=u[f],n[2]=u[f+1],n[1]=u[f+2],n[0]=u[f+3],t[0]}e.readFloatLE=o?a:l,e.readFloatBE=o?l:a}():function(){function t(o,i,r,a){var l=i<0?1:0;if(l&&(i=-i),i===0)o(1/i>0?0:2147483648,r,a);else if(isNaN(i))o(2143289344,r,a);else if(i>34028234663852886e22)o((l<<31|2139095040)>>>0,r,a);else if(i<11754943508222875e-54)o((l<<31|Math.round(i/1401298464324817e-60))>>>0,r,a);else{var u=Math.floor(Math.log(i)/Math.LN2),f=Math.round(i*Math.pow(2,-u)*8388608)&8388607;o((l<<31|u+127<<23|f)>>>0,r,a)}}e.writeFloatLE=t.bind(null,vt),e.writeFloatBE=t.bind(null,Et);function n(o,i,r){var a=o(i,r),l=(a>>31)*2+1,u=a>>>23&255,f=a&8388607;return u===255?f?NaN:l*(1/0):u===0?l*1401298464324817e-60*f:l*Math.pow(2,u-150)*(f+8388608)}e.readFloatLE=n.bind(null,Tt),e.readFloatBE=n.bind(null,Nt)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function i(u,f,s){t[0]=u,f[s]=n[0],f[s+1]=n[1],f[s+2]=n[2],f[s+3]=n[3],f[s+4]=n[4],f[s+5]=n[5],f[s+6]=n[6],f[s+7]=n[7]}function r(u,f,s){t[0]=u,f[s]=n[7],f[s+1]=n[6],f[s+2]=n[5],f[s+3]=n[4],f[s+4]=n[3],f[s+5]=n[2],f[s+6]=n[1],f[s+7]=n[0]}e.writeDoubleLE=o?i:r,e.writeDoubleBE=o?r:i;function a(u,f){return n[0]=u[f],n[1]=u[f+1],n[2]=u[f+2],n[3]=u[f+3],n[4]=u[f+4],n[5]=u[f+5],n[6]=u[f+6],n[7]=u[f+7],t[0]}function l(u,f){return n[7]=u[f],n[6]=u[f+1],n[5]=u[f+2],n[4]=u[f+3],n[3]=u[f+4],n[2]=u[f+5],n[1]=u[f+6],n[0]=u[f+7],t[0]}e.readDoubleLE=o?a:l,e.readDoubleBE=o?l:a}():function(){function t(o,i,r,a,l,u){var f=a<0?1:0;if(f&&(a=-a),a===0)o(0,l,u+i),o(1/a>0?0:2147483648,l,u+r);else if(isNaN(a))o(0,l,u+i),o(2146959360,l,u+r);else if(a>17976931348623157e292)o(0,l,u+i),o((f<<31|2146435072)>>>0,l,u+r);else{var s;if(a<22250738585072014e-324)s=a/5e-324,o(s>>>0,l,u+i),o((f<<31|s/4294967296)>>>0,l,u+r);else{var _=Math.floor(Math.log(a)/Math.LN2);_===1024&&(_=1023),s=a*Math.pow(2,-_),o(s*4503599627370496>>>0,l,u+i),o((f<<31|_+1023<<20|s*1048576&1048575)>>>0,l,u+r)}}}e.writeDoubleLE=t.bind(null,vt,0,4),e.writeDoubleBE=t.bind(null,Et,4,0);function n(o,i,r,a,l){var u=o(a,l+i),f=o(a,l+r),s=(f>>31)*2+1,_=f>>>20&2047,se=4294967296*(f&1048575)+u;return _===2047?se?NaN:s*(1/0):_===0?s*5e-324*se:s*Math.pow(2,_-1075)*(se+4503599627370496)}e.readDoubleLE=n.bind(null,Tt,0,4),e.readDoubleBE=n.bind(null,Nt,4,0)}(),e}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}function Et(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 Tt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Nt(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var xt=b((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}});var It=b(kt=>{"use strict";var Ue=kt;Ue.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};Ue.read=function(t,n,o){var i=o-n;if(i<1)return"";for(var r=null,a=[],l=0,u;n<o;)u=t[n++],u<128?a[l++]=u:u>191&&u<224?a[l++]=(u&31)<<6|t[n++]&63:u>239&&u<365?(u=((u&7)<<18|(t[n++]&63)<<12|(t[n++]&63)<<6|t[n++]&63)-65536,a[l++]=55296+(u>>10),a[l++]=56320+(u&1023)):a[l++]=(u&15)<<12|(t[n++]&63)<<6|t[n++]&63,l>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,a)),l=0);return r?(l&&r.push(String.fromCharCode.apply(String,a.slice(0,l))),r.join("")):String.fromCharCode.apply(String,a.slice(0,l))};Ue.write=function(t,n,o){for(var i=o,r,a,l=0;l<t.length;++l)r=t.charCodeAt(l),r<128?n[o++]=r:r<2048?(n[o++]=r>>6|192,n[o++]=r&63|128):(r&64512)===55296&&((a=t.charCodeAt(l+1))&64512)===56320?(r=65536+((r&1023)<<10)+(a&1023),++l,n[o++]=r>>18|240,n[o++]=r>>12&63|128,n[o++]=r>>6&63|128,n[o++]=r&63|128):(n[o++]=r>>12|224,n[o++]=r>>6&63|128,n[o++]=r&63|128);return o-i}});var _t=b((Hr,Ft)=>{"use strict";Ft.exports=rr;function rr(e,t,n){var o=n||8192,i=o>>>1,r=null,a=o;return function(u){if(u<1||u>i)return e(u);a+u>o&&(r=e(o),a=0);var f=t.call(r,a,a+=u);return a&7&&(a=(a|7)+1),f}}});var Rt=b((Zr,Ot)=>{"use strict";Ot.exports=v;var Ve=H();function v(e,t){this.lo=e>>>0,this.hi=t>>>0}var ce=v.zero=new v(0,0);ce.toNumber=function(){return 0};ce.zzEncode=ce.zzDecode=function(){return this};ce.length=function(){return 1};var ir=v.zeroHash="\0\0\0\0\0\0\0\0";v.fromNumber=function(t){if(t===0)return ce;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 v(o,i)};v.from=function(t){if(typeof t=="number")return v.fromNumber(t);if(Ve.isString(t))if(Ve.Long)t=Ve.Long.fromString(t);else return v.fromNumber(parseInt(t,10));return t.low||t.high?new v(t.low>>>0,t.high>>>0):ce};v.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var n=~this.lo+1>>>0,o=~this.hi>>>0;return n||(o=o+1>>>0),-(n+o*4294967296)}return this.lo+this.hi*4294967296};v.prototype.toLong=function(t){return Ve.Long?new Ve.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var q=String.prototype.charCodeAt;v.fromHash=function(t){return t===ir?ce:new v((q.call(t,0)|q.call(t,1)<<8|q.call(t,2)<<16|q.call(t,3)<<24)>>>0,(q.call(t,4)|q.call(t,5)<<8|q.call(t,6)<<16|q.call(t,7)<<24)>>>0)};v.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};v.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};v.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};v.prototype.length=function(){var t=this.lo,n=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?n===0?t<16384?t<128?1:2:t<2097152?3:4:n<16384?n<128?5:6:n<2097152?7:8:o<128?9:10}});var H=b($e=>{"use strict";var d=$e;d.asPromise=ct();d.base64=yt();d.EventEmitter=St();d.float=Ct();d.inquire=xt();d.utf8=It();d.pool=_t();d.LongBits=Rt();d.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);d.global=d.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||$e;d.emptyArray=Object.freeze?Object.freeze([]):[];d.emptyObject=Object.freeze?Object.freeze({}):{};d.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};d.isString=function(t){return typeof t=="string"||t instanceof String};d.isObject=function(t){return t&&typeof t=="object"};d.isset=d.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};d.Buffer=function(){try{var e=d.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}}();d._Buffer_from=null;d._Buffer_allocUnsafe=null;d.newBuffer=function(t){return typeof t=="number"?d.Buffer?d._Buffer_allocUnsafe(t):new d.Array(t):d.Buffer?d._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};d.Array=typeof Uint8Array<"u"?Uint8Array:Array;d.Long=d.global.dcodeIO&&d.global.dcodeIO.Long||d.global.Long||d.inquire("long");d.key2Re=/^true|false|0|1$/;d.key32Re=/^-?(?:0|[1-9][0-9]*)$/;d.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;d.longToHash=function(t){return t?d.LongBits.from(t).toHash():d.LongBits.zeroHash};d.longFromHash=function(t,n){var o=d.LongBits.fromHash(t);return d.Long?d.Long.fromBits(o.lo,o.hi,n):o.toNumber(!!n)};function wt(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}d.merge=wt;d.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Lt(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&&wt(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}d.newError=Lt;d.ProtocolError=Lt("ProtocolError");d.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]}};d.oneOfSetter=function(t){return function(n){for(var o=0;o<t.length;++o)t[o]!==n&&delete this[t[o]]}};d.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};d._configure=function(){var e=d.Buffer;if(!e){d._Buffer_from=d._Buffer_allocUnsafe=null;return}d._Buffer_from=e.from!==Uint8Array.from&&e.from||function(n,o){return new e(n,o)},d._Buffer_allocUnsafe=e.allocUnsafe||function(n){return new e(n)}}});var Qe=b((Kr,Dt)=>{"use strict";Dt.exports=h;var O=H(),Ge,Pe=O.LongBits,Bt=O.base64,Pt=O.utf8;function Ce(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function He(){}function or(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new Ce(He,0,0),this.tail=this.head,this.states=null}var At=function(){return O.Buffer?function(){return(h.create=function(){return new Ge})()}:function(){return new h}};h.create=At();h.alloc=function(t){return new O.Array(t)};O.Array!==Array&&(h.alloc=O.pool(h.alloc,O.Array.prototype.subarray));h.prototype._push=function(t,n,o){return this.tail=this.tail.next=new Ce(t,n,o),this.len+=n,this};function Ze(e,t,n){t[n]=e&255}function ur(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function ze(e,t){this.len=e,this.next=void 0,this.val=t}ze.prototype=Object.create(Ce.prototype);ze.prototype.fn=ur;h.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new ze((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};h.prototype.int32=function(t){return t<0?this._push(Ke,10,Pe.fromNumber(t)):this.uint32(t)};h.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Ke(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}h.prototype.uint64=function(t){var n=Pe.from(t);return this._push(Ke,n.length(),n)};h.prototype.int64=h.prototype.uint64;h.prototype.sint64=function(t){var n=Pe.from(t).zzEncode();return this._push(Ke,n.length(),n)};h.prototype.bool=function(t){return this._push(Ze,1,t?1:0)};function qe(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}h.prototype.fixed32=function(t){return this._push(qe,4,t>>>0)};h.prototype.sfixed32=h.prototype.fixed32;h.prototype.fixed64=function(t){var n=Pe.from(t);return this._push(qe,4,n.lo)._push(qe,4,n.hi)};h.prototype.sfixed64=h.prototype.fixed64;h.prototype.float=function(t){return this._push(O.float.writeFloatLE,4,t)};h.prototype.double=function(t){return this._push(O.float.writeDoubleLE,8,t)};var ar=O.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]};h.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push(Ze,1,0);if(O.isString(t)){var o=h.alloc(n=Bt.length(t));Bt.decode(t,o,0),t=o}return this.uint32(n)._push(ar,n,t)};h.prototype.string=function(t){var n=Pt.length(t);return n?this.uint32(n)._push(Pt.write,n,t):this._push(Ze,1,0)};h.prototype.fork=function(){return this.states=new or(this),this.head=this.tail=new Ce(He,0,0),this.len=0,this};h.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 Ce(He,0,0),this.len=0),this};h.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};h.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};h._configure=function(e){Ge=e,h.create=At(),Ge._configure()}});var Mt=b((Qr,Wt)=>{"use strict";Wt.exports=A;var Jt=Qe();(A.prototype=Object.create(Jt.prototype)).constructor=A;var Z=H();function A(){Jt.call(this)}A._configure=function(){A.alloc=Z._Buffer_allocUnsafe,A.writeBytesBuffer=Z.Buffer&&Z.Buffer.prototype instanceof Uint8Array&&Z.Buffer.prototype.set.name==="set"?function(t,n,o){n.set(t,o)}:function(t,n,o){if(t.copy)t.copy(n,o,0,t.length);else for(var i=0;i<t.length;)n[o++]=t[i++]}};A.prototype.bytes=function(t){Z.isString(t)&&(t=Z._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(A.writeBytesBuffer,n,t),this};function fr(e,t,n){e.length<40?Z.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}A.prototype.string=function(t){var n=Z.Buffer.byteLength(t);return this.uint32(n),n&&this._push(fr,n,t),this};A._configure()});var je=b((Yr,Ht)=>{"use strict";Ht.exports=g;var w=H(),Xe,Gt=w.LongBits,lr=w.utf8;function L(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function g(e){this.buf=e,this.pos=0,this.len=e.length}var Ut=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new g(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new g(t);throw Error("illegal buffer")},qt=function(){return w.Buffer?function(n){return(g.create=function(i){return w.Buffer.isBuffer(i)?new Xe(i):Ut(i)})(n)}:Ut};g.create=qt();g.prototype._slice=w.Array.prototype.subarray||w.Array.prototype.slice;g.prototype.uint32=function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,L(this,10);return t}}();g.prototype.int32=function(){return this.uint32()|0};g.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function Ye(){var e=new Gt(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 L(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 L(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}g.prototype.bool=function(){return this.uint32()!==0};function Ae(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}g.prototype.fixed32=function(){if(this.pos+4>this.len)throw L(this,4);return Ae(this.buf,this.pos+=4)};g.prototype.sfixed32=function(){if(this.pos+4>this.len)throw L(this,4);return Ae(this.buf,this.pos+=4)|0};function $t(){if(this.pos+8>this.len)throw L(this,8);return new Gt(Ae(this.buf,this.pos+=4),Ae(this.buf,this.pos+=4))}g.prototype.float=function(){if(this.pos+4>this.len)throw L(this,4);var t=w.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};g.prototype.double=function(){if(this.pos+8>this.len)throw L(this,4);var t=w.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};g.prototype.bytes=function(){var t=this.uint32(),n=this.pos,o=this.pos+t;if(o>this.len)throw L(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(n,o);if(n===o){var i=w.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,n,o)};g.prototype.string=function(){var t=this.bytes();return lr.read(t,0,t.length)};g.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw L(this,t);this.pos+=t}else do if(this.pos>=this.len)throw L(this);while(this.buf[this.pos++]&128);return this};g.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this};g._configure=function(e){Xe=e,g.create=qt(),Xe._configure();var t=w.Long?"toLong":"toNumber";w.merge(g.prototype,{int64:function(){return Ye.call(this)[t](!1)},uint64:function(){return Ye.call(this)[t](!0)},sint64:function(){return Ye.call(this).zzDecode()[t](!1)},fixed64:function(){return $t.call(this)[t](!0)},sfixed64:function(){return $t.call(this)[t](!1)}})}});var Qt=b((Xr,Kt)=>{"use strict";Kt.exports=pe;var zt=je();(pe.prototype=Object.create(zt.prototype)).constructor=pe;var Zt=H();function pe(e){zt.call(this,e)}pe._configure=function(){Zt.Buffer&&(pe.prototype._slice=Zt.Buffer.prototype.slice)};pe.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};pe._configure()});var Xt=b((jr,Yt)=>{"use strict";Yt.exports=xe;var et=H();(xe.prototype=Object.create(et.EventEmitter.prototype)).constructor=xe;function xe(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");et.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}xe.prototype.rpcCall=function e(t,n,o,i,r){if(!i)throw TypeError("request must be specified");var a=this;if(!r)return et.asPromise(e,a,t,n,o,i);if(!a.rpcImpl){setTimeout(function(){r(Error("already ended"))},0);return}try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,f){if(u)return a.emit("error",u,t),r(u);if(f===null){a.end(!0);return}if(!(f instanceof o))try{f=o[a.responseDelimited?"decodeDelimited":"decode"](f)}catch(s){return a.emit("error",s,t),r(s)}return a.emit("data",f,t),r(null,f)})}catch(l){a.emit("error",l,t),setTimeout(function(){r(l)},0);return}};xe.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var en=b(jt=>{"use strict";var dr=jt;dr.Service=Xt()});var nn=b((ti,tn)=>{"use strict";tn.exports={}});var un=b(on=>{"use strict";var N=on;N.build="minimal";N.Writer=Qe();N.BufferWriter=Mt();N.Reader=je();N.BufferReader=Qt();N.util=H();N.rpc=en();N.roots=nn();N.configure=rn;function rn(){N.util._configure(),N.Writer._configure(N.BufferWriter),N.Reader._configure(N.BufferReader)}rn()});var B=b((ri,an)=>{"use strict";an.exports=un()});var ye=P(B(),1);var C=P(B(),1);var c=new Map;var me;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(me||(me={}));function sr(e){switch(e){case 0:case"NULL_VALUE":return me.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return me.UNRECOGNIZED}}function cr(e){switch(e){case me.NULL_VALUE:return 0;case me.UNRECOGNIZED:default:return-1}}function tt(){return{fields:{}}}var E={$type:"google.protobuf.Struct",encode(e,t=C.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&ke.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=tt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let a=ke.decode(n,n.uint32());a.value!==void 0&&(i.fields[a.key]=a.value);continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:ln(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 E.fromPartial(e??{})},fromPartial(e){let t=tt();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),{}),t},wrap(e){let t=tt();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(E.$type,E);function fn(){return{key:"",value:void 0}}var ke={$type:"google.protobuf.Struct.FieldsEntry",encode(e,t=C.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&T.encode(T.wrap(e.value),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=fn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=T.unwrap(T.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:ve(e.key)?globalThis.String(e.key):"",value:ve(e?.value)?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 ke.fromPartial(e??{})},fromPartial(e){let t=fn();return t.key=e.key??"",t.value=e.value??void 0,t}};c.set(ke.$type,ke);function nt(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var T={$type:"google.protobuf.Value",encode(e,t=C.default.Writer.create()){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&E.encode(E.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&he.encode(he.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=nt();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=E.unwrap(E.decode(n,n.uint32()));continue;case 6:if(r!==50)break;i.listValue=he.unwrap(he.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{nullValue:ve(e.nullValue)?sr(e.nullValue):void 0,numberValue:ve(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:ve(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:ve(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:ln(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=cr(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 T.fromPartial(e??{})},fromPartial(e){let t=nt();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=nt();if(e===null)t.nullValue=me.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(T.$type,T);function rt(){return{values:[]}}var he={$type:"google.protobuf.ListValue",encode(e,t=C.default.Writer.create()){for(let n of e.values)T.encode(T.wrap(n),t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=rt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(T.unwrap(T.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 he.fromPartial(e??{})},fromPartial(e){let t=rt();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=rt();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};c.set(he.$type,he);function ln(e){return typeof e=="object"&&e!==null}function ve(e){return e!=null}function dn(){return{subredditId:"",subredditName:"",userId:"",appName:"",appVersion:"",postId:""}}var Ie={$type:"devvit.ui.effects.web_view.v1alpha.WebViewContext",encode(e,t=ye.default.Writer.create()){return e.subredditId!==""&&t.uint32(10).string(e.subredditId),e.subredditName!==""&&t.uint32(18).string(e.subredditName),e.userId!==""&&t.uint32(26).string(e.userId),e.appName!==""&&t.uint32(34).string(e.appName),e.appVersion!==""&&t.uint32(42).string(e.appVersion),e.postId!==""&&t.uint32(50).string(e.postId),t},decode(e,t){let n=e instanceof ye.default.Reader?e:ye.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=dn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.subredditId=n.string();continue;case 2:if(r!==18)break;i.subredditName=n.string();continue;case 3:if(r!==26)break;i.userId=n.string();continue;case 4:if(r!==34)break;i.appName=n.string();continue;case 5:if(r!==42)break;i.appVersion=n.string();continue;case 6:if(r!==50)break;i.postId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{subredditId:Ee(e.subredditId)?globalThis.String(e.subredditId):"",subredditName:Ee(e.subredditName)?globalThis.String(e.subredditName):"",userId:Ee(e.userId)?globalThis.String(e.userId):"",appName:Ee(e.appName)?globalThis.String(e.appName):"",appVersion:Ee(e.appVersion)?globalThis.String(e.appVersion):"",postId:Ee(e.postId)?globalThis.String(e.postId):""}},toJSON(e){let t={};return e.subredditId!==""&&(t.subredditId=e.subredditId),e.subredditName!==""&&(t.subredditName=e.subredditName),e.userId!==""&&(t.userId=e.userId),e.appName!==""&&(t.appName=e.appName),e.appVersion!==""&&(t.appVersion=e.appVersion),e.postId!==""&&(t.postId=e.postId),t},create(e){return Ie.fromPartial(e??{})},fromPartial(e){let t=dn();return t.subredditId=e.subredditId??"",t.subredditName=e.subredditName??"",t.userId=e.userId??"",t.appName=e.appName??"",t.appVersion=e.appVersion??"",t.postId=e.postId??"",t}};c.set(Ie.$type,Ie);function sn(){return{developerData:void 0}}var Fe={$type:"devvit.ui.effects.web_view.v1alpha.DevvitPostData",encode(e,t=ye.default.Writer.create()){return e.developerData!==void 0&&E.encode(E.wrap(e.developerData),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof ye.default.Reader?e:ye.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=sn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 2:if(r!==18)break;i.developerData=E.unwrap(E.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{developerData:pr(e.developerData)?e.developerData:void 0}},toJSON(e){let t={};return e.developerData!==void 0&&(t.developerData=e.developerData),t},create(e){return Fe.fromPartial(e??{})},fromPartial(e){let t=sn();return t.developerData=e.developerData??void 0,t}};c.set(Fe.$type,Fe);function pr(e){return typeof e=="object"&&e!==null}function Ee(e){return e!=null}function De(e,t){if(!e)throw Error(t)}var z;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(z||(z={}));function hr(e){return e.startsWith(z.ACCOUNT)}function mr(e){return e.startsWith(z.LINK)}function yr(e){return e.startsWith(z.SUBREDDIT)}function gr(e){De(hr(e),`Expected account id to start with ${z.ACCOUNT}, got ${e}}`)}function Sr(e){De(mr(e),`Expected link id to start with ${z.LINK}, got ${e}}`)}function br(e){De(yr(e),`Expected subreddit id to start with ${z.SUBREDDIT}, got ${e}}`)}function cn(e){return gr(e),e}function pn(e){return Sr(e),e}function hn(e){return br(e),e}var vr=({search:e,hash:t})=>{let n=new URLSearchParams(e).get("context");if(n){let o=decodeURIComponent(n),i=Ie.fromJSON(JSON.parse(o)),r=Er(t),a={subredditId:hn(i.subredditId),userId:cn(i.userId),subredditName:i.subredditName,appName:i.appName,appVersion:i.appVersion,postId:pn(i.postId),postData:r?.developerData};globalThis.devvit={context:a}}};globalThis.location&&vr(globalThis.location);function Er(e){let t=e?.slice(1);if(t)try{return Fe.fromJSON(JSON.parse(decodeURIComponent(t)))}catch(n){console.error("Error parsing post data from hash",n);return}}var Tr=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 F=P(B(),1);var Se=P(B(),1);var ge=P(B(),1);var Je=P(B(),1);function mn(){return{}}var We={$type:"google.protobuf.Empty",encode(e,t=Je.default.Writer.create()){return t},decode(e,t){let n=e instanceof Je.default.Reader?e:Je.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=mn();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 We.fromPartial(e??{})},fromPartial(e){return mn()}};c.set(We.$type,We);function yn(){return{channels:[]}}var it={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=ge.default.Writer.create()){for(let n of e.channels)t.uint32(10).string(n);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=yn();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 it.fromPartial(e??{})},fromPartial(e){let t=yn();return t.channels=e.channels?.map(n=>n)||[],t}};c.set(it.$type,it);function gn(){return{channel:"",data:void 0}}var D={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=ge.default.Writer.create()){return e.channel!==""&&t.uint32(10).string(e.channel),e.data!==void 0&&E.encode(E.wrap(e.data),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof ge.default.Reader?e:ge.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=gn();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=E.unwrap(E.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channel:Vr(e.channel)?globalThis.String(e.channel):"",data:Nr(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 D.fromPartial(e??{})},fromPartial(e){let t=gn();return t.channel=e.channel??"",t.data=e.data??void 0,t}};c.set(D.$type,D);function Nr(e){return typeof e=="object"&&e!==null}function Vr(e){return e!=null}var K;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(K||(K={}));function Cr(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return K.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return K.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return K.UNRECOGNIZED}}function xr(e){switch(e){case K.REALTIME_SUBSCRIBED:return 0;case K.REALTIME_UNSUBSCRIBED:return 1;case K.UNRECOGNIZED:default:return-1}}function Sn(){return{subscriptionIds:[]}}var ot={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=Se.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof Se.default.Reader?e:Se.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Sn();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 ot.fromPartial(e??{})},fromPartial(e){let t=Sn();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};c.set(ot.$type,ot);function bn(){return{event:void 0,status:void 0}}var J={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=Se.default.Writer.create()){return e.event!==void 0&&D.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 Se.default.Reader?e:Se.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=bn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.event=D.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:vn(e.event)?D.fromJSON(e.event):void 0,status:vn(e.status)?Cr(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=D.toJSON(e.event)),e.status!==void 0&&(t.status=xr(e.status)),t},create(e){return J.fromPartial(e??{})},fromPartial(e){let t=bn();return t.event=e.event!==void 0&&e.event!==null?D.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};c.set(J.$type,J);function vn(e){return e!=null}var I=P(B(),1);var Me=P(B(),1);var m=P(B(),1);var S;(function(e){e[e.STRING=0]="STRING",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.LIST=4]="LIST",e[e.SELECTION=5]="SELECTION",e[e.GROUP=6]="GROUP",e[e.IMAGE=7]="IMAGE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(S||(S={}));function Te(e){switch(e){case 0:case"STRING":return S.STRING;case 1:case"PARAGRAPH":return S.PARAGRAPH;case 2:case"NUMBER":return S.NUMBER;case 3:case"BOOLEAN":return S.BOOLEAN;case 4:case"LIST":return S.LIST;case 5:case"SELECTION":return S.SELECTION;case 6:case"GROUP":return S.GROUP;case 7:case"IMAGE":return S.IMAGE;case-1:case"UNRECOGNIZED":default:return S.UNRECOGNIZED}}function Ne(e){switch(e){case S.STRING:return 0;case S.PARAGRAPH:return 1;case S.NUMBER:return 2;case S.BOOLEAN:return 3;case S.LIST:return 4;case S.SELECTION:return 5;case S.GROUP:return 6;case S.IMAGE:return 7;case S.UNRECOGNIZED:default:return-1}}var x=P(B(),1);function En(){return{fieldType:0,isSecret:void 0,stringValue:void 0,numberValue:void 0,boolValue:void 0,listValue:void 0,selectionValue:void 0,groupValue:void 0}}var y={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,t=x.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&&Q.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&Y.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&X.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=En();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=Q.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionValue=Y.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupValue=X.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldType:W(e.fieldType)?Te(e.fieldType):0,isSecret:W(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:W(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:W(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:W(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:W(e.listValue)?Q.fromJSON(e.listValue):void 0,selectionValue:W(e.selectionValue)?Y.fromJSON(e.selectionValue):void 0,groupValue:W(e.groupValue)?X.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=Ne(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=Q.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=Y.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=X.toJSON(e.groupValue)),t},create(e){return y.fromPartial(e??{})},fromPartial(e){let t=En();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?Q.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?Y.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?X.fromPartial(e.groupValue):void 0,t}};c.set(y.$type,y);function Tn(){return{itemType:0,items:[]}}var Q={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=x.default.Writer.create()){e.itemType!==0&&t.uint32(8).int32(e.itemType);for(let n of e.items)y.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Tn();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(y.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:W(e.itemType)?Te(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(t=>y.fromJSON(t)):[]}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Ne(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>y.toJSON(n))),t},create(e){return Q.fromPartial(e??{})},fromPartial(e){let t=Tn();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>y.fromPartial(n))||[],t}};c.set(Q.$type,Q);function Nn(){return{values:[]}}var Y={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=x.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Nn();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 Y.fromPartial(e??{})},fromPartial(e){let t=Nn();return t.values=e.values?.map(n=>n)||[],t}};c.set(Y.$type,Y);function Vn(){return{}}var X={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=x.default.Writer.create()){return t},decode(e,t){let n=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Vn();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 X.fromPartial(e??{})},fromPartial(e){return Vn()}};c.set(X.$type,X);function W(e){return e!=null}function Cn(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var V={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,t=m.default.Writer.create()){return e.fieldId!==""&&t.uint32(10).string(e.fieldId),e.fieldType!==0&&t.uint32(16).int32(e.fieldType),e.label!==""&&t.uint32(26).string(e.label),e.helpText!==void 0&&t.uint32(34).string(e.helpText),e.defaultValue!==void 0&&y.encode(e.defaultValue,t.uint32(42).fork()).ldelim(),e.required!==void 0&&t.uint32(48).bool(e.required),e.disabled!==void 0&&t.uint32(56).bool(e.disabled),e.fieldConfig!==void 0&&k.encode(e.fieldConfig,t.uint32(66).fork()).ldelim(),e.isSecret!==void 0&&t.uint32(72).bool(e.isSecret),t},decode(e,t){let n=e instanceof m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Cn();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=y.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=k.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:p(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:p(e.fieldType)?Te(e.fieldType):0,label:p(e.label)?globalThis.String(e.label):"",helpText:p(e.helpText)?globalThis.String(e.helpText):void 0,defaultValue:p(e.defaultValue)?y.fromJSON(e.defaultValue):void 0,required:p(e.required)?globalThis.Boolean(e.required):void 0,disabled:p(e.disabled)?globalThis.Boolean(e.disabled):void 0,fieldConfig:p(e.fieldConfig)?k.fromJSON(e.fieldConfig):void 0,isSecret:p(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let t={};return e.fieldId!==""&&(t.fieldId=e.fieldId),e.fieldType!==0&&(t.fieldType=Ne(e.fieldType)),e.label!==""&&(t.label=e.label),e.helpText!==void 0&&(t.helpText=e.helpText),e.defaultValue!==void 0&&(t.defaultValue=y.toJSON(e.defaultValue)),e.required!==void 0&&(t.required=e.required),e.disabled!==void 0&&(t.disabled=e.disabled),e.fieldConfig!==void 0&&(t.fieldConfig=k.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return V.fromPartial(e??{})},fromPartial(e){let t=Cn();return t.fieldId=e.fieldId??"",t.fieldType=e.fieldType??0,t.label=e.label??"",t.helpText=e.helpText??void 0,t.defaultValue=e.defaultValue!==void 0&&e.defaultValue!==null?y.fromPartial(e.defaultValue):void 0,t.required=e.required??void 0,t.disabled=e.disabled??void 0,t.fieldConfig=e.fieldConfig!==void 0&&e.fieldConfig!==null?k.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};c.set(V.$type,V);function xn(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var k={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=m.default.Writer.create()){return e.stringConfig!==void 0&&j.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&ee.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&te.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&ne.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&re.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&ie.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&ue.encode(e.groupConfig,t.uint32(58).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=xn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.stringConfig=j.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.paragraphConfig=ee.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.numberConfig=te.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.booleanConfig=ne.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.listConfig=re.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionConfig=ie.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupConfig=ue.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{stringConfig:p(e.stringConfig)?j.fromJSON(e.stringConfig):void 0,paragraphConfig:p(e.paragraphConfig)?ee.fromJSON(e.paragraphConfig):void 0,numberConfig:p(e.numberConfig)?te.fromJSON(e.numberConfig):void 0,booleanConfig:p(e.booleanConfig)?ne.fromJSON(e.booleanConfig):void 0,listConfig:p(e.listConfig)?re.fromJSON(e.listConfig):void 0,selectionConfig:p(e.selectionConfig)?ie.fromJSON(e.selectionConfig):void 0,groupConfig:p(e.groupConfig)?ue.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=j.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=ee.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=te.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=ne.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=re.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=ie.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=ue.toJSON(e.groupConfig)),t},create(e){return k.fromPartial(e??{})},fromPartial(e){let t=xn();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?j.fromPartial(e.stringConfig):void 0,t.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?ee.fromPartial(e.paragraphConfig):void 0,t.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?te.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?ne.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?re.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?ie.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?ue.fromPartial(e.groupConfig):void 0,t}};c.set(k.$type,k);function kn(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var j={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.String",encode(e,t=m.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=kn();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:p(e.minLength)?globalThis.Number(e.minLength):void 0,maxLength:p(e.maxLength)?globalThis.Number(e.maxLength):void 0,placeholder:p(e.placeholder)?globalThis.String(e.placeholder):void 0}},toJSON(e){let t={};return e.minLength!==void 0&&(t.minLength=Math.round(e.minLength)),e.maxLength!==void 0&&(t.maxLength=Math.round(e.maxLength)),e.placeholder!==void 0&&(t.placeholder=e.placeholder),t},create(e){return j.fromPartial(e??{})},fromPartial(e){let t=kn();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(j.$type,j);function In(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var ee={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Paragraph",encode(e,t=m.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=In();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:p(e.maxCharacters)?globalThis.Number(e.maxCharacters):void 0,lineHeight:p(e.lineHeight)?globalThis.Number(e.lineHeight):void 0,placeholder:p(e.placeholder)?globalThis.String(e.placeholder):void 0}},toJSON(e){let t={};return e.maxCharacters!==void 0&&(t.maxCharacters=Math.round(e.maxCharacters)),e.lineHeight!==void 0&&(t.lineHeight=Math.round(e.lineHeight)),e.placeholder!==void 0&&(t.placeholder=e.placeholder),t},create(e){return ee.fromPartial(e??{})},fromPartial(e){let t=In();return t.maxCharacters=e.maxCharacters??void 0,t.lineHeight=e.lineHeight??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(ee.$type,ee);function Fn(){return{step:void 0,min:void 0,max:void 0}}var te={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Number",encode(e,t=m.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Fn();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:p(e.step)?globalThis.Number(e.step):void 0,min:p(e.min)?globalThis.Number(e.min):void 0,max:p(e.max)?globalThis.Number(e.max):void 0}},toJSON(e){let t={};return e.step!==void 0&&(t.step=e.step),e.min!==void 0&&(t.min=e.min),e.max!==void 0&&(t.max=e.max),t},create(e){return te.fromPartial(e??{})},fromPartial(e){let t=Fn();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 _n(){return{}}var ne={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Boolean",encode(e,t=m.default.Writer.create()){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=_n();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return ne.fromPartial(e??{})},fromPartial(e){return _n()}};c.set(ne.$type,ne);function On(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var re={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.List",encode(e,t=m.default.Writer.create()){return e.itemType!==0&&t.uint32(8).int32(e.itemType),e.itemConfig!==void 0&&k.encode(e.itemConfig,t.uint32(18).fork()).ldelim(),e.minEntries!==void 0&&t.uint32(24).int32(e.minEntries),e.maxEntries!==void 0&&t.uint32(32).int32(e.maxEntries),e.entryLabel!==void 0&&t.uint32(42).string(e.entryLabel),t},decode(e,t){let n=e instanceof m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=On();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=k.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:p(e.itemType)?Te(e.itemType):0,itemConfig:p(e.itemConfig)?k.fromJSON(e.itemConfig):void 0,minEntries:p(e.minEntries)?globalThis.Number(e.minEntries):void 0,maxEntries:p(e.maxEntries)?globalThis.Number(e.maxEntries):void 0,entryLabel:p(e.entryLabel)?globalThis.String(e.entryLabel):void 0}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Ne(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=k.toJSON(e.itemConfig)),e.minEntries!==void 0&&(t.minEntries=Math.round(e.minEntries)),e.maxEntries!==void 0&&(t.maxEntries=Math.round(e.maxEntries)),e.entryLabel!==void 0&&(t.entryLabel=e.entryLabel),t},create(e){return re.fromPartial(e??{})},fromPartial(e){let t=On();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?k.fromPartial(e.itemConfig):void 0,t.minEntries=e.minEntries??void 0,t.maxEntries=e.maxEntries??void 0,t.entryLabel=e.entryLabel??void 0,t}};c.set(re.$type,re);function Rn(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var ie={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=m.default.Writer.create()){for(let n of e.choices)oe.encode(n,t.uint32(10).fork()).ldelim();return e.multiSelect!==void 0&&t.uint32(16).bool(e.multiSelect),e.minSelections!==void 0&&t.uint32(24).int32(e.minSelections),e.maxSelections!==void 0&&t.uint32(32).int32(e.maxSelections),e.renderAsList!==void 0&&t.uint32(40).bool(e.renderAsList),t},decode(e,t){let n=e instanceof m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Rn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.choices.push(oe.decode(n,n.uint32()));continue;case 2:if(r!==16)break;i.multiSelect=n.bool();continue;case 3:if(r!==24)break;i.minSelections=n.int32();continue;case 4:if(r!==32)break;i.maxSelections=n.int32();continue;case 5:if(r!==40)break;i.renderAsList=n.bool();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{choices:globalThis.Array.isArray(e?.choices)?e.choices.map(t=>oe.fromJSON(t)):[],multiSelect:p(e.multiSelect)?globalThis.Boolean(e.multiSelect):void 0,minSelections:p(e.minSelections)?globalThis.Number(e.minSelections):void 0,maxSelections:p(e.maxSelections)?globalThis.Number(e.maxSelections):void 0,renderAsList:p(e.renderAsList)?globalThis.Boolean(e.renderAsList):void 0}},toJSON(e){let t={};return e.choices?.length&&(t.choices=e.choices.map(n=>oe.toJSON(n))),e.multiSelect!==void 0&&(t.multiSelect=e.multiSelect),e.minSelections!==void 0&&(t.minSelections=Math.round(e.minSelections)),e.maxSelections!==void 0&&(t.maxSelections=Math.round(e.maxSelections)),e.renderAsList!==void 0&&(t.renderAsList=e.renderAsList),t},create(e){return ie.fromPartial(e??{})},fromPartial(e){let t=Rn();return t.choices=e.choices?.map(n=>oe.fromPartial(n))||[],t.multiSelect=e.multiSelect??void 0,t.minSelections=e.minSelections??void 0,t.maxSelections=e.maxSelections??void 0,t.renderAsList=e.renderAsList??void 0,t}};c.set(ie.$type,ie);function wn(){return{label:"",value:""}}var oe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection.Item",encode(e,t=m.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=wn();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:p(e.label)?globalThis.String(e.label):"",value:p(e.value)?globalThis.String(e.value):""}},toJSON(e){let t={};return e.label!==""&&(t.label=e.label),e.value!==""&&(t.value=e.value),t},create(e){return oe.fromPartial(e??{})},fromPartial(e){let t=wn();return t.label=e.label??"",t.value=e.value??"",t}};c.set(oe.$type,oe);function Ln(){return{fields:[]}}var ue={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,t=m.default.Writer.create()){for(let n of e.fields)V.encode(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=Ln();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(V.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=>V.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>V.toJSON(n))),t},create(e){return ue.fromPartial(e??{})},fromPartial(e){let t=Ln();return t.fields=e.fields?.map(n=>V.fromPartial(n))||[],t}};c.set(ue.$type,ue);function p(e){return e!=null}function Bn(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var M={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=Me.default.Writer.create()){for(let n of e.fields)V.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 Me.default.Reader?e:Me.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Bn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(V.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=>V.fromJSON(t)):[],title:_e(e.title)?globalThis.String(e.title):void 0,shortDescription:_e(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:_e(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:_e(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:_e(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>V.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 M.fromPartial(e??{})},fromPartial(e){let t=Bn();return t.fields=e.fields?.map(n=>V.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(M.$type,M);function _e(e){return e!=null}function Pn(){return{form:void 0}}var ut={$type:"devvit.ui.effects.v1alpha.ShowFormEffect",encode(e,t=I.default.Writer.create()){return e.form!==void 0&&M.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Pn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.form=M.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{form:Re(e.form)?M.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=M.toJSON(e.form)),t},create(e){return ut.fromPartial(e??{})},fromPartial(e){let t=Pn();return t.form=e.form!==void 0&&e.form!==null?M.fromPartial(e.form):void 0,t}};c.set(ut.$type,ut);function An(){return{results:{},formId:void 0}}var U={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent",encode(e,t=I.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{Oe.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 I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=An();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let a=Oe.decode(n,n.uint32());a.value!==void 0&&(i.results[a.key]=a.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:kr(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=y.fromJSON(o),t),{}):{},formId:Re(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]=y.toJSON(i)}))}return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return U.fromPartial(e??{})},fromPartial(e){let t=An();return t.results=Object.entries(e.results??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=y.fromPartial(i)),n),{}),t.formId=e.formId??void 0,t}};c.set(U.$type,U);function Dn(){return{key:"",value:void 0}}var Oe={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=I.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&y.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Dn();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=y.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:Re(e.key)?globalThis.String(e.key):"",value:Re(e.value)?y.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=y.toJSON(e.value)),t},create(e){return Oe.fromPartial(e??{})},fromPartial(e){let t=Dn();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?y.fromPartial(e.value):void 0,t}};c.set(Oe.$type,Oe);function Jn(){return{formId:void 0}}var $={$type:"devvit.ui.effects.v1alpha.FormCanceledEvent",encode(e,t=I.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Jn();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:Re(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 $.fromPartial(e??{})},fromPartial(e){let t=Jn();return t.formId=e.formId??void 0,t}};c.set($.$type,$);function kr(e){return typeof e=="object"&&e!==null}function Re(e){return e!=null}var le;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(le||(le={}));function Ir(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return le.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return le.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return le.UNRECOGNIZED}}function Fr(e){switch(e){case le.WEBVIEW_VISIBLE:return 0;case le.WEBVIEW_HIDDEN:return 1;case le.UNRECOGNIZED:default:return-1}}function Wn(){return{message:void 0,jsonString:""}}var ae={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=F.default.Writer.create()){return e.message!==void 0&&T.encode(T.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Wn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.message=T.unwrap(T.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:G(e?.message)?e.message:void 0,jsonString:G(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 ae.fromPartial(e??{})},fromPartial(e){let t=Wn();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};c.set(ae.$type,ae);function Mn(){return{visibility:0}}var fe={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=F.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Mn();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:G(e.visibility)?Ir(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=Fr(e.visibility)),t},create(e){return fe.fromPartial(e??{})},fromPartial(e){let t=Mn();return t.visibility=e.visibility??0,t}};c.set(fe.$type,fe);function Un(){return{postMessage:void 0,fullScreen:void 0}}var at={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=F.default.Writer.create()){return e.postMessage!==void 0&&ae.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&fe.encode(e.fullScreen,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Un();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postMessage=ae.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.fullScreen=fe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{postMessage:G(e.postMessage)?ae.fromJSON(e.postMessage):void 0,fullScreen:G(e.fullScreen)?fe.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=ae.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=fe.toJSON(e.fullScreen)),t},create(e){return at.fromPartial(e??{})},fromPartial(e){let t=Un();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?ae.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?fe.fromPartial(e.fullScreen):void 0,t}};c.set(at.$type,at);function $n(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0}}var we={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=F.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&$.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&U.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&J.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=$n();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=$.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.formSubmitted=U.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.realtimeEvent=J.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{id:G(e.id)?globalThis.String(e.id):"",formCanceled:G(e.formCanceled)?$.fromJSON(e.formCanceled):void 0,formSubmitted:G(e.formSubmitted)?U.fromJSON(e.formSubmitted):void 0,realtimeEvent:G(e.realtimeEvent)?J.fromJSON(e.realtimeEvent):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=$.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=U.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=J.toJSON(e.realtimeEvent)),t},create(e){return we.fromPartial(e??{})},fromPartial(e){let t=$n();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?$.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?U.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?J.fromPartial(e.realtimeEvent):void 0,t}};c.set(we.$type,we);function G(e){return e!=null}var Gn=[3];var de=e=>new Promise(t=>{let n={scope:0,type:"devvit-internal"};if(e.realtimeSubscriptions?n.realtimeEffect=e.realtimeSubscriptions:n.effect=e,Gn.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 a=we.fromJSON(r.data.data);t(a),window.removeEventListener("message",i)}};window.addEventListener("message",i),window.parent.postMessage(n,"*")}else window.parent.postMessage(n,"*"),t(void 0)});function qn(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.url).toString(),de({navigateToUrl:{url:t},type:5})}function ft(e,t=new Set){for(let n of e){if(n.type==="group"){ft(n.fields,t);continue}let o=n.name;if(t.has(o))throw new Error(`Duplicate field name: ${o}`);t.add(o)}_r(e)}function _r(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 Or(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 Hn(e){return Object.keys(e).reduce((t,n)=>{let o=Or(e[n]);return o!==void 0&&(t[n]=o),t},{})}function lt(e){return e.map(t=>{switch(t.type){case"string":return Rr(t);case"image":return wr(t);case"paragraph":return Lr(t);case"number":return Br(t);case"select":return Pr(t);case"boolean":return Ar(t);case"group":return Dr(t);default:throw new Error("Unknown field type.")}})}function Rr(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 wr(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function Lr(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 Br(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 Pr(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 Ar(e){return{defaultValue:{fieldType:3,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:3,helpText:e.helpText,label:e.label}}function Dr(e){return{fieldId:"",fieldType:6,fieldConfig:{groupConfig:{fields:lt(e.fields)}},label:e.label,helpText:e.helpText}}var Zn=1,Jr=()=>(Zn++,`form.${Zn}`),zn=async e=>{let t={fields:[],id:Jr(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};ft(e.fields),t.fields=lt(e.fields);let n=await de({showForm:{form:t},type:3});return!n||!n.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:Hn(n.formSubmitted.results)}};function Kn(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?1:0}:t={text:e},de({showToast:{toast:t},type:4})}export{Tr as context,de as emitEffect,qn as navigateTo,zn as showForm,Kn as showToast};
|
|
1
|
+
var ri=Object.create;var yt=Object.defineProperty;var oi=Object.getOwnPropertyDescriptor;var ui=Object.getOwnPropertyNames;var ai=Object.getPrototypeOf,di=Object.prototype.hasOwnProperty;var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var fi=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ui(t))!di.call(e,r)&&r!==n&&yt(e,r,{get:()=>t[r],enumerable:!(o=oi(t,r))||o.enumerable});return e};var w=(e,t,n)=>(n=e!=null?ri(ai(e)):{},fi(t||!e||!e.__esModule?yt(n,"default",{value:e,enumerable:!0}):n,e));var St=b((Qi,gt)=>{"use strict";gt.exports=li;function li(e,t){for(var n=new Array(arguments.length-1),o=0,r=2,i=!0;r<arguments.length;)n[o++]=arguments[r++];return new Promise(function(f,u){n[o]=function(c){if(i)if(i=!1,c)u(c);else{for(var _=new Array(arguments.length-1),pe=0;pe<_.length;)_[pe++]=arguments[pe];f.apply(null,_)}};try{e.apply(t||null,n)}catch(d){i&&(i=!1,u(d))}})}});var Nt=b(Et=>{"use strict";var Pe=Et;Pe.length=function(t){var n=t.length;if(!n)return 0;for(var o=0;--n%4>1&&t.charAt(n)==="=";)++o;return Math.ceil(t.length*3)/4-o};var Ee=new Array(64),vt=new Array(123);for(L=0;L<64;)vt[Ee[L]=L<26?L+65:L<52?L+71:L<62?L-4:L-59|43]=L++;var L;Pe.encode=function(t,n,o){for(var r=null,i=[],a=0,f=0,u;n<o;){var d=t[n++];switch(f){case 0:i[a++]=Ee[d>>2],u=(d&3)<<4,f=1;break;case 1:i[a++]=Ee[u|d>>4],u=(d&15)<<2,f=2;break;case 2:i[a++]=Ee[u|d>>6],i[a++]=Ee[d&63],f=0;break}a>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,i)),a=0)}return f&&(i[a++]=Ee[u],i[a++]=61,f===1&&(i[a++]=61)),r?(a&&r.push(String.fromCharCode.apply(String,i.slice(0,a))),r.join("")):String.fromCharCode.apply(String,i.slice(0,a))};var bt="invalid encoding";Pe.decode=function(t,n,o){for(var r=o,i=0,a,f=0;f<t.length;){var u=t.charCodeAt(f++);if(u===61&&i>1)break;if((u=vt[u])===void 0)throw Error(bt);switch(i){case 0:a=u,i=1;break;case 1:n[o++]=a<<2|(u&48)>>4,a=u,i=2;break;case 2:n[o++]=(a&15)<<4|(u&60)>>2,a=u,i=3;break;case 3:n[o++]=(a&3)<<6|u,i=0;break}}if(i===1)throw Error(bt);return o-r};Pe.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var Vt=b((Xi,Tt)=>{"use strict";Tt.exports=De;function De(){this._listeners={}}De.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};De.prototype.off=function(t,n){if(t===void 0)this._listeners={};else if(n===void 0)this._listeners[t]=[];else for(var o=this._listeners[t],r=0;r<o.length;)o[r].fn===n?o.splice(r,1):++r;return this};De.prototype.emit=function(t){var n=this._listeners[t];if(n){for(var o=[],r=1;r<arguments.length;)o.push(arguments[r++]);for(r=0;r<n.length;)n[r].fn.apply(n[r++].ctx,o)}return this}});var Ft=b((ji,_t)=>{"use strict";_t.exports=Ct(Ct);function Ct(e){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function r(u,d,c){t[0]=u,d[c]=n[0],d[c+1]=n[1],d[c+2]=n[2],d[c+3]=n[3]}function i(u,d,c){t[0]=u,d[c]=n[3],d[c+1]=n[2],d[c+2]=n[1],d[c+3]=n[0]}e.writeFloatLE=o?r:i,e.writeFloatBE=o?i:r;function a(u,d){return n[0]=u[d],n[1]=u[d+1],n[2]=u[d+2],n[3]=u[d+3],t[0]}function f(u,d){return n[3]=u[d],n[2]=u[d+1],n[1]=u[d+2],n[0]=u[d+3],t[0]}e.readFloatLE=o?a:f,e.readFloatBE=o?f:a}():function(){function t(o,r,i,a){var f=r<0?1:0;if(f&&(r=-r),r===0)o(1/r>0?0:2147483648,i,a);else if(isNaN(r))o(2143289344,i,a);else if(r>34028234663852886e22)o((f<<31|2139095040)>>>0,i,a);else if(r<11754943508222875e-54)o((f<<31|Math.round(r/1401298464324817e-60))>>>0,i,a);else{var u=Math.floor(Math.log(r)/Math.LN2),d=Math.round(r*Math.pow(2,-u)*8388608)&8388607;o((f<<31|u+127<<23|d)>>>0,i,a)}}e.writeFloatLE=t.bind(null,It),e.writeFloatBE=t.bind(null,Ot);function n(o,r,i){var a=o(r,i),f=(a>>31)*2+1,u=a>>>23&255,d=a&8388607;return u===255?d?NaN:f*(1/0):u===0?f*1401298464324817e-60*d:f*Math.pow(2,u-150)*(d+8388608)}e.readFloatLE=n.bind(null,kt),e.readFloatBE=n.bind(null,xt)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function r(u,d,c){t[0]=u,d[c]=n[0],d[c+1]=n[1],d[c+2]=n[2],d[c+3]=n[3],d[c+4]=n[4],d[c+5]=n[5],d[c+6]=n[6],d[c+7]=n[7]}function i(u,d,c){t[0]=u,d[c]=n[7],d[c+1]=n[6],d[c+2]=n[5],d[c+3]=n[4],d[c+4]=n[3],d[c+5]=n[2],d[c+6]=n[1],d[c+7]=n[0]}e.writeDoubleLE=o?r:i,e.writeDoubleBE=o?i:r;function a(u,d){return n[0]=u[d],n[1]=u[d+1],n[2]=u[d+2],n[3]=u[d+3],n[4]=u[d+4],n[5]=u[d+5],n[6]=u[d+6],n[7]=u[d+7],t[0]}function f(u,d){return n[7]=u[d],n[6]=u[d+1],n[5]=u[d+2],n[4]=u[d+3],n[3]=u[d+4],n[2]=u[d+5],n[1]=u[d+6],n[0]=u[d+7],t[0]}e.readDoubleLE=o?a:f,e.readDoubleBE=o?f:a}():function(){function t(o,r,i,a,f,u){var d=a<0?1:0;if(d&&(a=-a),a===0)o(0,f,u+r),o(1/a>0?0:2147483648,f,u+i);else if(isNaN(a))o(0,f,u+r),o(2146959360,f,u+i);else if(a>17976931348623157e292)o(0,f,u+r),o((d<<31|2146435072)>>>0,f,u+i);else{var c;if(a<22250738585072014e-324)c=a/5e-324,o(c>>>0,f,u+r),o((d<<31|c/4294967296)>>>0,f,u+i);else{var _=Math.floor(Math.log(a)/Math.LN2);_===1024&&(_=1023),c=a*Math.pow(2,-_),o(c*4503599627370496>>>0,f,u+r),o((d<<31|_+1023<<20|c*1048576&1048575)>>>0,f,u+i)}}}e.writeDoubleLE=t.bind(null,It,0,4),e.writeDoubleBE=t.bind(null,Ot,4,0);function n(o,r,i,a,f){var u=o(a,f+r),d=o(a,f+i),c=(d>>31)*2+1,_=d>>>20&2047,pe=4294967296*(d&1048575)+u;return _===2047?pe?NaN:c*(1/0):_===0?c*5e-324*pe:c*Math.pow(2,_-1075)*(pe+4503599627370496)}e.readDoubleLE=n.bind(null,kt,0,4),e.readDoubleBE=n.bind(null,xt,4,0)}(),e}function It(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function Ot(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=e&255}function kt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function xt(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var Rt=b((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}});var Lt=b(wt=>{"use strict";var qe=wt;qe.length=function(t){for(var n=0,o=0,r=0;r<t.length;++r)o=t.charCodeAt(r),o<128?n+=1:o<2048?n+=2:(o&64512)===55296&&(t.charCodeAt(r+1)&64512)===56320?(++r,n+=4):n+=3;return n};qe.read=function(t,n,o){var r=o-n;if(r<1)return"";for(var i=null,a=[],f=0,u;n<o;)u=t[n++],u<128?a[f++]=u:u>191&&u<224?a[f++]=(u&31)<<6|t[n++]&63:u>239&&u<365?(u=((u&7)<<18|(t[n++]&63)<<12|(t[n++]&63)<<6|t[n++]&63)-65536,a[f++]=55296+(u>>10),a[f++]=56320+(u&1023)):a[f++]=(u&15)<<12|(t[n++]&63)<<6|t[n++]&63,f>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,a)),f=0);return i?(f&&i.push(String.fromCharCode.apply(String,a.slice(0,f))),i.join("")):String.fromCharCode.apply(String,a.slice(0,f))};qe.write=function(t,n,o){for(var r=o,i,a,f=0;f<t.length;++f)i=t.charCodeAt(f),i<128?n[o++]=i:i<2048?(n[o++]=i>>6|192,n[o++]=i&63|128):(i&64512)===55296&&((a=t.charCodeAt(f+1))&64512)===56320?(i=65536+((i&1023)<<10)+(a&1023),++f,n[o++]=i>>18|240,n[o++]=i>>12&63|128,n[o++]=i>>6&63|128,n[o++]=i&63|128):(n[o++]=i>>12|224,n[o++]=i>>6&63|128,n[o++]=i&63|128);return o-r}});var Pt=b((tr,Bt)=>{"use strict";Bt.exports=si;function si(e,t,n){var o=n||8192,r=o>>>1,i=null,a=o;return function(u){if(u<1||u>r)return e(u);a+u>o&&(i=e(o),a=0);var d=t.call(i,a,a+=u);return a&7&&(a=(a|7)+1),d}}});var At=b((nr,Dt)=>{"use strict";Dt.exports=v;var Ie=Z();function v(e,t){this.lo=e>>>0,this.hi=t>>>0}var me=v.zero=new v(0,0);me.toNumber=function(){return 0};me.zzEncode=me.zzDecode=function(){return this};me.length=function(){return 1};var ci=v.zeroHash="\0\0\0\0\0\0\0\0";v.fromNumber=function(t){if(t===0)return me;var n=t<0;n&&(t=-t);var o=t>>>0,r=(t-o)/4294967296>>>0;return n&&(r=~r>>>0,o=~o>>>0,++o>4294967295&&(o=0,++r>4294967295&&(r=0))),new v(o,r)};v.from=function(t){if(typeof t=="number")return v.fromNumber(t);if(Ie.isString(t))if(Ie.Long)t=Ie.Long.fromString(t);else return v.fromNumber(parseInt(t,10));return t.low||t.high?new v(t.low>>>0,t.high>>>0):me};v.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var n=~this.lo+1>>>0,o=~this.hi>>>0;return n||(o=o+1>>>0),-(n+o*4294967296)}return this.lo+this.hi*4294967296};v.prototype.toLong=function(t){return Ie.Long?new Ie.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var H=String.prototype.charCodeAt;v.fromHash=function(t){return t===ci?me:new v((H.call(t,0)|H.call(t,1)<<8|H.call(t,2)<<16|H.call(t,3)<<24)>>>0,(H.call(t,4)|H.call(t,5)<<8|H.call(t,6)<<16|H.call(t,7)<<24)>>>0)};v.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};v.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};v.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};v.prototype.length=function(){var t=this.lo,n=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?n===0?t<16384?t<128?1:2:t<2097152?3:4:n<16384?n<128?5:6:n<2097152?7:8:o<128?9:10}});var Z=b(He=>{"use strict";var l=He;l.asPromise=St();l.base64=Nt();l.EventEmitter=Vt();l.float=Ft();l.inquire=Rt();l.utf8=Lt();l.pool=Pt();l.LongBits=At();l.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);l.global=l.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||He;l.emptyArray=Object.freeze?Object.freeze([]):[];l.emptyObject=Object.freeze?Object.freeze({}):{};l.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};l.isString=function(t){return typeof t=="string"||t instanceof String};l.isObject=function(t){return t&&typeof t=="object"};l.isset=l.isSet=function(t,n){var o=t[n];return o!=null&&t.hasOwnProperty(n)?typeof o!="object"||(Array.isArray(o)?o.length:Object.keys(o).length)>0:!1};l.Buffer=function(){try{var e=l.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}}();l._Buffer_from=null;l._Buffer_allocUnsafe=null;l.newBuffer=function(t){return typeof t=="number"?l.Buffer?l._Buffer_allocUnsafe(t):new l.Array(t):l.Buffer?l._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};l.Array=typeof Uint8Array<"u"?Uint8Array:Array;l.Long=l.global.dcodeIO&&l.global.dcodeIO.Long||l.global.Long||l.inquire("long");l.key2Re=/^true|false|0|1$/;l.key32Re=/^-?(?:0|[1-9][0-9]*)$/;l.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;l.longToHash=function(t){return t?l.LongBits.from(t).toHash():l.LongBits.zeroHash};l.longFromHash=function(t,n){var o=l.LongBits.fromHash(t);return l.Long?l.Long.fromBits(o.lo,o.hi,n):o.toNumber(!!n)};function Mt(e,t,n){for(var o=Object.keys(t),r=0;r<o.length;++r)(e[o[r]]===void 0||!n)&&(e[o[r]]=t[o[r]]);return e}l.merge=Mt;l.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Jt(e){function t(n,o){if(!(this instanceof t))return new t(n,o);Object.defineProperty(this,"message",{get:function(){return n}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),o&&Mt(this,o)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}l.newError=Jt;l.ProtocolError=Jt("ProtocolError");l.oneOfGetter=function(t){for(var n={},o=0;o<t.length;++o)n[t[o]]=1;return function(){for(var r=Object.keys(this),i=r.length-1;i>-1;--i)if(n[r[i]]===1&&this[r[i]]!==void 0&&this[r[i]]!==null)return r[i]}};l.oneOfSetter=function(t){return function(n){for(var o=0;o<t.length;++o)t[o]!==n&&delete this[t[o]]}};l.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};l._configure=function(){var e=l.Buffer;if(!e){l._Buffer_from=l._Buffer_allocUnsafe=null;return}l._Buffer_from=e.from!==Uint8Array.from&&e.from||function(n,o){return new e(n,o)},l._Buffer_allocUnsafe=e.allocUnsafe||function(n){return new e(n)}}});var je=b((rr,Gt)=>{"use strict";Gt.exports=m;var F=Z(),Ze,Ae=F.LongBits,Wt=F.base64,Ut=F.utf8;function Oe(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function Ke(){}function pi(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function m(){this.len=0,this.head=new Oe(Ke,0,0),this.tail=this.head,this.states=null}var $t=function(){return F.Buffer?function(){return(m.create=function(){return new Ze})()}:function(){return new m}};m.create=$t();m.alloc=function(t){return new F.Array(t)};F.Array!==Array&&(m.alloc=F.pool(m.alloc,F.Array.prototype.subarray));m.prototype._push=function(t,n,o){return this.tail=this.tail.next=new Oe(t,n,o),this.len+=n,this};function Qe(e,t,n){t[n]=e&255}function mi(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function Ye(e,t){this.len=e,this.next=void 0,this.val=t}Ye.prototype=Object.create(Oe.prototype);Ye.prototype.fn=mi;m.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Ye((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};m.prototype.int32=function(t){return t<0?this._push(Xe,10,Ae.fromNumber(t)):this.uint32(t)};m.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Xe(e,t,n){for(;e.hi;)t[n++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=e.lo&127|128,e.lo=e.lo>>>7;t[n++]=e.lo}m.prototype.uint64=function(t){var n=Ae.from(t);return this._push(Xe,n.length(),n)};m.prototype.int64=m.prototype.uint64;m.prototype.sint64=function(t){var n=Ae.from(t).zzEncode();return this._push(Xe,n.length(),n)};m.prototype.bool=function(t){return this._push(Qe,1,t?1:0)};function ze(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}m.prototype.fixed32=function(t){return this._push(ze,4,t>>>0)};m.prototype.sfixed32=m.prototype.fixed32;m.prototype.fixed64=function(t){var n=Ae.from(t);return this._push(ze,4,n.lo)._push(ze,4,n.hi)};m.prototype.sfixed64=m.prototype.fixed64;m.prototype.float=function(t){return this._push(F.float.writeFloatLE,4,t)};m.prototype.double=function(t){return this._push(F.float.writeDoubleLE,8,t)};var hi=F.Array.prototype.set?function(t,n,o){n.set(t,o)}:function(t,n,o){for(var r=0;r<t.length;++r)n[o+r]=t[r]};m.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push(Qe,1,0);if(F.isString(t)){var o=m.alloc(n=Wt.length(t));Wt.decode(t,o,0),t=o}return this.uint32(n)._push(hi,n,t)};m.prototype.string=function(t){var n=Ut.length(t);return n?this.uint32(n)._push(Ut.write,n,t):this._push(Qe,1,0)};m.prototype.fork=function(){return this.states=new pi(this),this.head=this.tail=new Oe(Ke,0,0),this.len=0,this};m.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Oe(Ke,0,0),this.len=0),this};m.prototype.ldelim=function(){var t=this.head,n=this.tail,o=this.len;return this.reset().uint32(o),o&&(this.tail.next=t.next,this.tail=n,this.len+=o),this};m.prototype.finish=function(){for(var t=this.head.next,n=this.constructor.alloc(this.len),o=0;t;)t.fn(t.val,n,o),o+=t.len,t=t.next;return n};m._configure=function(e){Ze=e,m.create=$t(),Ze._configure()}});var Zt=b((or,Ht)=>{"use strict";Ht.exports=A;var qt=je();(A.prototype=Object.create(qt.prototype)).constructor=A;var z=Z();function A(){qt.call(this)}A._configure=function(){A.alloc=z._Buffer_allocUnsafe,A.writeBytesBuffer=z.Buffer&&z.Buffer.prototype instanceof Uint8Array&&z.Buffer.prototype.set.name==="set"?function(t,n,o){n.set(t,o)}:function(t,n,o){if(t.copy)t.copy(n,o,0,t.length);else for(var r=0;r<t.length;)n[o++]=t[r++]}};A.prototype.bytes=function(t){z.isString(t)&&(t=z._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(A.writeBytesBuffer,n,t),this};function yi(e,t,n){e.length<40?z.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}A.prototype.string=function(t){var n=z.Buffer.byteLength(t);return this.uint32(n),n&&this._push(yi,n,t),this};A._configure()});var nt=b((ur,Xt)=>{"use strict";Xt.exports=g;var B=Z(),tt,Qt=B.LongBits,gi=B.utf8;function P(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function g(e){this.buf=e,this.pos=0,this.len=e.length}var zt=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new g(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new g(t);throw Error("illegal buffer")},Yt=function(){return B.Buffer?function(n){return(g.create=function(r){return B.Buffer.isBuffer(r)?new tt(r):zt(r)})(n)}:zt};g.create=Yt();g.prototype._slice=B.Array.prototype.subarray||B.Array.prototype.slice;g.prototype.uint32=function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,P(this,10);return t}}();g.prototype.int32=function(){return this.uint32()|0};g.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function et(){var e=new Qt(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw P(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw P(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}g.prototype.bool=function(){return this.uint32()!==0};function Me(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}g.prototype.fixed32=function(){if(this.pos+4>this.len)throw P(this,4);return Me(this.buf,this.pos+=4)};g.prototype.sfixed32=function(){if(this.pos+4>this.len)throw P(this,4);return Me(this.buf,this.pos+=4)|0};function Kt(){if(this.pos+8>this.len)throw P(this,8);return new Qt(Me(this.buf,this.pos+=4),Me(this.buf,this.pos+=4))}g.prototype.float=function(){if(this.pos+4>this.len)throw P(this,4);var t=B.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};g.prototype.double=function(){if(this.pos+8>this.len)throw P(this,4);var t=B.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};g.prototype.bytes=function(){var t=this.uint32(),n=this.pos,o=this.pos+t;if(o>this.len)throw P(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(n,o);if(n===o){var r=B.Buffer;return r?r.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,n,o)};g.prototype.string=function(){var t=this.bytes();return gi.read(t,0,t.length)};g.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw P(this,t);this.pos+=t}else do if(this.pos>=this.len)throw P(this);while(this.buf[this.pos++]&128);return this};g.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this};g._configure=function(e){tt=e,g.create=Yt(),tt._configure();var t=B.Long?"toLong":"toNumber";B.merge(g.prototype,{int64:function(){return et.call(this)[t](!1)},uint64:function(){return et.call(this)[t](!0)},sint64:function(){return et.call(this).zzDecode()[t](!1)},fixed64:function(){return Kt.call(this)[t](!0)},sfixed64:function(){return Kt.call(this)[t](!1)}})}});var nn=b((ar,tn)=>{"use strict";tn.exports=he;var en=nt();(he.prototype=Object.create(en.prototype)).constructor=he;var jt=Z();function he(e){en.call(this,e)}he._configure=function(){jt.Buffer&&(he.prototype._slice=jt.Buffer.prototype.slice)};he.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};he._configure()});var on=b((dr,rn)=>{"use strict";rn.exports=ke;var it=Z();(ke.prototype=Object.create(it.EventEmitter.prototype)).constructor=ke;function ke(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");it.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}ke.prototype.rpcCall=function e(t,n,o,r,i){if(!r)throw TypeError("request must be specified");var a=this;if(!i)return it.asPromise(e,a,t,n,o,r);if(!a.rpcImpl){setTimeout(function(){i(Error("already ended"))},0);return}try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](r).finish(),function(u,d){if(u)return a.emit("error",u,t),i(u);if(d===null){a.end(!0);return}if(!(d instanceof o))try{d=o[a.responseDelimited?"decodeDelimited":"decode"](d)}catch(c){return a.emit("error",c,t),i(c)}return a.emit("data",d,t),i(null,d)})}catch(f){a.emit("error",f,t),setTimeout(function(){i(f)},0);return}};ke.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var an=b(un=>{"use strict";var Si=un;Si.Service=on()});var fn=b((lr,dn)=>{"use strict";dn.exports={}});var cn=b(sn=>{"use strict";var V=sn;V.build="minimal";V.Writer=je();V.BufferWriter=Zt();V.Reader=nt();V.BufferReader=nn();V.util=Z();V.rpc=an();V.roots=fn();V.configure=ln;function ln(){V.util._configure(),V.Writer._configure(V.BufferWriter),V.Reader._configure(V.BufferReader)}ln()});var R=b((cr,pn)=>{"use strict";pn.exports=cn()});var Se=w(R(),1);var I=w(R(),1);var s=new Map;var ge;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ge||(ge={}));function bi(e){switch(e){case 0:case"NULL_VALUE":return ge.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return ge.UNRECOGNIZED}}function vi(e){switch(e){case ge.NULL_VALUE:return 0;case ge.UNRECOGNIZED:default:return-1}}function rt(){return{fields:{}}}var E={$type:"google.protobuf.Struct",encode(e,t=I.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&xe.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=rt();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;let a=xe.decode(n,n.uint32());a.value!==void 0&&(r.fields[a.key]=a.value);continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{fields:hn(e.fields)?Object.entries(e.fields).reduce((t,[n,o])=>(t[n]=o,t),{}):{}}},toJSON(e){let t={};if(e.fields){let n=Object.entries(e.fields);n.length>0&&(t.fields={},n.forEach(([o,r])=>{t.fields[o]=r}))}return t},create(e){return E.fromPartial(e??{})},fromPartial(e){let t=rt();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,r])=>(r!==void 0&&(n[o]=r),n),{}),t},wrap(e){let t=rt();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};s.set(E.$type,E);function mn(){return{key:"",value:void 0}}var xe={$type:"google.protobuf.Struct.FieldsEntry",encode(e,t=I.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&N.encode(N.wrap(e.value),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=mn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.key=n.string();continue;case 2:if(i!==18)break;r.value=N.unwrap(N.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{key:Ne(e.key)?globalThis.String(e.key):"",value:Ne(e?.value)?e.value:void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=e.value),t},create(e){return xe.fromPartial(e??{})},fromPartial(e){let t=mn();return t.key=e.key??"",t.value=e.value??void 0,t}};s.set(xe.$type,xe);function ot(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var N={$type:"google.protobuf.Value",encode(e,t=I.default.Writer.create()){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&E.encode(E.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&ye.encode(ye.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=ot();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.nullValue=n.int32();continue;case 2:if(i!==17)break;r.numberValue=n.double();continue;case 3:if(i!==26)break;r.stringValue=n.string();continue;case 4:if(i!==32)break;r.boolValue=n.bool();continue;case 5:if(i!==42)break;r.structValue=E.unwrap(E.decode(n,n.uint32()));continue;case 6:if(i!==50)break;r.listValue=ye.unwrap(ye.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{nullValue:Ne(e.nullValue)?bi(e.nullValue):void 0,numberValue:Ne(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:Ne(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:Ne(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:hn(e.structValue)?e.structValue:void 0,listValue:globalThis.Array.isArray(e.listValue)?[...e.listValue]:void 0}},toJSON(e){let t={};return e.nullValue!==void 0&&(t.nullValue=vi(e.nullValue)),e.numberValue!==void 0&&(t.numberValue=e.numberValue),e.stringValue!==void 0&&(t.stringValue=e.stringValue),e.boolValue!==void 0&&(t.boolValue=e.boolValue),e.structValue!==void 0&&(t.structValue=e.structValue),e.listValue!==void 0&&(t.listValue=e.listValue),t},create(e){return N.fromPartial(e??{})},fromPartial(e){let t=ot();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=ot();if(e===null)t.nullValue=ge.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new globalThis.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};s.set(N.$type,N);function ut(){return{values:[]}}var ye={$type:"google.protobuf.ListValue",encode(e,t=I.default.Writer.create()){for(let n of e.values)N.encode(N.wrap(n),t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=ut();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.values.push(N.unwrap(N.decode(n,n.uint32())));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?[...e.values]:[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values),t},create(e){return ye.fromPartial(e??{})},fromPartial(e){let t=ut();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=ut();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};s.set(ye.$type,ye);function hn(e){return typeof e=="object"&&e!==null}function Ne(e){return e!=null}function yn(){return{subredditId:"",subredditName:"",userId:"",appName:"",appVersion:"",postId:""}}var _e={$type:"devvit.ui.effects.web_view.v1alpha.WebViewContext",encode(e,t=Se.default.Writer.create()){return e.subredditId!==""&&t.uint32(10).string(e.subredditId),e.subredditName!==""&&t.uint32(18).string(e.subredditName),e.userId!==""&&t.uint32(26).string(e.userId),e.appName!==""&&t.uint32(34).string(e.appName),e.appVersion!==""&&t.uint32(42).string(e.appVersion),e.postId!==""&&t.uint32(50).string(e.postId),t},decode(e,t){let n=e instanceof Se.default.Reader?e:Se.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=yn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.subredditId=n.string();continue;case 2:if(i!==18)break;r.subredditName=n.string();continue;case 3:if(i!==26)break;r.userId=n.string();continue;case 4:if(i!==34)break;r.appName=n.string();continue;case 5:if(i!==42)break;r.appVersion=n.string();continue;case 6:if(i!==50)break;r.postId=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{subredditId:Te(e.subredditId)?globalThis.String(e.subredditId):"",subredditName:Te(e.subredditName)?globalThis.String(e.subredditName):"",userId:Te(e.userId)?globalThis.String(e.userId):"",appName:Te(e.appName)?globalThis.String(e.appName):"",appVersion:Te(e.appVersion)?globalThis.String(e.appVersion):"",postId:Te(e.postId)?globalThis.String(e.postId):""}},toJSON(e){let t={};return e.subredditId!==""&&(t.subredditId=e.subredditId),e.subredditName!==""&&(t.subredditName=e.subredditName),e.userId!==""&&(t.userId=e.userId),e.appName!==""&&(t.appName=e.appName),e.appVersion!==""&&(t.appVersion=e.appVersion),e.postId!==""&&(t.postId=e.postId),t},create(e){return _e.fromPartial(e??{})},fromPartial(e){let t=yn();return t.subredditId=e.subredditId??"",t.subredditName=e.subredditName??"",t.userId=e.userId??"",t.appName=e.appName??"",t.appVersion=e.appVersion??"",t.postId=e.postId??"",t}};s.set(_e.$type,_e);function gn(){return{developerData:void 0}}var Fe={$type:"devvit.ui.effects.web_view.v1alpha.DevvitPostData",encode(e,t=Se.default.Writer.create()){return e.developerData!==void 0&&E.encode(E.wrap(e.developerData),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof Se.default.Reader?e:Se.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=gn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 2:if(i!==18)break;r.developerData=E.unwrap(E.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{developerData:Ei(e.developerData)?e.developerData:void 0}},toJSON(e){let t={};return e.developerData!==void 0&&(t.developerData=e.developerData),t},create(e){return Fe.fromPartial(e??{})},fromPartial(e){let t=gn();return t.developerData=e.developerData??void 0,t}};s.set(Fe.$type,Fe);function Ei(e){return typeof e=="object"&&e!==null}function Te(e){return e!=null}function Je(e,t){if(!e)throw Error(t)}var K;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(K||(K={}));function Ni(e){return e.startsWith(K.ACCOUNT)}function Ti(e){return e.startsWith(K.LINK)}function Vi(e){return e.startsWith(K.SUBREDDIT)}function Ci(e){Je(Ni(e),`Expected account id to start with ${K.ACCOUNT}, got ${e}}`)}function Ii(e){Je(Ti(e),`Expected link id to start with ${K.LINK}, got ${e}}`)}function Oi(e){Je(Vi(e),`Expected subreddit id to start with ${K.SUBREDDIT}, got ${e}}`)}function Sn(e){return Ci(e),e}function bn(e){return Ii(e),e}function vn(e){return Oi(e),e}var ki=({search:e,hash:t})=>{let n=new URLSearchParams(e).get("context");if(n){let o=decodeURIComponent(n),r=_e.fromJSON(JSON.parse(o)),i=xi(t),a={subredditId:vn(r.subredditId),userId:Sn(r.userId),subredditName:r.subredditName,appName:r.appName,appVersion:r.appVersion,postId:bn(r.postId),postData:i?.developerData};globalThis.devvit={context:a}}};globalThis.location&&ki(globalThis.location);function xi(e){let t=e?.slice(1);if(t)try{return Fe.fromJSON(JSON.parse(decodeURIComponent(t)))}catch(n){console.error("Error parsing post data from hash",n);return}}var _i=new Proxy({},{get:(e,t)=>globalThis.devvit.context[t],ownKeys(){return Object.keys(globalThis.devvit.context)},getOwnPropertyDescriptor(e,t){return{enumerable:!0,configurable:!0,value:globalThis.devvit.context[t]}}});var T=w(R(),1);var ve=w(R(),1);var be=w(R(),1);var We=w(R(),1);function En(){return{}}var Ue={$type:"google.protobuf.Empty",encode(e,t=We.default.Writer.create()){return t},decode(e,t){let n=e instanceof We.default.Reader?e:We.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=En();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Ue.fromPartial(e??{})},fromPartial(e){return En()}};s.set(Ue.$type,Ue);function Nn(){return{channels:[]}}var at={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=be.default.Writer.create()){for(let n of e.channels)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof be.default.Reader?e:be.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Nn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.channels.push(n.string());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{channels:globalThis.Array.isArray(e?.channels)?e.channels.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.channels?.length&&(t.channels=e.channels),t},create(e){return at.fromPartial(e??{})},fromPartial(e){let t=Nn();return t.channels=e.channels?.map(n=>n)||[],t}};s.set(at.$type,at);function Tn(){return{channel:"",data:void 0}}var J={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=be.default.Writer.create()){return e.channel!==""&&t.uint32(10).string(e.channel),e.data!==void 0&&E.encode(E.wrap(e.data),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof be.default.Reader?e:be.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Tn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.channel=n.string();continue;case 2:if(i!==18)break;r.data=E.unwrap(E.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{channel:Ri(e.channel)?globalThis.String(e.channel):"",data:Fi(e.data)?e.data:void 0}},toJSON(e){let t={};return e.channel!==""&&(t.channel=e.channel),e.data!==void 0&&(t.data=e.data),t},create(e){return J.fromPartial(e??{})},fromPartial(e){let t=Tn();return t.channel=e.channel??"",t.data=e.data??void 0,t}};s.set(J.$type,J);function Fi(e){return typeof e=="object"&&e!==null}function Ri(e){return e!=null}var Q;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Q||(Q={}));function wi(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return Q.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return Q.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return Q.UNRECOGNIZED}}function Li(e){switch(e){case Q.REALTIME_SUBSCRIBED:return 0;case Q.REALTIME_UNSUBSCRIBED:return 1;case Q.UNRECOGNIZED:default:return-1}}function Vn(){return{subscriptionIds:[]}}var dt={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=ve.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof ve.default.Reader?e:ve.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Vn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.subscriptionIds.push(n.string());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{subscriptionIds:globalThis.Array.isArray(e?.subscriptionIds)?e.subscriptionIds.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.subscriptionIds?.length&&(t.subscriptionIds=e.subscriptionIds),t},create(e){return dt.fromPartial(e??{})},fromPartial(e){let t=Vn();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};s.set(dt.$type,dt);function Cn(){return{event:void 0,status:void 0}}var W={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=ve.default.Writer.create()){return e.event!==void 0&&J.encode(e.event,t.uint32(10).fork()).ldelim(),e.status!==void 0&&t.uint32(16).int32(e.status),t},decode(e,t){let n=e instanceof ve.default.Reader?e:ve.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Cn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.event=J.decode(n,n.uint32());continue;case 2:if(i!==16)break;r.status=n.int32();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{event:In(e.event)?J.fromJSON(e.event):void 0,status:In(e.status)?wi(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=J.toJSON(e.event)),e.status!==void 0&&(t.status=Li(e.status)),t},create(e){return W.fromPartial(e??{})},fromPartial(e){let t=Cn();return t.event=e.event!==void 0&&e.event!==null?J.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};s.set(W.$type,W);function In(e){return e!=null}var x=w(R(),1);var $e=w(R(),1);var h=w(R(),1);var S;(function(e){e[e.STRING=0]="STRING",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.LIST=4]="LIST",e[e.SELECTION=5]="SELECTION",e[e.GROUP=6]="GROUP",e[e.IMAGE=7]="IMAGE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(S||(S={}));function Ve(e){switch(e){case 0:case"STRING":return S.STRING;case 1:case"PARAGRAPH":return S.PARAGRAPH;case 2:case"NUMBER":return S.NUMBER;case 3:case"BOOLEAN":return S.BOOLEAN;case 4:case"LIST":return S.LIST;case 5:case"SELECTION":return S.SELECTION;case 6:case"GROUP":return S.GROUP;case 7:case"IMAGE":return S.IMAGE;case-1:case"UNRECOGNIZED":default:return S.UNRECOGNIZED}}function Ce(e){switch(e){case S.STRING:return 0;case S.PARAGRAPH:return 1;case S.NUMBER:return 2;case S.BOOLEAN:return 3;case S.LIST:return 4;case S.SELECTION:return 5;case S.GROUP:return 6;case S.IMAGE:return 7;case S.UNRECOGNIZED:default:return-1}}var O=w(R(),1);function On(){return{fieldType:0,isSecret:void 0,stringValue:void 0,numberValue:void 0,boolValue:void 0,listValue:void 0,selectionValue:void 0,groupValue:void 0}}var y={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,t=O.default.Writer.create()){return e.fieldType!==0&&t.uint32(8).int32(e.fieldType),e.isSecret!==void 0&&t.uint32(800).bool(e.isSecret),e.stringValue!==void 0&&t.uint32(18).string(e.stringValue),e.numberValue!==void 0&&t.uint32(25).double(e.numberValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.listValue!==void 0&&Y.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&X.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&j.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof O.default.Reader?e:O.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=On();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.fieldType=n.int32();continue;case 100:if(i!==800)break;r.isSecret=n.bool();continue;case 2:if(i!==18)break;r.stringValue=n.string();continue;case 3:if(i!==25)break;r.numberValue=n.double();continue;case 4:if(i!==32)break;r.boolValue=n.bool();continue;case 5:if(i!==42)break;r.listValue=Y.decode(n,n.uint32());continue;case 6:if(i!==50)break;r.selectionValue=X.decode(n,n.uint32());continue;case 7:if(i!==58)break;r.groupValue=j.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{fieldType:U(e.fieldType)?Ve(e.fieldType):0,isSecret:U(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:U(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:U(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:U(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:U(e.listValue)?Y.fromJSON(e.listValue):void 0,selectionValue:U(e.selectionValue)?X.fromJSON(e.selectionValue):void 0,groupValue:U(e.groupValue)?j.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=Ce(e.fieldType)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),e.stringValue!==void 0&&(t.stringValue=e.stringValue),e.numberValue!==void 0&&(t.numberValue=e.numberValue),e.boolValue!==void 0&&(t.boolValue=e.boolValue),e.listValue!==void 0&&(t.listValue=Y.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=X.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=j.toJSON(e.groupValue)),t},create(e){return y.fromPartial(e??{})},fromPartial(e){let t=On();return t.fieldType=e.fieldType??0,t.isSecret=e.isSecret??void 0,t.stringValue=e.stringValue??void 0,t.numberValue=e.numberValue??void 0,t.boolValue=e.boolValue??void 0,t.listValue=e.listValue!==void 0&&e.listValue!==null?Y.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?X.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?j.fromPartial(e.groupValue):void 0,t}};s.set(y.$type,y);function kn(){return{itemType:0,items:[]}}var Y={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=O.default.Writer.create()){e.itemType!==0&&t.uint32(8).int32(e.itemType);for(let n of e.items)y.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof O.default.Reader?e:O.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=kn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.itemType=n.int32();continue;case 2:if(i!==18)break;r.items.push(y.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{itemType:U(e.itemType)?Ve(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(t=>y.fromJSON(t)):[]}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Ce(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>y.toJSON(n))),t},create(e){return Y.fromPartial(e??{})},fromPartial(e){let t=kn();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>y.fromPartial(n))||[],t}};s.set(Y.$type,Y);function xn(){return{values:[]}}var X={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=O.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof O.default.Reader?e:O.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=xn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.values.push(n.string());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?e.values.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values),t},create(e){return X.fromPartial(e??{})},fromPartial(e){let t=xn();return t.values=e.values?.map(n=>n)||[],t}};s.set(X.$type,X);function _n(){return{}}var j={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=O.default.Writer.create()){return t},decode(e,t){let n=e instanceof O.default.Reader?e:O.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=_n();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return j.fromPartial(e??{})},fromPartial(e){return _n()}};s.set(j.$type,j);function U(e){return e!=null}function Fn(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var C={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,t=h.default.Writer.create()){return e.fieldId!==""&&t.uint32(10).string(e.fieldId),e.fieldType!==0&&t.uint32(16).int32(e.fieldType),e.label!==""&&t.uint32(26).string(e.label),e.helpText!==void 0&&t.uint32(34).string(e.helpText),e.defaultValue!==void 0&&y.encode(e.defaultValue,t.uint32(42).fork()).ldelim(),e.required!==void 0&&t.uint32(48).bool(e.required),e.disabled!==void 0&&t.uint32(56).bool(e.disabled),e.fieldConfig!==void 0&&k.encode(e.fieldConfig,t.uint32(66).fork()).ldelim(),e.isSecret!==void 0&&t.uint32(72).bool(e.isSecret),t},decode(e,t){let n=e instanceof h.default.Reader?e:h.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Fn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fieldId=n.string();continue;case 2:if(i!==16)break;r.fieldType=n.int32();continue;case 3:if(i!==26)break;r.label=n.string();continue;case 4:if(i!==34)break;r.helpText=n.string();continue;case 5:if(i!==42)break;r.defaultValue=y.decode(n,n.uint32());continue;case 6:if(i!==48)break;r.required=n.bool();continue;case 7:if(i!==56)break;r.disabled=n.bool();continue;case 8:if(i!==66)break;r.fieldConfig=k.decode(n,n.uint32());continue;case 9:if(i!==72)break;r.isSecret=n.bool();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{fieldId:p(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:p(e.fieldType)?Ve(e.fieldType):0,label:p(e.label)?globalThis.String(e.label):"",helpText:p(e.helpText)?globalThis.String(e.helpText):void 0,defaultValue:p(e.defaultValue)?y.fromJSON(e.defaultValue):void 0,required:p(e.required)?globalThis.Boolean(e.required):void 0,disabled:p(e.disabled)?globalThis.Boolean(e.disabled):void 0,fieldConfig:p(e.fieldConfig)?k.fromJSON(e.fieldConfig):void 0,isSecret:p(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let t={};return e.fieldId!==""&&(t.fieldId=e.fieldId),e.fieldType!==0&&(t.fieldType=Ce(e.fieldType)),e.label!==""&&(t.label=e.label),e.helpText!==void 0&&(t.helpText=e.helpText),e.defaultValue!==void 0&&(t.defaultValue=y.toJSON(e.defaultValue)),e.required!==void 0&&(t.required=e.required),e.disabled!==void 0&&(t.disabled=e.disabled),e.fieldConfig!==void 0&&(t.fieldConfig=k.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return C.fromPartial(e??{})},fromPartial(e){let t=Fn();return t.fieldId=e.fieldId??"",t.fieldType=e.fieldType??0,t.label=e.label??"",t.helpText=e.helpText??void 0,t.defaultValue=e.defaultValue!==void 0&&e.defaultValue!==null?y.fromPartial(e.defaultValue):void 0,t.required=e.required??void 0,t.disabled=e.disabled??void 0,t.fieldConfig=e.fieldConfig!==void 0&&e.fieldConfig!==null?k.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};s.set(C.$type,C);function Rn(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var k={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=h.default.Writer.create()){return e.stringConfig!==void 0&&ee.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&te.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&ne.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&ie.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&re.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&oe.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&ae.encode(e.groupConfig,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof h.default.Reader?e:h.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Rn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.stringConfig=ee.decode(n,n.uint32());continue;case 2:if(i!==18)break;r.paragraphConfig=te.decode(n,n.uint32());continue;case 3:if(i!==26)break;r.numberConfig=ne.decode(n,n.uint32());continue;case 4:if(i!==34)break;r.booleanConfig=ie.decode(n,n.uint32());continue;case 5:if(i!==42)break;r.listConfig=re.decode(n,n.uint32());continue;case 6:if(i!==50)break;r.selectionConfig=oe.decode(n,n.uint32());continue;case 7:if(i!==58)break;r.groupConfig=ae.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{stringConfig:p(e.stringConfig)?ee.fromJSON(e.stringConfig):void 0,paragraphConfig:p(e.paragraphConfig)?te.fromJSON(e.paragraphConfig):void 0,numberConfig:p(e.numberConfig)?ne.fromJSON(e.numberConfig):void 0,booleanConfig:p(e.booleanConfig)?ie.fromJSON(e.booleanConfig):void 0,listConfig:p(e.listConfig)?re.fromJSON(e.listConfig):void 0,selectionConfig:p(e.selectionConfig)?oe.fromJSON(e.selectionConfig):void 0,groupConfig:p(e.groupConfig)?ae.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=ee.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=te.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=ne.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=ie.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=re.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=oe.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=ae.toJSON(e.groupConfig)),t},create(e){return k.fromPartial(e??{})},fromPartial(e){let t=Rn();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?ee.fromPartial(e.stringConfig):void 0,t.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?te.fromPartial(e.paragraphConfig):void 0,t.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?ne.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?ie.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?re.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?oe.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?ae.fromPartial(e.groupConfig):void 0,t}};s.set(k.$type,k);function wn(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var ee={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.String",encode(e,t=h.default.Writer.create()){return e.minLength!==void 0&&t.uint32(8).int32(e.minLength),e.maxLength!==void 0&&t.uint32(16).int32(e.maxLength),e.placeholder!==void 0&&t.uint32(26).string(e.placeholder),t},decode(e,t){let n=e instanceof h.default.Reader?e:h.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=wn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.minLength=n.int32();continue;case 2:if(i!==16)break;r.maxLength=n.int32();continue;case 3:if(i!==26)break;r.placeholder=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{minLength:p(e.minLength)?globalThis.Number(e.minLength):void 0,maxLength:p(e.maxLength)?globalThis.Number(e.maxLength):void 0,placeholder:p(e.placeholder)?globalThis.String(e.placeholder):void 0}},toJSON(e){let t={};return e.minLength!==void 0&&(t.minLength=Math.round(e.minLength)),e.maxLength!==void 0&&(t.maxLength=Math.round(e.maxLength)),e.placeholder!==void 0&&(t.placeholder=e.placeholder),t},create(e){return ee.fromPartial(e??{})},fromPartial(e){let t=wn();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};s.set(ee.$type,ee);function Ln(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var te={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Paragraph",encode(e,t=h.default.Writer.create()){return e.maxCharacters!==void 0&&t.uint32(8).int32(e.maxCharacters),e.lineHeight!==void 0&&t.uint32(16).int32(e.lineHeight),e.placeholder!==void 0&&t.uint32(26).string(e.placeholder),t},decode(e,t){let n=e instanceof h.default.Reader?e:h.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Ln();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.maxCharacters=n.int32();continue;case 2:if(i!==16)break;r.lineHeight=n.int32();continue;case 3:if(i!==26)break;r.placeholder=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{maxCharacters:p(e.maxCharacters)?globalThis.Number(e.maxCharacters):void 0,lineHeight:p(e.lineHeight)?globalThis.Number(e.lineHeight):void 0,placeholder:p(e.placeholder)?globalThis.String(e.placeholder):void 0}},toJSON(e){let t={};return e.maxCharacters!==void 0&&(t.maxCharacters=Math.round(e.maxCharacters)),e.lineHeight!==void 0&&(t.lineHeight=Math.round(e.lineHeight)),e.placeholder!==void 0&&(t.placeholder=e.placeholder),t},create(e){return te.fromPartial(e??{})},fromPartial(e){let t=Ln();return t.maxCharacters=e.maxCharacters??void 0,t.lineHeight=e.lineHeight??void 0,t.placeholder=e.placeholder??void 0,t}};s.set(te.$type,te);function Bn(){return{step:void 0,min:void 0,max:void 0}}var ne={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Number",encode(e,t=h.default.Writer.create()){return e.step!==void 0&&t.uint32(9).double(e.step),e.min!==void 0&&t.uint32(17).double(e.min),e.max!==void 0&&t.uint32(25).double(e.max),t},decode(e,t){let n=e instanceof h.default.Reader?e:h.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Bn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==9)break;r.step=n.double();continue;case 2:if(i!==17)break;r.min=n.double();continue;case 3:if(i!==25)break;r.max=n.double();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{step:p(e.step)?globalThis.Number(e.step):void 0,min:p(e.min)?globalThis.Number(e.min):void 0,max:p(e.max)?globalThis.Number(e.max):void 0}},toJSON(e){let t={};return e.step!==void 0&&(t.step=e.step),e.min!==void 0&&(t.min=e.min),e.max!==void 0&&(t.max=e.max),t},create(e){return ne.fromPartial(e??{})},fromPartial(e){let t=Bn();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};s.set(ne.$type,ne);function Pn(){return{}}var ie={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Boolean",encode(e,t=h.default.Writer.create()){return t},decode(e,t){let n=e instanceof h.default.Reader?e:h.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Pn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return ie.fromPartial(e??{})},fromPartial(e){return Pn()}};s.set(ie.$type,ie);function Dn(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var re={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.List",encode(e,t=h.default.Writer.create()){return e.itemType!==0&&t.uint32(8).int32(e.itemType),e.itemConfig!==void 0&&k.encode(e.itemConfig,t.uint32(18).fork()).ldelim(),e.minEntries!==void 0&&t.uint32(24).int32(e.minEntries),e.maxEntries!==void 0&&t.uint32(32).int32(e.maxEntries),e.entryLabel!==void 0&&t.uint32(42).string(e.entryLabel),t},decode(e,t){let n=e instanceof h.default.Reader?e:h.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Dn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.itemType=n.int32();continue;case 2:if(i!==18)break;r.itemConfig=k.decode(n,n.uint32());continue;case 3:if(i!==24)break;r.minEntries=n.int32();continue;case 4:if(i!==32)break;r.maxEntries=n.int32();continue;case 5:if(i!==42)break;r.entryLabel=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{itemType:p(e.itemType)?Ve(e.itemType):0,itemConfig:p(e.itemConfig)?k.fromJSON(e.itemConfig):void 0,minEntries:p(e.minEntries)?globalThis.Number(e.minEntries):void 0,maxEntries:p(e.maxEntries)?globalThis.Number(e.maxEntries):void 0,entryLabel:p(e.entryLabel)?globalThis.String(e.entryLabel):void 0}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Ce(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=k.toJSON(e.itemConfig)),e.minEntries!==void 0&&(t.minEntries=Math.round(e.minEntries)),e.maxEntries!==void 0&&(t.maxEntries=Math.round(e.maxEntries)),e.entryLabel!==void 0&&(t.entryLabel=e.entryLabel),t},create(e){return re.fromPartial(e??{})},fromPartial(e){let t=Dn();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?k.fromPartial(e.itemConfig):void 0,t.minEntries=e.minEntries??void 0,t.maxEntries=e.maxEntries??void 0,t.entryLabel=e.entryLabel??void 0,t}};s.set(re.$type,re);function An(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var oe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=h.default.Writer.create()){for(let n of e.choices)ue.encode(n,t.uint32(10).fork()).ldelim();return e.multiSelect!==void 0&&t.uint32(16).bool(e.multiSelect),e.minSelections!==void 0&&t.uint32(24).int32(e.minSelections),e.maxSelections!==void 0&&t.uint32(32).int32(e.maxSelections),e.renderAsList!==void 0&&t.uint32(40).bool(e.renderAsList),t},decode(e,t){let n=e instanceof h.default.Reader?e:h.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=An();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.choices.push(ue.decode(n,n.uint32()));continue;case 2:if(i!==16)break;r.multiSelect=n.bool();continue;case 3:if(i!==24)break;r.minSelections=n.int32();continue;case 4:if(i!==32)break;r.maxSelections=n.int32();continue;case 5:if(i!==40)break;r.renderAsList=n.bool();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{choices:globalThis.Array.isArray(e?.choices)?e.choices.map(t=>ue.fromJSON(t)):[],multiSelect:p(e.multiSelect)?globalThis.Boolean(e.multiSelect):void 0,minSelections:p(e.minSelections)?globalThis.Number(e.minSelections):void 0,maxSelections:p(e.maxSelections)?globalThis.Number(e.maxSelections):void 0,renderAsList:p(e.renderAsList)?globalThis.Boolean(e.renderAsList):void 0}},toJSON(e){let t={};return e.choices?.length&&(t.choices=e.choices.map(n=>ue.toJSON(n))),e.multiSelect!==void 0&&(t.multiSelect=e.multiSelect),e.minSelections!==void 0&&(t.minSelections=Math.round(e.minSelections)),e.maxSelections!==void 0&&(t.maxSelections=Math.round(e.maxSelections)),e.renderAsList!==void 0&&(t.renderAsList=e.renderAsList),t},create(e){return oe.fromPartial(e??{})},fromPartial(e){let t=An();return t.choices=e.choices?.map(n=>ue.fromPartial(n))||[],t.multiSelect=e.multiSelect??void 0,t.minSelections=e.minSelections??void 0,t.maxSelections=e.maxSelections??void 0,t.renderAsList=e.renderAsList??void 0,t}};s.set(oe.$type,oe);function Mn(){return{label:"",value:""}}var ue={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection.Item",encode(e,t=h.default.Writer.create()){return e.label!==""&&t.uint32(10).string(e.label),e.value!==""&&t.uint32(18).string(e.value),t},decode(e,t){let n=e instanceof h.default.Reader?e:h.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Mn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.label=n.string();continue;case 2:if(i!==18)break;r.value=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{label:p(e.label)?globalThis.String(e.label):"",value:p(e.value)?globalThis.String(e.value):""}},toJSON(e){let t={};return e.label!==""&&(t.label=e.label),e.value!==""&&(t.value=e.value),t},create(e){return ue.fromPartial(e??{})},fromPartial(e){let t=Mn();return t.label=e.label??"",t.value=e.value??"",t}};s.set(ue.$type,ue);function Jn(){return{fields:[]}}var ae={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,t=h.default.Writer.create()){for(let n of e.fields)C.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof h.default.Reader?e:h.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Jn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fields.push(C.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>C.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>C.toJSON(n))),t},create(e){return ae.fromPartial(e??{})},fromPartial(e){let t=Jn();return t.fields=e.fields?.map(n=>C.fromPartial(n))||[],t}};s.set(ae.$type,ae);function p(e){return e!=null}function Wn(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var $={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=$e.default.Writer.create()){for(let n of e.fields)C.encode(n,t.uint32(10).fork()).ldelim();return e.title!==void 0&&t.uint32(18).string(e.title),e.shortDescription!==void 0&&t.uint32(26).string(e.shortDescription),e.acceptLabel!==void 0&&t.uint32(34).string(e.acceptLabel),e.cancelLabel!==void 0&&t.uint32(42).string(e.cancelLabel),e.id!==void 0&&t.uint32(50).string(e.id),t},decode(e,t){let n=e instanceof $e.default.Reader?e:$e.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Wn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fields.push(C.decode(n,n.uint32()));continue;case 2:if(i!==18)break;r.title=n.string();continue;case 3:if(i!==26)break;r.shortDescription=n.string();continue;case 4:if(i!==34)break;r.acceptLabel=n.string();continue;case 5:if(i!==42)break;r.cancelLabel=n.string();continue;case 6:if(i!==50)break;r.id=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>C.fromJSON(t)):[],title:Re(e.title)?globalThis.String(e.title):void 0,shortDescription:Re(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:Re(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:Re(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:Re(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>C.toJSON(n))),e.title!==void 0&&(t.title=e.title),e.shortDescription!==void 0&&(t.shortDescription=e.shortDescription),e.acceptLabel!==void 0&&(t.acceptLabel=e.acceptLabel),e.cancelLabel!==void 0&&(t.cancelLabel=e.cancelLabel),e.id!==void 0&&(t.id=e.id),t},create(e){return $.fromPartial(e??{})},fromPartial(e){let t=Wn();return t.fields=e.fields?.map(n=>C.fromPartial(n))||[],t.title=e.title??void 0,t.shortDescription=e.shortDescription??void 0,t.acceptLabel=e.acceptLabel??void 0,t.cancelLabel=e.cancelLabel??void 0,t.id=e.id??void 0,t}};s.set($.$type,$);function Re(e){return e!=null}function Un(){return{form:void 0}}var ft={$type:"devvit.ui.effects.v1alpha.ShowFormEffect",encode(e,t=x.default.Writer.create()){return e.form!==void 0&&$.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Un();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.form=$.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{form:Le(e.form)?$.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=$.toJSON(e.form)),t},create(e){return ft.fromPartial(e??{})},fromPartial(e){let t=Un();return t.form=e.form!==void 0&&e.form!==null?$.fromPartial(e.form):void 0,t}};s.set(ft.$type,ft);function $n(){return{results:{},formId:void 0}}var G={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent",encode(e,t=x.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{we.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),e.formId!==void 0&&t.uint32(18).string(e.formId),t},decode(e,t){let n=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=$n();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;let a=we.decode(n,n.uint32());a.value!==void 0&&(r.results[a.key]=a.value);continue;case 2:if(i!==18)break;r.formId=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{results:Bi(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=y.fromJSON(o),t),{}):{},formId:Le(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let t={};if(e.results){let n=Object.entries(e.results);n.length>0&&(t.results={},n.forEach(([o,r])=>{t.results[o]=y.toJSON(r)}))}return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return G.fromPartial(e??{})},fromPartial(e){let t=$n();return t.results=Object.entries(e.results??{}).reduce((n,[o,r])=>(r!==void 0&&(n[o]=y.fromPartial(r)),n),{}),t.formId=e.formId??void 0,t}};s.set(G.$type,G);function Gn(){return{key:"",value:void 0}}var we={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=x.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&y.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Gn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.key=n.string();continue;case 2:if(i!==18)break;r.value=y.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{key:Le(e.key)?globalThis.String(e.key):"",value:Le(e.value)?y.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=y.toJSON(e.value)),t},create(e){return we.fromPartial(e??{})},fromPartial(e){let t=Gn();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?y.fromPartial(e.value):void 0,t}};s.set(we.$type,we);function qn(){return{formId:void 0}}var q={$type:"devvit.ui.effects.v1alpha.FormCanceledEvent",encode(e,t=x.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=qn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.formId=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{formId:Le(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let t={};return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return q.fromPartial(e??{})},fromPartial(e){let t=qn();return t.formId=e.formId??void 0,t}};s.set(q.$type,q);function Bi(e){return typeof e=="object"&&e!==null}function Le(e){return e!=null}var Ge=w(R(),1);var M;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.INLINE_MODE=1]="INLINE_MODE",e[e.IMMERSIVE_MODE=2]="IMMERSIVE_MODE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(M||(M={}));function st(e){switch(e){case 0:case"UNSPECIFIED":return M.UNSPECIFIED;case 1:case"INLINE_MODE":return M.INLINE_MODE;case 2:case"IMMERSIVE_MODE":return M.IMMERSIVE_MODE;case-1:case"UNRECOGNIZED":default:return M.UNRECOGNIZED}}function ct(e){switch(e){case M.UNSPECIFIED:return 0;case M.INLINE_MODE:return 1;case M.IMMERSIVE_MODE:return 2;case M.UNRECOGNIZED:default:return-1}}function Hn(){return{immersiveMode:0}}var lt={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,t=Ge.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),t},decode(e,t){let n=e instanceof Ge.default.Reader?e:Ge.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Hn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.immersiveMode=n.int32();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{immersiveMode:Pi(e.immersiveMode)?st(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=ct(e.immersiveMode)),t},create(e){return lt.fromPartial(e??{})},fromPartial(e){let t=Hn();return t.immersiveMode=e.immersiveMode??0,t}};s.set(lt.$type,lt);function Pi(e){return e!=null}var se;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(se||(se={}));function Di(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return se.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return se.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return se.UNRECOGNIZED}}function Ai(e){switch(e){case se.WEBVIEW_VISIBLE:return 0;case se.WEBVIEW_HIDDEN:return 1;case se.UNRECOGNIZED:default:return-1}}function Zn(){return{message:void 0,jsonString:""}}var de={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=T.default.Writer.create()){return e.message!==void 0&&N.encode(N.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Zn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.message=N.unwrap(N.decode(n,n.uint32()));continue;case 2:if(i!==18)break;r.jsonString=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{message:D(e?.message)?e.message:void 0,jsonString:D(e.jsonString)?globalThis.String(e.jsonString):""}},toJSON(e){let t={};return e.message!==void 0&&(t.message=e.message),e.jsonString!==""&&(t.jsonString=e.jsonString),t},create(e){return de.fromPartial(e??{})},fromPartial(e){let t=Zn();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};s.set(de.$type,de);function zn(){return{visibility:0}}var fe={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=T.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=zn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.visibility=n.int32();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{visibility:D(e.visibility)?Di(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=Ai(e.visibility)),t},create(e){return fe.fromPartial(e??{})},fromPartial(e){let t=zn();return t.visibility=e.visibility??0,t}};s.set(fe.$type,fe);function Kn(){return{postMessage:void 0,fullScreen:void 0}}var pt={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=T.default.Writer.create()){return e.postMessage!==void 0&&de.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&fe.encode(e.fullScreen,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Kn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.postMessage=de.decode(n,n.uint32());continue;case 2:if(i!==18)break;r.fullScreen=fe.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{postMessage:D(e.postMessage)?de.fromJSON(e.postMessage):void 0,fullScreen:D(e.fullScreen)?fe.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=de.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=fe.toJSON(e.fullScreen)),t},create(e){return pt.fromPartial(e??{})},fromPartial(e){let t=Kn();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?de.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?fe.fromPartial(e.fullScreen):void 0,t}};s.set(pt.$type,pt);function Qn(){return{immersiveMode:0}}var le={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode(e,t=T.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Qn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.immersiveMode=n.int32();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{immersiveMode:D(e.immersiveMode)?st(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=ct(e.immersiveMode)),t},create(e){return le.fromPartial(e??{})},fromPartial(e){let t=Qn();return t.immersiveMode=e.immersiveMode??0,t}};s.set(le.$type,le);function Yn(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0}}var Be={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=T.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&q.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&G.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&W.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&le.encode(e.immersiveModeEvent,t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof T.default.Reader?e:T.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Yn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.id=n.string();continue;case 2:if(i!==18)break;r.formCanceled=q.decode(n,n.uint32());continue;case 3:if(i!==26)break;r.formSubmitted=G.decode(n,n.uint32());continue;case 4:if(i!==34)break;r.realtimeEvent=W.decode(n,n.uint32());continue;case 5:if(i!==42)break;r.immersiveModeEvent=le.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{id:D(e.id)?globalThis.String(e.id):"",formCanceled:D(e.formCanceled)?q.fromJSON(e.formCanceled):void 0,formSubmitted:D(e.formSubmitted)?G.fromJSON(e.formSubmitted):void 0,realtimeEvent:D(e.realtimeEvent)?W.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:D(e.immersiveModeEvent)?le.fromJSON(e.immersiveModeEvent):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=q.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=G.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=W.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(t.immersiveModeEvent=le.toJSON(e.immersiveModeEvent)),t},create(e){return Be.fromPartial(e??{})},fromPartial(e){let t=Yn();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?q.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?G.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?W.fromPartial(e.realtimeEvent):void 0,t.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?le.fromPartial(e.immersiveModeEvent):void 0,t}};s.set(Be.$type,Be);function D(e){return e!=null}var Xn=[3];var ce=e=>new Promise(t=>{let n={scope:0,type:"devvit-internal"};if(e.realtimeSubscriptions?n.realtimeEffect=e.realtimeSubscriptions:n.effect=e,Xn.includes(e.type)){let o=self.crypto.randomUUID();n.id=o;let r=i=>{if(i.data?.type==="devvit-message"&&i.data?.data?.id===o){let a=Be.fromJSON(i.data.data);t(a),window.removeEventListener("message",r)}};window.addEventListener("message",r),window.parent.postMessage(n,"*")}else window.parent.postMessage(n,"*"),t(void 0)});function jn(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.url).toString(),ce({navigateToUrl:{url:t},type:5})}function mt(e,t=new Set){for(let n of e){if(n.type==="group"){mt(n.fields,t);continue}let o=n.name;if(t.has(o))throw new Error(`Duplicate field name: ${o}`);t.add(o)}Mi(e)}function Mi(e){for(let t of e)if(t.type==="string"&&t.isSecret&&t.scope!=="app")throw`Invalid setting: only app settings can be secrets. Add "scope: SettingScope.App" to field "${t.name}"`}function Ji(e){switch(e.fieldType){case 0:return e.stringValue;case 7:return e.stringValue;case 1:return e.stringValue;case 2:return e.numberValue;case 3:return e.boolValue;case 5:return e.selectionValue?.values??[];default:return}}function ei(e){return Object.keys(e).reduce((t,n)=>{let o=Ji(e[n]);return o!==void 0&&(t[n]=o),t},{})}function ht(e){return e.map(t=>{switch(t.type){case"string":return Wi(t);case"image":return Ui(t);case"paragraph":return $i(t);case"number":return Gi(t);case"select":return qi(t);case"boolean":return Hi(t);case"group":return Zi(t);default:throw new Error("Unknown field type.")}})}function Wi(e){return{defaultValue:{fieldType:0,stringValue:e.defaultValue},disabled:e.disabled,fieldConfig:{stringConfig:{placeholder:e.placeholder}},fieldId:e.name,fieldType:0,helpText:e.helpText,label:e.label,required:e.required,isSecret:e.isSecret}}function Ui(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function $i(e){return{defaultValue:{fieldType:1,stringValue:e.defaultValue},disabled:e.disabled,fieldConfig:{paragraphConfig:{lineHeight:e.lineHeight,placeholder:e.placeholder}},fieldId:e.name,fieldType:1,helpText:e.helpText,label:e.label,required:e.required}}function Gi(e){return{defaultValue:{fieldType:2,numberValue:e.defaultValue},disabled:e.disabled,fieldConfig:{numberConfig:{}},fieldId:e.name,fieldType:2,helpText:e.helpText,label:e.label,required:e.required}}function qi(e){return{defaultValue:{fieldType:5,selectionValue:{values:e.defaultValue??[]}},disabled:e.disabled,fieldConfig:{selectionConfig:{choices:e.options,multiSelect:e.multiSelect}},fieldId:e.name,fieldType:5,helpText:e.helpText,label:e.label,required:e.required}}function Hi(e){return{defaultValue:{fieldType:3,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:3,helpText:e.helpText,label:e.label}}function Zi(e){return{fieldId:"",fieldType:6,fieldConfig:{groupConfig:{fields:ht(e.fields)}},label:e.label,helpText:e.helpText}}var ti=1,zi=()=>(ti++,`form.${ti}`),ni=async e=>{let t={fields:[],id:zi(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};mt(e.fields),t.fields=ht(e.fields);let n=await ce({showForm:{form:t},type:3});return!n||!n.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:ei(n.formSubmitted.results)}};function ii(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?1:0}:t={text:e},ce({showToast:{toast:t},type:4})}export{_i as context,ce as emitEffect,jn as navigateTo,ni as showForm,ii as showToast};
|
|
2
2
|
//# sourceMappingURL=client.min.js.map
|