hive-react-kit 0.7.3 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -60,7 +60,7 @@
60
60
  ${a}`;class s extends Error{constructor(a,i,o=new Map){super(a),Object.defineProperty(this,"validationErrors",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="ArgumentError",Error.captureStackTrace?Error.captureStackTrace(this,i):this.stack=r(this,(0,t.generateStackTrace)()),this.validationErrors=o}}return Ma.ArgumentError=s,Ma}var $a={},Ts={},zo;function $0(){return zo||(zo=1,Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.default=()=>Math.random().toString(16).slice(2)),Ts}var Ho;function I0(){if(Ho)return $a;Ho=1,Object.defineProperty($a,"__esModule",{value:!0}),$a.not=void 0;const t=$0(),r=tr(),s=n=>{const a=n.addValidator;return n.addValidator=i=>{const{validator:o,message:c,negatedMessage:d}=i,f=(0,t.default)();return i.message=(l,h)=>d?d(l,h):c(l,f).replace(/ to /,"$&not ").replace(f,h),i.validator=l=>!o(l),n[r.validatorSymbol].push(i),n.addValidator=a,n},n};return $a.not=s,$a}var Hn={},Wo;function ys(){return Wo||(Wo=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isPredicate=t.testSymbol=void 0,t.testSymbol=Symbol("test");const r=s=>!!s[t.testSymbol];t.isPredicate=r})(Hn)),Hn}var Ia={},Go;function id(){if(Go)return Ia;Go=1,Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.generateArgumentErrorMessage=void 0;const t=(r,s=!1)=>{const n=[],a=[...r.entries()],i=a.some(([,o])=>o.size!==1);if(a.length===1){const[,o]=a[0];if(!s&&o.size===1){const[c]=o;return c}for(const c of o)n.push(`${s?" - ":""}${c}`);return n.join(`
61
61
  `)}if(!i)return a.map(([,[o]])=>` - ${o}`).join(`
62
62
  `);for(const[o,c]of a){n.push(`Errors from the "${o}" predicate:`);for(const d of c)n.push(` - ${d}`)}return n.join(`
63
- `)};return Ia.generateArgumentErrorMessage=t,Ia}var Jo;function tr(){return Jo||(Jo=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Predicate=t.validatorSymbol=void 0;const r=Pa(),s=go(),n=I0(),a=ys(),i=id();t.validatorSymbol=Symbol("validators");class o{constructor(d,f={}){Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:f}),Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:{validators:[]}}),this.context={...this.context,...this.options};const l=this.type.charAt(0).toLowerCase()+this.type.slice(1);this.addValidator({message:(h,u)=>`Expected ${u?.slice(this.type.length+1)||"argument"} to be of type \`${this.type}\` but received type \`${(0,r.default)(h)}\``,validator:h=>r.default[l](h)})}[a.testSymbol](d,f,l,h){const u=new Map;for(const{validator:p,message:b}of this.context.validators){if(this.options.optional===!0&&d===void 0)continue;let w;try{w=p(d)}catch(m){w=m}if(w===!0)continue;const x=r.default.function_(l)?l():l,g=x&&h?`\`${x}\``:x,v=g?`${this.type} ${g}`:this.type,N=x||this.type,j=u.get(N),y=b(d,v,w);j?j.add(y):u.set(N,new Set([y]))}if(u.size>0){const p=(0,i.generateArgumentErrorMessage)(u);throw new s.ArgumentError(p,f,u)}}get[t.validatorSymbol](){return this.context.validators}get not(){return(0,n.not)(this)}validate(d){return this.addValidator({message:(f,l,h)=>typeof h=="string"?`(${l}) ${h}`:h(l),validator:f=>{const{message:l,validator:h}=d(f);return h?!0:l}})}is(d){return this.addValidator({message:(f,l,h)=>h?`(${l}) ${h}`:`Expected ${l} \`${f}\` to pass custom validation function`,validator:d})}message(d){const{validators:f}=this.context;return f[f.length-1].message=(l,h)=>typeof d=="function"?d(l,h):d,this}addValidator(d){return this.context.validators.push(d),this}}t.Predicate=o})(zn)),zn}var Ds={},Wn={},Fa={},Gn,Yo;function F0(){return Yo||(Yo=1,Gn=function(t){return!isNaN(Date.parse(t))}),Gn}var Xo;function B0(){if(Xo)return Fa;Xo=1,Object.defineProperty(Fa,"__esModule",{value:!0}),Fa.StringPredicate=void 0;const t=Pa(),r=F0(),s=tr();class n extends s.Predicate{constructor(i){super("string",i)}length(i){return this.addValidator({message:(o,c)=>`Expected ${c} to have length \`${i}\`, got \`${o}\``,validator:o=>o.length===i})}minLength(i){return this.addValidator({message:(o,c)=>`Expected ${c} to have a minimum length of \`${i}\`, got \`${o}\``,validator:o=>o.length>=i,negatedMessage:(o,c)=>`Expected ${c} to have a maximum length of \`${i-1}\`, got \`${o}\``})}maxLength(i){return this.addValidator({message:(o,c)=>`Expected ${c} to have a maximum length of \`${i}\`, got \`${o}\``,validator:o=>o.length<=i,negatedMessage:(o,c)=>`Expected ${c} to have a minimum length of \`${i+1}\`, got \`${o}\``})}matches(i){return this.addValidator({message:(o,c)=>`Expected ${c} to match \`${i}\`, got \`${o}\``,validator:o=>i.test(o)})}startsWith(i){return this.addValidator({message:(o,c)=>`Expected ${c} to start with \`${i}\`, got \`${o}\``,validator:o=>o.startsWith(i)})}endsWith(i){return this.addValidator({message:(o,c)=>`Expected ${c} to end with \`${i}\`, got \`${o}\``,validator:o=>o.endsWith(i)})}includes(i){return this.addValidator({message:(o,c)=>`Expected ${c} to include \`${i}\`, got \`${o}\``,validator:o=>o.includes(i)})}oneOf(i){return this.addValidator({message:(o,c)=>{let d=JSON.stringify(i);if(i.length>10){const f=i.length-10;d=JSON.stringify(i.slice(0,10)).replace(/]$/,`,…+${f} more]`)}return`Expected ${c} to be one of \`${d}\`, got \`${o}\``},validator:o=>i.includes(o)})}get empty(){return this.addValidator({message:(i,o)=>`Expected ${o} to be empty, got \`${i}\``,validator:i=>i===""})}get nonEmpty(){return this.addValidator({message:(i,o)=>`Expected ${o} to not be empty`,validator:i=>i!==""})}equals(i){return this.addValidator({message:(o,c)=>`Expected ${c} to be equal to \`${i}\`, got \`${o}\``,validator:o=>o===i})}get alphanumeric(){return this.addValidator({message:(i,o)=>`Expected ${o} to be alphanumeric, got \`${i}\``,validator:i=>/^[a-z\d]+$/i.test(i)})}get alphabetical(){return this.addValidator({message:(i,o)=>`Expected ${o} to be alphabetical, got \`${i}\``,validator:i=>/^[a-z]+$/gi.test(i)})}get numeric(){return this.addValidator({message:(i,o)=>`Expected ${o} to be numeric, got \`${i}\``,validator:i=>/^[+-]?\d+$/i.test(i)})}get date(){return this.addValidator({message:(i,o)=>`Expected ${o} to be a date, got \`${i}\``,validator:r})}get lowercase(){return this.addValidator({message:(i,o)=>`Expected ${o} to be lowercase, got \`${i}\``,validator:i=>i.trim()!==""&&i===i.toLowerCase()})}get uppercase(){return this.addValidator({message:(i,o)=>`Expected ${o} to be uppercase, got \`${i}\``,validator:i=>i.trim()!==""&&i===i.toUpperCase()})}get url(){return this.addValidator({message:(i,o)=>`Expected ${o} to be a URL, got \`${i}\``,validator:t.default.urlString})}}return Fa.StringPredicate=n,Fa}var Ba={},Zo;function V0(){if(Zo)return Ba;Zo=1,Object.defineProperty(Ba,"__esModule",{value:!0}),Ba.NumberPredicate=void 0;const t=Pa(),r=tr();class s extends r.Predicate{constructor(a){super("number",a)}inRange(a,i){return this.addValidator({message:(o,c)=>`Expected ${c} to be in range [${a}..${i}], got ${o}`,validator:o=>t.default.inRange(o,[a,i])})}greaterThan(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be greater than ${a}, got ${i}`,validator:i=>i>a})}greaterThanOrEqual(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be greater than or equal to ${a}, got ${i}`,validator:i=>i>=a})}lessThan(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be less than ${a}, got ${i}`,validator:i=>i<a})}lessThanOrEqual(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be less than or equal to ${a}, got ${i}`,validator:i=>i<=a})}equal(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be equal to ${a}, got ${i}`,validator:i=>i===a})}oneOf(a){return this.addValidator({message:(i,o)=>{let c=JSON.stringify(a);if(a.length>10){const d=a.length-10;c=JSON.stringify(a.slice(0,10)).replace(/]$/,`,…+${d} more]`)}return`Expected ${o} to be one of \`${c}\`, got ${i}`},validator:i=>a.includes(i)})}get integer(){return this.addValidator({message:(a,i)=>`Expected ${i} to be an integer, got ${a}`,validator:a=>t.default.integer(a)})}get finite(){return this.addValidator({message:(a,i)=>`Expected ${i} to be finite, got ${a}`,validator:a=>!t.default.infinite(a)})}get infinite(){return this.addValidator({message:(a,i)=>`Expected ${i} to be infinite, got ${a}`,validator:a=>t.default.infinite(a)})}get positive(){return this.addValidator({message:(a,i)=>`Expected ${i} to be positive, got ${a}`,validator:a=>a>0})}get negative(){return this.addValidator({message:(a,i)=>`Expected ${i} to be negative, got ${a}`,validator:a=>a<0})}get integerOrInfinite(){return this.addValidator({message:(a,i)=>`Expected ${i} to be an integer or infinite, got ${a}`,validator:a=>t.default.integer(a)||t.default.infinite(a)})}get uint8(){return this.integer.inRange(0,255)}get uint16(){return this.integer.inRange(0,65535)}get uint32(){return this.integer.inRange(0,4294967295)}get int8(){return this.integer.inRange(-128,127)}get int16(){return this.integer.inRange(-32768,32767)}get int32(){return this.integer.inRange(-2147483648,2147483647)}}return Ba.NumberPredicate=s,Ba}var Va={},Ko;function U0(){if(Ko)return Va;Ko=1,Object.defineProperty(Va,"__esModule",{value:!0}),Va.BigIntPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(n){super("bigint",n)}}return Va.BigIntPredicate=r,Va}var Ua={},Qo;function q0(){if(Qo)return Ua;Qo=1,Object.defineProperty(Ua,"__esModule",{value:!0}),Ua.BooleanPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(n){super("boolean",n)}get true(){return this.addValidator({message:(n,a)=>`Expected ${a} to be true, got ${n}`,validator:n=>n})}get false(){return this.addValidator({message:(n,a)=>`Expected ${a} to be false, got ${n}`,validator:n=>!n})}}return Ua.BooleanPredicate=r,Ua}var qa={},hs={exports:{}};hs.exports;var el;function kn(){return el||(el=1,(function(t,r){var s=200,n="__lodash_hash_undefined__",a=1,i=2,o=9007199254740991,c="[object Arguments]",d="[object Array]",f="[object AsyncFunction]",l="[object Boolean]",h="[object Date]",u="[object Error]",p="[object Function]",b="[object GeneratorFunction]",w="[object Map]",x="[object Number]",g="[object Null]",v="[object Object]",N="[object Promise]",j="[object Proxy]",y="[object RegExp]",m="[object Set]",_="[object String]",E="[object Symbol]",A="[object Undefined]",C="[object WeakMap]",T="[object ArrayBuffer]",D="[object DataView]",L="[object Float32Array]",H="[object Float64Array]",V="[object Int8Array]",z="[object Int16Array]",F="[object Int32Array]",Y="[object Uint8Array]",G="[object Uint8ClampedArray]",ne="[object Uint16Array]",ie="[object Uint32Array]",xe=/[\\^$.*+?()[\]{}|]/g,U=/^\[object .+?Constructor\]$/,q=/^(?:0|[1-9]\d*)$/,B={};B[L]=B[H]=B[V]=B[z]=B[F]=B[Y]=B[G]=B[ne]=B[ie]=!0,B[c]=B[d]=B[T]=B[l]=B[D]=B[h]=B[u]=B[p]=B[w]=B[x]=B[v]=B[y]=B[m]=B[_]=B[C]=!1;var pe=typeof Kr=="object"&&Kr&&Kr.Object===Object&&Kr,ee=typeof self=="object"&&self&&self.Object===Object&&self,te=pe||ee||Function("return this")(),_e=r&&!r.nodeType&&r,Ie=_e&&!0&&t&&!t.nodeType&&t,K=Ie&&Ie.exports===_e,le=K&&pe.process,oe=(function(){try{return le&&le.binding&&le.binding("util")}catch{}})(),Ne=oe&&oe.isTypedArray;function Ce(R,J){for(var Z=-1,M=R==null?0:R.length,ce=0,me=[];++Z<M;){var qe=R[Z];J(qe,Z,R)&&(me[ce++]=qe)}return me}function Me(R,J){for(var Z=-1,M=J.length,ce=R.length;++Z<M;)R[ce+Z]=J[Z];return R}function Fe(R,J){for(var Z=-1,M=R==null?0:R.length;++Z<M;)if(J(R[Z],Z,R))return!0;return!1}function ue(R,J){for(var Z=-1,M=Array(R);++Z<R;)M[Z]=J(Z);return M}function Re(R){return function(J){return R(J)}}function se(R,J){return R.has(J)}function de(R,J){return R?.[J]}function ve(R){var J=-1,Z=Array(R.size);return R.forEach(function(M,ce){Z[++J]=[ce,M]}),Z}function fe(R,J){return function(Z){return R(J(Z))}}function ke(R){var J=-1,Z=Array(R.size);return R.forEach(function(M){Z[++J]=M}),Z}var Se=Array.prototype,Be=Function.prototype,Ge=Object.prototype,pt=te["__core-js_shared__"],jt=Be.toString,gt=Ge.hasOwnProperty,St=(function(){var R=/[^.]+$/.exec(pt&&pt.keys&&pt.keys.IE_PROTO||"");return R?"Symbol(src)_1."+R:""})(),Ct=Ge.toString,Tt=RegExp("^"+jt.call(gt).replace(xe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Bt=K?te.Buffer:void 0,Ke=te.Symbol,at=te.Uint8Array,_t=Ge.propertyIsEnumerable,Vt=Se.splice,kt=Ke?Ke.toStringTag:void 0,Ut=Object.getOwnPropertySymbols,S=Bt?Bt.isBuffer:void 0,P=fe(Object.keys,Object),I=Xt(te,"DataView"),X=Xt(te,"Map"),be=Xt(te,"Promise"),Oe=Xt(te,"Set"),Xe=Xt(te,"WeakMap"),Ve=Xt(Object,"create"),ze=ae(I),bt=ae(X),Dt=ae(be),Mt=ae(Oe),$t=ae(Xe),Yt=Ke?Ke.prototype:void 0,Et=Yt?Yt.valueOf:void 0;function ft(R){var J=-1,Z=R==null?0:R.length;for(this.clear();++J<Z;){var M=R[J];this.set(M[0],M[1])}}function ge(){this.__data__=Ve?Ve(null):{},this.size=0}function Te(R){var J=this.has(R)&&delete this.__data__[R];return this.size-=J?1:0,J}function Pe(R){var J=this.__data__;if(Ve){var Z=J[R];return Z===n?void 0:Z}return gt.call(J,R)?J[R]:void 0}function He(R){var J=this.__data__;return Ve?J[R]!==void 0:gt.call(J,R)}function Ue(R,J){var Z=this.__data__;return this.size+=this.has(R)?0:1,Z[R]=Ve&&J===void 0?n:J,this}ft.prototype.clear=ge,ft.prototype.delete=Te,ft.prototype.get=Pe,ft.prototype.has=He,ft.prototype.set=Ue;function xt(R){var J=-1,Z=R==null?0:R.length;for(this.clear();++J<Z;){var M=R[J];this.set(M[0],M[1])}}function Je(){this.__data__=[],this.size=0}function cr(R){var J=this.__data__,Z=mt(J,R);if(Z<0)return!1;var M=J.length-1;return Z==M?J.pop():Vt.call(J,Z,1),--this.size,!0}function Or(R){var J=this.__data__,Z=mt(J,R);return Z<0?void 0:J[Z][1]}function rr(R){return mt(this.__data__,R)>-1}function Lr(R,J){var Z=this.__data__,M=mt(Z,R);return M<0?(++this.size,Z.push([R,J])):Z[M][1]=J,this}xt.prototype.clear=Je,xt.prototype.delete=cr,xt.prototype.get=Or,xt.prototype.has=rr,xt.prototype.set=Lr;function zt(R){var J=-1,Z=R==null?0:R.length;for(this.clear();++J<Z;){var M=R[J];this.set(M[0],M[1])}}function Mr(){this.size=0,this.__data__={hash:new ft,map:new(X||xt),string:new ft}}function $e(R){var J=We(this,R).delete(R);return this.size-=J?1:0,J}function ar(R){return We(this,R).get(R)}function kr(R){return We(this,R).has(R)}function ut(R,J){var Z=We(this,R),M=Z.size;return Z.set(R,J),this.size+=Z.size==M?0:1,this}zt.prototype.clear=Mr,zt.prototype.delete=$e,zt.prototype.get=ar,zt.prototype.has=kr,zt.prototype.set=ut;function W(R){var J=-1,Z=R==null?0:R.length;for(this.__data__=new zt;++J<Z;)this.add(R[J])}function Q(R){return this.__data__.set(R,n),this}function we(R){return this.__data__.has(R)}W.prototype.add=W.prototype.push=Q,W.prototype.has=we;function Ae(R){var J=this.__data__=new xt(R);this.size=J.size}function ht(){this.__data__=new xt,this.size=0}function Ye(R){var J=this.__data__,Z=J.delete(R);return this.size=J.size,Z}function yt(R){return this.__data__.get(R)}function Ot(R){return this.__data__.has(R)}function Gt(R,J){var Z=this.__data__;if(Z instanceof xt){var M=Z.__data__;if(!X||M.length<s-1)return M.push([R,J]),this.size=++Z.size,this;Z=this.__data__=new zt(M)}return Z.set(R,J),this.size=Z.size,this}Ae.prototype.clear=ht,Ae.prototype.delete=Ye,Ae.prototype.get=yt,Ae.prototype.has=Ot,Ae.prototype.set=Gt;function At(R,J){var Z=lt(R),M=!Z&&De(R),ce=!Z&&!M&&Qe(R),me=!Z&&!M&&!ce&&dt(R),qe=Z||M||ce||me,nt=qe?ue(R.length,String):[],it=nt.length;for(var ot in R)gt.call(R,ot)&&!(qe&&(ot=="length"||ce&&(ot=="offset"||ot=="parent")||me&&(ot=="buffer"||ot=="byteLength"||ot=="byteOffset")||dr(ot,it)))&&nt.push(ot);return nt}function mt(R,J){for(var Z=R.length;Z--;)if(ye(R[Z][0],J))return Z;return-1}function Rt(R,J,Z){var M=J(R);return lt(R)?M:Me(M,Z(R))}function qt(R){return R==null?R===void 0?A:g:kt&&kt in Object(R)?ir(R):he(R)}function It(R){return Lt(R)&&qt(R)==c}function sr(R,J,Z,M,ce){return R===J?!0:R==null||J==null||!Lt(R)&&!Lt(J)?R!==R&&J!==J:xr(R,J,Z,M,sr,ce)}function xr(R,J,Z,M,ce,me){var qe=lt(R),nt=lt(J),it=qe?d:vt(R),ot=nt?d:vt(J);it=it==c?v:it,ot=ot==c?v:ot;var Ft=it==v,Kt=ot==v,Ht=it==ot;if(Ht&&Qe(R)){if(!Qe(J))return!1;qe=!0,Ft=!1}if(Ht&&!Ft)return me||(me=new Ae),qe||dt(R)?nr(R,J,Z,M,ce,me):yr(R,J,it,Z,M,ce,me);if(!(Z&a)){var wt=Ft&&gt.call(R,"__wrapped__"),fr=Kt&&gt.call(J,"__wrapped__");if(wt||fr){var Sr=wt?R.value():R,Br=fr?J.value():J;return me||(me=new Ae),ce(Sr,Br,Z,M,me)}}return Ht?(me||(me=new Ae),Ir(R,J,Z,M,ce,me)):!1}function br(R){if(!Zt(R)||$(R))return!1;var J=et(R)?Tt:U;return J.test(ae(R))}function lr(R){return Lt(R)&&Pt(R.length)&&!!B[qt(R)]}function ur(R){if(!re(R))return P(R);var J=[];for(var Z in Object(R))gt.call(R,Z)&&Z!="constructor"&&J.push(Z);return J}function nr(R,J,Z,M,ce,me){var qe=Z&a,nt=R.length,it=J.length;if(nt!=it&&!(qe&&it>nt))return!1;var ot=me.get(R);if(ot&&me.get(J))return ot==J;var Ft=-1,Kt=!0,Ht=Z&i?new W:void 0;for(me.set(R,J),me.set(J,R);++Ft<nt;){var wt=R[Ft],fr=J[Ft];if(M)var Sr=qe?M(fr,wt,Ft,J,R,me):M(wt,fr,Ft,R,J,me);if(Sr!==void 0){if(Sr)continue;Kt=!1;break}if(Ht){if(!Fe(J,function(Br,aa){if(!se(Ht,aa)&&(wt===Br||ce(wt,Br,Z,M,me)))return Ht.push(aa)})){Kt=!1;break}}else if(!(wt===fr||ce(wt,fr,Z,M,me))){Kt=!1;break}}return me.delete(R),me.delete(J),Kt}function yr(R,J,Z,M,ce,me,qe){switch(Z){case D:if(R.byteLength!=J.byteLength||R.byteOffset!=J.byteOffset)return!1;R=R.buffer,J=J.buffer;case T:return!(R.byteLength!=J.byteLength||!me(new at(R),new at(J)));case l:case h:case x:return ye(+R,+J);case u:return R.name==J.name&&R.message==J.message;case y:case _:return R==J+"";case w:var nt=ve;case m:var it=M&a;if(nt||(nt=ke),R.size!=J.size&&!it)return!1;var ot=qe.get(R);if(ot)return ot==J;M|=i,qe.set(R,J);var Ft=nr(nt(R),nt(J),M,ce,me,qe);return qe.delete(R),Ft;case E:if(Et)return Et.call(R)==Et.call(J)}return!1}function Ir(R,J,Z,M,ce,me){var qe=Z&a,nt=st(R),it=nt.length,ot=st(J),Ft=ot.length;if(it!=Ft&&!qe)return!1;for(var Kt=it;Kt--;){var Ht=nt[Kt];if(!(qe?Ht in J:gt.call(J,Ht)))return!1}var wt=me.get(R);if(wt&&me.get(J))return wt==J;var fr=!0;me.set(R,J),me.set(J,R);for(var Sr=qe;++Kt<it;){Ht=nt[Kt];var Br=R[Ht],aa=J[Ht];if(M)var Ro=qe?M(aa,Br,Ht,J,R,me):M(Br,aa,Ht,R,J,me);if(!(Ro===void 0?Br===aa||ce(Br,aa,Z,M,me):Ro)){fr=!1;break}Sr||(Sr=Ht=="constructor")}if(fr&&!Sr){var ks=R.constructor,Es=J.constructor;ks!=Es&&"constructor"in R&&"constructor"in J&&!(typeof ks=="function"&&ks instanceof ks&&typeof Es=="function"&&Es instanceof Es)&&(fr=!1)}return me.delete(R),me.delete(J),fr}function st(R){return Rt(R,or,Fr)}function We(R,J){var Z=R.__data__;return vr(J)?Z[typeof J=="string"?"string":"hash"]:Z.map}function Xt(R,J){var Z=de(R,J);return br(Z)?Z:void 0}function ir(R){var J=gt.call(R,kt),Z=R[kt];try{R[kt]=void 0;var M=!0}catch{}var ce=Ct.call(R);return M&&(J?R[kt]=Z:delete R[kt]),ce}var Fr=Ut?function(R){return R==null?[]:(R=Object(R),Ce(Ut(R),function(J){return _t.call(R,J)}))}:Yr,vt=qt;(I&&vt(new I(new ArrayBuffer(1)))!=D||X&&vt(new X)!=w||be&&vt(be.resolve())!=N||Oe&&vt(new Oe)!=m||Xe&&vt(new Xe)!=C)&&(vt=function(R){var J=qt(R),Z=J==v?R.constructor:void 0,M=Z?ae(Z):"";if(M)switch(M){case ze:return D;case bt:return w;case Dt:return N;case Mt:return m;case $t:return C}return J});function dr(R,J){return J=J??o,!!J&&(typeof R=="number"||q.test(R))&&R>-1&&R%1==0&&R<J}function vr(R){var J=typeof R;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?R!=="__proto__":R===null}function $(R){return!!St&&St in R}function re(R){var J=R&&R.constructor,Z=typeof J=="function"&&J.prototype||Ge;return R===Z}function he(R){return Ct.call(R)}function ae(R){if(R!=null){try{return jt.call(R)}catch{}try{return R+""}catch{}}return""}function ye(R,J){return R===J||R!==R&&J!==J}var De=It((function(){return arguments})())?It:function(R){return Lt(R)&&gt.call(R,"callee")&&!_t.call(R,"callee")},lt=Array.isArray;function Ze(R){return R!=null&&Pt(R.length)&&!et(R)}var Qe=S||ra;function ct(R,J){return sr(R,J)}function et(R){if(!Zt(R))return!1;var J=qt(R);return J==p||J==b||J==f||J==j}function Pt(R){return typeof R=="number"&&R>-1&&R%1==0&&R<=o}function Zt(R){var J=typeof R;return R!=null&&(J=="object"||J=="function")}function Lt(R){return R!=null&&typeof R=="object"}var dt=Ne?Re(Ne):lr;function or(R){return Ze(R)?At(R):ur(R)}function Yr(){return[]}function ra(){return!1}t.exports=ct})(hs,hs.exports)),hs.exports}var ia={},Ps={},tl;function En(){if(tl)return Ps;tl=1,Object.defineProperty(Ps,"__esModule",{value:!0});const t=ys();function r(s,n,a,i=!0){a[t.testSymbol](s,r,n,i)}return Ps.default=r,Ps}var rl;function od(){if(rl)return ia;rl=1,Object.defineProperty(ia,"__esModule",{value:!0}),ia.exact=ia.partial=void 0;const t=Pa(),r=En(),s=ys();function n(i,o,c){try{for(const d of Object.keys(o)){const f=c?`${c}.${d}`:d;if((0,s.isPredicate)(o[d]))(0,r.default)(i[d],f,o[d]);else if(t.default.plainObject(o[d])){const l=n(i[d],o[d],f);if(l!==!0)return l}}return!0}catch(d){return d.message}}ia.partial=n;function a(i,o,c,d){try{const f=new Set(Object.keys(i));for(const l of Object.keys(o)){f.delete(l);const h=c?`${c}.${l}`:l;if((0,s.isPredicate)(o[l]))(0,r.default)(i[l],h,o[l]);else if(t.default.plainObject(o[l])){if(!Object.prototype.hasOwnProperty.call(i,l))return`Expected \`${h}\` to exist`;const u=a(i[l],o[l],h);if(u!==!0)return u}}if(f.size>0){const l=[...f.keys()][0],h=c?`${c}.${l}`:l;return`Did not expect ${d?"element":"property"} \`${h}\` to exist, got \`${i[l]}\``}return!0}catch(f){return f.message}}return ia.exact=a,ia}var Os={},al;function An(){if(al)return Os;al=1,Object.defineProperty(Os,"__esModule",{value:!0});const t=En();return Os.default=(r,s,n)=>{try{for(const a of r)(0,t.default)(a,s,n,!1);return!0}catch(a){return a.message}},Os}var sl;function z0(){if(sl)return qa;sl=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.ArrayPredicate=void 0;const t=kn(),r=tr(),s=od(),n=An();class a extends r.Predicate{constructor(o){super("array",o)}length(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have length \`${o}\`, got \`${c.length}\``,validator:c=>c.length===o})}minLength(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a minimum length of \`${o}\`, got \`${c.length}\``,validator:c=>c.length>=o,negatedMessage:(c,d)=>`Expected ${d} to have a maximum length of \`${o-1}\`, got \`${c.length}\``})}maxLength(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a maximum length of \`${o}\`, got \`${c.length}\``,validator:c=>c.length<=o,negatedMessage:(c,d)=>`Expected ${d} to have a minimum length of \`${o+1}\`, got \`${c.length}\``})}startsWith(o){return this.addValidator({message:(c,d)=>`Expected ${d} to start with \`${o}\`, got \`${c[0]}\``,validator:c=>c[0]===o})}endsWith(o){return this.addValidator({message:(c,d)=>`Expected ${d} to end with \`${o}\`, got \`${c[c.length-1]}\``,validator:c=>c[c.length-1]===o})}includes(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to include all elements of \`${JSON.stringify(o)}\`, got \`${JSON.stringify(c)}\``,validator:c=>o.every(d=>c.includes(d))})}includesAny(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to include any element of \`${JSON.stringify(o)}\`, got \`${JSON.stringify(c)}\``,validator:c=>o.some(d=>c.includes(d))})}get empty(){return this.addValidator({message:(o,c)=>`Expected ${c} to be empty, got \`${JSON.stringify(o)}\``,validator:o=>o.length===0})}get nonEmpty(){return this.addValidator({message:(o,c)=>`Expected ${c} to not be empty`,validator:o=>o.length>0})}deepEqual(o){return this.addValidator({message:(c,d)=>`Expected ${d} to be deeply equal to \`${JSON.stringify(o)}\`, got \`${JSON.stringify(c)}\``,validator:c=>t(c,o)})}ofType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,n.default)(c,"values",o)})}exactShape(o){const c=o;return this.addValidator({message:(d,f,l)=>`${l.replace("Expected","Expected element")} in ${f}`,validator:d=>(0,s.exact)(d,c,void 0,!0)})}}return qa.ArrayPredicate=a,qa}var za={},Jn,nl;function H0(){return nl||(nl=1,Jn=t=>{const r=typeof t;return t!==null&&(r==="object"||r==="function")}),Jn}var Yn,il;function W0(){if(il)return Yn;il=1;const t=H0(),r=new Set(["__proto__","prototype","constructor"]),s=a=>!a.some(i=>r.has(i));function n(a){const i=a.split("."),o=[];for(let c=0;c<i.length;c++){let d=i[c];for(;d[d.length-1]==="\\"&&i[c+1]!==void 0;)d=d.slice(0,-1)+".",d+=i[++c];o.push(d)}return s(o)?o:[]}return Yn={get(a,i,o){if(!t(a)||typeof i!="string")return o===void 0?a:o;const c=n(i);if(c.length!==0){for(let d=0;d<c.length;d++)if(a=a[c[d]],a==null){if(d!==c.length-1)return o;break}return a===void 0?o:a}},set(a,i,o){if(!t(a)||typeof i!="string")return a;const c=a,d=n(i);for(let f=0;f<d.length;f++){const l=d[f];t(a[l])||(a[l]={}),f===d.length-1&&(a[l]=o),a=a[l]}return c},delete(a,i){if(!t(a)||typeof i!="string")return!1;const o=n(i);for(let c=0;c<o.length;c++){const d=o[c];if(c===o.length-1)return delete a[d],!0;if(a=a[d],!t(a))return!1}},has(a,i){if(!t(a)||typeof i!="string")return!1;const o=n(i);if(o.length===0)return!1;for(let c=0;c<o.length;c++)if(t(a)){if(!(o[c]in a))return!1;a=a[o[c]]}else return!1;return!0}},Yn}var Ls={},ol;function vs(){return ol||(ol=1,Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.default=(t,r,s=5)=>{const n=[];for(const a of r)if(!t.has(a)&&(n.push(a),n.length===s))return n;return n.length===0?!0:n}),Ls}var Ms={},ll;function G0(){if(ll)return Ms;ll=1,Object.defineProperty(Ms,"__esModule",{value:!0});const t=Pa(),r=En(),s=(n,a)=>t.default.plainObject(n)?Object.values(n).every(i=>s(i,a)):((0,r.default)(n,"deep values",a,!1),!0);return Ms.default=(n,a)=>{try{return s(n,a)}catch(i){return i.message}},Ms}var ul;function J0(){if(ul)return za;ul=1,Object.defineProperty(za,"__esModule",{value:!0}),za.ObjectPredicate=void 0;const t=Pa(),r=W0(),s=kn(),n=vs(),a=An(),i=G0(),o=od(),c=tr();class d extends c.Predicate{constructor(l){super("object",l)}get plain(){return this.addValidator({message:(l,h)=>`Expected ${h} to be a plain object`,validator:l=>t.default.plainObject(l)})}get empty(){return this.addValidator({message:(l,h)=>`Expected ${h} to be empty, got \`${JSON.stringify(l)}\``,validator:l=>Object.keys(l).length===0})}get nonEmpty(){return this.addValidator({message:(l,h)=>`Expected ${h} to not be empty`,validator:l=>Object.keys(l).length>0})}valuesOfType(l){return this.addValidator({message:(h,u,p)=>`(${u}) ${p}`,validator:h=>(0,a.default)(Object.values(h),"values",l)})}deepValuesOfType(l){return this.addValidator({message:(h,u,p)=>`(${u}) ${p}`,validator:h=>(0,i.default)(h,l)})}deepEqual(l){return this.addValidator({message:(h,u)=>`Expected ${u} to be deeply equal to \`${JSON.stringify(l)}\`, got \`${JSON.stringify(h)}\``,validator:h=>s(h,l)})}instanceOf(l){return this.addValidator({message:(h,u)=>{var p;let{name:b}=(p=h?.constructor)!==null&&p!==void 0?p:{};return(!b||b==="Object")&&(b=JSON.stringify(h)),`Expected ${u} \`${b}\` to be of type \`${l.name}\``},validator:h=>h instanceof l})}hasKeys(...l){return this.addValidator({message:(h,u,p)=>`Expected ${u} to have keys \`${JSON.stringify(p)}\``,validator:h=>(0,n.default)({has:u=>r.has(h,u)},l)})}hasAnyKeys(...l){return this.addValidator({message:(h,u)=>`Expected ${u} to have any key of \`${JSON.stringify(l)}\``,validator:h=>l.some(u=>r.has(h,u))})}partialShape(l){return this.addValidator({message:(h,u,p)=>`${p.replace("Expected","Expected property")} in ${u}`,validator:h=>(0,o.partial)(h,l)})}exactShape(l){return this.addValidator({message:(h,u,p)=>`${p.replace("Expected","Expected property")} in ${u}`,validator:h=>(0,o.exact)(h,l)})}}return za.ObjectPredicate=d,za}var Ha={},cl;function Y0(){if(cl)return Ha;cl=1,Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.DatePredicate=void 0;const t=tr();class r extends t.Predicate{constructor(n){super("date",n)}before(n){return this.addValidator({message:(a,i)=>`Expected ${i} ${a.toISOString()} to be before ${n.toISOString()}`,validator:a=>a.getTime()<n.getTime()})}after(n){return this.addValidator({message:(a,i)=>`Expected ${i} ${a.toISOString()} to be after ${n.toISOString()}`,validator:a=>a.getTime()>n.getTime()})}}return Ha.DatePredicate=r,Ha}var Wa={},dl;function X0(){if(dl)return Wa;dl=1,Object.defineProperty(Wa,"__esModule",{value:!0}),Wa.ErrorPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(n){super("error",n)}name(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have name \`${n}\`, got \`${a.name}\``,validator:a=>a.name===n})}message(n){return this.addValidator({message:(a,i)=>`Expected ${i} message to be \`${n}\`, got \`${a.message}\``,validator:a=>a.message===n})}messageIncludes(n){return this.addValidator({message:(a,i)=>`Expected ${i} message to include \`${n}\`, got \`${a.message}\``,validator:a=>a.message.includes(n)})}hasKeys(...n){return this.addValidator({message:(a,i)=>`Expected ${i} message to have keys \`${n.join("`, `")}\``,validator:a=>n.every(i=>Object.prototype.hasOwnProperty.call(a,i))})}instanceOf(n){return this.addValidator({message:(a,i)=>`Expected ${i} \`${a.name}\` to be of type \`${n.name}\``,validator:a=>a instanceof n})}get typeError(){return this.instanceOf(TypeError)}get evalError(){return this.instanceOf(EvalError)}get rangeError(){return this.instanceOf(RangeError)}get referenceError(){return this.instanceOf(ReferenceError)}get syntaxError(){return this.instanceOf(SyntaxError)}get uriError(){return this.instanceOf(URIError)}}return Wa.ErrorPredicate=r,Wa}var Ga={},fl;function Z0(){if(fl)return Ga;fl=1,Object.defineProperty(Ga,"__esModule",{value:!0}),Ga.MapPredicate=void 0;const t=kn(),r=vs(),s=An(),n=tr();class a extends n.Predicate{constructor(o){super("Map",o)}size(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have size \`${o}\`, got \`${c.size}\``,validator:c=>c.size===o})}minSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a minimum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size>=o,negatedMessage:(c,d)=>`Expected ${d} to have a maximum size of \`${o-1}\`, got \`${c.size}\``})}maxSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a maximum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size<=o,negatedMessage:(c,d)=>`Expected ${d} to have a minimum size of \`${o+1}\`, got \`${c.size}\``})}hasKeys(...o){return this.addValidator({message:(c,d,f)=>`Expected ${d} to have keys \`${JSON.stringify(f)}\``,validator:c=>(0,r.default)(c,o)})}hasAnyKeys(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to have any key of \`${JSON.stringify(o)}\``,validator:c=>o.some(d=>c.has(d))})}hasValues(...o){return this.addValidator({message:(c,d,f)=>`Expected ${d} to have values \`${JSON.stringify(f)}\``,validator:c=>(0,r.default)(new Set(c.values()),o)})}hasAnyValues(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to have any value of \`${JSON.stringify(o)}\``,validator:c=>{const d=new Set(c.values());return o.some(f=>d.has(f))}})}keysOfType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,s.default)(c.keys(),"keys",o)})}valuesOfType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,s.default)(c.values(),"values",o)})}get empty(){return this.addValidator({message:(o,c)=>`Expected ${c} to be empty, got \`${JSON.stringify([...o])}\``,validator:o=>o.size===0})}get nonEmpty(){return this.addValidator({message:(o,c)=>`Expected ${c} to not be empty`,validator:o=>o.size>0})}deepEqual(o){return this.addValidator({message:(c,d)=>`Expected ${d} to be deeply equal to \`${JSON.stringify([...o])}\`, got \`${JSON.stringify([...c])}\``,validator:c=>t(c,o)})}}return Ga.MapPredicate=a,Ga}var Ja={},hl;function K0(){if(hl)return Ja;hl=1,Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.WeakMapPredicate=void 0;const t=vs(),r=tr();class s extends r.Predicate{constructor(a){super("WeakMap",a)}hasKeys(...a){return this.addValidator({message:(i,o,c)=>`Expected ${o} to have keys \`${JSON.stringify(c)}\``,validator:i=>(0,t.default)(i,a)})}hasAnyKeys(...a){return this.addValidator({message:(i,o)=>`Expected ${o} to have any key of \`${JSON.stringify(a)}\``,validator:i=>a.some(o=>i.has(o))})}}return Ja.WeakMapPredicate=s,Ja}var Ya={},ml;function Q0(){if(ml)return Ya;ml=1,Object.defineProperty(Ya,"__esModule",{value:!0}),Ya.SetPredicate=void 0;const t=kn(),r=vs(),s=An(),n=tr();class a extends n.Predicate{constructor(o){super("Set",o)}size(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have size \`${o}\`, got \`${c.size}\``,validator:c=>c.size===o})}minSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a minimum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size>=o,negatedMessage:(c,d)=>`Expected ${d} to have a maximum size of \`${o-1}\`, got \`${c.size}\``})}maxSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a maximum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size<=o,negatedMessage:(c,d)=>`Expected ${d} to have a minimum size of \`${o+1}\`, got \`${c.size}\``})}has(...o){return this.addValidator({message:(c,d,f)=>`Expected ${d} to have items \`${JSON.stringify(f)}\``,validator:c=>(0,r.default)(c,o)})}hasAny(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to have any item of \`${JSON.stringify(o)}\``,validator:c=>o.some(d=>c.has(d))})}ofType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,s.default)(c,"values",o)})}get empty(){return this.addValidator({message:(o,c)=>`Expected ${c} to be empty, got \`${JSON.stringify([...o])}\``,validator:o=>o.size===0})}get nonEmpty(){return this.addValidator({message:(o,c)=>`Expected ${c} to not be empty`,validator:o=>o.size>0})}deepEqual(o){return this.addValidator({message:(c,d)=>`Expected ${d} to be deeply equal to \`${JSON.stringify([...o])}\`, got \`${JSON.stringify([...c])}\``,validator:c=>t(c,o)})}}return Ya.SetPredicate=a,Ya}var Xa={},pl;function ef(){if(pl)return Xa;pl=1,Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.WeakSetPredicate=void 0;const t=vs(),r=tr();class s extends r.Predicate{constructor(a){super("WeakSet",a)}has(...a){return this.addValidator({message:(i,o,c)=>`Expected ${o} to have items \`${JSON.stringify(c)}\``,validator:i=>(0,t.default)(i,a)})}hasAny(...a){return this.addValidator({message:(i,o)=>`Expected ${o} to have any item of \`${JSON.stringify(a)}\``,validator:i=>a.some(o=>i.has(o))})}}return Xa.WeakSetPredicate=s,Xa}var Za={},gl;function tf(){if(gl)return Za;gl=1,Object.defineProperty(Za,"__esModule",{value:!0}),Za.TypedArrayPredicate=void 0;const t=tr();class r extends t.Predicate{byteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength===n})}minByteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength>=n,negatedMessage:(a,i)=>`Expected ${i} to have a maximum byte length of \`${n-1}\`, got \`${a.byteLength}\``})}maxByteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength<=n,negatedMessage:(a,i)=>`Expected ${i} to have a minimum byte length of \`${n+1}\`, got \`${a.byteLength}\``})}length(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have length \`${n}\`, got \`${a.length}\``,validator:a=>a.length===n})}minLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum length of \`${n}\`, got \`${a.length}\``,validator:a=>a.length>=n,negatedMessage:(a,i)=>`Expected ${i} to have a maximum length of \`${n-1}\`, got \`${a.length}\``})}maxLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum length of \`${n}\`, got \`${a.length}\``,validator:a=>a.length<=n,negatedMessage:(a,i)=>`Expected ${i} to have a minimum length of \`${n+1}\`, got \`${a.length}\``})}}return Za.TypedArrayPredicate=r,Za}var Ka={},xl;function rf(){if(xl)return Ka;xl=1,Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.ArrayBufferPredicate=void 0;const t=tr();class r extends t.Predicate{byteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength===n})}minByteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength>=n,negatedMessage:(a,i)=>`Expected ${i} to have a maximum byte length of \`${n-1}\`, got \`${a.byteLength}\``})}maxByteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength<=n,negatedMessage:(a,i)=>`Expected ${i} to have a minimum byte length of \`${n+1}\`, got \`${a.byteLength}\``})}}return Ka.ArrayBufferPredicate=r,Ka}var Qa={},bl;function af(){if(bl)return Qa;bl=1,Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.DataViewPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(n){super("DataView",n)}byteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength===n})}minByteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength>=n,negatedMessage:(a,i)=>`Expected ${i} to have a maximum byte length of \`${n-1}\`, got \`${a.byteLength}\``})}maxByteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength<=n,negatedMessage:(a,i)=>`Expected ${i} to have a minimum byte length of \`${n+1}\`, got \`${a.byteLength}\``})}}return Qa.DataViewPredicate=r,Qa}var es={},yl;function sf(){if(yl)return es;yl=1,Object.defineProperty(es,"__esModule",{value:!0}),es.AnyPredicate=void 0;const t=go(),r=ys(),s=id();class n{constructor(i,o={}){Object.defineProperty(this,"predicates",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:o})}[r.testSymbol](i,o,c,d){const f=new Map;for(const l of this.predicates)try{o(i,c,l,d);return}catch(h){if(i===void 0&&this.options.optional===!0)return;if(h instanceof t.ArgumentError)for(const[u,p]of h.validationErrors.entries()){const b=f.get(u);f.set(u,new Set([...b??[],...p]))}}if(f.size>0){const l=(0,s.generateArgumentErrorMessage)(f,!0);throw new t.ArgumentError(`Any predicate failed with the following errors:
63
+ `)};return Ia.generateArgumentErrorMessage=t,Ia}var Jo;function tr(){return Jo||(Jo=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Predicate=t.validatorSymbol=void 0;const r=Pa(),s=go(),n=I0(),a=ys(),i=id();t.validatorSymbol=Symbol("validators");class o{constructor(d,f={}){Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:f}),Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:{validators:[]}}),this.context={...this.context,...this.options};const l=this.type.charAt(0).toLowerCase()+this.type.slice(1);this.addValidator({message:(h,u)=>`Expected ${u?.slice(this.type.length+1)||"argument"} to be of type \`${this.type}\` but received type \`${(0,r.default)(h)}\``,validator:h=>r.default[l](h)})}[a.testSymbol](d,f,l,h){const u=new Map;for(const{validator:p,message:b}of this.context.validators){if(this.options.optional===!0&&d===void 0)continue;let w;try{w=p(d)}catch(m){w=m}if(w===!0)continue;const x=r.default.function_(l)?l():l,g=x&&h?`\`${x}\``:x,v=g?`${this.type} ${g}`:this.type,N=x||this.type,j=u.get(N),y=b(d,v,w);j?j.add(y):u.set(N,new Set([y]))}if(u.size>0){const p=(0,i.generateArgumentErrorMessage)(u);throw new s.ArgumentError(p,f,u)}}get[t.validatorSymbol](){return this.context.validators}get not(){return(0,n.not)(this)}validate(d){return this.addValidator({message:(f,l,h)=>typeof h=="string"?`(${l}) ${h}`:h(l),validator:f=>{const{message:l,validator:h}=d(f);return h?!0:l}})}is(d){return this.addValidator({message:(f,l,h)=>h?`(${l}) ${h}`:`Expected ${l} \`${f}\` to pass custom validation function`,validator:d})}message(d){const{validators:f}=this.context;return f[f.length-1].message=(l,h)=>typeof d=="function"?d(l,h):d,this}addValidator(d){return this.context.validators.push(d),this}}t.Predicate=o})(zn)),zn}var Ds={},Wn={},Fa={},Gn,Yo;function F0(){return Yo||(Yo=1,Gn=function(t){return!isNaN(Date.parse(t))}),Gn}var Xo;function B0(){if(Xo)return Fa;Xo=1,Object.defineProperty(Fa,"__esModule",{value:!0}),Fa.StringPredicate=void 0;const t=Pa(),r=F0(),s=tr();class n extends s.Predicate{constructor(i){super("string",i)}length(i){return this.addValidator({message:(o,c)=>`Expected ${c} to have length \`${i}\`, got \`${o}\``,validator:o=>o.length===i})}minLength(i){return this.addValidator({message:(o,c)=>`Expected ${c} to have a minimum length of \`${i}\`, got \`${o}\``,validator:o=>o.length>=i,negatedMessage:(o,c)=>`Expected ${c} to have a maximum length of \`${i-1}\`, got \`${o}\``})}maxLength(i){return this.addValidator({message:(o,c)=>`Expected ${c} to have a maximum length of \`${i}\`, got \`${o}\``,validator:o=>o.length<=i,negatedMessage:(o,c)=>`Expected ${c} to have a minimum length of \`${i+1}\`, got \`${o}\``})}matches(i){return this.addValidator({message:(o,c)=>`Expected ${c} to match \`${i}\`, got \`${o}\``,validator:o=>i.test(o)})}startsWith(i){return this.addValidator({message:(o,c)=>`Expected ${c} to start with \`${i}\`, got \`${o}\``,validator:o=>o.startsWith(i)})}endsWith(i){return this.addValidator({message:(o,c)=>`Expected ${c} to end with \`${i}\`, got \`${o}\``,validator:o=>o.endsWith(i)})}includes(i){return this.addValidator({message:(o,c)=>`Expected ${c} to include \`${i}\`, got \`${o}\``,validator:o=>o.includes(i)})}oneOf(i){return this.addValidator({message:(o,c)=>{let d=JSON.stringify(i);if(i.length>10){const f=i.length-10;d=JSON.stringify(i.slice(0,10)).replace(/]$/,`,…+${f} more]`)}return`Expected ${c} to be one of \`${d}\`, got \`${o}\``},validator:o=>i.includes(o)})}get empty(){return this.addValidator({message:(i,o)=>`Expected ${o} to be empty, got \`${i}\``,validator:i=>i===""})}get nonEmpty(){return this.addValidator({message:(i,o)=>`Expected ${o} to not be empty`,validator:i=>i!==""})}equals(i){return this.addValidator({message:(o,c)=>`Expected ${c} to be equal to \`${i}\`, got \`${o}\``,validator:o=>o===i})}get alphanumeric(){return this.addValidator({message:(i,o)=>`Expected ${o} to be alphanumeric, got \`${i}\``,validator:i=>/^[a-z\d]+$/i.test(i)})}get alphabetical(){return this.addValidator({message:(i,o)=>`Expected ${o} to be alphabetical, got \`${i}\``,validator:i=>/^[a-z]+$/gi.test(i)})}get numeric(){return this.addValidator({message:(i,o)=>`Expected ${o} to be numeric, got \`${i}\``,validator:i=>/^[+-]?\d+$/i.test(i)})}get date(){return this.addValidator({message:(i,o)=>`Expected ${o} to be a date, got \`${i}\``,validator:r})}get lowercase(){return this.addValidator({message:(i,o)=>`Expected ${o} to be lowercase, got \`${i}\``,validator:i=>i.trim()!==""&&i===i.toLowerCase()})}get uppercase(){return this.addValidator({message:(i,o)=>`Expected ${o} to be uppercase, got \`${i}\``,validator:i=>i.trim()!==""&&i===i.toUpperCase()})}get url(){return this.addValidator({message:(i,o)=>`Expected ${o} to be a URL, got \`${i}\``,validator:t.default.urlString})}}return Fa.StringPredicate=n,Fa}var Ba={},Zo;function V0(){if(Zo)return Ba;Zo=1,Object.defineProperty(Ba,"__esModule",{value:!0}),Ba.NumberPredicate=void 0;const t=Pa(),r=tr();class s extends r.Predicate{constructor(a){super("number",a)}inRange(a,i){return this.addValidator({message:(o,c)=>`Expected ${c} to be in range [${a}..${i}], got ${o}`,validator:o=>t.default.inRange(o,[a,i])})}greaterThan(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be greater than ${a}, got ${i}`,validator:i=>i>a})}greaterThanOrEqual(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be greater than or equal to ${a}, got ${i}`,validator:i=>i>=a})}lessThan(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be less than ${a}, got ${i}`,validator:i=>i<a})}lessThanOrEqual(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be less than or equal to ${a}, got ${i}`,validator:i=>i<=a})}equal(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be equal to ${a}, got ${i}`,validator:i=>i===a})}oneOf(a){return this.addValidator({message:(i,o)=>{let c=JSON.stringify(a);if(a.length>10){const d=a.length-10;c=JSON.stringify(a.slice(0,10)).replace(/]$/,`,…+${d} more]`)}return`Expected ${o} to be one of \`${c}\`, got ${i}`},validator:i=>a.includes(i)})}get integer(){return this.addValidator({message:(a,i)=>`Expected ${i} to be an integer, got ${a}`,validator:a=>t.default.integer(a)})}get finite(){return this.addValidator({message:(a,i)=>`Expected ${i} to be finite, got ${a}`,validator:a=>!t.default.infinite(a)})}get infinite(){return this.addValidator({message:(a,i)=>`Expected ${i} to be infinite, got ${a}`,validator:a=>t.default.infinite(a)})}get positive(){return this.addValidator({message:(a,i)=>`Expected ${i} to be positive, got ${a}`,validator:a=>a>0})}get negative(){return this.addValidator({message:(a,i)=>`Expected ${i} to be negative, got ${a}`,validator:a=>a<0})}get integerOrInfinite(){return this.addValidator({message:(a,i)=>`Expected ${i} to be an integer or infinite, got ${a}`,validator:a=>t.default.integer(a)||t.default.infinite(a)})}get uint8(){return this.integer.inRange(0,255)}get uint16(){return this.integer.inRange(0,65535)}get uint32(){return this.integer.inRange(0,4294967295)}get int8(){return this.integer.inRange(-128,127)}get int16(){return this.integer.inRange(-32768,32767)}get int32(){return this.integer.inRange(-2147483648,2147483647)}}return Ba.NumberPredicate=s,Ba}var Va={},Ko;function U0(){if(Ko)return Va;Ko=1,Object.defineProperty(Va,"__esModule",{value:!0}),Va.BigIntPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(n){super("bigint",n)}}return Va.BigIntPredicate=r,Va}var Ua={},Qo;function q0(){if(Qo)return Ua;Qo=1,Object.defineProperty(Ua,"__esModule",{value:!0}),Ua.BooleanPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(n){super("boolean",n)}get true(){return this.addValidator({message:(n,a)=>`Expected ${a} to be true, got ${n}`,validator:n=>n})}get false(){return this.addValidator({message:(n,a)=>`Expected ${a} to be false, got ${n}`,validator:n=>!n})}}return Ua.BooleanPredicate=r,Ua}var qa={},hs={exports:{}};hs.exports;var el;function kn(){return el||(el=1,(function(t,r){var s=200,n="__lodash_hash_undefined__",a=1,i=2,o=9007199254740991,c="[object Arguments]",d="[object Array]",f="[object AsyncFunction]",l="[object Boolean]",h="[object Date]",u="[object Error]",p="[object Function]",b="[object GeneratorFunction]",w="[object Map]",x="[object Number]",g="[object Null]",v="[object Object]",N="[object Promise]",j="[object Proxy]",y="[object RegExp]",m="[object Set]",_="[object String]",E="[object Symbol]",A="[object Undefined]",C="[object WeakMap]",T="[object ArrayBuffer]",D="[object DataView]",L="[object Float32Array]",H="[object Float64Array]",V="[object Int8Array]",z="[object Int16Array]",F="[object Int32Array]",Y="[object Uint8Array]",G="[object Uint8ClampedArray]",ne="[object Uint16Array]",ie="[object Uint32Array]",xe=/[\\^$.*+?()[\]{}|]/g,U=/^\[object .+?Constructor\]$/,q=/^(?:0|[1-9]\d*)$/,B={};B[L]=B[H]=B[V]=B[z]=B[F]=B[Y]=B[G]=B[ne]=B[ie]=!0,B[c]=B[d]=B[T]=B[l]=B[D]=B[h]=B[u]=B[p]=B[w]=B[x]=B[v]=B[y]=B[m]=B[_]=B[C]=!1;var pe=typeof Kr=="object"&&Kr&&Kr.Object===Object&&Kr,ee=typeof self=="object"&&self&&self.Object===Object&&self,te=pe||ee||Function("return this")(),_e=r&&!r.nodeType&&r,Ie=_e&&!0&&t&&!t.nodeType&&t,K=Ie&&Ie.exports===_e,le=K&&pe.process,oe=(function(){try{return le&&le.binding&&le.binding("util")}catch{}})(),Ne=oe&&oe.isTypedArray;function Ce(R,J){for(var Z=-1,M=R==null?0:R.length,ce=0,me=[];++Z<M;){var qe=R[Z];J(qe,Z,R)&&(me[ce++]=qe)}return me}function Me(R,J){for(var Z=-1,M=J.length,ce=R.length;++Z<M;)R[ce+Z]=J[Z];return R}function Fe(R,J){for(var Z=-1,M=R==null?0:R.length;++Z<M;)if(J(R[Z],Z,R))return!0;return!1}function ue(R,J){for(var Z=-1,M=Array(R);++Z<R;)M[Z]=J(Z);return M}function Re(R){return function(J){return R(J)}}function ae(R,J){return R.has(J)}function de(R,J){return R?.[J]}function ve(R){var J=-1,Z=Array(R.size);return R.forEach(function(M,ce){Z[++J]=[ce,M]}),Z}function fe(R,J){return function(Z){return R(J(Z))}}function ke(R){var J=-1,Z=Array(R.size);return R.forEach(function(M){Z[++J]=M}),Z}var Se=Array.prototype,Be=Function.prototype,Ge=Object.prototype,pt=te["__core-js_shared__"],jt=Be.toString,gt=Ge.hasOwnProperty,St=(function(){var R=/[^.]+$/.exec(pt&&pt.keys&&pt.keys.IE_PROTO||"");return R?"Symbol(src)_1."+R:""})(),Ct=Ge.toString,Tt=RegExp("^"+jt.call(gt).replace(xe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Bt=K?te.Buffer:void 0,Ke=te.Symbol,at=te.Uint8Array,_t=Ge.propertyIsEnumerable,Vt=Se.splice,kt=Ke?Ke.toStringTag:void 0,Ut=Object.getOwnPropertySymbols,S=Bt?Bt.isBuffer:void 0,P=fe(Object.keys,Object),I=Xt(te,"DataView"),X=Xt(te,"Map"),be=Xt(te,"Promise"),Oe=Xt(te,"Set"),Xe=Xt(te,"WeakMap"),Ve=Xt(Object,"create"),ze=se(I),bt=se(X),Dt=se(be),Mt=se(Oe),$t=se(Xe),Yt=Ke?Ke.prototype:void 0,Et=Yt?Yt.valueOf:void 0;function ft(R){var J=-1,Z=R==null?0:R.length;for(this.clear();++J<Z;){var M=R[J];this.set(M[0],M[1])}}function ge(){this.__data__=Ve?Ve(null):{},this.size=0}function Te(R){var J=this.has(R)&&delete this.__data__[R];return this.size-=J?1:0,J}function Pe(R){var J=this.__data__;if(Ve){var Z=J[R];return Z===n?void 0:Z}return gt.call(J,R)?J[R]:void 0}function He(R){var J=this.__data__;return Ve?J[R]!==void 0:gt.call(J,R)}function Ue(R,J){var Z=this.__data__;return this.size+=this.has(R)?0:1,Z[R]=Ve&&J===void 0?n:J,this}ft.prototype.clear=ge,ft.prototype.delete=Te,ft.prototype.get=Pe,ft.prototype.has=He,ft.prototype.set=Ue;function xt(R){var J=-1,Z=R==null?0:R.length;for(this.clear();++J<Z;){var M=R[J];this.set(M[0],M[1])}}function Je(){this.__data__=[],this.size=0}function cr(R){var J=this.__data__,Z=mt(J,R);if(Z<0)return!1;var M=J.length-1;return Z==M?J.pop():Vt.call(J,Z,1),--this.size,!0}function Or(R){var J=this.__data__,Z=mt(J,R);return Z<0?void 0:J[Z][1]}function rr(R){return mt(this.__data__,R)>-1}function Lr(R,J){var Z=this.__data__,M=mt(Z,R);return M<0?(++this.size,Z.push([R,J])):Z[M][1]=J,this}xt.prototype.clear=Je,xt.prototype.delete=cr,xt.prototype.get=Or,xt.prototype.has=rr,xt.prototype.set=Lr;function zt(R){var J=-1,Z=R==null?0:R.length;for(this.clear();++J<Z;){var M=R[J];this.set(M[0],M[1])}}function Mr(){this.size=0,this.__data__={hash:new ft,map:new(X||xt),string:new ft}}function $e(R){var J=We(this,R).delete(R);return this.size-=J?1:0,J}function ar(R){return We(this,R).get(R)}function kr(R){return We(this,R).has(R)}function ut(R,J){var Z=We(this,R),M=Z.size;return Z.set(R,J),this.size+=Z.size==M?0:1,this}zt.prototype.clear=Mr,zt.prototype.delete=$e,zt.prototype.get=ar,zt.prototype.has=kr,zt.prototype.set=ut;function W(R){var J=-1,Z=R==null?0:R.length;for(this.__data__=new zt;++J<Z;)this.add(R[J])}function Q(R){return this.__data__.set(R,n),this}function we(R){return this.__data__.has(R)}W.prototype.add=W.prototype.push=Q,W.prototype.has=we;function Ae(R){var J=this.__data__=new xt(R);this.size=J.size}function ht(){this.__data__=new xt,this.size=0}function Ye(R){var J=this.__data__,Z=J.delete(R);return this.size=J.size,Z}function yt(R){return this.__data__.get(R)}function Ot(R){return this.__data__.has(R)}function Gt(R,J){var Z=this.__data__;if(Z instanceof xt){var M=Z.__data__;if(!X||M.length<s-1)return M.push([R,J]),this.size=++Z.size,this;Z=this.__data__=new zt(M)}return Z.set(R,J),this.size=Z.size,this}Ae.prototype.clear=ht,Ae.prototype.delete=Ye,Ae.prototype.get=yt,Ae.prototype.has=Ot,Ae.prototype.set=Gt;function At(R,J){var Z=lt(R),M=!Z&&De(R),ce=!Z&&!M&&Qe(R),me=!Z&&!M&&!ce&&dt(R),qe=Z||M||ce||me,nt=qe?ue(R.length,String):[],it=nt.length;for(var ot in R)gt.call(R,ot)&&!(qe&&(ot=="length"||ce&&(ot=="offset"||ot=="parent")||me&&(ot=="buffer"||ot=="byteLength"||ot=="byteOffset")||dr(ot,it)))&&nt.push(ot);return nt}function mt(R,J){for(var Z=R.length;Z--;)if(ye(R[Z][0],J))return Z;return-1}function Rt(R,J,Z){var M=J(R);return lt(R)?M:Me(M,Z(R))}function qt(R){return R==null?R===void 0?A:g:kt&&kt in Object(R)?ir(R):he(R)}function It(R){return Lt(R)&&qt(R)==c}function sr(R,J,Z,M,ce){return R===J?!0:R==null||J==null||!Lt(R)&&!Lt(J)?R!==R&&J!==J:xr(R,J,Z,M,sr,ce)}function xr(R,J,Z,M,ce,me){var qe=lt(R),nt=lt(J),it=qe?d:vt(R),ot=nt?d:vt(J);it=it==c?v:it,ot=ot==c?v:ot;var Ft=it==v,Kt=ot==v,Ht=it==ot;if(Ht&&Qe(R)){if(!Qe(J))return!1;qe=!0,Ft=!1}if(Ht&&!Ft)return me||(me=new Ae),qe||dt(R)?nr(R,J,Z,M,ce,me):yr(R,J,it,Z,M,ce,me);if(!(Z&a)){var wt=Ft&&gt.call(R,"__wrapped__"),fr=Kt&&gt.call(J,"__wrapped__");if(wt||fr){var Sr=wt?R.value():R,Br=fr?J.value():J;return me||(me=new Ae),ce(Sr,Br,Z,M,me)}}return Ht?(me||(me=new Ae),Ir(R,J,Z,M,ce,me)):!1}function br(R){if(!Zt(R)||$(R))return!1;var J=et(R)?Tt:U;return J.test(se(R))}function lr(R){return Lt(R)&&Pt(R.length)&&!!B[qt(R)]}function ur(R){if(!re(R))return P(R);var J=[];for(var Z in Object(R))gt.call(R,Z)&&Z!="constructor"&&J.push(Z);return J}function nr(R,J,Z,M,ce,me){var qe=Z&a,nt=R.length,it=J.length;if(nt!=it&&!(qe&&it>nt))return!1;var ot=me.get(R);if(ot&&me.get(J))return ot==J;var Ft=-1,Kt=!0,Ht=Z&i?new W:void 0;for(me.set(R,J),me.set(J,R);++Ft<nt;){var wt=R[Ft],fr=J[Ft];if(M)var Sr=qe?M(fr,wt,Ft,J,R,me):M(wt,fr,Ft,R,J,me);if(Sr!==void 0){if(Sr)continue;Kt=!1;break}if(Ht){if(!Fe(J,function(Br,aa){if(!ae(Ht,aa)&&(wt===Br||ce(wt,Br,Z,M,me)))return Ht.push(aa)})){Kt=!1;break}}else if(!(wt===fr||ce(wt,fr,Z,M,me))){Kt=!1;break}}return me.delete(R),me.delete(J),Kt}function yr(R,J,Z,M,ce,me,qe){switch(Z){case D:if(R.byteLength!=J.byteLength||R.byteOffset!=J.byteOffset)return!1;R=R.buffer,J=J.buffer;case T:return!(R.byteLength!=J.byteLength||!me(new at(R),new at(J)));case l:case h:case x:return ye(+R,+J);case u:return R.name==J.name&&R.message==J.message;case y:case _:return R==J+"";case w:var nt=ve;case m:var it=M&a;if(nt||(nt=ke),R.size!=J.size&&!it)return!1;var ot=qe.get(R);if(ot)return ot==J;M|=i,qe.set(R,J);var Ft=nr(nt(R),nt(J),M,ce,me,qe);return qe.delete(R),Ft;case E:if(Et)return Et.call(R)==Et.call(J)}return!1}function Ir(R,J,Z,M,ce,me){var qe=Z&a,nt=st(R),it=nt.length,ot=st(J),Ft=ot.length;if(it!=Ft&&!qe)return!1;for(var Kt=it;Kt--;){var Ht=nt[Kt];if(!(qe?Ht in J:gt.call(J,Ht)))return!1}var wt=me.get(R);if(wt&&me.get(J))return wt==J;var fr=!0;me.set(R,J),me.set(J,R);for(var Sr=qe;++Kt<it;){Ht=nt[Kt];var Br=R[Ht],aa=J[Ht];if(M)var Ro=qe?M(aa,Br,Ht,J,R,me):M(Br,aa,Ht,R,J,me);if(!(Ro===void 0?Br===aa||ce(Br,aa,Z,M,me):Ro)){fr=!1;break}Sr||(Sr=Ht=="constructor")}if(fr&&!Sr){var ks=R.constructor,Es=J.constructor;ks!=Es&&"constructor"in R&&"constructor"in J&&!(typeof ks=="function"&&ks instanceof ks&&typeof Es=="function"&&Es instanceof Es)&&(fr=!1)}return me.delete(R),me.delete(J),fr}function st(R){return Rt(R,or,Fr)}function We(R,J){var Z=R.__data__;return vr(J)?Z[typeof J=="string"?"string":"hash"]:Z.map}function Xt(R,J){var Z=de(R,J);return br(Z)?Z:void 0}function ir(R){var J=gt.call(R,kt),Z=R[kt];try{R[kt]=void 0;var M=!0}catch{}var ce=Ct.call(R);return M&&(J?R[kt]=Z:delete R[kt]),ce}var Fr=Ut?function(R){return R==null?[]:(R=Object(R),Ce(Ut(R),function(J){return _t.call(R,J)}))}:Yr,vt=qt;(I&&vt(new I(new ArrayBuffer(1)))!=D||X&&vt(new X)!=w||be&&vt(be.resolve())!=N||Oe&&vt(new Oe)!=m||Xe&&vt(new Xe)!=C)&&(vt=function(R){var J=qt(R),Z=J==v?R.constructor:void 0,M=Z?se(Z):"";if(M)switch(M){case ze:return D;case bt:return w;case Dt:return N;case Mt:return m;case $t:return C}return J});function dr(R,J){return J=J??o,!!J&&(typeof R=="number"||q.test(R))&&R>-1&&R%1==0&&R<J}function vr(R){var J=typeof R;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?R!=="__proto__":R===null}function $(R){return!!St&&St in R}function re(R){var J=R&&R.constructor,Z=typeof J=="function"&&J.prototype||Ge;return R===Z}function he(R){return Ct.call(R)}function se(R){if(R!=null){try{return jt.call(R)}catch{}try{return R+""}catch{}}return""}function ye(R,J){return R===J||R!==R&&J!==J}var De=It((function(){return arguments})())?It:function(R){return Lt(R)&&gt.call(R,"callee")&&!_t.call(R,"callee")},lt=Array.isArray;function Ze(R){return R!=null&&Pt(R.length)&&!et(R)}var Qe=S||ra;function ct(R,J){return sr(R,J)}function et(R){if(!Zt(R))return!1;var J=qt(R);return J==p||J==b||J==f||J==j}function Pt(R){return typeof R=="number"&&R>-1&&R%1==0&&R<=o}function Zt(R){var J=typeof R;return R!=null&&(J=="object"||J=="function")}function Lt(R){return R!=null&&typeof R=="object"}var dt=Ne?Re(Ne):lr;function or(R){return Ze(R)?At(R):ur(R)}function Yr(){return[]}function ra(){return!1}t.exports=ct})(hs,hs.exports)),hs.exports}var ia={},Ps={},tl;function En(){if(tl)return Ps;tl=1,Object.defineProperty(Ps,"__esModule",{value:!0});const t=ys();function r(s,n,a,i=!0){a[t.testSymbol](s,r,n,i)}return Ps.default=r,Ps}var rl;function od(){if(rl)return ia;rl=1,Object.defineProperty(ia,"__esModule",{value:!0}),ia.exact=ia.partial=void 0;const t=Pa(),r=En(),s=ys();function n(i,o,c){try{for(const d of Object.keys(o)){const f=c?`${c}.${d}`:d;if((0,s.isPredicate)(o[d]))(0,r.default)(i[d],f,o[d]);else if(t.default.plainObject(o[d])){const l=n(i[d],o[d],f);if(l!==!0)return l}}return!0}catch(d){return d.message}}ia.partial=n;function a(i,o,c,d){try{const f=new Set(Object.keys(i));for(const l of Object.keys(o)){f.delete(l);const h=c?`${c}.${l}`:l;if((0,s.isPredicate)(o[l]))(0,r.default)(i[l],h,o[l]);else if(t.default.plainObject(o[l])){if(!Object.prototype.hasOwnProperty.call(i,l))return`Expected \`${h}\` to exist`;const u=a(i[l],o[l],h);if(u!==!0)return u}}if(f.size>0){const l=[...f.keys()][0],h=c?`${c}.${l}`:l;return`Did not expect ${d?"element":"property"} \`${h}\` to exist, got \`${i[l]}\``}return!0}catch(f){return f.message}}return ia.exact=a,ia}var Os={},al;function An(){if(al)return Os;al=1,Object.defineProperty(Os,"__esModule",{value:!0});const t=En();return Os.default=(r,s,n)=>{try{for(const a of r)(0,t.default)(a,s,n,!1);return!0}catch(a){return a.message}},Os}var sl;function z0(){if(sl)return qa;sl=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.ArrayPredicate=void 0;const t=kn(),r=tr(),s=od(),n=An();class a extends r.Predicate{constructor(o){super("array",o)}length(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have length \`${o}\`, got \`${c.length}\``,validator:c=>c.length===o})}minLength(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a minimum length of \`${o}\`, got \`${c.length}\``,validator:c=>c.length>=o,negatedMessage:(c,d)=>`Expected ${d} to have a maximum length of \`${o-1}\`, got \`${c.length}\``})}maxLength(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a maximum length of \`${o}\`, got \`${c.length}\``,validator:c=>c.length<=o,negatedMessage:(c,d)=>`Expected ${d} to have a minimum length of \`${o+1}\`, got \`${c.length}\``})}startsWith(o){return this.addValidator({message:(c,d)=>`Expected ${d} to start with \`${o}\`, got \`${c[0]}\``,validator:c=>c[0]===o})}endsWith(o){return this.addValidator({message:(c,d)=>`Expected ${d} to end with \`${o}\`, got \`${c[c.length-1]}\``,validator:c=>c[c.length-1]===o})}includes(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to include all elements of \`${JSON.stringify(o)}\`, got \`${JSON.stringify(c)}\``,validator:c=>o.every(d=>c.includes(d))})}includesAny(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to include any element of \`${JSON.stringify(o)}\`, got \`${JSON.stringify(c)}\``,validator:c=>o.some(d=>c.includes(d))})}get empty(){return this.addValidator({message:(o,c)=>`Expected ${c} to be empty, got \`${JSON.stringify(o)}\``,validator:o=>o.length===0})}get nonEmpty(){return this.addValidator({message:(o,c)=>`Expected ${c} to not be empty`,validator:o=>o.length>0})}deepEqual(o){return this.addValidator({message:(c,d)=>`Expected ${d} to be deeply equal to \`${JSON.stringify(o)}\`, got \`${JSON.stringify(c)}\``,validator:c=>t(c,o)})}ofType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,n.default)(c,"values",o)})}exactShape(o){const c=o;return this.addValidator({message:(d,f,l)=>`${l.replace("Expected","Expected element")} in ${f}`,validator:d=>(0,s.exact)(d,c,void 0,!0)})}}return qa.ArrayPredicate=a,qa}var za={},Jn,nl;function H0(){return nl||(nl=1,Jn=t=>{const r=typeof t;return t!==null&&(r==="object"||r==="function")}),Jn}var Yn,il;function W0(){if(il)return Yn;il=1;const t=H0(),r=new Set(["__proto__","prototype","constructor"]),s=a=>!a.some(i=>r.has(i));function n(a){const i=a.split("."),o=[];for(let c=0;c<i.length;c++){let d=i[c];for(;d[d.length-1]==="\\"&&i[c+1]!==void 0;)d=d.slice(0,-1)+".",d+=i[++c];o.push(d)}return s(o)?o:[]}return Yn={get(a,i,o){if(!t(a)||typeof i!="string")return o===void 0?a:o;const c=n(i);if(c.length!==0){for(let d=0;d<c.length;d++)if(a=a[c[d]],a==null){if(d!==c.length-1)return o;break}return a===void 0?o:a}},set(a,i,o){if(!t(a)||typeof i!="string")return a;const c=a,d=n(i);for(let f=0;f<d.length;f++){const l=d[f];t(a[l])||(a[l]={}),f===d.length-1&&(a[l]=o),a=a[l]}return c},delete(a,i){if(!t(a)||typeof i!="string")return!1;const o=n(i);for(let c=0;c<o.length;c++){const d=o[c];if(c===o.length-1)return delete a[d],!0;if(a=a[d],!t(a))return!1}},has(a,i){if(!t(a)||typeof i!="string")return!1;const o=n(i);if(o.length===0)return!1;for(let c=0;c<o.length;c++)if(t(a)){if(!(o[c]in a))return!1;a=a[o[c]]}else return!1;return!0}},Yn}var Ls={},ol;function vs(){return ol||(ol=1,Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.default=(t,r,s=5)=>{const n=[];for(const a of r)if(!t.has(a)&&(n.push(a),n.length===s))return n;return n.length===0?!0:n}),Ls}var Ms={},ll;function G0(){if(ll)return Ms;ll=1,Object.defineProperty(Ms,"__esModule",{value:!0});const t=Pa(),r=En(),s=(n,a)=>t.default.plainObject(n)?Object.values(n).every(i=>s(i,a)):((0,r.default)(n,"deep values",a,!1),!0);return Ms.default=(n,a)=>{try{return s(n,a)}catch(i){return i.message}},Ms}var ul;function J0(){if(ul)return za;ul=1,Object.defineProperty(za,"__esModule",{value:!0}),za.ObjectPredicate=void 0;const t=Pa(),r=W0(),s=kn(),n=vs(),a=An(),i=G0(),o=od(),c=tr();class d extends c.Predicate{constructor(l){super("object",l)}get plain(){return this.addValidator({message:(l,h)=>`Expected ${h} to be a plain object`,validator:l=>t.default.plainObject(l)})}get empty(){return this.addValidator({message:(l,h)=>`Expected ${h} to be empty, got \`${JSON.stringify(l)}\``,validator:l=>Object.keys(l).length===0})}get nonEmpty(){return this.addValidator({message:(l,h)=>`Expected ${h} to not be empty`,validator:l=>Object.keys(l).length>0})}valuesOfType(l){return this.addValidator({message:(h,u,p)=>`(${u}) ${p}`,validator:h=>(0,a.default)(Object.values(h),"values",l)})}deepValuesOfType(l){return this.addValidator({message:(h,u,p)=>`(${u}) ${p}`,validator:h=>(0,i.default)(h,l)})}deepEqual(l){return this.addValidator({message:(h,u)=>`Expected ${u} to be deeply equal to \`${JSON.stringify(l)}\`, got \`${JSON.stringify(h)}\``,validator:h=>s(h,l)})}instanceOf(l){return this.addValidator({message:(h,u)=>{var p;let{name:b}=(p=h?.constructor)!==null&&p!==void 0?p:{};return(!b||b==="Object")&&(b=JSON.stringify(h)),`Expected ${u} \`${b}\` to be of type \`${l.name}\``},validator:h=>h instanceof l})}hasKeys(...l){return this.addValidator({message:(h,u,p)=>`Expected ${u} to have keys \`${JSON.stringify(p)}\``,validator:h=>(0,n.default)({has:u=>r.has(h,u)},l)})}hasAnyKeys(...l){return this.addValidator({message:(h,u)=>`Expected ${u} to have any key of \`${JSON.stringify(l)}\``,validator:h=>l.some(u=>r.has(h,u))})}partialShape(l){return this.addValidator({message:(h,u,p)=>`${p.replace("Expected","Expected property")} in ${u}`,validator:h=>(0,o.partial)(h,l)})}exactShape(l){return this.addValidator({message:(h,u,p)=>`${p.replace("Expected","Expected property")} in ${u}`,validator:h=>(0,o.exact)(h,l)})}}return za.ObjectPredicate=d,za}var Ha={},cl;function Y0(){if(cl)return Ha;cl=1,Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.DatePredicate=void 0;const t=tr();class r extends t.Predicate{constructor(n){super("date",n)}before(n){return this.addValidator({message:(a,i)=>`Expected ${i} ${a.toISOString()} to be before ${n.toISOString()}`,validator:a=>a.getTime()<n.getTime()})}after(n){return this.addValidator({message:(a,i)=>`Expected ${i} ${a.toISOString()} to be after ${n.toISOString()}`,validator:a=>a.getTime()>n.getTime()})}}return Ha.DatePredicate=r,Ha}var Wa={},dl;function X0(){if(dl)return Wa;dl=1,Object.defineProperty(Wa,"__esModule",{value:!0}),Wa.ErrorPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(n){super("error",n)}name(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have name \`${n}\`, got \`${a.name}\``,validator:a=>a.name===n})}message(n){return this.addValidator({message:(a,i)=>`Expected ${i} message to be \`${n}\`, got \`${a.message}\``,validator:a=>a.message===n})}messageIncludes(n){return this.addValidator({message:(a,i)=>`Expected ${i} message to include \`${n}\`, got \`${a.message}\``,validator:a=>a.message.includes(n)})}hasKeys(...n){return this.addValidator({message:(a,i)=>`Expected ${i} message to have keys \`${n.join("`, `")}\``,validator:a=>n.every(i=>Object.prototype.hasOwnProperty.call(a,i))})}instanceOf(n){return this.addValidator({message:(a,i)=>`Expected ${i} \`${a.name}\` to be of type \`${n.name}\``,validator:a=>a instanceof n})}get typeError(){return this.instanceOf(TypeError)}get evalError(){return this.instanceOf(EvalError)}get rangeError(){return this.instanceOf(RangeError)}get referenceError(){return this.instanceOf(ReferenceError)}get syntaxError(){return this.instanceOf(SyntaxError)}get uriError(){return this.instanceOf(URIError)}}return Wa.ErrorPredicate=r,Wa}var Ga={},fl;function Z0(){if(fl)return Ga;fl=1,Object.defineProperty(Ga,"__esModule",{value:!0}),Ga.MapPredicate=void 0;const t=kn(),r=vs(),s=An(),n=tr();class a extends n.Predicate{constructor(o){super("Map",o)}size(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have size \`${o}\`, got \`${c.size}\``,validator:c=>c.size===o})}minSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a minimum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size>=o,negatedMessage:(c,d)=>`Expected ${d} to have a maximum size of \`${o-1}\`, got \`${c.size}\``})}maxSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a maximum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size<=o,negatedMessage:(c,d)=>`Expected ${d} to have a minimum size of \`${o+1}\`, got \`${c.size}\``})}hasKeys(...o){return this.addValidator({message:(c,d,f)=>`Expected ${d} to have keys \`${JSON.stringify(f)}\``,validator:c=>(0,r.default)(c,o)})}hasAnyKeys(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to have any key of \`${JSON.stringify(o)}\``,validator:c=>o.some(d=>c.has(d))})}hasValues(...o){return this.addValidator({message:(c,d,f)=>`Expected ${d} to have values \`${JSON.stringify(f)}\``,validator:c=>(0,r.default)(new Set(c.values()),o)})}hasAnyValues(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to have any value of \`${JSON.stringify(o)}\``,validator:c=>{const d=new Set(c.values());return o.some(f=>d.has(f))}})}keysOfType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,s.default)(c.keys(),"keys",o)})}valuesOfType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,s.default)(c.values(),"values",o)})}get empty(){return this.addValidator({message:(o,c)=>`Expected ${c} to be empty, got \`${JSON.stringify([...o])}\``,validator:o=>o.size===0})}get nonEmpty(){return this.addValidator({message:(o,c)=>`Expected ${c} to not be empty`,validator:o=>o.size>0})}deepEqual(o){return this.addValidator({message:(c,d)=>`Expected ${d} to be deeply equal to \`${JSON.stringify([...o])}\`, got \`${JSON.stringify([...c])}\``,validator:c=>t(c,o)})}}return Ga.MapPredicate=a,Ga}var Ja={},hl;function K0(){if(hl)return Ja;hl=1,Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.WeakMapPredicate=void 0;const t=vs(),r=tr();class s extends r.Predicate{constructor(a){super("WeakMap",a)}hasKeys(...a){return this.addValidator({message:(i,o,c)=>`Expected ${o} to have keys \`${JSON.stringify(c)}\``,validator:i=>(0,t.default)(i,a)})}hasAnyKeys(...a){return this.addValidator({message:(i,o)=>`Expected ${o} to have any key of \`${JSON.stringify(a)}\``,validator:i=>a.some(o=>i.has(o))})}}return Ja.WeakMapPredicate=s,Ja}var Ya={},ml;function Q0(){if(ml)return Ya;ml=1,Object.defineProperty(Ya,"__esModule",{value:!0}),Ya.SetPredicate=void 0;const t=kn(),r=vs(),s=An(),n=tr();class a extends n.Predicate{constructor(o){super("Set",o)}size(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have size \`${o}\`, got \`${c.size}\``,validator:c=>c.size===o})}minSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a minimum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size>=o,negatedMessage:(c,d)=>`Expected ${d} to have a maximum size of \`${o-1}\`, got \`${c.size}\``})}maxSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a maximum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size<=o,negatedMessage:(c,d)=>`Expected ${d} to have a minimum size of \`${o+1}\`, got \`${c.size}\``})}has(...o){return this.addValidator({message:(c,d,f)=>`Expected ${d} to have items \`${JSON.stringify(f)}\``,validator:c=>(0,r.default)(c,o)})}hasAny(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to have any item of \`${JSON.stringify(o)}\``,validator:c=>o.some(d=>c.has(d))})}ofType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,s.default)(c,"values",o)})}get empty(){return this.addValidator({message:(o,c)=>`Expected ${c} to be empty, got \`${JSON.stringify([...o])}\``,validator:o=>o.size===0})}get nonEmpty(){return this.addValidator({message:(o,c)=>`Expected ${c} to not be empty`,validator:o=>o.size>0})}deepEqual(o){return this.addValidator({message:(c,d)=>`Expected ${d} to be deeply equal to \`${JSON.stringify([...o])}\`, got \`${JSON.stringify([...c])}\``,validator:c=>t(c,o)})}}return Ya.SetPredicate=a,Ya}var Xa={},pl;function ef(){if(pl)return Xa;pl=1,Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.WeakSetPredicate=void 0;const t=vs(),r=tr();class s extends r.Predicate{constructor(a){super("WeakSet",a)}has(...a){return this.addValidator({message:(i,o,c)=>`Expected ${o} to have items \`${JSON.stringify(c)}\``,validator:i=>(0,t.default)(i,a)})}hasAny(...a){return this.addValidator({message:(i,o)=>`Expected ${o} to have any item of \`${JSON.stringify(a)}\``,validator:i=>a.some(o=>i.has(o))})}}return Xa.WeakSetPredicate=s,Xa}var Za={},gl;function tf(){if(gl)return Za;gl=1,Object.defineProperty(Za,"__esModule",{value:!0}),Za.TypedArrayPredicate=void 0;const t=tr();class r extends t.Predicate{byteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength===n})}minByteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength>=n,negatedMessage:(a,i)=>`Expected ${i} to have a maximum byte length of \`${n-1}\`, got \`${a.byteLength}\``})}maxByteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength<=n,negatedMessage:(a,i)=>`Expected ${i} to have a minimum byte length of \`${n+1}\`, got \`${a.byteLength}\``})}length(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have length \`${n}\`, got \`${a.length}\``,validator:a=>a.length===n})}minLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum length of \`${n}\`, got \`${a.length}\``,validator:a=>a.length>=n,negatedMessage:(a,i)=>`Expected ${i} to have a maximum length of \`${n-1}\`, got \`${a.length}\``})}maxLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum length of \`${n}\`, got \`${a.length}\``,validator:a=>a.length<=n,negatedMessage:(a,i)=>`Expected ${i} to have a minimum length of \`${n+1}\`, got \`${a.length}\``})}}return Za.TypedArrayPredicate=r,Za}var Ka={},xl;function rf(){if(xl)return Ka;xl=1,Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.ArrayBufferPredicate=void 0;const t=tr();class r extends t.Predicate{byteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength===n})}minByteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength>=n,negatedMessage:(a,i)=>`Expected ${i} to have a maximum byte length of \`${n-1}\`, got \`${a.byteLength}\``})}maxByteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength<=n,negatedMessage:(a,i)=>`Expected ${i} to have a minimum byte length of \`${n+1}\`, got \`${a.byteLength}\``})}}return Ka.ArrayBufferPredicate=r,Ka}var Qa={},bl;function af(){if(bl)return Qa;bl=1,Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.DataViewPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(n){super("DataView",n)}byteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength===n})}minByteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength>=n,negatedMessage:(a,i)=>`Expected ${i} to have a maximum byte length of \`${n-1}\`, got \`${a.byteLength}\``})}maxByteLength(n){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum byte length of \`${n}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength<=n,negatedMessage:(a,i)=>`Expected ${i} to have a minimum byte length of \`${n+1}\`, got \`${a.byteLength}\``})}}return Qa.DataViewPredicate=r,Qa}var es={},yl;function sf(){if(yl)return es;yl=1,Object.defineProperty(es,"__esModule",{value:!0}),es.AnyPredicate=void 0;const t=go(),r=ys(),s=id();class n{constructor(i,o={}){Object.defineProperty(this,"predicates",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:o})}[r.testSymbol](i,o,c,d){const f=new Map;for(const l of this.predicates)try{o(i,c,l,d);return}catch(h){if(i===void 0&&this.options.optional===!0)return;if(h instanceof t.ArgumentError)for(const[u,p]of h.validationErrors.entries()){const b=f.get(u);f.set(u,new Set([...b??[],...p]))}}if(f.size>0){const l=(0,s.generateArgumentErrorMessage)(f,!0);throw new t.ArgumentError(`Any predicate failed with the following errors:
64
64
  ${l}`,o,f)}}}return es.AnyPredicate=n,es}var vl;function so(){return vl||(vl=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.AnyPredicate=t.DataViewPredicate=t.ArrayBufferPredicate=t.TypedArrayPredicate=t.WeakSetPredicate=t.SetPredicate=t.WeakMapPredicate=t.MapPredicate=t.ErrorPredicate=t.DatePredicate=t.ObjectPredicate=t.ArrayPredicate=t.BooleanPredicate=t.BigIntPredicate=t.NumberPredicate=t.StringPredicate=void 0;const r=B0();Object.defineProperty(t,"StringPredicate",{enumerable:!0,get:function(){return r.StringPredicate}});const s=V0();Object.defineProperty(t,"NumberPredicate",{enumerable:!0,get:function(){return s.NumberPredicate}});const n=U0();Object.defineProperty(t,"BigIntPredicate",{enumerable:!0,get:function(){return n.BigIntPredicate}});const a=q0();Object.defineProperty(t,"BooleanPredicate",{enumerable:!0,get:function(){return a.BooleanPredicate}});const i=tr(),o=z0();Object.defineProperty(t,"ArrayPredicate",{enumerable:!0,get:function(){return o.ArrayPredicate}});const c=J0();Object.defineProperty(t,"ObjectPredicate",{enumerable:!0,get:function(){return c.ObjectPredicate}});const d=Y0();Object.defineProperty(t,"DatePredicate",{enumerable:!0,get:function(){return d.DatePredicate}});const f=X0();Object.defineProperty(t,"ErrorPredicate",{enumerable:!0,get:function(){return f.ErrorPredicate}});const l=Z0();Object.defineProperty(t,"MapPredicate",{enumerable:!0,get:function(){return l.MapPredicate}});const h=K0();Object.defineProperty(t,"WeakMapPredicate",{enumerable:!0,get:function(){return h.WeakMapPredicate}});const u=Q0();Object.defineProperty(t,"SetPredicate",{enumerable:!0,get:function(){return u.SetPredicate}});const p=ef();Object.defineProperty(t,"WeakSetPredicate",{enumerable:!0,get:function(){return p.WeakSetPredicate}});const b=tf();Object.defineProperty(t,"TypedArrayPredicate",{enumerable:!0,get:function(){return b.TypedArrayPredicate}});const w=rf();Object.defineProperty(t,"ArrayBufferPredicate",{enumerable:!0,get:function(){return w.ArrayBufferPredicate}});const x=af();Object.defineProperty(t,"DataViewPredicate",{enumerable:!0,get:function(){return x.DataViewPredicate}});const g=sf();Object.defineProperty(t,"AnyPredicate",{enumerable:!0,get:function(){return g.AnyPredicate}}),t.default=(v,N)=>(Object.defineProperties(v,{string:{get:()=>new r.StringPredicate(N)},number:{get:()=>new s.NumberPredicate(N)},bigint:{get:()=>new n.BigIntPredicate(N)},boolean:{get:()=>new a.BooleanPredicate(N)},undefined:{get:()=>new i.Predicate("undefined",N)},null:{get:()=>new i.Predicate("null",N)},nullOrUndefined:{get:()=>new i.Predicate("nullOrUndefined",N)},nan:{get:()=>new i.Predicate("nan",N)},symbol:{get:()=>new i.Predicate("symbol",N)},array:{get:()=>new o.ArrayPredicate(N)},object:{get:()=>new c.ObjectPredicate(N)},date:{get:()=>new d.DatePredicate(N)},error:{get:()=>new f.ErrorPredicate(N)},map:{get:()=>new l.MapPredicate(N)},weakMap:{get:()=>new h.WeakMapPredicate(N)},set:{get:()=>new u.SetPredicate(N)},weakSet:{get:()=>new p.WeakSetPredicate(N)},function:{get:()=>new i.Predicate("Function",N)},buffer:{get:()=>new i.Predicate("Buffer",N)},regExp:{get:()=>new i.Predicate("RegExp",N)},promise:{get:()=>new i.Predicate("Promise",N)},typedArray:{get:()=>new b.TypedArrayPredicate("TypedArray",N)},int8Array:{get:()=>new b.TypedArrayPredicate("Int8Array",N)},uint8Array:{get:()=>new b.TypedArrayPredicate("Uint8Array",N)},uint8ClampedArray:{get:()=>new b.TypedArrayPredicate("Uint8ClampedArray",N)},int16Array:{get:()=>new b.TypedArrayPredicate("Int16Array",N)},uint16Array:{get:()=>new b.TypedArrayPredicate("Uint16Array",N)},int32Array:{get:()=>new b.TypedArrayPredicate("Int32Array",N)},uint32Array:{get:()=>new b.TypedArrayPredicate("Uint32Array",N)},float32Array:{get:()=>new b.TypedArrayPredicate("Float32Array",N)},float64Array:{get:()=>new b.TypedArrayPredicate("Float64Array",N)},arrayBuffer:{get:()=>new w.ArrayBufferPredicate("ArrayBuffer",N)},sharedArrayBuffer:{get:()=>new w.ArrayBufferPredicate("SharedArrayBuffer",N)},dataView:{get:()=>new x.DataViewPredicate(N)},iterable:{get:()=>new i.Predicate("Iterable",N)},any:{value:(...j)=>new g.AnyPredicate(j,N)}}),v)})(Wn)),Wn}var wl;function nf(){if(wl)return Ds;wl=1,Object.defineProperty(Ds,"__esModule",{value:!0});const t=so();return Ds.default=r=>(Object.defineProperties(r,{optional:{get:()=>(0,t.default)({},{optional:!0})}}),r),Ds}var Nl;function ws(){return Nl||(Nl=1,(function(t){var r=na&&na.__createBinding||(Object.create?(function(p,b,w,x){x===void 0&&(x=w);var g=Object.getOwnPropertyDescriptor(b,w);(!g||("get"in g?!b.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return b[w]}}),Object.defineProperty(p,x,g)}):(function(p,b,w,x){x===void 0&&(x=w),p[x]=b[w]})),s=na&&na.__exportStar||function(p,b){for(var w in p)w!=="default"&&!Object.prototype.hasOwnProperty.call(b,w)&&r(b,p,w)};Object.defineProperty(t,"__esModule",{value:!0}),t.ArgumentError=t.Predicate=void 0;const n=L0(),a=M0(),i=tr();Object.defineProperty(t,"Predicate",{enumerable:!0,get:function(){return i.Predicate}});const o=ys(),c=nf(),d=so(),f=En(),l=(p,b,w)=>{if(!(0,o.isPredicate)(b)&&typeof b!="string")throw new TypeError(`Expected second argument to be a predicate or a string, got \`${typeof b}\``);if((0,o.isPredicate)(b)){const x=(0,n.default)();(0,f.default)(p,()=>(0,a.inferLabel)(x),b);return}(0,f.default)(p,b,w)};Object.defineProperties(l,{isValid:{value:(p,b)=>{try{return(0,f.default)(p,"",b),!0}catch{return!1}}},create:{value:(p,b)=>(w,x)=>{if((0,o.isPredicate)(p)){const g=(0,n.default)();(0,f.default)(w,x??(()=>(0,a.inferLabel)(g)),p);return}(0,f.default)(w,x??p,b)}}});const h=(0,d.default)((0,c.default)(l));t.default=h,s(so(),t);var u=go();Object.defineProperty(t,"ArgumentError",{enumerable:!0,get:function(){return u.ArgumentError}})})(na)),na}var Rs;function ld(t){return Rs=Rs||document.createElement("textarea"),Rs.innerHTML="&"+t+";",Rs.value}function of(t){return Object.prototype.toString.call(t)}function lf(t){return of(t)==="[object String]"}var uf=Object.prototype.hasOwnProperty;function ud(t,r){return t?uf.call(t,r):!1}function xo(t){var r=[].slice.call(arguments,1);return r.forEach(function(s){if(s){if(typeof s!="object")throw new TypeError(s+"must be object");Object.keys(s).forEach(function(n){t[n]=s[n]})}}),t}var cf=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;function Ta(t){return t.indexOf("\\")<0?t:t.replace(cf,"$1")}function bo(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function yn(t){if(t>65535){t-=65536;var r=55296+(t>>10),s=56320+(t&1023);return String.fromCharCode(r,s)}return String.fromCharCode(t)}var df=/&([a-z#][a-z0-9]{1,31});/gi,ff=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;function hf(t,r){var s=0,n=ld(r);return r!==n?n:r.charCodeAt(0)===35&&ff.test(r)&&(s=r[1].toLowerCase()==="x"?parseInt(r.slice(2),16):parseInt(r.slice(1),10),bo(s))?yn(s):t}function Qr(t){return t.indexOf("&")<0?t:t.replace(df,hf)}var mf=/[&<>"]/,pf=/[&<>"]/g,gf={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function xf(t){return gf[t]}function gr(t){return mf.test(t)?t.replace(pf,xf):t}var bf=Object.freeze({isString:lf,has:ud,assign:xo,unescapeMd:Ta,isValidEntityCode:bo,fromCodePoint:yn,replaceEntities:Qr,escapeHtml:gr}),Le={};Le.blockquote_open=function(){return`<blockquote>
65
65
  `};Le.blockquote_close=function(t,r){return"</blockquote>"+ba(t,r)};Le.code=function(t,r){return t[r].block?"<pre><code>"+gr(t[r].content)+"</code></pre>"+ba(t,r):"<code>"+gr(t[r].content)+"</code>"};Le.fence=function(t,r,s,n,a){var i=t[r],o="",c=s.langPrefix,d="",f,l,h;if(i.params){if(f=i.params.split(/\s+/g),l=f.join(" "),ud(a.rules.fence_custom,f[0]))return a.rules.fence_custom[f[0]](t,r,s,n,a);d=gr(Qr(Ta(l))),o=' class="'+c+d+'"'}return s.highlight?h=s.highlight.apply(s.highlight,[i.content].concat(f))||gr(i.content):h=gr(i.content),"<pre><code"+o+">"+h+"</code></pre>"+ba(t,r)};Le.fence_custom={};Le.heading_open=function(t,r){return"<h"+t[r].hLevel+">"};Le.heading_close=function(t,r){return"</h"+t[r].hLevel+`>
66
66
  `};Le.hr=function(t,r,s){return(s.xhtmlOut?"<hr />":"<hr>")+ba(t,r)};Le.bullet_list_open=function(){return`<ul>
@@ -100,11 +100,11 @@ new Remarkable().use(linkify)
100
100
  `),this.inline=new Cn,this.block=new vo,this.core=new md,this.renderer=new yo,this.ruler=new _r,this.options={},this.configure(qh[t]),this.set(r||{})}ta.prototype.set=function(t){xo(this.options,t)};ta.prototype.configure=function(t){var r=this;if(!t)throw new Error("Wrong `remarkable` preset, check name/content");t.options&&r.set(t.options),t.components&&Object.keys(t.components).forEach(function(s){t.components[s].rules&&r[s].ruler.enable(t.components[s].rules,!0)})};ta.prototype.use=function(t,r){return t(this,r),this};ta.prototype.parse=function(t,r){var s=new gd(this,t,r);return this.core.process(s),s.tokens};ta.prototype.render=function(t,r){return r=r||{},this.renderer.render(this.parse(t,r),this.options,r)};ta.prototype.parseInline=function(t,r){var s=new gd(this,t,r);return s.inlineMode=!0,this.core.process(s),s.tokens};ta.prototype.renderInline=function(t,r){return r=r||{},this.renderer.render(this.parseInline(t,r),this.options,r)};const zh=Object.freeze(Object.defineProperty({__proto__:null,Remarkable:ta,utils:bf},Symbol.toStringTag,{value:"Module"})),Hh=po(zh);var Vr={},Xr={};function Wh(t,r){var s=Object.setPrototypeOf;s?s(t,r):t.__proto__=r}function xd(t,r){r===void 0&&(r=t.constructor);var s=Error.captureStackTrace;s&&s(t,r)}var Gh=(function(){var t=function(s,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,i){a.__proto__=i}||function(a,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(a[o]=i[o])},t(s,n)};return function(r,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");t(r,s);function n(){this.constructor=r}r.prototype=s===null?Object.create(s):(n.prototype=s.prototype,new n)}})(),Jh=(function(t){Gh(r,t);function r(s,n){var a=this.constructor,i=t.call(this,s,n)||this;return Object.defineProperty(i,"name",{value:a.name,enumerable:!1,configurable:!0}),Wh(i,a.prototype),xd(i),i}return r})(Error),Yh=function(t,r,s){if(s||arguments.length===2)for(var n=0,a=r.length,i;n<a;n++)(i||!(n in r))&&(i||(i=Array.prototype.slice.call(r,0,n)),i[n]=r[n]);return t.concat(i||Array.prototype.slice.call(r))};function Xh(t,r){r===void 0&&(r=Error);function s(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];if(!(this instanceof s))return new(s.bind.apply(s,Yh([void 0],n,!1)));r.apply(this,n),Object.defineProperty(this,"name",{value:t.name||r.name,enumerable:!1,configurable:!0}),t.apply(this,n),xd(this,s)}return Object.defineProperties(s,{prototype:{value:Object.create(r.prototype,{constructor:{value:s,writable:!0,configurable:!0}})}})}const Zh=Object.freeze(Object.defineProperty({__proto__:null,CustomError:Jh,customErrorFactory:Xh},Symbol.toStringTag,{value:"Module"})),Kh=po(Zh);var ei={};const Qh={},em=Object.freeze(Object.defineProperty({__proto__:null,default:Qh},Symbol.toStringTag,{value:"Module"})),jr=po(em);var ti,Pl;function tm(){if(Pl)return ti;Pl=1;const t=jr,r=/\s+at.*(?:\(|\s)(.*)\)?/,s=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,n=typeof t.homedir>"u"?"":t.homedir();return ti=(a,i)=>(i=Object.assign({pretty:!1},i),a.replace(/\\/g,"/").split(`
101
101
  `).filter(o=>{const c=o.match(r);if(c===null||!c[1])return!0;const d=c[1];return d.includes(".app/Contents/Resources/electron.asar")||d.includes(".app/Contents/Resources/default_app.asar")?!1:!s.test(d)}).filter(o=>o.trim()!=="").map(o=>i.pretty?o.replace(r,(c,d)=>c.replace(d,d.replace(n,"~"))):o).join(`
102
102
  `)),ti}var ri,Ol;function bd(){if(Ol)return ri;Ol=1;var t=function(v){return r(v)&&!s(v)};function r(g){return!!g&&typeof g=="object"}function s(g){var v=Object.prototype.toString.call(g);return v==="[object RegExp]"||v==="[object Date]"||i(g)}var n=typeof Symbol=="function"&&Symbol.for,a=n?Symbol.for("react.element"):60103;function i(g){return g.$$typeof===a}function o(g){return Array.isArray(g)?[]:{}}function c(g,v){return v.clone!==!1&&v.isMergeableObject(g)?w(o(g),g,v):g}function d(g,v,N){return g.concat(v).map(function(j){return c(j,N)})}function f(g,v){if(!v.customMerge)return w;var N=v.customMerge(g);return typeof N=="function"?N:w}function l(g){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(g).filter(function(v){return Object.propertyIsEnumerable.call(g,v)}):[]}function h(g){return Object.keys(g).concat(l(g))}function u(g,v){try{return v in g}catch{return!1}}function p(g,v){return u(g,v)&&!(Object.hasOwnProperty.call(g,v)&&Object.propertyIsEnumerable.call(g,v))}function b(g,v,N){var j={};return N.isMergeableObject(g)&&h(g).forEach(function(y){j[y]=c(g[y],N)}),h(v).forEach(function(y){p(g,y)||(u(g,y)&&N.isMergeableObject(v[y])?j[y]=f(y,N)(g[y],v[y],N):j[y]=c(v[y],N))}),j}function w(g,v,N){N=N||{},N.arrayMerge=N.arrayMerge||d,N.isMergeableObject=N.isMergeableObject||t,N.cloneUnlessOtherwiseSpecified=c;var j=Array.isArray(v),y=Array.isArray(g),m=j===y;return m?j?N.arrayMerge(g,v,N):b(g,v,N):c(v,N)}w.all=function(v,N){if(!Array.isArray(v))throw new Error("first argument should be an array");return v.reduce(function(j,y){return w(j,y,N)},{})};var x=w;return ri=x,ri}var ai={},Ll;function io(){return Ll||(Ll=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),(function(r){r.DEFAULT={cleanStack:!0}})(t.Options||(t.Options={}))})(ai)),ai}var Ml;function Rl(){return Ml||(Ml=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=tm(),s=bd(),n=io();(function(a){function i(d,f,l,h){h===void 0&&(h=n.Options.DEFAULT);var u=d;return f&&(u.cause=f),u.stack=o(u.stack,f,h),l&&c(u,l),u}a.make=i;function o(d,f,l){var h=d||"";f&&(h+=`
103
- Caused by: `+(f.stack||f));function u(p){return r(p,{pretty:!0})}return l&&l.cleanStack&&(h=u(h)),h}a.appendToStack=o;function c(d,f){for(var l in f)if(f.hasOwnProperty(l)){var h=d.hasOwnProperty(l)&&typeof d[l]=="object";d[l]=h?s(d[l],f[l]):f[l]}}})(t.ChainedErrorFactory||(t.ChainedErrorFactory={}))})(ei)),ei}var $l;function Tn(){if($l)return Xr;$l=1;var t=Xr&&Xr.__extends||(function(){var c=function(d,f){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var u in h)h.hasOwnProperty(u)&&(l[u]=h[u])},c(d,f)};return function(d,f){c(d,f);function l(){this.constructor=d}d.prototype=f===null?Object.create(f):(l.prototype=f.prototype,new l)}})();Object.defineProperty(Xr,"__esModule",{value:!0});var r=Kh,s=Rl(),n=io(),a=(function(c){t(d,c);function d(f,l,h){h===void 0&&(h=n.Options.DEFAULT);var u=c.call(this,f)||this;return u.cause=l,u.stack=s.ChainedErrorFactory.appendToStack(u.stack,l,h),u}return d})(r.CustomError);Xr.default=a;var i=Rl();Xr.ChainedErrorFactory=i.ChainedErrorFactory;var o=io();return Xr.Options=o.Options,Xr}var Il;function rm(){if(Il)return Vr;Il=1;var t=Vr&&Vr.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.SecurityError=Vr.SecurityChecker=void 0;const r=t(Tn());let s=class{static checkSecurity(i,o){if(!o.allowScriptTag&&this.containsScriptTag(i))throw new n("Renderer rejected the input because of insecure content: text contains script tag")}static containsScriptTag(i){return/<\s*script/gi.test(i)}};Vr.SecurityChecker=s;class n extends r.default{constructor(i,o){super(i,o)}}return Vr.SecurityError=n,Vr}var hr={},ts={},Ur={},oa={},Fl;function Dn(){if(Fl)return oa;Fl=1;function t(i,o,c){if(c===void 0&&(c=Array.prototype),i&&typeof c.find=="function")return c.find.call(i,o);for(var d=0;d<i.length;d++)if(Object.prototype.hasOwnProperty.call(i,d)){var f=i[d];if(o.call(void 0,f,d,i))return f}}function r(i,o){return o===void 0&&(o=Object),o&&typeof o.freeze=="function"?o.freeze(i):i}function s(i,o){if(i===null||typeof i!="object")throw new TypeError("target is not an object");for(var c in o)Object.prototype.hasOwnProperty.call(o,c)&&(i[c]=o[c]);return i}var n=r({HTML:"text/html",isHTML:function(i){return i===n.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),a=r({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(i){return i===a.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return oa.assign=s,oa.find=t,oa.freeze=r,oa.MIME_TYPE=n,oa.NAMESPACE=a,oa}var Bl;function yd(){if(Bl)return Ur;Bl=1;var t=Dn(),r=t.find,s=t.NAMESPACE;function n(S){return S!==""}function a(S){return S?S.split(/[\t\n\f\r ]+/).filter(n):[]}function i(S,P){return S.hasOwnProperty(P)||(S[P]=!0),S}function o(S){if(!S)return[];var P=a(S);return Object.keys(P.reduce(i,{}))}function c(S){return function(P){return S&&S.indexOf(P)!==-1}}function d(S,P){for(var I in S)Object.prototype.hasOwnProperty.call(S,I)&&(P[I]=S[I])}function f(S,P){var I=S.prototype;if(!(I instanceof P)){let X=function(){};X.prototype=P.prototype,X=new X,d(I,X),S.prototype=I=X}I.constructor!=S&&(typeof S!="function"&&console.error("unknown Class:"+S),I.constructor=S)}var l={},h=l.ELEMENT_NODE=1,u=l.ATTRIBUTE_NODE=2,p=l.TEXT_NODE=3,b=l.CDATA_SECTION_NODE=4,w=l.ENTITY_REFERENCE_NODE=5,x=l.ENTITY_NODE=6,g=l.PROCESSING_INSTRUCTION_NODE=7,v=l.COMMENT_NODE=8,N=l.DOCUMENT_NODE=9,j=l.DOCUMENT_TYPE_NODE=10,y=l.DOCUMENT_FRAGMENT_NODE=11,m=l.NOTATION_NODE=12,_={},E={};_.INDEX_SIZE_ERR=(E[1]="Index size error",1),_.DOMSTRING_SIZE_ERR=(E[2]="DOMString size error",2);var A=_.HIERARCHY_REQUEST_ERR=(E[3]="Hierarchy request error",3);_.WRONG_DOCUMENT_ERR=(E[4]="Wrong document",4),_.INVALID_CHARACTER_ERR=(E[5]="Invalid character",5),_.NO_DATA_ALLOWED_ERR=(E[6]="No data allowed",6),_.NO_MODIFICATION_ALLOWED_ERR=(E[7]="No modification allowed",7);var C=_.NOT_FOUND_ERR=(E[8]="Not found",8);_.NOT_SUPPORTED_ERR=(E[9]="Not supported",9);var T=_.INUSE_ATTRIBUTE_ERR=(E[10]="Attribute in use",10);_.INVALID_STATE_ERR=(E[11]="Invalid state",11),_.SYNTAX_ERR=(E[12]="Syntax error",12),_.INVALID_MODIFICATION_ERR=(E[13]="Invalid modification",13),_.NAMESPACE_ERR=(E[14]="Invalid namespace",14),_.INVALID_ACCESS_ERR=(E[15]="Invalid access",15);function D(S,P){if(P instanceof Error)var I=P;else I=this,Error.call(this,E[S]),this.message=E[S],Error.captureStackTrace&&Error.captureStackTrace(this,D);return I.code=S,P&&(this.message=this.message+": "+P),I}D.prototype=Error.prototype,d(_,D);function L(){}L.prototype={length:0,item:function(S){return S>=0&&S<this.length?this[S]:null},toString:function(S,P){for(var I=[],X=0;X<this.length;X++)_t(this[X],I,S,P);return I.join("")},filter:function(S){return Array.prototype.filter.call(this,S)},indexOf:function(S){return Array.prototype.indexOf.call(this,S)}};function H(S,P){this._node=S,this._refresh=P,V(this)}function V(S){var P=S._node._inc||S._node.ownerDocument._inc;if(S._inc!==P){var I=S._refresh(S._node);if(Ut(S,"length",I.length),!S.$$length||I.length<S.$$length)for(var X=I.length;X in S;X++)Object.prototype.hasOwnProperty.call(S,X)&&delete S[X];d(I,S),S._inc=P}}H.prototype.item=function(S){return V(this),this[S]||null},f(H,L);function z(){}function F(S,P){for(var I=S.length;I--;)if(S[I]===P)return I}function Y(S,P,I,X){if(X?P[F(P,X)]=I:P[P.length++]=I,S){I.ownerElement=S;var be=S.ownerDocument;be&&(X&&pe(be,S,X),B(be,S,I))}}function G(S,P,I){var X=F(P,I);if(X>=0){for(var be=P.length-1;X<be;)P[X]=P[++X];if(P.length=be,S){var Oe=S.ownerDocument;Oe&&(pe(Oe,S,I),I.ownerElement=null)}}else throw new D(C,new Error(S.tagName+"@"+I))}z.prototype={length:0,item:L.prototype.item,getNamedItem:function(S){for(var P=this.length;P--;){var I=this[P];if(I.nodeName==S)return I}},setNamedItem:function(S){var P=S.ownerElement;if(P&&P!=this._ownerElement)throw new D(T);var I=this.getNamedItem(S.nodeName);return Y(this._ownerElement,this,S,I),I},setNamedItemNS:function(S){var P=S.ownerElement,I;if(P&&P!=this._ownerElement)throw new D(T);return I=this.getNamedItemNS(S.namespaceURI,S.localName),Y(this._ownerElement,this,S,I),I},removeNamedItem:function(S){var P=this.getNamedItem(S);return G(this._ownerElement,this,P),P},removeNamedItemNS:function(S,P){var I=this.getNamedItemNS(S,P);return G(this._ownerElement,this,I),I},getNamedItemNS:function(S,P){for(var I=this.length;I--;){var X=this[I];if(X.localName==P&&X.namespaceURI==S)return X}return null}};function ne(){}ne.prototype={hasFeature:function(S,P){return!0},createDocument:function(S,P,I){var X=new q;if(X.implementation=this,X.childNodes=new L,X.doctype=I||null,I&&X.appendChild(I),P){var be=X.createElementNS(S,P);X.appendChild(be)}return X},createDocumentType:function(S,P,I){var X=new Ge;return X.name=S,X.nodeName=S,X.publicId=P||"",X.systemId=I||"",X}};function ie(){}ie.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(S,P){return Re(this,S,P)},replaceChild:function(S,P){Re(this,S,P,ue),P&&this.removeChild(P)},removeChild:function(S){return te(this,S)},appendChild:function(S){return this.insertBefore(S,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(S){return kt(this.ownerDocument||this,this,S)},normalize:function(){for(var S=this.firstChild;S;){var P=S.nextSibling;P&&P.nodeType==p&&S.nodeType==p?(this.removeChild(P),S.appendData(P.data)):(S.normalize(),S=P)}},isSupported:function(S,P){return this.ownerDocument.implementation.hasFeature(S,P)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(S){for(var P=this;P;){var I=P._nsMap;if(I){for(var X in I)if(Object.prototype.hasOwnProperty.call(I,X)&&I[X]===S)return X}P=P.nodeType==u?P.ownerDocument:P.parentNode}return null},lookupNamespaceURI:function(S){for(var P=this;P;){var I=P._nsMap;if(I&&Object.prototype.hasOwnProperty.call(I,S))return I[S];P=P.nodeType==u?P.ownerDocument:P.parentNode}return null},isDefaultNamespace:function(S){var P=this.lookupPrefix(S);return P==null}};function xe(S){return S=="<"&&"&lt;"||S==">"&&"&gt;"||S=="&"&&"&amp;"||S=='"'&&"&quot;"||"&#"+S.charCodeAt()+";"}d(l,ie),d(l,ie.prototype);function U(S,P){if(P(S))return!0;if(S=S.firstChild)do if(U(S,P))return!0;while(S=S.nextSibling)}function q(){this.ownerDocument=this}function B(S,P,I){S&&S._inc++;var X=I.namespaceURI;X===s.XMLNS&&(P._nsMap[I.prefix?I.localName:""]=I.value)}function pe(S,P,I,X){S&&S._inc++;var be=I.namespaceURI;be===s.XMLNS&&delete P._nsMap[I.prefix?I.localName:""]}function ee(S,P,I){if(S&&S._inc){S._inc++;var X=P.childNodes;if(I)X[X.length++]=I;else{for(var be=P.firstChild,Oe=0;be;)X[Oe++]=be,be=be.nextSibling;X.length=Oe,delete X[X.length]}}}function te(S,P){var I=P.previousSibling,X=P.nextSibling;return I?I.nextSibling=X:S.firstChild=X,X?X.previousSibling=I:S.lastChild=I,P.parentNode=null,P.previousSibling=null,P.nextSibling=null,ee(S.ownerDocument,S),P}function _e(S){return S&&(S.nodeType===ie.DOCUMENT_NODE||S.nodeType===ie.DOCUMENT_FRAGMENT_NODE||S.nodeType===ie.ELEMENT_NODE)}function Ie(S){return S&&(le(S)||oe(S)||K(S)||S.nodeType===ie.DOCUMENT_FRAGMENT_NODE||S.nodeType===ie.COMMENT_NODE||S.nodeType===ie.PROCESSING_INSTRUCTION_NODE)}function K(S){return S&&S.nodeType===ie.DOCUMENT_TYPE_NODE}function le(S){return S&&S.nodeType===ie.ELEMENT_NODE}function oe(S){return S&&S.nodeType===ie.TEXT_NODE}function Ne(S,P){var I=S.childNodes||[];if(r(I,le)||K(P))return!1;var X=r(I,K);return!(P&&X&&I.indexOf(X)>I.indexOf(P))}function Ce(S,P){var I=S.childNodes||[];function X(Oe){return le(Oe)&&Oe!==P}if(r(I,X))return!1;var be=r(I,K);return!(P&&be&&I.indexOf(be)>I.indexOf(P))}function Me(S,P,I){if(!_e(S))throw new D(A,"Unexpected parent node type "+S.nodeType);if(I&&I.parentNode!==S)throw new D(C,"child not in parent");if(!Ie(P)||K(P)&&S.nodeType!==ie.DOCUMENT_NODE)throw new D(A,"Unexpected node type "+P.nodeType+" for parent node type "+S.nodeType)}function Fe(S,P,I){var X=S.childNodes||[],be=P.childNodes||[];if(P.nodeType===ie.DOCUMENT_FRAGMENT_NODE){var Oe=be.filter(le);if(Oe.length>1||r(be,oe))throw new D(A,"More than one element or text in fragment");if(Oe.length===1&&!Ne(S,I))throw new D(A,"Element in fragment can not be inserted before doctype")}if(le(P)&&!Ne(S,I))throw new D(A,"Only one element can be added and only after doctype");if(K(P)){if(r(X,K))throw new D(A,"Only one doctype is allowed");var Xe=r(X,le);if(I&&X.indexOf(Xe)<X.indexOf(I))throw new D(A,"Doctype can only be inserted before an element");if(!I&&Xe)throw new D(A,"Doctype can not be appended since element is present")}}function ue(S,P,I){var X=S.childNodes||[],be=P.childNodes||[];if(P.nodeType===ie.DOCUMENT_FRAGMENT_NODE){var Oe=be.filter(le);if(Oe.length>1||r(be,oe))throw new D(A,"More than one element or text in fragment");if(Oe.length===1&&!Ce(S,I))throw new D(A,"Element in fragment can not be inserted before doctype")}if(le(P)&&!Ce(S,I))throw new D(A,"Only one element can be added and only after doctype");if(K(P)){if(r(X,function(ze){return K(ze)&&ze!==I}))throw new D(A,"Only one doctype is allowed");var Xe=r(X,le);if(I&&X.indexOf(Xe)<X.indexOf(I))throw new D(A,"Doctype can only be inserted before an element")}}function Re(S,P,I,X){Me(S,P,I),S.nodeType===ie.DOCUMENT_NODE&&(X||Fe)(S,P,I);var be=P.parentNode;if(be&&be.removeChild(P),P.nodeType===y){var Oe=P.firstChild;if(Oe==null)return P;var Xe=P.lastChild}else Oe=Xe=P;var Ve=I?I.previousSibling:S.lastChild;Oe.previousSibling=Ve,Xe.nextSibling=I,Ve?Ve.nextSibling=Oe:S.firstChild=Oe,I==null?S.lastChild=Xe:I.previousSibling=Xe;do Oe.parentNode=S;while(Oe!==Xe&&(Oe=Oe.nextSibling));return ee(S.ownerDocument||S,S),P.nodeType==y&&(P.firstChild=P.lastChild=null),P}function se(S,P){return P.parentNode&&P.parentNode.removeChild(P),P.parentNode=S,P.previousSibling=S.lastChild,P.nextSibling=null,P.previousSibling?P.previousSibling.nextSibling=P:S.firstChild=P,S.lastChild=P,ee(S.ownerDocument,S,P),P}q.prototype={nodeName:"#document",nodeType:N,doctype:null,documentElement:null,_inc:1,insertBefore:function(S,P){if(S.nodeType==y){for(var I=S.firstChild;I;){var X=I.nextSibling;this.insertBefore(I,P),I=X}return S}return Re(this,S,P),S.ownerDocument=this,this.documentElement===null&&S.nodeType===h&&(this.documentElement=S),S},removeChild:function(S){return this.documentElement==S&&(this.documentElement=null),te(this,S)},replaceChild:function(S,P){Re(this,S,P,ue),S.ownerDocument=this,P&&this.removeChild(P),le(S)&&(this.documentElement=S)},importNode:function(S,P){return Vt(this,S,P)},getElementById:function(S){var P=null;return U(this.documentElement,function(I){if(I.nodeType==h&&I.getAttribute("id")==S)return P=I,!0}),P},getElementsByClassName:function(S){var P=o(S);return new H(this,function(I){var X=[];return P.length>0&&U(I.documentElement,function(be){if(be!==I&&be.nodeType===h){var Oe=be.getAttribute("class");if(Oe){var Xe=S===Oe;if(!Xe){var Ve=o(Oe);Xe=P.every(c(Ve))}Xe&&X.push(be)}}}),X})},createElement:function(S){var P=new de;P.ownerDocument=this,P.nodeName=S,P.tagName=S,P.localName=S,P.childNodes=new L;var I=P.attributes=new z;return I._ownerElement=P,P},createDocumentFragment:function(){var S=new St;return S.ownerDocument=this,S.childNodes=new L,S},createTextNode:function(S){var P=new ke;return P.ownerDocument=this,P.appendData(S),P},createComment:function(S){var P=new Se;return P.ownerDocument=this,P.appendData(S),P},createCDATASection:function(S){var P=new Be;return P.ownerDocument=this,P.appendData(S),P},createProcessingInstruction:function(S,P){var I=new Ct;return I.ownerDocument=this,I.tagName=I.nodeName=I.target=S,I.nodeValue=I.data=P,I},createAttribute:function(S){var P=new ve;return P.ownerDocument=this,P.name=S,P.nodeName=S,P.localName=S,P.specified=!0,P},createEntityReference:function(S){var P=new gt;return P.ownerDocument=this,P.nodeName=S,P},createElementNS:function(S,P){var I=new de,X=P.split(":"),be=I.attributes=new z;return I.childNodes=new L,I.ownerDocument=this,I.nodeName=P,I.tagName=P,I.namespaceURI=S,X.length==2?(I.prefix=X[0],I.localName=X[1]):I.localName=P,be._ownerElement=I,I},createAttributeNS:function(S,P){var I=new ve,X=P.split(":");return I.ownerDocument=this,I.nodeName=P,I.name=P,I.namespaceURI=S,I.specified=!0,X.length==2?(I.prefix=X[0],I.localName=X[1]):I.localName=P,I}},f(q,ie);function de(){this._nsMap={}}de.prototype={nodeType:h,hasAttribute:function(S){return this.getAttributeNode(S)!=null},getAttribute:function(S){var P=this.getAttributeNode(S);return P&&P.value||""},getAttributeNode:function(S){return this.attributes.getNamedItem(S)},setAttribute:function(S,P){var I=this.ownerDocument.createAttribute(S);I.value=I.nodeValue=""+P,this.setAttributeNode(I)},removeAttribute:function(S){var P=this.getAttributeNode(S);P&&this.removeAttributeNode(P)},appendChild:function(S){return S.nodeType===y?this.insertBefore(S,null):se(this,S)},setAttributeNode:function(S){return this.attributes.setNamedItem(S)},setAttributeNodeNS:function(S){return this.attributes.setNamedItemNS(S)},removeAttributeNode:function(S){return this.attributes.removeNamedItem(S.nodeName)},removeAttributeNS:function(S,P){var I=this.getAttributeNodeNS(S,P);I&&this.removeAttributeNode(I)},hasAttributeNS:function(S,P){return this.getAttributeNodeNS(S,P)!=null},getAttributeNS:function(S,P){var I=this.getAttributeNodeNS(S,P);return I&&I.value||""},setAttributeNS:function(S,P,I){var X=this.ownerDocument.createAttributeNS(S,P);X.value=X.nodeValue=""+I,this.setAttributeNode(X)},getAttributeNodeNS:function(S,P){return this.attributes.getNamedItemNS(S,P)},getElementsByTagName:function(S){return new H(this,function(P){var I=[];return U(P,function(X){X!==P&&X.nodeType==h&&(S==="*"||X.tagName==S)&&I.push(X)}),I})},getElementsByTagNameNS:function(S,P){return new H(this,function(I){var X=[];return U(I,function(be){be!==I&&be.nodeType===h&&(S==="*"||be.namespaceURI===S)&&(P==="*"||be.localName==P)&&X.push(be)}),X})}},q.prototype.getElementsByTagName=de.prototype.getElementsByTagName,q.prototype.getElementsByTagNameNS=de.prototype.getElementsByTagNameNS,f(de,ie);function ve(){}ve.prototype.nodeType=u,f(ve,ie);function fe(){}fe.prototype={data:"",substringData:function(S,P){return this.data.substring(S,S+P)},appendData:function(S){S=this.data+S,this.nodeValue=this.data=S,this.length=S.length},insertData:function(S,P){this.replaceData(S,0,P)},appendChild:function(S){throw new Error(E[A])},deleteData:function(S,P){this.replaceData(S,P,"")},replaceData:function(S,P,I){var X=this.data.substring(0,S),be=this.data.substring(S+P);I=X+I+be,this.nodeValue=this.data=I,this.length=I.length}},f(fe,ie);function ke(){}ke.prototype={nodeName:"#text",nodeType:p,splitText:function(S){var P=this.data,I=P.substring(S);P=P.substring(0,S),this.data=this.nodeValue=P,this.length=P.length;var X=this.ownerDocument.createTextNode(I);return this.parentNode&&this.parentNode.insertBefore(X,this.nextSibling),X}},f(ke,fe);function Se(){}Se.prototype={nodeName:"#comment",nodeType:v},f(Se,fe);function Be(){}Be.prototype={nodeName:"#cdata-section",nodeType:b},f(Be,fe);function Ge(){}Ge.prototype.nodeType=j,f(Ge,ie);function pt(){}pt.prototype.nodeType=m,f(pt,ie);function jt(){}jt.prototype.nodeType=x,f(jt,ie);function gt(){}gt.prototype.nodeType=w,f(gt,ie);function St(){}St.prototype.nodeName="#document-fragment",St.prototype.nodeType=y,f(St,ie);function Ct(){}Ct.prototype.nodeType=g,f(Ct,ie);function Tt(){}Tt.prototype.serializeToString=function(S,P,I){return Bt.call(S,P,I)},ie.prototype.toString=Bt;function Bt(S,P){var I=[],X=this.nodeType==9&&this.documentElement||this,be=X.prefix,Oe=X.namespaceURI;if(Oe&&be==null){var be=X.lookupPrefix(Oe);if(be==null)var Xe=[{namespace:Oe,prefix:null}]}return _t(this,I,S,P,Xe),I.join("")}function Ke(S,P,I){var X=S.prefix||"",be=S.namespaceURI;if(!be||X==="xml"&&be===s.XML||be===s.XMLNS)return!1;for(var Oe=I.length;Oe--;){var Xe=I[Oe];if(Xe.prefix===X)return Xe.namespace!==be}return!0}function at(S,P,I){S.push(" ",P,'="',I.replace(/[<>&"\t\n\r]/g,xe),'"')}function _t(S,P,I,X,be){if(be||(be=[]),X)if(S=X(S),S){if(typeof S=="string"){P.push(S);return}}else return;switch(S.nodeType){case h:var Oe=S.attributes,Xe=Oe.length,Te=S.firstChild,Ve=S.tagName;I=s.isHTML(S.namespaceURI)||I;var ze=Ve;if(!I&&!S.prefix&&S.namespaceURI){for(var bt,Dt=0;Dt<Oe.length;Dt++)if(Oe.item(Dt).name==="xmlns"){bt=Oe.item(Dt).value;break}if(!bt)for(var Mt=be.length-1;Mt>=0;Mt--){var $t=be[Mt];if($t.prefix===""&&$t.namespace===S.namespaceURI){bt=$t.namespace;break}}if(bt!==S.namespaceURI)for(var Mt=be.length-1;Mt>=0;Mt--){var $t=be[Mt];if($t.namespace===S.namespaceURI){$t.prefix&&(ze=$t.prefix+":"+Ve);break}}}P.push("<",ze);for(var Yt=0;Yt<Xe;Yt++){var Et=Oe.item(Yt);Et.prefix=="xmlns"?be.push({prefix:Et.localName,namespace:Et.value}):Et.nodeName=="xmlns"&&be.push({prefix:"",namespace:Et.value})}for(var Yt=0;Yt<Xe;Yt++){var Et=Oe.item(Yt);if(Ke(Et,I,be)){var ft=Et.prefix||"",ge=Et.namespaceURI;at(P,ft?"xmlns:"+ft:"xmlns",ge),be.push({prefix:ft,namespace:ge})}_t(Et,P,I,X,be)}if(Ve===ze&&Ke(S,I,be)){var ft=S.prefix||"",ge=S.namespaceURI;at(P,ft?"xmlns:"+ft:"xmlns",ge),be.push({prefix:ft,namespace:ge})}if(Te||I&&!/^(?:meta|link|img|br|hr|input)$/i.test(Ve)){if(P.push(">"),I&&/^script$/i.test(Ve))for(;Te;)Te.data?P.push(Te.data):_t(Te,P,I,X,be.slice()),Te=Te.nextSibling;else for(;Te;)_t(Te,P,I,X,be.slice()),Te=Te.nextSibling;P.push("</",ze,">")}else P.push("/>");return;case N:case y:for(var Te=S.firstChild;Te;)_t(Te,P,I,X,be.slice()),Te=Te.nextSibling;return;case u:return at(P,S.name,S.value);case p:return P.push(S.data.replace(/[<&>]/g,xe));case b:return P.push("<![CDATA[",S.data,"]]>");case v:return P.push("<!--",S.data,"-->");case j:var Pe=S.publicId,He=S.systemId;if(P.push("<!DOCTYPE ",S.name),Pe)P.push(" PUBLIC ",Pe),He&&He!="."&&P.push(" ",He),P.push(">");else if(He&&He!=".")P.push(" SYSTEM ",He,">");else{var Ue=S.internalSubset;Ue&&P.push(" [",Ue,"]"),P.push(">")}return;case g:return P.push("<?",S.target," ",S.data,"?>");case w:return P.push("&",S.nodeName,";");default:P.push("??",S.nodeName)}}function Vt(S,P,I){var X;switch(P.nodeType){case h:X=P.cloneNode(!1),X.ownerDocument=S;case y:break;case u:I=!0;break}if(X||(X=P.cloneNode(!1)),X.ownerDocument=S,X.parentNode=null,I)for(var be=P.firstChild;be;)X.appendChild(Vt(S,be,I)),be=be.nextSibling;return X}function kt(S,P,I){var X=new P.constructor;for(var be in P)if(Object.prototype.hasOwnProperty.call(P,be)){var Oe=P[be];typeof Oe!="object"&&Oe!=X[be]&&(X[be]=Oe)}switch(P.childNodes&&(X.childNodes=new L),X.ownerDocument=S,X.nodeType){case h:var Xe=P.attributes,Ve=X.attributes=new z,ze=Xe.length;Ve._ownerElement=X;for(var bt=0;bt<ze;bt++)X.setAttributeNode(kt(S,Xe.item(bt),!0));break;case u:I=!0}if(I)for(var Dt=P.firstChild;Dt;)X.appendChild(kt(S,Dt,I)),Dt=Dt.nextSibling;return X}function Ut(S,P,I){S[P]=I}try{if(Object.defineProperty){let S=function(P){switch(P.nodeType){case h:case y:var I=[];for(P=P.firstChild;P;)P.nodeType!==7&&P.nodeType!==8&&I.push(S(P)),P=P.nextSibling;return I.join("");default:return P.nodeValue}};Object.defineProperty(H.prototype,"length",{get:function(){return V(this),this.$$length}}),Object.defineProperty(ie.prototype,"textContent",{get:function(){return S(this)},set:function(P){switch(this.nodeType){case h:case y:for(;this.firstChild;)this.removeChild(this.firstChild);(P||String(P))&&this.appendChild(this.ownerDocument.createTextNode(P));break;default:this.data=P,this.value=P,this.nodeValue=P}}}),Ut=function(P,I,X){P["$$"+I]=X}}}catch{}return Ur.DocumentType=Ge,Ur.DOMException=D,Ur.DOMImplementation=ne,Ur.Element=de,Ur.Node=ie,Ur.NodeList=L,Ur.XMLSerializer=Tt,Ur}var rs={},si={},Vl;function am(){return Vl||(Vl=1,(function(t){var r=Dn().freeze;t.XML_ENTITIES=r({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=r({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
104
- `,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES})(si)),si}var Fs={},Ul;function sm(){if(Ul)return Fs;Ul=1;var t=Dn().NAMESPACE,r=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,s=new RegExp("[\\-\\.0-9"+r.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),n=new RegExp("^"+r.source+s.source+"*(?::"+r.source+s.source+"*)?$"),a=0,i=1,o=2,c=3,d=4,f=5,l=6,h=7;function u(A,C){this.message=A,this.locator=C,Error.captureStackTrace&&Error.captureStackTrace(this,u)}u.prototype=new Error,u.prototype.name=u.name;function p(){}p.prototype={parse:function(A,C,T){var D=this.domBuilder;D.startDocument(),j(C,C={}),b(A,C,T,D,this.errorHandler),D.endDocument()}};function b(A,C,T,D,L){function H(de){if(de>65535){de-=65536;var ve=55296+(de>>10),fe=56320+(de&1023);return String.fromCharCode(ve,fe)}else return String.fromCharCode(de)}function V(de){var ve=de.slice(1,-1);return Object.hasOwnProperty.call(T,ve)?T[ve]:ve.charAt(0)==="#"?H(parseInt(ve.substr(1).replace("x","0x"))):(L.error("entity not found:"+de),de)}function z(de){if(de>q){var ve=A.substring(q,de).replace(/&#?\w+;/g,V);ie&&F(q),D.characters(ve,0,de-q),q=de}}function F(de,ve){for(;de>=G&&(ve=ne.exec(A));)Y=ve.index,G=Y+ve[0].length,ie.lineNumber++;ie.columnNumber=de-Y+1}for(var Y=0,G=0,ne=/.*(?:\r\n?|\n)|.*$/g,ie=D.locator,xe=[{currentNSMap:C}],U={},q=0;;){try{var B=A.indexOf("<",q);if(B<0){if(!A.substr(q).match(/^\s*$/)){var pe=D.doc,ee=pe.createTextNode(A.substr(q));pe.appendChild(ee),D.currentElement=ee}return}switch(B>q&&z(B),A.charAt(B+1)){case"/":var Me=A.indexOf(">",B+3),te=A.substring(B+2,Me).replace(/[ \t\n\r]+$/g,""),_e=xe.pop();Me<0?(te=A.substring(B+2).replace(/[\s<].*/,""),L.error("end tag name: "+te+" is not complete:"+_e.tagName),Me=B+1+te.length):te.match(/\s</)&&(te=te.replace(/[\s<].*/,""),L.error("end tag name: "+te+" maybe not complete"),Me=B+1+te.length);var Ie=_e.localNSMap,K=_e.tagName==te,le=K||_e.tagName&&_e.tagName.toLowerCase()==te.toLowerCase();if(le){if(D.endElement(_e.uri,_e.localName,te),Ie)for(var oe in Ie)Object.prototype.hasOwnProperty.call(Ie,oe)&&D.endPrefixMapping(oe);K||L.fatalError("end tag name: "+te+" is not match the current start tagName:"+_e.tagName)}else xe.push(_e);Me++;break;case"?":ie&&F(B),Me=m(A,B,D);break;case"!":ie&&F(B),Me=y(A,B,D,L);break;default:ie&&F(B);var Ne=new _,Ce=xe[xe.length-1].currentNSMap,Me=x(A,B,Ne,Ce,V,L),Fe=Ne.length;if(!Ne.closed&&N(A,Me,Ne.tagName,U)&&(Ne.closed=!0,T.nbsp||L.warning("unclosed xml attribute")),ie&&Fe){for(var ue=w(ie,{}),Re=0;Re<Fe;Re++){var se=Ne[Re];F(se.offset),se.locator=w(ie,{})}D.locator=ue,g(Ne,D,Ce)&&xe.push(Ne),D.locator=ie}else g(Ne,D,Ce)&&xe.push(Ne);t.isHTML(Ne.uri)&&!Ne.closed?Me=v(A,Me,Ne.tagName,V,D):Me++}}catch(de){if(de instanceof u)throw de;L.error("element parse error: "+de),Me=-1}Me>q?q=Me:z(Math.max(B,q)+1)}}function w(A,C){return C.lineNumber=A.lineNumber,C.columnNumber=A.columnNumber,C}function x(A,C,T,D,L,H){function V(ie,xe,U){T.attributeNames.hasOwnProperty(ie)&&H.fatalError("Attribute "+ie+" redefined"),T.addValue(ie,xe.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,L),U)}for(var z,F,Y=++C,G=a;;){var ne=A.charAt(Y);switch(ne){case"=":if(G===i)z=A.slice(C,Y),G=c;else if(G===o)G=c;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(G===c||G===i)if(G===i&&(H.warning('attribute value must after "="'),z=A.slice(C,Y)),C=Y+1,Y=A.indexOf(ne,C),Y>0)F=A.slice(C,Y),V(z,F,C-1),G=f;else throw new Error("attribute value no end '"+ne+"' match");else if(G==d)F=A.slice(C,Y),V(z,F,C),H.warning('attribute "'+z+'" missed start quot('+ne+")!!"),C=Y+1,G=f;else throw new Error('attribute value must after "="');break;case"/":switch(G){case a:T.setTagName(A.slice(C,Y));case f:case l:case h:G=h,T.closed=!0;case d:case i:break;case o:T.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return H.error("unexpected end of input"),G==a&&T.setTagName(A.slice(C,Y)),Y;case">":switch(G){case a:T.setTagName(A.slice(C,Y));case f:case l:case h:break;case d:case i:F=A.slice(C,Y),F.slice(-1)==="/"&&(T.closed=!0,F=F.slice(0,-1));case o:G===o&&(F=z),G==d?(H.warning('attribute "'+F+'" missed quot(")!'),V(z,F,C)):((!t.isHTML(D[""])||!F.match(/^(?:disabled|checked|selected)$/i))&&H.warning('attribute "'+F+'" missed value!! "'+F+'" instead!!'),V(F,F,C));break;case c:throw new Error("attribute value missed!!")}return Y;case"€":ne=" ";default:if(ne<=" ")switch(G){case a:T.setTagName(A.slice(C,Y)),G=l;break;case i:z=A.slice(C,Y),G=o;break;case d:var F=A.slice(C,Y);H.warning('attribute "'+F+'" missed quot(")!!'),V(z,F,C);case f:G=l;break}else switch(G){case o:T.tagName,(!t.isHTML(D[""])||!z.match(/^(?:disabled|checked|selected)$/i))&&H.warning('attribute "'+z+'" missed value!! "'+z+'" instead2!!'),V(z,z,C),C=Y,G=i;break;case f:H.warning('attribute space is required"'+z+'"!!');case l:G=i,C=Y;break;case c:G=d,C=Y;break;case h:throw new Error("elements closed character '/' and '>' must be connected to")}}Y++}}function g(A,C,T){for(var D=A.tagName,L=null,ne=A.length;ne--;){var H=A[ne],V=H.qName,z=H.value,ie=V.indexOf(":");if(ie>0)var F=H.prefix=V.slice(0,ie),Y=V.slice(ie+1),G=F==="xmlns"&&Y;else Y=V,F=null,G=V==="xmlns"&&"";H.localName=Y,G!==!1&&(L==null&&(L={},j(T,T={})),T[G]=L[G]=z,H.uri=t.XMLNS,C.startPrefixMapping(G,z))}for(var ne=A.length;ne--;){H=A[ne];var F=H.prefix;F&&(F==="xml"&&(H.uri=t.XML),F!=="xmlns"&&(H.uri=T[F||""]))}var ie=D.indexOf(":");ie>0?(F=A.prefix=D.slice(0,ie),Y=A.localName=D.slice(ie+1)):(F=null,Y=A.localName=D);var xe=A.uri=T[F||""];if(C.startElement(xe,Y,D,A),A.closed){if(C.endElement(xe,Y,D),L)for(F in L)Object.prototype.hasOwnProperty.call(L,F)&&C.endPrefixMapping(F)}else return A.currentNSMap=T,A.localNSMap=L,!0}function v(A,C,T,D,L){if(/^(?:script|textarea)$/i.test(T)){var H=A.indexOf("</"+T+">",C),V=A.substring(C+1,H);if(/[&<]/.test(V))return/^script$/i.test(T)?(L.characters(V,0,V.length),H):(V=V.replace(/&#?\w+;/g,D),L.characters(V,0,V.length),H)}return C+1}function N(A,C,T,D){var L=D[T];return L==null&&(L=A.lastIndexOf("</"+T+">"),L<C&&(L=A.lastIndexOf("</"+T)),D[T]=L),L<C}function j(A,C){for(var T in A)Object.prototype.hasOwnProperty.call(A,T)&&(C[T]=A[T])}function y(A,C,T,D){var L=A.charAt(C+2);switch(L){case"-":if(A.charAt(C+3)==="-"){var H=A.indexOf("-->",C+4);return H>C?(T.comment(A,C+4,H-C-4),H+3):(D.error("Unclosed comment"),-1)}else return-1;default:if(A.substr(C+3,6)=="CDATA["){var H=A.indexOf("]]>",C+9);return T.startCDATA(),T.characters(A,C+9,H-C-9),T.endCDATA(),H+3}var V=E(A,C),z=V.length;if(z>1&&/!doctype/i.test(V[0][0])){var F=V[1][0],Y=!1,G=!1;z>3&&(/^public$/i.test(V[2][0])?(Y=V[3][0],G=z>4&&V[4][0]):/^system$/i.test(V[2][0])&&(G=V[3][0]));var ne=V[z-1];return T.startDTD(F,Y,G),T.endDTD(),ne.index+ne[0].length}}return-1}function m(A,C,T){var D=A.indexOf("?>",C);if(D){var L=A.substring(C,D).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return L?(L[0].length,T.processingInstruction(L[1],L[2]),D+2):-1}return-1}function _(){this.attributeNames={}}_.prototype={setTagName:function(A){if(!n.test(A))throw new Error("invalid tagName:"+A);this.tagName=A},addValue:function(A,C,T){if(!n.test(A))throw new Error("invalid attribute:"+A);this.attributeNames[A]=this.length,this[this.length++]={qName:A,value:C,offset:T}},length:0,getLocalName:function(A){return this[A].localName},getLocator:function(A){return this[A].locator},getQName:function(A){return this[A].qName},getURI:function(A){return this[A].uri},getValue:function(A){return this[A].value}};function E(A,C){var T,D=[],L=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(L.lastIndex=C,L.exec(A);T=L.exec(A);)if(D.push(T),T[1])return D}return Fs.XMLReader=p,Fs.ParseError=u,Fs}var ql;function nm(){if(ql)return rs;ql=1;var t=Dn(),r=yd(),s=am(),n=sm(),a=r.DOMImplementation,i=t.NAMESPACE,o=n.ParseError,c=n.XMLReader;function d(x){return x.replace(/\r[\n\u0085]/g,`
103
+ Caused by: `+(f.stack||f));function u(p){return r(p,{pretty:!0})}return l&&l.cleanStack&&(h=u(h)),h}a.appendToStack=o;function c(d,f){for(var l in f)if(f.hasOwnProperty(l)){var h=d.hasOwnProperty(l)&&typeof d[l]=="object";d[l]=h?s(d[l],f[l]):f[l]}}})(t.ChainedErrorFactory||(t.ChainedErrorFactory={}))})(ei)),ei}var $l;function Tn(){if($l)return Xr;$l=1;var t=Xr&&Xr.__extends||(function(){var c=function(d,f){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var u in h)h.hasOwnProperty(u)&&(l[u]=h[u])},c(d,f)};return function(d,f){c(d,f);function l(){this.constructor=d}d.prototype=f===null?Object.create(f):(l.prototype=f.prototype,new l)}})();Object.defineProperty(Xr,"__esModule",{value:!0});var r=Kh,s=Rl(),n=io(),a=(function(c){t(d,c);function d(f,l,h){h===void 0&&(h=n.Options.DEFAULT);var u=c.call(this,f)||this;return u.cause=l,u.stack=s.ChainedErrorFactory.appendToStack(u.stack,l,h),u}return d})(r.CustomError);Xr.default=a;var i=Rl();Xr.ChainedErrorFactory=i.ChainedErrorFactory;var o=io();return Xr.Options=o.Options,Xr}var Il;function rm(){if(Il)return Vr;Il=1;var t=Vr&&Vr.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.SecurityError=Vr.SecurityChecker=void 0;const r=t(Tn());let s=class{static checkSecurity(i,o){if(!o.allowScriptTag&&this.containsScriptTag(i))throw new n("Renderer rejected the input because of insecure content: text contains script tag")}static containsScriptTag(i){return/<\s*script/gi.test(i)}};Vr.SecurityChecker=s;class n extends r.default{constructor(i,o){super(i,o)}}return Vr.SecurityError=n,Vr}var hr={},ts={},Ur={},oa={},Fl;function Dn(){if(Fl)return oa;Fl=1;function t(i,o,c){if(c===void 0&&(c=Array.prototype),i&&typeof c.find=="function")return c.find.call(i,o);for(var d=0;d<i.length;d++)if(Object.prototype.hasOwnProperty.call(i,d)){var f=i[d];if(o.call(void 0,f,d,i))return f}}function r(i,o){return o===void 0&&(o=Object),o&&typeof o.freeze=="function"?o.freeze(i):i}function s(i,o){if(i===null||typeof i!="object")throw new TypeError("target is not an object");for(var c in o)Object.prototype.hasOwnProperty.call(o,c)&&(i[c]=o[c]);return i}var n=r({HTML:"text/html",isHTML:function(i){return i===n.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),a=r({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(i){return i===a.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return oa.assign=s,oa.find=t,oa.freeze=r,oa.MIME_TYPE=n,oa.NAMESPACE=a,oa}var Bl;function yd(){if(Bl)return Ur;Bl=1;var t=Dn(),r=t.find,s=t.NAMESPACE;function n(S){return S!==""}function a(S){return S?S.split(/[\t\n\f\r ]+/).filter(n):[]}function i(S,P){return S.hasOwnProperty(P)||(S[P]=!0),S}function o(S){if(!S)return[];var P=a(S);return Object.keys(P.reduce(i,{}))}function c(S){return function(P){return S&&S.indexOf(P)!==-1}}function d(S,P){for(var I in S)Object.prototype.hasOwnProperty.call(S,I)&&(P[I]=S[I])}function f(S,P){var I=S.prototype;if(!(I instanceof P)){let X=function(){};X.prototype=P.prototype,X=new X,d(I,X),S.prototype=I=X}I.constructor!=S&&(typeof S!="function"&&console.error("unknown Class:"+S),I.constructor=S)}var l={},h=l.ELEMENT_NODE=1,u=l.ATTRIBUTE_NODE=2,p=l.TEXT_NODE=3,b=l.CDATA_SECTION_NODE=4,w=l.ENTITY_REFERENCE_NODE=5,x=l.ENTITY_NODE=6,g=l.PROCESSING_INSTRUCTION_NODE=7,v=l.COMMENT_NODE=8,N=l.DOCUMENT_NODE=9,j=l.DOCUMENT_TYPE_NODE=10,y=l.DOCUMENT_FRAGMENT_NODE=11,m=l.NOTATION_NODE=12,_={},E={};_.INDEX_SIZE_ERR=(E[1]="Index size error",1),_.DOMSTRING_SIZE_ERR=(E[2]="DOMString size error",2);var A=_.HIERARCHY_REQUEST_ERR=(E[3]="Hierarchy request error",3);_.WRONG_DOCUMENT_ERR=(E[4]="Wrong document",4),_.INVALID_CHARACTER_ERR=(E[5]="Invalid character",5),_.NO_DATA_ALLOWED_ERR=(E[6]="No data allowed",6),_.NO_MODIFICATION_ALLOWED_ERR=(E[7]="No modification allowed",7);var C=_.NOT_FOUND_ERR=(E[8]="Not found",8);_.NOT_SUPPORTED_ERR=(E[9]="Not supported",9);var T=_.INUSE_ATTRIBUTE_ERR=(E[10]="Attribute in use",10);_.INVALID_STATE_ERR=(E[11]="Invalid state",11),_.SYNTAX_ERR=(E[12]="Syntax error",12),_.INVALID_MODIFICATION_ERR=(E[13]="Invalid modification",13),_.NAMESPACE_ERR=(E[14]="Invalid namespace",14),_.INVALID_ACCESS_ERR=(E[15]="Invalid access",15);function D(S,P){if(P instanceof Error)var I=P;else I=this,Error.call(this,E[S]),this.message=E[S],Error.captureStackTrace&&Error.captureStackTrace(this,D);return I.code=S,P&&(this.message=this.message+": "+P),I}D.prototype=Error.prototype,d(_,D);function L(){}L.prototype={length:0,item:function(S){return S>=0&&S<this.length?this[S]:null},toString:function(S,P){for(var I=[],X=0;X<this.length;X++)_t(this[X],I,S,P);return I.join("")},filter:function(S){return Array.prototype.filter.call(this,S)},indexOf:function(S){return Array.prototype.indexOf.call(this,S)}};function H(S,P){this._node=S,this._refresh=P,V(this)}function V(S){var P=S._node._inc||S._node.ownerDocument._inc;if(S._inc!==P){var I=S._refresh(S._node);if(Ut(S,"length",I.length),!S.$$length||I.length<S.$$length)for(var X=I.length;X in S;X++)Object.prototype.hasOwnProperty.call(S,X)&&delete S[X];d(I,S),S._inc=P}}H.prototype.item=function(S){return V(this),this[S]||null},f(H,L);function z(){}function F(S,P){for(var I=S.length;I--;)if(S[I]===P)return I}function Y(S,P,I,X){if(X?P[F(P,X)]=I:P[P.length++]=I,S){I.ownerElement=S;var be=S.ownerDocument;be&&(X&&pe(be,S,X),B(be,S,I))}}function G(S,P,I){var X=F(P,I);if(X>=0){for(var be=P.length-1;X<be;)P[X]=P[++X];if(P.length=be,S){var Oe=S.ownerDocument;Oe&&(pe(Oe,S,I),I.ownerElement=null)}}else throw new D(C,new Error(S.tagName+"@"+I))}z.prototype={length:0,item:L.prototype.item,getNamedItem:function(S){for(var P=this.length;P--;){var I=this[P];if(I.nodeName==S)return I}},setNamedItem:function(S){var P=S.ownerElement;if(P&&P!=this._ownerElement)throw new D(T);var I=this.getNamedItem(S.nodeName);return Y(this._ownerElement,this,S,I),I},setNamedItemNS:function(S){var P=S.ownerElement,I;if(P&&P!=this._ownerElement)throw new D(T);return I=this.getNamedItemNS(S.namespaceURI,S.localName),Y(this._ownerElement,this,S,I),I},removeNamedItem:function(S){var P=this.getNamedItem(S);return G(this._ownerElement,this,P),P},removeNamedItemNS:function(S,P){var I=this.getNamedItemNS(S,P);return G(this._ownerElement,this,I),I},getNamedItemNS:function(S,P){for(var I=this.length;I--;){var X=this[I];if(X.localName==P&&X.namespaceURI==S)return X}return null}};function ne(){}ne.prototype={hasFeature:function(S,P){return!0},createDocument:function(S,P,I){var X=new q;if(X.implementation=this,X.childNodes=new L,X.doctype=I||null,I&&X.appendChild(I),P){var be=X.createElementNS(S,P);X.appendChild(be)}return X},createDocumentType:function(S,P,I){var X=new Ge;return X.name=S,X.nodeName=S,X.publicId=P||"",X.systemId=I||"",X}};function ie(){}ie.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(S,P){return Re(this,S,P)},replaceChild:function(S,P){Re(this,S,P,ue),P&&this.removeChild(P)},removeChild:function(S){return te(this,S)},appendChild:function(S){return this.insertBefore(S,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(S){return kt(this.ownerDocument||this,this,S)},normalize:function(){for(var S=this.firstChild;S;){var P=S.nextSibling;P&&P.nodeType==p&&S.nodeType==p?(this.removeChild(P),S.appendData(P.data)):(S.normalize(),S=P)}},isSupported:function(S,P){return this.ownerDocument.implementation.hasFeature(S,P)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(S){for(var P=this;P;){var I=P._nsMap;if(I){for(var X in I)if(Object.prototype.hasOwnProperty.call(I,X)&&I[X]===S)return X}P=P.nodeType==u?P.ownerDocument:P.parentNode}return null},lookupNamespaceURI:function(S){for(var P=this;P;){var I=P._nsMap;if(I&&Object.prototype.hasOwnProperty.call(I,S))return I[S];P=P.nodeType==u?P.ownerDocument:P.parentNode}return null},isDefaultNamespace:function(S){var P=this.lookupPrefix(S);return P==null}};function xe(S){return S=="<"&&"&lt;"||S==">"&&"&gt;"||S=="&"&&"&amp;"||S=='"'&&"&quot;"||"&#"+S.charCodeAt()+";"}d(l,ie),d(l,ie.prototype);function U(S,P){if(P(S))return!0;if(S=S.firstChild)do if(U(S,P))return!0;while(S=S.nextSibling)}function q(){this.ownerDocument=this}function B(S,P,I){S&&S._inc++;var X=I.namespaceURI;X===s.XMLNS&&(P._nsMap[I.prefix?I.localName:""]=I.value)}function pe(S,P,I,X){S&&S._inc++;var be=I.namespaceURI;be===s.XMLNS&&delete P._nsMap[I.prefix?I.localName:""]}function ee(S,P,I){if(S&&S._inc){S._inc++;var X=P.childNodes;if(I)X[X.length++]=I;else{for(var be=P.firstChild,Oe=0;be;)X[Oe++]=be,be=be.nextSibling;X.length=Oe,delete X[X.length]}}}function te(S,P){var I=P.previousSibling,X=P.nextSibling;return I?I.nextSibling=X:S.firstChild=X,X?X.previousSibling=I:S.lastChild=I,P.parentNode=null,P.previousSibling=null,P.nextSibling=null,ee(S.ownerDocument,S),P}function _e(S){return S&&(S.nodeType===ie.DOCUMENT_NODE||S.nodeType===ie.DOCUMENT_FRAGMENT_NODE||S.nodeType===ie.ELEMENT_NODE)}function Ie(S){return S&&(le(S)||oe(S)||K(S)||S.nodeType===ie.DOCUMENT_FRAGMENT_NODE||S.nodeType===ie.COMMENT_NODE||S.nodeType===ie.PROCESSING_INSTRUCTION_NODE)}function K(S){return S&&S.nodeType===ie.DOCUMENT_TYPE_NODE}function le(S){return S&&S.nodeType===ie.ELEMENT_NODE}function oe(S){return S&&S.nodeType===ie.TEXT_NODE}function Ne(S,P){var I=S.childNodes||[];if(r(I,le)||K(P))return!1;var X=r(I,K);return!(P&&X&&I.indexOf(X)>I.indexOf(P))}function Ce(S,P){var I=S.childNodes||[];function X(Oe){return le(Oe)&&Oe!==P}if(r(I,X))return!1;var be=r(I,K);return!(P&&be&&I.indexOf(be)>I.indexOf(P))}function Me(S,P,I){if(!_e(S))throw new D(A,"Unexpected parent node type "+S.nodeType);if(I&&I.parentNode!==S)throw new D(C,"child not in parent");if(!Ie(P)||K(P)&&S.nodeType!==ie.DOCUMENT_NODE)throw new D(A,"Unexpected node type "+P.nodeType+" for parent node type "+S.nodeType)}function Fe(S,P,I){var X=S.childNodes||[],be=P.childNodes||[];if(P.nodeType===ie.DOCUMENT_FRAGMENT_NODE){var Oe=be.filter(le);if(Oe.length>1||r(be,oe))throw new D(A,"More than one element or text in fragment");if(Oe.length===1&&!Ne(S,I))throw new D(A,"Element in fragment can not be inserted before doctype")}if(le(P)&&!Ne(S,I))throw new D(A,"Only one element can be added and only after doctype");if(K(P)){if(r(X,K))throw new D(A,"Only one doctype is allowed");var Xe=r(X,le);if(I&&X.indexOf(Xe)<X.indexOf(I))throw new D(A,"Doctype can only be inserted before an element");if(!I&&Xe)throw new D(A,"Doctype can not be appended since element is present")}}function ue(S,P,I){var X=S.childNodes||[],be=P.childNodes||[];if(P.nodeType===ie.DOCUMENT_FRAGMENT_NODE){var Oe=be.filter(le);if(Oe.length>1||r(be,oe))throw new D(A,"More than one element or text in fragment");if(Oe.length===1&&!Ce(S,I))throw new D(A,"Element in fragment can not be inserted before doctype")}if(le(P)&&!Ce(S,I))throw new D(A,"Only one element can be added and only after doctype");if(K(P)){if(r(X,function(ze){return K(ze)&&ze!==I}))throw new D(A,"Only one doctype is allowed");var Xe=r(X,le);if(I&&X.indexOf(Xe)<X.indexOf(I))throw new D(A,"Doctype can only be inserted before an element")}}function Re(S,P,I,X){Me(S,P,I),S.nodeType===ie.DOCUMENT_NODE&&(X||Fe)(S,P,I);var be=P.parentNode;if(be&&be.removeChild(P),P.nodeType===y){var Oe=P.firstChild;if(Oe==null)return P;var Xe=P.lastChild}else Oe=Xe=P;var Ve=I?I.previousSibling:S.lastChild;Oe.previousSibling=Ve,Xe.nextSibling=I,Ve?Ve.nextSibling=Oe:S.firstChild=Oe,I==null?S.lastChild=Xe:I.previousSibling=Xe;do Oe.parentNode=S;while(Oe!==Xe&&(Oe=Oe.nextSibling));return ee(S.ownerDocument||S,S),P.nodeType==y&&(P.firstChild=P.lastChild=null),P}function ae(S,P){return P.parentNode&&P.parentNode.removeChild(P),P.parentNode=S,P.previousSibling=S.lastChild,P.nextSibling=null,P.previousSibling?P.previousSibling.nextSibling=P:S.firstChild=P,S.lastChild=P,ee(S.ownerDocument,S,P),P}q.prototype={nodeName:"#document",nodeType:N,doctype:null,documentElement:null,_inc:1,insertBefore:function(S,P){if(S.nodeType==y){for(var I=S.firstChild;I;){var X=I.nextSibling;this.insertBefore(I,P),I=X}return S}return Re(this,S,P),S.ownerDocument=this,this.documentElement===null&&S.nodeType===h&&(this.documentElement=S),S},removeChild:function(S){return this.documentElement==S&&(this.documentElement=null),te(this,S)},replaceChild:function(S,P){Re(this,S,P,ue),S.ownerDocument=this,P&&this.removeChild(P),le(S)&&(this.documentElement=S)},importNode:function(S,P){return Vt(this,S,P)},getElementById:function(S){var P=null;return U(this.documentElement,function(I){if(I.nodeType==h&&I.getAttribute("id")==S)return P=I,!0}),P},getElementsByClassName:function(S){var P=o(S);return new H(this,function(I){var X=[];return P.length>0&&U(I.documentElement,function(be){if(be!==I&&be.nodeType===h){var Oe=be.getAttribute("class");if(Oe){var Xe=S===Oe;if(!Xe){var Ve=o(Oe);Xe=P.every(c(Ve))}Xe&&X.push(be)}}}),X})},createElement:function(S){var P=new de;P.ownerDocument=this,P.nodeName=S,P.tagName=S,P.localName=S,P.childNodes=new L;var I=P.attributes=new z;return I._ownerElement=P,P},createDocumentFragment:function(){var S=new St;return S.ownerDocument=this,S.childNodes=new L,S},createTextNode:function(S){var P=new ke;return P.ownerDocument=this,P.appendData(S),P},createComment:function(S){var P=new Se;return P.ownerDocument=this,P.appendData(S),P},createCDATASection:function(S){var P=new Be;return P.ownerDocument=this,P.appendData(S),P},createProcessingInstruction:function(S,P){var I=new Ct;return I.ownerDocument=this,I.tagName=I.nodeName=I.target=S,I.nodeValue=I.data=P,I},createAttribute:function(S){var P=new ve;return P.ownerDocument=this,P.name=S,P.nodeName=S,P.localName=S,P.specified=!0,P},createEntityReference:function(S){var P=new gt;return P.ownerDocument=this,P.nodeName=S,P},createElementNS:function(S,P){var I=new de,X=P.split(":"),be=I.attributes=new z;return I.childNodes=new L,I.ownerDocument=this,I.nodeName=P,I.tagName=P,I.namespaceURI=S,X.length==2?(I.prefix=X[0],I.localName=X[1]):I.localName=P,be._ownerElement=I,I},createAttributeNS:function(S,P){var I=new ve,X=P.split(":");return I.ownerDocument=this,I.nodeName=P,I.name=P,I.namespaceURI=S,I.specified=!0,X.length==2?(I.prefix=X[0],I.localName=X[1]):I.localName=P,I}},f(q,ie);function de(){this._nsMap={}}de.prototype={nodeType:h,hasAttribute:function(S){return this.getAttributeNode(S)!=null},getAttribute:function(S){var P=this.getAttributeNode(S);return P&&P.value||""},getAttributeNode:function(S){return this.attributes.getNamedItem(S)},setAttribute:function(S,P){var I=this.ownerDocument.createAttribute(S);I.value=I.nodeValue=""+P,this.setAttributeNode(I)},removeAttribute:function(S){var P=this.getAttributeNode(S);P&&this.removeAttributeNode(P)},appendChild:function(S){return S.nodeType===y?this.insertBefore(S,null):ae(this,S)},setAttributeNode:function(S){return this.attributes.setNamedItem(S)},setAttributeNodeNS:function(S){return this.attributes.setNamedItemNS(S)},removeAttributeNode:function(S){return this.attributes.removeNamedItem(S.nodeName)},removeAttributeNS:function(S,P){var I=this.getAttributeNodeNS(S,P);I&&this.removeAttributeNode(I)},hasAttributeNS:function(S,P){return this.getAttributeNodeNS(S,P)!=null},getAttributeNS:function(S,P){var I=this.getAttributeNodeNS(S,P);return I&&I.value||""},setAttributeNS:function(S,P,I){var X=this.ownerDocument.createAttributeNS(S,P);X.value=X.nodeValue=""+I,this.setAttributeNode(X)},getAttributeNodeNS:function(S,P){return this.attributes.getNamedItemNS(S,P)},getElementsByTagName:function(S){return new H(this,function(P){var I=[];return U(P,function(X){X!==P&&X.nodeType==h&&(S==="*"||X.tagName==S)&&I.push(X)}),I})},getElementsByTagNameNS:function(S,P){return new H(this,function(I){var X=[];return U(I,function(be){be!==I&&be.nodeType===h&&(S==="*"||be.namespaceURI===S)&&(P==="*"||be.localName==P)&&X.push(be)}),X})}},q.prototype.getElementsByTagName=de.prototype.getElementsByTagName,q.prototype.getElementsByTagNameNS=de.prototype.getElementsByTagNameNS,f(de,ie);function ve(){}ve.prototype.nodeType=u,f(ve,ie);function fe(){}fe.prototype={data:"",substringData:function(S,P){return this.data.substring(S,S+P)},appendData:function(S){S=this.data+S,this.nodeValue=this.data=S,this.length=S.length},insertData:function(S,P){this.replaceData(S,0,P)},appendChild:function(S){throw new Error(E[A])},deleteData:function(S,P){this.replaceData(S,P,"")},replaceData:function(S,P,I){var X=this.data.substring(0,S),be=this.data.substring(S+P);I=X+I+be,this.nodeValue=this.data=I,this.length=I.length}},f(fe,ie);function ke(){}ke.prototype={nodeName:"#text",nodeType:p,splitText:function(S){var P=this.data,I=P.substring(S);P=P.substring(0,S),this.data=this.nodeValue=P,this.length=P.length;var X=this.ownerDocument.createTextNode(I);return this.parentNode&&this.parentNode.insertBefore(X,this.nextSibling),X}},f(ke,fe);function Se(){}Se.prototype={nodeName:"#comment",nodeType:v},f(Se,fe);function Be(){}Be.prototype={nodeName:"#cdata-section",nodeType:b},f(Be,fe);function Ge(){}Ge.prototype.nodeType=j,f(Ge,ie);function pt(){}pt.prototype.nodeType=m,f(pt,ie);function jt(){}jt.prototype.nodeType=x,f(jt,ie);function gt(){}gt.prototype.nodeType=w,f(gt,ie);function St(){}St.prototype.nodeName="#document-fragment",St.prototype.nodeType=y,f(St,ie);function Ct(){}Ct.prototype.nodeType=g,f(Ct,ie);function Tt(){}Tt.prototype.serializeToString=function(S,P,I){return Bt.call(S,P,I)},ie.prototype.toString=Bt;function Bt(S,P){var I=[],X=this.nodeType==9&&this.documentElement||this,be=X.prefix,Oe=X.namespaceURI;if(Oe&&be==null){var be=X.lookupPrefix(Oe);if(be==null)var Xe=[{namespace:Oe,prefix:null}]}return _t(this,I,S,P,Xe),I.join("")}function Ke(S,P,I){var X=S.prefix||"",be=S.namespaceURI;if(!be||X==="xml"&&be===s.XML||be===s.XMLNS)return!1;for(var Oe=I.length;Oe--;){var Xe=I[Oe];if(Xe.prefix===X)return Xe.namespace!==be}return!0}function at(S,P,I){S.push(" ",P,'="',I.replace(/[<>&"\t\n\r]/g,xe),'"')}function _t(S,P,I,X,be){if(be||(be=[]),X)if(S=X(S),S){if(typeof S=="string"){P.push(S);return}}else return;switch(S.nodeType){case h:var Oe=S.attributes,Xe=Oe.length,Te=S.firstChild,Ve=S.tagName;I=s.isHTML(S.namespaceURI)||I;var ze=Ve;if(!I&&!S.prefix&&S.namespaceURI){for(var bt,Dt=0;Dt<Oe.length;Dt++)if(Oe.item(Dt).name==="xmlns"){bt=Oe.item(Dt).value;break}if(!bt)for(var Mt=be.length-1;Mt>=0;Mt--){var $t=be[Mt];if($t.prefix===""&&$t.namespace===S.namespaceURI){bt=$t.namespace;break}}if(bt!==S.namespaceURI)for(var Mt=be.length-1;Mt>=0;Mt--){var $t=be[Mt];if($t.namespace===S.namespaceURI){$t.prefix&&(ze=$t.prefix+":"+Ve);break}}}P.push("<",ze);for(var Yt=0;Yt<Xe;Yt++){var Et=Oe.item(Yt);Et.prefix=="xmlns"?be.push({prefix:Et.localName,namespace:Et.value}):Et.nodeName=="xmlns"&&be.push({prefix:"",namespace:Et.value})}for(var Yt=0;Yt<Xe;Yt++){var Et=Oe.item(Yt);if(Ke(Et,I,be)){var ft=Et.prefix||"",ge=Et.namespaceURI;at(P,ft?"xmlns:"+ft:"xmlns",ge),be.push({prefix:ft,namespace:ge})}_t(Et,P,I,X,be)}if(Ve===ze&&Ke(S,I,be)){var ft=S.prefix||"",ge=S.namespaceURI;at(P,ft?"xmlns:"+ft:"xmlns",ge),be.push({prefix:ft,namespace:ge})}if(Te||I&&!/^(?:meta|link|img|br|hr|input)$/i.test(Ve)){if(P.push(">"),I&&/^script$/i.test(Ve))for(;Te;)Te.data?P.push(Te.data):_t(Te,P,I,X,be.slice()),Te=Te.nextSibling;else for(;Te;)_t(Te,P,I,X,be.slice()),Te=Te.nextSibling;P.push("</",ze,">")}else P.push("/>");return;case N:case y:for(var Te=S.firstChild;Te;)_t(Te,P,I,X,be.slice()),Te=Te.nextSibling;return;case u:return at(P,S.name,S.value);case p:return P.push(S.data.replace(/[<&>]/g,xe));case b:return P.push("<![CDATA[",S.data,"]]>");case v:return P.push("<!--",S.data,"-->");case j:var Pe=S.publicId,He=S.systemId;if(P.push("<!DOCTYPE ",S.name),Pe)P.push(" PUBLIC ",Pe),He&&He!="."&&P.push(" ",He),P.push(">");else if(He&&He!=".")P.push(" SYSTEM ",He,">");else{var Ue=S.internalSubset;Ue&&P.push(" [",Ue,"]"),P.push(">")}return;case g:return P.push("<?",S.target," ",S.data,"?>");case w:return P.push("&",S.nodeName,";");default:P.push("??",S.nodeName)}}function Vt(S,P,I){var X;switch(P.nodeType){case h:X=P.cloneNode(!1),X.ownerDocument=S;case y:break;case u:I=!0;break}if(X||(X=P.cloneNode(!1)),X.ownerDocument=S,X.parentNode=null,I)for(var be=P.firstChild;be;)X.appendChild(Vt(S,be,I)),be=be.nextSibling;return X}function kt(S,P,I){var X=new P.constructor;for(var be in P)if(Object.prototype.hasOwnProperty.call(P,be)){var Oe=P[be];typeof Oe!="object"&&Oe!=X[be]&&(X[be]=Oe)}switch(P.childNodes&&(X.childNodes=new L),X.ownerDocument=S,X.nodeType){case h:var Xe=P.attributes,Ve=X.attributes=new z,ze=Xe.length;Ve._ownerElement=X;for(var bt=0;bt<ze;bt++)X.setAttributeNode(kt(S,Xe.item(bt),!0));break;case u:I=!0}if(I)for(var Dt=P.firstChild;Dt;)X.appendChild(kt(S,Dt,I)),Dt=Dt.nextSibling;return X}function Ut(S,P,I){S[P]=I}try{if(Object.defineProperty){let S=function(P){switch(P.nodeType){case h:case y:var I=[];for(P=P.firstChild;P;)P.nodeType!==7&&P.nodeType!==8&&I.push(S(P)),P=P.nextSibling;return I.join("");default:return P.nodeValue}};Object.defineProperty(H.prototype,"length",{get:function(){return V(this),this.$$length}}),Object.defineProperty(ie.prototype,"textContent",{get:function(){return S(this)},set:function(P){switch(this.nodeType){case h:case y:for(;this.firstChild;)this.removeChild(this.firstChild);(P||String(P))&&this.appendChild(this.ownerDocument.createTextNode(P));break;default:this.data=P,this.value=P,this.nodeValue=P}}}),Ut=function(P,I,X){P["$$"+I]=X}}}catch{}return Ur.DocumentType=Ge,Ur.DOMException=D,Ur.DOMImplementation=ne,Ur.Element=de,Ur.Node=ie,Ur.NodeList=L,Ur.XMLSerializer=Tt,Ur}var rs={},si={},Vl;function am(){return Vl||(Vl=1,(function(t){var r=Dn().freeze;t.XML_ENTITIES=r({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=r({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
104
+ `,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES})(si)),si}var Fs={},Ul;function sm(){if(Ul)return Fs;Ul=1;var t=Dn().NAMESPACE,r=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,s=new RegExp("[\\-\\.0-9"+r.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),n=new RegExp("^"+r.source+s.source+"*(?::"+r.source+s.source+"*)?$"),a=0,i=1,o=2,c=3,d=4,f=5,l=6,h=7;function u(A,C){this.message=A,this.locator=C,Error.captureStackTrace&&Error.captureStackTrace(this,u)}u.prototype=new Error,u.prototype.name=u.name;function p(){}p.prototype={parse:function(A,C,T){var D=this.domBuilder;D.startDocument(),j(C,C={}),b(A,C,T,D,this.errorHandler),D.endDocument()}};function b(A,C,T,D,L){function H(de){if(de>65535){de-=65536;var ve=55296+(de>>10),fe=56320+(de&1023);return String.fromCharCode(ve,fe)}else return String.fromCharCode(de)}function V(de){var ve=de.slice(1,-1);return Object.hasOwnProperty.call(T,ve)?T[ve]:ve.charAt(0)==="#"?H(parseInt(ve.substr(1).replace("x","0x"))):(L.error("entity not found:"+de),de)}function z(de){if(de>q){var ve=A.substring(q,de).replace(/&#?\w+;/g,V);ie&&F(q),D.characters(ve,0,de-q),q=de}}function F(de,ve){for(;de>=G&&(ve=ne.exec(A));)Y=ve.index,G=Y+ve[0].length,ie.lineNumber++;ie.columnNumber=de-Y+1}for(var Y=0,G=0,ne=/.*(?:\r\n?|\n)|.*$/g,ie=D.locator,xe=[{currentNSMap:C}],U={},q=0;;){try{var B=A.indexOf("<",q);if(B<0){if(!A.substr(q).match(/^\s*$/)){var pe=D.doc,ee=pe.createTextNode(A.substr(q));pe.appendChild(ee),D.currentElement=ee}return}switch(B>q&&z(B),A.charAt(B+1)){case"/":var Me=A.indexOf(">",B+3),te=A.substring(B+2,Me).replace(/[ \t\n\r]+$/g,""),_e=xe.pop();Me<0?(te=A.substring(B+2).replace(/[\s<].*/,""),L.error("end tag name: "+te+" is not complete:"+_e.tagName),Me=B+1+te.length):te.match(/\s</)&&(te=te.replace(/[\s<].*/,""),L.error("end tag name: "+te+" maybe not complete"),Me=B+1+te.length);var Ie=_e.localNSMap,K=_e.tagName==te,le=K||_e.tagName&&_e.tagName.toLowerCase()==te.toLowerCase();if(le){if(D.endElement(_e.uri,_e.localName,te),Ie)for(var oe in Ie)Object.prototype.hasOwnProperty.call(Ie,oe)&&D.endPrefixMapping(oe);K||L.fatalError("end tag name: "+te+" is not match the current start tagName:"+_e.tagName)}else xe.push(_e);Me++;break;case"?":ie&&F(B),Me=m(A,B,D);break;case"!":ie&&F(B),Me=y(A,B,D,L);break;default:ie&&F(B);var Ne=new _,Ce=xe[xe.length-1].currentNSMap,Me=x(A,B,Ne,Ce,V,L),Fe=Ne.length;if(!Ne.closed&&N(A,Me,Ne.tagName,U)&&(Ne.closed=!0,T.nbsp||L.warning("unclosed xml attribute")),ie&&Fe){for(var ue=w(ie,{}),Re=0;Re<Fe;Re++){var ae=Ne[Re];F(ae.offset),ae.locator=w(ie,{})}D.locator=ue,g(Ne,D,Ce)&&xe.push(Ne),D.locator=ie}else g(Ne,D,Ce)&&xe.push(Ne);t.isHTML(Ne.uri)&&!Ne.closed?Me=v(A,Me,Ne.tagName,V,D):Me++}}catch(de){if(de instanceof u)throw de;L.error("element parse error: "+de),Me=-1}Me>q?q=Me:z(Math.max(B,q)+1)}}function w(A,C){return C.lineNumber=A.lineNumber,C.columnNumber=A.columnNumber,C}function x(A,C,T,D,L,H){function V(ie,xe,U){T.attributeNames.hasOwnProperty(ie)&&H.fatalError("Attribute "+ie+" redefined"),T.addValue(ie,xe.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,L),U)}for(var z,F,Y=++C,G=a;;){var ne=A.charAt(Y);switch(ne){case"=":if(G===i)z=A.slice(C,Y),G=c;else if(G===o)G=c;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(G===c||G===i)if(G===i&&(H.warning('attribute value must after "="'),z=A.slice(C,Y)),C=Y+1,Y=A.indexOf(ne,C),Y>0)F=A.slice(C,Y),V(z,F,C-1),G=f;else throw new Error("attribute value no end '"+ne+"' match");else if(G==d)F=A.slice(C,Y),V(z,F,C),H.warning('attribute "'+z+'" missed start quot('+ne+")!!"),C=Y+1,G=f;else throw new Error('attribute value must after "="');break;case"/":switch(G){case a:T.setTagName(A.slice(C,Y));case f:case l:case h:G=h,T.closed=!0;case d:case i:break;case o:T.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return H.error("unexpected end of input"),G==a&&T.setTagName(A.slice(C,Y)),Y;case">":switch(G){case a:T.setTagName(A.slice(C,Y));case f:case l:case h:break;case d:case i:F=A.slice(C,Y),F.slice(-1)==="/"&&(T.closed=!0,F=F.slice(0,-1));case o:G===o&&(F=z),G==d?(H.warning('attribute "'+F+'" missed quot(")!'),V(z,F,C)):((!t.isHTML(D[""])||!F.match(/^(?:disabled|checked|selected)$/i))&&H.warning('attribute "'+F+'" missed value!! "'+F+'" instead!!'),V(F,F,C));break;case c:throw new Error("attribute value missed!!")}return Y;case"€":ne=" ";default:if(ne<=" ")switch(G){case a:T.setTagName(A.slice(C,Y)),G=l;break;case i:z=A.slice(C,Y),G=o;break;case d:var F=A.slice(C,Y);H.warning('attribute "'+F+'" missed quot(")!!'),V(z,F,C);case f:G=l;break}else switch(G){case o:T.tagName,(!t.isHTML(D[""])||!z.match(/^(?:disabled|checked|selected)$/i))&&H.warning('attribute "'+z+'" missed value!! "'+z+'" instead2!!'),V(z,z,C),C=Y,G=i;break;case f:H.warning('attribute space is required"'+z+'"!!');case l:G=i,C=Y;break;case c:G=d,C=Y;break;case h:throw new Error("elements closed character '/' and '>' must be connected to")}}Y++}}function g(A,C,T){for(var D=A.tagName,L=null,ne=A.length;ne--;){var H=A[ne],V=H.qName,z=H.value,ie=V.indexOf(":");if(ie>0)var F=H.prefix=V.slice(0,ie),Y=V.slice(ie+1),G=F==="xmlns"&&Y;else Y=V,F=null,G=V==="xmlns"&&"";H.localName=Y,G!==!1&&(L==null&&(L={},j(T,T={})),T[G]=L[G]=z,H.uri=t.XMLNS,C.startPrefixMapping(G,z))}for(var ne=A.length;ne--;){H=A[ne];var F=H.prefix;F&&(F==="xml"&&(H.uri=t.XML),F!=="xmlns"&&(H.uri=T[F||""]))}var ie=D.indexOf(":");ie>0?(F=A.prefix=D.slice(0,ie),Y=A.localName=D.slice(ie+1)):(F=null,Y=A.localName=D);var xe=A.uri=T[F||""];if(C.startElement(xe,Y,D,A),A.closed){if(C.endElement(xe,Y,D),L)for(F in L)Object.prototype.hasOwnProperty.call(L,F)&&C.endPrefixMapping(F)}else return A.currentNSMap=T,A.localNSMap=L,!0}function v(A,C,T,D,L){if(/^(?:script|textarea)$/i.test(T)){var H=A.indexOf("</"+T+">",C),V=A.substring(C+1,H);if(/[&<]/.test(V))return/^script$/i.test(T)?(L.characters(V,0,V.length),H):(V=V.replace(/&#?\w+;/g,D),L.characters(V,0,V.length),H)}return C+1}function N(A,C,T,D){var L=D[T];return L==null&&(L=A.lastIndexOf("</"+T+">"),L<C&&(L=A.lastIndexOf("</"+T)),D[T]=L),L<C}function j(A,C){for(var T in A)Object.prototype.hasOwnProperty.call(A,T)&&(C[T]=A[T])}function y(A,C,T,D){var L=A.charAt(C+2);switch(L){case"-":if(A.charAt(C+3)==="-"){var H=A.indexOf("-->",C+4);return H>C?(T.comment(A,C+4,H-C-4),H+3):(D.error("Unclosed comment"),-1)}else return-1;default:if(A.substr(C+3,6)=="CDATA["){var H=A.indexOf("]]>",C+9);return T.startCDATA(),T.characters(A,C+9,H-C-9),T.endCDATA(),H+3}var V=E(A,C),z=V.length;if(z>1&&/!doctype/i.test(V[0][0])){var F=V[1][0],Y=!1,G=!1;z>3&&(/^public$/i.test(V[2][0])?(Y=V[3][0],G=z>4&&V[4][0]):/^system$/i.test(V[2][0])&&(G=V[3][0]));var ne=V[z-1];return T.startDTD(F,Y,G),T.endDTD(),ne.index+ne[0].length}}return-1}function m(A,C,T){var D=A.indexOf("?>",C);if(D){var L=A.substring(C,D).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return L?(L[0].length,T.processingInstruction(L[1],L[2]),D+2):-1}return-1}function _(){this.attributeNames={}}_.prototype={setTagName:function(A){if(!n.test(A))throw new Error("invalid tagName:"+A);this.tagName=A},addValue:function(A,C,T){if(!n.test(A))throw new Error("invalid attribute:"+A);this.attributeNames[A]=this.length,this[this.length++]={qName:A,value:C,offset:T}},length:0,getLocalName:function(A){return this[A].localName},getLocator:function(A){return this[A].locator},getQName:function(A){return this[A].qName},getURI:function(A){return this[A].uri},getValue:function(A){return this[A].value}};function E(A,C){var T,D=[],L=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(L.lastIndex=C,L.exec(A);T=L.exec(A);)if(D.push(T),T[1])return D}return Fs.XMLReader=p,Fs.ParseError=u,Fs}var ql;function nm(){if(ql)return rs;ql=1;var t=Dn(),r=yd(),s=am(),n=sm(),a=r.DOMImplementation,i=t.NAMESPACE,o=n.ParseError,c=n.XMLReader;function d(x){return x.replace(/\r[\n\u0085]/g,`
105
105
  `).replace(/[\r\u0085\u2028]/g,`
106
106
  `)}function f(x){this.options=x||{locator:{}}}f.prototype.parseFromString=function(x,g){var v=this.options,N=new c,j=v.domBuilder||new h,y=v.errorHandler,m=v.locator,_=v.xmlns||{},E=/\/x?html?$/.test(g),A=E?s.HTML_ENTITIES:s.XML_ENTITIES;m&&j.setDocumentLocator(m),N.errorHandler=l(y,j,m),N.domBuilder=v.domBuilder||j,E&&(_[""]=i.HTML),_.xml=_.xml||i.XML;var C=v.normalizeLineEndings||d;return x&&typeof x=="string"?N.parse(C(x),_,A):N.errorHandler.error("invalid doc source"),j.doc};function l(x,g,v){if(!x){if(g instanceof h)return g;x=g}var N={},j=x instanceof Function;v=v||{};function y(m){var _=x[m];!_&&j&&(_=x.length==2?function(E){x(m,E)}:x),N[m]=_&&function(E){_("[xmldom "+m+"] "+E+p(v))}||function(){}}return y("warning"),y("error"),y("fatalError"),N}function h(){this.cdata=!1}function u(x,g){g.lineNumber=x.lineNumber,g.columnNumber=x.columnNumber}h.prototype={startDocument:function(){this.doc=new a().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(x,g,v,N){var j=this.doc,y=j.createElementNS(x,v||g),m=N.length;w(this,y),this.currentElement=y,this.locator&&u(this.locator,y);for(var _=0;_<m;_++){var x=N.getURI(_),E=N.getValue(_),v=N.getQName(_),A=j.createAttributeNS(x,v);this.locator&&u(N.getLocator(_),A),A.value=A.nodeValue=E,y.setAttributeNode(A)}},endElement:function(x,g,v){var N=this.currentElement;N.tagName,this.currentElement=N.parentNode},startPrefixMapping:function(x,g){},endPrefixMapping:function(x){},processingInstruction:function(x,g){var v=this.doc.createProcessingInstruction(x,g);this.locator&&u(this.locator,v),w(this,v)},ignorableWhitespace:function(x,g,v){},characters:function(x,g,v){if(x=b.apply(this,arguments),x){if(this.cdata)var N=this.doc.createCDATASection(x);else var N=this.doc.createTextNode(x);this.currentElement?this.currentElement.appendChild(N):/^\s*$/.test(x)&&this.doc.appendChild(N),this.locator&&u(this.locator,N)}},skippedEntity:function(x){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(x){(this.locator=x)&&(x.lineNumber=0)},comment:function(x,g,v){x=b.apply(this,arguments);var N=this.doc.createComment(x);this.locator&&u(this.locator,N),w(this,N)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(x,g,v){var N=this.doc.implementation;if(N&&N.createDocumentType){var j=N.createDocumentType(x,g,v);this.locator&&u(this.locator,j),w(this,j),this.doc.doctype=j}},warning:function(x){console.warn("[xmldom warning] "+x,p(this.locator))},error:function(x){console.error("[xmldom error] "+x,p(this.locator))},fatalError:function(x){throw new o(x,this.locator)}};function p(x){if(x)return`
107
- @`+(x.systemId||"")+"#[line:"+x.lineNumber+",col:"+x.columnNumber+"]"}function b(x,g,v){return typeof x=="string"?x.substr(g,v):x.length>=g+v||g?new java.lang.String(x,g,v)+"":x}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(x){h.prototype[x]=function(){return null}});function w(x,g){x.currentElement?x.currentElement.appendChild(g):x.doc.appendChild(g)}return rs.__DOMHandler=h,rs.normalizeLineEndings=d,rs.DOMParser=f,rs}var zl;function im(){if(zl)return ts;zl=1;var t=yd();return ts.DOMImplementation=t.DOMImplementation,ts.XMLSerializer=t.XMLSerializer,ts.DOMParser=nm().DOMParser,ts}var as={},Er={},Bs={},ni={},Vs={},Hl;function Pn(){if(Hl)return Vs;Hl=1,Object.defineProperty(Vs,"__esModule",{value:!0});const t=Tn();let r=class extends t.default{constructor(n,a){super(n,a)}};return Vs.UniverseLogError=r,Vs}var Wl;function Ns(){return Wl||(Wl=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});const r=Pn();(function(s){s.error="error",s.warn="warn",s.info="info",s.http="http",s.verbose="verbose",s.debug="debug",s.silly="silly"})(t.LogLevel||(t.LogLevel={})),(function(s){s.LEVELS_VALUES={[s.error]:0,[s.warn]:1,[s.info]:2,[s.http]:3,[s.verbose]:4,[s.debug]:5,[s.silly]:6},s.LEVELS_BY_NAME={[s.error]:s.error,[s.warn]:s.warn,[s.info]:s.info,[s.http]:s.http,[s.verbose]:s.verbose,[s.debug]:s.debug,[s.silly]:s.silly},s.DEFAULT_LEVEL=s.info;function n(d){if(typeof s.LEVELS_BY_NAME[d]>"u"){const f=Object.keys(s.LEVELS_BY_NAME).join(", ");throw new r.UniverseLogError(`There is no such log level: '${d}'. Available levels: [ ${f} ]`)}return s.LEVELS_BY_NAME[d]}s.valueOf=n;function a(d){if(typeof s.LEVELS_VALUES[d]>"u"){const f=Object.keys(s.LEVELS_BY_NAME).join(", ");throw new r.UniverseLogError(`There is no such log level: '${d}'. Available levels: [ ${f} ]`)}return s.LEVELS_VALUES[d]}s.levelToValue=a;function i(d){return a(d.level)<=a(d.threshold)}s.isLessOrEquallyVerbose=i;function o(d,f){return s.LEVELS_VALUES[d]>s.LEVELS_VALUES[f]?d:f}s.moreVerbose=o;function c(d,f){return s.LEVELS_VALUES[d]<s.LEVELS_VALUES[f]?d:f}s.lessVerbose=c})(t.LogLevel||(t.LogLevel={}))})(ni)),ni}var Us={},ka={},ii={exports:{}},Gl;function vd(){return Gl||(Gl=1,(function(t){t.exports=(function(s){var n={};function a(i){if(n[i])return n[i].exports;var o=n[i]={i,l:!1,exports:{}};return s[i].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=s,a.c=n,a.d=function(i,o,c){a.o(i,o)||Object.defineProperty(i,o,{enumerable:!0,get:c})},a.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},a.t=function(i,o){if(1&o&&(i=a(i)),8&o||4&o&&typeof i=="object"&&i&&i.__esModule)return i;var c=Object.create(null);if(a.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:i}),2&o&&typeof i!="string")for(var d in i)a.d(c,d,(function(f){return i[f]}).bind(null,d));return c},a.n=function(i){var o=i&&i.__esModule?function(){return i.default}:function(){return i};return a.d(o,"a",o),o},a.o=function(i,o){return Object.prototype.hasOwnProperty.call(i,o)},a.p="",a(a.s=4)})([function(s,n,a){var i=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(n,"__esModule",{value:!0});const o=i(a(1)),c=a(8),d=a(2),f=a(16);n.validatorSymbol=Symbol("validators"),n.Predicate=class{constructor(l,h={}){this.type=l,this.options=h,this.context={validators:[]},this.context=Object.assign({},this.context,this.options);const u=this.type[0].toLowerCase()+this.type.slice(1);this.addValidator({message:(p,b)=>`Expected ${b&&b.substring(this.type.length+1)||"argument"} to be of type \`${this.type}\` but received type \`${o.default(p)}\``,validator:p=>o.default[u](p)})}[d.testSymbol](l,h,u){for(const{validator:p,message:b}of this.context.validators){if(this.options.optional===!0&&l===void 0)continue;const w=p(l);if(w===!0)continue;let x=u;throw typeof u=="function"&&(x=u()),x=x?`${this.type} \`${x}\``:this.type,new c.ArgumentError(b(l,x,w),h)}}get[n.validatorSymbol](){return this.context.validators}get not(){return f.not(this)}validate(l){return this.addValidator({message:(h,u,p)=>typeof p=="string"?`(${u}) ${p}`:p(u),validator:h=>{const{message:u,validator:p}=l(h);return!!p||u}})}is(l){return this.addValidator({message:(h,u,p)=>p?`(${u}) ${p}`:`Expected ${u} \`${h}\` to pass custom validation function`,validator:l})}addValidator(l){return this.context.validators.push(l),this}}},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0});const i=typeof URL>"u"?a(15).URL:URL,{toString:o}=Object.prototype,c=g=>v=>typeof v===g,d=g=>{const v=o.call(g).slice(8,-1);if(v)return v},f=g=>v=>d(v)===g;function l(g){switch(g){case null:return"null";case!0:case!1:return"boolean"}switch(typeof g){case"undefined":return"undefined";case"string":return"string";case"number":return"number";case"bigint":return"bigint";case"symbol":return"symbol"}if(l.function_(g))return"Function";if(l.observable(g))return"Observable";if(l.array(g))return"Array";if(l.buffer(g))return"Buffer";const v=d(g);if(v)return v;if(g instanceof String||g instanceof Boolean||g instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}const h=g=>typeof g=="object";l.undefined=c("undefined"),l.string=c("string"),l.number=c("number"),l.bigint=c("bigint"),l.function_=c("function"),l.null_=(g=>g===null),l.class_=(g=>l.function_(g)&&g.toString().startsWith("class ")),l.boolean=(g=>g===!0||g===!1),l.symbol=c("symbol"),l.numericString=(g=>l.string(g)&&g.length>0&&!Number.isNaN(Number(g))),l.array=Array.isArray,l.buffer=(g=>!l.nullOrUndefined(g)&&!l.nullOrUndefined(g.constructor)&&l.function_(g.constructor.isBuffer)&&g.constructor.isBuffer(g)),l.nullOrUndefined=(g=>l.null_(g)||l.undefined(g)),l.object=(g=>!l.nullOrUndefined(g)&&(l.function_(g)||h(g))),l.iterable=(g=>!l.nullOrUndefined(g)&&l.function_(g[Symbol.iterator])),l.asyncIterable=(g=>!l.nullOrUndefined(g)&&l.function_(g[Symbol.asyncIterator])),l.generator=(g=>l.iterable(g)&&l.function_(g.next)&&l.function_(g.throw)),l.nativePromise=(g=>f("Promise")(g)),l.promise=(g=>l.nativePromise(g)||(v=>!l.null_(v)&&h(v)&&l.function_(v.then)&&l.function_(v.catch))(g)),l.generatorFunction=f("GeneratorFunction"),l.asyncFunction=f("AsyncFunction"),l.boundFunction=(g=>l.function_(g)&&!g.hasOwnProperty("prototype")),l.regExp=f("RegExp"),l.date=f("Date"),l.error=f("Error"),l.map=(g=>f("Map")(g)),l.set=(g=>f("Set")(g)),l.weakMap=(g=>f("WeakMap")(g)),l.weakSet=(g=>f("WeakSet")(g)),l.int8Array=f("Int8Array"),l.uint8Array=f("Uint8Array"),l.uint8ClampedArray=f("Uint8ClampedArray"),l.int16Array=f("Int16Array"),l.uint16Array=f("Uint16Array"),l.int32Array=f("Int32Array"),l.uint32Array=f("Uint32Array"),l.float32Array=f("Float32Array"),l.float64Array=f("Float64Array"),l.bigint64Array=f("BigInt64Array"),l.biguint64Array=f("BigUint64Array"),l.arrayBuffer=f("ArrayBuffer"),l.sharedArrayBuffer=f("SharedArrayBuffer"),l.dataView=f("DataView"),l.directInstanceOf=((g,v)=>Object.getPrototypeOf(g)===v.prototype),l.urlInstance=(g=>f("URL")(g)),l.urlString=(g=>{if(!l.string(g))return!1;try{return new i(g),!0}catch{return!1}}),l.truthy=(g=>!!g),l.falsy=(g=>!g),l.nan=(g=>Number.isNaN(g));const u=new Set(["undefined","string","number","bigint","boolean","symbol"]);l.primitive=(g=>l.null_(g)||u.has(typeof g)),l.integer=(g=>Number.isInteger(g)),l.safeInteger=(g=>Number.isSafeInteger(g)),l.plainObject=(g=>{if(d(g)!=="Object")return!1;const v=Object.getPrototypeOf(g);return v===null||v===Object.getPrototypeOf({})});const p=new Set(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"]);l.typedArray=(g=>{const v=d(g);return v!==void 0&&p.has(v)}),l.arrayLike=(g=>!l.nullOrUndefined(g)&&!l.function_(g)&&(v=>l.safeInteger(v)&&v>=0)(g.length)),l.inRange=((g,v)=>{if(l.number(v))return g>=Math.min(0,v)&&g<=Math.max(v,0);if(l.array(v)&&v.length===2)return g>=Math.min(...v)&&g<=Math.max(...v);throw new TypeError(`Invalid range: ${JSON.stringify(v)}`)});const b=["innerHTML","ownerDocument","style","attributes","nodeValue"];l.domElement=(g=>l.object(g)&&g.nodeType===1&&l.string(g.nodeName)&&!l.plainObject(g)&&b.every(v=>v in g)),l.observable=(g=>!!g&&(!(!g[Symbol.observable]||g!==g[Symbol.observable]())||!(!g["@@observable"]||g!==g["@@observable"]()))),l.nodeStream=(g=>!l.nullOrUndefined(g)&&h(g)&&l.function_(g.pipe)&&!l.observable(g)),l.infinite=(g=>g===1/0||g===-1/0);const w=g=>v=>l.integer(v)&&Math.abs(v%2)===g;l.evenInteger=w(0),l.oddInteger=w(1),l.emptyArray=(g=>l.array(g)&&g.length===0),l.nonEmptyArray=(g=>l.array(g)&&g.length>0),l.emptyString=(g=>l.string(g)&&g.length===0),l.nonEmptyString=(g=>l.string(g)&&g.length>0),l.emptyStringOrWhitespace=(g=>l.emptyString(g)||(v=>l.string(v)&&/\S/.test(v)===!1)(g)),l.emptyObject=(g=>l.object(g)&&!l.map(g)&&!l.set(g)&&Object.keys(g).length===0),l.nonEmptyObject=(g=>l.object(g)&&!l.map(g)&&!l.set(g)&&Object.keys(g).length>0),l.emptySet=(g=>l.set(g)&&g.size===0),l.nonEmptySet=(g=>l.set(g)&&g.size>0),l.emptyMap=(g=>l.map(g)&&g.size===0),l.nonEmptyMap=(g=>l.map(g)&&g.size>0);const x=(g,v,N)=>{if(l.function_(v)===!1)throw new TypeError(`Invalid predicate: ${JSON.stringify(v)}`);if(N.length===0)throw new TypeError("Invalid number of values");return g.call(N,v)};l.any=((g,...v)=>x(Array.prototype.some,g,v)),l.all=((g,...v)=>x(Array.prototype.every,g,v)),Object.defineProperties(l,{class:{value:l.class_},function:{value:l.function_},null:{value:l.null_}}),s.exports=l,n.default=l},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0}),n.testSymbol=Symbol("test"),n.isPredicate=(i=>!!(i&&i[n.testSymbol]))},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0}),n.default=((i,o,c=5)=>{const d=[];for(const f of o)if(!i.has(f)&&(d.push(f),d.length===c))return d;return d.length===0||d})},function(s,n,a){var i=this&&this.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(n,"__esModule",{value:!0});const o=i(a(10)),c=a(11),d=a(0);n.Predicate=d.Predicate;const f=a(2),l=i(a(17)),h=i(a(6)),u=i(a(9)),p=(w,x,g)=>{if(!f.isPredicate(x)&&typeof x!="string")throw new TypeError(`Expected second argument to be a predicate or a string, got \`${typeof x}\``);if(f.isPredicate(x)){const v=o.default();u.default(w,()=>c.inferLabel(v),x)}else u.default(w,x,g)};Object.defineProperties(p,{isValid:{value:(w,x)=>{try{return p(w,x),!0}catch{return!1}}},create:{value:(w,x)=>g=>{if(f.isPredicate(w)){const v=o.default();u.default(g,()=>c.inferLabel(v),w)}else u.default(g,w,x)}}}),n.default=h.default(l.default(p));var b=a(6);n.StringPredicate=b.StringPredicate,n.NumberPredicate=b.NumberPredicate,n.BooleanPredicate=b.BooleanPredicate,n.ArrayPredicate=b.ArrayPredicate,n.ObjectPredicate=b.ObjectPredicate,n.DatePredicate=b.DatePredicate,n.ErrorPredicate=b.ErrorPredicate,n.MapPredicate=b.MapPredicate,n.WeakMapPredicate=b.WeakMapPredicate,n.SetPredicate=b.SetPredicate,n.WeakSetPredicate=b.WeakSetPredicate,n.AnyPredicate=b.AnyPredicate},function(s,n,a){(function(i){var o=200,c="__lodash_hash_undefined__",d=1,f=2,l=9007199254740991,h="[object Arguments]",u="[object Array]",p="[object AsyncFunction]",b="[object Boolean]",w="[object Date]",x="[object Error]",g="[object Function]",v="[object GeneratorFunction]",N="[object Map]",j="[object Number]",y="[object Null]",m="[object Object]",_="[object Proxy]",E="[object RegExp]",A="[object Set]",C="[object String]",T="[object Symbol]",D="[object Undefined]",L="[object ArrayBuffer]",H="[object DataView]",V=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,F={};F["[object Float32Array]"]=F["[object Float64Array]"]=F["[object Int8Array]"]=F["[object Int16Array]"]=F["[object Int32Array]"]=F["[object Uint8Array]"]=F["[object Uint8ClampedArray]"]=F["[object Uint16Array]"]=F["[object Uint32Array]"]=!0,F[h]=F[u]=F[L]=F[b]=F[H]=F[w]=F[x]=F[g]=F[N]=F[j]=F[m]=F[E]=F[A]=F[C]=F["[object WeakMap]"]=!1;var Y=typeof Kr=="object"&&Kr&&Kr.Object===Object&&Kr,G=typeof self=="object"&&self&&self.Object===Object&&self,ne=Y||G||Function("return this")(),ie=n&&!n.nodeType&&n,xe=ie&&typeof i=="object"&&i&&!i.nodeType&&i,U=xe&&xe.exports===ie,q=U&&Y.process,B=(function(){try{return q&&q.binding&&q.binding("util")}catch{}})(),pe=B&&B.isTypedArray;function ee(W,Q){for(var we=-1,Ae=W==null?0:W.length;++we<Ae;)if(Q(W[we],we,W))return!0;return!1}function te(W){var Q=-1,we=Array(W.size);return W.forEach(function(Ae,ht){we[++Q]=[ht,Ae]}),we}function _e(W){var Q=-1,we=Array(W.size);return W.forEach(function(Ae){we[++Q]=Ae}),we}var Ie,K,le,oe=Array.prototype,Ne=Function.prototype,Ce=Object.prototype,Me=ne["__core-js_shared__"],Fe=Ne.toString,ue=Ce.hasOwnProperty,Re=(Ie=/[^.]+$/.exec(Me&&Me.keys&&Me.keys.IE_PROTO||""))?"Symbol(src)_1."+Ie:"",se=Ce.toString,de=RegExp("^"+Fe.call(ue).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ve=U?ne.Buffer:void 0,fe=ne.Symbol,ke=ne.Uint8Array,Se=Ce.propertyIsEnumerable,Be=oe.splice,Ge=fe?fe.toStringTag:void 0,pt=Object.getOwnPropertySymbols,jt=ve?ve.isBuffer:void 0,gt=(K=Object.keys,le=Object,function(W){return K(le(W))}),St=Pe(ne,"DataView"),Ct=Pe(ne,"Map"),Tt=Pe(ne,"Promise"),Bt=Pe(ne,"Set"),Ke=Pe(ne,"WeakMap"),at=Pe(Object,"create"),_t=Je(St),Vt=Je(Ct),kt=Je(Tt),Ut=Je(Bt),S=Je(Ke),P=fe?fe.prototype:void 0,I=P?P.valueOf:void 0;function X(W){var Q=-1,we=W==null?0:W.length;for(this.clear();++Q<we;){var Ae=W[Q];this.set(Ae[0],Ae[1])}}function be(W){var Q=-1,we=W==null?0:W.length;for(this.clear();++Q<we;){var Ae=W[Q];this.set(Ae[0],Ae[1])}}function Oe(W){var Q=-1,we=W==null?0:W.length;for(this.clear();++Q<we;){var Ae=W[Q];this.set(Ae[0],Ae[1])}}function Xe(W){var Q=-1,we=W==null?0:W.length;for(this.__data__=new Oe;++Q<we;)this.add(W[Q])}function Ve(W){var Q=this.__data__=new be(W);this.size=Q.size}function ze(W,Q){var we=rr(W),Ae=!we&&Or(W),ht=!we&&!Ae&&Lr(W),Ye=!we&&!Ae&&!ht&&kr(W),yt=we||Ae||ht||Ye,Ot=yt?(function(mt,Rt){for(var qt=-1,It=Array(mt);++qt<mt;)It[qt]=Rt(qt);return It})(W.length,String):[],Gt=Ot.length;for(var At in W)!ue.call(W,At)||yt&&(At=="length"||ht&&(At=="offset"||At=="parent")||Ye&&(At=="buffer"||At=="byteLength"||At=="byteOffset")||xt(At,Gt))||Ot.push(At);return Ot}function bt(W,Q){for(var we=W.length;we--;)if(cr(W[we][0],Q))return we;return-1}function Dt(W){return W==null?W===void 0?D:y:Ge&&Ge in Object(W)?(function(Q){var we=ue.call(Q,Ge),Ae=Q[Ge];try{Q[Ge]=void 0;var ht=!0}catch{}var Ye=se.call(Q);return ht&&(we?Q[Ge]=Ae:delete Q[Ge]),Ye})(W):(function(Q){return se.call(Q)})(W)}function Mt(W){return ar(W)&&Dt(W)==h}function $t(W,Q,we,Ae,ht){return W===Q||(W==null||Q==null||!ar(W)&&!ar(Q)?W!=W&&Q!=Q:(function(Ye,yt,Ot,Gt,At,mt){var Rt=rr(Ye),qt=rr(yt),It=Rt?u:Ue(Ye),sr=qt?u:Ue(yt),xr=(It=It==h?m:It)==m,br=(sr=sr==h?m:sr)==m,lr=It==sr;if(lr&&Lr(Ye)){if(!Lr(yt))return!1;Rt=!0,xr=!1}if(lr&&!xr)return mt||(mt=new Ve),Rt||kr(Ye)?ft(Ye,yt,Ot,Gt,At,mt):(function(st,We,Xt,ir,Fr,vt,dr){switch(Xt){case H:if(st.byteLength!=We.byteLength||st.byteOffset!=We.byteOffset)return!1;st=st.buffer,We=We.buffer;case L:return!(st.byteLength!=We.byteLength||!vt(new ke(st),new ke(We)));case b:case w:case j:return cr(+st,+We);case x:return st.name==We.name&&st.message==We.message;case E:case C:return st==We+"";case N:var vr=te;case A:var $=ir&d;if(vr||(vr=_e),st.size!=We.size&&!$)return!1;var re=dr.get(st);if(re)return re==We;ir|=f,dr.set(st,We);var he=ft(vr(st),vr(We),ir,Fr,vt,dr);return dr.delete(st),he;case T:if(I)return I.call(st)==I.call(We)}return!1})(Ye,yt,It,Ot,Gt,At,mt);if(!(Ot&d)){var ur=xr&&ue.call(Ye,"__wrapped__"),nr=br&&ue.call(yt,"__wrapped__");if(ur||nr){var yr=ur?Ye.value():Ye,Ir=nr?yt.value():yt;return mt||(mt=new Ve),At(yr,Ir,Ot,Gt,mt)}}return lr?(mt||(mt=new Ve),(function(st,We,Xt,ir,Fr,vt){var dr=Xt&d,vr=ge(st),$=vr.length,re=ge(We).length;if($!=re&&!dr)return!1;for(var he=$;he--;){var ae=vr[he];if(!(dr?ae in We:ue.call(We,ae)))return!1}var ye=vt.get(st);if(ye&&vt.get(We))return ye==We;var De=!0;vt.set(st,We),vt.set(We,st);for(var lt=dr;++he<$;){ae=vr[he];var Ze=st[ae],Qe=We[ae];if(ir)var ct=dr?ir(Qe,Ze,ae,We,st,vt):ir(Ze,Qe,ae,st,We,vt);if(!(ct===void 0?Ze===Qe||Fr(Ze,Qe,Xt,ir,vt):ct)){De=!1;break}lt||(lt=ae=="constructor")}if(De&&!lt){var et=st.constructor,Pt=We.constructor;et!=Pt&&"constructor"in st&&"constructor"in We&&!(typeof et=="function"&&et instanceof et&&typeof Pt=="function"&&Pt instanceof Pt)&&(De=!1)}return vt.delete(st),vt.delete(We),De})(Ye,yt,Ot,Gt,At,mt)):!1})(W,Q,we,Ae,$t,ht))}function Yt(W){return!(!$e(W)||(Q=W,Re&&Re in Q))&&(zt(W)?de:V).test(Je(W));var Q}function Et(W){if(we=(Q=W)&&Q.constructor,Ae=typeof we=="function"&&we.prototype||Ce,Q!==Ae)return gt(W);var Q,we,Ae,ht=[];for(var Ye in Object(W))ue.call(W,Ye)&&Ye!="constructor"&&ht.push(Ye);return ht}function ft(W,Q,we,Ae,ht,Ye){var yt=we&d,Ot=W.length,Gt=Q.length;if(Ot!=Gt&&!(yt&&Gt>Ot))return!1;var At=Ye.get(W);if(At&&Ye.get(Q))return At==Q;var mt=-1,Rt=!0,qt=we&f?new Xe:void 0;for(Ye.set(W,Q),Ye.set(Q,W);++mt<Ot;){var It=W[mt],sr=Q[mt];if(Ae)var xr=yt?Ae(sr,It,mt,Q,W,Ye):Ae(It,sr,mt,W,Q,Ye);if(xr!==void 0){if(xr)continue;Rt=!1;break}if(qt){if(!ee(Q,function(br,lr){if(ur=lr,!qt.has(ur)&&(It===br||ht(It,br,we,Ae,Ye)))return qt.push(lr);var ur})){Rt=!1;break}}else if(It!==sr&&!ht(It,sr,we,Ae,Ye)){Rt=!1;break}}return Ye.delete(W),Ye.delete(Q),Rt}function ge(W){return(function(Q,we,Ae){var ht=we(Q);return rr(Q)?ht:(function(Ye,yt){for(var Ot=-1,Gt=yt.length,At=Ye.length;++Ot<Gt;)Ye[At+Ot]=yt[Ot];return Ye})(ht,Ae(Q))})(W,ut,He)}function Te(W,Q){var we,Ae,ht=W.__data__;return((Ae=typeof(we=Q))=="string"||Ae=="number"||Ae=="symbol"||Ae=="boolean"?we!=="__proto__":we===null)?ht[typeof Q=="string"?"string":"hash"]:ht.map}function Pe(W,Q){var we=(function(Ae,ht){return Ae?.[ht]})(W,Q);return Yt(we)?we:void 0}X.prototype.clear=function(){this.__data__=at?at(null):{},this.size=0},X.prototype.delete=function(W){var Q=this.has(W)&&delete this.__data__[W];return this.size-=Q?1:0,Q},X.prototype.get=function(W){var Q=this.__data__;if(at){var we=Q[W];return we===c?void 0:we}return ue.call(Q,W)?Q[W]:void 0},X.prototype.has=function(W){var Q=this.__data__;return at?Q[W]!==void 0:ue.call(Q,W)},X.prototype.set=function(W,Q){var we=this.__data__;return this.size+=this.has(W)?0:1,we[W]=at&&Q===void 0?c:Q,this},be.prototype.clear=function(){this.__data__=[],this.size=0},be.prototype.delete=function(W){var Q=this.__data__,we=bt(Q,W);return!(we<0||(we==Q.length-1?Q.pop():Be.call(Q,we,1),--this.size,0))},be.prototype.get=function(W){var Q=this.__data__,we=bt(Q,W);return we<0?void 0:Q[we][1]},be.prototype.has=function(W){return bt(this.__data__,W)>-1},be.prototype.set=function(W,Q){var we=this.__data__,Ae=bt(we,W);return Ae<0?(++this.size,we.push([W,Q])):we[Ae][1]=Q,this},Oe.prototype.clear=function(){this.size=0,this.__data__={hash:new X,map:new(Ct||be),string:new X}},Oe.prototype.delete=function(W){var Q=Te(this,W).delete(W);return this.size-=Q?1:0,Q},Oe.prototype.get=function(W){return Te(this,W).get(W)},Oe.prototype.has=function(W){return Te(this,W).has(W)},Oe.prototype.set=function(W,Q){var we=Te(this,W),Ae=we.size;return we.set(W,Q),this.size+=we.size==Ae?0:1,this},Xe.prototype.add=Xe.prototype.push=function(W){return this.__data__.set(W,c),this},Xe.prototype.has=function(W){return this.__data__.has(W)},Ve.prototype.clear=function(){this.__data__=new be,this.size=0},Ve.prototype.delete=function(W){var Q=this.__data__,we=Q.delete(W);return this.size=Q.size,we},Ve.prototype.get=function(W){return this.__data__.get(W)},Ve.prototype.has=function(W){return this.__data__.has(W)},Ve.prototype.set=function(W,Q){var we=this.__data__;if(we instanceof be){var Ae=we.__data__;if(!Ct||Ae.length<o-1)return Ae.push([W,Q]),this.size=++we.size,this;we=this.__data__=new Oe(Ae)}return we.set(W,Q),this.size=we.size,this};var He=pt?function(W){return W==null?[]:(W=Object(W),(function(Q,we){for(var Ae=-1,ht=Q==null?0:Q.length,Ye=0,yt=[];++Ae<ht;){var Ot=Q[Ae];we(Ot,Ae,Q)&&(yt[Ye++]=Ot)}return yt})(pt(W),function(Q){return Se.call(W,Q)}))}:function(){return[]},Ue=Dt;function xt(W,Q){return!!(Q=Q??l)&&(typeof W=="number"||z.test(W))&&W>-1&&W%1==0&&W<Q}function Je(W){if(W!=null){try{return Fe.call(W)}catch{}try{return W+""}catch{}}return""}function cr(W,Q){return W===Q||W!=W&&Q!=Q}(St&&Ue(new St(new ArrayBuffer(1)))!=H||Ct&&Ue(new Ct)!=N||Tt&&Ue(Tt.resolve())!="[object Promise]"||Bt&&Ue(new Bt)!=A||Ke&&Ue(new Ke)!="[object WeakMap]")&&(Ue=function(W){var Q=Dt(W),we=Q==m?W.constructor:void 0,Ae=we?Je(we):"";if(Ae)switch(Ae){case _t:return H;case Vt:return N;case kt:return"[object Promise]";case Ut:return A;case S:return"[object WeakMap]"}return Q});var Or=Mt((function(){return arguments})())?Mt:function(W){return ar(W)&&ue.call(W,"callee")&&!Se.call(W,"callee")},rr=Array.isArray,Lr=jt||function(){return!1};function zt(W){if(!$e(W))return!1;var Q=Dt(W);return Q==g||Q==v||Q==p||Q==_}function Mr(W){return typeof W=="number"&&W>-1&&W%1==0&&W<=l}function $e(W){var Q=typeof W;return W!=null&&(Q=="object"||Q=="function")}function ar(W){return W!=null&&typeof W=="object"}var kr=pe?(function(W){return function(Q){return W(Q)}})(pe):function(W){return ar(W)&&Mr(W.length)&&!!F[Dt(W)]};function ut(W){return(Q=W)!=null&&Mr(Q.length)&&!zt(Q)?ze(W):Et(W);var Q}i.exports=function(W,Q){return $t(W,Q)}}).call(this,a(23)(s))},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0});const i=a(18);n.StringPredicate=i.StringPredicate;const o=a(20);n.NumberPredicate=o.NumberPredicate;const c=a(21);n.BooleanPredicate=c.BooleanPredicate;const d=a(0),f=a(22);n.ArrayPredicate=f.ArrayPredicate;const l=a(24);n.ObjectPredicate=l.ObjectPredicate;const h=a(29);n.DatePredicate=h.DatePredicate;const u=a(30);n.ErrorPredicate=u.ErrorPredicate;const p=a(31);n.MapPredicate=p.MapPredicate;const b=a(32);n.WeakMapPredicate=b.WeakMapPredicate;const w=a(33);n.SetPredicate=w.SetPredicate;const x=a(34);n.WeakSetPredicate=x.WeakSetPredicate;const g=a(35);n.AnyPredicate=g.AnyPredicate,n.default=((v,N)=>(Object.defineProperties(v,{string:{get:()=>new i.StringPredicate(N)},number:{get:()=>new o.NumberPredicate(N)},boolean:{get:()=>new c.BooleanPredicate(N)},undefined:{get:()=>new d.Predicate("undefined",N)},null:{get:()=>new d.Predicate("null",N)},nullOrUndefined:{get:()=>new d.Predicate("nullOrUndefined",N)},nan:{get:()=>new d.Predicate("nan",N)},symbol:{get:()=>new d.Predicate("symbol",N)},array:{get:()=>new f.ArrayPredicate(N)},object:{get:()=>new l.ObjectPredicate(N)},date:{get:()=>new h.DatePredicate(N)},error:{get:()=>new u.ErrorPredicate(N)},map:{get:()=>new p.MapPredicate(N)},weakMap:{get:()=>new b.WeakMapPredicate(N)},set:{get:()=>new w.SetPredicate(N)},weakSet:{get:()=>new x.WeakSetPredicate(N)},function:{get:()=>new d.Predicate("Function",N)},buffer:{get:()=>new d.Predicate("Buffer",N)},regExp:{get:()=>new d.Predicate("RegExp",N)},promise:{get:()=>new d.Predicate("Promise",N)},typedArray:{get:()=>new d.Predicate("TypedArray",N)},int8Array:{get:()=>new d.Predicate("Int8Array",N)},uint8Array:{get:()=>new d.Predicate("Uint8Array",N)},uint8ClampedArray:{get:()=>new d.Predicate("Uint8ClampedArray",N)},int16Array:{get:()=>new d.Predicate("Int16Array",N)},uint16Array:{get:()=>new d.Predicate("Uint16Array",N)},int32Array:{get:()=>new d.Predicate("Int32Array",N)},uint32Array:{get:()=>new d.Predicate("Uint32Array",N)},float32Array:{get:()=>new d.Predicate("Float32Array",N)},float64Array:{get:()=>new d.Predicate("Float64Array",N)},arrayBuffer:{get:()=>new d.Predicate("ArrayBuffer",N)},dataView:{get:()=>new d.Predicate("DataView",N)},iterable:{get:()=>new d.Predicate("Iterable",N)},any:{value:(...j)=>new g.AnyPredicate(j,N)}}),v))},function(s,n,a){var i=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(n,"__esModule",{value:!0});const o=i(a(4));n.default=((c,d)=>{try{for(const f of c)o.default(f,d);return!0}catch(f){return f.message}})},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0}),n.ArgumentError=class extends Error{constructor(i,o){super(i),"captureStackTrace"in Error&&Error.captureStackTrace(this,o),this.name="ArgumentError"}}},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0});const i=a(2);n.default=function o(c,d,f){f[i.testSymbol](c,o,d)}},function(s,n,a){const i=()=>{const o=Error.prepareStackTrace;Error.prepareStackTrace=((d,f)=>f);const c=new Error().stack.slice(1);return Error.prepareStackTrace=o,c};s.exports=i,s.exports.default=i},function(s,n,a){var i=this&&this.__importStar||function(h){if(h&&h.__esModule)return h;var u={};if(h!=null)for(var p in h)Object.hasOwnProperty.call(h,p)&&(u[p]=h[p]);return u.default=h,u},o=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(n,"__esModule",{value:!0});const c=i(a(12)),d=o(a(13)),f=o(a(14)),l=/^.*?\((.*?)[,)]/;n.inferLabel=(h=>{if(!f.default)return;const u=h[1],p=u.getFileName(),b=u.getLineNumber(),w=u.getColumnNumber();if(!p||b===null||w===null)return;let x=[];try{x=c.readFileSync(p,"utf8").split(`
107
+ @`+(x.systemId||"")+"#[line:"+x.lineNumber+",col:"+x.columnNumber+"]"}function b(x,g,v){return typeof x=="string"?x.substr(g,v):x.length>=g+v||g?new java.lang.String(x,g,v)+"":x}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(x){h.prototype[x]=function(){return null}});function w(x,g){x.currentElement?x.currentElement.appendChild(g):x.doc.appendChild(g)}return rs.__DOMHandler=h,rs.normalizeLineEndings=d,rs.DOMParser=f,rs}var zl;function im(){if(zl)return ts;zl=1;var t=yd();return ts.DOMImplementation=t.DOMImplementation,ts.XMLSerializer=t.XMLSerializer,ts.DOMParser=nm().DOMParser,ts}var as={},Er={},Bs={},ni={},Vs={},Hl;function Pn(){if(Hl)return Vs;Hl=1,Object.defineProperty(Vs,"__esModule",{value:!0});const t=Tn();let r=class extends t.default{constructor(n,a){super(n,a)}};return Vs.UniverseLogError=r,Vs}var Wl;function Ns(){return Wl||(Wl=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});const r=Pn();(function(s){s.error="error",s.warn="warn",s.info="info",s.http="http",s.verbose="verbose",s.debug="debug",s.silly="silly"})(t.LogLevel||(t.LogLevel={})),(function(s){s.LEVELS_VALUES={[s.error]:0,[s.warn]:1,[s.info]:2,[s.http]:3,[s.verbose]:4,[s.debug]:5,[s.silly]:6},s.LEVELS_BY_NAME={[s.error]:s.error,[s.warn]:s.warn,[s.info]:s.info,[s.http]:s.http,[s.verbose]:s.verbose,[s.debug]:s.debug,[s.silly]:s.silly},s.DEFAULT_LEVEL=s.info;function n(d){if(typeof s.LEVELS_BY_NAME[d]>"u"){const f=Object.keys(s.LEVELS_BY_NAME).join(", ");throw new r.UniverseLogError(`There is no such log level: '${d}'. Available levels: [ ${f} ]`)}return s.LEVELS_BY_NAME[d]}s.valueOf=n;function a(d){if(typeof s.LEVELS_VALUES[d]>"u"){const f=Object.keys(s.LEVELS_BY_NAME).join(", ");throw new r.UniverseLogError(`There is no such log level: '${d}'. Available levels: [ ${f} ]`)}return s.LEVELS_VALUES[d]}s.levelToValue=a;function i(d){return a(d.level)<=a(d.threshold)}s.isLessOrEquallyVerbose=i;function o(d,f){return s.LEVELS_VALUES[d]>s.LEVELS_VALUES[f]?d:f}s.moreVerbose=o;function c(d,f){return s.LEVELS_VALUES[d]<s.LEVELS_VALUES[f]?d:f}s.lessVerbose=c})(t.LogLevel||(t.LogLevel={}))})(ni)),ni}var Us={},ka={},ii={exports:{}},Gl;function vd(){return Gl||(Gl=1,(function(t){t.exports=(function(s){var n={};function a(i){if(n[i])return n[i].exports;var o=n[i]={i,l:!1,exports:{}};return s[i].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=s,a.c=n,a.d=function(i,o,c){a.o(i,o)||Object.defineProperty(i,o,{enumerable:!0,get:c})},a.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},a.t=function(i,o){if(1&o&&(i=a(i)),8&o||4&o&&typeof i=="object"&&i&&i.__esModule)return i;var c=Object.create(null);if(a.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:i}),2&o&&typeof i!="string")for(var d in i)a.d(c,d,(function(f){return i[f]}).bind(null,d));return c},a.n=function(i){var o=i&&i.__esModule?function(){return i.default}:function(){return i};return a.d(o,"a",o),o},a.o=function(i,o){return Object.prototype.hasOwnProperty.call(i,o)},a.p="",a(a.s=4)})([function(s,n,a){var i=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(n,"__esModule",{value:!0});const o=i(a(1)),c=a(8),d=a(2),f=a(16);n.validatorSymbol=Symbol("validators"),n.Predicate=class{constructor(l,h={}){this.type=l,this.options=h,this.context={validators:[]},this.context=Object.assign({},this.context,this.options);const u=this.type[0].toLowerCase()+this.type.slice(1);this.addValidator({message:(p,b)=>`Expected ${b&&b.substring(this.type.length+1)||"argument"} to be of type \`${this.type}\` but received type \`${o.default(p)}\``,validator:p=>o.default[u](p)})}[d.testSymbol](l,h,u){for(const{validator:p,message:b}of this.context.validators){if(this.options.optional===!0&&l===void 0)continue;const w=p(l);if(w===!0)continue;let x=u;throw typeof u=="function"&&(x=u()),x=x?`${this.type} \`${x}\``:this.type,new c.ArgumentError(b(l,x,w),h)}}get[n.validatorSymbol](){return this.context.validators}get not(){return f.not(this)}validate(l){return this.addValidator({message:(h,u,p)=>typeof p=="string"?`(${u}) ${p}`:p(u),validator:h=>{const{message:u,validator:p}=l(h);return!!p||u}})}is(l){return this.addValidator({message:(h,u,p)=>p?`(${u}) ${p}`:`Expected ${u} \`${h}\` to pass custom validation function`,validator:l})}addValidator(l){return this.context.validators.push(l),this}}},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0});const i=typeof URL>"u"?a(15).URL:URL,{toString:o}=Object.prototype,c=g=>v=>typeof v===g,d=g=>{const v=o.call(g).slice(8,-1);if(v)return v},f=g=>v=>d(v)===g;function l(g){switch(g){case null:return"null";case!0:case!1:return"boolean"}switch(typeof g){case"undefined":return"undefined";case"string":return"string";case"number":return"number";case"bigint":return"bigint";case"symbol":return"symbol"}if(l.function_(g))return"Function";if(l.observable(g))return"Observable";if(l.array(g))return"Array";if(l.buffer(g))return"Buffer";const v=d(g);if(v)return v;if(g instanceof String||g instanceof Boolean||g instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}const h=g=>typeof g=="object";l.undefined=c("undefined"),l.string=c("string"),l.number=c("number"),l.bigint=c("bigint"),l.function_=c("function"),l.null_=(g=>g===null),l.class_=(g=>l.function_(g)&&g.toString().startsWith("class ")),l.boolean=(g=>g===!0||g===!1),l.symbol=c("symbol"),l.numericString=(g=>l.string(g)&&g.length>0&&!Number.isNaN(Number(g))),l.array=Array.isArray,l.buffer=(g=>!l.nullOrUndefined(g)&&!l.nullOrUndefined(g.constructor)&&l.function_(g.constructor.isBuffer)&&g.constructor.isBuffer(g)),l.nullOrUndefined=(g=>l.null_(g)||l.undefined(g)),l.object=(g=>!l.nullOrUndefined(g)&&(l.function_(g)||h(g))),l.iterable=(g=>!l.nullOrUndefined(g)&&l.function_(g[Symbol.iterator])),l.asyncIterable=(g=>!l.nullOrUndefined(g)&&l.function_(g[Symbol.asyncIterator])),l.generator=(g=>l.iterable(g)&&l.function_(g.next)&&l.function_(g.throw)),l.nativePromise=(g=>f("Promise")(g)),l.promise=(g=>l.nativePromise(g)||(v=>!l.null_(v)&&h(v)&&l.function_(v.then)&&l.function_(v.catch))(g)),l.generatorFunction=f("GeneratorFunction"),l.asyncFunction=f("AsyncFunction"),l.boundFunction=(g=>l.function_(g)&&!g.hasOwnProperty("prototype")),l.regExp=f("RegExp"),l.date=f("Date"),l.error=f("Error"),l.map=(g=>f("Map")(g)),l.set=(g=>f("Set")(g)),l.weakMap=(g=>f("WeakMap")(g)),l.weakSet=(g=>f("WeakSet")(g)),l.int8Array=f("Int8Array"),l.uint8Array=f("Uint8Array"),l.uint8ClampedArray=f("Uint8ClampedArray"),l.int16Array=f("Int16Array"),l.uint16Array=f("Uint16Array"),l.int32Array=f("Int32Array"),l.uint32Array=f("Uint32Array"),l.float32Array=f("Float32Array"),l.float64Array=f("Float64Array"),l.bigint64Array=f("BigInt64Array"),l.biguint64Array=f("BigUint64Array"),l.arrayBuffer=f("ArrayBuffer"),l.sharedArrayBuffer=f("SharedArrayBuffer"),l.dataView=f("DataView"),l.directInstanceOf=((g,v)=>Object.getPrototypeOf(g)===v.prototype),l.urlInstance=(g=>f("URL")(g)),l.urlString=(g=>{if(!l.string(g))return!1;try{return new i(g),!0}catch{return!1}}),l.truthy=(g=>!!g),l.falsy=(g=>!g),l.nan=(g=>Number.isNaN(g));const u=new Set(["undefined","string","number","bigint","boolean","symbol"]);l.primitive=(g=>l.null_(g)||u.has(typeof g)),l.integer=(g=>Number.isInteger(g)),l.safeInteger=(g=>Number.isSafeInteger(g)),l.plainObject=(g=>{if(d(g)!=="Object")return!1;const v=Object.getPrototypeOf(g);return v===null||v===Object.getPrototypeOf({})});const p=new Set(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"]);l.typedArray=(g=>{const v=d(g);return v!==void 0&&p.has(v)}),l.arrayLike=(g=>!l.nullOrUndefined(g)&&!l.function_(g)&&(v=>l.safeInteger(v)&&v>=0)(g.length)),l.inRange=((g,v)=>{if(l.number(v))return g>=Math.min(0,v)&&g<=Math.max(v,0);if(l.array(v)&&v.length===2)return g>=Math.min(...v)&&g<=Math.max(...v);throw new TypeError(`Invalid range: ${JSON.stringify(v)}`)});const b=["innerHTML","ownerDocument","style","attributes","nodeValue"];l.domElement=(g=>l.object(g)&&g.nodeType===1&&l.string(g.nodeName)&&!l.plainObject(g)&&b.every(v=>v in g)),l.observable=(g=>!!g&&(!(!g[Symbol.observable]||g!==g[Symbol.observable]())||!(!g["@@observable"]||g!==g["@@observable"]()))),l.nodeStream=(g=>!l.nullOrUndefined(g)&&h(g)&&l.function_(g.pipe)&&!l.observable(g)),l.infinite=(g=>g===1/0||g===-1/0);const w=g=>v=>l.integer(v)&&Math.abs(v%2)===g;l.evenInteger=w(0),l.oddInteger=w(1),l.emptyArray=(g=>l.array(g)&&g.length===0),l.nonEmptyArray=(g=>l.array(g)&&g.length>0),l.emptyString=(g=>l.string(g)&&g.length===0),l.nonEmptyString=(g=>l.string(g)&&g.length>0),l.emptyStringOrWhitespace=(g=>l.emptyString(g)||(v=>l.string(v)&&/\S/.test(v)===!1)(g)),l.emptyObject=(g=>l.object(g)&&!l.map(g)&&!l.set(g)&&Object.keys(g).length===0),l.nonEmptyObject=(g=>l.object(g)&&!l.map(g)&&!l.set(g)&&Object.keys(g).length>0),l.emptySet=(g=>l.set(g)&&g.size===0),l.nonEmptySet=(g=>l.set(g)&&g.size>0),l.emptyMap=(g=>l.map(g)&&g.size===0),l.nonEmptyMap=(g=>l.map(g)&&g.size>0);const x=(g,v,N)=>{if(l.function_(v)===!1)throw new TypeError(`Invalid predicate: ${JSON.stringify(v)}`);if(N.length===0)throw new TypeError("Invalid number of values");return g.call(N,v)};l.any=((g,...v)=>x(Array.prototype.some,g,v)),l.all=((g,...v)=>x(Array.prototype.every,g,v)),Object.defineProperties(l,{class:{value:l.class_},function:{value:l.function_},null:{value:l.null_}}),s.exports=l,n.default=l},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0}),n.testSymbol=Symbol("test"),n.isPredicate=(i=>!!(i&&i[n.testSymbol]))},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0}),n.default=((i,o,c=5)=>{const d=[];for(const f of o)if(!i.has(f)&&(d.push(f),d.length===c))return d;return d.length===0||d})},function(s,n,a){var i=this&&this.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(n,"__esModule",{value:!0});const o=i(a(10)),c=a(11),d=a(0);n.Predicate=d.Predicate;const f=a(2),l=i(a(17)),h=i(a(6)),u=i(a(9)),p=(w,x,g)=>{if(!f.isPredicate(x)&&typeof x!="string")throw new TypeError(`Expected second argument to be a predicate or a string, got \`${typeof x}\``);if(f.isPredicate(x)){const v=o.default();u.default(w,()=>c.inferLabel(v),x)}else u.default(w,x,g)};Object.defineProperties(p,{isValid:{value:(w,x)=>{try{return p(w,x),!0}catch{return!1}}},create:{value:(w,x)=>g=>{if(f.isPredicate(w)){const v=o.default();u.default(g,()=>c.inferLabel(v),w)}else u.default(g,w,x)}}}),n.default=h.default(l.default(p));var b=a(6);n.StringPredicate=b.StringPredicate,n.NumberPredicate=b.NumberPredicate,n.BooleanPredicate=b.BooleanPredicate,n.ArrayPredicate=b.ArrayPredicate,n.ObjectPredicate=b.ObjectPredicate,n.DatePredicate=b.DatePredicate,n.ErrorPredicate=b.ErrorPredicate,n.MapPredicate=b.MapPredicate,n.WeakMapPredicate=b.WeakMapPredicate,n.SetPredicate=b.SetPredicate,n.WeakSetPredicate=b.WeakSetPredicate,n.AnyPredicate=b.AnyPredicate},function(s,n,a){(function(i){var o=200,c="__lodash_hash_undefined__",d=1,f=2,l=9007199254740991,h="[object Arguments]",u="[object Array]",p="[object AsyncFunction]",b="[object Boolean]",w="[object Date]",x="[object Error]",g="[object Function]",v="[object GeneratorFunction]",N="[object Map]",j="[object Number]",y="[object Null]",m="[object Object]",_="[object Proxy]",E="[object RegExp]",A="[object Set]",C="[object String]",T="[object Symbol]",D="[object Undefined]",L="[object ArrayBuffer]",H="[object DataView]",V=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,F={};F["[object Float32Array]"]=F["[object Float64Array]"]=F["[object Int8Array]"]=F["[object Int16Array]"]=F["[object Int32Array]"]=F["[object Uint8Array]"]=F["[object Uint8ClampedArray]"]=F["[object Uint16Array]"]=F["[object Uint32Array]"]=!0,F[h]=F[u]=F[L]=F[b]=F[H]=F[w]=F[x]=F[g]=F[N]=F[j]=F[m]=F[E]=F[A]=F[C]=F["[object WeakMap]"]=!1;var Y=typeof Kr=="object"&&Kr&&Kr.Object===Object&&Kr,G=typeof self=="object"&&self&&self.Object===Object&&self,ne=Y||G||Function("return this")(),ie=n&&!n.nodeType&&n,xe=ie&&typeof i=="object"&&i&&!i.nodeType&&i,U=xe&&xe.exports===ie,q=U&&Y.process,B=(function(){try{return q&&q.binding&&q.binding("util")}catch{}})(),pe=B&&B.isTypedArray;function ee(W,Q){for(var we=-1,Ae=W==null?0:W.length;++we<Ae;)if(Q(W[we],we,W))return!0;return!1}function te(W){var Q=-1,we=Array(W.size);return W.forEach(function(Ae,ht){we[++Q]=[ht,Ae]}),we}function _e(W){var Q=-1,we=Array(W.size);return W.forEach(function(Ae){we[++Q]=Ae}),we}var Ie,K,le,oe=Array.prototype,Ne=Function.prototype,Ce=Object.prototype,Me=ne["__core-js_shared__"],Fe=Ne.toString,ue=Ce.hasOwnProperty,Re=(Ie=/[^.]+$/.exec(Me&&Me.keys&&Me.keys.IE_PROTO||""))?"Symbol(src)_1."+Ie:"",ae=Ce.toString,de=RegExp("^"+Fe.call(ue).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ve=U?ne.Buffer:void 0,fe=ne.Symbol,ke=ne.Uint8Array,Se=Ce.propertyIsEnumerable,Be=oe.splice,Ge=fe?fe.toStringTag:void 0,pt=Object.getOwnPropertySymbols,jt=ve?ve.isBuffer:void 0,gt=(K=Object.keys,le=Object,function(W){return K(le(W))}),St=Pe(ne,"DataView"),Ct=Pe(ne,"Map"),Tt=Pe(ne,"Promise"),Bt=Pe(ne,"Set"),Ke=Pe(ne,"WeakMap"),at=Pe(Object,"create"),_t=Je(St),Vt=Je(Ct),kt=Je(Tt),Ut=Je(Bt),S=Je(Ke),P=fe?fe.prototype:void 0,I=P?P.valueOf:void 0;function X(W){var Q=-1,we=W==null?0:W.length;for(this.clear();++Q<we;){var Ae=W[Q];this.set(Ae[0],Ae[1])}}function be(W){var Q=-1,we=W==null?0:W.length;for(this.clear();++Q<we;){var Ae=W[Q];this.set(Ae[0],Ae[1])}}function Oe(W){var Q=-1,we=W==null?0:W.length;for(this.clear();++Q<we;){var Ae=W[Q];this.set(Ae[0],Ae[1])}}function Xe(W){var Q=-1,we=W==null?0:W.length;for(this.__data__=new Oe;++Q<we;)this.add(W[Q])}function Ve(W){var Q=this.__data__=new be(W);this.size=Q.size}function ze(W,Q){var we=rr(W),Ae=!we&&Or(W),ht=!we&&!Ae&&Lr(W),Ye=!we&&!Ae&&!ht&&kr(W),yt=we||Ae||ht||Ye,Ot=yt?(function(mt,Rt){for(var qt=-1,It=Array(mt);++qt<mt;)It[qt]=Rt(qt);return It})(W.length,String):[],Gt=Ot.length;for(var At in W)!ue.call(W,At)||yt&&(At=="length"||ht&&(At=="offset"||At=="parent")||Ye&&(At=="buffer"||At=="byteLength"||At=="byteOffset")||xt(At,Gt))||Ot.push(At);return Ot}function bt(W,Q){for(var we=W.length;we--;)if(cr(W[we][0],Q))return we;return-1}function Dt(W){return W==null?W===void 0?D:y:Ge&&Ge in Object(W)?(function(Q){var we=ue.call(Q,Ge),Ae=Q[Ge];try{Q[Ge]=void 0;var ht=!0}catch{}var Ye=ae.call(Q);return ht&&(we?Q[Ge]=Ae:delete Q[Ge]),Ye})(W):(function(Q){return ae.call(Q)})(W)}function Mt(W){return ar(W)&&Dt(W)==h}function $t(W,Q,we,Ae,ht){return W===Q||(W==null||Q==null||!ar(W)&&!ar(Q)?W!=W&&Q!=Q:(function(Ye,yt,Ot,Gt,At,mt){var Rt=rr(Ye),qt=rr(yt),It=Rt?u:Ue(Ye),sr=qt?u:Ue(yt),xr=(It=It==h?m:It)==m,br=(sr=sr==h?m:sr)==m,lr=It==sr;if(lr&&Lr(Ye)){if(!Lr(yt))return!1;Rt=!0,xr=!1}if(lr&&!xr)return mt||(mt=new Ve),Rt||kr(Ye)?ft(Ye,yt,Ot,Gt,At,mt):(function(st,We,Xt,ir,Fr,vt,dr){switch(Xt){case H:if(st.byteLength!=We.byteLength||st.byteOffset!=We.byteOffset)return!1;st=st.buffer,We=We.buffer;case L:return!(st.byteLength!=We.byteLength||!vt(new ke(st),new ke(We)));case b:case w:case j:return cr(+st,+We);case x:return st.name==We.name&&st.message==We.message;case E:case C:return st==We+"";case N:var vr=te;case A:var $=ir&d;if(vr||(vr=_e),st.size!=We.size&&!$)return!1;var re=dr.get(st);if(re)return re==We;ir|=f,dr.set(st,We);var he=ft(vr(st),vr(We),ir,Fr,vt,dr);return dr.delete(st),he;case T:if(I)return I.call(st)==I.call(We)}return!1})(Ye,yt,It,Ot,Gt,At,mt);if(!(Ot&d)){var ur=xr&&ue.call(Ye,"__wrapped__"),nr=br&&ue.call(yt,"__wrapped__");if(ur||nr){var yr=ur?Ye.value():Ye,Ir=nr?yt.value():yt;return mt||(mt=new Ve),At(yr,Ir,Ot,Gt,mt)}}return lr?(mt||(mt=new Ve),(function(st,We,Xt,ir,Fr,vt){var dr=Xt&d,vr=ge(st),$=vr.length,re=ge(We).length;if($!=re&&!dr)return!1;for(var he=$;he--;){var se=vr[he];if(!(dr?se in We:ue.call(We,se)))return!1}var ye=vt.get(st);if(ye&&vt.get(We))return ye==We;var De=!0;vt.set(st,We),vt.set(We,st);for(var lt=dr;++he<$;){se=vr[he];var Ze=st[se],Qe=We[se];if(ir)var ct=dr?ir(Qe,Ze,se,We,st,vt):ir(Ze,Qe,se,st,We,vt);if(!(ct===void 0?Ze===Qe||Fr(Ze,Qe,Xt,ir,vt):ct)){De=!1;break}lt||(lt=se=="constructor")}if(De&&!lt){var et=st.constructor,Pt=We.constructor;et!=Pt&&"constructor"in st&&"constructor"in We&&!(typeof et=="function"&&et instanceof et&&typeof Pt=="function"&&Pt instanceof Pt)&&(De=!1)}return vt.delete(st),vt.delete(We),De})(Ye,yt,Ot,Gt,At,mt)):!1})(W,Q,we,Ae,$t,ht))}function Yt(W){return!(!$e(W)||(Q=W,Re&&Re in Q))&&(zt(W)?de:V).test(Je(W));var Q}function Et(W){if(we=(Q=W)&&Q.constructor,Ae=typeof we=="function"&&we.prototype||Ce,Q!==Ae)return gt(W);var Q,we,Ae,ht=[];for(var Ye in Object(W))ue.call(W,Ye)&&Ye!="constructor"&&ht.push(Ye);return ht}function ft(W,Q,we,Ae,ht,Ye){var yt=we&d,Ot=W.length,Gt=Q.length;if(Ot!=Gt&&!(yt&&Gt>Ot))return!1;var At=Ye.get(W);if(At&&Ye.get(Q))return At==Q;var mt=-1,Rt=!0,qt=we&f?new Xe:void 0;for(Ye.set(W,Q),Ye.set(Q,W);++mt<Ot;){var It=W[mt],sr=Q[mt];if(Ae)var xr=yt?Ae(sr,It,mt,Q,W,Ye):Ae(It,sr,mt,W,Q,Ye);if(xr!==void 0){if(xr)continue;Rt=!1;break}if(qt){if(!ee(Q,function(br,lr){if(ur=lr,!qt.has(ur)&&(It===br||ht(It,br,we,Ae,Ye)))return qt.push(lr);var ur})){Rt=!1;break}}else if(It!==sr&&!ht(It,sr,we,Ae,Ye)){Rt=!1;break}}return Ye.delete(W),Ye.delete(Q),Rt}function ge(W){return(function(Q,we,Ae){var ht=we(Q);return rr(Q)?ht:(function(Ye,yt){for(var Ot=-1,Gt=yt.length,At=Ye.length;++Ot<Gt;)Ye[At+Ot]=yt[Ot];return Ye})(ht,Ae(Q))})(W,ut,He)}function Te(W,Q){var we,Ae,ht=W.__data__;return((Ae=typeof(we=Q))=="string"||Ae=="number"||Ae=="symbol"||Ae=="boolean"?we!=="__proto__":we===null)?ht[typeof Q=="string"?"string":"hash"]:ht.map}function Pe(W,Q){var we=(function(Ae,ht){return Ae?.[ht]})(W,Q);return Yt(we)?we:void 0}X.prototype.clear=function(){this.__data__=at?at(null):{},this.size=0},X.prototype.delete=function(W){var Q=this.has(W)&&delete this.__data__[W];return this.size-=Q?1:0,Q},X.prototype.get=function(W){var Q=this.__data__;if(at){var we=Q[W];return we===c?void 0:we}return ue.call(Q,W)?Q[W]:void 0},X.prototype.has=function(W){var Q=this.__data__;return at?Q[W]!==void 0:ue.call(Q,W)},X.prototype.set=function(W,Q){var we=this.__data__;return this.size+=this.has(W)?0:1,we[W]=at&&Q===void 0?c:Q,this},be.prototype.clear=function(){this.__data__=[],this.size=0},be.prototype.delete=function(W){var Q=this.__data__,we=bt(Q,W);return!(we<0||(we==Q.length-1?Q.pop():Be.call(Q,we,1),--this.size,0))},be.prototype.get=function(W){var Q=this.__data__,we=bt(Q,W);return we<0?void 0:Q[we][1]},be.prototype.has=function(W){return bt(this.__data__,W)>-1},be.prototype.set=function(W,Q){var we=this.__data__,Ae=bt(we,W);return Ae<0?(++this.size,we.push([W,Q])):we[Ae][1]=Q,this},Oe.prototype.clear=function(){this.size=0,this.__data__={hash:new X,map:new(Ct||be),string:new X}},Oe.prototype.delete=function(W){var Q=Te(this,W).delete(W);return this.size-=Q?1:0,Q},Oe.prototype.get=function(W){return Te(this,W).get(W)},Oe.prototype.has=function(W){return Te(this,W).has(W)},Oe.prototype.set=function(W,Q){var we=Te(this,W),Ae=we.size;return we.set(W,Q),this.size+=we.size==Ae?0:1,this},Xe.prototype.add=Xe.prototype.push=function(W){return this.__data__.set(W,c),this},Xe.prototype.has=function(W){return this.__data__.has(W)},Ve.prototype.clear=function(){this.__data__=new be,this.size=0},Ve.prototype.delete=function(W){var Q=this.__data__,we=Q.delete(W);return this.size=Q.size,we},Ve.prototype.get=function(W){return this.__data__.get(W)},Ve.prototype.has=function(W){return this.__data__.has(W)},Ve.prototype.set=function(W,Q){var we=this.__data__;if(we instanceof be){var Ae=we.__data__;if(!Ct||Ae.length<o-1)return Ae.push([W,Q]),this.size=++we.size,this;we=this.__data__=new Oe(Ae)}return we.set(W,Q),this.size=we.size,this};var He=pt?function(W){return W==null?[]:(W=Object(W),(function(Q,we){for(var Ae=-1,ht=Q==null?0:Q.length,Ye=0,yt=[];++Ae<ht;){var Ot=Q[Ae];we(Ot,Ae,Q)&&(yt[Ye++]=Ot)}return yt})(pt(W),function(Q){return Se.call(W,Q)}))}:function(){return[]},Ue=Dt;function xt(W,Q){return!!(Q=Q??l)&&(typeof W=="number"||z.test(W))&&W>-1&&W%1==0&&W<Q}function Je(W){if(W!=null){try{return Fe.call(W)}catch{}try{return W+""}catch{}}return""}function cr(W,Q){return W===Q||W!=W&&Q!=Q}(St&&Ue(new St(new ArrayBuffer(1)))!=H||Ct&&Ue(new Ct)!=N||Tt&&Ue(Tt.resolve())!="[object Promise]"||Bt&&Ue(new Bt)!=A||Ke&&Ue(new Ke)!="[object WeakMap]")&&(Ue=function(W){var Q=Dt(W),we=Q==m?W.constructor:void 0,Ae=we?Je(we):"";if(Ae)switch(Ae){case _t:return H;case Vt:return N;case kt:return"[object Promise]";case Ut:return A;case S:return"[object WeakMap]"}return Q});var Or=Mt((function(){return arguments})())?Mt:function(W){return ar(W)&&ue.call(W,"callee")&&!Se.call(W,"callee")},rr=Array.isArray,Lr=jt||function(){return!1};function zt(W){if(!$e(W))return!1;var Q=Dt(W);return Q==g||Q==v||Q==p||Q==_}function Mr(W){return typeof W=="number"&&W>-1&&W%1==0&&W<=l}function $e(W){var Q=typeof W;return W!=null&&(Q=="object"||Q=="function")}function ar(W){return W!=null&&typeof W=="object"}var kr=pe?(function(W){return function(Q){return W(Q)}})(pe):function(W){return ar(W)&&Mr(W.length)&&!!F[Dt(W)]};function ut(W){return(Q=W)!=null&&Mr(Q.length)&&!zt(Q)?ze(W):Et(W);var Q}i.exports=function(W,Q){return $t(W,Q)}}).call(this,a(23)(s))},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0});const i=a(18);n.StringPredicate=i.StringPredicate;const o=a(20);n.NumberPredicate=o.NumberPredicate;const c=a(21);n.BooleanPredicate=c.BooleanPredicate;const d=a(0),f=a(22);n.ArrayPredicate=f.ArrayPredicate;const l=a(24);n.ObjectPredicate=l.ObjectPredicate;const h=a(29);n.DatePredicate=h.DatePredicate;const u=a(30);n.ErrorPredicate=u.ErrorPredicate;const p=a(31);n.MapPredicate=p.MapPredicate;const b=a(32);n.WeakMapPredicate=b.WeakMapPredicate;const w=a(33);n.SetPredicate=w.SetPredicate;const x=a(34);n.WeakSetPredicate=x.WeakSetPredicate;const g=a(35);n.AnyPredicate=g.AnyPredicate,n.default=((v,N)=>(Object.defineProperties(v,{string:{get:()=>new i.StringPredicate(N)},number:{get:()=>new o.NumberPredicate(N)},boolean:{get:()=>new c.BooleanPredicate(N)},undefined:{get:()=>new d.Predicate("undefined",N)},null:{get:()=>new d.Predicate("null",N)},nullOrUndefined:{get:()=>new d.Predicate("nullOrUndefined",N)},nan:{get:()=>new d.Predicate("nan",N)},symbol:{get:()=>new d.Predicate("symbol",N)},array:{get:()=>new f.ArrayPredicate(N)},object:{get:()=>new l.ObjectPredicate(N)},date:{get:()=>new h.DatePredicate(N)},error:{get:()=>new u.ErrorPredicate(N)},map:{get:()=>new p.MapPredicate(N)},weakMap:{get:()=>new b.WeakMapPredicate(N)},set:{get:()=>new w.SetPredicate(N)},weakSet:{get:()=>new x.WeakSetPredicate(N)},function:{get:()=>new d.Predicate("Function",N)},buffer:{get:()=>new d.Predicate("Buffer",N)},regExp:{get:()=>new d.Predicate("RegExp",N)},promise:{get:()=>new d.Predicate("Promise",N)},typedArray:{get:()=>new d.Predicate("TypedArray",N)},int8Array:{get:()=>new d.Predicate("Int8Array",N)},uint8Array:{get:()=>new d.Predicate("Uint8Array",N)},uint8ClampedArray:{get:()=>new d.Predicate("Uint8ClampedArray",N)},int16Array:{get:()=>new d.Predicate("Int16Array",N)},uint16Array:{get:()=>new d.Predicate("Uint16Array",N)},int32Array:{get:()=>new d.Predicate("Int32Array",N)},uint32Array:{get:()=>new d.Predicate("Uint32Array",N)},float32Array:{get:()=>new d.Predicate("Float32Array",N)},float64Array:{get:()=>new d.Predicate("Float64Array",N)},arrayBuffer:{get:()=>new d.Predicate("ArrayBuffer",N)},dataView:{get:()=>new d.Predicate("DataView",N)},iterable:{get:()=>new d.Predicate("Iterable",N)},any:{value:(...j)=>new g.AnyPredicate(j,N)}}),v))},function(s,n,a){var i=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(n,"__esModule",{value:!0});const o=i(a(4));n.default=((c,d)=>{try{for(const f of c)o.default(f,d);return!0}catch(f){return f.message}})},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0}),n.ArgumentError=class extends Error{constructor(i,o){super(i),"captureStackTrace"in Error&&Error.captureStackTrace(this,o),this.name="ArgumentError"}}},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0});const i=a(2);n.default=function o(c,d,f){f[i.testSymbol](c,o,d)}},function(s,n,a){const i=()=>{const o=Error.prepareStackTrace;Error.prepareStackTrace=((d,f)=>f);const c=new Error().stack.slice(1);return Error.prepareStackTrace=o,c};s.exports=i,s.exports.default=i},function(s,n,a){var i=this&&this.__importStar||function(h){if(h&&h.__esModule)return h;var u={};if(h!=null)for(var p in h)Object.hasOwnProperty.call(h,p)&&(u[p]=h[p]);return u.default=h,u},o=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(n,"__esModule",{value:!0});const c=i(a(12)),d=o(a(13)),f=o(a(14)),l=/^.*?\((.*?)[,)]/;n.inferLabel=(h=>{if(!f.default)return;const u=h[1],p=u.getFileName(),b=u.getLineNumber(),w=u.getColumnNumber();if(!p||b===null||w===null)return;let x=[];try{x=c.readFileSync(p,"utf8").split(`
108
108
  `)}catch{return}let g=x[b-1];if(!g)return;g=g.slice(w-1);const v=l.exec(g);if(!v||!v[1])return;const N=v[1];return d.default(N)||d.default(N.split(".").pop())?N:void 0})},function(s,n){s.exports=jr},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0});const i=/^[a-z$_][a-z$_0-9]*$/i,o=new Set(["undefined","null","true","false","super","this","Infinity","NaN"]);n.default=(c=>c&&!o.has(c)&&i.test(c))},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0}),n.default=!!(typeof process<"u"&&process.versions&&process.versions.node)},function(s,n){s.exports=jr},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0});const i=a(0);n.not=(o=>{const c=o.addValidator;return o.addValidator=(d=>{const f=d.validator,l=d.message;return d.message=((h,u)=>`[NOT] ${l(h,u)}`),d.validator=(h=>!f(h)),o[i.validatorSymbol].push(d),o.addValidator=c,o}),o})},function(s,n,a){var i=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(n,"__esModule",{value:!0});const o=i(a(6));n.default=(c=>(Object.defineProperties(c,{optional:{get:()=>o.default({},{optional:!0})}}),c))},function(s,n,a){var i=this&&this.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(n,"__esModule",{value:!0});const o=i(a(1)),c=i(a(19)),d=a(0);n.StringPredicate=class extends d.Predicate{constructor(f){super("string",f)}length(f){return this.addValidator({message:(l,h)=>`Expected ${h} to have length \`${f}\`, got \`${l}\``,validator:l=>l.length===f})}minLength(f){return this.addValidator({message:(l,h)=>`Expected ${h} to have a minimum length of \`${f}\`, got \`${l}\``,validator:l=>l.length>=f})}maxLength(f){return this.addValidator({message:(l,h)=>`Expected ${h} to have a maximum length of \`${f}\`, got \`${l}\``,validator:l=>l.length<=f})}matches(f){return this.addValidator({message:(l,h)=>`Expected ${h} to match \`${f}\`, got \`${l}\``,validator:l=>f.test(l)})}startsWith(f){return this.addValidator({message:(l,h)=>`Expected ${h} to start with \`${f}\`, got \`${l}\``,validator:l=>l.startsWith(f)})}endsWith(f){return this.addValidator({message:(l,h)=>`Expected ${h} to end with \`${f}\`, got \`${l}\``,validator:l=>l.endsWith(f)})}includes(f){return this.addValidator({message:(l,h)=>`Expected ${h} to include \`${f}\`, got \`${l}\``,validator:l=>l.includes(f)})}oneOf(f){return this.addValidator({message:(l,h)=>{let u=JSON.stringify(f);if(f.length>10){const p=f.length-10;u=JSON.stringify(f.slice(0,10)).replace(/]$/,`,…+${p} more]`)}return`Expected ${h} to be one of \`${u}\`, got \`${l}\``},validator:l=>f.includes(l)})}get empty(){return this.addValidator({message:(f,l)=>`Expected ${l} to be empty, got \`${f}\``,validator:f=>f===""})}get nonEmpty(){return this.addValidator({message:(f,l)=>`Expected ${l} to not be empty`,validator:f=>f!==""})}equals(f){return this.addValidator({message:(l,h)=>`Expected ${h} to be equal to \`${f}\`, got \`${l}\``,validator:l=>l===f})}get alphanumeric(){return this.addValidator({message:(f,l)=>`Expected ${l} to be alphanumeric, got \`${f}\``,validator:f=>/^[a-z\d]+$/i.test(f)})}get alphabetical(){return this.addValidator({message:(f,l)=>`Expected ${l} to be alphabetical, got \`${f}\``,validator:f=>/^[a-z]+$/gi.test(f)})}get numeric(){return this.addValidator({message:(f,l)=>`Expected ${l} to be numeric, got \`${f}\``,validator:f=>/^(\+|-)?\d+$/i.test(f)})}get date(){return this.addValidator({message:(f,l)=>`Expected ${l} to be a date, got \`${f}\``,validator:c.default})}get lowercase(){return this.addValidator({message:(f,l)=>`Expected ${l} to be lowercase, got \`${f}\``,validator:f=>f.trim()!==""&&f===f.toLowerCase()})}get uppercase(){return this.addValidator({message:(f,l)=>`Expected ${l} to be uppercase, got \`${f}\``,validator:f=>f.trim()!==""&&f===f.toUpperCase()})}get url(){return this.addValidator({message:(f,l)=>`Expected ${l} to be a URL, got \`${f}\``,validator:o.default.urlString})}}},function(s,n,a){s.exports=function(i){return!isNaN(Date.parse(i))}},function(s,n,a){var i=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(n,"__esModule",{value:!0});const o=i(a(1)),c=a(0);n.NumberPredicate=class extends c.Predicate{constructor(d){super("number",d)}inRange(d,f){return this.addValidator({message:(l,h)=>`Expected ${h} to be in range [${d}..${f}], got ${l}`,validator:l=>o.default.inRange(l,[d,f])})}greaterThan(d){return this.addValidator({message:(f,l)=>`Expected ${l} to be greater than ${d}, got ${f}`,validator:f=>f>d})}greaterThanOrEqual(d){return this.addValidator({message:(f,l)=>`Expected ${l} to be greater than or equal to ${d}, got ${f}`,validator:f=>f>=d})}lessThan(d){return this.addValidator({message:(f,l)=>`Expected ${l} to be less than ${d}, got ${f}`,validator:f=>f<d})}lessThanOrEqual(d){return this.addValidator({message:(f,l)=>`Expected ${l} to be less than or equal to ${d}, got ${f}`,validator:f=>f<=d})}equal(d){return this.addValidator({message:(f,l)=>`Expected ${l} to be equal to ${d}, got ${f}`,validator:f=>f===d})}oneOf(d){return this.addValidator({message:(f,l)=>{let h=JSON.stringify(d);if(d.length>10){const u=d.length-10;h=JSON.stringify(d.slice(0,10)).replace(/]$/,`,…+${u} more]`)}return`Expected ${l} to be one of \`${h}\`, got ${f}`},validator:f=>d.includes(f)})}get integer(){return this.addValidator({message:(d,f)=>`Expected ${f} to be an integer, got ${d}`,validator:d=>o.default.integer(d)})}get finite(){return this.addValidator({message:(d,f)=>`Expected ${f} to be finite, got ${d}`,validator:d=>!o.default.infinite(d)})}get infinite(){return this.addValidator({message:(d,f)=>`Expected ${f} to be infinite, got ${d}`,validator:d=>o.default.infinite(d)})}get positive(){return this.addValidator({message:(d,f)=>`Expected ${f} to be positive, got ${d}`,validator:d=>d>0})}get negative(){return this.addValidator({message:(d,f)=>`Expected ${f} to be negative, got ${d}`,validator:d=>d<0})}get integerOrInfinite(){return this.addValidator({message:(d,f)=>`Expected ${f} to be an integer or infinite, got ${d}`,validator:d=>o.default.integer(d)||o.default.infinite(d)})}get uint8(){return this.integer.inRange(0,255)}get uint16(){return this.integer.inRange(0,65535)}get uint32(){return this.integer.inRange(0,4294967295)}get int8(){return this.integer.inRange(-128,127)}get int16(){return this.integer.inRange(-32768,32767)}get int32(){return this.integer.inRange(-2147483648,2147483647)}}},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0});const i=a(0);n.BooleanPredicate=class extends i.Predicate{constructor(o){super("boolean",o)}get true(){return this.addValidator({message:(o,c)=>`Expected ${c} to be true, got ${o}`,validator:o=>o===!0})}get false(){return this.addValidator({message:(o,c)=>`Expected ${c} to be false, got ${o}`,validator:o=>o===!1})}}},function(s,n,a){var i=this&&this.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(n,"__esModule",{value:!0});const o=i(a(5)),c=i(a(4)),d=a(0);n.ArrayPredicate=class extends d.Predicate{constructor(f){super("array",f)}length(f){return this.addValidator({message:(l,h)=>`Expected ${h} to have length \`${f}\`, got \`${l.length}\``,validator:l=>l.length===f})}minLength(f){return this.addValidator({message:(l,h)=>`Expected ${h} to have a minimum length of \`${f}\`, got \`${l.length}\``,validator:l=>l.length>=f})}maxLength(f){return this.addValidator({message:(l,h)=>`Expected ${h} to have a maximum length of \`${f}\`, got \`${l.length}\``,validator:l=>l.length<=f})}startsWith(f){return this.addValidator({message:(l,h)=>`Expected ${h} to start with \`${f}\`, got \`${l[0]}\``,validator:l=>l[0]===f})}endsWith(f){return this.addValidator({message:(l,h)=>`Expected ${h} to end with \`${f}\`, got \`${l[l.length-1]}\``,validator:l=>l[l.length-1]===f})}includes(...f){return this.addValidator({message:(l,h)=>`Expected ${h} to include all elements of \`${JSON.stringify(f)}\`, got \`${JSON.stringify(l)}\``,validator:l=>f.every(h=>l.indexOf(h)!==-1)})}includesAny(...f){return this.addValidator({message:(l,h)=>`Expected ${h} to include any element of \`${JSON.stringify(f)}\`, got \`${JSON.stringify(l)}\``,validator:l=>f.some(h=>l.indexOf(h)!==-1)})}get empty(){return this.addValidator({message:(f,l)=>`Expected ${l} to be empty, got \`${JSON.stringify(f)}\``,validator:f=>f.length===0})}get nonEmpty(){return this.addValidator({message:(f,l)=>`Expected ${l} to not be empty`,validator:f=>f.length>0})}deepEqual(f){return this.addValidator({message:(l,h)=>`Expected ${h} to be deeply equal to \`${JSON.stringify(f)}\`, got \`${JSON.stringify(l)}\``,validator:l=>o.default(l,f)})}ofType(f){let l;return this.addValidator({message:(h,u)=>`(${u}) ${l}`,validator:h=>{try{for(const u of h)c.default(u,f);return!0}catch(u){return l=u.message,!1}}})}}},function(s,n){s.exports=function(a){return a.webpackPolyfill||(a.deprecate=function(){},a.paths=[],a.children||(a.children=[]),Object.defineProperty(a,"loaded",{enumerable:!0,get:function(){return a.l}}),Object.defineProperty(a,"id",{enumerable:!0,get:function(){return a.i}}),a.webpackPolyfill=1),a}},function(s,n,a){var i=this&&this.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(n,"__esModule",{value:!0});const o=i(a(1)),c=i(a(25)),d=i(a(5)),f=a(0),l=i(a(3)),h=i(a(7)),u=i(a(27)),p=a(28);n.ObjectPredicate=class extends f.Predicate{constructor(b){super("object",b)}get plain(){return this.addValidator({message:(b,w)=>`Expected ${w} to be a plain object`,validator:b=>o.default.plainObject(b)})}get empty(){return this.addValidator({message:(b,w)=>`Expected ${w} to be empty, got \`${JSON.stringify(b)}\``,validator:b=>Object.keys(b).length===0})}get nonEmpty(){return this.addValidator({message:(b,w)=>`Expected ${w} to not be empty`,validator:b=>Object.keys(b).length>0})}valuesOfType(b){return this.addValidator({message:(w,x,g)=>`(${x}) ${g}`,validator:w=>{const x=Object.keys(w).map(g=>w[g]);return h.default(x,b)}})}deepValuesOfType(b){return this.addValidator({message:(w,x,g)=>`(${x}) ${g}`,validator:w=>u.default(w,b)})}deepEqual(b){return this.addValidator({message:(w,x)=>`Expected ${x} to be deeply equal to \`${JSON.stringify(b)}\`, got \`${JSON.stringify(w)}\``,validator:w=>d.default(w,b)})}instanceOf(b){return this.addValidator({message:(w,x)=>{let g=w.constructor.name;return g&&g!=="Object"||(g=JSON.stringify(w)),`Expected ${x} \`${g}\` to be of type \`${b.name}\``},validator:w=>w instanceof b})}hasKeys(...b){return this.addValidator({message:(w,x,g)=>`Expected ${x} to have keys \`${JSON.stringify(g)}\``,validator:w=>l.default({has:x=>c.default.has(w,x)},b)})}hasAnyKeys(...b){return this.addValidator({message:(w,x)=>`Expected ${x} to have any key of \`${JSON.stringify(b)}\``,validator:w=>b.some(x=>c.default.has(w,x))})}partialShape(b){return this.addValidator({message:(w,x,g)=>`${g.replace("Expected","Expected property")} in ${x}`,validator:w=>p.partial(w,b)})}exactShape(b){return this.addValidator({message:(w,x,g)=>`${g.replace("Expected","Expected property")} in ${x}`,validator:w=>p.exact(w,b)})}}},function(s,n,a){const i=a(26);function o(c){const d=c.split("."),f=[];for(let l=0;l<d.length;l++){let h=d[l];for(;h[h.length-1]==="\\"&&d[l+1]!==void 0;)h=h.slice(0,-1)+".",h+=d[++l];f.push(h)}return f}s.exports={get(c,d,f){if(!i(c)||typeof d!="string")return f===void 0?c:f;const l=o(d);for(let h=0;h<l.length;h++){if(!Object.prototype.propertyIsEnumerable.call(c,l[h]))return f;if((c=c[l[h]])==null){if(h!==l.length-1)return f;break}}return c},set(c,d,f){if(!i(c)||typeof d!="string")return c;const l=c,h=o(d);for(let u=0;u<h.length;u++){const p=h[u];i(c[p])||(c[p]={}),u===h.length-1&&(c[p]=f),c=c[p]}return l},delete(c,d){if(!i(c)||typeof d!="string")return;const f=o(d);for(let l=0;l<f.length;l++){const h=f[l];if(l===f.length-1)return void delete c[h];if(c=c[h],!i(c))return}},has(c,d){if(!i(c)||typeof d!="string")return!1;const f=o(d);for(let l=0;l<f.length;l++){if(!i(c)||!(f[l]in c))return!1;c=c[f[l]]}return!0}}},function(s,n,a){s.exports=function(i){var o=typeof i;return i!==null&&(o==="object"||o==="function")}},function(s,n,a){var i=this&&this.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(n,"__esModule",{value:!0});const o=i(a(1)),c=i(a(4)),d=(f,l)=>o.default.plainObject(f)?Object.keys(f).every(h=>d(f[h],l)):(c.default(f,l),!0);n.default=((f,l)=>{try{return d(f,l)}catch(h){return h.message}})},function(s,n,a){var i=this&&this.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(n,"__esModule",{value:!0});const o=i(a(1)),c=i(a(9)),d=a(2);n.partial=function f(l,h,u){try{for(const p of Object.keys(h)){const b=u?`${u}.${p}`:p;if(d.isPredicate(h[p]))c.default(l[p],b,h[p]);else if(o.default.plainObject(h[p])){const w=f(l[p],h[p],b);if(w!==!0)return w}}return!0}catch(p){return p.message}},n.exact=function f(l,h,u){try{const p=new Set(Object.keys(l));for(const b of Object.keys(h)){p.delete(b);const w=u?`${u}.${b}`:b;if(d.isPredicate(h[b]))c.default(l[b],w,h[b]);else if(o.default.plainObject(h[b])){if(!Object.prototype.hasOwnProperty.call(l,b))return`Expected \`${w}\` to exist`;const x=f(l[b],h[b],w);if(x!==!0)return x}}if(p.size>0){const b=Array.from(p.keys())[0];return`Did not expect property \`${u?`${u}.${b}`:b}\` to exist, got \`${l[b]}\``}return!0}catch(p){return p.message}}},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0});const i=a(0);n.DatePredicate=class extends i.Predicate{constructor(o){super("date",o)}before(o){return this.addValidator({message:(c,d)=>`Expected ${d} ${c.toISOString()} to be before ${o.toISOString()}`,validator:c=>c.getTime()<o.getTime()})}after(o){return this.addValidator({message:(c,d)=>`Expected ${d} ${c.toISOString()} to be after ${o.toISOString()}`,validator:c=>c.getTime()>o.getTime()})}}},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0});const i=a(0);n.ErrorPredicate=class extends i.Predicate{constructor(o){super("error",o)}name(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have name \`${o}\`, got \`${c.name}\``,validator:c=>c.name===o})}message(o){return this.addValidator({message:(c,d)=>`Expected ${d} message to be \`${o}\`, got \`${c.message}\``,validator:c=>c.message===o})}messageIncludes(o){return this.addValidator({message:(c,d)=>`Expected ${d} message to include \`${o}\`, got \`${c.message}\``,validator:c=>c.message.includes(o)})}hasKeys(...o){return this.addValidator({message:(c,d)=>`Expected ${d} message to have keys \`${o.join("`, `")}\``,validator:c=>o.every(d=>c.hasOwnProperty(d))})}instanceOf(o){return this.addValidator({message:(c,d)=>`Expected ${d} \`${c.name}\` to be of type \`${o.name}\``,validator:c=>c instanceof o})}get typeError(){return this.instanceOf(TypeError)}get evalError(){return this.instanceOf(EvalError)}get rangeError(){return this.instanceOf(RangeError)}get referenceError(){return this.instanceOf(ReferenceError)}get syntaxError(){return this.instanceOf(SyntaxError)}get uriError(){return this.instanceOf(URIError)}}},function(s,n,a){var i=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(n,"__esModule",{value:!0});const o=i(a(5)),c=a(0),d=i(a(3)),f=i(a(7));n.MapPredicate=class extends c.Predicate{constructor(l){super("Map",l)}size(l){return this.addValidator({message:(h,u)=>`Expected ${u} to have size \`${l}\`, got \`${h.size}\``,validator:h=>h.size===l})}minSize(l){return this.addValidator({message:(h,u)=>`Expected ${u} to have a minimum size of \`${l}\`, got \`${h.size}\``,validator:h=>h.size>=l})}maxSize(l){return this.addValidator({message:(h,u)=>`Expected ${u} to have a maximum size of \`${l}\`, got \`${h.size}\``,validator:h=>h.size<=l})}hasKeys(...l){return this.addValidator({message:(h,u,p)=>`Expected ${u} to have keys \`${JSON.stringify(p)}\``,validator:h=>d.default(h,l)})}hasAnyKeys(...l){return this.addValidator({message:(h,u)=>`Expected ${u} to have any key of \`${JSON.stringify(l)}\``,validator:h=>l.some(u=>h.has(u))})}hasValues(...l){return this.addValidator({message:(h,u,p)=>`Expected ${u} to have values \`${JSON.stringify(p)}\``,validator:h=>d.default(new Set(h.values()),l)})}hasAnyValues(...l){return this.addValidator({message:(h,u)=>`Expected ${u} to have any value of \`${JSON.stringify(l)}\``,validator:h=>{const u=new Set(h.values());return l.some(p=>u.has(p))}})}keysOfType(l){return this.addValidator({message:(h,u,p)=>`(${u}) ${p}`,validator:h=>f.default(h.keys(),l)})}valuesOfType(l){return this.addValidator({message:(h,u,p)=>`(${u}) ${p}`,validator:h=>f.default(h.values(),l)})}get empty(){return this.addValidator({message:(l,h)=>`Expected ${h} to be empty, got \`${JSON.stringify(Array.from(l))}\``,validator:l=>l.size===0})}get nonEmpty(){return this.addValidator({message:(l,h)=>`Expected ${h} to not be empty`,validator:l=>l.size>0})}deepEqual(l){return this.addValidator({message:(h,u)=>`Expected ${u} to be deeply equal to \`${JSON.stringify(Array.from(l))}\`, got \`${JSON.stringify(Array.from(h))}\``,validator:h=>o.default(h,l)})}}},function(s,n,a){var i=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(n,"__esModule",{value:!0});const o=a(0),c=i(a(3));n.WeakMapPredicate=class extends o.Predicate{constructor(d){super("WeakMap",d)}hasKeys(...d){return this.addValidator({message:(f,l,h)=>`Expected ${l} to have keys \`${JSON.stringify(h)}\``,validator:f=>c.default(f,d)})}hasAnyKeys(...d){return this.addValidator({message:(f,l)=>`Expected ${l} to have any key of \`${JSON.stringify(d)}\``,validator:f=>d.some(l=>f.has(l))})}}},function(s,n,a){var i=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(n,"__esModule",{value:!0});const o=i(a(5)),c=a(0),d=i(a(3)),f=i(a(7));n.SetPredicate=class extends c.Predicate{constructor(l){super("Set",l)}size(l){return this.addValidator({message:(h,u)=>`Expected ${u} to have size \`${l}\`, got \`${h.size}\``,validator:h=>h.size===l})}minSize(l){return this.addValidator({message:(h,u)=>`Expected ${u} to have a minimum size of \`${l}\`, got \`${h.size}\``,validator:h=>h.size>=l})}maxSize(l){return this.addValidator({message:(h,u)=>`Expected ${u} to have a maximum size of \`${l}\`, got \`${h.size}\``,validator:h=>h.size<=l})}has(...l){return this.addValidator({message:(h,u,p)=>`Expected ${u} to have items \`${JSON.stringify(p)}\``,validator:h=>d.default(h,l)})}hasAny(...l){return this.addValidator({message:(h,u)=>`Expected ${u} to have any item of \`${JSON.stringify(l)}\``,validator:h=>l.some(u=>h.has(u))})}ofType(l){return this.addValidator({message:(h,u,p)=>`(${u}) ${p}`,validator:h=>f.default(h,l)})}get empty(){return this.addValidator({message:(l,h)=>`Expected ${h} to be empty, got \`${JSON.stringify(Array.from(l))}\``,validator:l=>l.size===0})}get nonEmpty(){return this.addValidator({message:(l,h)=>`Expected ${h} to not be empty`,validator:l=>l.size>0})}deepEqual(l){return this.addValidator({message:(h,u)=>`Expected ${u} to be deeply equal to \`${JSON.stringify(Array.from(l))}\`, got \`${JSON.stringify(Array.from(h))}\``,validator:h=>o.default(h,l)})}}},function(s,n,a){var i=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(n,"__esModule",{value:!0});const o=a(0),c=i(a(3));n.WeakSetPredicate=class extends o.Predicate{constructor(d){super("WeakSet",d)}has(...d){return this.addValidator({message:(f,l,h)=>`Expected ${l} to have items \`${JSON.stringify(h)}\``,validator:f=>c.default(f,d)})}hasAny(...d){return this.addValidator({message:(f,l)=>`Expected ${l} to have any item of \`${JSON.stringify(d)}\``,validator:f=>d.some(l=>f.has(l))})}}},function(s,n,a){Object.defineProperty(n,"__esModule",{value:!0});const i=a(8),o=a(2);n.AnyPredicate=class{constructor(c,d={}){this.predicates=c,this.options=d}[o.testSymbol](c,d,f){const l=["Any predicate failed with the following errors:"];for(const h of this.predicates)try{return void d(c,f,h)}catch(u){if(c===void 0&&this.options.optional===!0)return;l.push(`- ${u.message}`)}throw new i.ArgumentError(l.join(`
109
109
  `),d)}}}]);const r=t.exports;t.exports=r.default,Object.assign(t.exports,r)})(ii)),ii.exports}var oi={},qs={},Jl;function om(){if(Jl)return qs;Jl=1,Object.defineProperty(qs,"__esModule",{value:!0});let t=class oo{constructor(s){this.pretty=!1,this.pretty=s}format(s,n){const a=Object.assign({},n,s);return this.pretty?JSON.stringify(a,void 0,2)+`
110
110
  `:JSON.stringify(a)}getName(){return this.pretty?oo.FORMAT_NAME_PRETTY:oo.FORMAT_NAME}};return t.FORMAT_NAME="json",t.FORMAT_NAME_PRETTY="json_pretty",qs.JsonLogFormat=t,qs}var zs={},li={},Yl;function On(){return Yl||(Yl=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),(function(r){r.EMPTY_METADATA={};function s(n){let a=n.service?`${n.service}.`:n.project?`${n.project}.`:"";return a+=n.module?`${n.module}.`:"",a+=n.library?`[${n.library}].`:"",a+=n.tag||"",a||(a="universe-log-empty-id"),a}r.getBestIdentifier=s})(t.LogMetadata||(t.LogMetadata={}))})(li)),li}var Hs={},Xl;function wd(){if(Xl)return Hs;Xl=1,Object.defineProperty(Hs,"__esModule",{value:!0});let t=class{static getTimestamp(){return Date.now()}static getUTCISOTime(){return new Date().toISOString()}};return Hs.TimeUtils=t,Hs}var Zl;function lm(){if(Zl)return zs;Zl=1,Object.defineProperty(zs,"__esModule",{value:!0});const t=On(),r=wd();let s=class Nd{format(a,i){const o=a.time_iso||new Date(a.timestamp).toISOString()||r.TimeUtils.getUTCISOTime();return`${t.LogMetadata.getBestIdentifier(i)} | ${o} [${a.level}]: ${a.message}`+this.includeStackIfPresent(a)}getName(){return Nd.FORMAT_NAME}includeStackIfPresent(a){return a.error&&a.error.stack?`
@@ -1063,13 +1063,13 @@ vulnerable to XSS attacks. Please remove it from \`allowedTags\`.
1063
1063
  Or, to disable this warning, add the \`allowVulnerableTags\` option
1064
1064
  and ensure you are accounting for this risk.
1065
1065
 
1066
- `)});const _=g.nonTextTags||["script","style","textarea","option"];let E,A;g.allowedAttributes&&(E={},A={},d(g.allowedAttributes,function(K,le){E[le]=[];const oe=[];K.forEach(function(Ne){typeof Ne=="string"&&Ne.indexOf("*")>=0?oe.push(r(Ne).replace(/\\\*/g,".*")):E[le].push(Ne)}),oe.length&&(A[le]=new RegExp("^("+oe.join("|")+")$"))}));const C={},T={},D={};d(g.allowedClasses,function(K,le){if(E&&(f(E,le)||(E[le]=[]),E[le].push("class")),C[le]=K,Array.isArray(K)){const oe=[];C[le]=[],D[le]=[],K.forEach(function(Ne){typeof Ne=="string"&&Ne.indexOf("*")>=0?oe.push(r(Ne).replace(/\\\*/g,".*")):Ne instanceof RegExp?D[le].push(Ne):C[le].push(Ne)}),oe.length&&(T[le]=new RegExp("^("+oe.join("|")+")$"))}});const L={};let H;d(g.transformTags,function(K,le){let oe;typeof K=="function"?oe=K:typeof K=="string"&&(oe=b.simpleTransform(K)),le==="*"?H=oe:L[le]=oe});let V,z,F,Y,G,ne,ie=!1;U();const xe=new t.Parser({onopentag:function(K,le){if(g.enforceHtmlBoundary&&K==="html"&&U(),G){ne++;return}const oe=new y(K,le);z.push(oe);let Ne=!1;const Ce=!!oe.text;let Me;if(f(L,K)&&(Me=L[K](K,le),oe.attribs=le=Me.attribs,Me.text!==void 0&&(oe.innerText=Me.text),K!==Me.tagName&&(oe.name=K=Me.tagName,Y[V]=Me.tagName)),H&&(Me=H(K,le),oe.attribs=le=Me.attribs,K!==Me.tagName&&(oe.name=K=Me.tagName,Y[V]=Me.tagName)),(!m(K)||g.disallowedTagsMode==="recursiveEscape"&&!h(F)||g.nestingLimit!=null&&V>=g.nestingLimit)&&(Ne=!0,F[V]=!0,(g.disallowedTagsMode==="discard"||g.disallowedTagsMode==="completelyDiscard")&&_.indexOf(K)!==-1&&(G=!0,ne=1),F[V]=!0),V++,Ne){if(g.disallowedTagsMode==="discard"||g.disallowedTagsMode==="completelyDiscard")return;j=N,N=""}N+="<"+K,K==="script"&&(g.allowedScriptHostnames||g.allowedScriptDomains)&&(oe.innerText=""),(!E||f(E,K)||E["*"])&&d(le,function(Fe,ue){if(!p.test(ue)){delete oe.attribs[ue];return}if(Fe===""&&!g.allowedEmptyAttributes.includes(ue)&&(g.nonBooleanAttributes.includes(ue)||g.nonBooleanAttributes.includes("*"))){delete oe.attribs[ue];return}let Re=!1;if(!E||f(E,K)&&E[K].indexOf(ue)!==-1||E["*"]&&E["*"].indexOf(ue)!==-1||f(A,K)&&A[K].test(ue)||A["*"]&&A["*"].test(ue))Re=!0;else if(E&&E[K]){for(const se of E[K])if(s(se)&&se.name&&se.name===ue){Re=!0;let de="";if(se.multiple===!0){const ve=Fe.split(" ");for(const fe of ve)se.values.indexOf(fe)!==-1&&(de===""?de=fe:de+=" "+fe)}else se.values.indexOf(Fe)>=0&&(de=Fe);Fe=de}}if(Re){if(g.allowedSchemesAppliedToAttributes.indexOf(ue)!==-1&&B(K,Fe)){delete oe.attribs[ue];return}if(K==="script"&&ue==="src"){let se=!0;try{const de=pe(Fe);if(g.allowedScriptHostnames||g.allowedScriptDomains){const ve=(g.allowedScriptHostnames||[]).find(function(ke){return ke===de.url.hostname}),fe=(g.allowedScriptDomains||[]).find(function(ke){return de.url.hostname===ke||de.url.hostname.endsWith(`.${ke}`)});se=ve||fe}}catch{se=!1}if(!se){delete oe.attribs[ue];return}}if(K==="iframe"&&ue==="src"){let se=!0;try{const de=pe(Fe);if(de.isRelativeUrl)se=f(g,"allowIframeRelativeUrls")?g.allowIframeRelativeUrls:!g.allowedIframeHostnames&&!g.allowedIframeDomains;else if(g.allowedIframeHostnames||g.allowedIframeDomains){const ve=(g.allowedIframeHostnames||[]).find(function(ke){return ke===de.url.hostname}),fe=(g.allowedIframeDomains||[]).find(function(ke){return de.url.hostname===ke||de.url.hostname.endsWith(`.${ke}`)});se=ve||fe}}catch{se=!1}if(!se){delete oe.attribs[ue];return}}if(ue==="srcset")try{let se=a(Fe);if(se.forEach(function(de){B("srcset",de.url)&&(de.evil=!0)}),se=l(se,function(de){return!de.evil}),se.length)Fe=u(l(se,function(de){return!de.evil})),oe.attribs[ue]=Fe;else{delete oe.attribs[ue];return}}catch{delete oe.attribs[ue];return}if(ue==="class"){const se=C[K],de=C["*"],ve=T[K],fe=D[K],ke=T["*"],Se=[ve,ke].concat(fe).filter(function(Be){return Be});if(se&&de?Fe=Ie(Fe,n(se,de),Se):Fe=Ie(Fe,se||de,Se),!Fe.length){delete oe.attribs[ue];return}}if(ue==="style"){if(g.parseStyleAttributes)try{const se=i(K+" {"+Fe+"}",{map:!1}),de=ee(se,g.allowedStyles);if(Fe=te(de),Fe.length===0){delete oe.attribs[ue];return}}catch{typeof window<"u"&&console.warn('Failed to parse "'+K+" {"+Fe+`}", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547`),delete oe.attribs[ue];return}else if(g.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.")}N+=" "+ue,Fe&&Fe.length?N+='="'+q(Fe,!0)+'"':g.allowedEmptyAttributes.includes(ue)&&(N+='=""')}else delete oe.attribs[ue]}),g.selfClosing.indexOf(K)!==-1?N+=" />":(N+=">",oe.innerText&&!Ce&&!g.textFilter&&(N+=q(oe.innerText),ie=!0)),Ne&&(N=j+q(N),j="")},ontext:function(K){if(G)return;const le=z[z.length-1];let oe;if(le&&(oe=le.tag,K=le.innerText!==void 0?le.innerText:K),g.disallowedTagsMode==="completelyDiscard"&&!m(oe))K="";else if((g.disallowedTagsMode==="discard"||g.disallowedTagsMode==="completelyDiscard")&&(oe==="script"||oe==="style"))N+=K;else{const Ne=q(K,!1);g.textFilter&&!ie?N+=g.textFilter(Ne,oe):ie||(N+=Ne)}if(z.length){const Ne=z[z.length-1];Ne.text+=K}},onclosetag:function(K,le){if(G)if(ne--,!ne)G=!1;else return;const oe=z.pop();if(!oe)return;if(oe.tag!==K){z.push(oe);return}G=g.enforceHtmlBoundary?K==="html":!1,V--;const Ne=F[V];if(Ne){if(delete F[V],g.disallowedTagsMode==="discard"||g.disallowedTagsMode==="completelyDiscard"){oe.updateParentNodeText();return}j=N,N=""}if(Y[V]&&(K=Y[V],delete Y[V]),g.exclusiveFilter&&g.exclusiveFilter(oe)){N=N.substr(0,oe.tagPosition);return}if(oe.updateParentNodeMediaChildren(),oe.updateParentNodeText(),g.selfClosing.indexOf(K)!==-1||le&&!m(K)&&["escape","recursiveEscape"].indexOf(g.disallowedTagsMode)>=0){Ne&&(N=j,j="");return}N+="</"+K+">",Ne&&(N=j+q(N),j=""),ie=!1}},g.parser);return xe.write(x),xe.end(),N;function U(){N="",V=0,z=[],F={},Y={},G=!1,ne=0}function q(K,le){return typeof K!="string"&&(K=K+""),g.parser.decodeEntities&&(K=K.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),le&&(K=K.replace(/"/g,"&quot;"))),K=K.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),le&&(K=K.replace(/"/g,"&quot;")),K}function B(K,le){for(le=le.replace(/[\x00-\x20]+/g,"");;){const Ce=le.indexOf("<!--");if(Ce===-1)break;const Me=le.indexOf("-->",Ce+4);if(Me===-1)break;le=le.substring(0,Ce)+le.substring(Me+3)}const oe=le.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!oe)return le.match(/^[/\\]{2}/)?!g.allowProtocolRelative:!1;const Ne=oe[1].toLowerCase();return f(g.allowedSchemesByTag,K)?g.allowedSchemesByTag[K].indexOf(Ne)===-1:!g.allowedSchemes||g.allowedSchemes.indexOf(Ne)===-1}function pe(K){if(K=K.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//"),K.startsWith("relative:"))throw new Error("relative: exploit attempt");let le="relative://relative-site";for(let Ce=0;Ce<100;Ce++)le+=`/${Ce}`;const oe=new URL(K,le);return{isRelativeUrl:oe&&oe.hostname==="relative-site"&&oe.protocol==="relative:",url:oe}}function ee(K,le){if(!le)return K;const oe=K.nodes[0];let Ne;return le[oe.selector]&&le["*"]?Ne=n(le[oe.selector],le["*"]):Ne=le[oe.selector]||le["*"],Ne&&(K.nodes[0].nodes=oe.nodes.reduce(_e(Ne),[])),K}function te(K){return K.nodes[0].nodes.reduce(function(le,oe){return le.push(`${oe.prop}:${oe.value}${oe.important?" !important":""}`),le},[]).join(";")}function _e(K){return function(le,oe){return f(K,oe.prop)&&K[oe.prop].some(function(Ce){return Ce.test(oe.value)})&&le.push(oe),le}}function Ie(K,le,oe){return le?(K=K.split(/\s+/),K.filter(function(Ne){return le.indexOf(Ne)!==-1||oe.some(function(Ce){return Ce.test(Ne)})}).join(" ")):K}}const w={decodeEntities:!0};return b.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","main","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0},b.simpleTransform=function(x,g,v){return v=v===void 0?!0:v,g=g||{},function(N,j){let y;if(v)for(y in g)j[y]=g[y];else j=g;return{tagName:x,attribs:j}}},Hi}var Lc;function Xm(){if(Lc)return ha;Lc=1;var t=ha&&ha.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(ha,"__esModule",{value:!0}),ha.TagTransformingSanitizer=void 0;const r=t(ws()),s=t(Ym()),n=Jr(),a=No(),i=Ld();let o=class{constructor(d,f){this.sanitizationErrors=[],this.validate(d),a.Localization.validate(f),this.localization=f,this.options=d}sanitize(d){return(0,s.default)(d,this.generateSanitizeConfig())}getErrors(){return this.sanitizationErrors}generateSanitizeConfig(){return{allowedTags:i.StaticConfig.sanitization.allowedTags,allowedAttributes:{iframe:["src","width","height","frameborder","allowfullscreen","webkitallowfullscreen","mozallowfullscreen"],div:["class","title"],td:["style"],img:["src","alt"],a:["href","rel","title","class","target","id"]},allowedSchemes:["http","https","hive"],transformTags:{iframe:(d,f)=>{const l=f.src;for(const u of i.StaticConfig.sanitization.iframeWhitelist)if(u.re.test(l)){const p=typeof u.fn=="function"?u.fn(l):l;if(!p)break;return{tagName:"iframe",attribs:{src:p,width:this.options.iframeWidth+"",height:this.options.iframeHeight+"",frameborder:"0",allowfullscreen:"allowfullscreen",webkitallowfullscreen:"webkitallowfullscreen",mozallowfullscreen:"mozallowfullscreen"}}}return n.Log.log().warn('Blocked, did not match iframe "src" white list urls:',d,f),this.sanitizationErrors.push("Invalid iframe URL: "+l),{tagName:"div",text:`(Unsupported ${l})`,attribs:{}}},img:(d,f)=>{if(this.options.noImage)return{tagName:"div",text:this.localization.noImage,attribs:{}};const{src:l,alt:h}=f;if(!/^(https?:)?\/\//i.test(l))return n.Log.log().warn("Blocked, image tag src does not appear to be a url",d,f),this.sanitizationErrors.push("An image in this post did not save properly."),{tagName:"img",attribs:{src:"brokenimg.jpg"}};const u={};return u.src=l.replace(/^http:\/\//i,"//"),h&&h!==""&&(u.alt=h),{tagName:d,attribs:u}},div:(d,f)=>{const l={},u=["pull-right","pull-left","text-justify","text-rtl","text-center","text-right","videoWrapper","phishy"].find(b=>f.class===b);return u&&(l.class=u),u==="phishy"&&f.title===this.localization.phishingWarning&&(l.title=f.title),{tagName:d,attribs:l}},td:(d,f)=>{const l={};return f.style==="text-align:right"&&(l.style="text-align:right"),{tagName:d,attribs:l}},a:(d,f)=>{const l=Object.assign({},f);let{href:h}=f;return h&&(h=h.trim(),l.href=h),h&&!this.options.isLinkSafeFn(h)&&(l.rel=this.options.addNofollowToLinks?"nofollow noopener":"noopener",l.title=this.localization.phishingWarning,l.target=this.options.addTargetBlankToLinks?"_blank":"_self"),h&&this.options.addExternalCssClassToMatchingLinksFn(h)?l.class=this.options.cssClassForExternalLinks?this.options.cssClassForExternalLinks:"":l.class=this.options.cssClassForInternalLinks?this.options.cssClassForInternalLinks:"",{tagName:d,attribs:l}}}}}validate(d){(0,r.default)(d,"TagsSanitizerOptions",r.default.object),(0,r.default)(d.iframeWidth,"TagsSanitizerOptions.iframeWidth",r.default.number.integer.positive),(0,r.default)(d.iframeHeight,"TagsSanitizerOptions.iframeHeight",r.default.number.integer.positive),(0,r.default)(d.addNofollowToLinks,"TagsSanitizerOptions.addNofollowToLinks",r.default.boolean),(0,r.default)(d.addTargetBlankToLinks,"TagsSanitizerOptions.addTargetBlankToLinks",r.default.optional.boolean),(0,r.default)(d.cssClassForInternalLinks,"TagsSanitizerOptions.cssClassForInternalLinks",r.default.optional.string),(0,r.default)(d.cssClassForExternalLinks,"TagsSanitizerOptions.cssClassForExternalLinks",r.default.optional.string),(0,r.default)(d.noImage,"TagsSanitizerOptions.noImage",r.default.boolean),(0,r.default)(d.isLinkSafeFn,"TagsSanitizerOptions.isLinkSafeFn",r.default.function),(0,r.default)(d.addExternalCssClassToMatchingLinksFn,"TagsSanitizerOptions.addExternalCssClassToMatchingLinksFn",r.default.function)}};return ha.TagTransformingSanitizer=o,ha}var Mc;function Rc(){if(Mc)return sa;Mc=1;var t=sa&&sa.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(sa,"__esModule",{value:!0}),sa.DefaultRenderer=void 0;const r=t(ws()),s=Hh,n=rm(),a=_m(),i=No(),o=km(),c=Xm();let d=class{constructor(l,h=i.Localization.DEFAULT){this.validate(l),this.options=l,i.Localization.validate(h),this.tagTransformingSanitizer=new c.TagTransformingSanitizer({iframeWidth:this.options.assetsWidth,iframeHeight:this.options.assetsHeight,addNofollowToLinks:this.options.addNofollowToLinks,addTargetBlankToLinks:this.options.addTargetBlankToLinks,cssClassForInternalLinks:this.options.cssClassForInternalLinks,cssClassForExternalLinks:this.options.cssClassForExternalLinks,noImage:this.options.doNotShowImages,isLinkSafeFn:this.options.isLinkSafeFn,addExternalCssClassToMatchingLinksFn:this.options.addExternalCssClassToMatchingLinksFn},h),this.domParser=new a.HtmlDOMParser({width:this.options.assetsWidth,height:this.options.assetsHeight,ipfsPrefix:this.options.ipfsPrefix,baseUrl:this.options.baseUrl,imageProxyFn:this.options.imageProxyFn,hashtagUrlFn:this.options.hashtagUrlFn,usertagUrlFn:this.options.usertagUrlFn,hideImages:this.options.doNotShowImages},h)}render(l){return(0,r.default)(l,"input",r.default.string.nonEmpty),this.doRender(l)}doRender(l){return l=o.PreliminarySanitizer.preliminarySanitize(l),l=this.isHtml(l)?l:this.renderMarkdown(l),l=this.wrapRenderedTextWithHtmlIfNeeded(l),l=this.domParser.parse(l).getParsedDocumentAsString(),l=this.sanitize(l),n.SecurityChecker.checkSecurity(l,{allowScriptTag:this.options.allowInsecureScriptTags}),l=this.domParser.embedder.insertAssets(l),l}renderMarkdown(l){return new s.Remarkable({html:!0,breaks:this.options.breaks,typographer:!1,quotes:"“”‘’"}).render(l)}wrapRenderedTextWithHtmlIfNeeded(l){return l.indexOf("<html>")!==0&&(l="<html>"+l+"</html>"),l}isHtml(l){let h=!1;const u=l.match(/^<html>([\S\s]*)<\/html>$/);return u&&u.length===2?(h=!0,l=u[1]):h=/^<p>[\S\s]*<\/p>/.test(l),h}sanitize(l){return this.options.skipSanitization?l:this.tagTransformingSanitizer.sanitize(l)}validate(l){(0,r.default)(l,"RendererOptions",r.default.object),(0,r.default)(l.baseUrl,"RendererOptions.baseUrl",r.default.string.nonEmpty),(0,r.default)(l.breaks,"RendererOptions.breaks",r.default.boolean),(0,r.default)(l.skipSanitization,"RendererOptions.skipSanitization",r.default.boolean),(0,r.default)(l.addNofollowToLinks,"RendererOptions.addNofollowToLinks",r.default.boolean),(0,r.default)(l.addTargetBlankToLinks,"RendererOptions.addTargetBlankToLinks",r.default.optional.boolean),(0,r.default)(l.cssClassForInternalLinks,"RendererOptions.cssClassForInternalLinks",r.default.optional.string),(0,r.default)(l.cssClassForExternalLinks,"RendererOptions.cssClassForExternalLinks",r.default.optional.string),(0,r.default)(l.doNotShowImages,"RendererOptions.doNotShowImages",r.default.boolean),(0,r.default)(l.ipfsPrefix,"RendererOptions.ipfsPrefix",r.default.optional.string),(0,r.default)(l.assetsWidth,"RendererOptions.assetsWidth",r.default.number.integer.positive),(0,r.default)(l.assetsHeight,"RendererOptions.assetsHeight",r.default.number.integer.positive),(0,r.default)(l.imageProxyFn,"RendererOptions.imageProxyFn",r.default.function),(0,r.default)(l.hashtagUrlFn,"RendererOptions.hashtagUrlFn",r.default.function),(0,r.default)(l.usertagUrlFn,"RendererOptions.usertagUrlFn",r.default.function),(0,r.default)(l.isLinkSafeFn,"RendererOptions.isLinkSafeFn",r.default.function),(0,r.default)(l.addExternalCssClassToMatchingLinksFn,"RendererOptions.addExternalCssClassToMatchingLinksFn",r.default.function)}};return sa.DefaultRenderer=d,sa}var $c;function Zm(){return $c||($c=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.HiveContentRenderer=t.DefaultRenderer=void 0;const r=Rc();var s=Rc();Object.defineProperty(t,"DefaultRenderer",{enumerable:!0,get:function(){return s.DefaultRenderer}}),t.HiveContentRenderer={DefaultRenderer:r.DefaultRenderer},t.default=t.HiveContentRenderer})(qn)),qn}var Bn=Zm();function Vn({author:t,permlink:r,defaultValue:s=100,onUpvote:n,onCancel:a}){const[i,o]=k.useState(s),[c,d]=k.useState(!1),f=[1,...Array.from({length:10},(h,u)=>(u+1)*10)],l=async()=>{if(!(i===0||c)){d(!0);try{await n(i)}finally{d(!1)}}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm p-4",children:e.jsxs("div",{className:"bg-gray-900 rounded-2xl w-full max-w-md p-5 sm:p-6 shadow-xl flex flex-col",children:[e.jsxs("h2",{className:"text-center text-base sm:text-lg font-semibold text-white mb-6",children:["Vote for @",t]}),e.jsxs("div",{className:"relative w-full flex flex-col items-center mb-8",children:[e.jsxs("div",{className:"absolute -top-8 left-0",style:{left:`${i}%`,transform:"translateX(-50%)"},children:[e.jsxs("div",{className:"bg-blue-600 text-white text-xs sm:text-sm px-2 py-1 rounded-lg shadow",children:[i,"%"]}),e.jsx("div",{className:"mx-auto w-2 h-2 bg-blue-600 rotate-45 -mt-1"})]}),e.jsx("input",{type:"range",min:1,max:100,value:i,onChange:h=>o(Number(h.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer accent-blue-600 [&::-webkit-slider-runnable-track]:rounded-lg [&::-webkit-slider-runnable-track]:h-2 [&::-moz-range-track]:rounded-lg [&::-moz-range-track]:h-2 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-blue-600 [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-white [&::-webkit-slider-thumb]:shadow-md [&::-webkit-slider-thumb]:-mt-1.5 [&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:bg-blue-600 [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-white [&::-moz-range-progress]:bg-blue-600 [&::-moz-range-progress]:rounded-lg",style:{background:`linear-gradient(to right, #2563eb ${i}%, #374151 ${i}%)`}}),e.jsx("div",{className:"flex justify-between w-full mt-3 ml-2 text-[10px] sm:text-xs text-gray-400",children:f.map(h=>e.jsx("button",{type:"button",onClick:()=>o(h),className:`focus:outline-none px-1 rounded transition
1066
+ `)});const _=g.nonTextTags||["script","style","textarea","option"];let E,A;g.allowedAttributes&&(E={},A={},d(g.allowedAttributes,function(K,le){E[le]=[];const oe=[];K.forEach(function(Ne){typeof Ne=="string"&&Ne.indexOf("*")>=0?oe.push(r(Ne).replace(/\\\*/g,".*")):E[le].push(Ne)}),oe.length&&(A[le]=new RegExp("^("+oe.join("|")+")$"))}));const C={},T={},D={};d(g.allowedClasses,function(K,le){if(E&&(f(E,le)||(E[le]=[]),E[le].push("class")),C[le]=K,Array.isArray(K)){const oe=[];C[le]=[],D[le]=[],K.forEach(function(Ne){typeof Ne=="string"&&Ne.indexOf("*")>=0?oe.push(r(Ne).replace(/\\\*/g,".*")):Ne instanceof RegExp?D[le].push(Ne):C[le].push(Ne)}),oe.length&&(T[le]=new RegExp("^("+oe.join("|")+")$"))}});const L={};let H;d(g.transformTags,function(K,le){let oe;typeof K=="function"?oe=K:typeof K=="string"&&(oe=b.simpleTransform(K)),le==="*"?H=oe:L[le]=oe});let V,z,F,Y,G,ne,ie=!1;U();const xe=new t.Parser({onopentag:function(K,le){if(g.enforceHtmlBoundary&&K==="html"&&U(),G){ne++;return}const oe=new y(K,le);z.push(oe);let Ne=!1;const Ce=!!oe.text;let Me;if(f(L,K)&&(Me=L[K](K,le),oe.attribs=le=Me.attribs,Me.text!==void 0&&(oe.innerText=Me.text),K!==Me.tagName&&(oe.name=K=Me.tagName,Y[V]=Me.tagName)),H&&(Me=H(K,le),oe.attribs=le=Me.attribs,K!==Me.tagName&&(oe.name=K=Me.tagName,Y[V]=Me.tagName)),(!m(K)||g.disallowedTagsMode==="recursiveEscape"&&!h(F)||g.nestingLimit!=null&&V>=g.nestingLimit)&&(Ne=!0,F[V]=!0,(g.disallowedTagsMode==="discard"||g.disallowedTagsMode==="completelyDiscard")&&_.indexOf(K)!==-1&&(G=!0,ne=1),F[V]=!0),V++,Ne){if(g.disallowedTagsMode==="discard"||g.disallowedTagsMode==="completelyDiscard")return;j=N,N=""}N+="<"+K,K==="script"&&(g.allowedScriptHostnames||g.allowedScriptDomains)&&(oe.innerText=""),(!E||f(E,K)||E["*"])&&d(le,function(Fe,ue){if(!p.test(ue)){delete oe.attribs[ue];return}if(Fe===""&&!g.allowedEmptyAttributes.includes(ue)&&(g.nonBooleanAttributes.includes(ue)||g.nonBooleanAttributes.includes("*"))){delete oe.attribs[ue];return}let Re=!1;if(!E||f(E,K)&&E[K].indexOf(ue)!==-1||E["*"]&&E["*"].indexOf(ue)!==-1||f(A,K)&&A[K].test(ue)||A["*"]&&A["*"].test(ue))Re=!0;else if(E&&E[K]){for(const ae of E[K])if(s(ae)&&ae.name&&ae.name===ue){Re=!0;let de="";if(ae.multiple===!0){const ve=Fe.split(" ");for(const fe of ve)ae.values.indexOf(fe)!==-1&&(de===""?de=fe:de+=" "+fe)}else ae.values.indexOf(Fe)>=0&&(de=Fe);Fe=de}}if(Re){if(g.allowedSchemesAppliedToAttributes.indexOf(ue)!==-1&&B(K,Fe)){delete oe.attribs[ue];return}if(K==="script"&&ue==="src"){let ae=!0;try{const de=pe(Fe);if(g.allowedScriptHostnames||g.allowedScriptDomains){const ve=(g.allowedScriptHostnames||[]).find(function(ke){return ke===de.url.hostname}),fe=(g.allowedScriptDomains||[]).find(function(ke){return de.url.hostname===ke||de.url.hostname.endsWith(`.${ke}`)});ae=ve||fe}}catch{ae=!1}if(!ae){delete oe.attribs[ue];return}}if(K==="iframe"&&ue==="src"){let ae=!0;try{const de=pe(Fe);if(de.isRelativeUrl)ae=f(g,"allowIframeRelativeUrls")?g.allowIframeRelativeUrls:!g.allowedIframeHostnames&&!g.allowedIframeDomains;else if(g.allowedIframeHostnames||g.allowedIframeDomains){const ve=(g.allowedIframeHostnames||[]).find(function(ke){return ke===de.url.hostname}),fe=(g.allowedIframeDomains||[]).find(function(ke){return de.url.hostname===ke||de.url.hostname.endsWith(`.${ke}`)});ae=ve||fe}}catch{ae=!1}if(!ae){delete oe.attribs[ue];return}}if(ue==="srcset")try{let ae=a(Fe);if(ae.forEach(function(de){B("srcset",de.url)&&(de.evil=!0)}),ae=l(ae,function(de){return!de.evil}),ae.length)Fe=u(l(ae,function(de){return!de.evil})),oe.attribs[ue]=Fe;else{delete oe.attribs[ue];return}}catch{delete oe.attribs[ue];return}if(ue==="class"){const ae=C[K],de=C["*"],ve=T[K],fe=D[K],ke=T["*"],Se=[ve,ke].concat(fe).filter(function(Be){return Be});if(ae&&de?Fe=Ie(Fe,n(ae,de),Se):Fe=Ie(Fe,ae||de,Se),!Fe.length){delete oe.attribs[ue];return}}if(ue==="style"){if(g.parseStyleAttributes)try{const ae=i(K+" {"+Fe+"}",{map:!1}),de=ee(ae,g.allowedStyles);if(Fe=te(de),Fe.length===0){delete oe.attribs[ue];return}}catch{typeof window<"u"&&console.warn('Failed to parse "'+K+" {"+Fe+`}", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547`),delete oe.attribs[ue];return}else if(g.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.")}N+=" "+ue,Fe&&Fe.length?N+='="'+q(Fe,!0)+'"':g.allowedEmptyAttributes.includes(ue)&&(N+='=""')}else delete oe.attribs[ue]}),g.selfClosing.indexOf(K)!==-1?N+=" />":(N+=">",oe.innerText&&!Ce&&!g.textFilter&&(N+=q(oe.innerText),ie=!0)),Ne&&(N=j+q(N),j="")},ontext:function(K){if(G)return;const le=z[z.length-1];let oe;if(le&&(oe=le.tag,K=le.innerText!==void 0?le.innerText:K),g.disallowedTagsMode==="completelyDiscard"&&!m(oe))K="";else if((g.disallowedTagsMode==="discard"||g.disallowedTagsMode==="completelyDiscard")&&(oe==="script"||oe==="style"))N+=K;else{const Ne=q(K,!1);g.textFilter&&!ie?N+=g.textFilter(Ne,oe):ie||(N+=Ne)}if(z.length){const Ne=z[z.length-1];Ne.text+=K}},onclosetag:function(K,le){if(G)if(ne--,!ne)G=!1;else return;const oe=z.pop();if(!oe)return;if(oe.tag!==K){z.push(oe);return}G=g.enforceHtmlBoundary?K==="html":!1,V--;const Ne=F[V];if(Ne){if(delete F[V],g.disallowedTagsMode==="discard"||g.disallowedTagsMode==="completelyDiscard"){oe.updateParentNodeText();return}j=N,N=""}if(Y[V]&&(K=Y[V],delete Y[V]),g.exclusiveFilter&&g.exclusiveFilter(oe)){N=N.substr(0,oe.tagPosition);return}if(oe.updateParentNodeMediaChildren(),oe.updateParentNodeText(),g.selfClosing.indexOf(K)!==-1||le&&!m(K)&&["escape","recursiveEscape"].indexOf(g.disallowedTagsMode)>=0){Ne&&(N=j,j="");return}N+="</"+K+">",Ne&&(N=j+q(N),j=""),ie=!1}},g.parser);return xe.write(x),xe.end(),N;function U(){N="",V=0,z=[],F={},Y={},G=!1,ne=0}function q(K,le){return typeof K!="string"&&(K=K+""),g.parser.decodeEntities&&(K=K.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),le&&(K=K.replace(/"/g,"&quot;"))),K=K.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),le&&(K=K.replace(/"/g,"&quot;")),K}function B(K,le){for(le=le.replace(/[\x00-\x20]+/g,"");;){const Ce=le.indexOf("<!--");if(Ce===-1)break;const Me=le.indexOf("-->",Ce+4);if(Me===-1)break;le=le.substring(0,Ce)+le.substring(Me+3)}const oe=le.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!oe)return le.match(/^[/\\]{2}/)?!g.allowProtocolRelative:!1;const Ne=oe[1].toLowerCase();return f(g.allowedSchemesByTag,K)?g.allowedSchemesByTag[K].indexOf(Ne)===-1:!g.allowedSchemes||g.allowedSchemes.indexOf(Ne)===-1}function pe(K){if(K=K.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//"),K.startsWith("relative:"))throw new Error("relative: exploit attempt");let le="relative://relative-site";for(let Ce=0;Ce<100;Ce++)le+=`/${Ce}`;const oe=new URL(K,le);return{isRelativeUrl:oe&&oe.hostname==="relative-site"&&oe.protocol==="relative:",url:oe}}function ee(K,le){if(!le)return K;const oe=K.nodes[0];let Ne;return le[oe.selector]&&le["*"]?Ne=n(le[oe.selector],le["*"]):Ne=le[oe.selector]||le["*"],Ne&&(K.nodes[0].nodes=oe.nodes.reduce(_e(Ne),[])),K}function te(K){return K.nodes[0].nodes.reduce(function(le,oe){return le.push(`${oe.prop}:${oe.value}${oe.important?" !important":""}`),le},[]).join(";")}function _e(K){return function(le,oe){return f(K,oe.prop)&&K[oe.prop].some(function(Ce){return Ce.test(oe.value)})&&le.push(oe),le}}function Ie(K,le,oe){return le?(K=K.split(/\s+/),K.filter(function(Ne){return le.indexOf(Ne)!==-1||oe.some(function(Ce){return Ce.test(Ne)})}).join(" ")):K}}const w={decodeEntities:!0};return b.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","main","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0},b.simpleTransform=function(x,g,v){return v=v===void 0?!0:v,g=g||{},function(N,j){let y;if(v)for(y in g)j[y]=g[y];else j=g;return{tagName:x,attribs:j}}},Hi}var Lc;function Xm(){if(Lc)return ha;Lc=1;var t=ha&&ha.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(ha,"__esModule",{value:!0}),ha.TagTransformingSanitizer=void 0;const r=t(ws()),s=t(Ym()),n=Jr(),a=No(),i=Ld();let o=class{constructor(d,f){this.sanitizationErrors=[],this.validate(d),a.Localization.validate(f),this.localization=f,this.options=d}sanitize(d){return(0,s.default)(d,this.generateSanitizeConfig())}getErrors(){return this.sanitizationErrors}generateSanitizeConfig(){return{allowedTags:i.StaticConfig.sanitization.allowedTags,allowedAttributes:{iframe:["src","width","height","frameborder","allowfullscreen","webkitallowfullscreen","mozallowfullscreen"],div:["class","title"],td:["style"],img:["src","alt"],a:["href","rel","title","class","target","id"]},allowedSchemes:["http","https","hive"],transformTags:{iframe:(d,f)=>{const l=f.src;for(const u of i.StaticConfig.sanitization.iframeWhitelist)if(u.re.test(l)){const p=typeof u.fn=="function"?u.fn(l):l;if(!p)break;return{tagName:"iframe",attribs:{src:p,width:this.options.iframeWidth+"",height:this.options.iframeHeight+"",frameborder:"0",allowfullscreen:"allowfullscreen",webkitallowfullscreen:"webkitallowfullscreen",mozallowfullscreen:"mozallowfullscreen"}}}return n.Log.log().warn('Blocked, did not match iframe "src" white list urls:',d,f),this.sanitizationErrors.push("Invalid iframe URL: "+l),{tagName:"div",text:`(Unsupported ${l})`,attribs:{}}},img:(d,f)=>{if(this.options.noImage)return{tagName:"div",text:this.localization.noImage,attribs:{}};const{src:l,alt:h}=f;if(!/^(https?:)?\/\//i.test(l))return n.Log.log().warn("Blocked, image tag src does not appear to be a url",d,f),this.sanitizationErrors.push("An image in this post did not save properly."),{tagName:"img",attribs:{src:"brokenimg.jpg"}};const u={};return u.src=l.replace(/^http:\/\//i,"//"),h&&h!==""&&(u.alt=h),{tagName:d,attribs:u}},div:(d,f)=>{const l={},u=["pull-right","pull-left","text-justify","text-rtl","text-center","text-right","videoWrapper","phishy"].find(b=>f.class===b);return u&&(l.class=u),u==="phishy"&&f.title===this.localization.phishingWarning&&(l.title=f.title),{tagName:d,attribs:l}},td:(d,f)=>{const l={};return f.style==="text-align:right"&&(l.style="text-align:right"),{tagName:d,attribs:l}},a:(d,f)=>{const l=Object.assign({},f);let{href:h}=f;return h&&(h=h.trim(),l.href=h),h&&!this.options.isLinkSafeFn(h)&&(l.rel=this.options.addNofollowToLinks?"nofollow noopener":"noopener",l.title=this.localization.phishingWarning,l.target=this.options.addTargetBlankToLinks?"_blank":"_self"),h&&this.options.addExternalCssClassToMatchingLinksFn(h)?l.class=this.options.cssClassForExternalLinks?this.options.cssClassForExternalLinks:"":l.class=this.options.cssClassForInternalLinks?this.options.cssClassForInternalLinks:"",{tagName:d,attribs:l}}}}}validate(d){(0,r.default)(d,"TagsSanitizerOptions",r.default.object),(0,r.default)(d.iframeWidth,"TagsSanitizerOptions.iframeWidth",r.default.number.integer.positive),(0,r.default)(d.iframeHeight,"TagsSanitizerOptions.iframeHeight",r.default.number.integer.positive),(0,r.default)(d.addNofollowToLinks,"TagsSanitizerOptions.addNofollowToLinks",r.default.boolean),(0,r.default)(d.addTargetBlankToLinks,"TagsSanitizerOptions.addTargetBlankToLinks",r.default.optional.boolean),(0,r.default)(d.cssClassForInternalLinks,"TagsSanitizerOptions.cssClassForInternalLinks",r.default.optional.string),(0,r.default)(d.cssClassForExternalLinks,"TagsSanitizerOptions.cssClassForExternalLinks",r.default.optional.string),(0,r.default)(d.noImage,"TagsSanitizerOptions.noImage",r.default.boolean),(0,r.default)(d.isLinkSafeFn,"TagsSanitizerOptions.isLinkSafeFn",r.default.function),(0,r.default)(d.addExternalCssClassToMatchingLinksFn,"TagsSanitizerOptions.addExternalCssClassToMatchingLinksFn",r.default.function)}};return ha.TagTransformingSanitizer=o,ha}var Mc;function Rc(){if(Mc)return sa;Mc=1;var t=sa&&sa.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(sa,"__esModule",{value:!0}),sa.DefaultRenderer=void 0;const r=t(ws()),s=Hh,n=rm(),a=_m(),i=No(),o=km(),c=Xm();let d=class{constructor(l,h=i.Localization.DEFAULT){this.validate(l),this.options=l,i.Localization.validate(h),this.tagTransformingSanitizer=new c.TagTransformingSanitizer({iframeWidth:this.options.assetsWidth,iframeHeight:this.options.assetsHeight,addNofollowToLinks:this.options.addNofollowToLinks,addTargetBlankToLinks:this.options.addTargetBlankToLinks,cssClassForInternalLinks:this.options.cssClassForInternalLinks,cssClassForExternalLinks:this.options.cssClassForExternalLinks,noImage:this.options.doNotShowImages,isLinkSafeFn:this.options.isLinkSafeFn,addExternalCssClassToMatchingLinksFn:this.options.addExternalCssClassToMatchingLinksFn},h),this.domParser=new a.HtmlDOMParser({width:this.options.assetsWidth,height:this.options.assetsHeight,ipfsPrefix:this.options.ipfsPrefix,baseUrl:this.options.baseUrl,imageProxyFn:this.options.imageProxyFn,hashtagUrlFn:this.options.hashtagUrlFn,usertagUrlFn:this.options.usertagUrlFn,hideImages:this.options.doNotShowImages},h)}render(l){return(0,r.default)(l,"input",r.default.string.nonEmpty),this.doRender(l)}doRender(l){return l=o.PreliminarySanitizer.preliminarySanitize(l),l=this.isHtml(l)?l:this.renderMarkdown(l),l=this.wrapRenderedTextWithHtmlIfNeeded(l),l=this.domParser.parse(l).getParsedDocumentAsString(),l=this.sanitize(l),n.SecurityChecker.checkSecurity(l,{allowScriptTag:this.options.allowInsecureScriptTags}),l=this.domParser.embedder.insertAssets(l),l}renderMarkdown(l){return new s.Remarkable({html:!0,breaks:this.options.breaks,typographer:!1,quotes:"“”‘’"}).render(l)}wrapRenderedTextWithHtmlIfNeeded(l){return l.indexOf("<html>")!==0&&(l="<html>"+l+"</html>"),l}isHtml(l){let h=!1;const u=l.match(/^<html>([\S\s]*)<\/html>$/);return u&&u.length===2?(h=!0,l=u[1]):h=/^<p>[\S\s]*<\/p>/.test(l),h}sanitize(l){return this.options.skipSanitization?l:this.tagTransformingSanitizer.sanitize(l)}validate(l){(0,r.default)(l,"RendererOptions",r.default.object),(0,r.default)(l.baseUrl,"RendererOptions.baseUrl",r.default.string.nonEmpty),(0,r.default)(l.breaks,"RendererOptions.breaks",r.default.boolean),(0,r.default)(l.skipSanitization,"RendererOptions.skipSanitization",r.default.boolean),(0,r.default)(l.addNofollowToLinks,"RendererOptions.addNofollowToLinks",r.default.boolean),(0,r.default)(l.addTargetBlankToLinks,"RendererOptions.addTargetBlankToLinks",r.default.optional.boolean),(0,r.default)(l.cssClassForInternalLinks,"RendererOptions.cssClassForInternalLinks",r.default.optional.string),(0,r.default)(l.cssClassForExternalLinks,"RendererOptions.cssClassForExternalLinks",r.default.optional.string),(0,r.default)(l.doNotShowImages,"RendererOptions.doNotShowImages",r.default.boolean),(0,r.default)(l.ipfsPrefix,"RendererOptions.ipfsPrefix",r.default.optional.string),(0,r.default)(l.assetsWidth,"RendererOptions.assetsWidth",r.default.number.integer.positive),(0,r.default)(l.assetsHeight,"RendererOptions.assetsHeight",r.default.number.integer.positive),(0,r.default)(l.imageProxyFn,"RendererOptions.imageProxyFn",r.default.function),(0,r.default)(l.hashtagUrlFn,"RendererOptions.hashtagUrlFn",r.default.function),(0,r.default)(l.usertagUrlFn,"RendererOptions.usertagUrlFn",r.default.function),(0,r.default)(l.isLinkSafeFn,"RendererOptions.isLinkSafeFn",r.default.function),(0,r.default)(l.addExternalCssClassToMatchingLinksFn,"RendererOptions.addExternalCssClassToMatchingLinksFn",r.default.function)}};return sa.DefaultRenderer=d,sa}var $c;function Zm(){return $c||($c=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.HiveContentRenderer=t.DefaultRenderer=void 0;const r=Rc();var s=Rc();Object.defineProperty(t,"DefaultRenderer",{enumerable:!0,get:function(){return s.DefaultRenderer}}),t.HiveContentRenderer={DefaultRenderer:r.DefaultRenderer},t.default=t.HiveContentRenderer})(qn)),qn}var Bn=Zm();function Vn({author:t,permlink:r,defaultValue:s=100,onUpvote:n,onCancel:a}){const[i,o]=k.useState(s),[c,d]=k.useState(!1),f=[1,...Array.from({length:10},(h,u)=>(u+1)*10)],l=async()=>{if(!(i===0||c)){d(!0);try{await n(i)}finally{d(!1)}}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm p-4",children:e.jsxs("div",{className:"bg-gray-900 rounded-2xl w-full max-w-md p-5 sm:p-6 shadow-xl flex flex-col",children:[e.jsxs("h2",{className:"text-center text-base sm:text-lg font-semibold text-white mb-6",children:["Vote for @",t]}),e.jsxs("div",{className:"relative w-full flex flex-col items-center mb-8",children:[e.jsxs("div",{className:"absolute -top-8 left-0",style:{left:`${i}%`,transform:"translateX(-50%)"},children:[e.jsxs("div",{className:"bg-blue-600 text-white text-xs sm:text-sm px-2 py-1 rounded-lg shadow",children:[i,"%"]}),e.jsx("div",{className:"mx-auto w-2 h-2 bg-blue-600 rotate-45 -mt-1"})]}),e.jsx("input",{type:"range",min:1,max:100,value:i,onChange:h=>o(Number(h.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer accent-blue-600 [&::-webkit-slider-runnable-track]:rounded-lg [&::-webkit-slider-runnable-track]:h-2 [&::-moz-range-track]:rounded-lg [&::-moz-range-track]:h-2 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-blue-600 [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-white [&::-webkit-slider-thumb]:shadow-md [&::-webkit-slider-thumb]:-mt-1.5 [&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:bg-blue-600 [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-white [&::-moz-range-progress]:bg-blue-600 [&::-moz-range-progress]:rounded-lg",style:{background:`linear-gradient(to right, #2563eb ${i}%, #374151 ${i}%)`}}),e.jsx("div",{className:"flex justify-between w-full mt-3 ml-2 text-[10px] sm:text-xs text-gray-400",children:f.map(h=>e.jsx("button",{type:"button",onClick:()=>o(h),className:`focus:outline-none px-1 rounded transition
1067
1067
  ${i===h?"text-blue-600 font-bold":"hover:text-blue-700 hover:bg-gray-700"}`,style:{background:"none",border:"none",cursor:"pointer"},children:h},h))})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:l,disabled:i===0||c,className:`flex-1 flex items-center justify-center rounded-full font-semibold transition
1068
1068
  text-sm sm:text-base px-3 py-2 sm:px-4 sm:py-3 shadow
1069
1069
  ${i===0||c?"bg-blue-300 text-white cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 text-white"}`,children:c?e.jsxs(e.Fragment,{children:[e.jsx(O.Loader2,{className:"w-4 h-4 sm:w-5 sm:h-5 mr-1 animate-spin"}),"Voting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(O.ThumbsUp,{className:"w-4 h-4 sm:w-5 sm:h-5 mr-1"}),"Vote"]})}),e.jsxs("button",{onClick:a,disabled:c,className:`flex-1 flex items-center justify-center rounded-full font-semibold text-sm sm:text-base px-3 py-2 sm:px-4 sm:py-3 shadow
1070
1070
  bg-gray-700 hover:bg-gray-600 text-white
1071
- disabled:opacity-50 disabled:cursor-not-allowed`,children:[e.jsx(O.X,{className:"w-4 h-4 sm:w-5 sm:h-5 mr-1"}),"Cancel"]})]})]})})}const To=({comment:t,allComments:r,onReply:s,currentUser:n,token:a,searchQuery:i,depth:o=0,onVotedRefresh:c,onClickCommentUpvote:d,onClickCommentReply:f,onClickUpvoteButton:l})=>{const[h,u]=k.useState(!1),[p,b]=k.useState(!0),[w,x]=k.useState(!1),g=k.useMemo(()=>{const ee=t.active_votes||[];if(!n)return!1;const te=n.toLowerCase();return ee.some(_e=>(_e.voter||"").toLowerCase()===te)},[t.active_votes,n]),[v,N]=k.useState(!1),[j,y]=k.useState(""),[m,_]=k.useState(!1),E=ee=>{y(ee),N(!0),setTimeout(()=>N(!1),2500)},A=t.depth||0;let T=r.filter(ee=>ee.parent_author===t.author&&ee.parent_permlink===t.permlink&&(typeof ee.depth!="number"||ee.depth===A+1));if((!T||T.length===0)&&Array.isArray(t.replies)&&t.replies.length>0){const ee=new Set(t.replies);T=r.filter(te=>ee.has(`${te.author}/${te.permlink}`))}const D=T.length>0,L=o>=4,H=(ee,te)=>{if(!te)return ee;const _e=new RegExp(`(${te})`,"gi");return ee.replace(_e,'<mark class="bg-yellow-800">$1</mark>')},V=()=>{x(!0)},z=async ee=>{if(d){try{await Promise.resolve(d(t.author,t.permlink,ee)),u(!0),x(!1),setTimeout(()=>{c?.(),E("Vote submitted successfully!")},3e3)}catch(te){const _e=te instanceof Error?te.message:"Failed to upvote";alert(_e)}return}if(!a){E("Please login or provide an upvote handler to vote");return}try{const te=Math.round(ee*100);await Nt.handleUpvote({author:t.author,permlink:t.permlink,weight:te,authToken:a}),u(!0),x(!1),_(!0),setTimeout(()=>{c?.(),_(!1),E("Vote submitted successfully ✅")},3e3)}catch(te){const _e=te instanceof Error?te.message:"Failed to upvote";alert(_e)}},F=()=>{n?s(t.author,t.permlink):E("Please login to upvote")},Y=t.json_metadata_parsed||(()=>{try{return t.json_metadata?JSON.parse(t.json_metadata):void 0}catch{return}})(),G=t.body||"",ie=(ee=>{const te=/^(\s*(?:#[\p{L}\p{N}_-]+\s*(?:,\s*)?)+\s*)$/gimu;return ee.replace(te,"").trim()})(G),xe=i?H(ie,i):ie,U=/!\[[^\]]*\]\([^)]+\)/.test(ie)||/<img\s/i.test(ie),q=Array.isArray(Y?.image)?Y.image:[],B=new Bn.DefaultRenderer({baseUrl:"https://hive.blog/",breaks:!0,skipSanitization:!1,allowInsecureScriptTags:!1,addNofollowToLinks:!0,doNotShowImages:!1,assetsWidth:640,assetsHeight:480,imageProxyFn:ee=>ee,usertagUrlFn:ee=>`/@${ee}`,hashtagUrlFn:ee=>`/trending/${ee}`,isLinkSafeFn:ee=>!0,addExternalCssClassToMatchingLinksFn:ee=>!0,ipfsPrefix:"https://ipfs.io/ipfs/"}),pe=t.stats?.total_votes||t.net_votes||0;return e.jsxs("div",{className:`${o>0?"ml-4 md:ml-8 border-l-2 border-gray-700 pl-4 md:pl-6":""}`,children:[e.jsx("div",{className:"group hover:bg-gray-800/50 transition-colors duration-200 p-4 md:p-6",children:e.jsxs("div",{className:"flex items-start space-x-3 md:space-x-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("img",{src:`https://images.hive.blog/u/${t.author}/avatar`,alt:t.author,className:"w-8 h-8 md:w-10 md:h-10 rounded-full object-cover ring-2 ring-gray-700",onError:ee=>{ee.target.src=`https://ui-avatars.com/api/?name=${t.author}&background=random`}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center flex-wrap gap-2 mb-2",children:[e.jsxs("button",{className:"font-semibold text-white hover:text-blue-400 transition-colors duration-200 text-sm md:text-base",onClick:()=>{},children:["@",t.author]}),e.jsxs("div",{className:"flex items-center text-xs md:text-sm text-gray-400 space-x-1",children:[e.jsx(O.Clock,{className:"w-3 h-3 md:w-4 md:h-4"}),e.jsx("span",{children:bs.formatDistanceToNow(new Date(t.created+"Z"),{addSuffix:!0})})]}),t.author===n&&e.jsx("span",{className:"px-2 py-1 text-xs bg-blue-900 text-blue-200 rounded-full",children:"You"})]}),e.jsx("div",{className:"prose prose-sm md:prose-base prose-invert max-w-none mb-3 comment-content text-left text-gray-100 prose-a:text-blue-400 [&>*]:text-left",children:i?e.jsx("div",{className:"text-left",dangerouslySetInnerHTML:{__html:xe}}):e.jsx("div",{className:"text-left",dangerouslySetInnerHTML:{__html:B.render(ie)}})}),!U&&q.length>0&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-3",children:q.map((ee,te)=>e.jsx("img",{src:ee,alt:`image-${te}`,className:"max-w-full h-auto rounded-lg shadow-sm cursor-pointer hover:shadow-md transition-shadow duration-200",onClick:()=>window.open(ee,"_blank")},ee+te))}),e.jsxs("div",{className:"flex items-center space-x-4 md:space-x-6",children:[e.jsxs("button",{onClick:()=>{if(d){if(!n){E("Please login to upvote");return}if(g||h){E("You have already upvoted this comment");return}V()}else if(l){if(!n){E("Please login to upvote");return}if(g||h){E("You have already upvoted this comment");return}V()}else{if(!n){E("Please login to upvote");return}a?g?E("You have already upvoted this comment"):V():(c?.(),E("Vote submitted successfully ✅"))}},className:`flex items-center space-x-1 md:space-x-2 text-xs md:text-sm font-medium transition-colors duration-200 ${h?"text-blue-400":"text-gray-400 hover:text-blue-400"}`,children:[e.jsx(O.ThumbsUp,{className:`w-4 h-4 ${g||h?"fill-current text-blue-400":""}`}),e.jsx("span",{children:pe})]}),e.jsxs("button",{onClick:()=>{f?f(t):F()},className:"flex items-center space-x-1 md:space-x-2 text-xs md:text-sm font-medium text-gray-400 hover:text-blue-400 transition-colors duration-200",children:[e.jsx(O.MessageSquare,{className:"w-4 h-4"}),e.jsx("span",{children:"Reply"})]}),D&&e.jsx("button",{onClick:()=>b(!p),className:"flex items-center space-x-1 md:space-x-2 text-xs md:text-sm font-medium text-gray-400 hover:text-blue-400 transition-colors duration-200",children:e.jsxs("span",{children:[p?"Hide":"Show"," ",T.length," ",T.length===1?"reply":"replies"]})}),e.jsx("button",{onClick:()=>f?.(t),className:"opacity-0 group-hover:opacity-100 p-1 rounded-full hover:bg-gray-700 transition-all duration-200",children:e.jsx(O.MoreHorizontal,{className:"w-4 h-4 text-gray-400"})})]}),w&&!g&&e.jsx("div",{className:"mt-3",children:e.jsx(Vn,{author:t.author,permlink:t.permlink,onUpvote:z,onCancel:()=>x(!1)})}),m&&e.jsxs("div",{className:"mt-3 inline-flex items-center text-xs text-gray-400",children:[e.jsx("span",{className:"w-4 h-4 border-2 border-blue-500 border-t-transparent rounded-full animate-spin mr-2"}),"Updating votes..."]}),v&&e.jsx("div",{className:"fixed bottom-4 right-4 w-[280px] z-50",children:e.jsx("div",{className:"bg-gray-800 text-white rounded px-3 py-2 shadow-lg text-sm",children:j})})]})]})}),D&&p&&!L&&e.jsx("div",{className:"space-y-0",children:T.map(ee=>e.jsx(To,{comment:ee,allComments:r,onReply:s,currentUser:n,searchQuery:i,depth:o+1,onVotedRefresh:c,onClickCommentUpvote:d,onClickCommentReply:f,onClickUpvoteButton:l},ee.permlink))}),D&&L&&e.jsx("div",{className:"ml-4 md:ml-8 p-3 text-sm text-gray-400 border-l-2 border-gray-700 pl-4",children:e.jsxs("button",{onClick:()=>{console.log("Show more replies for:",t.author,t.permlink)},className:"text-blue-400 hover:underline",children:["View ",T.length," more ",T.length===1?"reply":"replies"]})})]})},Xd=({onImageUploaded:t,ecencyToken:r,disabled:s=!1})=>{const n=k.useRef(null),[a,i]=k.useState(!1),[o,c]=k.useState(null),[d,f]=k.useState(null),l=p=>{const b=p.target.files?.[0];if(b){if(!b.type.startsWith("image/")){c("Please select an image file");return}if(b.size>10*1024*1024){c("File size must be less than 10MB");return}c(null),f(URL.createObjectURL(b)),h(b)}},h=async p=>{i(!0),c(null);try{if(!r)throw new Error("Upload token not provided. Please pass ecencyToken prop.");const b=new FormData;b.append("file",p);const w=await fetch("https://images.ecency.com/hs/"+r,{method:"POST",headers:{accept:"application/json, text/plain, */*",origin:"https://ecency.com",referer:"https://ecency.com/"},body:b});if(!w.ok)throw new Error(`Upload failed: ${w.statusText}`);const x=await w.json();if(x.url)t(x.url),f(null),n.current&&(n.current.value="");else throw new Error("No URL returned from upload")}catch(b){c(b instanceof Error?b.message:"Failed to upload image")}finally{i(!1)}},u=()=>{f(null),c(null),n.current&&(n.current.value="")};return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:n,type:"file",accept:"image/*",onChange:l,className:"hidden",disabled:s||a}),e.jsx("button",{type:"button",onClick:()=>!s&&!a&&n.current?.click(),disabled:s||a,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Upload Image",children:a?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Upload,{className:"h-4 w-4"})}),(d||o)&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-xl shadow-xl max-w-md w-full mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:o?"Upload Error":"Image Preview"}),e.jsx("button",{type:"button",onClick:u,className:"p-1 hover:bg-gray-800 rounded",children:e.jsx(O.X,{className:"h-5 w-5 text-gray-300"})})]}),e.jsx("div",{className:"p-4",children:o?e.jsx("div",{className:"text-red-400 text-sm",children:o}):d?e.jsxs("div",{className:"space-y-4",children:[e.jsx("img",{src:d,alt:"Preview",className:"w-full max-h-64 object-contain rounded"}),a&&e.jsxs("div",{className:"text-center",children:[e.jsx(O.Loader2,{className:"h-6 w-6 animate-spin mx-auto mb-2 text-blue-400"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Uploading image..."})]})]}):null})]})})]})},fo="https://audio.3speak.tv",Km="sk_demo_b0d3f4b972c5065b701394df3de2f44fd59aa3244c58c478",Qm=".mp3,.wav,.ogg,.m4a,.aac,.flac,.weba,.opus,audio/mpeg,audio/wav,audio/ogg,audio/aac,audio/flac,audio/webm,audio/opus",ep=50*1024*1024,Wi=300;function Ic(t){const r=Math.floor(t/60),s=t%60;return`${r}:${String(s).padStart(2,"0")}`}function tp(t){return new Promise(r=>{const s=URL.createObjectURL(t),n=new Audio;n.addEventListener("loadedmetadata",()=>{const a=n.duration;URL.revokeObjectURL(s),r(Number.isFinite(a)?Math.round(a):0)}),n.addEventListener("error",()=>{URL.revokeObjectURL(s),r(0)}),n.src=s})}const rp=/\.(mp3|wav|ogg|m4a|aac|flac|weba|opus)$/i;function ap(t){return rp.test(t)}function sp(t){return t.split(".").pop()?.toLowerCase()??"m4a"}function np(t){return`${fo}/play?a=${t}&mode=minimal&iframe=1`}function ip(){const t=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];for(const r of t)if(typeof MediaRecorder<"u"&&MediaRecorder.isTypeSupported(r))return r;return""}const Zd=({onAudioUploaded:t,username:r,threeSpeakApiKey:s,disabled:n=!1})=>{const a=s||Km,i=k.useRef(null),o=k.useRef(null),c=k.useRef([]),d=k.useRef(null),f=k.useRef(null),[l,h]=k.useState(null),[u,p]=k.useState(!1),[b,w]=k.useState(null),[x,g]=k.useState(!1),[v,N]=k.useState(0),[j,y]=k.useState(null),[m,_]=k.useState(null),[E,A]=k.useState(!1),[C,T]=k.useState(null),[D,L]=k.useState(null),[H,V]=k.useState(null);k.useEffect(()=>()=>{d.current&&clearInterval(d.current),m&&URL.revokeObjectURL(m),D&&URL.revokeObjectURL(D),f.current&&(f.current.pause(),f.current=null)},[]),k.useEffect(()=>{x&&v>=Wi&&Y()},[x,v]);const z=k.useCallback(()=>{d.current&&clearInterval(d.current),m&&URL.revokeObjectURL(m),D&&URL.revokeObjectURL(D),f.current&&(f.current.pause(),f.current=null),o.current&&o.current.state!=="inactive"&&o.current.stop(),o.current=null,c.current=[],h(null),p(!1),w(null),g(!1),N(0),y(null),_(null),A(!1),T(null),L(null),V(null),i.current&&(i.current.value="")},[m,D]),F=async()=>{w(null),y(null),m&&URL.revokeObjectURL(m),_(null),N(0);try{const ee=await navigator.mediaDevices.getUserMedia({audio:!0}),te=new MediaRecorder(ee,{mimeType:ip()});o.current=te,c.current=[],te.ondataavailable=_e=>{_e.data.size>0&&c.current.push(_e.data)},te.onstop=()=>{ee.getTracks().forEach(K=>K.stop());const _e=new Blob(c.current,{type:te.mimeType}),Ie=URL.createObjectURL(_e);y(_e),_(Ie),g(!1),d.current&&clearInterval(d.current)},te.start(100),g(!0),d.current=setInterval(()=>{N(_e=>_e+1)},1e3)}catch{w("Microphone access denied. Please allow microphone permission.")}},Y=()=>{o.current&&o.current.state!=="inactive"&&o.current.stop()},G=()=>{m&&URL.revokeObjectURL(m),f.current&&(f.current.pause(),f.current=null),y(null),_(null),N(0),A(!1),w(null)},ne=()=>{if(!m)return;if(E&&f.current){f.current.pause(),A(!1);return}const ee=new Audio(m);f.current=ee,ee.onended=()=>A(!1),ee.play(),A(!0)},ie=async()=>{if(!j)return;const ee=new File([j],`recording-${Date.now()}.webm`,{type:j.type});await B(ee,v)},xe=ee=>{const te=ee.target.files?.[0];if(te){if(te.type.startsWith("video/")){w("Video files are not allowed. Please select an audio file.");return}if(!te.type.startsWith("audio/")&&!ap(te.name)){w("Please select an audio file (MP3, WAV, OGG, M4A, etc.)");return}if(te.size>ep){w("File size must be less than 50MB");return}w(null),T(te),V(te.name),L(URL.createObjectURL(te)),h("gallery-preview")}},U=async()=>{if(!C)return;const ee=await tp(C);await B(C,ee)},q=()=>{D&&URL.revokeObjectURL(D),T(null),L(null),V(null),w(null),h("pick"),i.current&&(i.current.value="")},B=async(ee,te)=>{p(!0),w(null);try{if(!r)throw new Error("Please log in to upload audio.");const _e=ee instanceof File?sp(ee.name):"webm",Ie=new FormData;Ie.append("audio",ee),Ie.append("duration",String(te)),Ie.append("format",_e),Ie.append("title",`Audio by ${r}`);const K=await fetch(`${fo}/api/audio/upload`,{method:"POST",headers:{"X-API-Key":a,"X-User":r},body:Ie});if(!K.ok){const Ne=await K.json().catch(()=>null);throw new Error(Ne?.message??Ne?.error??`Upload failed: ${K.statusText}`)}const le=await K.json();if(le.error)throw new Error(le.error);let oe;if(le.permlink)oe=np(le.permlink);else if(le.playUrl)oe=le.playUrl;else if(le.cid)oe=`${fo}/play?cid=${le.cid}&mode=minimal&iframe=1`;else throw new Error("No audio URL returned from upload");t(oe,te),z()}catch(_e){w(_e instanceof Error?_e.message:"Failed to upload audio")}finally{p(!1)}},pe=v/Wi*100;return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:i,type:"file",accept:Qm,onChange:xe,className:"hidden",disabled:n||u}),e.jsx("button",{type:"button",onClick:()=>!n&&!u&&h("pick"),disabled:n||u,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Add Audio",children:u?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Music,{className:"h-4 w-4"})}),l&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm px-4",children:e.jsxs("div",{className:"w-full max-w-md rounded-xl border border-gray-700 bg-gray-900 shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[e.jsxs("h3",{className:"text-base font-semibold text-white",children:[l==="pick"&&"Add Audio",l==="record"&&"Record Audio",l==="gallery-preview"&&"Upload Audio"]}),e.jsx("button",{type:"button",onClick:z,disabled:u,className:"flex h-7 w-7 items-center justify-center rounded-full text-gray-400 hover:bg-gray-800 hover:text-white disabled:opacity-50",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4",children:[b&&e.jsx("div",{className:"mb-3 rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-400",children:b}),l==="pick"&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>{w(null),h("record")},className:"flex items-center gap-3 rounded-xl border border-gray-700 bg-gray-800 px-4 py-4 text-left transition-colors hover:border-blue-500/40 hover:bg-gray-800/80",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-blue-500/15",children:e.jsx(O.Mic,{className:"h-5 w-5 text-blue-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-white",children:"Record Audio"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Record up to 5 minutes from your microphone"})]})]}),e.jsxs("button",{type:"button",onClick:()=>{w(null),i.current?.click()},className:"flex items-center gap-3 rounded-xl border border-gray-700 bg-gray-800 px-4 py-4 text-left transition-colors hover:border-blue-500/40 hover:bg-gray-800/80",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-emerald-500/15",children:e.jsx(O.Upload,{className:"h-5 w-5 text-emerald-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-white",children:"Upload from Gallery"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Select an audio file (MP3, WAV, OGG, etc.)"})]})]}),e.jsx("p",{className:"text-center text-xs text-gray-500",children:"Max 50 MB per audio file"})]}),l==="record"&&e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:`text-3xl font-mono font-semibold tabular-nums ${x?"text-red-400":"text-white"}`,children:Ic(v)}),e.jsx("p",{className:"mt-1 text-xs text-gray-400",children:x?"Recording...":j?"Recording complete":"Tap to start recording"})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-gray-700 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-red-500 transition-all duration-1000",style:{width:`${Math.min(pe,100)}%`}})}),e.jsxs("p",{className:"text-xs text-gray-400",children:["Max ",Ic(Wi)]}),j?e.jsxs("div",{className:"flex flex-col items-center gap-4 w-full",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:ne,className:"flex h-12 w-12 items-center justify-center rounded-full bg-gray-800 border border-gray-700 text-white transition-colors hover:bg-gray-700",children:E?e.jsx(O.Pause,{className:"h-5 w-5"}):e.jsx(O.Play,{className:"h-5 w-5 ml-0.5"})}),e.jsx("button",{type:"button",onClick:G,disabled:u,className:"flex h-12 w-12 items-center justify-center rounded-full bg-gray-800 border border-gray-700 text-gray-400 transition-colors hover:bg-gray-700 hover:text-red-400 disabled:opacity-50",children:e.jsx(O.Trash2,{className:"h-5 w-5"})}),e.jsx("button",{type:"button",onClick:()=>{G(),F()},disabled:u,className:"flex h-12 w-12 items-center justify-center rounded-full bg-gray-800 border border-gray-700 text-gray-400 transition-colors hover:bg-gray-700 hover:text-white disabled:opacity-50",children:e.jsx(O.RotateCcw,{className:"h-5 w-5"})})]}),e.jsx("button",{type:"button",onClick:()=>{ie()},disabled:u,className:"w-full rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50",children:u?e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):"Upload Recording"})]}):e.jsx("div",{className:"flex items-center gap-4",children:e.jsx("button",{type:"button",onClick:x?Y:F,className:"flex h-16 w-16 items-center justify-center rounded-full bg-red-500 text-white shadow-lg transition-transform hover:scale-105 active:scale-95",children:x?e.jsx(O.Square,{className:"h-6 w-6 fill-current"}):e.jsx(O.Mic,{className:"h-6 w-6"})})}),!x&&!u&&e.jsx("button",{type:"button",onClick:()=>{G(),h("pick")},className:"text-xs text-gray-400 hover:text-white transition-colors",children:"Back to options"})]}),l==="gallery-preview"&&e.jsxs("div",{className:"flex flex-col gap-3",children:[H&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[e.jsx(O.Music,{className:"h-4 w-4 shrink-0 text-blue-400"}),e.jsx("span",{className:"truncate",children:H})]}),D&&e.jsx("audio",{src:D,controls:!0,className:"w-full rounded-lg",preload:"metadata"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:q,disabled:u,className:"flex-1 rounded-lg border border-gray-700 bg-gray-800 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-gray-700 disabled:opacity-50",children:"Remove"}),e.jsx("button",{type:"button",onClick:()=>{U()},disabled:u,className:"flex-1 rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50",children:u?e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):"Upload"})]}),!u&&e.jsx("button",{type:"button",onClick:q,className:"text-center text-xs text-gray-400 hover:text-white transition-colors",children:"Back to options"})]})]})]})})]})},op="https://embed.3speak.tv/uploads",lp="sk_demo_b0d3f4b972c5065b701394df3de2f44fd59aa3244c58c478",up=100*1024*1024,cp=5*1024*1024,dp="video/mp4,video/quicktime,video/webm,video/3gpp,.mp4,.mov,.webm,.3gp",Fc=90;function nn(t){return t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Gi(t){const r=Math.floor(t/60),s=t%60;return`${r}:${String(s).padStart(2,"0")}`}function fp(t){return new Promise((r,s)=>{const n=document.createElement("video"),a=URL.createObjectURL(t);n.preload="metadata",n.muted=!0,n.playsInline=!0,n.onloadeddata=()=>{n.currentTime=Math.min(.75,n.duration*.25)},n.onseeked=()=>{const i=document.createElement("canvas");i.width=n.videoWidth,i.height=n.videoHeight;const o=i.getContext("2d");if(!o){URL.revokeObjectURL(a),s(new Error("Cannot create canvas context"));return}o.drawImage(n,0,0,i.width,i.height),i.toBlob(c=>{if(URL.revokeObjectURL(a),!c){s(new Error("Failed to generate thumbnail"));return}r({blob:c,dataUrl:i.toDataURL("image/jpeg",.7)})},"image/jpeg",.7)},n.onerror=()=>{URL.revokeObjectURL(a),s(new Error("Failed to load video"))},n.src=a})}function hp(t){return new Promise(r=>{const s=document.createElement("video"),n=URL.createObjectURL(t);s.preload="metadata",s.onloadedmetadata=()=>{URL.revokeObjectURL(n),r({duration:Number.isFinite(s.duration)?Math.round(s.duration):0,width:s.videoWidth||0,height:s.videoHeight||0})},s.onerror=()=>{URL.revokeObjectURL(n),r({duration:0,width:0,height:0})},s.src=n})}async function mp(t,r){const s=new FormData;s.append("file",t,`video-thumbnail-${Date.now()}.jpg`);const n=await fetch(`https://images.ecency.com/hs/${r}`,{method:"POST",headers:{accept:"application/json, text/plain, */*",origin:"https://ecency.com",referer:"https://ecency.com/"},body:s});if(!n.ok)throw new Error(`Thumbnail upload failed: ${n.statusText}`);const a=await n.json();if(!a.url)throw new Error("No URL returned from thumbnail upload");return a.url}async function pp(t,r,s){await fetch(`https://embed.3speak.tv/video/${t}/thumbnail`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":s},body:JSON.stringify({thumbnail_url:r})}).catch(()=>{})}function gp(t){try{const r=new URL(t).searchParams.get("v");if(!r)return null;const s=r.split("/");return s[s.length-1]||null}catch{return null}}async function xp(t,r,s,n,a,i){const{Upload:o}=await import("tus-js-client");return new Promise((c,d)=>{let f=null;const l=new o(t,{endpoint:op,metadata:{filename:t.name,filetype:t.type||"video/mp4",frontend_app:"hive-react-kit",owner:r,short:"true",duration:String(s)},chunkSize:cp,retryDelays:[0,2e3,5e3,1e4],headers:{"X-API-Key":n},onProgress:(u,p)=>{p&&a({bytesUploaded:u,bytesTotal:p,percentage:Number((u/p*100).toFixed(1))})},onAfterResponse:(u,p)=>{const b=p.getHeader("X-Embed-URL");b&&(f=b)},onError:u=>d(i.aborted?new Error("Upload aborted"):u),onSuccess:()=>{if(!l.url||!f){d(new Error("3Speak upload completed without required URLs."));return}c({embedUrl:f,uploadUrl:l.url})}}),h=()=>{l.abort(!0).catch(()=>{}),d(new Error("Upload aborted"))};if(i.aborted){h();return}i.addEventListener("abort",h),l.findPreviousUploads().then(u=>{u.length>0&&l.resumeFromPreviousUpload(u[0]),l.start()}).catch(d)})}const Kd=({onVideoUploaded:t,username:r,ecencyToken:s,threeSpeakApiKey:n,disabled:a=!1})=>{const i=n||lp,o=k.useRef(null),c=k.useRef(null),[d,f]=k.useState(!1),[l,h]=k.useState(null),[u,p]=k.useState(null),[b,w]=k.useState(null),[x,g]=k.useState(0),[v,N]=k.useState("16/9"),[j,y]=k.useState(null),[m,_]=k.useState(!1),[E,A]=k.useState(null),[C,T]=k.useState(null);k.useEffect(()=>()=>{c.current&&c.current.abort(),j&&URL.revokeObjectURL(j)},[]);const D=k.useCallback(()=>{c.current&&(c.current.abort(),c.current=null),j&&URL.revokeObjectURL(j),f(!1),h(null),p(null),w(null),g(0),N("16/9"),y(null),_(!1),A(null),T(null),o.current&&(o.current.value="")},[j]),L=async F=>{const Y=F.target.files?.[0];if(Y){if(!Y.type.startsWith("video/")){T("Please select a video file (MP4, MOV, WebM, etc.)");return}if(Y.size>up){T(`Video file is too large (${nn(Y.size)}). Maximum is 100 MB.`);return}T(null),h(Y),y(URL.createObjectURL(Y));try{const G=await hp(Y);if(g(G.duration),N(G.width&&G.height?`${G.width}/${G.height}`:"9/16"),G.width&&G.height&&G.width>G.height){T(`Only portrait (vertical) videos are allowed. Your video is ${G.width}×${G.height} (landscape). Please record or crop in portrait mode.`);return}if(G.duration>Fc){T(`Video is too long (${Gi(G.duration)}). Maximum is ${Gi(Fc)}.`);return}const ne=await fp(Y);p(ne.dataUrl),w(ne.blob)}catch{console.warn("Failed to generate thumbnail")}}},H=async()=>{if(!l||!r){T(r?"No video selected.":"Please log in to upload videos.");return}_(!0),T(null),A({bytesUploaded:0,bytesTotal:l.size,percentage:0});const F=new AbortController;c.current=F;try{let Y=Promise.resolve(null);b&&s&&(Y=mp(b,s).catch(()=>null));const G=await xp(l,r,x,i,xe=>A(xe),F.signal),ne=await Y;if(ne&&G.embedUrl){const xe=gp(G.embedUrl);xe&&await pp(xe,ne,i)}const ie=l;t(G.embedUrl,G.uploadUrl,v,ie),D()}catch(Y){F.signal.aborted||T(Y instanceof Error?Y.message:"Failed to upload video.")}finally{_(!1),c.current=null}},V=()=>{c.current&&(c.current.abort(),c.current=null),_(!1),A(null)},z=()=>{j&&URL.revokeObjectURL(j),h(null),p(null),w(null),g(0),y(null),T(null),A(null),o.current&&(o.current.value="")};return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:o,type:"file",accept:dp,onChange:L,className:"hidden",disabled:a||m}),e.jsx("button",{type:"button",onClick:()=>{!a&&!m&&(T(null),f(!0),o.current?.click())},disabled:a||m,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Upload Video",children:m?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Video,{className:"h-4 w-4"})}),d&&l&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm px-4",children:e.jsxs("div",{className:"w-full max-w-lg rounded-xl border border-gray-700 bg-gray-900 shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[e.jsx("h3",{className:"text-base font-semibold text-white",children:"Upload Video"}),e.jsx("button",{type:"button",onClick:D,disabled:m,className:"flex h-7 w-7 items-center justify-center rounded-full text-gray-400 hover:bg-gray-800 hover:text-white disabled:opacity-50",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4",children:[C&&e.jsx("div",{className:"mb-3 rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-400",children:C}),e.jsxs("div",{className:"flex gap-3 mb-4",children:[e.jsxs("div",{className:"relative h-20 w-20 shrink-0 overflow-hidden rounded-lg bg-gray-800 border border-gray-700",children:[u?e.jsx("img",{src:u,alt:"Thumbnail",className:"h-full w-full object-cover"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center",children:e.jsx(O.Video,{className:"h-8 w-8 text-gray-500"})}),!m&&!C&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30",children:e.jsx(O.Play,{className:"h-5 w-5 text-white ml-0.5"})})]}),e.jsxs("div",{className:"flex flex-col justify-center min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-white truncate",children:l.name}),e.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:[nn(l.size),x>0&&` · ${Gi(x)}`]})]})]}),j&&!m&&e.jsx("div",{className:"mb-4 overflow-hidden rounded-lg bg-black",style:{maxHeight:"280px"},children:e.jsx("video",{src:j,controls:!0,playsInline:!0,preload:"metadata",className:"w-full",style:{maxHeight:"280px"}})}),m&&E&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs text-gray-400",children:"Uploading..."}),e.jsxs("span",{className:"text-xs font-medium text-white",children:[E.percentage.toFixed(0),"%"]})]}),e.jsx("div",{className:"h-2 w-full rounded-full bg-gray-700 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-blue-500 transition-all duration-300",style:{width:`${E.percentage}%`}})}),e.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:[nn(E.bytesUploaded)," / ",nn(E.bytesTotal)]})]}),e.jsx("div",{className:"flex gap-2",children:m?e.jsx("button",{type:"button",onClick:V,className:"flex-1 rounded-lg border border-gray-700 bg-gray-800 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-gray-700",children:"Cancel"}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:z,className:"flex items-center justify-center gap-1.5 flex-1 rounded-lg border border-gray-700 bg-gray-800 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-gray-700",children:[e.jsx(O.Trash2,{className:"h-3.5 w-3.5"}),"Remove"]}),e.jsx("button",{type:"button",onClick:()=>{H()},disabled:!!C,className:"flex-1 rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50",children:"Upload Video"})]})})]})]})})]})},Qd=({isOpen:t,onClose:r,onSelectGif:s,giphyApiKey:n})=>{const[a,i]=k.useState(""),[o,c]=k.useState([]),[d,f]=k.useState(!1),[l,h]=k.useState(null),u=k.useRef(null),p=k.useRef(null);k.useEffect(()=>{t&&setTimeout(()=>u.current?.focus(),100)},[t]);const b=async g=>{if(!g.trim())return;p.current?.abort();const v=new AbortController;p.current=v,f(!0),h(null);try{if(!n)throw new Error("GIPHY API key not provided. Pass giphyApiKey prop.");const N=await fetch(`https://api.giphy.com/v1/gifs/search?api_key=${n}&q=${encodeURIComponent(g)}&limit=20&rating=g`,{signal:v.signal});if(!N.ok)throw new Error(`Failed to fetch GIFs: ${N.statusText}`);const j=await N.json();c(j.data||[])}catch(N){if(v.signal.aborted)return;h(N instanceof Error?N.message:"Failed to search GIFs")}finally{v.signal.aborted||f(!1)}},w=g=>{g.preventDefault(),b(a)},x=g=>{const v=g.images.original?.url||g.images.downsized?.url||g.images.fixed_height?.url;v&&(s(v),r())};return t?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:r,children:e.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-xl shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] flex flex-col",onClick:g=>g.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Choose a GIF"}),e.jsx("button",{type:"button",onClick:r,className:"p-1 hover:bg-gray-800 rounded transition-colors text-gray-400",children:e.jsx(O.X,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"p-4",children:[e.jsx("form",{onSubmit:w,className:"mb-4",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:u,type:"text",value:a,onChange:g=>i(g.target.value),placeholder:"Search for GIFs...",className:"flex-1 px-3 py-2 border border-gray-700 bg-gray-800 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-white placeholder-gray-400"}),e.jsxs("button",{type:"submit",disabled:d||!a.trim(),className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 flex items-center gap-2",children:[e.jsx(O.Search,{className:"h-4 w-4"}),"Search"]})]})}),l&&e.jsx("div",{className:"text-red-400 text-sm mb-4",children:l}),d&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-blue-500 border-t-transparent mx-auto"}),e.jsx("p",{className:"mt-2 text-gray-400",children:"Searching for GIFs..."})]}),o.length>0&&e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 max-h-96 overflow-y-auto",children:o.map(g=>e.jsxs("button",{type:"button",onClick:()=>x(g),className:"relative group rounded-lg overflow-hidden hover:ring-2 hover:ring-blue-500 transition-all",children:[e.jsx("img",{src:g.images.fixed_height?.url||g.images.downsized?.url||g.images.original?.url,alt:g.title,className:"w-full h-32 object-cover",loading:"lazy"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("div",{className:"bg-black/90 rounded-full p-2",children:e.jsx(O.Image,{className:"h-4 w-4 text-blue-400"})})})]},g.id))}),!d&&o.length===0&&a&&e.jsxs("div",{className:"text-center py-8 text-gray-400",children:['No GIFs found for "',a,'"']})]})]})}):null},ho={Smileys:["😀","😃","😄","😁","😆","😅","🤣","😂","🙂","🙃","😉","😊","😇","🥰","😍","🤩","😘","😗","😚","😙","🥲","😋","😛","😜","🤪","😝","🤑","🤗","🤭","🤫","🤔","🫡","🤐","🤨","😐","😑","😶","🫥","😏","😒","🙄","😬","🤥","😌","😔","😪","🤤","😴","😷","🤒","🤕","🤢","🤮","🥵","🥶","🥴","😵","🤯","🤠","🥳","🥸","😎","🤓","🧐","😕","🫤","😟","🙁","☹️","😮","😯","😲","😳","🥺","🥹","😦","😧","😨","😰","😥","😢","😭","😱","😖","😣","😞","😓","😩","😫","🥱","😤","😡","😠","🤬","😈","👿"],Gestures:["👋","🤚","🖐️","✋","🖖","🫱","🫲","🫳","🫴","👌","🤌","🤏","✌️","🤞","🫰","🤟","🤘","🤙","👈","👉","👆","🖕","👇","☝️","🫵","👍","👎","✊","👊","🤛","🤜","👏","🙌","🫶","👐","🤲","🤝","🙏","✍️","💅","🤳","💪","🦾","🦿","🦵","🦶","👂","🦻"],People:["👶","🧒","👦","👧","🧑","👱","👨","🧔","👩","🧓","👴","👵","🙍","🙎","🙅","🙆","💁","🙋","🧏","🙇","🤦","🤷","👮","🕵️","💂","🥷","👷","🫅","🤴","👸","👳","👲","🧕","🤵","👰","🤰","🫃","🤱","👼","🎅","🤶","🦸","🦹","🧙","🧚","🧛","🧜","🧝"],Animals:["🐶","🐱","🐭","🐹","🐰","🦊","🐻","🐼","🐻‍❄️","🐨","🐯","🦁","🐮","🐷","🐸","🐵","🙈","🙉","🙊","🐒","🐔","🐧","🐦","🐤","🐣","🐥","🦆","🦅","🦉","🦇","🐺","🐗","🐴","🦄","🐝","🪱","🐛","🦋","🐌","🐞","🐜","🪰","🪲","🪳","🦟","🦗","🕷️","🐢","🐍","🦎","🦖","🦕","🐙","🦑","🦐","🦞","🦀","🐡","🐠","🐟","🐬","🐳","🐋","🦈"],Food:["🍏","🍎","🍐","🍊","🍋","🍌","🍉","🍇","🍓","🫐","🍈","🍒","🍑","🥭","🍍","🥥","🥝","🍅","🍆","🥑","🥦","🥬","🥒","🌶️","🫑","🌽","🥕","🫒","🧄","🧅","🥔","🍠","🥐","🥯","🍞","🥖","🥨","🧀","🥚","🍳","🧈","🥞","🧇","🥓","🥩","🍗","🍖","🌭","🍔","🍟","🍕","🫓","🥪","🥙","🧆","🌮","🌯","🫔","🥗","🥘","🫕","🥫","🍝","🍜","🍲","🍛","🍣","🍱","🥟","🦪","🍤","🍙","🍚","🍘","🍥","🥠","🥮","🍢","🍡","🍧","🍨","🍦","🥧","🧁","🍰","🎂","🍮","🍭","🍬","🍫","🍿","🍩","🍪","🌰","🥜","🍯"],Travel:["🚗","🚕","🚙","🚌","🚎","🏎️","🚓","🚑","🚒","🚐","🛻","🚚","🚛","🚜","🏍️","🛵","🚲","🛴","🛹","🛼","🚁","🛸","🚀","🛩️","✈️","🚢","⛵","🚤","🛥️","🛳️","⛴️","🚂","🏠","🏡","🏢","🏣","🏤","🏥","🏦","🏨","🏩","🏪","🏫","🏬","🏭","🏯","🏰","💒","🗼","🗽","⛪","🕌","🛕","🕍","⛩️","🕋","⛲","⛺","🌁","🌃","🏙️","🌄","🌅","🌆"],Objects:["⌚","📱","📲","💻","⌨️","🖥️","🖨️","🖱️","🖲️","🕹️","🗜️","💾","💿","📀","📼","📷","📸","📹","🎥","📽️","🎞️","📞","☎️","📟","📠","📺","📻","🎙️","🎚️","🎛️","🧭","⏱️","💡","🔦","🕯️","🪔","🧯","🛢️","💸","💵","💴","💶","💷","🪙","💰","💳","💎","⚖️","🪜","🧰","🪛","🔧","🔨","⚒️","🛠️","⛏️","🪚","🔩","⚙️","🪤","🧲","🔫","💣","🧨","🪓","🔪","🗡️","⚔️","🛡️","🚬","⚰️","🪦","⚱️","🏺","🔮","📿","🧿","🪬","💈","⚗️"],Symbols:["❤️","🧡","💛","💚","💙","💜","🖤","🤍","🤎","💔","❤️‍🔥","❤️‍🩹","❣️","💕","💞","💓","💗","💖","💘","💝","💟","☮️","✝️","☪️","🕉️","☸️","✡️","🔯","🕎","☯️","☦️","🛐","⛎","♈","♉","♊","♋","♌","♍","♎","♏","♐","♑","♒","♓","🆔","⚛️","🉑","☢️","☣️","📴","📳","🈶","🈚","🈸","🈺","🈷️","✴️","🆚","💮","🉐","㊙️","㊗️","🈴","🈵","🈹","🈲","🅰️","🅱️","🆎","🅾️","🆑","🆘","❌","⭕","🛑","⛔","📛","🚫","💯","💢","♨️","🚷","🚯","🚳","🚱","🔞","📵","🚭","❗","❕","❓","❔","‼️","⁉️","🔅","🔆","〽️","⚠️","🚸","🔱","⚜️","🔰","♻️","✅","🈯","💹","❇️","✳️","❎","🌐","💠","🔘","🔳","🔲","⬛","⬜","◼️","◻️","◾","◽","▪️","▫️","🔴","🟠","🟡","🟢","🔵","🟣","🟤","⚫","⚪"],Flags:["🏁","🚩","🎌","🏴","🏳️","🏳️‍🌈","🏳️‍⚧️","🏴‍☠️","🇦🇫","🇦🇱","🇩🇿","🇦🇸","🇦🇩","🇦🇴","🇦🇮","🇦🇬","🇦🇷","🇦🇲","🇦🇺","🇦🇹","🇧🇸","🇧🇭","🇧🇩","🇧🇧","🇧🇾","🇧🇪","🇧🇿","🇧🇯","🇧🇹","🇧🇴","🇧🇦","🇧🇼","🇧🇷","🇧🇳","🇧🇬","🇧🇫","🇧🇮","🇨🇦","🇨🇳","🇨🇴","🇨🇷","🇭🇷","🇨🇺","🇨🇿","🇩🇰","🇩🇴","🇪🇨","🇪🇬","🇸🇻","🇪🇹","🇫🇮","🇫🇷","🇩🇪","🇬🇭","🇬🇷","🇬🇹","🇭🇹","🇭🇳","🇭🇰","🇭🇺","🇮🇸","🇮🇳","🇮🇩","🇮🇷","🇮🇶","🇮🇪","🇮🇱","🇮🇹","🇯🇲","🇯🇵","🇯🇴","🇰🇿","🇰🇪","🇰🇼","🇱🇧","🇱🇾","🇱🇹","🇱🇺","🇲🇾","🇲🇽","🇲🇦","🇲🇿","🇳🇵","🇳🇱","🇳🇿","🇳🇬","🇳🇴","🇴🇲","🇵🇰","🇵🇦","🇵🇪","🇵🇭","🇵🇱","🇵🇹","🇶🇦","🇷🇴","🇷🇺","🇸🇦","🇷🇸","🇸🇬","🇸🇰","🇸🇮","🇿🇦","🇰🇷","🇪🇸","🇱🇰","🇸🇪","🇨🇭","🇹🇼","🇹🇭","🇹🇷","🇺🇦","🇦🇪","🇬🇧","🇺🇸","🇻🇪","🇻🇳"]},bp={Smileys:"😀",Gestures:"👋",People:"👤",Animals:"🐶",Food:"🍔",Travel:"✈️",Objects:"💡",Symbols:"❤️",Flags:"🏁"},Ji=Object.keys(ho),e0=({isOpen:t,onClose:r,onSelectEmoji:s})=>{const[n,a]=k.useState(""),[i,o]=k.useState(Ji[0]),c=k.useRef(null),d=k.useRef(null);if(k.useEffect(()=>{t&&(a(""),o(Ji[0]),setTimeout(()=>c.current?.focus(),100))},[t]),!t)return null;const f=Object.values(ho).flat(),l=n?f.filter(h=>h.includes(n)):null;return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("style",{children:".emoji-no-scrollbar::-webkit-scrollbar { display: none; }"}),e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:r,"aria-hidden":!0}),e.jsxs("div",{className:"relative bg-gray-900 border border-gray-700 rounded-xl shadow-xl w-full max-w-md h-[400px] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-gray-700",children:[e.jsx("h3",{className:"text-sm font-semibold text-white",children:"Emoji Picker"}),e.jsx("button",{type:"button",onClick:r,className:"p-1 hover:bg-gray-800 rounded text-gray-400",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"px-3 pt-3",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-gray-500"}),e.jsx("input",{ref:c,type:"text",value:n,onChange:h=>a(h.target.value),placeholder:"Search emoji...",className:"w-full pl-8 pr-3 py-1.5 text-sm bg-gray-800 border border-gray-700 rounded-lg text-white placeholder-gray-500 focus:outline-none focus:ring-1 focus:ring-blue-500"})]})}),!n&&e.jsx("div",{className:"emoji-no-scrollbar flex gap-1 px-3 pt-2 pb-1 overflow-x-auto",style:{scrollbarWidth:"none"},children:Ji.map(h=>e.jsx("button",{type:"button",onClick:()=>{o(h),d.current?.scrollTo({top:0,behavior:"smooth"})},className:`p-1.5 text-lg rounded-md transition-colors ${i===h?"bg-blue-600/20 ring-1 ring-blue-500":"hover:bg-gray-800"}`,title:h,children:bp[h]||h.charAt(0)},h))}),e.jsx("div",{ref:d,className:"emoji-no-scrollbar flex-1 overflow-y-auto p-3 min-h-0",style:{scrollbarWidth:"none"},children:n?l&&l.length>0?e.jsx("div",{className:"grid grid-cols-8 gap-1",children:l.map((h,u)=>e.jsx("button",{type:"button",onClick:()=>s(h),className:"p-1.5 hover:bg-gray-800 rounded text-xl transition-colors text-center",children:h},`${h}-${u}`))}):e.jsx("p",{className:"text-center text-gray-500 text-sm py-8",children:"No emoji found"}):e.jsx("div",{className:"grid grid-cols-8 gap-1",children:ho[i]?.map((h,u)=>e.jsx("button",{type:"button",onClick:()=>s(h),className:"p-1.5 hover:bg-gray-800 rounded text-xl transition-colors text-center",children:h},`${h}-${u}`))})})]})]})},t0=({isOpen:t,onClose:r,onSelectTemplate:s,templates:n,authorFromUrl:a})=>{const[i,o]=k.useState(""),c=k.useRef(null);k.useEffect(()=>{t&&(o(""),setTimeout(()=>c.current?.focus(),100))},[t]);const d=l=>{const h=a?l.replace(/\{\{author\}\}/g,a):l;s(h),r()},f=n.filter(l=>l.templateName.toLowerCase().includes(i.toLowerCase())||l.template.toLowerCase().includes(i.toLowerCase()));return t?e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:r,children:e.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-xl shadow-xl max-w-2xl w-full max-h-[80vh] flex flex-col",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Choose a Template"}),e.jsx("button",{onClick:r,className:"p-1.5 hover:bg-gray-800 rounded transition-colors",children:e.jsx(O.X,{className:"h-5 w-5 text-gray-400"})})]}),e.jsxs("div",{className:"p-4 flex-1 overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"relative mb-4",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx("input",{ref:c,type:"text",value:i,onChange:l=>o(l.target.value),placeholder:"Search templates...",className:"w-full pl-10 pr-3 py-2 border border-gray-700 bg-gray-800 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-white placeholder-gray-500 text-sm"})]}),f.length>0?e.jsx("div",{className:"space-y-2 overflow-y-auto flex-1",children:f.map(l=>e.jsx("button",{onClick:()=>d(l.template),className:"w-full text-left p-3 border border-gray-700 rounded-lg hover:bg-gray-800 hover:border-blue-500 transition-all group",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(O.FileText,{className:"h-4 w-4 text-gray-500 group-hover:text-blue-400 mt-0.5 shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-medium text-white text-sm group-hover:text-blue-400",children:l.templateName}),e.jsx("p",{className:"text-xs text-gray-400 mt-1 line-clamp-2",children:l.template})]})]})},l._id))}):e.jsx("div",{className:"text-center py-8 text-gray-400",children:i?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-white",children:["No templates found for “",i,"”"]}),e.jsx("p",{className:"text-xs mt-1 text-gray-500",children:"Try a different search term"})]}):e.jsxs(e.Fragment,{children:[e.jsx(O.FileText,{className:"h-12 w-12 text-gray-600 mx-auto mb-3"}),e.jsx("p",{className:"text-white",children:"No templates available"}),e.jsx("p",{className:"text-xs mt-1 text-gray-500",children:"Create templates via the API to use them here"})]})})]})]})}):null},on=2,Yi=10;function yp(){const t=new Date;return t.setDate(t.getDate()+7),t.toISOString().slice(0,16)}const r0=({isOpen:t,onClose:r,onSave:s,initialData:n})=>{const[a,i]=k.useState(n?.question??""),[o,c]=k.useState(n?.choices?.length?n.choices:["",""]),[d,f]=k.useState(n?.end_time?new Date(n.end_time*1e3).toISOString().slice(0,16):yp()),[l,h]=k.useState(n?.max_choices_voted??1),[u,p]=k.useState(n?.allow_vote_changes??!0),[b,w]=k.useState(n?.filters?.account_age??0),[x,g]=k.useState(n?.ui_hide_res_until_voted??!1);if(!t)return null;const v=()=>{o.length<Yi&&c([...o,""])},N=C=>{o.length>on&&c(o.filter((T,D)=>D!==C))},j=(C,T)=>{c(o.map((D,L)=>L===C?T:D))},y=o.filter(C=>C.trim()),m=a.trim().length>0&&y.length>=on&&new Date(d).getTime()>Date.now(),_=()=>{m&&(s({question:a.trim(),choices:y,end_time:Math.floor(new Date(d).getTime()/1e3),max_choices_voted:Math.min(l,y.length),allow_vote_changes:u,filters:{account_age:b},ui_hide_res_until_voted:x}),r())},E="w-full rounded-lg border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-white placeholder-gray-500 focus:border-blue-500 focus:outline-none",A="block text-xs font-medium text-gray-400 mb-1";return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:r,"aria-hidden":!0}),e.jsxs("div",{className:"relative bg-gray-900 border border-gray-700 rounded-xl shadow-xl w-full max-w-md max-h-[85vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[e.jsx("h3",{className:"text-sm font-semibold text-white",children:"Create Poll"}),e.jsx("button",{type:"button",onClick:r,className:"p-1.5 hover:bg-gray-800 rounded text-gray-400",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:A,children:"Question"}),e.jsx("input",{type:"text",value:a,onChange:C=>i(C.target.value),placeholder:"Ask a question...",className:E,maxLength:256})]}),e.jsxs("div",{children:[e.jsxs("label",{className:A,children:["Choices (min ",on,", max ",Yi,")"]}),e.jsx("div",{className:"space-y-2",children:o.map((C,T)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:C,onChange:D=>j(T,D.target.value),placeholder:`Option ${T+1}`,className:E,maxLength:128}),o.length>on&&e.jsx("button",{type:"button",onClick:()=>N(T),className:"shrink-0 rounded p-1.5 text-gray-400 hover:bg-gray-800 hover:text-red-400",title:"Remove option",children:e.jsx(O.X,{className:"h-3.5 w-3.5"})})]},T))}),o.length<Yi&&e.jsx("button",{type:"button",onClick:v,className:"mt-2 text-xs text-blue-400 hover:text-blue-300 font-medium",children:"+ Add option"})]}),e.jsxs("div",{children:[e.jsx("label",{className:A,children:"Poll ends at"}),e.jsx("input",{type:"datetime-local",value:d,onChange:C=>f(C.target.value),className:E,min:new Date().toISOString().slice(0,16)})]}),e.jsxs("div",{children:[e.jsxs("label",{className:A,children:["Max choices a voter can select (",l,")"]}),e.jsx("input",{type:"range",min:1,max:Math.max(y.length,1),value:l,onChange:C=>h(Number(C.target.value)),className:"w-full accent-blue-500"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:C=>p(C.target.checked),className:"accent-blue-500"}),e.jsx("span",{className:"text-xs text-gray-400",children:"Allow voters to change their vote"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:A,children:["Minimum account age to vote (days): ",b]}),e.jsx("input",{type:"number",min:0,max:365,value:b,onChange:C=>w(Math.max(0,Number(C.target.value))),className:E})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:x,onChange:C=>g(C.target.checked),className:"accent-blue-500"}),e.jsx("span",{className:"text-xs text-gray-400",children:"Hide results until user has voted"})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-gray-700",children:[e.jsx("button",{type:"button",onClick:r,className:"rounded-lg px-4 py-2 text-sm text-gray-400 hover:bg-gray-800",children:"Cancel"}),e.jsx("button",{type:"button",onClick:_,disabled:!m,className:"rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white disabled:opacity-50 hover:bg-blue-700",children:"Attach Poll"})]})]})]})},ln="https://hreplier-api.sagarkothari88.one/data/templates",un=t=>({Authorization:t,"Content-Type":"application/json"}),a0={async getTemplates(t,r){const n=await fetch(r||ln,{method:"GET",headers:un(t)});if(!n.ok)throw(await n.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to fetch templates: ${n.status} ${n.statusText}`);return(await n.json()).map(i=>({_id:i._id,name:i.name,templateName:i.templateName,template:i.template}))},async createTemplate(t,r,s,n){const i=await fetch(n||ln,{method:"POST",headers:un(t),body:JSON.stringify({templateName:r,template:s})});if(!i.ok)throw(await i.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to create template: ${i.status}`);const o=await i.json();return{_id:o._id,name:o.name,templateName:o.templateName,template:o.template}},async updateTemplate(t,r,s,n,a){const o=await fetch(a||ln,{method:"PUT",headers:un(t),body:JSON.stringify({id:r,templateName:s,template:n})});if(!o.ok)throw(await o.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to update template: ${o.status}`);const c=await o.json();return{_id:c._id,name:c.name,templateName:c.templateName,template:c.template}},async deleteTemplate(t,r,s){const a=await fetch(`${s||ln}/${r}`,{method:"DELETE",headers:un(t)});if(!a.ok)throw(await a.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to delete template: ${a.status}`)}};var Xi,Bc;function Vc(){if(Bc)return Xi;Bc=1;const{entries:t,setPrototypeOf:r,isFrozen:s,getPrototypeOf:n,getOwnPropertyDescriptor:a}=Object;let{freeze:i,seal:o,create:c}=Object,{apply:d,construct:f}=typeof Reflect<"u"&&Reflect;i||(i=function(fe){return fe}),o||(o=function(fe){return fe}),d||(d=function(fe,ke){for(var Se=arguments.length,Be=new Array(Se>2?Se-2:0),Ge=2;Ge<Se;Ge++)Be[Ge-2]=arguments[Ge];return fe.apply(ke,Be)}),f||(f=function(fe){for(var ke=arguments.length,Se=new Array(ke>1?ke-1:0),Be=1;Be<ke;Be++)Se[Be-1]=arguments[Be];return new fe(...Se)});const l=E(Array.prototype.forEach),h=E(Array.prototype.lastIndexOf),u=E(Array.prototype.pop),p=E(Array.prototype.push),b=E(Array.prototype.splice),w=E(String.prototype.toLowerCase),x=E(String.prototype.toString),g=E(String.prototype.match),v=E(String.prototype.replace),N=E(String.prototype.indexOf),j=E(String.prototype.trim),y=E(Object.prototype.hasOwnProperty),m=E(RegExp.prototype.test),_=A(TypeError);function E(ve){return function(fe){fe instanceof RegExp&&(fe.lastIndex=0);for(var ke=arguments.length,Se=new Array(ke>1?ke-1:0),Be=1;Be<ke;Be++)Se[Be-1]=arguments[Be];return d(ve,fe,Se)}}function A(ve){return function(){for(var fe=arguments.length,ke=new Array(fe),Se=0;Se<fe;Se++)ke[Se]=arguments[Se];return f(ve,ke)}}function C(ve,fe){let ke=arguments.length>2&&arguments[2]!==void 0?arguments[2]:w;r&&r(ve,null);let Se=fe.length;for(;Se--;){let Be=fe[Se];if(typeof Be=="string"){const Ge=ke(Be);Ge!==Be&&(s(fe)||(fe[Se]=Ge),Be=Ge)}ve[Be]=!0}return ve}function T(ve){for(let fe=0;fe<ve.length;fe++)y(ve,fe)||(ve[fe]=null);return ve}function D(ve){const fe=c(null);for(const[ke,Se]of t(ve))y(ve,ke)&&(Array.isArray(Se)?fe[ke]=T(Se):Se&&typeof Se=="object"&&Se.constructor===Object?fe[ke]=D(Se):fe[ke]=Se);return fe}function L(ve,fe){for(;ve!==null;){const Se=a(ve,fe);if(Se){if(Se.get)return E(Se.get);if(typeof Se.value=="function")return E(Se.value)}ve=n(ve)}function ke(){return null}return ke}const H=i(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),V=i(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),z=i(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),F=i(["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"]),Y=i(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),G=i(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ne=i(["#text"]),ie=i(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),xe=i(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),U=i(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),q=i(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),B=o(/\{\{[\w\W]*|[\w\W]*\}\}/gm),pe=o(/<%[\w\W]*|[\w\W]*%>/gm),ee=o(/\$\{[\w\W]*/gm),te=o(/^data-[\-\w.\u00B7-\uFFFF]+$/),_e=o(/^aria-[\-\w]+$/),Ie=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),K=o(/^(?:\w+script|data):/i),le=o(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),oe=o(/^html$/i),Ne=o(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ce=Object.freeze({__proto__:null,ARIA_ATTR:_e,ATTR_WHITESPACE:le,CUSTOM_ELEMENT:Ne,DATA_ATTR:te,DOCTYPE_NAME:oe,ERB_EXPR:pe,IS_ALLOWED_URI:Ie,IS_SCRIPT_OR_DATA:K,MUSTACHE_EXPR:B,TMPLIT_EXPR:ee});const Me={element:1,text:3,progressingInstruction:7,comment:8,document:9},Fe=function(){return typeof window>"u"?null:window},ue=function(fe,ke){if(typeof fe!="object"||typeof fe.createPolicy!="function")return null;let Se=null;const Be="data-tt-policy-suffix";ke&&ke.hasAttribute(Be)&&(Se=ke.getAttribute(Be));const Ge="dompurify"+(Se?"#"+Se:"");try{return fe.createPolicy(Ge,{createHTML(pt){return pt},createScriptURL(pt){return pt}})}catch{return console.warn("TrustedTypes policy "+Ge+" could not be created."),null}},Re=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function se(){let ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Fe();const fe=Z=>se(Z);if(fe.version="3.3.3",fe.removed=[],!ve||!ve.document||ve.document.nodeType!==Me.document||!ve.Element)return fe.isSupported=!1,fe;let{document:ke}=ve;const Se=ke,Be=Se.currentScript,{DocumentFragment:Ge,HTMLTemplateElement:pt,Node:jt,Element:gt,NodeFilter:St,NamedNodeMap:Ct=ve.NamedNodeMap||ve.MozNamedAttrMap,HTMLFormElement:Tt,DOMParser:Bt,trustedTypes:Ke}=ve,at=gt.prototype,_t=L(at,"cloneNode"),Vt=L(at,"remove"),kt=L(at,"nextSibling"),Ut=L(at,"childNodes"),S=L(at,"parentNode");if(typeof pt=="function"){const Z=ke.createElement("template");Z.content&&Z.content.ownerDocument&&(ke=Z.content.ownerDocument)}let P,I="";const{implementation:X,createNodeIterator:be,createDocumentFragment:Oe,getElementsByTagName:Xe}=ke,{importNode:Ve}=Se;let ze=Re();fe.isSupported=typeof t=="function"&&typeof S=="function"&&X&&X.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:bt,ERB_EXPR:Dt,TMPLIT_EXPR:Mt,DATA_ATTR:$t,ARIA_ATTR:Yt,IS_SCRIPT_OR_DATA:Et,ATTR_WHITESPACE:ft,CUSTOM_ELEMENT:ge}=Ce;let{IS_ALLOWED_URI:Te}=Ce,Pe=null;const He=C({},[...H,...V,...z,...Y,...ne]);let Ue=null;const xt=C({},[...ie,...xe,...U,...q]);let Je=Object.seal(c(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),cr=null,Or=null;const rr=Object.seal(c(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Lr=!0,zt=!0,Mr=!1,$e=!0,ar=!1,kr=!0,ut=!1,W=!1,Q=!1,we=!1,Ae=!1,ht=!1,Ye=!0,yt=!1;const Ot="user-content-";let Gt=!0,At=!1,mt={},Rt=null;const qt=C({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let It=null;const sr=C({},["audio","video","img","source","image","track"]);let xr=null;const br=C({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),lr="http://www.w3.org/1998/Math/MathML",ur="http://www.w3.org/2000/svg",nr="http://www.w3.org/1999/xhtml";let yr=nr,Ir=!1,st=null;const We=C({},[lr,ur,nr],x);let Xt=C({},["mi","mo","mn","ms","mtext"]),ir=C({},["annotation-xml"]);const Fr=C({},["title","style","font","a","script"]);let vt=null;const dr=["application/xhtml+xml","text/html"],vr="text/html";let $=null,re=null;const he=ke.createElement("form"),ae=function(M){return M instanceof RegExp||M instanceof Function},ye=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(re&&re===M)){if((!M||typeof M!="object")&&(M={}),M=D(M),vt=dr.indexOf(M.PARSER_MEDIA_TYPE)===-1?vr:M.PARSER_MEDIA_TYPE,$=vt==="application/xhtml+xml"?x:w,Pe=y(M,"ALLOWED_TAGS")?C({},M.ALLOWED_TAGS,$):He,Ue=y(M,"ALLOWED_ATTR")?C({},M.ALLOWED_ATTR,$):xt,st=y(M,"ALLOWED_NAMESPACES")?C({},M.ALLOWED_NAMESPACES,x):We,xr=y(M,"ADD_URI_SAFE_ATTR")?C(D(br),M.ADD_URI_SAFE_ATTR,$):br,It=y(M,"ADD_DATA_URI_TAGS")?C(D(sr),M.ADD_DATA_URI_TAGS,$):sr,Rt=y(M,"FORBID_CONTENTS")?C({},M.FORBID_CONTENTS,$):qt,cr=y(M,"FORBID_TAGS")?C({},M.FORBID_TAGS,$):D({}),Or=y(M,"FORBID_ATTR")?C({},M.FORBID_ATTR,$):D({}),mt=y(M,"USE_PROFILES")?M.USE_PROFILES:!1,Lr=M.ALLOW_ARIA_ATTR!==!1,zt=M.ALLOW_DATA_ATTR!==!1,Mr=M.ALLOW_UNKNOWN_PROTOCOLS||!1,$e=M.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ar=M.SAFE_FOR_TEMPLATES||!1,kr=M.SAFE_FOR_XML!==!1,ut=M.WHOLE_DOCUMENT||!1,we=M.RETURN_DOM||!1,Ae=M.RETURN_DOM_FRAGMENT||!1,ht=M.RETURN_TRUSTED_TYPE||!1,Q=M.FORCE_BODY||!1,Ye=M.SANITIZE_DOM!==!1,yt=M.SANITIZE_NAMED_PROPS||!1,Gt=M.KEEP_CONTENT!==!1,At=M.IN_PLACE||!1,Te=M.ALLOWED_URI_REGEXP||Ie,yr=M.NAMESPACE||nr,Xt=M.MATHML_TEXT_INTEGRATION_POINTS||Xt,ir=M.HTML_INTEGRATION_POINTS||ir,Je=M.CUSTOM_ELEMENT_HANDLING||{},M.CUSTOM_ELEMENT_HANDLING&&ae(M.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Je.tagNameCheck=M.CUSTOM_ELEMENT_HANDLING.tagNameCheck),M.CUSTOM_ELEMENT_HANDLING&&ae(M.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Je.attributeNameCheck=M.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),M.CUSTOM_ELEMENT_HANDLING&&typeof M.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Je.allowCustomizedBuiltInElements=M.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ar&&(zt=!1),Ae&&(we=!0),mt&&(Pe=C({},ne),Ue=c(null),mt.html===!0&&(C(Pe,H),C(Ue,ie)),mt.svg===!0&&(C(Pe,V),C(Ue,xe),C(Ue,q)),mt.svgFilters===!0&&(C(Pe,z),C(Ue,xe),C(Ue,q)),mt.mathMl===!0&&(C(Pe,Y),C(Ue,U),C(Ue,q))),y(M,"ADD_TAGS")||(rr.tagCheck=null),y(M,"ADD_ATTR")||(rr.attributeCheck=null),M.ADD_TAGS&&(typeof M.ADD_TAGS=="function"?rr.tagCheck=M.ADD_TAGS:(Pe===He&&(Pe=D(Pe)),C(Pe,M.ADD_TAGS,$))),M.ADD_ATTR&&(typeof M.ADD_ATTR=="function"?rr.attributeCheck=M.ADD_ATTR:(Ue===xt&&(Ue=D(Ue)),C(Ue,M.ADD_ATTR,$))),M.ADD_URI_SAFE_ATTR&&C(xr,M.ADD_URI_SAFE_ATTR,$),M.FORBID_CONTENTS&&(Rt===qt&&(Rt=D(Rt)),C(Rt,M.FORBID_CONTENTS,$)),M.ADD_FORBID_CONTENTS&&(Rt===qt&&(Rt=D(Rt)),C(Rt,M.ADD_FORBID_CONTENTS,$)),Gt&&(Pe["#text"]=!0),ut&&C(Pe,["html","head","body"]),Pe.table&&(C(Pe,["tbody"]),delete cr.tbody),M.TRUSTED_TYPES_POLICY){if(typeof M.TRUSTED_TYPES_POLICY.createHTML!="function")throw _('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof M.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw _('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');P=M.TRUSTED_TYPES_POLICY,I=P.createHTML("")}else P===void 0&&(P=ue(Ke,Be)),P!==null&&typeof I=="string"&&(I=P.createHTML(""));i&&i(M),re=M}},De=C({},[...V,...z,...F]),lt=C({},[...Y,...G]),Ze=function(M){let ce=S(M);(!ce||!ce.tagName)&&(ce={namespaceURI:yr,tagName:"template"});const me=w(M.tagName),qe=w(ce.tagName);return st[M.namespaceURI]?M.namespaceURI===ur?ce.namespaceURI===nr?me==="svg":ce.namespaceURI===lr?me==="svg"&&(qe==="annotation-xml"||Xt[qe]):!!De[me]:M.namespaceURI===lr?ce.namespaceURI===nr?me==="math":ce.namespaceURI===ur?me==="math"&&ir[qe]:!!lt[me]:M.namespaceURI===nr?ce.namespaceURI===ur&&!ir[qe]||ce.namespaceURI===lr&&!Xt[qe]?!1:!lt[me]&&(Fr[me]||!De[me]):!!(vt==="application/xhtml+xml"&&st[M.namespaceURI]):!1},Qe=function(M){p(fe.removed,{element:M});try{S(M).removeChild(M)}catch{Vt(M)}},ct=function(M,ce){try{p(fe.removed,{attribute:ce.getAttributeNode(M),from:ce})}catch{p(fe.removed,{attribute:null,from:ce})}if(ce.removeAttribute(M),M==="is")if(we||Ae)try{Qe(ce)}catch{}else try{ce.setAttribute(M,"")}catch{}},et=function(M){let ce=null,me=null;if(Q)M="<remove></remove>"+M;else{const it=g(M,/^[\r\n\t ]+/);me=it&&it[0]}vt==="application/xhtml+xml"&&yr===nr&&(M='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+M+"</body></html>");const qe=P?P.createHTML(M):M;if(yr===nr)try{ce=new Bt().parseFromString(qe,vt)}catch{}if(!ce||!ce.documentElement){ce=X.createDocument(yr,"template",null);try{ce.documentElement.innerHTML=Ir?I:qe}catch{}}const nt=ce.body||ce.documentElement;return M&&me&&nt.insertBefore(ke.createTextNode(me),nt.childNodes[0]||null),yr===nr?Xe.call(ce,ut?"html":"body")[0]:ut?ce.documentElement:nt},Pt=function(M){return be.call(M.ownerDocument||M,M,St.SHOW_ELEMENT|St.SHOW_COMMENT|St.SHOW_TEXT|St.SHOW_PROCESSING_INSTRUCTION|St.SHOW_CDATA_SECTION,null)},Zt=function(M){return M instanceof Tt&&(typeof M.nodeName!="string"||typeof M.textContent!="string"||typeof M.removeChild!="function"||!(M.attributes instanceof Ct)||typeof M.removeAttribute!="function"||typeof M.setAttribute!="function"||typeof M.namespaceURI!="string"||typeof M.insertBefore!="function"||typeof M.hasChildNodes!="function")},Lt=function(M){return typeof jt=="function"&&M instanceof jt};function dt(Z,M,ce){l(Z,me=>{me.call(fe,M,ce,re)})}const or=function(M){let ce=null;if(dt(ze.beforeSanitizeElements,M,null),Zt(M))return Qe(M),!0;const me=$(M.nodeName);if(dt(ze.uponSanitizeElement,M,{tagName:me,allowedTags:Pe}),kr&&M.hasChildNodes()&&!Lt(M.firstElementChild)&&m(/<[/\w!]/g,M.innerHTML)&&m(/<[/\w!]/g,M.textContent)||M.nodeType===Me.progressingInstruction||kr&&M.nodeType===Me.comment&&m(/<[/\w]/g,M.data))return Qe(M),!0;if(!(rr.tagCheck instanceof Function&&rr.tagCheck(me))&&(!Pe[me]||cr[me])){if(!cr[me]&&ra(me)&&(Je.tagNameCheck instanceof RegExp&&m(Je.tagNameCheck,me)||Je.tagNameCheck instanceof Function&&Je.tagNameCheck(me)))return!1;if(Gt&&!Rt[me]){const qe=S(M)||M.parentNode,nt=Ut(M)||M.childNodes;if(nt&&qe){const it=nt.length;for(let ot=it-1;ot>=0;--ot){const Ft=_t(nt[ot],!0);Ft.__removalCount=(M.__removalCount||0)+1,qe.insertBefore(Ft,kt(M))}}}return Qe(M),!0}return M instanceof gt&&!Ze(M)||(me==="noscript"||me==="noembed"||me==="noframes")&&m(/<\/no(script|embed|frames)/i,M.innerHTML)?(Qe(M),!0):(ar&&M.nodeType===Me.text&&(ce=M.textContent,l([bt,Dt,Mt],qe=>{ce=v(ce,qe," ")}),M.textContent!==ce&&(p(fe.removed,{element:M.cloneNode()}),M.textContent=ce)),dt(ze.afterSanitizeElements,M,null),!1)},Yr=function(M,ce,me){if(Or[ce]||Ye&&(ce==="id"||ce==="name")&&(me in ke||me in he))return!1;if(!(zt&&!Or[ce]&&m($t,ce))){if(!(Lr&&m(Yt,ce))){if(!(rr.attributeCheck instanceof Function&&rr.attributeCheck(ce,M))){if(!Ue[ce]||Or[ce]){if(!(ra(M)&&(Je.tagNameCheck instanceof RegExp&&m(Je.tagNameCheck,M)||Je.tagNameCheck instanceof Function&&Je.tagNameCheck(M))&&(Je.attributeNameCheck instanceof RegExp&&m(Je.attributeNameCheck,ce)||Je.attributeNameCheck instanceof Function&&Je.attributeNameCheck(ce,M))||ce==="is"&&Je.allowCustomizedBuiltInElements&&(Je.tagNameCheck instanceof RegExp&&m(Je.tagNameCheck,me)||Je.tagNameCheck instanceof Function&&Je.tagNameCheck(me))))return!1}else if(!xr[ce]){if(!m(Te,v(me,ft,""))){if(!((ce==="src"||ce==="xlink:href"||ce==="href")&&M!=="script"&&N(me,"data:")===0&&It[M])){if(!(Mr&&!m(Et,v(me,ft,"")))){if(me)return!1}}}}}}}return!0},ra=function(M){return M!=="annotation-xml"&&g(M,ge)},R=function(M){dt(ze.beforeSanitizeAttributes,M,null);const{attributes:ce}=M;if(!ce||Zt(M))return;const me={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ue,forceKeepAttr:void 0};let qe=ce.length;for(;qe--;){const nt=ce[qe],{name:it,namespaceURI:ot,value:Ft}=nt,Kt=$(it),Ht=Ft;let wt=it==="value"?Ht:j(Ht);if(me.attrName=Kt,me.attrValue=wt,me.keepAttr=!0,me.forceKeepAttr=void 0,dt(ze.uponSanitizeAttribute,M,me),wt=me.attrValue,yt&&(Kt==="id"||Kt==="name")&&(ct(it,M),wt=Ot+wt),kr&&m(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,wt)){ct(it,M);continue}if(Kt==="attributename"&&g(wt,"href")){ct(it,M);continue}if(me.forceKeepAttr)continue;if(!me.keepAttr){ct(it,M);continue}if(!$e&&m(/\/>/i,wt)){ct(it,M);continue}ar&&l([bt,Dt,Mt],Sr=>{wt=v(wt,Sr," ")});const fr=$(M.nodeName);if(!Yr(fr,Kt,wt)){ct(it,M);continue}if(P&&typeof Ke=="object"&&typeof Ke.getAttributeType=="function"&&!ot)switch(Ke.getAttributeType(fr,Kt)){case"TrustedHTML":{wt=P.createHTML(wt);break}case"TrustedScriptURL":{wt=P.createScriptURL(wt);break}}if(wt!==Ht)try{ot?M.setAttributeNS(ot,it,wt):M.setAttribute(it,wt),Zt(M)?Qe(M):u(fe.removed)}catch{ct(it,M)}}dt(ze.afterSanitizeAttributes,M,null)},J=function Z(M){let ce=null;const me=Pt(M);for(dt(ze.beforeSanitizeShadowDOM,M,null);ce=me.nextNode();)dt(ze.uponSanitizeShadowNode,ce,null),or(ce),R(ce),ce.content instanceof Ge&&Z(ce.content);dt(ze.afterSanitizeShadowDOM,M,null)};return fe.sanitize=function(Z){let M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ce=null,me=null,qe=null,nt=null;if(Ir=!Z,Ir&&(Z="<!-->"),typeof Z!="string"&&!Lt(Z))if(typeof Z.toString=="function"){if(Z=Z.toString(),typeof Z!="string")throw _("dirty is not a string, aborting")}else throw _("toString is not a function");if(!fe.isSupported)return Z;if(W||ye(M),fe.removed=[],typeof Z=="string"&&(At=!1),At){if(Z.nodeName){const Ft=$(Z.nodeName);if(!Pe[Ft]||cr[Ft])throw _("root node is forbidden and cannot be sanitized in-place")}}else if(Z instanceof jt)ce=et("<!---->"),me=ce.ownerDocument.importNode(Z,!0),me.nodeType===Me.element&&me.nodeName==="BODY"||me.nodeName==="HTML"?ce=me:ce.appendChild(me);else{if(!we&&!ar&&!ut&&Z.indexOf("<")===-1)return P&&ht?P.createHTML(Z):Z;if(ce=et(Z),!ce)return we?null:ht?I:""}ce&&Q&&Qe(ce.firstChild);const it=Pt(At?Z:ce);for(;qe=it.nextNode();)or(qe),R(qe),qe.content instanceof Ge&&J(qe.content);if(At)return Z;if(we){if(Ae)for(nt=Oe.call(ce.ownerDocument);ce.firstChild;)nt.appendChild(ce.firstChild);else nt=ce;return(Ue.shadowroot||Ue.shadowrootmode)&&(nt=Ve.call(Se,nt,!0)),nt}let ot=ut?ce.outerHTML:ce.innerHTML;return ut&&Pe["!doctype"]&&ce.ownerDocument&&ce.ownerDocument.doctype&&ce.ownerDocument.doctype.name&&m(oe,ce.ownerDocument.doctype.name)&&(ot="<!DOCTYPE "+ce.ownerDocument.doctype.name+`>
1072
- `+ot),ar&&l([bt,Dt,Mt],Ft=>{ot=v(ot,Ft," ")}),P&&ht?P.createHTML(ot):ot},fe.setConfig=function(){let Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ye(Z),W=!0},fe.clearConfig=function(){re=null,W=!1},fe.isValidAttribute=function(Z,M,ce){re||ye({});const me=$(Z),qe=$(M);return Yr(me,qe,ce)},fe.addHook=function(Z,M){typeof M=="function"&&p(ze[Z],M)},fe.removeHook=function(Z,M){if(M!==void 0){const ce=h(ze[Z],M);return ce===-1?void 0:b(ze[Z],ce,1)[0]}return u(ze[Z])},fe.removeHooks=function(Z){ze[Z]=[]},fe.removeAllHooks=function(){ze=Re()},fe}var de=se();return Xi=de,Xi}var Zi,Uc;function vp(){return Uc||(Uc=1,Zi=self.DOMPurify||(self.DOMPurify=Vc().default||Vc())),Zi}var wp=vp();const Np=O0(wp);var jp="https://ipfs.3speak.tv",_p=["https://ipfs.skatehive.app","https://cloudflare-ipfs.com","https://ipfs.io"],kp=["peakd.com","ecency.com","hive.blog","hiveblog.io","leofinance.io","3speak.tv","d.tube","esteem.app","busy.org"],Ep={ALLOWED_TAGS:["p","br","span","div","blockquote","pre","code","strong","em","b","i","u","ins","del","s","strike","mark","sub","sup","small","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","th","td","caption","col","colgroup","a","img","video","source","audio","iframe","hr","center","details","summary"],ALLOWED_ATTR:["href","src","alt","title","width","height","class","id","style","target","rel","controls","muted","preload","loading","autoplay","loop","type","allowfullscreen","frameborder","allow","scrolling","colspan","rowspan","align","valign","start","reversed","data-dnt","data-theme","allowtransparency"],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|ipfs):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1,FORBID_TAGS:["script","form","input","button","textarea","select","dialog","object","embed","applet","base","link","meta"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","onfocus","onblur","onchange","onsubmit","onkeydown","onkeyup","onkeypress"],KEEP_CONTENT:!0,RETURN_TRUSTED_TYPE:!1};function Ap(t){return t.replace(/<p><center>([\s\S]*?)<hr \/>([\s\S]*?)<\/center><\/p>/gi,(r,s,n)=>`<center>${s.trim()}</center><hr />${n.trim()}`)}function Sp(t){const r=new Set,s=new Set;return t=Ap(t),t=t.replace(/<a[^>]*href="(https?:\/\/3speak\.tv\/watch\?v=([^"&]+)[^"]*)"[^>]*>.*?<\/a>/g,(n,a,i)=>r.has(i)?n:(r.add(i),`<div class="video-container"><iframe src="${`https://play.3speak.tv/watch?v=${i}&mode=iframe`}" allowfullscreen loading="lazy"></iframe></div>`)),t=t.replace(/<a[^>]*href="(https?:\/\/play\.3speak\.tv\/watch\?v=([^"&]+)[^"]*)"[^>]*>.*?<\/a>/g,(n,a,i)=>r.has(i)?n:(r.add(i),`<div class="video-container"><iframe src="${`https://play.3speak.tv/watch?v=${i}&mode=iframe`}" allowfullscreen loading="lazy"></iframe></div>`)),t=t.replace(/<a[^>]*href="(https?:\/\/play\.3speak\.tv\/embed\?v=([^"&]+)[^"]*)"[^>]*>.*?<\/a>/g,(n,a,i)=>r.has(i)?n:(r.add(i),`<div class="video-container"><iframe src="${`https://play.3speak.tv/embed?v=${i}&mode=iframe`}" allowfullscreen loading="lazy"></iframe></div>`)),t=t.replace(/<a[^>]*href="(https?:\/\/audio\.3speak\.tv\/play\?a=([^"&]+)[^"]*)"[^>]*>.*?<\/a>/g,(n,a,i)=>s.has(i)?n:(s.add(i),`<div class="audio-container"><iframe src="${`https://audio.3speak.tv/play?a=${i}`}" loading="lazy"></iframe></div>`)),t}function Cp(t){const r=new Set,s=/<a[^>]*href="(https?:\/\/(?:twitter\.com|x\.com)\/([^/]+)\/status\/(\d+)[^"]*)"[^>]*>.*?<\/a>/gi;t=t.replace(s,(a,i,o,c)=>r.has(c)?a:(r.add(c),`<div class="twitter-embed-container" style="max-width: 550px;">
1071
+ disabled:opacity-50 disabled:cursor-not-allowed`,children:[e.jsx(O.X,{className:"w-4 h-4 sm:w-5 sm:h-5 mr-1"}),"Cancel"]})]})]})})}const To=({comment:t,allComments:r,onReply:s,currentUser:n,token:a,searchQuery:i,depth:o=0,onVotedRefresh:c,onClickCommentUpvote:d,onClickCommentReply:f,onClickUpvoteButton:l})=>{const[h,u]=k.useState(!1),[p,b]=k.useState(!0),[w,x]=k.useState(!1),g=k.useMemo(()=>{const ee=t.active_votes||[];if(!n)return!1;const te=n.toLowerCase();return ee.some(_e=>(_e.voter||"").toLowerCase()===te)},[t.active_votes,n]),[v,N]=k.useState(!1),[j,y]=k.useState(""),[m,_]=k.useState(!1),E=ee=>{y(ee),N(!0),setTimeout(()=>N(!1),2500)},A=t.depth||0;let T=r.filter(ee=>ee.parent_author===t.author&&ee.parent_permlink===t.permlink&&(typeof ee.depth!="number"||ee.depth===A+1));if((!T||T.length===0)&&Array.isArray(t.replies)&&t.replies.length>0){const ee=new Set(t.replies);T=r.filter(te=>ee.has(`${te.author}/${te.permlink}`))}const D=T.length>0,L=o>=4,H=(ee,te)=>{if(!te)return ee;const _e=new RegExp(`(${te})`,"gi");return ee.replace(_e,'<mark class="bg-yellow-800">$1</mark>')},V=()=>{x(!0)},z=async ee=>{if(d){try{await Promise.resolve(d(t.author,t.permlink,ee)),u(!0),x(!1),setTimeout(()=>{c?.(),E("Vote submitted successfully!")},3e3)}catch(te){const _e=te instanceof Error?te.message:"Failed to upvote";alert(_e)}return}if(!a){E("Please login or provide an upvote handler to vote");return}try{const te=Math.round(ee*100);await Nt.handleUpvote({author:t.author,permlink:t.permlink,weight:te,authToken:a}),u(!0),x(!1),_(!0),setTimeout(()=>{c?.(),_(!1),E("Vote submitted successfully ✅")},3e3)}catch(te){const _e=te instanceof Error?te.message:"Failed to upvote";alert(_e)}},F=()=>{n?s(t.author,t.permlink):E("Please login to upvote")},Y=t.json_metadata_parsed||(()=>{try{return t.json_metadata?JSON.parse(t.json_metadata):void 0}catch{return}})(),G=t.body||"",ie=(ee=>{const te=/^(\s*(?:#[\p{L}\p{N}_-]+\s*(?:,\s*)?)+\s*)$/gimu;return ee.replace(te,"").trim()})(G),xe=i?H(ie,i):ie,U=/!\[[^\]]*\]\([^)]+\)/.test(ie)||/<img\s/i.test(ie),q=Array.isArray(Y?.image)?Y.image:[],B=new Bn.DefaultRenderer({baseUrl:"https://hive.blog/",breaks:!0,skipSanitization:!1,allowInsecureScriptTags:!1,addNofollowToLinks:!0,doNotShowImages:!1,assetsWidth:640,assetsHeight:480,imageProxyFn:ee=>ee,usertagUrlFn:ee=>`/@${ee}`,hashtagUrlFn:ee=>`/trending/${ee}`,isLinkSafeFn:ee=>!0,addExternalCssClassToMatchingLinksFn:ee=>!0,ipfsPrefix:"https://ipfs.io/ipfs/"}),pe=t.stats?.total_votes||t.net_votes||0;return e.jsxs("div",{className:`${o>0?"ml-4 md:ml-8 border-l-2 border-gray-700 pl-4 md:pl-6":""}`,children:[e.jsx("div",{className:"group hover:bg-gray-800/50 transition-colors duration-200 p-4 md:p-6",children:e.jsxs("div",{className:"flex items-start space-x-3 md:space-x-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("img",{src:`https://images.hive.blog/u/${t.author}/avatar`,alt:t.author,className:"w-8 h-8 md:w-10 md:h-10 rounded-full object-cover ring-2 ring-gray-700",onError:ee=>{ee.target.src=`https://ui-avatars.com/api/?name=${t.author}&background=random`}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center flex-wrap gap-2 mb-2",children:[e.jsxs("button",{className:"font-semibold text-white hover:text-blue-400 transition-colors duration-200 text-sm md:text-base",onClick:()=>{},children:["@",t.author]}),e.jsxs("div",{className:"flex items-center text-xs md:text-sm text-gray-400 space-x-1",children:[e.jsx(O.Clock,{className:"w-3 h-3 md:w-4 md:h-4"}),e.jsx("span",{children:bs.formatDistanceToNow(new Date(t.created+"Z"),{addSuffix:!0})})]}),t.author===n&&e.jsx("span",{className:"px-2 py-1 text-xs bg-blue-900 text-blue-200 rounded-full",children:"You"})]}),e.jsx("div",{className:"prose prose-sm md:prose-base prose-invert max-w-none mb-3 comment-content text-left text-gray-100 prose-a:text-blue-400 [&>*]:text-left",children:i?e.jsx("div",{className:"text-left",dangerouslySetInnerHTML:{__html:xe}}):e.jsx("div",{className:"text-left",dangerouslySetInnerHTML:{__html:B.render(ie)}})}),!U&&q.length>0&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-3",children:q.map((ee,te)=>e.jsx("img",{src:ee,alt:`image-${te}`,className:"max-w-full h-auto rounded-lg shadow-sm cursor-pointer hover:shadow-md transition-shadow duration-200",onClick:()=>window.open(ee,"_blank")},ee+te))}),e.jsxs("div",{className:"flex items-center space-x-4 md:space-x-6",children:[e.jsxs("button",{onClick:()=>{if(d){if(!n){E("Please login to upvote");return}if(g||h){E("You have already upvoted this comment");return}V()}else if(l){if(!n){E("Please login to upvote");return}if(g||h){E("You have already upvoted this comment");return}V()}else{if(!n){E("Please login to upvote");return}a?g?E("You have already upvoted this comment"):V():(c?.(),E("Vote submitted successfully ✅"))}},className:`flex items-center space-x-1 md:space-x-2 text-xs md:text-sm font-medium transition-colors duration-200 ${h?"text-blue-400":"text-gray-400 hover:text-blue-400"}`,children:[e.jsx(O.ThumbsUp,{className:`w-4 h-4 ${g||h?"fill-current text-blue-400":""}`}),e.jsx("span",{children:pe})]}),e.jsxs("button",{onClick:()=>{f?f(t):F()},className:"flex items-center space-x-1 md:space-x-2 text-xs md:text-sm font-medium text-gray-400 hover:text-blue-400 transition-colors duration-200",children:[e.jsx(O.MessageSquare,{className:"w-4 h-4"}),e.jsx("span",{children:"Reply"})]}),D&&e.jsx("button",{onClick:()=>b(!p),className:"flex items-center space-x-1 md:space-x-2 text-xs md:text-sm font-medium text-gray-400 hover:text-blue-400 transition-colors duration-200",children:e.jsxs("span",{children:[p?"Hide":"Show"," ",T.length," ",T.length===1?"reply":"replies"]})}),e.jsx("button",{onClick:()=>f?.(t),className:"opacity-0 group-hover:opacity-100 p-1 rounded-full hover:bg-gray-700 transition-all duration-200",children:e.jsx(O.MoreHorizontal,{className:"w-4 h-4 text-gray-400"})})]}),w&&!g&&e.jsx("div",{className:"mt-3",children:e.jsx(Vn,{author:t.author,permlink:t.permlink,onUpvote:z,onCancel:()=>x(!1)})}),m&&e.jsxs("div",{className:"mt-3 inline-flex items-center text-xs text-gray-400",children:[e.jsx("span",{className:"w-4 h-4 border-2 border-blue-500 border-t-transparent rounded-full animate-spin mr-2"}),"Updating votes..."]}),v&&e.jsx("div",{className:"fixed bottom-4 right-4 w-[280px] z-50",children:e.jsx("div",{className:"bg-gray-800 text-white rounded px-3 py-2 shadow-lg text-sm",children:j})})]})]})}),D&&p&&!L&&e.jsx("div",{className:"space-y-0",children:T.map(ee=>e.jsx(To,{comment:ee,allComments:r,onReply:s,currentUser:n,searchQuery:i,depth:o+1,onVotedRefresh:c,onClickCommentUpvote:d,onClickCommentReply:f,onClickUpvoteButton:l},ee.permlink))}),D&&L&&e.jsx("div",{className:"ml-4 md:ml-8 p-3 text-sm text-gray-400 border-l-2 border-gray-700 pl-4",children:e.jsxs("button",{onClick:()=>{console.log("Show more replies for:",t.author,t.permlink)},className:"text-blue-400 hover:underline",children:["View ",T.length," more ",T.length===1?"reply":"replies"]})})]})},Xd=({onImageUploaded:t,ecencyToken:r,disabled:s=!1})=>{const n=k.useRef(null),[a,i]=k.useState(!1),[o,c]=k.useState(null),[d,f]=k.useState(null),l=p=>{const b=p.target.files?.[0];if(b){if(!b.type.startsWith("image/")){c("Please select an image file");return}if(b.size>10*1024*1024){c("File size must be less than 10MB");return}c(null),f(URL.createObjectURL(b)),h(b)}},h=async p=>{i(!0),c(null);try{if(!r)throw new Error("Upload token not provided. Please pass ecencyToken prop.");const b=new FormData;b.append("file",p);const w=await fetch("https://images.ecency.com/hs/"+r,{method:"POST",headers:{accept:"application/json, text/plain, */*",origin:"https://ecency.com",referer:"https://ecency.com/"},body:b});if(!w.ok)throw new Error(`Upload failed: ${w.statusText}`);const x=await w.json();if(x.url)t(x.url),f(null),n.current&&(n.current.value="");else throw new Error("No URL returned from upload")}catch(b){c(b instanceof Error?b.message:"Failed to upload image")}finally{i(!1)}},u=()=>{f(null),c(null),n.current&&(n.current.value="")};return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:n,type:"file",accept:"image/*",onChange:l,className:"hidden",disabled:s||a}),e.jsx("button",{type:"button",onClick:()=>!s&&!a&&n.current?.click(),disabled:s||a,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Upload Image",children:a?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Upload,{className:"h-4 w-4"})}),(d||o)&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-xl shadow-xl max-w-md w-full mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:o?"Upload Error":"Image Preview"}),e.jsx("button",{type:"button",onClick:u,className:"p-1 hover:bg-gray-800 rounded",children:e.jsx(O.X,{className:"h-5 w-5 text-gray-300"})})]}),e.jsx("div",{className:"p-4",children:o?e.jsx("div",{className:"text-red-400 text-sm",children:o}):d?e.jsxs("div",{className:"space-y-4",children:[e.jsx("img",{src:d,alt:"Preview",className:"w-full max-h-64 object-contain rounded"}),a&&e.jsxs("div",{className:"text-center",children:[e.jsx(O.Loader2,{className:"h-6 w-6 animate-spin mx-auto mb-2 text-blue-400"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Uploading image..."})]})]}):null})]})})]})},fo="https://audio.3speak.tv",Km="sk_demo_b0d3f4b972c5065b701394df3de2f44fd59aa3244c58c478",Qm=".mp3,.wav,.ogg,.m4a,.aac,.flac,.weba,.opus,audio/mpeg,audio/wav,audio/ogg,audio/aac,audio/flac,audio/webm,audio/opus",ep=50*1024*1024,Wi=300;function Ic(t){const r=Math.floor(t/60),s=t%60;return`${r}:${String(s).padStart(2,"0")}`}function tp(t){return new Promise(r=>{const s=URL.createObjectURL(t),n=new Audio;n.addEventListener("loadedmetadata",()=>{const a=n.duration;URL.revokeObjectURL(s),r(Number.isFinite(a)?Math.round(a):0)}),n.addEventListener("error",()=>{URL.revokeObjectURL(s),r(0)}),n.src=s})}const rp=/\.(mp3|wav|ogg|m4a|aac|flac|weba|opus)$/i;function ap(t){return rp.test(t)}function sp(t){return t.split(".").pop()?.toLowerCase()??"m4a"}function np(t){return`${fo}/play?a=${t}&mode=minimal&iframe=1`}function ip(){const t=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];for(const r of t)if(typeof MediaRecorder<"u"&&MediaRecorder.isTypeSupported(r))return r;return""}const Zd=({onAudioUploaded:t,username:r,threeSpeakApiKey:s,disabled:n=!1})=>{const a=s||Km,i=k.useRef(null),o=k.useRef(null),c=k.useRef([]),d=k.useRef(null),f=k.useRef(null),[l,h]=k.useState(null),[u,p]=k.useState(!1),[b,w]=k.useState(null),[x,g]=k.useState(!1),[v,N]=k.useState(0),[j,y]=k.useState(null),[m,_]=k.useState(null),[E,A]=k.useState(!1),[C,T]=k.useState(null),[D,L]=k.useState(null),[H,V]=k.useState(null);k.useEffect(()=>()=>{d.current&&clearInterval(d.current),m&&URL.revokeObjectURL(m),D&&URL.revokeObjectURL(D),f.current&&(f.current.pause(),f.current=null)},[]),k.useEffect(()=>{x&&v>=Wi&&Y()},[x,v]);const z=k.useCallback(()=>{d.current&&clearInterval(d.current),m&&URL.revokeObjectURL(m),D&&URL.revokeObjectURL(D),f.current&&(f.current.pause(),f.current=null),o.current&&o.current.state!=="inactive"&&o.current.stop(),o.current=null,c.current=[],h(null),p(!1),w(null),g(!1),N(0),y(null),_(null),A(!1),T(null),L(null),V(null),i.current&&(i.current.value="")},[m,D]),F=async()=>{w(null),y(null),m&&URL.revokeObjectURL(m),_(null),N(0);try{const ee=await navigator.mediaDevices.getUserMedia({audio:!0}),te=new MediaRecorder(ee,{mimeType:ip()});o.current=te,c.current=[],te.ondataavailable=_e=>{_e.data.size>0&&c.current.push(_e.data)},te.onstop=()=>{ee.getTracks().forEach(K=>K.stop());const _e=new Blob(c.current,{type:te.mimeType}),Ie=URL.createObjectURL(_e);y(_e),_(Ie),g(!1),d.current&&clearInterval(d.current)},te.start(100),g(!0),d.current=setInterval(()=>{N(_e=>_e+1)},1e3)}catch{w("Microphone access denied. Please allow microphone permission.")}},Y=()=>{o.current&&o.current.state!=="inactive"&&o.current.stop()},G=()=>{m&&URL.revokeObjectURL(m),f.current&&(f.current.pause(),f.current=null),y(null),_(null),N(0),A(!1),w(null)},ne=()=>{if(!m)return;if(E&&f.current){f.current.pause(),A(!1);return}const ee=new Audio(m);f.current=ee,ee.onended=()=>A(!1),ee.play(),A(!0)},ie=async()=>{if(!j)return;const ee=new File([j],`recording-${Date.now()}.webm`,{type:j.type});await B(ee,v)},xe=ee=>{const te=ee.target.files?.[0];if(te){if(te.type.startsWith("video/")){w("Video files are not allowed. Please select an audio file.");return}if(!te.type.startsWith("audio/")&&!ap(te.name)){w("Please select an audio file (MP3, WAV, OGG, M4A, etc.)");return}if(te.size>ep){w("File size must be less than 50MB");return}w(null),T(te),V(te.name),L(URL.createObjectURL(te)),h("gallery-preview")}},U=async()=>{if(!C)return;const ee=await tp(C);await B(C,ee)},q=()=>{D&&URL.revokeObjectURL(D),T(null),L(null),V(null),w(null),h("pick"),i.current&&(i.current.value="")},B=async(ee,te)=>{p(!0),w(null);try{if(!r)throw new Error("Please log in to upload audio.");const _e=ee instanceof File?sp(ee.name):"webm",Ie=new FormData;Ie.append("audio",ee),Ie.append("duration",String(te)),Ie.append("format",_e),Ie.append("title",`Audio by ${r}`);const K=await fetch(`${fo}/api/audio/upload`,{method:"POST",headers:{"X-API-Key":a,"X-User":r},body:Ie});if(!K.ok){const Ne=await K.json().catch(()=>null);throw new Error(Ne?.message??Ne?.error??`Upload failed: ${K.statusText}`)}const le=await K.json();if(le.error)throw new Error(le.error);let oe;if(le.permlink)oe=np(le.permlink);else if(le.playUrl)oe=le.playUrl;else if(le.cid)oe=`${fo}/play?cid=${le.cid}&mode=minimal&iframe=1`;else throw new Error("No audio URL returned from upload");t(oe,te),z()}catch(_e){w(_e instanceof Error?_e.message:"Failed to upload audio")}finally{p(!1)}},pe=v/Wi*100;return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:i,type:"file",accept:Qm,onChange:xe,className:"hidden",disabled:n||u}),e.jsx("button",{type:"button",onClick:()=>!n&&!u&&h("pick"),disabled:n||u,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Add Audio",children:u?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Music,{className:"h-4 w-4"})}),l&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm px-4",children:e.jsxs("div",{className:"w-full max-w-md rounded-xl border border-gray-700 bg-gray-900 shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[e.jsxs("h3",{className:"text-base font-semibold text-white",children:[l==="pick"&&"Add Audio",l==="record"&&"Record Audio",l==="gallery-preview"&&"Upload Audio"]}),e.jsx("button",{type:"button",onClick:z,disabled:u,className:"flex h-7 w-7 items-center justify-center rounded-full text-gray-400 hover:bg-gray-800 hover:text-white disabled:opacity-50",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4",children:[b&&e.jsx("div",{className:"mb-3 rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-400",children:b}),l==="pick"&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>{w(null),h("record")},className:"flex items-center gap-3 rounded-xl border border-gray-700 bg-gray-800 px-4 py-4 text-left transition-colors hover:border-blue-500/40 hover:bg-gray-800/80",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-blue-500/15",children:e.jsx(O.Mic,{className:"h-5 w-5 text-blue-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-white",children:"Record Audio"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Record up to 5 minutes from your microphone"})]})]}),e.jsxs("button",{type:"button",onClick:()=>{w(null),i.current?.click()},className:"flex items-center gap-3 rounded-xl border border-gray-700 bg-gray-800 px-4 py-4 text-left transition-colors hover:border-blue-500/40 hover:bg-gray-800/80",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-emerald-500/15",children:e.jsx(O.Upload,{className:"h-5 w-5 text-emerald-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-white",children:"Upload from Gallery"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Select an audio file (MP3, WAV, OGG, etc.)"})]})]}),e.jsx("p",{className:"text-center text-xs text-gray-500",children:"Max 50 MB per audio file"})]}),l==="record"&&e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:`text-3xl font-mono font-semibold tabular-nums ${x?"text-red-400":"text-white"}`,children:Ic(v)}),e.jsx("p",{className:"mt-1 text-xs text-gray-400",children:x?"Recording...":j?"Recording complete":"Tap to start recording"})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-gray-700 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-red-500 transition-all duration-1000",style:{width:`${Math.min(pe,100)}%`}})}),e.jsxs("p",{className:"text-xs text-gray-400",children:["Max ",Ic(Wi)]}),j?e.jsxs("div",{className:"flex flex-col items-center gap-4 w-full",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:ne,className:"flex h-12 w-12 items-center justify-center rounded-full bg-gray-800 border border-gray-700 text-white transition-colors hover:bg-gray-700",children:E?e.jsx(O.Pause,{className:"h-5 w-5"}):e.jsx(O.Play,{className:"h-5 w-5 ml-0.5"})}),e.jsx("button",{type:"button",onClick:G,disabled:u,className:"flex h-12 w-12 items-center justify-center rounded-full bg-gray-800 border border-gray-700 text-gray-400 transition-colors hover:bg-gray-700 hover:text-red-400 disabled:opacity-50",children:e.jsx(O.Trash2,{className:"h-5 w-5"})}),e.jsx("button",{type:"button",onClick:()=>{G(),F()},disabled:u,className:"flex h-12 w-12 items-center justify-center rounded-full bg-gray-800 border border-gray-700 text-gray-400 transition-colors hover:bg-gray-700 hover:text-white disabled:opacity-50",children:e.jsx(O.RotateCcw,{className:"h-5 w-5"})})]}),e.jsx("button",{type:"button",onClick:()=>{ie()},disabled:u,className:"w-full rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50",children:u?e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):"Upload Recording"})]}):e.jsx("div",{className:"flex items-center gap-4",children:e.jsx("button",{type:"button",onClick:x?Y:F,className:"flex h-16 w-16 items-center justify-center rounded-full bg-red-500 text-white shadow-lg transition-transform hover:scale-105 active:scale-95",children:x?e.jsx(O.Square,{className:"h-6 w-6 fill-current"}):e.jsx(O.Mic,{className:"h-6 w-6"})})}),!x&&!u&&e.jsx("button",{type:"button",onClick:()=>{G(),h("pick")},className:"text-xs text-gray-400 hover:text-white transition-colors",children:"Back to options"})]}),l==="gallery-preview"&&e.jsxs("div",{className:"flex flex-col gap-3",children:[H&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[e.jsx(O.Music,{className:"h-4 w-4 shrink-0 text-blue-400"}),e.jsx("span",{className:"truncate",children:H})]}),D&&e.jsx("audio",{src:D,controls:!0,className:"w-full rounded-lg",preload:"metadata"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:q,disabled:u,className:"flex-1 rounded-lg border border-gray-700 bg-gray-800 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-gray-700 disabled:opacity-50",children:"Remove"}),e.jsx("button",{type:"button",onClick:()=>{U()},disabled:u,className:"flex-1 rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50",children:u?e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):"Upload"})]}),!u&&e.jsx("button",{type:"button",onClick:q,className:"text-center text-xs text-gray-400 hover:text-white transition-colors",children:"Back to options"})]})]})]})})]})},op="https://embed.3speak.tv/uploads",lp="sk_demo_b0d3f4b972c5065b701394df3de2f44fd59aa3244c58c478",up=100*1024*1024,cp=5*1024*1024,dp="video/mp4,video/quicktime,video/webm,video/3gpp,.mp4,.mov,.webm,.3gp",Fc=90;function nn(t){return t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Gi(t){const r=Math.floor(t/60),s=t%60;return`${r}:${String(s).padStart(2,"0")}`}function fp(t){return new Promise((r,s)=>{const n=document.createElement("video"),a=URL.createObjectURL(t);n.preload="metadata",n.muted=!0,n.playsInline=!0,n.onloadeddata=()=>{n.currentTime=Math.min(.75,n.duration*.25)},n.onseeked=()=>{const i=document.createElement("canvas");i.width=n.videoWidth,i.height=n.videoHeight;const o=i.getContext("2d");if(!o){URL.revokeObjectURL(a),s(new Error("Cannot create canvas context"));return}o.drawImage(n,0,0,i.width,i.height),i.toBlob(c=>{if(URL.revokeObjectURL(a),!c){s(new Error("Failed to generate thumbnail"));return}r({blob:c,dataUrl:i.toDataURL("image/jpeg",.7)})},"image/jpeg",.7)},n.onerror=()=>{URL.revokeObjectURL(a),s(new Error("Failed to load video"))},n.src=a})}function hp(t){return new Promise(r=>{const s=document.createElement("video"),n=URL.createObjectURL(t);s.preload="metadata",s.onloadedmetadata=()=>{URL.revokeObjectURL(n),r({duration:Number.isFinite(s.duration)?Math.round(s.duration):0,width:s.videoWidth||0,height:s.videoHeight||0})},s.onerror=()=>{URL.revokeObjectURL(n),r({duration:0,width:0,height:0})},s.src=n})}async function mp(t,r){const s=new FormData;s.append("file",t,`video-thumbnail-${Date.now()}.jpg`);const n=await fetch(`https://images.ecency.com/hs/${r}`,{method:"POST",headers:{accept:"application/json, text/plain, */*",origin:"https://ecency.com",referer:"https://ecency.com/"},body:s});if(!n.ok)throw new Error(`Thumbnail upload failed: ${n.statusText}`);const a=await n.json();if(!a.url)throw new Error("No URL returned from thumbnail upload");return a.url}async function pp(t,r,s){await fetch(`https://embed.3speak.tv/video/${t}/thumbnail`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":s},body:JSON.stringify({thumbnail_url:r})}).catch(()=>{})}function gp(t){try{const r=new URL(t).searchParams.get("v");if(!r)return null;const s=r.split("/");return s[s.length-1]||null}catch{return null}}async function xp(t,r,s,n,a,i){const{Upload:o}=await import("tus-js-client");return new Promise((c,d)=>{let f=null;const l=new o(t,{endpoint:op,metadata:{filename:t.name,filetype:t.type||"video/mp4",frontend_app:"hive-react-kit",owner:r,short:"true",duration:String(s)},chunkSize:cp,retryDelays:[0,2e3,5e3,1e4],headers:{"X-API-Key":n},onProgress:(u,p)=>{p&&a({bytesUploaded:u,bytesTotal:p,percentage:Number((u/p*100).toFixed(1))})},onAfterResponse:(u,p)=>{const b=p.getHeader("X-Embed-URL");b&&(f=b)},onError:u=>d(i.aborted?new Error("Upload aborted"):u),onSuccess:()=>{if(!l.url||!f){d(new Error("3Speak upload completed without required URLs."));return}c({embedUrl:f,uploadUrl:l.url})}}),h=()=>{l.abort(!0).catch(()=>{}),d(new Error("Upload aborted"))};if(i.aborted){h();return}i.addEventListener("abort",h),l.findPreviousUploads().then(u=>{u.length>0&&l.resumeFromPreviousUpload(u[0]),l.start()}).catch(d)})}const Kd=({onVideoUploaded:t,username:r,ecencyToken:s,threeSpeakApiKey:n,disabled:a=!1})=>{const i=n||lp,o=k.useRef(null),c=k.useRef(null),[d,f]=k.useState(!1),[l,h]=k.useState(null),[u,p]=k.useState(null),[b,w]=k.useState(null),[x,g]=k.useState(0),[v,N]=k.useState("16/9"),[j,y]=k.useState(null),[m,_]=k.useState(!1),[E,A]=k.useState(null),[C,T]=k.useState(null);k.useEffect(()=>()=>{c.current&&c.current.abort(),j&&URL.revokeObjectURL(j)},[]);const D=k.useCallback(()=>{c.current&&(c.current.abort(),c.current=null),j&&URL.revokeObjectURL(j),f(!1),h(null),p(null),w(null),g(0),N("16/9"),y(null),_(!1),A(null),T(null),o.current&&(o.current.value="")},[j]),L=async F=>{const Y=F.target.files?.[0];if(Y){if(!Y.type.startsWith("video/")){T("Please select a video file (MP4, MOV, WebM, etc.)");return}if(Y.size>up){T(`Video file is too large (${nn(Y.size)}). Maximum is 100 MB.`);return}T(null),h(Y),y(URL.createObjectURL(Y));try{const G=await hp(Y);if(g(G.duration),N(G.width&&G.height?`${G.width}/${G.height}`:"9/16"),G.width&&G.height&&G.width>G.height){T(`Only portrait (vertical) videos are allowed. Your video is ${G.width}×${G.height} (landscape). Please record or crop in portrait mode.`);return}if(G.duration>Fc){T(`Video is too long (${Gi(G.duration)}). Maximum is ${Gi(Fc)}.`);return}const ne=await fp(Y);p(ne.dataUrl),w(ne.blob)}catch{console.warn("Failed to generate thumbnail")}}},H=async()=>{if(!l||!r){T(r?"No video selected.":"Please log in to upload videos.");return}_(!0),T(null),A({bytesUploaded:0,bytesTotal:l.size,percentage:0});const F=new AbortController;c.current=F;try{let Y=Promise.resolve(null);b&&s&&(Y=mp(b,s).catch(()=>null));const G=await xp(l,r,x,i,xe=>A(xe),F.signal),ne=await Y;if(ne&&G.embedUrl){const xe=gp(G.embedUrl);xe&&await pp(xe,ne,i)}const ie=l;t(G.embedUrl,G.uploadUrl,v,ie),D()}catch(Y){F.signal.aborted||T(Y instanceof Error?Y.message:"Failed to upload video.")}finally{_(!1),c.current=null}},V=()=>{c.current&&(c.current.abort(),c.current=null),_(!1),A(null)},z=()=>{j&&URL.revokeObjectURL(j),h(null),p(null),w(null),g(0),y(null),T(null),A(null),o.current&&(o.current.value="")};return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:o,type:"file",accept:dp,onChange:L,className:"hidden",disabled:a||m}),e.jsx("button",{type:"button",onClick:()=>{!a&&!m&&(T(null),f(!0),o.current?.click())},disabled:a||m,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Upload Video",children:m?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Video,{className:"h-4 w-4"})}),d&&l&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm px-4",children:e.jsxs("div",{className:"w-full max-w-lg rounded-xl border border-gray-700 bg-gray-900 shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[e.jsx("h3",{className:"text-base font-semibold text-white",children:"Upload Video"}),e.jsx("button",{type:"button",onClick:D,disabled:m,className:"flex h-7 w-7 items-center justify-center rounded-full text-gray-400 hover:bg-gray-800 hover:text-white disabled:opacity-50",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4",children:[C&&e.jsx("div",{className:"mb-3 rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-400",children:C}),e.jsxs("div",{className:"flex gap-3 mb-4",children:[e.jsxs("div",{className:"relative h-20 w-20 shrink-0 overflow-hidden rounded-lg bg-gray-800 border border-gray-700",children:[u?e.jsx("img",{src:u,alt:"Thumbnail",className:"h-full w-full object-cover"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center",children:e.jsx(O.Video,{className:"h-8 w-8 text-gray-500"})}),!m&&!C&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30",children:e.jsx(O.Play,{className:"h-5 w-5 text-white ml-0.5"})})]}),e.jsxs("div",{className:"flex flex-col justify-center min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-white truncate",children:l.name}),e.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:[nn(l.size),x>0&&` · ${Gi(x)}`]})]})]}),j&&!m&&e.jsx("div",{className:"mb-4 overflow-hidden rounded-lg bg-black",style:{maxHeight:"280px"},children:e.jsx("video",{src:j,controls:!0,playsInline:!0,preload:"metadata",className:"w-full",style:{maxHeight:"280px"}})}),m&&E&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs text-gray-400",children:"Uploading..."}),e.jsxs("span",{className:"text-xs font-medium text-white",children:[E.percentage.toFixed(0),"%"]})]}),e.jsx("div",{className:"h-2 w-full rounded-full bg-gray-700 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-blue-500 transition-all duration-300",style:{width:`${E.percentage}%`}})}),e.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:[nn(E.bytesUploaded)," / ",nn(E.bytesTotal)]})]}),e.jsx("div",{className:"flex gap-2",children:m?e.jsx("button",{type:"button",onClick:V,className:"flex-1 rounded-lg border border-gray-700 bg-gray-800 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-gray-700",children:"Cancel"}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:z,className:"flex items-center justify-center gap-1.5 flex-1 rounded-lg border border-gray-700 bg-gray-800 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-gray-700",children:[e.jsx(O.Trash2,{className:"h-3.5 w-3.5"}),"Remove"]}),e.jsx("button",{type:"button",onClick:()=>{H()},disabled:!!C,className:"flex-1 rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50",children:"Upload Video"})]})})]})]})})]})},Qd=({isOpen:t,onClose:r,onSelectGif:s,giphyApiKey:n})=>{const[a,i]=k.useState(""),[o,c]=k.useState([]),[d,f]=k.useState(!1),[l,h]=k.useState(null),u=k.useRef(null),p=k.useRef(null);k.useEffect(()=>{t&&setTimeout(()=>u.current?.focus(),100)},[t]);const b=async g=>{if(!g.trim())return;p.current?.abort();const v=new AbortController;p.current=v,f(!0),h(null);try{if(!n)throw new Error("GIPHY API key not provided. Pass giphyApiKey prop.");const N=await fetch(`https://api.giphy.com/v1/gifs/search?api_key=${n}&q=${encodeURIComponent(g)}&limit=20&rating=g`,{signal:v.signal});if(!N.ok)throw new Error(`Failed to fetch GIFs: ${N.statusText}`);const j=await N.json();c(j.data||[])}catch(N){if(v.signal.aborted)return;h(N instanceof Error?N.message:"Failed to search GIFs")}finally{v.signal.aborted||f(!1)}},w=g=>{g.preventDefault(),b(a)},x=g=>{const v=g.images.original?.url||g.images.downsized?.url||g.images.fixed_height?.url;v&&(s(v),r())};return t?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:r,children:e.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-xl shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] flex flex-col",onClick:g=>g.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Choose a GIF"}),e.jsx("button",{type:"button",onClick:r,className:"p-1 hover:bg-gray-800 rounded transition-colors text-gray-400",children:e.jsx(O.X,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"p-4",children:[e.jsx("form",{onSubmit:w,className:"mb-4",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:u,type:"text",value:a,onChange:g=>i(g.target.value),placeholder:"Search for GIFs...",className:"flex-1 px-3 py-2 border border-gray-700 bg-gray-800 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-white placeholder-gray-400"}),e.jsxs("button",{type:"submit",disabled:d||!a.trim(),className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 flex items-center gap-2",children:[e.jsx(O.Search,{className:"h-4 w-4"}),"Search"]})]})}),l&&e.jsx("div",{className:"text-red-400 text-sm mb-4",children:l}),d&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-blue-500 border-t-transparent mx-auto"}),e.jsx("p",{className:"mt-2 text-gray-400",children:"Searching for GIFs..."})]}),o.length>0&&e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 max-h-96 overflow-y-auto",children:o.map(g=>e.jsxs("button",{type:"button",onClick:()=>x(g),className:"relative group rounded-lg overflow-hidden hover:ring-2 hover:ring-blue-500 transition-all",children:[e.jsx("img",{src:g.images.fixed_height?.url||g.images.downsized?.url||g.images.original?.url,alt:g.title,className:"w-full h-32 object-cover",loading:"lazy"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("div",{className:"bg-black/90 rounded-full p-2",children:e.jsx(O.Image,{className:"h-4 w-4 text-blue-400"})})})]},g.id))}),!d&&o.length===0&&a&&e.jsxs("div",{className:"text-center py-8 text-gray-400",children:['No GIFs found for "',a,'"']})]})]})}):null},ho={Smileys:["😀","😃","😄","😁","😆","😅","🤣","😂","🙂","🙃","😉","😊","😇","🥰","😍","🤩","😘","😗","😚","😙","🥲","😋","😛","😜","🤪","😝","🤑","🤗","🤭","🤫","🤔","🫡","🤐","🤨","😐","😑","😶","🫥","😏","😒","🙄","😬","🤥","😌","😔","😪","🤤","😴","😷","🤒","🤕","🤢","🤮","🥵","🥶","🥴","😵","🤯","🤠","🥳","🥸","😎","🤓","🧐","😕","🫤","😟","🙁","☹️","😮","😯","😲","😳","🥺","🥹","😦","😧","😨","😰","😥","😢","😭","😱","😖","😣","😞","😓","😩","😫","🥱","😤","😡","😠","🤬","😈","👿"],Gestures:["👋","🤚","🖐️","✋","🖖","🫱","🫲","🫳","🫴","👌","🤌","🤏","✌️","🤞","🫰","🤟","🤘","🤙","👈","👉","👆","🖕","👇","☝️","🫵","👍","👎","✊","👊","🤛","🤜","👏","🙌","🫶","👐","🤲","🤝","🙏","✍️","💅","🤳","💪","🦾","🦿","🦵","🦶","👂","🦻"],People:["👶","🧒","👦","👧","🧑","👱","👨","🧔","👩","🧓","👴","👵","🙍","🙎","🙅","🙆","💁","🙋","🧏","🙇","🤦","🤷","👮","🕵️","💂","🥷","👷","🫅","🤴","👸","👳","👲","🧕","🤵","👰","🤰","🫃","🤱","👼","🎅","🤶","🦸","🦹","🧙","🧚","🧛","🧜","🧝"],Animals:["🐶","🐱","🐭","🐹","🐰","🦊","🐻","🐼","🐻‍❄️","🐨","🐯","🦁","🐮","🐷","🐸","🐵","🙈","🙉","🙊","🐒","🐔","🐧","🐦","🐤","🐣","🐥","🦆","🦅","🦉","🦇","🐺","🐗","🐴","🦄","🐝","🪱","🐛","🦋","🐌","🐞","🐜","🪰","🪲","🪳","🦟","🦗","🕷️","🐢","🐍","🦎","🦖","🦕","🐙","🦑","🦐","🦞","🦀","🐡","🐠","🐟","🐬","🐳","🐋","🦈"],Food:["🍏","🍎","🍐","🍊","🍋","🍌","🍉","🍇","🍓","🫐","🍈","🍒","🍑","🥭","🍍","🥥","🥝","🍅","🍆","🥑","🥦","🥬","🥒","🌶️","🫑","🌽","🥕","🫒","🧄","🧅","🥔","🍠","🥐","🥯","🍞","🥖","🥨","🧀","🥚","🍳","🧈","🥞","🧇","🥓","🥩","🍗","🍖","🌭","🍔","🍟","🍕","🫓","🥪","🥙","🧆","🌮","🌯","🫔","🥗","🥘","🫕","🥫","🍝","🍜","🍲","🍛","🍣","🍱","🥟","🦪","🍤","🍙","🍚","🍘","🍥","🥠","🥮","🍢","🍡","🍧","🍨","🍦","🥧","🧁","🍰","🎂","🍮","🍭","🍬","🍫","🍿","🍩","🍪","🌰","🥜","🍯"],Travel:["🚗","🚕","🚙","🚌","🚎","🏎️","🚓","🚑","🚒","🚐","🛻","🚚","🚛","🚜","🏍️","🛵","🚲","🛴","🛹","🛼","🚁","🛸","🚀","🛩️","✈️","🚢","⛵","🚤","🛥️","🛳️","⛴️","🚂","🏠","🏡","🏢","🏣","🏤","🏥","🏦","🏨","🏩","🏪","🏫","🏬","🏭","🏯","🏰","💒","🗼","🗽","⛪","🕌","🛕","🕍","⛩️","🕋","⛲","⛺","🌁","🌃","🏙️","🌄","🌅","🌆"],Objects:["⌚","📱","📲","💻","⌨️","🖥️","🖨️","🖱️","🖲️","🕹️","🗜️","💾","💿","📀","📼","📷","📸","📹","🎥","📽️","🎞️","📞","☎️","📟","📠","📺","📻","🎙️","🎚️","🎛️","🧭","⏱️","💡","🔦","🕯️","🪔","🧯","🛢️","💸","💵","💴","💶","💷","🪙","💰","💳","💎","⚖️","🪜","🧰","🪛","🔧","🔨","⚒️","🛠️","⛏️","🪚","🔩","⚙️","🪤","🧲","🔫","💣","🧨","🪓","🔪","🗡️","⚔️","🛡️","🚬","⚰️","🪦","⚱️","🏺","🔮","📿","🧿","🪬","💈","⚗️"],Symbols:["❤️","🧡","💛","💚","💙","💜","🖤","🤍","🤎","💔","❤️‍🔥","❤️‍🩹","❣️","💕","💞","💓","💗","💖","💘","💝","💟","☮️","✝️","☪️","🕉️","☸️","✡️","🔯","🕎","☯️","☦️","🛐","⛎","♈","♉","♊","♋","♌","♍","♎","♏","♐","♑","♒","♓","🆔","⚛️","🉑","☢️","☣️","📴","📳","🈶","🈚","🈸","🈺","🈷️","✴️","🆚","💮","🉐","㊙️","㊗️","🈴","🈵","🈹","🈲","🅰️","🅱️","🆎","🅾️","🆑","🆘","❌","⭕","🛑","⛔","📛","🚫","💯","💢","♨️","🚷","🚯","🚳","🚱","🔞","📵","🚭","❗","❕","❓","❔","‼️","⁉️","🔅","🔆","〽️","⚠️","🚸","🔱","⚜️","🔰","♻️","✅","🈯","💹","❇️","✳️","❎","🌐","💠","🔘","🔳","🔲","⬛","⬜","◼️","◻️","◾","◽","▪️","▫️","🔴","🟠","🟡","🟢","🔵","🟣","🟤","⚫","⚪"],Flags:["🏁","🚩","🎌","🏴","🏳️","🏳️‍🌈","🏳️‍⚧️","🏴‍☠️","🇦🇫","🇦🇱","🇩🇿","🇦🇸","🇦🇩","🇦🇴","🇦🇮","🇦🇬","🇦🇷","🇦🇲","🇦🇺","🇦🇹","🇧🇸","🇧🇭","🇧🇩","🇧🇧","🇧🇾","🇧🇪","🇧🇿","🇧🇯","🇧🇹","🇧🇴","🇧🇦","🇧🇼","🇧🇷","🇧🇳","🇧🇬","🇧🇫","🇧🇮","🇨🇦","🇨🇳","🇨🇴","🇨🇷","🇭🇷","🇨🇺","🇨🇿","🇩🇰","🇩🇴","🇪🇨","🇪🇬","🇸🇻","🇪🇹","🇫🇮","🇫🇷","🇩🇪","🇬🇭","🇬🇷","🇬🇹","🇭🇹","🇭🇳","🇭🇰","🇭🇺","🇮🇸","🇮🇳","🇮🇩","🇮🇷","🇮🇶","🇮🇪","🇮🇱","🇮🇹","🇯🇲","🇯🇵","🇯🇴","🇰🇿","🇰🇪","🇰🇼","🇱🇧","🇱🇾","🇱🇹","🇱🇺","🇲🇾","🇲🇽","🇲🇦","🇲🇿","🇳🇵","🇳🇱","🇳🇿","🇳🇬","🇳🇴","🇴🇲","🇵🇰","🇵🇦","🇵🇪","🇵🇭","🇵🇱","🇵🇹","🇶🇦","🇷🇴","🇷🇺","🇸🇦","🇷🇸","🇸🇬","🇸🇰","🇸🇮","🇿🇦","🇰🇷","🇪🇸","🇱🇰","🇸🇪","🇨🇭","🇹🇼","🇹🇭","🇹🇷","🇺🇦","🇦🇪","🇬🇧","🇺🇸","🇻🇪","🇻🇳"]},bp={Smileys:"😀",Gestures:"👋",People:"👤",Animals:"🐶",Food:"🍔",Travel:"✈️",Objects:"💡",Symbols:"❤️",Flags:"🏁"},Ji=Object.keys(ho),e0=({isOpen:t,onClose:r,onSelectEmoji:s})=>{const[n,a]=k.useState(""),[i,o]=k.useState(Ji[0]),c=k.useRef(null),d=k.useRef(null);if(k.useEffect(()=>{t&&(a(""),o(Ji[0]),setTimeout(()=>c.current?.focus(),100))},[t]),!t)return null;const f=Object.values(ho).flat(),l=n?f.filter(h=>h.includes(n)):null;return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("style",{children:".emoji-no-scrollbar::-webkit-scrollbar { display: none; }"}),e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:r,"aria-hidden":!0}),e.jsxs("div",{className:"relative bg-gray-900 border border-gray-700 rounded-xl shadow-xl w-full max-w-md h-[400px] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-gray-700",children:[e.jsx("h3",{className:"text-sm font-semibold text-white",children:"Emoji Picker"}),e.jsx("button",{type:"button",onClick:r,className:"p-1 hover:bg-gray-800 rounded text-gray-400",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"px-3 pt-3",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-gray-500"}),e.jsx("input",{ref:c,type:"text",value:n,onChange:h=>a(h.target.value),placeholder:"Search emoji...",className:"w-full pl-8 pr-3 py-1.5 text-sm bg-gray-800 border border-gray-700 rounded-lg text-white placeholder-gray-500 focus:outline-none focus:ring-1 focus:ring-blue-500"})]})}),!n&&e.jsx("div",{className:"emoji-no-scrollbar flex gap-1 px-3 pt-2 pb-1 overflow-x-auto",style:{scrollbarWidth:"none"},children:Ji.map(h=>e.jsx("button",{type:"button",onClick:()=>{o(h),d.current?.scrollTo({top:0,behavior:"smooth"})},className:`p-1.5 text-lg rounded-md transition-colors ${i===h?"bg-blue-600/20 ring-1 ring-blue-500":"hover:bg-gray-800"}`,title:h,children:bp[h]||h.charAt(0)},h))}),e.jsx("div",{ref:d,className:"emoji-no-scrollbar flex-1 overflow-y-auto p-3 min-h-0",style:{scrollbarWidth:"none"},children:n?l&&l.length>0?e.jsx("div",{className:"grid grid-cols-8 gap-1",children:l.map((h,u)=>e.jsx("button",{type:"button",onClick:()=>s(h),className:"p-1.5 hover:bg-gray-800 rounded text-xl transition-colors text-center",children:h},`${h}-${u}`))}):e.jsx("p",{className:"text-center text-gray-500 text-sm py-8",children:"No emoji found"}):e.jsx("div",{className:"grid grid-cols-8 gap-1",children:ho[i]?.map((h,u)=>e.jsx("button",{type:"button",onClick:()=>s(h),className:"p-1.5 hover:bg-gray-800 rounded text-xl transition-colors text-center",children:h},`${h}-${u}`))})})]})]})},t0=({isOpen:t,onClose:r,onSelectTemplate:s,templates:n,authorFromUrl:a})=>{const[i,o]=k.useState(""),c=k.useRef(null);k.useEffect(()=>{t&&(o(""),setTimeout(()=>c.current?.focus(),100))},[t]);const d=l=>{const h=a?l.replace(/\{\{author\}\}/g,a):l;s(h),r()},f=n.filter(l=>l.templateName.toLowerCase().includes(i.toLowerCase())||l.template.toLowerCase().includes(i.toLowerCase()));return t?e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:r,children:e.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-xl shadow-xl max-w-2xl w-full max-h-[80vh] flex flex-col",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Choose a Template"}),e.jsx("button",{onClick:r,className:"p-1.5 hover:bg-gray-800 rounded transition-colors",children:e.jsx(O.X,{className:"h-5 w-5 text-gray-400"})})]}),e.jsxs("div",{className:"p-4 flex-1 overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"relative mb-4",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx("input",{ref:c,type:"text",value:i,onChange:l=>o(l.target.value),placeholder:"Search templates...",className:"w-full pl-10 pr-3 py-2 border border-gray-700 bg-gray-800 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-white placeholder-gray-500 text-sm"})]}),f.length>0?e.jsx("div",{className:"space-y-2 overflow-y-auto flex-1",children:f.map(l=>e.jsx("button",{onClick:()=>d(l.template),className:"w-full text-left p-3 border border-gray-700 rounded-lg hover:bg-gray-800 hover:border-blue-500 transition-all group",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(O.FileText,{className:"h-4 w-4 text-gray-500 group-hover:text-blue-400 mt-0.5 shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-medium text-white text-sm group-hover:text-blue-400",children:l.templateName}),e.jsx("p",{className:"text-xs text-gray-400 mt-1 line-clamp-2",children:l.template})]})]})},l._id))}):e.jsx("div",{className:"text-center py-8 text-gray-400",children:i?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-white",children:["No templates found for “",i,"”"]}),e.jsx("p",{className:"text-xs mt-1 text-gray-500",children:"Try a different search term"})]}):e.jsxs(e.Fragment,{children:[e.jsx(O.FileText,{className:"h-12 w-12 text-gray-600 mx-auto mb-3"}),e.jsx("p",{className:"text-white",children:"No templates available"}),e.jsx("p",{className:"text-xs mt-1 text-gray-500",children:"Create templates via the API to use them here"})]})})]})]})}):null},on=2,Yi=10;function yp(){const t=new Date;return t.setDate(t.getDate()+7),t.toISOString().slice(0,16)}const r0=({isOpen:t,onClose:r,onSave:s,initialData:n})=>{const[a,i]=k.useState(n?.question??""),[o,c]=k.useState(n?.choices?.length?n.choices:["",""]),[d,f]=k.useState(n?.end_time?new Date(n.end_time*1e3).toISOString().slice(0,16):yp()),[l,h]=k.useState(n?.max_choices_voted??1),[u,p]=k.useState(n?.allow_vote_changes??!0),[b,w]=k.useState(n?.filters?.account_age??0),[x,g]=k.useState(n?.ui_hide_res_until_voted??!1);if(!t)return null;const v=()=>{o.length<Yi&&c([...o,""])},N=C=>{o.length>on&&c(o.filter((T,D)=>D!==C))},j=(C,T)=>{c(o.map((D,L)=>L===C?T:D))},y=o.filter(C=>C.trim()),m=a.trim().length>0&&y.length>=on&&new Date(d).getTime()>Date.now(),_=()=>{m&&(s({question:a.trim(),choices:y,end_time:Math.floor(new Date(d).getTime()/1e3),max_choices_voted:Math.min(l,y.length),allow_vote_changes:u,filters:{account_age:b},ui_hide_res_until_voted:x}),r())},E="w-full rounded-lg border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-white placeholder-gray-500 focus:border-blue-500 focus:outline-none",A="block text-xs font-medium text-gray-400 mb-1";return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:r,"aria-hidden":!0}),e.jsxs("div",{className:"relative bg-gray-900 border border-gray-700 rounded-xl shadow-xl w-full max-w-md max-h-[85vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[e.jsx("h3",{className:"text-sm font-semibold text-white",children:"Create Poll"}),e.jsx("button",{type:"button",onClick:r,className:"p-1.5 hover:bg-gray-800 rounded text-gray-400",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:A,children:"Question"}),e.jsx("input",{type:"text",value:a,onChange:C=>i(C.target.value),placeholder:"Ask a question...",className:E,maxLength:256})]}),e.jsxs("div",{children:[e.jsxs("label",{className:A,children:["Choices (min ",on,", max ",Yi,")"]}),e.jsx("div",{className:"space-y-2",children:o.map((C,T)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:C,onChange:D=>j(T,D.target.value),placeholder:`Option ${T+1}`,className:E,maxLength:128}),o.length>on&&e.jsx("button",{type:"button",onClick:()=>N(T),className:"shrink-0 rounded p-1.5 text-gray-400 hover:bg-gray-800 hover:text-red-400",title:"Remove option",children:e.jsx(O.X,{className:"h-3.5 w-3.5"})})]},T))}),o.length<Yi&&e.jsx("button",{type:"button",onClick:v,className:"mt-2 text-xs text-blue-400 hover:text-blue-300 font-medium",children:"+ Add option"})]}),e.jsxs("div",{children:[e.jsx("label",{className:A,children:"Poll ends at"}),e.jsx("input",{type:"datetime-local",value:d,onChange:C=>f(C.target.value),className:E,min:new Date().toISOString().slice(0,16)})]}),e.jsxs("div",{children:[e.jsxs("label",{className:A,children:["Max choices a voter can select (",l,")"]}),e.jsx("input",{type:"range",min:1,max:Math.max(y.length,1),value:l,onChange:C=>h(Number(C.target.value)),className:"w-full accent-blue-500"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:C=>p(C.target.checked),className:"accent-blue-500"}),e.jsx("span",{className:"text-xs text-gray-400",children:"Allow voters to change their vote"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:A,children:["Minimum account age to vote (days): ",b]}),e.jsx("input",{type:"number",min:0,max:365,value:b,onChange:C=>w(Math.max(0,Number(C.target.value))),className:E})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:x,onChange:C=>g(C.target.checked),className:"accent-blue-500"}),e.jsx("span",{className:"text-xs text-gray-400",children:"Hide results until user has voted"})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-gray-700",children:[e.jsx("button",{type:"button",onClick:r,className:"rounded-lg px-4 py-2 text-sm text-gray-400 hover:bg-gray-800",children:"Cancel"}),e.jsx("button",{type:"button",onClick:_,disabled:!m,className:"rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white disabled:opacity-50 hover:bg-blue-700",children:"Attach Poll"})]})]})]})},ln="https://hreplier-api.sagarkothari88.one/data/templates",un=t=>({Authorization:t,"Content-Type":"application/json"}),a0={async getTemplates(t,r){const n=await fetch(r||ln,{method:"GET",headers:un(t)});if(!n.ok)throw(await n.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to fetch templates: ${n.status} ${n.statusText}`);return(await n.json()).map(i=>({_id:i._id,name:i.name,templateName:i.templateName,template:i.template}))},async createTemplate(t,r,s,n){const i=await fetch(n||ln,{method:"POST",headers:un(t),body:JSON.stringify({templateName:r,template:s})});if(!i.ok)throw(await i.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to create template: ${i.status}`);const o=await i.json();return{_id:o._id,name:o.name,templateName:o.templateName,template:o.template}},async updateTemplate(t,r,s,n,a){const o=await fetch(a||ln,{method:"PUT",headers:un(t),body:JSON.stringify({id:r,templateName:s,template:n})});if(!o.ok)throw(await o.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to update template: ${o.status}`);const c=await o.json();return{_id:c._id,name:c.name,templateName:c.templateName,template:c.template}},async deleteTemplate(t,r,s){const a=await fetch(`${s||ln}/${r}`,{method:"DELETE",headers:un(t)});if(!a.ok)throw(await a.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to delete template: ${a.status}`)}};var Xi,Bc;function Vc(){if(Bc)return Xi;Bc=1;const{entries:t,setPrototypeOf:r,isFrozen:s,getPrototypeOf:n,getOwnPropertyDescriptor:a}=Object;let{freeze:i,seal:o,create:c}=Object,{apply:d,construct:f}=typeof Reflect<"u"&&Reflect;i||(i=function(fe){return fe}),o||(o=function(fe){return fe}),d||(d=function(fe,ke){for(var Se=arguments.length,Be=new Array(Se>2?Se-2:0),Ge=2;Ge<Se;Ge++)Be[Ge-2]=arguments[Ge];return fe.apply(ke,Be)}),f||(f=function(fe){for(var ke=arguments.length,Se=new Array(ke>1?ke-1:0),Be=1;Be<ke;Be++)Se[Be-1]=arguments[Be];return new fe(...Se)});const l=E(Array.prototype.forEach),h=E(Array.prototype.lastIndexOf),u=E(Array.prototype.pop),p=E(Array.prototype.push),b=E(Array.prototype.splice),w=E(String.prototype.toLowerCase),x=E(String.prototype.toString),g=E(String.prototype.match),v=E(String.prototype.replace),N=E(String.prototype.indexOf),j=E(String.prototype.trim),y=E(Object.prototype.hasOwnProperty),m=E(RegExp.prototype.test),_=A(TypeError);function E(ve){return function(fe){fe instanceof RegExp&&(fe.lastIndex=0);for(var ke=arguments.length,Se=new Array(ke>1?ke-1:0),Be=1;Be<ke;Be++)Se[Be-1]=arguments[Be];return d(ve,fe,Se)}}function A(ve){return function(){for(var fe=arguments.length,ke=new Array(fe),Se=0;Se<fe;Se++)ke[Se]=arguments[Se];return f(ve,ke)}}function C(ve,fe){let ke=arguments.length>2&&arguments[2]!==void 0?arguments[2]:w;r&&r(ve,null);let Se=fe.length;for(;Se--;){let Be=fe[Se];if(typeof Be=="string"){const Ge=ke(Be);Ge!==Be&&(s(fe)||(fe[Se]=Ge),Be=Ge)}ve[Be]=!0}return ve}function T(ve){for(let fe=0;fe<ve.length;fe++)y(ve,fe)||(ve[fe]=null);return ve}function D(ve){const fe=c(null);for(const[ke,Se]of t(ve))y(ve,ke)&&(Array.isArray(Se)?fe[ke]=T(Se):Se&&typeof Se=="object"&&Se.constructor===Object?fe[ke]=D(Se):fe[ke]=Se);return fe}function L(ve,fe){for(;ve!==null;){const Se=a(ve,fe);if(Se){if(Se.get)return E(Se.get);if(typeof Se.value=="function")return E(Se.value)}ve=n(ve)}function ke(){return null}return ke}const H=i(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),V=i(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),z=i(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),F=i(["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"]),Y=i(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),G=i(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ne=i(["#text"]),ie=i(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),xe=i(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),U=i(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),q=i(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),B=o(/\{\{[\w\W]*|[\w\W]*\}\}/gm),pe=o(/<%[\w\W]*|[\w\W]*%>/gm),ee=o(/\$\{[\w\W]*/gm),te=o(/^data-[\-\w.\u00B7-\uFFFF]+$/),_e=o(/^aria-[\-\w]+$/),Ie=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),K=o(/^(?:\w+script|data):/i),le=o(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),oe=o(/^html$/i),Ne=o(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ce=Object.freeze({__proto__:null,ARIA_ATTR:_e,ATTR_WHITESPACE:le,CUSTOM_ELEMENT:Ne,DATA_ATTR:te,DOCTYPE_NAME:oe,ERB_EXPR:pe,IS_ALLOWED_URI:Ie,IS_SCRIPT_OR_DATA:K,MUSTACHE_EXPR:B,TMPLIT_EXPR:ee});const Me={element:1,text:3,progressingInstruction:7,comment:8,document:9},Fe=function(){return typeof window>"u"?null:window},ue=function(fe,ke){if(typeof fe!="object"||typeof fe.createPolicy!="function")return null;let Se=null;const Be="data-tt-policy-suffix";ke&&ke.hasAttribute(Be)&&(Se=ke.getAttribute(Be));const Ge="dompurify"+(Se?"#"+Se:"");try{return fe.createPolicy(Ge,{createHTML(pt){return pt},createScriptURL(pt){return pt}})}catch{return console.warn("TrustedTypes policy "+Ge+" could not be created."),null}},Re=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ae(){let ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Fe();const fe=Z=>ae(Z);if(fe.version="3.3.3",fe.removed=[],!ve||!ve.document||ve.document.nodeType!==Me.document||!ve.Element)return fe.isSupported=!1,fe;let{document:ke}=ve;const Se=ke,Be=Se.currentScript,{DocumentFragment:Ge,HTMLTemplateElement:pt,Node:jt,Element:gt,NodeFilter:St,NamedNodeMap:Ct=ve.NamedNodeMap||ve.MozNamedAttrMap,HTMLFormElement:Tt,DOMParser:Bt,trustedTypes:Ke}=ve,at=gt.prototype,_t=L(at,"cloneNode"),Vt=L(at,"remove"),kt=L(at,"nextSibling"),Ut=L(at,"childNodes"),S=L(at,"parentNode");if(typeof pt=="function"){const Z=ke.createElement("template");Z.content&&Z.content.ownerDocument&&(ke=Z.content.ownerDocument)}let P,I="";const{implementation:X,createNodeIterator:be,createDocumentFragment:Oe,getElementsByTagName:Xe}=ke,{importNode:Ve}=Se;let ze=Re();fe.isSupported=typeof t=="function"&&typeof S=="function"&&X&&X.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:bt,ERB_EXPR:Dt,TMPLIT_EXPR:Mt,DATA_ATTR:$t,ARIA_ATTR:Yt,IS_SCRIPT_OR_DATA:Et,ATTR_WHITESPACE:ft,CUSTOM_ELEMENT:ge}=Ce;let{IS_ALLOWED_URI:Te}=Ce,Pe=null;const He=C({},[...H,...V,...z,...Y,...ne]);let Ue=null;const xt=C({},[...ie,...xe,...U,...q]);let Je=Object.seal(c(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),cr=null,Or=null;const rr=Object.seal(c(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Lr=!0,zt=!0,Mr=!1,$e=!0,ar=!1,kr=!0,ut=!1,W=!1,Q=!1,we=!1,Ae=!1,ht=!1,Ye=!0,yt=!1;const Ot="user-content-";let Gt=!0,At=!1,mt={},Rt=null;const qt=C({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let It=null;const sr=C({},["audio","video","img","source","image","track"]);let xr=null;const br=C({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),lr="http://www.w3.org/1998/Math/MathML",ur="http://www.w3.org/2000/svg",nr="http://www.w3.org/1999/xhtml";let yr=nr,Ir=!1,st=null;const We=C({},[lr,ur,nr],x);let Xt=C({},["mi","mo","mn","ms","mtext"]),ir=C({},["annotation-xml"]);const Fr=C({},["title","style","font","a","script"]);let vt=null;const dr=["application/xhtml+xml","text/html"],vr="text/html";let $=null,re=null;const he=ke.createElement("form"),se=function(M){return M instanceof RegExp||M instanceof Function},ye=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(re&&re===M)){if((!M||typeof M!="object")&&(M={}),M=D(M),vt=dr.indexOf(M.PARSER_MEDIA_TYPE)===-1?vr:M.PARSER_MEDIA_TYPE,$=vt==="application/xhtml+xml"?x:w,Pe=y(M,"ALLOWED_TAGS")?C({},M.ALLOWED_TAGS,$):He,Ue=y(M,"ALLOWED_ATTR")?C({},M.ALLOWED_ATTR,$):xt,st=y(M,"ALLOWED_NAMESPACES")?C({},M.ALLOWED_NAMESPACES,x):We,xr=y(M,"ADD_URI_SAFE_ATTR")?C(D(br),M.ADD_URI_SAFE_ATTR,$):br,It=y(M,"ADD_DATA_URI_TAGS")?C(D(sr),M.ADD_DATA_URI_TAGS,$):sr,Rt=y(M,"FORBID_CONTENTS")?C({},M.FORBID_CONTENTS,$):qt,cr=y(M,"FORBID_TAGS")?C({},M.FORBID_TAGS,$):D({}),Or=y(M,"FORBID_ATTR")?C({},M.FORBID_ATTR,$):D({}),mt=y(M,"USE_PROFILES")?M.USE_PROFILES:!1,Lr=M.ALLOW_ARIA_ATTR!==!1,zt=M.ALLOW_DATA_ATTR!==!1,Mr=M.ALLOW_UNKNOWN_PROTOCOLS||!1,$e=M.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ar=M.SAFE_FOR_TEMPLATES||!1,kr=M.SAFE_FOR_XML!==!1,ut=M.WHOLE_DOCUMENT||!1,we=M.RETURN_DOM||!1,Ae=M.RETURN_DOM_FRAGMENT||!1,ht=M.RETURN_TRUSTED_TYPE||!1,Q=M.FORCE_BODY||!1,Ye=M.SANITIZE_DOM!==!1,yt=M.SANITIZE_NAMED_PROPS||!1,Gt=M.KEEP_CONTENT!==!1,At=M.IN_PLACE||!1,Te=M.ALLOWED_URI_REGEXP||Ie,yr=M.NAMESPACE||nr,Xt=M.MATHML_TEXT_INTEGRATION_POINTS||Xt,ir=M.HTML_INTEGRATION_POINTS||ir,Je=M.CUSTOM_ELEMENT_HANDLING||{},M.CUSTOM_ELEMENT_HANDLING&&se(M.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Je.tagNameCheck=M.CUSTOM_ELEMENT_HANDLING.tagNameCheck),M.CUSTOM_ELEMENT_HANDLING&&se(M.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Je.attributeNameCheck=M.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),M.CUSTOM_ELEMENT_HANDLING&&typeof M.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Je.allowCustomizedBuiltInElements=M.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ar&&(zt=!1),Ae&&(we=!0),mt&&(Pe=C({},ne),Ue=c(null),mt.html===!0&&(C(Pe,H),C(Ue,ie)),mt.svg===!0&&(C(Pe,V),C(Ue,xe),C(Ue,q)),mt.svgFilters===!0&&(C(Pe,z),C(Ue,xe),C(Ue,q)),mt.mathMl===!0&&(C(Pe,Y),C(Ue,U),C(Ue,q))),y(M,"ADD_TAGS")||(rr.tagCheck=null),y(M,"ADD_ATTR")||(rr.attributeCheck=null),M.ADD_TAGS&&(typeof M.ADD_TAGS=="function"?rr.tagCheck=M.ADD_TAGS:(Pe===He&&(Pe=D(Pe)),C(Pe,M.ADD_TAGS,$))),M.ADD_ATTR&&(typeof M.ADD_ATTR=="function"?rr.attributeCheck=M.ADD_ATTR:(Ue===xt&&(Ue=D(Ue)),C(Ue,M.ADD_ATTR,$))),M.ADD_URI_SAFE_ATTR&&C(xr,M.ADD_URI_SAFE_ATTR,$),M.FORBID_CONTENTS&&(Rt===qt&&(Rt=D(Rt)),C(Rt,M.FORBID_CONTENTS,$)),M.ADD_FORBID_CONTENTS&&(Rt===qt&&(Rt=D(Rt)),C(Rt,M.ADD_FORBID_CONTENTS,$)),Gt&&(Pe["#text"]=!0),ut&&C(Pe,["html","head","body"]),Pe.table&&(C(Pe,["tbody"]),delete cr.tbody),M.TRUSTED_TYPES_POLICY){if(typeof M.TRUSTED_TYPES_POLICY.createHTML!="function")throw _('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof M.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw _('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');P=M.TRUSTED_TYPES_POLICY,I=P.createHTML("")}else P===void 0&&(P=ue(Ke,Be)),P!==null&&typeof I=="string"&&(I=P.createHTML(""));i&&i(M),re=M}},De=C({},[...V,...z,...F]),lt=C({},[...Y,...G]),Ze=function(M){let ce=S(M);(!ce||!ce.tagName)&&(ce={namespaceURI:yr,tagName:"template"});const me=w(M.tagName),qe=w(ce.tagName);return st[M.namespaceURI]?M.namespaceURI===ur?ce.namespaceURI===nr?me==="svg":ce.namespaceURI===lr?me==="svg"&&(qe==="annotation-xml"||Xt[qe]):!!De[me]:M.namespaceURI===lr?ce.namespaceURI===nr?me==="math":ce.namespaceURI===ur?me==="math"&&ir[qe]:!!lt[me]:M.namespaceURI===nr?ce.namespaceURI===ur&&!ir[qe]||ce.namespaceURI===lr&&!Xt[qe]?!1:!lt[me]&&(Fr[me]||!De[me]):!!(vt==="application/xhtml+xml"&&st[M.namespaceURI]):!1},Qe=function(M){p(fe.removed,{element:M});try{S(M).removeChild(M)}catch{Vt(M)}},ct=function(M,ce){try{p(fe.removed,{attribute:ce.getAttributeNode(M),from:ce})}catch{p(fe.removed,{attribute:null,from:ce})}if(ce.removeAttribute(M),M==="is")if(we||Ae)try{Qe(ce)}catch{}else try{ce.setAttribute(M,"")}catch{}},et=function(M){let ce=null,me=null;if(Q)M="<remove></remove>"+M;else{const it=g(M,/^[\r\n\t ]+/);me=it&&it[0]}vt==="application/xhtml+xml"&&yr===nr&&(M='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+M+"</body></html>");const qe=P?P.createHTML(M):M;if(yr===nr)try{ce=new Bt().parseFromString(qe,vt)}catch{}if(!ce||!ce.documentElement){ce=X.createDocument(yr,"template",null);try{ce.documentElement.innerHTML=Ir?I:qe}catch{}}const nt=ce.body||ce.documentElement;return M&&me&&nt.insertBefore(ke.createTextNode(me),nt.childNodes[0]||null),yr===nr?Xe.call(ce,ut?"html":"body")[0]:ut?ce.documentElement:nt},Pt=function(M){return be.call(M.ownerDocument||M,M,St.SHOW_ELEMENT|St.SHOW_COMMENT|St.SHOW_TEXT|St.SHOW_PROCESSING_INSTRUCTION|St.SHOW_CDATA_SECTION,null)},Zt=function(M){return M instanceof Tt&&(typeof M.nodeName!="string"||typeof M.textContent!="string"||typeof M.removeChild!="function"||!(M.attributes instanceof Ct)||typeof M.removeAttribute!="function"||typeof M.setAttribute!="function"||typeof M.namespaceURI!="string"||typeof M.insertBefore!="function"||typeof M.hasChildNodes!="function")},Lt=function(M){return typeof jt=="function"&&M instanceof jt};function dt(Z,M,ce){l(Z,me=>{me.call(fe,M,ce,re)})}const or=function(M){let ce=null;if(dt(ze.beforeSanitizeElements,M,null),Zt(M))return Qe(M),!0;const me=$(M.nodeName);if(dt(ze.uponSanitizeElement,M,{tagName:me,allowedTags:Pe}),kr&&M.hasChildNodes()&&!Lt(M.firstElementChild)&&m(/<[/\w!]/g,M.innerHTML)&&m(/<[/\w!]/g,M.textContent)||M.nodeType===Me.progressingInstruction||kr&&M.nodeType===Me.comment&&m(/<[/\w]/g,M.data))return Qe(M),!0;if(!(rr.tagCheck instanceof Function&&rr.tagCheck(me))&&(!Pe[me]||cr[me])){if(!cr[me]&&ra(me)&&(Je.tagNameCheck instanceof RegExp&&m(Je.tagNameCheck,me)||Je.tagNameCheck instanceof Function&&Je.tagNameCheck(me)))return!1;if(Gt&&!Rt[me]){const qe=S(M)||M.parentNode,nt=Ut(M)||M.childNodes;if(nt&&qe){const it=nt.length;for(let ot=it-1;ot>=0;--ot){const Ft=_t(nt[ot],!0);Ft.__removalCount=(M.__removalCount||0)+1,qe.insertBefore(Ft,kt(M))}}}return Qe(M),!0}return M instanceof gt&&!Ze(M)||(me==="noscript"||me==="noembed"||me==="noframes")&&m(/<\/no(script|embed|frames)/i,M.innerHTML)?(Qe(M),!0):(ar&&M.nodeType===Me.text&&(ce=M.textContent,l([bt,Dt,Mt],qe=>{ce=v(ce,qe," ")}),M.textContent!==ce&&(p(fe.removed,{element:M.cloneNode()}),M.textContent=ce)),dt(ze.afterSanitizeElements,M,null),!1)},Yr=function(M,ce,me){if(Or[ce]||Ye&&(ce==="id"||ce==="name")&&(me in ke||me in he))return!1;if(!(zt&&!Or[ce]&&m($t,ce))){if(!(Lr&&m(Yt,ce))){if(!(rr.attributeCheck instanceof Function&&rr.attributeCheck(ce,M))){if(!Ue[ce]||Or[ce]){if(!(ra(M)&&(Je.tagNameCheck instanceof RegExp&&m(Je.tagNameCheck,M)||Je.tagNameCheck instanceof Function&&Je.tagNameCheck(M))&&(Je.attributeNameCheck instanceof RegExp&&m(Je.attributeNameCheck,ce)||Je.attributeNameCheck instanceof Function&&Je.attributeNameCheck(ce,M))||ce==="is"&&Je.allowCustomizedBuiltInElements&&(Je.tagNameCheck instanceof RegExp&&m(Je.tagNameCheck,me)||Je.tagNameCheck instanceof Function&&Je.tagNameCheck(me))))return!1}else if(!xr[ce]){if(!m(Te,v(me,ft,""))){if(!((ce==="src"||ce==="xlink:href"||ce==="href")&&M!=="script"&&N(me,"data:")===0&&It[M])){if(!(Mr&&!m(Et,v(me,ft,"")))){if(me)return!1}}}}}}}return!0},ra=function(M){return M!=="annotation-xml"&&g(M,ge)},R=function(M){dt(ze.beforeSanitizeAttributes,M,null);const{attributes:ce}=M;if(!ce||Zt(M))return;const me={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ue,forceKeepAttr:void 0};let qe=ce.length;for(;qe--;){const nt=ce[qe],{name:it,namespaceURI:ot,value:Ft}=nt,Kt=$(it),Ht=Ft;let wt=it==="value"?Ht:j(Ht);if(me.attrName=Kt,me.attrValue=wt,me.keepAttr=!0,me.forceKeepAttr=void 0,dt(ze.uponSanitizeAttribute,M,me),wt=me.attrValue,yt&&(Kt==="id"||Kt==="name")&&(ct(it,M),wt=Ot+wt),kr&&m(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,wt)){ct(it,M);continue}if(Kt==="attributename"&&g(wt,"href")){ct(it,M);continue}if(me.forceKeepAttr)continue;if(!me.keepAttr){ct(it,M);continue}if(!$e&&m(/\/>/i,wt)){ct(it,M);continue}ar&&l([bt,Dt,Mt],Sr=>{wt=v(wt,Sr," ")});const fr=$(M.nodeName);if(!Yr(fr,Kt,wt)){ct(it,M);continue}if(P&&typeof Ke=="object"&&typeof Ke.getAttributeType=="function"&&!ot)switch(Ke.getAttributeType(fr,Kt)){case"TrustedHTML":{wt=P.createHTML(wt);break}case"TrustedScriptURL":{wt=P.createScriptURL(wt);break}}if(wt!==Ht)try{ot?M.setAttributeNS(ot,it,wt):M.setAttribute(it,wt),Zt(M)?Qe(M):u(fe.removed)}catch{ct(it,M)}}dt(ze.afterSanitizeAttributes,M,null)},J=function Z(M){let ce=null;const me=Pt(M);for(dt(ze.beforeSanitizeShadowDOM,M,null);ce=me.nextNode();)dt(ze.uponSanitizeShadowNode,ce,null),or(ce),R(ce),ce.content instanceof Ge&&Z(ce.content);dt(ze.afterSanitizeShadowDOM,M,null)};return fe.sanitize=function(Z){let M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ce=null,me=null,qe=null,nt=null;if(Ir=!Z,Ir&&(Z="<!-->"),typeof Z!="string"&&!Lt(Z))if(typeof Z.toString=="function"){if(Z=Z.toString(),typeof Z!="string")throw _("dirty is not a string, aborting")}else throw _("toString is not a function");if(!fe.isSupported)return Z;if(W||ye(M),fe.removed=[],typeof Z=="string"&&(At=!1),At){if(Z.nodeName){const Ft=$(Z.nodeName);if(!Pe[Ft]||cr[Ft])throw _("root node is forbidden and cannot be sanitized in-place")}}else if(Z instanceof jt)ce=et("<!---->"),me=ce.ownerDocument.importNode(Z,!0),me.nodeType===Me.element&&me.nodeName==="BODY"||me.nodeName==="HTML"?ce=me:ce.appendChild(me);else{if(!we&&!ar&&!ut&&Z.indexOf("<")===-1)return P&&ht?P.createHTML(Z):Z;if(ce=et(Z),!ce)return we?null:ht?I:""}ce&&Q&&Qe(ce.firstChild);const it=Pt(At?Z:ce);for(;qe=it.nextNode();)or(qe),R(qe),qe.content instanceof Ge&&J(qe.content);if(At)return Z;if(we){if(Ae)for(nt=Oe.call(ce.ownerDocument);ce.firstChild;)nt.appendChild(ce.firstChild);else nt=ce;return(Ue.shadowroot||Ue.shadowrootmode)&&(nt=Ve.call(Se,nt,!0)),nt}let ot=ut?ce.outerHTML:ce.innerHTML;return ut&&Pe["!doctype"]&&ce.ownerDocument&&ce.ownerDocument.doctype&&ce.ownerDocument.doctype.name&&m(oe,ce.ownerDocument.doctype.name)&&(ot="<!DOCTYPE "+ce.ownerDocument.doctype.name+`>
1072
+ `+ot),ar&&l([bt,Dt,Mt],Ft=>{ot=v(ot,Ft," ")}),P&&ht?P.createHTML(ot):ot},fe.setConfig=function(){let Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ye(Z),W=!0},fe.clearConfig=function(){re=null,W=!1},fe.isValidAttribute=function(Z,M,ce){re||ye({});const me=$(Z),qe=$(M);return Yr(me,qe,ce)},fe.addHook=function(Z,M){typeof M=="function"&&p(ze[Z],M)},fe.removeHook=function(Z,M){if(M!==void 0){const ce=h(ze[Z],M);return ce===-1?void 0:b(ze[Z],ce,1)[0]}return u(ze[Z])},fe.removeHooks=function(Z){ze[Z]=[]},fe.removeAllHooks=function(){ze=Re()},fe}var de=ae();return Xi=de,Xi}var Zi,Uc;function vp(){return Uc||(Uc=1,Zi=self.DOMPurify||(self.DOMPurify=Vc().default||Vc())),Zi}var wp=vp();const Np=O0(wp);var jp="https://ipfs.3speak.tv",_p=["https://ipfs.skatehive.app","https://cloudflare-ipfs.com","https://ipfs.io"],kp=["peakd.com","ecency.com","hive.blog","hiveblog.io","leofinance.io","3speak.tv","d.tube","esteem.app","busy.org"],Ep={ALLOWED_TAGS:["p","br","span","div","blockquote","pre","code","strong","em","b","i","u","ins","del","s","strike","mark","sub","sup","small","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","th","td","caption","col","colgroup","a","img","video","source","audio","iframe","hr","center","details","summary"],ALLOWED_ATTR:["href","src","alt","title","width","height","class","id","style","target","rel","controls","muted","preload","loading","autoplay","loop","type","allowfullscreen","frameborder","allow","scrolling","colspan","rowspan","align","valign","start","reversed","data-dnt","data-theme","allowtransparency"],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|ipfs):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1,FORBID_TAGS:["script","form","input","button","textarea","select","dialog","object","embed","applet","base","link","meta"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","onfocus","onblur","onchange","onsubmit","onkeydown","onkeyup","onkeypress"],KEEP_CONTENT:!0,RETURN_TRUSTED_TYPE:!1};function Ap(t){return t.replace(/<p><center>([\s\S]*?)<hr \/>([\s\S]*?)<\/center><\/p>/gi,(r,s,n)=>`<center>${s.trim()}</center><hr />${n.trim()}`)}function Sp(t){const r=new Set,s=new Set;return t=Ap(t),t=t.replace(/<a[^>]*href="(https?:\/\/3speak\.tv\/watch\?v=([^"&]+)[^"]*)"[^>]*>.*?<\/a>/g,(n,a,i)=>r.has(i)?n:(r.add(i),`<div class="video-container"><iframe src="${`https://play.3speak.tv/watch?v=${i}&mode=iframe`}" allowfullscreen loading="lazy"></iframe></div>`)),t=t.replace(/<a[^>]*href="(https?:\/\/play\.3speak\.tv\/watch\?v=([^"&]+)[^"]*)"[^>]*>.*?<\/a>/g,(n,a,i)=>r.has(i)?n:(r.add(i),`<div class="video-container"><iframe src="${`https://play.3speak.tv/watch?v=${i}&mode=iframe`}" allowfullscreen loading="lazy"></iframe></div>`)),t=t.replace(/<a[^>]*href="(https?:\/\/play\.3speak\.tv\/embed\?v=([^"&]+)[^"]*)"[^>]*>.*?<\/a>/g,(n,a,i)=>r.has(i)?n:(r.add(i),`<div class="video-container"><iframe src="${`https://play.3speak.tv/embed?v=${i}&mode=iframe`}" allowfullscreen loading="lazy"></iframe></div>`)),t=t.replace(/<a[^>]*href="(https?:\/\/audio\.3speak\.tv\/play\?a=([^"&]+)[^"]*)"[^>]*>.*?<\/a>/g,(n,a,i)=>s.has(i)?n:(s.add(i),`<div class="audio-container"><iframe src="${`https://audio.3speak.tv/play?a=${i}`}" loading="lazy"></iframe></div>`)),t}function Cp(t){const r=new Set,s=/<a[^>]*href="(https?:\/\/(?:twitter\.com|x\.com)\/([^/]+)\/status\/(\d+)[^"]*)"[^>]*>.*?<\/a>/gi;t=t.replace(s,(a,i,o,c)=>r.has(c)?a:(r.add(c),`<div class="twitter-embed-container" style="max-width: 550px;">
1073
1073
  <iframe
1074
1074
  src="https://platform.twitter.com/embed/Tweet.html?id=${c}&dnt=true"
1075
1075
  width="550"
@@ -1114,20 +1114,20 @@ and ensure you are accounting for this risk.
1114
1114
  </div>`)),t}function Dp(t,r,s){const n=[r,...s,"https://ipfs.io","https://gateway.pinata.cloud"];for(const a of n){const i=new RegExp(`<iframe src="${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}/ipfs/([a-zA-Z0-9-?=&]+)"(?:(?!<\\/iframe>).)*\\sallowfullscreen><\\/iframe>`,"g");t=t.replace(i,(o,c)=>`<video controls muted preload="none" loading="lazy">
1115
1115
  ${[r,...s].map(f=>`<source src="${f}/ipfs/${c}" type="video/mp4">`).join(`
1116
1116
  `)}
1117
- </video>`)}return t}function Pp(t){return t.replace(/<a href="(https?:\/\/[^"]*(?:ipfs|bafy|Qm)[^"]*)"([^>]*)>/gi,`<a href="$1" target="_blank" rel="noopener noreferrer"$2 onclick="event.preventDefault(); window.open(this.href, '_blank'); return false;">`)}function Op(t,r,s){const n=r.map(i=>i.replace(".","\\.")).join("|"),a=new RegExp(`<a href="https?:\\/\\/(?:www\\.)?(${n})\\/((?:[^/]+\\/)?@([a-z0-9.-]+)\\/([a-z0-9-]+))"([^>]*)>`,"gi");return t.replace(a,(i,o,c,d,f,l)=>`<a href="${`${s}/@${d}/${f}`}"${l}>`)}function Un(t={}){const{baseUrl:r="https://hive.blog/",ipfsGateway:s=jp,ipfsFallbackGateways:n=_p,usertagUrlFn:a=w=>"/@"+w,hashtagUrlFn:i=w=>"/trending/"+w,additionalHiveFrontends:o=[],convertHiveUrls:c=!0,internalUrlPrefix:d="",assetsWidth:f=540,assetsHeight:l=380,imageProxyFn:h}=t,u=[...kp,...o],p=w=>{try{if(w.includes("ipfs")){const x=w.split("/ipfs/");if(x[1])return`https://ipfs.io/ipfs/${x[1]}`}return w}catch{return w}},b=new Bn.DefaultRenderer({baseUrl:r,breaks:!0,skipSanitization:!1,allowInsecureScriptTags:!1,addNofollowToLinks:!0,doNotShowImages:!1,assetsWidth:f,assetsHeight:l,imageProxyFn:h||p,usertagUrlFn:a,hashtagUrlFn:i,isLinkSafeFn:()=>!0,addExternalCssClassToMatchingLinksFn:()=>!0,ipfsPrefix:s});return function(x){let g=b.render(x);return g=Sp(g),g=Dp(g,s,n),g=Cp(g),g=Tp(g),g=Pp(g),c&&(g=Op(g,u,d)),Np.sanitize(g,Ep)}}Un();const gs=({onSubmit:t,onCancel:r,currentUser:s,placeholder:n="Write in Markdown...",parentAuthor:a,parentPermlink:i,ecencyToken:o,threeSpeakApiKey:c,giphyApiKey:d,templateToken:f,templateApiBaseUrl:l,hideBold:h,hideItalic:u,hideLink:p,hideImage:b,hideAudio:w,hideVideo:x,hideEmoji:g,hideGif:v,hideCode:N,hideMention:j,hideTemplate:y,hidePreview:m,hidePoll:_,onPollChange:E,showCancel:A=!0,submitLabel:C="Post",title:T,defaultPreviewOn:D=!1,value:L,onChange:H,disabled:V=!1,hideSubmitArea:z=!1,submitRef:F,hideUserHeader:Y=!1,bgColor:G,borderColor:ne,disableAutoFocus:ie=!1})=>{const[xe,U]=k.useState(""),q=L!==void 0?L:xe,B=ge=>{H?H(ge):U(ge)},[pe,ee]=k.useState(!1),te=V||pe,[_e,Ie]=k.useState(!1),[K,le]=k.useState(!1),[oe,Ne]=k.useState(!1),[Ce,Me]=k.useState(D),[Fe,ue]=k.useState(null),[Re,se]=k.useState(0),[de,ve]=k.useState(null),[fe,ke]=k.useState(null),[Se,Be]=k.useState(null),[Ge,pt]=k.useState([]),[jt,gt]=k.useState(!1),[St,Ct]=k.useState(!1),[Tt,Bt]=k.useState(null),[Ke,at]=k.useState(!1),_t=k.useRef(null),Vt=k.useRef(0),kt=k.useMemo(()=>{try{return Un({baseUrl:"https://hive.blog/",ipfsGateway:"https://ipfs.3speak.tv",assetsWidth:640,assetsHeight:390,usertagUrlFn:ge=>`https://peakd.com/@${ge}`,hashtagUrlFn:ge=>`https://peakd.com/created/${ge}`,convertHiveUrls:!0})}catch{return null}},[]);k.useEffect(()=>{!ie&&_t.current&&_t.current.focus()},[ie]),k.useEffect(()=>{L!==void 0&&L===""&&(ue(null),se(0),fe&&URL.revokeObjectURL(fe),ve(null),ke(null))},[L]),k.useEffect(()=>{if(!f){pt([]);return}a0.getTemplates(f,l).then(pt).catch(ge=>console.error("Failed to fetch templates:",ge))},[f,l]);const Ut=k.useCallback((ge,Te="")=>{const Pe=_t.current;if(!Pe)return;const He=Pe.selectionStart,Ue=Pe.selectionEnd,xt=q.slice(He,Ue),Je=q.slice(0,He)+ge+xt+Te+q.slice(Ue);B(Je),setTimeout(()=>{Pe.focus(),Pe.setSelectionRange(He+ge.length,He+ge.length+xt.length)},0)},[q]),S=k.useCallback(ge=>{const Te=_t.current;if(!Te)return;const Pe=Te.selectionStart;B(q.slice(0,Pe)+ge+q.slice(Pe)),setTimeout(()=>{Te.focus(),Te.setSelectionRange(Pe+ge.length,Pe+ge.length)},0)},[q]),P=k.useCallback(()=>{const ge=_t.current;if(!ge)return;const Te=ge.selectionStart,Pe=ge.selectionEnd,He=q.slice(Te,Pe);if(He.includes(`
1117
+ </video>`)}return t}function Pp(t){return t.replace(/<a href="(https?:\/\/[^"]*(?:ipfs|bafy|Qm)[^"]*)"([^>]*)>/gi,`<a href="$1" target="_blank" rel="noopener noreferrer"$2 onclick="event.preventDefault(); window.open(this.href, '_blank'); return false;">`)}function Op(t,r,s){const n=r.map(i=>i.replace(".","\\.")).join("|"),a=new RegExp(`<a href="https?:\\/\\/(?:www\\.)?(${n})\\/((?:[^/]+\\/)?@([a-z0-9.-]+)\\/([a-z0-9-]+))"([^>]*)>`,"gi");return t.replace(a,(i,o,c,d,f,l)=>`<a href="${`${s}/@${d}/${f}`}"${l}>`)}function Un(t={}){const{baseUrl:r="https://hive.blog/",ipfsGateway:s=jp,ipfsFallbackGateways:n=_p,usertagUrlFn:a=w=>"/@"+w,hashtagUrlFn:i=w=>"/trending/"+w,additionalHiveFrontends:o=[],convertHiveUrls:c=!0,internalUrlPrefix:d="",assetsWidth:f=540,assetsHeight:l=380,imageProxyFn:h}=t,u=[...kp,...o],p=w=>{try{if(w.includes("ipfs")){const x=w.split("/ipfs/");if(x[1])return`https://ipfs.io/ipfs/${x[1]}`}return w}catch{return w}},b=new Bn.DefaultRenderer({baseUrl:r,breaks:!0,skipSanitization:!1,allowInsecureScriptTags:!1,addNofollowToLinks:!0,doNotShowImages:!1,assetsWidth:f,assetsHeight:l,imageProxyFn:h||p,usertagUrlFn:a,hashtagUrlFn:i,isLinkSafeFn:()=>!0,addExternalCssClassToMatchingLinksFn:()=>!0,ipfsPrefix:s});return function(x){let g=b.render(x);return g=Sp(g),g=Dp(g,s,n),g=Cp(g),g=Tp(g),g=Pp(g),c&&(g=Op(g,u,d)),Np.sanitize(g,Ep)}}Un();const gs=({onSubmit:t,onCancel:r,currentUser:s,placeholder:n="Write in Markdown...",parentAuthor:a,parentPermlink:i,ecencyToken:o,threeSpeakApiKey:c,giphyApiKey:d,templateToken:f,templateApiBaseUrl:l,hideBold:h,hideItalic:u,hideLink:p,hideImage:b,hideAudio:w,hideVideo:x,hideEmoji:g,hideGif:v,hideCode:N,hideMention:j,hideTemplate:y,hidePreview:m,hidePoll:_,onPollChange:E,showCancel:A=!0,submitLabel:C="Post",title:T,defaultPreviewOn:D=!1,value:L,onChange:H,disabled:V=!1,hideSubmitArea:z=!1,submitRef:F,hideUserHeader:Y=!1,bgColor:G,borderColor:ne,disableAutoFocus:ie=!1})=>{const[xe,U]=k.useState(""),q=L!==void 0?L:xe,B=ge=>{H?H(ge):U(ge)},[pe,ee]=k.useState(!1),te=V||pe,[_e,Ie]=k.useState(!1),[K,le]=k.useState(!1),[oe,Ne]=k.useState(!1),[Ce,Me]=k.useState(D),[Fe,ue]=k.useState(null),[Re,ae]=k.useState(0),[de,ve]=k.useState(null),[fe,ke]=k.useState(null),[Se,Be]=k.useState(null),[Ge,pt]=k.useState([]),[jt,gt]=k.useState(!1),[St,Ct]=k.useState(!1),[Tt,Bt]=k.useState(null),[Ke,at]=k.useState(!1),_t=k.useRef(null),Vt=k.useRef(0),kt=k.useMemo(()=>{try{return Un({baseUrl:"https://hive.blog/",ipfsGateway:"https://ipfs.3speak.tv",assetsWidth:640,assetsHeight:390,usertagUrlFn:ge=>`https://peakd.com/@${ge}`,hashtagUrlFn:ge=>`https://peakd.com/created/${ge}`,convertHiveUrls:!0})}catch{return null}},[]);k.useEffect(()=>{!ie&&_t.current&&_t.current.focus()},[ie]),k.useEffect(()=>{L!==void 0&&L===""&&(ue(null),ae(0),fe&&URL.revokeObjectURL(fe),ve(null),ke(null))},[L]),k.useEffect(()=>{if(!f){pt([]);return}a0.getTemplates(f,l).then(pt).catch(ge=>console.error("Failed to fetch templates:",ge))},[f,l]);const Ut=k.useCallback((ge,Te="")=>{const Pe=_t.current;if(!Pe)return;const He=Pe.selectionStart,Ue=Pe.selectionEnd,xt=q.slice(He,Ue),Je=q.slice(0,He)+ge+xt+Te+q.slice(Ue);B(Je),setTimeout(()=>{Pe.focus(),Pe.setSelectionRange(He+ge.length,He+ge.length+xt.length)},0)},[q]),S=k.useCallback(ge=>{const Te=_t.current;if(!Te)return;const Pe=Te.selectionStart;B(q.slice(0,Pe)+ge+q.slice(Pe)),setTimeout(()=>{Te.focus(),Te.setSelectionRange(Pe+ge.length,Pe+ge.length)},0)},[q]),P=k.useCallback(()=>{const ge=_t.current;if(!ge)return;const Te=ge.selectionStart,Pe=ge.selectionEnd,He=q.slice(Te,Pe);if(He.includes(`
1118
1118
  `)||He.length===0){const Ue="```\n"+(He||"code here")+"\n```",xt=q.slice(0,Te)+Ue+q.slice(Pe);B(xt),setTimeout(()=>{ge.focus(),ge.setSelectionRange(Te+4,Te+4+(He.length||9))},0)}else Ut("`","`")},[q,Ut]),I=k.useCallback(()=>{S(a?`@${a} `:"@")},[a,S]),X=k.useCallback((ge,Te)=>{navigator.clipboard.writeText(ge).then(()=>{Be(Te),setTimeout(()=>Be(null),2e3)})},[]),be=k.useCallback(async ge=>{if(!o||!ge.type.startsWith("image/"))return null;if(ge.size>10*1024*1024)return console.error("Image too large (max 10MB)"),null;try{const Te=new FormData;Te.append("file",ge);const Pe=await fetch(`https://images.ecency.com/hs/${o}`,{method:"POST",body:Te});if(!Pe.ok)throw new Error(`Upload failed: ${Pe.status}`);return(await Pe.json()).url||null}catch(Te){return console.error("Image upload failed:",Te),null}},[o]),Oe=k.useCallback(async ge=>{if(!o)return;const Te=ge.clipboardData?.items;if(Te){for(let Pe=0;Pe<Te.length;Pe++)if(Te[Pe].type.startsWith("image/")){ge.preventDefault();const He=Te[Pe].getAsFile();if(!He)continue;Ct(!0);const Ue=await be(He);Ct(!1),Ue&&S(`![Image](${Ue})
1119
1119
  `);return}}},[o,be,S]),Xe=k.useCallback(ge=>{o&&(ge.preventDefault(),ge.stopPropagation(),Vt.current++,ge.dataTransfer.types.includes("Files")&&gt(!0))},[o]),Ve=k.useCallback(ge=>{ge.preventDefault(),ge.stopPropagation(),Vt.current--,Vt.current===0&&gt(!1)},[]),ze=k.useCallback(ge=>{ge.preventDefault(),ge.stopPropagation()},[]),bt=k.useCallback(async ge=>{if(ge.preventDefault(),ge.stopPropagation(),gt(!1),Vt.current=0,!o)return;const Te=ge.dataTransfer.files;if(!(!Te||Te.length===0))for(let Pe=0;Pe<Te.length;Pe++){const He=Te[Pe];if(He.type.startsWith("image/")){Ct(!0);const Ue=await be(He);Ct(!1),Ue&&S(`![Image](${Ue})
1120
1120
  `)}}},[o,be,S]),Dt=async()=>{if(!(!q.trim()||te)){ee(!0);try{let ge=q.trim();Fe&&(ge+=`
1121
1121
  ${Fe}`),de&&(ge+=`
1122
- ${de}`),await t(ge),B(""),ue(null),se(0),ve(null),fe&&URL.revokeObjectURL(fe),ke(null),Bt(null),E?.(null)}catch(ge){console.error("Failed to submit:",ge)}finally{ee(!1)}}};k.useEffect(()=>(F&&(F.current={submit:Dt,getFinalBody:()=>{let ge=q.trim();return Fe&&(ge+=`
1122
+ ${de}`),await t(ge),B(""),ue(null),ae(0),ve(null),fe&&URL.revokeObjectURL(fe),ke(null),Bt(null),E?.(null)}catch(ge){console.error("Failed to submit:",ge)}finally{ee(!1)}}};k.useEffect(()=>(F&&(F.current={submit:Dt,getFinalBody:()=>{let ge=q.trim();return Fe&&(ge+=`
1123
1123
  ${Fe}`),de&&(ge+=`
1124
- ${de}`),ge},clear:()=>{B(""),ue(null),se(0),ve(null),fe&&URL.revokeObjectURL(fe),ke(null),Bt(null),E?.(null)}}),()=>{F&&(F.current=null)}));const Mt=ge=>{ge.key==="Enter"&&(ge.metaKey||ge.ctrlKey)&&(ge.preventDefault(),Dt()),ge.key==="Escape"&&r&&r()},$t=()=>{ue(null),se(0)},Yt=()=>{fe&&URL.revokeObjectURL(fe),ve(null),ke(null)},Et=k.useCallback(()=>{if(!q.trim())return null;const ge=q.split(/(```[\s\S]*?```)/g);let Te=0;return e.jsx("div",{className:"space-y-2",children:ge.map((Pe,He)=>{if(Pe.startsWith("```")&&Pe.endsWith("```")){const xt=Pe.slice(3,-3).replace(/^\w*\n?/,""),Je=Te++;return e.jsxs("div",{className:"relative group rounded-lg overflow-hidden",children:[e.jsx("pre",{className:"bg-gray-950 text-green-400 p-3 rounded-lg text-xs overflow-x-auto font-mono",children:e.jsx("code",{children:xt.trim()||" "})}),e.jsx("button",{type:"button",onClick:()=>X(xt.trim(),Je),className:"absolute top-2 right-2 p-1.5 rounded-md bg-gray-800 hover:bg-gray-700 text-gray-400 hover:text-white transition-colors opacity-0 group-hover:opacity-100",title:"Copy code",children:Se===Je?e.jsx(O.Check,{className:"h-3.5 w-3.5 text-green-400"}):e.jsx(O.Copy,{className:"h-3.5 w-3.5"})})]},He)}const Ue=Pe.split(/(`[^`]+`)/g);return e.jsx("span",{children:Ue.map((xt,Je)=>{if(xt.startsWith("`")&&xt.endsWith("`")){const cr=xt.slice(1,-1);return e.jsx("code",{className:"bg-gray-800 text-amber-400 px-1.5 py-0.5 rounded text-xs font-mono cursor-pointer hover:bg-gray-700 transition-colors",title:"Click to copy",onClick:()=>navigator.clipboard.writeText(cr),children:cr},Je)}return xt.trim()?e.jsx("span",{className:"text-gray-300 text-sm",children:xt},Je):null})},He)})})},[q,Se,X]),ft="p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50";return e.jsxs("div",{className:`p-4 md:p-6 space-y-3 rounded-xl border transition-colors ${jt?"border-blue-500 bg-blue-900/10":""}`,style:{backgroundColor:jt?void 0:G||"#111827",borderColor:jt?void 0:ne||"#374151"},onDragEnter:Xe,onDragLeave:Ve,onDragOver:ze,onDrop:bt,children:[T&&e.jsx("h3",{className:"text-white font-semibold text-base",children:T}),!Y&&e.jsxs("div",{className:"flex items-center justify-start space-x-3 text-left",children:[e.jsx("div",{className:"flex-shrink-0",children:s?e.jsx("img",{src:`https://images.hive.blog/u/${s}/avatar`,alt:s,className:"w-10 h-10 rounded-full object-cover border-2 border-gray-600",onError:ge=>{ge.target.src=`https://ui-avatars.com/api/?name=${s}&background=random`}}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-gray-700 flex items-center justify-center",children:e.jsx(O.User,{className:"w-6 h-6 text-gray-400"})})}),e.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[e.jsx("div",{className:"text-sm text-white font-medium",children:s?`@${s}`:"Anonymous"}),a&&e.jsxs("div",{className:"text-xs text-gray-400",children:["Replying to @",a]})]})]}),Ce&&q.trim()&&e.jsxs("div",{className:"rounded-lg border border-gray-700 bg-gray-800/50 overflow-hidden max-h-[300px] flex flex-col",children:[e.jsxs("div",{className:"px-3 py-2 text-xs uppercase tracking-wide text-gray-400 bg-gray-800 border-b border-gray-700 flex items-center justify-between shrink-0",children:[e.jsx("span",{children:"Preview"}),(q.includes("```")||/`[^`]+`/.test(q))&&e.jsx("span",{className:"text-[10px] text-gray-500 normal-case",children:"Hover code blocks to copy"})]}),e.jsx("div",{className:"p-3 overflow-y-auto",style:{scrollbarWidth:"thin"},children:kt?e.jsx("div",{className:"rendered-body text-white text-sm overflow-x-auto prose prose-invert prose-sm max-w-none",dangerouslySetInnerHTML:{__html:kt(q)}}):Et()})]}),Fe&&e.jsxs("div",{className:"rounded-lg border border-gray-700 bg-gray-800 overflow-hidden",children:[e.jsx("div",{className:"relative",style:{height:"60px",overflow:"hidden"},children:e.jsx("iframe",{src:Fe,title:"Audio preview",className:"w-full border-0 absolute top-0 left-0",style:{height:"200px"},allow:"autoplay; encrypted-media",loading:"lazy"})}),e.jsxs("div",{className:"flex items-center gap-2 border-t border-gray-700 px-3 py-1.5",children:[e.jsxs("span",{className:"flex-1 truncate text-xs text-gray-400",children:["Audio attached",Re>0?` (${Math.floor(Re/60)}:${String(Re%60).padStart(2,"0")})`:""]}),e.jsx("button",{type:"button",onClick:$t,className:"shrink-0 rounded p-1.5 text-gray-400 hover:text-red-400 hover:bg-gray-700 transition-colors",title:"Remove audio",children:e.jsx(O.X,{className:"h-4 w-4"})})]})]}),de&&e.jsxs("div",{className:"rounded-lg border border-gray-700 bg-gray-800 overflow-hidden",children:[fe?e.jsx("video",{src:fe,controls:!0,playsInline:!0,preload:"metadata",className:"w-full",style:{maxHeight:"200px"}}):e.jsx("div",{className:"h-20 flex items-center justify-center text-gray-400 text-xs",children:"Video attached"}),e.jsxs("div",{className:"flex items-center gap-2 border-t border-gray-700 px-3 py-1.5",children:[e.jsx("span",{className:"flex-1 truncate text-xs text-gray-400",children:"Video attached"}),e.jsx("button",{type:"button",onClick:Yt,className:"shrink-0 rounded p-0.5 text-gray-400 hover:text-red-400",title:"Remove video",children:e.jsx(O.X,{className:"h-3.5 w-3.5"})})]})]}),Tt&&e.jsx("div",{className:"rounded-lg border border-gray-700 bg-gray-800 overflow-hidden",children:e.jsxs("div",{className:"px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx(O.BarChart3,{className:"h-3.5 w-3.5 shrink-0 text-blue-400"}),e.jsx("span",{className:"flex-1 truncate text-xs font-medium text-white",children:Tt.question}),e.jsx("button",{type:"button",onClick:()=>at(!0),className:"shrink-0 rounded p-0.5 text-gray-400 hover:bg-gray-700 hover:text-white",title:"Edit poll",children:e.jsx(O.Code,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:()=>{Bt(null),E?.(null)},className:"shrink-0 rounded p-0.5 text-gray-400 hover:bg-gray-700 hover:text-red-400",title:"Remove poll",children:e.jsx(O.X,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:Tt.choices.map((ge,Te)=>e.jsx("span",{className:"rounded-full bg-gray-700 px-2 py-0.5 text-xs text-gray-300",children:ge},Te))}),e.jsxs("div",{className:"mt-1.5 text-[10px] text-gray-500",children:["Ends ",new Date(Tt.end_time*1e3).toLocaleDateString()," · Max ",Tt.max_choices_voted," choice",Tt.max_choices_voted>1?"s":""]})]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-gray-700 pb-2",children:[!m&&e.jsx("button",{type:"button",onClick:()=>Me(ge=>!ge),className:`${ft} ${Ce?"bg-gray-700 text-blue-400":""}`,title:Ce?"Hide preview":"Show preview",disabled:te,children:Ce?e.jsx(O.EyeOff,{className:"h-4 w-4"}):e.jsx(O.Eye,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-1"}),!h&&e.jsx("button",{type:"button",onClick:()=>Ut("**","**"),className:ft,title:"Bold",disabled:te,children:e.jsx(O.Bold,{className:"h-4 w-4"})}),!u&&e.jsx("button",{type:"button",onClick:()=>Ut("*","*"),className:ft,title:"Italic",disabled:te,children:e.jsx(O.Italic,{className:"h-4 w-4"})}),!p&&e.jsx("button",{type:"button",onClick:()=>Ut("[","](url)"),className:ft,title:"Link",disabled:te,children:e.jsx(O.Link,{className:"h-4 w-4"})}),!N&&e.jsx("button",{type:"button",onClick:P,className:ft,title:"Code block",disabled:te,children:e.jsx(O.Code,{className:"h-4 w-4"})}),!j&&e.jsx("button",{type:"button",onClick:I,className:ft,title:a?`Mention @${a}`:"Mention",disabled:te,children:e.jsx(O.AtSign,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-1"}),!b&&o&&e.jsx(Xd,{onImageUploaded:ge=>S(`![Image](${ge})`),ecencyToken:o,disabled:te}),!w&&c&&e.jsx(Zd,{onAudioUploaded:(ge,Te)=>{ue(ge),se(Te)},username:s,threeSpeakApiKey:c,disabled:pe||!!Fe}),!x&&c&&e.jsx(Kd,{onVideoUploaded:(ge,Te,Pe,He)=>{ve(ge),He&&ke(URL.createObjectURL(He))},username:s,ecencyToken:o,threeSpeakApiKey:c,disabled:pe||!!de}),!g&&e.jsx("button",{type:"button",onClick:()=>le(!0),className:ft,title:"Emoji",disabled:te,children:e.jsx(O.Smile,{className:"h-4 w-4"})}),!v&&d&&e.jsx("button",{type:"button",onClick:()=>Ie(!0),className:`${ft} text-xs font-bold px-2`,title:"GIF",disabled:te,children:"GIF"}),!y&&f&&Ge.length>0&&e.jsx("button",{type:"button",onClick:()=>Ne(!0),className:ft,title:"Insert template",disabled:te,children:e.jsx(O.FileText,{className:"h-4 w-4"})}),!_&&e.jsx("button",{type:"button",onClick:()=>at(!0),className:`${ft} ${Tt?"text-blue-400":""}`,title:Tt?"Edit poll":"Create poll",disabled:te,children:e.jsx(O.BarChart3,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"relative",children:[jt&&e.jsx("div",{className:"absolute inset-0 z-10 bg-blue-900/30 border-2 border-dashed border-blue-500 rounded-lg flex items-center justify-center",children:e.jsx("span",{className:"text-blue-300 font-medium text-sm",children:"Drop image to upload"})}),St&&e.jsx("div",{className:"absolute inset-0 z-10 bg-gray-900/80 rounded-lg flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-blue-400 border-t-transparent rounded-full animate-spin"}),"Uploading image..."]})}),e.jsx("textarea",{ref:_t,value:q,onChange:ge=>B(ge.target.value),onKeyDown:Mt,onPaste:Oe,placeholder:o?`${n}
1124
+ ${de}`),ge},clear:()=>{B(""),ue(null),ae(0),ve(null),fe&&URL.revokeObjectURL(fe),ke(null),Bt(null),E?.(null)}}),()=>{F&&(F.current=null)}));const Mt=ge=>{ge.key==="Enter"&&(ge.metaKey||ge.ctrlKey)&&(ge.preventDefault(),Dt()),ge.key==="Escape"&&r&&r()},$t=()=>{ue(null),ae(0)},Yt=()=>{fe&&URL.revokeObjectURL(fe),ve(null),ke(null)},Et=k.useCallback(()=>{if(!q.trim())return null;const ge=q.split(/(```[\s\S]*?```)/g);let Te=0;return e.jsx("div",{className:"space-y-2",children:ge.map((Pe,He)=>{if(Pe.startsWith("```")&&Pe.endsWith("```")){const xt=Pe.slice(3,-3).replace(/^\w*\n?/,""),Je=Te++;return e.jsxs("div",{className:"relative group rounded-lg overflow-hidden",children:[e.jsx("pre",{className:"bg-gray-950 text-green-400 p-3 rounded-lg text-xs overflow-x-auto font-mono",children:e.jsx("code",{children:xt.trim()||" "})}),e.jsx("button",{type:"button",onClick:()=>X(xt.trim(),Je),className:"absolute top-2 right-2 p-1.5 rounded-md bg-gray-800 hover:bg-gray-700 text-gray-400 hover:text-white transition-colors opacity-0 group-hover:opacity-100",title:"Copy code",children:Se===Je?e.jsx(O.Check,{className:"h-3.5 w-3.5 text-green-400"}):e.jsx(O.Copy,{className:"h-3.5 w-3.5"})})]},He)}const Ue=Pe.split(/(`[^`]+`)/g);return e.jsx("span",{children:Ue.map((xt,Je)=>{if(xt.startsWith("`")&&xt.endsWith("`")){const cr=xt.slice(1,-1);return e.jsx("code",{className:"bg-gray-800 text-amber-400 px-1.5 py-0.5 rounded text-xs font-mono cursor-pointer hover:bg-gray-700 transition-colors",title:"Click to copy",onClick:()=>navigator.clipboard.writeText(cr),children:cr},Je)}return xt.trim()?e.jsx("span",{className:"text-gray-300 text-sm",children:xt},Je):null})},He)})})},[q,Se,X]),ft="p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50";return e.jsxs("div",{className:`p-4 md:p-6 space-y-3 rounded-xl border transition-colors ${jt?"border-blue-500 bg-blue-900/10":""}`,style:{backgroundColor:jt?void 0:G||"#111827",borderColor:jt?void 0:ne||"#374151"},onDragEnter:Xe,onDragLeave:Ve,onDragOver:ze,onDrop:bt,children:[T&&e.jsx("h3",{className:"text-white font-semibold text-base",children:T}),!Y&&e.jsxs("div",{className:"flex items-center justify-start space-x-3 text-left",children:[e.jsx("div",{className:"flex-shrink-0",children:s?e.jsx("img",{src:`https://images.hive.blog/u/${s}/avatar`,alt:s,className:"w-10 h-10 rounded-full object-cover border-2 border-gray-600",onError:ge=>{ge.target.src=`https://ui-avatars.com/api/?name=${s}&background=random`}}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-gray-700 flex items-center justify-center",children:e.jsx(O.User,{className:"w-6 h-6 text-gray-400"})})}),e.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[e.jsx("div",{className:"text-sm text-white font-medium",children:s?`@${s}`:"Anonymous"}),a&&e.jsxs("div",{className:"text-xs text-gray-400",children:["Replying to @",a]})]})]}),Ce&&q.trim()&&e.jsxs("div",{className:"rounded-lg border border-gray-700 bg-gray-800/50 overflow-hidden max-h-[300px] flex flex-col",children:[e.jsxs("div",{className:"px-3 py-2 text-xs uppercase tracking-wide text-gray-400 bg-gray-800 border-b border-gray-700 flex items-center justify-between shrink-0",children:[e.jsx("span",{children:"Preview"}),(q.includes("```")||/`[^`]+`/.test(q))&&e.jsx("span",{className:"text-[10px] text-gray-500 normal-case",children:"Hover code blocks to copy"})]}),e.jsx("div",{className:"p-3 overflow-y-auto",style:{scrollbarWidth:"thin"},children:kt?e.jsx("div",{className:"rendered-body text-white text-sm overflow-x-auto prose prose-invert prose-sm max-w-none",dangerouslySetInnerHTML:{__html:kt(q)}}):Et()})]}),Fe&&e.jsxs("div",{className:"rounded-lg border border-gray-700 bg-gray-800 overflow-hidden",children:[e.jsx("div",{className:"relative",style:{height:"60px",overflow:"hidden"},children:e.jsx("iframe",{src:Fe,title:"Audio preview",className:"w-full border-0 absolute top-0 left-0",style:{height:"200px"},allow:"autoplay; encrypted-media",loading:"lazy"})}),e.jsxs("div",{className:"flex items-center gap-2 border-t border-gray-700 px-3 py-1.5",children:[e.jsxs("span",{className:"flex-1 truncate text-xs text-gray-400",children:["Audio attached",Re>0?` (${Math.floor(Re/60)}:${String(Re%60).padStart(2,"0")})`:""]}),e.jsx("button",{type:"button",onClick:$t,className:"shrink-0 rounded p-1.5 text-gray-400 hover:text-red-400 hover:bg-gray-700 transition-colors",title:"Remove audio",children:e.jsx(O.X,{className:"h-4 w-4"})})]})]}),de&&e.jsxs("div",{className:"rounded-lg border border-gray-700 bg-gray-800 overflow-hidden",children:[fe?e.jsx("video",{src:fe,controls:!0,playsInline:!0,preload:"metadata",className:"w-full",style:{maxHeight:"200px"}}):e.jsx("div",{className:"h-20 flex items-center justify-center text-gray-400 text-xs",children:"Video attached"}),e.jsxs("div",{className:"flex items-center gap-2 border-t border-gray-700 px-3 py-1.5",children:[e.jsx("span",{className:"flex-1 truncate text-xs text-gray-400",children:"Video attached"}),e.jsx("button",{type:"button",onClick:Yt,className:"shrink-0 rounded p-0.5 text-gray-400 hover:text-red-400",title:"Remove video",children:e.jsx(O.X,{className:"h-3.5 w-3.5"})})]})]}),Tt&&e.jsx("div",{className:"rounded-lg border border-gray-700 bg-gray-800 overflow-hidden",children:e.jsxs("div",{className:"px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx(O.BarChart3,{className:"h-3.5 w-3.5 shrink-0 text-blue-400"}),e.jsx("span",{className:"flex-1 truncate text-xs font-medium text-white",children:Tt.question}),e.jsx("button",{type:"button",onClick:()=>at(!0),className:"shrink-0 rounded p-0.5 text-gray-400 hover:bg-gray-700 hover:text-white",title:"Edit poll",children:e.jsx(O.Code,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:()=>{Bt(null),E?.(null)},className:"shrink-0 rounded p-0.5 text-gray-400 hover:bg-gray-700 hover:text-red-400",title:"Remove poll",children:e.jsx(O.X,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:Tt.choices.map((ge,Te)=>e.jsx("span",{className:"rounded-full bg-gray-700 px-2 py-0.5 text-xs text-gray-300",children:ge},Te))}),e.jsxs("div",{className:"mt-1.5 text-[10px] text-gray-500",children:["Ends ",new Date(Tt.end_time*1e3).toLocaleDateString()," · Max ",Tt.max_choices_voted," choice",Tt.max_choices_voted>1?"s":""]})]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-gray-700 pb-2",children:[!m&&e.jsx("button",{type:"button",onClick:()=>Me(ge=>!ge),className:`${ft} ${Ce?"bg-gray-700 text-blue-400":""}`,title:Ce?"Hide preview":"Show preview",disabled:te,children:Ce?e.jsx(O.EyeOff,{className:"h-4 w-4"}):e.jsx(O.Eye,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-1"}),!h&&e.jsx("button",{type:"button",onClick:()=>Ut("**","**"),className:ft,title:"Bold",disabled:te,children:e.jsx(O.Bold,{className:"h-4 w-4"})}),!u&&e.jsx("button",{type:"button",onClick:()=>Ut("*","*"),className:ft,title:"Italic",disabled:te,children:e.jsx(O.Italic,{className:"h-4 w-4"})}),!p&&e.jsx("button",{type:"button",onClick:()=>Ut("[","](url)"),className:ft,title:"Link",disabled:te,children:e.jsx(O.Link,{className:"h-4 w-4"})}),!N&&e.jsx("button",{type:"button",onClick:P,className:ft,title:"Code block",disabled:te,children:e.jsx(O.Code,{className:"h-4 w-4"})}),!j&&e.jsx("button",{type:"button",onClick:I,className:ft,title:a?`Mention @${a}`:"Mention",disabled:te,children:e.jsx(O.AtSign,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-1"}),!b&&o&&e.jsx(Xd,{onImageUploaded:ge=>S(`![Image](${ge})`),ecencyToken:o,disabled:te}),!w&&c&&e.jsx(Zd,{onAudioUploaded:(ge,Te)=>{ue(ge),ae(Te)},username:s,threeSpeakApiKey:c,disabled:pe||!!Fe}),!x&&c&&e.jsx(Kd,{onVideoUploaded:(ge,Te,Pe,He)=>{ve(ge),He&&ke(URL.createObjectURL(He))},username:s,ecencyToken:o,threeSpeakApiKey:c,disabled:pe||!!de}),!g&&e.jsx("button",{type:"button",onClick:()=>le(!0),className:ft,title:"Emoji",disabled:te,children:e.jsx(O.Smile,{className:"h-4 w-4"})}),!v&&d&&e.jsx("button",{type:"button",onClick:()=>Ie(!0),className:`${ft} text-xs font-bold px-2`,title:"GIF",disabled:te,children:"GIF"}),!y&&f&&Ge.length>0&&e.jsx("button",{type:"button",onClick:()=>Ne(!0),className:ft,title:"Insert template",disabled:te,children:e.jsx(O.FileText,{className:"h-4 w-4"})}),!_&&e.jsx("button",{type:"button",onClick:()=>at(!0),className:`${ft} ${Tt?"text-blue-400":""}`,title:Tt?"Edit poll":"Create poll",disabled:te,children:e.jsx(O.BarChart3,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"relative",children:[jt&&e.jsx("div",{className:"absolute inset-0 z-10 bg-blue-900/30 border-2 border-dashed border-blue-500 rounded-lg flex items-center justify-center",children:e.jsx("span",{className:"text-blue-300 font-medium text-sm",children:"Drop image to upload"})}),St&&e.jsx("div",{className:"absolute inset-0 z-10 bg-gray-900/80 rounded-lg flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-blue-400 border-t-transparent rounded-full animate-spin"}),"Uploading image..."]})}),e.jsx("textarea",{ref:_t,value:q,onChange:ge=>B(ge.target.value),onKeyDown:Mt,onPaste:Oe,placeholder:o?`${n}
1125
1125
  (Paste or drag & drop images here)`:n,disabled:te,rows:4,className:"w-full min-h-[100px] max-h-[300px] p-3 border border-gray-700 rounded-lg resize-y focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-gray-800 text-white placeholder-gray-500 transition-colors duration-200 disabled:opacity-50 text-sm font-mono",onInput:ge=>{const Te=ge.target;Te.style.height="auto",Te.style.height=Te.scrollHeight+"px"}})]}),!z&&e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsxs("div",{className:"text-xs text-gray-500",children:[navigator.platform?.includes("Mac")?"Cmd":"Ctrl","+Enter to post",o&&e.jsx("span",{className:"ml-2",children:"| Paste/drop images"})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[A&&r&&e.jsx("button",{onClick:r,disabled:te,className:"px-4 py-2 text-gray-400 hover:text-white transition-colors disabled:opacity-50",children:"Cancel"}),e.jsx("button",{onClick:Dt,disabled:te||!q.trim(),className:"px-6 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-700 text-white rounded-lg font-medium transition-all disabled:opacity-50 flex items-center space-x-2",children:pe?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),e.jsx("span",{children:"Posting..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(O.Send,{className:"w-4 h-4"}),e.jsx("span",{children:C})]})})]})]}),e.jsx(Qd,{isOpen:_e,onClose:()=>Ie(!1),onSelectGif:ge=>{S(`![GIF](${ge})`),Ie(!1)},giphyApiKey:d}),e.jsx(e0,{isOpen:K,onClose:()=>le(!1),onSelectEmoji:ge=>{S(ge),le(!1)}}),e.jsx(t0,{isOpen:oe,onClose:()=>Ne(!1),onSelectTemplate:S,templates:Ge,authorFromUrl:a}),e.jsx(r0,{isOpen:Ke,onClose:()=>at(!1),onSave:ge=>{Bt(ge),E?.(ge)},initialData:Tt})]})},xs=gs,Lp=({parentAuthor:t,parentPermlink:r,onClose:s,onCommentSubmitted:n,currentUser:a,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f})=>{const[l,h]=k.useState(!1),u=async p=>{if(!(!p.trim()||l)){h(!0);try{await n(t,r,p),s()}catch(b){console.error("Failed to submit reply:",b)}finally{h(!1)}}};return k.useEffect(()=>{const p=b=>{b.key==="Escape"&&s()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[s]),e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-gray-700 bg-gray-900/50",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"p-2 bg-blue-900 rounded-lg",children:e.jsx(O.Send,{className:"w-5 h-5 text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-white",children:"Reply to Comment"}),e.jsxs("p",{className:"text-sm text-gray-400",children:["@",t]})]})]}),e.jsx("button",{onClick:s,disabled:l,className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200 disabled:opacity-50",children:e.jsx(O.X,{className:"w-6 h-6 text-gray-400"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(xs,{onSubmit:u,onCancel:s,currentUser:a,parentAuthor:t,parentPermlink:r,placeholder:`Reply to @${t}...`,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f})}),e.jsx("div",{className:"p-4 md:p-6 border-t border-gray-700 bg-gray-900/50",children:e.jsxs("div",{className:"flex items-center justify-between text-xs md:text-sm text-gray-400",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("span",{children:"• Markdown supported"}),e.jsx("span",{children:"• Be respectful"})]}),e.jsx("div",{className:"hidden md:block",children:"Press Esc to close"})]})})]})})},Mp=({isVisible:t,searchQuery:r,onSearchChange:s,onClose:n})=>{const a=k.useRef(null);k.useEffect(()=>{t&&a.current&&a.current.focus()},[t]);const i=()=>{s(""),n()};return e.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-in-out ${t?"max-h-20 opacity-100":"max-h-0 opacity-0"}`,children:e.jsx("div",{className:"p-4 border-b border-gray-700 bg-gray-900/30",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx("input",{ref:a,type:"text",value:r,onChange:o=>s(o.target.value),placeholder:"Search comments and authors...",className:"w-full pl-10 pr-10 py-2 bg-gray-800 border border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-white placeholder-gray-400 transition-colors duration-200"}),r&&e.jsx("button",{onClick:()=>s(""),className:"absolute right-8 top-1/2 transform -translate-y-1/2 p-1 rounded-full hover:bg-gray-700 transition-colors duration-200",children:e.jsx(O.X,{className:"w-4 h-4 text-gray-400"})}),e.jsx("button",{onClick:i,className:"absolute right-3 top-1/2 transform -translate-y-1/2 p-1 rounded-full hover:bg-gray-700 transition-colors duration-200",children:e.jsx(O.X,{className:"w-4 h-4 text-gray-400"})})]})})})},Do=({author:t,permlink:r,onClose:s,currentUser:n,token:a,onClickCommentUpvote:i,onClickCommentReply:o,onClickUpvoteButton:c,onSubmitComment:d,ecencyToken:f,threeSpeakApiKey:l,giphyApiKey:h,templateToken:u,templateApiBaseUrl:p})=>{const[b,w]=k.useState([]),[x,g]=k.useState([]),[v,N]=k.useState(!0),[j,y]=k.useState(null),[m,_]=k.useState(null),[E,A]=k.useState(!1),[C,T]=k.useState(""),[D,L]=k.useState(!1),[H,V]=k.useState(!1),z=k.useCallback(async(xe=!1)=>{xe?V(!0):N(!0),y(null);try{const U=await Nt.getCommentsList(t,r,n??"");w(U),g(U)}catch(U){y(U instanceof Error?U.message:"Failed to load comments")}finally{N(!1),V(!1)}},[t,r]);k.useEffect(()=>{z()},[z]),k.useEffect(()=>{if(!C.trim())g(b);else{const xe=b.filter(U=>U.body?.toLowerCase().includes(C.toLowerCase())||U.author.toLowerCase().includes(C.toLowerCase()));g(xe)}},[C,b]);const F=(xe,U)=>{_({author:xe,permlink:U})},Y=xe=>{xe.target===xe.currentTarget&&s()},G=async(xe,U,q)=>{if(d){try{await Promise.resolve(d(xe,U,q)),L(!1),V(!0),setTimeout(async()=>{await z(!0),V(!1)},3e3)}catch(B){const pe=B instanceof Error?B.message:"Failed to post comment";alert(pe)}return}if(!a){alert("Please login to comment");return}try{await Nt.handleComment({author:xe,permlink:U,body:q,authToken:a}),L(!1),V(!0),setTimeout(async()=>{await z(!0),V(!1)},3e3)}catch(B){const pe=B instanceof Error?B.message:"Failed to post comment";alert(pe)}},ne=k.useMemo(()=>{if(!n?.trim())return x;const xe=n.toLowerCase();return[...x].sort((U,q)=>{const B=U.author?.toLowerCase()===xe,pe=q.author?.toLowerCase()===xe;return B&&!pe?-1:!B&&pe?1:0})},[x,n]),ie=ne.filter(xe=>xe.parent_author===t&&xe.parent_permlink===r);return v?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4 h-screen",children:e.jsx("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl h-[90vh] flex flex-col",children:e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx(O.Loader2,{className:"w-12 h-12 animate-spin text-blue-500 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-300",children:"Loading comments..."})]})})})}):j?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-40 p-4 h-screen",onClick:Y,children:e.jsx("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-4xl h-[90vh] flex flex-col overflow-hidden",children:e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsxs("div",{className:"text-center p-6",children:[e.jsx(O.AlertCircle,{className:"w-16 h-16 text-red-500 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"Failed to load comments"}),e.jsx("p",{className:"text-gray-300 mb-6",children:j}),e.jsx("button",{onClick:()=>z(),className:"px-6 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg transition-colors duration-200",children:"Try Again"})]})})})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-40 p-4 h-screen",onClick:Y,children:e.jsxs("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-4xl h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex justify-between items-center p-4 md:p-6 border-b border-gray-700 bg-gray-900/50",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("h2",{className:"text-lg md:text-xl font-bold text-white",children:["Comments (",b.length,")"]}),H&&e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin text-blue-500"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>z(!0),disabled:H,className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200 disabled:opacity-50",title:"Refresh comments",children:e.jsx(O.RefreshCw,{className:`w-5 h-5 text-gray-400 ${H?"animate-spin":""}`})}),e.jsx("button",{onClick:()=>A(!E),className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200",title:"Search comments",children:e.jsx(O.Search,{className:"w-5 h-5 text-gray-400"})}),e.jsx("button",{onClick:s,className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200",children:e.jsx(O.X,{className:"w-6 h-6 text-gray-400"})})]})]}),e.jsx(Mp,{isVisible:E,searchQuery:C,onSearchChange:T,onClose:()=>A(!1)}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[D&&e.jsx("div",{className:"border-b border-gray-700",children:e.jsx(xs,{onSubmit:xe=>G(t,r,xe),onCancel:()=>L(!1),currentUser:n,placeholder:"Add a comment...",ecencyToken:f,threeSpeakApiKey:l,giphyApiKey:h,templateToken:u,templateApiBaseUrl:p})}),ie.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8 text-center",children:[e.jsx(O.MessageCirclePlus,{className:"w-16 h-16 text-gray-600 mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:C?"No comments found":"No comments yet"}),e.jsx("p",{className:"text-gray-400 mb-6",children:C?"Try adjusting your search terms":"Be the first to share your thoughts!"}),!C&&n&&e.jsx("button",{onClick:()=>L(!0),className:"px-6 py-3 bg-blue-500 hover:bg-blue-600 text-white rounded-lg font-medium transition-colors duration-200",children:"Add Comment"})]}):e.jsx("div",{className:"divide-y divide-gray-700",children:ie.map(xe=>e.jsx(To,{comment:xe,allComments:ne,onReply:F,currentUser:n,token:a,searchQuery:C,depth:0,onVotedRefresh:()=>z(!0),onClickCommentUpvote:i,onClickCommentReply:o,onClickUpvoteButton:c},xe.permlink))})]}),!D&&n&&ie.length>0&&e.jsx("div",{className:"p-4 md:p-6 border-t border-gray-700 bg-gray-900/50",children:e.jsxs("button",{onClick:()=>L(!0),className:"w-full md:w-auto px-6 py-3 bg-blue-500 hover:bg-blue-600 text-white rounded-lg font-medium transition-all duration-200 transform hover:scale-[1.02] flex items-center justify-center space-x-2",children:[e.jsx(O.MessageCirclePlus,{className:"w-5 h-5"}),e.jsx("span",{children:"Add Comment"})]})})]})}),m&&e.jsx(Lp,{parentAuthor:m.author,parentPermlink:m.permlink,onClose:()=>_(null),onCommentSubmitted:G,currentUser:n,ecencyToken:f,threeSpeakApiKey:l,giphyApiKey:h,templateToken:u,templateApiBaseUrl:p})]})};function Rp(t){const r=typeof t=="string"?new Date(t):t,s=Math.floor((Date.now()-r.getTime())/1e3),n={year:31536e3,month:2628e3,day:86400,hour:3600,minute:60};for(const[a,i]of Object.entries(n)){const o=Math.floor(s/i);if(o>1)return`${o} ${a}s ago`;if(o===1)return`${o} ${a} ago`}return"just now"}const Po=({author:t,permlink:r,onClose:s,currentUser:n,token:a,onClickUpvoteButton:i})=>{const[o,c]=k.useState([]),[d,f]=k.useState(!0),[l,h]=k.useState(!1),u=!!n&&o.some(_=>_.voter===n),[p,b]=k.useState(!1),[w,x]=k.useState(""),[g,v]=k.useState(!1),N=_=>{x(_),b(!0),setTimeout(()=>b(!1),2500)},j=async()=>{f(!0);const _=await Nt.getActiveVotes(t,r);_.sort((E,A)=>!E.time||!A.time?0:new Date(A.time).getTime()-new Date(E.time).getTime()),c(_),f(!1)};k.useEffect(()=>{j()},[t,r]);const y=_=>{_.target===_.currentTarget&&s()},m=async _=>{if(!a||!n){alert("Please login to upvote");return}try{const E=Math.round(_*100);await Nt.handleUpvote({author:t,permlink:r,weight:E,authToken:a}),h(!1),v(!0),setTimeout(async()=>{await j(),v(!1),N("Vote submitted successfully ✅"),s()},3e3)}catch(E){const A=E instanceof Error?E.message:"Failed to upvote";alert(A)}};return e.jsxs("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 px-4 h-screen",onClick:y,children:[e.jsxs("div",{className:"relative bg-gray-800 rounded-xl shadow-2xl w-full max-w-md max-h-[80vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 md:p-6 border-b border-gray-700 bg-gray-900/50 flex items-center justify-between",children:[e.jsxs("h2",{className:"text-lg font-bold text-white flex items-center space-x-2",children:[e.jsxs("span",{children:["Voters (",o.length,")"]}),g&&e.jsx("span",{className:"inline-flex items-center ml-2",children:e.jsx("span",{className:"w-4 h-4 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})})]}),!l&&e.jsx("button",{onClick:()=>{if(i){i(n,a);return}if(!n||!a){N("Please login to upvote");return}u?N("You have already upvoted this post"):h(!0)},"aria-label":"Open Vote Slider",className:"p-1 hover:bg-gray-700 rounded",type:"button",children:e.jsx(O.ThumbsUp,{className:`w-5 h-5 ${u?"text-blue-400 fill-current":"text-gray-300"}`})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d?e.jsx("div",{className:"flex justify-center items-center h-full p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500"})}):l&&!u?e.jsx(Vn,{author:t,permlink:r,onUpvote:m,onCancel:()=>h(!1)}):e.jsx("ul",{children:o.map(_=>e.jsxs("li",{className:"flex items-center p-4 border-b border-gray-700",children:[e.jsx("img",{src:`https://images.hive.blog/u/${_.voter}/avatar`,alt:_.voter,className:"w-10 h-10 rounded-full mr-4",onError:E=>{E.target.src=`https://ui-avatars.com/api/?name=${_.voter}&background=random`}}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-white",children:_.voter}),e.jsxs("div",{className:"text-sm text-gray-400",children:[((_.percent||0)/100).toFixed(0),"%",_.time&&` · ${Rp(_.time+"Z")}`]})]})]},_.voter))})})]}),p&&e.jsx("div",{className:"fixed bottom-4 right-4 w-[280px] z-50",children:e.jsx("div",{className:"bg-gray-800 text-white rounded px-3 py-2 shadow-lg text-sm",children:w})})]})},s0=({isOpen:t,onClose:r,title:s,children:n,maxWidth:a="max-w-2xl"})=>t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),e.jsxs("div",{className:`relative bg-card border border-border rounded-xl shadow-xl w-full mx-4 ${a} max-h-[90vh] overflow-hidden animate-scale-in`,children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[e.jsx("h2",{className:"text-xl font-bold text-card-foreground",children:s}),e.jsx("button",{onClick:r,className:"p-2 rounded-lg hover:bg-muted transition-colors",children:e.jsx(O.X,{className:"w-5 h-5 text-muted-foreground"})})]}),e.jsx("div",{className:"overflow-y-auto max-h-[calc(90vh-80px)] custom-scrollbar",children:n})]})]}):null,$p=({author:t,permlink:r,content:s,onClose:n})=>e.jsx(s0,{isOpen:!0,onClose:n,title:"Video Description",maxWidth:"max-w-2xl",children:e.jsxs("div",{className:"p-6",children:[s?e.jsx("div",{className:"prose prose-sm max-w-none",children:e.jsx("div",{className:"bg-muted/30 rounded-lg p-4",children:e.jsx("pre",{className:"whitespace-pre-wrap text-sm text-card-foreground font-sans leading-relaxed",children:s})})}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(O.FileText,{className:"w-12 h-12 text-muted-foreground mx-auto mb-2"}),e.jsx("p",{className:"text-muted-foreground",children:"No description available"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"This video doesn't have a description yet."})]}),e.jsx("div",{className:"mt-6 pt-4 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("span",{children:["By @",t]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["/",r]})]})})]})}),Ip=({username:t,permlink:r,onAuthorClick:s,onVideoClick:n,onTagClick:a,onBack:i,onCommentsModal:o,onUpvotesModal:c,onDescriptionModal:d,onVideoInfo:f,onShare:l,onBookmark:h}={})=>{const u=t,p=r,[b,w]=k.useState(null),[x,g]=k.useState(!0),[v,N]=k.useState(null),[j,y]=k.useState(!1),[m,_]=k.useState(null),[E,A]=k.useState(!1),[C,T]=k.useState(!1),[D,L]=k.useState(!1),[H,V]=k.useState(!1),z=k.useRef(null),F=k.useRef(null),Y=k.useRef(null);k.useEffect(()=>{(async()=>{if(!(!u||!p))try{g(!0),N(null);const B=await Nt.getVideoDetails(u,p);w(B),y(!1),_(null)}catch(B){N(B instanceof Error?B.message:"Failed to load video")}finally{g(!1)}})()},[u,p]);const G=q=>q?q.startsWith("ipfs://")?`https://ipfs-3speak.b-cdn.net/ipfs/${q.replace("ipfs://","").split("/")[0]}/manifest.m3u8`:q:"";k.useEffect(()=>((async()=>{const B=b?.video_v2;if(!j||!B||!z.current)return;const pe=z.current,ee=G(B);F.current&&(F.current.destroy(),F.current=null),pe.src="",pe.load();try{let te=!1;const _e=()=>{te||(te=!0,pe.play().then(()=>_(null)).catch(Ce=>_(`Playback failed: ${Ce.message}`)))};if(ja.isSupported()){const Ce=new ja({debug:!1,enableWorker:!1,lowLatencyMode:!1,backBufferLength:90,maxLoadingDelay:4,maxBufferLength:30,maxMaxBufferLength:600,startLevel:-1});F.current=Ce,Ce.on(ja.Events.MANIFEST_PARSED,()=>{}),Ce.on(ja.Events.ERROR,(Me,Fe)=>{if(Fe.fatal)switch(Fe.type){case ja.ErrorTypes.NETWORK_ERROR:_("Network error, retrying..."),setTimeout(()=>Ce.startLoad(),1e3);break;case ja.ErrorTypes.MEDIA_ERROR:_("Media error, retrying..."),setTimeout(()=>Ce.recoverMediaError(),1e3);break;default:_(`Fatal error: ${Fe.details}`),Ce.destroy(),F.current=null;break}}),Ce.attachMedia(pe),Ce.loadSource(ee)}else if(pe.canPlayType("application/vnd.apple.mpegurl"))pe.src=ee;else{const Ce=ee.replace("/manifest.m3u8","/480p/index.m3u8");pe.src=Ce}const Ie=()=>A(!0),K=()=>{A(!1),_e()},le=Ce=>{const Me=Ce.target;_(`Video error: ${Me.error?.message||"Unknown error"}`),A(!1)},oe=()=>A(!1);pe.addEventListener("loadstart",Ie),pe.addEventListener("canplay",K),pe.addEventListener("error",le),pe.addEventListener("loadeddata",oe);const Ne=async()=>{const Ce=!!document.fullscreenElement;try{Ce?"orientation"in screen&&await(screen.orientation?.lock?.("landscape")??Promise.resolve()):"orientation"in screen&&screen.orientation?.unlock?.()}catch{}};return document.addEventListener("fullscreenchange",Ne),Y.current=()=>{document.removeEventListener("fullscreenchange",Ne)},()=>{pe.removeEventListener("loadstart",Ie),pe.removeEventListener("canplay",K),pe.removeEventListener("error",le),pe.removeEventListener("loadeddata",oe),Y.current&&Y.current()}}catch(te){_(`Setup error: ${te instanceof Error?te.message:"Unknown"}`)}})(),()=>{F.current&&(F.current.destroy(),F.current=null)}),[j,b?.video_v2]);const ne=()=>{if(!b?.video_v2){_("No video source available");return}y(!0),_(null),A(!0)},ie=q=>{n&&n(q)},xe=q=>{s&&s(q)},U=q=>{if(!q)return"00:00";const B=Math.floor(q),pe=Math.floor(B/3600),ee=Math.floor(B%3600/60),te=B%60,_e=Ie=>Ie.toString().padStart(2,"0");return B<60?`00:${_e(te)}`:pe===0?`${_e(ee)}:${_e(te)}`:`${_e(pe)}:${_e(ee)}:${_e(te)}`};return x?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("div",{className:"sticky top-0 z-50 w-full bg-background border-b border-border",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsx("div",{className:"h-8 w-24 bg-muted rounded-full animate-pulse"})})}),e.jsx("div",{className:"container mx-auto px-4 py-8 max-w-6xl",children:e.jsxs("div",{className:"animate-pulse space-y-6",children:[e.jsx("div",{className:"aspect-video bg-muted rounded-xl"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-6 bg-muted rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-muted rounded w-1/2"})]})]})})]}):v||!b?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"text-center max-w-md mx-auto px-4",children:[e.jsx("h2",{className:"text-xl font-semibold text-card-foreground mb-2",children:"Failed to Load Video"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:v||"Video not found"}),e.jsxs("button",{onClick:()=>{i&&i()},className:"inline-flex items-center gap-2 px-4 py-2 bg-card border border-border text-card-foreground rounded-lg hover:bg-card-hover transition-colors",children:[e.jsx(O.ArrowLeft,{className:"w-4 h-4"}),"Go Back"]})]})}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("div",{className:"sticky top-0 z-50 w-full bg-background/95 backdrop-blur-sm border-b border-border",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsxs("button",{onClick:()=>{i&&i()},className:"inline-flex items-center gap-2 text-muted-foreground hover:text-card-foreground transition-colors",children:[e.jsx(O.ArrowLeft,{className:"w-4 h-4"}),"Back"]})})}),e.jsx("div",{className:"container mx-auto px-4 py-8 max-w-6xl",children:e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsx("div",{className:"w-full aspect-video bg-black rounded-xl overflow-hidden relative shadow-card",children:j?e.jsxs("div",{className:"relative w-full h-full",children:[e.jsx("video",{ref:z,controls:!0,poster:xa(b.thumbnail),className:"w-full h-full object-contain bg-black",onDoubleClick:async q=>{const B=q.currentTarget;try{document.fullscreenElement?await document.exitFullscreen():await B.requestFullscreen()}catch{}}}),E&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary"})}),m&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/80",children:e.jsxs("div",{className:"text-center text-white",children:[e.jsx("p",{className:"mb-4",children:m}),e.jsx("button",{onClick:()=>{y(!1),_(null)},className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary-hover transition-colors",children:"Try Again"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("img",{src:xa(b.thumbnail)||`https://images.hive.blog/u/${b.owner}/avatar`,alt:b.title,className:"w-full h-full object-cover",onError:q=>{q.target.src=`https://images.hive.blog/u/${b.owner}/avatar`}}),e.jsx("div",{className:"absolute inset-0 bg-gradient-overlay opacity-30"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("button",{onClick:ne,className:"bg-primary hover:bg-primary-hover rounded-full p-6 transform hover:scale-110 transition-all duration-300 shadow-lg",children:e.jsx(O.Play,{className:"w-8 h-8 text-primary-foreground ml-1",fill:"currentColor"})})}),b.duration&&e.jsxs("div",{className:"absolute bottom-4 right-4 bg-black/80 text-white text-sm px-3 py-1 rounded-md flex items-center gap-1 backdrop-blur-sm",children:[e.jsx(O.Clock,{className:"w-3 h-3"}),U(b.duration)]}),b.views&&e.jsxs("div",{className:"absolute bottom-4 left-4 bg-black/80 text-white text-sm px-3 py-1 rounded-md flex items-center gap-1 backdrop-blur-sm",children:[e.jsx(O.Eye,{className:"w-3 h-3"}),b.views.toLocaleString()," views"]})]})}),e.jsx(nd,{title:b.title||"",author:b.owner||"",permlink:b.permlink||"",createdAt:b.created,description:b.description||"",video:{title:b.title||"",author:b.owner||"",permlink:b.permlink||"",created:b.created||new Date,category:b.category||"",numOfUpvotes:void 0,numOfComments:void 0,hiveValue:void 0,duration:b.duration,thumbnail:b.thumbnail,views:b.views},onTapComment:()=>{o?o(u,p):T(!0)},onTapUpvote:()=>{c?c(u,p):L(!0)},onTapInfo:()=>{d?d(u,p,b.description||""):V(!0)},onTapAuthor:()=>{s&&s(b.owner)},onTapShare:()=>{l&&l(u,p)},onTapBookmark:()=>{h&&h(u,p)}}),b.tags&&e.jsx("div",{className:"flex flex-wrap gap-2",children:b.tags.split(",").map((q,B)=>e.jsxs("span",{className:"bg-primary/10 text-primary px-3 py-1 rounded-full text-sm font-medium hover:bg-primary/20 transition-colors cursor-pointer",onClick:()=>{a&&a(q.trim())},children:["#",q.trim()]},B))})]}),e.jsxs("div",{className:"bg-card border border-border rounded-xl p-6 sticky top-24",children:[e.jsx("h3",{className:"font-semibold text-card-foreground mb-4 text-lg",children:"Related Videos"}),e.jsx("div",{className:"space-y-4",children:e.jsx(_n,{feedType:er.RELATED,username:b.owner,onVideoClick:ie,onAuthorClick:xe})})]})]})}),C&&u&&p&&e.jsx(Do,{author:u,permlink:p,onClose:()=>T(!1)}),D&&u&&p&&e.jsx(Po,{author:u,permlink:p,onClose:()=>L(!1)}),H&&u&&p&&e.jsx($p,{author:u,permlink:p,content:b.description||"",onClose:()=>V(!1)})]})};var n0={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},qc=k.createContext&&k.createContext(n0),Fp=["attr","size","title"];function Bp(t,r){if(t==null)return{};var s,n,a=Vp(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)s=i[n],r.indexOf(s)===-1&&{}.propertyIsEnumerable.call(t,s)&&(a[s]=t[s])}return a}function Vp(t,r){if(t==null)return{};var s={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;s[n]=t[n]}return s}function wn(){return wn=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var s=arguments[r];for(var n in s)({}).hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},wn.apply(null,arguments)}function zc(t,r){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),s.push.apply(s,n)}return s}function Nn(t){for(var r=1;r<arguments.length;r++){var s=arguments[r]!=null?arguments[r]:{};r%2?zc(Object(s),!0).forEach(function(n){Up(t,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):zc(Object(s)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(s,n))})}return t}function Up(t,r,s){return(r=qp(r))in t?Object.defineProperty(t,r,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[r]=s,t}function qp(t){var r=zp(t,"string");return typeof r=="symbol"?r:r+""}function zp(t,r){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var n=s.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function i0(t){return t&&t.map((r,s)=>k.createElement(r.tag,Nn({key:s},r.attr),i0(r.child)))}function Jt(t){return r=>k.createElement(Hp,wn({attr:Nn({},t.attr)},r),i0(t.child))}function Hp(t){var r=s=>{var{attr:n,size:a,title:i}=t,o=Bp(t,Fp),c=a||s.size||"1em",d;return s.className&&(d=s.className),t.className&&(d=(d?d+" ":"")+t.className),k.createElement("svg",wn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},s.attr,n,o,{className:d,style:Nn(Nn({color:t.color||s.color},s.style),t.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),i&&k.createElement("title",null,i),t.children)};return qc!==void 0?k.createElement(qc.Consumer,null,s=>r(s)):r(n0)}function Wp(t){return Jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M461.2 128H80c-8.84 0-16-7.16-16-16s7.16-16 16-16h384c8.84 0 16-7.16 16-16 0-26.51-21.49-48-48-48H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h397.2c28.02 0 50.8-21.53 50.8-48V176c0-26.47-22.78-48-50.8-48zM416 336c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32z"},child:[]}]})(t)}function Gp(t){return Jt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M96 224c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm448 0c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm32 32h-64c-17.6 0-33.5 7.1-45.1 18.6 40.3 22.1 68.9 62 75.1 109.4h66c17.7 0 32-14.3 32-32v-32c0-35.3-28.7-64-64-64zm-256 0c61.9 0 112-50.1 112-112S381.9 32 320 32 208 82.1 208 144s50.1 112 112 112zm76.8 32h-8.3c-20.8 10-43.9 16-68.5 16s-47.6-6-68.5-16h-8.3C179.6 288 128 339.6 128 403.2V432c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48v-28.8c0-63.6-51.6-115.2-115.2-115.2zm-223.7-13.4C161.5 263.1 145.6 256 128 256H64c-35.3 0-64 28.7-64 64v32c0 17.7 14.3 32 32 32h65.9c6.3-47.4 34.9-87.3 75.2-109.4z"},child:[]}]})(t)}function Jp(t){return Jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M480 160H32c-17.673 0-32-14.327-32-32V64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24z"},child:[]}]})(t)}function Yp(t){return Jt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M560 224h-29.5c-8.8-20-21.6-37.7-37.4-52.5L512 96h-32c-29.4 0-55.4 13.5-73 34.3-7.6-1.1-15.1-2.3-23-2.3H256c-77.4 0-141.9 55-156.8 128H56c-14.8 0-26.5-13.5-23.5-28.8C34.7 215.8 45.4 208 57 208h1c3.3 0 6-2.7 6-6v-20c0-3.3-2.7-6-6-6-28.5 0-53.9 20.4-57.5 48.6C-3.9 258.8 22.7 288 56 288h40c0 52.2 25.4 98.1 64 127.3V496c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16v-48h128v48c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16v-80.7c11.8-8.9 22.3-19.4 31.3-31.3H560c8.8 0 16-7.2 16-16V240c0-8.8-7.2-16-16-16zm-128 64c-8.8 0-16-7.2-16-16s7.2-16 16-16 16 7.2 16 16-7.2 16-16 16zM256 96h128c5.4 0 10.7.4 15.9.8 0-.3.1-.5.1-.8 0-53-43-96-96-96s-96 43-96 96c0 2.1.5 4.1.6 6.2 15.2-3.9 31-6.2 47.4-6.2z"},child:[]}]})(t)}function Xp(t){return Jt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M608 64H32C14.33 64 0 78.33 0 96v320c0 17.67 14.33 32 32 32h576c17.67 0 32-14.33 32-32V96c0-17.67-14.33-32-32-32zM48 400v-64c35.35 0 64 28.65 64 64H48zm0-224v-64h64c0 35.35-28.65 64-64 64zm272 176c-44.19 0-80-42.99-80-96 0-53.02 35.82-96 80-96s80 42.98 80 96c0 53.03-35.83 96-80 96zm272 48h-64c0-35.35 28.65-64 64-64v64zm0-224c-35.35 0-64-28.65-64-64h64v64z"},child:[]}]})(t)}function Zp(t){return Jt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M621.16 54.46C582.37 38.19 543.55 32 504.75 32c-123.17-.01-246.33 62.34-369.5 62.34-30.89 0-61.76-3.92-92.65-13.72-3.47-1.1-6.95-1.62-10.35-1.62C15.04 79 0 92.32 0 110.81v317.26c0 12.63 7.23 24.6 18.84 29.46C57.63 473.81 96.45 480 135.25 480c123.17 0 246.34-62.35 369.51-62.35 30.89 0 61.76 3.92 92.65 13.72 3.47 1.1 6.95 1.62 10.35 1.62 17.21 0 32.25-13.32 32.25-31.81V83.93c-.01-12.64-7.24-24.6-18.85-29.47zM48 132.22c20.12 5.04 41.12 7.57 62.72 8.93C104.84 170.54 79 192.69 48 192.69v-60.47zm0 285v-47.78c34.37 0 62.18 27.27 63.71 61.4-22.53-1.81-43.59-6.31-63.71-13.62zM320 352c-44.19 0-80-42.99-80-96 0-53.02 35.82-96 80-96s80 42.98 80 96c0 53.03-35.83 96-80 96zm272 27.78c-17.52-4.39-35.71-6.85-54.32-8.44 5.87-26.08 27.5-45.88 54.32-49.28v57.72zm0-236.11c-30.89-3.91-54.86-29.7-55.81-61.55 19.54 2.17 38.09 6.23 55.81 12.66v48.89z"},child:[]}]})(t)}function Ki(t){return Jt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M624 416H381.54c-.74 19.81-14.71 32-32.74 32H288c-18.69 0-33.02-17.47-32.77-32H16c-8.8 0-16 7.2-16 16v16c0 35.2 28.8 64 64 64h512c35.2 0 64-28.8 64-64v-16c0-8.8-7.2-16-16-16zM576 48c0-26.4-21.6-48-48-48H112C85.6 0 64 21.6 64 48v336h512V48zm-64 272H128V64h384v256z"},child:[]}]})(t)}function Kp(t){return Jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M473.7 73.8l-2.4-2.5c-46-47-118-51.7-169.6-14.8L336 159.9l-96 64 48 128-144-144 96-64-28.6-86.5C159.7 19.6 87 24 40.7 71.4l-2.4 2.4C-10.4 123.6-12.5 202.9 31 256l212.1 218.6c7.1 7.3 18.6 7.3 25.7 0L481 255.9c43.5-53 41.4-132.3-7.3-182.1z"},child:[]}]})(t)}function Hc(t){return Jt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M275.3 250.5c7 7.4 18.4 7.4 25.5 0l108.9-114.2c31.6-33.2 29.8-88.2-5.6-118.8-30.8-26.7-76.7-21.9-104.9 7.7L288 36.9l-11.1-11.6C248.7-4.4 202.8-9.2 172 17.5c-35.3 30.6-37.2 85.6-5.6 118.8l108.9 114.2zm290 77.6c-11.8-10.7-30.2-10-42.6 0L430.3 402c-11.3 9.1-25.4 14-40 14H272c-8.8 0-16-7.2-16-16s7.2-16 16-16h78.3c15.9 0 30.7-10.9 33.3-26.6 3.3-20-12.1-37.4-31.6-37.4H192c-27 0-53.1 9.3-74.1 26.3L71.4 384H16c-8.8 0-16 7.2-16 16v96c0 8.8 7.2 16 16 16h356.8c14.5 0 28.6-4.9 40-14L564 377c15.2-12.1 16.4-35.3 1.3-48.9z"},child:[]}]})(t)}function Qp(t){return Jt({attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z"},child:[]}]})(t)}function mo(t){return Jt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"},child:[]}]})(t)}function eg(t){return Jt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M160 224v64h320v-64c0-35.3 28.7-64 64-64h32c0-53-43-96-96-96H160c-53 0-96 43-96 96h32c35.3 0 64 28.7 64 64zm416-32h-32c-17.7 0-32 14.3-32 32v96H128v-96c0-17.7-14.3-32-32-32H64c-35.3 0-64 28.7-64 64 0 23.6 13 44 32 55.1V432c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16v-16h384v16c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16V311.1c19-11.1 32-31.5 32-55.1 0-35.3-28.7-64-64-64z"},child:[]}]})(t)}function tg(t){return Jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 405.3V448c0 35.3 86 64 192 64s192-28.7 192-64v-42.7C342.7 434.4 267.2 448 192 448S41.3 434.4 0 405.3zM320 128c106 0 192-28.7 192-64S426 0 320 0 128 28.7 128 64s86 64 192 64zM0 300.4V352c0 35.3 86 64 192 64s192-28.7 192-64v-51.6c-41.3 34-116.9 51.6-192 51.6S41.3 334.4 0 300.4zm416 11c57.3-11.1 96-31.7 96-55.4v-42.7c-23.2 16.4-57.3 27.6-96 34.5v63.6zM192 160C86 160 0 195.8 0 240s86 80 192 80 192-35.8 192-80-86-80-192-80zm219.3 56.3c60-10.8 100.7-32 100.7-56.3v-42.7c-35.5 25.1-96.5 38.6-160.7 41.8 29.5 14.3 51.2 33.5 60 57.2z"},child:[]}]})(t)}function rg(t){return Jt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 384H64V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-32c0-8.84-7.16-16-16-16zM464 96H345.94c-21.38 0-32.09 25.85-16.97 40.97l32.4 32.4L288 242.75l-73.37-73.37c-12.5-12.5-32.76-12.5-45.25 0l-68.69 68.69c-6.25 6.25-6.25 16.38 0 22.63l22.62 22.62c6.25 6.25 16.38 6.25 22.63 0L192 237.25l73.37 73.37c12.5 12.5 32.76 12.5 45.25 0l96-96 32.4 32.4c15.12 15.12 40.97 4.41 40.97-16.97V112c.01-8.84-7.15-16-15.99-16z"},child:[]}]})(t)}function ag(t){return Jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M436 480h-20V24c0-13.255-10.745-24-24-24H56C42.745 0 32 10.745 32 24v456H12c-6.627 0-12 5.373-12 12v20h448v-20c0-6.627-5.373-12-12-12zM128 76c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12V76zm0 96c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40zm52 148h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12zm76 160h-64v-84c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v84zm64-172c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40zm0-96c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40zm0-96c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12V76c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40z"},child:[]}]})(t)}function o0(t){return Jt({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M296 160H180.6l42.6-129.8C227.2 15 215.7 0 200 0H56C44 0 33.8 8.9 32.2 20.8l-32 240C-1.7 275.2 9.5 288 24 288h118.7L96.6 482.5c-3.6 15.2 8 29.5 23.3 29.5 8.4 0 16.4-4.4 20.8-12l176-304c9.3-15.9-2.2-36-20.7-36z"},child:[]}]})(t)}function sg(t){return Jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"},child:[]}]})(t)}function ng(t){return Jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(t)}function ig(t){return Jt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z"},child:[]}]})(t)}const Oo=new D0.Client(["https://api.hive.blog"]),og=async t=>{try{const r=await Oo.database.getAccounts([t]);if(!r||r.length===0)throw new Error("Account not found");return r[0]}catch(r){return console.error("Error in getWalletDataDetail:",r),{error:r instanceof Error?r.message:"Unknown error"}}},lg=async t=>{try{const r=await Oo.database.getDynamicGlobalProperties(),s=parseFloat(t.split(" ")[0]),n=parseFloat(String(r.total_vesting_shares).split(" ")[0]),a=parseFloat(String(r.total_vesting_fund_hive).split(" ")[0]);return(s*a/n).toFixed(3)}catch(r){return console.error("Error in convertVestingSharesToHiveData:",r),"0"}},ug=async t=>{try{const s=(await Oo.database.call("get_feed_history",[])).current_median_history,n=parseFloat(s.base.split(" ")[0]),a=typeof t=="string"?parseFloat(t):t;return(n*a).toFixed(2)}catch(r){return console.error("Error in convertHivetoUSDData:",r),"0"}},cg=async(t,r=100)=>{const n=await(await fetch("https://api.hive.blog/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:0,jsonrpc:"2.0",method:"condenser_api.get_account_history",params:[t,-1,r,"4",null]})})).json();if(n.error)throw new Error(n.error.message||"Failed to fetch transactions");return(n.result||[]).filter(i=>i[1]?.op?.[0]==="transfer").map(i=>{const[o,c]=i,d=c.op[1];return{id:o,timestamp:c.timestamp,type:d.from===t?"sent":"received",amount:d.amount,from:d.from,to:d.to,memo:d.memo||"",trx_id:c.trx_id}}).reverse()},l0=td.create(t=>({walletData:null,isLoading:!1,error:null,transactions:[],isLoadingTransactions:!1,transactionError:null,setWalletData:r=>t({walletData:r}),clearWalletData:()=>t({walletData:null,error:null,transactions:[],transactionError:null}),fetchWalletData:async r=>{t({isLoading:!0,error:null});try{const s=await og(r),n=w=>"error"in w;if(!s||n(s))throw new Error(n(s)?s.error:"Account not found");const a=typeof s.vesting_shares=="string"?s.vesting_shares:"0.000000 VESTS",i=typeof s.balance=="string"?s.balance:s.balance.toString(),o=typeof s.hbd_balance=="string"?s.hbd_balance:s.hbd_balance.toString(),c=typeof s.savings_balance=="string"?s.savings_balance:s.savings_balance.toString(),d=typeof s.savings_hbd_balance=="string"?s.savings_hbd_balance:s.savings_hbd_balance.toString(),f=await lg(a),l=parseFloat(i.split(" ")[0]||"0"),h=parseFloat(f),u=(l+h).toFixed(3),p=await ug(u),b={balance:i,hbd_balance:o,savings_balance:c,savings_hbd_balance:d,hive_power:`${f} HP`,estimated_value:`$${p}`};return t({walletData:b}),b}catch(s){const n=s instanceof Error?s.message:"Failed to fetch wallet data";console.error("Wallet fetch error:",n);const a={balance:"0.000 HIVE",hbd_balance:"0.000 HBD",savings_balance:"0.000 HIVE",savings_hbd_balance:"0.000 HBD",hive_power:"0 HP",estimated_value:"$0.00",error:n};return t({walletData:a,error:n}),a}finally{t({isLoading:!1})}},fetchTransactions:async(r,s=100)=>{t({isLoadingTransactions:!0,transactionError:null});try{const n=await cg(r,s);return t({transactions:n}),n}catch(n){const a=n instanceof Error?n.message:"Failed to fetch transactions";return console.error("Transaction fetch error:",a),t({transactionError:a}),[]}finally{t({isLoadingTransactions:!1})}}}));function dg(t){const r=new Date,s=new Date(t+"Z"),n=r.getTime()-s.getTime(),a=Math.floor(n/1e3),i=Math.floor(a/60),o=Math.floor(i/60),c=Math.floor(o/24);return c>30?s.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):c>0?`${c}d ago`:o>0?`${o}h ago`:i>0?`${i}m ago`:"just now"}const fg=({tx:t})=>{const r=t.type==="sent",s=r?t.to:t.from;return e.jsxs("div",{className:"flex items-center gap-3 p-3.5 rounded-lg bg-gray-800 border border-gray-700 mb-2 transition-all duration-200 hover:bg-gray-750 hover:border-gray-600",children:[e.jsx("div",{className:`p-2 rounded-full flex items-center justify-center flex-shrink-0 ${r?"bg-red-500/15 text-red-400":"bg-emerald-500/15 text-emerald-400"}`,children:r?e.jsx(sg,{size:12}):e.jsx(ig,{size:12})}),e.jsx("img",{src:`https://images.hive.blog/u/${s}/avatar`,alt:s,className:"w-9 h-9 rounded-full flex-shrink-0 border-2 border-gray-600",onError:n=>{n.target.src=`https://ui-avatars.com/api/?name=${s}&background=random&size=36`}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx("span",{className:"text-sm font-semibold text-gray-200 truncate",children:s})}),e.jsxs("div",{className:"text-xs text-gray-500 mt-0.5",children:[r?"Sent":"Received"," · ",dg(t.timestamp)]})]}),e.jsx("div",{className:"text-right flex-shrink-0",children:e.jsxs("div",{className:`text-sm font-bold ${r?"text-red-400":"text-emerald-400"}`,children:[r?"-":"+",t.amount]})})]})},u0=({username:t,className:r=""})=>{const{walletData:s,fetchWalletData:n,isLoading:a,error:i,transactions:o,fetchTransactions:c,isLoadingTransactions:d,transactionError:f}=l0();k.useEffect(()=>{t&&(n(t),c(t))},[t,n,c]);const l=({label:h,value:u,icon:p,iconBgClass:b="bg-blue-500/15",iconTextClass:w="text-blue-400",valueClass:x="text-gray-200"})=>e.jsxs("div",{className:"flex items-center justify-between p-3.5 rounded-lg bg-gray-800 border border-gray-700 mb-2.5 transition-all duration-200 hover:bg-gray-750 hover:border-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[p&&e.jsx("div",{className:`p-2 rounded-full flex items-center justify-center ${b} ${w}`,children:p}),e.jsx("span",{className:"font-semibold text-sm text-gray-300",children:h})]}),e.jsx("span",{className:`font-medium text-sm ${x}`,children:u??"-"})]});return e.jsx("div",{className:`p-4 transition-all duration-300 ${r}`,children:e.jsxs("div",{className:"max-w-md mx-auto",children:[e.jsxs("div",{className:"flex flex-col items-center p-5 mb-5 rounded-xl bg-gray-800 border border-gray-700",children:[t&&e.jsx("img",{src:`https://images.hive.blog/u/${t}/avatar`,alt:`${t} avatar`,className:"w-16 h-16 rounded-full border-3 border-blue-500/30 mb-2.5 transition-transform hover:scale-105",onError:h=>{h.target.src=`https://ui-avatars.com/api/?name=${t}&background=random`}}),e.jsx("div",{className:"text-base font-bold text-white",children:t}),e.jsx("div",{className:"text-xs text-gray-400",children:"Hive Wallet Overview"})]}),e.jsxs("div",{className:"text-center rounded-xl bg-gradient-to-r from-blue-600 to-purple-600 p-5 mb-5 transition-all duration-300 hover:from-blue-500 hover:to-purple-500 shadow-lg shadow-blue-500/10",children:[e.jsx("div",{className:"text-xs font-semibold text-blue-100/80",children:"Estimated Value"}),e.jsx("div",{className:"text-2xl font-bold mt-1.5 text-white",children:a?e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),e.jsx("span",{className:"text-lg",children:"Loading..."})]}):s?.estimated_value??"-"})]}),i&&e.jsxs("div",{className:"flex items-center p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 mb-4 text-sm",children:[e.jsx(mo,{className:"mr-2 flex-shrink-0"}),e.jsx("span",{children:i})]}),e.jsx(l,{label:"Balance",value:s?.balance,icon:e.jsx(Wp,{}),iconBgClass:"bg-blue-500/15",iconTextClass:"text-blue-400",valueClass:"text-blue-300"}),e.jsx(l,{label:"HBD Balance",value:s?.hbd_balance,icon:e.jsx(Xp,{}),iconBgClass:"bg-emerald-500/15",iconTextClass:"text-emerald-400",valueClass:"text-emerald-300"}),e.jsx(l,{label:"Savings Balance",value:s?.savings_balance,icon:e.jsx(Yp,{}),iconBgClass:"bg-amber-500/15",iconTextClass:"text-amber-400",valueClass:"text-amber-300"}),e.jsx(l,{label:"Savings HBD",value:s?.savings_hbd_balance,icon:e.jsx(tg,{}),iconBgClass:"bg-purple-500/15",iconTextClass:"text-purple-400",valueClass:"text-purple-300"}),e.jsx(l,{label:"Hive Power",value:s?.hive_power,icon:e.jsx(o0,{}),iconBgClass:"bg-orange-500/15",iconTextClass:"text-orange-400",valueClass:"text-orange-300"}),e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 px-1",children:[e.jsx("h3",{className:"text-sm font-bold text-gray-300 tracking-wide uppercase",children:"Transaction History"}),o.length>0&&e.jsxs("span",{className:"text-xs text-gray-500",children:[o.length," transactions"]})]}),d&&e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-gray-600 border-t-blue-400 rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-gray-400",children:"Loading transactions..."})]})}),f&&e.jsxs("div",{className:"flex items-center p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 mb-4 text-sm",children:[e.jsx(mo,{className:"mr-2 flex-shrink-0"}),e.jsx("span",{children:f})]}),!d&&!f&&o.length===0&&e.jsx("div",{className:"text-center p-8 rounded-lg bg-gray-800 border border-gray-700",children:e.jsx("p",{className:"text-sm text-gray-500",children:"No transactions found"})}),!d&&t&&o.map(h=>e.jsx(fg,{tx:h},h.trx_id+h.id))]})]})})};function c0({sort:t="trending",tag:r="",observer:s="hive.blog",limit:n=20,showSortDropdown:a=!0,theme:i="dark",onAuthorClick:o,onPostClick:c,onCommunityClick:d,onPayoutClick:f,onUpvoteClick:l,onCommentClick:h,onReblogClick:u}){const[p,b]=k.useState([]),[w,x]=k.useState(!0),[g,v]=k.useState(null),[N,j]=k.useState(t),[y,m]=k.useState(!0),[_,E]=k.useState(!1),A=k.useRef(null);new Bn.DefaultRenderer({baseUrl:"https://hive.blog/",breaks:!0,skipSanitization:!1,allowInsecureScriptTags:!1,addNofollowToLinks:!0,doNotShowImages:!1,assetsWidth:640,assetsHeight:480,imageProxyFn:z=>z,usertagUrlFn:z=>`/@${z}`,hashtagUrlFn:z=>`/trending/${z}`,isLinkSafeFn:z=>!0,addExternalCssClassToMatchingLinksFn:z=>!0,ipfsPrefix:"https://ipfs.io/ipfs/"});const C=k.useCallback(async(z,F=!1)=>{F?E(!0):(x(!0),m(!0)),v(null);try{const Y=F&&p.length>0?p[p.length-1]:null,G=await Nt.getRankedPosts(z,r,s,n,Y?.author,Y?.permlink);F?(b(ne=>{const ie=new Set(ne.map(U=>U.post_id)),xe=G.filter(U=>!ie.has(U.post_id));return[...ne,...xe]}),m(G.length===n)):(b(G),m(G.length===n))}catch(Y){v(Y instanceof Error?Y.message:"Failed to load posts"),m(!1)}finally{x(!1),E(!1)}},[r,s,n,p]),T=k.useCallback(()=>{!_&&y&&!w&&C(N,!0)},[_,y,w,N,C]);k.useEffect(()=>{C(N)},[N,r,s,n]),k.useEffect(()=>{const z=new IntersectionObserver(F=>{F[0].isIntersecting&&T()},{threshold:1});return A.current&&z.observe(A.current),()=>{A.current&&z.unobserve(A.current)}},[T]);const D=z=>{j(z),b([]),m(!0)},L=z=>z>=1e6?`${(z/1e6).toFixed(1)}M`:z>=1e3?`${(z/1e3).toFixed(1)}K`:z.toString(),H=z=>{const F=z.payout*.5,Y=z.payout*.5,ne=(z.beneficiaries.find(ie=>ie.account==="commentrewarder")?.weight||0)/1e4*100;return{pending:`$${z.payout.toFixed(2)}`,breakdown:`${F.toFixed(2)} HBD, ${Y.toFixed(2)} HP`,commentRewarder:`${ne.toFixed(2)}%`,payoutInDays:Math.ceil((new Date(z.payout_at).getTime()-Date.now())/(1e3*60*60*24))}},V=z=>{const Y=(z.body||"").replace(/!\[[^\]]*\]\([^)]+\)/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^#+\s*/gm,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/<[^>]*>/g,"").replace(/\n+/g," ").trim();return Y.length>200?Y.substring(0,200)+"...":Y};return w?e.jsx("div",{className:"flex justify-center items-center min-h-[400px]",children:e.jsx(O.Loader2,{className:"w-8 h-8 animate-spin"})}):g?e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-card-foreground",children:"Failed to load posts"}),e.jsx("p",{className:"text-muted-foreground",children:g}),e.jsx("button",{onClick:()=>C(N),className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90",children:"Retry"})]}):e.jsx("div",{className:i==="dark"?"dark":"",children:e.jsxs("div",{className:`space-y-6 p-2 ${i==="dark"?"bg-slate-950":"bg-white"}`,children:[a&&e.jsx("div",{className:"flex justify-center",children:e.jsxs("select",{value:N,onChange:z=>D(z.target.value),className:`px-4 py-2 border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary ${i==="dark"?"bg-slate-950 text-white":"bg-card text-card-foreground"}`,children:[e.jsx("option",{value:"trending",children:"Trending"}),e.jsx("option",{value:"hot",children:"Hot"}),e.jsx("option",{value:"created",children:"New"})]})}),e.jsxs("div",{className:"space-y-4",children:[p.map(z=>{const F=z.json_metadata?.image?.[0],Y=H(z);return e.jsxs("div",{className:`border border-border rounded-xl p-4 shadow-card hover:shadow-card-hover transition-shadow ${i==="dark"?"bg-slate-900 text-white":"bg-slate-50 text-black"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 flex-wrap",children:[e.jsx("img",{src:`https://images.hive.blog/u/${z.author}/avatar`,alt:z.author,className:"w-8 h-8 rounded-full cursor-pointer flex-shrink-0",onClick:()=>o?.(z.author,`https://images.hive.blog/u/${z.author}/avatar`),onError:G=>{G.target.src=`https://ui-avatars.com/api/?name=${z.author}&background=random`}}),e.jsx("span",{className:"font-medium cursor-pointer hover:text-primary",onClick:()=>o?.(z.author,`https://images.hive.blog/u/${z.author}/avatar`),children:z.author}),e.jsxs("span",{className:i==="dark"?"text-gray-400":"text-muted-foreground",children:["(",z.author_reputation.toFixed(2),")"]}),e.jsx("span",{className:`cursor-pointer hover:text-primary ${i==="dark"?"text-gray-400":"text-muted-foreground"}`,onClick:()=>d?.(z.community_title),children:z.community_title}),e.jsx("span",{className:`hidden sm:inline ${i==="dark"?"text-gray-400":"text-muted-foreground"}`,children:"•"}),e.jsx("span",{className:`text-sm ${i==="dark"?"text-gray-400":"text-muted-foreground"}`,children:bs.formatDistanceToNow(new Date(z.created+"Z"),{addSuffix:!0})})]}),e.jsxs("div",{className:"flex gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-shrink-0",children:F?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:F.startsWith("http")?F:`https://images.hive.blog/u/320x0/${F}`,alt:z.title,className:"w-20 h-20 sm:w-32 sm:h-32 object-cover rounded-lg cursor-pointer",onClick:()=>c?.(z),onError:G=>{G.target.src!==`https://images.hive.blog/u/${z.author}/avatar`?G.target.src=`https://images.hive.blog/u/${z.author}/avatar`:G.target.src="https://images.hive.blog/u/null/avatar"}}),(()=>{const G=z.body?.match(/!\[[^\]]*\]\(([^)]+)\)/g)?.map(ne=>{const ie=ne.match(/\(([^)]+)\)/);return ie?ie[1]:null}).filter(Boolean)||[];return G.length>0?e.jsx("div",{className:"absolute -bottom-1 -right-1 sm:-bottom-2 sm:-right-2 flex space-x-1",children:G.slice(0,3).map((ne,ie)=>e.jsx("img",{src:ne,alt:`body-image-${ie}`,className:"w-6 h-6 sm:w-8 sm:h-8 object-cover rounded border-2 border-white shadow-sm cursor-pointer",onClick:xe=>{xe.stopPropagation();const U=xe.currentTarget.parentElement?.parentElement?.querySelector("img:not(.w-6):not(.w-8)");U&&(U.src=ne)}},ie))}):null})()]}):e.jsx("img",{src:`https://images.hive.blog/u/${z.author}/avatar`,alt:z.author,className:"w-20 h-20 sm:w-32 sm:h-32 rounded-lg cursor-pointer",onClick:()=>c?.(z)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold text-base sm:text-lg mb-1 sm:mb-2 cursor-pointer hover:text-primary line-clamp-2",onClick:()=>c?.(z),children:z.title}),e.jsx("p",{className:`mb-2 sm:mb-3 line-clamp-2 sm:line-clamp-3 cursor-pointer hover:text-primary text-sm sm:text-base ${i==="dark"?"text-gray-300":"text-gray-600"}`,onClick:()=>c?.(z),children:z.json_metadata?.description||V(z)||"No description available"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"relative group",children:[e.jsxs("span",{className:"font-semibold text-green-600 cursor-pointer hover:text-green-700 text-sm sm:text-base",onClick:()=>f?.(z.payout),children:["$",z.payout.toFixed(2)]}),e.jsxs("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block bg-black text-white text-xs p-2 rounded shadow-lg whitespace-nowrap z-10",children:[e.jsxs("div",{children:["Pending payout amount: ",Y.pending]}),e.jsxs("div",{children:["Breakdown: ",Y.breakdown]}),e.jsxs("div",{children:["commentrewarder: ",Y.commentRewarder]}),e.jsxs("div",{children:["Payout in ",Y.payoutInDays," days"]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 sm:gap-4",children:[e.jsxs("div",{className:`flex items-center gap-1 hover:text-primary transition-colors cursor-pointer ${i==="dark"?"text-gray-400":"text-muted-foreground"}`,onClick:()=>l?.(z),children:[e.jsx(O.ThumbsUp,{className:"w-3 h-3 sm:w-4 sm:h-4"}),e.jsx("span",{className:"text-xs sm:text-sm",children:L(z.stats.total_votes)})]}),e.jsxs("div",{className:`flex items-center gap-1 hover:text-blue-400 transition-colors cursor-pointer ${i==="dark"?"text-blue-400":"text-blue-600"}`,onClick:()=>h?.(z),children:[e.jsx(O.MessageCircle,{className:"w-3 h-3 sm:w-4 sm:h-4"}),e.jsx("span",{className:"text-xs sm:text-sm",children:L(z.children)})]}),e.jsxs("div",{className:`flex items-center gap-1 hover:text-gray-400 transition-colors cursor-pointer ${i==="dark"?"text-gray-400":"text-gray-600"}`,onClick:()=>u?.(z),children:[e.jsx(O.Repeat2,{className:"w-3 h-3 sm:w-4 sm:h-4"}),e.jsx("span",{className:"text-xs sm:text-sm",children:L(z.reblogs)})]})]})]})]})]})]},z.post_id)}),_&&e.jsxs("div",{className:"flex justify-center items-center py-4",children:[e.jsx(O.Loader2,{className:"w-6 h-6 animate-spin"}),e.jsx("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-muted-foreground"}`,children:"Loading more posts..."})]}),y&&!_&&e.jsx("div",{ref:A,className:"h-10"})]})]})})}class Ca{static instance;static getInstance(){return Ca.instance||(Ca.instance=new Ca),Ca.instance}async getProposals(r){return r==="expired"?this.getExpiredProposals():this.getActiveProposals()}async getActiveProposals(){try{const n=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{accept:"application/json, text/plain, */*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,hi;q=0.7","content-type":"application/json",origin:"https://peakd.com","sec-ch-ua":'"Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"cross-site","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"},body:JSON.stringify({id:72,jsonrpc:"2.0",method:"database_api.list_proposals",params:{start:[-1],limit:500,order:"by_total_votes",order_direction:"descending",status:"votable"}})})).json()).result.proposals,i=await(await fetch("https://stats.hivehub.dev/dhf_proposals")).json(),o={};i.forEach(h=>{o[h.proposal_id]=h});const f=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{accept:"application/json, text/plain, */*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,hi;q=0.7","content-type":"application/json",origin:"https://peakd.com","sec-ch-ua":'"Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"cross-site","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"},body:JSON.stringify({id:73,jsonrpc:"2.0",method:"database_api.list_proposal_votes",params:{start:["shaktimaaan"],limit:1e3,order:"by_voter_proposal",order_direction:"ascending",status:"votable"}})})).json()).result.proposal_votes||[],l={};return f.forEach(h=>{l[h.proposal.proposal_id]||(l[h.proposal.proposal_id]=[]),l[h.proposal.proposal_id].push(h)}),n.map(h=>{const u=h.id,p=o[u],b=l[u]||[],w=b.reduce((x,g)=>x+parseFloat(g.total_hbd||"0"),0);return{proposal_id:u,subject:h.subject,permlink:h.permlink,creator:h.creator,receiver:h.receiver,start_date:h.start_date,end_date:h.end_date,total_hbd_received:p?p.total_hbd_received:"0",max_hbd_remaining:p?p.max_hbd_remaining:"0",all_votes_num:h.total_votes||"0",all_votes_hp:p?p.all_votes_hp:w.toString(),votes:p?p.votes:b,status:h.status,daily_pay:h.daily_pay,total_votes:h.total_votes,daily_pay_hbd:h.daily_pay?Number(h.daily_pay.amount)/Math.pow(10,h.daily_pay.precision):0,remaining_days:Math.max(0,Math.ceil((new Date(h.end_date).getTime()-new Date().getTime())/(1e3*60*60*24))),vote_value_total:p?parseFloat(p.all_votes_hp):w}})}catch(r){return console.error("Error fetching active proposals:",r),[]}}async getExpiredProposals(){try{const n=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{accept:"application/json, text/plain, */*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,hi;q=0.7","content-type":"application/json",origin:"https://peakd.com","sec-ch-ua":'"Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"cross-site","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"},body:JSON.stringify({id:65,jsonrpc:"2.0",method:"database_api.list_proposals",params:{start:[-1],limit:500,order:"by_total_votes",order_direction:"descending",status:"expired"}})})).json()).result.proposals,i=await(await fetch("https://stats.hivehub.dev/dhf_proposals")).json(),o={};i.forEach(h=>{o[h.proposal_id]=h});const f=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{accept:"application/json, text/plain, */*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,hi;q=0.7","content-type":"application/json",origin:"https://peakd.com","sec-ch-ua":'"Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"cross-site","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"},body:JSON.stringify({id:76,jsonrpc:"2.0",method:"database_api.list_proposal_votes",params:{start:["shaktimaaan"],limit:1e3,order:"by_voter_proposal",order_direction:"ascending",status:"expired"}})})).json()).result.proposal_votes||[],l={};return f.forEach(h=>{l[h.proposal_id]||(l[h.proposal_id]=[]),l[h.proposal_id].push(h)}),n.map(h=>{const u=h.id,p=o[u],b=l[u]||[],w=b.reduce((x,g)=>x+parseFloat(g.total_hbd||"0"),0);return{proposal_id:u,subject:h.subject,permlink:h.permlink,creator:h.creator,receiver:h.receiver,start_date:h.start_date,end_date:h.end_date,total_hbd_received:p?p.total_hbd_received:"0",max_hbd_remaining:p?p.max_hbd_remaining:"0",all_votes_num:h.total_votes||"0",all_votes_hp:p?p.all_votes_hp:w.toString(),votes:p?p.votes:b,status:h.status,daily_pay:h.daily_pay,total_votes:h.total_votes,daily_pay_hbd:h.daily_pay?Number(h.daily_pay.amount)/Math.pow(10,h.daily_pay.precision):0,remaining_days:0,vote_value_total:p?parseFloat(p.all_votes_hp):w}})}catch(r){return console.error("Error fetching expired proposals:",r),[]}}}const Wc=Ca.getInstance(),hg=["All","Active","Upcoming","Expired","By Peak Projects"],d0=["Votes","Start Date","End Date","Creator"],Gc=t=>t==="By Peak Projects"?["Creator"]:d0,mr=t=>{const r=typeof t=="string"?parseFloat(t):t;return isNaN(r)?t.toString():r.toLocaleString()},Qi=t=>{const r=new Date(t.start_date),s=new Date(t.end_date);return`(${Math.ceil((s.getTime()-r.getTime())/(1e3*60*60*24))} days)`},mg=({onClickSupport:t,onClickVoteValue:r,onClickSelect:s,onClickUser:n,onClickAvatar:a,theme:i="dark"})=>{const[o,c]=k.useState([]),[d,f]=k.useState("All"),[l,h]=k.useState("Votes");k.useEffect(()=>{d==="By Peak Projects"&&!Gc(d).includes(l)?h("Creator"):d!=="By Peak Projects"&&l==="Creator"&&!d0.includes(l)&&h("Votes")},[d,l]);const[u,p]=k.useState(!0);k.useEffect(()=>{(async()=>{p(!0);try{const[g,v]=await Promise.all([Wc.getProposals("active"),Wc.getProposals("expired")]);c([...g,...v])}catch(g){console.error("Error fetching proposals:",g),c([])}p(!1)})()},[]);const b=o.filter(x=>d==="All"?x.status==="active"||new Date(x.start_date+"Z")>new Date:d==="Active"?x.status==="active":d==="Upcoming"?new Date(x.start_date+"Z")>new Date:d==="Expired"?new Date(x.end_date+"Z")<new Date:d==="By Peak Projects"?x.creator==="peakd":!0).sort((x,g)=>d==="By Peak Projects"?g.creator.localeCompare(x.creator):0),w=d==="All"?(()=>{const x=b.filter(N=>N.status==="active"),g=b.filter(N=>new Date(N.start_date+"Z")>new Date),v=(N,j)=>l==="Votes"?Number(j.all_votes_num)-Number(N.all_votes_num):l==="Start Date"?new Date(j.start_date+"Z").getTime()-new Date(N.start_date+"Z").getTime():l==="End Date"?new Date(N.end_date+"Z").getTime()-new Date(j.end_date+"Z").getTime():l==="Creator"?N.creator.localeCompare(j.creator):0;return[...x.sort(v),...g.sort(v)]})():b.sort((x,g)=>l==="Votes"?Number(g.all_votes_num)-Number(x.all_votes_num):l==="Start Date"?new Date(g.start_date+"Z").getTime()-new Date(x.start_date+"Z").getTime():l==="End Date"?new Date(x.end_date+"Z").getTime()-new Date(g.end_date+"Z").getTime():l==="Creator"?x.creator.localeCompare(g.creator):0);return u?e.jsx("div",{className:"flex justify-center items-center py-8",children:e.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:"Loading proposals..."})}):e.jsx("div",{className:i==="dark"?"dark":"",children:e.jsxs("div",{className:`space-y-6 p-2 ${i==="dark"?"bg-slate-950":"bg-white"}`,children:[e.jsx("div",{className:"flex gap-2 mb-4 flex-wrap",children:hg.map(x=>e.jsx("button",{className:`px-3 py-1 rounded text-sm ${d===x?"bg-blue-500 text-white":`${i==="dark"?"bg-slate-900 text-gray-300":"bg-gray-200 text-gray-700"}`}`,onClick:()=>f(x),children:x},x))}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:`${i==="dark"?"text-gray-300":"text-gray-700"} mr-2`,children:"Sort by:"}),e.jsx("select",{value:l,onChange:x=>h(x.target.value),className:`px-3 py-1 border rounded ${i==="dark"?"border-gray-600 bg-slate-900 text-gray-100":"border-gray-300 bg-white text-gray-900"}`,children:Gc(d).map(x=>e.jsx("option",{value:x,children:x},x))})]}),e.jsxs("div",{children:[d==="All"&&(()=>{const x=w.filter(v=>v.status==="active"),g=w.filter(v=>new Date(v.start_date+"Z")>new Date);return e.jsxs(e.Fragment,{children:[x.map(v=>e.jsx("div",{className:`border rounded-lg mb-4 p-2 sm:p-4 shadow ${i==="dark"?"border-gray-800 bg-slate-900":"border-gray-200 bg-white"}`,children:e.jsxs("div",{className:"flex flex-col sm:flex-row",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsx("span",{onClick:()=>a(v),className:"inline-block mr-2 cursor-pointer",children:e.jsx("img",{src:`https://images.hive.blog/u/${v.creator}/avatar`,className:"w-8 h-8 rounded-full inline",alt:`${v.creator} avatar`})}),e.jsxs("span",{className:`font-bold cursor-pointer ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>n(v),children:["by ",v.creator]}),v.receiver&&e.jsxs("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:["with receiver ",e.jsx("strong",{className:`${i==="dark"?"text-gray-100":"text-gray-900"}`,children:v.receiver})]})]}),e.jsxs("div",{className:`cursor-pointer text-lg font-semibold mb-1 ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>s(v),children:[v.subject," ",e.jsxs("span",{className:`cursor-pointer text-lg font-semibold mb-1 ${i==="dark"?"text-gray-500":"text-gray-600"}`,children:["#",v.proposal_id]})]}),e.jsxs("div",{className:`text-sm mb-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:[e.jsx("span",{className:`inline-block px-2 py-1 rounded text-xs font-medium ${new Date(v.start_date+"Z")>new Date?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":new Date(v.end_date+"Z")<new Date?"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200":v.status==="active"?"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"}`,children:new Date(v.start_date+"Z")>new Date?"upcoming":new Date(v.end_date+"Z")<new Date?"expired":v.status})," - "+new Date(v.start_date+"Z").toLocaleDateString()+" - "+new Date(v.end_date+"Z").toLocaleDateString()," ",e.jsx("span",{className:`text-xs ${i==="dark"?"text-gray-500":"text-gray-400"}`,children:Qi(v)})]}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>window.open(`https://peakd.com/${v.creator}/${v.permlink}`,"_blank"),className:"text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",title:"View on Peakd",children:e.jsx(O.ExternalLink,{size:16})}),e.jsxs("button",{onClick:()=>window.open(`https://hivehub.dev/proposals/${v.proposal_id}`,"_blank"),className:"flex text-green-500 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",title:"View Stats",children:[e.jsx(O.PieChart,{size:16})," Stats"]})]}),e.jsx("div",{className:"mb-2",children:e.jsxs("span",{className:`inline-block cursor-pointer px-2 py-1 rounded ${i==="dark"?"bg-gray-800 text-gray-300":"bg-gray-100 text-gray-700"}`,onClick:()=>r(v),children:["Vote value: ",v.vote_value_total?mr(v.vote_value_total):0," HP"]})})]}),e.jsxs("div",{className:"mt-4 sm:mt-0 sm:ml-4 w-full sm:w-48 flex flex-col space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Daily Pay:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[v.daily_pay_hbd?mr(v.daily_pay_hbd):0," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Remaining:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.remaining_days||0)," Days"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Paid:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.total_hbd_received||0)," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"To Pay:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.max_hbd_remaining||0)," HBD"]})]}),e.jsx("div",{className:"mt-2",children:e.jsx("button",{className:"px-3 sm:px-5 py-2 bg-green-600 hover:bg-green-700 text-white rounded cursor-pointer w-full text-xs sm:text-sm",onClick:()=>t(v),children:"Support"})})]})]})},v.proposal_id)),g.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"my-6 text-center",children:[e.jsx("h3",{className:`text-xl font-bold mb-2 ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:"Upcoming proposals"}),e.jsx("p",{className:`${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"The proposals listed below will start in the future. You can already support them."})]}),g.map(v=>e.jsx("div",{className:`border rounded-lg mb-4 p-2 sm:p-4 shadow ${i==="dark"?"border-gray-800 bg-slate-950":"border-gray-200 bg-white"}`,children:e.jsxs("div",{className:"flex flex-col sm:flex-row",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsx("span",{onClick:()=>a(v),className:"inline-block mr-2 cursor-pointer",children:e.jsx("img",{src:`https://images.hive.blog/u/${v.creator}/avatar`,className:"w-8 h-8 rounded-full inline",alt:`${v.creator} avatar`})}),e.jsx("span",{className:`font-bold cursor-pointer ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>n(v),children:v.creator}),e.jsxs("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:["with receiver ",e.jsx("strong",{className:`${i==="dark"?"text-gray-100":"text-gray-900"}`,children:v.receiver})]})]}),e.jsx("div",{className:`cursor-pointer text-lg font-semibold mb-1 ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>s(v),children:v.subject}),e.jsxs("div",{className:`text-sm mb-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:[e.jsx("span",{className:`inline-block px-2 py-1 rounded text-xs font-medium ${new Date(v.start_date+"Z")>new Date?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":new Date(v.end_date+"Z")<new Date?"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200":v.status==="active"?"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"}`,children:new Date(v.start_date+"Z")>new Date?"upcoming":new Date(v.end_date+"Z")<new Date?"expired":v.status})," - "+new Date(v.start_date+"Z").toLocaleDateString()+" - "+new Date(v.end_date+"Z").toLocaleDateString()," ",e.jsx("span",{className:`text-xs ${i==="dark"?"text-gray-500":"text-gray-400"}`,children:Qi(v)})]}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>window.open(`https://peakd.com/${v.creator}/${v.permlink}`,"_blank"),className:"text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",title:"View on Peakd",children:e.jsx(O.ExternalLink,{size:16})}),e.jsxs("button",{onClick:()=>window.open(`https://hivehub.dev/proposals/${v.proposal_id}`,"_blank"),className:"flex text-green-500 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",title:"View Stats",children:[e.jsx(O.PieChart,{size:16})," Stats"]})]}),e.jsx("div",{className:"mb-2",children:e.jsxs("span",{className:`inline-block cursor-pointer px-2 py-1 rounded ${i==="dark"?"bg-gray-800 text-gray-300":"bg-gray-100 text-gray-700"}`,onClick:()=>r(v),children:["Vote value: ",v.vote_value_total?mr(v.vote_value_total):0," HP"]})})]}),e.jsxs("div",{className:"mt-4 sm:mt-0 sm:ml-4 w-full sm:w-48 flex flex-col space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Daily Pay:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[v.daily_pay_hbd?mr(v.daily_pay_hbd):0," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Remaining:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.remaining_days||0)," Days"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Paid:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.total_hbd_received||0)," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"To Pay:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.max_hbd_remaining||0)," HBD"]})]}),e.jsx("div",{className:"mt-2",children:e.jsx("button",{className:"px-3 sm:px-5 py-2 bg-green-600 hover:bg-green-700 text-white rounded cursor-pointer w-full text-xs sm:text-sm",onClick:()=>t(v),children:"Support"})})]})]})},v.proposal_id))]})]})})(),d!=="All"&&w.map(x=>e.jsx("div",{className:`border rounded-lg mb-4 p-2 sm:p-4 shadow ${i==="dark"?"border-gray-800 bg-slate-950":"border-gray-200 bg-white"}`,children:e.jsxs("div",{className:"flex flex-col sm:flex-row",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsx("span",{onClick:()=>a(x),className:"inline-block mr-2 cursor-pointer",children:e.jsx("img",{src:`https://images.hive.blog/u/${x.creator}/avatar`,className:"w-8 h-8 rounded-full inline",alt:`${x.creator} avatar`})}),e.jsx("span",{className:`font-bold cursor-pointer ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>n(x),children:x.creator}),e.jsxs("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:["with receiver ",e.jsx("strong",{className:`${i==="dark"?"text-gray-100":"text-gray-900"}`,children:x.receiver})]})]}),e.jsxs("div",{className:`cursor-pointer text-lg font-semibold mb-1 ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>s(x),children:[x.subject," #",x.proposal_id]}),e.jsxs("div",{className:`text-sm mb-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:[e.jsx("span",{className:`inline-block px-2 py-1 rounded text-xs font-medium ${new Date(x.start_date+"Z")>new Date?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":new Date(x.end_date+"Z")<new Date?"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200":x.status==="active"?"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"}`,children:new Date(x.start_date+"Z")>new Date?"upcoming":new Date(x.end_date+"Z")<new Date?"expired":x.status})," - "+new Date(x.start_date+"Z").toLocaleDateString()+" - "+new Date(x.end_date+"Z").toLocaleDateString()," ",e.jsx("span",{className:`text-xs ${i==="dark"?"text-gray-500":"text-gray-400"}`,children:Qi(x)})]}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>window.open(`https://peakd.com/@${x.creator}/${x.permlink}`,"_blank"),className:"text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",title:"View on Peakd",children:e.jsx(O.ExternalLink,{size:16})}),e.jsxs("button",{onClick:()=>window.open(`https://hivehub.dev/proposals/${x.proposal_id}`,"_blank"),className:"flex text-green-500 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",title:"View Stats",children:[e.jsx(O.PieChart,{size:16})," Stats"]})]}),e.jsx("div",{className:"mb-2",children:e.jsxs("span",{className:`inline-block cursor-pointer px-2 py-1 rounded ${i==="dark"?"bg-gray-800 text-gray-300":"bg-gray-100 text-gray-700"}`,onClick:()=>r(x),children:["Vote value: ",x.vote_value_total?mr(x.vote_value_total):0," HP"]})})]}),e.jsxs("div",{className:"mt-4 sm:mt-0 sm:ml-4 w-full sm:w-48 flex flex-col space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"font-mono text-gray-600 dark:text-gray-400 text-xs sm:text-sm",children:"Daily Pay:"}),e.jsxs("strong",{className:"text-gray-900 dark:text-gray-100 text-xs sm:text-sm",children:[x.daily_pay_hbd?mr(x.daily_pay_hbd):0," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"font-mono text-gray-600 dark:text-gray-400 text-xs sm:text-sm",children:"Remaining:"}),e.jsxs("strong",{className:"text-gray-900 dark:text-gray-100 text-xs sm:text-sm",children:[mr(x.remaining_days||0)," Days"]})]}),d!=="Expired"&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"font-mono text-gray-600 dark:text-gray-400 text-xs sm:text-sm",children:"Paid:"}),e.jsxs("strong",{className:"text-gray-900 dark:text-gray-100 text-xs sm:text-sm",children:[mr(x.total_hbd_received||0)," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"font-mono text-gray-600 dark:text-gray-400 text-xs sm:text-sm",children:"To Pay:"}),e.jsxs("strong",{className:"text-gray-900 dark:text-gray-100 text-xs sm:text-sm",children:[mr(x.max_hbd_remaining||0)," HBD"]})]}),e.jsx("div",{className:"mt-2",children:e.jsx("button",{className:"px-3 sm:px-5 py-2 bg-green-600 hover:bg-green-700 text-white rounded cursor-pointer w-full text-xs sm:text-sm",onClick:()=>t(x),children:"Support"})})]})]})},x.proposal_id))]})]})})};class pg{HIVE_API_URL="https://api.hive.blog";async _fetch(r,s,n){return fetch(r,n?{...s,signal:n}:s)}async getProfile(r,s){const n={jsonrpc:"2.0",method:"bridge.get_profile",params:{account:r},id:1},a=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},s);if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return a.json()}async getFollowers(r,s=null,n=100,a){const i={jsonrpc:"2.0",method:"condenser_api.get_followers",params:[r,s||"","blog",n],id:1},o=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)},a);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return(await o.json()).result}async getFollowing(r,s=null,n=100,a){const i={jsonrpc:"2.0",method:"condenser_api.get_following",params:[r,s||"","blog",n],id:1},o=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)},a);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return(await o.json()).result}async getAccounts(r,s){const n={jsonrpc:"2.0",method:"condenser_api.get_accounts",params:[r],id:1},a=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},s);if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return(await a.json()).result}async getDynamicGlobalProperties(r){const s={jsonrpc:"2.0",method:"condenser_api.get_dynamic_global_properties",params:[],id:1},n=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)},r);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return(await n.json()).result}async convertVestingSharesToHive(r){try{const s=await this.getDynamicGlobalProperties(),n=parseFloat(r.split(" ")[0]),a=parseFloat(s.total_vesting_shares.split(" ")[0]),i=parseFloat(s.total_vesting_fund_hive.split(" ")[0]);return(n*i/a).toFixed(3)}catch(s){return console.error("Error converting vesting shares:",s),"0"}}async getFeedHistory(r){const s={jsonrpc:"2.0",method:"condenser_api.get_feed_history",params:[],id:1},n=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)},r);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return(await n.json()).result}async getVoteValue(r,s=1e4){try{const n=await this.getAccounts([r]);if(n.length===0)throw new Error("Account not found!");const a=n[0],i=await this.getDynamicGlobalProperties(),o=await this.getFeedHistory(),c=parseFloat(a.vesting_shares)+parseFloat(a.received_vesting_shares)-parseFloat(a.delegated_vesting_shares)-parseFloat(a.vesting_withdraw_rate),d=Math.floor(Date.now()/1e3)-a.voting_manabar.last_update_time,f=c*1e6/4;let l=parseFloat(a.voting_manabar.current_mana.toString())+d*f/(300*60*24);l>f&&(l=f);const h=l*100/f,u=a.vesting_shares||"0 VESTS",p=parseFloat(u.toString().split(" ")[0]),b=i.total_vesting_shares||"0 VESTS",w=parseFloat(b.toString().split(" ")[0]),x=s/1e4,g=h*x/100,v=i.vote_power_reserve_rate*(300*60*24)/(3600*24),N=g*f/100,j=parseFloat(i.recent_claims||"0"),y=i.reward_balance||"0 HIVE",m=parseFloat(y.toString().split(" ")[0]),_=i.current_supply||"0 HIVE",E=parseFloat(_.toString().split(" ")[0]),A=i.current_sbd_supply||"0 HBD",C=parseFloat(A.toString().split(" ")[0]),T=m/j*(p/w)*(N/f)*E,D=o?.current_median_history;if(!D||!D.base)return"0.00";const L=parseFloat(D.base.toString().split(" ")[0]);return(T*L).toFixed(2)}catch(n){return console.error("Error calculating vote value:",n),"0.00"}}async getUserBlogs(r,s=20,n,a,i){const o={jsonrpc:"2.0",method:"bridge.get_account_posts",params:{sort:"blog",account:r,observer:r,limit:s,start_author:n||null,start_permlink:a||null},id:1},c=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},i);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return(await c.json()).result||[]}async getUserPosts(r,s=20,n,a,i){const o={jsonrpc:"2.0",method:"bridge.get_account_posts",params:{sort:"posts",account:r,observer:r,limit:s,start_author:n||null,start_permlink:a||null},id:1},c=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},i);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return(await c.json()).result||[]}async getUserComments(r,s=20,n,a,i){const o={jsonrpc:"2.0",method:"bridge.get_account_posts",params:{sort:"comments",account:r,observer:r,limit:s,start_author:n||null,start_permlink:a||null},id:1},c=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},i);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return(await c.json()).result||[]}async getUserReplies(r,s=20,n,a,i){const o={jsonrpc:"2.0",method:"bridge.get_account_posts",params:{sort:"replies",account:r,observer:r,limit:s,start_author:n||null,start_permlink:a||null},id:1},c=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},i);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return(await c.json()).result||[]}async getSnapReferences(r,s,n){let a=`https://peakd.com/api/public/snaps/account?container=peak.snaps&username=${r}`;s!==void 0&&(a+=`&startId=${s}`);const i=await this._fetch(a,{method:"GET",headers:{Accept:"application/json"}},n);if(!i.ok)throw new Error(`PeakD API error: ${i.status}`);const o=await i.json();return Array.isArray(o)?o:[]}async batchGetPosts(r,s="",n){const i=[];for(let o=0;o<r.length;o+=5){const d=r.slice(o,o+5).map((u,p)=>({jsonrpc:"2.0",method:"bridge.get_post",params:{author:u.author,permlink:u.permlink,observer:s},id:p+1})),f=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)},n);if(!f.ok)continue;const l=await f.json(),h=Array.isArray(l)?l:[l];for(const u of h)u?.result&&i.push(u.result)}return i}async getUserSnaps(r,s,n,a){const i=await this.getSnapReferences(r,s,a);if(i.length===0)return{snaps:[],nextStartId:null};const o=await this.batchGetPosts(i,n||r,a),c=i[i.length-1],d=i.length>=15?c.id:null;return{snaps:o,nextStartId:d}}async getUserPolls(r,s){const n=`https://polls.hivehub.dev/rpc/polls?author=eq.${encodeURIComponent(r)}&order=created.desc`,a=await this._fetch(n,{method:"GET",headers:{Accept:"application/json"}},s);if(!a.ok)throw new Error(`Polls API error: ${a.status}`);const i=await a.json();return Array.isArray(i)?i:[]}async getPollDetail(r,s,n){const a=`https://polls.hivehub.dev/rpc/poll?author=eq.${encodeURIComponent(r)}&permlink=eq.${encodeURIComponent(s)}`,i=await this._fetch(a,{method:"GET",headers:{Accept:"application/json"}},n);if(!i.ok)throw new Error(`Polls API error: ${i.status}`);const o=await i.json();return Array.isArray(o)&&o.length>0?o[0]:null}delay(r){return new Promise(s=>setTimeout(s,r))}API_THROTTLE_MS=150;parseAssetFloat(r){return r&&parseFloat(r.split(" ")[0])||0}parseHiveTime(r){if(!r)return null;const s=r.endsWith("Z")?r:`${r}Z`,n=Date.parse(s);return isNaN(n)?null:n}async getPendingAuthorRewards(r,s,n){const a=Date.now()-6048e5,i=[],o=new Set;let c=0;const d=h=>{if(!h||!h.author||!h.permlink)return;const u=`${h.author}/${h.permlink}`;if(o.has(u))return;const p=this.parseHiveTime(h.created||h.posted);if(p&&p<a)return;const b=h.cashout_time||h.payout_at||"",w=this.parseHiveTime(b);if(!w||isNaN(w)||w<=Date.now()||this.parseAssetFloat(h.max_accepted_payout||"0")===0)return;const g=this.parseAssetFloat(h.pending_payout_value||"0");if(h.is_paidout===!0)return;const N=(Array.isArray(h.beneficiaries)?h.beneficiaries:[]).reduce((m,_)=>m+(Number(_.weight)||0),0)/1e4,y=g*.5*Math.max(0,Math.min(1,1-N));o.add(u),c+=y,i.push({author:h.author,permlink:h.permlink,title:h.title||"",isComment:!!h.parent_author,payoutMs:w-Date.now(),hbd:y,hpEq:null,beneficiaryCut:N})},f=async h=>{let b=null,w=null;for(let x=0;x<30;x++){const g={jsonrpc:"2.0",method:"bridge.get_account_posts",params:{sort:h,account:r,observer:r,limit:20,start_author:b,start_permlink:w},id:1},v=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)},n);if(!v.ok)break;const j=(await v.json()).result;if(!Array.isArray(j)||!j.length)break;j.forEach(d);const y=j[j.length-1],m=this.parseHiveTime(y?.created);if(b=y?.author||null,w=y?.permlink||null,j.length<20||!b||!w||m&&m<a)break;await this.delay(this.API_THROTTLE_MS)}};if(await f("posts"),s&&i.length>0){const h=[...i].sort((u,p)=>(u.payoutMs||0)-(p.payoutMs||0));s(h,c,0)}await f("comments"),i.sort((h,u)=>(h.payoutMs||0)-(u.payoutMs||0));let l=0;try{const h=await this.rpcCall("condenser_api.get_current_median_history_price",[],n),u=this.parseAssetFloat(h?.base)/this.parseAssetFloat(h?.quote||"1.000 HIVE");u>0&&(l=c/u,i.forEach(p=>{p.hpEq=(p.hbd||0)/u}))}catch{}return{rows:i,totalHbd:c,totalHpEq:l}}async getPendingCurationRewards(r,s,n){const i=Date.now()-864e6,o=[],c=(1n<<0n).toString();let d=-1;const f=1e3,l=new Set;for(let m=0;m<20;m++){const _=[r,d,f,c,"0"];let E;try{E=await this.rpcCall("condenser_api.get_account_history",_,n)}catch{try{E=await this.rpcCall("condenser_api.get_account_history",[r,d,f],n)}catch{break}}if(!Array.isArray(E)||!E.length)break;let A=1/0;for(const[C,T]of E){if(l.has(C))continue;l.add(C);const[D,L]=T?.op||[];D==="vote"&&L?.voter===r&&o.push({voter:L.voter,author:L.author,permlink:L.permlink,weight:L.weight,timestamp:T.timestamp});const H=this.parseHiveTime(T?.timestamp);H&&H<A&&(A=H)}if(A<=i||(d=E[0][0]-1,d<0))break;await this.delay(this.API_THROTTLE_MS)}const h=new Map;for(const m of o){const _=this.parseHiveTime(m.timestamp);if(!_||_<i)continue;const E=`${m.author}/${m.permlink}`,A=h.get(E);(!A||_>(this.parseHiveTime(A.timestamp)||0))&&h.set(E,m)}const u=Array.from(h.values()).filter(m=>(m.weight||0)>0);if(!u.length)return{rows:[],totalHp:0,totalHbd:0};const[p,b,w]=await Promise.all([this.rpcCall("condenser_api.get_reward_fund",["post"],n),this.rpcCall("condenser_api.get_current_median_history_price",[],n),this.getDynamicGlobalProperties(n)]),x=this.parseAssetFloat(b?.base)/this.parseAssetFloat(b?.quote||"1.000 HIVE"),g=Number(p?.percent_curation_rewards||5e3),v=[],N=6;for(let m=0;m<u.length;m+=N){const _=u.slice(m,m+N),E=await Promise.all(_.map(async A=>{try{const C=await this.rpcCall("condenser_api.get_content",[A.author,A.permlink],n);if(!C||C.allow_curation_rewards===!1)return null;const T=this.parseHiveTime(C.cashout_time);if(!T||T<=Date.now()||this.parseAssetFloat(C.max_accepted_payout)<=0)return null;const L=this.parseAssetFloat(C.pending_payout_value||"0");if(L<=0)return null;let H=Array.isArray(C.active_votes)&&C.active_votes.length?C.active_votes:await this.rpcCall("condenser_api.get_active_votes",[A.author,A.permlink],n);if(!Array.isArray(H)||!H.length)return null;const V=H.find(Ie=>Ie.voter===r);if(!V)return null;const z=Number(V.rshares||0);if(z<=0)return null;const F=L*(g/1e4);let Y;const G=Number(V.weight||0),ne=Number(C.total_vote_weight||0);if(G>0&&ne>0)Y=G/ne;else{const Ie=H.reduce((K,le)=>{const oe=Number(le.rshares||0);return oe>0?K+oe:K},0);Y=Ie>0?z/Ie:0}const ie=F*Y,xe=x>0?ie/x:0;if(xe<=0)return null;const U=H.reduce((Ie,K)=>{const le=Number(K.rshares||0);return le>0?Ie+le:Ie},0),q=U>0?z/U:0,B=q>0?Y/q*100:null,pe=this.parseHiveTime(C.created),ee=V.time?this.parseHiveTime(V.time):this.parseHiveTime(A.timestamp),te=pe&&ee?Math.max(0,ee-pe):null;let _e=Number(A.weight||0);return V.percent!==void 0&&(_e=Number(V.percent)),{hp:xe,hbd:ie,author:A.author,permlink:A.permlink,title:C.title||`${A.author}/${A.permlink}`,payoutMs:T-Date.now(),votedAfterMs:te,weightPct:(_e||0)/100,efficiency:B,isComment:!!C.parent_author}}catch{return null}}));for(const A of E)A&&A.hp>0&&v.push(A);if(s&&v.length>0){const A=[...v].sort((D,L)=>(D.payoutMs||0)-(L.payoutMs||0)),C=A.reduce((D,L)=>D+(L.hp||0),0),T=A.reduce((D,L)=>D+(L.hbd||0),0);s(A,C,T)}m+N<u.length&&await this.delay(this.API_THROTTLE_MS)}v.sort((m,_)=>(m.payoutMs||0)-(_.payoutMs||0));const j=v.reduce((m,_)=>m+(_.hp||0),0),y=v.reduce((m,_)=>m+(_.hbd||0),0);return{rows:v,totalHp:j,totalHbd:y}}async rpcCall(r,s,n){const a={jsonrpc:"2.0",method:r,params:s,id:1},i=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)},n);if(!i.ok)throw new Error(`RPC error: ${i.status}`);const o=await i.json();if(o.error)throw new Error(o.error.message||"RPC error");return o.result}userAvatar(r){return`https://images.hive.blog/u/${r}/avatar`}}const Ee=new pg,Jc=({vestingShares:t})=>{const[r,s]=k.useState("...");return k.useEffect(()=>{(async()=>{try{const a=await Ee.convertVestingSharesToHive(t);s(a)}catch(a){console.error("Error calculating HP:",a);const i=parseFloat(t.split(" ")[0]);s((i/1e6).toFixed(3))}})()},[t]),e.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:[r," HP"]})},gg=({username:t,onClickAuthor:r,onClickAddRemoveFromLists:s,onClickFollow:n})=>{const[a,i]=k.useState([]),[o,c]=k.useState([]),[d,f]=k.useState({}),[l,h]=k.useState(!0),[u,p]=k.useState(null),[b,w]=k.useState(null),x=k.useRef(null),g=async()=>{try{h(!0),p(null);const j=await Ee.getFollowers(t);if(i(j),j.length>0){const y=j.map(A=>A.follower),m=await Ee.getAccounts(y);c(m);const _={},E={};for(const A of j)try{const C=await Ee.getVoteValue(A.follower);E[A.follower]=C}catch(C){console.warn(`Failed to get voting data for ${A.follower}:`,C),_[A.follower]={upvotepower:"0",downvote:"0"},E[A.follower]="0.00"}f(E)}}catch(j){p(j instanceof Error?j.message:"Failed to load followers data")}finally{h(!1)}};k.useEffect(()=>{g()},[t]),k.useEffect(()=>{const j=y=>{x.current&&!x.current.contains(y.target)&&w(null)};return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[]);const v=j=>{const y=o.find(m=>m.name===j);if(!y)return null;try{return JSON.parse(y.posting_json_metadata)?.profile||{}}catch{return{}}},N=j=>{const y=new Date,m=new Date(j),_=y.getTime()-m.getTime(),E=Math.floor(_/(1e3*60*60*24));if(Math.floor(E/30)>=1)return m.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});const C=Math.floor(_/1e3),T=Math.floor(C/60),D=Math.floor(T/60),L=Math.floor(E/7),H=Math.floor(E/365);return H>0?`${H} year${H>1?"s":""} ago`:L>0?`${L} week${L>1?"s":""} ago`:E>0?`${E} day${E>1?"s":""} ago`:D>0?`${D} hour${D>1?"s":""} ago`:T>0?`${T} minute${T>1?"s":""} ago`:"Just now"};return l?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading followers..."]})}):u?e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load followers"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:u}),e.jsxs("button",{onClick:g,className:"m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):a.length===0?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"This user has no followers."})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:[e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Avatar"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Username"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Last Post"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"HP"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Vote Value"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Manage"})]})}),e.jsx("tbody",{children:a.map((j,y)=>{const m=o.find(E=>E.name===j.follower),_=v(j.follower);return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[e.jsx("td",{className:"py-4 px-4",children:e.jsx("img",{src:_?.profile_image||Ee.userAvatar(j.follower),alt:j.follower,className:"w-12 h-12 rounded-full object-cover cursor-pointer",onClick:()=>r&&r(j.follower),onError:E=>{E.target.src=`https://ui-avatars.com/api/?name=${j.follower}&background=random`}})}),e.jsxs("td",{className:"py-4 px-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-semibold text-gray-900 dark:text-white cursor-pointer hover:text-blue-600 dark:hover:text-blue-400",onClick:()=>r&&r(j.follower),children:["@",j.follower]}),_?.location&&e.jsxs("div",{className:"relative group",children:[e.jsx(O.MapPin,{className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),e.jsx("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-gray-900 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10",children:_.location})]})]}),_?.about&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1 truncate max-w-xs",children:_.about})]}),e.jsx("td",{className:"py-4 px-4",children:m?.last_post&&m.last_post!=="1970-01-01T00:00:00"?e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:N(m.last_root_post)}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"Never"})}),e.jsx("td",{className:"py-4 px-4",children:m?e.jsx(Jc,{vestingShares:m.vesting_shares}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"-"})}),e.jsx("td",{className:"py-4 px-4",children:d[j.follower]?e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:["$",d[j.follower]]}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"-"})}),e.jsx("td",{className:"py-4 px-4",children:e.jsxs("div",{className:"relative",ref:b===j.follower?x:null,children:[e.jsx("button",{onClick:()=>w(b===j.follower?null:j.follower),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e.jsx(O.MoreVertical,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),b===j.follower&&e.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10",children:[e.jsxs("button",{onClick:()=>{s&&s(j.follower),w(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserPlus,{className:"w-4 h-4"}),"Add/remove from lists"]}),e.jsxs("button",{onClick:()=>{n&&n(j.follower),w(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserMinus,{className:"w-4 h-4"}),"Follow"]})]})]})})]},`${j.follower}-${y}`)})})]})}),e.jsx("div",{className:"md:hidden space-y-4",children:a.map((j,y)=>{const m=o.find(E=>E.name===j.follower),_=v(j.follower);return e.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("img",{src:_?.profile_image||Ee.userAvatar(j.follower),alt:j.follower,className:"w-10 h-10 rounded-full object-cover cursor-pointer flex-shrink-0",onClick:()=>r&&r(j.follower),onError:E=>{E.target.src=`https://ui-avatars.com/api/?name=${j.follower}&background=random`}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-semibold text-gray-900 dark:text-white cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 text-sm",onClick:()=>r&&r(j.follower),children:["@",j.follower]}),_?.location&&e.jsxs("div",{className:"relative group",children:[e.jsx(O.MapPin,{className:"w-3 h-3 text-gray-500 dark:text-gray-400"}),e.jsx("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-gray-900 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10",children:_.location})]})]}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:m?.last_post&&m.last_post!=="1970-01-01T00:00:00"?N(m.last_root_post):e.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"Never"})})]}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[e.jsx("div",{className:"flex items-center gap-4",children:m&&e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:e.jsx(Jc,{vestingShares:m.vesting_shares})})}),e.jsxs("div",{className:"relative",ref:b===j.follower?x:null,children:[e.jsx("button",{onClick:()=>w(b===j.follower?null:j.follower),className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e.jsx(O.MoreVertical,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),b===j.follower&&e.jsxs("div",{className:"absolute right-0 mt-1 w-40 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10",children:[e.jsxs("button",{onClick:()=>{s&&s(j.follower),w(null)},className:"w-full text-left px-3 py-2 text-xs text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserPlus,{className:"w-3 h-3"}),"Add/remove from lists"]}),e.jsxs("button",{onClick:()=>{n&&n(j.follower),w(null)},className:"w-full text-left px-3 py-2 text-xs text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserMinus,{className:"w-3 h-3"}),"Follow"]})]})]})]})]})]})},`${j.follower}-${y}`)})})]})},Yc=({vestingShares:t})=>{const[r,s]=k.useState("...");return k.useEffect(()=>{(async()=>{try{const a=await Ee.convertVestingSharesToHive(t);s(a)}catch(a){console.error("Error calculating HP:",a);const i=parseFloat(t.split(" ")[0]);s((i/1e6).toFixed(3))}})()},[t]),e.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:[r," HP"]})},xg=({username:t,onClickAuthor:r,onClickAddRemoveFromLists:s,onClickUnfollow:n})=>{const[a,i]=k.useState([]),[o,c]=k.useState([]),[d,f]=k.useState({}),[l,h]=k.useState(!0),[u,p]=k.useState(null),[b,w]=k.useState(null),x=k.useRef(null),g=async()=>{try{h(!0),p(null);const j=await Ee.getFollowing(t);if(i(j),j.length>0){const y=j.map(E=>E.following),m=await Ee.getAccounts(y);c(m);const _={};for(const E of j)try{const A=await Ee.getVoteValue(E.following);_[E.following]=A}catch(A){console.warn(`Failed to get voting data for ${E.following}:`,A),_[E.following]="0.00"}f(_)}}catch(j){p(j instanceof Error?j.message:"Failed to load following data")}finally{h(!1)}};k.useEffect(()=>{g()},[t]),k.useEffect(()=>{const j=y=>{x.current&&!x.current.contains(y.target)&&w(null)};return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[]);const v=j=>{const y=o.find(m=>m.name===j);if(!y)return null;try{return JSON.parse(y.posting_json_metadata)?.profile||{}}catch{return{}}},N=j=>{const y=new Date,m=new Date(j),_=y.getTime()-m.getTime(),E=Math.floor(_/(1e3*60*60*24));if(Math.floor(E/30)>=1)return m.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});const C=Math.floor(_/1e3),T=Math.floor(C/60),D=Math.floor(T/60),L=Math.floor(E/7),H=Math.floor(E/365);return H>0?`${H} year${H>1?"s":""} ago`:L>0?`${L} week${L>1?"s":""} ago`:E>0?`${E} day${E>1?"s":""} ago`:D>0?`${D} hour${D>1?"s":""} ago`:T>0?`${T} minute${T>1?"s":""} ago`:"Just now"};return l?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading following..."]})}):u?e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load following"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:u}),e.jsxs("button",{onClick:g,className:"m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):a.length===0?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"This user is not following anyone."})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:[e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Avatar"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Username"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Last Post"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"HP"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Vote Value"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Manage"})]})}),e.jsx("tbody",{children:a.map((j,y)=>{const m=o.find(E=>E.name===j.following),_=v(j.following);return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[e.jsx("td",{className:"py-4 px-4",children:e.jsx("img",{src:_?.profile_image||Ee.userAvatar(j.following),alt:j.following,className:"w-12 h-12 rounded-full object-cover cursor-pointer",onClick:()=>r&&r(j.following),onError:E=>{E.target.src=`https://ui-avatars.com/api/?name=${j.following}&background=random`}})}),e.jsxs("td",{className:"py-4 px-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-semibold text-gray-900 dark:text-white cursor-pointer hover:text-blue-600 dark:hover:text-blue-400",onClick:()=>r&&r(j.following),children:["@",j.following]}),_?.location&&e.jsxs("div",{className:"relative group",children:[e.jsx(O.MapPin,{className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),e.jsx("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-gray-900 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10",children:_.location})]})]}),_?.about&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1 truncate max-w-xs",children:_.about})]}),e.jsx("td",{className:"py-4 px-4",children:m?.last_post&&m.last_post!=="1970-01-01T00:00:00"?e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:N(m.last_root_post)}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"Never"})}),e.jsx("td",{className:"py-4 px-4",children:m?e.jsx(Yc,{vestingShares:m.vesting_shares}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"-"})}),e.jsx("td",{className:"py-4 px-4",children:d[j.following]?e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:["$",d[j.following]]}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"-"})}),e.jsx("td",{className:"py-4 px-4",children:e.jsxs("div",{className:"relative",ref:b===j.following?x:null,children:[e.jsx("button",{onClick:()=>w(b===j.following?null:j.following),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e.jsx(O.MoreVertical,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),b===j.following&&e.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10",children:[e.jsxs("button",{onClick:()=>{s&&s(j.following),w(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserPlus,{className:"w-4 h-4"}),"Add/remove from lists"]}),e.jsxs("button",{onClick:()=>{n&&n(j.following),w(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserMinus,{className:"w-4 h-4"}),"Unfollow"]})]})]})})]},`${j.following}-${y}`)})})]})}),e.jsx("div",{className:"md:hidden space-y-4",children:a.map((j,y)=>{const m=o.find(E=>E.name===j.following),_=v(j.following);return e.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("img",{src:_?.profile_image||Ee.userAvatar(j.following),alt:j.following,className:"w-10 h-10 rounded-full object-cover cursor-pointer flex-shrink-0",onClick:()=>r&&r(j.following),onError:E=>{E.target.src=`https://ui-avatars.com/api/?name=${j.following}&background=random`}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-semibold text-gray-900 dark:text-white cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 text-sm",onClick:()=>r&&r(j.following),children:["@",j.following]}),_?.location&&e.jsxs("div",{className:"relative group",children:[e.jsx(O.MapPin,{className:"w-3 h-3 text-gray-500 dark:text-gray-400"}),e.jsx("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-gray-900 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10",children:_.location})]})]}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:m?.last_post&&m.last_post!=="1970-01-01T00:00:00"?N(m.last_root_post):e.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"Never"})})]}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[e.jsx("div",{className:"flex items-center gap-4",children:m&&e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:e.jsx(Yc,{vestingShares:m.vesting_shares})})}),e.jsxs("div",{className:"relative",ref:b===j.following?x:null,children:[e.jsx("button",{onClick:()=>w(b===j.following?null:j.following),className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e.jsx(O.MoreVertical,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),b===j.following&&e.jsxs("div",{className:"absolute right-0 mt-1 w-40 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10",children:[e.jsxs("button",{onClick:()=>{s&&s(j.following),w(null)},className:"w-full text-left px-3 py-2 text-xs text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserPlus,{className:"w-3 h-3"}),"Add/remove from lists"]}),e.jsxs("button",{onClick:()=>{n&&n(j.following),w(null)},className:"w-full text-left px-3 py-2 text-xs text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserMinus,{className:"w-3 h-3"}),"Unfollow"]})]})]})]})]})]})},`${j.following}-${y}`)})})]})},Xc=new Da.Client(["https://api.hive.blog","https://api.syncad.com","https://api.deathwing.me"]);class bg{async getAccountHistory(r,s=-1,n=1e3,a,i){try{const o=[r,s,n];return a!==void 0&&i!==void 0&&o.push(a,i),(await Xc.call("condenser_api","get_account_history",o)).map(([d,f])=>({index:d,block:f.block,op:{type:f.op[0],value:f.op[1]},op_in_trx:f.op_in_trx,timestamp:f.timestamp,trx_id:f.trx_id,trx_in_block:f.trx_in_block,virtual_op:f.virtual_op}))}catch(o){return console.error("Error fetching account history:",o),[]}}async getNextAccountHistoryPage(r,s,n=1e3){try{const a=s-1;return(await Xc.call("condenser_api","get_account_history",[r,a,n])).map(([c,d])=>({index:c,block:d.block,op:{type:d.op[0],value:d.op[1]},op_in_trx:d.op_in_trx,timestamp:d.timestamp,trx_id:d.trx_id,trx_in_block:d.trx_in_block,virtual_op:d.virtual_op})).filter(c=>c.index<s)}catch(a){return console.error("Error fetching next page of account history:",a),[]}}convertToActivityListItems(r,s){return r.filter(n=>{const a=n.op.type;return a!=="effective_comment_vote"&&a!=="witness_set_properties"&&a!=="producer_reward"&&a!=="comment_reward"&&a!=="comment_payout_update"&&a!=="claim_reward_balance"&&a!=="transfer"&&a!=="claim_account"&&a!=="transfer_to_vesting"&&a!=="transfer_to_vesting_completed"}).map(n=>{const a=this.parseOperation(n,s);return{id:`${n.index}-${n.trx_id}`,type:a.type,direction:a.direction,timestamp:n.timestamp,block:n.block,description:a.description,details:n.op.value,index:n.index,...a.extraFields}}).filter(n=>n!==null)}parseOperation(r,s){const{op:n}=r,a=n.type,i=n.value;switch(a){case"vote":return this.parseVoteOperation(i,s);case"comment":return this.parseCommentOperation(i,s);case"custom_json":return this.parseCustomJsonOperation(i,s);case"comment_options":return this.parseCommentOptionsOperation(i,s);case"effective_comment_vote":return this.parseEffectiveCommentVoteOperation(i,s);case"curation_reward":return this.parseCurationRewardOperation(i,s);case"author_reward":return this.parseAuthorRewardOperation(i,s);case"comment_benefactor_reward":return this.parseCommentBenefactorRewardOperation(i,s);default:return{type:"other",direction:"out",description:`${a} operation`,extraFields:{}}}}parseVoteOperation(r,s){const{voter:n,author:a,permlink:i,weight:o}=r,c=a===s,d=c?"in":"out",f=(o/100).toFixed(0);let l="";return c?l=`${n} voted ${a}/${i} with ${f}%`:l=`Voted ${a}/${i} with ${f}%`,{type:"vote",direction:d,description:l,extraFields:{voter:n,author:a,permlink:i,weight:parseInt(f)}}}parseCommentOperation(r,s){const{author:n,parent_author:a,parent_permlink:i,permlink:o}=r,d=a===s?"in":"out",l=`Commented on ${i} by ${a||n}.`;return{type:"comment",direction:d,description:l,extraFields:{author:n,permlink:o,parent_author:a,parent_permlink:i}}}parseCustomJsonOperation(r,s){const{id:n,json:a,required_auths:i,required_posting_auths:o}=r;let c={};try{c=JSON.parse(a)}catch{}let d="Custom Json";if(n==="follow"){const[f,l]=c;f==="follow"&&(d="Custom Json")}return{type:"custom_json",direction:"out",description:d,extraFields:{}}}parseCommentOptionsOperation(r,s){const{author:n,permlink:a,max_accepted_payout:i}=r;return{type:"comment_options",direction:"out",description:"Comment Payout Update",extraFields:{author:n,permlink:a,payout:i}}}parseEffectiveCommentVoteOperation(r,s){const{voter:n,author:a,permlink:i,pending_payout:o}=r,c=a===s,d=c?"in":"out",f=c?`${n} voted on ${a}/${i} (effective vote)`:`Effective vote on ${a}/${i}`;return{type:"effective_comment_vote",direction:d,description:f,extraFields:{voter:n,author:a,permlink:i,payout:o}}}parseCurationRewardOperation(r,s){const{author:n,curator:a,permlink:i,reward:o}=r,d=a===s?"in":"out",h=`${(parseFloat(o.split(" ")[0])*1e-6).toFixed(3)} HP`,u=`Curation reward for ${a}/${i} by ${n}`;return{type:"curation_reward",direction:d,description:u,extraFields:{author:n,curator:a,permlink:i,reward:h}}}parseAuthorRewardOperation(r,s){const{author:n,permlink:a,hbd_payout:i,hive_payout:o,vesting_payout:c}=r,f=n===s?"in":"out",h=(parseFloat(c.split(" ")[0])*1e-6).toFixed(3),u=i.split(" ")[0],p=o.split(" ")[0],b=`Author reward: ${u} HBD, ${p} HIVE, ${h} HP for ${a}`;return{type:"author_reward",direction:f,description:b,extraFields:{author:n,permlink:a,hbd_payout:i,hive_payout:o,vesting_payout:c}}}parseCommentBenefactorRewardOperation(r,s){const{author:n,benefactor:a,permlink:i,hbd_payout:o,hive_payout:c,vesting_payout:d}=r,l=a===s?"in":"out",u=(parseFloat(d.split(" ")[0])*1e-6).toFixed(3),p=o.split(" ")[0],b=c.split(" ")[0],w=`Benefactor reward on ${i} by ${n}: ${p} HBD, ${b} HIVE, ${u} HP`;return{type:"comment_benefactor_reward",direction:l,description:w,extraFields:{author:n,benefactor:a,permlink:i,hbd_payout:o,hive_payout:c,vesting_payout:d}}}filterByDirection(r,s){return s==="all"?r:r.filter(n=>n.direction===s)}filterByGeneralType(r,s){if(s==="all")return r;switch(s){case"votes":return r.filter(n=>n.type==="vote"||n.type==="effective_comment_vote");case"comments":return r.filter(n=>n.type==="comment");case"replies":return r.filter(n=>n.type==="comment"&&n.direction==="in");case"others":return r.filter(n=>n.type==="custom_json"||n.type==="comment_options"||n.type==="other");default:return r}}filterByRewardType(r,s){if(s==="all")return r;switch(s){case"author":return r.filter(n=>n.type==="effective_comment_vote"&&n.direction==="in");case"curation":return r.filter(n=>n.type==="effective_comment_vote"&&n.direction==="out");case"benefactor":return r.filter(n=>n.type==="comment_options"&&n.details?.beneficiaries);default:return r}}searchActivities(r,s){if(!s.trim())return r;const n=s.toLowerCase();return r.filter(a=>a.description.toLowerCase().includes(n)||a.author?.toLowerCase().includes(n)||a.permlink?.toLowerCase().includes(n)||a.voter?.toLowerCase().includes(n))}getRelativeTime(r){try{const s=new Date(r),a=new Date().getTime()-s.getTime(),i=Math.floor(a/1e3),o=Math.floor(i/60),c=Math.floor(o/60),d=Math.floor(c/24);return i<60?`${i} seconds ago`:o<60?`${o} minutes ago`:c<24?`${c} hours ago`:d<7?`${d} days ago`:s.toLocaleDateString()}catch(s){return console.error("Error calculating relative time:",s),r}}}const Ea=new bg,f0=({username:t,directionFilter:r="all",generalFilter:s="all",rewardFilter:n="all",searchTerm:a="",limit:i=1e3,className:o,onClickPermlink:c,onSelectActivity:d})=>{const[f,l]=k.useState(a),[h,u]=k.useState(r),[p,b]=k.useState(s),[w,x]=k.useState(n),[g,v]=k.useState([]),[N,j]=k.useState([]),[y,m]=k.useState(!1),[_,E]=k.useState(null),[A,C]=k.useState(new Set),[T,D]=k.useState(null),[L,H]=k.useState(!0),[V,z]=k.useState(!1),[F,Y]=k.useState(-1),G=k.useRef(null),ne=async(q=!1)=>{if(t){q?z(!0):(m(!0),H(!0),Y(-1)),E(null);try{let B;q?B=await Ea.getNextAccountHistoryPage(t,F,i):B=await Ea.getAccountHistory(t,-1,i);const pe=Ea.convertToActivityListItems(B,t);if(pe.sort((ee,te)=>new Date(te.timestamp).getTime()-new Date(ee.timestamp).getTime()),v(q?ee=>[...ee,...pe]:pe),B.length>0){const ee=Math.min(...B.map(te=>te.index));Y(ee)}pe.length===0&&H(!1)}catch(B){E("Failed to load activity history"),console.error("Error loading activities:",B),H(!1)}finally{m(!1),z(!1)}}};k.useEffect(()=>{ne()},[t,i]);const ie=k.useCallback(()=>{L&&!y&&!V&&ne(!0)},[L,y,V]);k.useEffect(()=>{let q=g;h!=="all"?q=q.filter(B=>B.direction===h):q=q.filter(B=>B.type!=="custom_json"&&B.type!=="comment_options"),p!=="all"&&(p==="votes"?q=q.filter(B=>B.type==="vote"||B.type==="effective_comment_vote"):p==="comments"?q=q.filter(B=>B.type==="comment"):p==="replies"?q=q.filter(B=>B.type==="comment"&&B.direction==="in"):p==="curation"?q=q.filter(B=>B.type==="curation_reward"):p==="others"&&(q=g.filter(B=>B.type==="custom_json"||B.type==="comment_options"))),w!=="all"&&(w==="author"?q=q.filter(B=>B.type==="effective_comment_vote"&&B.direction==="in"):w==="curation"?q=q.filter(B=>B.type==="effective_comment_vote"&&B.direction==="out"):w==="benefactor"&&(q=q.filter(B=>B.type==="comment_options"))),f&&(q=q.filter(B=>B.description.toLowerCase().includes(f.toLowerCase())||B.author?.toLowerCase().includes(f.toLowerCase())||B.permlink?.toLowerCase().includes(f.toLowerCase()))),j(q)},[g,h,p,w,f]),k.useEffect(()=>{const q=B=>{G.current&&!G.current.contains(B.target)&&D(null)};return document.addEventListener("mousedown",q),()=>{document.removeEventListener("mousedown",q)}},[]);const xe=q=>{switch(q.type){case"vote":case"effective_comment_vote":return e.jsx(O.Wallet,{className:"h-4 w-4"});case"comment":return e.jsx(O.MessageCircle,{className:"h-4 w-4"});case"custom_json":return e.jsx(O.FileText,{className:"h-4 w-4"});case"curation_reward":return e.jsx(O.Wallet,{className:"h-4 w-4"});case"author_reward":return e.jsx(O.DollarSign,{className:"h-4 w-4"});case"comment_benefactor_reward":return e.jsx(O.User,{className:"h-4 w-4"});default:return e.jsx(O.Eye,{className:"h-4 w-4"})}},U=(q,B)=>q.split(/(\s+)/).map((ee,te)=>{if(ee.includes("/")){const[_e,Ie]=ee.split("/");if(_e&&Ie)return e.jsx("span",{className:"text-blue-500 cursor-pointer hover:underline",onClick:K=>{K.stopPropagation(),console.log("Clicked permlink:",_e,Ie),c?.(_e,Ie)},children:ee},te)}return e.jsx("span",{children:ee},te)});return y?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 items-start lg:items-center justify-between",children:[e.jsx("div",{className:"flex-1 max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse"}),e.jsx("div",{className:"w-full h-10 bg-gray-200 dark:bg-gray-700 rounded-md animate-pulse"})]})}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Array.from({length:5}).map((q,B)=>e.jsx("div",{className:"w-24 h-10 bg-gray-200 dark:bg-gray-700 rounded-md animate-pulse"},B))})]}),e.jsx("div",{className:"flex flex-wrap gap-4 mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:Array.from({length:4}).map((q,B)=>e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-20"},B))})]}),e.jsx("div",{className:"space-y-4",children:Array.from({length:5}).map((q,B)=>e.jsxs("div",{className:"flex items-center justify-between py-3 px-4 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"w-8 h-8 bg-gray-200 dark:bg-gray-700 rounded-full animate-pulse flex-shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0 space-y-2",children:e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-3/4"})})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-4",children:[e.jsx("div",{className:"w-3 h-3 bg-gray-200 dark:bg-gray-700 rounded animate-pulse"}),e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-16"})]})]},B))})]}):_?e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load activities"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:_}),e.jsxs("button",{onClick:()=>ne(),className:"inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 items-start lg:items-center justify-between",children:[e.jsx("div",{className:"flex-1 max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search activities...",value:f,onChange:q=>l(q.target.value),className:"w-full pl-10 pr-3 py-2 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-md text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"})]})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("select",{value:h,onChange:q=>u(q.target.value),className:"px-3 py-2 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-md text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm",children:[e.jsx("option",{value:"all",children:"All Directions"}),e.jsx("option",{value:"in",children:"Incoming"}),e.jsx("option",{value:"out",children:"Outgoing"})]}),e.jsxs("select",{value:p,onChange:q=>b(q.target.value),className:"px-3 py-2 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-md text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm",children:[e.jsx("option",{value:"all",children:"All Types"}),e.jsx("option",{value:"votes",children:"Votes"}),e.jsx("option",{value:"comments",children:"Comments"}),e.jsx("option",{value:"replies",children:"Replies"}),e.jsx("option",{value:"curation",children:"Curation"}),e.jsx("option",{value:"others",children:"Others"})]}),e.jsxs("select",{value:w,onChange:q=>x(q.target.value),className:"px-3 py-2 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-md text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm",children:[e.jsx("option",{value:"all",children:"All Rewards"}),e.jsx("option",{value:"author",children:"Author"}),e.jsx("option",{value:"curation",children:"Curation"}),e.jsx("option",{value:"benefactor",children:"Benefactor"})]}),e.jsx("button",{onClick:()=>ne(),disabled:y||V,className:"px-3 py-2 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(O.RefreshCw,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Total: ",e.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:g.length})]}),e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Filtered: ",e.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:N.length})]}),e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Incoming: ",e.jsx("span",{className:"font-semibold text-green-600 dark:text-green-400",children:g.filter(q=>q.direction==="in").length})]}),e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Outgoing: ",e.jsx("span",{className:"font-semibold text-blue-600 dark:text-blue-400",children:g.filter(q=>q.direction==="out").length})]})]})]}),e.jsx("div",{className:"space-y-4",children:N.length===0?e.jsx("div",{className:"flex items-center justify-center min-h-[200px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:g.length===0?"No activities found for this user.":"No activities match the current filters."})}):e.jsxs(e.Fragment,{children:[N.map((q,B)=>e.jsxs("div",{className:"flex items-center justify-between py-3 px-4 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors cursor-pointer",onClick:pe=>{d?.(q)},children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[q.type==="vote"&&q.voter?e.jsx("img",{src:`https://images.hive.blog/u/${q.voter}/avatar`,alt:q.voter,className:"w-8 h-8 rounded-full flex-shrink-0",onError:pe=>{const ee=pe.target;ee.style.display="none";const te=ee.nextElementSibling;te&&(te.style.display="flex")}}):q.type==="comment_benefactor_reward"&&q.author?e.jsx("img",{src:`https://images.hive.blog/u/${q.author}/avatar`,alt:q.author,className:"w-8 h-8 rounded-full flex-shrink-0",onError:pe=>{const ee=pe.target;ee.style.display="none";const te=ee.nextElementSibling;te&&(te.style.display="flex")}}):q.type==="comment"&&q.author?e.jsx("img",{src:`https://images.hive.blog/u/${q.author}/avatar`,alt:q.author,className:"w-8 h-8 rounded-full flex-shrink-0",onError:pe=>{const ee=pe.target;ee.style.display="none";const te=ee.nextElementSibling;te&&(te.style.display="flex")}}):null,e.jsx("div",{className:`w-8 h-8 bg-purple-100 dark:bg-purple-900/20 rounded-full flex items-center justify-center flex-shrink-0 ${q.type==="vote"&&q.voter||q.type==="comment_benefactor_reward"&&q.author||q.type==="comment"&&q.author?"hidden":""}`,children:xe(q)}),e.jsx("div",{className:"flex-1 min-w-0",children:q.type==="custom_json"||q.type==="comment_options"?e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-900 dark:text-white break-words font-medium",children:U(q.description)}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:Ea.getRelativeTime(q.timestamp+"Z")}),e.jsx("div",{className:"border border-gray-200 dark:border-gray-600 rounded p-2 bg-gray-50 dark:bg-gray-700/50 mt-1",children:e.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400 space-y-1 font-mono break-words",children:[q.type==="custom_json"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"id:"})," ",q.details.id]}),e.jsxs("div",{className:"break-all",children:[e.jsx("span",{className:"font-medium",children:"json:"})," ",JSON.stringify(q.details.json).replace(/\\\"/g,'"').replace(/^"|"$/g,"")]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"required_auths:"})," ",JSON.stringify(q.details.required_auths)]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"required_posting_auths:"})," ",JSON.stringify(q.details.required_posting_auths)]})]}),q.type==="comment_options"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"author:"}),e.jsx("span",{className:"text-blue-500 cursor-pointer hover:underline",children:q.details.author})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"permlink:"}),e.jsx("span",{className:"text-blue-500 cursor-pointer hover:underline",onClick:pe=>{pe.stopPropagation(),console.log("Clicked permlink:",q.details.author,q.details.permlink),c?.(q.details.author,q.details.permlink)},children:q.details.permlink})]})]})]})})]}):e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-900 dark:text-white break-words",children:U(q.description)}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 sm:hidden",children:Ea.getRelativeTime(q.timestamp+"Z")})]})})]}),e.jsx("div",{className:"flex items-center gap-1 text-sm text-gray-600 dark:text-gray-400 flex-shrink-0 ml-4 hidden sm:flex",children:q.type!=="custom_json"&&q.type!=="comment_options"&&e.jsxs(e.Fragment,{children:[e.jsx(O.Clock,{className:"h-3 w-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:Ea.getRelativeTime(q.timestamp+"Z")})]})})]},`${q.id}-${B}`)),L&&g.length>0&&e.jsx("div",{className:"flex justify-center py-6",children:e.jsx("button",{onClick:ie,disabled:y||V,className:"px-6 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white rounded-lg font-medium transition-colors disabled:cursor-not-allowed flex items-center gap-2",children:V?e.jsxs(e.Fragment,{children:[e.jsx(O.RefreshCw,{className:"h-4 w-4 animate-spin"}),"Loading..."]}):"Load More Activities"})}),!L&&g.length>0&&e.jsx("div",{className:"text-center text-sm text-gray-400 py-4",children:"No more activities to load"})]})})]})},cn=new Da.Client(["https://api.hive.blog","https://api.syncad.com","https://api.deathwing.me"]);class yg{async getWitnessesByVote(r="",s=60){try{return await cn.call("condenser_api","get_witnesses_by_vote",[r,s])}catch(n){throw console.error("Error fetching witnesses by vote:",n),n}}async getAccount(r){try{const s=await cn.call("condenser_api","get_accounts",[[r]]);return s&&s.length>0?s[0]:null}catch(s){return console.error("Error fetching account:",s),null}}async getAccounts(r){try{return await cn.call("condenser_api","get_accounts",[r])}catch(s){return console.error("Error fetching accounts:",s),[]}}async getWitnessVotes(r,s="",n=250){try{return await cn.call("database_api","list_witness_votes",{start:[r,s],limit:n,order:"by_witness_account"})}catch(a){throw console.error("Error fetching witness votes:",a),a}}async getAllWitnessVotes(r){const s=[];let n="";try{for(;;){const i=await this.getWitnessVotes(r,n,250);if(s.push(...i.votes),i.votes.length<250)break;n=i.votes[i.votes.length-1].account}return s}catch(i){return console.error("Error fetching all witness votes:",i),[]}}async hasUserVotedForWitness(r,s){try{const n=await this.getAccount(r);return!n||!n.witness_votes?!1:n.witness_votes.includes(s)}catch(n){return console.error("Error checking witness vote:",n),!1}}async getUserWitnessVotes(r){try{return(await this.getAccount(r))?.witness_votes||[]}catch(s){return console.error("Error fetching user witness votes:",s),[]}}formatVotesToMHP(r){return`${(parseFloat(r)/1e6).toFixed(1)}m`}calculateAPR(r){return r/100}getVersionStatus(r,s){const n=this.parseVersion(r),a=this.parseVersion(s);return this.compareVersions(n,a)>=0?"green":this.compareVersions(n,a)<0?"red":"grey"}parseVersion(r){return r.split(".").map(s=>parseInt(s,10))}compareVersions(r,s){const n=Math.max(r.length,s.length);for(let a=0;a<n;a++){const i=r[a]||0,o=s[a]||0;if(i>o)return 1;if(i<o)return-1}return 0}getWitnessDescription(r){try{let s;if(r.json_metadata&&r.json_metadata!=="{}"){s=JSON.parse(r.json_metadata);const n=s.profile?.witness_description;if(n)return n}return r.posting_json_metadata&&r.posting_json_metadata!=="{}"?(s=JSON.parse(r.posting_json_metadata),s.profile?.about||""):""}catch(s){return console.error("Error parsing witness description:",s),""}}formatTimeAgo(r){const s=new Date(r),a=Math.floor((new Date().getTime()-s.getTime())/1e3);if(a<60)return`${a} second${a>1?"s":""} ago`;if(a<3600){const i=Math.floor(a/60);return`${i} minute${i>1?"s":""} ago`}else if(a<86400){const i=Math.floor(a/3600);return`${i} hour${i>1?"s":""} ago`}else if(a<604800){const i=Math.floor(a/86400);return`${i} day${i>1?"s":""} ago`}else if(a<2592e3){const i=Math.floor(a/604800);return`${i} week${i>1?"s":""} ago`}else if(a<31536e3){const i=Math.floor(a/2592e3);return`${i} month${i>1?"s":""} ago`}else{const i=Math.floor(a/31536e3);return`${i} year${i>1?"s":""} ago`}}}const Nr=new yg,Wt=td.create((t,r)=>({witnesses:[],witnessVotes:[],userWitnessVotes:[],witnessDetails:new Map,witnessAccounts:new Map,loadingWitnesses:!1,loadingMoreWitnesses:!1,loadingVotes:!1,loadingMoreVotes:!1,loadingUserVotes:!1,error:null,nextWitnessStart:"",nextVotesStart:"",hasMoreWitnesses:!0,hasMoreVotes:!1,selectedWitness:null,filters:{status:"all",name:"",version:""},loadWitnesses:async(s="",n=50)=>{const{witnesses:a}=r();if(a.length>=500){t({hasMoreWitnesses:!1});return}t(s!==""?{loadingMoreWitnesses:!0}:{loadingWitnesses:!0,error:null});try{const o=await Nr.getWitnessesByVote(s,n);t(d=>{const f=new Set(d.witnesses.map(h=>h.owner)),l=o.filter(h=>!f.has(h.owner));return{witnesses:[...d.witnesses,...l],nextWitnessStart:o.length>0?o[o.length-1].owner:"",hasMoreWitnesses:o.length===n}});const c=o.filter(d=>!r().witnessDetails.has(d.owner)).map(d=>d.owner);c.length>0&&r().loadWitnessDetails(c)}catch(o){console.error("Error loading witnesses:",o),t({error:"Failed to load witnesses data"})}finally{t({loadingWitnesses:!1,loadingMoreWitnesses:!1})}},loadMoreWitnesses:async()=>{const{nextWitnessStart:s,hasMoreWitnesses:n,loadingMoreWitnesses:a}=r();!n||a||!s||await r().loadWitnesses(s,50)},loadWitnessVotes:async s=>{t({loadingVotes:!0,witnessVotes:[],nextVotesStart:"",hasMoreVotes:!1,selectedWitness:s});try{const n=await Nr.getWitnessVotes(s,"",250);t({witnessVotes:n.votes,nextVotesStart:n.votes.length>0?n.votes[n.votes.length-1].account:"",hasMoreVotes:n.votes.length===250,loadingVotes:!1})}catch(n){console.error("Error loading witness votes:",n),t({error:"Failed to load witness votes",loadingVotes:!1})}},loadMoreVotes:async()=>{const{hasMoreVotes:s,loadingMoreVotes:n,nextVotesStart:a,selectedWitness:i,witnessVotes:o}=r();if(!s||n||!a||o.length>=1e3){o.length>=1e3&&t({hasMoreVotes:!1});return}t({loadingMoreVotes:!0});try{const c=await Nr.getWitnessVotes(i||"",a,250);t(d=>{const l=[...d.witnessVotes,...c.votes].filter((u,p,b)=>b.findIndex(w=>w.account===u.account)===p),h=c.votes.filter((u,p,b)=>b.findIndex(w=>w.account===u.account)===p);return{witnessVotes:l,nextVotesStart:h.length>0?h[h.length-1].account:"",hasMoreVotes:c.votes.length===250}})}catch(c){console.error("Error loading more witness votes:",c)}finally{t({loadingMoreVotes:!1})}},loadUserWitnessVotes:async s=>{if(s){t({loadingUserVotes:!0});try{const n=await Nr.getUserWitnessVotes(s);t({userWitnessVotes:n})}catch(n){console.error("Error loading user witness votes:",n)}finally{t({loadingUserVotes:!1})}}},loadWitnessDetails:async s=>{try{const n=await Nr.getAccounts(s);t(a=>{const i=new Map(a.witnessDetails),o=new Map(a.witnessAccounts);return n.forEach(c=>{const d=Nr.getWitnessDescription(c);d&&i.set(c.name,d),o.set(c.name,c)}),{witnessDetails:i,witnessAccounts:o}})}catch(n){console.error("Error loading witness details:",n)}},setFilters:s=>t({filters:s}),setSelectedWitness:s=>t({selectedWitness:s}),clearVotes:()=>t({witnessVotes:[],nextVotesStart:"",hasMoreVotes:!1,selectedWitness:null})})),Zc=({filters:t,onFiltersChange:r,theme:s="dark"})=>{const n=s==="dark"?"text-blue-400 hover:text-blue-300":"text-blue-600 hover:text-blue-800",a=c=>{const d=t.status===c?"all":c;r({...t,status:d})},i=c=>{r({...t,name:c})},o=c=>{r({...t,version:c})};return e.jsxs("div",{className:`rounded-lg p-4 mb-6 border ${s==="dark"?"bg-slate-950 border-gray-800":"bg-white border-gray-200"}`,children:[e.jsx("h3",{className:`text-lg font-semibold mb-4 ${s==="dark"?"text-white":"text-gray-900"}`,children:"FILTERS"}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h4",{className:`text-sm font-medium mb-3 ${s==="dark"?"text-gray-300":"text-gray-700"}`,children:"WITNESS"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.status==="active",onChange:()=>a("active"),className:"w-4 h-4 text-blue-600 rounded focus:ring-blue-500 focus:ring-2"}),e.jsx("span",{className:`${s==="dark"?"text-white":"text-gray-900"}`,children:"Active"})]}),e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.status==="disabled",onChange:()=>a("disabled"),className:"w-4 h-4 text-blue-600 rounded focus:ring-blue-500 focus:ring-2"}),e.jsx("span",{className:`${s==="dark"?"text-white":"text-gray-900"}`,children:"Disabled/Stale"})]}),e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.status==="approved",onChange:()=>a("approved"),className:"w-4 h-4 text-blue-600 rounded focus:ring-blue-500 focus:ring-2"}),e.jsx("span",{className:`${s==="dark"?"text-white":"text-gray-900"}`,children:"Approved"})]}),t.status!=="all"&&e.jsx("button",{onClick:()=>r({...t,status:"all"}),className:`text-sm underline ${n}`,children:"Clear Status Filter"})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h4",{className:`text-sm font-medium mb-3 ${s==="dark"?"text-gray-300":"text-gray-700"}`,children:"NAME"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx("svg",{className:`w-4 h-4 ${s==="dark"?"text-gray-400":"text-gray-500"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),e.jsx("input",{type:"text",placeholder:"Search",value:t.name,onChange:c=>i(c.target.value),className:`w-full pl-10 pr-4 py-2 border-b focus:outline-none focus:border-blue-500 ${s==="dark"?"bg-slate-900 border-gray-700 text-white placeholder-gray-400":"bg-gray-50 border-gray-300 text-gray-900 placeholder-gray-500"}`})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:`text-sm font-medium mb-3 ${s==="dark"?"text-gray-300":"text-gray-700"}`,children:"VERSION"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx("svg",{className:`w-4 h-4 ${s==="dark"?"text-gray-400":"text-gray-500"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),e.jsx("input",{type:"text",placeholder:"Version",value:t.version,onChange:c=>o(c.target.value),className:`w-full pl-10 pr-4 py-2 border-b focus:outline-none focus:border-blue-500 ${s==="dark"?"bg-slate-900 border-gray-700 text-white placeholder-gray-400":"bg-gray-50 border-gray-300 text-gray-900 placeholder-gray-500"}`})]})]})]})},eo=768;function Lo(){const[t,r]=bn.useState(void 0);return bn.useEffect(()=>{const s=window.matchMedia(`(max-width: ${eo-1}px)`),n=()=>{r(window.innerWidth<eo)};return s.addEventListener("change",n),r(window.innerWidth<eo),()=>s.removeEventListener("change",n)},[]),!!t}const vg=({isOpen:t,onClose:r,witness:s,votes:n,loadingMore:a,hasMore:i,loadingInitial:o,scrollContainerRef:c,sentinelRef:d,loadMoreVotes:f,theme:l="dark"})=>{const h=k.useCallback(u=>{u[0].isIntersecting&&i&&!a&&f()},[i,a,f]);return k.useEffect(()=>{const u=new IntersectionObserver(h,{threshold:.1,root:c.current});return d.current&&u.observe(d.current),()=>{d.current&&u.unobserve(d.current)}},[h,c,d]),t?e.jsx("div",{className:"fixed inset-0 bg-black/50 bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`rounded-lg max-w-2xl w-full max-h-[80vh] overflow-hidden border ${l==="dark"?"bg-slate-950 border-gray-800":"bg-white border-gray-200"}`,children:[e.jsxs("div",{className:`flex items-center justify-between p-4 border-b ${l==="dark"?"border-gray-800":"border-gray-200"}`,children:[e.jsxs("h3",{className:`text-lg font-semibold ${l==="dark"?"text-white":"text-gray-900"}`,children:["Votes for @",s," (showing ",n.length,")"]}),e.jsx("button",{onClick:r,className:`text-xl font-bold ${l==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,children:"×"})]}),e.jsxs("div",{ref:c,className:"p-4 overflow-y-auto max-h-[60vh]",children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:n.map((u,p)=>e.jsxs("div",{className:`flex items-center space-x-3 p-3 rounded-lg border ${l==="dark"?"bg-gray-800 border-gray-800":"bg-gray-50 border-gray-200"}`,children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium ${l==="dark"?"bg-gray-600 text-white":"bg-gray-200 text-gray-900"}`,children:e.jsx("img",{className:"w-8 h-8 rounded-full",src:`https://images.hive.blog/u/${u.account}/avatar`,alt:u.account,onError:b=>{b.target.src="https://images.hive.blog/u/null/avatar"}})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:`font-medium ${l==="dark"?"text-white":"text-gray-900"}`,children:u.account}),e.jsxs("div",{className:`text-sm ${l==="dark"?"text-gray-400":"text-gray-500"}`,children:["Vote #",p+1]})]}),e.jsx("div",{className:`text-sm ${l==="dark"?"text-gray-400":"text-gray-500"}`,children:"25"})]},u.account))}),n.length===0&&!o&&e.jsx("div",{className:`text-center py-8 ${l==="dark"?"text-gray-400":"text-gray-500"}`,children:"No votes found for this witness."}),a&&e.jsx("div",{className:`text-center py-4 ${l==="dark"?"text-gray-400":"text-gray-500"}`,children:"Loading more votes..."}),i&&!a&&e.jsx("div",{className:"text-center py-4",children:e.jsx("button",{onClick:f,className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded",children:"Load More Votes"})}),i&&e.jsx("div",{ref:d,className:"h-4"})]})]})}):null},wg=({username:t,filters:r={status:"all",name:"",version:""},onWitnessVoteClick:s,onWitnessStatsClick:n,onWitnessUrlClick:a,theme:i="dark"})=>{const o=Lo(),c=Wt(U=>U.witnesses),d=Wt(U=>U.userWitnessVotes),f=Wt(U=>U.loadingWitnesses),l=Wt(U=>U.error),h=Wt(U=>U.selectedWitness),u=Wt(U=>U.witnessVotes),p=Wt(U=>U.hasMoreVotes),b=Wt(U=>U.loadingMoreVotes),w=Wt(U=>U.loadingVotes),x=Wt(U=>U.filters),g=Wt(U=>U.hasMoreWitnesses),v=Wt(U=>U.loadingWitnesses),N=Wt(U=>U.witnessDetails);Wt(U=>U.witnessAccounts);const j=Wt(U=>U.loadWitnesses),y=Wt(U=>U.loadMoreWitnesses),m=Wt(U=>U.loadWitnessVotes),_=Wt(U=>U.loadMoreVotes),E=Wt(U=>U.loadUserWitnessVotes),A=Wt(U=>U.setFilters),[C,T]=k.useState(!1),[D,L]=k.useState(!1),H=k.useRef(null),V=k.useRef(null),z=k.useRef(null),F=k.useCallback(U=>{U[0].isIntersecting&&g&&!v&&y()},[g,v,y]);k.useEffect(()=>{const U=new IntersectionObserver(F,{threshold:.1});return z.current&&U.observe(z.current),()=>{z.current&&U.unobserve(z.current)}},[F]),k.useEffect(()=>{j()},[j]),k.useEffect(()=>{t&&E(t)},[t,E]),k.useEffect(()=>{A(r)},[]);const Y=k.useMemo(()=>c.filter(U=>{if(x.status!=="all"){if(x.status==="active"){const q=new Date;if(q.setFullYear(q.getFullYear()-1),new Date(U.last_hbd_exchange_update+"Z")<=q)return!1}else if(x.status==="disabled"){const q=new Date;if(q.setFullYear(q.getFullYear()-1),new Date(U.last_hbd_exchange_update+"Z")>q)return!1}else if(x.status==="approved"&&!d.includes(U.owner))return!1}return!(x.name&&!U.owner.toLowerCase().includes(x.name.toLowerCase())||x.version&&!U.running_version.includes(x.version))}),[c,x,d]),G=async U=>{s?s(U):(await m(U),T(!0))},ne=U=>{n?n(U):window.open(`https://hivehub.dev/witnesses/@${U}`,"_blank")},ie=U=>{a?a(U):window.open(U,"_blank")},xe=U=>t?d.includes(U):!1;return f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"})}):l?e.jsx("div",{className:"text-center p-8 text-red-400",children:l}):e.jsxs("div",{className:"w-full",children:[e.jsx(vg,{isOpen:C,onClose:()=>T(!1),witness:h||"",votes:u,loadingMore:b,hasMore:p,loadingInitial:w,scrollContainerRef:V,sentinelRef:H,loadMoreVotes:_,theme:i}),o?e.jsxs("div",{className:`w-full p-2 ${i==="dark"?"bg-slate-950":"bg-white"}`,children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h2",{className:`text-lg font-semibold ${i==="dark"?"text-white":"text-gray-900"}`,children:"Witnesses"}),e.jsxs("button",{onClick:()=>L(!D),className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded flex items-center space-x-2",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),e.jsx("span",{children:D?"Hide Filters":"Show Filters"})]})]}),D&&e.jsx("div",{className:"fixed inset-0 bg-black/50 bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`rounded-lg w-full max-w-md max-h-[80vh] overflow-hidden border ${i==="dark"?"bg-slate-950 border-gray-800":"bg-white border-gray-200"}`,children:[e.jsxs("div",{className:`flex items-center justify-between p-4 border-b ${i==="dark"?"border-gray-800":"border-gray-200"}`,children:[e.jsx("h3",{className:`text-lg font-semibold ${i==="dark"?"text-white":"text-gray-900"}`,children:"Filters"}),e.jsx("button",{onClick:()=>L(!1),className:`text-xl font-bold ${i==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,children:"×"})]}),e.jsx("div",{className:"p-4 overflow-y-auto max-h-[60vh]",children:e.jsx(Zc,{filters:x,onFiltersChange:A,theme:i})})]})}),e.jsxs("div",{className:"space-y-4 max-h-[70vh] overflow-y-auto",children:[Y.map((U,q)=>{const B=Nr.getVersionStatus(U.running_version,U.hardfork_version_vote),pe=xe(U.owner),ee=c.findIndex(te=>te.owner===U.owner)+1;return e.jsxs("div",{className:`rounded-lg border p-4 shadow-sm ${i==="dark"?"bg-slate-900 border-gray-800":"bg-white border-gray-200"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsxs("span",{className:`text-lg font-bold ${i==="dark"?"text-white":"text-gray-900"}`,children:["#",ee]}),e.jsx("img",{className:"w-10 h-10 rounded-full",src:`https://images.hive.blog/u/${U.owner}/avatar`,alt:U.owner,onError:te=>{te.target.src="https://images.hive.blog/u/null/avatar"}}),e.jsxs("div",{children:[e.jsx("div",{className:`font-medium ${i==="dark"?"text-white":"text-gray-900"}`,children:U.owner}),e.jsxs("div",{className:`text-xs ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:["Since ",new Date(U.created).getFullYear()]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("svg",{className:`w-6 h-6 ${pe?"text-green-600":i==="dark"?"text-gray-500":"text-gray-400"}`,fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex space-x-1",children:[e.jsx("button",{onClick:()=>ie(U.url),className:`${i==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,title:"Visit witness URL",children:"🔗"}),e.jsx("button",{onClick:()=>ne(U.owner),className:`${i==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,title:"View witness stats",children:"📊"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-3",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`text-xs uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Version"}),e.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium mt-1 block ${B==="green"?"bg-green-100 text-green-800":B==="red"?"bg-red-100 text-red-800":"bg-gray-100 text-gray-800"}`,children:U.running_version})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`text-xs uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Votes (MHP)"}),e.jsx("button",{onClick:()=>G(U.owner),className:"text-blue-600 hover:text-blue-800 cursor-pointer text-sm font-medium mt-1",disabled:w,children:w&&h===U.owner?"Loading...":Nr.formatVotesToMHP(U.votes)})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`text-xs uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"APR"}),e.jsxs("div",{className:`font-medium mt-1 ${i==="dark"?"text-white":"text-gray-900"}`,children:[Nr.calculateAPR(U.props.hbd_interest_rate),"%"]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 text-xs",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Last Block"}),e.jsx("div",{className:`${i==="dark"?"text-white":"text-gray-900"}`,children:U.last_confirmed_block_num.toLocaleString()})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Miss"}),e.jsx("div",{className:`${i==="dark"?"text-white":"text-gray-900"}`,children:U.total_missed.toLocaleString()})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Price Feed"}),e.jsx("div",{className:`${i==="dark"?"text-white":"text-gray-900"}`,children:U.hbd_exchange_rate.base}),e.jsx("div",{className:`${i==="dark"?"text-gray-400":"text-gray-500"}`,children:Nr.formatTimeAgo(U.last_hbd_exchange_update+"Z")})]})]}),N.get(U.owner)&&e.jsx("div",{className:`mt-3 pt-3 border-t ${i==="dark"?"border-gray-800":"border-gray-200"}`,children:e.jsx("div",{className:`text-xs line-clamp-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:N.get(U.owner)})})]},U.owner)}),v&&e.jsxs("div",{className:"flex items-center justify-center py-4",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500"}),e.jsx("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Loading more witnesses..."})]}),g&&e.jsx("div",{ref:z,className:"h-1"})]})]}):e.jsx("div",{className:`max-w-7xl mx-auto p-2 ${i==="dark"?"bg-slate-950":"bg-white"}`,children:e.jsxs("div",{className:"grid grid-cols-5 gap-4",children:[e.jsx("div",{className:"col-span-1 sticky top-0 h-screen overflow-y-auto",children:e.jsx(Zc,{filters:x,onFiltersChange:A,theme:i})}),e.jsxs("div",{className:"col-span-4 overflow-auto max-h-screen",children:[e.jsxs("table",{className:`w-full text-xs text-left ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:[e.jsx("thead",{className:`text-xs uppercase ${i==="dark"?"text-gray-400 bg-slate-900":"text-gray-700 bg-gray-50"}`,children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Rank"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Witness"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Version"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Votes"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Last Block"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Miss"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Feed"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"APR"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Vote"})]})}),e.jsx("tbody",{children:Y.map((U,q)=>{const B=Nr.getVersionStatus(U.running_version,U.hardfork_version_vote),pe=xe(U.owner);return e.jsxs("tr",{className:`border-b hover:bg-gray-50 ${i==="dark"?"border-gray-800 hover:bg-gray-800":"border-gray-200"}`,children:[e.jsx("td",{className:`px-2 py-2 font-medium text-xs ${i==="dark"?"text-white":"text-gray-900"}`,children:c.findIndex(ee=>ee.owner===U.owner)+1}),e.jsx("td",{className:"px-2 py-2",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("img",{className:"w-6 h-6 rounded-full",src:`https://images.hive.blog/u/${U.owner}/avatar`,alt:U.owner,onError:ee=>{ee.target.src="https://images.hive.blog/u/null/avatar"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:`font-medium text-xs truncate ${i==="dark"?"text-white":"text-gray-900"}`,children:U.owner}),e.jsxs("div",{className:`text-xs ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:["Since ",new Date(U.created).getFullYear()]})]}),e.jsxs("div",{className:"flex space-x-1 flex-shrink-0",children:[e.jsx("button",{onClick:()=>ie(U.url),className:`text-xs ${i==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,title:"Visit witness URL",children:"🔗"}),e.jsx("button",{onClick:()=>ne(U.owner),className:`text-xs ${i==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,title:"View witness stats",children:"📊"})]})]})}),e.jsx("td",{className:"px-2 py-2",children:e.jsx("span",{className:`px-1 py-0.5 rounded text-xs font-medium ${B==="green"?"bg-green-100 text-green-800":B==="red"?"bg-red-100 text-red-800":"bg-gray-100 text-gray-800"}`,children:U.running_version})}),e.jsx("td",{className:"px-2 py-2",children:e.jsx("button",{onClick:()=>G(U.owner),className:"text-blue-600 hover:text-blue-800 cursor-pointer text-xs",disabled:w,children:w&&h===U.owner?"...":Nr.formatVotesToMHP(U.votes)})}),e.jsx("td",{className:"px-2 py-2 text-right",children:e.jsx("div",{className:`text-xs ${i==="dark"?"text-white":"text-gray-900"}`,children:U.last_confirmed_block_num.toLocaleString()})}),e.jsx("td",{className:"px-2 py-2 text-right text-xs",children:e.jsx("div",{className:`${i==="dark"?"text-white":"text-gray-900"}`,children:U.total_missed.toLocaleString()})}),e.jsx("td",{className:"px-2 py-2 text-right",children:e.jsx("div",{className:`text-xs ${i==="dark"?"text-white":"text-gray-900"}`,children:U.hbd_exchange_rate.base})}),e.jsx("td",{className:"px-2 py-2 text-right text-xs",children:e.jsxs("div",{className:`${i==="dark"?"text-white":"text-gray-900"}`,children:[Nr.calculateAPR(U.props.hbd_interest_rate),"%"]})}),e.jsx("td",{className:"px-2 py-2",children:e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("svg",{className:`w-4 h-4 ${pe?"text-green-600":i==="dark"?"text-gray-500":"text-gray-400"}`,fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})})]},U.owner)})})]}),v&&e.jsxs("div",{className:"flex items-center justify-center py-4",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500"}),e.jsx("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Loading more witnesses..."})]}),g&&e.jsx("div",{ref:z,className:"h-1"})]})]})})]})},Ng=new Da.Client(["https://api.hive.blog","https://api.syncad.com","https://api.deathwing.me"]);class jg{async getTransactionHistory(r,s=-1,n=1e3,a=null,i=null){try{const o=[r,s,n];a!==null&&i!==null&&o.push(a,i);const c=await Ng.call("condenser_api","get_account_history",o);return Array.isArray(c)?c.map(d=>Array.isArray(d)&&d.length>=2?d[1]:d):[]}catch(o){return console.error("Error in getTransactionHistory:",o),[]}}async getFilteredTransactionHistory(r,s=[],n=100){try{const a=await this.getTransactionHistory(r,-1,1e3);let i=a;return s.length>0&&(i=a.filter(o=>{const c=o.op?.[0];return s.includes(c)})),i.slice(0,n)}catch(a){return console.error("Error in getFilteredTransactionHistory:",a),[]}}async getRecentTransfers(r,s=50){return this.getFilteredTransactionHistory(r,["transfer"],s)}async getRecentVotes(r,s=50){return this.getFilteredTransactionHistory(r,["vote"],s)}async getRecentComments(r,s=50){return this.getFilteredTransactionHistory(r,["comment"],s)}parseOperation(r){try{if(!r.op||!Array.isArray(r.op)||r.op.length<2)return null;const[s,n]=r.op;switch(s){case"transfer":return{type:"transfer",value:{from:n.from||"",to:n.to||"",amount:n.amount||"",memo:n.memo||""}};case"vote":return{type:"vote",value:{voter:n.voter||"",author:n.author||"",permlink:n.permlink||"",weight:n.weight||0}};case"comment":return{type:"comment",value:{parent_author:n.parent_author||"",parent_permlink:n.parent_permlink||"",author:n.author||"",permlink:n.permlink||"",title:n.title||"",body:n.body||"",json_metadata:n.json_metadata||""}};case"custom_json":return{type:"custom_json",value:{required_auths:n.required_auths||[],required_posting_auths:n.required_posting_auths||[],id:n.id||"",json:n.json||""}};case"comment_payout_update":return{type:"comment_payout_update",value:{author:n.author||"",permlink:n.permlink||""}};case"comment_options":return{type:"comment_options",value:{author:n.author||"",permlink:n.permlink||"",max_accepted_payout:n.max_accepted_payout||"",percent_hbd:n.percent_hbd||0,allow_votes:n.allow_votes||!1,allow_curation_rewards:n.allow_curation_rewards||!1,extensions:n.extensions||[]}};case"effective_comment_vote":return{type:"effective_comment_vote",value:{voter:n.voter||"",author:n.author||"",permlink:n.permlink||"",pending_payout:n.pending_payout||"",weight:n.weight||0,rshares:n.rshares||0,total_vote_weight:n.total_vote_weight||0}};default:return console.warn("Unknown operation type:",s,r.op),null}}catch(s){return console.error("Error parsing operation:",s,r.op),null}}formatTimestamp(r){try{return new Date(r).toLocaleString()}catch(s){return console.error("Error formatting timestamp:",s),r}}getTransactionSummary(r){const s={};let n="",a="";return r.forEach(i=>{const o=i.op?.[0]||"unknown";s[o]=(s[o]||0)+1,(!n||i.timestamp<n)&&(n=i.timestamp),(!a||i.timestamp>a)&&(a=i.timestamp)}),{totalTransactions:r.length,operationCounts:s,dateRange:{earliest:n,latest:a}}}}const Aa=new jg;function _g({account:t,className:r}){const[s,n]=k.useState([]),[a,i]=k.useState([]),[o,c]=k.useState(!1),[d,f]=k.useState(null),[l,h]=k.useState(""),[u,p]=k.useState("all"),[b,w]=k.useState(50),x=[{value:"all",label:"All Operations",icon:O.Activity},{value:"transfer",label:"Transfers",icon:O.Send},{value:"vote",label:"Votes",icon:O.TrendingUp},{value:"comment",label:"Comments",icon:O.MessageCircle},{value:"custom_json",label:"Custom JSON",icon:O.ArrowUpDown},{value:"comment_payout_update",label:"Payout Updates",icon:O.RefreshCw},{value:"comment_options",label:"Comment Options",icon:O.Filter},{value:"effective_comment_vote",label:"Effective Votes",icon:O.Users}],g=async()=>{if(t){c(!0),f(null);try{const y=await Aa.getTransactionHistory(t,-1,b);n(y),i(y)}catch(y){f("Failed to load transaction history"),console.error("Error loading transactions:",y)}finally{c(!1)}}};k.useEffect(()=>{g()},[t,b]),k.useEffect(()=>{let y=s;if(u!=="all"&&(y=y.filter(m=>m.op?.[0]===u)),l){const m=l.toLowerCase();y=y.filter(_=>{const E=Aa.parseOperation(_);if(!E)return!1;switch(E.type){case"transfer":return E.value.from.toLowerCase().includes(m)||E.value.to.toLowerCase().includes(m)||E.value.memo.toLowerCase().includes(m);case"vote":return E.value.voter.toLowerCase().includes(m)||E.value.author.toLowerCase().includes(m)||E.value.permlink.toLowerCase().includes(m);case"comment":return E.value.author.toLowerCase().includes(m)||E.value.title.toLowerCase().includes(m)||E.value.permlink.toLowerCase().includes(m);default:return!1}})}i(y)},[s,u,l]);const v=y=>{if(!y)return e.jsx(O.Activity,{className:"h-4 w-4"});const m=x.find(_=>_.value===y.type)?.icon||O.Activity;return e.jsx(m,{className:"h-4 w-4"})},N=y=>{const m=Aa.parseOperation(y);if(!m)return e.jsx("span",{className:"text-gray-400",children:"Unknown operation"});switch(m.type){case"transfer":return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Transfer"}),e.jsx("span",{className:"text-sm font-medium text-white",children:m.value.amount})]}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"From:"}),e.jsx("img",{src:Ee.userAvatar(m.value.from),alt:`${m.value.from} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.from)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.from})]}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"To:"}),e.jsx("img",{src:Ee.userAvatar(m.value.to),alt:`${m.value.to} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.to)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.to})]}),m.value.memo&&e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Memo:"})," ",m.value.memo]})]});case"vote":return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Vote"}),e.jsxs("span",{className:"text-sm font-medium text-white",children:[m.value.weight,"%"]})]}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"Voter:"}),e.jsx("img",{src:Ee.userAvatar(m.value.voter),alt:`${m.value.voter} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.voter)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.voter})]}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"Author:"}),e.jsx("img",{src:Ee.userAvatar(m.value.author),alt:`${m.value.author} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.author)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.author})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Permlink:"})," ",m.value.permlink]})]});case"comment":return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Comment"})}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"Author:"}),e.jsx("img",{src:Ee.userAvatar(m.value.author),alt:`${m.value.author} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.author)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.author})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Title:"})," ",m.value.title]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Permlink:"})," ",m.value.permlink]})]});case"custom_json":return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Custom JSON"})}),e.jsxs("div",{className:"text-sm text-gray-400",children:["ID: ",m.value.id]}),e.jsxs("div",{className:"text-sm text-gray-400",children:["JSON: ",m.value.json.substring(0,100),"..."]})]});case"comment_payout_update":return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Payout Update"})}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"Author:"}),e.jsx("img",{src:Ee.userAvatar(m.value.author),alt:`${m.value.author} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.author)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.author})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Permlink:"})," ",m.value.permlink]})]});case"comment_options":return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Comment Options"})}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"Author:"}),e.jsx("img",{src:Ee.userAvatar(m.value.author),alt:`${m.value.author} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.author)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.author})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Max Payout:"})," ",m.value.max_accepted_payout]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"HBD Percent:"})," ",m.value.percent_hbd,"%"]})]});case"effective_comment_vote":return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Effective Vote"}),e.jsx("span",{className:"text-sm font-medium text-white",children:m.value.weight})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:["Voter:"," ",e.jsx("span",{className:"font-mono text-gray-300",children:m.value.voter})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:["Post: @",m.value.author,"/",m.value.permlink]}),e.jsxs("div",{className:"text-sm text-gray-400",children:["Pending Payout: ",m.value.pending_payout]})]});default:return e.jsx("span",{className:"text-gray-400",children:"Unknown operation"})}},j=Aa.getTransactionSummary(s);return o?e.jsxs("div",{className:`bg-gray-800 border border-gray-700 rounded-lg shadow-sm ${r}`,children:[e.jsxs("div",{className:"p-2 md:p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(O.Activity,{className:"h-5 w-5 text-gray-300"}),e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Transaction History"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Loading transaction history for"}),e.jsx("img",{src:Ee.userAvatar(t),alt:`${t} avatar`,className:"w-6 h-6 rounded-full",onError:y=>{y.target.src=Ee.userAvatar(t)}}),e.jsxs("p",{className:"text-sm text-gray-400",children:["@",t]})]})]}),e.jsx("div",{className:"p-2 md:p-6 space-y-2 md:space-y-4",children:Array.from({length:5}).map((y,m)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded animate-pulse w-3/4"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded animate-pulse w-1/2"})]},m))})]}):e.jsxs("div",{className:`bg-gray-800 border border-gray-700 rounded-lg shadow-sm ${r}`,children:[e.jsxs("div",{className:"p-4 md:p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(O.Activity,{className:"h-5 w-5 text-gray-300"}),e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Transaction History"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Transaction history for"}),e.jsx("img",{src:Ee.userAvatar(t),alt:`${t} avatar`,className:"w-6 h-6 rounded-full",onError:y=>{y.target.src=Ee.userAvatar(t)}}),e.jsxs("p",{className:"text-sm text-gray-400",children:["@",t]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-white",children:j.totalTransactions}),e.jsx("div",{className:"text-sm text-gray-400",children:"Total"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-white",children:j.operationCounts.transfer||0}),e.jsx("div",{className:"text-sm text-gray-400",children:"Transfers"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-white",children:j.operationCounts.vote||0}),e.jsx("div",{className:"text-sm text-gray-400",children:"Votes"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-white",children:j.operationCounts.comment||0}),e.jsx("div",{className:"text-sm text-gray-400",children:"Comments"})]})]})]}),e.jsxs("div",{className:"p-4 md:p-6 space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search transactions...",value:l,onChange:y=>h(y.target.value),className:"w-full pl-10 pr-3 py-2 bg-gray-700 border border-gray-600 rounded-md text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"})]})}),e.jsx("select",{value:u,onChange:y=>p(y.target.value),className:"w-full sm:w-48 px-3 py-2 bg-gray-700 border border-gray-600 rounded-md text-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:x.map(y=>e.jsx("option",{value:y.value,children:y.label},y.value))}),e.jsxs("select",{value:b.toString(),onChange:y=>w(parseInt(y.target.value)),className:"w-full sm:w-32 px-3 py-2 bg-gray-700 border border-gray-600 rounded-md text-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:[e.jsx("option",{value:"25",children:"25"}),e.jsx("option",{value:"50",children:"50"}),e.jsx("option",{value:"100",children:"100"}),e.jsx("option",{value:"200",children:"200"})]}),e.jsx("button",{onClick:g,className:"px-3 py-2 bg-gray-700 border border-gray-600 rounded-md hover:bg-gray-600 text-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:e.jsx(O.RefreshCw,{className:"h-4 w-4"})})]}),d&&e.jsx("div",{className:"p-4 border border-red-700 bg-red-900 rounded-md",children:e.jsx("p",{className:"text-red-300",children:d})}),e.jsx("div",{className:"space-y-4",children:a.length===0?e.jsx("div",{className:"text-center py-8 text-gray-400",children:"No transactions found"}):a.map(y=>{const m=Aa.parseOperation(y);return e.jsxs("div",{className:"border border-gray-600 rounded-lg p-3 md:p-4 space-y-3 hover:bg-gray-700 transition-colors",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-3",children:[v(m),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-white",children:m?.type?m.type.charAt(0).toUpperCase()+m.type.slice(1):"Unknown"}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-1",children:[e.jsx(O.Clock,{className:"h-3 w-3"}),Aa.formatTimestamp(y.timestamp)]})]})]})}),e.jsx("div",{className:"ml-6 md:ml-7",children:N(y)})]},`${y.trx_id}-${y.op_in_trx}`)})}),a.length>0&&e.jsxs("div",{className:"text-center text-sm text-gray-400",children:["Showing ",a.length," of ",s.length," ","transactions"]})]})]})}const kg=new Da.Client(["https://api.hive.blog","https://api.syncad.com","https://api.deathwing.me"]);class Eg{async getUserChannel(r,s="posts",n=20,a=null,i=null,o=null){const c={account:r,sort:s,limit:n};a&&(c.start_author=a),i&&(c.start_permlink=i),o&&(c.observer=o);try{const d=await kg.call("bridge","get_account_posts",c);return Array.isArray(d)?d:[]}catch(d){return console.error("Error in getUserChannel:",d),[]}}async getUserPosts(r,s=20){return this.getUserChannel(r,"posts",s)}async getUserComments(r,s=20){return this.getUserChannel(r,"comments",s)}async getUserReplies(r,s=20){return this.getUserChannel(r,"replies",s)}async getAllUserActivity(r,s=10){try{const[n,a,i]=await Promise.all([this.getUserPosts(r,s),this.getUserComments(r,s),this.getUserReplies(r,s)]);return[...n,...a,...i].sort((c,d)=>new Date(d.created).getTime()-new Date(c.created).getTime())}catch(n){return console.error("Error in getAllUserActivity:",n),[]}}convertToDisplayItem(r){return{id:r.id,author:r.author,permlink:r.permlink,title:r.title,body:r.body,created:r.created,category:r.category,net_votes:r.net_votes,children:r.children,total_payout_value:r.total_payout_value,pending_payout_value:r.pending_payout_value,url:r.url,type:r.parent_author===""?"post":"comment"}}formatTimestamp(r){try{return new Date(r).toLocaleString()}catch(s){return console.error("Error formatting timestamp:",s),r}}getRelativeTime(r){try{const s=new Date(r),a=new Date().getTime()-s.getTime(),i=Math.floor(a/1e3),o=Math.floor(i/60),c=Math.floor(o/60),d=Math.floor(c/24);return i<60?`${i} seconds ago`:o<60?`${o} minutes ago`:c<24?`${c} hours ago`:d<7?`${d} days ago`:s.toLocaleDateString()}catch(s){return console.error("Error calculating relative time:",s),r}}truncateText(r,s=150){return r.length<=s?r:r.substring(0,s)+"..."}getActivitySummary(r){let s=0,n=0,a=0,i=0;return r.forEach(o=>{o.parent_author===""?s++:n++,a+=o.net_votes||0;const c=o.total_payout_value?.match(/(\d+\.?\d*)/);c&&(i+=parseFloat(c[1]))}),{totalActivities:r.length,postsCount:s,commentsCount:n,totalVotes:a,totalPayout:`${i.toFixed(3)} HIVE`,averageVotes:r.length>0?Math.round(a/r.length):0}}filterByCategory(r,s){return r.filter(n=>n.category===s)}filterByDateRange(r,s,n){return r.filter(a=>{const i=new Date(a.created);return i>=s&&i<=n})}searchActivities(r,s){const n=s.toLowerCase();return r.filter(a=>a.title.toLowerCase().includes(n)||a.body.toLowerCase().includes(n)||a.category.toLowerCase().includes(n))}}const Sa=new Eg,Ag=({username:t,className:r})=>{const[s,n]=k.useState([]),[a,i]=k.useState([]),[o,c]=k.useState([]),[d,f]=k.useState([]),[l,h]=k.useState([]),[u,p]=k.useState(!1),[b,w]=k.useState(null),[x,g]=k.useState(""),[v,N]=k.useState(20),[j,y]=k.useState("all"),[m,_]=k.useState(new Set),[E,A]=k.useState(!1),C=async()=>{if(!(!t||E)){p(!0),w(null);try{const[F,Y,G]=await Promise.all([Sa.getUserPosts(t,v),Sa.getUserComments(t,v),Sa.getUserReplies(t,v)]);n(F),i(Y),c(G),A(!0)}catch(F){w("Failed to load activity history"),console.error("Error loading activities:",F)}finally{p(!1)}}};k.useEffect(()=>{C()},[t]),k.useEffect(()=>{if(!E)return;let F=[];switch(j){case"posts":F=s;break;case"comments":F=a;break;case"replies":F=o;break;default:F=[...s,...a,...o].sort((Y,G)=>new Date(G.created).getTime()-new Date(Y.created).getTime());break}f(F),h(F)},[j,s,a,o,E]),k.useEffect(()=>{let F=d;x&&(F=Sa.searchActivities(d,x)),h(F)},[d,x]);const T=F=>!F||F==="0.000 HIVE"?"0 HIVE":F,D=F=>F.parent_author===""?"Post":F.depth===1?"Comment":"Reply",L=new Bn.DefaultRenderer({baseUrl:"https://hive.blog/",breaks:!0,skipSanitization:!1,allowInsecureScriptTags:!1,addNofollowToLinks:!0,doNotShowImages:!1,assetsWidth:640,assetsHeight:480,imageProxyFn:F=>F,usertagUrlFn:F=>`/@${F}`,hashtagUrlFn:F=>`/trending/${F}`,isLinkSafeFn:F=>!0,addExternalCssClassToMatchingLinksFn:F=>!0,ipfsPrefix:"https://ipfs.io/ipfs/"}),H=F=>{const Y=new Set(m);Y.has(F)?Y.delete(F):Y.add(F),_(Y)},V=F=>{const Y=`${F.author}-${F.permlink}`,G=m.has(Y),ne=F.body.length>100;return e.jsxs("div",{className:"border border-gray-200 dark:border-gray-600 rounded-lg p-3 sm:p-4 space-y-3 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors relative",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3",children:e.jsx("div",{className:"flex items-start gap-3 flex-1",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[e.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${F.parent_author===""?"bg-blue-900 text-blue-300":"bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300"}`,children:D(F)}),e.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:["in #",F.category]})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("img",{src:Ee.userAvatar(F.author),alt:`${F.author} avatar`,className:"w-5 h-5 sm:w-6 sm:h-6 rounded-full flex-shrink-0",onError:ie=>{ie.target.src=Ee.userAvatar(F.author)}}),e.jsx("h3",{className:"font-medium text-base sm:text-lg leading-tight text-gray-900 dark:text-white break-words",children:F.title||"Untitled"})]}),e.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none mb-3 text-gray-500 dark:text-gray-400 comment-content overflow-hidden",children:[e.jsx("div",{className:"break-words overflow-wrap-anywhere",dangerouslySetInnerHTML:{__html:L.render(ne&&!G?F.body.substring(0,50)+".....":F.body)}}),ne&&e.jsxs("button",{onClick:()=>H(Y),className:"mt-2 text-blue-400 hover:text-blue-300 text-sm font-medium flex items-center gap-1",children:[e.jsx(O.ChevronDown,{className:`h-3 w-3 transition-transform ${G?"rotate-180":""}`}),G?"Show less":"Show more"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-4 text-sm text-gray-500 dark:text-gray-400",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"h-3 w-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:Sa.getRelativeTime(F.created)})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(O.ThumbsUp,{className:"h-3 w-3 flex-shrink-0"}),e.jsxs("span",{children:[F.net_votes," votes"]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(O.Reply,{className:"h-3 w-3 flex-shrink-0"}),e.jsxs("span",{children:[F.children," replies"]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"💰"}),e.jsx("span",{children:T(F.total_payout_value)})]})]})]})})}),e.jsx("button",{onClick:()=>window.open(`https://peakd.com/@${F.author}/${F.permlink}`,"_blank"),className:"absolute top-3 right-3 flex-shrink-0 p-2 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:e.jsx(O.ExternalLink,{className:"h-4 w-4"})})]},Y)},z=Sa.getActivitySummary(d);return u?e.jsxs("div",{className:`bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm ${r}`,children:[e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Loading activity history for"}),e.jsx("img",{src:Ee.userAvatar(t),alt:`${t} avatar`,className:"w-6 h-6 rounded-full",onError:F=>{F.target.src=Ee.userAvatar(t)}}),e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["@",t]})]})}),e.jsx("div",{className:"p-6 space-y-4",children:Array.from({length:5}).map((F,Y)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-3/4"}),e.jsx("div",{className:"h-3 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-1/2"}),e.jsx("div",{className:"h-20 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-full"})]},Y))})]}):e.jsxs("div",{className:`space-y-6 ${r}`,children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:e.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-6",children:[e.jsx("img",{src:Ee.userAvatar(t),alt:`${t} avatar`,className:"w-16 h-16 rounded-full object-cover",onError:F=>{F.target.src=Ee.userAvatar(t)}}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:["@",t]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:"Activity History"}),e.jsx("div",{className:"flex flex-wrap gap-6 text-sm",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.FileText,{className:"w-4 h-4"}),e.jsxs("span",{children:[z.totalActivities," Total Activities"]})]})})]})]})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex md:grid md:grid-cols-4 overflow-x-auto md:overflow-visible w-full bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg",children:[e.jsx("button",{onClick:()=>y("all"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${j==="all"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"All"}),e.jsx("button",{onClick:()=>y("posts"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${j==="posts"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"Posts"}),e.jsx("button",{onClick:()=>y("comments"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${j==="comments"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"Comments"}),e.jsx("button",{onClick:()=>y("replies"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${j==="replies"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"Replies"})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"flex flex-row gap-4 mb-6",children:[e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-500 dark:text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search activities...",value:x,onChange:F=>g(F.target.value),className:"w-full pl-10 pr-3 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"})]})}),e.jsx("button",{onClick:()=>{A(!1),C()},className:"px-3 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:e.jsx(O.RefreshCw,{className:"h-4 w-4"})})]}),b&&e.jsx("div",{className:"p-4 border border-red-200 dark:border-red-700 bg-red-50 dark:bg-red-900 rounded-md",children:e.jsx("p",{className:"text-red-600 dark:text-red-300",children:b})}),e.jsx("div",{className:"space-y-4",children:l.length===0?e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No activities found"}):l.map(V)}),l.length>0&&e.jsxs("div",{className:"text-center text-sm text-gray-500 dark:text-gray-400",children:["Showing ",l.length," of ",d.length," ","activities"]})]})]})]})},Qt="https://images.ecency.com",rt={actifit_logo:`${Qt}/DQmemUxomzr8RFEZGoT7a8rSvpx1LnzuAzDNyikKuENkSuc/actifit_logo.png`,checkinwithxyz:`${Qt}/DQmUAbGJ1XN461zbaEus7aam1vuVg1cMAtzpuLGgwdAPUEU/checkinwithxyz.png`,developers:`${Qt}/DQmNeGvBgY5r4pay9fhrD8LforDyasa2kstPwBmaLcQBmSW/developers.png`,distriator_logo:`${Qt}/DQmZw6AXZ7wmEChsWXA3onVZXCsRUYGwbp87qP9onaLAvLW/distriator_logo.png`,ecency_logo:`${Qt}/DQmNsuCkexmEKoWB9ywdR5UkzRQ4Xu6CAgHjRTATCB23znc/ecency_logo.png`,happrover_logo:`${Qt}/DQmcy4sHYiMkUJYLhu4jgrvVbvk9vxeSvXHn21ZpVLXK6Jf/happrover_logo.png`,hive_logo:`${Qt}/DQma5YQXrk1WZ7oxgLqdPjbVdShmVGzeL7yZ6BCQGjMF6G3/hive_logo.png`,hive_fest_fact_logo:`${Qt}/DQmTiwJfQSBsdQMAivWfi97P6UwUqsd4wBgFmP2xhQjtA4r/hive_fest_fact_logo.png`,hiveauth_logo:`${Qt}/DQmP9vkxQuQkaCfin2whQfokMF9YJMN3Aujz9B5sGQVNWoE/hiveauth_logo.png`,hpolls_logo:`${Qt}/DQmejtPJC86dhzUKPZxQxaCBaud2ocy6PWPLqjEHNPoWQnX/hpolls_logo.png`,hreplier:`${Qt}/DQmRMrDJvNBeRzDj1W8e99TqkN87Ch7w9SWun6woVaRTAZ3/hreplier.png`,nodes:`${Qt}/DQmbmVKTexP4r4CfzmQKztzBdA26vZBJuJHLZo5GwT88Gxf/nodes.png`,podcast_logo:`${Qt}/DQmd1xwQJvM5pPvWpXoNT1vWqo4XqFvN7RDUVZb3w6ZxHLo/podcast_logo.jpg`,stats_logo:`${Qt}/DQme3DKpB5uVv5ASf9AkFHLY3JdxD2YQMuPa6k2jptULXRY/stats_logo.png`,template:`${Qt}/DQmStuCUgDJmxtLKLUd3fZKmYyPEbvuopdRhwFx3SHiycCq/template.png`,three_shorts_logo:`${Qt}/DQmbNeu2p1GokLH6T8QwekCJBSwSK4qo29ebeVwqD1YbK25/three_shorts_logo.png`,three_speak_logo:`${Qt}/DQmc84A9bXdQ3oRMz3YgV1VNCAFvPbJVSvsf434FApxg2cf/three_speak_logo.png`,vote_logo:`${Qt}/DQmVa8V2FCjJKMaqgoUaRDHPa4TYdqceCmAbCJU7rGj5yBe/vote_logo.png`},Sg=[{key:"vote-witness-sagar",name:"Vote Witness Sagar",url:"https://vote.hive.uno/@sagarkothari88",logo:"",alwaysVisible:!0,isAvatar:!0,avatarUrl:"https://images.hive.blog/u/sagarkothari88/avatar"},{key:"vote-witness-threespeak",name:"Vote Witness 3Speak",url:"https://vote.hive.uno/@threespeak",logo:rt.three_speak_logo,alwaysVisible:!0},{key:"distriator",name:"Distriator",url:"https://distriator.com/",logo:rt.distriator_logo,visibilityKey:"isDistriator"},{key:"checkinwithxyz",name:"CheckinWithXYZ",url:"https://checkinwith.xyz/",logo:rt.checkinwithxyz,visibilityKey:"isCheckinwithxyz"},{key:"hreplier",name:"HReplier",url:"https://hreplier.sagarkothari88.one/",logo:rt.hreplier,visibilityKey:"isHreplier"},{key:"hpolls",name:"HPolls",url:"https://hpolls.sagarkothari88.one/",logo:rt.hpolls_logo,visibilityKey:"isHpolls"},{key:"hstats",name:"HStats",url:"https://hstats.sagarkothari88.one/",logo:rt.stats_logo,visibilityKey:"isHstats"},{key:"hsnaps",name:"HSnaps",url:"https://hsnaps.sagarkothari88.one/",logo:rt.template,visibilityKey:"isHsnaps"},{key:"3speak",name:"3Speak",url:"https://3speak.tv/",logo:rt.three_speak_logo,alwaysVisible:!0},{key:"hivefestfacts",name:"HiveFestFacts",url:"https://hivefestfacts.sagarkothari88.one/",logo:rt.hive_fest_fact_logo,visibilityKey:"isHiveFestFacts"}];function Cg(){const[t,r]=k.useState("desktop");return k.useEffect(()=>{const s=()=>{const n=window.innerWidth;n<480?r("mobile"):n<768?r("tablet"):r("desktop")};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),t}const Tg={mobile:{icon:28,fontSize:8,padding:"4px 6px",gap:2,barPadding:"4px",minWidth:52,maxWidth:68},tablet:{icon:30,fontSize:8,padding:"4px 5px",gap:3,barPadding:"5px 6px",minWidth:56,maxWidth:72},desktop:{icon:32,fontSize:9,padding:"4px 6px",gap:4,barPadding:"6px 8px",minWidth:60,maxWidth:80}},Dg=({isDistriator:t=!0,isCheckinwithxyz:r=!0,isHreplier:s=!0,isHpolls:n=!0,isHstats:a=!0,isHsnaps:i=!0,isHiveFestFacts:o=!0,backgroundColor:c="#ffffff",textColor:d="#4b5563",borderTopColor:f="#e2e8f0"})=>{const l=Cg(),h=Tg[l],u={isDistriator:t,isCheckinwithxyz:r,isHreplier:s,isHpolls:n,isHstats:a,isHsnaps:i,isHiveFestFacts:o},p=Sg.filter(b=>b.alwaysVisible||u[b.visibilityKey]!==!1);return p.length===0?null:e.jsxs("div",{style:{position:"fixed",bottom:0,left:0,right:0,zIndex:9999,backgroundColor:c,borderTop:`1px solid ${f}`,boxShadow:"0 -2px 10px rgba(0, 0, 0, 0.08)"},children:[e.jsx("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:l==="desktop"?"center":"flex-start",overflowX:"auto",overflowY:"hidden",whiteSpace:"nowrap",padding:h.barPadding,gap:`${h.gap}px`,scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch"},className:"hive-toolbar-scroll",children:p.map(b=>e.jsxs("a",{href:b.url,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textDecoration:"none",color:d,padding:h.padding,borderRadius:"8px",transition:"background-color 0.2s, transform 0.2s",cursor:"pointer",flexShrink:0,minWidth:`${h.minWidth}px`,maxWidth:`${h.maxWidth}px`},onMouseEnter:w=>{w.currentTarget.style.backgroundColor="#f3f4f6",w.currentTarget.style.transform="scale(1.05)"},onMouseLeave:w=>{w.currentTarget.style.backgroundColor="transparent",w.currentTarget.style.transform="scale(1)"},children:[b.isAvatar?e.jsx("img",{src:b.avatarUrl,alt:b.name,style:{width:`${h.icon}px`,height:`${h.icon}px`,borderRadius:"50%",objectFit:"cover"}}):e.jsx("img",{src:b.logo,alt:b.name,style:{width:`${h.icon}px`,height:`${h.icon}px`,borderRadius:"8px",objectFit:"contain"}}),e.jsx("span",{style:{fontSize:`${h.fontSize}px`,fontWeight:500,marginTop:"2px",textAlign:"center",lineHeight:"1.2",whiteSpace:"normal",wordWrap:"break-word",color:d,maxWidth:`${h.maxWidth}px`,display:"block"},children:b.name})]},b.key))}),e.jsx("style",{children:`
1126
1126
  .hive-toolbar-scroll::-webkit-scrollbar {
1127
1127
  display: none;
1128
1128
  }
1129
- `})]})};function jn({author:t,permlink:r,currentUser:s,hiveValue:n,hiveIconUrl:a,payoutTooltip:i,initialVotes:o,initialCommentsCount:c,onUpvote:d,onSubmitComment:f,onComments:l,onReblog:h,onShare:u,onTip:p,onReport:b,onClickCommentUpvote:w,ecencyToken:x,threeSpeakApiKey:g,giphyApiKey:v,templateToken:N,templateApiBaseUrl:j,disableCommentsModal:y}){const m=s==null||s===""?null:s,_=m!=null,[E,A]=k.useState(o??[]),[C,T]=k.useState(c??0),[D,L]=k.useState(!1),[H,V]=k.useState(!1),[z,F]=k.useState(!1),[Y,G]=k.useState({message:"",visible:!1}),[ne,ie]=k.useState(!1),xe=k.useCallback(Re=>{G({message:Re,visible:!0}),setTimeout(()=>G(se=>({...se,visible:!1})),2500)},[]),U=o!==void 0,q=c!==void 0,B=k.useCallback(async()=>{try{const Re=await Nt.getActiveVotes(t,r);A(Re)}catch{}},[t,r]);k.useEffect(()=>{U||B()},[t,r,U]),k.useEffect(()=>{q||Nt.getCommentsList(t,r).then(Re=>{T(Re.length)}).catch(()=>{})},[t,r,q]);const pe=_&&!!m&&E.some(Re=>Re.voter.toLowerCase()===m.toLowerCase()),ee=(Re,se)=>{if(!_&&Re!=="Comment"){xe(`Please Login to ${Re}`);return}se()},te=()=>{ee("Upvote",()=>{if(pe){xe("You have already upvoted this post");return}L(!0)})},_e=async Re=>{if(d){ie(!0);try{await Promise.resolve(d(Re)),L(!1),xe("Vote submitted successfully"),await B(),setTimeout(()=>{B()},4e3)}catch(se){const de=se instanceof Error?se.message:"Failed to upvote";xe(de)}finally{ie(!1)}}},Ie=()=>{V(!0)},K=()=>{V(!1),_&&!pe?L(!0):xe(_?"You have already upvoted this post":"Please Login to Upvote")},le=()=>{if(y){l?.();return}ee("Comment",()=>{l?.(),F(!0)})},oe=()=>{ee("Reblog",()=>h?.())},Ne=()=>{ee("Report",()=>b?.())},Ce=()=>{ee("Tip",()=>p?.())},Me=()=>{if(u){u();return}typeof navigator<"u"&&navigator.share?navigator.share({title:`${t}'s post`,url:`https://peakd.com/@${t}/${r}`,text:`Check out this post by @${t}`}).then(()=>xe("Shared")).catch(()=>{}):(navigator.clipboard?.writeText(`https://peakd.com/@${t}/${r}`),xe("Link copied to clipboard"))},Fe=async(Re,se,de)=>{if(f)try{await Promise.resolve(f(Re,se,de)),xe("Comment posted")}catch(ve){const fe=ve instanceof Error?ve.message:"Failed to post comment";throw xe(fe),ve}},ue="absolute left-1/2 -translate-x-1/2 bottom-full mb-1 px-2 py-1 text-xs font-medium text-white bg-gray-700 rounded shadow-lg whitespace-nowrap opacity-0 pointer-events-none group-hover:opacity-100 transition-opacity duration-150 z-[60]";return e.jsxs("div",{className:"flex items-center justify-between gap-2 sm:gap-4 text-xs sm:text-sm w-full",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-1.5 sm:gap-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsxs("div",{className:"relative group",children:[e.jsx("span",{className:ue,children:"Upvote"}),e.jsx("button",{type:"button",onClick:te,disabled:ne,className:"p-0.5 sm:p-1 rounded hover:bg-gray-700 disabled:opacity-50","aria-label":"Upvote",children:ne?e.jsx(O.Loader2,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin text-blue-600"}):e.jsx(O.ThumbsUp,{className:`w-3.5 h-3.5 sm:w-4 sm:h-4 ${pe?"text-blue-400 fill-current":"text-gray-300"}`})})]}),e.jsxs("div",{className:"relative group",children:[e.jsx("span",{className:ue,children:"View upvotes"}),e.jsx("button",{type:"button",onClick:Ie,className:"flex items-center gap-0.5 text-gray-300 hover:text-blue-400 transition-colors","aria-label":"View upvotes",children:e.jsx("span",{children:E.length})})]})]}),e.jsxs("div",{className:"relative group",children:[e.jsx("span",{className:ue,children:"Comments"}),e.jsxs("button",{type:"button",onClick:le,className:"flex items-center gap-0.5 text-gray-300 hover:text-blue-400 transition-colors","aria-label":"Comments",children:[e.jsx(O.MessageCircle,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),e.jsx("span",{children:C})]})]}),h&&e.jsxs("div",{className:"relative group",children:[e.jsx("span",{className:ue,children:"Reblog"}),e.jsx("button",{type:"button",onClick:oe,className:"flex items-center gap-0.5 text-gray-300 hover:text-blue-400 transition-colors p-0.5 sm:p-1 rounded","aria-label":"Reblog",children:e.jsx(O.Repeat2,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]}),e.jsxs("div",{className:"relative group",children:[e.jsx("span",{className:ue,children:"Share"}),e.jsx("button",{type:"button",onClick:Me,className:"flex items-center gap-0.5 text-gray-300 hover:text-blue-400 transition-colors p-0.5 sm:p-1 rounded","aria-label":"Share",children:e.jsx(O.Share2,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]}),b&&e.jsxs("div",{className:"relative group",children:[e.jsx("span",{className:ue,children:"Report"}),e.jsx("button",{type:"button",onClick:Ne,className:"flex items-center gap-0.5 text-gray-300 hover:text-red-400 transition-colors p-0.5 sm:p-1 rounded","aria-label":"Report",children:e.jsx(O.Flag,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]}),p&&e.jsxs("div",{className:"relative group",children:[e.jsx("span",{className:ue,children:"Tip"}),e.jsx("button",{type:"button",onClick:Ce,className:"flex items-center gap-0.5 text-gray-300 hover:text-green-400 transition-colors p-0.5 sm:p-1 rounded","aria-label":"Tip",children:e.jsx(O.Gift,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]}),e.jsx("div",{className:"flex-1 flex justify-end min-w-0 shrink-0",children:n!=null&&n!==""&&e.jsxs("div",{className:"relative group",children:[e.jsxs("div",{className:"flex items-center gap-1 cursor-default",children:[e.jsx("span",{className:"font-semibold text-green-400 text-xs sm:text-sm",children:n}),a&&e.jsx("img",{src:a,alt:"Hive",className:"w-4 h-4 rounded-full"})]}),i&&e.jsx("div",{className:"absolute right-0 bottom-full mb-2 w-64 px-3 py-2 text-xs text-gray-200 bg-gray-900 border border-gray-700 rounded-lg shadow-xl whitespace-pre-line opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity duration-200 z-[60]",children:i})]})}),D&&e.jsx(Vn,{author:t,permlink:r,onUpvote:_e,onCancel:()=>L(!1)}),H&&e.jsx(Po,{author:t,permlink:r,onClose:()=>V(!1),currentUser:m??void 0,token:void 0,onClickUpvoteButton:K}),z&&e.jsx(Do,{author:t,permlink:r,onClose:()=>{F(!1),Nt.getCommentsList(t,r).then(Re=>T(Re.length))},currentUser:m??void 0,token:void 0,onSubmitComment:f?Fe:void 0,onClickCommentUpvote:w,ecencyToken:x,threeSpeakApiKey:g,giphyApiKey:v,templateToken:N,templateApiBaseUrl:j}),Y.visible&&e.jsx("div",{className:"fixed bottom-4 right-4 z-[100] max-w-[280px] rounded-lg bg-gray-900 text-white px-3 py-2 shadow-lg text-sm",children:Y.message})]})}const Pg=4;function h0({comment:t,allComments:r,onReply:s,onCancelReply:n,onCommentSubmit:a,activeReplyKey:i,currentUser:o,token:c,depth:d=0,onVotedRefresh:f,onClickCommentUpvote:l,ecencyToken:h,threeSpeakApiKey:u,giphyApiKey:p,templateToken:b,templateApiBaseUrl:w,hiveIconUrl:x,onShareComment:g,onTipComment:v,onReportComment:N}){const[j,y]=k.useState(!1),[m,_]=k.useState(!0),[E,A]=k.useState(!1),[C,T]=k.useState(!1),[D,L]=k.useState(!1),[H,V]=k.useState(""),[z,F]=k.useState(!1),[Y,G]=k.useState(""),ne=se=>{V(se),L(!0),setTimeout(()=>L(!1),2500)},ie=k.useMemo(()=>{if(!o)return!1;const se=o.toLowerCase();return(t.active_votes||[]).some(de=>(de.voter||"").toLowerCase()===se)},[t.active_votes,o]),xe=t.depth||0;let U=r.filter(se=>se.parent_author===t.author&&se.parent_permlink===t.permlink&&(typeof se.depth!="number"||se.depth===xe+1));if(U.length===0&&Array.isArray(t.replies)&&t.replies.length>0){const se=new Set(t.replies);U=r.filter(de=>se.has(`${de.author}/${de.permlink}`))}const q=U.length>0,B=d>=Pg,pe=i===`${t.author}/${t.permlink}`;k.useEffect(()=>{pe&&G("")},[pe]);const ee=t.json_metadata_parsed||(()=>{try{return t.json_metadata?JSON.parse(t.json_metadata):void 0}catch{return}})(),_e=(t.body||"").replace(/^(\s*(?:#[\p{L}\p{N}_-]+\s*(?:,\s*)?)+\s*)$/gimu,"").trim(),Ie=/!\[[^\]]*\]\([^)]+\)/.test(_e)||/<img\s/i.test(_e),K=Array.isArray(ee?.image)?ee.image:[],le=k.useMemo(()=>{try{return Un({baseUrl:"https://hreplier.sagarkothari88.one/",ipfsGateway:"https://ipfs.3speak.tv",assetsWidth:640,assetsHeight:480,usertagUrlFn:se=>`https://hreplier.sagarkothari88.one/#/@${se}`,hashtagUrlFn:se=>`https://peakd.com/created/${se}`,convertHiveUrls:!0})}catch{return null}},[]),oe=k.useMemo(()=>{if(!_e||!le)return"";try{let se=le(_e);return se=se.replace(/https:\/\/3speak\.tv\/embed\?v=([^"&\s]+)/gi,(de,ve)=>`https://play.3speak.tv/embed?v=${ve}&mode=iframe&noscroll=1`),se}catch{return""}},[_e,le]),Ne=t.stats?.total_votes||t.net_votes||0,Ce=k.useMemo(()=>{if(t.payout&&t.payout>0)return t.payout.toFixed(3);const se=parseFloat(String(t.pending_payout_value??"0").replace(/[^\d.]/g,""))||0;if(se>0)return se.toFixed(3);const de=parseFloat(String(t.author_payout_value??"0").replace(/[^\d.]/g,""))||0,ve=parseFloat(String(t.curator_payout_value??"0").replace(/[^\d.]/g,""))||0,fe=de+ve;return fe>0?fe.toFixed(3):""},[t.payout,t.pending_payout_value,t.author_payout_value,t.curator_payout_value]),Me=async se=>{if(l){try{await Promise.resolve(l(t.author,t.permlink,se)),T(!0),A(!1),setTimeout(()=>{f?.(),ne("Vote submitted successfully!")},3e3)}catch(de){alert(de instanceof Error?de.message:"Failed to upvote")}return}if(!c){ne("Please login or provide an upvote handler to vote");return}try{await Nt.handleUpvote({author:t.author,permlink:t.permlink,weight:Math.round(se*100),authToken:c}),T(!0),A(!1),setTimeout(()=>{f?.(),ne("Vote submitted successfully!")},3e3)}catch(de){alert(de instanceof Error?de.message:"Failed to upvote")}},Fe=()=>{if(!o){ne("Please login to upvote");return}if(ie||C){ne("You have already upvoted this comment");return}A(!0)},ue=()=>{if(!o){ne("Please login to reply");return}s(t.author,t.permlink)},Re=!B||z;return e.jsxs("div",{className:`${d>0?"ml-2 md:ml-6 border-l-2 border-gray-700/50 pl-2 md:pl-4":""}`,children:[e.jsxs("div",{className:"py-2 px-1.5 md:py-3 md:px-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 md:gap-2 mb-1 min-w-0",children:[e.jsx("img",{src:`https://images.hive.blog/u/${t.author}/avatar`,alt:t.author,className:"w-6 h-6 md:w-7 md:h-7 rounded-full flex-shrink-0 bg-gray-700",onError:se=>{se.target.src=`https://ui-avatars.com/api/?name=${t.author}&background=random`}}),e.jsxs("span",{className:"text-xs md:text-sm font-semibold text-white truncate",children:["@",t.author]}),t.author===o&&e.jsx("span",{className:"px-1 py-0.5 text-[9px] md:text-[10px] bg-blue-900 text-blue-200 rounded-full flex-shrink-0",children:"You"}),e.jsxs("span",{className:"hidden sm:flex items-center gap-1 text-xs text-gray-500 flex-shrink-0",children:[e.jsx(O.Clock,{className:"w-3 h-3"}),t.created?bs.formatDistanceToNow(new Date(t.created+"Z"),{addSuffix:!0}):""]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>y(!j),className:"p-1 rounded hover:bg-gray-700/60 transition-colors text-gray-400 hover:text-white flex-shrink-0",title:j?"Expand comment":"Minimize comment",children:j?e.jsx(O.ChevronDown,{className:"w-4 h-4"}):e.jsx(O.ChevronUp,{className:"w-4 h-4"})})]}),!j&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"prose prose-sm prose-invert max-w-none mb-2 text-gray-200 text-left prose-a:text-blue-400 [&>*]:text-left ml-7 md:ml-9",children:oe?e.jsx("div",{className:"hive-post-body",dangerouslySetInnerHTML:{__html:oe}}):e.jsx("p",{className:"text-gray-400 text-sm italic",children:"No content available."})}),!Ie&&K.length>0&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 mb-2 ml-7 md:ml-9",children:K.map((se,de)=>e.jsx("img",{src:se,alt:`image-${de}`,className:"max-w-full h-auto rounded-lg cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>window.open(se,"_blank")},se+de))}),e.jsx("div",{className:"ml-7 md:ml-9 text-xs",children:e.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1.5",children:[e.jsxs("button",{onClick:Fe,className:`flex items-center gap-1 font-medium transition-colors ${ie||C?"text-blue-400":"text-gray-400 hover:text-blue-400"}`,children:[e.jsx(O.ThumbsUp,{className:`w-3.5 h-3.5 ${ie||C?"fill-current":""}`}),e.jsx("span",{children:Ne})]}),e.jsxs("button",{onClick:ue,className:"flex items-center gap-1 font-medium text-gray-400 hover:text-blue-400 transition-colors",children:[e.jsx(O.MessageSquare,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Reply"})]}),g&&e.jsx("button",{onClick:()=>g(t.author,t.permlink),className:"text-gray-400 hover:text-blue-400 transition-colors p-0.5",title:"Share",children:e.jsx(O.Share2,{className:"w-3.5 h-3.5"})}),N&&o&&t.author!==o&&e.jsx("button",{onClick:()=>N(t.author,t.permlink),className:"text-gray-400 hover:text-red-400 transition-colors p-0.5",title:"Report",children:e.jsx(O.Flag,{className:"w-3.5 h-3.5"})}),v&&o&&t.author!==o&&e.jsx("button",{onClick:()=>v(t.author,t.permlink),className:"text-gray-400 hover:text-green-400 transition-colors p-0.5",title:"Tip",children:e.jsx(O.Gift,{className:"w-3.5 h-3.5"})}),q&&e.jsxs("button",{onClick:()=>_(!m),className:"flex items-center gap-1 font-medium text-gray-400 hover:text-blue-400 transition-colors",children:[m?e.jsx(O.ChevronUp,{className:"w-3.5 h-3.5"}):e.jsx(O.ChevronDown,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"hidden sm:inline",children:[m?"Hide":"Show"," "]}),e.jsxs("span",{children:[U.length," ",U.length===1?"reply":"replies"]})]}),Ce&&e.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[e.jsx("span",{className:"font-semibold text-green-400 text-[11px]",children:Ce}),x&&e.jsx("img",{src:x,alt:"Hive",className:"w-3 h-3 rounded-full"})]})]})}),E&&!ie&&e.jsx("div",{className:"mt-2 ml-7 md:ml-9",children:e.jsx(Vn,{author:t.author,permlink:t.permlink,onUpvote:Me,onCancel:()=>A(!1)})}),pe&&o&&e.jsxs(e.Fragment,{children:[T0.createPortal(e.jsxs("div",{className:"md:hidden",children:[e.jsx("div",{className:"fixed inset-0 bg-black/40 z-[9998]",onClick:n}),e.jsxs("div",{className:"fixed inset-x-0 bottom-0 z-[9999] border-t border-gray-700 bg-gray-900 shadow-[0_-4px_20px_rgba(0,0,0,0.5)] max-h-[70vh] overflow-y-auto",children:[e.jsx("div",{className:"px-3 py-2 border-b border-gray-700 bg-gray-900/95 sticky top-0 z-10",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:`https://images.hive.blog/u/${o}/avatar`,alt:o,className:"w-6 h-6 rounded-full flex-shrink-0 bg-gray-700 border border-gray-600",onError:se=>{se.target.src=`https://ui-avatars.com/api/?name=${o}&background=random`}}),e.jsxs("span",{className:"text-xs font-medium text-white truncate",children:["@",o]}),o===t.author?e.jsx("span",{className:"text-gray-500 text-[11px]",children:"replying to your comment"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-500 text-[11px]",children:"to"}),e.jsx("img",{src:`https://images.hive.blog/u/${t.author}/avatar`,alt:t.author,className:"w-6 h-6 rounded-full flex-shrink-0 bg-gray-700 border border-gray-600",onError:se=>{se.target.src=`https://ui-avatars.com/api/?name=${t.author}&background=random`}}),e.jsxs("span",{className:"text-xs font-medium text-blue-400 truncate",children:["@",t.author]})]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:n,className:"p-1.5 rounded hover:bg-gray-700/60 transition-colors flex-shrink-0",title:"Cancel reply",children:e.jsx(O.X,{className:"w-4 h-4 text-gray-400 hover:text-white"})})]})}),e.jsx(gs,{onSubmit:se=>a(t.author,t.permlink,se),onCancel:n,currentUser:o,parentAuthor:t.author,parentPermlink:t.permlink,placeholder:`Reply to @${t.author}...`,value:Y,onChange:G,ecencyToken:h,threeSpeakApiKey:u,giphyApiKey:p,templateToken:b,templateApiBaseUrl:w,hideUserHeader:!0,showCancel:!0})]})]}),document.body),e.jsxs("div",{className:"hidden md:block mt-3 ml-9 border border-gray-700 rounded-xl overflow-hidden bg-gray-800/50",children:[e.jsx("div",{className:"px-3 py-2 border-b border-gray-700 bg-gray-900/50",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("img",{src:`https://images.hive.blog/u/${o}/avatar`,alt:o,className:"w-6 h-6 rounded-full flex-shrink-0 bg-gray-700 border border-gray-600",onError:se=>{se.target.src=`https://ui-avatars.com/api/?name=${o}&background=random`}}),e.jsx("div",{className:"flex flex-col min-w-0",children:e.jsxs("span",{className:"text-xs font-medium text-white truncate",children:["@",o]})}),o===t.author?e.jsx("span",{className:"text-gray-500 text-[11px]",children:"replying to your comment"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-500 text-[11px]",children:"replying to"}),e.jsx("img",{src:`https://images.hive.blog/u/${t.author}/avatar`,alt:t.author,className:"w-6 h-6 rounded-full flex-shrink-0 bg-gray-700 border border-gray-600",onError:se=>{se.target.src=`https://ui-avatars.com/api/?name=${t.author}&background=random`}}),e.jsx("div",{className:"flex flex-col min-w-0",children:e.jsxs("span",{className:"text-xs font-medium text-blue-400 truncate",children:["@",t.author,"/",t.permlink]})})]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:n,className:"p-1 rounded hover:bg-gray-700/60 transition-colors flex-shrink-0",title:"Cancel reply",children:e.jsx(O.X,{className:"w-3.5 h-3.5 text-gray-400 hover:text-white"})})]})}),e.jsx(gs,{onSubmit:se=>a(t.author,t.permlink,se),onCancel:n,currentUser:o,parentAuthor:t.author,parentPermlink:t.permlink,placeholder:`Reply to @${t.author}...`,value:Y,onChange:G,ecencyToken:h,threeSpeakApiKey:u,giphyApiKey:p,templateToken:b,templateApiBaseUrl:w,hideUserHeader:!0,showCancel:!0})]})]})]}),j&&(()=>{const se=_e.replace(/<[^>]*>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[#*_~`>]/g,"").replace(/\s+/g," ").trim();return e.jsxs("p",{className:"text-xs text-gray-500 ml-7 md:ml-9 truncate",children:[se.slice(0,120),se.length>120?"…":""]})})()]}),!j&&q&&m&&Re&&e.jsx("div",{children:U.map(se=>e.jsx(h0,{comment:se,allComments:r,onReply:s,onCancelReply:n,onCommentSubmit:a,activeReplyKey:i,currentUser:o,token:c,depth:d+1,onVotedRefresh:f,onClickCommentUpvote:l,ecencyToken:h,threeSpeakApiKey:u,giphyApiKey:p,templateToken:b,templateApiBaseUrl:w,hiveIconUrl:x,onShareComment:g,onTipComment:v,onReportComment:N},se.permlink))}),!j&&q&&m&&B&&!z&&e.jsx("div",{className:"ml-3 md:ml-6 py-2 pl-3 md:pl-4 border-l-2 border-gray-700/50",children:e.jsxs("button",{onClick:()=>F(!0),className:"text-xs text-blue-400 hover:text-blue-300 hover:underline transition-colors",children:["View ",U.length," more ",U.length===1?"reply":"replies"]})}),D&&e.jsx("div",{className:"fixed bottom-4 right-4 w-[280px] z-50",children:e.jsx("div",{className:"bg-gray-800 text-white rounded px-3 py-2 shadow-lg text-sm",children:H})})]})}function Og({author:t,permlink:r,currentUser:s,token:n,onSubmitComment:a,onClickCommentUpvote:i,ecencyToken:o,threeSpeakApiKey:c,giphyApiKey:d,templateToken:f,templateApiBaseUrl:l,reportedAuthors:h,reportedPosts:u,hiveIconUrl:p,onShareComment:b,onTipComment:w,onReportComment:x}){const[g,v]=k.useState([]),[N,j]=k.useState(!0),[y,m]=k.useState(null),[_,E]=k.useState(!1),[A,C]=k.useState(null),[T,D]=k.useState(""),[L,H]=k.useState(!1),V=k.useCallback(async(B=!1)=>{B?E(!0):j(!0),m(null);try{const pe=await Nt.getCommentsList(t,r,s??"");v(pe)}catch(pe){m(pe instanceof Error?pe.message:"Failed to load comments")}finally{j(!1),E(!1)}},[t,r]);k.useEffect(()=>{V()},[V]);const z=k.useMemo(()=>{if(!T.trim())return g;const B=T.toLowerCase();return g.filter(pe=>pe.body?.toLowerCase().includes(B)||pe.author.toLowerCase().includes(B))},[T,g]),F=k.useMemo(()=>{if(!s)return z;const B=new Set((h??[]).map(ee=>ee.toLowerCase())),pe=new Set((u??[]).map(ee=>`${ee.author.toLowerCase()}/${ee.permlink.toLowerCase()}`));return B.size===0&&pe.size===0?z:z.filter(ee=>!(B.has(ee.author.toLowerCase())||pe.has(`${ee.author.toLowerCase()}/${ee.permlink.toLowerCase()}`)))},[z,s,h,u]),Y=k.useMemo(()=>{if(!s?.trim())return F;const B=s.toLowerCase();return[...F].sort((pe,ee)=>{const te=pe.author?.toLowerCase()===B,_e=ee.author?.toLowerCase()===B;return te&&!_e?-1:!te&&_e?1:0})},[F,s]),G=Y.filter(B=>B.parent_author===t&&B.parent_permlink===r),ne=(B,pe)=>{C(`${B}/${pe}`)},ie=()=>{C(null)},xe=async(B,pe,ee)=>{if(a){try{await Promise.resolve(a(B,pe,ee)),C(null),E(!0),setTimeout(async()=>{await V(!0)},3e3)}catch(te){alert(te instanceof Error?te.message:"Failed to post comment")}return}if(!n){alert("Please login to comment");return}try{await Nt.handleComment({author:B,permlink:pe,body:ee,authToken:n}),C(null),E(!0),setTimeout(async()=>{await V(!0)},3e3)}catch(te){alert(te instanceof Error?te.message:"Failed to post comment")}},U=!!s,q=s===t;return e.jsxs("div",{className:"border-t border-gray-700/50 mt-2",children:[e.jsxs("div",{className:"flex items-center justify-between px-1 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("h3",{className:"text-sm font-semibold text-white",children:["Comments ",g.length>0&&`(${g.length})`]}),_&&e.jsx(O.Loader2,{className:"w-4 h-4 animate-spin text-blue-500"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>H(!L),className:"p-1.5 rounded-lg hover:bg-gray-700/60 transition-colors",title:"Search comments",children:e.jsx(O.Search,{className:"w-4 h-4 text-gray-400"})}),e.jsx("button",{onClick:()=>V(!0),disabled:_,className:"p-1.5 rounded-lg hover:bg-gray-700/60 transition-colors disabled:opacity-50",title:"Refresh comments",children:e.jsx(O.RefreshCw,{className:`w-4 h-4 text-gray-400 ${_?"animate-spin":""}`})})]})]}),L&&e.jsx("div",{className:"px-1 pb-3",children:e.jsx("input",{type:"text",placeholder:"Search comments...",value:T,onChange:B=>D(B.target.value),className:"w-full bg-gray-800 border border-gray-700 rounded-lg px-3 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-blue-500",autoFocus:!0})}),U&&e.jsxs("div",{className:"border border-gray-700 rounded-xl mb-3 overflow-hidden bg-gray-800/50",children:[e.jsx("div",{className:"px-3 py-2.5 border-b border-gray-700 bg-gray-900/50",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("img",{src:`https://images.hive.blog/u/${s}/avatar`,alt:s,className:"w-6 h-6 rounded-full flex-shrink-0 bg-gray-700 border border-gray-600",onError:B=>{B.target.src=`https://ui-avatars.com/api/?name=${s}&background=random`}}),e.jsxs("span",{className:"text-xs font-medium text-white",children:["@",s]}),q?e.jsx("span",{className:"text-gray-500 text-[11px]",children:"commenting on your post"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-500 text-[11px]",children:"replying to"}),e.jsx("img",{src:`https://images.hive.blog/u/${t}/avatar`,alt:t,className:"w-6 h-6 rounded-full flex-shrink-0 bg-gray-700 border border-gray-600",onError:B=>{B.target.src=`https://ui-avatars.com/api/?name=${t}&background=random`}}),e.jsx("div",{className:"flex flex-col min-w-0",children:e.jsxs("span",{className:"text-xs font-medium text-blue-400 truncate",children:["@",t,"/",r]})})]})]})}),e.jsx(gs,{onSubmit:B=>xe(t,r,B),currentUser:s,parentAuthor:t,parentPermlink:r,placeholder:`Write a comment to @${t}...`,ecencyToken:o,threeSpeakApiKey:c,giphyApiKey:d,templateToken:f,templateApiBaseUrl:l,hideUserHeader:!0,disableAutoFocus:!0})]}),N&&e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(O.Loader2,{className:"w-6 h-6 animate-spin text-blue-500 mr-2"}),e.jsx("span",{className:"text-sm text-gray-400",children:"Loading comments..."})]}),!N&&y&&e.jsxs("div",{className:"flex flex-col items-center py-6 text-center",children:[e.jsx(O.AlertCircle,{className:"w-8 h-8 text-red-500 mb-2"}),e.jsx("p",{className:"text-sm text-gray-400 mb-3",children:y}),e.jsx("button",{onClick:()=>V(),className:"px-4 py-1.5 bg-blue-600 hover:bg-blue-700 text-white text-sm rounded-lg transition-colors",children:"Retry"})]}),!N&&!y&&G.length===0&&e.jsxs("div",{className:"flex flex-col items-center py-8 text-center",children:[e.jsx(O.MessageCirclePlus,{className:"w-10 h-10 text-gray-600 mb-3"}),e.jsx("p",{className:"text-sm text-gray-400",children:T?"No comments match your search":"No comments yet. Be the first!"})]}),!N&&!y&&G.length>0&&e.jsx("div",{className:"divide-y divide-gray-800/50",children:G.map(B=>e.jsx(h0,{comment:B,allComments:Y,onReply:ne,onCancelReply:ie,onCommentSubmit:xe,activeReplyKey:A,currentUser:s,token:n,depth:0,onVotedRefresh:()=>V(!0),onClickCommentUpvote:i,ecencyToken:o,threeSpeakApiKey:c,giphyApiKey:d,templateToken:f,templateApiBaseUrl:l,hiveIconUrl:p,onShareComment:b,onTipComment:w,onReportComment:x},B.permlink))})]})}const Lg=t=>{if(t===0)return"25";const r=t<0;let s=r?-t:t,n=Math.log10(s);return n=Math.max(n-9,0),n=(r?-1:1)*n,n=n*9+25,Math.round(n).toString()},Mg=t=>{try{return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return t}};function Rg({author:t,permlink:r,currentUser:s,onUpvote:n,onSubmitComment:a,onClickCommentUpvote:i,onReblog:o,onShare:c,onTip:d,onReport:f,onShareComment:l,onTipComment:h,onReportComment:u,ecencyToken:p,threeSpeakApiKey:b,giphyApiKey:w,templateToken:x,templateApiBaseUrl:g,reportedAuthors:v,reportedPosts:N,hiveIconUrl:j="/images/hive_logo.png",backgroundColor:y,onBack:m,onUserClick:_,onNavigateToPost:E,onVotePoll:A}){const C=k.useMemo(()=>y?Array.isArray(y)?y.length===0?{}:y.length===1?{background:y[0]}:{background:`linear-gradient(to bottom, ${y.join(", ")})`}:{background:y}:{},[y]),T=k.useMemo(()=>y?Array.isArray(y)?{backgroundColor:y[0],opacity:.97}:{backgroundColor:y}:{},[y]),[D,L]=k.useState(null),[H,V]=k.useState(null),[z,F]=k.useState(!0),[Y,G]=k.useState(null),[ne,ie]=k.useState(null),[xe,U]=k.useState(!1),q=k.useRef(null),[B,pe]=k.useState([]),[ee,te]=k.useState(!1),[_e,Ie]=k.useState([]),K=k.useMemo(()=>{try{return Un({baseUrl:"https://hreplier.sagarkothari88.one/",ipfsGateway:"https://ipfs.3speak.tv",assetsWidth:640,assetsHeight:480,usertagUrlFn:ue=>`https://hreplier.sagarkothari88.one/#/@${ue}`,hashtagUrlFn:ue=>`https://peakd.com/created/${ue}`,convertHiveUrls:!0})}catch{return null}},[]),le=k.useMemo(()=>{if(!D?.body||!K)return"";try{let ue=K(D.body);return ue=ue.replace(/https:\/\/3speak\.tv\/embed\?v=([^"&\s]+)/gi,(Re,se)=>`https://play.3speak.tv/embed?v=${se}&mode=iframe&noscroll=1`),ue=ue.replace(/<img\s([^>]*?)alt="([^"]+)"([^>]*?)\/?\s*>/gi,(Re,se,de,ve)=>`<figure class="hive-img-figure">${`<img ${se}alt="${de}"${ve}>`}<figcaption>${de}</figcaption></figure>`),ue}catch{return""}},[D?.body,K]),oe=k.useMemo(()=>{const ue=D?.json_metadata;if(!ue)return{};if(typeof ue=="string")try{return JSON.parse(ue)}catch{return{}}return ue},[D?.json_metadata]),Ne=k.useCallback(async()=>{F(!0),G(null);try{const ue=await Nt.getPostContent(t,r);ue?L(ue):G("Post not found")}catch(ue){G(ue instanceof Error?ue.message:"Failed to load post")}finally{F(!1)}},[t,r]);k.useEffect(()=>{Ne()},[Ne]),k.useEffect(()=>{!D||oe?.content_type!=="poll"||(U(!0),Ee.getPollDetail(D.author,D.permlink).then(ue=>ie(ue)).catch(()=>ie(null)).finally(()=>U(!1)))},[D?.author,D?.permlink,oe?.content_type]),k.useEffect(()=>{(async()=>{if(t)try{const se=(await Ee.getProfile(t))?.result;if(!se)return;V({username:se.name,name:se.metadata?.profile?.name,profileImage:se.metadata?.profile?.profile_image,followersCount:se.stats?.followers||0,followingCount:se.stats?.following||0,postsCount:se.post_count||0,reputation:se.reputation||0})}catch{}})()},[t]);const Ce=ue=>{if(!ue)return 0;const Re=typeof ue=="string"?ue:String(ue),se=parseFloat(Re.replace(/[^\d.]/g,""));return isNaN(se)?0:se},Me=k.useMemo(()=>{if(!D)return"";if(D.payout&&D.payout>0)return`${D.payout.toFixed(3)}`;const ue=Ce(D.pending_payout_value);if(ue>0)return`${ue.toFixed(3)}`;const Re=Ce(D.total_payout_value);if(Re>0)return`${Re.toFixed(3)}`;const se=Ce(D.author_payout_value),de=Ce(D.curator_payout_value),ve=se+de;return ve>0?`${ve.toFixed(3)}`:"0.000"},[D]),Fe=k.useMemo(()=>{if(!D)return"";const ue=[],Re=Ce(D.pending_payout_value),se=Ce(D.author_payout_value),de=Ce(D.curator_payout_value),ve=D.payout&&D.payout>0?D.payout:Re>0?Re:se+de,fe=D.percent_hbd??1e4;if(fe===0?ue.push("Hive Rewards Payout 100% Powered Up"):ue.push(`Hive Rewards Payout (${(fe/200).toFixed(0)}%/${100-fe/200}%)`),D.is_paidout)ue.push("Past payouts:"),se>0&&ue.push(`Author: $${se.toFixed(3)}`),de>0&&ue.push(`Curator: $${de.toFixed(3)}`),ue.push(`Total: $${ve.toFixed(3)}`);else{if(D.payout_at){const ke=new Date(D.payout_at).getTime()-Date.now();if(ke>0){const Se=Math.floor(ke/36e5),Be=Math.floor(Se/24),Ge=Se%24,pt=Be>0?`in ${Be} day${Be>1?"s":""}${Ge>0?` ${Ge} hour${Ge>1?"s":""}`:""}`:`in ${Se} hour${Se>1?"s":""}`;ue.push(`Payout will occur: ${pt}`)}}ue.push(`Pending: $${Re.toFixed(3)}`)}return D.beneficiaries?.length>0&&(ue.push("Beneficiaries:"),D.beneficiaries.forEach(ke=>{ue.push(`${ke.account}: ${(ke.weight/100).toFixed(0)}%`)})),ue.join(`
1130
- `)},[D]);return z?e.jsxs("div",{className:"dark flex flex-col h-full bg-gray-900 animate-pulse",style:C,children:[e.jsx("div",{className:"sticky top-0 z-30 h-[56px] bg-gray-800 border-b border-gray-700 flex items-center",style:T,children:e.jsxs("div",{className:"px-4 py-2 flex items-center gap-2 w-full",children:[m&&e.jsx("div",{className:"w-8 h-8 bg-gray-700 rounded-lg flex-shrink-0"}),e.jsx("div",{className:"w-8 h-8 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-28 mb-1.5"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-44"})]})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-4 sm:py-6",children:[e.jsx("div",{className:"h-7 bg-gray-700 rounded w-4/5 mb-2"}),e.jsx("div",{className:"h-7 bg-gray-700 rounded w-3/5 mb-3"}),e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-32"}),e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24"})]}),e.jsxs("div",{className:"py-2.5 border-y border-gray-700/50 mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"h-4 w-4 bg-gray-700 rounded"}),e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-8"}),e.jsx("div",{className:"h-4 w-4 bg-gray-700 rounded"}),e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-8"}),e.jsx("div",{className:"h-4 w-4 bg-gray-700 rounded"}),e.jsx("div",{className:"h-4 w-4 bg-gray-700 rounded"}),e.jsx("div",{className:"h-4 w-4 bg-gray-700 rounded"}),e.jsx("div",{className:"h-4 w-4 bg-gray-700 rounded"}),e.jsx("div",{className:"flex-1"}),e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-16"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-4/5"})]}),e.jsx("div",{className:"h-48 sm:h-64 bg-gray-800 rounded-xl border border-gray-700"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-3/5"})]}),e.jsx("div",{className:"h-6 bg-gray-700 rounded w-2/5 mt-2"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-2/3"})]}),e.jsx("div",{className:"h-48 sm:h-64 bg-gray-800 rounded-xl border border-gray-700"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-3/4"})]})]}),e.jsx("div",{className:"border-t border-gray-700/50 pt-4 mt-6",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-5 bg-gray-700 rounded-full w-14"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded-full w-16"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded-full w-12"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded-full w-18"})]})})]})})]}):Y||!D?e.jsx("div",{className:"dark flex justify-center items-center min-h-screen bg-gray-900 p-8",style:C,children:e.jsxs("div",{className:"text-center",children:[e.jsx(O.AlertCircle,{className:"w-12 h-12 text-red-500 mx-auto mb-3"}),e.jsx("h3",{className:"text-base font-semibold text-white mb-1",children:"Failed to load post"}),e.jsx("p",{className:"text-gray-400 text-sm mb-4",children:Y}),e.jsx("button",{onClick:Ne,className:"px-5 py-2 bg-blue-600 hover:bg-blue-700 text-white text-sm rounded-lg transition-colors",children:"Try Again"})]})}):e.jsx("div",{className:"dark flex flex-col h-full bg-gray-900",style:C,children:e.jsxs("div",{className:"flex flex-col overflow-y-auto h-full",children:[e.jsx("div",{className:"sticky top-0 z-30 h-[56px] bg-gray-800/95 backdrop-blur-sm border-b border-gray-700 flex items-center",style:T,children:e.jsxs("div",{className:"px-4 py-2 flex items-center gap-2 w-full",children:[m&&e.jsx("button",{onClick:m,className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors flex-shrink-0",children:e.jsx(O.ArrowLeft,{className:"h-5 w-5 text-gray-300"})}),e.jsx("img",{src:H?.profileImage||`https://images.hive.blog/u/${D.author}/avatar`,alt:D.author,className:"w-8 h-8 rounded-full flex-shrink-0 bg-gray-700 cursor-pointer",onError:ue=>{ue.target.src=`https://images.hive.blog/u/${D.author}/avatar`},onClick:()=>_?.(D.author)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>_?.(D.author),className:"text-sm font-semibold text-white truncate hover:text-blue-400 transition-colors",children:["@",D.author]}),H&&H.reputation>0&&e.jsx("span",{className:"text-[10px] bg-gray-700 text-gray-300 px-1.5 py-0.5 rounded-full flex-shrink-0",children:Lg(H.reputation)})]}),H&&e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-400",children:[e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-gray-200",children:H.followersCount.toLocaleString()})," Followers"]}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-gray-200",children:H.followingCount.toLocaleString()})," Following"]}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-gray-200",children:H.postsCount.toLocaleString()})," Posts"]})]})]})]})}),e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-4 sm:py-6",children:[D.depth>0&&D.parent_author&&D.parent_permlink&&e.jsxs("button",{onClick:()=>E?.(D.parent_author,D.parent_permlink),className:"mb-4 flex items-center gap-2 px-3 py-2 rounded-lg border border-gray-700 bg-gray-800/60 hover:bg-gray-700/60 transition-colors text-sm text-blue-400 hover:text-blue-300",children:[e.jsx(O.ArrowUpRight,{className:"w-4 h-4"}),e.jsx("span",{children:"View parent post"}),e.jsxs("span",{className:"text-gray-500 text-xs truncate max-w-[250px]",children:["@",D.parent_author,"/",D.parent_permlink]})]}),e.jsx("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold text-white leading-tight mb-2",children:D.title}),e.jsxs("div",{className:"text-xs text-gray-400 mb-4 flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"w-3.5 h-3.5"}),Mg(D.created)]}),D.community_title&&e.jsxs("span",{children:["in ",e.jsx("span",{className:"text-blue-400",children:D.community_title})]})]}),e.jsx("div",{className:"pb-6",children:le?e.jsx("div",{className:"hive-post-body",dangerouslySetInnerHTML:{__html:le}}):e.jsx("p",{className:"text-gray-400 text-sm italic",children:"No content available."})}),oe?.content_type==="poll"&&(()=>{const ue=ne?.max_choices_voted??oe?.max_choices_voted??1,Re=ue>1,se=ne?.end_time?new Date(ne.end_time).getTime():(oe?.end_time??0)*1e3,de=se>0&&Date.now()>se,ve=_e.length>0,fe=s?ne?.poll_voters?.find(Ke=>Ke.name===s):void 0,ke=fe?.choices?.length?fe.choices:fe?.choice_num!=null?[fe.choice_num]:[],Se=ve||ke.length>0,Be=ne?.allow_vote_changes??oe?.allow_vote_changes??!1,Ge=ve?_e:ke,pt=!!s&&!de&&!!A&&(!Se||Be),jt=Se&&Be&&!ve,gt=ne?.poll_choices??(oe?.choices??[]).map((Ke,at)=>({choice_num:at+1,choice_text:Ke,votes:null})),St=gt.reduce((Ke,at)=>Ke+(at.votes?.total_votes??0),0),Ct=Re||jt,Tt=async Ke=>{if(!(!pt||ee))if(Ct)pe(at=>at.includes(Ke)?at.filter(_t=>_t!==Ke):at.length>=ue?at:[...at,Ke]);else{te(!0);try{await A?.(D.author,D.permlink,[Ke]),Ie([Ke])}finally{te(!1)}}},Bt=async()=>{if(!(!pt||ee||B.length===0)){te(!0);try{await A?.(D.author,D.permlink,B),Ie(B),pe([])}finally{te(!1)}}};return e.jsxs("div",{className:"mb-6 rounded-xl border border-gray-700 bg-gray-800/60 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 pt-4 pb-2",children:[e.jsx(O.BarChart2,{className:"w-4 h-4 text-blue-400 flex-shrink-0"}),e.jsx("span",{className:"text-xs font-semibold text-blue-400 uppercase tracking-wide",children:"Poll"}),e.jsx("span",{className:`ml-auto text-[11px] px-2 py-0.5 rounded-full font-medium ${de?"bg-gray-700 text-gray-400":"bg-green-900/50 text-green-400"}`,children:de?"Ended":`Ends in ${Math.ceil((se-Date.now())/(1e3*60*60*24))}d`})]}),e.jsx("p",{className:"px-4 pb-3 text-sm font-semibold text-white",children:ne?.question??oe?.question}),pt&&Ct&&e.jsxs("p",{className:"px-4 pb-2 text-[11px] text-gray-400",children:[jt?"Change your vote — ":"","Select up to ",ue," option",ue>1?"s":"",B.length>0&&e.jsxs("span",{className:"ml-1 text-blue-400",children:["· ",B.length," selected"]})]}),e.jsx("div",{className:"px-4 pb-4 space-y-2",children:xe?[1,2,3].map(Ke=>e.jsx("div",{className:"h-9 bg-gray-700/50 rounded-lg animate-pulse"},Ke)):gt.map(Ke=>{const at=Ke.votes?.total_votes??0,_t=St>0?Math.round(at/St*100):0,Vt=Ge.includes(Ke.choice_num),kt=B.includes(Ke.choice_num),Ut=Ct&&B.length>=ue&&!kt,S=pt&&!Ut;let P="border-gray-700",I=e.jsx(O.Circle,{className:"w-3.5 h-3.5 text-gray-500 flex-shrink-0"}),X="bg-blue-600/20";return kt?(P="border-blue-500/60",I=e.jsx(O.CheckCircle2,{className:"w-3.5 h-3.5 text-blue-400 flex-shrink-0"})):Vt&&!jt?(P="border-green-600/60",I=e.jsx(O.CheckCircle2,{className:"w-3.5 h-3.5 text-green-500 flex-shrink-0"}),X="bg-green-600/20"):Vt&&jt&&(P="border-green-800/40",I=e.jsx(O.CheckCircle2,{className:"w-3.5 h-3.5 text-green-700 flex-shrink-0"}),X="bg-green-900/10"),e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${P} bg-gray-900/50 transition-colors ${S?"cursor-pointer hover:border-blue-500/40":Ut?"opacity-50 cursor-not-allowed":""}`,onClick:()=>Tt(Ke.choice_num),children:[_t>0&&e.jsx("div",{className:`absolute inset-y-0 left-0 ${X} transition-all duration-500`,style:{width:`${_t}%`}}),e.jsxs("div",{className:"relative flex items-center justify-between px-3 py-2.5 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[I,e.jsx("span",{className:`text-sm truncate ${kt?"text-blue-300 font-medium":Vt&&!jt?"text-green-300 font-medium":Vt&&jt?"text-green-700":"text-gray-200"}`,children:Ke.choice_text})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 text-[11px] text-gray-400",children:[e.jsxs("span",{children:[_t,"%"]}),e.jsx("span",{className:"text-gray-600",children:"·"}),e.jsxs("span",{children:[at," vote",at!==1?"s":""]})]})]})]},Ke.choice_num)})}),pt&&Ct&&e.jsx("div",{className:"px-4 pb-4",children:e.jsxs("button",{onClick:Bt,disabled:B.length===0||ee,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-700 disabled:text-gray-500 text-white text-sm rounded-lg transition-colors w-full justify-center font-medium",children:[e.jsx(O.Send,{className:"w-3.5 h-3.5"}),ee?"Submitting…":jt?"Change Vote":`Submit Vote${B.length>1?"s":""}`]})}),e.jsxs("div",{className:"px-4 pb-3 text-[11px] text-gray-500 border-t border-gray-700/50 pt-2 flex items-center gap-2",children:[e.jsxs("span",{children:[ne?.poll_stats?.total_voting_accounts_num??0," voter",(ne?.poll_stats?.total_voting_accounts_num??0)!==1?"s":""," total"]}),Se&&e.jsxs("span",{className:"text-green-500 ml-auto",children:["✓ Voted",Be?" · Vote changes allowed":""]})]})]})})(),oe?.tags&&oe.tags.length>0&&e.jsxs("div",{className:"border-t border-gray-700/50 pt-4 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-400 mb-2",children:[e.jsx(O.Tag,{className:"w-3.5 h-3.5"})," Tags"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:oe.tags.map((ue,Re)=>e.jsxs("span",{className:"px-2.5 py-0.5 bg-blue-900/50 text-blue-300 text-[11px] rounded-full",children:["#",ue]},Re))})]}),e.jsx("div",{className:"py-2.5 border-t border-gray-700/50",children:e.jsx(jn,{author:D.author,permlink:D.permlink,currentUser:s,hiveValue:Me,hiveIconUrl:j,payoutTooltip:Fe,initialVotes:D.active_votes||[],initialCommentsCount:D.children||0,onUpvote:n,onSubmitComment:a,onClickCommentUpvote:i,onReblog:o,onShare:c,onTip:d,onReport:f,ecencyToken:p,threeSpeakApiKey:b,giphyApiKey:w,templateToken:x,templateApiBaseUrl:g,disableCommentsModal:!0,onComments:()=>q.current?.scrollIntoView({behavior:"smooth"})})}),e.jsx("div",{ref:q,children:e.jsx(Og,{author:D.author,permlink:D.permlink,currentUser:s,onSubmitComment:a,onClickCommentUpvote:i,ecencyToken:p,threeSpeakApiKey:b,giphyApiKey:w,templateToken:x,templateApiBaseUrl:g,reportedAuthors:v,reportedPosts:N,hiveIconUrl:j,onShareComment:l,onTipComment:h,onReportComment:u})})]})})]})})}const to="_communityLocalKey",pn={getBookmarkedCommunities:()=>{const t=localStorage.getItem(to);return t?JSON.parse(t):[]},isUserPresentLocally:t=>{const r=localStorage.getItem(to);return r?JSON.parse(r).includes(t):!1},storeLikedCommunityLocally:(t,r=!1)=>{let s=pn.getBookmarkedCommunities();return s.includes(t)?s=s.filter(n=>n!==t):r||s.push(t),localStorage.setItem(to,JSON.stringify(s)),s}},Mo=({id:t,toastType:r,isLiked:s,onAdd:n,onRemove:a,onFavourite:i})=>{const[o,c]=k.useState(s??pn.isUserPresentLocally(t));k.useEffect(()=>{s!==void 0&&c(s)},[s]);const d=()=>{i&&i(),o?(a?a(t,"remove_bookmark"):pn.storeLikedCommunityLocally(t,!0),f(!1)):(n?n(t,"add_bookmark"):pn.storeLikedCommunityLocally(t),f(!0)),c(!o)},f=l=>{alert(`The ${r} is ${l?"added to":"removed from"} your bookmarks`)};return e.jsx("button",{onClick:d,className:"p-2 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:o?e.jsx(O.BookmarkCheck,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"}):e.jsx(O.Bookmark,{className:"w-5 h-5 text-gray-500 dark:text-gray-400"})})};class $g{HIVE_API_URL="https://api.hive.blog";async getListOfCommunities(r,s=20,n){const a={limit:s};n&&n.trim()!==""&&(a.last=n),r&&r.trim()!==""&&(a.query=r);const i={jsonrpc:"2.0",method:"bridge.list_communities",params:a,id:1};try{const o=await fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return(await o.json()).result||[]}catch(o){throw console.error("Error fetching communities:",o),o}}async getCommunityDetails(r){const s={jsonrpc:"2.0",method:"bridge.get_community",params:{name:r},id:1};try{const n=await fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return await n.json()}catch(n){throw console.error("Error fetching community details:",n),n}}async getCommunitySubscribers(r,s=100,n){const a={community:r,limit:s};n&&n.trim()!==""&&(a.last=n);const i={jsonrpc:"2.0",method:"bridge.list_community_roles",params:a,id:1};try{const o=await fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return((await o.json()).result||[]).map(d=>({username:d[0],role:d[1],extra:d[2],subscribedAt:d[3]}))}catch(o){throw console.error("Error fetching community subscribers:",o),o}}async getCommunitySubscribersList(r,s=100,n){const a={community:r,limit:s};n&&n.trim()!==""&&(a.last=n);const i={jsonrpc:"2.0",method:"bridge.list_subscribers",params:a,id:2};try{const o=await fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return((await o.json()).result||[]).map(d=>({username:d[0],role:d[1],extra:d[2],subscribedAt:d[3]}))}catch(o){throw console.error("Error fetching community subscribers list:",o),o}}async getCommunityAccounts(r){const s={jsonrpc:"2.0",method:"condenser_api.get_accounts",params:[[r]],id:2};try{const n=await fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return(await n.json()).result||[]}catch(n){throw console.error("Error fetching community accounts:",n),n}}async getRankedPosts(r,s="created",n=20,a,i){const o={tag:r,sort:s,limit:n};a&&i&&(o.start_author=a,o.start_permlink=i);const c={jsonrpc:"2.0",method:"bridge.get_ranked_posts",params:o,id:3};try{const d=await fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok)throw new Error(`HTTP error! status: ${d.status}`);return(await d.json()).result||[]}catch(d){throw console.error("Error fetching ranked posts:",d),d}}communityIcon(r){return`https://images.hive.blog/u/${r}/avatar?size=icon`}userOwnerThumb(r){return`https://images.hive.blog/u/${r}/avatar`}async getCommunityActivities(r,s=100,n){const a={account:r,limit:s};n&&(a.last_id=n);const i={jsonrpc:"2.0",method:"bridge.account_notifications",params:a,id:19};try{const o=await fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return(await o.json()).result||[]}catch(o){throw console.error("Error fetching community activities:",o),o}}}const pr=new $g,Ig=({onSelectCommunity:t,theme:r="dark"})=>{const[s,n]=k.useState([]),[a,i]=k.useState(""),[o,c]=k.useState(!0),[d,f]=k.useState(!1),[l,h]=k.useState(!0),[u,p]=k.useState(null),[b,w]=k.useState(null),x=20,g=k.useRef(null),v=k.useCallback(async(y=!1)=>{if(!(!y&&(d||!l)))try{y?(c(!0),w(null),n([]),p(null),h(!0)):f(!0);const m=a.trim(),_=await pr.getListOfCommunities(m.length>=3?m:void 0,x,y?void 0:u||void 0);n(E=>y?_:[...E,..._]),_.length<x||_.length>0&&_[_.length-1].name===u?h(!1):_.length>0&&p(_[_.length-1].name||null)}catch(m){w(m instanceof Error?m.message:"Failed to load communities"),h(!1)}finally{c(!1),f(!1)}},[a,d,l,u]);k.useEffect(()=>{const y=setTimeout(()=>{v(!0)},a.length>=3||a.length===0?0:500);return()=>clearTimeout(y)},[a]),k.useEffect(()=>{g.current?.focus()},[a,o,b]),k.useEffect(()=>{const y=()=>{window.innerHeight+document.documentElement.scrollTop>=document.documentElement.offsetHeight-200&&!d&&!o&&l&&v()};return window.addEventListener("scroll",y),()=>window.removeEventListener("scroll",y)},[v,d,o,l]);const N=()=>{v(!0)},j=()=>e.jsx("div",{className:"space-y-4",children:Array.from({length:6}).map((y,m)=>e.jsx("div",{className:`${r==="dark"?"bg-slate-900 border-gray-800":"bg-white border-gray-200"} border rounded-xl p-4 animate-pulse`,children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`w-12 h-12 ${r==="dark"?"bg-slate-800":"bg-gray-200"} rounded-full`}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:`h-4 ${r==="dark"?"bg-slate-800":"bg-gray-200"} rounded w-3/4`}),e.jsx("div",{className:`h-3 ${r==="dark"?"bg-slate-800":"bg-gray-200"} rounded w-1/2`})]}),e.jsx("div",{className:`h-3 ${r==="dark"?"bg-slate-800":"bg-gray-200"} rounded w-16`})]})},m))});return o&&s.length===0?e.jsxs("div",{className:`space-y-6 ${r==="dark"?"bg-slate-950":"bg-white"}`,children:[e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 ${r==="dark"?"text-gray-400":"text-gray-500"} w-5 h-5`}),e.jsx("input",{type:"text",placeholder:"Search communities...",value:a,onChange:y=>i(y.target.value),ref:g,autoFocus:!0,className:`w-full pl-10 pr-4 py-3 ${r==="dark"?"bg-slate-900 border-gray-800 text-white placeholder-gray-400":"bg-white border-gray-200 text-gray-900 placeholder-gray-500"}
1129
+ `})]})};function jn({author:t,permlink:r,currentUser:s,hiveValue:n,hiveIconUrl:a,payoutTooltip:i,initialVotes:o,initialCommentsCount:c,onUpvote:d,onSubmitComment:f,onComments:l,onReblog:h,onShare:u,onTip:p,onReport:b,onClickCommentUpvote:w,ecencyToken:x,threeSpeakApiKey:g,giphyApiKey:v,templateToken:N,templateApiBaseUrl:j,disableCommentsModal:y}){const m=s==null||s===""?null:s,_=m!=null,[E,A]=k.useState(o??[]),[C,T]=k.useState(c??0),[D,L]=k.useState(!1),[H,V]=k.useState(!1),[z,F]=k.useState(!1),[Y,G]=k.useState({message:"",visible:!1}),[ne,ie]=k.useState(!1),xe=k.useCallback(Re=>{G({message:Re,visible:!0}),setTimeout(()=>G(ae=>({...ae,visible:!1})),2500)},[]),U=o!==void 0,q=c!==void 0,B=k.useCallback(async()=>{try{const Re=await Nt.getActiveVotes(t,r);A(Re)}catch{}},[t,r]);k.useEffect(()=>{U||B()},[t,r,U]),k.useEffect(()=>{q||Nt.getCommentsList(t,r).then(Re=>{T(Re.length)}).catch(()=>{})},[t,r,q]);const pe=_&&!!m&&E.some(Re=>Re.voter.toLowerCase()===m.toLowerCase()),ee=(Re,ae)=>{if(!_&&Re!=="Comment"){xe(`Please Login to ${Re}`);return}ae()},te=()=>{ee("Upvote",()=>{if(pe){xe("You have already upvoted this post");return}L(!0)})},_e=async Re=>{if(d){ie(!0);try{await Promise.resolve(d(Re)),L(!1),xe("Vote submitted successfully"),await B(),setTimeout(()=>{B()},4e3)}catch(ae){const de=ae instanceof Error?ae.message:"Failed to upvote";xe(de)}finally{ie(!1)}}},Ie=()=>{V(!0)},K=()=>{V(!1),_&&!pe?L(!0):xe(_?"You have already upvoted this post":"Please Login to Upvote")},le=()=>{if(y){l?.();return}ee("Comment",()=>{l?.(),F(!0)})},oe=()=>{ee("Reblog",()=>h?.())},Ne=()=>{ee("Report",()=>b?.())},Ce=()=>{ee("Tip",()=>p?.())},Me=()=>{if(u){u();return}typeof navigator<"u"&&navigator.share?navigator.share({title:`${t}'s post`,url:`https://peakd.com/@${t}/${r}`,text:`Check out this post by @${t}`}).then(()=>xe("Shared")).catch(()=>{}):(navigator.clipboard?.writeText(`https://peakd.com/@${t}/${r}`),xe("Link copied to clipboard"))},Fe=async(Re,ae,de)=>{if(f)try{await Promise.resolve(f(Re,ae,de)),xe("Comment posted")}catch(ve){const fe=ve instanceof Error?ve.message:"Failed to post comment";throw xe(fe),ve}},ue="absolute left-1/2 -translate-x-1/2 bottom-full mb-1 px-2 py-1 text-xs font-medium text-white bg-gray-700 rounded shadow-lg whitespace-nowrap opacity-0 pointer-events-none group-hover:opacity-100 transition-opacity duration-150 z-[60]";return e.jsxs("div",{className:"flex items-center justify-between gap-2 sm:gap-4 text-xs sm:text-sm w-full",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-1.5 sm:gap-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsxs("div",{className:"relative group",children:[e.jsx("span",{className:ue,children:"Upvote"}),e.jsx("button",{type:"button",onClick:te,disabled:ne,className:"p-0.5 sm:p-1 rounded hover:bg-gray-700 disabled:opacity-50","aria-label":"Upvote",children:ne?e.jsx(O.Loader2,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin text-blue-600"}):e.jsx(O.ThumbsUp,{className:`w-3.5 h-3.5 sm:w-4 sm:h-4 ${pe?"text-blue-400 fill-current":"text-gray-300"}`})})]}),e.jsxs("div",{className:"relative group",children:[e.jsx("span",{className:ue,children:"View upvotes"}),e.jsx("button",{type:"button",onClick:Ie,className:"flex items-center gap-0.5 text-gray-300 hover:text-blue-400 transition-colors","aria-label":"View upvotes",children:e.jsx("span",{children:E.length})})]})]}),e.jsxs("div",{className:"relative group",children:[e.jsx("span",{className:ue,children:"Comments"}),e.jsxs("button",{type:"button",onClick:le,className:"flex items-center gap-0.5 text-gray-300 hover:text-blue-400 transition-colors","aria-label":"Comments",children:[e.jsx(O.MessageCircle,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),e.jsx("span",{children:C})]})]}),h&&e.jsxs("div",{className:"relative group",children:[e.jsx("span",{className:ue,children:"Reblog"}),e.jsx("button",{type:"button",onClick:oe,className:"flex items-center gap-0.5 text-gray-300 hover:text-blue-400 transition-colors p-0.5 sm:p-1 rounded","aria-label":"Reblog",children:e.jsx(O.Repeat2,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]}),e.jsxs("div",{className:"relative group",children:[e.jsx("span",{className:ue,children:"Share"}),e.jsx("button",{type:"button",onClick:Me,className:"flex items-center gap-0.5 text-gray-300 hover:text-blue-400 transition-colors p-0.5 sm:p-1 rounded","aria-label":"Share",children:e.jsx(O.Share2,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]}),b&&e.jsxs("div",{className:"relative group",children:[e.jsx("span",{className:ue,children:"Report"}),e.jsx("button",{type:"button",onClick:Ne,className:"flex items-center gap-0.5 text-gray-300 hover:text-red-400 transition-colors p-0.5 sm:p-1 rounded","aria-label":"Report",children:e.jsx(O.Flag,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]}),p&&e.jsxs("div",{className:"relative group",children:[e.jsx("span",{className:ue,children:"Tip"}),e.jsx("button",{type:"button",onClick:Ce,className:"flex items-center gap-0.5 text-gray-300 hover:text-green-400 transition-colors p-0.5 sm:p-1 rounded","aria-label":"Tip",children:e.jsx(O.Gift,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]}),e.jsx("div",{className:"flex-1 flex justify-end min-w-0 shrink-0",children:n!=null&&n!==""&&e.jsxs("div",{className:"relative group",children:[e.jsxs("div",{className:"flex items-center gap-1 cursor-default",children:[e.jsx("span",{className:"font-semibold text-green-400 text-xs sm:text-sm",children:n}),a&&e.jsx("img",{src:a,alt:"Hive",className:"w-4 h-4 rounded-full"})]}),i&&e.jsx("div",{className:"absolute right-0 bottom-full mb-2 w-64 px-3 py-2 text-xs text-gray-200 bg-gray-900 border border-gray-700 rounded-lg shadow-xl whitespace-pre-line opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity duration-200 z-[60]",children:i})]})}),D&&e.jsx(Vn,{author:t,permlink:r,onUpvote:_e,onCancel:()=>L(!1)}),H&&e.jsx(Po,{author:t,permlink:r,onClose:()=>V(!1),currentUser:m??void 0,token:void 0,onClickUpvoteButton:K}),z&&e.jsx(Do,{author:t,permlink:r,onClose:()=>{F(!1),Nt.getCommentsList(t,r).then(Re=>T(Re.length))},currentUser:m??void 0,token:void 0,onSubmitComment:f?Fe:void 0,onClickCommentUpvote:w,ecencyToken:x,threeSpeakApiKey:g,giphyApiKey:v,templateToken:N,templateApiBaseUrl:j}),Y.visible&&e.jsx("div",{className:"fixed bottom-4 right-4 z-[100] max-w-[280px] rounded-lg bg-gray-900 text-white px-3 py-2 shadow-lg text-sm",children:Y.message})]})}const Pg=4;function h0({comment:t,allComments:r,onReply:s,onCancelReply:n,onCommentSubmit:a,activeReplyKey:i,currentUser:o,token:c,depth:d=0,onVotedRefresh:f,onClickCommentUpvote:l,ecencyToken:h,threeSpeakApiKey:u,giphyApiKey:p,templateToken:b,templateApiBaseUrl:w,hiveIconUrl:x,onShareComment:g,onTipComment:v,onReportComment:N}){const[j,y]=k.useState(!1),[m,_]=k.useState(!0),[E,A]=k.useState(!1),[C,T]=k.useState(!1),[D,L]=k.useState(!1),[H,V]=k.useState(""),[z,F]=k.useState(!1),[Y,G]=k.useState(""),ne=ae=>{V(ae),L(!0),setTimeout(()=>L(!1),2500)},ie=k.useMemo(()=>{if(!o)return!1;const ae=o.toLowerCase();return(t.active_votes||[]).some(de=>(de.voter||"").toLowerCase()===ae)},[t.active_votes,o]),xe=t.depth||0;let U=r.filter(ae=>ae.parent_author===t.author&&ae.parent_permlink===t.permlink&&(typeof ae.depth!="number"||ae.depth===xe+1));if(U.length===0&&Array.isArray(t.replies)&&t.replies.length>0){const ae=new Set(t.replies);U=r.filter(de=>ae.has(`${de.author}/${de.permlink}`))}const q=U.length>0,B=d>=Pg,pe=i===`${t.author}/${t.permlink}`;k.useEffect(()=>{pe&&G("")},[pe]);const ee=t.json_metadata_parsed||(()=>{try{return t.json_metadata?JSON.parse(t.json_metadata):void 0}catch{return}})(),_e=(t.body||"").replace(/^(\s*(?:#[\p{L}\p{N}_-]+\s*(?:,\s*)?)+\s*)$/gimu,"").trim(),Ie=/!\[[^\]]*\]\([^)]+\)/.test(_e)||/<img\s/i.test(_e),K=Array.isArray(ee?.image)?ee.image:[],le=k.useMemo(()=>{try{return Un({baseUrl:"https://hreplier.sagarkothari88.one/",ipfsGateway:"https://ipfs.3speak.tv",assetsWidth:640,assetsHeight:480,usertagUrlFn:ae=>`https://hreplier.sagarkothari88.one/#/@${ae}`,hashtagUrlFn:ae=>`https://peakd.com/created/${ae}`,convertHiveUrls:!0})}catch{return null}},[]),oe=k.useMemo(()=>{if(!_e||!le)return"";try{let ae=le(_e);return ae=ae.replace(/https:\/\/3speak\.tv\/embed\?v=([^"&\s]+)/gi,(de,ve)=>`https://play.3speak.tv/embed?v=${ve}&mode=iframe&noscroll=1`),ae}catch{return""}},[_e,le]),Ne=t.stats?.total_votes||t.net_votes||0,Ce=k.useMemo(()=>{if(t.payout&&t.payout>0)return t.payout.toFixed(3);const ae=parseFloat(String(t.pending_payout_value??"0").replace(/[^\d.]/g,""))||0;if(ae>0)return ae.toFixed(3);const de=parseFloat(String(t.author_payout_value??"0").replace(/[^\d.]/g,""))||0,ve=parseFloat(String(t.curator_payout_value??"0").replace(/[^\d.]/g,""))||0,fe=de+ve;return fe>0?fe.toFixed(3):""},[t.payout,t.pending_payout_value,t.author_payout_value,t.curator_payout_value]),Me=async ae=>{if(l){try{await Promise.resolve(l(t.author,t.permlink,ae)),T(!0),A(!1),setTimeout(()=>{f?.(),ne("Vote submitted successfully!")},3e3)}catch(de){alert(de instanceof Error?de.message:"Failed to upvote")}return}if(!c){ne("Please login or provide an upvote handler to vote");return}try{await Nt.handleUpvote({author:t.author,permlink:t.permlink,weight:Math.round(ae*100),authToken:c}),T(!0),A(!1),setTimeout(()=>{f?.(),ne("Vote submitted successfully!")},3e3)}catch(de){alert(de instanceof Error?de.message:"Failed to upvote")}},Fe=()=>{if(!o){ne("Please login to upvote");return}if(ie||C){ne("You have already upvoted this comment");return}A(!0)},ue=()=>{if(!o){ne("Please login to reply");return}s(t.author,t.permlink)},Re=!B||z;return e.jsxs("div",{className:`${d>0?"ml-2 md:ml-6 border-l-2 border-gray-700/50 pl-2 md:pl-4":""}`,children:[e.jsxs("div",{className:"py-2 px-1.5 md:py-3 md:px-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 md:gap-2 mb-1 min-w-0",children:[e.jsx("img",{src:`https://images.hive.blog/u/${t.author}/avatar`,alt:t.author,className:"w-6 h-6 md:w-7 md:h-7 rounded-full flex-shrink-0 bg-gray-700",onError:ae=>{ae.target.src=`https://ui-avatars.com/api/?name=${t.author}&background=random`}}),e.jsxs("span",{className:"text-xs md:text-sm font-semibold text-white truncate",children:["@",t.author]}),t.author===o&&e.jsx("span",{className:"px-1 py-0.5 text-[9px] md:text-[10px] bg-blue-900 text-blue-200 rounded-full flex-shrink-0",children:"You"}),e.jsxs("span",{className:"hidden sm:flex items-center gap-1 text-xs text-gray-500 flex-shrink-0",children:[e.jsx(O.Clock,{className:"w-3 h-3"}),t.created?bs.formatDistanceToNow(new Date(t.created+"Z"),{addSuffix:!0}):""]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>y(!j),className:"p-1 rounded hover:bg-gray-700/60 transition-colors text-gray-400 hover:text-white flex-shrink-0",title:j?"Expand comment":"Minimize comment",children:j?e.jsx(O.ChevronDown,{className:"w-4 h-4"}):e.jsx(O.ChevronUp,{className:"w-4 h-4"})})]}),!j&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"prose prose-sm prose-invert max-w-none mb-2 text-gray-200 text-left prose-a:text-blue-400 [&>*]:text-left ml-7 md:ml-9",children:oe?e.jsx("div",{className:"hive-post-body",dangerouslySetInnerHTML:{__html:oe}}):e.jsx("p",{className:"text-gray-400 text-sm italic",children:"No content available."})}),!Ie&&K.length>0&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 mb-2 ml-7 md:ml-9",children:K.map((ae,de)=>e.jsx("img",{src:ae,alt:`image-${de}`,className:"max-w-full h-auto rounded-lg cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>window.open(ae,"_blank")},ae+de))}),e.jsx("div",{className:"ml-7 md:ml-9 text-xs",children:e.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1.5",children:[e.jsxs("button",{onClick:Fe,className:`flex items-center gap-1 font-medium transition-colors ${ie||C?"text-blue-400":"text-gray-400 hover:text-blue-400"}`,children:[e.jsx(O.ThumbsUp,{className:`w-3.5 h-3.5 ${ie||C?"fill-current":""}`}),e.jsx("span",{children:Ne})]}),e.jsxs("button",{onClick:ue,className:"flex items-center gap-1 font-medium text-gray-400 hover:text-blue-400 transition-colors",children:[e.jsx(O.MessageSquare,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Reply"})]}),g&&e.jsx("button",{onClick:()=>g(t.author,t.permlink),className:"text-gray-400 hover:text-blue-400 transition-colors p-0.5",title:"Share",children:e.jsx(O.Share2,{className:"w-3.5 h-3.5"})}),N&&o&&t.author!==o&&e.jsx("button",{onClick:()=>N(t.author,t.permlink),className:"text-gray-400 hover:text-red-400 transition-colors p-0.5",title:"Report",children:e.jsx(O.Flag,{className:"w-3.5 h-3.5"})}),v&&o&&t.author!==o&&e.jsx("button",{onClick:()=>v(t.author,t.permlink),className:"text-gray-400 hover:text-green-400 transition-colors p-0.5",title:"Tip",children:e.jsx(O.Gift,{className:"w-3.5 h-3.5"})}),q&&e.jsxs("button",{onClick:()=>_(!m),className:"flex items-center gap-1 font-medium text-gray-400 hover:text-blue-400 transition-colors",children:[m?e.jsx(O.ChevronUp,{className:"w-3.5 h-3.5"}):e.jsx(O.ChevronDown,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"hidden sm:inline",children:[m?"Hide":"Show"," "]}),e.jsxs("span",{children:[U.length," ",U.length===1?"reply":"replies"]})]}),Ce&&e.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[e.jsx("span",{className:"font-semibold text-green-400 text-[11px]",children:Ce}),x&&e.jsx("img",{src:x,alt:"Hive",className:"w-3 h-3 rounded-full"})]})]})}),E&&!ie&&e.jsx("div",{className:"mt-2 ml-7 md:ml-9",children:e.jsx(Vn,{author:t.author,permlink:t.permlink,onUpvote:Me,onCancel:()=>A(!1)})}),pe&&o&&e.jsxs(e.Fragment,{children:[T0.createPortal(e.jsxs("div",{className:"md:hidden",children:[e.jsx("div",{className:"fixed inset-0 bg-black/40 z-[9998]",onClick:n}),e.jsxs("div",{className:"fixed inset-x-0 bottom-0 z-[9999] border-t border-gray-700 bg-gray-900 shadow-[0_-4px_20px_rgba(0,0,0,0.5)] max-h-[70vh] overflow-y-auto",children:[e.jsx("div",{className:"px-3 py-2 border-b border-gray-700 bg-gray-900/95 sticky top-0 z-10",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:`https://images.hive.blog/u/${o}/avatar`,alt:o,className:"w-6 h-6 rounded-full flex-shrink-0 bg-gray-700 border border-gray-600",onError:ae=>{ae.target.src=`https://ui-avatars.com/api/?name=${o}&background=random`}}),e.jsxs("span",{className:"text-xs font-medium text-white truncate",children:["@",o]}),o===t.author?e.jsx("span",{className:"text-gray-500 text-[11px]",children:"replying to your comment"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-500 text-[11px]",children:"to"}),e.jsx("img",{src:`https://images.hive.blog/u/${t.author}/avatar`,alt:t.author,className:"w-6 h-6 rounded-full flex-shrink-0 bg-gray-700 border border-gray-600",onError:ae=>{ae.target.src=`https://ui-avatars.com/api/?name=${t.author}&background=random`}}),e.jsxs("span",{className:"text-xs font-medium text-blue-400 truncate",children:["@",t.author]})]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:n,className:"p-1.5 rounded hover:bg-gray-700/60 transition-colors flex-shrink-0",title:"Cancel reply",children:e.jsx(O.X,{className:"w-4 h-4 text-gray-400 hover:text-white"})})]})}),e.jsx(gs,{onSubmit:ae=>a(t.author,t.permlink,ae),onCancel:n,currentUser:o,parentAuthor:t.author,parentPermlink:t.permlink,placeholder:`Reply to @${t.author}...`,value:Y,onChange:G,ecencyToken:h,threeSpeakApiKey:u,giphyApiKey:p,templateToken:b,templateApiBaseUrl:w,hideUserHeader:!0,showCancel:!0})]})]}),document.body),e.jsxs("div",{className:"hidden md:block mt-3 ml-9 border border-gray-700 rounded-xl overflow-hidden bg-gray-800/50",children:[e.jsx("div",{className:"px-3 py-2 border-b border-gray-700 bg-gray-900/50",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("img",{src:`https://images.hive.blog/u/${o}/avatar`,alt:o,className:"w-6 h-6 rounded-full flex-shrink-0 bg-gray-700 border border-gray-600",onError:ae=>{ae.target.src=`https://ui-avatars.com/api/?name=${o}&background=random`}}),e.jsx("div",{className:"flex flex-col min-w-0",children:e.jsxs("span",{className:"text-xs font-medium text-white truncate",children:["@",o]})}),o===t.author?e.jsx("span",{className:"text-gray-500 text-[11px]",children:"replying to your comment"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-500 text-[11px]",children:"replying to"}),e.jsx("img",{src:`https://images.hive.blog/u/${t.author}/avatar`,alt:t.author,className:"w-6 h-6 rounded-full flex-shrink-0 bg-gray-700 border border-gray-600",onError:ae=>{ae.target.src=`https://ui-avatars.com/api/?name=${t.author}&background=random`}}),e.jsx("div",{className:"flex flex-col min-w-0",children:e.jsxs("span",{className:"text-xs font-medium text-blue-400 truncate",children:["@",t.author,"/",t.permlink]})})]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:n,className:"p-1 rounded hover:bg-gray-700/60 transition-colors flex-shrink-0",title:"Cancel reply",children:e.jsx(O.X,{className:"w-3.5 h-3.5 text-gray-400 hover:text-white"})})]})}),e.jsx(gs,{onSubmit:ae=>a(t.author,t.permlink,ae),onCancel:n,currentUser:o,parentAuthor:t.author,parentPermlink:t.permlink,placeholder:`Reply to @${t.author}...`,value:Y,onChange:G,ecencyToken:h,threeSpeakApiKey:u,giphyApiKey:p,templateToken:b,templateApiBaseUrl:w,hideUserHeader:!0,showCancel:!0})]})]})]}),j&&(()=>{const ae=_e.replace(/<[^>]*>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[#*_~`>]/g,"").replace(/\s+/g," ").trim();return e.jsxs("p",{className:"text-xs text-gray-500 ml-7 md:ml-9 truncate",children:[ae.slice(0,120),ae.length>120?"…":""]})})()]}),!j&&q&&m&&Re&&e.jsx("div",{children:U.map(ae=>e.jsx(h0,{comment:ae,allComments:r,onReply:s,onCancelReply:n,onCommentSubmit:a,activeReplyKey:i,currentUser:o,token:c,depth:d+1,onVotedRefresh:f,onClickCommentUpvote:l,ecencyToken:h,threeSpeakApiKey:u,giphyApiKey:p,templateToken:b,templateApiBaseUrl:w,hiveIconUrl:x,onShareComment:g,onTipComment:v,onReportComment:N},ae.permlink))}),!j&&q&&m&&B&&!z&&e.jsx("div",{className:"ml-3 md:ml-6 py-2 pl-3 md:pl-4 border-l-2 border-gray-700/50",children:e.jsxs("button",{onClick:()=>F(!0),className:"text-xs text-blue-400 hover:text-blue-300 hover:underline transition-colors",children:["View ",U.length," more ",U.length===1?"reply":"replies"]})}),D&&e.jsx("div",{className:"fixed bottom-4 right-4 w-[280px] z-50",children:e.jsx("div",{className:"bg-gray-800 text-white rounded px-3 py-2 shadow-lg text-sm",children:H})})]})}function Og({author:t,permlink:r,currentUser:s,token:n,onSubmitComment:a,onClickCommentUpvote:i,ecencyToken:o,threeSpeakApiKey:c,giphyApiKey:d,templateToken:f,templateApiBaseUrl:l,reportedAuthors:h,reportedPosts:u,hiveIconUrl:p,onShareComment:b,onTipComment:w,onReportComment:x}){const[g,v]=k.useState([]),[N,j]=k.useState(!0),[y,m]=k.useState(null),[_,E]=k.useState(!1),[A,C]=k.useState(null),[T,D]=k.useState(""),[L,H]=k.useState(!1),V=k.useCallback(async(B=!1)=>{B?E(!0):j(!0),m(null);try{const pe=await Nt.getCommentsList(t,r,s??"");v(pe)}catch(pe){m(pe instanceof Error?pe.message:"Failed to load comments")}finally{j(!1),E(!1)}},[t,r]);k.useEffect(()=>{V()},[V]);const z=k.useMemo(()=>{if(!T.trim())return g;const B=T.toLowerCase();return g.filter(pe=>pe.body?.toLowerCase().includes(B)||pe.author.toLowerCase().includes(B))},[T,g]),F=k.useMemo(()=>{if(!s)return z;const B=new Set((h??[]).map(ee=>ee.toLowerCase())),pe=new Set((u??[]).map(ee=>`${ee.author.toLowerCase()}/${ee.permlink.toLowerCase()}`));return B.size===0&&pe.size===0?z:z.filter(ee=>!(B.has(ee.author.toLowerCase())||pe.has(`${ee.author.toLowerCase()}/${ee.permlink.toLowerCase()}`)))},[z,s,h,u]),Y=k.useMemo(()=>{if(!s?.trim())return F;const B=s.toLowerCase();return[...F].sort((pe,ee)=>{const te=pe.author?.toLowerCase()===B,_e=ee.author?.toLowerCase()===B;return te&&!_e?-1:!te&&_e?1:0})},[F,s]),G=Y.filter(B=>B.parent_author===t&&B.parent_permlink===r),ne=(B,pe)=>{C(`${B}/${pe}`)},ie=()=>{C(null)},xe=async(B,pe,ee)=>{if(a){try{await Promise.resolve(a(B,pe,ee)),C(null),E(!0),setTimeout(async()=>{await V(!0)},3e3)}catch(te){alert(te instanceof Error?te.message:"Failed to post comment")}return}if(!n){alert("Please login to comment");return}try{await Nt.handleComment({author:B,permlink:pe,body:ee,authToken:n}),C(null),E(!0),setTimeout(async()=>{await V(!0)},3e3)}catch(te){alert(te instanceof Error?te.message:"Failed to post comment")}},U=!!s,q=s===t;return e.jsxs("div",{className:"border-t border-gray-700/50 mt-2",children:[e.jsxs("div",{className:"flex items-center justify-between px-1 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("h3",{className:"text-sm font-semibold text-white",children:["Comments ",g.length>0&&`(${g.length})`]}),_&&e.jsx(O.Loader2,{className:"w-4 h-4 animate-spin text-blue-500"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>H(!L),className:"p-1.5 rounded-lg hover:bg-gray-700/60 transition-colors",title:"Search comments",children:e.jsx(O.Search,{className:"w-4 h-4 text-gray-400"})}),e.jsx("button",{onClick:()=>V(!0),disabled:_,className:"p-1.5 rounded-lg hover:bg-gray-700/60 transition-colors disabled:opacity-50",title:"Refresh comments",children:e.jsx(O.RefreshCw,{className:`w-4 h-4 text-gray-400 ${_?"animate-spin":""}`})})]})]}),L&&e.jsx("div",{className:"px-1 pb-3",children:e.jsx("input",{type:"text",placeholder:"Search comments...",value:T,onChange:B=>D(B.target.value),className:"w-full bg-gray-800 border border-gray-700 rounded-lg px-3 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-blue-500",autoFocus:!0})}),U&&e.jsxs("div",{className:"border border-gray-700 rounded-xl mb-3 overflow-hidden bg-gray-800/50",children:[e.jsx("div",{className:"px-3 py-2.5 border-b border-gray-700 bg-gray-900/50",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("img",{src:`https://images.hive.blog/u/${s}/avatar`,alt:s,className:"w-6 h-6 rounded-full flex-shrink-0 bg-gray-700 border border-gray-600",onError:B=>{B.target.src=`https://ui-avatars.com/api/?name=${s}&background=random`}}),e.jsxs("span",{className:"text-xs font-medium text-white",children:["@",s]}),q?e.jsx("span",{className:"text-gray-500 text-[11px]",children:"commenting on your post"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-500 text-[11px]",children:"replying to"}),e.jsx("img",{src:`https://images.hive.blog/u/${t}/avatar`,alt:t,className:"w-6 h-6 rounded-full flex-shrink-0 bg-gray-700 border border-gray-600",onError:B=>{B.target.src=`https://ui-avatars.com/api/?name=${t}&background=random`}}),e.jsx("div",{className:"flex flex-col min-w-0",children:e.jsxs("span",{className:"text-xs font-medium text-blue-400 truncate",children:["@",t,"/",r]})})]})]})}),e.jsx(gs,{onSubmit:B=>xe(t,r,B),currentUser:s,parentAuthor:t,parentPermlink:r,placeholder:`Write a comment to @${t}...`,ecencyToken:o,threeSpeakApiKey:c,giphyApiKey:d,templateToken:f,templateApiBaseUrl:l,hideUserHeader:!0,disableAutoFocus:!0})]}),N&&e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(O.Loader2,{className:"w-6 h-6 animate-spin text-blue-500 mr-2"}),e.jsx("span",{className:"text-sm text-gray-400",children:"Loading comments..."})]}),!N&&y&&e.jsxs("div",{className:"flex flex-col items-center py-6 text-center",children:[e.jsx(O.AlertCircle,{className:"w-8 h-8 text-red-500 mb-2"}),e.jsx("p",{className:"text-sm text-gray-400 mb-3",children:y}),e.jsx("button",{onClick:()=>V(),className:"px-4 py-1.5 bg-blue-600 hover:bg-blue-700 text-white text-sm rounded-lg transition-colors",children:"Retry"})]}),!N&&!y&&G.length===0&&e.jsxs("div",{className:"flex flex-col items-center py-8 text-center",children:[e.jsx(O.MessageCirclePlus,{className:"w-10 h-10 text-gray-600 mb-3"}),e.jsx("p",{className:"text-sm text-gray-400",children:T?"No comments match your search":"No comments yet. Be the first!"})]}),!N&&!y&&G.length>0&&e.jsx("div",{className:"divide-y divide-gray-800/50",children:G.map(B=>e.jsx(h0,{comment:B,allComments:Y,onReply:ne,onCancelReply:ie,onCommentSubmit:xe,activeReplyKey:A,currentUser:s,token:n,depth:0,onVotedRefresh:()=>V(!0),onClickCommentUpvote:i,ecencyToken:o,threeSpeakApiKey:c,giphyApiKey:d,templateToken:f,templateApiBaseUrl:l,hiveIconUrl:p,onShareComment:b,onTipComment:w,onReportComment:x},B.permlink))})]})}const Lg=t=>{if(t===0)return"25";const r=t<0;let s=r?-t:t,n=Math.log10(s);return n=Math.max(n-9,0),n=(r?-1:1)*n,n=n*9+25,Math.round(n).toString()},Mg=t=>{try{return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return t}};function Rg({author:t,permlink:r,currentUser:s,onUpvote:n,onSubmitComment:a,onClickCommentUpvote:i,onReblog:o,onShare:c,onTip:d,onReport:f,onShareComment:l,onTipComment:h,onReportComment:u,ecencyToken:p,threeSpeakApiKey:b,giphyApiKey:w,templateToken:x,templateApiBaseUrl:g,reportedAuthors:v,reportedPosts:N,hiveIconUrl:j="/images/hive_logo.png",backgroundColor:y,onBack:m,onUserClick:_,onNavigateToPost:E,onVotePoll:A}){const C=k.useMemo(()=>y?Array.isArray(y)?y.length===0?{}:y.length===1?{background:y[0]}:{background:`linear-gradient(to bottom, ${y.join(", ")})`}:{background:y}:{},[y]),T=k.useMemo(()=>y?Array.isArray(y)?{backgroundColor:y[0],opacity:.97}:{backgroundColor:y}:{},[y]),[D,L]=k.useState(null),[H,V]=k.useState(null),[z,F]=k.useState(!0),[Y,G]=k.useState(null),[ne,ie]=k.useState(null),[xe,U]=k.useState(!1),q=k.useRef(null),[B,pe]=k.useState([]),[ee,te]=k.useState(!1),[_e,Ie]=k.useState([]),K=k.useMemo(()=>{try{return Un({baseUrl:"https://hreplier.sagarkothari88.one/",ipfsGateway:"https://ipfs.3speak.tv",assetsWidth:640,assetsHeight:480,usertagUrlFn:ue=>`https://hreplier.sagarkothari88.one/#/@${ue}`,hashtagUrlFn:ue=>`https://peakd.com/created/${ue}`,convertHiveUrls:!0})}catch{return null}},[]),le=k.useMemo(()=>{if(!D?.body||!K)return"";try{let ue=K(D.body);return ue=ue.replace(/https:\/\/3speak\.tv\/embed\?v=([^"&\s]+)/gi,(Re,ae)=>`https://play.3speak.tv/embed?v=${ae}&mode=iframe&noscroll=1`),ue=ue.replace(/(<iframe\s[^>]*src="https:\/\/play\.3speak\.tv\/embed[^"]*"[^>]*><\/iframe>)/gi,'<div class="threeSpeakWrapper">$1</div>'),ue=ue.replace(/<iframe\s[^>]*src="(https:\/\/audio\.3speak\.tv\/play\?[^"]*)"[^>]*>(?:<\/iframe>)?/gi,(Re,ae)=>{let de=ae;return de.includes("mode=minimal")||(de+="&mode=minimal"),de.includes("iframe=1")||(de+="&iframe=1"),`<div class="audioWrapper"><iframe src="${de}" scrolling="no" frameborder="0" allow="autoplay"></iframe></div>`}),ue=ue.replace(/<img\s([^>]*?)alt="([^"]+)"([^>]*?)\/?\s*>/gi,(Re,ae,de,ve)=>`<figure class="hive-img-figure">${`<img ${ae}alt="${de}"${ve}>`}<figcaption>${de}</figcaption></figure>`),ue}catch{return""}},[D?.body,K]),oe=k.useMemo(()=>{const ue=D?.json_metadata;if(!ue)return{};if(typeof ue=="string")try{return JSON.parse(ue)}catch{return{}}return ue},[D?.json_metadata]),Ne=k.useCallback(async()=>{F(!0),G(null);try{const ue=await Nt.getPostContent(t,r);ue?L(ue):G("Post not found")}catch(ue){G(ue instanceof Error?ue.message:"Failed to load post")}finally{F(!1)}},[t,r]);k.useEffect(()=>{Ne()},[Ne]),k.useEffect(()=>{!D||oe?.content_type!=="poll"||(U(!0),Ee.getPollDetail(D.author,D.permlink).then(ue=>ie(ue)).catch(()=>ie(null)).finally(()=>U(!1)))},[D?.author,D?.permlink,oe?.content_type]),k.useEffect(()=>{(async()=>{if(t)try{const ae=(await Ee.getProfile(t))?.result;if(!ae)return;V({username:ae.name,name:ae.metadata?.profile?.name,profileImage:ae.metadata?.profile?.profile_image,followersCount:ae.stats?.followers||0,followingCount:ae.stats?.following||0,postsCount:ae.post_count||0,reputation:ae.reputation||0})}catch{}})()},[t]);const Ce=ue=>{if(!ue)return 0;const Re=typeof ue=="string"?ue:String(ue),ae=parseFloat(Re.replace(/[^\d.]/g,""));return isNaN(ae)?0:ae},Me=k.useMemo(()=>{if(!D)return"";if(D.payout&&D.payout>0)return`${D.payout.toFixed(3)}`;const ue=Ce(D.pending_payout_value);if(ue>0)return`${ue.toFixed(3)}`;const Re=Ce(D.total_payout_value);if(Re>0)return`${Re.toFixed(3)}`;const ae=Ce(D.author_payout_value),de=Ce(D.curator_payout_value),ve=ae+de;return ve>0?`${ve.toFixed(3)}`:"0.000"},[D]),Fe=k.useMemo(()=>{if(!D)return"";const ue=[],Re=Ce(D.pending_payout_value),ae=Ce(D.author_payout_value),de=Ce(D.curator_payout_value),ve=D.payout&&D.payout>0?D.payout:Re>0?Re:ae+de,fe=D.percent_hbd??1e4;if(fe===0?ue.push("Hive Rewards Payout 100% Powered Up"):ue.push(`Hive Rewards Payout (${(fe/200).toFixed(0)}%/${100-fe/200}%)`),D.is_paidout)ue.push("Past payouts:"),ae>0&&ue.push(`Author: $${ae.toFixed(3)}`),de>0&&ue.push(`Curator: $${de.toFixed(3)}`),ue.push(`Total: $${ve.toFixed(3)}`);else{if(D.payout_at){const ke=new Date(D.payout_at).getTime()-Date.now();if(ke>0){const Se=Math.floor(ke/36e5),Be=Math.floor(Se/24),Ge=Se%24,pt=Be>0?`in ${Be} day${Be>1?"s":""}${Ge>0?` ${Ge} hour${Ge>1?"s":""}`:""}`:`in ${Se} hour${Se>1?"s":""}`;ue.push(`Payout will occur: ${pt}`)}}ue.push(`Pending: $${Re.toFixed(3)}`)}return D.beneficiaries?.length>0&&(ue.push("Beneficiaries:"),D.beneficiaries.forEach(ke=>{ue.push(`${ke.account}: ${(ke.weight/100).toFixed(0)}%`)})),ue.join(`
1130
+ `)},[D]);return z?e.jsxs("div",{className:"dark flex flex-col h-full bg-gray-900 animate-pulse",style:C,children:[e.jsx("div",{className:"sticky top-0 z-30 h-[56px] bg-gray-800 border-b border-gray-700 flex items-center",style:T,children:e.jsxs("div",{className:"px-4 py-2 flex items-center gap-2 w-full",children:[m&&e.jsx("div",{className:"w-8 h-8 bg-gray-700 rounded-lg flex-shrink-0"}),e.jsx("div",{className:"w-8 h-8 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-28 mb-1.5"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-44"})]})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-4 sm:py-6",children:[e.jsx("div",{className:"h-7 bg-gray-700 rounded w-4/5 mb-2"}),e.jsx("div",{className:"h-7 bg-gray-700 rounded w-3/5 mb-3"}),e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-32"}),e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24"})]}),e.jsxs("div",{className:"py-2.5 border-y border-gray-700/50 mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"h-4 w-4 bg-gray-700 rounded"}),e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-8"}),e.jsx("div",{className:"h-4 w-4 bg-gray-700 rounded"}),e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-8"}),e.jsx("div",{className:"h-4 w-4 bg-gray-700 rounded"}),e.jsx("div",{className:"h-4 w-4 bg-gray-700 rounded"}),e.jsx("div",{className:"h-4 w-4 bg-gray-700 rounded"}),e.jsx("div",{className:"h-4 w-4 bg-gray-700 rounded"}),e.jsx("div",{className:"flex-1"}),e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-16"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-4/5"})]}),e.jsx("div",{className:"h-48 sm:h-64 bg-gray-800 rounded-xl border border-gray-700"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-3/5"})]}),e.jsx("div",{className:"h-6 bg-gray-700 rounded w-2/5 mt-2"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-2/3"})]}),e.jsx("div",{className:"h-48 sm:h-64 bg-gray-800 rounded-xl border border-gray-700"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-gray-700/60 rounded w-3/4"})]})]}),e.jsx("div",{className:"border-t border-gray-700/50 pt-4 mt-6",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-5 bg-gray-700 rounded-full w-14"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded-full w-16"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded-full w-12"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded-full w-18"})]})})]})})]}):Y||!D?e.jsx("div",{className:"dark flex justify-center items-center min-h-screen bg-gray-900 p-8",style:C,children:e.jsxs("div",{className:"text-center",children:[e.jsx(O.AlertCircle,{className:"w-12 h-12 text-red-500 mx-auto mb-3"}),e.jsx("h3",{className:"text-base font-semibold text-white mb-1",children:"Failed to load post"}),e.jsx("p",{className:"text-gray-400 text-sm mb-4",children:Y}),e.jsx("button",{onClick:Ne,className:"px-5 py-2 bg-blue-600 hover:bg-blue-700 text-white text-sm rounded-lg transition-colors",children:"Try Again"})]})}):e.jsx("div",{className:"dark flex flex-col h-full bg-gray-900",style:C,children:e.jsxs("div",{className:"flex flex-col overflow-y-auto h-full",children:[e.jsx("div",{className:"sticky top-0 z-30 h-[56px] bg-gray-800/95 backdrop-blur-sm border-b border-gray-700 flex items-center",style:T,children:e.jsxs("div",{className:"px-4 py-2 flex items-center gap-2 w-full",children:[m&&e.jsx("button",{onClick:m,className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors flex-shrink-0",children:e.jsx(O.ArrowLeft,{className:"h-5 w-5 text-gray-300"})}),e.jsx("img",{src:H?.profileImage||`https://images.hive.blog/u/${D.author}/avatar`,alt:D.author,className:"w-8 h-8 rounded-full flex-shrink-0 bg-gray-700 cursor-pointer",onError:ue=>{ue.target.src=`https://images.hive.blog/u/${D.author}/avatar`},onClick:()=>_?.(D.author)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>_?.(D.author),className:"text-sm font-semibold text-white truncate hover:text-blue-400 transition-colors",children:["@",D.author]}),H&&H.reputation>0&&e.jsx("span",{className:"text-[10px] bg-gray-700 text-gray-300 px-1.5 py-0.5 rounded-full flex-shrink-0",children:Lg(H.reputation)})]}),H&&e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-400",children:[e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-gray-200",children:H.followersCount.toLocaleString()})," Followers"]}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-gray-200",children:H.followingCount.toLocaleString()})," Following"]}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-gray-200",children:H.postsCount.toLocaleString()})," Posts"]})]})]})]})}),e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-4 sm:py-6",children:[D.depth>0&&D.parent_author&&D.parent_permlink&&e.jsxs("button",{onClick:()=>E?.(D.parent_author,D.parent_permlink),className:"mb-4 flex items-center gap-2 px-3 py-2 rounded-lg border border-gray-700 bg-gray-800/60 hover:bg-gray-700/60 transition-colors text-sm text-blue-400 hover:text-blue-300",children:[e.jsx(O.ArrowUpRight,{className:"w-4 h-4"}),e.jsx("span",{children:"View parent post"}),e.jsxs("span",{className:"text-gray-500 text-xs truncate max-w-[250px]",children:["@",D.parent_author,"/",D.parent_permlink]})]}),e.jsx("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold text-white leading-tight mb-2",children:D.title}),e.jsxs("div",{className:"text-xs text-gray-400 mb-4 flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"w-3.5 h-3.5"}),Mg(D.created)]}),D.community_title&&e.jsxs("span",{children:["in ",e.jsx("span",{className:"text-blue-400",children:D.community_title})]})]}),e.jsx("div",{className:"pb-6",children:le?e.jsx("div",{className:"hive-post-body",dangerouslySetInnerHTML:{__html:le}}):e.jsx("p",{className:"text-gray-400 text-sm italic",children:"No content available."})}),oe?.content_type==="poll"&&(()=>{const ue=ne?.max_choices_voted??oe?.max_choices_voted??1,Re=ue>1,ae=ne?.end_time?new Date(ne.end_time).getTime():(oe?.end_time??0)*1e3,de=ae>0&&Date.now()>ae,ve=_e.length>0,fe=s?ne?.poll_voters?.find(Ke=>Ke.name===s):void 0,ke=fe?.choices?.length?fe.choices:fe?.choice_num!=null?[fe.choice_num]:[],Se=ve||ke.length>0,Be=ne?.allow_vote_changes??oe?.allow_vote_changes??!1,Ge=ve?_e:ke,pt=!!s&&!de&&!!A&&(!Se||Be),jt=Se&&Be&&!ve,gt=ne?.poll_choices??(oe?.choices??[]).map((Ke,at)=>({choice_num:at+1,choice_text:Ke,votes:null})),St=gt.reduce((Ke,at)=>Ke+(at.votes?.total_votes??0),0),Ct=Re||jt,Tt=async Ke=>{if(!(!pt||ee))if(Ct)pe(at=>at.includes(Ke)?at.filter(_t=>_t!==Ke):at.length>=ue?at:[...at,Ke]);else{te(!0);try{await A?.(D.author,D.permlink,[Ke]),Ie([Ke])}finally{te(!1)}}},Bt=async()=>{if(!(!pt||ee||B.length===0)){te(!0);try{await A?.(D.author,D.permlink,B),Ie(B),pe([])}finally{te(!1)}}};return e.jsxs("div",{className:"mb-6 rounded-xl border border-gray-700 bg-gray-800/60 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 pt-4 pb-2",children:[e.jsx(O.BarChart2,{className:"w-4 h-4 text-blue-400 flex-shrink-0"}),e.jsx("span",{className:"text-xs font-semibold text-blue-400 uppercase tracking-wide",children:"Poll"}),e.jsx("span",{className:`ml-auto text-[11px] px-2 py-0.5 rounded-full font-medium ${de?"bg-gray-700 text-gray-400":"bg-green-900/50 text-green-400"}`,children:de?"Ended":`Ends in ${Math.ceil((ae-Date.now())/(1e3*60*60*24))}d`})]}),e.jsx("p",{className:"px-4 pb-3 text-sm font-semibold text-white",children:ne?.question??oe?.question}),pt&&Ct&&e.jsxs("p",{className:"px-4 pb-2 text-[11px] text-gray-400",children:[jt?"Change your vote — ":"","Select up to ",ue," option",ue>1?"s":"",B.length>0&&e.jsxs("span",{className:"ml-1 text-blue-400",children:["· ",B.length," selected"]})]}),e.jsx("div",{className:"px-4 pb-4 space-y-2",children:xe?[1,2,3].map(Ke=>e.jsx("div",{className:"h-9 bg-gray-700/50 rounded-lg animate-pulse"},Ke)):gt.map(Ke=>{const at=Ke.votes?.total_votes??0,_t=St>0?Math.round(at/St*100):0,Vt=Ge.includes(Ke.choice_num),kt=B.includes(Ke.choice_num),Ut=Ct&&B.length>=ue&&!kt,S=pt&&!Ut;let P="border-gray-700",I=e.jsx(O.Circle,{className:"w-3.5 h-3.5 text-gray-500 flex-shrink-0"}),X="bg-blue-600/20";return kt?(P="border-blue-500/60",I=e.jsx(O.CheckCircle2,{className:"w-3.5 h-3.5 text-blue-400 flex-shrink-0"})):Vt&&!jt?(P="border-green-600/60",I=e.jsx(O.CheckCircle2,{className:"w-3.5 h-3.5 text-green-500 flex-shrink-0"}),X="bg-green-600/20"):Vt&&jt&&(P="border-green-800/40",I=e.jsx(O.CheckCircle2,{className:"w-3.5 h-3.5 text-green-700 flex-shrink-0"}),X="bg-green-900/10"),e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${P} bg-gray-900/50 transition-colors ${S?"cursor-pointer hover:border-blue-500/40":Ut?"opacity-50 cursor-not-allowed":""}`,onClick:()=>Tt(Ke.choice_num),children:[_t>0&&e.jsx("div",{className:`absolute inset-y-0 left-0 ${X} transition-all duration-500`,style:{width:`${_t}%`}}),e.jsxs("div",{className:"relative flex items-center justify-between px-3 py-2.5 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[I,e.jsx("span",{className:`text-sm truncate ${kt?"text-blue-300 font-medium":Vt&&!jt?"text-green-300 font-medium":Vt&&jt?"text-green-700":"text-gray-200"}`,children:Ke.choice_text})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 text-[11px] text-gray-400",children:[e.jsxs("span",{children:[_t,"%"]}),e.jsx("span",{className:"text-gray-600",children:"·"}),e.jsxs("span",{children:[at," vote",at!==1?"s":""]})]})]})]},Ke.choice_num)})}),pt&&Ct&&e.jsx("div",{className:"px-4 pb-4",children:e.jsxs("button",{onClick:Bt,disabled:B.length===0||ee,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-700 disabled:text-gray-500 text-white text-sm rounded-lg transition-colors w-full justify-center font-medium",children:[e.jsx(O.Send,{className:"w-3.5 h-3.5"}),ee?"Submitting…":jt?"Change Vote":`Submit Vote${B.length>1?"s":""}`]})}),e.jsxs("div",{className:"px-4 pb-3 text-[11px] text-gray-500 border-t border-gray-700/50 pt-2 flex items-center gap-2",children:[e.jsxs("span",{children:[ne?.poll_stats?.total_voting_accounts_num??0," voter",(ne?.poll_stats?.total_voting_accounts_num??0)!==1?"s":""," total"]}),Se&&e.jsxs("span",{className:"text-green-500 ml-auto",children:["✓ Voted",Be?" · Vote changes allowed":""]})]})]})})(),oe?.tags&&oe.tags.length>0&&e.jsxs("div",{className:"border-t border-gray-700/50 pt-4 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-400 mb-2",children:[e.jsx(O.Tag,{className:"w-3.5 h-3.5"})," Tags"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:oe.tags.map((ue,Re)=>e.jsxs("span",{className:"px-2.5 py-0.5 bg-blue-900/50 text-blue-300 text-[11px] rounded-full",children:["#",ue]},Re))})]}),e.jsx("div",{className:"py-2.5 border-t border-gray-700/50",children:e.jsx(jn,{author:D.author,permlink:D.permlink,currentUser:s,hiveValue:Me,hiveIconUrl:j,payoutTooltip:Fe,initialVotes:D.active_votes||[],initialCommentsCount:D.children||0,onUpvote:n,onSubmitComment:a,onClickCommentUpvote:i,onReblog:o,onShare:c,onTip:d,onReport:f,ecencyToken:p,threeSpeakApiKey:b,giphyApiKey:w,templateToken:x,templateApiBaseUrl:g,disableCommentsModal:!0,onComments:()=>q.current?.scrollIntoView({behavior:"smooth"})})}),e.jsx("div",{ref:q,children:e.jsx(Og,{author:D.author,permlink:D.permlink,currentUser:s,onSubmitComment:a,onClickCommentUpvote:i,ecencyToken:p,threeSpeakApiKey:b,giphyApiKey:w,templateToken:x,templateApiBaseUrl:g,reportedAuthors:v,reportedPosts:N,hiveIconUrl:j,onShareComment:l,onTipComment:h,onReportComment:u})})]})})]})})}const to="_communityLocalKey",pn={getBookmarkedCommunities:()=>{const t=localStorage.getItem(to);return t?JSON.parse(t):[]},isUserPresentLocally:t=>{const r=localStorage.getItem(to);return r?JSON.parse(r).includes(t):!1},storeLikedCommunityLocally:(t,r=!1)=>{let s=pn.getBookmarkedCommunities();return s.includes(t)?s=s.filter(n=>n!==t):r||s.push(t),localStorage.setItem(to,JSON.stringify(s)),s}},Mo=({id:t,toastType:r,isLiked:s,onAdd:n,onRemove:a,onFavourite:i})=>{const[o,c]=k.useState(s??pn.isUserPresentLocally(t));k.useEffect(()=>{s!==void 0&&c(s)},[s]);const d=()=>{i&&i(),o?(a?a(t,"remove_bookmark"):pn.storeLikedCommunityLocally(t,!0),f(!1)):(n?n(t,"add_bookmark"):pn.storeLikedCommunityLocally(t),f(!0)),c(!o)},f=l=>{alert(`The ${r} is ${l?"added to":"removed from"} your bookmarks`)};return e.jsx("button",{onClick:d,className:"p-2 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:o?e.jsx(O.BookmarkCheck,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"}):e.jsx(O.Bookmark,{className:"w-5 h-5 text-gray-500 dark:text-gray-400"})})};class $g{HIVE_API_URL="https://api.hive.blog";async getListOfCommunities(r,s=20,n){const a={limit:s};n&&n.trim()!==""&&(a.last=n),r&&r.trim()!==""&&(a.query=r);const i={jsonrpc:"2.0",method:"bridge.list_communities",params:a,id:1};try{const o=await fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return(await o.json()).result||[]}catch(o){throw console.error("Error fetching communities:",o),o}}async getCommunityDetails(r){const s={jsonrpc:"2.0",method:"bridge.get_community",params:{name:r},id:1};try{const n=await fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return await n.json()}catch(n){throw console.error("Error fetching community details:",n),n}}async getCommunitySubscribers(r,s=100,n){const a={community:r,limit:s};n&&n.trim()!==""&&(a.last=n);const i={jsonrpc:"2.0",method:"bridge.list_community_roles",params:a,id:1};try{const o=await fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return((await o.json()).result||[]).map(d=>({username:d[0],role:d[1],extra:d[2],subscribedAt:d[3]}))}catch(o){throw console.error("Error fetching community subscribers:",o),o}}async getCommunitySubscribersList(r,s=100,n){const a={community:r,limit:s};n&&n.trim()!==""&&(a.last=n);const i={jsonrpc:"2.0",method:"bridge.list_subscribers",params:a,id:2};try{const o=await fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return((await o.json()).result||[]).map(d=>({username:d[0],role:d[1],extra:d[2],subscribedAt:d[3]}))}catch(o){throw console.error("Error fetching community subscribers list:",o),o}}async getCommunityAccounts(r){const s={jsonrpc:"2.0",method:"condenser_api.get_accounts",params:[[r]],id:2};try{const n=await fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return(await n.json()).result||[]}catch(n){throw console.error("Error fetching community accounts:",n),n}}async getRankedPosts(r,s="created",n=20,a,i){const o={tag:r,sort:s,limit:n};a&&i&&(o.start_author=a,o.start_permlink=i);const c={jsonrpc:"2.0",method:"bridge.get_ranked_posts",params:o,id:3};try{const d=await fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok)throw new Error(`HTTP error! status: ${d.status}`);return(await d.json()).result||[]}catch(d){throw console.error("Error fetching ranked posts:",d),d}}communityIcon(r){return`https://images.hive.blog/u/${r}/avatar?size=icon`}userOwnerThumb(r){return`https://images.hive.blog/u/${r}/avatar`}async getCommunityActivities(r,s=100,n){const a={account:r,limit:s};n&&(a.last_id=n);const i={jsonrpc:"2.0",method:"bridge.account_notifications",params:a,id:19};try{const o=await fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return(await o.json()).result||[]}catch(o){throw console.error("Error fetching community activities:",o),o}}}const pr=new $g,Ig=({onSelectCommunity:t,theme:r="dark"})=>{const[s,n]=k.useState([]),[a,i]=k.useState(""),[o,c]=k.useState(!0),[d,f]=k.useState(!1),[l,h]=k.useState(!0),[u,p]=k.useState(null),[b,w]=k.useState(null),x=20,g=k.useRef(null),v=k.useCallback(async(y=!1)=>{if(!(!y&&(d||!l)))try{y?(c(!0),w(null),n([]),p(null),h(!0)):f(!0);const m=a.trim(),_=await pr.getListOfCommunities(m.length>=3?m:void 0,x,y?void 0:u||void 0);n(E=>y?_:[...E,..._]),_.length<x||_.length>0&&_[_.length-1].name===u?h(!1):_.length>0&&p(_[_.length-1].name||null)}catch(m){w(m instanceof Error?m.message:"Failed to load communities"),h(!1)}finally{c(!1),f(!1)}},[a,d,l,u]);k.useEffect(()=>{const y=setTimeout(()=>{v(!0)},a.length>=3||a.length===0?0:500);return()=>clearTimeout(y)},[a]),k.useEffect(()=>{g.current?.focus()},[a,o,b]),k.useEffect(()=>{const y=()=>{window.innerHeight+document.documentElement.scrollTop>=document.documentElement.offsetHeight-200&&!d&&!o&&l&&v()};return window.addEventListener("scroll",y),()=>window.removeEventListener("scroll",y)},[v,d,o,l]);const N=()=>{v(!0)},j=()=>e.jsx("div",{className:"space-y-4",children:Array.from({length:6}).map((y,m)=>e.jsx("div",{className:`${r==="dark"?"bg-slate-900 border-gray-800":"bg-white border-gray-200"} border rounded-xl p-4 animate-pulse`,children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`w-12 h-12 ${r==="dark"?"bg-slate-800":"bg-gray-200"} rounded-full`}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:`h-4 ${r==="dark"?"bg-slate-800":"bg-gray-200"} rounded w-3/4`}),e.jsx("div",{className:`h-3 ${r==="dark"?"bg-slate-800":"bg-gray-200"} rounded w-1/2`})]}),e.jsx("div",{className:`h-3 ${r==="dark"?"bg-slate-800":"bg-gray-200"} rounded w-16`})]})},m))});return o&&s.length===0?e.jsxs("div",{className:`space-y-6 ${r==="dark"?"bg-slate-950":"bg-white"}`,children:[e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 ${r==="dark"?"text-gray-400":"text-gray-500"} w-5 h-5`}),e.jsx("input",{type:"text",placeholder:"Search communities...",value:a,onChange:y=>i(y.target.value),ref:g,autoFocus:!0,className:`w-full pl-10 pr-4 py-3 ${r==="dark"?"bg-slate-900 border-gray-800 text-white placeholder-gray-400":"bg-white border-gray-200 text-gray-900 placeholder-gray-500"}
1131
1131
  rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),e.jsx(j,{})]}):b&&s.length===0?e.jsxs("div",{className:`space-y-6 ${r==="dark"?"bg-slate-950":"bg-white"}`,children:[e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 ${r==="dark"?"text-gray-400":"text-gray-500"} w-5 h-5`}),e.jsx("input",{type:"text",placeholder:"Search communities...",value:a,onChange:y=>i(y.target.value),ref:g,autoFocus:!0,className:`w-full pl-10 pr-4 py-3 ${r==="dark"?"bg-slate-900 border-gray-800 text-white placeholder-gray-400":"bg-white border-gray-200 text-gray-900 placeholder-gray-500"}
1132
1132
  rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:`text-lg font-semibold ${r==="dark"?"text-white":"text-gray-900"} mb-2`,children:"Failed to load communities"}),e.jsx("p",{className:`${r==="dark"?"text-gray-400":"text-gray-500"} mb-4`,children:b}),e.jsxs("button",{onClick:N,className:`m-2 inline-flex items-center justify-center rounded-md border ${r==="dark"?"border-gray-800 bg-slate-900 text-gray-400 hover:bg-gray-800 hover:text-white":"border-gray-200 bg-white text-gray-500 hover:bg-gray-100 hover:text-gray-900"} p-2 text-sm font-medium shadow-sm transition-colors disabled:opacity-50 disabled:pointer-events-none`,children:[e.jsx(O.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})})]}):e.jsxs("div",{className:`space-y-6 ${r==="dark"?"bg-slate-950":"bg-white"}`,children:[e.jsx("div",{className:"",children:e.jsx("h2",{className:`text-xl font-semibold ${r==="dark"?"text-white":"text-gray-900"}`,children:"Communities"})}),e.jsxs("div",{className:"relative flex justify-between items-center",children:[e.jsx(O.Search,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 ${r==="dark"?"text-gray-400":"text-gray-500"} w-5 h-5`}),e.jsx("input",{type:"text",placeholder:"Search communities...",value:a,onChange:y=>i(y.target.value),ref:g,autoFocus:!0,className:`w-full pl-10 pr-4 py-3 ${r==="dark"?"bg-slate-900 border-gray-800 text-white placeholder-gray-400":"bg-white border-gray-200 text-gray-900 placeholder-gray-500"}
1133
1133
  rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500`}),e.jsx("button",{onClick:N,className:`m-2 inline-flex items-center justify-center rounded-md border ${r==="dark"?"border-gray-800 bg-slate-900 text-gray-400 hover:bg-gray-800 hover:text-white":"border-gray-200 bg-white text-gray-500 hover:bg-gray-100 hover:text-gray-900"} p-2 text-sm font-medium shadow-sm transition-colors disabled:opacity-50 disabled:pointer-events-none`,children:e.jsx(O.RefreshCw,{className:"w-4 h-4"})})]}),s.length===0?e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:`text-lg font-semibold ${r==="dark"?"text-white":"text-gray-900"} mb-2`,children:"No communities found"}),e.jsx("p",{className:`${r==="dark"?"text-gray-400":"text-gray-500"}`,children:a?"Try adjusting your search terms":"Check back later for new communities"})]})}):e.jsxs("div",{className:"space-y-4",children:[s.map(y=>e.jsx("div",{className:`${r==="dark"?"bg-slate-900 border-gray-800 hover:bg-slate-800":"bg-white border-gray-200 hover:bg-gray-100"} border rounded-xl p-4 transition-colors cursor-pointer`,onClick:()=>t(y.name||""),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("img",{src:pr.communityIcon(y.name||""),alt:y.title,className:"w-12 h-12 rounded-full object-cover",onError:m=>{m.target.src=`https://ui-avatars.com/api/?name=${y.title}&background=random`}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:`font-semibold truncate ${r==="dark"?"text-white":"text-gray-900"}`,children:y.title}),e.jsx("p",{className:`text-sm line-clamp-2 ${r==="dark"?"text-gray-400":"text-gray-500"}`,children:y.about})]}),e.jsx("div",{className:"text-right",children:e.jsxs("p",{className:`text-sm ${r==="dark"?"text-gray-400":"text-gray-500"}`,children:[(y.subscribers||0).toLocaleString()," members"]})})]})},y.id)),l&&e.jsx("div",{className:"flex justify-center pt-4",children:d?e.jsxs("div",{className:`flex items-center gap-2 ${r==="dark"?"text-gray-400":"text-gray-500"}`,children:[e.jsx(O.Loader2,{className:"w-4 h-4 animate-spin"}),"Loading more communities..."]}):e.jsx("button",{onClick:()=>v(),className:`m-2 inline-flex items-center justify-center rounded-md border ${r==="dark"?"border-gray-800 bg-slate-900 text-gray-400 hover:bg-gray-800 hover:text-white":"border-gray-200 bg-white text-gray-500 hover:bg-gray-100 hover:text-gray-900"} p-2 text-sm font-medium shadow-sm transition-colors disabled:opacity-50 disabled:pointer-events-none`,children:"Load More Communities"})})]})]})},m0=({communityId:t})=>{const[r,s]=k.useState(null),[n,a]=k.useState(!0),[i,o]=k.useState(null),c=async()=>{try{a(!0),o(null);const h=await pr.getCommunityDetails(t);s(h)}catch(h){o(h instanceof Error?h.message:"Failed to load community details")}finally{a(!1)}};k.useEffect(()=>{c()},[t]);const d=h=>{try{return new Date(h).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return h}},f=h=>h.replace(/<[^>]*>/g,"");if(n)return e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading community details..."]})});if(i)return e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load community details"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:i}),e.jsxs("button",{onClick:c,className:"m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4"}),"Try Again"]})]})});if(!r?.result)return e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No community details available"})});const l=r.result;return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[l.about&&e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-3",children:"About"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300 leading-relaxed",children:f(l.about)})]}),l.description&&e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-3",children:"Information"}),e.jsx("div",{className:"text-gray-600 dark:text-gray-300 leading-relaxed whitespace-pre-wrap",children:f(l.description)})]}),l.flag_text&&e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-3",children:"Community Rules"}),e.jsx("div",{className:"text-gray-600 dark:text-gray-300 leading-relaxed whitespace-pre-wrap",children:f(l.flag_text)})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Total Authors"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:l.num_authors?.toLocaleString()||"0"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Subscribers"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:l.subscribers?.toLocaleString()||"0"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Created"}),e.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l.created_at?d(l.created_at):"Unknown"})]}),l.lang&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Language"}),e.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l.lang.toUpperCase()})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Pending Posts"}),e.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l.num_pending?.toLocaleString()||"0"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Type"}),e.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l.is_nsfw?"NSFW":"Safe"})]})]})]})})},p0=({communityId:t,onSelectTeamMember:r})=>{const[s,n]=k.useState(null),[a,i]=k.useState(!0),[o,c]=k.useState(null),d=async()=>{try{i(!0),c(null);const l=await pr.getCommunityDetails(t);n(l)}catch(l){c(l instanceof Error?l.message:"Failed to load team details")}finally{i(!1)}};k.useEffect(()=>{d()},[t]);const f=s?.result?.team||[];return a?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading team members..."]})}):o?e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load team details"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:o}),e.jsxs("button",{onClick:d,className:"m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):f.length===0?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No team members found"})}):e.jsx("div",{className:"space-y-6",children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:f.map((l,h)=>{const u=l[0],p=l.length>1?l[1]:"";return e.jsx("div",{onClick:()=>r&&r(u),className:`bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
@@ -1136,8 +1136,8 @@ ${de}`),ge},clear:()=>{B(""),ue(null),se(0),ve(null),fe&&URL.revokeObjectURL(fe)
1136
1136
  rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700
1137
1137
  transition-colors cursor-pointer`,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:Ee.userAvatar(f.follower),alt:f.follower,className:"w-12 h-12 rounded-full object-cover",onError:h=>{h.target.src=`https://ui-avatars.com/api/?name=${f.follower}&background=random`}}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:["@",f.follower]})})]})},`${f.follower}-${l}`))})})},b0=({username:t,onSelectUser:r})=>{const[s,n]=k.useState([]),[a,i]=k.useState(!0),[o,c]=k.useState(null),d=async()=>{try{i(!0),c(null);const f=await Ee.getFollowing(t);n(f)}catch(f){c(f instanceof Error?f.message:"Failed to load following list")}finally{i(!1)}};return k.useEffect(()=>{d()},[t]),a?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading following list..."]})}):o?e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load following list"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:o}),e.jsxs("button",{onClick:d,className:"m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):s.length===0?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"This user is not following anyone."})}):e.jsx("div",{className:"space-y-6",children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:s.map((f,l)=>e.jsx("div",{onClick:()=>r&&r(f.following),className:`bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
1138
1138
  rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700
1139
- transition-colors cursor-pointer`,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:Ee.userAvatar(f.following),alt:f.following,className:"w-12 h-12 rounded-full object-cover",onError:h=>{h.target.src=`https://ui-avatars.com/api/?name=${f.following}&background=random`}}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:["@",f.following]})})]})},`${f.following}-${l}`))})})},y0=({username:t})=>{const[r,s]=k.useState(null),[n,a]=k.useState(!0),[i,o]=k.useState(null),c=async()=>{try{a(!0),o(null);const u=await Ee.getProfile(t);s(u)}catch(u){o(u instanceof Error?u.message:"Failed to load user details")}finally{a(!1)}};k.useEffect(()=>{c()},[t]);const d=u=>{try{return new Date(u).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return u}},f=u=>u.replace(/<[^>]*>/g,"");if(n)return e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading user details..."]})});if(i)return e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load user details"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:i}),e.jsxs("button",{onClick:c,className:"m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4"}),"Try Again"]})]})});if(!r?.result)return e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No user details available"})});const l=r.result,h=l.metadata?.profile;return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[h?.about&&e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-3",children:"About"}),e.jsx("div",{className:"text-gray-600 dark:text-gray-300 leading-relaxed whitespace-pre-wrap",children:f(h.about)})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Location"}),e.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:h?.location||"Not specified"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Website"}),e.jsx("a",{href:h?.website,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-blue-500 hover:underline",children:h?.website||"Not specified"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Joined"}),e.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l.created?d(l.created):"Unknown"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Followers"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:l.stats?.followers?.toLocaleString()||"0"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Following"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:l.stats?.following?.toLocaleString()||"0"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Post Count"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:l.post_count?.toLocaleString()||"0"})]})]})]})})},Hg=({username:t,onVideoClick:r,onAuthorClick:s,onBack:n,onClickUserInfoTab:a,onClickFollowersTab:i,onClickFollowingTab:o,onBookmarkToggle:c,onRss:d,onShare:f,onMoreMenu:l,showMoreMenu:h=!1})=>{const[u,p]=k.useState("videos"),[b,w]=k.useState(null),[x,g]=k.useState(!1),[v,N]=k.useState(!0);k.useEffect(()=>{(async()=>{try{N(!0);const C=await Ee.getProfile(t);w(C)}catch(C){console.error("Failed to fetch user details:",C)}finally{N(!1)}})()},[t]);const j=()=>{if(f)f(t);else{const A=`https://3speak.tv/user/${t}`;navigator.share?navigator.share({title:b?.result?.name||t,url:A}):navigator.clipboard.writeText(A)}},y=()=>{d?d(t):window.open(`https://3speak.tv/rss/${t}.xml`,"_blank")},m=A=>{s(A)};if(v)return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"h-8 bg-gray-200 dark:bg-gray-700 rounded w-32 mb-6"}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-200 dark:bg-gray-700 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-6 bg-gray-200 dark:bg-gray-700 rounded w-48"}),e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-32"})]})]}),e.jsx("div",{className:"flex gap-2",children:Array.from({length:4}).map((A,C)=>e.jsx("div",{className:"h-10 bg-gray-200 dark:bg-gray-700 rounded w-20"},C))})]})]})});const _=b?.result,E=_?.metadata?.profile;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("button",{onClick:n,className:"flex items-center justify-center mr-4 px-2 text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-full",children:[e.jsx(O.ArrowLeft,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs("div",{className:"relative bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl overflow-hidden",children:[e.jsx("img",{src:E.cover_image||Ee.userAvatar(t),alt:"Cover",className:"w-full h-48 object-cover",onError:A=>{A.target.src=Ee.userAvatar(t)}}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-6",children:[e.jsx("img",{src:E?.profile_image,alt:E?.name,className:"w-24 h-24 rounded-full object-cover border-4 border-white dark:border-gray-800 -mt-16",onError:A=>{A.target.src=Ee.userAvatar(t)}}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:E?.name||t}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:E?.about||"No description available"}),e.jsxs("div",{className:"flex flex-wrap gap-6 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Users,{className:"w-4 h-4"}),e.jsxs("span",{children:[(_?.stats?.followers||0).toLocaleString()," Followers"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Users,{className:"w-4 h-4"}),e.jsxs("span",{children:[(_?.stats?.following||0).toLocaleString()," Following"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Calendar,{className:"w-4 h-4"}),e.jsxs("span",{children:["Joined"," ",_?.created?new Date(_.created).getFullYear():"Unknown"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Mo,{id:t,toastType:"user",onAdd:(A,C)=>{c?c(A,!0):console.log("Added:",A,C)},onRemove:(A,C)=>{c?c(A,!1):console.log("Removed:",A,C)}}),e.jsx("button",{onClick:y,className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:e.jsx(O.Rss,{className:"w-4 h-4"})}),e.jsx("button",{onClick:j,className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:e.jsx(O.Share2,{className:"w-4 h-4"})}),h&&e.jsx("button",{onClick:()=>{l&&l(t)},className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:e.jsx(O.MoreVertical,{className:"w-4 h-4"})})]})]})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"grid grid-cols-4 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[{key:"videos",label:"Videos"},{key:"about",label:"User Info",callback:a},{key:"followers",label:"Followers",callback:i},{key:"following",label:"Following",callback:o}].map((A,C)=>e.jsx("button",{onClick:()=>{A.callback?A.callback():p(A.key)},className:`px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${u===A.key?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:A.label},A.key))}),e.jsxs("div",{className:"mt-6",children:[u==="videos"&&e.jsx(_n,{feedType:er.USER,username:t,onVideoClick:r,onAuthorClick:s}),u==="about"&&e.jsx(y0,{username:t}),u==="followers"&&e.jsx(x0,{username:t,onSelectUser:m}),u==="following"&&e.jsx(b0,{username:t,onSelectUser:m})]})]})]})},Wg=["Spam","Harassment or bullying","Hate speech","Violence or dangerous organizations","Intellectual property violation","Self-harm","Non-consensual intimate images","Doxxing","Minor safety","Other"],Kc=({isOpen:t,onClose:r,onReport:s,reportType:n,targetUsername:a,targetPermlink:i})=>{const[o,c]=k.useState("select"),[d,f]=k.useState(""),[l,h]=k.useState(!1),u=x=>{f(x),c("confirm")},p=async()=>{if(d){h(!0);try{await s(d),r(),c("select"),f("")}catch(x){console.error("Report failed:",x)}finally{h(!1)}}},b=()=>{r(),c("select"),f("")},w=()=>{c("select"),f("")};return t?e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[1000] p-4",onClick:b,children:e.jsxs("div",{className:"bg-gray-900 rounded-xl shadow-xl max-w-md w-full max-h-[80vh] flex flex-col border border-gray-700",onClick:x=>x.stopPropagation(),children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(O.Flag,{className:"h-5 w-5 text-red-500"}),e.jsxs("h3",{className:"text-lg font-semibold text-white",children:["Report ",n==="user"?"User":"Post"]})]}),e.jsx("button",{onClick:b,className:"p-1 hover:bg-gray-800 rounded transition-colors",children:e.jsx(O.X,{className:"h-5 w-5 text-gray-400"})})]}),e.jsxs("p",{className:"text-sm text-gray-400 mt-1",children:["@",a]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[o==="select"&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-gray-400 mb-4",children:["Why are you reporting this ",n,"?"]}),e.jsx("div",{className:"space-y-2",children:Wg.map(x=>e.jsx("button",{onClick:()=>u(x),className:"w-full text-left px-4 py-3 border border-gray-700 rounded-lg text-gray-300 hover:bg-gray-800 hover:border-gray-600 transition-colors",children:x},x))})]}),o==="confirm"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start space-x-3 mb-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(O.AlertTriangle,{className:"h-6 w-6 text-red-500"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-sm font-medium text-white mb-2",children:"Report Summary"}),e.jsxs("div",{className:"space-y-2 text-sm text-gray-400",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Type:"})," ",n==="user"?"User":"Post"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Target:"})," @",a]}),n==="post"&&i&&e.jsxs("p",{children:[e.jsx("strong",{children:"Post:"})," ",i]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Reason:"})," ",d]})]})]})]}),e.jsx("div",{className:"bg-yellow-900/20 border border-yellow-800 rounded-lg p-3",children:e.jsx("p",{className:"text-xs text-yellow-200",children:"Reports are reviewed by our moderation team. False reports may result in action against your account."})})]})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-gray-700 flex items-center justify-end space-x-3",children:[o==="select"&&e.jsx("button",{onClick:b,className:"px-4 py-2 border border-gray-600 text-gray-300 rounded-lg hover:bg-gray-800 transition-colors",children:"Cancel"}),o==="confirm"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:w,className:"px-4 py-2 border border-gray-600 text-gray-300 rounded-lg hover:bg-gray-800 transition-colors",children:"Back"}),e.jsx("button",{onClick:p,disabled:l,className:"px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:l?"Reporting...":"Submit Report"})]})]})]})}):null},dn=t=>{const r=new Date,s=new Date(t),n=Math.floor((r.getTime()-s.getTime())/1e3);return n<60?"just now":n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:n<2592e3?`${Math.floor(n/86400)}d ago`:s.toLocaleDateString()},Gg=t=>{if(t===0)return"25";const r=t<0;let s=r?-t:t,n=Math.log10(s);return n=Math.max(n-9,0),n=(r?-1:1)*n,n=n*9+25,Math.round(n).toString()},Jg=t=>{try{return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return t}},Qc=t=>{let r=t;return r=r.replace(/<[^>]*>/g,""),r=r.replace(/!\[.*?\]\([^\s)]+\)/g,""),r=r.replace(/\[([^\]]*)\]\([^\s)]+\)/g,"$1"),r=r.replace(/https?:\/\/[^\s)>\]]+/g,""),r=r.replace(/\[.*?\]/g,""),r=r.replace(/\(https?:\/\/[^\s)]*\)/g,""),r=r.replace(/[*_~`#>|]/g,""),r=r.replace(/^[-_*]{3,}\s*$/gm,""),r=r.replace(/\s+/g," ").trim(),r},Yg=({username:t,currentUsername:r,onBack:s,showBackButton:n=!1,tabShown:a,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f,reportedPosts:l=[],reportedAuthors:h=[],onFollow:u,onUnfollow:p,onIgnoreAuthor:b,onReportUser:w,onUpvote:x,onSubmitComment:g,onClickCommentUpvote:v,onReblog:N,onTip:j,onReportPost:y,onUserClick:m,onPostClick:_,onSnapClick:E,onPollClick:A,onActivityPermlink:C,onActivitySelect:T,onShare:D,onSharePost:L,onCommentClick:H,onFavouriteList:V,onAddToFavourite:z,isFavourited:F=!1,favouriteCount:Y=0})=>{const[G,ne]=k.useState(null),[ie,xe]=k.useState(!0),[U,q]=k.useState(null),[B,pe]=k.useState("blogs"),[ee,te]=k.useState([]),[_e,Ie]=k.useState([]),[K,le]=k.useState([]),[oe,Ne]=k.useState([]),[Ce,Me]=k.useState([]),[Fe,ue]=k.useState(null),[Re,se]=k.useState([]),[de,ve]=k.useState([]),[fe,ke]=k.useState({totalHbd:0,totalHpEq:0}),[Se,Be]=k.useState([]),[Ge,pt]=k.useState({totalHp:0,totalHbd:0}),[jt,gt]=k.useState(!1),[St,Ct]=k.useState([]),[Tt,Bt]=k.useState([]),[Ke,at]=k.useState([]),[_t,Vt]=k.useState([]),[kt,Ut]=k.useState(null),[S,P]=k.useState(100),[I,X]=k.useState(!1),[be,Oe]=k.useState(!1),[Xe,Ve]=k.useState({blogs:!0,posts:!0,snaps:!0,polls:!1,comments:!0,replies:!0,activities:!1,authorRewards:!1,curationRewards:!1,followers:!0,following:!0,wallet:!1,votingPower:!1,badges:!1,witnessVotes:!1}),ze=20,bt=100,Dt=k.useRef(null),[Mt,$t]=k.useState(!1),[Yt,Et]=k.useState(!1),[ft,ge]=k.useState(!1),[Te,Pe]=k.useState(!1),[He,Ue]=k.useState(null),xt=k.useRef(null),Je=k.useRef(null),[cr,Or]=k.useState(!1),[rr,Lr]=k.useState(!1),zt=k.useCallback(()=>{const $=Je.current;$&&(Or($.scrollLeft>0),Lr($.scrollLeft+$.clientWidth<$.scrollWidth-1))},[]);k.useEffect(()=>{const $=Je.current;if(!$)return;zt(),$.addEventListener("scroll",zt);const re=new ResizeObserver(zt);return re.observe($),()=>{$.removeEventListener("scroll",zt),re.disconnect()}},[zt]);const Mr=k.useCallback($=>{const re=Je.current;re&&re.scrollBy({left:$==="left"?-150:150,behavior:"smooth"})},[]);Lo();const $e=t.replace(/^@/,"").trim(),ar=k.useMemo(()=>new Set(l.map($=>`${$.author}/${$.permlink}`)),[l]),kr=k.useMemo(()=>new Set(h),[h]),ut=k.useCallback($=>$.filter(re=>!kr.has(re.author)&&!ar.has(`${re.author}/${re.permlink}`)),[ar,kr]);k.useEffect(()=>{const $=re=>{xt.current&&!xt.current.contains(re.target)&&Et(!1)};return document.addEventListener("click",$),()=>document.removeEventListener("click",$)},[]),k.useEffect(()=>{(async()=>{if($e){xe(!0),q(null);try{const[re,he,ae]=await Promise.all([Ee.getProfile($e),Ee.getAccounts([$e]),Ee.getDynamicGlobalProperties()]),ye=re?.result,De=he?.[0];if(!ye){q("User not found");return}let lt;if(ae&&De?.vesting_shares){const Lt=parseFloat(De.vesting_shares.split(" ")[0]),dt=parseFloat(ae.total_vesting_shares.split(" ")[0]),or=parseFloat(ae.total_vesting_fund_hive.split(" ")[0]);lt=Lt/dt*or}let Ze;De?.voting_power&&(Ze=De.voting_power/1e4*100);let Qe=!1;if(r&&r!==$e)try{Qe=(await Ee.getFollowing(r)).some(dt=>dt.following===$e)}catch{}let ct=null;if(De?.posting_json_metadata)try{ct=JSON.parse(De.posting_json_metadata)?.profile}catch{}let et=null;if(De?.json_metadata)try{et=JSON.parse(De.json_metadata)?.profile}catch{}const Pt=ye.metadata?.profile,Zt={username:ye.name,name:ct?.name||et?.name||Pt?.name,about:ct?.about||et?.about||Pt?.about,location:ct?.location||et?.location||Pt?.location,website:ct?.website||et?.website||Pt?.website,profileImage:ct?.profile_image||et?.profile_image||Pt?.profile_image,coverImage:ct?.cover_image||et?.cover_image||Pt?.cover_image,followersCount:ye.stats?.followers||0,followingCount:ye.stats?.following||0,postsCount:ye.post_count||0,reputation:ye.reputation||0,isFollowing:Qe,created:ye.created,lastActivity:De?.last_post,hivePower:lt,votingPower:Ze};ne(Zt)}catch(re){console.error("Error fetching user profile:",re),q("Failed to load user profile")}finally{xe(!1)}}})()},[$e,r]),k.useEffect(()=>{te([]),Ie([]),Me([]),ue(null),se([]),ve([]),ke({totalHbd:0,totalHpEq:0}),Be([]),pt({totalHp:0,totalHbd:0}),le([]),Ne([]),Ct([]),Bt([]);const $=a&&a.length>0?a[0]:"blogs";pe($),Ve({blogs:!0,posts:!0,snaps:!0,polls:!1,comments:!0,replies:!0,activities:!1,authorRewards:!1,curationRewards:!1,followers:!0,following:!0,wallet:!1,votingPower:!1,badges:!1,witnessVotes:!1}),at([]),Vt([]),Ut(null),P(100)},[$e]),k.useEffect(()=>{const $=new AbortController,{signal:re}=$;return(async()=>{if($e){X(!0),gt(!1),B==="authorRewards"&&(ve([]),ke({totalHbd:0,totalHpEq:0})),B==="curationRewards"&&(Be([]),pt({totalHp:0,totalHbd:0}));try{switch(B){case"blogs":{const ae=ut(await Ee.getUserBlogs($e,ze,void 0,void 0,re));te(ae),Ve(ye=>({...ye,blogs:ae.length>=ze}));break}case"posts":{const ae=ut(await Ee.getUserPosts($e,ze,void 0,void 0,re));Ie(ae),Ve(ye=>({...ye,posts:ae.length>=ze}));break}case"snaps":{const{snaps:ae,nextStartId:ye}=await Ee.getUserSnaps($e,void 0,r,re);Me(ut(ae)),ue(ye),Ve(De=>({...De,snaps:ye!==null}));break}case"polls":{const ae=ut(await Ee.getUserPolls($e,re));se(ae),Ve(ye=>({...ye,polls:!1}));break}case"comments":{const ae=ut(await Ee.getUserComments($e,ze,void 0,void 0,re));le(ae),Ve(ye=>({...ye,comments:ae.length>=ze}));break}case"replies":{const ae=ut(await Ee.getUserReplies($e,ze,void 0,void 0,re));Ne(ae),Ve(ye=>({...ye,replies:ae.length>=ze}));break}case"followers":{const ae=await Ee.getFollowers($e,null,bt,re);Ct(ae),Ve(ye=>({...ye,followers:ae.length>=bt}));break}case"following":{const ae=await Ee.getFollowing($e,null,bt,re);Bt(ae),Ve(ye=>({...ye,following:ae.length>=bt}));break}case"authorRewards":{gt(!0);const ae=await Ee.getPendingAuthorRewards($e,(ye,De,lt)=>{re.aborted||(ve([...ye]),ke({totalHbd:De,totalHpEq:lt}),X(!1))},re);ve(ae.rows),ke({totalHbd:ae.totalHbd,totalHpEq:ae.totalHpEq}),gt(!1);break}case"curationRewards":{gt(!0);const ae=await Ee.getPendingCurationRewards($e,(ye,De,lt)=>{re.aborted||(Be([...ye]),pt({totalHp:De,totalHbd:lt}),X(!1))},re);Be(ae.rows),pt({totalHp:ae.totalHp,totalHbd:ae.totalHbd}),gt(!1);break}case"votingPower":{const[ae,,ye]=await Promise.all([Ee.getAccounts([$e],re),Ee.getDynamicGlobalProperties(re),Ee.getFeedHistory(re)]),De=ae?.[0];if(De){const Ze=M=>parseFloat(String(M).split(" ")[0])||0,ct=(Ze(De.vesting_shares)+Ze(De.received_vesting_shares)-Ze(De.delegated_vesting_shares))*1e6,et=Math.floor(Date.now()/1e3)-De.voting_manabar.last_update_time;let Pt=parseFloat(String(De.voting_manabar.current_mana))+et*ct/432e3;Pt>ct&&(Pt=ct);const Zt=ct>0?Pt/ct*100:0,Lt=ct/4,dt=Math.floor(Date.now()/1e3)-De.downvote_manabar.last_update_time;let or=parseFloat(String(De.downvote_manabar.current_mana))+dt*Lt/432e3;or>Lt&&(or=Lt);const Yr=Lt>0?or/Lt*100:0;let ra=0;try{const me=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:"rc_api.find_rc_accounts",params:{accounts:[$e]},id:1}),signal:re})).json())?.result?.rc_accounts?.[0];if(me){const qe=parseFloat(me.rc_manabar.current_mana),nt=parseFloat(me.max_rc);nt>0&&(ra=qe/nt*100)}}catch{}let R=0,J=0,Z=0;try{const me=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:"condenser_api.get_reward_fund",params:["post"],id:1}),signal:re})).json())?.result;me&&(R=Ze(me.reward_balance),J=parseFloat(me.recent_claims)||0)}catch{}if(ye?.current_median_history){const M=Ze(ye.current_median_history.base),ce=Ze(ye.current_median_history.quote)||1;Z=M/ce}Ut({upvotePower:Math.min(Zt,100),downvotePower:Math.min(Yr,100),resourceCredits:Math.min(ra,100),maxMana:ct,rewardBalance:R,recentClaims:J,feedPrice:Z})}break}case"badges":{let ae=[],ye=null,De=!0;for(;De;){const Ze=await Ee.getFollowers($e,ye,1e3,re);ae=[...ae,...Ze],Ze.length<1e3?De=!1:ye=Ze[Ze.length-1].follower}const lt=ae.map(Ze=>Ze.follower).filter(Ze=>Ze.startsWith("badge-"));at(lt);break}case"witnessVotes":{const ye=(await Ee.getAccounts([$e],re))?.[0];ye?.witness_votes&&Vt(ye.witness_votes);break}}}catch(ae){if(ae?.name==="AbortError")return;console.error(`Error fetching ${B}:`,ae)}finally{re.aborted||X(!1)}}})(),()=>{$.abort()}},[$e,B]);const W=k.useMemo(()=>ut(ee),[ee,ut]),Q=k.useMemo(()=>ut(_e),[_e,ut]),we=k.useMemo(()=>ut(Ce),[Ce,ut]),Ae=k.useMemo(()=>ut(K),[K,ut]),ht=k.useMemo(()=>ut(oe),[oe,ut]),Ye=k.useMemo(()=>ut(Re),[Re,ut]),yt=k.useCallback(async()=>{if(!(be||!Xe[B]||!$e)){Oe(!0);try{switch(B){case"blogs":{const $=ee[ee.length-1];if(!$)break;const re=await Ee.getUserBlogs($e,ze,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);te(ae=>[...ae,...he]),Ve(ae=>({...ae,blogs:he.length>=ze-1}));break}case"posts":{const $=_e[_e.length-1];if(!$)break;const re=await Ee.getUserPosts($e,ze,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);Ie(ae=>[...ae,...he]),Ve(ae=>({...ae,posts:he.length>=ze-1}));break}case"snaps":{if(!Fe)break;const{snaps:$,nextStartId:re}=await Ee.getUserSnaps($e,Fe,r);Me(he=>[...he,...ut($)]),ue(re),Ve(he=>({...he,snaps:re!==null}));break}case"comments":{const $=K[K.length-1];if(!$)break;const re=await Ee.getUserComments($e,ze,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);le(ae=>[...ae,...he]),Ve(ae=>({...ae,comments:he.length>=ze-1}));break}case"replies":{const $=oe[oe.length-1];if(!$)break;const re=await Ee.getUserReplies($e,ze,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);Ne(ae=>[...ae,...he]),Ve(ae=>({...ae,replies:he.length>=ze-1}));break}case"followers":{const $=St[St.length-1];if(!$)break;const re=await Ee.getFollowers($e,$.follower,bt),he=re.length>0&&re[0].follower===$.follower?re.slice(1):re;Ct(ae=>[...ae,...he]),Ve(ae=>({...ae,followers:he.length>=bt-1}));break}case"following":{const $=Tt[Tt.length-1];if(!$)break;const re=await Ee.getFollowing($e,$.following,bt),he=re.length>0&&re[0].following===$.following?re.slice(1):re;Bt(ae=>[...ae,...he]),Ve(ae=>({...ae,following:he.length>=bt-1}));break}}}catch($){console.error(`Error loading more ${B}:`,$)}finally{Oe(!1)}}},[B,$e,r,be,Xe,ee,_e,Ce,Fe,K,oe,St,Tt]);k.useEffect(()=>{const $=Dt.current;if(!$)return;const re=new IntersectionObserver(he=>{he[0].isIntersecting&&yt()},{rootMargin:"200px"});return re.observe($),()=>re.disconnect()},[yt]);const Ot=k.useCallback(async()=>{if(G){$t(!0),Et(!1);try{const $=G.isFollowing;$&&p?await p($e):!$&&u&&await u($e),ne(re=>re&&{...re,isFollowing:!$,followersCount:$?Math.max(0,re.followersCount-1):re.followersCount+1}),setTimeout(async()=>{try{const re=await Ee.getProfile($e);re?.result?.stats&&ne(he=>he&&{...he,followersCount:re.result.stats.followers??he.followersCount,followingCount:re.result.stats.following??he.followingCount})}catch{}},3e3)}catch($){console.error("Follow/Unfollow error:",$)}finally{$t(!1)}}},[G,$e,u,p]),Gt=k.useCallback(async()=>{$t(!0);try{b&&await b($e),ge(!1),Et(!1)}catch($){console.error("Error ignoring user:",$)}finally{$t(!1)}},[$e,b]),At=k.useCallback(async $=>{$t(!0);try{w&&await w($e,$),Pe(!1),Et(!1)}catch(re){console.error("Error reporting user:",re)}finally{$t(!1)}},[$e,w]),mt=k.useCallback(()=>{D?.($e)},[$e,D]),Rt=k.useCallback(async()=>{V&&await V()},[V]),qt=k.useCallback(async()=>{z&&await z($e)},[$e,z]);if(ie)return e.jsxs("div",{className:"dark h-full overflow-y-auto animate-pulse bg-gray-900",children:[e.jsxs("div",{className:"sticky top-0 z-30 bg-gray-900 border-b border-gray-700 px-4 py-3 flex items-center gap-3",children:[n&&e.jsx("div",{className:"w-8 h-8 bg-gray-700 rounded-full"}),e.jsx("div",{className:"w-9 h-9 bg-gray-700 rounded-full"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-28 mb-1.5"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-36"})]}),e.jsx("div",{className:"w-8 h-8 bg-gray-700 rounded-full"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"h-36 sm:h-44 bg-gray-800 w-full"}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-4",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-48 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-64 mb-3"}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-24"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-28"})]})]})]}),e.jsx("div",{className:"border-b border-gray-700 px-2 py-2 flex gap-1 overflow-x-auto",children:[80,64,72,96,80,64,72].map(($,re)=>e.jsx("div",{className:"h-8 bg-gray-800 rounded-lg flex-shrink-0",style:{width:$}},re))}),e.jsx("div",{className:"p-4 space-y-3",children:[1,2,3,4].map($=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24 mb-2"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-4/5 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-full mb-1.5"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-3/5 mb-3"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},$))})]});if(U||!G)return e.jsx("div",{className:"dark flex items-center justify-center min-h-[400px] bg-gray-900",children:e.jsxs("div",{className:"text-center",children:[e.jsx(O.User,{className:"h-14 w-14 text-gray-500 mx-auto mb-3"}),e.jsx("h3",{className:"text-lg font-medium text-white mb-1",children:"User Not Found"}),e.jsx("p",{className:"text-gray-400",children:U||"This user does not exist"}),n&&s&&e.jsxs("button",{onClick:s,className:"mt-4 inline-flex items-center px-4 py-2 text-sm font-medium rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700",children:[e.jsx(O.ArrowLeft,{className:"h-4 w-4 mr-2"}),"Go Back"]})]})});const It=({images:$})=>{const[re,he]=k.useState(0),[ae,ye]=k.useState(!1);return $.length===0?null:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative w-16 flex-shrink-0 mt-1.5",children:[e.jsx("button",{onClick:De=>{De.stopPropagation(),ye(!0)},className:"block w-16 h-16 rounded-lg overflow-hidden border border-gray-600 hover:border-blue-500 transition-colors cursor-pointer",children:e.jsx("img",{src:$[re],alt:"",className:"w-full h-full object-cover bg-gray-700",onError:De=>{De.target.style.display="none"}})}),$.length>1&&e.jsxs("div",{className:"flex items-center justify-between mt-1",children:[e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt-1+$.length)%$.length)},className:"p-0.5 text-gray-400 hover:text-white transition-colors",title:"Previous",children:e.jsx(O.ChevronLeft,{className:"h-3.5 w-3.5"})}),e.jsxs("span",{className:"text-[10px] text-gray-500",children:[re+1,"/",$.length]}),e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt+1)%$.length)},className:"p-0.5 text-gray-400 hover:text-white transition-colors",title:"Next",children:e.jsx(O.ChevronRight,{className:"h-3.5 w-3.5"})})]})]}),ae&&e.jsx("div",{className:"fixed inset-0 z-[2000] bg-black/80 flex items-center justify-center p-4",onClick:()=>ye(!1),children:e.jsxs("div",{className:"relative max-w-3xl max-h-[85vh] w-full flex items-center justify-center",onClick:De=>De.stopPropagation(),children:[e.jsx("img",{src:$[re],alt:"",className:"max-w-full max-h-[80vh] rounded-lg object-contain"}),e.jsx("button",{onClick:()=>ye(!1),className:"absolute top-2 right-2 text-white/70 hover:text-white bg-black/50 rounded-full p-1.5 transition-colors",title:"Close",children:e.jsx("span",{className:"text-lg leading-none",children:"×"})}),$.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt-1+$.length)%$.length)},className:"absolute left-2 top-1/2 -translate-y-1/2 bg-black/50 hover:bg-black/70 text-white rounded-full p-2 transition-colors",children:e.jsx(O.ChevronLeft,{className:"h-5 w-5"})}),e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt+1)%$.length)},className:"absolute right-2 top-1/2 -translate-y-1/2 bg-black/50 hover:bg-black/70 text-white rounded-full p-2 transition-colors",children:e.jsx(O.ChevronRight,{className:"h-5 w-5"})}),e.jsxs("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 bg-black/50 text-white text-xs px-3 py-1 rounded-full",children:[re+1," / ",$.length]})]})]})})]})},sr=($,re,he)=>{const ae=$.json_metadata?.image?.length?$.json_metadata.image:[],ye=$.json_metadata?.description||($.body?Qc($.body):""),De=$.payout?$.payout.toFixed(3):$.pending_payout_value?$.pending_payout_value.replace(/[^\d.]/g,""):"0.000",lt=De,Ze=[],Qe=$.percent_hbd??1e4;if(Qe===0?Ze.push("Hive Rewards Payout 100% Powered Up"):Ze.push(`Hive Rewards Payout (${(Qe/200).toFixed(0)}%/${100-Qe/200}%)`),$.is_paidout){const et=$.author_payout_value?$.author_payout_value.replace(/[^\d.]/g,""):"";Ze.push("Past payouts:"),Ze.push(`${De} Hive Rewards${et?` (Author ${et})`:""}`)}else{if($.payout_at){const et=new Date($.payout_at),Pt=new Date,Zt=et.getTime()-Pt.getTime();if(Zt>0){const Lt=Math.floor(Zt/36e5),dt=Math.floor(Lt/24),or=Lt%24,Yr=dt>0?`in ${dt} day${dt>1?"s":""}${or>0?` ${or} hour${or>1?"s":""}`:""}`:`in ${Lt} hour${Lt>1?"s":""}`;Ze.push(`Payout will occur: ${Yr}`)}}Qe===0?Ze.push(`${De} Hive Rewards (100% Powered Up)`):Ze.push(`${De} Hive Rewards (${(Qe/200).toFixed(0)}%/${100-Qe/200}%)`)}$.beneficiaries?.length>0&&(Ze.push("Beneficiaries:"),$.beneficiaries.forEach(et=>{Ze.push(`${et.account}: ${(et.weight/100).toFixed(0)}%`)}));const ct=Ze.join(`
1140
- `);return e.jsxs("div",{className:`border border-gray-700 rounded-lg p-4 bg-gray-800 hover:bg-gray-700 transition-colors ${he?"cursor-pointer":""}`,onClick:he,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center gap-1.5 flex-shrink-0 w-16",children:[e.jsx("img",{src:`https://images.hive.blog/u/${$.author}/avatar`,alt:$.author,className:"w-10 h-10 rounded-full bg-gray-700 flex-shrink-0",onError:et=>{et.target.src=`https://ui-avatars.com/api/?name=${$.author}&background=random&size=40`}}),e.jsx(It,{images:ae})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("button",{onClick:et=>{et.stopPropagation(),m?.($.author)},className:"font-medium text-white hover:text-blue-400 text-sm",children:["@",$.author]}),e.jsx("span",{className:"text-xs text-gray-500",children:dn($.created)})]}),$.title&&e.jsx("button",{onClick:()=>_?.($.author,$.permlink,$.title),className:"text-left text-base font-semibold text-white mb-1 line-clamp-2 hover:text-blue-400",children:$.title}),ye&&e.jsx("p",{className:"text-gray-400 text-sm line-clamp-2",children:ye.substring(0,200)}),$.community_title&&e.jsxs("span",{className:"inline-block mt-1 text-xs text-blue-400 font-medium",children:["#",$.community_title]})]})]}),e.jsx("div",{className:"mt-3 pt-2 border-t border-gray-700/50",onClick:et=>et.stopPropagation(),children:e.jsx(jn,{author:$.author,permlink:$.permlink,currentUser:r,hiveValue:lt,hiveIconUrl:"/images/hive_logo.png",payoutTooltip:ct,initialVotes:$.active_votes||[],initialCommentsCount:$.children||0,onUpvote:x?et=>x($.author,$.permlink,et):void 0,onSubmitComment:g?(et,Pt,Zt)=>g(et,Pt,Zt):void 0,onClickCommentUpvote:v,onReblog:$.author!==r&&N?()=>N($.author,$.permlink):void 0,onShare:L?()=>L($.author,$.permlink):void 0,onTip:$.author!==r&&j?()=>j($.author,$.permlink):void 0,onReport:$.author!==r&&y?()=>Ue({author:$.author,permlink:$.permlink}):void 0,disableCommentsModal:!!H,onComments:H?()=>H($.author,$.permlink):void 0,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f})})]},`${$.author}/${$.permlink}`)},xr=$=>{const re=$.poll_stats?.total_voting_accounts_num||0,he=$.status==="Active",De=new Date($.end_time)<new Date,lt=$.post_body?Qc($.post_body):"",Ze=$.poll_choices?.length||0;return e.jsxs("div",{className:"border border-gray-700 rounded-lg bg-gray-800 hover:bg-gray-700/50 transition-colors cursor-pointer",onClick:()=>A?.($.author,$.permlink,$.question),children:[e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:`https://images.hive.blog/u/${$.author}/avatar`,alt:$.author,className:"w-8 h-8 rounded-full bg-gray-700",onError:Qe=>{Qe.target.src=`https://ui-avatars.com/api/?name=${$.author}&background=random&size=32`}}),e.jsxs("div",{children:[e.jsxs("button",{onClick:Qe=>{Qe.stopPropagation(),m?.($.author)},className:"text-sm font-medium text-white hover:text-blue-400",children:["@",$.author]}),e.jsx("p",{className:"text-[10px] text-gray-500",children:dn($.created)})]})]}),e.jsx("span",{className:`text-[10px] font-semibold px-2 py-0.5 rounded-full ${he&&!De?"bg-green-500/20 text-green-400":"bg-gray-600/30 text-gray-400"}`,children:he&&!De?"Active":"Ended"})]}),e.jsx("h3",{className:"text-sm font-semibold text-white mb-1",children:$.question}),lt&&e.jsx("p",{className:"text-gray-400 text-xs line-clamp-2 mb-2",children:lt.substring(0,150)}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-500",children:[e.jsxs("span",{children:[re," voter",re!==1?"s":""]}),e.jsxs("span",{children:[Ze," option",Ze!==1?"s":""]}),$.poll_stats?.total_hive_hp!=null&&$.poll_stats.total_hive_hp>0&&e.jsxs("span",{children:[($.poll_stats.total_hive_hp/1e3).toFixed(1),"k HP"]}),$.end_time&&e.jsx("span",{children:he&&!De?`Ends ${dn($.end_time)}`:"Ended"})]})]}),e.jsx("div",{className:"px-4 pb-3 pt-1 border-t border-gray-700/50",onClick:Qe=>Qe.stopPropagation(),children:e.jsx(jn,{author:$.author,permlink:$.permlink,currentUser:r,hiveIconUrl:"/images/hive_logo.png",initialVotes:[],initialCommentsCount:0,onUpvote:x?Qe=>x($.author,$.permlink,Qe):void 0,onSubmitComment:g?(Qe,ct,et)=>g(Qe,ct,et):void 0,onClickCommentUpvote:v,onReblog:$.author!==r&&N?()=>N($.author,$.permlink):void 0,onShare:L?()=>L($.author,$.permlink):void 0,onTip:$.author!==r&&j?()=>j($.author,$.permlink):void 0,onReport:$.author!==r&&y?()=>Ue({author:$.author,permlink:$.permlink}):void 0,disableCommentsModal:!!H,onComments:H?()=>H($.author,$.permlink):void 0,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f})})]},`${$.author}/${$.permlink}`)},br=($,re)=>e.jsx("div",{className:"border border-gray-700 rounded-lg p-4 bg-gray-800 hover:bg-gray-700 transition-colors",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:`https://images.hive.blog/u/${$}/avatar`,alt:$,className:"w-10 h-10 rounded-full flex-shrink-0 bg-gray-700",onError:he=>{he.target.src=`https://ui-avatars.com/api/?name=${$}&background=random&size=40`}}),e.jsxs("button",{onClick:()=>m?.($),className:"font-medium text-white hover:text-blue-400",children:["@",$]})]})},`${$}-${re}`),lr=($=5)=>e.jsx("div",{className:"space-y-3 animate-pulse",children:Array.from({length:$},(re,he)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-4/5 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-full mb-1.5"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-3/5 mb-3"}),he%2===0&&e.jsx("div",{className:"h-32 bg-gray-700 rounded-lg w-20 mb-3"}),e.jsxs("div",{className:"flex gap-4 mt-2",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},he))}),ur=($=8)=>e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3 animate-pulse",children:Array.from({length:$},(re,he)=>e.jsx("div",{className:"border border-gray-700 rounded-lg p-4 bg-gray-800",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-28"})]})},he))}),nr=($=3)=>e.jsx("div",{className:"space-y-3 animate-pulse",children:Array.from({length:$},(re,he)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded-full w-14"})]}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-4/5 mb-3"}),e.jsxs("div",{className:"space-y-2 mb-3",children:[e.jsx("div",{className:"h-8 bg-gray-700 rounded-lg w-full"}),e.jsx("div",{className:"h-8 bg-gray-700 rounded-lg w-full"}),e.jsx("div",{className:"h-8 bg-gray-700 rounded-lg w-3/4"})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-24"})]})]})]})},he))}),yr=()=>e.jsxs("div",{className:"space-y-3 animate-pulse",children:[e.jsxs("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-5 h-5 bg-gray-700 rounded"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-44"})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[1,2,3,4].map($=>e.jsxs("div",{className:"bg-gray-900/50 rounded-lg p-2.5",children:[e.jsx("div",{className:"h-2.5 bg-gray-700 rounded w-12 mb-2"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded w-16"})]},$))})]}),[1,2,3,4,5].map($=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-7 h-7 bg-gray-700 rounded-lg"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-1/3 mb-3"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},$))]}),Ir=()=>{switch(B){case"blogs":case"posts":case"snaps":case"comments":case"replies":return lr();case"followers":case"following":case"badges":case"witnessVotes":return ur();case"polls":return nr();case"authorRewards":case"curationRewards":return yr();default:return lr()}},st=$=>{if(!$||!isFinite($)||$<=0)return"—";const re=Math.floor($/1e3),he=Math.floor(re/60),ae=Math.floor(he/60),ye=Math.floor(ae/24);return ye>=1?`${ye}d ${ae%24}h`:ae>=1?`${ae}h ${he%60}m`:`${Math.max(1,he)}m`},We=($,re=3)=>$==null||isNaN($)?"—":Number($).toLocaleString(void 0,{maximumFractionDigits:re,minimumFractionDigits:re}),Xt=()=>{if(I&&de.length===0)return yr();if(de.length===0&&!jt)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Award,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No pending author rewards"}),e.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"Rewards appear for posts/comments with pending payouts"})]});const $=de.filter(he=>!he.isComment).length,re=de.length-$;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"bg-gradient-to-r from-amber-900/30 to-orange-900/30 rounded-xl p-4 border border-amber-700/40",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(O.Award,{className:"w-5 h-5 text-amber-400"}),e.jsx("h3",{className:"text-sm font-semibold text-amber-300",children:"Pending Author Rewards"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Posts"}),e.jsx("p",{className:"text-lg font-bold text-white",children:$})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Comments"}),e.jsx("p",{className:"text-lg font-bold text-white",children:re})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HBD"}),e.jsxs("p",{className:"text-lg font-bold text-amber-400",children:["$",We(fe.totalHbd)]})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HP"}),e.jsx("p",{className:"text-lg font-bold text-orange-400",children:We(fe.totalHpEq)})]})]})]}),de.map((he,ae)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700 hover:border-gray-600 transition-colors cursor-pointer",onClick:()=>_?.(he.author,he.permlink,he.title),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center flex-shrink-0 ${he.isComment?"bg-blue-900/40 text-blue-400":"bg-emerald-900/40 text-emerald-400"}`,children:he.isComment?e.jsx(O.MessageCircle,{className:"w-3.5 h-3.5"}):e.jsx(O.FileText,{className:"w-3.5 h-3.5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:"text-sm font-medium text-white truncate",children:he.title||`${he.author}/${he.permlink}`}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full flex-shrink-0 ${he.isComment?"bg-blue-900/40 text-blue-300":"bg-emerald-900/40 text-emerald-300"}`,children:he.isComment?"Comment":"Post"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 mt-2 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"w-3 h-3"}),"Payout in ",st(he.payoutMs)]}),e.jsxs("span",{className:"text-amber-400 font-medium",children:["$",We(he.hbd)," HBD"]}),he.hpEq!==null&&e.jsxs("span",{className:"text-orange-400 font-medium",children:[We(he.hpEq)," HP"]}),he.beneficiaryCut>0&&e.jsxs("span",{className:"text-gray-500",children:["Beneficiary: ",(he.beneficiaryCut*100).toFixed(0),"%"]})]})]})]})},`${he.author}-${he.permlink}-${ae}`)),jt&&e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2].map(he=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-7 h-7 bg-gray-700 rounded-lg"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},he))})]})},ir=()=>{if(I&&Se.length===0)return yr();if(Se.length===0&&!jt)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.TrendingUp,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No pending curation rewards"}),e.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"Rewards appear for posts you voted on with pending payouts"})]});const $=Se.filter(ye=>!ye.isComment).length,re=Se.length-$,he=Se.filter(ye=>ye.efficiency!==null),ae=he.length>0?he.reduce((ye,De)=>ye+(De.efficiency||0),0)/he.length:null;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"bg-gradient-to-r from-blue-900/30 to-purple-900/30 rounded-xl p-4 border border-blue-700/40",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(O.TrendingUp,{className:"w-5 h-5 text-blue-400"}),e.jsx("h3",{className:"text-sm font-semibold text-blue-300",children:"Pending Curation Rewards"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-3",children:[e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Posts"}),e.jsx("p",{className:"text-lg font-bold text-white",children:$})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Comments"}),e.jsx("p",{className:"text-lg font-bold text-white",children:re})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HP"}),e.jsx("p",{className:"text-lg font-bold text-blue-400",children:We(Ge.totalHp)})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HBD"}),e.jsxs("p",{className:"text-lg font-bold text-purple-400",children:["$",We(Ge.totalHbd)]})]}),ae!==null&&e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Avg Efficiency"}),e.jsxs("p",{className:`text-lg font-bold ${ae>=100?"text-emerald-400":"text-amber-400"}`,children:[ae.toFixed(1),"%"]})]})]})]}),Se.map((ye,De)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700 hover:border-gray-600 transition-colors cursor-pointer",onClick:()=>_?.(ye.author,ye.permlink,ye.title),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center flex-shrink-0 ${ye.isComment?"bg-blue-900/40 text-blue-400":"bg-emerald-900/40 text-emerald-400"}`,children:ye.isComment?e.jsx(O.MessageCircle,{className:"w-3.5 h-3.5"}):e.jsx(O.FileText,{className:"w-3.5 h-3.5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"text-sm font-medium text-white truncate",children:ye.title||`${ye.author}/${ye.permlink}`}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["by @",ye.author]})]}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full flex-shrink-0 ${ye.isComment?"bg-blue-900/40 text-blue-300":"bg-emerald-900/40 text-emerald-300"}`,children:ye.isComment?"Comment":"Post"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 mt-2 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"w-3 h-3"}),"Payout in ",st(ye.payoutMs)]}),e.jsxs("span",{className:"text-blue-400 font-medium",children:[We(ye.hp)," HP"]}),e.jsxs("span",{className:"text-purple-400 font-medium",children:["$",We(ye.hbd)," HBD"]}),e.jsxs("span",{className:"text-gray-500",children:["Vote: ",ye.weightPct.toFixed(0),"%"]}),ye.efficiency!==null&&e.jsxs("span",{className:`font-medium ${ye.efficiency>=100?"text-emerald-400":"text-amber-400"}`,children:["Eff: ",ye.efficiency.toFixed(1),"%"]}),ye.votedAfterMs!==null&&e.jsxs("span",{className:"text-gray-500",children:["Voted after ",st(ye.votedAfterMs)]})]})]})]})},`${ye.author}-${ye.permlink}-${De}`)),jt&&e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2].map(ye=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-7 h-7 bg-gray-700 rounded-lg"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-1/3 mb-3"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-14"})]})]})]})},ye))})]})},Fr=()=>{if(B==="wallet")return e.jsx("div",{className:"max-w-lg mx-auto",children:e.jsx(u0,{username:$e})});if(B==="activities")return e.jsx(f0,{username:$e,onClickPermlink:C,onSelectActivity:T});if(B==="authorRewards")return Xt();if(B==="curationRewards")return ir();if(B==="votingPower"){if(I)return e.jsxs("div",{className:"max-w-lg mx-auto space-y-6 animate-pulse",children:[[1,2,3].map(dt=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-32"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded-full w-full"})]},dt)),e.jsxs("div",{className:"mt-4 p-4 bg-gray-800 rounded-xl border border-gray-700",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-40 mb-3"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded-full w-full"})]})]});if(!kt)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Gauge,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"Voting power data unavailable"})]});const{maxMana:ae,rewardBalance:ye,recentClaims:De,feedPrice:lt}=kt,Ze=S*100,Qe=ae*.02*(Ze/1e4),ct=De>0?Qe/De*ye:0,et=ct*lt,Pt=kt.upvotePower<S*2/100,Zt=(dt,or=3)=>isNaN(dt)?"—":dt.toLocaleString(void 0,{minimumFractionDigits:or,maximumFractionDigits:or}),Lt=[{label:"Voting Power",value:kt.upvotePower,color:"#10b981"},{label:"Downvote Power",value:kt.downvotePower,color:"#f59e0b"},{label:"Resource Credits",value:kt.resourceCredits,color:"#3b82f6"}];return e.jsxs("div",{className:"max-w-lg mx-auto space-y-6",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-gray-800 border border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-200",children:"Vote Value"}),e.jsxs("span",{className:"text-xs font-bold text-blue-400",children:[S,"%"]})]}),e.jsx("div",{className:"text-[13px] text-gray-400 mb-3",children:De>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-white font-medium",children:[Zt(et)," HBD"]}),e.jsx("span",{className:"mx-1.5",children:"·"}),e.jsxs("span",{className:"text-gray-300",children:["~",Zt(ct)," HIVE"]}),Pt&&e.jsx("span",{className:"ml-2 text-amber-400 text-xs",children:"⚠ low mana"})]}):e.jsxs("span",{children:["Vote @",S,"% · —"]})}),e.jsx("input",{type:"range",min:0,max:100,step:5,value:S,onChange:dt=>P(Number(dt.target.value)),className:"w-full h-2 rounded-full appearance-none cursor-pointer",style:{background:`linear-gradient(to right, #3b82f6 0%, #3b82f6 ${S}%, #374151 ${S}%, #374151 100%)`,accentColor:"#3b82f6"}}),e.jsxs("div",{className:"flex justify-between text-[11px] text-gray-500 mt-1",children:[e.jsx("span",{children:"0%"}),e.jsx("span",{children:"25%"}),e.jsx("span",{children:"50%"}),e.jsx("span",{children:"75%"}),e.jsx("span",{children:"100%"})]})]}),Lt.map(dt=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm font-medium text-gray-300",children:dt.label}),e.jsxs("span",{className:"text-sm font-bold text-white",children:[dt.value.toFixed(2),"%"]})]}),e.jsx("div",{className:"w-full bg-gray-700 rounded-full h-3",children:e.jsx("div",{className:"h-3 rounded-full transition-all duration-500 ease-out",style:{width:`${Math.min(dt.value,100)}%`,backgroundColor:dt.color}})})]},dt.label))]})}if(B==="badges")return I?ur():Ke.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Award,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No badges found"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:Ke.map((ae,ye)=>br(ae,ye))});if(B==="witnessVotes")return I?ur():_t.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Shield,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No witness votes found"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:_t.map((ae,ye)=>br(ae,ye))});if(I)return Ir();if(B==="followers")return St.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Users,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No followers found"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:St.map((ae,ye)=>br(ae.follower,ye))});if(B==="following")return Tt.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Users,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"Not following anyone"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:Tt.map((ae,ye)=>br(ae.following,ye))});if(B==="polls")return Ye.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.BarChart3,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No polls found"})]}):e.jsx("div",{className:"space-y-3",children:Ye.map(ae=>xr(ae))});const re={blogs:{data:W,type:"blog",icon:O.FileText},posts:{data:Q,type:"post",icon:O.FileText},snaps:{data:we,type:"post",icon:O.Camera},comments:{data:Ae,type:"comment",icon:O.MessageCircle},replies:{data:ht,type:"reply",icon:O.Reply}}[B];if(!re)return null;if(re.data.length===0){const ae=re.icon;return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(ae,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsxs("p",{className:"text-gray-400",children:["No ",B," found"]})]})}const he=ae=>{if(B==="snaps"&&E)return()=>E(ae.author,ae.permlink);if((B==="blogs"||B==="posts")&&_)return()=>_(ae.author,ae.permlink,ae.title)};return e.jsx("div",{className:"space-y-3",children:re.data.map(ae=>sr(ae,re.type,he(ae)))})},vt=[{id:"blogs",label:"Blogs",icon:O.FileText},{id:"posts",label:"Posts",icon:O.FileText},{id:"snaps",label:"Snaps",icon:O.Camera},{id:"polls",label:"Polls",icon:O.BarChart3},{id:"comments",label:"Comments",icon:O.MessageCircle},{id:"replies",label:"Replies",icon:O.Reply},{id:"activities",label:"Activities",icon:O.Activity},{id:"authorRewards",label:"Author Rewards",icon:O.Award},{id:"curationRewards",label:"Curation Rewards",icon:O.TrendingUp},{id:"followers",label:"Followers",icon:O.Users},{id:"following",label:"Following",icon:O.Users},{id:"wallet",label:"Wallet",icon:O.Wallet},{id:"votingPower",label:"Voting Power",icon:O.Gauge},{id:"badges",label:"Badges",icon:O.Award},{id:"witnessVotes",label:"Witness Votes",icon:O.Shield}],dr=a&&a.length>0?a.map($=>vt.find(re=>re.id===$)).filter($=>$!==void 0):vt,vr=r&&r!==$e;return e.jsx("div",{className:"dark flex flex-col h-full bg-gray-900",children:e.jsxs("div",{className:"flex flex-col overflow-y-auto h-full scrollbar-hide",children:[e.jsx("div",{className:"sticky top-0 z-30 h-[56px] bg-gray-800/95 backdrop-blur-sm border-b border-gray-700 flex items-center",children:e.jsxs("div",{className:"px-4 py-2 flex items-center gap-2 w-full",children:[n&&s&&e.jsx("button",{onClick:s,className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors flex-shrink-0",children:e.jsx(O.ArrowLeft,{className:"h-5 w-5 text-gray-300"})}),e.jsx("img",{src:G.profileImage||`https://images.hive.blog/u/${$e}/avatar`,alt:$e,className:"w-8 h-8 rounded-full flex-shrink-0 bg-gray-700",onError:$=>{$.target.src=`https://images.hive.blog/u/${$e}/avatar`}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"text-sm font-semibold text-white truncate",children:`@${$e}`}),G.reputation>0&&e.jsx("span",{className:"text-[10px] bg-gray-700 text-gray-300 px-1.5 py-0.5 rounded-full flex-shrink-0",children:Gg(G.reputation)})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-400",children:[e.jsxs("button",{onClick:()=>pe("followers"),className:"hover:text-white transition-colors",children:[e.jsx("span",{className:"font-semibold text-gray-200",children:G.followersCount.toLocaleString()})," Followers"]}),e.jsxs("button",{onClick:()=>pe("following"),className:"hover:text-white transition-colors",children:[e.jsx("span",{className:"font-semibold text-gray-200",children:G.followingCount.toLocaleString()})," Following"]}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-gray-200",children:G.postsCount.toLocaleString()})," Posts"]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[V&&e.jsxs("button",{onClick:Rt,className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors relative",title:"Favourite list",children:[e.jsx(O.Heart,{className:`h-4 w-4 ${F?"text-red-500":"text-gray-400"}`,fill:F?"currentColor":"none"}),Y>0&&e.jsx("span",{className:"absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full h-4 w-4 flex items-center justify-center",children:Y>99?"99+":Y})]}),e.jsx("button",{onClick:mt,className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors",title:"Share profile",children:e.jsx(O.Share2,{className:"h-4 w-4 text-gray-400"})}),vr&&e.jsxs("div",{className:"relative",ref:xt,children:[e.jsx("button",{onClick:()=>Et($=>!$),className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors",title:"More actions",children:e.jsx(O.MoreVertical,{className:"h-4 w-4 text-gray-400"})}),Yt&&e.jsxs("div",{className:"absolute right-0 mt-1 w-48 rounded-lg border border-gray-700 bg-gray-800 shadow-xl z-[100]",onClick:$=>$.stopPropagation(),children:[(u||p)&&e.jsx("button",{onClick:()=>{Et(!1),Ot()},disabled:Mt,className:"w-full px-4 py-2.5 text-left text-sm text-gray-200 hover:bg-gray-700 disabled:opacity-50 first:rounded-t-lg",children:G.isFollowing?"Unfollow":"Follow"}),b&&e.jsx("button",{onClick:()=>{Et(!1),ge(!0)},disabled:Mt,className:"w-full px-4 py-2.5 text-left text-sm text-red-400 hover:bg-red-900/20 disabled:opacity-50",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(O.Ban,{className:"h-4 w-4"})," Ignore Author"]})}),w&&e.jsx("button",{onClick:()=>{Et(!1),Pe(!0)},disabled:Mt,className:"w-full px-4 py-2.5 text-left text-sm text-orange-400 hover:bg-orange-900/20 disabled:opacity-50 last:rounded-b-lg",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(O.Flag,{className:"h-4 w-4"})," Report User"]})})]})]})]})]})}),e.jsxs("div",{className:"relative",children:[G.coverImage?e.jsx("div",{className:"w-full h-24 sm:h-32 bg-cover bg-center",style:{backgroundImage:`url(${G.coverImage})`}}):e.jsx("div",{className:"w-full h-24 sm:h-32 bg-gradient-to-r from-blue-600 to-purple-700"}),e.jsx("div",{className:"absolute inset-0 bg-gray-900/80"}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 px-4 pb-3 pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"text-sm font-semibold text-white truncate",children:G.name||`@${$e}`}),G.about&&e.jsx("p",{className:"text-gray-300 text-xs leading-relaxed mt-1 line-clamp-2",children:G.about})]}),z&&e.jsx("button",{onClick:qt,className:"p-2 hover:bg-white/10 rounded-lg transition-colors ml-2 flex-shrink-0",title:F?"Remove from favourites":"Add to favourites",children:e.jsx(O.Heart,{className:`h-5 w-5 ${F?"text-red-500":"text-white"}`,fill:F?"currentColor":"none"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 mt-1.5 text-[11px] text-gray-300",children:[G.location&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.MapPin,{className:"h-3 w-3 text-rose-400"})," ",G.location]}),G.website&&e.jsxs("a",{href:G.website.startsWith("http")?G.website:`https://${G.website}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-blue-400 hover:underline",children:[e.jsx(O.Globe,{className:"h-3 w-3 text-blue-400"})," ",G.website]}),G.created&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Calendar,{className:"h-3 w-3 text-green-400"})," ",Jg(G.created)]}),G.lastActivity&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"h-3 w-3 text-amber-400"})," ",dn(G.lastActivity)]}),G.votingPower!==void 0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Zap,{className:"h-3 w-3 text-yellow-400"})," VP ",G.votingPower.toFixed(1),"%"]}),G.hivePower!==void 0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Zap,{className:"h-3 w-3 text-orange-400"})," HP ",G.hivePower.toFixed(0)]})]})]})]}),e.jsxs("div",{className:"sticky top-[56px] z-20 bg-gray-800 border-b border-gray-700 relative flex items-center",children:[cr&&e.jsx("button",{onClick:()=>Mr("left"),className:"absolute left-0 z-10 h-full px-2 bg-gray-700 hover:bg-gray-600 flex items-center shadow-md transition-colors",children:e.jsx(O.ChevronLeft,{className:"h-4 w-4 text-white"})}),e.jsx("div",{ref:Je,className:"flex overflow-x-auto scrollbar-hide",children:dr.map($=>{const re=$.icon;return e.jsxs("button",{onClick:()=>pe($.id),className:`flex items-center gap-1 px-3 sm:px-4 py-2.5 text-xs sm:text-sm font-medium whitespace-nowrap transition-colors border-b-2 ${B===$.id?"text-blue-400 border-blue-400":"text-gray-400 border-transparent hover:text-gray-300 hover:border-gray-600"}`,children:[e.jsx(re,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:$.label})]},$.id)})}),rr&&e.jsx("button",{onClick:()=>Mr("right"),className:"absolute right-0 z-10 h-full px-2 bg-gray-700 hover:bg-gray-600 flex items-center shadow-md transition-colors",children:e.jsx(O.ChevronRight,{className:"h-4 w-4 text-white"})})]}),e.jsxs("div",{className:"p-4 flex-1",children:[Fr(),B!=="wallet"&&Xe[B]&&e.jsx("div",{ref:Dt,className:"min-h-[60px] py-2",children:be?e.jsx("div",{className:"animate-pulse space-y-3",children:B==="followers"||B==="following"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:[1,2].map($=>e.jsx("div",{className:"border border-gray-700 rounded-lg p-4 bg-gray-800",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-28"})]})},$))}):e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24 mb-2"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-1/2"})]})]})})}):e.jsx("div",{className:"h-1"})}),B!=="wallet"&&!Xe[B]&&!I&&e.jsxs("div",{className:"text-center py-4 text-xs text-gray-600",children:["No more ",B," to load"]})]}),ft&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[1000] p-4",onClick:()=>ge(!1),children:e.jsxs("div",{className:"bg-gray-800 rounded-xl shadow-xl max-w-sm w-full border border-gray-700 p-6",onClick:$=>$.stopPropagation(),children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"Ignore Author"}),e.jsxs("p",{className:"text-sm text-gray-300 mb-6",children:["Are you sure you want to ignore"," ",e.jsxs("span",{className:"text-red-400 font-medium",children:["@",$e]}),"? Their content will be hidden from your feed."]}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx("button",{onClick:()=>ge(!1),disabled:Mt,className:"px-4 py-2 text-sm font-medium rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700 disabled:opacity-50",children:"Cancel"}),e.jsx("button",{onClick:Gt,disabled:Mt,className:"px-4 py-2 text-sm font-medium rounded-lg text-white bg-red-600 hover:bg-red-700 disabled:opacity-50",children:Mt?"Processing...":"Confirm Ignore"})]})]})}),e.jsx(Kc,{isOpen:Te,onClose:()=>Pe(!1),onReport:At,reportType:"user",targetUsername:$e}),e.jsx(Kc,{isOpen:!!He,onClose:()=>Ue(null),onReport:async $=>{if(He&&y){await y(He.author,He.permlink,$);const re=he=>he.author===He.author&&he.permlink===He.permlink;te(he=>he.filter(ae=>!re(ae))),Ie(he=>he.filter(ae=>!re(ae))),Me(he=>he.filter(ae=>!re(ae))),le(he=>he.filter(ae=>!re(ae))),Ne(he=>he.filter(ae=>!re(ae))),se(he=>he.filter(ae=>!re(ae)))}Ue(null)},reportType:"post",targetUsername:He?.author||"",targetPermlink:He?.permlink})]})})},Xg=t=>{window.open(t,"_blank")},Zg=({app:t,backgroundColor:r,boxShadow:s})=>{const n=()=>{Xg(t.url)};return e.jsx("div",{className:"card hover-lift cursor-pointer transition-all duration-300 h-full",onClick:n,style:{backgroundColor:r??"rgba(15,23,42,0.9)",boxShadow:s??"0 18px 45px rgba(0,0,0,0.6)",border:"1px solid rgba(148,163,184,0.25)"},children:e.jsx("div",{className:"card-body p-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex-shrink-0",children:t.useCircleBackground!==!1?e.jsx("div",{className:"avatar",children:e.jsx("div",{className:"w-16 h-16 rounded-full",children:e.jsx("img",{src:t.imagePath,alt:`${t.name} logo`,className:"w-full h-full object-cover",onError:a=>{a.currentTarget.src="/placeholder.svg"}})})}):e.jsx("img",{src:t.imagePath,alt:`${t.name} logo`,className:"w-16 h-16 object-contain",onError:a=>{a.currentTarget.src="/placeholder.svg"}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("h3",{className:"card-title text-lg font-bold text-base-content mb-2 line-clamp-2",children:t.name}),t.isComingSoon&&e.jsx("div",{className:"badge badge-warning badge-sm",children:"Coming Soon"})]}),e.jsx("div",{className:"text-base-content/70 text-sm leading-relaxed",children:t.description.split(`
1139
+ transition-colors cursor-pointer`,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:Ee.userAvatar(f.following),alt:f.following,className:"w-12 h-12 rounded-full object-cover",onError:h=>{h.target.src=`https://ui-avatars.com/api/?name=${f.following}&background=random`}}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:["@",f.following]})})]})},`${f.following}-${l}`))})})},y0=({username:t})=>{const[r,s]=k.useState(null),[n,a]=k.useState(!0),[i,o]=k.useState(null),c=async()=>{try{a(!0),o(null);const u=await Ee.getProfile(t);s(u)}catch(u){o(u instanceof Error?u.message:"Failed to load user details")}finally{a(!1)}};k.useEffect(()=>{c()},[t]);const d=u=>{try{return new Date(u).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return u}},f=u=>u.replace(/<[^>]*>/g,"");if(n)return e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading user details..."]})});if(i)return e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load user details"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:i}),e.jsxs("button",{onClick:c,className:"m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4"}),"Try Again"]})]})});if(!r?.result)return e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No user details available"})});const l=r.result,h=l.metadata?.profile;return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[h?.about&&e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-3",children:"About"}),e.jsx("div",{className:"text-gray-600 dark:text-gray-300 leading-relaxed whitespace-pre-wrap",children:f(h.about)})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Location"}),e.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:h?.location||"Not specified"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Website"}),e.jsx("a",{href:h?.website,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-blue-500 hover:underline",children:h?.website||"Not specified"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Joined"}),e.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l.created?d(l.created):"Unknown"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Followers"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:l.stats?.followers?.toLocaleString()||"0"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Following"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:l.stats?.following?.toLocaleString()||"0"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Post Count"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:l.post_count?.toLocaleString()||"0"})]})]})]})})},Hg=({username:t,onVideoClick:r,onAuthorClick:s,onBack:n,onClickUserInfoTab:a,onClickFollowersTab:i,onClickFollowingTab:o,onBookmarkToggle:c,onRss:d,onShare:f,onMoreMenu:l,showMoreMenu:h=!1})=>{const[u,p]=k.useState("videos"),[b,w]=k.useState(null),[x,g]=k.useState(!1),[v,N]=k.useState(!0);k.useEffect(()=>{(async()=>{try{N(!0);const C=await Ee.getProfile(t);w(C)}catch(C){console.error("Failed to fetch user details:",C)}finally{N(!1)}})()},[t]);const j=()=>{if(f)f(t);else{const A=`https://3speak.tv/user/${t}`;navigator.share?navigator.share({title:b?.result?.name||t,url:A}):navigator.clipboard.writeText(A)}},y=()=>{d?d(t):window.open(`https://3speak.tv/rss/${t}.xml`,"_blank")},m=A=>{s(A)};if(v)return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"h-8 bg-gray-200 dark:bg-gray-700 rounded w-32 mb-6"}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-200 dark:bg-gray-700 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-6 bg-gray-200 dark:bg-gray-700 rounded w-48"}),e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-32"})]})]}),e.jsx("div",{className:"flex gap-2",children:Array.from({length:4}).map((A,C)=>e.jsx("div",{className:"h-10 bg-gray-200 dark:bg-gray-700 rounded w-20"},C))})]})]})});const _=b?.result,E=_?.metadata?.profile;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("button",{onClick:n,className:"flex items-center justify-center mr-4 px-2 text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-full",children:[e.jsx(O.ArrowLeft,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs("div",{className:"relative bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl overflow-hidden",children:[e.jsx("img",{src:E.cover_image||Ee.userAvatar(t),alt:"Cover",className:"w-full h-48 object-cover",onError:A=>{A.target.src=Ee.userAvatar(t)}}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-6",children:[e.jsx("img",{src:E?.profile_image,alt:E?.name,className:"w-24 h-24 rounded-full object-cover border-4 border-white dark:border-gray-800 -mt-16",onError:A=>{A.target.src=Ee.userAvatar(t)}}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:E?.name||t}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:E?.about||"No description available"}),e.jsxs("div",{className:"flex flex-wrap gap-6 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Users,{className:"w-4 h-4"}),e.jsxs("span",{children:[(_?.stats?.followers||0).toLocaleString()," Followers"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Users,{className:"w-4 h-4"}),e.jsxs("span",{children:[(_?.stats?.following||0).toLocaleString()," Following"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Calendar,{className:"w-4 h-4"}),e.jsxs("span",{children:["Joined"," ",_?.created?new Date(_.created).getFullYear():"Unknown"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Mo,{id:t,toastType:"user",onAdd:(A,C)=>{c?c(A,!0):console.log("Added:",A,C)},onRemove:(A,C)=>{c?c(A,!1):console.log("Removed:",A,C)}}),e.jsx("button",{onClick:y,className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:e.jsx(O.Rss,{className:"w-4 h-4"})}),e.jsx("button",{onClick:j,className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:e.jsx(O.Share2,{className:"w-4 h-4"})}),h&&e.jsx("button",{onClick:()=>{l&&l(t)},className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:e.jsx(O.MoreVertical,{className:"w-4 h-4"})})]})]})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"grid grid-cols-4 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[{key:"videos",label:"Videos"},{key:"about",label:"User Info",callback:a},{key:"followers",label:"Followers",callback:i},{key:"following",label:"Following",callback:o}].map((A,C)=>e.jsx("button",{onClick:()=>{A.callback?A.callback():p(A.key)},className:`px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${u===A.key?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:A.label},A.key))}),e.jsxs("div",{className:"mt-6",children:[u==="videos"&&e.jsx(_n,{feedType:er.USER,username:t,onVideoClick:r,onAuthorClick:s}),u==="about"&&e.jsx(y0,{username:t}),u==="followers"&&e.jsx(x0,{username:t,onSelectUser:m}),u==="following"&&e.jsx(b0,{username:t,onSelectUser:m})]})]})]})},Wg=["Spam","Harassment or bullying","Hate speech","Violence or dangerous organizations","Intellectual property violation","Self-harm","Non-consensual intimate images","Doxxing","Minor safety","Other"],Kc=({isOpen:t,onClose:r,onReport:s,reportType:n,targetUsername:a,targetPermlink:i})=>{const[o,c]=k.useState("select"),[d,f]=k.useState(""),[l,h]=k.useState(!1),u=x=>{f(x),c("confirm")},p=async()=>{if(d){h(!0);try{await s(d),r(),c("select"),f("")}catch(x){console.error("Report failed:",x)}finally{h(!1)}}},b=()=>{r(),c("select"),f("")},w=()=>{c("select"),f("")};return t?e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[1000] p-4",onClick:b,children:e.jsxs("div",{className:"bg-gray-900 rounded-xl shadow-xl max-w-md w-full max-h-[80vh] flex flex-col border border-gray-700",onClick:x=>x.stopPropagation(),children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(O.Flag,{className:"h-5 w-5 text-red-500"}),e.jsxs("h3",{className:"text-lg font-semibold text-white",children:["Report ",n==="user"?"User":"Post"]})]}),e.jsx("button",{onClick:b,className:"p-1 hover:bg-gray-800 rounded transition-colors",children:e.jsx(O.X,{className:"h-5 w-5 text-gray-400"})})]}),e.jsxs("p",{className:"text-sm text-gray-400 mt-1",children:["@",a]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[o==="select"&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-gray-400 mb-4",children:["Why are you reporting this ",n,"?"]}),e.jsx("div",{className:"space-y-2",children:Wg.map(x=>e.jsx("button",{onClick:()=>u(x),className:"w-full text-left px-4 py-3 border border-gray-700 rounded-lg text-gray-300 hover:bg-gray-800 hover:border-gray-600 transition-colors",children:x},x))})]}),o==="confirm"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start space-x-3 mb-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(O.AlertTriangle,{className:"h-6 w-6 text-red-500"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-sm font-medium text-white mb-2",children:"Report Summary"}),e.jsxs("div",{className:"space-y-2 text-sm text-gray-400",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Type:"})," ",n==="user"?"User":"Post"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Target:"})," @",a]}),n==="post"&&i&&e.jsxs("p",{children:[e.jsx("strong",{children:"Post:"})," ",i]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Reason:"})," ",d]})]})]})]}),e.jsx("div",{className:"bg-yellow-900/20 border border-yellow-800 rounded-lg p-3",children:e.jsx("p",{className:"text-xs text-yellow-200",children:"Reports are reviewed by our moderation team. False reports may result in action against your account."})})]})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-gray-700 flex items-center justify-end space-x-3",children:[o==="select"&&e.jsx("button",{onClick:b,className:"px-4 py-2 border border-gray-600 text-gray-300 rounded-lg hover:bg-gray-800 transition-colors",children:"Cancel"}),o==="confirm"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:w,className:"px-4 py-2 border border-gray-600 text-gray-300 rounded-lg hover:bg-gray-800 transition-colors",children:"Back"}),e.jsx("button",{onClick:p,disabled:l,className:"px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:l?"Reporting...":"Submit Report"})]})]})]})}):null},dn=t=>{const r=new Date,s=new Date(t),n=Math.floor((r.getTime()-s.getTime())/1e3);return n<60?"just now":n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:n<2592e3?`${Math.floor(n/86400)}d ago`:s.toLocaleDateString()},Gg=t=>{if(t===0)return"25";const r=t<0;let s=r?-t:t,n=Math.log10(s);return n=Math.max(n-9,0),n=(r?-1:1)*n,n=n*9+25,Math.round(n).toString()},Jg=t=>{try{return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return t}},Qc=t=>{let r=t;return r=r.replace(/<[^>]*>/g,""),r=r.replace(/!\[.*?\]\([^\s)]+\)/g,""),r=r.replace(/\[([^\]]*)\]\([^\s)]+\)/g,"$1"),r=r.replace(/https?:\/\/[^\s)>\]]+/g,""),r=r.replace(/\[.*?\]/g,""),r=r.replace(/\(https?:\/\/[^\s)]*\)/g,""),r=r.replace(/[*_~`#>|]/g,""),r=r.replace(/^[-_*]{3,}\s*$/gm,""),r=r.replace(/\s+/g," ").trim(),r},Yg=({username:t,currentUsername:r,onBack:s,showBackButton:n=!1,tabShown:a,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f,reportedPosts:l=[],reportedAuthors:h=[],onFollow:u,onUnfollow:p,onIgnoreAuthor:b,onReportUser:w,onUpvote:x,onSubmitComment:g,onClickCommentUpvote:v,onReblog:N,onTip:j,onReportPost:y,onUserClick:m,onPostClick:_,onSnapClick:E,onPollClick:A,onActivityPermlink:C,onActivitySelect:T,onShare:D,onSharePost:L,onCommentClick:H,onFavouriteList:V,onAddToFavourite:z,isFavourited:F=!1,favouriteCount:Y=0})=>{const[G,ne]=k.useState(null),[ie,xe]=k.useState(!0),[U,q]=k.useState(null),[B,pe]=k.useState("blogs"),[ee,te]=k.useState([]),[_e,Ie]=k.useState([]),[K,le]=k.useState([]),[oe,Ne]=k.useState([]),[Ce,Me]=k.useState([]),[Fe,ue]=k.useState(null),[Re,ae]=k.useState([]),[de,ve]=k.useState([]),[fe,ke]=k.useState({totalHbd:0,totalHpEq:0}),[Se,Be]=k.useState([]),[Ge,pt]=k.useState({totalHp:0,totalHbd:0}),[jt,gt]=k.useState(!1),[St,Ct]=k.useState([]),[Tt,Bt]=k.useState([]),[Ke,at]=k.useState([]),[_t,Vt]=k.useState([]),[kt,Ut]=k.useState(null),[S,P]=k.useState(100),[I,X]=k.useState(!1),[be,Oe]=k.useState(!1),[Xe,Ve]=k.useState({blogs:!0,posts:!0,snaps:!0,polls:!1,comments:!0,replies:!0,activities:!1,authorRewards:!1,curationRewards:!1,followers:!0,following:!0,wallet:!1,votingPower:!1,badges:!1,witnessVotes:!1}),ze=20,bt=100,Dt=k.useRef(null),[Mt,$t]=k.useState(!1),[Yt,Et]=k.useState(!1),[ft,ge]=k.useState(!1),[Te,Pe]=k.useState(!1),[He,Ue]=k.useState(null),xt=k.useRef(null),Je=k.useRef(null),[cr,Or]=k.useState(!1),[rr,Lr]=k.useState(!1),zt=k.useCallback(()=>{const $=Je.current;$&&(Or($.scrollLeft>0),Lr($.scrollLeft+$.clientWidth<$.scrollWidth-1))},[]);k.useEffect(()=>{const $=Je.current;if(!$)return;zt(),$.addEventListener("scroll",zt);const re=new ResizeObserver(zt);return re.observe($),()=>{$.removeEventListener("scroll",zt),re.disconnect()}},[zt]);const Mr=k.useCallback($=>{const re=Je.current;re&&re.scrollBy({left:$==="left"?-150:150,behavior:"smooth"})},[]);Lo();const $e=t.replace(/^@/,"").trim(),ar=k.useMemo(()=>new Set(l.map($=>`${$.author}/${$.permlink}`)),[l]),kr=k.useMemo(()=>new Set(h),[h]),ut=k.useCallback($=>$.filter(re=>!kr.has(re.author)&&!ar.has(`${re.author}/${re.permlink}`)),[ar,kr]);k.useEffect(()=>{const $=re=>{xt.current&&!xt.current.contains(re.target)&&Et(!1)};return document.addEventListener("click",$),()=>document.removeEventListener("click",$)},[]),k.useEffect(()=>{(async()=>{if($e){xe(!0),q(null);try{const[re,he,se]=await Promise.all([Ee.getProfile($e),Ee.getAccounts([$e]),Ee.getDynamicGlobalProperties()]),ye=re?.result,De=he?.[0];if(!ye){q("User not found");return}let lt;if(se&&De?.vesting_shares){const Lt=parseFloat(De.vesting_shares.split(" ")[0]),dt=parseFloat(se.total_vesting_shares.split(" ")[0]),or=parseFloat(se.total_vesting_fund_hive.split(" ")[0]);lt=Lt/dt*or}let Ze;De?.voting_power&&(Ze=De.voting_power/1e4*100);let Qe=!1;if(r&&r!==$e)try{Qe=(await Ee.getFollowing(r)).some(dt=>dt.following===$e)}catch{}let ct=null;if(De?.posting_json_metadata)try{ct=JSON.parse(De.posting_json_metadata)?.profile}catch{}let et=null;if(De?.json_metadata)try{et=JSON.parse(De.json_metadata)?.profile}catch{}const Pt=ye.metadata?.profile,Zt={username:ye.name,name:ct?.name||et?.name||Pt?.name,about:ct?.about||et?.about||Pt?.about,location:ct?.location||et?.location||Pt?.location,website:ct?.website||et?.website||Pt?.website,profileImage:ct?.profile_image||et?.profile_image||Pt?.profile_image,coverImage:ct?.cover_image||et?.cover_image||Pt?.cover_image,followersCount:ye.stats?.followers||0,followingCount:ye.stats?.following||0,postsCount:ye.post_count||0,reputation:ye.reputation||0,isFollowing:Qe,created:ye.created,lastActivity:De?.last_post,hivePower:lt,votingPower:Ze};ne(Zt)}catch(re){console.error("Error fetching user profile:",re),q("Failed to load user profile")}finally{xe(!1)}}})()},[$e,r]),k.useEffect(()=>{te([]),Ie([]),Me([]),ue(null),ae([]),ve([]),ke({totalHbd:0,totalHpEq:0}),Be([]),pt({totalHp:0,totalHbd:0}),le([]),Ne([]),Ct([]),Bt([]);const $=a&&a.length>0?a[0]:"blogs";pe($),Ve({blogs:!0,posts:!0,snaps:!0,polls:!1,comments:!0,replies:!0,activities:!1,authorRewards:!1,curationRewards:!1,followers:!0,following:!0,wallet:!1,votingPower:!1,badges:!1,witnessVotes:!1}),at([]),Vt([]),Ut(null),P(100)},[$e]),k.useEffect(()=>{const $=new AbortController,{signal:re}=$;return(async()=>{if($e){X(!0),gt(!1),B==="authorRewards"&&(ve([]),ke({totalHbd:0,totalHpEq:0})),B==="curationRewards"&&(Be([]),pt({totalHp:0,totalHbd:0}));try{switch(B){case"blogs":{const se=ut(await Ee.getUserBlogs($e,ze,void 0,void 0,re));te(se),Ve(ye=>({...ye,blogs:se.length>=ze}));break}case"posts":{const se=ut(await Ee.getUserPosts($e,ze,void 0,void 0,re));Ie(se),Ve(ye=>({...ye,posts:se.length>=ze}));break}case"snaps":{const{snaps:se,nextStartId:ye}=await Ee.getUserSnaps($e,void 0,r,re);Me(ut(se)),ue(ye),Ve(De=>({...De,snaps:ye!==null}));break}case"polls":{const se=ut(await Ee.getUserPolls($e,re));ae(se),Ve(ye=>({...ye,polls:!1}));break}case"comments":{const se=ut(await Ee.getUserComments($e,ze,void 0,void 0,re));le(se),Ve(ye=>({...ye,comments:se.length>=ze}));break}case"replies":{const se=ut(await Ee.getUserReplies($e,ze,void 0,void 0,re));Ne(se),Ve(ye=>({...ye,replies:se.length>=ze}));break}case"followers":{const se=await Ee.getFollowers($e,null,bt,re);Ct(se),Ve(ye=>({...ye,followers:se.length>=bt}));break}case"following":{const se=await Ee.getFollowing($e,null,bt,re);Bt(se),Ve(ye=>({...ye,following:se.length>=bt}));break}case"authorRewards":{gt(!0);const se=await Ee.getPendingAuthorRewards($e,(ye,De,lt)=>{re.aborted||(ve([...ye]),ke({totalHbd:De,totalHpEq:lt}),X(!1))},re);ve(se.rows),ke({totalHbd:se.totalHbd,totalHpEq:se.totalHpEq}),gt(!1);break}case"curationRewards":{gt(!0);const se=await Ee.getPendingCurationRewards($e,(ye,De,lt)=>{re.aborted||(Be([...ye]),pt({totalHp:De,totalHbd:lt}),X(!1))},re);Be(se.rows),pt({totalHp:se.totalHp,totalHbd:se.totalHbd}),gt(!1);break}case"votingPower":{const[se,,ye]=await Promise.all([Ee.getAccounts([$e],re),Ee.getDynamicGlobalProperties(re),Ee.getFeedHistory(re)]),De=se?.[0];if(De){const Ze=M=>parseFloat(String(M).split(" ")[0])||0,ct=(Ze(De.vesting_shares)+Ze(De.received_vesting_shares)-Ze(De.delegated_vesting_shares))*1e6,et=Math.floor(Date.now()/1e3)-De.voting_manabar.last_update_time;let Pt=parseFloat(String(De.voting_manabar.current_mana))+et*ct/432e3;Pt>ct&&(Pt=ct);const Zt=ct>0?Pt/ct*100:0,Lt=ct/4,dt=Math.floor(Date.now()/1e3)-De.downvote_manabar.last_update_time;let or=parseFloat(String(De.downvote_manabar.current_mana))+dt*Lt/432e3;or>Lt&&(or=Lt);const Yr=Lt>0?or/Lt*100:0;let ra=0;try{const me=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:"rc_api.find_rc_accounts",params:{accounts:[$e]},id:1}),signal:re})).json())?.result?.rc_accounts?.[0];if(me){const qe=parseFloat(me.rc_manabar.current_mana),nt=parseFloat(me.max_rc);nt>0&&(ra=qe/nt*100)}}catch{}let R=0,J=0,Z=0;try{const me=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:"condenser_api.get_reward_fund",params:["post"],id:1}),signal:re})).json())?.result;me&&(R=Ze(me.reward_balance),J=parseFloat(me.recent_claims)||0)}catch{}if(ye?.current_median_history){const M=Ze(ye.current_median_history.base),ce=Ze(ye.current_median_history.quote)||1;Z=M/ce}Ut({upvotePower:Math.min(Zt,100),downvotePower:Math.min(Yr,100),resourceCredits:Math.min(ra,100),maxMana:ct,rewardBalance:R,recentClaims:J,feedPrice:Z})}break}case"badges":{let se=[],ye=null,De=!0;for(;De;){const Ze=await Ee.getFollowers($e,ye,1e3,re);se=[...se,...Ze],Ze.length<1e3?De=!1:ye=Ze[Ze.length-1].follower}const lt=se.map(Ze=>Ze.follower).filter(Ze=>Ze.startsWith("badge-"));at(lt);break}case"witnessVotes":{const ye=(await Ee.getAccounts([$e],re))?.[0];ye?.witness_votes&&Vt(ye.witness_votes);break}}}catch(se){if(se?.name==="AbortError")return;console.error(`Error fetching ${B}:`,se)}finally{re.aborted||X(!1)}}})(),()=>{$.abort()}},[$e,B]);const W=k.useMemo(()=>ut(ee),[ee,ut]),Q=k.useMemo(()=>ut(_e),[_e,ut]),we=k.useMemo(()=>ut(Ce),[Ce,ut]),Ae=k.useMemo(()=>ut(K),[K,ut]),ht=k.useMemo(()=>ut(oe),[oe,ut]),Ye=k.useMemo(()=>ut(Re),[Re,ut]),yt=k.useCallback(async()=>{if(!(be||!Xe[B]||!$e)){Oe(!0);try{switch(B){case"blogs":{const $=ee[ee.length-1];if(!$)break;const re=await Ee.getUserBlogs($e,ze,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);te(se=>[...se,...he]),Ve(se=>({...se,blogs:he.length>=ze-1}));break}case"posts":{const $=_e[_e.length-1];if(!$)break;const re=await Ee.getUserPosts($e,ze,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);Ie(se=>[...se,...he]),Ve(se=>({...se,posts:he.length>=ze-1}));break}case"snaps":{if(!Fe)break;const{snaps:$,nextStartId:re}=await Ee.getUserSnaps($e,Fe,r);Me(he=>[...he,...ut($)]),ue(re),Ve(he=>({...he,snaps:re!==null}));break}case"comments":{const $=K[K.length-1];if(!$)break;const re=await Ee.getUserComments($e,ze,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);le(se=>[...se,...he]),Ve(se=>({...se,comments:he.length>=ze-1}));break}case"replies":{const $=oe[oe.length-1];if(!$)break;const re=await Ee.getUserReplies($e,ze,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);Ne(se=>[...se,...he]),Ve(se=>({...se,replies:he.length>=ze-1}));break}case"followers":{const $=St[St.length-1];if(!$)break;const re=await Ee.getFollowers($e,$.follower,bt),he=re.length>0&&re[0].follower===$.follower?re.slice(1):re;Ct(se=>[...se,...he]),Ve(se=>({...se,followers:he.length>=bt-1}));break}case"following":{const $=Tt[Tt.length-1];if(!$)break;const re=await Ee.getFollowing($e,$.following,bt),he=re.length>0&&re[0].following===$.following?re.slice(1):re;Bt(se=>[...se,...he]),Ve(se=>({...se,following:he.length>=bt-1}));break}}}catch($){console.error(`Error loading more ${B}:`,$)}finally{Oe(!1)}}},[B,$e,r,be,Xe,ee,_e,Ce,Fe,K,oe,St,Tt]);k.useEffect(()=>{const $=Dt.current;if(!$)return;const re=new IntersectionObserver(he=>{he[0].isIntersecting&&yt()},{rootMargin:"200px"});return re.observe($),()=>re.disconnect()},[yt]);const Ot=k.useCallback(async()=>{if(G){$t(!0),Et(!1);try{const $=G.isFollowing;$&&p?await p($e):!$&&u&&await u($e),ne(re=>re&&{...re,isFollowing:!$,followersCount:$?Math.max(0,re.followersCount-1):re.followersCount+1}),setTimeout(async()=>{try{const re=await Ee.getProfile($e);re?.result?.stats&&ne(he=>he&&{...he,followersCount:re.result.stats.followers??he.followersCount,followingCount:re.result.stats.following??he.followingCount})}catch{}},3e3)}catch($){console.error("Follow/Unfollow error:",$)}finally{$t(!1)}}},[G,$e,u,p]),Gt=k.useCallback(async()=>{$t(!0);try{b&&await b($e),ge(!1),Et(!1)}catch($){console.error("Error ignoring user:",$)}finally{$t(!1)}},[$e,b]),At=k.useCallback(async $=>{$t(!0);try{w&&await w($e,$),Pe(!1),Et(!1)}catch(re){console.error("Error reporting user:",re)}finally{$t(!1)}},[$e,w]),mt=k.useCallback(()=>{D?.($e)},[$e,D]),Rt=k.useCallback(async()=>{V&&await V()},[V]),qt=k.useCallback(async()=>{z&&await z($e)},[$e,z]);if(ie)return e.jsxs("div",{className:"dark h-full overflow-y-auto animate-pulse bg-gray-900",children:[e.jsxs("div",{className:"sticky top-0 z-30 bg-gray-900 border-b border-gray-700 px-4 py-3 flex items-center gap-3",children:[n&&e.jsx("div",{className:"w-8 h-8 bg-gray-700 rounded-full"}),e.jsx("div",{className:"w-9 h-9 bg-gray-700 rounded-full"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-28 mb-1.5"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-36"})]}),e.jsx("div",{className:"w-8 h-8 bg-gray-700 rounded-full"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"h-36 sm:h-44 bg-gray-800 w-full"}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-4",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-48 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-64 mb-3"}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-24"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-28"})]})]})]}),e.jsx("div",{className:"border-b border-gray-700 px-2 py-2 flex gap-1 overflow-x-auto",children:[80,64,72,96,80,64,72].map(($,re)=>e.jsx("div",{className:"h-8 bg-gray-800 rounded-lg flex-shrink-0",style:{width:$}},re))}),e.jsx("div",{className:"p-4 space-y-3",children:[1,2,3,4].map($=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24 mb-2"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-4/5 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-full mb-1.5"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-3/5 mb-3"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},$))})]});if(U||!G)return e.jsx("div",{className:"dark flex items-center justify-center min-h-[400px] bg-gray-900",children:e.jsxs("div",{className:"text-center",children:[e.jsx(O.User,{className:"h-14 w-14 text-gray-500 mx-auto mb-3"}),e.jsx("h3",{className:"text-lg font-medium text-white mb-1",children:"User Not Found"}),e.jsx("p",{className:"text-gray-400",children:U||"This user does not exist"}),n&&s&&e.jsxs("button",{onClick:s,className:"mt-4 inline-flex items-center px-4 py-2 text-sm font-medium rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700",children:[e.jsx(O.ArrowLeft,{className:"h-4 w-4 mr-2"}),"Go Back"]})]})});const It=({images:$})=>{const[re,he]=k.useState(0),[se,ye]=k.useState(!1);return $.length===0?null:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative w-16 flex-shrink-0 mt-1.5",children:[e.jsx("button",{onClick:De=>{De.stopPropagation(),ye(!0)},className:"block w-16 h-16 rounded-lg overflow-hidden border border-gray-600 hover:border-blue-500 transition-colors cursor-pointer",children:e.jsx("img",{src:$[re],alt:"",className:"w-full h-full object-cover bg-gray-700",onError:De=>{De.target.style.display="none"}})}),$.length>1&&e.jsxs("div",{className:"flex items-center justify-between mt-1",children:[e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt-1+$.length)%$.length)},className:"p-0.5 text-gray-400 hover:text-white transition-colors",title:"Previous",children:e.jsx(O.ChevronLeft,{className:"h-3.5 w-3.5"})}),e.jsxs("span",{className:"text-[10px] text-gray-500",children:[re+1,"/",$.length]}),e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt+1)%$.length)},className:"p-0.5 text-gray-400 hover:text-white transition-colors",title:"Next",children:e.jsx(O.ChevronRight,{className:"h-3.5 w-3.5"})})]})]}),se&&e.jsx("div",{className:"fixed inset-0 z-[2000] bg-black/80 flex items-center justify-center p-4",onClick:()=>ye(!1),children:e.jsxs("div",{className:"relative max-w-3xl max-h-[85vh] w-full flex items-center justify-center",onClick:De=>De.stopPropagation(),children:[e.jsx("img",{src:$[re],alt:"",className:"max-w-full max-h-[80vh] rounded-lg object-contain"}),e.jsx("button",{onClick:()=>ye(!1),className:"absolute top-2 right-2 text-white/70 hover:text-white bg-black/50 rounded-full p-1.5 transition-colors",title:"Close",children:e.jsx("span",{className:"text-lg leading-none",children:"×"})}),$.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt-1+$.length)%$.length)},className:"absolute left-2 top-1/2 -translate-y-1/2 bg-black/50 hover:bg-black/70 text-white rounded-full p-2 transition-colors",children:e.jsx(O.ChevronLeft,{className:"h-5 w-5"})}),e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt+1)%$.length)},className:"absolute right-2 top-1/2 -translate-y-1/2 bg-black/50 hover:bg-black/70 text-white rounded-full p-2 transition-colors",children:e.jsx(O.ChevronRight,{className:"h-5 w-5"})}),e.jsxs("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 bg-black/50 text-white text-xs px-3 py-1 rounded-full",children:[re+1," / ",$.length]})]})]})})]})},sr=($,re,he)=>{const se=$.json_metadata?.image?.length?$.json_metadata.image:[],ye=$.json_metadata?.description||($.body?Qc($.body):""),De=$.payout?$.payout.toFixed(3):$.pending_payout_value?$.pending_payout_value.replace(/[^\d.]/g,""):"0.000",lt=De,Ze=[],Qe=$.percent_hbd??1e4;if(Qe===0?Ze.push("Hive Rewards Payout 100% Powered Up"):Ze.push(`Hive Rewards Payout (${(Qe/200).toFixed(0)}%/${100-Qe/200}%)`),$.is_paidout){const et=$.author_payout_value?$.author_payout_value.replace(/[^\d.]/g,""):"";Ze.push("Past payouts:"),Ze.push(`${De} Hive Rewards${et?` (Author ${et})`:""}`)}else{if($.payout_at){const et=new Date($.payout_at),Pt=new Date,Zt=et.getTime()-Pt.getTime();if(Zt>0){const Lt=Math.floor(Zt/36e5),dt=Math.floor(Lt/24),or=Lt%24,Yr=dt>0?`in ${dt} day${dt>1?"s":""}${or>0?` ${or} hour${or>1?"s":""}`:""}`:`in ${Lt} hour${Lt>1?"s":""}`;Ze.push(`Payout will occur: ${Yr}`)}}Qe===0?Ze.push(`${De} Hive Rewards (100% Powered Up)`):Ze.push(`${De} Hive Rewards (${(Qe/200).toFixed(0)}%/${100-Qe/200}%)`)}$.beneficiaries?.length>0&&(Ze.push("Beneficiaries:"),$.beneficiaries.forEach(et=>{Ze.push(`${et.account}: ${(et.weight/100).toFixed(0)}%`)}));const ct=Ze.join(`
1140
+ `);return e.jsxs("div",{className:`border border-gray-700 rounded-lg p-4 bg-gray-800 hover:bg-gray-700 transition-colors ${he?"cursor-pointer":""}`,onClick:he,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center gap-1.5 flex-shrink-0 w-16",children:[e.jsx("img",{src:`https://images.hive.blog/u/${$.author}/avatar`,alt:$.author,className:"w-10 h-10 rounded-full bg-gray-700 flex-shrink-0",onError:et=>{et.target.src=`https://ui-avatars.com/api/?name=${$.author}&background=random&size=40`}}),e.jsx(It,{images:se})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("button",{onClick:et=>{et.stopPropagation(),m?.($.author)},className:"font-medium text-white hover:text-blue-400 text-sm",children:["@",$.author]}),e.jsx("span",{className:"text-xs text-gray-500",children:dn($.created)})]}),$.title&&e.jsx("button",{onClick:()=>_?.($.author,$.permlink,$.title),className:"text-left text-base font-semibold text-white mb-1 line-clamp-2 hover:text-blue-400",children:$.title}),ye&&e.jsx("p",{className:"text-gray-400 text-sm line-clamp-2",children:ye.substring(0,200)}),$.community_title&&e.jsxs("span",{className:"inline-block mt-1 text-xs text-blue-400 font-medium",children:["#",$.community_title]})]})]}),e.jsx("div",{className:"mt-3 pt-2 border-t border-gray-700/50",onClick:et=>et.stopPropagation(),children:e.jsx(jn,{author:$.author,permlink:$.permlink,currentUser:r,hiveValue:lt,hiveIconUrl:"/images/hive_logo.png",payoutTooltip:ct,initialVotes:$.active_votes||[],initialCommentsCount:$.children||0,onUpvote:x?et=>x($.author,$.permlink,et):void 0,onSubmitComment:g?(et,Pt,Zt)=>g(et,Pt,Zt):void 0,onClickCommentUpvote:v,onReblog:$.author!==r&&N?()=>N($.author,$.permlink):void 0,onShare:L?()=>L($.author,$.permlink):void 0,onTip:$.author!==r&&j?()=>j($.author,$.permlink):void 0,onReport:$.author!==r&&y?()=>Ue({author:$.author,permlink:$.permlink}):void 0,disableCommentsModal:!!H,onComments:H?()=>H($.author,$.permlink):void 0,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f})})]},`${$.author}/${$.permlink}`)},xr=$=>{const re=$.poll_stats?.total_voting_accounts_num||0,he=$.status==="Active",De=new Date($.end_time)<new Date,lt=$.post_body?Qc($.post_body):"",Ze=$.poll_choices?.length||0;return e.jsxs("div",{className:"border border-gray-700 rounded-lg bg-gray-800 hover:bg-gray-700/50 transition-colors cursor-pointer",onClick:()=>A?.($.author,$.permlink,$.question),children:[e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:`https://images.hive.blog/u/${$.author}/avatar`,alt:$.author,className:"w-8 h-8 rounded-full bg-gray-700",onError:Qe=>{Qe.target.src=`https://ui-avatars.com/api/?name=${$.author}&background=random&size=32`}}),e.jsxs("div",{children:[e.jsxs("button",{onClick:Qe=>{Qe.stopPropagation(),m?.($.author)},className:"text-sm font-medium text-white hover:text-blue-400",children:["@",$.author]}),e.jsx("p",{className:"text-[10px] text-gray-500",children:dn($.created)})]})]}),e.jsx("span",{className:`text-[10px] font-semibold px-2 py-0.5 rounded-full ${he&&!De?"bg-green-500/20 text-green-400":"bg-gray-600/30 text-gray-400"}`,children:he&&!De?"Active":"Ended"})]}),e.jsx("h3",{className:"text-sm font-semibold text-white mb-1",children:$.question}),lt&&e.jsx("p",{className:"text-gray-400 text-xs line-clamp-2 mb-2",children:lt.substring(0,150)}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-500",children:[e.jsxs("span",{children:[re," voter",re!==1?"s":""]}),e.jsxs("span",{children:[Ze," option",Ze!==1?"s":""]}),$.poll_stats?.total_hive_hp!=null&&$.poll_stats.total_hive_hp>0&&e.jsxs("span",{children:[($.poll_stats.total_hive_hp/1e3).toFixed(1),"k HP"]}),$.end_time&&e.jsx("span",{children:he&&!De?`Ends ${dn($.end_time)}`:"Ended"})]})]}),e.jsx("div",{className:"px-4 pb-3 pt-1 border-t border-gray-700/50",onClick:Qe=>Qe.stopPropagation(),children:e.jsx(jn,{author:$.author,permlink:$.permlink,currentUser:r,hiveIconUrl:"/images/hive_logo.png",initialVotes:[],initialCommentsCount:0,onUpvote:x?Qe=>x($.author,$.permlink,Qe):void 0,onSubmitComment:g?(Qe,ct,et)=>g(Qe,ct,et):void 0,onClickCommentUpvote:v,onReblog:$.author!==r&&N?()=>N($.author,$.permlink):void 0,onShare:L?()=>L($.author,$.permlink):void 0,onTip:$.author!==r&&j?()=>j($.author,$.permlink):void 0,onReport:$.author!==r&&y?()=>Ue({author:$.author,permlink:$.permlink}):void 0,disableCommentsModal:!!H,onComments:H?()=>H($.author,$.permlink):void 0,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f})})]},`${$.author}/${$.permlink}`)},br=($,re)=>e.jsx("div",{className:"border border-gray-700 rounded-lg p-4 bg-gray-800 hover:bg-gray-700 transition-colors",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:`https://images.hive.blog/u/${$}/avatar`,alt:$,className:"w-10 h-10 rounded-full flex-shrink-0 bg-gray-700",onError:he=>{he.target.src=`https://ui-avatars.com/api/?name=${$}&background=random&size=40`}}),e.jsxs("button",{onClick:()=>m?.($),className:"font-medium text-white hover:text-blue-400",children:["@",$]})]})},`${$}-${re}`),lr=($=5)=>e.jsx("div",{className:"space-y-3 animate-pulse",children:Array.from({length:$},(re,he)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-4/5 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-full mb-1.5"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-3/5 mb-3"}),he%2===0&&e.jsx("div",{className:"h-32 bg-gray-700 rounded-lg w-20 mb-3"}),e.jsxs("div",{className:"flex gap-4 mt-2",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},he))}),ur=($=8)=>e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3 animate-pulse",children:Array.from({length:$},(re,he)=>e.jsx("div",{className:"border border-gray-700 rounded-lg p-4 bg-gray-800",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-28"})]})},he))}),nr=($=3)=>e.jsx("div",{className:"space-y-3 animate-pulse",children:Array.from({length:$},(re,he)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded-full w-14"})]}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-4/5 mb-3"}),e.jsxs("div",{className:"space-y-2 mb-3",children:[e.jsx("div",{className:"h-8 bg-gray-700 rounded-lg w-full"}),e.jsx("div",{className:"h-8 bg-gray-700 rounded-lg w-full"}),e.jsx("div",{className:"h-8 bg-gray-700 rounded-lg w-3/4"})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-24"})]})]})]})},he))}),yr=()=>e.jsxs("div",{className:"space-y-3 animate-pulse",children:[e.jsxs("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-5 h-5 bg-gray-700 rounded"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-44"})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[1,2,3,4].map($=>e.jsxs("div",{className:"bg-gray-900/50 rounded-lg p-2.5",children:[e.jsx("div",{className:"h-2.5 bg-gray-700 rounded w-12 mb-2"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded w-16"})]},$))})]}),[1,2,3,4,5].map($=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-7 h-7 bg-gray-700 rounded-lg"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-1/3 mb-3"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},$))]}),Ir=()=>{switch(B){case"blogs":case"posts":case"snaps":case"comments":case"replies":return lr();case"followers":case"following":case"badges":case"witnessVotes":return ur();case"polls":return nr();case"authorRewards":case"curationRewards":return yr();default:return lr()}},st=$=>{if(!$||!isFinite($)||$<=0)return"—";const re=Math.floor($/1e3),he=Math.floor(re/60),se=Math.floor(he/60),ye=Math.floor(se/24);return ye>=1?`${ye}d ${se%24}h`:se>=1?`${se}h ${he%60}m`:`${Math.max(1,he)}m`},We=($,re=3)=>$==null||isNaN($)?"—":Number($).toLocaleString(void 0,{maximumFractionDigits:re,minimumFractionDigits:re}),Xt=()=>{if(I&&de.length===0)return yr();if(de.length===0&&!jt)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Award,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No pending author rewards"}),e.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"Rewards appear for posts/comments with pending payouts"})]});const $=de.filter(he=>!he.isComment).length,re=de.length-$;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"bg-gradient-to-r from-amber-900/30 to-orange-900/30 rounded-xl p-4 border border-amber-700/40",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(O.Award,{className:"w-5 h-5 text-amber-400"}),e.jsx("h3",{className:"text-sm font-semibold text-amber-300",children:"Pending Author Rewards"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Posts"}),e.jsx("p",{className:"text-lg font-bold text-white",children:$})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Comments"}),e.jsx("p",{className:"text-lg font-bold text-white",children:re})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HBD"}),e.jsxs("p",{className:"text-lg font-bold text-amber-400",children:["$",We(fe.totalHbd)]})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HP"}),e.jsx("p",{className:"text-lg font-bold text-orange-400",children:We(fe.totalHpEq)})]})]})]}),de.map((he,se)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700 hover:border-gray-600 transition-colors cursor-pointer",onClick:()=>_?.(he.author,he.permlink,he.title),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center flex-shrink-0 ${he.isComment?"bg-blue-900/40 text-blue-400":"bg-emerald-900/40 text-emerald-400"}`,children:he.isComment?e.jsx(O.MessageCircle,{className:"w-3.5 h-3.5"}):e.jsx(O.FileText,{className:"w-3.5 h-3.5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:"text-sm font-medium text-white truncate",children:he.title||`${he.author}/${he.permlink}`}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full flex-shrink-0 ${he.isComment?"bg-blue-900/40 text-blue-300":"bg-emerald-900/40 text-emerald-300"}`,children:he.isComment?"Comment":"Post"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 mt-2 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"w-3 h-3"}),"Payout in ",st(he.payoutMs)]}),e.jsxs("span",{className:"text-amber-400 font-medium",children:["$",We(he.hbd)," HBD"]}),he.hpEq!==null&&e.jsxs("span",{className:"text-orange-400 font-medium",children:[We(he.hpEq)," HP"]}),he.beneficiaryCut>0&&e.jsxs("span",{className:"text-gray-500",children:["Beneficiary: ",(he.beneficiaryCut*100).toFixed(0),"%"]})]})]})]})},`${he.author}-${he.permlink}-${se}`)),jt&&e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2].map(he=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-7 h-7 bg-gray-700 rounded-lg"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},he))})]})},ir=()=>{if(I&&Se.length===0)return yr();if(Se.length===0&&!jt)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.TrendingUp,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No pending curation rewards"}),e.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"Rewards appear for posts you voted on with pending payouts"})]});const $=Se.filter(ye=>!ye.isComment).length,re=Se.length-$,he=Se.filter(ye=>ye.efficiency!==null),se=he.length>0?he.reduce((ye,De)=>ye+(De.efficiency||0),0)/he.length:null;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"bg-gradient-to-r from-blue-900/30 to-purple-900/30 rounded-xl p-4 border border-blue-700/40",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(O.TrendingUp,{className:"w-5 h-5 text-blue-400"}),e.jsx("h3",{className:"text-sm font-semibold text-blue-300",children:"Pending Curation Rewards"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-3",children:[e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Posts"}),e.jsx("p",{className:"text-lg font-bold text-white",children:$})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Comments"}),e.jsx("p",{className:"text-lg font-bold text-white",children:re})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HP"}),e.jsx("p",{className:"text-lg font-bold text-blue-400",children:We(Ge.totalHp)})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HBD"}),e.jsxs("p",{className:"text-lg font-bold text-purple-400",children:["$",We(Ge.totalHbd)]})]}),se!==null&&e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Avg Efficiency"}),e.jsxs("p",{className:`text-lg font-bold ${se>=100?"text-emerald-400":"text-amber-400"}`,children:[se.toFixed(1),"%"]})]})]})]}),Se.map((ye,De)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700 hover:border-gray-600 transition-colors cursor-pointer",onClick:()=>_?.(ye.author,ye.permlink,ye.title),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center flex-shrink-0 ${ye.isComment?"bg-blue-900/40 text-blue-400":"bg-emerald-900/40 text-emerald-400"}`,children:ye.isComment?e.jsx(O.MessageCircle,{className:"w-3.5 h-3.5"}):e.jsx(O.FileText,{className:"w-3.5 h-3.5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"text-sm font-medium text-white truncate",children:ye.title||`${ye.author}/${ye.permlink}`}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["by @",ye.author]})]}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full flex-shrink-0 ${ye.isComment?"bg-blue-900/40 text-blue-300":"bg-emerald-900/40 text-emerald-300"}`,children:ye.isComment?"Comment":"Post"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 mt-2 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"w-3 h-3"}),"Payout in ",st(ye.payoutMs)]}),e.jsxs("span",{className:"text-blue-400 font-medium",children:[We(ye.hp)," HP"]}),e.jsxs("span",{className:"text-purple-400 font-medium",children:["$",We(ye.hbd)," HBD"]}),e.jsxs("span",{className:"text-gray-500",children:["Vote: ",ye.weightPct.toFixed(0),"%"]}),ye.efficiency!==null&&e.jsxs("span",{className:`font-medium ${ye.efficiency>=100?"text-emerald-400":"text-amber-400"}`,children:["Eff: ",ye.efficiency.toFixed(1),"%"]}),ye.votedAfterMs!==null&&e.jsxs("span",{className:"text-gray-500",children:["Voted after ",st(ye.votedAfterMs)]})]})]})]})},`${ye.author}-${ye.permlink}-${De}`)),jt&&e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2].map(ye=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-7 h-7 bg-gray-700 rounded-lg"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-1/3 mb-3"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-14"})]})]})]})},ye))})]})},Fr=()=>{if(B==="wallet")return e.jsx("div",{className:"max-w-lg mx-auto",children:e.jsx(u0,{username:$e})});if(B==="activities")return e.jsx(f0,{username:$e,onClickPermlink:C,onSelectActivity:T});if(B==="authorRewards")return Xt();if(B==="curationRewards")return ir();if(B==="votingPower"){if(I)return e.jsxs("div",{className:"max-w-lg mx-auto space-y-6 animate-pulse",children:[[1,2,3].map(dt=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-32"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded-full w-full"})]},dt)),e.jsxs("div",{className:"mt-4 p-4 bg-gray-800 rounded-xl border border-gray-700",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-40 mb-3"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded-full w-full"})]})]});if(!kt)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Gauge,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"Voting power data unavailable"})]});const{maxMana:se,rewardBalance:ye,recentClaims:De,feedPrice:lt}=kt,Ze=S*100,Qe=se*.02*(Ze/1e4),ct=De>0?Qe/De*ye:0,et=ct*lt,Pt=kt.upvotePower<S*2/100,Zt=(dt,or=3)=>isNaN(dt)?"—":dt.toLocaleString(void 0,{minimumFractionDigits:or,maximumFractionDigits:or}),Lt=[{label:"Voting Power",value:kt.upvotePower,color:"#10b981"},{label:"Downvote Power",value:kt.downvotePower,color:"#f59e0b"},{label:"Resource Credits",value:kt.resourceCredits,color:"#3b82f6"}];return e.jsxs("div",{className:"max-w-lg mx-auto space-y-6",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-gray-800 border border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-200",children:"Vote Value"}),e.jsxs("span",{className:"text-xs font-bold text-blue-400",children:[S,"%"]})]}),e.jsx("div",{className:"text-[13px] text-gray-400 mb-3",children:De>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-white font-medium",children:[Zt(et)," HBD"]}),e.jsx("span",{className:"mx-1.5",children:"·"}),e.jsxs("span",{className:"text-gray-300",children:["~",Zt(ct)," HIVE"]}),Pt&&e.jsx("span",{className:"ml-2 text-amber-400 text-xs",children:"⚠ low mana"})]}):e.jsxs("span",{children:["Vote @",S,"% · —"]})}),e.jsx("input",{type:"range",min:0,max:100,step:5,value:S,onChange:dt=>P(Number(dt.target.value)),className:"w-full h-2 rounded-full appearance-none cursor-pointer",style:{background:`linear-gradient(to right, #3b82f6 0%, #3b82f6 ${S}%, #374151 ${S}%, #374151 100%)`,accentColor:"#3b82f6"}}),e.jsxs("div",{className:"flex justify-between text-[11px] text-gray-500 mt-1",children:[e.jsx("span",{children:"0%"}),e.jsx("span",{children:"25%"}),e.jsx("span",{children:"50%"}),e.jsx("span",{children:"75%"}),e.jsx("span",{children:"100%"})]})]}),Lt.map(dt=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm font-medium text-gray-300",children:dt.label}),e.jsxs("span",{className:"text-sm font-bold text-white",children:[dt.value.toFixed(2),"%"]})]}),e.jsx("div",{className:"w-full bg-gray-700 rounded-full h-3",children:e.jsx("div",{className:"h-3 rounded-full transition-all duration-500 ease-out",style:{width:`${Math.min(dt.value,100)}%`,backgroundColor:dt.color}})})]},dt.label))]})}if(B==="badges")return I?ur():Ke.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Award,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No badges found"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:Ke.map((se,ye)=>br(se,ye))});if(B==="witnessVotes")return I?ur():_t.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Shield,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No witness votes found"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:_t.map((se,ye)=>br(se,ye))});if(I)return Ir();if(B==="followers")return St.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Users,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No followers found"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:St.map((se,ye)=>br(se.follower,ye))});if(B==="following")return Tt.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Users,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"Not following anyone"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:Tt.map((se,ye)=>br(se.following,ye))});if(B==="polls")return Ye.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.BarChart3,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No polls found"})]}):e.jsx("div",{className:"space-y-3",children:Ye.map(se=>xr(se))});const re={blogs:{data:W,type:"blog",icon:O.FileText},posts:{data:Q,type:"post",icon:O.FileText},snaps:{data:we,type:"post",icon:O.Camera},comments:{data:Ae,type:"comment",icon:O.MessageCircle},replies:{data:ht,type:"reply",icon:O.Reply}}[B];if(!re)return null;if(re.data.length===0){const se=re.icon;return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(se,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsxs("p",{className:"text-gray-400",children:["No ",B," found"]})]})}const he=se=>{if(B==="snaps"&&E)return()=>E(se.author,se.permlink);if((B==="blogs"||B==="posts")&&_)return()=>_(se.author,se.permlink,se.title)};return e.jsx("div",{className:"space-y-3",children:re.data.map(se=>sr(se,re.type,he(se)))})},vt=[{id:"blogs",label:"Blogs",icon:O.FileText},{id:"posts",label:"Posts",icon:O.FileText},{id:"snaps",label:"Snaps",icon:O.Camera},{id:"polls",label:"Polls",icon:O.BarChart3},{id:"comments",label:"Comments",icon:O.MessageCircle},{id:"replies",label:"Replies",icon:O.Reply},{id:"activities",label:"Activities",icon:O.Activity},{id:"authorRewards",label:"Author Rewards",icon:O.Award},{id:"curationRewards",label:"Curation Rewards",icon:O.TrendingUp},{id:"followers",label:"Followers",icon:O.Users},{id:"following",label:"Following",icon:O.Users},{id:"wallet",label:"Wallet",icon:O.Wallet},{id:"votingPower",label:"Voting Power",icon:O.Gauge},{id:"badges",label:"Badges",icon:O.Award},{id:"witnessVotes",label:"Witness Votes",icon:O.Shield}],dr=a&&a.length>0?a.map($=>vt.find(re=>re.id===$)).filter($=>$!==void 0):vt,vr=r&&r!==$e;return e.jsx("div",{className:"dark flex flex-col h-full bg-gray-900",children:e.jsxs("div",{className:"flex flex-col overflow-y-auto h-full scrollbar-hide",children:[e.jsx("div",{className:"sticky top-0 z-30 h-[56px] bg-gray-800/95 backdrop-blur-sm border-b border-gray-700 flex items-center",children:e.jsxs("div",{className:"px-4 py-2 flex items-center gap-2 w-full",children:[n&&s&&e.jsx("button",{onClick:s,className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors flex-shrink-0",children:e.jsx(O.ArrowLeft,{className:"h-5 w-5 text-gray-300"})}),e.jsx("img",{src:G.profileImage||`https://images.hive.blog/u/${$e}/avatar`,alt:$e,className:"w-8 h-8 rounded-full flex-shrink-0 bg-gray-700",onError:$=>{$.target.src=`https://images.hive.blog/u/${$e}/avatar`}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"text-sm font-semibold text-white truncate",children:`@${$e}`}),G.reputation>0&&e.jsx("span",{className:"text-[10px] bg-gray-700 text-gray-300 px-1.5 py-0.5 rounded-full flex-shrink-0",children:Gg(G.reputation)})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-400",children:[e.jsxs("button",{onClick:()=>pe("followers"),className:"hover:text-white transition-colors",children:[e.jsx("span",{className:"font-semibold text-gray-200",children:G.followersCount.toLocaleString()})," Followers"]}),e.jsxs("button",{onClick:()=>pe("following"),className:"hover:text-white transition-colors",children:[e.jsx("span",{className:"font-semibold text-gray-200",children:G.followingCount.toLocaleString()})," Following"]}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-gray-200",children:G.postsCount.toLocaleString()})," Posts"]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[V&&e.jsxs("button",{onClick:Rt,className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors relative",title:"Favourite list",children:[e.jsx(O.Heart,{className:`h-4 w-4 ${F?"text-red-500":"text-gray-400"}`,fill:F?"currentColor":"none"}),Y>0&&e.jsx("span",{className:"absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full h-4 w-4 flex items-center justify-center",children:Y>99?"99+":Y})]}),e.jsx("button",{onClick:mt,className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors",title:"Share profile",children:e.jsx(O.Share2,{className:"h-4 w-4 text-gray-400"})}),vr&&e.jsxs("div",{className:"relative",ref:xt,children:[e.jsx("button",{onClick:()=>Et($=>!$),className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors",title:"More actions",children:e.jsx(O.MoreVertical,{className:"h-4 w-4 text-gray-400"})}),Yt&&e.jsxs("div",{className:"absolute right-0 mt-1 w-48 rounded-lg border border-gray-700 bg-gray-800 shadow-xl z-[100]",onClick:$=>$.stopPropagation(),children:[(u||p)&&e.jsx("button",{onClick:()=>{Et(!1),Ot()},disabled:Mt,className:"w-full px-4 py-2.5 text-left text-sm text-gray-200 hover:bg-gray-700 disabled:opacity-50 first:rounded-t-lg",children:G.isFollowing?"Unfollow":"Follow"}),b&&e.jsx("button",{onClick:()=>{Et(!1),ge(!0)},disabled:Mt,className:"w-full px-4 py-2.5 text-left text-sm text-red-400 hover:bg-red-900/20 disabled:opacity-50",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(O.Ban,{className:"h-4 w-4"})," Ignore Author"]})}),w&&e.jsx("button",{onClick:()=>{Et(!1),Pe(!0)},disabled:Mt,className:"w-full px-4 py-2.5 text-left text-sm text-orange-400 hover:bg-orange-900/20 disabled:opacity-50 last:rounded-b-lg",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(O.Flag,{className:"h-4 w-4"})," Report User"]})})]})]})]})]})}),e.jsxs("div",{className:"relative",children:[G.coverImage?e.jsx("div",{className:"w-full h-24 sm:h-32 bg-cover bg-center",style:{backgroundImage:`url(${G.coverImage})`}}):e.jsx("div",{className:"w-full h-24 sm:h-32 bg-gradient-to-r from-blue-600 to-purple-700"}),e.jsx("div",{className:"absolute inset-0 bg-gray-900/80"}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 px-4 pb-3 pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"text-sm font-semibold text-white truncate",children:G.name||`@${$e}`}),G.about&&e.jsx("p",{className:"text-gray-300 text-xs leading-relaxed mt-1 line-clamp-2",children:G.about})]}),z&&e.jsx("button",{onClick:qt,className:"p-2 hover:bg-white/10 rounded-lg transition-colors ml-2 flex-shrink-0",title:F?"Remove from favourites":"Add to favourites",children:e.jsx(O.Heart,{className:`h-5 w-5 ${F?"text-red-500":"text-white"}`,fill:F?"currentColor":"none"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 mt-1.5 text-[11px] text-gray-300",children:[G.location&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.MapPin,{className:"h-3 w-3 text-rose-400"})," ",G.location]}),G.website&&e.jsxs("a",{href:G.website.startsWith("http")?G.website:`https://${G.website}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-blue-400 hover:underline",children:[e.jsx(O.Globe,{className:"h-3 w-3 text-blue-400"})," ",G.website]}),G.created&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Calendar,{className:"h-3 w-3 text-green-400"})," ",Jg(G.created)]}),G.lastActivity&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"h-3 w-3 text-amber-400"})," ",dn(G.lastActivity)]}),G.votingPower!==void 0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Zap,{className:"h-3 w-3 text-yellow-400"})," VP ",G.votingPower.toFixed(1),"%"]}),G.hivePower!==void 0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Zap,{className:"h-3 w-3 text-orange-400"})," HP ",G.hivePower.toFixed(0)]})]})]})]}),e.jsxs("div",{className:"sticky top-[56px] z-20 bg-gray-800 border-b border-gray-700 relative flex items-center",children:[cr&&e.jsx("button",{onClick:()=>Mr("left"),className:"absolute left-0 z-10 h-full px-2 bg-gray-700 hover:bg-gray-600 flex items-center shadow-md transition-colors",children:e.jsx(O.ChevronLeft,{className:"h-4 w-4 text-white"})}),e.jsx("div",{ref:Je,className:"flex overflow-x-auto scrollbar-hide",children:dr.map($=>{const re=$.icon;return e.jsxs("button",{onClick:()=>pe($.id),className:`flex items-center gap-1 px-3 sm:px-4 py-2.5 text-xs sm:text-sm font-medium whitespace-nowrap transition-colors border-b-2 ${B===$.id?"text-blue-400 border-blue-400":"text-gray-400 border-transparent hover:text-gray-300 hover:border-gray-600"}`,children:[e.jsx(re,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:$.label})]},$.id)})}),rr&&e.jsx("button",{onClick:()=>Mr("right"),className:"absolute right-0 z-10 h-full px-2 bg-gray-700 hover:bg-gray-600 flex items-center shadow-md transition-colors",children:e.jsx(O.ChevronRight,{className:"h-4 w-4 text-white"})})]}),e.jsxs("div",{className:"p-4 flex-1",children:[Fr(),B!=="wallet"&&Xe[B]&&e.jsx("div",{ref:Dt,className:"min-h-[60px] py-2",children:be?e.jsx("div",{className:"animate-pulse space-y-3",children:B==="followers"||B==="following"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:[1,2].map($=>e.jsx("div",{className:"border border-gray-700 rounded-lg p-4 bg-gray-800",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-28"})]})},$))}):e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24 mb-2"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-1/2"})]})]})})}):e.jsx("div",{className:"h-1"})}),B!=="wallet"&&!Xe[B]&&!I&&e.jsxs("div",{className:"text-center py-4 text-xs text-gray-600",children:["No more ",B," to load"]})]}),ft&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[1000] p-4",onClick:()=>ge(!1),children:e.jsxs("div",{className:"bg-gray-800 rounded-xl shadow-xl max-w-sm w-full border border-gray-700 p-6",onClick:$=>$.stopPropagation(),children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"Ignore Author"}),e.jsxs("p",{className:"text-sm text-gray-300 mb-6",children:["Are you sure you want to ignore"," ",e.jsxs("span",{className:"text-red-400 font-medium",children:["@",$e]}),"? Their content will be hidden from your feed."]}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx("button",{onClick:()=>ge(!1),disabled:Mt,className:"px-4 py-2 text-sm font-medium rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700 disabled:opacity-50",children:"Cancel"}),e.jsx("button",{onClick:Gt,disabled:Mt,className:"px-4 py-2 text-sm font-medium rounded-lg text-white bg-red-600 hover:bg-red-700 disabled:opacity-50",children:Mt?"Processing...":"Confirm Ignore"})]})]})}),e.jsx(Kc,{isOpen:Te,onClose:()=>Pe(!1),onReport:At,reportType:"user",targetUsername:$e}),e.jsx(Kc,{isOpen:!!He,onClose:()=>Ue(null),onReport:async $=>{if(He&&y){await y(He.author,He.permlink,$);const re=he=>he.author===He.author&&he.permlink===He.permlink;te(he=>he.filter(se=>!re(se))),Ie(he=>he.filter(se=>!re(se))),Me(he=>he.filter(se=>!re(se))),le(he=>he.filter(se=>!re(se))),Ne(he=>he.filter(se=>!re(se))),ae(he=>he.filter(se=>!re(se)))}Ue(null)},reportType:"post",targetUsername:He?.author||"",targetPermlink:He?.permlink})]})})},Xg=t=>{window.open(t,"_blank")},Zg=({app:t,backgroundColor:r,boxShadow:s})=>{const n=()=>{Xg(t.url)};return e.jsx("div",{className:"card hover-lift cursor-pointer transition-all duration-300 h-full",onClick:n,style:{backgroundColor:r??"rgba(15,23,42,0.9)",boxShadow:s??"0 18px 45px rgba(0,0,0,0.6)",border:"1px solid rgba(148,163,184,0.25)"},children:e.jsx("div",{className:"card-body p-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex-shrink-0",children:t.useCircleBackground!==!1?e.jsx("div",{className:"avatar",children:e.jsx("div",{className:"w-16 h-16 rounded-full",children:e.jsx("img",{src:t.imagePath,alt:`${t.name} logo`,className:"w-full h-full object-cover",onError:a=>{a.currentTarget.src="/placeholder.svg"}})})}):e.jsx("img",{src:t.imagePath,alt:`${t.name} logo`,className:"w-16 h-16 object-contain",onError:a=>{a.currentTarget.src="/placeholder.svg"}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("h3",{className:"card-title text-lg font-bold text-base-content mb-2 line-clamp-2",children:t.name}),t.isComingSoon&&e.jsx("div",{className:"badge badge-warning badge-sm",children:"Coming Soon"})]}),e.jsx("div",{className:"text-base-content/70 text-sm leading-relaxed",children:t.description.split(`
1141
1141
  `).map((a,i)=>e.jsx("div",{className:"mb-1",children:a},i))})]})]})})})},Kg=()=>{const[t,r]=k.useState({width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0});k.useEffect(()=>{const i=()=>{r({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]);const s=t.width<850,n=t.width<=1050&&t.width>=850,a=t.width>1050;return{isMobileView:s,isTabletView:n,isWebView:a,screenSize:t}},Qg=({apps:t,cardBackgroundColor:r,cardShadow:s})=>{const{isMobileView:n,isTabletView:a}=Kg(),i=()=>n?"grid-cols-1":a?"grid-cols-2":"grid-cols-3";return e.jsx("div",{className:"container mx-auto px-4 lg:px-16",children:e.jsx("div",{className:`grid ${i()} gap-6 lg:gap-8`,children:t.map((o,c)=>e.jsx(Zg,{app:o,backgroundColor:r,boxShadow:s},c))})})},ex=[{imagePath:rt.hreplier,name:"hReplier",url:"https://hreplier.sagarkothari88.one/",description:`- Easily Manage your Hive Blog's replies
1142
1142
  - We are working on Hive Inbox as Key contributors`},{imagePath:rt.template,name:"hSnaps",url:"https://hsnaps.sagarkothari88.one/",description:`- A Snaps App for Hive Blockchain
1143
1143
  - We are working on Hive Snaps as Key contributors`},{imagePath:rt.hive_fest_fact_logo,name:"Hive Fest Fact",url:"https://hivefestfacts.sagarkothari88.one/",description:"- Hive Fest Facts is a platform dedicated to sharing interesting and informative facts about Hive Fest, the annual gathering of the Hive blockchain community."},{imagePath:rt.hpolls_logo,name:"hPolls",url:"https://hpolls.sagarkothari88.one/",description:`- Create and manage polls on the Hive blockchain