@devvit/public-api 0.11.0-next-2024-07-30-8f65a4fa6.0 → 0.11.0-next-2024-07-30-0415fdb14.0

Sign up to get free protection for your applications and to get access to all the features.
package/public-api.min.js CHANGED
@@ -1,8 +1,8 @@
1
- var $S=Object.create;var dp=Object.defineProperty;var KS=Object.getOwnPropertyDescriptor;var XS=Object.getOwnPropertyNames;var ZS=Object.getPrototypeOf,YS=Object.prototype.hasOwnProperty;var h=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var QS=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of XS(e))!YS.call(r,n)&&n!==t&&dp(r,n,{get:()=>e[n],enumerable:!(i=KS(e,n))||i.enumerable});return r};var Bn=(r,e,t)=>(t=r!=null?$S(ZS(r)):{},QS(e||!r||!r.__esModule?dp(t,"default",{value:r,enumerable:!0}):t,r));var Gl=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var s=(r,e,t)=>(Gl(r,e,"read from private field"),t?t.call(r):e.get(r)),d=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},l=(r,e,t,i)=>(Gl(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t);var S=(r,e,t)=>(Gl(r,e,"access private method"),t);var ne=h((IF,lp)=>{lp.exports=function(r){try{return!!r()}catch{return!0}}});var Ea=h((wF,up)=>{var eP=ne();up.exports=!eP(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var z=h((xF,pp)=>{var cp=Ea(),mp=Function.prototype,Vl=mp.call,tP=cp&&mp.bind.bind(Vl,Vl);pp.exports=cp?tP:function(r){return function(){return Vl.apply(r,arguments)}}});var gp=h((TF,fp)=>{var rP=Math.ceil,iP=Math.floor;fp.exports=Math.trunc||function(e){var t=+e;return(t>0?iP:rP)(t)}});var Ra=h((AF,hp)=>{var nP=gp();hp.exports=function(r){var e=+r;return e!==e||e===0?0:nP(e)}});var le=h((EF,vp)=>{var Oa=function(r){return r&&r.Math==Math&&r};vp.exports=Oa(typeof globalThis=="object"&&globalThis)||Oa(typeof window=="object"&&window)||Oa(typeof self=="object"&&self)||Oa(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var _r=h((RF,yp)=>{yp.exports=!1});var Fa=h((OF,kp)=>{var bp=le(),sP=Object.defineProperty;kp.exports=function(r,e){try{sP(bp,r,{value:e,configurable:!0,writable:!0})}catch{bp[r]=e}return e}});var Ma=h((FF,Pp)=>{var oP=le(),aP=Fa(),Sp="__core-js_shared__",dP=oP[Sp]||aP(Sp,{});Pp.exports=dP});var zl=h((MF,Ip)=>{var lP=_r(),Cp=Ma();(Ip.exports=function(r,e){return Cp[r]||(Cp[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:lP?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"})});var La=h((LF,wp)=>{wp.exports=function(r){return r==null}});var Ua=h((UF,xp)=>{var uP=La(),cP=TypeError;xp.exports=function(r){if(uP(r))throw cP("Can't call method on "+r);return r}});var Dn=h((BF,Tp)=>{var mP=Ua(),pP=Object;Tp.exports=function(r){return pP(mP(r))}});var Se=h((DF,Ap)=>{var fP=z(),gP=Dn(),hP=fP({}.hasOwnProperty);Ap.exports=Object.hasOwn||function(e,t){return hP(gP(e),t)}});var Jl=h((_F,Ep)=>{var vP=z(),yP=0,bP=Math.random(),kP=vP(1 .toString);Ep.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+kP(++yP+bP,36)}});var Op=h((NF,Rp)=>{Rp.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var _p=h((qF,Dp)=>{var Bp=le(),$l=Op(),Fp=Bp.process,Mp=Bp.Deno,Lp=Fp&&Fp.versions||Mp&&Mp.version,Up=Lp&&Lp.v8,Ne,Ba;Up&&(Ne=Up.split("."),Ba=Ne[0]>0&&Ne[0]<4?1:+(Ne[0]+Ne[1]));!Ba&&$l&&(Ne=$l.match(/Edge\/(\d+)/),(!Ne||Ne[1]>=74)&&(Ne=$l.match(/Chrome\/(\d+)/),Ne&&(Ba=+Ne[1])));Dp.exports=Ba});var Kl=h((jF,qp)=>{var Np=_p(),SP=ne();qp.exports=!!Object.getOwnPropertySymbols&&!SP(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Np&&Np<41})});var Xl=h((HF,jp)=>{var PP=Kl();jp.exports=PP&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Pe=h((WF,Wp)=>{var CP=le(),IP=zl(),Hp=Se(),wP=Jl(),xP=Kl(),TP=Xl(),Nr=CP.Symbol,Zl=IP("wks"),AP=TP?Nr.for||Nr:Nr&&Nr.withoutSetter||wP;Wp.exports=function(r){return Hp(Zl,r)||(Zl[r]=xP&&Hp(Nr,r)?Nr[r]:AP("Symbol."+r)),Zl[r]}});var zp=h((GF,Vp)=>{var EP=Pe(),RP=EP("toStringTag"),Gp={};Gp[RP]="z";Vp.exports=String(Gp)==="[object z]"});var Ql=h((VF,Jp)=>{var Yl=typeof document=="object"&&document.all,OP=typeof Yl>"u"&&Yl!==void 0;Jp.exports={all:Yl,IS_HTMLDDA:OP}});var J=h((zF,Kp)=>{var $p=Ql(),FP=$p.all;Kp.exports=$p.IS_HTMLDDA?function(r){return typeof r=="function"||r===FP}:function(r){return typeof r=="function"}});var Da=h((JF,Zp)=>{var Xp=z(),MP=Xp({}.toString),LP=Xp("".slice);Zp.exports=function(r){return LP(MP(r),8,-1)}});var _n=h(($F,Yp)=>{var UP=zp(),BP=J(),_a=Da(),DP=Pe(),_P=DP("toStringTag"),NP=Object,qP=_a(function(){return arguments}())=="Arguments",jP=function(r,e){try{return r[e]}catch{}};Yp.exports=UP?_a:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=jP(e=NP(r),_P))=="string"?t:qP?_a(e):(i=_a(e))=="Object"&&BP(e.callee)?"Arguments":i}});var Nn=h((KF,Qp)=>{var HP=_n(),WP=String;Qp.exports=function(r){if(HP(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return WP(r)}});var tu=h((XF,rf)=>{var eu=z(),GP=Ra(),VP=Nn(),zP=Ua(),JP=eu("".charAt),ef=eu("".charCodeAt),$P=eu("".slice),tf=function(r){return function(e,t){var i=VP(zP(e)),n=GP(t),o=i.length,a,c;return n<0||n>=o?r?"":void 0:(a=ef(i,n),a<55296||a>56319||n+1===o||(c=ef(i,n+1))<56320||c>57343?r?JP(i,n):a:r?$P(i,n,n+2):(a-55296<<10)+(c-56320)+65536)}};rf.exports={codeAt:tf(!1),charAt:tf(!0)}});var of=h((ZF,sf)=>{var KP=le(),XP=J(),nf=KP.WeakMap;sf.exports=XP(nf)&&/native code/.test(String(nf))});var yt=h((YF,lf)=>{var af=J(),df=Ql(),ZP=df.all;lf.exports=df.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:af(r)||r===ZP}:function(r){return typeof r=="object"?r!==null:af(r)}});var ue=h((QF,uf)=>{var YP=ne();uf.exports=!YP(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var iu=h((eM,mf)=>{var QP=le(),cf=yt(),ru=QP.document,eC=cf(ru)&&cf(ru.createElement);mf.exports=function(r){return eC?ru.createElement(r):{}}});var nu=h((tM,pf)=>{var tC=ue(),rC=ne(),iC=iu();pf.exports=!tC&&!rC(function(){return Object.defineProperty(iC("div"),"a",{get:function(){return 7}}).a!=7})});var su=h((rM,ff)=>{var nC=ue(),sC=ne();ff.exports=nC&&sC(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var $e=h((iM,gf)=>{var oC=yt(),aC=String,dC=TypeError;gf.exports=function(r){if(oC(r))return r;throw dC(aC(r)+" is not an object")}});var qe=h((nM,hf)=>{var lC=Ea(),Na=Function.prototype.call;hf.exports=lC?Na.bind(Na):function(){return Na.apply(Na,arguments)}});var qn=h((sM,vf)=>{var ou=le(),uC=J(),cC=function(r){return uC(r)?r:void 0};vf.exports=function(r,e){return arguments.length<2?cC(ou[r]):ou[r]&&ou[r][e]}});var au=h((oM,yf)=>{var mC=z();yf.exports=mC({}.isPrototypeOf)});var du=h((aM,bf)=>{var pC=qn(),fC=J(),gC=au(),hC=Xl(),vC=Object;bf.exports=hC?function(r){return typeof r=="symbol"}:function(r){var e=pC("Symbol");return fC(e)&&gC(e.prototype,vC(r))}});var lu=h((dM,kf)=>{var yC=String;kf.exports=function(r){try{return yC(r)}catch{return"Object"}}});var qa=h((lM,Sf)=>{var bC=J(),kC=lu(),SC=TypeError;Sf.exports=function(r){if(bC(r))return r;throw SC(kC(r)+" is not a function")}});var ja=h((uM,Pf)=>{var PC=qa(),CC=La();Pf.exports=function(r,e){var t=r[e];return CC(t)?void 0:PC(t)}});var If=h((cM,Cf)=>{var uu=qe(),cu=J(),mu=yt(),IC=TypeError;Cf.exports=function(r,e){var t,i;if(e==="string"&&cu(t=r.toString)&&!mu(i=uu(t,r))||cu(t=r.valueOf)&&!mu(i=uu(t,r))||e!=="string"&&cu(t=r.toString)&&!mu(i=uu(t,r)))return i;throw IC("Can't convert object to primitive value")}});var Af=h((mM,Tf)=>{var wC=qe(),wf=yt(),xf=du(),xC=ja(),TC=If(),AC=Pe(),EC=TypeError,RC=AC("toPrimitive");Tf.exports=function(r,e){if(!wf(r)||xf(r))return r;var t=xC(r,RC),i;if(t){if(e===void 0&&(e="default"),i=wC(t,r,e),!wf(i)||xf(i))return i;throw EC("Can't convert object to primitive value")}return e===void 0&&(e="number"),TC(r,e)}});var Ha=h((pM,Ef)=>{var OC=Af(),FC=du();Ef.exports=function(r){var e=OC(r,"string");return FC(e)?e:e+""}});var Ke=h(Of=>{var MC=ue(),LC=nu(),UC=su(),Wa=$e(),Rf=Ha(),BC=TypeError,pu=Object.defineProperty,DC=Object.getOwnPropertyDescriptor,fu="enumerable",gu="configurable",hu="writable";Of.f=MC?UC?function(e,t,i){if(Wa(e),t=Rf(t),Wa(i),typeof e=="function"&&t==="prototype"&&"value"in i&&hu in i&&!i[hu]){var n=DC(e,t);n&&n[hu]&&(e[t]=i.value,i={configurable:gu in i?i[gu]:n[gu],enumerable:fu in i?i[fu]:n[fu],writable:!1})}return pu(e,t,i)}:pu:function(e,t,i){if(Wa(e),t=Rf(t),Wa(i),LC)try{return pu(e,t,i)}catch{}if("get"in i||"set"in i)throw BC("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var qr=h((gM,Ff)=>{Ff.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Ga=h((hM,Mf)=>{var _C=ue(),NC=Ke(),qC=qr();Mf.exports=_C?function(r,e,t){return NC.f(r,e,qC(1,t))}:function(r,e,t){return r[e]=t,r}});var Va=h((vM,Uf)=>{var jC=zl(),HC=Jl(),Lf=jC("keys");Uf.exports=function(r){return Lf[r]||(Lf[r]=HC(r))}});var za=h((yM,Bf)=>{Bf.exports={}});var jr=h((bM,Nf)=>{var WC=of(),_f=le(),GC=yt(),VC=Ga(),vu=Se(),yu=Ma(),zC=Va(),JC=za(),Df="Object already initialized",bu=_f.TypeError,$C=_f.WeakMap,Ja,jn,$a,KC=function(r){return $a(r)?jn(r):Ja(r,{})},XC=function(r){return function(e){var t;if(!GC(e)||(t=jn(e)).type!==r)throw bu("Incompatible receiver, "+r+" required");return t}};WC||yu.state?(je=yu.state||(yu.state=new $C),je.get=je.get,je.has=je.has,je.set=je.set,Ja=function(r,e){if(je.has(r))throw bu(Df);return e.facade=r,je.set(r,e),e},jn=function(r){return je.get(r)||{}},$a=function(r){return je.has(r)}):(Qt=zC("state"),JC[Qt]=!0,Ja=function(r,e){if(vu(r,Qt))throw bu(Df);return e.facade=r,VC(r,Qt,e),e},jn=function(r){return vu(r,Qt)?r[Qt]:{}},$a=function(r){return vu(r,Qt)});var je,Qt;Nf.exports={set:Ja,get:jn,has:$a,enforce:KC,getterFor:XC}});var ku=h(Hf=>{"use strict";var qf={}.propertyIsEnumerable,jf=Object.getOwnPropertyDescriptor,ZC=jf&&!qf.call({1:2},1);Hf.f=ZC?function(e){var t=jf(this,e);return!!t&&t.enumerable}:qf});var Pu=h((SM,Wf)=>{var YC=z(),QC=ne(),eI=Da(),Su=Object,tI=YC("".split);Wf.exports=QC(function(){return!Su("z").propertyIsEnumerable(0)})?function(r){return eI(r)=="String"?tI(r,""):Su(r)}:Su});var Hr=h((PM,Gf)=>{var rI=Pu(),iI=Ua();Gf.exports=function(r){return rI(iI(r))}});var Cu=h(zf=>{var nI=ue(),sI=qe(),oI=ku(),aI=qr(),dI=Hr(),lI=Ha(),uI=Se(),cI=nu(),Vf=Object.getOwnPropertyDescriptor;zf.f=nI?Vf:function(e,t){if(e=dI(e),t=lI(t),cI)try{return Vf(e,t)}catch{}if(uI(e,t))return aI(!sI(oI.f,e,t),e[t])}});var xu=h((IM,$f)=>{var Iu=ue(),mI=Se(),Jf=Function.prototype,pI=Iu&&Object.getOwnPropertyDescriptor,wu=mI(Jf,"name"),fI=wu&&function(){}.name==="something",gI=wu&&(!Iu||Iu&&pI(Jf,"name").configurable);$f.exports={EXISTS:wu,PROPER:fI,CONFIGURABLE:gI}});var Au=h((wM,Kf)=>{var hI=z(),vI=J(),Tu=Ma(),yI=hI(Function.toString);vI(Tu.inspectSource)||(Tu.inspectSource=function(r){return yI(r)});Kf.exports=Tu.inspectSource});var Ou=h((xM,Yf)=>{var Ru=z(),bI=ne(),kI=J(),Ka=Se(),Eu=ue(),SI=xu().CONFIGURABLE,PI=Au(),Zf=jr(),CI=Zf.enforce,II=Zf.get,Xf=String,Xa=Object.defineProperty,wI=Ru("".slice),xI=Ru("".replace),TI=Ru([].join),AI=Eu&&!bI(function(){return Xa(function(){},"length",{value:8}).length!==8}),EI=String(String).split("String"),RI=Yf.exports=function(r,e,t){wI(Xf(e),0,7)==="Symbol("&&(e="["+xI(Xf(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Ka(r,"name")||SI&&r.name!==e)&&(Eu?Xa(r,"name",{value:e,configurable:!0}):r.name=e),AI&&t&&Ka(t,"arity")&&r.length!==t.arity&&Xa(r,"length",{value:t.arity});try{t&&Ka(t,"constructor")&&t.constructor?Eu&&Xa(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=CI(r);return Ka(i,"source")||(i.source=TI(EI,typeof e=="string"?e:"")),r};Function.prototype.toString=RI(function(){return kI(this)&&II(this).source||PI(this)},"toString")});var er=h((TM,Qf)=>{var OI=J(),FI=Ke(),MI=Ou(),LI=Fa();Qf.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(OI(t)&&MI(t,o,i),i.global)n?r[e]=t:LI(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:FI.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var Fu=h((AM,eg)=>{var UI=Ra(),BI=Math.max,DI=Math.min;eg.exports=function(r,e){var t=UI(r);return t<0?BI(t+e,0):DI(t,e)}});var rg=h((EM,tg)=>{var _I=Ra(),NI=Math.min;tg.exports=function(r){return r>0?NI(_I(r),9007199254740991):0}});var Za=h((RM,ig)=>{var qI=rg();ig.exports=function(r){return qI(r.length)}});var og=h((OM,sg)=>{var jI=Hr(),HI=Fu(),WI=Za(),ng=function(r){return function(e,t,i){var n=jI(e),o=WI(n),a=HI(i,o),c;if(r&&t!=t){for(;o>a;)if(c=n[a++],c!=c)return!0}else for(;o>a;a++)if((r||a in n)&&n[a]===t)return r||a||0;return!r&&-1}};sg.exports={includes:ng(!0),indexOf:ng(!1)}});var Lu=h((FM,dg)=>{var GI=z(),Mu=Se(),VI=Hr(),zI=og().indexOf,JI=za(),ag=GI([].push);dg.exports=function(r,e){var t=VI(r),i=0,n=[],o;for(o in t)!Mu(JI,o)&&Mu(t,o)&&ag(n,o);for(;e.length>i;)Mu(t,o=e[i++])&&(~zI(n,o)||ag(n,o));return n}});var Ya=h((MM,lg)=>{lg.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var cg=h(ug=>{var $I=Lu(),KI=Ya(),XI=KI.concat("length","prototype");ug.f=Object.getOwnPropertyNames||function(e){return $I(e,XI)}});var Uu=h(mg=>{mg.f=Object.getOwnPropertySymbols});var fg=h((BM,pg)=>{var ZI=qn(),YI=z(),QI=cg(),ew=Uu(),tw=$e(),rw=YI([].concat);pg.exports=ZI("Reflect","ownKeys")||function(e){var t=QI.f(tw(e)),i=ew.f;return i?rw(t,i(e)):t}});var vg=h((DM,hg)=>{var gg=Se(),iw=fg(),nw=Cu(),sw=Ke();hg.exports=function(r,e,t){for(var i=iw(e),n=sw.f,o=nw.f,a=0;a<i.length;a++){var c=i[a];!gg(r,c)&&!(t&&gg(t,c))&&n(r,c,o(e,c))}}});var bg=h((_M,yg)=>{var ow=ne(),aw=J(),dw=/#|\.prototype\./,Hn=function(r,e){var t=uw[lw(r)];return t==mw?!0:t==cw?!1:aw(e)?ow(e):!!e},lw=Hn.normalize=function(r){return String(r).replace(dw,".").toLowerCase()},uw=Hn.data={},cw=Hn.NATIVE="N",mw=Hn.POLYFILL="P";yg.exports=Hn});var Wn=h((NM,kg)=>{var Bu=le(),pw=Cu().f,fw=Ga(),gw=er(),hw=Fa(),vw=vg(),yw=bg();kg.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,c,p,f,v;if(i?a=Bu:n?a=Bu[t]||hw(t,{}):a=(Bu[t]||{}).prototype,a)for(c in e){if(f=e[c],r.dontCallGetSet?(v=pw(a,c),p=v&&v.value):p=a[c],o=yw(i?c:t+(n?".":"#")+c,r.forced),!o&&p!==void 0){if(typeof f==typeof p)continue;vw(f,p)}(r.sham||p&&p.sham)&&fw(f,"sham",!0),gw(a,c,f,r)}}});var Du=h((qM,Sg)=>{var bw=Lu(),kw=Ya();Sg.exports=Object.keys||function(e){return bw(e,kw)}});var Cg=h(Pg=>{var Sw=ue(),Pw=su(),Cw=Ke(),Iw=$e(),ww=Hr(),xw=Du();Pg.f=Sw&&!Pw?Object.defineProperties:function(e,t){Iw(e);for(var i=ww(t),n=xw(t),o=n.length,a=0,c;o>a;)Cw.f(e,c=n[a++],i[c]);return e}});var wg=h((HM,Ig)=>{var Tw=qn();Ig.exports=Tw("document","documentElement")});var Gn=h((WM,Fg)=>{var Aw=$e(),Ew=Cg(),xg=Ya(),Rw=za(),Ow=wg(),Fw=iu(),Mw=Va(),Tg=">",Ag="<",Nu="prototype",qu="script",Rg=Mw("IE_PROTO"),_u=function(){},Og=function(r){return Ag+qu+Tg+r+Ag+"/"+qu+Tg},Eg=function(r){r.write(Og("")),r.close();var e=r.parentWindow.Object;return r=null,e},Lw=function(){var r=Fw("iframe"),e="java"+qu+":",t;return r.style.display="none",Ow.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(Og("document.F=Object")),t.close(),t.F},Qa,ed=function(){try{Qa=new ActiveXObject("htmlfile")}catch{}ed=typeof document<"u"?document.domain&&Qa?Eg(Qa):Lw():Eg(Qa);for(var r=xg.length;r--;)delete ed[Nu][xg[r]];return ed()};Rw[Rg]=!0;Fg.exports=Object.create||function(e,t){var i;return e!==null?(_u[Nu]=Aw(e),i=new _u,_u[Nu]=null,i[Rg]=e):i=ed(),t===void 0?i:Ew.f(i,t)}});var Lg=h((GM,Mg)=>{var Uw=ne();Mg.exports=!Uw(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var Hu=h((VM,Bg)=>{var Bw=Se(),Dw=J(),_w=Dn(),Nw=Va(),qw=Lg(),Ug=Nw("IE_PROTO"),ju=Object,jw=ju.prototype;Bg.exports=qw?ju.getPrototypeOf:function(r){var e=_w(r);if(Bw(e,Ug))return e[Ug];var t=e.constructor;return Dw(t)&&e instanceof t?t.prototype:e instanceof ju?jw:null}});var zu=h((zM,Ng)=>{"use strict";var Hw=ne(),Ww=J(),Gw=yt(),Vw=Gn(),Dg=Hu(),zw=er(),Jw=Pe(),$w=_r(),Vu=Jw("iterator"),_g=!1,it,Wu,Gu;[].keys&&(Gu=[].keys(),"next"in Gu?(Wu=Dg(Dg(Gu)),Wu!==Object.prototype&&(it=Wu)):_g=!0);var Kw=!Gw(it)||Hw(function(){var r={};return it[Vu].call(r)!==r});Kw?it={}:$w&&(it=Vw(it));Ww(it[Vu])||zw(it,Vu,function(){return this});Ng.exports={IteratorPrototype:it,BUGGY_SAFARI_ITERATORS:_g}});var Vn=h((JM,jg)=>{var Xw=Ke().f,Zw=Se(),Yw=Pe(),qg=Yw("toStringTag");jg.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!Zw(r,qg)&&Xw(r,qg,{configurable:!0,value:e})}});var Wr=h(($M,Hg)=>{Hg.exports={}});var Ju=h((KM,Wg)=>{"use strict";var Qw=zu().IteratorPrototype,ex=Gn(),tx=qr(),rx=Vn(),ix=Wr(),nx=function(){return this};Wg.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=ex(Qw,{next:tx(+!i,t)}),rx(r,n,!1,!0),ix[n]=nx,r}});var Vg=h((XM,Gg)=>{var sx=J(),ox=String,ax=TypeError;Gg.exports=function(r){if(typeof r=="object"||sx(r))return r;throw ax("Can't set "+ox(r)+" as a prototype")}});var Jg=h((ZM,zg)=>{var dx=z(),lx=$e(),ux=Vg();zg.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=dx(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return lx(n),ux(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var Ku=h((YM,ih)=>{"use strict";var cx=Wn(),mx=qe(),td=_r(),th=xu(),px=J(),fx=Ju(),$g=Hu(),Kg=Jg(),gx=Vn(),hx=Ga(),$u=er(),vx=Pe(),Xg=Wr(),rh=zu(),yx=th.PROPER,bx=th.CONFIGURABLE,Zg=rh.IteratorPrototype,rd=rh.BUGGY_SAFARI_ITERATORS,zn=vx("iterator"),Yg="keys",Jn="values",Qg="entries",eh=function(){return this};ih.exports=function(r,e,t,i,n,o,a){fx(t,e,i);var c=function(F){if(F===n&&b)return b;if(!rd&&F in v)return v[F];switch(F){case Yg:return function(){return new t(this,F)};case Jn:return function(){return new t(this,F)};case Qg:return function(){return new t(this,F)}}return function(){return new t(this)}},p=e+" Iterator",f=!1,v=r.prototype,m=v[zn]||v["@@iterator"]||n&&v[n],b=!rd&&m||c(n),y=e=="Array"&&v.entries||m,C,w,T;if(y&&(C=$g(y.call(new r)),C!==Object.prototype&&C.next&&(!td&&$g(C)!==Zg&&(Kg?Kg(C,Zg):px(C[zn])||$u(C,zn,eh)),gx(C,p,!0,!0),td&&(Xg[p]=eh))),yx&&n==Jn&&m&&m.name!==Jn&&(!td&&bx?hx(v,"name",Jn):(f=!0,b=function(){return mx(m,this)})),n)if(w={values:c(Jn),keys:o?b:c(Yg),entries:c(Qg)},a)for(T in w)(rd||f||!(T in v))&&$u(v,T,w[T]);else cx({target:e,proto:!0,forced:rd||f},w);return(!td||a)&&v[zn]!==b&&$u(v,zn,b,{name:n}),Xg[e]=b,w}});var Xu=h((QM,nh)=>{nh.exports=function(r,e){return{value:r,done:e}}});var dh=h(()=>{"use strict";var kx=tu().charAt,Sx=Nn(),oh=jr(),Px=Ku(),sh=Xu(),ah="String Iterator",Cx=oh.set,Ix=oh.getterFor(ah);Px(String,"String",function(r){Cx(this,{type:ah,string:Sx(r),index:0})},function(){var e=Ix(this),t=e.string,i=e.index,n;return i>=t.length?sh(void 0,!0):(n=kx(t,i),e.index+=n.length,sh(n,!1))})});var Zu=h((rL,lh)=>{var wx=ne(),xx=Pe(),Tx=_r(),Ax=xx("iterator");lh.exports=!wx(function(){var r=new URL("b?a=1&b=2&c=3","http://a"),e=r.searchParams,t="";return r.pathname="c%20d",e.forEach(function(i,n){e.delete("b"),t+=n+i}),Tx&&!r.toJSON||!e.sort||r.href!=="http://a/c%20d?a=1&c=3"||e.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!e[Ax]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("http://\u0442\u0435\u0441\u0442").host!=="xn--e1aybc"||new URL("http://a#\u0431").hash!=="#%D0%B1"||t!=="a1c3"||new URL("http://x",void 0).host!=="x"})});var ch=h((iL,uh)=>{var Ex=Da(),Rx=z();uh.exports=function(r){if(Ex(r)==="Function")return Rx(r)}});var id=h((nL,ph)=>{var mh=ch(),Ox=qa(),Fx=Ea(),Mx=mh(mh.bind);ph.exports=function(r,e){return Ox(r),e===void 0?r:Fx?Mx(r,e):function(){return r.apply(e,arguments)}}});var hh=h((sL,gh)=>{var fh=Ou(),Lx=Ke();gh.exports=function(r,e,t){return t.get&&fh(t.get,e,{getter:!0}),t.set&&fh(t.set,e,{setter:!0}),Lx.f(r,e,t)}});var Yu=h((oL,vh)=>{var Ux=au(),Bx=TypeError;vh.exports=function(r,e){if(Ux(e,r))return r;throw Bx("Incorrect invocation")}});var Sh=h((aL,kh)=>{"use strict";var yh=ue(),Dx=z(),_x=qe(),Nx=ne(),Qu=Du(),qx=Uu(),jx=ku(),Hx=Dn(),Wx=Pu(),Gr=Object.assign,bh=Object.defineProperty,Gx=Dx([].concat);kh.exports=!Gr||Nx(function(){if(yh&&Gr({b:1},Gr(bh({},"a",{enumerable:!0,get:function(){bh(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var r={},e={},t=Symbol(),i="abcdefghijklmnopqrst";return r[t]=7,i.split("").forEach(function(n){e[n]=n}),Gr({},r)[t]!=7||Qu(Gr({},e)).join("")!=i})?function(e,t){for(var i=Hx(e),n=arguments.length,o=1,a=qx.f,c=jx.f;n>o;)for(var p=Wx(arguments[o++]),f=a?Gx(Qu(p),a(p)):Qu(p),v=f.length,m=0,b;v>m;)b=f[m++],(!yh||_x(c,p,b))&&(i[b]=p[b]);return i}:Gr});var Ih=h((dL,Ch)=>{var Vx=qe(),Ph=$e(),zx=ja();Ch.exports=function(r,e,t){var i,n;Ph(r);try{if(i=zx(r,"return"),!i){if(e==="throw")throw t;return t}i=Vx(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Ph(i),t}});var xh=h((lL,wh)=>{var Jx=$e(),$x=Ih();wh.exports=function(r,e,t,i){try{return i?e(Jx(t)[0],t[1]):e(t)}catch(n){$x(r,"throw",n)}}});var Ah=h((uL,Th)=>{var Kx=Pe(),Xx=Wr(),Zx=Kx("iterator"),Yx=Array.prototype;Th.exports=function(r){return r!==void 0&&(Xx.Array===r||Yx[Zx]===r)}});var Lh=h((cL,Mh)=>{var Qx=z(),eT=ne(),Eh=J(),tT=_n(),rT=qn(),iT=Au(),Rh=function(){},nT=[],Oh=rT("Reflect","construct"),ec=/^\s*(?:class|function)\b/,sT=Qx(ec.exec),oT=!ec.exec(Rh),$n=function(e){if(!Eh(e))return!1;try{return Oh(Rh,nT,e),!0}catch{return!1}},Fh=function(e){if(!Eh(e))return!1;switch(tT(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return oT||!!sT(ec,iT(e))}catch{return!0}};Fh.sham=!0;Mh.exports=!Oh||eT(function(){var r;return $n($n.call)||!$n(Object)||!$n(function(){r=!0})||r})?Fh:$n});var tc=h((mL,Uh)=>{"use strict";var aT=Ha(),dT=Ke(),lT=qr();Uh.exports=function(r,e,t){var i=aT(e);i in r?dT.f(r,i,lT(0,t)):r[i]=t}});var nd=h((pL,Dh)=>{var uT=_n(),Bh=ja(),cT=La(),mT=Wr(),pT=Pe(),fT=pT("iterator");Dh.exports=function(r){if(!cT(r))return Bh(r,fT)||Bh(r,"@@iterator")||mT[uT(r)]}});var rc=h((fL,_h)=>{var gT=qe(),hT=qa(),vT=$e(),yT=lu(),bT=nd(),kT=TypeError;_h.exports=function(r,e){var t=arguments.length<2?bT(r):e;if(hT(t))return vT(gT(t,r));throw kT(yT(r)+" is not iterable")}});var Hh=h((gL,jh)=>{"use strict";var ST=id(),PT=qe(),CT=Dn(),IT=xh(),wT=Ah(),xT=Lh(),TT=Za(),Nh=tc(),AT=rc(),ET=nd(),qh=Array;jh.exports=function(e){var t=CT(e),i=xT(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=ST(o,n>2?arguments[2]:void 0));var c=ET(t),p=0,f,v,m,b,y,C;if(c&&!(this===qh&&wT(c)))for(b=AT(t,c),y=b.next,v=i?new this:[];!(m=PT(y,b)).done;p++)C=a?IT(b,o,[m.value,p],!0):m.value,Nh(v,p,C);else for(f=TT(t),v=i?new this(f):qh(f);f>p;p++)C=a?o(t[p],p):t[p],Nh(v,p,C);return v.length=p,v}});var ic=h((hL,Gh)=>{var Wh=Fu(),RT=Za(),OT=tc(),FT=Array,MT=Math.max;Gh.exports=function(r,e,t){for(var i=RT(r),n=Wh(e,i),o=Wh(t===void 0?i:t,i),a=FT(MT(o-n,0)),c=0;n<o;n++,c++)OT(a,c,r[n]);return a.length=c,a}});var Qh=h((vL,Yh)=>{var tr=z(),nc=2147483647,Kn=36,Kh=1,ac=26,LT=38,UT=700,BT=72,DT=128,_T="-",NT=/[^\0-\u007E]/,Xh=/[.\u3002\uFF0E\uFF61]/g,Vh="Overflow: input needs wider integers to process",sc=Kn-Kh,zh=RangeError,qT=tr(Xh.exec),Vr=Math.floor,oc=String.fromCharCode,Jh=tr("".charCodeAt),Zh=tr([].join),bt=tr([].push),jT=tr("".replace),HT=tr("".split),WT=tr("".toLowerCase),GT=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=Jh(r,t++);if(n>=55296&&n<=56319&&t<i){var o=Jh(r,t++);(o&64512)==56320?bt(e,((n&1023)<<10)+(o&1023)+65536):(bt(e,n),t--)}else bt(e,n)}return e},$h=function(r){return r+22+75*(r<26)},VT=function(r,e,t){var i=0;for(r=t?Vr(r/UT):r>>1,r+=Vr(r/e);r>sc*ac>>1;)r=Vr(r/sc),i+=Kn;return Vr(i+(sc+1)*r/(r+LT))},zT=function(r){var e=[];r=GT(r);var t=r.length,i=DT,n=0,o=BT,a,c;for(a=0;a<r.length;a++)c=r[a],c<128&&bt(e,oc(c));var p=e.length,f=p;for(p&&bt(e,_T);f<t;){var v=nc;for(a=0;a<r.length;a++)c=r[a],c>=i&&c<v&&(v=c);var m=f+1;if(v-i>Vr((nc-n)/m))throw zh(Vh);for(n+=(v-i)*m,i=v,a=0;a<r.length;a++){if(c=r[a],c<i&&++n>nc)throw zh(Vh);if(c==i){for(var b=n,y=Kn;;){var C=y<=o?Kh:y>=o+ac?ac:y-o;if(b<C)break;var w=b-C,T=Kn-C;bt(e,oc($h(C+w%T))),b=Vr(w/T),y+=Kn}bt(e,oc($h(b))),o=VT(n,m,f==p),n=0,f++}}n++,i++}return Zh(e,"")};Yh.exports=function(r){var e=[],t=HT(jT(WT(r),Xh,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],bt(e,qT(NT,n)?"xn--"+zT(n):n);return Zh(e,".")}});var dc=h((yL,ev)=>{var JT=TypeError;ev.exports=function(r,e){if(r<e)throw JT("Not enough arguments");return r}});var rv=h((bL,tv)=>{var $T=Pe(),KT=Gn(),XT=Ke().f,lc=$T("unscopables"),uc=Array.prototype;uc[lc]==null&&XT(uc,lc,{configurable:!0,value:KT(null)});tv.exports=function(r){uc[lc][r]=!0}});var dv=h((kL,av)=>{"use strict";var ZT=Hr(),cc=rv(),iv=Wr(),sv=jr(),YT=Ke().f,QT=Ku(),sd=Xu(),eA=_r(),tA=ue(),ov="Array Iterator",rA=sv.set,iA=sv.getterFor(ov);av.exports=QT(Array,"Array",function(r,e){rA(this,{type:ov,target:ZT(r),index:0,kind:e})},function(){var r=iA(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,sd(void 0,!0)):t=="keys"?sd(i,!1):t=="values"?sd(e[i],!1):sd([i,e[i]],!1)},"values");var nv=iv.Arguments=iv.Array;cc("keys");cc("values");cc("entries");if(!eA&&tA&&nv.name!=="values")try{YT(nv,"name",{value:"values"})}catch{}});var uv=h((SL,lv)=>{var nA=er();lv.exports=function(r,e,t){for(var i in e)nA(r,i,e[i],t);return r}});var pv=h((PL,mv)=>{var cv=ic(),sA=Math.floor,mc=function(r,e){var t=r.length,i=sA(t/2);return t<8?oA(r,e):aA(r,mc(cv(r,0,i),e),mc(cv(r,i),e),e)},oA=function(r,e){for(var t=r.length,i=1,n,o;i<t;){for(o=i,n=r[i];o&&e(r[o-1],n)>0;)r[o]=r[--o];o!==i++&&(r[o]=n)}return r},aA=function(r,e,t,i){for(var n=e.length,o=t.length,a=0,c=0;a<n||c<o;)r[a+c]=a<n&&c<o?i(e[a],t[c])<=0?e[a++]:t[c++]:a<n?e[a++]:t[c++];return r};mv.exports=mc});var Pc=h((CL,Mv)=>{"use strict";dv();var vc=Wn(),Jr=le(),od=qe(),Xe=z(),dA=ue(),wv=Zu(),xv=er(),lA=uv(),uA=Vn(),cA=Ju(),kc=jr(),Tv=Yu(),pc=J(),mA=Se(),pA=id(),fA=_n(),gA=$e(),Av=yt(),ce=Nn(),hA=Gn(),fv=qr(),yc=rc(),vA=nd(),zr=dc(),yA=Pe(),bA=pv(),kA=yA("iterator"),Yn="URLSearchParams",Ev=Yn+"Iterator",Rv=kc.set,He=kc.getterFor(Yn),SA=kc.getterFor(Ev),PA=Object.getOwnPropertyDescriptor,Sc=function(r){if(!dA)return Jr[r];var e=PA(Jr,r);return e&&e.value},gv=Sc("fetch"),dd=Sc("Request"),Xn=Sc("Headers"),fc=dd&&dd.prototype,hv=Xn&&Xn.prototype,CA=Jr.RegExp,IA=Jr.TypeError,Ov=Jr.decodeURIComponent,wA=Jr.encodeURIComponent,xA=Xe("".charAt),vv=Xe([].join),rr=Xe([].push),bc=Xe("".replace),TA=Xe([].shift),yv=Xe([].splice),bv=Xe("".split),AA=Xe("".slice),EA=/\+/g,kv=Array(4),RA=function(r){return kv[r-1]||(kv[r-1]=CA("((?:%[\\da-f]{2}){"+r+"})","gi"))},OA=function(r){try{return Ov(r)}catch{return r}},Sv=function(r){var e=bc(r,EA," "),t=4;try{return Ov(e)}catch{for(;t;)e=bc(e,RA(t--),OA);return e}},FA=/[!'()~]|%20/g,MA={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},LA=function(r){return MA[r]},Pv=function(r){return bc(wA(r),FA,LA)},gc=cA(function(e,t){Rv(this,{type:Ev,iterator:yc(He(e).entries),kind:t})},"Iterator",function(){var e=SA(this),t=e.kind,i=e.iterator.next(),n=i.value;return i.done||(i.value=t==="keys"?n.key:t==="values"?n.value:[n.key,n.value]),i},!0),Fv=function(r){this.entries=[],this.url=null,r!==void 0&&(Av(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?xA(r,0)==="?"?AA(r,1):r:ce(r)))};Fv.prototype={type:Yn,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=vA(r),t,i,n,o,a,c,p;if(e)for(t=yc(r,e),i=t.next;!(n=od(i,t)).done;){if(o=yc(gA(n.value)),a=o.next,(c=od(a,o)).done||(p=od(a,o)).done||!od(a,o).done)throw IA("Expected sequence with length 2");rr(this.entries,{key:ce(c.value),value:ce(p.value)})}else for(var f in r)mA(r,f)&&rr(this.entries,{key:f,value:ce(r[f])})},parseQuery:function(r){if(r)for(var e=bv(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=bv(i,"="),rr(this.entries,{key:Sv(TA(n)),value:Sv(vv(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],rr(e,Pv(i.key)+"="+Pv(i.value));return vv(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var ld=function(){Tv(this,Zn);var e=arguments.length>0?arguments[0]:void 0;Rv(this,new Fv(e))},Zn=ld.prototype;lA(Zn,{append:function(e,t){zr(arguments.length,2);var i=He(this);rr(i.entries,{key:ce(e),value:ce(t)}),i.updateURL()},delete:function(r){zr(arguments.length,1);for(var e=He(this),t=e.entries,i=ce(r),n=0;n<t.length;)t[n].key===i?yv(t,n,1):n++;e.updateURL()},get:function(e){zr(arguments.length,1);for(var t=He(this).entries,i=ce(e),n=0;n<t.length;n++)if(t[n].key===i)return t[n].value;return null},getAll:function(e){zr(arguments.length,1);for(var t=He(this).entries,i=ce(e),n=[],o=0;o<t.length;o++)t[o].key===i&&rr(n,t[o].value);return n},has:function(e){zr(arguments.length,1);for(var t=He(this).entries,i=ce(e),n=0;n<t.length;)if(t[n++].key===i)return!0;return!1},set:function(e,t){zr(arguments.length,1);for(var i=He(this),n=i.entries,o=!1,a=ce(e),c=ce(t),p=0,f;p<n.length;p++)f=n[p],f.key===a&&(o?yv(n,p--,1):(o=!0,f.value=c));o||rr(n,{key:a,value:c}),i.updateURL()},sort:function(){var e=He(this);bA(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=He(this).entries,i=pA(e,arguments.length>1?arguments[1]:void 0),n=0,o;n<t.length;)o=t[n++],i(o.value,o.key,this)},keys:function(){return new gc(this,"keys")},values:function(){return new gc(this,"values")},entries:function(){return new gc(this,"entries")}},{enumerable:!0});xv(Zn,kA,Zn.entries,{name:"entries"});xv(Zn,"toString",function(){return He(this).serialize()},{enumerable:!0});uA(ld,Yn);vc({global:!0,constructor:!0,forced:!wv},{URLSearchParams:ld});!wv&&pc(Xn)&&(Cv=Xe(hv.has),Iv=Xe(hv.set),hc=function(r){if(Av(r)){var e=r.body,t;if(fA(e)===Yn)return t=r.headers?new Xn(r.headers):new Xn,Cv(t,"content-type")||Iv(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),hA(r,{body:fv(0,ce(e)),headers:fv(0,t)})}return r},pc(gv)&&vc({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return gv(e,arguments.length>1?hc(arguments[1]):{})}}),pc(dd)&&(ad=function(e){return Tv(this,fc),new dd(e,arguments.length>1?hc(arguments[1]):{})},fc.constructor=ad,ad.prototype=fc,vc({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:ad})));var Cv,Iv,hc,ad;Mv.exports={URLSearchParams:ld,getState:He}});var Yv=h(()=>{"use strict";dh();var UA=Wn(),_c=ue(),BA=Zu(),Nc=le(),Lv=id(),Te=z(),fd=er(),Ce=hh(),DA=Yu(),Uc=Se(),qc=Sh(),$r=Hh(),We=ic(),_A=tu().codeAt,NA=Qh(),st=Nn(),qA=Vn(),jA=dc(),zv=Pc(),Jv=jr(),HA=Jv.set,gd=Jv.getterFor("URL"),WA=zv.URLSearchParams,GA=zv.getState,Qn=Nc.URL,Bc=Nc.TypeError,hd=Nc.parseInt,VA=Math.floor,Uv=Math.pow,xe=Te("".charAt),Ge=Te(/./.exec),ts=Te([].join),zA=Te(1 .toString),JA=Te([].pop),Xr=Te([].push),Bv=Te("".replace),$A=Te([].shift),KA=Te("".split),is=Te("".slice),vd=Te("".toLowerCase),XA=Te([].unshift),ZA="Invalid authority",Cc="Invalid scheme",ir="Invalid host",Dv="Invalid port",$v=/[a-z]/i,YA=/[\d+-.a-z]/i,Dc=/\d/,QA=/^0x/i,e0=/^[0-7]+$/,t0=/^\d+$/,Kv=/^[\da-f]+$/i,r0=/[\0\t\n\r #%/:<>?@[\\\]^|]/,i0=/[\0\t\n\r #/:<>?@[\\\]^|]/,n0=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,s0=/[\t\n\r]/g,Ie,o0=function(r){var e=KA(r,"."),t,i,n,o,a,c,p;if(e.length&&e[e.length-1]==""&&e.length--,t=e.length,t>4)return r;for(i=[],n=0;n<t;n++){if(o=e[n],o=="")return r;if(a=10,o.length>1&&xe(o,0)=="0"&&(a=Ge(QA,o)?16:8,o=is(o,a==8?1:2)),o==="")c=0;else{if(!Ge(a==10?t0:a==8?e0:Kv,o))return r;c=hd(o,a)}Xr(i,c)}for(n=0;n<t;n++)if(c=i[n],n==t-1){if(c>=Uv(256,5-t))return null}else if(c>255)return null;for(p=JA(i),n=0;n<i.length;n++)p+=i[n]*Uv(256,3-n);return p},a0=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,c,p,f,v,m,b=function(){return xe(r,n)};if(b()==":"){if(xe(r,1)!=":")return;n+=2,t++,i=t}for(;b();){if(t==8)return;if(b()==":"){if(i!==null)return;n++,t++,i=t;continue}for(o=a=0;a<4&&Ge(Kv,b());)o=o*16+hd(b(),16),n++,a++;if(b()=="."){if(a==0||(n-=a,t>6))return;for(c=0;b();){if(p=null,c>0)if(b()=="."&&c<4)n++;else return;if(!Ge(Dc,b()))return;for(;Ge(Dc,b());){if(f=hd(b(),10),p===null)p=f;else{if(p==0)return;p=p*10+f}if(p>255)return;n++}e[t]=e[t]*256+p,c++,(c==2||c==4)&&t++}if(c!=4)return;break}else if(b()==":"){if(n++,!b())return}else if(b())return;e[t++]=o}if(i!==null)for(v=t-i,t=7;t!=0&&v>0;)m=e[t],e[t--]=e[i+v-1],e[i+--v]=m;else if(t!=8)return;return e},d0=function(r){for(var e=null,t=1,i=null,n=0,o=0;o<8;o++)r[o]!==0?(n>t&&(e=i,t=n),i=null,n=0):(i===null&&(i=o),++n);return n>t&&(e=i,t=n),e},es=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)XA(e,r%256),r=VA(r/256);return ts(e,".")}else if(typeof r=="object"){for(e="",i=d0(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=zA(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},pd={},Xv=qc({},pd,{" ":1,'"':1,"<":1,">":1,"`":1}),Zv=qc({},Xv,{"#":1,"?":1,"{":1,"}":1}),Ic=qc({},Zv,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),kt=function(r,e){var t=_A(r,0);return t>32&&t<127&&!Uc(e,r)?r:encodeURIComponent(r)},ud={ftp:21,file:null,http:80,https:443,ws:80,wss:443},rs=function(r,e){var t;return r.length==2&&Ge($v,xe(r,0))&&((t=xe(r,1))==":"||!e&&t=="|")},_v=function(r){var e;return r.length>1&&rs(is(r,0,2))&&(r.length==2||(e=xe(r,2))==="/"||e==="\\"||e==="?"||e==="#")},l0=function(r){return r==="."||vd(r)==="%2e"},u0=function(r){return r=vd(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},wc={},Nv={},xc={},qv={},jv={},Tc={},Hv={},Wv={},cd={},md={},Ac={},Ec={},Rc={},Oc={},Gv={},Fc={},Kr={},Ze={},Vv={},nr={},nt={},jc=function(r,e,t){var i=st(r),n,o,a;if(e){if(o=this.parse(i),o)throw Bc(o);this.searchParams=null}else{if(t!==void 0&&(n=new jc(t,!0)),o=this.parse(i,null,n),o)throw Bc(o);a=GA(new WA),a.bindURL(this),this.searchParams=a}};jc.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||wc,o=0,a="",c=!1,p=!1,f=!1,v,m,b,y;for(r=st(r),e||(i.scheme="",i.username="",i.password="",i.host=null,i.port=null,i.path=[],i.query=null,i.fragment=null,i.cannotBeABaseURL=!1,r=Bv(r,n0,"")),r=Bv(r,s0,""),v=$r(r);o<=v.length;){switch(m=v[o],n){case wc:if(m&&Ge($v,m))a+=vd(m),n=Nv;else{if(e)return Cc;n=xc;continue}break;case Nv:if(m&&(Ge(YA,m)||m=="+"||m=="-"||m=="."))a+=vd(m);else if(m==":"){if(e&&(i.isSpecial()!=Uc(ud,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&ud[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=Oc:i.isSpecial()&&t&&t.scheme==i.scheme?n=qv:i.isSpecial()?n=Wv:v[o+1]=="/"?(n=jv,o++):(i.cannotBeABaseURL=!0,Xr(i.path,""),n=Vv)}else{if(e)return Cc;a="",n=xc,o=0;continue}break;case xc:if(!t||t.cannotBeABaseURL&&m!="#")return Cc;if(t.cannotBeABaseURL&&m=="#"){i.scheme=t.scheme,i.path=We(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=nt;break}n=t.scheme=="file"?Oc:Tc;continue;case qv:if(m=="/"&&v[o+1]=="/")n=cd,o++;else{n=Tc;continue}break;case jv:if(m=="/"){n=md;break}else{n=Ze;continue}case Tc:if(i.scheme=t.scheme,m==Ie)i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=We(t.path),i.query=t.query;else if(m=="/"||m=="\\"&&i.isSpecial())n=Hv;else if(m=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=We(t.path),i.query="",n=nr;else if(m=="#")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=We(t.path),i.query=t.query,i.fragment="",n=nt;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=We(t.path),i.path.length--,n=Ze;continue}break;case Hv:if(i.isSpecial()&&(m=="/"||m=="\\"))n=cd;else if(m=="/")n=md;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=Ze;continue}break;case Wv:if(n=cd,m!="/"||xe(a,o+1)!="/")continue;o++;break;case cd:if(m!="/"&&m!="\\"){n=md;continue}break;case md:if(m=="@"){c&&(a="%40"+a),c=!0,b=$r(a);for(var C=0;C<b.length;C++){var w=b[C];if(w==":"&&!f){f=!0;continue}var T=kt(w,Ic);f?i.password+=T:i.username+=T}a=""}else if(m==Ie||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(c&&a=="")return ZA;o-=$r(a).length+1,a="",n=Ac}else a+=m;break;case Ac:case Ec:if(e&&i.scheme=="file"){n=Fc;continue}else if(m==":"&&!p){if(a=="")return ir;if(y=i.parseHost(a),y)return y;if(a="",n=Rc,e==Ec)return}else if(m==Ie||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(i.isSpecial()&&a=="")return ir;if(e&&a==""&&(i.includesCredentials()||i.port!==null))return;if(y=i.parseHost(a),y)return y;if(a="",n=Kr,e)return;continue}else m=="["?p=!0:m=="]"&&(p=!1),a+=m;break;case Rc:if(Ge(Dc,m))a+=m;else if(m==Ie||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()||e){if(a!=""){var F=hd(a,10);if(F>65535)return Dv;i.port=i.isSpecial()&&F===ud[i.scheme]?null:F,a=""}if(e)return;n=Kr;continue}else return Dv;break;case Oc:if(i.scheme="file",m=="/"||m=="\\")n=Gv;else if(t&&t.scheme=="file")if(m==Ie)i.host=t.host,i.path=We(t.path),i.query=t.query;else if(m=="?")i.host=t.host,i.path=We(t.path),i.query="",n=nr;else if(m=="#")i.host=t.host,i.path=We(t.path),i.query=t.query,i.fragment="",n=nt;else{_v(ts(We(v,o),""))||(i.host=t.host,i.path=We(t.path),i.shortenPath()),n=Ze;continue}else{n=Ze;continue}break;case Gv:if(m=="/"||m=="\\"){n=Fc;break}t&&t.scheme=="file"&&!_v(ts(We(v,o),""))&&(rs(t.path[0],!0)?Xr(i.path,t.path[0]):i.host=t.host),n=Ze;continue;case Fc:if(m==Ie||m=="/"||m=="\\"||m=="?"||m=="#"){if(!e&&rs(a))n=Ze;else if(a==""){if(i.host="",e)return;n=Kr}else{if(y=i.parseHost(a),y)return y;if(i.host=="localhost"&&(i.host=""),e)return;a="",n=Kr}continue}else a+=m;break;case Kr:if(i.isSpecial()){if(n=Ze,m!="/"&&m!="\\")continue}else if(!e&&m=="?")i.query="",n=nr;else if(!e&&m=="#")i.fragment="",n=nt;else if(m!=Ie&&(n=Ze,m!="/"))continue;break;case Ze:if(m==Ie||m=="/"||m=="\\"&&i.isSpecial()||!e&&(m=="?"||m=="#")){if(u0(a)?(i.shortenPath(),m!="/"&&!(m=="\\"&&i.isSpecial())&&Xr(i.path,"")):l0(a)?m!="/"&&!(m=="\\"&&i.isSpecial())&&Xr(i.path,""):(i.scheme=="file"&&!i.path.length&&rs(a)&&(i.host&&(i.host=""),a=xe(a,0)+":"),Xr(i.path,a)),a="",i.scheme=="file"&&(m==Ie||m=="?"||m=="#"))for(;i.path.length>1&&i.path[0]==="";)$A(i.path);m=="?"?(i.query="",n=nr):m=="#"&&(i.fragment="",n=nt)}else a+=kt(m,Zv);break;case Vv:m=="?"?(i.query="",n=nr):m=="#"?(i.fragment="",n=nt):m!=Ie&&(i.path[0]+=kt(m,pd));break;case nr:!e&&m=="#"?(i.fragment="",n=nt):m!=Ie&&(m=="'"&&i.isSpecial()?i.query+="%27":m=="#"?i.query+="%23":i.query+=kt(m,pd));break;case nt:m!=Ie&&(i.fragment+=kt(m,Xv));break}o++}},parseHost:function(r){var e,t,i;if(xe(r,0)=="["){if(xe(r,r.length-1)!="]"||(e=a0(is(r,1,-1)),!e))return ir;this.host=e}else if(this.isSpecial()){if(r=NA(r),Ge(r0,r)||(e=o0(r),e===null))return ir;this.host=e}else{if(Ge(i0,r))return ir;for(e="",t=$r(r),i=0;i<t.length;i++)e+=kt(t[i],pd);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return Uc(ud,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!rs(r[0],!0))&&r.length--},serialize:function(){var r=this,e=r.scheme,t=r.username,i=r.password,n=r.host,o=r.port,a=r.path,c=r.query,p=r.fragment,f=e+":";return n!==null?(f+="//",r.includesCredentials()&&(f+=t+(i?":"+i:"")+"@"),f+=es(n),o!==null&&(f+=":"+o)):e=="file"&&(f+="//"),f+=r.cannotBeABaseURL?a[0]:a.length?"/"+ts(a,"/"):"",c!==null&&(f+="?"+c),p!==null&&(f+="#"+p),f},setHref:function(r){var e=this.parse(r);if(e)throw Bc(e);this.searchParams.update()},getOrigin:function(){var r=this.scheme,e=this.port;if(r=="blob")try{return new Zr(r.path[0]).origin}catch{return"null"}return r=="file"||!this.isSpecial()?"null":r+"://"+es(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(st(r)+":",wc)},getUsername:function(){return this.username},setUsername:function(r){var e=$r(st(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=kt(e[t],Ic)}},getPassword:function(){return this.password},setPassword:function(r){var e=$r(st(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=kt(e[t],Ic)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?es(r):es(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,Ac)},getHostname:function(){var r=this.host;return r===null?"":es(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,Ec)},getPort:function(){var r=this.port;return r===null?"":st(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=st(r),r==""?this.port=null:this.parse(r,Rc))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+ts(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,Kr))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=st(r),r==""?this.query=null:(xe(r,0)=="?"&&(r=is(r,1)),this.query="",this.parse(r,nr)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var r=this.fragment;return r?"#"+r:""},setHash:function(r){if(r=st(r),r==""){this.fragment=null;return}xe(r,0)=="#"&&(r=is(r,1)),this.fragment="",this.parse(r,nt)},update:function(){this.query=this.searchParams.serialize()||null}};var Zr=function(e){var t=DA(this,Y),i=jA(arguments.length,1)>1?arguments[1]:void 0,n=HA(t,new jc(e,!1,i));_c||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},Y=Zr.prototype,we=function(r,e){return{get:function(){return gd(this)[r]()},set:e&&function(t){return gd(this)[e](t)},configurable:!0,enumerable:!0}};_c&&(Ce(Y,"href",we("serialize","setHref")),Ce(Y,"origin",we("getOrigin")),Ce(Y,"protocol",we("getProtocol","setProtocol")),Ce(Y,"username",we("getUsername","setUsername")),Ce(Y,"password",we("getPassword","setPassword")),Ce(Y,"host",we("getHost","setHost")),Ce(Y,"hostname",we("getHostname","setHostname")),Ce(Y,"port",we("getPort","setPort")),Ce(Y,"pathname",we("getPathname","setPathname")),Ce(Y,"search",we("getSearch","setSearch")),Ce(Y,"searchParams",we("getSearchParams")),Ce(Y,"hash",we("getHash","setHash")));fd(Y,"toJSON",function(){return gd(this).serialize()},{enumerable:!0});fd(Y,"toString",function(){return gd(this).serialize()},{enumerable:!0});Qn&&(Mc=Qn.createObjectURL,Lc=Qn.revokeObjectURL,Mc&&fd(Zr,"createObjectURL",Lv(Mc,Qn)),Lc&&fd(Zr,"revokeObjectURL",Lv(Lc,Qn)));var Mc,Lc;qA(Zr,"URL");UA({global:!0,constructor:!0,forced:!BA,sham:!_c},{URL:Zr})});var Qv=h(()=>{Yv()});var ey=h(()=>{"use strict";var c0=Wn(),m0=qe();c0({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return m0(URL.prototype.toString,this)}})});var ty=h(()=>{Pc()});var iy=h((FL,ry)=>{var p0=le();ry.exports=p0});var sy=h((ML,ny)=>{Qv();ey();ty();var f0=iy();ny.exports=f0.URL});var gm=h((i_,fb)=>{var TE=Object.prototype.toString;fb.exports=function(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;if(t==="boolean")return"boolean";if(t==="string")return"string";if(t==="number")return"number";if(t==="symbol")return"symbol";if(t==="function")return FE(e)?"generatorfunction":"function";if(AE(e))return"array";if(UE(e))return"buffer";if(LE(e))return"arguments";if(RE(e))return"date";if(EE(e))return"error";if(OE(e))return"regexp";switch(pb(e)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(ME(e))return"generator";switch(t=TE.call(e),t){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")};function pb(r){return typeof r.constructor=="function"?r.constructor.name:null}function AE(r){return Array.isArray?Array.isArray(r):r instanceof Array}function EE(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function RE(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function OE(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function FE(r,e){return pb(r)==="GeneratorFunction"}function ME(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function LE(r){try{if(typeof r.length=="number"&&typeof r.callee=="function")return!0}catch(e){if(e.message.indexOf("callee")!==-1)return!0}return!1}function UE(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var vb=h((n_,hb)=>{"use strict";var gb=Symbol.prototype.valueOf,BE=gm();function DE(r,e){switch(BE(r)){case"array":return r.slice();case"object":return Object.assign({},r);case"date":return new r.constructor(Number(r));case"map":return new Map(r);case"set":return new Set(r);case"buffer":return jE(r);case"symbol":return HE(r);case"arraybuffer":return NE(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return qE(r);case"regexp":return _E(r);case"error":return Object.create(r);default:return r}}function _E(r){let e=r.flags!==void 0?r.flags:/\w+$/.exec(r)||void 0,t=new r.constructor(r.source,e);return t.lastIndex=r.lastIndex,t}function NE(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function qE(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function jE(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function HE(r){return gb?Object(gb.call(r)):{}}hb.exports=DE});var bb=h((s_,yb)=>{"use strict";yb.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var Pb=h((o_,Sb)=>{"use strict";var WE=bb();function kb(r){return WE(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}Sb.exports=function(e){var t,i;return!(kb(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,kb(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var Ib=h((a_,Cb)=>{"use strict";var GE=vb(),VE=gm(),zE=Pb();function hm(r,e){switch(VE(r)){case"object":return JE(r,e);case"array":return $E(r,e);default:return GE(r)}}function JE(r,e){if(typeof e=="function")return e(r);if(e||zE(r)){let t=new r.constructor;for(let i in r)t[i]=hm(r[i],e);return t}return r}function $E(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=hm(r[i],e);return t}Cb.exports=hm});var Am=h((ys,Si)=>{var KE=200,Tm="__lodash_hash_undefined__",Xd=1,Bb=2,Db=9007199254740991,Wd="[object Arguments]",km="[object Array]",XE="[object AsyncFunction]",_b="[object Boolean]",Nb="[object Date]",qb="[object Error]",jb="[object Function]",ZE="[object GeneratorFunction]",Gd="[object Map]",Hb="[object Number]",YE="[object Null]",ki="[object Object]",wb="[object Promise]",QE="[object Proxy]",Wb="[object RegExp]",Vd="[object Set]",Gb="[object String]",eR="[object Symbol]",tR="[object Undefined]",Sm="[object WeakMap]",Vb="[object ArrayBuffer]",zd="[object DataView]",rR="[object Float32Array]",iR="[object Float64Array]",nR="[object Int8Array]",sR="[object Int16Array]",oR="[object Int32Array]",aR="[object Uint8Array]",dR="[object Uint8ClampedArray]",lR="[object Uint16Array]",uR="[object Uint32Array]",cR=/[\\^$.*+?()[\]{}|]/g,mR=/^\[object .+?Constructor\]$/,pR=/^(?:0|[1-9]\d*)$/,q={};q[rR]=q[iR]=q[nR]=q[sR]=q[oR]=q[aR]=q[dR]=q[lR]=q[uR]=!0;q[Wd]=q[km]=q[Vb]=q[_b]=q[zd]=q[Nb]=q[qb]=q[jb]=q[Gd]=q[Hb]=q[ki]=q[Wb]=q[Vd]=q[Gb]=q[Sm]=!1;var zb=typeof global=="object"&&global&&global.Object===Object&&global,fR=typeof self=="object"&&self&&self.Object===Object&&self,lt=zb||fR||Function("return this")(),Jb=typeof ys=="object"&&ys&&!ys.nodeType&&ys,xb=Jb&&typeof Si=="object"&&Si&&!Si.nodeType&&Si,$b=xb&&xb.exports===Jb,vm=$b&&zb.process,Tb=function(){try{return vm&&vm.binding&&vm.binding("util")}catch{}}(),Ab=Tb&&Tb.isTypedArray;function gR(r,e){for(var t=-1,i=r==null?0:r.length,n=0,o=[];++t<i;){var a=r[t];e(a,t,r)&&(o[n++]=a)}return o}function hR(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function vR(r,e){for(var t=-1,i=r==null?0:r.length;++t<i;)if(e(r[t],t,r))return!0;return!1}function yR(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function bR(r){return function(e){return r(e)}}function kR(r,e){return r.has(e)}function SR(r,e){return r?.[e]}function PR(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function CR(r,e){return function(t){return r(e(t))}}function IR(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var wR=Array.prototype,xR=Function.prototype,Zd=Object.prototype,ym=lt["__core-js_shared__"],Kb=xR.toString,Ye=Zd.hasOwnProperty,Eb=function(){var r=/[^.]+$/.exec(ym&&ym.keys&&ym.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Xb=Zd.toString,TR=RegExp("^"+Kb.call(Ye).replace(cR,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Rb=$b?lt.Buffer:void 0,Jd=lt.Symbol,Ob=lt.Uint8Array,Zb=Zd.propertyIsEnumerable,AR=wR.splice,fr=Jd?Jd.toStringTag:void 0,Fb=Object.getOwnPropertySymbols,ER=Rb?Rb.isBuffer:void 0,RR=CR(Object.keys,Object),Pm=Pi(lt,"DataView"),bs=Pi(lt,"Map"),Cm=Pi(lt,"Promise"),Im=Pi(lt,"Set"),wm=Pi(lt,"WeakMap"),ks=Pi(Object,"create"),OR=vr(Pm),FR=vr(bs),MR=vr(Cm),LR=vr(Im),UR=vr(wm),Mb=Jd?Jd.prototype:void 0,bm=Mb?Mb.valueOf:void 0;function gr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function BR(){this.__data__=ks?ks(null):{},this.size=0}function DR(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function _R(r){var e=this.__data__;if(ks){var t=e[r];return t===Tm?void 0:t}return Ye.call(e,r)?e[r]:void 0}function NR(r){var e=this.__data__;return ks?e[r]!==void 0:Ye.call(e,r)}function qR(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=ks&&e===void 0?Tm:e,this}gr.prototype.clear=BR;gr.prototype.delete=DR;gr.prototype.get=_R;gr.prototype.has=NR;gr.prototype.set=qR;function ut(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function jR(){this.__data__=[],this.size=0}function HR(r){var e=this.__data__,t=Yd(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():AR.call(e,t,1),--this.size,!0}function WR(r){var e=this.__data__,t=Yd(e,r);return t<0?void 0:e[t][1]}function GR(r){return Yd(this.__data__,r)>-1}function VR(r,e){var t=this.__data__,i=Yd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}ut.prototype.clear=jR;ut.prototype.delete=HR;ut.prototype.get=WR;ut.prototype.has=GR;ut.prototype.set=VR;function hr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function zR(){this.size=0,this.__data__={hash:new gr,map:new(bs||ut),string:new gr}}function JR(r){var e=Qd(this,r).delete(r);return this.size-=e?1:0,e}function $R(r){return Qd(this,r).get(r)}function KR(r){return Qd(this,r).has(r)}function XR(r,e){var t=Qd(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}hr.prototype.clear=zR;hr.prototype.delete=JR;hr.prototype.get=$R;hr.prototype.has=KR;hr.prototype.set=XR;function $d(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new hr;++e<t;)this.add(r[e])}function ZR(r){return this.__data__.set(r,Tm),this}function YR(r){return this.__data__.has(r)}$d.prototype.add=$d.prototype.push=ZR;$d.prototype.has=YR;function Rt(r){var e=this.__data__=new ut(r);this.size=e.size}function QR(){this.__data__=new ut,this.size=0}function eO(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function tO(r){return this.__data__.get(r)}function rO(r){return this.__data__.has(r)}function iO(r,e){var t=this.__data__;if(t instanceof ut){var i=t.__data__;if(!bs||i.length<KE-1)return i.push([r,e]),this.size=++t.size,this;t=this.__data__=new hr(i)}return t.set(r,e),this.size=t.size,this}Rt.prototype.clear=QR;Rt.prototype.delete=eO;Rt.prototype.get=tO;Rt.prototype.has=rO;Rt.prototype.set=iO;function nO(r,e){var t=Kd(r),i=!t&&bO(r),n=!t&&!i&&xm(r),o=!t&&!i&&!n&&nk(r),a=t||i||n||o,c=a?yR(r.length,String):[],p=c.length;for(var f in r)(e||Ye.call(r,f))&&!(a&&(f=="length"||n&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||fO(f,p)))&&c.push(f);return c}function Yd(r,e){for(var t=r.length;t--;)if(ek(r[t][0],e))return t;return-1}function sO(r,e,t){var i=e(r);return Kd(r)?i:hR(i,t(r))}function Ps(r){return r==null?r===void 0?tR:YE:fr&&fr in Object(r)?mO(r):yO(r)}function Lb(r){return Ss(r)&&Ps(r)==Wd}function Yb(r,e,t,i,n){return r===e?!0:r==null||e==null||!Ss(r)&&!Ss(e)?r!==r&&e!==e:oO(r,e,t,i,Yb,n)}function oO(r,e,t,i,n,o){var a=Kd(r),c=Kd(e),p=a?km:Et(r),f=c?km:Et(e);p=p==Wd?ki:p,f=f==Wd?ki:f;var v=p==ki,m=f==ki,b=p==f;if(b&&xm(r)){if(!xm(e))return!1;a=!0,v=!1}if(b&&!v)return o||(o=new Rt),a||nk(r)?Qb(r,e,t,i,n,o):uO(r,e,p,t,i,n,o);if(!(t&Xd)){var y=v&&Ye.call(r,"__wrapped__"),C=m&&Ye.call(e,"__wrapped__");if(y||C){var w=y?r.value():r,T=C?e.value():e;return o||(o=new Rt),n(w,T,t,i,o)}}return b?(o||(o=new Rt),cO(r,e,t,i,n,o)):!1}function aO(r){if(!ik(r)||hO(r))return!1;var e=tk(r)?TR:mR;return e.test(vr(r))}function dO(r){return Ss(r)&&rk(r.length)&&!!q[Ps(r)]}function lO(r){if(!vO(r))return RR(r);var e=[];for(var t in Object(r))Ye.call(r,t)&&t!="constructor"&&e.push(t);return e}function Qb(r,e,t,i,n,o){var a=t&Xd,c=r.length,p=e.length;if(c!=p&&!(a&&p>c))return!1;var f=o.get(r);if(f&&o.get(e))return f==e;var v=-1,m=!0,b=t&Bb?new $d:void 0;for(o.set(r,e),o.set(e,r);++v<c;){var y=r[v],C=e[v];if(i)var w=a?i(C,y,v,e,r,o):i(y,C,v,r,e,o);if(w!==void 0){if(w)continue;m=!1;break}if(b){if(!vR(e,function(T,F){if(!kR(b,F)&&(y===T||n(y,T,t,i,o)))return b.push(F)})){m=!1;break}}else if(!(y===C||n(y,C,t,i,o))){m=!1;break}}return o.delete(r),o.delete(e),m}function uO(r,e,t,i,n,o,a){switch(t){case zd:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case Vb:return!(r.byteLength!=e.byteLength||!o(new Ob(r),new Ob(e)));case _b:case Nb:case Hb:return ek(+r,+e);case qb:return r.name==e.name&&r.message==e.message;case Wb:case Gb:return r==e+"";case Gd:var c=PR;case Vd:var p=i&Xd;if(c||(c=IR),r.size!=e.size&&!p)return!1;var f=a.get(r);if(f)return f==e;i|=Bb,a.set(r,e);var v=Qb(c(r),c(e),i,n,o,a);return a.delete(r),v;case eR:if(bm)return bm.call(r)==bm.call(e)}return!1}function cO(r,e,t,i,n,o){var a=t&Xd,c=Ub(r),p=c.length,f=Ub(e),v=f.length;if(p!=v&&!a)return!1;for(var m=p;m--;){var b=c[m];if(!(a?b in e:Ye.call(e,b)))return!1}var y=o.get(r);if(y&&o.get(e))return y==e;var C=!0;o.set(r,e),o.set(e,r);for(var w=a;++m<p;){b=c[m];var T=r[b],F=e[b];if(i)var de=a?i(F,T,b,e,r,o):i(T,F,b,r,e,o);if(!(de===void 0?T===F||n(T,F,t,i,o):de)){C=!1;break}w||(w=b=="constructor")}if(C&&!w){var Un=r.constructor,Aa=e.constructor;Un!=Aa&&"constructor"in r&&"constructor"in e&&!(typeof Un=="function"&&Un instanceof Un&&typeof Aa=="function"&&Aa instanceof Aa)&&(C=!1)}return o.delete(r),o.delete(e),C}function Ub(r){return sO(r,PO,pO)}function Qd(r,e){var t=r.__data__;return gO(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Pi(r,e){var t=SR(r,e);return aO(t)?t:void 0}function mO(r){var e=Ye.call(r,fr),t=r[fr];try{r[fr]=void 0;var i=!0}catch{}var n=Xb.call(r);return i&&(e?r[fr]=t:delete r[fr]),n}var pO=Fb?function(r){return r==null?[]:(r=Object(r),gR(Fb(r),function(e){return Zb.call(r,e)}))}:CO,Et=Ps;(Pm&&Et(new Pm(new ArrayBuffer(1)))!=zd||bs&&Et(new bs)!=Gd||Cm&&Et(Cm.resolve())!=wb||Im&&Et(new Im)!=Vd||wm&&Et(new wm)!=Sm)&&(Et=function(r){var e=Ps(r),t=e==ki?r.constructor:void 0,i=t?vr(t):"";if(i)switch(i){case OR:return zd;case FR:return Gd;case MR:return wb;case LR:return Vd;case UR:return Sm}return e});function fO(r,e){return e=e??Db,!!e&&(typeof r=="number"||pR.test(r))&&r>-1&&r%1==0&&r<e}function gO(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function hO(r){return!!Eb&&Eb in r}function vO(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||Zd;return r===t}function yO(r){return Xb.call(r)}function vr(r){if(r!=null){try{return Kb.call(r)}catch{}try{return r+""}catch{}}return""}function ek(r,e){return r===e||r!==r&&e!==e}var bO=Lb(function(){return arguments}())?Lb:function(r){return Ss(r)&&Ye.call(r,"callee")&&!Zb.call(r,"callee")},Kd=Array.isArray;function kO(r){return r!=null&&rk(r.length)&&!tk(r)}var xm=ER||IO;function SO(r,e){return Yb(r,e)}function tk(r){if(!ik(r))return!1;var e=Ps(r);return e==jb||e==ZE||e==XE||e==QE}function rk(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Db}function ik(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function Ss(r){return r!=null&&typeof r=="object"}var nk=Ab?bR(Ab):dO;function PO(r){return kO(r)?nO(r):lO(r)}function CO(){return[]}function IO(){return!1}Si.exports=SO});var NS=h(Cl=>{"use strict";Cl.byteLength=XO;Cl.toByteArray=YO;Cl.fromByteArray=tF;var et=[],Be=[],KO=typeof Uint8Array<"u"?Uint8Array:Array,rp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Rr=0,DS=rp.length;Rr<DS;++Rr)et[Rr]=rp[Rr],Be[rp.charCodeAt(Rr)]=Rr;var Rr,DS;Be["-".charCodeAt(0)]=62;Be["_".charCodeAt(0)]=63;function _S(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function XO(r){var e=_S(r),t=e[0],i=e[1];return(t+i)*3/4-i}function ZO(r,e,t){return(e+t)*3/4-t}function YO(r){var e,t=_S(r),i=t[0],n=t[1],o=new KO(ZO(r,i,n)),a=0,c=n>0?i-4:i,p;for(p=0;p<c;p+=4)e=Be[r.charCodeAt(p)]<<18|Be[r.charCodeAt(p+1)]<<12|Be[r.charCodeAt(p+2)]<<6|Be[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=Be[r.charCodeAt(p)]<<2|Be[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=Be[r.charCodeAt(p)]<<10|Be[r.charCodeAt(p+1)]<<4|Be[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function QO(r){return et[r>>18&63]+et[r>>12&63]+et[r>>6&63]+et[r&63]}function eF(r,e,t){for(var i,n=[],o=e;o<t;o+=3)i=(r[o]<<16&16711680)+(r[o+1]<<8&65280)+(r[o+2]&255),n.push(QO(i));return n.join("")}function tF(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,c=t-i;a<c;a+=o)n.push(eF(r,a,a+o>c?c:a+o));return i===1?(e=r[t-1],n.push(et[e>>2]+et[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(et[e>>10]+et[e>>4&63]+et[e<<2&63]+"=")),n.join("")}});var yH=Bn(sy(),1);function g(r,e){if(r==null)throw Error(e??"Expected nonnullish value.")}function sr(r,e){if(!r)throw Error(e)}var Q;(function(r){r.COMMENT="t1_",r.ACCOUNT="t2_",r.LINK="t3_",r.MESSAGE="t4_",r.SUBREDDIT="t5_",r.AWARD="t6_"})(Q||(Q={}));function St(r){return r.startsWith(Q.COMMENT)}function yd(r){return r.startsWith(Q.ACCOUNT)}function or(r){return r.startsWith(Q.LINK)}function oy(r){return r.startsWith(Q.MESSAGE)}function ay(r){return r.startsWith(Q.SUBREDDIT)}function dy(r){return r.startsWith(Q.AWARD)}function g0(r){sr(St(r),`Expected comment id to start with ${Q.COMMENT}, got ${r}}`)}function h0(r){sr(yd(r),`Expected account id to start with ${Q.ACCOUNT}, got ${r}}`)}function v0(r){sr(or(r),`Expected link id to start with ${Q.LINK}, got ${r}}`)}function y0(r){sr(oy(r),`Expected message id to start with ${Q.MESSAGE}, got ${r}}`)}function b0(r){sr(ay(r),`Expected subreddit id to start with ${Q.SUBREDDIT}, got ${r}}`)}function k0(r){sr(dy(r),`Expected award id to start with ${Q.AWARD}, got ${r}}`)}function Yr(r){return g0(r),r}function ee(r){return h0(r),r}function me(r){return v0(r),r}function S0(r){return y0(r),r}function Ae(r){return b0(r),r}function P0(r){return k0(r),r}function pe(r){if(St(r))return Yr(r);if(yd(r))return ee(r);if(or(r))return me(r);if(oy(r))return S0(r);if(ay(r))return Ae(r);if(dy(r))return P0(r);throw new Error(`Expected thing id to start with ${Object.values(Q).join(", ")} got ${r}}`)}function Hc(r){return St(r)}import*as P from"@devvit/protos";var bd=class{constructor(e){}};var Wc=(t=>(t.Installation="installation",t.App="app",t))(Wc||{});function ar(r,e=new Set){for(let t of r){if(t.type==="group"){ar(t.fields,e);continue}let i=t.name;if(e.has(i))throw new Error(`Duplicate field name: ${i}`);e.add(i)}C0(r)}function C0(r){for(let e of r)if(e.type==="string"&&e.isSecret&&e.scope!=="app")throw`Invalid setting: only app settings can be secrets. Add "scope: SettingScope.App" to field "${e.name}"`}var Pt=Object.freeze({INTERVAL:0,FORM:1,STATE:2,CHANNEL:3});var WL=["activity","add-emoji","add","add-media","add-to-feed","admin","align-center","align-left","align-right","all","appearance","approve","archived","aspect-ratio","aspect-rectangle","attach","audio","author","avatar-style","award","back","ban","best","binoculars","block","blockchain","bold","bot","boost","bounce","brand-awareness","browse","browser","cake","calendar","camera","caret-down","caret-left","caret-right","caret-up","chat","chat-group","chat-new","checkbox-dismiss","checkbox","checkmark","chrome","clear","close","closed-captioning","code-block","code-inline","coins-color-old","coins-color","coins","collapse-left","collapse-right","collection","comment","comments","community","contest","controversial","crop","crosspost","crowd-control","custom-feed","customize","day","delete","discover","dismiss-all","distinguish","down-arrow","down","download","downvote","downvotes","drag","drugs","duplicate","edit","effect","embed","emoji","end-live-chat","error","expand-left","expand-right","external","feed-video","filter","format","forward","gif-post","heart","help","hide","history","home","hot","ignore-reports","image-post","inbox","info","invite","italic","join","joined","jump-down","jump-up","karma","keyboard","kick","language","leave","left","link","link-post","list-bulleted","list-numbered","live-chat","live","load","location","lock","logout","loop","mark-read","mask","media-gallery","meme","menu","message","mic","mic-mute","mod","mod-mail","mod-mode","mod-mute","mod-overflow","mod-queue","mod-unmute","music","new","night","notification","notification-frequent","notification-off","nsfw","nsfw-language","nsfw-violence","original","overflow-caret","overflow-horizontal","overflow-vertical","pause","payment","peace","pending-posts","phone","pin","planet","play","poll-post","popular","posts","powerup-color-outline","powerup-fill-color","powerup","predictions","premium","privacy","profile","qa","qr-code","quarantined","quote","r-slash","radio-button","raise-hand","random","ratings-everyone","ratings-mature","ratings-nsfw","ratings-violence","refresh","remove","reply","report","reverse","right","rising","rotate","rotate-image","rpan","rules","safari","save","saved","search","self","send","settings","share-android","share","share-ios","show","side-menu","skipback10","skipforward10","sort-az","sort","sort-price","sort-za","spam","spoiler","sponsored","star","statistics","status-live","sticker","strikethrough","subtract","superscript","swap-camera","swipe-back","swipe-down","swipe","swipe-up","table","tag","tap","telescope","text","text-post","text-size","toggle","tools","top","topic-activism","topic-addictionsupport","topic-advice","topic-animals","topic-anime","topic-art","topic-beauty","topic-business","topic-careers","topic-cars","topic-celebrity","topic-craftsdiy","topic-crypto","topic-culture","topic-diy","topic-entertainment","topic-ethics","topic-family","topic-fashion","topic","topic-fitness","topic-food","topic-funny","topic-gender","topic-health","topic-help","topic-history","topic-hobbies","topic-homegarden","topic-internet","topic-law","topic-learning","topic-lifestyle","topic-marketplace","topic-mature","topic-mensfashion","topic-menshealth","topic-meta","topic-military","topic-movies","topic-music","topic-news","topic-other","topic-outdoors","topic-pets","topic-photography","topic-places","topic-podcasts","topic-politics","topic-programming","topic-reading","topic-religion","topic-science","topic-sexorientation","topic-sports","topic-style","topic-tabletop","topic-technology","topic-television","topic-traumasupport","topic-travel","topic-videogaming","topic-womensfashion","topic-womenshealth","translate","trim","u-slash","unban","undo","unheart","unlock","unmod","unpin","unverified","up-arrow","up","upload","upvote","upvotes","user","user-note","users","vault","verified","video-camera","video-feed","video-live-1","video-live-fill-1","video-live","video-post","video-thread","video-transcription","view-card","view-classic","view-compact","view-grid","views","volume","volume-mute","wallet","warning","wiki-ban","wiki","wiki-unban","world"];import{AppSettingsDefinition as N0,GetFieldsResponse as q0}from"@devvit/protos";import{FormField as dr,FormFieldType as Ee}from"@devvit/protos";function ot(r){return r.map(e=>{switch(e.type){case"string":return I0(e);case"image":return w0(e);case"paragraph":return x0(e);case"number":return T0(e);case"select":return A0(e);case"boolean":return E0(e);case"group":return R0(e);default:throw new Error("Unknown field type.")}})}function I0(r){return dr.fromPartial({defaultValue:{fieldType:Ee.STRING,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{stringConfig:{placeholder:r.placeholder}},fieldId:r.name,fieldType:Ee.STRING,helpText:r.helpText,label:r.label,required:r.required,isSecret:r.isSecret})}function w0(r){return dr.fromPartial({disabled:r.disabled,fieldId:r.name,fieldType:Ee.IMAGE,helpText:r.helpText,label:r.label,required:r.required})}function x0(r){return dr.fromPartial({defaultValue:{fieldType:Ee.PARAGRAPH,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{paragraphConfig:{lineHeight:r.lineHeight,placeholder:r.placeholder}},fieldId:r.name,fieldType:Ee.PARAGRAPH,helpText:r.helpText,label:r.label,required:r.required})}function T0(r){return dr.fromPartial({defaultValue:{fieldType:Ee.NUMBER,numberValue:r.defaultValue},disabled:r.disabled,fieldConfig:{numberConfig:{}},fieldId:r.name,fieldType:Ee.NUMBER,helpText:r.helpText,label:r.label,required:r.required})}function A0(r){return dr.fromPartial({defaultValue:{fieldType:Ee.SELECTION,selectionValue:{values:r.defaultValue}},disabled:r.disabled,fieldConfig:{selectionConfig:{choices:r.options,multiSelect:r.multiSelect}},fieldId:r.name,fieldType:Ee.SELECTION,helpText:r.helpText,label:r.label,required:r.required})}function E0(r){return dr.fromPartial({defaultValue:{fieldType:Ee.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Ee.BOOLEAN,helpText:r.helpText,label:r.label})}function R0(r){return dr.fromPartial({fieldType:Ee.GROUP,fieldConfig:{groupConfig:{fields:ot(r.fields)}},label:r.label,helpText:r.helpText})}function L(r,e){u.prototype[r]=e}import{ValidateFormResponse as _0}from"@devvit/protos";import{RealtimeSubscriptionStatus as uy}from"@devvit/protos";var B=Object.freeze({Actor:"devvit-actor",App:"devvit-app",AppUser:"devvit-app-user",AppViewerAuthToken:"devvit-app-viewer-authorization",Caller:"devvit-caller",CallerPortID:"devvit-caller-port-id",Canary:"devvit-canary",Debug:"devvit-debug",GQLHost:"devvit-gql-host",Installation:"devvit-installation",ModPermissions:"devvit-mod-permissions",R2Auth:"devvit-sec-authorization",R2Host:"devvit-r2-host",RemoteHostname:"devvit-remote-hostname",SettingsUri:"devvit-sec-settings-uri",StreamID:"devvit-stream-id",Subreddit:"devvit-subreddit",TraceID:"devvit-trace-id",User:"devvit-user",Version:"devvit-version",Language:"devvit-accept-language",Timezone:"devvit-accept-timezone",AppDependencies:"devvit-app-dependencies",WebviewTemplate:"devvit-webview-template"}),ly;(function(r){r.Blocks="blocks",r.EmitSnapshots="emitSnapshots",r.EmitState="emitState",r.Realtime="realtime",r.Runtime="runtime",r.Surface="surface",r.UseAsync="useAsync",r.Payments="payments"})(ly||(ly={}));function cy(r){function e(t){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=r.metadata[B.App]?.values[0];g(c,"useChannel - app is missing from Context");let p=r.metadata[B.Installation]?.values[0];g(p,"useChannel - installation is missing from Context");async function f(T){let F=o[n].channel;if(o[n].active)if(o[n].connected)await r.realtime.send(F,T);else throw Error(`Failed to send to channel '${F}'; it is active but not yet connected`);else throw Error(`Cannot send a message over inactive channel: ${F}`)}function v(){if(!o[n].active){let T=o[n].channel;o[n].active=!0,r.addRealtimeChannel(T)}}function m(){if(o[n].active){let T=o[n].channel;o[n].active=!1,r.removeRealtimeChannel(T)}}function b(T){return async()=>{let F;switch(T.status){case uy.REALTIME_SUBSCRIBED:o[n].connected=!0,F=t.onSubscribed?.();break;case uy.REALTIME_UNSUBSCRIBED:o[n].connected=!1,F=t.onUnsubscribed?.();break;default:F=t.onMessage(T.event?.data??{});break}await F}}let y={channel:`${c}:${p}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:Pt.CHANNEL};n in o?y=o[n]:n in a&&(y=a[n]);let C=r.realtimeEvent;r.isInitialRender?y.active=!1:C&&y.active&&C.event.channel===y.channel&&(y.preventCallback||r.runHook(b(C)),r.rerenderIn(0)),o[n]=y,r.currentHookIndex++;let w=0;return y.active&&y.connected?w=2:y.active&&!y.connected?w=1:!y.active&&y.connected?w=3:!y.active&&!y.connected&&(w=4),{subscribe:v,unsubscribe:m,send:f,status:w}}return e}import{FormFieldType as Qr}from"@devvit/protos";function Gc(r){switch(r.fieldType){case Qr.STRING:return r.stringValue;case Qr.IMAGE:return r.stringValue;case Qr.PARAGRAPH:return r.stringValue;case Qr.NUMBER:return r.numberValue;case Qr.BOOLEAN:return r.boolValue;case Qr.SELECTION:return r.selectionValue?.values??[];default:return}}function Ct(r){return Object.keys(r).reduce((e,t)=>{let i=Gc(r[t]);return i!==void 0&&(e[t]=i),e},{})}function my(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentKey(),a=r.getCurrentComponentState(),c=r.getPreviousComponentState(),p=`form.hook.${o}.${n}`,f={formKey:p,preventSubmit:!1,type:Pt.FORM};n in a?f=a[n]:n in c&&(f=c[n]),a[n]=f,r.forms.set(p,t);let v=r.formSubmittedEvent;return v&&!f.preventSubmit&&v.formId===p&&r.runHook(async()=>{let m=i(Ct(v.results));m&&m instanceof Promise&&await m,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function py(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=100,p=Math.max(c,i),f={lastRun:void 0,running:!1,preventCallback:!1,type:Pt.INTERVAL};n in o?f=o[n]:n in a&&(f=a[n]);function v(){i<c&&console.error(`useInterval delay must be at least ${c}ms. Your interval of ${i}ms was automatically extended.`);for(let[b,y]of Object.entries(o))if(b!==n.toString()&&y?.type===Pt.INTERVAL&&y?.running)throw new Error("Only one useInterval hook may be running at a time");o[n]={running:!0,lastRun:o[n]?.lastRun??Date.now(),preventCallback:!1,type:Pt.INTERVAL},r.rerenderIn(p)}function m(){o[n].running=!1,o[n].lastRun=void 0,o[n].preventCallback=!1}return r.isEffectRender&&f.running&&(f.preventCallback||(f.lastRun===void 0||f.lastRun+p<Date.now())&&r.runHook(async()=>{let b=t();b&&b instanceof Promise&&await b,f.lastRun=Date.now()}),r.rerenderIn(p)),f.preventCallback=!1,o[n]=f,r.currentHookIndex++,{start:v,stop:m}}return e}function fy(r){function e(t){let i=r.currentHookIndex,n=r.getCurrentComponentState(),o=r.getPreviousComponentState();if(i in n)return r.currentHookIndex++,[n[i],a];if(r.isInitialRender||!(i in o)){let c=t instanceof Function?t():t;if(c instanceof Promise)throw(async()=>{n[i]=await c,r.currentHookIndex=0})();n[i]=c}else n[i]=o[i];function a(c){if(r.isRendering)throw new Error("Cannot call setState while rendering.");n[i]=c instanceof Function?c(n[i]):c}return r.currentHookIndex++,[n[i],a]}return e}var $c={now(){return new Date}};function gy(r){return`__autocache__${r}`}function hy(r){return`__lock__${r}`}var F0=300,M0=1e3,kd=5e3,Vc=3,vy=.1,yy=1e3,L0=3e4;function by(r){if(r.error)throw new Error(r.error);return r.value}var It,wt,Re,ei,Pd,ky,Cd,Sy,Id,Py,ns,zc,wd,Cy,xd,Iy,ss,Jc,Td,wy,Sd=class{constructor(e,t,i=$c){d(this,Pd);d(this,Cd);d(this,Id);d(this,ns);d(this,wd);d(this,xd);d(this,ss);d(this,Td);d(this,It,void 0);d(this,wt,{});d(this,Re,void 0);d(this,ei,void 0);l(this,It,e),l(this,ei,t),l(this,Re,i)}async cache(e,t){l(this,wt,s(this,ei).__cache=s(this,ei).__cache??{}),S(this,Td,wy).call(this,t);let i=S(this,Pd,ky).call(this,t.key);if(i!==void 0)return i;let n=await S(this,ss,Jc).call(this,t.key),o=await S(this,Cd,Sy).call(this,t,n,e);return by(o)}};It=new WeakMap,wt=new WeakMap,Re=new WeakMap,ei=new WeakMap,Pd=new WeakSet,ky=function(e){let t=s(this,wt)[e];if(t){let i=s(this,Re).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<Vc&&Math.random()<vy&&t.errorTime+yy<i;if(t?.expires&&t.expires<i&&t.checkedAt+yy<i||n){delete s(this,wt)[e];return}else return by(t)}},Cd=new WeakSet,Sy=async function(e,t,i){let n=t?.expires,o=n?S(this,xd,Iy).call(this,n):1;return!t||t?.error&&t.errorCount<Vc&&vy>Math.random()||o>Math.random()?S(this,Id,Py).call(this,e,t,i):t},Id=new WeakSet,Py=async function(e,t,i){let n=hy(e.key),o=s(this,Re).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,It).set(n,"1",{expiration:a,nx:!0}))return S(this,wd,Cy).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Re).now();return S(this,ns,zc).call(this,p,e.key,e.ttl)}},ns=new WeakSet,zc=async function(e,t,i){let n=Math.min(i,M0),o=await S(this,ss,Jc).call(this,t);if(o)return o;if(s(this,Re).now().getTime()-e.getTime()>=n)throw new Error(`Cache request timed out trying to get data at key: ${t}`);return await new Promise(a=>setTimeout(a,F0)),S(this,ns,zc).call(this,e,t,i)},wd=new WeakSet,Cy=async function(e,t,i,n){let o=s(this,Re).now().getTime()+n;t=t??{value:null,expires:o,errorCount:0,error:null,errorTime:null,checkedAt:0};try{t.value=await i(),t.error=null,t.errorCount=0,t.errorTime=null}catch(a){t.value=null,t.error=a.message??"Unknown error",t.errorTime=s(this,Re).now().getTime(),t.errorCount++}return s(this,wt)[e]=t,await s(this,It).set(gy(e),JSON.stringify(t),{expiration:new Date(o+L0)}),t.error&&t.errorCount<Vc&&await s(this,It).del(hy(e)),t},xd=new WeakSet,Iy=function(e){let t=s(this,Re).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},ss=new WeakSet,Jc=async function(e){let t=await s(this,It).get(gy(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Re).now().getTime(),s(this,wt)[e]=i,i}},Td=new WeakSet,wy=function(e){e.ttl<kd&&(console.warn(`Cache TTL cannot be less than ${kd} milliseconds! Updating ttl value of ${e.ttl} to ${kd}.`),e.ttl=kd)};function xy(r,e,t=$c){let i=new Sd(r,e,t);return i.cache.bind(i)}function Ty(r){new URL(r.slice(0,r.indexOf(",")))}var ti,ri,Ad,Ay,Ed,Ey,ii=class{constructor(){d(this,Ad);d(this,Ed);d(this,ti,{});d(this,ri,{});l(this,ti,u.assets),l(this,ri,u.webviewAssets)}getURL(e,t){return typeof e=="string"?S(this,Ad,Ay).call(this,e,t??{webview:!1}):S(this,Ed,Ey).call(this,e,t??{webview:!1})}};ti=new WeakMap,ri=new WeakMap,Ad=new WeakSet,Ay=function(e,t){let i=t.webview?s(this,ri)[e]:s(this,ti)[e];if(i)return i;try{return Ty(e),encodeURI(e)}catch{return""}},Ed=new WeakSet,Ey=function(e,t){let i={},n=[],o=t.webview?s(this,ri):s(this,ti);if(o)for(let a of e)if(o[a])i[a]=o[a];else try{Ty(a),i[a]=encodeURI(a)}catch{n.push(a)}else n=e;if(n.length>0)throw new Error(`The following assets were missing from the assets list: ${n.join(", ")}`);return i};var xt,ni=class{constructor(e){d(this,xt,void 0);l(this,xt,e)}async get(e){let{messages:t}=await u.kvStorePlugin.Get({keys:[e]},s(this,xt));try{if(t[e])return JSON.parse(t[e])}catch{return}}async put(e,t){let i={};i[e]=JSON.stringify(t),await u.kvStorePlugin.Put({messages:i},s(this,xt))}async delete(e){await u.kvStorePlugin.Del({keys:[e]},s(this,xt))}async list(){let{keys:e}=await u.kvStorePlugin.List({filter:"*"},s(this,xt));return e}};xt=new WeakMap;var os,si=class{constructor(e){d(this,os,void 0);l(this,os,e)}async upload(e){let t=await u.mediaPlugin.Upload(e,s(this,os));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};os=new WeakMap;var as,oi=class{constructor(e){d(this,as,void 0);l(this,as,e)}async add(e){await u.modLogPlugin.Add(e,s(this,as))}};as=new WeakMap;var ds,ai=class{constructor(e){d(this,ds,void 0);l(this,ds,e)}async send(e,t){await u.realtimePlugin.Send({channel:e,data:t},s(this,ds))}};ds=new WeakMap;var k,ls,li=class{constructor(e){d(this,k,void 0);d(this,ls,void 0);l(this,k,e),l(this,ls,new Od(e))}get modMail(){return s(this,ls)}getSubredditById(e){return fe.getById(pe(e),s(this,k))}getSubredditByName(e){return fe.getByName(e,s(this,k))}addSubredditRemovalReason(e,t){return fe.addRemovalReason(e,t.title,t.message,s(this,k))}getSubredditRemovalReasons(e){return fe.getRemovalReasons(e,s(this,k))}getCurrentSubreddit(){return fe.getFromMetadata(s(this,k))}getPostById(e){return G.getById(pe(e),s(this,k))}submitPost(e){return G.submit(e,s(this,k))}crosspost(e){return G.crosspost(e,s(this,k))}getUserById(e){return I.getById(pe(e),s(this,k))}getCollectionById(e){return di.getCollectionById({collectionId:e},s(this,k))}createCollection(e){return di.create(e,s(this,k))}getCollectionsForSubreddit(e){return di.getCollectionsForSubreddit({subredditId:e},s(this,k))}getUserByUsername(e){return I.getByUsername(e,s(this,k))}getCurrentUser(){return I.getFromMetadata(B.User,s(this,k))}getAppUser(){return I.getFromMetadata(B.AppUser,s(this,k))}getSnoovatarUrl(e){return I.getSnoovatarUrl(e,s(this,k))}getCommentById(e){return $.getById(pe(e),s(this,k))}getComments(e){return $.getComments(e,s(this,k))}getCommentsByUser(e){return $.getCommentsByUser(e,s(this,k))}submitComment(e){return $.submit({...e,id:pe(e.id)},s(this,k))}getControversialPosts(e){return G.getControversialPosts(e,s(this,k))}getTopPosts(e){return G.getTopPosts(e,s(this,k))}getHotPosts(e){return G.getHotPosts(e,s(this,k))}getNewPosts(e){return G.getNewPosts(e,s(this,k))}getRisingPosts(e){return G.getRisingPosts(e,s(this,k))}getPostsByUser(e){return G.getPostsByUser(e,s(this,k))}getCommentsAndPostsByUser(e){return I.getOverview(e,s(this,k))}getModerationLog(e){return Rd(e,s(this,k))}getApprovedUsers(e){return I.getSubredditUsersByType({type:"contributors",...e},s(this,k))}approveUser(e,t){return I.createRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}removeUser(e,t){return I.removeRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}getWikiContributors(e){return I.getSubredditUsersByType({type:"wikicontributors",...e},s(this,k))}addWikiContributor(e,t){return I.createRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}removeWikiContributor(e,t){return I.removeRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}getBannedUsers(e){return I.getSubredditUsersByType({type:"banned",...e},s(this,k))}banUser(e){return I.createRelationship({username:e.username,subredditName:e.subredditName,type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,k))}unbanUser(e,t){return I.removeRelationship({username:e,subredditName:t,type:"banned"},s(this,k))}getBannedWikiContributors(e){return I.getSubredditUsersByType({type:"wikibanned",...e},s(this,k))}banWikiContributor(e){return I.createRelationship({...e,type:"wikibanned"},s(this,k))}unbanWikiContributor(e,t){return I.removeRelationship({username:e,subredditName:t,type:"wikibanned"},s(this,k))}getModerators(e){return I.getSubredditUsersByType({type:"moderators",...e},s(this,k))}inviteModerator(e){return I.createRelationship({type:"moderator_invite",subredditName:e.subredditName,username:e.subredditName,permissions:e.permissions??[]},s(this,k))}revokeModeratorInvite(e,t){return I.removeRelationship({username:e,subredditName:t,type:"moderator_invite"},s(this,k))}removeModerator(e,t){return I.removeRelationship({type:"moderator",subredditName:t,username:e},s(this,k))}setModeratorPermissions(e,t,i){return I.setModeratorPermissions(e,t,i,s(this,k))}getMutedUsers(e){return I.getSubredditUsersByType({type:"muted",...e},s(this,k))}muteUser(e){return I.createRelationship({...e,type:"muted"},s(this,k))}unmuteUser(e,t){return I.removeRelationship({username:e,subredditName:t,type:"muted"},s(this,k))}getModNotes(e){return Oe.get(e,s(this,k))}deleteModNote(e){return Oe.delete(e,s(this,k))}addModNote(e){let t={...e,redditId:e.redditId?pe(e.redditId):void 0};return Oe.add(t,s(this,k))}addRemovalNote(e){return Oe.addRemovalNote(e,s(this,k))}async sendPrivateMessage(e){return lr.send(e,s(this,k))}async sendPrivateMessageAsSubreddit(e){return lr.sendAsSubreddit(e,s(this,k))}async approve(e){if(St(e))return $.approve(e,s(this,k));if(or(e))return G.approve(e,s(this,k));throw new Error("id must start with either t1_ or t3_")}async remove(e,t){if(St(e))return $.remove(e,t,s(this,k));if(or(e))return G.remove(e,t,s(this,k));throw new Error("id must start with either t1_ or t3_")}async getPostFlairTemplates(e){return se.getPostFlairTemplates(e,s(this,k))}async getUserFlairTemplates(e){return se.getUserFlairTemplates(e,s(this,k))}async createPostFlairTemplate(e){return se.createPostFlairTemplate(e,s(this,k))}async createUserFlairTemplate(e){return se.createUserFlairTemplate(e,s(this,k))}async editFlairTemplate(e){return se.editFlairTemplate(e,s(this,k))}async deleteFlairTemplate(e,t){return se.deleteFlairTemplate(e,t,s(this,k))}async setUserFlair(e){return Fe.setUserFlair(e,s(this,k))}async removeUserFlair(e,t){return Fe.removeUserFlair(e,t,s(this,k))}async setPostFlair(e){return Fe.setPostFlair(e,s(this,k))}async removePostFlair(e,t){return Fe.removePostFlair(e,me(t),s(this,k))}async getWidgets(e){return te.getWidgets(e,s(this,k))}async deleteWidget(e,t){return te.delete(e,t,s(this,k))}async addWidget(e){return te.add(e,s(this,k))}async reorderWidgets(e,t){return te.reorder(e,t,s(this,k))}async getWikiPage(e,t){return ge.getPage(e,t,s(this,k))}async getWikiPages(e){return ge.getPages(e,s(this,k))}async createWikiPage(e){return ge.createPage(e,s(this,k))}async updateWikiPage(e){return ge.updatePage(e,s(this,k))}getWikiPageRevisions(e){return ge.getPageRevisions(e,s(this,k))}async revertWikiPage(e,t,i){return ge.revertPage(e,t,i,s(this,k))}async getWikiPageSettings(e,t){return ge.getPageSettings(e,t,s(this,k))}async updateWikiPageSettings(e){return ge.updatePageSettings(e,s(this,k))}async addEditorToWikiPage(e,t,i){return ge.addEditor(e,t,i,s(this,k))}async removeEditorFromWikiPage(e,t,i){return ge.removeEditor(e,t,i,s(this,k))}getMessages(e){return lr.getMessages(e,s(this,k))}markAllMessagesAsRead(){return lr.markAllAsRead(s(this,k))}report(e,t){return u.redditAPIPlugins.LinksAndComments.Report({reason:t.reason,thingId:e.id,srName:e.subredditName,usernames:e.authorName},s(this,k))}getModQueue(e){return fe.aboutLocation({...e,location:"modqueue"},s(this,k))}getReports(e){return fe.aboutLocation({...e,location:"reports"},s(this,k))}getSpam(e){return fe.aboutLocation({...e,location:"spam"},s(this,k))}getUnmoderated(e){return fe.aboutLocation({...e,location:"unmoderated"},s(this,k))}getEdited(e){return fe.aboutLocation({...e,location:"edited"},s(this,k))}getVaultByAddress(e){return Fy(e,s(this,k))}getVaultByUserId(e){return My(pe(e),s(this,k))}getSubredditLeaderboard(e){return Oy(e,s(this,k))}};k=new WeakMap,ls=new WeakMap;import{RedisKeyScope as Kc}from"@devvit/protos";var E,R,O,Xc=class{constructor(e,t,i){d(this,E,void 0);d(this,R,void 0);d(this,O,void 0);l(this,E,e),l(this,R,t),l(this,O,i)}async get(e){return await s(this,E).Get({key:e,transactionId:s(this,R)},s(this,O)),this}async multi(){await s(this,E).Multi(s(this,R),s(this,O))}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),await s(this,E).Set({key:e,value:t,nx:i?.nx===!0,xx:i?.xx===!0,expiration:n||0,transactionId:s(this,R)},s(this,O)),this}async del(...e){return await s(this,E).Del({keys:e,transactionId:s(this,R)},s(this,O)),this}async type(e){return await s(this,E).Type({key:e,transactionId:s(this,R)},s(this,O)),this}async exec(){let e=await s(this,E).Exec(s(this,R),s(this,O)),t=[];for(let i of e.response)i.members?t.push(i.members):i.nil!==void 0?t.push(null):i.num!==void 0?t.push(i.num):i.values!==void 0?t.push(i.values.values):i.str!==void 0&&t.push(i.str);return t}async discard(){await s(this,E).Discard(s(this,R),s(this,O))}async watch(...e){return await s(this,E).Watch({keys:e,transactionId:s(this,R)},s(this,O)),this}async unwatch(){return await s(this,E).Unwatch(s(this,R),s(this,O)),this}async getRange(e,t,i){return await s(this,E).GetRange({key:e,start:t,end:i,transactionId:s(this,R)},s(this,O)),this}async setRange(e,t,i){return await s(this,E).SetRange({key:e,offset:t,value:i,transactionId:s(this,R)},s(this,O)),this}async strlen(e){return this.strLen(e)}async strLen(e){return await s(this,E).Strlen({key:e,transactionId:s(this,R)},s(this,O)),this}async mget(e){return this.mGet(e)}async mGet(e){return await s(this,E).MGet({keys:e,transactionId:s(this,R)},s(this,O)),this}async mset(e){return this.mSet(e)}async mSet(e){let t=Object.entries(e).map(([i,n])=>({key:i,value:n}));return await s(this,E).MSet({kv:t,transactionId:s(this,R)},s(this,O)),this}async incrBy(e,t){return await s(this,E).IncrBy({key:e,value:t,transactionId:s(this,R)},s(this,O)),this}async expire(e,t){return await s(this,E).Expire({key:e,seconds:t,transactionId:s(this,R)},s(this,O)),this}async expireTime(e){return await s(this,E).ExpireTime({key:e,transactionId:s(this,R)},s(this,O)),this}async zAdd(e,...t){return await s(this,E).ZAdd({key:e,members:t,transactionId:s(this,R)},s(this,O)),this}async zScore(e,t){return await s(this,E).ZScore({key:{key:e,transactionId:s(this,R)},member:t},s(this,O)),this}async zRank(e,t){return await s(this,E).ZRank({key:{key:e,transactionId:s(this,R)},member:t},s(this,O)),this}async zIncrBy(e,t,i){return await s(this,E).ZIncrBy({key:e,member:t,value:i,transactionId:s(this,R)},s(this,O)),this}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,R)};return await s(this,E).ZScan(o,s(this,O)),this}async zCard(e){return await s(this,E).ZCard({key:e,transactionId:s(this,R)},s(this,O)),this}async zRange(e,t,i,n){let o={rev:!1,byLex:!1,byScore:!1,offset:0,count:1e3};return n?.reverse&&(o.rev=n.reverse),n?.by==="lex"?o.byLex=!0:n?.by==="score"&&(o.byScore=!0),await s(this,E).ZRange({key:{key:e,transactionId:s(this,R)},start:t+"",stop:i+"",...o},s(this,O)),this}async zRem(e,t){return await s(this,E).ZRem({key:{key:e,transactionId:s(this,R)},members:t},s(this,O)),this}async zRemRangeByLex(e,t,i){return await s(this,E).ZRemRangeByLex({key:{key:e,transactionId:s(this,R)},min:t,max:i},s(this,O)),this}async zRemRangeByRank(e,t,i){return await s(this,E).ZRemRangeByRank({key:{key:e,transactionId:s(this,R)},start:t,stop:i},s(this,O)),this}async zRemRangeByScore(e,t,i){return await s(this,E).ZRemRangeByScore({key:{key:e,transactionId:s(this,R)},min:t,max:i},s(this,O)),this}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){return await s(this,E).HGetAll({key:e,transactionId:s(this,R)},s(this,O)),this}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){return await s(this,E).HGet({key:e,field:t,transactionId:s(this,R)},s(this,O)),this}async hset(e,t){return this.hSet(e,t)}async hSet(e,t){let i=Object.entries(t).map(([n,o])=>({field:n,value:o}));return await s(this,E).HSet({key:e,fv:i,transactionId:s(this,R)},s(this,O)),this}async hincrby(e,t,i){return this.hIncrBy(e,t,i)}async hIncrBy(e,t,i){return await s(this,E).HIncrBy({key:e,field:t,value:i,transactionId:s(this,R)},s(this,O)),this}async hdel(e,t){return this.hDel(e,t)}async hDel(e,t){return await s(this,E).HDel({key:e,fields:t,transactionId:s(this,R)},s(this,O)),this}async hscan(e,t,i,n){return this.hScan(e,t,i,n)}async hScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,R)};return await s(this,E).HScan(o,s(this,O)),this}async hkeys(e){return this.hKeys(e)}async hKeys(e){return await s(this,E).HKeys({key:e,transactionId:s(this,R)},s(this,O)),this}async hlen(e){return this.hLen(e)}async hLen(e){return await s(this,E).HLen({key:e,transactionId:s(this,R)},s(this,O)),this}};E=new WeakMap,R=new WeakMap,O=new WeakMap;var M,ui,Zc=class Zc{constructor(e,t=void 0,i=Kc.INSTALLATION){d(this,M,void 0);d(this,ui,void 0);l(this,M,e),l(this,ui,t),this.scope=i,this.global=i===Kc.INSTALLATION?new Zc(s(this,M),s(this,ui),Kc.GLOBAL):this}get storage(){return s(this,ui)||u.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,M));return new Xc(this.storage,t,s(this,M))}async get(e){let t=await this.storage.Get({key:e,scope:this.scope},s(this,M));return t!==null?t.value??void 0:t}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),(await this.storage.Set({key:e,value:t,nx:i?.nx===!0&&!i.xx,xx:i?.xx===!0&&!i.nx,expiration:n||0,scope:this.scope},s(this,M))).value}async del(...e){await this.storage.Del({keys:e,scope:this.scope},s(this,M))}async incrBy(e,t){return(await this.storage.IncrBy({key:e,value:t,scope:this.scope},s(this,M))).value}async getRange(e,t,i){let n=await this.storage.GetRange({key:e,start:t,end:i,scope:this.scope},s(this,M));return n!==null?n.value:n}async setRange(e,t,i){return(await this.storage.SetRange({key:e,offset:t,value:i,scope:this.scope},s(this,M))).value}async strlen(e){return this.strLen(e)}async strLen(e){return(await this.storage.Strlen({key:e,scope:this.scope},s(this,M))).value}async expire(e,t){await this.storage.Expire({key:e,seconds:t,scope:this.scope},s(this,M))}async expireTime(e){return(await this.storage.ExpireTime({key:e,scope:this.scope},s(this,M))).value}async zAdd(e,...t){return(await this.storage.ZAdd({key:e,members:t,scope:this.scope},s(this,M))).value}async zRange(e,t,i,n){let o={rev:!1,byLex:!1,byScore:!1,offset:0,count:1e3};return n?.reverse&&(o.rev=n.reverse),n?.by==="lex"?o.byLex=!0:n?.by==="score"?o.byScore=!0:(o.offset=0,o.count=0),(await this.storage.ZRange({key:{key:e},start:t+"",stop:i+"",...o,scope:this.scope},s(this,M))).members}async zRem(e,t){return(await this.storage.ZRem({key:{key:e},members:t,scope:this.scope},s(this,M))).value}async zRemRangeByLex(e,t,i){return(await this.storage.ZRemRangeByLex({key:{key:e},min:t,max:i,scope:this.scope},s(this,M))).value}async zRemRangeByRank(e,t,i){return(await this.storage.ZRemRangeByRank({key:{key:e},start:t,stop:i,scope:this.scope},s(this,M))).value}async zRemRangeByScore(e,t,i){return(await this.storage.ZRemRangeByScore({key:{key:e},min:t,max:i,scope:this.scope},s(this,M))).value}async zScore(e,t){let i=await this.storage.ZScore({key:{key:e},member:t,scope:this.scope},s(this,M));return i!==null?i.value:i}async zRank(e,t){let i=await this.storage.ZRank({key:{key:e},member:t,scope:this.scope},s(this,M));return i!==null?i.value:i}async zIncrBy(e,t,i){let n=await this.storage.ZIncrBy({key:e,member:t,value:i,scope:this.scope},s(this,M));return n!==null?n.value:n}async mget(e){return this.mGet(e)}async mGet(e){let t=await this.storage.MGet({keys:e,scope:this.scope},s(this,M));return t!==null?t.values.map(i=>i||null):t}async mset(e){return this.mSet(e)}async mSet(e){let t=Object.entries(e).map(([i,n])=>({key:i,value:n}));await this.storage.MSet({kv:t,scope:this.scope},s(this,M))}async zCard(e){let t=await this.storage.ZCard({key:e,scope:this.scope},s(this,M));return t!==null?t.value:t}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,scope:this.scope};return await this.storage.ZScan(o,s(this,M))}async type(e){let t=await this.storage.Type({key:e,scope:this.scope},s(this,M));return t!==null?t.value:t}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){let i=await this.storage.HGet({key:e,field:t,scope:this.scope},s(this,M));return i!==null?i.value??void 0:i}async hset(e,t){return this.hSet(e,t)}async hSet(e,t){let i=Object.entries(t).map(([o,a])=>({field:o,value:a}));return(await this.storage.HSet({key:e,fv:i,scope:this.scope},s(this,M))).value}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){let t=await this.storage.HGetAll({key:e,scope:this.scope},s(this,M));return t!==null?t.fieldValues:t}async hdel(e,t){return this.hDel(e,t)}async hDel(e,t){return(await this.storage.HDel({key:e,fields:t,scope:this.scope},s(this,M))).value}async hscan(e,t,i,n){return this.hScan(e,t,i,n)}async hScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,scope:this.scope};return await this.storage.HScan(o,s(this,M))}async hkeys(e){return this.hKeys(e)}async hKeys(e){let t=await this.storage.HKeys({key:e,scope:this.scope},s(this,M));return t!==null?t.keys:t}async hincrby(e,t,i){return this.hIncrBy(e,t,i)}async hIncrBy(e,t,i){return(await this.storage.HIncrBy({key:e,field:t,value:i,scope:this.scope},s(this,M))).value}async hlen(e){return this.hLen(e)}async hLen(e){return(await this.storage.HLen({key:e,scope:this.scope})).value}};M=new WeakMap,ui=new WeakMap;var ci=Zc;var ur,mi=class{constructor(e){d(this,ur,void 0);l(this,ur,e)}async runJob(e){return(await u.schedulerPlugin.Schedule({action:{type:e.name,data:e.data},cron:"cron"in e?e.cron:void 0,when:"runAt"in e?e.runAt:void 0},s(this,ur))).id}async cancelJob(e){await u.schedulerPlugin.Cancel({id:e},s(this,ur))}async listJobs(){return(await u.schedulerPlugin.List({after:new Date(0),before:new Date(Date.now()+31536e7)},s(this,ur))).actions.map(t=>(g(t.request?.action,"Scheduled job is malformed"),"when"in t.request&&t.request.when!=null?{id:t.id,name:t.request.action.type,runAt:t.request.when,data:t.request.action.data}:{id:t.id,name:t.request.action.type,cron:t.request.cron??"",data:t.request.action}))}};ur=new WeakMap;var us,pi=class{constructor(e){d(this,us,void 0);l(this,us,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await u.settingsPlugin.GetSettings({},s(this,us));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...Ly(t.installationSettings.settings,u.installationSettings),...Ly(t.appSettings.settings,u.appSettings)}}};us=new WeakMap;function Ly(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=Gc(r[n]),i),{});return e&&Uy(t,e),t}function Uy(r,e){for(let t of e)t.type==="group"?Uy(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as Yc,Form as U0,ToastAppearance as By}from"@devvit/protos";var cr,fi,Fd=class{constructor(e){d(this,cr,[]);d(this,fi,void 0);l(this,fi,e)}showForm(e,t){let i=u.formDefinitions.get(e);if(!i&&s(this,fi)){let a=s(this,fi).forms.get(e);a&&(i={form:a,onSubmit:()=>{}})}if(!i)throw new Error("Form does not exist. Make sure you have added it using Devvit.createForm at the root of your app.");let n=i.form instanceof Function?i.form(t??{}):i.form,o=U0.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});ar(n.fields),o.fields=ot(n.fields),s(this,cr).push({type:Yc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?By.SUCCESS:By.NEUTRAL}:t={text:e},s(this,cr).push({type:Yc.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,cr).push({type:Yc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,cr)}};cr=new WeakMap,fi=new WeakMap;function Me({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new oi(r),o=new ni(r),a=new ci(r),c=xy(a,i?i.state:{}),p=new li(r),f=new mi(r),v=new pi(r),m=e?new Fd(i):void 0,b=new si(r),y=new ii,C=new ai(r),w=t&&i?fy(i):void 0,T=t&&i?py(i):void 0,F=t&&i?my(i):void 0,de=t&&i?cy(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:f,settings:v,media:b,assets:y,realtime:C,get useForm(){return F??(()=>{throw new Error("useForm() is unavailable")})},get cache(){return c??(()=>{throw new Error("cache() is unavailable")})},get useState(){return w??(()=>{throw new Error("useState() is unavailable")})},get useInterval(){return T??(()=>{throw new Error("useInterval() is unavailable")})},get useChannel(){return de??(()=>{throw new Error("useChannel() is unavailable")})},get ui(){if(!m)throw new Error("ui client is not available");return m}}}var Dy={name:"@devvit/public-api",version:"0.11.0-dev",license:"BSD-3-Clause",repository:{type:"git",url:"https://developers.reddit.com/"},type:"module",exports:{".":"./dist/index.js","./package.json":"./package.json","./*":"./dist/*"},main:"./dist/index.js",files:["dist/**"],scripts:{build:"yarn build:icon-types && yarn build:semantic-colors && tsc && cp -af devvit.tsconfig.json dist/ && yarn build:types && yarn build:min && yarn build:unmin","build:icon-types":"make-icons src/types/icons.ts","build:min":"esbuild --bundle --sourcemap=linked --target=es2020 --format=esm --metafile=dist/meta.min.json --outfile=dist/public-api.min.js --external:@devvit/protos --minify src/index.ts","build:semantic-colors":"node scripts/make-semantic-colors.js","build:types":"api-extractor run && sed -ne '/declare global {/,$ p' src/devvit/Devvit.ts >> dist/public-api.d.ts","build:unmin":"esbuild --bundle --sourcemap=inline --target=es2020 --format=iife --metafile=dist/meta.json --outfile=dist/public-api.iife.js --global-name=devvitPublicAPI src/index.ts",clean:"rm -rf .turbo api-extractor coverage dist src/devvit/internals/semanticColors.ts src/types/icons.ts || :",clobber:"yarn clean && rm -rf node_modules",dev:"tsc -w","dev:build":"chokidar ./src --command 'yarn build' --ignore './src/types/icons.ts' --ignore './src/devvit/internals/semanticColors.ts'",lint:"redlint .","lint:fix":"yarn lint --fix",prepublishOnly:"publish-package-json",test:"yarn test:unit && yarn test:types && yarn test:size","test:size":"filesize","test:types":"tsc --noEmit","test:unit":"vitest run","test:unit-with-coverage":"vitest run --coverage"},types:"./dist/index.d.ts",dependencies:{"@devvit/protos":"0.11.0-dev","@devvit/shared-types":"0.11.0-dev","base64-js":"1.5.1","clone-deep":"4.0.1","core-js":"3.27.2","lodash.isequal":"4.5.0"},devDependencies:{"@ampproject/filesize":"4.3.0","@devvit/eslint-config":"0.11.0-dev","@devvit/repo-tools":"0.11.0-dev","@devvit/tsconfig":"0.11.0-dev","@microsoft/api-extractor":"7.41.0","@reddit/faceplate-ui":"11.3.3","@types/clone-deep":"4.0.1","@types/core-js":"2.5.6","@types/lodash.isequal":"4.5.6","@vitest/coverage-c8":"0.32.0","chokidar-cli":"3.0.0",esbuild:"0.18.12",eslint:"8.9.0",typescript:"5.3.2",vitest:"1.6.0"},publishConfig:{directory:"dist"},filesize:{"dist/public-api.min.js":{gzip:"78 KB",none:"255 KB"}},source:"./src/index.ts"};function oe(r,e,t){let i=r[B.Subreddit]?.values[0];g(i,"subreddit is missing from Context");let n=r[B.AppUser]?.values[0],o=r[B.User]?.values[0],a=D0(r);return{get appAccountId(){return g(n,"appAccountId is missing from Context"),n},subredditId:i,userId:o,postId:e,commentId:t,debug:a,toJSON(){return{appAccountId:n,subredditId:i,userId:o,postId:e,commentId:t,debug:a}}}}function D0(r){let e={blocks:void 0,emitSnapshots:void 0,emitState:void 0,realtime:void 0,runtime:void 0,surface:void 0,useAsync:void 0,payments:void 0},t={};for(let n in e)t[n.toLowerCase()]=n;let i={};for(let n of(r[B.Debug]?.values??[]).join().split(",")){let[o,a]=n.split("=");o&&(o=o.trim(),a=a?.trim(),o.toLowerCase()in t&&(o=t[o.toLowerCase()]),i[o]??(i[o]=a||`${!0}`))}return r[B.Debug]&&console.info(`[api] @devvit/public-api v${Dy.version} ${Object.entries(i).map(([n,o])=>`${n}=${o}`).join(" ")}`),{...i,metadata:r}}function _y(r){return r.flatMap(e=>e.type==="group"?_y(e.fields):e)}async function Md(r,e,t){if(!e)throw new Error("Settings were not defined.");let i=_0.fromPartial({success:!0,errors:{}}),n=Ct(r.fieldValues),o=_y(e);return await Promise.all(o.map(async a=>{let c=a.name;if(c&&a.onValidate){let p=n[c],f=a.onValidate,v=Object.assign(Me({metadata:t}),oe(t)),m=await f({value:p,isEditing:r.editing},v);m&&(i.success=!1,i.errors[c]=m)}})),i}async function j0(){if(!u.appSettings)throw new Error("App settings were not defined.");return q0.fromPartial({fields:{fields:ot(u.appSettings)}})}async function H0(r,e){return Md(r,u.appSettings,e)}function Ny(r){r.provides(N0),L("GetAppSettingsFields",j0),L("ValidateAppForm",H0)}import{CustomPostDefinition as K0}from"@devvit/protos";import{BlockRenderEventType as mm,EffectType as ib}from"@devvit/protos";function gi(r){return r.__effects}function qy(){let r=new Set;return e=>{let t=e,i=1;for(;r.has(t);)t=`${e}.${i++}`;return r.add(t),t}}import{BlockActionType as cm,BlockAnimationDirection as Xy,BlockAnimationLoopMode as Zy,BlockAnimationType as Yy,BlockAvatarBackground as Qy,BlockAvatarFacing as eb,BlockAvatarSize as Tt,BlockBorderWidth as Dd,BlockButtonAppearance as At,BlockButtonSize as im,BlockFullSnooSize as vi,BlockGap as _d,BlockHorizontalAlignment as nm,BlockIconSize as Nd,BlockImageResizeMode as cs,BlockPadding as ms,BlockRadius as ps,BlockSpacerShape as sm,BlockSpacerSize as qd,BlockStackDirection as om,BlockTextOutline as am,BlockTextOverflow as dm,BlockTextSize as yi,BlockTextStyle as lm,BlockTextWeight as tb,BlockType as Le,BlockVerticalAlignment as um}from"@devvit/protos";var Qc={transparent:"transparent",black:"#000000",white:"#ffffff","coolgray-950":"#04090A","coolgray-900":"#0B1416","coolgray-850":"#0F1A1C","coolgray-800":"#131F23","coolgray-750":"#1A282D","coolgray-700":"#223237","coolgray-650":"#2A3C42","coolgray-600":"#33464C","coolgray-550":"#4B6066","coolgray-525":"#576F76","coolgray-500":"#667A80","coolgray-450":"#82959B","coolgray-400":"#A0B0B5","coolgray-350":"#B8C5C9","coolgray-300":"#D2DADD","coolgray-250":"#DAE0E3","coolgray-200":"#E2E7E9","coolgray-150":"#EAEDEF","coolgray-100":"#F2F4F5","coolgray-50":"#F9FAFA","puregray-950":"#080808","puregray-900":"#131313","puregray-850":"#181818","puregray-800":"#1E1E1E","puregray-750":"#272727","puregray-700":"#303030","puregray-650":"#393939","puregray-600":"#434343","puregray-550":"#5C5C5C","puregray-500":"#767676","puregray-450":"#919191","puregray-400":"#ACACAC","puregray-350":"#C3C3C3","puregray-300":"#D6D6D6","puregray-250":"#DDDDDD","puregray-200":"#E4E4E4","puregray-150":"#EBEBEB","puregray-100":"#F2F2F2","puregray-50":"#F8F8F8","orangered-950":"#190600","orangered-900":"#340E00","orangered-800":"#4F1500","orangered-700":"#721F00","orangered-600":"#962900","orangered-500":"#D93A00","orangered-400":"#FE7C53","orangered-300":"#FFBEA6","orangered-200":"#FFD5C6","orangered-100":"#FFEDE5","orangered-50":"#FFF6F3","red-950":"#1C0004","red-900":"#3A0008","red-800":"#58000C","red-700":"#7E0011","red-600":"#A50016","red-500":"#EB001F","red-400":"#FF6E80","red-300":"#FFADB8","red-200":"#FFCCD2","red-100":"#FFEAED","red-50":"#FFF6F7","sakurapink-950":"#1A0011","sakurapink-900":"#360024","sakurapink-800":"#530037","sakurapink-700":"#770051","sakurapink-600":"#9B006A","sakurapink-500":"#E00096","sakurapink-400":"#FF55BD","sakurapink-300":"#FFA5E3","sakurapink-200":"#FFC5EC","sakurapink-100":"#FFE5F9","sakurapink-50":"#FFF3FB","berrypurple-950":"#16001F","berrypurple-900":"#2E0041","berrypurple-800":"#470062","berrypurple-700":"#66008C","berrypurple-600":"#8700B5","berrypurple-500":"#BC0EFF","berrypurple-400":"#D55EFF","berrypurple-300":"#EEA7FF","berrypurple-200":"#F2C8FF","berrypurple-100":"#FBE6FF","berrypurple-50":"#FCF4FF","periwinkle-950":"#0D0B1F","periwinkle-900":"#1A1741","periwinkle-800":"#272262","periwinkle-700":"#372F8C","periwinkle-600":"#453BB5","periwinkle-500":"#6A5CFF","periwinkle-400":"#988EFF","periwinkle-300":"#C3BDFF","periwinkle-200":"#D8D4FF","periwinkle-100":"#ECEAFF","periwinkle-50":"#F7F6FF","alienblue-950":"#000C1D","alienblue-900":"#00183D","alienblue-800":"#00255D","alienblue-700":"#003584","alienblue-600":"#0045AC","alienblue-500":"#1870F4","alienblue-400":"#629FFF","alienblue-300":"#A7CCFF","alienblue-200":"#C6DCFF","alienblue-100":"#E4EFFF","alienblue-50":"#F3F7FF","lightblue-950":"#000D12","lightblue-900":"#001C26","lightblue-800":"#002A3A","lightblue-700":"#003F56","lightblue-600":"#005472","lightblue-500":"#007FAE","lightblue-400":"#47B0DB","lightblue-300":"#95DCFB","lightblue-200":"#B6E9FF","lightblue-100":"#D9F6FF","lightblue-50":"#ECFAFF","mintgreen-950":"#00100E","mintgreen-900":"#001E1B","mintgreen-800":"#002E28","mintgreen-700":"#00443C","mintgreen-600":"#005A4F","mintgreen-500":"#008675","mintgreen-400":"#45B9AB","mintgreen-300":"#96E1D8","mintgreen-200":"#B7ECE5","mintgreen-100":"#DAF7F4","mintgreen-50":"#ECFBF9","kiwigreen-950":"#021000","kiwigreen-900":"#032200","kiwigreen-800":"#053200","kiwigreen-700":"#084A00","kiwigreen-600":"#0A6000","kiwigreen-500":"#0E8A00","kiwigreen-400":"#55BD46","kiwigreen-300":"#A3E398","kiwigreen-200":"#BFEEB8","kiwigreen-100":"#DFF8DB","kiwigreen-50":"#EEFCED","lime-950":"#0C0E00","lime-900":"#1A1F00","lime-800":"#282F00","lime-700":"#3A4501","lime-600":"#4D5A01","lime-500":"#6B7E01","lime-400":"#A1B33B","lime-300":"#CFDB83","lime-200":"#DFE8A6","lime-100":"#EFF4CC","lime-50":"#F7FAE5","yellow-950":"#100D01","yellow-900":"#251E02","yellow-800":"#382D03","yellow-700":"#504104","yellow-600":"#665505","yellow-500":"#8F7407","yellow-400":"#DBAF00","yellow-300":"#FADB61","yellow-200":"#FFE88F","yellow-100":"#FFF2BD","yellow-50":"#FFFAE5","yelloworange-950":"#150C00","yelloworange-900":"#2C1A00","yelloworange-800":"#432700","yelloworange-700":"#623A00","yelloworange-600":"#814C00","yelloworange-500":"#B06400","yelloworange-400":"#FF9C1A","yelloworange-300":"#FFCD7C","yelloworange-200":"#FFDDA8","yelloworange-100":"#FFF0D3","yelloworange-50":"#FFF7EA","poopbrown-950":"#110B04","poopbrown-900":"#29190A","poopbrown-800":"#3B2510","poopbrown-700":"#54371A","poopbrown-600":"#6E4924","poopbrown-500":"#9A6D3F","poopbrown-400":"#CAA075","poopbrown-300":"#EECCAA","poopbrown-200":"#F6DDC3","poopbrown-100":"#FEEEDD","poopbrown-50":"#FEF7EE",pizzaRed:{light:"#ef5350",dark:"#c62828"},"global-brand-orangered":{light:"#FF4500",dark:"#FF4500"},"global-focus":{light:"#47B0DB",dark:"#007FAE"},"interactive-content-disabled":{light:"#0000003f",dark:"#ffffff3f"},"interactive-background-disabled":{light:"#0000000c",dark:"#ffffff0c"},"interactive-pressed":{light:"#00000028",dark:"#ffffff28"},"neutral-content":{light:"#2A3C42",dark:"#B8C5C9"},"neutral-content-disabled":{light:"#D6D6D6",dark:"#303030"},"neutral-content-weak":{light:"#576F76",dark:"#82959B"},"neutral-content-strong":{light:"#0F1A1C",dark:"#F2F4F5"},"neutral-background":{light:"#ffffff",dark:"#0B1416"},"neutral-background-selected":{light:"#EAEDEF",dark:"#1A282D"},"neutral-background-weak":{light:"#F9FAFA",dark:"#04090A"},"neutral-background-medium":{light:"#F8F8F8",dark:"#131313"},"neutral-background-strong":{light:"#ffffff",dark:"#0F1A1C"},"neutral-background-hover":{light:"#F2F4F5",dark:"#131F23"},"neutral-border":{light:"#00000033",dark:"#ffffff33"},"neutral-border-medium":{light:"#0000007f",dark:"#ffffff7f"},"neutral-border-weak":{light:"#00000019",dark:"#ffffff19"},"neutral-border-strong":{light:"#0F1A1C",dark:"#F2F4F5"},primary:{light:"#0045AC",dark:"#629FFF"},"primary-hover":{light:"#003584",dark:"#A7CCFF"},"primary-visited":{light:"#8700B5",dark:"#D55EFF"},"primary-onBackground":{light:"#ffffff",dark:"#ffffff"},"primary-onBackground-selected":{light:"#ffffff",dark:"#000000"},"primary-background":{light:"#0045AC",dark:"#0045AC"},"primary-background-hover":{light:"#003584",dark:"#1870F4"},"primary-background-selected":{light:"#00255D",dark:"#629FFF"},secondary:{light:"#0F1A1C",dark:"#F2F4F5"},"secondary-hover":{light:"#000000",dark:"#ffffff"},"secondary-weak":{light:"#576F76",dark:"#82959B"},"secondary-onBackground":{light:"#000000",dark:"#ffffff"},"secondary-background":{light:"#EAEDEF",dark:"#1A282D"},"secondary-background-hover":{light:"#E2E7E9",dark:"#223237"},"secondary-background-selected":{light:"#D2DADD",dark:"#33464C"},"secondary-plain":{light:"#0F1A1C",dark:"#F2F4F5"},"secondary-plain-hover":{light:"#000000",dark:"#ffffff"},"danger-background":{light:"#EB001F",dark:"#A50016"},"danger-background-disabled":{light:"#FFCCD2",dark:"#3A0008"},"danger-background-hover":{light:"#A50016",dark:"#EB001F"},"danger-onBackground":{light:"#ffffff",dark:"#ffffff"},"danger-content":{light:"#A50016",dark:"#FF6E80"},"danger-content-hover":{light:"#7E0011",dark:"#FFADB8"},"danger-content-default":{light:"#ffffff",dark:"#ffffff"},"brand-background":{light:"#D93A00",dark:"#D93A00"},"brand-onBackground":{light:"#ffffff",dark:"#ffffff"},"brand-background-hover":{light:"#962900",dark:"#962900"},"media-background":{light:"#00000099",dark:"#00000099"},"media-onbackground":{light:"#ffffff",dark:"#ffffff"},"media-onbackground-weak":{light:"#E2E7E9",dark:"#E2E7E9"},"media-background-hover":{light:"#000000cc",dark:"#000000cc"},"media-onbackground-disabled":{light:"#ffffff3f",dark:"#ffffff3f"},"media-border-selected":{light:"#ffffff",dark:"#ffffff"},"media-background-selected":{light:"#000000cc",dark:"#000000cc"},"success-content":{light:"#0A6000",dark:"#55BD46"},"success-hover":{light:"#084A00",dark:"#A3E398"},"success-onBackground":{light:"#ffffff",dark:"#ffffff"},"success-background":{light:"#0E8A00",dark:"#0A6000"},"success-background-hover":{light:"#0A6000",dark:"#0E8A00"},"warning-content":{light:"#665505",dark:"#DBAF00"},"warning-content-hover":{light:"#504104",dark:"#FADB61"},"warning-onBackground":{light:"#000000",dark:"#000000"},"warning-background":{light:"#DBAF00",dark:"#DBAF00"},"warning-background-hover":{light:"#8F7407",dark:"#FADB61"},"upvote-content":{light:"#962900",dark:"#FE7C53"},"upvote-content-weak":{light:"#FF4500",dark:"#FF4500"},"upvote-disabled":{light:"#9629004c",dark:"#FE7C534c"},"upvote-onBackground":{light:"#ffffff",dark:"#ffffff"},"upvote-background":{light:"#D93A00",dark:"#D93A00"},"upvote-background-hover":{light:"#962900",dark:"#962900"},"upvote-background-disabled":{light:"#D93A004c",dark:"#D93A004c"},"downvote-content":{light:"#453BB5",dark:"#988EFF"},"downvote-content-weak":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-disabled":{light:"#453BB54c",dark:"#988EFF4c"},"downvote-onBackground":{light:"#ffffff",dark:"#ffffff"},"downvote-background":{light:"#6A5CFF",dark:"#453BB5"},"downvote-background-hover":{light:"#453BB5",dark:"#453BB5"},"downvote-background-disabled":{light:"#6A5CFF4c",dark:"#6A5CFF4c"},"brand-gradient-default":{light:"",dark:""},"brand-gradient-default-highlight":{light:"",dark:""},"brand-gradient-hover":{light:"",dark:""},"brand-gradient-hover-highlight":{light:"",dark:""},"brand-gradient-active":{light:"",dark:""},"brand-gradient-active-highlight":{light:"",dark:""},"gradient-media":{light:"",dark:""},"gradient-media-strong":{light:"",dark:""},"transparent-background-hover":{light:"#82959B19",dark:"#667A8019"},"global-black":{light:"#000000",dark:"#000000"},"global-white":{light:"#ffffff",dark:"#ffffff"},"global-orangered":{light:"#D93A00",dark:"#D93A00"},"global-alienblue":{light:"#1870F4",dark:"#1870F4"},"global-darkblue":{light:"#131F23",dark:"#131F23"},"tone-1":{light:"#131313",dark:"#F2F2F2"},"tone-2":{light:"#434343",dark:"#ACACAC"},"tone-3":{light:"#ACACAC",dark:"#434343"},"tone-4":{light:"#E4E4E4",dark:"#303030"},"tone-5":{light:"#F2F2F2",dark:"#1E1E1E"},"tone-6":{light:"#F8F8F8",dark:"#131313"},"tone-7":{light:"#ffffff",dark:"#080808"},"action-upvote":{light:"#D93A00",dark:"#D93A00"},"action-downvote":{light:"#6A5CFF",dark:"#6A5CFF"},"alert-caution":{light:"#8F7407",dark:"#8F7407"},"identity-admin":{light:"#D93A00",dark:"#D93A00"},"identity-moderator":{light:"#0E8A00",dark:"#0E8A00"},"identity-self":{light:"#008675",dark:"#008675"},"identity-coins":{light:"#DBAF00",dark:"#DBAF00"},"category-live":{light:"#D93A00",dark:"#D93A00"},"category-nsfw":{light:"#E00096",dark:"#E00096"},"category-spoiler":{light:"#131313",dark:"#F2F2F2"},"ui-canvas":{light:"#F2F2F2",dark:"#080808"},"ui-modalbackground":{light:"#ffffff",dark:"#0F1A1C"},"avatar-gradient":{light:"",dark:""},"opacity-highlight":{light:"",dark:""},"opacity-08":{light:"#13131314",dark:"#13131314"},"opacity-50":{light:"#0000007f",dark:"#F2F2F27f"},scrim:{light:"#00000099",dark:"#00000099"},"scrim-strong":{light:"#000000cc",dark:"#000000cc"},"scrim-gradient":{light:"",dark:""},online:{light:"#55BD46",dark:"#55BD46"},favorite:{light:"#8F7407",dark:"#DBAF00"}};var jy={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",transparent:"#FFFFFF00",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},Hy=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),Wy=r=>r in Qc,em=r=>r in jy,Gy=r=>!!r.match(/^rgba?\(.*/),Vy=r=>!!r.match(/^hsla?\(.*/),zy=(r,e="light")=>{if(em(r))return Ld(r);let i=Qc[r];return typeof i=="string"?i:i[e]},Ld=r=>jy[r]??r,Jy=r=>{let[e,t,i,n]=r.replace(/^rgba?\(|\s+|\)$/g,"").split(",");if(!e||!t||!i)return r;let a=[...[e,t,i].map(p=>parseFloat(p))];if(n){let p=parseFloat(n),f=Math.round(p*255);a.push(f)}return`#${a.map(p=>p.toString(16).padStart(2,"0")).join("")}`};import{BlockStackDirection as Ud}from"@devvit/protos";var tm={stackParentLayout:{hasHeight:!0,hasWidth:!0,direction:Ud.UNRECOGNIZED,alignment:void 0}};function Ky(r,e,t){if(!e)return{hasHeight:!1,hasWidth:!1};let{growDirection:i,stretchDirection:n}=W0(r?.grow,e.direction,e.alignment),o=t?.height?.value?.value||t?.height?.min?.value||$y(2,i,n,e.hasHeight),a=t?.width?.value?.value||t?.width?.min?.value||$y(1,i,n,e.hasWidth);return{hasHeight:!!o,hasWidth:!!a}}function $y(r,e,t,i){return e===r&&i||t===r&&i}function W0(r,e,t){let i=e===Ud.STACK_VERTICAL||e===Ud.UNRECOGNIZED,n=e===Ud.STACK_HORIZONTAL,o=0;n&&r?o=1:i&&r&&(o=2);let a=t===void 0||t.horizontal===void 0,c=t===void 0||t.vertical===void 0,p=n?!!c:i?!!a:!1,f=0;return n&&p?f=2:i&&p&&(f=1),{growDirection:o,stretchDirection:f}}import{BlockSizeUnit as mr,BlockStackDirection as Bd}from"@devvit/protos";function hi(r){if(r==null)return;if(typeof r=="number")return{value:r,unit:mr.SIZE_UNIT_PERCENT};let e=r.match(/^(\d+(?:\.\d+)?)(px|%)?$/);if(e==null)return;let t=mr.SIZE_UNIT_PERCENT;return e.at(2)==="px"&&(t=mr.SIZE_UNIT_PIXELS),{value:Number.parseFloat(e[1]),unit:t}}function G0(r,e){return(r.width?.value?.unit===mr.SIZE_UNIT_PERCENT||r.width?.min?.unit===mr.SIZE_UNIT_PERCENT)&&(e.direction===Bd.STACK_HORIZONTAL||e.direction===Bd.STACK_DEPTH)&&(e.hasWidth||(r.width=void 0)),(r.height?.value?.unit===mr.SIZE_UNIT_PERCENT||r.height?.min?.unit===mr.SIZE_UNIT_PERCENT)&&(e.direction===Bd.STACK_VERTICAL||e.direction===Bd.STACK_DEPTH)&&(e.hasHeight||(r.height=void 0)),r}function rm(r,e){if(r){let t=r.width!=null||r.minWidth!=null||r.maxWidth!=null,i=r.height!=null||r.minHeight!=null||r.maxHeight!=null;if(t||i||r.grow!=null){let n={width:t?{value:hi(r.width),min:hi(r.minWidth),max:hi(r.maxWidth)}:void 0,height:i?{value:hi(r.height),min:hi(r.minHeight),max:hi(r.maxHeight)}:void 0,grow:r.grow};return e.stackParentLayout&&(n=G0(n,e.stackParentLayout)),n}}}var rb="data-",V0=new Set(["onPress","onMessage"]),z0=new Map([["onPress",cm.ACTION_CLICK],["onMessage",cm.ACTION_WEBVIEW]]),fs,bi=class{constructor(e=()=>{}){d(this,fs,void 0);l(this,fs,e)}createBlocksElementOrThrow({type:e,props:t,children:i}){let n=this.createBlocksElement({type:e,props:t,children:i},tm);if(!n)throw new Error(`Could not create block of type ${e}`);return n}createBlocksElement({type:e,props:t,children:i},n){switch(e){case"blocks":return this.makeRoot(t,...i);case"hstack":return this.makeHStack(t,n,...i);case"vstack":return this.makeVStack(t,n,...i);case"zstack":return this.makeZStack(t,n,...i);case"text":return this.makeText(t,n,...i);case"button":return this.makeButton(t,n,...i);case"image":return this.makeImage(t,n);case"spacer":return this.makeSpacer(t,n);case"icon":return this.makeIcon(t,n);case"avatar":return this.makeAvatar(t,n);case"fullsnoo":return this.makeFullSnoo(t,n);case"animation":return this.makeAnimation(t,n);case"webview":return this.makeWebView(t,n);case"__fragment":throw new Error("root fragment is not supported - use 'blocks' instead")}}makeRootHeight(e){switch(e){case"regular":return 320;case"tall":return 512}}makeBlockPadding(e){switch(e){case"none":return ms.PADDING_NONE;case"xsmall":return ms.PADDING_XSMALL;case"small":return ms.PADDING_SMALL;case"medium":return ms.PADDING_MEDIUM;case"large":return ms.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return ps.RADIUS_NONE;case"small":return ps.RADIUS_SMALL;case"medium":return ps.RADIUS_MEDIUM;case"large":return ps.RADIUS_LARGE;case"full":return ps.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return _d.GAP_NONE;case"small":return _d.GAP_SMALL;case"medium":return _d.GAP_MEDIUM;case"large":return _d.GAP_LARGE}}makeBlockAlignment(e){if(e===void 0)return;let t,i;if(e.includes("top")?t=um.ALIGN_TOP:e.includes("middle")?t=um.ALIGN_MIDDLE:e.includes("bottom")&&(t=um.ALIGN_BOTTOM),e.includes("start")?i=nm.ALIGN_START:e.includes("center")?i=nm.ALIGN_CENTER:e.includes("end")&&(i=nm.ALIGN_END),t!==void 0||i!==void 0)return{vertical:t,horizontal:i}}makeBlockBorder(e,t,i,n){if(!e&&!t)return;let o;switch(e){case"none":o=Dd.BORDER_WIDTH_NONE;break;case"thin":o=Dd.BORDER_WIDTH_THIN;break;case"thick":o=Dd.BORDER_WIDTH_THICK;break;default:o=Dd.BORDER_WIDTH_THIN;break}let a=t??"neutral-border-weak",c=this.getThemedColors(a,i,n);return{width:o,color:c?.light,colors:c}}makeBlockTextSize(e){switch(e){case"xsmall":return yi.TEXT_SIZE_XSMALL;case"small":return yi.TEXT_SIZE_SMALL;case"medium":return yi.TEXT_SIZE_MEDIUM;case"large":return yi.TEXT_SIZE_LARGE;case"xlarge":return yi.TEXT_SIZE_XLARGE;case"xxlarge":return yi.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return lm.TEXT_STYLE_BODY;case"metadata":return lm.TEXT_STYLE_METADATA;case"heading":return lm.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return am.TEXT_OUTLINE_NONE;case"thin":return am.TEXT_OUTLINE_THIN;case"thick":return am.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return tb.TEXT_WEIGHT_REGULAR;case"bold":return tb.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return dm.TEXT_OVERFLOW_CLIP;case"ellipsis":return dm.TEXT_OVERFLOW_ELLIPSE}return dm.TEXT_OVERFLOW_ELLIPSE}makeBlockButtonAppearance(e){switch(e){case"secondary":return At.BUTTON_APPEARANCE_SECONDARY;case"primary":return At.BUTTON_APPEARANCE_PRIMARY;case"plain":return At.BUTTON_APPEARANCE_PLAIN;case"bordered":return At.BUTTON_APPEARANCE_BORDERED;case"media":return At.BUTTON_APPEARANCE_MEDIA;case"destructive":return At.BUTTON_APPEARANCE_DESTRUCTIVE;case"caution":return At.BUTTON_APPEARANCE_CAUTION;case"success":return At.BUTTON_APPEARANCE_SUCCESS}}makeBlockButtonSize(e){switch(e){case"small":return im.BUTTON_SIZE_SMALL;case"medium":return im.BUTTON_SIZE_MEDIUM;case"large":return im.BUTTON_SIZE_LARGE}}makeBlockImageResizeMode(e){switch(e){case"none":return cs.IMAGE_RESIZE_NONE;case"fit":return cs.IMAGE_RESIZE_FIT;case"fill":return cs.IMAGE_RESIZE_FILL;case"cover":return cs.IMAGE_RESIZE_COVER;case"scale-down":return cs.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return qd.SPACER_XSMALL;case"small":return qd.SPACER_SMALL;case"medium":return qd.SPACER_MEDIUM;case"large":return qd.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return sm.SPACER_INVISIBLE;case"thin":return sm.SPACER_THIN;case"square":return sm.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return Nd.ICON_SIZE_XSMALL;case"small":return Nd.ICON_SIZE_SMALL;case"medium":return Nd.ICON_SIZE_MEDIUM;case"large":return Nd.ICON_SIZE_LARGE}}makeBlockAvatarSize(e){switch(e){case"xxsmall":return Tt.AVATAR_SIZE_XXSMALL;case"xsmall":return Tt.AVATAR_SIZE_XSMALL;case"small":return Tt.AVATAR_SIZE_SMALL;case"medium":return Tt.AVATAR_SIZE_MEDIUM;case"large":return Tt.AVATAR_SIZE_LARGE;case"xlarge":return Tt.AVATAR_SIZE_XXLARGE;case"xxlarge":return Tt.AVATAR_SIZE_XXLARGE;case"xxxlarge":return Tt.AVATAR_SIZE_XXXLARGE}}makeBlockAvatarFacing(e){switch(e){case"left":return eb.AVATAR_FACING_LEFT;case"right":return eb.AVATAR_FACING_RIGHT}}makeBlockFullSnooSize(e){switch(e){case"xsmall":return vi.FULLSNOO_XSMALL;case"small":return vi.FULLSNOO_SMALL;case"medium":return vi.FULLSNOO_MEDIUM;case"large":return vi.FULLSNOO_LARGE;case"xlarge":return vi.FULLSNOO_XLARGE;case"xxlarge":return vi.FULLSNOO_XXLARGE}}makeBlockAvatarBackground(e){switch(e){case"dark":return Qy.AVATAR_BG_DARK;case"light":return Qy.AVATAR_BG_LIGHT}}makeBlockAnimationType(e){return e==="lottie"||e===void 0?Yy.ANIM_LOTTIE:Yy.UNRECOGNIZED}makeBlockAnimationDirection(e){switch(e){case"backward":return Xy.ANIM_DIR_BACKWARD;case"forward":return Xy.ANIM_DIR_FORWARD}}makeBlockLoopMode(e){switch(e){case"repeat":return Zy.ANIM_LOOP_REPEAT;case"bounce":return Zy.ANIM_LOOP_BOUNCE}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(rb)).reduce((t,i)=>(t[i.substring(rb.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);return V0.forEach(o=>{if(o in t){let a=t[o];i.push({type:z0.get(o)??cm.UNRECOGNIZED,id:a.toString(),data:n})}}),i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),Hy(e)?e:Wy(e)?zy(e,t):em(e)?Ld(e):Gy(e)?Jy(e):Vy(e)?e:(console.warn(`Could not parse color: ${e}.`),Ld("red"))}childrenToBlocks(e,t){return e.flatMap(i=>(typeof i!="string"?this.createBlocksElement(i,t):void 0)??[])}getThemedColors(e,t,i){let n=this.blockColorToHex(t,"light"),o=this.blockColorToHex(i,"dark"),a=[];if(e&&(!n||!o)){let c=Array.from(e?.matchAll(/[\w#-]+(?:\([\w\t ,.#-]+\))?/g)??[]);a.push(...c.map(p=>p[0]))}return n||(n=this.blockColorToHex(a?.at(0),"light")),o||(o=this.blockColorToHex(a?.at(1)??a?.at(0),"dark")),n||o?{light:n,dark:o}:void 0}parsePixels(e){return typeof e=="string"?Number(e.slice(0,-2)):e}resolveAssetUrl(e,t){return s(this,fs).call(this)?.getURL(e,t)??e}childrenToString(e){return e.map(t=>t.toString()).join("")}makeRoot(e,...t){return this.wrapRoot(e,this.childrenToBlocks(t,tm))}wrapRoot(e,t){return this.makeBlock(Le.BLOCK_ROOT,{},{},{rootConfig:{children:t,height:this.makeRootHeight(u.customPostType?.height??e?.height??"regular")}})}makeStackBlock(e,t,i,n){let o=this.getThemedColors(t?.backgroundColor,t?.lightBackgroundColor,t?.darkBackgroundColor),a=this.makeBlockAlignment(t?.alignment),c=rm(t,i),p=Ky(t,i.stackParentLayout,c);return this.makeBlock(Le.BLOCK_STACK,t,i,{stackConfig:{alignment:a,backgroundColor:o?.light,backgroundColors:o,border:this.makeBlockBorder(t?.border,t?.borderColor,t?.lightBorderColor,t?.darkBorderColor),children:this.childrenToBlocks(n,{stackParentLayout:{...p,direction:e,alignment:a}}),cornerRadius:this.makeBlockRadius(t?.cornerRadius),direction:e,gap:this.makeBlockGap(t?.gap),padding:this.makeBlockPadding(t?.padding),reverse:t?.reverse}})}makeHStack(e,t,...i){return this.makeStackBlock(om.STACK_HORIZONTAL,e,t,i)}makeVStack(e,t,...i){return this.makeStackBlock(om.STACK_VERTICAL,e,t,i)}makeZStack(e,t,...i){return this.makeStackBlock(om.STACK_DEPTH,e,t,i)}makeText(e,t,...i){let n=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(Le.BLOCK_TEXT,e,t,{textConfig:{alignment:this.makeBlockAlignment(e?.alignment),color:n?.light,colors:n,outline:this.makeBlockTextOutline(e?.outline),size:this.makeBlockTextSize(e?.size),style:this.makeBlockTextStyle(e?.style),text:this.childrenToString(i),weight:this.makeBlockTextWeight(e?.weight),selectable:e?.selectable,wrap:e?.wrap,overflow:this.makeBlockTextOverflow(e?.overflow)}})}makeButton(e,t,...i){let n=this.getThemedColors(e?.textColor,e?.lightTextColor,e?.darkTextColor);return this.makeBlock(Le.BLOCK_BUTTON,e,t,{buttonConfig:{buttonAppearance:this.makeBlockButtonAppearance(e?.appearance),icon:e?.icon,buttonSize:this.makeBlockButtonSize(e?.size),text:this.childrenToString(i),textColor:n?.light,textColors:n,disabled:e?.disabled}})}makeImage(e,t){return e&&this.makeBlock(Le.BLOCK_IMAGE,e,t,{imageConfig:{description:e?.description,resizeMode:this.makeBlockImageResizeMode(e.resizeMode),url:this.resolveAssetUrl(e.url),width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight)}})}makeSpacer(e,t){return this.makeBlock(Le.BLOCK_SPACER,e,t,{spacerConfig:{size:this.makeBlockSpacerSize(e?.size),shape:this.makeBlockSpacerShape(e?.shape)}})}makeIcon(e,t){let i=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return e&&this.makeBlock(Le.BLOCK_ICON,e,t,{iconConfig:{icon:e.name,color:i?.light,colors:i,size:this.makeBlockIconSize(e.size)}})}makeAvatar(e,t){return e&&this.makeBlock(Le.BLOCK_AVATAR,e,t,{avatarConfig:{thingId:e.thingId,size:this.makeBlockAvatarSize(e.size),facing:this.makeBlockAvatarFacing(e.facing),background:this.makeBlockAvatarBackground(e.background)}})}makeFullSnoo(e,t){return e&&this.makeBlock(Le.BLOCK_FULLSNOO,e,t,{fullsnooConfig:{userId:e.userId,facing:this.makeBlockAvatarFacing(e.facing),size:this.makeBlockFullSnooSize(e.size)}})}makeAnimation(e,t){return e&&this.makeBlock(Le.BLOCK_ANIMATION,e,t,{animationConfig:{type:this.makeBlockAnimationType(e.type),url:this.resolveAssetUrl(e.url),loop:e.loop,loopMode:this.makeBlockLoopMode(e.loopMode),autoplay:e.autoplay,width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight),direction:this.makeBlockAnimationDirection(e.direction),speed:e.speed}})}makeWebView(e,t){return e&&this.makeBlock(Le.BLOCK_WEBVIEW,e,t,{webviewConfig:{url:this.resolveAssetUrl(e.url,{webview:!0}),state:e.state}})}makeBlock(e,t,i,n){return{type:e,sizes:rm(t,i),config:n,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}ensureRootBlock(e){let t=e;if(t.type===Le.BLOCK_ROOT)return t.config?.rootConfig&&u.customPostType?.height&&(t.config.rootConfig.height=this.makeRootHeight(u.customPostType?.height)),t;let i=this.wrapRoot(void 0,[t]);if(!i)throw new Error("Could not create root block");return i}};fs=new WeakMap;function nb(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var sb=r=>{let e="",t=r.props?Object.keys(r.props).map(i=>i==="onPress"?"":`${i}="${r.props[i]}"`).join(" "):"";e+=`<${r.type}${t?" "+t:""}>`;for(let i of r.children)typeof i=="string"?e+=i:e+=sb(i);return e+=`</${r.type}>`,e};function J0(r){return" ".repeat(r)}function $0(r){let e="",t=0,i=r.split(/>\s*</);for(let n=0;n<i.length;n++){let o=i[n];n===0&&(o=o.trim()),n===i.length-1&&(o=o.trim());let a=o.charAt(0)==="/";a&&t--,e+=J0(t),n!==0&&(e+="<"),e+=o,n!==i.length-1&&(e+=`>
2
- `),!a&&o.indexOf("</")===-1&&o.charAt(o.length-1)!=="/"&&t++}return e}var jd,ob,pr,gs,hs,pm,vs,at=class{constructor(e,t,i,n,o){d(this,jd);d(this,pr);d(this,hs);this.renderState={};this.currentComponentKey=[];this.currentHookIndex=0;this.actions=new Map;this.forms=new Map;this.realtimeChannels=[];this.realtimeUpdated=!1;this.pendingHooks=[];this.isRendering=!1;this.transformer=new bi(()=>this.assets);this.effects=[];d(this,vs,!1);this.component=e,this.event=t,this.state={__renderState:{},...i},this.metadata=n,this.state.__realtimeChannels&&(this.realtimeChannels=this.state.__realtimeChannels);let a=Me({reconciler:this,hooks:!0,ui:!0,metadata:n});this.cache=a.cache,this.modLog=a.modLog,this.reddit=a.reddit,this.kvStore=a.kvStore,this.redis=a.redis,this.settings=a.settings,this.scheduler=a.scheduler,this.media=a.media,this.assets=a.assets,this.realtime=a.realtime,this.dimensions=o,this.ui=a.ui,this.hooks={useState:a.useState,useInterval:a.useInterval,useForm:a.useForm,useChannel:a.useChannel}}emitEffect(e,t){this.effects.push(t)}async render(){await this.reconcile(),this.isRendering=!0;let e=await this.buildBlocksUI();return this.isRendering=!1,e}makeUniqueActionID(e){let t=e,i=1;for(;this.actions.has(t);)t=`${e}.${i++}`;return t}async reconcile(){let e=S(this,pr,gs).call(this),t={type:this.component,props:e,children:[]},i=await this.processBlock(t);if(nb(i),this.transformer.createBlocksElementOrThrow(i),this.isUserActionRender&&this.blockRenderEventId){let n=this.actions.get(this.blockRenderEventId);n&&await n(this.event.data)}for(let n of this.pendingHooks)await n();this.buildNextState(),S(this,jd,ob).call(this)}async buildBlocksUI(){let e=S(this,pr,gs).call(this),t={type:this.component,props:e,children:[]},i=await this.renderElement(e,t);return this.transformer.ensureRootBlock(i)}async renderElement(e,t){let i=await this.processBlock(t);return nb(i),(u.debug.emitSnapshots||e.debug.emitSnapshots)&&console.debug($0(sb(i))),(u.debug.emitState||e.debug.emitState)&&console.debug(JSON.stringify(this.state,void 0,2)),this.transformer.createBlocksElementOrThrow(i)}async processProps(e){let t=e.props??{},i=["onPress","onMessage"];for(let n of i)if(n in t){let o=t[n],a=o?.name,c=this.makeUniqueActionID(`${e.type}.${a??n}`);this.actions.set(c,o),t[n]=c}}async processBlock(e,t=qy(),i=[]){let n=e;if(typeof n.type=="string"){let c=[];for(let m=0;m<n.children.length;m++){let b=n.children[m];b!=null&&c.push(await this.processBlock(b,t,[...i,`${n.type}.${m}`]))}let p=c.flat(),f=S(this,hs,pm).call(this,p);return await this.processProps(n),{type:n.type,props:n.props,children:f}}if(typeof n.type=="function"){let c=t(`${i.length?i.join("."):"root"}.${n.type.name.length?n.type.name:"anonymous"}`);this.currentComponentKey.push(c),this.renderState[c]||(this.renderState[c]={});let p=n.children.flatMap(m=>m),f={...S(this,pr,gs).call(this),...n.props,children:p},v;for(;v===void 0;)try{v=await n.type(f,S(this,pr,gs).call(this))}catch(m){if(m instanceof Promise)v=await m;else throw m}if(!this.isInitialRender){let m=this.getPreviousComponentState();if(Object.keys(m).length!==this.currentHookIndex)throw new Error("Invalid hook call. Hooks can only be called at the top-level of a function component. Make sure that you are not calling hooks inside loops, conditions, or nested functions.")}if(this.currentComponentKey.pop(),this.currentHookIndex=0,typeof v=="object")return this.processBlock(v,t,[...i,n.type.name])}if(typeof n=="string")return n;if(typeof n=="number")return`${n}`;let o=[],a="";return Array.isArray(n)?o=n:typeof n.type>"u"&&n.children&&(o=n.children,a="fragmentChild."),{type:"__fragment",props:void 0,children:await Promise.all(o.flatMap(async(c,p)=>await this.processBlock(c,t,[...i,`${a}${p}`])))}}getCurrentComponentKey(){if(!this.currentComponentKey.at(-1))throw new Error("Current component key is missing");return this.currentComponentKey}getCurrentComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.renderState[e]}getPreviousComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.state.__renderState[e]||(this.state.__renderState[e]={}),this.state.__renderState[e]}get isInitialRender(){return this.event?this.event.type===mm.RENDER_INITIAL:!1}get isUserActionRender(){return this.event?this.event.type===mm.RENDER_USER_ACTION:!1}get isEffectRender(){return this.event?this.event.type===mm.RENDER_EFFECT_EVENT:!1}get formSubmittedEvent(){return this.event?this.event.formSubmitted:!1}get blockRenderEventId(){return this.event?this.event.id:!1}get realtimeEvent(){if(!this.event)return!1;let e=this.event.realtimeEvent;return e?.event?.channel?e:!1}runHook(e){this.pendingHooks.push(e)}rerenderIn(e){s(this,vs)||(l(this,vs,!0),this.effects.push({type:ib.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:e/1e3}}))}addRealtimeChannel(e){this.realtimeChannels.push(e),this.realtimeUpdated=!0}removeRealtimeChannel(e){this.realtimeChannels=this.realtimeChannels.filter(t=>t!==e),this.realtimeUpdated=!0}get realtimeEffect(){return this.realtimeUpdated&&this.realtimeChannels.length>0?[{type:ib.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:this.realtimeChannels}}]:[]}getEffects(){return[...gi(this.ui),...this.effects,...this.realtimeEffect]}buildNextState(){for(let e of Object.keys(this.renderState))this.renderState[e]=Object.values(this.renderState[e]);this.state={__postData:this.state.__postData,__renderState:this.renderState,__cache:this.state.__cache,...this.realtimeChannels.length>0?{__realtimeChannels:this.realtimeChannels}:{}}}};jd=new WeakSet,ob=function(){this.actions.clear(),this.currentComponentKey=[],this.currentHookIndex=0,this.pendingHooks=[],this.realtimeChannels=[],this.realtimeUpdated=!1},pr=new WeakSet,gs=function(){let e={...oe(this.metadata,this.state.__postData?.thingId),modLog:this.modLog,reddit:this.reddit,cache:this.cache,kvStore:this.kvStore,redis:this.redis,settings:this.settings,scheduler:this.scheduler,media:this.media,assets:this.assets,realtime:this.realtime,ui:this.ui,dimensions:this.dimensions,uiEnvironment:{timezone:this.metadata[B.Timezone]?.values[0],locale:this.metadata[B.Language]?.values[0],dimensions:this.dimensions},...this.hooks};return e.debug.effects=this,e},hs=new WeakSet,pm=function(e){let t=[];for(let i of e)typeof i=="string"?t.push(i):i.type==="__fragment"?t.push(...S(this,hs,pm).call(this,i.children)):t.push(i);return t},vs=new WeakMap;async function X0(r,e){let t=u.customPostType;if(!t)throw new Error("Custom post type not registered");let i=new at((o,a)=>t.render(a),r.blocks,r.state,e,r.dimensions),n=await i.render();return{state:i.state,blocks:{ui:n},effects:i.getEffects()}}function ab(r){r.provides(K0),L("RenderPost",X0)}import{GetFieldsResponse as Z0,InstallationSettingsDefinition as Y0}from"@devvit/protos";async function Q0(){if(!u.installationSettings)throw new Error("Installation settings were not defined.");return Z0.fromPartial({fields:{fields:ot(u.installationSettings)}})}async function eE(r,e){return Md(r,u.installationSettings,e)}function db(r){r.provides(Y0),L("GetSettingsFields",Q0),L("ValidateForm",eE)}import{ContextActionDefinition as tE,ContextActionDescription as rE,ContextActionResponse as iE}from"@devvit/protos";var lb=r=>`menuItem.${r}`;function fm(r){return u.menuItems.find((e,t)=>lb(t)===r)}async function nE(r,e){let t=u.menuItems;if(!t.length)throw new Error("No menu items registered.");return{actions:t.map((n,o)=>rE.fromPartial({actionId:lb(o),name:n.label,description:n.description,contexts:{subreddit:n.location.includes("subreddit"),post:n.location.includes("post"),comment:n.location.includes("comment")},users:{loggedOut:n.forUserType?.includes("loggedOut"),member:n.forUserType?.includes("member"),moderator:n.forUserType?.includes("moderator")},postFilters:n.postFilter==="currentApp"?{currentApp:!0}:void 0}))}}async function sE(r,e){let t=fm(r.actionId);if(!t)throw new Error(`MenuItem ${r.actionId} not found`);let i=r.comment?.id&&`t1_${r.comment.id}`,n=r.post?.id&&`t3_${r.post.id}`,o=r.subreddit?.id&&`t5_${r.subreddit.id}`,a=i||n||o;g(a,"targetId is missing from ContextActionRequest");let c={targetId:a,location:r.comment?"comment":r.post?"post":"subreddit"},p=Object.assign(Me({ui:!0,metadata:e}),oe(e,n,i),{uiEnvironment:{timezone:e[B.Timezone]?.values[0],locale:e[B.Language]?.values[0]}});return await t.onPress(c,p),iE.fromPartial({effects:gi(p.ui)})}function ub(r){r.provides(tE),L("GetActions",nE),L("OnAction",sE)}function dt(r){return r?r===!0?!0:r.enabled:!1}import{SchedulerHandlerDefinition as oE}from"@devvit/protos";async function aE(r,e){let t=r.type,i=u.scheduledJobHandlers.get(t);if(!i)throw new Error(`Job ${t} not found`);let n={name:t,data:r.data},o=Object.assign(Me({metadata:e}),oe(e));await i(n,o)}function cb(r){r.provides(oE),L("HandleScheduledAction",aE)}import{HandlerResult as dE,OnAppInstallDefinition as lE,OnAppUpgradeDefinition as uE,OnCommentCreateDefinition as cE,OnCommentDeleteDefinition as mE,OnCommentReportDefinition as pE,OnCommentSubmitDefinition as fE,OnCommentUpdateDefinition as gE,OnModActionDefinition as hE,OnModMailDefinition as vE,OnPostCreateDefinition as yE,OnPostDeleteDefinition as bE,OnPostFlairUpdateDefinition as kE,OnPostReportDefinition as SE,OnPostSubmitDefinition as PE,OnPostUpdateDefinition as CE,OnPostNsfwUpdateDefinition as IE,OnPostSpoilerUpdateDefinition as wE}from"@devvit/protos";var Hd;(function(r){function e(o,a){return o.length<=a?o:`${o.slice(0,a-1)}\u2026`}r.ellipsize=e;function t(o){return o[0]==null?o:`${o[0].toLocaleUpperCase()}${o.slice(1)}`}r.capitalize=t;function i(o){return o==null||/^\s*$/.test(o)}r.isBlank=i;function n(o){return o instanceof Error?`${o.stack||o.message||o.name}`:String(o)}r.caughtToString=n})(Hd||(Hd={}));function K(r,e){return g(e),async(t,i)=>{let n={...t,type:r},o=Object.assign(Me({metadata:i}),oe(i)),a=await Promise.allSettled(e.map(p=>p(n,o))),c=xE(a);if(c)throw c.err;return dE.fromPartial({})}}function mb(r){for(let e of u.triggerOnEventHandlers.keys())switch(e){case"PostSubmit":r.provides(PE),L("OnPostSubmit",K("PostSubmit",u.triggerOnEventHandlers.get(e)));break;case"PostCreate":r.provides(yE),L("OnPostCreate",K("PostCreate",u.triggerOnEventHandlers.get(e)));break;case"PostUpdate":r.provides(CE),L("OnPostUpdate",K("PostUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostReport":r.provides(SE),L("OnPostReport",K("PostReport",u.triggerOnEventHandlers.get(e)));break;case"PostDelete":r.provides(bE),L("OnPostDelete",K("PostDelete",u.triggerOnEventHandlers.get(e)));break;case"PostFlairUpdate":r.provides(kE),L("OnPostFlairUpdate",K("PostFlairUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentSubmit":r.provides(fE),L("OnCommentSubmit",K("CommentSubmit",u.triggerOnEventHandlers.get(e)));break;case"CommentCreate":r.provides(cE),L("OnCommentCreate",K("CommentCreate",u.triggerOnEventHandlers.get(e)));break;case"CommentUpdate":r.provides(gE),L("OnCommentUpdate",K("CommentUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentReport":r.provides(pE),L("OnCommentReport",K("CommentReport",u.triggerOnEventHandlers.get(e)));break;case"CommentDelete":r.provides(mE),L("OnCommentDelete",K("CommentDelete",u.triggerOnEventHandlers.get(e)));break;case"AppInstall":r.provides(lE),L("OnAppInstall",K("AppInstall",u.triggerOnEventHandlers.get(e)));break;case"AppUpgrade":r.provides(uE),L("OnAppUpgrade",K("AppUpgrade",u.triggerOnEventHandlers.get(e)));break;case"ModAction":r.provides(hE),L("OnModAction",K("ModAction",u.triggerOnEventHandlers.get(e)));break;case"ModMail":r.provides(vE),L("OnModMail",K("ModMail",u.triggerOnEventHandlers.get(e)));break;case"PostNsfwUpdate":r.provides(IE),L("OnPostNsfwUpdate",K("PostNsfwUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostSpoilerUpdate":r.provides(wE),L("OnPostSpoilerUpdate",K("PostSpoilerUpdate",u.triggerOnEventHandlers.get(e)));break;default:throw new Error(`Unknown trigger event: ${e}`)}}function xE(r){let e=r.reduce((t,i)=>i.status==="rejected"?[...t,i.reason]:t,[]);if(e.length!==0)return e.length===1?{err:e[0]}:{err:new Error(e.map(t=>Hd.caughtToString(t)).join(`
3
- `))}}var sk=Bn(Ib(),1),ok=Bn(Am(),1);import{EffectType as wO,UIEventHandlerDefinition as xO}from"@devvit/protos";async function TO(r,e){let t=r.state??{},i=(0,sk.default)(t),n=Me({ui:!0,metadata:e});if(r.event?.formSubmitted&&r.event.formSubmitted.formId){let p=r.event.formSubmitted.formId;if(p.includes("form.hook.")&&u.customPostType){let y=new at((C,w)=>u.customPostType?.render(w)??null,r.event,r.state,e,void 0);return await y.reconcile(),{state:y.state,effects:y.getEffects()}}let f=u.formDefinitions.get(p);if(!f)throw new Error(`Form with key ${p} not found`);let v,m;if(i.__contextAction){let{actionId:y,thingId:C}=i.__contextAction,w=fm(y);w?.location==="post"?v=C:w?.location==="comment"&&(m=C)}let b=Object.assign(n,oe(e,v,m),{uiEnvironment:{timezone:e[B.Timezone]?.values[0],locale:e[B.Language]?.values[0]}});await f.onSubmit({values:Ct(r.event.formSubmitted.results)},b)}else if(r.event?.realtimeEvent){if(u.customPostType){let p=new at((f,v)=>u.customPostType?.render(v)??null,r.event,r.state,e,void 0);return await p.reconcile(),{state:p.state,effects:p.getEffects()}}}else if(r.event?.toastAction)throw new Error("Toast actions not yet implemented");let o=!(0,ok.default)(t,i),a=gi(n.ui),c=o?[...a,{type:wO.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:0}}]:a;return{state:i,effects:c}}function ak(r){r.provides(xO),L("HandleUIEvent",TO)}import{CustomPostDefinition as Ek}from"@devvit/protos";import{EffectType as Om,Form as EO,ToastAppearance as uk}from"@devvit/protos";function dk(r){let e=r.match(/form\.hook\.(.+)\.0/);if(e?.[1])return e[1]}var Em=class{constructor(e,t,i){this.state=null;this.hookId=e.hookId,this.form=t,this.onSubmit=i,this.onUIEvent=async n=>{n.formSubmitted&&await i(Ct(n.formSubmitted.results))}}};function Rm(r,e){let t=Ve({namespace:"useForm"},i=>new Em(i,r,e));return AO({id:t.hookId})}function AO(r){return`form.hook.${r.id}.0`}function lk(r,e){let t=dk(e);return r.getHook({id:t})}var Ot,el=class{constructor(e){d(this,Ot,void 0);l(this,Ot,e)}showForm(e,t){let i=lk(s(this,Ot),e);if(!i)throw new Error("Form does not exist. Make sure you have added it using useForm.");let n=i.form instanceof Function?i.form(t??{}):i.form,o=EO.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});ar(n.fields),o.fields=ot(n.fields),s(this,Ot).emitEffect(e,{type:Om.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?uk.SUCCESS:uk.NEUTRAL}:t={text:e},s(this,Ot).emitEffect(e.toString(),{type:Om.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,Ot).emitEffect(t,{type:Om.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}};Ot=new WeakMap;import{EffectType as RO,RealtimeSubscriptionStatus as ck}from"@devvit/protos";var Ft,Qe,Mt,yr,Cs,Mm,tl=class tl{constructor(e,t){d(this,Cs);d(this,Ft,void 0);d(this,Qe,void 0);d(this,Mt,void 0);d(this,yr,void 0);l(this,Ft,t.context),l(this,Qe,!!t.context._devvitContext?.debug.realtime),l(this,yr,e),l(this,Mt,t.invalidate);let i=t.context.meta[B.App]?.values[0];if(!i)throw Error("useChannel missing app ID metadata");let n=t.context.meta[B.Installation]?.values[0];if(!n)throw Error("useChannel missing install ID from metadata");let o=`${i}:${n}:${e.name}`;if(Object.values(s(this,Ft).hooks).filter(c=>c instanceof tl).some(c=>c.state.channel===o))throw Error(`useChannel channel names must be unique; "${o}" duplicated`);this.state={channel:o,connected:!1,subscribed:!1}}async onUIEvent(e){let t=e.realtimeEvent;if(!(!t||!this.state.subscribed))switch(t.status){case ck.REALTIME_SUBSCRIBED:s(this,Qe)&&console.debug(`[realtime] "${this.state.channel}" connected`),this.state.connected=!0,s(this,Mt).call(this),await s(this,yr).onSubscribed?.();break;case ck.REALTIME_UNSUBSCRIBED:s(this,Qe)&&console.debug(`[realtime] "${this.state.channel}" disconnected`),this.state.connected=!1,s(this,Mt).call(this),await s(this,yr).onUnsubscribed?.();break;default:s(this,Qe)&&console.debug(`[realtime] "${this.state.channel}" received message: ${JSON.stringify(e,void 0,2)}`),s(this,yr).onMessage(t.event?.data??{});break}}async send(e){if(s(this,Qe)&&console.debug(`[realtime] "${this.state.channel}" send message: ${JSON.stringify(e,void 0,2)}`),!this.state.subscribed||!this.state.connected)throw console.debug(`[realtime] "${this.state.channel}" send failed; channel not connected`),Error(`useChannel send failed; "${this.state.channel}" channel not connected`);await s(this,Ft).devvitContext.realtime.send(this.state.channel,e)}get status(){return this.state.subscribed&&this.state.connected?2:this.state.subscribed&&!this.state.connected?1:!this.state.subscribed&&this.state.connected?3:4}subscribe(){this.state.subscribed||(s(this,Qe)&&console.debug(`[realtime] "${this.state.channel}" subscribed`),this.state.subscribed=!0,s(this,Mt).call(this),S(this,Cs,Mm).call(this))}unsubscribe(){this.state.subscribed&&(s(this,Qe)&&console.debug(`[realtime] "${this.state.channel}" unsubscribed`),this.state.subscribed=!1,s(this,Mt).call(this),S(this,Cs,Mm).call(this))}};Ft=new WeakMap,Qe=new WeakMap,Mt=new WeakMap,yr=new WeakMap,Cs=new WeakSet,Mm=function(){let e=Object.values(s(this,Ft).hooks).filter(t=>t instanceof tl&&t.state.subscribed).map(t=>t.state.channel);s(this,Ft).emitEffect(this.state.channel,{type:RO.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:e}})};var Fm=tl;function Lm(r){if(!r.name||/[^a-zA-Z0-9_]/.test(r.name))throw Error(`useChannel error: The name "${r.name}" you provided for the hook is invalid. Valid names can only contain letters, numbers, and underscores (_).`);let e=`useChannel:${r.name}`;return Ve({id:e,namespace:e},t=>new Fm(r,t))}import{EffectType as Um}from"@devvit/protos";function mk(r){return typeof r=="object"&&r!==null&&"__deleted"in r}var br,Ci=class Ci{constructor(e,t){d(this,br,void 0);this._segments=[];this._hooks={};this._prevHookId="";this._effects={};this._changed={};this._touched={};this._requeueEvents=[];this._rootProps={};this._generated={};this._undeliveredHandlers={};this.request=e,this.meta=t,l(this,br,e.state??{__cache:{}}),this._rootProps=e.props??{}}get devvitContext(){if(!this._devvitContext)throw new Error("Devvit context not available");return this._devvitContext}set devvitContext(e){this._devvitContext=e}get _changedState(){let e={__cache:s(this,br).__cache??{}};for(let i in this._changed)e[i]=this._state[i];let t=new Set(Object.keys(this._state));return Object.keys(this._hooks).forEach(i=>{i!=="__cache"&&t.delete(i)}),t.forEach(i=>{if(i==="__cache")return;let n={__deleted:!0};this._state[i]=e[i]=n}),e}get hooks(){return this._hooks}get _state(){return s(this,br)}set _state(e){this._changed={},this._hooks={},l(this,br,e)}push(e){this._segments.push({...e,next:0})}pop(){this._segments.pop()}addUndeliveredEventHandler(e,t){this._undeliveredHandlers[e]=t}addGlobalUndeliveredEventHandler(e,t){Ci.addGlobalUndeliveredEventHandler(e,t)}getHook(e){return this._hooks[e.id]}static addGlobalUndeliveredEventHandler(e,t){Ci._staticUndeliveredHandlers[e]=t}async handleUndeliveredEvent(e){let t={...Ci._staticUndeliveredHandlers,...this._undeliveredHandlers};for(let[i,n]of Object.entries(t))await n(e,this)}emitEffect(e,t){this._effects[e]=t}addToRequeueEvents(...e){this._devvitContext?.debug.blocks&&console.debug("[blocks] requeueing events",e);let t=e.reduce((i,n)=>(n.retry?i.retry.push(n):i.normal.push(n),i),{retry:[],normal:[]});this._requeueEvents=[...t.retry,...this._requeueEvents,...t.normal]}get effects(){return Object.values(this._effects)}nextHookId(e){e.key===void 0&&(e.key=this._segments[this._segments.length-1].next+++""),this.push(e);try{let t=[];for(let n=this._segments.length-1;n>=0;n--){let o=this._segments[n];if(o.id){t.unshift(o.id);break}let a=[];o.namespace&&a.push(o.namespace),o.key!==void 0&&o.key!==!1&&a.push(o.key),t.unshift(a.join("-"))}let i=t.join(".");if(this._generated[i]&&!e.shared)throw new Error(`Hook id ${i} already used, cannot register another hook with the same id`);return this._generated[i]=!0,this._prevHookId=i,i}finally{this.pop()}}};br=new WeakMap,Ci._staticUndeliveredHandlers={};var Ii=Ci;var Lt={};Ii.addGlobalUndeliveredEventHandler("intervals",async(r,e)=>{r.timer&&r.hook&&(delete Lt[r.hook],e.emitEffect("timers",{type:Um.EFFECT_SET_INTERVALS,interval:{intervals:Lt}}))});var Ut,wi,Is,xi,Bm=class{constructor(e,t,i){d(this,Ut,void 0);d(this,wi,void 0);d(this,Is,void 0);d(this,xi,void 0);this.state={duration:{seconds:0,nanos:0},running:!1};l(this,wi,i.invalidate),l(this,Ut,i.hookId),l(this,Is,e),l(this,xi,i.context);let n=Math.floor(t/1e3),o=t%1e3*1e6;this.state.duration={seconds:n,nanos:o}}onStateLoaded(){this.state.running?Lt[s(this,Ut)]={duration:this.state.duration}:delete Lt[s(this,Ut)]}async onUIEvent(e){await s(this,Is).call(this)}start(){Lt[s(this,Ut)]={duration:this.state.duration},this.state.running=!0,s(this,wi).call(this),s(this,xi).emitEffect("timers",{type:Um.EFFECT_SET_INTERVALS,interval:{intervals:Lt}})}stop(){delete Lt[s(this,Ut)],this.state.running=!1,s(this,wi).call(this),s(this,xi).emitEffect("timers",{type:Um.EFFECT_SET_INTERVALS,interval:{intervals:Lt}})}};Ut=new WeakMap,wi=new WeakMap,Is=new WeakMap,xi=new WeakMap;function Dm(r,e){let t=Ve({namespace:"useInterval"},i=>new Bm(r,e,i));return{start:()=>t.start(),stop:()=>t.stop()}}var kr=class extends Error{};var ct,ws,Sr,Ti,Pr,_m=class{constructor(e,t){this.state={value:null,load_state:"initial"};d(this,ct,void 0);d(this,ws,void 0);d(this,Sr,void 0);d(this,Ti,void 0);d(this,Pr,void 0);l(this,Sr,e),l(this,Ti,t.hookId),l(this,ct,t.invalidate),l(this,ws,t.context)}async onUIEvent(){if(this.state.load_state==="loading"&&s(this,Pr)){try{this.state.value=await s(this,Pr),this.state.load_state="loaded"}catch(e){this.state.load_state="error",console.error("Error loading async state: ",e)}s(this,ct).call(this)}else console.warn("Invalid state: ",this.state.load_state,s(this,Pr))}setter(e){this.state.value=e instanceof Function?e(this.state.value):e,this.state.load_state="loaded",s(this,ct).call(this)}onStateLoaded(){if(this.state.load_state==="loading")throw new kr;if(this.state.load_state==="initial"){let e;try{e=s(this,Sr)instanceof Function?s(this,Sr).call(this):s(this,Sr)}catch(t){console.log("error in loading async",t),this.state.load_state="error",s(this,ct).call(this);return}if(e instanceof Promise){l(this,Pr,e),this.state.load_state="loading";let t={asyncRequest:{requestId:s(this,Ti)},hook:s(this,Ti)};throw s(this,ws).addToRequeueEvents(t),s(this,ct).call(this),new kr}else this.state.value=e,this.state.load_state="loaded";s(this,ct).call(this)}}};ct=new WeakMap,ws=new WeakMap,Sr=new WeakMap,Ti=new WeakMap,Pr=new WeakMap;function Nm(r){let e=Ve({namespace:"useState"},t=>new _m(r,t));return[e.state.value,e.setter.bind(e)]}var Wm={now(){return new Date}};function pk(r){return`__autocache__${r}`}function fk(r){return`__lock__${r}`}var OO=300,FO=1e3,rl=5e3,qm=3,gk=.1,hk=1e3,MO=3e4;function vk(r){if(r.error)throw new Error(r.error);return r.value}var Bt,Dt,Ue,Ai,nl,yk,sl,bk,ol,kk,xs,jm,al,Sk,dl,Pk,Ts,Hm,ll,Ck,il=class{constructor(e,t,i=Wm){d(this,nl);d(this,sl);d(this,ol);d(this,xs);d(this,al);d(this,dl);d(this,Ts);d(this,ll);d(this,Bt,void 0);d(this,Dt,{});d(this,Ue,void 0);d(this,Ai,void 0);l(this,Bt,e),l(this,Ai,t),l(this,Ue,i)}async cache(e,t){var a;(a=s(this,Ai)).__cache??(a.__cache={}),l(this,Dt,s(this,Ai).__cache),S(this,ll,Ck).call(this,t);let i=S(this,nl,yk).call(this,t.key);if(i!==void 0)return i;let n=await S(this,Ts,Hm).call(this,t.key),o=await S(this,sl,bk).call(this,t,n,e);return vk(o)}};Bt=new WeakMap,Dt=new WeakMap,Ue=new WeakMap,Ai=new WeakMap,nl=new WeakSet,yk=function(e){let t=s(this,Dt)[e];if(t){let i=s(this,Ue).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<qm&&Math.random()<gk&&t.errorTime+hk<i;if(t?.expires&&t.expires<i&&t.checkedAt+hk<i||n){delete s(this,Dt)[e];return}else return vk(t)}},sl=new WeakSet,bk=async function(e,t,i){let n=t?.expires,o=n?S(this,dl,Pk).call(this,n):1;return!t||t?.error&&t.errorCount<qm&&gk>Math.random()||o>Math.random()?S(this,ol,kk).call(this,e,t,i):t},ol=new WeakSet,kk=async function(e,t,i){let n=fk(e.key),o=s(this,Ue).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Bt).set(n,"1",{expiration:a,nx:!0}))return S(this,al,Sk).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Ue).now();return S(this,xs,jm).call(this,p,e.key,e.ttl)}},xs=new WeakSet,jm=async function(e,t,i){let n=Math.min(i,FO),o=await S(this,Ts,Hm).call(this,t);if(o)return o;if(s(this,Ue).now().getTime()-e.getTime()>=n)throw new Error(`Cache request timed out trying to get data at key: ${t}`);return await new Promise(a=>setTimeout(a,OO)),S(this,xs,jm).call(this,e,t,i)},al=new WeakSet,Sk=async function(e,t,i,n){let o=s(this,Ue).now().getTime()+n;t=t??{value:null,expires:o,errorCount:0,error:null,errorTime:null,checkedAt:0};try{t.value=await i(),t.error=null,t.errorCount=0,t.errorTime=null}catch(a){t.value=null,t.error=a.message??"Unknown error",t.errorTime=s(this,Ue).now().getTime(),t.errorCount++}return s(this,Dt)[e]=t,await s(this,Bt).set(pk(e),JSON.stringify(t),{expiration:new Date(o+MO)}),t.error&&t.errorCount<qm&&await s(this,Bt).del(fk(e)),t},dl=new WeakSet,Pk=function(e){let t=s(this,Ue).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},Ts=new WeakSet,Hm=async function(e){let t=await s(this,Bt).get(pk(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Ue).now().getTime(),s(this,Dt)[e]=i,i}},ll=new WeakSet,Ck=function(e){e.ttl<rl&&(console.warn(`Cache TTL cannot be less than ${rl} milliseconds! Updating ttl value of ${e.ttl} to ${rl}.`),e.ttl=rl)};function Ik(r,e,t=Wm){let i=new il(r,e,t);return i.cache.bind(i)}var ul=class{buildContext(e,t,i){let n=new oi(i),o=new ni(i),a=new ci(i),c=new li(i),p=new mi(i),f=new pi(i),v=new el(e),m=new si(i),b=new ii,y=new ai(i),C=Ik(a,e._state),w={modLog:n,kvStore:o,redis:a,reddit:c,scheduler:p,settings:f,media:m,assets:b,realtime:y,ui:v,useState:Nm,useChannel:Lm,useInterval:Dm,useForm:Rm,cache:C,dimensions:t.env?.dimensions,uiEnvironment:{timezone:i[B.Timezone]?.values[0],locale:i[B.Language]?.values[0],dimensions:t.env?.dimensions}},T=oe(i,t.props?.postId);return T.debug.effects=e,{...T,...w}}};var he=null;function wk(r){return JSON.parse(JSON.stringify(r))}function LO(r){if(!(r!==""&&!/[-.]/.test(r)))throw new Error(`Hook with namespace '${r}' is invalid. Hook namespaces cannot be empty string or contain dashes/dots because they are used as delimiters internally. Please update the hook namespace and try again.`)}function UO(r){return r.blocking||r.resize?!1:!r.hook}function Ve(r,e){if(!he)throw new Error("Hooks can only be declared at the top of a component. You cannot declare hooks outside of components or inside of event handlers. It's almost always a mistake to declare hooks inside of loops or conditionals.");LO(r.namespace);let t=he.nextHookId(r),i=he;i._touched[t]=!0;let n={hookId:t,invalidate:()=>{i._changed[t]=!0,i._state[t]=i?._hooks[t]?.state},context:he},o=he._state[t]===void 0||mk(he._state[t]);he._hooks[t]=he._hooks[t]??e(n);let a=he._hooks[t];return o||(a.state=he._state[t]),a.onStateLoaded?.(),o&&a.state!==void 0&&a.state!==null&&n.invalidate(),a}var BO=null,Ei,fl,As,re,ve,Ri,cl,gl,xk,Es,Gm,hl,Tk,Rs,Vm,Os,zm,Oi,ml,Fs,Jm,vl,Ak,pl=class{constructor(e){d(this,re);d(this,Ri);d(this,gl);d(this,Es);d(this,hl);d(this,Rs);d(this,Os);d(this,Oi);d(this,Fs);d(this,vl);d(this,Ei,void 0);d(this,fl,new ul);d(this,As,new bi(()=>this._latestRenderContext?.devvitContext?.assets));this._latestRenderContext=null;s(this,re,ve)&&console.debug("[blocks] BlocksHandler v1"),l(this,Ei,e),BO=this}async handle(e,t){let i=new Ii(e,t),n=s(this,fl).buildContext(i,e,t);i.devvitContext=n;let o,a=e.events,p=!e.events?.length||a.some(y=>!y.async),f=a.some(y=>y.blocking),v,m,b=[...a];for(a.length===0&&a.push({}),s(this,re,ve)&&console.debug("[blocks] starting processing events");a.length>0;){s(this,re,ve)&&console.debug("[blocks] processing events loop iteration",a.length);let y=[];if(!a[0].async)y.push(a.shift());else for(;a[0]?.async;)y.push(a.shift());if(!y.length)throw Error("batch must have at least one event");try{if(y[0].async){let w=wk(i._state);await S(this,gl,xk).call(this,i,...y),i._state=w}else await S(this,hl,Tk).call(this,i,...y)}catch(w){if(s(this,re,ve)&&console.debug("[blocks] caught in handler",w),i._latestRenderContent=void 0,m){i._state=m._state,i._changed=v,i._effects=m._effects;let T=b.map(F=>{let de={...F};return de.retry=!0,de});i.addToRequeueEvents(...T);break}else throw console.error("[blocks] unhandled error in handler",w),w}s(this,re,ve)&&console.debug("[blocks] remaining events",i._requeueEvents);let C=[];for(let w of i._requeueEvents){if(!p&&!w.async){s(this,re,ve)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch A",w),C.push(w);continue}if(p&&w.async&&!f){s(this,re,ve)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch B",w),C.push(w);continue}s(this,re,ve)&&console.debug("[blocks] reprocessing event in BlocksHandler",w),a.push(w)}i._requeueEvents=C,a.length>0&&(v={...i._changed},m={_state:wk(i._state),_effects:{...i._effects}},b=[...a])}if(p){i._latestRenderContent||(i._latestRenderContent=S(this,Rs,Vm).call(this,s(this,Ei),i.request.props??{},i));let y=i._latestRenderContent;y&&(o=s(this,As).createBlocksElementOrThrow(y),o=s(this,As).ensureRootBlock(o))}return{state:i._changedState,effects:i.effects,blocks:o,events:i._requeueEvents}}};Ei=new WeakMap,fl=new WeakMap,As=new WeakMap,re=new WeakSet,ve=function(){return!!this._latestRenderContext?.devvitContext.debug.blocks},Ri=new WeakSet,cl=function(e,...t){e._touched={},S(this,Rs,Vm).call(this,s(this,Ei),e.request.props??{},e);for(let i in e._hooks)e._touched[i]||delete e._hooks[i]},gl=new WeakSet,xk=async function(e,...t){S(this,Ri,cl).call(this,e,...t),await Promise.all(t.map(async i=>{if(!i.async)throw new Error("You can't mix main and other queues in one batch. This is likely a platform bug. Please file an issue in the Discord for someone to help! https://discord.com/channels/1050224141732687912/1115441897079574620");await S(this,Es,Gm).call(this,e,i)}))},Es=new WeakSet,Gm=async function(e,t){UO(t)&&console.warn("Received an event in #attemptHook that does not have an associated hook. This will cause the event to be undelivered and may cause bugs. Make sure that event passes a hook field. Event:",{event:t});let i=e._hooks[t.hook];if(i?.onUIEvent)try{await i.onUIEvent(t,e)}catch(n){throw console.error("Error in event handler",n),n}else await e.handleUndeliveredEvent(t)},hl=new WeakSet,Tk=async function(e,...t){for(let i of t)s(this,re,ve)&&console.log("[blocks] handling main queue event",i),s(this,re,ve)&&console.log("[blocks] before",e._state),S(this,Ri,cl).call(this,e,i),await S(this,Es,Gm).call(this,e,i),s(this,re,ve)&&console.log("[blocks] after",e._state);S(this,Ri,cl).call(this,e)},Rs=new WeakSet,Vm=function(e,t,i){s(this,re,ve)&&console.debug("[blocks] renderRoot"),i._generated={},he=i,this._latestRenderContext=i;try{let n=S(this,Os,zm).call(this,e,t,i);if(n.length!==1)throw new Error(`There can only be one root element, received: ${n.length}. Please wrap these elements in a <vstack></vstack> or <hstack></hstack> to continue. Fragments cannot be used as a root element.`);let o=n[0];if(o==="[object Promise]")throw new Error('Root elements cannot be asynchronous. To use data from an async endpoint, please use "const [data] = context.useState(async () => {/** your async code */})".');if(typeof o=="string")throw new Error("The root element must return a valid block, not a string. Try wrapping the element in a <text>your content</text> tag to continue.");return i._latestRenderContent=o,o}catch(n){if(n instanceof kr)return;throw n}finally{he=null}},Os=new WeakSet,zm=function(e,t,i){i.push({namespace:e.name||"anonymous",...t});try{let n=e(t,i.devvitContext);return S(this,Fs,Jm).call(this,n,i)}finally{i.pop()}},Oi=new WeakSet,ml=function(e,t){return e=e.flat(1/0),e.flatMap((i,n)=>(i&&typeof i=="object"&&"props"in i&&(i.props?.key||(i.props=i.props??{},i.props.key=`${n}`)),S(this,Fs,Jm).call(this,i,t)))},Fs=new WeakSet,Jm=function(e,t){if(Array.isArray(e))return S(this,Oi,ml).call(this,e,t);if(DO(e))if(e.type===void 0){t.push({namespace:"fragment",...e.props});let i=S(this,Oi,ml).call(this,e.children,t);return t.pop(),i}else if(typeof e.type=="function"){let i={...e.props,children:e.children};return S(this,Os,zm).call(this,e.type,i,t)}else{t.push({namespace:e.type,...e.props});let i=S(this,Oi,ml).call(this,e.children,t),n=S(this,vl,Ak).call(this,e.props??{});return t.pop(),[{type:e.type,children:i,props:n}]}else return[(e??"").toString()]},vl=new WeakSet,Ak=function(e){let t={};for(let i in e)if(!(typeof e[i]>"u"))if(typeof e[i]=="function"){let n=Ve({namespace:i,key:!1},({hookId:o})=>({hookId:o,state:null,onUIEvent:e[i]}));t[i]=n.hookId,"captureHookRef"in e[i]&&e[i].captureHookRef()}else{let n=JSON.parse(JSON.stringify(e[i]));n!=null&&(t[i]=n)}return t};function DO(r){return typeof r=="object"&&r!=null&&"type"in r}var _O=[[Ek,Ek.methods.renderPostContent,(r,e)=>u.customPostType?.render(e)??null]];function NO(r){return async(e,t)=>new pl(r).handle(e,t)}function Rk(r){for(let[e,t,i]of _O)r.provides(e),L(t.name,NO(i))}var Fi,Ms,Mi,Cr,Ir,Li,Ui,wr,_t,Ls,Us,xr,_,U=class U extends bd{static configure(e){l(this,Mi,{...s(this,Mi),...e}),dt(e.http)&&this.use(P.HTTPDefinition),(dt(e.kvStore)||dt(e.redis))&&(this.use(P.KVStoreDefinition),this.use(P.RedisAPIDefinition)),dt(e.media)&&this.use(P.MediaServiceDefinition),dt(e.modLog)&&this.use(P.ModlogDefinition),dt(e.redditAPI)&&(this.use(P.FlairDefinition),this.use(P.GraphQLDefinition),this.use(P.LinksAndCommentsDefinition),this.use(P.ListingsDefinition),this.use(P.ModerationDefinition),this.use(P.ModNoteDefinition),this.use(P.NewModmailDefinition),this.use(P.PrivateMessagesDefinition),this.use(P.SubredditsDefinition),this.use(P.PostCollectionsDefinition),this.use(P.UsersDefinition),this.use(P.WidgetsDefinition),this.use(P.WikiDefinition),this.use(P.RedditAPIV2Definition)),dt(e.realtime)&&this.use(P.RealtimeDefinition)}static addMenuItem(e){s(this,Ui).push(e)}static addCustomPostType(e){l(this,Cr,e)}static createForm(e,t){let i=`form.${s(this,Ir).size}`;return s(this,Ir).set(i,{form:e,onSubmit:t}),i}static addSchedulerJob(e){if(s(this,_)[P.SchedulerDefinition.fullName]||this.use(P.SchedulerDefinition),s(this,wr).has(e.name))throw new Error(`Job ${e.name} is already defined`);s(this,wr).set(e.name,e.onRun)}static addSettings(e){ar(e);let t=e.filter(n=>n.type==="group"||!n.scope||n.scope==="installation"),i=e.filter(n=>n.type!=="group"&&n.scope==="app");t.length>0&&l(this,Li,t),i.length>0&&l(this,Fi,i),s(this,_)[P.SettingsDefinition.fullName]||this.use(P.SettingsDefinition)}static addTrigger(e){if("events"in e){for(let t of e.events)this.addTrigger({event:t,onEvent:(i,n)=>e.onEvent(i,n)});return this}return s(this,_t).has(e.event)?s(this,_t).get(e.event)?.push(e.onEvent):s(this,_t).set(e.event,[e.onEvent]),U}static provide(e){s(this,Us).push(e)}static use(e,t){s(this,xr)[e.fullName]={def:e,options:t??{},handler:void 0};let i={};for(let n of Object.values(e.methods))i[n.name]=(o,a)=>s(this,xr)[e.fullName].handler?.[n.name]?.(n.requestType?.fromPartial(o??{}),a);return s(this,_)[e.fullName]=i,i}static get redditAPIPlugins(){if(!dt(s(this,Mi).redditAPI))throw new Error("Reddit API is not enabled. You can enable it by passing `redditAPI: true` to `Devvit.configure`.");return{Flair:s(this,_)[P.FlairDefinition.fullName],GraphQL:s(this,_)[P.GraphQLDefinition.fullName],LinksAndComments:s(this,_)[P.LinksAndCommentsDefinition.fullName],Listings:s(this,_)[P.ListingsDefinition.fullName],Moderation:s(this,_)[P.ModerationDefinition.fullName],ModNote:s(this,_)[P.ModNoteDefinition.fullName],NewModmail:s(this,_)[P.NewModmailDefinition.fullName],PrivateMessages:s(this,_)[P.PrivateMessagesDefinition.fullName],Subreddits:s(this,_)[P.SubredditsDefinition.fullName],PostCollections:s(this,_)[P.PostCollectionsDefinition.fullName],Users:s(this,_)[P.UsersDefinition.fullName],Widgets:s(this,_)[P.WidgetsDefinition.fullName],Wiki:s(this,_)[P.WikiDefinition.fullName]}}static get modLogPlugin(){let e=s(this,_)[P.ModlogDefinition.fullName];if(!e)throw new Error("ModLog is not enabled. You can enable it by passing `modLog: true` to `Devvit.configure`");return e}static get schedulerPlugin(){let e=s(this,_)[P.SchedulerDefinition.fullName];if(!e)throw new Error("Scheduler is not enabled. You can enable it by calling `Devvit.addSchedulerJob` at the top level of your app.");return e}static get kvStorePlugin(){let e=s(this,_)[P.KVStoreDefinition.fullName];if(!e)throw new Error("Key Value Store is not enabled. You can enable it by passing `kvStore: true` to `Devvit.configure`");return e}static get redisPlugin(){let e=s(this,_)[P.RedisAPIDefinition.fullName];if(!e)throw new Error("Redis is not enabled. You can enable it by passing `redis: true` to `Devvit.configure`");return e}static get mediaPlugin(){let e=s(this,_)[P.MediaServiceDefinition.fullName];if(!e)throw new Error("MediaService is not enabled. You can enable it by passing `media: true` to `Devvit.configure`");return e}static get redditapiv2Plugin(){let e=s(this,_)[P.RedditAPIV2Definition.fullName];if(!e)throw new Error("RedditAPIV2 is not enabled. You can enable it by passing `apiV2: true` to `Devvit.configure`");return e}static get settingsPlugin(){let e=s(this,_)[P.SettingsDefinition.fullName];if(!e)throw new Error("Settings must first be configured with `Devvit.addSettings()` before they can be accessed");return e}static get realtimePlugin(){let e=s(this,_)[P.RealtimeDefinition.fullName];if(!e)throw new Error("Realtime is not enabled. You can enable it by passing `realtime: true` to `Devvit.configure`");return e}static get menuItems(){return s(this,Ui)}static get customPostType(){return s(this,Cr)}static get formDefinitions(){return s(this,Ir)}static get scheduledJobHandlers(){return s(this,wr)}static get installationSettings(){return s(this,Li)}static get appSettings(){return s(this,Fi)}static get triggerOnEventHandlers(){return s(this,_t)}static get assets(){return s(this,Ms)}static get webviewAssets(){return s(this,Ls)}constructor(e){super(e),l(U,Ms,e.assets??{}),l(U,Ls,e.webviewAssets??{});for(let t in s(U,xr)){let i=s(U,xr)[t];i.handler=e.use(i.def,i.options)}s(U,Ui).length>0&&ub(e),s(U,wr).size>0&&cb(e),s(U,Cr)&&(ab(e),Rk(e)),(s(U,Cr)||s(U,Ir).size>0)&&ak(e),s(U,Li)&&db(e),s(U,Fi)&&Ny(e),s(U,_t).size>0&&mb(e);for(let t of s(U,Us))e.provides(t)}};Fi=new WeakMap,Ms=new WeakMap,Mi=new WeakMap,Cr=new WeakMap,Ir=new WeakMap,Li=new WeakMap,Ui=new WeakMap,wr=new WeakMap,_t=new WeakMap,Ls=new WeakMap,Us=new WeakMap,xr=new WeakMap,_=new WeakMap,U.debug={},d(U,Fi,void 0),d(U,Ms,{}),d(U,Mi,{}),d(U,Cr,void 0),d(U,Ir,new Map),d(U,Li,void 0),d(U,Ui,[]),d(U,wr,new Map),d(U,_t,new Map),d(U,Ls,{}),d(U,Us,[]),d(U,xr,{}),d(U,_,{});var u=U;(e=>{function r(t,i,...n){return{type:t,props:i,children:n}}e.createElement=r})(u||(u={}));function V(r){let e=Object.getOwnPropertyDescriptors(r.constructor.prototype);for(let[t,i]of Object.entries(e))i.get&&Object.defineProperty(r,t,{...i,enumerable:!0})}var $m;(function(r){r[r.bold=1]="bold",r[r.italic=2]="italic",r[r.underline=4]="underline",r[r.strikethrough=8]="strikethrough",r[r.subscript=16]="subscript",r[r.superscript=32]="superscript",r[r.monospace=64]="monospace"})($m||($m={}));var Ok="text",Fk="raw",Mk="br",Lk="link",Uk="c/",Bk="p/",Dk="r/",_k="u/",Nk="@",qk="spoilertext",jk="par",Hk="h",Wk="hr",Gk="blockquote",Vk="code",zk="li",Jk="list",$k="L",Kk="R",Xk="C",Zk="table",Yk="embed",Qk="img",eS="gif",tS="video";function rS(r){return{e:eS,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function iS(r,e){let t={},i=[];return Object.assign(t,Bs(t,i),Ds(t,i),_s(t,i),js(t,i),Hs(t,i),Ws(t,i)),e(t),{e:Gk,c:i,...r.author&&{a:r.author}}}function nS(r,e){let t={},i=[];return Object.assign(t,Xm(t,i)),e(t),{e:Vk,c:i,...r.language&&{l:r.language}}}function sS(r){return{e:Uk,t:r.permalink}}function oS(r,e){let t={},i=[];return Object.assign(t,Xm(t,i),qs(t,i)),e(t),{e:Hk,l:r.level,c:i}}function aS(r){return{e:Yk,u:r.sourceUrl,c:r.contentUrl,x:r.width,y:r.height}}function dS(){return{e:Wk}}function lS(r){return{e:Qk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function uS(){return{e:Mk}}function cS(r){return{e:Lk,t:r.text,u:r.url,...r.formatting&&{f:r.formatting},...r.tooltip&&{a:r.tooltip}}}function mS(r,e){let t={},i=[];return Object.assign(t,AS(t,i)),e(t),{e:Jk,o:r.ordered,c:i}}function pS(r){let e={},t=[];return Object.assign(e,Bs(e,t),Ds(e,t),_s(e,t),yl(e,t),js(e,t),Hs(e,t),Ws(e,t)),r(e),{e:zk,c:t}}function fS(r){let e={},t=[];return Object.assign(e,bl(e,t),qs(e,t),Km(e,t),Zm(e,t),Ns(e,t)),r(e),{e:jk,c:t}}function gS(r){return{e:Bk,t:r.permalink}}function hS(r){return{e:Fk,t:r}}function vS(r){let e={},t=[];return Object.assign(e,bl(e,t),qs(e,t),Km(e,t)),r(e),{e:qk,c:t}}function yS(r){return{e:Dk,t:r.subredditName,l:r.showPrefix}}function bS(r){let e={},t=[],i=[];return Object.assign(e,ES(e,t,i)),r(e),{e:Zk,h:t,c:i}}function kS(r){let[e,t]=TS();return r(e),{c:t}}function SS(r,e){let[t,i]=TS();e(t);let n;switch(r.columnAlignment){case"left":n=$k;break;case"right":n=Kk;break;case"center":n=Xk;break}return{...n&&{a:n},...i&&{c:i}}}function PS(r){let e={},t=[];return Object.assign(e,RS(e,t)),r(e),t}function CS(r){return{e:Ok,t:r.text,...r.formatting&&{f:r.formatting}}}function IS(r){return{e:_k,t:r.username,l:r.showPrefix}}function wS(r){return{e:Nk,t:r.username,l:r.showPrefix}}function xS(r){return{e:tS,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur},...r.thumbnail&&{p:r.thumbnail},...r.convertToGif&&{gifify:r.convertToGif}}}function TS(){let r={},e=[];return Object.assign(r,bl(r,e),qs(r,e),Zm(r,e),Ns(r,e)),[r,e]}function Bs(r,e){return{blockQuote(t,i){return e.push(iS(t,i)),r}}}function Ds(r,e){return{codeBlock(t,i){return e.push(nS(t,i)),r}}}function OS(r,e){return{embed(t){return e.push(aS(t)),r}}}function _s(r,e){return{heading(t,i){return e.push(oS(t,i)),r}}}function yl(r,e){return{horizontalRule(){return e.push(dS()),r}}}function Ns(r,e){return{image(t){return e.push(lS(t)),r},animatedImage(t){return e.push(rS(t)),r}}}function Km(r,e){return{linebreak(){return e.push(uS()),r}}}function qs(r,e){return{link(t){return e.push(cS(t)),r},commentLink(t){return e.push(sS(t)),r},postLink(t){return e.push(gS(t)),r},subredditLink(t){return e.push(yS(t)),r},userLink(t){return e.push(IS(t)),r},userMention(t){return e.push(wS(t)),r}}}function js(r,e){return{list(t,i){return e.push(mS(t,i)),r}}}function AS(r,e){return{item(t){return e.push(pS(t)),r}}}function Hs(r,e){return{paragraph(t){return e.push(fS(t)),r}}}function Xm(r,e){return{rawText(t){return e.push(hS(t)),r}}}function Zm(r,e){return{spoiler(t){return e.push(vS(t)),r}}}function ES(r,e,t){return{headerCell(i,n){return e.push(SS(i,n)),r},row(i){return t.push(PS(i)),r}}}function Ws(r,e){return{table(t){return e.push(bS(t)),r}}}function RS(r,e){return{cell(t){return e.push(kS(t)),r}}}function bl(r,e){return{text(t){return e.push(CS(t)),r}}}function FS(r,e){return{video(t){return e.push(xS(t)),r}}}var qO=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},jO=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},kl,Gs=class{constructor(){kl.set(this,void 0);let e=[];Object.assign(this,Hs(this,e),_s(this,e),yl(this,e),Bs(this,e),Ds(this,e),OS(this,e),js(this,e),Ws(this,e),Ns(this,e),FS(this,e)),qO(this,kl,{document:e},"f")}build(){return JSON.stringify(jO(this,kl,"f"))}paragraph(e){return this}heading(e,t){return this}horizontalRule(){return this}blockQuote(e,t){return this}codeBlock(e,t){return this}embed(e){return this}list(e,t){return this}table(e){return this}image(e){return this}animatedImage(e){return this}video(e){return this}};kl=new WeakMap;function Bi(r){let e;return r instanceof Gs?e=r.build():typeof r=="object"?e=JSON.stringify(r):e=r,e}var MS=100,LS=1/0,Tr,Ar,Nt,Di,_i,Sl,j=class{constructor(e){d(this,_i);d(this,Tr,void 0);d(this,Ar,void 0);d(this,Nt,void 0);d(this,Di,!1);this.pageSize=MS;this.limit=LS;this.children=[];V(this),this._fetch=e.fetch,this.pageSize=e.pageSize??MS,this.limit=e.limit??LS,l(this,Ar,e.after),l(this,Tr,e.before),l(this,Nt,e.more),e.children&&(this.children=e.children)}get hasMore(){return!s(this,Di)||!!(s(this,Ar)||s(this,Tr)||s(this,Nt))}async*[Symbol.asyncIterator](){let e=0;for(;;){if(e===this.children.length)if(this.hasMore){if((await S(this,_i,Sl).call(this)).length===0)break}else break;if(yield this.children[e],e++,e===this.limit)break}}setMore(e){l(this,Nt,e)}preventInitialFetch(){l(this,Di,!0)}async all(){for(;this.hasMore&&this.children.length<this.limit;)await S(this,_i,Sl).call(this);return this.children.slice(0,this.limit)}async get(e){let t=e<=this.limit?e:this.limit;for(;this.hasMore&&this.children.length<t;)await S(this,_i,Sl).call(this);return this.children.slice(0,t)}};Tr=new WeakMap,Ar=new WeakMap,Nt=new WeakMap,Di=new WeakMap,_i=new WeakSet,Sl=async function(){if(!this.hasMore)throw new Error("This listing does not have any more items to load.");let{children:e,before:t,after:i,more:n}=await this._fetch({before:s(this,Tr),after:s(this,Ar),limit:this.pageSize,more:s(this,Nt)});return this.children.push(...e),l(this,Tr,t),l(this,Ar,i),l(this,Nt,n),l(this,Di,!0),e};function HO(r){try{return!0}catch{return!1}}function WO(r){try{return!0}catch{return!1}}var Vs,Ym,Oe=class{constructor(){}static get(e,t){let i=u.redditAPIPlugins.ModNote;return new j({hasMore:!0,before:e.before,limit:e.limit,pageSize:e.limit,fetch:async n=>{let o=await i.GetNotes({subreddit:e.subreddit,user:e.user,filter:e.filter,before:n.before,limit:n.limit},t);return{children:o.modNotes?.map(a=>S(this,Vs,Ym).call(this,a))||[],before:o.hasNextPage?o.endCursor:void 0,hasMore:o.hasNextPage}}})}static async delete(e,t){let i=u.redditAPIPlugins.ModNote,{deleted:n}=await i.DeleteNotes(e,t);return!!n}static async add(e,t){let n=await u.redditAPIPlugins.ModNote.PostNotes(e,t);if(!n?.created)throw new Error("Failed to create mod note");return S(this,Vs,Ym).call(this,n.created)}static async addRemovalNote(e,t){await u.redditAPIPlugins.ModNote.PostRemovalNote(e,t)}};Vs=new WeakSet,Ym=function(e){if(g(e.id,"Mod note ID is null or undefined"),g(e.createdAt,"Mod note createdAt is null or undefined"),g(e.type,"Mod note type is null or undefined"),g(e.subreddit,"Mod note subreddit is null or undefined"),g(e.subredditId,"Mod note subredditId is null or undefined"),g(e.operator,"Mod note operator is null or undefined"),g(e.operatorId,"Mod note operatorId is null or undefined"),g(e.user,"Mod note user is null or undefined"),g(e.userId,"Mod note userId is null or undefined"),g(e.userNoteData,"Mod note userNote is null or undefined"),g(e.modActionData,"Mod note modAction is null or undefined"),!HO(e.userNoteData?.label??""))throw new Error(`Invalid user note label: ${e.userNoteData?.label}`);if(!WO(e.type))throw new Error(`Invalid mod note type: ${e.type}`);return{id:e.id,user:{id:ee(e.userId??""),name:e.user},subreddit:{id:Ae(e.subredditId??""),name:e.subreddit},operator:{id:ee(e.operatorId??""),name:e.operator},createdAt:new Date(e.createdAt*1e3),userNote:{note:e.userNoteData?.note,redditId:pe(e.userNoteData?.redditId??""),label:e.userNoteData?.label},type:e.type}},d(Oe,Vs);var qt=class{static queryWithQueryString(e,t){return u.redditAPIPlugins.GraphQL.Query({query:e},t)}static query(e,t,i,n){return u.redditAPIPlugins.GraphQL.PersistedQuery({operationName:e,id:t,variables:i},n)}};var US=["all","wiki","posts","access","mail","config","flair","channels","chat_config","chat_community","chat_operator"];function GO(r,e,t=!1){let i=t?"%2b":"+";return e.map(n=>(r.includes(n)?i:"-")+n).join(",")}function Qm(r){return GO(r,US,!0)}function BS(r){return r.filter(e=>US.includes(e))}var VO=(t=>(t.User="USER_FLAIR",t.Post="LINK_FLAIR",t))(VO||{}),Er,Ni,qi,ji,Hi,Wi,Gi,Vi,zi,Ji,$i,Pl,ze=class ze{constructor(e,t,i){d(this,Er,void 0);d(this,Ni,void 0);d(this,qi,void 0);d(this,ji,void 0);d(this,Hi,void 0);d(this,Wi,void 0);d(this,Gi,void 0);d(this,Vi,void 0);d(this,zi,void 0);d(this,Ji,void 0);V(this),g(e.id),g(e.text),l(this,Er,e.id),l(this,Ni,t),l(this,qi,e.text),l(this,ji,zO(e.textColor)),l(this,Hi,JO(e.backgroundColor)),l(this,Wi,$O(e.allowableContent)),l(this,Gi,e.modOnly),l(this,Vi,e.maxEmojis),l(this,zi,e.textEditable),l(this,Ji,i)}get id(){return s(this,Er)}get text(){return s(this,qi)}get textColor(){return s(this,ji)}get backgroundColor(){return s(this,Hi)}get allowableContent(){return s(this,Wi)}get modOnly(){return s(this,Gi)}get maxEmojis(){return s(this,Vi)}get allowUserEdits(){return s(this,zi)}async delete(){return ze.deleteFlairTemplate(s(this,Er),s(this,Ni),s(this,Ji))}async edit(e){return ze.editFlairTemplate({id:s(this,Er),subredditName:s(this,Ni),text:e.text??s(this,qi),allowableContent:e.allowableContent??s(this,Wi),backgroundColor:e.backgroundColor??s(this,Hi),maxEmojis:e.maxEmojis??s(this,Vi),modOnly:e.modOnly??s(this,Gi),textColor:e.textColor??s(this,ji),allowUserEdits:e.allowUserEdits??s(this,zi)},s(this,Ji))}static async createPostFlairTemplate(e,t){var i;return S(i=ze,$i,Pl).call(i,{...e,flairType:"LINK_FLAIR"},t)}static async createUserFlairTemplate(e,t){var i;return S(i=ze,$i,Pl).call(i,{...e,flairType:"USER_FLAIR"},t)}static async editFlairTemplate(e,t){var i;return S(i=ze,$i,Pl).call(i,e,t)}static async getPostFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.LinkFlair({subreddit:e},t)).flair?.map(o=>new ze(o,e,t))||[]}static async getUserFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.UserFlair({subreddit:e},t)).flair?.map(o=>new ze(o,e,t))||[]}static async deleteFlairTemplate(e,t,i){await u.redditAPIPlugins.Flair.DeleteFlairTemplate({subreddit:e,flairTemplateId:t},i)}};Er=new WeakMap,Ni=new WeakMap,qi=new WeakMap,ji=new WeakMap,Hi=new WeakMap,Wi=new WeakMap,Gi=new WeakMap,Vi=new WeakMap,zi=new WeakMap,Ji=new WeakMap,$i=new WeakSet,Pl=async function(e,t){let{subredditName:i,allowableContent:n="all",backgroundColor:o="transparent",flairType:a="",maxEmojis:c=10,modOnly:p=!1,text:f,textColor:v="dark",allowUserEdits:m=!1,id:b=""}=e;if(p&&m)throw new Error("Cannot have a mod only flair that is editable by users");let C=await u.redditAPIPlugins.Flair.FlairTemplate({subreddit:i,allowableContent:n,backgroundColor:o,flairType:a,maxEmojis:c,modOnly:p,text:f,textColor:v,textEditable:m,flairTemplateId:b,cssClass:"",overrideCss:!1},t);return new ze(C,i,t)},d(ze,$i);var se=ze;function $s(r){return{flairCssClass:r.flairCssClass,user:r.user,flairText:r.flairText}}var zs,ep,Js,tp,jt=class jt{static async getUserFlairBySubreddit(e,t){return u.redditAPIPlugins.Flair.FlairList(e,t)}static setUserFlair(e,t){var i;return S(i=jt,zs,ep).call(i,e,t)}static setPostFlair(e,t){var i;return S(i=jt,zs,ep).call(i,{...e,postId:me(e.postId)},t)}static async removePostFlair(e,t,i){var n;return S(n=jt,Js,tp).call(n,e,t,void 0,i)}static async removeUserFlair(e,t,i){var n;return S(n=jt,Js,tp).call(n,e,void 0,t,i)}};zs=new WeakSet,ep=async function(e,t){await u.redditAPIPlugins.Flair.SelectFlair({subreddit:e.subredditName,flairTemplateId:e.flairTemplateId??"",text:e.text??"",name:e.username,link:e.postId,backgroundColor:e.backgroundColor??"",textColor:e.textColor??"dark",cssClass:e.cssClass??"",returnRtjson:"none"},t)},Js=new WeakSet,tp=async function(e,t,i,n){await u.redditAPIPlugins.Flair.SelectFlair({subreddit:e,name:i??"",link:t??"",flairTemplateId:"",backgroundColor:"",text:"",textColor:"",cssClass:"",returnRtjson:"none"},n)},d(jt,zs),d(jt,Js);var Fe=jt;function zO(r){if(g(r,"Flair text color is required"),r==="light"||r==="dark")return r;throw new Error(`Invalid flair text color: ${r}`)}function JO(r){if(g(r,"Flair background color is required"),r==="transparent"||/^#([A-Fa-f0-9]{6})$/.test(r))return r;throw new Error(`Invalid flair background color: ${r}`)}function $O(r){if(r==="all"||r==="text"||r==="emoji")return r;throw new Error(`Invalid allowable content: ${r}`)}import{Block as rF}from"@devvit/protos";var qS=Bn(NS(),1);var Ki,Xs,Xi,Zs,Ys,Qs,eo,to,Zi,ro,io,no,so,oo,ao,Ht,lo,uo,Or,Yi,Wt,Qi,en,tn,Fr,Gt,Vt,rn,zt,Jt,$t,mt,co,mo,nn,sn,D,N=class N{constructor(e,t){d(this,Ki,void 0);d(this,Xs,void 0);d(this,Xi,void 0);d(this,Zs,void 0);d(this,Ys,void 0);d(this,Qs,void 0);d(this,eo,void 0);d(this,to,void 0);d(this,Zi,void 0);d(this,ro,void 0);d(this,io,void 0);d(this,no,void 0);d(this,so,void 0);d(this,oo,void 0);d(this,ao,void 0);d(this,Ht,void 0);d(this,lo,void 0);d(this,uo,void 0);d(this,Or,void 0);d(this,Yi,void 0);d(this,Wt,void 0);d(this,Qi,void 0);d(this,en,void 0);d(this,tn,void 0);d(this,Fr,void 0);d(this,Gt,void 0);d(this,Vt,void 0);d(this,rn,void 0);d(this,zt,void 0);d(this,Jt,void 0);d(this,$t,void 0);d(this,mt,void 0);d(this,co,void 0);d(this,mo,void 0);d(this,nn,void 0);d(this,sn,void 0);d(this,D,void 0);V(this),g(e.id,"Post is missing id"),g(e.title,"Post is missing title"),g(e.createdUtc,"Post is missing created date"),g(e.author,"Post is missing author name"),g(e.subreddit,"Post is missing subreddit name"),g(e.subredditId,"Post is missing subreddit id"),g(e.url,"Post is missing url"),g(e.permalink,"Post is missing permalink"),l(this,Ki,me(`t3_${e.id}`)),l(this,Xi,e.author),l(this,Xs,e.authorFullname?ee(e.authorFullname):void 0),l(this,Ys,Ae(e.subredditId)),l(this,Qs,e.subreddit),l(this,no,e.score??0),l(this,so,e.numComments??0),l(this,oo,e.numReports??0);let i=new Date(0);i.setUTCSeconds(e.createdUtc),l(this,Zs,i),l(this,to,e.title),l(this,Zi,e.selftext),l(this,ro,e.selftextHtml),l(this,io,e.url),l(this,eo,e.permalink),e.thumbnail&&e.thumbnail!=="self"&&e.thumbnail!=="nsfw"&&e.thumbnailHeight!=null&&e.thumbnailWidth!=null&&l(this,ao,{url:e.thumbnail,height:e.thumbnailHeight,width:e.thumbnailWidth}),l(this,Ht,e.approved??!1),l(this,lo,e.approvedAtUtc??0),l(this,uo,e.bannedAtUtc??0),l(this,Wt,e.removed??!1),l(this,Qi,e.removedBy),l(this,en,e.removedByCategory),l(this,Or,e.spam??!1),l(this,Yi,e.stickied??!1),l(this,tn,e.archived??!1),l(this,Fr,e.edited??!1),l(this,Gt,e.locked??!1),l(this,Vt,e.over18??!1),l(this,rn,e.quarantine??!1),l(this,zt,e.spoiler),l(this,Jt,e.hidden??!1),l(this,$t,e.ignoreReports??!1),l(this,mt,e.distinguished),l(this,mo,e.secureMedia),l(this,nn,(e.modReports??[]).map(([n])=>n)),l(this,sn,(e.userReports??[]).map(([n])=>n)),l(this,D,t),(e.linkFlairBackgroundColor||e.linkFlairCssClass||e.linkFlairText||e.linkFlairType||e.linkFlairTemplateId||e.linkFlairRichtext||e.linkFlairTextColor)&&l(this,co,{backgroundColor:e.linkFlairBackgroundColor,cssClass:e.linkFlairCssClass,text:e.linkFlairText,type:e.linkFlairType,templateId:e.linkFlairTemplateId,richtext:(e.linkFlairRichtext??[]).map(({e:n,t:o,a,u:c})=>({elementType:n,text:o,emojiRef:a,url:c})),textColor:e.linkFlairTextColor})}get id(){return s(this,Ki)}get authorId(){return s(this,Xs)}get authorName(){return s(this,Xi)}get subredditId(){return s(this,Ys)}get subredditName(){return s(this,Qs)}get permalink(){return s(this,eo)}get title(){return s(this,to)}get body(){return s(this,Zi)}get bodyHtml(){return s(this,ro)}get url(){return s(this,io)}get thumbnail(){return s(this,ao)}get createdAt(){return s(this,Zs)}get score(){return s(this,no)}get numberOfComments(){return s(this,so)}get numberOfReports(){return s(this,oo)}get approved(){return s(this,Ht)}get approvedAtUtc(){return s(this,lo)}get bannedAtUtc(){return s(this,uo)}get spam(){return s(this,Or)}get stickied(){return s(this,Yi)}get removed(){return s(this,Wt)}get removedBy(){return s(this,Qi)}get removedByCategory(){return s(this,en)}get archived(){return s(this,tn)}get edited(){return s(this,Fr)}get locked(){return s(this,Gt)}get nsfw(){return s(this,Vt)}get quarantined(){return s(this,rn)}get spoiler(){return s(this,zt)}get hidden(){return s(this,Jt)}get ignoringReports(){return s(this,$t)}get distinguishedBy(){return s(this,mt)}get comments(){return $.getComments({postId:this.id},s(this,D))}get flair(){return s(this,co)}get secureMedia(){return s(this,mo)}get userReportReasons(){return s(this,sn)}get modReportReasons(){return s(this,nn)}toJSON(){return{id:this.id,authorId:this.authorId,authorName:this.authorName,subredditId:this.subredditId,subredditName:this.subredditName,permalink:this.permalink,title:this.title,body:this.body,bodyHtml:this.bodyHtml,url:this.url,thumbnail:this.thumbnail,score:this.score,numberOfComments:this.numberOfComments,numberOfReports:this.numberOfReports,createdAt:this.createdAt,approved:this.approved,spam:this.spam,stickied:this.stickied,removed:this.removed,removedBy:s(this,Qi),removedByCategory:s(this,en),archived:this.archived,edited:this.edited,locked:this.locked,nsfw:this.nsfw,quarantined:this.quarantined,spoiler:this.spoiler,hidden:this.hidden,ignoringReports:this.ignoringReports,distinguishedBy:this.distinguishedBy,flair:this.flair,secureMedia:this.secureMedia,modReportReasons:s(this,nn),userReportReasons:s(this,sn)}}isApproved(){return s(this,Ht)}isSpam(){return s(this,Or)}isStickied(){return s(this,Yi)}isRemoved(){return s(this,Wt)}isArchived(){return s(this,tn)}isEdited(){return s(this,Fr)}isLocked(){return s(this,Gt)}isNsfw(){return s(this,Vt)}isQuarantined(){return s(this,rn)}isSpoiler(){return s(this,zt)}isHidden(){return s(this,Jt)}isIgnoringReports(){return s(this,$t)}isDistinguishedBy(){return s(this,mt)}async edit(e){let t=await N.edit({id:this.id,...e},s(this,D));l(this,Zi,t.body),l(this,Fr,t.edited)}async addComment(e){return $.submit({id:this.id,...e},s(this,D))}async delete(){return N.delete(this.id,s(this,D))}async approve(){await N.approve(this.id,s(this,D)),l(this,Ht,!0),l(this,Wt,!1)}async remove(e=!1){await N.remove(this.id,e,s(this,D)),l(this,Wt,!0),l(this,Or,e),l(this,Ht,!1)}async lock(){await N.lock(this.id,s(this,D)),l(this,Gt,!0)}async unlock(){await N.unlock(this.id,s(this,D)),l(this,Gt,!1)}async hide(){await N.hide(this.id,s(this,D)),l(this,Jt,!0)}async unhide(){await N.unhide(this.id,s(this,D)),l(this,Jt,!1)}async markAsNsfw(){await N.markAsNsfw(this.id,s(this,D)),l(this,Vt,!0)}async unmarkAsNsfw(){await N.unmarkAsNsfw(this.id,s(this,D)),l(this,Vt,!1)}async markAsSpoiler(){await N.markAsSpoiler(this.id,s(this,D)),l(this,zt,!0)}async unmarkAsSpoiler(){await N.unmarkAsSpoiler(this.id,s(this,D)),l(this,zt,!1)}async sticky(e){await N.sticky(this.id,e,s(this,D))}async unsticky(){await N.unsticky(this.id,s(this,D))}async distinguish(){let{distinguishedBy:e}=await N.distinguish(this.id,!1,s(this,D));l(this,mt,e)}async distinguishAsAdmin(){let{distinguishedBy:e}=await N.distinguish(this.id,!0,s(this,D));l(this,mt,e)}async undistinguish(){let{distinguishedBy:e}=await N.undistinguish(this.id,s(this,D));l(this,mt,e)}async ignoreReports(){await N.ignoreReports(this.id,s(this,D)),l(this,$t,!0)}async unignoreReports(){await N.unignoreReports(this.id,s(this,D)),l(this,$t,!1)}async getAuthor(){return I.getByUsername(s(this,Xi),s(this,D))}async crosspost(e){return N.crosspost({...e,postId:this.id},s(this,D))}addRemovalNote(e){return Oe.addRemovalNote({itemIds:[s(this,Ki)],...e},s(this,D))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=or(e)?e:`t3_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.length)throw new Error("could not find post");let a=o.data.children[0];if(!a?.data)throw new Error("could not find post");return new N(a.data,t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,n;if("preview"in e){g(t,"Missing metadata in `SubmitPostOptions`");let c=await new at(()=>e.preview,void 0,{},t,void 0).buildBlocksUI(),p=rF.encode(c).finish();n=await i.Submit({kind:"custom",sr:e.subredditName,richtextJson:(0,qS.fromByteArray)(p),...e},t)}else n=await i.Submit({kind:"kind"in e?e.kind:"url"in e?"link":"self",sr:e.subredditName,richtextJson:"richtext"in e?Bi(e.richtext):void 0,...e},t);if("kind"in e&&["image","video","videogif"].includes(e.kind)&&!n.json?.data?.id&&"url"in e)throw new Error(`Post of ${e.kind} type with ${e.url} is being created asynchronously and should be updated in the subreddit soon.`);if(!n.json?.data?.id||n.json?.errors?.length)throw new Error(`failed to submit post - either post ID is empty or request failed with errors: ${n.json?.errors}`);return N.getById(`t3_${n.json.data.id}`,t)}static async crosspost(e,t){let i=u.redditAPIPlugins.LinksAndComments,{postId:n,subredditName:o,...a}=e,c=await i.Submit({kind:"crosspost",sr:o,crosspostFullname:me(n),...a},t);if(!c.json?.data?.id||c.json?.errors?.length)throw new Error("failed to crosspost post");return N.getById(`t3_${c.json.data.id}`,t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;if("richtext"in e&&(o=Bi(e.richtext)),(await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t)).json?.errors?.length)throw new Error("Failed to edit post");return N.getById(n,t)}static async delete(e,t){await u.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await u.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await u.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async hide(e,t){await u.redditAPIPlugins.LinksAndComments.Hide({id:e},t)}static async unhide(e,t){await u.redditAPIPlugins.LinksAndComments.Unhide({id:e},t)}static async markAsNsfw(e,t){await u.redditAPIPlugins.LinksAndComments.MarkNSFW({id:e},t)}static async unmarkAsNsfw(e,t){await u.redditAPIPlugins.LinksAndComments.UnmarkNSFW({id:e},t)}static async markAsSpoiler(e,t){await u.redditAPIPlugins.LinksAndComments.Spoiler({id:e},t)}static async unmarkAsSpoiler(e,t){await u.redditAPIPlugins.LinksAndComments.Unspoiler({id:e},t)}static async sticky(e,t,i){await u.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!0,num:t},i)}static async unsticky(e,t){await u.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!1},t)}static async lock(e,t){await u.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await u.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async distinguish(e,t,i){let a=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:t?"admin":"yes",sticky:!1},i)).json?.data?.things?.[0]?.data;return g(a),{distinguishedBy:a.distinguished}}static async undistinguish(e,t){let o=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:"no",sticky:!1},t)).json?.data?.things?.[0]?.data;return g(o),{distinguishedBy:o.distinguished}}static async ignoreReports(e,t){await u.redditAPIPlugins.Moderation.IgnoreReports({id:e},t)}static async unignoreReports(e,t){await u.redditAPIPlugins.Moderation.UnignoreReports({id:e},t)}static getControversialPosts(e={},t){return this.getSortedPosts({...e,sort:"controversial"},t)}static getTopPosts(e={},t){return this.getSortedPosts({...e,sort:"top"},t)}static getSortedPosts(e,t){let i=u.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Sort({show:"all",sort:e.sort,t:e.timeframe,subreddit:e.subredditName,...n},t);return Ks(o,t)}})}static getHotPosts(e={location:"GLOBAL"},t){let i=u.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Hot({g:e.location,show:"all",subreddit:e.subredditName,...n},t);return Ks(o,t)}})}static getNewPosts(e,t){let i=u.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.New({show:"all",subreddit:e.subredditName,...n},t);return Ks(o,t)}})}static getRisingPosts(e,t){let i=u.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Rising({show:"all",subreddit:e.subredditName,...n},t);return Ks(o,t)}})}static getPostsByUser(e,t){let i=u.redditAPIPlugins.Users;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"submitted",...n},t);return Ks(o,t)}})}};Ki=new WeakMap,Xs=new WeakMap,Xi=new WeakMap,Zs=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,eo=new WeakMap,to=new WeakMap,Zi=new WeakMap,ro=new WeakMap,io=new WeakMap,no=new WeakMap,so=new WeakMap,oo=new WeakMap,ao=new WeakMap,Ht=new WeakMap,lo=new WeakMap,uo=new WeakMap,Or=new WeakMap,Yi=new WeakMap,Wt=new WeakMap,Qi=new WeakMap,en=new WeakMap,tn=new WeakMap,Fr=new WeakMap,Gt=new WeakMap,Vt=new WeakMap,rn=new WeakMap,zt=new WeakMap,Jt=new WeakMap,$t=new WeakMap,mt=new WeakMap,co=new WeakMap,mo=new WeakMap,nn=new WeakMap,sn=new WeakMap,D=new WeakMap;var G=N;function Ks(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>new G(i.data,e)),before:r.data.before,after:r.data.after}}var po,on,fo,go,ho,vo,yo,Kt,bo,ko,pt,Mr=class Mr{constructor(e,t){d(this,po,void 0);d(this,on,void 0);d(this,fo,void 0);d(this,go,void 0);d(this,ho,void 0);d(this,vo,void 0);d(this,yo,void 0);d(this,Kt,new Map);d(this,bo,void 0);d(this,ko,void 0);d(this,pt,void 0);V(this),g(e.id,"User ID is missing or undefined"),g(e.name,"Username is missing or undefined"),g(e.createdUtc,"User is missing created date"),l(this,po,ee(yd(e.id)?e.id:`t2_${e.id}`)),l(this,on,e.name),l(this,vo,e.over18??!1),l(this,yo,e.isEmployee??!1);let i=new Date(0);if(i.setUTCSeconds(e.createdUtc),l(this,fo,i),l(this,go,e.linkKarma??0),l(this,ho,e.commentKarma??0),e.modPermissions)for(let[n,o]of Object.entries(e.modPermissions))s(this,Kt).set(n,BS(o));l(this,bo,new URL(e.subreddit?.url??"","https://www.reddit.com").toString()),l(this,ko,e.subreddit?.url??""),l(this,pt,t)}get id(){return s(this,po)}get username(){return s(this,on)}get createdAt(){return s(this,fo)}get linkKarma(){return s(this,go)}get commentKarma(){return s(this,ho)}get nsfw(){return s(this,vo)}get isAdmin(){return s(this,yo)}get modPermissions(){return s(this,Kt)}get url(){return s(this,bo)}get permalink(){return s(this,ko)}toJSON(){return{id:this.id,username:this.username,createdAt:this.createdAt,linkKarma:this.linkKarma,commentKarma:this.commentKarma,nsfw:this.nsfw,modPermissionsBySubreddit:Object.fromEntries(this.modPermissions)}}async getModPermissionsForSubreddit(e){if(s(this,Kt).has(e))return s(this,Kt).get(e);let t=await Mr.getSubredditUsersByType({subredditName:e,type:"moderators",username:this.username},s(this,pt)).all();if(t.length===0)return[];let i=t[0].modPermissions.get(e)??[];return i.length>0&&s(this,Kt).set(e,i),i}getComments(e){return $.getCommentsByUser({username:this.username,...e},s(this,pt))}getPosts(e){return G.getPostsByUser({username:this.username,...e},s(this,pt))}async getUserFlairBySubreddit(e){let t=await Fe.getUserFlairBySubreddit({subreddit:e,name:s(this,on)},s(this,pt));return t.users[0]?$s(t.users[0]):void 0}getSnoovatarUrl(){return Mr.getSnoovatarUrl(this.username,s(this,pt))}static async getById(e,t){let o=(await u.redditAPIPlugins.Users.UserDataByAccountIds({ids:e},t))?.users?.[e]?.name;return o==null?void 0:Mr.getByUsername(o,t)}static async getByUsername(e,t){let n=await u.redditAPIPlugins.Users.UserAbout({username:e},t);if(n.data?.id)return new Mr(n.data,t)}static async getFromMetadata(e,t){g(t);let i=t?.[e]?.values[0];return i?Mr.getById(ee(i),t):Promise.resolve(void 0)}static getSubredditUsersByType(e,t){let i=u.redditAPIPlugins.Subreddits;return new j({hasMore:!0,pageSize:e.pageSize,limit:e.limit,after:e.after,before:e.before,fetch:async n=>{let o=await i.AboutWhere({where:e.type,user:e.username,subreddit:e.subredditName,show:"all",...n},t);return nF(o,e.subredditName,t)}})}static async createRelationship(e,t){let i=u.redditAPIPlugins.Users,{type:n,subredditName:o,username:a,permissions:c,...p}=e,f=await i.Friend({type:n,subreddit:o,name:a,permissions:c?Qm(c):void 0,...p},t);if(f.json?.errors?.length)throw new Error(f.json.errors.join(`
4
- `))}static async removeRelationship(e,t){await u.redditAPIPlugins.Users.Unfriend({type:e.type,subreddit:e.subredditName,name:e.username},t)}static async setModeratorPermissions(e,t,i,n){let a=await u.redditAPIPlugins.Users.SetPermissions({subreddit:t,name:e,type:"moderator",permissions:Qm(i)},n);if(a.json?.errors?.length)throw new Error(a.json.errors.join(`
5
- `))}static async getSnoovatarUrl(e,t){let i="GetSnoovatarUrlByName",n="c47fd42345af268616d2d8904b56856acdc05cf61d3650380f539ad7d596ac0c";return(await qt.query(i,n,{username:e},t)).data?.redditorInfoByName?.snoovatarIcon?.url}static getOverview(e,t){let i=u.redditAPIPlugins.Users;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"overview",...n},t);return iF(o,t)}})}};po=new WeakMap,on=new WeakMap,fo=new WeakMap,go=new WeakMap,ho=new WeakMap,vo=new WeakMap,yo=new WeakMap,Kt=new WeakMap,bo=new WeakMap,ko=new WeakMap,pt=new WeakMap;var I=Mr;function iF(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>{if(i.kind==="t3")return new G(i.data,e);if(i.kind==="t1")return new $(i.data,e);throw new Error(`Type ${i.kind} is not supported`)}),before:r.data.before,after:r.data.after}}async function nF(r,e,t){let i=u.redditAPIPlugins.Users;if(!r.data?.children)throw new Error("Listing response is missing children");let n=r.data.children.map(v=>(g(v.data?.id,"User id is still from listing data"),v.data.id)),o=100,a=[];for(let v=0;v<n.length;v+=o)a.push(n.slice(v,v+o));let p=(await Promise.all(a.map(v=>i.UserDataByAccountIds({ids:v.join(",")},t)))).reduce((v,m)=>({...v,...m.users}),{});return{children:r.data.children.map(v=>{let m=v.data?.id;g(m,"User id is missing from listing");let b=p[m];return g(b,"User data is missing from response"),new I({id:m,name:b.name,linkKarma:b.linkKarma,commentKarma:b.commentKarma,createdUtc:b.createdUtc,over18:b.profileOver18,snoovatarSize:[],modPermissions:{[e]:v.data?.modPermissions??[]}},t)}),before:r.data.before,after:r.data.after}}var Lr,So,an,dn,Po,Co,ln,Io,wo,un,Xt,xo,To,Ur,Zt,Yt,ft,Br,gt,Ao,Eo,Ro,Oo,Fo,Mo,Lo,Z,cn,Il,mn,wl,H=class H{constructor(e,t){d(this,Lr,void 0);d(this,So,void 0);d(this,an,void 0);d(this,dn,void 0);d(this,Po,void 0);d(this,Co,void 0);d(this,ln,void 0);d(this,Io,void 0);d(this,wo,void 0);d(this,un,void 0);d(this,Xt,void 0);d(this,xo,void 0);d(this,To,void 0);d(this,Ur,void 0);d(this,Zt,void 0);d(this,Yt,void 0);d(this,ft,void 0);d(this,Br,void 0);d(this,gt,void 0);d(this,Ao,void 0);d(this,Eo,void 0);d(this,Ro,void 0);d(this,Oo,void 0);d(this,Fo,void 0);d(this,Mo,void 0);d(this,Lo,void 0);d(this,Z,void 0);var n;V(this),g(e.id,"Comment id is null or undefined"),g(e.body,"Comment body is null or undefined"),g(e.createdUtc,"Comment is missing created date"),g(e.author,"Comment author is null or undefined"),g(e.parentId,"Comment parentId is null or undefined"),g(e.linkId,"Comment linkId is null or undefined"),g(e.permalink,"Comment permalink is null or undefined"),g(e.subreddit,"Comment is missing subreddit name"),g(e.subredditId,"Comment is missing subreddit id"),l(this,Lr,Yr(`t1_${e.id}`)),l(this,So,e.authorFullname?ee(e.authorFullname):void 0),l(this,an,e.author),l(this,dn,e.body),l(this,Io,Ae(e.subredditId)),l(this,wo,e.subreddit),l(this,Co,Hc(e.parentId)?Yr(e.parentId):me(e.parentId)),l(this,ln,me(e.linkId)),l(this,Ur,e.edited??!1),l(this,Zt,e.locked??!1),l(this,Yt,e.removed??!1),l(this,ft,e.stickied??!1),l(this,Xt,e.approved??!1),l(this,xo,e.approvedAtUtc??0),l(this,To,e.bannedAtUtc??0),l(this,Br,e.spam??!1),l(this,gt,e.distinguished),l(this,Ao,e.numReports??0),l(this,Eo,e.collapsedBecauseCrowdControl??!1),l(this,Ro,e.score??0),l(this,Oo,e.permalink),l(this,Lo,new URL(e.permalink??"","https://www.reddit.com/").toString()),l(this,Fo,(e.modReports??[]).map(([o])=>o)),l(this,Mo,(e.userReports??[]).map(([o])=>o));let i=new Date(0);i.setUTCSeconds(e.createdUtc),l(this,Po,i),l(this,un,S(n=H,cn,Il).call(n,{postId:s(this,ln),commentId:s(this,Lr)},t)),l(this,Z,t)}get id(){return s(this,Lr)}get authorId(){return s(this,So)}get authorName(){return s(this,an)}get subredditId(){return s(this,Io)}get subredditName(){return s(this,wo)}get body(){return s(this,dn)}get createdAt(){return s(this,Po)}get parentId(){return s(this,Co)}get postId(){return s(this,ln)}get replies(){return s(this,un)}get distinguishedBy(){return s(this,gt)}get locked(){return s(this,Zt)}get stickied(){return s(this,ft)}get removed(){return s(this,Yt)}get approved(){return s(this,Xt)}get approvedAtUtc(){return s(this,xo)}get bannedAtUtc(){return s(this,To)}get spam(){return s(this,Br)}get edited(){return s(this,Ur)}get numReports(){return s(this,Ao)}get collapsedBecauseCrowdControl(){return s(this,Eo)}get score(){return s(this,Ro)}get permalink(){return s(this,Oo)}get userReportReasons(){return s(this,Mo)}get modReportReasons(){return s(this,Fo)}get url(){return s(this,Lo)}toJSON(){return{id:this.id,authorName:this.authorName,subredditId:this.subredditId,subredditName:this.subredditName,body:this.body,createdAt:this.createdAt,parentId:this.parentId,postId:this.postId,replies:this.replies,approved:this.approved,locked:this.locked,removed:this.removed,stickied:this.stickied,spam:this.spam,edited:this.edited,distinguishedBy:this.distinguishedBy,numReports:this.numReports,collapsedBecauseCrowdControl:this.collapsedBecauseCrowdControl,score:this.score,permalink:this.permalink,modReportReasons:this.modReportReasons,userReportReasons:this.userReportReasons,url:this.url}}isLocked(){return s(this,Zt)}isApproved(){return s(this,Xt)}isRemoved(){return s(this,Yt)}isSpam(){return s(this,Br)}isStickied(){return s(this,ft)}isDistinguished(){return!!s(this,gt)}isEdited(){return s(this,Ur)}async delete(){return H.delete(this.id,s(this,Z))}async edit(e){let t=await H.edit({id:this.id,...e},s(this,Z));return l(this,dn,t.body),l(this,Ur,t.edited),this}async approve(){await H.approve(this.id,s(this,Z)),l(this,Xt,!0),l(this,Yt,!1)}async remove(e=!1){await H.remove(this.id,e,s(this,Z)),l(this,Yt,!0),l(this,Br,e),l(this,Xt,!1)}async lock(){await H.lock(this.id,s(this,Z)),l(this,Zt,!0)}async unlock(){await H.unlock(this.id,s(this,Z)),l(this,Zt,!1)}async reply(e){return H.submit({id:this.id,...e},s(this,Z))}async getAuthor(){return I.getByUsername(s(this,an),s(this,Z))}async distinguish(e=!1){let{distinguishedBy:t,stickied:i}=await H.distinguish(this.id,e,!1,s(this,Z));l(this,gt,t),l(this,ft,i)}async distinguishAsAdmin(e=!1){let{distinguishedBy:t,stickied:i}=await H.distinguish(this.id,e,!0,s(this,Z));l(this,gt,t),l(this,ft,i)}async undistinguish(){let{distinguishedBy:e,stickied:t}=await H.undistinguish(this.id,s(this,Z));l(this,gt,e),l(this,ft,t)}addRemovalNote(e){return Oe.addRemovalNote({itemIds:[s(this,Lr)],...e},s(this,Z))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=St(e)?e:`t1_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.[0]?.data)throw new Error("not found");return new H(o.data.children[0].data,t)}static getComments(e,t){var a;let{postId:i,commentId:n,...o}=e;return S(a=H,cn,Il).call(a,{postId:me(i),commentId:n?Yr(n):void 0,...o},t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=Bi(e.richtext));let a=await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("Failed to edit comment");let c=a.json?.data?.things?.[0]?.data;return g(c),new H(c,t)}static async delete(e,t){await u.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await u.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await u.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async lock(e,t){await u.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await u.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=Bi(e.richtext));let a=await i.Comment({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("failed to reply to comment");let c=a.json?.data?.things?.[0]?.data;return g(c),new H(c,t)}static async distinguish(e,t,i,n){let c=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:i?"admin":"yes",sticky:t},n)).json?.data?.things?.[0]?.data;return g(c),{distinguishedBy:c.distinguished,stickied:!!c.stickied}}static async undistinguish(e,t){let o=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:"no",sticky:!1},t)).json?.data?.things?.[0]?.data;return g(o),{distinguishedBy:o.distinguished,stickied:!!o.stickied}}static getCommentsByUser(e,t){let i=u.redditAPIPlugins.Users;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"comments",...n},t);return g(o.data,"Failed to get comments for user"),{children:o.data.children?.map(c=>new H(c.data,t))||[],before:o.data.before,after:o.data.after}}})}};Lr=new WeakMap,So=new WeakMap,an=new WeakMap,dn=new WeakMap,Po=new WeakMap,Co=new WeakMap,ln=new WeakMap,Io=new WeakMap,wo=new WeakMap,un=new WeakMap,Xt=new WeakMap,xo=new WeakMap,To=new WeakMap,Ur=new WeakMap,Zt=new WeakMap,Yt=new WeakMap,ft=new WeakMap,Br=new WeakMap,gt=new WeakMap,Ao=new WeakMap,Eo=new WeakMap,Ro=new WeakMap,Oo=new WeakMap,Fo=new WeakMap,Mo=new WeakMap,Lo=new WeakMap,Z=new WeakMap,cn=new WeakSet,Il=function(e,t,i=0){return new j({limit:e.limit,pageSize:e.pageSize,fetch:async n=>{var b,y;let o=n.limit,a=u.redditAPIPlugins.Listings,c=u.redditAPIPlugins.LinksAndComments,p=e.commentId;if(n.more)if(n.more.children.length){let C=n.more;(!o||o>100)&&(o=100);let w=C.children.splice(0,o),T=await c.MoreChildren({linkId:e.postId,children:w,sort:e.sort},t);if(!T.json?.data?.things?.length)return{children:[]};let{children:F}=S(b=H,mn,wl).call(b,T.json.data.things,e.postId,e,t);return{children:F,more:C.children.length?C:void 0}}else p=n.more.parentId,i=i+n.more.depth;let v=(await a.Comments({article:e.postId.substring(3),comment:p?.substring(3),limit:o,depth:e.depth,sort:e.sort},t)).listings?.[1]?.data?.children??[],m=v[0];return p&&m?.data?.replyList?.data&&(v=m.data.replyList.data.children),S(y=H,mn,wl).call(y,v,p??e.postId,e,t,i)}})},mn=new WeakSet,wl=function(e,t,i,n,o=0){var f,v;let a=[],c,p={};for(let m of e){if(!m.data||(m.data.depth!=null&&(m.data.depth=m.data.depth+o),m.data.depth!=null&&i.depth!=null&&m.data.depth>=i.depth))continue;let b=m.data.parentId?p[m.data.parentId]:void 0;if(m.kind==="t1"){if(m.data.name===t)continue;let y=new H(m.data,n);if(p[y.id]=y,l(y,un,S(f=H,cn,Il).call(f,{...i,postId:y.postId,commentId:y.id},n,o)),"replyList"in m.data&&m.data.replyList?.data){let{children:C,more:w}=S(v=H,mn,wl).call(v,m.data.replyList.data.children,y.id,i,n,o);C.length&&y.replies.children.push(...C),w&&y.replies.setMore(w)}y.replies.preventInitialFetch(),b?b.replies.children.push(y):a.push(y)}else if(m.kind==="more"&&m.data.parentId&&m.data.depth!=null){let y={parentId:Hc(m.data.parentId)?Yr(m.data.parentId):me(m.data.parentId),children:m.data.children??[],depth:m.data.depth};b?b.replies.setMore(y):y.parentId===t&&(c=y)}}return{children:a,more:c}},d(H,cn),d(H,mn);var $=H;function Rd(r,e){let t=u.redditAPIPlugins.Moderation;return new j({hasMore:!0,after:r.after,before:r.before,limit:r.limit,pageSize:r.pageSize,fetch:async i=>{let n=await t.AboutLog({subreddit:r.subredditName,mod:r.moderatorUsernames?r.moderatorUsernames.join(","):void 0,type:r.type,...i},e);return sF(n)}})}function sF(r){if(!r.data?.children)throw new Error("AboutLogResponse is missing children");return{children:r.data.children.map(t=>{if(!t.data)throw new Error("ModAction from AboutLogResponse is missing or invalid");let{id:i,mod:n,modId36:o,createdUtc:a,subreddit:c,subredditNamePrefixed:p,action:f,srId36:v,description:m,details:b,targetAuthor:y,targetBody:C,targetFullname:w,targetPermalink:T,targetTitle:F}=t.data;g(i,"ModAction from AboutLogResponse is missing id"),g(n,"ModAction from AboutLogResponse is missing mod"),g(o,"ModAction from AboutLogResponse is missing modId36"),g(a,"ModAction from AboutLogResponse is missing createdUtc"),g(c,"ModAction from AboutLogResponse is missing subreddit"),g(p,"ModAction from AboutLogResponse is missing subredditNamePrefixed"),g(f,"ModAction from AboutLogResponse is missing action"),g(v,"ModAction from AboutLogResponse is missing srId36");let de=new Date(0);return de.setUTCSeconds(a),{id:i,type:f,moderatorName:n,moderatorId:`t2_${o}`,createdAt:de,subredditName:c,subredditId:`t5_${v}`,description:m,details:b,target:w?{id:w,author:y,body:C,permalink:T,title:F}:void 0}}),after:r.data.after,before:r.data.before}}var oF=(a=>(a.New="New",a.InProgress="InProgress",a.Archived="Archived",a.Appeals="Appeals",a.JoinRequests="JoinRequests",a.Filtered="Filtered",a))(oF||{}),aF={0:"New",1:"InProgress",2:"Archived",3:"Appeals",4:"JoinRequests",5:"Filtered"},dF=(y=>(y.Highlighted="Highlighted",y.Unhighlighted="Unhighlighted",y.Archived="Archived",y.Unarchived="Unarchived",y.ReportedToAdmins="ReportedToAdmins",y.Muted="Muted",y.Unmuted="Unmuted",y.Banned="Banned",y.Unbanned="Unbanned",y.Approved="Approved",y.Disapproved="Disapproved",y.Filtered="Filtered",y.Unfiltered="Unfiltered",y))(dF||{}),lF={0:"Highlighted",1:"Unhighlighted",2:"Archived",3:"Unarchived",4:"ReportedToAdmins",5:"Muted",6:"Unmuted",7:"Banned",8:"Unbanned",9:"Approved",10:"Disapproved",11:"Filtered",12:"Unfiltered"},W,X,ie,xl,jS,Tl,HS,Od=class{constructor(e){d(this,X);d(this,xl);d(this,Tl);d(this,W,void 0);l(this,W,e)}async bulkReadConversations(e,t){let i=u.redditAPIPlugins.NewModmail,{conversationIds:n}=await i.BulkReadConversations({entity:e.join(","),state:t},s(this,W));return n}async getConversations(e){let i=await u.redditAPIPlugins.NewModmail.GetConversations({after:e.after,entity:e.subreddits?e.subreddits.join(","):void 0,limit:e.limit,sort:e.sort,state:e.state},s(this,W)),n={};for(let o in i.conversations)n[o]=S(this,X,ie).call(this,{protoConversation:i.conversations[o],protoMessages:i.messages,protoModActions:{}});return{conversations:n,viewerId:i.viewerId}}async getConversation(e){let i=await u.redditAPIPlugins.NewModmail.GetConversation({...e,markRead:!!e.markRead},s(this,W));return{participantSubreddit:i.participantSubreddit,conversation:S(this,X,ie).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getSubreddits(){let e=u.redditAPIPlugins.NewModmail,{subreddits:t}=await e.Subreddits({},s(this,W));return t}async createConversation(e){let i=await u.redditAPIPlugins.NewModmail.CreateConversation({body:e.body,isAuthorHidden:e.isAuthorHidden??!1,srName:e.subredditName,subject:e.subject,to:e.to?e.to:void 0},s(this,W));return{conversation:S(this,X,ie).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async reply(e){let i=await u.redditAPIPlugins.NewModmail.CreateConversationMessage({body:e.body,conversationId:e.conversationId,isAuthorHidden:e.isAuthorHidden??!1,isInternal:e.isInternal??!1},s(this,W));return{conversation:S(this,X,ie).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:{}}),user:i.user}}async highlightConversation(e){let i=await u.redditAPIPlugins.NewModmail.HighlightConversation({conversationId:e},s(this,W));return{conversation:S(this,X,ie).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unhighlightConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnhighlightConversation({conversationId:e},s(this,W));return{conversation:S(this,X,ie).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async archiveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ArchiveConversation({conversationId:e},s(this,W));return{conversation:S(this,X,ie).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unarchiveConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnarchiveConversation({conversationId:e},s(this,W));return{conversation:S(this,X,ie).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async muteConversation(e){let i=await u.redditAPIPlugins.NewModmail.MuteConversation({conversationId:e.conversationId,numHours:e.numHours},s(this,W));return{conversation:S(this,X,ie).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unmuteConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnmuteConversation({conversationId:e},s(this,W));return{conversation:S(this,X,ie).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async readConversations(e){await u.redditAPIPlugins.NewModmail.Read({conversationIds:e.join(",")},s(this,W))}async unreadConversations(e){await u.redditAPIPlugins.NewModmail.Unread({conversationIds:e.join(",")},s(this,W))}async approveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ApproveConversation({conversationId:e},s(this,W));return{conversation:S(this,X,ie).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async disapproveConversation(e){let i=await u.redditAPIPlugins.NewModmail.DisapproveConversation({conversationId:e},s(this,W));return{conversation:S(this,X,ie).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async tempBanConversation(e){let i=await u.redditAPIPlugins.NewModmail.TempBan({...e},s(this,W));return{conversation:S(this,X,ie).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unbanConversation(e){let i=await u.redditAPIPlugins.NewModmail.Unban({conversationId:e},s(this,W));return{conversation:S(this,X,ie).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getUnreadCount(){return await u.redditAPIPlugins.NewModmail.UnreadCount({},s(this,W))}async getUserConversations(e){return await u.redditAPIPlugins.NewModmail.UserConversations({conversationId:e},s(this,W))}};W=new WeakMap,X=new WeakSet,ie=function({protoConversation:e,protoMessages:t,protoModActions:i}){return{...e,state:aF[e.state],messages:S(this,xl,jS).call(this,e,t),modActions:S(this,Tl,HS).call(this,e,i)}},xl=new WeakSet,jS=function(e,t){let i={},n=e.objIds.filter(o=>o.key==="messages").map(({id:o})=>o);for(let o of n){let a=t[o];a&&(i[o]=a)}return i},Tl=new WeakSet,HS=function(e,t){let i={},n=e.objIds.filter(o=>o.key==="modActions").map(({id:o})=>o);for(let o of n){let a=t[o];a&&(i[o]={...a,actionType:lF[a.actionTypeId]})}return i};var pn,fn,Al,Uo,Bo,Do,_o,ip=class ip{constructor(e,t){d(this,pn,void 0);d(this,fn,void 0);d(this,Al,void 0);d(this,Uo,void 0);d(this,Bo,void 0);d(this,Do,void 0);d(this,_o,void 0);if(V(this),g(e.id,"PrivateMessage: Invalid data, no id"),g(e.name,"PrivateMessage: Invalid data, no name"),g(e.created,"PrivateMessage: Invalid data, no created date"),l(this,pn,pe(e.name)),e.author!=null)l(this,fn,{type:"user",username:e.author,id:e.authorFullname?ee(e.authorFullname):void 0});else if(e.subreddit!=null)l(this,fn,{type:"subreddit",name:e.subreddit,id:e.subredditId?Ae(e.subredditId):void 0});else throw new Error("PrivateMessage: Invalid data, no author or subreddit");l(this,Uo,e.body??""),l(this,Bo,e.bodyHtml??"");let i=new Date(0);i.setUTCSeconds(e.createdUtc),l(this,Do,i),l(this,Al,e.parentId?pe(e.parentId):void 0),l(this,_o,t)}static async getMessages(e,t){let i=u.redditAPIPlugins.PrivateMessages;return new j({...e,fetch:async n=>{let o=await i.MessageWhere({...n,where:e.type??"inbox"},t);return{after:o.data?.after,before:o.data?.before,children:o.data?.children?.map(a=>new ip(a.data,t)).filter(Boolean)||[]}}})}static async send({to:e,subject:t,text:i},n){await u.redditAPIPlugins.PrivateMessages.Compose({to:e,subject:t,text:i,fromSr:""},n)}static async sendAsSubreddit({to:e,fromSubredditName:t,subject:i,text:n},o){await u.redditAPIPlugins.PrivateMessages.Compose({to:e,fromSr:t,subject:i,text:n},o)}static async markAllAsRead(e){await u.redditAPIPlugins.PrivateMessages.ReadAllMessages({filterTypes:""},e)}get id(){return s(this,pn)}get from(){return s(this,fn)}get body(){return s(this,Uo)}get bodyHtml(){return s(this,Bo)}get created(){return s(this,Do)}async markAsRead(){await u.redditAPIPlugins.PrivateMessages.ReadMessage({id:s(this,pn)},s(this,_o))}};pn=new WeakMap,fn=new WeakMap,Al=new WeakMap,Uo=new WeakMap,Bo=new WeakMap,Do=new WeakMap,_o=new WeakMap;var lr=ip;var Ry=(o=>(o.Reports="reports",o.Spam="spam",o.Modqueue="modqueue",o.Unmoderated="unmoderated",o.Edited="edited",o))(Ry||{}),gn,x,No,qo,jo,Ho,Wo,Go,Vo,zo,Jo,hn,A,tt=class tt{constructor(e,t){d(this,gn,void 0);d(this,x,void 0);d(this,No,void 0);d(this,qo,void 0);d(this,jo,void 0);d(this,Ho,void 0);d(this,Wo,void 0);d(this,Go,void 0);d(this,Vo,void 0);d(this,zo,void 0);d(this,Jo,void 0);d(this,hn,void 0);d(this,A,void 0);V(this),g(e.id,"Subreddit id is missing or undefined"),g(e.displayName,"Subreddit name is missing or undefined"),l(this,gn,Ae(`t5_${e.id}`)),l(this,x,e.displayName),g(e.createdUtc,"Subreddit is missing created date");let i=new Date(0);i.setUTCSeconds(e.createdUtc),l(this,No,i),l(this,qo,uF(e.subredditType)),l(this,jo,e.title),l(this,Ho,e.description),g(e.lang,"Subreddit is missing language"),l(this,Wo,e.lang),l(this,Go,e.subscribers??0),l(this,Vo,e.activeUserCount??0),l(this,zo,e.over18??!1),l(this,hn,e.url??""),l(this,Jo,{acceptFollowers:e.acceptFollowers??!1,allOriginalContent:e.allOriginalContent??!1,allowChatPostCreation:e.allowChatPostCreation??!1,allowDiscovery:e.allowDiscovery??!1,allowGalleries:e.allowGalleries??!1,allowImages:e.allowImages??!1,allowPolls:e.allowPolls??!1,allowPredictionContributors:e.allowPredictionContributors??!1,allowPredictions:e.allowPredictions??!1,allowPredictionsTournament:e.allowPredictionsTournament??!1,allowTalks:e.allowTalks??!1,allowVideoGifs:e.allowVideogifs??!1,allowVideos:e.allowVideos??!1,chatPostEnabled:e.isChatPostFeatureEnabled??!1,collectionsEnabled:e.collectionsEnabled??!1,crosspostable:e.isCrosspostableSubreddit??!1,emojisEnabled:e.emojisEnabled??!1,eventPostsEnabled:e.eventPostsEnabled??!1,linkFlairEnabled:e.linkFlairEnabled??!1,originalContentTagEnabled:e.originalContentTagEnabled??!1,restrictCommenting:e.restrictCommenting??!1,restrictPosting:e.restrictPosting??!1,shouldArchivePosts:e.shouldArchivePosts??!1,spoilersEnabled:e.spoilersEnabled??!1,wikiEnabled:e.wikiEnabled??!1,allowedPostType:cF(e.submissionType),allowedMediaInComments:(e.allowedMediaInComments??[]).map(mF),bannerBackgroundColor:e.bannerBackgroundColor,bannerBackgroundImage:e.bannerBackgroundImage,bannerImage:e.bannerImg,communityIcon:e.communityIcon,headerTitle:e.headerTitle,mobileBannerImage:e.mobileBannerImage,userFlairs:{enabled:e.userFlairEnabledInSr??!1,usersCanAssign:e.canAssignUserFlair??!1},postFlairs:{enabled:e.linkFlairEnabled??!1,usersCanAssign:e.canAssignLinkFlair??!1},url:new URL(s(this,hn),"https://www.reddit.com").toString()}),l(this,A,t)}get id(){return s(this,gn)}get name(){return s(this,x)}get createdAt(){return s(this,No)}get type(){return s(this,qo)}get title(){return s(this,jo)}get description(){return s(this,Ho)}get language(){return s(this,Wo)}get numberOfSubscribers(){return s(this,Go)}get numberOfActiveUsers(){return s(this,Vo)}get nsfw(){return s(this,zo)}get settings(){return s(this,Jo)}get userFlairsEnabled(){return this.settings.userFlairs.enabled}get postFlairsEnabled(){return this.settings.postFlairs.enabled}get usersCanAssignUserFlairs(){return this.settings.userFlairs.usersCanAssign}get usersCanAssignPostFlairs(){return this.settings.postFlairs.usersCanAssign}get url(){return this.settings.url}get permalink(){return s(this,hn)}toJSON(){return{id:this.id,name:this.name,createdAt:this.createdAt,type:this.type,title:this.title,description:this.description,language:this.language,nsfw:this.nsfw,numberOfSubscribers:this.numberOfSubscribers,numberOfActiveUsers:this.numberOfActiveUsers,settings:this.settings}}async submitPost(e){let t={...e,subredditName:s(this,x)};return G.submit(t,s(this,A))}getControversialPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return G.getControversialPosts({...e,subredditName:s(this,x)},s(this,A))}getTopPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return G.getTopPosts({...e,subredditName:s(this,x)},s(this,A))}getApprovedUsers(e={}){return I.getSubredditUsersByType({type:"contributors",subredditName:s(this,x),...e},s(this,A))}approveUser(e){return I.createRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,A))}removeUser(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,A))}getWikiContributors(e={}){return I.getSubredditUsersByType({type:"wikicontributors",subredditName:s(this,x),...e},s(this,A))}addWikiContributor(e){return I.createRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,A))}removeWikiContributor(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,A))}getBannedUsers(e={}){return I.getSubredditUsersByType({type:"banned",subredditName:s(this,x),...e},s(this,A))}banUser(e){return I.createRelationship({username:e.username,subredditName:s(this,x),type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,A))}unbanUser(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"banned"},s(this,A))}getBannedWikiContributors(e={}){return I.getSubredditUsersByType({type:"wikibanned",subredditName:s(this,x),...e},s(this,A))}banWikiContributor(e){return I.createRelationship({username:e.username,subredditName:s(this,x),type:"wikibanned",banReason:e.reason,note:e.note,duration:e.duration},s(this,A))}unbanWikiContributor(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"wikibanned"},s(this,A))}getModerators(e={}){return I.getSubredditUsersByType({type:"moderators",subredditName:s(this,x),...e},s(this,A))}inviteModerator(e,t){return I.createRelationship({type:"moderator_invite",subredditName:s(this,x),username:e,permissions:t??[]},s(this,A))}revokeModeratorInvite(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"moderator_invite"},s(this,A))}removeModerator(e){return I.removeRelationship({type:"moderator",subredditName:s(this,x),username:e},s(this,A))}setModeratorPermissions(e,t){return I.setModeratorPermissions(e,s(this,x),t,s(this,A))}getMutedUsers(e={}){return I.getSubredditUsersByType({type:"muted",subredditName:s(this,x),...e},s(this,A))}muteUser(e,t){return I.createRelationship({username:e,subredditName:s(this,x),type:"muted",note:t},s(this,A))}unmuteUser(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"muted"},s(this,A))}getModerationLog(e){return Rd({subredditName:s(this,x),...e},s(this,A))}getUserFlairTemplates(){return se.getUserFlairTemplates(s(this,x),s(this,A))}getPostFlairTemplates(){return se.getPostFlairTemplates(s(this,x),s(this,A))}createPostFlairTemplate(e){return se.createPostFlairTemplate({subredditName:s(this,x),...e},s(this,A))}createUserFlairTemplate(e){return se.createUserFlairTemplate({subredditName:s(this,x),...e},s(this,A))}async getUserFlair(e){if(e?.usernames!==void 0)return{users:await Promise.all(e.usernames.map(async i=>{let n=await Fe.getUserFlairBySubreddit({subreddit:s(this,x),name:i},s(this,A));return $s(n.users[0])}))};{let t=await Fe.getUserFlairBySubreddit({...e,subreddit:s(this,x)},s(this,A));return{next:t.next,prev:t.prev,users:t.users.map(i=>$s(i))}}}getModQueue(e={type:"all"}){return tt.aboutLocation({...e,location:"modqueue",subreddit:s(this,x)},s(this,A))}getReports(e={type:"all"}){return tt.aboutLocation({...e,location:"reports",subreddit:s(this,x)},s(this,A))}getSpam(e={type:"all"}){return tt.aboutLocation({...e,location:"spam",subreddit:s(this,x)},s(this,A))}getUnmoderated(e={type:"all"}){return tt.aboutLocation({...e,location:"unmoderated",subreddit:s(this,x)},s(this,A))}getEdited(e={type:"all"}){return tt.aboutLocation({...e,location:"edited",subreddit:s(this,x)},s(this,A))}static aboutLocation(e,t){let i=u.redditAPIPlugins.Moderation,n;switch(e.type){case"post":n="links";break;case"comment":n="comments";break;default:n=void 0}return new j({...e,fetch:async o=>{let a=await i.AboutLocation({...o,...e,only:n},t);return WS(a,t)}})}getCommentsAndPostsByIds(e){let t=u.redditAPIPlugins.LinksAndComments;return new j({fetch:async()=>{let i=await t.Info({thingIds:e,subreddits:[s(this,gn)]},s(this,A));return WS(i,s(this,A))}})}static async addRemovalReason(e,t,i,n){return(await u.redditAPIPlugins.Subreddits.SubredditAddRemovalReason({title:t,message:i,subreddit:e},n)).id}static async getRemovalReasons(e,t){let n=await u.redditAPIPlugins.Subreddits.SubredditGetRemovalReasons({subreddit:e},t);return n.order.map(o=>({...n.data[o]}))}static async getFromMetadata(e){g(e);let t=e?.[B.Subreddit]?.values[0];return g(t),tt.getById(Ae(t),e)}static async getById(e,t){let o=(await u.redditAPIPlugins.LinksAndComments.Info({thingIds:[e],subreddits:[]},t)).data?.children[0]?.data?.displayName;return g(o),tt.getByName(o,t)}static async getByName(e,t){let n=await u.redditAPIPlugins.Subreddits.SubredditAbout({subreddit:e},t);if(!n?.data)throw new Error("not found");return new tt(n.data,t)}};gn=new WeakMap,x=new WeakMap,No=new WeakMap,qo=new WeakMap,jo=new WeakMap,Ho=new WeakMap,Wo=new WeakMap,Go=new WeakMap,Vo=new WeakMap,zo=new WeakMap,Jo=new WeakMap,hn=new WeakMap,A=new WeakMap;var fe=tt;async function Oy(r,e){let t="GetSubredditLeaderboard",i="18ead70c46b6446d45ecd8b679b16d9a929a933d6ef25d8262a459cb18b72848",o=(await qt.query(t,i,{id:r},e)).data?.subredditInfoById?.leaderboard;if(!o)throw new Error("subreddit leaderboard not found");if(!o.summary)throw new Error("subreddit leaderboard summary not found");return{id:o.id,summary:o.summary}}function uF(r){if(r==="public"||r==="private"||r==="restricted"||r==="employees_only"||r==="gold_restricted"||r==="archived")return r;throw new Error(`invalid subreddit type: ${r}`)}function cF(r){if(r==="any"||r==="link"||r==="self")return r;throw new Error(`invalid allowed post type: ${r}`)}function mF(r){if(r==="animated"||r==="giphy"||r==="static"||r==="expression")return r;throw new Error(`invalid comment media type: ${r}`)}function WS(r,e){let i=(r.data?.children??[]).map(a=>{let c=n(a);if(c!=null)return c;let p=o(a);return p??null}).filter(Boolean);return{after:r.data?.after,before:r.data?.before,children:i};function n(a){try{return new G(a.data,e)}catch{return null}}function o(a){try{return new $(a.data,e)}catch{return null}}}async function Fy(r,e){return GS("GetVaultContactByAddress","3e2f7966a5c120e64fd2795d06a46595c52d988185be98d3ed71c3f81ae80d2e",{provider:"ethereum",address:r},e)}async function My(r,e){return GS("GetVaultContactByUserId","a854ddc19d0e22c4f36ed917fdbd568f299f3571427e393aee5e2972080fffe9",{provider:"ethereum",userId:r},e)}async function GS(r,e,t,i){let o=(await qt.query(r,e,t,i))?.data?.vault?.contact;return{provider:o?.provider,userId:ee(o?.userId),address:o?.address,createdAt:o?.createdAt,isActive:o?.isActive}}import{CommunityListWidget_CommunityData as pF,GetWidgetsResponse_WidgetItem as ae}from"@devvit/protos";var $o,Ko,Xo,Zo,sp=class sp{constructor(e,t,i){d(this,$o,void 0);d(this,Ko,void 0);d(this,Xo,void 0);d(this,Zo,void 0);V(this),l(this,$o,e.id),l(this,Ko,e.shortName),l(this,Xo,t),l(this,Zo,i)}get id(){return s(this,$o)}get name(){return s(this,Ko)}get subredditName(){return s(this,Xo)}toJSON(){return{id:this.id,name:this.name,subredditName:this.subredditName}}delete(){return sp.delete(this.subredditName,this.id,s(this,Zo))}static async getWidgets(e,t){let n=await u.redditAPIPlugins.Widgets.GetWidgets({subreddit:e},t);g(n.layout,"Failed to load widgets for subreddit");let o=n.items,a=[];for(let c of n.layout.sidebar?.order??[]){let p=o[c];switch(p?.kind){case"image":a.push(new El(p,e,t));break;case"calendar":a.push(new Rl(p,e,t));break;case"textarea":a.push(new Ol(p,e,t));break;case"button":a.push(new Fl(p,e,t));break;case"community-list":a.push(new Ml(p,e,t));break;case"post-flair":a.push(new Ll(p,e,t));break;case"custom":a.push(new Ul(p,e,t));break;case"subreddit-rules":{let f=await u.redditAPIPlugins.Subreddits.SubredditAboutRules({subreddit:e},t);a.push(new np(f,p,e,t));break}default:throw new Error(`Unknown widget type: ${p.kind}`)}}return a}static async delete(e,t,i){await u.redditAPIPlugins.Widgets.DeleteWidget({subreddit:e,id:t},i)}static async reorder(e,t,i){await u.redditAPIPlugins.Widgets.OrderWidgets({subreddit:e,order:t},i)}static async add(e,t){switch(e?.type){case"image":return El.create(e,t);case"calendar":return Rl.create(e,t);case"textarea":return Ol.create(e,t);case"button":return Fl.create(e,t);case"community-list":return Ml.create(e,t);case"post-flair":return Ll.create(e,t);case"custom":return Ul.create(e,t);default:throw new Error("Unknown widget type")}}};$o=new WeakMap,Ko=new WeakMap,Xo=new WeakMap,Zo=new WeakMap;var te=sp,Yo,Bl=class Bl extends te{constructor(t,i,n){super(t,i,n);d(this,Yo,void 0);l(this,Yo,t.data.map(o=>(g(o.url,"Image widget data is missing url"),g(o.height,"Image widget data is missing height"),g(o.width,"Image widget data is missing width"),g(o.linkUrl,"Image widget data is missing linkUrl"),{url:o.url,height:o.height,width:o.width,linkUrl:o.linkUrl})))}get images(){return s(this,Yo)}toJSON(){return{...super.toJSON(),images:this.images}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddImageWidget(t,i);return new Bl(ae.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateImageWidget(t,i);return new Bl(ae.fromJSON(o),t.subreddit,i)}};Yo=new WeakMap;var El=Bl,Qo,ea,ta,Dl=class Dl extends te{constructor(t,i,n){super(t,i,n);d(this,Qo,void 0);d(this,ea,void 0);d(this,ta,void 0);g(t.googleCalendarId,"Calendar widget data is missing googleCalendarId"),g(t.configuration,"Calendar widget data is missing configuration"),g(t.styles,"Calendar widget data is missing styles"),l(this,Qo,t.googleCalendarId),l(this,ea,t.configuration),l(this,ta,t.styles)}get googleCalendarId(){return s(this,Qo)}get configuration(){return s(this,ea)}get styles(){return s(this,ta)}toJSON(){return{...super.toJSON(),googleCalendarId:this.googleCalendarId,configuration:this.configuration,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddCalendarWidget(t,i);return new Dl(ae.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCalendarWidget(t,i);return new Dl(ae.fromJSON(o),t.subreddit,i)}};Qo=new WeakMap,ea=new WeakMap,ta=new WeakMap;var Rl=Dl,ra,ia,_l=class _l extends te{constructor(t,i,n){super(t,i,n);d(this,ra,void 0);d(this,ia,void 0);g(t.text,"Textarea widget data is missing text"),g(t.styles,"Textarea widget data is missing styles"),l(this,ra,t.text),l(this,ia,t.styles)}get text(){return s(this,ra)}get styles(){return s(this,ia)}toJSON(){return{...super.toJSON(),text:this.text,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddTextAreaWidget(t,i);return new _l(ae.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateTextAreaWidget(t,i);return new _l(ae.fromJSON(o),t.subreddit,i)}};ra=new WeakMap,ia=new WeakMap;var Ol=_l,na,sa,oa,Nl=class Nl extends te{constructor(t,i,n){super(t,i,n);d(this,na,void 0);d(this,sa,void 0);d(this,oa,void 0);g(t.styles,"Button widget data is missing styles"),l(this,na,t.buttons),l(this,sa,t.description??""),l(this,oa,t.styles)}get buttons(){return s(this,na)}get description(){return s(this,sa)}get styles(){return s(this,oa)}toJSON(){return{...super.toJSON(),buttons:this.buttons,description:this.description,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddButtonWidget(t,i);return new Nl(ae.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateButtonWidget(t,i);return new Nl(ae.fromJSON(o),t.subreddit,i)}};na=new WeakMap,sa=new WeakMap,oa=new WeakMap;var Fl=Nl,aa,da,ql=class ql extends te{constructor(t,i,n){super(t,i,n);d(this,aa,void 0);d(this,da,void 0);l(this,aa,t.data.map(o=>pF.fromJSON(o))),g(t.styles,"Community list widget data is missing styles"),l(this,da,t.styles)}get communities(){return s(this,aa)}get styles(){return s(this,da)}toJSON(){return{...super.toJSON(),communities:this.communities,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddCommunityListWidget(t,i);return new ql(ae.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCommunityListWidget(t,i);return new ql(ae.fromJSON(o),t.subreddit,i)}};aa=new WeakMap,da=new WeakMap;var Ml=ql,la,ua,ca,jl=class jl extends te{constructor(t,i,n){super(t,i,n);d(this,la,void 0);d(this,ua,void 0);d(this,ca,void 0);if(g(t.styles,"Post flair widget data is missing styles"),l(this,la,t.styles),l(this,ua,t.order.map(o=>t.templates[o])),!(t.display&&t.display==="list"||t.display==="cloud"))throw new Error("Post flair widget data is missing display type");l(this,ca,t.display)}get styles(){return s(this,la)}get templates(){return s(this,ua)}get display(){return s(this,ca)}toJSON(){return{...super.toJSON(),styles:this.styles,templates:this.templates,display:this.display}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddPostFlairWidget(t,i);return new jl(ae.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdatePostFlairWidget(t,i);return new jl(ae.fromJSON(o),t.subreddit,i)}};la=new WeakMap,ua=new WeakMap,ca=new WeakMap;var Ll=jl,ma,pa,fa,ga,ha,Hl=class Hl extends te{constructor(t,i,n){super(t,i,n);d(this,ma,void 0);d(this,pa,void 0);d(this,fa,void 0);d(this,ga,void 0);d(this,ha,void 0);g(t.stylesheetUrl,"Custom widget data is missing stylesheetUrl"),g(t.height,"Custom widget data is missing height"),g(t.css,"Custom widget data is missing css"),l(this,ma,t.imageData??[]),l(this,pa,t.text??""),l(this,fa,t.stylesheetUrl),l(this,ga,t.height),l(this,ha,t.css)}get images(){return s(this,ma)}get text(){return s(this,pa)}get stylesheetUrl(){return s(this,fa)}get height(){return s(this,ga)}get css(){return s(this,ha)}toJSON(){return{...super.toJSON(),images:this.images,text:this.text,stylesheetUrl:this.stylesheetUrl,height:this.height,css:this.css}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddCustomWidget(t,i);return new Hl(ae.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCustomWidget(t,i);return new Hl(ae.fromJSON(o),t.subreddit,i)}};ma=new WeakMap,pa=new WeakMap,fa=new WeakMap,ga=new WeakMap,ha=new WeakMap;var Ul=Hl,va,np=class extends te{constructor(t,i,n,o){super(i,n,o);d(this,va,void 0);let a=t.rules.map(({description:c,priority:p,shortName:f,violationReason:v})=>(g(c,"Subreddit rule is missing description"),g(p,"Subreddit rule is missing priority"),g(f,"Subreddit rule is missing shortName"),g(v,"Subreddit rule is missing violationReason"),{description:c,priority:p,shortName:f,violationReason:v}));l(this,va,a)}get rules(){return s(this,va)}toJSON(){return{...super.toJSON(),rules:this.rules}}};va=new WeakMap;var fF=(i=>(i[i.SUBREDDIT_PERMISSIONS=0]="SUBREDDIT_PERMISSIONS",i[i.APPROVED_CONTRIBUTORS_ONLY=1]="APPROVED_CONTRIBUTORS_ONLY",i[i.MODS_ONLY=2]="MODS_ONLY",i))(fF||{}),ye,be,vn,yn,bn,kn,Sn,Je,De=class De{constructor(e,t,i,n){d(this,ye,void 0);d(this,be,void 0);d(this,vn,void 0);d(this,yn,void 0);d(this,bn,void 0);d(this,kn,void 0);d(this,Sn,void 0);d(this,Je,void 0);V(this),l(this,ye,e),l(this,be,t),l(this,vn,i.contentMd),l(this,yn,i.revisionId),l(this,bn,new Date(i.revisionDate)),l(this,kn,i.reason??""),g(i.revisionBy?.data,"Wiki page author details are missing"),l(this,Sn,new I(i.revisionBy.data,n)),l(this,Je,n)}get name(){return s(this,ye)}get subredditName(){return s(this,be)}get content(){return s(this,vn)}get revisionId(){return s(this,yn)}get revisionDate(){return s(this,bn)}get revisionReason(){return s(this,kn)}get revisionAuthor(){return s(this,Sn)}toJSON(){return{name:s(this,ye),subredditName:s(this,be),content:s(this,vn),revisionId:s(this,yn),revisionDate:s(this,bn),revisionReason:s(this,kn),revisionAuthor:s(this,Sn).toJSON()}}async update(e,t){return De.updatePage({subredditName:s(this,be),page:s(this,ye),content:e,reason:t},s(this,Je))}async getRevisions(e){return De.getPageRevisions({subredditName:s(this,be),page:s(this,ye),...e},s(this,Je))}async revertTo(e){return De.revertPage(s(this,be),s(this,ye),e,s(this,Je))}async getSettings(){return De.getPageSettings(s(this,be),s(this,ye),s(this,Je))}async updateSettings(e){return De.updatePageSettings({subredditName:s(this,be),page:s(this,ye),listed:e.listed,permLevel:e.permLevel},s(this,Je))}async addEditor(e){return De.addEditor(s(this,be),s(this,ye),e,s(this,Je))}async removeEditor(e){return De.removeEditor(s(this,be),s(this,ye),e,s(this,Je))}static async getPage(e,t,i){let o=await u.redditAPIPlugins.Wiki.GetWikiPage({subreddit:e,page:t},i);return g(o.data,"Failed to get wiki page"),new De(t,e,o.data,i)}static async getPages(e,t){return(await u.redditAPIPlugins.Wiki.GetWikiPages({subreddit:e},t)).data||[]}static async createPage(e,t){return De.updatePage(e,t)}static async updatePage(e,t){return await u.redditAPIPlugins.Wiki.EditWikiPage({subreddit:e.subredditName,page:e.page,content:e.content,reason:e.reason??""},t),De.getPage(e.subredditName,e.page,t)}static getPageRevisions(e,t){let i=u.redditAPIPlugins.Wiki;return new j({hasMore:!0,after:e.after,limit:e.limit,pageSize:e.pageSize,async fetch(n){let o=await i.GetWikiPageRevisions({subreddit:e.subredditName,page:e.page,limit:n.limit,after:n.after,before:n.before},t);return gF(o,t)}})}static async revertPage(e,t,i,n){await u.redditAPIPlugins.Wiki.RevertWikiPage({subreddit:e,page:t,revision:i},n)}static async getPageSettings(e,t,i){let o=await u.redditAPIPlugins.Wiki.GetWikiPageSettings({subreddit:e,page:t},i);return g(o.data,"Failed to get wiki page settings"),new Wl(o.data,i)}static async updatePageSettings(e,t){let n=await u.redditAPIPlugins.Wiki.UpdateWikiPageSettings({subreddit:e.subredditName,page:e.page,listed:e.listed?"on":"",permlevel:e.permLevel},t);return g(n.data,"Failed to update wiki page settings"),new Wl(n.data,t)}static async addEditor(e,t,i,n){await u.redditAPIPlugins.Wiki.AllowEditor({act:"add",subreddit:e,page:t,username:i},n)}static async removeEditor(e,t,i,n){await u.redditAPIPlugins.Wiki.AllowEditor({act:"del",subreddit:e,page:t,username:i},n)}};ye=new WeakMap,be=new WeakMap,vn=new WeakMap,yn=new WeakMap,bn=new WeakMap,kn=new WeakMap,Sn=new WeakMap,Je=new WeakMap;var ge=De,Pn,Cn,In,wn,xn,Tn,op=class{constructor(e,t){d(this,Pn,void 0);d(this,Cn,void 0);d(this,In,void 0);d(this,wn,void 0);d(this,xn,void 0);d(this,Tn,void 0);l(this,Pn,e.id),l(this,Cn,e.page),l(this,In,new Date(e.timestamp)),g(e.author?.data,"Wiki page revision author details are missing"),l(this,wn,new I(e.author.data,t)),l(this,xn,e.reason??""),l(this,Tn,e.revisionHidden??!1)}get id(){return s(this,Pn)}get page(){return s(this,Cn)}get date(){return s(this,In)}get author(){return s(this,wn)}get reason(){return s(this,xn)}get hidden(){return s(this,Tn)}toJSON(){return{id:s(this,Pn),page:s(this,Cn),date:s(this,In),author:s(this,wn).toJSON(),reason:s(this,xn),hidden:s(this,Tn)}}};Pn=new WeakMap,Cn=new WeakMap,In=new WeakMap,wn=new WeakMap,xn=new WeakMap,Tn=new WeakMap;var An,En,Rn,Wl=class{constructor(e,t){d(this,An,void 0);d(this,En,void 0);d(this,Rn,void 0);l(this,An,e.listed),l(this,En,e.permLevel),l(this,Rn,e.editors.map(i=>(g(i.data,"Wiki page editor details are missing"),new I(i.data,t))))}get listed(){return s(this,An)}get permLevel(){return s(this,En)}get editors(){return s(this,Rn)}toJSON(){return{listed:s(this,An),permLevel:s(this,En),editors:s(this,Rn).map(e=>e.toJSON())}}};An=new WeakMap,En=new WeakMap,Rn=new WeakMap;function gF(r,e){return g(r.data?.children,"Wiki page revision listing is missing children"),{children:r.data.children.map(i=>new op(i,e)),before:r.data.before,after:r.data.after}}var hF=(t=>(t.Gallery="GALLERY",t.Timeline="TIMELINE",t))(hF||{});function vF(r){return r==="GALLERY"?"GALLERY":"TIMELINE"}var _e,ke,ba,On,Fn,ka,Sa,Pa,Ca,ht,Ia,wa,Mn,ya=class ya{constructor(e,t){d(this,_e,void 0);d(this,ke,void 0);d(this,ba,void 0);d(this,On,void 0);d(this,Fn,void 0);d(this,ka,void 0);d(this,Sa,void 0);d(this,Pa,void 0);d(this,Ca,void 0);d(this,ht,void 0);d(this,Ia,void 0);d(this,wa,void 0);d(this,Mn,void 0);g(e.collectionId,"Collection Id is missing or undefined"),g(e.subredditId,"Subreddit Id is missing or undefined"),g(e.title,"Collection title is missing or undefined"),g(e.authorId,"Collection author's id is missing or undefined"),g(e.authorName,"Collection author's id is missing or undefined"),g(e.createdAtUtc,"Collection create timestamp is missing"),g(e.lastUpdateUtc,"Collection last updated timestamp is missing"),l(this,_e,t),l(this,ke,e.collectionId),l(this,ba,e.subredditId),l(this,On,e.title),l(this,Fn,e.description||""),l(this,ka,e.authorId),l(this,Sa,e.authorName),l(this,Pa,e.permalink),l(this,Ca,e.primaryLinkId),l(this,ht,e.linkIds||[]),l(this,Mn,vF(e.displayLayout)),l(this,Ia,e.createdAtUtc),l(this,wa,e.lastUpdateUtc),V(this)}get id(){return s(this,ke)}get subredditId(){return s(this,ba)}get title(){return s(this,On)}get description(){return s(this,Fn)}get authorId(){return s(this,ka)}get authorName(){return s(this,Sa)}get permalink(){return s(this,Pa)}get primaryLinkId(){return s(this,Ca)}get linkIds(){return s(this,ht)}get createdAtUtc(){return s(this,Ia)}get lastUpdateUtc(){return s(this,wa)}get displayLayout(){return s(this,Mn)}static async getCollectionById(e,t){let n=await u.redditAPIPlugins.PostCollections.Collection(e,t);return new ya(n,t)}static async create(e,t){let n=await u.redditAPIPlugins.PostCollections.Create({srFullname:e.subredditId,title:e.title,description:e.description,displayLayout:e.displayLayout},t);return new ya(n,t)}static async getCollectionsForSubreddit(e,t){return(await u.redditapiv2Plugin.GetSubredditCollections({srFullname:e.subredditId},t)).collections.map(n=>new ya(n,t))}async addPost(e){await u.redditAPIPlugins.PostCollections.AddPost({collectionId:s(this,ke),linkFullname:e},s(this,_e)),s(this,ht).push(e)}async removePost(e){await u.redditAPIPlugins.PostCollections.RemovePost({collectionId:s(this,ke),linkFullname:e},s(this,_e)),l(this,ht,s(this,ht).filter(i=>i!==e))}async delete(){await u.redditAPIPlugins.PostCollections.Delete({collectionId:s(this,ke)},s(this,_e))}async follow(e){await u.redditAPIPlugins.PostCollections.Follow({collectionId:s(this,ke),follow:e},s(this,_e))}async reorder(e){await u.redditAPIPlugins.PostCollections.Reorder({collectionId:s(this,ke),linkIds:e.join(",")},s(this,_e)),l(this,ht,e)}async updateTitle(e){await u.redditAPIPlugins.PostCollections.UpdateTitle({collectionId:s(this,ke),title:e},s(this,_e)),l(this,On,e)}async updateDescription(e){await u.redditAPIPlugins.PostCollections.UpdateDescription({collectionId:s(this,ke),description:e},s(this,_e)),l(this,Fn,e)}async updateLayout(e){await u.redditAPIPlugins.PostCollections.UpdateDisplayLayout({collectionId:s(this,ke),displayLayout:e},s(this,_e)),l(this,Mn,e)}};_e=new WeakMap,ke=new WeakMap,ba=new WeakMap,On=new WeakMap,Fn=new WeakMap,ka=new WeakMap,Sa=new WeakMap,Pa=new WeakMap,Ca=new WeakMap,ht=new WeakMap,Ia=new WeakMap,wa=new WeakMap,Mn=new WeakMap;var di=ya;var yF=["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"],bF=["border-image","border-image-source","behavior","expression","list-style-image","cursor","content"],kF=["onload","onerror","onclick","onmouseover"];function SF(r){return/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/.test(r)?r:r.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"')}function VS(r){if(r){if(!r.trim().startsWith("<svg")){console.log("The provided string is not a valid SVG.");return}try{let e=new RegExp(`<\\s*(${yF.join("|")})\\b`,"gi"),t=new RegExp(`(${bF.join("|")})\\s*:\\s*url\\s*\\((['"]?)(.*?)\\2\\)`,"gi"),i=new RegExp(`(${kF.join("|")})\\s*(=\\s*(['"]?)(.*?)\\3)?`,"gi");r=r.trim().replace(/\s+/g," "),r=SF(r);let n=r.match(e)||[],o=r.match(t)||[],a=r.match(i)||[],c=!1;return n.length>0&&(c=!0,console.warn(`Disallowed elements detected in SVG: ${n.map(p=>p.replace("<","")).join(", ")}`)),o.length>0&&(c=!0,console.warn(`Disallowed styles detected in SVG: ${o.map(p=>p.split(":")[0]).join(", ")}`)),a.length>0&&(c=!0,console.warn(`Disallowed attributes detected in SVG: ${a.map(p=>p.split("=")[0]).join(", ")}`)),c?void 0:r}catch{return}}}function cH(r,...e){let t="";return r.forEach((i,n)=>{t+=i;let o=e[n];o!==void 0&&(t+=`${o}`)}),t=VS(t),t===void 0?"":`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t)}`}var zS="ServerCallRequired";var JS=Bn(Am(),1);var rt,vt,xa,Ln,Ta,Dr,ap=class{constructor(e,t,i){d(this,rt,void 0);d(this,vt,void 0);d(this,xa,void 0);d(this,Ln,void 0);d(this,Ta,void 0);d(this,Dr,void 0);l(this,rt,!!i.context.devvitContext.debug.useAsync),s(this,rt)&&console.debug("[useAsync] v1",t),this.state={data:null,load_state:"initial",error:null,depends:null},l(this,vt,i.hookId),l(this,xa,e),l(this,Ln,i.invalidate),l(this,Ta,i.context),l(this,Dr,t.depends??null)}onStateLoaded(){if(this.state.load_state!=="disabled"&&(s(this,rt)&&console.debug("[useAsync] async onLoad ",s(this,vt),this.state),s(this,rt)&&console.debug("[useAsync] async onLoad have ",s(this,Dr),"and",this.state.depends),!(0,JS.default)(s(this,Dr),this.state.depends)||this.state.load_state==="initial")){this.state.load_state="loading",this.state.depends=s(this,Dr),s(this,Ln).call(this);let e={hook:s(this,vt),async:!0,asyncRequest:{requestId:s(this,vt)+"-"+JSON.stringify(this.state.depends)}};s(this,rt)&&console.debug("[useAsync] onLoad requeue"),s(this,Ta).addToRequeueEvents(e)}}async onUIEvent(e,t){if(e.asyncRequest){let i={requestId:e.asyncRequest.requestId};try{i.data={value:await s(this,xa).call(this)}}catch(o){if(o instanceof Error){if(o.message===zS)throw o;i.error={message:o.message,details:o.stack??""}}else i.error={message:"Unknown error",details:String(o)}}let n={asyncResponse:i,hook:s(this,vt)};s(this,rt)&&console.debug("[useAsync] onReq requeue"),t.addToRequeueEvents(n)}else if(e.asyncResponse){let i=s(this,vt)+"-"+JSON.stringify(this.state.depends);e.asyncResponse.requestId===i?(this.state={...this.state,data:e.asyncResponse.data?.value,error:e.asyncResponse.error??null,load_state:e.asyncResponse.error?"error":"loaded"},s(this,Ln).call(this)):s(this,rt)&&console.debug("[useAsync] onResp skip, stale event")}else throw new Error("Unknown event type")}};rt=new WeakMap,vt=new WeakMap,xa=new WeakMap,Ln=new WeakMap,Ta=new WeakMap,Dr=new WeakMap;function PF(r,e={}){let t=Ve({namespace:"useAsync"},i=>new ap(r,e,i));return{data:t.state.data,error:t.state.error,loading:t.state.load_state==="loading"}}export{WL as ALL_ICON_NAMES,Ry as AboutLocations,Fl as ButtonWidget,Rl as CalendarWidget,hF as CollectionDisplayLayout,$ as Comment,Ml as CommunityListWidget,Ul as CustomWidget,u as Devvit,Fe as Flair,se as FlairTemplate,VO as FlairType,Pt as Hook,El as ImageWidget,j as Listing,dF as ModMailActionType,oF as ModMailConversationState,Od as ModMailService,Oe as ModNote,G as Post,di as PostCollection,Ll as PostFlairWidget,lr as PrivateMessage,Gs as RichTextBuilder,Wc as SettingScope,fe as Subreddit,np as SubredditRulesWidget,Ol as TextAreaWidget,I as User,te as Widget,ge as WikiPage,fF as WikiPagePermissionLevel,op as WikiPageRevision,Wl as WikiPageSettings,$s as convertUserFlairProtoToAPI,Rd as getModerationLog,Oy as getSubredditLeaderboard,Fy as getVaultByAddress,My as getVaultByUserId,cH as svg,PF as useAsync,Lm as useChannel,Rm as useForm,Dm as useInterval,Nm as useState};
1
+ var SS=Object.create;var Lm=Object.defineProperty;var PS=Object.getOwnPropertyDescriptor;var CS=Object.getOwnPropertyNames;var IS=Object.getPrototypeOf,wS=Object.prototype.hasOwnProperty;var Um=r=>{throw TypeError(r)};var h=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var xS=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of CS(e))!wS.call(r,n)&&n!==t&&Lm(r,n,{get:()=>e[n],enumerable:!(i=PS(e,n))||i.enumerable});return r};var _n=(r,e,t)=>(t=r!=null?SS(IS(r)):{},xS(e||!r||!r.__esModule?Lm(t,"default",{value:r,enumerable:!0}):t,r));var fl=(r,e,t)=>e.has(r)||Um("Cannot "+t);var s=(r,e,t)=>(fl(r,e,"read from private field"),t?t.call(r):e.get(r)),l=(r,e,t)=>e.has(r)?Um("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),d=(r,e,t,i)=>(fl(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t),S=(r,e,t)=>(fl(r,e,"access private method"),t);var oe=h((ZO,Bm)=>{Bm.exports=function(r){try{return!!r()}catch{return!0}}});var ka=h((YO,Dm)=>{var TS=oe();Dm.exports=!TS(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var X=h((QO,qm)=>{var _m=ka(),Nm=Function.prototype,gl=Nm.call,AS=_m&&Nm.bind.bind(gl,gl);qm.exports=_m?AS:function(r){return function(){return gl.apply(r,arguments)}}});var jm=h((eF,Hm)=>{var ES=Math.ceil,RS=Math.floor;Hm.exports=Math.trunc||function(e){var t=+e;return(t>0?RS:ES)(t)}});var Sa=h((tF,Wm)=>{var OS=jm();Wm.exports=function(r){var e=+r;return e!==e||e===0?0:OS(e)}});var ce=h((rF,Gm)=>{var Pa=function(r){return r&&r.Math==Math&&r};Gm.exports=Pa(typeof globalThis=="object"&&globalThis)||Pa(typeof window=="object"&&window)||Pa(typeof self=="object"&&self)||Pa(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var jr=h((iF,Vm)=>{Vm.exports=!1});var Ca=h((nF,Jm)=>{var zm=ce(),FS=Object.defineProperty;Jm.exports=function(r,e){try{FS(zm,r,{value:e,configurable:!0,writable:!0})}catch{zm[r]=e}return e}});var Ia=h((sF,Km)=>{var MS=ce(),LS=Ca(),$m="__core-js_shared__",US=MS[$m]||LS($m,{});Km.exports=US});var hl=h((oF,Zm)=>{var BS=jr(),Xm=Ia();(Zm.exports=function(r,e){return Xm[r]||(Xm[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:BS?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"})});var wa=h((aF,Ym)=>{Ym.exports=function(r){return r==null}});var xa=h((dF,Qm)=>{var DS=wa(),_S=TypeError;Qm.exports=function(r){if(DS(r))throw _S("Can't call method on "+r);return r}});var Nn=h((lF,ep)=>{var NS=xa(),qS=Object;ep.exports=function(r){return qS(NS(r))}});var Ce=h((uF,tp)=>{var HS=X(),jS=Nn(),WS=HS({}.hasOwnProperty);tp.exports=Object.hasOwn||function(e,t){return WS(jS(e),t)}});var vl=h((cF,rp)=>{var GS=X(),VS=0,zS=Math.random(),JS=GS(1 .toString);rp.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+JS(++VS+zS,36)}});var np=h((mF,ip)=>{ip.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var cp=h((pF,up)=>{var lp=ce(),yl=np(),sp=lp.process,op=lp.Deno,ap=sp&&sp.versions||op&&op.version,dp=ap&&ap.v8,je,Ta;dp&&(je=dp.split("."),Ta=je[0]>0&&je[0]<4?1:+(je[0]+je[1]));!Ta&&yl&&(je=yl.match(/Edge\/(\d+)/),(!je||je[1]>=74)&&(je=yl.match(/Chrome\/(\d+)/),je&&(Ta=+je[1])));up.exports=Ta});var bl=h((fF,pp)=>{var mp=cp(),$S=oe();pp.exports=!!Object.getOwnPropertySymbols&&!$S(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&mp&&mp<41})});var kl=h((gF,fp)=>{var KS=bl();fp.exports=KS&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ie=h((hF,hp)=>{var XS=ce(),ZS=hl(),gp=Ce(),YS=vl(),QS=bl(),eP=kl(),Wr=XS.Symbol,Sl=ZS("wks"),tP=eP?Wr.for||Wr:Wr&&Wr.withoutSetter||YS;hp.exports=function(r){return gp(Sl,r)||(Sl[r]=QS&&gp(Wr,r)?Wr[r]:tP("Symbol."+r)),Sl[r]}});var bp=h((vF,yp)=>{var rP=Ie(),iP=rP("toStringTag"),vp={};vp[iP]="z";yp.exports=String(vp)==="[object z]"});var Cl=h((yF,kp)=>{var Pl=typeof document=="object"&&document.all,nP=typeof Pl>"u"&&Pl!==void 0;kp.exports={all:Pl,IS_HTMLDDA:nP}});var Z=h((bF,Pp)=>{var Sp=Cl(),sP=Sp.all;Pp.exports=Sp.IS_HTMLDDA?function(r){return typeof r=="function"||r===sP}:function(r){return typeof r=="function"}});var Aa=h((kF,Ip)=>{var Cp=X(),oP=Cp({}.toString),aP=Cp("".slice);Ip.exports=function(r){return aP(oP(r),8,-1)}});var qn=h((SF,wp)=>{var dP=bp(),lP=Z(),Ea=Aa(),uP=Ie(),cP=uP("toStringTag"),mP=Object,pP=Ea(function(){return arguments}())=="Arguments",fP=function(r,e){try{return r[e]}catch{}};wp.exports=dP?Ea:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=fP(e=mP(r),cP))=="string"?t:pP?Ea(e):(i=Ea(e))=="Object"&&lP(e.callee)?"Arguments":i}});var Hn=h((PF,xp)=>{var gP=qn(),hP=String;xp.exports=function(r){if(gP(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return hP(r)}});var wl=h((CF,Ep)=>{var Il=X(),vP=Sa(),yP=Hn(),bP=xa(),kP=Il("".charAt),Tp=Il("".charCodeAt),SP=Il("".slice),Ap=function(r){return function(e,t){var i=yP(bP(e)),n=vP(t),o=i.length,a,c;return n<0||n>=o?r?"":void 0:(a=Tp(i,n),a<55296||a>56319||n+1===o||(c=Tp(i,n+1))<56320||c>57343?r?kP(i,n):a:r?SP(i,n,n+2):(a-55296<<10)+(c-56320)+65536)}};Ep.exports={codeAt:Ap(!1),charAt:Ap(!0)}});var Fp=h((IF,Op)=>{var PP=ce(),CP=Z(),Rp=PP.WeakMap;Op.exports=CP(Rp)&&/native code/.test(String(Rp))});var Pt=h((wF,Up)=>{var Mp=Z(),Lp=Cl(),IP=Lp.all;Up.exports=Lp.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:Mp(r)||r===IP}:function(r){return typeof r=="object"?r!==null:Mp(r)}});var me=h((xF,Bp)=>{var wP=oe();Bp.exports=!wP(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var Tl=h((TF,_p)=>{var xP=ce(),Dp=Pt(),xl=xP.document,TP=Dp(xl)&&Dp(xl.createElement);_p.exports=function(r){return TP?xl.createElement(r):{}}});var Al=h((AF,Np)=>{var AP=me(),EP=oe(),RP=Tl();Np.exports=!AP&&!EP(function(){return Object.defineProperty(RP("div"),"a",{get:function(){return 7}}).a!=7})});var El=h((EF,qp)=>{var OP=me(),FP=oe();qp.exports=OP&&FP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Ze=h((RF,Hp)=>{var MP=Pt(),LP=String,UP=TypeError;Hp.exports=function(r){if(MP(r))return r;throw UP(LP(r)+" is not an object")}});var We=h((OF,jp)=>{var BP=ka(),Ra=Function.prototype.call;jp.exports=BP?Ra.bind(Ra):function(){return Ra.apply(Ra,arguments)}});var jn=h((FF,Wp)=>{var Rl=ce(),DP=Z(),_P=function(r){return DP(r)?r:void 0};Wp.exports=function(r,e){return arguments.length<2?_P(Rl[r]):Rl[r]&&Rl[r][e]}});var Ol=h((MF,Gp)=>{var NP=X();Gp.exports=NP({}.isPrototypeOf)});var Fl=h((LF,Vp)=>{var qP=jn(),HP=Z(),jP=Ol(),WP=kl(),GP=Object;Vp.exports=WP?function(r){return typeof r=="symbol"}:function(r){var e=qP("Symbol");return HP(e)&&jP(e.prototype,GP(r))}});var Ml=h((UF,zp)=>{var VP=String;zp.exports=function(r){try{return VP(r)}catch{return"Object"}}});var Oa=h((BF,Jp)=>{var zP=Z(),JP=Ml(),$P=TypeError;Jp.exports=function(r){if(zP(r))return r;throw $P(JP(r)+" is not a function")}});var Fa=h((DF,$p)=>{var KP=Oa(),XP=wa();$p.exports=function(r,e){var t=r[e];return XP(t)?void 0:KP(t)}});var Xp=h((_F,Kp)=>{var Ll=We(),Ul=Z(),Bl=Pt(),ZP=TypeError;Kp.exports=function(r,e){var t,i;if(e==="string"&&Ul(t=r.toString)&&!Bl(i=Ll(t,r))||Ul(t=r.valueOf)&&!Bl(i=Ll(t,r))||e!=="string"&&Ul(t=r.toString)&&!Bl(i=Ll(t,r)))return i;throw ZP("Can't convert object to primitive value")}});var ef=h((NF,Qp)=>{var YP=We(),Zp=Pt(),Yp=Fl(),QP=Fa(),eC=Xp(),tC=Ie(),rC=TypeError,iC=tC("toPrimitive");Qp.exports=function(r,e){if(!Zp(r)||Yp(r))return r;var t=QP(r,iC),i;if(t){if(e===void 0&&(e="default"),i=YP(t,r,e),!Zp(i)||Yp(i))return i;throw rC("Can't convert object to primitive value")}return e===void 0&&(e="number"),eC(r,e)}});var Ma=h((qF,tf)=>{var nC=ef(),sC=Fl();tf.exports=function(r){var e=nC(r,"string");return sC(e)?e:e+""}});var Ye=h(nf=>{var oC=me(),aC=Al(),dC=El(),La=Ze(),rf=Ma(),lC=TypeError,Dl=Object.defineProperty,uC=Object.getOwnPropertyDescriptor,_l="enumerable",Nl="configurable",ql="writable";nf.f=oC?dC?function(e,t,i){if(La(e),t=rf(t),La(i),typeof e=="function"&&t==="prototype"&&"value"in i&&ql in i&&!i[ql]){var n=uC(e,t);n&&n[ql]&&(e[t]=i.value,i={configurable:Nl in i?i[Nl]:n[Nl],enumerable:_l in i?i[_l]:n[_l],writable:!1})}return Dl(e,t,i)}:Dl:function(e,t,i){if(La(e),t=rf(t),La(i),aC)try{return Dl(e,t,i)}catch{}if("get"in i||"set"in i)throw lC("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var Gr=h((jF,sf)=>{sf.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Ua=h((WF,of)=>{var cC=me(),mC=Ye(),pC=Gr();of.exports=cC?function(r,e,t){return mC.f(r,e,pC(1,t))}:function(r,e,t){return r[e]=t,r}});var Ba=h((GF,df)=>{var fC=hl(),gC=vl(),af=fC("keys");df.exports=function(r){return af[r]||(af[r]=gC(r))}});var Da=h((VF,lf)=>{lf.exports={}});var Vr=h((zF,mf)=>{var hC=Fp(),cf=ce(),vC=Pt(),yC=Ua(),Hl=Ce(),jl=Ia(),bC=Ba(),kC=Da(),uf="Object already initialized",Wl=cf.TypeError,SC=cf.WeakMap,_a,Wn,Na,PC=function(r){return Na(r)?Wn(r):_a(r,{})},CC=function(r){return function(e){var t;if(!vC(e)||(t=Wn(e)).type!==r)throw Wl("Incompatible receiver, "+r+" required");return t}};hC||jl.state?(Ge=jl.state||(jl.state=new SC),Ge.get=Ge.get,Ge.has=Ge.has,Ge.set=Ge.set,_a=function(r,e){if(Ge.has(r))throw Wl(uf);return e.facade=r,Ge.set(r,e),e},Wn=function(r){return Ge.get(r)||{}},Na=function(r){return Ge.has(r)}):(ir=bC("state"),kC[ir]=!0,_a=function(r,e){if(Hl(r,ir))throw Wl(uf);return e.facade=r,yC(r,ir,e),e},Wn=function(r){return Hl(r,ir)?r[ir]:{}},Na=function(r){return Hl(r,ir)});var Ge,ir;mf.exports={set:_a,get:Wn,has:Na,enforce:PC,getterFor:CC}});var Gl=h(gf=>{"use strict";var pf={}.propertyIsEnumerable,ff=Object.getOwnPropertyDescriptor,IC=ff&&!pf.call({1:2},1);gf.f=IC?function(e){var t=ff(this,e);return!!t&&t.enumerable}:pf});var zl=h(($F,hf)=>{var wC=X(),xC=oe(),TC=Aa(),Vl=Object,AC=wC("".split);hf.exports=xC(function(){return!Vl("z").propertyIsEnumerable(0)})?function(r){return TC(r)=="String"?AC(r,""):Vl(r)}:Vl});var zr=h((KF,vf)=>{var EC=zl(),RC=xa();vf.exports=function(r){return EC(RC(r))}});var Jl=h(bf=>{var OC=me(),FC=We(),MC=Gl(),LC=Gr(),UC=zr(),BC=Ma(),DC=Ce(),_C=Al(),yf=Object.getOwnPropertyDescriptor;bf.f=OC?yf:function(e,t){if(e=UC(e),t=BC(t),_C)try{return yf(e,t)}catch{}if(DC(e,t))return LC(!FC(MC.f,e,t),e[t])}});var Xl=h((ZF,Sf)=>{var $l=me(),NC=Ce(),kf=Function.prototype,qC=$l&&Object.getOwnPropertyDescriptor,Kl=NC(kf,"name"),HC=Kl&&function(){}.name==="something",jC=Kl&&(!$l||$l&&qC(kf,"name").configurable);Sf.exports={EXISTS:Kl,PROPER:HC,CONFIGURABLE:jC}});var Yl=h((YF,Pf)=>{var WC=X(),GC=Z(),Zl=Ia(),VC=WC(Function.toString);GC(Zl.inspectSource)||(Zl.inspectSource=function(r){return VC(r)});Pf.exports=Zl.inspectSource});var tu=h((QF,wf)=>{var eu=X(),zC=oe(),JC=Z(),qa=Ce(),Ql=me(),$C=Xl().CONFIGURABLE,KC=Yl(),If=Vr(),XC=If.enforce,ZC=If.get,Cf=String,Ha=Object.defineProperty,YC=eu("".slice),QC=eu("".replace),eI=eu([].join),tI=Ql&&!zC(function(){return Ha(function(){},"length",{value:8}).length!==8}),rI=String(String).split("String"),iI=wf.exports=function(r,e,t){YC(Cf(e),0,7)==="Symbol("&&(e="["+QC(Cf(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!qa(r,"name")||$C&&r.name!==e)&&(Ql?Ha(r,"name",{value:e,configurable:!0}):r.name=e),tI&&t&&qa(t,"arity")&&r.length!==t.arity&&Ha(r,"length",{value:t.arity});try{t&&qa(t,"constructor")&&t.constructor?Ql&&Ha(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=XC(r);return qa(i,"source")||(i.source=eI(rI,typeof e=="string"?e:"")),r};Function.prototype.toString=iI(function(){return JC(this)&&ZC(this).source||KC(this)},"toString")});var nr=h((eM,xf)=>{var nI=Z(),sI=Ye(),oI=tu(),aI=Ca();xf.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(nI(t)&&oI(t,o,i),i.global)n?r[e]=t:aI(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:sI.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var ru=h((tM,Tf)=>{var dI=Sa(),lI=Math.max,uI=Math.min;Tf.exports=function(r,e){var t=dI(r);return t<0?lI(t+e,0):uI(t,e)}});var Ef=h((rM,Af)=>{var cI=Sa(),mI=Math.min;Af.exports=function(r){return r>0?mI(cI(r),9007199254740991):0}});var ja=h((iM,Rf)=>{var pI=Ef();Rf.exports=function(r){return pI(r.length)}});var Mf=h((nM,Ff)=>{var fI=zr(),gI=ru(),hI=ja(),Of=function(r){return function(e,t,i){var n=fI(e),o=hI(n),a=gI(i,o),c;if(r&&t!=t){for(;o>a;)if(c=n[a++],c!=c)return!0}else for(;o>a;a++)if((r||a in n)&&n[a]===t)return r||a||0;return!r&&-1}};Ff.exports={includes:Of(!0),indexOf:Of(!1)}});var nu=h((sM,Uf)=>{var vI=X(),iu=Ce(),yI=zr(),bI=Mf().indexOf,kI=Da(),Lf=vI([].push);Uf.exports=function(r,e){var t=yI(r),i=0,n=[],o;for(o in t)!iu(kI,o)&&iu(t,o)&&Lf(n,o);for(;e.length>i;)iu(t,o=e[i++])&&(~bI(n,o)||Lf(n,o));return n}});var Wa=h((oM,Bf)=>{Bf.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var _f=h(Df=>{var SI=nu(),PI=Wa(),CI=PI.concat("length","prototype");Df.f=Object.getOwnPropertyNames||function(e){return SI(e,CI)}});var su=h(Nf=>{Nf.f=Object.getOwnPropertySymbols});var Hf=h((lM,qf)=>{var II=jn(),wI=X(),xI=_f(),TI=su(),AI=Ze(),EI=wI([].concat);qf.exports=II("Reflect","ownKeys")||function(e){var t=xI.f(AI(e)),i=TI.f;return i?EI(t,i(e)):t}});var Gf=h((uM,Wf)=>{var jf=Ce(),RI=Hf(),OI=Jl(),FI=Ye();Wf.exports=function(r,e,t){for(var i=RI(e),n=FI.f,o=OI.f,a=0;a<i.length;a++){var c=i[a];!jf(r,c)&&!(t&&jf(t,c))&&n(r,c,o(e,c))}}});var zf=h((cM,Vf)=>{var MI=oe(),LI=Z(),UI=/#|\.prototype\./,Gn=function(r,e){var t=DI[BI(r)];return t==NI?!0:t==_I?!1:LI(e)?MI(e):!!e},BI=Gn.normalize=function(r){return String(r).replace(UI,".").toLowerCase()},DI=Gn.data={},_I=Gn.NATIVE="N",NI=Gn.POLYFILL="P";Vf.exports=Gn});var Vn=h((mM,Jf)=>{var ou=ce(),qI=Jl().f,HI=Ua(),jI=nr(),WI=Ca(),GI=Gf(),VI=zf();Jf.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,c,p,f,v;if(i?a=ou:n?a=ou[t]||WI(t,{}):a=(ou[t]||{}).prototype,a)for(c in e){if(f=e[c],r.dontCallGetSet?(v=qI(a,c),p=v&&v.value):p=a[c],o=VI(i?c:t+(n?".":"#")+c,r.forced),!o&&p!==void 0){if(typeof f==typeof p)continue;GI(f,p)}(r.sham||p&&p.sham)&&HI(f,"sham",!0),jI(a,c,f,r)}}});var au=h((pM,$f)=>{var zI=nu(),JI=Wa();$f.exports=Object.keys||function(e){return zI(e,JI)}});var Xf=h(Kf=>{var $I=me(),KI=El(),XI=Ye(),ZI=Ze(),YI=zr(),QI=au();Kf.f=$I&&!KI?Object.defineProperties:function(e,t){ZI(e);for(var i=YI(t),n=QI(t),o=n.length,a=0,c;o>a;)XI.f(e,c=n[a++],i[c]);return e}});var Yf=h((gM,Zf)=>{var ew=jn();Zf.exports=ew("document","documentElement")});var zn=h((hM,sg)=>{var tw=Ze(),rw=Xf(),Qf=Wa(),iw=Da(),nw=Yf(),sw=Tl(),ow=Ba(),eg=">",tg="<",lu="prototype",uu="script",ig=ow("IE_PROTO"),du=function(){},ng=function(r){return tg+uu+eg+r+tg+"/"+uu+eg},rg=function(r){r.write(ng("")),r.close();var e=r.parentWindow.Object;return r=null,e},aw=function(){var r=sw("iframe"),e="java"+uu+":",t;return r.style.display="none",nw.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(ng("document.F=Object")),t.close(),t.F},Ga,Va=function(){try{Ga=new ActiveXObject("htmlfile")}catch{}Va=typeof document<"u"?document.domain&&Ga?rg(Ga):aw():rg(Ga);for(var r=Qf.length;r--;)delete Va[lu][Qf[r]];return Va()};iw[ig]=!0;sg.exports=Object.create||function(e,t){var i;return e!==null?(du[lu]=tw(e),i=new du,du[lu]=null,i[ig]=e):i=Va(),t===void 0?i:rw.f(i,t)}});var ag=h((vM,og)=>{var dw=oe();og.exports=!dw(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var mu=h((yM,lg)=>{var lw=Ce(),uw=Z(),cw=Nn(),mw=Ba(),pw=ag(),dg=mw("IE_PROTO"),cu=Object,fw=cu.prototype;lg.exports=pw?cu.getPrototypeOf:function(r){var e=cw(r);if(lw(e,dg))return e[dg];var t=e.constructor;return uw(t)&&e instanceof t?t.prototype:e instanceof cu?fw:null}});var hu=h((bM,mg)=>{"use strict";var gw=oe(),hw=Z(),vw=Pt(),yw=zn(),ug=mu(),bw=nr(),kw=Ie(),Sw=jr(),gu=kw("iterator"),cg=!1,at,pu,fu;[].keys&&(fu=[].keys(),"next"in fu?(pu=ug(ug(fu)),pu!==Object.prototype&&(at=pu)):cg=!0);var Pw=!vw(at)||gw(function(){var r={};return at[gu].call(r)!==r});Pw?at={}:Sw&&(at=yw(at));hw(at[gu])||bw(at,gu,function(){return this});mg.exports={IteratorPrototype:at,BUGGY_SAFARI_ITERATORS:cg}});var Jn=h((kM,fg)=>{var Cw=Ye().f,Iw=Ce(),ww=Ie(),pg=ww("toStringTag");fg.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!Iw(r,pg)&&Cw(r,pg,{configurable:!0,value:e})}});var Jr=h((SM,gg)=>{gg.exports={}});var vu=h((PM,hg)=>{"use strict";var xw=hu().IteratorPrototype,Tw=zn(),Aw=Gr(),Ew=Jn(),Rw=Jr(),Ow=function(){return this};hg.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=Tw(xw,{next:Aw(+!i,t)}),Ew(r,n,!1,!0),Rw[n]=Ow,r}});var yg=h((CM,vg)=>{var Fw=Z(),Mw=String,Lw=TypeError;vg.exports=function(r){if(typeof r=="object"||Fw(r))return r;throw Lw("Can't set "+Mw(r)+" as a prototype")}});var kg=h((IM,bg)=>{var Uw=X(),Bw=Ze(),Dw=yg();bg.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=Uw(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return Bw(n),Dw(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var bu=h((wM,Rg)=>{"use strict";var _w=Vn(),Nw=We(),za=jr(),Ag=Xl(),qw=Z(),Hw=vu(),Sg=mu(),Pg=kg(),jw=Jn(),Ww=Ua(),yu=nr(),Gw=Ie(),Cg=Jr(),Eg=hu(),Vw=Ag.PROPER,zw=Ag.CONFIGURABLE,Ig=Eg.IteratorPrototype,Ja=Eg.BUGGY_SAFARI_ITERATORS,$n=Gw("iterator"),wg="keys",Kn="values",xg="entries",Tg=function(){return this};Rg.exports=function(r,e,t,i,n,o,a){Hw(t,e,i);var c=function(M){if(M===n&&b)return b;if(!Ja&&M in v)return v[M];switch(M){case wg:return function(){return new t(this,M)};case Kn:return function(){return new t(this,M)};case xg:return function(){return new t(this,M)}}return function(){return new t(this)}},p=e+" Iterator",f=!1,v=r.prototype,m=v[$n]||v["@@iterator"]||n&&v[n],b=!Ja&&m||c(n),y=e=="Array"&&v.entries||m,C,I,T;if(y&&(C=Sg(y.call(new r)),C!==Object.prototype&&C.next&&(!za&&Sg(C)!==Ig&&(Pg?Pg(C,Ig):qw(C[$n])||yu(C,$n,Tg)),jw(C,p,!0,!0),za&&(Cg[p]=Tg))),Vw&&n==Kn&&m&&m.name!==Kn&&(!za&&zw?Ww(v,"name",Kn):(f=!0,b=function(){return Nw(m,this)})),n)if(I={values:c(Kn),keys:o?b:c(wg),entries:c(xg)},a)for(T in I)(Ja||f||!(T in v))&&yu(v,T,I[T]);else _w({target:e,proto:!0,forced:Ja||f},I);return(!za||a)&&v[$n]!==b&&yu(v,$n,b,{name:n}),Cg[e]=b,I}});var ku=h((xM,Og)=>{Og.exports=function(r,e){return{value:r,done:e}}});var Ug=h(()=>{"use strict";var Jw=wl().charAt,$w=Hn(),Mg=Vr(),Kw=bu(),Fg=ku(),Lg="String Iterator",Xw=Mg.set,Zw=Mg.getterFor(Lg);Kw(String,"String",function(r){Xw(this,{type:Lg,string:$w(r),index:0})},function(){var e=Zw(this),t=e.string,i=e.index,n;return i>=t.length?Fg(void 0,!0):(n=Jw(t,i),e.index+=n.length,Fg(n,!1))})});var Su=h((EM,Bg)=>{var Yw=oe(),Qw=Ie(),ex=jr(),tx=Qw("iterator");Bg.exports=!Yw(function(){var r=new URL("b?a=1&b=2&c=3","http://a"),e=r.searchParams,t="";return r.pathname="c%20d",e.forEach(function(i,n){e.delete("b"),t+=n+i}),ex&&!r.toJSON||!e.sort||r.href!=="http://a/c%20d?a=1&c=3"||e.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!e[tx]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("http://\u0442\u0435\u0441\u0442").host!=="xn--e1aybc"||new URL("http://a#\u0431").hash!=="#%D0%B1"||t!=="a1c3"||new URL("http://x",void 0).host!=="x"})});var _g=h((RM,Dg)=>{var rx=Aa(),ix=X();Dg.exports=function(r){if(rx(r)==="Function")return ix(r)}});var $a=h((OM,qg)=>{var Ng=_g(),nx=Oa(),sx=ka(),ox=Ng(Ng.bind);qg.exports=function(r,e){return nx(r),e===void 0?r:sx?ox(r,e):function(){return r.apply(e,arguments)}}});var Wg=h((FM,jg)=>{var Hg=tu(),ax=Ye();jg.exports=function(r,e,t){return t.get&&Hg(t.get,e,{getter:!0}),t.set&&Hg(t.set,e,{setter:!0}),ax.f(r,e,t)}});var Pu=h((MM,Gg)=>{var dx=Ol(),lx=TypeError;Gg.exports=function(r,e){if(dx(e,r))return r;throw lx("Incorrect invocation")}});var $g=h((LM,Jg)=>{"use strict";var Vg=me(),ux=X(),cx=We(),mx=oe(),Cu=au(),px=su(),fx=Gl(),gx=Nn(),hx=zl(),$r=Object.assign,zg=Object.defineProperty,vx=ux([].concat);Jg.exports=!$r||mx(function(){if(Vg&&$r({b:1},$r(zg({},"a",{enumerable:!0,get:function(){zg(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var r={},e={},t=Symbol(),i="abcdefghijklmnopqrst";return r[t]=7,i.split("").forEach(function(n){e[n]=n}),$r({},r)[t]!=7||Cu($r({},e)).join("")!=i})?function(e,t){for(var i=gx(e),n=arguments.length,o=1,a=px.f,c=fx.f;n>o;)for(var p=hx(arguments[o++]),f=a?vx(Cu(p),a(p)):Cu(p),v=f.length,m=0,b;v>m;)b=f[m++],(!Vg||cx(c,p,b))&&(i[b]=p[b]);return i}:$r});var Zg=h((UM,Xg)=>{var yx=We(),Kg=Ze(),bx=Fa();Xg.exports=function(r,e,t){var i,n;Kg(r);try{if(i=bx(r,"return"),!i){if(e==="throw")throw t;return t}i=yx(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Kg(i),t}});var Qg=h((BM,Yg)=>{var kx=Ze(),Sx=Zg();Yg.exports=function(r,e,t,i){try{return i?e(kx(t)[0],t[1]):e(t)}catch(n){Sx(r,"throw",n)}}});var th=h((DM,eh)=>{var Px=Ie(),Cx=Jr(),Ix=Px("iterator"),wx=Array.prototype;eh.exports=function(r){return r!==void 0&&(Cx.Array===r||wx[Ix]===r)}});var ah=h((_M,oh)=>{var xx=X(),Tx=oe(),rh=Z(),Ax=qn(),Ex=jn(),Rx=Yl(),ih=function(){},Ox=[],nh=Ex("Reflect","construct"),Iu=/^\s*(?:class|function)\b/,Fx=xx(Iu.exec),Mx=!Iu.exec(ih),Xn=function(e){if(!rh(e))return!1;try{return nh(ih,Ox,e),!0}catch{return!1}},sh=function(e){if(!rh(e))return!1;switch(Ax(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Mx||!!Fx(Iu,Rx(e))}catch{return!0}};sh.sham=!0;oh.exports=!nh||Tx(function(){var r;return Xn(Xn.call)||!Xn(Object)||!Xn(function(){r=!0})||r})?sh:Xn});var wu=h((NM,dh)=>{"use strict";var Lx=Ma(),Ux=Ye(),Bx=Gr();dh.exports=function(r,e,t){var i=Lx(e);i in r?Ux.f(r,i,Bx(0,t)):r[i]=t}});var Ka=h((qM,uh)=>{var Dx=qn(),lh=Fa(),_x=wa(),Nx=Jr(),qx=Ie(),Hx=qx("iterator");uh.exports=function(r){if(!_x(r))return lh(r,Hx)||lh(r,"@@iterator")||Nx[Dx(r)]}});var xu=h((HM,ch)=>{var jx=We(),Wx=Oa(),Gx=Ze(),Vx=Ml(),zx=Ka(),Jx=TypeError;ch.exports=function(r,e){var t=arguments.length<2?zx(r):e;if(Wx(t))return Gx(jx(t,r));throw Jx(Vx(r)+" is not iterable")}});var gh=h((jM,fh)=>{"use strict";var $x=$a(),Kx=We(),Xx=Nn(),Zx=Qg(),Yx=th(),Qx=ah(),eT=ja(),mh=wu(),tT=xu(),rT=Ka(),ph=Array;fh.exports=function(e){var t=Xx(e),i=Qx(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=$x(o,n>2?arguments[2]:void 0));var c=rT(t),p=0,f,v,m,b,y,C;if(c&&!(this===ph&&Yx(c)))for(b=tT(t,c),y=b.next,v=i?new this:[];!(m=Kx(y,b)).done;p++)C=a?Zx(b,o,[m.value,p],!0):m.value,mh(v,p,C);else for(f=eT(t),v=i?new this(f):ph(f);f>p;p++)C=a?o(t[p],p):t[p],mh(v,p,C);return v.length=p,v}});var Tu=h((WM,vh)=>{var hh=ru(),iT=ja(),nT=wu(),sT=Array,oT=Math.max;vh.exports=function(r,e,t){for(var i=iT(r),n=hh(e,i),o=hh(t===void 0?i:t,i),a=sT(oT(o-n,0)),c=0;n<o;n++,c++)nT(a,c,r[n]);return a.length=c,a}});var xh=h((GM,wh)=>{var sr=X(),Au=2147483647,Zn=36,Ph=1,Ou=26,aT=38,dT=700,lT=72,uT=128,cT="-",mT=/[^\0-\u007E]/,Ch=/[.\u3002\uFF0E\uFF61]/g,yh="Overflow: input needs wider integers to process",Eu=Zn-Ph,bh=RangeError,pT=sr(Ch.exec),Kr=Math.floor,Ru=String.fromCharCode,kh=sr("".charCodeAt),Ih=sr([].join),Ct=sr([].push),fT=sr("".replace),gT=sr("".split),hT=sr("".toLowerCase),vT=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=kh(r,t++);if(n>=55296&&n<=56319&&t<i){var o=kh(r,t++);(o&64512)==56320?Ct(e,((n&1023)<<10)+(o&1023)+65536):(Ct(e,n),t--)}else Ct(e,n)}return e},Sh=function(r){return r+22+75*(r<26)},yT=function(r,e,t){var i=0;for(r=t?Kr(r/dT):r>>1,r+=Kr(r/e);r>Eu*Ou>>1;)r=Kr(r/Eu),i+=Zn;return Kr(i+(Eu+1)*r/(r+aT))},bT=function(r){var e=[];r=vT(r);var t=r.length,i=uT,n=0,o=lT,a,c;for(a=0;a<r.length;a++)c=r[a],c<128&&Ct(e,Ru(c));var p=e.length,f=p;for(p&&Ct(e,cT);f<t;){var v=Au;for(a=0;a<r.length;a++)c=r[a],c>=i&&c<v&&(v=c);var m=f+1;if(v-i>Kr((Au-n)/m))throw bh(yh);for(n+=(v-i)*m,i=v,a=0;a<r.length;a++){if(c=r[a],c<i&&++n>Au)throw bh(yh);if(c==i){for(var b=n,y=Zn;;){var C=y<=o?Ph:y>=o+Ou?Ou:y-o;if(b<C)break;var I=b-C,T=Zn-C;Ct(e,Ru(Sh(C+I%T))),b=Kr(I/T),y+=Zn}Ct(e,Ru(Sh(b))),o=yT(n,m,f==p),n=0,f++}}n++,i++}return Ih(e,"")};wh.exports=function(r){var e=[],t=gT(fT(hT(r),Ch,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],Ct(e,pT(mT,n)?"xn--"+bT(n):n);return Ih(e,".")}});var Fu=h((VM,Th)=>{var kT=TypeError;Th.exports=function(r,e){if(r<e)throw kT("Not enough arguments");return r}});var Eh=h((zM,Ah)=>{var ST=Ie(),PT=zn(),CT=Ye().f,Mu=ST("unscopables"),Lu=Array.prototype;Lu[Mu]==null&&CT(Lu,Mu,{configurable:!0,value:PT(null)});Ah.exports=function(r){Lu[Mu][r]=!0}});var Uh=h((JM,Lh)=>{"use strict";var IT=zr(),Uu=Eh(),Rh=Jr(),Fh=Vr(),wT=Ye().f,xT=bu(),Xa=ku(),TT=jr(),AT=me(),Mh="Array Iterator",ET=Fh.set,RT=Fh.getterFor(Mh);Lh.exports=xT(Array,"Array",function(r,e){ET(this,{type:Mh,target:IT(r),index:0,kind:e})},function(){var r=RT(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,Xa(void 0,!0)):t=="keys"?Xa(i,!1):t=="values"?Xa(e[i],!1):Xa([i,e[i]],!1)},"values");var Oh=Rh.Arguments=Rh.Array;Uu("keys");Uu("values");Uu("entries");if(!TT&&AT&&Oh.name!=="values")try{wT(Oh,"name",{value:"values"})}catch{}});var Dh=h(($M,Bh)=>{var OT=nr();Bh.exports=function(r,e,t){for(var i in e)OT(r,i,e[i],t);return r}});var qh=h((KM,Nh)=>{var _h=Tu(),FT=Math.floor,Bu=function(r,e){var t=r.length,i=FT(t/2);return t<8?MT(r,e):LT(r,Bu(_h(r,0,i),e),Bu(_h(r,i),e),e)},MT=function(r,e){for(var t=r.length,i=1,n,o;i<t;){for(o=i,n=r[i];o&&e(r[o-1],n)>0;)r[o]=r[--o];o!==i++&&(r[o]=n)}return r},LT=function(r,e,t,i){for(var n=e.length,o=t.length,a=0,c=0;a<n||c<o;)r[a+c]=a<n&&c<o?i(e[a],t[c])<=0?e[a++]:t[c++]:a<n?e[a++]:t[c++];return r};Nh.exports=Bu});var zu=h((XM,ov)=>{"use strict";Uh();var Hu=Vn(),Zr=ce(),Za=We(),Qe=X(),UT=me(),Yh=Su(),Qh=nr(),BT=Dh(),DT=Jn(),_T=vu(),Gu=Vr(),ev=Pu(),Du=Z(),NT=Ce(),qT=$a(),HT=qn(),jT=Ze(),tv=Pt(),pe=Hn(),WT=zn(),Hh=Gr(),ju=xu(),GT=Ka(),Xr=Fu(),VT=Ie(),zT=qh(),JT=VT("iterator"),es="URLSearchParams",rv=es+"Iterator",iv=Gu.set,Ve=Gu.getterFor(es),$T=Gu.getterFor(rv),KT=Object.getOwnPropertyDescriptor,Vu=function(r){if(!UT)return Zr[r];var e=KT(Zr,r);return e&&e.value},jh=Vu("fetch"),Qa=Vu("Request"),Yn=Vu("Headers"),_u=Qa&&Qa.prototype,Wh=Yn&&Yn.prototype,XT=Zr.RegExp,ZT=Zr.TypeError,nv=Zr.decodeURIComponent,YT=Zr.encodeURIComponent,QT=Qe("".charAt),Gh=Qe([].join),or=Qe([].push),Wu=Qe("".replace),eA=Qe([].shift),Vh=Qe([].splice),zh=Qe("".split),tA=Qe("".slice),rA=/\+/g,Jh=Array(4),iA=function(r){return Jh[r-1]||(Jh[r-1]=XT("((?:%[\\da-f]{2}){"+r+"})","gi"))},nA=function(r){try{return nv(r)}catch{return r}},$h=function(r){var e=Wu(r,rA," "),t=4;try{return nv(e)}catch{for(;t;)e=Wu(e,iA(t--),nA);return e}},sA=/[!'()~]|%20/g,oA={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},aA=function(r){return oA[r]},Kh=function(r){return Wu(YT(r),sA,aA)},Nu=_T(function(e,t){iv(this,{type:rv,iterator:ju(Ve(e).entries),kind:t})},"Iterator",function(){var e=$T(this),t=e.kind,i=e.iterator.next(),n=i.value;return i.done||(i.value=t==="keys"?n.key:t==="values"?n.value:[n.key,n.value]),i},!0),sv=function(r){this.entries=[],this.url=null,r!==void 0&&(tv(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?QT(r,0)==="?"?tA(r,1):r:pe(r)))};sv.prototype={type:es,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=GT(r),t,i,n,o,a,c,p;if(e)for(t=ju(r,e),i=t.next;!(n=Za(i,t)).done;){if(o=ju(jT(n.value)),a=o.next,(c=Za(a,o)).done||(p=Za(a,o)).done||!Za(a,o).done)throw ZT("Expected sequence with length 2");or(this.entries,{key:pe(c.value),value:pe(p.value)})}else for(var f in r)NT(r,f)&&or(this.entries,{key:f,value:pe(r[f])})},parseQuery:function(r){if(r)for(var e=zh(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=zh(i,"="),or(this.entries,{key:$h(eA(n)),value:$h(Gh(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],or(e,Kh(i.key)+"="+Kh(i.value));return Gh(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var ed=function(){ev(this,Qn);var e=arguments.length>0?arguments[0]:void 0;iv(this,new sv(e))},Qn=ed.prototype;BT(Qn,{append:function(e,t){Xr(arguments.length,2);var i=Ve(this);or(i.entries,{key:pe(e),value:pe(t)}),i.updateURL()},delete:function(r){Xr(arguments.length,1);for(var e=Ve(this),t=e.entries,i=pe(r),n=0;n<t.length;)t[n].key===i?Vh(t,n,1):n++;e.updateURL()},get:function(e){Xr(arguments.length,1);for(var t=Ve(this).entries,i=pe(e),n=0;n<t.length;n++)if(t[n].key===i)return t[n].value;return null},getAll:function(e){Xr(arguments.length,1);for(var t=Ve(this).entries,i=pe(e),n=[],o=0;o<t.length;o++)t[o].key===i&&or(n,t[o].value);return n},has:function(e){Xr(arguments.length,1);for(var t=Ve(this).entries,i=pe(e),n=0;n<t.length;)if(t[n++].key===i)return!0;return!1},set:function(e,t){Xr(arguments.length,1);for(var i=Ve(this),n=i.entries,o=!1,a=pe(e),c=pe(t),p=0,f;p<n.length;p++)f=n[p],f.key===a&&(o?Vh(n,p--,1):(o=!0,f.value=c));o||or(n,{key:a,value:c}),i.updateURL()},sort:function(){var e=Ve(this);zT(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=Ve(this).entries,i=qT(e,arguments.length>1?arguments[1]:void 0),n=0,o;n<t.length;)o=t[n++],i(o.value,o.key,this)},keys:function(){return new Nu(this,"keys")},values:function(){return new Nu(this,"values")},entries:function(){return new Nu(this,"entries")}},{enumerable:!0});Qh(Qn,JT,Qn.entries,{name:"entries"});Qh(Qn,"toString",function(){return Ve(this).serialize()},{enumerable:!0});DT(ed,es);Hu({global:!0,constructor:!0,forced:!Yh},{URLSearchParams:ed});!Yh&&Du(Yn)&&(Xh=Qe(Wh.has),Zh=Qe(Wh.set),qu=function(r){if(tv(r)){var e=r.body,t;if(HT(e)===es)return t=r.headers?new Yn(r.headers):new Yn,Xh(t,"content-type")||Zh(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),WT(r,{body:Hh(0,pe(e)),headers:Hh(0,t)})}return r},Du(jh)&&Hu({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return jh(e,arguments.length>1?qu(arguments[1]):{})}}),Du(Qa)&&(Ya=function(e){return ev(this,_u),new Qa(e,arguments.length>1?qu(arguments[1]):{})},_u.constructor=Ya,Ya.prototype=_u,Hu({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Ya})));var Xh,Zh,qu,Ya;ov.exports={URLSearchParams:ed,getState:Ve}});var wv=h(()=>{"use strict";Ug();var dA=Vn(),dc=me(),lA=Su(),lc=ce(),av=$a(),Ee=X(),sd=nr(),we=Wg(),uA=Pu(),sc=Ce(),uc=$g(),Yr=gh(),ze=Tu(),cA=wl().codeAt,mA=xh(),lt=Hn(),pA=Jn(),fA=Fu(),bv=zu(),kv=Vr(),gA=kv.set,od=kv.getterFor("URL"),hA=bv.URLSearchParams,vA=bv.getState,ts=lc.URL,oc=lc.TypeError,ad=lc.parseInt,yA=Math.floor,dv=Math.pow,Ae=Ee("".charAt),Je=Ee(/./.exec),is=Ee([].join),bA=Ee(1 .toString),kA=Ee([].pop),ei=Ee([].push),lv=Ee("".replace),SA=Ee([].shift),PA=Ee("".split),ss=Ee("".slice),dd=Ee("".toLowerCase),CA=Ee([].unshift),IA="Invalid authority",Ju="Invalid scheme",ar="Invalid host",uv="Invalid port",Sv=/[a-z]/i,wA=/[\d+-.a-z]/i,ac=/\d/,xA=/^0x/i,TA=/^[0-7]+$/,AA=/^\d+$/,Pv=/^[\da-f]+$/i,EA=/[\0\t\n\r #%/:<>?@[\\\]^|]/,RA=/[\0\t\n\r #/:<>?@[\\\]^|]/,OA=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,FA=/[\t\n\r]/g,xe,MA=function(r){var e=PA(r,"."),t,i,n,o,a,c,p;if(e.length&&e[e.length-1]==""&&e.length--,t=e.length,t>4)return r;for(i=[],n=0;n<t;n++){if(o=e[n],o=="")return r;if(a=10,o.length>1&&Ae(o,0)=="0"&&(a=Je(xA,o)?16:8,o=ss(o,a==8?1:2)),o==="")c=0;else{if(!Je(a==10?AA:a==8?TA:Pv,o))return r;c=ad(o,a)}ei(i,c)}for(n=0;n<t;n++)if(c=i[n],n==t-1){if(c>=dv(256,5-t))return null}else if(c>255)return null;for(p=kA(i),n=0;n<i.length;n++)p+=i[n]*dv(256,3-n);return p},LA=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,c,p,f,v,m,b=function(){return Ae(r,n)};if(b()==":"){if(Ae(r,1)!=":")return;n+=2,t++,i=t}for(;b();){if(t==8)return;if(b()==":"){if(i!==null)return;n++,t++,i=t;continue}for(o=a=0;a<4&&Je(Pv,b());)o=o*16+ad(b(),16),n++,a++;if(b()=="."){if(a==0||(n-=a,t>6))return;for(c=0;b();){if(p=null,c>0)if(b()=="."&&c<4)n++;else return;if(!Je(ac,b()))return;for(;Je(ac,b());){if(f=ad(b(),10),p===null)p=f;else{if(p==0)return;p=p*10+f}if(p>255)return;n++}e[t]=e[t]*256+p,c++,(c==2||c==4)&&t++}if(c!=4)return;break}else if(b()==":"){if(n++,!b())return}else if(b())return;e[t++]=o}if(i!==null)for(v=t-i,t=7;t!=0&&v>0;)m=e[t],e[t--]=e[i+v-1],e[i+--v]=m;else if(t!=8)return;return e},UA=function(r){for(var e=null,t=1,i=null,n=0,o=0;o<8;o++)r[o]!==0?(n>t&&(e=i,t=n),i=null,n=0):(i===null&&(i=o),++n);return n>t&&(e=i,t=n),e},rs=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)CA(e,r%256),r=yA(r/256);return is(e,".")}else if(typeof r=="object"){for(e="",i=UA(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=bA(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},nd={},Cv=uc({},nd,{" ":1,'"':1,"<":1,">":1,"`":1}),Iv=uc({},Cv,{"#":1,"?":1,"{":1,"}":1}),$u=uc({},Iv,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),It=function(r,e){var t=cA(r,0);return t>32&&t<127&&!sc(e,r)?r:encodeURIComponent(r)},td={ftp:21,file:null,http:80,https:443,ws:80,wss:443},ns=function(r,e){var t;return r.length==2&&Je(Sv,Ae(r,0))&&((t=Ae(r,1))==":"||!e&&t=="|")},cv=function(r){var e;return r.length>1&&ns(ss(r,0,2))&&(r.length==2||(e=Ae(r,2))==="/"||e==="\\"||e==="?"||e==="#")},BA=function(r){return r==="."||dd(r)==="%2e"},DA=function(r){return r=dd(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Ku={},mv={},Xu={},pv={},fv={},Zu={},gv={},hv={},rd={},id={},Yu={},Qu={},ec={},tc={},vv={},rc={},Qr={},et={},yv={},dr={},dt={},cc=function(r,e,t){var i=lt(r),n,o,a;if(e){if(o=this.parse(i),o)throw oc(o);this.searchParams=null}else{if(t!==void 0&&(n=new cc(t,!0)),o=this.parse(i,null,n),o)throw oc(o);a=vA(new hA),a.bindURL(this),this.searchParams=a}};cc.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||Ku,o=0,a="",c=!1,p=!1,f=!1,v,m,b,y;for(r=lt(r),e||(i.scheme="",i.username="",i.password="",i.host=null,i.port=null,i.path=[],i.query=null,i.fragment=null,i.cannotBeABaseURL=!1,r=lv(r,OA,"")),r=lv(r,FA,""),v=Yr(r);o<=v.length;){switch(m=v[o],n){case Ku:if(m&&Je(Sv,m))a+=dd(m),n=mv;else{if(e)return Ju;n=Xu;continue}break;case mv:if(m&&(Je(wA,m)||m=="+"||m=="-"||m=="."))a+=dd(m);else if(m==":"){if(e&&(i.isSpecial()!=sc(td,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&td[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=tc:i.isSpecial()&&t&&t.scheme==i.scheme?n=pv:i.isSpecial()?n=hv:v[o+1]=="/"?(n=fv,o++):(i.cannotBeABaseURL=!0,ei(i.path,""),n=yv)}else{if(e)return Ju;a="",n=Xu,o=0;continue}break;case Xu:if(!t||t.cannotBeABaseURL&&m!="#")return Ju;if(t.cannotBeABaseURL&&m=="#"){i.scheme=t.scheme,i.path=ze(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=dt;break}n=t.scheme=="file"?tc:Zu;continue;case pv:if(m=="/"&&v[o+1]=="/")n=rd,o++;else{n=Zu;continue}break;case fv:if(m=="/"){n=id;break}else{n=et;continue}case Zu:if(i.scheme=t.scheme,m==xe)i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=ze(t.path),i.query=t.query;else if(m=="/"||m=="\\"&&i.isSpecial())n=gv;else if(m=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=ze(t.path),i.query="",n=dr;else if(m=="#")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=ze(t.path),i.query=t.query,i.fragment="",n=dt;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=ze(t.path),i.path.length--,n=et;continue}break;case gv:if(i.isSpecial()&&(m=="/"||m=="\\"))n=rd;else if(m=="/")n=id;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=et;continue}break;case hv:if(n=rd,m!="/"||Ae(a,o+1)!="/")continue;o++;break;case rd:if(m!="/"&&m!="\\"){n=id;continue}break;case id:if(m=="@"){c&&(a="%40"+a),c=!0,b=Yr(a);for(var C=0;C<b.length;C++){var I=b[C];if(I==":"&&!f){f=!0;continue}var T=It(I,$u);f?i.password+=T:i.username+=T}a=""}else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(c&&a=="")return IA;o-=Yr(a).length+1,a="",n=Yu}else a+=m;break;case Yu:case Qu:if(e&&i.scheme=="file"){n=rc;continue}else if(m==":"&&!p){if(a=="")return ar;if(y=i.parseHost(a),y)return y;if(a="",n=ec,e==Qu)return}else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(i.isSpecial()&&a=="")return ar;if(e&&a==""&&(i.includesCredentials()||i.port!==null))return;if(y=i.parseHost(a),y)return y;if(a="",n=Qr,e)return;continue}else m=="["?p=!0:m=="]"&&(p=!1),a+=m;break;case ec:if(Je(ac,m))a+=m;else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()||e){if(a!=""){var M=ad(a,10);if(M>65535)return uv;i.port=i.isSpecial()&&M===td[i.scheme]?null:M,a=""}if(e)return;n=Qr;continue}else return uv;break;case tc:if(i.scheme="file",m=="/"||m=="\\")n=vv;else if(t&&t.scheme=="file")if(m==xe)i.host=t.host,i.path=ze(t.path),i.query=t.query;else if(m=="?")i.host=t.host,i.path=ze(t.path),i.query="",n=dr;else if(m=="#")i.host=t.host,i.path=ze(t.path),i.query=t.query,i.fragment="",n=dt;else{cv(is(ze(v,o),""))||(i.host=t.host,i.path=ze(t.path),i.shortenPath()),n=et;continue}else{n=et;continue}break;case vv:if(m=="/"||m=="\\"){n=rc;break}t&&t.scheme=="file"&&!cv(is(ze(v,o),""))&&(ns(t.path[0],!0)?ei(i.path,t.path[0]):i.host=t.host),n=et;continue;case rc:if(m==xe||m=="/"||m=="\\"||m=="?"||m=="#"){if(!e&&ns(a))n=et;else if(a==""){if(i.host="",e)return;n=Qr}else{if(y=i.parseHost(a),y)return y;if(i.host=="localhost"&&(i.host=""),e)return;a="",n=Qr}continue}else a+=m;break;case Qr:if(i.isSpecial()){if(n=et,m!="/"&&m!="\\")continue}else if(!e&&m=="?")i.query="",n=dr;else if(!e&&m=="#")i.fragment="",n=dt;else if(m!=xe&&(n=et,m!="/"))continue;break;case et:if(m==xe||m=="/"||m=="\\"&&i.isSpecial()||!e&&(m=="?"||m=="#")){if(DA(a)?(i.shortenPath(),m!="/"&&!(m=="\\"&&i.isSpecial())&&ei(i.path,"")):BA(a)?m!="/"&&!(m=="\\"&&i.isSpecial())&&ei(i.path,""):(i.scheme=="file"&&!i.path.length&&ns(a)&&(i.host&&(i.host=""),a=Ae(a,0)+":"),ei(i.path,a)),a="",i.scheme=="file"&&(m==xe||m=="?"||m=="#"))for(;i.path.length>1&&i.path[0]==="";)SA(i.path);m=="?"?(i.query="",n=dr):m=="#"&&(i.fragment="",n=dt)}else a+=It(m,Iv);break;case yv:m=="?"?(i.query="",n=dr):m=="#"?(i.fragment="",n=dt):m!=xe&&(i.path[0]+=It(m,nd));break;case dr:!e&&m=="#"?(i.fragment="",n=dt):m!=xe&&(m=="'"&&i.isSpecial()?i.query+="%27":m=="#"?i.query+="%23":i.query+=It(m,nd));break;case dt:m!=xe&&(i.fragment+=It(m,Cv));break}o++}},parseHost:function(r){var e,t,i;if(Ae(r,0)=="["){if(Ae(r,r.length-1)!="]"||(e=LA(ss(r,1,-1)),!e))return ar;this.host=e}else if(this.isSpecial()){if(r=mA(r),Je(EA,r)||(e=MA(r),e===null))return ar;this.host=e}else{if(Je(RA,r))return ar;for(e="",t=Yr(r),i=0;i<t.length;i++)e+=It(t[i],nd);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return sc(td,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!ns(r[0],!0))&&r.length--},serialize:function(){var r=this,e=r.scheme,t=r.username,i=r.password,n=r.host,o=r.port,a=r.path,c=r.query,p=r.fragment,f=e+":";return n!==null?(f+="//",r.includesCredentials()&&(f+=t+(i?":"+i:"")+"@"),f+=rs(n),o!==null&&(f+=":"+o)):e=="file"&&(f+="//"),f+=r.cannotBeABaseURL?a[0]:a.length?"/"+is(a,"/"):"",c!==null&&(f+="?"+c),p!==null&&(f+="#"+p),f},setHref:function(r){var e=this.parse(r);if(e)throw oc(e);this.searchParams.update()},getOrigin:function(){var r=this.scheme,e=this.port;if(r=="blob")try{return new ti(r.path[0]).origin}catch{return"null"}return r=="file"||!this.isSpecial()?"null":r+"://"+rs(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(lt(r)+":",Ku)},getUsername:function(){return this.username},setUsername:function(r){var e=Yr(lt(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=It(e[t],$u)}},getPassword:function(){return this.password},setPassword:function(r){var e=Yr(lt(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=It(e[t],$u)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?rs(r):rs(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,Yu)},getHostname:function(){var r=this.host;return r===null?"":rs(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,Qu)},getPort:function(){var r=this.port;return r===null?"":lt(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=lt(r),r==""?this.port=null:this.parse(r,ec))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+is(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,Qr))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=lt(r),r==""?this.query=null:(Ae(r,0)=="?"&&(r=ss(r,1)),this.query="",this.parse(r,dr)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var r=this.fragment;return r?"#"+r:""},setHash:function(r){if(r=lt(r),r==""){this.fragment=null;return}Ae(r,0)=="#"&&(r=ss(r,1)),this.fragment="",this.parse(r,dt)},update:function(){this.query=this.searchParams.serialize()||null}};var ti=function(e){var t=uA(this,te),i=fA(arguments.length,1)>1?arguments[1]:void 0,n=gA(t,new cc(e,!1,i));dc||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},te=ti.prototype,Te=function(r,e){return{get:function(){return od(this)[r]()},set:e&&function(t){return od(this)[e](t)},configurable:!0,enumerable:!0}};dc&&(we(te,"href",Te("serialize","setHref")),we(te,"origin",Te("getOrigin")),we(te,"protocol",Te("getProtocol","setProtocol")),we(te,"username",Te("getUsername","setUsername")),we(te,"password",Te("getPassword","setPassword")),we(te,"host",Te("getHost","setHost")),we(te,"hostname",Te("getHostname","setHostname")),we(te,"port",Te("getPort","setPort")),we(te,"pathname",Te("getPathname","setPathname")),we(te,"search",Te("getSearch","setSearch")),we(te,"searchParams",Te("getSearchParams")),we(te,"hash",Te("getHash","setHash")));sd(te,"toJSON",function(){return od(this).serialize()},{enumerable:!0});sd(te,"toString",function(){return od(this).serialize()},{enumerable:!0});ts&&(ic=ts.createObjectURL,nc=ts.revokeObjectURL,ic&&sd(ti,"createObjectURL",av(ic,ts)),nc&&sd(ti,"revokeObjectURL",av(nc,ts)));var ic,nc;pA(ti,"URL");dA({global:!0,constructor:!0,forced:!lA,sham:!dc},{URL:ti})});var xv=h(()=>{wv()});var Tv=h(()=>{"use strict";var _A=Vn(),NA=We();_A({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return NA(URL.prototype.toString,this)}})});var Av=h(()=>{zu()});var Rv=h((sL,Ev)=>{var qA=ce();Ev.exports=qA});var Fv=h((oL,Ov)=>{xv();Tv();Av();var HA=Rv();Ov.exports=HA.URL});var Nc=h((RD,Hy)=>{var eE=Object.prototype.toString;Hy.exports=function(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;if(t==="boolean")return"boolean";if(t==="string")return"string";if(t==="number")return"number";if(t==="symbol")return"symbol";if(t==="function")return sE(e)?"generatorfunction":"function";if(tE(e))return"array";if(dE(e))return"buffer";if(aE(e))return"arguments";if(iE(e))return"date";if(rE(e))return"error";if(nE(e))return"regexp";switch(qy(e)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(oE(e))return"generator";switch(t=eE.call(e),t){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")};function qy(r){return typeof r.constructor=="function"?r.constructor.name:null}function tE(r){return Array.isArray?Array.isArray(r):r instanceof Array}function rE(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function iE(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function nE(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function sE(r,e){return qy(r)==="GeneratorFunction"}function oE(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function aE(r){try{if(typeof r.length=="number"&&typeof r.callee=="function")return!0}catch(e){if(e.message.indexOf("callee")!==-1)return!0}return!1}function dE(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var Gy=h((OD,Wy)=>{"use strict";var jy=Symbol.prototype.valueOf,lE=Nc();function uE(r,e){switch(lE(r)){case"array":return r.slice();case"object":return Object.assign({},r);case"date":return new r.constructor(Number(r));case"map":return new Map(r);case"set":return new Set(r);case"buffer":return fE(r);case"symbol":return gE(r);case"arraybuffer":return mE(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return pE(r);case"regexp":return cE(r);case"error":return Object.create(r);default:return r}}function cE(r){let e=r.flags!==void 0?r.flags:/\w+$/.exec(r)||void 0,t=new r.constructor(r.source,e);return t.lastIndex=r.lastIndex,t}function mE(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function pE(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function fE(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function gE(r){return jy?Object(jy.call(r)):{}}Wy.exports=uE});var zy=h((FD,Vy)=>{"use strict";Vy.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var Ky=h((MD,$y)=>{"use strict";var hE=zy();function Jy(r){return hE(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}$y.exports=function(e){var t,i;return!(Jy(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,Jy(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var Zy=h((LD,Xy)=>{"use strict";var vE=Gy(),yE=Nc(),bE=Ky();function qc(r,e){switch(yE(r)){case"object":return kE(r,e);case"array":return SE(r,e);default:return vE(r)}}function kE(r,e){if(typeof e=="function")return e(r);if(e||bE(r)){let t=new r.constructor;for(let i in r)t[i]=qc(r[i],e);return t}return r}function SE(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=qc(r[i],e);return t}Xy.exports=qc});var Yc=h((vs,Ti)=>{var PE=200,Zc="__lodash_hash_undefined__",Od=1,lb=2,ub=9007199254740991,Id="[object Arguments]",Gc="[object Array]",CE="[object AsyncFunction]",cb="[object Boolean]",mb="[object Date]",pb="[object Error]",fb="[object Function]",IE="[object GeneratorFunction]",wd="[object Map]",gb="[object Number]",wE="[object Null]",xi="[object Object]",Yy="[object Promise]",xE="[object Proxy]",hb="[object RegExp]",xd="[object Set]",vb="[object String]",TE="[object Symbol]",AE="[object Undefined]",Vc="[object WeakMap]",yb="[object ArrayBuffer]",Td="[object DataView]",EE="[object Float32Array]",RE="[object Float64Array]",OE="[object Int8Array]",FE="[object Int16Array]",ME="[object Int32Array]",LE="[object Uint8Array]",UE="[object Uint8ClampedArray]",BE="[object Uint16Array]",DE="[object Uint32Array]",_E=/[\\^$.*+?()[\]{}|]/g,NE=/^\[object .+?Constructor\]$/,qE=/^(?:0|[1-9]\d*)$/,H={};H[EE]=H[RE]=H[OE]=H[FE]=H[ME]=H[LE]=H[UE]=H[BE]=H[DE]=!0;H[Id]=H[Gc]=H[yb]=H[cb]=H[Td]=H[mb]=H[pb]=H[fb]=H[wd]=H[gb]=H[xi]=H[hb]=H[xd]=H[vb]=H[Vc]=!1;var bb=typeof global=="object"&&global&&global.Object===Object&&global,HE=typeof self=="object"&&self&&self.Object===Object&&self,pt=bb||HE||Function("return this")(),kb=typeof vs=="object"&&vs&&!vs.nodeType&&vs,Qy=kb&&typeof Ti=="object"&&Ti&&!Ti.nodeType&&Ti,Sb=Qy&&Qy.exports===kb,Hc=Sb&&bb.process,eb=function(){try{return Hc&&Hc.binding&&Hc.binding("util")}catch{}}(),tb=eb&&eb.isTypedArray;function jE(r,e){for(var t=-1,i=r==null?0:r.length,n=0,o=[];++t<i;){var a=r[t];e(a,t,r)&&(o[n++]=a)}return o}function WE(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function GE(r,e){for(var t=-1,i=r==null?0:r.length;++t<i;)if(e(r[t],t,r))return!0;return!1}function VE(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function zE(r){return function(e){return r(e)}}function JE(r,e){return r.has(e)}function $E(r,e){return r?.[e]}function KE(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function XE(r,e){return function(t){return r(e(t))}}function ZE(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var YE=Array.prototype,QE=Function.prototype,Fd=Object.prototype,jc=pt["__core-js_shared__"],Pb=QE.toString,tt=Fd.hasOwnProperty,rb=function(){var r=/[^.]+$/.exec(jc&&jc.keys&&jc.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Cb=Fd.toString,eR=RegExp("^"+Pb.call(tt).replace(_E,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ib=Sb?pt.Buffer:void 0,Ad=pt.Symbol,nb=pt.Uint8Array,Ib=Fd.propertyIsEnumerable,tR=YE.splice,vr=Ad?Ad.toStringTag:void 0,sb=Object.getOwnPropertySymbols,rR=ib?ib.isBuffer:void 0,iR=XE(Object.keys,Object),zc=Ai(pt,"DataView"),ys=Ai(pt,"Map"),Jc=Ai(pt,"Promise"),$c=Ai(pt,"Set"),Kc=Ai(pt,"WeakMap"),bs=Ai(Object,"create"),nR=kr(zc),sR=kr(ys),oR=kr(Jc),aR=kr($c),dR=kr(Kc),ob=Ad?Ad.prototype:void 0,Wc=ob?ob.valueOf:void 0;function yr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function lR(){this.__data__=bs?bs(null):{},this.size=0}function uR(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function cR(r){var e=this.__data__;if(bs){var t=e[r];return t===Zc?void 0:t}return tt.call(e,r)?e[r]:void 0}function mR(r){var e=this.__data__;return bs?e[r]!==void 0:tt.call(e,r)}function pR(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=bs&&e===void 0?Zc:e,this}yr.prototype.clear=lR;yr.prototype.delete=uR;yr.prototype.get=cR;yr.prototype.has=mR;yr.prototype.set=pR;function ft(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function fR(){this.__data__=[],this.size=0}function gR(r){var e=this.__data__,t=Md(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():tR.call(e,t,1),--this.size,!0}function hR(r){var e=this.__data__,t=Md(e,r);return t<0?void 0:e[t][1]}function vR(r){return Md(this.__data__,r)>-1}function yR(r,e){var t=this.__data__,i=Md(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}ft.prototype.clear=fR;ft.prototype.delete=gR;ft.prototype.get=hR;ft.prototype.has=vR;ft.prototype.set=yR;function br(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function bR(){this.size=0,this.__data__={hash:new yr,map:new(ys||ft),string:new yr}}function kR(r){var e=Ld(this,r).delete(r);return this.size-=e?1:0,e}function SR(r){return Ld(this,r).get(r)}function PR(r){return Ld(this,r).has(r)}function CR(r,e){var t=Ld(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}br.prototype.clear=bR;br.prototype.delete=kR;br.prototype.get=SR;br.prototype.has=PR;br.prototype.set=CR;function Ed(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new br;++e<t;)this.add(r[e])}function IR(r){return this.__data__.set(r,Zc),this}function wR(r){return this.__data__.has(r)}Ed.prototype.add=Ed.prototype.push=IR;Ed.prototype.has=wR;function Lt(r){var e=this.__data__=new ft(r);this.size=e.size}function xR(){this.__data__=new ft,this.size=0}function TR(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function AR(r){return this.__data__.get(r)}function ER(r){return this.__data__.has(r)}function RR(r,e){var t=this.__data__;if(t instanceof ft){var i=t.__data__;if(!ys||i.length<PE-1)return i.push([r,e]),this.size=++t.size,this;t=this.__data__=new br(i)}return t.set(r,e),this.size=t.size,this}Lt.prototype.clear=xR;Lt.prototype.delete=TR;Lt.prototype.get=AR;Lt.prototype.has=ER;Lt.prototype.set=RR;function OR(r,e){var t=Rd(r),i=!t&&zR(r),n=!t&&!i&&Xc(r),o=!t&&!i&&!n&&Ob(r),a=t||i||n||o,c=a?VE(r.length,String):[],p=c.length;for(var f in r)(e||tt.call(r,f))&&!(a&&(f=="length"||n&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||HR(f,p)))&&c.push(f);return c}function Md(r,e){for(var t=r.length;t--;)if(Tb(r[t][0],e))return t;return-1}function FR(r,e,t){var i=e(r);return Rd(r)?i:WE(i,t(r))}function Ss(r){return r==null?r===void 0?AE:wE:vr&&vr in Object(r)?NR(r):VR(r)}function ab(r){return ks(r)&&Ss(r)==Id}function wb(r,e,t,i,n){return r===e?!0:r==null||e==null||!ks(r)&&!ks(e)?r!==r&&e!==e:MR(r,e,t,i,wb,n)}function MR(r,e,t,i,n,o){var a=Rd(r),c=Rd(e),p=a?Gc:Mt(r),f=c?Gc:Mt(e);p=p==Id?xi:p,f=f==Id?xi:f;var v=p==xi,m=f==xi,b=p==f;if(b&&Xc(r)){if(!Xc(e))return!1;a=!0,v=!1}if(b&&!v)return o||(o=new Lt),a||Ob(r)?xb(r,e,t,i,n,o):DR(r,e,p,t,i,n,o);if(!(t&Od)){var y=v&&tt.call(r,"__wrapped__"),C=m&&tt.call(e,"__wrapped__");if(y||C){var I=y?r.value():r,T=C?e.value():e;return o||(o=new Lt),n(I,T,t,i,o)}}return b?(o||(o=new Lt),_R(r,e,t,i,n,o)):!1}function LR(r){if(!Rb(r)||WR(r))return!1;var e=Ab(r)?eR:NE;return e.test(kr(r))}function UR(r){return ks(r)&&Eb(r.length)&&!!H[Ss(r)]}function BR(r){if(!GR(r))return iR(r);var e=[];for(var t in Object(r))tt.call(r,t)&&t!="constructor"&&e.push(t);return e}function xb(r,e,t,i,n,o){var a=t&Od,c=r.length,p=e.length;if(c!=p&&!(a&&p>c))return!1;var f=o.get(r);if(f&&o.get(e))return f==e;var v=-1,m=!0,b=t&lb?new Ed:void 0;for(o.set(r,e),o.set(e,r);++v<c;){var y=r[v],C=e[v];if(i)var I=a?i(C,y,v,e,r,o):i(y,C,v,r,e,o);if(I!==void 0){if(I)continue;m=!1;break}if(b){if(!GE(e,function(T,M){if(!JE(b,M)&&(y===T||n(y,T,t,i,o)))return b.push(M)})){m=!1;break}}else if(!(y===C||n(y,C,t,i,o))){m=!1;break}}return o.delete(r),o.delete(e),m}function DR(r,e,t,i,n,o,a){switch(t){case Td:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case yb:return!(r.byteLength!=e.byteLength||!o(new nb(r),new nb(e)));case cb:case mb:case gb:return Tb(+r,+e);case pb:return r.name==e.name&&r.message==e.message;case hb:case vb:return r==e+"";case wd:var c=KE;case xd:var p=i&Od;if(c||(c=ZE),r.size!=e.size&&!p)return!1;var f=a.get(r);if(f)return f==e;i|=lb,a.set(r,e);var v=xb(c(r),c(e),i,n,o,a);return a.delete(r),v;case TE:if(Wc)return Wc.call(r)==Wc.call(e)}return!1}function _R(r,e,t,i,n,o){var a=t&Od,c=db(r),p=c.length,f=db(e),v=f.length;if(p!=v&&!a)return!1;for(var m=p;m--;){var b=c[m];if(!(a?b in e:tt.call(e,b)))return!1}var y=o.get(r);if(y&&o.get(e))return y==e;var C=!0;o.set(r,e),o.set(e,r);for(var I=a;++m<p;){b=c[m];var T=r[b],M=e[b];if(i)var ue=a?i(M,T,b,e,r,o):i(T,M,b,r,e,o);if(!(ue===void 0?T===M||n(T,M,t,i,o):ue)){C=!1;break}I||(I=b=="constructor")}if(C&&!I){var Dn=r.constructor,ba=e.constructor;Dn!=ba&&"constructor"in r&&"constructor"in e&&!(typeof Dn=="function"&&Dn instanceof Dn&&typeof ba=="function"&&ba instanceof ba)&&(C=!1)}return o.delete(r),o.delete(e),C}function db(r){return FR(r,KR,qR)}function Ld(r,e){var t=r.__data__;return jR(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Ai(r,e){var t=$E(r,e);return LR(t)?t:void 0}function NR(r){var e=tt.call(r,vr),t=r[vr];try{r[vr]=void 0;var i=!0}catch{}var n=Cb.call(r);return i&&(e?r[vr]=t:delete r[vr]),n}var qR=sb?function(r){return r==null?[]:(r=Object(r),jE(sb(r),function(e){return Ib.call(r,e)}))}:XR,Mt=Ss;(zc&&Mt(new zc(new ArrayBuffer(1)))!=Td||ys&&Mt(new ys)!=wd||Jc&&Mt(Jc.resolve())!=Yy||$c&&Mt(new $c)!=xd||Kc&&Mt(new Kc)!=Vc)&&(Mt=function(r){var e=Ss(r),t=e==xi?r.constructor:void 0,i=t?kr(t):"";if(i)switch(i){case nR:return Td;case sR:return wd;case oR:return Yy;case aR:return xd;case dR:return Vc}return e});function HR(r,e){return e=e??ub,!!e&&(typeof r=="number"||qE.test(r))&&r>-1&&r%1==0&&r<e}function jR(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function WR(r){return!!rb&&rb in r}function GR(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||Fd;return r===t}function VR(r){return Cb.call(r)}function kr(r){if(r!=null){try{return Pb.call(r)}catch{}try{return r+""}catch{}}return""}function Tb(r,e){return r===e||r!==r&&e!==e}var zR=ab(function(){return arguments}())?ab:function(r){return ks(r)&&tt.call(r,"callee")&&!Ib.call(r,"callee")},Rd=Array.isArray;function JR(r){return r!=null&&Eb(r.length)&&!Ab(r)}var Xc=rR||ZR;function $R(r,e){return wb(r,e)}function Ab(r){if(!Rb(r))return!1;var e=Ss(r);return e==fb||e==IE||e==CE||e==xE}function Eb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=ub}function Rb(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function ks(r){return r!=null&&typeof r=="object"}var Ob=tb?zE(tb):UR;function KR(r){return JR(r)?OR(r):BR(r)}function XR(){return[]}function ZR(){return!1}Ti.exports=$R});var fS=h(Kd=>{"use strict";Kd.byteLength=IO;Kd.toByteArray=xO;Kd.fromByteArray=EO;var nt=[],Ne=[],CO=typeof Uint8Array<"u"?Uint8Array:Array,Em="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ur=0,mS=Em.length;Ur<mS;++Ur)nt[Ur]=Em[Ur],Ne[Em.charCodeAt(Ur)]=Ur;var Ur,mS;Ne[45]=62;Ne[95]=63;function pS(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function IO(r){var e=pS(r),t=e[0],i=e[1];return(t+i)*3/4-i}function wO(r,e,t){return(e+t)*3/4-t}function xO(r){var e,t=pS(r),i=t[0],n=t[1],o=new CO(wO(r,i,n)),a=0,c=n>0?i-4:i,p;for(p=0;p<c;p+=4)e=Ne[r.charCodeAt(p)]<<18|Ne[r.charCodeAt(p+1)]<<12|Ne[r.charCodeAt(p+2)]<<6|Ne[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=Ne[r.charCodeAt(p)]<<2|Ne[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=Ne[r.charCodeAt(p)]<<10|Ne[r.charCodeAt(p+1)]<<4|Ne[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function TO(r){return nt[r>>18&63]+nt[r>>12&63]+nt[r>>6&63]+nt[r&63]}function AO(r,e,t){for(var i,n=[],o=e;o<t;o+=3)i=(r[o]<<16&16711680)+(r[o+1]<<8&65280)+(r[o+2]&255),n.push(TO(i));return n.join("")}function EO(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,c=t-i;a<c;a+=o)n.push(AO(r,a,a+o>c?c:a+o));return i===1?(e=r[t-1],n.push(nt[e>>2]+nt[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(nt[e>>10]+nt[e>>4&63]+nt[e<<2&63]+"=")),n.join("")}});var $H=_n(Fv(),1);function g(r,e){if(r==null)throw Error(e??"Expected nonnullish value.")}function lr(r,e){if(!r)throw Error(e)}var re;(function(r){r.COMMENT="t1_",r.ACCOUNT="t2_",r.LINK="t3_",r.MESSAGE="t4_",r.SUBREDDIT="t5_",r.AWARD="t6_"})(re||(re={}));function wt(r){return r.startsWith(re.COMMENT)}function ld(r){return r.startsWith(re.ACCOUNT)}function ur(r){return r.startsWith(re.LINK)}function Mv(r){return r.startsWith(re.MESSAGE)}function Lv(r){return r.startsWith(re.SUBREDDIT)}function Uv(r){return r.startsWith(re.AWARD)}function jA(r){lr(wt(r),`Expected comment id to start with ${re.COMMENT}, got ${r}}`)}function WA(r){lr(ld(r),`Expected account id to start with ${re.ACCOUNT}, got ${r}}`)}function GA(r){lr(ur(r),`Expected link id to start with ${re.LINK}, got ${r}}`)}function VA(r){lr(Mv(r),`Expected message id to start with ${re.MESSAGE}, got ${r}}`)}function zA(r){lr(Lv(r),`Expected subreddit id to start with ${re.SUBREDDIT}, got ${r}}`)}function JA(r){lr(Uv(r),`Expected award id to start with ${re.AWARD}, got ${r}}`)}function ri(r){return jA(r),r}function ie(r){return WA(r),r}function fe(r){return GA(r),r}function $A(r){return VA(r),r}function Re(r){return zA(r),r}function KA(r){return JA(r),r}function ge(r){if(wt(r))return ri(r);if(ld(r))return ie(r);if(ur(r))return fe(r);if(Mv(r))return $A(r);if(Lv(r))return Re(r);if(Uv(r))return KA(r);throw new Error(`Expected thing id to start with ${Object.values(re).join(", ")} got ${r}}`)}function mc(r){return wt(r)}import*as P from"@devvit/protos";var ud=class{constructor(e){}};var pc=(t=>(t.Installation="installation",t.App="app",t))(pc||{});function cr(r,e=new Set){for(let t of r){if(t.type==="group"){cr(t.fields,e);continue}let i=t.name;if(e.has(i))throw new Error(`Duplicate field name: ${i}`);e.add(i)}XA(r)}function XA(r){for(let e of r)if(e.type==="string"&&e.isSecret&&e.scope!=="app")throw`Invalid setting: only app settings can be secrets. Add "scope: SettingScope.App" to field "${e.name}"`}var xt=Object.freeze({INTERVAL:0,FORM:1,STATE:2,CHANNEL:3});var hL=["activity","add-emoji","add","add-media","add-to-feed","admin","align-center","align-left","align-right","all","appearance","approve","archived","aspect-ratio","aspect-rectangle","attach","audio","author","avatar-style","award","back","ban","best","binoculars","block","blockchain","bold","bot","boost","bounce","brand-awareness","browse","browser","cake","calendar","camera","caret-down","caret-left","caret-right","caret-up","chat","chat-group","chat-new","checkbox-dismiss","checkbox","checkmark","chrome","clear","close","closed-captioning","code-block","code-inline","coins-color-old","coins-color","coins","collapse-left","collapse-right","collection","comment","comments","community","contest","controversial","crop","crosspost","crowd-control","custom-feed","customize","day","delete","discover","dismiss-all","distinguish","down-arrow","down","download","downvote","downvotes","drag","drugs","duplicate","edit","effect","embed","emoji","end-live-chat","error","expand-left","expand-right","external","feed-video","filter","format","forward","gif-post","heart","help","hide","history","home","hot","ignore-reports","image-post","inbox","info","invite","italic","join","joined","jump-down","jump-up","karma","keyboard","kick","language","leave","left","link","link-post","list-bulleted","list-numbered","live-chat","live","load","location","lock","logout","loop","mark-read","mask","media-gallery","meme","menu","message","mic","mic-mute","mod","mod-mail","mod-mode","mod-mute","mod-overflow","mod-queue","mod-unmute","music","new","night","notification","notification-frequent","notification-off","nsfw","nsfw-language","nsfw-violence","original","overflow-caret","overflow-horizontal","overflow-vertical","pause","payment","peace","pending-posts","phone","pin","planet","play","poll-post","popular","posts","powerup-color-outline","powerup-fill-color","powerup","predictions","premium","privacy","profile","qa","qr-code","quarantined","quote","r-slash","radio-button","raise-hand","random","ratings-everyone","ratings-mature","ratings-nsfw","ratings-violence","refresh","remove","reply","report","reverse","right","rising","rotate","rotate-image","rpan","rules","safari","save","saved","search","self","send","settings","share-android","share","share-ios","show","side-menu","skipback10","skipforward10","sort-az","sort","sort-price","sort-za","spam","spoiler","sponsored","star","statistics","status-live","sticker","strikethrough","subtract","superscript","swap-camera","swipe-back","swipe-down","swipe","swipe-up","table","tag","tap","telescope","text","text-post","text-size","toggle","tools","top","topic-activism","topic-addictionsupport","topic-advice","topic-animals","topic-anime","topic-art","topic-beauty","topic-business","topic-careers","topic-cars","topic-celebrity","topic-craftsdiy","topic-crypto","topic-culture","topic-diy","topic-entertainment","topic-ethics","topic-family","topic-fashion","topic","topic-fitness","topic-food","topic-funny","topic-gender","topic-health","topic-help","topic-history","topic-hobbies","topic-homegarden","topic-internet","topic-law","topic-learning","topic-lifestyle","topic-marketplace","topic-mature","topic-mensfashion","topic-menshealth","topic-meta","topic-military","topic-movies","topic-music","topic-news","topic-other","topic-outdoors","topic-pets","topic-photography","topic-places","topic-podcasts","topic-politics","topic-programming","topic-reading","topic-religion","topic-science","topic-sexorientation","topic-sports","topic-style","topic-tabletop","topic-technology","topic-television","topic-traumasupport","topic-travel","topic-videogaming","topic-womensfashion","topic-womenshealth","translate","trim","u-slash","unban","undo","unheart","unlock","unmod","unpin","unverified","up-arrow","up","upload","upvote","upvotes","user","user-note","users","vault","verified","video-camera","video-feed","video-live-1","video-live-fill-1","video-live","video-post","video-thread","video-transcription","view-card","view-classic","view-compact","view-grid","views","volume","volume-mute","wallet","warning","wiki-ban","wiki","wiki-unban","world"];import{AppSettingsDefinition as m0,GetFieldsResponse as p0}from"@devvit/protos";import{FormField as mr,FormFieldType as Oe}from"@devvit/protos";function ut(r){return r.map(e=>{switch(e.type){case"string":return ZA(e);case"image":return YA(e);case"paragraph":return QA(e);case"number":return e0(e);case"select":return t0(e);case"boolean":return r0(e);case"group":return i0(e);default:throw new Error("Unknown field type.")}})}function ZA(r){return mr.fromPartial({defaultValue:{fieldType:Oe.STRING,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{stringConfig:{placeholder:r.placeholder}},fieldId:r.name,fieldType:Oe.STRING,helpText:r.helpText,label:r.label,required:r.required,isSecret:r.isSecret})}function YA(r){return mr.fromPartial({disabled:r.disabled,fieldId:r.name,fieldType:Oe.IMAGE,helpText:r.helpText,label:r.label,required:r.required})}function QA(r){return mr.fromPartial({defaultValue:{fieldType:Oe.PARAGRAPH,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{paragraphConfig:{lineHeight:r.lineHeight,placeholder:r.placeholder}},fieldId:r.name,fieldType:Oe.PARAGRAPH,helpText:r.helpText,label:r.label,required:r.required})}function e0(r){return mr.fromPartial({defaultValue:{fieldType:Oe.NUMBER,numberValue:r.defaultValue},disabled:r.disabled,fieldConfig:{numberConfig:{}},fieldId:r.name,fieldType:Oe.NUMBER,helpText:r.helpText,label:r.label,required:r.required})}function t0(r){return mr.fromPartial({defaultValue:{fieldType:Oe.SELECTION,selectionValue:{values:r.defaultValue}},disabled:r.disabled,fieldConfig:{selectionConfig:{choices:r.options,multiSelect:r.multiSelect}},fieldId:r.name,fieldType:Oe.SELECTION,helpText:r.helpText,label:r.label,required:r.required})}function r0(r){return mr.fromPartial({defaultValue:{fieldType:Oe.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Oe.BOOLEAN,helpText:r.helpText,label:r.label})}function i0(r){return mr.fromPartial({fieldType:Oe.GROUP,fieldConfig:{groupConfig:{fields:ut(r.fields)}},label:r.label,helpText:r.helpText})}function U(r,e){u.prototype[r]=e}import{ValidateFormResponse as c0}from"@devvit/protos";import{RealtimeSubscriptionStatus as Dv}from"@devvit/protos";var D=Object.freeze({Actor:"devvit-actor",App:"devvit-app",AppUser:"devvit-app-user",AppViewerAuthToken:"devvit-app-viewer-authorization",Caller:"devvit-caller",CallerPortID:"devvit-caller-port-id",Canary:"devvit-canary",Debug:"devvit-debug",GQLHost:"devvit-gql-host",Installation:"devvit-installation",ModPermissions:"devvit-mod-permissions",R2Auth:"devvit-sec-authorization",R2Host:"devvit-r2-host",RemoteHostname:"devvit-remote-hostname",SettingsUri:"devvit-sec-settings-uri",StreamID:"devvit-stream-id",Subreddit:"devvit-subreddit",TraceID:"devvit-trace-id",User:"devvit-user",Version:"devvit-version",Language:"devvit-accept-language",Timezone:"devvit-accept-timezone",AppDependencies:"devvit-app-dependencies",WebviewTemplate:"devvit-webview-template"}),Bv;(function(r){r.Blocks="blocks",r.EmitSnapshots="emitSnapshots",r.EmitState="emitState",r.Realtime="realtime",r.Runtime="runtime",r.Surface="surface",r.UseAsync="useAsync",r.Payments="payments"})(Bv||(Bv={}));function _v(r){function e(t){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=r.metadata[D.App]?.values[0];g(c,"useChannel - app is missing from Context");let p=r.metadata[D.Installation]?.values[0];g(p,"useChannel - installation is missing from Context");async function f(T){let M=o[n].channel;if(o[n].active)if(o[n].connected)await r.realtime.send(M,T);else throw Error(`Failed to send to channel '${M}'; it is active but not yet connected`);else throw Error(`Cannot send a message over inactive channel: ${M}`)}function v(){if(!o[n].active){let T=o[n].channel;o[n].active=!0,r.addRealtimeChannel(T)}}function m(){if(o[n].active){let T=o[n].channel;o[n].active=!1,r.removeRealtimeChannel(T)}}function b(T){return async()=>{let M;switch(T.status){case Dv.REALTIME_SUBSCRIBED:o[n].connected=!0,M=t.onSubscribed?.();break;case Dv.REALTIME_UNSUBSCRIBED:o[n].connected=!1,M=t.onUnsubscribed?.();break;default:M=t.onMessage(T.event?.data??{});break}await M}}let y={channel:`${c}:${p}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:xt.CHANNEL};n in o?y=o[n]:n in a&&(y=a[n]);let C=r.realtimeEvent;r.isInitialRender?y.active=!1:C&&y.active&&C.event.channel===y.channel&&(y.preventCallback||r.runHook(b(C)),r.rerenderIn(0)),o[n]=y,r.currentHookIndex++;let I=0;return y.active&&y.connected?I=2:y.active&&!y.connected?I=1:!y.active&&y.connected?I=3:!y.active&&!y.connected&&(I=4),{subscribe:v,unsubscribe:m,send:f,status:I}}return e}import{FormFieldType as ii}from"@devvit/protos";function fc(r){switch(r.fieldType){case ii.STRING:return r.stringValue;case ii.IMAGE:return r.stringValue;case ii.PARAGRAPH:return r.stringValue;case ii.NUMBER:return r.numberValue;case ii.BOOLEAN:return r.boolValue;case ii.SELECTION:return r.selectionValue?.values??[];default:return}}function Tt(r){return Object.keys(r).reduce((e,t)=>{let i=fc(r[t]);return i!==void 0&&(e[t]=i),e},{})}function Nv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentKey(),a=r.getCurrentComponentState(),c=r.getPreviousComponentState(),p=`form.hook.${o}.${n}`,f={formKey:p,preventSubmit:!1,type:xt.FORM};n in a?f=a[n]:n in c&&(f=c[n]),a[n]=f,r.forms.set(p,t);let v=r.formSubmittedEvent;return v&&!f.preventSubmit&&v.formId===p&&r.runHook(async()=>{let m=i(Tt(v.results));m&&m instanceof Promise&&await m,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function qv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=100,p=Math.max(c,i),f={lastRun:void 0,running:!1,preventCallback:!1,type:xt.INTERVAL};n in o?f=o[n]:n in a&&(f=a[n]);function v(){i<c&&console.error(`useInterval delay must be at least ${c}ms. Your interval of ${i}ms was automatically extended.`);for(let[b,y]of Object.entries(o))if(b!==n.toString()&&y?.type===xt.INTERVAL&&y?.running)throw new Error("Only one useInterval hook may be running at a time");o[n]={running:!0,lastRun:o[n]?.lastRun??Date.now(),preventCallback:!1,type:xt.INTERVAL},r.rerenderIn(p)}function m(){o[n].running=!1,o[n].lastRun=void 0,o[n].preventCallback=!1}return r.isEffectRender&&f.running&&(f.preventCallback||(f.lastRun===void 0||f.lastRun+p<Date.now())&&r.runHook(async()=>{let b=t();b&&b instanceof Promise&&await b,f.lastRun=Date.now()}),r.rerenderIn(p)),f.preventCallback=!1,o[n]=f,r.currentHookIndex++,{start:v,stop:m}}return e}function Hv(r){function e(t){let i=r.currentHookIndex,n=r.getCurrentComponentState(),o=r.getPreviousComponentState();if(i in n)return r.currentHookIndex++,[n[i],a];if(r.isInitialRender||!(i in o)){let c=t instanceof Function?t():t;if(c instanceof Promise)throw(async()=>{n[i]=await c,r.currentHookIndex=0})();n[i]=c}else n[i]=o[i];function a(c){if(r.isRendering)throw new Error("Cannot call setState while rendering.");n[i]=c instanceof Function?c(n[i]):c}return r.currentHookIndex++,[n[i],a]}return e}var yc={now(){return new Date}};function jv(r){return`__autocache__${r}`}function Wv(r){return`__lock__${r}`}var s0=300,o0=1e3,cd=5e3,gc=3,Gv=.1,Vv=1e3,a0=3e4;function zv(r){if(r.error)throw new Error(r.error);return r.value}var At,Et,Fe,ni,J,Jv,$v,Kv,hc,Xv,Zv,vc,Yv,md=class{constructor(e,t,i=yc){l(this,J);l(this,At);l(this,Et,{});l(this,Fe);l(this,ni);d(this,At,e),d(this,ni,t),d(this,Fe,i)}async cache(e,t){d(this,Et,s(this,ni).__cache=s(this,ni).__cache??{}),S(this,J,Yv).call(this,t);let i=S(this,J,Jv).call(this,t.key);if(i!==void 0)return i;let n=await S(this,J,vc).call(this,t.key),o=await S(this,J,$v).call(this,t,n,e);return zv(o)}};At=new WeakMap,Et=new WeakMap,Fe=new WeakMap,ni=new WeakMap,J=new WeakSet,Jv=function(e){let t=s(this,Et)[e];if(t){let i=s(this,Fe).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<gc&&Math.random()<Gv&&t.errorTime+Vv<i;if(t?.expires&&t.expires<i&&t.checkedAt+Vv<i||n){delete s(this,Et)[e];return}else return zv(t)}},$v=async function(e,t,i){let n=t?.expires,o=n?S(this,J,Zv).call(this,n):1;return!t||t?.error&&t.errorCount<gc&&Gv>Math.random()||o>Math.random()?S(this,J,Kv).call(this,e,t,i):t},Kv=async function(e,t,i){let n=Wv(e.key),o=s(this,Fe).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,At).set(n,"1",{expiration:a,nx:!0}))return S(this,J,Xv).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Fe).now();return S(this,J,hc).call(this,p,e.key,e.ttl)}},hc=async function(e,t,i){let n=Math.min(i,o0),o=await S(this,J,vc).call(this,t);if(o)return o;if(s(this,Fe).now().getTime()-e.getTime()>=n)throw new Error(`Cache request timed out trying to get data at key: ${t}`);return await new Promise(a=>setTimeout(a,s0)),S(this,J,hc).call(this,e,t,i)},Xv=async function(e,t,i,n){let o=s(this,Fe).now().getTime()+n;t=t??{value:null,expires:o,errorCount:0,error:null,errorTime:null,checkedAt:0};try{t.value=await i(),t.error=null,t.errorCount=0,t.errorTime=null}catch(a){t.value=null,t.error=a.message??"Unknown error",t.errorTime=s(this,Fe).now().getTime(),t.errorCount++}return s(this,Et)[e]=t,await s(this,At).set(jv(e),JSON.stringify(t),{expiration:new Date(o+a0)}),t.error&&t.errorCount<gc&&await s(this,At).del(Wv(e)),t},Zv=function(e){let t=s(this,Fe).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},vc=async function(e){let t=await s(this,At).get(jv(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Fe).now().getTime(),s(this,Et)[e]=i,i}},Yv=function(e){e.ttl<cd&&(console.warn(`Cache TTL cannot be less than ${cd} milliseconds! Updating ttl value of ${e.ttl} to ${cd}.`),e.ttl=cd)};function Qv(r,e,t=yc){let i=new md(r,e,t);return i.cache.bind(i)}function ey(r){new URL(r.slice(0,r.indexOf(",")))}var si,oi,di,ty,ry,ai=class{constructor(){l(this,di);l(this,si,{});l(this,oi,{});d(this,si,u.assets),d(this,oi,u.webviewAssets)}getURL(e,t){return typeof e=="string"?S(this,di,ty).call(this,e,t??{webview:!1}):S(this,di,ry).call(this,e,t??{webview:!1})}};si=new WeakMap,oi=new WeakMap,di=new WeakSet,ty=function(e,t){let i=t.webview?s(this,oi)[e]:s(this,si)[e];if(i)return i;try{return ey(e),encodeURI(e)}catch{return""}},ry=function(e,t){let i={},n=[],o=t.webview?s(this,oi):s(this,si);if(o)for(let a of e)if(o[a])i[a]=o[a];else try{ey(a),i[a]=encodeURI(a)}catch{n.push(a)}else n=e;if(n.length>0)throw new Error(`The following assets were missing from the assets list: ${n.join(", ")}`);return i};var Rt,li=class{constructor(e){l(this,Rt);d(this,Rt,e)}async get(e){let{messages:t}=await u.kvStorePlugin.Get({keys:[e]},s(this,Rt));try{if(t[e])return JSON.parse(t[e])}catch{return}}async put(e,t){let i={};i[e]=JSON.stringify(t),await u.kvStorePlugin.Put({messages:i},s(this,Rt))}async delete(e){await u.kvStorePlugin.Del({keys:[e]},s(this,Rt))}async list(){let{keys:e}=await u.kvStorePlugin.List({filter:"*"},s(this,Rt));return e}};Rt=new WeakMap;var os,ui=class{constructor(e){l(this,os);d(this,os,e)}async upload(e){let t=await u.mediaPlugin.Upload(e,s(this,os));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};os=new WeakMap;var as,ci=class{constructor(e){l(this,as);d(this,as,e)}async add(e){await u.modLogPlugin.Add(e,s(this,as))}};as=new WeakMap;var ds,mi=class{constructor(e){l(this,ds);d(this,ds,e)}async send(e,t){await u.realtimePlugin.Send({channel:e,data:t},s(this,ds))}};ds=new WeakMap;var k,ls,fi=class{constructor(e){l(this,k);l(this,ls);d(this,k,e),d(this,ls,new fd(e))}get modMail(){return s(this,ls)}getSubredditById(e){return he.getById(ge(e),s(this,k))}getSubredditByName(e){return he.getByName(e,s(this,k))}addSubredditRemovalReason(e,t){return he.addRemovalReason(e,t.title,t.message,s(this,k))}getSubredditRemovalReasons(e){return he.getRemovalReasons(e,s(this,k))}getCurrentSubreddit(){return he.getFromMetadata(s(this,k))}getPostById(e){return V.getById(ge(e),s(this,k))}submitPost(e){return V.submit(e,s(this,k))}crosspost(e){return V.crosspost(e,s(this,k))}getUserById(e){return w.getById(ge(e),s(this,k))}getCollectionById(e){return pi.getCollectionById({collectionId:e},s(this,k))}createCollection(e){return pi.create(e,s(this,k))}getCollectionsForSubreddit(e){return pi.getCollectionsForSubreddit({subredditId:e},s(this,k))}getUserByUsername(e){return w.getByUsername(e,s(this,k))}getCurrentUser(){return w.getFromMetadata(D.User,s(this,k))}getAppUser(){return w.getFromMetadata(D.AppUser,s(this,k))}getSnoovatarUrl(e){return w.getSnoovatarUrl(e,s(this,k))}getCommentById(e){return Y.getById(ge(e),s(this,k))}getComments(e){return Y.getComments(e,s(this,k))}getCommentsByUser(e){return Y.getCommentsByUser(e,s(this,k))}submitComment(e){return Y.submit({...e,id:ge(e.id)},s(this,k))}getControversialPosts(e){return V.getControversialPosts(e,s(this,k))}getTopPosts(e){return V.getTopPosts(e,s(this,k))}getHotPosts(e){return V.getHotPosts(e,s(this,k))}getNewPosts(e){return V.getNewPosts(e,s(this,k))}getRisingPosts(e){return V.getRisingPosts(e,s(this,k))}getPostsByUser(e){return V.getPostsByUser(e,s(this,k))}getCommentsAndPostsByUser(e){return w.getOverview(e,s(this,k))}getModerationLog(e){return pd(e,s(this,k))}getApprovedUsers(e){return w.getSubredditUsersByType({type:"contributors",...e},s(this,k))}approveUser(e,t){return w.createRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}removeUser(e,t){return w.removeRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}getWikiContributors(e){return w.getSubredditUsersByType({type:"wikicontributors",...e},s(this,k))}addWikiContributor(e,t){return w.createRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}removeWikiContributor(e,t){return w.removeRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}getBannedUsers(e){return w.getSubredditUsersByType({type:"banned",...e},s(this,k))}banUser(e){return w.createRelationship({username:e.username,subredditName:e.subredditName,type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,k))}unbanUser(e,t){return w.removeRelationship({username:e,subredditName:t,type:"banned"},s(this,k))}getBannedWikiContributors(e){return w.getSubredditUsersByType({type:"wikibanned",...e},s(this,k))}banWikiContributor(e){return w.createRelationship({...e,type:"wikibanned"},s(this,k))}unbanWikiContributor(e,t){return w.removeRelationship({username:e,subredditName:t,type:"wikibanned"},s(this,k))}getModerators(e){return w.getSubredditUsersByType({type:"moderators",...e},s(this,k))}inviteModerator(e){return w.createRelationship({type:"moderator_invite",subredditName:e.subredditName,username:e.subredditName,permissions:e.permissions??[]},s(this,k))}revokeModeratorInvite(e,t){return w.removeRelationship({username:e,subredditName:t,type:"moderator_invite"},s(this,k))}removeModerator(e,t){return w.removeRelationship({type:"moderator",subredditName:t,username:e},s(this,k))}setModeratorPermissions(e,t,i){return w.setModeratorPermissions(e,t,i,s(this,k))}getMutedUsers(e){return w.getSubredditUsersByType({type:"muted",...e},s(this,k))}muteUser(e){return w.createRelationship({...e,type:"muted"},s(this,k))}unmuteUser(e,t){return w.removeRelationship({username:e,subredditName:t,type:"muted"},s(this,k))}getModNotes(e){return Me.get(e,s(this,k))}deleteModNote(e){return Me.delete(e,s(this,k))}addModNote(e){let t={...e,redditId:e.redditId?ge(e.redditId):void 0};return Me.add(t,s(this,k))}addRemovalNote(e){return Me.addRemovalNote(e,s(this,k))}async sendPrivateMessage(e){return pr.send(e,s(this,k))}async sendPrivateMessageAsSubreddit(e){return pr.sendAsSubreddit(e,s(this,k))}async approve(e){if(wt(e))return Y.approve(e,s(this,k));if(ur(e))return V.approve(e,s(this,k));throw new Error("id must start with either t1_ or t3_")}async remove(e,t){if(wt(e))return Y.remove(e,t,s(this,k));if(ur(e))return V.remove(e,t,s(this,k));throw new Error("id must start with either t1_ or t3_")}async getPostFlairTemplates(e){return ae.getPostFlairTemplates(e,s(this,k))}async getUserFlairTemplates(e){return ae.getUserFlairTemplates(e,s(this,k))}async createPostFlairTemplate(e){return ae.createPostFlairTemplate(e,s(this,k))}async createUserFlairTemplate(e){return ae.createUserFlairTemplate(e,s(this,k))}async editFlairTemplate(e){return ae.editFlairTemplate(e,s(this,k))}async deleteFlairTemplate(e,t){return ae.deleteFlairTemplate(e,t,s(this,k))}async setUserFlair(e){return Le.setUserFlair(e,s(this,k))}async removeUserFlair(e,t){return Le.removeUserFlair(e,t,s(this,k))}async setPostFlair(e){return Le.setPostFlair(e,s(this,k))}async removePostFlair(e,t){return Le.removePostFlair(e,fe(t),s(this,k))}async getWidgets(e){return ne.getWidgets(e,s(this,k))}async deleteWidget(e,t){return ne.delete(e,t,s(this,k))}async addWidget(e){return ne.add(e,s(this,k))}async reorderWidgets(e,t){return ne.reorder(e,t,s(this,k))}async getWikiPage(e,t){return ve.getPage(e,t,s(this,k))}async getWikiPages(e){return ve.getPages(e,s(this,k))}async createWikiPage(e){return ve.createPage(e,s(this,k))}async updateWikiPage(e){return ve.updatePage(e,s(this,k))}getWikiPageRevisions(e){return ve.getPageRevisions(e,s(this,k))}async revertWikiPage(e,t,i){return ve.revertPage(e,t,i,s(this,k))}async getWikiPageSettings(e,t){return ve.getPageSettings(e,t,s(this,k))}async updateWikiPageSettings(e){return ve.updatePageSettings(e,s(this,k))}async addEditorToWikiPage(e,t,i){return ve.addEditor(e,t,i,s(this,k))}async removeEditorFromWikiPage(e,t,i){return ve.removeEditor(e,t,i,s(this,k))}getMessages(e){return pr.getMessages(e,s(this,k))}markAllMessagesAsRead(){return pr.markAllAsRead(s(this,k))}report(e,t){return u.redditAPIPlugins.LinksAndComments.Report({reason:t.reason,thingId:e.id,srName:e.subredditName,usernames:e.authorName},s(this,k))}getModQueue(e){return he.aboutLocation({...e,location:"modqueue"},s(this,k))}getReports(e){return he.aboutLocation({...e,location:"reports"},s(this,k))}getSpam(e){return he.aboutLocation({...e,location:"spam"},s(this,k))}getUnmoderated(e){return he.aboutLocation({...e,location:"unmoderated"},s(this,k))}getEdited(e){return he.aboutLocation({...e,location:"edited"},s(this,k))}getVaultByAddress(e){return sy(e,s(this,k))}getVaultByUserId(e){return oy(ge(e),s(this,k))}getSubredditLeaderboard(e){return ny(e,s(this,k))}};k=new WeakMap,ls=new WeakMap;import{RedisKeyScope as bc}from"@devvit/protos";var R,O,F,kc=class{constructor(e,t,i){l(this,R);l(this,O);l(this,F);d(this,R,e),d(this,O,t),d(this,F,i)}async get(e){return await s(this,R).Get({key:e,transactionId:s(this,O)},s(this,F)),this}async multi(){await s(this,R).Multi(s(this,O),s(this,F))}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),await s(this,R).Set({key:e,value:t,nx:i?.nx===!0,xx:i?.xx===!0,expiration:n||0,transactionId:s(this,O)},s(this,F)),this}async del(...e){return await s(this,R).Del({keys:e,transactionId:s(this,O)},s(this,F)),this}async type(e){return await s(this,R).Type({key:e,transactionId:s(this,O)},s(this,F)),this}async exec(){let e=await s(this,R).Exec(s(this,O),s(this,F)),t=[];for(let i of e.response)i.members?t.push(i.members):i.nil!==void 0?t.push(null):i.num!==void 0?t.push(i.num):i.values!==void 0?t.push(i.values.values):i.str!==void 0&&t.push(i.str);return t}async discard(){await s(this,R).Discard(s(this,O),s(this,F))}async watch(...e){return await s(this,R).Watch({keys:e,transactionId:s(this,O)},s(this,F)),this}async unwatch(){return await s(this,R).Unwatch(s(this,O),s(this,F)),this}async getRange(e,t,i){return await s(this,R).GetRange({key:e,start:t,end:i,transactionId:s(this,O)},s(this,F)),this}async setRange(e,t,i){return await s(this,R).SetRange({key:e,offset:t,value:i,transactionId:s(this,O)},s(this,F)),this}async strlen(e){return this.strLen(e)}async strLen(e){return await s(this,R).Strlen({key:e,transactionId:s(this,O)},s(this,F)),this}async mget(e){return this.mGet(e)}async mGet(e){return await s(this,R).MGet({keys:e,transactionId:s(this,O)},s(this,F)),this}async mset(e){return this.mSet(e)}async mSet(e){let t=Object.entries(e).map(([i,n])=>({key:i,value:n}));return await s(this,R).MSet({kv:t,transactionId:s(this,O)},s(this,F)),this}async incrBy(e,t){return await s(this,R).IncrBy({key:e,value:t,transactionId:s(this,O)},s(this,F)),this}async expire(e,t){return await s(this,R).Expire({key:e,seconds:t,transactionId:s(this,O)},s(this,F)),this}async expireTime(e){return await s(this,R).ExpireTime({key:e,transactionId:s(this,O)},s(this,F)),this}async zAdd(e,...t){return await s(this,R).ZAdd({key:e,members:t,transactionId:s(this,O)},s(this,F)),this}async zScore(e,t){return await s(this,R).ZScore({key:{key:e,transactionId:s(this,O)},member:t},s(this,F)),this}async zRank(e,t){return await s(this,R).ZRank({key:{key:e,transactionId:s(this,O)},member:t},s(this,F)),this}async zIncrBy(e,t,i){return await s(this,R).ZIncrBy({key:e,member:t,value:i,transactionId:s(this,O)},s(this,F)),this}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,O)};return await s(this,R).ZScan(o,s(this,F)),this}async zCard(e){return await s(this,R).ZCard({key:e,transactionId:s(this,O)},s(this,F)),this}async zRange(e,t,i,n){let o={rev:!1,byLex:!1,byScore:!1,offset:0,count:1e3};return n?.reverse&&(o.rev=n.reverse),n?.by==="lex"?o.byLex=!0:n?.by==="score"&&(o.byScore=!0),await s(this,R).ZRange({key:{key:e,transactionId:s(this,O)},start:t+"",stop:i+"",...o},s(this,F)),this}async zRem(e,t){return await s(this,R).ZRem({key:{key:e,transactionId:s(this,O)},members:t},s(this,F)),this}async zRemRangeByLex(e,t,i){return await s(this,R).ZRemRangeByLex({key:{key:e,transactionId:s(this,O)},min:t,max:i},s(this,F)),this}async zRemRangeByRank(e,t,i){return await s(this,R).ZRemRangeByRank({key:{key:e,transactionId:s(this,O)},start:t,stop:i},s(this,F)),this}async zRemRangeByScore(e,t,i){return await s(this,R).ZRemRangeByScore({key:{key:e,transactionId:s(this,O)},min:t,max:i},s(this,F)),this}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){return await s(this,R).HGetAll({key:e,transactionId:s(this,O)},s(this,F)),this}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){return await s(this,R).HGet({key:e,field:t,transactionId:s(this,O)},s(this,F)),this}async hset(e,t){return this.hSet(e,t)}async hSet(e,t){let i=Object.entries(t).map(([n,o])=>({field:n,value:o}));return await s(this,R).HSet({key:e,fv:i,transactionId:s(this,O)},s(this,F)),this}async hincrby(e,t,i){return this.hIncrBy(e,t,i)}async hIncrBy(e,t,i){return await s(this,R).HIncrBy({key:e,field:t,value:i,transactionId:s(this,O)},s(this,F)),this}async hdel(e,t){return this.hDel(e,t)}async hDel(e,t){return await s(this,R).HDel({key:e,fields:t,transactionId:s(this,O)},s(this,F)),this}async hscan(e,t,i,n){return this.hScan(e,t,i,n)}async hScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,O)};return await s(this,R).HScan(o,s(this,F)),this}async hkeys(e){return this.hKeys(e)}async hKeys(e){return await s(this,R).HKeys({key:e,transactionId:s(this,O)},s(this,F)),this}async hlen(e){return this.hLen(e)}async hLen(e){return await s(this,R).HLen({key:e,transactionId:s(this,O)},s(this,F)),this}};R=new WeakMap,O=new WeakMap,F=new WeakMap;var L,gi,Sc=class Sc{constructor(e,t=void 0,i=bc.INSTALLATION){l(this,L);l(this,gi);d(this,L,e),d(this,gi,t),this.scope=i,this.global=i===bc.INSTALLATION?new Sc(s(this,L),s(this,gi),bc.GLOBAL):this}get storage(){return s(this,gi)||u.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,L));return new kc(this.storage,t,s(this,L))}async get(e){let t=await this.storage.Get({key:e,scope:this.scope},s(this,L));return t!==null?t.value??void 0:t}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),(await this.storage.Set({key:e,value:t,nx:i?.nx===!0&&!i.xx,xx:i?.xx===!0&&!i.nx,expiration:n||0,scope:this.scope},s(this,L))).value}async del(...e){await this.storage.Del({keys:e,scope:this.scope},s(this,L))}async incrBy(e,t){return(await this.storage.IncrBy({key:e,value:t,scope:this.scope},s(this,L))).value}async getRange(e,t,i){let n=await this.storage.GetRange({key:e,start:t,end:i,scope:this.scope},s(this,L));return n!==null?n.value:n}async setRange(e,t,i){return(await this.storage.SetRange({key:e,offset:t,value:i,scope:this.scope},s(this,L))).value}async strlen(e){return this.strLen(e)}async strLen(e){return(await this.storage.Strlen({key:e,scope:this.scope},s(this,L))).value}async expire(e,t){await this.storage.Expire({key:e,seconds:t,scope:this.scope},s(this,L))}async expireTime(e){return(await this.storage.ExpireTime({key:e,scope:this.scope},s(this,L))).value}async zAdd(e,...t){return(await this.storage.ZAdd({key:e,members:t,scope:this.scope},s(this,L))).value}async zRange(e,t,i,n){let o={rev:!1,byLex:!1,byScore:!1,offset:0,count:1e3};return n?.reverse&&(o.rev=n.reverse),n?.by==="lex"?o.byLex=!0:n?.by==="score"?o.byScore=!0:(o.offset=0,o.count=0),(await this.storage.ZRange({key:{key:e},start:t+"",stop:i+"",...o,scope:this.scope},s(this,L))).members}async zRem(e,t){return(await this.storage.ZRem({key:{key:e},members:t,scope:this.scope},s(this,L))).value}async zRemRangeByLex(e,t,i){return(await this.storage.ZRemRangeByLex({key:{key:e},min:t,max:i,scope:this.scope},s(this,L))).value}async zRemRangeByRank(e,t,i){return(await this.storage.ZRemRangeByRank({key:{key:e},start:t,stop:i,scope:this.scope},s(this,L))).value}async zRemRangeByScore(e,t,i){return(await this.storage.ZRemRangeByScore({key:{key:e},min:t,max:i,scope:this.scope},s(this,L))).value}async zScore(e,t){let i=await this.storage.ZScore({key:{key:e},member:t,scope:this.scope},s(this,L));return i!==null?i.value:i}async zRank(e,t){let i=await this.storage.ZRank({key:{key:e},member:t,scope:this.scope},s(this,L));return i!==null?i.value:i}async zIncrBy(e,t,i){let n=await this.storage.ZIncrBy({key:e,member:t,value:i,scope:this.scope},s(this,L));return n!==null?n.value:n}async mget(e){return this.mGet(e)}async mGet(e){let t=await this.storage.MGet({keys:e,scope:this.scope},s(this,L));return t!==null?t.values.map(i=>i||null):t}async mset(e){return this.mSet(e)}async mSet(e){let t=Object.entries(e).map(([i,n])=>({key:i,value:n}));await this.storage.MSet({kv:t,scope:this.scope},s(this,L))}async zCard(e){let t=await this.storage.ZCard({key:e,scope:this.scope},s(this,L));return t!==null?t.value:t}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,scope:this.scope};return await this.storage.ZScan(o,s(this,L))}async type(e){let t=await this.storage.Type({key:e,scope:this.scope},s(this,L));return t!==null?t.value:t}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){let i=await this.storage.HGet({key:e,field:t,scope:this.scope},s(this,L));return i!==null?i.value??void 0:i}async hset(e,t){return this.hSet(e,t)}async hSet(e,t){let i=Object.entries(t).map(([o,a])=>({field:o,value:a}));return(await this.storage.HSet({key:e,fv:i,scope:this.scope},s(this,L))).value}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){let t=await this.storage.HGetAll({key:e,scope:this.scope},s(this,L));return t!==null?t.fieldValues:t}async hdel(e,t){return this.hDel(e,t)}async hDel(e,t){return(await this.storage.HDel({key:e,fields:t,scope:this.scope},s(this,L))).value}async hscan(e,t,i,n){return this.hScan(e,t,i,n)}async hScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,scope:this.scope};return await this.storage.HScan(o,s(this,L))}async hkeys(e){return this.hKeys(e)}async hKeys(e){let t=await this.storage.HKeys({key:e,scope:this.scope},s(this,L));return t!==null?t.keys:t}async hincrby(e,t,i){return this.hIncrBy(e,t,i)}async hIncrBy(e,t,i){return(await this.storage.HIncrBy({key:e,field:t,value:i,scope:this.scope},s(this,L))).value}async hlen(e){return this.hLen(e)}async hLen(e){return(await this.storage.HLen({key:e,scope:this.scope})).value}};L=new WeakMap,gi=new WeakMap;var hi=Sc;var fr,vi=class{constructor(e){l(this,fr);d(this,fr,e)}async runJob(e){return(await u.schedulerPlugin.Schedule({action:{type:e.name,data:e.data},cron:"cron"in e?e.cron:void 0,when:"runAt"in e?e.runAt:void 0},s(this,fr))).id}async cancelJob(e){await u.schedulerPlugin.Cancel({id:e},s(this,fr))}async listJobs(){return(await u.schedulerPlugin.List({after:new Date(0),before:new Date(Date.now()+31536e7)},s(this,fr))).actions.map(t=>(g(t.request?.action,"Scheduled job is malformed"),"when"in t.request&&t.request.when!=null?{id:t.id,name:t.request.action.type,runAt:t.request.when,data:t.request.action.data}:{id:t.id,name:t.request.action.type,cron:t.request.cron??"",data:t.request.action}))}};fr=new WeakMap;var us,yi=class{constructor(e){l(this,us);d(this,us,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await u.settingsPlugin.GetSettings({},s(this,us));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...ay(t.installationSettings.settings,u.installationSettings),...ay(t.appSettings.settings,u.appSettings)}}};us=new WeakMap;function ay(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=fc(r[n]),i),{});return e&&dy(t,e),t}function dy(r,e){for(let t of e)t.type==="group"?dy(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as Pc,Form as d0,ToastAppearance as ly}from"@devvit/protos";var gr,bi,gd=class{constructor(e){l(this,gr,[]);l(this,bi);d(this,bi,e)}showForm(e,t){let i=u.formDefinitions.get(e);if(!i&&s(this,bi)){let a=s(this,bi).forms.get(e);a&&(i={form:a,onSubmit:()=>{}})}if(!i)throw new Error("Form does not exist. Make sure you have added it using Devvit.createForm at the root of your app.");let n=i.form instanceof Function?i.form(t??{}):i.form,o=d0.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});cr(n.fields),o.fields=ut(n.fields),s(this,gr).push({type:Pc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?ly.SUCCESS:ly.NEUTRAL}:t={text:e},s(this,gr).push({type:Pc.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,gr).push({type:Pc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,gr)}};gr=new WeakMap,bi=new WeakMap;function Ue({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new ci(r),o=new li(r),a=new hi(r),c=Qv(a,i?i.state:{}),p=new fi(r),f=new vi(r),v=new yi(r),m=e?new gd(i):void 0,b=new ui(r),y=new ai,C=new mi(r),I=t&&i?Hv(i):void 0,T=t&&i?qv(i):void 0,M=t&&i?Nv(i):void 0,ue=t&&i?_v(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:f,settings:v,media:b,assets:y,realtime:C,get useForm(){return M??(()=>{throw new Error("useForm() is unavailable")})},get cache(){return c??(()=>{throw new Error("cache() is unavailable")})},get useState(){return I??(()=>{throw new Error("useState() is unavailable")})},get useInterval(){return T??(()=>{throw new Error("useInterval() is unavailable")})},get useChannel(){return ue??(()=>{throw new Error("useChannel() is unavailable")})},get ui(){if(!m)throw new Error("ui client is not available");return m}}}var uy={name:"@devvit/public-api",version:"0.11.0-dev",license:"BSD-3-Clause",repository:{type:"git",url:"https://developers.reddit.com/"},type:"module",exports:{".":"./dist/index.js","./package.json":"./package.json","./*":"./dist/*"},main:"./dist/index.js",files:["dist/**"],scripts:{build:"yarn build:icon-types && yarn build:semantic-colors && tsc && cp -af devvit.tsconfig.json dist/ && yarn build:types && yarn build:min && yarn build:unmin","build:icon-types":"make-icons src/types/icons.ts","build:min":"esbuild --bundle --sourcemap=linked --target=es2020 --format=esm --metafile=dist/meta.min.json --outfile=dist/public-api.min.js --external:@devvit/protos --minify src/index.ts","build:semantic-colors":"node scripts/make-semantic-colors.js","build:types":"api-extractor run && sed -ne '/declare global {/,$ p' src/devvit/Devvit.ts >> dist/public-api.d.ts","build:unmin":"esbuild --bundle --sourcemap=inline --target=es2020 --format=iife --metafile=dist/meta.json --outfile=dist/public-api.iife.js --global-name=devvitPublicAPI src/index.ts",clean:"rm -rf .turbo api-extractor coverage dist src/devvit/internals/semanticColors.ts src/types/icons.ts || :",clobber:"yarn clean && rm -rf node_modules",dev:"tsc -w","dev:build":"chokidar ./src --command 'yarn build' --ignore './src/types/icons.ts' --ignore './src/devvit/internals/semanticColors.ts'",lint:"redlint .","lint:fix":"yarn lint --fix",prepublishOnly:"publish-package-json",test:"yarn test:unit && yarn test:types && yarn test:size","test:size":"filesize","test:types":"tsc --noEmit","test:unit":"vitest run","test:unit-with-coverage":"vitest run --coverage"},types:"./dist/index.d.ts",dependencies:{"@devvit/protos":"0.11.0-dev","@devvit/shared-types":"0.11.0-dev","base64-js":"1.5.1","clone-deep":"4.0.1","core-js":"3.27.2","lodash.isequal":"4.5.0"},devDependencies:{"@ampproject/filesize":"4.3.0","@devvit/eslint-config":"0.11.0-dev","@devvit/repo-tools":"0.11.0-dev","@devvit/tsconfig":"0.11.0-dev","@microsoft/api-extractor":"7.41.0","@reddit/faceplate-ui":"11.3.3","@types/clone-deep":"4.0.1","@types/core-js":"2.5.6","@types/lodash.isequal":"4.5.6","@vitest/coverage-c8":"0.32.0","chokidar-cli":"3.0.0",esbuild:"0.23.0",eslint:"8.9.0",typescript:"5.3.2",vitest:"1.6.0"},publishConfig:{directory:"dist"},filesize:{"dist/public-api.min.js":{gzip:"78 KB",none:"255 KB"}},source:"./src/index.ts"};function de(r,e,t){let i=r[D.Subreddit]?.values[0];g(i,"subreddit is missing from Context");let n=r[D.AppUser]?.values[0],o=r[D.User]?.values[0],a=u0(r);return{get appAccountId(){return g(n,"appAccountId is missing from Context"),n},subredditId:i,userId:o,postId:e,commentId:t,debug:a,toJSON(){return{appAccountId:n,subredditId:i,userId:o,postId:e,commentId:t,debug:a}}}}function u0(r){let e={blocks:void 0,emitSnapshots:void 0,emitState:void 0,realtime:void 0,runtime:void 0,surface:void 0,useAsync:void 0,payments:void 0},t={};for(let n in e)t[n.toLowerCase()]=n;let i={};for(let n of(r[D.Debug]?.values??[]).join().split(",")){let[o,a]=n.split("=");o&&(o=o.trim(),a=a?.trim(),o.toLowerCase()in t&&(o=t[o.toLowerCase()]),i[o]??(i[o]=a||"true"))}return r[D.Debug]&&console.info(`[api] @devvit/public-api v${uy.version} ${Object.entries(i).map(([n,o])=>`${n}=${o}`).join(" ")}`),{...i,metadata:r}}function cy(r){return r.flatMap(e=>e.type==="group"?cy(e.fields):e)}async function hd(r,e,t){if(!e)throw new Error("Settings were not defined.");let i=c0.fromPartial({success:!0,errors:{}}),n=Tt(r.fieldValues),o=cy(e);return await Promise.all(o.map(async a=>{let c=a.name;if(c&&a.onValidate){let p=n[c],f=a.onValidate,v=Object.assign(Ue({metadata:t}),de(t)),m=await f({value:p,isEditing:r.editing},v);m&&(i.success=!1,i.errors[c]=m)}})),i}async function f0(){if(!u.appSettings)throw new Error("App settings were not defined.");return p0.fromPartial({fields:{fields:ut(u.appSettings)}})}async function g0(r,e){return hd(r,u.appSettings,e)}function my(r){r.provides(m0),U("GetAppSettingsFields",f0),U("ValidateAppForm",g0)}import{CustomPostDefinition as P0}from"@devvit/protos";import{BlockRenderEventType as Bc,EffectType as Ry}from"@devvit/protos";function ki(r){return r.__effects}function py(){let r=new Set;return e=>{let t=e,i=1;for(;r.has(t);)t=`${e}.${i++}`;return r.add(t),t}}import{BlockActionType as Uc,BlockAnimationDirection as Cy,BlockAnimationLoopMode as Iy,BlockAnimationType as wy,BlockAvatarBackground as xy,BlockAvatarFacing as Ty,BlockAvatarSize as Ot,BlockBorderWidth as kd,BlockButtonAppearance as Ft,BlockButtonSize as Tc,BlockFullSnooSize as Pi,BlockGap as Sd,BlockHorizontalAlignment as Ac,BlockIconSize as Pd,BlockImageResizeMode as cs,BlockPadding as ms,BlockRadius as ps,BlockSpacerShape as Ec,BlockSpacerSize as Cd,BlockStackDirection as Rc,BlockTextOutline as Oc,BlockTextOverflow as Fc,BlockTextSize as Ci,BlockTextStyle as Mc,BlockTextWeight as Ay,BlockType as Be,BlockVerticalAlignment as Lc}from"@devvit/protos";var Cc={transparent:"transparent",black:"#000000",white:"#ffffff","coolgray-950":"#04090A","coolgray-900":"#0B1416","coolgray-850":"#0F1A1C","coolgray-800":"#131F23","coolgray-750":"#1A282D","coolgray-700":"#223237","coolgray-650":"#2A3C42","coolgray-600":"#33464C","coolgray-550":"#4B6066","coolgray-525":"#576F76","coolgray-500":"#667A80","coolgray-450":"#82959B","coolgray-400":"#A0B0B5","coolgray-350":"#B8C5C9","coolgray-300":"#D2DADD","coolgray-250":"#DAE0E3","coolgray-200":"#E2E7E9","coolgray-150":"#EAEDEF","coolgray-100":"#F2F4F5","coolgray-50":"#F9FAFA","puregray-950":"#080808","puregray-900":"#131313","puregray-850":"#181818","puregray-800":"#1E1E1E","puregray-750":"#272727","puregray-700":"#303030","puregray-650":"#393939","puregray-600":"#434343","puregray-550":"#5C5C5C","puregray-500":"#767676","puregray-450":"#919191","puregray-400":"#ACACAC","puregray-350":"#C3C3C3","puregray-300":"#D6D6D6","puregray-250":"#DDDDDD","puregray-200":"#E4E4E4","puregray-150":"#EBEBEB","puregray-100":"#F2F2F2","puregray-50":"#F8F8F8","orangered-950":"#190600","orangered-900":"#340E00","orangered-800":"#4F1500","orangered-700":"#721F00","orangered-600":"#962900","orangered-500":"#D93A00","orangered-400":"#FE7C53","orangered-300":"#FFBEA6","orangered-200":"#FFD5C6","orangered-100":"#FFEDE5","orangered-50":"#FFF6F3","red-950":"#1C0004","red-900":"#3A0008","red-800":"#58000C","red-700":"#7E0011","red-600":"#A50016","red-500":"#EB001F","red-400":"#FF6E80","red-300":"#FFADB8","red-200":"#FFCCD2","red-100":"#FFEAED","red-50":"#FFF6F7","sakurapink-950":"#1A0011","sakurapink-900":"#360024","sakurapink-800":"#530037","sakurapink-700":"#770051","sakurapink-600":"#9B006A","sakurapink-500":"#E00096","sakurapink-400":"#FF55BD","sakurapink-300":"#FFA5E3","sakurapink-200":"#FFC5EC","sakurapink-100":"#FFE5F9","sakurapink-50":"#FFF3FB","berrypurple-950":"#16001F","berrypurple-900":"#2E0041","berrypurple-800":"#470062","berrypurple-700":"#66008C","berrypurple-600":"#8700B5","berrypurple-500":"#BC0EFF","berrypurple-400":"#D55EFF","berrypurple-300":"#EEA7FF","berrypurple-200":"#F2C8FF","berrypurple-100":"#FBE6FF","berrypurple-50":"#FCF4FF","periwinkle-950":"#0D0B1F","periwinkle-900":"#1A1741","periwinkle-800":"#272262","periwinkle-700":"#372F8C","periwinkle-600":"#453BB5","periwinkle-500":"#6A5CFF","periwinkle-400":"#988EFF","periwinkle-300":"#C3BDFF","periwinkle-200":"#D8D4FF","periwinkle-100":"#ECEAFF","periwinkle-50":"#F7F6FF","alienblue-950":"#000C1D","alienblue-900":"#00183D","alienblue-800":"#00255D","alienblue-700":"#003584","alienblue-600":"#0045AC","alienblue-500":"#1870F4","alienblue-400":"#629FFF","alienblue-300":"#A7CCFF","alienblue-200":"#C6DCFF","alienblue-100":"#E4EFFF","alienblue-50":"#F3F7FF","lightblue-950":"#000D12","lightblue-900":"#001C26","lightblue-800":"#002A3A","lightblue-700":"#003F56","lightblue-600":"#005472","lightblue-500":"#007FAE","lightblue-400":"#47B0DB","lightblue-300":"#95DCFB","lightblue-200":"#B6E9FF","lightblue-100":"#D9F6FF","lightblue-50":"#ECFAFF","mintgreen-950":"#00100E","mintgreen-900":"#001E1B","mintgreen-800":"#002E28","mintgreen-700":"#00443C","mintgreen-600":"#005A4F","mintgreen-500":"#008675","mintgreen-400":"#45B9AB","mintgreen-300":"#96E1D8","mintgreen-200":"#B7ECE5","mintgreen-100":"#DAF7F4","mintgreen-50":"#ECFBF9","kiwigreen-950":"#021000","kiwigreen-900":"#032200","kiwigreen-800":"#053200","kiwigreen-700":"#084A00","kiwigreen-600":"#0A6000","kiwigreen-500":"#0E8A00","kiwigreen-400":"#55BD46","kiwigreen-300":"#A3E398","kiwigreen-200":"#BFEEB8","kiwigreen-100":"#DFF8DB","kiwigreen-50":"#EEFCED","lime-950":"#0C0E00","lime-900":"#1A1F00","lime-800":"#282F00","lime-700":"#3A4501","lime-600":"#4D5A01","lime-500":"#6B7E01","lime-400":"#A1B33B","lime-300":"#CFDB83","lime-200":"#DFE8A6","lime-100":"#EFF4CC","lime-50":"#F7FAE5","yellow-950":"#100D01","yellow-900":"#251E02","yellow-800":"#382D03","yellow-700":"#504104","yellow-600":"#665505","yellow-500":"#8F7407","yellow-400":"#DBAF00","yellow-300":"#FADB61","yellow-200":"#FFE88F","yellow-100":"#FFF2BD","yellow-50":"#FFFAE5","yelloworange-950":"#150C00","yelloworange-900":"#2C1A00","yelloworange-800":"#432700","yelloworange-700":"#623A00","yelloworange-600":"#814C00","yelloworange-500":"#B06400","yelloworange-400":"#FF9C1A","yelloworange-300":"#FFCD7C","yelloworange-200":"#FFDDA8","yelloworange-100":"#FFF0D3","yelloworange-50":"#FFF7EA","poopbrown-950":"#110B04","poopbrown-900":"#29190A","poopbrown-800":"#3B2510","poopbrown-700":"#54371A","poopbrown-600":"#6E4924","poopbrown-500":"#9A6D3F","poopbrown-400":"#CAA075","poopbrown-300":"#EECCAA","poopbrown-200":"#F6DDC3","poopbrown-100":"#FEEEDD","poopbrown-50":"#FEF7EE",pizzaRed:{light:"#ef5350",dark:"#c62828"},"global-brand-orangered":{light:"#FF4500",dark:"#FF4500"},"global-focus":{light:"#47B0DB",dark:"#007FAE"},"interactive-content-disabled":{light:"#0000003f",dark:"#ffffff3f"},"interactive-background-disabled":{light:"#0000000c",dark:"#ffffff0c"},"interactive-pressed":{light:"#00000028",dark:"#ffffff28"},"neutral-content":{light:"#2A3C42",dark:"#B8C5C9"},"neutral-content-disabled":{light:"#D6D6D6",dark:"#303030"},"neutral-content-weak":{light:"#576F76",dark:"#82959B"},"neutral-content-strong":{light:"#0F1A1C",dark:"#F2F4F5"},"neutral-background":{light:"#ffffff",dark:"#0B1416"},"neutral-background-selected":{light:"#EAEDEF",dark:"#1A282D"},"neutral-background-weak":{light:"#F9FAFA",dark:"#04090A"},"neutral-background-medium":{light:"#F8F8F8",dark:"#131313"},"neutral-background-strong":{light:"#ffffff",dark:"#0F1A1C"},"neutral-background-hover":{light:"#F2F4F5",dark:"#131F23"},"neutral-border":{light:"#00000033",dark:"#ffffff33"},"neutral-border-medium":{light:"#0000007f",dark:"#ffffff7f"},"neutral-border-weak":{light:"#00000019",dark:"#ffffff19"},"neutral-border-strong":{light:"#0F1A1C",dark:"#F2F4F5"},primary:{light:"#0045AC",dark:"#629FFF"},"primary-hover":{light:"#003584",dark:"#A7CCFF"},"primary-visited":{light:"#8700B5",dark:"#D55EFF"},"primary-onBackground":{light:"#ffffff",dark:"#ffffff"},"primary-onBackground-selected":{light:"#ffffff",dark:"#000000"},"primary-background":{light:"#0045AC",dark:"#0045AC"},"primary-background-hover":{light:"#003584",dark:"#1870F4"},"primary-background-selected":{light:"#00255D",dark:"#629FFF"},secondary:{light:"#0F1A1C",dark:"#F2F4F5"},"secondary-hover":{light:"#000000",dark:"#ffffff"},"secondary-weak":{light:"#576F76",dark:"#82959B"},"secondary-onBackground":{light:"#000000",dark:"#ffffff"},"secondary-background":{light:"#EAEDEF",dark:"#1A282D"},"secondary-background-hover":{light:"#E2E7E9",dark:"#223237"},"secondary-background-selected":{light:"#D2DADD",dark:"#33464C"},"secondary-plain":{light:"#0F1A1C",dark:"#F2F4F5"},"secondary-plain-hover":{light:"#000000",dark:"#ffffff"},"danger-background":{light:"#EB001F",dark:"#A50016"},"danger-background-disabled":{light:"#FFCCD2",dark:"#3A0008"},"danger-background-hover":{light:"#A50016",dark:"#EB001F"},"danger-onBackground":{light:"#ffffff",dark:"#ffffff"},"danger-content":{light:"#A50016",dark:"#FF6E80"},"danger-content-hover":{light:"#7E0011",dark:"#FFADB8"},"danger-content-default":{light:"#ffffff",dark:"#ffffff"},"brand-background":{light:"#D93A00",dark:"#D93A00"},"brand-onBackground":{light:"#ffffff",dark:"#ffffff"},"brand-background-hover":{light:"#962900",dark:"#962900"},"media-background":{light:"#00000099",dark:"#00000099"},"media-onbackground":{light:"#ffffff",dark:"#ffffff"},"media-onbackground-weak":{light:"#E2E7E9",dark:"#E2E7E9"},"media-background-hover":{light:"#000000cc",dark:"#000000cc"},"media-onbackground-disabled":{light:"#ffffff3f",dark:"#ffffff3f"},"media-border-selected":{light:"#ffffff",dark:"#ffffff"},"media-background-selected":{light:"#000000cc",dark:"#000000cc"},"success-content":{light:"#0A6000",dark:"#55BD46"},"success-hover":{light:"#084A00",dark:"#A3E398"},"success-onBackground":{light:"#ffffff",dark:"#ffffff"},"success-background":{light:"#0E8A00",dark:"#0A6000"},"success-background-hover":{light:"#0A6000",dark:"#0E8A00"},"warning-content":{light:"#665505",dark:"#DBAF00"},"warning-content-hover":{light:"#504104",dark:"#FADB61"},"warning-onBackground":{light:"#000000",dark:"#000000"},"warning-background":{light:"#DBAF00",dark:"#DBAF00"},"warning-background-hover":{light:"#8F7407",dark:"#FADB61"},"upvote-content":{light:"#962900",dark:"#FE7C53"},"upvote-content-weak":{light:"#FF4500",dark:"#FF4500"},"upvote-disabled":{light:"#9629004c",dark:"#FE7C534c"},"upvote-onBackground":{light:"#ffffff",dark:"#ffffff"},"upvote-background":{light:"#D93A00",dark:"#D93A00"},"upvote-background-hover":{light:"#962900",dark:"#962900"},"upvote-background-disabled":{light:"#D93A004c",dark:"#D93A004c"},"downvote-content":{light:"#453BB5",dark:"#988EFF"},"downvote-content-weak":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-disabled":{light:"#453BB54c",dark:"#988EFF4c"},"downvote-onBackground":{light:"#ffffff",dark:"#ffffff"},"downvote-background":{light:"#6A5CFF",dark:"#453BB5"},"downvote-background-hover":{light:"#453BB5",dark:"#453BB5"},"downvote-background-disabled":{light:"#6A5CFF4c",dark:"#6A5CFF4c"},"brand-gradient-default":{light:"",dark:""},"brand-gradient-default-highlight":{light:"",dark:""},"brand-gradient-hover":{light:"",dark:""},"brand-gradient-hover-highlight":{light:"",dark:""},"brand-gradient-active":{light:"",dark:""},"brand-gradient-active-highlight":{light:"",dark:""},"gradient-media":{light:"",dark:""},"gradient-media-strong":{light:"",dark:""},"transparent-background-hover":{light:"#82959B19",dark:"#667A8019"},"global-black":{light:"#000000",dark:"#000000"},"global-white":{light:"#ffffff",dark:"#ffffff"},"global-orangered":{light:"#D93A00",dark:"#D93A00"},"global-alienblue":{light:"#1870F4",dark:"#1870F4"},"global-darkblue":{light:"#131F23",dark:"#131F23"},"tone-1":{light:"#131313",dark:"#F2F2F2"},"tone-2":{light:"#434343",dark:"#ACACAC"},"tone-3":{light:"#ACACAC",dark:"#434343"},"tone-4":{light:"#E4E4E4",dark:"#303030"},"tone-5":{light:"#F2F2F2",dark:"#1E1E1E"},"tone-6":{light:"#F8F8F8",dark:"#131313"},"tone-7":{light:"#ffffff",dark:"#080808"},"action-upvote":{light:"#D93A00",dark:"#D93A00"},"action-downvote":{light:"#6A5CFF",dark:"#6A5CFF"},"alert-caution":{light:"#8F7407",dark:"#8F7407"},"identity-admin":{light:"#D93A00",dark:"#D93A00"},"identity-moderator":{light:"#0E8A00",dark:"#0E8A00"},"identity-self":{light:"#008675",dark:"#008675"},"identity-coins":{light:"#DBAF00",dark:"#DBAF00"},"category-live":{light:"#D93A00",dark:"#D93A00"},"category-nsfw":{light:"#E00096",dark:"#E00096"},"category-spoiler":{light:"#131313",dark:"#F2F2F2"},"ui-canvas":{light:"#F2F2F2",dark:"#080808"},"ui-modalbackground":{light:"#ffffff",dark:"#0F1A1C"},"avatar-gradient":{light:"",dark:""},"opacity-highlight":{light:"",dark:""},"opacity-08":{light:"#13131314",dark:"#13131314"},"opacity-50":{light:"#0000007f",dark:"#F2F2F27f"},scrim:{light:"#00000099",dark:"#00000099"},"scrim-strong":{light:"#000000cc",dark:"#000000cc"},"scrim-gradient":{light:"",dark:""},online:{light:"#55BD46",dark:"#55BD46"},favorite:{light:"#8F7407",dark:"#DBAF00"}};var fy={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",transparent:"#FFFFFF00",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},gy=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),hy=r=>r in Cc,Ic=r=>r in fy,vy=r=>!!r.match(/^rgba?\(.*/),yy=r=>!!r.match(/^hsla?\(.*/),by=(r,e="light")=>{if(Ic(r))return vd(r);let i=Cc[r];return typeof i=="string"?i:i[e]},vd=r=>fy[r]??r,ky=r=>{let[e,t,i,n]=r.replace(/^rgba?\(|\s+|\)$/g,"").split(",");if(!e||!t||!i)return r;let a=[...[e,t,i].map(p=>parseFloat(p))];if(n){let p=parseFloat(n),f=Math.round(p*255);a.push(f)}return`#${a.map(p=>p.toString(16).padStart(2,"0")).join("")}`};import{BlockStackDirection as yd}from"@devvit/protos";var wc={stackParentLayout:{hasHeight:!0,hasWidth:!0,direction:yd.UNRECOGNIZED,alignment:void 0}};function Py(r,e,t){if(!e)return{hasHeight:!1,hasWidth:!1};let{growDirection:i,stretchDirection:n}=h0(r?.grow,e.direction,e.alignment),o=t?.height?.value?.value||t?.height?.min?.value||Sy(2,i,n,e.hasHeight),a=t?.width?.value?.value||t?.width?.min?.value||Sy(1,i,n,e.hasWidth);return{hasHeight:!!o,hasWidth:!!a}}function Sy(r,e,t,i){return e===r&&i||t===r&&i}function h0(r,e,t){let i=e===yd.STACK_VERTICAL||e===yd.UNRECOGNIZED,n=e===yd.STACK_HORIZONTAL,o=0;n&&r?o=1:i&&r&&(o=2);let a=t===void 0||t.horizontal===void 0,c=t===void 0||t.vertical===void 0,p=n?!!c:i?!!a:!1,f=0;return n&&p?f=2:i&&p&&(f=1),{growDirection:o,stretchDirection:f}}import{BlockSizeUnit as hr,BlockStackDirection as bd}from"@devvit/protos";function Si(r){if(r==null)return;if(typeof r=="number")return{value:r,unit:hr.SIZE_UNIT_PERCENT};let e=r.match(/^(\d+(?:\.\d+)?)(px|%)?$/);if(e==null)return;let t=hr.SIZE_UNIT_PERCENT;return e.at(2)==="px"&&(t=hr.SIZE_UNIT_PIXELS),{value:Number.parseFloat(e[1]),unit:t}}function v0(r,e){return(r.width?.value?.unit===hr.SIZE_UNIT_PERCENT||r.width?.min?.unit===hr.SIZE_UNIT_PERCENT)&&(e.direction===bd.STACK_HORIZONTAL||e.direction===bd.STACK_DEPTH)&&(e.hasWidth||(r.width=void 0)),(r.height?.value?.unit===hr.SIZE_UNIT_PERCENT||r.height?.min?.unit===hr.SIZE_UNIT_PERCENT)&&(e.direction===bd.STACK_VERTICAL||e.direction===bd.STACK_DEPTH)&&(e.hasHeight||(r.height=void 0)),r}function xc(r,e){if(r){let t=r.width!=null||r.minWidth!=null||r.maxWidth!=null,i=r.height!=null||r.minHeight!=null||r.maxHeight!=null;if(t||i||r.grow!=null){let n={width:t?{value:Si(r.width),min:Si(r.minWidth),max:Si(r.maxWidth)}:void 0,height:i?{value:Si(r.height),min:Si(r.minHeight),max:Si(r.maxHeight)}:void 0,grow:r.grow};return e.stackParentLayout&&(n=v0(n,e.stackParentLayout)),n}}}var Ey="data-",y0=new Set(["onPress","onMessage"]),b0=new Map([["onPress",Uc.ACTION_CLICK],["onMessage",Uc.ACTION_WEBVIEW]]),fs,Ii=class{constructor(e=()=>{}){l(this,fs);d(this,fs,e)}createBlocksElementOrThrow({type:e,props:t,children:i}){let n=this.createBlocksElement({type:e,props:t,children:i},wc);if(!n)throw new Error(`Could not create block of type ${e}`);return n}createBlocksElement({type:e,props:t,children:i},n){switch(e){case"blocks":return this.makeRoot(t,...i);case"hstack":return this.makeHStack(t,n,...i);case"vstack":return this.makeVStack(t,n,...i);case"zstack":return this.makeZStack(t,n,...i);case"text":return this.makeText(t,n,...i);case"button":return this.makeButton(t,n,...i);case"image":return this.makeImage(t,n);case"spacer":return this.makeSpacer(t,n);case"icon":return this.makeIcon(t,n);case"avatar":return this.makeAvatar(t,n);case"fullsnoo":return this.makeFullSnoo(t,n);case"animation":return this.makeAnimation(t,n);case"webview":return this.makeWebView(t,n);case"__fragment":throw new Error("root fragment is not supported - use 'blocks' instead")}}makeRootHeight(e){switch(e){case"regular":return 320;case"tall":return 512}}makeBlockPadding(e){switch(e){case"none":return ms.PADDING_NONE;case"xsmall":return ms.PADDING_XSMALL;case"small":return ms.PADDING_SMALL;case"medium":return ms.PADDING_MEDIUM;case"large":return ms.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return ps.RADIUS_NONE;case"small":return ps.RADIUS_SMALL;case"medium":return ps.RADIUS_MEDIUM;case"large":return ps.RADIUS_LARGE;case"full":return ps.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return Sd.GAP_NONE;case"small":return Sd.GAP_SMALL;case"medium":return Sd.GAP_MEDIUM;case"large":return Sd.GAP_LARGE}}makeBlockAlignment(e){if(e===void 0)return;let t,i;if(e.includes("top")?t=Lc.ALIGN_TOP:e.includes("middle")?t=Lc.ALIGN_MIDDLE:e.includes("bottom")&&(t=Lc.ALIGN_BOTTOM),e.includes("start")?i=Ac.ALIGN_START:e.includes("center")?i=Ac.ALIGN_CENTER:e.includes("end")&&(i=Ac.ALIGN_END),t!==void 0||i!==void 0)return{vertical:t,horizontal:i}}makeBlockBorder(e,t,i,n){if(!e&&!t)return;let o;switch(e){case"none":o=kd.BORDER_WIDTH_NONE;break;case"thin":o=kd.BORDER_WIDTH_THIN;break;case"thick":o=kd.BORDER_WIDTH_THICK;break;default:o=kd.BORDER_WIDTH_THIN;break}let a=t??"neutral-border-weak",c=this.getThemedColors(a,i,n);return{width:o,color:c?.light,colors:c}}makeBlockTextSize(e){switch(e){case"xsmall":return Ci.TEXT_SIZE_XSMALL;case"small":return Ci.TEXT_SIZE_SMALL;case"medium":return Ci.TEXT_SIZE_MEDIUM;case"large":return Ci.TEXT_SIZE_LARGE;case"xlarge":return Ci.TEXT_SIZE_XLARGE;case"xxlarge":return Ci.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return Mc.TEXT_STYLE_BODY;case"metadata":return Mc.TEXT_STYLE_METADATA;case"heading":return Mc.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return Oc.TEXT_OUTLINE_NONE;case"thin":return Oc.TEXT_OUTLINE_THIN;case"thick":return Oc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return Ay.TEXT_WEIGHT_REGULAR;case"bold":return Ay.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return Fc.TEXT_OVERFLOW_CLIP;case"ellipsis":return Fc.TEXT_OVERFLOW_ELLIPSE}return Fc.TEXT_OVERFLOW_ELLIPSE}makeBlockButtonAppearance(e){switch(e){case"secondary":return Ft.BUTTON_APPEARANCE_SECONDARY;case"primary":return Ft.BUTTON_APPEARANCE_PRIMARY;case"plain":return Ft.BUTTON_APPEARANCE_PLAIN;case"bordered":return Ft.BUTTON_APPEARANCE_BORDERED;case"media":return Ft.BUTTON_APPEARANCE_MEDIA;case"destructive":return Ft.BUTTON_APPEARANCE_DESTRUCTIVE;case"caution":return Ft.BUTTON_APPEARANCE_CAUTION;case"success":return Ft.BUTTON_APPEARANCE_SUCCESS}}makeBlockButtonSize(e){switch(e){case"small":return Tc.BUTTON_SIZE_SMALL;case"medium":return Tc.BUTTON_SIZE_MEDIUM;case"large":return Tc.BUTTON_SIZE_LARGE}}makeBlockImageResizeMode(e){switch(e){case"none":return cs.IMAGE_RESIZE_NONE;case"fit":return cs.IMAGE_RESIZE_FIT;case"fill":return cs.IMAGE_RESIZE_FILL;case"cover":return cs.IMAGE_RESIZE_COVER;case"scale-down":return cs.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return Cd.SPACER_XSMALL;case"small":return Cd.SPACER_SMALL;case"medium":return Cd.SPACER_MEDIUM;case"large":return Cd.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return Ec.SPACER_INVISIBLE;case"thin":return Ec.SPACER_THIN;case"square":return Ec.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return Pd.ICON_SIZE_XSMALL;case"small":return Pd.ICON_SIZE_SMALL;case"medium":return Pd.ICON_SIZE_MEDIUM;case"large":return Pd.ICON_SIZE_LARGE}}makeBlockAvatarSize(e){switch(e){case"xxsmall":return Ot.AVATAR_SIZE_XXSMALL;case"xsmall":return Ot.AVATAR_SIZE_XSMALL;case"small":return Ot.AVATAR_SIZE_SMALL;case"medium":return Ot.AVATAR_SIZE_MEDIUM;case"large":return Ot.AVATAR_SIZE_LARGE;case"xlarge":return Ot.AVATAR_SIZE_XXLARGE;case"xxlarge":return Ot.AVATAR_SIZE_XXLARGE;case"xxxlarge":return Ot.AVATAR_SIZE_XXXLARGE}}makeBlockAvatarFacing(e){switch(e){case"left":return Ty.AVATAR_FACING_LEFT;case"right":return Ty.AVATAR_FACING_RIGHT}}makeBlockFullSnooSize(e){switch(e){case"xsmall":return Pi.FULLSNOO_XSMALL;case"small":return Pi.FULLSNOO_SMALL;case"medium":return Pi.FULLSNOO_MEDIUM;case"large":return Pi.FULLSNOO_LARGE;case"xlarge":return Pi.FULLSNOO_XLARGE;case"xxlarge":return Pi.FULLSNOO_XXLARGE}}makeBlockAvatarBackground(e){switch(e){case"dark":return xy.AVATAR_BG_DARK;case"light":return xy.AVATAR_BG_LIGHT}}makeBlockAnimationType(e){return e==="lottie"||e===void 0?wy.ANIM_LOTTIE:wy.UNRECOGNIZED}makeBlockAnimationDirection(e){switch(e){case"backward":return Cy.ANIM_DIR_BACKWARD;case"forward":return Cy.ANIM_DIR_FORWARD}}makeBlockLoopMode(e){switch(e){case"repeat":return Iy.ANIM_LOOP_REPEAT;case"bounce":return Iy.ANIM_LOOP_BOUNCE}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(Ey)).reduce((t,i)=>(t[i.substring(Ey.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);return y0.forEach(o=>{if(o in t){let a=t[o];i.push({type:b0.get(o)??Uc.UNRECOGNIZED,id:a.toString(),data:n})}}),i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),gy(e)?e:hy(e)?by(e,t):Ic(e)?vd(e):vy(e)?ky(e):yy(e)?e:(console.warn(`Could not parse color: ${e}.`),vd("red"))}childrenToBlocks(e,t){return e.flatMap(i=>(typeof i!="string"?this.createBlocksElement(i,t):void 0)??[])}getThemedColors(e,t,i){let n=this.blockColorToHex(t,"light"),o=this.blockColorToHex(i,"dark"),a=[];if(e&&(!n||!o)){let c=Array.from(e?.matchAll(/[\w#-]+(?:\([\w\t ,.#-]+\))?/g)??[]);a.push(...c.map(p=>p[0]))}return n||(n=this.blockColorToHex(a?.at(0),"light")),o||(o=this.blockColorToHex(a?.at(1)??a?.at(0),"dark")),n||o?{light:n,dark:o}:void 0}parsePixels(e){return typeof e=="string"?Number(e.slice(0,-2)):e}resolveAssetUrl(e,t){return s(this,fs).call(this)?.getURL(e,t)??e}childrenToString(e){return e.map(t=>t.toString()).join("")}makeRoot(e,...t){return this.wrapRoot(e,this.childrenToBlocks(t,wc))}wrapRoot(e,t){return this.makeBlock(Be.BLOCK_ROOT,{},{},{rootConfig:{children:t,height:this.makeRootHeight(u.customPostType?.height??e?.height??"regular")}})}makeStackBlock(e,t,i,n){let o=this.getThemedColors(t?.backgroundColor,t?.lightBackgroundColor,t?.darkBackgroundColor),a=this.makeBlockAlignment(t?.alignment),c=xc(t,i),p=Py(t,i.stackParentLayout,c);return this.makeBlock(Be.BLOCK_STACK,t,i,{stackConfig:{alignment:a,backgroundColor:o?.light,backgroundColors:o,border:this.makeBlockBorder(t?.border,t?.borderColor,t?.lightBorderColor,t?.darkBorderColor),children:this.childrenToBlocks(n,{stackParentLayout:{...p,direction:e,alignment:a}}),cornerRadius:this.makeBlockRadius(t?.cornerRadius),direction:e,gap:this.makeBlockGap(t?.gap),padding:this.makeBlockPadding(t?.padding),reverse:t?.reverse}})}makeHStack(e,t,...i){return this.makeStackBlock(Rc.STACK_HORIZONTAL,e,t,i)}makeVStack(e,t,...i){return this.makeStackBlock(Rc.STACK_VERTICAL,e,t,i)}makeZStack(e,t,...i){return this.makeStackBlock(Rc.STACK_DEPTH,e,t,i)}makeText(e,t,...i){let n=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(Be.BLOCK_TEXT,e,t,{textConfig:{alignment:this.makeBlockAlignment(e?.alignment),color:n?.light,colors:n,outline:this.makeBlockTextOutline(e?.outline),size:this.makeBlockTextSize(e?.size),style:this.makeBlockTextStyle(e?.style),text:this.childrenToString(i),weight:this.makeBlockTextWeight(e?.weight),selectable:e?.selectable,wrap:e?.wrap,overflow:this.makeBlockTextOverflow(e?.overflow)}})}makeButton(e,t,...i){let n=this.getThemedColors(e?.textColor,e?.lightTextColor,e?.darkTextColor);return this.makeBlock(Be.BLOCK_BUTTON,e,t,{buttonConfig:{buttonAppearance:this.makeBlockButtonAppearance(e?.appearance),icon:e?.icon,buttonSize:this.makeBlockButtonSize(e?.size),text:this.childrenToString(i),textColor:n?.light,textColors:n,disabled:e?.disabled}})}makeImage(e,t){return e&&this.makeBlock(Be.BLOCK_IMAGE,e,t,{imageConfig:{description:e?.description,resizeMode:this.makeBlockImageResizeMode(e.resizeMode),url:this.resolveAssetUrl(e.url),width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight)}})}makeSpacer(e,t){return this.makeBlock(Be.BLOCK_SPACER,e,t,{spacerConfig:{size:this.makeBlockSpacerSize(e?.size),shape:this.makeBlockSpacerShape(e?.shape)}})}makeIcon(e,t){let i=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return e&&this.makeBlock(Be.BLOCK_ICON,e,t,{iconConfig:{icon:e.name,color:i?.light,colors:i,size:this.makeBlockIconSize(e.size)}})}makeAvatar(e,t){return e&&this.makeBlock(Be.BLOCK_AVATAR,e,t,{avatarConfig:{thingId:e.thingId,size:this.makeBlockAvatarSize(e.size),facing:this.makeBlockAvatarFacing(e.facing),background:this.makeBlockAvatarBackground(e.background)}})}makeFullSnoo(e,t){return e&&this.makeBlock(Be.BLOCK_FULLSNOO,e,t,{fullsnooConfig:{userId:e.userId,facing:this.makeBlockAvatarFacing(e.facing),size:this.makeBlockFullSnooSize(e.size)}})}makeAnimation(e,t){return e&&this.makeBlock(Be.BLOCK_ANIMATION,e,t,{animationConfig:{type:this.makeBlockAnimationType(e.type),url:this.resolveAssetUrl(e.url),loop:e.loop,loopMode:this.makeBlockLoopMode(e.loopMode),autoplay:e.autoplay,width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight),direction:this.makeBlockAnimationDirection(e.direction),speed:e.speed}})}makeWebView(e,t){return e&&this.makeBlock(Be.BLOCK_WEBVIEW,e,t,{webviewConfig:{url:this.resolveAssetUrl(e.url,{webview:!0}),state:e.state}})}makeBlock(e,t,i,n){return{type:e,sizes:xc(t,i),config:n,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}ensureRootBlock(e){let t=e;if(t.type===Be.BLOCK_ROOT)return t.config?.rootConfig&&u.customPostType?.height&&(t.config.rootConfig.height=this.makeRootHeight(u.customPostType?.height)),t;let i=this.wrapRoot(void 0,[t]);if(!i)throw new Error("Could not create root block");return i}};fs=new WeakMap;function Oy(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var Fy=r=>{let e="",t=r.props?Object.keys(r.props).map(i=>i==="onPress"?"":`${i}="${r.props[i]}"`).join(" "):"";e+=`<${r.type}${t?" "+t:""}>`;for(let i of r.children)typeof i=="string"?e+=i:e+=Fy(i);return e+=`</${r.type}>`,e};function k0(r){return" ".repeat(r)}function S0(r){let e="",t=0,i=r.split(/>\s*</);for(let n=0;n<i.length;n++){let o=i[n];n===0&&(o=o.trim()),n===i.length-1&&(o=o.trim());let a=o.charAt(0)==="/";a&&t--,e+=k0(t),n!==0&&(e+="<"),e+=o,n!==i.length-1&&(e+=`>
2
+ `),!a&&o.indexOf("</")===-1&&o.charAt(o.length-1)!=="/"&&t++}return e}var De,My,gs,Dc,hs,ct=class{constructor(e,t,i,n,o){l(this,De);this.renderState={};this.currentComponentKey=[];this.currentHookIndex=0;this.actions=new Map;this.forms=new Map;this.realtimeChannels=[];this.realtimeUpdated=!1;this.pendingHooks=[];this.isRendering=!1;this.transformer=new Ii(()=>this.assets);this.effects=[];l(this,hs,!1);this.component=e,this.event=t,this.state={__renderState:{},...i},this.metadata=n,this.state.__realtimeChannels&&(this.realtimeChannels=this.state.__realtimeChannels);let a=Ue({reconciler:this,hooks:!0,ui:!0,metadata:n});this.cache=a.cache,this.modLog=a.modLog,this.reddit=a.reddit,this.kvStore=a.kvStore,this.redis=a.redis,this.settings=a.settings,this.scheduler=a.scheduler,this.media=a.media,this.assets=a.assets,this.realtime=a.realtime,this.dimensions=o,this.ui=a.ui,this.hooks={useState:a.useState,useInterval:a.useInterval,useForm:a.useForm,useChannel:a.useChannel}}emitEffect(e,t){this.effects.push(t)}async render(){await this.reconcile(),this.isRendering=!0;let e=await this.buildBlocksUI();return this.isRendering=!1,e}makeUniqueActionID(e){let t=e,i=1;for(;this.actions.has(t);)t=`${e}.${i++}`;return t}async reconcile(){let e=S(this,De,gs).call(this),t={type:this.component,props:e,children:[]},i=await this.processBlock(t);if(Oy(i),this.transformer.createBlocksElementOrThrow(i),this.isUserActionRender&&this.blockRenderEventId){let n=this.actions.get(this.blockRenderEventId);n&&await n(this.event.data)}for(let n of this.pendingHooks)await n();this.buildNextState(),S(this,De,My).call(this)}async buildBlocksUI(){let e=S(this,De,gs).call(this),t={type:this.component,props:e,children:[]},i=await this.renderElement(e,t);return this.transformer.ensureRootBlock(i)}async renderElement(e,t){let i=await this.processBlock(t);return Oy(i),(u.debug.emitSnapshots||e.debug.emitSnapshots)&&console.debug(S0(Fy(i))),(u.debug.emitState||e.debug.emitState)&&console.debug(JSON.stringify(this.state,void 0,2)),this.transformer.createBlocksElementOrThrow(i)}async processProps(e){let t=e.props??{},i=["onPress","onMessage"];for(let n of i)if(n in t){let o=t[n],a=o?.name,c=this.makeUniqueActionID(`${e.type}.${a??n}`);this.actions.set(c,o),t[n]=c}}async processBlock(e,t=py(),i=[]){let n=e;if(typeof n.type=="string"){let c=[];for(let m=0;m<n.children.length;m++){let b=n.children[m];b!=null&&c.push(await this.processBlock(b,t,[...i,`${n.type}.${m}`]))}let p=c.flat(),f=S(this,De,Dc).call(this,p);return await this.processProps(n),{type:n.type,props:n.props,children:f}}if(typeof n.type=="function"){let c=t(`${i.length?i.join("."):"root"}.${n.type.name.length?n.type.name:"anonymous"}`);this.currentComponentKey.push(c),this.renderState[c]||(this.renderState[c]={});let p=n.children.flatMap(m=>m),f={...S(this,De,gs).call(this),...n.props,children:p},v;for(;v===void 0;)try{v=await n.type(f,S(this,De,gs).call(this))}catch(m){if(m instanceof Promise)v=await m;else throw m}if(!this.isInitialRender){let m=this.getPreviousComponentState();if(Object.keys(m).length!==this.currentHookIndex)throw new Error("Invalid hook call. Hooks can only be called at the top-level of a function component. Make sure that you are not calling hooks inside loops, conditions, or nested functions.")}if(this.currentComponentKey.pop(),this.currentHookIndex=0,typeof v=="object")return this.processBlock(v,t,[...i,n.type.name])}if(typeof n=="string")return n;if(typeof n=="number")return`${n}`;let o=[],a="";return Array.isArray(n)?o=n:typeof n.type>"u"&&n.children&&(o=n.children,a="fragmentChild."),{type:"__fragment",props:void 0,children:await Promise.all(o.flatMap(async(c,p)=>await this.processBlock(c,t,[...i,`${a}${p}`])))}}getCurrentComponentKey(){if(!this.currentComponentKey.at(-1))throw new Error("Current component key is missing");return this.currentComponentKey}getCurrentComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.renderState[e]}getPreviousComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.state.__renderState[e]||(this.state.__renderState[e]={}),this.state.__renderState[e]}get isInitialRender(){return this.event?this.event.type===Bc.RENDER_INITIAL:!1}get isUserActionRender(){return this.event?this.event.type===Bc.RENDER_USER_ACTION:!1}get isEffectRender(){return this.event?this.event.type===Bc.RENDER_EFFECT_EVENT:!1}get formSubmittedEvent(){return this.event?this.event.formSubmitted:!1}get blockRenderEventId(){return this.event?this.event.id:!1}get realtimeEvent(){if(!this.event)return!1;let e=this.event.realtimeEvent;return e?.event?.channel?e:!1}runHook(e){this.pendingHooks.push(e)}rerenderIn(e){s(this,hs)||(d(this,hs,!0),this.effects.push({type:Ry.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:e/1e3}}))}addRealtimeChannel(e){this.realtimeChannels.push(e),this.realtimeUpdated=!0}removeRealtimeChannel(e){this.realtimeChannels=this.realtimeChannels.filter(t=>t!==e),this.realtimeUpdated=!0}get realtimeEffect(){return this.realtimeUpdated&&this.realtimeChannels.length>0?[{type:Ry.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:this.realtimeChannels}}]:[]}getEffects(){return[...ki(this.ui),...this.effects,...this.realtimeEffect]}buildNextState(){for(let e of Object.keys(this.renderState))this.renderState[e]=Object.values(this.renderState[e]);this.state={__postData:this.state.__postData,__renderState:this.renderState,__cache:this.state.__cache,...this.realtimeChannels.length>0?{__realtimeChannels:this.realtimeChannels}:{}}}};De=new WeakSet,My=function(){this.actions.clear(),this.currentComponentKey=[],this.currentHookIndex=0,this.pendingHooks=[],this.realtimeChannels=[],this.realtimeUpdated=!1},gs=function(){let e={...de(this.metadata,this.state.__postData?.thingId),modLog:this.modLog,reddit:this.reddit,cache:this.cache,kvStore:this.kvStore,redis:this.redis,settings:this.settings,scheduler:this.scheduler,media:this.media,assets:this.assets,realtime:this.realtime,ui:this.ui,dimensions:this.dimensions,uiEnvironment:{timezone:this.metadata[D.Timezone]?.values[0],locale:this.metadata[D.Language]?.values[0],dimensions:this.dimensions},...this.hooks};return e.debug.effects=this,e},Dc=function(e){let t=[];for(let i of e)typeof i=="string"?t.push(i):i.type==="__fragment"?t.push(...S(this,De,Dc).call(this,i.children)):t.push(i);return t},hs=new WeakMap;async function C0(r,e){let t=u.customPostType;if(!t)throw new Error("Custom post type not registered");let i=new ct((o,a)=>t.render(a),r.blocks,r.state,e,r.dimensions),n=await i.render();return{state:i.state,blocks:{ui:n},effects:i.getEffects()}}function Ly(r){r.provides(P0),U("RenderPost",C0)}import{GetFieldsResponse as I0,InstallationSettingsDefinition as w0}from"@devvit/protos";async function x0(){if(!u.installationSettings)throw new Error("Installation settings were not defined.");return I0.fromPartial({fields:{fields:ut(u.installationSettings)}})}async function T0(r,e){return hd(r,u.installationSettings,e)}function Uy(r){r.provides(w0),U("GetSettingsFields",x0),U("ValidateForm",T0)}import{ContextActionDefinition as A0,ContextActionDescription as E0,ContextActionResponse as R0}from"@devvit/protos";var By=r=>`menuItem.${r}`;function _c(r){return u.menuItems.find((e,t)=>By(t)===r)}async function O0(r,e){let t=u.menuItems;if(!t.length)throw new Error("No menu items registered.");return{actions:t.map((n,o)=>E0.fromPartial({actionId:By(o),name:n.label,description:n.description,contexts:{subreddit:n.location.includes("subreddit"),post:n.location.includes("post"),comment:n.location.includes("comment")},users:{loggedOut:n.forUserType?.includes("loggedOut"),member:n.forUserType?.includes("member"),moderator:n.forUserType?.includes("moderator")},postFilters:n.postFilter==="currentApp"?{currentApp:!0}:void 0}))}}async function F0(r,e){let t=_c(r.actionId);if(!t)throw new Error(`MenuItem ${r.actionId} not found`);let i=r.comment?.id&&`t1_${r.comment.id}`,n=r.post?.id&&`t3_${r.post.id}`,o=r.subreddit?.id&&`t5_${r.subreddit.id}`,a=i||n||o;g(a,"targetId is missing from ContextActionRequest");let c={targetId:a,location:r.comment?"comment":r.post?"post":"subreddit"},p=Object.assign(Ue({ui:!0,metadata:e}),de(e,n,i),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});return await t.onPress(c,p),R0.fromPartial({effects:ki(p.ui)})}function Dy(r){r.provides(A0),U("GetActions",O0),U("OnAction",F0)}function mt(r){return r?r===!0?!0:r.enabled:!1}import{SchedulerHandlerDefinition as M0}from"@devvit/protos";async function L0(r,e){let t=r.type,i=u.scheduledJobHandlers.get(t);if(!i)throw new Error(`Job ${t} not found`);let n={name:t,data:r.data},o=Object.assign(Ue({metadata:e}),de(e));await i(n,o)}function _y(r){r.provides(M0),U("HandleScheduledAction",L0)}import{HandlerResult as U0,OnAppInstallDefinition as B0,OnAppUpgradeDefinition as D0,OnCommentCreateDefinition as _0,OnCommentDeleteDefinition as N0,OnCommentReportDefinition as q0,OnCommentSubmitDefinition as H0,OnCommentUpdateDefinition as j0,OnModActionDefinition as W0,OnModMailDefinition as G0,OnPostCreateDefinition as V0,OnPostDeleteDefinition as z0,OnPostFlairUpdateDefinition as J0,OnPostReportDefinition as $0,OnPostSubmitDefinition as K0,OnPostUpdateDefinition as X0,OnPostNsfwUpdateDefinition as Z0,OnPostSpoilerUpdateDefinition as Y0}from"@devvit/protos";var wi;(function(r){function e(o,a){return o.length<=a?o:`${o.slice(0,a-1)}\u2026`}r.ellipsize=e;function t(o){return o[0]==null?o:`${o[0].toLocaleUpperCase()}${o.slice(1)}`}r.capitalize=t;function i(o){return o==null||/^\s*$/.test(o)}r.isBlank=i;function n(o){return o instanceof Error?`${o.stack||o.message||o.name}`:String(o)}r.caughtToString=n})(wi||(wi={}));function Q(r,e){return g(e),async(t,i)=>{let n={...t,type:r},o=Object.assign(Ue({metadata:i}),de(i)),a=await Promise.allSettled(e.map(p=>p(n,o))),c=Q0(a);if(c)throw c.err;return U0.fromPartial({})}}function Ny(r){for(let e of u.triggerOnEventHandlers.keys())switch(e){case"PostSubmit":r.provides(K0),U("OnPostSubmit",Q("PostSubmit",u.triggerOnEventHandlers.get(e)));break;case"PostCreate":r.provides(V0),U("OnPostCreate",Q("PostCreate",u.triggerOnEventHandlers.get(e)));break;case"PostUpdate":r.provides(X0),U("OnPostUpdate",Q("PostUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostReport":r.provides($0),U("OnPostReport",Q("PostReport",u.triggerOnEventHandlers.get(e)));break;case"PostDelete":r.provides(z0),U("OnPostDelete",Q("PostDelete",u.triggerOnEventHandlers.get(e)));break;case"PostFlairUpdate":r.provides(J0),U("OnPostFlairUpdate",Q("PostFlairUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentSubmit":r.provides(H0),U("OnCommentSubmit",Q("CommentSubmit",u.triggerOnEventHandlers.get(e)));break;case"CommentCreate":r.provides(_0),U("OnCommentCreate",Q("CommentCreate",u.triggerOnEventHandlers.get(e)));break;case"CommentUpdate":r.provides(j0),U("OnCommentUpdate",Q("CommentUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentReport":r.provides(q0),U("OnCommentReport",Q("CommentReport",u.triggerOnEventHandlers.get(e)));break;case"CommentDelete":r.provides(N0),U("OnCommentDelete",Q("CommentDelete",u.triggerOnEventHandlers.get(e)));break;case"AppInstall":r.provides(B0),U("OnAppInstall",Q("AppInstall",u.triggerOnEventHandlers.get(e)));break;case"AppUpgrade":r.provides(D0),U("OnAppUpgrade",Q("AppUpgrade",u.triggerOnEventHandlers.get(e)));break;case"ModAction":r.provides(W0),U("OnModAction",Q("ModAction",u.triggerOnEventHandlers.get(e)));break;case"ModMail":r.provides(G0),U("OnModMail",Q("ModMail",u.triggerOnEventHandlers.get(e)));break;case"PostNsfwUpdate":r.provides(Z0),U("OnPostNsfwUpdate",Q("PostNsfwUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostSpoilerUpdate":r.provides(Y0),U("OnPostSpoilerUpdate",Q("PostSpoilerUpdate",u.triggerOnEventHandlers.get(e)));break;default:throw new Error(`Unknown trigger event: ${e}`)}}function Q0(r){let e=r.reduce((t,i)=>i.status==="rejected"?[...t,i.reason]:t,[]);if(e.length!==0)return e.length===1?{err:e[0]}:{err:new Error(e.map(t=>wi.caughtToString(t)).join(`
3
+ `))}}var Fb=_n(Zy(),1),Mb=_n(Yc(),1);import{EffectType as YR,UIEventHandlerDefinition as QR}from"@devvit/protos";async function eO(r,e){let t=r.state??{},i=(0,Fb.default)(t),n=Ue({ui:!0,metadata:e});if(r.event?.formSubmitted&&r.event.formSubmitted.formId){let p=r.event.formSubmitted.formId;if(p.includes("form.hook.")&&u.customPostType){let y=new ct((C,I)=>u.customPostType?.render(I)??null,r.event,r.state,e,void 0);return await y.reconcile(),{state:y.state,effects:y.getEffects()}}let f=u.formDefinitions.get(p);if(!f)throw new Error(`Form with key ${p} not found`);let v,m;if(i.__contextAction){let{actionId:y,thingId:C}=i.__contextAction,I=_c(y);I?.location==="post"?v=C:I?.location==="comment"&&(m=C)}let b=Object.assign(n,de(e,v,m),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});await f.onSubmit({values:Tt(r.event.formSubmitted.results)},b)}else if(r.event?.realtimeEvent){if(u.customPostType){let p=new ct((f,v)=>u.customPostType?.render(v)??null,r.event,r.state,e,void 0);return await p.reconcile(),{state:p.state,effects:p.getEffects()}}}else if(r.event?.toastAction)throw new Error("Toast actions not yet implemented");let o=!(0,Mb.default)(t,i),a=ki(n.ui),c=o?[...a,{type:YR.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:0}}]:a;return{state:i,effects:c}}function Lb(r){r.provides(QR),U("HandleUIEvent",eO)}import{CustomPostDefinition as nk}from"@devvit/protos";import{EffectType as tm,Form as rO,ToastAppearance as Db}from"@devvit/protos";function Ub(r){let e=r.match(/form\.hook\.(.+)\.0/);if(e?.[1])return e[1]}var Qc=class{constructor(e,t,i){this.state=null;this.hookId=e.hookId,this.form=t,this.onSubmit=i,this.onUIEvent=async n=>{n.formSubmitted&&await i(Tt(n.formSubmitted.results))}}};function em(r,e){let t=$e({namespace:"useForm"},i=>new Qc(i,r,e));return tO({id:t.hookId})}function tO(r){return`form.hook.${r.id}.0`}function Bb(r,e){let t=Ub(e);return r.getHook({id:t})}var Ut,Ud=class{constructor(e){l(this,Ut);d(this,Ut,e)}showForm(e,t){let i=Bb(s(this,Ut),e);if(!i)throw new Error("Form does not exist. Make sure you have added it using useForm.");let n=i.form instanceof Function?i.form(t??{}):i.form,o=rO.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});cr(n.fields),o.fields=ut(n.fields),s(this,Ut).emitEffect(e,{type:tm.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?Db.SUCCESS:Db.NEUTRAL}:t={text:e},s(this,Ut).emitEffect(e.toString(),{type:tm.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,Ut).emitEffect(t,{type:tm.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}};Ut=new WeakMap;import{EffectType as iO,RealtimeSubscriptionStatus as _b}from"@devvit/protos";var Bt,rt,Dt,Sr,Ps,im,Bd=class Bd{constructor(e,t){l(this,Ps);l(this,Bt);l(this,rt);l(this,Dt);l(this,Sr);d(this,Bt,t.context),d(this,rt,!!t.context._devvitContext?.debug.realtime),d(this,Sr,e),d(this,Dt,t.invalidate);let i=t.context.meta[D.App]?.values[0];if(!i)throw Error("useChannel missing app ID metadata");let n=t.context.meta[D.Installation]?.values[0];if(!n)throw Error("useChannel missing install ID from metadata");let o=`${i}:${n}:${e.name}`;if(Object.values(s(this,Bt).hooks).filter(c=>c instanceof Bd).some(c=>c.state.channel===o))throw Error(`useChannel channel names must be unique; "${o}" duplicated`);this.state={channel:o,connected:!1,subscribed:!1}}async onUIEvent(e){let t=e.realtimeEvent;if(!(!t||!this.state.subscribed))switch(t.status){case _b.REALTIME_SUBSCRIBED:s(this,rt)&&console.debug(`[realtime] "${this.state.channel}" connected`),this.state.connected=!0,s(this,Dt).call(this),await s(this,Sr).onSubscribed?.();break;case _b.REALTIME_UNSUBSCRIBED:s(this,rt)&&console.debug(`[realtime] "${this.state.channel}" disconnected`),this.state.connected=!1,s(this,Dt).call(this),await s(this,Sr).onUnsubscribed?.();break;default:s(this,rt)&&console.debug(`[realtime] "${this.state.channel}" received message: ${JSON.stringify(e,void 0,2)}`),s(this,Sr).onMessage(t.event?.data??{});break}}async send(e){if(s(this,rt)&&console.debug(`[realtime] "${this.state.channel}" send message: ${JSON.stringify(e,void 0,2)}`),!this.state.subscribed||!this.state.connected)throw console.debug(`[realtime] "${this.state.channel}" send failed; channel not connected`),Error(`useChannel send failed; "${this.state.channel}" channel not connected`);await s(this,Bt).devvitContext.realtime.send(this.state.channel,e)}get status(){return this.state.subscribed&&this.state.connected?2:this.state.subscribed&&!this.state.connected?1:!this.state.subscribed&&this.state.connected?3:4}subscribe(){this.state.subscribed||(s(this,rt)&&console.debug(`[realtime] "${this.state.channel}" subscribed`),this.state.subscribed=!0,s(this,Dt).call(this),S(this,Ps,im).call(this))}unsubscribe(){this.state.subscribed&&(s(this,rt)&&console.debug(`[realtime] "${this.state.channel}" unsubscribed`),this.state.subscribed=!1,s(this,Dt).call(this),S(this,Ps,im).call(this))}};Bt=new WeakMap,rt=new WeakMap,Dt=new WeakMap,Sr=new WeakMap,Ps=new WeakSet,im=function(){let e=Object.values(s(this,Bt).hooks).filter(t=>t instanceof Bd&&t.state.subscribed).map(t=>t.state.channel);s(this,Bt).emitEffect(this.state.channel,{type:iO.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:e}})};var rm=Bd;function nm(r){if(!r.name||/[^a-zA-Z0-9_]/.test(r.name))throw Error(`useChannel error: The name "${r.name}" you provided for the hook is invalid. Valid names can only contain letters, numbers, and underscores (_).`);let e=`useChannel:${r.name}`;return $e({id:e,namespace:e},t=>new rm(r,t))}import{EffectType as sm}from"@devvit/protos";function Nb(r){return typeof r=="object"&&r!==null&&"__deleted"in r}var Pr,Ei=class Ei{constructor(e,t){l(this,Pr);this._segments=[];this._hooks={};this._prevHookId="";this._effects={};this._changed={};this._touched={};this._requeueEvents=[];this._rootProps={};this._generated={};this._undeliveredHandlers={};this.request=e,this.meta=t,d(this,Pr,e.state??{__cache:{}}),this._rootProps=e.props??{}}get devvitContext(){if(!this._devvitContext)throw new Error("Devvit context not available");return this._devvitContext}set devvitContext(e){this._devvitContext=e}get _changedState(){let e={__cache:s(this,Pr).__cache??{}};for(let i in this._changed)e[i]=this._state[i];let t=new Set(Object.keys(this._state));return Object.keys(this._hooks).forEach(i=>{i!=="__cache"&&t.delete(i)}),t.forEach(i=>{if(i==="__cache")return;let n={__deleted:!0};this._state[i]=e[i]=n}),e}get hooks(){return this._hooks}get _state(){return s(this,Pr)}set _state(e){this._changed={},this._hooks={},d(this,Pr,e)}push(e){this._segments.push({...e,next:0})}pop(){this._segments.pop()}addUndeliveredEventHandler(e,t){this._undeliveredHandlers[e]=t}addGlobalUndeliveredEventHandler(e,t){Ei.addGlobalUndeliveredEventHandler(e,t)}getHook(e){return this._hooks[e.id]}static addGlobalUndeliveredEventHandler(e,t){Ei._staticUndeliveredHandlers[e]=t}async handleUndeliveredEvent(e){let t={...Ei._staticUndeliveredHandlers,...this._undeliveredHandlers};for(let[i,n]of Object.entries(t))await n(e,this)}emitEffect(e,t){this._effects[e]=t}addToRequeueEvents(...e){this._devvitContext?.debug.blocks&&console.debug("[blocks] requeueing events",e);let t=e.reduce((i,n)=>(n.retry?i.retry.push(n):i.normal.push(n),i),{retry:[],normal:[]});this._requeueEvents=[...t.retry,...this._requeueEvents,...t.normal]}get effects(){return Object.values(this._effects)}nextHookId(e){e.key===void 0&&(e.key=this._segments[this._segments.length-1].next+++""),this.push(e);try{let t=[];for(let n=this._segments.length-1;n>=0;n--){let o=this._segments[n];if(o.id){t.unshift(o.id);break}let a=[];o.namespace&&a.push(o.namespace),o.key!==void 0&&o.key!==!1&&a.push(o.key),t.unshift(a.join("-"))}let i=t.join(".");if(this._generated[i]&&!e.shared)throw new Error(`Hook id ${i} already used, cannot register another hook with the same id`);return this._generated[i]=!0,this._prevHookId=i,i}finally{this.pop()}}};Pr=new WeakMap,Ei._staticUndeliveredHandlers={};var Ri=Ei;var _t={};Ri.addGlobalUndeliveredEventHandler("intervals",async(r,e)=>{r.timer&&r.hook&&(delete _t[r.hook],e.emitEffect("timers",{type:sm.EFFECT_SET_INTERVALS,interval:{intervals:_t}}))});var Nt,Oi,Cs,Fi,om=class{constructor(e,t,i){l(this,Nt);l(this,Oi);l(this,Cs);l(this,Fi);this.state={duration:{seconds:0,nanos:0},running:!1};d(this,Oi,i.invalidate),d(this,Nt,i.hookId),d(this,Cs,e),d(this,Fi,i.context);let n=Math.floor(t/1e3),o=t%1e3*1e6;this.state.duration={seconds:n,nanos:o}}onStateLoaded(){this.state.running?_t[s(this,Nt)]={duration:this.state.duration}:delete _t[s(this,Nt)]}async onUIEvent(e){await s(this,Cs).call(this)}start(){_t[s(this,Nt)]={duration:this.state.duration},this.state.running=!0,s(this,Oi).call(this),s(this,Fi).emitEffect("timers",{type:sm.EFFECT_SET_INTERVALS,interval:{intervals:_t}})}stop(){delete _t[s(this,Nt)],this.state.running=!1,s(this,Oi).call(this),s(this,Fi).emitEffect("timers",{type:sm.EFFECT_SET_INTERVALS,interval:{intervals:_t}})}};Nt=new WeakMap,Oi=new WeakMap,Cs=new WeakMap,Fi=new WeakMap;function am(r,e){let t=$e({namespace:"useInterval"},i=>new om(r,e,i));return{start:()=>t.start(),stop:()=>t.stop()}}var Cr=class extends Error{};var dm="ServerCallRequired";function qb(r){return r?.message===dm}var Hb=_n(Yc(),1);function um(r){if(r instanceof Error){if(r.message===dm)throw r;return{message:r.message,details:r.stack??""}}else return{message:"Unknown error",details:wi.caughtToString(r)}}var it,gt,Is,Mi,ws,Ir,lm=class{constructor(e,t,i){l(this,it);l(this,gt);l(this,Is);l(this,Mi);l(this,ws);l(this,Ir);d(this,it,!!i.context.devvitContext.debug.useAsync),s(this,it)&&console.debug("[useAsync] v1",t),this.state={data:null,load_state:"initial",error:null,depends:null},d(this,gt,i.hookId),d(this,Is,e),d(this,Mi,i.invalidate),d(this,ws,i.context),d(this,Ir,t.depends??null)}onStateLoaded(){if(this.state.load_state!=="disabled"&&(s(this,it)&&console.debug("[useAsync] async onLoad ",s(this,gt),this.state),s(this,it)&&console.debug("[useAsync] async onLoad have ",s(this,Ir),"and",this.state.depends),!(0,Hb.default)(s(this,Ir),this.state.depends)||this.state.load_state==="initial")){this.state.load_state="loading",this.state.depends=s(this,Ir),s(this,Mi).call(this);let e={hook:s(this,gt),async:!0,asyncRequest:{requestId:s(this,gt)+"-"+JSON.stringify(this.state.depends)}};s(this,it)&&console.debug("[useAsync] onLoad requeue"),s(this,ws).addToRequeueEvents(e)}}async onUIEvent(e,t){if(e.asyncRequest){let i={requestId:e.asyncRequest.requestId};try{i.data={value:await s(this,Is).call(this)}}catch(o){i.error=um(o)}let n={asyncResponse:i,hook:s(this,gt)};s(this,it)&&console.debug("[useAsync] onReq requeue"),t.addToRequeueEvents(n)}else if(e.asyncResponse){let i=s(this,gt)+"-"+JSON.stringify(this.state.depends);e.asyncResponse.requestId===i?(this.state={...this.state,data:e.asyncResponse.data?.value,error:e.asyncResponse.error??null,load_state:e.asyncResponse.error?"error":"loaded"},s(this,Mi).call(this)):s(this,it)&&console.debug("[useAsync] onResp skip, stale event")}else throw new Error("Unknown event type")}};it=new WeakMap,gt=new WeakMap,Is=new WeakMap,Mi=new WeakMap,ws=new WeakMap,Ir=new WeakMap;function nO(r,e={}){let t=$e({namespace:"useAsync"},i=>new lm(r,e,i));return{data:t.state.data,error:t.state.error,loading:t.state.load_state==="loading"}}var ht,xs,wr,Li,xr,cm=class{constructor(e,t){this.state={value:null,load_state:"initial",error:null};l(this,ht);l(this,xs);l(this,wr);l(this,Li);l(this,xr);d(this,wr,e),d(this,Li,t.hookId),d(this,ht,t.invalidate),d(this,xs,t.context)}async onUIEvent(){if(this.state.load_state==="loading"&&s(this,xr)){try{this.state.value=await s(this,xr),this.state.load_state="loaded"}catch(e){this.state.load_state="error",this.state.error=um(e)}s(this,ht).call(this)}else console.warn("Invalid state: ",this.state.load_state,s(this,xr))}setter(e){this.state.value=e instanceof Function?e(this.state.value):e,this.state.load_state="loaded",s(this,ht).call(this)}onStateLoaded(){if(this.state.load_state==="loading")throw new Cr;if(this.state.load_state==="error")throw new Error(this.state.error?.message??"Unknown error");if(this.state.load_state==="initial"){let e;try{e=s(this,wr)instanceof Function?s(this,wr).call(this):s(this,wr)}catch(t){console.log("error in loading async",t),this.state.load_state="error",s(this,ht).call(this);return}if(e instanceof Promise){d(this,xr,e),this.state.load_state="loading";let t={asyncRequest:{requestId:s(this,Li)},hook:s(this,Li)};throw s(this,xs).addToRequeueEvents(t),s(this,ht).call(this),new Cr}else this.state.value=e,this.state.load_state="loaded";s(this,ht).call(this)}}};ht=new WeakMap,xs=new WeakMap,wr=new WeakMap,Li=new WeakMap,xr=new WeakMap;function mm(r){let e=$e({namespace:"useState"},t=>new cm(r,t));return[e.state.value,e.setter.bind(e)]}var hm={now(){return new Date}};function jb(r){return`__autocache__${r}`}function Wb(r){return`__lock__${r}`}var sO=300,oO=1e3,Dd=5e3,pm=3,Gb=.1,Vb=1e3,aO=3e4;function zb(r){if(r.error)throw new Error(r.error);return r.value}var qt,Ht,_e,Ui,$,Jb,$b,Kb,fm,Xb,Zb,gm,Yb,_d=class{constructor(e,t,i=hm){l(this,$);l(this,qt);l(this,Ht,{});l(this,_e);l(this,Ui);d(this,qt,e),d(this,Ui,t),d(this,_e,i)}async cache(e,t){var a;(a=s(this,Ui)).__cache??(a.__cache={}),d(this,Ht,s(this,Ui).__cache),S(this,$,Yb).call(this,t);let i=S(this,$,Jb).call(this,t.key);if(i!==void 0)return i;let n=await S(this,$,gm).call(this,t.key),o=await S(this,$,$b).call(this,t,n,e);return zb(o)}};qt=new WeakMap,Ht=new WeakMap,_e=new WeakMap,Ui=new WeakMap,$=new WeakSet,Jb=function(e){let t=s(this,Ht)[e];if(t){let i=s(this,_e).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<pm&&Math.random()<Gb&&t.errorTime+Vb<i;if(t?.expires&&t.expires<i&&t.checkedAt+Vb<i||n){delete s(this,Ht)[e];return}else return zb(t)}},$b=async function(e,t,i){let n=t?.expires,o=n?S(this,$,Zb).call(this,n):1;return!t||t?.error&&t.errorCount<pm&&Gb>Math.random()||o>Math.random()?S(this,$,Kb).call(this,e,t,i):t},Kb=async function(e,t,i){let n=Wb(e.key),o=s(this,_e).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,qt).set(n,"1",{expiration:a,nx:!0}))return S(this,$,Xb).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,_e).now();return S(this,$,fm).call(this,p,e.key,e.ttl)}},fm=async function(e,t,i){let n=Math.min(i,oO),o=await S(this,$,gm).call(this,t);if(o)return o;if(s(this,_e).now().getTime()-e.getTime()>=n)throw new Error(`Cache request timed out trying to get data at key: ${t}`);return await new Promise(a=>setTimeout(a,sO)),S(this,$,fm).call(this,e,t,i)},Xb=async function(e,t,i,n){let o=s(this,_e).now().getTime()+n;t=t??{value:null,expires:o,errorCount:0,error:null,errorTime:null,checkedAt:0};try{t.value=await i(),t.error=null,t.errorCount=0,t.errorTime=null}catch(a){t.value=null,t.error=a.message??"Unknown error",t.errorTime=s(this,_e).now().getTime(),t.errorCount++}return s(this,Ht)[e]=t,await s(this,qt).set(jb(e),JSON.stringify(t),{expiration:new Date(o+aO)}),t.error&&t.errorCount<pm&&await s(this,qt).del(Wb(e)),t},Zb=function(e){let t=s(this,_e).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},gm=async function(e){let t=await s(this,qt).get(jb(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,_e).now().getTime(),s(this,Ht)[e]=i,i}},Yb=function(e){e.ttl<Dd&&(console.warn(`Cache TTL cannot be less than ${Dd} milliseconds! Updating ttl value of ${e.ttl} to ${Dd}.`),e.ttl=Dd)};function Qb(r,e,t=hm){let i=new _d(r,e,t);return i.cache.bind(i)}var Nd=class{buildContext(e,t,i){let n=new ci(i),o=new li(i),a=new hi(i),c=new fi(i),p=new vi(i),f=new yi(i),v=new Ud(e),m=new ui(i),b=new ai,y=new mi(i),C=Qb(a,e._state),I={modLog:n,kvStore:o,redis:a,reddit:c,scheduler:p,settings:f,media:m,assets:b,realtime:y,ui:v,useState:mm,useChannel:nm,useInterval:am,useForm:em,cache:C,dimensions:t.env?.dimensions,uiEnvironment:{timezone:i[D.Timezone]?.values[0],locale:i[D.Language]?.values[0],dimensions:t.env?.dimensions}},T=de(i,t.props?.postId);return T.debug.effects=e,{...T,...I}}};var ye=null;function ek(r){return JSON.parse(JSON.stringify(r))}function dO(r){if(!(r!==""&&!/[-.]/.test(r)))throw new Error(`Hook with namespace '${r}' is invalid. Hook namespaces cannot be empty string or contain dashes/dots because they are used as delimiters internally. Please update the hook namespace and try again.`)}function lO(r){return r.blocking||r.resize?!1:!r.hook}function $e(r,e){if(!ye)throw new Error("Hooks can only be declared at the top of a component. You cannot declare hooks outside of components or inside of event handlers. It's almost always a mistake to declare hooks inside of loops or conditionals.");dO(r.namespace);let t=ye.nextHookId(r),i=ye;i._touched[t]=!0;let n={hookId:t,invalidate:()=>{i._changed[t]=!0,i._state[t]=i?._hooks[t]?.state},context:ye},o=ye._state[t]===void 0||Nb(ye._state[t]);ye._hooks[t]=ye._hooks[t]??e(n);let a=ye._hooks[t];return o||(a.state=ye._state[t]),a.onStateLoaded?.(),o&&a.state!==void 0&&a.state!==null&&n.invalidate(),a}var uO=null,Bi,Wd,Ts,A,be,qd,tk,vm,rk,ym,bm,Hd,km,ik,jd=class{constructor(e){l(this,A);l(this,Bi);l(this,Wd,new Nd);l(this,Ts,new Ii(()=>this._latestRenderContext?.devvitContext?.assets));this._latestRenderContext=null;s(this,A,be)&&console.debug("[blocks] BlocksHandler v1"),d(this,Bi,e),uO=this}async handle(e,t){let i=new Ri(e,t),n=s(this,Wd).buildContext(i,e,t);i.devvitContext=n;let o,a=e.events,p=!e.events?.length||a.some(y=>!y.async),f=a.some(y=>y.blocking),v,m,b=[...a];for(a.length===0&&a.push({}),s(this,A,be)&&console.debug("[blocks] starting processing events");a.length>0;){s(this,A,be)&&console.debug("[blocks] processing events loop iteration",a.length);let y=[];if(!a[0].async)y.push(a.shift());else for(;a[0]?.async;)y.push(a.shift());if(!y.length)throw Error("batch must have at least one event");try{if(y[0].async){let I=ek(i._state);await S(this,A,tk).call(this,i,...y),i._state=I}else await S(this,A,rk).call(this,i,...y)}catch(I){if(!qb(I))throw I;if(s(this,A,be)&&console.debug("[blocks] caught in handler",I),i._latestRenderContent=void 0,m){i._state=m._state,i._changed=v,i._effects=m._effects;let T=b.map(M=>{let ue={...M};return ue.retry=!0,ue});i.addToRequeueEvents(...T);break}else throw console.error("[blocks] unhandled error in handler",I),I}s(this,A,be)&&console.debug("[blocks] remaining events",i._requeueEvents);let C=[];for(let I of i._requeueEvents){if(!p&&!I.async){s(this,A,be)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch A",I),C.push(I);continue}if(p&&I.async&&!f){s(this,A,be)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch B",I),C.push(I);continue}s(this,A,be)&&console.debug("[blocks] reprocessing event in BlocksHandler",I),a.push(I)}i._requeueEvents=C,a.length>0&&(v={...i._changed},m={_state:ek(i._state),_effects:{...i._effects}},b=[...a])}if(p){i._latestRenderContent||(i._latestRenderContent=S(this,A,ym).call(this,s(this,Bi),i.request.props??{},i));let y=i._latestRenderContent;y&&(o=s(this,Ts).createBlocksElementOrThrow(y),o=s(this,Ts).ensureRootBlock(o))}return{state:i._changedState,effects:i.effects,blocks:o,events:i._requeueEvents}}};Bi=new WeakMap,Wd=new WeakMap,Ts=new WeakMap,A=new WeakSet,be=function(){return!!this._latestRenderContext?.devvitContext.debug.blocks},qd=function(e,...t){e._touched={},S(this,A,ym).call(this,s(this,Bi),e.request.props??{},e);for(let i in e._hooks)e._touched[i]||delete e._hooks[i]},tk=async function(e,...t){S(this,A,qd).call(this,e,...t),await Promise.all(t.map(async i=>{if(!i.async)throw new Error("You can't mix main and other queues in one batch. This is likely a platform bug. Please file an issue in the Discord for someone to help! https://discord.com/channels/1050224141732687912/1115441897079574620");await S(this,A,vm).call(this,e,i)}))},vm=async function(e,t){lO(t)&&console.warn("Received an event in #attemptHook that does not have an associated hook. This will cause the event to be undelivered and may cause bugs. Make sure that event passes a hook field. Event:",{event:t});let i=e._hooks[t.hook];if(i?.onUIEvent)try{await i.onUIEvent(t,e)}catch(n){throw console.error("Error in event handler",n),n}else await e.handleUndeliveredEvent(t)},rk=async function(e,...t){for(let i of t)s(this,A,be)&&console.log("[blocks] handling main queue event",i),s(this,A,be)&&console.log("[blocks] before",e._state),S(this,A,qd).call(this,e,i),await S(this,A,vm).call(this,e,i),s(this,A,be)&&console.log("[blocks] after",e._state);S(this,A,qd).call(this,e)},ym=function(e,t,i){s(this,A,be)&&console.debug("[blocks] renderRoot"),i._generated={},ye=i,this._latestRenderContext=i;try{let n=S(this,A,bm).call(this,e,t,i);if(n.length!==1)throw new Error(`There can only be one root element, received: ${n.length}. Please wrap these elements in a <vstack></vstack> or <hstack></hstack> to continue. Fragments cannot be used as a root element.`);let o=n[0];if(o==="[object Promise]")throw new Error('Root elements cannot be asynchronous. To use data from an async endpoint, please use "const [data] = context.useState(async () => {/** your async code */})".');if(typeof o=="string")throw new Error("The root element must return a valid block, not a string. Try wrapping the element in a <text>your content</text> tag to continue.");return i._latestRenderContent=o,o}catch(n){if(n instanceof Cr)return;throw n}finally{ye=null}},bm=function(e,t,i){i.push({namespace:e.name||"anonymous",...t});try{let n=e(t,i.devvitContext);return S(this,A,km).call(this,n,i)}finally{i.pop()}},Hd=function(e,t){return e=e.flat(1/0),e.flatMap((i,n)=>(i&&typeof i=="object"&&"props"in i&&(i.props?.key||(i.props=i.props??{},i.props.key=`${n}`)),S(this,A,km).call(this,i,t)))},km=function(e,t){if(Array.isArray(e))return S(this,A,Hd).call(this,e,t);if(cO(e))if(e.type===void 0){t.push({namespace:"fragment",...e.props});let i=S(this,A,Hd).call(this,e.children,t);return t.pop(),i}else if(typeof e.type=="function"){let i={...e.props,children:e.children};return S(this,A,bm).call(this,e.type,i,t)}else{t.push({namespace:e.type,...e.props});let i=S(this,A,Hd).call(this,e.children,t),n=S(this,A,ik).call(this,e.props??{});return t.pop(),[{type:e.type,children:i,props:n}]}else return[(e??"").toString()]},ik=function(e){let t={};for(let i in e)if(!(typeof e[i]>"u"))if(typeof e[i]=="function"){let n=$e({namespace:i,key:!1},({hookId:o})=>({hookId:o,state:null,onUIEvent:e[i]}));t[i]=n.hookId,"captureHookRef"in e[i]&&e[i].captureHookRef()}else{let n=JSON.parse(JSON.stringify(e[i]));n!=null&&(t[i]=n)}return t};function cO(r){return typeof r=="object"&&r!=null&&"type"in r}var mO=[[nk,nk.methods.renderPostContent,(r,e)=>u.customPostType?.render(e)??null]];function pO(r){return async(e,t)=>new jd(r).handle(e,t)}function sk(r){for(let[e,t,i]of mO)r.provides(e),U(t.name,pO(i))}var Di,As,_i,Tr,Ar,Ni,qi,Er,jt,Es,Rs,Rr,N,B=class B extends ud{static configure(e){d(this,_i,{...s(this,_i),...e}),mt(e.http)&&this.use(P.HTTPDefinition),(mt(e.kvStore)||mt(e.redis))&&(this.use(P.KVStoreDefinition),this.use(P.RedisAPIDefinition)),mt(e.media)&&this.use(P.MediaServiceDefinition),mt(e.modLog)&&this.use(P.ModlogDefinition),mt(e.redditAPI)&&(this.use(P.FlairDefinition),this.use(P.GraphQLDefinition),this.use(P.LinksAndCommentsDefinition),this.use(P.ListingsDefinition),this.use(P.ModerationDefinition),this.use(P.ModNoteDefinition),this.use(P.NewModmailDefinition),this.use(P.PrivateMessagesDefinition),this.use(P.SubredditsDefinition),this.use(P.PostCollectionsDefinition),this.use(P.UsersDefinition),this.use(P.WidgetsDefinition),this.use(P.WikiDefinition),this.use(P.RedditAPIV2Definition)),mt(e.realtime)&&this.use(P.RealtimeDefinition)}static addMenuItem(e){s(this,qi).push(e)}static addCustomPostType(e){d(this,Tr,e)}static createForm(e,t){let i=`form.${s(this,Ar).size}`;return s(this,Ar).set(i,{form:e,onSubmit:t}),i}static addSchedulerJob(e){if(s(this,N)[P.SchedulerDefinition.fullName]||this.use(P.SchedulerDefinition),s(this,Er).has(e.name))throw new Error(`Job ${e.name} is already defined`);s(this,Er).set(e.name,e.onRun)}static addSettings(e){cr(e);let t=e.filter(n=>n.type==="group"||!n.scope||n.scope==="installation"),i=e.filter(n=>n.type!=="group"&&n.scope==="app");t.length>0&&d(this,Ni,t),i.length>0&&d(this,Di,i),s(this,N)[P.SettingsDefinition.fullName]||this.use(P.SettingsDefinition)}static addTrigger(e){if("events"in e){for(let t of e.events)this.addTrigger({event:t,onEvent:(i,n)=>e.onEvent(i,n)});return this}return s(this,jt).has(e.event)?s(this,jt).get(e.event)?.push(e.onEvent):s(this,jt).set(e.event,[e.onEvent]),B}static provide(e){s(this,Rs).push(e)}static use(e,t){s(this,Rr)[e.fullName]={def:e,options:t??{},handler:void 0};let i={};for(let n of Object.values(e.methods))i[n.name]=(o,a)=>s(this,Rr)[e.fullName].handler?.[n.name]?.(n.requestType?.fromPartial(o??{}),a);return s(this,N)[e.fullName]=i,i}static get redditAPIPlugins(){if(!mt(s(this,_i).redditAPI))throw new Error("Reddit API is not enabled. You can enable it by passing `redditAPI: true` to `Devvit.configure`.");return{Flair:s(this,N)[P.FlairDefinition.fullName],GraphQL:s(this,N)[P.GraphQLDefinition.fullName],LinksAndComments:s(this,N)[P.LinksAndCommentsDefinition.fullName],Listings:s(this,N)[P.ListingsDefinition.fullName],Moderation:s(this,N)[P.ModerationDefinition.fullName],ModNote:s(this,N)[P.ModNoteDefinition.fullName],NewModmail:s(this,N)[P.NewModmailDefinition.fullName],PrivateMessages:s(this,N)[P.PrivateMessagesDefinition.fullName],Subreddits:s(this,N)[P.SubredditsDefinition.fullName],PostCollections:s(this,N)[P.PostCollectionsDefinition.fullName],Users:s(this,N)[P.UsersDefinition.fullName],Widgets:s(this,N)[P.WidgetsDefinition.fullName],Wiki:s(this,N)[P.WikiDefinition.fullName]}}static get modLogPlugin(){let e=s(this,N)[P.ModlogDefinition.fullName];if(!e)throw new Error("ModLog is not enabled. You can enable it by passing `modLog: true` to `Devvit.configure`");return e}static get schedulerPlugin(){let e=s(this,N)[P.SchedulerDefinition.fullName];if(!e)throw new Error("Scheduler is not enabled. You can enable it by calling `Devvit.addSchedulerJob` at the top level of your app.");return e}static get kvStorePlugin(){let e=s(this,N)[P.KVStoreDefinition.fullName];if(!e)throw new Error("Key Value Store is not enabled. You can enable it by passing `kvStore: true` to `Devvit.configure`");return e}static get redisPlugin(){let e=s(this,N)[P.RedisAPIDefinition.fullName];if(!e)throw new Error("Redis is not enabled. You can enable it by passing `redis: true` to `Devvit.configure`");return e}static get mediaPlugin(){let e=s(this,N)[P.MediaServiceDefinition.fullName];if(!e)throw new Error("MediaService is not enabled. You can enable it by passing `media: true` to `Devvit.configure`");return e}static get redditapiv2Plugin(){let e=s(this,N)[P.RedditAPIV2Definition.fullName];if(!e)throw new Error("RedditAPIV2 is not enabled. You can enable it by passing `apiV2: true` to `Devvit.configure`");return e}static get settingsPlugin(){let e=s(this,N)[P.SettingsDefinition.fullName];if(!e)throw new Error("Settings must first be configured with `Devvit.addSettings()` before they can be accessed");return e}static get realtimePlugin(){let e=s(this,N)[P.RealtimeDefinition.fullName];if(!e)throw new Error("Realtime is not enabled. You can enable it by passing `realtime: true` to `Devvit.configure`");return e}static get menuItems(){return s(this,qi)}static get customPostType(){return s(this,Tr)}static get formDefinitions(){return s(this,Ar)}static get scheduledJobHandlers(){return s(this,Er)}static get installationSettings(){return s(this,Ni)}static get appSettings(){return s(this,Di)}static get triggerOnEventHandlers(){return s(this,jt)}static get assets(){return s(this,As)}static get webviewAssets(){return s(this,Es)}constructor(e){super(e),d(B,As,e.assets??{}),d(B,Es,e.webviewAssets??{});for(let t in s(B,Rr)){let i=s(B,Rr)[t];i.handler=e.use(i.def,i.options)}s(B,qi).length>0&&Dy(e),s(B,Er).size>0&&_y(e),s(B,Tr)&&(Ly(e),sk(e)),(s(B,Tr)||s(B,Ar).size>0)&&Lb(e),s(B,Ni)&&Uy(e),s(B,Di)&&my(e),s(B,jt).size>0&&Ny(e);for(let t of s(B,Rs))e.provides(t)}};Di=new WeakMap,As=new WeakMap,_i=new WeakMap,Tr=new WeakMap,Ar=new WeakMap,Ni=new WeakMap,qi=new WeakMap,Er=new WeakMap,jt=new WeakMap,Es=new WeakMap,Rs=new WeakMap,Rr=new WeakMap,N=new WeakMap,B.debug={},l(B,Di),l(B,As,{}),l(B,_i,{}),l(B,Tr),l(B,Ar,new Map),l(B,Ni),l(B,qi,[]),l(B,Er,new Map),l(B,jt,new Map),l(B,Es,{}),l(B,Rs,[]),l(B,Rr,{}),l(B,N,{});var u=B;(e=>{function r(t,i,...n){return{type:t,props:i,children:n}}e.createElement=r})(u||(u={}));function K(r){let e=Object.getOwnPropertyDescriptors(r.constructor.prototype);for(let[t,i]of Object.entries(e))i.get&&Object.defineProperty(r,t,{...i,enumerable:!0})}var Sm;(function(r){r[r.bold=1]="bold",r[r.italic=2]="italic",r[r.underline=4]="underline",r[r.strikethrough=8]="strikethrough",r[r.subscript=16]="subscript",r[r.superscript=32]="superscript",r[r.monospace=64]="monospace"})(Sm||(Sm={}));var ok="text",ak="raw",dk="br",lk="link",uk="c/",ck="p/",mk="r/",pk="u/",fk="@",gk="spoilertext",hk="par",vk="h",yk="hr",bk="blockquote",kk="code",Sk="li",Pk="list",Ck="L",Ik="R",wk="C",xk="table",Tk="embed",Ak="img",Ek="gif",Rk="video";function Ok(r){return{e:Ek,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function Fk(r,e){let t={},i=[];return Object.assign(t,Os(t,i),Fs(t,i),Ms(t,i),Bs(t,i),Ds(t,i),_s(t,i)),e(t),{e:bk,c:i,...r.author&&{a:r.author}}}function Mk(r,e){let t={},i=[];return Object.assign(t,Cm(t,i)),e(t),{e:kk,c:i,...r.language&&{l:r.language}}}function Lk(r){return{e:uk,t:r.permalink}}function Uk(r,e){let t={},i=[];return Object.assign(t,Cm(t,i),Us(t,i)),e(t),{e:vk,l:r.level,c:i}}function Bk(r){return{e:Tk,u:r.sourceUrl,c:r.contentUrl,x:r.width,y:r.height}}function Dk(){return{e:yk}}function _k(r){return{e:Ak,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function Nk(){return{e:dk}}function qk(r){return{e:lk,t:r.text,u:r.url,...r.formatting&&{f:r.formatting},...r.tooltip&&{a:r.tooltip}}}function Hk(r,e){let t={},i=[];return Object.assign(t,iS(t,i)),e(t),{e:Pk,o:r.ordered,c:i}}function jk(r){let e={},t=[];return Object.assign(e,Os(e,t),Fs(e,t),Ms(e,t),Gd(e,t),Bs(e,t),Ds(e,t),_s(e,t)),r(e),{e:Sk,c:t}}function Wk(r){let e={},t=[];return Object.assign(e,Vd(e,t),Us(e,t),Pm(e,t),Im(e,t),Ls(e,t)),r(e),{e:hk,c:t}}function Gk(r){return{e:ck,t:r.permalink}}function Vk(r){return{e:ak,t:r}}function zk(r){let e={},t=[];return Object.assign(e,Vd(e,t),Us(e,t),Pm(e,t)),r(e),{e:gk,c:t}}function Jk(r){return{e:mk,t:r.subredditName,l:r.showPrefix}}function $k(r){let e={},t=[],i=[];return Object.assign(e,nS(e,t,i)),r(e),{e:xk,h:t,c:i}}function Kk(r){let[e,t]=rS();return r(e),{c:t}}function Xk(r,e){let[t,i]=rS();e(t);let n;switch(r.columnAlignment){case"left":n=Ck;break;case"right":n=Ik;break;case"center":n=wk;break}return{...n&&{a:n},...i&&{c:i}}}function Zk(r){let e={},t=[];return Object.assign(e,sS(e,t)),r(e),t}function Yk(r){return{e:ok,t:r.text,...r.formatting&&{f:r.formatting}}}function Qk(r){return{e:pk,t:r.username,l:r.showPrefix}}function eS(r){return{e:fk,t:r.username,l:r.showPrefix}}function tS(r){return{e:Rk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur},...r.thumbnail&&{p:r.thumbnail},...r.convertToGif&&{gifify:r.convertToGif}}}function rS(){let r={},e=[];return Object.assign(r,Vd(r,e),Us(r,e),Im(r,e),Ls(r,e)),[r,e]}function Os(r,e){return{blockQuote(t,i){return e.push(Fk(t,i)),r}}}function Fs(r,e){return{codeBlock(t,i){return e.push(Mk(t,i)),r}}}function oS(r,e){return{embed(t){return e.push(Bk(t)),r}}}function Ms(r,e){return{heading(t,i){return e.push(Uk(t,i)),r}}}function Gd(r,e){return{horizontalRule(){return e.push(Dk()),r}}}function Ls(r,e){return{image(t){return e.push(_k(t)),r},animatedImage(t){return e.push(Ok(t)),r}}}function Pm(r,e){return{linebreak(){return e.push(Nk()),r}}}function Us(r,e){return{link(t){return e.push(qk(t)),r},commentLink(t){return e.push(Lk(t)),r},postLink(t){return e.push(Gk(t)),r},subredditLink(t){return e.push(Jk(t)),r},userLink(t){return e.push(Qk(t)),r},userMention(t){return e.push(eS(t)),r}}}function Bs(r,e){return{list(t,i){return e.push(Hk(t,i)),r}}}function iS(r,e){return{item(t){return e.push(jk(t)),r}}}function Ds(r,e){return{paragraph(t){return e.push(Wk(t)),r}}}function Cm(r,e){return{rawText(t){return e.push(Vk(t)),r}}}function Im(r,e){return{spoiler(t){return e.push(zk(t)),r}}}function nS(r,e,t){return{headerCell(i,n){return e.push(Xk(i,n)),r},row(i){return t.push(Zk(i)),r}}}function _s(r,e){return{table(t){return e.push($k(t)),r}}}function sS(r,e){return{cell(t){return e.push(Kk(t)),r}}}function Vd(r,e){return{text(t){return e.push(Yk(t)),r}}}function aS(r,e){return{video(t){return e.push(tS(t)),r}}}var fO=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},gO=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},zd,Ns=class{constructor(){zd.set(this,void 0);let e=[];Object.assign(this,Ds(this,e),Ms(this,e),Gd(this,e),Os(this,e),Fs(this,e),oS(this,e),Bs(this,e),_s(this,e),Ls(this,e),aS(this,e)),fO(this,zd,{document:e},"f")}build(){return JSON.stringify(gO(this,zd,"f"))}paragraph(e){return this}heading(e,t){return this}horizontalRule(){return this}blockQuote(e,t){return this}codeBlock(e,t){return this}embed(e){return this}list(e,t){return this}table(e){return this}image(e){return this}animatedImage(e){return this}video(e){return this}};zd=new WeakMap;function Hi(r){let e;return r instanceof Ns?e=r.build():typeof r=="object"?e=JSON.stringify(r):e=r,e}var dS=100,lS=1/0,Or,Fr,Wt,ji,Wi,Jd,j=class{constructor(e){l(this,Wi);l(this,Or);l(this,Fr);l(this,Wt);l(this,ji,!1);this.pageSize=dS;this.limit=lS;this.children=[];K(this),this._fetch=e.fetch,this.pageSize=e.pageSize??dS,this.limit=e.limit??lS,d(this,Fr,e.after),d(this,Or,e.before),d(this,Wt,e.more),e.children&&(this.children=e.children)}get hasMore(){return!s(this,ji)||!!(s(this,Fr)||s(this,Or)||s(this,Wt))}async*[Symbol.asyncIterator](){let e=0;for(;;){if(e===this.children.length)if(this.hasMore){if((await S(this,Wi,Jd).call(this)).length===0)break}else break;if(yield this.children[e],e++,e===this.limit)break}}setMore(e){d(this,Wt,e)}preventInitialFetch(){d(this,ji,!0)}async all(){for(;this.hasMore&&this.children.length<this.limit;)await S(this,Wi,Jd).call(this);return this.children.slice(0,this.limit)}async get(e){let t=e<=this.limit?e:this.limit;for(;this.hasMore&&this.children.length<t;)await S(this,Wi,Jd).call(this);return this.children.slice(0,t)}};Or=new WeakMap,Fr=new WeakMap,Wt=new WeakMap,ji=new WeakMap,Wi=new WeakSet,Jd=async function(){if(!this.hasMore)throw new Error("This listing does not have any more items to load.");let{children:e,before:t,after:i,more:n}=await this._fetch({before:s(this,Or),after:s(this,Fr),limit:this.pageSize,more:s(this,Wt)});return this.children.push(...e),d(this,Or,t),d(this,Fr,i),d(this,Wt,n),d(this,ji,!0),e};function hO(r){try{return!0}catch{return!1}}function vO(r){try{return!0}catch{return!1}}var qs,wm,Me=class{constructor(){}static get(e,t){let i=u.redditAPIPlugins.ModNote;return new j({hasMore:!0,before:e.before,limit:e.limit,pageSize:e.limit,fetch:async n=>{let o=await i.GetNotes({subreddit:e.subreddit,user:e.user,filter:e.filter,before:n.before,limit:n.limit},t);return{children:o.modNotes?.map(a=>S(this,qs,wm).call(this,a))||[],before:o.hasNextPage?o.endCursor:void 0,hasMore:o.hasNextPage}}})}static async delete(e,t){let i=u.redditAPIPlugins.ModNote,{deleted:n}=await i.DeleteNotes(e,t);return!!n}static async add(e,t){let n=await u.redditAPIPlugins.ModNote.PostNotes(e,t);if(!n?.created)throw new Error("Failed to create mod note");return S(this,qs,wm).call(this,n.created)}static async addRemovalNote(e,t){await u.redditAPIPlugins.ModNote.PostRemovalNote(e,t)}};qs=new WeakSet,wm=function(e){if(g(e.id,"Mod note ID is null or undefined"),g(e.createdAt,"Mod note createdAt is null or undefined"),g(e.type,"Mod note type is null or undefined"),g(e.subreddit,"Mod note subreddit is null or undefined"),g(e.subredditId,"Mod note subredditId is null or undefined"),g(e.operator,"Mod note operator is null or undefined"),g(e.operatorId,"Mod note operatorId is null or undefined"),g(e.user,"Mod note user is null or undefined"),g(e.userId,"Mod note userId is null or undefined"),g(e.userNoteData,"Mod note userNote is null or undefined"),g(e.modActionData,"Mod note modAction is null or undefined"),!hO(e.userNoteData?.label??""))throw new Error(`Invalid user note label: ${e.userNoteData?.label}`);if(!vO(e.type))throw new Error(`Invalid mod note type: ${e.type}`);return{id:e.id,user:{id:ie(e.userId??""),name:e.user},subreddit:{id:Re(e.subredditId??""),name:e.subreddit},operator:{id:ie(e.operatorId??""),name:e.operator},createdAt:new Date(e.createdAt*1e3),userNote:{note:e.userNoteData?.note,redditId:ge(e.userNoteData?.redditId??""),label:e.userNoteData?.label},type:e.type}},l(Me,qs);var Gt=class{static queryWithQueryString(e,t){return u.redditAPIPlugins.GraphQL.Query({query:e},t)}static query(e,t,i,n){return u.redditAPIPlugins.GraphQL.PersistedQuery({operationName:e,id:t,variables:i},n)}};var uS=["all","wiki","posts","access","mail","config","flair","channels","chat_config","chat_community","chat_operator"];function yO(r,e,t=!1){let i=t?"%2b":"+";return e.map(n=>(r.includes(n)?i:"-")+n).join(",")}function xm(r){return yO(r,uS,!0)}function cS(r){return r.filter(e=>uS.includes(e))}var bO=(t=>(t.User="USER_FLAIR",t.Post="LINK_FLAIR",t))(bO||{}),Lr,Gi,Vi,zi,Ji,$i,Ki,Xi,Zi,Yi,Qi,$d,Ke=class Ke{constructor(e,t,i){l(this,Lr);l(this,Gi);l(this,Vi);l(this,zi);l(this,Ji);l(this,$i);l(this,Ki);l(this,Xi);l(this,Zi);l(this,Yi);K(this),g(e.id),g(e.text),d(this,Lr,e.id),d(this,Gi,t),d(this,Vi,e.text),d(this,zi,kO(e.textColor)),d(this,Ji,SO(e.backgroundColor)),d(this,$i,PO(e.allowableContent)),d(this,Ki,e.modOnly),d(this,Xi,e.maxEmojis),d(this,Zi,e.textEditable),d(this,Yi,i)}get id(){return s(this,Lr)}get text(){return s(this,Vi)}get textColor(){return s(this,zi)}get backgroundColor(){return s(this,Ji)}get allowableContent(){return s(this,$i)}get modOnly(){return s(this,Ki)}get maxEmojis(){return s(this,Xi)}get allowUserEdits(){return s(this,Zi)}async delete(){return Ke.deleteFlairTemplate(s(this,Lr),s(this,Gi),s(this,Yi))}async edit(e){return Ke.editFlairTemplate({id:s(this,Lr),subredditName:s(this,Gi),text:e.text??s(this,Vi),allowableContent:e.allowableContent??s(this,$i),backgroundColor:e.backgroundColor??s(this,Ji),maxEmojis:e.maxEmojis??s(this,Xi),modOnly:e.modOnly??s(this,Ki),textColor:e.textColor??s(this,zi),allowUserEdits:e.allowUserEdits??s(this,Zi)},s(this,Yi))}static async createPostFlairTemplate(e,t){var i;return S(i=Ke,Qi,$d).call(i,{...e,flairType:"LINK_FLAIR"},t)}static async createUserFlairTemplate(e,t){var i;return S(i=Ke,Qi,$d).call(i,{...e,flairType:"USER_FLAIR"},t)}static async editFlairTemplate(e,t){var i;return S(i=Ke,Qi,$d).call(i,e,t)}static async getPostFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.LinkFlair({subreddit:e},t)).flair?.map(o=>new Ke(o,e,t))||[]}static async getUserFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.UserFlair({subreddit:e},t)).flair?.map(o=>new Ke(o,e,t))||[]}static async deleteFlairTemplate(e,t,i){await u.redditAPIPlugins.Flair.DeleteFlairTemplate({subreddit:e,flairTemplateId:t},i)}};Lr=new WeakMap,Gi=new WeakMap,Vi=new WeakMap,zi=new WeakMap,Ji=new WeakMap,$i=new WeakMap,Ki=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,Yi=new WeakMap,Qi=new WeakSet,$d=async function(e,t){let{subredditName:i,allowableContent:n="all",backgroundColor:o="transparent",flairType:a="",maxEmojis:c=10,modOnly:p=!1,text:f,textColor:v="dark",allowUserEdits:m=!1,id:b=""}=e;if(p&&m)throw new Error("Cannot have a mod only flair that is editable by users");let C=await u.redditAPIPlugins.Flair.FlairTemplate({subreddit:i,allowableContent:n,backgroundColor:o,flairType:a,maxEmojis:c,modOnly:p,text:f,textColor:v,textEditable:m,flairTemplateId:b,cssClass:"",overrideCss:!1},t);return new Ke(C,i,t)},l(Ke,Qi);var ae=Ke;function Hs(r){return{flairCssClass:r.flairCssClass,user:r.user,flairText:r.flairText}}var Vt,Tm,Am,Mr=class Mr{static async getUserFlairBySubreddit(e,t){return u.redditAPIPlugins.Flair.FlairList(e,t)}static setUserFlair(e,t){var i;return S(i=Mr,Vt,Tm).call(i,e,t)}static setPostFlair(e,t){var i;return S(i=Mr,Vt,Tm).call(i,{...e,postId:fe(e.postId)},t)}static async removePostFlair(e,t,i){var n;return S(n=Mr,Vt,Am).call(n,e,t,void 0,i)}static async removeUserFlair(e,t,i){var n;return S(n=Mr,Vt,Am).call(n,e,void 0,t,i)}};Vt=new WeakSet,Tm=async function(e,t){await u.redditAPIPlugins.Flair.SelectFlair({subreddit:e.subredditName,flairTemplateId:e.flairTemplateId??"",text:e.text??"",name:e.username,link:e.postId,backgroundColor:e.backgroundColor??"",textColor:e.textColor??"dark",cssClass:e.cssClass??"",returnRtjson:"none"},t)},Am=async function(e,t,i,n){await u.redditAPIPlugins.Flair.SelectFlair({subreddit:e,name:i??"",link:t??"",flairTemplateId:"",backgroundColor:"",text:"",textColor:"",cssClass:"",returnRtjson:"none"},n)},l(Mr,Vt);var Le=Mr;function kO(r){if(g(r,"Flair text color is required"),r==="light"||r==="dark")return r;throw new Error(`Invalid flair text color: ${r}`)}function SO(r){if(g(r,"Flair background color is required"),r==="transparent"||/^#([A-Fa-f0-9]{6})$/.test(r))return r;throw new Error(`Invalid flair background color: ${r}`)}function PO(r){if(r==="all"||r==="text"||r==="emoji")return r;throw new Error(`Invalid allowable content: ${r}`)}import{Block as RO}from"@devvit/protos";var gS=_n(fS(),1);var en,Ws,tn,Gs,Vs,zs,Js,$s,rn,Ks,Xs,Zs,Ys,Qs,eo,zt,to,ro,Br,nn,Jt,sn,on,an,Dr,$t,Kt,dn,Xt,Zt,Yt,vt,io,no,ln,un,_,q=class q{constructor(e,t){l(this,en);l(this,Ws);l(this,tn);l(this,Gs);l(this,Vs);l(this,zs);l(this,Js);l(this,$s);l(this,rn);l(this,Ks);l(this,Xs);l(this,Zs);l(this,Ys);l(this,Qs);l(this,eo);l(this,zt);l(this,to);l(this,ro);l(this,Br);l(this,nn);l(this,Jt);l(this,sn);l(this,on);l(this,an);l(this,Dr);l(this,$t);l(this,Kt);l(this,dn);l(this,Xt);l(this,Zt);l(this,Yt);l(this,vt);l(this,io);l(this,no);l(this,ln);l(this,un);l(this,_);K(this),g(e.id,"Post is missing id"),g(e.title,"Post is missing title"),g(e.createdUtc,"Post is missing created date"),g(e.author,"Post is missing author name"),g(e.subreddit,"Post is missing subreddit name"),g(e.subredditId,"Post is missing subreddit id"),g(e.url,"Post is missing url"),g(e.permalink,"Post is missing permalink"),d(this,en,fe(`t3_${e.id}`)),d(this,tn,e.author),d(this,Ws,e.authorFullname?ie(e.authorFullname):void 0),d(this,Vs,Re(e.subredditId)),d(this,zs,e.subreddit),d(this,Zs,e.score??0),d(this,Ys,e.numComments??0),d(this,Qs,e.numReports??0);let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Gs,i),d(this,$s,e.title),d(this,rn,e.selftext),d(this,Ks,e.selftextHtml),d(this,Xs,e.url),d(this,Js,e.permalink),e.thumbnail&&e.thumbnail!=="self"&&e.thumbnail!=="nsfw"&&e.thumbnailHeight!=null&&e.thumbnailWidth!=null&&d(this,eo,{url:e.thumbnail,height:e.thumbnailHeight,width:e.thumbnailWidth}),d(this,zt,e.approved??!1),d(this,to,e.approvedAtUtc??0),d(this,ro,e.bannedAtUtc??0),d(this,Jt,e.removed??!1),d(this,sn,e.removedBy),d(this,on,e.removedByCategory),d(this,Br,e.spam??!1),d(this,nn,e.stickied??!1),d(this,an,e.archived??!1),d(this,Dr,e.edited??!1),d(this,$t,e.locked??!1),d(this,Kt,e.over18??!1),d(this,dn,e.quarantine??!1),d(this,Xt,e.spoiler),d(this,Zt,e.hidden??!1),d(this,Yt,e.ignoreReports??!1),d(this,vt,e.distinguished),d(this,no,e.secureMedia),d(this,ln,(e.modReports??[]).map(([n])=>n)),d(this,un,(e.userReports??[]).map(([n])=>n)),d(this,_,t),(e.linkFlairBackgroundColor||e.linkFlairCssClass||e.linkFlairText||e.linkFlairType||e.linkFlairTemplateId||e.linkFlairRichtext||e.linkFlairTextColor)&&d(this,io,{backgroundColor:e.linkFlairBackgroundColor,cssClass:e.linkFlairCssClass,text:e.linkFlairText,type:e.linkFlairType,templateId:e.linkFlairTemplateId,richtext:(e.linkFlairRichtext??[]).map(({e:n,t:o,a,u:c})=>({elementType:n,text:o,emojiRef:a,url:c})),textColor:e.linkFlairTextColor})}get id(){return s(this,en)}get authorId(){return s(this,Ws)}get authorName(){return s(this,tn)}get subredditId(){return s(this,Vs)}get subredditName(){return s(this,zs)}get permalink(){return s(this,Js)}get title(){return s(this,$s)}get body(){return s(this,rn)}get bodyHtml(){return s(this,Ks)}get url(){return s(this,Xs)}get thumbnail(){return s(this,eo)}get createdAt(){return s(this,Gs)}get score(){return s(this,Zs)}get numberOfComments(){return s(this,Ys)}get numberOfReports(){return s(this,Qs)}get approved(){return s(this,zt)}get approvedAtUtc(){return s(this,to)}get bannedAtUtc(){return s(this,ro)}get spam(){return s(this,Br)}get stickied(){return s(this,nn)}get removed(){return s(this,Jt)}get removedBy(){return s(this,sn)}get removedByCategory(){return s(this,on)}get archived(){return s(this,an)}get edited(){return s(this,Dr)}get locked(){return s(this,$t)}get nsfw(){return s(this,Kt)}get quarantined(){return s(this,dn)}get spoiler(){return s(this,Xt)}get hidden(){return s(this,Zt)}get ignoringReports(){return s(this,Yt)}get distinguishedBy(){return s(this,vt)}get comments(){return Y.getComments({postId:this.id},s(this,_))}get flair(){return s(this,io)}get secureMedia(){return s(this,no)}get userReportReasons(){return s(this,un)}get modReportReasons(){return s(this,ln)}toJSON(){return{id:this.id,authorId:this.authorId,authorName:this.authorName,subredditId:this.subredditId,subredditName:this.subredditName,permalink:this.permalink,title:this.title,body:this.body,bodyHtml:this.bodyHtml,url:this.url,thumbnail:this.thumbnail,score:this.score,numberOfComments:this.numberOfComments,numberOfReports:this.numberOfReports,createdAt:this.createdAt,approved:this.approved,spam:this.spam,stickied:this.stickied,removed:this.removed,removedBy:s(this,sn),removedByCategory:s(this,on),archived:this.archived,edited:this.edited,locked:this.locked,nsfw:this.nsfw,quarantined:this.quarantined,spoiler:this.spoiler,hidden:this.hidden,ignoringReports:this.ignoringReports,distinguishedBy:this.distinguishedBy,flair:this.flair,secureMedia:this.secureMedia,modReportReasons:s(this,ln),userReportReasons:s(this,un)}}isApproved(){return s(this,zt)}isSpam(){return s(this,Br)}isStickied(){return s(this,nn)}isRemoved(){return s(this,Jt)}isArchived(){return s(this,an)}isEdited(){return s(this,Dr)}isLocked(){return s(this,$t)}isNsfw(){return s(this,Kt)}isQuarantined(){return s(this,dn)}isSpoiler(){return s(this,Xt)}isHidden(){return s(this,Zt)}isIgnoringReports(){return s(this,Yt)}isDistinguishedBy(){return s(this,vt)}async edit(e){let t=await q.edit({id:this.id,...e},s(this,_));d(this,rn,t.body),d(this,Dr,t.edited)}async addComment(e){return Y.submit({id:this.id,...e},s(this,_))}async delete(){return q.delete(this.id,s(this,_))}async approve(){await q.approve(this.id,s(this,_)),d(this,zt,!0),d(this,Jt,!1)}async remove(e=!1){await q.remove(this.id,e,s(this,_)),d(this,Jt,!0),d(this,Br,e),d(this,zt,!1)}async lock(){await q.lock(this.id,s(this,_)),d(this,$t,!0)}async unlock(){await q.unlock(this.id,s(this,_)),d(this,$t,!1)}async hide(){await q.hide(this.id,s(this,_)),d(this,Zt,!0)}async unhide(){await q.unhide(this.id,s(this,_)),d(this,Zt,!1)}async markAsNsfw(){await q.markAsNsfw(this.id,s(this,_)),d(this,Kt,!0)}async unmarkAsNsfw(){await q.unmarkAsNsfw(this.id,s(this,_)),d(this,Kt,!1)}async markAsSpoiler(){await q.markAsSpoiler(this.id,s(this,_)),d(this,Xt,!0)}async unmarkAsSpoiler(){await q.unmarkAsSpoiler(this.id,s(this,_)),d(this,Xt,!1)}async sticky(e){await q.sticky(this.id,e,s(this,_))}async unsticky(){await q.unsticky(this.id,s(this,_))}async distinguish(){let{distinguishedBy:e}=await q.distinguish(this.id,!1,s(this,_));d(this,vt,e)}async distinguishAsAdmin(){let{distinguishedBy:e}=await q.distinguish(this.id,!0,s(this,_));d(this,vt,e)}async undistinguish(){let{distinguishedBy:e}=await q.undistinguish(this.id,s(this,_));d(this,vt,e)}async ignoreReports(){await q.ignoreReports(this.id,s(this,_)),d(this,Yt,!0)}async unignoreReports(){await q.unignoreReports(this.id,s(this,_)),d(this,Yt,!1)}async getAuthor(){return w.getByUsername(s(this,tn),s(this,_))}async crosspost(e){return q.crosspost({...e,postId:this.id},s(this,_))}addRemovalNote(e){return Me.addRemovalNote({itemIds:[s(this,en)],...e},s(this,_))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=ur(e)?e:`t3_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.length)throw new Error("could not find post");let a=o.data.children[0];if(!a?.data)throw new Error("could not find post");return new q(a.data,t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,n;if("preview"in e){g(t,"Missing metadata in `SubmitPostOptions`");let c=await new ct(()=>e.preview,void 0,{},t,void 0).buildBlocksUI(),p=RO.encode(c).finish();n=await i.Submit({kind:"custom",sr:e.subredditName,richtextJson:(0,gS.fromByteArray)(p),...e},t)}else n=await i.Submit({kind:"kind"in e?e.kind:"url"in e?"link":"self",sr:e.subredditName,richtextJson:"richtext"in e?Hi(e.richtext):void 0,...e},t);if("kind"in e&&["image","video","videogif"].includes(e.kind)&&!n.json?.data?.id&&"url"in e)throw new Error(`Post of ${e.kind} type with ${e.url} is being created asynchronously and should be updated in the subreddit soon.`);if(!n.json?.data?.id||n.json?.errors?.length)throw new Error(`failed to submit post - either post ID is empty or request failed with errors: ${n.json?.errors}`);return q.getById(`t3_${n.json.data.id}`,t)}static async crosspost(e,t){let i=u.redditAPIPlugins.LinksAndComments,{postId:n,subredditName:o,...a}=e,c=await i.Submit({kind:"crosspost",sr:o,crosspostFullname:fe(n),...a},t);if(!c.json?.data?.id||c.json?.errors?.length)throw new Error("failed to crosspost post");return q.getById(`t3_${c.json.data.id}`,t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;if("richtext"in e&&(o=Hi(e.richtext)),(await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t)).json?.errors?.length)throw new Error("Failed to edit post");return q.getById(n,t)}static async delete(e,t){await u.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await u.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await u.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async hide(e,t){await u.redditAPIPlugins.LinksAndComments.Hide({id:e},t)}static async unhide(e,t){await u.redditAPIPlugins.LinksAndComments.Unhide({id:e},t)}static async markAsNsfw(e,t){await u.redditAPIPlugins.LinksAndComments.MarkNSFW({id:e},t)}static async unmarkAsNsfw(e,t){await u.redditAPIPlugins.LinksAndComments.UnmarkNSFW({id:e},t)}static async markAsSpoiler(e,t){await u.redditAPIPlugins.LinksAndComments.Spoiler({id:e},t)}static async unmarkAsSpoiler(e,t){await u.redditAPIPlugins.LinksAndComments.Unspoiler({id:e},t)}static async sticky(e,t,i){await u.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!0,num:t},i)}static async unsticky(e,t){await u.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!1},t)}static async lock(e,t){await u.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await u.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async distinguish(e,t,i){let a=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:t?"admin":"yes",sticky:!1},i)).json?.data?.things?.[0]?.data;return g(a),{distinguishedBy:a.distinguished}}static async undistinguish(e,t){let o=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:"no",sticky:!1},t)).json?.data?.things?.[0]?.data;return g(o),{distinguishedBy:o.distinguished}}static async ignoreReports(e,t){await u.redditAPIPlugins.Moderation.IgnoreReports({id:e},t)}static async unignoreReports(e,t){await u.redditAPIPlugins.Moderation.UnignoreReports({id:e},t)}static getControversialPosts(e={},t){return this.getSortedPosts({...e,sort:"controversial"},t)}static getTopPosts(e={},t){return this.getSortedPosts({...e,sort:"top"},t)}static getSortedPosts(e,t){let i=u.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Sort({show:"all",sort:e.sort,t:e.timeframe,subreddit:e.subredditName,...n},t);return js(o,t)}})}static getHotPosts(e={location:"GLOBAL"},t){let i=u.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Hot({g:e.location,show:"all",subreddit:e.subredditName,...n},t);return js(o,t)}})}static getNewPosts(e,t){let i=u.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.New({show:"all",subreddit:e.subredditName,...n},t);return js(o,t)}})}static getRisingPosts(e,t){let i=u.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Rising({show:"all",subreddit:e.subredditName,...n},t);return js(o,t)}})}static getPostsByUser(e,t){let i=u.redditAPIPlugins.Users;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"submitted",...n},t);return js(o,t)}})}};en=new WeakMap,Ws=new WeakMap,tn=new WeakMap,Gs=new WeakMap,Vs=new WeakMap,zs=new WeakMap,Js=new WeakMap,$s=new WeakMap,rn=new WeakMap,Ks=new WeakMap,Xs=new WeakMap,Zs=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,eo=new WeakMap,zt=new WeakMap,to=new WeakMap,ro=new WeakMap,Br=new WeakMap,nn=new WeakMap,Jt=new WeakMap,sn=new WeakMap,on=new WeakMap,an=new WeakMap,Dr=new WeakMap,$t=new WeakMap,Kt=new WeakMap,dn=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,Yt=new WeakMap,vt=new WeakMap,io=new WeakMap,no=new WeakMap,ln=new WeakMap,un=new WeakMap,_=new WeakMap;var V=q;function js(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>new V(i.data,e)),before:r.data.before,after:r.data.after}}var so,cn,oo,ao,lo,uo,co,Qt,mo,po,yt,_r=class _r{constructor(e,t){l(this,so);l(this,cn);l(this,oo);l(this,ao);l(this,lo);l(this,uo);l(this,co);l(this,Qt,new Map);l(this,mo);l(this,po);l(this,yt);K(this),g(e.id,"User ID is missing or undefined"),g(e.name,"Username is missing or undefined"),g(e.createdUtc,"User is missing created date"),d(this,so,ie(ld(e.id)?e.id:`t2_${e.id}`)),d(this,cn,e.name),d(this,uo,e.over18??!1),d(this,co,e.isEmployee??!1);let i=new Date(0);if(i.setUTCSeconds(e.createdUtc),d(this,oo,i),d(this,ao,e.linkKarma??0),d(this,lo,e.commentKarma??0),e.modPermissions)for(let[n,o]of Object.entries(e.modPermissions))s(this,Qt).set(n,cS(o));d(this,mo,new URL(e.subreddit?.url??"","https://www.reddit.com").toString()),d(this,po,e.subreddit?.url??""),d(this,yt,t)}get id(){return s(this,so)}get username(){return s(this,cn)}get createdAt(){return s(this,oo)}get linkKarma(){return s(this,ao)}get commentKarma(){return s(this,lo)}get nsfw(){return s(this,uo)}get isAdmin(){return s(this,co)}get modPermissions(){return s(this,Qt)}get url(){return s(this,mo)}get permalink(){return s(this,po)}toJSON(){return{id:this.id,username:this.username,createdAt:this.createdAt,linkKarma:this.linkKarma,commentKarma:this.commentKarma,nsfw:this.nsfw,modPermissionsBySubreddit:Object.fromEntries(this.modPermissions)}}async getModPermissionsForSubreddit(e){if(s(this,Qt).has(e))return s(this,Qt).get(e);let t=await _r.getSubredditUsersByType({subredditName:e,type:"moderators",username:this.username},s(this,yt)).all();if(t.length===0)return[];let i=t[0].modPermissions.get(e)??[];return i.length>0&&s(this,Qt).set(e,i),i}getComments(e){return Y.getCommentsByUser({username:this.username,...e},s(this,yt))}getPosts(e){return V.getPostsByUser({username:this.username,...e},s(this,yt))}async getUserFlairBySubreddit(e){let t=await Le.getUserFlairBySubreddit({subreddit:e,name:s(this,cn)},s(this,yt));return t.users[0]?Hs(t.users[0]):void 0}getSnoovatarUrl(){return _r.getSnoovatarUrl(this.username,s(this,yt))}static async getById(e,t){let o=(await u.redditAPIPlugins.Users.UserDataByAccountIds({ids:e},t))?.users?.[e]?.name;return o==null?void 0:_r.getByUsername(o,t)}static async getByUsername(e,t){let n=await u.redditAPIPlugins.Users.UserAbout({username:e},t);if(n.data?.id)return new _r(n.data,t)}static async getFromMetadata(e,t){g(t);let i=t?.[e]?.values[0];return i?_r.getById(ie(i),t):Promise.resolve(void 0)}static getSubredditUsersByType(e,t){let i=u.redditAPIPlugins.Subreddits;return new j({hasMore:!0,pageSize:e.pageSize,limit:e.limit,after:e.after,before:e.before,fetch:async n=>{let o=await i.AboutWhere({where:e.type,user:e.username,subreddit:e.subredditName,show:"all",...n},t);return FO(o,e.subredditName,t)}})}static async createRelationship(e,t){let i=u.redditAPIPlugins.Users,{type:n,subredditName:o,username:a,permissions:c,...p}=e,f=await i.Friend({type:n,subreddit:o,name:a,permissions:c?xm(c):void 0,...p},t);if(f.json?.errors?.length)throw new Error(f.json.errors.join(`
4
+ `))}static async removeRelationship(e,t){await u.redditAPIPlugins.Users.Unfriend({type:e.type,subreddit:e.subredditName,name:e.username},t)}static async setModeratorPermissions(e,t,i,n){let a=await u.redditAPIPlugins.Users.SetPermissions({subreddit:t,name:e,type:"moderator",permissions:xm(i)},n);if(a.json?.errors?.length)throw new Error(a.json.errors.join(`
5
+ `))}static async getSnoovatarUrl(e,t){return(await Gt.query("GetSnoovatarUrlByName","c47fd42345af268616d2d8904b56856acdc05cf61d3650380f539ad7d596ac0c",{username:e},t)).data?.redditorInfoByName?.snoovatarIcon?.url}static getOverview(e,t){let i=u.redditAPIPlugins.Users;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"overview",...n},t);return OO(o,t)}})}};so=new WeakMap,cn=new WeakMap,oo=new WeakMap,ao=new WeakMap,lo=new WeakMap,uo=new WeakMap,co=new WeakMap,Qt=new WeakMap,mo=new WeakMap,po=new WeakMap,yt=new WeakMap;var w=_r;function OO(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>{if(i.kind==="t3")return new V(i.data,e);if(i.kind==="t1")return new Y(i.data,e);throw new Error(`Type ${i.kind} is not supported`)}),before:r.data.before,after:r.data.after}}async function FO(r,e,t){let i=u.redditAPIPlugins.Users;if(!r.data?.children)throw new Error("Listing response is missing children");let n=r.data.children.map(v=>(g(v.data?.id,"User id is still from listing data"),v.data.id)),o=100,a=[];for(let v=0;v<n.length;v+=o)a.push(n.slice(v,v+o));let p=(await Promise.all(a.map(v=>i.UserDataByAccountIds({ids:v.join(",")},t)))).reduce((v,m)=>({...v,...m.users}),{});return{children:r.data.children.map(v=>{let m=v.data?.id;g(m,"User id is missing from listing");let b=p[m];return g(b,"User data is missing from response"),new w({id:m,name:b.name,linkKarma:b.linkKarma,commentKarma:b.commentKarma,createdUtc:b.createdUtc,over18:b.profileOver18,snoovatarSize:[],modPermissions:{[e]:v.data?.modPermissions??[]}},t)}),before:r.data.before,after:r.data.after}}var Nr,fo,mn,pn,go,ho,fn,vo,yo,gn,er,bo,ko,qr,tr,rr,bt,Hr,kt,So,Po,Co,Io,wo,xo,To,ee,st,Xd,Zd,W=class W{constructor(e,t){l(this,Nr);l(this,fo);l(this,mn);l(this,pn);l(this,go);l(this,ho);l(this,fn);l(this,vo);l(this,yo);l(this,gn);l(this,er);l(this,bo);l(this,ko);l(this,qr);l(this,tr);l(this,rr);l(this,bt);l(this,Hr);l(this,kt);l(this,So);l(this,Po);l(this,Co);l(this,Io);l(this,wo);l(this,xo);l(this,To);l(this,ee);var n;K(this),g(e.id,"Comment id is null or undefined"),g(e.body,"Comment body is null or undefined"),g(e.createdUtc,"Comment is missing created date"),g(e.author,"Comment author is null or undefined"),g(e.parentId,"Comment parentId is null or undefined"),g(e.linkId,"Comment linkId is null or undefined"),g(e.permalink,"Comment permalink is null or undefined"),g(e.subreddit,"Comment is missing subreddit name"),g(e.subredditId,"Comment is missing subreddit id"),d(this,Nr,ri(`t1_${e.id}`)),d(this,fo,e.authorFullname?ie(e.authorFullname):void 0),d(this,mn,e.author),d(this,pn,e.body),d(this,vo,Re(e.subredditId)),d(this,yo,e.subreddit),d(this,ho,mc(e.parentId)?ri(e.parentId):fe(e.parentId)),d(this,fn,fe(e.linkId)),d(this,qr,e.edited??!1),d(this,tr,e.locked??!1),d(this,rr,e.removed??!1),d(this,bt,e.stickied??!1),d(this,er,e.approved??!1),d(this,bo,e.approvedAtUtc??0),d(this,ko,e.bannedAtUtc??0),d(this,Hr,e.spam??!1),d(this,kt,e.distinguished),d(this,So,e.numReports??0),d(this,Po,e.collapsedBecauseCrowdControl??!1),d(this,Co,e.score??0),d(this,Io,e.permalink),d(this,To,new URL(e.permalink??"","https://www.reddit.com/").toString()),d(this,wo,(e.modReports??[]).map(([o])=>o)),d(this,xo,(e.userReports??[]).map(([o])=>o));let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,go,i),d(this,gn,S(n=W,st,Xd).call(n,{postId:s(this,fn),commentId:s(this,Nr)},t)),d(this,ee,t)}get id(){return s(this,Nr)}get authorId(){return s(this,fo)}get authorName(){return s(this,mn)}get subredditId(){return s(this,vo)}get subredditName(){return s(this,yo)}get body(){return s(this,pn)}get createdAt(){return s(this,go)}get parentId(){return s(this,ho)}get postId(){return s(this,fn)}get replies(){return s(this,gn)}get distinguishedBy(){return s(this,kt)}get locked(){return s(this,tr)}get stickied(){return s(this,bt)}get removed(){return s(this,rr)}get approved(){return s(this,er)}get approvedAtUtc(){return s(this,bo)}get bannedAtUtc(){return s(this,ko)}get spam(){return s(this,Hr)}get edited(){return s(this,qr)}get numReports(){return s(this,So)}get collapsedBecauseCrowdControl(){return s(this,Po)}get score(){return s(this,Co)}get permalink(){return s(this,Io)}get userReportReasons(){return s(this,xo)}get modReportReasons(){return s(this,wo)}get url(){return s(this,To)}toJSON(){return{id:this.id,authorName:this.authorName,subredditId:this.subredditId,subredditName:this.subredditName,body:this.body,createdAt:this.createdAt,parentId:this.parentId,postId:this.postId,replies:this.replies,approved:this.approved,locked:this.locked,removed:this.removed,stickied:this.stickied,spam:this.spam,edited:this.edited,distinguishedBy:this.distinguishedBy,numReports:this.numReports,collapsedBecauseCrowdControl:this.collapsedBecauseCrowdControl,score:this.score,permalink:this.permalink,modReportReasons:this.modReportReasons,userReportReasons:this.userReportReasons,url:this.url}}isLocked(){return s(this,tr)}isApproved(){return s(this,er)}isRemoved(){return s(this,rr)}isSpam(){return s(this,Hr)}isStickied(){return s(this,bt)}isDistinguished(){return!!s(this,kt)}isEdited(){return s(this,qr)}async delete(){return W.delete(this.id,s(this,ee))}async edit(e){let t=await W.edit({id:this.id,...e},s(this,ee));return d(this,pn,t.body),d(this,qr,t.edited),this}async approve(){await W.approve(this.id,s(this,ee)),d(this,er,!0),d(this,rr,!1)}async remove(e=!1){await W.remove(this.id,e,s(this,ee)),d(this,rr,!0),d(this,Hr,e),d(this,er,!1)}async lock(){await W.lock(this.id,s(this,ee)),d(this,tr,!0)}async unlock(){await W.unlock(this.id,s(this,ee)),d(this,tr,!1)}async reply(e){return W.submit({id:this.id,...e},s(this,ee))}async getAuthor(){return w.getByUsername(s(this,mn),s(this,ee))}async distinguish(e=!1){let{distinguishedBy:t,stickied:i}=await W.distinguish(this.id,e,!1,s(this,ee));d(this,kt,t),d(this,bt,i)}async distinguishAsAdmin(e=!1){let{distinguishedBy:t,stickied:i}=await W.distinguish(this.id,e,!0,s(this,ee));d(this,kt,t),d(this,bt,i)}async undistinguish(){let{distinguishedBy:e,stickied:t}=await W.undistinguish(this.id,s(this,ee));d(this,kt,e),d(this,bt,t)}addRemovalNote(e){return Me.addRemovalNote({itemIds:[s(this,Nr)],...e},s(this,ee))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=wt(e)?e:`t1_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.[0]?.data)throw new Error("not found");return new W(o.data.children[0].data,t)}static getComments(e,t){var a;let{postId:i,commentId:n,...o}=e;return S(a=W,st,Xd).call(a,{postId:fe(i),commentId:n?ri(n):void 0,...o},t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=Hi(e.richtext));let a=await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("Failed to edit comment");let c=a.json?.data?.things?.[0]?.data;return g(c),new W(c,t)}static async delete(e,t){await u.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await u.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await u.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async lock(e,t){await u.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await u.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=Hi(e.richtext));let a=await i.Comment({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("failed to reply to comment");let c=a.json?.data?.things?.[0]?.data;return g(c),new W(c,t)}static async distinguish(e,t,i,n){let c=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:i?"admin":"yes",sticky:t},n)).json?.data?.things?.[0]?.data;return g(c),{distinguishedBy:c.distinguished,stickied:!!c.stickied}}static async undistinguish(e,t){let o=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:"no",sticky:!1},t)).json?.data?.things?.[0]?.data;return g(o),{distinguishedBy:o.distinguished,stickied:!!o.stickied}}static getCommentsByUser(e,t){let i=u.redditAPIPlugins.Users;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"comments",...n},t);return g(o.data,"Failed to get comments for user"),{children:o.data.children?.map(c=>new W(c.data,t))||[],before:o.data.before,after:o.data.after}}})}};Nr=new WeakMap,fo=new WeakMap,mn=new WeakMap,pn=new WeakMap,go=new WeakMap,ho=new WeakMap,fn=new WeakMap,vo=new WeakMap,yo=new WeakMap,gn=new WeakMap,er=new WeakMap,bo=new WeakMap,ko=new WeakMap,qr=new WeakMap,tr=new WeakMap,rr=new WeakMap,bt=new WeakMap,Hr=new WeakMap,kt=new WeakMap,So=new WeakMap,Po=new WeakMap,Co=new WeakMap,Io=new WeakMap,wo=new WeakMap,xo=new WeakMap,To=new WeakMap,ee=new WeakMap,st=new WeakSet,Xd=function(e,t,i=0){return new j({limit:e.limit,pageSize:e.pageSize,fetch:async n=>{var b,y;let o=n.limit,a=u.redditAPIPlugins.Listings,c=u.redditAPIPlugins.LinksAndComments,p=e.commentId;if(n.more)if(n.more.children.length){let C=n.more;(!o||o>100)&&(o=100);let I=C.children.splice(0,o),T=await c.MoreChildren({linkId:e.postId,children:I,sort:e.sort},t);if(!T.json?.data?.things?.length)return{children:[]};let{children:M}=S(b=W,st,Zd).call(b,T.json.data.things,e.postId,e,t);return{children:M,more:C.children.length?C:void 0}}else p=n.more.parentId,i=i+n.more.depth;let v=(await a.Comments({article:e.postId.substring(3),comment:p?.substring(3),limit:o,depth:e.depth,sort:e.sort},t)).listings?.[1]?.data?.children??[],m=v[0];return p&&m?.data?.replyList?.data&&(v=m.data.replyList.data.children),S(y=W,st,Zd).call(y,v,p??e.postId,e,t,i)}})},Zd=function(e,t,i,n,o=0){var f,v;let a=[],c,p={};for(let m of e){if(!m.data||(m.data.depth!=null&&(m.data.depth=m.data.depth+o),m.data.depth!=null&&i.depth!=null&&m.data.depth>=i.depth))continue;let b=m.data.parentId?p[m.data.parentId]:void 0;if(m.kind==="t1"){if(m.data.name===t)continue;let y=new W(m.data,n);if(p[y.id]=y,d(y,gn,S(f=W,st,Xd).call(f,{...i,postId:y.postId,commentId:y.id},n,o)),"replyList"in m.data&&m.data.replyList?.data){let{children:C,more:I}=S(v=W,st,Zd).call(v,m.data.replyList.data.children,y.id,i,n,o);C.length&&y.replies.children.push(...C),I&&y.replies.setMore(I)}y.replies.preventInitialFetch(),b?b.replies.children.push(y):a.push(y)}else if(m.kind==="more"&&m.data.parentId&&m.data.depth!=null){let y={parentId:mc(m.data.parentId)?ri(m.data.parentId):fe(m.data.parentId),children:m.data.children??[],depth:m.data.depth};b?b.replies.setMore(y):y.parentId===t&&(c=y)}}return{children:a,more:c}},l(W,st);var Y=W;function pd(r,e){let t=u.redditAPIPlugins.Moderation;return new j({hasMore:!0,after:r.after,before:r.before,limit:r.limit,pageSize:r.pageSize,fetch:async i=>{let n=await t.AboutLog({subreddit:r.subredditName,mod:r.moderatorUsernames?r.moderatorUsernames.join(","):void 0,type:r.type,...i},e);return MO(n)}})}function MO(r){if(!r.data?.children)throw new Error("AboutLogResponse is missing children");return{children:r.data.children.map(t=>{if(!t.data)throw new Error("ModAction from AboutLogResponse is missing or invalid");let{id:i,mod:n,modId36:o,createdUtc:a,subreddit:c,subredditNamePrefixed:p,action:f,srId36:v,description:m,details:b,targetAuthor:y,targetBody:C,targetFullname:I,targetPermalink:T,targetTitle:M}=t.data;g(i,"ModAction from AboutLogResponse is missing id"),g(n,"ModAction from AboutLogResponse is missing mod"),g(o,"ModAction from AboutLogResponse is missing modId36"),g(a,"ModAction from AboutLogResponse is missing createdUtc"),g(c,"ModAction from AboutLogResponse is missing subreddit"),g(p,"ModAction from AboutLogResponse is missing subredditNamePrefixed"),g(f,"ModAction from AboutLogResponse is missing action"),g(v,"ModAction from AboutLogResponse is missing srId36");let ue=new Date(0);return ue.setUTCSeconds(a),{id:i,type:f,moderatorName:n,moderatorId:`t2_${o}`,createdAt:ue,subredditName:c,subredditId:`t5_${v}`,description:m,details:b,target:I?{id:I,author:y,body:C,permalink:T,title:M}:void 0}}),after:r.data.after,before:r.data.before}}var LO=(a=>(a.New="New",a.InProgress="InProgress",a.Archived="Archived",a.Appeals="Appeals",a.JoinRequests="JoinRequests",a.Filtered="Filtered",a))(LO||{}),UO={0:"New",1:"InProgress",2:"Archived",3:"Appeals",4:"JoinRequests",5:"Filtered"},BO=(y=>(y.Highlighted="Highlighted",y.Unhighlighted="Unhighlighted",y.Archived="Archived",y.Unarchived="Unarchived",y.ReportedToAdmins="ReportedToAdmins",y.Muted="Muted",y.Unmuted="Unmuted",y.Banned="Banned",y.Unbanned="Unbanned",y.Approved="Approved",y.Disapproved="Disapproved",y.Filtered="Filtered",y.Unfiltered="Unfiltered",y))(BO||{}),DO={0:"Highlighted",1:"Unhighlighted",2:"Archived",3:"Unarchived",4:"ReportedToAdmins",5:"Muted",6:"Unmuted",7:"Banned",8:"Unbanned",9:"Approved",10:"Disapproved",11:"Filtered",12:"Unfiltered"},G,z,se,hS,vS,fd=class{constructor(e){l(this,z);l(this,G);d(this,G,e)}async bulkReadConversations(e,t){let i=u.redditAPIPlugins.NewModmail,{conversationIds:n}=await i.BulkReadConversations({entity:e.join(","),state:t},s(this,G));return n}async getConversations(e){let i=await u.redditAPIPlugins.NewModmail.GetConversations({after:e.after,entity:e.subreddits?e.subreddits.join(","):void 0,limit:e.limit,sort:e.sort,state:e.state},s(this,G)),n={};for(let o in i.conversations)n[o]=S(this,z,se).call(this,{protoConversation:i.conversations[o],protoMessages:i.messages,protoModActions:{}});return{conversations:n,viewerId:i.viewerId}}async getConversation(e){let i=await u.redditAPIPlugins.NewModmail.GetConversation({...e,markRead:!!e.markRead},s(this,G));return{participantSubreddit:i.participantSubreddit,conversation:S(this,z,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getSubreddits(){let e=u.redditAPIPlugins.NewModmail,{subreddits:t}=await e.Subreddits({},s(this,G));return t}async createConversation(e){let i=await u.redditAPIPlugins.NewModmail.CreateConversation({body:e.body,isAuthorHidden:e.isAuthorHidden??!1,srName:e.subredditName,subject:e.subject,to:e.to?e.to:void 0},s(this,G));return{conversation:S(this,z,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async reply(e){let i=await u.redditAPIPlugins.NewModmail.CreateConversationMessage({body:e.body,conversationId:e.conversationId,isAuthorHidden:e.isAuthorHidden??!1,isInternal:e.isInternal??!1},s(this,G));return{conversation:S(this,z,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:{}}),user:i.user}}async highlightConversation(e){let i=await u.redditAPIPlugins.NewModmail.HighlightConversation({conversationId:e},s(this,G));return{conversation:S(this,z,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unhighlightConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnhighlightConversation({conversationId:e},s(this,G));return{conversation:S(this,z,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async archiveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ArchiveConversation({conversationId:e},s(this,G));return{conversation:S(this,z,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unarchiveConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnarchiveConversation({conversationId:e},s(this,G));return{conversation:S(this,z,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async muteConversation(e){let i=await u.redditAPIPlugins.NewModmail.MuteConversation({conversationId:e.conversationId,numHours:e.numHours},s(this,G));return{conversation:S(this,z,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unmuteConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnmuteConversation({conversationId:e},s(this,G));return{conversation:S(this,z,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async readConversations(e){await u.redditAPIPlugins.NewModmail.Read({conversationIds:e.join(",")},s(this,G))}async unreadConversations(e){await u.redditAPIPlugins.NewModmail.Unread({conversationIds:e.join(",")},s(this,G))}async approveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ApproveConversation({conversationId:e},s(this,G));return{conversation:S(this,z,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async disapproveConversation(e){let i=await u.redditAPIPlugins.NewModmail.DisapproveConversation({conversationId:e},s(this,G));return{conversation:S(this,z,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async tempBanConversation(e){let i=await u.redditAPIPlugins.NewModmail.TempBan({...e},s(this,G));return{conversation:S(this,z,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unbanConversation(e){let i=await u.redditAPIPlugins.NewModmail.Unban({conversationId:e},s(this,G));return{conversation:S(this,z,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getUnreadCount(){return await u.redditAPIPlugins.NewModmail.UnreadCount({},s(this,G))}async getUserConversations(e){return await u.redditAPIPlugins.NewModmail.UserConversations({conversationId:e},s(this,G))}};G=new WeakMap,z=new WeakSet,se=function({protoConversation:e,protoMessages:t,protoModActions:i}){return{...e,state:UO[e.state],messages:S(this,z,hS).call(this,e,t),modActions:S(this,z,vS).call(this,e,i)}},hS=function(e,t){let i={},n=e.objIds.filter(o=>o.key==="messages").map(({id:o})=>o);for(let o of n){let a=t[o];a&&(i[o]=a)}return i},vS=function(e,t){let i={},n=e.objIds.filter(o=>o.key==="modActions").map(({id:o})=>o);for(let o of n){let a=t[o];a&&(i[o]={...a,actionType:DO[a.actionTypeId]})}return i};var hn,vn,Yd,Ao,Eo,Ro,Oo,Rm=class Rm{constructor(e,t){l(this,hn);l(this,vn);l(this,Yd);l(this,Ao);l(this,Eo);l(this,Ro);l(this,Oo);if(K(this),g(e.id,"PrivateMessage: Invalid data, no id"),g(e.name,"PrivateMessage: Invalid data, no name"),g(e.created,"PrivateMessage: Invalid data, no created date"),d(this,hn,ge(e.name)),e.author!=null)d(this,vn,{type:"user",username:e.author,id:e.authorFullname?ie(e.authorFullname):void 0});else if(e.subreddit!=null)d(this,vn,{type:"subreddit",name:e.subreddit,id:e.subredditId?Re(e.subredditId):void 0});else throw new Error("PrivateMessage: Invalid data, no author or subreddit");d(this,Ao,e.body??""),d(this,Eo,e.bodyHtml??"");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Ro,i),d(this,Yd,e.parentId?ge(e.parentId):void 0),d(this,Oo,t)}static async getMessages(e,t){let i=u.redditAPIPlugins.PrivateMessages;return new j({...e,fetch:async n=>{let o=await i.MessageWhere({...n,where:e.type??"inbox"},t);return{after:o.data?.after,before:o.data?.before,children:o.data?.children?.map(a=>new Rm(a.data,t)).filter(Boolean)||[]}}})}static async send({to:e,subject:t,text:i},n){await u.redditAPIPlugins.PrivateMessages.Compose({to:e,subject:t,text:i,fromSr:""},n)}static async sendAsSubreddit({to:e,fromSubredditName:t,subject:i,text:n},o){await u.redditAPIPlugins.PrivateMessages.Compose({to:e,fromSr:t,subject:i,text:n},o)}static async markAllAsRead(e){await u.redditAPIPlugins.PrivateMessages.ReadAllMessages({filterTypes:""},e)}get id(){return s(this,hn)}get from(){return s(this,vn)}get body(){return s(this,Ao)}get bodyHtml(){return s(this,Eo)}get created(){return s(this,Ro)}async markAsRead(){await u.redditAPIPlugins.PrivateMessages.ReadMessage({id:s(this,hn)},s(this,Oo))}};hn=new WeakMap,vn=new WeakMap,Yd=new WeakMap,Ao=new WeakMap,Eo=new WeakMap,Ro=new WeakMap,Oo=new WeakMap;var pr=Rm;var iy=(o=>(o.Reports="reports",o.Spam="spam",o.Modqueue="modqueue",o.Unmoderated="unmoderated",o.Edited="edited",o))(iy||{}),yn,x,Fo,Mo,Lo,Uo,Bo,Do,_o,No,qo,bn,E,ot=class ot{constructor(e,t){l(this,yn);l(this,x);l(this,Fo);l(this,Mo);l(this,Lo);l(this,Uo);l(this,Bo);l(this,Do);l(this,_o);l(this,No);l(this,qo);l(this,bn);l(this,E);K(this),g(e.id,"Subreddit id is missing or undefined"),g(e.displayName,"Subreddit name is missing or undefined"),d(this,yn,Re(`t5_${e.id}`)),d(this,x,e.displayName),g(e.createdUtc,"Subreddit is missing created date");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Fo,i),d(this,Mo,_O(e.subredditType)),d(this,Lo,e.title),d(this,Uo,e.description),g(e.lang,"Subreddit is missing language"),d(this,Bo,e.lang),d(this,Do,e.subscribers??0),d(this,_o,e.activeUserCount??0),d(this,No,e.over18??!1),d(this,bn,e.url??""),d(this,qo,{acceptFollowers:e.acceptFollowers??!1,allOriginalContent:e.allOriginalContent??!1,allowChatPostCreation:e.allowChatPostCreation??!1,allowDiscovery:e.allowDiscovery??!1,allowGalleries:e.allowGalleries??!1,allowImages:e.allowImages??!1,allowPolls:e.allowPolls??!1,allowPredictionContributors:e.allowPredictionContributors??!1,allowPredictions:e.allowPredictions??!1,allowPredictionsTournament:e.allowPredictionsTournament??!1,allowTalks:e.allowTalks??!1,allowVideoGifs:e.allowVideogifs??!1,allowVideos:e.allowVideos??!1,chatPostEnabled:e.isChatPostFeatureEnabled??!1,collectionsEnabled:e.collectionsEnabled??!1,crosspostable:e.isCrosspostableSubreddit??!1,emojisEnabled:e.emojisEnabled??!1,eventPostsEnabled:e.eventPostsEnabled??!1,linkFlairEnabled:e.linkFlairEnabled??!1,originalContentTagEnabled:e.originalContentTagEnabled??!1,restrictCommenting:e.restrictCommenting??!1,restrictPosting:e.restrictPosting??!1,shouldArchivePosts:e.shouldArchivePosts??!1,spoilersEnabled:e.spoilersEnabled??!1,wikiEnabled:e.wikiEnabled??!1,allowedPostType:NO(e.submissionType),allowedMediaInComments:(e.allowedMediaInComments??[]).map(qO),bannerBackgroundColor:e.bannerBackgroundColor,bannerBackgroundImage:e.bannerBackgroundImage,bannerImage:e.bannerImg,communityIcon:e.communityIcon,headerTitle:e.headerTitle,mobileBannerImage:e.mobileBannerImage,userFlairs:{enabled:e.userFlairEnabledInSr??!1,usersCanAssign:e.canAssignUserFlair??!1},postFlairs:{enabled:e.linkFlairEnabled??!1,usersCanAssign:e.canAssignLinkFlair??!1},url:new URL(s(this,bn),"https://www.reddit.com").toString()}),d(this,E,t)}get id(){return s(this,yn)}get name(){return s(this,x)}get createdAt(){return s(this,Fo)}get type(){return s(this,Mo)}get title(){return s(this,Lo)}get description(){return s(this,Uo)}get language(){return s(this,Bo)}get numberOfSubscribers(){return s(this,Do)}get numberOfActiveUsers(){return s(this,_o)}get nsfw(){return s(this,No)}get settings(){return s(this,qo)}get userFlairsEnabled(){return this.settings.userFlairs.enabled}get postFlairsEnabled(){return this.settings.postFlairs.enabled}get usersCanAssignUserFlairs(){return this.settings.userFlairs.usersCanAssign}get usersCanAssignPostFlairs(){return this.settings.postFlairs.usersCanAssign}get url(){return this.settings.url}get permalink(){return s(this,bn)}toJSON(){return{id:this.id,name:this.name,createdAt:this.createdAt,type:this.type,title:this.title,description:this.description,language:this.language,nsfw:this.nsfw,numberOfSubscribers:this.numberOfSubscribers,numberOfActiveUsers:this.numberOfActiveUsers,settings:this.settings}}async submitPost(e){let t={...e,subredditName:s(this,x)};return V.submit(t,s(this,E))}getControversialPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return V.getControversialPosts({...e,subredditName:s(this,x)},s(this,E))}getTopPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return V.getTopPosts({...e,subredditName:s(this,x)},s(this,E))}getApprovedUsers(e={}){return w.getSubredditUsersByType({type:"contributors",subredditName:s(this,x),...e},s(this,E))}approveUser(e){return w.createRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,E))}removeUser(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,E))}getWikiContributors(e={}){return w.getSubredditUsersByType({type:"wikicontributors",subredditName:s(this,x),...e},s(this,E))}addWikiContributor(e){return w.createRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,E))}removeWikiContributor(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,E))}getBannedUsers(e={}){return w.getSubredditUsersByType({type:"banned",subredditName:s(this,x),...e},s(this,E))}banUser(e){return w.createRelationship({username:e.username,subredditName:s(this,x),type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,E))}unbanUser(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"banned"},s(this,E))}getBannedWikiContributors(e={}){return w.getSubredditUsersByType({type:"wikibanned",subredditName:s(this,x),...e},s(this,E))}banWikiContributor(e){return w.createRelationship({username:e.username,subredditName:s(this,x),type:"wikibanned",banReason:e.reason,note:e.note,duration:e.duration},s(this,E))}unbanWikiContributor(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"wikibanned"},s(this,E))}getModerators(e={}){return w.getSubredditUsersByType({type:"moderators",subredditName:s(this,x),...e},s(this,E))}inviteModerator(e,t){return w.createRelationship({type:"moderator_invite",subredditName:s(this,x),username:e,permissions:t??[]},s(this,E))}revokeModeratorInvite(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"moderator_invite"},s(this,E))}removeModerator(e){return w.removeRelationship({type:"moderator",subredditName:s(this,x),username:e},s(this,E))}setModeratorPermissions(e,t){return w.setModeratorPermissions(e,s(this,x),t,s(this,E))}getMutedUsers(e={}){return w.getSubredditUsersByType({type:"muted",subredditName:s(this,x),...e},s(this,E))}muteUser(e,t){return w.createRelationship({username:e,subredditName:s(this,x),type:"muted",note:t},s(this,E))}unmuteUser(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"muted"},s(this,E))}getModerationLog(e){return pd({subredditName:s(this,x),...e},s(this,E))}getUserFlairTemplates(){return ae.getUserFlairTemplates(s(this,x),s(this,E))}getPostFlairTemplates(){return ae.getPostFlairTemplates(s(this,x),s(this,E))}createPostFlairTemplate(e){return ae.createPostFlairTemplate({subredditName:s(this,x),...e},s(this,E))}createUserFlairTemplate(e){return ae.createUserFlairTemplate({subredditName:s(this,x),...e},s(this,E))}async getUserFlair(e){if(e?.usernames!==void 0)return{users:await Promise.all(e.usernames.map(async i=>{let n=await Le.getUserFlairBySubreddit({subreddit:s(this,x),name:i},s(this,E));return Hs(n.users[0])}))};{let t=await Le.getUserFlairBySubreddit({...e,subreddit:s(this,x)},s(this,E));return{next:t.next,prev:t.prev,users:t.users.map(i=>Hs(i))}}}getModQueue(e={type:"all"}){return ot.aboutLocation({...e,location:"modqueue",subreddit:s(this,x)},s(this,E))}getReports(e={type:"all"}){return ot.aboutLocation({...e,location:"reports",subreddit:s(this,x)},s(this,E))}getSpam(e={type:"all"}){return ot.aboutLocation({...e,location:"spam",subreddit:s(this,x)},s(this,E))}getUnmoderated(e={type:"all"}){return ot.aboutLocation({...e,location:"unmoderated",subreddit:s(this,x)},s(this,E))}getEdited(e={type:"all"}){return ot.aboutLocation({...e,location:"edited",subreddit:s(this,x)},s(this,E))}static aboutLocation(e,t){let i=u.redditAPIPlugins.Moderation,n;switch(e.type){case"post":n="links";break;case"comment":n="comments";break;default:n=void 0}return new j({...e,fetch:async o=>{let a=await i.AboutLocation({...o,...e,only:n},t);return yS(a,t)}})}getCommentsAndPostsByIds(e){let t=u.redditAPIPlugins.LinksAndComments;return new j({fetch:async()=>{let i=await t.Info({thingIds:e,subreddits:[s(this,yn)]},s(this,E));return yS(i,s(this,E))}})}static async addRemovalReason(e,t,i,n){return(await u.redditAPIPlugins.Subreddits.SubredditAddRemovalReason({title:t,message:i,subreddit:e},n)).id}static async getRemovalReasons(e,t){let n=await u.redditAPIPlugins.Subreddits.SubredditGetRemovalReasons({subreddit:e},t);return n.order.map(o=>({...n.data[o]}))}static async getFromMetadata(e){g(e);let t=e?.[D.Subreddit]?.values[0];return g(t),ot.getById(Re(t),e)}static async getById(e,t){let o=(await u.redditAPIPlugins.LinksAndComments.Info({thingIds:[e],subreddits:[]},t)).data?.children[0]?.data?.displayName;return g(o),ot.getByName(o,t)}static async getByName(e,t){let n=await u.redditAPIPlugins.Subreddits.SubredditAbout({subreddit:e},t);if(!n?.data)throw new Error("not found");return new ot(n.data,t)}};yn=new WeakMap,x=new WeakMap,Fo=new WeakMap,Mo=new WeakMap,Lo=new WeakMap,Uo=new WeakMap,Bo=new WeakMap,Do=new WeakMap,_o=new WeakMap,No=new WeakMap,qo=new WeakMap,bn=new WeakMap,E=new WeakMap;var he=ot;async function ny(r,e){let o=(await Gt.query("GetSubredditLeaderboard","18ead70c46b6446d45ecd8b679b16d9a929a933d6ef25d8262a459cb18b72848",{id:r},e)).data?.subredditInfoById?.leaderboard;if(!o)throw new Error("subreddit leaderboard not found");if(!o.summary)throw new Error("subreddit leaderboard summary not found");return{id:o.id,summary:o.summary}}function _O(r){if(r==="public"||r==="private"||r==="restricted"||r==="employees_only"||r==="gold_restricted"||r==="archived")return r;throw new Error(`invalid subreddit type: ${r}`)}function NO(r){if(r==="any"||r==="link"||r==="self")return r;throw new Error(`invalid allowed post type: ${r}`)}function qO(r){if(r==="animated"||r==="giphy"||r==="static"||r==="expression")return r;throw new Error(`invalid comment media type: ${r}`)}function yS(r,e){let i=(r.data?.children??[]).map(a=>{let c=n(a);if(c!=null)return c;let p=o(a);return p??null}).filter(Boolean);return{after:r.data?.after,before:r.data?.before,children:i};function n(a){try{return new V(a.data,e)}catch{return null}}function o(a){try{return new Y(a.data,e)}catch{return null}}}async function sy(r,e){return bS("GetVaultContactByAddress","3e2f7966a5c120e64fd2795d06a46595c52d988185be98d3ed71c3f81ae80d2e",{provider:"ethereum",address:r},e)}async function oy(r,e){return bS("GetVaultContactByUserId","a854ddc19d0e22c4f36ed917fdbd568f299f3571427e393aee5e2972080fffe9",{provider:"ethereum",userId:r},e)}async function bS(r,e,t,i){let o=(await Gt.query(r,e,t,i))?.data?.vault?.contact;return{provider:o?.provider,userId:ie(o?.userId),address:o?.address,createdAt:o?.createdAt,isActive:o?.isActive}}import{CommunityListWidget_CommunityData as HO,GetWidgetsResponse_WidgetItem as le}from"@devvit/protos";var Ho,jo,Wo,Go,Fm=class Fm{constructor(e,t,i){l(this,Ho);l(this,jo);l(this,Wo);l(this,Go);K(this),d(this,Ho,e.id),d(this,jo,e.shortName),d(this,Wo,t),d(this,Go,i)}get id(){return s(this,Ho)}get name(){return s(this,jo)}get subredditName(){return s(this,Wo)}toJSON(){return{id:this.id,name:this.name,subredditName:this.subredditName}}delete(){return Fm.delete(this.subredditName,this.id,s(this,Go))}static async getWidgets(e,t){let n=await u.redditAPIPlugins.Widgets.GetWidgets({subreddit:e},t);g(n.layout,"Failed to load widgets for subreddit");let o=n.items,a=[];for(let c of n.layout.sidebar?.order??[]){let p=o[c];switch(p?.kind){case"image":a.push(new Qd(p,e,t));break;case"calendar":a.push(new el(p,e,t));break;case"textarea":a.push(new tl(p,e,t));break;case"button":a.push(new rl(p,e,t));break;case"community-list":a.push(new il(p,e,t));break;case"post-flair":a.push(new nl(p,e,t));break;case"custom":a.push(new sl(p,e,t));break;case"subreddit-rules":{let f=await u.redditAPIPlugins.Subreddits.SubredditAboutRules({subreddit:e},t);a.push(new Om(f,p,e,t));break}default:throw new Error(`Unknown widget type: ${p.kind}`)}}return a}static async delete(e,t,i){await u.redditAPIPlugins.Widgets.DeleteWidget({subreddit:e,id:t},i)}static async reorder(e,t,i){await u.redditAPIPlugins.Widgets.OrderWidgets({subreddit:e,order:t},i)}static async add(e,t){switch(e?.type){case"image":return Qd.create(e,t);case"calendar":return el.create(e,t);case"textarea":return tl.create(e,t);case"button":return rl.create(e,t);case"community-list":return il.create(e,t);case"post-flair":return nl.create(e,t);case"custom":return sl.create(e,t);default:throw new Error("Unknown widget type")}}};Ho=new WeakMap,jo=new WeakMap,Wo=new WeakMap,Go=new WeakMap;var ne=Fm,Vo,ol=class ol extends ne{constructor(t,i,n){super(t,i,n);l(this,Vo);d(this,Vo,t.data.map(o=>(g(o.url,"Image widget data is missing url"),g(o.height,"Image widget data is missing height"),g(o.width,"Image widget data is missing width"),g(o.linkUrl,"Image widget data is missing linkUrl"),{url:o.url,height:o.height,width:o.width,linkUrl:o.linkUrl})))}get images(){return s(this,Vo)}toJSON(){return{...super.toJSON(),images:this.images}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddImageWidget(t,i);return new ol(le.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateImageWidget(t,i);return new ol(le.fromJSON(o),t.subreddit,i)}};Vo=new WeakMap;var Qd=ol,zo,Jo,$o,al=class al extends ne{constructor(t,i,n){super(t,i,n);l(this,zo);l(this,Jo);l(this,$o);g(t.googleCalendarId,"Calendar widget data is missing googleCalendarId"),g(t.configuration,"Calendar widget data is missing configuration"),g(t.styles,"Calendar widget data is missing styles"),d(this,zo,t.googleCalendarId),d(this,Jo,t.configuration),d(this,$o,t.styles)}get googleCalendarId(){return s(this,zo)}get configuration(){return s(this,Jo)}get styles(){return s(this,$o)}toJSON(){return{...super.toJSON(),googleCalendarId:this.googleCalendarId,configuration:this.configuration,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddCalendarWidget(t,i);return new al(le.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCalendarWidget(t,i);return new al(le.fromJSON(o),t.subreddit,i)}};zo=new WeakMap,Jo=new WeakMap,$o=new WeakMap;var el=al,Ko,Xo,dl=class dl extends ne{constructor(t,i,n){super(t,i,n);l(this,Ko);l(this,Xo);g(t.text,"Textarea widget data is missing text"),g(t.styles,"Textarea widget data is missing styles"),d(this,Ko,t.text),d(this,Xo,t.styles)}get text(){return s(this,Ko)}get styles(){return s(this,Xo)}toJSON(){return{...super.toJSON(),text:this.text,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddTextAreaWidget(t,i);return new dl(le.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateTextAreaWidget(t,i);return new dl(le.fromJSON(o),t.subreddit,i)}};Ko=new WeakMap,Xo=new WeakMap;var tl=dl,Zo,Yo,Qo,ll=class ll extends ne{constructor(t,i,n){super(t,i,n);l(this,Zo);l(this,Yo);l(this,Qo);g(t.styles,"Button widget data is missing styles"),d(this,Zo,t.buttons),d(this,Yo,t.description??""),d(this,Qo,t.styles)}get buttons(){return s(this,Zo)}get description(){return s(this,Yo)}get styles(){return s(this,Qo)}toJSON(){return{...super.toJSON(),buttons:this.buttons,description:this.description,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddButtonWidget(t,i);return new ll(le.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateButtonWidget(t,i);return new ll(le.fromJSON(o),t.subreddit,i)}};Zo=new WeakMap,Yo=new WeakMap,Qo=new WeakMap;var rl=ll,ea,ta,ul=class ul extends ne{constructor(t,i,n){super(t,i,n);l(this,ea);l(this,ta);d(this,ea,t.data.map(o=>HO.fromJSON(o))),g(t.styles,"Community list widget data is missing styles"),d(this,ta,t.styles)}get communities(){return s(this,ea)}get styles(){return s(this,ta)}toJSON(){return{...super.toJSON(),communities:this.communities,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddCommunityListWidget(t,i);return new ul(le.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCommunityListWidget(t,i);return new ul(le.fromJSON(o),t.subreddit,i)}};ea=new WeakMap,ta=new WeakMap;var il=ul,ra,ia,na,cl=class cl extends ne{constructor(t,i,n){super(t,i,n);l(this,ra);l(this,ia);l(this,na);if(g(t.styles,"Post flair widget data is missing styles"),d(this,ra,t.styles),d(this,ia,t.order.map(o=>t.templates[o])),!(t.display&&t.display==="list"||t.display==="cloud"))throw new Error("Post flair widget data is missing display type");d(this,na,t.display)}get styles(){return s(this,ra)}get templates(){return s(this,ia)}get display(){return s(this,na)}toJSON(){return{...super.toJSON(),styles:this.styles,templates:this.templates,display:this.display}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddPostFlairWidget(t,i);return new cl(le.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdatePostFlairWidget(t,i);return new cl(le.fromJSON(o),t.subreddit,i)}};ra=new WeakMap,ia=new WeakMap,na=new WeakMap;var nl=cl,sa,oa,aa,da,la,ml=class ml extends ne{constructor(t,i,n){super(t,i,n);l(this,sa);l(this,oa);l(this,aa);l(this,da);l(this,la);g(t.stylesheetUrl,"Custom widget data is missing stylesheetUrl"),g(t.height,"Custom widget data is missing height"),g(t.css,"Custom widget data is missing css"),d(this,sa,t.imageData??[]),d(this,oa,t.text??""),d(this,aa,t.stylesheetUrl),d(this,da,t.height),d(this,la,t.css)}get images(){return s(this,sa)}get text(){return s(this,oa)}get stylesheetUrl(){return s(this,aa)}get height(){return s(this,da)}get css(){return s(this,la)}toJSON(){return{...super.toJSON(),images:this.images,text:this.text,stylesheetUrl:this.stylesheetUrl,height:this.height,css:this.css}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddCustomWidget(t,i);return new ml(le.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCustomWidget(t,i);return new ml(le.fromJSON(o),t.subreddit,i)}};sa=new WeakMap,oa=new WeakMap,aa=new WeakMap,da=new WeakMap,la=new WeakMap;var sl=ml,ua,Om=class extends ne{constructor(t,i,n,o){super(i,n,o);l(this,ua);let a=t.rules.map(({description:c,priority:p,shortName:f,violationReason:v})=>(g(c,"Subreddit rule is missing description"),g(p,"Subreddit rule is missing priority"),g(f,"Subreddit rule is missing shortName"),g(v,"Subreddit rule is missing violationReason"),{description:c,priority:p,shortName:f,violationReason:v}));d(this,ua,a)}get rules(){return s(this,ua)}toJSON(){return{...super.toJSON(),rules:this.rules}}};ua=new WeakMap;var jO=(i=>(i[i.SUBREDDIT_PERMISSIONS=0]="SUBREDDIT_PERMISSIONS",i[i.APPROVED_CONTRIBUTORS_ONLY=1]="APPROVED_CONTRIBUTORS_ONLY",i[i.MODS_ONLY=2]="MODS_ONLY",i))(jO||{}),ke,Se,kn,Sn,Pn,Cn,In,Xe,qe=class qe{constructor(e,t,i,n){l(this,ke);l(this,Se);l(this,kn);l(this,Sn);l(this,Pn);l(this,Cn);l(this,In);l(this,Xe);K(this),d(this,ke,e),d(this,Se,t),d(this,kn,i.contentMd),d(this,Sn,i.revisionId),d(this,Pn,new Date(i.revisionDate)),d(this,Cn,i.reason??""),g(i.revisionBy?.data,"Wiki page author details are missing"),d(this,In,new w(i.revisionBy.data,n)),d(this,Xe,n)}get name(){return s(this,ke)}get subredditName(){return s(this,Se)}get content(){return s(this,kn)}get revisionId(){return s(this,Sn)}get revisionDate(){return s(this,Pn)}get revisionReason(){return s(this,Cn)}get revisionAuthor(){return s(this,In)}toJSON(){return{name:s(this,ke),subredditName:s(this,Se),content:s(this,kn),revisionId:s(this,Sn),revisionDate:s(this,Pn),revisionReason:s(this,Cn),revisionAuthor:s(this,In).toJSON()}}async update(e,t){return qe.updatePage({subredditName:s(this,Se),page:s(this,ke),content:e,reason:t},s(this,Xe))}async getRevisions(e){return qe.getPageRevisions({subredditName:s(this,Se),page:s(this,ke),...e},s(this,Xe))}async revertTo(e){return qe.revertPage(s(this,Se),s(this,ke),e,s(this,Xe))}async getSettings(){return qe.getPageSettings(s(this,Se),s(this,ke),s(this,Xe))}async updateSettings(e){return qe.updatePageSettings({subredditName:s(this,Se),page:s(this,ke),listed:e.listed,permLevel:e.permLevel},s(this,Xe))}async addEditor(e){return qe.addEditor(s(this,Se),s(this,ke),e,s(this,Xe))}async removeEditor(e){return qe.removeEditor(s(this,Se),s(this,ke),e,s(this,Xe))}static async getPage(e,t,i){let o=await u.redditAPIPlugins.Wiki.GetWikiPage({subreddit:e,page:t},i);return g(o.data,"Failed to get wiki page"),new qe(t,e,o.data,i)}static async getPages(e,t){return(await u.redditAPIPlugins.Wiki.GetWikiPages({subreddit:e},t)).data||[]}static async createPage(e,t){return qe.updatePage(e,t)}static async updatePage(e,t){return await u.redditAPIPlugins.Wiki.EditWikiPage({subreddit:e.subredditName,page:e.page,content:e.content,reason:e.reason??""},t),qe.getPage(e.subredditName,e.page,t)}static getPageRevisions(e,t){let i=u.redditAPIPlugins.Wiki;return new j({hasMore:!0,after:e.after,limit:e.limit,pageSize:e.pageSize,async fetch(n){let o=await i.GetWikiPageRevisions({subreddit:e.subredditName,page:e.page,limit:n.limit,after:n.after,before:n.before},t);return WO(o,t)}})}static async revertPage(e,t,i,n){await u.redditAPIPlugins.Wiki.RevertWikiPage({subreddit:e,page:t,revision:i},n)}static async getPageSettings(e,t,i){let o=await u.redditAPIPlugins.Wiki.GetWikiPageSettings({subreddit:e,page:t},i);return g(o.data,"Failed to get wiki page settings"),new pl(o.data,i)}static async updatePageSettings(e,t){let n=await u.redditAPIPlugins.Wiki.UpdateWikiPageSettings({subreddit:e.subredditName,page:e.page,listed:e.listed?"on":"",permlevel:e.permLevel},t);return g(n.data,"Failed to update wiki page settings"),new pl(n.data,t)}static async addEditor(e,t,i,n){await u.redditAPIPlugins.Wiki.AllowEditor({act:"add",subreddit:e,page:t,username:i},n)}static async removeEditor(e,t,i,n){await u.redditAPIPlugins.Wiki.AllowEditor({act:"del",subreddit:e,page:t,username:i},n)}};ke=new WeakMap,Se=new WeakMap,kn=new WeakMap,Sn=new WeakMap,Pn=new WeakMap,Cn=new WeakMap,In=new WeakMap,Xe=new WeakMap;var ve=qe,wn,xn,Tn,An,En,Rn,Mm=class{constructor(e,t){l(this,wn);l(this,xn);l(this,Tn);l(this,An);l(this,En);l(this,Rn);d(this,wn,e.id),d(this,xn,e.page),d(this,Tn,new Date(e.timestamp)),g(e.author?.data,"Wiki page revision author details are missing"),d(this,An,new w(e.author.data,t)),d(this,En,e.reason??""),d(this,Rn,e.revisionHidden??!1)}get id(){return s(this,wn)}get page(){return s(this,xn)}get date(){return s(this,Tn)}get author(){return s(this,An)}get reason(){return s(this,En)}get hidden(){return s(this,Rn)}toJSON(){return{id:s(this,wn),page:s(this,xn),date:s(this,Tn),author:s(this,An).toJSON(),reason:s(this,En),hidden:s(this,Rn)}}};wn=new WeakMap,xn=new WeakMap,Tn=new WeakMap,An=new WeakMap,En=new WeakMap,Rn=new WeakMap;var On,Fn,Mn,pl=class{constructor(e,t){l(this,On);l(this,Fn);l(this,Mn);d(this,On,e.listed),d(this,Fn,e.permLevel),d(this,Mn,e.editors.map(i=>(g(i.data,"Wiki page editor details are missing"),new w(i.data,t))))}get listed(){return s(this,On)}get permLevel(){return s(this,Fn)}get editors(){return s(this,Mn)}toJSON(){return{listed:s(this,On),permLevel:s(this,Fn),editors:s(this,Mn).map(e=>e.toJSON())}}};On=new WeakMap,Fn=new WeakMap,Mn=new WeakMap;function WO(r,e){return g(r.data?.children,"Wiki page revision listing is missing children"),{children:r.data.children.map(i=>new Mm(i,e)),before:r.data.before,after:r.data.after}}var GO=(t=>(t.Gallery="GALLERY",t.Timeline="TIMELINE",t))(GO||{});function VO(r){return r==="GALLERY"?"GALLERY":"TIMELINE"}var He,Pe,ma,Ln,Un,pa,fa,ga,ha,St,va,ya,Bn,ca=class ca{constructor(e,t){l(this,He);l(this,Pe);l(this,ma);l(this,Ln);l(this,Un);l(this,pa);l(this,fa);l(this,ga);l(this,ha);l(this,St);l(this,va);l(this,ya);l(this,Bn);g(e.collectionId,"Collection Id is missing or undefined"),g(e.subredditId,"Subreddit Id is missing or undefined"),g(e.title,"Collection title is missing or undefined"),g(e.authorId,"Collection author's id is missing or undefined"),g(e.authorName,"Collection author's id is missing or undefined"),g(e.createdAtUtc,"Collection create timestamp is missing"),g(e.lastUpdateUtc,"Collection last updated timestamp is missing"),d(this,He,t),d(this,Pe,e.collectionId),d(this,ma,e.subredditId),d(this,Ln,e.title),d(this,Un,e.description||""),d(this,pa,e.authorId),d(this,fa,e.authorName),d(this,ga,e.permalink),d(this,ha,e.primaryLinkId),d(this,St,e.linkIds||[]),d(this,Bn,VO(e.displayLayout)),d(this,va,e.createdAtUtc),d(this,ya,e.lastUpdateUtc),K(this)}get id(){return s(this,Pe)}get subredditId(){return s(this,ma)}get title(){return s(this,Ln)}get description(){return s(this,Un)}get authorId(){return s(this,pa)}get authorName(){return s(this,fa)}get permalink(){return s(this,ga)}get primaryLinkId(){return s(this,ha)}get linkIds(){return s(this,St)}get createdAtUtc(){return s(this,va)}get lastUpdateUtc(){return s(this,ya)}get displayLayout(){return s(this,Bn)}static async getCollectionById(e,t){let n=await u.redditAPIPlugins.PostCollections.Collection(e,t);return new ca(n,t)}static async create(e,t){let n=await u.redditAPIPlugins.PostCollections.Create({srFullname:e.subredditId,title:e.title,description:e.description,displayLayout:e.displayLayout},t);return new ca(n,t)}static async getCollectionsForSubreddit(e,t){return(await u.redditapiv2Plugin.GetSubredditCollections({srFullname:e.subredditId},t)).collections.map(n=>new ca(n,t))}async addPost(e){await u.redditAPIPlugins.PostCollections.AddPost({collectionId:s(this,Pe),linkFullname:e},s(this,He)),s(this,St).push(e)}async removePost(e){await u.redditAPIPlugins.PostCollections.RemovePost({collectionId:s(this,Pe),linkFullname:e},s(this,He)),d(this,St,s(this,St).filter(i=>i!==e))}async delete(){await u.redditAPIPlugins.PostCollections.Delete({collectionId:s(this,Pe)},s(this,He))}async follow(e){await u.redditAPIPlugins.PostCollections.Follow({collectionId:s(this,Pe),follow:e},s(this,He))}async reorder(e){await u.redditAPIPlugins.PostCollections.Reorder({collectionId:s(this,Pe),linkIds:e.join(",")},s(this,He)),d(this,St,e)}async updateTitle(e){await u.redditAPIPlugins.PostCollections.UpdateTitle({collectionId:s(this,Pe),title:e},s(this,He)),d(this,Ln,e)}async updateDescription(e){await u.redditAPIPlugins.PostCollections.UpdateDescription({collectionId:s(this,Pe),description:e},s(this,He)),d(this,Un,e)}async updateLayout(e){await u.redditAPIPlugins.PostCollections.UpdateDisplayLayout({collectionId:s(this,Pe),displayLayout:e},s(this,He)),d(this,Bn,e)}};He=new WeakMap,Pe=new WeakMap,ma=new WeakMap,Ln=new WeakMap,Un=new WeakMap,pa=new WeakMap,fa=new WeakMap,ga=new WeakMap,ha=new WeakMap,St=new WeakMap,va=new WeakMap,ya=new WeakMap,Bn=new WeakMap;var pi=ca;var zO=["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"],JO=["border-image","border-image-source","behavior","expression","list-style-image","cursor","content"],$O=["onload","onerror","onclick","onmouseover"];function KO(r){return/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/.test(r)?r:r.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"')}function kS(r){if(r){if(!r.trim().startsWith("<svg")){console.log("The provided string is not a valid SVG.");return}try{let e=new RegExp(`<\\s*(${zO.join("|")})\\b`,"gi"),t=new RegExp(`(${JO.join("|")})\\s*:\\s*url\\s*\\((['"]?)(.*?)\\2\\)`,"gi"),i=new RegExp(`(${$O.join("|")})\\s*(=\\s*(['"]?)(.*?)\\3)?`,"gi");r=r.trim().replace(/\s+/g," "),r=KO(r);let n=r.match(e)||[],o=r.match(t)||[],a=r.match(i)||[],c=!1;return n.length>0&&(c=!0,console.warn(`Disallowed elements detected in SVG: ${n.map(p=>p.replace("<","")).join(", ")}`)),o.length>0&&(c=!0,console.warn(`Disallowed styles detected in SVG: ${o.map(p=>p.split(":")[0]).join(", ")}`)),a.length>0&&(c=!0,console.warn(`Disallowed attributes detected in SVG: ${a.map(p=>p.split("=")[0]).join(", ")}`)),c?void 0:r}catch{return}}}function zH(r,...e){let t="";return r.forEach((i,n)=>{t+=i;let o=e[n];o!==void 0&&(t+=`${o}`)}),t=kS(t),t===void 0?"":`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t)}`}export{hL as ALL_ICON_NAMES,iy as AboutLocations,rl as ButtonWidget,el as CalendarWidget,GO as CollectionDisplayLayout,Y as Comment,il as CommunityListWidget,sl as CustomWidget,u as Devvit,Le as Flair,ae as FlairTemplate,bO as FlairType,xt as Hook,Qd as ImageWidget,j as Listing,BO as ModMailActionType,LO as ModMailConversationState,fd as ModMailService,Me as ModNote,V as Post,pi as PostCollection,nl as PostFlairWidget,pr as PrivateMessage,Ns as RichTextBuilder,pc as SettingScope,he as Subreddit,Om as SubredditRulesWidget,tl as TextAreaWidget,w as User,ne as Widget,ve as WikiPage,jO as WikiPagePermissionLevel,Mm as WikiPageRevision,pl as WikiPageSettings,Hs as convertUserFlairProtoToAPI,pd as getModerationLog,ny as getSubredditLeaderboard,sy as getVaultByAddress,oy as getVaultByUserId,zH as svg,nO as useAsync,nm as useChannel,em as useForm,am as useInterval,mm as useState};
6
6
  /*! Bundled license information:
7
7
 
8
8
  shallow-clone/index.js: