hive-react-kit 0.8.6 → 0.8.7

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
@@ -1068,7 +1068,7 @@ and ensure you are accounting for this risk.
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 $o=({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,y]=k.useState(!0),[w,x]=k.useState(!1),g=k.useMemo(()=>{const ae=t.active_votes||[];if(!n)return!1;const ee=n.toLowerCase();return ae.some(je=>(je.voter||"").toLowerCase()===ee)},[t.active_votes,n]),[v,N]=k.useState(!1),[_,b]=k.useState(""),[m,j]=k.useState(!1),E=ae=>{b(ae),N(!0),setTimeout(()=>N(!1),2500)},A=t.depth||0;let D=r.filter(ae=>ae.parent_author===t.author&&ae.parent_permlink===t.permlink&&(typeof ae.depth!="number"||ae.depth===A+1));if((!D||D.length===0)&&Array.isArray(t.replies)&&t.replies.length>0){const ae=new Set(t.replies);D=r.filter(ee=>ae.has(`${ee.author}/${ee.permlink}`))}const T=D.length>0,M=o>=4,J=(ae,ee)=>{if(!ee)return ae;const je=new RegExp(`(${ee})`,"gi");return ae.replace(je,'<mark class="bg-yellow-800">$1</mark>')},B=()=>{x(!0)},q=async ae=>{if(d){try{await Promise.resolve(d(t.author,t.permlink,ae)),u(!0),x(!1),setTimeout(()=>{c?.(),E("Vote submitted successfully!")},3e3)}catch(ee){const je=ee instanceof Error?ee.message:"Failed to upvote";Or({title:"Error",description:je})}return}if(!a){E("Please login or provide an upvote handler to vote");return}try{const ee=Math.round(ae*100);await At.handleUpvote({author:t.author,permlink:t.permlink,weight:ee,authToken:a}),u(!0),x(!1),j(!0),setTimeout(()=>{c?.(),j(!1),E("Vote submitted successfully ✅")},3e3)}catch(ee){const je=ee instanceof Error?ee.message:"Failed to upvote";Or({title:"Error",description:je}),j(!1)}},F=()=>{n?s(t.author,t.permlink):E("Please login to upvote")},X=t.json_metadata_parsed||(()=>{try{return t.json_metadata?JSON.parse(t.json_metadata):void 0}catch{return}})(),G=t.body||"",oe=(ae=>{const ee=/^(\s*(?:#[\p{L}\p{N}_-]+\s*(?:,\s*)?)+\s*)$/gimu;return ae.replace(ee,"").trim()})(G),be=i?J(oe,i):oe,V=/!\[[^\]]*\]\([^)]+\)/.test(oe)||/<img\s/i.test(oe),W=Array.isArray(X?.image)?X.image:[],U=new qn.DefaultRenderer({baseUrl:"https://hive.blog/",breaks:!0,skipSanitization:!1,allowInsecureScriptTags:!1,addNofollowToLinks:!0,doNotShowImages:!1,assetsWidth:640,assetsHeight:480,imageProxyFn:ae=>ae,usertagUrlFn:ae=>`/@${ae}`,hashtagUrlFn:ae=>`/trending/${ae}`,isLinkSafeFn:ae=>!0,addExternalCssClassToMatchingLinksFn:ae=>!0,ipfsPrefix:"https://ipfs.io/ipfs/"}),de=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:ae=>{ae.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:vs.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:be}}):e.jsx("div",{className:"text-left",dangerouslySetInnerHTML:{__html:U.render(oe)}})}),!V&&W.length>0&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-3",children:W.map((ae,ee)=>e.jsx("img",{src:ae,alt:`image-${ee}`,className:"max-w-full h-auto rounded-lg shadow-sm cursor-pointer hover:shadow-md transition-shadow duration-200",onClick:()=>window.open(ae,"_blank")},ae+ee))}),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}B()}else if(l){if(!n){E("Please login to upvote");return}if(g||h){E("You have already upvoted this comment");return}B()}else{if(!n){E("Please login to upvote");return}a?g?E("You have already upvoted this comment"):B():(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:de})]}),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"})]}),T&&e.jsx("button",{onClick:()=>y(!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"," ",D.length," ",D.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(Hn,{author:t.author,permlink:t.permlink,onUpvote:q,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:_})})]})]})}),T&&p&&!M&&e.jsx("div",{className:"space-y-0",children:D.map(ae=>e.jsx($o,{comment:ae,allComments:r,onReply:s,currentUser:n,searchQuery:i,depth:o+1,onVotedRefresh:c,onClickCommentUpvote:d,onClickCommentReply:f,onClickUpvoteButton:l},ae.permlink))}),T&&M&&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 ",D.length," more ",D.length===1?"reply":"replies"]})})]})};async function up(t){const r=await t.arrayBuffer(),s=new Uint8Array(r),n=new TextEncoder().encode("ImageSigningChallenge"),a=new Uint8Array(n.length+s.length);return a.set(n),a.set(s,n.length),JSON.stringify({type:"Buffer",data:Array.from(a)})}async function zn(t,r,s,n,a){if(!r)throw new Error("Hive username is required for image upload");const i=await up(s);a?.onSignStart?.();let o;try{o=await t(i)}finally{a?.onSignEnd?.()}if(!o)throw new Error("Image signing returned empty signature");const c=new FormData;n?c.append("file",s,n):c.append("file",s);const d=await fetch(`https://images.hive.blog/${r}/${o}`,{method:"POST",body:c,signal:a?.signal});if(!d.ok)throw new Error(`Hive image upload failed: ${d.statusText}`);const f=await d.json();if(!f.url)throw new Error("No URL returned from Hive image upload");return f.url}function bo(t){if(t==null)return"Failed to upload image";if(typeof t=="string")return t;if(t instanceof Error){if(t.message&&t.message!=="[object Object]")return t.message;const r=t;if(r.cause)return bo(r.cause);if(typeof r.error=="string")return r.error;if(r.error&&typeof r.error=="object")return bo(r.error)}if(typeof t=="object"){const r=t;if(typeof r.message=="string"&&r.message!=="[object Object]")return r.message;if(typeof r.error=="string")return r.error;if(r.cmd==="sign_nack"||r.cmd==="auth_nack")return"Request rejected in wallet";if(r.cmd==="sign_err"||r.cmd==="auth_err")return typeof r.error=="string"?r.error:"Wallet error";if(r.data&&typeof r.data.msg=="string")return r.data.msg;try{const s=JSON.stringify(t);if(s&&s!=="{}")return s}catch{}}return"Failed to upload image"}const i0=({onImageUploaded:t,ecencyToken:r,onSignMessage:s,signingUsername:n,onSigningStateChange:a,walletApprovalLabel:i="Open Keychain App & Approve",disabled:o=!1})=>{const c=k.useRef(null),d=k.useRef(null),[f,l]=k.useState(!1),[h,u]=k.useState(null),[p,y]=k.useState(null),[w,x]=k.useState(!1),g=()=>{d.current&&(d.current.abort(),d.current=null),x(!1),a?.(!1)},v=m=>{const j=m.target.files?.[0];if(j){if(g(),!j.type.startsWith("image/")){u("Please select an image file");return}if(j.size>10*1024*1024){u("File size must be less than 10MB");return}u(null),y(URL.createObjectURL(j)),_(j)}},N=async(m,j)=>{if(!r)throw new Error("Ecency token not provided");const E=new FormData;E.append("file",m);const A=await fetch("https://images.ecency.com/hss/"+r,{method:"POST",headers:{accept:"application/json, text/plain, */*",origin:"https://ecency.com",referer:"https://ecency.com/"},body:E,signal:j});if(!A.ok)throw new Error(`Upload failed: ${A.statusText}`);const S=await A.json();if(!S.url)throw new Error("No URL returned from upload");return S.url},_=async m=>{const j=new AbortController;d.current=j;const E=j.signal;l(!0),u(null);try{const A=!!(s&&n);if(!r&&!A)throw new Error("No upload method configured");let S;try{S=await N(m,E)}catch(D){if(E.aborted)return;if(!A)throw D;S=await zn(s,n,m,void 0,{onSignStart:()=>{E.aborted||(x(!0),a?.(!0))},onSignEnd:()=>{x(!1),a?.(!1)},signal:E})}if(E.aborted)return;t(S),y(null),c.current&&(c.current.value="")}catch(A){if(E.aborted)return;console.error("[ImageUploader] upload error:",A),u(bo(A))}finally{d.current===j&&(d.current=null),E.aborted||l(!1)}},b=()=>{g(),l(!1),y(null),u(null),c.current&&(c.current.value="")};return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:c,type:"file",accept:"image/*",onChange:v,className:"hidden",disabled:o||f}),e.jsx("button",{type:"button",onClick:()=>!o&&!f&&c.current?.click(),disabled:o||f,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Upload Image",children:f?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Upload,{className:"h-4 w-4"})}),(p||h)&&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:h?"Upload Error":"Image Preview"}),e.jsx("button",{type:"button",onClick:b,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:h?e.jsx("div",{className:"text-red-400 text-sm",children:h}):p?e.jsxs("div",{className:"space-y-4",children:[e.jsx("img",{src:p,alt:"Preview",className:"w-full max-h-64 object-contain rounded"}),w?e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-sm text-amber-400 animate-pulse",children:i})}):f?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]}):null})]})})]})},yo="https://audio.3speak.tv",cp="sk_demo_b0d3f4b972c5065b701394df3de2f44fd59aa3244c58c478",dp=".mp3,.wav,.ogg,.m4a,.aac,.flac,.weba,.opus,audio/mpeg,audio/wav,audio/ogg,audio/aac,audio/flac,audio/webm,audio/opus",fp=50*1024*1024,Xi=300;function zc(t){const r=Math.floor(t/60),s=t%60;return`${r}:${String(s).padStart(2,"0")}`}function hp(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 mp=/\.(mp3|wav|ogg|m4a|aac|flac|weba|opus)$/i;function pp(t){return mp.test(t)}function gp(t){return t.split(".").pop()?.toLowerCase()??"m4a"}function xp(t){return`${yo}/play?a=${t}&mode=minimal&iframe=1`}function bp(){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 o0=({onAudioUploaded:t,username:r,threeSpeakApiKey:s,disabled:n=!1})=>{const a=s||cp,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),[y,w]=k.useState(null),[x,g]=k.useState(!1),[v,N]=k.useState(0),[_,b]=k.useState(null),[m,j]=k.useState(null),[E,A]=k.useState(!1),[S,D]=k.useState(null),[T,M]=k.useState(null),[J,B]=k.useState(null);k.useEffect(()=>()=>{d.current&&clearInterval(d.current),m&&URL.revokeObjectURL(m),T&&URL.revokeObjectURL(T),f.current&&(f.current.pause(),f.current=null)},[]),k.useEffect(()=>{x&&v>=Xi&&X()},[x,v]);const q=k.useCallback(()=>{d.current&&clearInterval(d.current),m&&URL.revokeObjectURL(m),T&&URL.revokeObjectURL(T),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),b(null),j(null),A(!1),D(null),M(null),B(null),i.current&&(i.current.value="")},[m,T]),F=async()=>{w(null),b(null),m&&URL.revokeObjectURL(m),j(null),N(0);try{const ae=await navigator.mediaDevices.getUserMedia({audio:!0}),ee=new MediaRecorder(ae,{mimeType:bp()});o.current=ee,c.current=[],ee.ondataavailable=je=>{je.data.size>0&&c.current.push(je.data)},ee.onstop=()=>{ae.getTracks().forEach(K=>K.stop());const je=new Blob(c.current,{type:ee.mimeType}),Re=URL.createObjectURL(je);b(je),j(Re),g(!1),d.current&&clearInterval(d.current)},ee.start(100),g(!0),d.current=setInterval(()=>{N(je=>je+1)},1e3)}catch{w("Microphone access denied. Please allow microphone permission.")}},X=()=>{o.current&&o.current.state!=="inactive"&&o.current.stop()},G=()=>{m&&URL.revokeObjectURL(m),f.current&&(f.current.pause(),f.current=null),b(null),j(null),N(0),A(!1),w(null)},se=()=>{if(!m)return;if(E&&f.current){f.current.pause(),A(!1);return}const ae=new Audio(m);f.current=ae,ae.onended=()=>A(!1),ae.play(),A(!0)},oe=async()=>{if(!_)return;const ae=new File([_],`recording-${Date.now()}.webm`,{type:_.type});await U(ae,v)},be=ae=>{const ee=ae.target.files?.[0];if(ee){if(ee.type.startsWith("video/")){w("Video files are not allowed. Please select an audio file.");return}if(!ee.type.startsWith("audio/")&&!pp(ee.name)){w("Please select an audio file (MP3, WAV, OGG, M4A, etc.)");return}if(ee.size>fp){w("File size must be less than 50MB");return}w(null),D(ee),B(ee.name),M(URL.createObjectURL(ee)),h("gallery-preview")}},V=async()=>{if(!S)return;const ae=await hp(S);await U(S,ae)},W=()=>{T&&URL.revokeObjectURL(T),D(null),M(null),B(null),w(null),h("pick"),i.current&&(i.current.value="")},U=async(ae,ee)=>{p(!0),w(null);try{if(!r)throw new Error("Please log in to upload audio.");const je=ae instanceof File?gp(ae.name):"webm",Re=new FormData;Re.append("audio",ae),Re.append("duration",String(ee)),Re.append("format",je),Re.append("title",`Audio by ${r}`);const K=await fetch(`${yo}/api/audio/upload`,{method:"POST",headers:{"X-API-Key":a,"X-User":r},body:Re});if(!K.ok){const we=await K.json().catch(()=>null);throw new Error(we?.message??we?.error??`Upload failed: ${K.statusText}`)}const re=await K.json();if(re.error)throw new Error(re.error);let ue;if(re.permlink)ue=xp(re.permlink);else if(re.playUrl)ue=re.playUrl;else if(re.cid)ue=`${yo}/play?cid=${re.cid}&mode=minimal&iframe=1`;else throw new Error("No audio URL returned from upload");t(ue,ee),q()}catch(je){w(je instanceof Error?je.message:"Failed to upload audio")}finally{p(!1)}},de=v/Xi*100;return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:i,type:"file",accept:dp,onChange:be,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:q,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:[y&&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:y}),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:zc(v)}),e.jsx("p",{className:"mt-1 text-xs text-gray-400",children:x?"Recording...":_?"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(de,100)}%`}})}),e.jsxs("p",{className:"text-xs text-gray-400",children:["Max ",zc(Xi)]}),_?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:se,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:()=>{oe()},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?X: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:[J&&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:J})]}),T&&e.jsx("audio",{src:T,controls:!0,className:"w-full rounded-lg",preload:"metadata"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:W,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:()=>{V()},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:W,className:"text-center text-xs text-gray-400 hover:text-white transition-colors",children:"Back to options"})]})]})]})})]})},yp="https://embed.3speak.tv/uploads",vp="sk_demo_b0d3f4b972c5065b701394df3de2f44fd59aa3244c58c478",wp=100*1024*1024,Np=5*1024*1024,jp="video/mp4,video/quicktime,video/webm,video/3gpp,.mp4,.mov,.webm,.3gp",Wc=90;function ln(t){return t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Ki(t){const r=Math.floor(t/60),s=t%60;return`${r}:${String(s).padStart(2,"0")}`}function _p(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 kp(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 Ep(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 Ap(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 Sp(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 Cp(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:yp,metadata:{filename:t.name,filetype:t.type||"video/mp4",frontend_app:"hive-react-kit",owner:r,short:"true",duration:String(s)},chunkSize:Np,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 y=p.getHeader("X-Embed-URL");y&&(f=y)},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 l0=({onVideoUploaded:t,username:r,ecencyToken:s,onSignMessage:n,threeSpeakApiKey:a,disabled:i=!1})=>{const o=a||vp,c=k.useRef(null),d=k.useRef(null),[f,l]=k.useState(!1),[h,u]=k.useState(null),[p,y]=k.useState(null),[w,x]=k.useState(null),[g,v]=k.useState(0),[N,_]=k.useState("16/9"),[b,m]=k.useState(null),[j,E]=k.useState(!1),[A,S]=k.useState(null),[D,T]=k.useState(null);k.useEffect(()=>()=>{d.current&&d.current.abort(),b&&URL.revokeObjectURL(b)},[]);const M=k.useCallback(()=>{d.current&&(d.current.abort(),d.current=null),b&&URL.revokeObjectURL(b),l(!1),u(null),y(null),x(null),v(0),_("16/9"),m(null),E(!1),S(null),T(null),c.current&&(c.current.value="")},[b]),J=async X=>{const G=X.target.files?.[0];if(G){if(!G.type.startsWith("video/")){T("Please select a video file (MP4, MOV, WebM, etc.)");return}if(G.size>wp){T(`Video file is too large (${ln(G.size)}). Maximum is 100 MB.`);return}T(null),u(G),m(URL.createObjectURL(G));try{const se=await kp(G);if(v(se.duration),_(se.width&&se.height?`${se.width}/${se.height}`:"9/16"),se.width&&se.height&&se.width>se.height){T(`Only portrait (vertical) videos are allowed. Your video is ${se.width}×${se.height} (landscape). Please record or crop in portrait mode.`);return}if(se.duration>Wc){T(`Video is too long (${Ki(se.duration)}). Maximum is ${Ki(Wc)}.`);return}const oe=await _p(G);y(oe.dataUrl),x(oe.blob)}catch{console.warn("Failed to generate thumbnail")}}},B=async()=>{if(!h||!r){T(r?"No video selected.":"Please log in to upload videos.");return}E(!0),T(null),S({bytesUploaded:0,bytesTotal:h.size,percentage:0});const X=new AbortController;d.current=X;try{let G=Promise.resolve(null);if(w){const V=`video-thumbnail-${Date.now()}.jpg`;G=(async()=>{if(s)try{return await Ep(w,s)}catch{}if(n&&r)try{return await zn(n,r,w,V)}catch{}return null})()}const se=await Cp(h,r,g,o,V=>S(V),X.signal),oe=await G;if(oe&&se.embedUrl){const V=Sp(se.embedUrl);V&&await Ap(V,oe,o)}const be=h;t(se.embedUrl,se.uploadUrl,N,be),M()}catch(G){X.signal.aborted||T(G instanceof Error?G.message:"Failed to upload video.")}finally{E(!1),d.current=null}},q=()=>{d.current&&(d.current.abort(),d.current=null),E(!1),S(null)},F=()=>{b&&URL.revokeObjectURL(b),u(null),y(null),x(null),v(0),m(null),T(null),S(null),c.current&&(c.current.value="")};return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:c,type:"file",accept:jp,onChange:J,className:"hidden",disabled:i||j}),e.jsx("button",{type:"button",onClick:()=>{!i&&!j&&(T(null),l(!0),c.current?.click())},disabled:i||j,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Upload Video",children:j?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Video,{className:"h-4 w-4"})}),f&&h&&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:M,disabled:j,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:[D&&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:D}),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:[p?e.jsx("img",{src:p,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"})}),!j&&!D&&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:h.name}),e.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:[ln(h.size),g>0&&` · ${Ki(g)}`]})]})]}),b&&!j&&e.jsx("div",{className:"mb-4 overflow-hidden rounded-lg bg-black",style:{maxHeight:"280px"},children:e.jsx("video",{src:b,controls:!0,playsInline:!0,preload:"metadata",className:"w-full",style:{maxHeight:"280px"}})}),j&&A&&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:[A.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:`${A.percentage}%`}})}),e.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:[ln(A.bytesUploaded)," / ",ln(A.bytesTotal)]})]}),e.jsx("div",{className:"flex gap-2",children:j?e.jsx("button",{type:"button",onClick:q,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:F,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:()=>{B()},disabled:!!D,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"})]})})]})]})})]})},u0=({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 y=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 _=await N.json();c(_.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(),y(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},vo={Smileys:["😀","😃","😄","😁","😆","😅","🤣","😂","🙂","🙃","😉","😊","😇","🥰","😍","🤩","😘","😗","😚","😙","🥲","😋","😛","😜","🤪","😝","🤑","🤗","🤭","🤫","🤔","🫡","🤐","🤨","😐","😑","😶","🫥","😏","😒","🙄","😬","🤥","😌","😔","😪","🤤","😴","😷","🤒","🤕","🤢","🤮","🥵","🥶","🥴","😵","🤯","🤠","🥳","🥸","😎","🤓","🧐","😕","🫤","😟","🙁","☹️","😮","😯","😲","😳","🥺","🥹","😦","😧","😨","😰","😥","😢","😭","😱","😖","😣","😞","😓","😩","😫","🥱","😤","😡","😠","🤬","😈","👿"],Gestures:["👋","🤚","🖐️","✋","🖖","🫱","🫲","🫳","🫴","👌","🤌","🤏","✌️","🤞","🫰","🤟","🤘","🤙","👈","👉","👆","🖕","👇","☝️","🫵","👍","👎","✊","👊","🤛","🤜","👏","🙌","🫶","👐","🤲","🤝","🙏","✍️","💅","🤳","💪","🦾","🦿","🦵","🦶","👂","🦻"],People:["👶","🧒","👦","👧","🧑","👱","👨","🧔","👩","🧓","👴","👵","🙍","🙎","🙅","🙆","💁","🙋","🧏","🙇","🤦","🤷","👮","🕵️","💂","🥷","👷","🫅","🤴","👸","👳","👲","🧕","🤵","👰","🤰","🫃","🤱","👼","🎅","🤶","🦸","🦹","🧙","🧚","🧛","🧜","🧝"],Animals:["🐶","🐱","🐭","🐹","🐰","🦊","🐻","🐼","🐻‍❄️","🐨","🐯","🦁","🐮","🐷","🐸","🐵","🙈","🙉","🙊","🐒","🐔","🐧","🐦","🐤","🐣","🐥","🦆","🦅","🦉","🦇","🐺","🐗","🐴","🦄","🐝","🪱","🐛","🦋","🐌","🐞","🐜","🪰","🪲","🪳","🦟","🦗","🕷️","🐢","🐍","🦎","🦖","🦕","🐙","🦑","🦐","🦞","🦀","🐡","🐠","🐟","🐬","🐳","🐋","🦈"],Food:["🍏","🍎","🍐","🍊","🍋","🍌","🍉","🍇","🍓","🫐","🍈","🍒","🍑","🥭","🍍","🥥","🥝","🍅","🍆","🥑","🥦","🥬","🥒","🌶️","🫑","🌽","🥕","🫒","🧄","🧅","🥔","🍠","🥐","🥯","🍞","🥖","🥨","🧀","🥚","🍳","🧈","🥞","🧇","🥓","🥩","🍗","🍖","🌭","🍔","🍟","🍕","🫓","🥪","🥙","🧆","🌮","🌯","🫔","🥗","🥘","🫕","🥫","🍝","🍜","🍲","🍛","🍣","🍱","🥟","🦪","🍤","🍙","🍚","🍘","🍥","🥠","🥮","🍢","🍡","🍧","🍨","🍦","🥧","🧁","🍰","🎂","🍮","🍭","🍬","🍫","🍿","🍩","🍪","🌰","🥜","🍯"],Travel:["🚗","🚕","🚙","🚌","🚎","🏎️","🚓","🚑","🚒","🚐","🛻","🚚","🚛","🚜","🏍️","🛵","🚲","🛴","🛹","🛼","🚁","🛸","🚀","🛩️","✈️","🚢","⛵","🚤","🛥️","🛳️","⛴️","🚂","🏠","🏡","🏢","🏣","🏤","🏥","🏦","🏨","🏩","🏪","🏫","🏬","🏭","🏯","🏰","💒","🗼","🗽","⛪","🕌","🛕","🕍","⛩️","🕋","⛲","⛺","🌁","🌃","🏙️","🌄","🌅","🌆"],Objects:["⌚","📱","📲","💻","⌨️","🖥️","🖨️","🖱️","🖲️","🕹️","🗜️","💾","💿","📀","📼","📷","📸","📹","🎥","📽️","🎞️","📞","☎️","📟","📠","📺","📻","🎙️","🎚️","🎛️","🧭","⏱️","💡","🔦","🕯️","🪔","🧯","🛢️","💸","💵","💴","💶","💷","🪙","💰","💳","💎","⚖️","🪜","🧰","🪛","🔧","🔨","⚒️","🛠️","⛏️","🪚","🔩","⚙️","🪤","🧲","🔫","💣","🧨","🪓","🔪","🗡️","⚔️","🛡️","🚬","⚰️","🪦","⚱️","🏺","🔮","📿","🧿","🪬","💈","⚗️"],Symbols:["❤️","🧡","💛","💚","💙","💜","🖤","🤍","🤎","💔","❤️‍🔥","❤️‍🩹","❣️","💕","💞","💓","💗","💖","💘","💝","💟","☮️","✝️","☪️","🕉️","☸️","✡️","🔯","🕎","☯️","☦️","🛐","⛎","♈","♉","♊","♋","♌","♍","♎","♏","♐","♑","♒","♓","🆔","⚛️","🉑","☢️","☣️","📴","📳","🈶","🈚","🈸","🈺","🈷️","✴️","🆚","💮","🉐","㊙️","㊗️","🈴","🈵","🈹","🈲","🅰️","🅱️","🆎","🅾️","🆑","🆘","❌","⭕","🛑","⛔","📛","🚫","💯","💢","♨️","🚷","🚯","🚳","🚱","🔞","📵","🚭","❗","❕","❓","❔","‼️","⁉️","🔅","🔆","〽️","⚠️","🚸","🔱","⚜️","🔰","♻️","✅","🈯","💹","❇️","✳️","❎","🌐","💠","🔘","🔳","🔲","⬛","⬜","◼️","◻️","◾","◽","▪️","▫️","🔴","🟠","🟡","🟢","🔵","🟣","🟤","⚫","⚪"],Flags:["🏁","🚩","🎌","🏴","🏳️","🏳️‍🌈","🏳️‍⚧️","🏴‍☠️","🇦🇫","🇦🇱","🇩🇿","🇦🇸","🇦🇩","🇦🇴","🇦🇮","🇦🇬","🇦🇷","🇦🇲","🇦🇺","🇦🇹","🇧🇸","🇧🇭","🇧🇩","🇧🇧","🇧🇾","🇧🇪","🇧🇿","🇧🇯","🇧🇹","🇧🇴","🇧🇦","🇧🇼","🇧🇷","🇧🇳","🇧🇬","🇧🇫","🇧🇮","🇨🇦","🇨🇳","🇨🇴","🇨🇷","🇭🇷","🇨🇺","🇨🇿","🇩🇰","🇩🇴","🇪🇨","🇪🇬","🇸🇻","🇪🇹","🇫🇮","🇫🇷","🇩🇪","🇬🇭","🇬🇷","🇬🇹","🇭🇹","🇭🇳","🇭🇰","🇭🇺","🇮🇸","🇮🇳","🇮🇩","🇮🇷","🇮🇶","🇮🇪","🇮🇱","🇮🇹","🇯🇲","🇯🇵","🇯🇴","🇰🇿","🇰🇪","🇰🇼","🇱🇧","🇱🇾","🇱🇹","🇱🇺","🇲🇾","🇲🇽","🇲🇦","🇲🇿","🇳🇵","🇳🇱","🇳🇿","🇳🇬","🇳🇴","🇴🇲","🇵🇰","🇵🇦","🇵🇪","🇵🇭","🇵🇱","🇵🇹","🇶🇦","🇷🇴","🇷🇺","🇸🇦","🇷🇸","🇸🇬","🇸🇰","🇸🇮","🇿🇦","🇰🇷","🇪🇸","🇱🇰","🇸🇪","🇨🇭","🇹🇼","🇹🇭","🇹🇷","🇺🇦","🇦🇪","🇬🇧","🇺🇸","🇻🇪","🇻🇳"]},Tp={Smileys:"😀",Gestures:"👋",People:"👤",Animals:"🐶",Food:"🍔",Travel:"✈️",Objects:"💡",Symbols:"❤️",Flags:"🏁"},Qi=Object.keys(vo),c0=({isOpen:t,onClose:r,onSelectEmoji:s})=>{const[n,a]=k.useState(""),[i,o]=k.useState(Qi[0]),c=k.useRef(null),d=k.useRef(null);if(k.useEffect(()=>{t&&(a(""),o(Qi[0]),setTimeout(()=>c.current?.focus(),100))},[t]),!t)return null;const f=Object.values(vo).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:Qi.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:Tp[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:vo[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}`))})})]})]})},d0=({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},un=2,eo=10;function Dp(){const t=new Date;return t.setDate(t.getDate()+7),t.toISOString().slice(0,16)}const f0=({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):Dp()),[l,h]=k.useState(n?.max_choices_voted??1),[u,p]=k.useState(n?.allow_vote_changes??!0),[y,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<eo&&c([...o,""])},N=S=>{o.length>un&&c(o.filter((D,T)=>T!==S))},_=(S,D)=>{c(o.map((T,M)=>M===S?D:T))},b=o.filter(S=>S.trim()),m=a.trim().length>0&&b.length>=un&&new Date(d).getTime()>Date.now(),j=()=>{m&&(s({question:a.trim(),choices:b,end_time:Math.floor(new Date(d).getTime()/1e3),max_choices_voted:Math.min(l,b.length),allow_vote_changes:u,filters:{account_age:y},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:S=>i(S.target.value),placeholder:"Ask a question...",className:E,maxLength:256})]}),e.jsxs("div",{children:[e.jsxs("label",{className:A,children:["Choices (min ",un,", max ",eo,")"]}),e.jsx("div",{className:"space-y-2",children:o.map((S,D)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:S,onChange:T=>_(D,T.target.value),placeholder:`Option ${D+1}`,className:E,maxLength:128}),o.length>un&&e.jsx("button",{type:"button",onClick:()=>N(D),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"})})]},D))}),o.length<eo&&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:S=>f(S.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(b.length,1),value:l,onChange:S=>h(Number(S.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:S=>p(S.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): ",y]}),e.jsx("input",{type:"number",min:0,max:365,value:y,onChange:S=>w(Math.max(0,Number(S.target.value))),className:E})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:x,onChange:S=>g(S.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:j,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"})]})]})]})},cn="https://hreplier-api.sagarkothari88.one/data/templates",dn=t=>({Authorization:t,"Content-Type":"application/json"}),h0={async getTemplates(t,r){const n=await fetch(r||cn,{method:"GET",headers:dn(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||cn,{method:"POST",headers:dn(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||cn,{method:"PUT",headers:dn(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||cn}/${r}`,{method:"DELETE",headers:dn(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 to,Gc;function Jc(){if(Gc)return to;Gc=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(Q){return Q}),o||(o=function(Q){return Q}),d||(d=function(Q,Ne){for(var _e=arguments.length,Ie=new Array(_e>2?_e-2:0),$e=2;$e<_e;$e++)Ie[$e-2]=arguments[$e];return Q.apply(Ne,Ie)}),f||(f=function(Q){for(var Ne=arguments.length,_e=new Array(Ne>1?Ne-1:0),Ie=1;Ie<Ne;Ie++)_e[Ie-1]=arguments[Ie];return new Q(..._e)});const l=E(Array.prototype.forEach),h=E(Array.prototype.lastIndexOf),u=E(Array.prototype.pop),p=E(Array.prototype.push),y=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),_=E(String.prototype.trim),b=E(Object.prototype.hasOwnProperty),m=E(RegExp.prototype.test),j=A(TypeError);function E(pe){return function(Q){Q instanceof RegExp&&(Q.lastIndex=0);for(var Ne=arguments.length,_e=new Array(Ne>1?Ne-1:0),Ie=1;Ie<Ne;Ie++)_e[Ie-1]=arguments[Ie];return d(pe,Q,_e)}}function A(pe){return function(){for(var Q=arguments.length,Ne=new Array(Q),_e=0;_e<Q;_e++)Ne[_e]=arguments[_e];return f(pe,Ne)}}function S(pe,Q){let Ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:w;r&&r(pe,null);let _e=Q.length;for(;_e--;){let Ie=Q[_e];if(typeof Ie=="string"){const $e=Ne(Ie);$e!==Ie&&(s(Q)||(Q[_e]=$e),Ie=$e)}pe[Ie]=!0}return pe}function D(pe){for(let Q=0;Q<pe.length;Q++)b(pe,Q)||(pe[Q]=null);return pe}function T(pe){const Q=c(null);for(const[Ne,_e]of t(pe))b(pe,Ne)&&(Array.isArray(_e)?Q[Ne]=D(_e):_e&&typeof _e=="object"&&_e.constructor===Object?Q[Ne]=T(_e):Q[Ne]=_e);return Q}function M(pe,Q){for(;pe!==null;){const _e=a(pe,Q);if(_e){if(_e.get)return E(_e.get);if(typeof _e.value=="function")return E(_e.value)}pe=n(pe)}function Ne(){return null}return Ne}const J=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"]),B=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"]),q=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"]),X=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"]),se=i(["#text"]),oe=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"]),be=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"]),V=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"]),W=i(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),U=o(/\{\{[\w\W]*|[\w\W]*\}\}/gm),de=o(/<%[\w\W]*|[\w\W]*%>/gm),ae=o(/\$\{[\w\W]*/gm),ee=o(/^data-[\-\w.\u00B7-\uFFFF]+$/),je=o(/^aria-[\-\w]+$/),Re=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),K=o(/^(?:\w+script|data):/i),re=o(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ue=o(/^html$/i),we=o(/^[a-z][.\w]*(-[.\w]+)+$/i);var Me=Object.freeze({__proto__:null,ARIA_ATTR:je,ATTR_WHITESPACE:re,CUSTOM_ELEMENT:we,DATA_ATTR:ee,DOCTYPE_NAME:ue,ERB_EXPR:de,IS_ALLOWED_URI:Re,IS_SCRIPT_OR_DATA:K,MUSTACHE_EXPR:U,TMPLIT_EXPR:ae});const Te={element:1,text:3,progressingInstruction:7,comment:8,document:9},Be=function(){return typeof window>"u"?null:window},Oe=function(Q,Ne){if(typeof Q!="object"||typeof Q.createPolicy!="function")return null;let _e=null;const Ie="data-tt-policy-suffix";Ne&&Ne.hasAttribute(Ie)&&(_e=Ne.getAttribute(Ie));const $e="dompurify"+(_e?"#"+_e:"");try{return Q.createPolicy($e,{createHTML(ut){return ut},createScriptURL(ut){return ut}})}catch{return console.warn("TrustedTypes policy "+$e+" could not be created."),null}},me=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ae(){let pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Be();const Q=Z=>Ae(Z);if(Q.version="3.3.3",Q.removed=[],!pe||!pe.document||pe.document.nodeType!==Te.document||!pe.Element)return Q.isSupported=!1,Q;let{document:Ne}=pe;const _e=Ne,Ie=_e.currentScript,{DocumentFragment:$e,HTMLTemplateElement:ut,Node:Pt,Element:pt,NodeFilter:Tt,NamedNodeMap:$t=pe.NamedNodeMap||pe.MozNamedAttrMap,HTMLFormElement:Lt,DOMParser:Vt,trustedTypes:Ut}=pe,Ue=pt.prototype,ct=M(Ue,"cloneNode"),Ht=M(Ue,"remove"),wt=M(Ue,"nextSibling"),Mt=M(Ue,"childNodes"),C=M(Ue,"parentNode");if(typeof ut=="function"){const Z=Ne.createElement("template");Z.content&&Z.content.ownerDocument&&(Ne=Z.content.ownerDocument)}let P,I="";const{implementation:Y,createNodeIterator:ge,createDocumentFragment:Pe,getElementsByTagName:He}=Ne,{importNode:ze}=_e;let ft=me();Q.isSupported=typeof t=="function"&&typeof C=="function"&&Y&&Y.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:It,ERB_EXPR:Ke,TMPLIT_EXPR:nt,DATA_ATTR:gt,ARIA_ATTR:zt,IS_SCRIPT_OR_DATA:Ot,ATTR_WHITESPACE:Nt,CUSTOM_ELEMENT:cr}=Me;let{IS_ALLOWED_URI:st}=Me,ht=null;const Yt=S({},[...J,...B,...q,...X,...se]);let it=null;const Zt=S({},[...oe,...be,...V,...W]);let Ze=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}})),lr=null,wr=null;const dt=Object.seal(c(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ve=!0,Fe=!0,Ge=!1,xt=!0,rt=!1,vt=!0,ke=!1,z=!1,te=!1,ce=!1,De=!1,mt=!1,Je=!0,St=!1;const Rt="user-content-";let Xt=!0,jt=!1,bt={},Ft=null;const Gt=S({},["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 qt=null;const ur=S({},["audio","video","img","source","image","track"]);let Nr=null;const Lr=S({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fr="http://www.w3.org/1998/Math/MathML",jr="http://www.w3.org/2000/svg",Kt="http://www.w3.org/1999/xhtml";let Cr=Kt,Mr=!1,lt=null;const at=S({},[fr,jr,Kt],x);let sr=S({},["mi","mo","mn","ms","mtext"]),rr=S({},["annotation-xml"]);const dr=S({},["title","style","font","a","script"]);let Ct=null;const hr=["application/xhtml+xml","text/html"],_r="text/html";let _t=null,mr=null;const kr=Ne.createElement("form"),$=function(R){return R instanceof RegExp||R instanceof Function},ne=function(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(mr&&mr===R)){if((!R||typeof R!="object")&&(R={}),R=T(R),Ct=hr.indexOf(R.PARSER_MEDIA_TYPE)===-1?_r:R.PARSER_MEDIA_TYPE,_t=Ct==="application/xhtml+xml"?x:w,ht=b(R,"ALLOWED_TAGS")?S({},R.ALLOWED_TAGS,_t):Yt,it=b(R,"ALLOWED_ATTR")?S({},R.ALLOWED_ATTR,_t):Zt,lt=b(R,"ALLOWED_NAMESPACES")?S({},R.ALLOWED_NAMESPACES,x):at,Nr=b(R,"ADD_URI_SAFE_ATTR")?S(T(Lr),R.ADD_URI_SAFE_ATTR,_t):Lr,qt=b(R,"ADD_DATA_URI_TAGS")?S(T(ur),R.ADD_DATA_URI_TAGS,_t):ur,Ft=b(R,"FORBID_CONTENTS")?S({},R.FORBID_CONTENTS,_t):Gt,lr=b(R,"FORBID_TAGS")?S({},R.FORBID_TAGS,_t):T({}),wr=b(R,"FORBID_ATTR")?S({},R.FORBID_ATTR,_t):T({}),bt=b(R,"USE_PROFILES")?R.USE_PROFILES:!1,ve=R.ALLOW_ARIA_ATTR!==!1,Fe=R.ALLOW_DATA_ATTR!==!1,Ge=R.ALLOW_UNKNOWN_PROTOCOLS||!1,xt=R.ALLOW_SELF_CLOSE_IN_ATTR!==!1,rt=R.SAFE_FOR_TEMPLATES||!1,vt=R.SAFE_FOR_XML!==!1,ke=R.WHOLE_DOCUMENT||!1,ce=R.RETURN_DOM||!1,De=R.RETURN_DOM_FRAGMENT||!1,mt=R.RETURN_TRUSTED_TYPE||!1,te=R.FORCE_BODY||!1,Je=R.SANITIZE_DOM!==!1,St=R.SANITIZE_NAMED_PROPS||!1,Xt=R.KEEP_CONTENT!==!1,jt=R.IN_PLACE||!1,st=R.ALLOWED_URI_REGEXP||Re,Cr=R.NAMESPACE||Kt,sr=R.MATHML_TEXT_INTEGRATION_POINTS||sr,rr=R.HTML_INTEGRATION_POINTS||rr,Ze=R.CUSTOM_ELEMENT_HANDLING||{},R.CUSTOM_ELEMENT_HANDLING&&$(R.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ze.tagNameCheck=R.CUSTOM_ELEMENT_HANDLING.tagNameCheck),R.CUSTOM_ELEMENT_HANDLING&&$(R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ze.attributeNameCheck=R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),R.CUSTOM_ELEMENT_HANDLING&&typeof R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Ze.allowCustomizedBuiltInElements=R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),rt&&(Fe=!1),De&&(ce=!0),bt&&(ht=S({},se),it=c(null),bt.html===!0&&(S(ht,J),S(it,oe)),bt.svg===!0&&(S(ht,B),S(it,be),S(it,W)),bt.svgFilters===!0&&(S(ht,q),S(it,be),S(it,W)),bt.mathMl===!0&&(S(ht,X),S(it,V),S(it,W))),b(R,"ADD_TAGS")||(dt.tagCheck=null),b(R,"ADD_ATTR")||(dt.attributeCheck=null),R.ADD_TAGS&&(typeof R.ADD_TAGS=="function"?dt.tagCheck=R.ADD_TAGS:(ht===Yt&&(ht=T(ht)),S(ht,R.ADD_TAGS,_t))),R.ADD_ATTR&&(typeof R.ADD_ATTR=="function"?dt.attributeCheck=R.ADD_ATTR:(it===Zt&&(it=T(it)),S(it,R.ADD_ATTR,_t))),R.ADD_URI_SAFE_ATTR&&S(Nr,R.ADD_URI_SAFE_ATTR,_t),R.FORBID_CONTENTS&&(Ft===Gt&&(Ft=T(Ft)),S(Ft,R.FORBID_CONTENTS,_t)),R.ADD_FORBID_CONTENTS&&(Ft===Gt&&(Ft=T(Ft)),S(Ft,R.ADD_FORBID_CONTENTS,_t)),Xt&&(ht["#text"]=!0),ke&&S(ht,["html","head","body"]),ht.table&&(S(ht,["tbody"]),delete lr.tbody),R.TRUSTED_TYPES_POLICY){if(typeof R.TRUSTED_TYPES_POLICY.createHTML!="function")throw j('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof R.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw j('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');P=R.TRUSTED_TYPES_POLICY,I=P.createHTML("")}else P===void 0&&(P=Oe(Ut,Ie)),P!==null&&typeof I=="string"&&(I=P.createHTML(""));i&&i(R),mr=R}},fe=S({},[...B,...q,...F]),ie=S({},[...X,...G]),ye=function(R){let le=C(R);(!le||!le.tagName)&&(le={namespaceURI:Cr,tagName:"template"});const xe=w(R.tagName),qe=w(le.tagName);return lt[R.namespaceURI]?R.namespaceURI===jr?le.namespaceURI===Kt?xe==="svg":le.namespaceURI===fr?xe==="svg"&&(qe==="annotation-xml"||sr[qe]):!!fe[xe]:R.namespaceURI===fr?le.namespaceURI===Kt?xe==="math":le.namespaceURI===jr?xe==="math"&&rr[qe]:!!ie[xe]:R.namespaceURI===Kt?le.namespaceURI===jr&&!rr[qe]||le.namespaceURI===fr&&!sr[qe]?!1:!ie[xe]&&(dr[xe]||!fe[xe]):!!(Ct==="application/xhtml+xml"&&lt[R.namespaceURI]):!1},Se=function(R){p(Q.removed,{element:R});try{C(R).removeChild(R)}catch{Ht(R)}},ot=function(R,le){try{p(Q.removed,{attribute:le.getAttributeNode(R),from:le})}catch{p(Q.removed,{attribute:null,from:le})}if(le.removeAttribute(R),R==="is")if(ce||De)try{Se(le)}catch{}else try{le.setAttribute(R,"")}catch{}},Ve=function(R){let le=null,xe=null;if(te)R="<remove></remove>"+R;else{const Xe=g(R,/^[\r\n\t ]+/);xe=Xe&&Xe[0]}Ct==="application/xhtml+xml"&&Cr===Kt&&(R='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+R+"</body></html>");const qe=P?P.createHTML(R):R;if(Cr===Kt)try{le=new Vt().parseFromString(qe,Ct)}catch{}if(!le||!le.documentElement){le=Y.createDocument(Cr,"template",null);try{le.documentElement.innerHTML=Mr?I:qe}catch{}}const Qe=le.body||le.documentElement;return R&&xe&&Qe.insertBefore(Ne.createTextNode(xe),Qe.childNodes[0]||null),Cr===Kt?He.call(le,ke?"html":"body")[0]:ke?le.documentElement:Qe},yt=function(R){return ge.call(R.ownerDocument||R,R,Tt.SHOW_ELEMENT|Tt.SHOW_COMMENT|Tt.SHOW_TEXT|Tt.SHOW_PROCESSING_INSTRUCTION|Tt.SHOW_CDATA_SECTION,null)},Dt=function(R){return R instanceof Lt&&(typeof R.nodeName!="string"||typeof R.textContent!="string"||typeof R.removeChild!="function"||!(R.attributes instanceof $t)||typeof R.removeAttribute!="function"||typeof R.setAttribute!="function"||typeof R.namespaceURI!="string"||typeof R.insertBefore!="function"||typeof R.hasChildNodes!="function")},Ye=function(R){return typeof Pt=="function"&&R instanceof Pt};function kt(Z,R,le){l(Z,xe=>{xe.call(Q,R,le,mr)})}const pr=function(R){let le=null;if(kt(ft.beforeSanitizeElements,R,null),Dt(R))return Se(R),!0;const xe=_t(R.nodeName);if(kt(ft.uponSanitizeElement,R,{tagName:xe,allowedTags:ht}),vt&&R.hasChildNodes()&&!Ye(R.firstElementChild)&&m(/<[/\w!]/g,R.innerHTML)&&m(/<[/\w!]/g,R.textContent)||R.nodeType===Te.progressingInstruction||vt&&R.nodeType===Te.comment&&m(/<[/\w]/g,R.data))return Se(R),!0;if(!(dt.tagCheck instanceof Function&&dt.tagCheck(xe))&&(!ht[xe]||lr[xe])){if(!lr[xe]&&nr(xe)&&(Ze.tagNameCheck instanceof RegExp&&m(Ze.tagNameCheck,xe)||Ze.tagNameCheck instanceof Function&&Ze.tagNameCheck(xe)))return!1;if(Xt&&!Ft[xe]){const qe=C(R)||R.parentNode,Qe=Mt(R)||R.childNodes;if(Qe&&qe){const Xe=Qe.length;for(let We=Xe-1;We>=0;--We){const Bt=ct(Qe[We],!0);Bt.__removalCount=(R.__removalCount||0)+1,qe.insertBefore(Bt,wt(R))}}}return Se(R),!0}return R instanceof pt&&!ye(R)||(xe==="noscript"||xe==="noembed"||xe==="noframes")&&m(/<\/no(script|embed|frames)/i,R.innerHTML)?(Se(R),!0):(rt&&R.nodeType===Te.text&&(le=R.textContent,l([It,Ke,nt],qe=>{le=v(le,qe," ")}),R.textContent!==le&&(p(Q.removed,{element:R.cloneNode()}),R.textContent=le)),kt(ft.afterSanitizeElements,R,null),!1)},Wt=function(R,le,xe){if(wr[le]||Je&&(le==="id"||le==="name")&&(xe in Ne||xe in kr))return!1;if(!(Fe&&!wr[le]&&m(gt,le))){if(!(ve&&m(zt,le))){if(!(dt.attributeCheck instanceof Function&&dt.attributeCheck(le,R))){if(!it[le]||wr[le]){if(!(nr(R)&&(Ze.tagNameCheck instanceof RegExp&&m(Ze.tagNameCheck,R)||Ze.tagNameCheck instanceof Function&&Ze.tagNameCheck(R))&&(Ze.attributeNameCheck instanceof RegExp&&m(Ze.attributeNameCheck,le)||Ze.attributeNameCheck instanceof Function&&Ze.attributeNameCheck(le,R))||le==="is"&&Ze.allowCustomizedBuiltInElements&&(Ze.tagNameCheck instanceof RegExp&&m(Ze.tagNameCheck,xe)||Ze.tagNameCheck instanceof Function&&Ze.tagNameCheck(xe))))return!1}else if(!Nr[le]){if(!m(st,v(xe,Nt,""))){if(!((le==="src"||le==="xlink:href"||le==="href")&&R!=="script"&&N(xe,"data:")===0&&qt[R])){if(!(Ge&&!m(Ot,v(xe,Nt,"")))){if(xe)return!1}}}}}}}return!0},nr=function(R){return R!=="annotation-xml"&&g(R,cr)},L=function(R){kt(ft.beforeSanitizeAttributes,R,null);const{attributes:le}=R;if(!le||Dt(R))return;const xe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:it,forceKeepAttr:void 0};let qe=le.length;for(;qe--;){const Qe=le[qe],{name:Xe,namespaceURI:We,value:Bt}=Qe,Jt=_t(Xe),Qt=Bt;let Et=Xe==="value"?Qt:_(Qt);if(xe.attrName=Jt,xe.attrValue=Et,xe.keepAttr=!0,xe.forceKeepAttr=void 0,kt(ft.uponSanitizeAttribute,R,xe),Et=xe.attrValue,St&&(Jt==="id"||Jt==="name")&&(ot(Xe,R),Et=Rt+Et),vt&&m(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Et)){ot(Xe,R);continue}if(Jt==="attributename"&&g(Et,"href")){ot(Xe,R);continue}if(xe.forceKeepAttr)continue;if(!xe.keepAttr){ot(Xe,R);continue}if(!xt&&m(/\/>/i,Et)){ot(Xe,R);continue}rt&&l([It,Ke,nt],Rr=>{Et=v(Et,Rr," ")});const gr=_t(R.nodeName);if(!Wt(gr,Jt,Et)){ot(Xe,R);continue}if(P&&typeof Ut=="object"&&typeof Ut.getAttributeType=="function"&&!We)switch(Ut.getAttributeType(gr,Jt)){case"TrustedHTML":{Et=P.createHTML(Et);break}case"TrustedScriptURL":{Et=P.createScriptURL(Et);break}}if(Et!==Qt)try{We?R.setAttributeNS(We,Xe,Et):R.setAttribute(Xe,Et),Dt(R)?Se(R):u(Q.removed)}catch{ot(Xe,R)}}kt(ft.afterSanitizeAttributes,R,null)},H=function Z(R){let le=null;const xe=yt(R);for(kt(ft.beforeSanitizeShadowDOM,R,null);le=xe.nextNode();)kt(ft.uponSanitizeShadowNode,le,null),pr(le),L(le),le.content instanceof $e&&Z(le.content);kt(ft.afterSanitizeShadowDOM,R,null)};return Q.sanitize=function(Z){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},le=null,xe=null,qe=null,Qe=null;if(Mr=!Z,Mr&&(Z="<!-->"),typeof Z!="string"&&!Ye(Z))if(typeof Z.toString=="function"){if(Z=Z.toString(),typeof Z!="string")throw j("dirty is not a string, aborting")}else throw j("toString is not a function");if(!Q.isSupported)return Z;if(z||ne(R),Q.removed=[],typeof Z=="string"&&(jt=!1),jt){if(Z.nodeName){const Bt=_t(Z.nodeName);if(!ht[Bt]||lr[Bt])throw j("root node is forbidden and cannot be sanitized in-place")}}else if(Z instanceof Pt)le=Ve("<!---->"),xe=le.ownerDocument.importNode(Z,!0),xe.nodeType===Te.element&&xe.nodeName==="BODY"||xe.nodeName==="HTML"?le=xe:le.appendChild(xe);else{if(!ce&&!rt&&!ke&&Z.indexOf("<")===-1)return P&&mt?P.createHTML(Z):Z;if(le=Ve(Z),!le)return ce?null:mt?I:""}le&&te&&Se(le.firstChild);const Xe=yt(jt?Z:le);for(;qe=Xe.nextNode();)pr(qe),L(qe),qe.content instanceof $e&&H(qe.content);if(jt)return Z;if(ce){if(De)for(Qe=Pe.call(le.ownerDocument);le.firstChild;)Qe.appendChild(le.firstChild);else Qe=le;return(it.shadowroot||it.shadowrootmode)&&(Qe=ze.call(_e,Qe,!0)),Qe}let We=ke?le.outerHTML:le.innerHTML;return ke&&ht["!doctype"]&&le.ownerDocument&&le.ownerDocument.doctype&&le.ownerDocument.doctype.name&&m(ue,le.ownerDocument.doctype.name)&&(We="<!DOCTYPE "+le.ownerDocument.doctype.name+`>
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 $o=({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,y]=k.useState(!0),[w,x]=k.useState(!1),g=k.useMemo(()=>{const ae=t.active_votes||[];if(!n)return!1;const ee=n.toLowerCase();return ae.some(je=>(je.voter||"").toLowerCase()===ee)},[t.active_votes,n]),[v,N]=k.useState(!1),[_,b]=k.useState(""),[m,j]=k.useState(!1),E=ae=>{b(ae),N(!0),setTimeout(()=>N(!1),2500)},A=t.depth||0;let D=r.filter(ae=>ae.parent_author===t.author&&ae.parent_permlink===t.permlink&&(typeof ae.depth!="number"||ae.depth===A+1));if((!D||D.length===0)&&Array.isArray(t.replies)&&t.replies.length>0){const ae=new Set(t.replies);D=r.filter(ee=>ae.has(`${ee.author}/${ee.permlink}`))}const T=D.length>0,M=o>=4,J=(ae,ee)=>{if(!ee)return ae;const je=new RegExp(`(${ee})`,"gi");return ae.replace(je,'<mark class="bg-yellow-800">$1</mark>')},B=()=>{x(!0)},q=async ae=>{if(d){try{await Promise.resolve(d(t.author,t.permlink,ae)),u(!0),x(!1),setTimeout(()=>{c?.(),E("Vote submitted successfully!")},3e3)}catch(ee){const je=ee instanceof Error?ee.message:"Failed to upvote";Or({title:"Error",description:je})}return}if(!a){E("Please login or provide an upvote handler to vote");return}try{const ee=Math.round(ae*100);await At.handleUpvote({author:t.author,permlink:t.permlink,weight:ee,authToken:a}),u(!0),x(!1),j(!0),setTimeout(()=>{c?.(),j(!1),E("Vote submitted successfully ✅")},3e3)}catch(ee){const je=ee instanceof Error?ee.message:"Failed to upvote";Or({title:"Error",description:je}),j(!1)}},F=()=>{n?s(t.author,t.permlink):E("Please login to upvote")},X=t.json_metadata_parsed||(()=>{try{return t.json_metadata?JSON.parse(t.json_metadata):void 0}catch{return}})(),G=t.body||"",oe=(ae=>{const ee=/^(\s*(?:#[\p{L}\p{N}_-]+\s*(?:,\s*)?)+\s*)$/gimu;return ae.replace(ee,"").trim()})(G),be=i?J(oe,i):oe,V=/!\[[^\]]*\]\([^)]+\)/.test(oe)||/<img\s/i.test(oe),W=Array.isArray(X?.image)?X.image:[],U=new qn.DefaultRenderer({baseUrl:"https://hive.blog/",breaks:!0,skipSanitization:!1,allowInsecureScriptTags:!1,addNofollowToLinks:!0,doNotShowImages:!1,assetsWidth:640,assetsHeight:480,imageProxyFn:ae=>ae,usertagUrlFn:ae=>`/@${ae}`,hashtagUrlFn:ae=>`/trending/${ae}`,isLinkSafeFn:ae=>!0,addExternalCssClassToMatchingLinksFn:ae=>!0,ipfsPrefix:"https://ipfs.io/ipfs/"}),de=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:ae=>{ae.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:vs.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:be}}):e.jsx("div",{className:"text-left",dangerouslySetInnerHTML:{__html:U.render(oe)}})}),!V&&W.length>0&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-3",children:W.map((ae,ee)=>e.jsx("img",{src:ae,alt:`image-${ee}`,className:"max-w-full h-auto rounded-lg shadow-sm cursor-pointer hover:shadow-md transition-shadow duration-200",onClick:()=>window.open(ae,"_blank")},ae+ee))}),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}B()}else if(l){if(!n){E("Please login to upvote");return}if(g||h){E("You have already upvoted this comment");return}B()}else{if(!n){E("Please login to upvote");return}a?g?E("You have already upvoted this comment"):B():(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:de})]}),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"})]}),T&&e.jsx("button",{onClick:()=>y(!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"," ",D.length," ",D.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(Hn,{author:t.author,permlink:t.permlink,onUpvote:q,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:_})})]})]})}),T&&p&&!M&&e.jsx("div",{className:"space-y-0",children:D.map(ae=>e.jsx($o,{comment:ae,allComments:r,onReply:s,currentUser:n,searchQuery:i,depth:o+1,onVotedRefresh:c,onClickCommentUpvote:d,onClickCommentReply:f,onClickUpvoteButton:l},ae.permlink))}),T&&M&&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 ",D.length," more ",D.length===1?"reply":"replies"]})})]})};async function up(t){const r=await t.arrayBuffer(),s=new Uint8Array(r),n=new TextEncoder().encode("ImageSigningChallenge"),a=new Uint8Array(n.length+s.length);return a.set(n),a.set(s,n.length),JSON.stringify({type:"Buffer",data:Array.from(a)})}async function zn(t,r,s,n,a){if(!r)throw new Error("Hive username is required for image upload");const i=await up(s);a?.onSignStart?.();let o;try{o=await t(i)}finally{a?.onSignEnd?.()}if(!o)throw new Error("Image signing returned empty signature");const c=new FormData;n?c.append("file",s,n):c.append("file",s);const d=await fetch(`https://images.hive.blog/${r}/${o}`,{method:"POST",body:c,signal:a?.signal});if(!d.ok)throw new Error(`Hive image upload failed: ${d.statusText}`);const f=await d.json();if(!f.url)throw new Error("No URL returned from Hive image upload");return f.url}function bo(t){if(t==null)return"Failed to upload image";if(typeof t=="string")return t;if(t instanceof Error){if(t.message&&t.message!=="[object Object]")return t.message;const r=t;if(r.cause)return bo(r.cause);if(typeof r.error=="string")return r.error;if(r.error&&typeof r.error=="object")return bo(r.error)}if(typeof t=="object"){const r=t;if(typeof r.message=="string"&&r.message!=="[object Object]")return r.message;if(typeof r.error=="string")return r.error;if(r.cmd==="sign_nack"||r.cmd==="auth_nack")return"Request rejected in wallet";if(r.cmd==="sign_err"||r.cmd==="auth_err")return typeof r.error=="string"?r.error:"Wallet error";if(r.data&&typeof r.data.msg=="string")return r.data.msg;try{const s=JSON.stringify(t);if(s&&s!=="{}")return s}catch{}}return"Failed to upload image"}const i0=({onImageUploaded:t,ecencyToken:r,onSignMessage:s,signingUsername:n,onSigningStateChange:a,walletApprovalLabel:i="Open Keychain App & Approve",disabled:o=!1})=>{const c=k.useRef(null),d=k.useRef(null),[f,l]=k.useState(!1),[h,u]=k.useState(null),[p,y]=k.useState(null),[w,x]=k.useState(!1),g=()=>{d.current&&(d.current.abort(),d.current=null),x(!1),a?.(!1)},v=m=>{const j=m.target.files?.[0];if(j){if(g(),!j.type.startsWith("image/")){u("Please select an image file");return}if(j.size>10*1024*1024){u("File size must be less than 10MB");return}u(null),y(URL.createObjectURL(j)),_(j)}},N=async(m,j)=>{if(!r)throw new Error("Ecency token not provided");const E=new FormData;E.append("file",m);const A=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:E,signal:j});if(!A.ok)throw new Error(`Upload failed: ${A.statusText}`);const S=await A.json();if(!S.url)throw new Error("No URL returned from upload");return S.url},_=async m=>{const j=new AbortController;d.current=j;const E=j.signal;l(!0),u(null);try{const A=!!(s&&n);if(!r&&!A)throw new Error("No upload method configured");let S;try{S=await N(m,E)}catch(D){if(E.aborted)return;if(!A)throw D;S=await zn(s,n,m,void 0,{onSignStart:()=>{E.aborted||(x(!0),a?.(!0))},onSignEnd:()=>{x(!1),a?.(!1)},signal:E})}if(E.aborted)return;t(S),y(null),c.current&&(c.current.value="")}catch(A){if(E.aborted)return;console.error("[ImageUploader] upload error:",A),u(bo(A))}finally{d.current===j&&(d.current=null),E.aborted||l(!1)}},b=()=>{g(),l(!1),y(null),u(null),c.current&&(c.current.value="")};return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:c,type:"file",accept:"image/*",onChange:v,className:"hidden",disabled:o||f}),e.jsx("button",{type:"button",onClick:()=>!o&&!f&&c.current?.click(),disabled:o||f,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Upload Image",children:f?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Upload,{className:"h-4 w-4"})}),(p||h)&&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:h?"Upload Error":"Image Preview"}),e.jsx("button",{type:"button",onClick:b,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:h?e.jsx("div",{className:"text-red-400 text-sm",children:h}):p?e.jsxs("div",{className:"space-y-4",children:[e.jsx("img",{src:p,alt:"Preview",className:"w-full max-h-64 object-contain rounded"}),w?e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-sm text-amber-400 animate-pulse",children:i})}):f?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]}):null})]})})]})},yo="https://audio.3speak.tv",cp="sk_demo_b0d3f4b972c5065b701394df3de2f44fd59aa3244c58c478",dp=".mp3,.wav,.ogg,.m4a,.aac,.flac,.weba,.opus,audio/mpeg,audio/wav,audio/ogg,audio/aac,audio/flac,audio/webm,audio/opus",fp=50*1024*1024,Xi=300;function zc(t){const r=Math.floor(t/60),s=t%60;return`${r}:${String(s).padStart(2,"0")}`}function hp(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 mp=/\.(mp3|wav|ogg|m4a|aac|flac|weba|opus)$/i;function pp(t){return mp.test(t)}function gp(t){return t.split(".").pop()?.toLowerCase()??"m4a"}function xp(t){return`${yo}/play?a=${t}&mode=minimal&iframe=1`}function bp(){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 o0=({onAudioUploaded:t,username:r,threeSpeakApiKey:s,disabled:n=!1})=>{const a=s||cp,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),[y,w]=k.useState(null),[x,g]=k.useState(!1),[v,N]=k.useState(0),[_,b]=k.useState(null),[m,j]=k.useState(null),[E,A]=k.useState(!1),[S,D]=k.useState(null),[T,M]=k.useState(null),[J,B]=k.useState(null);k.useEffect(()=>()=>{d.current&&clearInterval(d.current),m&&URL.revokeObjectURL(m),T&&URL.revokeObjectURL(T),f.current&&(f.current.pause(),f.current=null)},[]),k.useEffect(()=>{x&&v>=Xi&&X()},[x,v]);const q=k.useCallback(()=>{d.current&&clearInterval(d.current),m&&URL.revokeObjectURL(m),T&&URL.revokeObjectURL(T),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),b(null),j(null),A(!1),D(null),M(null),B(null),i.current&&(i.current.value="")},[m,T]),F=async()=>{w(null),b(null),m&&URL.revokeObjectURL(m),j(null),N(0);try{const ae=await navigator.mediaDevices.getUserMedia({audio:!0}),ee=new MediaRecorder(ae,{mimeType:bp()});o.current=ee,c.current=[],ee.ondataavailable=je=>{je.data.size>0&&c.current.push(je.data)},ee.onstop=()=>{ae.getTracks().forEach(K=>K.stop());const je=new Blob(c.current,{type:ee.mimeType}),Re=URL.createObjectURL(je);b(je),j(Re),g(!1),d.current&&clearInterval(d.current)},ee.start(100),g(!0),d.current=setInterval(()=>{N(je=>je+1)},1e3)}catch{w("Microphone access denied. Please allow microphone permission.")}},X=()=>{o.current&&o.current.state!=="inactive"&&o.current.stop()},G=()=>{m&&URL.revokeObjectURL(m),f.current&&(f.current.pause(),f.current=null),b(null),j(null),N(0),A(!1),w(null)},se=()=>{if(!m)return;if(E&&f.current){f.current.pause(),A(!1);return}const ae=new Audio(m);f.current=ae,ae.onended=()=>A(!1),ae.play(),A(!0)},oe=async()=>{if(!_)return;const ae=new File([_],`recording-${Date.now()}.webm`,{type:_.type});await U(ae,v)},be=ae=>{const ee=ae.target.files?.[0];if(ee){if(ee.type.startsWith("video/")){w("Video files are not allowed. Please select an audio file.");return}if(!ee.type.startsWith("audio/")&&!pp(ee.name)){w("Please select an audio file (MP3, WAV, OGG, M4A, etc.)");return}if(ee.size>fp){w("File size must be less than 50MB");return}w(null),D(ee),B(ee.name),M(URL.createObjectURL(ee)),h("gallery-preview")}},V=async()=>{if(!S)return;const ae=await hp(S);await U(S,ae)},W=()=>{T&&URL.revokeObjectURL(T),D(null),M(null),B(null),w(null),h("pick"),i.current&&(i.current.value="")},U=async(ae,ee)=>{p(!0),w(null);try{if(!r)throw new Error("Please log in to upload audio.");const je=ae instanceof File?gp(ae.name):"webm",Re=new FormData;Re.append("audio",ae),Re.append("duration",String(ee)),Re.append("format",je),Re.append("title",`Audio by ${r}`);const K=await fetch(`${yo}/api/audio/upload`,{method:"POST",headers:{"X-API-Key":a,"X-User":r},body:Re});if(!K.ok){const we=await K.json().catch(()=>null);throw new Error(we?.message??we?.error??`Upload failed: ${K.statusText}`)}const re=await K.json();if(re.error)throw new Error(re.error);let ue;if(re.permlink)ue=xp(re.permlink);else if(re.playUrl)ue=re.playUrl;else if(re.cid)ue=`${yo}/play?cid=${re.cid}&mode=minimal&iframe=1`;else throw new Error("No audio URL returned from upload");t(ue,ee),q()}catch(je){w(je instanceof Error?je.message:"Failed to upload audio")}finally{p(!1)}},de=v/Xi*100;return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:i,type:"file",accept:dp,onChange:be,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:q,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:[y&&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:y}),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:zc(v)}),e.jsx("p",{className:"mt-1 text-xs text-gray-400",children:x?"Recording...":_?"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(de,100)}%`}})}),e.jsxs("p",{className:"text-xs text-gray-400",children:["Max ",zc(Xi)]}),_?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:se,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:()=>{oe()},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?X: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:[J&&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:J})]}),T&&e.jsx("audio",{src:T,controls:!0,className:"w-full rounded-lg",preload:"metadata"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:W,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:()=>{V()},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:W,className:"text-center text-xs text-gray-400 hover:text-white transition-colors",children:"Back to options"})]})]})]})})]})},yp="https://embed.3speak.tv/uploads",vp="sk_demo_b0d3f4b972c5065b701394df3de2f44fd59aa3244c58c478",wp=100*1024*1024,Np=5*1024*1024,jp="video/mp4,video/quicktime,video/webm,video/3gpp,.mp4,.mov,.webm,.3gp",Wc=90;function ln(t){return t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Ki(t){const r=Math.floor(t/60),s=t%60;return`${r}:${String(s).padStart(2,"0")}`}function _p(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 kp(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 Ep(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 Ap(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 Sp(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 Cp(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:yp,metadata:{filename:t.name,filetype:t.type||"video/mp4",frontend_app:"hive-react-kit",owner:r,short:"true",duration:String(s)},chunkSize:Np,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 y=p.getHeader("X-Embed-URL");y&&(f=y)},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 l0=({onVideoUploaded:t,username:r,ecencyToken:s,onSignMessage:n,threeSpeakApiKey:a,disabled:i=!1})=>{const o=a||vp,c=k.useRef(null),d=k.useRef(null),[f,l]=k.useState(!1),[h,u]=k.useState(null),[p,y]=k.useState(null),[w,x]=k.useState(null),[g,v]=k.useState(0),[N,_]=k.useState("16/9"),[b,m]=k.useState(null),[j,E]=k.useState(!1),[A,S]=k.useState(null),[D,T]=k.useState(null);k.useEffect(()=>()=>{d.current&&d.current.abort(),b&&URL.revokeObjectURL(b)},[]);const M=k.useCallback(()=>{d.current&&(d.current.abort(),d.current=null),b&&URL.revokeObjectURL(b),l(!1),u(null),y(null),x(null),v(0),_("16/9"),m(null),E(!1),S(null),T(null),c.current&&(c.current.value="")},[b]),J=async X=>{const G=X.target.files?.[0];if(G){if(!G.type.startsWith("video/")){T("Please select a video file (MP4, MOV, WebM, etc.)");return}if(G.size>wp){T(`Video file is too large (${ln(G.size)}). Maximum is 100 MB.`);return}T(null),u(G),m(URL.createObjectURL(G));try{const se=await kp(G);if(v(se.duration),_(se.width&&se.height?`${se.width}/${se.height}`:"9/16"),se.width&&se.height&&se.width>se.height){T(`Only portrait (vertical) videos are allowed. Your video is ${se.width}×${se.height} (landscape). Please record or crop in portrait mode.`);return}if(se.duration>Wc){T(`Video is too long (${Ki(se.duration)}). Maximum is ${Ki(Wc)}.`);return}const oe=await _p(G);y(oe.dataUrl),x(oe.blob)}catch{console.warn("Failed to generate thumbnail")}}},B=async()=>{if(!h||!r){T(r?"No video selected.":"Please log in to upload videos.");return}E(!0),T(null),S({bytesUploaded:0,bytesTotal:h.size,percentage:0});const X=new AbortController;d.current=X;try{let G=Promise.resolve(null);if(w){const V=`video-thumbnail-${Date.now()}.jpg`;G=(async()=>{if(s)try{return await Ep(w,s)}catch{}if(n&&r)try{return await zn(n,r,w,V)}catch{}return null})()}const se=await Cp(h,r,g,o,V=>S(V),X.signal),oe=await G;if(oe&&se.embedUrl){const V=Sp(se.embedUrl);V&&await Ap(V,oe,o)}const be=h;t(se.embedUrl,se.uploadUrl,N,be),M()}catch(G){X.signal.aborted||T(G instanceof Error?G.message:"Failed to upload video.")}finally{E(!1),d.current=null}},q=()=>{d.current&&(d.current.abort(),d.current=null),E(!1),S(null)},F=()=>{b&&URL.revokeObjectURL(b),u(null),y(null),x(null),v(0),m(null),T(null),S(null),c.current&&(c.current.value="")};return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:c,type:"file",accept:jp,onChange:J,className:"hidden",disabled:i||j}),e.jsx("button",{type:"button",onClick:()=>{!i&&!j&&(T(null),l(!0),c.current?.click())},disabled:i||j,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Upload Video",children:j?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Video,{className:"h-4 w-4"})}),f&&h&&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:M,disabled:j,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:[D&&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:D}),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:[p?e.jsx("img",{src:p,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"})}),!j&&!D&&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:h.name}),e.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:[ln(h.size),g>0&&` · ${Ki(g)}`]})]})]}),b&&!j&&e.jsx("div",{className:"mb-4 overflow-hidden rounded-lg bg-black",style:{maxHeight:"280px"},children:e.jsx("video",{src:b,controls:!0,playsInline:!0,preload:"metadata",className:"w-full",style:{maxHeight:"280px"}})}),j&&A&&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:[A.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:`${A.percentage}%`}})}),e.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:[ln(A.bytesUploaded)," / ",ln(A.bytesTotal)]})]}),e.jsx("div",{className:"flex gap-2",children:j?e.jsx("button",{type:"button",onClick:q,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:F,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:()=>{B()},disabled:!!D,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"})]})})]})]})})]})},u0=({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 y=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 _=await N.json();c(_.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(),y(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},vo={Smileys:["😀","😃","😄","😁","😆","😅","🤣","😂","🙂","🙃","😉","😊","😇","🥰","😍","🤩","😘","😗","😚","😙","🥲","😋","😛","😜","🤪","😝","🤑","🤗","🤭","🤫","🤔","🫡","🤐","🤨","😐","😑","😶","🫥","😏","😒","🙄","😬","🤥","😌","😔","😪","🤤","😴","😷","🤒","🤕","🤢","🤮","🥵","🥶","🥴","😵","🤯","🤠","🥳","🥸","😎","🤓","🧐","😕","🫤","😟","🙁","☹️","😮","😯","😲","😳","🥺","🥹","😦","😧","😨","😰","😥","😢","😭","😱","😖","😣","😞","😓","😩","😫","🥱","😤","😡","😠","🤬","😈","👿"],Gestures:["👋","🤚","🖐️","✋","🖖","🫱","🫲","🫳","🫴","👌","🤌","🤏","✌️","🤞","🫰","🤟","🤘","🤙","👈","👉","👆","🖕","👇","☝️","🫵","👍","👎","✊","👊","🤛","🤜","👏","🙌","🫶","👐","🤲","🤝","🙏","✍️","💅","🤳","💪","🦾","🦿","🦵","🦶","👂","🦻"],People:["👶","🧒","👦","👧","🧑","👱","👨","🧔","👩","🧓","👴","👵","🙍","🙎","🙅","🙆","💁","🙋","🧏","🙇","🤦","🤷","👮","🕵️","💂","🥷","👷","🫅","🤴","👸","👳","👲","🧕","🤵","👰","🤰","🫃","🤱","👼","🎅","🤶","🦸","🦹","🧙","🧚","🧛","🧜","🧝"],Animals:["🐶","🐱","🐭","🐹","🐰","🦊","🐻","🐼","🐻‍❄️","🐨","🐯","🦁","🐮","🐷","🐸","🐵","🙈","🙉","🙊","🐒","🐔","🐧","🐦","🐤","🐣","🐥","🦆","🦅","🦉","🦇","🐺","🐗","🐴","🦄","🐝","🪱","🐛","🦋","🐌","🐞","🐜","🪰","🪲","🪳","🦟","🦗","🕷️","🐢","🐍","🦎","🦖","🦕","🐙","🦑","🦐","🦞","🦀","🐡","🐠","🐟","🐬","🐳","🐋","🦈"],Food:["🍏","🍎","🍐","🍊","🍋","🍌","🍉","🍇","🍓","🫐","🍈","🍒","🍑","🥭","🍍","🥥","🥝","🍅","🍆","🥑","🥦","🥬","🥒","🌶️","🫑","🌽","🥕","🫒","🧄","🧅","🥔","🍠","🥐","🥯","🍞","🥖","🥨","🧀","🥚","🍳","🧈","🥞","🧇","🥓","🥩","🍗","🍖","🌭","🍔","🍟","🍕","🫓","🥪","🥙","🧆","🌮","🌯","🫔","🥗","🥘","🫕","🥫","🍝","🍜","🍲","🍛","🍣","🍱","🥟","🦪","🍤","🍙","🍚","🍘","🍥","🥠","🥮","🍢","🍡","🍧","🍨","🍦","🥧","🧁","🍰","🎂","🍮","🍭","🍬","🍫","🍿","🍩","🍪","🌰","🥜","🍯"],Travel:["🚗","🚕","🚙","🚌","🚎","🏎️","🚓","🚑","🚒","🚐","🛻","🚚","🚛","🚜","🏍️","🛵","🚲","🛴","🛹","🛼","🚁","🛸","🚀","🛩️","✈️","🚢","⛵","🚤","🛥️","🛳️","⛴️","🚂","🏠","🏡","🏢","🏣","🏤","🏥","🏦","🏨","🏩","🏪","🏫","🏬","🏭","🏯","🏰","💒","🗼","🗽","⛪","🕌","🛕","🕍","⛩️","🕋","⛲","⛺","🌁","🌃","🏙️","🌄","🌅","🌆"],Objects:["⌚","📱","📲","💻","⌨️","🖥️","🖨️","🖱️","🖲️","🕹️","🗜️","💾","💿","📀","📼","📷","📸","📹","🎥","📽️","🎞️","📞","☎️","📟","📠","📺","📻","🎙️","🎚️","🎛️","🧭","⏱️","💡","🔦","🕯️","🪔","🧯","🛢️","💸","💵","💴","💶","💷","🪙","💰","💳","💎","⚖️","🪜","🧰","🪛","🔧","🔨","⚒️","🛠️","⛏️","🪚","🔩","⚙️","🪤","🧲","🔫","💣","🧨","🪓","🔪","🗡️","⚔️","🛡️","🚬","⚰️","🪦","⚱️","🏺","🔮","📿","🧿","🪬","💈","⚗️"],Symbols:["❤️","🧡","💛","💚","💙","💜","🖤","🤍","🤎","💔","❤️‍🔥","❤️‍🩹","❣️","💕","💞","💓","💗","💖","💘","💝","💟","☮️","✝️","☪️","🕉️","☸️","✡️","🔯","🕎","☯️","☦️","🛐","⛎","♈","♉","♊","♋","♌","♍","♎","♏","♐","♑","♒","♓","🆔","⚛️","🉑","☢️","☣️","📴","📳","🈶","🈚","🈸","🈺","🈷️","✴️","🆚","💮","🉐","㊙️","㊗️","🈴","🈵","🈹","🈲","🅰️","🅱️","🆎","🅾️","🆑","🆘","❌","⭕","🛑","⛔","📛","🚫","💯","💢","♨️","🚷","🚯","🚳","🚱","🔞","📵","🚭","❗","❕","❓","❔","‼️","⁉️","🔅","🔆","〽️","⚠️","🚸","🔱","⚜️","🔰","♻️","✅","🈯","💹","❇️","✳️","❎","🌐","💠","🔘","🔳","🔲","⬛","⬜","◼️","◻️","◾","◽","▪️","▫️","🔴","🟠","🟡","🟢","🔵","🟣","🟤","⚫","⚪"],Flags:["🏁","🚩","🎌","🏴","🏳️","🏳️‍🌈","🏳️‍⚧️","🏴‍☠️","🇦🇫","🇦🇱","🇩🇿","🇦🇸","🇦🇩","🇦🇴","🇦🇮","🇦🇬","🇦🇷","🇦🇲","🇦🇺","🇦🇹","🇧🇸","🇧🇭","🇧🇩","🇧🇧","🇧🇾","🇧🇪","🇧🇿","🇧🇯","🇧🇹","🇧🇴","🇧🇦","🇧🇼","🇧🇷","🇧🇳","🇧🇬","🇧🇫","🇧🇮","🇨🇦","🇨🇳","🇨🇴","🇨🇷","🇭🇷","🇨🇺","🇨🇿","🇩🇰","🇩🇴","🇪🇨","🇪🇬","🇸🇻","🇪🇹","🇫🇮","🇫🇷","🇩🇪","🇬🇭","🇬🇷","🇬🇹","🇭🇹","🇭🇳","🇭🇰","🇭🇺","🇮🇸","🇮🇳","🇮🇩","🇮🇷","🇮🇶","🇮🇪","🇮🇱","🇮🇹","🇯🇲","🇯🇵","🇯🇴","🇰🇿","🇰🇪","🇰🇼","🇱🇧","🇱🇾","🇱🇹","🇱🇺","🇲🇾","🇲🇽","🇲🇦","🇲🇿","🇳🇵","🇳🇱","🇳🇿","🇳🇬","🇳🇴","🇴🇲","🇵🇰","🇵🇦","🇵🇪","🇵🇭","🇵🇱","🇵🇹","🇶🇦","🇷🇴","🇷🇺","🇸🇦","🇷🇸","🇸🇬","🇸🇰","🇸🇮","🇿🇦","🇰🇷","🇪🇸","🇱🇰","🇸🇪","🇨🇭","🇹🇼","🇹🇭","🇹🇷","🇺🇦","🇦🇪","🇬🇧","🇺🇸","🇻🇪","🇻🇳"]},Tp={Smileys:"😀",Gestures:"👋",People:"👤",Animals:"🐶",Food:"🍔",Travel:"✈️",Objects:"💡",Symbols:"❤️",Flags:"🏁"},Qi=Object.keys(vo),c0=({isOpen:t,onClose:r,onSelectEmoji:s})=>{const[n,a]=k.useState(""),[i,o]=k.useState(Qi[0]),c=k.useRef(null),d=k.useRef(null);if(k.useEffect(()=>{t&&(a(""),o(Qi[0]),setTimeout(()=>c.current?.focus(),100))},[t]),!t)return null;const f=Object.values(vo).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:Qi.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:Tp[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:vo[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}`))})})]})]})},d0=({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},un=2,eo=10;function Dp(){const t=new Date;return t.setDate(t.getDate()+7),t.toISOString().slice(0,16)}const f0=({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):Dp()),[l,h]=k.useState(n?.max_choices_voted??1),[u,p]=k.useState(n?.allow_vote_changes??!0),[y,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<eo&&c([...o,""])},N=S=>{o.length>un&&c(o.filter((D,T)=>T!==S))},_=(S,D)=>{c(o.map((T,M)=>M===S?D:T))},b=o.filter(S=>S.trim()),m=a.trim().length>0&&b.length>=un&&new Date(d).getTime()>Date.now(),j=()=>{m&&(s({question:a.trim(),choices:b,end_time:Math.floor(new Date(d).getTime()/1e3),max_choices_voted:Math.min(l,b.length),allow_vote_changes:u,filters:{account_age:y},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:S=>i(S.target.value),placeholder:"Ask a question...",className:E,maxLength:256})]}),e.jsxs("div",{children:[e.jsxs("label",{className:A,children:["Choices (min ",un,", max ",eo,")"]}),e.jsx("div",{className:"space-y-2",children:o.map((S,D)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:S,onChange:T=>_(D,T.target.value),placeholder:`Option ${D+1}`,className:E,maxLength:128}),o.length>un&&e.jsx("button",{type:"button",onClick:()=>N(D),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"})})]},D))}),o.length<eo&&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:S=>f(S.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(b.length,1),value:l,onChange:S=>h(Number(S.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:S=>p(S.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): ",y]}),e.jsx("input",{type:"number",min:0,max:365,value:y,onChange:S=>w(Math.max(0,Number(S.target.value))),className:E})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:x,onChange:S=>g(S.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:j,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"})]})]})]})},cn="https://hreplier-api.sagarkothari88.one/data/templates",dn=t=>({Authorization:t,"Content-Type":"application/json"}),h0={async getTemplates(t,r){const n=await fetch(r||cn,{method:"GET",headers:dn(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||cn,{method:"POST",headers:dn(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||cn,{method:"PUT",headers:dn(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||cn}/${r}`,{method:"DELETE",headers:dn(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 to,Gc;function Jc(){if(Gc)return to;Gc=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(Q){return Q}),o||(o=function(Q){return Q}),d||(d=function(Q,Ne){for(var _e=arguments.length,Ie=new Array(_e>2?_e-2:0),$e=2;$e<_e;$e++)Ie[$e-2]=arguments[$e];return Q.apply(Ne,Ie)}),f||(f=function(Q){for(var Ne=arguments.length,_e=new Array(Ne>1?Ne-1:0),Ie=1;Ie<Ne;Ie++)_e[Ie-1]=arguments[Ie];return new Q(..._e)});const l=E(Array.prototype.forEach),h=E(Array.prototype.lastIndexOf),u=E(Array.prototype.pop),p=E(Array.prototype.push),y=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),_=E(String.prototype.trim),b=E(Object.prototype.hasOwnProperty),m=E(RegExp.prototype.test),j=A(TypeError);function E(pe){return function(Q){Q instanceof RegExp&&(Q.lastIndex=0);for(var Ne=arguments.length,_e=new Array(Ne>1?Ne-1:0),Ie=1;Ie<Ne;Ie++)_e[Ie-1]=arguments[Ie];return d(pe,Q,_e)}}function A(pe){return function(){for(var Q=arguments.length,Ne=new Array(Q),_e=0;_e<Q;_e++)Ne[_e]=arguments[_e];return f(pe,Ne)}}function S(pe,Q){let Ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:w;r&&r(pe,null);let _e=Q.length;for(;_e--;){let Ie=Q[_e];if(typeof Ie=="string"){const $e=Ne(Ie);$e!==Ie&&(s(Q)||(Q[_e]=$e),Ie=$e)}pe[Ie]=!0}return pe}function D(pe){for(let Q=0;Q<pe.length;Q++)b(pe,Q)||(pe[Q]=null);return pe}function T(pe){const Q=c(null);for(const[Ne,_e]of t(pe))b(pe,Ne)&&(Array.isArray(_e)?Q[Ne]=D(_e):_e&&typeof _e=="object"&&_e.constructor===Object?Q[Ne]=T(_e):Q[Ne]=_e);return Q}function M(pe,Q){for(;pe!==null;){const _e=a(pe,Q);if(_e){if(_e.get)return E(_e.get);if(typeof _e.value=="function")return E(_e.value)}pe=n(pe)}function Ne(){return null}return Ne}const J=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"]),B=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"]),q=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"]),X=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"]),se=i(["#text"]),oe=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"]),be=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"]),V=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"]),W=i(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),U=o(/\{\{[\w\W]*|[\w\W]*\}\}/gm),de=o(/<%[\w\W]*|[\w\W]*%>/gm),ae=o(/\$\{[\w\W]*/gm),ee=o(/^data-[\-\w.\u00B7-\uFFFF]+$/),je=o(/^aria-[\-\w]+$/),Re=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),K=o(/^(?:\w+script|data):/i),re=o(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ue=o(/^html$/i),we=o(/^[a-z][.\w]*(-[.\w]+)+$/i);var Me=Object.freeze({__proto__:null,ARIA_ATTR:je,ATTR_WHITESPACE:re,CUSTOM_ELEMENT:we,DATA_ATTR:ee,DOCTYPE_NAME:ue,ERB_EXPR:de,IS_ALLOWED_URI:Re,IS_SCRIPT_OR_DATA:K,MUSTACHE_EXPR:U,TMPLIT_EXPR:ae});const Te={element:1,text:3,progressingInstruction:7,comment:8,document:9},Be=function(){return typeof window>"u"?null:window},Oe=function(Q,Ne){if(typeof Q!="object"||typeof Q.createPolicy!="function")return null;let _e=null;const Ie="data-tt-policy-suffix";Ne&&Ne.hasAttribute(Ie)&&(_e=Ne.getAttribute(Ie));const $e="dompurify"+(_e?"#"+_e:"");try{return Q.createPolicy($e,{createHTML(ut){return ut},createScriptURL(ut){return ut}})}catch{return console.warn("TrustedTypes policy "+$e+" could not be created."),null}},me=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ae(){let pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Be();const Q=Z=>Ae(Z);if(Q.version="3.3.3",Q.removed=[],!pe||!pe.document||pe.document.nodeType!==Te.document||!pe.Element)return Q.isSupported=!1,Q;let{document:Ne}=pe;const _e=Ne,Ie=_e.currentScript,{DocumentFragment:$e,HTMLTemplateElement:ut,Node:Pt,Element:pt,NodeFilter:Tt,NamedNodeMap:$t=pe.NamedNodeMap||pe.MozNamedAttrMap,HTMLFormElement:Lt,DOMParser:Vt,trustedTypes:Ut}=pe,Ue=pt.prototype,ct=M(Ue,"cloneNode"),Ht=M(Ue,"remove"),wt=M(Ue,"nextSibling"),Mt=M(Ue,"childNodes"),C=M(Ue,"parentNode");if(typeof ut=="function"){const Z=Ne.createElement("template");Z.content&&Z.content.ownerDocument&&(Ne=Z.content.ownerDocument)}let P,I="";const{implementation:Y,createNodeIterator:ge,createDocumentFragment:Pe,getElementsByTagName:He}=Ne,{importNode:ze}=_e;let ft=me();Q.isSupported=typeof t=="function"&&typeof C=="function"&&Y&&Y.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:It,ERB_EXPR:Ke,TMPLIT_EXPR:nt,DATA_ATTR:gt,ARIA_ATTR:zt,IS_SCRIPT_OR_DATA:Ot,ATTR_WHITESPACE:Nt,CUSTOM_ELEMENT:cr}=Me;let{IS_ALLOWED_URI:st}=Me,ht=null;const Yt=S({},[...J,...B,...q,...X,...se]);let it=null;const Zt=S({},[...oe,...be,...V,...W]);let Ze=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}})),lr=null,wr=null;const dt=Object.seal(c(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ve=!0,Fe=!0,Ge=!1,xt=!0,rt=!1,vt=!0,ke=!1,z=!1,te=!1,ce=!1,De=!1,mt=!1,Je=!0,St=!1;const Rt="user-content-";let Xt=!0,jt=!1,bt={},Ft=null;const Gt=S({},["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 qt=null;const ur=S({},["audio","video","img","source","image","track"]);let Nr=null;const Lr=S({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fr="http://www.w3.org/1998/Math/MathML",jr="http://www.w3.org/2000/svg",Kt="http://www.w3.org/1999/xhtml";let Cr=Kt,Mr=!1,lt=null;const at=S({},[fr,jr,Kt],x);let sr=S({},["mi","mo","mn","ms","mtext"]),rr=S({},["annotation-xml"]);const dr=S({},["title","style","font","a","script"]);let Ct=null;const hr=["application/xhtml+xml","text/html"],_r="text/html";let _t=null,mr=null;const kr=Ne.createElement("form"),$=function(R){return R instanceof RegExp||R instanceof Function},ne=function(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(mr&&mr===R)){if((!R||typeof R!="object")&&(R={}),R=T(R),Ct=hr.indexOf(R.PARSER_MEDIA_TYPE)===-1?_r:R.PARSER_MEDIA_TYPE,_t=Ct==="application/xhtml+xml"?x:w,ht=b(R,"ALLOWED_TAGS")?S({},R.ALLOWED_TAGS,_t):Yt,it=b(R,"ALLOWED_ATTR")?S({},R.ALLOWED_ATTR,_t):Zt,lt=b(R,"ALLOWED_NAMESPACES")?S({},R.ALLOWED_NAMESPACES,x):at,Nr=b(R,"ADD_URI_SAFE_ATTR")?S(T(Lr),R.ADD_URI_SAFE_ATTR,_t):Lr,qt=b(R,"ADD_DATA_URI_TAGS")?S(T(ur),R.ADD_DATA_URI_TAGS,_t):ur,Ft=b(R,"FORBID_CONTENTS")?S({},R.FORBID_CONTENTS,_t):Gt,lr=b(R,"FORBID_TAGS")?S({},R.FORBID_TAGS,_t):T({}),wr=b(R,"FORBID_ATTR")?S({},R.FORBID_ATTR,_t):T({}),bt=b(R,"USE_PROFILES")?R.USE_PROFILES:!1,ve=R.ALLOW_ARIA_ATTR!==!1,Fe=R.ALLOW_DATA_ATTR!==!1,Ge=R.ALLOW_UNKNOWN_PROTOCOLS||!1,xt=R.ALLOW_SELF_CLOSE_IN_ATTR!==!1,rt=R.SAFE_FOR_TEMPLATES||!1,vt=R.SAFE_FOR_XML!==!1,ke=R.WHOLE_DOCUMENT||!1,ce=R.RETURN_DOM||!1,De=R.RETURN_DOM_FRAGMENT||!1,mt=R.RETURN_TRUSTED_TYPE||!1,te=R.FORCE_BODY||!1,Je=R.SANITIZE_DOM!==!1,St=R.SANITIZE_NAMED_PROPS||!1,Xt=R.KEEP_CONTENT!==!1,jt=R.IN_PLACE||!1,st=R.ALLOWED_URI_REGEXP||Re,Cr=R.NAMESPACE||Kt,sr=R.MATHML_TEXT_INTEGRATION_POINTS||sr,rr=R.HTML_INTEGRATION_POINTS||rr,Ze=R.CUSTOM_ELEMENT_HANDLING||{},R.CUSTOM_ELEMENT_HANDLING&&$(R.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ze.tagNameCheck=R.CUSTOM_ELEMENT_HANDLING.tagNameCheck),R.CUSTOM_ELEMENT_HANDLING&&$(R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ze.attributeNameCheck=R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),R.CUSTOM_ELEMENT_HANDLING&&typeof R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Ze.allowCustomizedBuiltInElements=R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),rt&&(Fe=!1),De&&(ce=!0),bt&&(ht=S({},se),it=c(null),bt.html===!0&&(S(ht,J),S(it,oe)),bt.svg===!0&&(S(ht,B),S(it,be),S(it,W)),bt.svgFilters===!0&&(S(ht,q),S(it,be),S(it,W)),bt.mathMl===!0&&(S(ht,X),S(it,V),S(it,W))),b(R,"ADD_TAGS")||(dt.tagCheck=null),b(R,"ADD_ATTR")||(dt.attributeCheck=null),R.ADD_TAGS&&(typeof R.ADD_TAGS=="function"?dt.tagCheck=R.ADD_TAGS:(ht===Yt&&(ht=T(ht)),S(ht,R.ADD_TAGS,_t))),R.ADD_ATTR&&(typeof R.ADD_ATTR=="function"?dt.attributeCheck=R.ADD_ATTR:(it===Zt&&(it=T(it)),S(it,R.ADD_ATTR,_t))),R.ADD_URI_SAFE_ATTR&&S(Nr,R.ADD_URI_SAFE_ATTR,_t),R.FORBID_CONTENTS&&(Ft===Gt&&(Ft=T(Ft)),S(Ft,R.FORBID_CONTENTS,_t)),R.ADD_FORBID_CONTENTS&&(Ft===Gt&&(Ft=T(Ft)),S(Ft,R.ADD_FORBID_CONTENTS,_t)),Xt&&(ht["#text"]=!0),ke&&S(ht,["html","head","body"]),ht.table&&(S(ht,["tbody"]),delete lr.tbody),R.TRUSTED_TYPES_POLICY){if(typeof R.TRUSTED_TYPES_POLICY.createHTML!="function")throw j('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof R.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw j('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');P=R.TRUSTED_TYPES_POLICY,I=P.createHTML("")}else P===void 0&&(P=Oe(Ut,Ie)),P!==null&&typeof I=="string"&&(I=P.createHTML(""));i&&i(R),mr=R}},fe=S({},[...B,...q,...F]),ie=S({},[...X,...G]),ye=function(R){let le=C(R);(!le||!le.tagName)&&(le={namespaceURI:Cr,tagName:"template"});const xe=w(R.tagName),qe=w(le.tagName);return lt[R.namespaceURI]?R.namespaceURI===jr?le.namespaceURI===Kt?xe==="svg":le.namespaceURI===fr?xe==="svg"&&(qe==="annotation-xml"||sr[qe]):!!fe[xe]:R.namespaceURI===fr?le.namespaceURI===Kt?xe==="math":le.namespaceURI===jr?xe==="math"&&rr[qe]:!!ie[xe]:R.namespaceURI===Kt?le.namespaceURI===jr&&!rr[qe]||le.namespaceURI===fr&&!sr[qe]?!1:!ie[xe]&&(dr[xe]||!fe[xe]):!!(Ct==="application/xhtml+xml"&&lt[R.namespaceURI]):!1},Se=function(R){p(Q.removed,{element:R});try{C(R).removeChild(R)}catch{Ht(R)}},ot=function(R,le){try{p(Q.removed,{attribute:le.getAttributeNode(R),from:le})}catch{p(Q.removed,{attribute:null,from:le})}if(le.removeAttribute(R),R==="is")if(ce||De)try{Se(le)}catch{}else try{le.setAttribute(R,"")}catch{}},Ve=function(R){let le=null,xe=null;if(te)R="<remove></remove>"+R;else{const Xe=g(R,/^[\r\n\t ]+/);xe=Xe&&Xe[0]}Ct==="application/xhtml+xml"&&Cr===Kt&&(R='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+R+"</body></html>");const qe=P?P.createHTML(R):R;if(Cr===Kt)try{le=new Vt().parseFromString(qe,Ct)}catch{}if(!le||!le.documentElement){le=Y.createDocument(Cr,"template",null);try{le.documentElement.innerHTML=Mr?I:qe}catch{}}const Qe=le.body||le.documentElement;return R&&xe&&Qe.insertBefore(Ne.createTextNode(xe),Qe.childNodes[0]||null),Cr===Kt?He.call(le,ke?"html":"body")[0]:ke?le.documentElement:Qe},yt=function(R){return ge.call(R.ownerDocument||R,R,Tt.SHOW_ELEMENT|Tt.SHOW_COMMENT|Tt.SHOW_TEXT|Tt.SHOW_PROCESSING_INSTRUCTION|Tt.SHOW_CDATA_SECTION,null)},Dt=function(R){return R instanceof Lt&&(typeof R.nodeName!="string"||typeof R.textContent!="string"||typeof R.removeChild!="function"||!(R.attributes instanceof $t)||typeof R.removeAttribute!="function"||typeof R.setAttribute!="function"||typeof R.namespaceURI!="string"||typeof R.insertBefore!="function"||typeof R.hasChildNodes!="function")},Ye=function(R){return typeof Pt=="function"&&R instanceof Pt};function kt(Z,R,le){l(Z,xe=>{xe.call(Q,R,le,mr)})}const pr=function(R){let le=null;if(kt(ft.beforeSanitizeElements,R,null),Dt(R))return Se(R),!0;const xe=_t(R.nodeName);if(kt(ft.uponSanitizeElement,R,{tagName:xe,allowedTags:ht}),vt&&R.hasChildNodes()&&!Ye(R.firstElementChild)&&m(/<[/\w!]/g,R.innerHTML)&&m(/<[/\w!]/g,R.textContent)||R.nodeType===Te.progressingInstruction||vt&&R.nodeType===Te.comment&&m(/<[/\w]/g,R.data))return Se(R),!0;if(!(dt.tagCheck instanceof Function&&dt.tagCheck(xe))&&(!ht[xe]||lr[xe])){if(!lr[xe]&&nr(xe)&&(Ze.tagNameCheck instanceof RegExp&&m(Ze.tagNameCheck,xe)||Ze.tagNameCheck instanceof Function&&Ze.tagNameCheck(xe)))return!1;if(Xt&&!Ft[xe]){const qe=C(R)||R.parentNode,Qe=Mt(R)||R.childNodes;if(Qe&&qe){const Xe=Qe.length;for(let We=Xe-1;We>=0;--We){const Bt=ct(Qe[We],!0);Bt.__removalCount=(R.__removalCount||0)+1,qe.insertBefore(Bt,wt(R))}}}return Se(R),!0}return R instanceof pt&&!ye(R)||(xe==="noscript"||xe==="noembed"||xe==="noframes")&&m(/<\/no(script|embed|frames)/i,R.innerHTML)?(Se(R),!0):(rt&&R.nodeType===Te.text&&(le=R.textContent,l([It,Ke,nt],qe=>{le=v(le,qe," ")}),R.textContent!==le&&(p(Q.removed,{element:R.cloneNode()}),R.textContent=le)),kt(ft.afterSanitizeElements,R,null),!1)},Wt=function(R,le,xe){if(wr[le]||Je&&(le==="id"||le==="name")&&(xe in Ne||xe in kr))return!1;if(!(Fe&&!wr[le]&&m(gt,le))){if(!(ve&&m(zt,le))){if(!(dt.attributeCheck instanceof Function&&dt.attributeCheck(le,R))){if(!it[le]||wr[le]){if(!(nr(R)&&(Ze.tagNameCheck instanceof RegExp&&m(Ze.tagNameCheck,R)||Ze.tagNameCheck instanceof Function&&Ze.tagNameCheck(R))&&(Ze.attributeNameCheck instanceof RegExp&&m(Ze.attributeNameCheck,le)||Ze.attributeNameCheck instanceof Function&&Ze.attributeNameCheck(le,R))||le==="is"&&Ze.allowCustomizedBuiltInElements&&(Ze.tagNameCheck instanceof RegExp&&m(Ze.tagNameCheck,xe)||Ze.tagNameCheck instanceof Function&&Ze.tagNameCheck(xe))))return!1}else if(!Nr[le]){if(!m(st,v(xe,Nt,""))){if(!((le==="src"||le==="xlink:href"||le==="href")&&R!=="script"&&N(xe,"data:")===0&&qt[R])){if(!(Ge&&!m(Ot,v(xe,Nt,"")))){if(xe)return!1}}}}}}}return!0},nr=function(R){return R!=="annotation-xml"&&g(R,cr)},L=function(R){kt(ft.beforeSanitizeAttributes,R,null);const{attributes:le}=R;if(!le||Dt(R))return;const xe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:it,forceKeepAttr:void 0};let qe=le.length;for(;qe--;){const Qe=le[qe],{name:Xe,namespaceURI:We,value:Bt}=Qe,Jt=_t(Xe),Qt=Bt;let Et=Xe==="value"?Qt:_(Qt);if(xe.attrName=Jt,xe.attrValue=Et,xe.keepAttr=!0,xe.forceKeepAttr=void 0,kt(ft.uponSanitizeAttribute,R,xe),Et=xe.attrValue,St&&(Jt==="id"||Jt==="name")&&(ot(Xe,R),Et=Rt+Et),vt&&m(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Et)){ot(Xe,R);continue}if(Jt==="attributename"&&g(Et,"href")){ot(Xe,R);continue}if(xe.forceKeepAttr)continue;if(!xe.keepAttr){ot(Xe,R);continue}if(!xt&&m(/\/>/i,Et)){ot(Xe,R);continue}rt&&l([It,Ke,nt],Rr=>{Et=v(Et,Rr," ")});const gr=_t(R.nodeName);if(!Wt(gr,Jt,Et)){ot(Xe,R);continue}if(P&&typeof Ut=="object"&&typeof Ut.getAttributeType=="function"&&!We)switch(Ut.getAttributeType(gr,Jt)){case"TrustedHTML":{Et=P.createHTML(Et);break}case"TrustedScriptURL":{Et=P.createScriptURL(Et);break}}if(Et!==Qt)try{We?R.setAttributeNS(We,Xe,Et):R.setAttribute(Xe,Et),Dt(R)?Se(R):u(Q.removed)}catch{ot(Xe,R)}}kt(ft.afterSanitizeAttributes,R,null)},H=function Z(R){let le=null;const xe=yt(R);for(kt(ft.beforeSanitizeShadowDOM,R,null);le=xe.nextNode();)kt(ft.uponSanitizeShadowNode,le,null),pr(le),L(le),le.content instanceof $e&&Z(le.content);kt(ft.afterSanitizeShadowDOM,R,null)};return Q.sanitize=function(Z){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},le=null,xe=null,qe=null,Qe=null;if(Mr=!Z,Mr&&(Z="<!-->"),typeof Z!="string"&&!Ye(Z))if(typeof Z.toString=="function"){if(Z=Z.toString(),typeof Z!="string")throw j("dirty is not a string, aborting")}else throw j("toString is not a function");if(!Q.isSupported)return Z;if(z||ne(R),Q.removed=[],typeof Z=="string"&&(jt=!1),jt){if(Z.nodeName){const Bt=_t(Z.nodeName);if(!ht[Bt]||lr[Bt])throw j("root node is forbidden and cannot be sanitized in-place")}}else if(Z instanceof Pt)le=Ve("<!---->"),xe=le.ownerDocument.importNode(Z,!0),xe.nodeType===Te.element&&xe.nodeName==="BODY"||xe.nodeName==="HTML"?le=xe:le.appendChild(xe);else{if(!ce&&!rt&&!ke&&Z.indexOf("<")===-1)return P&&mt?P.createHTML(Z):Z;if(le=Ve(Z),!le)return ce?null:mt?I:""}le&&te&&Se(le.firstChild);const Xe=yt(jt?Z:le);for(;qe=Xe.nextNode();)pr(qe),L(qe),qe.content instanceof $e&&H(qe.content);if(jt)return Z;if(ce){if(De)for(Qe=Pe.call(le.ownerDocument);le.firstChild;)Qe.appendChild(le.firstChild);else Qe=le;return(it.shadowroot||it.shadowrootmode)&&(Qe=ze.call(_e,Qe,!0)),Qe}let We=ke?le.outerHTML:le.innerHTML;return ke&&ht["!doctype"]&&le.ownerDocument&&le.ownerDocument.doctype&&le.ownerDocument.doctype.name&&m(ue,le.ownerDocument.doctype.name)&&(We="<!DOCTYPE "+le.ownerDocument.doctype.name+`>
1072
1072
  `+We),rt&&l([It,Ke,nt],Bt=>{We=v(We,Bt," ")}),P&&mt?P.createHTML(We):We},Q.setConfig=function(){let Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ne(Z),z=!0},Q.clearConfig=function(){mr=null,z=!1},Q.isValidAttribute=function(Z,R,le){mr||ne({});const xe=_t(Z),qe=_t(R);return Wt(xe,qe,le)},Q.addHook=function(Z,R){typeof R=="function"&&p(ft[Z],R)},Q.removeHook=function(Z,R){if(R!==void 0){const le=h(ft[Z],R);return le===-1?void 0:y(ft[Z],le,1)[0]}return u(ft[Z])},Q.removeHooks=function(Z){ft[Z]=[]},Q.removeAllHooks=function(){ft=me()},Q}var he=Ae();return to=he,to}var ro,Yc;function Pp(){return Yc||(Yc=1,ro=self.DOMPurify||(self.DOMPurify=Jc().default||Jc())),ro}var Op=Pp();const Lp=H0(Op);var Mp="https://ipfs.3speak.tv",Rp=["https://ipfs.skatehive.app","https://cloudflare-ipfs.com","https://ipfs.io"],$p=["peakd.com","ecency.com","hive.blog","hiveblog.io","leofinance.io","3speak.tv","d.tube","esteem.app","busy.org"],Ip={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 Fp(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 Bp(t){const r=new Set,s=new Set;return t=Fp(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 Up(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"
package/dist/index.esm.js CHANGED
@@ -19423,7 +19423,7 @@ const yg = ({
19423
19423
  if (!r) throw new Error("Ecency token not provided");
19424
19424
  const A = new FormData();
19425
19425
  A.append("file", p);
19426
- const S = await fetch("https://images.ecency.com/hss/" + r, {
19426
+ const S = await fetch("https://images.ecency.com/hs/" + r, {
19427
19427
  method: "POST",
19428
19428
  headers: {
19429
19429
  accept: "application/json, text/plain, */*",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hive-react-kit",
3
3
  "private": false,
4
- "version": "0.8.6",
4
+ "version": "0.8.7",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs.js",
7
7
  "module": "./dist/index.esm.js",