@devvit/public-api 0.10.19-next-2024-04-10-2178a091f.0 → 0.10.19-next-2024-04-10-49abb33fb.0

Sign up to get free protection for your applications and to get access to all the features.
package/public-api.min.js CHANGED
@@ -1,8 +1,8 @@
1
- var gP=Object.create;var Tm=Object.defineProperty;var hP=Object.getOwnPropertyDescriptor;var yP=Object.getOwnPropertyNames;var vP=Object.getPrototypeOf,bP=Object.prototype.hasOwnProperty;var b=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var PP=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of yP(e))!bP.call(r,n)&&n!==t&&Tm(r,n,{get:()=>e[n],enumerable:!(i=hP(e,n))||i.enumerable});return r};var xn=(r,e,t)=>(t=r!=null?gP(vP(r)):{},PP(e||!r||!r.__esModule?Tm(t,"default",{value:r,enumerable:!0}):t,r));var fl=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var s=(r,e,t)=>(fl(r,e,"read from private field"),t?t.call(r):e.get(r)),l=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},d=(r,e,t,i)=>(fl(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t);var k=(r,e,t)=>(fl(r,e,"access private method"),t);var oe=b((pB,Rm)=>{Rm.exports=function(r){try{return!!r()}catch{return!0}}});var la=b((fB,Fm)=>{var kP=oe();Fm.exports=!kP(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var J=b((gB,Um)=>{var Bm=la(),Om=Function.prototype,gl=Om.call,SP=Bm&&Om.bind.bind(gl,gl);Um.exports=Bm?SP:function(r){return function(){return gl.apply(r,arguments)}}});var Lm=b((hB,Mm)=>{var wP=Math.ceil,CP=Math.floor;Mm.exports=Math.trunc||function(e){var t=+e;return(t>0?CP:wP)(t)}});var ua=b((yB,Dm)=>{var xP=Lm();Dm.exports=function(r){var e=+r;return e!==e||e===0?0:xP(e)}});var me=b((vB,_m)=>{var ca=function(r){return r&&r.Math==Math&&r};_m.exports=ca(typeof globalThis=="object"&&globalThis)||ca(typeof window=="object"&&window)||ca(typeof self=="object"&&self)||ca(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var Er=b((bB,Nm)=>{Nm.exports=!1});var ma=b((PB,Hm)=>{var qm=me(),IP=Object.defineProperty;Hm.exports=function(r,e){try{IP(qm,r,{value:e,configurable:!0,writable:!0})}catch{qm[r]=e}return e}});var pa=b((kB,Wm)=>{var AP=me(),EP=ma(),jm="__core-js_shared__",TP=AP[jm]||EP(jm,{});Wm.exports=TP});var hl=b((SB,zm)=>{var RP=Er(),Gm=pa();(zm.exports=function(r,e){return Gm[r]||(Gm[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:RP?"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=b((wB,Vm)=>{Vm.exports=function(r){return r==null}});var ga=b((CB,$m)=>{var FP=fa(),BP=TypeError;$m.exports=function(r){if(FP(r))throw BP("Can't call method on "+r);return r}});var In=b((xB,Jm)=>{var OP=ga(),UP=Object;Jm.exports=function(r){return UP(OP(r))}});var we=b((IB,Km)=>{var MP=J(),LP=In(),DP=MP({}.hasOwnProperty);Km.exports=Object.hasOwn||function(e,t){return DP(LP(e),t)}});var yl=b((AB,Xm)=>{var _P=J(),NP=0,qP=Math.random(),HP=_P(1 .toString);Xm.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+HP(++NP+qP,36)}});var Ym=b((EB,Zm)=>{Zm.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var sp=b((TB,np)=>{var ip=me(),vl=Ym(),Qm=ip.process,ep=ip.Deno,tp=Qm&&Qm.versions||ep&&ep.version,rp=tp&&tp.v8,qe,ha;rp&&(qe=rp.split("."),ha=qe[0]>0&&qe[0]<4?1:+(qe[0]+qe[1]));!ha&&vl&&(qe=vl.match(/Edge\/(\d+)/),(!qe||qe[1]>=74)&&(qe=vl.match(/Chrome\/(\d+)/),qe&&(ha=+qe[1])));np.exports=ha});var bl=b((RB,ap)=>{var op=sp(),jP=oe();ap.exports=!!Object.getOwnPropertySymbols&&!jP(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&op&&op<41})});var Pl=b((FB,dp)=>{var WP=bl();dp.exports=WP&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ce=b((BB,up)=>{var GP=me(),zP=hl(),lp=we(),VP=yl(),$P=bl(),JP=Pl(),Tr=GP.Symbol,kl=zP("wks"),KP=JP?Tr.for||Tr:Tr&&Tr.withoutSetter||VP;up.exports=function(r){return lp(kl,r)||(kl[r]=$P&&lp(Tr,r)?Tr[r]:KP("Symbol."+r)),kl[r]}});var pp=b((OB,mp)=>{var XP=Ce(),ZP=XP("toStringTag"),cp={};cp[ZP]="z";mp.exports=String(cp)==="[object z]"});var wl=b((UB,fp)=>{var Sl=typeof document=="object"&&document.all,YP=typeof Sl>"u"&&Sl!==void 0;fp.exports={all:Sl,IS_HTMLDDA:YP}});var K=b((MB,hp)=>{var gp=wl(),QP=gp.all;hp.exports=gp.IS_HTMLDDA?function(r){return typeof r=="function"||r===QP}:function(r){return typeof r=="function"}});var ya=b((LB,vp)=>{var yp=J(),ek=yp({}.toString),tk=yp("".slice);vp.exports=function(r){return tk(ek(r),8,-1)}});var An=b((DB,bp)=>{var rk=pp(),ik=K(),va=ya(),nk=Ce(),sk=nk("toStringTag"),ok=Object,ak=va(function(){return arguments}())=="Arguments",dk=function(r,e){try{return r[e]}catch{}};bp.exports=rk?va:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=dk(e=ok(r),sk))=="string"?t:ak?va(e):(i=va(e))=="Object"&&ik(e.callee)?"Arguments":i}});var En=b((_B,Pp)=>{var lk=An(),uk=String;Pp.exports=function(r){if(lk(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return uk(r)}});var xl=b((NB,wp)=>{var Cl=J(),ck=ua(),mk=En(),pk=ga(),fk=Cl("".charAt),kp=Cl("".charCodeAt),gk=Cl("".slice),Sp=function(r){return function(e,t){var i=mk(pk(e)),n=ck(t),o=i.length,a,u;return n<0||n>=o?r?"":void 0:(a=kp(i,n),a<55296||a>56319||n+1===o||(u=kp(i,n+1))<56320||u>57343?r?fk(i,n):a:r?gk(i,n,n+2):(a-55296<<10)+(u-56320)+65536)}};wp.exports={codeAt:Sp(!1),charAt:Sp(!0)}});var Ip=b((qB,xp)=>{var hk=me(),yk=K(),Cp=hk.WeakMap;xp.exports=yk(Cp)&&/native code/.test(String(Cp))});var vt=b((HB,Tp)=>{var Ap=K(),Ep=wl(),vk=Ep.all;Tp.exports=Ep.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:Ap(r)||r===vk}:function(r){return typeof r=="object"?r!==null:Ap(r)}});var pe=b((jB,Rp)=>{var bk=oe();Rp.exports=!bk(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var Al=b((WB,Bp)=>{var Pk=me(),Fp=vt(),Il=Pk.document,kk=Fp(Il)&&Fp(Il.createElement);Bp.exports=function(r){return kk?Il.createElement(r):{}}});var El=b((GB,Op)=>{var Sk=pe(),wk=oe(),Ck=Al();Op.exports=!Sk&&!wk(function(){return Object.defineProperty(Ck("div"),"a",{get:function(){return 7}}).a!=7})});var Tl=b((zB,Up)=>{var xk=pe(),Ik=oe();Up.exports=xk&&Ik(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Xe=b((VB,Mp)=>{var Ak=vt(),Ek=String,Tk=TypeError;Mp.exports=function(r){if(Ak(r))return r;throw Tk(Ek(r)+" is not an object")}});var He=b(($B,Lp)=>{var Rk=la(),ba=Function.prototype.call;Lp.exports=Rk?ba.bind(ba):function(){return ba.apply(ba,arguments)}});var Tn=b((JB,Dp)=>{var Rl=me(),Fk=K(),Bk=function(r){return Fk(r)?r:void 0};Dp.exports=function(r,e){return arguments.length<2?Bk(Rl[r]):Rl[r]&&Rl[r][e]}});var Fl=b((KB,_p)=>{var Ok=J();_p.exports=Ok({}.isPrototypeOf)});var Bl=b((XB,Np)=>{var Uk=Tn(),Mk=K(),Lk=Fl(),Dk=Pl(),_k=Object;Np.exports=Dk?function(r){return typeof r=="symbol"}:function(r){var e=Uk("Symbol");return Mk(e)&&Lk(e.prototype,_k(r))}});var Ol=b((ZB,qp)=>{var Nk=String;qp.exports=function(r){try{return Nk(r)}catch{return"Object"}}});var Pa=b((YB,Hp)=>{var qk=K(),Hk=Ol(),jk=TypeError;Hp.exports=function(r){if(qk(r))return r;throw jk(Hk(r)+" is not a function")}});var ka=b((QB,jp)=>{var Wk=Pa(),Gk=fa();jp.exports=function(r,e){var t=r[e];return Gk(t)?void 0:Wk(t)}});var Gp=b((eO,Wp)=>{var Ul=He(),Ml=K(),Ll=vt(),zk=TypeError;Wp.exports=function(r,e){var t,i;if(e==="string"&&Ml(t=r.toString)&&!Ll(i=Ul(t,r))||Ml(t=r.valueOf)&&!Ll(i=Ul(t,r))||e!=="string"&&Ml(t=r.toString)&&!Ll(i=Ul(t,r)))return i;throw zk("Can't convert object to primitive value")}});var Jp=b((tO,$p)=>{var Vk=He(),zp=vt(),Vp=Bl(),$k=ka(),Jk=Gp(),Kk=Ce(),Xk=TypeError,Zk=Kk("toPrimitive");$p.exports=function(r,e){if(!zp(r)||Vp(r))return r;var t=$k(r,Zk),i;if(t){if(e===void 0&&(e="default"),i=Vk(t,r,e),!zp(i)||Vp(i))return i;throw Xk("Can't convert object to primitive value")}return e===void 0&&(e="number"),Jk(r,e)}});var Sa=b((rO,Kp)=>{var Yk=Jp(),Qk=Bl();Kp.exports=function(r){var e=Yk(r,"string");return Qk(e)?e:e+""}});var Ze=b(Zp=>{var eS=pe(),tS=El(),rS=Tl(),wa=Xe(),Xp=Sa(),iS=TypeError,Dl=Object.defineProperty,nS=Object.getOwnPropertyDescriptor,_l="enumerable",Nl="configurable",ql="writable";Zp.f=eS?rS?function(e,t,i){if(wa(e),t=Xp(t),wa(i),typeof e=="function"&&t==="prototype"&&"value"in i&&ql in i&&!i[ql]){var n=nS(e,t);n&&n[ql]&&(e[t]=i.value,i={configurable:Nl in i?i[Nl]:n[Nl],enumerable:_l in i?i[_l]:n[_l],writable:!1})}return Dl(e,t,i)}:Dl:function(e,t,i){if(wa(e),t=Xp(t),wa(i),tS)try{return Dl(e,t,i)}catch{}if("get"in i||"set"in i)throw iS("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var Rr=b((nO,Yp)=>{Yp.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Ca=b((sO,Qp)=>{var sS=pe(),oS=Ze(),aS=Rr();Qp.exports=sS?function(r,e,t){return oS.f(r,e,aS(1,t))}:function(r,e,t){return r[e]=t,r}});var xa=b((oO,tf)=>{var dS=hl(),lS=yl(),ef=dS("keys");tf.exports=function(r){return ef[r]||(ef[r]=lS(r))}});var Ia=b((aO,rf)=>{rf.exports={}});var Fr=b((dO,of)=>{var uS=Ip(),sf=me(),cS=vt(),mS=Ca(),Hl=we(),jl=pa(),pS=xa(),fS=Ia(),nf="Object already initialized",Wl=sf.TypeError,gS=sf.WeakMap,Aa,Rn,Ea,hS=function(r){return Ea(r)?Rn(r):Aa(r,{})},yS=function(r){return function(e){var t;if(!cS(e)||(t=Rn(e)).type!==r)throw Wl("Incompatible receiver, "+r+" required");return t}};uS||jl.state?(je=jl.state||(jl.state=new gS),je.get=je.get,je.has=je.has,je.set=je.set,Aa=function(r,e){if(je.has(r))throw Wl(nf);return e.facade=r,je.set(r,e),e},Rn=function(r){return je.get(r)||{}},Ea=function(r){return je.has(r)}):(Kt=pS("state"),fS[Kt]=!0,Aa=function(r,e){if(Hl(r,Kt))throw Wl(nf);return e.facade=r,mS(r,Kt,e),e},Rn=function(r){return Hl(r,Kt)?r[Kt]:{}},Ea=function(r){return Hl(r,Kt)});var je,Kt;of.exports={set:Aa,get:Rn,has:Ea,enforce:hS,getterFor:yS}});var Gl=b(lf=>{"use strict";var af={}.propertyIsEnumerable,df=Object.getOwnPropertyDescriptor,vS=df&&!af.call({1:2},1);lf.f=vS?function(e){var t=df(this,e);return!!t&&t.enumerable}:af});var Vl=b((uO,uf)=>{var bS=J(),PS=oe(),kS=ya(),zl=Object,SS=bS("".split);uf.exports=PS(function(){return!zl("z").propertyIsEnumerable(0)})?function(r){return kS(r)=="String"?SS(r,""):zl(r)}:zl});var Br=b((cO,cf)=>{var wS=Vl(),CS=ga();cf.exports=function(r){return wS(CS(r))}});var $l=b(pf=>{var xS=pe(),IS=He(),AS=Gl(),ES=Rr(),TS=Br(),RS=Sa(),FS=we(),BS=El(),mf=Object.getOwnPropertyDescriptor;pf.f=xS?mf:function(e,t){if(e=TS(e),t=RS(t),BS)try{return mf(e,t)}catch{}if(FS(e,t))return ES(!IS(AS.f,e,t),e[t])}});var Xl=b((pO,gf)=>{var Jl=pe(),OS=we(),ff=Function.prototype,US=Jl&&Object.getOwnPropertyDescriptor,Kl=OS(ff,"name"),MS=Kl&&function(){}.name==="something",LS=Kl&&(!Jl||Jl&&US(ff,"name").configurable);gf.exports={EXISTS:Kl,PROPER:MS,CONFIGURABLE:LS}});var Yl=b((fO,hf)=>{var DS=J(),_S=K(),Zl=pa(),NS=DS(Function.toString);_S(Zl.inspectSource)||(Zl.inspectSource=function(r){return NS(r)});hf.exports=Zl.inspectSource});var tu=b((gO,bf)=>{var eu=J(),qS=oe(),HS=K(),Ta=we(),Ql=pe(),jS=Xl().CONFIGURABLE,WS=Yl(),vf=Fr(),GS=vf.enforce,zS=vf.get,yf=String,Ra=Object.defineProperty,VS=eu("".slice),$S=eu("".replace),JS=eu([].join),KS=Ql&&!qS(function(){return Ra(function(){},"length",{value:8}).length!==8}),XS=String(String).split("String"),ZS=bf.exports=function(r,e,t){VS(yf(e),0,7)==="Symbol("&&(e="["+$S(yf(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Ta(r,"name")||jS&&r.name!==e)&&(Ql?Ra(r,"name",{value:e,configurable:!0}):r.name=e),KS&&t&&Ta(t,"arity")&&r.length!==t.arity&&Ra(r,"length",{value:t.arity});try{t&&Ta(t,"constructor")&&t.constructor?Ql&&Ra(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=GS(r);return Ta(i,"source")||(i.source=JS(XS,typeof e=="string"?e:"")),r};Function.prototype.toString=ZS(function(){return HS(this)&&zS(this).source||WS(this)},"toString")});var Xt=b((hO,Pf)=>{var YS=K(),QS=Ze(),ew=tu(),tw=ma();Pf.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(YS(t)&&ew(t,o,i),i.global)n?r[e]=t:tw(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:QS.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var ru=b((yO,kf)=>{var rw=ua(),iw=Math.max,nw=Math.min;kf.exports=function(r,e){var t=rw(r);return t<0?iw(t+e,0):nw(t,e)}});var wf=b((vO,Sf)=>{var sw=ua(),ow=Math.min;Sf.exports=function(r){return r>0?ow(sw(r),9007199254740991):0}});var Fa=b((bO,Cf)=>{var aw=wf();Cf.exports=function(r){return aw(r.length)}});var Af=b((PO,If)=>{var dw=Br(),lw=ru(),uw=Fa(),xf=function(r){return function(e,t,i){var n=dw(e),o=uw(n),a=lw(i,o),u;if(r&&t!=t){for(;o>a;)if(u=n[a++],u!=u)return!0}else for(;o>a;a++)if((r||a in n)&&n[a]===t)return r||a||0;return!r&&-1}};If.exports={includes:xf(!0),indexOf:xf(!1)}});var nu=b((kO,Tf)=>{var cw=J(),iu=we(),mw=Br(),pw=Af().indexOf,fw=Ia(),Ef=cw([].push);Tf.exports=function(r,e){var t=mw(r),i=0,n=[],o;for(o in t)!iu(fw,o)&&iu(t,o)&&Ef(n,o);for(;e.length>i;)iu(t,o=e[i++])&&(~pw(n,o)||Ef(n,o));return n}});var Ba=b((SO,Rf)=>{Rf.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Bf=b(Ff=>{var gw=nu(),hw=Ba(),yw=hw.concat("length","prototype");Ff.f=Object.getOwnPropertyNames||function(e){return gw(e,yw)}});var su=b(Of=>{Of.f=Object.getOwnPropertySymbols});var Mf=b((xO,Uf)=>{var vw=Tn(),bw=J(),Pw=Bf(),kw=su(),Sw=Xe(),ww=bw([].concat);Uf.exports=vw("Reflect","ownKeys")||function(e){var t=Pw.f(Sw(e)),i=kw.f;return i?ww(t,i(e)):t}});var _f=b((IO,Df)=>{var Lf=we(),Cw=Mf(),xw=$l(),Iw=Ze();Df.exports=function(r,e,t){for(var i=Cw(e),n=Iw.f,o=xw.f,a=0;a<i.length;a++){var u=i[a];!Lf(r,u)&&!(t&&Lf(t,u))&&n(r,u,o(e,u))}}});var qf=b((AO,Nf)=>{var Aw=oe(),Ew=K(),Tw=/#|\.prototype\./,Fn=function(r,e){var t=Fw[Rw(r)];return t==Ow?!0:t==Bw?!1:Ew(e)?Aw(e):!!e},Rw=Fn.normalize=function(r){return String(r).replace(Tw,".").toLowerCase()},Fw=Fn.data={},Bw=Fn.NATIVE="N",Ow=Fn.POLYFILL="P";Nf.exports=Fn});var Bn=b((EO,Hf)=>{var ou=me(),Uw=$l().f,Mw=Ca(),Lw=Xt(),Dw=ma(),_w=_f(),Nw=qf();Hf.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,u,p,f,g;if(i?a=ou:n?a=ou[t]||Dw(t,{}):a=(ou[t]||{}).prototype,a)for(u in e){if(f=e[u],r.dontCallGetSet?(g=Uw(a,u),p=g&&g.value):p=a[u],o=Nw(i?u:t+(n?".":"#")+u,r.forced),!o&&p!==void 0){if(typeof f==typeof p)continue;_w(f,p)}(r.sham||p&&p.sham)&&Mw(f,"sham",!0),Lw(a,u,f,r)}}});var au=b((TO,jf)=>{var qw=nu(),Hw=Ba();jf.exports=Object.keys||function(e){return qw(e,Hw)}});var Gf=b(Wf=>{var jw=pe(),Ww=Tl(),Gw=Ze(),zw=Xe(),Vw=Br(),$w=au();Wf.f=jw&&!Ww?Object.defineProperties:function(e,t){zw(e);for(var i=Vw(t),n=$w(t),o=n.length,a=0,u;o>a;)Gw.f(e,u=n[a++],i[u]);return e}});var Vf=b((FO,zf)=>{var Jw=Tn();zf.exports=Jw("document","documentElement")});var On=b((BO,Qf)=>{var Kw=Xe(),Xw=Gf(),$f=Ba(),Zw=Ia(),Yw=Vf(),Qw=Al(),eC=xa(),Jf=">",Kf="<",lu="prototype",uu="script",Zf=eC("IE_PROTO"),du=function(){},Yf=function(r){return Kf+uu+Jf+r+Kf+"/"+uu+Jf},Xf=function(r){r.write(Yf("")),r.close();var e=r.parentWindow.Object;return r=null,e},tC=function(){var r=Qw("iframe"),e="java"+uu+":",t;return r.style.display="none",Yw.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(Yf("document.F=Object")),t.close(),t.F},Oa,Ua=function(){try{Oa=new ActiveXObject("htmlfile")}catch{}Ua=typeof document<"u"?document.domain&&Oa?Xf(Oa):tC():Xf(Oa);for(var r=$f.length;r--;)delete Ua[lu][$f[r]];return Ua()};Zw[Zf]=!0;Qf.exports=Object.create||function(e,t){var i;return e!==null?(du[lu]=Kw(e),i=new du,du[lu]=null,i[Zf]=e):i=Ua(),t===void 0?i:Xw.f(i,t)}});var tg=b((OO,eg)=>{var rC=oe();eg.exports=!rC(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var mu=b((UO,ig)=>{var iC=we(),nC=K(),sC=In(),oC=xa(),aC=tg(),rg=oC("IE_PROTO"),cu=Object,dC=cu.prototype;ig.exports=aC?cu.getPrototypeOf:function(r){var e=sC(r);if(iC(e,rg))return e[rg];var t=e.constructor;return nC(t)&&e instanceof t?t.prototype:e instanceof cu?dC:null}});var hu=b((MO,og)=>{"use strict";var lC=oe(),uC=K(),cC=vt(),mC=On(),ng=mu(),pC=Xt(),fC=Ce(),gC=Er(),gu=fC("iterator"),sg=!1,nt,pu,fu;[].keys&&(fu=[].keys(),"next"in fu?(pu=ng(ng(fu)),pu!==Object.prototype&&(nt=pu)):sg=!0);var hC=!cC(nt)||lC(function(){var r={};return nt[gu].call(r)!==r});hC?nt={}:gC&&(nt=mC(nt));uC(nt[gu])||pC(nt,gu,function(){return this});og.exports={IteratorPrototype:nt,BUGGY_SAFARI_ITERATORS:sg}});var Un=b((LO,dg)=>{var yC=Ze().f,vC=we(),bC=Ce(),ag=bC("toStringTag");dg.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!vC(r,ag)&&yC(r,ag,{configurable:!0,value:e})}});var Or=b((DO,lg)=>{lg.exports={}});var yu=b((_O,ug)=>{"use strict";var PC=hu().IteratorPrototype,kC=On(),SC=Rr(),wC=Un(),CC=Or(),xC=function(){return this};ug.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=kC(PC,{next:SC(+!i,t)}),wC(r,n,!1,!0),CC[n]=xC,r}});var mg=b((NO,cg)=>{var IC=K(),AC=String,EC=TypeError;cg.exports=function(r){if(typeof r=="object"||IC(r))return r;throw EC("Can't set "+AC(r)+" as a prototype")}});var fg=b((qO,pg)=>{var TC=J(),RC=Xe(),FC=mg();pg.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=TC(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return RC(n),FC(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var bu=b((HO,Cg)=>{"use strict";var BC=Bn(),OC=He(),Ma=Er(),Sg=Xl(),UC=K(),MC=yu(),gg=mu(),hg=fg(),LC=Un(),DC=Ca(),vu=Xt(),_C=Ce(),yg=Or(),wg=hu(),NC=Sg.PROPER,qC=Sg.CONFIGURABLE,vg=wg.IteratorPrototype,La=wg.BUGGY_SAFARI_ITERATORS,Mn=_C("iterator"),bg="keys",Ln="values",Pg="entries",kg=function(){return this};Cg.exports=function(r,e,t,i,n,o,a){MC(t,e,i);var u=function(D){if(D===n&&h)return h;if(!La&&D in g)return g[D];switch(D){case bg:return function(){return new t(this,D)};case Ln:return function(){return new t(this,D)};case Pg:return function(){return new t(this,D)}}return function(){return new t(this)}},p=e+" Iterator",f=!1,g=r.prototype,c=g[Mn]||g["@@iterator"]||n&&g[n],h=!La&&c||u(n),P=e=="Array"&&g.entries||c,w,I,E;if(P&&(w=gg(P.call(new r)),w!==Object.prototype&&w.next&&(!Ma&&gg(w)!==vg&&(hg?hg(w,vg):UC(w[Mn])||vu(w,Mn,kg)),LC(w,p,!0,!0),Ma&&(yg[p]=kg))),NC&&n==Ln&&c&&c.name!==Ln&&(!Ma&&qC?DC(g,"name",Ln):(f=!0,h=function(){return OC(c,this)})),n)if(I={values:u(Ln),keys:o?h:u(bg),entries:u(Pg)},a)for(E in I)(La||f||!(E in g))&&vu(g,E,I[E]);else BC({target:e,proto:!0,forced:La||f},I);return(!Ma||a)&&g[Mn]!==h&&vu(g,Mn,h,{name:n}),yg[e]=h,I}});var Pu=b((jO,xg)=>{xg.exports=function(r,e){return{value:r,done:e}}});var Tg=b(()=>{"use strict";var HC=xl().charAt,jC=En(),Ag=Fr(),WC=bu(),Ig=Pu(),Eg="String Iterator",GC=Ag.set,zC=Ag.getterFor(Eg);WC(String,"String",function(r){GC(this,{type:Eg,string:jC(r),index:0})},function(){var e=zC(this),t=e.string,i=e.index,n;return i>=t.length?Ig(void 0,!0):(n=HC(t,i),e.index+=n.length,Ig(n,!1))})});var ku=b((zO,Rg)=>{var VC=oe(),$C=Ce(),JC=Er(),KC=$C("iterator");Rg.exports=!VC(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}),JC&&!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[KC]||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 Bg=b((VO,Fg)=>{var XC=ya(),ZC=J();Fg.exports=function(r){if(XC(r)==="Function")return ZC(r)}});var Da=b(($O,Ug)=>{var Og=Bg(),YC=Pa(),QC=la(),ex=Og(Og.bind);Ug.exports=function(r,e){return YC(r),e===void 0?r:QC?ex(r,e):function(){return r.apply(e,arguments)}}});var Dg=b((JO,Lg)=>{var Mg=tu(),tx=Ze();Lg.exports=function(r,e,t){return t.get&&Mg(t.get,e,{getter:!0}),t.set&&Mg(t.set,e,{setter:!0}),tx.f(r,e,t)}});var Su=b((KO,_g)=>{var rx=Fl(),ix=TypeError;_g.exports=function(r,e){if(rx(e,r))return r;throw ix("Incorrect invocation")}});var jg=b((XO,Hg)=>{"use strict";var Ng=pe(),nx=J(),sx=He(),ox=oe(),wu=au(),ax=su(),dx=Gl(),lx=In(),ux=Vl(),Ur=Object.assign,qg=Object.defineProperty,cx=nx([].concat);Hg.exports=!Ur||ox(function(){if(Ng&&Ur({b:1},Ur(qg({},"a",{enumerable:!0,get:function(){qg(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}),Ur({},r)[t]!=7||wu(Ur({},e)).join("")!=i})?function(e,t){for(var i=lx(e),n=arguments.length,o=1,a=ax.f,u=dx.f;n>o;)for(var p=ux(arguments[o++]),f=a?cx(wu(p),a(p)):wu(p),g=f.length,c=0,h;g>c;)h=f[c++],(!Ng||sx(u,p,h))&&(i[h]=p[h]);return i}:Ur});var zg=b((ZO,Gg)=>{var mx=He(),Wg=Xe(),px=ka();Gg.exports=function(r,e,t){var i,n;Wg(r);try{if(i=px(r,"return"),!i){if(e==="throw")throw t;return t}i=mx(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Wg(i),t}});var $g=b((YO,Vg)=>{var fx=Xe(),gx=zg();Vg.exports=function(r,e,t,i){try{return i?e(fx(t)[0],t[1]):e(t)}catch(n){gx(r,"throw",n)}}});var Kg=b((QO,Jg)=>{var hx=Ce(),yx=Or(),vx=hx("iterator"),bx=Array.prototype;Jg.exports=function(r){return r!==void 0&&(yx.Array===r||bx[vx]===r)}});var th=b((eU,eh)=>{var Px=J(),kx=oe(),Xg=K(),Sx=An(),wx=Tn(),Cx=Yl(),Zg=function(){},xx=[],Yg=wx("Reflect","construct"),Cu=/^\s*(?:class|function)\b/,Ix=Px(Cu.exec),Ax=!Cu.exec(Zg),Dn=function(e){if(!Xg(e))return!1;try{return Yg(Zg,xx,e),!0}catch{return!1}},Qg=function(e){if(!Xg(e))return!1;switch(Sx(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ax||!!Ix(Cu,Cx(e))}catch{return!0}};Qg.sham=!0;eh.exports=!Yg||kx(function(){var r;return Dn(Dn.call)||!Dn(Object)||!Dn(function(){r=!0})||r})?Qg:Dn});var xu=b((tU,rh)=>{"use strict";var Ex=Sa(),Tx=Ze(),Rx=Rr();rh.exports=function(r,e,t){var i=Ex(e);i in r?Tx.f(r,i,Rx(0,t)):r[i]=t}});var _a=b((rU,nh)=>{var Fx=An(),ih=ka(),Bx=fa(),Ox=Or(),Ux=Ce(),Mx=Ux("iterator");nh.exports=function(r){if(!Bx(r))return ih(r,Mx)||ih(r,"@@iterator")||Ox[Fx(r)]}});var Iu=b((iU,sh)=>{var Lx=He(),Dx=Pa(),_x=Xe(),Nx=Ol(),qx=_a(),Hx=TypeError;sh.exports=function(r,e){var t=arguments.length<2?qx(r):e;if(Dx(t))return _x(Lx(t,r));throw Hx(Nx(r)+" is not iterable")}});var lh=b((nU,dh)=>{"use strict";var jx=Da(),Wx=He(),Gx=In(),zx=$g(),Vx=Kg(),$x=th(),Jx=Fa(),oh=xu(),Kx=Iu(),Xx=_a(),ah=Array;dh.exports=function(e){var t=Gx(e),i=$x(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=jx(o,n>2?arguments[2]:void 0));var u=Xx(t),p=0,f,g,c,h,P,w;if(u&&!(this===ah&&Vx(u)))for(h=Kx(t,u),P=h.next,g=i?new this:[];!(c=Wx(P,h)).done;p++)w=a?zx(h,o,[c.value,p],!0):c.value,oh(g,p,w);else for(f=Jx(t),g=i?new this(f):ah(f);f>p;p++)w=a?o(t[p],p):t[p],oh(g,p,w);return g.length=p,g}});var Au=b((sU,ch)=>{var uh=ru(),Zx=Fa(),Yx=xu(),Qx=Array,eI=Math.max;ch.exports=function(r,e,t){for(var i=Zx(r),n=uh(e,i),o=uh(t===void 0?i:t,i),a=Qx(eI(o-n,0)),u=0;n<o;n++,u++)Yx(a,u,r[n]);return a.length=u,a}});var Ph=b((oU,bh)=>{var Zt=J(),Eu=2147483647,_n=36,hh=1,Fu=26,tI=38,rI=700,iI=72,nI=128,sI="-",oI=/[^\0-\u007E]/,yh=/[.\u3002\uFF0E\uFF61]/g,mh="Overflow: input needs wider integers to process",Tu=_n-hh,ph=RangeError,aI=Zt(yh.exec),Mr=Math.floor,Ru=String.fromCharCode,fh=Zt("".charCodeAt),vh=Zt([].join),bt=Zt([].push),dI=Zt("".replace),lI=Zt("".split),uI=Zt("".toLowerCase),cI=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=fh(r,t++);if(n>=55296&&n<=56319&&t<i){var o=fh(r,t++);(o&64512)==56320?bt(e,((n&1023)<<10)+(o&1023)+65536):(bt(e,n),t--)}else bt(e,n)}return e},gh=function(r){return r+22+75*(r<26)},mI=function(r,e,t){var i=0;for(r=t?Mr(r/rI):r>>1,r+=Mr(r/e);r>Tu*Fu>>1;)r=Mr(r/Tu),i+=_n;return Mr(i+(Tu+1)*r/(r+tI))},pI=function(r){var e=[];r=cI(r);var t=r.length,i=nI,n=0,o=iI,a,u;for(a=0;a<r.length;a++)u=r[a],u<128&&bt(e,Ru(u));var p=e.length,f=p;for(p&&bt(e,sI);f<t;){var g=Eu;for(a=0;a<r.length;a++)u=r[a],u>=i&&u<g&&(g=u);var c=f+1;if(g-i>Mr((Eu-n)/c))throw ph(mh);for(n+=(g-i)*c,i=g,a=0;a<r.length;a++){if(u=r[a],u<i&&++n>Eu)throw ph(mh);if(u==i){for(var h=n,P=_n;;){var w=P<=o?hh:P>=o+Fu?Fu:P-o;if(h<w)break;var I=h-w,E=_n-w;bt(e,Ru(gh(w+I%E))),h=Mr(I/E),P+=_n}bt(e,Ru(gh(h))),o=mI(n,c,f==p),n=0,f++}}n++,i++}return vh(e,"")};bh.exports=function(r){var e=[],t=lI(dI(uI(r),yh,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],bt(e,aI(oI,n)?"xn--"+pI(n):n);return vh(e,".")}});var Bu=b((aU,kh)=>{var fI=TypeError;kh.exports=function(r,e){if(r<e)throw fI("Not enough arguments");return r}});var wh=b((dU,Sh)=>{var gI=Ce(),hI=On(),yI=Ze().f,Ou=gI("unscopables"),Uu=Array.prototype;Uu[Ou]==null&&yI(Uu,Ou,{configurable:!0,value:hI(null)});Sh.exports=function(r){Uu[Ou][r]=!0}});var Th=b((lU,Eh)=>{"use strict";var vI=Br(),Mu=wh(),Ch=Or(),Ih=Fr(),bI=Ze().f,PI=bu(),Na=Pu(),kI=Er(),SI=pe(),Ah="Array Iterator",wI=Ih.set,CI=Ih.getterFor(Ah);Eh.exports=PI(Array,"Array",function(r,e){wI(this,{type:Ah,target:vI(r),index:0,kind:e})},function(){var r=CI(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,Na(void 0,!0)):t=="keys"?Na(i,!1):t=="values"?Na(e[i],!1):Na([i,e[i]],!1)},"values");var xh=Ch.Arguments=Ch.Array;Mu("keys");Mu("values");Mu("entries");if(!kI&&SI&&xh.name!=="values")try{bI(xh,"name",{value:"values"})}catch{}});var Fh=b((uU,Rh)=>{var xI=Xt();Rh.exports=function(r,e,t){for(var i in e)xI(r,i,e[i],t);return r}});var Uh=b((cU,Oh)=>{var Bh=Au(),II=Math.floor,Lu=function(r,e){var t=r.length,i=II(t/2);return t<8?AI(r,e):EI(r,Lu(Bh(r,0,i),e),Lu(Bh(r,i),e),e)},AI=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},EI=function(r,e,t,i){for(var n=e.length,o=t.length,a=0,u=0;a<n||u<o;)r[a+u]=a<n&&u<o?i(e[a],t[u])<=0?e[a++]:t[u++]:a<n?e[a++]:t[u++];return r};Oh.exports=Lu});var Vu=b((mU,ey)=>{"use strict";Th();var Hu=Bn(),Dr=me(),qa=He(),Ye=J(),TI=pe(),Vh=ku(),$h=Xt(),RI=Fh(),FI=Un(),BI=yu(),Gu=Fr(),Jh=Su(),Du=K(),OI=we(),UI=Da(),MI=An(),LI=Xe(),Kh=vt(),fe=En(),DI=On(),Mh=Rr(),ju=Iu(),_I=_a(),Lr=Bu(),NI=Ce(),qI=Uh(),HI=NI("iterator"),Hn="URLSearchParams",Xh=Hn+"Iterator",Zh=Gu.set,We=Gu.getterFor(Hn),jI=Gu.getterFor(Xh),WI=Object.getOwnPropertyDescriptor,zu=function(r){if(!TI)return Dr[r];var e=WI(Dr,r);return e&&e.value},Lh=zu("fetch"),ja=zu("Request"),Nn=zu("Headers"),_u=ja&&ja.prototype,Dh=Nn&&Nn.prototype,GI=Dr.RegExp,zI=Dr.TypeError,Yh=Dr.decodeURIComponent,VI=Dr.encodeURIComponent,$I=Ye("".charAt),_h=Ye([].join),Yt=Ye([].push),Wu=Ye("".replace),JI=Ye([].shift),Nh=Ye([].splice),qh=Ye("".split),KI=Ye("".slice),XI=/\+/g,Hh=Array(4),ZI=function(r){return Hh[r-1]||(Hh[r-1]=GI("((?:%[\\da-f]{2}){"+r+"})","gi"))},YI=function(r){try{return Yh(r)}catch{return r}},jh=function(r){var e=Wu(r,XI," "),t=4;try{return Yh(e)}catch{for(;t;)e=Wu(e,ZI(t--),YI);return e}},QI=/[!'()~]|%20/g,eA={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},tA=function(r){return eA[r]},Wh=function(r){return Wu(VI(r),QI,tA)},Nu=BI(function(e,t){Zh(this,{type:Xh,iterator:ju(We(e).entries),kind:t})},"Iterator",function(){var e=jI(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),Qh=function(r){this.entries=[],this.url=null,r!==void 0&&(Kh(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?$I(r,0)==="?"?KI(r,1):r:fe(r)))};Qh.prototype={type:Hn,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=_I(r),t,i,n,o,a,u,p;if(e)for(t=ju(r,e),i=t.next;!(n=qa(i,t)).done;){if(o=ju(LI(n.value)),a=o.next,(u=qa(a,o)).done||(p=qa(a,o)).done||!qa(a,o).done)throw zI("Expected sequence with length 2");Yt(this.entries,{key:fe(u.value),value:fe(p.value)})}else for(var f in r)OI(r,f)&&Yt(this.entries,{key:f,value:fe(r[f])})},parseQuery:function(r){if(r)for(var e=qh(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=qh(i,"="),Yt(this.entries,{key:jh(JI(n)),value:jh(_h(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],Yt(e,Wh(i.key)+"="+Wh(i.value));return _h(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Wa=function(){Jh(this,qn);var e=arguments.length>0?arguments[0]:void 0;Zh(this,new Qh(e))},qn=Wa.prototype;RI(qn,{append:function(e,t){Lr(arguments.length,2);var i=We(this);Yt(i.entries,{key:fe(e),value:fe(t)}),i.updateURL()},delete:function(r){Lr(arguments.length,1);for(var e=We(this),t=e.entries,i=fe(r),n=0;n<t.length;)t[n].key===i?Nh(t,n,1):n++;e.updateURL()},get:function(e){Lr(arguments.length,1);for(var t=We(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){Lr(arguments.length,1);for(var t=We(this).entries,i=fe(e),n=[],o=0;o<t.length;o++)t[o].key===i&&Yt(n,t[o].value);return n},has:function(e){Lr(arguments.length,1);for(var t=We(this).entries,i=fe(e),n=0;n<t.length;)if(t[n++].key===i)return!0;return!1},set:function(e,t){Lr(arguments.length,1);for(var i=We(this),n=i.entries,o=!1,a=fe(e),u=fe(t),p=0,f;p<n.length;p++)f=n[p],f.key===a&&(o?Nh(n,p--,1):(o=!0,f.value=u));o||Yt(n,{key:a,value:u}),i.updateURL()},sort:function(){var e=We(this);qI(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=We(this).entries,i=UI(e,arguments.length>1?arguments[1]:void 0),n=0,o;n<t.length;)o=t[n++],i(o.value,o.key,this)},keys:function(){return new Nu(this,"keys")},values:function(){return new Nu(this,"values")},entries:function(){return new Nu(this,"entries")}},{enumerable:!0});$h(qn,HI,qn.entries,{name:"entries"});$h(qn,"toString",function(){return We(this).serialize()},{enumerable:!0});FI(Wa,Hn);Hu({global:!0,constructor:!0,forced:!Vh},{URLSearchParams:Wa});!Vh&&Du(Nn)&&(Gh=Ye(Dh.has),zh=Ye(Dh.set),qu=function(r){if(Kh(r)){var e=r.body,t;if(MI(e)===Hn)return t=r.headers?new Nn(r.headers):new Nn,Gh(t,"content-type")||zh(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),DI(r,{body:Mh(0,fe(e)),headers:Mh(0,t)})}return r},Du(Lh)&&Hu({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Lh(e,arguments.length>1?qu(arguments[1]):{})}}),Du(ja)&&(Ha=function(e){return Jh(this,_u),new ja(e,arguments.length>1?qu(arguments[1]):{})},_u.constructor=Ha,Ha.prototype=_u,Hu({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Ha})));var Gh,zh,qu,Ha;ey.exports={URLSearchParams:Wa,getState:We}});var by=b(()=>{"use strict";Tg();var rA=Bn(),dc=pe(),iA=ku(),lc=me(),ty=Da(),Te=J(),Ja=Xt(),xe=Dg(),nA=Su(),sc=we(),uc=jg(),_r=lh(),Ge=Au(),sA=xl().codeAt,oA=Ph(),ot=En(),aA=Un(),dA=Bu(),py=Vu(),fy=Fr(),lA=fy.set,Ka=fy.getterFor("URL"),uA=py.URLSearchParams,cA=py.getState,jn=lc.URL,oc=lc.TypeError,Xa=lc.parseInt,mA=Math.floor,ry=Math.pow,Ee=Te("".charAt),ze=Te(/./.exec),Gn=Te([].join),pA=Te(1 .toString),fA=Te([].pop),qr=Te([].push),iy=Te("".replace),gA=Te([].shift),hA=Te("".split),Vn=Te("".slice),Za=Te("".toLowerCase),yA=Te([].unshift),vA="Invalid authority",$u="Invalid scheme",Qt="Invalid host",ny="Invalid port",gy=/[a-z]/i,bA=/[\d+-.a-z]/i,ac=/\d/,PA=/^0x/i,kA=/^[0-7]+$/,SA=/^\d+$/,hy=/^[\da-f]+$/i,wA=/[\0\t\n\r #%/:<>?@[\\\]^|]/,CA=/[\0\t\n\r #/:<>?@[\\\]^|]/,xA=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,IA=/[\t\n\r]/g,Ie,AA=function(r){var e=hA(r,"."),t,i,n,o,a,u,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&&Ee(o,0)=="0"&&(a=ze(PA,o)?16:8,o=Vn(o,a==8?1:2)),o==="")u=0;else{if(!ze(a==10?SA:a==8?kA:hy,o))return r;u=Xa(o,a)}qr(i,u)}for(n=0;n<t;n++)if(u=i[n],n==t-1){if(u>=ry(256,5-t))return null}else if(u>255)return null;for(p=fA(i),n=0;n<i.length;n++)p+=i[n]*ry(256,3-n);return p},EA=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,u,p,f,g,c,h=function(){return Ee(r,n)};if(h()==":"){if(Ee(r,1)!=":")return;n+=2,t++,i=t}for(;h();){if(t==8)return;if(h()==":"){if(i!==null)return;n++,t++,i=t;continue}for(o=a=0;a<4&&ze(hy,h());)o=o*16+Xa(h(),16),n++,a++;if(h()=="."){if(a==0||(n-=a,t>6))return;for(u=0;h();){if(p=null,u>0)if(h()=="."&&u<4)n++;else return;if(!ze(ac,h()))return;for(;ze(ac,h());){if(f=Xa(h(),10),p===null)p=f;else{if(p==0)return;p=p*10+f}if(p>255)return;n++}e[t]=e[t]*256+p,u++,(u==2||u==4)&&t++}if(u!=4)return;break}else if(h()==":"){if(n++,!h())return}else if(h())return;e[t++]=o}if(i!==null)for(g=t-i,t=7;t!=0&&g>0;)c=e[t],e[t--]=e[i+g-1],e[i+--g]=c;else if(t!=8)return;return e},TA=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},Wn=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)yA(e,r%256),r=mA(r/256);return Gn(e,".")}else if(typeof r=="object"){for(e="",i=TA(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=pA(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},$a={},yy=uc({},$a,{" ":1,'"':1,"<":1,">":1,"`":1}),vy=uc({},yy,{"#":1,"?":1,"{":1,"}":1}),Ju=uc({},vy,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Pt=function(r,e){var t=sA(r,0);return t>32&&t<127&&!sc(e,r)?r:encodeURIComponent(r)},Ga={ftp:21,file:null,http:80,https:443,ws:80,wss:443},zn=function(r,e){var t;return r.length==2&&ze(gy,Ee(r,0))&&((t=Ee(r,1))==":"||!e&&t=="|")},sy=function(r){var e;return r.length>1&&zn(Vn(r,0,2))&&(r.length==2||(e=Ee(r,2))==="/"||e==="\\"||e==="?"||e==="#")},RA=function(r){return r==="."||Za(r)==="%2e"},FA=function(r){return r=Za(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Ku={},oy={},Xu={},ay={},dy={},Zu={},ly={},uy={},za={},Va={},Yu={},Qu={},ec={},tc={},cy={},rc={},Nr={},Qe={},my={},er={},st={},cc=function(r,e,t){var i=ot(r),n,o,a;if(e){if(o=this.parse(i),o)throw oc(o);this.searchParams=null}else{if(t!==void 0&&(n=new cc(t,!0)),o=this.parse(i,null,n),o)throw oc(o);a=cA(new uA),a.bindURL(this),this.searchParams=a}};cc.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||Ku,o=0,a="",u=!1,p=!1,f=!1,g,c,h,P;for(r=ot(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=iy(r,xA,"")),r=iy(r,IA,""),g=_r(r);o<=g.length;){switch(c=g[o],n){case Ku:if(c&&ze(gy,c))a+=Za(c),n=oy;else{if(e)return $u;n=Xu;continue}break;case oy:if(c&&(ze(bA,c)||c=="+"||c=="-"||c=="."))a+=Za(c);else if(c==":"){if(e&&(i.isSpecial()!=sc(Ga,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&Ga[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=tc:i.isSpecial()&&t&&t.scheme==i.scheme?n=ay:i.isSpecial()?n=uy:g[o+1]=="/"?(n=dy,o++):(i.cannotBeABaseURL=!0,qr(i.path,""),n=my)}else{if(e)return $u;a="",n=Xu,o=0;continue}break;case Xu:if(!t||t.cannotBeABaseURL&&c!="#")return $u;if(t.cannotBeABaseURL&&c=="#"){i.scheme=t.scheme,i.path=Ge(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=st;break}n=t.scheme=="file"?tc:Zu;continue;case ay:if(c=="/"&&g[o+1]=="/")n=za,o++;else{n=Zu;continue}break;case dy:if(c=="/"){n=Va;break}else{n=Qe;continue}case Zu:if(i.scheme=t.scheme,c==Ie)i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ge(t.path),i.query=t.query;else if(c=="/"||c=="\\"&&i.isSpecial())n=ly;else if(c=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ge(t.path),i.query="",n=er;else if(c=="#")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ge(t.path),i.query=t.query,i.fragment="",n=st;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ge(t.path),i.path.length--,n=Qe;continue}break;case ly:if(i.isSpecial()&&(c=="/"||c=="\\"))n=za;else if(c=="/")n=Va;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=Qe;continue}break;case uy:if(n=za,c!="/"||Ee(a,o+1)!="/")continue;o++;break;case za:if(c!="/"&&c!="\\"){n=Va;continue}break;case Va:if(c=="@"){u&&(a="%40"+a),u=!0,h=_r(a);for(var w=0;w<h.length;w++){var I=h[w];if(I==":"&&!f){f=!0;continue}var E=Pt(I,Ju);f?i.password+=E:i.username+=E}a=""}else if(c==Ie||c=="/"||c=="?"||c=="#"||c=="\\"&&i.isSpecial()){if(u&&a=="")return vA;o-=_r(a).length+1,a="",n=Yu}else a+=c;break;case Yu:case Qu:if(e&&i.scheme=="file"){n=rc;continue}else if(c==":"&&!p){if(a=="")return Qt;if(P=i.parseHost(a),P)return P;if(a="",n=ec,e==Qu)return}else if(c==Ie||c=="/"||c=="?"||c=="#"||c=="\\"&&i.isSpecial()){if(i.isSpecial()&&a=="")return Qt;if(e&&a==""&&(i.includesCredentials()||i.port!==null))return;if(P=i.parseHost(a),P)return P;if(a="",n=Nr,e)return;continue}else c=="["?p=!0:c=="]"&&(p=!1),a+=c;break;case ec:if(ze(ac,c))a+=c;else if(c==Ie||c=="/"||c=="?"||c=="#"||c=="\\"&&i.isSpecial()||e){if(a!=""){var D=Xa(a,10);if(D>65535)return ny;i.port=i.isSpecial()&&D===Ga[i.scheme]?null:D,a=""}if(e)return;n=Nr;continue}else return ny;break;case tc:if(i.scheme="file",c=="/"||c=="\\")n=cy;else if(t&&t.scheme=="file")if(c==Ie)i.host=t.host,i.path=Ge(t.path),i.query=t.query;else if(c=="?")i.host=t.host,i.path=Ge(t.path),i.query="",n=er;else if(c=="#")i.host=t.host,i.path=Ge(t.path),i.query=t.query,i.fragment="",n=st;else{sy(Gn(Ge(g,o),""))||(i.host=t.host,i.path=Ge(t.path),i.shortenPath()),n=Qe;continue}else{n=Qe;continue}break;case cy:if(c=="/"||c=="\\"){n=rc;break}t&&t.scheme=="file"&&!sy(Gn(Ge(g,o),""))&&(zn(t.path[0],!0)?qr(i.path,t.path[0]):i.host=t.host),n=Qe;continue;case rc:if(c==Ie||c=="/"||c=="\\"||c=="?"||c=="#"){if(!e&&zn(a))n=Qe;else if(a==""){if(i.host="",e)return;n=Nr}else{if(P=i.parseHost(a),P)return P;if(i.host=="localhost"&&(i.host=""),e)return;a="",n=Nr}continue}else a+=c;break;case Nr:if(i.isSpecial()){if(n=Qe,c!="/"&&c!="\\")continue}else if(!e&&c=="?")i.query="",n=er;else if(!e&&c=="#")i.fragment="",n=st;else if(c!=Ie&&(n=Qe,c!="/"))continue;break;case Qe:if(c==Ie||c=="/"||c=="\\"&&i.isSpecial()||!e&&(c=="?"||c=="#")){if(FA(a)?(i.shortenPath(),c!="/"&&!(c=="\\"&&i.isSpecial())&&qr(i.path,"")):RA(a)?c!="/"&&!(c=="\\"&&i.isSpecial())&&qr(i.path,""):(i.scheme=="file"&&!i.path.length&&zn(a)&&(i.host&&(i.host=""),a=Ee(a,0)+":"),qr(i.path,a)),a="",i.scheme=="file"&&(c==Ie||c=="?"||c=="#"))for(;i.path.length>1&&i.path[0]==="";)gA(i.path);c=="?"?(i.query="",n=er):c=="#"&&(i.fragment="",n=st)}else a+=Pt(c,vy);break;case my:c=="?"?(i.query="",n=er):c=="#"?(i.fragment="",n=st):c!=Ie&&(i.path[0]+=Pt(c,$a));break;case er:!e&&c=="#"?(i.fragment="",n=st):c!=Ie&&(c=="'"&&i.isSpecial()?i.query+="%27":c=="#"?i.query+="%23":i.query+=Pt(c,$a));break;case st:c!=Ie&&(i.fragment+=Pt(c,yy));break}o++}},parseHost:function(r){var e,t,i;if(Ee(r,0)=="["){if(Ee(r,r.length-1)!="]"||(e=EA(Vn(r,1,-1)),!e))return Qt;this.host=e}else if(this.isSpecial()){if(r=oA(r),ze(wA,r)||(e=AA(r),e===null))return Qt;this.host=e}else{if(ze(CA,r))return Qt;for(e="",t=_r(r),i=0;i<t.length;i++)e+=Pt(t[i],$a);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return sc(Ga,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!zn(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,u=r.query,p=r.fragment,f=e+":";return n!==null?(f+="//",r.includesCredentials()&&(f+=t+(i?":"+i:"")+"@"),f+=Wn(n),o!==null&&(f+=":"+o)):e=="file"&&(f+="//"),f+=r.cannotBeABaseURL?a[0]:a.length?"/"+Gn(a,"/"):"",u!==null&&(f+="?"+u),p!==null&&(f+="#"+p),f},setHref:function(r){var e=this.parse(r);if(e)throw oc(e);this.searchParams.update()},getOrigin:function(){var r=this.scheme,e=this.port;if(r=="blob")try{return new Hr(r.path[0]).origin}catch{return"null"}return r=="file"||!this.isSpecial()?"null":r+"://"+Wn(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(ot(r)+":",Ku)},getUsername:function(){return this.username},setUsername:function(r){var e=_r(ot(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=Pt(e[t],Ju)}},getPassword:function(){return this.password},setPassword:function(r){var e=_r(ot(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=Pt(e[t],Ju)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?Wn(r):Wn(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,Yu)},getHostname:function(){var r=this.host;return r===null?"":Wn(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,Qu)},getPort:function(){var r=this.port;return r===null?"":ot(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=ot(r),r==""?this.port=null:this.parse(r,ec))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+Gn(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,Nr))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=ot(r),r==""?this.query=null:(Ee(r,0)=="?"&&(r=Vn(r,1)),this.query="",this.parse(r,er)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var r=this.fragment;return r?"#"+r:""},setHash:function(r){if(r=ot(r),r==""){this.fragment=null;return}Ee(r,0)=="#"&&(r=Vn(r,1)),this.fragment="",this.parse(r,st)},update:function(){this.query=this.searchParams.serialize()||null}};var Hr=function(e){var t=nA(this,ee),i=dA(arguments.length,1)>1?arguments[1]:void 0,n=lA(t,new cc(e,!1,i));dc||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},ee=Hr.prototype,Ae=function(r,e){return{get:function(){return Ka(this)[r]()},set:e&&function(t){return Ka(this)[e](t)},configurable:!0,enumerable:!0}};dc&&(xe(ee,"href",Ae("serialize","setHref")),xe(ee,"origin",Ae("getOrigin")),xe(ee,"protocol",Ae("getProtocol","setProtocol")),xe(ee,"username",Ae("getUsername","setUsername")),xe(ee,"password",Ae("getPassword","setPassword")),xe(ee,"host",Ae("getHost","setHost")),xe(ee,"hostname",Ae("getHostname","setHostname")),xe(ee,"port",Ae("getPort","setPort")),xe(ee,"pathname",Ae("getPathname","setPathname")),xe(ee,"search",Ae("getSearch","setSearch")),xe(ee,"searchParams",Ae("getSearchParams")),xe(ee,"hash",Ae("getHash","setHash")));Ja(ee,"toJSON",function(){return Ka(this).serialize()},{enumerable:!0});Ja(ee,"toString",function(){return Ka(this).serialize()},{enumerable:!0});jn&&(ic=jn.createObjectURL,nc=jn.revokeObjectURL,ic&&Ja(Hr,"createObjectURL",ty(ic,jn)),nc&&Ja(Hr,"revokeObjectURL",ty(nc,jn)));var ic,nc;aA(Hr,"URL");rA({global:!0,constructor:!0,forced:!iA,sham:!dc},{URL:Hr})});var Py=b(()=>{by()});var ky=b(()=>{"use strict";var BA=Bn(),OA=He();BA({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return OA(URL.prototype.toString,this)}})});var Sy=b(()=>{Vu()});var Cy=b((kU,wy)=>{var UA=me();wy.exports=UA});var Iy=b((SU,xy)=>{Py();ky();Sy();var MA=Cy();xy.exports=MA.URL});var hc=b(ed=>{"use strict";ed.byteLength=YA;ed.toByteArray=eE;ed.fromByteArray=iE;var et=[],Be=[],ZA=typeof Uint8Array<"u"?Uint8Array:Array,gc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(nr=0,Fy=gc.length;nr<Fy;++nr)et[nr]=gc[nr],Be[gc.charCodeAt(nr)]=nr;var nr,Fy;Be["-".charCodeAt(0)]=62;Be["_".charCodeAt(0)]=63;function By(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 YA(r){var e=By(r),t=e[0],i=e[1];return(t+i)*3/4-i}function QA(r,e,t){return(e+t)*3/4-t}function eE(r){var e,t=By(r),i=t[0],n=t[1],o=new ZA(QA(r,i,n)),a=0,u=n>0?i-4:i,p;for(p=0;p<u;p+=4)e=Be[r.charCodeAt(p)]<<18|Be[r.charCodeAt(p+1)]<<12|Be[r.charCodeAt(p+2)]<<6|Be[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=Be[r.charCodeAt(p)]<<2|Be[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=Be[r.charCodeAt(p)]<<10|Be[r.charCodeAt(p+1)]<<4|Be[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function tE(r){return et[r>>18&63]+et[r>>12&63]+et[r>>6&63]+et[r&63]}function rE(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(tE(i));return n.join("")}function iE(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,u=t-i;a<u;a+=o)n.push(rE(r,a,a+o>u?u:a+o));return i===1?(e=r[t-1],n.push(et[e>>2]+et[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(et[e>>10]+et[e>>4&63]+et[e<<2&63]+"=")),n.join("")}});var Oy=b(yc=>{yc.read=function(r,e,t,i,n){var o,a,u=n*8-i-1,p=(1<<u)-1,f=p>>1,g=-7,c=t?n-1:0,h=t?-1:1,P=r[e+c];for(c+=h,o=P&(1<<-g)-1,P>>=-g,g+=u;g>0;o=o*256+r[e+c],c+=h,g-=8);for(a=o&(1<<-g)-1,o>>=-g,g+=i;g>0;a=a*256+r[e+c],c+=h,g-=8);if(o===0)o=1-f;else{if(o===p)return a?NaN:(P?-1:1)*(1/0);a=a+Math.pow(2,i),o=o-f}return(P?-1:1)*a*Math.pow(2,o-i)};yc.write=function(r,e,t,i,n,o){var a,u,p,f=o*8-n-1,g=(1<<f)-1,c=g>>1,h=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,P=i?0:o-1,w=i?1:-1,I=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=g):(a=Math.floor(Math.log(e)/Math.LN2),e*(p=Math.pow(2,-a))<1&&(a--,p*=2),a+c>=1?e+=h/p:e+=h*Math.pow(2,1-c),e*p>=2&&(a++,p/=2),a+c>=g?(u=0,a=g):a+c>=1?(u=(e*p-1)*Math.pow(2,n),a=a+c):(u=e*Math.pow(2,c-1)*Math.pow(2,n),a=0));n>=8;r[t+P]=u&255,P+=w,u/=256,n-=8);for(a=a<<n|u,f+=n;f>0;r[t+P]=a&255,P+=w,a/=256,f-=8);r[t+P-w]|=I*128}});var Xy=b(Jr=>{"use strict";var vc=hc(),Vr=Oy(),Uy=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Jr.Buffer=y;Jr.SlowBuffer=lE;Jr.INSPECT_MAX_BYTES=50;var td=2147483647;Jr.kMaxLength=td;y.TYPED_ARRAY_SUPPORT=nE();!y.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function nE(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(y.prototype,"parent",{enumerable:!0,get:function(){if(y.isBuffer(this))return this.buffer}});Object.defineProperty(y.prototype,"offset",{enumerable:!0,get:function(){if(y.isBuffer(this))return this.byteOffset}});function dt(r){if(r>td)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,y.prototype),e}function y(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Sc(r)}return _y(r,e,t)}y.poolSize=8192;function _y(r,e,t){if(typeof r=="string")return oE(r,e);if(ArrayBuffer.isView(r))return aE(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(tt(r,ArrayBuffer)||r&&tt(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(tt(r,SharedArrayBuffer)||r&&tt(r.buffer,SharedArrayBuffer)))return Pc(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return y.from(i,e,t);let n=dE(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return y.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}y.from=function(r,e,t){return _y(r,e,t)};Object.setPrototypeOf(y.prototype,Uint8Array.prototype);Object.setPrototypeOf(y,Uint8Array);function Ny(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function sE(r,e,t){return Ny(r),r<=0?dt(r):e!==void 0?typeof t=="string"?dt(r).fill(e,t):dt(r).fill(e):dt(r)}y.alloc=function(r,e,t){return sE(r,e,t)};function Sc(r){return Ny(r),dt(r<0?0:wc(r)|0)}y.allocUnsafe=function(r){return Sc(r)};y.allocUnsafeSlow=function(r){return Sc(r)};function oE(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!y.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=qy(r,e)|0,i=dt(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function bc(r){let e=r.length<0?0:wc(r.length)|0,t=dt(e);for(let i=0;i<e;i+=1)t[i]=r[i]&255;return t}function aE(r){if(tt(r,Uint8Array)){let e=new Uint8Array(r);return Pc(e.buffer,e.byteOffset,e.byteLength)}return bc(r)}function Pc(r,e,t){if(e<0||r.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let i;return e===void 0&&t===void 0?i=new Uint8Array(r):t===void 0?i=new Uint8Array(r,e):i=new Uint8Array(r,e,t),Object.setPrototypeOf(i,y.prototype),i}function dE(r){if(y.isBuffer(r)){let e=wc(r.length)|0,t=dt(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||xc(r.length)?dt(0):bc(r);if(r.type==="Buffer"&&Array.isArray(r.data))return bc(r.data)}function wc(r){if(r>=td)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+td.toString(16)+" bytes");return r|0}function lE(r){return+r!=r&&(r=0),y.alloc(+r)}y.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==y.prototype};y.compare=function(e,t){if(tt(e,Uint8Array)&&(e=y.from(e,e.offset,e.byteLength)),tt(t,Uint8Array)&&(t=y.from(t,t.offset,t.byteLength)),!y.isBuffer(e)||!y.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,n=t.length;for(let o=0,a=Math.min(i,n);o<a;++o)if(e[o]!==t[o]){i=e[o],n=t[o];break}return i<n?-1:n<i?1:0};y.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};y.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return y.alloc(0);let i;if(t===void 0)for(t=0,i=0;i<e.length;++i)t+=e[i].length;let n=y.allocUnsafe(t),o=0;for(i=0;i<e.length;++i){let a=e[i];if(tt(a,Uint8Array))o+a.length>n.length?(y.isBuffer(a)||(a=y.from(a)),a.copy(n,o)):Uint8Array.prototype.set.call(n,a,o);else if(y.isBuffer(a))a.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=a.length}return n};function qy(r,e){if(y.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||tt(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return kc(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Ky(r).length;default:if(n)return i?-1:kc(r).length;e=(""+e).toLowerCase(),n=!0}}y.byteLength=qy;function uE(r,e,t){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return PE(this,e,t);case"utf8":case"utf-8":return jy(this,e,t);case"ascii":return vE(this,e,t);case"latin1":case"binary":return bE(this,e,t);case"base64":return hE(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return kE(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}y.prototype._isBuffer=!0;function sr(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}y.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)sr(this,t,t+1);return this};y.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)sr(this,t,t+3),sr(this,t+1,t+2);return this};y.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)sr(this,t,t+7),sr(this,t+1,t+6),sr(this,t+2,t+5),sr(this,t+3,t+4);return this};y.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?jy(this,0,e):uE.apply(this,arguments)};y.prototype.toLocaleString=y.prototype.toString;y.prototype.equals=function(e){if(!y.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:y.compare(this,e)===0};y.prototype.inspect=function(){let e="",t=Jr.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};Uy&&(y.prototype[Uy]=y.prototype.inspect);y.prototype.compare=function(e,t,i,n,o){if(tt(e,Uint8Array)&&(e=y.from(e,e.offset,e.byteLength)),!y.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),t<0||i>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=i)return 0;if(n>=o)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,o>>>=0,this===e)return 0;let a=o-n,u=i-t,p=Math.min(a,u),f=this.slice(n,o),g=e.slice(t,i);for(let c=0;c<p;++c)if(f[c]!==g[c]){a=f[c],u=g[c];break}return a<u?-1:u<a?1:0};function Hy(r,e,t,i,n){if(r.length===0)return-1;if(typeof t=="string"?(i=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,xc(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=y.from(e,i)),y.isBuffer(e))return e.length===0?-1:My(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):My(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function My(r,e,t,i,n){let o=1,a=r.length,u=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;o=2,a/=2,u/=2,t/=2}function p(g,c){return o===1?g[c]:g.readUInt16BE(c*o)}let f;if(n){let g=-1;for(f=t;f<a;f++)if(p(r,f)===p(e,g===-1?0:f-g)){if(g===-1&&(g=f),f-g+1===u)return g*o}else g!==-1&&(f-=f-g),g=-1}else for(t+u>a&&(t=a-u),f=t;f>=0;f--){let g=!0;for(let c=0;c<u;c++)if(p(r,f+c)!==p(e,c)){g=!1;break}if(g)return f}return-1}y.prototype.includes=function(e,t,i){return this.indexOf(e,t,i)!==-1};y.prototype.indexOf=function(e,t,i){return Hy(this,e,t,i,!0)};y.prototype.lastIndexOf=function(e,t,i){return Hy(this,e,t,i,!1)};function cE(r,e,t,i){t=Number(t)||0;let n=r.length-t;i?(i=Number(i),i>n&&(i=n)):i=n;let o=e.length;i>o/2&&(i=o/2);let a;for(a=0;a<i;++a){let u=parseInt(e.substr(a*2,2),16);if(xc(u))return a;r[t+a]=u}return a}function mE(r,e,t,i){return rd(kc(e,r.length-t),r,t,i)}function pE(r,e,t,i){return rd(xE(e),r,t,i)}function fE(r,e,t,i){return rd(Ky(e),r,t,i)}function gE(r,e,t,i){return rd(IE(e,r.length-t),r,t,i)}y.prototype.write=function(e,t,i,n){if(t===void 0)n="utf8",i=this.length,t=0;else if(i===void 0&&typeof t=="string")n=t,i=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((i===void 0||i>o)&&(i=o),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return cE(this,e,t,i);case"utf8":case"utf-8":return mE(this,e,t,i);case"ascii":case"latin1":case"binary":return pE(this,e,t,i);case"base64":return fE(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gE(this,e,t,i);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}};y.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function hE(r,e,t){return e===0&&t===r.length?vc.fromByteArray(r):vc.fromByteArray(r.slice(e,t))}function jy(r,e,t){t=Math.min(r.length,t);let i=[],n=e;for(;n<t;){let o=r[n],a=null,u=o>239?4:o>223?3:o>191?2:1;if(n+u<=t){let p,f,g,c;switch(u){case 1:o<128&&(a=o);break;case 2:p=r[n+1],(p&192)===128&&(c=(o&31)<<6|p&63,c>127&&(a=c));break;case 3:p=r[n+1],f=r[n+2],(p&192)===128&&(f&192)===128&&(c=(o&15)<<12|(p&63)<<6|f&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:p=r[n+1],f=r[n+2],g=r[n+3],(p&192)===128&&(f&192)===128&&(g&192)===128&&(c=(o&15)<<18|(p&63)<<12|(f&63)<<6|g&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,u=1):a>65535&&(a-=65536,i.push(a>>>10&1023|55296),a=56320|a&1023),i.push(a),n+=u}return yE(i)}var Ly=4096;function yE(r){let e=r.length;if(e<=Ly)return String.fromCharCode.apply(String,r);let t="",i=0;for(;i<e;)t+=String.fromCharCode.apply(String,r.slice(i,i+=Ly));return t}function vE(r,e,t){let i="";t=Math.min(r.length,t);for(let n=e;n<t;++n)i+=String.fromCharCode(r[n]&127);return i}function bE(r,e,t){let i="";t=Math.min(r.length,t);for(let n=e;n<t;++n)i+=String.fromCharCode(r[n]);return i}function PE(r,e,t){let i=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>i)&&(t=i);let n="";for(let o=e;o<t;++o)n+=AE[r[o]];return n}function kE(r,e,t){let i=r.slice(e,t),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}y.prototype.slice=function(e,t){let i=this.length;e=~~e,t=t===void 0?i:~~t,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),t<e&&(t=e);let n=this.subarray(e,t);return Object.setPrototypeOf(n,y.prototype),n};function X(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}y.prototype.readUintLE=y.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||X(e,t,this.length);let n=this[e],o=1,a=0;for(;++a<t&&(o*=256);)n+=this[e+a]*o;return n};y.prototype.readUintBE=y.prototype.readUIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||X(e,t,this.length);let n=this[e+--t],o=1;for(;t>0&&(o*=256);)n+=this[e+--t]*o;return n};y.prototype.readUint8=y.prototype.readUInt8=function(e,t){return e=e>>>0,t||X(e,1,this.length),this[e]};y.prototype.readUint16LE=y.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||X(e,2,this.length),this[e]|this[e+1]<<8};y.prototype.readUint16BE=y.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||X(e,2,this.length),this[e]<<8|this[e+1]};y.prototype.readUint32LE=y.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||X(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};y.prototype.readUint32BE=y.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||X(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};y.prototype.readBigUInt64LE=wt(function(e){e=e>>>0,$r(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&$n(e,this.length-8);let n=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))});y.prototype.readBigUInt64BE=wt(function(e){e=e>>>0,$r(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&$n(e,this.length-8);let n=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(o)});y.prototype.readIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||X(e,t,this.length);let n=this[e],o=1,a=0;for(;++a<t&&(o*=256);)n+=this[e+a]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n};y.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||X(e,t,this.length);let n=t,o=1,a=this[e+--n];for(;n>0&&(o*=256);)a+=this[e+--n]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*t)),a};y.prototype.readInt8=function(e,t){return e=e>>>0,t||X(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};y.prototype.readInt16LE=function(e,t){e=e>>>0,t||X(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};y.prototype.readInt16BE=function(e,t){e=e>>>0,t||X(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};y.prototype.readInt32LE=function(e,t){return e=e>>>0,t||X(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};y.prototype.readInt32BE=function(e,t){return e=e>>>0,t||X(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};y.prototype.readBigInt64LE=wt(function(e){e=e>>>0,$r(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&$n(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});y.prototype.readBigInt64BE=wt(function(e){e=e>>>0,$r(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&$n(e,this.length-8);let n=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i)});y.prototype.readFloatLE=function(e,t){return e=e>>>0,t||X(e,4,this.length),Vr.read(this,e,!0,23,4)};y.prototype.readFloatBE=function(e,t){return e=e>>>0,t||X(e,4,this.length),Vr.read(this,e,!1,23,4)};y.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||X(e,8,this.length),Vr.read(this,e,!0,52,8)};y.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||X(e,8,this.length),Vr.read(this,e,!1,52,8)};function ae(r,e,t,i,n,o){if(!y.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(t+i>r.length)throw new RangeError("Index out of range")}y.prototype.writeUintLE=y.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){let u=Math.pow(2,8*i)-1;ae(this,e,t,i,u,0)}let o=1,a=0;for(this[t]=e&255;++a<i&&(o*=256);)this[t+a]=e/o&255;return t+i};y.prototype.writeUintBE=y.prototype.writeUIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){let u=Math.pow(2,8*i)-1;ae(this,e,t,i,u,0)}let o=i-1,a=1;for(this[t+o]=e&255;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+i};y.prototype.writeUint8=y.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,1,255,0),this[t]=e&255,t+1};y.prototype.writeUint16LE=y.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};y.prototype.writeUint16BE=y.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};y.prototype.writeUint32LE=y.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};y.prototype.writeUint32BE=y.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function Wy(r,e,t,i,n){Jy(e,i,n,r,t,7);let o=Number(e&BigInt(4294967295));r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=a,a=a>>8,r[t++]=a,a=a>>8,r[t++]=a,a=a>>8,r[t++]=a,t}function Gy(r,e,t,i,n){Jy(e,i,n,r,t,7);let o=Number(e&BigInt(4294967295));r[t+7]=o,o=o>>8,r[t+6]=o,o=o>>8,r[t+5]=o,o=o>>8,r[t+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=a,a=a>>8,r[t+2]=a,a=a>>8,r[t+1]=a,a=a>>8,r[t]=a,t+8}y.prototype.writeBigUInt64LE=wt(function(e,t=0){return Wy(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});y.prototype.writeBigUInt64BE=wt(function(e,t=0){return Gy(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});y.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let p=Math.pow(2,8*i-1);ae(this,e,t,i,p-1,-p)}let o=0,a=1,u=0;for(this[t]=e&255;++o<i&&(a*=256);)e<0&&u===0&&this[t+o-1]!==0&&(u=1),this[t+o]=(e/a>>0)-u&255;return t+i};y.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let p=Math.pow(2,8*i-1);ae(this,e,t,i,p-1,-p)}let o=i-1,a=1,u=0;for(this[t+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[t+o+1]!==0&&(u=1),this[t+o]=(e/a>>0)-u&255;return t+i};y.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};y.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};y.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};y.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};y.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};y.prototype.writeBigInt64LE=wt(function(e,t=0){return Wy(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});y.prototype.writeBigInt64BE=wt(function(e,t=0){return Gy(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function zy(r,e,t,i,n,o){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Vy(r,e,t,i,n){return e=+e,t=t>>>0,n||zy(r,e,t,4,34028234663852886e22,-34028234663852886e22),Vr.write(r,e,t,i,23,4),t+4}y.prototype.writeFloatLE=function(e,t,i){return Vy(this,e,t,!0,i)};y.prototype.writeFloatBE=function(e,t,i){return Vy(this,e,t,!1,i)};function $y(r,e,t,i,n){return e=+e,t=t>>>0,n||zy(r,e,t,8,17976931348623157e292,-17976931348623157e292),Vr.write(r,e,t,i,52,8),t+8}y.prototype.writeDoubleLE=function(e,t,i){return $y(this,e,t,!0,i)};y.prototype.writeDoubleBE=function(e,t,i){return $y(this,e,t,!1,i)};y.prototype.copy=function(e,t,i,n){if(!y.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-i&&(n=e.length-t+i);let o=n-i;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,i,n):Uint8Array.prototype.set.call(e,this.subarray(i,n),t),o};y.prototype.fill=function(e,t,i,n){if(typeof e=="string"){if(typeof t=="string"?(n=t,t=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!y.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){let a=e.charCodeAt(0);(n==="utf8"&&a<128||n==="latin1")&&(e=a)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;t=t>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let o;if(typeof e=="number")for(o=t;o<i;++o)this[o]=e;else{let a=y.isBuffer(e)?e:y.from(e,n),u=a.length;if(u===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<i-t;++o)this[o+t]=a[o%u]}return this};var zr={};function Cc(r,e,t){zr[r]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}Cc("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Cc("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError);Cc("ERR_OUT_OF_RANGE",function(r,e,t){let i=`The value of "${r}" is out of range.`,n=t;return Number.isInteger(t)&&Math.abs(t)>2**32?n=Dy(String(t)):typeof t=="bigint"&&(n=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(n=Dy(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function Dy(r){let e="",t=r.length,i=r[0]==="-"?1:0;for(;t>=i+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function SE(r,e,t){$r(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&$n(e,r.length-(t+1))}function Jy(r,e,t,i,n,o){if(r>t||r<e){let a=typeof e=="bigint"?"n":"",u;throw o>3?e===0||e===BigInt(0)?u=`>= 0${a} and < 2${a} ** ${(o+1)*8}${a}`:u=`>= -(2${a} ** ${(o+1)*8-1}${a}) and < 2 ** ${(o+1)*8-1}${a}`:u=`>= ${e}${a} and <= ${t}${a}`,new zr.ERR_OUT_OF_RANGE("value",u,r)}SE(i,n,o)}function $r(r,e){if(typeof r!="number")throw new zr.ERR_INVALID_ARG_TYPE(e,"number",r)}function $n(r,e,t){throw Math.floor(r)!==r?($r(r,t),new zr.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new zr.ERR_BUFFER_OUT_OF_BOUNDS:new zr.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var wE=/[^+/0-9A-Za-z-_]/g;function CE(r){if(r=r.split("=")[0],r=r.trim().replace(wE,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function kc(r,e){e=e||1/0;let t,i=r.length,n=null,o=[];for(let a=0;a<i;++a){if(t=r.charCodeAt(a),t>55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&o.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;o.push(t)}else if(t<2048){if((e-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function xE(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function IE(r,e){let t,i,n,o=[];for(let a=0;a<r.length&&!((e-=2)<0);++a)t=r.charCodeAt(a),i=t>>8,n=t%256,o.push(n),o.push(i);return o}function Ky(r){return vc.toByteArray(CE(r))}function rd(r,e,t,i){let n;for(n=0;n<i&&!(n+t>=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function tt(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function xc(r){return r!==r}var AE=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let n=0;n<16;++n)e[i+n]=r[t]+r[n]}return e}();function wt(r){return typeof BigInt>"u"?EE:r}function EE(){throw new Error("BigInt not supported")}});var Kc=b((o_,Zv)=>{var ET=Object.prototype.toString;Zv.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 OT(e)?"generatorfunction":"function";if(TT(e))return"array";if(LT(e))return"buffer";if(MT(e))return"arguments";if(FT(e))return"date";if(RT(e))return"error";if(BT(e))return"regexp";switch(Xv(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(UT(e))return"generator";switch(t=ET.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 Xv(r){return typeof r.constructor=="function"?r.constructor.name:null}function TT(r){return Array.isArray?Array.isArray(r):r instanceof Array}function RT(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function FT(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function BT(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function OT(r,e){return Xv(r)==="GeneratorFunction"}function UT(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function MT(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 LT(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var eb=b((a_,Qv)=>{"use strict";var Yv=Symbol.prototype.valueOf,DT=Kc();function _T(r,e){switch(DT(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 jT(r);case"symbol":return WT(r);case"arraybuffer":return qT(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return HT(r);case"regexp":return NT(r);case"error":return Object.create(r);default:return r}}function NT(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 qT(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function HT(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function jT(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function WT(r){return Yv?Object(Yv.call(r)):{}}Qv.exports=_T});var rb=b((d_,tb)=>{"use strict";tb.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var sb=b((l_,nb)=>{"use strict";var GT=rb();function ib(r){return GT(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}nb.exports=function(e){var t,i;return!(ib(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,ib(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var ab=b((u_,ob)=>{"use strict";var zT=eb(),VT=Kc(),$T=sb();function Xc(r,e){switch(VT(r)){case"object":return JT(r,e);case"array":return KT(r,e);default:return zT(r)}}function JT(r,e){if(typeof e=="function")return e(r);if(e||$T(r)){let t=new r.constructor;for(let i in r)t[i]=Xc(r[i],e);return t}return r}function KT(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=Xc(r[i],e);return t}ob.exports=Xc});var jb=b((ds,gi)=>{var XT=200,am="__lodash_hash_undefined__",Rd=1,bb=2,Pb=9007199254740991,wd="[object Arguments]",em="[object Array]",ZT="[object AsyncFunction]",kb="[object Boolean]",Sb="[object Date]",wb="[object Error]",Cb="[object Function]",YT="[object GeneratorFunction]",Cd="[object Map]",xb="[object Number]",QT="[object Null]",fi="[object Object]",db="[object Promise]",eR="[object Proxy]",Ib="[object RegExp]",xd="[object Set]",Ab="[object String]",tR="[object Symbol]",rR="[object Undefined]",tm="[object WeakMap]",Eb="[object ArrayBuffer]",Id="[object DataView]",iR="[object Float32Array]",nR="[object Float64Array]",sR="[object Int8Array]",oR="[object Int16Array]",aR="[object Int32Array]",dR="[object Uint8Array]",lR="[object Uint8ClampedArray]",uR="[object Uint16Array]",cR="[object Uint32Array]",mR=/[\\^$.*+?()[\]{}|]/g,pR=/^\[object .+?Constructor\]$/,fR=/^(?:0|[1-9]\d*)$/,H={};H[iR]=H[nR]=H[sR]=H[oR]=H[aR]=H[dR]=H[lR]=H[uR]=H[cR]=!0;H[wd]=H[em]=H[Eb]=H[kb]=H[Id]=H[Sb]=H[wb]=H[Cb]=H[Cd]=H[xb]=H[fi]=H[Ib]=H[xd]=H[Ab]=H[tm]=!1;var Tb=typeof global=="object"&&global&&global.Object===Object&&global,gR=typeof self=="object"&&self&&self.Object===Object&&self,ct=Tb||gR||Function("return this")(),Rb=typeof ds=="object"&&ds&&!ds.nodeType&&ds,lb=Rb&&typeof gi=="object"&&gi&&!gi.nodeType&&gi,Fb=lb&&lb.exports===Rb,Zc=Fb&&Tb.process,ub=function(){try{return Zc&&Zc.binding&&Zc.binding("util")}catch{}}(),cb=ub&&ub.isTypedArray;function hR(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 yR(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function vR(r,e){for(var t=-1,i=r==null?0:r.length;++t<i;)if(e(r[t],t,r))return!0;return!1}function bR(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function PR(r){return function(e){return r(e)}}function kR(r,e){return r.has(e)}function SR(r,e){return r?.[e]}function wR(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function CR(r,e){return function(t){return r(e(t))}}function xR(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var IR=Array.prototype,AR=Function.prototype,Fd=Object.prototype,Yc=ct["__core-js_shared__"],Bb=AR.toString,rt=Fd.hasOwnProperty,mb=function(){var r=/[^.]+$/.exec(Yc&&Yc.keys&&Yc.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Ob=Fd.toString,ER=RegExp("^"+Bb.call(rt).replace(mR,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pb=Fb?ct.Buffer:void 0,Ad=ct.Symbol,fb=ct.Uint8Array,Ub=Fd.propertyIsEnumerable,TR=IR.splice,ur=Ad?Ad.toStringTag:void 0,gb=Object.getOwnPropertySymbols,RR=pb?pb.isBuffer:void 0,FR=CR(Object.keys,Object),rm=hi(ct,"DataView"),ls=hi(ct,"Map"),im=hi(ct,"Promise"),nm=hi(ct,"Set"),sm=hi(ct,"WeakMap"),us=hi(Object,"create"),BR=pr(rm),OR=pr(ls),UR=pr(im),MR=pr(nm),LR=pr(sm),hb=Ad?Ad.prototype:void 0,Qc=hb?hb.valueOf:void 0;function cr(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 DR(){this.__data__=us?us(null):{},this.size=0}function _R(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function NR(r){var e=this.__data__;if(us){var t=e[r];return t===am?void 0:t}return rt.call(e,r)?e[r]:void 0}function qR(r){var e=this.__data__;return us?e[r]!==void 0:rt.call(e,r)}function HR(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=us&&e===void 0?am:e,this}cr.prototype.clear=DR;cr.prototype.delete=_R;cr.prototype.get=NR;cr.prototype.has=qR;cr.prototype.set=HR;function mt(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function jR(){this.__data__=[],this.size=0}function WR(r){var e=this.__data__,t=Bd(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():TR.call(e,t,1),--this.size,!0}function GR(r){var e=this.__data__,t=Bd(e,r);return t<0?void 0:e[t][1]}function zR(r){return Bd(this.__data__,r)>-1}function VR(r,e){var t=this.__data__,i=Bd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}mt.prototype.clear=jR;mt.prototype.delete=WR;mt.prototype.get=GR;mt.prototype.has=zR;mt.prototype.set=VR;function mr(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 $R(){this.size=0,this.__data__={hash:new cr,map:new(ls||mt),string:new cr}}function JR(r){var e=Od(this,r).delete(r);return this.size-=e?1:0,e}function KR(r){return Od(this,r).get(r)}function XR(r){return Od(this,r).has(r)}function ZR(r,e){var t=Od(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}mr.prototype.clear=$R;mr.prototype.delete=JR;mr.prototype.get=KR;mr.prototype.has=XR;mr.prototype.set=ZR;function Ed(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new mr;++e<t;)this.add(r[e])}function YR(r){return this.__data__.set(r,am),this}function QR(r){return this.__data__.has(r)}Ed.prototype.add=Ed.prototype.push=YR;Ed.prototype.has=QR;function Ft(r){var e=this.__data__=new mt(r);this.size=e.size}function eF(){this.__data__=new mt,this.size=0}function tF(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function rF(r){return this.__data__.get(r)}function iF(r){return this.__data__.has(r)}function nF(r,e){var t=this.__data__;if(t instanceof mt){var i=t.__data__;if(!ls||i.length<XT-1)return i.push([r,e]),this.size=++t.size,this;t=this.__data__=new mr(i)}return t.set(r,e),this.size=t.size,this}Ft.prototype.clear=eF;Ft.prototype.delete=tF;Ft.prototype.get=rF;Ft.prototype.has=iF;Ft.prototype.set=nF;function sF(r,e){var t=Td(r),i=!t&&PF(r),n=!t&&!i&&om(r),o=!t&&!i&&!n&&Hb(r),a=t||i||n||o,u=a?bR(r.length,String):[],p=u.length;for(var f in r)(e||rt.call(r,f))&&!(a&&(f=="length"||n&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||gF(f,p)))&&u.push(f);return u}function Bd(r,e){for(var t=r.length;t--;)if(Db(r[t][0],e))return t;return-1}function oF(r,e,t){var i=e(r);return Td(r)?i:yR(i,t(r))}function ms(r){return r==null?r===void 0?rR:QT:ur&&ur in Object(r)?pF(r):bF(r)}function yb(r){return cs(r)&&ms(r)==wd}function Mb(r,e,t,i,n){return r===e?!0:r==null||e==null||!cs(r)&&!cs(e)?r!==r&&e!==e:aF(r,e,t,i,Mb,n)}function aF(r,e,t,i,n,o){var a=Td(r),u=Td(e),p=a?em:Rt(r),f=u?em:Rt(e);p=p==wd?fi:p,f=f==wd?fi:f;var g=p==fi,c=f==fi,h=p==f;if(h&&om(r)){if(!om(e))return!1;a=!0,g=!1}if(h&&!g)return o||(o=new Ft),a||Hb(r)?Lb(r,e,t,i,n,o):cF(r,e,p,t,i,n,o);if(!(t&Rd)){var P=g&&rt.call(r,"__wrapped__"),w=c&&rt.call(e,"__wrapped__");if(P||w){var I=P?r.value():r,E=w?e.value():e;return o||(o=new Ft),n(I,E,t,i,o)}}return h?(o||(o=new Ft),mF(r,e,t,i,n,o)):!1}function dF(r){if(!qb(r)||yF(r))return!1;var e=_b(r)?ER:pR;return e.test(pr(r))}function lF(r){return cs(r)&&Nb(r.length)&&!!H[ms(r)]}function uF(r){if(!vF(r))return FR(r);var e=[];for(var t in Object(r))rt.call(r,t)&&t!="constructor"&&e.push(t);return e}function Lb(r,e,t,i,n,o){var a=t&Rd,u=r.length,p=e.length;if(u!=p&&!(a&&p>u))return!1;var f=o.get(r);if(f&&o.get(e))return f==e;var g=-1,c=!0,h=t&bb?new Ed:void 0;for(o.set(r,e),o.set(e,r);++g<u;){var P=r[g],w=e[g];if(i)var I=a?i(w,P,g,e,r,o):i(P,w,g,r,e,o);if(I!==void 0){if(I)continue;c=!1;break}if(h){if(!vR(e,function(E,D){if(!kR(h,D)&&(P===E||n(P,E,t,i,o)))return h.push(D)})){c=!1;break}}else if(!(P===w||n(P,w,t,i,o))){c=!1;break}}return o.delete(r),o.delete(e),c}function cF(r,e,t,i,n,o,a){switch(t){case Id:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case Eb:return!(r.byteLength!=e.byteLength||!o(new fb(r),new fb(e)));case kb:case Sb:case xb:return Db(+r,+e);case wb:return r.name==e.name&&r.message==e.message;case Ib:case Ab:return r==e+"";case Cd:var u=wR;case xd:var p=i&Rd;if(u||(u=xR),r.size!=e.size&&!p)return!1;var f=a.get(r);if(f)return f==e;i|=bb,a.set(r,e);var g=Lb(u(r),u(e),i,n,o,a);return a.delete(r),g;case tR:if(Qc)return Qc.call(r)==Qc.call(e)}return!1}function mF(r,e,t,i,n,o){var a=t&Rd,u=vb(r),p=u.length,f=vb(e),g=f.length;if(p!=g&&!a)return!1;for(var c=p;c--;){var h=u[c];if(!(a?h in e:rt.call(e,h)))return!1}var P=o.get(r);if(P&&o.get(e))return P==e;var w=!0;o.set(r,e),o.set(e,r);for(var I=a;++c<p;){h=u[c];var E=r[h],D=e[h];if(i)var Ke=a?i(D,E,h,e,r,o):i(E,D,h,r,e,o);if(!(Ke===void 0?E===D||n(E,D,t,i,o):Ke)){w=!1;break}I||(I=h=="constructor")}if(w&&!I){var Cn=r.constructor,da=e.constructor;Cn!=da&&"constructor"in r&&"constructor"in e&&!(typeof Cn=="function"&&Cn instanceof Cn&&typeof da=="function"&&da instanceof da)&&(w=!1)}return o.delete(r),o.delete(e),w}function vb(r){return oF(r,wF,fF)}function Od(r,e){var t=r.__data__;return hF(e)?t[typeof e=="string"?"string":"hash"]:t.map}function hi(r,e){var t=SR(r,e);return dF(t)?t:void 0}function pF(r){var e=rt.call(r,ur),t=r[ur];try{r[ur]=void 0;var i=!0}catch{}var n=Ob.call(r);return i&&(e?r[ur]=t:delete r[ur]),n}var fF=gb?function(r){return r==null?[]:(r=Object(r),hR(gb(r),function(e){return Ub.call(r,e)}))}:CF,Rt=ms;(rm&&Rt(new rm(new ArrayBuffer(1)))!=Id||ls&&Rt(new ls)!=Cd||im&&Rt(im.resolve())!=db||nm&&Rt(new nm)!=xd||sm&&Rt(new sm)!=tm)&&(Rt=function(r){var e=ms(r),t=e==fi?r.constructor:void 0,i=t?pr(t):"";if(i)switch(i){case BR:return Id;case OR:return Cd;case UR:return db;case MR:return xd;case LR:return tm}return e});function gF(r,e){return e=e??Pb,!!e&&(typeof r=="number"||fR.test(r))&&r>-1&&r%1==0&&r<e}function hF(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function yF(r){return!!mb&&mb in r}function vF(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||Fd;return r===t}function bF(r){return Ob.call(r)}function pr(r){if(r!=null){try{return Bb.call(r)}catch{}try{return r+""}catch{}}return""}function Db(r,e){return r===e||r!==r&&e!==e}var PF=yb(function(){return arguments}())?yb:function(r){return cs(r)&&rt.call(r,"callee")&&!Ub.call(r,"callee")},Td=Array.isArray;function kF(r){return r!=null&&Nb(r.length)&&!_b(r)}var om=RR||xF;function SF(r,e){return Mb(r,e)}function _b(r){if(!qb(r))return!1;var e=ms(r);return e==Cb||e==YT||e==ZT||e==eR}function Nb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Pb}function qb(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function cs(r){return r!=null&&typeof r=="object"}var Hb=cb?PR(cb):lF;function wF(r){return kF(r)?sF(r):uF(r)}function CF(){return[]}function xF(){return!1}gi.exports=SF});var e2=xn(Iy(),1);function v(r,e){if(r==null)throw Error(e??"Expected nonnullish value.")}function Ay(r,e){return v(r,e),r}function tr(r,e){if(!r)throw Error(e)}var te;(function(r){r.COMMENT="t1_",r.ACCOUNT="t2_",r.LINK="t3_",r.MESSAGE="t4_",r.SUBREDDIT="t5_",r.AWARD="t6_"})(te||(te={}));function kt(r){return r.startsWith(te.COMMENT)}function Ya(r){return r.startsWith(te.ACCOUNT)}function rr(r){return r.startsWith(te.LINK)}function Ey(r){return r.startsWith(te.MESSAGE)}function Ty(r){return r.startsWith(te.SUBREDDIT)}function Ry(r){return r.startsWith(te.AWARD)}function LA(r){tr(kt(r),`Expected comment id to start with ${te.COMMENT}, got ${r}}`)}function DA(r){tr(Ya(r),`Expected account id to start with ${te.ACCOUNT}, got ${r}}`)}function _A(r){tr(rr(r),`Expected link id to start with ${te.LINK}, got ${r}}`)}function NA(r){tr(Ey(r),`Expected message id to start with ${te.MESSAGE}, got ${r}}`)}function qA(r){tr(Ty(r),`Expected subreddit id to start with ${te.SUBREDDIT}, got ${r}}`)}function HA(r){tr(Ry(r),`Expected award id to start with ${te.AWARD}, got ${r}}`)}function jr(r){return LA(r),r}function ge(r){return DA(r),r}function he(r){return _A(r),r}function jA(r){return NA(r),r}function Re(r){return qA(r),r}function WA(r){return HA(r),r}function Fe(r){if(kt(r))return jr(r);if(Ya(r))return ge(r);if(rr(r))return he(r);if(Ey(r))return jA(r);if(Ty(r))return Re(r);if(Ry(r))return WA(r);throw new Error(`Expected thing id to start with ${Object.values(te).join(", ")} got ${r}}`)}function mc(r){return kt(r)}import*as C from"@devvit/protos";var Qa=class{constructor(e){}};var pc=(t=>(t.Installation="installation",t.App="app",t))(pc||{});function ir(r,e=new Set){for(let t of r){if(t.type==="group"){ir(t.fields,e);continue}let i=t.name;if(e.has(i))throw new Error(`Duplicate field name: ${i}`);e.add(i)}GA(r)}function GA(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 St=Object.freeze({INTERVAL:0,FORM:1,STATE:2,CHANNEL:3});var BU=["activity","add-emoji","add","add-media","add-to-feed","admin","align-center","align-left","align-right","all","appearance","approve","archived","aspect-ratio","aspect-rectangle","attach","audio","author","avatar-style","award","back","ban","best","binoculars","block","blockchain","bold","bot","boost","bounce","browse","browser","cake","calendar","camera","caret-down","caret-left","caret-right","caret-up","chat","chat-group","chat-new","checkbox-dismiss","checkbox","checkmark","chrome","clear","close","closed-captioning","code-block","code-inline","coins-color-old","coins-color","coins","collapse-left","collapse-right","collection","comment","comments","community","contest","controversial","crop","crosspost","crowd-control","custom-feed","customize","day","delete","discover","dismiss-all","distinguish","down-arrow","down","download","downvote","downvotes","drag","drugs","duplicate","edit","effect","embed","emoji","end-live-chat","error","expand-left","expand-right","external","feed-video","filter","format","forward","gif-post","heart","help","hide","history","home","hot","ignore-reports","image-post","inbox","info","invite","italic","join","joined","jump-down","jump-up","karma","keyboard","kick","language","leave","left","link","link-post","list-bulleted","list-numbered","live-chat","live","load","location","lock","logout","loop","mark-read","mask","media-gallery","meme","menu","message","mic","mic-mute","mod","mod-mail","mod-mode","mod-mute","mod-overflow","mod-queue","mod-unmute","music","new","night","notification","notification-frequent","notification-off","nsfw","nsfw-language","nsfw-violence","original","overflow-caret","overflow-horizontal","overflow-vertical","pause","payment","peace","pending-posts","phone","pin","planet","play","poll-post","popular","posts","powerup-color-outline","powerup-fill-color","powerup","predictions","premium","privacy","profile","qa","qr-code","quarantined","quote","r-slash","radio-button","raise-hand","random","ratings-everyone","ratings-mature","ratings-nsfw","ratings-violence","refresh","remove","reply","report","reverse","right","rising","rotate","rotate-image","rpan","rules","safari","save","saved","search","self","send","settings","share-android","share","share-ios","show","side-menu","skipback10","skipforward10","sort-az","sort","sort-price","sort-za","spam","spoiler","sponsored","star","statistics","status-live","sticker","strikethrough","subtract","superscript","swap-camera","swipe-back","swipe-down","swipe","swipe-up","table","tag","tap","telescope","text","text-post","text-size","toggle","tools","top","topic-activism","topic-addictionsupport","topic-advice","topic-animals","topic-anime","topic-art","topic-beauty","topic-business","topic-careers","topic-cars","topic-celebrity","topic-craftsdiy","topic-crypto","topic-culture","topic-diy","topic-entertainment","topic-ethics","topic-family","topic-fashion","topic","topic-fitness","topic-food","topic-funny","topic-gender","topic-health","topic-help","topic-history","topic-hobbies","topic-homegarden","topic-internet","topic-law","topic-learning","topic-lifestyle","topic-marketplace","topic-mature","topic-mensfashion","topic-menshealth","topic-meta","topic-military","topic-movies","topic-music","topic-news","topic-other","topic-outdoors","topic-pets","topic-photography","topic-places","topic-podcasts","topic-politics","topic-programming","topic-reading","topic-religion","topic-science","topic-sexorientation","topic-sports","topic-style","topic-tabletop","topic-technology","topic-television","topic-traumasupport","topic-travel","topic-videogaming","topic-womensfashion","topic-womenshealth","translate","trim","u-slash","unban","undo","unheart","unlock","unmod","unpin","unverified","up-arrow","up","upload","upvote","upvotes","user","user-note","users","vault","verified","video-camera","video-feed","video-live-1","video-live-fill-1","video-live","video-post","video-thread","video-transcription","view-card","view-classic","view-compact","view-grid","views","volume","volume-mute","wallet","warning","wiki-ban","wiki","wiki-unban","world"];import{AppSettingsDefinition as ME,GetFieldsResponse as LE}from"@devvit/protos";import{FormField as Wr,FormFieldType as Ve}from"@devvit/protos";function at(r){return r.map(e=>{switch(e.type){case"string":return zA(e);case"paragraph":return VA(e);case"number":return $A(e);case"select":return JA(e);case"boolean":return KA(e);case"group":return XA(e);default:throw new Error("Unknown field type.")}})}function zA(r){return Wr.fromPartial({defaultValue:{fieldType:Ve.STRING,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{stringConfig:{placeholder:r.placeholder}},fieldId:r.name,fieldType:Ve.STRING,helpText:r.helpText,label:r.label,required:r.required,isSecret:r.isSecret})}function VA(r){return Wr.fromPartial({defaultValue:{fieldType:Ve.PARAGRAPH,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{paragraphConfig:{lineHeight:r.lineHeight,placeholder:r.placeholder}},fieldId:r.name,fieldType:Ve.PARAGRAPH,helpText:r.helpText,label:r.label,required:r.required})}function $A(r){return Wr.fromPartial({defaultValue:{fieldType:Ve.NUMBER,numberValue:r.defaultValue},disabled:r.disabled,fieldConfig:{numberConfig:{}},fieldId:r.name,fieldType:Ve.NUMBER,helpText:r.helpText,label:r.label,required:r.required})}function JA(r){return Wr.fromPartial({defaultValue:{fieldType:Ve.SELECTION,selectionValue:{values:r.defaultValue}},disabled:r.disabled,fieldConfig:{selectionConfig:{choices:r.options,multiSelect:r.multiSelect}},fieldId:r.name,fieldType:Ve.SELECTION,helpText:r.helpText,label:r.label,required:r.required})}function KA(r){return Wr.fromPartial({defaultValue:{fieldType:Ve.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Ve.BOOLEAN,helpText:r.helpText,label:r.label})}function XA(r){return Wr.fromPartial({fieldType:Ve.GROUP,fieldConfig:{groupConfig:{fields:at(r.fields)}},label:r.label,helpText:r.helpText})}function U(r,e){m.prototype[r]=e}import{ValidateFormResponse as UE}from"@devvit/protos";import{RealtimeSubscriptionStatus as Qy}from"@devvit/protos";var Gr;(function(r){function e(o,a){return o.length<=a?o:`${o.slice(0,a-1)}\u2026`}r.ellipsize=e;function t(o){return o[0]==null?o:`${o[0].toLocaleUpperCase()}${o.slice(1)}`}r.capitalize=t;function i(o){return o==null||/^\s*$/.test(o)}r.isBlank=i;function n(o){return o instanceof Error?`${o.stack||o.message||o.name}`:String(o)}r.caughtToString=n})(Gr||(Gr={}));function fc(r){if(r==null||typeof r!="object")return r;for(let e of Object.values(r))fc(e);return Object.freeze(r)}var nM=fc(new Set([Boolean,String,Date,ArrayBuffer,DataView,Array,Object,Map,Set,Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError].map(r=>r.prototype)));var re=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",DebugRenderXML:"devvit-debug-render-xml",GQLHost:"devvit-gql-host",Installation:"devvit-installation",ModPermissions:"devvit-mod-permissions",R2Auth:"devvit-sec-authorization",R2Host:"devvit-r2-host",RemoteHostname:"devvit-remote-hostname",SettingsUri:"devvit-sec-settings-uri",StreamID:"devvit-stream-id",Subreddit:"devvit-subreddit",TraceID:"devvit-trace-id",User:"devvit-user",Version:"devvit-version"});var Zy=xn(Xy(),1),cM=globalThis.Buffer??Zy.Buffer;function ye(r,e){return e?.[r]?.values[0]}function TE(r){let e=Ay(r.method.split("/").at(-1));return e[0].toLocaleLowerCase()+e.slice(1)}var Yy;(function(r){function e(t){let i=t.request?`${t.src} \u2192 ${t.dst}`:`${t.dst} \u2190 ${t.src}`,n=t.streamId.split("-")[0],o=Gr.capitalize(TE(t));return`${i}@${n}/${o}`}r.toLogString=e})(Yy||(Yy={}));function ev(r){function e(t){let i=r.currentHookIndex,n=r.getCurrentComponentState(),o=r.getPreviousComponentState(),a=ye(re.App,r.metadata);v(a,"useChannel - app is missing from Context");let u=ye(re.Installation,r.metadata);v(u,"useChannel - installation is missing from Context");async function p(I){let E=n[i].channel;if(n[i].active)if(n[i].connected)await r.realtime.send(E,I);else throw Error(`Failed to send to channel '${E}'; it is active but not yet connected`);else throw Error(`Cannot send a message over inactive channel: ${E}`)}function f(){if(!n[i].active){let I=n[i].channel;n[i].active=!0,r.addRealtimeChannel(I)}}function g(){if(n[i].active){let I=n[i].channel;n[i].active=!1,r.removeRealtimeChannel(I)}}function c(I){return async()=>{let E;switch(I.status){case Qy.REALTIME_SUBSCRIBED:n[i].connected=!0,E=t.onSubscribed?.();break;case Qy.REALTIME_UNSUBSCRIBED:n[i].connected=!1,E=t.onUnsubscribed?.();break;default:E=t.onMessage(I.event?.data??{});break}await E}}let h={channel:`${a}:${u}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:St.CHANNEL};i in n?h=n[i]:i in o&&(h=o[i]);let P=r.realtimeEvent;r.isInitialRender?h.active=!1:P&&h.active&&P.event.channel===h.channel&&(h.preventCallback||r.runHook(c(P)),r.rerenderIn(0)),n[i]=h,r.currentHookIndex++;let w=0;return h.active&&h.connected?w=2:h.active&&!h.connected?w=1:!h.active&&h.connected?w=3:!h.active&&!h.connected&&(w=4),{subscribe:f,unsubscribe:g,send:p,status:w}}return e}import{FormFieldType as Jn}from"@devvit/protos";function Ic(r){switch(r.fieldType){case Jn.STRING:return r.stringValue;case Jn.PARAGRAPH:return r.stringValue;case Jn.NUMBER:return r.numberValue;case Jn.BOOLEAN:return r.boolValue;case Jn.SELECTION:return r.selectionValue?.values??[];default:return}}function Ct(r){return Object.keys(r).reduce((e,t)=>(e[t]=Ic(r[t]),e),{})}function tv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentKey(),a=r.getCurrentComponentState(),u=r.getPreviousComponentState(),p=`form.hook.${o}.${n}`,f={formKey:p,preventSubmit:!1,type:St.FORM};n in a?f=a[n]:n in u&&(f=u[n]),a[n]=f,r.forms.set(p,t);let g=r.formSubmittedEvent;return g&&!f.preventSubmit&&g.formId===p&&r.runHook(async()=>{let c=i(Ct(g.results));c&&c instanceof Promise&&await c,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function rv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),u=100,p=Math.max(u,i),f={lastRun:void 0,running:!1,preventCallback:!1,type:St.INTERVAL};n in o?f=o[n]:n in a&&(f=a[n]);function g(){i<u&&console.error(`useInterval delay must be at least ${u}ms. Your interval of ${i}ms was automatically extended.`);for(let[h,P]of Object.entries(o))if(h!==n.toString()&&P?.type===St.INTERVAL&&P?.running)throw new Error("Only one useInterval hook may be running at a time");o[n]={running:!0,lastRun:Date.now(),preventCallback:!1,type:St.INTERVAL},r.rerenderIn(p)}function c(){o[n].running=!1,o[n].lastRun=void 0,o[n].preventCallback=!1}return r.isEffectRender&&f.running&&(f.preventCallback||(f.lastRun===void 0||f.lastRun+p<Date.now())&&r.runHook(async()=>{let h=t();h&&h instanceof Promise&&await h,f.lastRun=Date.now()}),r.rerenderIn(p)),f.preventCallback=!1,o[n]=f,r.currentHookIndex++,{start:g,stop:c}}return e}function iv(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 u=t instanceof Function?t():t;if(u instanceof Promise)throw(async()=>{n[i]=await u,r.currentHookIndex=0})();n[i]=u}else n[i]=o[i];function a(u){if(r.isRendering)throw new Error("Cannot call setState while rendering.");n[i]=u instanceof Function?u(n[i]):u}return r.currentHookIndex++,[n[i],a]}return e}var Kr,Xr,id,nv,nd,sv,Zr=class{constructor(e,t){l(this,id);l(this,nd);l(this,Kr,void 0);l(this,Xr,void 0);d(this,Kr,e),d(this,Xr,t)}async getURL(e){return typeof e=="string"?k(this,id,nv).call(this,e):k(this,nd,sv).call(this,e)}};Kr=new WeakMap,Xr=new WeakMap,id=new WeakSet,nv=async function(e){let t=globalThis?.devvit?.config?.assets?.[e];if(t)return t;let i=await s(this,Xr).call(this).GetAssetURL({path:e},s(this,Kr));if(!i.found)throw new Error(`Could not load the URL for asset ${e}`);return i.url},nd=new WeakSet,sv=async function(e){let t={},i=[],n=globalThis?.devvit?.config?.assets;if(n)for(let a of e)n[a]?t[a]=n[a]:i.push(a);else i=e;if(i.length===0)return t;let o=await s(this,Xr).call(this).GetAssetURLs({paths:i},s(this,Kr));i=[];for(let[a,u]of Object.entries(o.urls))u.found?t[a]=u.paths[0]:i.push(a);if(i.length>0)throw new Error(`The following assets were missing from the assets list: ${i.join(", ")}`);return t};var xt,Yr=class{constructor(e){l(this,xt,void 0);d(this,xt,e)}async get(e){let{messages:t}=await m.kvStorePlugin.Get({keys:[e]},s(this,xt));try{if(t[e])return JSON.parse(t[e])}catch{return}}async put(e,t){let i={};i[e]=JSON.stringify(t),await m.kvStorePlugin.Put({messages:i},s(this,xt))}async delete(e){await m.kvStorePlugin.Del({keys:[e]},s(this,xt))}async list(){let{keys:e}=await m.kvStorePlugin.List({filter:"*"},s(this,xt));return e}};xt=new WeakMap;var Kn,Qr=class{constructor(e){l(this,Kn,void 0);d(this,Kn,e)}async upload(e){let t=await m.mediaPlugin.Upload(e,s(this,Kn));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};Kn=new WeakMap;var Xn,ei=class{constructor(e){l(this,Xn,void 0);d(this,Xn,e)}async add(e){await m.modLogPlugin.Add(e,s(this,Xn))}};Xn=new WeakMap;var S,Zn,ri=class{constructor(e){l(this,S,void 0);l(this,Zn,void 0);d(this,S,e),d(this,Zn,new od(e))}get modMail(){return s(this,Zn)}getSubredditById(e){return ve.getById(Fe(e),s(this,S))}getSubredditByName(e){return ve.getByName(e,s(this,S))}addSubredditRemovalReason(e,t){return ve.addRemovalReason(e,t.title,t.message,s(this,S))}getSubredditRemovalReasons(e){return ve.getRemovalReasons(e,s(this,S))}getCurrentSubreddit(){return ve.getFromMetadata(s(this,S))}getPostById(e){return V.getById(Fe(e),s(this,S))}submitPost(e){return V.submit(e,s(this,S))}crosspost(e){return V.crosspost(e,s(this,S))}getUserById(e){return x.getById(Fe(e),s(this,S))}getCollectionById(e){return ti.getCollectionById({collectionId:e},s(this,S))}createCollection(e){return ti.create(e,s(this,S))}getCollectionsForSubreddit(e){return ti.getCollectionsForSubreddit({subredditId:e},s(this,S))}getUserByUsername(e){return x.getByUsername(e,s(this,S))}getCurrentUser(){return x.getFromMetadata(re.User,s(this,S))}getAppUser(){return x.getFromMetadata(re.AppUser,s(this,S))}getSnoovatarUrl(e){return x.getSnoovatarUrl(e,s(this,S))}getCommentById(e){return Z.getById(Fe(e),s(this,S))}getComments(e){return Z.getComments(e,s(this,S))}getCommentsByUser(e){return Z.getCommentsByUser(e,s(this,S))}submitComment(e){return Z.submit({...e,id:Fe(e.id)},s(this,S))}getControversialPosts(e){return V.getControversialPosts(e,s(this,S))}getTopPosts(e){return V.getTopPosts(e,s(this,S))}getHotPosts(e){return V.getHotPosts(e,s(this,S))}getNewPosts(e){return V.getNewPosts(e,s(this,S))}getRisingPosts(e){return V.getRisingPosts(e,s(this,S))}getPostsByUser(e){return V.getPostsByUser(e,s(this,S))}getCommentsAndPostsByUser(e){return x.getOverview(e,s(this,S))}getModerationLog(e){return sd(e,s(this,S))}getApprovedUsers(e){return x.getSubredditUsersByType({type:"contributors",...e},s(this,S))}approveUser(e,t){return x.createRelationship({username:e,subredditName:t,type:"contributor"},s(this,S))}removeUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"contributor"},s(this,S))}getWikiContributors(e){return x.getSubredditUsersByType({type:"wikicontributors",...e},s(this,S))}addWikiContributor(e,t){return x.createRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,S))}removeWikiContributor(e,t){return x.removeRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,S))}getBannedUsers(e){return x.getSubredditUsersByType({type:"banned",...e},s(this,S))}banUser(e){return x.createRelationship({username:e.username,subredditName:e.subredditName,type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,S))}unbanUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"banned"},s(this,S))}getBannedWikiContributors(e){return x.getSubredditUsersByType({type:"wikibanned",...e},s(this,S))}banWikiContributor(e){return x.createRelationship({...e,type:"wikibanned"},s(this,S))}unbanWikiContributor(e,t){return x.removeRelationship({username:e,subredditName:t,type:"wikibanned"},s(this,S))}getModerators(e){return x.getSubredditUsersByType({type:"moderators",...e},s(this,S))}inviteModerator(e){return x.createRelationship({type:"moderator_invite",subredditName:e.subredditName,username:e.subredditName,permissions:e.permissions??[]},s(this,S))}revokeModeratorInvite(e,t){return x.removeRelationship({username:e,subredditName:t,type:"moderator_invite"},s(this,S))}removeModerator(e,t){return x.removeRelationship({type:"moderator",subredditName:t,username:e},s(this,S))}setModeratorPermissions(e,t,i){return x.setModeratorPermissions(e,t,i,s(this,S))}getMutedUsers(e){return x.getSubredditUsersByType({type:"muted",...e},s(this,S))}muteUser(e){return x.createRelationship({...e,type:"muted"},s(this,S))}unmuteUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"muted"},s(this,S))}getModNotes(e){return Oe.get(e,s(this,S))}deleteModNote(e){return Oe.delete(e,s(this,S))}addModNote(e){let t={...e,redditId:Fe(e.redditId)};return Oe.add(t,s(this,S))}addRemovalNote(e){return Oe.addRemovalNote(e,s(this,S))}async sendPrivateMessage(e){return or.send(e,s(this,S))}async sendPrivateMessageAsSubreddit(e){return or.sendAsSubreddit(e,s(this,S))}async approve(e){if(kt(e))return Z.approve(e,s(this,S));if(rr(e))return V.approve(e,s(this,S));throw new Error("id must start with either t1_ or t3_")}async remove(e,t){if(kt(e))return Z.remove(e,t,s(this,S));if(rr(e))return V.remove(e,t,s(this,S));throw new Error("id must start with either t1_ or t3_")}async getPostFlairTemplates(e){return de.getPostFlairTemplates(e,s(this,S))}async getUserFlairTemplates(e){return de.getUserFlairTemplates(e,s(this,S))}async createPostFlairTemplate(e){return de.createPostFlairTemplate(e,s(this,S))}async createUserFlairTemplate(e){return de.createUserFlairTemplate(e,s(this,S))}async editFlairTemplate(e){return de.editFlairTemplate(e,s(this,S))}async deleteFlairTemplate(e,t){return de.deleteFlairTemplate(e,t,s(this,S))}async setUserFlair(e){return Ue.setUserFlair(e,s(this,S))}async removeUserFlair(e,t){return Ue.removeUserFlair(e,t,s(this,S))}async setPostFlair(e){return Ue.setPostFlair(e,s(this,S))}async removePostFlair(e,t){return Ue.removePostFlair(e,he(t),s(this,S))}async getWidgets(e){return ie.getWidgets(e,s(this,S))}async deleteWidget(e,t){return ie.delete(e,t,s(this,S))}async addWidget(e){return ie.add(e,s(this,S))}async reorderWidgets(e,t){return ie.reorder(e,t,s(this,S))}async getWikiPage(e,t){return be.getPage(e,t,s(this,S))}async getWikiPages(e){return be.getPages(e,s(this,S))}async createWikiPage(e){return be.createPage(e,s(this,S))}async updateWikiPage(e){return be.updatePage(e,s(this,S))}getWikiPageRevisions(e){return be.getPageRevisions(e,s(this,S))}async revertWikiPage(e,t,i){return be.revertPage(e,t,i,s(this,S))}async getWikiPageSettings(e,t){return be.getPageSettings(e,t,s(this,S))}async updateWikiPageSettings(e){return be.updatePageSettings(e,s(this,S))}async addEditorToWikiPage(e,t,i){return be.addEditor(e,t,i,s(this,S))}async removeEditorFromWikiPage(e,t,i){return be.removeEditor(e,t,i,s(this,S))}getMessages(e){return or.getMessages(e,s(this,S))}markAllMessagesAsRead(){return or.markAllAsRead(s(this,S))}report(e,t){return m.redditAPIPlugins.LinksAndComments.Report({reason:t.reason,thingId:e.id,srName:e.subredditName,usernames:e.authorName},s(this,S))}getModQueue(e){return ve.aboutLocation({...e,location:"modqueue"},s(this,S))}getReports(e){return ve.aboutLocation({...e,location:"reports"},s(this,S))}getSpam(e){return ve.aboutLocation({...e,location:"spam"},s(this,S))}getUnmoderated(e){return ve.aboutLocation({...e,location:"unmoderated"},s(this,S))}getEdited(e){return ve.aboutLocation({...e,location:"edited"},s(this,S))}};S=new WeakMap,Zn=new WeakMap;import{RedisKeyScope as Ac}from"@devvit/protos";var R,F,B,Ec=class{constructor(e,t,i){l(this,R,void 0);l(this,F,void 0);l(this,B,void 0);d(this,R,e),d(this,F,t),d(this,B,i)}async get(e){return await s(this,R).Get({key:e,transactionId:s(this,F)},s(this,B)),this}async multi(){await s(this,R).Multi(s(this,F),s(this,B))}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),await s(this,R).Set({key:e,value:t,nx:i?.nx===!0,xx:i?.xx===!0,expiration:n||0,transactionId:s(this,F)},s(this,B)),this}async del(...e){return await s(this,R).Del({keys:e,transactionId:s(this,F)},s(this,B)),this}async type(e){return await s(this,R).Type({key:e,transactionId:s(this,F)},s(this,B)),this}async exec(){let e=await s(this,R).Exec(s(this,F),s(this,B)),t=[];for(let i of e.response)i.members?t.push(i.members):i.nil!==void 0?t.push(null):i.num!==void 0?t.push(i.num):i.values!==void 0?t.push(i.values.values):i.str!==void 0&&t.push(i.str);return t}async discard(){await s(this,R).Discard(s(this,F),s(this,B))}async watch(...e){return await s(this,R).Watch({keys:e,transactionId:s(this,F)},s(this,B)),this}async unwatch(){return await s(this,R).Unwatch(s(this,F),s(this,B)),this}async getRange(e,t,i){return await s(this,R).GetRange({key:e,start:t,end:i,transactionId:s(this,F)},s(this,B)),this}async setRange(e,t,i){return await s(this,R).SetRange({key:e,offset:t,value:i,transactionId:s(this,F)},s(this,B)),this}async strlen(e){return await s(this,R).Strlen({key:e,transactionId:s(this,F)},s(this,B)),this}async mget(e){return await s(this,R).MGet({keys:e,transactionId:s(this,F)},s(this,B)),this}async mset(e){let t=Object.entries(e).map(([i,n])=>({key:i,value:n}));return await s(this,R).MSet({kv:t,transactionId:s(this,F)},s(this,B)),this}async incrBy(e,t){return await s(this,R).IncrBy({key:e,value:t,transactionId:s(this,F)},s(this,B)),this}async expire(e,t){return await s(this,R).Expire({key:e,seconds:t,transactionId:s(this,F)},s(this,B)),this}async expireTime(e){return await s(this,R).ExpireTime({key:e,transactionId:s(this,F)},s(this,B)),this}async zAdd(e,...t){return await s(this,R).ZAdd({key:e,members:t,transactionId:s(this,F)},s(this,B)),this}async zScore(e,t){return await s(this,R).ZScore({key:{key:e,transactionId:s(this,F)},member:t},s(this,B)),this}async zRank(e,t){return await s(this,R).ZRank({key:{key:e,transactionId:s(this,F)},member:t},s(this,B)),this}async zIncrBy(e,t,i){return await s(this,R).ZIncrBy({key:e,member:t,value:i,transactionId:s(this,F)},s(this,B)),this}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,F)};return await s(this,R).ZScan(o,s(this,B)),this}async zCard(e){return await s(this,R).ZCard({key:e,transactionId:s(this,F)},s(this,B)),this}async zRange(e,t,i,n){let o={rev:!1,byLex:!1,byScore:!1,offset:0,count:1e3};return n?.reverse&&(o.rev=n.reverse),n?.by==="lex"?o.byLex=!0:n?.by==="score"&&(o.byScore=!0),await s(this,R).ZRange({key:{key:e,transactionId:s(this,F)},start:t+"",stop:i+"",...o},s(this,B)),this}async zRem(e,t){return await s(this,R).ZRem({key:{key:e,transactionId:s(this,F)},members:t},s(this,B)),this}async zRemRangeByLex(e,t,i){return await s(this,R).ZRemRangeByLex({key:{key:e,transactionId:s(this,F)},min:t,max:i},s(this,B)),this}async zRemRangeByRank(e,t,i){return await s(this,R).ZRemRangeByRank({key:{key:e,transactionId:s(this,F)},start:t,stop:i},s(this,B)),this}async zRemRangeByScore(e,t,i){return await s(this,R).ZRemRangeByScore({key:{key:e,transactionId:s(this,F)},min:t,max:i},s(this,B)),this}async hgetall(e){return await s(this,R).HGetAll({key:e,transactionId:s(this,F)},s(this,B)),this}async hget(e,t){return await s(this,R).HGet({key:e,field:t,transactionId:s(this,F)},s(this,B)),this}async hset(e,t){let i=Object.entries(t).map(([n,o])=>({field:n,value:o}));return await s(this,R).HSet({key:e,fv:i,transactionId:s(this,F)},s(this,B)),this}async hincrby(e,t,i){return await s(this,R).HIncrBy({key:e,field:t,value:i,transactionId:s(this,F)},s(this,B)),this}async hdel(e,t){return await s(this,R).HDel({key:e,fields:t,transactionId:s(this,F)},s(this,B)),this}async hscan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,F)};return await s(this,R).HScan(o,s(this,B)),this}async hkeys(e){return await s(this,R).HKeys({key:e,transactionId:s(this,F)},s(this,B)),this}async hlen(e){return await s(this,R).HLen({key:e,transactionId:s(this,F)},s(this,B)),this}};R=new WeakMap,F=new WeakMap,B=new WeakMap;var O,ii,Tc=class Tc{constructor(e,t=void 0,i=Ac.INSTALLATION){l(this,O,void 0);l(this,ii,void 0);d(this,O,e),d(this,ii,t),this.scope=i,this.global=i===Ac.INSTALLATION?new Tc(s(this,O),s(this,ii),Ac.GLOBAL):this}get storage(){return s(this,ii)||m.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,O));return new Ec(this.storage,t,s(this,O))}async get(e){let t=await this.storage.Get({key:e,scope:this.scope},s(this,O));return t!==null?t.value??void 0:t}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),(await this.storage.Set({key:e,value:t,nx:i?.nx===!0&&!i.xx,xx:i?.xx===!0&&!i.nx,expiration:n||0,scope:this.scope},s(this,O))).value}async del(...e){await this.storage.Del({keys:e,scope:this.scope},s(this,O))}async incrBy(e,t){return(await this.storage.IncrBy({key:e,value:t,scope:this.scope},s(this,O))).value}async getRange(e,t,i){let n=await this.storage.GetRange({key:e,start:t,end:i,scope:this.scope},s(this,O));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,O))).value}async strlen(e){return(await this.storage.Strlen({key:e,scope:this.scope},s(this,O))).value}async expire(e,t){await this.storage.Expire({key:e,seconds:t,scope:this.scope},s(this,O))}async expireTime(e){return(await this.storage.ExpireTime({key:e,scope:this.scope},s(this,O))).value}async zAdd(e,...t){return(await this.storage.ZAdd({key:e,members:t,scope:this.scope},s(this,O))).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,O))).members}async zRem(e,t){return(await this.storage.ZRem({key:{key:e},members:t,scope:this.scope},s(this,O))).value}async zRemRangeByLex(e,t,i){return(await this.storage.ZRemRangeByLex({key:{key:e},min:t,max:i,scope:this.scope},s(this,O))).value}async zRemRangeByRank(e,t,i){return(await this.storage.ZRemRangeByRank({key:{key:e},start:t,stop:i,scope:this.scope},s(this,O))).value}async zRemRangeByScore(e,t,i){return(await this.storage.ZRemRangeByScore({key:{key:e},min:t,max:i,scope:this.scope},s(this,O))).value}async zScore(e,t){let i=await this.storage.ZScore({key:{key:e},member:t,scope:this.scope},s(this,O));return i!==null?i.value:i}async zRank(e,t){let i=await this.storage.ZRank({key:{key:e},member:t,scope:this.scope},s(this,O));return i!==null?i.value:i}async zIncrBy(e,t,i){let n=await this.storage.ZIncrBy({key:e,member:t,value:i,scope:this.scope},s(this,O));return n!==null?n.value:n}async mget(e){let t=await this.storage.MGet({keys:e,scope:this.scope},s(this,O));return t!==null?t.values.map(i=>i||null):t}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,O))}async zCard(e){let t=await this.storage.ZCard({key:e,scope:this.scope},s(this,O));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,O))}async type(e){let t=await this.storage.Type({key:e,scope:this.scope},s(this,O));return t!==null?t.value:t}async hget(e,t){let i=await this.storage.HGet({key:e,field:t,scope:this.scope},s(this,O));return i!==null?i.value??void 0:i}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,O))).value}async hgetall(e){let t=await this.storage.HGetAll({key:e,scope:this.scope},s(this,O));return t!==null?t.fieldValues:t}async hdel(e,t){return(await this.storage.HDel({key:e,fields:t,scope:this.scope},s(this,O))).value}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,O))}async hkeys(e){let t=await this.storage.HKeys({key:e,scope:this.scope},s(this,O));return t!==null?t.keys:t}async hincrby(e,t,i){return(await this.storage.HIncrBy({key:e,field:t,value:i,scope:this.scope},s(this,O))).value}async hlen(e){return(await this.storage.HLen({key:e,scope:this.scope})).value}};O=new WeakMap,ii=new WeakMap;var ni=Tc;var ar,si=class{constructor(e){l(this,ar,void 0);d(this,ar,e)}async runJob(e){return(await m.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,ar))).id}async cancelJob(e){await m.schedulerPlugin.Cancel({id:e},s(this,ar))}async listJobs(){return(await m.schedulerPlugin.List({after:new Date(0),before:new Date(Date.now()+31536e7)},s(this,ar))).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}))}};ar=new WeakMap;var Yn,oi=class{constructor(e){l(this,Yn,void 0);d(this,Yn,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await m.settingsPlugin.GetSettings({},s(this,Yn));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...av(t.installationSettings.settings,m.installationSettings),...av(t.appSettings.settings,m.appSettings)}}};Yn=new WeakMap;function av(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=Ic(r[n]),i),{});return e&&dv(t,e),t}function dv(r,e){for(let t of e)t.type==="group"?dv(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as Rc,Form as RE,ToastAppearance as lv}from"@devvit/protos";var dr,ai,ad=class{constructor(e){l(this,dr,[]);l(this,ai,void 0);d(this,ai,e)}showForm(e,t){let i=m.formDefinitions.get(e);if(!i&&s(this,ai)){let a=s(this,ai).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=RE.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});ir(n.fields),o.fields=at(n.fields),s(this,dr).push({type:Rc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?lv.SUCCESS:lv.NEUTRAL}:t={text:e},s(this,dr).push({type:Rc.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,dr).push({type:Rc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,dr)}};dr=new WeakMap,ai=new WeakMap;var Uc={now(){return new Date}};function uv(r){return`__autocache__${r}`}function cv(r){return`__lock__${r}`}var FE=300,BE=1e3,dd=5e3,Fc=3,mv=.1,pv=1e3,OE=3e4;function fv(r){if(r.error)throw new Error(r.error);return r.value}var It,At,Me,di,ud,gv,cd,hv,md,yv,Qn,Bc,pd,vv,fd,bv,es,Oc,gd,Pv,ld=class{constructor(e,t,i=Uc){l(this,ud);l(this,cd);l(this,md);l(this,Qn);l(this,pd);l(this,fd);l(this,es);l(this,gd);l(this,It,void 0);l(this,At,{});l(this,Me,void 0);l(this,di,void 0);d(this,It,e),d(this,di,t),d(this,Me,i)}async cache(e,t){d(this,At,s(this,di).__cache=s(this,di).__cache??{}),k(this,gd,Pv).call(this,t);let i=k(this,ud,gv).call(this,t.key);if(i!==void 0)return i;let n=await k(this,es,Oc).call(this,t.key),o=await k(this,cd,hv).call(this,t,n,e);return fv(o)}};It=new WeakMap,At=new WeakMap,Me=new WeakMap,di=new WeakMap,ud=new WeakSet,gv=function(e){let t=s(this,At)[e];if(t){let i=s(this,Me).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<Fc&&Math.random()<mv&&t.errorTime+pv<i;if(t?.expires&&t.expires<i&&t.checkedAt+pv<i||n){delete s(this,At)[e];return}else return fv(t)}},cd=new WeakSet,hv=async function(e,t,i){let n=t?.expires,o=n?k(this,fd,bv).call(this,n):1;return!t||t?.error&&t.errorCount<Fc&&mv>Math.random()||o>Math.random()?k(this,md,yv).call(this,e,t,i):t},md=new WeakSet,yv=async function(e,t,i){let n=cv(e.key),o=s(this,Me).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,It).set(n,"1",{expiration:a,nx:!0}))return k(this,pd,vv).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Me).now();return k(this,Qn,Bc).call(this,p,e.key,e.ttl)}},Qn=new WeakSet,Bc=async function(e,t,i){let n=Math.min(i,BE),o=await k(this,es,Oc).call(this,t);if(o)return o;if(s(this,Me).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,FE)),k(this,Qn,Bc).call(this,e,t,i)},pd=new WeakSet,vv=async function(e,t,i,n){let o=s(this,Me).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,Me).now().getTime(),t.errorCount++}return s(this,At)[e]=t,await s(this,It).set(uv(e),JSON.stringify(t),{expiration:new Date(o+OE)}),t.error&&t.errorCount<Fc&&await s(this,It).del(cv(e)),t},fd=new WeakSet,bv=function(e){let t=s(this,Me).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},es=new WeakSet,Oc=async function(e){let t=await s(this,It).get(uv(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Me).now().getTime(),s(this,At)[e]=i,i}},gd=new WeakSet,Pv=function(e){e.ttl<dd&&(console.warn(`Cache TTL cannot be less than ${dd} milliseconds! Updating ttl value of ${e.ttl} to ${dd}.`),e.ttl=dd)};function kv(r,e,t=Uc){let i=new ld(r,e,t);return i.cache.bind(i)}var ts,li=class{constructor(e){l(this,ts,void 0);d(this,ts,e)}async send(e,t){await m.realtimePlugin.Send({channel:e,data:t},s(this,ts))}};ts=new WeakMap;function Le({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new ei(r),o=new Yr(r),a=new ni(r),u=kv(a,i?i.state:{}),p=new ri(r),f=new si(r),g=new oi(r),c=e?new ad(i):void 0,h=new Qr(r),P=new Zr(r,()=>m.assetsPlugin),w=new li(r),I=t&&i?iv(i):void 0,E=t&&i?rv(i):void 0,D=t&&i?tv(i):void 0,Ke=t&&i?ev(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:f,settings:g,media:h,assets:P,realtime:w,get useForm(){return D??(()=>{throw new Error("useForm() is unavailable")})},get cache(){return u??(()=>{throw new Error("cache() is unavailable")})},get useState(){return I??(()=>{throw new Error("useState() is unavailable")})},get useInterval(){return E??(()=>{throw new Error("useInterval() is unavailable")})},get useChannel(){return Ke??(()=>{throw new Error("useChannel() is unavailable")})},get ui(){if(!c)throw new Error("ui client is not available");return c}}}function le(r,e,t){let i=ye(re.Subreddit,r);v(i,"subreddit is missing from Context");let n=ye(re.AppUser,r);v(n,"appAccountId is missing from Context");let o=ye(re.User,r),a={metadata:r};return{appAccountId:n,subredditId:i,userId:o,postId:e,commentId:t,debug:a,toJSON(){return{appAccountId:n,subredditId:i,userId:o,postId:e,commentId:t,debug:a}}}}async function hd(r,e,t){if(!e)throw new Error("Settings were not defined.");let i=UE.fromPartial({success:!0,errors:{}}),n=Ct(r.fieldValues),o=e.flatMap(a=>a.type==="group"?a.fields:a);return await Promise.all(o.map(async a=>{let u=a.name;if(u&&a.type!=="group"&&a.onValidate){let p=n[u],f=a.onValidate,g=Object.assign(Le({metadata:t}),le(t)),c=await f({value:p,isEditing:r.editing},g);c&&(i.success=!1,i.errors[u]=c)}})),i}async function DE(){if(!m.appSettings)throw new Error("App settings were not defined.");return LE.fromPartial({fields:{fields:at(m.appSettings)}})}async function _E(r,e){return hd(r,m.appSettings,e)}function Sv(r){r.provides(ME),U("GetAppSettingsFields",DE),U("ValidateAppForm",_E)}import{CustomPostDefinition as YE}from"@devvit/protos";import{BlockRenderEventType as Vc,BlockType as KE,EffectType as qv}from"@devvit/protos";var wv="redd.it",NE="redditstatic.com",qE="redditmedia.com",HE="snoo.dev";var jE=[HE,wv,NE,qE],WE=/^data:([a-zA-Z]+\/[a-zA-Z0-9.+_-]+)?(;charset=[a-zA-Z0-9._+-]+)?(;base64)?,(.*)/;function GE(r){return r.trim().replace(/[\r\n]+/g,"")}function zE(r){let e=WE.exec(GE(r));if(e)return{mimeType:e[1],charset:e[2]?.split("=")[1],isBase64:!!e[3],data:e[4].trim()}}function VE(r){return["image/svg+xml"].includes(r)}function $E(r){let e=zE(r);return e?.mimeType?VE(e.mimeType):!1}function Cv(r){try{if($E(r))return!0;let t=(new URL(r,`https://i.${wv}`)?.hostname).split(".").slice(-2).join(".");return!!t&&jE.includes(t)}catch{return!1}}function ui(r){return r.__effects}function xv(){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 JE,BlockAnimationDirection as Ov,BlockAnimationLoopMode as Uv,BlockAnimationType as Mv,BlockAvatarBackground as Lv,BlockAvatarFacing as Dv,BlockAvatarSize as Et,BlockBorderWidth as vd,BlockButtonAppearance as Tt,BlockButtonSize as Dc,BlockFullSnooSize as ci,BlockGap as bd,BlockHorizontalAlignment as _c,BlockIconSize as Pd,BlockImageResizeMode as rs,BlockPadding as is,BlockRadius as ns,BlockSizeUnit as Nc,BlockSpacerShape as qc,BlockSpacerSize as kd,BlockStackDirection as Hc,BlockTextOutline as jc,BlockTextOverflow as Wc,BlockTextSize as mi,BlockTextStyle as Gc,BlockTextWeight as _v,BlockType as De,BlockVerticalAlignment as zc}from"@devvit/protos";var Mc={transparent:"transparent",black:"#000000",white:"#ffffff","coolgray-950":"#04090A","coolgray-900":"#0B1416","coolgray-850":"#0F1A1C","coolgray-800":"#131F23","coolgray-750":"#1A282D","coolgray-700":"#223237","coolgray-650":"#2A3C42","coolgray-600":"#33464C","coolgray-550":"#4B6066","coolgray-525":"#576F76","coolgray-500":"#667A80","coolgray-450":"#82959B","coolgray-400":"#A0B0B5","coolgray-350":"#B8C5C9","coolgray-300":"#D2DADD","coolgray-250":"#DAE0E3","coolgray-200":"#E2E7E9","coolgray-150":"#EAEDEF","coolgray-100":"#F2F4F5","coolgray-50":"#F9FAFA","puregray-950":"#080808","puregray-900":"#131313","puregray-850":"#181818","puregray-800":"#1E1E1E","puregray-750":"#272727","puregray-700":"#303030","puregray-650":"#393939","puregray-600":"#434343","puregray-550":"#5C5C5C","puregray-500":"#767676","puregray-450":"#919191","puregray-400":"#ACACAC","puregray-350":"#C3C3C3","puregray-300":"#D6D6D6","puregray-250":"#DDDDDD","puregray-200":"#E4E4E4","puregray-150":"#EBEBEB","puregray-100":"#F2F2F2","puregray-50":"#F8F8F8","orangered-950":"#190600","orangered-900":"#340E00","orangered-800":"#4F1500","orangered-700":"#721F00","orangered-600":"#962900","orangered-500":"#D93A00","orangered-400":"#FE7C53","orangered-300":"#FFBEA6","orangered-200":"#FFD5C6","orangered-100":"#FFEDE5","orangered-50":"#FFF6F3","red-950":"#1C0004","red-900":"#3A0008","red-800":"#58000C","red-700":"#7E0011","red-600":"#A50016","red-500":"#EB001F","red-400":"#FF6E80","red-300":"#FFADB8","red-200":"#FFCCD2","red-100":"#FFEAED","red-50":"#FFF6F7","sakurapink-950":"#1A0011","sakurapink-900":"#360024","sakurapink-800":"#530037","sakurapink-700":"#770051","sakurapink-600":"#9B006A","sakurapink-500":"#E00096","sakurapink-400":"#FF55BD","sakurapink-300":"#FFA5E3","sakurapink-200":"#FFC5EC","sakurapink-100":"#FFE5F9","sakurapink-50":"#FFF3FB","berrypurple-950":"#16001F","berrypurple-900":"#2E0041","berrypurple-800":"#470062","berrypurple-700":"#66008C","berrypurple-600":"#8700B5","berrypurple-500":"#BC0EFF","berrypurple-400":"#D55EFF","berrypurple-300":"#EEA7FF","berrypurple-200":"#F2C8FF","berrypurple-100":"#FBE6FF","berrypurple-50":"#FCF4FF","periwinkle-950":"#0D0B1F","periwinkle-900":"#1A1741","periwinkle-800":"#272262","periwinkle-700":"#372F8C","periwinkle-600":"#453BB5","periwinkle-500":"#6A5CFF","periwinkle-400":"#988EFF","periwinkle-300":"#C3BDFF","periwinkle-200":"#D8D4FF","periwinkle-100":"#ECEAFF","periwinkle-50":"#F7F6FF","alienblue-950":"#000C1D","alienblue-900":"#00183D","alienblue-800":"#00255D","alienblue-700":"#003584","alienblue-600":"#0045AC","alienblue-500":"#1870F4","alienblue-400":"#629FFF","alienblue-300":"#A7CCFF","alienblue-200":"#C6DCFF","alienblue-100":"#E4EFFF","alienblue-50":"#F3F7FF","lightblue-950":"#000D12","lightblue-900":"#001C26","lightblue-800":"#002A3A","lightblue-700":"#003F56","lightblue-600":"#005472","lightblue-500":"#007FAE","lightblue-400":"#47B0DB","lightblue-300":"#95DCFB","lightblue-200":"#B6E9FF","lightblue-100":"#D9F6FF","lightblue-50":"#ECFAFF","mintgreen-950":"#00100E","mintgreen-900":"#001E1B","mintgreen-800":"#002E28","mintgreen-700":"#00443C","mintgreen-600":"#005A4F","mintgreen-500":"#008675","mintgreen-400":"#45B9AB","mintgreen-300":"#96E1D8","mintgreen-200":"#B7ECE5","mintgreen-100":"#DAF7F4","mintgreen-50":"#ECFBF9","kiwigreen-950":"#021000","kiwigreen-900":"#032200","kiwigreen-800":"#053200","kiwigreen-700":"#084A00","kiwigreen-600":"#0A6000","kiwigreen-500":"#0E8A00","kiwigreen-400":"#55BD46","kiwigreen-300":"#A3E398","kiwigreen-200":"#BFEEB8","kiwigreen-100":"#DFF8DB","kiwigreen-50":"#EEFCED","lime-950":"#0C0E00","lime-900":"#1A1F00","lime-800":"#282F00","lime-700":"#3A4501","lime-600":"#4D5A01","lime-500":"#6B7E01","lime-400":"#A1B33B","lime-300":"#CFDB83","lime-200":"#DFE8A6","lime-100":"#EFF4CC","lime-50":"#F7FAE5","yellow-950":"#100D01","yellow-900":"#251E02","yellow-800":"#382D03","yellow-700":"#504104","yellow-600":"#665505","yellow-500":"#8F7407","yellow-400":"#DBAF00","yellow-300":"#FADB61","yellow-200":"#FFE88F","yellow-100":"#FFF2BD","yellow-50":"#FFFAE5","yelloworange-950":"#150C00","yelloworange-900":"#2C1A00","yelloworange-800":"#432700","yelloworange-700":"#623A00","yelloworange-600":"#814C00","yelloworange-500":"#B06400","yelloworange-400":"#FF9C1A","yelloworange-300":"#FFCD7C","yelloworange-200":"#FFDDA8","yelloworange-100":"#FFF0D3","yelloworange-50":"#FFF7EA","poopbrown-950":"#110B04","poopbrown-900":"#29190A","poopbrown-800":"#3B2510","poopbrown-700":"#54371A","poopbrown-600":"#6E4924","poopbrown-500":"#9A6D3F","poopbrown-400":"#CAA075","poopbrown-300":"#EECCAA","poopbrown-200":"#F6DDC3","poopbrown-100":"#FEEEDD","poopbrown-50":"#FEF7EE",pizzaRed:{light:"#ef5350",dark:"#c62828"},"global-brand-orangered":{light:"#FF4500",dark:"#FF4500"},"global-focus":{light:"#47B0DB",dark:"#007FAE"},"interactive-content-disabled":{light:"#0000003f",dark:"#ffffff3f"},"interactive-background-disabled":{light:"#0000000c",dark:"#ffffff0c"},"interactive-pressed":{light:"#00000028",dark:"#ffffff28"},"neutral-content":{light:"#2A3C42",dark:"#B8C5C9"},"neutral-content-disabled":{light:"#D6D6D6",dark:"#303030"},"neutral-content-weak":{light:"#576F76",dark:"#82959B"},"neutral-content-strong":{light:"#0F1A1C",dark:"#F2F4F5"},"neutral-background":{light:"#ffffff",dark:"#0B1416"},"neutral-background-selected":{light:"#EAEDEF",dark:"#1A282D"},"neutral-background-weak":{light:"#F9FAFA",dark:"#04090A"},"neutral-background-medium":{light:"#F8F8F8",dark:"#131313"},"neutral-background-strong":{light:"#ffffff",dark:"#0F1A1C"},"neutral-background-hover":{light:"#F2F4F5",dark:"#131F23"},"neutral-border":{light:"#00000033",dark:"#ffffff33"},"neutral-border-medium":{light:"#0000007f",dark:"#ffffff7f"},"neutral-border-weak":{light:"#00000019",dark:"#ffffff19"},"neutral-border-strong":{light:"#0F1A1C",dark:"#F2F4F5"},primary:{light:"#0045AC",dark:"#629FFF"},"primary-hover":{light:"#003584",dark:"#A7CCFF"},"primary-visited":{light:"#8700B5",dark:"#D55EFF"},"primary-onBackground":{light:"#ffffff",dark:"#ffffff"},"primary-onBackground-selected":{light:"#ffffff",dark:"#000000"},"primary-background":{light:"#0045AC",dark:"#0045AC"},"primary-background-hover":{light:"#003584",dark:"#1870F4"},"primary-background-selected":{light:"#00255D",dark:"#629FFF"},secondary:{light:"#0F1A1C",dark:"#F2F4F5"},"secondary-hover":{light:"#000000",dark:"#ffffff"},"secondary-weak":{light:"#576F76",dark:"#82959B"},"secondary-onBackground":{light:"#000000",dark:"#ffffff"},"secondary-background":{light:"#EAEDEF",dark:"#1A282D"},"secondary-background-hover":{light:"#E2E7E9",dark:"#223237"},"secondary-background-selected":{light:"#D2DADD",dark:"#33464C"},"secondary-plain":{light:"#0F1A1C",dark:"#F2F4F5"},"secondary-plain-hover":{light:"#000000",dark:"#ffffff"},"danger-background":{light:"#EB001F",dark:"#A50016"},"danger-background-disabled":{light:"#FFCCD2",dark:"#3A0008"},"danger-background-hover":{light:"#A50016",dark:"#EB001F"},"danger-onBackground":{light:"#ffffff",dark:"#ffffff"},"danger-content":{light:"#A50016",dark:"#FF6E80"},"danger-content-hover":{light:"#7E0011",dark:"#FFADB8"},"danger-content-default":{light:"#ffffff",dark:"#ffffff"},"brand-background":{light:"#D93A00",dark:"#D93A00"},"brand-onBackground":{light:"#ffffff",dark:"#ffffff"},"brand-background-hover":{light:"#962900",dark:"#962900"},"media-background":{light:"#00000099",dark:"#00000099"},"media-onbackground":{light:"#ffffff",dark:"#ffffff"},"media-onbackground-weak":{light:"#E2E7E9",dark:"#E2E7E9"},"media-background-hover":{light:"#000000cc",dark:"#000000cc"},"media-onbackground-disabled":{light:"#ffffff3f",dark:"#ffffff3f"},"media-border-selected":{light:"#ffffff",dark:"#ffffff"},"media-background-selected":{light:"#000000cc",dark:"#000000cc"},"success-content":{light:"#0A6000",dark:"#55BD46"},"success-hover":{light:"#084A00",dark:"#A3E398"},"success-onBackground":{light:"#ffffff",dark:"#ffffff"},"success-background":{light:"#0E8A00",dark:"#0A6000"},"success-background-hover":{light:"#0A6000",dark:"#0E8A00"},"warning-content":{light:"#665505",dark:"#DBAF00"},"warning-content-hover":{light:"#504104",dark:"#FADB61"},"warning-onBackground":{light:"#000000",dark:"#000000"},"warning-background":{light:"#DBAF00",dark:"#DBAF00"},"warning-background-hover":{light:"#8F7407",dark:"#FADB61"},"upvote-content":{light:"#962900",dark:"#FE7C53"},"upvote-content-weak":{light:"#FF4500",dark:"#FF4500"},"upvote-disabled":{light:"#9629004c",dark:"#FE7C534c"},"upvote-onBackground":{light:"#ffffff",dark:"#ffffff"},"upvote-background":{light:"#D93A00",dark:"#D93A00"},"upvote-background-hover":{light:"#962900",dark:"#962900"},"upvote-background-disabled":{light:"#D93A004c",dark:"#D93A004c"},"downvote-content":{light:"#453BB5",dark:"#988EFF"},"downvote-content-weak":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-disabled":{light:"#453BB54c",dark:"#988EFF4c"},"downvote-onBackground":{light:"#ffffff",dark:"#ffffff"},"downvote-background":{light:"#6A5CFF",dark:"#453BB5"},"downvote-background-hover":{light:"#453BB5",dark:"#453BB5"},"downvote-background-disabled":{light:"#6A5CFF4c",dark:"#6A5CFF4c"},"brand-gradient-default":{light:"",dark:""},"brand-gradient-default-highlight":{light:"",dark:""},"brand-gradient-hover":{light:"",dark:""},"brand-gradient-hover-highlight":{light:"",dark:""},"brand-gradient-active":{light:"",dark:""},"brand-gradient-active-highlight":{light:"",dark:""},"gradient-media":{light:"",dark:""},"gradient-media-strong":{light:"",dark:""},"transparent-background-hover":{light:"#82959B19",dark:"#667A8019"},"global-black":{light:"#000000",dark:"#000000"},"global-white":{light:"#ffffff",dark:"#ffffff"},"global-orangered":{light:"#D93A00",dark:"#D93A00"},"global-alienblue":{light:"#1870F4",dark:"#1870F4"},"global-darkblue":{light:"#131F23",dark:"#131F23"},"tone-1":{light:"#131313",dark:"#F2F2F2"},"tone-2":{light:"#434343",dark:"#ACACAC"},"tone-3":{light:"#ACACAC",dark:"#434343"},"tone-4":{light:"#E4E4E4",dark:"#303030"},"tone-5":{light:"#F2F2F2",dark:"#1E1E1E"},"tone-6":{light:"#F8F8F8",dark:"#131313"},"tone-7":{light:"#ffffff",dark:"#080808"},"action-upvote":{light:"#D93A00",dark:"#D93A00"},"action-downvote":{light:"#6A5CFF",dark:"#6A5CFF"},"alert-caution":{light:"#8F7407",dark:"#8F7407"},"identity-admin":{light:"#D93A00",dark:"#D93A00"},"identity-moderator":{light:"#0E8A00",dark:"#0E8A00"},"identity-self":{light:"#008675",dark:"#008675"},"identity-coins":{light:"#DBAF00",dark:"#DBAF00"},"category-live":{light:"#D93A00",dark:"#D93A00"},"category-nsfw":{light:"#E00096",dark:"#E00096"},"category-spoiler":{light:"#131313",dark:"#F2F2F2"},"ui-canvas":{light:"#F2F2F2",dark:"#080808"},"ui-modalbackground":{light:"#ffffff",dark:"#0F1A1C"},"avatar-gradient":{light:"",dark:""},"opacity-highlight":{light:"",dark:""},"opacity-08":{light:"#13131314",dark:"#13131314"},"opacity-50":{light:"#0000007f",dark:"#F2F2F27f"},scrim:{light:"#00000099",dark:"#00000099"},"scrim-strong":{light:"#000000cc",dark:"#000000cc"},"scrim-gradient":{light:"",dark:""},online:{light:"#55BD46",dark:"#55BD46"},favorite:{light:"#8F7407",dark:"#DBAF00"}};var Iv={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"},Av=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),Ev=r=>r in Mc,Lc=r=>r in Iv,Tv=r=>!!r.match(/^rgba?\(.*/),Rv=r=>!!r.match(/^hsla?\(.*/),Fv=(r,e="light")=>{if(Lc(r))return yd(r);let i=Mc[r];return typeof i=="string"?i:i[e]},yd=r=>Iv[r]??r,Bv=r=>{let[e,t,i,n]=r.replace(/^rgba?\(|\s+|\)$/g,"").split(",");if(!e||!t||!i)return r;let a=[...[e,t,i].map(p=>parseFloat(p))];if(n){let p=parseFloat(n),f=Math.round(p*255);a.push(f)}return`#${a.map(p=>p.toString(16).padStart(2,"0")).join("")}`};var Nv="data-",pi=class{async createBlocksElementOrThrow({type:e,props:t,children:i}){let n=await this.createBlocksElement({type:e,props:t,children:i});if(!n)throw new Error(`Could not create block of type ${e}`);return n}async createBlocksElement({type:e,props:t,children:i}){switch(e){case"blocks":return this.makeRoot(t,...i);case"hstack":return this.makeHStack(t,...i);case"vstack":return this.makeVStack(t,...i);case"zstack":return this.makeZStack(t,...i);case"text":return this.makeText(t,...i);case"button":return this.makeButton(t,...i);case"image":return await this.makeImage(t);case"spacer":return this.makeSpacer(t);case"icon":return this.makeIcon(t);case"avatar":return this.makeAvatar(t);case"fullsnoo":return this.makeFullSnoo(t);case"animation":return await this.makeAnimation(t);case"webview":return this.makeWebView(t);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 is.PADDING_NONE;case"xsmall":return is.PADDING_XSMALL;case"small":return is.PADDING_SMALL;case"medium":return is.PADDING_MEDIUM;case"large":return is.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return ns.RADIUS_NONE;case"small":return ns.RADIUS_SMALL;case"medium":return ns.RADIUS_MEDIUM;case"large":return ns.RADIUS_LARGE;case"full":return ns.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return bd.GAP_NONE;case"small":return bd.GAP_SMALL;case"medium":return bd.GAP_MEDIUM;case"large":return bd.GAP_LARGE}}makeBlockAlignment(e){if(e===void 0)return;let t,i;if(e.includes("top")?t=zc.ALIGN_TOP:e.includes("middle")?t=zc.ALIGN_MIDDLE:e.includes("bottom")&&(t=zc.ALIGN_BOTTOM),e.includes("start")?i=_c.ALIGN_START:e.includes("center")?i=_c.ALIGN_CENTER:e.includes("end")&&(i=_c.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=vd.BORDER_WIDTH_NONE;break;case"thin":o=vd.BORDER_WIDTH_THIN;break;case"thick":o=vd.BORDER_WIDTH_THICK;break;default:o=vd.BORDER_WIDTH_THIN;break}let a=t??"neutral-border-weak",u=this.getThemedColors(a,i,n);return{width:o,color:u?.light,colors:u}}makeBlockTextSize(e){switch(e){case"xsmall":return mi.TEXT_SIZE_XSMALL;case"small":return mi.TEXT_SIZE_SMALL;case"medium":return mi.TEXT_SIZE_MEDIUM;case"large":return mi.TEXT_SIZE_LARGE;case"xlarge":return mi.TEXT_SIZE_XLARGE;case"xxlarge":return mi.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return Gc.TEXT_STYLE_BODY;case"metadata":return Gc.TEXT_STYLE_METADATA;case"heading":return Gc.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return jc.TEXT_OUTLINE_NONE;case"thin":return jc.TEXT_OUTLINE_THIN;case"thick":return jc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return _v.TEXT_WEIGHT_REGULAR;case"bold":return _v.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return Wc.TEXT_OVERFLOW_CLIP;case"ellipsis":return Wc.TEXT_OVERFLOW_ELLIPSE}return Wc.TEXT_OVERFLOW_ELLIPSE}makeBlockButtonAppearance(e){switch(e){case"secondary":return Tt.BUTTON_APPEARANCE_SECONDARY;case"primary":return Tt.BUTTON_APPEARANCE_PRIMARY;case"plain":return Tt.BUTTON_APPEARANCE_PLAIN;case"bordered":return Tt.BUTTON_APPEARANCE_BORDERED;case"media":return Tt.BUTTON_APPEARANCE_MEDIA;case"destructive":return Tt.BUTTON_APPEARANCE_DESTRUCTIVE;case"caution":return Tt.BUTTON_APPEARANCE_CAUTION;case"success":return Tt.BUTTON_APPEARANCE_SUCCESS}}makeBlockButtonSize(e){switch(e){case"small":return Dc.BUTTON_SIZE_SMALL;case"medium":return Dc.BUTTON_SIZE_MEDIUM;case"large":return Dc.BUTTON_SIZE_LARGE}}makeBlockImageResizeMode(e){switch(e){case"none":return rs.IMAGE_RESIZE_NONE;case"fit":return rs.IMAGE_RESIZE_FIT;case"fill":return rs.IMAGE_RESIZE_FILL;case"cover":return rs.IMAGE_RESIZE_COVER;case"scale-down":return rs.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return kd.SPACER_XSMALL;case"small":return kd.SPACER_SMALL;case"medium":return kd.SPACER_MEDIUM;case"large":return kd.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return qc.SPACER_INVISIBLE;case"thin":return qc.SPACER_THIN;case"square":return qc.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return Pd.ICON_SIZE_XSMALL;case"small":return Pd.ICON_SIZE_SMALL;case"medium":return Pd.ICON_SIZE_MEDIUM;case"large":return Pd.ICON_SIZE_LARGE}}makeBlockAvatarSize(e){switch(e){case"xxsmall":return Et.AVATAR_SIZE_XXSMALL;case"xsmall":return Et.AVATAR_SIZE_XSMALL;case"small":return Et.AVATAR_SIZE_SMALL;case"medium":return Et.AVATAR_SIZE_MEDIUM;case"large":return Et.AVATAR_SIZE_LARGE;case"xlarge":return Et.AVATAR_SIZE_XXLARGE;case"xxlarge":return Et.AVATAR_SIZE_XXLARGE;case"xxxlarge":return Et.AVATAR_SIZE_XXXLARGE}}makeBlockAvatarFacing(e){switch(e){case"left":return Dv.AVATAR_FACING_LEFT;case"right":return Dv.AVATAR_FACING_RIGHT}}makeBlockFullSnooSize(e){switch(e){case"xsmall":return ci.FULLSNOO_XSMALL;case"small":return ci.FULLSNOO_SMALL;case"medium":return ci.FULLSNOO_MEDIUM;case"large":return ci.FULLSNOO_LARGE;case"xlarge":return ci.FULLSNOO_XLARGE;case"xxlarge":return ci.FULLSNOO_XXLARGE}}makeBlockAvatarBackground(e){switch(e){case"dark":return Lv.AVATAR_BG_DARK;case"light":return Lv.AVATAR_BG_LIGHT}}makeBlockAnimationType(e){return e==="lottie"||e===void 0?Mv.ANIM_LOTTIE:Mv.UNRECOGNIZED}makeBlockAnimationDirection(e){switch(e){case"backward":return Ov.ANIM_DIR_BACKWARD;case"forward":return Ov.ANIM_DIR_FORWARD}}makeBlockLoopMode(e){switch(e){case"repeat":return Uv.ANIM_LOOP_REPEAT;case"bounce":return Uv.ANIM_LOOP_BOUNCE}}makeBlockSize(e){if(e&&(e.width!=null||e.height!=null||e.grow)){let{value:t,unit:i}=this.parseSize(e.width)??{},{value:n,unit:o}=this.parseSize(e.height)??{};return{width:t,widthUnit:i,height:n,heightUnit:o,grow:e.grow}}}makeBlockSizes(e){if(e){let t=e.width!=null||e.minWidth!=null||e.maxWidth!=null,i=e.height!=null||e.minHeight!=null||e.maxHeight!=null;if(t||i||e.grow!=null)return{width:t?{value:this.parseSize(e.width),min:this.parseSize(e.minWidth),max:this.parseSize(e.maxWidth)}:void 0,height:i?{value:this.parseSize(e.height),min:this.parseSize(e.minHeight),max:this.parseSize(e.maxHeight)}:void 0,grow:e.grow}}}parseSize(e){if(e==null)return;if(typeof e=="number")return{value:e,unit:Nc.SIZE_UNIT_PERCENT};let t=e.match(/^(\d+(?:\.\d+)?)(px|%)?$/);if(t==null)return;let i=Nc.SIZE_UNIT_PERCENT;return t?.at(2)==="px"&&(i=Nc.SIZE_UNIT_PIXELS),{value:Number.parseFloat(t[1]),unit:i}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(Nv)).reduce((t,i)=>(t[i.substring(Nv.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);if(t.onPress){let o=t.onPress;i.push({type:JE.ACTION_CLICK,id:o.toString(),data:n})}return i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),Av(e)?e:Ev(e)?Fv(e,t):Lc(e)?yd(e):Tv(e)?Bv(e):Rv(e)?e:(console.warn(`Could not parse color: ${e}.`),yd("red"))}async childrenToBlocks(e){let t=e.map(n=>{if(typeof n!="string")return this.createBlocksElement(n)});return(await Promise.all(t)).filter(n=>n!==void 0)}getThemedColors(e,t,i){let n=this.blockColorToHex(t,"light"),o=this.blockColorToHex(i,"dark"),a=[];if(e&&(!n||!o)){let u=Array.from(e?.matchAll(/[\w#-]+(?:\([\w\t ,.#-]+\))?/g)??[]);a.push(...u.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}childrenToString(e){return e.map(t=>t.toString()).join("")}async makeRoot(e,...t){return this.wrapRoot(e,await this.childrenToBlocks(t))}async wrapRoot(e,t){return this.makeBlock(De.BLOCK_ROOT,{},{rootConfig:{children:t,height:this.makeRootHeight(m.customPostType?.height??e?.height??"regular")}})}async makeStackBlock(e,t,i){let n=this.getThemedColors(t?.backgroundColor,t?.lightBackgroundColor,t?.darkBackgroundColor);return this.makeBlock(De.BLOCK_STACK,t,{stackConfig:{alignment:this.makeBlockAlignment(t?.alignment),backgroundColor:n?.light,backgroundColors:n,border:this.makeBlockBorder(t?.border,t?.borderColor,t?.lightBorderColor,t?.darkBorderColor),children:await this.childrenToBlocks(i),cornerRadius:this.makeBlockRadius(t?.cornerRadius),direction:e,gap:this.makeBlockGap(t?.gap),padding:this.makeBlockPadding(t?.padding),reverse:t?.reverse}})}async makeHStack(e,...t){return this.makeStackBlock(Hc.STACK_HORIZONTAL,e,t)}async makeVStack(e,...t){return this.makeStackBlock(Hc.STACK_VERTICAL,e,t)}async makeZStack(e,...t){return this.makeStackBlock(Hc.STACK_DEPTH,e,t)}makeText(e,...t){let i=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(De.BLOCK_TEXT,e,{textConfig:{alignment:this.makeBlockAlignment(e?.alignment),color:i?.light,colors:i,outline:this.makeBlockTextOutline(e?.outline),size:this.makeBlockTextSize(e?.size),style:this.makeBlockTextStyle(e?.style),text:this.childrenToString(t),weight:this.makeBlockTextWeight(e?.weight),selectable:e?.selectable,wrap:e?.wrap,overflow:this.makeBlockTextOverflow(e?.overflow)}})}makeButton(e,...t){let i=this.getThemedColors(e?.textColor,e?.lightTextColor,e?.darkTextColor);return this.makeBlock(De.BLOCK_BUTTON,e,{buttonConfig:{buttonAppearance:this.makeBlockButtonAppearance(e?.appearance),icon:e?.icon,buttonSize:this.makeBlockButtonSize(e?.size),text:this.childrenToString(t),textColor:i?.light,textColors:i,disabled:e?.disabled}})}async makeImage(e){return e&&this.makeBlock(De.BLOCK_IMAGE,e,{imageConfig:{description:e?.description,resizeMode:this.makeBlockImageResizeMode(e.resizeMode),url:e.url,width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight)}})}makeSpacer(e){return this.makeBlock(De.BLOCK_SPACER,e,{spacerConfig:{size:this.makeBlockSpacerSize(e?.size),shape:this.makeBlockSpacerShape(e?.shape)}})}makeIcon(e){let t=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return e&&this.makeBlock(De.BLOCK_ICON,e,{iconConfig:{icon:e.name,color:t?.light,colors:t,size:this.makeBlockIconSize(e.size)}})}makeAvatar(e){return e&&this.makeBlock(De.BLOCK_AVATAR,e,{avatarConfig:{thingId:e.thingId,size:this.makeBlockAvatarSize(e.size),facing:this.makeBlockAvatarFacing(e.facing),background:this.makeBlockAvatarBackground(e.background)}})}makeFullSnoo(e){return e&&this.makeBlock(De.BLOCK_FULLSNOO,e,{fullsnooConfig:{userId:e.userId,facing:this.makeBlockAvatarFacing(e.facing),size:this.makeBlockFullSnooSize(e.size)}})}async makeAnimation(e){return e&&this.makeBlock(De.BLOCK_ANIMATION,e,{animationConfig:{type:this.makeBlockAnimationType(e.type),url:e.url,loop:e.loop,loopMode:this.makeBlockLoopMode(e.loopMode),autoplay:e.autoplay,width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight),direction:this.makeBlockAnimationDirection(e.direction),speed:e.speed}})}makeWebView(e){return e&&this.makeBlock(De.BLOCK_WEBVIEW,e,{webviewConfig:{url:e.url}})}makeBlock(e,t,i){return{type:e,size:this.makeBlockSize(t),sizes:this.makeBlockSizes(t),config:i,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}async ensureRootBlock(e){let t=e;if(t.type===De.BLOCK_ROOT)return t.config?.rootConfig&&m.customPostType?.height&&(t.config.rootConfig.height=this.makeRootHeight(m.customPostType?.height)),t;let i=await this.wrapRoot(void 0,[t]);if(!i)throw new Error("Could not create root block");return i}};function Hv(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var jv=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+=jv(i);return e+=`</${r.type}>`,e};function XE(r){return" ".repeat(r)}function ZE(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+=XE(t),n!==0&&(e+="<"),e+=o,n!==i.length-1&&(e+=`>
2
- `),!a&&o.indexOf("</")===-1&&o.charAt(o.length-1)!=="/"&&t++}return e}var Sd,Wv,lr,ss,os,$c,as,lt=class{constructor(e,t,i,n,o){l(this,Sd);l(this,lr);l(this,os);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 pi;this.effects=[];l(this,as,!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={type:this.component,props:k(this,lr,ss).call(this),children:[]},t=await this.processBlock(e);if(Hv(t),await this.transformer.createBlocksElementOrThrow(t),this.isUserActionRender&&this.blockRenderEventId){let i=this.actions.get(this.blockRenderEventId);i&&await i({})}for(let i of this.pendingHooks)await i();this.buildNextState(),k(this,Sd,Wv).call(this)}async buildBlocksUI(){let e={type:this.component,props:k(this,lr,ss).call(this),children:[]},t=await this.renderElement(e);return this.transformer.ensureRootBlock(t)}async renderElement(e){let t=await this.processBlock(e);return Hv(t),(m.debug.emitSnapshots||ye(re.DebugRenderXML,this.metadata))&&console.log(ZE(jv(t))),m.debug.emitState&&console.log(JSON.stringify(this.state,null,2)),await this.transformer.createBlocksElementOrThrow(t)}async processProps(e){if(e.onPress){let t=e.onPress,i=t.name,n=this.makeUniqueActionID(`${KE.BLOCK_BUTTON}.${i??"onPress"}`);this.actions.set(n,t),e.onPress=n}e.url&&(e.url=await this.getAssetUrl(e.url))}async getAssetUrl(e){let t,i=globalThis?.devvit?.config?.assets;if(i&&(t=i[e]),!t&&!Cv(e)){console.log("No assets loaded on the config - falling back to plugin");try{t=await this.assets.getURL(e),i&&t&&(i[e]=t)}catch{}}return t??e}async processBlock(e,t=xv(),i=[]){let n=e;if(typeof n.type=="string"){let p=(await Promise.all(n.children.flatMap(async(c,h)=>c==null?[]:await this.processBlock(c,t,[...i,`${n.type}.${h}`])))).flat(),f=k(this,os,$c).call(this,p);return await this.processProps(n.props||{}),{type:n.type,props:n.props,children:f}}if(typeof n.type=="function"){let u=t(`${i.length?i.join("."):"root"}.${n.type.name.length?n.type.name:"anonymous"}`);this.currentComponentKey.push(u),this.renderState[u]||(this.renderState[u]={});let p=n.children.flatMap(c=>c),f={...k(this,lr,ss).call(this),...n.props,children:p},g;for(;g===void 0;)try{g=await n.type(f,k(this,lr,ss).call(this))}catch(c){if(c instanceof Promise)g=await c;else throw c}if(!this.isInitialRender){let c=this.getPreviousComponentState();if(Object.keys(c).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 g=="object")return this.processBlock(g,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(u,p)=>await this.processBlock(u,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===Vc.RENDER_INITIAL:!1}get isUserActionRender(){return this.event?this.event.type===Vc.RENDER_USER_ACTION:!1}get isEffectRender(){return this.event?this.event.type===Vc.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,as)||(d(this,as,!0),this.effects.push({type:qv.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:qv.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:this.realtimeChannels}}]:[]}getEffects(){return[...ui(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}:{}}}};Sd=new WeakSet,Wv=function(){this.actions.clear(),this.currentComponentKey=[],this.currentHookIndex=0,this.pendingHooks=[],this.realtimeChannels=[],this.realtimeUpdated=!1},lr=new WeakSet,ss=function(){let e={...le(this.metadata,this.state.__postData?.thingId),modLog:this.modLog,reddit:this.reddit,cache:this.cache,kvStore:this.kvStore,redis:this.redis,settings:this.settings,scheduler:this.scheduler,media:this.media,assets:this.assets,realtime:this.realtime,ui:this.ui,dimensions:this.dimensions,...this.hooks};return e.debug.effects=this,e},os=new WeakSet,$c=function(e){let t=[];for(let i of e)typeof i=="string"?t.push(i):i.type==="__fragment"?t.push(...k(this,os,$c).call(this,i.children)):t.push(i);return t},as=new WeakMap;async function QE(r,e){let t=m.customPostType;if(!t)throw new Error("Custom post type not registered");let i=new lt((o,a)=>t.render(a),r.blocks,r.state,e,r.dimensions),n=await i.render();return{state:i.state,blocks:{ui:n},effects:i.getEffects()}}function Gv(r){r.provides(YE),U("RenderPost",QE)}import{GetFieldsResponse as eT,InstallationSettingsDefinition as tT}from"@devvit/protos";async function rT(){if(!m.installationSettings)throw new Error("Installation settings were not defined.");return eT.fromPartial({fields:{fields:at(m.installationSettings)}})}async function iT(r,e){return hd(r,m.installationSettings,e)}function zv(r){r.provides(tT),U("GetSettingsFields",rT),U("ValidateForm",iT)}import{ContextActionDefinition as nT,ContextActionDescription as sT,ContextActionResponse as oT}from"@devvit/protos";var Vv=r=>`menuItem.${r}`;function Jc(r){return m.menuItems.find((e,t)=>Vv(t)===r)}async function aT(r,e){let t=m.menuItems;if(!t.length)throw new Error("No menu items registered.");return{actions:t.map((n,o)=>sT.fromPartial({actionId:Vv(o),name:n.label,description:n.description,contexts:{subreddit:n.location.includes("subreddit"),post:n.location.includes("post"),comment:n.location.includes("comment")},users:{loggedOut:n.forUserType?.includes("loggedOut"),member:n.forUserType?.includes("member"),moderator:n.forUserType?.includes("moderator")},postFilters:n.postFilter==="currentApp"?{currentApp:!0}:void 0}))}}async function dT(r,e){let t=Jc(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 u={targetId:a,location:r.comment?"comment":r.post?"post":"subreddit"},p=Object.assign(Le({ui:!0,metadata:e}),le(e,n,i));return await t.onPress(u,p),oT.fromPartial({effects:ui(p.ui)})}function $v(r){r.provides(nT),U("GetActions",aT),U("OnAction",dT)}function ut(r){return r?r===!0?!0:r.enabled:!1}import{SchedulerHandlerDefinition as lT}from"@devvit/protos";async function uT(r,e){let t=r.type,i=m.scheduledJobHandlers.get(t);if(!i)throw new Error(`Job ${t} not found`);let n={name:t,data:r.data},o=Object.assign(Le({metadata:e}),le(e));await i(n,o)}function Jv(r){r.provides(lT),U("HandleScheduledAction",uT)}import{HandlerResult as cT,OnAppInstallDefinition as mT,OnAppUpgradeDefinition as pT,OnCommentCreateDefinition as fT,OnCommentDeleteDefinition as gT,OnCommentReportDefinition as hT,OnCommentSubmitDefinition as yT,OnCommentUpdateDefinition as vT,OnModActionDefinition as bT,OnModMailDefinition as PT,OnPostCreateDefinition as kT,OnPostDeleteDefinition as ST,OnPostFlairUpdateDefinition as wT,OnPostReportDefinition as CT,OnPostSubmitDefinition as xT,OnPostUpdateDefinition as IT}from"@devvit/protos";function ne(r,e){return v(e),async(t,i)=>{let n={...t,type:r},o=Object.assign(Le({metadata:i}),le(i)),a=await Promise.allSettled(e.map(p=>p(n,o))),u=AT(a);if(u)throw u.err;return cT.fromPartial({})}}function Kv(r){for(let e of m.triggerOnEventHandlers.keys())switch(e){case"PostSubmit":r.provides(xT),U("OnPostSubmit",ne("PostSubmit",m.triggerOnEventHandlers.get(e)));break;case"PostCreate":r.provides(kT),U("OnPostCreate",ne("PostCreate",m.triggerOnEventHandlers.get(e)));break;case"PostUpdate":r.provides(IT),U("OnPostUpdate",ne("PostUpdate",m.triggerOnEventHandlers.get(e)));break;case"PostReport":r.provides(CT),U("OnPostReport",ne("PostReport",m.triggerOnEventHandlers.get(e)));break;case"PostDelete":r.provides(ST),U("OnPostDelete",ne("PostDelete",m.triggerOnEventHandlers.get(e)));break;case"PostFlairUpdate":r.provides(wT),U("OnPostFlairUpdate",ne("PostFlairUpdate",m.triggerOnEventHandlers.get(e)));break;case"CommentSubmit":r.provides(yT),U("OnCommentSubmit",ne("CommentSubmit",m.triggerOnEventHandlers.get(e)));break;case"CommentCreate":r.provides(fT),U("OnCommentCreate",ne("CommentCreate",m.triggerOnEventHandlers.get(e)));break;case"CommentUpdate":r.provides(vT),U("OnCommentUpdate",ne("CommentUpdate",m.triggerOnEventHandlers.get(e)));break;case"CommentReport":r.provides(hT),U("OnCommentReport",ne("CommentReport",m.triggerOnEventHandlers.get(e)));break;case"CommentDelete":r.provides(gT),U("OnCommentDelete",ne("CommentDelete",m.triggerOnEventHandlers.get(e)));break;case"AppInstall":r.provides(mT),U("OnAppInstall",ne("AppInstall",m.triggerOnEventHandlers.get(e)));break;case"AppUpgrade":r.provides(pT),U("OnAppUpgrade",ne("AppUpgrade",m.triggerOnEventHandlers.get(e)));break;case"ModAction":r.provides(bT),U("OnModAction",ne("ModAction",m.triggerOnEventHandlers.get(e)));break;case"ModMail":r.provides(PT),U("OnModMail",ne("ModMail",m.triggerOnEventHandlers.get(e)));break;default:throw new Error(`Unknown trigger event: ${e}`)}}function AT(r){let e=r.reduce((t,i)=>i.status==="rejected"?[...t,i.reason]:t,[]);if(e.length!==0)return e.length===1?{err:e[0]}:{err:new Error(e.map(t=>Gr.caughtToString(t)).join(`
3
- `))}}var Wb=xn(ab(),1),Gb=xn(jb(),1);import{EffectType as IF,UIEventHandlerDefinition as AF}from"@devvit/protos";async function EF(r,e){let t=r.state??{},i=(0,Wb.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.")&&m.customPostType){let P=new lt((w,I)=>m.customPostType?.render(I)??null,r.event,r.state,e,void 0);return await P.reconcile(),{state:P.state,effects:P.getEffects()}}let f=m.formDefinitions.get(p);if(!f)throw new Error(`Form with key ${p} not found`);let g,c;if(i.__contextAction){let{actionId:P,thingId:w}=i.__contextAction,I=Jc(P);I?.location==="post"?g=w:I?.location==="comment"&&(c=w)}let h=Object.assign(n,le(e,g,c));await f.onSubmit({values:Ct(r.event.formSubmitted.results)},h)}else if(r.event?.realtimeEvent){if(m.customPostType){let p=new lt((f,g)=>m.customPostType?.render(g)??null,r.event,r.state,e,void 0);return await p.reconcile(),{state:p.state,effects:p.getEffects()}}}else if(r.event?.toastAction)throw new Error("Toast actions not yet implemented");let o=!(0,Gb.default)(t,i),a=ui(n.ui),u=o?[...a,{type:IF.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:0}}]:a;return{state:i,effects:u}}function zb(r){r.provides(AF),U("HandleUIEvent",EF)}import{CustomPostDefinition as r0}from"@devvit/protos";import{EffectType as BF}from"@devvit/protos";import{EffectType as w_}from"@devvit/protos";var ps=class extends Error{};function Vb(r){let e=fr({namespace:"useState"},({changed:t})=>{let i=r instanceof Function?r():r;if(i instanceof Promise)throw new Error("Cannot use async initializer with useState, use useAsyncState instead.");return{state:i,setter:o=>{e.state=o instanceof Function?o(e.state):o,t()}}});return[e.state,e.setter]}import{EffectType as dm}from"@devvit/protos";var yi=class yi{constructor(e){this.request=e;this._segments=[];this._hooks={};this._prevHookId="";this._effects={};this._changed={};this._rootProps={};this._generated={};this._undeliveredHandlers={};this._state=e.state??{},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}push(e){this._segments.push({...e,next:0})}pop(){this._segments.pop()}addUndeliveredEventHandler(e,t){this._undeliveredHandlers[e]=t}addGlobalUndeliveredEventHandler(e,t){yi.addGlobalUndeliveredEventHandler(e,t)}getHook(e){return this._hooks[e.id]}static addGlobalUndeliveredEventHandler(e,t){yi._staticUndeliveredHandlers[e]=t}async handleUndeliveredEvent(e){let t={...yi._staticUndeliveredHandlers,...this._undeliveredHandlers};for(let[i,n]of Object.entries(t))await n(e,this)}emitEffect(e,t){this._effects[e]=t}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()}}};yi._staticUndeliveredHandlers={};var vi=yi;var Bt={};vi.addGlobalUndeliveredEventHandler("intervals",async(r,e)=>{r.timer&&r.hook&&(delete Bt[r.hook],e.emitEffect("timers",{type:dm.EFFECT_SET_INTERVALS,interval:{intervals:Bt}}))});var Ot,bi,fs,Pi,lm=class{constructor(e,t,i){l(this,Ot,void 0);l(this,bi,void 0);l(this,fs,void 0);l(this,Pi,void 0);this.state={duration:{seconds:0,nanos:0},running:!1};d(this,bi,i.changed),d(this,Ot,i.hookId),d(this,fs,e),d(this,Pi,i.context);let n=Math.floor(t/1e3),o=t%1e3*1e6;this.state.duration={seconds:n,nanos:o}}onLoad(){this.state.running?Bt[s(this,Ot)]={duration:this.state.duration}:delete Bt[s(this,Ot)]}async onUIEvent(e){await s(this,fs).call(this)}start(){Bt[s(this,Ot)]={duration:this.state.duration},this.state.running=!0,s(this,bi).call(this),s(this,Pi).emitEffect("timers",{type:dm.EFFECT_SET_INTERVALS,interval:{intervals:Bt}})}stop(){delete Bt[s(this,Ot)],this.state.running=!1,s(this,bi).call(this),s(this,Pi).emitEffect("timers",{type:dm.EFFECT_SET_INTERVALS,interval:{intervals:Bt}})}};Ot=new WeakMap,bi=new WeakMap,fs=new WeakMap,Pi=new WeakMap;function $b(r,e){return fr({namespace:"useInterval"},t=>new lm(r,e,t))}import{EffectType as cm,Form as FF,ToastAppearance as Xb}from"@devvit/protos";var um=class{constructor(e,t,i){this.state=null;this.hookId=e.hookId,this.form=t,this.onSubmit=i,this.onUIEvent=async n=>{n.formSubmitted&&await i(Ct(n.formSubmitted.results))}}};function Jb(r,e){let t=fr({namespace:"useForm"},i=>new um(i,r,e));return TF({id:t.hookId})}function TF(r){return`form.hook.${r.id}.0`}function RF(r){return{id:r.match(/form\.hook\.(.+)\.0/)[1]}}function Kb(r,e){let t=RF(e);return r.getHook(t)}var Ut,Ud=class{constructor(e){l(this,Ut,void 0);d(this,Ut,e)}showForm(e,t){let i=Kb(s(this,Ut),e);if(!i)throw new Error("Form does not exist. Make sure you have added it using useForm.");let n=i.form instanceof Function?i.form(t??{}):i.form,o=FF.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});ir(n.fields),o.fields=at(n.fields),s(this,Ut).emitEffect(e,{type:cm.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?Xb.SUCCESS:Xb.NEUTRAL}:t={text:e},s(this,Ut).emitEffect(e.toString(),{type:cm.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,Ut).emitEffect(t,{type:cm.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}};Ut=new WeakMap;var Zb=new Proxy({},{get:function(r,e,t){throw new Error(`Unimplemented API: ${String(e)}`)}}),Md=class{buildContext(e,t){let i=new ei(t),n=new Yr(t),o=new ni(t),a=new ri(t),u=new si(t),p=new oi(t),f=new Ud(e),g=new Qr(t),c=new Zr(t,()=>m.assetsPlugin),h=new li(t),I={modLog:i,kvStore:n,redis:o,reddit:a,scheduler:u,settings:p,media:g,assets:c,realtime:h,ui:f,useState:Vb,useChannel:Zb,useInterval:$b,useForm:Jb,cache:Zb},E=le(t);return E.debug.effects=e,{...E,...I}}};var ue=null;function Yb(r){return JSON.parse(JSON.stringify(r))}function fr(r,e){if(!ue)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.");let t=ue.nextHookId(r),i=ue,n={hookId:t,changed:()=>{i._changed[t]=!0,i._state[t]=i?._hooks[t]?.state},context:ue},o=ue._state[t]===void 0;ue._hooks[t]=ue._hooks[t]??e(n);let a=ue._hooks[t];return ue._state[t]!==void 0&&(a.state=ue._state[t]),a.onLoad&&a.onLoad(ue),o&&a.state!==void 0&&a.state!==null&&n.changed(),a}var OF=null,ki,_d,gs,hs,mm,Nd,Qb,ys,pm,qd,e0,vs,fm,bs,gm,Si,Ld,Ps,hm,Hd,t0,Dd=class{constructor(e){l(this,hs);l(this,Nd);l(this,ys);l(this,qd);l(this,vs);l(this,bs);l(this,Si);l(this,Ps);l(this,Hd);l(this,ki,void 0);l(this,_d,new Md);l(this,gs,new pi);this._latestRenderContext=null;d(this,ki,e),OF=this}async handle(e,t){let i=new vi(e),n=s(this,_d).buildContext(i,t);i.devvitContext=n;let o,a=e.events,p=!e.events?.length||a.some(h=>!h.async),f=a.some(h=>h.blocking),g,c=[...a];for(;a.length>0;){let h=[];if(!a[0].async)h.push(a.shift());else for(;a[0]?.async;)h.push(a.shift());if(!h.length)throw Error("batch must have at least one event");try{if(h[0].async){let P=Yb(i._state);await k(this,Nd,Qb).call(this,i,...h),i._state=P}else await k(this,qd,e0).call(this,i,...h)}catch(P){if(g){i._state=g._state,i._effects=g._effects,c.forEach((w,I)=>{let E={type:BF.EFFECT_SEND_EVENT,sendEvent:{event:w}};i.emitEffect(`remaining-${I}`,E)});break}else throw P}for(let[P,w]of Object.entries(i._effects))if(w.sendEvent?.event){if(!p&&!w.sendEvent?.event?.async||p&&w.sendEvent?.event?.async&&!f)break;let I=w.sendEvent.event;a.push(I),delete i._effects[P]}a.length>0&&(g={_state:Yb(i._state),_effects:{...i._effects}},c=[...a])}if(p){let h=k(this,vs,fm).call(this,s(this,ki),i._rootProps??{},i);h&&(o=await s(this,gs).createBlocksElementOrThrow(h),o=await s(this,gs).ensureRootBlock(o))}return{state:i._state,effects:i.effects,blocks:o}}};ki=new WeakMap,_d=new WeakMap,gs=new WeakMap,hs=new WeakSet,mm=function(e,...t){k(this,vs,fm).call(this,s(this,ki),e.request.props??{},e)},Nd=new WeakSet,Qb=async function(e,...t){k(this,hs,mm).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 k(this,ys,pm).call(this,e,i)}))},ys=new WeakSet,pm=async function(e,t){let i=e._hooks[t.hook];if(i&&i.onUIEvent)try{await i.onUIEvent(t,e)}catch(n){throw console.error("Error in event handler",n),n}else await e.handleUndeliveredEvent(t)},qd=new WeakSet,e0=async function(e,...t){for(let i of t)k(this,hs,mm).call(this,e,i),e._state.__generation=Number(e._state.__generation??0)+1,await k(this,ys,pm).call(this,e,i)},vs=new WeakSet,fm=function(e,t,i){i._generated={},ue=i,this._latestRenderContext=i;try{let n=k(this,bs,gm).call(this,e,t,i);if(n.length!==1)throw new Error("only one root");let o=n[0];if(typeof o=="string")throw new Error("There must be a root tag. Try wrapping your app in a <text></text>, <vstack> or other tag.");return o}catch(n){if(n instanceof ps)return;throw n}finally{ue=null}},bs=new WeakSet,gm=function(e,t,i){i.push({namespace:e.name,...t});try{let n=e(t,i.devvitContext);return k(this,Ps,hm).call(this,n,i)}finally{i.pop()}},Si=new WeakSet,Ld=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)),k(this,Ps,hm).call(this,i,t)))},Ps=new WeakSet,hm=function(e,t){if(Array.isArray(e))return k(this,Si,Ld).call(this,e,t);if(UF(e)){if(e.type===void 0)return k(this,Si,Ld).call(this,e.children,t);if(typeof e.type=="function"){let i={...e.props,children:e.children};return k(this,bs,gm).call(this,e.type,i,t)}else{t.push({namespace:e.type,...e.props});let i=k(this,Si,Ld).call(this,e.children,t),n=k(this,Hd,t0).call(this,e.props??{});return t.pop(),[{type:e.type,children:i,props:n}]}}else return[(e??"").toString()]},Hd=new WeakSet,t0=function(e){let t={};for(let i in e)if(typeof e[i]=="function"){let n=fr({namespace:i,key:!1},({hookId:o})=>({hookId:o,state:null,onUIEvent:e[i]}));t[i]=n.hookId,"captureHookRef"in e[i]&&e[i].captureHookRef()}else{let n=e[i];n!=null&&(t[i]=n.toString())}return t};function UF(r){return typeof r=="object"&&r!=null&&"type"in r}var MF=[[r0,r0.methods.renderPostContent,(r,e)=>m.customPostType?.render(e)??null]];function LF(r){return async(e,t)=>new Dd(r).handle(e,t)}function i0(r){for(let[e,t,i]of MF)r.provides(e),U(t.name,LF(i))}var ks,wi,gr,hr,yr,Ci,xi,Mt,vr,M,N,G,_=class _ extends Qa{static configure(e){d(this,ks,e),ut(e.http)&&k(this,N,G).call(this,C.HTTPDefinition),(ut(e.kvStore)||ut(e.redis))&&(k(this,N,G).call(this,C.KVStoreDefinition),k(this,N,G).call(this,C.RedisAPIDefinition)),ut(e.media)&&k(this,N,G).call(this,C.MediaServiceDefinition),ut(e.modLog)&&k(this,N,G).call(this,C.ModlogDefinition),ut(e.redditAPI)&&(k(this,N,G).call(this,C.FlairDefinition),k(this,N,G).call(this,C.GraphQLDefinition),k(this,N,G).call(this,C.LinksAndCommentsDefinition),k(this,N,G).call(this,C.ListingsDefinition),k(this,N,G).call(this,C.ModerationDefinition),k(this,N,G).call(this,C.ModNoteDefinition),k(this,N,G).call(this,C.NewModmailDefinition),k(this,N,G).call(this,C.PrivateMessagesDefinition),k(this,N,G).call(this,C.SubredditsDefinition),k(this,N,G).call(this,C.PostCollectionsDefinition),k(this,N,G).call(this,C.UsersDefinition),k(this,N,G).call(this,C.WidgetsDefinition),k(this,N,G).call(this,C.WikiDefinition),k(this,N,G).call(this,C.RedditAPIV2Definition)),ut(e.realtime)&&k(this,N,G).call(this,C.RealtimeDefinition)}static addMenuItem(e){s(this,wi).push(e)}static addCustomPostType(e){d(this,gr,e)}static createForm(e,t){let i=`form.${s(this,hr).size}`;return s(this,hr).set(i,{form:e,onSubmit:t}),i}static addSchedulerJob(e){if(s(this,M)[C.SchedulerDefinition.fullName]||k(this,N,G).call(this,C.SchedulerDefinition),s(this,yr).has(e.name))throw new Error(`Job ${e.name} is already defined`);s(this,yr).set(e.name,e.onRun)}static addSettings(e){ir(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,Ci,t),i.length>0&&d(this,xi,i),s(this,M)[C.SettingsDefinition.fullName]||k(this,N,G).call(this,C.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,Mt).has(e.event)?s(this,Mt).get(e.event)?.push(e.onEvent):s(this,Mt).set(e.event,[e.onEvent]),_}static get redditAPIPlugins(){if(!ut(s(this,ks).redditAPI))throw new Error("Reddit API is not enabled. You can enable it by passing `redditAPI: true` to `Devvit.configure`.");return{Flair:s(this,M)[C.FlairDefinition.fullName],GraphQL:s(this,M)[C.GraphQLDefinition.fullName],LinksAndComments:s(this,M)[C.LinksAndCommentsDefinition.fullName],Listings:s(this,M)[C.ListingsDefinition.fullName],Moderation:s(this,M)[C.ModerationDefinition.fullName],ModNote:s(this,M)[C.ModNoteDefinition.fullName],NewModmail:s(this,M)[C.NewModmailDefinition.fullName],PrivateMessages:s(this,M)[C.PrivateMessagesDefinition.fullName],Subreddits:s(this,M)[C.SubredditsDefinition.fullName],PostCollections:s(this,M)[C.PostCollectionsDefinition.fullName],Users:s(this,M)[C.UsersDefinition.fullName],Widgets:s(this,M)[C.WidgetsDefinition.fullName],Wiki:s(this,M)[C.WikiDefinition.fullName]}}static get modLogPlugin(){let e=s(this,M)[C.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,M)[C.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,M)[C.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,M)[C.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,M)[C.MediaServiceDefinition.fullName];if(!e)throw new Error("MediaService is not enabled. You can enable it by passing `media: true` to `Devvit.configure`");return e}static get redditapiv2Plugin(){let e=s(this,M)[C.RedditAPIV2Definition.fullName];if(!e)throw new Error("RedditAPIV2 is not enabled. You can enable it by passing `apiV2: true` to `Devvit.configure`");return e}static get assetsPlugin(){let e=s(this,M)[C.AssetResolverDefinition.fullName];if(!e)throw new Error("AssetsService is not available. This should not happen, and indicates a setup problem with the runtime.");return e}static get settingsPlugin(){let e=s(this,M)[C.SettingsDefinition.fullName];if(!e)throw new Error("Settings is not enabled. You can enable it by passing `settings: true` to `Devvit.configure`");return e}static get realtimePlugin(){let e=s(this,M)[C.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,wi)}static get customPostType(){return s(this,gr)}static get formDefinitions(){return s(this,hr)}static get scheduledJobHandlers(){return s(this,yr)}static get installationSettings(){return s(this,Ci)}static get appSettings(){return s(this,xi)}static get triggerOnEventHandlers(){return s(this,Mt)}constructor(e){var t;super(e),k(t=_,N,G).call(t,C.AssetResolverDefinition);for(let i in s(_,vr)){let n=s(_,vr)[i];n.handler=e.use(n.def,n.options)}s(_,wi).length>0&&$v(e),s(_,yr).size>0&&Jv(e),s(_,gr)&&(Gv(e),i0(e)),(s(_,gr)||s(_,hr).size>0)&&zb(e),s(_,Ci)&&zv(e),s(_,xi)&&Sv(e),s(_,Mt).size>0&&Kv(e)}};ks=new WeakMap,wi=new WeakMap,gr=new WeakMap,hr=new WeakMap,yr=new WeakMap,Ci=new WeakMap,xi=new WeakMap,Mt=new WeakMap,vr=new WeakMap,M=new WeakMap,N=new WeakSet,G=function(e,t){s(this,vr)[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,vr)[e.fullName].handler?.[n.name]?.(n.requestType?.fromPartial(o??{}),a);return s(this,M)[e.fullName]=i,i},l(_,N),_.debug={emitSnapshots:!1,emitState:!1},l(_,ks,{}),l(_,wi,[]),l(_,gr,void 0),l(_,hr,new Map),l(_,yr,new Map),l(_,Ci,void 0),l(_,xi,void 0),l(_,Mt,new Map),l(_,vr,{}),l(_,M,{});var m=_;(e=>{function r(t,i,...n){return{type:t,props:i,children:n}}e.createElement=r})(m||(m={}));function $(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 n0="text",s0="raw",o0="br",a0="link",d0="c/",l0="p/",u0="r/",c0="u/",m0="@",p0="spoilertext",f0="par",g0="h",h0="hr",y0="blockquote",v0="code",b0="li",P0="list",k0="L",S0="R",w0="C",C0="table",x0="embed",I0="img",A0="gif",E0="video";function T0(r){return{e:A0,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function R0(r,e){let t={},i=[];return Object.assign(t,Ss(t,i),ws(t,i),Cs(t,i),As(t,i),Es(t,i),Ts(t,i)),e(t),{e:y0,c:i,...r.author&&{a:r.author}}}function F0(r,e){let t={},i=[];return Object.assign(t,bm(t,i)),e(t),{e:v0,c:i,...r.language&&{l:r.language}}}function B0(r){return{e:d0,t:r.permalink}}function O0(r,e){let t={},i=[];return Object.assign(t,bm(t,i),Is(t,i)),e(t),{e:g0,l:r.level,c:i}}function U0(r){return{e:x0,u:r.sourceUrl,c:r.contentUrl,x:r.width,y:r.height}}function M0(){return{e:h0}}function L0(r){return{e:I0,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function D0(){return{e:o0}}function _0(r){return{e:a0,t:r.text,u:r.url,...r.formatting&&{f:r.formatting},...r.tooltip&&{a:r.tooltip}}}function N0(r,e){let t={},i=[];return Object.assign(t,tP(t,i)),e(t),{e:P0,o:r.ordered,c:i}}function q0(r){let e={},t=[];return Object.assign(e,Ss(e,t),ws(e,t),Cs(e,t),jd(e,t),As(e,t),Es(e,t),Ts(e,t)),r(e),{e:b0,c:t}}function H0(r){let e={},t=[];return Object.assign(e,Wd(e,t),Is(e,t),vm(e,t),Pm(e,t),xs(e,t)),r(e),{e:f0,c:t}}function j0(r){return{e:l0,t:r.permalink}}function W0(r){return{e:s0,t:r}}function G0(r){let e={},t=[];return Object.assign(e,Wd(e,t),Is(e,t),vm(e,t)),r(e),{e:p0,c:t}}function z0(r){return{e:u0,t:r.subredditName,l:r.showPrefix}}function V0(r){let e={},t=[],i=[];return Object.assign(e,rP(e,t,i)),r(e),{e:C0,h:t,c:i}}function $0(r){let[e,t]=eP();return r(e),{c:t}}function J0(r,e){let[t,i]=eP();e(t);let n;switch(r.columnAlignment){case"left":n=k0;break;case"right":n=S0;break;case"center":n=w0;break}return{...n&&{a:n},...i&&{c:i}}}function K0(r){let e={},t=[];return Object.assign(e,iP(e,t)),r(e),t}function X0(r){return{e:n0,t:r.text,...r.formatting&&{f:r.formatting}}}function Z0(r){return{e:c0,t:r.username,l:r.showPrefix}}function Y0(r){return{e:m0,t:r.username,l:r.showPrefix}}function Q0(r){return{e:E0,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur},...r.thumbnail&&{p:r.thumbnail},...r.convertToGif&&{gifify:r.convertToGif}}}function eP(){let r={},e=[];return Object.assign(r,Wd(r,e),Is(r,e),Pm(r,e),xs(r,e)),[r,e]}function Ss(r,e){return{blockQuote(t,i){return e.push(R0(t,i)),r}}}function ws(r,e){return{codeBlock(t,i){return e.push(F0(t,i)),r}}}function nP(r,e){return{embed(t){return e.push(U0(t)),r}}}function Cs(r,e){return{heading(t,i){return e.push(O0(t,i)),r}}}function jd(r,e){return{horizontalRule(){return e.push(M0()),r}}}function xs(r,e){return{image(t){return e.push(L0(t)),r},animatedImage(t){return e.push(T0(t)),r}}}function vm(r,e){return{linebreak(){return e.push(D0()),r}}}function Is(r,e){return{link(t){return e.push(_0(t)),r},commentLink(t){return e.push(B0(t)),r},postLink(t){return e.push(j0(t)),r},subredditLink(t){return e.push(z0(t)),r},userLink(t){return e.push(Z0(t)),r},userMention(t){return e.push(Y0(t)),r}}}function As(r,e){return{list(t,i){return e.push(N0(t,i)),r}}}function tP(r,e){return{item(t){return e.push(q0(t)),r}}}function Es(r,e){return{paragraph(t){return e.push(H0(t)),r}}}function bm(r,e){return{rawText(t){return e.push(W0(t)),r}}}function Pm(r,e){return{spoiler(t){return e.push(G0(t)),r}}}function rP(r,e,t){return{headerCell(i,n){return e.push(J0(i,n)),r},row(i){return t.push(K0(i)),r}}}function Ts(r,e){return{table(t){return e.push(V0(t)),r}}}function iP(r,e){return{cell(t){return e.push($0(t)),r}}}function Wd(r,e){return{text(t){return e.push(X0(t)),r}}}function sP(r,e){return{video(t){return e.push(Q0(t)),r}}}var DF=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},_F=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,Rs=class{constructor(){Gd.set(this,void 0);let e=[];Object.assign(this,Es(this,e),Cs(this,e),jd(this,e),Ss(this,e),ws(this,e),nP(this,e),As(this,e),Ts(this,e),xs(this,e),sP(this,e)),DF(this,Gd,{document:e},"f")}build(){return JSON.stringify(_F(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 Ii(r){let e;return r instanceof Rs?e=r.build():typeof r=="object"?e=JSON.stringify(r):e=r,e}var oP=100,aP=1/0,br,Pr,Lt,Ai,Ei,zd,j=class{constructor(e){l(this,Ei);l(this,br,void 0);l(this,Pr,void 0);l(this,Lt,void 0);l(this,Ai,!1);this.pageSize=oP;this.limit=aP;this.children=[];$(this),this._fetch=e.fetch,this.pageSize=e.pageSize??oP,this.limit=e.limit??aP,d(this,Pr,e.after),d(this,br,e.before),d(this,Lt,e.more),e.children&&(this.children=e.children)}get hasMore(){return!s(this,Ai)||!!(s(this,Pr)||s(this,br)||s(this,Lt))}async*[Symbol.asyncIterator](){let e=0;for(;;){if(e===this.children.length)if(this.hasMore){if((await k(this,Ei,zd).call(this)).length===0)break}else break;if(yield this.children[e],e++,e===this.limit)break}}setMore(e){d(this,Lt,e)}preventInitialFetch(){d(this,Ai,!0)}async all(){for(;this.hasMore&&this.children.length<this.limit;)await k(this,Ei,zd).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 k(this,Ei,zd).call(this);return this.children.slice(0,t)}};br=new WeakMap,Pr=new WeakMap,Lt=new WeakMap,Ai=new WeakMap,Ei=new WeakSet,zd=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,Pr),limit:this.pageSize,more:s(this,Lt)});return this.children.push(...e),d(this,br,t),d(this,Pr,i),d(this,Lt,n),d(this,Ai,!0),e};function NF(r){try{return!0}catch{return!1}}function qF(r){try{return!0}catch{return!1}}var Fs,km,Oe=class{constructor(){}static get(e,t){let i=m.redditAPIPlugins.ModNote;return new j({hasMore:!0,before:e.before,limit:e.limit,pageSize:e.limit,fetch:async n=>{let o=await i.GetNotes({subreddit:e.subreddit,user:e.user,filter:e.filter,before:n.before,limit:n.limit},t);return{children:o.modNotes?.map(a=>k(this,Fs,km).call(this,a))||[],before:o.hasNextPage?o.endCursor:void 0,hasMore:o.hasNextPage}}})}static async delete(e,t){let i=m.redditAPIPlugins.ModNote,{deleted:n}=await i.DeleteNotes(e,t);return!!n}static async add(e,t){let n=await m.redditAPIPlugins.ModNote.PostNotes(e,t);if(!n?.created)throw new Error("Failed to create mod note");return k(this,Fs,km).call(this,n.created)}static async addRemovalNote(e,t){await m.redditAPIPlugins.ModNote.PostRemovalNote(e,t)}};Fs=new WeakSet,km=function(e){if(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"),!NF(e.userNoteData?.label??""))throw new Error(`Invalid user note label: ${e.userNoteData?.label}`);if(!qF(e.type))throw new Error(`Invalid mod note type: ${e.type}`);return{id:e.id,user:{id:ge(e.userId??""),name:e.user},subreddit:{id:Re(e.subredditId??""),name:e.subreddit},operator:{id:ge(e.operatorId??""),name:e.operator},createdAt:new Date(e.createdAt*1e3),userNote:{note:e.userNoteData?.note,redditId:Fe(e.userNoteData?.redditId??""),label:e.userNoteData?.label},type:e.type}},l(Oe,Fs);var Vd=class{static queryWithQueryString(e,t){return m.redditAPIPlugins.GraphQL.Query({query:e},t)}static query(e,t,i,n){return m.redditAPIPlugins.GraphQL.PersistedQuery({operationName:e,id:t,variables:i},n)}};var dP=["all","wiki","posts","access","mail","config","flair","chat_operator","chat_config"];function HF(r,e,t=!1){let i=t?"%2b":"+";return e.map(n=>(r.includes(n)?i:"-")+n).join(",")}function Sm(r){return HF(r,dP,!0)}function lP(r){if(dP.includes(r))return r;throw new Error(`Invalid moderator permission: ${r}`)}var jF=(t=>(t.User="USER_FLAIR",t.Post="LINK_FLAIR",t))(jF||{}),kr,Ti,Ri,Fi,Bi,Oi,Ui,Mi,Li,Di,_i,$d,$e=class $e{constructor(e,t,i){l(this,kr,void 0);l(this,Ti,void 0);l(this,Ri,void 0);l(this,Fi,void 0);l(this,Bi,void 0);l(this,Oi,void 0);l(this,Ui,void 0);l(this,Mi,void 0);l(this,Li,void 0);l(this,Di,void 0);$(this),v(e.id),v(e.text),d(this,kr,e.id),d(this,Ti,t),d(this,Ri,e.text),d(this,Fi,WF(e.textColor)),d(this,Bi,GF(e.backgroundColor)),d(this,Oi,zF(e.allowableContent)),d(this,Ui,e.modOnly),d(this,Mi,e.maxEmojis),d(this,Li,e.textEditable),d(this,Di,i)}get id(){return s(this,kr)}get text(){return s(this,Ri)}get textColor(){return s(this,Fi)}get backgroundColor(){return s(this,Bi)}get allowableContent(){return s(this,Oi)}get modOnly(){return s(this,Ui)}get maxEmojis(){return s(this,Mi)}get allowUserEdits(){return s(this,Li)}async delete(){return $e.deleteFlairTemplate(s(this,kr),s(this,Ti),s(this,Di))}async edit(e){return $e.editFlairTemplate({id:s(this,kr),subredditName:s(this,Ti),text:e.text??s(this,Ri),allowableContent:e.allowableContent??s(this,Oi),backgroundColor:e.backgroundColor??s(this,Bi),maxEmojis:e.maxEmojis??s(this,Mi),modOnly:e.modOnly??s(this,Ui),textColor:e.textColor??s(this,Fi),allowUserEdits:e.allowUserEdits??s(this,Li)},s(this,Di))}static async createPostFlairTemplate(e,t){var i;return k(i=$e,_i,$d).call(i,{...e,flairType:"LINK_FLAIR"},t)}static async createUserFlairTemplate(e,t){var i;return k(i=$e,_i,$d).call(i,{...e,flairType:"USER_FLAIR"},t)}static async editFlairTemplate(e,t){var i;return k(i=$e,_i,$d).call(i,e,t)}static async getPostFlairTemplates(e,t){return(await m.redditAPIPlugins.Flair.LinkFlair({subreddit:e},t)).flair?.map(o=>new $e(o,e,t))||[]}static async getUserFlairTemplates(e,t){return(await m.redditAPIPlugins.Flair.UserFlair({subreddit:e},t)).flair?.map(o=>new $e(o,e,t))||[]}static async deleteFlairTemplate(e,t,i){await m.redditAPIPlugins.Flair.DeleteFlairTemplate({subreddit:e,flairTemplateId:t},i)}};kr=new WeakMap,Ti=new WeakMap,Ri=new WeakMap,Fi=new WeakMap,Bi=new WeakMap,Oi=new WeakMap,Ui=new WeakMap,Mi=new WeakMap,Li=new WeakMap,Di=new WeakMap,_i=new WeakSet,$d=async function(e,t){let{subredditName:i,allowableContent:n="all",backgroundColor:o="transparent",flairType:a="",maxEmojis:u=10,modOnly:p=!1,text:f,textColor:g="dark",allowUserEdits:c=!1,id:h=""}=e;if(p&&c)throw new Error("Cannot have a mod only flair that is editable by users");let w=await m.redditAPIPlugins.Flair.FlairTemplate({subreddit:i,allowableContent:n,backgroundColor:o,flairType:a,maxEmojis:u,modOnly:p,text:f,textColor:g,textEditable:c,flairTemplateId:h,cssClass:"",overrideCss:!1},t);return new $e(w,i,t)},l($e,_i);var de=$e;function Us(r){return{flairCssClass:r.flairCssClass,user:r.user,flairText:r.flairText}}var Bs,wm,Os,Cm,Dt=class Dt{static async getUserFlairBySubreddit(e,t){return m.redditAPIPlugins.Flair.FlairList(e,t)}static setUserFlair(e,t){var i;return k(i=Dt,Bs,wm).call(i,e,t)}static setPostFlair(e,t){var i;return k(i=Dt,Bs,wm).call(i,{...e,postId:he(e.postId)},t)}static async removePostFlair(e,t,i){var n;return k(n=Dt,Os,Cm).call(n,e,t,void 0,i)}static async removeUserFlair(e,t,i){var n;return k(n=Dt,Os,Cm).call(n,e,void 0,t,i)}};Bs=new WeakSet,wm=async function(e,t){await m.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)},Os=new WeakSet,Cm=async function(e,t,i,n){await m.redditAPIPlugins.Flair.SelectFlair({subreddit:e,name:i??"",link:t??"",flairTemplateId:"",backgroundColor:"",text:"",textColor:"",cssClass:"",returnRtjson:"none"},n)},l(Dt,Bs),l(Dt,Os);var Ue=Dt;function WF(r){if(v(r,"Flair text color is required"),r==="light"||r==="dark")return r;throw new Error(`Invalid flair text color: ${r}`)}function GF(r){if(v(r,"Flair background color is required"),r==="transparent"||/^#([A-Fa-f0-9]{6})$/.test(r))return r;throw new Error(`Invalid flair background color: ${r}`)}function zF(r){if(r==="all"||r==="text"||r==="emoji")return r;throw new Error(`Invalid allowable content: ${r}`)}import{Block as VF}from"@devvit/protos";var uP=xn(hc(),1);var Ni,Ls,qi,Ds,_s,Ns,qs,Hs,Hi,js,Ws,Gs,zs,Vs,$s,_t,Sr,ji,Nt,Wi,Gi,zi,wr,qt,Ht,Vi,jt,Wt,Gt,pt,Js,Ks,$i,Ji,L,q=class q{constructor(e,t){l(this,Ni,void 0);l(this,Ls,void 0);l(this,qi,void 0);l(this,Ds,void 0);l(this,_s,void 0);l(this,Ns,void 0);l(this,qs,void 0);l(this,Hs,void 0);l(this,Hi,void 0);l(this,js,void 0);l(this,Ws,void 0);l(this,Gs,void 0);l(this,zs,void 0);l(this,Vs,void 0);l(this,$s,void 0);l(this,_t,void 0);l(this,Sr,void 0);l(this,ji,void 0);l(this,Nt,void 0);l(this,Wi,void 0);l(this,Gi,void 0);l(this,zi,void 0);l(this,wr,void 0);l(this,qt,void 0);l(this,Ht,void 0);l(this,Vi,void 0);l(this,jt,void 0);l(this,Wt,void 0);l(this,Gt,void 0);l(this,pt,void 0);l(this,Js,void 0);l(this,Ks,void 0);l(this,$i,void 0);l(this,Ji,void 0);l(this,L,void 0);$(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,Ni,he(`t3_${e.id}`)),d(this,qi,e.author),d(this,Ls,e.authorFullname?ge(e.authorFullname):void 0),d(this,_s,Re(e.subredditId)),d(this,Ns,e.subreddit),d(this,Gs,e.score??0),d(this,zs,e.numComments??0),d(this,Vs,e.numReports??0);let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Ds,i),d(this,Hs,e.title),d(this,Hi,e.selftext),d(this,js,e.selftextHtml),d(this,Ws,e.url),d(this,qs,e.permalink),e.thumbnail&&e.thumbnail!=="self"&&e.thumbnail!=="nsfw"&&e.thumbnailHeight!=null&&e.thumbnailWidth!=null&&d(this,$s,{url:e.thumbnail,height:e.thumbnailHeight,width:e.thumbnailWidth}),d(this,_t,e.approved??!1),d(this,Nt,e.removed??!1),d(this,Wi,e.removedBy),d(this,Gi,e.removedByCategory),d(this,Sr,e.spam??!1),d(this,ji,e.stickied??!1),d(this,zi,e.archived??!1),d(this,wr,e.edited??!1),d(this,qt,e.locked??!1),d(this,Ht,e.over18??!1),d(this,Vi,e.quarantine??!1),d(this,jt,e.spoiler),d(this,Wt,e.hidden??!1),d(this,Gt,e.ignoreReports??!1),d(this,pt,e.distinguished),d(this,Ks,e.secureMedia),d(this,$i,(e.modReports??[]).map(([n])=>n)),d(this,Ji,(e.userReports??[]).map(([n])=>n)),d(this,L,t),(e.linkFlairBackgroundColor||e.linkFlairCssClass||e.linkFlairText||e.linkFlairType||e.linkFlairTemplateId||e.linkFlairRichtext||e.linkFlairTextColor)&&d(this,Js,{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})=>({elementType:n,text:o,emojiRef:a,url:u})),textColor:e.linkFlairTextColor})}get id(){return s(this,Ni)}get authorId(){return s(this,Ls)}get authorName(){return s(this,qi)}get subredditId(){return s(this,_s)}get subredditName(){return s(this,Ns)}get permalink(){return s(this,qs)}get title(){return s(this,Hs)}get body(){return s(this,Hi)}get bodyHtml(){return s(this,js)}get url(){return s(this,Ws)}get thumbnail(){return s(this,$s)}get createdAt(){return s(this,Ds)}get score(){return s(this,Gs)}get numberOfComments(){return s(this,zs)}get numberOfReports(){return s(this,Vs)}get approved(){return s(this,_t)}get spam(){return s(this,Sr)}get stickied(){return s(this,ji)}get removed(){return s(this,Nt)}get removedBy(){return s(this,Wi)}get removedByCategory(){return s(this,Gi)}get archived(){return s(this,zi)}get edited(){return s(this,wr)}get locked(){return s(this,qt)}get nsfw(){return s(this,Ht)}get quarantined(){return s(this,Vi)}get spoiler(){return s(this,jt)}get hidden(){return s(this,Wt)}get ignoringReports(){return s(this,Gt)}get distinguishedBy(){return s(this,pt)}get comments(){return Z.getComments({postId:this.id},s(this,L))}get flair(){return s(this,Js)}get secureMedia(){return s(this,Ks)}get userReportReasons(){return s(this,Ji)}get modReportReasons(){return s(this,$i)}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,Wi),removedByCategory:s(this,Gi),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,$i),userReportReasons:s(this,Ji)}}isApproved(){return s(this,_t)}isSpam(){return s(this,Sr)}isStickied(){return s(this,ji)}isRemoved(){return s(this,Nt)}isArchived(){return s(this,zi)}isEdited(){return s(this,wr)}isLocked(){return s(this,qt)}isNsfw(){return s(this,Ht)}isQuarantined(){return s(this,Vi)}isSpoiler(){return s(this,jt)}isHidden(){return s(this,Wt)}isIgnoringReports(){return s(this,Gt)}isDistinguishedBy(){return s(this,pt)}async edit(e){let t=await q.edit({id:this.id,...e},s(this,L));d(this,Hi,t.body),d(this,wr,t.edited)}async addComment(e){return Z.submit({id:this.id,...e},s(this,L))}async delete(){return q.delete(this.id,s(this,L))}async approve(){await q.approve(this.id,s(this,L)),d(this,_t,!0),d(this,Nt,!1)}async remove(e=!1){await q.remove(this.id,e,s(this,L)),d(this,Nt,!0),d(this,Sr,e),d(this,_t,!1)}async lock(){await q.lock(this.id,s(this,L)),d(this,qt,!0)}async unlock(){await q.unlock(this.id,s(this,L)),d(this,qt,!1)}async hide(){await q.hide(this.id,s(this,L)),d(this,Wt,!0)}async unhide(){await q.unhide(this.id,s(this,L)),d(this,Wt,!1)}async markAsNsfw(){await q.markAsNsfw(this.id,s(this,L)),d(this,Ht,!0)}async unmarkAsNsfw(){await q.unmarkAsNsfw(this.id,s(this,L)),d(this,Ht,!1)}async markAsSpoiler(){await q.markAsSpoiler(this.id,s(this,L)),d(this,jt,!0)}async unmarkAsSpoiler(){await q.unmarkAsSpoiler(this.id,s(this,L)),d(this,jt,!1)}async sticky(e){await q.sticky(this.id,e,s(this,L))}async unsticky(){await q.unsticky(this.id,s(this,L))}async distinguish(){let{distinguishedBy:e}=await q.distinguish(this.id,!1,s(this,L));d(this,pt,e)}async distinguishAsAdmin(){let{distinguishedBy:e}=await q.distinguish(this.id,!0,s(this,L));d(this,pt,e)}async undistinguish(){let{distinguishedBy:e}=await q.undistinguish(this.id,s(this,L));d(this,pt,e)}async ignoreReports(){await q.ignoreReports(this.id,s(this,L)),d(this,Gt,!0)}async unignoreReports(){await q.unignoreReports(this.id,s(this,L)),d(this,Gt,!1)}async getAuthor(){return x.getByUsername(s(this,qi),s(this,L))}async crosspost(e){return q.crosspost({...e,postId:this.id},s(this,L))}addRemovalNote(e){return Oe.addRemovalNote({itemIds:[s(this,Ni)],...e},s(this,L))}static async getById(e,t){let i=m.redditAPIPlugins.LinksAndComments,n=rr(e)?e:`t3_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.length)throw new Error("could not find post");let a=o.data.children[0];if(!a?.data)throw new Error("could not find post");return new q(a.data,t)}static async submit(e,t){let i=m.redditAPIPlugins.LinksAndComments,n;if("preview"in e){v(t,"Missing metadata in `SubmitPostOptions`");let u=await new lt(()=>e.preview,void 0,{},t,void 0).buildBlocksUI(),p=VF.encode(u).finish();n=await i.Submit({kind:"custom",sr:e.subredditName,richtextJson:(0,uP.fromByteArray)(p),...e},t)}else n=await i.Submit({kind:"kind"in e?e.kind:"url"in e?"link":"self",sr:e.subredditName,richtextJson:"richtext"in e?Ii(e.richtext):void 0,...e},t);if("kind"in e&&["image","video","videogif"].includes(e.kind)&&!n.json?.data?.id&&"url"in e)throw new Error(`Post of ${e.kind} type with ${e.url} is being created asynchronously and should be updated in the subreddit soon.`);if(!n.json?.data?.id||n.json?.errors?.length)throw new Error(`failed to submit post - either post ID is empty or request failed with errors: ${n.json?.errors}`);return q.getById(`t3_${n.json.data.id}`,t)}static async crosspost(e,t){let i=m.redditAPIPlugins.LinksAndComments,{postId:n,subredditName:o,...a}=e,u=await i.Submit({kind:"crosspost",sr:o,crosspostFullname:he(n),...a},t);if(!u.json?.data?.id||u.json?.errors?.length)throw new Error("failed to crosspost post");return q.getById(`t3_${u.json.data.id}`,t)}static async edit(e,t){let i=m.redditAPIPlugins.LinksAndComments,{id:n}=e,o;if("richtext"in e&&(o=Ii(e.richtext)),(await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t)).json?.errors?.length)throw new Error("Failed to edit post");return q.getById(n,t)}static async delete(e,t){await m.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await m.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await m.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async hide(e,t){await m.redditAPIPlugins.LinksAndComments.Hide({id:e},t)}static async unhide(e,t){await m.redditAPIPlugins.LinksAndComments.Unhide({id:e},t)}static async markAsNsfw(e,t){await m.redditAPIPlugins.LinksAndComments.MarkNSFW({id:e},t)}static async unmarkAsNsfw(e,t){await m.redditAPIPlugins.LinksAndComments.UnmarkNSFW({id:e},t)}static async markAsSpoiler(e,t){await m.redditAPIPlugins.LinksAndComments.Spoiler({id:e},t)}static async unmarkAsSpoiler(e,t){await m.redditAPIPlugins.LinksAndComments.Unspoiler({id:e},t)}static async sticky(e,t,i){await m.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!0,num:t},i)}static async unsticky(e,t){await m.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!1},t)}static async lock(e,t){await m.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await m.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async distinguish(e,t,i){let a=(await m.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 m.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 m.redditAPIPlugins.Moderation.IgnoreReports({id:e},t)}static async unignoreReports(e,t){await m.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=m.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Sort({show:"all",sort:e.sort,t:e.timeframe,subreddit:e.subredditName,...n},t);return Ms(o,t)}})}static getHotPosts(e={location:"GLOBAL"},t){let i=m.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Hot({g:e.location,show:"all",subreddit:e.subredditName,...n},t);return Ms(o,t)}})}static getNewPosts(e,t){let i=m.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.New({show:"all",subreddit:e.subredditName,...n},t);return Ms(o,t)}})}static getRisingPosts(e,t){let i=m.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Rising({show:"all",subreddit:e.subredditName,...n},t);return Ms(o,t)}})}static getPostsByUser(e,t){let i=m.redditAPIPlugins.Users;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"submitted",...n},t);return Ms(o,t)}})}};Ni=new WeakMap,Ls=new WeakMap,qi=new WeakMap,Ds=new WeakMap,_s=new WeakMap,Ns=new WeakMap,qs=new WeakMap,Hs=new WeakMap,Hi=new WeakMap,js=new WeakMap,Ws=new WeakMap,Gs=new WeakMap,zs=new WeakMap,Vs=new WeakMap,$s=new WeakMap,_t=new WeakMap,Sr=new WeakMap,ji=new WeakMap,Nt=new WeakMap,Wi=new WeakMap,Gi=new WeakMap,zi=new WeakMap,wr=new WeakMap,qt=new WeakMap,Ht=new WeakMap,Vi=new WeakMap,jt=new WeakMap,Wt=new WeakMap,Gt=new WeakMap,pt=new WeakMap,Js=new WeakMap,Ks=new WeakMap,$i=new WeakMap,Ji=new WeakMap,L=new WeakMap;var V=q;function Ms(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>new V(i.data,e)),before:r.data.before,after:r.data.after}}var Xs,Ki,Zs,Ys,Qs,eo,to,zt,ro,io,ft,Cr=class Cr{constructor(e,t){l(this,Xs,void 0);l(this,Ki,void 0);l(this,Zs,void 0);l(this,Ys,void 0);l(this,Qs,void 0);l(this,eo,void 0);l(this,to,void 0);l(this,zt,new Map);l(this,ro,void 0);l(this,io,void 0);l(this,ft,void 0);$(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,Xs,ge(Ya(e.id)?e.id:`t2_${e.id}`)),d(this,Ki,e.name),d(this,eo,e.over18??!1),d(this,to,e.isEmployee??!1);let i=new Date(0);if(i.setUTCSeconds(e.createdUtc),d(this,Zs,i),d(this,Ys,e.linkKarma??0),d(this,Qs,e.commentKarma??0),e.modPermissions)for(let[n,o]of Object.entries(e.modPermissions))s(this,zt).set(n,o.map(lP));d(this,ro,new URL(e.subreddit?.url??"","https://www.reddit.com").toString()),d(this,io,e.subreddit?.url??""),d(this,ft,t)}get id(){return s(this,Xs)}get username(){return s(this,Ki)}get createdAt(){return s(this,Zs)}get linkKarma(){return s(this,Ys)}get commentKarma(){return s(this,Qs)}get nsfw(){return s(this,eo)}get isAdmin(){return s(this,to)}get modPermissions(){return s(this,zt)}get url(){return s(this,ro)}get permalink(){return s(this,io)}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,zt).has(e))return s(this,zt).get(e);let t=await Cr.getSubredditUsersByType({subredditName:e,type:"moderators",username:this.username},s(this,ft)).all();if(t.length===0)return[];let i=t[0].modPermissions.get(e)??[];return i.length>0&&s(this,zt).set(e,i),i}getComments(e){return Z.getCommentsByUser({username:this.username,...e},s(this,ft))}getPosts(e){return V.getPostsByUser({username:this.username,...e},s(this,ft))}async getUserFlairBySubreddit(e){let t=await Ue.getUserFlairBySubreddit({subreddit:e,name:s(this,Ki)},s(this,ft));return t.users[0]?Us(t.users[0]):void 0}getSnoovatarUrl(){return Cr.getSnoovatarUrl(this.username,s(this,ft))}static async getById(e,t){let o=(await m.redditAPIPlugins.Users.UserDataByAccountIds({ids:e},t))?.users?.[e]?.name;return v(o,"Expected the username in response to be not null"),Cr.getByUsername(o,t)}static async getByUsername(e,t){let n=await m.redditAPIPlugins.Users.UserAbout({username:e},t);if(!n.data?.id)throw new Error("failed to get user");return new Cr(n.data,t)}static async getFromMetadata(e,t){v(t);let i=ye(e,t);return v(i),Cr.getById(ge(i),t)}static getSubredditUsersByType(e,t){let i=m.redditAPIPlugins.Subreddits;return new j({hasMore:!0,pageSize:e.pageSize,limit:e.limit,after:e.after,before:e.before,fetch:async n=>{let o=await i.AboutWhere({where:e.type,user:e.username,subreddit:e.subredditName,show:"all",...n},t);return JF(o,e.subredditName,t)}})}static async createRelationship(e,t){let i=m.redditAPIPlugins.Users,{type:n,subredditName:o,username:a,permissions:u,...p}=e,f=await i.Friend({type:n,subreddit:o,name:a,permissions:u?Sm(u):void 0,...p},t);if(f.json?.errors?.length)throw new Error(f.json.errors.join(`
1
+ var gP=Object.create;var Tm=Object.defineProperty;var hP=Object.getOwnPropertyDescriptor;var yP=Object.getOwnPropertyNames;var vP=Object.getPrototypeOf,bP=Object.prototype.hasOwnProperty;var b=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var PP=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of yP(e))!bP.call(r,n)&&n!==t&&Tm(r,n,{get:()=>e[n],enumerable:!(i=hP(e,n))||i.enumerable});return r};var Cn=(r,e,t)=>(t=r!=null?gP(vP(r)):{},PP(e||!r||!r.__esModule?Tm(t,"default",{value:r,enumerable:!0}):t,r));var fl=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var s=(r,e,t)=>(fl(r,e,"read from private field"),t?t.call(r):e.get(r)),l=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},d=(r,e,t,i)=>(fl(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t);var k=(r,e,t)=>(fl(r,e,"access private method"),t);var oe=b((fB,Rm)=>{Rm.exports=function(r){try{return!!r()}catch{return!0}}});var la=b((gB,Fm)=>{var kP=oe();Fm.exports=!kP(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var J=b((hB,Um)=>{var Bm=la(),Om=Function.prototype,gl=Om.call,SP=Bm&&Om.bind.bind(gl,gl);Um.exports=Bm?SP:function(r){return function(){return gl.apply(r,arguments)}}});var Lm=b((yB,Mm)=>{var wP=Math.ceil,IP=Math.floor;Mm.exports=Math.trunc||function(e){var t=+e;return(t>0?IP:wP)(t)}});var ua=b((vB,Dm)=>{var xP=Lm();Dm.exports=function(r){var e=+r;return e!==e||e===0?0:xP(e)}});var me=b((bB,_m)=>{var ca=function(r){return r&&r.Math==Math&&r};_m.exports=ca(typeof globalThis=="object"&&globalThis)||ca(typeof window=="object"&&window)||ca(typeof self=="object"&&self)||ca(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var Tr=b((PB,Nm)=>{Nm.exports=!1});var ma=b((kB,Hm)=>{var qm=me(),CP=Object.defineProperty;Hm.exports=function(r,e){try{CP(qm,r,{value:e,configurable:!0,writable:!0})}catch{qm[r]=e}return e}});var pa=b((SB,Wm)=>{var AP=me(),EP=ma(),jm="__core-js_shared__",TP=AP[jm]||EP(jm,{});Wm.exports=TP});var hl=b((wB,zm)=>{var RP=Tr(),Gm=pa();(zm.exports=function(r,e){return Gm[r]||(Gm[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:RP?"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=b((IB,Vm)=>{Vm.exports=function(r){return r==null}});var ga=b((xB,$m)=>{var FP=fa(),BP=TypeError;$m.exports=function(r){if(FP(r))throw BP("Can't call method on "+r);return r}});var An=b((CB,Jm)=>{var OP=ga(),UP=Object;Jm.exports=function(r){return UP(OP(r))}});var we=b((AB,Km)=>{var MP=J(),LP=An(),DP=MP({}.hasOwnProperty);Km.exports=Object.hasOwn||function(e,t){return DP(LP(e),t)}});var yl=b((EB,Xm)=>{var _P=J(),NP=0,qP=Math.random(),HP=_P(1 .toString);Xm.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+HP(++NP+qP,36)}});var Ym=b((TB,Zm)=>{Zm.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var sp=b((RB,np)=>{var ip=me(),vl=Ym(),Qm=ip.process,ep=ip.Deno,tp=Qm&&Qm.versions||ep&&ep.version,rp=tp&&tp.v8,He,ha;rp&&(He=rp.split("."),ha=He[0]>0&&He[0]<4?1:+(He[0]+He[1]));!ha&&vl&&(He=vl.match(/Edge\/(\d+)/),(!He||He[1]>=74)&&(He=vl.match(/Chrome\/(\d+)/),He&&(ha=+He[1])));np.exports=ha});var bl=b((FB,ap)=>{var op=sp(),jP=oe();ap.exports=!!Object.getOwnPropertySymbols&&!jP(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&op&&op<41})});var Pl=b((BB,dp)=>{var WP=bl();dp.exports=WP&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ie=b((OB,up)=>{var GP=me(),zP=hl(),lp=we(),VP=yl(),$P=bl(),JP=Pl(),Rr=GP.Symbol,kl=zP("wks"),KP=JP?Rr.for||Rr:Rr&&Rr.withoutSetter||VP;up.exports=function(r){return lp(kl,r)||(kl[r]=$P&&lp(Rr,r)?Rr[r]:KP("Symbol."+r)),kl[r]}});var pp=b((UB,mp)=>{var XP=Ie(),ZP=XP("toStringTag"),cp={};cp[ZP]="z";mp.exports=String(cp)==="[object z]"});var wl=b((MB,fp)=>{var Sl=typeof document=="object"&&document.all,YP=typeof Sl>"u"&&Sl!==void 0;fp.exports={all:Sl,IS_HTMLDDA:YP}});var K=b((LB,hp)=>{var gp=wl(),QP=gp.all;hp.exports=gp.IS_HTMLDDA?function(r){return typeof r=="function"||r===QP}:function(r){return typeof r=="function"}});var ya=b((DB,vp)=>{var yp=J(),ek=yp({}.toString),tk=yp("".slice);vp.exports=function(r){return tk(ek(r),8,-1)}});var En=b((_B,bp)=>{var rk=pp(),ik=K(),va=ya(),nk=Ie(),sk=nk("toStringTag"),ok=Object,ak=va(function(){return arguments}())=="Arguments",dk=function(r,e){try{return r[e]}catch{}};bp.exports=rk?va:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=dk(e=ok(r),sk))=="string"?t:ak?va(e):(i=va(e))=="Object"&&ik(e.callee)?"Arguments":i}});var Tn=b((NB,Pp)=>{var lk=En(),uk=String;Pp.exports=function(r){if(lk(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return uk(r)}});var xl=b((qB,wp)=>{var Il=J(),ck=ua(),mk=Tn(),pk=ga(),fk=Il("".charAt),kp=Il("".charCodeAt),gk=Il("".slice),Sp=function(r){return function(e,t){var i=mk(pk(e)),n=ck(t),o=i.length,a,u;return n<0||n>=o?r?"":void 0:(a=kp(i,n),a<55296||a>56319||n+1===o||(u=kp(i,n+1))<56320||u>57343?r?fk(i,n):a:r?gk(i,n,n+2):(a-55296<<10)+(u-56320)+65536)}};wp.exports={codeAt:Sp(!1),charAt:Sp(!0)}});var Cp=b((HB,xp)=>{var hk=me(),yk=K(),Ip=hk.WeakMap;xp.exports=yk(Ip)&&/native code/.test(String(Ip))});var vt=b((jB,Tp)=>{var Ap=K(),Ep=wl(),vk=Ep.all;Tp.exports=Ep.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:Ap(r)||r===vk}:function(r){return typeof r=="object"?r!==null:Ap(r)}});var pe=b((WB,Rp)=>{var bk=oe();Rp.exports=!bk(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var Al=b((GB,Bp)=>{var Pk=me(),Fp=vt(),Cl=Pk.document,kk=Fp(Cl)&&Fp(Cl.createElement);Bp.exports=function(r){return kk?Cl.createElement(r):{}}});var El=b((zB,Op)=>{var Sk=pe(),wk=oe(),Ik=Al();Op.exports=!Sk&&!wk(function(){return Object.defineProperty(Ik("div"),"a",{get:function(){return 7}}).a!=7})});var Tl=b((VB,Up)=>{var xk=pe(),Ck=oe();Up.exports=xk&&Ck(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Xe=b(($B,Mp)=>{var Ak=vt(),Ek=String,Tk=TypeError;Mp.exports=function(r){if(Ak(r))return r;throw Tk(Ek(r)+" is not an object")}});var je=b((JB,Lp)=>{var Rk=la(),ba=Function.prototype.call;Lp.exports=Rk?ba.bind(ba):function(){return ba.apply(ba,arguments)}});var Rn=b((KB,Dp)=>{var Rl=me(),Fk=K(),Bk=function(r){return Fk(r)?r:void 0};Dp.exports=function(r,e){return arguments.length<2?Bk(Rl[r]):Rl[r]&&Rl[r][e]}});var Fl=b((XB,_p)=>{var Ok=J();_p.exports=Ok({}.isPrototypeOf)});var Bl=b((ZB,Np)=>{var Uk=Rn(),Mk=K(),Lk=Fl(),Dk=Pl(),_k=Object;Np.exports=Dk?function(r){return typeof r=="symbol"}:function(r){var e=Uk("Symbol");return Mk(e)&&Lk(e.prototype,_k(r))}});var Ol=b((YB,qp)=>{var Nk=String;qp.exports=function(r){try{return Nk(r)}catch{return"Object"}}});var Pa=b((QB,Hp)=>{var qk=K(),Hk=Ol(),jk=TypeError;Hp.exports=function(r){if(qk(r))return r;throw jk(Hk(r)+" is not a function")}});var ka=b((eO,jp)=>{var Wk=Pa(),Gk=fa();jp.exports=function(r,e){var t=r[e];return Gk(t)?void 0:Wk(t)}});var Gp=b((tO,Wp)=>{var Ul=je(),Ml=K(),Ll=vt(),zk=TypeError;Wp.exports=function(r,e){var t,i;if(e==="string"&&Ml(t=r.toString)&&!Ll(i=Ul(t,r))||Ml(t=r.valueOf)&&!Ll(i=Ul(t,r))||e!=="string"&&Ml(t=r.toString)&&!Ll(i=Ul(t,r)))return i;throw zk("Can't convert object to primitive value")}});var Jp=b((rO,$p)=>{var Vk=je(),zp=vt(),Vp=Bl(),$k=ka(),Jk=Gp(),Kk=Ie(),Xk=TypeError,Zk=Kk("toPrimitive");$p.exports=function(r,e){if(!zp(r)||Vp(r))return r;var t=$k(r,Zk),i;if(t){if(e===void 0&&(e="default"),i=Vk(t,r,e),!zp(i)||Vp(i))return i;throw Xk("Can't convert object to primitive value")}return e===void 0&&(e="number"),Jk(r,e)}});var Sa=b((iO,Kp)=>{var Yk=Jp(),Qk=Bl();Kp.exports=function(r){var e=Yk(r,"string");return Qk(e)?e:e+""}});var Ze=b(Zp=>{var eS=pe(),tS=El(),rS=Tl(),wa=Xe(),Xp=Sa(),iS=TypeError,Dl=Object.defineProperty,nS=Object.getOwnPropertyDescriptor,_l="enumerable",Nl="configurable",ql="writable";Zp.f=eS?rS?function(e,t,i){if(wa(e),t=Xp(t),wa(i),typeof e=="function"&&t==="prototype"&&"value"in i&&ql in i&&!i[ql]){var n=nS(e,t);n&&n[ql]&&(e[t]=i.value,i={configurable:Nl in i?i[Nl]:n[Nl],enumerable:_l in i?i[_l]:n[_l],writable:!1})}return Dl(e,t,i)}:Dl:function(e,t,i){if(wa(e),t=Xp(t),wa(i),tS)try{return Dl(e,t,i)}catch{}if("get"in i||"set"in i)throw iS("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var Fr=b((sO,Yp)=>{Yp.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Ia=b((oO,Qp)=>{var sS=pe(),oS=Ze(),aS=Fr();Qp.exports=sS?function(r,e,t){return oS.f(r,e,aS(1,t))}:function(r,e,t){return r[e]=t,r}});var xa=b((aO,tf)=>{var dS=hl(),lS=yl(),ef=dS("keys");tf.exports=function(r){return ef[r]||(ef[r]=lS(r))}});var Ca=b((dO,rf)=>{rf.exports={}});var Br=b((lO,of)=>{var uS=Cp(),sf=me(),cS=vt(),mS=Ia(),Hl=we(),jl=pa(),pS=xa(),fS=Ca(),nf="Object already initialized",Wl=sf.TypeError,gS=sf.WeakMap,Aa,Fn,Ea,hS=function(r){return Ea(r)?Fn(r):Aa(r,{})},yS=function(r){return function(e){var t;if(!cS(e)||(t=Fn(e)).type!==r)throw Wl("Incompatible receiver, "+r+" required");return t}};uS||jl.state?(We=jl.state||(jl.state=new gS),We.get=We.get,We.has=We.has,We.set=We.set,Aa=function(r,e){if(We.has(r))throw Wl(nf);return e.facade=r,We.set(r,e),e},Fn=function(r){return We.get(r)||{}},Ea=function(r){return We.has(r)}):(Kt=pS("state"),fS[Kt]=!0,Aa=function(r,e){if(Hl(r,Kt))throw Wl(nf);return e.facade=r,mS(r,Kt,e),e},Fn=function(r){return Hl(r,Kt)?r[Kt]:{}},Ea=function(r){return Hl(r,Kt)});var We,Kt;of.exports={set:Aa,get:Fn,has:Ea,enforce:hS,getterFor:yS}});var Gl=b(lf=>{"use strict";var af={}.propertyIsEnumerable,df=Object.getOwnPropertyDescriptor,vS=df&&!af.call({1:2},1);lf.f=vS?function(e){var t=df(this,e);return!!t&&t.enumerable}:af});var Vl=b((cO,uf)=>{var bS=J(),PS=oe(),kS=ya(),zl=Object,SS=bS("".split);uf.exports=PS(function(){return!zl("z").propertyIsEnumerable(0)})?function(r){return kS(r)=="String"?SS(r,""):zl(r)}:zl});var Or=b((mO,cf)=>{var wS=Vl(),IS=ga();cf.exports=function(r){return wS(IS(r))}});var $l=b(pf=>{var xS=pe(),CS=je(),AS=Gl(),ES=Fr(),TS=Or(),RS=Sa(),FS=we(),BS=El(),mf=Object.getOwnPropertyDescriptor;pf.f=xS?mf:function(e,t){if(e=TS(e),t=RS(t),BS)try{return mf(e,t)}catch{}if(FS(e,t))return ES(!CS(AS.f,e,t),e[t])}});var Xl=b((fO,gf)=>{var Jl=pe(),OS=we(),ff=Function.prototype,US=Jl&&Object.getOwnPropertyDescriptor,Kl=OS(ff,"name"),MS=Kl&&function(){}.name==="something",LS=Kl&&(!Jl||Jl&&US(ff,"name").configurable);gf.exports={EXISTS:Kl,PROPER:MS,CONFIGURABLE:LS}});var Yl=b((gO,hf)=>{var DS=J(),_S=K(),Zl=pa(),NS=DS(Function.toString);_S(Zl.inspectSource)||(Zl.inspectSource=function(r){return NS(r)});hf.exports=Zl.inspectSource});var tu=b((hO,bf)=>{var eu=J(),qS=oe(),HS=K(),Ta=we(),Ql=pe(),jS=Xl().CONFIGURABLE,WS=Yl(),vf=Br(),GS=vf.enforce,zS=vf.get,yf=String,Ra=Object.defineProperty,VS=eu("".slice),$S=eu("".replace),JS=eu([].join),KS=Ql&&!qS(function(){return Ra(function(){},"length",{value:8}).length!==8}),XS=String(String).split("String"),ZS=bf.exports=function(r,e,t){VS(yf(e),0,7)==="Symbol("&&(e="["+$S(yf(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Ta(r,"name")||jS&&r.name!==e)&&(Ql?Ra(r,"name",{value:e,configurable:!0}):r.name=e),KS&&t&&Ta(t,"arity")&&r.length!==t.arity&&Ra(r,"length",{value:t.arity});try{t&&Ta(t,"constructor")&&t.constructor?Ql&&Ra(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=GS(r);return Ta(i,"source")||(i.source=JS(XS,typeof e=="string"?e:"")),r};Function.prototype.toString=ZS(function(){return HS(this)&&zS(this).source||WS(this)},"toString")});var Xt=b((yO,Pf)=>{var YS=K(),QS=Ze(),ew=tu(),tw=ma();Pf.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(YS(t)&&ew(t,o,i),i.global)n?r[e]=t:tw(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:QS.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var ru=b((vO,kf)=>{var rw=ua(),iw=Math.max,nw=Math.min;kf.exports=function(r,e){var t=rw(r);return t<0?iw(t+e,0):nw(t,e)}});var wf=b((bO,Sf)=>{var sw=ua(),ow=Math.min;Sf.exports=function(r){return r>0?ow(sw(r),9007199254740991):0}});var Fa=b((PO,If)=>{var aw=wf();If.exports=function(r){return aw(r.length)}});var Af=b((kO,Cf)=>{var dw=Or(),lw=ru(),uw=Fa(),xf=function(r){return function(e,t,i){var n=dw(e),o=uw(n),a=lw(i,o),u;if(r&&t!=t){for(;o>a;)if(u=n[a++],u!=u)return!0}else for(;o>a;a++)if((r||a in n)&&n[a]===t)return r||a||0;return!r&&-1}};Cf.exports={includes:xf(!0),indexOf:xf(!1)}});var nu=b((SO,Tf)=>{var cw=J(),iu=we(),mw=Or(),pw=Af().indexOf,fw=Ca(),Ef=cw([].push);Tf.exports=function(r,e){var t=mw(r),i=0,n=[],o;for(o in t)!iu(fw,o)&&iu(t,o)&&Ef(n,o);for(;e.length>i;)iu(t,o=e[i++])&&(~pw(n,o)||Ef(n,o));return n}});var Ba=b((wO,Rf)=>{Rf.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Bf=b(Ff=>{var gw=nu(),hw=Ba(),yw=hw.concat("length","prototype");Ff.f=Object.getOwnPropertyNames||function(e){return gw(e,yw)}});var su=b(Of=>{Of.f=Object.getOwnPropertySymbols});var Mf=b((CO,Uf)=>{var vw=Rn(),bw=J(),Pw=Bf(),kw=su(),Sw=Xe(),ww=bw([].concat);Uf.exports=vw("Reflect","ownKeys")||function(e){var t=Pw.f(Sw(e)),i=kw.f;return i?ww(t,i(e)):t}});var _f=b((AO,Df)=>{var Lf=we(),Iw=Mf(),xw=$l(),Cw=Ze();Df.exports=function(r,e,t){for(var i=Iw(e),n=Cw.f,o=xw.f,a=0;a<i.length;a++){var u=i[a];!Lf(r,u)&&!(t&&Lf(t,u))&&n(r,u,o(e,u))}}});var qf=b((EO,Nf)=>{var Aw=oe(),Ew=K(),Tw=/#|\.prototype\./,Bn=function(r,e){var t=Fw[Rw(r)];return t==Ow?!0:t==Bw?!1:Ew(e)?Aw(e):!!e},Rw=Bn.normalize=function(r){return String(r).replace(Tw,".").toLowerCase()},Fw=Bn.data={},Bw=Bn.NATIVE="N",Ow=Bn.POLYFILL="P";Nf.exports=Bn});var On=b((TO,Hf)=>{var ou=me(),Uw=$l().f,Mw=Ia(),Lw=Xt(),Dw=ma(),_w=_f(),Nw=qf();Hf.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,u,p,f,g;if(i?a=ou:n?a=ou[t]||Dw(t,{}):a=(ou[t]||{}).prototype,a)for(u in e){if(f=e[u],r.dontCallGetSet?(g=Uw(a,u),p=g&&g.value):p=a[u],o=Nw(i?u:t+(n?".":"#")+u,r.forced),!o&&p!==void 0){if(typeof f==typeof p)continue;_w(f,p)}(r.sham||p&&p.sham)&&Mw(f,"sham",!0),Lw(a,u,f,r)}}});var au=b((RO,jf)=>{var qw=nu(),Hw=Ba();jf.exports=Object.keys||function(e){return qw(e,Hw)}});var Gf=b(Wf=>{var jw=pe(),Ww=Tl(),Gw=Ze(),zw=Xe(),Vw=Or(),$w=au();Wf.f=jw&&!Ww?Object.defineProperties:function(e,t){zw(e);for(var i=Vw(t),n=$w(t),o=n.length,a=0,u;o>a;)Gw.f(e,u=n[a++],i[u]);return e}});var Vf=b((BO,zf)=>{var Jw=Rn();zf.exports=Jw("document","documentElement")});var Un=b((OO,Qf)=>{var Kw=Xe(),Xw=Gf(),$f=Ba(),Zw=Ca(),Yw=Vf(),Qw=Al(),eI=xa(),Jf=">",Kf="<",lu="prototype",uu="script",Zf=eI("IE_PROTO"),du=function(){},Yf=function(r){return Kf+uu+Jf+r+Kf+"/"+uu+Jf},Xf=function(r){r.write(Yf("")),r.close();var e=r.parentWindow.Object;return r=null,e},tI=function(){var r=Qw("iframe"),e="java"+uu+":",t;return r.style.display="none",Yw.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(Yf("document.F=Object")),t.close(),t.F},Oa,Ua=function(){try{Oa=new ActiveXObject("htmlfile")}catch{}Ua=typeof document<"u"?document.domain&&Oa?Xf(Oa):tI():Xf(Oa);for(var r=$f.length;r--;)delete Ua[lu][$f[r]];return Ua()};Zw[Zf]=!0;Qf.exports=Object.create||function(e,t){var i;return e!==null?(du[lu]=Kw(e),i=new du,du[lu]=null,i[Zf]=e):i=Ua(),t===void 0?i:Xw.f(i,t)}});var tg=b((UO,eg)=>{var rI=oe();eg.exports=!rI(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var mu=b((MO,ig)=>{var iI=we(),nI=K(),sI=An(),oI=xa(),aI=tg(),rg=oI("IE_PROTO"),cu=Object,dI=cu.prototype;ig.exports=aI?cu.getPrototypeOf:function(r){var e=sI(r);if(iI(e,rg))return e[rg];var t=e.constructor;return nI(t)&&e instanceof t?t.prototype:e instanceof cu?dI:null}});var hu=b((LO,og)=>{"use strict";var lI=oe(),uI=K(),cI=vt(),mI=Un(),ng=mu(),pI=Xt(),fI=Ie(),gI=Tr(),gu=fI("iterator"),sg=!1,nt,pu,fu;[].keys&&(fu=[].keys(),"next"in fu?(pu=ng(ng(fu)),pu!==Object.prototype&&(nt=pu)):sg=!0);var hI=!cI(nt)||lI(function(){var r={};return nt[gu].call(r)!==r});hI?nt={}:gI&&(nt=mI(nt));uI(nt[gu])||pI(nt,gu,function(){return this});og.exports={IteratorPrototype:nt,BUGGY_SAFARI_ITERATORS:sg}});var Mn=b((DO,dg)=>{var yI=Ze().f,vI=we(),bI=Ie(),ag=bI("toStringTag");dg.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!vI(r,ag)&&yI(r,ag,{configurable:!0,value:e})}});var Ur=b((_O,lg)=>{lg.exports={}});var yu=b((NO,ug)=>{"use strict";var PI=hu().IteratorPrototype,kI=Un(),SI=Fr(),wI=Mn(),II=Ur(),xI=function(){return this};ug.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=kI(PI,{next:SI(+!i,t)}),wI(r,n,!1,!0),II[n]=xI,r}});var mg=b((qO,cg)=>{var CI=K(),AI=String,EI=TypeError;cg.exports=function(r){if(typeof r=="object"||CI(r))return r;throw EI("Can't set "+AI(r)+" as a prototype")}});var fg=b((HO,pg)=>{var TI=J(),RI=Xe(),FI=mg();pg.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=TI(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return RI(n),FI(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var bu=b((jO,Ig)=>{"use strict";var BI=On(),OI=je(),Ma=Tr(),Sg=Xl(),UI=K(),MI=yu(),gg=mu(),hg=fg(),LI=Mn(),DI=Ia(),vu=Xt(),_I=Ie(),yg=Ur(),wg=hu(),NI=Sg.PROPER,qI=Sg.CONFIGURABLE,vg=wg.IteratorPrototype,La=wg.BUGGY_SAFARI_ITERATORS,Ln=_I("iterator"),bg="keys",Dn="values",Pg="entries",kg=function(){return this};Ig.exports=function(r,e,t,i,n,o,a){MI(t,e,i);var u=function(D){if(D===n&&h)return h;if(!La&&D in g)return g[D];switch(D){case bg:return function(){return new t(this,D)};case Dn:return function(){return new t(this,D)};case Pg:return function(){return new t(this,D)}}return function(){return new t(this)}},p=e+" Iterator",f=!1,g=r.prototype,c=g[Ln]||g["@@iterator"]||n&&g[n],h=!La&&c||u(n),P=e=="Array"&&g.entries||c,w,C,E;if(P&&(w=gg(P.call(new r)),w!==Object.prototype&&w.next&&(!Ma&&gg(w)!==vg&&(hg?hg(w,vg):UI(w[Ln])||vu(w,Ln,kg)),LI(w,p,!0,!0),Ma&&(yg[p]=kg))),NI&&n==Dn&&c&&c.name!==Dn&&(!Ma&&qI?DI(g,"name",Dn):(f=!0,h=function(){return OI(c,this)})),n)if(C={values:u(Dn),keys:o?h:u(bg),entries:u(Pg)},a)for(E in C)(La||f||!(E in g))&&vu(g,E,C[E]);else BI({target:e,proto:!0,forced:La||f},C);return(!Ma||a)&&g[Ln]!==h&&vu(g,Ln,h,{name:n}),yg[e]=h,C}});var Pu=b((WO,xg)=>{xg.exports=function(r,e){return{value:r,done:e}}});var Tg=b(()=>{"use strict";var HI=xl().charAt,jI=Tn(),Ag=Br(),WI=bu(),Cg=Pu(),Eg="String Iterator",GI=Ag.set,zI=Ag.getterFor(Eg);WI(String,"String",function(r){GI(this,{type:Eg,string:jI(r),index:0})},function(){var e=zI(this),t=e.string,i=e.index,n;return i>=t.length?Cg(void 0,!0):(n=HI(t,i),e.index+=n.length,Cg(n,!1))})});var ku=b((VO,Rg)=>{var VI=oe(),$I=Ie(),JI=Tr(),KI=$I("iterator");Rg.exports=!VI(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}),JI&&!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[KI]||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 Bg=b(($O,Fg)=>{var XI=ya(),ZI=J();Fg.exports=function(r){if(XI(r)==="Function")return ZI(r)}});var Da=b((JO,Ug)=>{var Og=Bg(),YI=Pa(),QI=la(),ex=Og(Og.bind);Ug.exports=function(r,e){return YI(r),e===void 0?r:QI?ex(r,e):function(){return r.apply(e,arguments)}}});var Dg=b((KO,Lg)=>{var Mg=tu(),tx=Ze();Lg.exports=function(r,e,t){return t.get&&Mg(t.get,e,{getter:!0}),t.set&&Mg(t.set,e,{setter:!0}),tx.f(r,e,t)}});var Su=b((XO,_g)=>{var rx=Fl(),ix=TypeError;_g.exports=function(r,e){if(rx(e,r))return r;throw ix("Incorrect invocation")}});var jg=b((ZO,Hg)=>{"use strict";var Ng=pe(),nx=J(),sx=je(),ox=oe(),wu=au(),ax=su(),dx=Gl(),lx=An(),ux=Vl(),Mr=Object.assign,qg=Object.defineProperty,cx=nx([].concat);Hg.exports=!Mr||ox(function(){if(Ng&&Mr({b:1},Mr(qg({},"a",{enumerable:!0,get:function(){qg(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}),Mr({},r)[t]!=7||wu(Mr({},e)).join("")!=i})?function(e,t){for(var i=lx(e),n=arguments.length,o=1,a=ax.f,u=dx.f;n>o;)for(var p=ux(arguments[o++]),f=a?cx(wu(p),a(p)):wu(p),g=f.length,c=0,h;g>c;)h=f[c++],(!Ng||sx(u,p,h))&&(i[h]=p[h]);return i}:Mr});var zg=b((YO,Gg)=>{var mx=je(),Wg=Xe(),px=ka();Gg.exports=function(r,e,t){var i,n;Wg(r);try{if(i=px(r,"return"),!i){if(e==="throw")throw t;return t}i=mx(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Wg(i),t}});var $g=b((QO,Vg)=>{var fx=Xe(),gx=zg();Vg.exports=function(r,e,t,i){try{return i?e(fx(t)[0],t[1]):e(t)}catch(n){gx(r,"throw",n)}}});var Kg=b((eU,Jg)=>{var hx=Ie(),yx=Ur(),vx=hx("iterator"),bx=Array.prototype;Jg.exports=function(r){return r!==void 0&&(yx.Array===r||bx[vx]===r)}});var th=b((tU,eh)=>{var Px=J(),kx=oe(),Xg=K(),Sx=En(),wx=Rn(),Ix=Yl(),Zg=function(){},xx=[],Yg=wx("Reflect","construct"),Iu=/^\s*(?:class|function)\b/,Cx=Px(Iu.exec),Ax=!Iu.exec(Zg),_n=function(e){if(!Xg(e))return!1;try{return Yg(Zg,xx,e),!0}catch{return!1}},Qg=function(e){if(!Xg(e))return!1;switch(Sx(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ax||!!Cx(Iu,Ix(e))}catch{return!0}};Qg.sham=!0;eh.exports=!Yg||kx(function(){var r;return _n(_n.call)||!_n(Object)||!_n(function(){r=!0})||r})?Qg:_n});var xu=b((rU,rh)=>{"use strict";var Ex=Sa(),Tx=Ze(),Rx=Fr();rh.exports=function(r,e,t){var i=Ex(e);i in r?Tx.f(r,i,Rx(0,t)):r[i]=t}});var _a=b((iU,nh)=>{var Fx=En(),ih=ka(),Bx=fa(),Ox=Ur(),Ux=Ie(),Mx=Ux("iterator");nh.exports=function(r){if(!Bx(r))return ih(r,Mx)||ih(r,"@@iterator")||Ox[Fx(r)]}});var Cu=b((nU,sh)=>{var Lx=je(),Dx=Pa(),_x=Xe(),Nx=Ol(),qx=_a(),Hx=TypeError;sh.exports=function(r,e){var t=arguments.length<2?qx(r):e;if(Dx(t))return _x(Lx(t,r));throw Hx(Nx(r)+" is not iterable")}});var lh=b((sU,dh)=>{"use strict";var jx=Da(),Wx=je(),Gx=An(),zx=$g(),Vx=Kg(),$x=th(),Jx=Fa(),oh=xu(),Kx=Cu(),Xx=_a(),ah=Array;dh.exports=function(e){var t=Gx(e),i=$x(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=jx(o,n>2?arguments[2]:void 0));var u=Xx(t),p=0,f,g,c,h,P,w;if(u&&!(this===ah&&Vx(u)))for(h=Kx(t,u),P=h.next,g=i?new this:[];!(c=Wx(P,h)).done;p++)w=a?zx(h,o,[c.value,p],!0):c.value,oh(g,p,w);else for(f=Jx(t),g=i?new this(f):ah(f);f>p;p++)w=a?o(t[p],p):t[p],oh(g,p,w);return g.length=p,g}});var Au=b((oU,ch)=>{var uh=ru(),Zx=Fa(),Yx=xu(),Qx=Array,eC=Math.max;ch.exports=function(r,e,t){for(var i=Zx(r),n=uh(e,i),o=uh(t===void 0?i:t,i),a=Qx(eC(o-n,0)),u=0;n<o;n++,u++)Yx(a,u,r[n]);return a.length=u,a}});var Ph=b((aU,bh)=>{var Zt=J(),Eu=2147483647,Nn=36,hh=1,Fu=26,tC=38,rC=700,iC=72,nC=128,sC="-",oC=/[^\0-\u007E]/,yh=/[.\u3002\uFF0E\uFF61]/g,mh="Overflow: input needs wider integers to process",Tu=Nn-hh,ph=RangeError,aC=Zt(yh.exec),Lr=Math.floor,Ru=String.fromCharCode,fh=Zt("".charCodeAt),vh=Zt([].join),bt=Zt([].push),dC=Zt("".replace),lC=Zt("".split),uC=Zt("".toLowerCase),cC=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=fh(r,t++);if(n>=55296&&n<=56319&&t<i){var o=fh(r,t++);(o&64512)==56320?bt(e,((n&1023)<<10)+(o&1023)+65536):(bt(e,n),t--)}else bt(e,n)}return e},gh=function(r){return r+22+75*(r<26)},mC=function(r,e,t){var i=0;for(r=t?Lr(r/rC):r>>1,r+=Lr(r/e);r>Tu*Fu>>1;)r=Lr(r/Tu),i+=Nn;return Lr(i+(Tu+1)*r/(r+tC))},pC=function(r){var e=[];r=cC(r);var t=r.length,i=nC,n=0,o=iC,a,u;for(a=0;a<r.length;a++)u=r[a],u<128&&bt(e,Ru(u));var p=e.length,f=p;for(p&&bt(e,sC);f<t;){var g=Eu;for(a=0;a<r.length;a++)u=r[a],u>=i&&u<g&&(g=u);var c=f+1;if(g-i>Lr((Eu-n)/c))throw ph(mh);for(n+=(g-i)*c,i=g,a=0;a<r.length;a++){if(u=r[a],u<i&&++n>Eu)throw ph(mh);if(u==i){for(var h=n,P=Nn;;){var w=P<=o?hh:P>=o+Fu?Fu:P-o;if(h<w)break;var C=h-w,E=Nn-w;bt(e,Ru(gh(w+C%E))),h=Lr(C/E),P+=Nn}bt(e,Ru(gh(h))),o=mC(n,c,f==p),n=0,f++}}n++,i++}return vh(e,"")};bh.exports=function(r){var e=[],t=lC(dC(uC(r),yh,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],bt(e,aC(oC,n)?"xn--"+pC(n):n);return vh(e,".")}});var Bu=b((dU,kh)=>{var fC=TypeError;kh.exports=function(r,e){if(r<e)throw fC("Not enough arguments");return r}});var wh=b((lU,Sh)=>{var gC=Ie(),hC=Un(),yC=Ze().f,Ou=gC("unscopables"),Uu=Array.prototype;Uu[Ou]==null&&yC(Uu,Ou,{configurable:!0,value:hC(null)});Sh.exports=function(r){Uu[Ou][r]=!0}});var Th=b((uU,Eh)=>{"use strict";var vC=Or(),Mu=wh(),Ih=Ur(),Ch=Br(),bC=Ze().f,PC=bu(),Na=Pu(),kC=Tr(),SC=pe(),Ah="Array Iterator",wC=Ch.set,IC=Ch.getterFor(Ah);Eh.exports=PC(Array,"Array",function(r,e){wC(this,{type:Ah,target:vC(r),index:0,kind:e})},function(){var r=IC(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,Na(void 0,!0)):t=="keys"?Na(i,!1):t=="values"?Na(e[i],!1):Na([i,e[i]],!1)},"values");var xh=Ih.Arguments=Ih.Array;Mu("keys");Mu("values");Mu("entries");if(!kC&&SC&&xh.name!=="values")try{bC(xh,"name",{value:"values"})}catch{}});var Fh=b((cU,Rh)=>{var xC=Xt();Rh.exports=function(r,e,t){for(var i in e)xC(r,i,e[i],t);return r}});var Uh=b((mU,Oh)=>{var Bh=Au(),CC=Math.floor,Lu=function(r,e){var t=r.length,i=CC(t/2);return t<8?AC(r,e):EC(r,Lu(Bh(r,0,i),e),Lu(Bh(r,i),e),e)},AC=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},EC=function(r,e,t,i){for(var n=e.length,o=t.length,a=0,u=0;a<n||u<o;)r[a+u]=a<n&&u<o?i(e[a],t[u])<=0?e[a++]:t[u++]:a<n?e[a++]:t[u++];return r};Oh.exports=Lu});var Vu=b((pU,ey)=>{"use strict";Th();var Hu=On(),_r=me(),qa=je(),Ye=J(),TC=pe(),Vh=ku(),$h=Xt(),RC=Fh(),FC=Mn(),BC=yu(),Gu=Br(),Jh=Su(),Du=K(),OC=we(),UC=Da(),MC=En(),LC=Xe(),Kh=vt(),fe=Tn(),DC=Un(),Mh=Fr(),ju=Cu(),_C=_a(),Dr=Bu(),NC=Ie(),qC=Uh(),HC=NC("iterator"),jn="URLSearchParams",Xh=jn+"Iterator",Zh=Gu.set,Ge=Gu.getterFor(jn),jC=Gu.getterFor(Xh),WC=Object.getOwnPropertyDescriptor,zu=function(r){if(!TC)return _r[r];var e=WC(_r,r);return e&&e.value},Lh=zu("fetch"),ja=zu("Request"),qn=zu("Headers"),_u=ja&&ja.prototype,Dh=qn&&qn.prototype,GC=_r.RegExp,zC=_r.TypeError,Yh=_r.decodeURIComponent,VC=_r.encodeURIComponent,$C=Ye("".charAt),_h=Ye([].join),Yt=Ye([].push),Wu=Ye("".replace),JC=Ye([].shift),Nh=Ye([].splice),qh=Ye("".split),KC=Ye("".slice),XC=/\+/g,Hh=Array(4),ZC=function(r){return Hh[r-1]||(Hh[r-1]=GC("((?:%[\\da-f]{2}){"+r+"})","gi"))},YC=function(r){try{return Yh(r)}catch{return r}},jh=function(r){var e=Wu(r,XC," "),t=4;try{return Yh(e)}catch{for(;t;)e=Wu(e,ZC(t--),YC);return e}},QC=/[!'()~]|%20/g,eA={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},tA=function(r){return eA[r]},Wh=function(r){return Wu(VC(r),QC,tA)},Nu=BC(function(e,t){Zh(this,{type:Xh,iterator:ju(Ge(e).entries),kind:t})},"Iterator",function(){var e=jC(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),Qh=function(r){this.entries=[],this.url=null,r!==void 0&&(Kh(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?$C(r,0)==="?"?KC(r,1):r:fe(r)))};Qh.prototype={type:jn,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=_C(r),t,i,n,o,a,u,p;if(e)for(t=ju(r,e),i=t.next;!(n=qa(i,t)).done;){if(o=ju(LC(n.value)),a=o.next,(u=qa(a,o)).done||(p=qa(a,o)).done||!qa(a,o).done)throw zC("Expected sequence with length 2");Yt(this.entries,{key:fe(u.value),value:fe(p.value)})}else for(var f in r)OC(r,f)&&Yt(this.entries,{key:f,value:fe(r[f])})},parseQuery:function(r){if(r)for(var e=qh(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=qh(i,"="),Yt(this.entries,{key:jh(JC(n)),value:jh(_h(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],Yt(e,Wh(i.key)+"="+Wh(i.value));return _h(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Wa=function(){Jh(this,Hn);var e=arguments.length>0?arguments[0]:void 0;Zh(this,new Qh(e))},Hn=Wa.prototype;RC(Hn,{append:function(e,t){Dr(arguments.length,2);var i=Ge(this);Yt(i.entries,{key:fe(e),value:fe(t)}),i.updateURL()},delete:function(r){Dr(arguments.length,1);for(var e=Ge(this),t=e.entries,i=fe(r),n=0;n<t.length;)t[n].key===i?Nh(t,n,1):n++;e.updateURL()},get:function(e){Dr(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){Dr(arguments.length,1);for(var t=Ge(this).entries,i=fe(e),n=[],o=0;o<t.length;o++)t[o].key===i&&Yt(n,t[o].value);return n},has:function(e){Dr(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){Dr(arguments.length,1);for(var i=Ge(this),n=i.entries,o=!1,a=fe(e),u=fe(t),p=0,f;p<n.length;p++)f=n[p],f.key===a&&(o?Nh(n,p--,1):(o=!0,f.value=u));o||Yt(n,{key:a,value:u}),i.updateURL()},sort:function(){var e=Ge(this);qC(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=Ge(this).entries,i=UC(e,arguments.length>1?arguments[1]:void 0),n=0,o;n<t.length;)o=t[n++],i(o.value,o.key,this)},keys:function(){return new Nu(this,"keys")},values:function(){return new Nu(this,"values")},entries:function(){return new Nu(this,"entries")}},{enumerable:!0});$h(Hn,HC,Hn.entries,{name:"entries"});$h(Hn,"toString",function(){return Ge(this).serialize()},{enumerable:!0});FC(Wa,jn);Hu({global:!0,constructor:!0,forced:!Vh},{URLSearchParams:Wa});!Vh&&Du(qn)&&(Gh=Ye(Dh.has),zh=Ye(Dh.set),qu=function(r){if(Kh(r)){var e=r.body,t;if(MC(e)===jn)return t=r.headers?new qn(r.headers):new qn,Gh(t,"content-type")||zh(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),DC(r,{body:Mh(0,fe(e)),headers:Mh(0,t)})}return r},Du(Lh)&&Hu({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Lh(e,arguments.length>1?qu(arguments[1]):{})}}),Du(ja)&&(Ha=function(e){return Jh(this,_u),new ja(e,arguments.length>1?qu(arguments[1]):{})},_u.constructor=Ha,Ha.prototype=_u,Hu({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Ha})));var Gh,zh,qu,Ha;ey.exports={URLSearchParams:Wa,getState:Ge}});var by=b(()=>{"use strict";Tg();var rA=On(),dc=pe(),iA=ku(),lc=me(),ty=Da(),Te=J(),Ja=Xt(),xe=Dg(),nA=Su(),sc=we(),uc=jg(),Nr=lh(),ze=Au(),sA=xl().codeAt,oA=Ph(),ot=Tn(),aA=Mn(),dA=Bu(),py=Vu(),fy=Br(),lA=fy.set,Ka=fy.getterFor("URL"),uA=py.URLSearchParams,cA=py.getState,Wn=lc.URL,oc=lc.TypeError,Xa=lc.parseInt,mA=Math.floor,ry=Math.pow,Ee=Te("".charAt),Ve=Te(/./.exec),zn=Te([].join),pA=Te(1 .toString),fA=Te([].pop),Hr=Te([].push),iy=Te("".replace),gA=Te([].shift),hA=Te("".split),$n=Te("".slice),Za=Te("".toLowerCase),yA=Te([].unshift),vA="Invalid authority",$u="Invalid scheme",Qt="Invalid host",ny="Invalid port",gy=/[a-z]/i,bA=/[\d+-.a-z]/i,ac=/\d/,PA=/^0x/i,kA=/^[0-7]+$/,SA=/^\d+$/,hy=/^[\da-f]+$/i,wA=/[\0\t\n\r #%/:<>?@[\\\]^|]/,IA=/[\0\t\n\r #/:<>?@[\\\]^|]/,xA=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,CA=/[\t\n\r]/g,Ce,AA=function(r){var e=hA(r,"."),t,i,n,o,a,u,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&&Ee(o,0)=="0"&&(a=Ve(PA,o)?16:8,o=$n(o,a==8?1:2)),o==="")u=0;else{if(!Ve(a==10?SA:a==8?kA:hy,o))return r;u=Xa(o,a)}Hr(i,u)}for(n=0;n<t;n++)if(u=i[n],n==t-1){if(u>=ry(256,5-t))return null}else if(u>255)return null;for(p=fA(i),n=0;n<i.length;n++)p+=i[n]*ry(256,3-n);return p},EA=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,u,p,f,g,c,h=function(){return Ee(r,n)};if(h()==":"){if(Ee(r,1)!=":")return;n+=2,t++,i=t}for(;h();){if(t==8)return;if(h()==":"){if(i!==null)return;n++,t++,i=t;continue}for(o=a=0;a<4&&Ve(hy,h());)o=o*16+Xa(h(),16),n++,a++;if(h()=="."){if(a==0||(n-=a,t>6))return;for(u=0;h();){if(p=null,u>0)if(h()=="."&&u<4)n++;else return;if(!Ve(ac,h()))return;for(;Ve(ac,h());){if(f=Xa(h(),10),p===null)p=f;else{if(p==0)return;p=p*10+f}if(p>255)return;n++}e[t]=e[t]*256+p,u++,(u==2||u==4)&&t++}if(u!=4)return;break}else if(h()==":"){if(n++,!h())return}else if(h())return;e[t++]=o}if(i!==null)for(g=t-i,t=7;t!=0&&g>0;)c=e[t],e[t--]=e[i+g-1],e[i+--g]=c;else if(t!=8)return;return e},TA=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},Gn=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)yA(e,r%256),r=mA(r/256);return zn(e,".")}else if(typeof r=="object"){for(e="",i=TA(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=pA(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},$a={},yy=uc({},$a,{" ":1,'"':1,"<":1,">":1,"`":1}),vy=uc({},yy,{"#":1,"?":1,"{":1,"}":1}),Ju=uc({},vy,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Pt=function(r,e){var t=sA(r,0);return t>32&&t<127&&!sc(e,r)?r:encodeURIComponent(r)},Ga={ftp:21,file:null,http:80,https:443,ws:80,wss:443},Vn=function(r,e){var t;return r.length==2&&Ve(gy,Ee(r,0))&&((t=Ee(r,1))==":"||!e&&t=="|")},sy=function(r){var e;return r.length>1&&Vn($n(r,0,2))&&(r.length==2||(e=Ee(r,2))==="/"||e==="\\"||e==="?"||e==="#")},RA=function(r){return r==="."||Za(r)==="%2e"},FA=function(r){return r=Za(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Ku={},oy={},Xu={},ay={},dy={},Zu={},ly={},uy={},za={},Va={},Yu={},Qu={},ec={},tc={},cy={},rc={},qr={},Qe={},my={},er={},st={},cc=function(r,e,t){var i=ot(r),n,o,a;if(e){if(o=this.parse(i),o)throw oc(o);this.searchParams=null}else{if(t!==void 0&&(n=new cc(t,!0)),o=this.parse(i,null,n),o)throw oc(o);a=cA(new uA),a.bindURL(this),this.searchParams=a}};cc.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||Ku,o=0,a="",u=!1,p=!1,f=!1,g,c,h,P;for(r=ot(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=iy(r,xA,"")),r=iy(r,CA,""),g=Nr(r);o<=g.length;){switch(c=g[o],n){case Ku:if(c&&Ve(gy,c))a+=Za(c),n=oy;else{if(e)return $u;n=Xu;continue}break;case oy:if(c&&(Ve(bA,c)||c=="+"||c=="-"||c=="."))a+=Za(c);else if(c==":"){if(e&&(i.isSpecial()!=sc(Ga,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&Ga[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=tc:i.isSpecial()&&t&&t.scheme==i.scheme?n=ay:i.isSpecial()?n=uy:g[o+1]=="/"?(n=dy,o++):(i.cannotBeABaseURL=!0,Hr(i.path,""),n=my)}else{if(e)return $u;a="",n=Xu,o=0;continue}break;case Xu:if(!t||t.cannotBeABaseURL&&c!="#")return $u;if(t.cannotBeABaseURL&&c=="#"){i.scheme=t.scheme,i.path=ze(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=st;break}n=t.scheme=="file"?tc:Zu;continue;case ay:if(c=="/"&&g[o+1]=="/")n=za,o++;else{n=Zu;continue}break;case dy:if(c=="/"){n=Va;break}else{n=Qe;continue}case Zu:if(i.scheme=t.scheme,c==Ce)i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=ze(t.path),i.query=t.query;else if(c=="/"||c=="\\"&&i.isSpecial())n=ly;else if(c=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=ze(t.path),i.query="",n=er;else if(c=="#")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=ze(t.path),i.query=t.query,i.fragment="",n=st;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=ze(t.path),i.path.length--,n=Qe;continue}break;case ly:if(i.isSpecial()&&(c=="/"||c=="\\"))n=za;else if(c=="/")n=Va;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=Qe;continue}break;case uy:if(n=za,c!="/"||Ee(a,o+1)!="/")continue;o++;break;case za:if(c!="/"&&c!="\\"){n=Va;continue}break;case Va:if(c=="@"){u&&(a="%40"+a),u=!0,h=Nr(a);for(var w=0;w<h.length;w++){var C=h[w];if(C==":"&&!f){f=!0;continue}var E=Pt(C,Ju);f?i.password+=E:i.username+=E}a=""}else if(c==Ce||c=="/"||c=="?"||c=="#"||c=="\\"&&i.isSpecial()){if(u&&a=="")return vA;o-=Nr(a).length+1,a="",n=Yu}else a+=c;break;case Yu:case Qu:if(e&&i.scheme=="file"){n=rc;continue}else if(c==":"&&!p){if(a=="")return Qt;if(P=i.parseHost(a),P)return P;if(a="",n=ec,e==Qu)return}else if(c==Ce||c=="/"||c=="?"||c=="#"||c=="\\"&&i.isSpecial()){if(i.isSpecial()&&a=="")return Qt;if(e&&a==""&&(i.includesCredentials()||i.port!==null))return;if(P=i.parseHost(a),P)return P;if(a="",n=qr,e)return;continue}else c=="["?p=!0:c=="]"&&(p=!1),a+=c;break;case ec:if(Ve(ac,c))a+=c;else if(c==Ce||c=="/"||c=="?"||c=="#"||c=="\\"&&i.isSpecial()||e){if(a!=""){var D=Xa(a,10);if(D>65535)return ny;i.port=i.isSpecial()&&D===Ga[i.scheme]?null:D,a=""}if(e)return;n=qr;continue}else return ny;break;case tc:if(i.scheme="file",c=="/"||c=="\\")n=cy;else if(t&&t.scheme=="file")if(c==Ce)i.host=t.host,i.path=ze(t.path),i.query=t.query;else if(c=="?")i.host=t.host,i.path=ze(t.path),i.query="",n=er;else if(c=="#")i.host=t.host,i.path=ze(t.path),i.query=t.query,i.fragment="",n=st;else{sy(zn(ze(g,o),""))||(i.host=t.host,i.path=ze(t.path),i.shortenPath()),n=Qe;continue}else{n=Qe;continue}break;case cy:if(c=="/"||c=="\\"){n=rc;break}t&&t.scheme=="file"&&!sy(zn(ze(g,o),""))&&(Vn(t.path[0],!0)?Hr(i.path,t.path[0]):i.host=t.host),n=Qe;continue;case rc:if(c==Ce||c=="/"||c=="\\"||c=="?"||c=="#"){if(!e&&Vn(a))n=Qe;else if(a==""){if(i.host="",e)return;n=qr}else{if(P=i.parseHost(a),P)return P;if(i.host=="localhost"&&(i.host=""),e)return;a="",n=qr}continue}else a+=c;break;case qr:if(i.isSpecial()){if(n=Qe,c!="/"&&c!="\\")continue}else if(!e&&c=="?")i.query="",n=er;else if(!e&&c=="#")i.fragment="",n=st;else if(c!=Ce&&(n=Qe,c!="/"))continue;break;case Qe:if(c==Ce||c=="/"||c=="\\"&&i.isSpecial()||!e&&(c=="?"||c=="#")){if(FA(a)?(i.shortenPath(),c!="/"&&!(c=="\\"&&i.isSpecial())&&Hr(i.path,"")):RA(a)?c!="/"&&!(c=="\\"&&i.isSpecial())&&Hr(i.path,""):(i.scheme=="file"&&!i.path.length&&Vn(a)&&(i.host&&(i.host=""),a=Ee(a,0)+":"),Hr(i.path,a)),a="",i.scheme=="file"&&(c==Ce||c=="?"||c=="#"))for(;i.path.length>1&&i.path[0]==="";)gA(i.path);c=="?"?(i.query="",n=er):c=="#"&&(i.fragment="",n=st)}else a+=Pt(c,vy);break;case my:c=="?"?(i.query="",n=er):c=="#"?(i.fragment="",n=st):c!=Ce&&(i.path[0]+=Pt(c,$a));break;case er:!e&&c=="#"?(i.fragment="",n=st):c!=Ce&&(c=="'"&&i.isSpecial()?i.query+="%27":c=="#"?i.query+="%23":i.query+=Pt(c,$a));break;case st:c!=Ce&&(i.fragment+=Pt(c,yy));break}o++}},parseHost:function(r){var e,t,i;if(Ee(r,0)=="["){if(Ee(r,r.length-1)!="]"||(e=EA($n(r,1,-1)),!e))return Qt;this.host=e}else if(this.isSpecial()){if(r=oA(r),Ve(wA,r)||(e=AA(r),e===null))return Qt;this.host=e}else{if(Ve(IA,r))return Qt;for(e="",t=Nr(r),i=0;i<t.length;i++)e+=Pt(t[i],$a);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return sc(Ga,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!Vn(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,u=r.query,p=r.fragment,f=e+":";return n!==null?(f+="//",r.includesCredentials()&&(f+=t+(i?":"+i:"")+"@"),f+=Gn(n),o!==null&&(f+=":"+o)):e=="file"&&(f+="//"),f+=r.cannotBeABaseURL?a[0]:a.length?"/"+zn(a,"/"):"",u!==null&&(f+="?"+u),p!==null&&(f+="#"+p),f},setHref:function(r){var e=this.parse(r);if(e)throw oc(e);this.searchParams.update()},getOrigin:function(){var r=this.scheme,e=this.port;if(r=="blob")try{return new jr(r.path[0]).origin}catch{return"null"}return r=="file"||!this.isSpecial()?"null":r+"://"+Gn(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(ot(r)+":",Ku)},getUsername:function(){return this.username},setUsername:function(r){var e=Nr(ot(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=Pt(e[t],Ju)}},getPassword:function(){return this.password},setPassword:function(r){var e=Nr(ot(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=Pt(e[t],Ju)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?Gn(r):Gn(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,Yu)},getHostname:function(){var r=this.host;return r===null?"":Gn(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,Qu)},getPort:function(){var r=this.port;return r===null?"":ot(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=ot(r),r==""?this.port=null:this.parse(r,ec))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+zn(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,qr))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=ot(r),r==""?this.query=null:(Ee(r,0)=="?"&&(r=$n(r,1)),this.query="",this.parse(r,er)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var r=this.fragment;return r?"#"+r:""},setHash:function(r){if(r=ot(r),r==""){this.fragment=null;return}Ee(r,0)=="#"&&(r=$n(r,1)),this.fragment="",this.parse(r,st)},update:function(){this.query=this.searchParams.serialize()||null}};var jr=function(e){var t=nA(this,ee),i=dA(arguments.length,1)>1?arguments[1]:void 0,n=lA(t,new cc(e,!1,i));dc||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},ee=jr.prototype,Ae=function(r,e){return{get:function(){return Ka(this)[r]()},set:e&&function(t){return Ka(this)[e](t)},configurable:!0,enumerable:!0}};dc&&(xe(ee,"href",Ae("serialize","setHref")),xe(ee,"origin",Ae("getOrigin")),xe(ee,"protocol",Ae("getProtocol","setProtocol")),xe(ee,"username",Ae("getUsername","setUsername")),xe(ee,"password",Ae("getPassword","setPassword")),xe(ee,"host",Ae("getHost","setHost")),xe(ee,"hostname",Ae("getHostname","setHostname")),xe(ee,"port",Ae("getPort","setPort")),xe(ee,"pathname",Ae("getPathname","setPathname")),xe(ee,"search",Ae("getSearch","setSearch")),xe(ee,"searchParams",Ae("getSearchParams")),xe(ee,"hash",Ae("getHash","setHash")));Ja(ee,"toJSON",function(){return Ka(this).serialize()},{enumerable:!0});Ja(ee,"toString",function(){return Ka(this).serialize()},{enumerable:!0});Wn&&(ic=Wn.createObjectURL,nc=Wn.revokeObjectURL,ic&&Ja(jr,"createObjectURL",ty(ic,Wn)),nc&&Ja(jr,"revokeObjectURL",ty(nc,Wn)));var ic,nc;aA(jr,"URL");rA({global:!0,constructor:!0,forced:!iA,sham:!dc},{URL:jr})});var Py=b(()=>{by()});var ky=b(()=>{"use strict";var BA=On(),OA=je();BA({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return OA(URL.prototype.toString,this)}})});var Sy=b(()=>{Vu()});var Iy=b((SU,wy)=>{var UA=me();wy.exports=UA});var Cy=b((wU,xy)=>{Py();ky();Sy();var MA=Iy();xy.exports=MA.URL});var hc=b(ed=>{"use strict";ed.byteLength=QA;ed.toByteArray=tE;ed.fromByteArray=nE;var et=[],Oe=[],YA=typeof Uint8Array<"u"?Uint8Array:Array,gc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(sr=0,Fy=gc.length;sr<Fy;++sr)et[sr]=gc[sr],Oe[gc.charCodeAt(sr)]=sr;var sr,Fy;Oe["-".charCodeAt(0)]=62;Oe["_".charCodeAt(0)]=63;function By(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 QA(r){var e=By(r),t=e[0],i=e[1];return(t+i)*3/4-i}function eE(r,e,t){return(e+t)*3/4-t}function tE(r){var e,t=By(r),i=t[0],n=t[1],o=new YA(eE(r,i,n)),a=0,u=n>0?i-4:i,p;for(p=0;p<u;p+=4)e=Oe[r.charCodeAt(p)]<<18|Oe[r.charCodeAt(p+1)]<<12|Oe[r.charCodeAt(p+2)]<<6|Oe[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=Oe[r.charCodeAt(p)]<<2|Oe[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=Oe[r.charCodeAt(p)]<<10|Oe[r.charCodeAt(p+1)]<<4|Oe[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function rE(r){return et[r>>18&63]+et[r>>12&63]+et[r>>6&63]+et[r&63]}function iE(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(rE(i));return n.join("")}function nE(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,u=t-i;a<u;a+=o)n.push(iE(r,a,a+o>u?u:a+o));return i===1?(e=r[t-1],n.push(et[e>>2]+et[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(et[e>>10]+et[e>>4&63]+et[e<<2&63]+"=")),n.join("")}});var Oy=b(yc=>{yc.read=function(r,e,t,i,n){var o,a,u=n*8-i-1,p=(1<<u)-1,f=p>>1,g=-7,c=t?n-1:0,h=t?-1:1,P=r[e+c];for(c+=h,o=P&(1<<-g)-1,P>>=-g,g+=u;g>0;o=o*256+r[e+c],c+=h,g-=8);for(a=o&(1<<-g)-1,o>>=-g,g+=i;g>0;a=a*256+r[e+c],c+=h,g-=8);if(o===0)o=1-f;else{if(o===p)return a?NaN:(P?-1:1)*(1/0);a=a+Math.pow(2,i),o=o-f}return(P?-1:1)*a*Math.pow(2,o-i)};yc.write=function(r,e,t,i,n,o){var a,u,p,f=o*8-n-1,g=(1<<f)-1,c=g>>1,h=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,P=i?0:o-1,w=i?1:-1,C=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=g):(a=Math.floor(Math.log(e)/Math.LN2),e*(p=Math.pow(2,-a))<1&&(a--,p*=2),a+c>=1?e+=h/p:e+=h*Math.pow(2,1-c),e*p>=2&&(a++,p/=2),a+c>=g?(u=0,a=g):a+c>=1?(u=(e*p-1)*Math.pow(2,n),a=a+c):(u=e*Math.pow(2,c-1)*Math.pow(2,n),a=0));n>=8;r[t+P]=u&255,P+=w,u/=256,n-=8);for(a=a<<n|u,f+=n;f>0;r[t+P]=a&255,P+=w,a/=256,f-=8);r[t+P-w]|=C*128}});var Xy=b(Jr=>{"use strict";var vc=hc(),Vr=Oy(),Uy=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Jr.Buffer=y;Jr.SlowBuffer=uE;Jr.INSPECT_MAX_BYTES=50;var td=2147483647;Jr.kMaxLength=td;y.TYPED_ARRAY_SUPPORT=sE();!y.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function sE(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(y.prototype,"parent",{enumerable:!0,get:function(){if(y.isBuffer(this))return this.buffer}});Object.defineProperty(y.prototype,"offset",{enumerable:!0,get:function(){if(y.isBuffer(this))return this.byteOffset}});function dt(r){if(r>td)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,y.prototype),e}function y(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Sc(r)}return _y(r,e,t)}y.poolSize=8192;function _y(r,e,t){if(typeof r=="string")return aE(r,e);if(ArrayBuffer.isView(r))return dE(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(tt(r,ArrayBuffer)||r&&tt(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(tt(r,SharedArrayBuffer)||r&&tt(r.buffer,SharedArrayBuffer)))return Pc(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return y.from(i,e,t);let n=lE(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return y.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}y.from=function(r,e,t){return _y(r,e,t)};Object.setPrototypeOf(y.prototype,Uint8Array.prototype);Object.setPrototypeOf(y,Uint8Array);function Ny(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function oE(r,e,t){return Ny(r),r<=0?dt(r):e!==void 0?typeof t=="string"?dt(r).fill(e,t):dt(r).fill(e):dt(r)}y.alloc=function(r,e,t){return oE(r,e,t)};function Sc(r){return Ny(r),dt(r<0?0:wc(r)|0)}y.allocUnsafe=function(r){return Sc(r)};y.allocUnsafeSlow=function(r){return Sc(r)};function aE(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!y.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=qy(r,e)|0,i=dt(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function bc(r){let e=r.length<0?0:wc(r.length)|0,t=dt(e);for(let i=0;i<e;i+=1)t[i]=r[i]&255;return t}function dE(r){if(tt(r,Uint8Array)){let e=new Uint8Array(r);return Pc(e.buffer,e.byteOffset,e.byteLength)}return bc(r)}function Pc(r,e,t){if(e<0||r.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let i;return e===void 0&&t===void 0?i=new Uint8Array(r):t===void 0?i=new Uint8Array(r,e):i=new Uint8Array(r,e,t),Object.setPrototypeOf(i,y.prototype),i}function lE(r){if(y.isBuffer(r)){let e=wc(r.length)|0,t=dt(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||xc(r.length)?dt(0):bc(r);if(r.type==="Buffer"&&Array.isArray(r.data))return bc(r.data)}function wc(r){if(r>=td)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+td.toString(16)+" bytes");return r|0}function uE(r){return+r!=r&&(r=0),y.alloc(+r)}y.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==y.prototype};y.compare=function(e,t){if(tt(e,Uint8Array)&&(e=y.from(e,e.offset,e.byteLength)),tt(t,Uint8Array)&&(t=y.from(t,t.offset,t.byteLength)),!y.isBuffer(e)||!y.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,n=t.length;for(let o=0,a=Math.min(i,n);o<a;++o)if(e[o]!==t[o]){i=e[o],n=t[o];break}return i<n?-1:n<i?1:0};y.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};y.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return y.alloc(0);let i;if(t===void 0)for(t=0,i=0;i<e.length;++i)t+=e[i].length;let n=y.allocUnsafe(t),o=0;for(i=0;i<e.length;++i){let a=e[i];if(tt(a,Uint8Array))o+a.length>n.length?(y.isBuffer(a)||(a=y.from(a)),a.copy(n,o)):Uint8Array.prototype.set.call(n,a,o);else if(y.isBuffer(a))a.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=a.length}return n};function qy(r,e){if(y.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||tt(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return kc(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Ky(r).length;default:if(n)return i?-1:kc(r).length;e=(""+e).toLowerCase(),n=!0}}y.byteLength=qy;function cE(r,e,t){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return kE(this,e,t);case"utf8":case"utf-8":return jy(this,e,t);case"ascii":return bE(this,e,t);case"latin1":case"binary":return PE(this,e,t);case"base64":return yE(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return SE(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}y.prototype._isBuffer=!0;function or(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}y.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)or(this,t,t+1);return this};y.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)or(this,t,t+3),or(this,t+1,t+2);return this};y.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)or(this,t,t+7),or(this,t+1,t+6),or(this,t+2,t+5),or(this,t+3,t+4);return this};y.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?jy(this,0,e):cE.apply(this,arguments)};y.prototype.toLocaleString=y.prototype.toString;y.prototype.equals=function(e){if(!y.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:y.compare(this,e)===0};y.prototype.inspect=function(){let e="",t=Jr.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};Uy&&(y.prototype[Uy]=y.prototype.inspect);y.prototype.compare=function(e,t,i,n,o){if(tt(e,Uint8Array)&&(e=y.from(e,e.offset,e.byteLength)),!y.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),t<0||i>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=i)return 0;if(n>=o)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,o>>>=0,this===e)return 0;let a=o-n,u=i-t,p=Math.min(a,u),f=this.slice(n,o),g=e.slice(t,i);for(let c=0;c<p;++c)if(f[c]!==g[c]){a=f[c],u=g[c];break}return a<u?-1:u<a?1:0};function Hy(r,e,t,i,n){if(r.length===0)return-1;if(typeof t=="string"?(i=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,xc(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=y.from(e,i)),y.isBuffer(e))return e.length===0?-1:My(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):My(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function My(r,e,t,i,n){let o=1,a=r.length,u=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;o=2,a/=2,u/=2,t/=2}function p(g,c){return o===1?g[c]:g.readUInt16BE(c*o)}let f;if(n){let g=-1;for(f=t;f<a;f++)if(p(r,f)===p(e,g===-1?0:f-g)){if(g===-1&&(g=f),f-g+1===u)return g*o}else g!==-1&&(f-=f-g),g=-1}else for(t+u>a&&(t=a-u),f=t;f>=0;f--){let g=!0;for(let c=0;c<u;c++)if(p(r,f+c)!==p(e,c)){g=!1;break}if(g)return f}return-1}y.prototype.includes=function(e,t,i){return this.indexOf(e,t,i)!==-1};y.prototype.indexOf=function(e,t,i){return Hy(this,e,t,i,!0)};y.prototype.lastIndexOf=function(e,t,i){return Hy(this,e,t,i,!1)};function mE(r,e,t,i){t=Number(t)||0;let n=r.length-t;i?(i=Number(i),i>n&&(i=n)):i=n;let o=e.length;i>o/2&&(i=o/2);let a;for(a=0;a<i;++a){let u=parseInt(e.substr(a*2,2),16);if(xc(u))return a;r[t+a]=u}return a}function pE(r,e,t,i){return rd(kc(e,r.length-t),r,t,i)}function fE(r,e,t,i){return rd(CE(e),r,t,i)}function gE(r,e,t,i){return rd(Ky(e),r,t,i)}function hE(r,e,t,i){return rd(AE(e,r.length-t),r,t,i)}y.prototype.write=function(e,t,i,n){if(t===void 0)n="utf8",i=this.length,t=0;else if(i===void 0&&typeof t=="string")n=t,i=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((i===void 0||i>o)&&(i=o),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return mE(this,e,t,i);case"utf8":case"utf-8":return pE(this,e,t,i);case"ascii":case"latin1":case"binary":return fE(this,e,t,i);case"base64":return gE(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return hE(this,e,t,i);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}};y.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function yE(r,e,t){return e===0&&t===r.length?vc.fromByteArray(r):vc.fromByteArray(r.slice(e,t))}function jy(r,e,t){t=Math.min(r.length,t);let i=[],n=e;for(;n<t;){let o=r[n],a=null,u=o>239?4:o>223?3:o>191?2:1;if(n+u<=t){let p,f,g,c;switch(u){case 1:o<128&&(a=o);break;case 2:p=r[n+1],(p&192)===128&&(c=(o&31)<<6|p&63,c>127&&(a=c));break;case 3:p=r[n+1],f=r[n+2],(p&192)===128&&(f&192)===128&&(c=(o&15)<<12|(p&63)<<6|f&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:p=r[n+1],f=r[n+2],g=r[n+3],(p&192)===128&&(f&192)===128&&(g&192)===128&&(c=(o&15)<<18|(p&63)<<12|(f&63)<<6|g&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,u=1):a>65535&&(a-=65536,i.push(a>>>10&1023|55296),a=56320|a&1023),i.push(a),n+=u}return vE(i)}var Ly=4096;function vE(r){let e=r.length;if(e<=Ly)return String.fromCharCode.apply(String,r);let t="",i=0;for(;i<e;)t+=String.fromCharCode.apply(String,r.slice(i,i+=Ly));return t}function bE(r,e,t){let i="";t=Math.min(r.length,t);for(let n=e;n<t;++n)i+=String.fromCharCode(r[n]&127);return i}function PE(r,e,t){let i="";t=Math.min(r.length,t);for(let n=e;n<t;++n)i+=String.fromCharCode(r[n]);return i}function kE(r,e,t){let i=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>i)&&(t=i);let n="";for(let o=e;o<t;++o)n+=EE[r[o]];return n}function SE(r,e,t){let i=r.slice(e,t),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}y.prototype.slice=function(e,t){let i=this.length;e=~~e,t=t===void 0?i:~~t,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),t<e&&(t=e);let n=this.subarray(e,t);return Object.setPrototypeOf(n,y.prototype),n};function X(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}y.prototype.readUintLE=y.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||X(e,t,this.length);let n=this[e],o=1,a=0;for(;++a<t&&(o*=256);)n+=this[e+a]*o;return n};y.prototype.readUintBE=y.prototype.readUIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||X(e,t,this.length);let n=this[e+--t],o=1;for(;t>0&&(o*=256);)n+=this[e+--t]*o;return n};y.prototype.readUint8=y.prototype.readUInt8=function(e,t){return e=e>>>0,t||X(e,1,this.length),this[e]};y.prototype.readUint16LE=y.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||X(e,2,this.length),this[e]|this[e+1]<<8};y.prototype.readUint16BE=y.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||X(e,2,this.length),this[e]<<8|this[e+1]};y.prototype.readUint32LE=y.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||X(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};y.prototype.readUint32BE=y.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||X(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};y.prototype.readBigUInt64LE=wt(function(e){e=e>>>0,$r(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&Jn(e,this.length-8);let n=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))});y.prototype.readBigUInt64BE=wt(function(e){e=e>>>0,$r(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&Jn(e,this.length-8);let n=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(o)});y.prototype.readIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||X(e,t,this.length);let n=this[e],o=1,a=0;for(;++a<t&&(o*=256);)n+=this[e+a]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n};y.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||X(e,t,this.length);let n=t,o=1,a=this[e+--n];for(;n>0&&(o*=256);)a+=this[e+--n]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*t)),a};y.prototype.readInt8=function(e,t){return e=e>>>0,t||X(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};y.prototype.readInt16LE=function(e,t){e=e>>>0,t||X(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};y.prototype.readInt16BE=function(e,t){e=e>>>0,t||X(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};y.prototype.readInt32LE=function(e,t){return e=e>>>0,t||X(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};y.prototype.readInt32BE=function(e,t){return e=e>>>0,t||X(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};y.prototype.readBigInt64LE=wt(function(e){e=e>>>0,$r(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&Jn(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});y.prototype.readBigInt64BE=wt(function(e){e=e>>>0,$r(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&Jn(e,this.length-8);let n=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i)});y.prototype.readFloatLE=function(e,t){return e=e>>>0,t||X(e,4,this.length),Vr.read(this,e,!0,23,4)};y.prototype.readFloatBE=function(e,t){return e=e>>>0,t||X(e,4,this.length),Vr.read(this,e,!1,23,4)};y.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||X(e,8,this.length),Vr.read(this,e,!0,52,8)};y.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||X(e,8,this.length),Vr.read(this,e,!1,52,8)};function ae(r,e,t,i,n,o){if(!y.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(t+i>r.length)throw new RangeError("Index out of range")}y.prototype.writeUintLE=y.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){let u=Math.pow(2,8*i)-1;ae(this,e,t,i,u,0)}let o=1,a=0;for(this[t]=e&255;++a<i&&(o*=256);)this[t+a]=e/o&255;return t+i};y.prototype.writeUintBE=y.prototype.writeUIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){let u=Math.pow(2,8*i)-1;ae(this,e,t,i,u,0)}let o=i-1,a=1;for(this[t+o]=e&255;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+i};y.prototype.writeUint8=y.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,1,255,0),this[t]=e&255,t+1};y.prototype.writeUint16LE=y.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};y.prototype.writeUint16BE=y.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};y.prototype.writeUint32LE=y.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};y.prototype.writeUint32BE=y.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function Wy(r,e,t,i,n){Jy(e,i,n,r,t,7);let o=Number(e&BigInt(4294967295));r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=a,a=a>>8,r[t++]=a,a=a>>8,r[t++]=a,a=a>>8,r[t++]=a,t}function Gy(r,e,t,i,n){Jy(e,i,n,r,t,7);let o=Number(e&BigInt(4294967295));r[t+7]=o,o=o>>8,r[t+6]=o,o=o>>8,r[t+5]=o,o=o>>8,r[t+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=a,a=a>>8,r[t+2]=a,a=a>>8,r[t+1]=a,a=a>>8,r[t]=a,t+8}y.prototype.writeBigUInt64LE=wt(function(e,t=0){return Wy(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});y.prototype.writeBigUInt64BE=wt(function(e,t=0){return Gy(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});y.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let p=Math.pow(2,8*i-1);ae(this,e,t,i,p-1,-p)}let o=0,a=1,u=0;for(this[t]=e&255;++o<i&&(a*=256);)e<0&&u===0&&this[t+o-1]!==0&&(u=1),this[t+o]=(e/a>>0)-u&255;return t+i};y.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let p=Math.pow(2,8*i-1);ae(this,e,t,i,p-1,-p)}let o=i-1,a=1,u=0;for(this[t+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[t+o+1]!==0&&(u=1),this[t+o]=(e/a>>0)-u&255;return t+i};y.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};y.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};y.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};y.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};y.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||ae(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};y.prototype.writeBigInt64LE=wt(function(e,t=0){return Wy(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});y.prototype.writeBigInt64BE=wt(function(e,t=0){return Gy(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function zy(r,e,t,i,n,o){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Vy(r,e,t,i,n){return e=+e,t=t>>>0,n||zy(r,e,t,4,34028234663852886e22,-34028234663852886e22),Vr.write(r,e,t,i,23,4),t+4}y.prototype.writeFloatLE=function(e,t,i){return Vy(this,e,t,!0,i)};y.prototype.writeFloatBE=function(e,t,i){return Vy(this,e,t,!1,i)};function $y(r,e,t,i,n){return e=+e,t=t>>>0,n||zy(r,e,t,8,17976931348623157e292,-17976931348623157e292),Vr.write(r,e,t,i,52,8),t+8}y.prototype.writeDoubleLE=function(e,t,i){return $y(this,e,t,!0,i)};y.prototype.writeDoubleBE=function(e,t,i){return $y(this,e,t,!1,i)};y.prototype.copy=function(e,t,i,n){if(!y.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-i&&(n=e.length-t+i);let o=n-i;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,i,n):Uint8Array.prototype.set.call(e,this.subarray(i,n),t),o};y.prototype.fill=function(e,t,i,n){if(typeof e=="string"){if(typeof t=="string"?(n=t,t=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!y.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){let a=e.charCodeAt(0);(n==="utf8"&&a<128||n==="latin1")&&(e=a)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;t=t>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let o;if(typeof e=="number")for(o=t;o<i;++o)this[o]=e;else{let a=y.isBuffer(e)?e:y.from(e,n),u=a.length;if(u===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<i-t;++o)this[o+t]=a[o%u]}return this};var zr={};function Ic(r,e,t){zr[r]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}Ic("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Ic("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError);Ic("ERR_OUT_OF_RANGE",function(r,e,t){let i=`The value of "${r}" is out of range.`,n=t;return Number.isInteger(t)&&Math.abs(t)>2**32?n=Dy(String(t)):typeof t=="bigint"&&(n=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(n=Dy(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function Dy(r){let e="",t=r.length,i=r[0]==="-"?1:0;for(;t>=i+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function wE(r,e,t){$r(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&Jn(e,r.length-(t+1))}function Jy(r,e,t,i,n,o){if(r>t||r<e){let a=typeof e=="bigint"?"n":"",u;throw o>3?e===0||e===BigInt(0)?u=`>= 0${a} and < 2${a} ** ${(o+1)*8}${a}`:u=`>= -(2${a} ** ${(o+1)*8-1}${a}) and < 2 ** ${(o+1)*8-1}${a}`:u=`>= ${e}${a} and <= ${t}${a}`,new zr.ERR_OUT_OF_RANGE("value",u,r)}wE(i,n,o)}function $r(r,e){if(typeof r!="number")throw new zr.ERR_INVALID_ARG_TYPE(e,"number",r)}function Jn(r,e,t){throw Math.floor(r)!==r?($r(r,t),new zr.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new zr.ERR_BUFFER_OUT_OF_BOUNDS:new zr.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var IE=/[^+/0-9A-Za-z-_]/g;function xE(r){if(r=r.split("=")[0],r=r.trim().replace(IE,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function kc(r,e){e=e||1/0;let t,i=r.length,n=null,o=[];for(let a=0;a<i;++a){if(t=r.charCodeAt(a),t>55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&o.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;o.push(t)}else if(t<2048){if((e-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function CE(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function AE(r,e){let t,i,n,o=[];for(let a=0;a<r.length&&!((e-=2)<0);++a)t=r.charCodeAt(a),i=t>>8,n=t%256,o.push(n),o.push(i);return o}function Ky(r){return vc.toByteArray(xE(r))}function rd(r,e,t,i){let n;for(n=0;n<i&&!(n+t>=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function tt(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function xc(r){return r!==r}var EE=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let n=0;n<16;++n)e[i+n]=r[t]+r[n]}return e}();function wt(r){return typeof BigInt>"u"?TE:r}function TE(){throw new Error("BigInt not supported")}});var Kc=b((a_,Zv)=>{var TT=Object.prototype.toString;Zv.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 UT(e)?"generatorfunction":"function";if(RT(e))return"array";if(DT(e))return"buffer";if(LT(e))return"arguments";if(BT(e))return"date";if(FT(e))return"error";if(OT(e))return"regexp";switch(Xv(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(MT(e))return"generator";switch(t=TT.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 Xv(r){return typeof r.constructor=="function"?r.constructor.name:null}function RT(r){return Array.isArray?Array.isArray(r):r instanceof Array}function FT(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function BT(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function OT(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function UT(r,e){return Xv(r)==="GeneratorFunction"}function MT(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function LT(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 DT(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var eb=b((d_,Qv)=>{"use strict";var Yv=Symbol.prototype.valueOf,_T=Kc();function NT(r,e){switch(_T(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 WT(r);case"symbol":return GT(r);case"arraybuffer":return HT(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return jT(r);case"regexp":return qT(r);case"error":return Object.create(r);default:return r}}function qT(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 HT(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function jT(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function WT(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function GT(r){return Yv?Object(Yv.call(r)):{}}Qv.exports=NT});var rb=b((l_,tb)=>{"use strict";tb.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var sb=b((u_,nb)=>{"use strict";var zT=rb();function ib(r){return zT(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}nb.exports=function(e){var t,i;return!(ib(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,ib(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var ab=b((c_,ob)=>{"use strict";var VT=eb(),$T=Kc(),JT=sb();function Xc(r,e){switch($T(r)){case"object":return KT(r,e);case"array":return XT(r,e);default:return VT(r)}}function KT(r,e){if(typeof e=="function")return e(r);if(e||JT(r)){let t=new r.constructor;for(let i in r)t[i]=Xc(r[i],e);return t}return r}function XT(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=Xc(r[i],e);return t}ob.exports=Xc});var jb=b((ds,hi)=>{var ZT=200,am="__lodash_hash_undefined__",Rd=1,bb=2,Pb=9007199254740991,wd="[object Arguments]",em="[object Array]",YT="[object AsyncFunction]",kb="[object Boolean]",Sb="[object Date]",wb="[object Error]",Ib="[object Function]",QT="[object GeneratorFunction]",Id="[object Map]",xb="[object Number]",eR="[object Null]",gi="[object Object]",db="[object Promise]",tR="[object Proxy]",Cb="[object RegExp]",xd="[object Set]",Ab="[object String]",rR="[object Symbol]",iR="[object Undefined]",tm="[object WeakMap]",Eb="[object ArrayBuffer]",Cd="[object DataView]",nR="[object Float32Array]",sR="[object Float64Array]",oR="[object Int8Array]",aR="[object Int16Array]",dR="[object Int32Array]",lR="[object Uint8Array]",uR="[object Uint8ClampedArray]",cR="[object Uint16Array]",mR="[object Uint32Array]",pR=/[\\^$.*+?()[\]{}|]/g,fR=/^\[object .+?Constructor\]$/,gR=/^(?:0|[1-9]\d*)$/,H={};H[nR]=H[sR]=H[oR]=H[aR]=H[dR]=H[lR]=H[uR]=H[cR]=H[mR]=!0;H[wd]=H[em]=H[Eb]=H[kb]=H[Cd]=H[Sb]=H[wb]=H[Ib]=H[Id]=H[xb]=H[gi]=H[Cb]=H[xd]=H[Ab]=H[tm]=!1;var Tb=typeof global=="object"&&global&&global.Object===Object&&global,hR=typeof self=="object"&&self&&self.Object===Object&&self,ct=Tb||hR||Function("return this")(),Rb=typeof ds=="object"&&ds&&!ds.nodeType&&ds,lb=Rb&&typeof hi=="object"&&hi&&!hi.nodeType&&hi,Fb=lb&&lb.exports===Rb,Zc=Fb&&Tb.process,ub=function(){try{return Zc&&Zc.binding&&Zc.binding("util")}catch{}}(),cb=ub&&ub.isTypedArray;function yR(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 vR(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function bR(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 PR(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function kR(r){return function(e){return r(e)}}function SR(r,e){return r.has(e)}function wR(r,e){return r?.[e]}function IR(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function xR(r,e){return function(t){return r(e(t))}}function CR(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var AR=Array.prototype,ER=Function.prototype,Fd=Object.prototype,Yc=ct["__core-js_shared__"],Bb=ER.toString,rt=Fd.hasOwnProperty,mb=function(){var r=/[^.]+$/.exec(Yc&&Yc.keys&&Yc.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Ob=Fd.toString,TR=RegExp("^"+Bb.call(rt).replace(pR,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pb=Fb?ct.Buffer:void 0,Ad=ct.Symbol,fb=ct.Uint8Array,Ub=Fd.propertyIsEnumerable,RR=AR.splice,cr=Ad?Ad.toStringTag:void 0,gb=Object.getOwnPropertySymbols,FR=pb?pb.isBuffer:void 0,BR=xR(Object.keys,Object),rm=yi(ct,"DataView"),ls=yi(ct,"Map"),im=yi(ct,"Promise"),nm=yi(ct,"Set"),sm=yi(ct,"WeakMap"),us=yi(Object,"create"),OR=fr(rm),UR=fr(ls),MR=fr(im),LR=fr(nm),DR=fr(sm),hb=Ad?Ad.prototype:void 0,Qc=hb?hb.valueOf:void 0;function mr(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 _R(){this.__data__=us?us(null):{},this.size=0}function NR(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function qR(r){var e=this.__data__;if(us){var t=e[r];return t===am?void 0:t}return rt.call(e,r)?e[r]:void 0}function HR(r){var e=this.__data__;return us?e[r]!==void 0:rt.call(e,r)}function jR(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=us&&e===void 0?am:e,this}mr.prototype.clear=_R;mr.prototype.delete=NR;mr.prototype.get=qR;mr.prototype.has=HR;mr.prototype.set=jR;function mt(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 WR(){this.__data__=[],this.size=0}function GR(r){var e=this.__data__,t=Bd(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():RR.call(e,t,1),--this.size,!0}function zR(r){var e=this.__data__,t=Bd(e,r);return t<0?void 0:e[t][1]}function VR(r){return Bd(this.__data__,r)>-1}function $R(r,e){var t=this.__data__,i=Bd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}mt.prototype.clear=WR;mt.prototype.delete=GR;mt.prototype.get=zR;mt.prototype.has=VR;mt.prototype.set=$R;function pr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function JR(){this.size=0,this.__data__={hash:new mr,map:new(ls||mt),string:new mr}}function KR(r){var e=Od(this,r).delete(r);return this.size-=e?1:0,e}function XR(r){return Od(this,r).get(r)}function ZR(r){return Od(this,r).has(r)}function YR(r,e){var t=Od(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}pr.prototype.clear=JR;pr.prototype.delete=KR;pr.prototype.get=XR;pr.prototype.has=ZR;pr.prototype.set=YR;function Ed(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new pr;++e<t;)this.add(r[e])}function QR(r){return this.__data__.set(r,am),this}function eF(r){return this.__data__.has(r)}Ed.prototype.add=Ed.prototype.push=QR;Ed.prototype.has=eF;function Ft(r){var e=this.__data__=new mt(r);this.size=e.size}function tF(){this.__data__=new mt,this.size=0}function rF(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function iF(r){return this.__data__.get(r)}function nF(r){return this.__data__.has(r)}function sF(r,e){var t=this.__data__;if(t instanceof mt){var i=t.__data__;if(!ls||i.length<ZT-1)return i.push([r,e]),this.size=++t.size,this;t=this.__data__=new pr(i)}return t.set(r,e),this.size=t.size,this}Ft.prototype.clear=tF;Ft.prototype.delete=rF;Ft.prototype.get=iF;Ft.prototype.has=nF;Ft.prototype.set=sF;function oF(r,e){var t=Td(r),i=!t&&kF(r),n=!t&&!i&&om(r),o=!t&&!i&&!n&&Hb(r),a=t||i||n||o,u=a?PR(r.length,String):[],p=u.length;for(var f in r)(e||rt.call(r,f))&&!(a&&(f=="length"||n&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||hF(f,p)))&&u.push(f);return u}function Bd(r,e){for(var t=r.length;t--;)if(Db(r[t][0],e))return t;return-1}function aF(r,e,t){var i=e(r);return Td(r)?i:vR(i,t(r))}function ms(r){return r==null?r===void 0?iR:eR:cr&&cr in Object(r)?fF(r):PF(r)}function yb(r){return cs(r)&&ms(r)==wd}function Mb(r,e,t,i,n){return r===e?!0:r==null||e==null||!cs(r)&&!cs(e)?r!==r&&e!==e:dF(r,e,t,i,Mb,n)}function dF(r,e,t,i,n,o){var a=Td(r),u=Td(e),p=a?em:Rt(r),f=u?em:Rt(e);p=p==wd?gi:p,f=f==wd?gi:f;var g=p==gi,c=f==gi,h=p==f;if(h&&om(r)){if(!om(e))return!1;a=!0,g=!1}if(h&&!g)return o||(o=new Ft),a||Hb(r)?Lb(r,e,t,i,n,o):mF(r,e,p,t,i,n,o);if(!(t&Rd)){var P=g&&rt.call(r,"__wrapped__"),w=c&&rt.call(e,"__wrapped__");if(P||w){var C=P?r.value():r,E=w?e.value():e;return o||(o=new Ft),n(C,E,t,i,o)}}return h?(o||(o=new Ft),pF(r,e,t,i,n,o)):!1}function lF(r){if(!qb(r)||vF(r))return!1;var e=_b(r)?TR:fR;return e.test(fr(r))}function uF(r){return cs(r)&&Nb(r.length)&&!!H[ms(r)]}function cF(r){if(!bF(r))return BR(r);var e=[];for(var t in Object(r))rt.call(r,t)&&t!="constructor"&&e.push(t);return e}function Lb(r,e,t,i,n,o){var a=t&Rd,u=r.length,p=e.length;if(u!=p&&!(a&&p>u))return!1;var f=o.get(r);if(f&&o.get(e))return f==e;var g=-1,c=!0,h=t&bb?new Ed:void 0;for(o.set(r,e),o.set(e,r);++g<u;){var P=r[g],w=e[g];if(i)var C=a?i(w,P,g,e,r,o):i(P,w,g,r,e,o);if(C!==void 0){if(C)continue;c=!1;break}if(h){if(!bR(e,function(E,D){if(!SR(h,D)&&(P===E||n(P,E,t,i,o)))return h.push(D)})){c=!1;break}}else if(!(P===w||n(P,w,t,i,o))){c=!1;break}}return o.delete(r),o.delete(e),c}function mF(r,e,t,i,n,o,a){switch(t){case Cd:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case Eb:return!(r.byteLength!=e.byteLength||!o(new fb(r),new fb(e)));case kb:case Sb:case xb:return Db(+r,+e);case wb:return r.name==e.name&&r.message==e.message;case Cb:case Ab:return r==e+"";case Id:var u=IR;case xd:var p=i&Rd;if(u||(u=CR),r.size!=e.size&&!p)return!1;var f=a.get(r);if(f)return f==e;i|=bb,a.set(r,e);var g=Lb(u(r),u(e),i,n,o,a);return a.delete(r),g;case rR:if(Qc)return Qc.call(r)==Qc.call(e)}return!1}function pF(r,e,t,i,n,o){var a=t&Rd,u=vb(r),p=u.length,f=vb(e),g=f.length;if(p!=g&&!a)return!1;for(var c=p;c--;){var h=u[c];if(!(a?h in e:rt.call(e,h)))return!1}var P=o.get(r);if(P&&o.get(e))return P==e;var w=!0;o.set(r,e),o.set(e,r);for(var C=a;++c<p;){h=u[c];var E=r[h],D=e[h];if(i)var Ke=a?i(D,E,h,e,r,o):i(E,D,h,r,e,o);if(!(Ke===void 0?E===D||n(E,D,t,i,o):Ke)){w=!1;break}C||(C=h=="constructor")}if(w&&!C){var xn=r.constructor,da=e.constructor;xn!=da&&"constructor"in r&&"constructor"in e&&!(typeof xn=="function"&&xn instanceof xn&&typeof da=="function"&&da instanceof da)&&(w=!1)}return o.delete(r),o.delete(e),w}function vb(r){return aF(r,IF,gF)}function Od(r,e){var t=r.__data__;return yF(e)?t[typeof e=="string"?"string":"hash"]:t.map}function yi(r,e){var t=wR(r,e);return lF(t)?t:void 0}function fF(r){var e=rt.call(r,cr),t=r[cr];try{r[cr]=void 0;var i=!0}catch{}var n=Ob.call(r);return i&&(e?r[cr]=t:delete r[cr]),n}var gF=gb?function(r){return r==null?[]:(r=Object(r),yR(gb(r),function(e){return Ub.call(r,e)}))}:xF,Rt=ms;(rm&&Rt(new rm(new ArrayBuffer(1)))!=Cd||ls&&Rt(new ls)!=Id||im&&Rt(im.resolve())!=db||nm&&Rt(new nm)!=xd||sm&&Rt(new sm)!=tm)&&(Rt=function(r){var e=ms(r),t=e==gi?r.constructor:void 0,i=t?fr(t):"";if(i)switch(i){case OR:return Cd;case UR:return Id;case MR:return db;case LR:return xd;case DR:return tm}return e});function hF(r,e){return e=e??Pb,!!e&&(typeof r=="number"||gR.test(r))&&r>-1&&r%1==0&&r<e}function yF(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function vF(r){return!!mb&&mb in r}function bF(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||Fd;return r===t}function PF(r){return Ob.call(r)}function fr(r){if(r!=null){try{return Bb.call(r)}catch{}try{return r+""}catch{}}return""}function Db(r,e){return r===e||r!==r&&e!==e}var kF=yb(function(){return arguments}())?yb:function(r){return cs(r)&&rt.call(r,"callee")&&!Ub.call(r,"callee")},Td=Array.isArray;function SF(r){return r!=null&&Nb(r.length)&&!_b(r)}var om=FR||CF;function wF(r,e){return Mb(r,e)}function _b(r){if(!qb(r))return!1;var e=ms(r);return e==Ib||e==QT||e==YT||e==tR}function Nb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Pb}function qb(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function cs(r){return r!=null&&typeof r=="object"}var Hb=cb?kR(cb):uF;function IF(r){return SF(r)?oF(r):cF(r)}function xF(){return[]}function CF(){return!1}hi.exports=wF});var t2=Cn(Cy(),1);function v(r,e){if(r==null)throw Error(e??"Expected nonnullish value.")}function Ay(r,e){return v(r,e),r}function tr(r,e){if(!r)throw Error(e)}var te;(function(r){r.COMMENT="t1_",r.ACCOUNT="t2_",r.LINK="t3_",r.MESSAGE="t4_",r.SUBREDDIT="t5_",r.AWARD="t6_"})(te||(te={}));function kt(r){return r.startsWith(te.COMMENT)}function Ya(r){return r.startsWith(te.ACCOUNT)}function rr(r){return r.startsWith(te.LINK)}function Ey(r){return r.startsWith(te.MESSAGE)}function Ty(r){return r.startsWith(te.SUBREDDIT)}function Ry(r){return r.startsWith(te.AWARD)}function LA(r){tr(kt(r),`Expected comment id to start with ${te.COMMENT}, got ${r}}`)}function DA(r){tr(Ya(r),`Expected account id to start with ${te.ACCOUNT}, got ${r}}`)}function _A(r){tr(rr(r),`Expected link id to start with ${te.LINK}, got ${r}}`)}function NA(r){tr(Ey(r),`Expected message id to start with ${te.MESSAGE}, got ${r}}`)}function qA(r){tr(Ty(r),`Expected subreddit id to start with ${te.SUBREDDIT}, got ${r}}`)}function HA(r){tr(Ry(r),`Expected award id to start with ${te.AWARD}, got ${r}}`)}function Wr(r){return LA(r),r}function ge(r){return DA(r),r}function he(r){return _A(r),r}function jA(r){return NA(r),r}function Re(r){return qA(r),r}function WA(r){return HA(r),r}function Fe(r){if(kt(r))return Wr(r);if(Ya(r))return ge(r);if(rr(r))return he(r);if(Ey(r))return jA(r);if(Ty(r))return Re(r);if(Ry(r))return WA(r);throw new Error(`Expected thing id to start with ${Object.values(te).join(", ")} got ${r}}`)}function mc(r){return kt(r)}import*as I from"@devvit/protos";var Qa=class{constructor(e){}};var pc=(t=>(t.Installation="installation",t.App="app",t))(pc||{});function ir(r,e=new Set){for(let t of r){if(t.type==="group"){ir(t.fields,e);continue}let i=t.name;if(e.has(i))throw new Error(`Duplicate field name: ${i}`);e.add(i)}GA(r)}function GA(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 St=Object.freeze({INTERVAL:0,FORM:1,STATE:2,CHANNEL:3});var OU=["activity","add-emoji","add","add-media","add-to-feed","admin","align-center","align-left","align-right","all","appearance","approve","archived","aspect-ratio","aspect-rectangle","attach","audio","author","avatar-style","award","back","ban","best","binoculars","block","blockchain","bold","bot","boost","bounce","browse","browser","cake","calendar","camera","caret-down","caret-left","caret-right","caret-up","chat","chat-group","chat-new","checkbox-dismiss","checkbox","checkmark","chrome","clear","close","closed-captioning","code-block","code-inline","coins-color-old","coins-color","coins","collapse-left","collapse-right","collection","comment","comments","community","contest","controversial","crop","crosspost","crowd-control","custom-feed","customize","day","delete","discover","dismiss-all","distinguish","down-arrow","down","download","downvote","downvotes","drag","drugs","duplicate","edit","effect","embed","emoji","end-live-chat","error","expand-left","expand-right","external","feed-video","filter","format","forward","gif-post","heart","help","hide","history","home","hot","ignore-reports","image-post","inbox","info","invite","italic","join","joined","jump-down","jump-up","karma","keyboard","kick","language","leave","left","link","link-post","list-bulleted","list-numbered","live-chat","live","load","location","lock","logout","loop","mark-read","mask","media-gallery","meme","menu","message","mic","mic-mute","mod","mod-mail","mod-mode","mod-mute","mod-overflow","mod-queue","mod-unmute","music","new","night","notification","notification-frequent","notification-off","nsfw","nsfw-language","nsfw-violence","original","overflow-caret","overflow-horizontal","overflow-vertical","pause","payment","peace","pending-posts","phone","pin","planet","play","poll-post","popular","posts","powerup-color-outline","powerup-fill-color","powerup","predictions","premium","privacy","profile","qa","qr-code","quarantined","quote","r-slash","radio-button","raise-hand","random","ratings-everyone","ratings-mature","ratings-nsfw","ratings-violence","refresh","remove","reply","report","reverse","right","rising","rotate","rotate-image","rpan","rules","safari","save","saved","search","self","send","settings","share-android","share","share-ios","show","side-menu","skipback10","skipforward10","sort-az","sort","sort-price","sort-za","spam","spoiler","sponsored","star","statistics","status-live","sticker","strikethrough","subtract","superscript","swap-camera","swipe-back","swipe-down","swipe","swipe-up","table","tag","tap","telescope","text","text-post","text-size","toggle","tools","top","topic-activism","topic-addictionsupport","topic-advice","topic-animals","topic-anime","topic-art","topic-beauty","topic-business","topic-careers","topic-cars","topic-celebrity","topic-craftsdiy","topic-crypto","topic-culture","topic-diy","topic-entertainment","topic-ethics","topic-family","topic-fashion","topic","topic-fitness","topic-food","topic-funny","topic-gender","topic-health","topic-help","topic-history","topic-hobbies","topic-homegarden","topic-internet","topic-law","topic-learning","topic-lifestyle","topic-marketplace","topic-mature","topic-mensfashion","topic-menshealth","topic-meta","topic-military","topic-movies","topic-music","topic-news","topic-other","topic-outdoors","topic-pets","topic-photography","topic-places","topic-podcasts","topic-politics","topic-programming","topic-reading","topic-religion","topic-science","topic-sexorientation","topic-sports","topic-style","topic-tabletop","topic-technology","topic-television","topic-traumasupport","topic-travel","topic-videogaming","topic-womensfashion","topic-womenshealth","translate","trim","u-slash","unban","undo","unheart","unlock","unmod","unpin","unverified","up-arrow","up","upload","upvote","upvotes","user","user-note","users","vault","verified","video-camera","video-feed","video-live-1","video-live-fill-1","video-live","video-post","video-thread","video-transcription","view-card","view-classic","view-compact","view-grid","views","volume","volume-mute","wallet","warning","wiki-ban","wiki","wiki-unban","world"];import{AppSettingsDefinition as LE,GetFieldsResponse as DE}from"@devvit/protos";import{FormField as nr,FormFieldType as Be}from"@devvit/protos";function at(r){return r.map(e=>{switch(e.type){case"string":return zA(e);case"image":return VA(e);case"paragraph":return $A(e);case"number":return JA(e);case"select":return KA(e);case"boolean":return XA(e);case"group":return ZA(e);default:throw new Error("Unknown field type.")}})}function zA(r){return nr.fromPartial({defaultValue:{fieldType:Be.STRING,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{stringConfig:{placeholder:r.placeholder}},fieldId:r.name,fieldType:Be.STRING,helpText:r.helpText,label:r.label,required:r.required,isSecret:r.isSecret})}function VA(r){return nr.fromPartial({disabled:r.disabled,fieldId:r.name,fieldType:Be.IMAGE,helpText:r.helpText,label:r.label,required:r.required})}function $A(r){return nr.fromPartial({defaultValue:{fieldType:Be.PARAGRAPH,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{paragraphConfig:{lineHeight:r.lineHeight,placeholder:r.placeholder}},fieldId:r.name,fieldType:Be.PARAGRAPH,helpText:r.helpText,label:r.label,required:r.required})}function JA(r){return nr.fromPartial({defaultValue:{fieldType:Be.NUMBER,numberValue:r.defaultValue},disabled:r.disabled,fieldConfig:{numberConfig:{}},fieldId:r.name,fieldType:Be.NUMBER,helpText:r.helpText,label:r.label,required:r.required})}function KA(r){return nr.fromPartial({defaultValue:{fieldType:Be.SELECTION,selectionValue:{values:r.defaultValue}},disabled:r.disabled,fieldConfig:{selectionConfig:{choices:r.options,multiSelect:r.multiSelect}},fieldId:r.name,fieldType:Be.SELECTION,helpText:r.helpText,label:r.label,required:r.required})}function XA(r){return nr.fromPartial({defaultValue:{fieldType:Be.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Be.BOOLEAN,helpText:r.helpText,label:r.label})}function ZA(r){return nr.fromPartial({fieldType:Be.GROUP,fieldConfig:{groupConfig:{fields:at(r.fields)}},label:r.label,helpText:r.helpText})}function U(r,e){m.prototype[r]=e}import{ValidateFormResponse as ME}from"@devvit/protos";import{RealtimeSubscriptionStatus as Qy}from"@devvit/protos";var Gr;(function(r){function e(o,a){return o.length<=a?o:`${o.slice(0,a-1)}\u2026`}r.ellipsize=e;function t(o){return o[0]==null?o:`${o[0].toLocaleUpperCase()}${o.slice(1)}`}r.capitalize=t;function i(o){return o==null||/^\s*$/.test(o)}r.isBlank=i;function n(o){return o instanceof Error?`${o.stack||o.message||o.name}`:String(o)}r.caughtToString=n})(Gr||(Gr={}));function fc(r){if(r==null||typeof r!="object")return r;for(let e of Object.values(r))fc(e);return Object.freeze(r)}var sM=fc(new Set([Boolean,String,Date,ArrayBuffer,DataView,Array,Object,Map,Set,Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError].map(r=>r.prototype)));var re=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",DebugRenderXML:"devvit-debug-render-xml",GQLHost:"devvit-gql-host",Installation:"devvit-installation",ModPermissions:"devvit-mod-permissions",R2Auth:"devvit-sec-authorization",R2Host:"devvit-r2-host",RemoteHostname:"devvit-remote-hostname",SettingsUri:"devvit-sec-settings-uri",StreamID:"devvit-stream-id",Subreddit:"devvit-subreddit",TraceID:"devvit-trace-id",User:"devvit-user",Version:"devvit-version"});var Zy=Cn(Xy(),1),mM=globalThis.Buffer??Zy.Buffer;function ye(r,e){return e?.[r]?.values[0]}function RE(r){let e=Ay(r.method.split("/").at(-1));return e[0].toLocaleLowerCase()+e.slice(1)}var Yy;(function(r){function e(t){let i=t.request?`${t.src} \u2192 ${t.dst}`:`${t.dst} \u2190 ${t.src}`,n=t.streamId.split("-")[0],o=Gr.capitalize(RE(t));return`${i}@${n}/${o}`}r.toLogString=e})(Yy||(Yy={}));function ev(r){function e(t){let i=r.currentHookIndex,n=r.getCurrentComponentState(),o=r.getPreviousComponentState(),a=ye(re.App,r.metadata);v(a,"useChannel - app is missing from Context");let u=ye(re.Installation,r.metadata);v(u,"useChannel - installation is missing from Context");async function p(C){let E=n[i].channel;if(n[i].active)if(n[i].connected)await r.realtime.send(E,C);else throw Error(`Failed to send to channel '${E}'; it is active but not yet connected`);else throw Error(`Cannot send a message over inactive channel: ${E}`)}function f(){if(!n[i].active){let C=n[i].channel;n[i].active=!0,r.addRealtimeChannel(C)}}function g(){if(n[i].active){let C=n[i].channel;n[i].active=!1,r.removeRealtimeChannel(C)}}function c(C){return async()=>{let E;switch(C.status){case Qy.REALTIME_SUBSCRIBED:n[i].connected=!0,E=t.onSubscribed?.();break;case Qy.REALTIME_UNSUBSCRIBED:n[i].connected=!1,E=t.onUnsubscribed?.();break;default:E=t.onMessage(C.event?.data??{});break}await E}}let h={channel:`${a}:${u}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:St.CHANNEL};i in n?h=n[i]:i in o&&(h=o[i]);let P=r.realtimeEvent;r.isInitialRender?h.active=!1:P&&h.active&&P.event.channel===h.channel&&(h.preventCallback||r.runHook(c(P)),r.rerenderIn(0)),n[i]=h,r.currentHookIndex++;let w=0;return h.active&&h.connected?w=2:h.active&&!h.connected?w=1:!h.active&&h.connected?w=3:!h.active&&!h.connected&&(w=4),{subscribe:f,unsubscribe:g,send:p,status:w}}return e}import{FormFieldType as Kr}from"@devvit/protos";function Cc(r){switch(r.fieldType){case Kr.STRING:return r.stringValue;case Kr.IMAGE:return r.stringValue;case Kr.PARAGRAPH:return r.stringValue;case Kr.NUMBER:return r.numberValue;case Kr.BOOLEAN:return r.boolValue;case Kr.SELECTION:return r.selectionValue?.values??[];default:return}}function It(r){return Object.keys(r).reduce((e,t)=>(e[t]=Cc(r[t]),e),{})}function tv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentKey(),a=r.getCurrentComponentState(),u=r.getPreviousComponentState(),p=`form.hook.${o}.${n}`,f={formKey:p,preventSubmit:!1,type:St.FORM};n in a?f=a[n]:n in u&&(f=u[n]),a[n]=f,r.forms.set(p,t);let g=r.formSubmittedEvent;return g&&!f.preventSubmit&&g.formId===p&&r.runHook(async()=>{let c=i(It(g.results));c&&c instanceof Promise&&await c,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function rv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),u=100,p=Math.max(u,i),f={lastRun:void 0,running:!1,preventCallback:!1,type:St.INTERVAL};n in o?f=o[n]:n in a&&(f=a[n]);function g(){i<u&&console.error(`useInterval delay must be at least ${u}ms. Your interval of ${i}ms was automatically extended.`);for(let[h,P]of Object.entries(o))if(h!==n.toString()&&P?.type===St.INTERVAL&&P?.running)throw new Error("Only one useInterval hook may be running at a time");o[n]={running:!0,lastRun:Date.now(),preventCallback:!1,type:St.INTERVAL},r.rerenderIn(p)}function c(){o[n].running=!1,o[n].lastRun=void 0,o[n].preventCallback=!1}return r.isEffectRender&&f.running&&(f.preventCallback||(f.lastRun===void 0||f.lastRun+p<Date.now())&&r.runHook(async()=>{let h=t();h&&h instanceof Promise&&await h,f.lastRun=Date.now()}),r.rerenderIn(p)),f.preventCallback=!1,o[n]=f,r.currentHookIndex++,{start:g,stop:c}}return e}function iv(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 u=t instanceof Function?t():t;if(u instanceof Promise)throw(async()=>{n[i]=await u,r.currentHookIndex=0})();n[i]=u}else n[i]=o[i];function a(u){if(r.isRendering)throw new Error("Cannot call setState while rendering.");n[i]=u instanceof Function?u(n[i]):u}return r.currentHookIndex++,[n[i],a]}return e}var Xr,Zr,id,nv,nd,sv,Yr=class{constructor(e,t){l(this,id);l(this,nd);l(this,Xr,void 0);l(this,Zr,void 0);d(this,Xr,e),d(this,Zr,t)}async getURL(e){return typeof e=="string"?k(this,id,nv).call(this,e):k(this,nd,sv).call(this,e)}};Xr=new WeakMap,Zr=new WeakMap,id=new WeakSet,nv=async function(e){let t=globalThis?.devvit?.config?.assets?.[e];if(t)return t;let i=await s(this,Zr).call(this).GetAssetURL({path:e},s(this,Xr));if(!i.found)throw new Error(`Could not load the URL for asset ${e}`);return i.url},nd=new WeakSet,sv=async function(e){let t={},i=[],n=globalThis?.devvit?.config?.assets;if(n)for(let a of e)n[a]?t[a]=n[a]:i.push(a);else i=e;if(i.length===0)return t;let o=await s(this,Zr).call(this).GetAssetURLs({paths:i},s(this,Xr));i=[];for(let[a,u]of Object.entries(o.urls))u.found?t[a]=u.paths[0]:i.push(a);if(i.length>0)throw new Error(`The following assets were missing from the assets list: ${i.join(", ")}`);return t};var xt,Qr=class{constructor(e){l(this,xt,void 0);d(this,xt,e)}async get(e){let{messages:t}=await m.kvStorePlugin.Get({keys:[e]},s(this,xt));try{if(t[e])return JSON.parse(t[e])}catch{return}}async put(e,t){let i={};i[e]=JSON.stringify(t),await m.kvStorePlugin.Put({messages:i},s(this,xt))}async delete(e){await m.kvStorePlugin.Del({keys:[e]},s(this,xt))}async list(){let{keys:e}=await m.kvStorePlugin.List({filter:"*"},s(this,xt));return e}};xt=new WeakMap;var Kn,ei=class{constructor(e){l(this,Kn,void 0);d(this,Kn,e)}async upload(e){let t=await m.mediaPlugin.Upload(e,s(this,Kn));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};Kn=new WeakMap;var Xn,ti=class{constructor(e){l(this,Xn,void 0);d(this,Xn,e)}async add(e){await m.modLogPlugin.Add(e,s(this,Xn))}};Xn=new WeakMap;var S,Zn,ii=class{constructor(e){l(this,S,void 0);l(this,Zn,void 0);d(this,S,e),d(this,Zn,new od(e))}get modMail(){return s(this,Zn)}getSubredditById(e){return ve.getById(Fe(e),s(this,S))}getSubredditByName(e){return ve.getByName(e,s(this,S))}addSubredditRemovalReason(e,t){return ve.addRemovalReason(e,t.title,t.message,s(this,S))}getSubredditRemovalReasons(e){return ve.getRemovalReasons(e,s(this,S))}getCurrentSubreddit(){return ve.getFromMetadata(s(this,S))}getPostById(e){return V.getById(Fe(e),s(this,S))}submitPost(e){return V.submit(e,s(this,S))}crosspost(e){return V.crosspost(e,s(this,S))}getUserById(e){return x.getById(Fe(e),s(this,S))}getCollectionById(e){return ri.getCollectionById({collectionId:e},s(this,S))}createCollection(e){return ri.create(e,s(this,S))}getCollectionsForSubreddit(e){return ri.getCollectionsForSubreddit({subredditId:e},s(this,S))}getUserByUsername(e){return x.getByUsername(e,s(this,S))}getCurrentUser(){return x.getFromMetadata(re.User,s(this,S))}getAppUser(){return x.getFromMetadata(re.AppUser,s(this,S))}getSnoovatarUrl(e){return x.getSnoovatarUrl(e,s(this,S))}getCommentById(e){return Z.getById(Fe(e),s(this,S))}getComments(e){return Z.getComments(e,s(this,S))}getCommentsByUser(e){return Z.getCommentsByUser(e,s(this,S))}submitComment(e){return Z.submit({...e,id:Fe(e.id)},s(this,S))}getControversialPosts(e){return V.getControversialPosts(e,s(this,S))}getTopPosts(e){return V.getTopPosts(e,s(this,S))}getHotPosts(e){return V.getHotPosts(e,s(this,S))}getNewPosts(e){return V.getNewPosts(e,s(this,S))}getRisingPosts(e){return V.getRisingPosts(e,s(this,S))}getPostsByUser(e){return V.getPostsByUser(e,s(this,S))}getCommentsAndPostsByUser(e){return x.getOverview(e,s(this,S))}getModerationLog(e){return sd(e,s(this,S))}getApprovedUsers(e){return x.getSubredditUsersByType({type:"contributors",...e},s(this,S))}approveUser(e,t){return x.createRelationship({username:e,subredditName:t,type:"contributor"},s(this,S))}removeUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"contributor"},s(this,S))}getWikiContributors(e){return x.getSubredditUsersByType({type:"wikicontributors",...e},s(this,S))}addWikiContributor(e,t){return x.createRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,S))}removeWikiContributor(e,t){return x.removeRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,S))}getBannedUsers(e){return x.getSubredditUsersByType({type:"banned",...e},s(this,S))}banUser(e){return x.createRelationship({username:e.username,subredditName:e.subredditName,type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,S))}unbanUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"banned"},s(this,S))}getBannedWikiContributors(e){return x.getSubredditUsersByType({type:"wikibanned",...e},s(this,S))}banWikiContributor(e){return x.createRelationship({...e,type:"wikibanned"},s(this,S))}unbanWikiContributor(e,t){return x.removeRelationship({username:e,subredditName:t,type:"wikibanned"},s(this,S))}getModerators(e){return x.getSubredditUsersByType({type:"moderators",...e},s(this,S))}inviteModerator(e){return x.createRelationship({type:"moderator_invite",subredditName:e.subredditName,username:e.subredditName,permissions:e.permissions??[]},s(this,S))}revokeModeratorInvite(e,t){return x.removeRelationship({username:e,subredditName:t,type:"moderator_invite"},s(this,S))}removeModerator(e,t){return x.removeRelationship({type:"moderator",subredditName:t,username:e},s(this,S))}setModeratorPermissions(e,t,i){return x.setModeratorPermissions(e,t,i,s(this,S))}getMutedUsers(e){return x.getSubredditUsersByType({type:"muted",...e},s(this,S))}muteUser(e){return x.createRelationship({...e,type:"muted"},s(this,S))}unmuteUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"muted"},s(this,S))}getModNotes(e){return Ue.get(e,s(this,S))}deleteModNote(e){return Ue.delete(e,s(this,S))}addModNote(e){let t={...e,redditId:Fe(e.redditId)};return Ue.add(t,s(this,S))}addRemovalNote(e){return Ue.addRemovalNote(e,s(this,S))}async sendPrivateMessage(e){return ar.send(e,s(this,S))}async sendPrivateMessageAsSubreddit(e){return ar.sendAsSubreddit(e,s(this,S))}async approve(e){if(kt(e))return Z.approve(e,s(this,S));if(rr(e))return V.approve(e,s(this,S));throw new Error("id must start with either t1_ or t3_")}async remove(e,t){if(kt(e))return Z.remove(e,t,s(this,S));if(rr(e))return V.remove(e,t,s(this,S));throw new Error("id must start with either t1_ or t3_")}async getPostFlairTemplates(e){return de.getPostFlairTemplates(e,s(this,S))}async getUserFlairTemplates(e){return de.getUserFlairTemplates(e,s(this,S))}async createPostFlairTemplate(e){return de.createPostFlairTemplate(e,s(this,S))}async createUserFlairTemplate(e){return de.createUserFlairTemplate(e,s(this,S))}async editFlairTemplate(e){return de.editFlairTemplate(e,s(this,S))}async deleteFlairTemplate(e,t){return de.deleteFlairTemplate(e,t,s(this,S))}async setUserFlair(e){return Me.setUserFlair(e,s(this,S))}async removeUserFlair(e,t){return Me.removeUserFlair(e,t,s(this,S))}async setPostFlair(e){return Me.setPostFlair(e,s(this,S))}async removePostFlair(e,t){return Me.removePostFlair(e,he(t),s(this,S))}async getWidgets(e){return ie.getWidgets(e,s(this,S))}async deleteWidget(e,t){return ie.delete(e,t,s(this,S))}async addWidget(e){return ie.add(e,s(this,S))}async reorderWidgets(e,t){return ie.reorder(e,t,s(this,S))}async getWikiPage(e,t){return be.getPage(e,t,s(this,S))}async getWikiPages(e){return be.getPages(e,s(this,S))}async createWikiPage(e){return be.createPage(e,s(this,S))}async updateWikiPage(e){return be.updatePage(e,s(this,S))}getWikiPageRevisions(e){return be.getPageRevisions(e,s(this,S))}async revertWikiPage(e,t,i){return be.revertPage(e,t,i,s(this,S))}async getWikiPageSettings(e,t){return be.getPageSettings(e,t,s(this,S))}async updateWikiPageSettings(e){return be.updatePageSettings(e,s(this,S))}async addEditorToWikiPage(e,t,i){return be.addEditor(e,t,i,s(this,S))}async removeEditorFromWikiPage(e,t,i){return be.removeEditor(e,t,i,s(this,S))}getMessages(e){return ar.getMessages(e,s(this,S))}markAllMessagesAsRead(){return ar.markAllAsRead(s(this,S))}report(e,t){return m.redditAPIPlugins.LinksAndComments.Report({reason:t.reason,thingId:e.id,srName:e.subredditName,usernames:e.authorName},s(this,S))}getModQueue(e){return ve.aboutLocation({...e,location:"modqueue"},s(this,S))}getReports(e){return ve.aboutLocation({...e,location:"reports"},s(this,S))}getSpam(e){return ve.aboutLocation({...e,location:"spam"},s(this,S))}getUnmoderated(e){return ve.aboutLocation({...e,location:"unmoderated"},s(this,S))}getEdited(e){return ve.aboutLocation({...e,location:"edited"},s(this,S))}};S=new WeakMap,Zn=new WeakMap;import{RedisKeyScope as Ac}from"@devvit/protos";var R,F,B,Ec=class{constructor(e,t,i){l(this,R,void 0);l(this,F,void 0);l(this,B,void 0);d(this,R,e),d(this,F,t),d(this,B,i)}async get(e){return await s(this,R).Get({key:e,transactionId:s(this,F)},s(this,B)),this}async multi(){await s(this,R).Multi(s(this,F),s(this,B))}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),await s(this,R).Set({key:e,value:t,nx:i?.nx===!0,xx:i?.xx===!0,expiration:n||0,transactionId:s(this,F)},s(this,B)),this}async del(...e){return await s(this,R).Del({keys:e,transactionId:s(this,F)},s(this,B)),this}async type(e){return await s(this,R).Type({key:e,transactionId:s(this,F)},s(this,B)),this}async exec(){let e=await s(this,R).Exec(s(this,F),s(this,B)),t=[];for(let i of e.response)i.members?t.push(i.members):i.nil!==void 0?t.push(null):i.num!==void 0?t.push(i.num):i.values!==void 0?t.push(i.values.values):i.str!==void 0&&t.push(i.str);return t}async discard(){await s(this,R).Discard(s(this,F),s(this,B))}async watch(...e){return await s(this,R).Watch({keys:e,transactionId:s(this,F)},s(this,B)),this}async unwatch(){return await s(this,R).Unwatch(s(this,F),s(this,B)),this}async getRange(e,t,i){return await s(this,R).GetRange({key:e,start:t,end:i,transactionId:s(this,F)},s(this,B)),this}async setRange(e,t,i){return await s(this,R).SetRange({key:e,offset:t,value:i,transactionId:s(this,F)},s(this,B)),this}async strlen(e){return await s(this,R).Strlen({key:e,transactionId:s(this,F)},s(this,B)),this}async mget(e){return await s(this,R).MGet({keys:e,transactionId:s(this,F)},s(this,B)),this}async mset(e){let t=Object.entries(e).map(([i,n])=>({key:i,value:n}));return await s(this,R).MSet({kv:t,transactionId:s(this,F)},s(this,B)),this}async incrBy(e,t){return await s(this,R).IncrBy({key:e,value:t,transactionId:s(this,F)},s(this,B)),this}async expire(e,t){return await s(this,R).Expire({key:e,seconds:t,transactionId:s(this,F)},s(this,B)),this}async expireTime(e){return await s(this,R).ExpireTime({key:e,transactionId:s(this,F)},s(this,B)),this}async zAdd(e,...t){return await s(this,R).ZAdd({key:e,members:t,transactionId:s(this,F)},s(this,B)),this}async zScore(e,t){return await s(this,R).ZScore({key:{key:e,transactionId:s(this,F)},member:t},s(this,B)),this}async zRank(e,t){return await s(this,R).ZRank({key:{key:e,transactionId:s(this,F)},member:t},s(this,B)),this}async zIncrBy(e,t,i){return await s(this,R).ZIncrBy({key:e,member:t,value:i,transactionId:s(this,F)},s(this,B)),this}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,F)};return await s(this,R).ZScan(o,s(this,B)),this}async zCard(e){return await s(this,R).ZCard({key:e,transactionId:s(this,F)},s(this,B)),this}async zRange(e,t,i,n){let o={rev:!1,byLex:!1,byScore:!1,offset:0,count:1e3};return n?.reverse&&(o.rev=n.reverse),n?.by==="lex"?o.byLex=!0:n?.by==="score"&&(o.byScore=!0),await s(this,R).ZRange({key:{key:e,transactionId:s(this,F)},start:t+"",stop:i+"",...o},s(this,B)),this}async zRem(e,t){return await s(this,R).ZRem({key:{key:e,transactionId:s(this,F)},members:t},s(this,B)),this}async zRemRangeByLex(e,t,i){return await s(this,R).ZRemRangeByLex({key:{key:e,transactionId:s(this,F)},min:t,max:i},s(this,B)),this}async zRemRangeByRank(e,t,i){return await s(this,R).ZRemRangeByRank({key:{key:e,transactionId:s(this,F)},start:t,stop:i},s(this,B)),this}async zRemRangeByScore(e,t,i){return await s(this,R).ZRemRangeByScore({key:{key:e,transactionId:s(this,F)},min:t,max:i},s(this,B)),this}async hgetall(e){return await s(this,R).HGetAll({key:e,transactionId:s(this,F)},s(this,B)),this}async hget(e,t){return await s(this,R).HGet({key:e,field:t,transactionId:s(this,F)},s(this,B)),this}async hset(e,t){let i=Object.entries(t).map(([n,o])=>({field:n,value:o}));return await s(this,R).HSet({key:e,fv:i,transactionId:s(this,F)},s(this,B)),this}async hincrby(e,t,i){return await s(this,R).HIncrBy({key:e,field:t,value:i,transactionId:s(this,F)},s(this,B)),this}async hdel(e,t){return await s(this,R).HDel({key:e,fields:t,transactionId:s(this,F)},s(this,B)),this}async hscan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,F)};return await s(this,R).HScan(o,s(this,B)),this}async hkeys(e){return await s(this,R).HKeys({key:e,transactionId:s(this,F)},s(this,B)),this}async hlen(e){return await s(this,R).HLen({key:e,transactionId:s(this,F)},s(this,B)),this}};R=new WeakMap,F=new WeakMap,B=new WeakMap;var O,ni,Tc=class Tc{constructor(e,t=void 0,i=Ac.INSTALLATION){l(this,O,void 0);l(this,ni,void 0);d(this,O,e),d(this,ni,t),this.scope=i,this.global=i===Ac.INSTALLATION?new Tc(s(this,O),s(this,ni),Ac.GLOBAL):this}get storage(){return s(this,ni)||m.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,O));return new Ec(this.storage,t,s(this,O))}async get(e){let t=await this.storage.Get({key:e,scope:this.scope},s(this,O));return t!==null?t.value??void 0:t}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),(await this.storage.Set({key:e,value:t,nx:i?.nx===!0&&!i.xx,xx:i?.xx===!0&&!i.nx,expiration:n||0,scope:this.scope},s(this,O))).value}async del(...e){await this.storage.Del({keys:e,scope:this.scope},s(this,O))}async incrBy(e,t){return(await this.storage.IncrBy({key:e,value:t,scope:this.scope},s(this,O))).value}async getRange(e,t,i){let n=await this.storage.GetRange({key:e,start:t,end:i,scope:this.scope},s(this,O));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,O))).value}async strlen(e){return(await this.storage.Strlen({key:e,scope:this.scope},s(this,O))).value}async expire(e,t){await this.storage.Expire({key:e,seconds:t,scope:this.scope},s(this,O))}async expireTime(e){return(await this.storage.ExpireTime({key:e,scope:this.scope},s(this,O))).value}async zAdd(e,...t){return(await this.storage.ZAdd({key:e,members:t,scope:this.scope},s(this,O))).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,O))).members}async zRem(e,t){return(await this.storage.ZRem({key:{key:e},members:t,scope:this.scope},s(this,O))).value}async zRemRangeByLex(e,t,i){return(await this.storage.ZRemRangeByLex({key:{key:e},min:t,max:i,scope:this.scope},s(this,O))).value}async zRemRangeByRank(e,t,i){return(await this.storage.ZRemRangeByRank({key:{key:e},start:t,stop:i,scope:this.scope},s(this,O))).value}async zRemRangeByScore(e,t,i){return(await this.storage.ZRemRangeByScore({key:{key:e},min:t,max:i,scope:this.scope},s(this,O))).value}async zScore(e,t){let i=await this.storage.ZScore({key:{key:e},member:t,scope:this.scope},s(this,O));return i!==null?i.value:i}async zRank(e,t){let i=await this.storage.ZRank({key:{key:e},member:t,scope:this.scope},s(this,O));return i!==null?i.value:i}async zIncrBy(e,t,i){let n=await this.storage.ZIncrBy({key:e,member:t,value:i,scope:this.scope},s(this,O));return n!==null?n.value:n}async mget(e){let t=await this.storage.MGet({keys:e,scope:this.scope},s(this,O));return t!==null?t.values.map(i=>i||null):t}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,O))}async zCard(e){let t=await this.storage.ZCard({key:e,scope:this.scope},s(this,O));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,O))}async type(e){let t=await this.storage.Type({key:e,scope:this.scope},s(this,O));return t!==null?t.value:t}async hget(e,t){let i=await this.storage.HGet({key:e,field:t,scope:this.scope},s(this,O));return i!==null?i.value??void 0:i}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,O))).value}async hgetall(e){let t=await this.storage.HGetAll({key:e,scope:this.scope},s(this,O));return t!==null?t.fieldValues:t}async hdel(e,t){return(await this.storage.HDel({key:e,fields:t,scope:this.scope},s(this,O))).value}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,O))}async hkeys(e){let t=await this.storage.HKeys({key:e,scope:this.scope},s(this,O));return t!==null?t.keys:t}async hincrby(e,t,i){return(await this.storage.HIncrBy({key:e,field:t,value:i,scope:this.scope},s(this,O))).value}async hlen(e){return(await this.storage.HLen({key:e,scope:this.scope})).value}};O=new WeakMap,ni=new WeakMap;var si=Tc;var dr,oi=class{constructor(e){l(this,dr,void 0);d(this,dr,e)}async runJob(e){return(await m.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,dr))).id}async cancelJob(e){await m.schedulerPlugin.Cancel({id:e},s(this,dr))}async listJobs(){return(await m.schedulerPlugin.List({after:new Date(0),before:new Date(Date.now()+31536e7)},s(this,dr))).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}))}};dr=new WeakMap;var Yn,ai=class{constructor(e){l(this,Yn,void 0);d(this,Yn,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await m.settingsPlugin.GetSettings({},s(this,Yn));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...av(t.installationSettings.settings,m.installationSettings),...av(t.appSettings.settings,m.appSettings)}}};Yn=new WeakMap;function av(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=Cc(r[n]),i),{});return e&&dv(t,e),t}function dv(r,e){for(let t of e)t.type==="group"?dv(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as Rc,Form as FE,ToastAppearance as lv}from"@devvit/protos";var lr,di,ad=class{constructor(e){l(this,lr,[]);l(this,di,void 0);d(this,di,e)}showForm(e,t){let i=m.formDefinitions.get(e);if(!i&&s(this,di)){let a=s(this,di).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=FE.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});ir(n.fields),o.fields=at(n.fields),s(this,lr).push({type:Rc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?lv.SUCCESS:lv.NEUTRAL}:t={text:e},s(this,lr).push({type:Rc.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,lr).push({type:Rc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,lr)}};lr=new WeakMap,di=new WeakMap;var Uc={now(){return new Date}};function uv(r){return`__autocache__${r}`}function cv(r){return`__lock__${r}`}var BE=300,OE=1e3,dd=5e3,Fc=3,mv=.1,pv=1e3,UE=3e4;function fv(r){if(r.error)throw new Error(r.error);return r.value}var Ct,At,Le,li,ud,gv,cd,hv,md,yv,Qn,Bc,pd,vv,fd,bv,es,Oc,gd,Pv,ld=class{constructor(e,t,i=Uc){l(this,ud);l(this,cd);l(this,md);l(this,Qn);l(this,pd);l(this,fd);l(this,es);l(this,gd);l(this,Ct,void 0);l(this,At,{});l(this,Le,void 0);l(this,li,void 0);d(this,Ct,e),d(this,li,t),d(this,Le,i)}async cache(e,t){d(this,At,s(this,li).__cache=s(this,li).__cache??{}),k(this,gd,Pv).call(this,t);let i=k(this,ud,gv).call(this,t.key);if(i!==void 0)return i;let n=await k(this,es,Oc).call(this,t.key),o=await k(this,cd,hv).call(this,t,n,e);return fv(o)}};Ct=new WeakMap,At=new WeakMap,Le=new WeakMap,li=new WeakMap,ud=new WeakSet,gv=function(e){let t=s(this,At)[e];if(t){let i=s(this,Le).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<Fc&&Math.random()<mv&&t.errorTime+pv<i;if(t?.expires&&t.expires<i&&t.checkedAt+pv<i||n){delete s(this,At)[e];return}else return fv(t)}},cd=new WeakSet,hv=async function(e,t,i){let n=t?.expires,o=n?k(this,fd,bv).call(this,n):1;return!t||t?.error&&t.errorCount<Fc&&mv>Math.random()||o>Math.random()?k(this,md,yv).call(this,e,t,i):t},md=new WeakSet,yv=async function(e,t,i){let n=cv(e.key),o=s(this,Le).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Ct).set(n,"1",{expiration:a,nx:!0}))return k(this,pd,vv).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Le).now();return k(this,Qn,Bc).call(this,p,e.key,e.ttl)}},Qn=new WeakSet,Bc=async function(e,t,i){let n=Math.min(i,OE),o=await k(this,es,Oc).call(this,t);if(o)return o;if(s(this,Le).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,BE)),k(this,Qn,Bc).call(this,e,t,i)},pd=new WeakSet,vv=async function(e,t,i,n){let o=s(this,Le).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,Le).now().getTime(),t.errorCount++}return s(this,At)[e]=t,await s(this,Ct).set(uv(e),JSON.stringify(t),{expiration:new Date(o+UE)}),t.error&&t.errorCount<Fc&&await s(this,Ct).del(cv(e)),t},fd=new WeakSet,bv=function(e){let t=s(this,Le).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},es=new WeakSet,Oc=async function(e){let t=await s(this,Ct).get(uv(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Le).now().getTime(),s(this,At)[e]=i,i}},gd=new WeakSet,Pv=function(e){e.ttl<dd&&(console.warn(`Cache TTL cannot be less than ${dd} milliseconds! Updating ttl value of ${e.ttl} to ${dd}.`),e.ttl=dd)};function kv(r,e,t=Uc){let i=new ld(r,e,t);return i.cache.bind(i)}var ts,ui=class{constructor(e){l(this,ts,void 0);d(this,ts,e)}async send(e,t){await m.realtimePlugin.Send({channel:e,data:t},s(this,ts))}};ts=new WeakMap;function De({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new ti(r),o=new Qr(r),a=new si(r),u=kv(a,i?i.state:{}),p=new ii(r),f=new oi(r),g=new ai(r),c=e?new ad(i):void 0,h=new ei(r),P=new Yr(r,()=>m.assetsPlugin),w=new ui(r),C=t&&i?iv(i):void 0,E=t&&i?rv(i):void 0,D=t&&i?tv(i):void 0,Ke=t&&i?ev(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:f,settings:g,media:h,assets:P,realtime:w,get useForm(){return D??(()=>{throw new Error("useForm() is unavailable")})},get cache(){return u??(()=>{throw new Error("cache() is unavailable")})},get useState(){return C??(()=>{throw new Error("useState() is unavailable")})},get useInterval(){return E??(()=>{throw new Error("useInterval() is unavailable")})},get useChannel(){return Ke??(()=>{throw new Error("useChannel() is unavailable")})},get ui(){if(!c)throw new Error("ui client is not available");return c}}}function le(r,e,t){let i=ye(re.Subreddit,r);v(i,"subreddit is missing from Context");let n=ye(re.AppUser,r);v(n,"appAccountId is missing from Context");let o=ye(re.User,r),a={metadata:r};return{appAccountId:n,subredditId:i,userId:o,postId:e,commentId:t,debug:a,toJSON(){return{appAccountId:n,subredditId:i,userId:o,postId:e,commentId:t,debug:a}}}}async function hd(r,e,t){if(!e)throw new Error("Settings were not defined.");let i=ME.fromPartial({success:!0,errors:{}}),n=It(r.fieldValues),o=e.flatMap(a=>a.type==="group"?a.fields:a);return await Promise.all(o.map(async a=>{let u=a.name;if(u&&a.type!=="group"&&a.onValidate){let p=n[u],f=a.onValidate,g=Object.assign(De({metadata:t}),le(t)),c=await f({value:p,isEditing:r.editing},g);c&&(i.success=!1,i.errors[u]=c)}})),i}async function _E(){if(!m.appSettings)throw new Error("App settings were not defined.");return DE.fromPartial({fields:{fields:at(m.appSettings)}})}async function NE(r,e){return hd(r,m.appSettings,e)}function Sv(r){r.provides(LE),U("GetAppSettingsFields",_E),U("ValidateAppForm",NE)}import{CustomPostDefinition as QE}from"@devvit/protos";import{BlockRenderEventType as Vc,BlockType as XE,EffectType as qv}from"@devvit/protos";var wv="redd.it",qE="redditstatic.com",HE="redditmedia.com",jE="snoo.dev";var WE=[jE,wv,qE,HE],GE=/^data:([a-zA-Z]+\/[a-zA-Z0-9.+_-]+)?(;charset=[a-zA-Z0-9._+-]+)?(;base64)?,(.*)/;function zE(r){return r.trim().replace(/[\r\n]+/g,"")}function VE(r){let e=GE.exec(zE(r));if(e)return{mimeType:e[1],charset:e[2]?.split("=")[1],isBase64:!!e[3],data:e[4].trim()}}function $E(r){return["image/svg+xml"].includes(r)}function JE(r){let e=VE(r);return e?.mimeType?$E(e.mimeType):!1}function Iv(r){try{if(JE(r))return!0;let t=(new URL(r,`https://i.${wv}`)?.hostname).split(".").slice(-2).join(".");return!!t&&WE.includes(t)}catch{return!1}}function ci(r){return r.__effects}function xv(){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 KE,BlockAnimationDirection as Ov,BlockAnimationLoopMode as Uv,BlockAnimationType as Mv,BlockAvatarBackground as Lv,BlockAvatarFacing as Dv,BlockAvatarSize as Et,BlockBorderWidth as vd,BlockButtonAppearance as Tt,BlockButtonSize as Dc,BlockFullSnooSize as mi,BlockGap as bd,BlockHorizontalAlignment as _c,BlockIconSize as Pd,BlockImageResizeMode as rs,BlockPadding as is,BlockRadius as ns,BlockSizeUnit as Nc,BlockSpacerShape as qc,BlockSpacerSize as kd,BlockStackDirection as Hc,BlockTextOutline as jc,BlockTextOverflow as Wc,BlockTextSize as pi,BlockTextStyle as Gc,BlockTextWeight as _v,BlockType as _e,BlockVerticalAlignment as zc}from"@devvit/protos";var Mc={transparent:"transparent",black:"#000000",white:"#ffffff","coolgray-950":"#04090A","coolgray-900":"#0B1416","coolgray-850":"#0F1A1C","coolgray-800":"#131F23","coolgray-750":"#1A282D","coolgray-700":"#223237","coolgray-650":"#2A3C42","coolgray-600":"#33464C","coolgray-550":"#4B6066","coolgray-525":"#576F76","coolgray-500":"#667A80","coolgray-450":"#82959B","coolgray-400":"#A0B0B5","coolgray-350":"#B8C5C9","coolgray-300":"#D2DADD","coolgray-250":"#DAE0E3","coolgray-200":"#E2E7E9","coolgray-150":"#EAEDEF","coolgray-100":"#F2F4F5","coolgray-50":"#F9FAFA","puregray-950":"#080808","puregray-900":"#131313","puregray-850":"#181818","puregray-800":"#1E1E1E","puregray-750":"#272727","puregray-700":"#303030","puregray-650":"#393939","puregray-600":"#434343","puregray-550":"#5C5C5C","puregray-500":"#767676","puregray-450":"#919191","puregray-400":"#ACACAC","puregray-350":"#C3C3C3","puregray-300":"#D6D6D6","puregray-250":"#DDDDDD","puregray-200":"#E4E4E4","puregray-150":"#EBEBEB","puregray-100":"#F2F2F2","puregray-50":"#F8F8F8","orangered-950":"#190600","orangered-900":"#340E00","orangered-800":"#4F1500","orangered-700":"#721F00","orangered-600":"#962900","orangered-500":"#D93A00","orangered-400":"#FE7C53","orangered-300":"#FFBEA6","orangered-200":"#FFD5C6","orangered-100":"#FFEDE5","orangered-50":"#FFF6F3","red-950":"#1C0004","red-900":"#3A0008","red-800":"#58000C","red-700":"#7E0011","red-600":"#A50016","red-500":"#EB001F","red-400":"#FF6E80","red-300":"#FFADB8","red-200":"#FFCCD2","red-100":"#FFEAED","red-50":"#FFF6F7","sakurapink-950":"#1A0011","sakurapink-900":"#360024","sakurapink-800":"#530037","sakurapink-700":"#770051","sakurapink-600":"#9B006A","sakurapink-500":"#E00096","sakurapink-400":"#FF55BD","sakurapink-300":"#FFA5E3","sakurapink-200":"#FFC5EC","sakurapink-100":"#FFE5F9","sakurapink-50":"#FFF3FB","berrypurple-950":"#16001F","berrypurple-900":"#2E0041","berrypurple-800":"#470062","berrypurple-700":"#66008C","berrypurple-600":"#8700B5","berrypurple-500":"#BC0EFF","berrypurple-400":"#D55EFF","berrypurple-300":"#EEA7FF","berrypurple-200":"#F2C8FF","berrypurple-100":"#FBE6FF","berrypurple-50":"#FCF4FF","periwinkle-950":"#0D0B1F","periwinkle-900":"#1A1741","periwinkle-800":"#272262","periwinkle-700":"#372F8C","periwinkle-600":"#453BB5","periwinkle-500":"#6A5CFF","periwinkle-400":"#988EFF","periwinkle-300":"#C3BDFF","periwinkle-200":"#D8D4FF","periwinkle-100":"#ECEAFF","periwinkle-50":"#F7F6FF","alienblue-950":"#000C1D","alienblue-900":"#00183D","alienblue-800":"#00255D","alienblue-700":"#003584","alienblue-600":"#0045AC","alienblue-500":"#1870F4","alienblue-400":"#629FFF","alienblue-300":"#A7CCFF","alienblue-200":"#C6DCFF","alienblue-100":"#E4EFFF","alienblue-50":"#F3F7FF","lightblue-950":"#000D12","lightblue-900":"#001C26","lightblue-800":"#002A3A","lightblue-700":"#003F56","lightblue-600":"#005472","lightblue-500":"#007FAE","lightblue-400":"#47B0DB","lightblue-300":"#95DCFB","lightblue-200":"#B6E9FF","lightblue-100":"#D9F6FF","lightblue-50":"#ECFAFF","mintgreen-950":"#00100E","mintgreen-900":"#001E1B","mintgreen-800":"#002E28","mintgreen-700":"#00443C","mintgreen-600":"#005A4F","mintgreen-500":"#008675","mintgreen-400":"#45B9AB","mintgreen-300":"#96E1D8","mintgreen-200":"#B7ECE5","mintgreen-100":"#DAF7F4","mintgreen-50":"#ECFBF9","kiwigreen-950":"#021000","kiwigreen-900":"#032200","kiwigreen-800":"#053200","kiwigreen-700":"#084A00","kiwigreen-600":"#0A6000","kiwigreen-500":"#0E8A00","kiwigreen-400":"#55BD46","kiwigreen-300":"#A3E398","kiwigreen-200":"#BFEEB8","kiwigreen-100":"#DFF8DB","kiwigreen-50":"#EEFCED","lime-950":"#0C0E00","lime-900":"#1A1F00","lime-800":"#282F00","lime-700":"#3A4501","lime-600":"#4D5A01","lime-500":"#6B7E01","lime-400":"#A1B33B","lime-300":"#CFDB83","lime-200":"#DFE8A6","lime-100":"#EFF4CC","lime-50":"#F7FAE5","yellow-950":"#100D01","yellow-900":"#251E02","yellow-800":"#382D03","yellow-700":"#504104","yellow-600":"#665505","yellow-500":"#8F7407","yellow-400":"#DBAF00","yellow-300":"#FADB61","yellow-200":"#FFE88F","yellow-100":"#FFF2BD","yellow-50":"#FFFAE5","yelloworange-950":"#150C00","yelloworange-900":"#2C1A00","yelloworange-800":"#432700","yelloworange-700":"#623A00","yelloworange-600":"#814C00","yelloworange-500":"#B06400","yelloworange-400":"#FF9C1A","yelloworange-300":"#FFCD7C","yelloworange-200":"#FFDDA8","yelloworange-100":"#FFF0D3","yelloworange-50":"#FFF7EA","poopbrown-950":"#110B04","poopbrown-900":"#29190A","poopbrown-800":"#3B2510","poopbrown-700":"#54371A","poopbrown-600":"#6E4924","poopbrown-500":"#9A6D3F","poopbrown-400":"#CAA075","poopbrown-300":"#EECCAA","poopbrown-200":"#F6DDC3","poopbrown-100":"#FEEEDD","poopbrown-50":"#FEF7EE",pizzaRed:{light:"#ef5350",dark:"#c62828"},"global-brand-orangered":{light:"#FF4500",dark:"#FF4500"},"global-focus":{light:"#47B0DB",dark:"#007FAE"},"interactive-content-disabled":{light:"#0000003f",dark:"#ffffff3f"},"interactive-background-disabled":{light:"#0000000c",dark:"#ffffff0c"},"interactive-pressed":{light:"#00000028",dark:"#ffffff28"},"neutral-content":{light:"#2A3C42",dark:"#B8C5C9"},"neutral-content-disabled":{light:"#D6D6D6",dark:"#303030"},"neutral-content-weak":{light:"#576F76",dark:"#82959B"},"neutral-content-strong":{light:"#0F1A1C",dark:"#F2F4F5"},"neutral-background":{light:"#ffffff",dark:"#0B1416"},"neutral-background-selected":{light:"#EAEDEF",dark:"#1A282D"},"neutral-background-weak":{light:"#F9FAFA",dark:"#04090A"},"neutral-background-medium":{light:"#F8F8F8",dark:"#131313"},"neutral-background-strong":{light:"#ffffff",dark:"#0F1A1C"},"neutral-background-hover":{light:"#F2F4F5",dark:"#131F23"},"neutral-border":{light:"#00000033",dark:"#ffffff33"},"neutral-border-medium":{light:"#0000007f",dark:"#ffffff7f"},"neutral-border-weak":{light:"#00000019",dark:"#ffffff19"},"neutral-border-strong":{light:"#0F1A1C",dark:"#F2F4F5"},primary:{light:"#0045AC",dark:"#629FFF"},"primary-hover":{light:"#003584",dark:"#A7CCFF"},"primary-visited":{light:"#8700B5",dark:"#D55EFF"},"primary-onBackground":{light:"#ffffff",dark:"#ffffff"},"primary-onBackground-selected":{light:"#ffffff",dark:"#000000"},"primary-background":{light:"#0045AC",dark:"#0045AC"},"primary-background-hover":{light:"#003584",dark:"#1870F4"},"primary-background-selected":{light:"#00255D",dark:"#629FFF"},secondary:{light:"#0F1A1C",dark:"#F2F4F5"},"secondary-hover":{light:"#000000",dark:"#ffffff"},"secondary-weak":{light:"#576F76",dark:"#82959B"},"secondary-onBackground":{light:"#000000",dark:"#ffffff"},"secondary-background":{light:"#EAEDEF",dark:"#1A282D"},"secondary-background-hover":{light:"#E2E7E9",dark:"#223237"},"secondary-background-selected":{light:"#D2DADD",dark:"#33464C"},"secondary-plain":{light:"#0F1A1C",dark:"#F2F4F5"},"secondary-plain-hover":{light:"#000000",dark:"#ffffff"},"danger-background":{light:"#EB001F",dark:"#A50016"},"danger-background-disabled":{light:"#FFCCD2",dark:"#3A0008"},"danger-background-hover":{light:"#A50016",dark:"#EB001F"},"danger-onBackground":{light:"#ffffff",dark:"#ffffff"},"danger-content":{light:"#A50016",dark:"#FF6E80"},"danger-content-hover":{light:"#7E0011",dark:"#FFADB8"},"danger-content-default":{light:"#ffffff",dark:"#ffffff"},"brand-background":{light:"#D93A00",dark:"#D93A00"},"brand-onBackground":{light:"#ffffff",dark:"#ffffff"},"brand-background-hover":{light:"#962900",dark:"#962900"},"media-background":{light:"#00000099",dark:"#00000099"},"media-onbackground":{light:"#ffffff",dark:"#ffffff"},"media-onbackground-weak":{light:"#E2E7E9",dark:"#E2E7E9"},"media-background-hover":{light:"#000000cc",dark:"#000000cc"},"media-onbackground-disabled":{light:"#ffffff3f",dark:"#ffffff3f"},"media-border-selected":{light:"#ffffff",dark:"#ffffff"},"media-background-selected":{light:"#000000cc",dark:"#000000cc"},"success-content":{light:"#0A6000",dark:"#55BD46"},"success-hover":{light:"#084A00",dark:"#A3E398"},"success-onBackground":{light:"#ffffff",dark:"#ffffff"},"success-background":{light:"#0E8A00",dark:"#0A6000"},"success-background-hover":{light:"#0A6000",dark:"#0E8A00"},"warning-content":{light:"#665505",dark:"#DBAF00"},"warning-content-hover":{light:"#504104",dark:"#FADB61"},"warning-onBackground":{light:"#000000",dark:"#000000"},"warning-background":{light:"#DBAF00",dark:"#DBAF00"},"warning-background-hover":{light:"#8F7407",dark:"#FADB61"},"upvote-content":{light:"#962900",dark:"#FE7C53"},"upvote-content-weak":{light:"#FF4500",dark:"#FF4500"},"upvote-disabled":{light:"#9629004c",dark:"#FE7C534c"},"upvote-onBackground":{light:"#ffffff",dark:"#ffffff"},"upvote-background":{light:"#D93A00",dark:"#D93A00"},"upvote-background-hover":{light:"#962900",dark:"#962900"},"upvote-background-disabled":{light:"#D93A004c",dark:"#D93A004c"},"downvote-content":{light:"#453BB5",dark:"#988EFF"},"downvote-content-weak":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-disabled":{light:"#453BB54c",dark:"#988EFF4c"},"downvote-onBackground":{light:"#ffffff",dark:"#ffffff"},"downvote-background":{light:"#6A5CFF",dark:"#453BB5"},"downvote-background-hover":{light:"#453BB5",dark:"#453BB5"},"downvote-background-disabled":{light:"#6A5CFF4c",dark:"#6A5CFF4c"},"brand-gradient-default":{light:"",dark:""},"brand-gradient-default-highlight":{light:"",dark:""},"brand-gradient-hover":{light:"",dark:""},"brand-gradient-hover-highlight":{light:"",dark:""},"brand-gradient-active":{light:"",dark:""},"brand-gradient-active-highlight":{light:"",dark:""},"gradient-media":{light:"",dark:""},"gradient-media-strong":{light:"",dark:""},"transparent-background-hover":{light:"#82959B19",dark:"#667A8019"},"global-black":{light:"#000000",dark:"#000000"},"global-white":{light:"#ffffff",dark:"#ffffff"},"global-orangered":{light:"#D93A00",dark:"#D93A00"},"global-alienblue":{light:"#1870F4",dark:"#1870F4"},"global-darkblue":{light:"#131F23",dark:"#131F23"},"tone-1":{light:"#131313",dark:"#F2F2F2"},"tone-2":{light:"#434343",dark:"#ACACAC"},"tone-3":{light:"#ACACAC",dark:"#434343"},"tone-4":{light:"#E4E4E4",dark:"#303030"},"tone-5":{light:"#F2F2F2",dark:"#1E1E1E"},"tone-6":{light:"#F8F8F8",dark:"#131313"},"tone-7":{light:"#ffffff",dark:"#080808"},"action-upvote":{light:"#D93A00",dark:"#D93A00"},"action-downvote":{light:"#6A5CFF",dark:"#6A5CFF"},"alert-caution":{light:"#8F7407",dark:"#8F7407"},"identity-admin":{light:"#D93A00",dark:"#D93A00"},"identity-moderator":{light:"#0E8A00",dark:"#0E8A00"},"identity-self":{light:"#008675",dark:"#008675"},"identity-coins":{light:"#DBAF00",dark:"#DBAF00"},"category-live":{light:"#D93A00",dark:"#D93A00"},"category-nsfw":{light:"#E00096",dark:"#E00096"},"category-spoiler":{light:"#131313",dark:"#F2F2F2"},"ui-canvas":{light:"#F2F2F2",dark:"#080808"},"ui-modalbackground":{light:"#ffffff",dark:"#0F1A1C"},"avatar-gradient":{light:"",dark:""},"opacity-highlight":{light:"",dark:""},"opacity-08":{light:"#13131314",dark:"#13131314"},"opacity-50":{light:"#0000007f",dark:"#F2F2F27f"},scrim:{light:"#00000099",dark:"#00000099"},"scrim-strong":{light:"#000000cc",dark:"#000000cc"},"scrim-gradient":{light:"",dark:""},online:{light:"#55BD46",dark:"#55BD46"},favorite:{light:"#8F7407",dark:"#DBAF00"}};var Cv={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"},Av=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),Ev=r=>r in Mc,Lc=r=>r in Cv,Tv=r=>!!r.match(/^rgba?\(.*/),Rv=r=>!!r.match(/^hsla?\(.*/),Fv=(r,e="light")=>{if(Lc(r))return yd(r);let i=Mc[r];return typeof i=="string"?i:i[e]},yd=r=>Cv[r]??r,Bv=r=>{let[e,t,i,n]=r.replace(/^rgba?\(|\s+|\)$/g,"").split(",");if(!e||!t||!i)return r;let a=[...[e,t,i].map(p=>parseFloat(p))];if(n){let p=parseFloat(n),f=Math.round(p*255);a.push(f)}return`#${a.map(p=>p.toString(16).padStart(2,"0")).join("")}`};var Nv="data-",fi=class{async createBlocksElementOrThrow({type:e,props:t,children:i}){let n=await this.createBlocksElement({type:e,props:t,children:i});if(!n)throw new Error(`Could not create block of type ${e}`);return n}async createBlocksElement({type:e,props:t,children:i}){switch(e){case"blocks":return this.makeRoot(t,...i);case"hstack":return this.makeHStack(t,...i);case"vstack":return this.makeVStack(t,...i);case"zstack":return this.makeZStack(t,...i);case"text":return this.makeText(t,...i);case"button":return this.makeButton(t,...i);case"image":return await this.makeImage(t);case"spacer":return this.makeSpacer(t);case"icon":return this.makeIcon(t);case"avatar":return this.makeAvatar(t);case"fullsnoo":return this.makeFullSnoo(t);case"animation":return await this.makeAnimation(t);case"webview":return this.makeWebView(t);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 is.PADDING_NONE;case"xsmall":return is.PADDING_XSMALL;case"small":return is.PADDING_SMALL;case"medium":return is.PADDING_MEDIUM;case"large":return is.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return ns.RADIUS_NONE;case"small":return ns.RADIUS_SMALL;case"medium":return ns.RADIUS_MEDIUM;case"large":return ns.RADIUS_LARGE;case"full":return ns.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return bd.GAP_NONE;case"small":return bd.GAP_SMALL;case"medium":return bd.GAP_MEDIUM;case"large":return bd.GAP_LARGE}}makeBlockAlignment(e){if(e===void 0)return;let t,i;if(e.includes("top")?t=zc.ALIGN_TOP:e.includes("middle")?t=zc.ALIGN_MIDDLE:e.includes("bottom")&&(t=zc.ALIGN_BOTTOM),e.includes("start")?i=_c.ALIGN_START:e.includes("center")?i=_c.ALIGN_CENTER:e.includes("end")&&(i=_c.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=vd.BORDER_WIDTH_NONE;break;case"thin":o=vd.BORDER_WIDTH_THIN;break;case"thick":o=vd.BORDER_WIDTH_THICK;break;default:o=vd.BORDER_WIDTH_THIN;break}let a=t??"neutral-border-weak",u=this.getThemedColors(a,i,n);return{width:o,color:u?.light,colors:u}}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 Gc.TEXT_STYLE_BODY;case"metadata":return Gc.TEXT_STYLE_METADATA;case"heading":return Gc.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return jc.TEXT_OUTLINE_NONE;case"thin":return jc.TEXT_OUTLINE_THIN;case"thick":return jc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return _v.TEXT_WEIGHT_REGULAR;case"bold":return _v.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return Wc.TEXT_OVERFLOW_CLIP;case"ellipsis":return Wc.TEXT_OVERFLOW_ELLIPSE}return Wc.TEXT_OVERFLOW_ELLIPSE}makeBlockButtonAppearance(e){switch(e){case"secondary":return Tt.BUTTON_APPEARANCE_SECONDARY;case"primary":return Tt.BUTTON_APPEARANCE_PRIMARY;case"plain":return Tt.BUTTON_APPEARANCE_PLAIN;case"bordered":return Tt.BUTTON_APPEARANCE_BORDERED;case"media":return Tt.BUTTON_APPEARANCE_MEDIA;case"destructive":return Tt.BUTTON_APPEARANCE_DESTRUCTIVE;case"caution":return Tt.BUTTON_APPEARANCE_CAUTION;case"success":return Tt.BUTTON_APPEARANCE_SUCCESS}}makeBlockButtonSize(e){switch(e){case"small":return Dc.BUTTON_SIZE_SMALL;case"medium":return Dc.BUTTON_SIZE_MEDIUM;case"large":return Dc.BUTTON_SIZE_LARGE}}makeBlockImageResizeMode(e){switch(e){case"none":return rs.IMAGE_RESIZE_NONE;case"fit":return rs.IMAGE_RESIZE_FIT;case"fill":return rs.IMAGE_RESIZE_FILL;case"cover":return rs.IMAGE_RESIZE_COVER;case"scale-down":return rs.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return kd.SPACER_XSMALL;case"small":return kd.SPACER_SMALL;case"medium":return kd.SPACER_MEDIUM;case"large":return kd.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return qc.SPACER_INVISIBLE;case"thin":return qc.SPACER_THIN;case"square":return qc.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return Pd.ICON_SIZE_XSMALL;case"small":return Pd.ICON_SIZE_SMALL;case"medium":return Pd.ICON_SIZE_MEDIUM;case"large":return Pd.ICON_SIZE_LARGE}}makeBlockAvatarSize(e){switch(e){case"xxsmall":return Et.AVATAR_SIZE_XXSMALL;case"xsmall":return Et.AVATAR_SIZE_XSMALL;case"small":return Et.AVATAR_SIZE_SMALL;case"medium":return Et.AVATAR_SIZE_MEDIUM;case"large":return Et.AVATAR_SIZE_LARGE;case"xlarge":return Et.AVATAR_SIZE_XXLARGE;case"xxlarge":return Et.AVATAR_SIZE_XXLARGE;case"xxxlarge":return Et.AVATAR_SIZE_XXXLARGE}}makeBlockAvatarFacing(e){switch(e){case"left":return Dv.AVATAR_FACING_LEFT;case"right":return Dv.AVATAR_FACING_RIGHT}}makeBlockFullSnooSize(e){switch(e){case"xsmall":return mi.FULLSNOO_XSMALL;case"small":return mi.FULLSNOO_SMALL;case"medium":return mi.FULLSNOO_MEDIUM;case"large":return mi.FULLSNOO_LARGE;case"xlarge":return mi.FULLSNOO_XLARGE;case"xxlarge":return mi.FULLSNOO_XXLARGE}}makeBlockAvatarBackground(e){switch(e){case"dark":return Lv.AVATAR_BG_DARK;case"light":return Lv.AVATAR_BG_LIGHT}}makeBlockAnimationType(e){return e==="lottie"||e===void 0?Mv.ANIM_LOTTIE:Mv.UNRECOGNIZED}makeBlockAnimationDirection(e){switch(e){case"backward":return Ov.ANIM_DIR_BACKWARD;case"forward":return Ov.ANIM_DIR_FORWARD}}makeBlockLoopMode(e){switch(e){case"repeat":return Uv.ANIM_LOOP_REPEAT;case"bounce":return Uv.ANIM_LOOP_BOUNCE}}makeBlockSize(e){if(e&&(e.width!=null||e.height!=null||e.grow)){let{value:t,unit:i}=this.parseSize(e.width)??{},{value:n,unit:o}=this.parseSize(e.height)??{};return{width:t,widthUnit:i,height:n,heightUnit:o,grow:e.grow}}}makeBlockSizes(e){if(e){let t=e.width!=null||e.minWidth!=null||e.maxWidth!=null,i=e.height!=null||e.minHeight!=null||e.maxHeight!=null;if(t||i||e.grow!=null)return{width:t?{value:this.parseSize(e.width),min:this.parseSize(e.minWidth),max:this.parseSize(e.maxWidth)}:void 0,height:i?{value:this.parseSize(e.height),min:this.parseSize(e.minHeight),max:this.parseSize(e.maxHeight)}:void 0,grow:e.grow}}}parseSize(e){if(e==null)return;if(typeof e=="number")return{value:e,unit:Nc.SIZE_UNIT_PERCENT};let t=e.match(/^(\d+(?:\.\d+)?)(px|%)?$/);if(t==null)return;let i=Nc.SIZE_UNIT_PERCENT;return t?.at(2)==="px"&&(i=Nc.SIZE_UNIT_PIXELS),{value:Number.parseFloat(t[1]),unit:i}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(Nv)).reduce((t,i)=>(t[i.substring(Nv.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);if(t.onPress){let o=t.onPress;i.push({type:KE.ACTION_CLICK,id:o.toString(),data:n})}return i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),Av(e)?e:Ev(e)?Fv(e,t):Lc(e)?yd(e):Tv(e)?Bv(e):Rv(e)?e:(console.warn(`Could not parse color: ${e}.`),yd("red"))}async childrenToBlocks(e){let t=e.map(n=>{if(typeof n!="string")return this.createBlocksElement(n)});return(await Promise.all(t)).filter(n=>n!==void 0)}getThemedColors(e,t,i){let n=this.blockColorToHex(t,"light"),o=this.blockColorToHex(i,"dark"),a=[];if(e&&(!n||!o)){let u=Array.from(e?.matchAll(/[\w#-]+(?:\([\w\t ,.#-]+\))?/g)??[]);a.push(...u.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}childrenToString(e){return e.map(t=>t.toString()).join("")}async makeRoot(e,...t){return this.wrapRoot(e,await this.childrenToBlocks(t))}async wrapRoot(e,t){return this.makeBlock(_e.BLOCK_ROOT,{},{rootConfig:{children:t,height:this.makeRootHeight(m.customPostType?.height??e?.height??"regular")}})}async makeStackBlock(e,t,i){let n=this.getThemedColors(t?.backgroundColor,t?.lightBackgroundColor,t?.darkBackgroundColor);return this.makeBlock(_e.BLOCK_STACK,t,{stackConfig:{alignment:this.makeBlockAlignment(t?.alignment),backgroundColor:n?.light,backgroundColors:n,border:this.makeBlockBorder(t?.border,t?.borderColor,t?.lightBorderColor,t?.darkBorderColor),children:await this.childrenToBlocks(i),cornerRadius:this.makeBlockRadius(t?.cornerRadius),direction:e,gap:this.makeBlockGap(t?.gap),padding:this.makeBlockPadding(t?.padding),reverse:t?.reverse}})}async makeHStack(e,...t){return this.makeStackBlock(Hc.STACK_HORIZONTAL,e,t)}async makeVStack(e,...t){return this.makeStackBlock(Hc.STACK_VERTICAL,e,t)}async makeZStack(e,...t){return this.makeStackBlock(Hc.STACK_DEPTH,e,t)}makeText(e,...t){let i=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(_e.BLOCK_TEXT,e,{textConfig:{alignment:this.makeBlockAlignment(e?.alignment),color:i?.light,colors:i,outline:this.makeBlockTextOutline(e?.outline),size:this.makeBlockTextSize(e?.size),style:this.makeBlockTextStyle(e?.style),text:this.childrenToString(t),weight:this.makeBlockTextWeight(e?.weight),selectable:e?.selectable,wrap:e?.wrap,overflow:this.makeBlockTextOverflow(e?.overflow)}})}makeButton(e,...t){let i=this.getThemedColors(e?.textColor,e?.lightTextColor,e?.darkTextColor);return this.makeBlock(_e.BLOCK_BUTTON,e,{buttonConfig:{buttonAppearance:this.makeBlockButtonAppearance(e?.appearance),icon:e?.icon,buttonSize:this.makeBlockButtonSize(e?.size),text:this.childrenToString(t),textColor:i?.light,textColors:i,disabled:e?.disabled}})}async makeImage(e){return e&&this.makeBlock(_e.BLOCK_IMAGE,e,{imageConfig:{description:e?.description,resizeMode:this.makeBlockImageResizeMode(e.resizeMode),url:e.url,width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight)}})}makeSpacer(e){return this.makeBlock(_e.BLOCK_SPACER,e,{spacerConfig:{size:this.makeBlockSpacerSize(e?.size),shape:this.makeBlockSpacerShape(e?.shape)}})}makeIcon(e){let t=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return e&&this.makeBlock(_e.BLOCK_ICON,e,{iconConfig:{icon:e.name,color:t?.light,colors:t,size:this.makeBlockIconSize(e.size)}})}makeAvatar(e){return e&&this.makeBlock(_e.BLOCK_AVATAR,e,{avatarConfig:{thingId:e.thingId,size:this.makeBlockAvatarSize(e.size),facing:this.makeBlockAvatarFacing(e.facing),background:this.makeBlockAvatarBackground(e.background)}})}makeFullSnoo(e){return e&&this.makeBlock(_e.BLOCK_FULLSNOO,e,{fullsnooConfig:{userId:e.userId,facing:this.makeBlockAvatarFacing(e.facing),size:this.makeBlockFullSnooSize(e.size)}})}async makeAnimation(e){return e&&this.makeBlock(_e.BLOCK_ANIMATION,e,{animationConfig:{type:this.makeBlockAnimationType(e.type),url:e.url,loop:e.loop,loopMode:this.makeBlockLoopMode(e.loopMode),autoplay:e.autoplay,width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight),direction:this.makeBlockAnimationDirection(e.direction),speed:e.speed}})}makeWebView(e){return e&&this.makeBlock(_e.BLOCK_WEBVIEW,e,{webviewConfig:{url:e.url}})}makeBlock(e,t,i){return{type:e,size:this.makeBlockSize(t),sizes:this.makeBlockSizes(t),config:i,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}async ensureRootBlock(e){let t=e;if(t.type===_e.BLOCK_ROOT)return t.config?.rootConfig&&m.customPostType?.height&&(t.config.rootConfig.height=this.makeRootHeight(m.customPostType?.height)),t;let i=await this.wrapRoot(void 0,[t]);if(!i)throw new Error("Could not create root block");return i}};function Hv(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var jv=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+=jv(i);return e+=`</${r.type}>`,e};function ZE(r){return" ".repeat(r)}function YE(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+=ZE(t),n!==0&&(e+="<"),e+=o,n!==i.length-1&&(e+=`>
2
+ `),!a&&o.indexOf("</")===-1&&o.charAt(o.length-1)!=="/"&&t++}return e}var Sd,Wv,ur,ss,os,$c,as,lt=class{constructor(e,t,i,n,o){l(this,Sd);l(this,ur);l(this,os);this.renderState={};this.currentComponentKey=[];this.currentHookIndex=0;this.actions=new Map;this.forms=new Map;this.realtimeChannels=[];this.realtimeUpdated=!1;this.pendingHooks=[];this.isRendering=!1;this.transformer=new fi;this.effects=[];l(this,as,!1);this.component=e,this.event=t,this.state={__renderState:{},...i},this.metadata=n,this.state.__realtimeChannels&&(this.realtimeChannels=this.state.__realtimeChannels);let a=De({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={type:this.component,props:k(this,ur,ss).call(this),children:[]},t=await this.processBlock(e);if(Hv(t),await this.transformer.createBlocksElementOrThrow(t),this.isUserActionRender&&this.blockRenderEventId){let i=this.actions.get(this.blockRenderEventId);i&&await i({})}for(let i of this.pendingHooks)await i();this.buildNextState(),k(this,Sd,Wv).call(this)}async buildBlocksUI(){let e={type:this.component,props:k(this,ur,ss).call(this),children:[]},t=await this.renderElement(e);return this.transformer.ensureRootBlock(t)}async renderElement(e){let t=await this.processBlock(e);return Hv(t),(m.debug.emitSnapshots||ye(re.DebugRenderXML,this.metadata))&&console.log(YE(jv(t))),m.debug.emitState&&console.log(JSON.stringify(this.state,null,2)),await this.transformer.createBlocksElementOrThrow(t)}async processProps(e){if(e.onPress){let t=e.onPress,i=t.name,n=this.makeUniqueActionID(`${XE.BLOCK_BUTTON}.${i??"onPress"}`);this.actions.set(n,t),e.onPress=n}e.url&&(e.url=await this.getAssetUrl(e.url))}async getAssetUrl(e){let t,i=globalThis?.devvit?.config?.assets;if(i&&(t=i[e]),!t&&!Iv(e)){console.log("No assets loaded on the config - falling back to plugin");try{t=await this.assets.getURL(e),i&&t&&(i[e]=t)}catch{}}return t??e}async processBlock(e,t=xv(),i=[]){let n=e;if(typeof n.type=="string"){let p=(await Promise.all(n.children.flatMap(async(c,h)=>c==null?[]:await this.processBlock(c,t,[...i,`${n.type}.${h}`])))).flat(),f=k(this,os,$c).call(this,p);return await this.processProps(n.props||{}),{type:n.type,props:n.props,children:f}}if(typeof n.type=="function"){let u=t(`${i.length?i.join("."):"root"}.${n.type.name.length?n.type.name:"anonymous"}`);this.currentComponentKey.push(u),this.renderState[u]||(this.renderState[u]={});let p=n.children.flatMap(c=>c),f={...k(this,ur,ss).call(this),...n.props,children:p},g;for(;g===void 0;)try{g=await n.type(f,k(this,ur,ss).call(this))}catch(c){if(c instanceof Promise)g=await c;else throw c}if(!this.isInitialRender){let c=this.getPreviousComponentState();if(Object.keys(c).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 g=="object")return this.processBlock(g,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(u,p)=>await this.processBlock(u,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===Vc.RENDER_INITIAL:!1}get isUserActionRender(){return this.event?this.event.type===Vc.RENDER_USER_ACTION:!1}get isEffectRender(){return this.event?this.event.type===Vc.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,as)||(d(this,as,!0),this.effects.push({type:qv.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:qv.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:this.realtimeChannels}}]:[]}getEffects(){return[...ci(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}:{}}}};Sd=new WeakSet,Wv=function(){this.actions.clear(),this.currentComponentKey=[],this.currentHookIndex=0,this.pendingHooks=[],this.realtimeChannels=[],this.realtimeUpdated=!1},ur=new WeakSet,ss=function(){let e={...le(this.metadata,this.state.__postData?.thingId),modLog:this.modLog,reddit:this.reddit,cache:this.cache,kvStore:this.kvStore,redis:this.redis,settings:this.settings,scheduler:this.scheduler,media:this.media,assets:this.assets,realtime:this.realtime,ui:this.ui,dimensions:this.dimensions,...this.hooks};return e.debug.effects=this,e},os=new WeakSet,$c=function(e){let t=[];for(let i of e)typeof i=="string"?t.push(i):i.type==="__fragment"?t.push(...k(this,os,$c).call(this,i.children)):t.push(i);return t},as=new WeakMap;async function eT(r,e){let t=m.customPostType;if(!t)throw new Error("Custom post type not registered");let i=new lt((o,a)=>t.render(a),r.blocks,r.state,e,r.dimensions),n=await i.render();return{state:i.state,blocks:{ui:n},effects:i.getEffects()}}function Gv(r){r.provides(QE),U("RenderPost",eT)}import{GetFieldsResponse as tT,InstallationSettingsDefinition as rT}from"@devvit/protos";async function iT(){if(!m.installationSettings)throw new Error("Installation settings were not defined.");return tT.fromPartial({fields:{fields:at(m.installationSettings)}})}async function nT(r,e){return hd(r,m.installationSettings,e)}function zv(r){r.provides(rT),U("GetSettingsFields",iT),U("ValidateForm",nT)}import{ContextActionDefinition as sT,ContextActionDescription as oT,ContextActionResponse as aT}from"@devvit/protos";var Vv=r=>`menuItem.${r}`;function Jc(r){return m.menuItems.find((e,t)=>Vv(t)===r)}async function dT(r,e){let t=m.menuItems;if(!t.length)throw new Error("No menu items registered.");return{actions:t.map((n,o)=>oT.fromPartial({actionId:Vv(o),name:n.label,description:n.description,contexts:{subreddit:n.location.includes("subreddit"),post:n.location.includes("post"),comment:n.location.includes("comment")},users:{loggedOut:n.forUserType?.includes("loggedOut"),member:n.forUserType?.includes("member"),moderator:n.forUserType?.includes("moderator")},postFilters:n.postFilter==="currentApp"?{currentApp:!0}:void 0}))}}async function lT(r,e){let t=Jc(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 u={targetId:a,location:r.comment?"comment":r.post?"post":"subreddit"},p=Object.assign(De({ui:!0,metadata:e}),le(e,n,i));return await t.onPress(u,p),aT.fromPartial({effects:ci(p.ui)})}function $v(r){r.provides(sT),U("GetActions",dT),U("OnAction",lT)}function ut(r){return r?r===!0?!0:r.enabled:!1}import{SchedulerHandlerDefinition as uT}from"@devvit/protos";async function cT(r,e){let t=r.type,i=m.scheduledJobHandlers.get(t);if(!i)throw new Error(`Job ${t} not found`);let n={name:t,data:r.data},o=Object.assign(De({metadata:e}),le(e));await i(n,o)}function Jv(r){r.provides(uT),U("HandleScheduledAction",cT)}import{HandlerResult as mT,OnAppInstallDefinition as pT,OnAppUpgradeDefinition as fT,OnCommentCreateDefinition as gT,OnCommentDeleteDefinition as hT,OnCommentReportDefinition as yT,OnCommentSubmitDefinition as vT,OnCommentUpdateDefinition as bT,OnModActionDefinition as PT,OnModMailDefinition as kT,OnPostCreateDefinition as ST,OnPostDeleteDefinition as wT,OnPostFlairUpdateDefinition as IT,OnPostReportDefinition as xT,OnPostSubmitDefinition as CT,OnPostUpdateDefinition as AT}from"@devvit/protos";function ne(r,e){return v(e),async(t,i)=>{let n={...t,type:r},o=Object.assign(De({metadata:i}),le(i)),a=await Promise.allSettled(e.map(p=>p(n,o))),u=ET(a);if(u)throw u.err;return mT.fromPartial({})}}function Kv(r){for(let e of m.triggerOnEventHandlers.keys())switch(e){case"PostSubmit":r.provides(CT),U("OnPostSubmit",ne("PostSubmit",m.triggerOnEventHandlers.get(e)));break;case"PostCreate":r.provides(ST),U("OnPostCreate",ne("PostCreate",m.triggerOnEventHandlers.get(e)));break;case"PostUpdate":r.provides(AT),U("OnPostUpdate",ne("PostUpdate",m.triggerOnEventHandlers.get(e)));break;case"PostReport":r.provides(xT),U("OnPostReport",ne("PostReport",m.triggerOnEventHandlers.get(e)));break;case"PostDelete":r.provides(wT),U("OnPostDelete",ne("PostDelete",m.triggerOnEventHandlers.get(e)));break;case"PostFlairUpdate":r.provides(IT),U("OnPostFlairUpdate",ne("PostFlairUpdate",m.triggerOnEventHandlers.get(e)));break;case"CommentSubmit":r.provides(vT),U("OnCommentSubmit",ne("CommentSubmit",m.triggerOnEventHandlers.get(e)));break;case"CommentCreate":r.provides(gT),U("OnCommentCreate",ne("CommentCreate",m.triggerOnEventHandlers.get(e)));break;case"CommentUpdate":r.provides(bT),U("OnCommentUpdate",ne("CommentUpdate",m.triggerOnEventHandlers.get(e)));break;case"CommentReport":r.provides(yT),U("OnCommentReport",ne("CommentReport",m.triggerOnEventHandlers.get(e)));break;case"CommentDelete":r.provides(hT),U("OnCommentDelete",ne("CommentDelete",m.triggerOnEventHandlers.get(e)));break;case"AppInstall":r.provides(pT),U("OnAppInstall",ne("AppInstall",m.triggerOnEventHandlers.get(e)));break;case"AppUpgrade":r.provides(fT),U("OnAppUpgrade",ne("AppUpgrade",m.triggerOnEventHandlers.get(e)));break;case"ModAction":r.provides(PT),U("OnModAction",ne("ModAction",m.triggerOnEventHandlers.get(e)));break;case"ModMail":r.provides(kT),U("OnModMail",ne("ModMail",m.triggerOnEventHandlers.get(e)));break;default:throw new Error(`Unknown trigger event: ${e}`)}}function ET(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=>Gr.caughtToString(t)).join(`
3
+ `))}}var Wb=Cn(ab(),1),Gb=Cn(jb(),1);import{EffectType as AF,UIEventHandlerDefinition as EF}from"@devvit/protos";async function TF(r,e){let t=r.state??{},i=(0,Wb.default)(t),n=De({ui:!0,metadata:e});if(r.event?.formSubmitted&&r.event.formSubmitted.formId){let p=r.event.formSubmitted.formId;if(p.includes("form.hook.")&&m.customPostType){let P=new lt((w,C)=>m.customPostType?.render(C)??null,r.event,r.state,e,void 0);return await P.reconcile(),{state:P.state,effects:P.getEffects()}}let f=m.formDefinitions.get(p);if(!f)throw new Error(`Form with key ${p} not found`);let g,c;if(i.__contextAction){let{actionId:P,thingId:w}=i.__contextAction,C=Jc(P);C?.location==="post"?g=w:C?.location==="comment"&&(c=w)}let h=Object.assign(n,le(e,g,c));await f.onSubmit({values:It(r.event.formSubmitted.results)},h)}else if(r.event?.realtimeEvent){if(m.customPostType){let p=new lt((f,g)=>m.customPostType?.render(g)??null,r.event,r.state,e,void 0);return await p.reconcile(),{state:p.state,effects:p.getEffects()}}}else if(r.event?.toastAction)throw new Error("Toast actions not yet implemented");let o=!(0,Gb.default)(t,i),a=ci(n.ui),u=o?[...a,{type:AF.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:0}}]:a;return{state:i,effects:u}}function zb(r){r.provides(EF),U("HandleUIEvent",TF)}import{CustomPostDefinition as r0}from"@devvit/protos";import{EffectType as OF}from"@devvit/protos";import{EffectType as I_}from"@devvit/protos";var ps=class extends Error{};function Vb(r){let e=gr({namespace:"useState"},({changed:t})=>{let i=r instanceof Function?r():r;if(i instanceof Promise)throw new Error("Cannot use async initializer with useState, use useAsyncState instead.");return{state:i,setter:o=>{e.state=o instanceof Function?o(e.state):o,t()}}});return[e.state,e.setter]}import{EffectType as dm}from"@devvit/protos";var vi=class vi{constructor(e){this.request=e;this._segments=[];this._hooks={};this._prevHookId="";this._effects={};this._changed={};this._rootProps={};this._generated={};this._undeliveredHandlers={};this._state=e.state??{},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}push(e){this._segments.push({...e,next:0})}pop(){this._segments.pop()}addUndeliveredEventHandler(e,t){this._undeliveredHandlers[e]=t}addGlobalUndeliveredEventHandler(e,t){vi.addGlobalUndeliveredEventHandler(e,t)}getHook(e){return this._hooks[e.id]}static addGlobalUndeliveredEventHandler(e,t){vi._staticUndeliveredHandlers[e]=t}async handleUndeliveredEvent(e){let t={...vi._staticUndeliveredHandlers,...this._undeliveredHandlers};for(let[i,n]of Object.entries(t))await n(e,this)}emitEffect(e,t){this._effects[e]=t}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()}}};vi._staticUndeliveredHandlers={};var bi=vi;var Bt={};bi.addGlobalUndeliveredEventHandler("intervals",async(r,e)=>{r.timer&&r.hook&&(delete Bt[r.hook],e.emitEffect("timers",{type:dm.EFFECT_SET_INTERVALS,interval:{intervals:Bt}}))});var Ot,Pi,fs,ki,lm=class{constructor(e,t,i){l(this,Ot,void 0);l(this,Pi,void 0);l(this,fs,void 0);l(this,ki,void 0);this.state={duration:{seconds:0,nanos:0},running:!1};d(this,Pi,i.changed),d(this,Ot,i.hookId),d(this,fs,e),d(this,ki,i.context);let n=Math.floor(t/1e3),o=t%1e3*1e6;this.state.duration={seconds:n,nanos:o}}onLoad(){this.state.running?Bt[s(this,Ot)]={duration:this.state.duration}:delete Bt[s(this,Ot)]}async onUIEvent(e){await s(this,fs).call(this)}start(){Bt[s(this,Ot)]={duration:this.state.duration},this.state.running=!0,s(this,Pi).call(this),s(this,ki).emitEffect("timers",{type:dm.EFFECT_SET_INTERVALS,interval:{intervals:Bt}})}stop(){delete Bt[s(this,Ot)],this.state.running=!1,s(this,Pi).call(this),s(this,ki).emitEffect("timers",{type:dm.EFFECT_SET_INTERVALS,interval:{intervals:Bt}})}};Ot=new WeakMap,Pi=new WeakMap,fs=new WeakMap,ki=new WeakMap;function $b(r,e){return gr({namespace:"useInterval"},t=>new lm(r,e,t))}import{EffectType as cm,Form as BF,ToastAppearance as Xb}from"@devvit/protos";var um=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(It(n.formSubmitted.results))}}};function Jb(r,e){let t=gr({namespace:"useForm"},i=>new um(i,r,e));return RF({id:t.hookId})}function RF(r){return`form.hook.${r.id}.0`}function FF(r){return{id:r.match(/form\.hook\.(.+)\.0/)[1]}}function Kb(r,e){let t=FF(e);return r.getHook(t)}var Ut,Ud=class{constructor(e){l(this,Ut,void 0);d(this,Ut,e)}showForm(e,t){let i=Kb(s(this,Ut),e);if(!i)throw new Error("Form does not exist. Make sure you have added it using useForm.");let n=i.form instanceof Function?i.form(t??{}):i.form,o=BF.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});ir(n.fields),o.fields=at(n.fields),s(this,Ut).emitEffect(e,{type:cm.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?Xb.SUCCESS:Xb.NEUTRAL}:t={text:e},s(this,Ut).emitEffect(e.toString(),{type:cm.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,Ut).emitEffect(t,{type:cm.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}};Ut=new WeakMap;var Zb=new Proxy({},{get:function(r,e,t){throw new Error(`Unimplemented API: ${String(e)}`)}}),Md=class{buildContext(e,t){let i=new ti(t),n=new Qr(t),o=new si(t),a=new ii(t),u=new oi(t),p=new ai(t),f=new Ud(e),g=new ei(t),c=new Yr(t,()=>m.assetsPlugin),h=new ui(t),C={modLog:i,kvStore:n,redis:o,reddit:a,scheduler:u,settings:p,media:g,assets:c,realtime:h,ui:f,useState:Vb,useChannel:Zb,useInterval:$b,useForm:Jb,cache:Zb},E=le(t);return E.debug.effects=e,{...E,...C}}};var ue=null;function Yb(r){return JSON.parse(JSON.stringify(r))}function gr(r,e){if(!ue)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.");let t=ue.nextHookId(r),i=ue,n={hookId:t,changed:()=>{i._changed[t]=!0,i._state[t]=i?._hooks[t]?.state},context:ue},o=ue._state[t]===void 0;ue._hooks[t]=ue._hooks[t]??e(n);let a=ue._hooks[t];return ue._state[t]!==void 0&&(a.state=ue._state[t]),a.onLoad&&a.onLoad(ue),o&&a.state!==void 0&&a.state!==null&&n.changed(),a}var UF=null,Si,_d,gs,hs,mm,Nd,Qb,ys,pm,qd,e0,vs,fm,bs,gm,wi,Ld,Ps,hm,Hd,t0,Dd=class{constructor(e){l(this,hs);l(this,Nd);l(this,ys);l(this,qd);l(this,vs);l(this,bs);l(this,wi);l(this,Ps);l(this,Hd);l(this,Si,void 0);l(this,_d,new Md);l(this,gs,new fi);this._latestRenderContext=null;d(this,Si,e),UF=this}async handle(e,t){let i=new bi(e),n=s(this,_d).buildContext(i,t);i.devvitContext=n;let o,a=e.events,p=!e.events?.length||a.some(h=>!h.async),f=a.some(h=>h.blocking),g,c=[...a];for(;a.length>0;){let h=[];if(!a[0].async)h.push(a.shift());else for(;a[0]?.async;)h.push(a.shift());if(!h.length)throw Error("batch must have at least one event");try{if(h[0].async){let P=Yb(i._state);await k(this,Nd,Qb).call(this,i,...h),i._state=P}else await k(this,qd,e0).call(this,i,...h)}catch(P){if(g){i._state=g._state,i._effects=g._effects,c.forEach((w,C)=>{let E={type:OF.EFFECT_SEND_EVENT,sendEvent:{event:w}};i.emitEffect(`remaining-${C}`,E)});break}else throw P}for(let[P,w]of Object.entries(i._effects))if(w.sendEvent?.event){if(!p&&!w.sendEvent?.event?.async||p&&w.sendEvent?.event?.async&&!f)break;let C=w.sendEvent.event;a.push(C),delete i._effects[P]}a.length>0&&(g={_state:Yb(i._state),_effects:{...i._effects}},c=[...a])}if(p){let h=k(this,vs,fm).call(this,s(this,Si),i._rootProps??{},i);h&&(o=await s(this,gs).createBlocksElementOrThrow(h),o=await s(this,gs).ensureRootBlock(o))}return{state:i._state,effects:i.effects,blocks:o}}};Si=new WeakMap,_d=new WeakMap,gs=new WeakMap,hs=new WeakSet,mm=function(e,...t){k(this,vs,fm).call(this,s(this,Si),e.request.props??{},e)},Nd=new WeakSet,Qb=async function(e,...t){k(this,hs,mm).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 k(this,ys,pm).call(this,e,i)}))},ys=new WeakSet,pm=async function(e,t){let i=e._hooks[t.hook];if(i&&i.onUIEvent)try{await i.onUIEvent(t,e)}catch(n){throw console.error("Error in event handler",n),n}else await e.handleUndeliveredEvent(t)},qd=new WeakSet,e0=async function(e,...t){for(let i of t)k(this,hs,mm).call(this,e,i),e._state.__generation=Number(e._state.__generation??0)+1,await k(this,ys,pm).call(this,e,i)},vs=new WeakSet,fm=function(e,t,i){i._generated={},ue=i,this._latestRenderContext=i;try{let n=k(this,bs,gm).call(this,e,t,i);if(n.length!==1)throw new Error("only one root");let o=n[0];if(typeof o=="string")throw new Error("There must be a root tag. Try wrapping your app in a <text></text>, <vstack> or other tag.");return o}catch(n){if(n instanceof ps)return;throw n}finally{ue=null}},bs=new WeakSet,gm=function(e,t,i){i.push({namespace:e.name,...t});try{let n=e(t,i.devvitContext);return k(this,Ps,hm).call(this,n,i)}finally{i.pop()}},wi=new WeakSet,Ld=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)),k(this,Ps,hm).call(this,i,t)))},Ps=new WeakSet,hm=function(e,t){if(Array.isArray(e))return k(this,wi,Ld).call(this,e,t);if(MF(e)){if(e.type===void 0)return k(this,wi,Ld).call(this,e.children,t);if(typeof e.type=="function"){let i={...e.props,children:e.children};return k(this,bs,gm).call(this,e.type,i,t)}else{t.push({namespace:e.type,...e.props});let i=k(this,wi,Ld).call(this,e.children,t),n=k(this,Hd,t0).call(this,e.props??{});return t.pop(),[{type:e.type,children:i,props:n}]}}else return[(e??"").toString()]},Hd=new WeakSet,t0=function(e){let t={};for(let i in e)if(typeof e[i]=="function"){let n=gr({namespace:i,key:!1},({hookId:o})=>({hookId:o,state:null,onUIEvent:e[i]}));t[i]=n.hookId,"captureHookRef"in e[i]&&e[i].captureHookRef()}else{let n=e[i];n!=null&&(t[i]=n.toString())}return t};function MF(r){return typeof r=="object"&&r!=null&&"type"in r}var LF=[[r0,r0.methods.renderPostContent,(r,e)=>m.customPostType?.render(e)??null]];function DF(r){return async(e,t)=>new Dd(r).handle(e,t)}function i0(r){for(let[e,t,i]of LF)r.provides(e),U(t.name,DF(i))}var ks,Ii,hr,yr,vr,xi,Ci,Mt,br,M,N,G,_=class _ extends Qa{static configure(e){d(this,ks,e),ut(e.http)&&k(this,N,G).call(this,I.HTTPDefinition),(ut(e.kvStore)||ut(e.redis))&&(k(this,N,G).call(this,I.KVStoreDefinition),k(this,N,G).call(this,I.RedisAPIDefinition)),ut(e.media)&&k(this,N,G).call(this,I.MediaServiceDefinition),ut(e.modLog)&&k(this,N,G).call(this,I.ModlogDefinition),ut(e.redditAPI)&&(k(this,N,G).call(this,I.FlairDefinition),k(this,N,G).call(this,I.GraphQLDefinition),k(this,N,G).call(this,I.LinksAndCommentsDefinition),k(this,N,G).call(this,I.ListingsDefinition),k(this,N,G).call(this,I.ModerationDefinition),k(this,N,G).call(this,I.ModNoteDefinition),k(this,N,G).call(this,I.NewModmailDefinition),k(this,N,G).call(this,I.PrivateMessagesDefinition),k(this,N,G).call(this,I.SubredditsDefinition),k(this,N,G).call(this,I.PostCollectionsDefinition),k(this,N,G).call(this,I.UsersDefinition),k(this,N,G).call(this,I.WidgetsDefinition),k(this,N,G).call(this,I.WikiDefinition),k(this,N,G).call(this,I.RedditAPIV2Definition)),ut(e.realtime)&&k(this,N,G).call(this,I.RealtimeDefinition)}static addMenuItem(e){s(this,Ii).push(e)}static addCustomPostType(e){d(this,hr,e)}static createForm(e,t){let i=`form.${s(this,yr).size}`;return s(this,yr).set(i,{form:e,onSubmit:t}),i}static addSchedulerJob(e){if(s(this,M)[I.SchedulerDefinition.fullName]||k(this,N,G).call(this,I.SchedulerDefinition),s(this,vr).has(e.name))throw new Error(`Job ${e.name} is already defined`);s(this,vr).set(e.name,e.onRun)}static addSettings(e){ir(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,xi,t),i.length>0&&d(this,Ci,i),s(this,M)[I.SettingsDefinition.fullName]||k(this,N,G).call(this,I.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,Mt).has(e.event)?s(this,Mt).get(e.event)?.push(e.onEvent):s(this,Mt).set(e.event,[e.onEvent]),_}static get redditAPIPlugins(){if(!ut(s(this,ks).redditAPI))throw new Error("Reddit API is not enabled. You can enable it by passing `redditAPI: true` to `Devvit.configure`.");return{Flair:s(this,M)[I.FlairDefinition.fullName],GraphQL:s(this,M)[I.GraphQLDefinition.fullName],LinksAndComments:s(this,M)[I.LinksAndCommentsDefinition.fullName],Listings:s(this,M)[I.ListingsDefinition.fullName],Moderation:s(this,M)[I.ModerationDefinition.fullName],ModNote:s(this,M)[I.ModNoteDefinition.fullName],NewModmail:s(this,M)[I.NewModmailDefinition.fullName],PrivateMessages:s(this,M)[I.PrivateMessagesDefinition.fullName],Subreddits:s(this,M)[I.SubredditsDefinition.fullName],PostCollections:s(this,M)[I.PostCollectionsDefinition.fullName],Users:s(this,M)[I.UsersDefinition.fullName],Widgets:s(this,M)[I.WidgetsDefinition.fullName],Wiki:s(this,M)[I.WikiDefinition.fullName]}}static get modLogPlugin(){let e=s(this,M)[I.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,M)[I.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,M)[I.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,M)[I.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,M)[I.MediaServiceDefinition.fullName];if(!e)throw new Error("MediaService is not enabled. You can enable it by passing `media: true` to `Devvit.configure`");return e}static get redditapiv2Plugin(){let e=s(this,M)[I.RedditAPIV2Definition.fullName];if(!e)throw new Error("RedditAPIV2 is not enabled. You can enable it by passing `apiV2: true` to `Devvit.configure`");return e}static get assetsPlugin(){let e=s(this,M)[I.AssetResolverDefinition.fullName];if(!e)throw new Error("AssetsService is not available. This should not happen, and indicates a setup problem with the runtime.");return e}static get settingsPlugin(){let e=s(this,M)[I.SettingsDefinition.fullName];if(!e)throw new Error("Settings is not enabled. You can enable it by passing `settings: true` to `Devvit.configure`");return e}static get realtimePlugin(){let e=s(this,M)[I.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,Ii)}static get customPostType(){return s(this,hr)}static get formDefinitions(){return s(this,yr)}static get scheduledJobHandlers(){return s(this,vr)}static get installationSettings(){return s(this,xi)}static get appSettings(){return s(this,Ci)}static get triggerOnEventHandlers(){return s(this,Mt)}constructor(e){var t;super(e),k(t=_,N,G).call(t,I.AssetResolverDefinition);for(let i in s(_,br)){let n=s(_,br)[i];n.handler=e.use(n.def,n.options)}s(_,Ii).length>0&&$v(e),s(_,vr).size>0&&Jv(e),s(_,hr)&&(Gv(e),i0(e)),(s(_,hr)||s(_,yr).size>0)&&zb(e),s(_,xi)&&zv(e),s(_,Ci)&&Sv(e),s(_,Mt).size>0&&Kv(e)}};ks=new WeakMap,Ii=new WeakMap,hr=new WeakMap,yr=new WeakMap,vr=new WeakMap,xi=new WeakMap,Ci=new WeakMap,Mt=new WeakMap,br=new WeakMap,M=new WeakMap,N=new WeakSet,G=function(e,t){s(this,br)[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,br)[e.fullName].handler?.[n.name]?.(n.requestType?.fromPartial(o??{}),a);return s(this,M)[e.fullName]=i,i},l(_,N),_.debug={emitSnapshots:!1,emitState:!1},l(_,ks,{}),l(_,Ii,[]),l(_,hr,void 0),l(_,yr,new Map),l(_,vr,new Map),l(_,xi,void 0),l(_,Ci,void 0),l(_,Mt,new Map),l(_,br,{}),l(_,M,{});var m=_;(e=>{function r(t,i,...n){return{type:t,props:i,children:n}}e.createElement=r})(m||(m={}));function $(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 n0="text",s0="raw",o0="br",a0="link",d0="c/",l0="p/",u0="r/",c0="u/",m0="@",p0="spoilertext",f0="par",g0="h",h0="hr",y0="blockquote",v0="code",b0="li",P0="list",k0="L",S0="R",w0="C",I0="table",x0="embed",C0="img",A0="gif",E0="video";function T0(r){return{e:A0,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function R0(r,e){let t={},i=[];return Object.assign(t,Ss(t,i),ws(t,i),Is(t,i),As(t,i),Es(t,i),Ts(t,i)),e(t),{e:y0,c:i,...r.author&&{a:r.author}}}function F0(r,e){let t={},i=[];return Object.assign(t,bm(t,i)),e(t),{e:v0,c:i,...r.language&&{l:r.language}}}function B0(r){return{e:d0,t:r.permalink}}function O0(r,e){let t={},i=[];return Object.assign(t,bm(t,i),Cs(t,i)),e(t),{e:g0,l:r.level,c:i}}function U0(r){return{e:x0,u:r.sourceUrl,c:r.contentUrl,x:r.width,y:r.height}}function M0(){return{e:h0}}function L0(r){return{e:C0,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function D0(){return{e:o0}}function _0(r){return{e:a0,t:r.text,u:r.url,...r.formatting&&{f:r.formatting},...r.tooltip&&{a:r.tooltip}}}function N0(r,e){let t={},i=[];return Object.assign(t,tP(t,i)),e(t),{e:P0,o:r.ordered,c:i}}function q0(r){let e={},t=[];return Object.assign(e,Ss(e,t),ws(e,t),Is(e,t),jd(e,t),As(e,t),Es(e,t),Ts(e,t)),r(e),{e:b0,c:t}}function H0(r){let e={},t=[];return Object.assign(e,Wd(e,t),Cs(e,t),vm(e,t),Pm(e,t),xs(e,t)),r(e),{e:f0,c:t}}function j0(r){return{e:l0,t:r.permalink}}function W0(r){return{e:s0,t:r}}function G0(r){let e={},t=[];return Object.assign(e,Wd(e,t),Cs(e,t),vm(e,t)),r(e),{e:p0,c:t}}function z0(r){return{e:u0,t:r.subredditName,l:r.showPrefix}}function V0(r){let e={},t=[],i=[];return Object.assign(e,rP(e,t,i)),r(e),{e:I0,h:t,c:i}}function $0(r){let[e,t]=eP();return r(e),{c:t}}function J0(r,e){let[t,i]=eP();e(t);let n;switch(r.columnAlignment){case"left":n=k0;break;case"right":n=S0;break;case"center":n=w0;break}return{...n&&{a:n},...i&&{c:i}}}function K0(r){let e={},t=[];return Object.assign(e,iP(e,t)),r(e),t}function X0(r){return{e:n0,t:r.text,...r.formatting&&{f:r.formatting}}}function Z0(r){return{e:c0,t:r.username,l:r.showPrefix}}function Y0(r){return{e:m0,t:r.username,l:r.showPrefix}}function Q0(r){return{e:E0,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur},...r.thumbnail&&{p:r.thumbnail},...r.convertToGif&&{gifify:r.convertToGif}}}function eP(){let r={},e=[];return Object.assign(r,Wd(r,e),Cs(r,e),Pm(r,e),xs(r,e)),[r,e]}function Ss(r,e){return{blockQuote(t,i){return e.push(R0(t,i)),r}}}function ws(r,e){return{codeBlock(t,i){return e.push(F0(t,i)),r}}}function nP(r,e){return{embed(t){return e.push(U0(t)),r}}}function Is(r,e){return{heading(t,i){return e.push(O0(t,i)),r}}}function jd(r,e){return{horizontalRule(){return e.push(M0()),r}}}function xs(r,e){return{image(t){return e.push(L0(t)),r},animatedImage(t){return e.push(T0(t)),r}}}function vm(r,e){return{linebreak(){return e.push(D0()),r}}}function Cs(r,e){return{link(t){return e.push(_0(t)),r},commentLink(t){return e.push(B0(t)),r},postLink(t){return e.push(j0(t)),r},subredditLink(t){return e.push(z0(t)),r},userLink(t){return e.push(Z0(t)),r},userMention(t){return e.push(Y0(t)),r}}}function As(r,e){return{list(t,i){return e.push(N0(t,i)),r}}}function tP(r,e){return{item(t){return e.push(q0(t)),r}}}function Es(r,e){return{paragraph(t){return e.push(H0(t)),r}}}function bm(r,e){return{rawText(t){return e.push(W0(t)),r}}}function Pm(r,e){return{spoiler(t){return e.push(G0(t)),r}}}function rP(r,e,t){return{headerCell(i,n){return e.push(J0(i,n)),r},row(i){return t.push(K0(i)),r}}}function Ts(r,e){return{table(t){return e.push(V0(t)),r}}}function iP(r,e){return{cell(t){return e.push($0(t)),r}}}function Wd(r,e){return{text(t){return e.push(X0(t)),r}}}function sP(r,e){return{video(t){return e.push(Q0(t)),r}}}var _F=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},NF=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,Rs=class{constructor(){Gd.set(this,void 0);let e=[];Object.assign(this,Es(this,e),Is(this,e),jd(this,e),Ss(this,e),ws(this,e),nP(this,e),As(this,e),Ts(this,e),xs(this,e),sP(this,e)),_F(this,Gd,{document:e},"f")}build(){return JSON.stringify(NF(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 Ai(r){let e;return r instanceof Rs?e=r.build():typeof r=="object"?e=JSON.stringify(r):e=r,e}var oP=100,aP=1/0,Pr,kr,Lt,Ei,Ti,zd,j=class{constructor(e){l(this,Ti);l(this,Pr,void 0);l(this,kr,void 0);l(this,Lt,void 0);l(this,Ei,!1);this.pageSize=oP;this.limit=aP;this.children=[];$(this),this._fetch=e.fetch,this.pageSize=e.pageSize??oP,this.limit=e.limit??aP,d(this,kr,e.after),d(this,Pr,e.before),d(this,Lt,e.more),e.children&&(this.children=e.children)}get hasMore(){return!s(this,Ei)||!!(s(this,kr)||s(this,Pr)||s(this,Lt))}async*[Symbol.asyncIterator](){let e=0;for(;;){if(e===this.children.length)if(this.hasMore){if((await k(this,Ti,zd).call(this)).length===0)break}else break;if(yield this.children[e],e++,e===this.limit)break}}setMore(e){d(this,Lt,e)}preventInitialFetch(){d(this,Ei,!0)}async all(){for(;this.hasMore&&this.children.length<this.limit;)await k(this,Ti,zd).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 k(this,Ti,zd).call(this);return this.children.slice(0,t)}};Pr=new WeakMap,kr=new WeakMap,Lt=new WeakMap,Ei=new WeakMap,Ti=new WeakSet,zd=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,Pr),after:s(this,kr),limit:this.pageSize,more:s(this,Lt)});return this.children.push(...e),d(this,Pr,t),d(this,kr,i),d(this,Lt,n),d(this,Ei,!0),e};function qF(r){try{return!0}catch{return!1}}function HF(r){try{return!0}catch{return!1}}var Fs,km,Ue=class{constructor(){}static get(e,t){let i=m.redditAPIPlugins.ModNote;return new j({hasMore:!0,before:e.before,limit:e.limit,pageSize:e.limit,fetch:async n=>{let o=await i.GetNotes({subreddit:e.subreddit,user:e.user,filter:e.filter,before:n.before,limit:n.limit},t);return{children:o.modNotes?.map(a=>k(this,Fs,km).call(this,a))||[],before:o.hasNextPage?o.endCursor:void 0,hasMore:o.hasNextPage}}})}static async delete(e,t){let i=m.redditAPIPlugins.ModNote,{deleted:n}=await i.DeleteNotes(e,t);return!!n}static async add(e,t){let n=await m.redditAPIPlugins.ModNote.PostNotes(e,t);if(!n?.created)throw new Error("Failed to create mod note");return k(this,Fs,km).call(this,n.created)}static async addRemovalNote(e,t){await m.redditAPIPlugins.ModNote.PostRemovalNote(e,t)}};Fs=new WeakSet,km=function(e){if(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"),!qF(e.userNoteData?.label??""))throw new Error(`Invalid user note label: ${e.userNoteData?.label}`);if(!HF(e.type))throw new Error(`Invalid mod note type: ${e.type}`);return{id:e.id,user:{id:ge(e.userId??""),name:e.user},subreddit:{id:Re(e.subredditId??""),name:e.subreddit},operator:{id:ge(e.operatorId??""),name:e.operator},createdAt:new Date(e.createdAt*1e3),userNote:{note:e.userNoteData?.note,redditId:Fe(e.userNoteData?.redditId??""),label:e.userNoteData?.label},type:e.type}},l(Ue,Fs);var Vd=class{static queryWithQueryString(e,t){return m.redditAPIPlugins.GraphQL.Query({query:e},t)}static query(e,t,i,n){return m.redditAPIPlugins.GraphQL.PersistedQuery({operationName:e,id:t,variables:i},n)}};var dP=["all","wiki","posts","access","mail","config","flair","chat_operator","chat_config"];function jF(r,e,t=!1){let i=t?"%2b":"+";return e.map(n=>(r.includes(n)?i:"-")+n).join(",")}function Sm(r){return jF(r,dP,!0)}function lP(r){if(dP.includes(r))return r;throw new Error(`Invalid moderator permission: ${r}`)}var WF=(t=>(t.User="USER_FLAIR",t.Post="LINK_FLAIR",t))(WF||{}),Sr,Ri,Fi,Bi,Oi,Ui,Mi,Li,Di,_i,Ni,$d,$e=class $e{constructor(e,t,i){l(this,Sr,void 0);l(this,Ri,void 0);l(this,Fi,void 0);l(this,Bi,void 0);l(this,Oi,void 0);l(this,Ui,void 0);l(this,Mi,void 0);l(this,Li,void 0);l(this,Di,void 0);l(this,_i,void 0);$(this),v(e.id),v(e.text),d(this,Sr,e.id),d(this,Ri,t),d(this,Fi,e.text),d(this,Bi,GF(e.textColor)),d(this,Oi,zF(e.backgroundColor)),d(this,Ui,VF(e.allowableContent)),d(this,Mi,e.modOnly),d(this,Li,e.maxEmojis),d(this,Di,e.textEditable),d(this,_i,i)}get id(){return s(this,Sr)}get text(){return s(this,Fi)}get textColor(){return s(this,Bi)}get backgroundColor(){return s(this,Oi)}get allowableContent(){return s(this,Ui)}get modOnly(){return s(this,Mi)}get maxEmojis(){return s(this,Li)}get allowUserEdits(){return s(this,Di)}async delete(){return $e.deleteFlairTemplate(s(this,Sr),s(this,Ri),s(this,_i))}async edit(e){return $e.editFlairTemplate({id:s(this,Sr),subredditName:s(this,Ri),text:e.text??s(this,Fi),allowableContent:e.allowableContent??s(this,Ui),backgroundColor:e.backgroundColor??s(this,Oi),maxEmojis:e.maxEmojis??s(this,Li),modOnly:e.modOnly??s(this,Mi),textColor:e.textColor??s(this,Bi),allowUserEdits:e.allowUserEdits??s(this,Di)},s(this,_i))}static async createPostFlairTemplate(e,t){var i;return k(i=$e,Ni,$d).call(i,{...e,flairType:"LINK_FLAIR"},t)}static async createUserFlairTemplate(e,t){var i;return k(i=$e,Ni,$d).call(i,{...e,flairType:"USER_FLAIR"},t)}static async editFlairTemplate(e,t){var i;return k(i=$e,Ni,$d).call(i,e,t)}static async getPostFlairTemplates(e,t){return(await m.redditAPIPlugins.Flair.LinkFlair({subreddit:e},t)).flair?.map(o=>new $e(o,e,t))||[]}static async getUserFlairTemplates(e,t){return(await m.redditAPIPlugins.Flair.UserFlair({subreddit:e},t)).flair?.map(o=>new $e(o,e,t))||[]}static async deleteFlairTemplate(e,t,i){await m.redditAPIPlugins.Flair.DeleteFlairTemplate({subreddit:e,flairTemplateId:t},i)}};Sr=new WeakMap,Ri=new WeakMap,Fi=new WeakMap,Bi=new WeakMap,Oi=new WeakMap,Ui=new WeakMap,Mi=new WeakMap,Li=new WeakMap,Di=new WeakMap,_i=new WeakMap,Ni=new WeakSet,$d=async function(e,t){let{subredditName:i,allowableContent:n="all",backgroundColor:o="transparent",flairType:a="",maxEmojis:u=10,modOnly:p=!1,text:f,textColor:g="dark",allowUserEdits:c=!1,id:h=""}=e;if(p&&c)throw new Error("Cannot have a mod only flair that is editable by users");let w=await m.redditAPIPlugins.Flair.FlairTemplate({subreddit:i,allowableContent:n,backgroundColor:o,flairType:a,maxEmojis:u,modOnly:p,text:f,textColor:g,textEditable:c,flairTemplateId:h,cssClass:"",overrideCss:!1},t);return new $e(w,i,t)},l($e,Ni);var de=$e;function Us(r){return{flairCssClass:r.flairCssClass,user:r.user,flairText:r.flairText}}var Bs,wm,Os,Im,Dt=class Dt{static async getUserFlairBySubreddit(e,t){return m.redditAPIPlugins.Flair.FlairList(e,t)}static setUserFlair(e,t){var i;return k(i=Dt,Bs,wm).call(i,e,t)}static setPostFlair(e,t){var i;return k(i=Dt,Bs,wm).call(i,{...e,postId:he(e.postId)},t)}static async removePostFlair(e,t,i){var n;return k(n=Dt,Os,Im).call(n,e,t,void 0,i)}static async removeUserFlair(e,t,i){var n;return k(n=Dt,Os,Im).call(n,e,void 0,t,i)}};Bs=new WeakSet,wm=async function(e,t){await m.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)},Os=new WeakSet,Im=async function(e,t,i,n){await m.redditAPIPlugins.Flair.SelectFlair({subreddit:e,name:i??"",link:t??"",flairTemplateId:"",backgroundColor:"",text:"",textColor:"",cssClass:"",returnRtjson:"none"},n)},l(Dt,Bs),l(Dt,Os);var Me=Dt;function GF(r){if(v(r,"Flair text color is required"),r==="light"||r==="dark")return r;throw new Error(`Invalid flair text color: ${r}`)}function zF(r){if(v(r,"Flair background color is required"),r==="transparent"||/^#([A-Fa-f0-9]{6})$/.test(r))return r;throw new Error(`Invalid flair background color: ${r}`)}function VF(r){if(r==="all"||r==="text"||r==="emoji")return r;throw new Error(`Invalid allowable content: ${r}`)}import{Block as $F}from"@devvit/protos";var uP=Cn(hc(),1);var qi,Ls,Hi,Ds,_s,Ns,qs,Hs,ji,js,Ws,Gs,zs,Vs,$s,_t,wr,Wi,Nt,Gi,zi,Vi,Ir,qt,Ht,$i,jt,Wt,Gt,pt,Js,Ks,Ji,Ki,L,q=class q{constructor(e,t){l(this,qi,void 0);l(this,Ls,void 0);l(this,Hi,void 0);l(this,Ds,void 0);l(this,_s,void 0);l(this,Ns,void 0);l(this,qs,void 0);l(this,Hs,void 0);l(this,ji,void 0);l(this,js,void 0);l(this,Ws,void 0);l(this,Gs,void 0);l(this,zs,void 0);l(this,Vs,void 0);l(this,$s,void 0);l(this,_t,void 0);l(this,wr,void 0);l(this,Wi,void 0);l(this,Nt,void 0);l(this,Gi,void 0);l(this,zi,void 0);l(this,Vi,void 0);l(this,Ir,void 0);l(this,qt,void 0);l(this,Ht,void 0);l(this,$i,void 0);l(this,jt,void 0);l(this,Wt,void 0);l(this,Gt,void 0);l(this,pt,void 0);l(this,Js,void 0);l(this,Ks,void 0);l(this,Ji,void 0);l(this,Ki,void 0);l(this,L,void 0);$(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,qi,he(`t3_${e.id}`)),d(this,Hi,e.author),d(this,Ls,e.authorFullname?ge(e.authorFullname):void 0),d(this,_s,Re(e.subredditId)),d(this,Ns,e.subreddit),d(this,Gs,e.score??0),d(this,zs,e.numComments??0),d(this,Vs,e.numReports??0);let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Ds,i),d(this,Hs,e.title),d(this,ji,e.selftext),d(this,js,e.selftextHtml),d(this,Ws,e.url),d(this,qs,e.permalink),e.thumbnail&&e.thumbnail!=="self"&&e.thumbnail!=="nsfw"&&e.thumbnailHeight!=null&&e.thumbnailWidth!=null&&d(this,$s,{url:e.thumbnail,height:e.thumbnailHeight,width:e.thumbnailWidth}),d(this,_t,e.approved??!1),d(this,Nt,e.removed??!1),d(this,Gi,e.removedBy),d(this,zi,e.removedByCategory),d(this,wr,e.spam??!1),d(this,Wi,e.stickied??!1),d(this,Vi,e.archived??!1),d(this,Ir,e.edited??!1),d(this,qt,e.locked??!1),d(this,Ht,e.over18??!1),d(this,$i,e.quarantine??!1),d(this,jt,e.spoiler),d(this,Wt,e.hidden??!1),d(this,Gt,e.ignoreReports??!1),d(this,pt,e.distinguished),d(this,Ks,e.secureMedia),d(this,Ji,(e.modReports??[]).map(([n])=>n)),d(this,Ki,(e.userReports??[]).map(([n])=>n)),d(this,L,t),(e.linkFlairBackgroundColor||e.linkFlairCssClass||e.linkFlairText||e.linkFlairType||e.linkFlairTemplateId||e.linkFlairRichtext||e.linkFlairTextColor)&&d(this,Js,{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})=>({elementType:n,text:o,emojiRef:a,url:u})),textColor:e.linkFlairTextColor})}get id(){return s(this,qi)}get authorId(){return s(this,Ls)}get authorName(){return s(this,Hi)}get subredditId(){return s(this,_s)}get subredditName(){return s(this,Ns)}get permalink(){return s(this,qs)}get title(){return s(this,Hs)}get body(){return s(this,ji)}get bodyHtml(){return s(this,js)}get url(){return s(this,Ws)}get thumbnail(){return s(this,$s)}get createdAt(){return s(this,Ds)}get score(){return s(this,Gs)}get numberOfComments(){return s(this,zs)}get numberOfReports(){return s(this,Vs)}get approved(){return s(this,_t)}get spam(){return s(this,wr)}get stickied(){return s(this,Wi)}get removed(){return s(this,Nt)}get removedBy(){return s(this,Gi)}get removedByCategory(){return s(this,zi)}get archived(){return s(this,Vi)}get edited(){return s(this,Ir)}get locked(){return s(this,qt)}get nsfw(){return s(this,Ht)}get quarantined(){return s(this,$i)}get spoiler(){return s(this,jt)}get hidden(){return s(this,Wt)}get ignoringReports(){return s(this,Gt)}get distinguishedBy(){return s(this,pt)}get comments(){return Z.getComments({postId:this.id},s(this,L))}get flair(){return s(this,Js)}get secureMedia(){return s(this,Ks)}get userReportReasons(){return s(this,Ki)}get modReportReasons(){return s(this,Ji)}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,Gi),removedByCategory:s(this,zi),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,Ji),userReportReasons:s(this,Ki)}}isApproved(){return s(this,_t)}isSpam(){return s(this,wr)}isStickied(){return s(this,Wi)}isRemoved(){return s(this,Nt)}isArchived(){return s(this,Vi)}isEdited(){return s(this,Ir)}isLocked(){return s(this,qt)}isNsfw(){return s(this,Ht)}isQuarantined(){return s(this,$i)}isSpoiler(){return s(this,jt)}isHidden(){return s(this,Wt)}isIgnoringReports(){return s(this,Gt)}isDistinguishedBy(){return s(this,pt)}async edit(e){let t=await q.edit({id:this.id,...e},s(this,L));d(this,ji,t.body),d(this,Ir,t.edited)}async addComment(e){return Z.submit({id:this.id,...e},s(this,L))}async delete(){return q.delete(this.id,s(this,L))}async approve(){await q.approve(this.id,s(this,L)),d(this,_t,!0),d(this,Nt,!1)}async remove(e=!1){await q.remove(this.id,e,s(this,L)),d(this,Nt,!0),d(this,wr,e),d(this,_t,!1)}async lock(){await q.lock(this.id,s(this,L)),d(this,qt,!0)}async unlock(){await q.unlock(this.id,s(this,L)),d(this,qt,!1)}async hide(){await q.hide(this.id,s(this,L)),d(this,Wt,!0)}async unhide(){await q.unhide(this.id,s(this,L)),d(this,Wt,!1)}async markAsNsfw(){await q.markAsNsfw(this.id,s(this,L)),d(this,Ht,!0)}async unmarkAsNsfw(){await q.unmarkAsNsfw(this.id,s(this,L)),d(this,Ht,!1)}async markAsSpoiler(){await q.markAsSpoiler(this.id,s(this,L)),d(this,jt,!0)}async unmarkAsSpoiler(){await q.unmarkAsSpoiler(this.id,s(this,L)),d(this,jt,!1)}async sticky(e){await q.sticky(this.id,e,s(this,L))}async unsticky(){await q.unsticky(this.id,s(this,L))}async distinguish(){let{distinguishedBy:e}=await q.distinguish(this.id,!1,s(this,L));d(this,pt,e)}async distinguishAsAdmin(){let{distinguishedBy:e}=await q.distinguish(this.id,!0,s(this,L));d(this,pt,e)}async undistinguish(){let{distinguishedBy:e}=await q.undistinguish(this.id,s(this,L));d(this,pt,e)}async ignoreReports(){await q.ignoreReports(this.id,s(this,L)),d(this,Gt,!0)}async unignoreReports(){await q.unignoreReports(this.id,s(this,L)),d(this,Gt,!1)}async getAuthor(){return x.getByUsername(s(this,Hi),s(this,L))}async crosspost(e){return q.crosspost({...e,postId:this.id},s(this,L))}addRemovalNote(e){return Ue.addRemovalNote({itemIds:[s(this,qi)],...e},s(this,L))}static async getById(e,t){let i=m.redditAPIPlugins.LinksAndComments,n=rr(e)?e:`t3_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.length)throw new Error("could not find post");let a=o.data.children[0];if(!a?.data)throw new Error("could not find post");return new q(a.data,t)}static async submit(e,t){let i=m.redditAPIPlugins.LinksAndComments,n;if("preview"in e){v(t,"Missing metadata in `SubmitPostOptions`");let u=await new lt(()=>e.preview,void 0,{},t,void 0).buildBlocksUI(),p=$F.encode(u).finish();n=await i.Submit({kind:"custom",sr:e.subredditName,richtextJson:(0,uP.fromByteArray)(p),...e},t)}else n=await i.Submit({kind:"kind"in e?e.kind:"url"in e?"link":"self",sr:e.subredditName,richtextJson:"richtext"in e?Ai(e.richtext):void 0,...e},t);if("kind"in e&&["image","video","videogif"].includes(e.kind)&&!n.json?.data?.id&&"url"in e)throw new Error(`Post of ${e.kind} type with ${e.url} is being created asynchronously and should be updated in the subreddit soon.`);if(!n.json?.data?.id||n.json?.errors?.length)throw new Error(`failed to submit post - either post ID is empty or request failed with errors: ${n.json?.errors}`);return q.getById(`t3_${n.json.data.id}`,t)}static async crosspost(e,t){let i=m.redditAPIPlugins.LinksAndComments,{postId:n,subredditName:o,...a}=e,u=await i.Submit({kind:"crosspost",sr:o,crosspostFullname:he(n),...a},t);if(!u.json?.data?.id||u.json?.errors?.length)throw new Error("failed to crosspost post");return q.getById(`t3_${u.json.data.id}`,t)}static async edit(e,t){let i=m.redditAPIPlugins.LinksAndComments,{id:n}=e,o;if("richtext"in e&&(o=Ai(e.richtext)),(await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t)).json?.errors?.length)throw new Error("Failed to edit post");return q.getById(n,t)}static async delete(e,t){await m.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await m.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await m.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async hide(e,t){await m.redditAPIPlugins.LinksAndComments.Hide({id:e},t)}static async unhide(e,t){await m.redditAPIPlugins.LinksAndComments.Unhide({id:e},t)}static async markAsNsfw(e,t){await m.redditAPIPlugins.LinksAndComments.MarkNSFW({id:e},t)}static async unmarkAsNsfw(e,t){await m.redditAPIPlugins.LinksAndComments.UnmarkNSFW({id:e},t)}static async markAsSpoiler(e,t){await m.redditAPIPlugins.LinksAndComments.Spoiler({id:e},t)}static async unmarkAsSpoiler(e,t){await m.redditAPIPlugins.LinksAndComments.Unspoiler({id:e},t)}static async sticky(e,t,i){await m.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!0,num:t},i)}static async unsticky(e,t){await m.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!1},t)}static async lock(e,t){await m.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await m.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async distinguish(e,t,i){let a=(await m.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 m.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 m.redditAPIPlugins.Moderation.IgnoreReports({id:e},t)}static async unignoreReports(e,t){await m.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=m.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Sort({show:"all",sort:e.sort,t:e.timeframe,subreddit:e.subredditName,...n},t);return Ms(o,t)}})}static getHotPosts(e={location:"GLOBAL"},t){let i=m.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Hot({g:e.location,show:"all",subreddit:e.subredditName,...n},t);return Ms(o,t)}})}static getNewPosts(e,t){let i=m.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.New({show:"all",subreddit:e.subredditName,...n},t);return Ms(o,t)}})}static getRisingPosts(e,t){let i=m.redditAPIPlugins.Listings;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Rising({show:"all",subreddit:e.subredditName,...n},t);return Ms(o,t)}})}static getPostsByUser(e,t){let i=m.redditAPIPlugins.Users;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"submitted",...n},t);return Ms(o,t)}})}};qi=new WeakMap,Ls=new WeakMap,Hi=new WeakMap,Ds=new WeakMap,_s=new WeakMap,Ns=new WeakMap,qs=new WeakMap,Hs=new WeakMap,ji=new WeakMap,js=new WeakMap,Ws=new WeakMap,Gs=new WeakMap,zs=new WeakMap,Vs=new WeakMap,$s=new WeakMap,_t=new WeakMap,wr=new WeakMap,Wi=new WeakMap,Nt=new WeakMap,Gi=new WeakMap,zi=new WeakMap,Vi=new WeakMap,Ir=new WeakMap,qt=new WeakMap,Ht=new WeakMap,$i=new WeakMap,jt=new WeakMap,Wt=new WeakMap,Gt=new WeakMap,pt=new WeakMap,Js=new WeakMap,Ks=new WeakMap,Ji=new WeakMap,Ki=new WeakMap,L=new WeakMap;var V=q;function Ms(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>new V(i.data,e)),before:r.data.before,after:r.data.after}}var Xs,Xi,Zs,Ys,Qs,eo,to,zt,ro,io,ft,xr=class xr{constructor(e,t){l(this,Xs,void 0);l(this,Xi,void 0);l(this,Zs,void 0);l(this,Ys,void 0);l(this,Qs,void 0);l(this,eo,void 0);l(this,to,void 0);l(this,zt,new Map);l(this,ro,void 0);l(this,io,void 0);l(this,ft,void 0);$(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,Xs,ge(Ya(e.id)?e.id:`t2_${e.id}`)),d(this,Xi,e.name),d(this,eo,e.over18??!1),d(this,to,e.isEmployee??!1);let i=new Date(0);if(i.setUTCSeconds(e.createdUtc),d(this,Zs,i),d(this,Ys,e.linkKarma??0),d(this,Qs,e.commentKarma??0),e.modPermissions)for(let[n,o]of Object.entries(e.modPermissions))s(this,zt).set(n,o.map(lP));d(this,ro,new URL(e.subreddit?.url??"","https://www.reddit.com").toString()),d(this,io,e.subreddit?.url??""),d(this,ft,t)}get id(){return s(this,Xs)}get username(){return s(this,Xi)}get createdAt(){return s(this,Zs)}get linkKarma(){return s(this,Ys)}get commentKarma(){return s(this,Qs)}get nsfw(){return s(this,eo)}get isAdmin(){return s(this,to)}get modPermissions(){return s(this,zt)}get url(){return s(this,ro)}get permalink(){return s(this,io)}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,zt).has(e))return s(this,zt).get(e);let t=await xr.getSubredditUsersByType({subredditName:e,type:"moderators",username:this.username},s(this,ft)).all();if(t.length===0)return[];let i=t[0].modPermissions.get(e)??[];return i.length>0&&s(this,zt).set(e,i),i}getComments(e){return Z.getCommentsByUser({username:this.username,...e},s(this,ft))}getPosts(e){return V.getPostsByUser({username:this.username,...e},s(this,ft))}async getUserFlairBySubreddit(e){let t=await Me.getUserFlairBySubreddit({subreddit:e,name:s(this,Xi)},s(this,ft));return t.users[0]?Us(t.users[0]):void 0}getSnoovatarUrl(){return xr.getSnoovatarUrl(this.username,s(this,ft))}static async getById(e,t){let o=(await m.redditAPIPlugins.Users.UserDataByAccountIds({ids:e},t))?.users?.[e]?.name;return v(o,"Expected the username in response to be not null"),xr.getByUsername(o,t)}static async getByUsername(e,t){let n=await m.redditAPIPlugins.Users.UserAbout({username:e},t);if(!n.data?.id)throw new Error("failed to get user");return new xr(n.data,t)}static async getFromMetadata(e,t){v(t);let i=ye(e,t);return v(i),xr.getById(ge(i),t)}static getSubredditUsersByType(e,t){let i=m.redditAPIPlugins.Subreddits;return new j({hasMore:!0,pageSize:e.pageSize,limit:e.limit,after:e.after,before:e.before,fetch:async n=>{let o=await i.AboutWhere({where:e.type,user:e.username,subreddit:e.subredditName,show:"all",...n},t);return KF(o,e.subredditName,t)}})}static async createRelationship(e,t){let i=m.redditAPIPlugins.Users,{type:n,subredditName:o,username:a,permissions:u,...p}=e,f=await i.Friend({type:n,subreddit:o,name:a,permissions:u?Sm(u):void 0,...p},t);if(f.json?.errors?.length)throw new Error(f.json.errors.join(`
4
4
  `))}static async removeRelationship(e,t){await m.redditAPIPlugins.Users.Unfriend({type:e.type,subreddit:e.subredditName,name:e.username},t)}static async setModeratorPermissions(e,t,i,n){let a=await m.redditAPIPlugins.Users.SetPermissions({subreddit:t,name:e,type:"moderator",permissions:Sm(i)},n);if(a.json?.errors?.length)throw new Error(a.json.errors.join(`
5
- `))}static async getSnoovatarUrl(e,t){let i="GetSnoovatarUrlByName",n="c47fd42345af268616d2d8904b56856acdc05cf61d3650380f539ad7d596ac0c";return(await Vd.query(i,n,{username:e},t)).data?.redditorInfoByName?.snoovatarIcon?.url}static getOverview(e,t){let i=m.redditAPIPlugins.Users;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"overview",...n},t);return $F(o,t)}})}};Xs=new WeakMap,Ki=new WeakMap,Zs=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,eo=new WeakMap,to=new WeakMap,zt=new WeakMap,ro=new WeakMap,io=new WeakMap,ft=new WeakMap;var x=Cr;function $F(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>{if(i.kind==="t3")return new V(i.data,e);if(i.kind==="t1")return new Z(i.data,e);throw new Error(`Type ${i.kind} is not supported`)}),before:r.data.before,after:r.data.after}}async function JF(r,e,t){let i=m.redditAPIPlugins.Users;if(!r.data?.children)throw new Error("Listing response is missing children");let n=r.data.children.map(g=>(v(g.data?.id,"User id is still from listing data"),g.data.id)),o=100,a=[];for(let g=0;g<n.length;g+=o)a.push(n.slice(g,g+o));let p=(await Promise.all(a.map(g=>i.UserDataByAccountIds({ids:g.join(",")},t)))).reduce((g,c)=>({...g,...c.users}),{});return{children:r.data.children.map(g=>{let c=g.data?.id;v(c,"User id is missing from listing");let h=p[c];return v(h,"User data is missing from response"),new x({id:c,name:h.name,linkKarma:h.linkKarma,commentKarma:h.commentKarma,createdUtc:h.createdUtc,over18:h.profileOver18,snoovatarSize:[],modPermissions:{[e]:g.data?.modPermissions??[]}},t)}),before:r.data.before,after:r.data.after}}var xr,no,Xi,Zi,so,oo,Yi,ao,lo,Qi,Vt,Ir,$t,Jt,gt,Ar,ht,uo,co,mo,po,fo,go,ho,Q,en,Jd,tn,Kd,W=class W{constructor(e,t){l(this,xr,void 0);l(this,no,void 0);l(this,Xi,void 0);l(this,Zi,void 0);l(this,so,void 0);l(this,oo,void 0);l(this,Yi,void 0);l(this,ao,void 0);l(this,lo,void 0);l(this,Qi,void 0);l(this,Vt,void 0);l(this,Ir,void 0);l(this,$t,void 0);l(this,Jt,void 0);l(this,gt,void 0);l(this,Ar,void 0);l(this,ht,void 0);l(this,uo,void 0);l(this,co,void 0);l(this,mo,void 0);l(this,po,void 0);l(this,fo,void 0);l(this,go,void 0);l(this,ho,void 0);l(this,Q,void 0);var n;$(this),v(e.id,"Comment id is null or undefined"),v(e.body,"Comment body is null or undefined"),v(e.createdUtc,"Comment is missing created date"),v(e.author,"Comment author is null or undefined"),v(e.parentId,"Comment parentId is null or undefined"),v(e.linkId,"Comment linkId is null or undefined"),v(e.permalink,"Comment permalink is null or undefined"),v(e.subreddit,"Comment is missing subreddit name"),v(e.subredditId,"Comment is missing subreddit id"),d(this,xr,jr(`t1_${e.id}`)),d(this,no,e.authorFullname?ge(e.authorFullname):void 0),d(this,Xi,e.author),d(this,Zi,e.body),d(this,ao,Re(e.subredditId)),d(this,lo,e.subreddit),d(this,oo,mc(e.parentId)?jr(e.parentId):he(e.parentId)),d(this,Yi,he(e.linkId)),d(this,Ir,e.edited??!1),d(this,$t,e.locked??!1),d(this,Jt,e.removed??!1),d(this,gt,e.stickied??!1),d(this,Vt,e.approved??!1),d(this,Ar,e.spam??!1),d(this,ht,e.distinguished),d(this,uo,e.numReports??0),d(this,co,e.collapsedBecauseCrowdControl??!1),d(this,mo,e.score??0),d(this,po,e.permalink),d(this,ho,new URL(e.permalink??"","https://www.reddit.com/").toString()),d(this,fo,(e.modReports??[]).map(([o])=>o)),d(this,go,(e.userReports??[]).map(([o])=>o));let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,so,i),d(this,Qi,k(n=W,en,Jd).call(n,{postId:s(this,Yi),commentId:s(this,xr)},t)),d(this,Q,t)}get id(){return s(this,xr)}get authorId(){return s(this,no)}get authorName(){return s(this,Xi)}get subredditId(){return s(this,ao)}get subredditName(){return s(this,lo)}get body(){return s(this,Zi)}get createdAt(){return s(this,so)}get parentId(){return s(this,oo)}get postId(){return s(this,Yi)}get replies(){return s(this,Qi)}get distinguishedBy(){return s(this,ht)}get locked(){return s(this,$t)}get stickied(){return s(this,gt)}get removed(){return s(this,Jt)}get approved(){return s(this,Vt)}get spam(){return s(this,Ar)}get edited(){return s(this,Ir)}get numReports(){return s(this,uo)}get collapsedBecauseCrowdControl(){return s(this,co)}get score(){return s(this,mo)}get permalink(){return s(this,po)}get userReportReasons(){return s(this,go)}get modReportReasons(){return s(this,fo)}get url(){return s(this,ho)}toJSON(){return{id:this.id,authorName:this.authorName,subredditId:this.subredditId,subredditName:this.subredditName,body:this.body,createdAt:this.createdAt,parentId:this.parentId,postId:this.postId,replies:this.replies,approved:this.approved,locked:this.locked,removed:this.removed,stickied:this.stickied,spam:this.spam,edited:this.edited,distinguishedBy:this.distinguishedBy,numReports:this.numReports,collapsedBecauseCrowdControl:this.collapsedBecauseCrowdControl,score:this.score,permalink:this.permalink,modReportReasons:this.modReportReasons,userReportReasons:this.userReportReasons,url:this.url}}isLocked(){return s(this,$t)}isApproved(){return s(this,Vt)}isRemoved(){return s(this,Jt)}isSpam(){return s(this,Ar)}isStickied(){return s(this,gt)}isDistinguished(){return!!s(this,ht)}isEdited(){return s(this,Ir)}async delete(){return W.delete(this.id,s(this,Q))}async edit(e){let t=await W.edit({id:this.id,...e},s(this,Q));return d(this,Zi,t.body),d(this,Ir,t.edited),this}async approve(){await W.approve(this.id,s(this,Q)),d(this,Vt,!0),d(this,Jt,!1)}async remove(e=!1){await W.remove(this.id,e,s(this,Q)),d(this,Jt,!0),d(this,Ar,e),d(this,Vt,!1)}async lock(){await W.lock(this.id,s(this,Q)),d(this,$t,!0)}async unlock(){await W.unlock(this.id,s(this,Q)),d(this,$t,!1)}async reply(e){return W.submit({id:this.id,...e},s(this,Q))}async getAuthor(){return x.getByUsername(s(this,Xi),s(this,Q))}async distinguish(e=!1){let{distinguishedBy:t,stickied:i}=await W.distinguish(this.id,e,!1,s(this,Q));d(this,ht,t),d(this,gt,i)}async distinguishAsAdmin(e=!1){let{distinguishedBy:t,stickied:i}=await W.distinguish(this.id,e,!0,s(this,Q));d(this,ht,t),d(this,gt,i)}async undistinguish(){let{distinguishedBy:e,stickied:t}=await W.undistinguish(this.id,s(this,Q));d(this,ht,e),d(this,gt,t)}addRemovalNote(e){return Oe.addRemovalNote({itemIds:[s(this,xr)],...e},s(this,Q))}static async getById(e,t){let i=m.redditAPIPlugins.LinksAndComments,n=kt(e)?e:`t1_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.[0]?.data)throw new Error("not found");return new W(o.data.children[0].data,t)}static getComments(e,t){var a;let{postId:i,commentId:n,...o}=e;return k(a=W,en,Jd).call(a,{postId:he(i),commentId:n?jr(n):void 0,...o},t)}static async edit(e,t){let i=m.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=Ii(e.richtext));let a=await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("Failed to edit comment");let u=a.json?.data?.things?.[0]?.data;return v(u),new W(u,t)}static async delete(e,t){await m.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await m.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await m.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async lock(e,t){await m.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await m.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async submit(e,t){let i=m.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=Ii(e.richtext));let a=await i.Comment({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("failed to reply to comment");let u=a.json?.data?.things?.[0]?.data;return v(u),new W(u,t)}static async distinguish(e,t,i,n){let u=(await m.redditAPIPlugins.Moderation.Distinguish({id:e,how:i?"admin":"yes",sticky:t},n)).json?.data?.things?.[0]?.data;return v(u),{distinguishedBy:u.distinguished,stickied:!!u.stickied}}static async undistinguish(e,t){let o=(await m.redditAPIPlugins.Moderation.Distinguish({id:e,how:"no",sticky:!1},t)).json?.data?.things?.[0]?.data;return v(o),{distinguishedBy:o.distinguished,stickied:!!o.stickied}}static getCommentsByUser(e,t){let i=m.redditAPIPlugins.Users;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"comments",...n},t);return v(o.data,"Failed to get comments for user"),{children:o.data.children?.map(u=>new W(u.data,t))||[],before:o.data.before,after:o.data.after}}})}};xr=new WeakMap,no=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,so=new WeakMap,oo=new WeakMap,Yi=new WeakMap,ao=new WeakMap,lo=new WeakMap,Qi=new WeakMap,Vt=new WeakMap,Ir=new WeakMap,$t=new WeakMap,Jt=new WeakMap,gt=new WeakMap,Ar=new WeakMap,ht=new WeakMap,uo=new WeakMap,co=new WeakMap,mo=new WeakMap,po=new WeakMap,fo=new WeakMap,go=new WeakMap,ho=new WeakMap,Q=new WeakMap,en=new WeakSet,Jd=function(e,t,i=0){return new j({limit:e.limit,pageSize:e.pageSize,fetch:async n=>{var h,P;let o=n.limit,a=m.redditAPIPlugins.Listings,u=m.redditAPIPlugins.LinksAndComments,p=e.commentId;if(n.more)if(n.more.children.length){let w=n.more;(!o||o>100)&&(o=100);let I=w.children.splice(0,o),E=await u.MoreChildren({linkId:e.postId,children:I,sort:e.sort},t);if(!E.json?.data?.things?.length)return{children:[]};let{children:D}=k(h=W,tn,Kd).call(h,E.json.data.things,e.postId,e,t);return{children:D,more:w.children.length?w:void 0}}else p=n.more.parentId,i=i+n.more.depth;let g=(await a.Comments({article:e.postId.substring(3),comment:p?.substring(3),limit:o,depth:e.depth,sort:e.sort},t)).listings?.[1]?.data?.children??[],c=g[0];return p&&c?.data?.replyList?.data&&(g=c.data.replyList.data.children),k(P=W,tn,Kd).call(P,g,p??e.postId,e,t,i)}})},tn=new WeakSet,Kd=function(e,t,i,n,o=0){var f,g;let a=[],u,p={};for(let c of e){if(!c.data||(c.data.depth!=null&&(c.data.depth=c.data.depth+o),c.data.depth!=null&&i.depth!=null&&c.data.depth>=i.depth))continue;let h=c.data.parentId?p[c.data.parentId]:void 0;if(c.kind==="t1"){if(c.data.name===t)continue;let P=new W(c.data,n);if(p[P.id]=P,d(P,Qi,k(f=W,en,Jd).call(f,{...i,postId:P.postId,commentId:P.id},n,o)),"replyList"in c.data&&c.data.replyList?.data){let{children:w,more:I}=k(g=W,tn,Kd).call(g,c.data.replyList.data.children,P.id,i,n,o);w.length&&P.replies.children.push(...w),I&&P.replies.setMore(I)}P.replies.preventInitialFetch(),h?h.replies.children.push(P):a.push(P)}else if(c.kind==="more"&&c.data.parentId&&c.data.depth!=null){let P={parentId:mc(c.data.parentId)?jr(c.data.parentId):he(c.data.parentId),children:c.data.children??[],depth:c.data.depth};h?h.replies.setMore(P):P.parentId===t&&(u=P)}}return{children:a,more:u}},l(W,en),l(W,tn);var Z=W;function sd(r,e){let t=m.redditAPIPlugins.Moderation;return new j({hasMore:!0,after:r.after,before:r.before,limit:r.limit,pageSize:r.pageSize,fetch:async i=>{let n=await t.AboutLog({subreddit:r.subredditName,mod:r.moderatorUsernames?r.moderatorUsernames.join(","):void 0,type:r.type,...i},e);return KF(n)}})}function KF(r){if(!r.data?.children)throw new Error("AboutLogResponse is missing children");return{children:r.data.children.map(t=>{if(!t.data)throw new Error("ModAction from AboutLogResponse is missing or invalid");let{id:i,mod:n,modId36:o,createdUtc:a,subreddit:u,subredditNamePrefixed:p,action:f,srId36:g,description:c,details:h,targetAuthor:P,targetBody:w,targetFullname:I,targetPermalink:E,targetTitle:D}=t.data;v(i,"ModAction from AboutLogResponse is missing id"),v(n,"ModAction from AboutLogResponse is missing mod"),v(o,"ModAction from AboutLogResponse is missing modId36"),v(a,"ModAction from AboutLogResponse is missing createdUtc"),v(u,"ModAction from AboutLogResponse is missing subreddit"),v(p,"ModAction from AboutLogResponse is missing subredditNamePrefixed"),v(f,"ModAction from AboutLogResponse is missing action"),v(g,"ModAction from AboutLogResponse is missing srId36");let Ke=new Date(0);return Ke.setUTCSeconds(a),{id:i,type:f,moderatorName:n,moderatorId:`t2_${o}`,createdAt:Ke,subredditName:u,subredditId:`t5_${g}`,description:c,details:h,target:I?{id:I,author:P,body:w,permalink:E,title:D}:void 0}}),after:r.data.after,before:r.data.before}}var XF=(a=>(a.New="New",a.InProgress="InProgress",a.Archived="Archived",a.Appeals="Appeals",a.JoinRequests="JoinRequests",a.Filtered="Filtered",a))(XF||{}),ZF={0:"New",1:"InProgress",2:"Archived",3:"Appeals",4:"JoinRequests",5:"Filtered"},YF=(P=>(P.Highlighted="Highlighted",P.Unhighlighted="Unhighlighted",P.Archived="Archived",P.Unarchived="Unarchived",P.ReportedToAdmins="ReportedToAdmins",P.Muted="Muted",P.Unmuted="Unmuted",P.Banned="Banned",P.Unbanned="Unbanned",P.Approved="Approved",P.Disapproved="Disapproved",P.Filtered="Filtered",P.Unfiltered="Unfiltered",P))(YF||{}),QF={0:"Highlighted",1:"Unhighlighted",2:"Archived",3:"Unarchived",4:"ReportedToAdmins",5:"Muted",6:"Unmuted",7:"Banned",8:"Unbanned",9:"Approved",10:"Disapproved",11:"Filtered",12:"Unfiltered"},z,Y,se,Xd,cP,Zd,mP,od=class{constructor(e){l(this,Y);l(this,Xd);l(this,Zd);l(this,z,void 0);d(this,z,e)}async bulkReadConversations(e,t){let i=m.redditAPIPlugins.NewModmail,{conversationIds:n}=await i.BulkReadConversations({entity:e.join(","),state:t},s(this,z));return n}async getConversations(e){let i=await m.redditAPIPlugins.NewModmail.GetConversations({after:e.after,entity:e.subreddits?e.subreddits.join(","):void 0,limit:e.limit,sort:e.sort,state:e.state},s(this,z)),n={};for(let o in i.conversations)n[o]=k(this,Y,se).call(this,{protoConversation:i.conversations[o],protoMessages:i.messages,protoModActions:{}});return{conversations:n,viewerId:i.viewerId}}async getConversation(e){let i=await m.redditAPIPlugins.NewModmail.GetConversation({...e,markRead:!!e.markRead},s(this,z));return{participantSubreddit:i.participantSubreddit,conversation:k(this,Y,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getSubreddits(){let e=m.redditAPIPlugins.NewModmail,{subreddits:t}=await e.Subreddits({},s(this,z));return t}async createConversation(e){let i=await m.redditAPIPlugins.NewModmail.CreateConversation({body:e.body,isAuthorHidden:e.isAuthorHidden??!1,srName:e.subredditName,subject:e.subject,to:e.to?e.to:void 0},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async reply(e){let i=await m.redditAPIPlugins.NewModmail.CreateConversationMessage({body:e.body,conversationId:e.conversationId,isAuthorHidden:e.isAuthorHidden??!1,isInternal:e.isInternal??!1},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:{}}),user:i.user}}async highlightConversation(e){let i=await m.redditAPIPlugins.NewModmail.HighlightConversation({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unhighlightConversation(e){let i=await m.redditAPIPlugins.NewModmail.UnhighlightConversation({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async archiveConversation(e){let i=await m.redditAPIPlugins.NewModmail.ArchiveConversation({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unarchiveConversation(e){let i=await m.redditAPIPlugins.NewModmail.UnarchiveConversation({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async muteConversation(e){let i=await m.redditAPIPlugins.NewModmail.MuteConversation({conversationId:e.conversationId,numHours:e.numHours},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unmuteConversation(e){let i=await m.redditAPIPlugins.NewModmail.UnmuteConversation({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async readConversations(e){await m.redditAPIPlugins.NewModmail.Read({conversationIds:e.join(",")},s(this,z))}async unreadConversations(e){await m.redditAPIPlugins.NewModmail.Unread({conversationIds:e.join(",")},s(this,z))}async approveConversation(e){let i=await m.redditAPIPlugins.NewModmail.ApproveConversation({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async disapproveConversation(e){let i=await m.redditAPIPlugins.NewModmail.DisapproveConversation({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async tempBanConversation(e){let i=await m.redditAPIPlugins.NewModmail.TempBan({...e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unbanConversation(e){let i=await m.redditAPIPlugins.NewModmail.Unban({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getUnreadCount(){return await m.redditAPIPlugins.NewModmail.UnreadCount({},s(this,z))}async getUserConversations(e){return await m.redditAPIPlugins.NewModmail.UserConversations({conversationId:e},s(this,z))}};z=new WeakMap,Y=new WeakSet,se=function({protoConversation:e,protoMessages:t,protoModActions:i}){return{...e,state:ZF[e.state],messages:k(this,Xd,cP).call(this,e,t),modActions:k(this,Zd,mP).call(this,e,i)}},Xd=new WeakSet,cP=function(e,t){let i={},n=e.objIds.filter(o=>o.key==="messages").map(({id:o})=>o);for(let o of n){let a=t[o];a&&(i[o]=a)}return i},Zd=new WeakSet,mP=function(e,t){let i={},n=e.objIds.filter(o=>o.key==="modActions").map(({id:o})=>o);for(let o of n){let a=t[o];a&&(i[o]={...a,actionType:QF[a.actionTypeId]})}return i};var rn,nn,Yd,yo,vo,bo,Po,xm=class xm{constructor(e,t){l(this,rn,void 0);l(this,nn,void 0);l(this,Yd,void 0);l(this,yo,void 0);l(this,vo,void 0);l(this,bo,void 0);l(this,Po,void 0);if($(this),v(e.id,"PrivateMessage: Invalid data, no id"),v(e.name,"PrivateMessage: Invalid data, no name"),v(e.created,"PrivateMessage: Invalid data, no created date"),d(this,rn,Fe(e.name)),e.author!=null)d(this,nn,{type:"user",username:e.author,id:e.authorFullname?ge(e.authorFullname):void 0});else if(e.subreddit!=null)d(this,nn,{type:"subreddit",name:e.subreddit,id:e.subredditId?Re(e.subredditId):void 0});else throw new Error("PrivateMessage: Invalid data, no author or subreddit");d(this,yo,e.body??""),d(this,vo,e.bodyHtml??"");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,bo,i),d(this,Yd,e.parentId?Fe(e.parentId):void 0),d(this,Po,t)}static async getMessages(e,t){let i=m.redditAPIPlugins.PrivateMessages;return new j({...e,fetch:async n=>{let o=await i.MessageWhere({...n,where:e.type??"inbox"},t);return{after:o.data?.after,before:o.data?.before,children:o.data?.children?.map(a=>new xm(a.data,t)).filter(Boolean)||[]}}})}static async send({to:e,subject:t,text:i},n){await m.redditAPIPlugins.PrivateMessages.Compose({to:e,subject:t,text:i,fromSr:""},n)}static async sendAsSubreddit({to:e,fromSubredditName:t,subject:i,text:n},o){await m.redditAPIPlugins.PrivateMessages.Compose({to:e,fromSr:t,subject:i,text:n},o)}static async markAllAsRead(e){await m.redditAPIPlugins.PrivateMessages.ReadAllMessages({filterTypes:""},e)}get id(){return s(this,rn)}get from(){return s(this,nn)}get body(){return s(this,yo)}get bodyHtml(){return s(this,vo)}get created(){return s(this,bo)}async markAsRead(){await m.redditAPIPlugins.PrivateMessages.ReadMessage({id:s(this,rn)},s(this,Po))}};rn=new WeakMap,nn=new WeakMap,Yd=new WeakMap,yo=new WeakMap,vo=new WeakMap,bo=new WeakMap,Po=new WeakMap;var or=xm;var ov=(o=>(o.Reports="reports",o.Spam="spam",o.Modqueue="modqueue",o.Unmoderated="unmoderated",o.Edited="edited",o))(ov||{}),sn,A,ko,So,wo,Co,xo,Io,Ao,Eo,To,on,T,it=class it{constructor(e,t){l(this,sn,void 0);l(this,A,void 0);l(this,ko,void 0);l(this,So,void 0);l(this,wo,void 0);l(this,Co,void 0);l(this,xo,void 0);l(this,Io,void 0);l(this,Ao,void 0);l(this,Eo,void 0);l(this,To,void 0);l(this,on,void 0);l(this,T,void 0);$(this),v(e.id,"Subreddit id is missing or undefined"),v(e.displayName,"Subreddit name is missing or undefined"),d(this,sn,Re(`t5_${e.id}`)),d(this,A,e.displayName),v(e.createdUtc,"Subreddit is missing created date");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,ko,i),d(this,So,eB(e.subredditType)),d(this,wo,e.title),d(this,Co,e.description),v(e.lang,"Subreddit is missing language"),d(this,xo,e.lang),d(this,Io,e.subscribers??0),d(this,Ao,e.activeUserCount??0),d(this,Eo,e.over18??!1),d(this,on,e.url??""),d(this,To,{acceptFollowers:e.acceptFollowers??!1,allOriginalContent:e.allOriginalContent??!1,allowChatPostCreation:e.allowChatPostCreation??!1,allowDiscovery:e.allowDiscovery??!1,allowGalleries:e.allowGalleries??!1,allowImages:e.allowImages??!1,allowPolls:e.allowPolls??!1,allowPredictionContributors:e.allowPredictionContributors??!1,allowPredictions:e.allowPredictions??!1,allowPredictionsTournament:e.allowPredictionsTournament??!1,allowTalks:e.allowTalks??!1,allowVideoGifs:e.allowVideogifs??!1,allowVideos:e.allowVideos??!1,chatPostEnabled:e.isChatPostFeatureEnabled??!1,collectionsEnabled:e.collectionsEnabled??!1,crosspostable:e.isCrosspostableSubreddit??!1,emojisEnabled:e.emojisEnabled??!1,eventPostsEnabled:e.eventPostsEnabled??!1,linkFlairEnabled:e.linkFlairEnabled??!1,originalContentTagEnabled:e.originalContentTagEnabled??!1,restrictCommenting:e.restrictCommenting??!1,restrictPosting:e.restrictPosting??!1,shouldArchivePosts:e.shouldArchivePosts??!1,spoilersEnabled:e.spoilersEnabled??!1,wikiEnabled:e.wikiEnabled??!1,allowedPostType:tB(e.submissionType),allowedMediaInComments:e.allowedMediaInComments.map(rB),bannerBackgroundColor:e.bannerBackgroundColor,bannerBackgroundImage:e.bannerBackgroundImage,bannerImage:e.bannerImg,communityIcon:e.communityIcon,headerTitle:e.headerTitle,mobileBannerImage:e.mobileBannerImage,userFlairs:{enabled:e.userFlairEnabledInSr??!1,usersCanAssign:e.canAssignUserFlair??!1},postFlairs:{enabled:e.linkFlairEnabled??!1,usersCanAssign:e.canAssignLinkFlair??!1},url:new URL(s(this,on),"https://www.reddit.com").toString()}),d(this,T,t)}get id(){return s(this,sn)}get name(){return s(this,A)}get createdAt(){return s(this,ko)}get type(){return s(this,So)}get title(){return s(this,wo)}get description(){return s(this,Co)}get language(){return s(this,xo)}get numberOfSubscribers(){return s(this,Io)}get numberOfActiveUsers(){return s(this,Ao)}get nsfw(){return s(this,Eo)}get settings(){return s(this,To)}get userFlairsEnabled(){return this.settings.userFlairs.enabled}get postFlairsEnabled(){return this.settings.postFlairs.enabled}get usersCanAssignUserFlairs(){return this.settings.userFlairs.usersCanAssign}get usersCanAssignPostFlairs(){return this.settings.postFlairs.usersCanAssign}get url(){return this.settings.url}get permalink(){return s(this,on)}toJSON(){return{id:this.id,name:this.name,createdAt:this.createdAt,type:this.type,title:this.title,description:this.description,language:this.language,nsfw:this.nsfw,numberOfSubscribers:this.numberOfSubscribers,numberOfActiveUsers:this.numberOfActiveUsers,settings:this.settings}}async submitPost(e){let t={...e,subredditName:s(this,A)};return V.submit(t,s(this,T))}getControversialPosts(e={}){if(!s(this,A))throw new Error("subreddit missing displayName - it might not have been fetched");return V.getControversialPosts({...e,subredditName:s(this,A)},s(this,T))}getTopPosts(e={}){if(!s(this,A))throw new Error("subreddit missing displayName - it might not have been fetched");return V.getTopPosts({...e,subredditName:s(this,A)},s(this,T))}getApprovedUsers(e={}){return x.getSubredditUsersByType({type:"contributors",subredditName:s(this,A),...e},s(this,T))}approveUser(e){return x.createRelationship({username:e,subredditName:s(this,A),type:"contributor"},s(this,T))}removeUser(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"contributor"},s(this,T))}getWikiContributors(e={}){return x.getSubredditUsersByType({type:"wikicontributors",subredditName:s(this,A),...e},s(this,T))}addWikiContributor(e){return x.createRelationship({username:e,subredditName:s(this,A),type:"wikicontributor"},s(this,T))}removeWikiContributor(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"wikicontributor"},s(this,T))}getBannedUsers(e={}){return x.getSubredditUsersByType({type:"banned",subredditName:s(this,A),...e},s(this,T))}banUser(e){return x.createRelationship({username:e.username,subredditName:s(this,A),type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,T))}unbanUser(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"banned"},s(this,T))}getBannedWikiContributors(e={}){return x.getSubredditUsersByType({type:"wikibanned",subredditName:s(this,A),...e},s(this,T))}banWikiContributor(e){return x.createRelationship({username:e.username,subredditName:s(this,A),type:"wikibanned",banReason:e.reason,note:e.note,duration:e.duration},s(this,T))}unbanWikiContributor(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"wikibanned"},s(this,T))}getModerators(e={}){return x.getSubredditUsersByType({type:"moderators",subredditName:s(this,A),...e},s(this,T))}inviteModerator(e,t){return x.createRelationship({type:"moderator_invite",subredditName:s(this,A),username:e,permissions:t??[]},s(this,T))}revokeModeratorInvite(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"moderator_invite"},s(this,T))}removeModerator(e){return x.removeRelationship({type:"moderator",subredditName:s(this,A),username:e},s(this,T))}setModeratorPermissions(e,t){return x.setModeratorPermissions(e,s(this,A),t,s(this,T))}getMutedUsers(e={}){return x.getSubredditUsersByType({type:"muted",subredditName:s(this,A),...e},s(this,T))}muteUser(e,t){return x.createRelationship({username:e,subredditName:s(this,A),type:"muted",note:t},s(this,T))}unmuteUser(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"muted"},s(this,T))}getModerationLog(e){return sd({subredditName:s(this,A),...e},s(this,T))}getUserFlairTemplates(){return de.getUserFlairTemplates(s(this,A),s(this,T))}getPostFlairTemplates(){return de.getPostFlairTemplates(s(this,A),s(this,T))}createPostFlairTemplate(e){return de.createPostFlairTemplate({subredditName:s(this,A),...e},s(this,T))}createUserFlairTemplate(e){return de.createUserFlairTemplate({subredditName:s(this,A),...e},s(this,T))}async getUserFlair(e){if(e?.usernames!==void 0)return{users:await Promise.all(e.usernames.map(async i=>{let n=await Ue.getUserFlairBySubreddit({subreddit:s(this,A),name:i},s(this,T));return Us(n.users[0])}))};{let t=await Ue.getUserFlairBySubreddit({...e,subreddit:s(this,A)},s(this,T));return{next:t.next,prev:t.prev,users:t.users.map(i=>Us(i))}}}getModQueue(e={type:"all"}){return it.aboutLocation({...e,location:"modqueue",subreddit:s(this,A)},s(this,T))}getReports(e={type:"all"}){return it.aboutLocation({...e,location:"reports",subreddit:s(this,A)},s(this,T))}getSpam(e={type:"all"}){return it.aboutLocation({...e,location:"spam",subreddit:s(this,A)},s(this,T))}getUnmoderated(e={type:"all"}){return it.aboutLocation({...e,location:"unmoderated",subreddit:s(this,A)},s(this,T))}getEdited(e={type:"all"}){return it.aboutLocation({...e,location:"edited",subreddit:s(this,A)},s(this,T))}static aboutLocation(e,t){let i=m.redditAPIPlugins.Moderation,n;switch(e.type){case"post":n="links";break;case"comment":n="comments";break;default:n=void 0}return new j({...e,fetch:async o=>{let a=await i.AboutLocation({...o,...e,only:n},t);return pP(a,t)}})}getCommentsAndPostsByIds(e){let t=m.redditAPIPlugins.LinksAndComments;return new j({fetch:async()=>{let i=await t.Info({thingIds:e,subreddits:[s(this,sn)]},s(this,T));return pP(i,s(this,T))}})}static async addRemovalReason(e,t,i,n){return(await m.redditAPIPlugins.Subreddits.SubredditAddRemovalReason({title:t,message:i,subreddit:e},n)).id}static async getRemovalReasons(e,t){let n=await m.redditAPIPlugins.Subreddits.SubredditGetRemovalReasons({subreddit:e},t);return n.order.map(o=>({...n.data[o]}))}static async getFromMetadata(e){v(e);let t=ye(re.Subreddit,e);return v(t),it.getById(Re(t),e)}static async getById(e,t){let o=(await m.redditAPIPlugins.LinksAndComments.Info({thingIds:[e],subreddits:[]},t)).data?.children[0]?.data?.displayName;return v(o),it.getByName(o,t)}static async getByName(e,t){let n=await m.redditAPIPlugins.Subreddits.SubredditAbout({subreddit:e},t);if(!n?.data)throw new Error("not found");return new it(n.data,t)}};sn=new WeakMap,A=new WeakMap,ko=new WeakMap,So=new WeakMap,wo=new WeakMap,Co=new WeakMap,xo=new WeakMap,Io=new WeakMap,Ao=new WeakMap,Eo=new WeakMap,To=new WeakMap,on=new WeakMap,T=new WeakMap;var ve=it;function eB(r){if(r==="public"||r==="private"||r==="restricted"||r==="employees_only"||r==="gold_restricted"||r==="archived")return r;throw new Error(`invalid subreddit type: ${r}`)}function tB(r){if(r==="any"||r==="link"||r==="self")return r;throw new Error(`invalid allowed post type: ${r}`)}function rB(r){if(r==="animated"||r==="giphy"||r==="static"||r==="expression")return r;throw new Error(`invalid comment media type: ${r}`)}function pP(r,e){let i=(r.data?.children??[]).map(a=>{let u=n(a);if(u!=null)return u;let p=o(a);return p??null}).filter(Boolean);return{after:r.data?.after,before:r.data?.before,children:i};function n(a){try{return new V(a.data,e)}catch{return null}}function o(a){try{return new Z(a.data,e)}catch{return null}}}import{CommunityListWidget_CommunityData as iB,GetWidgetsResponse_WidgetItem as ce}from"@devvit/protos";var Ro,Fo,Bo,Oo,Am=class Am{constructor(e,t,i){l(this,Ro,void 0);l(this,Fo,void 0);l(this,Bo,void 0);l(this,Oo,void 0);$(this),d(this,Ro,e.id),d(this,Fo,e.shortName),d(this,Bo,t),d(this,Oo,i)}get id(){return s(this,Ro)}get name(){return s(this,Fo)}get subredditName(){return s(this,Bo)}toJSON(){return{id:this.id,name:this.name,subredditName:this.subredditName}}delete(){return Am.delete(this.subredditName,this.id,s(this,Oo))}static async getWidgets(e,t){let n=await m.redditAPIPlugins.Widgets.GetWidgets({subreddit:e},t);v(n.layout,"Failed to load widgets for subreddit");let o=n.items,a=[];for(let u of n.layout.sidebar?.order??[]){let p=o[u];switch(p?.kind){case"image":a.push(new Qd(p,e,t));break;case"calendar":a.push(new el(p,e,t));break;case"textarea":a.push(new tl(p,e,t));break;case"button":a.push(new rl(p,e,t));break;case"community-list":a.push(new il(p,e,t));break;case"post-flair":a.push(new nl(p,e,t));break;case"custom":a.push(new sl(p,e,t));break;case"subreddit-rules":{let f=await m.redditAPIPlugins.Subreddits.SubredditAboutRules({subreddit:e},t);a.push(new Im(f,p,e,t));break}default:throw new Error(`Unknown widget type: ${p.kind}`)}}return a}static async delete(e,t,i){await m.redditAPIPlugins.Widgets.DeleteWidget({subreddit:e,id:t},i)}static async reorder(e,t,i){await m.redditAPIPlugins.Widgets.OrderWidgets({subreddit:e,order:t},i)}static async add(e,t){switch(e?.type){case"image":return Qd.create(e,t);case"calendar":return el.create(e,t);case"textarea":return tl.create(e,t);case"button":return rl.create(e,t);case"community-list":return il.create(e,t);case"post-flair":return nl.create(e,t);case"custom":return sl.create(e,t);default:throw new Error("Unknown widget type")}}};Ro=new WeakMap,Fo=new WeakMap,Bo=new WeakMap,Oo=new WeakMap;var ie=Am,Uo,ol=class ol extends ie{constructor(t,i,n){super(t,i,n);l(this,Uo,void 0);d(this,Uo,t.data.map(o=>(v(o.url,"Image widget data is missing url"),v(o.height,"Image widget data is missing height"),v(o.width,"Image widget data is missing width"),v(o.linkUrl,"Image widget data is missing linkUrl"),{url:o.url,height:o.height,width:o.width,linkUrl:o.linkUrl})))}get images(){return s(this,Uo)}toJSON(){return{...super.toJSON(),images:this.images}}static async create(t,i){let o=await m.redditAPIPlugins.Widgets.AddImageWidget(t,i);return new ol(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await m.redditAPIPlugins.Widgets.UpdateImageWidget(t,i);return new ol(ce.fromJSON(o),t.subreddit,i)}};Uo=new WeakMap;var Qd=ol,Mo,Lo,Do,al=class al extends ie{constructor(t,i,n){super(t,i,n);l(this,Mo,void 0);l(this,Lo,void 0);l(this,Do,void 0);v(t.googleCalendarId,"Calendar widget data is missing googleCalendarId"),v(t.configuration,"Calendar widget data is missing configuration"),v(t.styles,"Calendar widget data is missing styles"),d(this,Mo,t.googleCalendarId),d(this,Lo,t.configuration),d(this,Do,t.styles)}get googleCalendarId(){return s(this,Mo)}get configuration(){return s(this,Lo)}get styles(){return s(this,Do)}toJSON(){return{...super.toJSON(),googleCalendarId:this.googleCalendarId,configuration:this.configuration,styles:this.styles}}static async create(t,i){let o=await m.redditAPIPlugins.Widgets.AddCalendarWidget(t,i);return new al(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await m.redditAPIPlugins.Widgets.UpdateCalendarWidget(t,i);return new al(ce.fromJSON(o),t.subreddit,i)}};Mo=new WeakMap,Lo=new WeakMap,Do=new WeakMap;var el=al,_o,No,dl=class dl extends ie{constructor(t,i,n){super(t,i,n);l(this,_o,void 0);l(this,No,void 0);v(t.text,"Textarea widget data is missing text"),v(t.styles,"Textarea widget data is missing styles"),d(this,_o,t.text),d(this,No,t.styles)}get text(){return s(this,_o)}get styles(){return s(this,No)}toJSON(){return{...super.toJSON(),text:this.text,styles:this.styles}}static async create(t,i){let o=await m.redditAPIPlugins.Widgets.AddTextAreaWidget(t,i);return new dl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await m.redditAPIPlugins.Widgets.UpdateTextAreaWidget(t,i);return new dl(ce.fromJSON(o),t.subreddit,i)}};_o=new WeakMap,No=new WeakMap;var tl=dl,qo,Ho,jo,ll=class ll extends ie{constructor(t,i,n){super(t,i,n);l(this,qo,void 0);l(this,Ho,void 0);l(this,jo,void 0);v(t.styles,"Button widget data is missing styles"),d(this,qo,t.buttons),d(this,Ho,t.description??""),d(this,jo,t.styles)}get buttons(){return s(this,qo)}get description(){return s(this,Ho)}get styles(){return s(this,jo)}toJSON(){return{...super.toJSON(),buttons:this.buttons,description:this.description,styles:this.styles}}static async create(t,i){let o=await m.redditAPIPlugins.Widgets.AddButtonWidget(t,i);return new ll(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await m.redditAPIPlugins.Widgets.UpdateButtonWidget(t,i);return new ll(ce.fromJSON(o),t.subreddit,i)}};qo=new WeakMap,Ho=new WeakMap,jo=new WeakMap;var rl=ll,Wo,Go,ul=class ul extends ie{constructor(t,i,n){super(t,i,n);l(this,Wo,void 0);l(this,Go,void 0);d(this,Wo,t.data.map(o=>iB.fromJSON(o))),v(t.styles,"Community list widget data is missing styles"),d(this,Go,t.styles)}get communities(){return s(this,Wo)}get styles(){return s(this,Go)}toJSON(){return{...super.toJSON(),communities:this.communities,styles:this.styles}}static async create(t,i){let o=await m.redditAPIPlugins.Widgets.AddCommunityListWidget(t,i);return new ul(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await m.redditAPIPlugins.Widgets.UpdateCommunityListWidget(t,i);return new ul(ce.fromJSON(o),t.subreddit,i)}};Wo=new WeakMap,Go=new WeakMap;var il=ul,zo,Vo,$o,cl=class cl extends ie{constructor(t,i,n){super(t,i,n);l(this,zo,void 0);l(this,Vo,void 0);l(this,$o,void 0);if(v(t.styles,"Post flair widget data is missing styles"),d(this,zo,t.styles),d(this,Vo,t.order.map(o=>t.templates[o])),!(t.display&&t.display==="list"||t.display==="cloud"))throw new Error("Post flair widget data is missing display type");d(this,$o,t.display)}get styles(){return s(this,zo)}get templates(){return s(this,Vo)}get display(){return s(this,$o)}toJSON(){return{...super.toJSON(),styles:this.styles,templates:this.templates,display:this.display}}static async create(t,i){let o=await m.redditAPIPlugins.Widgets.AddPostFlairWidget(t,i);return new cl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await m.redditAPIPlugins.Widgets.UpdatePostFlairWidget(t,i);return new cl(ce.fromJSON(o),t.subreddit,i)}};zo=new WeakMap,Vo=new WeakMap,$o=new WeakMap;var nl=cl,Jo,Ko,Xo,Zo,Yo,ml=class ml extends ie{constructor(t,i,n){super(t,i,n);l(this,Jo,void 0);l(this,Ko,void 0);l(this,Xo,void 0);l(this,Zo,void 0);l(this,Yo,void 0);v(t.stylesheetUrl,"Custom widget data is missing stylesheetUrl"),v(t.height,"Custom widget data is missing height"),v(t.css,"Custom widget data is missing css"),d(this,Jo,t.imageData??[]),d(this,Ko,t.text??""),d(this,Xo,t.stylesheetUrl),d(this,Zo,t.height),d(this,Yo,t.css)}get images(){return s(this,Jo)}get text(){return s(this,Ko)}get stylesheetUrl(){return s(this,Xo)}get height(){return s(this,Zo)}get css(){return s(this,Yo)}toJSON(){return{...super.toJSON(),images:this.images,text:this.text,stylesheetUrl:this.stylesheetUrl,height:this.height,css:this.css}}static async create(t,i){let o=await m.redditAPIPlugins.Widgets.AddCustomWidget(t,i);return new ml(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await m.redditAPIPlugins.Widgets.UpdateCustomWidget(t,i);return new ml(ce.fromJSON(o),t.subreddit,i)}};Jo=new WeakMap,Ko=new WeakMap,Xo=new WeakMap,Zo=new WeakMap,Yo=new WeakMap;var sl=ml,Qo,Im=class extends ie{constructor(t,i,n,o){super(i,n,o);l(this,Qo,void 0);let a=t.rules.map(({description:u,priority:p,shortName:f,violationReason:g})=>(v(u,"Subreddit rule is missing description"),v(p,"Subreddit rule is missing priority"),v(f,"Subreddit rule is missing shortName"),v(g,"Subreddit rule is missing violationReason"),{description:u,priority:p,shortName:f,violationReason:g}));d(this,Qo,a)}get rules(){return s(this,Qo)}toJSON(){return{...super.toJSON(),rules:this.rules}}};Qo=new WeakMap;var nB=(i=>(i[i.SUBREDDIT_PERMISSIONS=0]="SUBREDDIT_PERMISSIONS",i[i.APPROVED_CONTRIBUTORS_ONLY=1]="APPROVED_CONTRIBUTORS_ONLY",i[i.MODS_ONLY=2]="MODS_ONLY",i))(nB||{}),Pe,ke,an,dn,ln,un,cn,Je,_e=class _e{constructor(e,t,i,n){l(this,Pe,void 0);l(this,ke,void 0);l(this,an,void 0);l(this,dn,void 0);l(this,ln,void 0);l(this,un,void 0);l(this,cn,void 0);l(this,Je,void 0);$(this),d(this,Pe,e),d(this,ke,t),d(this,an,i.contentMd),d(this,dn,i.revisionId),d(this,ln,new Date(i.revisionDate)),d(this,un,i.reason??""),v(i.revisionBy?.data,"Wiki page author details are missing"),d(this,cn,new x(i.revisionBy.data,n)),d(this,Je,n)}get name(){return s(this,Pe)}get subredditName(){return s(this,ke)}get content(){return s(this,an)}get revisionId(){return s(this,dn)}get revisionDate(){return s(this,ln)}get revisionReason(){return s(this,un)}get revisionAuthor(){return s(this,cn)}toJSON(){return{name:s(this,Pe),subredditName:s(this,ke),content:s(this,an),revisionId:s(this,dn),revisionDate:s(this,ln),revisionReason:s(this,un),revisionAuthor:s(this,cn).toJSON()}}async update(e,t){return _e.updatePage({subredditName:s(this,ke),page:s(this,Pe),content:e,reason:t},s(this,Je))}async getRevisions(e){return _e.getPageRevisions({subredditName:s(this,ke),page:s(this,Pe),...e},s(this,Je))}async revertTo(e){return _e.revertPage(s(this,ke),s(this,Pe),e,s(this,Je))}async getSettings(){return _e.getPageSettings(s(this,ke),s(this,Pe),s(this,Je))}async updateSettings(e){return _e.updatePageSettings({subredditName:s(this,ke),page:s(this,Pe),listed:e.listed,permLevel:e.permLevel},s(this,Je))}async addEditor(e){return _e.addEditor(s(this,ke),s(this,Pe),e,s(this,Je))}async removeEditor(e){return _e.removeEditor(s(this,ke),s(this,Pe),e,s(this,Je))}static async getPage(e,t,i){let o=await m.redditAPIPlugins.Wiki.GetWikiPage({subreddit:e,page:t},i);return v(o.data,"Failed to get wiki page"),new _e(t,e,o.data,i)}static async getPages(e,t){return(await m.redditAPIPlugins.Wiki.GetWikiPages({subreddit:e},t)).data||[]}static async createPage(e,t){return _e.updatePage(e,t)}static async updatePage(e,t){return await m.redditAPIPlugins.Wiki.EditWikiPage({subreddit:e.subredditName,page:e.page,content:e.content,reason:e.reason??""},t),_e.getPage(e.subredditName,e.page,t)}static getPageRevisions(e,t){let i=m.redditAPIPlugins.Wiki;return new j({hasMore:!0,after:e.after,limit:e.limit,pageSize:e.pageSize,async fetch(n){let o=await i.GetWikiPageRevisions({subreddit:e.subredditName,page:e.page,limit:n.limit,after:n.after,before:n.before},t);return sB(o,t)}})}static async revertPage(e,t,i,n){await m.redditAPIPlugins.Wiki.RevertWikiPage({subreddit:e,page:t,revision:i},n)}static async getPageSettings(e,t,i){let o=await m.redditAPIPlugins.Wiki.GetWikiPageSettings({subreddit:e,page:t},i);return v(o.data,"Failed to get wiki page settings"),new pl(o.data,i)}static async updatePageSettings(e,t){let n=await m.redditAPIPlugins.Wiki.UpdateWikiPageSettings({subreddit:e.subredditName,page:e.page,listed:e.listed?"on":"",permlevel:e.permLevel},t);return v(n.data,"Failed to update wiki page settings"),new pl(n.data,t)}static async addEditor(e,t,i,n){await m.redditAPIPlugins.Wiki.AllowEditor({act:"add",subreddit:e,page:t,username:i},n)}static async removeEditor(e,t,i,n){await m.redditAPIPlugins.Wiki.AllowEditor({act:"del",subreddit:e,page:t,username:i},n)}};Pe=new WeakMap,ke=new WeakMap,an=new WeakMap,dn=new WeakMap,ln=new WeakMap,un=new WeakMap,cn=new WeakMap,Je=new WeakMap;var be=_e,mn,pn,fn,gn,hn,yn,Em=class{constructor(e,t){l(this,mn,void 0);l(this,pn,void 0);l(this,fn,void 0);l(this,gn,void 0);l(this,hn,void 0);l(this,yn,void 0);d(this,mn,e.id),d(this,pn,e.page),d(this,fn,new Date(e.timestamp)),v(e.author?.data,"Wiki page revision author details are missing"),d(this,gn,new x(e.author.data,t)),d(this,hn,e.reason??""),d(this,yn,e.revisionHidden??!1)}get id(){return s(this,mn)}get page(){return s(this,pn)}get date(){return s(this,fn)}get author(){return s(this,gn)}get reason(){return s(this,hn)}get hidden(){return s(this,yn)}toJSON(){return{id:s(this,mn),page:s(this,pn),date:s(this,fn),author:s(this,gn).toJSON(),reason:s(this,hn),hidden:s(this,yn)}}};mn=new WeakMap,pn=new WeakMap,fn=new WeakMap,gn=new WeakMap,hn=new WeakMap,yn=new WeakMap;var vn,bn,Pn,pl=class{constructor(e,t){l(this,vn,void 0);l(this,bn,void 0);l(this,Pn,void 0);d(this,vn,e.listed),d(this,bn,e.permLevel),d(this,Pn,e.editors.map(i=>(v(i.data,"Wiki page editor details are missing"),new x(i.data,t))))}get listed(){return s(this,vn)}get permLevel(){return s(this,bn)}get editors(){return s(this,Pn)}toJSON(){return{listed:s(this,vn),permLevel:s(this,bn),editors:s(this,Pn).map(e=>e.toJSON())}}};vn=new WeakMap,bn=new WeakMap,Pn=new WeakMap;function sB(r,e){return v(r.data?.children,"Wiki page revision listing is missing children"),{children:r.data.children.map(i=>new Em(i,e)),before:r.data.before,after:r.data.after}}var oB=(t=>(t.Gallery="GALLERY",t.Timeline="TIMELINE",t))(oB||{});function aB(r){return r==="GALLERY"?"GALLERY":"TIMELINE"}var Ne,Se,ta,kn,Sn,ra,ia,na,sa,yt,oa,aa,wn,ea=class ea{constructor(e,t){l(this,Ne,void 0);l(this,Se,void 0);l(this,ta,void 0);l(this,kn,void 0);l(this,Sn,void 0);l(this,ra,void 0);l(this,ia,void 0);l(this,na,void 0);l(this,sa,void 0);l(this,yt,void 0);l(this,oa,void 0);l(this,aa,void 0);l(this,wn,void 0);v(e.collectionId,"Collection Id is missing or undefined"),v(e.subredditId,"Subreddit Id is missing or undefined"),v(e.title,"Collection title is missing or undefined"),v(e.authorId,"Collection author's id is missing or undefined"),v(e.authorName,"Collection author's id is missing or undefined"),v(e.createdAtUtc,"Collection create timestamp is missing"),v(e.lastUpdateUtc,"Collection last updated timestamp is missing"),d(this,Ne,t),d(this,Se,e.collectionId),d(this,ta,e.subredditId),d(this,kn,e.title),d(this,Sn,e.description||""),d(this,ra,e.authorId),d(this,ia,e.authorName),d(this,na,e.permalink),d(this,sa,e.primaryLinkId),d(this,yt,e.linkIds||[]),d(this,wn,aB(e.displayLayout)),d(this,oa,e.createdAtUtc),d(this,aa,e.lastUpdateUtc),$(this)}get id(){return s(this,Se)}get subredditId(){return s(this,ta)}get title(){return s(this,kn)}get description(){return s(this,Sn)}get authorId(){return s(this,ra)}get authorName(){return s(this,ia)}get permalink(){return s(this,na)}get primaryLinkId(){return s(this,sa)}get linkIds(){return s(this,yt)}get createdAtUtc(){return s(this,oa)}get lastUpdateUtc(){return s(this,aa)}get displayLayout(){return s(this,wn)}static async getCollectionById(e,t){let n=await m.redditAPIPlugins.PostCollections.Collection(e,t);return new ea(n,t)}static async create(e,t){let n=await m.redditAPIPlugins.PostCollections.Create({srFullname:e.subredditId,title:e.title,description:e.description,displayLayout:e.displayLayout},t);return new ea(n,t)}static async getCollectionsForSubreddit(e,t){return(await m.redditapiv2Plugin.GetSubredditCollections({srFullname:e.subredditId},t)).collections.map(n=>new ea(n,t))}async addPost(e){await m.redditAPIPlugins.PostCollections.AddPost({collectionId:s(this,Se),linkFullname:e},s(this,Ne)),s(this,yt).push(e)}async removePost(e){await m.redditAPIPlugins.PostCollections.RemovePost({collectionId:s(this,Se),linkFullname:e},s(this,Ne)),d(this,yt,s(this,yt).filter(i=>i!==e))}async delete(){await m.redditAPIPlugins.PostCollections.Delete({collectionId:s(this,Se)},s(this,Ne))}async follow(e){await m.redditAPIPlugins.PostCollections.Follow({collectionId:s(this,Se),follow:e},s(this,Ne))}async reorder(e){await m.redditAPIPlugins.PostCollections.Reorder({collectionId:s(this,Se),linkIds:e.join(",")},s(this,Ne)),d(this,yt,e)}async updateTitle(e){await m.redditAPIPlugins.PostCollections.UpdateTitle({collectionId:s(this,Se),title:e},s(this,Ne)),d(this,kn,e)}async updateDescription(e){await m.redditAPIPlugins.PostCollections.UpdateDescription({collectionId:s(this,Se),description:e},s(this,Ne)),d(this,Sn,e)}async updateLayout(e){await m.redditAPIPlugins.PostCollections.UpdateDisplayLayout({collectionId:s(this,Se),displayLayout:e},s(this,Ne)),d(this,wn,e)}};Ne=new WeakMap,Se=new WeakMap,ta=new WeakMap,kn=new WeakMap,Sn=new WeakMap,ra=new WeakMap,ia=new WeakMap,na=new WeakMap,sa=new WeakMap,yt=new WeakMap,oa=new WeakMap,aa=new WeakMap,wn=new WeakMap;var ti=ea;var dB=["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"],lB=["border-image","border-image-source","behavior","expression","list-style-image","cursor","content"],uB=["onload","onerror","onclick","onmouseover"];function cB(r){return/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/.test(r)?r:r.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"')}function fP(r){if(r){if(!r.trim().startsWith("<svg")){console.log("The provided string is not a valid SVG.");return}try{let e=new RegExp(`<\\s*(${dB.join("|")})\\b`,"gi"),t=new RegExp(`(${lB.join("|")})\\s*:\\s*url\\s*\\((['"]?)(.*?)\\2\\)`,"gi"),i=new RegExp(`(${uB.join("|")})\\s*(=\\s*(['"]?)(.*?)\\3)?`,"gi");r=r.trim().replace(/\s+/g," "),r=cB(r);let n=r.match(e)||[],o=r.match(t)||[],a=r.match(i)||[],u=!1;return n.length>0&&(u=!0,console.warn(`Disallowed elements detected in SVG: ${n.map(p=>p.replace("<","")).join(", ")}`)),o.length>0&&(u=!0,console.warn(`Disallowed styles detected in SVG: ${o.map(p=>p.split(":")[0]).join(", ")}`)),a.length>0&&(u=!0,console.warn(`Disallowed attributes detected in SVG: ${a.map(p=>p.split("=")[0]).join(", ")}`)),u?void 0:r}catch{return}}}function Yq(r,...e){let t="";return r.forEach((i,n)=>{t+=i;let o=e[n];o!==void 0&&(t+=`${o}`)}),t=fP(t),t===void 0?"":`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t)}`}export{BU as ALL_ICON_NAMES,ov as AboutLocations,rl as ButtonWidget,el as CalendarWidget,oB as CollectionDisplayLayout,Z as Comment,il as CommunityListWidget,sl as CustomWidget,m as Devvit,Ue as Flair,de as FlairTemplate,jF as FlairType,St as Hook,Qd as ImageWidget,j as Listing,YF as ModMailActionType,XF as ModMailConversationState,od as ModMailService,Oe as ModNote,V as Post,ti as PostCollection,nl as PostFlairWidget,or as PrivateMessage,Rs as RichTextBuilder,pc as SettingScope,ve as Subreddit,Im as SubredditRulesWidget,tl as TextAreaWidget,x as User,ie as Widget,be as WikiPage,nB as WikiPagePermissionLevel,Em as WikiPageRevision,pl as WikiPageSettings,Us as convertUserFlairProtoToAPI,sd as getModerationLog,Yq as svg};
5
+ `))}static async getSnoovatarUrl(e,t){let i="GetSnoovatarUrlByName",n="c47fd42345af268616d2d8904b56856acdc05cf61d3650380f539ad7d596ac0c";return(await Vd.query(i,n,{username:e},t)).data?.redditorInfoByName?.snoovatarIcon?.url}static getOverview(e,t){let i=m.redditAPIPlugins.Users;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"overview",...n},t);return JF(o,t)}})}};Xs=new WeakMap,Xi=new WeakMap,Zs=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,eo=new WeakMap,to=new WeakMap,zt=new WeakMap,ro=new WeakMap,io=new WeakMap,ft=new WeakMap;var x=xr;function JF(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>{if(i.kind==="t3")return new V(i.data,e);if(i.kind==="t1")return new Z(i.data,e);throw new Error(`Type ${i.kind} is not supported`)}),before:r.data.before,after:r.data.after}}async function KF(r,e,t){let i=m.redditAPIPlugins.Users;if(!r.data?.children)throw new Error("Listing response is missing children");let n=r.data.children.map(g=>(v(g.data?.id,"User id is still from listing data"),g.data.id)),o=100,a=[];for(let g=0;g<n.length;g+=o)a.push(n.slice(g,g+o));let p=(await Promise.all(a.map(g=>i.UserDataByAccountIds({ids:g.join(",")},t)))).reduce((g,c)=>({...g,...c.users}),{});return{children:r.data.children.map(g=>{let c=g.data?.id;v(c,"User id is missing from listing");let h=p[c];return v(h,"User data is missing from response"),new x({id:c,name:h.name,linkKarma:h.linkKarma,commentKarma:h.commentKarma,createdUtc:h.createdUtc,over18:h.profileOver18,snoovatarSize:[],modPermissions:{[e]:g.data?.modPermissions??[]}},t)}),before:r.data.before,after:r.data.after}}var Cr,no,Zi,Yi,so,oo,Qi,ao,lo,en,Vt,Ar,$t,Jt,gt,Er,ht,uo,co,mo,po,fo,go,ho,Q,tn,Jd,rn,Kd,W=class W{constructor(e,t){l(this,Cr,void 0);l(this,no,void 0);l(this,Zi,void 0);l(this,Yi,void 0);l(this,so,void 0);l(this,oo,void 0);l(this,Qi,void 0);l(this,ao,void 0);l(this,lo,void 0);l(this,en,void 0);l(this,Vt,void 0);l(this,Ar,void 0);l(this,$t,void 0);l(this,Jt,void 0);l(this,gt,void 0);l(this,Er,void 0);l(this,ht,void 0);l(this,uo,void 0);l(this,co,void 0);l(this,mo,void 0);l(this,po,void 0);l(this,fo,void 0);l(this,go,void 0);l(this,ho,void 0);l(this,Q,void 0);var n;$(this),v(e.id,"Comment id is null or undefined"),v(e.body,"Comment body is null or undefined"),v(e.createdUtc,"Comment is missing created date"),v(e.author,"Comment author is null or undefined"),v(e.parentId,"Comment parentId is null or undefined"),v(e.linkId,"Comment linkId is null or undefined"),v(e.permalink,"Comment permalink is null or undefined"),v(e.subreddit,"Comment is missing subreddit name"),v(e.subredditId,"Comment is missing subreddit id"),d(this,Cr,Wr(`t1_${e.id}`)),d(this,no,e.authorFullname?ge(e.authorFullname):void 0),d(this,Zi,e.author),d(this,Yi,e.body),d(this,ao,Re(e.subredditId)),d(this,lo,e.subreddit),d(this,oo,mc(e.parentId)?Wr(e.parentId):he(e.parentId)),d(this,Qi,he(e.linkId)),d(this,Ar,e.edited??!1),d(this,$t,e.locked??!1),d(this,Jt,e.removed??!1),d(this,gt,e.stickied??!1),d(this,Vt,e.approved??!1),d(this,Er,e.spam??!1),d(this,ht,e.distinguished),d(this,uo,e.numReports??0),d(this,co,e.collapsedBecauseCrowdControl??!1),d(this,mo,e.score??0),d(this,po,e.permalink),d(this,ho,new URL(e.permalink??"","https://www.reddit.com/").toString()),d(this,fo,(e.modReports??[]).map(([o])=>o)),d(this,go,(e.userReports??[]).map(([o])=>o));let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,so,i),d(this,en,k(n=W,tn,Jd).call(n,{postId:s(this,Qi),commentId:s(this,Cr)},t)),d(this,Q,t)}get id(){return s(this,Cr)}get authorId(){return s(this,no)}get authorName(){return s(this,Zi)}get subredditId(){return s(this,ao)}get subredditName(){return s(this,lo)}get body(){return s(this,Yi)}get createdAt(){return s(this,so)}get parentId(){return s(this,oo)}get postId(){return s(this,Qi)}get replies(){return s(this,en)}get distinguishedBy(){return s(this,ht)}get locked(){return s(this,$t)}get stickied(){return s(this,gt)}get removed(){return s(this,Jt)}get approved(){return s(this,Vt)}get spam(){return s(this,Er)}get edited(){return s(this,Ar)}get numReports(){return s(this,uo)}get collapsedBecauseCrowdControl(){return s(this,co)}get score(){return s(this,mo)}get permalink(){return s(this,po)}get userReportReasons(){return s(this,go)}get modReportReasons(){return s(this,fo)}get url(){return s(this,ho)}toJSON(){return{id:this.id,authorName:this.authorName,subredditId:this.subredditId,subredditName:this.subredditName,body:this.body,createdAt:this.createdAt,parentId:this.parentId,postId:this.postId,replies:this.replies,approved:this.approved,locked:this.locked,removed:this.removed,stickied:this.stickied,spam:this.spam,edited:this.edited,distinguishedBy:this.distinguishedBy,numReports:this.numReports,collapsedBecauseCrowdControl:this.collapsedBecauseCrowdControl,score:this.score,permalink:this.permalink,modReportReasons:this.modReportReasons,userReportReasons:this.userReportReasons,url:this.url}}isLocked(){return s(this,$t)}isApproved(){return s(this,Vt)}isRemoved(){return s(this,Jt)}isSpam(){return s(this,Er)}isStickied(){return s(this,gt)}isDistinguished(){return!!s(this,ht)}isEdited(){return s(this,Ar)}async delete(){return W.delete(this.id,s(this,Q))}async edit(e){let t=await W.edit({id:this.id,...e},s(this,Q));return d(this,Yi,t.body),d(this,Ar,t.edited),this}async approve(){await W.approve(this.id,s(this,Q)),d(this,Vt,!0),d(this,Jt,!1)}async remove(e=!1){await W.remove(this.id,e,s(this,Q)),d(this,Jt,!0),d(this,Er,e),d(this,Vt,!1)}async lock(){await W.lock(this.id,s(this,Q)),d(this,$t,!0)}async unlock(){await W.unlock(this.id,s(this,Q)),d(this,$t,!1)}async reply(e){return W.submit({id:this.id,...e},s(this,Q))}async getAuthor(){return x.getByUsername(s(this,Zi),s(this,Q))}async distinguish(e=!1){let{distinguishedBy:t,stickied:i}=await W.distinguish(this.id,e,!1,s(this,Q));d(this,ht,t),d(this,gt,i)}async distinguishAsAdmin(e=!1){let{distinguishedBy:t,stickied:i}=await W.distinguish(this.id,e,!0,s(this,Q));d(this,ht,t),d(this,gt,i)}async undistinguish(){let{distinguishedBy:e,stickied:t}=await W.undistinguish(this.id,s(this,Q));d(this,ht,e),d(this,gt,t)}addRemovalNote(e){return Ue.addRemovalNote({itemIds:[s(this,Cr)],...e},s(this,Q))}static async getById(e,t){let i=m.redditAPIPlugins.LinksAndComments,n=kt(e)?e:`t1_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.[0]?.data)throw new Error("not found");return new W(o.data.children[0].data,t)}static getComments(e,t){var a;let{postId:i,commentId:n,...o}=e;return k(a=W,tn,Jd).call(a,{postId:he(i),commentId:n?Wr(n):void 0,...o},t)}static async edit(e,t){let i=m.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=Ai(e.richtext));let a=await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("Failed to edit comment");let u=a.json?.data?.things?.[0]?.data;return v(u),new W(u,t)}static async delete(e,t){await m.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await m.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await m.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async lock(e,t){await m.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await m.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async submit(e,t){let i=m.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=Ai(e.richtext));let a=await i.Comment({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("failed to reply to comment");let u=a.json?.data?.things?.[0]?.data;return v(u),new W(u,t)}static async distinguish(e,t,i,n){let u=(await m.redditAPIPlugins.Moderation.Distinguish({id:e,how:i?"admin":"yes",sticky:t},n)).json?.data?.things?.[0]?.data;return v(u),{distinguishedBy:u.distinguished,stickied:!!u.stickied}}static async undistinguish(e,t){let o=(await m.redditAPIPlugins.Moderation.Distinguish({id:e,how:"no",sticky:!1},t)).json?.data?.things?.[0]?.data;return v(o),{distinguishedBy:o.distinguished,stickied:!!o.stickied}}static getCommentsByUser(e,t){let i=m.redditAPIPlugins.Users;return new j({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"comments",...n},t);return v(o.data,"Failed to get comments for user"),{children:o.data.children?.map(u=>new W(u.data,t))||[],before:o.data.before,after:o.data.after}}})}};Cr=new WeakMap,no=new WeakMap,Zi=new WeakMap,Yi=new WeakMap,so=new WeakMap,oo=new WeakMap,Qi=new WeakMap,ao=new WeakMap,lo=new WeakMap,en=new WeakMap,Vt=new WeakMap,Ar=new WeakMap,$t=new WeakMap,Jt=new WeakMap,gt=new WeakMap,Er=new WeakMap,ht=new WeakMap,uo=new WeakMap,co=new WeakMap,mo=new WeakMap,po=new WeakMap,fo=new WeakMap,go=new WeakMap,ho=new WeakMap,Q=new WeakMap,tn=new WeakSet,Jd=function(e,t,i=0){return new j({limit:e.limit,pageSize:e.pageSize,fetch:async n=>{var h,P;let o=n.limit,a=m.redditAPIPlugins.Listings,u=m.redditAPIPlugins.LinksAndComments,p=e.commentId;if(n.more)if(n.more.children.length){let w=n.more;(!o||o>100)&&(o=100);let C=w.children.splice(0,o),E=await u.MoreChildren({linkId:e.postId,children:C,sort:e.sort},t);if(!E.json?.data?.things?.length)return{children:[]};let{children:D}=k(h=W,rn,Kd).call(h,E.json.data.things,e.postId,e,t);return{children:D,more:w.children.length?w:void 0}}else p=n.more.parentId,i=i+n.more.depth;let g=(await a.Comments({article:e.postId.substring(3),comment:p?.substring(3),limit:o,depth:e.depth,sort:e.sort},t)).listings?.[1]?.data?.children??[],c=g[0];return p&&c?.data?.replyList?.data&&(g=c.data.replyList.data.children),k(P=W,rn,Kd).call(P,g,p??e.postId,e,t,i)}})},rn=new WeakSet,Kd=function(e,t,i,n,o=0){var f,g;let a=[],u,p={};for(let c of e){if(!c.data||(c.data.depth!=null&&(c.data.depth=c.data.depth+o),c.data.depth!=null&&i.depth!=null&&c.data.depth>=i.depth))continue;let h=c.data.parentId?p[c.data.parentId]:void 0;if(c.kind==="t1"){if(c.data.name===t)continue;let P=new W(c.data,n);if(p[P.id]=P,d(P,en,k(f=W,tn,Jd).call(f,{...i,postId:P.postId,commentId:P.id},n,o)),"replyList"in c.data&&c.data.replyList?.data){let{children:w,more:C}=k(g=W,rn,Kd).call(g,c.data.replyList.data.children,P.id,i,n,o);w.length&&P.replies.children.push(...w),C&&P.replies.setMore(C)}P.replies.preventInitialFetch(),h?h.replies.children.push(P):a.push(P)}else if(c.kind==="more"&&c.data.parentId&&c.data.depth!=null){let P={parentId:mc(c.data.parentId)?Wr(c.data.parentId):he(c.data.parentId),children:c.data.children??[],depth:c.data.depth};h?h.replies.setMore(P):P.parentId===t&&(u=P)}}return{children:a,more:u}},l(W,tn),l(W,rn);var Z=W;function sd(r,e){let t=m.redditAPIPlugins.Moderation;return new j({hasMore:!0,after:r.after,before:r.before,limit:r.limit,pageSize:r.pageSize,fetch:async i=>{let n=await t.AboutLog({subreddit:r.subredditName,mod:r.moderatorUsernames?r.moderatorUsernames.join(","):void 0,type:r.type,...i},e);return XF(n)}})}function XF(r){if(!r.data?.children)throw new Error("AboutLogResponse is missing children");return{children:r.data.children.map(t=>{if(!t.data)throw new Error("ModAction from AboutLogResponse is missing or invalid");let{id:i,mod:n,modId36:o,createdUtc:a,subreddit:u,subredditNamePrefixed:p,action:f,srId36:g,description:c,details:h,targetAuthor:P,targetBody:w,targetFullname:C,targetPermalink:E,targetTitle:D}=t.data;v(i,"ModAction from AboutLogResponse is missing id"),v(n,"ModAction from AboutLogResponse is missing mod"),v(o,"ModAction from AboutLogResponse is missing modId36"),v(a,"ModAction from AboutLogResponse is missing createdUtc"),v(u,"ModAction from AboutLogResponse is missing subreddit"),v(p,"ModAction from AboutLogResponse is missing subredditNamePrefixed"),v(f,"ModAction from AboutLogResponse is missing action"),v(g,"ModAction from AboutLogResponse is missing srId36");let Ke=new Date(0);return Ke.setUTCSeconds(a),{id:i,type:f,moderatorName:n,moderatorId:`t2_${o}`,createdAt:Ke,subredditName:u,subredditId:`t5_${g}`,description:c,details:h,target:C?{id:C,author:P,body:w,permalink:E,title:D}:void 0}}),after:r.data.after,before:r.data.before}}var ZF=(a=>(a.New="New",a.InProgress="InProgress",a.Archived="Archived",a.Appeals="Appeals",a.JoinRequests="JoinRequests",a.Filtered="Filtered",a))(ZF||{}),YF={0:"New",1:"InProgress",2:"Archived",3:"Appeals",4:"JoinRequests",5:"Filtered"},QF=(P=>(P.Highlighted="Highlighted",P.Unhighlighted="Unhighlighted",P.Archived="Archived",P.Unarchived="Unarchived",P.ReportedToAdmins="ReportedToAdmins",P.Muted="Muted",P.Unmuted="Unmuted",P.Banned="Banned",P.Unbanned="Unbanned",P.Approved="Approved",P.Disapproved="Disapproved",P.Filtered="Filtered",P.Unfiltered="Unfiltered",P))(QF||{}),eB={0:"Highlighted",1:"Unhighlighted",2:"Archived",3:"Unarchived",4:"ReportedToAdmins",5:"Muted",6:"Unmuted",7:"Banned",8:"Unbanned",9:"Approved",10:"Disapproved",11:"Filtered",12:"Unfiltered"},z,Y,se,Xd,cP,Zd,mP,od=class{constructor(e){l(this,Y);l(this,Xd);l(this,Zd);l(this,z,void 0);d(this,z,e)}async bulkReadConversations(e,t){let i=m.redditAPIPlugins.NewModmail,{conversationIds:n}=await i.BulkReadConversations({entity:e.join(","),state:t},s(this,z));return n}async getConversations(e){let i=await m.redditAPIPlugins.NewModmail.GetConversations({after:e.after,entity:e.subreddits?e.subreddits.join(","):void 0,limit:e.limit,sort:e.sort,state:e.state},s(this,z)),n={};for(let o in i.conversations)n[o]=k(this,Y,se).call(this,{protoConversation:i.conversations[o],protoMessages:i.messages,protoModActions:{}});return{conversations:n,viewerId:i.viewerId}}async getConversation(e){let i=await m.redditAPIPlugins.NewModmail.GetConversation({...e,markRead:!!e.markRead},s(this,z));return{participantSubreddit:i.participantSubreddit,conversation:k(this,Y,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getSubreddits(){let e=m.redditAPIPlugins.NewModmail,{subreddits:t}=await e.Subreddits({},s(this,z));return t}async createConversation(e){let i=await m.redditAPIPlugins.NewModmail.CreateConversation({body:e.body,isAuthorHidden:e.isAuthorHidden??!1,srName:e.subredditName,subject:e.subject,to:e.to?e.to:void 0},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async reply(e){let i=await m.redditAPIPlugins.NewModmail.CreateConversationMessage({body:e.body,conversationId:e.conversationId,isAuthorHidden:e.isAuthorHidden??!1,isInternal:e.isInternal??!1},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:{}}),user:i.user}}async highlightConversation(e){let i=await m.redditAPIPlugins.NewModmail.HighlightConversation({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unhighlightConversation(e){let i=await m.redditAPIPlugins.NewModmail.UnhighlightConversation({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async archiveConversation(e){let i=await m.redditAPIPlugins.NewModmail.ArchiveConversation({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unarchiveConversation(e){let i=await m.redditAPIPlugins.NewModmail.UnarchiveConversation({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async muteConversation(e){let i=await m.redditAPIPlugins.NewModmail.MuteConversation({conversationId:e.conversationId,numHours:e.numHours},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unmuteConversation(e){let i=await m.redditAPIPlugins.NewModmail.UnmuteConversation({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async readConversations(e){await m.redditAPIPlugins.NewModmail.Read({conversationIds:e.join(",")},s(this,z))}async unreadConversations(e){await m.redditAPIPlugins.NewModmail.Unread({conversationIds:e.join(",")},s(this,z))}async approveConversation(e){let i=await m.redditAPIPlugins.NewModmail.ApproveConversation({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async disapproveConversation(e){let i=await m.redditAPIPlugins.NewModmail.DisapproveConversation({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async tempBanConversation(e){let i=await m.redditAPIPlugins.NewModmail.TempBan({...e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unbanConversation(e){let i=await m.redditAPIPlugins.NewModmail.Unban({conversationId:e},s(this,z));return{conversation:k(this,Y,se).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getUnreadCount(){return await m.redditAPIPlugins.NewModmail.UnreadCount({},s(this,z))}async getUserConversations(e){return await m.redditAPIPlugins.NewModmail.UserConversations({conversationId:e},s(this,z))}};z=new WeakMap,Y=new WeakSet,se=function({protoConversation:e,protoMessages:t,protoModActions:i}){return{...e,state:YF[e.state],messages:k(this,Xd,cP).call(this,e,t),modActions:k(this,Zd,mP).call(this,e,i)}},Xd=new WeakSet,cP=function(e,t){let i={},n=e.objIds.filter(o=>o.key==="messages").map(({id:o})=>o);for(let o of n){let a=t[o];a&&(i[o]=a)}return i},Zd=new WeakSet,mP=function(e,t){let i={},n=e.objIds.filter(o=>o.key==="modActions").map(({id:o})=>o);for(let o of n){let a=t[o];a&&(i[o]={...a,actionType:eB[a.actionTypeId]})}return i};var nn,sn,Yd,yo,vo,bo,Po,xm=class xm{constructor(e,t){l(this,nn,void 0);l(this,sn,void 0);l(this,Yd,void 0);l(this,yo,void 0);l(this,vo,void 0);l(this,bo,void 0);l(this,Po,void 0);if($(this),v(e.id,"PrivateMessage: Invalid data, no id"),v(e.name,"PrivateMessage: Invalid data, no name"),v(e.created,"PrivateMessage: Invalid data, no created date"),d(this,nn,Fe(e.name)),e.author!=null)d(this,sn,{type:"user",username:e.author,id:e.authorFullname?ge(e.authorFullname):void 0});else if(e.subreddit!=null)d(this,sn,{type:"subreddit",name:e.subreddit,id:e.subredditId?Re(e.subredditId):void 0});else throw new Error("PrivateMessage: Invalid data, no author or subreddit");d(this,yo,e.body??""),d(this,vo,e.bodyHtml??"");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,bo,i),d(this,Yd,e.parentId?Fe(e.parentId):void 0),d(this,Po,t)}static async getMessages(e,t){let i=m.redditAPIPlugins.PrivateMessages;return new j({...e,fetch:async n=>{let o=await i.MessageWhere({...n,where:e.type??"inbox"},t);return{after:o.data?.after,before:o.data?.before,children:o.data?.children?.map(a=>new xm(a.data,t)).filter(Boolean)||[]}}})}static async send({to:e,subject:t,text:i},n){await m.redditAPIPlugins.PrivateMessages.Compose({to:e,subject:t,text:i,fromSr:""},n)}static async sendAsSubreddit({to:e,fromSubredditName:t,subject:i,text:n},o){await m.redditAPIPlugins.PrivateMessages.Compose({to:e,fromSr:t,subject:i,text:n},o)}static async markAllAsRead(e){await m.redditAPIPlugins.PrivateMessages.ReadAllMessages({filterTypes:""},e)}get id(){return s(this,nn)}get from(){return s(this,sn)}get body(){return s(this,yo)}get bodyHtml(){return s(this,vo)}get created(){return s(this,bo)}async markAsRead(){await m.redditAPIPlugins.PrivateMessages.ReadMessage({id:s(this,nn)},s(this,Po))}};nn=new WeakMap,sn=new WeakMap,Yd=new WeakMap,yo=new WeakMap,vo=new WeakMap,bo=new WeakMap,Po=new WeakMap;var ar=xm;var ov=(o=>(o.Reports="reports",o.Spam="spam",o.Modqueue="modqueue",o.Unmoderated="unmoderated",o.Edited="edited",o))(ov||{}),on,A,ko,So,wo,Io,xo,Co,Ao,Eo,To,an,T,it=class it{constructor(e,t){l(this,on,void 0);l(this,A,void 0);l(this,ko,void 0);l(this,So,void 0);l(this,wo,void 0);l(this,Io,void 0);l(this,xo,void 0);l(this,Co,void 0);l(this,Ao,void 0);l(this,Eo,void 0);l(this,To,void 0);l(this,an,void 0);l(this,T,void 0);$(this),v(e.id,"Subreddit id is missing or undefined"),v(e.displayName,"Subreddit name is missing or undefined"),d(this,on,Re(`t5_${e.id}`)),d(this,A,e.displayName),v(e.createdUtc,"Subreddit is missing created date");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,ko,i),d(this,So,tB(e.subredditType)),d(this,wo,e.title),d(this,Io,e.description),v(e.lang,"Subreddit is missing language"),d(this,xo,e.lang),d(this,Co,e.subscribers??0),d(this,Ao,e.activeUserCount??0),d(this,Eo,e.over18??!1),d(this,an,e.url??""),d(this,To,{acceptFollowers:e.acceptFollowers??!1,allOriginalContent:e.allOriginalContent??!1,allowChatPostCreation:e.allowChatPostCreation??!1,allowDiscovery:e.allowDiscovery??!1,allowGalleries:e.allowGalleries??!1,allowImages:e.allowImages??!1,allowPolls:e.allowPolls??!1,allowPredictionContributors:e.allowPredictionContributors??!1,allowPredictions:e.allowPredictions??!1,allowPredictionsTournament:e.allowPredictionsTournament??!1,allowTalks:e.allowTalks??!1,allowVideoGifs:e.allowVideogifs??!1,allowVideos:e.allowVideos??!1,chatPostEnabled:e.isChatPostFeatureEnabled??!1,collectionsEnabled:e.collectionsEnabled??!1,crosspostable:e.isCrosspostableSubreddit??!1,emojisEnabled:e.emojisEnabled??!1,eventPostsEnabled:e.eventPostsEnabled??!1,linkFlairEnabled:e.linkFlairEnabled??!1,originalContentTagEnabled:e.originalContentTagEnabled??!1,restrictCommenting:e.restrictCommenting??!1,restrictPosting:e.restrictPosting??!1,shouldArchivePosts:e.shouldArchivePosts??!1,spoilersEnabled:e.spoilersEnabled??!1,wikiEnabled:e.wikiEnabled??!1,allowedPostType:rB(e.submissionType),allowedMediaInComments:e.allowedMediaInComments.map(iB),bannerBackgroundColor:e.bannerBackgroundColor,bannerBackgroundImage:e.bannerBackgroundImage,bannerImage:e.bannerImg,communityIcon:e.communityIcon,headerTitle:e.headerTitle,mobileBannerImage:e.mobileBannerImage,userFlairs:{enabled:e.userFlairEnabledInSr??!1,usersCanAssign:e.canAssignUserFlair??!1},postFlairs:{enabled:e.linkFlairEnabled??!1,usersCanAssign:e.canAssignLinkFlair??!1},url:new URL(s(this,an),"https://www.reddit.com").toString()}),d(this,T,t)}get id(){return s(this,on)}get name(){return s(this,A)}get createdAt(){return s(this,ko)}get type(){return s(this,So)}get title(){return s(this,wo)}get description(){return s(this,Io)}get language(){return s(this,xo)}get numberOfSubscribers(){return s(this,Co)}get numberOfActiveUsers(){return s(this,Ao)}get nsfw(){return s(this,Eo)}get settings(){return s(this,To)}get userFlairsEnabled(){return this.settings.userFlairs.enabled}get postFlairsEnabled(){return this.settings.postFlairs.enabled}get usersCanAssignUserFlairs(){return this.settings.userFlairs.usersCanAssign}get usersCanAssignPostFlairs(){return this.settings.postFlairs.usersCanAssign}get url(){return this.settings.url}get permalink(){return s(this,an)}toJSON(){return{id:this.id,name:this.name,createdAt:this.createdAt,type:this.type,title:this.title,description:this.description,language:this.language,nsfw:this.nsfw,numberOfSubscribers:this.numberOfSubscribers,numberOfActiveUsers:this.numberOfActiveUsers,settings:this.settings}}async submitPost(e){let t={...e,subredditName:s(this,A)};return V.submit(t,s(this,T))}getControversialPosts(e={}){if(!s(this,A))throw new Error("subreddit missing displayName - it might not have been fetched");return V.getControversialPosts({...e,subredditName:s(this,A)},s(this,T))}getTopPosts(e={}){if(!s(this,A))throw new Error("subreddit missing displayName - it might not have been fetched");return V.getTopPosts({...e,subredditName:s(this,A)},s(this,T))}getApprovedUsers(e={}){return x.getSubredditUsersByType({type:"contributors",subredditName:s(this,A),...e},s(this,T))}approveUser(e){return x.createRelationship({username:e,subredditName:s(this,A),type:"contributor"},s(this,T))}removeUser(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"contributor"},s(this,T))}getWikiContributors(e={}){return x.getSubredditUsersByType({type:"wikicontributors",subredditName:s(this,A),...e},s(this,T))}addWikiContributor(e){return x.createRelationship({username:e,subredditName:s(this,A),type:"wikicontributor"},s(this,T))}removeWikiContributor(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"wikicontributor"},s(this,T))}getBannedUsers(e={}){return x.getSubredditUsersByType({type:"banned",subredditName:s(this,A),...e},s(this,T))}banUser(e){return x.createRelationship({username:e.username,subredditName:s(this,A),type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,T))}unbanUser(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"banned"},s(this,T))}getBannedWikiContributors(e={}){return x.getSubredditUsersByType({type:"wikibanned",subredditName:s(this,A),...e},s(this,T))}banWikiContributor(e){return x.createRelationship({username:e.username,subredditName:s(this,A),type:"wikibanned",banReason:e.reason,note:e.note,duration:e.duration},s(this,T))}unbanWikiContributor(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"wikibanned"},s(this,T))}getModerators(e={}){return x.getSubredditUsersByType({type:"moderators",subredditName:s(this,A),...e},s(this,T))}inviteModerator(e,t){return x.createRelationship({type:"moderator_invite",subredditName:s(this,A),username:e,permissions:t??[]},s(this,T))}revokeModeratorInvite(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"moderator_invite"},s(this,T))}removeModerator(e){return x.removeRelationship({type:"moderator",subredditName:s(this,A),username:e},s(this,T))}setModeratorPermissions(e,t){return x.setModeratorPermissions(e,s(this,A),t,s(this,T))}getMutedUsers(e={}){return x.getSubredditUsersByType({type:"muted",subredditName:s(this,A),...e},s(this,T))}muteUser(e,t){return x.createRelationship({username:e,subredditName:s(this,A),type:"muted",note:t},s(this,T))}unmuteUser(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"muted"},s(this,T))}getModerationLog(e){return sd({subredditName:s(this,A),...e},s(this,T))}getUserFlairTemplates(){return de.getUserFlairTemplates(s(this,A),s(this,T))}getPostFlairTemplates(){return de.getPostFlairTemplates(s(this,A),s(this,T))}createPostFlairTemplate(e){return de.createPostFlairTemplate({subredditName:s(this,A),...e},s(this,T))}createUserFlairTemplate(e){return de.createUserFlairTemplate({subredditName:s(this,A),...e},s(this,T))}async getUserFlair(e){if(e?.usernames!==void 0)return{users:await Promise.all(e.usernames.map(async i=>{let n=await Me.getUserFlairBySubreddit({subreddit:s(this,A),name:i},s(this,T));return Us(n.users[0])}))};{let t=await Me.getUserFlairBySubreddit({...e,subreddit:s(this,A)},s(this,T));return{next:t.next,prev:t.prev,users:t.users.map(i=>Us(i))}}}getModQueue(e={type:"all"}){return it.aboutLocation({...e,location:"modqueue",subreddit:s(this,A)},s(this,T))}getReports(e={type:"all"}){return it.aboutLocation({...e,location:"reports",subreddit:s(this,A)},s(this,T))}getSpam(e={type:"all"}){return it.aboutLocation({...e,location:"spam",subreddit:s(this,A)},s(this,T))}getUnmoderated(e={type:"all"}){return it.aboutLocation({...e,location:"unmoderated",subreddit:s(this,A)},s(this,T))}getEdited(e={type:"all"}){return it.aboutLocation({...e,location:"edited",subreddit:s(this,A)},s(this,T))}static aboutLocation(e,t){let i=m.redditAPIPlugins.Moderation,n;switch(e.type){case"post":n="links";break;case"comment":n="comments";break;default:n=void 0}return new j({...e,fetch:async o=>{let a=await i.AboutLocation({...o,...e,only:n},t);return pP(a,t)}})}getCommentsAndPostsByIds(e){let t=m.redditAPIPlugins.LinksAndComments;return new j({fetch:async()=>{let i=await t.Info({thingIds:e,subreddits:[s(this,on)]},s(this,T));return pP(i,s(this,T))}})}static async addRemovalReason(e,t,i,n){return(await m.redditAPIPlugins.Subreddits.SubredditAddRemovalReason({title:t,message:i,subreddit:e},n)).id}static async getRemovalReasons(e,t){let n=await m.redditAPIPlugins.Subreddits.SubredditGetRemovalReasons({subreddit:e},t);return n.order.map(o=>({...n.data[o]}))}static async getFromMetadata(e){v(e);let t=ye(re.Subreddit,e);return v(t),it.getById(Re(t),e)}static async getById(e,t){let o=(await m.redditAPIPlugins.LinksAndComments.Info({thingIds:[e],subreddits:[]},t)).data?.children[0]?.data?.displayName;return v(o),it.getByName(o,t)}static async getByName(e,t){let n=await m.redditAPIPlugins.Subreddits.SubredditAbout({subreddit:e},t);if(!n?.data)throw new Error("not found");return new it(n.data,t)}};on=new WeakMap,A=new WeakMap,ko=new WeakMap,So=new WeakMap,wo=new WeakMap,Io=new WeakMap,xo=new WeakMap,Co=new WeakMap,Ao=new WeakMap,Eo=new WeakMap,To=new WeakMap,an=new WeakMap,T=new WeakMap;var ve=it;function tB(r){if(r==="public"||r==="private"||r==="restricted"||r==="employees_only"||r==="gold_restricted"||r==="archived")return r;throw new Error(`invalid subreddit type: ${r}`)}function rB(r){if(r==="any"||r==="link"||r==="self")return r;throw new Error(`invalid allowed post type: ${r}`)}function iB(r){if(r==="animated"||r==="giphy"||r==="static"||r==="expression")return r;throw new Error(`invalid comment media type: ${r}`)}function pP(r,e){let i=(r.data?.children??[]).map(a=>{let u=n(a);if(u!=null)return u;let p=o(a);return p??null}).filter(Boolean);return{after:r.data?.after,before:r.data?.before,children:i};function n(a){try{return new V(a.data,e)}catch{return null}}function o(a){try{return new Z(a.data,e)}catch{return null}}}import{CommunityListWidget_CommunityData as nB,GetWidgetsResponse_WidgetItem as ce}from"@devvit/protos";var Ro,Fo,Bo,Oo,Am=class Am{constructor(e,t,i){l(this,Ro,void 0);l(this,Fo,void 0);l(this,Bo,void 0);l(this,Oo,void 0);$(this),d(this,Ro,e.id),d(this,Fo,e.shortName),d(this,Bo,t),d(this,Oo,i)}get id(){return s(this,Ro)}get name(){return s(this,Fo)}get subredditName(){return s(this,Bo)}toJSON(){return{id:this.id,name:this.name,subredditName:this.subredditName}}delete(){return Am.delete(this.subredditName,this.id,s(this,Oo))}static async getWidgets(e,t){let n=await m.redditAPIPlugins.Widgets.GetWidgets({subreddit:e},t);v(n.layout,"Failed to load widgets for subreddit");let o=n.items,a=[];for(let u of n.layout.sidebar?.order??[]){let p=o[u];switch(p?.kind){case"image":a.push(new Qd(p,e,t));break;case"calendar":a.push(new el(p,e,t));break;case"textarea":a.push(new tl(p,e,t));break;case"button":a.push(new rl(p,e,t));break;case"community-list":a.push(new il(p,e,t));break;case"post-flair":a.push(new nl(p,e,t));break;case"custom":a.push(new sl(p,e,t));break;case"subreddit-rules":{let f=await m.redditAPIPlugins.Subreddits.SubredditAboutRules({subreddit:e},t);a.push(new Cm(f,p,e,t));break}default:throw new Error(`Unknown widget type: ${p.kind}`)}}return a}static async delete(e,t,i){await m.redditAPIPlugins.Widgets.DeleteWidget({subreddit:e,id:t},i)}static async reorder(e,t,i){await m.redditAPIPlugins.Widgets.OrderWidgets({subreddit:e,order:t},i)}static async add(e,t){switch(e?.type){case"image":return Qd.create(e,t);case"calendar":return el.create(e,t);case"textarea":return tl.create(e,t);case"button":return rl.create(e,t);case"community-list":return il.create(e,t);case"post-flair":return nl.create(e,t);case"custom":return sl.create(e,t);default:throw new Error("Unknown widget type")}}};Ro=new WeakMap,Fo=new WeakMap,Bo=new WeakMap,Oo=new WeakMap;var ie=Am,Uo,ol=class ol extends ie{constructor(t,i,n){super(t,i,n);l(this,Uo,void 0);d(this,Uo,t.data.map(o=>(v(o.url,"Image widget data is missing url"),v(o.height,"Image widget data is missing height"),v(o.width,"Image widget data is missing width"),v(o.linkUrl,"Image widget data is missing linkUrl"),{url:o.url,height:o.height,width:o.width,linkUrl:o.linkUrl})))}get images(){return s(this,Uo)}toJSON(){return{...super.toJSON(),images:this.images}}static async create(t,i){let o=await m.redditAPIPlugins.Widgets.AddImageWidget(t,i);return new ol(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await m.redditAPIPlugins.Widgets.UpdateImageWidget(t,i);return new ol(ce.fromJSON(o),t.subreddit,i)}};Uo=new WeakMap;var Qd=ol,Mo,Lo,Do,al=class al extends ie{constructor(t,i,n){super(t,i,n);l(this,Mo,void 0);l(this,Lo,void 0);l(this,Do,void 0);v(t.googleCalendarId,"Calendar widget data is missing googleCalendarId"),v(t.configuration,"Calendar widget data is missing configuration"),v(t.styles,"Calendar widget data is missing styles"),d(this,Mo,t.googleCalendarId),d(this,Lo,t.configuration),d(this,Do,t.styles)}get googleCalendarId(){return s(this,Mo)}get configuration(){return s(this,Lo)}get styles(){return s(this,Do)}toJSON(){return{...super.toJSON(),googleCalendarId:this.googleCalendarId,configuration:this.configuration,styles:this.styles}}static async create(t,i){let o=await m.redditAPIPlugins.Widgets.AddCalendarWidget(t,i);return new al(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await m.redditAPIPlugins.Widgets.UpdateCalendarWidget(t,i);return new al(ce.fromJSON(o),t.subreddit,i)}};Mo=new WeakMap,Lo=new WeakMap,Do=new WeakMap;var el=al,_o,No,dl=class dl extends ie{constructor(t,i,n){super(t,i,n);l(this,_o,void 0);l(this,No,void 0);v(t.text,"Textarea widget data is missing text"),v(t.styles,"Textarea widget data is missing styles"),d(this,_o,t.text),d(this,No,t.styles)}get text(){return s(this,_o)}get styles(){return s(this,No)}toJSON(){return{...super.toJSON(),text:this.text,styles:this.styles}}static async create(t,i){let o=await m.redditAPIPlugins.Widgets.AddTextAreaWidget(t,i);return new dl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await m.redditAPIPlugins.Widgets.UpdateTextAreaWidget(t,i);return new dl(ce.fromJSON(o),t.subreddit,i)}};_o=new WeakMap,No=new WeakMap;var tl=dl,qo,Ho,jo,ll=class ll extends ie{constructor(t,i,n){super(t,i,n);l(this,qo,void 0);l(this,Ho,void 0);l(this,jo,void 0);v(t.styles,"Button widget data is missing styles"),d(this,qo,t.buttons),d(this,Ho,t.description??""),d(this,jo,t.styles)}get buttons(){return s(this,qo)}get description(){return s(this,Ho)}get styles(){return s(this,jo)}toJSON(){return{...super.toJSON(),buttons:this.buttons,description:this.description,styles:this.styles}}static async create(t,i){let o=await m.redditAPIPlugins.Widgets.AddButtonWidget(t,i);return new ll(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await m.redditAPIPlugins.Widgets.UpdateButtonWidget(t,i);return new ll(ce.fromJSON(o),t.subreddit,i)}};qo=new WeakMap,Ho=new WeakMap,jo=new WeakMap;var rl=ll,Wo,Go,ul=class ul extends ie{constructor(t,i,n){super(t,i,n);l(this,Wo,void 0);l(this,Go,void 0);d(this,Wo,t.data.map(o=>nB.fromJSON(o))),v(t.styles,"Community list widget data is missing styles"),d(this,Go,t.styles)}get communities(){return s(this,Wo)}get styles(){return s(this,Go)}toJSON(){return{...super.toJSON(),communities:this.communities,styles:this.styles}}static async create(t,i){let o=await m.redditAPIPlugins.Widgets.AddCommunityListWidget(t,i);return new ul(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await m.redditAPIPlugins.Widgets.UpdateCommunityListWidget(t,i);return new ul(ce.fromJSON(o),t.subreddit,i)}};Wo=new WeakMap,Go=new WeakMap;var il=ul,zo,Vo,$o,cl=class cl extends ie{constructor(t,i,n){super(t,i,n);l(this,zo,void 0);l(this,Vo,void 0);l(this,$o,void 0);if(v(t.styles,"Post flair widget data is missing styles"),d(this,zo,t.styles),d(this,Vo,t.order.map(o=>t.templates[o])),!(t.display&&t.display==="list"||t.display==="cloud"))throw new Error("Post flair widget data is missing display type");d(this,$o,t.display)}get styles(){return s(this,zo)}get templates(){return s(this,Vo)}get display(){return s(this,$o)}toJSON(){return{...super.toJSON(),styles:this.styles,templates:this.templates,display:this.display}}static async create(t,i){let o=await m.redditAPIPlugins.Widgets.AddPostFlairWidget(t,i);return new cl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await m.redditAPIPlugins.Widgets.UpdatePostFlairWidget(t,i);return new cl(ce.fromJSON(o),t.subreddit,i)}};zo=new WeakMap,Vo=new WeakMap,$o=new WeakMap;var nl=cl,Jo,Ko,Xo,Zo,Yo,ml=class ml extends ie{constructor(t,i,n){super(t,i,n);l(this,Jo,void 0);l(this,Ko,void 0);l(this,Xo,void 0);l(this,Zo,void 0);l(this,Yo,void 0);v(t.stylesheetUrl,"Custom widget data is missing stylesheetUrl"),v(t.height,"Custom widget data is missing height"),v(t.css,"Custom widget data is missing css"),d(this,Jo,t.imageData??[]),d(this,Ko,t.text??""),d(this,Xo,t.stylesheetUrl),d(this,Zo,t.height),d(this,Yo,t.css)}get images(){return s(this,Jo)}get text(){return s(this,Ko)}get stylesheetUrl(){return s(this,Xo)}get height(){return s(this,Zo)}get css(){return s(this,Yo)}toJSON(){return{...super.toJSON(),images:this.images,text:this.text,stylesheetUrl:this.stylesheetUrl,height:this.height,css:this.css}}static async create(t,i){let o=await m.redditAPIPlugins.Widgets.AddCustomWidget(t,i);return new ml(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await m.redditAPIPlugins.Widgets.UpdateCustomWidget(t,i);return new ml(ce.fromJSON(o),t.subreddit,i)}};Jo=new WeakMap,Ko=new WeakMap,Xo=new WeakMap,Zo=new WeakMap,Yo=new WeakMap;var sl=ml,Qo,Cm=class extends ie{constructor(t,i,n,o){super(i,n,o);l(this,Qo,void 0);let a=t.rules.map(({description:u,priority:p,shortName:f,violationReason:g})=>(v(u,"Subreddit rule is missing description"),v(p,"Subreddit rule is missing priority"),v(f,"Subreddit rule is missing shortName"),v(g,"Subreddit rule is missing violationReason"),{description:u,priority:p,shortName:f,violationReason:g}));d(this,Qo,a)}get rules(){return s(this,Qo)}toJSON(){return{...super.toJSON(),rules:this.rules}}};Qo=new WeakMap;var sB=(i=>(i[i.SUBREDDIT_PERMISSIONS=0]="SUBREDDIT_PERMISSIONS",i[i.APPROVED_CONTRIBUTORS_ONLY=1]="APPROVED_CONTRIBUTORS_ONLY",i[i.MODS_ONLY=2]="MODS_ONLY",i))(sB||{}),Pe,ke,dn,ln,un,cn,mn,Je,Ne=class Ne{constructor(e,t,i,n){l(this,Pe,void 0);l(this,ke,void 0);l(this,dn,void 0);l(this,ln,void 0);l(this,un,void 0);l(this,cn,void 0);l(this,mn,void 0);l(this,Je,void 0);$(this),d(this,Pe,e),d(this,ke,t),d(this,dn,i.contentMd),d(this,ln,i.revisionId),d(this,un,new Date(i.revisionDate)),d(this,cn,i.reason??""),v(i.revisionBy?.data,"Wiki page author details are missing"),d(this,mn,new x(i.revisionBy.data,n)),d(this,Je,n)}get name(){return s(this,Pe)}get subredditName(){return s(this,ke)}get content(){return s(this,dn)}get revisionId(){return s(this,ln)}get revisionDate(){return s(this,un)}get revisionReason(){return s(this,cn)}get revisionAuthor(){return s(this,mn)}toJSON(){return{name:s(this,Pe),subredditName:s(this,ke),content:s(this,dn),revisionId:s(this,ln),revisionDate:s(this,un),revisionReason:s(this,cn),revisionAuthor:s(this,mn).toJSON()}}async update(e,t){return Ne.updatePage({subredditName:s(this,ke),page:s(this,Pe),content:e,reason:t},s(this,Je))}async getRevisions(e){return Ne.getPageRevisions({subredditName:s(this,ke),page:s(this,Pe),...e},s(this,Je))}async revertTo(e){return Ne.revertPage(s(this,ke),s(this,Pe),e,s(this,Je))}async getSettings(){return Ne.getPageSettings(s(this,ke),s(this,Pe),s(this,Je))}async updateSettings(e){return Ne.updatePageSettings({subredditName:s(this,ke),page:s(this,Pe),listed:e.listed,permLevel:e.permLevel},s(this,Je))}async addEditor(e){return Ne.addEditor(s(this,ke),s(this,Pe),e,s(this,Je))}async removeEditor(e){return Ne.removeEditor(s(this,ke),s(this,Pe),e,s(this,Je))}static async getPage(e,t,i){let o=await m.redditAPIPlugins.Wiki.GetWikiPage({subreddit:e,page:t},i);return v(o.data,"Failed to get wiki page"),new Ne(t,e,o.data,i)}static async getPages(e,t){return(await m.redditAPIPlugins.Wiki.GetWikiPages({subreddit:e},t)).data||[]}static async createPage(e,t){return Ne.updatePage(e,t)}static async updatePage(e,t){return await m.redditAPIPlugins.Wiki.EditWikiPage({subreddit:e.subredditName,page:e.page,content:e.content,reason:e.reason??""},t),Ne.getPage(e.subredditName,e.page,t)}static getPageRevisions(e,t){let i=m.redditAPIPlugins.Wiki;return new j({hasMore:!0,after:e.after,limit:e.limit,pageSize:e.pageSize,async fetch(n){let o=await i.GetWikiPageRevisions({subreddit:e.subredditName,page:e.page,limit:n.limit,after:n.after,before:n.before},t);return oB(o,t)}})}static async revertPage(e,t,i,n){await m.redditAPIPlugins.Wiki.RevertWikiPage({subreddit:e,page:t,revision:i},n)}static async getPageSettings(e,t,i){let o=await m.redditAPIPlugins.Wiki.GetWikiPageSettings({subreddit:e,page:t},i);return v(o.data,"Failed to get wiki page settings"),new pl(o.data,i)}static async updatePageSettings(e,t){let n=await m.redditAPIPlugins.Wiki.UpdateWikiPageSettings({subreddit:e.subredditName,page:e.page,listed:e.listed?"on":"",permlevel:e.permLevel},t);return v(n.data,"Failed to update wiki page settings"),new pl(n.data,t)}static async addEditor(e,t,i,n){await m.redditAPIPlugins.Wiki.AllowEditor({act:"add",subreddit:e,page:t,username:i},n)}static async removeEditor(e,t,i,n){await m.redditAPIPlugins.Wiki.AllowEditor({act:"del",subreddit:e,page:t,username:i},n)}};Pe=new WeakMap,ke=new WeakMap,dn=new WeakMap,ln=new WeakMap,un=new WeakMap,cn=new WeakMap,mn=new WeakMap,Je=new WeakMap;var be=Ne,pn,fn,gn,hn,yn,vn,Em=class{constructor(e,t){l(this,pn,void 0);l(this,fn,void 0);l(this,gn,void 0);l(this,hn,void 0);l(this,yn,void 0);l(this,vn,void 0);d(this,pn,e.id),d(this,fn,e.page),d(this,gn,new Date(e.timestamp)),v(e.author?.data,"Wiki page revision author details are missing"),d(this,hn,new x(e.author.data,t)),d(this,yn,e.reason??""),d(this,vn,e.revisionHidden??!1)}get id(){return s(this,pn)}get page(){return s(this,fn)}get date(){return s(this,gn)}get author(){return s(this,hn)}get reason(){return s(this,yn)}get hidden(){return s(this,vn)}toJSON(){return{id:s(this,pn),page:s(this,fn),date:s(this,gn),author:s(this,hn).toJSON(),reason:s(this,yn),hidden:s(this,vn)}}};pn=new WeakMap,fn=new WeakMap,gn=new WeakMap,hn=new WeakMap,yn=new WeakMap,vn=new WeakMap;var bn,Pn,kn,pl=class{constructor(e,t){l(this,bn,void 0);l(this,Pn,void 0);l(this,kn,void 0);d(this,bn,e.listed),d(this,Pn,e.permLevel),d(this,kn,e.editors.map(i=>(v(i.data,"Wiki page editor details are missing"),new x(i.data,t))))}get listed(){return s(this,bn)}get permLevel(){return s(this,Pn)}get editors(){return s(this,kn)}toJSON(){return{listed:s(this,bn),permLevel:s(this,Pn),editors:s(this,kn).map(e=>e.toJSON())}}};bn=new WeakMap,Pn=new WeakMap,kn=new WeakMap;function oB(r,e){return v(r.data?.children,"Wiki page revision listing is missing children"),{children:r.data.children.map(i=>new Em(i,e)),before:r.data.before,after:r.data.after}}var aB=(t=>(t.Gallery="GALLERY",t.Timeline="TIMELINE",t))(aB||{});function dB(r){return r==="GALLERY"?"GALLERY":"TIMELINE"}var qe,Se,ta,Sn,wn,ra,ia,na,sa,yt,oa,aa,In,ea=class ea{constructor(e,t){l(this,qe,void 0);l(this,Se,void 0);l(this,ta,void 0);l(this,Sn,void 0);l(this,wn,void 0);l(this,ra,void 0);l(this,ia,void 0);l(this,na,void 0);l(this,sa,void 0);l(this,yt,void 0);l(this,oa,void 0);l(this,aa,void 0);l(this,In,void 0);v(e.collectionId,"Collection Id is missing or undefined"),v(e.subredditId,"Subreddit Id is missing or undefined"),v(e.title,"Collection title is missing or undefined"),v(e.authorId,"Collection author's id is missing or undefined"),v(e.authorName,"Collection author's id is missing or undefined"),v(e.createdAtUtc,"Collection create timestamp is missing"),v(e.lastUpdateUtc,"Collection last updated timestamp is missing"),d(this,qe,t),d(this,Se,e.collectionId),d(this,ta,e.subredditId),d(this,Sn,e.title),d(this,wn,e.description||""),d(this,ra,e.authorId),d(this,ia,e.authorName),d(this,na,e.permalink),d(this,sa,e.primaryLinkId),d(this,yt,e.linkIds||[]),d(this,In,dB(e.displayLayout)),d(this,oa,e.createdAtUtc),d(this,aa,e.lastUpdateUtc),$(this)}get id(){return s(this,Se)}get subredditId(){return s(this,ta)}get title(){return s(this,Sn)}get description(){return s(this,wn)}get authorId(){return s(this,ra)}get authorName(){return s(this,ia)}get permalink(){return s(this,na)}get primaryLinkId(){return s(this,sa)}get linkIds(){return s(this,yt)}get createdAtUtc(){return s(this,oa)}get lastUpdateUtc(){return s(this,aa)}get displayLayout(){return s(this,In)}static async getCollectionById(e,t){let n=await m.redditAPIPlugins.PostCollections.Collection(e,t);return new ea(n,t)}static async create(e,t){let n=await m.redditAPIPlugins.PostCollections.Create({srFullname:e.subredditId,title:e.title,description:e.description,displayLayout:e.displayLayout},t);return new ea(n,t)}static async getCollectionsForSubreddit(e,t){return(await m.redditapiv2Plugin.GetSubredditCollections({srFullname:e.subredditId},t)).collections.map(n=>new ea(n,t))}async addPost(e){await m.redditAPIPlugins.PostCollections.AddPost({collectionId:s(this,Se),linkFullname:e},s(this,qe)),s(this,yt).push(e)}async removePost(e){await m.redditAPIPlugins.PostCollections.RemovePost({collectionId:s(this,Se),linkFullname:e},s(this,qe)),d(this,yt,s(this,yt).filter(i=>i!==e))}async delete(){await m.redditAPIPlugins.PostCollections.Delete({collectionId:s(this,Se)},s(this,qe))}async follow(e){await m.redditAPIPlugins.PostCollections.Follow({collectionId:s(this,Se),follow:e},s(this,qe))}async reorder(e){await m.redditAPIPlugins.PostCollections.Reorder({collectionId:s(this,Se),linkIds:e.join(",")},s(this,qe)),d(this,yt,e)}async updateTitle(e){await m.redditAPIPlugins.PostCollections.UpdateTitle({collectionId:s(this,Se),title:e},s(this,qe)),d(this,Sn,e)}async updateDescription(e){await m.redditAPIPlugins.PostCollections.UpdateDescription({collectionId:s(this,Se),description:e},s(this,qe)),d(this,wn,e)}async updateLayout(e){await m.redditAPIPlugins.PostCollections.UpdateDisplayLayout({collectionId:s(this,Se),displayLayout:e},s(this,qe)),d(this,In,e)}};qe=new WeakMap,Se=new WeakMap,ta=new WeakMap,Sn=new WeakMap,wn=new WeakMap,ra=new WeakMap,ia=new WeakMap,na=new WeakMap,sa=new WeakMap,yt=new WeakMap,oa=new WeakMap,aa=new WeakMap,In=new WeakMap;var ri=ea;var lB=["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"],uB=["border-image","border-image-source","behavior","expression","list-style-image","cursor","content"],cB=["onload","onerror","onclick","onmouseover"];function mB(r){return/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/.test(r)?r:r.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"')}function fP(r){if(r){if(!r.trim().startsWith("<svg")){console.log("The provided string is not a valid SVG.");return}try{let e=new RegExp(`<\\s*(${lB.join("|")})\\b`,"gi"),t=new RegExp(`(${uB.join("|")})\\s*:\\s*url\\s*\\((['"]?)(.*?)\\2\\)`,"gi"),i=new RegExp(`(${cB.join("|")})\\s*(=\\s*(['"]?)(.*?)\\3)?`,"gi");r=r.trim().replace(/\s+/g," "),r=mB(r);let n=r.match(e)||[],o=r.match(t)||[],a=r.match(i)||[],u=!1;return n.length>0&&(u=!0,console.warn(`Disallowed elements detected in SVG: ${n.map(p=>p.replace("<","")).join(", ")}`)),o.length>0&&(u=!0,console.warn(`Disallowed styles detected in SVG: ${o.map(p=>p.split(":")[0]).join(", ")}`)),a.length>0&&(u=!0,console.warn(`Disallowed attributes detected in SVG: ${a.map(p=>p.split("=")[0]).join(", ")}`)),u?void 0:r}catch{return}}}function Qq(r,...e){let t="";return r.forEach((i,n)=>{t+=i;let o=e[n];o!==void 0&&(t+=`${o}`)}),t=fP(t),t===void 0?"":`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t)}`}export{OU as ALL_ICON_NAMES,ov as AboutLocations,rl as ButtonWidget,el as CalendarWidget,aB as CollectionDisplayLayout,Z as Comment,il as CommunityListWidget,sl as CustomWidget,m as Devvit,Me as Flair,de as FlairTemplate,WF as FlairType,St as Hook,Qd as ImageWidget,j as Listing,QF as ModMailActionType,ZF as ModMailConversationState,od as ModMailService,Ue as ModNote,V as Post,ri as PostCollection,nl as PostFlairWidget,ar as PrivateMessage,Rs as RichTextBuilder,pc as SettingScope,ve as Subreddit,Cm as SubredditRulesWidget,tl as TextAreaWidget,x as User,ie as Widget,be as WikiPage,sB as WikiPagePermissionLevel,Em as WikiPageRevision,pl as WikiPageSettings,Us as convertUserFlairProtoToAPI,sd as getModerationLog,Qq as svg};
6
6
  /*! Bundled license information:
7
7
 
8
8
  ieee754/index.js: