@devvit/public-api 0.11.5-next-2024-12-17-8084aa107.0 → 0.11.6-next-2024-12-18-f16c47ce7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/public-api.iife.js +6 -6
- package/public-api.min.js +1 -1
- package/public-api.min.js.map +1 -1
- package/version.json +5 -5
package/public-api.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var LS=Object.create;var Mm=Object.defineProperty;var DS=Object.getOwnPropertyDescriptor;var NS=Object.getOwnPropertyNames;var _S=Object.getPrototypeOf,HS=Object.prototype.hasOwnProperty;var Um=r=>{throw TypeError(r)};var f=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var qS=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of NS(e))!HS.call(r,n)&&n!==t&&Mm(r,n,{get:()=>e[n],enumerable:!(i=DS(e,n))||i.enumerable});return r};var Ln=(r,e,t)=>(t=r!=null?LS(_S(r)):{},qS(e||!r||!r.__esModule?Mm(t,"default",{value:r,enumerable:!0}):t,r));var cl=(r,e,t)=>e.has(r)||Um("Cannot "+t);var s=(r,e,t)=>(cl(r,e,"read from private field"),t?t.call(r):e.get(r)),l=(r,e,t)=>e.has(r)?Um("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),d=(r,e,t,i)=>(cl(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t),S=(r,e,t)=>(cl(r,e,"access private method"),t);var Lm=(r,e,t,i)=>({set _(n){d(r,e,n,t)},get _(){return s(r,e,i)}});var le=f((fO,Dm)=>{Dm.exports=function(r){try{return!!r()}catch{return!0}}});var ca=f((vO,Nm)=>{var jS=le();Nm.exports=!jS(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Z=f((yO,qm)=>{var _m=ca(),Hm=Function.prototype,ml=Hm.call,WS=_m&&Hm.bind.bind(ml,ml);qm.exports=_m?WS:function(r){return function(){return ml.apply(r,arguments)}}});var Wm=f((bO,jm)=>{var GS=Math.ceil,VS=Math.floor;jm.exports=Math.trunc||function(e){var t=+e;return(t>0?VS:GS)(t)}});var ma=f((kO,Gm)=>{var zS=Wm();Gm.exports=function(r){var e=+r;return e!==e||e===0?0:zS(e)}});var ge=f((SO,Vm)=>{var pa=function(r){return r&&r.Math==Math&&r};Vm.exports=pa(typeof globalThis=="object"&&globalThis)||pa(typeof window=="object"&&window)||pa(typeof self=="object"&&self)||pa(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var Gr=f((CO,zm)=>{zm.exports=!1});var ga=f((PO,$m)=>{var Jm=ge(),JS=Object.defineProperty;$m.exports=function(r,e){try{JS(Jm,r,{value:e,configurable:!0,writable:!0})}catch{Jm[r]=e}return e}});var ha=f((wO,Xm)=>{var $S=ge(),KS=ga(),Km="__core-js_shared__",XS=$S[Km]||KS(Km,{});Xm.exports=XS});var pl=f((IO,Qm)=>{var ZS=Gr(),Zm=ha();(Qm.exports=function(r,e){return Zm[r]||(Zm[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:ZS?"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((xO,Ym)=>{Ym.exports=function(r){return r==null}});var va=f((FO,ep)=>{var QS=fa(),YS=TypeError;ep.exports=function(r){if(QS(r))throw YS("Can't call method on "+r);return r}});var Dn=f((TO,tp)=>{var eC=va(),tC=Object;tp.exports=function(r){return tC(eC(r))}});var we=f((AO,rp)=>{var rC=Z(),iC=Dn(),nC=rC({}.hasOwnProperty);rp.exports=Object.hasOwn||function(e,t){return nC(iC(e),t)}});var gl=f((EO,ip)=>{var sC=Z(),oC=0,aC=Math.random(),dC=sC(1 .toString);ip.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+dC(++oC+aC,36)}});var sp=f((RO,np)=>{np.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var mp=f((OO,cp)=>{var up=ge(),hl=sp(),op=up.process,ap=up.Deno,dp=op&&op.versions||ap&&ap.version,lp=dp&&dp.v8,qe,ya;lp&&(qe=lp.split("."),ya=qe[0]>0&&qe[0]<4?1:+(qe[0]+qe[1]));!ya&&hl&&(qe=hl.match(/Edge\/(\d+)/),(!qe||qe[1]>=74)&&(qe=hl.match(/Chrome\/(\d+)/),qe&&(ya=+qe[1])));cp.exports=ya});var fl=f((BO,gp)=>{var pp=mp(),lC=le();gp.exports=!!Object.getOwnPropertySymbols&&!lC(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&pp&&pp<41})});var vl=f((MO,hp)=>{var uC=fl();hp.exports=uC&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ie=f((UO,vp)=>{var cC=ge(),mC=pl(),fp=we(),pC=gl(),gC=fl(),hC=vl(),Vr=cC.Symbol,yl=mC("wks"),fC=hC?Vr.for||Vr:Vr&&Vr.withoutSetter||pC;vp.exports=function(r){return fp(yl,r)||(yl[r]=gC&&fp(Vr,r)?Vr[r]:fC("Symbol."+r)),yl[r]}});var kp=f((LO,bp)=>{var vC=Ie(),yC=vC("toStringTag"),yp={};yp[yC]="z";bp.exports=String(yp)==="[object z]"});var kl=f((DO,Sp)=>{var bl=typeof document=="object"&&document.all,bC=typeof bl>"u"&&bl!==void 0;Sp.exports={all:bl,IS_HTMLDDA:bC}});var Q=f((NO,Pp)=>{var Cp=kl(),kC=Cp.all;Pp.exports=Cp.IS_HTMLDDA?function(r){return typeof r=="function"||r===kC}:function(r){return typeof r=="function"}});var ba=f((_O,Ip)=>{var wp=Z(),SC=wp({}.toString),CC=wp("".slice);Ip.exports=function(r){return CC(SC(r),8,-1)}});var Nn=f((HO,xp)=>{var PC=kp(),wC=Q(),ka=ba(),IC=Ie(),xC=IC("toStringTag"),FC=Object,TC=ka(function(){return arguments}())=="Arguments",AC=function(r,e){try{return r[e]}catch{}};xp.exports=PC?ka:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=AC(e=FC(r),xC))=="string"?t:TC?ka(e):(i=ka(e))=="Object"&&wC(e.callee)?"Arguments":i}});var _n=f((qO,Fp)=>{var EC=Nn(),RC=String;Fp.exports=function(r){if(EC(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return RC(r)}});var Cl=f((jO,Ep)=>{var Sl=Z(),OC=ma(),BC=_n(),MC=va(),UC=Sl("".charAt),Tp=Sl("".charCodeAt),LC=Sl("".slice),Ap=function(r){return function(e,t){var i=BC(MC(e)),n=OC(t),o=i.length,a,c;return n<0||n>=o?r?"":void 0:(a=Tp(i,n),a<55296||a>56319||n+1===o||(c=Tp(i,n+1))<56320||c>57343?r?UC(i,n):a:r?LC(i,n,n+2):(a-55296<<10)+(c-56320)+65536)}};Ep.exports={codeAt:Ap(!1),charAt:Ap(!0)}});var Bp=f((WO,Op)=>{var DC=ge(),NC=Q(),Rp=DC.WeakMap;Op.exports=NC(Rp)&&/native code/.test(String(Rp))});var Pt=f((GO,Lp)=>{var Mp=Q(),Up=kl(),_C=Up.all;Lp.exports=Up.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:Mp(r)||r===_C}:function(r){return typeof r=="object"?r!==null:Mp(r)}});var he=f((VO,Dp)=>{var HC=le();Dp.exports=!HC(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var wl=f((zO,_p)=>{var qC=ge(),Np=Pt(),Pl=qC.document,jC=Np(Pl)&&Np(Pl.createElement);_p.exports=function(r){return jC?Pl.createElement(r):{}}});var Il=f((JO,Hp)=>{var WC=he(),GC=le(),VC=wl();Hp.exports=!WC&&!GC(function(){return Object.defineProperty(VC("div"),"a",{get:function(){return 7}}).a!=7})});var xl=f(($O,qp)=>{var zC=he(),JC=le();qp.exports=zC&&JC(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Ze=f((KO,jp)=>{var $C=Pt(),KC=String,XC=TypeError;jp.exports=function(r){if($C(r))return r;throw XC(KC(r)+" is not an object")}});var je=f((XO,Wp)=>{var ZC=ca(),Sa=Function.prototype.call;Wp.exports=ZC?Sa.bind(Sa):function(){return Sa.apply(Sa,arguments)}});var Hn=f((ZO,Gp)=>{var Fl=ge(),QC=Q(),YC=function(r){return QC(r)?r:void 0};Gp.exports=function(r,e){return arguments.length<2?YC(Fl[r]):Fl[r]&&Fl[r][e]}});var Tl=f((QO,Vp)=>{var eP=Z();Vp.exports=eP({}.isPrototypeOf)});var Al=f((YO,zp)=>{var tP=Hn(),rP=Q(),iP=Tl(),nP=vl(),sP=Object;zp.exports=nP?function(r){return typeof r=="symbol"}:function(r){var e=tP("Symbol");return rP(e)&&iP(e.prototype,sP(r))}});var El=f((eB,Jp)=>{var oP=String;Jp.exports=function(r){try{return oP(r)}catch{return"Object"}}});var Ca=f((tB,$p)=>{var aP=Q(),dP=El(),lP=TypeError;$p.exports=function(r){if(aP(r))return r;throw lP(dP(r)+" is not a function")}});var Pa=f((rB,Kp)=>{var uP=Ca(),cP=fa();Kp.exports=function(r,e){var t=r[e];return cP(t)?void 0:uP(t)}});var Zp=f((iB,Xp)=>{var Rl=je(),Ol=Q(),Bl=Pt(),mP=TypeError;Xp.exports=function(r,e){var t,i;if(e==="string"&&Ol(t=r.toString)&&!Bl(i=Rl(t,r))||Ol(t=r.valueOf)&&!Bl(i=Rl(t,r))||e!=="string"&&Ol(t=r.toString)&&!Bl(i=Rl(t,r)))return i;throw mP("Can't convert object to primitive value")}});var tg=f((nB,eg)=>{var pP=je(),Qp=Pt(),Yp=Al(),gP=Pa(),hP=Zp(),fP=Ie(),vP=TypeError,yP=fP("toPrimitive");eg.exports=function(r,e){if(!Qp(r)||Yp(r))return r;var t=gP(r,yP),i;if(t){if(e===void 0&&(e="default"),i=pP(t,r,e),!Qp(i)||Yp(i))return i;throw vP("Can't convert object to primitive value")}return e===void 0&&(e="number"),hP(r,e)}});var wa=f((sB,rg)=>{var bP=tg(),kP=Al();rg.exports=function(r){var e=bP(r,"string");return kP(e)?e:e+""}});var Qe=f(ng=>{var SP=he(),CP=Il(),PP=xl(),Ia=Ze(),ig=wa(),wP=TypeError,Ml=Object.defineProperty,IP=Object.getOwnPropertyDescriptor,Ul="enumerable",Ll="configurable",Dl="writable";ng.f=SP?PP?function(e,t,i){if(Ia(e),t=ig(t),Ia(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Dl in i&&!i[Dl]){var n=IP(e,t);n&&n[Dl]&&(e[t]=i.value,i={configurable:Ll in i?i[Ll]:n[Ll],enumerable:Ul in i?i[Ul]:n[Ul],writable:!1})}return Ml(e,t,i)}:Ml:function(e,t,i){if(Ia(e),t=ig(t),Ia(i),CP)try{return Ml(e,t,i)}catch{}if("get"in i||"set"in i)throw wP("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var zr=f((aB,sg)=>{sg.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var xa=f((dB,og)=>{var xP=he(),FP=Qe(),TP=zr();og.exports=xP?function(r,e,t){return FP.f(r,e,TP(1,t))}:function(r,e,t){return r[e]=t,r}});var Fa=f((lB,dg)=>{var AP=pl(),EP=gl(),ag=AP("keys");dg.exports=function(r){return ag[r]||(ag[r]=EP(r))}});var Ta=f((uB,lg)=>{lg.exports={}});var Jr=f((cB,mg)=>{var RP=Bp(),cg=ge(),OP=Pt(),BP=xa(),Nl=we(),_l=ha(),MP=Fa(),UP=Ta(),ug="Object already initialized",Hl=cg.TypeError,LP=cg.WeakMap,Aa,qn,Ea,DP=function(r){return Ea(r)?qn(r):Aa(r,{})},NP=function(r){return function(e){var t;if(!OP(e)||(t=qn(e)).type!==r)throw Hl("Incompatible receiver, "+r+" required");return t}};RP||_l.state?(We=_l.state||(_l.state=new LP),We.get=We.get,We.has=We.has,We.set=We.set,Aa=function(r,e){if(We.has(r))throw Hl(ug);return e.facade=r,We.set(r,e),e},qn=function(r){return We.get(r)||{}},Ea=function(r){return We.has(r)}):(or=MP("state"),UP[or]=!0,Aa=function(r,e){if(Nl(r,or))throw Hl(ug);return e.facade=r,BP(r,or,e),e},qn=function(r){return Nl(r,or)?r[or]:{}},Ea=function(r){return Nl(r,or)});var We,or;mg.exports={set:Aa,get:qn,has:Ea,enforce:DP,getterFor:NP}});var ql=f(hg=>{"use strict";var pg={}.propertyIsEnumerable,gg=Object.getOwnPropertyDescriptor,_P=gg&&!pg.call({1:2},1);hg.f=_P?function(e){var t=gg(this,e);return!!t&&t.enumerable}:pg});var Wl=f((pB,fg)=>{var HP=Z(),qP=le(),jP=ba(),jl=Object,WP=HP("".split);fg.exports=qP(function(){return!jl("z").propertyIsEnumerable(0)})?function(r){return jP(r)=="String"?WP(r,""):jl(r)}:jl});var $r=f((gB,vg)=>{var GP=Wl(),VP=va();vg.exports=function(r){return GP(VP(r))}});var Gl=f(bg=>{var zP=he(),JP=je(),$P=ql(),KP=zr(),XP=$r(),ZP=wa(),QP=we(),YP=Il(),yg=Object.getOwnPropertyDescriptor;bg.f=zP?yg:function(e,t){if(e=XP(e),t=ZP(t),YP)try{return yg(e,t)}catch{}if(QP(e,t))return KP(!JP($P.f,e,t),e[t])}});var Jl=f((fB,Sg)=>{var Vl=he(),e0=we(),kg=Function.prototype,t0=Vl&&Object.getOwnPropertyDescriptor,zl=e0(kg,"name"),r0=zl&&function(){}.name==="something",i0=zl&&(!Vl||Vl&&t0(kg,"name").configurable);Sg.exports={EXISTS:zl,PROPER:r0,CONFIGURABLE:i0}});var Kl=f((vB,Cg)=>{var n0=Z(),s0=Q(),$l=ha(),o0=n0(Function.toString);s0($l.inspectSource)||($l.inspectSource=function(r){return o0(r)});Cg.exports=$l.inspectSource});var Ql=f((yB,Ig)=>{var Zl=Z(),a0=le(),d0=Q(),Ra=we(),Xl=he(),l0=Jl().CONFIGURABLE,u0=Kl(),wg=Jr(),c0=wg.enforce,m0=wg.get,Pg=String,Oa=Object.defineProperty,p0=Zl("".slice),g0=Zl("".replace),h0=Zl([].join),f0=Xl&&!a0(function(){return Oa(function(){},"length",{value:8}).length!==8}),v0=String(String).split("String"),y0=Ig.exports=function(r,e,t){p0(Pg(e),0,7)==="Symbol("&&(e="["+g0(Pg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Ra(r,"name")||l0&&r.name!==e)&&(Xl?Oa(r,"name",{value:e,configurable:!0}):r.name=e),f0&&t&&Ra(t,"arity")&&r.length!==t.arity&&Oa(r,"length",{value:t.arity});try{t&&Ra(t,"constructor")&&t.constructor?Xl&&Oa(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=c0(r);return Ra(i,"source")||(i.source=h0(v0,typeof e=="string"?e:"")),r};Function.prototype.toString=y0(function(){return d0(this)&&m0(this).source||u0(this)},"toString")});var ar=f((bB,xg)=>{var b0=Q(),k0=Qe(),S0=Ql(),C0=ga();xg.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(b0(t)&&S0(t,o,i),i.global)n?r[e]=t:C0(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:k0.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var Yl=f((kB,Fg)=>{var P0=ma(),w0=Math.max,I0=Math.min;Fg.exports=function(r,e){var t=P0(r);return t<0?w0(t+e,0):I0(t,e)}});var Ag=f((SB,Tg)=>{var x0=ma(),F0=Math.min;Tg.exports=function(r){return r>0?F0(x0(r),9007199254740991):0}});var Ba=f((CB,Eg)=>{var T0=Ag();Eg.exports=function(r){return T0(r.length)}});var Bg=f((PB,Og)=>{var A0=$r(),E0=Yl(),R0=Ba(),Rg=function(r){return function(e,t,i){var n=A0(e),o=R0(n),a=E0(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}};Og.exports={includes:Rg(!0),indexOf:Rg(!1)}});var tu=f((wB,Ug)=>{var O0=Z(),eu=we(),B0=$r(),M0=Bg().indexOf,U0=Ta(),Mg=O0([].push);Ug.exports=function(r,e){var t=B0(r),i=0,n=[],o;for(o in t)!eu(U0,o)&&eu(t,o)&&Mg(n,o);for(;e.length>i;)eu(t,o=e[i++])&&(~M0(n,o)||Mg(n,o));return n}});var Ma=f((IB,Lg)=>{Lg.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Ng=f(Dg=>{var L0=tu(),D0=Ma(),N0=D0.concat("length","prototype");Dg.f=Object.getOwnPropertyNames||function(e){return L0(e,N0)}});var ru=f(_g=>{_g.f=Object.getOwnPropertySymbols});var qg=f((TB,Hg)=>{var _0=Hn(),H0=Z(),q0=Ng(),j0=ru(),W0=Ze(),G0=H0([].concat);Hg.exports=_0("Reflect","ownKeys")||function(e){var t=q0.f(W0(e)),i=j0.f;return i?G0(t,i(e)):t}});var Gg=f((AB,Wg)=>{var jg=we(),V0=qg(),z0=Gl(),J0=Qe();Wg.exports=function(r,e,t){for(var i=V0(e),n=J0.f,o=z0.f,a=0;a<i.length;a++){var c=i[a];!jg(r,c)&&!(t&&jg(t,c))&&n(r,c,o(e,c))}}});var zg=f((EB,Vg)=>{var $0=le(),K0=Q(),X0=/#|\.prototype\./,jn=function(r,e){var t=Q0[Z0(r)];return t==ew?!0:t==Y0?!1:K0(e)?$0(e):!!e},Z0=jn.normalize=function(r){return String(r).replace(X0,".").toLowerCase()},Q0=jn.data={},Y0=jn.NATIVE="N",ew=jn.POLYFILL="P";Vg.exports=jn});var Wn=f((RB,Jg)=>{var iu=ge(),tw=Gl().f,rw=xa(),iw=ar(),nw=ga(),sw=Gg(),ow=zg();Jg.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,c,p,g,h;if(i?a=iu:n?a=iu[t]||nw(t,{}):a=(iu[t]||{}).prototype,a)for(c in e){if(g=e[c],r.dontCallGetSet?(h=tw(a,c),p=h&&h.value):p=a[c],o=ow(i?c:t+(n?".":"#")+c,r.forced),!o&&p!==void 0){if(typeof g==typeof p)continue;sw(g,p)}(r.sham||p&&p.sham)&&rw(g,"sham",!0),iw(a,c,g,r)}}});var nu=f((OB,$g)=>{var aw=tu(),dw=Ma();$g.exports=Object.keys||function(e){return aw(e,dw)}});var Xg=f(Kg=>{var lw=he(),uw=xl(),cw=Qe(),mw=Ze(),pw=$r(),gw=nu();Kg.f=lw&&!uw?Object.defineProperties:function(e,t){mw(e);for(var i=pw(t),n=gw(t),o=n.length,a=0,c;o>a;)cw.f(e,c=n[a++],i[c]);return e}});var Qg=f((MB,Zg)=>{var hw=Hn();Zg.exports=hw("document","documentElement")});var Gn=f((UB,sh)=>{var fw=Ze(),vw=Xg(),Yg=Ma(),yw=Ta(),bw=Qg(),kw=wl(),Sw=Fa(),eh=">",th="<",ou="prototype",au="script",ih=Sw("IE_PROTO"),su=function(){},nh=function(r){return th+au+eh+r+th+"/"+au+eh},rh=function(r){r.write(nh("")),r.close();var e=r.parentWindow.Object;return r=null,e},Cw=function(){var r=kw("iframe"),e="java"+au+":",t;return r.style.display="none",bw.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(nh("document.F=Object")),t.close(),t.F},Ua,La=function(){try{Ua=new ActiveXObject("htmlfile")}catch{}La=typeof document<"u"?document.domain&&Ua?rh(Ua):Cw():rh(Ua);for(var r=Yg.length;r--;)delete La[ou][Yg[r]];return La()};yw[ih]=!0;sh.exports=Object.create||function(e,t){var i;return e!==null?(su[ou]=fw(e),i=new su,su[ou]=null,i[ih]=e):i=La(),t===void 0?i:vw.f(i,t)}});var ah=f((LB,oh)=>{var Pw=le();oh.exports=!Pw(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var lu=f((DB,lh)=>{var ww=we(),Iw=Q(),xw=Dn(),Fw=Fa(),Tw=ah(),dh=Fw("IE_PROTO"),du=Object,Aw=du.prototype;lh.exports=Tw?du.getPrototypeOf:function(r){var e=xw(r);if(ww(e,dh))return e[dh];var t=e.constructor;return Iw(t)&&e instanceof t?t.prototype:e instanceof du?Aw:null}});var pu=f((NB,mh)=>{"use strict";var Ew=le(),Rw=Q(),Ow=Pt(),Bw=Gn(),uh=lu(),Mw=ar(),Uw=Ie(),Lw=Gr(),mu=Uw("iterator"),ch=!1,lt,uu,cu;[].keys&&(cu=[].keys(),"next"in cu?(uu=uh(uh(cu)),uu!==Object.prototype&&(lt=uu)):ch=!0);var Dw=!Ow(lt)||Ew(function(){var r={};return lt[mu].call(r)!==r});Dw?lt={}:Lw&&(lt=Bw(lt));Rw(lt[mu])||Mw(lt,mu,function(){return this});mh.exports={IteratorPrototype:lt,BUGGY_SAFARI_ITERATORS:ch}});var Vn=f((_B,gh)=>{var Nw=Qe().f,_w=we(),Hw=Ie(),ph=Hw("toStringTag");gh.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!_w(r,ph)&&Nw(r,ph,{configurable:!0,value:e})}});var Kr=f((HB,hh)=>{hh.exports={}});var gu=f((qB,fh)=>{"use strict";var qw=pu().IteratorPrototype,jw=Gn(),Ww=zr(),Gw=Vn(),Vw=Kr(),zw=function(){return this};fh.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=jw(qw,{next:Ww(+!i,t)}),Gw(r,n,!1,!0),Vw[n]=zw,r}});var yh=f((jB,vh)=>{var Jw=Q(),$w=String,Kw=TypeError;vh.exports=function(r){if(typeof r=="object"||Jw(r))return r;throw Kw("Can't set "+$w(r)+" as a prototype")}});var kh=f((WB,bh)=>{var Xw=Z(),Zw=Ze(),Qw=yh();bh.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=Xw(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return Zw(n),Qw(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var fu=f((GB,Eh)=>{"use strict";var Yw=Wn(),eI=je(),Da=Gr(),Th=Jl(),tI=Q(),rI=gu(),Sh=lu(),Ch=kh(),iI=Vn(),nI=xa(),hu=ar(),sI=Ie(),Ph=Kr(),Ah=pu(),oI=Th.PROPER,aI=Th.CONFIGURABLE,wh=Ah.IteratorPrototype,Na=Ah.BUGGY_SAFARI_ITERATORS,zn=sI("iterator"),Ih="keys",Jn="values",xh="entries",Fh=function(){return this};Eh.exports=function(r,e,t,i,n,o,a){rI(t,e,i);var c=function(U){if(U===n&&y)return y;if(!Na&&U in h)return h[U];switch(U){case Ih:return function(){return new t(this,U)};case Jn:return function(){return new t(this,U)};case xh:return function(){return new t(this,U)}}return function(){return new t(this)}},p=e+" Iterator",g=!1,h=r.prototype,m=h[zn]||h["@@iterator"]||n&&h[n],y=!Na&&m||c(n),b=e=="Array"&&h.entries||m,C,x,I;if(b&&(C=Sh(b.call(new r)),C!==Object.prototype&&C.next&&(!Da&&Sh(C)!==wh&&(Ch?Ch(C,wh):tI(C[zn])||hu(C,zn,Fh)),iI(C,p,!0,!0),Da&&(Ph[p]=Fh))),oI&&n==Jn&&m&&m.name!==Jn&&(!Da&&aI?nI(h,"name",Jn):(g=!0,y=function(){return eI(m,this)})),n)if(x={values:c(Jn),keys:o?y:c(Ih),entries:c(xh)},a)for(I in x)(Na||g||!(I in h))&&hu(h,I,x[I]);else Yw({target:e,proto:!0,forced:Na||g},x);return(!Da||a)&&h[zn]!==y&&hu(h,zn,y,{name:n}),Ph[e]=y,x}});var vu=f((VB,Rh)=>{Rh.exports=function(r,e){return{value:r,done:e}}});var Uh=f(()=>{"use strict";var dI=Cl().charAt,lI=_n(),Bh=Jr(),uI=fu(),Oh=vu(),Mh="String Iterator",cI=Bh.set,mI=Bh.getterFor(Mh);uI(String,"String",function(r){cI(this,{type:Mh,string:lI(r),index:0})},function(){var e=mI(this),t=e.string,i=e.index,n;return i>=t.length?Oh(void 0,!0):(n=dI(t,i),e.index+=n.length,Oh(n,!1))})});var yu=f(($B,Lh)=>{var pI=le(),gI=Ie(),hI=Gr(),fI=gI("iterator");Lh.exports=!pI(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}),hI&&!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[fI]||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 Nh=f((KB,Dh)=>{var vI=ba(),yI=Z();Dh.exports=function(r){if(vI(r)==="Function")return yI(r)}});var _a=f((XB,Hh)=>{var _h=Nh(),bI=Ca(),kI=ca(),SI=_h(_h.bind);Hh.exports=function(r,e){return bI(r),e===void 0?r:kI?SI(r,e):function(){return r.apply(e,arguments)}}});var Wh=f((ZB,jh)=>{var qh=Ql(),CI=Qe();jh.exports=function(r,e,t){return t.get&&qh(t.get,e,{getter:!0}),t.set&&qh(t.set,e,{setter:!0}),CI.f(r,e,t)}});var bu=f((QB,Gh)=>{var PI=Tl(),wI=TypeError;Gh.exports=function(r,e){if(PI(e,r))return r;throw wI("Incorrect invocation")}});var $h=f((YB,Jh)=>{"use strict";var Vh=he(),II=Z(),xI=je(),FI=le(),ku=nu(),TI=ru(),AI=ql(),EI=Dn(),RI=Wl(),Xr=Object.assign,zh=Object.defineProperty,OI=II([].concat);Jh.exports=!Xr||FI(function(){if(Vh&&Xr({b:1},Xr(zh({},"a",{enumerable:!0,get:function(){zh(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||ku(Xr({},e)).join("")!=i})?function(e,t){for(var i=EI(e),n=arguments.length,o=1,a=TI.f,c=AI.f;n>o;)for(var p=RI(arguments[o++]),g=a?OI(ku(p),a(p)):ku(p),h=g.length,m=0,y;h>m;)y=g[m++],(!Vh||xI(c,p,y))&&(i[y]=p[y]);return i}:Xr});var Zh=f((eM,Xh)=>{var BI=je(),Kh=Ze(),MI=Pa();Xh.exports=function(r,e,t){var i,n;Kh(r);try{if(i=MI(r,"return"),!i){if(e==="throw")throw t;return t}i=BI(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Kh(i),t}});var Yh=f((tM,Qh)=>{var UI=Ze(),LI=Zh();Qh.exports=function(r,e,t,i){try{return i?e(UI(t)[0],t[1]):e(t)}catch(n){LI(r,"throw",n)}}});var tf=f((rM,ef)=>{var DI=Ie(),NI=Kr(),_I=DI("iterator"),HI=Array.prototype;ef.exports=function(r){return r!==void 0&&(NI.Array===r||HI[_I]===r)}});var df=f((iM,af)=>{var qI=Z(),jI=le(),rf=Q(),WI=Nn(),GI=Hn(),VI=Kl(),nf=function(){},zI=[],sf=GI("Reflect","construct"),Su=/^\s*(?:class|function)\b/,JI=qI(Su.exec),$I=!Su.exec(nf),$n=function(e){if(!rf(e))return!1;try{return sf(nf,zI,e),!0}catch{return!1}},of=function(e){if(!rf(e))return!1;switch(WI(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return $I||!!JI(Su,VI(e))}catch{return!0}};of.sham=!0;af.exports=!sf||jI(function(){var r;return $n($n.call)||!$n(Object)||!$n(function(){r=!0})||r})?of:$n});var Cu=f((nM,lf)=>{"use strict";var KI=wa(),XI=Qe(),ZI=zr();lf.exports=function(r,e,t){var i=KI(e);i in r?XI.f(r,i,ZI(0,t)):r[i]=t}});var Ha=f((sM,cf)=>{var QI=Nn(),uf=Pa(),YI=fa(),ex=Kr(),tx=Ie(),rx=tx("iterator");cf.exports=function(r){if(!YI(r))return uf(r,rx)||uf(r,"@@iterator")||ex[QI(r)]}});var Pu=f((oM,mf)=>{var ix=je(),nx=Ca(),sx=Ze(),ox=El(),ax=Ha(),dx=TypeError;mf.exports=function(r,e){var t=arguments.length<2?ax(r):e;if(nx(t))return sx(ix(t,r));throw dx(ox(r)+" is not iterable")}});var ff=f((aM,hf)=>{"use strict";var lx=_a(),ux=je(),cx=Dn(),mx=Yh(),px=tf(),gx=df(),hx=Ba(),pf=Cu(),fx=Pu(),vx=Ha(),gf=Array;hf.exports=function(e){var t=cx(e),i=gx(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=lx(o,n>2?arguments[2]:void 0));var c=vx(t),p=0,g,h,m,y,b,C;if(c&&!(this===gf&&px(c)))for(y=fx(t,c),b=y.next,h=i?new this:[];!(m=ux(b,y)).done;p++)C=a?mx(y,o,[m.value,p],!0):m.value,pf(h,p,C);else for(g=hx(t),h=i?new this(g):gf(g);g>p;p++)C=a?o(t[p],p):t[p],pf(h,p,C);return h.length=p,h}});var wu=f((dM,yf)=>{var vf=Yl(),yx=Ba(),bx=Cu(),kx=Array,Sx=Math.max;yf.exports=function(r,e,t){for(var i=yx(r),n=vf(e,i),o=vf(t===void 0?i:t,i),a=kx(Sx(o-n,0)),c=0;n<o;n++,c++)bx(a,c,r[n]);return a.length=c,a}});var Ff=f((lM,xf)=>{var dr=Z(),Iu=2147483647,Kn=36,Pf=1,Tu=26,Cx=38,Px=700,wx=72,Ix=128,xx="-",Fx=/[^\0-\u007E]/,wf=/[.\u3002\uFF0E\uFF61]/g,bf="Overflow: input needs wider integers to process",xu=Kn-Pf,kf=RangeError,Tx=dr(wf.exec),Zr=Math.floor,Fu=String.fromCharCode,Sf=dr("".charCodeAt),If=dr([].join),wt=dr([].push),Ax=dr("".replace),Ex=dr("".split),Rx=dr("".toLowerCase),Ox=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=Sf(r,t++);if(n>=55296&&n<=56319&&t<i){var o=Sf(r,t++);(o&64512)==56320?wt(e,((n&1023)<<10)+(o&1023)+65536):(wt(e,n),t--)}else wt(e,n)}return e},Cf=function(r){return r+22+75*(r<26)},Bx=function(r,e,t){var i=0;for(r=t?Zr(r/Px):r>>1,r+=Zr(r/e);r>xu*Tu>>1;)r=Zr(r/xu),i+=Kn;return Zr(i+(xu+1)*r/(r+Cx))},Mx=function(r){var e=[];r=Ox(r);var t=r.length,i=Ix,n=0,o=wx,a,c;for(a=0;a<r.length;a++)c=r[a],c<128&&wt(e,Fu(c));var p=e.length,g=p;for(p&&wt(e,xx);g<t;){var h=Iu;for(a=0;a<r.length;a++)c=r[a],c>=i&&c<h&&(h=c);var m=g+1;if(h-i>Zr((Iu-n)/m))throw kf(bf);for(n+=(h-i)*m,i=h,a=0;a<r.length;a++){if(c=r[a],c<i&&++n>Iu)throw kf(bf);if(c==i){for(var y=n,b=Kn;;){var C=b<=o?Pf:b>=o+Tu?Tu:b-o;if(y<C)break;var x=y-C,I=Kn-C;wt(e,Fu(Cf(C+x%I))),y=Zr(x/I),b+=Kn}wt(e,Fu(Cf(y))),o=Bx(n,m,g==p),n=0,g++}}n++,i++}return If(e,"")};xf.exports=function(r){var e=[],t=Ex(Ax(Rx(r),wf,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],wt(e,Tx(Fx,n)?"xn--"+Mx(n):n);return If(e,".")}});var Au=f((uM,Tf)=>{var Ux=TypeError;Tf.exports=function(r,e){if(r<e)throw Ux("Not enough arguments");return r}});var Ef=f((cM,Af)=>{var Lx=Ie(),Dx=Gn(),Nx=Qe().f,Eu=Lx("unscopables"),Ru=Array.prototype;Ru[Eu]==null&&Nx(Ru,Eu,{configurable:!0,value:Dx(null)});Af.exports=function(r){Ru[Eu][r]=!0}});var Lf=f((mM,Uf)=>{"use strict";var _x=$r(),Ou=Ef(),Rf=Kr(),Bf=Jr(),Hx=Qe().f,qx=fu(),qa=vu(),jx=Gr(),Wx=he(),Mf="Array Iterator",Gx=Bf.set,Vx=Bf.getterFor(Mf);Uf.exports=qx(Array,"Array",function(r,e){Gx(this,{type:Mf,target:_x(r),index:0,kind:e})},function(){var r=Vx(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,qa(void 0,!0)):t=="keys"?qa(i,!1):t=="values"?qa(e[i],!1):qa([i,e[i]],!1)},"values");var Of=Rf.Arguments=Rf.Array;Ou("keys");Ou("values");Ou("entries");if(!jx&&Wx&&Of.name!=="values")try{Hx(Of,"name",{value:"values"})}catch{}});var Nf=f((pM,Df)=>{var zx=ar();Df.exports=function(r,e,t){for(var i in e)zx(r,i,e[i],t);return r}});var qf=f((gM,Hf)=>{var _f=wu(),Jx=Math.floor,Bu=function(r,e){var t=r.length,i=Jx(t/2);return t<8?$x(r,e):Kx(r,Bu(_f(r,0,i),e),Bu(_f(r,i),e),e)},$x=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},Kx=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};Hf.exports=Bu});var Wu=f((hM,av)=>{"use strict";Lf();var Nu=Wn(),Yr=ge(),ja=je(),Ye=Z(),Xx=he(),Yf=yu(),ev=ar(),Zx=Nf(),Qx=Vn(),Yx=gu(),qu=Jr(),tv=bu(),Mu=Q(),eF=we(),tF=_a(),rF=Nn(),iF=Ze(),rv=Pt(),fe=_n(),nF=Gn(),jf=zr(),_u=Pu(),sF=Ha(),Qr=Au(),oF=Ie(),aF=qf(),dF=oF("iterator"),Qn="URLSearchParams",iv=Qn+"Iterator",nv=qu.set,Ge=qu.getterFor(Qn),lF=qu.getterFor(iv),uF=Object.getOwnPropertyDescriptor,ju=function(r){if(!Xx)return Yr[r];var e=uF(Yr,r);return e&&e.value},Wf=ju("fetch"),Ga=ju("Request"),Xn=ju("Headers"),Uu=Ga&&Ga.prototype,Gf=Xn&&Xn.prototype,cF=Yr.RegExp,mF=Yr.TypeError,sv=Yr.decodeURIComponent,pF=Yr.encodeURIComponent,gF=Ye("".charAt),Vf=Ye([].join),lr=Ye([].push),Hu=Ye("".replace),hF=Ye([].shift),zf=Ye([].splice),Jf=Ye("".split),fF=Ye("".slice),vF=/\+/g,$f=Array(4),yF=function(r){return $f[r-1]||($f[r-1]=cF("((?:%[\\da-f]{2}){"+r+"})","gi"))},bF=function(r){try{return sv(r)}catch{return r}},Kf=function(r){var e=Hu(r,vF," "),t=4;try{return sv(e)}catch{for(;t;)e=Hu(e,yF(t--),bF);return e}},kF=/[!'()~]|%20/g,SF={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},CF=function(r){return SF[r]},Xf=function(r){return Hu(pF(r),kF,CF)},Lu=Yx(function(e,t){nv(this,{type:iv,iterator:_u(Ge(e).entries),kind:t})},"Iterator",function(){var e=lF(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),ov=function(r){this.entries=[],this.url=null,r!==void 0&&(rv(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?gF(r,0)==="?"?fF(r,1):r:fe(r)))};ov.prototype={type:Qn,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=sF(r),t,i,n,o,a,c,p;if(e)for(t=_u(r,e),i=t.next;!(n=ja(i,t)).done;){if(o=_u(iF(n.value)),a=o.next,(c=ja(a,o)).done||(p=ja(a,o)).done||!ja(a,o).done)throw mF("Expected sequence with length 2");lr(this.entries,{key:fe(c.value),value:fe(p.value)})}else for(var g in r)eF(r,g)&&lr(this.entries,{key:g,value:fe(r[g])})},parseQuery:function(r){if(r)for(var e=Jf(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=Jf(i,"="),lr(this.entries,{key:Kf(hF(n)),value:Kf(Vf(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],lr(e,Xf(i.key)+"="+Xf(i.value));return Vf(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Va=function(){tv(this,Zn);var e=arguments.length>0?arguments[0]:void 0;nv(this,new ov(e))},Zn=Va.prototype;Zx(Zn,{append:function(e,t){Qr(arguments.length,2);var i=Ge(this);lr(i.entries,{key:fe(e),value:fe(t)}),i.updateURL()},delete:function(r){Qr(arguments.length,1);for(var e=Ge(this),t=e.entries,i=fe(r),n=0;n<t.length;)t[n].key===i?zf(t,n,1):n++;e.updateURL()},get:function(e){Qr(arguments.length,1);for(var t=Ge(this).entries,i=fe(e),n=0;n<t.length;n++)if(t[n].key===i)return t[n].value;return null},getAll:function(e){Qr(arguments.length,1);for(var t=Ge(this).entries,i=fe(e),n=[],o=0;o<t.length;o++)t[o].key===i&&lr(n,t[o].value);return n},has:function(e){Qr(arguments.length,1);for(var t=Ge(this).entries,i=fe(e),n=0;n<t.length;)if(t[n++].key===i)return!0;return!1},set:function(e,t){Qr(arguments.length,1);for(var i=Ge(this),n=i.entries,o=!1,a=fe(e),c=fe(t),p=0,g;p<n.length;p++)g=n[p],g.key===a&&(o?zf(n,p--,1):(o=!0,g.value=c));o||lr(n,{key:a,value:c}),i.updateURL()},sort:function(){var e=Ge(this);aF(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=Ge(this).entries,i=tF(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 Lu(this,"keys")},values:function(){return new Lu(this,"values")},entries:function(){return new Lu(this,"entries")}},{enumerable:!0});ev(Zn,dF,Zn.entries,{name:"entries"});ev(Zn,"toString",function(){return Ge(this).serialize()},{enumerable:!0});Qx(Va,Qn);Nu({global:!0,constructor:!0,forced:!Yf},{URLSearchParams:Va});!Yf&&Mu(Xn)&&(Zf=Ye(Gf.has),Qf=Ye(Gf.set),Du=function(r){if(rv(r)){var e=r.body,t;if(rF(e)===Qn)return t=r.headers?new Xn(r.headers):new Xn,Zf(t,"content-type")||Qf(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),nF(r,{body:jf(0,fe(e)),headers:jf(0,t)})}return r},Mu(Wf)&&Nu({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Wf(e,arguments.length>1?Du(arguments[1]):{})}}),Mu(Ga)&&(Wa=function(e){return tv(this,Uu),new Ga(e,arguments.length>1?Du(arguments[1]):{})},Uu.constructor=Wa,Wa.prototype=Uu,Nu({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Wa})));var Zf,Qf,Du,Wa;av.exports={URLSearchParams:Va,getState:Ge}});var xv=f(()=>{"use strict";Uh();var PF=Wn(),sc=he(),wF=yu(),oc=ge(),dv=_a(),Ee=Z(),Xa=ar(),xe=Wh(),IF=bu(),rc=we(),ac=$h(),ei=ff(),Ve=wu(),xF=Cl().codeAt,FF=Ff(),ct=_n(),TF=Vn(),AF=Au(),kv=Wu(),Sv=Jr(),EF=Sv.set,Za=Sv.getterFor("URL"),RF=kv.URLSearchParams,OF=kv.getState,Yn=oc.URL,ic=oc.TypeError,Qa=oc.parseInt,BF=Math.floor,lv=Math.pow,Ae=Ee("".charAt),ze=Ee(/./.exec),ts=Ee([].join),MF=Ee(1 .toString),UF=Ee([].pop),ri=Ee([].push),uv=Ee("".replace),LF=Ee([].shift),DF=Ee("".split),is=Ee("".slice),Ya=Ee("".toLowerCase),NF=Ee([].unshift),_F="Invalid authority",Gu="Invalid scheme",ur="Invalid host",cv="Invalid port",Cv=/[a-z]/i,HF=/[\d+-.a-z]/i,nc=/\d/,qF=/^0x/i,jF=/^[0-7]+$/,WF=/^\d+$/,Pv=/^[\da-f]+$/i,GF=/[\0\t\n\r #%/:<>?@[\\\]^|]/,VF=/[\0\t\n\r #/:<>?@[\\\]^|]/,zF=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,JF=/[\t\n\r]/g,Fe,$F=function(r){var e=DF(r,"."),t,i,n,o,a,c,p;if(e.length&&e[e.length-1]==""&&e.length--,t=e.length,t>4)return r;for(i=[],n=0;n<t;n++){if(o=e[n],o=="")return r;if(a=10,o.length>1&&Ae(o,0)=="0"&&(a=ze(qF,o)?16:8,o=is(o,a==8?1:2)),o==="")c=0;else{if(!ze(a==10?WF:a==8?jF:Pv,o))return r;c=Qa(o,a)}ri(i,c)}for(n=0;n<t;n++)if(c=i[n],n==t-1){if(c>=lv(256,5-t))return null}else if(c>255)return null;for(p=UF(i),n=0;n<i.length;n++)p+=i[n]*lv(256,3-n);return p},KF=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,c,p,g,h,m,y=function(){return Ae(r,n)};if(y()==":"){if(Ae(r,1)!=":")return;n+=2,t++,i=t}for(;y();){if(t==8)return;if(y()==":"){if(i!==null)return;n++,t++,i=t;continue}for(o=a=0;a<4&&ze(Pv,y());)o=o*16+Qa(y(),16),n++,a++;if(y()=="."){if(a==0||(n-=a,t>6))return;for(c=0;y();){if(p=null,c>0)if(y()=="."&&c<4)n++;else return;if(!ze(nc,y()))return;for(;ze(nc,y());){if(g=Qa(y(),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(y()==":"){if(n++,!y())return}else if(y())return;e[t++]=o}if(i!==null)for(h=t-i,t=7;t!=0&&h>0;)m=e[t],e[t--]=e[i+h-1],e[i+--h]=m;else if(t!=8)return;return e},XF=function(r){for(var e=null,t=1,i=null,n=0,o=0;o<8;o++)r[o]!==0?(n>t&&(e=i,t=n),i=null,n=0):(i===null&&(i=o),++n);return n>t&&(e=i,t=n),e},es=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)NF(e,r%256),r=BF(r/256);return ts(e,".")}else if(typeof r=="object"){for(e="",i=XF(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=MF(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},Ka={},wv=ac({},Ka,{" ":1,'"':1,"<":1,">":1,"`":1}),Iv=ac({},wv,{"#":1,"?":1,"{":1,"}":1}),Vu=ac({},Iv,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),It=function(r,e){var t=xF(r,0);return t>32&&t<127&&!rc(e,r)?r:encodeURIComponent(r)},za={ftp:21,file:null,http:80,https:443,ws:80,wss:443},rs=function(r,e){var t;return r.length==2&&ze(Cv,Ae(r,0))&&((t=Ae(r,1))==":"||!e&&t=="|")},mv=function(r){var e;return r.length>1&&rs(is(r,0,2))&&(r.length==2||(e=Ae(r,2))==="/"||e==="\\"||e==="?"||e==="#")},ZF=function(r){return r==="."||Ya(r)==="%2e"},QF=function(r){return r=Ya(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},zu={},pv={},Ju={},gv={},hv={},$u={},fv={},vv={},Ja={},$a={},Ku={},Xu={},Zu={},Qu={},yv={},Yu={},ti={},et={},bv={},cr={},ut={},dc=function(r,e,t){var i=ct(r),n,o,a;if(e){if(o=this.parse(i),o)throw ic(o);this.searchParams=null}else{if(t!==void 0&&(n=new dc(t,!0)),o=this.parse(i,null,n),o)throw ic(o);a=OF(new RF),a.bindURL(this),this.searchParams=a}};dc.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||zu,o=0,a="",c=!1,p=!1,g=!1,h,m,y,b;for(r=ct(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=uv(r,zF,"")),r=uv(r,JF,""),h=ei(r);o<=h.length;){switch(m=h[o],n){case zu:if(m&&ze(Cv,m))a+=Ya(m),n=pv;else{if(e)return Gu;n=Ju;continue}break;case pv:if(m&&(ze(HF,m)||m=="+"||m=="-"||m=="."))a+=Ya(m);else if(m==":"){if(e&&(i.isSpecial()!=rc(za,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&za[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=Qu:i.isSpecial()&&t&&t.scheme==i.scheme?n=gv:i.isSpecial()?n=vv:h[o+1]=="/"?(n=hv,o++):(i.cannotBeABaseURL=!0,ri(i.path,""),n=bv)}else{if(e)return Gu;a="",n=Ju,o=0;continue}break;case Ju:if(!t||t.cannotBeABaseURL&&m!="#")return Gu;if(t.cannotBeABaseURL&&m=="#"){i.scheme=t.scheme,i.path=Ve(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=ut;break}n=t.scheme=="file"?Qu:$u;continue;case gv:if(m=="/"&&h[o+1]=="/")n=Ja,o++;else{n=$u;continue}break;case hv:if(m=="/"){n=$a;break}else{n=et;continue}case $u:if(i.scheme=t.scheme,m==Fe)i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query=t.query;else if(m=="/"||m=="\\"&&i.isSpecial())n=fv;else if(m=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(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=Ve(t.path),i.query=t.query,i.fragment="",n=ut;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.path.length--,n=et;continue}break;case fv:if(i.isSpecial()&&(m=="/"||m=="\\"))n=Ja;else if(m=="/")n=$a;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=et;continue}break;case vv:if(n=Ja,m!="/"||Ae(a,o+1)!="/")continue;o++;break;case Ja:if(m!="/"&&m!="\\"){n=$a;continue}break;case $a:if(m=="@"){c&&(a="%40"+a),c=!0,y=ei(a);for(var C=0;C<y.length;C++){var x=y[C];if(x==":"&&!g){g=!0;continue}var I=It(x,Vu);g?i.password+=I:i.username+=I}a=""}else if(m==Fe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(c&&a=="")return _F;o-=ei(a).length+1,a="",n=Ku}else a+=m;break;case Ku:case Xu:if(e&&i.scheme=="file"){n=Yu;continue}else if(m==":"&&!p){if(a=="")return ur;if(b=i.parseHost(a),b)return b;if(a="",n=Zu,e==Xu)return}else if(m==Fe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(i.isSpecial()&&a=="")return ur;if(e&&a==""&&(i.includesCredentials()||i.port!==null))return;if(b=i.parseHost(a),b)return b;if(a="",n=ti,e)return;continue}else m=="["?p=!0:m=="]"&&(p=!1),a+=m;break;case Zu:if(ze(nc,m))a+=m;else if(m==Fe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()||e){if(a!=""){var U=Qa(a,10);if(U>65535)return cv;i.port=i.isSpecial()&&U===za[i.scheme]?null:U,a=""}if(e)return;n=ti;continue}else return cv;break;case Qu:if(i.scheme="file",m=="/"||m=="\\")n=yv;else if(t&&t.scheme=="file")if(m==Fe)i.host=t.host,i.path=Ve(t.path),i.query=t.query;else if(m=="?")i.host=t.host,i.path=Ve(t.path),i.query="",n=cr;else if(m=="#")i.host=t.host,i.path=Ve(t.path),i.query=t.query,i.fragment="",n=ut;else{mv(ts(Ve(h,o),""))||(i.host=t.host,i.path=Ve(t.path),i.shortenPath()),n=et;continue}else{n=et;continue}break;case yv:if(m=="/"||m=="\\"){n=Yu;break}t&&t.scheme=="file"&&!mv(ts(Ve(h,o),""))&&(rs(t.path[0],!0)?ri(i.path,t.path[0]):i.host=t.host),n=et;continue;case Yu:if(m==Fe||m=="/"||m=="\\"||m=="?"||m=="#"){if(!e&&rs(a))n=et;else if(a==""){if(i.host="",e)return;n=ti}else{if(b=i.parseHost(a),b)return b;if(i.host=="localhost"&&(i.host=""),e)return;a="",n=ti}continue}else a+=m;break;case ti:if(i.isSpecial()){if(n=et,m!="/"&&m!="\\")continue}else if(!e&&m=="?")i.query="",n=cr;else if(!e&&m=="#")i.fragment="",n=ut;else if(m!=Fe&&(n=et,m!="/"))continue;break;case et:if(m==Fe||m=="/"||m=="\\"&&i.isSpecial()||!e&&(m=="?"||m=="#")){if(QF(a)?(i.shortenPath(),m!="/"&&!(m=="\\"&&i.isSpecial())&&ri(i.path,"")):ZF(a)?m!="/"&&!(m=="\\"&&i.isSpecial())&&ri(i.path,""):(i.scheme=="file"&&!i.path.length&&rs(a)&&(i.host&&(i.host=""),a=Ae(a,0)+":"),ri(i.path,a)),a="",i.scheme=="file"&&(m==Fe||m=="?"||m=="#"))for(;i.path.length>1&&i.path[0]==="";)LF(i.path);m=="?"?(i.query="",n=cr):m=="#"&&(i.fragment="",n=ut)}else a+=It(m,Iv);break;case bv:m=="?"?(i.query="",n=cr):m=="#"?(i.fragment="",n=ut):m!=Fe&&(i.path[0]+=It(m,Ka));break;case cr:!e&&m=="#"?(i.fragment="",n=ut):m!=Fe&&(m=="'"&&i.isSpecial()?i.query+="%27":m=="#"?i.query+="%23":i.query+=It(m,Ka));break;case ut:m!=Fe&&(i.fragment+=It(m,wv));break}o++}},parseHost:function(r){var e,t,i;if(Ae(r,0)=="["){if(Ae(r,r.length-1)!="]"||(e=KF(is(r,1,-1)),!e))return ur;this.host=e}else if(this.isSpecial()){if(r=FF(r),ze(GF,r)||(e=$F(r),e===null))return ur;this.host=e}else{if(ze(VF,r))return ur;for(e="",t=ei(r),i=0;i<t.length;i++)e+=It(t[i],Ka);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return rc(za,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!rs(r[0],!0))&&r.length--},serialize:function(){var r=this,e=r.scheme,t=r.username,i=r.password,n=r.host,o=r.port,a=r.path,c=r.query,p=r.fragment,g=e+":";return n!==null?(g+="//",r.includesCredentials()&&(g+=t+(i?":"+i:"")+"@"),g+=es(n),o!==null&&(g+=":"+o)):e=="file"&&(g+="//"),g+=r.cannotBeABaseURL?a[0]:a.length?"/"+ts(a,"/"):"",c!==null&&(g+="?"+c),p!==null&&(g+="#"+p),g},setHref:function(r){var e=this.parse(r);if(e)throw ic(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+"://"+es(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(ct(r)+":",zu)},getUsername:function(){return this.username},setUsername:function(r){var e=ei(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=It(e[t],Vu)}},getPassword:function(){return this.password},setPassword:function(r){var e=ei(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=It(e[t],Vu)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?es(r):es(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,Ku)},getHostname:function(){var r=this.host;return r===null?"":es(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,Xu)},getPort:function(){var r=this.port;return r===null?"":ct(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=ct(r),r==""?this.port=null:this.parse(r,Zu))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+ts(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,ti))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=ct(r),r==""?this.query=null:(Ae(r,0)=="?"&&(r=is(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=ct(r),r==""){this.fragment=null;return}Ae(r,0)=="#"&&(r=is(r,1)),this.fragment="",this.parse(r,ut)},update:function(){this.query=this.searchParams.serialize()||null}};var ii=function(e){var t=IF(this,ne),i=AF(arguments.length,1)>1?arguments[1]:void 0,n=EF(t,new dc(e,!1,i));sc||(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())},ne=ii.prototype,Te=function(r,e){return{get:function(){return Za(this)[r]()},set:e&&function(t){return Za(this)[e](t)},configurable:!0,enumerable:!0}};sc&&(xe(ne,"href",Te("serialize","setHref")),xe(ne,"origin",Te("getOrigin")),xe(ne,"protocol",Te("getProtocol","setProtocol")),xe(ne,"username",Te("getUsername","setUsername")),xe(ne,"password",Te("getPassword","setPassword")),xe(ne,"host",Te("getHost","setHost")),xe(ne,"hostname",Te("getHostname","setHostname")),xe(ne,"port",Te("getPort","setPort")),xe(ne,"pathname",Te("getPathname","setPathname")),xe(ne,"search",Te("getSearch","setSearch")),xe(ne,"searchParams",Te("getSearchParams")),xe(ne,"hash",Te("getHash","setHash")));Xa(ne,"toJSON",function(){return Za(this).serialize()},{enumerable:!0});Xa(ne,"toString",function(){return Za(this).serialize()},{enumerable:!0});Yn&&(ec=Yn.createObjectURL,tc=Yn.revokeObjectURL,ec&&Xa(ii,"createObjectURL",dv(ec,Yn)),tc&&Xa(ii,"revokeObjectURL",dv(tc,Yn)));var ec,tc;TF(ii,"URL");PF({global:!0,constructor:!0,forced:!wF,sham:!sc},{URL:ii})});var Fv=f(()=>{xv()});var Tv=f(()=>{"use strict";var YF=Wn(),eT=je();YF({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return eT(URL.prototype.toString,this)}})});var Av=f(()=>{Wu()});var Rv=f((wM,Ev)=>{var tT=ge();Ev.exports=tT});var Bv=f((IM,Ov)=>{Fv();Tv();Av();var rT=Rv();Ov.exports=rT.URL});var Lc=f((rN,zy)=>{var fA=Object.prototype.toString;zy.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 SA(e)?"generatorfunction":"function";if(vA(e))return"array";if(wA(e))return"buffer";if(PA(e))return"arguments";if(bA(e))return"date";if(yA(e))return"error";if(kA(e))return"regexp";switch(Vy(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(CA(e))return"generator";switch(t=fA.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 Vy(r){return typeof r.constructor=="function"?r.constructor.name:null}function vA(r){return Array.isArray?Array.isArray(r):r instanceof Array}function yA(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function bA(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function kA(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function SA(r,e){return Vy(r)==="GeneratorFunction"}function CA(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function PA(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 wA(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var Ky=f((iN,$y)=>{"use strict";var Jy=Symbol.prototype.valueOf,IA=Lc();function xA(r,e){switch(IA(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 EA(r);case"symbol":return RA(r);case"arraybuffer":return TA(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return AA(r);case"regexp":return FA(r);case"error":return Object.create(r);default:return r}}function FA(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 TA(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function AA(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function EA(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function RA(r){return Jy?Object(Jy.call(r)):{}}$y.exports=xA});var Zy=f((nN,Xy)=>{"use strict";Xy.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var eb=f((sN,Yy)=>{"use strict";var OA=Zy();function Qy(r){return OA(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}Yy.exports=function(e){var t,i;return!(Qy(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,Qy(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var rb=f((oN,tb)=>{"use strict";var BA=Ky(),MA=Lc(),UA=eb();function Dc(r,e){switch(MA(r)){case"object":return LA(r,e);case"array":return DA(r,e);default:return BA(r)}}function LA(r,e){if(typeof e=="function")return e(r);if(e||UA(r)){let t=new r.constructor;for(let i in r)t[i]=Dc(r[i],e);return t}return r}function DA(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=Dc(r[i],e);return t}tb.exports=Dc});var Kc=f((bs,Fi)=>{var NA=200,$c="__lodash_hash_undefined__",Id=1,gb=2,hb=9007199254740991,yd="[object Arguments]",qc="[object Array]",_A="[object AsyncFunction]",fb="[object Boolean]",vb="[object Date]",yb="[object Error]",bb="[object Function]",HA="[object GeneratorFunction]",bd="[object Map]",kb="[object Number]",qA="[object Null]",xi="[object Object]",ib="[object Promise]",jA="[object Proxy]",Sb="[object RegExp]",kd="[object Set]",Cb="[object String]",WA="[object Symbol]",GA="[object Undefined]",jc="[object WeakMap]",Pb="[object ArrayBuffer]",Sd="[object DataView]",VA="[object Float32Array]",zA="[object Float64Array]",JA="[object Int8Array]",$A="[object Int16Array]",KA="[object Int32Array]",XA="[object Uint8Array]",ZA="[object Uint8ClampedArray]",QA="[object Uint16Array]",YA="[object Uint32Array]",eE=/[\\^$.*+?()[\]{}|]/g,tE=/^\[object .+?Constructor\]$/,rE=/^(?:0|[1-9]\d*)$/,W={};W[VA]=W[zA]=W[JA]=W[$A]=W[KA]=W[XA]=W[ZA]=W[QA]=W[YA]=!0;W[yd]=W[qc]=W[Pb]=W[fb]=W[Sd]=W[vb]=W[yb]=W[bb]=W[bd]=W[kb]=W[xi]=W[Sb]=W[kd]=W[Cb]=W[jc]=!1;var wb=typeof global=="object"&&global&&global.Object===Object&&global,iE=typeof self=="object"&&self&&self.Object===Object&&self,ht=wb||iE||Function("return this")(),Ib=typeof bs=="object"&&bs&&!bs.nodeType&&bs,nb=Ib&&typeof Fi=="object"&&Fi&&!Fi.nodeType&&Fi,xb=nb&&nb.exports===Ib,Nc=xb&&wb.process,sb=function(){try{return Nc&&Nc.binding&&Nc.binding("util")}catch{}}(),ob=sb&&sb.isTypedArray;function nE(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 sE(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function oE(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 aE(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function dE(r){return function(e){return r(e)}}function lE(r,e){return r.has(e)}function uE(r,e){return r?.[e]}function cE(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function mE(r,e){return function(t){return r(e(t))}}function pE(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var gE=Array.prototype,hE=Function.prototype,xd=Object.prototype,_c=ht["__core-js_shared__"],Fb=hE.toString,rt=xd.hasOwnProperty,ab=function(){var r=/[^.]+$/.exec(_c&&_c.keys&&_c.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Tb=xd.toString,fE=RegExp("^"+Fb.call(rt).replace(eE,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),db=xb?ht.Buffer:void 0,Cd=ht.Symbol,lb=ht.Uint8Array,Ab=xd.propertyIsEnumerable,vE=gE.splice,yr=Cd?Cd.toStringTag:void 0,ub=Object.getOwnPropertySymbols,yE=db?db.isBuffer:void 0,bE=mE(Object.keys,Object),Wc=Ti(ht,"DataView"),ks=Ti(ht,"Map"),Gc=Ti(ht,"Promise"),Vc=Ti(ht,"Set"),zc=Ti(ht,"WeakMap"),Ss=Ti(Object,"create"),kE=Sr(Wc),SE=Sr(ks),CE=Sr(Gc),PE=Sr(Vc),wE=Sr(zc),cb=Cd?Cd.prototype:void 0,Hc=cb?cb.valueOf:void 0;function br(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function IE(){this.__data__=Ss?Ss(null):{},this.size=0}function xE(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function FE(r){var e=this.__data__;if(Ss){var t=e[r];return t===$c?void 0:t}return rt.call(e,r)?e[r]:void 0}function TE(r){var e=this.__data__;return Ss?e[r]!==void 0:rt.call(e,r)}function AE(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=Ss&&e===void 0?$c:e,this}br.prototype.clear=IE;br.prototype.delete=xE;br.prototype.get=FE;br.prototype.has=TE;br.prototype.set=AE;function ft(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function EE(){this.__data__=[],this.size=0}function RE(r){var e=this.__data__,t=Fd(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():vE.call(e,t,1),--this.size,!0}function OE(r){var e=this.__data__,t=Fd(e,r);return t<0?void 0:e[t][1]}function BE(r){return Fd(this.__data__,r)>-1}function ME(r,e){var t=this.__data__,i=Fd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}ft.prototype.clear=EE;ft.prototype.delete=RE;ft.prototype.get=OE;ft.prototype.has=BE;ft.prototype.set=ME;function kr(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 UE(){this.size=0,this.__data__={hash:new br,map:new(ks||ft),string:new br}}function LE(r){var e=Td(this,r).delete(r);return this.size-=e?1:0,e}function DE(r){return Td(this,r).get(r)}function NE(r){return Td(this,r).has(r)}function _E(r,e){var t=Td(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}kr.prototype.clear=UE;kr.prototype.delete=LE;kr.prototype.get=DE;kr.prototype.has=NE;kr.prototype.set=_E;function Pd(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new kr;++e<t;)this.add(r[e])}function HE(r){return this.__data__.set(r,$c),this}function qE(r){return this.__data__.has(r)}Pd.prototype.add=Pd.prototype.push=HE;Pd.prototype.has=qE;function Lt(r){var e=this.__data__=new ft(r);this.size=e.size}function jE(){this.__data__=new ft,this.size=0}function WE(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function GE(r){return this.__data__.get(r)}function VE(r){return this.__data__.has(r)}function zE(r,e){var t=this.__data__;if(t instanceof ft){var i=t.__data__;if(!ks||i.length<NA-1)return i.push([r,e]),this.size=++t.size,this;t=this.__data__=new kr(i)}return t.set(r,e),this.size=t.size,this}Lt.prototype.clear=jE;Lt.prototype.delete=WE;Lt.prototype.get=GE;Lt.prototype.has=VE;Lt.prototype.set=zE;function JE(r,e){var t=wd(r),i=!t&&dR(r),n=!t&&!i&&Jc(r),o=!t&&!i&&!n&&Lb(r),a=t||i||n||o,c=a?aE(r.length,String):[],p=c.length;for(var g in r)(e||rt.call(r,g))&&!(a&&(g=="length"||n&&(g=="offset"||g=="parent")||o&&(g=="buffer"||g=="byteLength"||g=="byteOffset")||iR(g,p)))&&c.push(g);return c}function Fd(r,e){for(var t=r.length;t--;)if(Ob(r[t][0],e))return t;return-1}function $E(r,e,t){var i=e(r);return wd(r)?i:sE(i,t(r))}function Ps(r){return r==null?r===void 0?GA:qA:yr&&yr in Object(r)?tR(r):aR(r)}function mb(r){return Cs(r)&&Ps(r)==yd}function Eb(r,e,t,i,n){return r===e?!0:r==null||e==null||!Cs(r)&&!Cs(e)?r!==r&&e!==e:KE(r,e,t,i,Eb,n)}function KE(r,e,t,i,n,o){var a=wd(r),c=wd(e),p=a?qc:Ut(r),g=c?qc:Ut(e);p=p==yd?xi:p,g=g==yd?xi:g;var h=p==xi,m=g==xi,y=p==g;if(y&&Jc(r)){if(!Jc(e))return!1;a=!0,h=!1}if(y&&!h)return o||(o=new Lt),a||Lb(r)?Rb(r,e,t,i,n,o):YE(r,e,p,t,i,n,o);if(!(t&Id)){var b=h&&rt.call(r,"__wrapped__"),C=m&&rt.call(e,"__wrapped__");if(b||C){var x=b?r.value():r,I=C?e.value():e;return o||(o=new Lt),n(x,I,t,i,o)}}return y?(o||(o=new Lt),eR(r,e,t,i,n,o)):!1}function XE(r){if(!Ub(r)||sR(r))return!1;var e=Bb(r)?fE:tE;return e.test(Sr(r))}function ZE(r){return Cs(r)&&Mb(r.length)&&!!W[Ps(r)]}function QE(r){if(!oR(r))return bE(r);var e=[];for(var t in Object(r))rt.call(r,t)&&t!="constructor"&&e.push(t);return e}function Rb(r,e,t,i,n,o){var a=t&Id,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 h=-1,m=!0,y=t&gb?new Pd:void 0;for(o.set(r,e),o.set(e,r);++h<c;){var b=r[h],C=e[h];if(i)var x=a?i(C,b,h,e,r,o):i(b,C,h,r,e,o);if(x!==void 0){if(x)continue;m=!1;break}if(y){if(!oE(e,function(I,U){if(!lE(y,U)&&(b===I||n(b,I,t,i,o)))return y.push(U)})){m=!1;break}}else if(!(b===C||n(b,C,t,i,o))){m=!1;break}}return o.delete(r),o.delete(e),m}function YE(r,e,t,i,n,o,a){switch(t){case Sd: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 lb(r),new lb(e)));case fb:case vb:case kb:return Ob(+r,+e);case yb:return r.name==e.name&&r.message==e.message;case Sb:case Cb:return r==e+"";case bd:var c=cE;case kd:var p=i&Id;if(c||(c=pE),r.size!=e.size&&!p)return!1;var g=a.get(r);if(g)return g==e;i|=gb,a.set(r,e);var h=Rb(c(r),c(e),i,n,o,a);return a.delete(r),h;case WA:if(Hc)return Hc.call(r)==Hc.call(e)}return!1}function eR(r,e,t,i,n,o){var a=t&Id,c=pb(r),p=c.length,g=pb(e),h=g.length;if(p!=h&&!a)return!1;for(var m=p;m--;){var y=c[m];if(!(a?y in e:rt.call(e,y)))return!1}var b=o.get(r);if(b&&o.get(e))return b==e;var C=!0;o.set(r,e),o.set(e,r);for(var x=a;++m<p;){y=c[m];var I=r[y],U=e[y];if(i)var Pe=a?i(U,I,y,e,r,o):i(I,U,y,r,e,o);if(!(Pe===void 0?I===U||n(I,U,t,i,o):Pe)){C=!1;break}x||(x=y=="constructor")}if(C&&!x){var Ct=r.constructor,ua=e.constructor;Ct!=ua&&"constructor"in r&&"constructor"in e&&!(typeof Ct=="function"&&Ct instanceof Ct&&typeof ua=="function"&&ua instanceof ua)&&(C=!1)}return o.delete(r),o.delete(e),C}function pb(r){return $E(r,cR,rR)}function Td(r,e){var t=r.__data__;return nR(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Ti(r,e){var t=uE(r,e);return XE(t)?t:void 0}function tR(r){var e=rt.call(r,yr),t=r[yr];try{r[yr]=void 0;var i=!0}catch{}var n=Tb.call(r);return i&&(e?r[yr]=t:delete r[yr]),n}var rR=ub?function(r){return r==null?[]:(r=Object(r),nE(ub(r),function(e){return Ab.call(r,e)}))}:mR,Ut=Ps;(Wc&&Ut(new Wc(new ArrayBuffer(1)))!=Sd||ks&&Ut(new ks)!=bd||Gc&&Ut(Gc.resolve())!=ib||Vc&&Ut(new Vc)!=kd||zc&&Ut(new zc)!=jc)&&(Ut=function(r){var e=Ps(r),t=e==xi?r.constructor:void 0,i=t?Sr(t):"";if(i)switch(i){case kE:return Sd;case SE:return bd;case CE:return ib;case PE:return kd;case wE:return jc}return e});function iR(r,e){return e=e??hb,!!e&&(typeof r=="number"||rE.test(r))&&r>-1&&r%1==0&&r<e}function nR(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function sR(r){return!!ab&&ab in r}function oR(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||xd;return r===t}function aR(r){return Tb.call(r)}function Sr(r){if(r!=null){try{return Fb.call(r)}catch{}try{return r+""}catch{}}return""}function Ob(r,e){return r===e||r!==r&&e!==e}var dR=mb(function(){return arguments}())?mb:function(r){return Cs(r)&&rt.call(r,"callee")&&!Ab.call(r,"callee")},wd=Array.isArray;function lR(r){return r!=null&&Mb(r.length)&&!Bb(r)}var Jc=yE||pR;function uR(r,e){return Eb(r,e)}function Bb(r){if(!Ub(r))return!1;var e=Ps(r);return e==bb||e==HA||e==_A||e==jA}function Mb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=hb}function Ub(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function Cs(r){return r!=null&&typeof r=="object"}var Lb=ob?dE(ob):ZE;function cR(r){return lR(r)?JE(r):QE(r)}function mR(){return[]}function pR(){return!1}Fi.exports=uR});var wS=f(Jd=>{"use strict";Jd.byteLength=qR;Jd.toByteArray=WR;Jd.fromByteArray=zR;var st=[],_e=[],HR=typeof Uint8Array<"u"?Uint8Array:Array,xm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Dr=0,CS=xm.length;Dr<CS;++Dr)st[Dr]=xm[Dr],_e[xm.charCodeAt(Dr)]=Dr;var Dr,CS;_e[45]=62;_e[95]=63;function PS(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function qR(r){var e=PS(r),t=e[0],i=e[1];return(t+i)*3/4-i}function jR(r,e,t){return(e+t)*3/4-t}function WR(r){var e,t=PS(r),i=t[0],n=t[1],o=new HR(jR(r,i,n)),a=0,c=n>0?i-4:i,p;for(p=0;p<c;p+=4)e=_e[r.charCodeAt(p)]<<18|_e[r.charCodeAt(p+1)]<<12|_e[r.charCodeAt(p+2)]<<6|_e[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=_e[r.charCodeAt(p)]<<2|_e[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=_e[r.charCodeAt(p)]<<10|_e[r.charCodeAt(p+1)]<<4|_e[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function GR(r){return st[r>>18&63]+st[r>>12&63]+st[r>>6&63]+st[r&63]}function VR(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(GR(i));return n.join("")}function zR(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,c=t-i;a<c;a+=o)n.push(VR(r,a,a+o>c?c:a+o));return i===1?(e=r[t-1],n.push(st[e>>2]+st[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(st[e>>10]+st[e>>4&63]+st[e<<2&63]+"=")),n.join("")}});var Uq=Ln(Bv(),1);function v(r,e){if(r==null)throw Error(e??"Expected nonnullish value.")}function mr(r,e){if(!r)throw Error(e)}var se;(function(r){r.COMMENT="t1_",r.ACCOUNT="t2_",r.LINK="t3_",r.MESSAGE="t4_",r.SUBREDDIT="t5_",r.AWARD="t6_"})(se||(se={}));function xt(r){return r.startsWith(se.COMMENT)}function ed(r){return r.startsWith(se.ACCOUNT)}function pr(r){return r.startsWith(se.LINK)}function Mv(r){return r.startsWith(se.MESSAGE)}function Uv(r){return r.startsWith(se.SUBREDDIT)}function Lv(r){return r.startsWith(se.AWARD)}function iT(r){mr(xt(r),`Expected comment id to start with ${se.COMMENT}, got ${r}}`)}function nT(r){mr(ed(r),`Expected account id to start with ${se.ACCOUNT}, got ${r}}`)}function sT(r){mr(pr(r),`Expected link id to start with ${se.LINK}, got ${r}}`)}function oT(r){mr(Mv(r),`Expected message id to start with ${se.MESSAGE}, got ${r}}`)}function aT(r){mr(Uv(r),`Expected subreddit id to start with ${se.SUBREDDIT}, got ${r}}`)}function dT(r){mr(Lv(r),`Expected award id to start with ${se.AWARD}, got ${r}}`)}function ni(r){return iT(r),r}function oe(r){return nT(r),r}function ve(r){return sT(r),r}function lT(r){return oT(r),r}function ie(r){return aT(r),r}function uT(r){return dT(r),r}function Re(r){if(xt(r))return ni(r);if(ed(r))return oe(r);if(pr(r))return ve(r);if(Mv(r))return lT(r);if(Uv(r))return ie(r);if(Lv(r))return uT(r);throw new Error(`Expected thing id to start with ${Object.values(se).join(", ")} got ${r}}`)}function lc(r){return xt(r)}import*as P from"@devvit/protos";var td=class{constructor(e){}};var uc=(t=>(t.Installation="installation",t.App="app",t))(uc||{});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)}cT(r)}function cT(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 Ft=Object.freeze({INTERVAL:0,FORM:1,STATE:2,CHANNEL:3});var UM=["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","caret-updown","planet","telescope"];import{AppSettingsDefinition as xT,GetFieldsResponse as FT}from"@devvit/protos";import{FormFieldType as Oe}from"@devvit/protos";function mt(r){return r.map(e=>{switch(e.type){case"string":return mT(e);case"image":return pT(e);case"paragraph":return gT(e);case"number":return hT(e);case"select":return fT(e);case"boolean":return vT(e);case"group":return yT(e);default:throw new Error("Unknown field type.")}})}function mT(r){return{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 pT(r){return{disabled:r.disabled,fieldId:r.name,fieldType:Oe.IMAGE,helpText:r.helpText,label:r.label,required:r.required}}function gT(r){return{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 hT(r){return{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 fT(r){return{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 vT(r){return{defaultValue:{fieldType:Oe.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Oe.BOOLEAN,helpText:r.helpText,label:r.label}}function yT(r){return{fieldId:"",fieldType:Oe.GROUP,fieldConfig:{groupConfig:{fields:mt(r.fields)}},label:r.label,helpText:r.helpText}}function L(r,e){u.prototype[r]=e}import{ValidateFormResponse as IT}from"@devvit/protos";import{RealtimeSubscriptionStatus as Nv}from"@devvit/protos";var B=Object.freeze({Actor:"devvit-actor",App:"devvit-app",AppUser:"devvit-app-user",AppViewerAuthToken:"devvit-app-viewer-authorization",Caller:"devvit-caller",CallerPortID:"devvit-caller-port-id",Canary:"devvit-canary",Debug:"devvit-debug",GQLHost:"devvit-gql-host",Installation:"devvit-installation",ModPermissions:"devvit-mod-permissions",Post:"devvit-post",PostAuthor:"devvit-post-author",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",Username:"devvit-user-name",UserAgent:"devvit-user-agent",Version:"devvit-version",Language:"devvit-accept-language",Timezone:"devvit-accept-timezone",AppDependencies:"devvit-app-dependencies"}),Dv;(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",r.WebView="webView"})(Dv||(Dv={}));function _v(r){function e(t){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=r.metadata[B.App]?.values[0];v(c,"useChannel - app is missing from Context");let p=r.metadata[B.Installation]?.values[0];v(p,"useChannel - installation is missing from Context");async function g(I){let U=o[n].channel;if(o[n].active)if(o[n].connected)await r.realtime.send(U,I);else throw Error(`Failed to send to channel '${U}'; it is active but not yet connected`);else throw Error(`Cannot send a message over inactive channel: ${U}`)}function h(){if(!o[n].active){let I=o[n].channel;o[n].active=!0,r.addRealtimeChannel(I)}}function m(){if(o[n].active){let I=o[n].channel;o[n].active=!1,r.removeRealtimeChannel(I)}}function y(I){return async()=>{let U;switch(I.status){case Nv.REALTIME_SUBSCRIBED:o[n].connected=!0,U=t.onSubscribed?.();break;case Nv.REALTIME_UNSUBSCRIBED:o[n].connected=!1,U=t.onUnsubscribed?.();break;default:U=t.onMessage(I.event?.data?.msg);break}await U}}let b={channel:`${c}:${p}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:Ft.CHANNEL};n in o?b=o[n]:n in a&&(b=a[n]);let C=r.realtimeEvent;r.isInitialRender?b.active=!1:C&&b.active&&C.event.channel===b.channel&&(b.preventCallback||r.runHook(y(C)),r.rerenderIn(0)),o[n]=b,r.currentHookIndex++;let x=0;return b.active&&b.connected?x=2:b.active&&!b.connected?x=1:!b.active&&b.connected?x=3:!b.active&&!b.connected&&(x=4),{subscribe:h,unsubscribe:m,send:g,status:x}}return e}import{FormFieldType as si}from"@devvit/protos";function cc(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=cc(r[t]);return i!==void 0&&(e[t]=i),e},{})}function Hv(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:Ft.FORM};n in a?g=a[n]:n in c&&(g=c[n]),a[n]=g,r.forms.set(p,t);let h=r.formSubmittedEvent;return h&&!g.preventSubmit&&h.formId===p&&r.runHook(async()=>{let m=i(Tt(h.results));m&&m instanceof Promise&&await m,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function qv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=100,p=Math.max(c,i),g={lastRun:void 0,running:!1,preventCallback:!1,type:Ft.INTERVAL};n in o?g=o[n]:n in a&&(g=a[n]);function h(){i<c&&console.error(`useInterval delay must be at least ${c}ms. Your interval of ${i}ms was automatically extended.`);for(let[y,b]of Object.entries(o))if(y!==n.toString()&&b?.type===Ft.INTERVAL&&b?.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:Ft.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 y=t();y&&y instanceof Promise&&await y,g.lastRun=Date.now()}),r.rerenderIn(p)),g.preventCallback=!1,o[n]=g,r.currentHookIndex++,{start:h,stop:m}}return e}function jv(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 hc={now(){return new Date}};function Wv(r){return`__autocache__${r}`}function Gv(r){return`__lock__${r}`}var kT=300,ST=1e3,rd=5e3,mc=3,Vv=.1,zv=1e3,CT=3e4;function Jv(r){if(r.error)throw new Error(r.error);return r.value}var At,Et,Be,oi,$,$v,Kv,Xv,pc,Zv,Qv,gc,Yv,id=class{constructor(e,t,i=hc){l(this,$);l(this,At);l(this,Et,{});l(this,Be);l(this,oi);d(this,At,e),d(this,oi,t),d(this,Be,i)}async cache(e,t){d(this,Et,s(this,oi).__cache=s(this,oi).__cache??{}),S(this,$,Yv).call(this,t);let i=S(this,$,$v).call(this,t.key);if(i!==void 0)return i;let n=await S(this,$,gc).call(this,t.key),o=await S(this,$,Kv).call(this,t,n,e);return Jv(o)}};At=new WeakMap,Et=new WeakMap,Be=new WeakMap,oi=new WeakMap,$=new WeakSet,$v=function(e){let t=s(this,Et)[e];if(t){let i=s(this,Be).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<mc&&Math.random()<Vv&&t.errorTime+zv<i;if(t?.expires&&t.expires<i&&t.checkedAt+zv<i||n){delete s(this,Et)[e];return}else return Jv(t)}},Kv=async function(e,t,i){let n=t?.expires,o=n?S(this,$,Qv).call(this,n):1;return!t||t?.error&&t.errorCount<mc&&Vv>Math.random()||o>Math.random()?S(this,$,Xv).call(this,e,t,i):t},Xv=async function(e,t,i){let n=Gv(e.key),o=s(this,Be).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,At).set(n,"1",{expiration:a,nx:!0}))return S(this,$,Zv).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Be).now();return S(this,$,pc).call(this,p,e.key,e.ttl)}},pc=async function(e,t,i){let n=Math.min(i,ST),o=await S(this,$,gc).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,kT)),S(this,$,pc).call(this,e,t,i)},Zv=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,Et)[e]=t,await s(this,At).set(Wv(e),JSON.stringify(t),{expiration:new Date(o+CT)}),t.error&&t.errorCount<mc&&await s(this,At).del(Gv(e)),t},Qv=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},gc=async function(e){let t=await s(this,At).get(Wv(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Be).now().getTime(),s(this,Et)[e]=i,i}},Yv=function(e){e.ttl<rd&&(console.warn(`Cache TTL cannot be less than ${rd} milliseconds! Updating ttl value of ${e.ttl} to ${rd}.`),e.ttl=rd)};function ey(r,e,t=hc){let i=new id(r,e,t);return i.cache.bind(i)}function ty(r){new URL(r.slice(0,r.indexOf(",")))}var ai,di,ui,ry,iy,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,ry).call(this,e,t??{webView:!1}):S(this,ui,iy).call(this,e,t??{webView:!1})}};ai=new WeakMap,di=new WeakMap,ui=new WeakSet,ry=function(e,t){let i=t.webView?s(this,di)[e]:s(this,ai)[e];if(i)return i;try{return ty(e),encodeURI(e)}catch{return""}},iy=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{ty(a),i[a]=encodeURI(a)}catch{n.push(a)}else n=e;if(n.length>0)throw new Error(`The following assets were missing from the assets list: ${n.join(", ")}`);return i};var Rt,ci=class{constructor(e){l(this,Rt);d(this,Rt,e)}async get(e){let{messages:t}=await u.kvStorePlugin.Get({keys:[e]},s(this,Rt));try{if(t[e])return JSON.parse(t[e])}catch{return}}async put(e,t){let i={};i[e]=JSON.stringify(t),await u.kvStorePlugin.Put({messages:i},s(this,Rt))}async delete(e){await u.kvStorePlugin.Del({keys:[e]},s(this,Rt))}async list(){let{keys:e}=await u.kvStorePlugin.List({filter:"*"},s(this,Rt));return e}};Rt=new WeakMap;var ns,mi=class{constructor(e){l(this,ns);d(this,ns,e)}async upload(e){let t=await u.mediaPlugin.Upload(e,s(this,ns));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};ns=new WeakMap;var ss,pi=class{constructor(e){l(this,ss);d(this,ss,e)}async add(e){await u.modLogPlugin.Add(e,s(this,ss))}};ss=new WeakMap;var os,gi=class{constructor(e){l(this,os);d(this,os,e)}async send(e,t){await u.realtimePlugin.Send({channel:e,data:{msg:t}},s(this,os))}};os=new WeakMap;var k,as,ds,ls,hi=class{constructor(e){l(this,k);l(this,as);l(this,ds);l(this,ls);d(this,k,e),d(this,as,new sd(e))}get modMail(){return s(this,as)}getSubredditById(e){return ye.getById(Re(e),s(this,k))}getSubredditInfoById(e){return oy(e,s(this,k))}getSubredditByName(e){return ye.getByName(e,s(this,k))}getSubredditInfoByName(e){return ay(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(Re(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 w.getById(Re(e),s(this,k))}getUserByUsername(e){return w.getByUsername(e,s(this,k))}async getCurrentUsername(){return s(this,ls)??d(this,ls,ny(s(this,k))),s(this,ls)}async getCurrentUser(){return s(this,ds)??d(this,ds,this.getCurrentUsername().then(e=>e?w.getByUsername(e,s(this,k)):void 0)),s(this,ds)}getAppUser(){return w.getFromMetadata(B.AppUser,s(this,k))}getSnoovatarUrl(e){return w.getSnoovatarUrl(e,s(this,k))}getCommentById(e){return te.getById(Re(e),s(this,k))}getComments(e){return te.getComments(e,s(this,k))}getCommentsByUser(e){return te.getCommentsByUser(e,s(this,k))}submitComment(e){return te.submit({...e,id:Re(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 w.getOverview(e,s(this,k))}getModerationLog(e){return nd(e,s(this,k))}getApprovedUsers(e){return w.getSubredditUsersByType({type:"contributors",...e},s(this,k))}approveUser(e,t){return w.createRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}removeUser(e,t){return w.removeRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}getWikiContributors(e){return w.getSubredditUsersByType({type:"wikicontributors",...e},s(this,k))}addWikiContributor(e,t){return w.createRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}removeWikiContributor(e,t){return w.removeRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}getBannedUsers(e){return w.getSubredditUsersByType({type:"banned",...e},s(this,k))}banUser(e){return w.createRelationship({username:e.username,subredditName:e.subredditName,type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration,banContext:e.context},s(this,k))}unbanUser(e,t){return w.removeRelationship({username:e,subredditName:t,type:"banned"},s(this,k))}getBannedWikiContributors(e){return w.getSubredditUsersByType({type:"wikibanned",...e},s(this,k))}banWikiContributor(e){return w.createRelationship({...e,type:"wikibanned"},s(this,k))}unbanWikiContributor(e,t){return w.removeRelationship({username:e,subredditName:t,type:"wikibanned"},s(this,k))}getModerators(e){return w.getSubredditUsersByType({type:"moderators",...e},s(this,k))}inviteModerator(e){return w.createRelationship({type:"moderator_invite",subredditName:e.subredditName,username:e.username,permissions:e.permissions??[]},s(this,k))}revokeModeratorInvite(e,t){return w.removeRelationship({username:e,subredditName:t,type:"moderator_invite"},s(this,k))}removeModerator(e,t){return w.removeRelationship({type:"moderator",subredditName:t,username:e},s(this,k))}setModeratorPermissions(e,t,i){return w.setModeratorPermissions(e,t,i,s(this,k))}getMutedUsers(e){return w.getSubredditUsersByType({type:"muted",...e},s(this,k))}muteUser(e){return w.createRelationship({...e,type:"muted"},s(this,k))}unmuteUser(e,t){return w.removeRelationship({username:e,subredditName:t,type:"muted"},s(this,k))}getModNotes(e){return Me.get(e,s(this,k))}deleteModNote(e){return Me.delete(e,s(this,k))}addModNote(e){let t={...e,redditId:e.redditId?Re(e.redditId):void 0};return Me.add(t,s(this,k))}addRemovalNote(e){return Me.addRemovalNote(e,s(this,k))}async sendPrivateMessage(e){return hr.send(e,s(this,k))}async sendPrivateMessageAsSubreddit(e){return hr.sendAsSubreddit(e,s(this,k))}async approve(e){if(xt(e))return te.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 te.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 ue.getPostFlairTemplates(e,s(this,k))}async getUserFlairTemplates(e){return ue.getUserFlairTemplates(e,s(this,k))}async createPostFlairTemplate(e){return ue.createPostFlairTemplate(e,s(this,k))}async createUserFlairTemplate(e){return ue.createUserFlairTemplate(e,s(this,k))}async editFlairTemplate(e){return ue.editFlairTemplate(e,s(this,k))}async deleteFlairTemplate(e,t){return ue.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,ve(t),s(this,k))}async getWidgets(e){return ae.getWidgets(e,s(this,k))}async deleteWidget(e,t){return ae.delete(e,t,s(this,k))}async addWidget(e){return ae.add(e,s(this,k))}async reorderWidgets(e,t){return ae.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 hr.getMessages(e,s(this,k))}markAllMessagesAsRead(){return hr.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 uy(e,s(this,k))}getVaultByUserId(e){return cy(Re(e),s(this,k))}getSubredditLeaderboard(e){return dy(e,s(this,k))}getSubredditStyles(e){return ly(e,s(this,k))}async subscribeToCurrentSubreddit(){let e=await this.getCurrentSubreddit();await u.redditAPIPlugins.Subreddits.Subscribe({action:"sub",actionSource:"",srName:e.name,sr:"",skipInitialDefaults:!0},s(this,k))}async unsubscribeFromCurrentSubreddit(){let e=await this.getCurrentSubreddit();await u.redditAPIPlugins.Subreddits.Subscribe({action:"unsub",actionSource:"",srName:e.name,sr:"",skipInitialDefaults:!1},s(this,k))}};k=new WeakMap,as=new WeakMap,ds=new WeakMap,ls=new WeakMap;import{RedisKeyScope as fc}from"@devvit/protos";function od(r){return r&&typeof r=="object"&&"message"in r&&r.message!==void 0&&typeof r.message=="string"?r.message.includes("redis: nil"):!1}var A,E,R,vc=class{constructor(e,t,i){l(this,A);l(this,E);l(this,R);d(this,A,e),d(this,E,t),d(this,R,i)}async get(e){return await s(this,A).Get({key:e,transactionId:s(this,E)},s(this,R)),this}async multi(){await s(this,A).Multi(s(this,E),s(this,R))}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,A).Set({key:e,value:t,nx:i?.nx===!0,xx:i?.xx===!0,expiration:n||0,transactionId:s(this,E)},s(this,R)),this}async del(...e){return await s(this,A).Del({keys:e,transactionId:s(this,E)},s(this,R)),this}async type(e){return await s(this,A).Type({key:e,transactionId:s(this,E)},s(this,R)),this}async exec(){let e=await s(this,A).Exec(s(this,E),s(this,R)),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):i.dbl!==void 0&&t.push(i.dbl);return t}async discard(){await s(this,A).Discard(s(this,E),s(this,R))}async watch(...e){return await s(this,A).Watch({keys:e,transactionId:s(this,E)},s(this,R)),this}async unwatch(){return await s(this,A).Unwatch(s(this,E),s(this,R)),this}async getRange(e,t,i){return await s(this,A).GetRange({key:e,start:t,end:i,transactionId:s(this,E)},s(this,R)),this}async setRange(e,t,i){return await s(this,A).SetRange({key:e,offset:t,value:i,transactionId:s(this,E)},s(this,R)),this}async strlen(e){return this.strLen(e)}async strLen(e){return await s(this,A).Strlen({key:e,transactionId:s(this,E)},s(this,R)),this}async mget(e){return this.mGet(e)}async mGet(e){return await s(this,A).MGet({keys:e,transactionId:s(this,E)},s(this,R)),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,A).MSet({kv:t,transactionId:s(this,E)},s(this,R)),this}async incrBy(e,t){return await s(this,A).IncrBy({key:e,value:t,transactionId:s(this,E)},s(this,R)),this}async expire(e,t){return await s(this,A).Expire({key:e,seconds:t,transactionId:s(this,E)},s(this,R)),this}async expireTime(e){return await s(this,A).ExpireTime({key:e,transactionId:s(this,E)},s(this,R)),this}async zAdd(e,...t){return await s(this,A).ZAdd({key:e,members:t,transactionId:s(this,E)},s(this,R)),this}async zScore(e,t){return await s(this,A).ZScore({key:{key:e,transactionId:s(this,E)},member:t},s(this,R)),this}async zRank(e,t){return await s(this,A).ZRank({key:{key:e,transactionId:s(this,E)},member:t},s(this,R)),this}async zIncrBy(e,t,i){return await s(this,A).ZIncrBy({key:e,member:t,value:i,transactionId:s(this,E)},s(this,R)),this}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,E)};return await s(this,A).ZScan(o,s(this,R)),this}async zCard(e){return await s(this,A).ZCard({key:e,transactionId:s(this,E)},s(this,R)),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,A).ZRange({key:{key:e,transactionId:s(this,E)},start:t+"",stop:i+"",...o},s(this,R)),this}async zRem(e,t){return await s(this,A).ZRem({key:{key:e,transactionId:s(this,E)},members:t},s(this,R)),this}async zRemRangeByLex(e,t,i){return await s(this,A).ZRemRangeByLex({key:{key:e,transactionId:s(this,E)},min:t,max:i},s(this,R)),this}async zRemRangeByRank(e,t,i){return await s(this,A).ZRemRangeByRank({key:{key:e,transactionId:s(this,E)},start:t,stop:i},s(this,R)),this}async zRemRangeByScore(e,t,i){return await s(this,A).ZRemRangeByScore({key:{key:e,transactionId:s(this,E)},min:t,max:i},s(this,R)),this}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){return await s(this,A).HGetAll({key:e,transactionId:s(this,E)},s(this,R)),this}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){return await s(this,A).HGet({key:e,field:t,transactionId:s(this,E)},s(this,R)),this}async hMGet(e,t){return await s(this,A).HMGet({key:e,fields:t,transactionId:s(this,E)},s(this,R)),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,A).HSet({key:e,fv:i,transactionId:s(this,E)},s(this,R)),this}async hincrby(e,t,i){return this.hIncrBy(e,t,i)}async hIncrBy(e,t,i){return await s(this,A).HIncrBy({key:e,field:t,value:i,transactionId:s(this,E)},s(this,R)),this}async hdel(e,t){return this.hDel(e,t)}async hDel(e,t){return await s(this,A).HDel({key:e,fields:t,transactionId:s(this,E)},s(this,R)),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,E)};return await s(this,A).HScan(o,s(this,R)),this}async hkeys(e){return this.hKeys(e)}async hKeys(e){return await s(this,A).HKeys({key:e,transactionId:s(this,E)},s(this,R)),this}async hlen(e){return this.hLen(e)}async hLen(e){return await s(this,A).HLen({key:e,transactionId:s(this,E)},s(this,R)),this}};A=new WeakMap,E=new WeakMap,R=new WeakMap;var M,fi,yc=class yc{constructor(e,t=void 0,i=fc.INSTALLATION){l(this,M);l(this,fi);d(this,M,e),d(this,fi,t),this.scope=i,this.global=i===fc.INSTALLATION?new yc(s(this,M),s(this,fi),fc.GLOBAL):this}get storage(){return s(this,fi)||u.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,M));return new vc(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(od(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(od(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(od(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(od(i))return;throw i}}async hMGet(e,t){let i=await this.storage.HMGet({key:e,fields:t,scope:this.scope},s(this,M));return i!==null?i.values.map(n=>n||null):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,fi=new WeakMap;var vi=yc;var fr,yi=class{constructor(e){l(this,fr);d(this,fr,e)}async runJob(e){return(await u.schedulerPlugin.Schedule({action:{type:e.name,data:e.data},cron:"cron"in e?e.cron:void 0,when:"runAt"in e?e.runAt:void 0},s(this,fr))).id}async cancelJob(e){await u.schedulerPlugin.Cancel({id:e},s(this,fr))}async listJobs(){return(await u.schedulerPlugin.List({after:new Date(0),before:new Date(Date.now()+31536e7)},s(this,fr))).actions.map(t=>(v(t.request?.action,"Scheduled job is malformed"),"when"in t.request&&t.request.when!=null?{id:t.id,name:t.request.action.type,runAt:t.request.when,data:t.request.action.data}:{id:t.id,name:t.request.action.type,cron:t.request.cron??"",data:t.request.action}))}};fr=new WeakMap;var us,bi=class{constructor(e){l(this,us);d(this,us,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await u.settingsPlugin.GetSettings({},s(this,us));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...my(t.installationSettings.settings,u.installationSettings),...my(t.appSettings.settings,u.appSettings)}}};us=new WeakMap;function my(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=cc(r[n]),i),{});return e&&py(t,e),t}function py(r,e){for(let t of e)t.type==="group"?py(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as ad,ToastAppearance as gy}from"@devvit/protos";var Ot,ki,cs,ld,dd=class{constructor(e){l(this,Ot,[]);l(this,ki);l(this,cs);l(this,ld,(e,t)=>{let i=t!==void 0?e:"",n=t!==void 0?t:e;s(this,Ot).push({type:ad.EFFECT_WEB_VIEW,webView:{postMessage:{webViewId:i,app:{message:n}}}})});d(this,ki,e),d(this,cs,{postMessage:s(this,ld)})}get webView(){return s(this,cs)}showForm(e,t){let i=u.formDefinitions.get(e);if(!i&&s(this,ki)){let a=s(this,ki).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={fields:[],id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description};gr(n.fields),o.fields=mt(n.fields),s(this,Ot).push({type:ad.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?gy.SUCCESS:gy.NEUTRAL}:t={text:e},s(this,Ot).push({type:ad.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,Ot).push({type:ad.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,Ot)}};Ot=new WeakMap,ki=new WeakMap,cs=new WeakMap,ld=new WeakMap;function Le({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new pi(r),o=new ci(r),a=new vi(r),c=ey(a,i?i.state:{}),p=new hi(r),g=new yi(r),h=new bi(r),m=e?new dd(i):void 0,y=new mi(r),b=new li,C=new gi(r),x=t&&i?jv(i):void 0,I=t&&i?qv(i):void 0,U=t&&i?Hv(i):void 0,Pe=t&&i?_v(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:g,settings:h,media:y,assets:b,realtime:C,get useForm(){return U??(()=>{throw new Error("useForm() is unavailable")})},get cache(){return c??(()=>{throw new Error("cache() is unavailable")})},get useState(){return x??(()=>{throw new Error("useState() is unavailable")})},get useInterval(){return I??(()=>{throw new Error("useInterval() is unavailable")})},get useChannel(){return Pe??(()=>{throw new Error("useChannel() is unavailable")})},get ui(){if(!m)throw new Error("ui client is not available");return m}}}var hy={name:"@devvit/public-api",version:"0.11.5-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.5-dev","@devvit/shared-types":"0.11.5-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/repo-tools":"0.11.5-dev","@devvit/tsconfig":"0.11.5-dev","@microsoft/api-extractor":"7.41.0","@reddit/faceplate-ui":"18.0.1","@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:"9.11.1",typescript:"5.3.2",vitest:"1.6.0"},publishConfig:{directory:"dist"},filesize:{"dist/public-api.min.js":{gzip:"80 KB",none:"260 KB"}},source:"./src/index.ts"};function ce(r,e,t){let i=r[B.Subreddit]?.values[0];v(i,"subreddit is missing from Context");let n=r[B.SubredditName]?.values[0],o=r[B.AppUser]?.values[0],a=r[B.App]?.values[0],c=r[B.Version]?.values[0],p=r[B.User]?.values[0],g=wT(r);return{get appAccountId(){return v(o,"appAccountId is missing from Context"),o},subredditId:i,subredditName:n,userId:p,postId:e,commentId:t,appName:a,appVersion:c,debug:g,toJSON(){return{appAccountId:o,appName:a,appVersion:c,subredditId:i,subredditName:n,userId:p,postId:e,commentId:t,debug:g}}}}function wT(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,webView:void 0},t={};for(let n in e)t[n.toLowerCase()]=n;let i={};for(let n of(r[B.Debug]?.values??[]).join().split(",")){let[o,a]=n.split("=");o&&(o=o.trim(),a=a?.trim(),o.toLowerCase()in t&&(o=t[o.toLowerCase()]),i[o]??(i[o]=a||"true"))}return r[B.Debug]&&console.info(`[api] @devvit/public-api v${hy.version} ${Object.entries(i).map(([n,o])=>`${n}=${o}`).join(" ")}`),{...i,metadata:r}}function fy(r){return r.flatMap(e=>e.type==="group"?fy(e.fields):e)}async function ud(r,e,t){if(!e)throw new Error("Settings were not defined.");let i={success:!0,errors:{}},n=Tt(r.fieldValues),o=fy(e);return await Promise.all(o.map(async a=>{let c=a.name;if(c&&a.onValidate){let p=n[c],g=a.onValidate,h=Object.assign(Le({metadata:t}),ce(t)),m=await g({value:p,isEditing:r.editing},h);m&&(i.success=!1,i.errors[c]=m)}})),IT.fromJSON(i)}async function TT(){if(!u.appSettings)throw new Error("App settings were not defined.");return FT.fromJSON({fields:{fields:mt(u.appSettings)}})}async function AT(r,e){return ud(r,u.appSettings,e)}function vy(r){r.provides(xT),L("GetAppSettingsFields",TT),L("ValidateAppForm",AT)}import{CustomPostDefinition as LT,RenderPostResponse as DT}from"@devvit/protos";import{BlockRenderEventType as Oc,EffectType as Oy}from"@devvit/protos";function Si(r){return r.__effects}function yy(){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 Rc,BlockAvatarBackground as Ty,BlockAvatarFacing as Ay,BlockAvatarSize as Bt,BlockBorderWidth as gd,BlockButtonAppearance as Mt,BlockButtonSize as Pc,BlockGap as hd,BlockHorizontalAlignment as wc,BlockIconSize as fd,BlockImageResizeMode as ms,BlockPadding as ps,BlockRadius as gs,BlockSpacerShape as Ic,BlockSpacerSize as vd,BlockStackDirection as xc,BlockTextOutline as Fc,BlockTextOverflow as Tc,BlockTextSize as Pi,BlockTextStyle as Ac,BlockTextWeight as Ey,BlockType as tt,BlockVerticalAlignment as Ec}from"@devvit/protos";var bc={"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 by={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"},ky=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),Sy=r=>r in bc,kc=r=>r in by,Cy=r=>!!r.match(/^rgba?\(.*/),Py=r=>!!r.match(/^hsla?\(.*/),wy=(r,e="light")=>{if(kc(r))return cd(r);let i=bc[r];return typeof i=="string"?i:i[e]},cd=r=>by[r]??r,Iy=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 md}from"@devvit/protos";var Sc={stackParentLayout:{hasHeight:!0,hasWidth:!0,direction:md.UNRECOGNIZED,alignment:void 0}};function Fy(r,e,t){if(!e)return{hasHeight:!1,hasWidth:!1};let{growDirection:i,stretchDirection:n}=ET(r?.grow,e.direction,e.alignment),o=t?.height?.value?.value||t?.height?.min?.value||xy(2,i,n,e.hasHeight),a=t?.width?.value?.value||t?.width?.min?.value||xy(1,i,n,e.hasWidth);return{hasHeight:!!o,hasWidth:!!a}}function xy(r,e,t,i){return e===r&&i||t===r&&i}function ET(r,e,t){let i=e===md.STACK_VERTICAL||e===md.UNRECOGNIZED,n=e===md.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 vr,BlockStackDirection as pd}from"@devvit/protos";function Ci(r){if(r==null)return;if(typeof r=="number")return{value:r,unit:vr.SIZE_UNIT_PERCENT};let e=r.match(/^(\d+(?:\.\d+)?)(px|%)?$/);if(e==null)return;let t=vr.SIZE_UNIT_PERCENT;return e.at(2)==="px"&&(t=vr.SIZE_UNIT_PIXELS),{value:Number.parseFloat(e[1]),unit:t}}function RT(r,e){return(r.width?.value?.unit===vr.SIZE_UNIT_PERCENT||r.width?.min?.unit===vr.SIZE_UNIT_PERCENT)&&(e.direction===pd.STACK_HORIZONTAL||e.direction===pd.STACK_DEPTH)&&(e.hasWidth||(r.width=void 0)),(r.height?.value?.unit===vr.SIZE_UNIT_PERCENT||r.height?.min?.unit===vr.SIZE_UNIT_PERCENT)&&(e.direction===pd.STACK_VERTICAL||e.direction===pd.STACK_DEPTH)&&(e.hasHeight||(r.height=void 0)),r}function Cc(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=RT(n,e.stackParentLayout)),n}}}var Ry="data-",OT=new Set(["onPress","onMessage"]),BT=new Map([["onPress",Rc.ACTION_CLICK],["onMessage",Rc.ACTION_WEBVIEW]]),hs,wi=class{constructor(e=()=>{}){l(this,hs);d(this,hs,e)}createBlocksElementOrThrow({type:e,props:t,children:i}){let n=this.createBlocksElement({type:e,props:t,children:i},Sc);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"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 ps.PADDING_NONE;case"xsmall":return ps.PADDING_XSMALL;case"small":return ps.PADDING_SMALL;case"medium":return ps.PADDING_MEDIUM;case"large":return ps.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return gs.RADIUS_NONE;case"small":return gs.RADIUS_SMALL;case"medium":return gs.RADIUS_MEDIUM;case"large":return gs.RADIUS_LARGE;case"full":return gs.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return hd.GAP_NONE;case"small":return hd.GAP_SMALL;case"medium":return hd.GAP_MEDIUM;case"large":return hd.GAP_LARGE}}makeBlockAlignment(e){if(e===void 0)return;let t,i;if(e.includes("top")?t=Ec.ALIGN_TOP:e.includes("middle")?t=Ec.ALIGN_MIDDLE:e.includes("bottom")&&(t=Ec.ALIGN_BOTTOM),e.includes("start")?i=wc.ALIGN_START:e.includes("center")?i=wc.ALIGN_CENTER:e.includes("end")&&(i=wc.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=gd.BORDER_WIDTH_NONE;break;case"thin":o=gd.BORDER_WIDTH_THIN;break;case"thick":o=gd.BORDER_WIDTH_THICK;break;default:o=gd.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 Pi.TEXT_SIZE_XSMALL;case"small":return Pi.TEXT_SIZE_SMALL;case"medium":return Pi.TEXT_SIZE_MEDIUM;case"large":return Pi.TEXT_SIZE_LARGE;case"xlarge":return Pi.TEXT_SIZE_XLARGE;case"xxlarge":return Pi.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return Ac.TEXT_STYLE_BODY;case"metadata":return Ac.TEXT_STYLE_METADATA;case"heading":return Ac.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return Fc.TEXT_OUTLINE_NONE;case"thin":return Fc.TEXT_OUTLINE_THIN;case"thick":return Fc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return Ey.TEXT_WEIGHT_REGULAR;case"bold":return Ey.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return Tc.TEXT_OVERFLOW_CLIP;case"ellipsis":return Tc.TEXT_OVERFLOW_ELLIPSE}return Tc.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 Pc.BUTTON_SIZE_SMALL;case"medium":return Pc.BUTTON_SIZE_MEDIUM;case"large":return Pc.BUTTON_SIZE_LARGE}}makeBlockImageResizeMode(e){switch(e){case"none":return ms.IMAGE_RESIZE_NONE;case"fit":return ms.IMAGE_RESIZE_FIT;case"fill":return ms.IMAGE_RESIZE_FILL;case"cover":return ms.IMAGE_RESIZE_COVER;case"scale-down":return ms.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return vd.SPACER_XSMALL;case"small":return vd.SPACER_SMALL;case"medium":return vd.SPACER_MEDIUM;case"large":return vd.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return Ic.SPACER_INVISIBLE;case"thin":return Ic.SPACER_THIN;case"square":return Ic.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return fd.ICON_SIZE_XSMALL;case"small":return fd.ICON_SIZE_SMALL;case"medium":return fd.ICON_SIZE_MEDIUM;case"large":return fd.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 Ay.AVATAR_FACING_LEFT;case"right":return Ay.AVATAR_FACING_RIGHT}}makeBlockAvatarBackground(e){switch(e){case"dark":return Ty.AVATAR_BG_DARK;case"light":return Ty.AVATAR_BG_LIGHT}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(Ry)).reduce((t,i)=>(t[i.substring(Ry.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);return OT.forEach(o=>{if(o in t){let a=t[o];i.push({type:BT.get(o)??Rc.UNRECOGNIZED,id:a.toString(),data:n})}}),i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),ky(e)?e:Sy(e)?wy(e,t):kc(e)?cd(e):Cy(e)?Iy(e):Py(e)?e:(console.warn(`Could not parse color: ${e}.`),cd("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,hs).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,Sc))}wrapRoot(e,t){return this.makeBlock(tt.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=Cc(t,i),p=Fy(t,i.stackParentLayout,c);return this.makeBlock(tt.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(xc.STACK_HORIZONTAL,e,t,i)}makeVStack(e,t,...i){return this.makeStackBlock(xc.STACK_VERTICAL,e,t,i)}makeZStack(e,t,...i){return this.makeStackBlock(xc.STACK_DEPTH,e,t,i)}makeText(e,t,...i){let n=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(tt.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(tt.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(tt.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(tt.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(tt.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(tt.BLOCK_AVATAR,e,t,{avatarConfig:{thingId:e.thingId,size:this.makeBlockAvatarSize(e.size),facing:this.makeBlockAvatarFacing(e.facing),background:this.makeBlockAvatarBackground(e.background)}})}makeWebView(e,t){return e&&this.makeBlock(tt.BLOCK_WEBVIEW,e,t,{webviewConfig:{url:this.resolveAssetUrl(e.url,{webView:!0}),state:e.state}})}makeBlock(e,t,i,n){return{type:e,sizes:Cc(t,i),config:n,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}ensureRootBlock(e){let t;if(e.type===tt.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}};hs=new WeakMap;function By(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var My=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+=My(i);return e+=`</${r.type}>`,e};function MT(r){return" ".repeat(r)}function UT(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+=MT(t),n!==0&&(e+="<"),e+=o,n!==i.length-1&&(e+=`>
|
|
1
|
+
var LS=Object.create;var Mm=Object.defineProperty;var DS=Object.getOwnPropertyDescriptor;var NS=Object.getOwnPropertyNames;var _S=Object.getPrototypeOf,HS=Object.prototype.hasOwnProperty;var Um=r=>{throw TypeError(r)};var f=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var qS=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of NS(e))!HS.call(r,n)&&n!==t&&Mm(r,n,{get:()=>e[n],enumerable:!(i=DS(e,n))||i.enumerable});return r};var Ln=(r,e,t)=>(t=r!=null?LS(_S(r)):{},qS(e||!r||!r.__esModule?Mm(t,"default",{value:r,enumerable:!0}):t,r));var cl=(r,e,t)=>e.has(r)||Um("Cannot "+t);var s=(r,e,t)=>(cl(r,e,"read from private field"),t?t.call(r):e.get(r)),l=(r,e,t)=>e.has(r)?Um("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),d=(r,e,t,i)=>(cl(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t),S=(r,e,t)=>(cl(r,e,"access private method"),t);var Lm=(r,e,t,i)=>({set _(n){d(r,e,n,t)},get _(){return s(r,e,i)}});var le=f((fO,Dm)=>{Dm.exports=function(r){try{return!!r()}catch{return!0}}});var ca=f((vO,Nm)=>{var jS=le();Nm.exports=!jS(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Z=f((yO,qm)=>{var _m=ca(),Hm=Function.prototype,ml=Hm.call,WS=_m&&Hm.bind.bind(ml,ml);qm.exports=_m?WS:function(r){return function(){return ml.apply(r,arguments)}}});var Wm=f((bO,jm)=>{var GS=Math.ceil,VS=Math.floor;jm.exports=Math.trunc||function(e){var t=+e;return(t>0?VS:GS)(t)}});var ma=f((kO,Gm)=>{var zS=Wm();Gm.exports=function(r){var e=+r;return e!==e||e===0?0:zS(e)}});var ge=f((SO,Vm)=>{var pa=function(r){return r&&r.Math==Math&&r};Vm.exports=pa(typeof globalThis=="object"&&globalThis)||pa(typeof window=="object"&&window)||pa(typeof self=="object"&&self)||pa(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var Gr=f((CO,zm)=>{zm.exports=!1});var ga=f((PO,$m)=>{var Jm=ge(),JS=Object.defineProperty;$m.exports=function(r,e){try{JS(Jm,r,{value:e,configurable:!0,writable:!0})}catch{Jm[r]=e}return e}});var ha=f((wO,Xm)=>{var $S=ge(),KS=ga(),Km="__core-js_shared__",XS=$S[Km]||KS(Km,{});Xm.exports=XS});var pl=f((IO,Qm)=>{var ZS=Gr(),Zm=ha();(Qm.exports=function(r,e){return Zm[r]||(Zm[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:ZS?"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((xO,Ym)=>{Ym.exports=function(r){return r==null}});var va=f((FO,ep)=>{var QS=fa(),YS=TypeError;ep.exports=function(r){if(QS(r))throw YS("Can't call method on "+r);return r}});var Dn=f((TO,tp)=>{var eC=va(),tC=Object;tp.exports=function(r){return tC(eC(r))}});var we=f((AO,rp)=>{var rC=Z(),iC=Dn(),nC=rC({}.hasOwnProperty);rp.exports=Object.hasOwn||function(e,t){return nC(iC(e),t)}});var gl=f((EO,ip)=>{var sC=Z(),oC=0,aC=Math.random(),dC=sC(1 .toString);ip.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+dC(++oC+aC,36)}});var sp=f((RO,np)=>{np.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var mp=f((OO,cp)=>{var up=ge(),hl=sp(),op=up.process,ap=up.Deno,dp=op&&op.versions||ap&&ap.version,lp=dp&&dp.v8,qe,ya;lp&&(qe=lp.split("."),ya=qe[0]>0&&qe[0]<4?1:+(qe[0]+qe[1]));!ya&&hl&&(qe=hl.match(/Edge\/(\d+)/),(!qe||qe[1]>=74)&&(qe=hl.match(/Chrome\/(\d+)/),qe&&(ya=+qe[1])));cp.exports=ya});var fl=f((BO,gp)=>{var pp=mp(),lC=le();gp.exports=!!Object.getOwnPropertySymbols&&!lC(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&pp&&pp<41})});var vl=f((MO,hp)=>{var uC=fl();hp.exports=uC&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ie=f((UO,vp)=>{var cC=ge(),mC=pl(),fp=we(),pC=gl(),gC=fl(),hC=vl(),Vr=cC.Symbol,yl=mC("wks"),fC=hC?Vr.for||Vr:Vr&&Vr.withoutSetter||pC;vp.exports=function(r){return fp(yl,r)||(yl[r]=gC&&fp(Vr,r)?Vr[r]:fC("Symbol."+r)),yl[r]}});var kp=f((LO,bp)=>{var vC=Ie(),yC=vC("toStringTag"),yp={};yp[yC]="z";bp.exports=String(yp)==="[object z]"});var kl=f((DO,Sp)=>{var bl=typeof document=="object"&&document.all,bC=typeof bl>"u"&&bl!==void 0;Sp.exports={all:bl,IS_HTMLDDA:bC}});var Q=f((NO,Pp)=>{var Cp=kl(),kC=Cp.all;Pp.exports=Cp.IS_HTMLDDA?function(r){return typeof r=="function"||r===kC}:function(r){return typeof r=="function"}});var ba=f((_O,Ip)=>{var wp=Z(),SC=wp({}.toString),CC=wp("".slice);Ip.exports=function(r){return CC(SC(r),8,-1)}});var Nn=f((HO,xp)=>{var PC=kp(),wC=Q(),ka=ba(),IC=Ie(),xC=IC("toStringTag"),FC=Object,TC=ka(function(){return arguments}())=="Arguments",AC=function(r,e){try{return r[e]}catch{}};xp.exports=PC?ka:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=AC(e=FC(r),xC))=="string"?t:TC?ka(e):(i=ka(e))=="Object"&&wC(e.callee)?"Arguments":i}});var _n=f((qO,Fp)=>{var EC=Nn(),RC=String;Fp.exports=function(r){if(EC(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return RC(r)}});var Cl=f((jO,Ep)=>{var Sl=Z(),OC=ma(),BC=_n(),MC=va(),UC=Sl("".charAt),Tp=Sl("".charCodeAt),LC=Sl("".slice),Ap=function(r){return function(e,t){var i=BC(MC(e)),n=OC(t),o=i.length,a,c;return n<0||n>=o?r?"":void 0:(a=Tp(i,n),a<55296||a>56319||n+1===o||(c=Tp(i,n+1))<56320||c>57343?r?UC(i,n):a:r?LC(i,n,n+2):(a-55296<<10)+(c-56320)+65536)}};Ep.exports={codeAt:Ap(!1),charAt:Ap(!0)}});var Bp=f((WO,Op)=>{var DC=ge(),NC=Q(),Rp=DC.WeakMap;Op.exports=NC(Rp)&&/native code/.test(String(Rp))});var Pt=f((GO,Lp)=>{var Mp=Q(),Up=kl(),_C=Up.all;Lp.exports=Up.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:Mp(r)||r===_C}:function(r){return typeof r=="object"?r!==null:Mp(r)}});var he=f((VO,Dp)=>{var HC=le();Dp.exports=!HC(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var wl=f((zO,_p)=>{var qC=ge(),Np=Pt(),Pl=qC.document,jC=Np(Pl)&&Np(Pl.createElement);_p.exports=function(r){return jC?Pl.createElement(r):{}}});var Il=f((JO,Hp)=>{var WC=he(),GC=le(),VC=wl();Hp.exports=!WC&&!GC(function(){return Object.defineProperty(VC("div"),"a",{get:function(){return 7}}).a!=7})});var xl=f(($O,qp)=>{var zC=he(),JC=le();qp.exports=zC&&JC(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Ze=f((KO,jp)=>{var $C=Pt(),KC=String,XC=TypeError;jp.exports=function(r){if($C(r))return r;throw XC(KC(r)+" is not an object")}});var je=f((XO,Wp)=>{var ZC=ca(),Sa=Function.prototype.call;Wp.exports=ZC?Sa.bind(Sa):function(){return Sa.apply(Sa,arguments)}});var Hn=f((ZO,Gp)=>{var Fl=ge(),QC=Q(),YC=function(r){return QC(r)?r:void 0};Gp.exports=function(r,e){return arguments.length<2?YC(Fl[r]):Fl[r]&&Fl[r][e]}});var Tl=f((QO,Vp)=>{var eP=Z();Vp.exports=eP({}.isPrototypeOf)});var Al=f((YO,zp)=>{var tP=Hn(),rP=Q(),iP=Tl(),nP=vl(),sP=Object;zp.exports=nP?function(r){return typeof r=="symbol"}:function(r){var e=tP("Symbol");return rP(e)&&iP(e.prototype,sP(r))}});var El=f((eB,Jp)=>{var oP=String;Jp.exports=function(r){try{return oP(r)}catch{return"Object"}}});var Ca=f((tB,$p)=>{var aP=Q(),dP=El(),lP=TypeError;$p.exports=function(r){if(aP(r))return r;throw lP(dP(r)+" is not a function")}});var Pa=f((rB,Kp)=>{var uP=Ca(),cP=fa();Kp.exports=function(r,e){var t=r[e];return cP(t)?void 0:uP(t)}});var Zp=f((iB,Xp)=>{var Rl=je(),Ol=Q(),Bl=Pt(),mP=TypeError;Xp.exports=function(r,e){var t,i;if(e==="string"&&Ol(t=r.toString)&&!Bl(i=Rl(t,r))||Ol(t=r.valueOf)&&!Bl(i=Rl(t,r))||e!=="string"&&Ol(t=r.toString)&&!Bl(i=Rl(t,r)))return i;throw mP("Can't convert object to primitive value")}});var tg=f((nB,eg)=>{var pP=je(),Qp=Pt(),Yp=Al(),gP=Pa(),hP=Zp(),fP=Ie(),vP=TypeError,yP=fP("toPrimitive");eg.exports=function(r,e){if(!Qp(r)||Yp(r))return r;var t=gP(r,yP),i;if(t){if(e===void 0&&(e="default"),i=pP(t,r,e),!Qp(i)||Yp(i))return i;throw vP("Can't convert object to primitive value")}return e===void 0&&(e="number"),hP(r,e)}});var wa=f((sB,rg)=>{var bP=tg(),kP=Al();rg.exports=function(r){var e=bP(r,"string");return kP(e)?e:e+""}});var Qe=f(ng=>{var SP=he(),CP=Il(),PP=xl(),Ia=Ze(),ig=wa(),wP=TypeError,Ml=Object.defineProperty,IP=Object.getOwnPropertyDescriptor,Ul="enumerable",Ll="configurable",Dl="writable";ng.f=SP?PP?function(e,t,i){if(Ia(e),t=ig(t),Ia(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Dl in i&&!i[Dl]){var n=IP(e,t);n&&n[Dl]&&(e[t]=i.value,i={configurable:Ll in i?i[Ll]:n[Ll],enumerable:Ul in i?i[Ul]:n[Ul],writable:!1})}return Ml(e,t,i)}:Ml:function(e,t,i){if(Ia(e),t=ig(t),Ia(i),CP)try{return Ml(e,t,i)}catch{}if("get"in i||"set"in i)throw wP("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var zr=f((aB,sg)=>{sg.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var xa=f((dB,og)=>{var xP=he(),FP=Qe(),TP=zr();og.exports=xP?function(r,e,t){return FP.f(r,e,TP(1,t))}:function(r,e,t){return r[e]=t,r}});var Fa=f((lB,dg)=>{var AP=pl(),EP=gl(),ag=AP("keys");dg.exports=function(r){return ag[r]||(ag[r]=EP(r))}});var Ta=f((uB,lg)=>{lg.exports={}});var Jr=f((cB,mg)=>{var RP=Bp(),cg=ge(),OP=Pt(),BP=xa(),Nl=we(),_l=ha(),MP=Fa(),UP=Ta(),ug="Object already initialized",Hl=cg.TypeError,LP=cg.WeakMap,Aa,qn,Ea,DP=function(r){return Ea(r)?qn(r):Aa(r,{})},NP=function(r){return function(e){var t;if(!OP(e)||(t=qn(e)).type!==r)throw Hl("Incompatible receiver, "+r+" required");return t}};RP||_l.state?(We=_l.state||(_l.state=new LP),We.get=We.get,We.has=We.has,We.set=We.set,Aa=function(r,e){if(We.has(r))throw Hl(ug);return e.facade=r,We.set(r,e),e},qn=function(r){return We.get(r)||{}},Ea=function(r){return We.has(r)}):(or=MP("state"),UP[or]=!0,Aa=function(r,e){if(Nl(r,or))throw Hl(ug);return e.facade=r,BP(r,or,e),e},qn=function(r){return Nl(r,or)?r[or]:{}},Ea=function(r){return Nl(r,or)});var We,or;mg.exports={set:Aa,get:qn,has:Ea,enforce:DP,getterFor:NP}});var ql=f(hg=>{"use strict";var pg={}.propertyIsEnumerable,gg=Object.getOwnPropertyDescriptor,_P=gg&&!pg.call({1:2},1);hg.f=_P?function(e){var t=gg(this,e);return!!t&&t.enumerable}:pg});var Wl=f((pB,fg)=>{var HP=Z(),qP=le(),jP=ba(),jl=Object,WP=HP("".split);fg.exports=qP(function(){return!jl("z").propertyIsEnumerable(0)})?function(r){return jP(r)=="String"?WP(r,""):jl(r)}:jl});var $r=f((gB,vg)=>{var GP=Wl(),VP=va();vg.exports=function(r){return GP(VP(r))}});var Gl=f(bg=>{var zP=he(),JP=je(),$P=ql(),KP=zr(),XP=$r(),ZP=wa(),QP=we(),YP=Il(),yg=Object.getOwnPropertyDescriptor;bg.f=zP?yg:function(e,t){if(e=XP(e),t=ZP(t),YP)try{return yg(e,t)}catch{}if(QP(e,t))return KP(!JP($P.f,e,t),e[t])}});var Jl=f((fB,Sg)=>{var Vl=he(),e0=we(),kg=Function.prototype,t0=Vl&&Object.getOwnPropertyDescriptor,zl=e0(kg,"name"),r0=zl&&function(){}.name==="something",i0=zl&&(!Vl||Vl&&t0(kg,"name").configurable);Sg.exports={EXISTS:zl,PROPER:r0,CONFIGURABLE:i0}});var Kl=f((vB,Cg)=>{var n0=Z(),s0=Q(),$l=ha(),o0=n0(Function.toString);s0($l.inspectSource)||($l.inspectSource=function(r){return o0(r)});Cg.exports=$l.inspectSource});var Ql=f((yB,Ig)=>{var Zl=Z(),a0=le(),d0=Q(),Ra=we(),Xl=he(),l0=Jl().CONFIGURABLE,u0=Kl(),wg=Jr(),c0=wg.enforce,m0=wg.get,Pg=String,Oa=Object.defineProperty,p0=Zl("".slice),g0=Zl("".replace),h0=Zl([].join),f0=Xl&&!a0(function(){return Oa(function(){},"length",{value:8}).length!==8}),v0=String(String).split("String"),y0=Ig.exports=function(r,e,t){p0(Pg(e),0,7)==="Symbol("&&(e="["+g0(Pg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Ra(r,"name")||l0&&r.name!==e)&&(Xl?Oa(r,"name",{value:e,configurable:!0}):r.name=e),f0&&t&&Ra(t,"arity")&&r.length!==t.arity&&Oa(r,"length",{value:t.arity});try{t&&Ra(t,"constructor")&&t.constructor?Xl&&Oa(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=c0(r);return Ra(i,"source")||(i.source=h0(v0,typeof e=="string"?e:"")),r};Function.prototype.toString=y0(function(){return d0(this)&&m0(this).source||u0(this)},"toString")});var ar=f((bB,xg)=>{var b0=Q(),k0=Qe(),S0=Ql(),C0=ga();xg.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(b0(t)&&S0(t,o,i),i.global)n?r[e]=t:C0(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:k0.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var Yl=f((kB,Fg)=>{var P0=ma(),w0=Math.max,I0=Math.min;Fg.exports=function(r,e){var t=P0(r);return t<0?w0(t+e,0):I0(t,e)}});var Ag=f((SB,Tg)=>{var x0=ma(),F0=Math.min;Tg.exports=function(r){return r>0?F0(x0(r),9007199254740991):0}});var Ba=f((CB,Eg)=>{var T0=Ag();Eg.exports=function(r){return T0(r.length)}});var Bg=f((PB,Og)=>{var A0=$r(),E0=Yl(),R0=Ba(),Rg=function(r){return function(e,t,i){var n=A0(e),o=R0(n),a=E0(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}};Og.exports={includes:Rg(!0),indexOf:Rg(!1)}});var tu=f((wB,Ug)=>{var O0=Z(),eu=we(),B0=$r(),M0=Bg().indexOf,U0=Ta(),Mg=O0([].push);Ug.exports=function(r,e){var t=B0(r),i=0,n=[],o;for(o in t)!eu(U0,o)&&eu(t,o)&&Mg(n,o);for(;e.length>i;)eu(t,o=e[i++])&&(~M0(n,o)||Mg(n,o));return n}});var Ma=f((IB,Lg)=>{Lg.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Ng=f(Dg=>{var L0=tu(),D0=Ma(),N0=D0.concat("length","prototype");Dg.f=Object.getOwnPropertyNames||function(e){return L0(e,N0)}});var ru=f(_g=>{_g.f=Object.getOwnPropertySymbols});var qg=f((TB,Hg)=>{var _0=Hn(),H0=Z(),q0=Ng(),j0=ru(),W0=Ze(),G0=H0([].concat);Hg.exports=_0("Reflect","ownKeys")||function(e){var t=q0.f(W0(e)),i=j0.f;return i?G0(t,i(e)):t}});var Gg=f((AB,Wg)=>{var jg=we(),V0=qg(),z0=Gl(),J0=Qe();Wg.exports=function(r,e,t){for(var i=V0(e),n=J0.f,o=z0.f,a=0;a<i.length;a++){var c=i[a];!jg(r,c)&&!(t&&jg(t,c))&&n(r,c,o(e,c))}}});var zg=f((EB,Vg)=>{var $0=le(),K0=Q(),X0=/#|\.prototype\./,jn=function(r,e){var t=Q0[Z0(r)];return t==ew?!0:t==Y0?!1:K0(e)?$0(e):!!e},Z0=jn.normalize=function(r){return String(r).replace(X0,".").toLowerCase()},Q0=jn.data={},Y0=jn.NATIVE="N",ew=jn.POLYFILL="P";Vg.exports=jn});var Wn=f((RB,Jg)=>{var iu=ge(),tw=Gl().f,rw=xa(),iw=ar(),nw=ga(),sw=Gg(),ow=zg();Jg.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,c,p,g,h;if(i?a=iu:n?a=iu[t]||nw(t,{}):a=(iu[t]||{}).prototype,a)for(c in e){if(g=e[c],r.dontCallGetSet?(h=tw(a,c),p=h&&h.value):p=a[c],o=ow(i?c:t+(n?".":"#")+c,r.forced),!o&&p!==void 0){if(typeof g==typeof p)continue;sw(g,p)}(r.sham||p&&p.sham)&&rw(g,"sham",!0),iw(a,c,g,r)}}});var nu=f((OB,$g)=>{var aw=tu(),dw=Ma();$g.exports=Object.keys||function(e){return aw(e,dw)}});var Xg=f(Kg=>{var lw=he(),uw=xl(),cw=Qe(),mw=Ze(),pw=$r(),gw=nu();Kg.f=lw&&!uw?Object.defineProperties:function(e,t){mw(e);for(var i=pw(t),n=gw(t),o=n.length,a=0,c;o>a;)cw.f(e,c=n[a++],i[c]);return e}});var Qg=f((MB,Zg)=>{var hw=Hn();Zg.exports=hw("document","documentElement")});var Gn=f((UB,sh)=>{var fw=Ze(),vw=Xg(),Yg=Ma(),yw=Ta(),bw=Qg(),kw=wl(),Sw=Fa(),eh=">",th="<",ou="prototype",au="script",ih=Sw("IE_PROTO"),su=function(){},nh=function(r){return th+au+eh+r+th+"/"+au+eh},rh=function(r){r.write(nh("")),r.close();var e=r.parentWindow.Object;return r=null,e},Cw=function(){var r=kw("iframe"),e="java"+au+":",t;return r.style.display="none",bw.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(nh("document.F=Object")),t.close(),t.F},Ua,La=function(){try{Ua=new ActiveXObject("htmlfile")}catch{}La=typeof document<"u"?document.domain&&Ua?rh(Ua):Cw():rh(Ua);for(var r=Yg.length;r--;)delete La[ou][Yg[r]];return La()};yw[ih]=!0;sh.exports=Object.create||function(e,t){var i;return e!==null?(su[ou]=fw(e),i=new su,su[ou]=null,i[ih]=e):i=La(),t===void 0?i:vw.f(i,t)}});var ah=f((LB,oh)=>{var Pw=le();oh.exports=!Pw(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var lu=f((DB,lh)=>{var ww=we(),Iw=Q(),xw=Dn(),Fw=Fa(),Tw=ah(),dh=Fw("IE_PROTO"),du=Object,Aw=du.prototype;lh.exports=Tw?du.getPrototypeOf:function(r){var e=xw(r);if(ww(e,dh))return e[dh];var t=e.constructor;return Iw(t)&&e instanceof t?t.prototype:e instanceof du?Aw:null}});var pu=f((NB,mh)=>{"use strict";var Ew=le(),Rw=Q(),Ow=Pt(),Bw=Gn(),uh=lu(),Mw=ar(),Uw=Ie(),Lw=Gr(),mu=Uw("iterator"),ch=!1,lt,uu,cu;[].keys&&(cu=[].keys(),"next"in cu?(uu=uh(uh(cu)),uu!==Object.prototype&&(lt=uu)):ch=!0);var Dw=!Ow(lt)||Ew(function(){var r={};return lt[mu].call(r)!==r});Dw?lt={}:Lw&&(lt=Bw(lt));Rw(lt[mu])||Mw(lt,mu,function(){return this});mh.exports={IteratorPrototype:lt,BUGGY_SAFARI_ITERATORS:ch}});var Vn=f((_B,gh)=>{var Nw=Qe().f,_w=we(),Hw=Ie(),ph=Hw("toStringTag");gh.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!_w(r,ph)&&Nw(r,ph,{configurable:!0,value:e})}});var Kr=f((HB,hh)=>{hh.exports={}});var gu=f((qB,fh)=>{"use strict";var qw=pu().IteratorPrototype,jw=Gn(),Ww=zr(),Gw=Vn(),Vw=Kr(),zw=function(){return this};fh.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=jw(qw,{next:Ww(+!i,t)}),Gw(r,n,!1,!0),Vw[n]=zw,r}});var yh=f((jB,vh)=>{var Jw=Q(),$w=String,Kw=TypeError;vh.exports=function(r){if(typeof r=="object"||Jw(r))return r;throw Kw("Can't set "+$w(r)+" as a prototype")}});var kh=f((WB,bh)=>{var Xw=Z(),Zw=Ze(),Qw=yh();bh.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=Xw(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return Zw(n),Qw(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var fu=f((GB,Eh)=>{"use strict";var Yw=Wn(),eI=je(),Da=Gr(),Th=Jl(),tI=Q(),rI=gu(),Sh=lu(),Ch=kh(),iI=Vn(),nI=xa(),hu=ar(),sI=Ie(),Ph=Kr(),Ah=pu(),oI=Th.PROPER,aI=Th.CONFIGURABLE,wh=Ah.IteratorPrototype,Na=Ah.BUGGY_SAFARI_ITERATORS,zn=sI("iterator"),Ih="keys",Jn="values",xh="entries",Fh=function(){return this};Eh.exports=function(r,e,t,i,n,o,a){rI(t,e,i);var c=function(U){if(U===n&&y)return y;if(!Na&&U in h)return h[U];switch(U){case Ih:return function(){return new t(this,U)};case Jn:return function(){return new t(this,U)};case xh:return function(){return new t(this,U)}}return function(){return new t(this)}},p=e+" Iterator",g=!1,h=r.prototype,m=h[zn]||h["@@iterator"]||n&&h[n],y=!Na&&m||c(n),b=e=="Array"&&h.entries||m,C,x,I;if(b&&(C=Sh(b.call(new r)),C!==Object.prototype&&C.next&&(!Da&&Sh(C)!==wh&&(Ch?Ch(C,wh):tI(C[zn])||hu(C,zn,Fh)),iI(C,p,!0,!0),Da&&(Ph[p]=Fh))),oI&&n==Jn&&m&&m.name!==Jn&&(!Da&&aI?nI(h,"name",Jn):(g=!0,y=function(){return eI(m,this)})),n)if(x={values:c(Jn),keys:o?y:c(Ih),entries:c(xh)},a)for(I in x)(Na||g||!(I in h))&&hu(h,I,x[I]);else Yw({target:e,proto:!0,forced:Na||g},x);return(!Da||a)&&h[zn]!==y&&hu(h,zn,y,{name:n}),Ph[e]=y,x}});var vu=f((VB,Rh)=>{Rh.exports=function(r,e){return{value:r,done:e}}});var Uh=f(()=>{"use strict";var dI=Cl().charAt,lI=_n(),Bh=Jr(),uI=fu(),Oh=vu(),Mh="String Iterator",cI=Bh.set,mI=Bh.getterFor(Mh);uI(String,"String",function(r){cI(this,{type:Mh,string:lI(r),index:0})},function(){var e=mI(this),t=e.string,i=e.index,n;return i>=t.length?Oh(void 0,!0):(n=dI(t,i),e.index+=n.length,Oh(n,!1))})});var yu=f(($B,Lh)=>{var pI=le(),gI=Ie(),hI=Gr(),fI=gI("iterator");Lh.exports=!pI(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}),hI&&!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[fI]||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 Nh=f((KB,Dh)=>{var vI=ba(),yI=Z();Dh.exports=function(r){if(vI(r)==="Function")return yI(r)}});var _a=f((XB,Hh)=>{var _h=Nh(),bI=Ca(),kI=ca(),SI=_h(_h.bind);Hh.exports=function(r,e){return bI(r),e===void 0?r:kI?SI(r,e):function(){return r.apply(e,arguments)}}});var Wh=f((ZB,jh)=>{var qh=Ql(),CI=Qe();jh.exports=function(r,e,t){return t.get&&qh(t.get,e,{getter:!0}),t.set&&qh(t.set,e,{setter:!0}),CI.f(r,e,t)}});var bu=f((QB,Gh)=>{var PI=Tl(),wI=TypeError;Gh.exports=function(r,e){if(PI(e,r))return r;throw wI("Incorrect invocation")}});var $h=f((YB,Jh)=>{"use strict";var Vh=he(),II=Z(),xI=je(),FI=le(),ku=nu(),TI=ru(),AI=ql(),EI=Dn(),RI=Wl(),Xr=Object.assign,zh=Object.defineProperty,OI=II([].concat);Jh.exports=!Xr||FI(function(){if(Vh&&Xr({b:1},Xr(zh({},"a",{enumerable:!0,get:function(){zh(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||ku(Xr({},e)).join("")!=i})?function(e,t){for(var i=EI(e),n=arguments.length,o=1,a=TI.f,c=AI.f;n>o;)for(var p=RI(arguments[o++]),g=a?OI(ku(p),a(p)):ku(p),h=g.length,m=0,y;h>m;)y=g[m++],(!Vh||xI(c,p,y))&&(i[y]=p[y]);return i}:Xr});var Zh=f((eM,Xh)=>{var BI=je(),Kh=Ze(),MI=Pa();Xh.exports=function(r,e,t){var i,n;Kh(r);try{if(i=MI(r,"return"),!i){if(e==="throw")throw t;return t}i=BI(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Kh(i),t}});var Yh=f((tM,Qh)=>{var UI=Ze(),LI=Zh();Qh.exports=function(r,e,t,i){try{return i?e(UI(t)[0],t[1]):e(t)}catch(n){LI(r,"throw",n)}}});var tf=f((rM,ef)=>{var DI=Ie(),NI=Kr(),_I=DI("iterator"),HI=Array.prototype;ef.exports=function(r){return r!==void 0&&(NI.Array===r||HI[_I]===r)}});var df=f((iM,af)=>{var qI=Z(),jI=le(),rf=Q(),WI=Nn(),GI=Hn(),VI=Kl(),nf=function(){},zI=[],sf=GI("Reflect","construct"),Su=/^\s*(?:class|function)\b/,JI=qI(Su.exec),$I=!Su.exec(nf),$n=function(e){if(!rf(e))return!1;try{return sf(nf,zI,e),!0}catch{return!1}},of=function(e){if(!rf(e))return!1;switch(WI(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return $I||!!JI(Su,VI(e))}catch{return!0}};of.sham=!0;af.exports=!sf||jI(function(){var r;return $n($n.call)||!$n(Object)||!$n(function(){r=!0})||r})?of:$n});var Cu=f((nM,lf)=>{"use strict";var KI=wa(),XI=Qe(),ZI=zr();lf.exports=function(r,e,t){var i=KI(e);i in r?XI.f(r,i,ZI(0,t)):r[i]=t}});var Ha=f((sM,cf)=>{var QI=Nn(),uf=Pa(),YI=fa(),ex=Kr(),tx=Ie(),rx=tx("iterator");cf.exports=function(r){if(!YI(r))return uf(r,rx)||uf(r,"@@iterator")||ex[QI(r)]}});var Pu=f((oM,mf)=>{var ix=je(),nx=Ca(),sx=Ze(),ox=El(),ax=Ha(),dx=TypeError;mf.exports=function(r,e){var t=arguments.length<2?ax(r):e;if(nx(t))return sx(ix(t,r));throw dx(ox(r)+" is not iterable")}});var ff=f((aM,hf)=>{"use strict";var lx=_a(),ux=je(),cx=Dn(),mx=Yh(),px=tf(),gx=df(),hx=Ba(),pf=Cu(),fx=Pu(),vx=Ha(),gf=Array;hf.exports=function(e){var t=cx(e),i=gx(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=lx(o,n>2?arguments[2]:void 0));var c=vx(t),p=0,g,h,m,y,b,C;if(c&&!(this===gf&&px(c)))for(y=fx(t,c),b=y.next,h=i?new this:[];!(m=ux(b,y)).done;p++)C=a?mx(y,o,[m.value,p],!0):m.value,pf(h,p,C);else for(g=hx(t),h=i?new this(g):gf(g);g>p;p++)C=a?o(t[p],p):t[p],pf(h,p,C);return h.length=p,h}});var wu=f((dM,yf)=>{var vf=Yl(),yx=Ba(),bx=Cu(),kx=Array,Sx=Math.max;yf.exports=function(r,e,t){for(var i=yx(r),n=vf(e,i),o=vf(t===void 0?i:t,i),a=kx(Sx(o-n,0)),c=0;n<o;n++,c++)bx(a,c,r[n]);return a.length=c,a}});var Ff=f((lM,xf)=>{var dr=Z(),Iu=2147483647,Kn=36,Pf=1,Tu=26,Cx=38,Px=700,wx=72,Ix=128,xx="-",Fx=/[^\0-\u007E]/,wf=/[.\u3002\uFF0E\uFF61]/g,bf="Overflow: input needs wider integers to process",xu=Kn-Pf,kf=RangeError,Tx=dr(wf.exec),Zr=Math.floor,Fu=String.fromCharCode,Sf=dr("".charCodeAt),If=dr([].join),wt=dr([].push),Ax=dr("".replace),Ex=dr("".split),Rx=dr("".toLowerCase),Ox=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=Sf(r,t++);if(n>=55296&&n<=56319&&t<i){var o=Sf(r,t++);(o&64512)==56320?wt(e,((n&1023)<<10)+(o&1023)+65536):(wt(e,n),t--)}else wt(e,n)}return e},Cf=function(r){return r+22+75*(r<26)},Bx=function(r,e,t){var i=0;for(r=t?Zr(r/Px):r>>1,r+=Zr(r/e);r>xu*Tu>>1;)r=Zr(r/xu),i+=Kn;return Zr(i+(xu+1)*r/(r+Cx))},Mx=function(r){var e=[];r=Ox(r);var t=r.length,i=Ix,n=0,o=wx,a,c;for(a=0;a<r.length;a++)c=r[a],c<128&&wt(e,Fu(c));var p=e.length,g=p;for(p&&wt(e,xx);g<t;){var h=Iu;for(a=0;a<r.length;a++)c=r[a],c>=i&&c<h&&(h=c);var m=g+1;if(h-i>Zr((Iu-n)/m))throw kf(bf);for(n+=(h-i)*m,i=h,a=0;a<r.length;a++){if(c=r[a],c<i&&++n>Iu)throw kf(bf);if(c==i){for(var y=n,b=Kn;;){var C=b<=o?Pf:b>=o+Tu?Tu:b-o;if(y<C)break;var x=y-C,I=Kn-C;wt(e,Fu(Cf(C+x%I))),y=Zr(x/I),b+=Kn}wt(e,Fu(Cf(y))),o=Bx(n,m,g==p),n=0,g++}}n++,i++}return If(e,"")};xf.exports=function(r){var e=[],t=Ex(Ax(Rx(r),wf,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],wt(e,Tx(Fx,n)?"xn--"+Mx(n):n);return If(e,".")}});var Au=f((uM,Tf)=>{var Ux=TypeError;Tf.exports=function(r,e){if(r<e)throw Ux("Not enough arguments");return r}});var Ef=f((cM,Af)=>{var Lx=Ie(),Dx=Gn(),Nx=Qe().f,Eu=Lx("unscopables"),Ru=Array.prototype;Ru[Eu]==null&&Nx(Ru,Eu,{configurable:!0,value:Dx(null)});Af.exports=function(r){Ru[Eu][r]=!0}});var Lf=f((mM,Uf)=>{"use strict";var _x=$r(),Ou=Ef(),Rf=Kr(),Bf=Jr(),Hx=Qe().f,qx=fu(),qa=vu(),jx=Gr(),Wx=he(),Mf="Array Iterator",Gx=Bf.set,Vx=Bf.getterFor(Mf);Uf.exports=qx(Array,"Array",function(r,e){Gx(this,{type:Mf,target:_x(r),index:0,kind:e})},function(){var r=Vx(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,qa(void 0,!0)):t=="keys"?qa(i,!1):t=="values"?qa(e[i],!1):qa([i,e[i]],!1)},"values");var Of=Rf.Arguments=Rf.Array;Ou("keys");Ou("values");Ou("entries");if(!jx&&Wx&&Of.name!=="values")try{Hx(Of,"name",{value:"values"})}catch{}});var Nf=f((pM,Df)=>{var zx=ar();Df.exports=function(r,e,t){for(var i in e)zx(r,i,e[i],t);return r}});var qf=f((gM,Hf)=>{var _f=wu(),Jx=Math.floor,Bu=function(r,e){var t=r.length,i=Jx(t/2);return t<8?$x(r,e):Kx(r,Bu(_f(r,0,i),e),Bu(_f(r,i),e),e)},$x=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},Kx=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};Hf.exports=Bu});var Wu=f((hM,av)=>{"use strict";Lf();var Nu=Wn(),Yr=ge(),ja=je(),Ye=Z(),Xx=he(),Yf=yu(),ev=ar(),Zx=Nf(),Qx=Vn(),Yx=gu(),qu=Jr(),tv=bu(),Mu=Q(),eF=we(),tF=_a(),rF=Nn(),iF=Ze(),rv=Pt(),fe=_n(),nF=Gn(),jf=zr(),_u=Pu(),sF=Ha(),Qr=Au(),oF=Ie(),aF=qf(),dF=oF("iterator"),Qn="URLSearchParams",iv=Qn+"Iterator",nv=qu.set,Ge=qu.getterFor(Qn),lF=qu.getterFor(iv),uF=Object.getOwnPropertyDescriptor,ju=function(r){if(!Xx)return Yr[r];var e=uF(Yr,r);return e&&e.value},Wf=ju("fetch"),Ga=ju("Request"),Xn=ju("Headers"),Uu=Ga&&Ga.prototype,Gf=Xn&&Xn.prototype,cF=Yr.RegExp,mF=Yr.TypeError,sv=Yr.decodeURIComponent,pF=Yr.encodeURIComponent,gF=Ye("".charAt),Vf=Ye([].join),lr=Ye([].push),Hu=Ye("".replace),hF=Ye([].shift),zf=Ye([].splice),Jf=Ye("".split),fF=Ye("".slice),vF=/\+/g,$f=Array(4),yF=function(r){return $f[r-1]||($f[r-1]=cF("((?:%[\\da-f]{2}){"+r+"})","gi"))},bF=function(r){try{return sv(r)}catch{return r}},Kf=function(r){var e=Hu(r,vF," "),t=4;try{return sv(e)}catch{for(;t;)e=Hu(e,yF(t--),bF);return e}},kF=/[!'()~]|%20/g,SF={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},CF=function(r){return SF[r]},Xf=function(r){return Hu(pF(r),kF,CF)},Lu=Yx(function(e,t){nv(this,{type:iv,iterator:_u(Ge(e).entries),kind:t})},"Iterator",function(){var e=lF(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),ov=function(r){this.entries=[],this.url=null,r!==void 0&&(rv(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?gF(r,0)==="?"?fF(r,1):r:fe(r)))};ov.prototype={type:Qn,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=sF(r),t,i,n,o,a,c,p;if(e)for(t=_u(r,e),i=t.next;!(n=ja(i,t)).done;){if(o=_u(iF(n.value)),a=o.next,(c=ja(a,o)).done||(p=ja(a,o)).done||!ja(a,o).done)throw mF("Expected sequence with length 2");lr(this.entries,{key:fe(c.value),value:fe(p.value)})}else for(var g in r)eF(r,g)&&lr(this.entries,{key:g,value:fe(r[g])})},parseQuery:function(r){if(r)for(var e=Jf(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=Jf(i,"="),lr(this.entries,{key:Kf(hF(n)),value:Kf(Vf(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],lr(e,Xf(i.key)+"="+Xf(i.value));return Vf(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Va=function(){tv(this,Zn);var e=arguments.length>0?arguments[0]:void 0;nv(this,new ov(e))},Zn=Va.prototype;Zx(Zn,{append:function(e,t){Qr(arguments.length,2);var i=Ge(this);lr(i.entries,{key:fe(e),value:fe(t)}),i.updateURL()},delete:function(r){Qr(arguments.length,1);for(var e=Ge(this),t=e.entries,i=fe(r),n=0;n<t.length;)t[n].key===i?zf(t,n,1):n++;e.updateURL()},get:function(e){Qr(arguments.length,1);for(var t=Ge(this).entries,i=fe(e),n=0;n<t.length;n++)if(t[n].key===i)return t[n].value;return null},getAll:function(e){Qr(arguments.length,1);for(var t=Ge(this).entries,i=fe(e),n=[],o=0;o<t.length;o++)t[o].key===i&&lr(n,t[o].value);return n},has:function(e){Qr(arguments.length,1);for(var t=Ge(this).entries,i=fe(e),n=0;n<t.length;)if(t[n++].key===i)return!0;return!1},set:function(e,t){Qr(arguments.length,1);for(var i=Ge(this),n=i.entries,o=!1,a=fe(e),c=fe(t),p=0,g;p<n.length;p++)g=n[p],g.key===a&&(o?zf(n,p--,1):(o=!0,g.value=c));o||lr(n,{key:a,value:c}),i.updateURL()},sort:function(){var e=Ge(this);aF(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=Ge(this).entries,i=tF(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 Lu(this,"keys")},values:function(){return new Lu(this,"values")},entries:function(){return new Lu(this,"entries")}},{enumerable:!0});ev(Zn,dF,Zn.entries,{name:"entries"});ev(Zn,"toString",function(){return Ge(this).serialize()},{enumerable:!0});Qx(Va,Qn);Nu({global:!0,constructor:!0,forced:!Yf},{URLSearchParams:Va});!Yf&&Mu(Xn)&&(Zf=Ye(Gf.has),Qf=Ye(Gf.set),Du=function(r){if(rv(r)){var e=r.body,t;if(rF(e)===Qn)return t=r.headers?new Xn(r.headers):new Xn,Zf(t,"content-type")||Qf(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),nF(r,{body:jf(0,fe(e)),headers:jf(0,t)})}return r},Mu(Wf)&&Nu({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Wf(e,arguments.length>1?Du(arguments[1]):{})}}),Mu(Ga)&&(Wa=function(e){return tv(this,Uu),new Ga(e,arguments.length>1?Du(arguments[1]):{})},Uu.constructor=Wa,Wa.prototype=Uu,Nu({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Wa})));var Zf,Qf,Du,Wa;av.exports={URLSearchParams:Va,getState:Ge}});var xv=f(()=>{"use strict";Uh();var PF=Wn(),sc=he(),wF=yu(),oc=ge(),dv=_a(),Ee=Z(),Xa=ar(),xe=Wh(),IF=bu(),rc=we(),ac=$h(),ei=ff(),Ve=wu(),xF=Cl().codeAt,FF=Ff(),ct=_n(),TF=Vn(),AF=Au(),kv=Wu(),Sv=Jr(),EF=Sv.set,Za=Sv.getterFor("URL"),RF=kv.URLSearchParams,OF=kv.getState,Yn=oc.URL,ic=oc.TypeError,Qa=oc.parseInt,BF=Math.floor,lv=Math.pow,Ae=Ee("".charAt),ze=Ee(/./.exec),ts=Ee([].join),MF=Ee(1 .toString),UF=Ee([].pop),ri=Ee([].push),uv=Ee("".replace),LF=Ee([].shift),DF=Ee("".split),is=Ee("".slice),Ya=Ee("".toLowerCase),NF=Ee([].unshift),_F="Invalid authority",Gu="Invalid scheme",ur="Invalid host",cv="Invalid port",Cv=/[a-z]/i,HF=/[\d+-.a-z]/i,nc=/\d/,qF=/^0x/i,jF=/^[0-7]+$/,WF=/^\d+$/,Pv=/^[\da-f]+$/i,GF=/[\0\t\n\r #%/:<>?@[\\\]^|]/,VF=/[\0\t\n\r #/:<>?@[\\\]^|]/,zF=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,JF=/[\t\n\r]/g,Fe,$F=function(r){var e=DF(r,"."),t,i,n,o,a,c,p;if(e.length&&e[e.length-1]==""&&e.length--,t=e.length,t>4)return r;for(i=[],n=0;n<t;n++){if(o=e[n],o=="")return r;if(a=10,o.length>1&&Ae(o,0)=="0"&&(a=ze(qF,o)?16:8,o=is(o,a==8?1:2)),o==="")c=0;else{if(!ze(a==10?WF:a==8?jF:Pv,o))return r;c=Qa(o,a)}ri(i,c)}for(n=0;n<t;n++)if(c=i[n],n==t-1){if(c>=lv(256,5-t))return null}else if(c>255)return null;for(p=UF(i),n=0;n<i.length;n++)p+=i[n]*lv(256,3-n);return p},KF=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,c,p,g,h,m,y=function(){return Ae(r,n)};if(y()==":"){if(Ae(r,1)!=":")return;n+=2,t++,i=t}for(;y();){if(t==8)return;if(y()==":"){if(i!==null)return;n++,t++,i=t;continue}for(o=a=0;a<4&&ze(Pv,y());)o=o*16+Qa(y(),16),n++,a++;if(y()=="."){if(a==0||(n-=a,t>6))return;for(c=0;y();){if(p=null,c>0)if(y()=="."&&c<4)n++;else return;if(!ze(nc,y()))return;for(;ze(nc,y());){if(g=Qa(y(),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(y()==":"){if(n++,!y())return}else if(y())return;e[t++]=o}if(i!==null)for(h=t-i,t=7;t!=0&&h>0;)m=e[t],e[t--]=e[i+h-1],e[i+--h]=m;else if(t!=8)return;return e},XF=function(r){for(var e=null,t=1,i=null,n=0,o=0;o<8;o++)r[o]!==0?(n>t&&(e=i,t=n),i=null,n=0):(i===null&&(i=o),++n);return n>t&&(e=i,t=n),e},es=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)NF(e,r%256),r=BF(r/256);return ts(e,".")}else if(typeof r=="object"){for(e="",i=XF(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=MF(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},Ka={},wv=ac({},Ka,{" ":1,'"':1,"<":1,">":1,"`":1}),Iv=ac({},wv,{"#":1,"?":1,"{":1,"}":1}),Vu=ac({},Iv,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),It=function(r,e){var t=xF(r,0);return t>32&&t<127&&!rc(e,r)?r:encodeURIComponent(r)},za={ftp:21,file:null,http:80,https:443,ws:80,wss:443},rs=function(r,e){var t;return r.length==2&&ze(Cv,Ae(r,0))&&((t=Ae(r,1))==":"||!e&&t=="|")},mv=function(r){var e;return r.length>1&&rs(is(r,0,2))&&(r.length==2||(e=Ae(r,2))==="/"||e==="\\"||e==="?"||e==="#")},ZF=function(r){return r==="."||Ya(r)==="%2e"},QF=function(r){return r=Ya(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},zu={},pv={},Ju={},gv={},hv={},$u={},fv={},vv={},Ja={},$a={},Ku={},Xu={},Zu={},Qu={},yv={},Yu={},ti={},et={},bv={},cr={},ut={},dc=function(r,e,t){var i=ct(r),n,o,a;if(e){if(o=this.parse(i),o)throw ic(o);this.searchParams=null}else{if(t!==void 0&&(n=new dc(t,!0)),o=this.parse(i,null,n),o)throw ic(o);a=OF(new RF),a.bindURL(this),this.searchParams=a}};dc.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||zu,o=0,a="",c=!1,p=!1,g=!1,h,m,y,b;for(r=ct(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=uv(r,zF,"")),r=uv(r,JF,""),h=ei(r);o<=h.length;){switch(m=h[o],n){case zu:if(m&&ze(Cv,m))a+=Ya(m),n=pv;else{if(e)return Gu;n=Ju;continue}break;case pv:if(m&&(ze(HF,m)||m=="+"||m=="-"||m=="."))a+=Ya(m);else if(m==":"){if(e&&(i.isSpecial()!=rc(za,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&za[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=Qu:i.isSpecial()&&t&&t.scheme==i.scheme?n=gv:i.isSpecial()?n=vv:h[o+1]=="/"?(n=hv,o++):(i.cannotBeABaseURL=!0,ri(i.path,""),n=bv)}else{if(e)return Gu;a="",n=Ju,o=0;continue}break;case Ju:if(!t||t.cannotBeABaseURL&&m!="#")return Gu;if(t.cannotBeABaseURL&&m=="#"){i.scheme=t.scheme,i.path=Ve(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=ut;break}n=t.scheme=="file"?Qu:$u;continue;case gv:if(m=="/"&&h[o+1]=="/")n=Ja,o++;else{n=$u;continue}break;case hv:if(m=="/"){n=$a;break}else{n=et;continue}case $u:if(i.scheme=t.scheme,m==Fe)i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query=t.query;else if(m=="/"||m=="\\"&&i.isSpecial())n=fv;else if(m=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(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=Ve(t.path),i.query=t.query,i.fragment="",n=ut;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.path.length--,n=et;continue}break;case fv:if(i.isSpecial()&&(m=="/"||m=="\\"))n=Ja;else if(m=="/")n=$a;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=et;continue}break;case vv:if(n=Ja,m!="/"||Ae(a,o+1)!="/")continue;o++;break;case Ja:if(m!="/"&&m!="\\"){n=$a;continue}break;case $a:if(m=="@"){c&&(a="%40"+a),c=!0,y=ei(a);for(var C=0;C<y.length;C++){var x=y[C];if(x==":"&&!g){g=!0;continue}var I=It(x,Vu);g?i.password+=I:i.username+=I}a=""}else if(m==Fe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(c&&a=="")return _F;o-=ei(a).length+1,a="",n=Ku}else a+=m;break;case Ku:case Xu:if(e&&i.scheme=="file"){n=Yu;continue}else if(m==":"&&!p){if(a=="")return ur;if(b=i.parseHost(a),b)return b;if(a="",n=Zu,e==Xu)return}else if(m==Fe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(i.isSpecial()&&a=="")return ur;if(e&&a==""&&(i.includesCredentials()||i.port!==null))return;if(b=i.parseHost(a),b)return b;if(a="",n=ti,e)return;continue}else m=="["?p=!0:m=="]"&&(p=!1),a+=m;break;case Zu:if(ze(nc,m))a+=m;else if(m==Fe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()||e){if(a!=""){var U=Qa(a,10);if(U>65535)return cv;i.port=i.isSpecial()&&U===za[i.scheme]?null:U,a=""}if(e)return;n=ti;continue}else return cv;break;case Qu:if(i.scheme="file",m=="/"||m=="\\")n=yv;else if(t&&t.scheme=="file")if(m==Fe)i.host=t.host,i.path=Ve(t.path),i.query=t.query;else if(m=="?")i.host=t.host,i.path=Ve(t.path),i.query="",n=cr;else if(m=="#")i.host=t.host,i.path=Ve(t.path),i.query=t.query,i.fragment="",n=ut;else{mv(ts(Ve(h,o),""))||(i.host=t.host,i.path=Ve(t.path),i.shortenPath()),n=et;continue}else{n=et;continue}break;case yv:if(m=="/"||m=="\\"){n=Yu;break}t&&t.scheme=="file"&&!mv(ts(Ve(h,o),""))&&(rs(t.path[0],!0)?ri(i.path,t.path[0]):i.host=t.host),n=et;continue;case Yu:if(m==Fe||m=="/"||m=="\\"||m=="?"||m=="#"){if(!e&&rs(a))n=et;else if(a==""){if(i.host="",e)return;n=ti}else{if(b=i.parseHost(a),b)return b;if(i.host=="localhost"&&(i.host=""),e)return;a="",n=ti}continue}else a+=m;break;case ti:if(i.isSpecial()){if(n=et,m!="/"&&m!="\\")continue}else if(!e&&m=="?")i.query="",n=cr;else if(!e&&m=="#")i.fragment="",n=ut;else if(m!=Fe&&(n=et,m!="/"))continue;break;case et:if(m==Fe||m=="/"||m=="\\"&&i.isSpecial()||!e&&(m=="?"||m=="#")){if(QF(a)?(i.shortenPath(),m!="/"&&!(m=="\\"&&i.isSpecial())&&ri(i.path,"")):ZF(a)?m!="/"&&!(m=="\\"&&i.isSpecial())&&ri(i.path,""):(i.scheme=="file"&&!i.path.length&&rs(a)&&(i.host&&(i.host=""),a=Ae(a,0)+":"),ri(i.path,a)),a="",i.scheme=="file"&&(m==Fe||m=="?"||m=="#"))for(;i.path.length>1&&i.path[0]==="";)LF(i.path);m=="?"?(i.query="",n=cr):m=="#"&&(i.fragment="",n=ut)}else a+=It(m,Iv);break;case bv:m=="?"?(i.query="",n=cr):m=="#"?(i.fragment="",n=ut):m!=Fe&&(i.path[0]+=It(m,Ka));break;case cr:!e&&m=="#"?(i.fragment="",n=ut):m!=Fe&&(m=="'"&&i.isSpecial()?i.query+="%27":m=="#"?i.query+="%23":i.query+=It(m,Ka));break;case ut:m!=Fe&&(i.fragment+=It(m,wv));break}o++}},parseHost:function(r){var e,t,i;if(Ae(r,0)=="["){if(Ae(r,r.length-1)!="]"||(e=KF(is(r,1,-1)),!e))return ur;this.host=e}else if(this.isSpecial()){if(r=FF(r),ze(GF,r)||(e=$F(r),e===null))return ur;this.host=e}else{if(ze(VF,r))return ur;for(e="",t=ei(r),i=0;i<t.length;i++)e+=It(t[i],Ka);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return rc(za,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!rs(r[0],!0))&&r.length--},serialize:function(){var r=this,e=r.scheme,t=r.username,i=r.password,n=r.host,o=r.port,a=r.path,c=r.query,p=r.fragment,g=e+":";return n!==null?(g+="//",r.includesCredentials()&&(g+=t+(i?":"+i:"")+"@"),g+=es(n),o!==null&&(g+=":"+o)):e=="file"&&(g+="//"),g+=r.cannotBeABaseURL?a[0]:a.length?"/"+ts(a,"/"):"",c!==null&&(g+="?"+c),p!==null&&(g+="#"+p),g},setHref:function(r){var e=this.parse(r);if(e)throw ic(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+"://"+es(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(ct(r)+":",zu)},getUsername:function(){return this.username},setUsername:function(r){var e=ei(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=It(e[t],Vu)}},getPassword:function(){return this.password},setPassword:function(r){var e=ei(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=It(e[t],Vu)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?es(r):es(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,Ku)},getHostname:function(){var r=this.host;return r===null?"":es(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,Xu)},getPort:function(){var r=this.port;return r===null?"":ct(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=ct(r),r==""?this.port=null:this.parse(r,Zu))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+ts(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,ti))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=ct(r),r==""?this.query=null:(Ae(r,0)=="?"&&(r=is(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=ct(r),r==""){this.fragment=null;return}Ae(r,0)=="#"&&(r=is(r,1)),this.fragment="",this.parse(r,ut)},update:function(){this.query=this.searchParams.serialize()||null}};var ii=function(e){var t=IF(this,ne),i=AF(arguments.length,1)>1?arguments[1]:void 0,n=EF(t,new dc(e,!1,i));sc||(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())},ne=ii.prototype,Te=function(r,e){return{get:function(){return Za(this)[r]()},set:e&&function(t){return Za(this)[e](t)},configurable:!0,enumerable:!0}};sc&&(xe(ne,"href",Te("serialize","setHref")),xe(ne,"origin",Te("getOrigin")),xe(ne,"protocol",Te("getProtocol","setProtocol")),xe(ne,"username",Te("getUsername","setUsername")),xe(ne,"password",Te("getPassword","setPassword")),xe(ne,"host",Te("getHost","setHost")),xe(ne,"hostname",Te("getHostname","setHostname")),xe(ne,"port",Te("getPort","setPort")),xe(ne,"pathname",Te("getPathname","setPathname")),xe(ne,"search",Te("getSearch","setSearch")),xe(ne,"searchParams",Te("getSearchParams")),xe(ne,"hash",Te("getHash","setHash")));Xa(ne,"toJSON",function(){return Za(this).serialize()},{enumerable:!0});Xa(ne,"toString",function(){return Za(this).serialize()},{enumerable:!0});Yn&&(ec=Yn.createObjectURL,tc=Yn.revokeObjectURL,ec&&Xa(ii,"createObjectURL",dv(ec,Yn)),tc&&Xa(ii,"revokeObjectURL",dv(tc,Yn)));var ec,tc;TF(ii,"URL");PF({global:!0,constructor:!0,forced:!wF,sham:!sc},{URL:ii})});var Fv=f(()=>{xv()});var Tv=f(()=>{"use strict";var YF=Wn(),eT=je();YF({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return eT(URL.prototype.toString,this)}})});var Av=f(()=>{Wu()});var Rv=f((wM,Ev)=>{var tT=ge();Ev.exports=tT});var Bv=f((IM,Ov)=>{Fv();Tv();Av();var rT=Rv();Ov.exports=rT.URL});var Lc=f((rN,zy)=>{var fA=Object.prototype.toString;zy.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 SA(e)?"generatorfunction":"function";if(vA(e))return"array";if(wA(e))return"buffer";if(PA(e))return"arguments";if(bA(e))return"date";if(yA(e))return"error";if(kA(e))return"regexp";switch(Vy(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(CA(e))return"generator";switch(t=fA.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 Vy(r){return typeof r.constructor=="function"?r.constructor.name:null}function vA(r){return Array.isArray?Array.isArray(r):r instanceof Array}function yA(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function bA(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function kA(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function SA(r,e){return Vy(r)==="GeneratorFunction"}function CA(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function PA(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 wA(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var Ky=f((iN,$y)=>{"use strict";var Jy=Symbol.prototype.valueOf,IA=Lc();function xA(r,e){switch(IA(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 EA(r);case"symbol":return RA(r);case"arraybuffer":return TA(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return AA(r);case"regexp":return FA(r);case"error":return Object.create(r);default:return r}}function FA(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 TA(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function AA(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function EA(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function RA(r){return Jy?Object(Jy.call(r)):{}}$y.exports=xA});var Zy=f((nN,Xy)=>{"use strict";Xy.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var eb=f((sN,Yy)=>{"use strict";var OA=Zy();function Qy(r){return OA(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}Yy.exports=function(e){var t,i;return!(Qy(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,Qy(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var rb=f((oN,tb)=>{"use strict";var BA=Ky(),MA=Lc(),UA=eb();function Dc(r,e){switch(MA(r)){case"object":return LA(r,e);case"array":return DA(r,e);default:return BA(r)}}function LA(r,e){if(typeof e=="function")return e(r);if(e||UA(r)){let t=new r.constructor;for(let i in r)t[i]=Dc(r[i],e);return t}return r}function DA(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=Dc(r[i],e);return t}tb.exports=Dc});var Kc=f((bs,Fi)=>{var NA=200,$c="__lodash_hash_undefined__",Id=1,gb=2,hb=9007199254740991,yd="[object Arguments]",qc="[object Array]",_A="[object AsyncFunction]",fb="[object Boolean]",vb="[object Date]",yb="[object Error]",bb="[object Function]",HA="[object GeneratorFunction]",bd="[object Map]",kb="[object Number]",qA="[object Null]",xi="[object Object]",ib="[object Promise]",jA="[object Proxy]",Sb="[object RegExp]",kd="[object Set]",Cb="[object String]",WA="[object Symbol]",GA="[object Undefined]",jc="[object WeakMap]",Pb="[object ArrayBuffer]",Sd="[object DataView]",VA="[object Float32Array]",zA="[object Float64Array]",JA="[object Int8Array]",$A="[object Int16Array]",KA="[object Int32Array]",XA="[object Uint8Array]",ZA="[object Uint8ClampedArray]",QA="[object Uint16Array]",YA="[object Uint32Array]",eE=/[\\^$.*+?()[\]{}|]/g,tE=/^\[object .+?Constructor\]$/,rE=/^(?:0|[1-9]\d*)$/,W={};W[VA]=W[zA]=W[JA]=W[$A]=W[KA]=W[XA]=W[ZA]=W[QA]=W[YA]=!0;W[yd]=W[qc]=W[Pb]=W[fb]=W[Sd]=W[vb]=W[yb]=W[bb]=W[bd]=W[kb]=W[xi]=W[Sb]=W[kd]=W[Cb]=W[jc]=!1;var wb=typeof global=="object"&&global&&global.Object===Object&&global,iE=typeof self=="object"&&self&&self.Object===Object&&self,ht=wb||iE||Function("return this")(),Ib=typeof bs=="object"&&bs&&!bs.nodeType&&bs,nb=Ib&&typeof Fi=="object"&&Fi&&!Fi.nodeType&&Fi,xb=nb&&nb.exports===Ib,Nc=xb&&wb.process,sb=function(){try{return Nc&&Nc.binding&&Nc.binding("util")}catch{}}(),ob=sb&&sb.isTypedArray;function nE(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 sE(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function oE(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 aE(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function dE(r){return function(e){return r(e)}}function lE(r,e){return r.has(e)}function uE(r,e){return r?.[e]}function cE(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function mE(r,e){return function(t){return r(e(t))}}function pE(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var gE=Array.prototype,hE=Function.prototype,xd=Object.prototype,_c=ht["__core-js_shared__"],Fb=hE.toString,rt=xd.hasOwnProperty,ab=function(){var r=/[^.]+$/.exec(_c&&_c.keys&&_c.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Tb=xd.toString,fE=RegExp("^"+Fb.call(rt).replace(eE,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),db=xb?ht.Buffer:void 0,Cd=ht.Symbol,lb=ht.Uint8Array,Ab=xd.propertyIsEnumerable,vE=gE.splice,yr=Cd?Cd.toStringTag:void 0,ub=Object.getOwnPropertySymbols,yE=db?db.isBuffer:void 0,bE=mE(Object.keys,Object),Wc=Ti(ht,"DataView"),ks=Ti(ht,"Map"),Gc=Ti(ht,"Promise"),Vc=Ti(ht,"Set"),zc=Ti(ht,"WeakMap"),Ss=Ti(Object,"create"),kE=Sr(Wc),SE=Sr(ks),CE=Sr(Gc),PE=Sr(Vc),wE=Sr(zc),cb=Cd?Cd.prototype:void 0,Hc=cb?cb.valueOf:void 0;function br(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function IE(){this.__data__=Ss?Ss(null):{},this.size=0}function xE(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function FE(r){var e=this.__data__;if(Ss){var t=e[r];return t===$c?void 0:t}return rt.call(e,r)?e[r]:void 0}function TE(r){var e=this.__data__;return Ss?e[r]!==void 0:rt.call(e,r)}function AE(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=Ss&&e===void 0?$c:e,this}br.prototype.clear=IE;br.prototype.delete=xE;br.prototype.get=FE;br.prototype.has=TE;br.prototype.set=AE;function ft(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function EE(){this.__data__=[],this.size=0}function RE(r){var e=this.__data__,t=Fd(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():vE.call(e,t,1),--this.size,!0}function OE(r){var e=this.__data__,t=Fd(e,r);return t<0?void 0:e[t][1]}function BE(r){return Fd(this.__data__,r)>-1}function ME(r,e){var t=this.__data__,i=Fd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}ft.prototype.clear=EE;ft.prototype.delete=RE;ft.prototype.get=OE;ft.prototype.has=BE;ft.prototype.set=ME;function kr(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 UE(){this.size=0,this.__data__={hash:new br,map:new(ks||ft),string:new br}}function LE(r){var e=Td(this,r).delete(r);return this.size-=e?1:0,e}function DE(r){return Td(this,r).get(r)}function NE(r){return Td(this,r).has(r)}function _E(r,e){var t=Td(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}kr.prototype.clear=UE;kr.prototype.delete=LE;kr.prototype.get=DE;kr.prototype.has=NE;kr.prototype.set=_E;function Pd(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new kr;++e<t;)this.add(r[e])}function HE(r){return this.__data__.set(r,$c),this}function qE(r){return this.__data__.has(r)}Pd.prototype.add=Pd.prototype.push=HE;Pd.prototype.has=qE;function Lt(r){var e=this.__data__=new ft(r);this.size=e.size}function jE(){this.__data__=new ft,this.size=0}function WE(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function GE(r){return this.__data__.get(r)}function VE(r){return this.__data__.has(r)}function zE(r,e){var t=this.__data__;if(t instanceof ft){var i=t.__data__;if(!ks||i.length<NA-1)return i.push([r,e]),this.size=++t.size,this;t=this.__data__=new kr(i)}return t.set(r,e),this.size=t.size,this}Lt.prototype.clear=jE;Lt.prototype.delete=WE;Lt.prototype.get=GE;Lt.prototype.has=VE;Lt.prototype.set=zE;function JE(r,e){var t=wd(r),i=!t&&dR(r),n=!t&&!i&&Jc(r),o=!t&&!i&&!n&&Lb(r),a=t||i||n||o,c=a?aE(r.length,String):[],p=c.length;for(var g in r)(e||rt.call(r,g))&&!(a&&(g=="length"||n&&(g=="offset"||g=="parent")||o&&(g=="buffer"||g=="byteLength"||g=="byteOffset")||iR(g,p)))&&c.push(g);return c}function Fd(r,e){for(var t=r.length;t--;)if(Ob(r[t][0],e))return t;return-1}function $E(r,e,t){var i=e(r);return wd(r)?i:sE(i,t(r))}function Ps(r){return r==null?r===void 0?GA:qA:yr&&yr in Object(r)?tR(r):aR(r)}function mb(r){return Cs(r)&&Ps(r)==yd}function Eb(r,e,t,i,n){return r===e?!0:r==null||e==null||!Cs(r)&&!Cs(e)?r!==r&&e!==e:KE(r,e,t,i,Eb,n)}function KE(r,e,t,i,n,o){var a=wd(r),c=wd(e),p=a?qc:Ut(r),g=c?qc:Ut(e);p=p==yd?xi:p,g=g==yd?xi:g;var h=p==xi,m=g==xi,y=p==g;if(y&&Jc(r)){if(!Jc(e))return!1;a=!0,h=!1}if(y&&!h)return o||(o=new Lt),a||Lb(r)?Rb(r,e,t,i,n,o):YE(r,e,p,t,i,n,o);if(!(t&Id)){var b=h&&rt.call(r,"__wrapped__"),C=m&&rt.call(e,"__wrapped__");if(b||C){var x=b?r.value():r,I=C?e.value():e;return o||(o=new Lt),n(x,I,t,i,o)}}return y?(o||(o=new Lt),eR(r,e,t,i,n,o)):!1}function XE(r){if(!Ub(r)||sR(r))return!1;var e=Bb(r)?fE:tE;return e.test(Sr(r))}function ZE(r){return Cs(r)&&Mb(r.length)&&!!W[Ps(r)]}function QE(r){if(!oR(r))return bE(r);var e=[];for(var t in Object(r))rt.call(r,t)&&t!="constructor"&&e.push(t);return e}function Rb(r,e,t,i,n,o){var a=t&Id,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 h=-1,m=!0,y=t&gb?new Pd:void 0;for(o.set(r,e),o.set(e,r);++h<c;){var b=r[h],C=e[h];if(i)var x=a?i(C,b,h,e,r,o):i(b,C,h,r,e,o);if(x!==void 0){if(x)continue;m=!1;break}if(y){if(!oE(e,function(I,U){if(!lE(y,U)&&(b===I||n(b,I,t,i,o)))return y.push(U)})){m=!1;break}}else if(!(b===C||n(b,C,t,i,o))){m=!1;break}}return o.delete(r),o.delete(e),m}function YE(r,e,t,i,n,o,a){switch(t){case Sd: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 lb(r),new lb(e)));case fb:case vb:case kb:return Ob(+r,+e);case yb:return r.name==e.name&&r.message==e.message;case Sb:case Cb:return r==e+"";case bd:var c=cE;case kd:var p=i&Id;if(c||(c=pE),r.size!=e.size&&!p)return!1;var g=a.get(r);if(g)return g==e;i|=gb,a.set(r,e);var h=Rb(c(r),c(e),i,n,o,a);return a.delete(r),h;case WA:if(Hc)return Hc.call(r)==Hc.call(e)}return!1}function eR(r,e,t,i,n,o){var a=t&Id,c=pb(r),p=c.length,g=pb(e),h=g.length;if(p!=h&&!a)return!1;for(var m=p;m--;){var y=c[m];if(!(a?y in e:rt.call(e,y)))return!1}var b=o.get(r);if(b&&o.get(e))return b==e;var C=!0;o.set(r,e),o.set(e,r);for(var x=a;++m<p;){y=c[m];var I=r[y],U=e[y];if(i)var Pe=a?i(U,I,y,e,r,o):i(I,U,y,r,e,o);if(!(Pe===void 0?I===U||n(I,U,t,i,o):Pe)){C=!1;break}x||(x=y=="constructor")}if(C&&!x){var Ct=r.constructor,ua=e.constructor;Ct!=ua&&"constructor"in r&&"constructor"in e&&!(typeof Ct=="function"&&Ct instanceof Ct&&typeof ua=="function"&&ua instanceof ua)&&(C=!1)}return o.delete(r),o.delete(e),C}function pb(r){return $E(r,cR,rR)}function Td(r,e){var t=r.__data__;return nR(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Ti(r,e){var t=uE(r,e);return XE(t)?t:void 0}function tR(r){var e=rt.call(r,yr),t=r[yr];try{r[yr]=void 0;var i=!0}catch{}var n=Tb.call(r);return i&&(e?r[yr]=t:delete r[yr]),n}var rR=ub?function(r){return r==null?[]:(r=Object(r),nE(ub(r),function(e){return Ab.call(r,e)}))}:mR,Ut=Ps;(Wc&&Ut(new Wc(new ArrayBuffer(1)))!=Sd||ks&&Ut(new ks)!=bd||Gc&&Ut(Gc.resolve())!=ib||Vc&&Ut(new Vc)!=kd||zc&&Ut(new zc)!=jc)&&(Ut=function(r){var e=Ps(r),t=e==xi?r.constructor:void 0,i=t?Sr(t):"";if(i)switch(i){case kE:return Sd;case SE:return bd;case CE:return ib;case PE:return kd;case wE:return jc}return e});function iR(r,e){return e=e??hb,!!e&&(typeof r=="number"||rE.test(r))&&r>-1&&r%1==0&&r<e}function nR(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function sR(r){return!!ab&&ab in r}function oR(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||xd;return r===t}function aR(r){return Tb.call(r)}function Sr(r){if(r!=null){try{return Fb.call(r)}catch{}try{return r+""}catch{}}return""}function Ob(r,e){return r===e||r!==r&&e!==e}var dR=mb(function(){return arguments}())?mb:function(r){return Cs(r)&&rt.call(r,"callee")&&!Ab.call(r,"callee")},wd=Array.isArray;function lR(r){return r!=null&&Mb(r.length)&&!Bb(r)}var Jc=yE||pR;function uR(r,e){return Eb(r,e)}function Bb(r){if(!Ub(r))return!1;var e=Ps(r);return e==bb||e==HA||e==_A||e==jA}function Mb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=hb}function Ub(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function Cs(r){return r!=null&&typeof r=="object"}var Lb=ob?dE(ob):ZE;function cR(r){return lR(r)?JE(r):QE(r)}function mR(){return[]}function pR(){return!1}Fi.exports=uR});var wS=f(Jd=>{"use strict";Jd.byteLength=qR;Jd.toByteArray=WR;Jd.fromByteArray=zR;var st=[],_e=[],HR=typeof Uint8Array<"u"?Uint8Array:Array,xm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Dr=0,CS=xm.length;Dr<CS;++Dr)st[Dr]=xm[Dr],_e[xm.charCodeAt(Dr)]=Dr;var Dr,CS;_e[45]=62;_e[95]=63;function PS(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function qR(r){var e=PS(r),t=e[0],i=e[1];return(t+i)*3/4-i}function jR(r,e,t){return(e+t)*3/4-t}function WR(r){var e,t=PS(r),i=t[0],n=t[1],o=new HR(jR(r,i,n)),a=0,c=n>0?i-4:i,p;for(p=0;p<c;p+=4)e=_e[r.charCodeAt(p)]<<18|_e[r.charCodeAt(p+1)]<<12|_e[r.charCodeAt(p+2)]<<6|_e[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=_e[r.charCodeAt(p)]<<2|_e[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=_e[r.charCodeAt(p)]<<10|_e[r.charCodeAt(p+1)]<<4|_e[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function GR(r){return st[r>>18&63]+st[r>>12&63]+st[r>>6&63]+st[r&63]}function VR(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(GR(i));return n.join("")}function zR(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,c=t-i;a<c;a+=o)n.push(VR(r,a,a+o>c?c:a+o));return i===1?(e=r[t-1],n.push(st[e>>2]+st[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(st[e>>10]+st[e>>4&63]+st[e<<2&63]+"=")),n.join("")}});var Uq=Ln(Bv(),1);function v(r,e){if(r==null)throw Error(e??"Expected nonnullish value.")}function mr(r,e){if(!r)throw Error(e)}var se;(function(r){r.COMMENT="t1_",r.ACCOUNT="t2_",r.LINK="t3_",r.MESSAGE="t4_",r.SUBREDDIT="t5_",r.AWARD="t6_"})(se||(se={}));function xt(r){return r.startsWith(se.COMMENT)}function ed(r){return r.startsWith(se.ACCOUNT)}function pr(r){return r.startsWith(se.LINK)}function Mv(r){return r.startsWith(se.MESSAGE)}function Uv(r){return r.startsWith(se.SUBREDDIT)}function Lv(r){return r.startsWith(se.AWARD)}function iT(r){mr(xt(r),`Expected comment id to start with ${se.COMMENT}, got ${r}}`)}function nT(r){mr(ed(r),`Expected account id to start with ${se.ACCOUNT}, got ${r}}`)}function sT(r){mr(pr(r),`Expected link id to start with ${se.LINK}, got ${r}}`)}function oT(r){mr(Mv(r),`Expected message id to start with ${se.MESSAGE}, got ${r}}`)}function aT(r){mr(Uv(r),`Expected subreddit id to start with ${se.SUBREDDIT}, got ${r}}`)}function dT(r){mr(Lv(r),`Expected award id to start with ${se.AWARD}, got ${r}}`)}function ni(r){return iT(r),r}function oe(r){return nT(r),r}function ve(r){return sT(r),r}function lT(r){return oT(r),r}function ie(r){return aT(r),r}function uT(r){return dT(r),r}function Re(r){if(xt(r))return ni(r);if(ed(r))return oe(r);if(pr(r))return ve(r);if(Mv(r))return lT(r);if(Uv(r))return ie(r);if(Lv(r))return uT(r);throw new Error(`Expected thing id to start with ${Object.values(se).join(", ")} got ${r}}`)}function lc(r){return xt(r)}import*as P from"@devvit/protos";var td=class{constructor(e){}};var uc=(t=>(t.Installation="installation",t.App="app",t))(uc||{});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)}cT(r)}function cT(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 Ft=Object.freeze({INTERVAL:0,FORM:1,STATE:2,CHANNEL:3});var UM=["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","caret-updown","planet","telescope"];import{AppSettingsDefinition as xT,GetFieldsResponse as FT}from"@devvit/protos";import{FormFieldType as Oe}from"@devvit/protos";function mt(r){return r.map(e=>{switch(e.type){case"string":return mT(e);case"image":return pT(e);case"paragraph":return gT(e);case"number":return hT(e);case"select":return fT(e);case"boolean":return vT(e);case"group":return yT(e);default:throw new Error("Unknown field type.")}})}function mT(r){return{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 pT(r){return{disabled:r.disabled,fieldId:r.name,fieldType:Oe.IMAGE,helpText:r.helpText,label:r.label,required:r.required}}function gT(r){return{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 hT(r){return{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 fT(r){return{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 vT(r){return{defaultValue:{fieldType:Oe.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Oe.BOOLEAN,helpText:r.helpText,label:r.label}}function yT(r){return{fieldId:"",fieldType:Oe.GROUP,fieldConfig:{groupConfig:{fields:mt(r.fields)}},label:r.label,helpText:r.helpText}}function L(r,e){u.prototype[r]=e}import{ValidateFormResponse as IT}from"@devvit/protos";import{RealtimeSubscriptionStatus as Nv}from"@devvit/protos";var B=Object.freeze({Actor:"devvit-actor",App:"devvit-app",AppUser:"devvit-app-user",AppViewerAuthToken:"devvit-app-viewer-authorization",Caller:"devvit-caller",CallerPortID:"devvit-caller-port-id",Canary:"devvit-canary",Debug:"devvit-debug",GQLHost:"devvit-gql-host",Installation:"devvit-installation",ModPermissions:"devvit-mod-permissions",Post:"devvit-post",PostAuthor:"devvit-post-author",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",Username:"devvit-user-name",UserAgent:"devvit-user-agent",Version:"devvit-version",Language:"devvit-accept-language",Timezone:"devvit-accept-timezone",AppDependencies:"devvit-app-dependencies"}),Dv;(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",r.WebView="webView"})(Dv||(Dv={}));function _v(r){function e(t){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=r.metadata[B.App]?.values[0];v(c,"useChannel - app is missing from Context");let p=r.metadata[B.Installation]?.values[0];v(p,"useChannel - installation is missing from Context");async function g(I){let U=o[n].channel;if(o[n].active)if(o[n].connected)await r.realtime.send(U,I);else throw Error(`Failed to send to channel '${U}'; it is active but not yet connected`);else throw Error(`Cannot send a message over inactive channel: ${U}`)}function h(){if(!o[n].active){let I=o[n].channel;o[n].active=!0,r.addRealtimeChannel(I)}}function m(){if(o[n].active){let I=o[n].channel;o[n].active=!1,r.removeRealtimeChannel(I)}}function y(I){return async()=>{let U;switch(I.status){case Nv.REALTIME_SUBSCRIBED:o[n].connected=!0,U=t.onSubscribed?.();break;case Nv.REALTIME_UNSUBSCRIBED:o[n].connected=!1,U=t.onUnsubscribed?.();break;default:U=t.onMessage(I.event?.data?.msg);break}await U}}let b={channel:`${c}:${p}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:Ft.CHANNEL};n in o?b=o[n]:n in a&&(b=a[n]);let C=r.realtimeEvent;r.isInitialRender?b.active=!1:C&&b.active&&C.event.channel===b.channel&&(b.preventCallback||r.runHook(y(C)),r.rerenderIn(0)),o[n]=b,r.currentHookIndex++;let x=0;return b.active&&b.connected?x=2:b.active&&!b.connected?x=1:!b.active&&b.connected?x=3:!b.active&&!b.connected&&(x=4),{subscribe:h,unsubscribe:m,send:g,status:x}}return e}import{FormFieldType as si}from"@devvit/protos";function cc(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=cc(r[t]);return i!==void 0&&(e[t]=i),e},{})}function Hv(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:Ft.FORM};n in a?g=a[n]:n in c&&(g=c[n]),a[n]=g,r.forms.set(p,t);let h=r.formSubmittedEvent;return h&&!g.preventSubmit&&h.formId===p&&r.runHook(async()=>{let m=i(Tt(h.results));m&&m instanceof Promise&&await m,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function qv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=100,p=Math.max(c,i),g={lastRun:void 0,running:!1,preventCallback:!1,type:Ft.INTERVAL};n in o?g=o[n]:n in a&&(g=a[n]);function h(){i<c&&console.error(`useInterval delay must be at least ${c}ms. Your interval of ${i}ms was automatically extended.`);for(let[y,b]of Object.entries(o))if(y!==n.toString()&&b?.type===Ft.INTERVAL&&b?.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:Ft.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 y=t();y&&y instanceof Promise&&await y,g.lastRun=Date.now()}),r.rerenderIn(p)),g.preventCallback=!1,o[n]=g,r.currentHookIndex++,{start:h,stop:m}}return e}function jv(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 hc={now(){return new Date}};function Wv(r){return`__autocache__${r}`}function Gv(r){return`__lock__${r}`}var kT=300,ST=1e3,rd=5e3,mc=3,Vv=.1,zv=1e3,CT=3e4;function Jv(r){if(r.error)throw new Error(r.error);return r.value}var At,Et,Be,oi,$,$v,Kv,Xv,pc,Zv,Qv,gc,Yv,id=class{constructor(e,t,i=hc){l(this,$);l(this,At);l(this,Et,{});l(this,Be);l(this,oi);d(this,At,e),d(this,oi,t),d(this,Be,i)}async cache(e,t){d(this,Et,s(this,oi).__cache=s(this,oi).__cache??{}),S(this,$,Yv).call(this,t);let i=S(this,$,$v).call(this,t.key);if(i!==void 0)return i;let n=await S(this,$,gc).call(this,t.key),o=await S(this,$,Kv).call(this,t,n,e);return Jv(o)}};At=new WeakMap,Et=new WeakMap,Be=new WeakMap,oi=new WeakMap,$=new WeakSet,$v=function(e){let t=s(this,Et)[e];if(t){let i=s(this,Be).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<mc&&Math.random()<Vv&&t.errorTime+zv<i;if(t?.expires&&t.expires<i&&t.checkedAt+zv<i||n){delete s(this,Et)[e];return}else return Jv(t)}},Kv=async function(e,t,i){let n=t?.expires,o=n?S(this,$,Qv).call(this,n):1;return!t||t?.error&&t.errorCount<mc&&Vv>Math.random()||o>Math.random()?S(this,$,Xv).call(this,e,t,i):t},Xv=async function(e,t,i){let n=Gv(e.key),o=s(this,Be).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,At).set(n,"1",{expiration:a,nx:!0}))return S(this,$,Zv).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Be).now();return S(this,$,pc).call(this,p,e.key,e.ttl)}},pc=async function(e,t,i){let n=Math.min(i,ST),o=await S(this,$,gc).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,kT)),S(this,$,pc).call(this,e,t,i)},Zv=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,Et)[e]=t,await s(this,At).set(Wv(e),JSON.stringify(t),{expiration:new Date(o+CT)}),t.error&&t.errorCount<mc&&await s(this,At).del(Gv(e)),t},Qv=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},gc=async function(e){let t=await s(this,At).get(Wv(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Be).now().getTime(),s(this,Et)[e]=i,i}},Yv=function(e){e.ttl<rd&&(console.warn(`Cache TTL cannot be less than ${rd} milliseconds! Updating ttl value of ${e.ttl} to ${rd}.`),e.ttl=rd)};function ey(r,e,t=hc){let i=new id(r,e,t);return i.cache.bind(i)}function ty(r){new URL(r.slice(0,r.indexOf(",")))}var ai,di,ui,ry,iy,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,ry).call(this,e,t??{webView:!1}):S(this,ui,iy).call(this,e,t??{webView:!1})}};ai=new WeakMap,di=new WeakMap,ui=new WeakSet,ry=function(e,t){let i=t.webView?s(this,di)[e]:s(this,ai)[e];if(i)return i;try{return ty(e),encodeURI(e)}catch{return""}},iy=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{ty(a),i[a]=encodeURI(a)}catch{n.push(a)}else n=e;if(n.length>0)throw new Error(`The following assets were missing from the assets list: ${n.join(", ")}`);return i};var Rt,ci=class{constructor(e){l(this,Rt);d(this,Rt,e)}async get(e){let{messages:t}=await u.kvStorePlugin.Get({keys:[e]},s(this,Rt));try{if(t[e])return JSON.parse(t[e])}catch{return}}async put(e,t){let i={};i[e]=JSON.stringify(t),await u.kvStorePlugin.Put({messages:i},s(this,Rt))}async delete(e){await u.kvStorePlugin.Del({keys:[e]},s(this,Rt))}async list(){let{keys:e}=await u.kvStorePlugin.List({filter:"*"},s(this,Rt));return e}};Rt=new WeakMap;var ns,mi=class{constructor(e){l(this,ns);d(this,ns,e)}async upload(e){let t=await u.mediaPlugin.Upload(e,s(this,ns));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};ns=new WeakMap;var ss,pi=class{constructor(e){l(this,ss);d(this,ss,e)}async add(e){await u.modLogPlugin.Add(e,s(this,ss))}};ss=new WeakMap;var os,gi=class{constructor(e){l(this,os);d(this,os,e)}async send(e,t){await u.realtimePlugin.Send({channel:e,data:{msg:t}},s(this,os))}};os=new WeakMap;var k,as,ds,ls,hi=class{constructor(e){l(this,k);l(this,as);l(this,ds);l(this,ls);d(this,k,e),d(this,as,new sd(e))}get modMail(){return s(this,as)}getSubredditById(e){return ye.getById(Re(e),s(this,k))}getSubredditInfoById(e){return oy(e,s(this,k))}getSubredditByName(e){return ye.getByName(e,s(this,k))}getSubredditInfoByName(e){return ay(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(Re(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 w.getById(Re(e),s(this,k))}getUserByUsername(e){return w.getByUsername(e,s(this,k))}async getCurrentUsername(){return s(this,ls)??d(this,ls,ny(s(this,k))),s(this,ls)}async getCurrentUser(){return s(this,ds)??d(this,ds,this.getCurrentUsername().then(e=>e?w.getByUsername(e,s(this,k)):void 0)),s(this,ds)}getAppUser(){return w.getFromMetadata(B.AppUser,s(this,k))}getSnoovatarUrl(e){return w.getSnoovatarUrl(e,s(this,k))}getCommentById(e){return te.getById(Re(e),s(this,k))}getComments(e){return te.getComments(e,s(this,k))}getCommentsByUser(e){return te.getCommentsByUser(e,s(this,k))}submitComment(e){return te.submit({...e,id:Re(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 w.getOverview(e,s(this,k))}getModerationLog(e){return nd(e,s(this,k))}getApprovedUsers(e){return w.getSubredditUsersByType({type:"contributors",...e},s(this,k))}approveUser(e,t){return w.createRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}removeUser(e,t){return w.removeRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}getWikiContributors(e){return w.getSubredditUsersByType({type:"wikicontributors",...e},s(this,k))}addWikiContributor(e,t){return w.createRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}removeWikiContributor(e,t){return w.removeRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}getBannedUsers(e){return w.getSubredditUsersByType({type:"banned",...e},s(this,k))}banUser(e){return w.createRelationship({username:e.username,subredditName:e.subredditName,type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration,banContext:e.context},s(this,k))}unbanUser(e,t){return w.removeRelationship({username:e,subredditName:t,type:"banned"},s(this,k))}getBannedWikiContributors(e){return w.getSubredditUsersByType({type:"wikibanned",...e},s(this,k))}banWikiContributor(e){return w.createRelationship({...e,type:"wikibanned"},s(this,k))}unbanWikiContributor(e,t){return w.removeRelationship({username:e,subredditName:t,type:"wikibanned"},s(this,k))}getModerators(e){return w.getSubredditUsersByType({type:"moderators",...e},s(this,k))}inviteModerator(e){return w.createRelationship({type:"moderator_invite",subredditName:e.subredditName,username:e.username,permissions:e.permissions??[]},s(this,k))}revokeModeratorInvite(e,t){return w.removeRelationship({username:e,subredditName:t,type:"moderator_invite"},s(this,k))}removeModerator(e,t){return w.removeRelationship({type:"moderator",subredditName:t,username:e},s(this,k))}setModeratorPermissions(e,t,i){return w.setModeratorPermissions(e,t,i,s(this,k))}getMutedUsers(e){return w.getSubredditUsersByType({type:"muted",...e},s(this,k))}muteUser(e){return w.createRelationship({...e,type:"muted"},s(this,k))}unmuteUser(e,t){return w.removeRelationship({username:e,subredditName:t,type:"muted"},s(this,k))}getModNotes(e){return Me.get(e,s(this,k))}deleteModNote(e){return Me.delete(e,s(this,k))}addModNote(e){let t={...e,redditId:e.redditId?Re(e.redditId):void 0};return Me.add(t,s(this,k))}addRemovalNote(e){return Me.addRemovalNote(e,s(this,k))}async sendPrivateMessage(e){return hr.send(e,s(this,k))}async sendPrivateMessageAsSubreddit(e){return hr.sendAsSubreddit(e,s(this,k))}async approve(e){if(xt(e))return te.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 te.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 ue.getPostFlairTemplates(e,s(this,k))}async getUserFlairTemplates(e){return ue.getUserFlairTemplates(e,s(this,k))}async createPostFlairTemplate(e){return ue.createPostFlairTemplate(e,s(this,k))}async createUserFlairTemplate(e){return ue.createUserFlairTemplate(e,s(this,k))}async editFlairTemplate(e){return ue.editFlairTemplate(e,s(this,k))}async deleteFlairTemplate(e,t){return ue.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,ve(t),s(this,k))}async getWidgets(e){return ae.getWidgets(e,s(this,k))}async deleteWidget(e,t){return ae.delete(e,t,s(this,k))}async addWidget(e){return ae.add(e,s(this,k))}async reorderWidgets(e,t){return ae.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 hr.getMessages(e,s(this,k))}markAllMessagesAsRead(){return hr.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 uy(e,s(this,k))}getVaultByUserId(e){return cy(Re(e),s(this,k))}getSubredditLeaderboard(e){return dy(e,s(this,k))}getSubredditStyles(e){return ly(e,s(this,k))}async subscribeToCurrentSubreddit(){let e=await this.getCurrentSubreddit();await u.redditAPIPlugins.Subreddits.Subscribe({action:"sub",actionSource:"",srName:e.name,sr:"",skipInitialDefaults:!0},s(this,k))}async unsubscribeFromCurrentSubreddit(){let e=await this.getCurrentSubreddit();await u.redditAPIPlugins.Subreddits.Subscribe({action:"unsub",actionSource:"",srName:e.name,sr:"",skipInitialDefaults:!1},s(this,k))}};k=new WeakMap,as=new WeakMap,ds=new WeakMap,ls=new WeakMap;import{RedisKeyScope as fc}from"@devvit/protos";function od(r){return r&&typeof r=="object"&&"message"in r&&r.message!==void 0&&typeof r.message=="string"?r.message.includes("redis: nil"):!1}var A,E,R,vc=class{constructor(e,t,i){l(this,A);l(this,E);l(this,R);d(this,A,e),d(this,E,t),d(this,R,i)}async get(e){return await s(this,A).Get({key:e,transactionId:s(this,E)},s(this,R)),this}async multi(){await s(this,A).Multi(s(this,E),s(this,R))}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,A).Set({key:e,value:t,nx:i?.nx===!0,xx:i?.xx===!0,expiration:n||0,transactionId:s(this,E)},s(this,R)),this}async del(...e){return await s(this,A).Del({keys:e,transactionId:s(this,E)},s(this,R)),this}async type(e){return await s(this,A).Type({key:e,transactionId:s(this,E)},s(this,R)),this}async exec(){let e=await s(this,A).Exec(s(this,E),s(this,R)),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):i.dbl!==void 0&&t.push(i.dbl);return t}async discard(){await s(this,A).Discard(s(this,E),s(this,R))}async watch(...e){return await s(this,A).Watch({keys:e,transactionId:s(this,E)},s(this,R)),this}async unwatch(){return await s(this,A).Unwatch(s(this,E),s(this,R)),this}async getRange(e,t,i){return await s(this,A).GetRange({key:e,start:t,end:i,transactionId:s(this,E)},s(this,R)),this}async setRange(e,t,i){return await s(this,A).SetRange({key:e,offset:t,value:i,transactionId:s(this,E)},s(this,R)),this}async strlen(e){return this.strLen(e)}async strLen(e){return await s(this,A).Strlen({key:e,transactionId:s(this,E)},s(this,R)),this}async mget(e){return this.mGet(e)}async mGet(e){return await s(this,A).MGet({keys:e,transactionId:s(this,E)},s(this,R)),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,A).MSet({kv:t,transactionId:s(this,E)},s(this,R)),this}async incrBy(e,t){return await s(this,A).IncrBy({key:e,value:t,transactionId:s(this,E)},s(this,R)),this}async expire(e,t){return await s(this,A).Expire({key:e,seconds:t,transactionId:s(this,E)},s(this,R)),this}async expireTime(e){return await s(this,A).ExpireTime({key:e,transactionId:s(this,E)},s(this,R)),this}async zAdd(e,...t){return await s(this,A).ZAdd({key:e,members:t,transactionId:s(this,E)},s(this,R)),this}async zScore(e,t){return await s(this,A).ZScore({key:{key:e,transactionId:s(this,E)},member:t},s(this,R)),this}async zRank(e,t){return await s(this,A).ZRank({key:{key:e,transactionId:s(this,E)},member:t},s(this,R)),this}async zIncrBy(e,t,i){return await s(this,A).ZIncrBy({key:e,member:t,value:i,transactionId:s(this,E)},s(this,R)),this}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,E)};return await s(this,A).ZScan(o,s(this,R)),this}async zCard(e){return await s(this,A).ZCard({key:e,transactionId:s(this,E)},s(this,R)),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,A).ZRange({key:{key:e,transactionId:s(this,E)},start:t+"",stop:i+"",...o},s(this,R)),this}async zRem(e,t){return await s(this,A).ZRem({key:{key:e,transactionId:s(this,E)},members:t},s(this,R)),this}async zRemRangeByLex(e,t,i){return await s(this,A).ZRemRangeByLex({key:{key:e,transactionId:s(this,E)},min:t,max:i},s(this,R)),this}async zRemRangeByRank(e,t,i){return await s(this,A).ZRemRangeByRank({key:{key:e,transactionId:s(this,E)},start:t,stop:i},s(this,R)),this}async zRemRangeByScore(e,t,i){return await s(this,A).ZRemRangeByScore({key:{key:e,transactionId:s(this,E)},min:t,max:i},s(this,R)),this}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){return await s(this,A).HGetAll({key:e,transactionId:s(this,E)},s(this,R)),this}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){return await s(this,A).HGet({key:e,field:t,transactionId:s(this,E)},s(this,R)),this}async hMGet(e,t){return await s(this,A).HMGet({key:e,fields:t,transactionId:s(this,E)},s(this,R)),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,A).HSet({key:e,fv:i,transactionId:s(this,E)},s(this,R)),this}async hincrby(e,t,i){return this.hIncrBy(e,t,i)}async hIncrBy(e,t,i){return await s(this,A).HIncrBy({key:e,field:t,value:i,transactionId:s(this,E)},s(this,R)),this}async hdel(e,t){return this.hDel(e,t)}async hDel(e,t){return await s(this,A).HDel({key:e,fields:t,transactionId:s(this,E)},s(this,R)),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,E)};return await s(this,A).HScan(o,s(this,R)),this}async hkeys(e){return this.hKeys(e)}async hKeys(e){return await s(this,A).HKeys({key:e,transactionId:s(this,E)},s(this,R)),this}async hlen(e){return this.hLen(e)}async hLen(e){return await s(this,A).HLen({key:e,transactionId:s(this,E)},s(this,R)),this}};A=new WeakMap,E=new WeakMap,R=new WeakMap;var M,fi,yc=class yc{constructor(e,t=void 0,i=fc.INSTALLATION){l(this,M);l(this,fi);d(this,M,e),d(this,fi,t),this.scope=i,this.global=i===fc.INSTALLATION?new yc(s(this,M),s(this,fi),fc.GLOBAL):this}get storage(){return s(this,fi)||u.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,M));return new vc(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(od(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(od(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(od(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(od(i))return;throw i}}async hMGet(e,t){let i=await this.storage.HMGet({key:e,fields:t,scope:this.scope},s(this,M));return i!==null?i.values.map(n=>n||null):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,fi=new WeakMap;var vi=yc;var fr,yi=class{constructor(e){l(this,fr);d(this,fr,e)}async runJob(e){return(await u.schedulerPlugin.Schedule({action:{type:e.name,data:e.data},cron:"cron"in e?e.cron:void 0,when:"runAt"in e?e.runAt:void 0},s(this,fr))).id}async cancelJob(e){await u.schedulerPlugin.Cancel({id:e},s(this,fr))}async listJobs(){return(await u.schedulerPlugin.List({after:new Date(0),before:new Date(Date.now()+31536e7)},s(this,fr))).actions.map(t=>(v(t.request?.action,"Scheduled job is malformed"),"when"in t.request&&t.request.when!=null?{id:t.id,name:t.request.action.type,runAt:t.request.when,data:t.request.action.data}:{id:t.id,name:t.request.action.type,cron:t.request.cron??"",data:t.request.action}))}};fr=new WeakMap;var us,bi=class{constructor(e){l(this,us);d(this,us,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await u.settingsPlugin.GetSettings({},s(this,us));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...my(t.installationSettings.settings,u.installationSettings),...my(t.appSettings.settings,u.appSettings)}}};us=new WeakMap;function my(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=cc(r[n]),i),{});return e&&py(t,e),t}function py(r,e){for(let t of e)t.type==="group"?py(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as ad,ToastAppearance as gy}from"@devvit/protos";var Ot,ki,cs,ld,dd=class{constructor(e){l(this,Ot,[]);l(this,ki);l(this,cs);l(this,ld,(e,t)=>{let i=t!==void 0?e:"",n=t!==void 0?t:e;s(this,Ot).push({type:ad.EFFECT_WEB_VIEW,webView:{postMessage:{webViewId:i,app:{message:n}}}})});d(this,ki,e),d(this,cs,{postMessage:s(this,ld)})}get webView(){return s(this,cs)}showForm(e,t){let i=u.formDefinitions.get(e);if(!i&&s(this,ki)){let a=s(this,ki).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={fields:[],id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description};gr(n.fields),o.fields=mt(n.fields),s(this,Ot).push({type:ad.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?gy.SUCCESS:gy.NEUTRAL}:t={text:e},s(this,Ot).push({type:ad.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,Ot).push({type:ad.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,Ot)}};Ot=new WeakMap,ki=new WeakMap,cs=new WeakMap,ld=new WeakMap;function Le({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new pi(r),o=new ci(r),a=new vi(r),c=ey(a,i?i.state:{}),p=new hi(r),g=new yi(r),h=new bi(r),m=e?new dd(i):void 0,y=new mi(r),b=new li,C=new gi(r),x=t&&i?jv(i):void 0,I=t&&i?qv(i):void 0,U=t&&i?Hv(i):void 0,Pe=t&&i?_v(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:g,settings:h,media:y,assets:b,realtime:C,get useForm(){return U??(()=>{throw new Error("useForm() is unavailable")})},get cache(){return c??(()=>{throw new Error("cache() is unavailable")})},get useState(){return x??(()=>{throw new Error("useState() is unavailable")})},get useInterval(){return I??(()=>{throw new Error("useInterval() is unavailable")})},get useChannel(){return Pe??(()=>{throw new Error("useChannel() is unavailable")})},get ui(){if(!m)throw new Error("ui client is not available");return m}}}var hy={name:"@devvit/public-api",version:"0.11.6-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.6-dev","@devvit/shared-types":"0.11.6-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/repo-tools":"0.11.6-dev","@devvit/tsconfig":"0.11.6-dev","@microsoft/api-extractor":"7.41.0","@reddit/faceplate-ui":"18.0.1","@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:"9.11.1",typescript:"5.3.2",vitest:"1.6.0"},publishConfig:{directory:"dist"},filesize:{"dist/public-api.min.js":{gzip:"80 KB",none:"260 KB"}},source:"./src/index.ts"};function ce(r,e,t){let i=r[B.Subreddit]?.values[0];v(i,"subreddit is missing from Context");let n=r[B.SubredditName]?.values[0],o=r[B.AppUser]?.values[0],a=r[B.App]?.values[0],c=r[B.Version]?.values[0],p=r[B.User]?.values[0],g=wT(r);return{get appAccountId(){return v(o,"appAccountId is missing from Context"),o},subredditId:i,subredditName:n,userId:p,postId:e,commentId:t,appName:a,appVersion:c,debug:g,toJSON(){return{appAccountId:o,appName:a,appVersion:c,subredditId:i,subredditName:n,userId:p,postId:e,commentId:t,debug:g}}}}function wT(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,webView:void 0},t={};for(let n in e)t[n.toLowerCase()]=n;let i={};for(let n of(r[B.Debug]?.values??[]).join().split(",")){let[o,a]=n.split("=");o&&(o=o.trim(),a=a?.trim(),o.toLowerCase()in t&&(o=t[o.toLowerCase()]),i[o]??(i[o]=a||"true"))}return r[B.Debug]&&console.info(`[api] @devvit/public-api v${hy.version} ${Object.entries(i).map(([n,o])=>`${n}=${o}`).join(" ")}`),{...i,metadata:r}}function fy(r){return r.flatMap(e=>e.type==="group"?fy(e.fields):e)}async function ud(r,e,t){if(!e)throw new Error("Settings were not defined.");let i={success:!0,errors:{}},n=Tt(r.fieldValues),o=fy(e);return await Promise.all(o.map(async a=>{let c=a.name;if(c&&a.onValidate){let p=n[c],g=a.onValidate,h=Object.assign(Le({metadata:t}),ce(t)),m=await g({value:p,isEditing:r.editing},h);m&&(i.success=!1,i.errors[c]=m)}})),IT.fromJSON(i)}async function TT(){if(!u.appSettings)throw new Error("App settings were not defined.");return FT.fromJSON({fields:{fields:mt(u.appSettings)}})}async function AT(r,e){return ud(r,u.appSettings,e)}function vy(r){r.provides(xT),L("GetAppSettingsFields",TT),L("ValidateAppForm",AT)}import{CustomPostDefinition as LT,RenderPostResponse as DT}from"@devvit/protos";import{BlockRenderEventType as Oc,EffectType as Oy}from"@devvit/protos";function Si(r){return r.__effects}function yy(){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 Rc,BlockAvatarBackground as Ty,BlockAvatarFacing as Ay,BlockAvatarSize as Bt,BlockBorderWidth as gd,BlockButtonAppearance as Mt,BlockButtonSize as Pc,BlockGap as hd,BlockHorizontalAlignment as wc,BlockIconSize as fd,BlockImageResizeMode as ms,BlockPadding as ps,BlockRadius as gs,BlockSpacerShape as Ic,BlockSpacerSize as vd,BlockStackDirection as xc,BlockTextOutline as Fc,BlockTextOverflow as Tc,BlockTextSize as Pi,BlockTextStyle as Ac,BlockTextWeight as Ey,BlockType as tt,BlockVerticalAlignment as Ec}from"@devvit/protos";var bc={"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 by={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"},ky=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),Sy=r=>r in bc,kc=r=>r in by,Cy=r=>!!r.match(/^rgba?\(.*/),Py=r=>!!r.match(/^hsla?\(.*/),wy=(r,e="light")=>{if(kc(r))return cd(r);let i=bc[r];return typeof i=="string"?i:i[e]},cd=r=>by[r]??r,Iy=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 md}from"@devvit/protos";var Sc={stackParentLayout:{hasHeight:!0,hasWidth:!0,direction:md.UNRECOGNIZED,alignment:void 0}};function Fy(r,e,t){if(!e)return{hasHeight:!1,hasWidth:!1};let{growDirection:i,stretchDirection:n}=ET(r?.grow,e.direction,e.alignment),o=t?.height?.value?.value||t?.height?.min?.value||xy(2,i,n,e.hasHeight),a=t?.width?.value?.value||t?.width?.min?.value||xy(1,i,n,e.hasWidth);return{hasHeight:!!o,hasWidth:!!a}}function xy(r,e,t,i){return e===r&&i||t===r&&i}function ET(r,e,t){let i=e===md.STACK_VERTICAL||e===md.UNRECOGNIZED,n=e===md.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 vr,BlockStackDirection as pd}from"@devvit/protos";function Ci(r){if(r==null)return;if(typeof r=="number")return{value:r,unit:vr.SIZE_UNIT_PERCENT};let e=r.match(/^(\d+(?:\.\d+)?)(px|%)?$/);if(e==null)return;let t=vr.SIZE_UNIT_PERCENT;return e.at(2)==="px"&&(t=vr.SIZE_UNIT_PIXELS),{value:Number.parseFloat(e[1]),unit:t}}function RT(r,e){return(r.width?.value?.unit===vr.SIZE_UNIT_PERCENT||r.width?.min?.unit===vr.SIZE_UNIT_PERCENT)&&(e.direction===pd.STACK_HORIZONTAL||e.direction===pd.STACK_DEPTH)&&(e.hasWidth||(r.width=void 0)),(r.height?.value?.unit===vr.SIZE_UNIT_PERCENT||r.height?.min?.unit===vr.SIZE_UNIT_PERCENT)&&(e.direction===pd.STACK_VERTICAL||e.direction===pd.STACK_DEPTH)&&(e.hasHeight||(r.height=void 0)),r}function Cc(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=RT(n,e.stackParentLayout)),n}}}var Ry="data-",OT=new Set(["onPress","onMessage"]),BT=new Map([["onPress",Rc.ACTION_CLICK],["onMessage",Rc.ACTION_WEBVIEW]]),hs,wi=class{constructor(e=()=>{}){l(this,hs);d(this,hs,e)}createBlocksElementOrThrow({type:e,props:t,children:i}){let n=this.createBlocksElement({type:e,props:t,children:i},Sc);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"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 ps.PADDING_NONE;case"xsmall":return ps.PADDING_XSMALL;case"small":return ps.PADDING_SMALL;case"medium":return ps.PADDING_MEDIUM;case"large":return ps.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return gs.RADIUS_NONE;case"small":return gs.RADIUS_SMALL;case"medium":return gs.RADIUS_MEDIUM;case"large":return gs.RADIUS_LARGE;case"full":return gs.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return hd.GAP_NONE;case"small":return hd.GAP_SMALL;case"medium":return hd.GAP_MEDIUM;case"large":return hd.GAP_LARGE}}makeBlockAlignment(e){if(e===void 0)return;let t,i;if(e.includes("top")?t=Ec.ALIGN_TOP:e.includes("middle")?t=Ec.ALIGN_MIDDLE:e.includes("bottom")&&(t=Ec.ALIGN_BOTTOM),e.includes("start")?i=wc.ALIGN_START:e.includes("center")?i=wc.ALIGN_CENTER:e.includes("end")&&(i=wc.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=gd.BORDER_WIDTH_NONE;break;case"thin":o=gd.BORDER_WIDTH_THIN;break;case"thick":o=gd.BORDER_WIDTH_THICK;break;default:o=gd.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 Pi.TEXT_SIZE_XSMALL;case"small":return Pi.TEXT_SIZE_SMALL;case"medium":return Pi.TEXT_SIZE_MEDIUM;case"large":return Pi.TEXT_SIZE_LARGE;case"xlarge":return Pi.TEXT_SIZE_XLARGE;case"xxlarge":return Pi.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return Ac.TEXT_STYLE_BODY;case"metadata":return Ac.TEXT_STYLE_METADATA;case"heading":return Ac.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return Fc.TEXT_OUTLINE_NONE;case"thin":return Fc.TEXT_OUTLINE_THIN;case"thick":return Fc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return Ey.TEXT_WEIGHT_REGULAR;case"bold":return Ey.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return Tc.TEXT_OVERFLOW_CLIP;case"ellipsis":return Tc.TEXT_OVERFLOW_ELLIPSE}return Tc.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 Pc.BUTTON_SIZE_SMALL;case"medium":return Pc.BUTTON_SIZE_MEDIUM;case"large":return Pc.BUTTON_SIZE_LARGE}}makeBlockImageResizeMode(e){switch(e){case"none":return ms.IMAGE_RESIZE_NONE;case"fit":return ms.IMAGE_RESIZE_FIT;case"fill":return ms.IMAGE_RESIZE_FILL;case"cover":return ms.IMAGE_RESIZE_COVER;case"scale-down":return ms.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return vd.SPACER_XSMALL;case"small":return vd.SPACER_SMALL;case"medium":return vd.SPACER_MEDIUM;case"large":return vd.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return Ic.SPACER_INVISIBLE;case"thin":return Ic.SPACER_THIN;case"square":return Ic.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return fd.ICON_SIZE_XSMALL;case"small":return fd.ICON_SIZE_SMALL;case"medium":return fd.ICON_SIZE_MEDIUM;case"large":return fd.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 Ay.AVATAR_FACING_LEFT;case"right":return Ay.AVATAR_FACING_RIGHT}}makeBlockAvatarBackground(e){switch(e){case"dark":return Ty.AVATAR_BG_DARK;case"light":return Ty.AVATAR_BG_LIGHT}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(Ry)).reduce((t,i)=>(t[i.substring(Ry.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);return OT.forEach(o=>{if(o in t){let a=t[o];i.push({type:BT.get(o)??Rc.UNRECOGNIZED,id:a.toString(),data:n})}}),i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),ky(e)?e:Sy(e)?wy(e,t):kc(e)?cd(e):Cy(e)?Iy(e):Py(e)?e:(console.warn(`Could not parse color: ${e}.`),cd("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,hs).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,Sc))}wrapRoot(e,t){return this.makeBlock(tt.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=Cc(t,i),p=Fy(t,i.stackParentLayout,c);return this.makeBlock(tt.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(xc.STACK_HORIZONTAL,e,t,i)}makeVStack(e,t,...i){return this.makeStackBlock(xc.STACK_VERTICAL,e,t,i)}makeZStack(e,t,...i){return this.makeStackBlock(xc.STACK_DEPTH,e,t,i)}makeText(e,t,...i){let n=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(tt.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(tt.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(tt.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(tt.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(tt.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(tt.BLOCK_AVATAR,e,t,{avatarConfig:{thingId:e.thingId,size:this.makeBlockAvatarSize(e.size),facing:this.makeBlockAvatarFacing(e.facing),background:this.makeBlockAvatarBackground(e.background)}})}makeWebView(e,t){return e&&this.makeBlock(tt.BLOCK_WEBVIEW,e,t,{webviewConfig:{url:this.resolveAssetUrl(e.url,{webView:!0}),state:e.state}})}makeBlock(e,t,i,n){return{type:e,sizes:Cc(t,i),config:n,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}ensureRootBlock(e){let t;if(e.type===tt.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}};hs=new WeakMap;function By(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var My=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+=My(i);return e+=`</${r.type}>`,e};function MT(r){return" ".repeat(r)}function UT(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+=MT(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 De,Uy,fs,Bc,vs,pt=class{constructor(e,t,i,n,o){l(this,De);this.renderState={};this.currentComponentKey=[];this.currentHookIndex=0;this.actions=new Map;this.forms=new Map;this.realtimeChannels=[];this.realtimeUpdated=!1;this.pendingHooks=[];this.isRendering=!1;this.transformer=new wi(()=>this.assets);this.effects=[];l(this,vs,!1);this.component=e,this.event=t,this.state={__renderState:{},...i},this.metadata=n,this.state.__realtimeChannels&&(this.realtimeChannels=this.state.__realtimeChannels);let a=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,De,fs).call(this),t={type:this.component,props:e,children:[]},i=await this.processBlock(t);if(By(i),this.transformer.createBlocksElementOrThrow(i),this.isUserActionRender&&this.blockRenderEventId){let n=this.actions.get(this.blockRenderEventId);n&&await n(this.event.data)}for(let n of this.pendingHooks)await n();this.buildNextState(),S(this,De,Uy).call(this)}async buildBlocksUI(){let e=S(this,De,fs).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 By(i),(u.debug.emitSnapshots||e.debug.emitSnapshots)&&console.debug(UT(My(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=yy(),i=[]){let n=e;if(typeof n.type=="string"){let c=[];for(let m=0;m<n.children.length;m++){let y=n.children[m];y!=null&&c.push(await this.processBlock(y,t,[...i,`${n.type}.${m}`]))}let p=c.flat(),g=S(this,De,Bc).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,De,fs).call(this),...n.props,children:p},h;for(;h===void 0;)try{h=await n.type(g,S(this,De,fs).call(this))}catch(m){if(m instanceof Promise)h=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 h=="object")return this.processBlock(h,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===Oc.RENDER_INITIAL:!1}get isUserActionRender(){return this.event?this.event.type===Oc.RENDER_USER_ACTION:!1}get isEffectRender(){return this.event?this.event.type===Oc.RENDER_EFFECT_EVENT:!1}get formSubmittedEvent(){return this.event?this.event.formSubmitted:!1}get blockRenderEventId(){return this.event?this.event.id:!1}get realtimeEvent(){if(!this.event)return!1;let e=this.event.realtimeEvent;return e?.event?.channel?e:!1}runHook(e){this.pendingHooks.push(e)}rerenderIn(e){s(this,vs)||(d(this,vs,!0),this.effects.push({type:Oy.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:Oy.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:this.realtimeChannels}}]:[]}getEffects(){return[...Si(this.ui),...this.effects,...this.realtimeEffect]}buildNextState(){for(let e of Object.keys(this.renderState))this.renderState[e]=Object.values(this.renderState[e]);this.state={__postData:this.state.__postData,__renderState:this.renderState,__cache:this.state.__cache,...this.realtimeChannels.length>0?{__realtimeChannels:this.realtimeChannels}:{}}}};De=new WeakSet,Uy=function(){this.actions.clear(),this.currentComponentKey=[],this.currentHookIndex=0,this.pendingHooks=[],this.realtimeChannels=[],this.realtimeUpdated=!1},fs=function(){let e={...ce(this.metadata,this.state.__postData?.thingId),modLog:this.modLog,reddit:this.reddit,cache:this.cache,kvStore:this.kvStore,redis:this.redis,settings:this.settings,scheduler:this.scheduler,media:this.media,assets:this.assets,realtime:this.realtime,ui:this.ui,dimensions:this.dimensions,uiEnvironment:{timezone:this.metadata[B.Timezone]?.values[0],locale:this.metadata[B.Language]?.values[0],dimensions:this.dimensions},...this.hooks};return e.debug.effects=this,e},Bc=function(e){let t=[];for(let i of e)typeof i=="string"?t.push(i):i.type==="__fragment"?t.push(...S(this,De,Bc).call(this,i.children)):t.push(i);return t},vs=new WeakMap;async function NT(r,e){let t=u.customPostType;if(!t)throw new Error("Custom post type not registered");let i=new pt((o,a)=>t.render(a),r.blocks,r.state,e,r.dimensions),n=await i.render();return DT.fromJSON({state:i.state,blocks:{ui:n},effects:i.getEffects()})}function Ly(r){r.provides(LT),L("RenderPost",NT)}import{GetFieldsResponse as _T,InstallationSettingsDefinition as HT}from"@devvit/protos";async function qT(){if(!u.installationSettings)throw new Error("Installation settings were not defined.");return _T.fromJSON({fields:{fields:mt(u.installationSettings)}})}async function jT(r,e){return ud(r,u.installationSettings,e)}function Dy(r){r.provides(HT),L("GetSettingsFields",qT),L("ValidateForm",jT)}import{ContextActionDefinition as WT,ContextActionList as GT,ContextActionResponse as VT}from"@devvit/protos";function Mc(r){let e=r.debug.metadata[B.User].values[0];if(!e)throw new Error("User missing from context");return e}function Uc(r){let e=r.debug.metadata[B.Subreddit].values[0];if(!e)throw new Error("Subreddit missing from context");return e}async function Ny(r,e){let t=Mc(r),i=Uc(r);if(!t||!i)throw new Error("User or subreddit missing from context");let n=e.comment?.id&&`t1_${e.comment.id}`,o=e.post?.id&&`t3_${e.post.id}`,a=e.subreddit?.id&&`t5_${e.subreddit.id}`,c=n||o||a;if(!c)throw new Error("targetId is missing from ContextActionRequest");if(n){let m=await r.reddit.getCommentById(n);if(!m)throw new Error(`Comment ${n} not found`);if(m.subredditId!==i)throw new Error("Comment does not belong to the subreddit")}if(o){let m=await r.reddit.getPostById(o);if(!m)throw new Error(`Post ${o} not found`);if(m.subredditId!==i)throw new Error("Post does not belong to the subreddit")}if(a&&a!==i)throw new Error(`Subreddit ${a} ${i} not found`);let p=ys(e.actionId);if(!p)throw new Error("Action not found");let g=!!p.forUserType?.includes("moderator");if(g&&!_y(r))throw new Error("User is not a moderator");let h={needsModCheck:g};await r.redis.set(`${t}${i}${c}${e.actionId}`,JSON.stringify(h)),await r.redis.expire(`${t}${i}${c}${e.actionId}`,600),console.debug("CSRF token added: "+JSON.stringify(h))}async function _y(r){let e=Mc(r),t=Uc(r),i=await r.reddit.getSubredditInfoById(t);return!!(await r.reddit.getModerators({subredditName:i.name}).all()).find(o=>o.id===e)}async function Hy(r,e){let t=Mc(r),i=Uc(r),{actionId:n,thingId:o}=e.state?.__contextAction??{},a=await r.redis.get(`${t}${i}${o}${n}`);if(!a)throw new Error("CSRF token not found");if(JSON.parse(a).needsModCheck&&!await _y(r))throw new Error("User is not a moderator: "+t+"; "+i);console.debug("CSRF token validated: "+a)}var qy=r=>`menuItem.${r}`;function ys(r){return u.menuItems.find((e,t)=>qy(t)===r)}async function zT(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"),moderator:n.forUserType?.includes("moderator")},postFilters:n.postFilter==="currentApp"?{currentApp:!0}:void 0}));return GT.fromJSON({actions:i})}async function JT(r,e){let t=ys(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;v(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}),ce(e,n,i),{uiEnvironment:{timezone:e[B.Timezone]?.values[0],locale:e[B.Language]?.values[0]}});return await Ny(p,r),await t.onPress(c,p),VT.fromJSON({effects:Si(p.ui)})}function jy(r){r.provides(WT),L("GetActions",zT),L("OnAction",JT)}function gt(r){return r?r===!0?!0:r.enabled:!1}import{SchedulerHandlerDefinition as $T}from"@devvit/protos";async function KT(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}),ce(e));await i(n,o)}function Wy(r){r.provides($T),L("HandleScheduledAction",KT)}import{OnAppInstallDefinition as XT,OnAppUpgradeDefinition as ZT,OnAutomoderatorFilterCommentDefinition as QT,OnAutomoderatorFilterPostDefinition as YT,OnCommentCreateDefinition as eA,OnCommentDeleteDefinition as tA,OnCommentReportDefinition as rA,OnCommentSubmitDefinition as iA,OnCommentUpdateDefinition as nA,OnModActionDefinition as sA,OnModMailDefinition as oA,OnPostCreateDefinition as aA,OnPostDeleteDefinition as dA,OnPostFlairUpdateDefinition as lA,OnPostNsfwUpdateDefinition as uA,OnPostReportDefinition as cA,OnPostSpoilerUpdateDefinition as mA,OnPostSubmitDefinition as pA,OnPostUpdateDefinition as gA}from"@devvit/protos";var Ii;(function(r){function e(a,c){return a.length<=c?a:`${a.slice(0,c-1)}\u2026`}r.ellipsize=e;function t(a){return a[0]==null?a:`${a[0].toLocaleUpperCase()}${a.slice(1)}`}r.capitalize=t;function i(a){return a==null||/^\s*$/.test(a)}r.isBlank=i;function n(a,c="stack"){return a instanceof Error?`${a[c]||a.stack||a.message||a.name}`:String(a)}r.caughtToString=n;function o(a,c="stack"){return a instanceof Error?`${a[c]||a.stack||a.message||a.name}`:String(a)}r.caughtToStringUntyped=o})(Ii||(Ii={}));function X(r,e){return v(e),async(t,i)=>{let n={...t,type:r},o=Object.assign(Le({metadata:i}),ce(i)),a=await Promise.allSettled(e.map(p=>p(n,o))),c=hA(a);if(c)throw c.err;return{}}}function Gy(r){for(let e of u.triggerOnEventHandlers.keys())switch(e){case"PostSubmit":r.provides(pA),L("OnPostSubmit",X("PostSubmit",u.triggerOnEventHandlers.get(e)));break;case"PostCreate":r.provides(aA),L("OnPostCreate",X("PostCreate",u.triggerOnEventHandlers.get(e)));break;case"PostUpdate":r.provides(gA),L("OnPostUpdate",X("PostUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostReport":r.provides(cA),L("OnPostReport",X("PostReport",u.triggerOnEventHandlers.get(e)));break;case"PostDelete":r.provides(dA),L("OnPostDelete",X("PostDelete",u.triggerOnEventHandlers.get(e)));break;case"PostFlairUpdate":r.provides(lA),L("OnPostFlairUpdate",X("PostFlairUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentSubmit":r.provides(iA),L("OnCommentSubmit",X("CommentSubmit",u.triggerOnEventHandlers.get(e)));break;case"CommentCreate":r.provides(eA),L("OnCommentCreate",X("CommentCreate",u.triggerOnEventHandlers.get(e)));break;case"CommentUpdate":r.provides(nA),L("OnCommentUpdate",X("CommentUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentReport":r.provides(rA),L("OnCommentReport",X("CommentReport",u.triggerOnEventHandlers.get(e)));break;case"CommentDelete":r.provides(tA),L("OnCommentDelete",X("CommentDelete",u.triggerOnEventHandlers.get(e)));break;case"AppInstall":r.provides(XT),L("OnAppInstall",X("AppInstall",u.triggerOnEventHandlers.get(e)));break;case"AppUpgrade":r.provides(ZT),L("OnAppUpgrade",X("AppUpgrade",u.triggerOnEventHandlers.get(e)));break;case"ModAction":r.provides(sA),L("OnModAction",X("ModAction",u.triggerOnEventHandlers.get(e)));break;case"ModMail":r.provides(oA),L("OnModMail",X("ModMail",u.triggerOnEventHandlers.get(e)));break;case"PostNsfwUpdate":r.provides(uA),L("OnPostNsfwUpdate",X("PostNsfwUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostSpoilerUpdate":r.provides(mA),L("OnPostSpoilerUpdate",X("PostSpoilerUpdate",u.triggerOnEventHandlers.get(e)));break;case"AutomoderatorFilterPost":r.provides(YT),L("OnAutomoderatorFilterPost",X("AutomoderatorFilterPost",u.triggerOnEventHandlers.get(e)));break;case"AutomoderatorFilterComment":r.provides(QT),L("OnAutomoderatorFilterComment",X("AutomoderatorFilterComment",u.triggerOnEventHandlers.get(e)));break;default:throw new Error(`Unknown trigger event: ${e}`)}}function hA(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=>Ii.caughtToString(t)).join(`
|
|
3
3
|
`))}}import{EffectType as gR,HandleUIEventResponse as Xc,UIEventHandlerDefinition as hR}from"@devvit/protos";var Db=Ln(rb(),1),Nb=Ln(Kc(),1);async function fR(r,e){let t=r.state??{},i=(0,Db.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 b=new pt((C,x)=>u.customPostType?.render(x)??null,r.event,r.state,e,void 0);return await b.reconcile(),Xc.fromJSON({state:b.state,effects:b.getEffects()})}let g=u.formDefinitions.get(p);if(!g)throw new Error(`Form with key ${p} not found`);let h,m;if(i.__contextAction){let{actionId:b,thingId:C}=i.__contextAction,x=ys(b);x?.location==="post"?h=C:x?.location==="comment"&&(m=C)}let y=Object.assign(n,ce(e,h,m),{uiEnvironment:{timezone:e[B.Timezone]?.values[0],locale:e[B.Language]?.values[0]}});await Hy(y,r),await g.onSubmit({values:Tt(r.event.formSubmitted.results)},y)}else if(r.event?.realtimeEvent){if(u.customPostType){let p=new pt((g,h)=>u.customPostType?.render(h)??null,r.event,r.state,e,void 0);return await p.reconcile(),Xc.fromJSON({state:p.state,effects:p.getEffects()})}}else if(r.event?.toastAction)throw new Error("Toast actions not yet implemented");let o=!(0,Nb.default)(t,i),a=Si(n.ui),c=o?[...a,{type:gR.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:0}}]:a;return Xc.fromJSON({state:i,effects:c})}function _b(r){r.provides(hR),L("HandleUIEvent",fR)}import{CustomPostDefinition as qd,UIResponse as gk}from"@devvit/protos";import{UIEventScope as wR}from"@devvit/protos";var Zc="ServerCallRequired";function Ad(r){return r?.message===Zc}var tm={now(){return new Date}};function Hb(r){return`__autocache__${r}`}function qb(r){return`__lock__${r}`}var vR=300,yR=1e3,Ed=5e3,Qc=3,jb=.1,Wb=1e3,bR=3e4;function Gb(r){if(r.error)throw new Error(r.error);return r.value}var Dt,Nt,Ne,Ai,K,Vb,zb,Jb,Yc,$b,Kb,em,Xb,Rd=class{constructor(e,t,i=tm){l(this,K);l(this,Dt);l(this,Nt,{});l(this,Ne);l(this,Ai);d(this,Dt,e),d(this,Ai,t),d(this,Ne,i)}async cache(e,t){var a;(a=s(this,Ai)).__cache??(a.__cache={}),d(this,Nt,s(this,Ai).__cache),S(this,K,Xb).call(this,t);let i=S(this,K,Vb).call(this,t.key);if(i!==void 0)return i;let n=await S(this,K,em).call(this,t.key),o=await S(this,K,zb).call(this,t,n,e);return Gb(o)}};Dt=new WeakMap,Nt=new WeakMap,Ne=new WeakMap,Ai=new WeakMap,K=new WeakSet,Vb=function(e){let t=s(this,Nt)[e];if(t){let i=s(this,Ne).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<Qc&&Math.random()<jb&&t.errorTime+Wb<i;if(t?.expires&&t.expires<i&&t.checkedAt+Wb<i||n){delete s(this,Nt)[e];return}else return Gb(t)}},zb=async function(e,t,i){let n=t?.expires,o=n?S(this,K,Kb).call(this,n):1;return!t||t?.error&&t.errorCount<Qc&&jb>Math.random()||o>Math.random()?S(this,K,Jb).call(this,e,t,i):t},Jb=async function(e,t,i){let n=qb(e.key),o=s(this,Ne).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Dt).set(n,"1",{expiration:a,nx:!0}))return S(this,K,$b).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Ne).now();return S(this,K,Yc).call(this,p,e.key,e.ttl)}},Yc=async function(e,t,i){let n=Math.min(i,yR),o=await S(this,K,em).call(this,t);if(o)return o;if(s(this,Ne).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,vR)),S(this,K,Yc).call(this,e,t,i)},$b=async function(e,t,i,n){let o=s(this,Ne).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,Ne).now().getTime(),t.errorCount++}return s(this,Nt)[e]=t,await s(this,Dt).set(Hb(e),JSON.stringify(t),{expiration:new Date(o+bR)}),t.error&&t.errorCount<Qc&&await s(this,Dt).del(qb(e)),t},Kb=function(e){let t=s(this,Ne).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},em=async function(e){let t=await s(this,Dt).get(Hb(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Ne).now().getTime(),s(this,Nt)[e]=i,i}},Xb=function(e){e.ttl<Ed&&(console.warn(`Cache TTL cannot be less than ${Ed} milliseconds! Updating ttl value of ${e.ttl} to ${Ed}.`),e.ttl=Ed)};function Zb(r,e,t=tm){let i=new Rd(r,e,t);return i.cache.bind(i)}import{EffectType as Od,ToastAppearance as ek}from"@devvit/protos";function Qb(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=Je({namespace:"useForm",initializer:i=>new rm(i,r,e)});return kR({id:t.hookId})}function kR(r){return`form.hook.${r.id}.0`}function Yb(r,e){let t=Qb(e);return r.getHook({id:t})}var vt,Md,ws,Ud,Bd=class{constructor(e){l(this,vt);l(this,Md,0);l(this,ws);l(this,Ud,(e,t)=>{let i=t!==void 0?e:"",n=t!==void 0?t:e;s(this,vt).emitEffect(`postMessage${Lm(this,Md)._++}`,{type:Od.EFFECT_WEB_VIEW,webView:{postMessage:{webViewId:i,app:{message:n}}}})});d(this,vt,e),d(this,ws,{postMessage:s(this,Ud)})}get webView(){return s(this,ws)}showForm(e,t){let i=Yb(s(this,vt),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={fields:[],id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description};gr(n.fields),o.fields=mt(n.fields),s(this,vt).emitEffect(e,{type:Od.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?ek.SUCCESS:ek.NEUTRAL}:t={text:e},s(this,vt).emitEffect(e.toString(),{type:Od.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,vt).emitEffect(t,{type:Od.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}};vt=new WeakMap,Md=new WeakMap,ws=new WeakMap,Ud=new WeakMap;import{EffectType as SR,RealtimeSubscriptionStatus as tk}from"@devvit/protos";var _t,it,Ht,Cr,Is,sm,Ld=class Ld{constructor(e,t){l(this,Is);l(this,_t);l(this,it);l(this,Ht);l(this,Cr);d(this,_t,t.context),d(this,it,!!t.context._devvitContext?.debug.realtime),d(this,Cr,e),d(this,Ht,t.invalidate);let i=t.context.meta[B.App]?.values[0];if(!i)throw Error("useChannel missing app ID metadata");let n=t.context.meta[B.Installation]?.values[0];if(!n)throw Error("useChannel missing install ID from metadata");let o=`${i}:${n}:${e.name}`;if(Object.values(s(this,_t)._hooks).filter(c=>c instanceof Ld).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 tk.REALTIME_SUBSCRIBED:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" connected`),this.state.connected=!0,s(this,Ht).call(this),await s(this,Cr).onSubscribed?.();break;case tk.REALTIME_UNSUBSCRIBED:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" disconnected`),this.state.connected=!1,s(this,Ht).call(this),await s(this,Cr).onUnsubscribed?.();break;default:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" received message: ${JSON.stringify(e,void 0,2)}`),s(this,Cr).onMessage(t.event?.data?.msg);break}}async send(e){if(s(this,it)&&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,it)&&console.debug(`[realtime] "${this.state.channel}" subscribed`),this.state.subscribed=!0,s(this,Ht).call(this),S(this,Is,sm).call(this))}unsubscribe(){this.state.subscribed&&(s(this,it)&&console.debug(`[realtime] "${this.state.channel}" unsubscribed`),this.state.subscribed=!1,s(this,Ht).call(this),S(this,Is,sm).call(this))}};_t=new WeakMap,it=new WeakMap,Ht=new WeakMap,Cr=new WeakMap,Is=new WeakSet,sm=function(){let e=Object.values(s(this,_t)._hooks).filter(t=>t instanceof Ld&&t.state.subscribed).map(t=>t.state.channel);s(this,_t).emitEffect(this.state.channel,{type:SR.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:e}})};var nm=Ld;function om(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 Je({id:e,namespace:e,initializer:t=>new nm(r,t)})}import{EffectType as am}from"@devvit/protos";function rk(r){return typeof r=="object"&&r!==null&&"__deleted"in r}var Pr,qt,Ei=class Ei{constructor(e,t){l(this,Pr);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,Pr,e.state??{__cache:{}}),this._rootProps=e.props??{}}get devvitContext(){if(!this._devvitContext)throw new Error("Devvit context not available");return this._devvitContext}set devvitContext(e){this._devvitContext=e}get _changedState(){let e={__cache:s(this,Pr).__cache??{}};for(let i in this._changed)e[i]=this._state[i];let t=new Set(Object.keys(this._state));return Object.keys(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,Pr)}set _state(e){d(this,Pr,e)}push(e){this._segments.push({...e,next:0})}pop(){this._segments.pop()}addUndeliveredEventHandler(e,t){this._undeliveredHandlers[e]=t}addGlobalUndeliveredEventHandler(e,t){Ei.addGlobalUndeliveredEventHandler(e,t)}getHook(e){return s(this,qt)[e.id]}static addGlobalUndeliveredEventHandler(e,t){Ei._staticUndeliveredHandlers[e]=t}async handleUndeliveredEvent(e){let t={...Ei._staticUndeliveredHandlers,...this._undeliveredHandlers};for(let[i,n]of Object.entries(t))await n(e,this)}emitEffect(e,t){this._effects[e]=t}addToRequeueEvents(...e){this._devvitContext?.debug.blocks&&console.debug("[blocks] requeueing events",e);let t=e.reduce((i,n)=>(n.retry?i.retry.push(n):i.normal.push(n),i),{retry:[],normal:[]});this._requeueEvents=[...t.retry,...this._requeueEvents,...t.normal]}get effects(){return Object.values(this._effects)}nextHookId(e){e.key===void 0&&(e.key=this._segments[this._segments.length-1].next+++""),this.push(e);try{let t=[];for(let n=this._segments.length-1;n>=0;n--){let o=this._segments[n];if(o.id){t.unshift(o.id);break}let a=[];o.namespace&&a.push(o.namespace),o.key!==void 0&&o.key!==!1&&a.push(o.key),t.unshift(a.join("-"))}let i=t.join(".");if(this._generated[i]&&!e.shared)throw new Error(`Hook id ${i} already used, cannot register another hook with the same id`);return this._generated[i]=!0,this._prevHookId=i,i}finally{this.pop()}}};Pr=new WeakMap,qt=new WeakMap,Ei._staticUndeliveredHandlers={};var Ri=Ei;var jt={};Ri.addGlobalUndeliveredEventHandler("intervals",async(r,e)=>{r.timer&&r.hook&&(delete jt[r.hook],e.emitEffect("timers",{type:am.EFFECT_SET_INTERVALS,interval:{intervals:jt}}))});var Wt,Oi,xs,Bi,dm=class{constructor(e,t,i){l(this,Wt);l(this,Oi);l(this,xs);l(this,Bi);this.state={duration:{seconds:0,nanos:0},running:!1};d(this,Oi,i.invalidate),d(this,Wt,i.hookId),d(this,xs,e),d(this,Bi,i.context);let n=Math.floor(t/1e3),o=t%1e3*1e6;this.state.duration={seconds:n,nanos:o}}onStateLoaded(){this.state.running?jt[s(this,Wt)]={duration:this.state.duration}:delete jt[s(this,Wt)]}async onUIEvent(e){await s(this,xs).call(this)}start(){jt[s(this,Wt)]={duration:this.state.duration},this.state.running=!0,s(this,Oi).call(this),s(this,Bi).emitEffect("timers",{type:am.EFFECT_SET_INTERVALS,interval:{intervals:jt}})}stop(){delete jt[s(this,Wt)],this.state.running=!1,s(this,Oi).call(this),s(this,Bi).emitEffect("timers",{type:am.EFFECT_SET_INTERVALS,interval:{intervals:jt}})}};Wt=new WeakMap,Oi=new WeakMap,xs=new WeakMap,Bi=new WeakMap;function lm(r,e){let t=Je({namespace:"useInterval",initializer:i=>new dm(r,e,i)});return{start:()=>t.start(),stop:()=>t.stop()}}import{UIEventScope as PR}from"@devvit/protos";var wr=class extends Error{};import{UIEventScope as ik}from"@devvit/protos";var nk=Ln(Kc(),1);function cm(r){if(r instanceof Error){if(r.message===Zc)throw r;return console.error(r),{message:r.message,details:r.stack??""}}else return console.error(r),{message:"Unknown error",details:Ii.caughtToString(r)}}var $e,nt,Mi,Fs,Ui,um=class{constructor(e,t,i){l(this,$e);l(this,nt);l(this,Mi);l(this,Fs);l(this,Ui);d(this,$e,!!i.context.devvitContext.debug.useAsync),s(this,$e)&&console.debug("[useAsync] v1",t),this.state={data:null,load_state:"initial",error:null,depends:null},d(this,nt,i.hookId),this.initializer=e,d(this,Mi,i.invalidate),d(this,Fs,i.context),this.localDepends=t.depends??null,d(this,Ui,t)}onStateLoaded(){if(s(this,$e)&&console.debug("[useAsync] async onLoad ",s(this,nt),this.state),s(this,$e)&&console.debug("[useAsync] async onLoad have ",this.localDepends,"and",this.state.depends),!(0,nk.default)(this.localDepends,this.state.depends)||this.state.load_state==="initial"){s(this,$e)&&console.debug("[useAsync] attempting to resolve for hookId",s(this,nt)),this.state.load_state="loading",this.state.depends=this.localDepends,s(this,Mi).call(this);let e={scope:ik.ALL,hook:s(this,nt),async:!0,asyncRequest:{requestId:s(this,nt)+"-"+JSON.stringify(this.state.depends)}};s(this,$e)&&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=cm(o)}let n={scope:ik.ALL,asyncResponse:i,hook:s(this,nt)};s(this,$e)&&console.debug("[useAsync] onReq requeue"),t.addToRequeueEvents(n)}else if(e.asyncResponse){let i=s(this,nt)+"-"+JSON.stringify(this.state.depends);e.asyncResponse.requestId===i?(this.state={...this.state,data:e.asyncResponse.data?.value??null,error:e.asyncResponse.error??null,load_state:e.asyncResponse.error?"error":"loaded"},s(this,Ui).finally&&await s(this,Ui).finally(this.state.data,this.state.error?new Error(this.state.error?.message??"Unknown error"):null),s(this,Mi).call(this)):s(this,$e)&&console.debug("[useAsync] onResp skip, stale event",e.asyncResponse.requestId," !== ",i)}else throw new Error("Unknown event type")}};$e=new WeakMap,nt=new WeakMap,Mi=new WeakMap,Fs=new WeakMap,Ui=new WeakMap;function CR(r,e={}){let t=Je({namespace:"useAsync",initializer:i=>new um(r,e,i)});return{data:t.state.data,error:t.state.error,loading:t.state.load_state==="loading"}}var yt,Li,Ir,xr,mm=class{constructor(e,t){this.state={value:null,load_state:"initial",error:null};l(this,yt);l(this,Li);l(this,Ir);l(this,xr);d(this,Ir,e),d(this,xr,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=cm(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,xr)]?._promise,this.state.load_state==="loading")throw new wr;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,Ir)instanceof Function?s(this,Ir).call(this):s(this,Ir)}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={scope:PR.ALL,asyncRequest:{requestId:s(this,xr)},hook:s(this,xr)};throw s(this,Li).addToRequeueEvents(t),s(this,yt).call(this),new wr}else this.state.value=e,this.state.load_state="loaded";s(this,yt).call(this)}}};yt=new WeakMap,Li=new WeakMap,Ir=new WeakMap,xr=new WeakMap;function pm(r){let e=Je({namespace:"useState",initializer:t=>new mm(r,t)});return[e.state.value,e.setter.bind(e)]}var Dd=class{buildContext(e,t,i){let n=new pi(i),o=new ci(i),a=new vi(i),c=new hi(i),p=new yi(i),g=new bi(i),h=new Bd(e),m=new mi(i),y=new li,b=new gi(i),C=Zb(a,e._state),x={modLog:n,kvStore:o,redis:a,reddit:c,scheduler:p,settings:g,media:m,assets:y,realtime:b,ui:h,useState:pm,useChannel:om,useInterval:lm,useForm:im,cache:C,dimensions:t.env?.dimensions,uiEnvironment:{timezone:i[B.Timezone]?.values[0],locale:i[B.Language]?.values[0],dimensions:t.env?.dimensions}},I=ce(i,t.props?.postId);return I.debug.effects=e,{...I,...x}}};var ke=null;function sk(r){return JSON.parse(JSON.stringify(r))}function IR(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 Je({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.");IR(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||rk(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 xR=null,ok=64,Di,Hd,Ts,F,me,Nd,ak,gm,dk,hm,fm,_d,vm,lk,Fr=class{constructor(e){l(this,F);l(this,Di);l(this,Hd,new Dd);l(this,Ts,new wi(()=>this._latestRenderContext?.devvitContext?.assets));this._latestRenderContext=null;s(this,F,me)&&console.debug("[blocks] BlocksHandler v1"),d(this,Di,e),xR=this}async handle(e,t){let i=new Ri(e,t),n=s(this,Hd).buildContext(i,e,t);i.devvitContext=n;let o,a=e.events,p=!e.events?.length||a.some(C=>!C.async),g=a.some(C=>C.blocking),h,m,y=[...a];a.length===0&&a.push({scope:wR.ALL}),s(this,F,me)&&console.debug("[blocks] starting processing events");let b=0;for(;a.length>0;){if(b++>ok)throw new Error(`Exceeded maximum iterations of ${ok}`);s(this,F,me)&&console.debug("[blocks] processing events loop iteration",a.length);let C=[];if(!a[0].async)C.push(a.shift());else for(;a[0]?.async;)C.push(a.shift());if(!C.length)throw Error("batch must have at least one event");try{if(C[0].async){let I=sk(i._state);await S(this,F,ak).call(this,i,...C),i._state=I}else await S(this,F,dk).call(this,i,...C)}catch(I){if(!Ad(I))throw I;if(s(this,F,me)&&console.debug("[blocks] caught in handler",I),i._latestRenderContent=void 0,m){i._state=m._state,i._changed=h,i._effects=m._effects;let U=y.map(Pe=>{let Ct={...Pe};return Ct.retry=!0,Ct});i.addToRequeueEvents(...U);break}else throw Ad(I)||console.error("[blocks] unhandled error in handler",I),I}s(this,F,me)&&console.debug("[blocks] remaining events",i._requeueEvents);let x=[];for(let I of i._requeueEvents){if(!p&&!I.async){s(this,F,me)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch A",I),x.push(I);continue}if(p&&I.async&&!g){s(this,F,me)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch B",I),x.push(I);continue}s(this,F,me)&&console.debug("[blocks] reprocessing event in BlocksHandler",I),a.push(I)}i._requeueEvents=x,a.length>0&&(h={...i._changed},m={_state:sk(i._state),_effects:{...i._effects}},y=[...a])}if(p){i._latestRenderContent||(i._latestRenderContent=S(this,F,hm).call(this,s(this,Di),i.request.props??{},i));let C=i._latestRenderContent;C&&(o=s(this,Ts).createBlocksElementOrThrow(C),o=s(this,Ts).ensureRootBlock(o))}return{state:i._changedState,effects:i.effects,blocks:o,events:i._requeueEvents}}};Di=new WeakMap,Hd=new WeakMap,Ts=new WeakMap,F=new WeakSet,me=function(){return!!this._latestRenderContext?.devvitContext.debug.blocks},Nd=function(e,...t){e._hooks={},S(this,F,hm).call(this,s(this,Di),e.request.props??{},e)},ak=async function(e,...t){S(this,F,Nd).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,gm).call(this,e,i)}))},gm=async function(e,t){let i=e._hooks[t.hook];if(i?.onUIEvent)try{await i.onUIEvent(t,e)}catch(n){throw Ad(n)?s(this,F,me)&&console.error("Server call required",n):console.error("Error in event handler",n),n}else await e.handleUndeliveredEvent(t)},dk=async function(e,...t){for(let i of t)s(this,F,me)&&console.log("[blocks] handling main queue event",i),s(this,F,me)&&console.log("[blocks] before",e._state),S(this,F,Nd).call(this,e,i),await S(this,F,gm).call(this,e,i),s(this,F,me)&&console.log("[blocks] after",e._state);S(this,F,Nd).call(this,e)},hm=function(e,t,i){s(this,F,me)&&console.debug("[blocks] renderRoot"),i._generated={},ke=i,this._latestRenderContext=i;try{let n=S(this,F,fm).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] = 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 wr)return;throw n}finally{ke=null}},fm=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] = useState(async () => {/** your async code */})".`);return S(this,F,vm).call(this,n,i)}finally{i.pop()}},_d=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,vm).call(this,i,t)))},vm=function(e,t){if(Array.isArray(e))return S(this,F,_d).call(this,e,t);if(FR(e))if(e.type===void 0)try{return t.push({namespace:"fragment",...e.props}),S(this,F,_d).call(this,e.children,t)}finally{t.pop()}else if(typeof e.type=="function"){let i={...e.props,children:e.children.flat(1/0)};return S(this,F,fm).call(this,e.type,i,t)}else try{t.push({namespace:e.type,...e.props});let i=S(this,F,_d).call(this,e.children,t),n=S(this,F,lk).call(this,e.props??{});return[{type:e.type,children:i,props:n}]}finally{t.pop()}else return[(e??"").toString()]},lk=function(e){let t={};for(let i in e)if(!(typeof e[i]>"u"))if(typeof e[i]=="function"){let n=Je({namespace:i,key:!1,initializer:({hookId:o})=>({hookId:o,state:null,onUIEvent:a=>{if(a.userAction)return e[i](a.userAction.data);if(a.webView?.postMessage)return e[i](a.webView.postMessage.message)}})});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 FR(r){return typeof r=="object"&&r!=null&&"type"in r}var uk=r=>{let e=Number(r.trim().split(".").pop());return isNaN(e)?void 0:e},ck=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=uk(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=uk(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)},mk=r=>r?r.platform==="Android"?r.versionNumber<1875012:r.platform==="iOS"?r.versionNumber<614973:!1:(console.warn(`Could not parse devvit-user-agent! Received: '${JSON.stringify(r)}'`),!1),TR=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}`)}},AR=({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=TR(r);t?e.ui.navigateTo(t):console.warn("No upgrade link found for platform:",r)}},"Upgrade"))))),pk=r=>()=>u.createElement(AR,{platform:r});var ER=()=>u.createElement("vstack",{alignment:"center middle",width:"100%",height:"100%"},u.createElement("text",null,"This feature is not available yet")),RR=[[qd,qd.methods.renderPostContent,(r,e)=>u.customPostType?.render(e)??null],[qd,qd.methods.renderPostComposer,(r,e)=>u.createElement(ER,null)]];function OR(r){return async(e,t)=>{let i=ck(t["devvit-user-agent"]?.values?.[0]??"");if(i&&mk(i)){let o=new Fr(pk(i.platform));return gk.fromJSON(await o.handle(e,t))}let n=new Fr(r);return gk.fromJSON(await n.handle(e,t))}}function hk(r){for(let[e,t,i]of RR)r.provides(e),L(t.name,OR(i))}var Ni,As,_i,Tr,Ar,Hi,qi,Er,Gt,Es,Rs,Rr,G,N=class N extends td{static configure(e){d(this,_i,{...s(this,_i),...e}),gt(e.http)&&this.use(P.HTTPDefinition),(e.redis===void 0||gt(e.kvStore)||gt(e.redis))&&(this.use(P.KVStoreDefinition),this.use(P.RedisAPIDefinition)),gt(e.media)&&this.use(P.MediaServiceDefinition),gt(e.modLog)&&this.use(P.ModlogDefinition),gt(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.UsersDefinition),this.use(P.WidgetsDefinition),this.use(P.WikiDefinition)),gt(e.realtime)&&this.use(P.RealtimeDefinition)}static addMenuItem(e){s(this,qi).push(e)}static addCustomPostType(e){d(this,Tr,e)}static createForm(e,t){let i=`form.${s(this,Ar).size}`;return s(this,Ar).set(i,{form:e,onSubmit:t}),i}static addSchedulerJob(e){if(s(this,G)[P.SchedulerDefinition.fullName]||this.use(P.SchedulerDefinition),s(this,Er).has(e.name))throw new Error(`Job ${e.name} is already defined`);s(this,Er).set(e.name,e.onRun)}static addSettings(e){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,Ni,i),s(this,G)[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,Gt).has(e.event)?s(this,Gt).get(e.event)?.push(e.onEvent):s(this,Gt).set(e.event,[e.onEvent]),N}static provide(e){s(this,Rs).push(e)}static use(e,t){s(this,Rr)[e.fullName]={def:e,options:t??{},handler:void 0};let i={};for(let n of Object.values(e.methods))i[n.name]=(o,a)=>s(this,Rr)[e.fullName].handler?.[n.name]?.(n.requestType?.fromPartial(o??{}),a);return s(this,G)[e.fullName]=i,i}static get redditAPIPlugins(){if(!gt(s(this,_i).redditAPI))throw new Error("Reddit API is not enabled. You can enable it by passing `redditAPI: true` to `Devvit.configure`.");return{Flair:s(this,G)[P.FlairDefinition.fullName],GraphQL:s(this,G)[P.GraphQLDefinition.fullName],LinksAndComments:s(this,G)[P.LinksAndCommentsDefinition.fullName],Listings:s(this,G)[P.ListingsDefinition.fullName],Moderation:s(this,G)[P.ModerationDefinition.fullName],ModNote:s(this,G)[P.ModNoteDefinition.fullName],NewModmail:s(this,G)[P.NewModmailDefinition.fullName],PrivateMessages:s(this,G)[P.PrivateMessagesDefinition.fullName],Subreddits:s(this,G)[P.SubredditsDefinition.fullName],Users:s(this,G)[P.UsersDefinition.fullName],Widgets:s(this,G)[P.WidgetsDefinition.fullName],Wiki:s(this,G)[P.WikiDefinition.fullName]}}static get modLogPlugin(){let e=s(this,G)[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,G)[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,G)[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,G)[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,G)[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 settingsPlugin(){let e=s(this,G)[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,G)[P.RealtimeDefinition.fullName];if(!e)throw new Error("Realtime is not enabled. You can enable it by passing `realtime: true` to `Devvit.configure`");return e}static get menuItems(){return s(this,qi)}static get customPostType(){return s(this,Tr)}static get formDefinitions(){return s(this,Ar)}static get scheduledJobHandlers(){return s(this,Er)}static get installationSettings(){return s(this,Hi)}static get appSettings(){return s(this,Ni)}static get triggerOnEventHandlers(){return s(this,Gt)}static get assets(){return s(this,As)}static get webViewAssets(){return s(this,Es)}constructor(e){super(e),d(N,As,e.assets??{}),d(N,Es,e.webviewAssets??{});for(let t in s(N,Rr)){let i=s(N,Rr)[t];i.handler=e.use(i.def,i.options)}s(N,qi).length>0&&jy(e),s(N,Er).size>0&&Wy(e),s(N,Tr)&&(Ly(e),hk(e)),(s(N,Tr)||s(N,Ar).size>0)&&_b(e),s(N,Hi)&&Dy(e),s(N,Ni)&&vy(e),s(N,Gt).size>0&&Gy(e);for(let t of s(N,Rs))e.provides(t)}};Ni=new WeakMap,As=new WeakMap,_i=new WeakMap,Tr=new WeakMap,Ar=new WeakMap,Hi=new WeakMap,qi=new WeakMap,Er=new WeakMap,Gt=new WeakMap,Es=new WeakMap,Rs=new WeakMap,Rr=new WeakMap,G=new WeakMap,N.debug={},l(N,Ni),l(N,As,{}),l(N,_i,{}),l(N,Tr),l(N,Ar,new Map),l(N,Hi),l(N,qi,[]),l(N,Er,new Map),l(N,Gt,new Map),l(N,Es,{}),l(N,Rs,[]),l(N,Rr,{}),l(N,G,{});var u=N;(e=>{function r(t,i,...n){return{type:t,props:i,children:n}}e.createElement=r})(u||(u={}));function Y(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 ym;(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"})(ym||(ym={}));var fk="text",vk="raw",yk="br",bk="link",kk="c/",Sk="p/",Ck="r/",Pk="u/",wk="@",Ik="spoilertext",xk="par",Fk="h",Tk="hr",Ak="blockquote",Ek="code",Rk="li",Ok="list",Bk="L",Mk="R",Uk="C",Lk="table",Dk="embed",Nk="img",_k="gif",Hk="video";function qk(r){return{e:_k,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function jk(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:Ak,c:i,...r.author&&{a:r.author}}}function Wk(r,e){let t={},i=[];return Object.assign(t,km(t,i)),e(t),{e:Ek,c:i,...r.language&&{l:r.language}}}function Gk(r){return{e:kk,t:r.permalink}}function Vk(r,e){let t={},i=[];return Object.assign(t,km(t,i),Ls(t,i)),e(t),{e:Fk,l:r.level,c:i}}function zk(r){return{e:Dk,u:r.sourceUrl,c:r.contentUrl,x:r.width,y:r.height}}function Jk(){return{e:Tk}}function $k(r){return{e:Nk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function Kk(){return{e:yk}}function Xk(r){return{e:bk,t:r.text,u:r.url,...r.formatting&&{f:r.formatting},...r.tooltip&&{a:r.tooltip}}}function Zk(r,e){let t={},i=[];return Object.assign(t,pS(t,i)),e(t),{e:Ok,o:r.ordered,c:i}}function Qk(r){let e={},t=[];return Object.assign(e,Os(e,t),Bs(e,t),Ms(e,t),jd(e,t),Ds(e,t),Ns(e,t),_s(e,t)),r(e),{e:Rk,c:t}}function Yk(r){let e={},t=[];return Object.assign(e,Wd(e,t),Ls(e,t),bm(e,t),Sm(e,t),Us(e,t)),r(e),{e:xk,c:t}}function eS(r){return{e:Sk,t:r.permalink}}function tS(r){return{e:vk,t:r}}function rS(r){let e={},t=[];return Object.assign(e,Wd(e,t),Ls(e,t),bm(e,t)),r(e),{e:Ik,c:t}}function iS(r){return{e:Ck,t:r.subredditName,l:r.showPrefix}}function nS(r){let e={},t=[],i=[];return Object.assign(e,gS(e,t,i)),r(e),{e:Lk,h:t,c:i}}function sS(r){let[e,t]=mS();return r(e),{c:t}}function oS(r,e){let[t,i]=mS();e(t);let n;switch(r.columnAlignment){case"left":n=Bk;break;case"right":n=Mk;break;case"center":n=Uk;break}return{...n&&{a:n},...i&&{c:i}}}function aS(r){let e={},t=[];return Object.assign(e,hS(e,t)),r(e),t}function dS(r){return{e:fk,t:r.text,...r.formatting&&{f:r.formatting}}}function lS(r){return{e:Pk,t:r.username,l:r.showPrefix}}function uS(r){return{e:wk,t:r.username,l:r.showPrefix}}function cS(r){return{e:Hk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur},...r.thumbnail&&{p:r.thumbnail},...r.convertToGif&&{gifify:r.convertToGif}}}function mS(){let r={},e=[];return Object.assign(r,Wd(r,e),Ls(r,e),Sm(r,e),Us(r,e)),[r,e]}function Os(r,e){return{blockQuote(t,i){return e.push(jk(t,i)),r}}}function Bs(r,e){return{codeBlock(t,i){return e.push(Wk(t,i)),r}}}function fS(r,e){return{embed(t){return e.push(zk(t)),r}}}function Ms(r,e){return{heading(t,i){return e.push(Vk(t,i)),r}}}function jd(r,e){return{horizontalRule(){return e.push(Jk()),r}}}function Us(r,e){return{image(t){return e.push($k(t)),r},animatedImage(t){return e.push(qk(t)),r}}}function bm(r,e){return{linebreak(){return e.push(Kk()),r}}}function Ls(r,e){return{link(t){return e.push(Xk(t)),r},commentLink(t){return e.push(Gk(t)),r},postLink(t){return e.push(eS(t)),r},subredditLink(t){return e.push(iS(t)),r},userLink(t){return e.push(lS(t)),r},userMention(t){return e.push(uS(t)),r}}}function Ds(r,e){return{list(t,i){return e.push(Zk(t,i)),r}}}function pS(r,e){return{item(t){return e.push(Qk(t)),r}}}function Ns(r,e){return{paragraph(t){return e.push(Yk(t)),r}}}function km(r,e){return{rawText(t){return e.push(tS(t)),r}}}function Sm(r,e){return{spoiler(t){return e.push(rS(t)),r}}}function gS(r,e,t){return{headerCell(i,n){return e.push(oS(i,n)),r},row(i){return t.push(aS(i)),r}}}function _s(r,e){return{table(t){return e.push(nS(t)),r}}}function hS(r,e){return{cell(t){return e.push(sS(t)),r}}}function Wd(r,e){return{text(t){return e.push(dS(t)),r}}}function vS(r,e){return{video(t){return e.push(cS(t)),r}}}var BR=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},MR=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)},Gd,Or=class{constructor(){Gd.set(this,void 0);let e=[];Object.assign(this,Ns(this,e),Ms(this,e),jd(this,e),Os(this,e),Bs(this,e),fS(this,e),Ds(this,e),_s(this,e),Us(this,e),vS(this,e)),BR(this,Gd,{document:e},"f")}build(){return JSON.stringify(MR(this,Gd,"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}};Gd=new WeakMap;function ji(r){let e;return r instanceof Or?e=r.build():typeof r=="object"?e=JSON.stringify(r):e=r,e}var yS=100,bS=1/0,Br,Mr,Vt,Wi,Gi,Vd,V=class{constructor(e){l(this,Gi);l(this,Br);l(this,Mr);l(this,Vt);l(this,Wi,!1);this.pageSize=yS;this.limit=bS;this.children=[];Y(this),this._fetch=e.fetch,this.pageSize=e.pageSize??yS,this.limit=e.limit??bS,d(this,Mr,e.after),d(this,Br,e.before),d(this,Vt,e.more),e.children&&(this.children=e.children)}get hasMore(){return!s(this,Wi)||!!(s(this,Mr)||s(this,Br)||s(this,Vt))}async*[Symbol.asyncIterator](){let e=0;for(;;){if(e===this.children.length)if(this.hasMore){if((await S(this,Gi,Vd).call(this)).length===0)break}else break;if(yield this.children[e],e++,e===this.limit)break}}setMore(e){d(this,Vt,e)}preventInitialFetch(){d(this,Wi,!0)}async all(){for(;this.hasMore&&this.children.length<this.limit;)await S(this,Gi,Vd).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,Gi,Vd).call(this);return this.children.slice(0,t)}};Br=new WeakMap,Mr=new WeakMap,Vt=new WeakMap,Wi=new WeakMap,Gi=new WeakSet,Vd=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,Vt)});return this.children.push(...e),d(this,Br,t),d(this,Mr,i),d(this,Vt,n),d(this,Wi,!0),e};var Hs,Cm,Me=class{constructor(){}static get(e,t){let i=u.redditAPIPlugins.ModNote;return new V({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,Cm).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,Cm).call(this,n.created)}static async addRemovalNote(e,t){await u.redditAPIPlugins.ModNote.PostRemovalNote(e,t)}};Hs=new WeakSet,Cm=function(e){return v(e.id,"Mod note ID is null or undefined"),v(e.createdAt,"Mod note createdAt is null or undefined"),v(e.type,"Mod note type is null or undefined"),v(e.subreddit,"Mod note subreddit is null or undefined"),v(e.subredditId,"Mod note subredditId is null or undefined"),v(e.operator,"Mod note operator is null or undefined"),v(e.operatorId,"Mod note operatorId is null or undefined"),v(e.user,"Mod note user is null or undefined"),v(e.userId,"Mod note userId is null or undefined"),v(e.userNoteData,"Mod note userNote is null or undefined"),v(e.modActionData,"Mod note modAction is null or undefined"),{id:e.id,user:{id:oe(e.userId??""),name:e.user},subreddit:{id:ie(e.subredditId??""),name:e.subreddit},operator:{id:oe(e.operatorId??""),name:e.operator},createdAt:new Date(e.createdAt*1e3),userNote:{note:e.userNoteData?.note,redditId:e.userNoteData?.redditId?Re(e.userNoteData?.redditId):void 0,label:e.userNoteData?.label},type:e.type}},l(Me,Hs);var re=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 kS=["all","wiki","posts","access","mail","config","flair","channels","chat_config","chat_operator","community_chat"];function UR(r,e){return e.map(t=>(r.includes(t)?"+":"-")+t).join(",")}function Pm(r){return UR(r,kS)}function SS(r){return r.filter(e=>kS.includes(e))}var LR=(t=>(t.User="USER_FLAIR",t.Post="LINK_FLAIR",t))(LR||{}),Lr,Vi,zi,Ji,$i,Ki,Xi,Zi,Qi,Yi,en,zd,Ke=class Ke{constructor(e,t,i){l(this,Lr);l(this,Vi);l(this,zi);l(this,Ji);l(this,$i);l(this,Ki);l(this,Xi);l(this,Zi);l(this,Qi);l(this,Yi);Y(this),v(e.id),v(e.text),d(this,Lr,e.id),d(this,Vi,t),d(this,zi,e.text),d(this,Ji,DR(e.textColor)),d(this,$i,NR(e.backgroundColor)),d(this,Ki,_R(e.allowableContent)),d(this,Xi,e.modOnly),d(this,Zi,e.maxEmojis),d(this,Qi,e.textEditable),d(this,Yi,i)}get id(){return s(this,Lr)}get text(){return s(this,zi)}get textColor(){return s(this,Ji)}get backgroundColor(){return s(this,$i)}get allowableContent(){return s(this,Ki)}get modOnly(){return s(this,Xi)}get maxEmojis(){return s(this,Zi)}get allowUserEdits(){return s(this,Qi)}async delete(){return Ke.deleteFlairTemplate(s(this,Lr),s(this,Vi),s(this,Yi))}async edit(e){return Ke.editFlairTemplate({id:s(this,Lr),subredditName:s(this,Vi),text:e.text??s(this,zi),allowableContent:e.allowableContent??s(this,Ki),backgroundColor:e.backgroundColor??s(this,$i),maxEmojis:e.maxEmojis??s(this,Zi),modOnly:e.modOnly??s(this,Xi),textColor:e.textColor??s(this,Ji),allowUserEdits:e.allowUserEdits??s(this,Qi)},s(this,Yi))}static async createPostFlairTemplate(e,t){var i;return S(i=Ke,en,zd).call(i,{...e,flairType:"LINK_FLAIR"},t)}static async createUserFlairTemplate(e,t){var i;return S(i=Ke,en,zd).call(i,{...e,flairType:"USER_FLAIR"},t)}static async editFlairTemplate(e,t){var i;return S(i=Ke,en,zd).call(i,e,t)}static async getPostFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.LinkFlair({subreddit:e},t)).flair?.map(o=>new Ke(o,e,t))||[]}static async getUserFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.UserFlair({subreddit:e},t)).flair?.map(o=>new Ke(o,e,t))||[]}static async deleteFlairTemplate(e,t,i){await u.redditAPIPlugins.Flair.DeleteFlairTemplate({subreddit:e,flairTemplateId:t},i)}};Lr=new WeakMap,Vi=new WeakMap,zi=new WeakMap,Ji=new WeakMap,$i=new WeakMap,Ki=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,Qi=new WeakMap,Yi=new WeakMap,en=new WeakSet,zd=async function(e,t){let{subredditName:i,allowableContent:n="all",backgroundColor:o="transparent",flairType:a="",maxEmojis:c=10,modOnly:p=!1,text:g,textColor:h="dark",allowUserEdits:m=!1,id:y=""}=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:h,textEditable:m,flairTemplateId:y,cssClass:"",overrideCss:!1},t);return new Ke(C,i,t)},l(Ke,en);var ue=Ke;function qs(r){return{flairCssClass:r.flairCssClass,user:r.user,flairText:r.flairText}}var zt,wm,Im,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,zt,wm).call(i,e,t)}static setPostFlair(e,t){var i;return S(i=Ur,zt,wm).call(i,{...e,postId:ve(e.postId)},t)}static async removePostFlair(e,t,i){var n;return S(n=Ur,zt,Im).call(n,e,t,void 0,i)}static async removeUserFlair(e,t,i){var n;return S(n=Ur,zt,Im).call(n,e,void 0,t,i)}};zt=new WeakSet,wm=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)},Im=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,zt);var Ue=Ur;function DR(r){if(v(r,"Flair text color is required"),r==="light"||r==="dark")return r;throw new Error(`Invalid flair text color: ${r}`)}function NR(r){if(!r||r.length===0||r==="transparent")return"transparent";if(/^#([A-Fa-f0-9]{6})$/.test(r))return r;throw new Error(`Invalid flair background color: ${r}`)}function _R(r){if(r==="all"||r==="text"||r==="emoji")return r;throw new Error(`Invalid allowable content: ${r}`)}import"@devvit/protos";import{Block as IS,UIResponse as $R}from"@devvit/protos";var Tm=Ln(wS(),1);var Fm=r=>"text"in r?r.text:JR(r.richtext),JR=r=>r instanceof Or?r.build():typeof r=="object"?JSON.stringify(r):r;var KR={NONE:0,BLOCKS:1,UNRECOGNIZED:-1},tn,Ws,rn,Gs,nn,Vs,zs,Js,Nr,$s,Ks,Xs,Zs,Qs,Ys,Jt,eo,to,_r,sn,$t,on,an,dn,Kt,Xt,Zt,ln,Qt,Yt,er,bt,ro,io,un,cn,D,_=class _{constructor(e,t){l(this,tn);l(this,Ws);l(this,rn);l(this,Gs);l(this,nn);l(this,Vs);l(this,zs);l(this,Js);l(this,Nr);l(this,$s);l(this,Ks);l(this,Xs);l(this,Zs);l(this,Qs);l(this,Ys);l(this,Jt);l(this,eo);l(this,to);l(this,_r);l(this,sn);l(this,$t);l(this,on);l(this,an);l(this,dn);l(this,Kt);l(this,Xt);l(this,Zt);l(this,ln);l(this,Qt);l(this,Yt);l(this,er);l(this,bt);l(this,ro);l(this,io);l(this,un);l(this,cn);l(this,D);Y(this),v(e.id,"Post is missing id"),v(e.title,"Post is missing title"),v(e.createdUtc,"Post is missing created date"),v(e.author,"Post is missing author name"),v(e.subreddit,"Post is missing subreddit name"),v(e.subredditId,"Post is missing subreddit id"),v(e.url,"Post is missing url"),v(e.permalink,"Post is missing permalink"),d(this,tn,ve(`t3_${e.id}`)),d(this,rn,e.author),d(this,Ws,e.authorFullname?oe(e.authorFullname):void 0),d(this,nn,ie(e.subredditId)),d(this,Vs,e.subreddit),d(this,Xs,e.score??0),d(this,Zs,e.numComments??0),d(this,Qs,e.numReports??0);let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Gs,i),d(this,Js,e.title),d(this,Nr,e.selftext),d(this,$s,e.selftextHtml),d(this,Ks,e.url),d(this,zs,e.permalink),e.thumbnail&&e.thumbnail!=="self"&&e.thumbnail!=="nsfw"&&e.thumbnailHeight!=null&&e.thumbnailWidth!=null&&d(this,Ys,{url:e.thumbnail,height:e.thumbnailHeight,width:e.thumbnailWidth}),d(this,Jt,e.approved??!1),d(this,eo,e.approvedAtUtc??0),d(this,to,e.bannedAtUtc??0),d(this,$t,e.removed??!1),d(this,on,e.removedBy),d(this,an,e.removedByCategory),d(this,_r,e.spam??!1),d(this,sn,e.stickied??!1),d(this,dn,e.archived??!1),d(this,Kt,e.edited??!1),d(this,Xt,e.locked??!1),d(this,Zt,e.over18??!1),d(this,ln,e.quarantine??!1),d(this,Qt,e.spoiler),d(this,Yt,e.hidden??!1),d(this,er,e.ignoreReports??!1),d(this,bt,e.distinguished),d(this,io,e.secureMedia),d(this,un,(e.modReports??[]).map(([n])=>n)),d(this,cn,(e.userReports??[]).map(([n])=>n)),d(this,D,t),(e.linkFlairBackgroundColor||e.linkFlairCssClass||e.linkFlairText||e.linkFlairType||e.linkFlairTemplateId||e.linkFlairRichtext||e.linkFlairTextColor)&&d(this,ro,{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,tn)}get authorId(){return s(this,Ws)}get authorName(){return s(this,rn)}get subredditId(){return s(this,nn)}get subredditName(){return s(this,Vs)}get permalink(){return s(this,zs)}get title(){return s(this,Js)}get body(){return s(this,Nr)}get bodyHtml(){return s(this,$s)}get url(){return s(this,Ks)}get thumbnail(){return s(this,Ys)}get createdAt(){return s(this,Gs)}get score(){return s(this,Xs)}get numberOfComments(){return s(this,Zs)}get numberOfReports(){return s(this,Qs)}get approved(){return s(this,Jt)}get approvedAtUtc(){return s(this,eo)}get bannedAtUtc(){return s(this,to)}get spam(){return s(this,_r)}get stickied(){return s(this,sn)}get removed(){return s(this,$t)}get removedBy(){return s(this,on)}get removedByCategory(){return s(this,an)}get archived(){return s(this,dn)}get edited(){return s(this,Kt)}get locked(){return s(this,Xt)}get nsfw(){return s(this,Zt)}get quarantined(){return s(this,ln)}get spoiler(){return s(this,Qt)}get hidden(){return s(this,Yt)}get ignoringReports(){return s(this,er)}get distinguishedBy(){return s(this,bt)}get comments(){return te.getComments({postId:this.id},s(this,D))}get flair(){return s(this,ro)}get secureMedia(){return s(this,io)}get userReportReasons(){return s(this,cn)}get modReportReasons(){return s(this,un)}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,on),removedByCategory:s(this,an),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,un),userReportReasons:s(this,cn)}}isApproved(){return s(this,Jt)}isSpam(){return s(this,_r)}isStickied(){return s(this,sn)}isRemoved(){return s(this,$t)}isArchived(){return s(this,dn)}isEdited(){return s(this,Kt)}isLocked(){return s(this,Xt)}isNsfw(){return s(this,Zt)}isQuarantined(){return s(this,ln)}isSpoiler(){return s(this,Qt)}isHidden(){return s(this,Yt)}isIgnoringReports(){return s(this,er)}isDistinguishedBy(){return s(this,bt)}async edit(e){let t=await _.edit({id:this.id,...e},s(this,D));d(this,Nr,t.body),d(this,Kt,t.edited)}async setSuggestedCommentSort(e){await _.setSuggestedCommentSort({id:this.id,subredditId:s(this,nn),suggestedSort:e},s(this,D))}async setCustomPostPreview(e){await _.setCustomPostPreview({id:this.id,ui:e},s(this,D))}async setTextFallback(e){let t=await _.setTextFallback(e,this.id,s(this,D));d(this,Nr,t.body),d(this,Kt,t.edited)}async addComment(e){return te.submit({id:this.id,...e},s(this,D))}async delete(){return _.delete(this.id,s(this,D))}async approve(){await _.approve(this.id,s(this,D)),d(this,Jt,!0),d(this,$t,!1)}async remove(e=!1){await _.remove(this.id,e,s(this,D)),d(this,$t,!0),d(this,_r,e),d(this,Jt,!1)}async lock(){await _.lock(this.id,s(this,D)),d(this,Xt,!0)}async unlock(){await _.unlock(this.id,s(this,D)),d(this,Xt,!1)}async hide(){await _.hide(this.id,s(this,D)),d(this,Yt,!0)}async unhide(){await _.unhide(this.id,s(this,D)),d(this,Yt,!1)}async markAsNsfw(){await _.markAsNsfw(this.id,s(this,D)),d(this,Zt,!0)}async unmarkAsNsfw(){await _.unmarkAsNsfw(this.id,s(this,D)),d(this,Zt,!1)}async markAsSpoiler(){await _.markAsSpoiler(this.id,s(this,D)),d(this,Qt,!0)}async unmarkAsSpoiler(){await _.unmarkAsSpoiler(this.id,s(this,D)),d(this,Qt,!1)}async sticky(e){await _.sticky(this.id,e,s(this,D))}async unsticky(){await _.unsticky(this.id,s(this,D))}async distinguish(){let{distinguishedBy:e}=await _.distinguish(this.id,!1,s(this,D));d(this,bt,e)}async distinguishAsAdmin(){let{distinguishedBy:e}=await _.distinguish(this.id,!0,s(this,D));d(this,bt,e)}async undistinguish(){let{distinguishedBy:e}=await _.undistinguish(this.id,s(this,D));d(this,bt,e)}async ignoreReports(){await _.ignoreReports(this.id,s(this,D)),d(this,er,!0)}async unignoreReports(){await _.unignoreReports(this.id,s(this,D)),d(this,er,!1)}async getAuthor(){return w.getByUsername(s(this,rn),s(this,D))}async crosspost(e){return _.crosspost({...e,postId:this.id},s(this,D))}addRemovalNote(e){return Me.addRemovalNote({itemIds:[s(this,tn)],...e},s(this,D))}async getEnrichedThumbnail(){return XR({id:this.id},s(this,D))}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 _(a.data,t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,n;if("preview"in e){v(t,"Missing metadata in `SubmitPostOptions`");let c=await new pt(()=>e.preview,void 0,{},t,void 0).buildBlocksUI(),p=IS.encode(c).finish(),{textFallback:g,...h}=e,m=g?Fm(g):"",y={kind:"custom",sr:e.subredditName,richtextJson:(0,Tm.fromByteArray)(p),richtextFallback:m,...h};n=await i.SubmitCustomPost(y,t)}else n=await i.Submit({kind:"kind"in e?e.kind:"url"in e?"link":"self",sr:e.subredditName,richtextJson:"richtext"in e?ji(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 _.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:ve(n),...a},t);if(!c.json?.data?.id||c.json?.errors?.length)throw new Error("failed to crosspost post");return _.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=ji(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 _.getById(n,t)}static async setSuggestedCommentSort(e,t){if(!(await re.query("SetSuggestedSort","cf6052acc7fefaa65b710625b81dba8041f258313aafe9730e2a3dc855e5d10d",{input:{subredditId:e.subredditId,postId:e.id,sort:e.suggestedSort}},t)).data?.setSuggestedSort?.ok)throw new Error("Failed to set suggested sort")}static async setCustomPostPreview(e,t){if(!t)throw new Error("Failed to set custom post preview. Metadata not found");let i=u.redditAPIPlugins.LinksAndComments,n=new Fr(e.ui),a=$R.fromJSON(await n.handle({events:[]},t)).blocks,c=(0,Tm.fromByteArray)(IS.encode(a).finish());await i.SetCustomPostPreview({thingId:e.id,bodyType:KR.BLOCKS,blocksRenderContent:c},t)}static async setTextFallback(e,t,i){if(!("text"in e)&&!("richtext"in e))throw new Error(`No text fallback provided for post ${t}.`);let n=u.redditAPIPlugins.LinksAndComments,o=Fm(e);if((await n.EditCustomPost({thingId:t,richtextFallback:o},i)).json?.errors?.length)throw new Error("Failed to set post text fallback");return _.getById(t,i)}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 v(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 v(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 V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Sort({show:"all",sort:e.sort,t:e.timeframe,subreddit:e.subredditName,...n},t);return js(o,t)}})}static getHotPosts(e={location:"GLOBAL"},t){let i=u.redditAPIPlugins.Listings;return new V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Hot({g:e.location,show:"all",subreddit:e.subredditName,...n},t);return js(o,t)}})}static getNewPosts(e,t){let i=u.redditAPIPlugins.Listings;return new V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.New({show:"all",subreddit:e.subredditName,...n},t);return js(o,t)}})}static getRisingPosts(e,t){let i=u.redditAPIPlugins.Listings;return new V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Rising({show:"all",subreddit:e.subredditName,...n},t);return js(o,t)}})}static getPostsByUser(e,t){let i=u.redditAPIPlugins.Users;return new V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"submitted",...n},t);return js(o,t)}})}};tn=new WeakMap,Ws=new WeakMap,rn=new WeakMap,Gs=new WeakMap,nn=new WeakMap,Vs=new WeakMap,zs=new WeakMap,Js=new WeakMap,Nr=new WeakMap,$s=new WeakMap,Ks=new WeakMap,Xs=new WeakMap,Zs=new WeakMap,Qs=new WeakMap,Ys=new WeakMap,Jt=new WeakMap,eo=new WeakMap,to=new WeakMap,_r=new WeakMap,sn=new WeakMap,$t=new WeakMap,on=new WeakMap,an=new WeakMap,dn=new WeakMap,Kt=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,ln=new WeakMap,Qt=new WeakMap,Yt=new WeakMap,er=new WeakMap,bt=new WeakMap,ro=new WeakMap,io=new WeakMap,un=new WeakMap,cn=new WeakMap,D=new WeakMap;var z=_;function js(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}}async function XR(r,e){let o=(await re.query("GetThumbnailV2","81580ce4e23d748c5a59a1618489b559bf4518b6a73af41f345d8d074c8b2ce9",{id:r.id},e)).data?.postInfoById?.thumbnailV2;if(o){if(!o.image)return}else throw new Error("Failed to get thumbnail");return{attribution:o.attribution,image:{url:o.image.url,width:o.image.dimensions.width,height:o.image.dimensions.height},isObfuscatedDefault:o.isObfuscatedDefault,...o.obfuscatedImage&&{obfuscatedImage:{url:o.obfuscatedImage.url,width:o.obfuscatedImage.dimensions.width,height:o.obfuscatedImage.dimensions.height}}}}var ZR=(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))(ZR||{}),no,mn,so,oo,ao,lo,uo,tr,co,mo,ot,Hr=class Hr{constructor(e,t){l(this,no);l(this,mn);l(this,so);l(this,oo);l(this,ao);l(this,lo);l(this,uo);l(this,tr,new Map);l(this,co);l(this,mo);l(this,ot);Y(this),v(e.id,"User ID is missing or undefined"),v(e.name,"Username is missing or undefined"),v(e.createdUtc,"User is missing created date"),d(this,no,oe(ed(e.id)?e.id:`t2_${e.id}`)),d(this,mn,e.name),d(this,lo,e.over18??!1),d(this,uo,e.isEmployee??!1);let i=new Date(0);if(i.setUTCSeconds(e.createdUtc),d(this,so,i),d(this,oo,e.linkKarma??0),d(this,ao,e.commentKarma??0),e.modPermissions)for(let[n,o]of Object.entries(e.modPermissions))s(this,tr).set(n,SS(o));d(this,co,new URL(e.subreddit?.url??"","https://www.reddit.com").toString()),d(this,mo,e.subreddit?.url??""),d(this,ot,t)}get id(){return s(this,no)}get username(){return s(this,mn)}get createdAt(){return s(this,so)}get linkKarma(){return s(this,oo)}get commentKarma(){return s(this,ao)}get nsfw(){return s(this,lo)}get isAdmin(){return s(this,uo)}get modPermissions(){return s(this,tr)}get url(){return s(this,co)}get permalink(){return s(this,mo)}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 Hr.getSubredditUsersByType({subredditName:e,type:"moderators",username:this.username},s(this,ot)).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 te.getCommentsByUser({username:this.username,...e},s(this,ot))}getPosts(e){return z.getPostsByUser({username:this.username,...e},s(this,ot))}async getUserFlairBySubreddit(e){let t=await Ue.getUserFlairBySubreddit({subreddit:e,name:s(this,mn)},s(this,ot));return t.users[0]?qs(t.users[0]):void 0}getSnoovatarUrl(){return Hr.getSnoovatarUrl(this.username,s(this,ot))}async getSocialLinks(){let i=await re.query("GetUserSocialLinks","2aca18ef5f4fc75fb91cdaace3e9aeeae2cb3843b5c26ad511e6f01b8521593a",{name:this.username},s(this,ot));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 i=await xS(e,t);return i==null?void 0:Hr.getByUsername(i,t)}static async getByUsername(e,t){let i=u.redditAPIPlugins.Users;try{let n=await i.UserAbout({username:e},t);if(n.data?.id)return new Hr(n.data,t)}catch(n){if(n instanceof Error&&n.message.includes("404 Not Found"))return;throw n}}static async getFromMetadata(e,t){v(t);let i=t?.[e]?.values[0];return i?Hr.getById(oe(i),t):Promise.resolve(void 0)}static getSubredditUsersByType(e,t){let i=u.redditAPIPlugins.Subreddits;return new V({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 YR(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?Pm(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:Pm(i)},n);if(a.json?.errors?.length)throw new Error(a.json.errors.join(`
|