1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[43029],{18756:(e,s,t)=>{t.d(s,{A:()=>n});let n=(0,t(71847).A)("at-sign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]])},42533:(e,s,t)=>{t.d(s,{y:()=>n});let n=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1})},43029:(e,s,t)=>{t.r(s),t.d(s,{TikTokPanel:()=>N});var n=t(95155),l=t(12115),a=t(93499),r=t(35299),i=t(18756),o=t(33789),c=t(90235),d=t(50020),m=t(4246),u=t(42533),x=t(46258),p=t(83457),f=t(5937),h=t(65313);function v(e){let{quiet:s,onThemeSelect:t}=e,[a,r]=(0,l.useState)("all");return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"glass-surface inline-flex items-center gap-1 p-1",children:[["rooms","By post"],["all","All comments"]].map(e=>{let[s,t]=e;return(0,n.jsx)("button",{type:"button","aria-pressed":a===s,onClick:()=>r(s),className:a===s?"rounded-full bg-gradient-to-r from-brand-primary to-brand-secondary px-3 py-1 text-xs font-semibold text-white shadow-sm":"rounded-full px-3 py-1 text-xs font-semibold text-muted-foreground hover:text-foreground",children:t},s)})}),"rooms"===a?(0,n.jsx)(g,{onShowAll:()=>r("all")}):(0,n.jsx)(j,{quiet:s,onThemeSelect:t})]})}function j(e){var s,t,a;let{quiet:r,onThemeSelect:i}=e,[o,c]=(0,l.useState)(0),u=(0,d.oo)({platform:"tiktok"},o),x=u.data,p=null!=(s=null==x?void 0:x.total)?s:0,f=Math.max(0,Math.ceil(p/(null!=(t=null==x?void 0:x.pageSize)?t:25))-1);return u.isLoading?(0,n.jsx)(m._T,{}):u.isError?(0,n.jsx)(h.E,{onRetry:()=>void u.refetch()}):0===p?(0,n.jsxs)("div",{className:"glass-surface px-4 py-10 text-center",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-foreground",children:r?"TikTok is quiet for this brand":"No TikTok comments yet"}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:r?"The last pass finished cleanly but found no comment-worthy videos â small accounts often have sparse comment volume. We keep checking on every re-sync.":"Comments appear here once the first harvest finishes."})]}):(0,n.jsxs)("div",{className:"space-y-2",children:[(null!=(a=null==x?void 0:x.mentions)?a:[]).map(e=>{var s,t;return(0,n.jsx)(y,{mention:e,themes:null!=(t=null==x||null==(s=x.themesByMention)?void 0:s[e.id])?t:[],onThemeSelect:i},e.id)}),f>0&&(0,n.jsx)(m.ed,{page:o,lastPage:f,onPage:c})]})}function g(e){var s,t;let{onShowAll:r}=e,[i,o]=(0,l.useState)(0),c=(0,d.DK)("tiktok",i);if(c.isLoading)return(0,n.jsx)(m._T,{});if(c.isError)return(0,n.jsx)(h.E,{onRetry:()=>void c.refetch()});let u=c.data,x=Math.max(0,Math.ceil((null!=(s=null==u?void 0:u.total)?s:0)/(null!=(t=null==u?void 0:u.pageSize)?t:5))-1);return(null==u?void 0:u.rooms.length)?(0,n.jsxs)("div",{className:"space-y-3",children:[u.rooms.map(e=>{var s;return(0,n.jsxs)("section",{className:"section-frost space-y-3 p-4",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"text-sm font-semibold text-foreground",children:(null==(s=e.parent.caption)?void 0:s.trim())||"Untitled video"}),(0,n.jsxs)("p",{className:"mt-1 text-xs text-muted-foreground",children:[e.parent.postedAt?new Date(e.parent.postedAt).toLocaleDateString():"Date unavailable"," ","\xb7 ",e.commentTotal," kept comment",1===e.commentTotal?"":"s"]})]}),(0,n.jsx)("a",{href:e.parent.url,target:"_blank",rel:"noreferrer","aria-label":"Open the video on TikTok",className:"text-muted-foreground hover:text-brand-secondary",children:(0,n.jsx)(a.A,{className:"h-4 w-4"})})]}),(0,n.jsx)("div",{className:"space-y-2 border-l-2 border-brand-secondary/20 pl-3",children:e.comments.map(e=>(0,n.jsx)(y,{mention:e},e.id))}),e.commentTotal>e.comments.length&&(0,n.jsx)("button",{type:"button",className:"btn-frost-soft",onClick:r,children:"Show all comments"})]},e.parent.id)}),x>0&&(0,n.jsx)(m.ed,{page:i,lastPage:x,onPage:o})]}):(0,n.jsxs)("div",{className:"glass-surface px-4 py-10 text-center",children:[(0,n.jsx)("p",{className:"text-sm font-medium",children:"No comment rooms yet"}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Posts appear here once their comments have been collected."})]})}function y(e){var s;let{mention:t,themes:l=[],onThemeSelect:r}=e,i=null==(s=t.tags)?void 0:s.tiktok;return(0,n.jsxs)("div",{className:"glass-surface space-y-1.5 px-3 py-2.5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(null==i?void 0:i.isReply)&&(0,n.jsx)("span",{className:"glass-pill px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",children:"Reply"}),t.posted_at&&new Date(t.posted_at).toLocaleDateString()]}),t.url&&(0,n.jsx)("a",{href:t.url,target:"_blank",rel:"noreferrer","aria-label":"Open the video on TikTok",className:"text-muted-foreground hover:text-brand-secondary",children:(0,n.jsx)(a.A,{className:"h-3 w-3"})})]}),(0,n.jsx)("p",{className:"text-sm leading-snug text-foreground",children:t.body}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground",children:[(null==i?void 0:i.likes)!=null&&(0,n.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,n.jsx)(p.A,{className:"h-3 w-3"})," ",i.likes]}),(null==i?void 0:i.replyCount)!=null&&(0,n.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,n.jsx)(f.A,{className:"h-3 w-3"})," ",i.replyCount]}),t.parent_title&&(0,n.jsxs)("span",{className:"min-w-0 truncate",children:["on: â",t.parent_title,"â"]})]}),(0,n.jsx)(m.Fo,{themes:l,onSelect:r})]})}
1function N(e){var s,t,i,o,c,p,f,h,j,g,N,T;let{source:C,mentionCount:S}=e,A=(0,d.LA)(),_=A.data,[F,E]=(0,l.useState)(!1),[P,L]=(0,l.useState)(null),M=null!=(t=null==_?void 0:_.profile)?t:null,D=(null==_?void 0:_.resolving)===!0,R=!!(null==M?void 0:M.confirmedAt),W=null!=(o=null!=(i=null==_?void 0:_.sourceStatus)?i:null==C?void 0:C.status)?o:"available",q=null!=(p=null!=(c=null==_?void 0:_.lastError)?c:null==C||null==(s=C.meta)?void 0:s.lastError)?p:null,O=F||!M&&!D&&!(null==_?void 0:_.username),z=!!M&&R&&!O,I=(0,d.lV)("brand","tiktok",z);if((0,l.useEffect)(()=>{L(null)},[null==C?void 0:C.id,null==M?void 0:M.username]),M&&R&&!O){let e=null==(f=I.data)?void 0:f.themes.find(e=>e.id===P),s="synced"===W&&0===S&&(null==_||null==(h=_.lastRun)?void 0:h.zeroItems)===!0;return(0,n.jsx)(m.UT,{rail:(0,n.jsx)(m.CL,{identity:(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)(x.v,{sourceType:"tiktok_comments"}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"truncate text-sm font-semibold text-foreground",children:null!=(j=M.displayName)?j:"@".concat(M.username)}),(0,n.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:["@",M.username,null!=M.followers&&(0,n.jsxs)(n.Fragment,{children:[" \xb7 ",u.y.format(M.followers)," followers"]}),null!=M.videoCount&&(0,n.jsxs)(n.Fragment,{children:[" \xb7 ",u.y.format(M.videoCount)," videos"]})]})]})]}),(0,n.jsxs)("a",{href:M.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs font-medium text-brand-secondary",children:["Open on TikTok ",(0,n.jsx)(a.A,{className:"h-3 w-3"})]})]}),source:C,vitals:(0,n.jsxs)("div",{className:"glass-surface divide-y divide-purple-100/70 px-3",children:[(0,n.jsx)(m.W8,{label:"Comments collected",value:u.y.format(null!=(g=null==_?void 0:_.commentsIngested)?g:0)}),(0,n.jsx)(m.W8,{label:"Mentions kept",value:u.y.format(S)})]}),themes:I,selectedThemeId:P,onSelectTheme:L,countOf:e=>{var s,t;return null!=(t=null==(s=e.slice)?void 0:s.frequency)?t:0},footer:(0,n.jsx)("button",{type:"button",className:"btn-frost-soft",onClick:()=>E(!0),children:"Change profile"})}),children:(0,n.jsxs)("div",{className:"space-y-3",children:[q&&!(null==_?void 0:_.scraping)&&(0,n.jsxs)("div",{className:"banner-resume p-3 text-xs",children:[q.message," â check the profile and try again."]}),e?(0,n.jsx)(m.Fz,{theme:e,platform:"tiktok",renderMention:e=>(0,n.jsx)(y,{mention:e}),onClear:()=>L(null)}):(0,n.jsx)(v,{quiet:s,onThemeSelect:L})]})})}return(0,n.jsx)("div",{className:"section-frost",children:(0,n.jsxs)("div",{className:"space-y-4 p-4",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,n.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,n.jsx)(x.v,{sourceType:"tiktok_comments",size:"sm"}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold",children:"TikTok comments"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"What viewers say under your own videos â questions are objections in disguise."})]})]}),(0,n.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:M&&!O&&(0,n.jsx)("button",{type:"button",className:"btn-frost-soft flex-none",onClick:()=>E(!0),children:"Change profile"})})]}),q&&!D&&!(null==_?void 0:_.scraping)&&(0,n.jsxs)("div",{className:"banner-resume text-xs",children:[q.message," â check the profile and try again."]}),O?(0,n.jsx)(b,{initialUsername:null!=(T=null!=(N=null==_?void 0:_.username)?N:null==M?void 0:M.username)?T:"",pending:D,onSubmitted:()=>E(!1)}):D||A.isLoading?(0,n.jsxs)("div",{className:"glass-surface flex items-center gap-2 px-3 py-4 text-xs text-muted-foreground",children:[(0,n.jsx)(r.A,{className:"h-3.5 w-3.5 animate-spin motion-reduce:animate-none"}),"Looking up your TikTok profileâ¦"]}):(null==M?void 0:M.unavailable)?(0,n.jsx)(k,{profile:M,onEdit:()=>E(!0)}):M&&!R?(0,n.jsx)(w,{profile:M,onEdit:()=>E(!0)}):null]})})}function b(e){let{initialUsername:s,pending:t,onSubmitted:a}=e,m=(0,d.hB)(),[u,x]=(0,l.useState)(s),p=!m.isPending&&!t&&""!==u.trim();return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)(c.J,{className:"text-xs",children:"Your brand's TikTok profile"}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(i.A,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,n.jsx)(o.p,{value:u,onChange:e=>x(e.target.value),placeholder:"yourbrand",className:"glass-surface h-9 border-purple-100/70 pl-8 text-sm shadow-none"})]}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:'We read the comment sections of your own videos â the fans, the complaints, and the "does it ship toâ¦" questions. Paste the profile URL if that\'s easier.'})]}),(0,n.jsxs)("button",{type:"button",className:"btn-frost-primary inline-flex items-center gap-1.5 disabled:opacity-50",disabled:!p,onClick:()=>m.mutate({username:u.trim()},{onSuccess:a}),children:[m.isPending||t?(0,n.jsx)(r.A,{className:"h-3.5 w-3.5 animate-spin motion-reduce:animate-none"}):(0,n.jsx)(i.A,{className:"h-3.5 w-3.5"}),"Find my TikTok profile"]})]})}function k(e){let{profile:s,onEdit:t}=e;return(0,n.jsxs)("div",{className:"glass-surface space-y-2 px-3 py-4",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-foreground",children:"private"===s.unavailable?"@".concat(s.username," looks private"):"We couldn't find @".concat(s.username)}),(0,n.jsxs)("p",{className:"text-xs text-muted-foreground",children:["private"===s.unavailable?"Comments on a private profile cannot be read. If this is your brand account, make it public or use a different public profile.":"That username did not resolve on TikTok â double-check the spelling or paste your profile URL.",s.unavailableMessage?(0,n.jsxs)(n.Fragment,{children:[" (",s.unavailableMessage,")"]}):null]}),(0,n.jsx)("button",{type:"button",className:"btn-frost-soft",onClick:t,children:"Try a different username"})]})}function w(e){var s;let{profile:t,onEdit:l}=e,i=(0,d.Ot)();return(0,n.jsxs)("div",{className:"glass-surface space-y-3 px-3 py-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:null!=(s=t.displayName)?s:"@".concat(t.username)}),(0,n.jsx)("a",{href:t.url,target:"_blank",rel:"noreferrer","aria-label":"Open the profile on TikTok",className:"flex-none text-muted-foreground transition-colors hover:text-brand-secondary",children:(0,n.jsx)(a.A,{className:"h-3 w-3"})})]}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:t.degraded?(0,n.jsx)(n.Fragment,{children:"We couldn't verify this profile's details â it may have no videos yet. Confirm only if this is your brand."}):(0,n.jsxs)(n.Fragment,{children:["@",t.username,null!=t.followers&&(0,n.jsxs)(n.Fragment,{children:[" \xb7 ",u.y.format(t.followers)," followers"]}),null!=t.videoCount&&(0,n.jsxs)(n.Fragment,{children:[" \xb7 ",u.y.format(t.videoCount)," videos"]})]})})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsxs)("button",{type:"button",className:"btn-frost-primary inline-flex items-center gap-1.5 disabled:opacity-50",disabled:i.isPending,onClick:()=>i.mutate(void 0),children:[i.isPending?(0,n.jsx)(r.A,{className:"h-3.5 w-3.5 animate-spin motion-reduce:animate-none"}):null,"Yes, this is our profile â start reading comments"]}),(0,n.jsx)("button",{type:"button",className:"btn-frost-soft",onClick:l,children:"Not our profile"})]})]})}}}]);
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.