@devvit/public-api 0.11.0-next-2024-08-28-c7054fdb3.0 → 0.11.0-next-2024-08-29-fd7c15444.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 AS=Object.create;var Nm=Object.defineProperty;var TS=Object.getOwnPropertyDescriptor;var ES=Object.getOwnPropertyNames;var RS=Object.getPrototypeOf,OS=Object.prototype.hasOwnProperty;var _m=r=>{throw TypeError(r)};var f=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var BS=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ES(e))!OS.call(r,n)&&n!==t&&Nm(r,n,{get:()=>e[n],enumerable:!(i=TS(e,n))||i.enumerable});return r};var qn=(r,e,t)=>(t=r!=null?AS(RS(r)):{},BS(e||!r||!r.__esModule?Nm(t,"default",{value:r,enumerable:!0}):t,r));var fl=(r,e,t)=>e.has(r)||_m("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)?_m("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 ae=f((lO,qm)=>{qm.exports=function(r){try{return!!r()}catch{return!0}}});var Sa=f((uO,Hm)=>{var MS=ae();Hm.exports=!MS(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Z=f((cO,Gm)=>{var jm=Sa(),Wm=Function.prototype,vl=Wm.call,US=jm&&Wm.bind.bind(vl,vl);Gm.exports=jm?US:function(r){return function(){return vl.apply(r,arguments)}}});var zm=f((mO,Vm)=>{var LS=Math.ceil,DS=Math.floor;Vm.exports=Math.trunc||function(e){var t=+e;return(t>0?DS:LS)(t)}});var Pa=f((pO,Jm)=>{var NS=zm();Jm.exports=function(r){var e=+r;return e!==e||e===0?0:NS(e)}});var pe=f((gO,$m)=>{var Ca=function(r){return r&&r.Math==Math&&r};$m.exports=Ca(typeof globalThis=="object"&&globalThis)||Ca(typeof window=="object"&&window)||Ca(typeof self=="object"&&self)||Ca(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var Gr=f((hO,Km)=>{Km.exports=!1});var wa=f((fO,Zm)=>{var Xm=pe(),_S=Object.defineProperty;Zm.exports=function(r,e){try{_S(Xm,r,{value:e,configurable:!0,writable:!0})}catch{Xm[r]=e}return e}});var Ia=f((vO,Qm)=>{var qS=pe(),HS=wa(),Ym="__core-js_shared__",jS=qS[Ym]||HS(Ym,{});Qm.exports=jS});var yl=f((yO,tp)=>{var WS=Gr(),ep=Ia();(tp.exports=function(r,e){return ep[r]||(ep[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:WS?"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 Fa=f((bO,rp)=>{rp.exports=function(r){return r==null}});var xa=f((kO,ip)=>{var GS=Fa(),VS=TypeError;ip.exports=function(r){if(GS(r))throw VS("Can't call method on "+r);return r}});var Hn=f((SO,np)=>{var zS=xa(),JS=Object;np.exports=function(r){return JS(zS(r))}});var we=f((PO,sp)=>{var $S=Z(),KS=Hn(),XS=$S({}.hasOwnProperty);sp.exports=Object.hasOwn||function(e,t){return XS(KS(e),t)}});var bl=f((CO,op)=>{var ZS=Z(),YS=0,QS=Math.random(),eP=ZS(1 .toString);op.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+eP(++YS+QS,36)}});var dp=f((wO,ap)=>{ap.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var hp=f((IO,gp)=>{var pp=pe(),kl=dp(),lp=pp.process,up=pp.Deno,cp=lp&&lp.versions||up&&up.version,mp=cp&&cp.v8,We,Aa;mp&&(We=mp.split("."),Aa=We[0]>0&&We[0]<4?1:+(We[0]+We[1]));!Aa&&kl&&(We=kl.match(/Edge\/(\d+)/),(!We||We[1]>=74)&&(We=kl.match(/Chrome\/(\d+)/),We&&(Aa=+We[1])));gp.exports=Aa});var Sl=f((FO,vp)=>{var fp=hp(),tP=ae();vp.exports=!!Object.getOwnPropertySymbols&&!tP(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&fp&&fp<41})});var Pl=f((xO,yp)=>{var rP=Sl();yp.exports=rP&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ie=f((AO,kp)=>{var iP=pe(),nP=yl(),bp=we(),sP=bl(),oP=Sl(),aP=Pl(),Vr=iP.Symbol,Cl=nP("wks"),dP=aP?Vr.for||Vr:Vr&&Vr.withoutSetter||sP;kp.exports=function(r){return bp(Cl,r)||(Cl[r]=oP&&bp(Vr,r)?Vr[r]:dP("Symbol."+r)),Cl[r]}});var Cp=f((TO,Pp)=>{var lP=Ie(),uP=lP("toStringTag"),Sp={};Sp[uP]="z";Pp.exports=String(Sp)==="[object z]"});var Il=f((EO,wp)=>{var wl=typeof document=="object"&&document.all,cP=typeof wl>"u"&&wl!==void 0;wp.exports={all:wl,IS_HTMLDDA:cP}});var Y=f((RO,Fp)=>{var Ip=Il(),mP=Ip.all;Fp.exports=Ip.IS_HTMLDDA?function(r){return typeof r=="function"||r===mP}:function(r){return typeof r=="function"}});var Ta=f((OO,Ap)=>{var xp=Z(),pP=xp({}.toString),gP=xp("".slice);Ap.exports=function(r){return gP(pP(r),8,-1)}});var jn=f((BO,Tp)=>{var hP=Cp(),fP=Y(),Ea=Ta(),vP=Ie(),yP=vP("toStringTag"),bP=Object,kP=Ea(function(){return arguments}())=="Arguments",SP=function(r,e){try{return r[e]}catch{}};Tp.exports=hP?Ea:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=SP(e=bP(r),yP))=="string"?t:kP?Ea(e):(i=Ea(e))=="Object"&&fP(e.callee)?"Arguments":i}});var Wn=f((MO,Ep)=>{var PP=jn(),CP=String;Ep.exports=function(r){if(PP(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return CP(r)}});var xl=f((UO,Bp)=>{var Fl=Z(),wP=Pa(),IP=Wn(),FP=xa(),xP=Fl("".charAt),Rp=Fl("".charCodeAt),AP=Fl("".slice),Op=function(r){return function(e,t){var i=IP(FP(e)),n=wP(t),o=i.length,a,c;return n<0||n>=o?r?"":void 0:(a=Rp(i,n),a<55296||a>56319||n+1===o||(c=Rp(i,n+1))<56320||c>57343?r?xP(i,n):a:r?AP(i,n,n+2):(a-55296<<10)+(c-56320)+65536)}};Bp.exports={codeAt:Op(!1),charAt:Op(!0)}});var Lp=f((LO,Up)=>{var TP=pe(),EP=Y(),Mp=TP.WeakMap;Up.exports=EP(Mp)&&/native code/.test(String(Mp))});var It=f((DO,_p)=>{var Dp=Y(),Np=Il(),RP=Np.all;_p.exports=Np.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:Dp(r)||r===RP}:function(r){return typeof r=="object"?r!==null:Dp(r)}});var ge=f((NO,qp)=>{var OP=ae();qp.exports=!OP(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var Tl=f((_O,jp)=>{var BP=pe(),Hp=It(),Al=BP.document,MP=Hp(Al)&&Hp(Al.createElement);jp.exports=function(r){return MP?Al.createElement(r):{}}});var El=f((qO,Wp)=>{var UP=ge(),LP=ae(),DP=Tl();Wp.exports=!UP&&!LP(function(){return Object.defineProperty(DP("div"),"a",{get:function(){return 7}}).a!=7})});var Rl=f((HO,Gp)=>{var NP=ge(),_P=ae();Gp.exports=NP&&_P(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Qe=f((jO,Vp)=>{var qP=It(),HP=String,jP=TypeError;Vp.exports=function(r){if(qP(r))return r;throw jP(HP(r)+" is not an object")}});var Ge=f((WO,zp)=>{var WP=Sa(),Ra=Function.prototype.call;zp.exports=WP?Ra.bind(Ra):function(){return Ra.apply(Ra,arguments)}});var Gn=f((GO,Jp)=>{var Ol=pe(),GP=Y(),VP=function(r){return GP(r)?r:void 0};Jp.exports=function(r,e){return arguments.length<2?VP(Ol[r]):Ol[r]&&Ol[r][e]}});var Bl=f((VO,$p)=>{var zP=Z();$p.exports=zP({}.isPrototypeOf)});var Ml=f((zO,Kp)=>{var JP=Gn(),$P=Y(),KP=Bl(),XP=Pl(),ZP=Object;Kp.exports=XP?function(r){return typeof r=="symbol"}:function(r){var e=JP("Symbol");return $P(e)&&KP(e.prototype,ZP(r))}});var Ul=f((JO,Xp)=>{var YP=String;Xp.exports=function(r){try{return YP(r)}catch{return"Object"}}});var Oa=f(($O,Zp)=>{var QP=Y(),eC=Ul(),tC=TypeError;Zp.exports=function(r){if(QP(r))return r;throw tC(eC(r)+" is not a function")}});var Ba=f((KO,Yp)=>{var rC=Oa(),iC=Fa();Yp.exports=function(r,e){var t=r[e];return iC(t)?void 0:rC(t)}});var eg=f((XO,Qp)=>{var Ll=Ge(),Dl=Y(),Nl=It(),nC=TypeError;Qp.exports=function(r,e){var t,i;if(e==="string"&&Dl(t=r.toString)&&!Nl(i=Ll(t,r))||Dl(t=r.valueOf)&&!Nl(i=Ll(t,r))||e!=="string"&&Dl(t=r.toString)&&!Nl(i=Ll(t,r)))return i;throw nC("Can't convert object to primitive value")}});var ng=f((ZO,ig)=>{var sC=Ge(),tg=It(),rg=Ml(),oC=Ba(),aC=eg(),dC=Ie(),lC=TypeError,uC=dC("toPrimitive");ig.exports=function(r,e){if(!tg(r)||rg(r))return r;var t=oC(r,uC),i;if(t){if(e===void 0&&(e="default"),i=sC(t,r,e),!tg(i)||rg(i))return i;throw lC("Can't convert object to primitive value")}return e===void 0&&(e="number"),aC(r,e)}});var Ma=f((YO,sg)=>{var cC=ng(),mC=Ml();sg.exports=function(r){var e=cC(r,"string");return mC(e)?e:e+""}});var et=f(ag=>{var pC=ge(),gC=El(),hC=Rl(),Ua=Qe(),og=Ma(),fC=TypeError,_l=Object.defineProperty,vC=Object.getOwnPropertyDescriptor,ql="enumerable",Hl="configurable",jl="writable";ag.f=pC?hC?function(e,t,i){if(Ua(e),t=og(t),Ua(i),typeof e=="function"&&t==="prototype"&&"value"in i&&jl in i&&!i[jl]){var n=vC(e,t);n&&n[jl]&&(e[t]=i.value,i={configurable:Hl in i?i[Hl]:n[Hl],enumerable:ql in i?i[ql]:n[ql],writable:!1})}return _l(e,t,i)}:_l:function(e,t,i){if(Ua(e),t=og(t),Ua(i),gC)try{return _l(e,t,i)}catch{}if("get"in i||"set"in i)throw fC("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var zr=f((eB,dg)=>{dg.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var La=f((tB,lg)=>{var yC=ge(),bC=et(),kC=zr();lg.exports=yC?function(r,e,t){return bC.f(r,e,kC(1,t))}:function(r,e,t){return r[e]=t,r}});var Da=f((rB,cg)=>{var SC=yl(),PC=bl(),ug=SC("keys");cg.exports=function(r){return ug[r]||(ug[r]=PC(r))}});var Na=f((iB,mg)=>{mg.exports={}});var Jr=f((nB,hg)=>{var CC=Lp(),gg=pe(),wC=It(),IC=La(),Wl=we(),Gl=Ia(),FC=Da(),xC=Na(),pg="Object already initialized",Vl=gg.TypeError,AC=gg.WeakMap,_a,Vn,qa,TC=function(r){return qa(r)?Vn(r):_a(r,{})},EC=function(r){return function(e){var t;if(!wC(e)||(t=Vn(e)).type!==r)throw Vl("Incompatible receiver, "+r+" required");return t}};CC||Gl.state?(Ve=Gl.state||(Gl.state=new AC),Ve.get=Ve.get,Ve.has=Ve.has,Ve.set=Ve.set,_a=function(r,e){if(Ve.has(r))throw Vl(pg);return e.facade=r,Ve.set(r,e),e},Vn=function(r){return Ve.get(r)||{}},qa=function(r){return Ve.has(r)}):(or=FC("state"),xC[or]=!0,_a=function(r,e){if(Wl(r,or))throw Vl(pg);return e.facade=r,IC(r,or,e),e},Vn=function(r){return Wl(r,or)?r[or]:{}},qa=function(r){return Wl(r,or)});var Ve,or;hg.exports={set:_a,get:Vn,has:qa,enforce:TC,getterFor:EC}});var zl=f(yg=>{"use strict";var fg={}.propertyIsEnumerable,vg=Object.getOwnPropertyDescriptor,RC=vg&&!fg.call({1:2},1);yg.f=RC?function(e){var t=vg(this,e);return!!t&&t.enumerable}:fg});var $l=f((oB,bg)=>{var OC=Z(),BC=ae(),MC=Ta(),Jl=Object,UC=OC("".split);bg.exports=BC(function(){return!Jl("z").propertyIsEnumerable(0)})?function(r){return MC(r)=="String"?UC(r,""):Jl(r)}:Jl});var $r=f((aB,kg)=>{var LC=$l(),DC=xa();kg.exports=function(r){return LC(DC(r))}});var Kl=f(Pg=>{var NC=ge(),_C=Ge(),qC=zl(),HC=zr(),jC=$r(),WC=Ma(),GC=we(),VC=El(),Sg=Object.getOwnPropertyDescriptor;Pg.f=NC?Sg:function(e,t){if(e=jC(e),t=WC(t),VC)try{return Sg(e,t)}catch{}if(GC(e,t))return HC(!_C(qC.f,e,t),e[t])}});var Yl=f((lB,wg)=>{var Xl=ge(),zC=we(),Cg=Function.prototype,JC=Xl&&Object.getOwnPropertyDescriptor,Zl=zC(Cg,"name"),$C=Zl&&function(){}.name==="something",KC=Zl&&(!Xl||Xl&&JC(Cg,"name").configurable);wg.exports={EXISTS:Zl,PROPER:$C,CONFIGURABLE:KC}});var eu=f((uB,Ig)=>{var XC=Z(),ZC=Y(),Ql=Ia(),YC=XC(Function.toString);ZC(Ql.inspectSource)||(Ql.inspectSource=function(r){return YC(r)});Ig.exports=Ql.inspectSource});var iu=f((cB,Ag)=>{var ru=Z(),QC=ae(),e0=Y(),Ha=we(),tu=ge(),t0=Yl().CONFIGURABLE,r0=eu(),xg=Jr(),i0=xg.enforce,n0=xg.get,Fg=String,ja=Object.defineProperty,s0=ru("".slice),o0=ru("".replace),a0=ru([].join),d0=tu&&!QC(function(){return ja(function(){},"length",{value:8}).length!==8}),l0=String(String).split("String"),u0=Ag.exports=function(r,e,t){s0(Fg(e),0,7)==="Symbol("&&(e="["+o0(Fg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Ha(r,"name")||t0&&r.name!==e)&&(tu?ja(r,"name",{value:e,configurable:!0}):r.name=e),d0&&t&&Ha(t,"arity")&&r.length!==t.arity&&ja(r,"length",{value:t.arity});try{t&&Ha(t,"constructor")&&t.constructor?tu&&ja(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=i0(r);return Ha(i,"source")||(i.source=a0(l0,typeof e=="string"?e:"")),r};Function.prototype.toString=u0(function(){return e0(this)&&n0(this).source||r0(this)},"toString")});var ar=f((mB,Tg)=>{var c0=Y(),m0=et(),p0=iu(),g0=wa();Tg.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(c0(t)&&p0(t,o,i),i.global)n?r[e]=t:g0(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:m0.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var nu=f((pB,Eg)=>{var h0=Pa(),f0=Math.max,v0=Math.min;Eg.exports=function(r,e){var t=h0(r);return t<0?f0(t+e,0):v0(t,e)}});var Og=f((gB,Rg)=>{var y0=Pa(),b0=Math.min;Rg.exports=function(r){return r>0?b0(y0(r),9007199254740991):0}});var Wa=f((hB,Bg)=>{var k0=Og();Bg.exports=function(r){return k0(r.length)}});var Lg=f((fB,Ug)=>{var S0=$r(),P0=nu(),C0=Wa(),Mg=function(r){return function(e,t,i){var n=S0(e),o=C0(n),a=P0(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}};Ug.exports={includes:Mg(!0),indexOf:Mg(!1)}});var ou=f((vB,Ng)=>{var w0=Z(),su=we(),I0=$r(),F0=Lg().indexOf,x0=Na(),Dg=w0([].push);Ng.exports=function(r,e){var t=I0(r),i=0,n=[],o;for(o in t)!su(x0,o)&&su(t,o)&&Dg(n,o);for(;e.length>i;)su(t,o=e[i++])&&(~F0(n,o)||Dg(n,o));return n}});var Ga=f((yB,_g)=>{_g.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Hg=f(qg=>{var A0=ou(),T0=Ga(),E0=T0.concat("length","prototype");qg.f=Object.getOwnPropertyNames||function(e){return A0(e,E0)}});var au=f(jg=>{jg.f=Object.getOwnPropertySymbols});var Gg=f((SB,Wg)=>{var R0=Gn(),O0=Z(),B0=Hg(),M0=au(),U0=Qe(),L0=O0([].concat);Wg.exports=R0("Reflect","ownKeys")||function(e){var t=B0.f(U0(e)),i=M0.f;return i?L0(t,i(e)):t}});var Jg=f((PB,zg)=>{var Vg=we(),D0=Gg(),N0=Kl(),_0=et();zg.exports=function(r,e,t){for(var i=D0(e),n=_0.f,o=N0.f,a=0;a<i.length;a++){var c=i[a];!Vg(r,c)&&!(t&&Vg(t,c))&&n(r,c,o(e,c))}}});var Kg=f((CB,$g)=>{var q0=ae(),H0=Y(),j0=/#|\.prototype\./,zn=function(r,e){var t=G0[W0(r)];return t==z0?!0:t==V0?!1:H0(e)?q0(e):!!e},W0=zn.normalize=function(r){return String(r).replace(j0,".").toLowerCase()},G0=zn.data={},V0=zn.NATIVE="N",z0=zn.POLYFILL="P";$g.exports=zn});var Jn=f((wB,Xg)=>{var du=pe(),J0=Kl().f,$0=La(),K0=ar(),X0=wa(),Z0=Jg(),Y0=Kg();Xg.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,c,p,g,v;if(i?a=du:n?a=du[t]||X0(t,{}):a=(du[t]||{}).prototype,a)for(c in e){if(g=e[c],r.dontCallGetSet?(v=J0(a,c),p=v&&v.value):p=a[c],o=Y0(i?c:t+(n?".":"#")+c,r.forced),!o&&p!==void 0){if(typeof g==typeof p)continue;Z0(g,p)}(r.sham||p&&p.sham)&&$0(g,"sham",!0),K0(a,c,g,r)}}});var lu=f((IB,Zg)=>{var Q0=ou(),ew=Ga();Zg.exports=Object.keys||function(e){return Q0(e,ew)}});var Qg=f(Yg=>{var tw=ge(),rw=Rl(),iw=et(),nw=Qe(),sw=$r(),ow=lu();Yg.f=tw&&!rw?Object.defineProperties:function(e,t){nw(e);for(var i=sw(t),n=ow(t),o=n.length,a=0,c;o>a;)iw.f(e,c=n[a++],i[c]);return e}});var th=f((xB,eh)=>{var aw=Gn();eh.exports=aw("document","documentElement")});var $n=f((AB,dh)=>{var dw=Qe(),lw=Qg(),rh=Ga(),uw=Na(),cw=th(),mw=Tl(),pw=Da(),ih=">",nh="<",cu="prototype",mu="script",oh=pw("IE_PROTO"),uu=function(){},ah=function(r){return nh+mu+ih+r+nh+"/"+mu+ih},sh=function(r){r.write(ah("")),r.close();var e=r.parentWindow.Object;return r=null,e},gw=function(){var r=mw("iframe"),e="java"+mu+":",t;return r.style.display="none",cw.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(ah("document.F=Object")),t.close(),t.F},Va,za=function(){try{Va=new ActiveXObject("htmlfile")}catch{}za=typeof document<"u"?document.domain&&Va?sh(Va):gw():sh(Va);for(var r=rh.length;r--;)delete za[cu][rh[r]];return za()};uw[oh]=!0;dh.exports=Object.create||function(e,t){var i;return e!==null?(uu[cu]=dw(e),i=new uu,uu[cu]=null,i[oh]=e):i=za(),t===void 0?i:lw.f(i,t)}});var uh=f((TB,lh)=>{var hw=ae();lh.exports=!hw(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var gu=f((EB,mh)=>{var fw=we(),vw=Y(),yw=Hn(),bw=Da(),kw=uh(),ch=bw("IE_PROTO"),pu=Object,Sw=pu.prototype;mh.exports=kw?pu.getPrototypeOf:function(r){var e=yw(r);if(fw(e,ch))return e[ch];var t=e.constructor;return vw(t)&&e instanceof t?t.prototype:e instanceof pu?Sw:null}});var yu=f((RB,hh)=>{"use strict";var Pw=ae(),Cw=Y(),ww=It(),Iw=$n(),ph=gu(),Fw=ar(),xw=Ie(),Aw=Gr(),vu=xw("iterator"),gh=!1,ut,hu,fu;[].keys&&(fu=[].keys(),"next"in fu?(hu=ph(ph(fu)),hu!==Object.prototype&&(ut=hu)):gh=!0);var Tw=!ww(ut)||Pw(function(){var r={};return ut[vu].call(r)!==r});Tw?ut={}:Aw&&(ut=Iw(ut));Cw(ut[vu])||Fw(ut,vu,function(){return this});hh.exports={IteratorPrototype:ut,BUGGY_SAFARI_ITERATORS:gh}});var Kn=f((OB,vh)=>{var Ew=et().f,Rw=we(),Ow=Ie(),fh=Ow("toStringTag");vh.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!Rw(r,fh)&&Ew(r,fh,{configurable:!0,value:e})}});var Kr=f((BB,yh)=>{yh.exports={}});var bu=f((MB,bh)=>{"use strict";var Bw=yu().IteratorPrototype,Mw=$n(),Uw=zr(),Lw=Kn(),Dw=Kr(),Nw=function(){return this};bh.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=Mw(Bw,{next:Uw(+!i,t)}),Lw(r,n,!1,!0),Dw[n]=Nw,r}});var Sh=f((UB,kh)=>{var _w=Y(),qw=String,Hw=TypeError;kh.exports=function(r){if(typeof r=="object"||_w(r))return r;throw Hw("Can't set "+qw(r)+" as a prototype")}});var Ch=f((LB,Ph)=>{var jw=Z(),Ww=Qe(),Gw=Sh();Ph.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=jw(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return Ww(n),Gw(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var Su=f((DB,Bh)=>{"use strict";var Vw=Jn(),zw=Ge(),Ja=Gr(),Rh=Yl(),Jw=Y(),$w=bu(),wh=gu(),Ih=Ch(),Kw=Kn(),Xw=La(),ku=ar(),Zw=Ie(),Fh=Kr(),Oh=yu(),Yw=Rh.PROPER,Qw=Rh.CONFIGURABLE,xh=Oh.IteratorPrototype,$a=Oh.BUGGY_SAFARI_ITERATORS,Xn=Zw("iterator"),Ah="keys",Zn="values",Th="entries",Eh=function(){return this};Bh.exports=function(r,e,t,i,n,o,a){$w(t,e,i);var c=function(B){if(B===n&&b)return b;if(!$a&&B in v)return v[B];switch(B){case Ah:return function(){return new t(this,B)};case Zn:return function(){return new t(this,B)};case Th:return function(){return new t(this,B)}}return function(){return new t(this)}},p=e+" Iterator",g=!1,v=r.prototype,m=v[Xn]||v["@@iterator"]||n&&v[n],b=!$a&&m||c(n),y=e=="Array"&&v.entries||m,C,w,A;if(y&&(C=wh(y.call(new r)),C!==Object.prototype&&C.next&&(!Ja&&wh(C)!==xh&&(Ih?Ih(C,xh):Jw(C[Xn])||ku(C,Xn,Eh)),Kw(C,p,!0,!0),Ja&&(Fh[p]=Eh))),Yw&&n==Zn&&m&&m.name!==Zn&&(!Ja&&Qw?Xw(v,"name",Zn):(g=!0,b=function(){return zw(m,this)})),n)if(w={values:c(Zn),keys:o?b:c(Ah),entries:c(Th)},a)for(A in w)($a||g||!(A in v))&&ku(v,A,w[A]);else Vw({target:e,proto:!0,forced:$a||g},w);return(!Ja||a)&&v[Xn]!==b&&ku(v,Xn,b,{name:n}),Fh[e]=b,w}});var Pu=f((NB,Mh)=>{Mh.exports=function(r,e){return{value:r,done:e}}});var Nh=f(()=>{"use strict";var eI=xl().charAt,tI=Wn(),Lh=Jr(),rI=Su(),Uh=Pu(),Dh="String Iterator",iI=Lh.set,nI=Lh.getterFor(Dh);rI(String,"String",function(r){iI(this,{type:Dh,string:tI(r),index:0})},function(){var e=nI(this),t=e.string,i=e.index,n;return i>=t.length?Uh(void 0,!0):(n=eI(t,i),e.index+=n.length,Uh(n,!1))})});var Cu=f((HB,_h)=>{var sI=ae(),oI=Ie(),aI=Gr(),dI=oI("iterator");_h.exports=!sI(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}),aI&&!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[dI]||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 Hh=f((jB,qh)=>{var lI=Ta(),uI=Z();qh.exports=function(r){if(lI(r)==="Function")return uI(r)}});var Ka=f((WB,Wh)=>{var jh=Hh(),cI=Oa(),mI=Sa(),pI=jh(jh.bind);Wh.exports=function(r,e){return cI(r),e===void 0?r:mI?pI(r,e):function(){return r.apply(e,arguments)}}});var zh=f((GB,Vh)=>{var Gh=iu(),gI=et();Vh.exports=function(r,e,t){return t.get&&Gh(t.get,e,{getter:!0}),t.set&&Gh(t.set,e,{setter:!0}),gI.f(r,e,t)}});var wu=f((VB,Jh)=>{var hI=Bl(),fI=TypeError;Jh.exports=function(r,e){if(hI(e,r))return r;throw fI("Incorrect invocation")}});var Zh=f((zB,Xh)=>{"use strict";var $h=ge(),vI=Z(),yI=Ge(),bI=ae(),Iu=lu(),kI=au(),SI=zl(),PI=Hn(),CI=$l(),Xr=Object.assign,Kh=Object.defineProperty,wI=vI([].concat);Xh.exports=!Xr||bI(function(){if($h&&Xr({b:1},Xr(Kh({},"a",{enumerable:!0,get:function(){Kh(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}),Xr({},r)[t]!=7||Iu(Xr({},e)).join("")!=i})?function(e,t){for(var i=PI(e),n=arguments.length,o=1,a=kI.f,c=SI.f;n>o;)for(var p=CI(arguments[o++]),g=a?wI(Iu(p),a(p)):Iu(p),v=g.length,m=0,b;v>m;)b=g[m++],(!$h||yI(c,p,b))&&(i[b]=p[b]);return i}:Xr});var ef=f((JB,Qh)=>{var II=Ge(),Yh=Qe(),FI=Ba();Qh.exports=function(r,e,t){var i,n;Yh(r);try{if(i=FI(r,"return"),!i){if(e==="throw")throw t;return t}i=II(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Yh(i),t}});var rf=f(($B,tf)=>{var xI=Qe(),AI=ef();tf.exports=function(r,e,t,i){try{return i?e(xI(t)[0],t[1]):e(t)}catch(n){AI(r,"throw",n)}}});var sf=f((KB,nf)=>{var TI=Ie(),EI=Kr(),RI=TI("iterator"),OI=Array.prototype;nf.exports=function(r){return r!==void 0&&(EI.Array===r||OI[RI]===r)}});var cf=f((XB,uf)=>{var BI=Z(),MI=ae(),of=Y(),UI=jn(),LI=Gn(),DI=eu(),af=function(){},NI=[],df=LI("Reflect","construct"),Fu=/^\s*(?:class|function)\b/,_I=BI(Fu.exec),qI=!Fu.exec(af),Yn=function(e){if(!of(e))return!1;try{return df(af,NI,e),!0}catch{return!1}},lf=function(e){if(!of(e))return!1;switch(UI(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return qI||!!_I(Fu,DI(e))}catch{return!0}};lf.sham=!0;uf.exports=!df||MI(function(){var r;return Yn(Yn.call)||!Yn(Object)||!Yn(function(){r=!0})||r})?lf:Yn});var xu=f((ZB,mf)=>{"use strict";var HI=Ma(),jI=et(),WI=zr();mf.exports=function(r,e,t){var i=HI(e);i in r?jI.f(r,i,WI(0,t)):r[i]=t}});var Xa=f((YB,gf)=>{var GI=jn(),pf=Ba(),VI=Fa(),zI=Kr(),JI=Ie(),$I=JI("iterator");gf.exports=function(r){if(!VI(r))return pf(r,$I)||pf(r,"@@iterator")||zI[GI(r)]}});var Au=f((QB,hf)=>{var KI=Ge(),XI=Oa(),ZI=Qe(),YI=Ul(),QI=Xa(),eF=TypeError;hf.exports=function(r,e){var t=arguments.length<2?QI(r):e;if(XI(t))return ZI(KI(t,r));throw eF(YI(r)+" is not iterable")}});var bf=f((eM,yf)=>{"use strict";var tF=Ka(),rF=Ge(),iF=Hn(),nF=rf(),sF=sf(),oF=cf(),aF=Wa(),ff=xu(),dF=Au(),lF=Xa(),vf=Array;yf.exports=function(e){var t=iF(e),i=oF(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=tF(o,n>2?arguments[2]:void 0));var c=lF(t),p=0,g,v,m,b,y,C;if(c&&!(this===vf&&sF(c)))for(b=dF(t,c),y=b.next,v=i?new this:[];!(m=rF(y,b)).done;p++)C=a?nF(b,o,[m.value,p],!0):m.value,ff(v,p,C);else for(g=aF(t),v=i?new this(g):vf(g);g>p;p++)C=a?o(t[p],p):t[p],ff(v,p,C);return v.length=p,v}});var Tu=f((tM,Sf)=>{var kf=nu(),uF=Wa(),cF=xu(),mF=Array,pF=Math.max;Sf.exports=function(r,e,t){for(var i=uF(r),n=kf(e,i),o=kf(t===void 0?i:t,i),a=mF(pF(o-n,0)),c=0;n<o;n++,c++)cF(a,c,r[n]);return a.length=c,a}});var Ef=f((rM,Tf)=>{var dr=Z(),Eu=2147483647,Qn=36,Ff=1,Bu=26,gF=38,hF=700,fF=72,vF=128,yF="-",bF=/[^\0-\u007E]/,xf=/[.\u3002\uFF0E\uFF61]/g,Pf="Overflow: input needs wider integers to process",Ru=Qn-Ff,Cf=RangeError,kF=dr(xf.exec),Zr=Math.floor,Ou=String.fromCharCode,wf=dr("".charCodeAt),Af=dr([].join),Ft=dr([].push),SF=dr("".replace),PF=dr("".split),CF=dr("".toLowerCase),wF=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=wf(r,t++);if(n>=55296&&n<=56319&&t<i){var o=wf(r,t++);(o&64512)==56320?Ft(e,((n&1023)<<10)+(o&1023)+65536):(Ft(e,n),t--)}else Ft(e,n)}return e},If=function(r){return r+22+75*(r<26)},IF=function(r,e,t){var i=0;for(r=t?Zr(r/hF):r>>1,r+=Zr(r/e);r>Ru*Bu>>1;)r=Zr(r/Ru),i+=Qn;return Zr(i+(Ru+1)*r/(r+gF))},FF=function(r){var e=[];r=wF(r);var t=r.length,i=vF,n=0,o=fF,a,c;for(a=0;a<r.length;a++)c=r[a],c<128&&Ft(e,Ou(c));var p=e.length,g=p;for(p&&Ft(e,yF);g<t;){var v=Eu;for(a=0;a<r.length;a++)c=r[a],c>=i&&c<v&&(v=c);var m=g+1;if(v-i>Zr((Eu-n)/m))throw Cf(Pf);for(n+=(v-i)*m,i=v,a=0;a<r.length;a++){if(c=r[a],c<i&&++n>Eu)throw Cf(Pf);if(c==i){for(var b=n,y=Qn;;){var C=y<=o?Ff:y>=o+Bu?Bu:y-o;if(b<C)break;var w=b-C,A=Qn-C;Ft(e,Ou(If(C+w%A))),b=Zr(w/A),y+=Qn}Ft(e,Ou(If(b))),o=IF(n,m,g==p),n=0,g++}}n++,i++}return Af(e,"")};Tf.exports=function(r){var e=[],t=PF(SF(CF(r),xf,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],Ft(e,kF(bF,n)?"xn--"+FF(n):n);return Af(e,".")}});var Mu=f((iM,Rf)=>{var xF=TypeError;Rf.exports=function(r,e){if(r<e)throw xF("Not enough arguments");return r}});var Bf=f((nM,Of)=>{var AF=Ie(),TF=$n(),EF=et().f,Uu=AF("unscopables"),Lu=Array.prototype;Lu[Uu]==null&&EF(Lu,Uu,{configurable:!0,value:TF(null)});Of.exports=function(r){Lu[Uu][r]=!0}});var _f=f((sM,Nf)=>{"use strict";var RF=$r(),Du=Bf(),Mf=Kr(),Lf=Jr(),OF=et().f,BF=Su(),Za=Pu(),MF=Gr(),UF=ge(),Df="Array Iterator",LF=Lf.set,DF=Lf.getterFor(Df);Nf.exports=BF(Array,"Array",function(r,e){LF(this,{type:Df,target:RF(r),index:0,kind:e})},function(){var r=DF(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,Za(void 0,!0)):t=="keys"?Za(i,!1):t=="values"?Za(e[i],!1):Za([i,e[i]],!1)},"values");var Uf=Mf.Arguments=Mf.Array;Du("keys");Du("values");Du("entries");if(!MF&&UF&&Uf.name!=="values")try{OF(Uf,"name",{value:"values"})}catch{}});var Hf=f((oM,qf)=>{var NF=ar();qf.exports=function(r,e,t){for(var i in e)NF(r,i,e[i],t);return r}});var Gf=f((aM,Wf)=>{var jf=Tu(),_F=Math.floor,Nu=function(r,e){var t=r.length,i=_F(t/2);return t<8?qF(r,e):HF(r,Nu(jf(r,0,i),e),Nu(jf(r,i),e),e)},qF=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},HF=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};Wf.exports=Nu});var $u=f((dM,uv)=>{"use strict";_f();var Wu=Jn(),Qr=pe(),Ya=Ge(),tt=Z(),jF=ge(),rv=Cu(),iv=ar(),WF=Hf(),GF=Kn(),VF=bu(),zu=Jr(),nv=wu(),_u=Y(),zF=we(),JF=Ka(),$F=jn(),KF=Qe(),sv=It(),he=Wn(),XF=$n(),Vf=zr(),Gu=Au(),ZF=Xa(),Yr=Mu(),YF=Ie(),QF=Gf(),ex=YF("iterator"),rs="URLSearchParams",ov=rs+"Iterator",av=zu.set,ze=zu.getterFor(rs),tx=zu.getterFor(ov),rx=Object.getOwnPropertyDescriptor,Ju=function(r){if(!jF)return Qr[r];var e=rx(Qr,r);return e&&e.value},zf=Ju("fetch"),ed=Ju("Request"),es=Ju("Headers"),qu=ed&&ed.prototype,Jf=es&&es.prototype,ix=Qr.RegExp,nx=Qr.TypeError,dv=Qr.decodeURIComponent,sx=Qr.encodeURIComponent,ox=tt("".charAt),$f=tt([].join),lr=tt([].push),Vu=tt("".replace),ax=tt([].shift),Kf=tt([].splice),Xf=tt("".split),dx=tt("".slice),lx=/\+/g,Zf=Array(4),ux=function(r){return Zf[r-1]||(Zf[r-1]=ix("((?:%[\\da-f]{2}){"+r+"})","gi"))},cx=function(r){try{return dv(r)}catch{return r}},Yf=function(r){var e=Vu(r,lx," "),t=4;try{return dv(e)}catch{for(;t;)e=Vu(e,ux(t--),cx);return e}},mx=/[!'()~]|%20/g,px={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},gx=function(r){return px[r]},Qf=function(r){return Vu(sx(r),mx,gx)},Hu=VF(function(e,t){av(this,{type:ov,iterator:Gu(ze(e).entries),kind:t})},"Iterator",function(){var e=tx(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),lv=function(r){this.entries=[],this.url=null,r!==void 0&&(sv(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?ox(r,0)==="?"?dx(r,1):r:he(r)))};lv.prototype={type:rs,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=ZF(r),t,i,n,o,a,c,p;if(e)for(t=Gu(r,e),i=t.next;!(n=Ya(i,t)).done;){if(o=Gu(KF(n.value)),a=o.next,(c=Ya(a,o)).done||(p=Ya(a,o)).done||!Ya(a,o).done)throw nx("Expected sequence with length 2");lr(this.entries,{key:he(c.value),value:he(p.value)})}else for(var g in r)zF(r,g)&&lr(this.entries,{key:g,value:he(r[g])})},parseQuery:function(r){if(r)for(var e=Xf(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=Xf(i,"="),lr(this.entries,{key:Yf(ax(n)),value:Yf($f(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],lr(e,Qf(i.key)+"="+Qf(i.value));return $f(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var td=function(){nv(this,ts);var e=arguments.length>0?arguments[0]:void 0;av(this,new lv(e))},ts=td.prototype;WF(ts,{append:function(e,t){Yr(arguments.length,2);var i=ze(this);lr(i.entries,{key:he(e),value:he(t)}),i.updateURL()},delete:function(r){Yr(arguments.length,1);for(var e=ze(this),t=e.entries,i=he(r),n=0;n<t.length;)t[n].key===i?Kf(t,n,1):n++;e.updateURL()},get:function(e){Yr(arguments.length,1);for(var t=ze(this).entries,i=he(e),n=0;n<t.length;n++)if(t[n].key===i)return t[n].value;return null},getAll:function(e){Yr(arguments.length,1);for(var t=ze(this).entries,i=he(e),n=[],o=0;o<t.length;o++)t[o].key===i&&lr(n,t[o].value);return n},has:function(e){Yr(arguments.length,1);for(var t=ze(this).entries,i=he(e),n=0;n<t.length;)if(t[n++].key===i)return!0;return!1},set:function(e,t){Yr(arguments.length,1);for(var i=ze(this),n=i.entries,o=!1,a=he(e),c=he(t),p=0,g;p<n.length;p++)g=n[p],g.key===a&&(o?Kf(n,p--,1):(o=!0,g.value=c));o||lr(n,{key:a,value:c}),i.updateURL()},sort:function(){var e=ze(this);QF(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=ze(this).entries,i=JF(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 Hu(this,"keys")},values:function(){return new Hu(this,"values")},entries:function(){return new Hu(this,"entries")}},{enumerable:!0});iv(ts,ex,ts.entries,{name:"entries"});iv(ts,"toString",function(){return ze(this).serialize()},{enumerable:!0});GF(td,rs);Wu({global:!0,constructor:!0,forced:!rv},{URLSearchParams:td});!rv&&_u(es)&&(ev=tt(Jf.has),tv=tt(Jf.set),ju=function(r){if(sv(r)){var e=r.body,t;if($F(e)===rs)return t=r.headers?new es(r.headers):new es,ev(t,"content-type")||tv(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),XF(r,{body:Vf(0,he(e)),headers:Vf(0,t)})}return r},_u(zf)&&Wu({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return zf(e,arguments.length>1?ju(arguments[1]):{})}}),_u(ed)&&(Qa=function(e){return nv(this,qu),new ed(e,arguments.length>1?ju(arguments[1]):{})},qu.constructor=Qa,Qa.prototype=qu,Wu({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Qa})));var ev,tv,ju,Qa;uv.exports={URLSearchParams:td,getState:ze}});var Tv=f(()=>{"use strict";Nh();var hx=Jn(),uc=ge(),fx=Cu(),cc=pe(),cv=Ka(),Ee=Z(),od=ar(),Fe=zh(),vx=wu(),ac=we(),mc=Zh(),ei=bf(),Je=Tu(),yx=xl().codeAt,bx=Ef(),mt=Wn(),kx=Kn(),Sx=Mu(),Cv=$u(),wv=Jr(),Px=wv.set,ad=wv.getterFor("URL"),Cx=Cv.URLSearchParams,wx=Cv.getState,is=cc.URL,dc=cc.TypeError,dd=cc.parseInt,Ix=Math.floor,mv=Math.pow,Te=Ee("".charAt),$e=Ee(/./.exec),ss=Ee([].join),Fx=Ee(1 .toString),xx=Ee([].pop),ri=Ee([].push),pv=Ee("".replace),Ax=Ee([].shift),Tx=Ee("".split),as=Ee("".slice),ld=Ee("".toLowerCase),Ex=Ee([].unshift),Rx="Invalid authority",Ku="Invalid scheme",ur="Invalid host",gv="Invalid port",Iv=/[a-z]/i,Ox=/[\d+-.a-z]/i,lc=/\d/,Bx=/^0x/i,Mx=/^[0-7]+$/,Ux=/^\d+$/,Fv=/^[\da-f]+$/i,Lx=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Dx=/[\0\t\n\r #/:<>?@[\\\]^|]/,Nx=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,_x=/[\t\n\r]/g,xe,qx=function(r){var e=Tx(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&&Te(o,0)=="0"&&(a=$e(Bx,o)?16:8,o=as(o,a==8?1:2)),o==="")c=0;else{if(!$e(a==10?Ux:a==8?Mx:Fv,o))return r;c=dd(o,a)}ri(i,c)}for(n=0;n<t;n++)if(c=i[n],n==t-1){if(c>=mv(256,5-t))return null}else if(c>255)return null;for(p=xx(i),n=0;n<i.length;n++)p+=i[n]*mv(256,3-n);return p},Hx=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,c,p,g,v,m,b=function(){return Te(r,n)};if(b()==":"){if(Te(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&&$e(Fv,b());)o=o*16+dd(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(!$e(lc,b()))return;for(;$e(lc,b());){if(g=dd(b(),10),p===null)p=g;else{if(p==0)return;p=p*10+g}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},jx=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},ns=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)Ex(e,r%256),r=Ix(r/256);return ss(e,".")}else if(typeof r=="object"){for(e="",i=jx(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=Fx(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},sd={},xv=mc({},sd,{" ":1,'"':1,"<":1,">":1,"`":1}),Av=mc({},xv,{"#":1,"?":1,"{":1,"}":1}),Xu=mc({},Av,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),xt=function(r,e){var t=yx(r,0);return t>32&&t<127&&!ac(e,r)?r:encodeURIComponent(r)},rd={ftp:21,file:null,http:80,https:443,ws:80,wss:443},os=function(r,e){var t;return r.length==2&&$e(Iv,Te(r,0))&&((t=Te(r,1))==":"||!e&&t=="|")},hv=function(r){var e;return r.length>1&&os(as(r,0,2))&&(r.length==2||(e=Te(r,2))==="/"||e==="\\"||e==="?"||e==="#")},Wx=function(r){return r==="."||ld(r)==="%2e"},Gx=function(r){return r=ld(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Zu={},fv={},Yu={},vv={},yv={},Qu={},bv={},kv={},id={},nd={},ec={},tc={},rc={},ic={},Sv={},nc={},ti={},rt={},Pv={},cr={},ct={},pc=function(r,e,t){var i=mt(r),n,o,a;if(e){if(o=this.parse(i),o)throw dc(o);this.searchParams=null}else{if(t!==void 0&&(n=new pc(t,!0)),o=this.parse(i,null,n),o)throw dc(o);a=wx(new Cx),a.bindURL(this),this.searchParams=a}};pc.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||Zu,o=0,a="",c=!1,p=!1,g=!1,v,m,b,y;for(r=mt(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=pv(r,Nx,"")),r=pv(r,_x,""),v=ei(r);o<=v.length;){switch(m=v[o],n){case Zu:if(m&&$e(Iv,m))a+=ld(m),n=fv;else{if(e)return Ku;n=Yu;continue}break;case fv:if(m&&($e(Ox,m)||m=="+"||m=="-"||m=="."))a+=ld(m);else if(m==":"){if(e&&(i.isSpecial()!=ac(rd,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&rd[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=ic:i.isSpecial()&&t&&t.scheme==i.scheme?n=vv:i.isSpecial()?n=kv:v[o+1]=="/"?(n=yv,o++):(i.cannotBeABaseURL=!0,ri(i.path,""),n=Pv)}else{if(e)return Ku;a="",n=Yu,o=0;continue}break;case Yu:if(!t||t.cannotBeABaseURL&&m!="#")return Ku;if(t.cannotBeABaseURL&&m=="#"){i.scheme=t.scheme,i.path=Je(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=ct;break}n=t.scheme=="file"?ic:Qu;continue;case vv:if(m=="/"&&v[o+1]=="/")n=id,o++;else{n=Qu;continue}break;case yv:if(m=="/"){n=nd;break}else{n=rt;continue}case Qu: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=Je(t.path),i.query=t.query;else if(m=="/"||m=="\\"&&i.isSpecial())n=bv;else if(m=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.query="",n=cr;else if(m=="#")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.query=t.query,i.fragment="",n=ct;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.path.length--,n=rt;continue}break;case bv:if(i.isSpecial()&&(m=="/"||m=="\\"))n=id;else if(m=="/")n=nd;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=rt;continue}break;case kv:if(n=id,m!="/"||Te(a,o+1)!="/")continue;o++;break;case id:if(m!="/"&&m!="\\"){n=nd;continue}break;case nd:if(m=="@"){c&&(a="%40"+a),c=!0,b=ei(a);for(var C=0;C<b.length;C++){var w=b[C];if(w==":"&&!g){g=!0;continue}var A=xt(w,Xu);g?i.password+=A:i.username+=A}a=""}else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(c&&a=="")return Rx;o-=ei(a).length+1,a="",n=ec}else a+=m;break;case ec:case tc:if(e&&i.scheme=="file"){n=nc;continue}else if(m==":"&&!p){if(a=="")return ur;if(y=i.parseHost(a),y)return y;if(a="",n=rc,e==tc)return}else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(i.isSpecial()&&a=="")return ur;if(e&&a==""&&(i.includesCredentials()||i.port!==null))return;if(y=i.parseHost(a),y)return y;if(a="",n=ti,e)return;continue}else m=="["?p=!0:m=="]"&&(p=!1),a+=m;break;case rc:if($e(lc,m))a+=m;else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()||e){if(a!=""){var B=dd(a,10);if(B>65535)return gv;i.port=i.isSpecial()&&B===rd[i.scheme]?null:B,a=""}if(e)return;n=ti;continue}else return gv;break;case ic:if(i.scheme="file",m=="/"||m=="\\")n=Sv;else if(t&&t.scheme=="file")if(m==xe)i.host=t.host,i.path=Je(t.path),i.query=t.query;else if(m=="?")i.host=t.host,i.path=Je(t.path),i.query="",n=cr;else if(m=="#")i.host=t.host,i.path=Je(t.path),i.query=t.query,i.fragment="",n=ct;else{hv(ss(Je(v,o),""))||(i.host=t.host,i.path=Je(t.path),i.shortenPath()),n=rt;continue}else{n=rt;continue}break;case Sv:if(m=="/"||m=="\\"){n=nc;break}t&&t.scheme=="file"&&!hv(ss(Je(v,o),""))&&(os(t.path[0],!0)?ri(i.path,t.path[0]):i.host=t.host),n=rt;continue;case nc:if(m==xe||m=="/"||m=="\\"||m=="?"||m=="#"){if(!e&&os(a))n=rt;else if(a==""){if(i.host="",e)return;n=ti}else{if(y=i.parseHost(a),y)return y;if(i.host=="localhost"&&(i.host=""),e)return;a="",n=ti}continue}else a+=m;break;case ti:if(i.isSpecial()){if(n=rt,m!="/"&&m!="\\")continue}else if(!e&&m=="?")i.query="",n=cr;else if(!e&&m=="#")i.fragment="",n=ct;else if(m!=xe&&(n=rt,m!="/"))continue;break;case rt:if(m==xe||m=="/"||m=="\\"&&i.isSpecial()||!e&&(m=="?"||m=="#")){if(Gx(a)?(i.shortenPath(),m!="/"&&!(m=="\\"&&i.isSpecial())&&ri(i.path,"")):Wx(a)?m!="/"&&!(m=="\\"&&i.isSpecial())&&ri(i.path,""):(i.scheme=="file"&&!i.path.length&&os(a)&&(i.host&&(i.host=""),a=Te(a,0)+":"),ri(i.path,a)),a="",i.scheme=="file"&&(m==xe||m=="?"||m=="#"))for(;i.path.length>1&&i.path[0]==="";)Ax(i.path);m=="?"?(i.query="",n=cr):m=="#"&&(i.fragment="",n=ct)}else a+=xt(m,Av);break;case Pv:m=="?"?(i.query="",n=cr):m=="#"?(i.fragment="",n=ct):m!=xe&&(i.path[0]+=xt(m,sd));break;case cr:!e&&m=="#"?(i.fragment="",n=ct):m!=xe&&(m=="'"&&i.isSpecial()?i.query+="%27":m=="#"?i.query+="%23":i.query+=xt(m,sd));break;case ct:m!=xe&&(i.fragment+=xt(m,xv));break}o++}},parseHost:function(r){var e,t,i;if(Te(r,0)=="["){if(Te(r,r.length-1)!="]"||(e=Hx(as(r,1,-1)),!e))return ur;this.host=e}else if(this.isSpecial()){if(r=bx(r),$e(Lx,r)||(e=qx(r),e===null))return ur;this.host=e}else{if($e(Dx,r))return ur;for(e="",t=ei(r),i=0;i<t.length;i++)e+=xt(t[i],sd);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return ac(rd,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!os(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,g=e+":";return n!==null?(g+="//",r.includesCredentials()&&(g+=t+(i?":"+i:"")+"@"),g+=ns(n),o!==null&&(g+=":"+o)):e=="file"&&(g+="//"),g+=r.cannotBeABaseURL?a[0]:a.length?"/"+ss(a,"/"):"",c!==null&&(g+="?"+c),p!==null&&(g+="#"+p),g},setHref:function(r){var e=this.parse(r);if(e)throw dc(e);this.searchParams.update()},getOrigin:function(){var r=this.scheme,e=this.port;if(r=="blob")try{return new ii(r.path[0]).origin}catch{return"null"}return r=="file"||!this.isSpecial()?"null":r+"://"+ns(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(mt(r)+":",Zu)},getUsername:function(){return this.username},setUsername:function(r){var e=ei(mt(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=xt(e[t],Xu)}},getPassword:function(){return this.password},setPassword:function(r){var e=ei(mt(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=xt(e[t],Xu)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?ns(r):ns(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,ec)},getHostname:function(){var r=this.host;return r===null?"":ns(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,tc)},getPort:function(){var r=this.port;return r===null?"":mt(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=mt(r),r==""?this.port=null:this.parse(r,rc))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+ss(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,ti))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=mt(r),r==""?this.query=null:(Te(r,0)=="?"&&(r=as(r,1)),this.query="",this.parse(r,cr)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var r=this.fragment;return r?"#"+r:""},setHash:function(r){if(r=mt(r),r==""){this.fragment=null;return}Te(r,0)=="#"&&(r=as(r,1)),this.fragment="",this.parse(r,ct)},update:function(){this.query=this.searchParams.serialize()||null}};var ii=function(e){var t=vx(this,re),i=Sx(arguments.length,1)>1?arguments[1]:void 0,n=Px(t,new pc(e,!1,i));uc||(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())},re=ii.prototype,Ae=function(r,e){return{get:function(){return ad(this)[r]()},set:e&&function(t){return ad(this)[e](t)},configurable:!0,enumerable:!0}};uc&&(Fe(re,"href",Ae("serialize","setHref")),Fe(re,"origin",Ae("getOrigin")),Fe(re,"protocol",Ae("getProtocol","setProtocol")),Fe(re,"username",Ae("getUsername","setUsername")),Fe(re,"password",Ae("getPassword","setPassword")),Fe(re,"host",Ae("getHost","setHost")),Fe(re,"hostname",Ae("getHostname","setHostname")),Fe(re,"port",Ae("getPort","setPort")),Fe(re,"pathname",Ae("getPathname","setPathname")),Fe(re,"search",Ae("getSearch","setSearch")),Fe(re,"searchParams",Ae("getSearchParams")),Fe(re,"hash",Ae("getHash","setHash")));od(re,"toJSON",function(){return ad(this).serialize()},{enumerable:!0});od(re,"toString",function(){return ad(this).serialize()},{enumerable:!0});is&&(sc=is.createObjectURL,oc=is.revokeObjectURL,sc&&od(ii,"createObjectURL",cv(sc,is)),oc&&od(ii,"revokeObjectURL",cv(oc,is)));var sc,oc;kx(ii,"URL");hx({global:!0,constructor:!0,forced:!fx,sham:!uc},{URL:ii})});var Ev=f(()=>{Tv()});var Rv=f(()=>{"use strict";var Vx=Jn(),zx=Ge();Vx({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return zx(URL.prototype.toString,this)}})});var Ov=f(()=>{$u()});var Mv=f((vM,Bv)=>{var Jx=pe();Bv.exports=Jx});var Lv=f((yM,Uv)=>{Ev();Rv();Ov();var $x=Mv();Uv.exports=$x.URL});var Hc=f((jD,Vy)=>{var dT=Object.prototype.toString;Vy.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 pT(e)?"generatorfunction":"function";if(lT(e))return"array";if(fT(e))return"buffer";if(hT(e))return"arguments";if(cT(e))return"date";if(uT(e))return"error";if(mT(e))return"regexp";switch(Gy(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(gT(e))return"generator";switch(t=dT.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 Gy(r){return typeof r.constructor=="function"?r.constructor.name:null}function lT(r){return Array.isArray?Array.isArray(r):r instanceof Array}function uT(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function cT(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function mT(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function pT(r,e){return Gy(r)==="GeneratorFunction"}function gT(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function hT(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 fT(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var $y=f((WD,Jy)=>{"use strict";var zy=Symbol.prototype.valueOf,vT=Hc();function yT(r,e){switch(vT(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 PT(r);case"symbol":return CT(r);case"arraybuffer":return kT(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return ST(r);case"regexp":return bT(r);case"error":return Object.create(r);default:return r}}function bT(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 kT(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function ST(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function PT(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function CT(r){return zy?Object(zy.call(r)):{}}Jy.exports=yT});var Xy=f((GD,Ky)=>{"use strict";Ky.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var Qy=f((VD,Yy)=>{"use strict";var wT=Xy();function Zy(r){return wT(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}Yy.exports=function(e){var t,i;return!(Zy(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,Zy(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var tb=f((zD,eb)=>{"use strict";var IT=$y(),FT=Hc(),xT=Qy();function jc(r,e){switch(FT(r)){case"object":return AT(r,e);case"array":return TT(r,e);default:return IT(r)}}function AT(r,e){if(typeof e=="function")return e(r);if(e||xT(r)){let t=new r.constructor;for(let i in r)t[i]=jc(r[i],e);return t}return r}function TT(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=jc(r[i],e);return t}eb.exports=jc});var em=f((bs,Ti)=>{var ET=200,Qc="__lodash_hash_undefined__",Bd=1,pb=2,gb=9007199254740991,Fd="[object Arguments]",zc="[object Array]",RT="[object AsyncFunction]",hb="[object Boolean]",fb="[object Date]",vb="[object Error]",yb="[object Function]",OT="[object GeneratorFunction]",xd="[object Map]",bb="[object Number]",BT="[object Null]",Ai="[object Object]",rb="[object Promise]",MT="[object Proxy]",kb="[object RegExp]",Ad="[object Set]",Sb="[object String]",UT="[object Symbol]",LT="[object Undefined]",Jc="[object WeakMap]",Pb="[object ArrayBuffer]",Td="[object DataView]",DT="[object Float32Array]",NT="[object Float64Array]",_T="[object Int8Array]",qT="[object Int16Array]",HT="[object Int32Array]",jT="[object Uint8Array]",WT="[object Uint8ClampedArray]",GT="[object Uint16Array]",VT="[object Uint32Array]",zT=/[\\^$.*+?()[\]{}|]/g,JT=/^\[object .+?Constructor\]$/,$T=/^(?:0|[1-9]\d*)$/,W={};W[DT]=W[NT]=W[_T]=W[qT]=W[HT]=W[jT]=W[WT]=W[GT]=W[VT]=!0;W[Fd]=W[zc]=W[Pb]=W[hb]=W[Td]=W[fb]=W[vb]=W[yb]=W[xd]=W[bb]=W[Ai]=W[kb]=W[Ad]=W[Sb]=W[Jc]=!1;var Cb=typeof global=="object"&&global&&global.Object===Object&&global,KT=typeof self=="object"&&self&&self.Object===Object&&self,ft=Cb||KT||Function("return this")(),wb=typeof bs=="object"&&bs&&!bs.nodeType&&bs,ib=wb&&typeof Ti=="object"&&Ti&&!Ti.nodeType&&Ti,Ib=ib&&ib.exports===wb,Wc=Ib&&Cb.process,nb=function(){try{return Wc&&Wc.binding&&Wc.binding("util")}catch{}}(),sb=nb&&nb.isTypedArray;function XT(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 ZT(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function YT(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 QT(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function eE(r){return function(e){return r(e)}}function tE(r,e){return r.has(e)}function rE(r,e){return r?.[e]}function iE(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function nE(r,e){return function(t){return r(e(t))}}function sE(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var oE=Array.prototype,aE=Function.prototype,Md=Object.prototype,Gc=ft["__core-js_shared__"],Fb=aE.toString,it=Md.hasOwnProperty,ob=function(){var r=/[^.]+$/.exec(Gc&&Gc.keys&&Gc.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),xb=Md.toString,dE=RegExp("^"+Fb.call(it).replace(zT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ab=Ib?ft.Buffer:void 0,Ed=ft.Symbol,db=ft.Uint8Array,Ab=Md.propertyIsEnumerable,lE=oE.splice,kr=Ed?Ed.toStringTag:void 0,lb=Object.getOwnPropertySymbols,uE=ab?ab.isBuffer:void 0,cE=nE(Object.keys,Object),$c=Ei(ft,"DataView"),ks=Ei(ft,"Map"),Kc=Ei(ft,"Promise"),Xc=Ei(ft,"Set"),Zc=Ei(ft,"WeakMap"),Ss=Ei(Object,"create"),mE=Cr($c),pE=Cr(ks),gE=Cr(Kc),hE=Cr(Xc),fE=Cr(Zc),ub=Ed?Ed.prototype:void 0,Vc=ub?ub.valueOf:void 0;function Sr(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 vE(){this.__data__=Ss?Ss(null):{},this.size=0}function yE(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function bE(r){var e=this.__data__;if(Ss){var t=e[r];return t===Qc?void 0:t}return it.call(e,r)?e[r]:void 0}function kE(r){var e=this.__data__;return Ss?e[r]!==void 0:it.call(e,r)}function SE(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=Ss&&e===void 0?Qc:e,this}Sr.prototype.clear=vE;Sr.prototype.delete=yE;Sr.prototype.get=bE;Sr.prototype.has=kE;Sr.prototype.set=SE;function vt(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 PE(){this.__data__=[],this.size=0}function CE(r){var e=this.__data__,t=Ud(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():lE.call(e,t,1),--this.size,!0}function wE(r){var e=this.__data__,t=Ud(e,r);return t<0?void 0:e[t][1]}function IE(r){return Ud(this.__data__,r)>-1}function FE(r,e){var t=this.__data__,i=Ud(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}vt.prototype.clear=PE;vt.prototype.delete=CE;vt.prototype.get=wE;vt.prototype.has=IE;vt.prototype.set=FE;function Pr(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 xE(){this.size=0,this.__data__={hash:new Sr,map:new(ks||vt),string:new Sr}}function AE(r){var e=Ld(this,r).delete(r);return this.size-=e?1:0,e}function TE(r){return Ld(this,r).get(r)}function EE(r){return Ld(this,r).has(r)}function RE(r,e){var t=Ld(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}Pr.prototype.clear=xE;Pr.prototype.delete=AE;Pr.prototype.get=TE;Pr.prototype.has=EE;Pr.prototype.set=RE;function Rd(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Pr;++e<t;)this.add(r[e])}function OE(r){return this.__data__.set(r,Qc),this}function BE(r){return this.__data__.has(r)}Rd.prototype.add=Rd.prototype.push=OE;Rd.prototype.has=BE;function Dt(r){var e=this.__data__=new vt(r);this.size=e.size}function ME(){this.__data__=new vt,this.size=0}function UE(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function LE(r){return this.__data__.get(r)}function DE(r){return this.__data__.has(r)}function NE(r,e){var t=this.__data__;if(t instanceof vt){var i=t.__data__;if(!ks||i.length<ET-1)return i.push([r,e]),this.size=++t.size,this;t=this.__data__=new Pr(i)}return t.set(r,e),this.size=t.size,this}Dt.prototype.clear=ME;Dt.prototype.delete=UE;Dt.prototype.get=LE;Dt.prototype.has=DE;Dt.prototype.set=NE;function _E(r,e){var t=Od(r),i=!t&&eR(r),n=!t&&!i&&Yc(r),o=!t&&!i&&!n&&Ub(r),a=t||i||n||o,c=a?QT(r.length,String):[],p=c.length;for(var g in r)(e||it.call(r,g))&&!(a&&(g=="length"||n&&(g=="offset"||g=="parent")||o&&(g=="buffer"||g=="byteLength"||g=="byteOffset")||KE(g,p)))&&c.push(g);return c}function Ud(r,e){for(var t=r.length;t--;)if(Rb(r[t][0],e))return t;return-1}function qE(r,e,t){var i=e(r);return Od(r)?i:ZT(i,t(r))}function Cs(r){return r==null?r===void 0?LT:BT:kr&&kr in Object(r)?JE(r):QE(r)}function cb(r){return Ps(r)&&Cs(r)==Fd}function Tb(r,e,t,i,n){return r===e?!0:r==null||e==null||!Ps(r)&&!Ps(e)?r!==r&&e!==e:HE(r,e,t,i,Tb,n)}function HE(r,e,t,i,n,o){var a=Od(r),c=Od(e),p=a?zc:Lt(r),g=c?zc:Lt(e);p=p==Fd?Ai:p,g=g==Fd?Ai:g;var v=p==Ai,m=g==Ai,b=p==g;if(b&&Yc(r)){if(!Yc(e))return!1;a=!0,v=!1}if(b&&!v)return o||(o=new Dt),a||Ub(r)?Eb(r,e,t,i,n,o):VE(r,e,p,t,i,n,o);if(!(t&Bd)){var y=v&&it.call(r,"__wrapped__"),C=m&&it.call(e,"__wrapped__");if(y||C){var w=y?r.value():r,A=C?e.value():e;return o||(o=new Dt),n(w,A,t,i,o)}}return b?(o||(o=new Dt),zE(r,e,t,i,n,o)):!1}function jE(r){if(!Mb(r)||ZE(r))return!1;var e=Ob(r)?dE:JT;return e.test(Cr(r))}function WE(r){return Ps(r)&&Bb(r.length)&&!!W[Cs(r)]}function GE(r){if(!YE(r))return cE(r);var e=[];for(var t in Object(r))it.call(r,t)&&t!="constructor"&&e.push(t);return e}function Eb(r,e,t,i,n,o){var a=t&Bd,c=r.length,p=e.length;if(c!=p&&!(a&&p>c))return!1;var g=o.get(r);if(g&&o.get(e))return g==e;var v=-1,m=!0,b=t&pb?new Rd: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(!YT(e,function(A,B){if(!tE(b,B)&&(y===A||n(y,A,t,i,o)))return b.push(B)})){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 VE(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 Pb:return!(r.byteLength!=e.byteLength||!o(new db(r),new db(e)));case hb:case fb:case bb:return Rb(+r,+e);case vb:return r.name==e.name&&r.message==e.message;case kb:case Sb:return r==e+"";case xd:var c=iE;case Ad:var p=i&Bd;if(c||(c=sE),r.size!=e.size&&!p)return!1;var g=a.get(r);if(g)return g==e;i|=pb,a.set(r,e);var v=Eb(c(r),c(e),i,n,o,a);return a.delete(r),v;case UT:if(Vc)return Vc.call(r)==Vc.call(e)}return!1}function zE(r,e,t,i,n,o){var a=t&Bd,c=mb(r),p=c.length,g=mb(e),v=g.length;if(p!=v&&!a)return!1;for(var m=p;m--;){var b=c[m];if(!(a?b in e:it.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 A=r[b],B=e[b];if(i)var me=a?i(B,A,b,e,r,o):i(A,B,b,r,e,o);if(!(me===void 0?A===B||n(A,B,t,i,o):me)){C=!1;break}w||(w=b=="constructor")}if(C&&!w){var _n=r.constructor,ka=e.constructor;_n!=ka&&"constructor"in r&&"constructor"in e&&!(typeof _n=="function"&&_n instanceof _n&&typeof ka=="function"&&ka instanceof ka)&&(C=!1)}return o.delete(r),o.delete(e),C}function mb(r){return qE(r,iR,$E)}function Ld(r,e){var t=r.__data__;return XE(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Ei(r,e){var t=rE(r,e);return jE(t)?t:void 0}function JE(r){var e=it.call(r,kr),t=r[kr];try{r[kr]=void 0;var i=!0}catch{}var n=xb.call(r);return i&&(e?r[kr]=t:delete r[kr]),n}var $E=lb?function(r){return r==null?[]:(r=Object(r),XT(lb(r),function(e){return Ab.call(r,e)}))}:nR,Lt=Cs;($c&&Lt(new $c(new ArrayBuffer(1)))!=Td||ks&&Lt(new ks)!=xd||Kc&&Lt(Kc.resolve())!=rb||Xc&&Lt(new Xc)!=Ad||Zc&&Lt(new Zc)!=Jc)&&(Lt=function(r){var e=Cs(r),t=e==Ai?r.constructor:void 0,i=t?Cr(t):"";if(i)switch(i){case mE:return Td;case pE:return xd;case gE:return rb;case hE:return Ad;case fE:return Jc}return e});function KE(r,e){return e=e??gb,!!e&&(typeof r=="number"||$T.test(r))&&r>-1&&r%1==0&&r<e}function XE(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function ZE(r){return!!ob&&ob in r}function YE(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||Md;return r===t}function QE(r){return xb.call(r)}function Cr(r){if(r!=null){try{return Fb.call(r)}catch{}try{return r+""}catch{}}return""}function Rb(r,e){return r===e||r!==r&&e!==e}var eR=cb(function(){return arguments}())?cb:function(r){return Ps(r)&&it.call(r,"callee")&&!Ab.call(r,"callee")},Od=Array.isArray;function tR(r){return r!=null&&Bb(r.length)&&!Ob(r)}var Yc=uE||sR;function rR(r,e){return Tb(r,e)}function Ob(r){if(!Mb(r))return!1;var e=Cs(r);return e==yb||e==OT||e==RT||e==MT}function Bb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=gb}function Mb(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function Ps(r){return r!=null&&typeof r=="object"}var Ub=sb?eE(sb):WE;function iR(r){return tR(r)?_E(r):GE(r)}function nR(){return[]}function sR(){return!1}Ti.exports=rR});var SS=f(Zd=>{"use strict";Zd.byteLength=UR;Zd.toByteArray=DR;Zd.fromByteArray=qR;var ot=[],qe=[],MR=typeof Uint8Array<"u"?Uint8Array:Array,Bm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Dr=0,bS=Bm.length;Dr<bS;++Dr)ot[Dr]=Bm[Dr],qe[Bm.charCodeAt(Dr)]=Dr;var Dr,bS;qe[45]=62;qe[95]=63;function kS(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 UR(r){var e=kS(r),t=e[0],i=e[1];return(t+i)*3/4-i}function LR(r,e,t){return(e+t)*3/4-t}function DR(r){var e,t=kS(r),i=t[0],n=t[1],o=new MR(LR(r,i,n)),a=0,c=n>0?i-4:i,p;for(p=0;p<c;p+=4)e=qe[r.charCodeAt(p)]<<18|qe[r.charCodeAt(p+1)]<<12|qe[r.charCodeAt(p+2)]<<6|qe[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=qe[r.charCodeAt(p)]<<2|qe[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=qe[r.charCodeAt(p)]<<10|qe[r.charCodeAt(p+1)]<<4|qe[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function NR(r){return ot[r>>18&63]+ot[r>>12&63]+ot[r>>6&63]+ot[r&63]}function _R(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(NR(i));return n.join("")}function qR(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,c=t-i;a<c;a+=o)n.push(_R(r,a,a+o>c?c:a+o));return i===1?(e=r[t-1],n.push(ot[e>>2]+ot[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(ot[e>>10]+ot[e>>4&63]+ot[e<<2&63]+"=")),n.join("")}});var lH=qn(Lv(),1);function h(r,e){if(r==null)throw Error(e??"Expected nonnullish value.")}function mr(r,e){if(!r)throw Error(e)}var ie;(function(r){r.COMMENT="t1_",r.ACCOUNT="t2_",r.LINK="t3_",r.MESSAGE="t4_",r.SUBREDDIT="t5_",r.AWARD="t6_"})(ie||(ie={}));function At(r){return r.startsWith(ie.COMMENT)}function ud(r){return r.startsWith(ie.ACCOUNT)}function pr(r){return r.startsWith(ie.LINK)}function Dv(r){return r.startsWith(ie.MESSAGE)}function Nv(r){return r.startsWith(ie.SUBREDDIT)}function _v(r){return r.startsWith(ie.AWARD)}function Kx(r){mr(At(r),`Expected comment id to start with ${ie.COMMENT}, got ${r}}`)}function Xx(r){mr(ud(r),`Expected account id to start with ${ie.ACCOUNT}, got ${r}}`)}function Zx(r){mr(pr(r),`Expected link id to start with ${ie.LINK}, got ${r}}`)}function Yx(r){mr(Dv(r),`Expected message id to start with ${ie.MESSAGE}, got ${r}}`)}function Qx(r){mr(Nv(r),`Expected subreddit id to start with ${ie.SUBREDDIT}, got ${r}}`)}function eA(r){mr(_v(r),`Expected award id to start with ${ie.AWARD}, got ${r}}`)}function ni(r){return Kx(r),r}function ne(r){return Xx(r),r}function fe(r){return Zx(r),r}function tA(r){return Yx(r),r}function Re(r){return Qx(r),r}function rA(r){return eA(r),r}function ve(r){if(At(r))return ni(r);if(ud(r))return ne(r);if(pr(r))return fe(r);if(Dv(r))return tA(r);if(Nv(r))return Re(r);if(_v(r))return rA(r);throw new Error(`Expected thing id to start with ${Object.values(ie).join(", ")} got ${r}}`)}function gc(r){return At(r)}import*as P from"@devvit/protos";var cd=class{constructor(e){}};var hc=(t=>(t.Installation="installation",t.App="app",t))(hc||{});function gr(r,e=new Set){for(let t of r){if(t.type==="group"){gr(t.fields,e);continue}let i=t.name;if(e.has(i))throw new Error(`Duplicate field name: ${i}`);e.add(i)}iA(r)}function iA(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 Tt=Object.freeze({INTERVAL:0,FORM:1,STATE:2,CHANNEL:3});var AM=["3rd-party","activity","add-emoji","add","add-media","add-to-feed","admin","ads","ai","align-center","align-left","align-right","all","ama","appearance","approve","archived","aspect-ratio","aspect-rectangle","attach","audience","audio","author","automod","avatar-style","award","back","backup","ban","best","block","blockchain","bold","boost","bot","bounce","brand-awareness","browse","browser","cake","calendar","camera","campaign","caret-down","caret-left","caret-right","caret-up","chat","chat-group","chat-new","chat-private","checkbox-dismiss","checkbox","checkmark","chrome","clear","client-list","close","closed-captioning","code-block","code-inline","coins-color-old","coins","collapse-left","collapse-right","collectible-expressions","collection","comment","comments","communities","community","confidence","contest","controversial","conversion","copy-clipboard","crop","crosspost","crowd-control","custom-feed","customize","dashboard","day","delete-column","delete","delete-row","devvit","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","funnel","gif-post","gold","hashtag","heart","help","hide","history","home","hot","ignore-reports","image-post","inbox","info","insert-column-left","insert-column-right","insert-row-above","insert-row-below","internet","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","macro","mark-read","marketplace","mask","media-gallery","meme","menu","message","mic","mic-mute","mod","mod-mail","mod-mode","mod-mute","mod-overflow","mod-queue","mod-unmute","music","mute","new","night","no-internet","notification","notification-frequent","notification-off","nsfw","nsfw-language","nsfw-violence","official","original","overflow-caret","overflow-horizontal","overflow-vertical","pause","payment","peace","pending-posts","phone","pin","play","poll-post","popular","posts","powerup","predictions","premium","privacy","profile","qa","qr-code","quarantined","quote","r-slash","radar","radio-button","raise-hand","random","ratings-everyone","ratings-mature","ratings-nsfw","ratings-violence","recovery-phrase","refresh","removal-reasons","remove","reply","report","reverse","rich-text","right","rising","rotate","rotate-image","rpan","rules","safari","save","save-view","saved","saved-response","search","self","send","settings","severity","share","share-new","show","side-menu","skipback10","skipforward10","sort-az","sort","sort-price","sort-za","spam","spoiler","sponsored","spreadsheet","star","statistics","status-live","sticker","strikethrough","subtract","superscript","swap-camera","swipe-back","swipe-down","swipe","swipe-up","table","tag","tap","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","translation-off","trim","u-slash","unban","undo","unheart","unlock","unmod","unpin","unstar","unverified","up-arrow","up","upload","upvote","upvotes","user","user-note","users","vault","verified","video-camera","video-feed","video-post","video-thread","video-transcription","view-card","view-classic","view-compact","view-grid","view-sort","views","volume","wallet","warning","webhook","whale","wiki-ban","wiki","wiki-unban","world","coins-color","powerup-color","powerup-fill-color","share-android","share-ios","video-live-1","video-live-fill-1","video-live","volume-mute","binoculars","planet","telescope","caret-updown"];import{AppSettingsDefinition as bA,GetFieldsResponse as kA}from"@devvit/protos";import{FormField as hr,FormFieldType as Oe}from"@devvit/protos";function pt(r){return r.map(e=>{switch(e.type){case"string":return nA(e);case"image":return sA(e);case"paragraph":return oA(e);case"number":return aA(e);case"select":return dA(e);case"boolean":return lA(e);case"group":return uA(e);default:throw new Error("Unknown field type.")}})}function nA(r){return hr.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 sA(r){return hr.fromPartial({disabled:r.disabled,fieldId:r.name,fieldType:Oe.IMAGE,helpText:r.helpText,label:r.label,required:r.required})}function oA(r){return hr.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 aA(r){return hr.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 dA(r){return hr.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 lA(r){return hr.fromPartial({defaultValue:{fieldType:Oe.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Oe.BOOLEAN,helpText:r.helpText,label:r.label})}function uA(r){return hr.fromPartial({fieldType:Oe.GROUP,fieldConfig:{groupConfig:{fields:pt(r.fields)}},label:r.label,helpText:r.helpText})}function U(r,e){u.prototype[r]=e}import{ValidateFormResponse as yA}from"@devvit/protos";import{RealtimeSubscriptionStatus as Hv}from"@devvit/protos";var L=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",SubredditName:"devvit-subreddit-name",TraceID:"devvit-trace-id",User:"devvit-user",UserAgent:"devvit-user-agent",Version:"devvit-version",Language:"devvit-accept-language",Timezone:"devvit-accept-timezone",AppDependencies:"devvit-app-dependencies",WebviewTemplate:"devvit-webview-template"}),qv;(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",r.Bootstrap="bootstrap"})(qv||(qv={}));function jv(r){function e(t){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=r.metadata[L.App]?.values[0];h(c,"useChannel - app is missing from Context");let p=r.metadata[L.Installation]?.values[0];h(p,"useChannel - installation is missing from Context");async function g(A){let B=o[n].channel;if(o[n].active)if(o[n].connected)await r.realtime.send(B,A);else throw Error(`Failed to send to channel '${B}'; it is active but not yet connected`);else throw Error(`Cannot send a message over inactive channel: ${B}`)}function v(){if(!o[n].active){let A=o[n].channel;o[n].active=!0,r.addRealtimeChannel(A)}}function m(){if(o[n].active){let A=o[n].channel;o[n].active=!1,r.removeRealtimeChannel(A)}}function b(A){return async()=>{let B;switch(A.status){case Hv.REALTIME_SUBSCRIBED:o[n].connected=!0,B=t.onSubscribed?.();break;case Hv.REALTIME_UNSUBSCRIBED:o[n].connected=!1,B=t.onUnsubscribed?.();break;default:B=t.onMessage(A.event?.data??{});break}await B}}let y={channel:`${c}:${p}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:Tt.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:g,status:w}}return e}import{FormFieldType as si}from"@devvit/protos";function fc(r){switch(r.fieldType){case si.STRING:return r.stringValue;case si.IMAGE:return r.stringValue;case si.PARAGRAPH:return r.stringValue;case si.NUMBER:return r.numberValue;case si.BOOLEAN:return r.boolValue;case si.SELECTION:return r.selectionValue?.values??[];default:return}}function Et(r){return Object.keys(r).reduce((e,t)=>{let i=fc(r[t]);return i!==void 0&&(e[t]=i),e},{})}function Wv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentKey(),a=r.getCurrentComponentState(),c=r.getPreviousComponentState(),p=`form.hook.${o}.${n}`,g={formKey:p,preventSubmit:!1,type:Tt.FORM};n in a?g=a[n]:n in c&&(g=c[n]),a[n]=g,r.forms.set(p,t);let v=r.formSubmittedEvent;return v&&!g.preventSubmit&&v.formId===p&&r.runHook(async()=>{let m=i(Et(v.results));m&&m instanceof Promise&&await m,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function Gv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=100,p=Math.max(c,i),g={lastRun:void 0,running:!1,preventCallback:!1,type:Tt.INTERVAL};n in o?g=o[n]:n in a&&(g=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===Tt.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:Tt.INTERVAL},r.rerenderIn(p)}function m(){o[n].running=!1,o[n].lastRun=void 0,o[n].preventCallback=!1}return r.isEffectRender&&g.running&&(g.preventCallback||(g.lastRun===void 0||g.lastRun+p<Date.now())&&r.runHook(async()=>{let b=t();b&&b instanceof Promise&&await b,g.lastRun=Date.now()}),r.rerenderIn(p)),g.preventCallback=!1,o[n]=g,r.currentHookIndex++,{start:v,stop:m}}return e}function Vv(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 kc={now(){return new Date}};function zv(r){return`__autocache__${r}`}function Jv(r){return`__lock__${r}`}var mA=300,pA=1e3,md=5e3,vc=3,$v=.1,Kv=1e3,gA=3e4;function Xv(r){if(r.error)throw new Error(r.error);return r.value}var Rt,Ot,Be,oi,$,Zv,Yv,Qv,yc,ey,ty,bc,ry,pd=class{constructor(e,t,i=kc){l(this,$);l(this,Rt);l(this,Ot,{});l(this,Be);l(this,oi);d(this,Rt,e),d(this,oi,t),d(this,Be,i)}async cache(e,t){d(this,Ot,s(this,oi).__cache=s(this,oi).__cache??{}),S(this,$,ry).call(this,t);let i=S(this,$,Zv).call(this,t.key);if(i!==void 0)return i;let n=await S(this,$,bc).call(this,t.key),o=await S(this,$,Yv).call(this,t,n,e);return Xv(o)}};Rt=new WeakMap,Ot=new WeakMap,Be=new WeakMap,oi=new WeakMap,$=new WeakSet,Zv=function(e){let t=s(this,Ot)[e];if(t){let i=s(this,Be).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<vc&&Math.random()<$v&&t.errorTime+Kv<i;if(t?.expires&&t.expires<i&&t.checkedAt+Kv<i||n){delete s(this,Ot)[e];return}else return Xv(t)}},Yv=async function(e,t,i){let n=t?.expires,o=n?S(this,$,ty).call(this,n):1;return!t||t?.error&&t.errorCount<vc&&$v>Math.random()||o>Math.random()?S(this,$,Qv).call(this,e,t,i):t},Qv=async function(e,t,i){let n=Jv(e.key),o=s(this,Be).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Rt).set(n,"1",{expiration:a,nx:!0}))return S(this,$,ey).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Be).now();return S(this,$,yc).call(this,p,e.key,e.ttl)}},yc=async function(e,t,i){let n=Math.min(i,pA),o=await S(this,$,bc).call(this,t);if(o)return o;if(s(this,Be).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,mA)),S(this,$,yc).call(this,e,t,i)},ey=async function(e,t,i,n){let o=s(this,Be).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,Be).now().getTime(),t.errorCount++}return s(this,Ot)[e]=t,await s(this,Rt).set(zv(e),JSON.stringify(t),{expiration:new Date(o+gA)}),t.error&&t.errorCount<vc&&await s(this,Rt).del(Jv(e)),t},ty=function(e){let t=s(this,Be).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},bc=async function(e){let t=await s(this,Rt).get(zv(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Be).now().getTime(),s(this,Ot)[e]=i,i}},ry=function(e){e.ttl<md&&(console.warn(`Cache TTL cannot be less than ${md} milliseconds! Updating ttl value of ${e.ttl} to ${md}.`),e.ttl=md)};function iy(r,e,t=kc){let i=new pd(r,e,t);return i.cache.bind(i)}function ny(r){new URL(r.slice(0,r.indexOf(",")))}var ai,di,ui,sy,oy,li=class{constructor(){l(this,ui);l(this,ai,{});l(this,di,{});d(this,ai,u.assets),d(this,di,u.webviewAssets)}getURL(e,t){return typeof e=="string"?S(this,ui,sy).call(this,e,t??{webview:!1}):S(this,ui,oy).call(this,e,t??{webview:!1})}};ai=new WeakMap,di=new WeakMap,ui=new WeakSet,sy=function(e,t){let i=t.webview?s(this,di)[e]:s(this,ai)[e];if(i)return i;try{return ny(e),encodeURI(e)}catch{return""}},oy=function(e,t){let i={},n=[],o=t.webview?s(this,di):s(this,ai);if(o)for(let a of e)if(o[a])i[a]=o[a];else try{ny(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 Bt,ci=class{constructor(e){l(this,Bt);d(this,Bt,e)}async get(e){let{messages:t}=await u.kvStorePlugin.Get({keys:[e]},s(this,Bt));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,Bt))}async delete(e){await u.kvStorePlugin.Del({keys:[e]},s(this,Bt))}async list(){let{keys:e}=await u.kvStorePlugin.List({filter:"*"},s(this,Bt));return e}};Bt=new WeakMap;var ds,mi=class{constructor(e){l(this,ds);d(this,ds,e)}async upload(e){let t=await u.mediaPlugin.Upload(e,s(this,ds));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};ds=new WeakMap;var ls,pi=class{constructor(e){l(this,ls);d(this,ls,e)}async add(e){await u.modLogPlugin.Add(e,s(this,ls))}};ls=new WeakMap;var us,gi=class{constructor(e){l(this,us);d(this,us,e)}async send(e,t){await u.realtimePlugin.Send({channel:e,data:t},s(this,us))}};us=new WeakMap;var k,cs,fi=class{constructor(e){l(this,k);l(this,cs);d(this,k,e),d(this,cs,new hd(e))}get modMail(){return s(this,cs)}getSubredditById(e){return ye.getById(ve(e),s(this,k))}getSubredditByName(e){return ye.getByName(e,s(this,k))}addSubredditRemovalReason(e,t){return ye.addRemovalReason(e,t.title,t.message,s(this,k))}getSubredditRemovalReasons(e){return ye.getRemovalReasons(e,s(this,k))}getCurrentSubreddit(){return ye.getFromMetadata(s(this,k))}getPostById(e){return z.getById(ve(e),s(this,k))}submitPost(e){return z.submit(e,s(this,k))}crosspost(e){return z.crosspost(e,s(this,k))}getUserById(e){return I.getById(ve(e),s(this,k))}getCollectionById(e){return hi.getCollectionById({collectionId:e},s(this,k))}createCollection(e){return hi.create(e,s(this,k))}getCollectionsForSubreddit(e){return hi.getCollectionsForSubreddit({subredditId:e},s(this,k))}getUserByUsername(e){return I.getByUsername(e,s(this,k))}getCurrentUser(){return I.getFromMetadata(L.User,s(this,k))}getAppUser(){return I.getFromMetadata(L.AppUser,s(this,k))}getSnoovatarUrl(e){return I.getSnoovatarUrl(e,s(this,k))}getCommentById(e){return ee.getById(ve(e),s(this,k))}getComments(e){return ee.getComments(e,s(this,k))}getCommentsByUser(e){return ee.getCommentsByUser(e,s(this,k))}submitComment(e){return ee.submit({...e,id:ve(e.id)},s(this,k))}getControversialPosts(e){return z.getControversialPosts(e,s(this,k))}getTopPosts(e){return z.getTopPosts(e,s(this,k))}getHotPosts(e){return z.getHotPosts(e,s(this,k))}getNewPosts(e){return z.getNewPosts(e,s(this,k))}getRisingPosts(e){return z.getRisingPosts(e,s(this,k))}getPostsByUser(e){return z.getPostsByUser(e,s(this,k))}getCommentsAndPostsByUser(e){return I.getOverview(e,s(this,k))}getModerationLog(e){return gd(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.username,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 Me.get(e,s(this,k))}deleteModNote(e){return Me.delete(e,s(this,k))}addModNote(e){let t={...e,redditId:e.redditId?ve(e.redditId):void 0};return Me.add(t,s(this,k))}addRemovalNote(e){return Me.addRemovalNote(e,s(this,k))}async sendPrivateMessage(e){return fr.send(e,s(this,k))}async sendPrivateMessageAsSubreddit(e){return fr.sendAsSubreddit(e,s(this,k))}async approve(e){if(At(e))return ee.approve(e,s(this,k));if(pr(e))return z.approve(e,s(this,k));throw new Error("id must start with either t1_ or t3_")}async remove(e,t){if(At(e))return ee.remove(e,t,s(this,k));if(pr(e))return z.remove(e,t,s(this,k));throw new Error("id must start with either t1_ or t3_")}async getPostFlairTemplates(e){return de.getPostFlairTemplates(e,s(this,k))}async getUserFlairTemplates(e){return de.getUserFlairTemplates(e,s(this,k))}async createPostFlairTemplate(e){return de.createPostFlairTemplate(e,s(this,k))}async createUserFlairTemplate(e){return de.createUserFlairTemplate(e,s(this,k))}async editFlairTemplate(e){return de.editFlairTemplate(e,s(this,k))}async deleteFlairTemplate(e,t){return de.deleteFlairTemplate(e,t,s(this,k))}async setUserFlair(e){return Ue.setUserFlair(e,s(this,k))}async removeUserFlair(e,t){return Ue.removeUserFlair(e,t,s(this,k))}async setPostFlair(e){return Ue.setPostFlair(e,s(this,k))}async removePostFlair(e,t){return Ue.removePostFlair(e,fe(t),s(this,k))}async getWidgets(e){return se.getWidgets(e,s(this,k))}async deleteWidget(e,t){return se.delete(e,t,s(this,k))}async addWidget(e){return se.add(e,s(this,k))}async reorderWidgets(e,t){return se.reorder(e,t,s(this,k))}async getWikiPage(e,t){return be.getPage(e,t,s(this,k))}async getWikiPages(e){return be.getPages(e,s(this,k))}async createWikiPage(e){return be.createPage(e,s(this,k))}async updateWikiPage(e){return be.updatePage(e,s(this,k))}getWikiPageRevisions(e){return be.getPageRevisions(e,s(this,k))}async revertWikiPage(e,t,i){return be.revertPage(e,t,i,s(this,k))}async getWikiPageSettings(e,t){return be.getPageSettings(e,t,s(this,k))}async updateWikiPageSettings(e){return be.updatePageSettings(e,s(this,k))}async addEditorToWikiPage(e,t,i){return be.addEditor(e,t,i,s(this,k))}async removeEditorFromWikiPage(e,t,i){return be.removeEditor(e,t,i,s(this,k))}getMessages(e){return fr.getMessages(e,s(this,k))}markAllMessagesAsRead(){return fr.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 ye.aboutLocation({...e,location:"modqueue"},s(this,k))}getReports(e){return ye.aboutLocation({...e,location:"reports"},s(this,k))}getSpam(e){return ye.aboutLocation({...e,location:"spam"},s(this,k))}getUnmoderated(e){return ye.aboutLocation({...e,location:"unmoderated"},s(this,k))}getEdited(e){return ye.aboutLocation({...e,location:"edited"},s(this,k))}getVaultByAddress(e){return ly(e,s(this,k))}getVaultByUserId(e){return uy(ve(e),s(this,k))}getSubredditLeaderboard(e){return dy(e,s(this,k))}};k=new WeakMap,cs=new WeakMap;import{RedisKeyScope as Sc}from"@devvit/protos";function fd(r){return r&&typeof r=="object"&&"message"in r&&r.message!==void 0&&typeof r.message=="string"?r.message.includes("redis: nil"):!1}var E,R,O,Pc=class{constructor(e,t,i){l(this,E);l(this,R);l(this,O);d(this,E,e),d(this,R,t),d(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,vi,Cc=class Cc{constructor(e,t=void 0,i=Sc.INSTALLATION){l(this,M);l(this,vi);d(this,M,e),d(this,vi,t),this.scope=i,this.global=i===Sc.INSTALLATION?new Cc(s(this,M),s(this,vi),Sc.GLOBAL):this}get storage(){return s(this,vi)||u.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,M));return new Pc(this.storage,t,s(this,M))}async get(e){try{let t=await this.storage.Get({key:e,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return t!==null?t.value??void 0:t}catch(t){if(fd(t))return;throw 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){try{let i=await this.storage.ZScore({key:{key:e},member:t,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return i!==null?i.value:i}catch(i){if(fd(i))return;throw i}}async zRank(e,t){try{let i=await this.storage.ZRank({key:{key:e},member:t,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return i!==null?i.value:i}catch(i){if(fd(i))return;throw 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){try{let i=await this.storage.HGet({key:e,field:t,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return i!==null?i.value??void 0:i}catch(i){if(fd(i))return;throw 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,vi=new WeakMap;var yi=Cc;var vr,bi=class{constructor(e){l(this,vr);d(this,vr,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,vr))).id}async cancelJob(e){await u.schedulerPlugin.Cancel({id:e},s(this,vr))}async listJobs(){return(await u.schedulerPlugin.List({after:new Date(0),before:new Date(Date.now()+31536e7)},s(this,vr))).actions.map(t=>(h(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}))}};vr=new WeakMap;var ms,ki=class{constructor(e){l(this,ms);d(this,ms,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await u.settingsPlugin.GetSettings({},s(this,ms));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...cy(t.installationSettings.settings,u.installationSettings),...cy(t.appSettings.settings,u.appSettings)}}};ms=new WeakMap;function cy(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=fc(r[n]),i),{});return e&&my(t,e),t}function my(r,e){for(let t of e)t.type==="group"?my(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as wc,Form as hA,ToastAppearance as py}from"@devvit/protos";var yr,Si,vd=class{constructor(e){l(this,yr,[]);l(this,Si);d(this,Si,e)}showForm(e,t){let i=u.formDefinitions.get(e);if(!i&&s(this,Si)){let a=s(this,Si).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=hA.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});gr(n.fields),o.fields=pt(n.fields),s(this,yr).push({type:wc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?py.SUCCESS:py.NEUTRAL}:t={text:e},s(this,yr).push({type:wc.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,yr).push({type:wc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,yr)}};yr=new WeakMap,Si=new WeakMap;function Le({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new pi(r),o=new ci(r),a=new yi(r),c=iy(a,i?i.state:{}),p=new fi(r),g=new bi(r),v=new ki(r),m=e?new vd(i):void 0,b=new mi(r),y=new li,C=new gi(r),w=t&&i?Vv(i):void 0,A=t&&i?Gv(i):void 0,B=t&&i?Wv(i):void 0,me=t&&i?jv(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:g,settings:v,media:b,assets:y,realtime:C,get useForm(){return B??(()=>{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 A??(()=>{throw new Error("useInterval() is unavailable")})},get useChannel(){return me??(()=>{throw new Error("useChannel() is unavailable")})},get ui(){if(!m)throw new Error("ui client is not available");return m}}}var gy={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":"16.1.0","@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:"258 KB"}},source:"./src/index.ts"};function le(r,e,t){let i=r[L.Subreddit]?.values[0];h(i,"subreddit is missing from Context");let n=r[L.AppUser]?.values[0],o=r[L.App]?.values[0],a=r[L.Version]?.values[0],c=r[L.User]?.values[0],p=vA(r);return{get appAccountId(){return h(n,"appAccountId is missing from Context"),n},subredditId:i,userId:c,postId:e,commentId:t,appName:o,appVersion:a,debug:p,toJSON(){return{appAccountId:n,appName:o,appVersion:a,subredditId:i,userId:c,postId:e,commentId:t,debug:p}}}}function vA(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,bootstrap:void 0},t={};for(let n in e)t[n.toLowerCase()]=n;let i={};for(let n of(r[L.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[L.Debug]&&console.info(`[api] @devvit/public-api v${gy.version} ${Object.entries(i).map(([n,o])=>`${n}=${o}`).join(" ")}`),{...i,metadata:r}}function hy(r){return r.flatMap(e=>e.type==="group"?hy(e.fields):e)}async function yd(r,e,t){if(!e)throw new Error("Settings were not defined.");let i={success:!0,errors:{}},n=Et(r.fieldValues),o=hy(e);return await Promise.all(o.map(async a=>{let c=a.name;if(c&&a.onValidate){let p=n[c],g=a.onValidate,v=Object.assign(Le({metadata:t}),le(t)),m=await g({value:p,isEditing:r.editing},v);m&&(i.success=!1,i.errors[c]=m)}})),yA.fromJSON(i)}async function SA(){if(!u.appSettings)throw new Error("App settings were not defined.");return kA.fromJSON({fields:{fields:pt(u.appSettings)}})}async function PA(r,e){return yd(r,u.appSettings,e)}function fy(r){r.provides(bA),U("GetAppSettingsFields",SA),U("ValidateAppForm",PA)}import{CustomPostDefinition as TA,RenderPostResponse as EA}from"@devvit/protos";import{BlockRenderEventType as Nc,EffectType as My}from"@devvit/protos";function Pi(r){return r.__effects}function vy(){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 Dc,BlockAnimationDirection as xy,BlockAnimationLoopMode as Ay,BlockAnimationType as Ty,BlockAvatarBackground as Ey,BlockAvatarFacing as Ry,BlockAvatarSize as Mt,BlockBorderWidth as Pd,BlockButtonAppearance as Ut,BlockButtonSize as Tc,BlockFullSnooSize as wi,BlockGap as Cd,BlockHorizontalAlignment as Ec,BlockIconSize as wd,BlockImageResizeMode as ps,BlockPadding as gs,BlockRadius as hs,BlockSpacerShape as Rc,BlockSpacerSize as Id,BlockStackDirection as Oc,BlockTextOutline as Bc,BlockTextOverflow as Mc,BlockTextSize as Ii,BlockTextStyle as Uc,BlockTextWeight as Oy,BlockType as De,BlockVerticalAlignment as Lc}from"@devvit/protos";var Ic={"alienblue-100":"#DCE2FB","alienblue-200":"#B8C5FC","alienblue-25":"#F7F8FD","alienblue-300":"#90A9FD","alienblue-400":"#648EFC","alienblue-50":"#EEF0FB","alienblue-500":"#1870F4","alienblue-600":"#115BCA","alienblue-700":"#0A449B","alienblue-75":"#E6E9FB","alienblue-800":"#0A2F6C","alienblue-900":"#0A1A3F","alienblue-950":"#07102B","berrypurple-100":"#F3DAFB","berrypurple-200":"#EAB3FD","berrypurple-25":"#FBF6FD","berrypurple-300":"#DE8BFF","berrypurple-400":"#CF5FFF","berrypurple-50":"#F8EDFC","berrypurple-500":"#BC0EFF","berrypurple-600":"#9B00D4","berrypurple-700":"#7600A3","berrypurple-75":"#F6E4FB","berrypurple-800":"#520472","berrypurple-900":"#300643","berrypurple-950":"#20042A",black:"#000000","black-opacity-0":"#00000000","black-opacity-10":"#00000019","black-opacity-15":"#00000026","black-opacity-20":"#00000033","black-opacity-25":"#0000003F","black-opacity-33":"#00000054","black-opacity-5":"#0000000C","black-opacity-50":"#0000007F","black-opacity-60":"#00000099","black-opacity-67":"#000000AA","black-opacity-80":"#000000CC","black-opacity-90":"#000000E5","brown-100":"#F1DFCF","brown-200":"#E9BE95","brown-25":"#FBF7F4","brown-300":"#DC9D5D","brown-400":"#BA854E","brown-50":"#F7EFE9","brown-500":"#9A6D3F","brown-600":"#7B5631","brown-700":"#5D4023","brown-75":"#F4E7DC","brown-800":"#3F2C19","brown-900":"#221A11","brown-950":"#15100A","coolgray-100":"#DBE4E9","coolgray-150":"#C9D7DE","coolgray-200":"#B7CAD4","coolgray-25":"#F6F8F9","coolgray-250":"#A4BDCA","coolgray-300":"#97AFBC","coolgray-350":"#8BA2AD","coolgray-400":"#7F949F","coolgray-450":"#748791","coolgray-50":"#EEF1F3","coolgray-500":"#667780","coolgray-525":"#576F76","coolgray-550":"#5C6C74","coolgray-600":"#536168","coolgray-650":"#48545B","coolgray-700":"#3D494E","coolgray-75":"#E5EBEE","coolgray-750":"#333D42","coolgray-800":"#2A3236","coolgray-850":"#21272A","coolgray-900":"#181C1F","coolgray-950":"#0E1113","global-black":{light:"#000000",dark:"#000000"},"global-brand-orangered":{light:"#FF4500",dark:"#FF4500"},"global-white":{light:"#FFFFFF",dark:"#FFFFFF"},"kiwigreen-100":"#A8F5A0","kiwigreen-200":"#58E15B","kiwigreen-25":"#EBFDE7","kiwigreen-300":"#00C61C","kiwigreen-400":"#01A816","kiwigreen-50":"#DDF8D7","kiwigreen-500":"#008A10","kiwigreen-600":"#016E0B","kiwigreen-700":"#005306","kiwigreen-75":"#CAF5C2","kiwigreen-800":"#033902","kiwigreen-900":"#0D2005","kiwigreen-950":"#081404","lightblue-100":"#CAE7FB","lightblue-200":"#87D0FD","lightblue-25":"#F3F9FD","lightblue-300":"#02B9FB","lightblue-400":"#029DD5","lightblue-50":"#E6F3FC","lightblue-500":"#007FAE","lightblue-600":"#01668D","lightblue-700":"#014D6B","lightblue-75":"#D9EDFB","lightblue-800":"#03354B","lightblue-900":"#051E2B","lightblue-950":"#04131A","lime-100":"#B7F28E","lime-200":"#90DA58","lime-25":"#EEFDDC","lime-300":"#6DBF01","lime-400":"#5BA200","lime-50":"#E0F8C8","lime-500":"#4A8500","lime-600":"#3A6A00","lime-700":"#2A5000","lime-75":"#CEF5AD","lime-800":"#1E3702","lime-900":"#151E05","lime-950":"#0D1304","mintgreen-100":"#9BF5D9","mintgreen-200":"#00E2B7","mintgreen-25":"#E7FDF5","mintgreen-300":"#00C29D","mintgreen-400":"#01A484","mintgreen-50":"#D7F8EC","mintgreen-500":"#01876D","mintgreen-600":"#006C56","mintgreen-700":"#015140","mintgreen-75":"#C0F5E3","mintgreen-800":"#00382B","mintgreen-900":"#032019","mintgreen-950":"#03140F","orangered-100":"#FCDBCF","orangered-200":"#FDB498","orangered-25":"#FDF6F4","orangered-300":"#FF895D","orangered-400":"#FF4500","orangered-50":"#FCEEE8","orangered-500":"#D93900","orangered-600":"#AE2C00","orangered-700":"#842100","orangered-75":"#FBE5DC","orangered-800":"#591B02","orangered-900":"#2F1405","orangered-950":"#1C0D04","periwinkle-100":"#E6DFFB","periwinkle-200":"#CDBEFD","periwinkle-25":"#F9F7FD","periwinkle-300":"#B29FFF","periwinkle-400":"#9580FF","periwinkle-50":"#F2EFFC","periwinkle-500":"#6A5CFF","periwinkle-600":"#523DFF","periwinkle-700":"#4001EA","periwinkle-75":"#ECE7FB","periwinkle-800":"#250AA6","periwinkle-900":"#160E5B","periwinkle-950":"#0C083F","poopbrown-100":"#FEEEDD","poopbrown-200":"#F6DDC3","poopbrown-300":"#EECCAA","poopbrown-400":"#CAA075","poopbrown-50":"#FEF7EE","poopbrown-500":"#9A6D3F","poopbrown-600":"#6E4924","poopbrown-700":"#54371A","poopbrown-800":"#3B2510","poopbrown-900":"#29190A","poopbrown-950":"#110B04","puregray-100":"#F2F2F2","puregray-150":"#EBEBEB","puregray-200":"#E4E4E4","puregray-250":"#DDDDDD","puregray-300":"#D6D6D6","puregray-350":"#C3C3C3","puregray-400":"#ACACAC","puregray-450":"#919191","puregray-50":"#F8F8F8","puregray-500":"#767676","puregray-550":"#5C5C5C","puregray-600":"#434343","puregray-650":"#393939","puregray-700":"#303030","puregray-750":"#272727","puregray-800":"#1E1E1E","puregray-850":"#181818","puregray-900":"#131313","puregray-950":"#080808","red-100":"#FBDBD4","red-200":"#FDB3A4","red-25":"#FDF6F5","red-300":"#FF8773","red-400":"#FF4F40","red-50":"#FCEEEA","red-500":"#EB001F","red-600":"#BC0117","red-700":"#90000F","red-75":"#FBE4DF","red-800":"#650405","red-900":"#340F05","red-950":"#1F0B04","sakurapink-100":"#FBD9EB","sakurapink-200":"#FDAEDA","sakurapink-25":"#FDF6F9","sakurapink-300":"#FF7ECA","sakurapink-400":"#FF38BB","sakurapink-50":"#FCEDF4","sakurapink-500":"#DE019F","sakurapink-600":"#B2007F","sakurapink-700":"#880060","sakurapink-75":"#FBE3EF","sakurapink-800":"#5F0443","sakurapink-900":"#380626","sakurapink-950":"#250419",transparent:"transparent",white:"#ffffff","white-opacity-0":"#FFFFFF00","white-opacity-10":"#FFFFFF19","white-opacity-15":"#FFFFFF26","white-opacity-20":"#FFFFFF33","white-opacity-25":"#FFFFFF3F","white-opacity-5":"#FFFFFF0C","white-opacity-50":"#FFFFFF7F","yellow-100":"#FFE284","yellow-200":"#FFBF0B","yellow-25":"#FFF9E0","yellow-300":"#D8A100","yellow-400":"#B78800","yellow-50":"#FFF3C0","yellow-500":"#977000","yellow-600":"#785800","yellow-700":"#5B4200","yellow-75":"#FFEAA2","yellow-800":"#3F2D00","yellow-900":"#231A03","yellow-950":"#161003","yelloworange-100":"#FCDCC8","yelloworange-200":"#FDB586","yelloworange-25":"#FDF7F3","yelloworange-300":"#FF8A35","yelloworange-400":"#E46C00","yelloworange-50":"#FCEEE6","yelloworange-500":"#BD5800","yelloworange-600":"#974500","yelloworange-700":"#733300","yelloworange-75":"#FBE5D7","yelloworange-800":"#4E2402","yelloworange-900":"#2A1705","yelloworange-950":"#1A0E04","action-downvote":{light:"#6A5CFF",dark:"#6A5CFF"},"action-upvote":{light:"#D93900",dark:"#D93900"},"ai-background-weaker":{light:"#E7FDF5",dark:"#00382B"},"ai-plain":{light:"#006C56",dark:"#01A484"},"ai-plain-hover":{light:"#015140",dark:"#00C29D"},"alert-caution":{light:"#977000",dark:"#977000"},"avatar-gradient":{light:"",dark:""},"brand-background":{light:"#D93900",dark:"#D93900"},"brand-background-hover":{light:"#AE2C00",dark:"#AE2C00"},"brand-gradient-active":{light:"",dark:""},"brand-gradient-active-highlight":{light:"",dark:""},"brand-gradient-default":{light:"",dark:""},"brand-gradient-default-highlight":{light:"",dark:""},"brand-gradient-hover":{light:"",dark:""},"brand-gradient-hover-highlight":{light:"",dark:""},"brand-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"category-live":{light:"#D93900",dark:"#D93900"},"category-nsfw":{light:"#DE019F",dark:"#DE019F"},"category-spoiler":{light:"#131313",dark:"#F2F2F2"},"caution-background":{light:"#FFBF0B",dark:"#D8A100"},"caution-background-hover":{light:"#D8A100",dark:"#FFBF0B"},"caution-onBackground":{light:"#000000",dark:"#000000"},"caution-plain":{light:"#785800",dark:"#FFBF0B"},"caution-plain-hover":{light:"#5B4200",dark:"#FFE284"},"danger-background":{light:"#EB001F",dark:"#BC0117"},"danger-background-disabled":{light:"#FDB3A4",dark:"#340F05"},"danger-background-hover":{light:"#BC0117",dark:"#EB001F"},"danger-background-weaker":{light:"#FBDBD4",dark:"#650405"},"danger-content":{light:"#BC0117",dark:"#FF4F40"},"danger-content-default":{light:"#ffffff",dark:"#ffffff"},"danger-content-hover":{light:"#90000F",dark:"#FF8773"},"danger-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"danger-plain":{light:"#BC0117",dark:"#FF8773"},"danger-plain-hover":{light:"#90000F",dark:"#FDB3A4"},"downvote-background":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-background-disabled":{light:"#6a5cff4d",dark:"#6a5cff4d"},"downvote-background-hover":{light:"#523DFF",dark:"#523DFF"},"downvote-content":{light:"#523DFF",dark:"#9580FF"},"downvote-content-weak":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-disabled":{light:"#523DFF4c",dark:"#9580FF4c"},"downvote-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"downvote-onStrongScrim":{light:"#B29FFF",dark:"#B29FFF"},"downvote-onStrongScrim-disabled":{light:"#b29fff4d",dark:"#b29fff4d"},"downvote-onStrongScrim-weaker":{light:"#9580FF",dark:"#9580FF"},"downvote-plain":{light:"#523DFF",dark:"#9580FF"},"downvote-plain-disabled":{light:"#523dff4d",dark:"#9580ff4d"},"downvote-plain-weaker":{light:"#6A5CFF",dark:"#6A5CFF"},"elevation-large1":{light:"#0000003F",dark:"#0000007F"},"elevation-large2":{light:"#00000026",dark:"#00000033"},"elevation-medium1":{light:"#0000003F",dark:"#0000007F"},"elevation-medium2":{light:"#00000019",dark:"#00000033"},"elevation-small":{light:"#00000026",dark:"#00000054"},"elevation-xsmall":{light:"#0000003F",dark:"#000000AA"},favorite:{light:"#977000",dark:"#B78800"},"global-admin":{light:"#D93900",dark:"#D93900"},"global-alienblue":{light:"#1870F4",dark:"#1870F4"},"global-darkblue":{light:"#2A3236",dark:"#2A3236"},"global-focus":{light:"#029DD5",dark:"#007FAE"},"global-gold":{light:"#B78800",dark:"#D8A100"},"global-moderator":{light:"#008A10",dark:"#008A10"},"global-nsfw":{light:"#DE019F",dark:"#DE019F"},"global-offline":{light:"#667780",dark:"#667780"},"global-online":{light:"#00C61C",dark:"#00C61C"},"global-orangered":{light:"#FF4500",dark:"#FF4500"},"global-stars":{light:"#977000",dark:"#D8A100"},"gradient-media":{light:"",dark:""},"gradient-media-strong":{light:"",dark:""},"identity-admin":{light:"#D93900",dark:"#D93900"},"identity-coins":{light:"#B78800",dark:"#B78800"},"identity-moderator":{light:"#008A10",dark:"#008A10"},"identity-self":{light:"#01876D",dark:"#01876D"},"interactive-background-disabled":{light:"#0000000C",dark:"#FFFFFF0C"},"interactive-content-disabled":{light:"#0000003F",dark:"#FFFFFF3F"},"interactive-focused":{light:"#007FAE",dark:"#007FAE"},"interactive-pressed":{light:"#00000026",dark:"#FFFFFF26"},"inverted-interactive-background-disabled":{light:"#FFFFFF0C",dark:"#0000000C"},"inverted-interactive-content-disabled":{light:"#FFFFFF3F",dark:"#0000003F"},"inverted-interactive-pressed":{light:"#FFFFFF26",dark:"#00000026"},"inverted-neutral-background":{light:"#0E1113",dark:"#FFFFFF"},"inverted-neutral-background-hover":{light:"#181C1F",dark:"#F6F8F9"},"inverted-neutral-border":{light:"#FFFFFF33",dark:"#00000033"},"inverted-neutral-content":{light:"#B7CAD4",dark:"#333D42"},"inverted-neutral-content-strong":{light:"#EEF1F3",dark:"#181C1F"},"inverted-secondary-background":{light:"#2A3236",dark:"#E5EBEE"},"inverted-secondary-background-hover":{light:"#333D42",dark:"#DBE4E9"},"inverted-secondary-background-selected":{light:"#3D494E",dark:"#C9D7DE"},"inverted-secondary-onBackground":{light:"#FFFFFF",dark:"#000000"},"inverted-secondary-plain":{light:"#DBE4E9",dark:"#181C1F"},"inverted-secondary-plain-hover":{light:"#FFFFFF",dark:"#000000"},"media-background":{light:"#00000099",dark:"#00000099"},"media-background-hover":{light:"#000000cc",dark:"#000000cc"},"media-background-selected":{light:"#000000cc",dark:"#000000cc"},"media-border-selected":{light:"#FFFFFF",dark:"#FFFFFF"},"media-border-weak":{light:"#FFFFFF19",dark:"#FFFFFF19"},"media-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"media-onBackground-disabled":{light:"#FFFFFF3F",dark:"#FFFFFF3F"},"media-onBackground-weak":{light:"#E5EBEE",dark:"#E5EBEE"},"media-onbackground":{light:"#ffffff",dark:"#ffffff"},"media-onbackground-disabled":{light:"#ffffff3f",dark:"#ffffff3f"},"media-onbackground-weak":{light:"#B7CAD4",dark:"#B7CAD4"},"neutral-background":{light:"#FFFFFF",dark:"#0E1113"},"neutral-background-container":{light:"#F6F8F9",dark:"#181C1F"},"neutral-background-container-hover":{light:"#EEF1F3",dark:"#21272A"},"neutral-background-container-strong":{light:"#EEF1F3",dark:"#21272A"},"neutral-background-container-strong-hover":{light:"#E5EBEE",dark:"#2A3236"},"neutral-background-gilded":{light:"#FFF9E0",dark:"#181C1F"},"neutral-background-gilded-hover":{light:"#FFF3C0",dark:"#21272A"},"neutral-background-hover":{light:"#F6F8F9",dark:"#181C1F"},"neutral-background-medium":{light:"#F8F8F8",dark:"#131313"},"neutral-background-pinned":{light:"#FFFFFF",dark:"#0E1113"},"neutral-background-selected":{light:"#E5EBEE",dark:"#2A3236"},"neutral-background-strong":{light:"#FFFFFF",dark:"#181C1F"},"neutral-background-strong-hover":{light:"#F6F8F9",dark:"#21272A"},"neutral-background-weak":{light:"#F6F8F9",dark:"#000000"},"neutral-background-weak-hover":{light:"#EEF1F3",dark:"#0E1113"},"neutral-border":{light:"#00000033",dark:"#FFFFFF33"},"neutral-border-medium":{light:"#0000007F",dark:"#FFFFFF7F"},"neutral-border-strong":{light:"#181C1F",dark:"#F6F8F9"},"neutral-border-weak":{light:"#00000019",dark:"#FFFFFF19"},"neutral-content":{light:"#333D42",dark:"#B7CAD4"},"neutral-content-disabled":{light:"#D6D6D6",dark:"#303030"},"neutral-content-strong":{light:"#181C1F",dark:"#EEF1F3"},"neutral-content-weak":{light:"#5C6C74",dark:"#8BA2AD"},offline:{light:"#767676",dark:"#767676"},online:{light:"#01A816",dark:"#01A816"},"opacity-08":{light:"#13131314",dark:"#13131314"},"opacity-50":{light:"#0000007f",dark:"#F2F2F27f"},"opacity-highlight":{light:"",dark:""},pizzaRed:{light:"#ef5350",dark:"#c62828"},primary:{light:"#115BCA",dark:"#648EFC"},"primary-background":{light:"#0A449B",dark:"#115BCA"},"primary-background-hover":{light:"#0A2F6C",dark:"#1870F4"},"primary-background-selected":{light:"#0A1A3F",dark:"#648EFC"},"primary-border":{light:"#0A449B",dark:"#648EFC"},"primary-border-hover":{light:"#0A2F6C",dark:"#90A9FD"},"primary-hover":{light:"#0A449B",dark:"#90A9FD"},"primary-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"primary-onBackground-selected":{light:"#FFFFFF",dark:"#000000"},"primary-plain":{light:"#0A449B",dark:"#648EFC"},"primary-plain-hover":{light:"#0A2F6C",dark:"#90A9FD"},"primary-plain-visited":{light:"#7600A3",dark:"#CF5FFF"},"primary-visited":{light:"#9B00D4",dark:"#CF5FFF"},scrim:{light:"#00000099",dark:"#00000099"},"scrim-background":{light:"#00000099",dark:"#00000099"},"scrim-background-strong":{light:"#000000CC",dark:"#000000CC"},"scrim-gradient":{light:"",dark:""},"scrim-strong":{light:"#000000cc",dark:"#000000cc"},secondary:{light:"#21272A",dark:"#DBE4E9"},"secondary-background":{light:"#E5EBEE",dark:"#2A3236"},"secondary-background-hover":{light:"#DBE4E9",dark:"#333D42"},"secondary-background-selected":{light:"#C9D7DE",dark:"#3D494E"},"secondary-hover":{light:"#000000",dark:"#ffffff"},"secondary-onBackground":{light:"#000000",dark:"#FFFFFF"},"secondary-plain":{light:"#181C1F",dark:"#DBE4E9"},"secondary-plain-hover":{light:"#000000",dark:"#FFFFFF"},"secondary-plain-weak":{light:"#5C6C74",dark:"#8BA2AD"},"secondary-weak":{light:"#576F76",dark:"#748791"},"success-background":{light:"#008A10",dark:"#016E0B"},"success-background-hover":{light:"#016E0B",dark:"#008A10"},"success-content":{light:"#016E0B",dark:"#01A816"},"success-hover":{light:"#005306",dark:"#00C61C"},"success-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"success-plain":{light:"#016E0B",dark:"#00C61C"},"success-plain-hover":{light:"#005306",dark:"#58E15B"},"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"},"transparent-background-hover":{light:"#74879119",dark:"#66778019"},"ui-canvas":{light:"#F2F2F2",dark:"#080808"},"ui-modalbackground":{light:"#FFFFFF",dark:"#181C1F"},"upvote-background":{light:"#D93900",dark:"#D93900"},"upvote-background-disabled":{light:"#d939004d",dark:"#d939004d"},"upvote-background-hover":{light:"#AE2C00",dark:"#AE2C00"},"upvote-content":{light:"#AE2C00",dark:"#FF4500"},"upvote-content-weak":{light:"#FF4500",dark:"#FF4500"},"upvote-disabled":{light:"#AE2C004c",dark:"#FF45004c"},"upvote-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"upvote-onStrongScrim":{light:"#FF895D",dark:"#FF895D"},"upvote-onStrongScrim-disabled":{light:"#ff895d4d",dark:"#ff895d4d"},"upvote-onStrongScrim-weaker":{light:"#FF4500",dark:"#FF4500"},"upvote-plain":{light:"#AE2C00",dark:"#FF895D"},"upvote-plain-disabled":{light:"#ae2c004d",dark:"#ff895d4d"},"upvote-plain-weaker":{light:"#FF4500",dark:"#FF4500"},"warning-background":{light:"#B78800",dark:"#B78800"},"warning-background-hover":{light:"#977000",dark:"#D8A100"},"warning-content":{light:"#785800",dark:"#B78800"},"warning-content-hover":{light:"#5B4200",dark:"#D8A100"},"warning-onBackground":{light:"#000000",dark:"#000000"}};var yy={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"},by=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),ky=r=>r in Ic,Fc=r=>r in yy,Sy=r=>!!r.match(/^rgba?\(.*/),Py=r=>!!r.match(/^hsla?\(.*/),Cy=(r,e="light")=>{if(Fc(r))return bd(r);let i=Ic[r];return typeof i=="string"?i:i[e]},bd=r=>yy[r]??r,wy=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),g=Math.round(p*255);a.push(g)}return`#${a.map(p=>p.toString(16).padStart(2,"0")).join("")}`};import{BlockStackDirection as kd}from"@devvit/protos";var xc={stackParentLayout:{hasHeight:!0,hasWidth:!0,direction:kd.UNRECOGNIZED,alignment:void 0}};function Fy(r,e,t){if(!e)return{hasHeight:!1,hasWidth:!1};let{growDirection:i,stretchDirection:n}=CA(r?.grow,e.direction,e.alignment),o=t?.height?.value?.value||t?.height?.min?.value||Iy(2,i,n,e.hasHeight),a=t?.width?.value?.value||t?.width?.min?.value||Iy(1,i,n,e.hasWidth);return{hasHeight:!!o,hasWidth:!!a}}function Iy(r,e,t,i){return e===r&&i||t===r&&i}function CA(r,e,t){let i=e===kd.STACK_VERTICAL||e===kd.UNRECOGNIZED,n=e===kd.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,g=0;return n&&p?g=2:i&&p&&(g=1),{growDirection:o,stretchDirection:g}}import{BlockSizeUnit as br,BlockStackDirection as Sd}from"@devvit/protos";function Ci(r){if(r==null)return;if(typeof r=="number")return{value:r,unit:br.SIZE_UNIT_PERCENT};let e=r.match(/^(\d+(?:\.\d+)?)(px|%)?$/);if(e==null)return;let t=br.SIZE_UNIT_PERCENT;return e.at(2)==="px"&&(t=br.SIZE_UNIT_PIXELS),{value:Number.parseFloat(e[1]),unit:t}}function wA(r,e){return(r.width?.value?.unit===br.SIZE_UNIT_PERCENT||r.width?.min?.unit===br.SIZE_UNIT_PERCENT)&&(e.direction===Sd.STACK_HORIZONTAL||e.direction===Sd.STACK_DEPTH)&&(e.hasWidth||(r.width=void 0)),(r.height?.value?.unit===br.SIZE_UNIT_PERCENT||r.height?.min?.unit===br.SIZE_UNIT_PERCENT)&&(e.direction===Sd.STACK_VERTICAL||e.direction===Sd.STACK_DEPTH)&&(e.hasHeight||(r.height=void 0)),r}function Ac(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:Ci(r.width),min:Ci(r.minWidth),max:Ci(r.maxWidth)}:void 0,height:i?{value:Ci(r.height),min:Ci(r.minHeight),max:Ci(r.maxHeight)}:void 0,grow:r.grow};return e.stackParentLayout&&(n=wA(n,e.stackParentLayout)),n}}}var By="data-",IA=new Set(["onPress","onMessage"]),FA=new Map([["onPress",Dc.ACTION_CLICK],["onMessage",Dc.ACTION_WEBVIEW]]),fs,Fi=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},xc);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 gs.PADDING_NONE;case"xsmall":return gs.PADDING_XSMALL;case"small":return gs.PADDING_SMALL;case"medium":return gs.PADDING_MEDIUM;case"large":return gs.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return hs.RADIUS_NONE;case"small":return hs.RADIUS_SMALL;case"medium":return hs.RADIUS_MEDIUM;case"large":return hs.RADIUS_LARGE;case"full":return hs.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return Cd.GAP_NONE;case"small":return Cd.GAP_SMALL;case"medium":return Cd.GAP_MEDIUM;case"large":return Cd.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=Ec.ALIGN_START:e.includes("center")?i=Ec.ALIGN_CENTER:e.includes("end")&&(i=Ec.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=Pd.BORDER_WIDTH_NONE;break;case"thin":o=Pd.BORDER_WIDTH_THIN;break;case"thick":o=Pd.BORDER_WIDTH_THICK;break;default:o=Pd.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 Ii.TEXT_SIZE_XSMALL;case"small":return Ii.TEXT_SIZE_SMALL;case"medium":return Ii.TEXT_SIZE_MEDIUM;case"large":return Ii.TEXT_SIZE_LARGE;case"xlarge":return Ii.TEXT_SIZE_XLARGE;case"xxlarge":return Ii.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return Uc.TEXT_STYLE_BODY;case"metadata":return Uc.TEXT_STYLE_METADATA;case"heading":return Uc.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return Bc.TEXT_OUTLINE_NONE;case"thin":return Bc.TEXT_OUTLINE_THIN;case"thick":return Bc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return Oy.TEXT_WEIGHT_REGULAR;case"bold":return Oy.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return Mc.TEXT_OVERFLOW_CLIP;case"ellipsis":return Mc.TEXT_OVERFLOW_ELLIPSE}return Mc.TEXT_OVERFLOW_ELLIPSE}makeBlockButtonAppearance(e){switch(e){case"secondary":return Ut.BUTTON_APPEARANCE_SECONDARY;case"primary":return Ut.BUTTON_APPEARANCE_PRIMARY;case"plain":return Ut.BUTTON_APPEARANCE_PLAIN;case"bordered":return Ut.BUTTON_APPEARANCE_BORDERED;case"media":return Ut.BUTTON_APPEARANCE_MEDIA;case"destructive":return Ut.BUTTON_APPEARANCE_DESTRUCTIVE;case"caution":return Ut.BUTTON_APPEARANCE_CAUTION;case"success":return Ut.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 ps.IMAGE_RESIZE_NONE;case"fit":return ps.IMAGE_RESIZE_FIT;case"fill":return ps.IMAGE_RESIZE_FILL;case"cover":return ps.IMAGE_RESIZE_COVER;case"scale-down":return ps.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return Id.SPACER_XSMALL;case"small":return Id.SPACER_SMALL;case"medium":return Id.SPACER_MEDIUM;case"large":return Id.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return Rc.SPACER_INVISIBLE;case"thin":return Rc.SPACER_THIN;case"square":return Rc.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return wd.ICON_SIZE_XSMALL;case"small":return wd.ICON_SIZE_SMALL;case"medium":return wd.ICON_SIZE_MEDIUM;case"large":return wd.ICON_SIZE_LARGE}}makeBlockAvatarSize(e){switch(e){case"xxsmall":return Mt.AVATAR_SIZE_XXSMALL;case"xsmall":return Mt.AVATAR_SIZE_XSMALL;case"small":return Mt.AVATAR_SIZE_SMALL;case"medium":return Mt.AVATAR_SIZE_MEDIUM;case"large":return Mt.AVATAR_SIZE_LARGE;case"xlarge":return Mt.AVATAR_SIZE_XXLARGE;case"xxlarge":return Mt.AVATAR_SIZE_XXLARGE;case"xxxlarge":return Mt.AVATAR_SIZE_XXXLARGE}}makeBlockAvatarFacing(e){switch(e){case"left":return Ry.AVATAR_FACING_LEFT;case"right":return Ry.AVATAR_FACING_RIGHT}}makeBlockFullSnooSize(e){switch(e){case"xsmall":return wi.FULLSNOO_XSMALL;case"small":return wi.FULLSNOO_SMALL;case"medium":return wi.FULLSNOO_MEDIUM;case"large":return wi.FULLSNOO_LARGE;case"xlarge":return wi.FULLSNOO_XLARGE;case"xxlarge":return wi.FULLSNOO_XXLARGE}}makeBlockAvatarBackground(e){switch(e){case"dark":return Ey.AVATAR_BG_DARK;case"light":return Ey.AVATAR_BG_LIGHT}}makeBlockAnimationType(e){return e==="lottie"||e===void 0?Ty.ANIM_LOTTIE:Ty.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 Ay.ANIM_LOOP_REPEAT;case"bounce":return Ay.ANIM_LOOP_BOUNCE}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(By)).reduce((t,i)=>(t[i.substring(By.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);return IA.forEach(o=>{if(o in t){let a=t[o];i.push({type:FA.get(o)??Dc.UNRECOGNIZED,id:a.toString(),data:n})}}),i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),by(e)?e:ky(e)?Cy(e,t):Fc(e)?bd(e):Sy(e)?wy(e):Py(e)?e:(console.warn(`Could not parse color: ${e}.`),bd("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,xc))}wrapRoot(e,t){return this.makeBlock(De.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=Ac(t,i),p=Fy(t,i.stackParentLayout,c);return this.makeBlock(De.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(Oc.STACK_HORIZONTAL,e,t,i)}makeVStack(e,t,...i){return this.makeStackBlock(Oc.STACK_VERTICAL,e,t,i)}makeZStack(e,t,...i){return this.makeStackBlock(Oc.STACK_DEPTH,e,t,i)}makeText(e,t,...i){let n=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(De.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(De.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(De.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(De.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(De.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(De.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(De.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(De.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(De.BLOCK_WEBVIEW,e,t,{webviewConfig:{url:this.resolveAssetUrl(e.url,{webview:!0}),state:e.state}})}makeBlock(e,t,i,n){return{type:e,sizes:Ac(t,i),config:n,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}ensureRootBlock(e){let t;if(e.type===De.BLOCK_ROOT?(e.config?.rootConfig&&u.customPostType?.height&&(e.config.rootConfig.height=this.makeRootHeight(u.customPostType?.height)),t=e):t=this.wrapRoot(void 0,[e]),!t)throw new Error("Could not create root block");return t}};fs=new WeakMap;function Uy(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var Ly=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+=Ly(i);return e+=`</${r.type}>`,e};function xA(r){return" ".repeat(r)}function AA(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+=xA(t),n!==0&&(e+="<"),e+=o,n!==i.length-1&&(e+=`>
1
+ var AS=Object.create;var Nm=Object.defineProperty;var TS=Object.getOwnPropertyDescriptor;var ES=Object.getOwnPropertyNames;var RS=Object.getPrototypeOf,OS=Object.prototype.hasOwnProperty;var _m=r=>{throw TypeError(r)};var f=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var BS=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ES(e))!OS.call(r,n)&&n!==t&&Nm(r,n,{get:()=>e[n],enumerable:!(i=TS(e,n))||i.enumerable});return r};var qn=(r,e,t)=>(t=r!=null?AS(RS(r)):{},BS(e||!r||!r.__esModule?Nm(t,"default",{value:r,enumerable:!0}):t,r));var fl=(r,e,t)=>e.has(r)||_m("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)?_m("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 ae=f((lO,qm)=>{qm.exports=function(r){try{return!!r()}catch{return!0}}});var Sa=f((uO,Hm)=>{var MS=ae();Hm.exports=!MS(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Z=f((cO,Gm)=>{var jm=Sa(),Wm=Function.prototype,vl=Wm.call,US=jm&&Wm.bind.bind(vl,vl);Gm.exports=jm?US:function(r){return function(){return vl.apply(r,arguments)}}});var zm=f((mO,Vm)=>{var LS=Math.ceil,DS=Math.floor;Vm.exports=Math.trunc||function(e){var t=+e;return(t>0?DS:LS)(t)}});var Pa=f((pO,Jm)=>{var NS=zm();Jm.exports=function(r){var e=+r;return e!==e||e===0?0:NS(e)}});var pe=f((gO,$m)=>{var Ca=function(r){return r&&r.Math==Math&&r};$m.exports=Ca(typeof globalThis=="object"&&globalThis)||Ca(typeof window=="object"&&window)||Ca(typeof self=="object"&&self)||Ca(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var Gr=f((hO,Km)=>{Km.exports=!1});var wa=f((fO,Zm)=>{var Xm=pe(),_S=Object.defineProperty;Zm.exports=function(r,e){try{_S(Xm,r,{value:e,configurable:!0,writable:!0})}catch{Xm[r]=e}return e}});var Ia=f((vO,Qm)=>{var qS=pe(),HS=wa(),Ym="__core-js_shared__",jS=qS[Ym]||HS(Ym,{});Qm.exports=jS});var yl=f((yO,tp)=>{var WS=Gr(),ep=Ia();(tp.exports=function(r,e){return ep[r]||(ep[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:WS?"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 Fa=f((bO,rp)=>{rp.exports=function(r){return r==null}});var xa=f((kO,ip)=>{var GS=Fa(),VS=TypeError;ip.exports=function(r){if(GS(r))throw VS("Can't call method on "+r);return r}});var Hn=f((SO,np)=>{var zS=xa(),JS=Object;np.exports=function(r){return JS(zS(r))}});var we=f((PO,sp)=>{var $S=Z(),KS=Hn(),XS=$S({}.hasOwnProperty);sp.exports=Object.hasOwn||function(e,t){return XS(KS(e),t)}});var bl=f((CO,op)=>{var ZS=Z(),YS=0,QS=Math.random(),eP=ZS(1 .toString);op.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+eP(++YS+QS,36)}});var dp=f((wO,ap)=>{ap.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var hp=f((IO,gp)=>{var pp=pe(),kl=dp(),lp=pp.process,up=pp.Deno,cp=lp&&lp.versions||up&&up.version,mp=cp&&cp.v8,We,Aa;mp&&(We=mp.split("."),Aa=We[0]>0&&We[0]<4?1:+(We[0]+We[1]));!Aa&&kl&&(We=kl.match(/Edge\/(\d+)/),(!We||We[1]>=74)&&(We=kl.match(/Chrome\/(\d+)/),We&&(Aa=+We[1])));gp.exports=Aa});var Sl=f((FO,vp)=>{var fp=hp(),tP=ae();vp.exports=!!Object.getOwnPropertySymbols&&!tP(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&fp&&fp<41})});var Pl=f((xO,yp)=>{var rP=Sl();yp.exports=rP&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ie=f((AO,kp)=>{var iP=pe(),nP=yl(),bp=we(),sP=bl(),oP=Sl(),aP=Pl(),Vr=iP.Symbol,Cl=nP("wks"),dP=aP?Vr.for||Vr:Vr&&Vr.withoutSetter||sP;kp.exports=function(r){return bp(Cl,r)||(Cl[r]=oP&&bp(Vr,r)?Vr[r]:dP("Symbol."+r)),Cl[r]}});var Cp=f((TO,Pp)=>{var lP=Ie(),uP=lP("toStringTag"),Sp={};Sp[uP]="z";Pp.exports=String(Sp)==="[object z]"});var Il=f((EO,wp)=>{var wl=typeof document=="object"&&document.all,cP=typeof wl>"u"&&wl!==void 0;wp.exports={all:wl,IS_HTMLDDA:cP}});var Y=f((RO,Fp)=>{var Ip=Il(),mP=Ip.all;Fp.exports=Ip.IS_HTMLDDA?function(r){return typeof r=="function"||r===mP}:function(r){return typeof r=="function"}});var Ta=f((OO,Ap)=>{var xp=Z(),pP=xp({}.toString),gP=xp("".slice);Ap.exports=function(r){return gP(pP(r),8,-1)}});var jn=f((BO,Tp)=>{var hP=Cp(),fP=Y(),Ea=Ta(),vP=Ie(),yP=vP("toStringTag"),bP=Object,kP=Ea(function(){return arguments}())=="Arguments",SP=function(r,e){try{return r[e]}catch{}};Tp.exports=hP?Ea:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=SP(e=bP(r),yP))=="string"?t:kP?Ea(e):(i=Ea(e))=="Object"&&fP(e.callee)?"Arguments":i}});var Wn=f((MO,Ep)=>{var PP=jn(),CP=String;Ep.exports=function(r){if(PP(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return CP(r)}});var xl=f((UO,Bp)=>{var Fl=Z(),wP=Pa(),IP=Wn(),FP=xa(),xP=Fl("".charAt),Rp=Fl("".charCodeAt),AP=Fl("".slice),Op=function(r){return function(e,t){var i=IP(FP(e)),n=wP(t),o=i.length,a,c;return n<0||n>=o?r?"":void 0:(a=Rp(i,n),a<55296||a>56319||n+1===o||(c=Rp(i,n+1))<56320||c>57343?r?xP(i,n):a:r?AP(i,n,n+2):(a-55296<<10)+(c-56320)+65536)}};Bp.exports={codeAt:Op(!1),charAt:Op(!0)}});var Lp=f((LO,Up)=>{var TP=pe(),EP=Y(),Mp=TP.WeakMap;Up.exports=EP(Mp)&&/native code/.test(String(Mp))});var wt=f((DO,_p)=>{var Dp=Y(),Np=Il(),RP=Np.all;_p.exports=Np.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:Dp(r)||r===RP}:function(r){return typeof r=="object"?r!==null:Dp(r)}});var ge=f((NO,qp)=>{var OP=ae();qp.exports=!OP(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var Tl=f((_O,jp)=>{var BP=pe(),Hp=wt(),Al=BP.document,MP=Hp(Al)&&Hp(Al.createElement);jp.exports=function(r){return MP?Al.createElement(r):{}}});var El=f((qO,Wp)=>{var UP=ge(),LP=ae(),DP=Tl();Wp.exports=!UP&&!LP(function(){return Object.defineProperty(DP("div"),"a",{get:function(){return 7}}).a!=7})});var Rl=f((HO,Gp)=>{var NP=ge(),_P=ae();Gp.exports=NP&&_P(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Qe=f((jO,Vp)=>{var qP=wt(),HP=String,jP=TypeError;Vp.exports=function(r){if(qP(r))return r;throw jP(HP(r)+" is not an object")}});var Ge=f((WO,zp)=>{var WP=Sa(),Ra=Function.prototype.call;zp.exports=WP?Ra.bind(Ra):function(){return Ra.apply(Ra,arguments)}});var Gn=f((GO,Jp)=>{var Ol=pe(),GP=Y(),VP=function(r){return GP(r)?r:void 0};Jp.exports=function(r,e){return arguments.length<2?VP(Ol[r]):Ol[r]&&Ol[r][e]}});var Bl=f((VO,$p)=>{var zP=Z();$p.exports=zP({}.isPrototypeOf)});var Ml=f((zO,Kp)=>{var JP=Gn(),$P=Y(),KP=Bl(),XP=Pl(),ZP=Object;Kp.exports=XP?function(r){return typeof r=="symbol"}:function(r){var e=JP("Symbol");return $P(e)&&KP(e.prototype,ZP(r))}});var Ul=f((JO,Xp)=>{var YP=String;Xp.exports=function(r){try{return YP(r)}catch{return"Object"}}});var Oa=f(($O,Zp)=>{var QP=Y(),eC=Ul(),tC=TypeError;Zp.exports=function(r){if(QP(r))return r;throw tC(eC(r)+" is not a function")}});var Ba=f((KO,Yp)=>{var rC=Oa(),iC=Fa();Yp.exports=function(r,e){var t=r[e];return iC(t)?void 0:rC(t)}});var eg=f((XO,Qp)=>{var Ll=Ge(),Dl=Y(),Nl=wt(),nC=TypeError;Qp.exports=function(r,e){var t,i;if(e==="string"&&Dl(t=r.toString)&&!Nl(i=Ll(t,r))||Dl(t=r.valueOf)&&!Nl(i=Ll(t,r))||e!=="string"&&Dl(t=r.toString)&&!Nl(i=Ll(t,r)))return i;throw nC("Can't convert object to primitive value")}});var ng=f((ZO,ig)=>{var sC=Ge(),tg=wt(),rg=Ml(),oC=Ba(),aC=eg(),dC=Ie(),lC=TypeError,uC=dC("toPrimitive");ig.exports=function(r,e){if(!tg(r)||rg(r))return r;var t=oC(r,uC),i;if(t){if(e===void 0&&(e="default"),i=sC(t,r,e),!tg(i)||rg(i))return i;throw lC("Can't convert object to primitive value")}return e===void 0&&(e="number"),aC(r,e)}});var Ma=f((YO,sg)=>{var cC=ng(),mC=Ml();sg.exports=function(r){var e=cC(r,"string");return mC(e)?e:e+""}});var et=f(ag=>{var pC=ge(),gC=El(),hC=Rl(),Ua=Qe(),og=Ma(),fC=TypeError,_l=Object.defineProperty,vC=Object.getOwnPropertyDescriptor,ql="enumerable",Hl="configurable",jl="writable";ag.f=pC?hC?function(e,t,i){if(Ua(e),t=og(t),Ua(i),typeof e=="function"&&t==="prototype"&&"value"in i&&jl in i&&!i[jl]){var n=vC(e,t);n&&n[jl]&&(e[t]=i.value,i={configurable:Hl in i?i[Hl]:n[Hl],enumerable:ql in i?i[ql]:n[ql],writable:!1})}return _l(e,t,i)}:_l:function(e,t,i){if(Ua(e),t=og(t),Ua(i),gC)try{return _l(e,t,i)}catch{}if("get"in i||"set"in i)throw fC("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var zr=f((eB,dg)=>{dg.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var La=f((tB,lg)=>{var yC=ge(),bC=et(),kC=zr();lg.exports=yC?function(r,e,t){return bC.f(r,e,kC(1,t))}:function(r,e,t){return r[e]=t,r}});var Da=f((rB,cg)=>{var SC=yl(),PC=bl(),ug=SC("keys");cg.exports=function(r){return ug[r]||(ug[r]=PC(r))}});var Na=f((iB,mg)=>{mg.exports={}});var Jr=f((nB,hg)=>{var CC=Lp(),gg=pe(),wC=wt(),IC=La(),Wl=we(),Gl=Ia(),FC=Da(),xC=Na(),pg="Object already initialized",Vl=gg.TypeError,AC=gg.WeakMap,_a,Vn,qa,TC=function(r){return qa(r)?Vn(r):_a(r,{})},EC=function(r){return function(e){var t;if(!wC(e)||(t=Vn(e)).type!==r)throw Vl("Incompatible receiver, "+r+" required");return t}};CC||Gl.state?(Ve=Gl.state||(Gl.state=new AC),Ve.get=Ve.get,Ve.has=Ve.has,Ve.set=Ve.set,_a=function(r,e){if(Ve.has(r))throw Vl(pg);return e.facade=r,Ve.set(r,e),e},Vn=function(r){return Ve.get(r)||{}},qa=function(r){return Ve.has(r)}):(or=FC("state"),xC[or]=!0,_a=function(r,e){if(Wl(r,or))throw Vl(pg);return e.facade=r,IC(r,or,e),e},Vn=function(r){return Wl(r,or)?r[or]:{}},qa=function(r){return Wl(r,or)});var Ve,or;hg.exports={set:_a,get:Vn,has:qa,enforce:TC,getterFor:EC}});var zl=f(yg=>{"use strict";var fg={}.propertyIsEnumerable,vg=Object.getOwnPropertyDescriptor,RC=vg&&!fg.call({1:2},1);yg.f=RC?function(e){var t=vg(this,e);return!!t&&t.enumerable}:fg});var $l=f((oB,bg)=>{var OC=Z(),BC=ae(),MC=Ta(),Jl=Object,UC=OC("".split);bg.exports=BC(function(){return!Jl("z").propertyIsEnumerable(0)})?function(r){return MC(r)=="String"?UC(r,""):Jl(r)}:Jl});var $r=f((aB,kg)=>{var LC=$l(),DC=xa();kg.exports=function(r){return LC(DC(r))}});var Kl=f(Pg=>{var NC=ge(),_C=Ge(),qC=zl(),HC=zr(),jC=$r(),WC=Ma(),GC=we(),VC=El(),Sg=Object.getOwnPropertyDescriptor;Pg.f=NC?Sg:function(e,t){if(e=jC(e),t=WC(t),VC)try{return Sg(e,t)}catch{}if(GC(e,t))return HC(!_C(qC.f,e,t),e[t])}});var Yl=f((lB,wg)=>{var Xl=ge(),zC=we(),Cg=Function.prototype,JC=Xl&&Object.getOwnPropertyDescriptor,Zl=zC(Cg,"name"),$C=Zl&&function(){}.name==="something",KC=Zl&&(!Xl||Xl&&JC(Cg,"name").configurable);wg.exports={EXISTS:Zl,PROPER:$C,CONFIGURABLE:KC}});var eu=f((uB,Ig)=>{var XC=Z(),ZC=Y(),Ql=Ia(),YC=XC(Function.toString);ZC(Ql.inspectSource)||(Ql.inspectSource=function(r){return YC(r)});Ig.exports=Ql.inspectSource});var iu=f((cB,Ag)=>{var ru=Z(),QC=ae(),e0=Y(),Ha=we(),tu=ge(),t0=Yl().CONFIGURABLE,r0=eu(),xg=Jr(),i0=xg.enforce,n0=xg.get,Fg=String,ja=Object.defineProperty,s0=ru("".slice),o0=ru("".replace),a0=ru([].join),d0=tu&&!QC(function(){return ja(function(){},"length",{value:8}).length!==8}),l0=String(String).split("String"),u0=Ag.exports=function(r,e,t){s0(Fg(e),0,7)==="Symbol("&&(e="["+o0(Fg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Ha(r,"name")||t0&&r.name!==e)&&(tu?ja(r,"name",{value:e,configurable:!0}):r.name=e),d0&&t&&Ha(t,"arity")&&r.length!==t.arity&&ja(r,"length",{value:t.arity});try{t&&Ha(t,"constructor")&&t.constructor?tu&&ja(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=i0(r);return Ha(i,"source")||(i.source=a0(l0,typeof e=="string"?e:"")),r};Function.prototype.toString=u0(function(){return e0(this)&&n0(this).source||r0(this)},"toString")});var ar=f((mB,Tg)=>{var c0=Y(),m0=et(),p0=iu(),g0=wa();Tg.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(c0(t)&&p0(t,o,i),i.global)n?r[e]=t:g0(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:m0.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var nu=f((pB,Eg)=>{var h0=Pa(),f0=Math.max,v0=Math.min;Eg.exports=function(r,e){var t=h0(r);return t<0?f0(t+e,0):v0(t,e)}});var Og=f((gB,Rg)=>{var y0=Pa(),b0=Math.min;Rg.exports=function(r){return r>0?b0(y0(r),9007199254740991):0}});var Wa=f((hB,Bg)=>{var k0=Og();Bg.exports=function(r){return k0(r.length)}});var Lg=f((fB,Ug)=>{var S0=$r(),P0=nu(),C0=Wa(),Mg=function(r){return function(e,t,i){var n=S0(e),o=C0(n),a=P0(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}};Ug.exports={includes:Mg(!0),indexOf:Mg(!1)}});var ou=f((vB,Ng)=>{var w0=Z(),su=we(),I0=$r(),F0=Lg().indexOf,x0=Na(),Dg=w0([].push);Ng.exports=function(r,e){var t=I0(r),i=0,n=[],o;for(o in t)!su(x0,o)&&su(t,o)&&Dg(n,o);for(;e.length>i;)su(t,o=e[i++])&&(~F0(n,o)||Dg(n,o));return n}});var Ga=f((yB,_g)=>{_g.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Hg=f(qg=>{var A0=ou(),T0=Ga(),E0=T0.concat("length","prototype");qg.f=Object.getOwnPropertyNames||function(e){return A0(e,E0)}});var au=f(jg=>{jg.f=Object.getOwnPropertySymbols});var Gg=f((SB,Wg)=>{var R0=Gn(),O0=Z(),B0=Hg(),M0=au(),U0=Qe(),L0=O0([].concat);Wg.exports=R0("Reflect","ownKeys")||function(e){var t=B0.f(U0(e)),i=M0.f;return i?L0(t,i(e)):t}});var Jg=f((PB,zg)=>{var Vg=we(),D0=Gg(),N0=Kl(),_0=et();zg.exports=function(r,e,t){for(var i=D0(e),n=_0.f,o=N0.f,a=0;a<i.length;a++){var c=i[a];!Vg(r,c)&&!(t&&Vg(t,c))&&n(r,c,o(e,c))}}});var Kg=f((CB,$g)=>{var q0=ae(),H0=Y(),j0=/#|\.prototype\./,zn=function(r,e){var t=G0[W0(r)];return t==z0?!0:t==V0?!1:H0(e)?q0(e):!!e},W0=zn.normalize=function(r){return String(r).replace(j0,".").toLowerCase()},G0=zn.data={},V0=zn.NATIVE="N",z0=zn.POLYFILL="P";$g.exports=zn});var Jn=f((wB,Xg)=>{var du=pe(),J0=Kl().f,$0=La(),K0=ar(),X0=wa(),Z0=Jg(),Y0=Kg();Xg.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,c,p,g,v;if(i?a=du:n?a=du[t]||X0(t,{}):a=(du[t]||{}).prototype,a)for(c in e){if(g=e[c],r.dontCallGetSet?(v=J0(a,c),p=v&&v.value):p=a[c],o=Y0(i?c:t+(n?".":"#")+c,r.forced),!o&&p!==void 0){if(typeof g==typeof p)continue;Z0(g,p)}(r.sham||p&&p.sham)&&$0(g,"sham",!0),K0(a,c,g,r)}}});var lu=f((IB,Zg)=>{var Q0=ou(),ew=Ga();Zg.exports=Object.keys||function(e){return Q0(e,ew)}});var Qg=f(Yg=>{var tw=ge(),rw=Rl(),iw=et(),nw=Qe(),sw=$r(),ow=lu();Yg.f=tw&&!rw?Object.defineProperties:function(e,t){nw(e);for(var i=sw(t),n=ow(t),o=n.length,a=0,c;o>a;)iw.f(e,c=n[a++],i[c]);return e}});var th=f((xB,eh)=>{var aw=Gn();eh.exports=aw("document","documentElement")});var $n=f((AB,dh)=>{var dw=Qe(),lw=Qg(),rh=Ga(),uw=Na(),cw=th(),mw=Tl(),pw=Da(),ih=">",nh="<",cu="prototype",mu="script",oh=pw("IE_PROTO"),uu=function(){},ah=function(r){return nh+mu+ih+r+nh+"/"+mu+ih},sh=function(r){r.write(ah("")),r.close();var e=r.parentWindow.Object;return r=null,e},gw=function(){var r=mw("iframe"),e="java"+mu+":",t;return r.style.display="none",cw.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(ah("document.F=Object")),t.close(),t.F},Va,za=function(){try{Va=new ActiveXObject("htmlfile")}catch{}za=typeof document<"u"?document.domain&&Va?sh(Va):gw():sh(Va);for(var r=rh.length;r--;)delete za[cu][rh[r]];return za()};uw[oh]=!0;dh.exports=Object.create||function(e,t){var i;return e!==null?(uu[cu]=dw(e),i=new uu,uu[cu]=null,i[oh]=e):i=za(),t===void 0?i:lw.f(i,t)}});var uh=f((TB,lh)=>{var hw=ae();lh.exports=!hw(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var gu=f((EB,mh)=>{var fw=we(),vw=Y(),yw=Hn(),bw=Da(),kw=uh(),ch=bw("IE_PROTO"),pu=Object,Sw=pu.prototype;mh.exports=kw?pu.getPrototypeOf:function(r){var e=yw(r);if(fw(e,ch))return e[ch];var t=e.constructor;return vw(t)&&e instanceof t?t.prototype:e instanceof pu?Sw:null}});var yu=f((RB,hh)=>{"use strict";var Pw=ae(),Cw=Y(),ww=wt(),Iw=$n(),ph=gu(),Fw=ar(),xw=Ie(),Aw=Gr(),vu=xw("iterator"),gh=!1,ut,hu,fu;[].keys&&(fu=[].keys(),"next"in fu?(hu=ph(ph(fu)),hu!==Object.prototype&&(ut=hu)):gh=!0);var Tw=!ww(ut)||Pw(function(){var r={};return ut[vu].call(r)!==r});Tw?ut={}:Aw&&(ut=Iw(ut));Cw(ut[vu])||Fw(ut,vu,function(){return this});hh.exports={IteratorPrototype:ut,BUGGY_SAFARI_ITERATORS:gh}});var Kn=f((OB,vh)=>{var Ew=et().f,Rw=we(),Ow=Ie(),fh=Ow("toStringTag");vh.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!Rw(r,fh)&&Ew(r,fh,{configurable:!0,value:e})}});var Kr=f((BB,yh)=>{yh.exports={}});var bu=f((MB,bh)=>{"use strict";var Bw=yu().IteratorPrototype,Mw=$n(),Uw=zr(),Lw=Kn(),Dw=Kr(),Nw=function(){return this};bh.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=Mw(Bw,{next:Uw(+!i,t)}),Lw(r,n,!1,!0),Dw[n]=Nw,r}});var Sh=f((UB,kh)=>{var _w=Y(),qw=String,Hw=TypeError;kh.exports=function(r){if(typeof r=="object"||_w(r))return r;throw Hw("Can't set "+qw(r)+" as a prototype")}});var Ch=f((LB,Ph)=>{var jw=Z(),Ww=Qe(),Gw=Sh();Ph.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=jw(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return Ww(n),Gw(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var Su=f((DB,Bh)=>{"use strict";var Vw=Jn(),zw=Ge(),Ja=Gr(),Rh=Yl(),Jw=Y(),$w=bu(),wh=gu(),Ih=Ch(),Kw=Kn(),Xw=La(),ku=ar(),Zw=Ie(),Fh=Kr(),Oh=yu(),Yw=Rh.PROPER,Qw=Rh.CONFIGURABLE,xh=Oh.IteratorPrototype,$a=Oh.BUGGY_SAFARI_ITERATORS,Xn=Zw("iterator"),Ah="keys",Zn="values",Th="entries",Eh=function(){return this};Bh.exports=function(r,e,t,i,n,o,a){$w(t,e,i);var c=function(B){if(B===n&&b)return b;if(!$a&&B in v)return v[B];switch(B){case Ah:return function(){return new t(this,B)};case Zn:return function(){return new t(this,B)};case Th:return function(){return new t(this,B)}}return function(){return new t(this)}},p=e+" Iterator",g=!1,v=r.prototype,m=v[Xn]||v["@@iterator"]||n&&v[n],b=!$a&&m||c(n),y=e=="Array"&&v.entries||m,C,w,A;if(y&&(C=wh(y.call(new r)),C!==Object.prototype&&C.next&&(!Ja&&wh(C)!==xh&&(Ih?Ih(C,xh):Jw(C[Xn])||ku(C,Xn,Eh)),Kw(C,p,!0,!0),Ja&&(Fh[p]=Eh))),Yw&&n==Zn&&m&&m.name!==Zn&&(!Ja&&Qw?Xw(v,"name",Zn):(g=!0,b=function(){return zw(m,this)})),n)if(w={values:c(Zn),keys:o?b:c(Ah),entries:c(Th)},a)for(A in w)($a||g||!(A in v))&&ku(v,A,w[A]);else Vw({target:e,proto:!0,forced:$a||g},w);return(!Ja||a)&&v[Xn]!==b&&ku(v,Xn,b,{name:n}),Fh[e]=b,w}});var Pu=f((NB,Mh)=>{Mh.exports=function(r,e){return{value:r,done:e}}});var Nh=f(()=>{"use strict";var eI=xl().charAt,tI=Wn(),Lh=Jr(),rI=Su(),Uh=Pu(),Dh="String Iterator",iI=Lh.set,nI=Lh.getterFor(Dh);rI(String,"String",function(r){iI(this,{type:Dh,string:tI(r),index:0})},function(){var e=nI(this),t=e.string,i=e.index,n;return i>=t.length?Uh(void 0,!0):(n=eI(t,i),e.index+=n.length,Uh(n,!1))})});var Cu=f((HB,_h)=>{var sI=ae(),oI=Ie(),aI=Gr(),dI=oI("iterator");_h.exports=!sI(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}),aI&&!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[dI]||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 Hh=f((jB,qh)=>{var lI=Ta(),uI=Z();qh.exports=function(r){if(lI(r)==="Function")return uI(r)}});var Ka=f((WB,Wh)=>{var jh=Hh(),cI=Oa(),mI=Sa(),pI=jh(jh.bind);Wh.exports=function(r,e){return cI(r),e===void 0?r:mI?pI(r,e):function(){return r.apply(e,arguments)}}});var zh=f((GB,Vh)=>{var Gh=iu(),gI=et();Vh.exports=function(r,e,t){return t.get&&Gh(t.get,e,{getter:!0}),t.set&&Gh(t.set,e,{setter:!0}),gI.f(r,e,t)}});var wu=f((VB,Jh)=>{var hI=Bl(),fI=TypeError;Jh.exports=function(r,e){if(hI(e,r))return r;throw fI("Incorrect invocation")}});var Zh=f((zB,Xh)=>{"use strict";var $h=ge(),vI=Z(),yI=Ge(),bI=ae(),Iu=lu(),kI=au(),SI=zl(),PI=Hn(),CI=$l(),Xr=Object.assign,Kh=Object.defineProperty,wI=vI([].concat);Xh.exports=!Xr||bI(function(){if($h&&Xr({b:1},Xr(Kh({},"a",{enumerable:!0,get:function(){Kh(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}),Xr({},r)[t]!=7||Iu(Xr({},e)).join("")!=i})?function(e,t){for(var i=PI(e),n=arguments.length,o=1,a=kI.f,c=SI.f;n>o;)for(var p=CI(arguments[o++]),g=a?wI(Iu(p),a(p)):Iu(p),v=g.length,m=0,b;v>m;)b=g[m++],(!$h||yI(c,p,b))&&(i[b]=p[b]);return i}:Xr});var ef=f((JB,Qh)=>{var II=Ge(),Yh=Qe(),FI=Ba();Qh.exports=function(r,e,t){var i,n;Yh(r);try{if(i=FI(r,"return"),!i){if(e==="throw")throw t;return t}i=II(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Yh(i),t}});var rf=f(($B,tf)=>{var xI=Qe(),AI=ef();tf.exports=function(r,e,t,i){try{return i?e(xI(t)[0],t[1]):e(t)}catch(n){AI(r,"throw",n)}}});var sf=f((KB,nf)=>{var TI=Ie(),EI=Kr(),RI=TI("iterator"),OI=Array.prototype;nf.exports=function(r){return r!==void 0&&(EI.Array===r||OI[RI]===r)}});var cf=f((XB,uf)=>{var BI=Z(),MI=ae(),of=Y(),UI=jn(),LI=Gn(),DI=eu(),af=function(){},NI=[],df=LI("Reflect","construct"),Fu=/^\s*(?:class|function)\b/,_I=BI(Fu.exec),qI=!Fu.exec(af),Yn=function(e){if(!of(e))return!1;try{return df(af,NI,e),!0}catch{return!1}},lf=function(e){if(!of(e))return!1;switch(UI(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return qI||!!_I(Fu,DI(e))}catch{return!0}};lf.sham=!0;uf.exports=!df||MI(function(){var r;return Yn(Yn.call)||!Yn(Object)||!Yn(function(){r=!0})||r})?lf:Yn});var xu=f((ZB,mf)=>{"use strict";var HI=Ma(),jI=et(),WI=zr();mf.exports=function(r,e,t){var i=HI(e);i in r?jI.f(r,i,WI(0,t)):r[i]=t}});var Xa=f((YB,gf)=>{var GI=jn(),pf=Ba(),VI=Fa(),zI=Kr(),JI=Ie(),$I=JI("iterator");gf.exports=function(r){if(!VI(r))return pf(r,$I)||pf(r,"@@iterator")||zI[GI(r)]}});var Au=f((QB,hf)=>{var KI=Ge(),XI=Oa(),ZI=Qe(),YI=Ul(),QI=Xa(),eF=TypeError;hf.exports=function(r,e){var t=arguments.length<2?QI(r):e;if(XI(t))return ZI(KI(t,r));throw eF(YI(r)+" is not iterable")}});var bf=f((eM,yf)=>{"use strict";var tF=Ka(),rF=Ge(),iF=Hn(),nF=rf(),sF=sf(),oF=cf(),aF=Wa(),ff=xu(),dF=Au(),lF=Xa(),vf=Array;yf.exports=function(e){var t=iF(e),i=oF(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=tF(o,n>2?arguments[2]:void 0));var c=lF(t),p=0,g,v,m,b,y,C;if(c&&!(this===vf&&sF(c)))for(b=dF(t,c),y=b.next,v=i?new this:[];!(m=rF(y,b)).done;p++)C=a?nF(b,o,[m.value,p],!0):m.value,ff(v,p,C);else for(g=aF(t),v=i?new this(g):vf(g);g>p;p++)C=a?o(t[p],p):t[p],ff(v,p,C);return v.length=p,v}});var Tu=f((tM,Sf)=>{var kf=nu(),uF=Wa(),cF=xu(),mF=Array,pF=Math.max;Sf.exports=function(r,e,t){for(var i=uF(r),n=kf(e,i),o=kf(t===void 0?i:t,i),a=mF(pF(o-n,0)),c=0;n<o;n++,c++)cF(a,c,r[n]);return a.length=c,a}});var Ef=f((rM,Tf)=>{var dr=Z(),Eu=2147483647,Qn=36,Ff=1,Bu=26,gF=38,hF=700,fF=72,vF=128,yF="-",bF=/[^\0-\u007E]/,xf=/[.\u3002\uFF0E\uFF61]/g,Pf="Overflow: input needs wider integers to process",Ru=Qn-Ff,Cf=RangeError,kF=dr(xf.exec),Zr=Math.floor,Ou=String.fromCharCode,wf=dr("".charCodeAt),Af=dr([].join),It=dr([].push),SF=dr("".replace),PF=dr("".split),CF=dr("".toLowerCase),wF=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=wf(r,t++);if(n>=55296&&n<=56319&&t<i){var o=wf(r,t++);(o&64512)==56320?It(e,((n&1023)<<10)+(o&1023)+65536):(It(e,n),t--)}else It(e,n)}return e},If=function(r){return r+22+75*(r<26)},IF=function(r,e,t){var i=0;for(r=t?Zr(r/hF):r>>1,r+=Zr(r/e);r>Ru*Bu>>1;)r=Zr(r/Ru),i+=Qn;return Zr(i+(Ru+1)*r/(r+gF))},FF=function(r){var e=[];r=wF(r);var t=r.length,i=vF,n=0,o=fF,a,c;for(a=0;a<r.length;a++)c=r[a],c<128&&It(e,Ou(c));var p=e.length,g=p;for(p&&It(e,yF);g<t;){var v=Eu;for(a=0;a<r.length;a++)c=r[a],c>=i&&c<v&&(v=c);var m=g+1;if(v-i>Zr((Eu-n)/m))throw Cf(Pf);for(n+=(v-i)*m,i=v,a=0;a<r.length;a++){if(c=r[a],c<i&&++n>Eu)throw Cf(Pf);if(c==i){for(var b=n,y=Qn;;){var C=y<=o?Ff:y>=o+Bu?Bu:y-o;if(b<C)break;var w=b-C,A=Qn-C;It(e,Ou(If(C+w%A))),b=Zr(w/A),y+=Qn}It(e,Ou(If(b))),o=IF(n,m,g==p),n=0,g++}}n++,i++}return Af(e,"")};Tf.exports=function(r){var e=[],t=PF(SF(CF(r),xf,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],It(e,kF(bF,n)?"xn--"+FF(n):n);return Af(e,".")}});var Mu=f((iM,Rf)=>{var xF=TypeError;Rf.exports=function(r,e){if(r<e)throw xF("Not enough arguments");return r}});var Bf=f((nM,Of)=>{var AF=Ie(),TF=$n(),EF=et().f,Uu=AF("unscopables"),Lu=Array.prototype;Lu[Uu]==null&&EF(Lu,Uu,{configurable:!0,value:TF(null)});Of.exports=function(r){Lu[Uu][r]=!0}});var _f=f((sM,Nf)=>{"use strict";var RF=$r(),Du=Bf(),Mf=Kr(),Lf=Jr(),OF=et().f,BF=Su(),Za=Pu(),MF=Gr(),UF=ge(),Df="Array Iterator",LF=Lf.set,DF=Lf.getterFor(Df);Nf.exports=BF(Array,"Array",function(r,e){LF(this,{type:Df,target:RF(r),index:0,kind:e})},function(){var r=DF(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,Za(void 0,!0)):t=="keys"?Za(i,!1):t=="values"?Za(e[i],!1):Za([i,e[i]],!1)},"values");var Uf=Mf.Arguments=Mf.Array;Du("keys");Du("values");Du("entries");if(!MF&&UF&&Uf.name!=="values")try{OF(Uf,"name",{value:"values"})}catch{}});var Hf=f((oM,qf)=>{var NF=ar();qf.exports=function(r,e,t){for(var i in e)NF(r,i,e[i],t);return r}});var Gf=f((aM,Wf)=>{var jf=Tu(),_F=Math.floor,Nu=function(r,e){var t=r.length,i=_F(t/2);return t<8?qF(r,e):HF(r,Nu(jf(r,0,i),e),Nu(jf(r,i),e),e)},qF=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},HF=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};Wf.exports=Nu});var $u=f((dM,uv)=>{"use strict";_f();var Wu=Jn(),Qr=pe(),Ya=Ge(),tt=Z(),jF=ge(),rv=Cu(),iv=ar(),WF=Hf(),GF=Kn(),VF=bu(),zu=Jr(),nv=wu(),_u=Y(),zF=we(),JF=Ka(),$F=jn(),KF=Qe(),sv=wt(),he=Wn(),XF=$n(),Vf=zr(),Gu=Au(),ZF=Xa(),Yr=Mu(),YF=Ie(),QF=Gf(),ex=YF("iterator"),rs="URLSearchParams",ov=rs+"Iterator",av=zu.set,ze=zu.getterFor(rs),tx=zu.getterFor(ov),rx=Object.getOwnPropertyDescriptor,Ju=function(r){if(!jF)return Qr[r];var e=rx(Qr,r);return e&&e.value},zf=Ju("fetch"),ed=Ju("Request"),es=Ju("Headers"),qu=ed&&ed.prototype,Jf=es&&es.prototype,ix=Qr.RegExp,nx=Qr.TypeError,dv=Qr.decodeURIComponent,sx=Qr.encodeURIComponent,ox=tt("".charAt),$f=tt([].join),lr=tt([].push),Vu=tt("".replace),ax=tt([].shift),Kf=tt([].splice),Xf=tt("".split),dx=tt("".slice),lx=/\+/g,Zf=Array(4),ux=function(r){return Zf[r-1]||(Zf[r-1]=ix("((?:%[\\da-f]{2}){"+r+"})","gi"))},cx=function(r){try{return dv(r)}catch{return r}},Yf=function(r){var e=Vu(r,lx," "),t=4;try{return dv(e)}catch{for(;t;)e=Vu(e,ux(t--),cx);return e}},mx=/[!'()~]|%20/g,px={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},gx=function(r){return px[r]},Qf=function(r){return Vu(sx(r),mx,gx)},Hu=VF(function(e,t){av(this,{type:ov,iterator:Gu(ze(e).entries),kind:t})},"Iterator",function(){var e=tx(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),lv=function(r){this.entries=[],this.url=null,r!==void 0&&(sv(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?ox(r,0)==="?"?dx(r,1):r:he(r)))};lv.prototype={type:rs,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=ZF(r),t,i,n,o,a,c,p;if(e)for(t=Gu(r,e),i=t.next;!(n=Ya(i,t)).done;){if(o=Gu(KF(n.value)),a=o.next,(c=Ya(a,o)).done||(p=Ya(a,o)).done||!Ya(a,o).done)throw nx("Expected sequence with length 2");lr(this.entries,{key:he(c.value),value:he(p.value)})}else for(var g in r)zF(r,g)&&lr(this.entries,{key:g,value:he(r[g])})},parseQuery:function(r){if(r)for(var e=Xf(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=Xf(i,"="),lr(this.entries,{key:Yf(ax(n)),value:Yf($f(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],lr(e,Qf(i.key)+"="+Qf(i.value));return $f(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var td=function(){nv(this,ts);var e=arguments.length>0?arguments[0]:void 0;av(this,new lv(e))},ts=td.prototype;WF(ts,{append:function(e,t){Yr(arguments.length,2);var i=ze(this);lr(i.entries,{key:he(e),value:he(t)}),i.updateURL()},delete:function(r){Yr(arguments.length,1);for(var e=ze(this),t=e.entries,i=he(r),n=0;n<t.length;)t[n].key===i?Kf(t,n,1):n++;e.updateURL()},get:function(e){Yr(arguments.length,1);for(var t=ze(this).entries,i=he(e),n=0;n<t.length;n++)if(t[n].key===i)return t[n].value;return null},getAll:function(e){Yr(arguments.length,1);for(var t=ze(this).entries,i=he(e),n=[],o=0;o<t.length;o++)t[o].key===i&&lr(n,t[o].value);return n},has:function(e){Yr(arguments.length,1);for(var t=ze(this).entries,i=he(e),n=0;n<t.length;)if(t[n++].key===i)return!0;return!1},set:function(e,t){Yr(arguments.length,1);for(var i=ze(this),n=i.entries,o=!1,a=he(e),c=he(t),p=0,g;p<n.length;p++)g=n[p],g.key===a&&(o?Kf(n,p--,1):(o=!0,g.value=c));o||lr(n,{key:a,value:c}),i.updateURL()},sort:function(){var e=ze(this);QF(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=ze(this).entries,i=JF(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 Hu(this,"keys")},values:function(){return new Hu(this,"values")},entries:function(){return new Hu(this,"entries")}},{enumerable:!0});iv(ts,ex,ts.entries,{name:"entries"});iv(ts,"toString",function(){return ze(this).serialize()},{enumerable:!0});GF(td,rs);Wu({global:!0,constructor:!0,forced:!rv},{URLSearchParams:td});!rv&&_u(es)&&(ev=tt(Jf.has),tv=tt(Jf.set),ju=function(r){if(sv(r)){var e=r.body,t;if($F(e)===rs)return t=r.headers?new es(r.headers):new es,ev(t,"content-type")||tv(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),XF(r,{body:Vf(0,he(e)),headers:Vf(0,t)})}return r},_u(zf)&&Wu({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return zf(e,arguments.length>1?ju(arguments[1]):{})}}),_u(ed)&&(Qa=function(e){return nv(this,qu),new ed(e,arguments.length>1?ju(arguments[1]):{})},qu.constructor=Qa,Qa.prototype=qu,Wu({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Qa})));var ev,tv,ju,Qa;uv.exports={URLSearchParams:td,getState:ze}});var Tv=f(()=>{"use strict";Nh();var hx=Jn(),uc=ge(),fx=Cu(),cc=pe(),cv=Ka(),Ee=Z(),od=ar(),Fe=zh(),vx=wu(),ac=we(),mc=Zh(),ei=bf(),Je=Tu(),yx=xl().codeAt,bx=Ef(),mt=Wn(),kx=Kn(),Sx=Mu(),Cv=$u(),wv=Jr(),Px=wv.set,ad=wv.getterFor("URL"),Cx=Cv.URLSearchParams,wx=Cv.getState,is=cc.URL,dc=cc.TypeError,dd=cc.parseInt,Ix=Math.floor,mv=Math.pow,Te=Ee("".charAt),$e=Ee(/./.exec),ss=Ee([].join),Fx=Ee(1 .toString),xx=Ee([].pop),ri=Ee([].push),pv=Ee("".replace),Ax=Ee([].shift),Tx=Ee("".split),as=Ee("".slice),ld=Ee("".toLowerCase),Ex=Ee([].unshift),Rx="Invalid authority",Ku="Invalid scheme",ur="Invalid host",gv="Invalid port",Iv=/[a-z]/i,Ox=/[\d+-.a-z]/i,lc=/\d/,Bx=/^0x/i,Mx=/^[0-7]+$/,Ux=/^\d+$/,Fv=/^[\da-f]+$/i,Lx=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Dx=/[\0\t\n\r #/:<>?@[\\\]^|]/,Nx=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,_x=/[\t\n\r]/g,xe,qx=function(r){var e=Tx(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&&Te(o,0)=="0"&&(a=$e(Bx,o)?16:8,o=as(o,a==8?1:2)),o==="")c=0;else{if(!$e(a==10?Ux:a==8?Mx:Fv,o))return r;c=dd(o,a)}ri(i,c)}for(n=0;n<t;n++)if(c=i[n],n==t-1){if(c>=mv(256,5-t))return null}else if(c>255)return null;for(p=xx(i),n=0;n<i.length;n++)p+=i[n]*mv(256,3-n);return p},Hx=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,c,p,g,v,m,b=function(){return Te(r,n)};if(b()==":"){if(Te(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&&$e(Fv,b());)o=o*16+dd(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(!$e(lc,b()))return;for(;$e(lc,b());){if(g=dd(b(),10),p===null)p=g;else{if(p==0)return;p=p*10+g}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},jx=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},ns=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)Ex(e,r%256),r=Ix(r/256);return ss(e,".")}else if(typeof r=="object"){for(e="",i=jx(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=Fx(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},sd={},xv=mc({},sd,{" ":1,'"':1,"<":1,">":1,"`":1}),Av=mc({},xv,{"#":1,"?":1,"{":1,"}":1}),Xu=mc({},Av,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Ft=function(r,e){var t=yx(r,0);return t>32&&t<127&&!ac(e,r)?r:encodeURIComponent(r)},rd={ftp:21,file:null,http:80,https:443,ws:80,wss:443},os=function(r,e){var t;return r.length==2&&$e(Iv,Te(r,0))&&((t=Te(r,1))==":"||!e&&t=="|")},hv=function(r){var e;return r.length>1&&os(as(r,0,2))&&(r.length==2||(e=Te(r,2))==="/"||e==="\\"||e==="?"||e==="#")},Wx=function(r){return r==="."||ld(r)==="%2e"},Gx=function(r){return r=ld(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Zu={},fv={},Yu={},vv={},yv={},Qu={},bv={},kv={},id={},nd={},ec={},tc={},rc={},ic={},Sv={},nc={},ti={},rt={},Pv={},cr={},ct={},pc=function(r,e,t){var i=mt(r),n,o,a;if(e){if(o=this.parse(i),o)throw dc(o);this.searchParams=null}else{if(t!==void 0&&(n=new pc(t,!0)),o=this.parse(i,null,n),o)throw dc(o);a=wx(new Cx),a.bindURL(this),this.searchParams=a}};pc.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||Zu,o=0,a="",c=!1,p=!1,g=!1,v,m,b,y;for(r=mt(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=pv(r,Nx,"")),r=pv(r,_x,""),v=ei(r);o<=v.length;){switch(m=v[o],n){case Zu:if(m&&$e(Iv,m))a+=ld(m),n=fv;else{if(e)return Ku;n=Yu;continue}break;case fv:if(m&&($e(Ox,m)||m=="+"||m=="-"||m=="."))a+=ld(m);else if(m==":"){if(e&&(i.isSpecial()!=ac(rd,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&rd[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=ic:i.isSpecial()&&t&&t.scheme==i.scheme?n=vv:i.isSpecial()?n=kv:v[o+1]=="/"?(n=yv,o++):(i.cannotBeABaseURL=!0,ri(i.path,""),n=Pv)}else{if(e)return Ku;a="",n=Yu,o=0;continue}break;case Yu:if(!t||t.cannotBeABaseURL&&m!="#")return Ku;if(t.cannotBeABaseURL&&m=="#"){i.scheme=t.scheme,i.path=Je(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=ct;break}n=t.scheme=="file"?ic:Qu;continue;case vv:if(m=="/"&&v[o+1]=="/")n=id,o++;else{n=Qu;continue}break;case yv:if(m=="/"){n=nd;break}else{n=rt;continue}case Qu: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=Je(t.path),i.query=t.query;else if(m=="/"||m=="\\"&&i.isSpecial())n=bv;else if(m=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.query="",n=cr;else if(m=="#")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.query=t.query,i.fragment="",n=ct;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.path.length--,n=rt;continue}break;case bv:if(i.isSpecial()&&(m=="/"||m=="\\"))n=id;else if(m=="/")n=nd;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=rt;continue}break;case kv:if(n=id,m!="/"||Te(a,o+1)!="/")continue;o++;break;case id:if(m!="/"&&m!="\\"){n=nd;continue}break;case nd:if(m=="@"){c&&(a="%40"+a),c=!0,b=ei(a);for(var C=0;C<b.length;C++){var w=b[C];if(w==":"&&!g){g=!0;continue}var A=Ft(w,Xu);g?i.password+=A:i.username+=A}a=""}else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(c&&a=="")return Rx;o-=ei(a).length+1,a="",n=ec}else a+=m;break;case ec:case tc:if(e&&i.scheme=="file"){n=nc;continue}else if(m==":"&&!p){if(a=="")return ur;if(y=i.parseHost(a),y)return y;if(a="",n=rc,e==tc)return}else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(i.isSpecial()&&a=="")return ur;if(e&&a==""&&(i.includesCredentials()||i.port!==null))return;if(y=i.parseHost(a),y)return y;if(a="",n=ti,e)return;continue}else m=="["?p=!0:m=="]"&&(p=!1),a+=m;break;case rc:if($e(lc,m))a+=m;else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()||e){if(a!=""){var B=dd(a,10);if(B>65535)return gv;i.port=i.isSpecial()&&B===rd[i.scheme]?null:B,a=""}if(e)return;n=ti;continue}else return gv;break;case ic:if(i.scheme="file",m=="/"||m=="\\")n=Sv;else if(t&&t.scheme=="file")if(m==xe)i.host=t.host,i.path=Je(t.path),i.query=t.query;else if(m=="?")i.host=t.host,i.path=Je(t.path),i.query="",n=cr;else if(m=="#")i.host=t.host,i.path=Je(t.path),i.query=t.query,i.fragment="",n=ct;else{hv(ss(Je(v,o),""))||(i.host=t.host,i.path=Je(t.path),i.shortenPath()),n=rt;continue}else{n=rt;continue}break;case Sv:if(m=="/"||m=="\\"){n=nc;break}t&&t.scheme=="file"&&!hv(ss(Je(v,o),""))&&(os(t.path[0],!0)?ri(i.path,t.path[0]):i.host=t.host),n=rt;continue;case nc:if(m==xe||m=="/"||m=="\\"||m=="?"||m=="#"){if(!e&&os(a))n=rt;else if(a==""){if(i.host="",e)return;n=ti}else{if(y=i.parseHost(a),y)return y;if(i.host=="localhost"&&(i.host=""),e)return;a="",n=ti}continue}else a+=m;break;case ti:if(i.isSpecial()){if(n=rt,m!="/"&&m!="\\")continue}else if(!e&&m=="?")i.query="",n=cr;else if(!e&&m=="#")i.fragment="",n=ct;else if(m!=xe&&(n=rt,m!="/"))continue;break;case rt:if(m==xe||m=="/"||m=="\\"&&i.isSpecial()||!e&&(m=="?"||m=="#")){if(Gx(a)?(i.shortenPath(),m!="/"&&!(m=="\\"&&i.isSpecial())&&ri(i.path,"")):Wx(a)?m!="/"&&!(m=="\\"&&i.isSpecial())&&ri(i.path,""):(i.scheme=="file"&&!i.path.length&&os(a)&&(i.host&&(i.host=""),a=Te(a,0)+":"),ri(i.path,a)),a="",i.scheme=="file"&&(m==xe||m=="?"||m=="#"))for(;i.path.length>1&&i.path[0]==="";)Ax(i.path);m=="?"?(i.query="",n=cr):m=="#"&&(i.fragment="",n=ct)}else a+=Ft(m,Av);break;case Pv:m=="?"?(i.query="",n=cr):m=="#"?(i.fragment="",n=ct):m!=xe&&(i.path[0]+=Ft(m,sd));break;case cr:!e&&m=="#"?(i.fragment="",n=ct):m!=xe&&(m=="'"&&i.isSpecial()?i.query+="%27":m=="#"?i.query+="%23":i.query+=Ft(m,sd));break;case ct:m!=xe&&(i.fragment+=Ft(m,xv));break}o++}},parseHost:function(r){var e,t,i;if(Te(r,0)=="["){if(Te(r,r.length-1)!="]"||(e=Hx(as(r,1,-1)),!e))return ur;this.host=e}else if(this.isSpecial()){if(r=bx(r),$e(Lx,r)||(e=qx(r),e===null))return ur;this.host=e}else{if($e(Dx,r))return ur;for(e="",t=ei(r),i=0;i<t.length;i++)e+=Ft(t[i],sd);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return ac(rd,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!os(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,g=e+":";return n!==null?(g+="//",r.includesCredentials()&&(g+=t+(i?":"+i:"")+"@"),g+=ns(n),o!==null&&(g+=":"+o)):e=="file"&&(g+="//"),g+=r.cannotBeABaseURL?a[0]:a.length?"/"+ss(a,"/"):"",c!==null&&(g+="?"+c),p!==null&&(g+="#"+p),g},setHref:function(r){var e=this.parse(r);if(e)throw dc(e);this.searchParams.update()},getOrigin:function(){var r=this.scheme,e=this.port;if(r=="blob")try{return new ii(r.path[0]).origin}catch{return"null"}return r=="file"||!this.isSpecial()?"null":r+"://"+ns(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(mt(r)+":",Zu)},getUsername:function(){return this.username},setUsername:function(r){var e=ei(mt(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=Ft(e[t],Xu)}},getPassword:function(){return this.password},setPassword:function(r){var e=ei(mt(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=Ft(e[t],Xu)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?ns(r):ns(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,ec)},getHostname:function(){var r=this.host;return r===null?"":ns(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,tc)},getPort:function(){var r=this.port;return r===null?"":mt(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=mt(r),r==""?this.port=null:this.parse(r,rc))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+ss(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,ti))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=mt(r),r==""?this.query=null:(Te(r,0)=="?"&&(r=as(r,1)),this.query="",this.parse(r,cr)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var r=this.fragment;return r?"#"+r:""},setHash:function(r){if(r=mt(r),r==""){this.fragment=null;return}Te(r,0)=="#"&&(r=as(r,1)),this.fragment="",this.parse(r,ct)},update:function(){this.query=this.searchParams.serialize()||null}};var ii=function(e){var t=vx(this,re),i=Sx(arguments.length,1)>1?arguments[1]:void 0,n=Px(t,new pc(e,!1,i));uc||(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())},re=ii.prototype,Ae=function(r,e){return{get:function(){return ad(this)[r]()},set:e&&function(t){return ad(this)[e](t)},configurable:!0,enumerable:!0}};uc&&(Fe(re,"href",Ae("serialize","setHref")),Fe(re,"origin",Ae("getOrigin")),Fe(re,"protocol",Ae("getProtocol","setProtocol")),Fe(re,"username",Ae("getUsername","setUsername")),Fe(re,"password",Ae("getPassword","setPassword")),Fe(re,"host",Ae("getHost","setHost")),Fe(re,"hostname",Ae("getHostname","setHostname")),Fe(re,"port",Ae("getPort","setPort")),Fe(re,"pathname",Ae("getPathname","setPathname")),Fe(re,"search",Ae("getSearch","setSearch")),Fe(re,"searchParams",Ae("getSearchParams")),Fe(re,"hash",Ae("getHash","setHash")));od(re,"toJSON",function(){return ad(this).serialize()},{enumerable:!0});od(re,"toString",function(){return ad(this).serialize()},{enumerable:!0});is&&(sc=is.createObjectURL,oc=is.revokeObjectURL,sc&&od(ii,"createObjectURL",cv(sc,is)),oc&&od(ii,"revokeObjectURL",cv(oc,is)));var sc,oc;kx(ii,"URL");hx({global:!0,constructor:!0,forced:!fx,sham:!uc},{URL:ii})});var Ev=f(()=>{Tv()});var Rv=f(()=>{"use strict";var Vx=Jn(),zx=Ge();Vx({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return zx(URL.prototype.toString,this)}})});var Ov=f(()=>{$u()});var Mv=f((vM,Bv)=>{var Jx=pe();Bv.exports=Jx});var Lv=f((yM,Uv)=>{Ev();Rv();Ov();var $x=Mv();Uv.exports=$x.URL});var Hc=f((jD,Vy)=>{var dT=Object.prototype.toString;Vy.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 pT(e)?"generatorfunction":"function";if(lT(e))return"array";if(fT(e))return"buffer";if(hT(e))return"arguments";if(cT(e))return"date";if(uT(e))return"error";if(mT(e))return"regexp";switch(Gy(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(gT(e))return"generator";switch(t=dT.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 Gy(r){return typeof r.constructor=="function"?r.constructor.name:null}function lT(r){return Array.isArray?Array.isArray(r):r instanceof Array}function uT(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function cT(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function mT(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function pT(r,e){return Gy(r)==="GeneratorFunction"}function gT(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function hT(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 fT(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var $y=f((WD,Jy)=>{"use strict";var zy=Symbol.prototype.valueOf,vT=Hc();function yT(r,e){switch(vT(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 PT(r);case"symbol":return CT(r);case"arraybuffer":return kT(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return ST(r);case"regexp":return bT(r);case"error":return Object.create(r);default:return r}}function bT(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 kT(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function ST(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function PT(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function CT(r){return zy?Object(zy.call(r)):{}}Jy.exports=yT});var Xy=f((GD,Ky)=>{"use strict";Ky.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var Qy=f((VD,Yy)=>{"use strict";var wT=Xy();function Zy(r){return wT(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}Yy.exports=function(e){var t,i;return!(Zy(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,Zy(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var tb=f((zD,eb)=>{"use strict";var IT=$y(),FT=Hc(),xT=Qy();function jc(r,e){switch(FT(r)){case"object":return AT(r,e);case"array":return TT(r,e);default:return IT(r)}}function AT(r,e){if(typeof e=="function")return e(r);if(e||xT(r)){let t=new r.constructor;for(let i in r)t[i]=jc(r[i],e);return t}return r}function TT(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=jc(r[i],e);return t}eb.exports=jc});var em=f((bs,Ti)=>{var ET=200,Qc="__lodash_hash_undefined__",Bd=1,pb=2,gb=9007199254740991,Fd="[object Arguments]",zc="[object Array]",RT="[object AsyncFunction]",hb="[object Boolean]",fb="[object Date]",vb="[object Error]",yb="[object Function]",OT="[object GeneratorFunction]",xd="[object Map]",bb="[object Number]",BT="[object Null]",Ai="[object Object]",rb="[object Promise]",MT="[object Proxy]",kb="[object RegExp]",Ad="[object Set]",Sb="[object String]",UT="[object Symbol]",LT="[object Undefined]",Jc="[object WeakMap]",Pb="[object ArrayBuffer]",Td="[object DataView]",DT="[object Float32Array]",NT="[object Float64Array]",_T="[object Int8Array]",qT="[object Int16Array]",HT="[object Int32Array]",jT="[object Uint8Array]",WT="[object Uint8ClampedArray]",GT="[object Uint16Array]",VT="[object Uint32Array]",zT=/[\\^$.*+?()[\]{}|]/g,JT=/^\[object .+?Constructor\]$/,$T=/^(?:0|[1-9]\d*)$/,W={};W[DT]=W[NT]=W[_T]=W[qT]=W[HT]=W[jT]=W[WT]=W[GT]=W[VT]=!0;W[Fd]=W[zc]=W[Pb]=W[hb]=W[Td]=W[fb]=W[vb]=W[yb]=W[xd]=W[bb]=W[Ai]=W[kb]=W[Ad]=W[Sb]=W[Jc]=!1;var Cb=typeof global=="object"&&global&&global.Object===Object&&global,KT=typeof self=="object"&&self&&self.Object===Object&&self,ft=Cb||KT||Function("return this")(),wb=typeof bs=="object"&&bs&&!bs.nodeType&&bs,ib=wb&&typeof Ti=="object"&&Ti&&!Ti.nodeType&&Ti,Ib=ib&&ib.exports===wb,Wc=Ib&&Cb.process,nb=function(){try{return Wc&&Wc.binding&&Wc.binding("util")}catch{}}(),sb=nb&&nb.isTypedArray;function XT(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 ZT(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function YT(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 QT(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function eE(r){return function(e){return r(e)}}function tE(r,e){return r.has(e)}function rE(r,e){return r?.[e]}function iE(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function nE(r,e){return function(t){return r(e(t))}}function sE(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var oE=Array.prototype,aE=Function.prototype,Md=Object.prototype,Gc=ft["__core-js_shared__"],Fb=aE.toString,it=Md.hasOwnProperty,ob=function(){var r=/[^.]+$/.exec(Gc&&Gc.keys&&Gc.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),xb=Md.toString,dE=RegExp("^"+Fb.call(it).replace(zT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ab=Ib?ft.Buffer:void 0,Ed=ft.Symbol,db=ft.Uint8Array,Ab=Md.propertyIsEnumerable,lE=oE.splice,kr=Ed?Ed.toStringTag:void 0,lb=Object.getOwnPropertySymbols,uE=ab?ab.isBuffer:void 0,cE=nE(Object.keys,Object),$c=Ei(ft,"DataView"),ks=Ei(ft,"Map"),Kc=Ei(ft,"Promise"),Xc=Ei(ft,"Set"),Zc=Ei(ft,"WeakMap"),Ss=Ei(Object,"create"),mE=Cr($c),pE=Cr(ks),gE=Cr(Kc),hE=Cr(Xc),fE=Cr(Zc),ub=Ed?Ed.prototype:void 0,Vc=ub?ub.valueOf:void 0;function Sr(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 vE(){this.__data__=Ss?Ss(null):{},this.size=0}function yE(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function bE(r){var e=this.__data__;if(Ss){var t=e[r];return t===Qc?void 0:t}return it.call(e,r)?e[r]:void 0}function kE(r){var e=this.__data__;return Ss?e[r]!==void 0:it.call(e,r)}function SE(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=Ss&&e===void 0?Qc:e,this}Sr.prototype.clear=vE;Sr.prototype.delete=yE;Sr.prototype.get=bE;Sr.prototype.has=kE;Sr.prototype.set=SE;function vt(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 PE(){this.__data__=[],this.size=0}function CE(r){var e=this.__data__,t=Ud(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():lE.call(e,t,1),--this.size,!0}function wE(r){var e=this.__data__,t=Ud(e,r);return t<0?void 0:e[t][1]}function IE(r){return Ud(this.__data__,r)>-1}function FE(r,e){var t=this.__data__,i=Ud(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}vt.prototype.clear=PE;vt.prototype.delete=CE;vt.prototype.get=wE;vt.prototype.has=IE;vt.prototype.set=FE;function Pr(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 xE(){this.size=0,this.__data__={hash:new Sr,map:new(ks||vt),string:new Sr}}function AE(r){var e=Ld(this,r).delete(r);return this.size-=e?1:0,e}function TE(r){return Ld(this,r).get(r)}function EE(r){return Ld(this,r).has(r)}function RE(r,e){var t=Ld(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}Pr.prototype.clear=xE;Pr.prototype.delete=AE;Pr.prototype.get=TE;Pr.prototype.has=EE;Pr.prototype.set=RE;function Rd(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Pr;++e<t;)this.add(r[e])}function OE(r){return this.__data__.set(r,Qc),this}function BE(r){return this.__data__.has(r)}Rd.prototype.add=Rd.prototype.push=OE;Rd.prototype.has=BE;function Lt(r){var e=this.__data__=new vt(r);this.size=e.size}function ME(){this.__data__=new vt,this.size=0}function UE(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function LE(r){return this.__data__.get(r)}function DE(r){return this.__data__.has(r)}function NE(r,e){var t=this.__data__;if(t instanceof vt){var i=t.__data__;if(!ks||i.length<ET-1)return i.push([r,e]),this.size=++t.size,this;t=this.__data__=new Pr(i)}return t.set(r,e),this.size=t.size,this}Lt.prototype.clear=ME;Lt.prototype.delete=UE;Lt.prototype.get=LE;Lt.prototype.has=DE;Lt.prototype.set=NE;function _E(r,e){var t=Od(r),i=!t&&eR(r),n=!t&&!i&&Yc(r),o=!t&&!i&&!n&&Ub(r),a=t||i||n||o,c=a?QT(r.length,String):[],p=c.length;for(var g in r)(e||it.call(r,g))&&!(a&&(g=="length"||n&&(g=="offset"||g=="parent")||o&&(g=="buffer"||g=="byteLength"||g=="byteOffset")||KE(g,p)))&&c.push(g);return c}function Ud(r,e){for(var t=r.length;t--;)if(Rb(r[t][0],e))return t;return-1}function qE(r,e,t){var i=e(r);return Od(r)?i:ZT(i,t(r))}function Cs(r){return r==null?r===void 0?LT:BT:kr&&kr in Object(r)?JE(r):QE(r)}function cb(r){return Ps(r)&&Cs(r)==Fd}function Tb(r,e,t,i,n){return r===e?!0:r==null||e==null||!Ps(r)&&!Ps(e)?r!==r&&e!==e:HE(r,e,t,i,Tb,n)}function HE(r,e,t,i,n,o){var a=Od(r),c=Od(e),p=a?zc:Ut(r),g=c?zc:Ut(e);p=p==Fd?Ai:p,g=g==Fd?Ai:g;var v=p==Ai,m=g==Ai,b=p==g;if(b&&Yc(r)){if(!Yc(e))return!1;a=!0,v=!1}if(b&&!v)return o||(o=new Lt),a||Ub(r)?Eb(r,e,t,i,n,o):VE(r,e,p,t,i,n,o);if(!(t&Bd)){var y=v&&it.call(r,"__wrapped__"),C=m&&it.call(e,"__wrapped__");if(y||C){var w=y?r.value():r,A=C?e.value():e;return o||(o=new Lt),n(w,A,t,i,o)}}return b?(o||(o=new Lt),zE(r,e,t,i,n,o)):!1}function jE(r){if(!Mb(r)||ZE(r))return!1;var e=Ob(r)?dE:JT;return e.test(Cr(r))}function WE(r){return Ps(r)&&Bb(r.length)&&!!W[Cs(r)]}function GE(r){if(!YE(r))return cE(r);var e=[];for(var t in Object(r))it.call(r,t)&&t!="constructor"&&e.push(t);return e}function Eb(r,e,t,i,n,o){var a=t&Bd,c=r.length,p=e.length;if(c!=p&&!(a&&p>c))return!1;var g=o.get(r);if(g&&o.get(e))return g==e;var v=-1,m=!0,b=t&pb?new Rd: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(!YT(e,function(A,B){if(!tE(b,B)&&(y===A||n(y,A,t,i,o)))return b.push(B)})){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 VE(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 Pb:return!(r.byteLength!=e.byteLength||!o(new db(r),new db(e)));case hb:case fb:case bb:return Rb(+r,+e);case vb:return r.name==e.name&&r.message==e.message;case kb:case Sb:return r==e+"";case xd:var c=iE;case Ad:var p=i&Bd;if(c||(c=sE),r.size!=e.size&&!p)return!1;var g=a.get(r);if(g)return g==e;i|=pb,a.set(r,e);var v=Eb(c(r),c(e),i,n,o,a);return a.delete(r),v;case UT:if(Vc)return Vc.call(r)==Vc.call(e)}return!1}function zE(r,e,t,i,n,o){var a=t&Bd,c=mb(r),p=c.length,g=mb(e),v=g.length;if(p!=v&&!a)return!1;for(var m=p;m--;){var b=c[m];if(!(a?b in e:it.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 A=r[b],B=e[b];if(i)var me=a?i(B,A,b,e,r,o):i(A,B,b,r,e,o);if(!(me===void 0?A===B||n(A,B,t,i,o):me)){C=!1;break}w||(w=b=="constructor")}if(C&&!w){var _n=r.constructor,ka=e.constructor;_n!=ka&&"constructor"in r&&"constructor"in e&&!(typeof _n=="function"&&_n instanceof _n&&typeof ka=="function"&&ka instanceof ka)&&(C=!1)}return o.delete(r),o.delete(e),C}function mb(r){return qE(r,iR,$E)}function Ld(r,e){var t=r.__data__;return XE(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Ei(r,e){var t=rE(r,e);return jE(t)?t:void 0}function JE(r){var e=it.call(r,kr),t=r[kr];try{r[kr]=void 0;var i=!0}catch{}var n=xb.call(r);return i&&(e?r[kr]=t:delete r[kr]),n}var $E=lb?function(r){return r==null?[]:(r=Object(r),XT(lb(r),function(e){return Ab.call(r,e)}))}:nR,Ut=Cs;($c&&Ut(new $c(new ArrayBuffer(1)))!=Td||ks&&Ut(new ks)!=xd||Kc&&Ut(Kc.resolve())!=rb||Xc&&Ut(new Xc)!=Ad||Zc&&Ut(new Zc)!=Jc)&&(Ut=function(r){var e=Cs(r),t=e==Ai?r.constructor:void 0,i=t?Cr(t):"";if(i)switch(i){case mE:return Td;case pE:return xd;case gE:return rb;case hE:return Ad;case fE:return Jc}return e});function KE(r,e){return e=e??gb,!!e&&(typeof r=="number"||$T.test(r))&&r>-1&&r%1==0&&r<e}function XE(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function ZE(r){return!!ob&&ob in r}function YE(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||Md;return r===t}function QE(r){return xb.call(r)}function Cr(r){if(r!=null){try{return Fb.call(r)}catch{}try{return r+""}catch{}}return""}function Rb(r,e){return r===e||r!==r&&e!==e}var eR=cb(function(){return arguments}())?cb:function(r){return Ps(r)&&it.call(r,"callee")&&!Ab.call(r,"callee")},Od=Array.isArray;function tR(r){return r!=null&&Bb(r.length)&&!Ob(r)}var Yc=uE||sR;function rR(r,e){return Tb(r,e)}function Ob(r){if(!Mb(r))return!1;var e=Cs(r);return e==yb||e==OT||e==RT||e==MT}function Bb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=gb}function Mb(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function Ps(r){return r!=null&&typeof r=="object"}var Ub=sb?eE(sb):WE;function iR(r){return tR(r)?_E(r):GE(r)}function nR(){return[]}function sR(){return!1}Ti.exports=rR});var SS=f(Zd=>{"use strict";Zd.byteLength=UR;Zd.toByteArray=DR;Zd.fromByteArray=qR;var ot=[],qe=[],MR=typeof Uint8Array<"u"?Uint8Array:Array,Bm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Dr=0,bS=Bm.length;Dr<bS;++Dr)ot[Dr]=Bm[Dr],qe[Bm.charCodeAt(Dr)]=Dr;var Dr,bS;qe[45]=62;qe[95]=63;function kS(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 UR(r){var e=kS(r),t=e[0],i=e[1];return(t+i)*3/4-i}function LR(r,e,t){return(e+t)*3/4-t}function DR(r){var e,t=kS(r),i=t[0],n=t[1],o=new MR(LR(r,i,n)),a=0,c=n>0?i-4:i,p;for(p=0;p<c;p+=4)e=qe[r.charCodeAt(p)]<<18|qe[r.charCodeAt(p+1)]<<12|qe[r.charCodeAt(p+2)]<<6|qe[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=qe[r.charCodeAt(p)]<<2|qe[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=qe[r.charCodeAt(p)]<<10|qe[r.charCodeAt(p+1)]<<4|qe[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function NR(r){return ot[r>>18&63]+ot[r>>12&63]+ot[r>>6&63]+ot[r&63]}function _R(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(NR(i));return n.join("")}function qR(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,c=t-i;a<c;a+=o)n.push(_R(r,a,a+o>c?c:a+o));return i===1?(e=r[t-1],n.push(ot[e>>2]+ot[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(ot[e>>10]+ot[e>>4&63]+ot[e<<2&63]+"=")),n.join("")}});var lH=qn(Lv(),1);function h(r,e){if(r==null)throw Error(e??"Expected nonnullish value.")}function mr(r,e){if(!r)throw Error(e)}var ie;(function(r){r.COMMENT="t1_",r.ACCOUNT="t2_",r.LINK="t3_",r.MESSAGE="t4_",r.SUBREDDIT="t5_",r.AWARD="t6_"})(ie||(ie={}));function xt(r){return r.startsWith(ie.COMMENT)}function ud(r){return r.startsWith(ie.ACCOUNT)}function pr(r){return r.startsWith(ie.LINK)}function Dv(r){return r.startsWith(ie.MESSAGE)}function Nv(r){return r.startsWith(ie.SUBREDDIT)}function _v(r){return r.startsWith(ie.AWARD)}function Kx(r){mr(xt(r),`Expected comment id to start with ${ie.COMMENT}, got ${r}}`)}function Xx(r){mr(ud(r),`Expected account id to start with ${ie.ACCOUNT}, got ${r}}`)}function Zx(r){mr(pr(r),`Expected link id to start with ${ie.LINK}, got ${r}}`)}function Yx(r){mr(Dv(r),`Expected message id to start with ${ie.MESSAGE}, got ${r}}`)}function Qx(r){mr(Nv(r),`Expected subreddit id to start with ${ie.SUBREDDIT}, got ${r}}`)}function eA(r){mr(_v(r),`Expected award id to start with ${ie.AWARD}, got ${r}}`)}function ni(r){return Kx(r),r}function ne(r){return Xx(r),r}function fe(r){return Zx(r),r}function tA(r){return Yx(r),r}function Re(r){return Qx(r),r}function rA(r){return eA(r),r}function ve(r){if(xt(r))return ni(r);if(ud(r))return ne(r);if(pr(r))return fe(r);if(Dv(r))return tA(r);if(Nv(r))return Re(r);if(_v(r))return rA(r);throw new Error(`Expected thing id to start with ${Object.values(ie).join(", ")} got ${r}}`)}function gc(r){return xt(r)}import*as P from"@devvit/protos";var cd=class{constructor(e){}};var hc=(t=>(t.Installation="installation",t.App="app",t))(hc||{});function gr(r,e=new Set){for(let t of r){if(t.type==="group"){gr(t.fields,e);continue}let i=t.name;if(e.has(i))throw new Error(`Duplicate field name: ${i}`);e.add(i)}iA(r)}function iA(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 At=Object.freeze({INTERVAL:0,FORM:1,STATE:2,CHANNEL:3});var AM=["3rd-party","activity","add-emoji","add","add-media","add-to-feed","admin","ads","ai","align-center","align-left","align-right","all","ama","appearance","approve","archived","aspect-ratio","aspect-rectangle","attach","audience","audio","author","automod","avatar-style","award","back","backup","ban","best","block","blockchain","bold","boost","bot","bounce","brand-awareness","browse","browser","cake","calendar","camera","campaign","caret-down","caret-left","caret-right","caret-up","chat","chat-group","chat-new","chat-private","checkbox-dismiss","checkbox","checkmark","chrome","clear","client-list","close","closed-captioning","code-block","code-inline","coins-color-old","coins","collapse-left","collapse-right","collectible-expressions","collection","comment","comments","communities","community","confidence","contest","controversial","conversion","copy-clipboard","crop","crosspost","crowd-control","custom-feed","customize","dashboard","day","delete-column","delete","delete-row","devvit","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","funnel","gif-post","gold","hashtag","heart","help","hide","history","home","hot","ignore-reports","image-post","inbox","info","insert-column-left","insert-column-right","insert-row-above","insert-row-below","internet","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","macro","mark-read","marketplace","mask","media-gallery","meme","menu","message","mic","mic-mute","mod","mod-mail","mod-mode","mod-mute","mod-overflow","mod-queue","mod-unmute","music","mute","new","night","no-internet","notification","notification-frequent","notification-off","nsfw","nsfw-language","nsfw-violence","official","original","overflow-caret","overflow-horizontal","overflow-vertical","pause","payment","peace","pending-posts","phone","pin","play","poll-post","popular","posts","powerup","predictions","premium","privacy","profile","qa","qr-code","quarantined","quote","r-slash","radar","radio-button","raise-hand","random","ratings-everyone","ratings-mature","ratings-nsfw","ratings-violence","recovery-phrase","refresh","removal-reasons","remove","reply","report","reverse","rich-text","right","rising","rotate","rotate-image","rpan","rules","safari","save","save-view","saved","saved-response","search","self","send","settings","severity","share","share-new","show","side-menu","skipback10","skipforward10","sort-az","sort","sort-price","sort-za","spam","spoiler","sponsored","spreadsheet","star","statistics","status-live","sticker","strikethrough","subtract","superscript","swap-camera","swipe-back","swipe-down","swipe","swipe-up","table","tag","tap","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","translation-off","trim","u-slash","unban","undo","unheart","unlock","unmod","unpin","unstar","unverified","up-arrow","up","upload","upvote","upvotes","user","user-note","users","vault","verified","video-camera","video-feed","video-post","video-thread","video-transcription","view-card","view-classic","view-compact","view-grid","view-sort","views","volume","wallet","warning","webhook","whale","wiki-ban","wiki","wiki-unban","world","coins-color","powerup-color","powerup-fill-color","share-android","share-ios","video-live-1","video-live-fill-1","video-live","volume-mute","binoculars","planet","telescope","caret-updown"];import{AppSettingsDefinition as bA,GetFieldsResponse as kA}from"@devvit/protos";import{FormField as hr,FormFieldType as Oe}from"@devvit/protos";function pt(r){return r.map(e=>{switch(e.type){case"string":return nA(e);case"image":return sA(e);case"paragraph":return oA(e);case"number":return aA(e);case"select":return dA(e);case"boolean":return lA(e);case"group":return uA(e);default:throw new Error("Unknown field type.")}})}function nA(r){return hr.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 sA(r){return hr.fromPartial({disabled:r.disabled,fieldId:r.name,fieldType:Oe.IMAGE,helpText:r.helpText,label:r.label,required:r.required})}function oA(r){return hr.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 aA(r){return hr.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 dA(r){return hr.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 lA(r){return hr.fromPartial({defaultValue:{fieldType:Oe.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Oe.BOOLEAN,helpText:r.helpText,label:r.label})}function uA(r){return hr.fromPartial({fieldType:Oe.GROUP,fieldConfig:{groupConfig:{fields:pt(r.fields)}},label:r.label,helpText:r.helpText})}function U(r,e){u.prototype[r]=e}import{ValidateFormResponse as yA}from"@devvit/protos";import{RealtimeSubscriptionStatus as Hv}from"@devvit/protos";var L=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",SubredditName:"devvit-subreddit-name",TraceID:"devvit-trace-id",User:"devvit-user",UserAgent:"devvit-user-agent",Version:"devvit-version",Language:"devvit-accept-language",Timezone:"devvit-accept-timezone",AppDependencies:"devvit-app-dependencies",WebviewTemplate:"devvit-webview-template"}),qv;(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",r.Bootstrap="bootstrap"})(qv||(qv={}));function jv(r){function e(t){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=r.metadata[L.App]?.values[0];h(c,"useChannel - app is missing from Context");let p=r.metadata[L.Installation]?.values[0];h(p,"useChannel - installation is missing from Context");async function g(A){let B=o[n].channel;if(o[n].active)if(o[n].connected)await r.realtime.send(B,A);else throw Error(`Failed to send to channel '${B}'; it is active but not yet connected`);else throw Error(`Cannot send a message over inactive channel: ${B}`)}function v(){if(!o[n].active){let A=o[n].channel;o[n].active=!0,r.addRealtimeChannel(A)}}function m(){if(o[n].active){let A=o[n].channel;o[n].active=!1,r.removeRealtimeChannel(A)}}function b(A){return async()=>{let B;switch(A.status){case Hv.REALTIME_SUBSCRIBED:o[n].connected=!0,B=t.onSubscribed?.();break;case Hv.REALTIME_UNSUBSCRIBED:o[n].connected=!1,B=t.onUnsubscribed?.();break;default:B=t.onMessage(A.event?.data??{});break}await B}}let y={channel:`${c}:${p}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:At.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:g,status:w}}return e}import{FormFieldType as si}from"@devvit/protos";function fc(r){switch(r.fieldType){case si.STRING:return r.stringValue;case si.IMAGE:return r.stringValue;case si.PARAGRAPH:return r.stringValue;case si.NUMBER:return r.numberValue;case si.BOOLEAN:return r.boolValue;case si.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 Wv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentKey(),a=r.getCurrentComponentState(),c=r.getPreviousComponentState(),p=`form.hook.${o}.${n}`,g={formKey:p,preventSubmit:!1,type:At.FORM};n in a?g=a[n]:n in c&&(g=c[n]),a[n]=g,r.forms.set(p,t);let v=r.formSubmittedEvent;return v&&!g.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 Gv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=100,p=Math.max(c,i),g={lastRun:void 0,running:!1,preventCallback:!1,type:At.INTERVAL};n in o?g=o[n]:n in a&&(g=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===At.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:At.INTERVAL},r.rerenderIn(p)}function m(){o[n].running=!1,o[n].lastRun=void 0,o[n].preventCallback=!1}return r.isEffectRender&&g.running&&(g.preventCallback||(g.lastRun===void 0||g.lastRun+p<Date.now())&&r.runHook(async()=>{let b=t();b&&b instanceof Promise&&await b,g.lastRun=Date.now()}),r.rerenderIn(p)),g.preventCallback=!1,o[n]=g,r.currentHookIndex++,{start:v,stop:m}}return e}function Vv(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 kc={now(){return new Date}};function zv(r){return`__autocache__${r}`}function Jv(r){return`__lock__${r}`}var mA=300,pA=1e3,md=5e3,vc=3,$v=.1,Kv=1e3,gA=3e4;function Xv(r){if(r.error)throw new Error(r.error);return r.value}var Et,Rt,Be,oi,$,Zv,Yv,Qv,yc,ey,ty,bc,ry,pd=class{constructor(e,t,i=kc){l(this,$);l(this,Et);l(this,Rt,{});l(this,Be);l(this,oi);d(this,Et,e),d(this,oi,t),d(this,Be,i)}async cache(e,t){d(this,Rt,s(this,oi).__cache=s(this,oi).__cache??{}),S(this,$,ry).call(this,t);let i=S(this,$,Zv).call(this,t.key);if(i!==void 0)return i;let n=await S(this,$,bc).call(this,t.key),o=await S(this,$,Yv).call(this,t,n,e);return Xv(o)}};Et=new WeakMap,Rt=new WeakMap,Be=new WeakMap,oi=new WeakMap,$=new WeakSet,Zv=function(e){let t=s(this,Rt)[e];if(t){let i=s(this,Be).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<vc&&Math.random()<$v&&t.errorTime+Kv<i;if(t?.expires&&t.expires<i&&t.checkedAt+Kv<i||n){delete s(this,Rt)[e];return}else return Xv(t)}},Yv=async function(e,t,i){let n=t?.expires,o=n?S(this,$,ty).call(this,n):1;return!t||t?.error&&t.errorCount<vc&&$v>Math.random()||o>Math.random()?S(this,$,Qv).call(this,e,t,i):t},Qv=async function(e,t,i){let n=Jv(e.key),o=s(this,Be).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Et).set(n,"1",{expiration:a,nx:!0}))return S(this,$,ey).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Be).now();return S(this,$,yc).call(this,p,e.key,e.ttl)}},yc=async function(e,t,i){let n=Math.min(i,pA),o=await S(this,$,bc).call(this,t);if(o)return o;if(s(this,Be).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,mA)),S(this,$,yc).call(this,e,t,i)},ey=async function(e,t,i,n){let o=s(this,Be).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,Be).now().getTime(),t.errorCount++}return s(this,Rt)[e]=t,await s(this,Et).set(zv(e),JSON.stringify(t),{expiration:new Date(o+gA)}),t.error&&t.errorCount<vc&&await s(this,Et).del(Jv(e)),t},ty=function(e){let t=s(this,Be).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},bc=async function(e){let t=await s(this,Et).get(zv(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Be).now().getTime(),s(this,Rt)[e]=i,i}},ry=function(e){e.ttl<md&&(console.warn(`Cache TTL cannot be less than ${md} milliseconds! Updating ttl value of ${e.ttl} to ${md}.`),e.ttl=md)};function iy(r,e,t=kc){let i=new pd(r,e,t);return i.cache.bind(i)}function ny(r){new URL(r.slice(0,r.indexOf(",")))}var ai,di,ui,sy,oy,li=class{constructor(){l(this,ui);l(this,ai,{});l(this,di,{});d(this,ai,u.assets),d(this,di,u.webviewAssets)}getURL(e,t){return typeof e=="string"?S(this,ui,sy).call(this,e,t??{webview:!1}):S(this,ui,oy).call(this,e,t??{webview:!1})}};ai=new WeakMap,di=new WeakMap,ui=new WeakSet,sy=function(e,t){let i=t.webview?s(this,di)[e]:s(this,ai)[e];if(i)return i;try{return ny(e),encodeURI(e)}catch{return""}},oy=function(e,t){let i={},n=[],o=t.webview?s(this,di):s(this,ai);if(o)for(let a of e)if(o[a])i[a]=o[a];else try{ny(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 Ot,ci=class{constructor(e){l(this,Ot);d(this,Ot,e)}async get(e){let{messages:t}=await u.kvStorePlugin.Get({keys:[e]},s(this,Ot));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,Ot))}async delete(e){await u.kvStorePlugin.Del({keys:[e]},s(this,Ot))}async list(){let{keys:e}=await u.kvStorePlugin.List({filter:"*"},s(this,Ot));return e}};Ot=new WeakMap;var ds,mi=class{constructor(e){l(this,ds);d(this,ds,e)}async upload(e){let t=await u.mediaPlugin.Upload(e,s(this,ds));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};ds=new WeakMap;var ls,pi=class{constructor(e){l(this,ls);d(this,ls,e)}async add(e){await u.modLogPlugin.Add(e,s(this,ls))}};ls=new WeakMap;var us,gi=class{constructor(e){l(this,us);d(this,us,e)}async send(e,t){await u.realtimePlugin.Send({channel:e,data:t},s(this,us))}};us=new WeakMap;var k,cs,fi=class{constructor(e){l(this,k);l(this,cs);d(this,k,e),d(this,cs,new hd(e))}get modMail(){return s(this,cs)}getSubredditById(e){return ye.getById(ve(e),s(this,k))}getSubredditByName(e){return ye.getByName(e,s(this,k))}addSubredditRemovalReason(e,t){return ye.addRemovalReason(e,t.title,t.message,s(this,k))}getSubredditRemovalReasons(e){return ye.getRemovalReasons(e,s(this,k))}getCurrentSubreddit(){return ye.getFromMetadata(s(this,k))}getPostById(e){return z.getById(ve(e),s(this,k))}submitPost(e){return z.submit(e,s(this,k))}crosspost(e){return z.crosspost(e,s(this,k))}getUserById(e){return I.getById(ve(e),s(this,k))}getCollectionById(e){return hi.getCollectionById({collectionId:e},s(this,k))}createCollection(e){return hi.create(e,s(this,k))}getCollectionsForSubreddit(e){return hi.getCollectionsForSubreddit({subredditId:e},s(this,k))}getUserByUsername(e){return I.getByUsername(e,s(this,k))}getCurrentUser(){return I.getFromMetadata(L.User,s(this,k))}getAppUser(){return I.getFromMetadata(L.AppUser,s(this,k))}getSnoovatarUrl(e){return I.getSnoovatarUrl(e,s(this,k))}getCommentById(e){return ee.getById(ve(e),s(this,k))}getComments(e){return ee.getComments(e,s(this,k))}getCommentsByUser(e){return ee.getCommentsByUser(e,s(this,k))}submitComment(e){return ee.submit({...e,id:ve(e.id)},s(this,k))}getControversialPosts(e){return z.getControversialPosts(e,s(this,k))}getTopPosts(e){return z.getTopPosts(e,s(this,k))}getHotPosts(e){return z.getHotPosts(e,s(this,k))}getNewPosts(e){return z.getNewPosts(e,s(this,k))}getRisingPosts(e){return z.getRisingPosts(e,s(this,k))}getPostsByUser(e){return z.getPostsByUser(e,s(this,k))}getCommentsAndPostsByUser(e){return I.getOverview(e,s(this,k))}getModerationLog(e){return gd(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.username,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 Me.get(e,s(this,k))}deleteModNote(e){return Me.delete(e,s(this,k))}addModNote(e){let t={...e,redditId:e.redditId?ve(e.redditId):void 0};return Me.add(t,s(this,k))}addRemovalNote(e){return Me.addRemovalNote(e,s(this,k))}async sendPrivateMessage(e){return fr.send(e,s(this,k))}async sendPrivateMessageAsSubreddit(e){return fr.sendAsSubreddit(e,s(this,k))}async approve(e){if(xt(e))return ee.approve(e,s(this,k));if(pr(e))return z.approve(e,s(this,k));throw new Error("id must start with either t1_ or t3_")}async remove(e,t){if(xt(e))return ee.remove(e,t,s(this,k));if(pr(e))return z.remove(e,t,s(this,k));throw new Error("id must start with either t1_ or t3_")}async getPostFlairTemplates(e){return de.getPostFlairTemplates(e,s(this,k))}async getUserFlairTemplates(e){return de.getUserFlairTemplates(e,s(this,k))}async createPostFlairTemplate(e){return de.createPostFlairTemplate(e,s(this,k))}async createUserFlairTemplate(e){return de.createUserFlairTemplate(e,s(this,k))}async editFlairTemplate(e){return de.editFlairTemplate(e,s(this,k))}async deleteFlairTemplate(e,t){return de.deleteFlairTemplate(e,t,s(this,k))}async setUserFlair(e){return Ue.setUserFlair(e,s(this,k))}async removeUserFlair(e,t){return Ue.removeUserFlair(e,t,s(this,k))}async setPostFlair(e){return Ue.setPostFlair(e,s(this,k))}async removePostFlair(e,t){return Ue.removePostFlair(e,fe(t),s(this,k))}async getWidgets(e){return se.getWidgets(e,s(this,k))}async deleteWidget(e,t){return se.delete(e,t,s(this,k))}async addWidget(e){return se.add(e,s(this,k))}async reorderWidgets(e,t){return se.reorder(e,t,s(this,k))}async getWikiPage(e,t){return be.getPage(e,t,s(this,k))}async getWikiPages(e){return be.getPages(e,s(this,k))}async createWikiPage(e){return be.createPage(e,s(this,k))}async updateWikiPage(e){return be.updatePage(e,s(this,k))}getWikiPageRevisions(e){return be.getPageRevisions(e,s(this,k))}async revertWikiPage(e,t,i){return be.revertPage(e,t,i,s(this,k))}async getWikiPageSettings(e,t){return be.getPageSettings(e,t,s(this,k))}async updateWikiPageSettings(e){return be.updatePageSettings(e,s(this,k))}async addEditorToWikiPage(e,t,i){return be.addEditor(e,t,i,s(this,k))}async removeEditorFromWikiPage(e,t,i){return be.removeEditor(e,t,i,s(this,k))}getMessages(e){return fr.getMessages(e,s(this,k))}markAllMessagesAsRead(){return fr.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 ye.aboutLocation({...e,location:"modqueue"},s(this,k))}getReports(e){return ye.aboutLocation({...e,location:"reports"},s(this,k))}getSpam(e){return ye.aboutLocation({...e,location:"spam"},s(this,k))}getUnmoderated(e){return ye.aboutLocation({...e,location:"unmoderated"},s(this,k))}getEdited(e){return ye.aboutLocation({...e,location:"edited"},s(this,k))}getVaultByAddress(e){return ly(e,s(this,k))}getVaultByUserId(e){return uy(ve(e),s(this,k))}getSubredditLeaderboard(e){return dy(e,s(this,k))}};k=new WeakMap,cs=new WeakMap;import{RedisKeyScope as Sc}from"@devvit/protos";function fd(r){return r&&typeof r=="object"&&"message"in r&&r.message!==void 0&&typeof r.message=="string"?r.message.includes("redis: nil"):!1}var E,R,O,Pc=class{constructor(e,t,i){l(this,E);l(this,R);l(this,O);d(this,E,e),d(this,R,t),d(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,vi,Cc=class Cc{constructor(e,t=void 0,i=Sc.INSTALLATION){l(this,M);l(this,vi);d(this,M,e),d(this,vi,t),this.scope=i,this.global=i===Sc.INSTALLATION?new Cc(s(this,M),s(this,vi),Sc.GLOBAL):this}get storage(){return s(this,vi)||u.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,M));return new Pc(this.storage,t,s(this,M))}async get(e){try{let t=await this.storage.Get({key:e,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return t!==null?t.value??void 0:t}catch(t){if(fd(t))return;throw 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){try{let i=await this.storage.ZScore({key:{key:e},member:t,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return i!==null?i.value:i}catch(i){if(fd(i))return;throw i}}async zRank(e,t){try{let i=await this.storage.ZRank({key:{key:e},member:t,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return i!==null?i.value:i}catch(i){if(fd(i))return;throw 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){try{let i=await this.storage.HGet({key:e,field:t,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return i!==null?i.value??void 0:i}catch(i){if(fd(i))return;throw 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,vi=new WeakMap;var yi=Cc;var vr,bi=class{constructor(e){l(this,vr);d(this,vr,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,vr))).id}async cancelJob(e){await u.schedulerPlugin.Cancel({id:e},s(this,vr))}async listJobs(){return(await u.schedulerPlugin.List({after:new Date(0),before:new Date(Date.now()+31536e7)},s(this,vr))).actions.map(t=>(h(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}))}};vr=new WeakMap;var ms,ki=class{constructor(e){l(this,ms);d(this,ms,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await u.settingsPlugin.GetSettings({},s(this,ms));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...cy(t.installationSettings.settings,u.installationSettings),...cy(t.appSettings.settings,u.appSettings)}}};ms=new WeakMap;function cy(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=fc(r[n]),i),{});return e&&my(t,e),t}function my(r,e){for(let t of e)t.type==="group"?my(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as wc,Form as hA,ToastAppearance as py}from"@devvit/protos";var yr,Si,vd=class{constructor(e){l(this,yr,[]);l(this,Si);d(this,Si,e)}showForm(e,t){let i=u.formDefinitions.get(e);if(!i&&s(this,Si)){let a=s(this,Si).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=hA.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});gr(n.fields),o.fields=pt(n.fields),s(this,yr).push({type:wc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?py.SUCCESS:py.NEUTRAL}:t={text:e},s(this,yr).push({type:wc.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,yr).push({type:wc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,yr)}};yr=new WeakMap,Si=new WeakMap;function Le({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new pi(r),o=new ci(r),a=new yi(r),c=iy(a,i?i.state:{}),p=new fi(r),g=new bi(r),v=new ki(r),m=e?new vd(i):void 0,b=new mi(r),y=new li,C=new gi(r),w=t&&i?Vv(i):void 0,A=t&&i?Gv(i):void 0,B=t&&i?Wv(i):void 0,me=t&&i?jv(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:g,settings:v,media:b,assets:y,realtime:C,get useForm(){return B??(()=>{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 A??(()=>{throw new Error("useInterval() is unavailable")})},get useChannel(){return me??(()=>{throw new Error("useChannel() is unavailable")})},get ui(){if(!m)throw new Error("ui client is not available");return m}}}var gy={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":"16.1.0","@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:"258 KB"}},source:"./src/index.ts"};function le(r,e,t){let i=r[L.Subreddit]?.values[0];h(i,"subreddit is missing from Context");let n=r[L.AppUser]?.values[0],o=r[L.App]?.values[0],a=r[L.Version]?.values[0],c=r[L.User]?.values[0],p=vA(r);return{get appAccountId(){return h(n,"appAccountId is missing from Context"),n},subredditId:i,userId:c,postId:e,commentId:t,appName:o,appVersion:a,debug:p,toJSON(){return{appAccountId:n,appName:o,appVersion:a,subredditId:i,userId:c,postId:e,commentId:t,debug:p}}}}function vA(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,bootstrap:void 0},t={};for(let n in e)t[n.toLowerCase()]=n;let i={};for(let n of(r[L.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[L.Debug]&&console.info(`[api] @devvit/public-api v${gy.version} ${Object.entries(i).map(([n,o])=>`${n}=${o}`).join(" ")}`),{...i,metadata:r}}function hy(r){return r.flatMap(e=>e.type==="group"?hy(e.fields):e)}async function yd(r,e,t){if(!e)throw new Error("Settings were not defined.");let i={success:!0,errors:{}},n=Tt(r.fieldValues),o=hy(e);return await Promise.all(o.map(async a=>{let c=a.name;if(c&&a.onValidate){let p=n[c],g=a.onValidate,v=Object.assign(Le({metadata:t}),le(t)),m=await g({value:p,isEditing:r.editing},v);m&&(i.success=!1,i.errors[c]=m)}})),yA.fromJSON(i)}async function SA(){if(!u.appSettings)throw new Error("App settings were not defined.");return kA.fromJSON({fields:{fields:pt(u.appSettings)}})}async function PA(r,e){return yd(r,u.appSettings,e)}function fy(r){r.provides(bA),U("GetAppSettingsFields",SA),U("ValidateAppForm",PA)}import{CustomPostDefinition as TA,RenderPostResponse as EA}from"@devvit/protos";import{BlockRenderEventType as Nc,EffectType as My}from"@devvit/protos";function Pi(r){return r.__effects}function vy(){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 Dc,BlockAnimationDirection as xy,BlockAnimationLoopMode as Ay,BlockAnimationType as Ty,BlockAvatarBackground as Ey,BlockAvatarFacing as Ry,BlockAvatarSize as Bt,BlockBorderWidth as Pd,BlockButtonAppearance as Mt,BlockButtonSize as Tc,BlockFullSnooSize as wi,BlockGap as Cd,BlockHorizontalAlignment as Ec,BlockIconSize as wd,BlockImageResizeMode as ps,BlockPadding as gs,BlockRadius as hs,BlockSpacerShape as Rc,BlockSpacerSize as Id,BlockStackDirection as Oc,BlockTextOutline as Bc,BlockTextOverflow as Mc,BlockTextSize as Ii,BlockTextStyle as Uc,BlockTextWeight as Oy,BlockType as De,BlockVerticalAlignment as Lc}from"@devvit/protos";var Ic={"alienblue-100":"#DCE2FB","alienblue-200":"#B8C5FC","alienblue-25":"#F7F8FD","alienblue-300":"#90A9FD","alienblue-400":"#648EFC","alienblue-50":"#EEF0FB","alienblue-500":"#1870F4","alienblue-600":"#115BCA","alienblue-700":"#0A449B","alienblue-75":"#E6E9FB","alienblue-800":"#0A2F6C","alienblue-900":"#0A1A3F","alienblue-950":"#07102B","berrypurple-100":"#F3DAFB","berrypurple-200":"#EAB3FD","berrypurple-25":"#FBF6FD","berrypurple-300":"#DE8BFF","berrypurple-400":"#CF5FFF","berrypurple-50":"#F8EDFC","berrypurple-500":"#BC0EFF","berrypurple-600":"#9B00D4","berrypurple-700":"#7600A3","berrypurple-75":"#F6E4FB","berrypurple-800":"#520472","berrypurple-900":"#300643","berrypurple-950":"#20042A",black:"#000000","black-opacity-0":"#00000000","black-opacity-10":"#00000019","black-opacity-15":"#00000026","black-opacity-20":"#00000033","black-opacity-25":"#0000003F","black-opacity-33":"#00000054","black-opacity-5":"#0000000C","black-opacity-50":"#0000007F","black-opacity-60":"#00000099","black-opacity-67":"#000000AA","black-opacity-80":"#000000CC","black-opacity-90":"#000000E5","brown-100":"#F1DFCF","brown-200":"#E9BE95","brown-25":"#FBF7F4","brown-300":"#DC9D5D","brown-400":"#BA854E","brown-50":"#F7EFE9","brown-500":"#9A6D3F","brown-600":"#7B5631","brown-700":"#5D4023","brown-75":"#F4E7DC","brown-800":"#3F2C19","brown-900":"#221A11","brown-950":"#15100A","coolgray-100":"#DBE4E9","coolgray-150":"#C9D7DE","coolgray-200":"#B7CAD4","coolgray-25":"#F6F8F9","coolgray-250":"#A4BDCA","coolgray-300":"#97AFBC","coolgray-350":"#8BA2AD","coolgray-400":"#7F949F","coolgray-450":"#748791","coolgray-50":"#EEF1F3","coolgray-500":"#667780","coolgray-525":"#576F76","coolgray-550":"#5C6C74","coolgray-600":"#536168","coolgray-650":"#48545B","coolgray-700":"#3D494E","coolgray-75":"#E5EBEE","coolgray-750":"#333D42","coolgray-800":"#2A3236","coolgray-850":"#21272A","coolgray-900":"#181C1F","coolgray-950":"#0E1113","global-black":{light:"#000000",dark:"#000000"},"global-brand-orangered":{light:"#FF4500",dark:"#FF4500"},"global-white":{light:"#FFFFFF",dark:"#FFFFFF"},"kiwigreen-100":"#A8F5A0","kiwigreen-200":"#58E15B","kiwigreen-25":"#EBFDE7","kiwigreen-300":"#00C61C","kiwigreen-400":"#01A816","kiwigreen-50":"#DDF8D7","kiwigreen-500":"#008A10","kiwigreen-600":"#016E0B","kiwigreen-700":"#005306","kiwigreen-75":"#CAF5C2","kiwigreen-800":"#033902","kiwigreen-900":"#0D2005","kiwigreen-950":"#081404","lightblue-100":"#CAE7FB","lightblue-200":"#87D0FD","lightblue-25":"#F3F9FD","lightblue-300":"#02B9FB","lightblue-400":"#029DD5","lightblue-50":"#E6F3FC","lightblue-500":"#007FAE","lightblue-600":"#01668D","lightblue-700":"#014D6B","lightblue-75":"#D9EDFB","lightblue-800":"#03354B","lightblue-900":"#051E2B","lightblue-950":"#04131A","lime-100":"#B7F28E","lime-200":"#90DA58","lime-25":"#EEFDDC","lime-300":"#6DBF01","lime-400":"#5BA200","lime-50":"#E0F8C8","lime-500":"#4A8500","lime-600":"#3A6A00","lime-700":"#2A5000","lime-75":"#CEF5AD","lime-800":"#1E3702","lime-900":"#151E05","lime-950":"#0D1304","mintgreen-100":"#9BF5D9","mintgreen-200":"#00E2B7","mintgreen-25":"#E7FDF5","mintgreen-300":"#00C29D","mintgreen-400":"#01A484","mintgreen-50":"#D7F8EC","mintgreen-500":"#01876D","mintgreen-600":"#006C56","mintgreen-700":"#015140","mintgreen-75":"#C0F5E3","mintgreen-800":"#00382B","mintgreen-900":"#032019","mintgreen-950":"#03140F","orangered-100":"#FCDBCF","orangered-200":"#FDB498","orangered-25":"#FDF6F4","orangered-300":"#FF895D","orangered-400":"#FF4500","orangered-50":"#FCEEE8","orangered-500":"#D93900","orangered-600":"#AE2C00","orangered-700":"#842100","orangered-75":"#FBE5DC","orangered-800":"#591B02","orangered-900":"#2F1405","orangered-950":"#1C0D04","periwinkle-100":"#E6DFFB","periwinkle-200":"#CDBEFD","periwinkle-25":"#F9F7FD","periwinkle-300":"#B29FFF","periwinkle-400":"#9580FF","periwinkle-50":"#F2EFFC","periwinkle-500":"#6A5CFF","periwinkle-600":"#523DFF","periwinkle-700":"#4001EA","periwinkle-75":"#ECE7FB","periwinkle-800":"#250AA6","periwinkle-900":"#160E5B","periwinkle-950":"#0C083F","poopbrown-100":"#FEEEDD","poopbrown-200":"#F6DDC3","poopbrown-300":"#EECCAA","poopbrown-400":"#CAA075","poopbrown-50":"#FEF7EE","poopbrown-500":"#9A6D3F","poopbrown-600":"#6E4924","poopbrown-700":"#54371A","poopbrown-800":"#3B2510","poopbrown-900":"#29190A","poopbrown-950":"#110B04","puregray-100":"#F2F2F2","puregray-150":"#EBEBEB","puregray-200":"#E4E4E4","puregray-250":"#DDDDDD","puregray-300":"#D6D6D6","puregray-350":"#C3C3C3","puregray-400":"#ACACAC","puregray-450":"#919191","puregray-50":"#F8F8F8","puregray-500":"#767676","puregray-550":"#5C5C5C","puregray-600":"#434343","puregray-650":"#393939","puregray-700":"#303030","puregray-750":"#272727","puregray-800":"#1E1E1E","puregray-850":"#181818","puregray-900":"#131313","puregray-950":"#080808","red-100":"#FBDBD4","red-200":"#FDB3A4","red-25":"#FDF6F5","red-300":"#FF8773","red-400":"#FF4F40","red-50":"#FCEEEA","red-500":"#EB001F","red-600":"#BC0117","red-700":"#90000F","red-75":"#FBE4DF","red-800":"#650405","red-900":"#340F05","red-950":"#1F0B04","sakurapink-100":"#FBD9EB","sakurapink-200":"#FDAEDA","sakurapink-25":"#FDF6F9","sakurapink-300":"#FF7ECA","sakurapink-400":"#FF38BB","sakurapink-50":"#FCEDF4","sakurapink-500":"#DE019F","sakurapink-600":"#B2007F","sakurapink-700":"#880060","sakurapink-75":"#FBE3EF","sakurapink-800":"#5F0443","sakurapink-900":"#380626","sakurapink-950":"#250419",transparent:"transparent",white:"#ffffff","white-opacity-0":"#FFFFFF00","white-opacity-10":"#FFFFFF19","white-opacity-15":"#FFFFFF26","white-opacity-20":"#FFFFFF33","white-opacity-25":"#FFFFFF3F","white-opacity-5":"#FFFFFF0C","white-opacity-50":"#FFFFFF7F","yellow-100":"#FFE284","yellow-200":"#FFBF0B","yellow-25":"#FFF9E0","yellow-300":"#D8A100","yellow-400":"#B78800","yellow-50":"#FFF3C0","yellow-500":"#977000","yellow-600":"#785800","yellow-700":"#5B4200","yellow-75":"#FFEAA2","yellow-800":"#3F2D00","yellow-900":"#231A03","yellow-950":"#161003","yelloworange-100":"#FCDCC8","yelloworange-200":"#FDB586","yelloworange-25":"#FDF7F3","yelloworange-300":"#FF8A35","yelloworange-400":"#E46C00","yelloworange-50":"#FCEEE6","yelloworange-500":"#BD5800","yelloworange-600":"#974500","yelloworange-700":"#733300","yelloworange-75":"#FBE5D7","yelloworange-800":"#4E2402","yelloworange-900":"#2A1705","yelloworange-950":"#1A0E04","action-downvote":{light:"#6A5CFF",dark:"#6A5CFF"},"action-upvote":{light:"#D93900",dark:"#D93900"},"ai-background-weaker":{light:"#E7FDF5",dark:"#00382B"},"ai-plain":{light:"#006C56",dark:"#01A484"},"ai-plain-hover":{light:"#015140",dark:"#00C29D"},"alert-caution":{light:"#977000",dark:"#977000"},"avatar-gradient":{light:"",dark:""},"brand-background":{light:"#D93900",dark:"#D93900"},"brand-background-hover":{light:"#AE2C00",dark:"#AE2C00"},"brand-gradient-active":{light:"",dark:""},"brand-gradient-active-highlight":{light:"",dark:""},"brand-gradient-default":{light:"",dark:""},"brand-gradient-default-highlight":{light:"",dark:""},"brand-gradient-hover":{light:"",dark:""},"brand-gradient-hover-highlight":{light:"",dark:""},"brand-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"category-live":{light:"#D93900",dark:"#D93900"},"category-nsfw":{light:"#DE019F",dark:"#DE019F"},"category-spoiler":{light:"#131313",dark:"#F2F2F2"},"caution-background":{light:"#FFBF0B",dark:"#D8A100"},"caution-background-hover":{light:"#D8A100",dark:"#FFBF0B"},"caution-onBackground":{light:"#000000",dark:"#000000"},"caution-plain":{light:"#785800",dark:"#FFBF0B"},"caution-plain-hover":{light:"#5B4200",dark:"#FFE284"},"danger-background":{light:"#EB001F",dark:"#BC0117"},"danger-background-disabled":{light:"#FDB3A4",dark:"#340F05"},"danger-background-hover":{light:"#BC0117",dark:"#EB001F"},"danger-background-weaker":{light:"#FBDBD4",dark:"#650405"},"danger-content":{light:"#BC0117",dark:"#FF4F40"},"danger-content-default":{light:"#ffffff",dark:"#ffffff"},"danger-content-hover":{light:"#90000F",dark:"#FF8773"},"danger-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"danger-plain":{light:"#BC0117",dark:"#FF8773"},"danger-plain-hover":{light:"#90000F",dark:"#FDB3A4"},"downvote-background":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-background-disabled":{light:"#6a5cff4d",dark:"#6a5cff4d"},"downvote-background-hover":{light:"#523DFF",dark:"#523DFF"},"downvote-content":{light:"#523DFF",dark:"#9580FF"},"downvote-content-weak":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-disabled":{light:"#523DFF4c",dark:"#9580FF4c"},"downvote-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"downvote-onStrongScrim":{light:"#B29FFF",dark:"#B29FFF"},"downvote-onStrongScrim-disabled":{light:"#b29fff4d",dark:"#b29fff4d"},"downvote-onStrongScrim-weaker":{light:"#9580FF",dark:"#9580FF"},"downvote-plain":{light:"#523DFF",dark:"#9580FF"},"downvote-plain-disabled":{light:"#523dff4d",dark:"#9580ff4d"},"downvote-plain-weaker":{light:"#6A5CFF",dark:"#6A5CFF"},"elevation-large1":{light:"#0000003F",dark:"#0000007F"},"elevation-large2":{light:"#00000026",dark:"#00000033"},"elevation-medium1":{light:"#0000003F",dark:"#0000007F"},"elevation-medium2":{light:"#00000019",dark:"#00000033"},"elevation-small":{light:"#00000026",dark:"#00000054"},"elevation-xsmall":{light:"#0000003F",dark:"#000000AA"},favorite:{light:"#977000",dark:"#B78800"},"global-admin":{light:"#D93900",dark:"#D93900"},"global-alienblue":{light:"#1870F4",dark:"#1870F4"},"global-darkblue":{light:"#2A3236",dark:"#2A3236"},"global-focus":{light:"#029DD5",dark:"#007FAE"},"global-gold":{light:"#B78800",dark:"#D8A100"},"global-moderator":{light:"#008A10",dark:"#008A10"},"global-nsfw":{light:"#DE019F",dark:"#DE019F"},"global-offline":{light:"#667780",dark:"#667780"},"global-online":{light:"#00C61C",dark:"#00C61C"},"global-orangered":{light:"#FF4500",dark:"#FF4500"},"global-stars":{light:"#977000",dark:"#D8A100"},"gradient-media":{light:"",dark:""},"gradient-media-strong":{light:"",dark:""},"identity-admin":{light:"#D93900",dark:"#D93900"},"identity-coins":{light:"#B78800",dark:"#B78800"},"identity-moderator":{light:"#008A10",dark:"#008A10"},"identity-self":{light:"#01876D",dark:"#01876D"},"interactive-background-disabled":{light:"#0000000C",dark:"#FFFFFF0C"},"interactive-content-disabled":{light:"#0000003F",dark:"#FFFFFF3F"},"interactive-focused":{light:"#007FAE",dark:"#007FAE"},"interactive-pressed":{light:"#00000026",dark:"#FFFFFF26"},"inverted-interactive-background-disabled":{light:"#FFFFFF0C",dark:"#0000000C"},"inverted-interactive-content-disabled":{light:"#FFFFFF3F",dark:"#0000003F"},"inverted-interactive-pressed":{light:"#FFFFFF26",dark:"#00000026"},"inverted-neutral-background":{light:"#0E1113",dark:"#FFFFFF"},"inverted-neutral-background-hover":{light:"#181C1F",dark:"#F6F8F9"},"inverted-neutral-border":{light:"#FFFFFF33",dark:"#00000033"},"inverted-neutral-content":{light:"#B7CAD4",dark:"#333D42"},"inverted-neutral-content-strong":{light:"#EEF1F3",dark:"#181C1F"},"inverted-secondary-background":{light:"#2A3236",dark:"#E5EBEE"},"inverted-secondary-background-hover":{light:"#333D42",dark:"#DBE4E9"},"inverted-secondary-background-selected":{light:"#3D494E",dark:"#C9D7DE"},"inverted-secondary-onBackground":{light:"#FFFFFF",dark:"#000000"},"inverted-secondary-plain":{light:"#DBE4E9",dark:"#181C1F"},"inverted-secondary-plain-hover":{light:"#FFFFFF",dark:"#000000"},"media-background":{light:"#00000099",dark:"#00000099"},"media-background-hover":{light:"#000000cc",dark:"#000000cc"},"media-background-selected":{light:"#000000cc",dark:"#000000cc"},"media-border-selected":{light:"#FFFFFF",dark:"#FFFFFF"},"media-border-weak":{light:"#FFFFFF19",dark:"#FFFFFF19"},"media-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"media-onBackground-disabled":{light:"#FFFFFF3F",dark:"#FFFFFF3F"},"media-onBackground-weak":{light:"#E5EBEE",dark:"#E5EBEE"},"media-onbackground":{light:"#ffffff",dark:"#ffffff"},"media-onbackground-disabled":{light:"#ffffff3f",dark:"#ffffff3f"},"media-onbackground-weak":{light:"#B7CAD4",dark:"#B7CAD4"},"neutral-background":{light:"#FFFFFF",dark:"#0E1113"},"neutral-background-container":{light:"#F6F8F9",dark:"#181C1F"},"neutral-background-container-hover":{light:"#EEF1F3",dark:"#21272A"},"neutral-background-container-strong":{light:"#EEF1F3",dark:"#21272A"},"neutral-background-container-strong-hover":{light:"#E5EBEE",dark:"#2A3236"},"neutral-background-gilded":{light:"#FFF9E0",dark:"#181C1F"},"neutral-background-gilded-hover":{light:"#FFF3C0",dark:"#21272A"},"neutral-background-hover":{light:"#F6F8F9",dark:"#181C1F"},"neutral-background-medium":{light:"#F8F8F8",dark:"#131313"},"neutral-background-pinned":{light:"#FFFFFF",dark:"#0E1113"},"neutral-background-selected":{light:"#E5EBEE",dark:"#2A3236"},"neutral-background-strong":{light:"#FFFFFF",dark:"#181C1F"},"neutral-background-strong-hover":{light:"#F6F8F9",dark:"#21272A"},"neutral-background-weak":{light:"#F6F8F9",dark:"#000000"},"neutral-background-weak-hover":{light:"#EEF1F3",dark:"#0E1113"},"neutral-border":{light:"#00000033",dark:"#FFFFFF33"},"neutral-border-medium":{light:"#0000007F",dark:"#FFFFFF7F"},"neutral-border-strong":{light:"#181C1F",dark:"#F6F8F9"},"neutral-border-weak":{light:"#00000019",dark:"#FFFFFF19"},"neutral-content":{light:"#333D42",dark:"#B7CAD4"},"neutral-content-disabled":{light:"#D6D6D6",dark:"#303030"},"neutral-content-strong":{light:"#181C1F",dark:"#EEF1F3"},"neutral-content-weak":{light:"#5C6C74",dark:"#8BA2AD"},offline:{light:"#767676",dark:"#767676"},online:{light:"#01A816",dark:"#01A816"},"opacity-08":{light:"#13131314",dark:"#13131314"},"opacity-50":{light:"#0000007f",dark:"#F2F2F27f"},"opacity-highlight":{light:"",dark:""},pizzaRed:{light:"#ef5350",dark:"#c62828"},primary:{light:"#115BCA",dark:"#648EFC"},"primary-background":{light:"#0A449B",dark:"#115BCA"},"primary-background-hover":{light:"#0A2F6C",dark:"#1870F4"},"primary-background-selected":{light:"#0A1A3F",dark:"#648EFC"},"primary-border":{light:"#0A449B",dark:"#648EFC"},"primary-border-hover":{light:"#0A2F6C",dark:"#90A9FD"},"primary-hover":{light:"#0A449B",dark:"#90A9FD"},"primary-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"primary-onBackground-selected":{light:"#FFFFFF",dark:"#000000"},"primary-plain":{light:"#0A449B",dark:"#648EFC"},"primary-plain-hover":{light:"#0A2F6C",dark:"#90A9FD"},"primary-plain-visited":{light:"#7600A3",dark:"#CF5FFF"},"primary-visited":{light:"#9B00D4",dark:"#CF5FFF"},scrim:{light:"#00000099",dark:"#00000099"},"scrim-background":{light:"#00000099",dark:"#00000099"},"scrim-background-strong":{light:"#000000CC",dark:"#000000CC"},"scrim-gradient":{light:"",dark:""},"scrim-strong":{light:"#000000cc",dark:"#000000cc"},secondary:{light:"#21272A",dark:"#DBE4E9"},"secondary-background":{light:"#E5EBEE",dark:"#2A3236"},"secondary-background-hover":{light:"#DBE4E9",dark:"#333D42"},"secondary-background-selected":{light:"#C9D7DE",dark:"#3D494E"},"secondary-hover":{light:"#000000",dark:"#ffffff"},"secondary-onBackground":{light:"#000000",dark:"#FFFFFF"},"secondary-plain":{light:"#181C1F",dark:"#DBE4E9"},"secondary-plain-hover":{light:"#000000",dark:"#FFFFFF"},"secondary-plain-weak":{light:"#5C6C74",dark:"#8BA2AD"},"secondary-weak":{light:"#576F76",dark:"#748791"},"success-background":{light:"#008A10",dark:"#016E0B"},"success-background-hover":{light:"#016E0B",dark:"#008A10"},"success-content":{light:"#016E0B",dark:"#01A816"},"success-hover":{light:"#005306",dark:"#00C61C"},"success-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"success-plain":{light:"#016E0B",dark:"#00C61C"},"success-plain-hover":{light:"#005306",dark:"#58E15B"},"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"},"transparent-background-hover":{light:"#74879119",dark:"#66778019"},"ui-canvas":{light:"#F2F2F2",dark:"#080808"},"ui-modalbackground":{light:"#FFFFFF",dark:"#181C1F"},"upvote-background":{light:"#D93900",dark:"#D93900"},"upvote-background-disabled":{light:"#d939004d",dark:"#d939004d"},"upvote-background-hover":{light:"#AE2C00",dark:"#AE2C00"},"upvote-content":{light:"#AE2C00",dark:"#FF4500"},"upvote-content-weak":{light:"#FF4500",dark:"#FF4500"},"upvote-disabled":{light:"#AE2C004c",dark:"#FF45004c"},"upvote-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"upvote-onStrongScrim":{light:"#FF895D",dark:"#FF895D"},"upvote-onStrongScrim-disabled":{light:"#ff895d4d",dark:"#ff895d4d"},"upvote-onStrongScrim-weaker":{light:"#FF4500",dark:"#FF4500"},"upvote-plain":{light:"#AE2C00",dark:"#FF895D"},"upvote-plain-disabled":{light:"#ae2c004d",dark:"#ff895d4d"},"upvote-plain-weaker":{light:"#FF4500",dark:"#FF4500"},"warning-background":{light:"#B78800",dark:"#B78800"},"warning-background-hover":{light:"#977000",dark:"#D8A100"},"warning-content":{light:"#785800",dark:"#B78800"},"warning-content-hover":{light:"#5B4200",dark:"#D8A100"},"warning-onBackground":{light:"#000000",dark:"#000000"}};var yy={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"},by=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),ky=r=>r in Ic,Fc=r=>r in yy,Sy=r=>!!r.match(/^rgba?\(.*/),Py=r=>!!r.match(/^hsla?\(.*/),Cy=(r,e="light")=>{if(Fc(r))return bd(r);let i=Ic[r];return typeof i=="string"?i:i[e]},bd=r=>yy[r]??r,wy=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),g=Math.round(p*255);a.push(g)}return`#${a.map(p=>p.toString(16).padStart(2,"0")).join("")}`};import{BlockStackDirection as kd}from"@devvit/protos";var xc={stackParentLayout:{hasHeight:!0,hasWidth:!0,direction:kd.UNRECOGNIZED,alignment:void 0}};function Fy(r,e,t){if(!e)return{hasHeight:!1,hasWidth:!1};let{growDirection:i,stretchDirection:n}=CA(r?.grow,e.direction,e.alignment),o=t?.height?.value?.value||t?.height?.min?.value||Iy(2,i,n,e.hasHeight),a=t?.width?.value?.value||t?.width?.min?.value||Iy(1,i,n,e.hasWidth);return{hasHeight:!!o,hasWidth:!!a}}function Iy(r,e,t,i){return e===r&&i||t===r&&i}function CA(r,e,t){let i=e===kd.STACK_VERTICAL||e===kd.UNRECOGNIZED,n=e===kd.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,g=0;return n&&p?g=2:i&&p&&(g=1),{growDirection:o,stretchDirection:g}}import{BlockSizeUnit as br,BlockStackDirection as Sd}from"@devvit/protos";function Ci(r){if(r==null)return;if(typeof r=="number")return{value:r,unit:br.SIZE_UNIT_PERCENT};let e=r.match(/^(\d+(?:\.\d+)?)(px|%)?$/);if(e==null)return;let t=br.SIZE_UNIT_PERCENT;return e.at(2)==="px"&&(t=br.SIZE_UNIT_PIXELS),{value:Number.parseFloat(e[1]),unit:t}}function wA(r,e){return(r.width?.value?.unit===br.SIZE_UNIT_PERCENT||r.width?.min?.unit===br.SIZE_UNIT_PERCENT)&&(e.direction===Sd.STACK_HORIZONTAL||e.direction===Sd.STACK_DEPTH)&&(e.hasWidth||(r.width=void 0)),(r.height?.value?.unit===br.SIZE_UNIT_PERCENT||r.height?.min?.unit===br.SIZE_UNIT_PERCENT)&&(e.direction===Sd.STACK_VERTICAL||e.direction===Sd.STACK_DEPTH)&&(e.hasHeight||(r.height=void 0)),r}function Ac(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:Ci(r.width),min:Ci(r.minWidth),max:Ci(r.maxWidth)}:void 0,height:i?{value:Ci(r.height),min:Ci(r.minHeight),max:Ci(r.maxHeight)}:void 0,grow:r.grow};return e.stackParentLayout&&(n=wA(n,e.stackParentLayout)),n}}}var By="data-",IA=new Set(["onPress","onMessage"]),FA=new Map([["onPress",Dc.ACTION_CLICK],["onMessage",Dc.ACTION_WEBVIEW]]),fs,Fi=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},xc);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 gs.PADDING_NONE;case"xsmall":return gs.PADDING_XSMALL;case"small":return gs.PADDING_SMALL;case"medium":return gs.PADDING_MEDIUM;case"large":return gs.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return hs.RADIUS_NONE;case"small":return hs.RADIUS_SMALL;case"medium":return hs.RADIUS_MEDIUM;case"large":return hs.RADIUS_LARGE;case"full":return hs.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return Cd.GAP_NONE;case"small":return Cd.GAP_SMALL;case"medium":return Cd.GAP_MEDIUM;case"large":return Cd.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=Ec.ALIGN_START:e.includes("center")?i=Ec.ALIGN_CENTER:e.includes("end")&&(i=Ec.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=Pd.BORDER_WIDTH_NONE;break;case"thin":o=Pd.BORDER_WIDTH_THIN;break;case"thick":o=Pd.BORDER_WIDTH_THICK;break;default:o=Pd.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 Ii.TEXT_SIZE_XSMALL;case"small":return Ii.TEXT_SIZE_SMALL;case"medium":return Ii.TEXT_SIZE_MEDIUM;case"large":return Ii.TEXT_SIZE_LARGE;case"xlarge":return Ii.TEXT_SIZE_XLARGE;case"xxlarge":return Ii.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return Uc.TEXT_STYLE_BODY;case"metadata":return Uc.TEXT_STYLE_METADATA;case"heading":return Uc.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return Bc.TEXT_OUTLINE_NONE;case"thin":return Bc.TEXT_OUTLINE_THIN;case"thick":return Bc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return Oy.TEXT_WEIGHT_REGULAR;case"bold":return Oy.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return Mc.TEXT_OVERFLOW_CLIP;case"ellipsis":return Mc.TEXT_OVERFLOW_ELLIPSE}return Mc.TEXT_OVERFLOW_ELLIPSE}makeBlockButtonAppearance(e){switch(e){case"secondary":return Mt.BUTTON_APPEARANCE_SECONDARY;case"primary":return Mt.BUTTON_APPEARANCE_PRIMARY;case"plain":return Mt.BUTTON_APPEARANCE_PLAIN;case"bordered":return Mt.BUTTON_APPEARANCE_BORDERED;case"media":return Mt.BUTTON_APPEARANCE_MEDIA;case"destructive":return Mt.BUTTON_APPEARANCE_DESTRUCTIVE;case"caution":return Mt.BUTTON_APPEARANCE_CAUTION;case"success":return Mt.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 ps.IMAGE_RESIZE_NONE;case"fit":return ps.IMAGE_RESIZE_FIT;case"fill":return ps.IMAGE_RESIZE_FILL;case"cover":return ps.IMAGE_RESIZE_COVER;case"scale-down":return ps.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return Id.SPACER_XSMALL;case"small":return Id.SPACER_SMALL;case"medium":return Id.SPACER_MEDIUM;case"large":return Id.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return Rc.SPACER_INVISIBLE;case"thin":return Rc.SPACER_THIN;case"square":return Rc.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return wd.ICON_SIZE_XSMALL;case"small":return wd.ICON_SIZE_SMALL;case"medium":return wd.ICON_SIZE_MEDIUM;case"large":return wd.ICON_SIZE_LARGE}}makeBlockAvatarSize(e){switch(e){case"xxsmall":return Bt.AVATAR_SIZE_XXSMALL;case"xsmall":return Bt.AVATAR_SIZE_XSMALL;case"small":return Bt.AVATAR_SIZE_SMALL;case"medium":return Bt.AVATAR_SIZE_MEDIUM;case"large":return Bt.AVATAR_SIZE_LARGE;case"xlarge":return Bt.AVATAR_SIZE_XXLARGE;case"xxlarge":return Bt.AVATAR_SIZE_XXLARGE;case"xxxlarge":return Bt.AVATAR_SIZE_XXXLARGE}}makeBlockAvatarFacing(e){switch(e){case"left":return Ry.AVATAR_FACING_LEFT;case"right":return Ry.AVATAR_FACING_RIGHT}}makeBlockFullSnooSize(e){switch(e){case"xsmall":return wi.FULLSNOO_XSMALL;case"small":return wi.FULLSNOO_SMALL;case"medium":return wi.FULLSNOO_MEDIUM;case"large":return wi.FULLSNOO_LARGE;case"xlarge":return wi.FULLSNOO_XLARGE;case"xxlarge":return wi.FULLSNOO_XXLARGE}}makeBlockAvatarBackground(e){switch(e){case"dark":return Ey.AVATAR_BG_DARK;case"light":return Ey.AVATAR_BG_LIGHT}}makeBlockAnimationType(e){return e==="lottie"||e===void 0?Ty.ANIM_LOTTIE:Ty.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 Ay.ANIM_LOOP_REPEAT;case"bounce":return Ay.ANIM_LOOP_BOUNCE}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(By)).reduce((t,i)=>(t[i.substring(By.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);return IA.forEach(o=>{if(o in t){let a=t[o];i.push({type:FA.get(o)??Dc.UNRECOGNIZED,id:a.toString(),data:n})}}),i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),by(e)?e:ky(e)?Cy(e,t):Fc(e)?bd(e):Sy(e)?wy(e):Py(e)?e:(console.warn(`Could not parse color: ${e}.`),bd("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,xc))}wrapRoot(e,t){return this.makeBlock(De.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=Ac(t,i),p=Fy(t,i.stackParentLayout,c);return this.makeBlock(De.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(Oc.STACK_HORIZONTAL,e,t,i)}makeVStack(e,t,...i){return this.makeStackBlock(Oc.STACK_VERTICAL,e,t,i)}makeZStack(e,t,...i){return this.makeStackBlock(Oc.STACK_DEPTH,e,t,i)}makeText(e,t,...i){let n=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(De.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(De.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(De.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(De.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(De.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(De.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(De.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(De.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(De.BLOCK_WEBVIEW,e,t,{webviewConfig:{url:this.resolveAssetUrl(e.url,{webview:!0}),state:e.state}})}makeBlock(e,t,i,n){return{type:e,sizes:Ac(t,i),config:n,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}ensureRootBlock(e){let t;if(e.type===De.BLOCK_ROOT?(e.config?.rootConfig&&u.customPostType?.height&&(e.config.rootConfig.height=this.makeRootHeight(u.customPostType?.height)),t=e):t=this.wrapRoot(void 0,[e]),!t)throw new Error("Could not create root block");return t}};fs=new WeakMap;function Uy(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var Ly=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+=Ly(i);return e+=`</${r.type}>`,e};function xA(r){return" ".repeat(r)}function AA(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+=xA(t),n!==0&&(e+="<"),e+=o,n!==i.length-1&&(e+=`>
2
2
  `),!a&&o.indexOf("</")===-1&&o.charAt(o.length-1)!=="/"&&t++}return e}var Ne,Dy,vs,_c,ys,gt=class{constructor(e,t,i,n,o){l(this,Ne);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 Fi(()=>this.assets);this.effects=[];l(this,ys,!1);this.component=e,this.event=t,this.state={__renderState:{},...i},this.metadata=n,this.state.__realtimeChannels&&(this.realtimeChannels=this.state.__realtimeChannels);let a=Le({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,Ne,vs).call(this),t={type:this.component,props:e,children:[]},i=await this.processBlock(t);if(Uy(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,Ne,Dy).call(this)}async buildBlocksUI(){let e=S(this,Ne,vs).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 Uy(i),(u.debug.emitSnapshots||e.debug.emitSnapshots)&&console.debug(AA(Ly(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=vy(),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(),g=S(this,Ne,_c).call(this,p);return await this.processProps(n),{type:n.type,props:n.props,children:g}}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),g={...S(this,Ne,vs).call(this),...n.props,children:p},v;for(;v===void 0;)try{v=await n.type(g,S(this,Ne,vs).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===Nc.RENDER_INITIAL:!1}get isUserActionRender(){return this.event?this.event.type===Nc.RENDER_USER_ACTION:!1}get isEffectRender(){return this.event?this.event.type===Nc.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,ys)||(d(this,ys,!0),this.effects.push({type:My.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:My.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:this.realtimeChannels}}]:[]}getEffects(){return[...Pi(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}:{}}}};Ne=new WeakSet,Dy=function(){this.actions.clear(),this.currentComponentKey=[],this.currentHookIndex=0,this.pendingHooks=[],this.realtimeChannels=[],this.realtimeUpdated=!1},vs=function(){let e={...le(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[L.Timezone]?.values[0],locale:this.metadata[L.Language]?.values[0],dimensions:this.dimensions},...this.hooks};return e.debug.effects=this,e},_c=function(e){let t=[];for(let i of e)typeof i=="string"?t.push(i):i.type==="__fragment"?t.push(...S(this,Ne,_c).call(this,i.children)):t.push(i);return t},ys=new WeakMap;async function RA(r,e){let t=u.customPostType;if(!t)throw new Error("Custom post type not registered");let i=new gt((o,a)=>t.render(a),r.blocks,r.state,e,r.dimensions),n=await i.render();return EA.fromJSON({state:i.state,blocks:{ui:n},effects:i.getEffects()})}function Ny(r){r.provides(TA),U("RenderPost",RA)}import{GetFieldsResponse as OA,InstallationSettingsDefinition as BA}from"@devvit/protos";async function MA(){if(!u.installationSettings)throw new Error("Installation settings were not defined.");return OA.fromJSON({fields:{fields:pt(u.installationSettings)}})}async function UA(r,e){return yd(r,u.installationSettings,e)}function _y(r){r.provides(BA),U("GetSettingsFields",MA),U("ValidateForm",UA)}import{ContextActionDefinition as LA,ContextActionList as DA,ContextActionResponse as NA}from"@devvit/protos";var qy=r=>`menuItem.${r}`;function qc(r){return u.menuItems.find((e,t)=>qy(t)===r)}async function _A(r,e){let t=u.menuItems;if(!t.length)throw new Error("No menu items registered.");let i=t.map((n,o)=>({actionId:qy(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}));return DA.fromJSON({actions:i})}async function qA(r,e){let t=qc(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;h(a,"targetId is missing from ContextActionRequest");let c={targetId:a,location:r.comment?"comment":r.post?"post":"subreddit"},p=Object.assign(Le({ui:!0,metadata:e}),le(e,n,i),{uiEnvironment:{timezone:e[L.Timezone]?.values[0],locale:e[L.Language]?.values[0]}});return await t.onPress(c,p),NA.fromJSON({effects:Pi(p.ui)})}function Hy(r){r.provides(LA),U("GetActions",_A),U("OnAction",qA)}function ht(r){return r?r===!0?!0:r.enabled:!1}import{SchedulerHandlerDefinition as HA}from"@devvit/protos";async function jA(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(Le({metadata:e}),le(e));await i(n,o)}function jy(r){r.provides(HA),U("HandleScheduledAction",jA)}import{HandlerResult as WA,OnAppInstallDefinition as GA,OnAppUpgradeDefinition as VA,OnCommentCreateDefinition as zA,OnCommentDeleteDefinition as JA,OnCommentReportDefinition as $A,OnCommentSubmitDefinition as KA,OnCommentUpdateDefinition as XA,OnModActionDefinition as ZA,OnModMailDefinition as YA,OnPostCreateDefinition as QA,OnPostDeleteDefinition as eT,OnPostFlairUpdateDefinition as tT,OnPostReportDefinition as rT,OnPostSubmitDefinition as iT,OnPostUpdateDefinition as nT,OnPostNsfwUpdateDefinition as sT,OnPostSpoilerUpdateDefinition as oT}from"@devvit/protos";var xi;(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})(xi||(xi={}));function te(r,e){return h(e),async(t,i)=>{let n={...t,type:r},o=Object.assign(Le({metadata:i}),le(i)),a=await Promise.allSettled(e.map(p=>p(n,o))),c=aT(a);if(c)throw c.err;return WA.fromPartial({})}}function Wy(r){for(let e of u.triggerOnEventHandlers.keys())switch(e){case"PostSubmit":r.provides(iT),U("OnPostSubmit",te("PostSubmit",u.triggerOnEventHandlers.get(e)));break;case"PostCreate":r.provides(QA),U("OnPostCreate",te("PostCreate",u.triggerOnEventHandlers.get(e)));break;case"PostUpdate":r.provides(nT),U("OnPostUpdate",te("PostUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostReport":r.provides(rT),U("OnPostReport",te("PostReport",u.triggerOnEventHandlers.get(e)));break;case"PostDelete":r.provides(eT),U("OnPostDelete",te("PostDelete",u.triggerOnEventHandlers.get(e)));break;case"PostFlairUpdate":r.provides(tT),U("OnPostFlairUpdate",te("PostFlairUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentSubmit":r.provides(KA),U("OnCommentSubmit",te("CommentSubmit",u.triggerOnEventHandlers.get(e)));break;case"CommentCreate":r.provides(zA),U("OnCommentCreate",te("CommentCreate",u.triggerOnEventHandlers.get(e)));break;case"CommentUpdate":r.provides(XA),U("OnCommentUpdate",te("CommentUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentReport":r.provides($A),U("OnCommentReport",te("CommentReport",u.triggerOnEventHandlers.get(e)));break;case"CommentDelete":r.provides(JA),U("OnCommentDelete",te("CommentDelete",u.triggerOnEventHandlers.get(e)));break;case"AppInstall":r.provides(GA),U("OnAppInstall",te("AppInstall",u.triggerOnEventHandlers.get(e)));break;case"AppUpgrade":r.provides(VA),U("OnAppUpgrade",te("AppUpgrade",u.triggerOnEventHandlers.get(e)));break;case"ModAction":r.provides(ZA),U("OnModAction",te("ModAction",u.triggerOnEventHandlers.get(e)));break;case"ModMail":r.provides(YA),U("OnModMail",te("ModMail",u.triggerOnEventHandlers.get(e)));break;case"PostNsfwUpdate":r.provides(sT),U("OnPostNsfwUpdate",te("PostNsfwUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostSpoilerUpdate":r.provides(oT),U("OnPostSpoilerUpdate",te("PostSpoilerUpdate",u.triggerOnEventHandlers.get(e)));break;default:throw new Error(`Unknown trigger event: ${e}`)}}function aT(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=>xi.caughtToString(t)).join(`
3
- `))}}var Lb=qn(tb(),1),Db=qn(em(),1);import{EffectType as oR,HandleUIEventResponse as tm,UIEventHandlerDefinition as aR}from"@devvit/protos";async function dR(r,e){let t=r.state??{},i=(0,Lb.default)(t),n=Le({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 gt((C,w)=>u.customPostType?.render(w)??null,r.event,r.state,e,void 0);return await y.reconcile(),tm.fromJSON({state:y.state,effects:y.getEffects()})}let g=u.formDefinitions.get(p);if(!g)throw new Error(`Form with key ${p} not found`);let v,m;if(i.__contextAction){let{actionId:y,thingId:C}=i.__contextAction,w=qc(y);w?.location==="post"?v=C:w?.location==="comment"&&(m=C)}let b=Object.assign(n,le(e,v,m),{uiEnvironment:{timezone:e[L.Timezone]?.values[0],locale:e[L.Language]?.values[0]}});await g.onSubmit({values:Et(r.event.formSubmitted.results)},b)}else if(r.event?.realtimeEvent){if(u.customPostType){let p=new gt((g,v)=>u.customPostType?.render(v)??null,r.event,r.state,e,void 0);return await p.reconcile(),tm.fromJSON({state:p.state,effects:p.getEffects()})}}else if(r.event?.toastAction)throw new Error("Toast actions not yet implemented");let o=!(0,Db.default)(t,i),a=Pi(n.ui),c=o?[...a,{type:oR.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:0}}]:a;return tm.fromJSON({state:i,effects:c})}function Nb(r){r.provides(aR),U("HandleUIEvent",dR)}import{CustomPostDefinition as Vd,UIResponse as ck}from"@devvit/protos";import{EffectType as nm,Form as uR,ToastAppearance as Hb}from"@devvit/protos";function _b(r){let e=r.match(/form\.hook\.(.+)\.0/);if(e?.[1])return e[1]}var rm=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(Et(n.formSubmitted.results))}}};function im(r,e){let t=Ke({namespace:"useForm",initializer:i=>new rm(i,r,e)});return lR({id:t.hookId})}function lR(r){return`form.hook.${r.id}.0`}function qb(r,e){let t=_b(e);return r.getHook({id:t})}var Nt,Dd=class{constructor(e){l(this,Nt);d(this,Nt,e)}showForm(e,t){let i=qb(s(this,Nt),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=uR.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});gr(n.fields),o.fields=pt(n.fields),s(this,Nt).emitEffect(e,{type:nm.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?Hb.SUCCESS:Hb.NEUTRAL}:t={text:e},s(this,Nt).emitEffect(e.toString(),{type:nm.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,Nt).emitEffect(t,{type:nm.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}};Nt=new WeakMap;import{EffectType as cR,RealtimeSubscriptionStatus as jb}from"@devvit/protos";var _t,nt,qt,wr,ws,om,Nd=class Nd{constructor(e,t){l(this,ws);l(this,_t);l(this,nt);l(this,qt);l(this,wr);d(this,_t,t.context),d(this,nt,!!t.context._devvitContext?.debug.realtime),d(this,wr,e),d(this,qt,t.invalidate);let i=t.context.meta[L.App]?.values[0];if(!i)throw Error("useChannel missing app ID metadata");let n=t.context.meta[L.Installation]?.values[0];if(!n)throw Error("useChannel missing install ID from metadata");let o=`${i}:${n}:${e.name}`;if(Object.values(s(this,_t)._hooks).filter(c=>c instanceof Nd).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 jb.REALTIME_SUBSCRIBED:s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" connected`),this.state.connected=!0,s(this,qt).call(this),await s(this,wr).onSubscribed?.();break;case jb.REALTIME_UNSUBSCRIBED:s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" disconnected`),this.state.connected=!1,s(this,qt).call(this),await s(this,wr).onUnsubscribed?.();break;default:s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" received message: ${JSON.stringify(e,void 0,2)}`),s(this,wr).onMessage(t.event?.data??{});break}}async send(e){if(s(this,nt)&&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,_t).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,nt)&&console.debug(`[realtime] "${this.state.channel}" subscribed`),this.state.subscribed=!0,s(this,qt).call(this),S(this,ws,om).call(this))}unsubscribe(){this.state.subscribed&&(s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" unsubscribed`),this.state.subscribed=!1,s(this,qt).call(this),S(this,ws,om).call(this))}};_t=new WeakMap,nt=new WeakMap,qt=new WeakMap,wr=new WeakMap,ws=new WeakSet,om=function(){let e=Object.values(s(this,_t)._hooks).filter(t=>t instanceof Nd&&t.state.subscribed).map(t=>t.state.channel);s(this,_t).emitEffect(this.state.channel,{type:cR.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:e}})};var sm=Nd;function am(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 Ke({id:e,namespace:e,initializer:t=>new sm(r,t)})}import{EffectType as dm}from"@devvit/protos";function Wb(r){return typeof r=="object"&&r!==null&&"__deleted"in r}var Ir,yt,Ri=class Ri{constructor(e,t){l(this,Ir);this._segments=[];l(this,yt,{});this._prevHooks={};this._prevHookId="";this._effects={};this._changed={};this._touched={};this._requeueEvents=[];this._rootProps={};this._generated={};this._undeliveredHandlers={};this.request=e,this.meta=t,d(this,Ir,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,Ir).__cache??{}};for(let i in this._changed)e[i]=this._state[i];let t=new Set(Object.keys(this._state));return Object.keys(s(this,yt)).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 s(this,yt)}set _hooks(e){this._prevHooks=s(this,yt),d(this,yt,e)}get _state(){return s(this,Ir)}set _state(e){d(this,yt,{}),d(this,Ir,e)}push(e){this._segments.push({...e,next:0})}pop(){this._segments.pop()}addUndeliveredEventHandler(e,t){this._undeliveredHandlers[e]=t}addGlobalUndeliveredEventHandler(e,t){Ri.addGlobalUndeliveredEventHandler(e,t)}getHook(e){return s(this,yt)[e.id]}static addGlobalUndeliveredEventHandler(e,t){Ri._staticUndeliveredHandlers[e]=t}async handleUndeliveredEvent(e){let t={...Ri._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()}}};Ir=new WeakMap,yt=new WeakMap,Ri._staticUndeliveredHandlers={};var Oi=Ri;var Ht={};Oi.addGlobalUndeliveredEventHandler("intervals",async(r,e)=>{r.timer&&r.hook&&(delete Ht[r.hook],e.emitEffect("timers",{type:dm.EFFECT_SET_INTERVALS,interval:{intervals:Ht}}))});var jt,Bi,Is,Mi,lm=class{constructor(e,t,i){l(this,jt);l(this,Bi);l(this,Is);l(this,Mi);this.state={duration:{seconds:0,nanos:0},running:!1};d(this,Bi,i.invalidate),d(this,jt,i.hookId),d(this,Is,e),d(this,Mi,i.context);let n=Math.floor(t/1e3),o=t%1e3*1e6;this.state.duration={seconds:n,nanos:o}}onStateLoaded(){this.state.running?Ht[s(this,jt)]={duration:this.state.duration}:delete Ht[s(this,jt)]}async onUIEvent(e){await s(this,Is).call(this)}start(){Ht[s(this,jt)]={duration:this.state.duration},this.state.running=!0,s(this,Bi).call(this),s(this,Mi).emitEffect("timers",{type:dm.EFFECT_SET_INTERVALS,interval:{intervals:Ht}})}stop(){delete Ht[s(this,jt)],this.state.running=!1,s(this,Bi).call(this),s(this,Mi).emitEffect("timers",{type:dm.EFFECT_SET_INTERVALS,interval:{intervals:Ht}})}};jt=new WeakMap,Bi=new WeakMap,Is=new WeakMap,Mi=new WeakMap;function um(r,e){let t=Ke({namespace:"useInterval",initializer:i=>new lm(r,e,i)});return{start:()=>t.start(),stop:()=>t.stop()}}var Fr=class extends Error{};var cm="ServerCallRequired";function mm(r){return r?.message===cm}var Gb=qn(em(),1);function gm(r){if(r instanceof Error){if(r.message===cm)throw r;return console.error(r),{message:r.message,details:r.stack??""}}else return console.error(r),{message:"Unknown error",details:xi.caughtToString(r)}}var Xe,st,Ui,Fs,pm=class{constructor(e,t,i){l(this,Xe);l(this,st);l(this,Ui);l(this,Fs);d(this,Xe,!!i.context.devvitContext.debug.useAsync),s(this,Xe)&&console.debug("[useAsync] v1",t),this.state={data:null,load_state:"initial",error:null,depends:null},d(this,st,i.hookId),this.initializer=e,d(this,Ui,i.invalidate),d(this,Fs,i.context),this.localDepends=t.depends??null}onStateLoaded(){if(this.state.load_state!=="disabled"&&(s(this,Xe)&&console.debug("[useAsync] async onLoad ",s(this,st),this.state),s(this,Xe)&&console.debug("[useAsync] async onLoad have ",this.localDepends,"and",this.state.depends),!(0,Gb.default)(this.localDepends,this.state.depends)||this.state.load_state==="initial")){s(this,Xe)&&console.debug("[useAsync] attempting to resolve for hookId",s(this,st)),this.state.load_state="loading",this.state.depends=this.localDepends,s(this,Ui).call(this);let e={hook:s(this,st),async:!0,asyncRequest:{requestId:s(this,st)+"-"+JSON.stringify(this.state.depends)}};s(this,Xe)&&console.debug("[useAsync] onLoad requeue"),s(this,Fs).addToRequeueEvents(e)}}async onUIEvent(e,t){if(e.asyncRequest){let i={requestId:e.asyncRequest.requestId};try{i.data={value:await this.initializer()}}catch(o){i.error=gm(o)}let n={asyncResponse:i,hook:s(this,st)};s(this,Xe)&&console.debug("[useAsync] onReq requeue"),t.addToRequeueEvents(n)}else if(e.asyncResponse){let i=s(this,st)+"-"+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,Ui).call(this)):s(this,Xe)&&console.debug("[useAsync] onResp skip, stale event")}else throw new Error("Unknown event type")}};Xe=new WeakMap,st=new WeakMap,Ui=new WeakMap,Fs=new WeakMap;function mR(r,e={}){let t=Ke({namespace:"useAsync",initializer:i=>new pm(r,e,i)});return{data:t.state.data,error:t.state.error,loading:t.state.load_state==="loading"}}var bt,Li,xr,Ar,hm=class{constructor(e,t){this.state={value:null,load_state:"initial",error:null};l(this,bt);l(this,Li);l(this,xr);l(this,Ar);d(this,xr,e),d(this,Ar,t.hookId),d(this,bt,t.invalidate),d(this,Li,t.context)}async onUIEvent(){if(this.state.load_state==="loading"&&this._promise){try{this.state.value=await this._promise,this.state.load_state="loaded"}catch(e){this.state.load_state="error",this.state.error=gm(e)}s(this,bt).call(this)}else console.warn("Invalid state: ",this.state.load_state,this._promise)}setter(e){this.state.value=e instanceof Function?e(this.state.value):e,this.state.load_state="loaded",s(this,bt).call(this)}onStateLoaded(){if(this._promise=s(this,Li)._prevHooks[s(this,Ar)]?._promise,this.state.load_state==="loading")throw new Fr;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,xr)instanceof Function?s(this,xr).call(this):s(this,xr)}catch(t){console.log("error in loading async",t),this.state.load_state="error",s(this,bt).call(this);return}if(e instanceof Promise){this._promise=e,this.state.load_state="loading";let t={asyncRequest:{requestId:s(this,Ar)},hook:s(this,Ar)};throw s(this,Li).addToRequeueEvents(t),s(this,bt).call(this),new Fr}else this.state.value=e,this.state.load_state="loaded";s(this,bt).call(this)}}};bt=new WeakMap,Li=new WeakMap,xr=new WeakMap,Ar=new WeakMap;function fm(r){let e=Ke({namespace:"useState",initializer:t=>new hm(r,t)});return[e.state.value,e.setter.bind(e)]}var km={now(){return new Date}};function Vb(r){return`__autocache__${r}`}function zb(r){return`__lock__${r}`}var pR=300,gR=1e3,_d=5e3,vm=3,Jb=.1,$b=1e3,hR=3e4;function Kb(r){if(r.error)throw new Error(r.error);return r.value}var Wt,Gt,_e,Di,K,Xb,Zb,Yb,ym,Qb,ek,bm,tk,qd=class{constructor(e,t,i=km){l(this,K);l(this,Wt);l(this,Gt,{});l(this,_e);l(this,Di);d(this,Wt,e),d(this,Di,t),d(this,_e,i)}async cache(e,t){var a;(a=s(this,Di)).__cache??(a.__cache={}),d(this,Gt,s(this,Di).__cache),S(this,K,tk).call(this,t);let i=S(this,K,Xb).call(this,t.key);if(i!==void 0)return i;let n=await S(this,K,bm).call(this,t.key),o=await S(this,K,Zb).call(this,t,n,e);return Kb(o)}};Wt=new WeakMap,Gt=new WeakMap,_e=new WeakMap,Di=new WeakMap,K=new WeakSet,Xb=function(e){let t=s(this,Gt)[e];if(t){let i=s(this,_e).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<vm&&Math.random()<Jb&&t.errorTime+$b<i;if(t?.expires&&t.expires<i&&t.checkedAt+$b<i||n){delete s(this,Gt)[e];return}else return Kb(t)}},Zb=async function(e,t,i){let n=t?.expires,o=n?S(this,K,ek).call(this,n):1;return!t||t?.error&&t.errorCount<vm&&Jb>Math.random()||o>Math.random()?S(this,K,Yb).call(this,e,t,i):t},Yb=async function(e,t,i){let n=zb(e.key),o=s(this,_e).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Wt).set(n,"1",{expiration:a,nx:!0}))return S(this,K,Qb).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,_e).now();return S(this,K,ym).call(this,p,e.key,e.ttl)}},ym=async function(e,t,i){let n=Math.min(i,gR),o=await S(this,K,bm).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,pR)),S(this,K,ym).call(this,e,t,i)},Qb=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,Gt)[e]=t,await s(this,Wt).set(Vb(e),JSON.stringify(t),{expiration:new Date(o+hR)}),t.error&&t.errorCount<vm&&await s(this,Wt).del(zb(e)),t},ek=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},bm=async function(e){let t=await s(this,Wt).get(Vb(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,_e).now().getTime(),s(this,Gt)[e]=i,i}},tk=function(e){e.ttl<_d&&(console.warn(`Cache TTL cannot be less than ${_d} milliseconds! Updating ttl value of ${e.ttl} to ${_d}.`),e.ttl=_d)};function rk(r,e,t=km){let i=new qd(r,e,t);return i.cache.bind(i)}var Hd=class{buildContext(e,t,i){let n=new pi(i),o=new ci(i),a=new yi(i),c=new fi(i),p=new bi(i),g=new ki(i),v=new Dd(e),m=new mi(i),b=new li,y=new gi(i),C=rk(a,e._state),w={modLog:n,kvStore:o,redis:a,reddit:c,scheduler:p,settings:g,media:m,assets:b,realtime:y,ui:v,useState:fm,useChannel:am,useInterval:um,useForm:im,cache:C,dimensions:t.env?.dimensions,uiEnvironment:{timezone:i[L.Timezone]?.values[0],locale:i[L.Language]?.values[0],dimensions:t.env?.dimensions}},A=le(i,t.props?.postId);return A.debug.effects=e,{...A,...w}}};var ke=null;function ik(r){return JSON.parse(JSON.stringify(r))}function fR(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 vR(r){return r.blocking||r.resize?!1:!r.hook}function Ke({initializer:r,...e}){if(!ke)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.");fR(e.namespace);let t=ke.nextHookId(e),i=ke,n={hookId:t,invalidate:()=>{i._changed[t]=!0,i._state[t]=i?._hooks[t]?.state},context:ke},o=ke._state[t]===void 0||Wb(ke._state[t]);ke._hooks[t]=ke._hooks[t]??r(n);let a=ke._hooks[t];return o||(a.state=ke._state[t]),a.onStateLoaded?.(),o&&a.state!==void 0&&a.state!==null&&n.invalidate(),a}var yR=null,Ni,Gd,As,F,ue,jd,nk,Sm,sk,Pm,Cm,Wd,wm,ok,xs=class{constructor(e){l(this,F);l(this,Ni);l(this,Gd,new Hd);l(this,As,new Fi(()=>this._latestRenderContext?.devvitContext?.assets));this._latestRenderContext=null;s(this,F,ue)&&console.debug("[blocks] BlocksHandler v1"),d(this,Ni,e),yR=this}async handle(e,t){let i=new Oi(e,t),n=s(this,Gd).buildContext(i,e,t);i.devvitContext=n;let o,a=e.events,p=!e.events?.length||a.some(y=>!y.async),g=a.some(y=>y.blocking),v,m,b=[...a];for(a.length===0&&a.push({}),s(this,F,ue)&&console.debug("[blocks] starting processing events");a.length>0;){s(this,F,ue)&&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=ik(i._state);await S(this,F,nk).call(this,i,...y),i._state=w}else await S(this,F,sk).call(this,i,...y)}catch(w){if(!mm(w))throw w;if(s(this,F,ue)&&console.debug("[blocks] caught in handler",w),i._latestRenderContent=void 0,m){i._state=m._state,i._changed=v,i._effects=m._effects;let A=b.map(B=>{let me={...B};return me.retry=!0,me});i.addToRequeueEvents(...A);break}else throw console.error("[blocks] unhandled error in handler",w),w}s(this,F,ue)&&console.debug("[blocks] remaining events",i._requeueEvents);let C=[];for(let w of i._requeueEvents){if(!p&&!w.async){s(this,F,ue)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch A",w),C.push(w);continue}if(p&&w.async&&!g){s(this,F,ue)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch B",w),C.push(w);continue}s(this,F,ue)&&console.debug("[blocks] reprocessing event in BlocksHandler",w),a.push(w)}i._requeueEvents=C,a.length>0&&(v={...i._changed},m={_state:ik(i._state),_effects:{...i._effects}},b=[...a])}if(p){i._latestRenderContent||(i._latestRenderContent=S(this,F,Pm).call(this,s(this,Ni),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}}};Ni=new WeakMap,Gd=new WeakMap,As=new WeakMap,F=new WeakSet,ue=function(){return!!this._latestRenderContext?.devvitContext.debug.blocks},jd=function(e,...t){e._hooks={},S(this,F,Pm).call(this,s(this,Ni),e.request.props??{},e)},nk=async function(e,...t){S(this,F,jd).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,F,Sm).call(this,e,i)}))},Sm=async function(e,t){vR(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 mm(n)?s(this,F,ue)&&console.error("Server call required",n):console.error("Error in event handler",n),n}else await e.handleUndeliveredEvent(t)},sk=async function(e,...t){for(let i of t)s(this,F,ue)&&console.log("[blocks] handling main queue event",i),s(this,F,ue)&&console.log("[blocks] before",e._state),S(this,F,jd).call(this,e,i),await S(this,F,Sm).call(this,e,i),s(this,F,ue)&&console.log("[blocks] after",e._state);S(this,F,jd).call(this,e)},Pm=function(e,t,i){s(this,F,ue)&&console.debug("[blocks] renderRoot"),i._generated={},ke=i,this._latestRenderContext=i;try{let n=S(this,F,Cm).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 async. 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 Fr)return;throw n}finally{ke=null}},Cm=function(e,t,i){i.push({namespace:e.name||"anonymous",...t});try{let n=e(t,i.devvitContext);if(n instanceof Promise)throw new Error(`Components (found: ${e.name??"unknown component"}) cannot be async. To use data from an async endpoint, please use "const [data] = context.useState(async () => {/** your async code */})".`);return S(this,F,wm).call(this,n,i)}finally{i.pop()}},Wd=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,F,wm).call(this,i,t)))},wm=function(e,t){if(Array.isArray(e))return S(this,F,Wd).call(this,e,t);if(bR(e))if(e.type===void 0){t.push({namespace:"fragment",...e.props});let i=S(this,F,Wd).call(this,e.children,t);return t.pop(),i}else if(typeof e.type=="function"){let i={...e.props,children:e.children.flat(1/0)};return S(this,F,Cm).call(this,e.type,i,t)}else{t.push({namespace:e.type,...e.props});let i=S(this,F,Wd).call(this,e.children,t),n=S(this,F,ok).call(this,e.props??{});return t.pop(),[{type:e.type,children:i,props:n}]}else return[(e??"").toString()]},ok=function(e){let t={};for(let i in e)if(!(typeof e[i]>"u"))if(typeof e[i]=="function"){let n=Ke({namespace:i,key:!1,initializer:({hookId:o})=>({hookId:o,state:null,onUIEvent:a=>e[i](a.userAction?.data)})});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 bR(r){return typeof r=="object"&&r!=null&&"type"in r}var ak=r=>{let e=Number(r.trim().split(".").pop());return isNaN(e)?void 0:e},dk=r=>{let[e,t,i]=r.trim().split(";");if(!e||!t||!i){console.warn(`Received a malformed devvit-user-agent! Received: '${r}'`);return}if(e!=="Reddit"){console.warn(`Received unknown company name in user agent! Received: '${r}'`);return}if(t==="iOS"){let n=ak(i);if(n===void 0){console.warn(`Could not parse version number from user agent! Received: '${r}'`);return}return{company:"Reddit",platform:"iOS",rawVersion:i,versionNumber:n}}if(t==="Android"){let n=ak(i);if(n===void 0){console.warn(`Could not parse version number from user agent! Received: '${r}'`);return}return{company:"Reddit",platform:"Android",rawVersion:i,versionNumber:n}}if(t==="Shreddit")return{company:"Reddit",platform:"Shreddit",rawVersion:i};if(t==="Play")return{company:"Reddit",platform:"Play",rawVersion:i};console.warn("Received unknown platform:",t)},lk=r=>r?r.platform==="Android"?r.versionNumber<1819908:r.platform==="iOS"?r.versionNumber<614940:!1:(console.warn(`Could not parse devvit-user-agent! Received: '${JSON.stringify(r)}'`),!1),kR=r=>{switch(r){case"Android":return"https://play.google.com/store/apps/details?id=com.reddit.frontpage";case"iOS":return"https://apps.apple.com/us/app/reddit/id1064216828";case"Play":case"Shreddit":break;default:console.error(`No upgrade link for platform: ${r}`)}},SR=({platform:r},e)=>u.createElement("blocks",null,u.createElement("vstack",{alignment:"middle center",height:100,width:100},u.createElement("vstack",{maxWidth:"300px",gap:"large",alignment:"middle center"},u.createElement("vstack",{gap:"medium",alignment:"middle center"},u.createElement("image",{imageHeight:100,imageWidth:100,url:"https://i.redd.it/p1vmc5ulmpib1.png"}),u.createElement("text",{size:"large",weight:"bold",wrap:!0,alignment:"center"},"Uh oh, the app you're trying to use requires the latest version of Reddit. Please upgrade your app to continue.")),u.createElement("hstack",{alignment:"middle center"},u.createElement("button",{onPress:()=>{let t=kR(r);t?e.ui.navigateTo(t):console.warn("No upgrade link found for platform:",r)}},"Upgrade"))))),uk=r=>()=>u.createElement(SR,{platform:r});var PR=()=>u.createElement("vstack",{alignment:"center middle",width:"100%",height:"100%"},u.createElement("text",null,"This feature is not available yet")),CR=[[Vd,Vd.methods.renderPostContent,(r,e)=>u.customPostType?.render(e)??null],[Vd,Vd.methods.renderPostComposer,(r,e)=>u.createElement(PR,null)]];function wR(r){return async(e,t)=>{let i=dk(t["devvit-user-agent"]?.values?.[0]??"");if(i&&lk(i)){let o=new xs(uk(i.platform));return ck.fromJSON(await o.handle(e,t))}let n=new xs(r);return ck.fromJSON(await n.handle(e,t))}}function mk(r){for(let[e,t,i]of CR)r.provides(e),U(t.name,wR(i))}var _i,Ts,qi,Tr,Er,Hi,ji,Rr,Vt,Es,Rs,Or,_,D=class D extends cd{static configure(e){d(this,qi,{...s(this,qi),...e}),ht(e.http)&&this.use(P.HTTPDefinition),(ht(e.kvStore)||ht(e.redis))&&(this.use(P.KVStoreDefinition),this.use(P.RedisAPIDefinition)),ht(e.media)&&this.use(P.MediaServiceDefinition),ht(e.modLog)&&this.use(P.ModlogDefinition),ht(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)),ht(e.realtime)&&this.use(P.RealtimeDefinition)}static addMenuItem(e){s(this,ji).push(e)}static addCustomPostType(e){d(this,Tr,e)}static createForm(e,t){let i=`form.${s(this,Er).size}`;return s(this,Er).set(i,{form:e,onSubmit:t}),i}static addSchedulerJob(e){if(s(this,_)[P.SchedulerDefinition.fullName]||this.use(P.SchedulerDefinition),s(this,Rr).has(e.name))throw new Error(`Job ${e.name} is already defined`);s(this,Rr).set(e.name,e.onRun)}static addSettings(e){gr(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,Hi,t),i.length>0&&d(this,_i,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,Vt).has(e.event)?s(this,Vt).get(e.event)?.push(e.onEvent):s(this,Vt).set(e.event,[e.onEvent]),D}static provide(e){s(this,Rs).push(e)}static use(e,t){s(this,Or)[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,Or)[e.fullName].handler?.[n.name]?.(n.requestType?.fromPartial(o??{}),a);return s(this,_)[e.fullName]=i,i}static get redditAPIPlugins(){if(!ht(s(this,qi).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,ji)}static get customPostType(){return s(this,Tr)}static get formDefinitions(){return s(this,Er)}static get scheduledJobHandlers(){return s(this,Rr)}static get installationSettings(){return s(this,Hi)}static get appSettings(){return s(this,_i)}static get triggerOnEventHandlers(){return s(this,Vt)}static get assets(){return s(this,Ts)}static get webviewAssets(){return s(this,Es)}constructor(e){super(e),d(D,Ts,e.assets??{}),d(D,Es,e.webviewAssets??{});for(let t in s(D,Or)){let i=s(D,Or)[t];i.handler=e.use(i.def,i.options)}s(D,ji).length>0&&Hy(e),s(D,Rr).size>0&&jy(e),s(D,Tr)&&(Ny(e),mk(e)),(s(D,Tr)||s(D,Er).size>0)&&Nb(e),s(D,Hi)&&_y(e),s(D,_i)&&fy(e),s(D,Vt).size>0&&Wy(e);for(let t of s(D,Rs))e.provides(t)}};_i=new WeakMap,Ts=new WeakMap,qi=new WeakMap,Tr=new WeakMap,Er=new WeakMap,Hi=new WeakMap,ji=new WeakMap,Rr=new WeakMap,Vt=new WeakMap,Es=new WeakMap,Rs=new WeakMap,Or=new WeakMap,_=new WeakMap,D.debug={},l(D,_i),l(D,Ts,{}),l(D,qi,{}),l(D,Tr),l(D,Er,new Map),l(D,Hi),l(D,ji,[]),l(D,Rr,new Map),l(D,Vt,new Map),l(D,Es,{}),l(D,Rs,[]),l(D,Or,{}),l(D,_,{});var u=D;(e=>{function r(t,i,...n){return{type:t,props:i,children:n}}e.createElement=r})(u||(u={}));function X(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 Im;(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"})(Im||(Im={}));var pk="text",gk="raw",hk="br",fk="link",vk="c/",yk="p/",bk="r/",kk="u/",Sk="@",Pk="spoilertext",Ck="par",wk="h",Ik="hr",Fk="blockquote",xk="code",Ak="li",Tk="list",Ek="L",Rk="R",Ok="C",Bk="table",Mk="embed",Uk="img",Lk="gif",Dk="video";function Nk(r){return{e:Lk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function _k(r,e){let t={},i=[];return Object.assign(t,Os(t,i),Bs(t,i),Ms(t,i),Ds(t,i),Ns(t,i),_s(t,i)),e(t),{e:Fk,c:i,...r.author&&{a:r.author}}}function qk(r,e){let t={},i=[];return Object.assign(t,xm(t,i)),e(t),{e:xk,c:i,...r.language&&{l:r.language}}}function Hk(r){return{e:vk,t:r.permalink}}function jk(r,e){let t={},i=[];return Object.assign(t,xm(t,i),Ls(t,i)),e(t),{e:wk,l:r.level,c:i}}function Wk(r){return{e:Mk,u:r.sourceUrl,c:r.contentUrl,x:r.width,y:r.height}}function Gk(){return{e:Ik}}function Vk(r){return{e:Uk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function zk(){return{e:hk}}function Jk(r){return{e:fk,t:r.text,u:r.url,...r.formatting&&{f:r.formatting},...r.tooltip&&{a:r.tooltip}}}function $k(r,e){let t={},i=[];return Object.assign(t,uS(t,i)),e(t),{e:Tk,o:r.ordered,c:i}}function Kk(r){let e={},t=[];return Object.assign(e,Os(e,t),Bs(e,t),Ms(e,t),zd(e,t),Ds(e,t),Ns(e,t),_s(e,t)),r(e),{e:Ak,c:t}}function Xk(r){let e={},t=[];return Object.assign(e,Jd(e,t),Ls(e,t),Fm(e,t),Am(e,t),Us(e,t)),r(e),{e:Ck,c:t}}function Zk(r){return{e:yk,t:r.permalink}}function Yk(r){return{e:gk,t:r}}function Qk(r){let e={},t=[];return Object.assign(e,Jd(e,t),Ls(e,t),Fm(e,t)),r(e),{e:Pk,c:t}}function eS(r){return{e:bk,t:r.subredditName,l:r.showPrefix}}function tS(r){let e={},t=[],i=[];return Object.assign(e,cS(e,t,i)),r(e),{e:Bk,h:t,c:i}}function rS(r){let[e,t]=lS();return r(e),{c:t}}function iS(r,e){let[t,i]=lS();e(t);let n;switch(r.columnAlignment){case"left":n=Ek;break;case"right":n=Rk;break;case"center":n=Ok;break}return{...n&&{a:n},...i&&{c:i}}}function nS(r){let e={},t=[];return Object.assign(e,mS(e,t)),r(e),t}function sS(r){return{e:pk,t:r.text,...r.formatting&&{f:r.formatting}}}function oS(r){return{e:kk,t:r.username,l:r.showPrefix}}function aS(r){return{e:Sk,t:r.username,l:r.showPrefix}}function dS(r){return{e:Dk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur},...r.thumbnail&&{p:r.thumbnail},...r.convertToGif&&{gifify:r.convertToGif}}}function lS(){let r={},e=[];return Object.assign(r,Jd(r,e),Ls(r,e),Am(r,e),Us(r,e)),[r,e]}function Os(r,e){return{blockQuote(t,i){return e.push(_k(t,i)),r}}}function Bs(r,e){return{codeBlock(t,i){return e.push(qk(t,i)),r}}}function pS(r,e){return{embed(t){return e.push(Wk(t)),r}}}function Ms(r,e){return{heading(t,i){return e.push(jk(t,i)),r}}}function zd(r,e){return{horizontalRule(){return e.push(Gk()),r}}}function Us(r,e){return{image(t){return e.push(Vk(t)),r},animatedImage(t){return e.push(Nk(t)),r}}}function Fm(r,e){return{linebreak(){return e.push(zk()),r}}}function Ls(r,e){return{link(t){return e.push(Jk(t)),r},commentLink(t){return e.push(Hk(t)),r},postLink(t){return e.push(Zk(t)),r},subredditLink(t){return e.push(eS(t)),r},userLink(t){return e.push(oS(t)),r},userMention(t){return e.push(aS(t)),r}}}function Ds(r,e){return{list(t,i){return e.push($k(t,i)),r}}}function uS(r,e){return{item(t){return e.push(Kk(t)),r}}}function Ns(r,e){return{paragraph(t){return e.push(Xk(t)),r}}}function xm(r,e){return{rawText(t){return e.push(Yk(t)),r}}}function Am(r,e){return{spoiler(t){return e.push(Qk(t)),r}}}function cS(r,e,t){return{headerCell(i,n){return e.push(iS(i,n)),r},row(i){return t.push(nS(i)),r}}}function _s(r,e){return{table(t){return e.push(tS(t)),r}}}function mS(r,e){return{cell(t){return e.push(rS(t)),r}}}function Jd(r,e){return{text(t){return e.push(sS(t)),r}}}function gS(r,e){return{video(t){return e.push(dS(t)),r}}}var IR=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},FR=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)},$d,qs=class{constructor(){$d.set(this,void 0);let e=[];Object.assign(this,Ns(this,e),Ms(this,e),zd(this,e),Os(this,e),Bs(this,e),pS(this,e),Ds(this,e),_s(this,e),Us(this,e),gS(this,e)),IR(this,$d,{document:e},"f")}build(){return JSON.stringify(FR(this,$d,"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}};$d=new WeakMap;function Wi(r){let e;return r instanceof qs?e=r.build():typeof r=="object"?e=JSON.stringify(r):e=r,e}var hS=100,fS=1/0,Br,Mr,zt,Gi,Vi,Kd,G=class{constructor(e){l(this,Vi);l(this,Br);l(this,Mr);l(this,zt);l(this,Gi,!1);this.pageSize=hS;this.limit=fS;this.children=[];X(this),this._fetch=e.fetch,this.pageSize=e.pageSize??hS,this.limit=e.limit??fS,d(this,Mr,e.after),d(this,Br,e.before),d(this,zt,e.more),e.children&&(this.children=e.children)}get hasMore(){return!s(this,Gi)||!!(s(this,Mr)||s(this,Br)||s(this,zt))}async*[Symbol.asyncIterator](){let e=0;for(;;){if(e===this.children.length)if(this.hasMore){if((await S(this,Vi,Kd).call(this)).length===0)break}else break;if(yield this.children[e],e++,e===this.limit)break}}setMore(e){d(this,zt,e)}preventInitialFetch(){d(this,Gi,!0)}async all(){for(;this.hasMore&&this.children.length<this.limit;)await S(this,Vi,Kd).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,Vi,Kd).call(this);return this.children.slice(0,t)}};Br=new WeakMap,Mr=new WeakMap,zt=new WeakMap,Gi=new WeakMap,Vi=new WeakSet,Kd=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,Br),after:s(this,Mr),limit:this.pageSize,more:s(this,zt)});return this.children.push(...e),d(this,Br,t),d(this,Mr,i),d(this,zt,n),d(this,Gi,!0),e};function xR(r){try{return!0}catch{return!1}}function AR(r){try{return!0}catch{return!1}}var Hs,Tm,Me=class{constructor(){}static get(e,t){let i=u.redditAPIPlugins.ModNote;return new G({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,Hs,Tm).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,Hs,Tm).call(this,n.created)}static async addRemovalNote(e,t){await u.redditAPIPlugins.ModNote.PostRemovalNote(e,t)}};Hs=new WeakSet,Tm=function(e){if(h(e.id,"Mod note ID is null or undefined"),h(e.createdAt,"Mod note createdAt is null or undefined"),h(e.type,"Mod note type is null or undefined"),h(e.subreddit,"Mod note subreddit is null or undefined"),h(e.subredditId,"Mod note subredditId is null or undefined"),h(e.operator,"Mod note operator is null or undefined"),h(e.operatorId,"Mod note operatorId is null or undefined"),h(e.user,"Mod note user is null or undefined"),h(e.userId,"Mod note userId is null or undefined"),h(e.userNoteData,"Mod note userNote is null or undefined"),h(e.modActionData,"Mod note modAction is null or undefined"),!xR(e.userNoteData?.label??""))throw new Error(`Invalid user note label: ${e.userNoteData?.label}`);if(!AR(e.type))throw new Error(`Invalid mod note type: ${e.type}`);return{id:e.id,user:{id:ne(e.userId??""),name:e.user},subreddit:{id:Re(e.subredditId??""),name:e.subreddit},operator:{id:ne(e.operatorId??""),name:e.operator},createdAt:new Date(e.createdAt*1e3),userNote:{note:e.userNoteData?.note,redditId:ve(e.userNoteData?.redditId??""),label:e.userNoteData?.label},type:e.type}},l(Me,Hs);var kt=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 vS=["all","wiki","posts","access","mail","config","flair","channels","chat_config","chat_operator","community_chat"];function TR(r,e){return e.map(t=>(r.includes(t)?"+":"-")+t).join(",")}function Em(r){return TR(r,vS)}function yS(r){return r.filter(e=>vS.includes(e))}var ER=(t=>(t.User="USER_FLAIR",t.Post="LINK_FLAIR",t))(ER||{}),Lr,zi,Ji,$i,Ki,Xi,Zi,Yi,Qi,en,tn,Xd,Ze=class Ze{constructor(e,t,i){l(this,Lr);l(this,zi);l(this,Ji);l(this,$i);l(this,Ki);l(this,Xi);l(this,Zi);l(this,Yi);l(this,Qi);l(this,en);X(this),h(e.id),h(e.text),d(this,Lr,e.id),d(this,zi,t),d(this,Ji,e.text),d(this,$i,RR(e.textColor)),d(this,Ki,OR(e.backgroundColor)),d(this,Xi,BR(e.allowableContent)),d(this,Zi,e.modOnly),d(this,Yi,e.maxEmojis),d(this,Qi,e.textEditable),d(this,en,i)}get id(){return s(this,Lr)}get text(){return s(this,Ji)}get textColor(){return s(this,$i)}get backgroundColor(){return s(this,Ki)}get allowableContent(){return s(this,Xi)}get modOnly(){return s(this,Zi)}get maxEmojis(){return s(this,Yi)}get allowUserEdits(){return s(this,Qi)}async delete(){return Ze.deleteFlairTemplate(s(this,Lr),s(this,zi),s(this,en))}async edit(e){return Ze.editFlairTemplate({id:s(this,Lr),subredditName:s(this,zi),text:e.text??s(this,Ji),allowableContent:e.allowableContent??s(this,Xi),backgroundColor:e.backgroundColor??s(this,Ki),maxEmojis:e.maxEmojis??s(this,Yi),modOnly:e.modOnly??s(this,Zi),textColor:e.textColor??s(this,$i),allowUserEdits:e.allowUserEdits??s(this,Qi)},s(this,en))}static async createPostFlairTemplate(e,t){var i;return S(i=Ze,tn,Xd).call(i,{...e,flairType:"LINK_FLAIR"},t)}static async createUserFlairTemplate(e,t){var i;return S(i=Ze,tn,Xd).call(i,{...e,flairType:"USER_FLAIR"},t)}static async editFlairTemplate(e,t){var i;return S(i=Ze,tn,Xd).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)}};Lr=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 WeakMap,en=new WeakMap,tn=new WeakSet,Xd=async function(e,t){let{subredditName:i,allowableContent:n="all",backgroundColor:o="transparent",flairType:a="",maxEmojis:c=10,modOnly:p=!1,text:g,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:g,textColor:v,textEditable:m,flairTemplateId:b,cssClass:"",overrideCss:!1},t);return new Ze(C,i,t)},l(Ze,tn);var de=Ze;function js(r){return{flairCssClass:r.flairCssClass,user:r.user,flairText:r.flairText}}var Jt,Rm,Om,Ur=class Ur{static async getUserFlairBySubreddit(e,t){return u.redditAPIPlugins.Flair.FlairList(e,t)}static setUserFlair(e,t){var i;return S(i=Ur,Jt,Rm).call(i,e,t)}static setPostFlair(e,t){var i;return S(i=Ur,Jt,Rm).call(i,{...e,postId:fe(e.postId)},t)}static async removePostFlair(e,t,i){var n;return S(n=Ur,Jt,Om).call(n,e,t,void 0,i)}static async removeUserFlair(e,t,i){var n;return S(n=Ur,Jt,Om).call(n,e,void 0,t,i)}};Jt=new WeakSet,Rm=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)},Om=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(Ur,Jt);var Ue=Ur;function RR(r){if(h(r,"Flair text color is required"),r==="light"||r==="dark")return r;throw new Error(`Invalid flair text color: ${r}`)}function OR(r){if(h(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 BR(r){if(r==="all"||r==="text"||r==="emoji")return r;throw new Error(`Invalid allowable content: ${r}`)}import{Block as HR}from"@devvit/protos";var PS=qn(SS(),1);var rn,Gs,nn,Vs,zs,Js,$s,Ks,sn,Xs,Zs,Ys,Qs,eo,to,$t,ro,io,Nr,on,Kt,an,dn,ln,_r,Xt,Zt,un,Yt,Qt,er,St,no,so,cn,mn,N,H=class H{constructor(e,t){l(this,rn);l(this,Gs);l(this,nn);l(this,Vs);l(this,zs);l(this,Js);l(this,$s);l(this,Ks);l(this,sn);l(this,Xs);l(this,Zs);l(this,Ys);l(this,Qs);l(this,eo);l(this,to);l(this,$t);l(this,ro);l(this,io);l(this,Nr);l(this,on);l(this,Kt);l(this,an);l(this,dn);l(this,ln);l(this,_r);l(this,Xt);l(this,Zt);l(this,un);l(this,Yt);l(this,Qt);l(this,er);l(this,St);l(this,no);l(this,so);l(this,cn);l(this,mn);l(this,N);X(this),h(e.id,"Post is missing id"),h(e.title,"Post is missing title"),h(e.createdUtc,"Post is missing created date"),h(e.author,"Post is missing author name"),h(e.subreddit,"Post is missing subreddit name"),h(e.subredditId,"Post is missing subreddit id"),h(e.url,"Post is missing url"),h(e.permalink,"Post is missing permalink"),d(this,rn,fe(`t3_${e.id}`)),d(this,nn,e.author),d(this,Gs,e.authorFullname?ne(e.authorFullname):void 0),d(this,zs,Re(e.subredditId)),d(this,Js,e.subreddit),d(this,Ys,e.score??0),d(this,Qs,e.numComments??0),d(this,eo,e.numReports??0);let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Vs,i),d(this,Ks,e.title),d(this,sn,e.selftext),d(this,Xs,e.selftextHtml),d(this,Zs,e.url),d(this,$s,e.permalink),e.thumbnail&&e.thumbnail!=="self"&&e.thumbnail!=="nsfw"&&e.thumbnailHeight!=null&&e.thumbnailWidth!=null&&d(this,to,{url:e.thumbnail,height:e.thumbnailHeight,width:e.thumbnailWidth}),d(this,$t,e.approved??!1),d(this,ro,e.approvedAtUtc??0),d(this,io,e.bannedAtUtc??0),d(this,Kt,e.removed??!1),d(this,an,e.removedBy),d(this,dn,e.removedByCategory),d(this,Nr,e.spam??!1),d(this,on,e.stickied??!1),d(this,ln,e.archived??!1),d(this,_r,e.edited??!1),d(this,Xt,e.locked??!1),d(this,Zt,e.over18??!1),d(this,un,e.quarantine??!1),d(this,Yt,e.spoiler),d(this,Qt,e.hidden??!1),d(this,er,e.ignoreReports??!1),d(this,St,e.distinguished),d(this,so,e.secureMedia),d(this,cn,(e.modReports??[]).map(([n])=>n)),d(this,mn,(e.userReports??[]).map(([n])=>n)),d(this,N,t),(e.linkFlairBackgroundColor||e.linkFlairCssClass||e.linkFlairText||e.linkFlairType||e.linkFlairTemplateId||e.linkFlairRichtext||e.linkFlairTextColor)&&d(this,no,{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,rn)}get authorId(){return s(this,Gs)}get authorName(){return s(this,nn)}get subredditId(){return s(this,zs)}get subredditName(){return s(this,Js)}get permalink(){return s(this,$s)}get title(){return s(this,Ks)}get body(){return s(this,sn)}get bodyHtml(){return s(this,Xs)}get url(){return s(this,Zs)}get thumbnail(){return s(this,to)}get createdAt(){return s(this,Vs)}get score(){return s(this,Ys)}get numberOfComments(){return s(this,Qs)}get numberOfReports(){return s(this,eo)}get approved(){return s(this,$t)}get approvedAtUtc(){return s(this,ro)}get bannedAtUtc(){return s(this,io)}get spam(){return s(this,Nr)}get stickied(){return s(this,on)}get removed(){return s(this,Kt)}get removedBy(){return s(this,an)}get removedByCategory(){return s(this,dn)}get archived(){return s(this,ln)}get edited(){return s(this,_r)}get locked(){return s(this,Xt)}get nsfw(){return s(this,Zt)}get quarantined(){return s(this,un)}get spoiler(){return s(this,Yt)}get hidden(){return s(this,Qt)}get ignoringReports(){return s(this,er)}get distinguishedBy(){return s(this,St)}get comments(){return ee.getComments({postId:this.id},s(this,N))}get flair(){return s(this,no)}get secureMedia(){return s(this,so)}get userReportReasons(){return s(this,mn)}get modReportReasons(){return s(this,cn)}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,an),removedByCategory:s(this,dn),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,cn),userReportReasons:s(this,mn)}}isApproved(){return s(this,$t)}isSpam(){return s(this,Nr)}isStickied(){return s(this,on)}isRemoved(){return s(this,Kt)}isArchived(){return s(this,ln)}isEdited(){return s(this,_r)}isLocked(){return s(this,Xt)}isNsfw(){return s(this,Zt)}isQuarantined(){return s(this,un)}isSpoiler(){return s(this,Yt)}isHidden(){return s(this,Qt)}isIgnoringReports(){return s(this,er)}isDistinguishedBy(){return s(this,St)}async edit(e){let t=await H.edit({id:this.id,...e},s(this,N));d(this,sn,t.body),d(this,_r,t.edited)}async addComment(e){return ee.submit({id:this.id,...e},s(this,N))}async delete(){return H.delete(this.id,s(this,N))}async approve(){await H.approve(this.id,s(this,N)),d(this,$t,!0),d(this,Kt,!1)}async remove(e=!1){await H.remove(this.id,e,s(this,N)),d(this,Kt,!0),d(this,Nr,e),d(this,$t,!1)}async lock(){await H.lock(this.id,s(this,N)),d(this,Xt,!0)}async unlock(){await H.unlock(this.id,s(this,N)),d(this,Xt,!1)}async hide(){await H.hide(this.id,s(this,N)),d(this,Qt,!0)}async unhide(){await H.unhide(this.id,s(this,N)),d(this,Qt,!1)}async markAsNsfw(){await H.markAsNsfw(this.id,s(this,N)),d(this,Zt,!0)}async unmarkAsNsfw(){await H.unmarkAsNsfw(this.id,s(this,N)),d(this,Zt,!1)}async markAsSpoiler(){await H.markAsSpoiler(this.id,s(this,N)),d(this,Yt,!0)}async unmarkAsSpoiler(){await H.unmarkAsSpoiler(this.id,s(this,N)),d(this,Yt,!1)}async sticky(e){await H.sticky(this.id,e,s(this,N))}async unsticky(){await H.unsticky(this.id,s(this,N))}async distinguish(){let{distinguishedBy:e}=await H.distinguish(this.id,!1,s(this,N));d(this,St,e)}async distinguishAsAdmin(){let{distinguishedBy:e}=await H.distinguish(this.id,!0,s(this,N));d(this,St,e)}async undistinguish(){let{distinguishedBy:e}=await H.undistinguish(this.id,s(this,N));d(this,St,e)}async ignoreReports(){await H.ignoreReports(this.id,s(this,N)),d(this,er,!0)}async unignoreReports(){await H.unignoreReports(this.id,s(this,N)),d(this,er,!1)}async getAuthor(){return I.getByUsername(s(this,nn),s(this,N))}async crosspost(e){return H.crosspost({...e,postId:this.id},s(this,N))}addRemovalNote(e){return Me.addRemovalNote({itemIds:[s(this,rn)],...e},s(this,N))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=pr(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 H(a.data,t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,n;if("preview"in e){h(t,"Missing metadata in `SubmitPostOptions`");let c=await new gt(()=>e.preview,void 0,{},t,void 0).buildBlocksUI(),p=HR.encode(c).finish();n=await i.Submit({kind:"custom",sr:e.subredditName,richtextJson:(0,PS.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?Wi(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 H.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 H.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=Wi(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 H.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 h(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 h(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 G({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 Ws(o,t)}})}static getHotPosts(e={location:"GLOBAL"},t){let i=u.redditAPIPlugins.Listings;return new G({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 Ws(o,t)}})}static getNewPosts(e,t){let i=u.redditAPIPlugins.Listings;return new G({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 Ws(o,t)}})}static getRisingPosts(e,t){let i=u.redditAPIPlugins.Listings;return new G({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 Ws(o,t)}})}static getPostsByUser(e,t){let i=u.redditAPIPlugins.Users;return new G({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 Ws(o,t)}})}};rn=new WeakMap,Gs=new WeakMap,nn=new WeakMap,Vs=new WeakMap,zs=new WeakMap,Js=new WeakMap,$s=new WeakMap,Ks=new WeakMap,sn=new WeakMap,Xs=new WeakMap,Zs=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,eo=new WeakMap,to=new WeakMap,$t=new WeakMap,ro=new WeakMap,io=new WeakMap,Nr=new WeakMap,on=new WeakMap,Kt=new WeakMap,an=new WeakMap,dn=new WeakMap,ln=new WeakMap,_r=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,un=new WeakMap,Yt=new WeakMap,Qt=new WeakMap,er=new WeakMap,St=new WeakMap,no=new WeakMap,so=new WeakMap,cn=new WeakMap,mn=new WeakMap,N=new WeakMap;var z=H;function Ws(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>new z(i.data,e)),before:r.data.before,after:r.data.after}}var jR=(q=>(q.Custom="CUSTOM",q.Reddit="REDDIT",q.Instagram="INSTAGRAM",q.Twitter="TWITTER",q.Tiktok="TIKTOK",q.Twitch="TWITCH",q.Facebook="FACEBOOK",q.Youtube="YOUTUBE",q.Tumblr="TUMBLR",q.Spotify="SPOTIFY",q.Soundcloud="SOUNDCLOUD",q.Beacons="BEACONS",q.Linktree="LINKTREE",q.Discord="DISCORD",q.Venmo="VENMO",q.CashApp="CASH_APP",q.Patreon="PATREON",q.Kofi="KOFI",q.Paypal="PAYPAL",q.Cameo="CAMEO",q.Onlyfans="ONLYFANS",q.Substack="SUBSTACK",q.Kickstarter="KICKSTARTER",q.Indiegogo="INDIEGOGO",q.BuyMeACoffee="BUY_ME_A_COFFEE",q.Shopify="SHOPIFY",q))(jR||{}),oo,pn,ao,lo,uo,co,mo,tr,po,go,at,qr=class qr{constructor(e,t){l(this,oo);l(this,pn);l(this,ao);l(this,lo);l(this,uo);l(this,co);l(this,mo);l(this,tr,new Map);l(this,po);l(this,go);l(this,at);X(this),h(e.id,"User ID is missing or undefined"),h(e.name,"Username is missing or undefined"),h(e.createdUtc,"User is missing created date"),d(this,oo,ne(ud(e.id)?e.id:`t2_${e.id}`)),d(this,pn,e.name),d(this,co,e.over18??!1),d(this,mo,e.isEmployee??!1);let i=new Date(0);if(i.setUTCSeconds(e.createdUtc),d(this,ao,i),d(this,lo,e.linkKarma??0),d(this,uo,e.commentKarma??0),e.modPermissions)for(let[n,o]of Object.entries(e.modPermissions))s(this,tr).set(n,yS(o));d(this,po,new URL(e.subreddit?.url??"","https://www.reddit.com").toString()),d(this,go,e.subreddit?.url??""),d(this,at,t)}get id(){return s(this,oo)}get username(){return s(this,pn)}get createdAt(){return s(this,ao)}get linkKarma(){return s(this,lo)}get commentKarma(){return s(this,uo)}get nsfw(){return s(this,co)}get isAdmin(){return s(this,mo)}get modPermissions(){return s(this,tr)}get url(){return s(this,po)}get permalink(){return s(this,go)}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,tr).has(e))return s(this,tr).get(e);let t=await qr.getSubredditUsersByType({subredditName:e,type:"moderators",username:this.username},s(this,at)).all();if(t.length===0)return[];let i=t[0].modPermissions.get(e)??[];return i.length>0&&s(this,tr).set(e,i),i}getComments(e){return ee.getCommentsByUser({username:this.username,...e},s(this,at))}getPosts(e){return z.getPostsByUser({username:this.username,...e},s(this,at))}async getUserFlairBySubreddit(e){let t=await Ue.getUserFlairBySubreddit({subreddit:e,name:s(this,pn)},s(this,at));return t.users[0]?js(t.users[0]):void 0}getSnoovatarUrl(){return qr.getSnoovatarUrl(this.username,s(this,at))}async getSocialLinks(){let i=await kt.query("GetUserSocialLinks","2aca18ef5f4fc75fb91cdaace3e9aeeae2cb3843b5c26ad511e6f01b8521593a",{name:this.username},s(this,at));return i.data?.user?.profile?.socialLinks?i.data.user.profile.socialLinks.map(n=>({...n,handle:n.handle??void 0})):[]}static async getById(e,t){let o=(await u.redditAPIPlugins.Users.UserDataByAccountIds({ids:e},t))?.users?.[e]?.name;return o==null?void 0:qr.getByUsername(o,t)}static async getByUsername(e,t){let n=await u.redditAPIPlugins.Users.UserAbout({username:e},t);if(n.data?.id)return new qr(n.data,t)}static async getFromMetadata(e,t){h(t);let i=t?.[e]?.values[0];return i?qr.getById(ne(i),t):Promise.resolve(void 0)}static getSubredditUsersByType(e,t){let i=u.redditAPIPlugins.Subreddits;return new G({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 GR(o,e.subredditName,t)}})}static async createRelationship(e,t){let i=u.redditAPIPlugins.Users,{type:n,subredditName:o,username:a,permissions:c,...p}=e,g=await i.Friend({type:n,subreddit:o,name:a,permissions:c?Em(c):void 0,...p},t);if(g.json?.errors?.length)throw new Error(g.json.errors.join(`
3
+ `))}}var Lb=qn(tb(),1),Db=qn(em(),1);import{EffectType as oR,HandleUIEventResponse as tm,UIEventHandlerDefinition as aR}from"@devvit/protos";async function dR(r,e){let t=r.state??{},i=(0,Lb.default)(t),n=Le({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 gt((C,w)=>u.customPostType?.render(w)??null,r.event,r.state,e,void 0);return await y.reconcile(),tm.fromJSON({state:y.state,effects:y.getEffects()})}let g=u.formDefinitions.get(p);if(!g)throw new Error(`Form with key ${p} not found`);let v,m;if(i.__contextAction){let{actionId:y,thingId:C}=i.__contextAction,w=qc(y);w?.location==="post"?v=C:w?.location==="comment"&&(m=C)}let b=Object.assign(n,le(e,v,m),{uiEnvironment:{timezone:e[L.Timezone]?.values[0],locale:e[L.Language]?.values[0]}});await g.onSubmit({values:Tt(r.event.formSubmitted.results)},b)}else if(r.event?.realtimeEvent){if(u.customPostType){let p=new gt((g,v)=>u.customPostType?.render(v)??null,r.event,r.state,e,void 0);return await p.reconcile(),tm.fromJSON({state:p.state,effects:p.getEffects()})}}else if(r.event?.toastAction)throw new Error("Toast actions not yet implemented");let o=!(0,Db.default)(t,i),a=Pi(n.ui),c=o?[...a,{type:oR.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:0}}]:a;return tm.fromJSON({state:i,effects:c})}function Nb(r){r.provides(aR),U("HandleUIEvent",dR)}import{CustomPostDefinition as Vd,UIResponse as ck}from"@devvit/protos";import{EffectType as nm,Form as uR,ToastAppearance as Hb}from"@devvit/protos";function _b(r){let e=r.match(/form\.hook\.(.+)\.0/);if(e?.[1])return e[1]}var rm=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 im(r,e){let t=Ke({namespace:"useForm",initializer:i=>new rm(i,r,e)});return lR({id:t.hookId})}function lR(r){return`form.hook.${r.id}.0`}function qb(r,e){let t=_b(e);return r.getHook({id:t})}var Dt,Dd=class{constructor(e){l(this,Dt);d(this,Dt,e)}showForm(e,t){let i=qb(s(this,Dt),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=uR.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});gr(n.fields),o.fields=pt(n.fields),s(this,Dt).emitEffect(e,{type:nm.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?Hb.SUCCESS:Hb.NEUTRAL}:t={text:e},s(this,Dt).emitEffect(e.toString(),{type:nm.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,Dt).emitEffect(t,{type:nm.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}};Dt=new WeakMap;import{EffectType as cR,RealtimeSubscriptionStatus as jb}from"@devvit/protos";var Nt,nt,_t,wr,ws,om,Nd=class Nd{constructor(e,t){l(this,ws);l(this,Nt);l(this,nt);l(this,_t);l(this,wr);d(this,Nt,t.context),d(this,nt,!!t.context._devvitContext?.debug.realtime),d(this,wr,e),d(this,_t,t.invalidate);let i=t.context.meta[L.App]?.values[0];if(!i)throw Error("useChannel missing app ID metadata");let n=t.context.meta[L.Installation]?.values[0];if(!n)throw Error("useChannel missing install ID from metadata");let o=`${i}:${n}:${e.name}`;if(Object.values(s(this,Nt)._hooks).filter(c=>c instanceof Nd).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 jb.REALTIME_SUBSCRIBED:s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" connected`),this.state.connected=!0,s(this,_t).call(this),await s(this,wr).onSubscribed?.();break;case jb.REALTIME_UNSUBSCRIBED:s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" disconnected`),this.state.connected=!1,s(this,_t).call(this),await s(this,wr).onUnsubscribed?.();break;default:s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" received message: ${JSON.stringify(e,void 0,2)}`),s(this,wr).onMessage(t.event?.data??{});break}}async send(e){if(s(this,nt)&&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,Nt).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,nt)&&console.debug(`[realtime] "${this.state.channel}" subscribed`),this.state.subscribed=!0,s(this,_t).call(this),S(this,ws,om).call(this))}unsubscribe(){this.state.subscribed&&(s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" unsubscribed`),this.state.subscribed=!1,s(this,_t).call(this),S(this,ws,om).call(this))}};Nt=new WeakMap,nt=new WeakMap,_t=new WeakMap,wr=new WeakMap,ws=new WeakSet,om=function(){let e=Object.values(s(this,Nt)._hooks).filter(t=>t instanceof Nd&&t.state.subscribed).map(t=>t.state.channel);s(this,Nt).emitEffect(this.state.channel,{type:cR.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:e}})};var sm=Nd;function am(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 Ke({id:e,namespace:e,initializer:t=>new sm(r,t)})}import{EffectType as dm}from"@devvit/protos";function Wb(r){return typeof r=="object"&&r!==null&&"__deleted"in r}var Ir,qt,Ri=class Ri{constructor(e,t){l(this,Ir);this._segments=[];l(this,qt,{});this._prevHooks={};this._prevHookId="";this._effects={};this._changed={};this._touched={};this._requeueEvents=[];this._rootProps={};this._generated={};this._undeliveredHandlers={};this.request=e,this.meta=t,d(this,Ir,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,Ir).__cache??{}};for(let i in this._changed)e[i]=this._state[i];let t=new Set(Object.keys(this._state));return Object.keys(s(this,qt)).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 s(this,qt)}set _hooks(e){this._prevHooks=s(this,qt),d(this,qt,e)}get _state(){return s(this,Ir)}set _state(e){d(this,Ir,e)}push(e){this._segments.push({...e,next:0})}pop(){this._segments.pop()}addUndeliveredEventHandler(e,t){this._undeliveredHandlers[e]=t}addGlobalUndeliveredEventHandler(e,t){Ri.addGlobalUndeliveredEventHandler(e,t)}getHook(e){return s(this,qt)[e.id]}static addGlobalUndeliveredEventHandler(e,t){Ri._staticUndeliveredHandlers[e]=t}async handleUndeliveredEvent(e){let t={...Ri._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()}}};Ir=new WeakMap,qt=new WeakMap,Ri._staticUndeliveredHandlers={};var Oi=Ri;var Ht={};Oi.addGlobalUndeliveredEventHandler("intervals",async(r,e)=>{r.timer&&r.hook&&(delete Ht[r.hook],e.emitEffect("timers",{type:dm.EFFECT_SET_INTERVALS,interval:{intervals:Ht}}))});var jt,Bi,Is,Mi,lm=class{constructor(e,t,i){l(this,jt);l(this,Bi);l(this,Is);l(this,Mi);this.state={duration:{seconds:0,nanos:0},running:!1};d(this,Bi,i.invalidate),d(this,jt,i.hookId),d(this,Is,e),d(this,Mi,i.context);let n=Math.floor(t/1e3),o=t%1e3*1e6;this.state.duration={seconds:n,nanos:o}}onStateLoaded(){this.state.running?Ht[s(this,jt)]={duration:this.state.duration}:delete Ht[s(this,jt)]}async onUIEvent(e){await s(this,Is).call(this)}start(){Ht[s(this,jt)]={duration:this.state.duration},this.state.running=!0,s(this,Bi).call(this),s(this,Mi).emitEffect("timers",{type:dm.EFFECT_SET_INTERVALS,interval:{intervals:Ht}})}stop(){delete Ht[s(this,jt)],this.state.running=!1,s(this,Bi).call(this),s(this,Mi).emitEffect("timers",{type:dm.EFFECT_SET_INTERVALS,interval:{intervals:Ht}})}};jt=new WeakMap,Bi=new WeakMap,Is=new WeakMap,Mi=new WeakMap;function um(r,e){let t=Ke({namespace:"useInterval",initializer:i=>new lm(r,e,i)});return{start:()=>t.start(),stop:()=>t.stop()}}var Fr=class extends Error{};var cm="ServerCallRequired";function mm(r){return r?.message===cm}var Gb=qn(em(),1);function gm(r){if(r instanceof Error){if(r.message===cm)throw r;return console.error(r),{message:r.message,details:r.stack??""}}else return console.error(r),{message:"Unknown error",details:xi.caughtToString(r)}}var Xe,st,Ui,Fs,pm=class{constructor(e,t,i){l(this,Xe);l(this,st);l(this,Ui);l(this,Fs);d(this,Xe,!!i.context.devvitContext.debug.useAsync),s(this,Xe)&&console.debug("[useAsync] v1",t),this.state={data:null,load_state:"initial",error:null,depends:null},d(this,st,i.hookId),this.initializer=e,d(this,Ui,i.invalidate),d(this,Fs,i.context),this.localDepends=t.depends??null}onStateLoaded(){if(this.state.load_state!=="disabled"&&(s(this,Xe)&&console.debug("[useAsync] async onLoad ",s(this,st),this.state),s(this,Xe)&&console.debug("[useAsync] async onLoad have ",this.localDepends,"and",this.state.depends),!(0,Gb.default)(this.localDepends,this.state.depends)||this.state.load_state==="initial")){s(this,Xe)&&console.debug("[useAsync] attempting to resolve for hookId",s(this,st)),this.state.load_state="loading",this.state.depends=this.localDepends,s(this,Ui).call(this);let e={hook:s(this,st),async:!0,asyncRequest:{requestId:s(this,st)+"-"+JSON.stringify(this.state.depends)}};s(this,Xe)&&console.debug("[useAsync] onLoad requeue"),s(this,Fs).addToRequeueEvents(e)}}async onUIEvent(e,t){if(e.asyncRequest){let i={requestId:e.asyncRequest.requestId};try{i.data={value:await this.initializer()}}catch(o){i.error=gm(o)}let n={asyncResponse:i,hook:s(this,st)};s(this,Xe)&&console.debug("[useAsync] onReq requeue"),t.addToRequeueEvents(n)}else if(e.asyncResponse){let i=s(this,st)+"-"+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,Ui).call(this)):s(this,Xe)&&console.debug("[useAsync] onResp skip, stale event")}else throw new Error("Unknown event type")}};Xe=new WeakMap,st=new WeakMap,Ui=new WeakMap,Fs=new WeakMap;function mR(r,e={}){let t=Ke({namespace:"useAsync",initializer:i=>new pm(r,e,i)});return{data:t.state.data,error:t.state.error,loading:t.state.load_state==="loading"}}var yt,Li,xr,Ar,hm=class{constructor(e,t){this.state={value:null,load_state:"initial",error:null};l(this,yt);l(this,Li);l(this,xr);l(this,Ar);d(this,xr,e),d(this,Ar,t.hookId),d(this,yt,t.invalidate),d(this,Li,t.context)}async onUIEvent(){if(this.state.load_state==="loading"&&this._promise){try{this.state.value=await this._promise,this.state.load_state="loaded"}catch(e){this.state.load_state="error",this.state.error=gm(e)}s(this,yt).call(this)}else console.warn("Invalid state: ",this.state.load_state,this._promise)}setter(e){this.state.value=e instanceof Function?e(this.state.value):e,this.state.load_state="loaded",s(this,yt).call(this)}onStateLoaded(){if(this._promise=s(this,Li)._prevHooks[s(this,Ar)]?._promise,this.state.load_state==="loading")throw new Fr;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,xr)instanceof Function?s(this,xr).call(this):s(this,xr)}catch(t){console.log("error in loading async",t),this.state.load_state="error",s(this,yt).call(this);return}if(e instanceof Promise){this._promise=e,this.state.load_state="loading";let t={asyncRequest:{requestId:s(this,Ar)},hook:s(this,Ar)};throw s(this,Li).addToRequeueEvents(t),s(this,yt).call(this),new Fr}else this.state.value=e,this.state.load_state="loaded";s(this,yt).call(this)}}};yt=new WeakMap,Li=new WeakMap,xr=new WeakMap,Ar=new WeakMap;function fm(r){let e=Ke({namespace:"useState",initializer:t=>new hm(r,t)});return[e.state.value,e.setter.bind(e)]}var km={now(){return new Date}};function Vb(r){return`__autocache__${r}`}function zb(r){return`__lock__${r}`}var pR=300,gR=1e3,_d=5e3,vm=3,Jb=.1,$b=1e3,hR=3e4;function Kb(r){if(r.error)throw new Error(r.error);return r.value}var Wt,Gt,_e,Di,K,Xb,Zb,Yb,ym,Qb,ek,bm,tk,qd=class{constructor(e,t,i=km){l(this,K);l(this,Wt);l(this,Gt,{});l(this,_e);l(this,Di);d(this,Wt,e),d(this,Di,t),d(this,_e,i)}async cache(e,t){var a;(a=s(this,Di)).__cache??(a.__cache={}),d(this,Gt,s(this,Di).__cache),S(this,K,tk).call(this,t);let i=S(this,K,Xb).call(this,t.key);if(i!==void 0)return i;let n=await S(this,K,bm).call(this,t.key),o=await S(this,K,Zb).call(this,t,n,e);return Kb(o)}};Wt=new WeakMap,Gt=new WeakMap,_e=new WeakMap,Di=new WeakMap,K=new WeakSet,Xb=function(e){let t=s(this,Gt)[e];if(t){let i=s(this,_e).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<vm&&Math.random()<Jb&&t.errorTime+$b<i;if(t?.expires&&t.expires<i&&t.checkedAt+$b<i||n){delete s(this,Gt)[e];return}else return Kb(t)}},Zb=async function(e,t,i){let n=t?.expires,o=n?S(this,K,ek).call(this,n):1;return!t||t?.error&&t.errorCount<vm&&Jb>Math.random()||o>Math.random()?S(this,K,Yb).call(this,e,t,i):t},Yb=async function(e,t,i){let n=zb(e.key),o=s(this,_e).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Wt).set(n,"1",{expiration:a,nx:!0}))return S(this,K,Qb).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,_e).now();return S(this,K,ym).call(this,p,e.key,e.ttl)}},ym=async function(e,t,i){let n=Math.min(i,gR),o=await S(this,K,bm).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,pR)),S(this,K,ym).call(this,e,t,i)},Qb=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,Gt)[e]=t,await s(this,Wt).set(Vb(e),JSON.stringify(t),{expiration:new Date(o+hR)}),t.error&&t.errorCount<vm&&await s(this,Wt).del(zb(e)),t},ek=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},bm=async function(e){let t=await s(this,Wt).get(Vb(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,_e).now().getTime(),s(this,Gt)[e]=i,i}},tk=function(e){e.ttl<_d&&(console.warn(`Cache TTL cannot be less than ${_d} milliseconds! Updating ttl value of ${e.ttl} to ${_d}.`),e.ttl=_d)};function rk(r,e,t=km){let i=new qd(r,e,t);return i.cache.bind(i)}var Hd=class{buildContext(e,t,i){let n=new pi(i),o=new ci(i),a=new yi(i),c=new fi(i),p=new bi(i),g=new ki(i),v=new Dd(e),m=new mi(i),b=new li,y=new gi(i),C=rk(a,e._state),w={modLog:n,kvStore:o,redis:a,reddit:c,scheduler:p,settings:g,media:m,assets:b,realtime:y,ui:v,useState:fm,useChannel:am,useInterval:um,useForm:im,cache:C,dimensions:t.env?.dimensions,uiEnvironment:{timezone:i[L.Timezone]?.values[0],locale:i[L.Language]?.values[0],dimensions:t.env?.dimensions}},A=le(i,t.props?.postId);return A.debug.effects=e,{...A,...w}}};var ke=null;function ik(r){return JSON.parse(JSON.stringify(r))}function fR(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 vR(r){return r.blocking||r.resize?!1:!r.hook}function Ke({initializer:r,...e}){if(!ke)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.");fR(e.namespace);let t=ke.nextHookId(e),i=ke,n={hookId:t,invalidate:()=>{i._changed[t]=!0,i._state[t]=i?._hooks[t]?.state},context:ke},o=ke._state[t]===void 0||Wb(ke._state[t]);ke._hooks[t]=ke._hooks[t]??r(n);let a=ke._hooks[t];return o||(a.state=ke._state[t]),a.onStateLoaded?.(),o&&a.state!==void 0&&a.state!==null&&n.invalidate(),a}var yR=null,Ni,Gd,As,F,ue,jd,nk,Sm,sk,Pm,Cm,Wd,wm,ok,xs=class{constructor(e){l(this,F);l(this,Ni);l(this,Gd,new Hd);l(this,As,new Fi(()=>this._latestRenderContext?.devvitContext?.assets));this._latestRenderContext=null;s(this,F,ue)&&console.debug("[blocks] BlocksHandler v1"),d(this,Ni,e),yR=this}async handle(e,t){let i=new Oi(e,t),n=s(this,Gd).buildContext(i,e,t);i.devvitContext=n;let o,a=e.events,p=!e.events?.length||a.some(y=>!y.async),g=a.some(y=>y.blocking),v,m,b=[...a];for(a.length===0&&a.push({}),s(this,F,ue)&&console.debug("[blocks] starting processing events");a.length>0;){s(this,F,ue)&&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=ik(i._state);await S(this,F,nk).call(this,i,...y),i._state=w}else await S(this,F,sk).call(this,i,...y)}catch(w){if(!mm(w))throw w;if(s(this,F,ue)&&console.debug("[blocks] caught in handler",w),i._latestRenderContent=void 0,m){i._state=m._state,i._changed=v,i._effects=m._effects;let A=b.map(B=>{let me={...B};return me.retry=!0,me});i.addToRequeueEvents(...A);break}else throw console.error("[blocks] unhandled error in handler",w),w}s(this,F,ue)&&console.debug("[blocks] remaining events",i._requeueEvents);let C=[];for(let w of i._requeueEvents){if(!p&&!w.async){s(this,F,ue)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch A",w),C.push(w);continue}if(p&&w.async&&!g){s(this,F,ue)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch B",w),C.push(w);continue}s(this,F,ue)&&console.debug("[blocks] reprocessing event in BlocksHandler",w),a.push(w)}i._requeueEvents=C,a.length>0&&(v={...i._changed},m={_state:ik(i._state),_effects:{...i._effects}},b=[...a])}if(p){i._latestRenderContent||(i._latestRenderContent=S(this,F,Pm).call(this,s(this,Ni),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}}};Ni=new WeakMap,Gd=new WeakMap,As=new WeakMap,F=new WeakSet,ue=function(){return!!this._latestRenderContext?.devvitContext.debug.blocks},jd=function(e,...t){e._hooks={},S(this,F,Pm).call(this,s(this,Ni),e.request.props??{},e)},nk=async function(e,...t){S(this,F,jd).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,F,Sm).call(this,e,i)}))},Sm=async function(e,t){vR(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 mm(n)?s(this,F,ue)&&console.error("Server call required",n):console.error("Error in event handler",n),n}else await e.handleUndeliveredEvent(t)},sk=async function(e,...t){for(let i of t)s(this,F,ue)&&console.log("[blocks] handling main queue event",i),s(this,F,ue)&&console.log("[blocks] before",e._state),S(this,F,jd).call(this,e,i),await S(this,F,Sm).call(this,e,i),s(this,F,ue)&&console.log("[blocks] after",e._state);S(this,F,jd).call(this,e)},Pm=function(e,t,i){s(this,F,ue)&&console.debug("[blocks] renderRoot"),i._generated={},ke=i,this._latestRenderContext=i;try{let n=S(this,F,Cm).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 async. 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 Fr)return;throw n}finally{ke=null}},Cm=function(e,t,i){i.push({namespace:e.name||"anonymous",...t});try{let n=e(t,i.devvitContext);if(n instanceof Promise)throw new Error(`Components (found: ${e.name??"unknown component"}) cannot be async. To use data from an async endpoint, please use "const [data] = context.useState(async () => {/** your async code */})".`);return S(this,F,wm).call(this,n,i)}finally{i.pop()}},Wd=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,F,wm).call(this,i,t)))},wm=function(e,t){if(Array.isArray(e))return S(this,F,Wd).call(this,e,t);if(bR(e))if(e.type===void 0){t.push({namespace:"fragment",...e.props});let i=S(this,F,Wd).call(this,e.children,t);return t.pop(),i}else if(typeof e.type=="function"){let i={...e.props,children:e.children.flat(1/0)};return S(this,F,Cm).call(this,e.type,i,t)}else{t.push({namespace:e.type,...e.props});let i=S(this,F,Wd).call(this,e.children,t),n=S(this,F,ok).call(this,e.props??{});return t.pop(),[{type:e.type,children:i,props:n}]}else return[(e??"").toString()]},ok=function(e){let t={};for(let i in e)if(!(typeof e[i]>"u"))if(typeof e[i]=="function"){let n=Ke({namespace:i,key:!1,initializer:({hookId:o})=>({hookId:o,state:null,onUIEvent:a=>e[i](a.userAction?.data)})});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 bR(r){return typeof r=="object"&&r!=null&&"type"in r}var ak=r=>{let e=Number(r.trim().split(".").pop());return isNaN(e)?void 0:e},dk=r=>{let[e,t,i]=r.trim().split(";");if(!e||!t||!i){console.warn(`Received a malformed devvit-user-agent! Received: '${r}'`);return}if(e!=="Reddit"){console.warn(`Received unknown company name in user agent! Received: '${r}'`);return}if(t==="iOS"){let n=ak(i);if(n===void 0){console.warn(`Could not parse version number from user agent! Received: '${r}'`);return}return{company:"Reddit",platform:"iOS",rawVersion:i,versionNumber:n}}if(t==="Android"){let n=ak(i);if(n===void 0){console.warn(`Could not parse version number from user agent! Received: '${r}'`);return}return{company:"Reddit",platform:"Android",rawVersion:i,versionNumber:n}}if(t==="Shreddit")return{company:"Reddit",platform:"Shreddit",rawVersion:i};if(t==="Play")return{company:"Reddit",platform:"Play",rawVersion:i};console.warn("Received unknown platform:",t)},lk=r=>r?r.platform==="Android"?r.versionNumber<1819908:r.platform==="iOS"?r.versionNumber<614940:!1:(console.warn(`Could not parse devvit-user-agent! Received: '${JSON.stringify(r)}'`),!1),kR=r=>{switch(r){case"Android":return"https://play.google.com/store/apps/details?id=com.reddit.frontpage";case"iOS":return"https://apps.apple.com/us/app/reddit/id1064216828";case"Play":case"Shreddit":break;default:console.error(`No upgrade link for platform: ${r}`)}},SR=({platform:r},e)=>u.createElement("blocks",null,u.createElement("vstack",{alignment:"middle center",height:100,width:100},u.createElement("vstack",{maxWidth:"300px",gap:"large",alignment:"middle center"},u.createElement("vstack",{gap:"medium",alignment:"middle center"},u.createElement("image",{imageHeight:100,imageWidth:100,url:"https://i.redd.it/p1vmc5ulmpib1.png"}),u.createElement("text",{size:"large",weight:"bold",wrap:!0,alignment:"center"},"Uh oh, the app you're trying to use requires the latest version of Reddit. Please upgrade your app to continue.")),u.createElement("hstack",{alignment:"middle center"},u.createElement("button",{onPress:()=>{let t=kR(r);t?e.ui.navigateTo(t):console.warn("No upgrade link found for platform:",r)}},"Upgrade"))))),uk=r=>()=>u.createElement(SR,{platform:r});var PR=()=>u.createElement("vstack",{alignment:"center middle",width:"100%",height:"100%"},u.createElement("text",null,"This feature is not available yet")),CR=[[Vd,Vd.methods.renderPostContent,(r,e)=>u.customPostType?.render(e)??null],[Vd,Vd.methods.renderPostComposer,(r,e)=>u.createElement(PR,null)]];function wR(r){return async(e,t)=>{let i=dk(t["devvit-user-agent"]?.values?.[0]??"");if(i&&lk(i)){let o=new xs(uk(i.platform));return ck.fromJSON(await o.handle(e,t))}let n=new xs(r);return ck.fromJSON(await n.handle(e,t))}}function mk(r){for(let[e,t,i]of CR)r.provides(e),U(t.name,wR(i))}var _i,Ts,qi,Tr,Er,Hi,ji,Rr,Vt,Es,Rs,Or,_,D=class D extends cd{static configure(e){d(this,qi,{...s(this,qi),...e}),ht(e.http)&&this.use(P.HTTPDefinition),(ht(e.kvStore)||ht(e.redis))&&(this.use(P.KVStoreDefinition),this.use(P.RedisAPIDefinition)),ht(e.media)&&this.use(P.MediaServiceDefinition),ht(e.modLog)&&this.use(P.ModlogDefinition),ht(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)),ht(e.realtime)&&this.use(P.RealtimeDefinition)}static addMenuItem(e){s(this,ji).push(e)}static addCustomPostType(e){d(this,Tr,e)}static createForm(e,t){let i=`form.${s(this,Er).size}`;return s(this,Er).set(i,{form:e,onSubmit:t}),i}static addSchedulerJob(e){if(s(this,_)[P.SchedulerDefinition.fullName]||this.use(P.SchedulerDefinition),s(this,Rr).has(e.name))throw new Error(`Job ${e.name} is already defined`);s(this,Rr).set(e.name,e.onRun)}static addSettings(e){gr(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,Hi,t),i.length>0&&d(this,_i,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,Vt).has(e.event)?s(this,Vt).get(e.event)?.push(e.onEvent):s(this,Vt).set(e.event,[e.onEvent]),D}static provide(e){s(this,Rs).push(e)}static use(e,t){s(this,Or)[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,Or)[e.fullName].handler?.[n.name]?.(n.requestType?.fromPartial(o??{}),a);return s(this,_)[e.fullName]=i,i}static get redditAPIPlugins(){if(!ht(s(this,qi).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,ji)}static get customPostType(){return s(this,Tr)}static get formDefinitions(){return s(this,Er)}static get scheduledJobHandlers(){return s(this,Rr)}static get installationSettings(){return s(this,Hi)}static get appSettings(){return s(this,_i)}static get triggerOnEventHandlers(){return s(this,Vt)}static get assets(){return s(this,Ts)}static get webviewAssets(){return s(this,Es)}constructor(e){super(e),d(D,Ts,e.assets??{}),d(D,Es,e.webviewAssets??{});for(let t in s(D,Or)){let i=s(D,Or)[t];i.handler=e.use(i.def,i.options)}s(D,ji).length>0&&Hy(e),s(D,Rr).size>0&&jy(e),s(D,Tr)&&(Ny(e),mk(e)),(s(D,Tr)||s(D,Er).size>0)&&Nb(e),s(D,Hi)&&_y(e),s(D,_i)&&fy(e),s(D,Vt).size>0&&Wy(e);for(let t of s(D,Rs))e.provides(t)}};_i=new WeakMap,Ts=new WeakMap,qi=new WeakMap,Tr=new WeakMap,Er=new WeakMap,Hi=new WeakMap,ji=new WeakMap,Rr=new WeakMap,Vt=new WeakMap,Es=new WeakMap,Rs=new WeakMap,Or=new WeakMap,_=new WeakMap,D.debug={},l(D,_i),l(D,Ts,{}),l(D,qi,{}),l(D,Tr),l(D,Er,new Map),l(D,Hi),l(D,ji,[]),l(D,Rr,new Map),l(D,Vt,new Map),l(D,Es,{}),l(D,Rs,[]),l(D,Or,{}),l(D,_,{});var u=D;(e=>{function r(t,i,...n){return{type:t,props:i,children:n}}e.createElement=r})(u||(u={}));function X(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 Im;(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"})(Im||(Im={}));var pk="text",gk="raw",hk="br",fk="link",vk="c/",yk="p/",bk="r/",kk="u/",Sk="@",Pk="spoilertext",Ck="par",wk="h",Ik="hr",Fk="blockquote",xk="code",Ak="li",Tk="list",Ek="L",Rk="R",Ok="C",Bk="table",Mk="embed",Uk="img",Lk="gif",Dk="video";function Nk(r){return{e:Lk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function _k(r,e){let t={},i=[];return Object.assign(t,Os(t,i),Bs(t,i),Ms(t,i),Ds(t,i),Ns(t,i),_s(t,i)),e(t),{e:Fk,c:i,...r.author&&{a:r.author}}}function qk(r,e){let t={},i=[];return Object.assign(t,xm(t,i)),e(t),{e:xk,c:i,...r.language&&{l:r.language}}}function Hk(r){return{e:vk,t:r.permalink}}function jk(r,e){let t={},i=[];return Object.assign(t,xm(t,i),Ls(t,i)),e(t),{e:wk,l:r.level,c:i}}function Wk(r){return{e:Mk,u:r.sourceUrl,c:r.contentUrl,x:r.width,y:r.height}}function Gk(){return{e:Ik}}function Vk(r){return{e:Uk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function zk(){return{e:hk}}function Jk(r){return{e:fk,t:r.text,u:r.url,...r.formatting&&{f:r.formatting},...r.tooltip&&{a:r.tooltip}}}function $k(r,e){let t={},i=[];return Object.assign(t,uS(t,i)),e(t),{e:Tk,o:r.ordered,c:i}}function Kk(r){let e={},t=[];return Object.assign(e,Os(e,t),Bs(e,t),Ms(e,t),zd(e,t),Ds(e,t),Ns(e,t),_s(e,t)),r(e),{e:Ak,c:t}}function Xk(r){let e={},t=[];return Object.assign(e,Jd(e,t),Ls(e,t),Fm(e,t),Am(e,t),Us(e,t)),r(e),{e:Ck,c:t}}function Zk(r){return{e:yk,t:r.permalink}}function Yk(r){return{e:gk,t:r}}function Qk(r){let e={},t=[];return Object.assign(e,Jd(e,t),Ls(e,t),Fm(e,t)),r(e),{e:Pk,c:t}}function eS(r){return{e:bk,t:r.subredditName,l:r.showPrefix}}function tS(r){let e={},t=[],i=[];return Object.assign(e,cS(e,t,i)),r(e),{e:Bk,h:t,c:i}}function rS(r){let[e,t]=lS();return r(e),{c:t}}function iS(r,e){let[t,i]=lS();e(t);let n;switch(r.columnAlignment){case"left":n=Ek;break;case"right":n=Rk;break;case"center":n=Ok;break}return{...n&&{a:n},...i&&{c:i}}}function nS(r){let e={},t=[];return Object.assign(e,mS(e,t)),r(e),t}function sS(r){return{e:pk,t:r.text,...r.formatting&&{f:r.formatting}}}function oS(r){return{e:kk,t:r.username,l:r.showPrefix}}function aS(r){return{e:Sk,t:r.username,l:r.showPrefix}}function dS(r){return{e:Dk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur},...r.thumbnail&&{p:r.thumbnail},...r.convertToGif&&{gifify:r.convertToGif}}}function lS(){let r={},e=[];return Object.assign(r,Jd(r,e),Ls(r,e),Am(r,e),Us(r,e)),[r,e]}function Os(r,e){return{blockQuote(t,i){return e.push(_k(t,i)),r}}}function Bs(r,e){return{codeBlock(t,i){return e.push(qk(t,i)),r}}}function pS(r,e){return{embed(t){return e.push(Wk(t)),r}}}function Ms(r,e){return{heading(t,i){return e.push(jk(t,i)),r}}}function zd(r,e){return{horizontalRule(){return e.push(Gk()),r}}}function Us(r,e){return{image(t){return e.push(Vk(t)),r},animatedImage(t){return e.push(Nk(t)),r}}}function Fm(r,e){return{linebreak(){return e.push(zk()),r}}}function Ls(r,e){return{link(t){return e.push(Jk(t)),r},commentLink(t){return e.push(Hk(t)),r},postLink(t){return e.push(Zk(t)),r},subredditLink(t){return e.push(eS(t)),r},userLink(t){return e.push(oS(t)),r},userMention(t){return e.push(aS(t)),r}}}function Ds(r,e){return{list(t,i){return e.push($k(t,i)),r}}}function uS(r,e){return{item(t){return e.push(Kk(t)),r}}}function Ns(r,e){return{paragraph(t){return e.push(Xk(t)),r}}}function xm(r,e){return{rawText(t){return e.push(Yk(t)),r}}}function Am(r,e){return{spoiler(t){return e.push(Qk(t)),r}}}function cS(r,e,t){return{headerCell(i,n){return e.push(iS(i,n)),r},row(i){return t.push(nS(i)),r}}}function _s(r,e){return{table(t){return e.push(tS(t)),r}}}function mS(r,e){return{cell(t){return e.push(rS(t)),r}}}function Jd(r,e){return{text(t){return e.push(sS(t)),r}}}function gS(r,e){return{video(t){return e.push(dS(t)),r}}}var IR=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},FR=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)},$d,qs=class{constructor(){$d.set(this,void 0);let e=[];Object.assign(this,Ns(this,e),Ms(this,e),zd(this,e),Os(this,e),Bs(this,e),pS(this,e),Ds(this,e),_s(this,e),Us(this,e),gS(this,e)),IR(this,$d,{document:e},"f")}build(){return JSON.stringify(FR(this,$d,"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}};$d=new WeakMap;function Wi(r){let e;return r instanceof qs?e=r.build():typeof r=="object"?e=JSON.stringify(r):e=r,e}var hS=100,fS=1/0,Br,Mr,zt,Gi,Vi,Kd,G=class{constructor(e){l(this,Vi);l(this,Br);l(this,Mr);l(this,zt);l(this,Gi,!1);this.pageSize=hS;this.limit=fS;this.children=[];X(this),this._fetch=e.fetch,this.pageSize=e.pageSize??hS,this.limit=e.limit??fS,d(this,Mr,e.after),d(this,Br,e.before),d(this,zt,e.more),e.children&&(this.children=e.children)}get hasMore(){return!s(this,Gi)||!!(s(this,Mr)||s(this,Br)||s(this,zt))}async*[Symbol.asyncIterator](){let e=0;for(;;){if(e===this.children.length)if(this.hasMore){if((await S(this,Vi,Kd).call(this)).length===0)break}else break;if(yield this.children[e],e++,e===this.limit)break}}setMore(e){d(this,zt,e)}preventInitialFetch(){d(this,Gi,!0)}async all(){for(;this.hasMore&&this.children.length<this.limit;)await S(this,Vi,Kd).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,Vi,Kd).call(this);return this.children.slice(0,t)}};Br=new WeakMap,Mr=new WeakMap,zt=new WeakMap,Gi=new WeakMap,Vi=new WeakSet,Kd=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,Br),after:s(this,Mr),limit:this.pageSize,more:s(this,zt)});return this.children.push(...e),d(this,Br,t),d(this,Mr,i),d(this,zt,n),d(this,Gi,!0),e};function xR(r){try{return!0}catch{return!1}}function AR(r){try{return!0}catch{return!1}}var Hs,Tm,Me=class{constructor(){}static get(e,t){let i=u.redditAPIPlugins.ModNote;return new G({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,Hs,Tm).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,Hs,Tm).call(this,n.created)}static async addRemovalNote(e,t){await u.redditAPIPlugins.ModNote.PostRemovalNote(e,t)}};Hs=new WeakSet,Tm=function(e){if(h(e.id,"Mod note ID is null or undefined"),h(e.createdAt,"Mod note createdAt is null or undefined"),h(e.type,"Mod note type is null or undefined"),h(e.subreddit,"Mod note subreddit is null or undefined"),h(e.subredditId,"Mod note subredditId is null or undefined"),h(e.operator,"Mod note operator is null or undefined"),h(e.operatorId,"Mod note operatorId is null or undefined"),h(e.user,"Mod note user is null or undefined"),h(e.userId,"Mod note userId is null or undefined"),h(e.userNoteData,"Mod note userNote is null or undefined"),h(e.modActionData,"Mod note modAction is null or undefined"),!xR(e.userNoteData?.label??""))throw new Error(`Invalid user note label: ${e.userNoteData?.label}`);if(!AR(e.type))throw new Error(`Invalid mod note type: ${e.type}`);return{id:e.id,user:{id:ne(e.userId??""),name:e.user},subreddit:{id:Re(e.subredditId??""),name:e.subreddit},operator:{id:ne(e.operatorId??""),name:e.operator},createdAt:new Date(e.createdAt*1e3),userNote:{note:e.userNoteData?.note,redditId:ve(e.userNoteData?.redditId??""),label:e.userNoteData?.label},type:e.type}},l(Me,Hs);var bt=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 vS=["all","wiki","posts","access","mail","config","flair","channels","chat_config","chat_operator","community_chat"];function TR(r,e){return e.map(t=>(r.includes(t)?"+":"-")+t).join(",")}function Em(r){return TR(r,vS)}function yS(r){return r.filter(e=>vS.includes(e))}var ER=(t=>(t.User="USER_FLAIR",t.Post="LINK_FLAIR",t))(ER||{}),Lr,zi,Ji,$i,Ki,Xi,Zi,Yi,Qi,en,tn,Xd,Ze=class Ze{constructor(e,t,i){l(this,Lr);l(this,zi);l(this,Ji);l(this,$i);l(this,Ki);l(this,Xi);l(this,Zi);l(this,Yi);l(this,Qi);l(this,en);X(this),h(e.id),h(e.text),d(this,Lr,e.id),d(this,zi,t),d(this,Ji,e.text),d(this,$i,RR(e.textColor)),d(this,Ki,OR(e.backgroundColor)),d(this,Xi,BR(e.allowableContent)),d(this,Zi,e.modOnly),d(this,Yi,e.maxEmojis),d(this,Qi,e.textEditable),d(this,en,i)}get id(){return s(this,Lr)}get text(){return s(this,Ji)}get textColor(){return s(this,$i)}get backgroundColor(){return s(this,Ki)}get allowableContent(){return s(this,Xi)}get modOnly(){return s(this,Zi)}get maxEmojis(){return s(this,Yi)}get allowUserEdits(){return s(this,Qi)}async delete(){return Ze.deleteFlairTemplate(s(this,Lr),s(this,zi),s(this,en))}async edit(e){return Ze.editFlairTemplate({id:s(this,Lr),subredditName:s(this,zi),text:e.text??s(this,Ji),allowableContent:e.allowableContent??s(this,Xi),backgroundColor:e.backgroundColor??s(this,Ki),maxEmojis:e.maxEmojis??s(this,Yi),modOnly:e.modOnly??s(this,Zi),textColor:e.textColor??s(this,$i),allowUserEdits:e.allowUserEdits??s(this,Qi)},s(this,en))}static async createPostFlairTemplate(e,t){var i;return S(i=Ze,tn,Xd).call(i,{...e,flairType:"LINK_FLAIR"},t)}static async createUserFlairTemplate(e,t){var i;return S(i=Ze,tn,Xd).call(i,{...e,flairType:"USER_FLAIR"},t)}static async editFlairTemplate(e,t){var i;return S(i=Ze,tn,Xd).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)}};Lr=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 WeakMap,en=new WeakMap,tn=new WeakSet,Xd=async function(e,t){let{subredditName:i,allowableContent:n="all",backgroundColor:o="transparent",flairType:a="",maxEmojis:c=10,modOnly:p=!1,text:g,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:g,textColor:v,textEditable:m,flairTemplateId:b,cssClass:"",overrideCss:!1},t);return new Ze(C,i,t)},l(Ze,tn);var de=Ze;function js(r){return{flairCssClass:r.flairCssClass,user:r.user,flairText:r.flairText}}var Jt,Rm,Om,Ur=class Ur{static async getUserFlairBySubreddit(e,t){return u.redditAPIPlugins.Flair.FlairList(e,t)}static setUserFlair(e,t){var i;return S(i=Ur,Jt,Rm).call(i,e,t)}static setPostFlair(e,t){var i;return S(i=Ur,Jt,Rm).call(i,{...e,postId:fe(e.postId)},t)}static async removePostFlair(e,t,i){var n;return S(n=Ur,Jt,Om).call(n,e,t,void 0,i)}static async removeUserFlair(e,t,i){var n;return S(n=Ur,Jt,Om).call(n,e,void 0,t,i)}};Jt=new WeakSet,Rm=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)},Om=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(Ur,Jt);var Ue=Ur;function RR(r){if(h(r,"Flair text color is required"),r==="light"||r==="dark")return r;throw new Error(`Invalid flair text color: ${r}`)}function OR(r){if(h(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 BR(r){if(r==="all"||r==="text"||r==="emoji")return r;throw new Error(`Invalid allowable content: ${r}`)}import{Block as HR}from"@devvit/protos";var PS=qn(SS(),1);var rn,Gs,nn,Vs,zs,Js,$s,Ks,sn,Xs,Zs,Ys,Qs,eo,to,$t,ro,io,Nr,on,Kt,an,dn,ln,_r,Xt,Zt,un,Yt,Qt,er,kt,no,so,cn,mn,N,H=class H{constructor(e,t){l(this,rn);l(this,Gs);l(this,nn);l(this,Vs);l(this,zs);l(this,Js);l(this,$s);l(this,Ks);l(this,sn);l(this,Xs);l(this,Zs);l(this,Ys);l(this,Qs);l(this,eo);l(this,to);l(this,$t);l(this,ro);l(this,io);l(this,Nr);l(this,on);l(this,Kt);l(this,an);l(this,dn);l(this,ln);l(this,_r);l(this,Xt);l(this,Zt);l(this,un);l(this,Yt);l(this,Qt);l(this,er);l(this,kt);l(this,no);l(this,so);l(this,cn);l(this,mn);l(this,N);X(this),h(e.id,"Post is missing id"),h(e.title,"Post is missing title"),h(e.createdUtc,"Post is missing created date"),h(e.author,"Post is missing author name"),h(e.subreddit,"Post is missing subreddit name"),h(e.subredditId,"Post is missing subreddit id"),h(e.url,"Post is missing url"),h(e.permalink,"Post is missing permalink"),d(this,rn,fe(`t3_${e.id}`)),d(this,nn,e.author),d(this,Gs,e.authorFullname?ne(e.authorFullname):void 0),d(this,zs,Re(e.subredditId)),d(this,Js,e.subreddit),d(this,Ys,e.score??0),d(this,Qs,e.numComments??0),d(this,eo,e.numReports??0);let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Vs,i),d(this,Ks,e.title),d(this,sn,e.selftext),d(this,Xs,e.selftextHtml),d(this,Zs,e.url),d(this,$s,e.permalink),e.thumbnail&&e.thumbnail!=="self"&&e.thumbnail!=="nsfw"&&e.thumbnailHeight!=null&&e.thumbnailWidth!=null&&d(this,to,{url:e.thumbnail,height:e.thumbnailHeight,width:e.thumbnailWidth}),d(this,$t,e.approved??!1),d(this,ro,e.approvedAtUtc??0),d(this,io,e.bannedAtUtc??0),d(this,Kt,e.removed??!1),d(this,an,e.removedBy),d(this,dn,e.removedByCategory),d(this,Nr,e.spam??!1),d(this,on,e.stickied??!1),d(this,ln,e.archived??!1),d(this,_r,e.edited??!1),d(this,Xt,e.locked??!1),d(this,Zt,e.over18??!1),d(this,un,e.quarantine??!1),d(this,Yt,e.spoiler),d(this,Qt,e.hidden??!1),d(this,er,e.ignoreReports??!1),d(this,kt,e.distinguished),d(this,so,e.secureMedia),d(this,cn,(e.modReports??[]).map(([n])=>n)),d(this,mn,(e.userReports??[]).map(([n])=>n)),d(this,N,t),(e.linkFlairBackgroundColor||e.linkFlairCssClass||e.linkFlairText||e.linkFlairType||e.linkFlairTemplateId||e.linkFlairRichtext||e.linkFlairTextColor)&&d(this,no,{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,rn)}get authorId(){return s(this,Gs)}get authorName(){return s(this,nn)}get subredditId(){return s(this,zs)}get subredditName(){return s(this,Js)}get permalink(){return s(this,$s)}get title(){return s(this,Ks)}get body(){return s(this,sn)}get bodyHtml(){return s(this,Xs)}get url(){return s(this,Zs)}get thumbnail(){return s(this,to)}get createdAt(){return s(this,Vs)}get score(){return s(this,Ys)}get numberOfComments(){return s(this,Qs)}get numberOfReports(){return s(this,eo)}get approved(){return s(this,$t)}get approvedAtUtc(){return s(this,ro)}get bannedAtUtc(){return s(this,io)}get spam(){return s(this,Nr)}get stickied(){return s(this,on)}get removed(){return s(this,Kt)}get removedBy(){return s(this,an)}get removedByCategory(){return s(this,dn)}get archived(){return s(this,ln)}get edited(){return s(this,_r)}get locked(){return s(this,Xt)}get nsfw(){return s(this,Zt)}get quarantined(){return s(this,un)}get spoiler(){return s(this,Yt)}get hidden(){return s(this,Qt)}get ignoringReports(){return s(this,er)}get distinguishedBy(){return s(this,kt)}get comments(){return ee.getComments({postId:this.id},s(this,N))}get flair(){return s(this,no)}get secureMedia(){return s(this,so)}get userReportReasons(){return s(this,mn)}get modReportReasons(){return s(this,cn)}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,an),removedByCategory:s(this,dn),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,cn),userReportReasons:s(this,mn)}}isApproved(){return s(this,$t)}isSpam(){return s(this,Nr)}isStickied(){return s(this,on)}isRemoved(){return s(this,Kt)}isArchived(){return s(this,ln)}isEdited(){return s(this,_r)}isLocked(){return s(this,Xt)}isNsfw(){return s(this,Zt)}isQuarantined(){return s(this,un)}isSpoiler(){return s(this,Yt)}isHidden(){return s(this,Qt)}isIgnoringReports(){return s(this,er)}isDistinguishedBy(){return s(this,kt)}async edit(e){let t=await H.edit({id:this.id,...e},s(this,N));d(this,sn,t.body),d(this,_r,t.edited)}async addComment(e){return ee.submit({id:this.id,...e},s(this,N))}async delete(){return H.delete(this.id,s(this,N))}async approve(){await H.approve(this.id,s(this,N)),d(this,$t,!0),d(this,Kt,!1)}async remove(e=!1){await H.remove(this.id,e,s(this,N)),d(this,Kt,!0),d(this,Nr,e),d(this,$t,!1)}async lock(){await H.lock(this.id,s(this,N)),d(this,Xt,!0)}async unlock(){await H.unlock(this.id,s(this,N)),d(this,Xt,!1)}async hide(){await H.hide(this.id,s(this,N)),d(this,Qt,!0)}async unhide(){await H.unhide(this.id,s(this,N)),d(this,Qt,!1)}async markAsNsfw(){await H.markAsNsfw(this.id,s(this,N)),d(this,Zt,!0)}async unmarkAsNsfw(){await H.unmarkAsNsfw(this.id,s(this,N)),d(this,Zt,!1)}async markAsSpoiler(){await H.markAsSpoiler(this.id,s(this,N)),d(this,Yt,!0)}async unmarkAsSpoiler(){await H.unmarkAsSpoiler(this.id,s(this,N)),d(this,Yt,!1)}async sticky(e){await H.sticky(this.id,e,s(this,N))}async unsticky(){await H.unsticky(this.id,s(this,N))}async distinguish(){let{distinguishedBy:e}=await H.distinguish(this.id,!1,s(this,N));d(this,kt,e)}async distinguishAsAdmin(){let{distinguishedBy:e}=await H.distinguish(this.id,!0,s(this,N));d(this,kt,e)}async undistinguish(){let{distinguishedBy:e}=await H.undistinguish(this.id,s(this,N));d(this,kt,e)}async ignoreReports(){await H.ignoreReports(this.id,s(this,N)),d(this,er,!0)}async unignoreReports(){await H.unignoreReports(this.id,s(this,N)),d(this,er,!1)}async getAuthor(){return I.getByUsername(s(this,nn),s(this,N))}async crosspost(e){return H.crosspost({...e,postId:this.id},s(this,N))}addRemovalNote(e){return Me.addRemovalNote({itemIds:[s(this,rn)],...e},s(this,N))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=pr(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 H(a.data,t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,n;if("preview"in e){h(t,"Missing metadata in `SubmitPostOptions`");let c=await new gt(()=>e.preview,void 0,{},t,void 0).buildBlocksUI(),p=HR.encode(c).finish();n=await i.Submit({kind:"custom",sr:e.subredditName,richtextJson:(0,PS.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?Wi(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 H.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 H.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=Wi(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 H.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 h(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 h(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 G({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 Ws(o,t)}})}static getHotPosts(e={location:"GLOBAL"},t){let i=u.redditAPIPlugins.Listings;return new G({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 Ws(o,t)}})}static getNewPosts(e,t){let i=u.redditAPIPlugins.Listings;return new G({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 Ws(o,t)}})}static getRisingPosts(e,t){let i=u.redditAPIPlugins.Listings;return new G({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 Ws(o,t)}})}static getPostsByUser(e,t){let i=u.redditAPIPlugins.Users;return new G({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 Ws(o,t)}})}};rn=new WeakMap,Gs=new WeakMap,nn=new WeakMap,Vs=new WeakMap,zs=new WeakMap,Js=new WeakMap,$s=new WeakMap,Ks=new WeakMap,sn=new WeakMap,Xs=new WeakMap,Zs=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,eo=new WeakMap,to=new WeakMap,$t=new WeakMap,ro=new WeakMap,io=new WeakMap,Nr=new WeakMap,on=new WeakMap,Kt=new WeakMap,an=new WeakMap,dn=new WeakMap,ln=new WeakMap,_r=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,un=new WeakMap,Yt=new WeakMap,Qt=new WeakMap,er=new WeakMap,kt=new WeakMap,no=new WeakMap,so=new WeakMap,cn=new WeakMap,mn=new WeakMap,N=new WeakMap;var z=H;function Ws(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>new z(i.data,e)),before:r.data.before,after:r.data.after}}var jR=(q=>(q.Custom="CUSTOM",q.Reddit="REDDIT",q.Instagram="INSTAGRAM",q.Twitter="TWITTER",q.Tiktok="TIKTOK",q.Twitch="TWITCH",q.Facebook="FACEBOOK",q.Youtube="YOUTUBE",q.Tumblr="TUMBLR",q.Spotify="SPOTIFY",q.Soundcloud="SOUNDCLOUD",q.Beacons="BEACONS",q.Linktree="LINKTREE",q.Discord="DISCORD",q.Venmo="VENMO",q.CashApp="CASH_APP",q.Patreon="PATREON",q.Kofi="KOFI",q.Paypal="PAYPAL",q.Cameo="CAMEO",q.Onlyfans="ONLYFANS",q.Substack="SUBSTACK",q.Kickstarter="KICKSTARTER",q.Indiegogo="INDIEGOGO",q.BuyMeACoffee="BUY_ME_A_COFFEE",q.Shopify="SHOPIFY",q))(jR||{}),oo,pn,ao,lo,uo,co,mo,tr,po,go,at,qr=class qr{constructor(e,t){l(this,oo);l(this,pn);l(this,ao);l(this,lo);l(this,uo);l(this,co);l(this,mo);l(this,tr,new Map);l(this,po);l(this,go);l(this,at);X(this),h(e.id,"User ID is missing or undefined"),h(e.name,"Username is missing or undefined"),h(e.createdUtc,"User is missing created date"),d(this,oo,ne(ud(e.id)?e.id:`t2_${e.id}`)),d(this,pn,e.name),d(this,co,e.over18??!1),d(this,mo,e.isEmployee??!1);let i=new Date(0);if(i.setUTCSeconds(e.createdUtc),d(this,ao,i),d(this,lo,e.linkKarma??0),d(this,uo,e.commentKarma??0),e.modPermissions)for(let[n,o]of Object.entries(e.modPermissions))s(this,tr).set(n,yS(o));d(this,po,new URL(e.subreddit?.url??"","https://www.reddit.com").toString()),d(this,go,e.subreddit?.url??""),d(this,at,t)}get id(){return s(this,oo)}get username(){return s(this,pn)}get createdAt(){return s(this,ao)}get linkKarma(){return s(this,lo)}get commentKarma(){return s(this,uo)}get nsfw(){return s(this,co)}get isAdmin(){return s(this,mo)}get modPermissions(){return s(this,tr)}get url(){return s(this,po)}get permalink(){return s(this,go)}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,tr).has(e))return s(this,tr).get(e);let t=await qr.getSubredditUsersByType({subredditName:e,type:"moderators",username:this.username},s(this,at)).all();if(t.length===0)return[];let i=t[0].modPermissions.get(e)??[];return i.length>0&&s(this,tr).set(e,i),i}getComments(e){return ee.getCommentsByUser({username:this.username,...e},s(this,at))}getPosts(e){return z.getPostsByUser({username:this.username,...e},s(this,at))}async getUserFlairBySubreddit(e){let t=await Ue.getUserFlairBySubreddit({subreddit:e,name:s(this,pn)},s(this,at));return t.users[0]?js(t.users[0]):void 0}getSnoovatarUrl(){return qr.getSnoovatarUrl(this.username,s(this,at))}async getSocialLinks(){let i=await bt.query("GetUserSocialLinks","2aca18ef5f4fc75fb91cdaace3e9aeeae2cb3843b5c26ad511e6f01b8521593a",{name:this.username},s(this,at));return i.data?.user?.profile?.socialLinks?i.data.user.profile.socialLinks.map(n=>({...n,handle:n.handle??void 0})):[]}static async getById(e,t){let o=(await u.redditAPIPlugins.Users.UserDataByAccountIds({ids:e},t))?.users?.[e]?.name;return o==null?void 0:qr.getByUsername(o,t)}static async getByUsername(e,t){let n=await u.redditAPIPlugins.Users.UserAbout({username:e},t);if(n.data?.id)return new qr(n.data,t)}static async getFromMetadata(e,t){h(t);let i=t?.[e]?.values[0];return i?qr.getById(ne(i),t):Promise.resolve(void 0)}static getSubredditUsersByType(e,t){let i=u.redditAPIPlugins.Subreddits;return new G({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 GR(o,e.subredditName,t)}})}static async createRelationship(e,t){let i=u.redditAPIPlugins.Users,{type:n,subredditName:o,username:a,permissions:c,...p}=e,g=await i.Friend({type:n,subreddit:o,name:a,permissions:c?Em(c):void 0,...p},t);if(g.json?.errors?.length)throw new Error(g.json.errors.join(`
4
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:Em(i)},n);if(a.json?.errors?.length)throw new Error(a.json.errors.join(`
5
- `))}static async getSnoovatarUrl(e,t){return(await kt.query("GetSnoovatarUrlByName","c47fd42345af268616d2d8904b56856acdc05cf61d3650380f539ad7d596ac0c",{username:e},t)).data?.redditorInfoByName?.snoovatarIcon?.url}static getOverview(e,t){let i=u.redditAPIPlugins.Users;return new G({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 WR(o,t)}})}};oo=new WeakMap,pn=new WeakMap,ao=new WeakMap,lo=new WeakMap,uo=new WeakMap,co=new WeakMap,mo=new WeakMap,tr=new WeakMap,po=new WeakMap,go=new WeakMap,at=new WeakMap;var I=qr;function WR(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 z(i.data,e);if(i.kind==="t1")return new ee(i.data,e);throw new Error(`Type ${i.kind} is not supported`)}),before:r.data.before,after:r.data.after}}async function GR(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=>(h(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;h(m,"User id is missing from listing");let b=p[m];return h(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 Hr,ho,gn,hn,fo,vo,fn,yo,bo,vn,rr,ko,So,jr,ir,nr,Pt,Wr,Ct,Po,Co,wo,Io,Fo,xo,Ao,sr,Q,dt,Yd,Qd,j=class j{constructor(e,t){l(this,Hr);l(this,ho);l(this,gn);l(this,hn);l(this,fo);l(this,vo);l(this,fn);l(this,yo);l(this,bo);l(this,vn);l(this,rr);l(this,ko);l(this,So);l(this,jr);l(this,ir);l(this,nr);l(this,Pt);l(this,Wr);l(this,Ct);l(this,Po);l(this,Co);l(this,wo);l(this,Io);l(this,Fo);l(this,xo);l(this,Ao);l(this,sr);l(this,Q);var n;X(this),h(e.id,"Comment id is null or undefined"),h(e.body,"Comment body is null or undefined"),h(e.createdUtc,"Comment is missing created date"),h(e.author,"Comment author is null or undefined"),h(e.parentId,"Comment parentId is null or undefined"),h(e.linkId,"Comment linkId is null or undefined"),h(e.permalink,"Comment permalink is null or undefined"),h(e.subreddit,"Comment is missing subreddit name"),h(e.subredditId,"Comment is missing subreddit id"),d(this,Hr,ni(`t1_${e.id}`)),d(this,ho,e.authorFullname?ne(e.authorFullname):void 0),d(this,gn,e.author),d(this,hn,e.body),d(this,yo,Re(e.subredditId)),d(this,bo,e.subreddit),d(this,vo,gc(e.parentId)?ni(e.parentId):fe(e.parentId)),d(this,fn,fe(e.linkId)),d(this,jr,e.edited??!1),d(this,ir,e.locked??!1),d(this,nr,e.removed??!1),d(this,Pt,e.stickied??!1),d(this,rr,e.approved??!1),d(this,ko,e.approvedAtUtc??0),d(this,So,e.bannedAtUtc??0),d(this,Wr,e.spam??!1),d(this,Ct,e.distinguished),d(this,Po,e.numReports??0),d(this,Co,e.collapsedBecauseCrowdControl??!1),d(this,wo,e.score??0),d(this,Io,e.permalink),d(this,Ao,new URL(e.permalink??"","https://www.reddit.com/").toString()),d(this,sr,e.ignoreReports??!1),d(this,Fo,(e.modReports??[]).map(([o])=>o)),d(this,xo,(e.userReports??[]).map(([o])=>o));let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,fo,i),d(this,vn,S(n=j,dt,Yd).call(n,{postId:s(this,fn),commentId:s(this,Hr)},t)),d(this,Q,t)}get id(){return s(this,Hr)}get authorId(){return s(this,ho)}get authorName(){return s(this,gn)}get subredditId(){return s(this,yo)}get subredditName(){return s(this,bo)}get body(){return s(this,hn)}get createdAt(){return s(this,fo)}get parentId(){return s(this,vo)}get postId(){return s(this,fn)}get replies(){return s(this,vn)}get distinguishedBy(){return s(this,Ct)}get locked(){return s(this,ir)}get stickied(){return s(this,Pt)}get removed(){return s(this,nr)}get approved(){return s(this,rr)}get approvedAtUtc(){return s(this,ko)}get bannedAtUtc(){return s(this,So)}get spam(){return s(this,Wr)}get edited(){return s(this,jr)}get numReports(){return s(this,Po)}get collapsedBecauseCrowdControl(){return s(this,Co)}get score(){return s(this,wo)}get permalink(){return s(this,Io)}get userReportReasons(){return s(this,xo)}get modReportReasons(){return s(this,Fo)}get url(){return s(this,Ao)}get ignoringReports(){return s(this,sr)}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,ignoringReports:this.ignoringReports}}isLocked(){return s(this,ir)}isApproved(){return s(this,rr)}isRemoved(){return s(this,nr)}isSpam(){return s(this,Wr)}isStickied(){return s(this,Pt)}isDistinguished(){return!!s(this,Ct)}isEdited(){return s(this,jr)}isIgnoringReports(){return s(this,sr)}async delete(){return j.delete(this.id,s(this,Q))}async edit(e){let t=await j.edit({id:this.id,...e},s(this,Q));return d(this,hn,t.body),d(this,jr,t.edited),this}async approve(){await j.approve(this.id,s(this,Q)),d(this,rr,!0),d(this,nr,!1)}async remove(e=!1){await j.remove(this.id,e,s(this,Q)),d(this,nr,!0),d(this,Wr,e),d(this,rr,!1)}async lock(){await j.lock(this.id,s(this,Q)),d(this,ir,!0)}async unlock(){await j.unlock(this.id,s(this,Q)),d(this,ir,!1)}async reply(e){return j.submit({id:this.id,...e},s(this,Q))}async getAuthor(){return I.getByUsername(s(this,gn),s(this,Q))}async distinguish(e=!1){let{distinguishedBy:t,stickied:i}=await j.distinguish(this.id,e,!1,s(this,Q));d(this,Ct,t),d(this,Pt,i)}async distinguishAsAdmin(e=!1){let{distinguishedBy:t,stickied:i}=await j.distinguish(this.id,e,!0,s(this,Q));d(this,Ct,t),d(this,Pt,i)}async undistinguish(){let{distinguishedBy:e,stickied:t}=await j.undistinguish(this.id,s(this,Q));d(this,Ct,e),d(this,Pt,t)}async ignoreReports(){await j.ignoreReports(this.id,s(this,Q)),d(this,sr,!0)}async unignoreReports(){await j.unignoreReports(this.id,s(this,Q)),d(this,sr,!1)}addRemovalNote(e){return Me.addRemovalNote({itemIds:[s(this,Hr)],...e},s(this,Q))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=At(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 j(o.data.children[0].data,t)}static getComments(e,t){var a;let{postId:i,commentId:n,...o}=e;return S(a=j,dt,Yd).call(a,{postId:fe(i),commentId:n?ni(n):void 0,...o},t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=Wi(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 h(c),new j(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=Wi(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 h(c),new j(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 h(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 h(o),{distinguishedBy:o.distinguished,stickied:!!o.stickied}}static getCommentsByUser(e,t){let i=u.redditAPIPlugins.Users;return new G({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 h(o.data,"Failed to get comments for user"),{children:o.data.children?.map(c=>new j(c.data,t))||[],before:o.data.before,after:o.data.after}}})}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)}};Hr=new WeakMap,ho=new WeakMap,gn=new WeakMap,hn=new WeakMap,fo=new WeakMap,vo=new WeakMap,fn=new WeakMap,yo=new WeakMap,bo=new WeakMap,vn=new WeakMap,rr=new WeakMap,ko=new WeakMap,So=new WeakMap,jr=new WeakMap,ir=new WeakMap,nr=new WeakMap,Pt=new WeakMap,Wr=new WeakMap,Ct=new WeakMap,Po=new WeakMap,Co=new WeakMap,wo=new WeakMap,Io=new WeakMap,Fo=new WeakMap,xo=new WeakMap,Ao=new WeakMap,sr=new WeakMap,Q=new WeakMap,dt=new WeakSet,Yd=function(e,t,i=0){return new G({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),A=await c.MoreChildren({linkId:e.postId,children:w,sort:e.sort},t);if(!A.json?.data?.things?.length)return{children:[]};let{children:B}=S(b=j,dt,Qd).call(b,A.json.data.things,e.postId,e,t);return{children:B,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=j,dt,Qd).call(y,v,p??e.postId,e,t,i)}})},Qd=function(e,t,i,n,o=0){var g,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 j(m.data,n);if(p[y.id]=y,d(y,vn,S(g=j,dt,Yd).call(g,{...i,postId:y.postId,commentId:y.id},n,o)),"replyList"in m.data&&m.data.replyList?.data){let{children:C,more:w}=S(v=j,dt,Qd).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:gc(m.data.parentId)?ni(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(j,dt);var ee=j;function gd(r,e){let t=u.redditAPIPlugins.Moderation;return new G({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 VR(n)}})}function VR(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:g,srId36:v,description:m,details:b,targetAuthor:y,targetBody:C,targetFullname:w,targetPermalink:A,targetTitle:B}=t.data;h(i,"ModAction from AboutLogResponse is missing id"),h(n,"ModAction from AboutLogResponse is missing mod"),h(o,"ModAction from AboutLogResponse is missing modId36"),h(a,"ModAction from AboutLogResponse is missing createdUtc"),h(c,"ModAction from AboutLogResponse is missing subreddit"),h(p,"ModAction from AboutLogResponse is missing subredditNamePrefixed"),h(g,"ModAction from AboutLogResponse is missing action"),h(v,"ModAction from AboutLogResponse is missing srId36");let me=new Date(0);return me.setUTCSeconds(a),{id:i,type:g,moderatorName:n,moderatorId:`t2_${o}`,createdAt:me,subredditName:c,subredditId:`t5_${v}`,description:m,details:b,target:w?{id:w,author:y,body:C,permalink:A,title:B}:void 0}}),after:r.data.after,before:r.data.before}}var zR=(a=>(a.New="New",a.InProgress="InProgress",a.Archived="Archived",a.Appeals="Appeals",a.JoinRequests="JoinRequests",a.Filtered="Filtered",a))(zR||{}),JR={0:"New",1:"InProgress",2:"Archived",3:"Appeals",4:"JoinRequests",5:"Filtered"},$R=(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))($R||{}),KR={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"},V,J,oe,CS,wS,hd=class{constructor(e){l(this,J);l(this,V);d(this,V,e)}async bulkReadConversations(e,t){let i=u.redditAPIPlugins.NewModmail,{conversationIds:n}=await i.BulkReadConversations({entity:e.join(","),state:t},s(this,V));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,V)),n={};for(let o in i.conversations)n[o]=S(this,J,oe).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,V));return{participantSubreddit:i.participantSubreddit,conversation:S(this,J,oe).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,V));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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V))}async unreadConversations(e){await u.redditAPIPlugins.NewModmail.Unread({conversationIds:e.join(",")},s(this,V))}async approveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ApproveConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getUnreadCount(){return await u.redditAPIPlugins.NewModmail.UnreadCount({},s(this,V))}async getUserConversations(e){return await u.redditAPIPlugins.NewModmail.UserConversations({conversationId:e},s(this,V))}};V=new WeakMap,J=new WeakSet,oe=function({protoConversation:e,protoMessages:t,protoModActions:i}){return{...e,state:JR[e.state],messages:S(this,J,CS).call(this,e,t),modActions:S(this,J,wS).call(this,e,i)}},CS=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},wS=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:KR[a.actionTypeId]})}return i};var yn,bn,el,To,Eo,Ro,Oo,Mm=class Mm{constructor(e,t){l(this,yn);l(this,bn);l(this,el);l(this,To);l(this,Eo);l(this,Ro);l(this,Oo);if(X(this),h(e.id,"PrivateMessage: Invalid data, no id"),h(e.name,"PrivateMessage: Invalid data, no name"),h(e.created,"PrivateMessage: Invalid data, no created date"),d(this,yn,ve(e.name)),e.author!=null)d(this,bn,{type:"user",username:e.author,id:e.authorFullname?ne(e.authorFullname):void 0});else if(e.subreddit!=null)d(this,bn,{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,To,e.body??""),d(this,Eo,e.bodyHtml??"");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Ro,i),d(this,el,e.parentId?ve(e.parentId):void 0),d(this,Oo,t)}static async getMessages(e,t){let i=u.redditAPIPlugins.PrivateMessages;return new G({...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 Mm(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,yn)}get from(){return s(this,bn)}get body(){return s(this,To)}get bodyHtml(){return s(this,Eo)}get created(){return s(this,Ro)}async markAsRead(){await u.redditAPIPlugins.PrivateMessages.ReadMessage({id:s(this,yn)},s(this,Oo))}};yn=new WeakMap,bn=new WeakMap,el=new WeakMap,To=new WeakMap,Eo=new WeakMap,Ro=new WeakMap,Oo=new WeakMap;var fr=Mm;var ay=(o=>(o.Reports="reports",o.Spam="spam",o.Modqueue="modqueue",o.Unmoderated="unmoderated",o.Edited="edited",o))(ay||{}),kn,x,Bo,Mo,Uo,Lo,Do,No,_o,qo,Ho,Sn,T,lt=class lt{constructor(e,t){l(this,kn);l(this,x);l(this,Bo);l(this,Mo);l(this,Uo);l(this,Lo);l(this,Do);l(this,No);l(this,_o);l(this,qo);l(this,Ho);l(this,Sn);l(this,T);X(this),h(e.id,"Subreddit id is missing or undefined"),h(e.displayName,"Subreddit name is missing or undefined"),d(this,kn,Re(`t5_${e.id}`)),d(this,x,e.displayName),h(e.createdUtc,"Subreddit is missing created date");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Bo,i),d(this,Mo,XR(e.subredditType)),d(this,Uo,e.title),d(this,Lo,e.description),h(e.lang,"Subreddit is missing language"),d(this,Do,e.lang),d(this,No,e.subscribers??0),d(this,_o,e.activeUserCount??0),d(this,qo,e.over18??!1),d(this,Sn,e.url??""),d(this,Ho,{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:ZR(e.submissionType),allowedMediaInComments:(e.allowedMediaInComments??[]).map(YR),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,Sn),"https://www.reddit.com").toString()}),d(this,T,t)}get id(){return s(this,kn)}get name(){return s(this,x)}get createdAt(){return s(this,Bo)}get type(){return s(this,Mo)}get title(){return s(this,Uo)}get description(){return s(this,Lo)}get language(){return s(this,Do)}get numberOfSubscribers(){return s(this,No)}get numberOfActiveUsers(){return s(this,_o)}get nsfw(){return s(this,qo)}get settings(){return s(this,Ho)}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,Sn)}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 z.submit(t,s(this,T))}getControversialPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getControversialPosts({...e,subredditName:s(this,x)},s(this,T))}getTopPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getTopPosts({...e,subredditName:s(this,x)},s(this,T))}getApprovedUsers(e={}){return I.getSubredditUsersByType({type:"contributors",subredditName:s(this,x),...e},s(this,T))}approveUser(e){return I.createRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,T))}removeUser(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,T))}getWikiContributors(e={}){return I.getSubredditUsersByType({type:"wikicontributors",subredditName:s(this,x),...e},s(this,T))}addWikiContributor(e){return I.createRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,T))}removeWikiContributor(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,T))}getBannedUsers(e={}){return I.getSubredditUsersByType({type:"banned",subredditName:s(this,x),...e},s(this,T))}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,T))}unbanUser(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"banned"},s(this,T))}getBannedWikiContributors(e={}){return I.getSubredditUsersByType({type:"wikibanned",subredditName:s(this,x),...e},s(this,T))}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,T))}unbanWikiContributor(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"wikibanned"},s(this,T))}getModerators(e={}){return I.getSubredditUsersByType({type:"moderators",subredditName:s(this,x),...e},s(this,T))}inviteModerator(e,t){return I.createRelationship({type:"moderator_invite",subredditName:s(this,x),username:e,permissions:t??[]},s(this,T))}revokeModeratorInvite(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"moderator_invite"},s(this,T))}removeModerator(e){return I.removeRelationship({type:"moderator",subredditName:s(this,x),username:e},s(this,T))}setModeratorPermissions(e,t){return I.setModeratorPermissions(e,s(this,x),t,s(this,T))}getMutedUsers(e={}){return I.getSubredditUsersByType({type:"muted",subredditName:s(this,x),...e},s(this,T))}muteUser(e,t){return I.createRelationship({username:e,subredditName:s(this,x),type:"muted",note:t},s(this,T))}unmuteUser(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"muted"},s(this,T))}getModerationLog(e){return gd({subredditName:s(this,x),...e},s(this,T))}getUserFlairTemplates(){return de.getUserFlairTemplates(s(this,x),s(this,T))}getPostFlairTemplates(){return de.getPostFlairTemplates(s(this,x),s(this,T))}createPostFlairTemplate(e){return de.createPostFlairTemplate({subredditName:s(this,x),...e},s(this,T))}createUserFlairTemplate(e){return de.createUserFlairTemplate({subredditName:s(this,x),...e},s(this,T))}async getUserFlair(e){if(e?.usernames!==void 0)return{users:await Promise.all(e.usernames.map(async i=>{let n=await Ue.getUserFlairBySubreddit({subreddit:s(this,x),name:i},s(this,T));return js(n.users[0])}))};{let t=await Ue.getUserFlairBySubreddit({...e,subreddit:s(this,x)},s(this,T));return{next:t.next,prev:t.prev,users:t.users.map(i=>js(i))}}}getModQueue(e={type:"all"}){return lt.aboutLocation({...e,location:"modqueue",subreddit:s(this,x)},s(this,T))}getReports(e={type:"all"}){return lt.aboutLocation({...e,location:"reports",subreddit:s(this,x)},s(this,T))}getSpam(e={type:"all"}){return lt.aboutLocation({...e,location:"spam",subreddit:s(this,x)},s(this,T))}getUnmoderated(e={type:"all"}){return lt.aboutLocation({...e,location:"unmoderated",subreddit:s(this,x)},s(this,T))}getEdited(e={type:"all"}){return lt.aboutLocation({...e,location:"edited",subreddit:s(this,x)},s(this,T))}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 G({...e,fetch:async o=>{let a=await i.AboutLocation({...o,...e,only:n},t);return IS(a,t)}})}getCommentsAndPostsByIds(e){let t=u.redditAPIPlugins.LinksAndComments;return new G({fetch:async()=>{let i=await t.Info({thingIds:e,subreddits:[s(this,kn)]},s(this,T));return IS(i,s(this,T))}})}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){h(e);let t=e?.[L.Subreddit]?.values[0];return h(t),lt.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 h(o),lt.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 lt(n.data,t)}};kn=new WeakMap,x=new WeakMap,Bo=new WeakMap,Mo=new WeakMap,Uo=new WeakMap,Lo=new WeakMap,Do=new WeakMap,No=new WeakMap,_o=new WeakMap,qo=new WeakMap,Ho=new WeakMap,Sn=new WeakMap,T=new WeakMap;var ye=lt;async function dy(r,e){let o=(await kt.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 XR(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 ZR(r){if(r==="any"||r==="link"||r==="self")return r;throw new Error(`invalid allowed post type: ${r}`)}function YR(r){if(r==="animated"||r==="giphy"||r==="static"||r==="expression")return r;throw new Error(`invalid comment media type: ${r}`)}function IS(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 z(a.data,e)}catch{return null}}function o(a){try{return new ee(a.data,e)}catch{return null}}}async function ly(r,e){return FS("GetVaultContactByAddress","3e2f7966a5c120e64fd2795d06a46595c52d988185be98d3ed71c3f81ae80d2e",{provider:"ethereum",address:r},e)}async function uy(r,e){return FS("GetVaultContactByUserId","a854ddc19d0e22c4f36ed917fdbd568f299f3571427e393aee5e2972080fffe9",{provider:"ethereum",userId:r},e)}async function FS(r,e,t,i){let o=(await kt.query(r,e,t,i))?.data?.vault?.contact;return{provider:o?.provider,userId:ne(o?.userId),address:o?.address,createdAt:o?.createdAt,isActive:o?.isActive}}import{CommunityListWidget_CommunityData as QR,GetWidgetsResponse_WidgetItem as ce}from"@devvit/protos";var jo,Wo,Go,Vo,Lm=class Lm{constructor(e,t,i){l(this,jo);l(this,Wo);l(this,Go);l(this,Vo);X(this),d(this,jo,e.id),d(this,Wo,e.shortName),d(this,Go,t),d(this,Vo,i)}get id(){return s(this,jo)}get name(){return s(this,Wo)}get subredditName(){return s(this,Go)}toJSON(){return{id:this.id,name:this.name,subredditName:this.subredditName}}delete(){return Lm.delete(this.subredditName,this.id,s(this,Vo))}static async getWidgets(e,t){let n=await u.redditAPIPlugins.Widgets.GetWidgets({subreddit:e},t);h(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 tl(p,e,t));break;case"calendar":a.push(new rl(p,e,t));break;case"textarea":a.push(new il(p,e,t));break;case"button":a.push(new nl(p,e,t));break;case"community-list":a.push(new sl(p,e,t));break;case"post-flair":a.push(new ol(p,e,t));break;case"custom":a.push(new al(p,e,t));break;case"subreddit-rules":{let g=await u.redditAPIPlugins.Subreddits.SubredditAboutRules({subreddit:e},t);a.push(new Um(g,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 tl.create(e,t);case"calendar":return rl.create(e,t);case"textarea":return il.create(e,t);case"button":return nl.create(e,t);case"community-list":return sl.create(e,t);case"post-flair":return ol.create(e,t);case"custom":return al.create(e,t);default:throw new Error("Unknown widget type")}}};jo=new WeakMap,Wo=new WeakMap,Go=new WeakMap,Vo=new WeakMap;var se=Lm,zo,dl=class dl extends se{constructor(t,i,n){super(t,i,n);l(this,zo);d(this,zo,t.data.map(o=>(h(o.url,"Image widget data is missing url"),h(o.height,"Image widget data is missing height"),h(o.width,"Image widget data is missing width"),h(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,zo)}toJSON(){return{...super.toJSON(),images:this.images}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddImageWidget(t,i);return new dl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateImageWidget(t,i);return new dl(ce.fromJSON(o),t.subreddit,i)}};zo=new WeakMap;var tl=dl,Jo,$o,Ko,ll=class ll extends se{constructor(t,i,n){super(t,i,n);l(this,Jo);l(this,$o);l(this,Ko);h(t.googleCalendarId,"Calendar widget data is missing googleCalendarId"),h(t.configuration,"Calendar widget data is missing configuration"),h(t.styles,"Calendar widget data is missing styles"),d(this,Jo,t.googleCalendarId),d(this,$o,t.configuration),d(this,Ko,t.styles)}get googleCalendarId(){return s(this,Jo)}get configuration(){return s(this,$o)}get styles(){return s(this,Ko)}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 ll(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCalendarWidget(t,i);return new ll(ce.fromJSON(o),t.subreddit,i)}};Jo=new WeakMap,$o=new WeakMap,Ko=new WeakMap;var rl=ll,Xo,Zo,ul=class ul extends se{constructor(t,i,n){super(t,i,n);l(this,Xo);l(this,Zo);h(t.text,"Textarea widget data is missing text"),h(t.styles,"Textarea widget data is missing styles"),d(this,Xo,t.text),d(this,Zo,t.styles)}get text(){return s(this,Xo)}get styles(){return s(this,Zo)}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 ul(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateTextAreaWidget(t,i);return new ul(ce.fromJSON(o),t.subreddit,i)}};Xo=new WeakMap,Zo=new WeakMap;var il=ul,Yo,Qo,ea,cl=class cl extends se{constructor(t,i,n){super(t,i,n);l(this,Yo);l(this,Qo);l(this,ea);h(t.styles,"Button widget data is missing styles"),d(this,Yo,t.buttons),d(this,Qo,t.description??""),d(this,ea,t.styles)}get buttons(){return s(this,Yo)}get description(){return s(this,Qo)}get styles(){return s(this,ea)}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 cl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateButtonWidget(t,i);return new cl(ce.fromJSON(o),t.subreddit,i)}};Yo=new WeakMap,Qo=new WeakMap,ea=new WeakMap;var nl=cl,ta,ra,ml=class ml extends se{constructor(t,i,n){super(t,i,n);l(this,ta);l(this,ra);d(this,ta,t.data.map(o=>QR.fromJSON(o))),h(t.styles,"Community list widget data is missing styles"),d(this,ra,t.styles)}get communities(){return s(this,ta)}get styles(){return s(this,ra)}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 ml(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCommunityListWidget(t,i);return new ml(ce.fromJSON(o),t.subreddit,i)}};ta=new WeakMap,ra=new WeakMap;var sl=ml,ia,na,sa,pl=class pl extends se{constructor(t,i,n){super(t,i,n);l(this,ia);l(this,na);l(this,sa);if(h(t.styles,"Post flair widget data is missing styles"),d(this,ia,t.styles),d(this,na,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,sa,t.display)}get styles(){return s(this,ia)}get templates(){return s(this,na)}get display(){return s(this,sa)}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 pl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdatePostFlairWidget(t,i);return new pl(ce.fromJSON(o),t.subreddit,i)}};ia=new WeakMap,na=new WeakMap,sa=new WeakMap;var ol=pl,oa,aa,da,la,ua,gl=class gl extends se{constructor(t,i,n){super(t,i,n);l(this,oa);l(this,aa);l(this,da);l(this,la);l(this,ua);h(t.stylesheetUrl,"Custom widget data is missing stylesheetUrl"),h(t.height,"Custom widget data is missing height"),h(t.css,"Custom widget data is missing css"),d(this,oa,t.imageData??[]),d(this,aa,t.text??""),d(this,da,t.stylesheetUrl),d(this,la,t.height),d(this,ua,t.css)}get images(){return s(this,oa)}get text(){return s(this,aa)}get stylesheetUrl(){return s(this,da)}get height(){return s(this,la)}get css(){return s(this,ua)}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 gl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCustomWidget(t,i);return new gl(ce.fromJSON(o),t.subreddit,i)}};oa=new WeakMap,aa=new WeakMap,da=new WeakMap,la=new WeakMap,ua=new WeakMap;var al=gl,ca,Um=class extends se{constructor(t,i,n,o){super(i,n,o);l(this,ca);let a=t.rules.map(({description:c,priority:p,shortName:g,violationReason:v})=>(h(c,"Subreddit rule is missing description"),h(p,"Subreddit rule is missing priority"),h(g,"Subreddit rule is missing shortName"),h(v,"Subreddit rule is missing violationReason"),{description:c,priority:p,shortName:g,violationReason:v}));d(this,ca,a)}get rules(){return s(this,ca)}toJSON(){return{...super.toJSON(),rules:this.rules}}};ca=new WeakMap;var eO=(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))(eO||{}),Se,Pe,Pn,Cn,wn,In,Fn,Ye,He=class He{constructor(e,t,i,n){l(this,Se);l(this,Pe);l(this,Pn);l(this,Cn);l(this,wn);l(this,In);l(this,Fn);l(this,Ye);X(this),d(this,Se,e),d(this,Pe,t),d(this,Pn,i.contentMd),d(this,Cn,i.revisionId),d(this,wn,new Date(i.revisionDate)),d(this,In,i.reason??""),h(i.revisionBy?.data,"Wiki page author details are missing"),d(this,Fn,new I(i.revisionBy.data,n)),d(this,Ye,n)}get name(){return s(this,Se)}get subredditName(){return s(this,Pe)}get content(){return s(this,Pn)}get revisionId(){return s(this,Cn)}get revisionDate(){return s(this,wn)}get revisionReason(){return s(this,In)}get revisionAuthor(){return s(this,Fn)}toJSON(){return{name:s(this,Se),subredditName:s(this,Pe),content:s(this,Pn),revisionId:s(this,Cn),revisionDate:s(this,wn),revisionReason:s(this,In),revisionAuthor:s(this,Fn).toJSON()}}async update(e,t){return He.updatePage({subredditName:s(this,Pe),page:s(this,Se),content:e,reason:t},s(this,Ye))}async getRevisions(e){return He.getPageRevisions({subredditName:s(this,Pe),page:s(this,Se),...e},s(this,Ye))}async revertTo(e){return He.revertPage(s(this,Pe),s(this,Se),e,s(this,Ye))}async getSettings(){return He.getPageSettings(s(this,Pe),s(this,Se),s(this,Ye))}async updateSettings(e){return He.updatePageSettings({subredditName:s(this,Pe),page:s(this,Se),listed:e.listed,permLevel:e.permLevel},s(this,Ye))}async addEditor(e){return He.addEditor(s(this,Pe),s(this,Se),e,s(this,Ye))}async removeEditor(e){return He.removeEditor(s(this,Pe),s(this,Se),e,s(this,Ye))}static async getPage(e,t,i){let o=await u.redditAPIPlugins.Wiki.GetWikiPage({subreddit:e,page:t},i);return h(o.data,"Failed to get wiki page"),new He(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 He.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),He.getPage(e.subredditName,e.page,t)}static getPageRevisions(e,t){let i=u.redditAPIPlugins.Wiki;return new G({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 tO(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 h(o.data,"Failed to get wiki page settings"),new hl(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 h(n.data,"Failed to update wiki page settings"),new hl(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)}};Se=new WeakMap,Pe=new WeakMap,Pn=new WeakMap,Cn=new WeakMap,wn=new WeakMap,In=new WeakMap,Fn=new WeakMap,Ye=new WeakMap;var be=He,xn,An,Tn,En,Rn,On,Dm=class{constructor(e,t){l(this,xn);l(this,An);l(this,Tn);l(this,En);l(this,Rn);l(this,On);d(this,xn,e.id),d(this,An,e.page),d(this,Tn,new Date(e.timestamp)),h(e.author?.data,"Wiki page revision author details are missing"),d(this,En,new I(e.author.data,t)),d(this,Rn,e.reason??""),d(this,On,e.revisionHidden??!1)}get id(){return s(this,xn)}get page(){return s(this,An)}get date(){return s(this,Tn)}get author(){return s(this,En)}get reason(){return s(this,Rn)}get hidden(){return s(this,On)}toJSON(){return{id:s(this,xn),page:s(this,An),date:s(this,Tn),author:s(this,En).toJSON(),reason:s(this,Rn),hidden:s(this,On)}}};xn=new WeakMap,An=new WeakMap,Tn=new WeakMap,En=new WeakMap,Rn=new WeakMap,On=new WeakMap;var Bn,Mn,Un,hl=class{constructor(e,t){l(this,Bn);l(this,Mn);l(this,Un);d(this,Bn,e.listed),d(this,Mn,e.permLevel),d(this,Un,e.editors.map(i=>(h(i.data,"Wiki page editor details are missing"),new I(i.data,t))))}get listed(){return s(this,Bn)}get permLevel(){return s(this,Mn)}get editors(){return s(this,Un)}toJSON(){return{listed:s(this,Bn),permLevel:s(this,Mn),editors:s(this,Un).map(e=>e.toJSON())}}};Bn=new WeakMap,Mn=new WeakMap,Un=new WeakMap;function tO(r,e){return h(r.data?.children,"Wiki page revision listing is missing children"),{children:r.data.children.map(i=>new Dm(i,e)),before:r.data.before,after:r.data.after}}var rO=(t=>(t.Gallery="GALLERY",t.Timeline="TIMELINE",t))(rO||{});function iO(r){return r==="GALLERY"?"GALLERY":"TIMELINE"}var je,Ce,pa,Ln,Dn,ga,ha,fa,va,wt,ya,ba,Nn,ma=class ma{constructor(e,t){l(this,je);l(this,Ce);l(this,pa);l(this,Ln);l(this,Dn);l(this,ga);l(this,ha);l(this,fa);l(this,va);l(this,wt);l(this,ya);l(this,ba);l(this,Nn);h(e.collectionId,"Collection Id is missing or undefined"),h(e.subredditId,"Subreddit Id is missing or undefined"),h(e.title,"Collection title is missing or undefined"),h(e.authorId,"Collection author's id is missing or undefined"),h(e.authorName,"Collection author's id is missing or undefined"),h(e.createdAtUtc,"Collection create timestamp is missing"),h(e.lastUpdateUtc,"Collection last updated timestamp is missing"),d(this,je,t),d(this,Ce,e.collectionId),d(this,pa,e.subredditId),d(this,Ln,e.title),d(this,Dn,e.description||""),d(this,ga,e.authorId),d(this,ha,e.authorName),d(this,fa,e.permalink),d(this,va,e.primaryLinkId),d(this,wt,e.linkIds||[]),d(this,Nn,iO(e.displayLayout)),d(this,ya,e.createdAtUtc),d(this,ba,e.lastUpdateUtc),X(this)}get id(){return s(this,Ce)}get subredditId(){return s(this,pa)}get title(){return s(this,Ln)}get description(){return s(this,Dn)}get authorId(){return s(this,ga)}get authorName(){return s(this,ha)}get permalink(){return s(this,fa)}get primaryLinkId(){return s(this,va)}get linkIds(){return s(this,wt)}get createdAtUtc(){return s(this,ya)}get lastUpdateUtc(){return s(this,ba)}get displayLayout(){return s(this,Nn)}static async getCollectionById(e,t){let n=await u.redditAPIPlugins.PostCollections.Collection(e,t);return new ma(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 ma(n,t)}static async getCollectionsForSubreddit(e,t){return(await u.redditapiv2Plugin.GetSubredditCollections({srFullname:e.subredditId},t)).collections.map(n=>new ma(n,t))}async addPost(e){await u.redditAPIPlugins.PostCollections.AddPost({collectionId:s(this,Ce),linkFullname:e},s(this,je)),s(this,wt).push(e)}async removePost(e){await u.redditAPIPlugins.PostCollections.RemovePost({collectionId:s(this,Ce),linkFullname:e},s(this,je)),d(this,wt,s(this,wt).filter(i=>i!==e))}async delete(){await u.redditAPIPlugins.PostCollections.Delete({collectionId:s(this,Ce)},s(this,je))}async follow(e){await u.redditAPIPlugins.PostCollections.Follow({collectionId:s(this,Ce),follow:e},s(this,je))}async reorder(e){await u.redditAPIPlugins.PostCollections.Reorder({collectionId:s(this,Ce),linkIds:e.join(",")},s(this,je)),d(this,wt,e)}async updateTitle(e){await u.redditAPIPlugins.PostCollections.UpdateTitle({collectionId:s(this,Ce),title:e},s(this,je)),d(this,Ln,e)}async updateDescription(e){await u.redditAPIPlugins.PostCollections.UpdateDescription({collectionId:s(this,Ce),description:e},s(this,je)),d(this,Dn,e)}async updateLayout(e){await u.redditAPIPlugins.PostCollections.UpdateDisplayLayout({collectionId:s(this,Ce),displayLayout:e},s(this,je)),d(this,Nn,e)}};je=new WeakMap,Ce=new WeakMap,pa=new WeakMap,Ln=new WeakMap,Dn=new WeakMap,ga=new WeakMap,ha=new WeakMap,fa=new WeakMap,va=new WeakMap,wt=new WeakMap,ya=new WeakMap,ba=new WeakMap,Nn=new WeakMap;var hi=ma;var nO=["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"],sO=["border-image","border-image-source","behavior","expression","list-style-image","cursor","content"],oO=["onload","onerror","onclick","onmouseover"];function aO(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 xS(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*(${nO.join("|")})\\b`,"gi"),t=new RegExp(`(${sO.join("|")})\\s*:\\s*url\\s*\\((['"]?)(.*?)\\2\\)`,"gi"),i=new RegExp(`(${oO.join("|")})\\s*(=\\s*(['"]?)(.*?)\\3)?`,"gi");r=r.trim().replace(/\s+/g," "),r=aO(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 aH(r,...e){let t="";return r.forEach((i,n)=>{t+=i;let o=e[n];o!==void 0&&(t+=`${o}`)}),t=xS(t),t===void 0?"":`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t)}`}export{AM as ALL_ICON_NAMES,ay as AboutLocations,nl as ButtonWidget,rl as CalendarWidget,rO as CollectionDisplayLayout,ee as Comment,sl as CommunityListWidget,al as CustomWidget,u as Devvit,Ue as Flair,de as FlairTemplate,ER as FlairType,Tt as Hook,tl as ImageWidget,G as Listing,$R as ModMailActionType,zR as ModMailConversationState,hd as ModMailService,Me as ModNote,z as Post,hi as PostCollection,ol as PostFlairWidget,fr as PrivateMessage,qs as RichTextBuilder,hc as SettingScope,jR as SocialLinkType,ye as Subreddit,Um as SubredditRulesWidget,il as TextAreaWidget,I as User,se as Widget,be as WikiPage,eO as WikiPagePermissionLevel,Dm as WikiPageRevision,hl as WikiPageSettings,js as convertUserFlairProtoToAPI,gd as getModerationLog,dy as getSubredditLeaderboard,ly as getVaultByAddress,uy as getVaultByUserId,aH as svg,mR as useAsync,am as useChannel,im as useForm,um as useInterval,fm as useState};
5
+ `))}static async getSnoovatarUrl(e,t){return(await bt.query("GetSnoovatarUrlByName","c47fd42345af268616d2d8904b56856acdc05cf61d3650380f539ad7d596ac0c",{username:e},t)).data?.redditorInfoByName?.snoovatarIcon?.url}static getOverview(e,t){let i=u.redditAPIPlugins.Users;return new G({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 WR(o,t)}})}};oo=new WeakMap,pn=new WeakMap,ao=new WeakMap,lo=new WeakMap,uo=new WeakMap,co=new WeakMap,mo=new WeakMap,tr=new WeakMap,po=new WeakMap,go=new WeakMap,at=new WeakMap;var I=qr;function WR(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 z(i.data,e);if(i.kind==="t1")return new ee(i.data,e);throw new Error(`Type ${i.kind} is not supported`)}),before:r.data.before,after:r.data.after}}async function GR(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=>(h(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;h(m,"User id is missing from listing");let b=p[m];return h(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 Hr,ho,gn,hn,fo,vo,fn,yo,bo,vn,rr,ko,So,jr,ir,nr,St,Wr,Pt,Po,Co,wo,Io,Fo,xo,Ao,sr,Q,dt,Yd,Qd,j=class j{constructor(e,t){l(this,Hr);l(this,ho);l(this,gn);l(this,hn);l(this,fo);l(this,vo);l(this,fn);l(this,yo);l(this,bo);l(this,vn);l(this,rr);l(this,ko);l(this,So);l(this,jr);l(this,ir);l(this,nr);l(this,St);l(this,Wr);l(this,Pt);l(this,Po);l(this,Co);l(this,wo);l(this,Io);l(this,Fo);l(this,xo);l(this,Ao);l(this,sr);l(this,Q);var n;X(this),h(e.id,"Comment id is null or undefined"),h(e.body,"Comment body is null or undefined"),h(e.createdUtc,"Comment is missing created date"),h(e.author,"Comment author is null or undefined"),h(e.parentId,"Comment parentId is null or undefined"),h(e.linkId,"Comment linkId is null or undefined"),h(e.permalink,"Comment permalink is null or undefined"),h(e.subreddit,"Comment is missing subreddit name"),h(e.subredditId,"Comment is missing subreddit id"),d(this,Hr,ni(`t1_${e.id}`)),d(this,ho,e.authorFullname?ne(e.authorFullname):void 0),d(this,gn,e.author),d(this,hn,e.body),d(this,yo,Re(e.subredditId)),d(this,bo,e.subreddit),d(this,vo,gc(e.parentId)?ni(e.parentId):fe(e.parentId)),d(this,fn,fe(e.linkId)),d(this,jr,e.edited??!1),d(this,ir,e.locked??!1),d(this,nr,e.removed??!1),d(this,St,e.stickied??!1),d(this,rr,e.approved??!1),d(this,ko,e.approvedAtUtc??0),d(this,So,e.bannedAtUtc??0),d(this,Wr,e.spam??!1),d(this,Pt,e.distinguished),d(this,Po,e.numReports??0),d(this,Co,e.collapsedBecauseCrowdControl??!1),d(this,wo,e.score??0),d(this,Io,e.permalink),d(this,Ao,new URL(e.permalink??"","https://www.reddit.com/").toString()),d(this,sr,e.ignoreReports??!1),d(this,Fo,(e.modReports??[]).map(([o])=>o)),d(this,xo,(e.userReports??[]).map(([o])=>o));let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,fo,i),d(this,vn,S(n=j,dt,Yd).call(n,{postId:s(this,fn),commentId:s(this,Hr)},t)),d(this,Q,t)}get id(){return s(this,Hr)}get authorId(){return s(this,ho)}get authorName(){return s(this,gn)}get subredditId(){return s(this,yo)}get subredditName(){return s(this,bo)}get body(){return s(this,hn)}get createdAt(){return s(this,fo)}get parentId(){return s(this,vo)}get postId(){return s(this,fn)}get replies(){return s(this,vn)}get distinguishedBy(){return s(this,Pt)}get locked(){return s(this,ir)}get stickied(){return s(this,St)}get removed(){return s(this,nr)}get approved(){return s(this,rr)}get approvedAtUtc(){return s(this,ko)}get bannedAtUtc(){return s(this,So)}get spam(){return s(this,Wr)}get edited(){return s(this,jr)}get numReports(){return s(this,Po)}get collapsedBecauseCrowdControl(){return s(this,Co)}get score(){return s(this,wo)}get permalink(){return s(this,Io)}get userReportReasons(){return s(this,xo)}get modReportReasons(){return s(this,Fo)}get url(){return s(this,Ao)}get ignoringReports(){return s(this,sr)}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,ignoringReports:this.ignoringReports}}isLocked(){return s(this,ir)}isApproved(){return s(this,rr)}isRemoved(){return s(this,nr)}isSpam(){return s(this,Wr)}isStickied(){return s(this,St)}isDistinguished(){return!!s(this,Pt)}isEdited(){return s(this,jr)}isIgnoringReports(){return s(this,sr)}async delete(){return j.delete(this.id,s(this,Q))}async edit(e){let t=await j.edit({id:this.id,...e},s(this,Q));return d(this,hn,t.body),d(this,jr,t.edited),this}async approve(){await j.approve(this.id,s(this,Q)),d(this,rr,!0),d(this,nr,!1)}async remove(e=!1){await j.remove(this.id,e,s(this,Q)),d(this,nr,!0),d(this,Wr,e),d(this,rr,!1)}async lock(){await j.lock(this.id,s(this,Q)),d(this,ir,!0)}async unlock(){await j.unlock(this.id,s(this,Q)),d(this,ir,!1)}async reply(e){return j.submit({id:this.id,...e},s(this,Q))}async getAuthor(){return I.getByUsername(s(this,gn),s(this,Q))}async distinguish(e=!1){let{distinguishedBy:t,stickied:i}=await j.distinguish(this.id,e,!1,s(this,Q));d(this,Pt,t),d(this,St,i)}async distinguishAsAdmin(e=!1){let{distinguishedBy:t,stickied:i}=await j.distinguish(this.id,e,!0,s(this,Q));d(this,Pt,t),d(this,St,i)}async undistinguish(){let{distinguishedBy:e,stickied:t}=await j.undistinguish(this.id,s(this,Q));d(this,Pt,e),d(this,St,t)}async ignoreReports(){await j.ignoreReports(this.id,s(this,Q)),d(this,sr,!0)}async unignoreReports(){await j.unignoreReports(this.id,s(this,Q)),d(this,sr,!1)}addRemovalNote(e){return Me.addRemovalNote({itemIds:[s(this,Hr)],...e},s(this,Q))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=xt(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 j(o.data.children[0].data,t)}static getComments(e,t){var a;let{postId:i,commentId:n,...o}=e;return S(a=j,dt,Yd).call(a,{postId:fe(i),commentId:n?ni(n):void 0,...o},t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=Wi(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 h(c),new j(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=Wi(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 h(c),new j(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 h(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 h(o),{distinguishedBy:o.distinguished,stickied:!!o.stickied}}static getCommentsByUser(e,t){let i=u.redditAPIPlugins.Users;return new G({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 h(o.data,"Failed to get comments for user"),{children:o.data.children?.map(c=>new j(c.data,t))||[],before:o.data.before,after:o.data.after}}})}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)}};Hr=new WeakMap,ho=new WeakMap,gn=new WeakMap,hn=new WeakMap,fo=new WeakMap,vo=new WeakMap,fn=new WeakMap,yo=new WeakMap,bo=new WeakMap,vn=new WeakMap,rr=new WeakMap,ko=new WeakMap,So=new WeakMap,jr=new WeakMap,ir=new WeakMap,nr=new WeakMap,St=new WeakMap,Wr=new WeakMap,Pt=new WeakMap,Po=new WeakMap,Co=new WeakMap,wo=new WeakMap,Io=new WeakMap,Fo=new WeakMap,xo=new WeakMap,Ao=new WeakMap,sr=new WeakMap,Q=new WeakMap,dt=new WeakSet,Yd=function(e,t,i=0){return new G({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),A=await c.MoreChildren({linkId:e.postId,children:w,sort:e.sort},t);if(!A.json?.data?.things?.length)return{children:[]};let{children:B}=S(b=j,dt,Qd).call(b,A.json.data.things,e.postId,e,t);return{children:B,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=j,dt,Qd).call(y,v,p??e.postId,e,t,i)}})},Qd=function(e,t,i,n,o=0){var g,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 j(m.data,n);if(p[y.id]=y,d(y,vn,S(g=j,dt,Yd).call(g,{...i,postId:y.postId,commentId:y.id},n,o)),"replyList"in m.data&&m.data.replyList?.data){let{children:C,more:w}=S(v=j,dt,Qd).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:gc(m.data.parentId)?ni(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(j,dt);var ee=j;function gd(r,e){let t=u.redditAPIPlugins.Moderation;return new G({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 VR(n)}})}function VR(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:g,srId36:v,description:m,details:b,targetAuthor:y,targetBody:C,targetFullname:w,targetPermalink:A,targetTitle:B}=t.data;h(i,"ModAction from AboutLogResponse is missing id"),h(n,"ModAction from AboutLogResponse is missing mod"),h(o,"ModAction from AboutLogResponse is missing modId36"),h(a,"ModAction from AboutLogResponse is missing createdUtc"),h(c,"ModAction from AboutLogResponse is missing subreddit"),h(p,"ModAction from AboutLogResponse is missing subredditNamePrefixed"),h(g,"ModAction from AboutLogResponse is missing action"),h(v,"ModAction from AboutLogResponse is missing srId36");let me=new Date(0);return me.setUTCSeconds(a),{id:i,type:g,moderatorName:n,moderatorId:`t2_${o}`,createdAt:me,subredditName:c,subredditId:`t5_${v}`,description:m,details:b,target:w?{id:w,author:y,body:C,permalink:A,title:B}:void 0}}),after:r.data.after,before:r.data.before}}var zR=(a=>(a.New="New",a.InProgress="InProgress",a.Archived="Archived",a.Appeals="Appeals",a.JoinRequests="JoinRequests",a.Filtered="Filtered",a))(zR||{}),JR={0:"New",1:"InProgress",2:"Archived",3:"Appeals",4:"JoinRequests",5:"Filtered"},$R=(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))($R||{}),KR={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"},V,J,oe,CS,wS,hd=class{constructor(e){l(this,J);l(this,V);d(this,V,e)}async bulkReadConversations(e,t){let i=u.redditAPIPlugins.NewModmail,{conversationIds:n}=await i.BulkReadConversations({entity:e.join(","),state:t},s(this,V));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,V)),n={};for(let o in i.conversations)n[o]=S(this,J,oe).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,V));return{participantSubreddit:i.participantSubreddit,conversation:S(this,J,oe).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,V));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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V))}async unreadConversations(e){await u.redditAPIPlugins.NewModmail.Unread({conversationIds:e.join(",")},s(this,V))}async approveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ApproveConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).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,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getUnreadCount(){return await u.redditAPIPlugins.NewModmail.UnreadCount({},s(this,V))}async getUserConversations(e){return await u.redditAPIPlugins.NewModmail.UserConversations({conversationId:e},s(this,V))}};V=new WeakMap,J=new WeakSet,oe=function({protoConversation:e,protoMessages:t,protoModActions:i}){return{...e,state:JR[e.state],messages:S(this,J,CS).call(this,e,t),modActions:S(this,J,wS).call(this,e,i)}},CS=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},wS=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:KR[a.actionTypeId]})}return i};var yn,bn,el,To,Eo,Ro,Oo,Mm=class Mm{constructor(e,t){l(this,yn);l(this,bn);l(this,el);l(this,To);l(this,Eo);l(this,Ro);l(this,Oo);if(X(this),h(e.id,"PrivateMessage: Invalid data, no id"),h(e.name,"PrivateMessage: Invalid data, no name"),h(e.created,"PrivateMessage: Invalid data, no created date"),d(this,yn,ve(e.name)),e.author!=null)d(this,bn,{type:"user",username:e.author,id:e.authorFullname?ne(e.authorFullname):void 0});else if(e.subreddit!=null)d(this,bn,{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,To,e.body??""),d(this,Eo,e.bodyHtml??"");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Ro,i),d(this,el,e.parentId?ve(e.parentId):void 0),d(this,Oo,t)}static async getMessages(e,t){let i=u.redditAPIPlugins.PrivateMessages;return new G({...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 Mm(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,yn)}get from(){return s(this,bn)}get body(){return s(this,To)}get bodyHtml(){return s(this,Eo)}get created(){return s(this,Ro)}async markAsRead(){await u.redditAPIPlugins.PrivateMessages.ReadMessage({id:s(this,yn)},s(this,Oo))}};yn=new WeakMap,bn=new WeakMap,el=new WeakMap,To=new WeakMap,Eo=new WeakMap,Ro=new WeakMap,Oo=new WeakMap;var fr=Mm;var ay=(o=>(o.Reports="reports",o.Spam="spam",o.Modqueue="modqueue",o.Unmoderated="unmoderated",o.Edited="edited",o))(ay||{}),kn,x,Bo,Mo,Uo,Lo,Do,No,_o,qo,Ho,Sn,T,lt=class lt{constructor(e,t){l(this,kn);l(this,x);l(this,Bo);l(this,Mo);l(this,Uo);l(this,Lo);l(this,Do);l(this,No);l(this,_o);l(this,qo);l(this,Ho);l(this,Sn);l(this,T);X(this),h(e.id,"Subreddit id is missing or undefined"),h(e.displayName,"Subreddit name is missing or undefined"),d(this,kn,Re(`t5_${e.id}`)),d(this,x,e.displayName),h(e.createdUtc,"Subreddit is missing created date");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Bo,i),d(this,Mo,XR(e.subredditType)),d(this,Uo,e.title),d(this,Lo,e.description),h(e.lang,"Subreddit is missing language"),d(this,Do,e.lang),d(this,No,e.subscribers??0),d(this,_o,e.activeUserCount??0),d(this,qo,e.over18??!1),d(this,Sn,e.url??""),d(this,Ho,{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:ZR(e.submissionType),allowedMediaInComments:(e.allowedMediaInComments??[]).map(YR),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,Sn),"https://www.reddit.com").toString()}),d(this,T,t)}get id(){return s(this,kn)}get name(){return s(this,x)}get createdAt(){return s(this,Bo)}get type(){return s(this,Mo)}get title(){return s(this,Uo)}get description(){return s(this,Lo)}get language(){return s(this,Do)}get numberOfSubscribers(){return s(this,No)}get numberOfActiveUsers(){return s(this,_o)}get nsfw(){return s(this,qo)}get settings(){return s(this,Ho)}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,Sn)}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 z.submit(t,s(this,T))}getControversialPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getControversialPosts({...e,subredditName:s(this,x)},s(this,T))}getTopPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getTopPosts({...e,subredditName:s(this,x)},s(this,T))}getApprovedUsers(e={}){return I.getSubredditUsersByType({type:"contributors",subredditName:s(this,x),...e},s(this,T))}approveUser(e){return I.createRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,T))}removeUser(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,T))}getWikiContributors(e={}){return I.getSubredditUsersByType({type:"wikicontributors",subredditName:s(this,x),...e},s(this,T))}addWikiContributor(e){return I.createRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,T))}removeWikiContributor(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,T))}getBannedUsers(e={}){return I.getSubredditUsersByType({type:"banned",subredditName:s(this,x),...e},s(this,T))}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,T))}unbanUser(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"banned"},s(this,T))}getBannedWikiContributors(e={}){return I.getSubredditUsersByType({type:"wikibanned",subredditName:s(this,x),...e},s(this,T))}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,T))}unbanWikiContributor(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"wikibanned"},s(this,T))}getModerators(e={}){return I.getSubredditUsersByType({type:"moderators",subredditName:s(this,x),...e},s(this,T))}inviteModerator(e,t){return I.createRelationship({type:"moderator_invite",subredditName:s(this,x),username:e,permissions:t??[]},s(this,T))}revokeModeratorInvite(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"moderator_invite"},s(this,T))}removeModerator(e){return I.removeRelationship({type:"moderator",subredditName:s(this,x),username:e},s(this,T))}setModeratorPermissions(e,t){return I.setModeratorPermissions(e,s(this,x),t,s(this,T))}getMutedUsers(e={}){return I.getSubredditUsersByType({type:"muted",subredditName:s(this,x),...e},s(this,T))}muteUser(e,t){return I.createRelationship({username:e,subredditName:s(this,x),type:"muted",note:t},s(this,T))}unmuteUser(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"muted"},s(this,T))}getModerationLog(e){return gd({subredditName:s(this,x),...e},s(this,T))}getUserFlairTemplates(){return de.getUserFlairTemplates(s(this,x),s(this,T))}getPostFlairTemplates(){return de.getPostFlairTemplates(s(this,x),s(this,T))}createPostFlairTemplate(e){return de.createPostFlairTemplate({subredditName:s(this,x),...e},s(this,T))}createUserFlairTemplate(e){return de.createUserFlairTemplate({subredditName:s(this,x),...e},s(this,T))}async getUserFlair(e){if(e?.usernames!==void 0)return{users:await Promise.all(e.usernames.map(async i=>{let n=await Ue.getUserFlairBySubreddit({subreddit:s(this,x),name:i},s(this,T));return js(n.users[0])}))};{let t=await Ue.getUserFlairBySubreddit({...e,subreddit:s(this,x)},s(this,T));return{next:t.next,prev:t.prev,users:t.users.map(i=>js(i))}}}getModQueue(e={type:"all"}){return lt.aboutLocation({...e,location:"modqueue",subreddit:s(this,x)},s(this,T))}getReports(e={type:"all"}){return lt.aboutLocation({...e,location:"reports",subreddit:s(this,x)},s(this,T))}getSpam(e={type:"all"}){return lt.aboutLocation({...e,location:"spam",subreddit:s(this,x)},s(this,T))}getUnmoderated(e={type:"all"}){return lt.aboutLocation({...e,location:"unmoderated",subreddit:s(this,x)},s(this,T))}getEdited(e={type:"all"}){return lt.aboutLocation({...e,location:"edited",subreddit:s(this,x)},s(this,T))}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 G({...e,fetch:async o=>{let a=await i.AboutLocation({...o,...e,only:n},t);return IS(a,t)}})}getCommentsAndPostsByIds(e){let t=u.redditAPIPlugins.LinksAndComments;return new G({fetch:async()=>{let i=await t.Info({thingIds:e,subreddits:[s(this,kn)]},s(this,T));return IS(i,s(this,T))}})}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){h(e);let t=e?.[L.Subreddit]?.values[0];return h(t),lt.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 h(o),lt.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 lt(n.data,t)}};kn=new WeakMap,x=new WeakMap,Bo=new WeakMap,Mo=new WeakMap,Uo=new WeakMap,Lo=new WeakMap,Do=new WeakMap,No=new WeakMap,_o=new WeakMap,qo=new WeakMap,Ho=new WeakMap,Sn=new WeakMap,T=new WeakMap;var ye=lt;async function dy(r,e){let o=(await bt.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 XR(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 ZR(r){if(r==="any"||r==="link"||r==="self")return r;throw new Error(`invalid allowed post type: ${r}`)}function YR(r){if(r==="animated"||r==="giphy"||r==="static"||r==="expression")return r;throw new Error(`invalid comment media type: ${r}`)}function IS(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 z(a.data,e)}catch{return null}}function o(a){try{return new ee(a.data,e)}catch{return null}}}async function ly(r,e){return FS("GetVaultContactByAddress","3e2f7966a5c120e64fd2795d06a46595c52d988185be98d3ed71c3f81ae80d2e",{provider:"ethereum",address:r},e)}async function uy(r,e){return FS("GetVaultContactByUserId","a854ddc19d0e22c4f36ed917fdbd568f299f3571427e393aee5e2972080fffe9",{provider:"ethereum",userId:r},e)}async function FS(r,e,t,i){let o=(await bt.query(r,e,t,i))?.data?.vault?.contact;return{provider:o?.provider,userId:ne(o?.userId),address:o?.address,createdAt:o?.createdAt,isActive:o?.isActive}}import{CommunityListWidget_CommunityData as QR,GetWidgetsResponse_WidgetItem as ce}from"@devvit/protos";var jo,Wo,Go,Vo,Lm=class Lm{constructor(e,t,i){l(this,jo);l(this,Wo);l(this,Go);l(this,Vo);X(this),d(this,jo,e.id),d(this,Wo,e.shortName),d(this,Go,t),d(this,Vo,i)}get id(){return s(this,jo)}get name(){return s(this,Wo)}get subredditName(){return s(this,Go)}toJSON(){return{id:this.id,name:this.name,subredditName:this.subredditName}}delete(){return Lm.delete(this.subredditName,this.id,s(this,Vo))}static async getWidgets(e,t){let n=await u.redditAPIPlugins.Widgets.GetWidgets({subreddit:e},t);h(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 tl(p,e,t));break;case"calendar":a.push(new rl(p,e,t));break;case"textarea":a.push(new il(p,e,t));break;case"button":a.push(new nl(p,e,t));break;case"community-list":a.push(new sl(p,e,t));break;case"post-flair":a.push(new ol(p,e,t));break;case"custom":a.push(new al(p,e,t));break;case"subreddit-rules":{let g=await u.redditAPIPlugins.Subreddits.SubredditAboutRules({subreddit:e},t);a.push(new Um(g,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 tl.create(e,t);case"calendar":return rl.create(e,t);case"textarea":return il.create(e,t);case"button":return nl.create(e,t);case"community-list":return sl.create(e,t);case"post-flair":return ol.create(e,t);case"custom":return al.create(e,t);default:throw new Error("Unknown widget type")}}};jo=new WeakMap,Wo=new WeakMap,Go=new WeakMap,Vo=new WeakMap;var se=Lm,zo,dl=class dl extends se{constructor(t,i,n){super(t,i,n);l(this,zo);d(this,zo,t.data.map(o=>(h(o.url,"Image widget data is missing url"),h(o.height,"Image widget data is missing height"),h(o.width,"Image widget data is missing width"),h(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,zo)}toJSON(){return{...super.toJSON(),images:this.images}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddImageWidget(t,i);return new dl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateImageWidget(t,i);return new dl(ce.fromJSON(o),t.subreddit,i)}};zo=new WeakMap;var tl=dl,Jo,$o,Ko,ll=class ll extends se{constructor(t,i,n){super(t,i,n);l(this,Jo);l(this,$o);l(this,Ko);h(t.googleCalendarId,"Calendar widget data is missing googleCalendarId"),h(t.configuration,"Calendar widget data is missing configuration"),h(t.styles,"Calendar widget data is missing styles"),d(this,Jo,t.googleCalendarId),d(this,$o,t.configuration),d(this,Ko,t.styles)}get googleCalendarId(){return s(this,Jo)}get configuration(){return s(this,$o)}get styles(){return s(this,Ko)}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 ll(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCalendarWidget(t,i);return new ll(ce.fromJSON(o),t.subreddit,i)}};Jo=new WeakMap,$o=new WeakMap,Ko=new WeakMap;var rl=ll,Xo,Zo,ul=class ul extends se{constructor(t,i,n){super(t,i,n);l(this,Xo);l(this,Zo);h(t.text,"Textarea widget data is missing text"),h(t.styles,"Textarea widget data is missing styles"),d(this,Xo,t.text),d(this,Zo,t.styles)}get text(){return s(this,Xo)}get styles(){return s(this,Zo)}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 ul(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateTextAreaWidget(t,i);return new ul(ce.fromJSON(o),t.subreddit,i)}};Xo=new WeakMap,Zo=new WeakMap;var il=ul,Yo,Qo,ea,cl=class cl extends se{constructor(t,i,n){super(t,i,n);l(this,Yo);l(this,Qo);l(this,ea);h(t.styles,"Button widget data is missing styles"),d(this,Yo,t.buttons),d(this,Qo,t.description??""),d(this,ea,t.styles)}get buttons(){return s(this,Yo)}get description(){return s(this,Qo)}get styles(){return s(this,ea)}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 cl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateButtonWidget(t,i);return new cl(ce.fromJSON(o),t.subreddit,i)}};Yo=new WeakMap,Qo=new WeakMap,ea=new WeakMap;var nl=cl,ta,ra,ml=class ml extends se{constructor(t,i,n){super(t,i,n);l(this,ta);l(this,ra);d(this,ta,t.data.map(o=>QR.fromJSON(o))),h(t.styles,"Community list widget data is missing styles"),d(this,ra,t.styles)}get communities(){return s(this,ta)}get styles(){return s(this,ra)}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 ml(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCommunityListWidget(t,i);return new ml(ce.fromJSON(o),t.subreddit,i)}};ta=new WeakMap,ra=new WeakMap;var sl=ml,ia,na,sa,pl=class pl extends se{constructor(t,i,n){super(t,i,n);l(this,ia);l(this,na);l(this,sa);if(h(t.styles,"Post flair widget data is missing styles"),d(this,ia,t.styles),d(this,na,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,sa,t.display)}get styles(){return s(this,ia)}get templates(){return s(this,na)}get display(){return s(this,sa)}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 pl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdatePostFlairWidget(t,i);return new pl(ce.fromJSON(o),t.subreddit,i)}};ia=new WeakMap,na=new WeakMap,sa=new WeakMap;var ol=pl,oa,aa,da,la,ua,gl=class gl extends se{constructor(t,i,n){super(t,i,n);l(this,oa);l(this,aa);l(this,da);l(this,la);l(this,ua);h(t.stylesheetUrl,"Custom widget data is missing stylesheetUrl"),h(t.height,"Custom widget data is missing height"),h(t.css,"Custom widget data is missing css"),d(this,oa,t.imageData??[]),d(this,aa,t.text??""),d(this,da,t.stylesheetUrl),d(this,la,t.height),d(this,ua,t.css)}get images(){return s(this,oa)}get text(){return s(this,aa)}get stylesheetUrl(){return s(this,da)}get height(){return s(this,la)}get css(){return s(this,ua)}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 gl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCustomWidget(t,i);return new gl(ce.fromJSON(o),t.subreddit,i)}};oa=new WeakMap,aa=new WeakMap,da=new WeakMap,la=new WeakMap,ua=new WeakMap;var al=gl,ca,Um=class extends se{constructor(t,i,n,o){super(i,n,o);l(this,ca);let a=t.rules.map(({description:c,priority:p,shortName:g,violationReason:v})=>(h(c,"Subreddit rule is missing description"),h(p,"Subreddit rule is missing priority"),h(g,"Subreddit rule is missing shortName"),h(v,"Subreddit rule is missing violationReason"),{description:c,priority:p,shortName:g,violationReason:v}));d(this,ca,a)}get rules(){return s(this,ca)}toJSON(){return{...super.toJSON(),rules:this.rules}}};ca=new WeakMap;var eO=(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))(eO||{}),Se,Pe,Pn,Cn,wn,In,Fn,Ye,He=class He{constructor(e,t,i,n){l(this,Se);l(this,Pe);l(this,Pn);l(this,Cn);l(this,wn);l(this,In);l(this,Fn);l(this,Ye);X(this),d(this,Se,e),d(this,Pe,t),d(this,Pn,i.contentMd),d(this,Cn,i.revisionId),d(this,wn,new Date(i.revisionDate)),d(this,In,i.reason??""),h(i.revisionBy?.data,"Wiki page author details are missing"),d(this,Fn,new I(i.revisionBy.data,n)),d(this,Ye,n)}get name(){return s(this,Se)}get subredditName(){return s(this,Pe)}get content(){return s(this,Pn)}get revisionId(){return s(this,Cn)}get revisionDate(){return s(this,wn)}get revisionReason(){return s(this,In)}get revisionAuthor(){return s(this,Fn)}toJSON(){return{name:s(this,Se),subredditName:s(this,Pe),content:s(this,Pn),revisionId:s(this,Cn),revisionDate:s(this,wn),revisionReason:s(this,In),revisionAuthor:s(this,Fn).toJSON()}}async update(e,t){return He.updatePage({subredditName:s(this,Pe),page:s(this,Se),content:e,reason:t},s(this,Ye))}async getRevisions(e){return He.getPageRevisions({subredditName:s(this,Pe),page:s(this,Se),...e},s(this,Ye))}async revertTo(e){return He.revertPage(s(this,Pe),s(this,Se),e,s(this,Ye))}async getSettings(){return He.getPageSettings(s(this,Pe),s(this,Se),s(this,Ye))}async updateSettings(e){return He.updatePageSettings({subredditName:s(this,Pe),page:s(this,Se),listed:e.listed,permLevel:e.permLevel},s(this,Ye))}async addEditor(e){return He.addEditor(s(this,Pe),s(this,Se),e,s(this,Ye))}async removeEditor(e){return He.removeEditor(s(this,Pe),s(this,Se),e,s(this,Ye))}static async getPage(e,t,i){let o=await u.redditAPIPlugins.Wiki.GetWikiPage({subreddit:e,page:t},i);return h(o.data,"Failed to get wiki page"),new He(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 He.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),He.getPage(e.subredditName,e.page,t)}static getPageRevisions(e,t){let i=u.redditAPIPlugins.Wiki;return new G({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 tO(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 h(o.data,"Failed to get wiki page settings"),new hl(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 h(n.data,"Failed to update wiki page settings"),new hl(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)}};Se=new WeakMap,Pe=new WeakMap,Pn=new WeakMap,Cn=new WeakMap,wn=new WeakMap,In=new WeakMap,Fn=new WeakMap,Ye=new WeakMap;var be=He,xn,An,Tn,En,Rn,On,Dm=class{constructor(e,t){l(this,xn);l(this,An);l(this,Tn);l(this,En);l(this,Rn);l(this,On);d(this,xn,e.id),d(this,An,e.page),d(this,Tn,new Date(e.timestamp)),h(e.author?.data,"Wiki page revision author details are missing"),d(this,En,new I(e.author.data,t)),d(this,Rn,e.reason??""),d(this,On,e.revisionHidden??!1)}get id(){return s(this,xn)}get page(){return s(this,An)}get date(){return s(this,Tn)}get author(){return s(this,En)}get reason(){return s(this,Rn)}get hidden(){return s(this,On)}toJSON(){return{id:s(this,xn),page:s(this,An),date:s(this,Tn),author:s(this,En).toJSON(),reason:s(this,Rn),hidden:s(this,On)}}};xn=new WeakMap,An=new WeakMap,Tn=new WeakMap,En=new WeakMap,Rn=new WeakMap,On=new WeakMap;var Bn,Mn,Un,hl=class{constructor(e,t){l(this,Bn);l(this,Mn);l(this,Un);d(this,Bn,e.listed),d(this,Mn,e.permLevel),d(this,Un,e.editors.map(i=>(h(i.data,"Wiki page editor details are missing"),new I(i.data,t))))}get listed(){return s(this,Bn)}get permLevel(){return s(this,Mn)}get editors(){return s(this,Un)}toJSON(){return{listed:s(this,Bn),permLevel:s(this,Mn),editors:s(this,Un).map(e=>e.toJSON())}}};Bn=new WeakMap,Mn=new WeakMap,Un=new WeakMap;function tO(r,e){return h(r.data?.children,"Wiki page revision listing is missing children"),{children:r.data.children.map(i=>new Dm(i,e)),before:r.data.before,after:r.data.after}}var rO=(t=>(t.Gallery="GALLERY",t.Timeline="TIMELINE",t))(rO||{});function iO(r){return r==="GALLERY"?"GALLERY":"TIMELINE"}var je,Ce,pa,Ln,Dn,ga,ha,fa,va,Ct,ya,ba,Nn,ma=class ma{constructor(e,t){l(this,je);l(this,Ce);l(this,pa);l(this,Ln);l(this,Dn);l(this,ga);l(this,ha);l(this,fa);l(this,va);l(this,Ct);l(this,ya);l(this,ba);l(this,Nn);h(e.collectionId,"Collection Id is missing or undefined"),h(e.subredditId,"Subreddit Id is missing or undefined"),h(e.title,"Collection title is missing or undefined"),h(e.authorId,"Collection author's id is missing or undefined"),h(e.authorName,"Collection author's id is missing or undefined"),h(e.createdAtUtc,"Collection create timestamp is missing"),h(e.lastUpdateUtc,"Collection last updated timestamp is missing"),d(this,je,t),d(this,Ce,e.collectionId),d(this,pa,e.subredditId),d(this,Ln,e.title),d(this,Dn,e.description||""),d(this,ga,e.authorId),d(this,ha,e.authorName),d(this,fa,e.permalink),d(this,va,e.primaryLinkId),d(this,Ct,e.linkIds||[]),d(this,Nn,iO(e.displayLayout)),d(this,ya,e.createdAtUtc),d(this,ba,e.lastUpdateUtc),X(this)}get id(){return s(this,Ce)}get subredditId(){return s(this,pa)}get title(){return s(this,Ln)}get description(){return s(this,Dn)}get authorId(){return s(this,ga)}get authorName(){return s(this,ha)}get permalink(){return s(this,fa)}get primaryLinkId(){return s(this,va)}get linkIds(){return s(this,Ct)}get createdAtUtc(){return s(this,ya)}get lastUpdateUtc(){return s(this,ba)}get displayLayout(){return s(this,Nn)}static async getCollectionById(e,t){let n=await u.redditAPIPlugins.PostCollections.Collection(e,t);return new ma(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 ma(n,t)}static async getCollectionsForSubreddit(e,t){return(await u.redditapiv2Plugin.GetSubredditCollections({srFullname:e.subredditId},t)).collections.map(n=>new ma(n,t))}async addPost(e){await u.redditAPIPlugins.PostCollections.AddPost({collectionId:s(this,Ce),linkFullname:e},s(this,je)),s(this,Ct).push(e)}async removePost(e){await u.redditAPIPlugins.PostCollections.RemovePost({collectionId:s(this,Ce),linkFullname:e},s(this,je)),d(this,Ct,s(this,Ct).filter(i=>i!==e))}async delete(){await u.redditAPIPlugins.PostCollections.Delete({collectionId:s(this,Ce)},s(this,je))}async follow(e){await u.redditAPIPlugins.PostCollections.Follow({collectionId:s(this,Ce),follow:e},s(this,je))}async reorder(e){await u.redditAPIPlugins.PostCollections.Reorder({collectionId:s(this,Ce),linkIds:e.join(",")},s(this,je)),d(this,Ct,e)}async updateTitle(e){await u.redditAPIPlugins.PostCollections.UpdateTitle({collectionId:s(this,Ce),title:e},s(this,je)),d(this,Ln,e)}async updateDescription(e){await u.redditAPIPlugins.PostCollections.UpdateDescription({collectionId:s(this,Ce),description:e},s(this,je)),d(this,Dn,e)}async updateLayout(e){await u.redditAPIPlugins.PostCollections.UpdateDisplayLayout({collectionId:s(this,Ce),displayLayout:e},s(this,je)),d(this,Nn,e)}};je=new WeakMap,Ce=new WeakMap,pa=new WeakMap,Ln=new WeakMap,Dn=new WeakMap,ga=new WeakMap,ha=new WeakMap,fa=new WeakMap,va=new WeakMap,Ct=new WeakMap,ya=new WeakMap,ba=new WeakMap,Nn=new WeakMap;var hi=ma;var nO=["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"],sO=["border-image","border-image-source","behavior","expression","list-style-image","cursor","content"],oO=["onload","onerror","onclick","onmouseover"];function aO(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 xS(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*(${nO.join("|")})\\b`,"gi"),t=new RegExp(`(${sO.join("|")})\\s*:\\s*url\\s*\\((['"]?)(.*?)\\2\\)`,"gi"),i=new RegExp(`(${oO.join("|")})\\s*(=\\s*(['"]?)(.*?)\\3)?`,"gi");r=r.trim().replace(/\s+/g," "),r=aO(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 aH(r,...e){let t="";return r.forEach((i,n)=>{t+=i;let o=e[n];o!==void 0&&(t+=`${o}`)}),t=xS(t),t===void 0?"":`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t)}`}export{AM as ALL_ICON_NAMES,ay as AboutLocations,nl as ButtonWidget,rl as CalendarWidget,rO as CollectionDisplayLayout,ee as Comment,sl as CommunityListWidget,al as CustomWidget,u as Devvit,Ue as Flair,de as FlairTemplate,ER as FlairType,At as Hook,tl as ImageWidget,G as Listing,$R as ModMailActionType,zR as ModMailConversationState,hd as ModMailService,Me as ModNote,z as Post,hi as PostCollection,ol as PostFlairWidget,fr as PrivateMessage,qs as RichTextBuilder,hc as SettingScope,jR as SocialLinkType,ye as Subreddit,Um as SubredditRulesWidget,il as TextAreaWidget,I as User,se as Widget,be as WikiPage,eO as WikiPagePermissionLevel,Dm as WikiPageRevision,hl as WikiPageSettings,js as convertUserFlairProtoToAPI,gd as getModerationLog,dy as getSubredditLeaderboard,ly as getVaultByAddress,uy as getVaultByUserId,aH as svg,mR as useAsync,am as useChannel,im as useForm,um as useInterval,fm as useState};
6
6
  /*! Bundled license information:
7
7
 
8
8
  shallow-clone/index.js: