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