1import{d as D,b as y,a6 as R,u as P,a7 as Q,am as J,f as u,h as v,j as m,z as W,i as r,k as U,g as $,l as I,n as z,Q as X,m as F,t as w,F as b,a as Y,al as Z,v as e,x as V,ak as ee,aj as te,N as E,c as L,a0 as M,aA as ne,aB as se,_ as j,p as ae,G as le,az as ie,P as oe}from"./index.16ba4ea0.js";import{_ as q}from"./Avatar.vue_vue_type_script_setup_true_lang.87e6bbe3.js";import{_ as me}from"./Rating.vue_vue_type_script_setup_true_lang.3ad4ff04.js";import{_ as re}from"./ReportDialog.vue_vue_type_script_setup_true_lang.571cdeb2.js";const ue={key:0,class:"flex gap-3 items-start"},ce=["disabled"],de={class:"flex flex-wrap gap-1.5 p-2"},he=["onClick"],ge={key:1},pe={class:"text-center text-white"},fe={key:2,class:"text-red-500 ml-12 mt-0 text-sm"},S=D({__name:"CommentsForm",props:{thingId:{},thingType:{},parentId:{}},emits:["add-comment"],setup(t,{emit:x}){const C=y(null),i=t,s=x,{user:g,isAuthorized:d}=R(P()),{authDialog:k}=R(Q()),n=y(!1),o=y(""),a=y(!1),c=y(""),p=Z,_=y(null),G=f=>{const l=f.target;l.style.height="auto",l.style.overflowY="hidden",l.style.height=l.scrollHeight+"px",c.value=""};J(C,()=>{a.value=!1});const K=()=>{if(o.value.length<3){c.value="Comment must be at least 3 characters";return}a.value||(a.value=!0,N(""))},O=async f=>{await N(f)},B=f=>{console.error(f),c.value="Captcha verification failed.",a.value=!1},N=async f=>{var l,h;c.value="";try{const T=await Y.comments.createComment(i.thingId,i.thingType,o.value,i.parentId,f);s("add-comment",T),o.value="",p&&((l=_.value)==null?void 0:l.reset)&&_.value.reset(),a.value=!1}catch(T){const A=T.toString().toLowerCase();if(p&&A.includes("captcha verification required")){_.value?_.value.execute():(console.error("Captcha ref is missing"),c.value="Captcha error (Internal)",a.value=!1);return}p&&((h=_.value)==null?void 0:h.reset)&&_.value.reset(),A.includes("spam")?c.value="Links or spam content are not allowed.":c.value=T.toString()||"Error posting comment",a.value=!1}finally{c.value&&setTimeout(()=>c.value="",3e3)}};return(f,l)=>(e(),u(b,null,[v(d)?(e(),u("div",ue,[m(q,{image:v(g).avatar_url,name:v(g).username,icon:"account",class:"h-9 w-9 grow-0 shrink-0"},null,8,["image","name"]),m(W,{textarea:!0,rows:1,oninput:G,modelValue:o.value,"onUpdate:modelValue":l[0]||(l[0]=h=>o.value=h),placeholder:"Your comment",ref:"input",class:"flex-1 !resize-none"},null,8,["modelValue"]),r("button",{onClick:l[1]||(l[1]=U(h=>n.value=!0,["stop"])),ref_key:"el",ref:C},[m(V,{name:"smiley",class:"h-6 w-6 text-zinc-300 mt-1.5"})],512),r("button",{onClick:U(K,["stop"]),disabled:o.value.length<3||a.value||!v(d),class:"disabled:opacity-25"},[a.value?(e(),$(V,{key:0,name:"loading",class:"h-6 w-6 text-zinc-300 mt-1.5 animate-spin"})):(e(),$(V,{key:1,name:"send",class:"h-6 w-6 text-zinc-300 mt-1.5"}))],8,ce),v(p)?(e(),$(v(te),{key:0,ref_key:"captcha",ref:_,onVerify:O,onError:B,onExpired:B,class:"absolute",size:"invisible",sitekey:v(ee),theme:"dark"},null,8,["sitekey"])):I("",!0),m(X,{target:f.$refs.el,modelValue:n.value,"onUpdate:modelValue":l[2]||(l[2]=h=>n.value=h),placement:"top-end",offset:8},{default:z(()=>[r("div",de,[(e(),u(b,null,E(["\u2764\uFE0F","\u{1F60A}","\u{1F975}","\u{1F924}","\u{1F44D}","\u{1F351}","\u{1F346}","\u{1F4A6}"],h=>r("button",{onClick:T=>{var A;return o.value+=h,n.value=!1,(A=f.$refs.input)==null?void 0:A.$el.focus()},class:"p-1.5 rounded-md hover:bg-zinc-600"},w(h),9,he)),64))])]),_:1},8,["target","modelValue"])])):(e(),u("div",ge,[r("p",pe,[r("span",{class:"text-blue-400 font-medium cursor-pointer",onClick:l[3]||(l[3]=h=>k.value=!0)},"Sign In"),l[4]||(l[4]=F(" to write your comment ",-1))])])),c.value?(e(),u("div",fe,w(c.value),1)):I("",!0)],64))}}),ve={class:"flex min-w-0 gap-x-3"},ye={class:"min-w-0 flex-1"},xe={class:"text-sm"},Ce={class:"text-zinc-400 ml-2 text-xs"},ke={key:0,class:"whitespace-pre-line text-zinc-500 mt-0.5 font-medium select-text italic"},_e={key:1,class:"whitespace-pre-line text-zinc-300 mt-0.5 font-normal select-text"},we={key:2,class:"flex gap-1.5 mt-1"},$e={key:4,class:"mt-3 border-l border-zinc-800 pl-4 sm:pl-5"},H=D({__name:"Comment",props:{comment:{},thingId:{},thingType:{},highlightCommentId:{}},setup(t){const x=L(()=>P().isAdmin),C=k=>{s.value=!1,i.comment.comments||(i.comment.comments=[]),i.comment.comments.push(k)},i=t,s=y(!1),g=y(!1),d=L(()=>i.comment.deleted_at!==void 0&&i.comment.deleted_at!==null);return(k,n)=>{var c;const o=M("router-link"),a=M("Comment",!0);return e(),u(b,null,[r("div",{class:ae(["min-w-0",i.highlightCommentId===t.comment.id?"rounded-lg border border-red-500/60 bg-red-950/20 p-3":""])},[r("div",ve,[m(o,{to:`/u/${t.comment.user.username}`,class:"grow-0 shrink-0"},{default:z(()=>[m(q,{image:t.comment.user.avatar_url,name:t.comment.user.username,icon:"account",class:"h-9 w-9"},null,8,["image","name"])]),_:1},8,["to"]),r("div",ye,[r("div",xe,[m(o,{to:`/u/${t.comment.user.username}`,class:"text-zinc-100 font-medium"},{default:z(()=>[F(w(t.comment.user.username),1)]),_:1},8,["to"]),r("span",Ce,[F(w(v(ne)(new Date(t.comment.created_at)))+" ago ",1),x.value&&t.comment.is_shadowbanned?(e(),u(b,{key:0},[n[3]||(n[3]=F(" \u2022 ",-1)),n[4]||(n[4]=r("span",{class:"text-red-500 font-medium"},"Shadow-banned",-1))],64)):I("",!0)])]),d.value?(e(),u("p",ke," Deleted ")):(e(),u("p",_e,w(t.comment.comment),1)),d.value?I("",!0):(e(),u("div",we,[m(me,{liked:t.comment.liked,likes:t.comment.likes,"thing-id":t.comment.id,"thing-type":v(se).Comment},null,8,["liked","likes","thing-id","thing-type"]),m(j,{onClick:n[0]||(n[0]=p=>s.value=!s.value),dense:!0,class:"!text-xs"},{default:z(()=>[F(w(s.value?"Cancel":"Reply"),1)]),_:1}),m(j,{onClick:n[1]||(n[1]=p=>g.value=!0),dense:!0,class:"!text-xs inline-flex items-center gap-1",title:"Report comment"},{default:z(()=>[m(V,{name:"flag",class:"h-3.5 w-3.5"}),n[5]||(n[5]=r("span",null,"Report",-1))]),_:1})])),!d.value&&s.value?(e(),$(S,{key:3,"parent-id":t.comment.id,"thing-id":i.thingId,"thing-type":i.thingType,class:"mt-2",onAddComment:C},null,8,["parent-id","thing-id","thing-type"])):I("",!0),(c=t.comment.comments)!=null&&c.length?(e(),u("div",$e,[(e(!0),u(b,null,E(t.comment.comments,p=>(e(),$(a,{class:"mt-3 first:mt-0",comment:p,"highlight-comment-id":i.highlightCommentId,"thing-type":i.thingType,"thing-id":i.thingId},null,8,["comment","highlight-comment-id","thing-type","thing-id"]))),256))])):I("",!0)])])],2),m(re,{modelValue:g.value,"onUpdate:modelValue":n[2]||(n[2]=p=>g.value=p),"content-id":t.comment.id,"content-type":"comment",title:"Report this Comment"},null,8,["modelValue","content-id"])],64)}}}),be={key:0},Ie={class:"inline-flex items-center gap-2 font-medium"},ze={key:1},Ee=D({__name:"Comments",props:{thingId:{},thingType:{},highlightCommentId:{}},async setup(t){let x,C;const{isMobile:i}=le(),s=t,g=y(!1),d=y([]),k=async n=>{d.value.unshift(n)};return d.value=([x,C]=ie(()=>Y.comments.getComments(s.thingId)),x=await x,C(),x),(n,o)=>v(i)?(e(),u("div",be,[r("div",{class:"border-t border-b py-3 border-zinc-800 flex items-center justify-between px-2",onClick:o[0]||(o[0]=a=>g.value=!0)},[r("span",Ie,[m(V,{name:"flag",class:"h-4 w-4 text-zinc-500"}),r("span",null,w(d.value.length)+" comments",1)]),m(V,{name:"unfold",class:"h-6 w-6"})]),m(oe,{modelValue:g.value,"onUpdate:modelValue":o[1]||(o[1]=a=>g.value=a)},{default:z(()=>[m(S,{"thing-id":s.thingId,"thing-type":s.thingType,class:"mb-6 px-2",onAddComment:k},null,8,["thing-id","thing-type"]),(e(!0),u(b,null,E(d.value,a=>(e(),$(H,{class:"my-4 px-2","thing-type":s.thingType,"thing-id":s.thingId,"highlight-comment-id":s.highlightCommentId,comment:a},null,8,["thing-type","thing-id","highlight-comment-id","comment"]))),256))]),_:1},8,["modelValue"])])):(e(),u("div",ze,[o[2]||(o[2]=r("div",{class:"mb-3"},null,-1)),m(S,{"thing-id":s.thingId,"thing-type":s.thingType,class:"mb-3",onAddComment:k},null,8,["thing-id","thing-type"]),(e(!0),u(b,null,E(d.value,a=>(e(),$(H,{class:"my-2",comment:a,"highlight-comment-id":s.highlightCommentId,"thing-type":s.thingType,"thing-id":s.thingId},null,8,["comment","highlight-comment-id","thing-type","thing-id"]))),256))]))}});
1export{Ee as _};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.