PageSourceSearch

https://johnnylee.pw/_hyax-build/9qfVWLyK.js

js johnnylee.pw collected 2026-10-08 19:15:28 UTC 13,232 bytes, 1 lines download raw bytes

1import{u as pe,S as me}from"./5LGOBbys.js";import{e as _e,K as fe,l as ge,J as he,a9 as ve,aF as ye,z as xe,c,j as i,w as d,u as e,a2 as I,b as t,ds as J,t as n,F as x,U as T,m as be,a7 as ke,T as we,Z as Re,o as a,a as _,D as ze,aJ as Z,S as Ce,ak as Ae,v as $e,aO as Ie,bt as ee,i as h,al as Te,d as A,R as De,cJ as Se,O as Ue,aQ as je,d5 as Ee,b_ as Le,n as te,ek as Fe,eb as Ve,x as P}from"./B3bClFiC.js";import{_ as B,d as Ne}from"./BeMIwZbb.js";(function(){try{var b=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};b.SENTRY_RELEASE={id:"16d86feaf6e8b56f348e0082049db0299aadb4ad"};var k=new b.Error().stack;k&&(b._sentryDebugIds=b._sentryDebugIds||{},b._sentryDebugIds[k]="ba9ac1aa-1b29-4459-acf5-ef20cb5c351e",b._sentryDebugIdIdentifier="sentry-dbid-ba9ac1aa-1b29-4459-acf5-ef20cb5c351e")}catch{}})();const Pe={class:"app-container"},Be={key:0,class:"flex items-center justify-center py-24"},Me={key:1,class:"flex flex-col items-center justify-center py-24"},Ye={class:"mb-6 flex size-16 items-center justify-center rounded-2xl bg-gradient-to-br from-purple-400 to-violet-500"},Ge={class:"text-main font-semibold"},He={class:"mt-2 max-w-md text-center text-helper text-foreground/50"},Ke={class:"flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between"},Je={class:"flex-1"},Oe={class:"flex gap-2"},qe={key:0,class:"mt-3 flex flex-wrap gap-1.5"},Qe=["onClick"],We={key:0,class:"flex flex-col items-center justify-center py-12"},Xe={class:"text-main font-semibold"},Ze={class:"mt-1 text-helper text-foreground/50"},et={key:1,class:"flex flex-col items-center justify-center py-24"},tt={class:"text-main font-medium text-foreground/75"},st={class:"mt-1 text-helper text-foreground/50"},ot={key:2,class:"space-y-6"},at={class:"flex items-start justify-between gap-3"},nt={class:"flex items-center gap-3"},it={class:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-purple-500/10"},lt={key:0,class:"flex flex-col items-center justify-center rounded-lg border border-dashed border-border/60 py-10 text-center"},rt={class:"text-helper text-foreground/60"},ct={key:0,class:"mb-6"},dt={class:"text-helper font-medium text-foreground/60 mb-2"},ut={class:"overflow-x-auto"},pt={class:"w-full text-left"},mt={class:"border-b"},_t={class:"pb-2 pr-4 text-helper font-medium text-foreground/50"},ft={class:"pb-2 pr-4 text-helper font-medium text-foreground/50"},gt={class:"pb-2 text-right text-helper font-medium text-foreground/50"},ht={class:"max-w-[300px] py-2.5 pr-4"},vt=["href"],yt={class:"truncate"},xt={class:"py-2.5 pr-4"},bt={class:"py-2.5 text-right"},kt={class:"flex items-center justify-end gap-1"},wt={class:"text-helper tabular-nums font-medium"},Rt={key:1,class:"mb-5"},zt={class:"text-helper font-medium text-foreground/60 mb-2"},Ct={class:"flex flex-wrap gap-1.5"},At={key:2,class:"mb-5"},$t={class:"text-helper font-medium text-foreground/60 mb-2"},It={class:"space-y-1.5"},Tt={class:"text-foreground/75"},Dt={class:"mb-2 flex items-center justify-between gap-3"},St={class:"text-helper font-medium text-foreground/60"},Ut={key:0,class:"space-y-2"},jt={class:"flex items-center gap-2 min-w-0"},Et={class:"flex shrink-0 items-center gap-2"},Lt={key:1,class:"text-helper text-foreground/50"},Pt=_e({__name:"competitors",async setup(b){let k,M;const{t:s}=fe();ge({title:()=>s("seoRest.competitors.metaTitle")});const{apiCaller:D}=he(),f=ve(),{toast:S}=ye(),{analysisResult:w,currentAnalysisId:F,hasAnalyzed:O,hasLoadedFromDb:se,isLoadingLatest:Y,isAnalyzing:U,niche:q,competitorUrls:y,hydrateFromDb:oe,setResult:ae}=pe();if(!O.value&&!se.value&&f.value){Y.value=!0;const{data:o}=([k,M]=xe(()=>Re(`seo-latest-competitors-${f.value}`,()=>D.seoEngine.getLatest.query({teamId:f.value}))),k=await k,M(),k);o.value&&oe(o.value),Y.value=!1}const V=P("");function Q(){const o=V.value.trim();o&&!y.value.includes(o)&&(y.value.push(o),V.value="")}function ne(o){y.value.splice(o,1)}function R(o){const r=(o||"").trim().toLowerCase();return r?r.replace(/^https?:\/\//,"").replace(/^www\./,"").replace(/\/+$/,""):""}const W=be(()=>{const o=w.value?.content_gaps??[],r=new Set,p=y.value.map(m=>{const v=R(m),g=o.findIndex((C,$)=>!r.has($)&&R(C.competitor_url)===v);return g!==-1&&r.add(g),{url:m,gapIndex:g===-1?null:g,gap:g===-1?null:o[g]}});return o.forEach((m,v)=>{r.has(v)||p.push({url:m.competitor_url,gapIndex:v,gap:m})}),p}),z=P(new Set);async function ie(o){if(!f.value)return;const r=R(o);if(!z.value.has(r)){z.value.add(r);try{const p=await D.seoEngine.analyzeCompetitor.mutate({teamId:f.value,analysisId:F.value??void 0,competitorUrl:o,niche:q.value||void 0});w.value&&(w.value.content_gaps=p.content_gaps),F.value=p.analysisId,Array.isArray(p.competitorUrls)&&(y.value=p.competitorUrls)}catch(p){S({title:s("seoRest.competitors.analysisFailed"),description:p?.message||s("seoRest.competitors.failedCompetitor"),variant:"error"})}finally{z.value.delete(r)}}}async function le(){if(f.value){U.value=!0;try{const o=await D.seoEngine.analyze.mutate({teamId:f.value,niche:q.value||void 0,competitorUrls:y.value.length>0?y.value:void 0});ae(o)}catch(o){S({title:s("seoRest.competitors.analysisFailed"),description:o?.message||s("seoRest.competitors.failedSeo"),variant:"error"})}finally{U.value=!1}}}
1function G(o){return typeof o=="string"?o:o.title}function j(o){return typeof o=="string"?!1:!!o.done}const H=P(new Set),E=P(new Set);async function re(o,r,p){if(!f.value||!w.value)return;const m=w.value.content_gaps[o],v=m?.suggested_articles[r];if(!v)return;const g=`${o}:${r}`,C=G(v),$=j(v);m.suggested_articles[r]={title:C,done:p},H.value.add(g);try{await D.seoEngine.setSuggestedArticleDone.mutate({teamId:f.value,analysisId:F.value??void 0,gapIndex:o,articleIndex:r,done:p})}catch(K){m.suggested_articles[r]={title:C,done:$},S({title:s("seoRest.competitors.couldntUpdate"),description:K?.message||s("seoRest.competitors.failedSuggestionUpdate"),variant:"error"})}finally{H.value.delete(g)}}async function ce(o){if(!(!f.value||!w.value)&&!E.value.has(o)){E.value.add(o);try{const r=await D.seoEngine.suggestMoreArticles.mutate({teamId:f.value,analysisId:F.value??void 0,gapIndex:o}),p=w.value.content_gaps[o];p&&(p.suggested_articles=r.suggested_articles),r.newArticles.length===0&&S({title:s("seoRest.competitors.noNewIdeas"),description:s("seoRest.competitors.noNewIdeasDescription")})}catch(r){S({title:s("seoRest.competitors.couldntGenerate"),description:r?.message||s("seoRest.competitors.failedGenerate"),variant:"error"})}finally{E.value.delete(o)}}}return(o,r)=>{const p=me,m=ze,v=ke,g=Ae,C=Ce,$=we,K=Ue,de=Ne,ue=De;return a(),c("div",Pe,[i(p,null,{title:d(()=>[_(n(e(s)("seoRest.competitors.title")),1)]),subtitle:d(()=>[_(n(e(s)("seoRest.competitors.subtitle")),1)]),_:1}),e(Y)?(a(),c("div",Be,[i(e(I),{class:"size-6 animate-spin text-foreground/50"})])):e(O)?(a(),c(x,{key:2},[i($,{class:"mb-8"},{default:d(()=>[i(C,{class:"pt-6"},{default:d(()=>[t("div",Ke,[t("div",Je,[i(g,{class:"text-helper mb-1.5 block font-medium"},{default:d(()=>[_(n(e(s)("seoRest.competitors.addCompetitors")),1)]),_:1}),t("div",Oe,[i(e($e),{modelValue:V.value,"onUpdate:modelValue":r[0]||(r[0]=l=>V.value=l),placeholder:e(s)("seoRest.competitors.urlPlaceholder"),onKeydown:Ie(Q,["enter"]),class:"max-w-sm flex-1"},null,8,["modelValue","placeholder"]),i(m,{variant:"outline",size:"sm",onClick:Q,class:"shrink-0"},{default:d(()=>[i(e(ee),{class:"mr-1.5 size-4"}),_(" "+n(e(s)("seoRest.common.add")),1)]),_:1})]),e(y).length>0?(a(),c("div",qe,[(a(!0),c(x,null,T(e(y),(l,N)=>
1(a(),h(e(B),{key:N,variant:"secondary",class:"gap-1 pr-1"},{default:d(()=>[_(n(l)+" ",1),t("button",{onClick:u=>ne(N),class:"ml-1 hover:text-foreground"},[i(e(Te),{class:"size-3"})],8,Qe)]),_:2},1024))),128))])):A("",!0)]),i(m,{disabled:e(U),onClick:le,class:"shrink-0"},{default:d(()=>[e(U)?(a(),h(e(I),{key:0,class:"mr-2 size-4 animate-spin"})):A("",!0),_(" "+n(e(s)("seoRest.common.reAnalyze")),1)]),_:1},8,["disabled"])])]),_:1})]),_:1}),e(U)?(a(),c("div",We,[i(e(I),{class:"mb-4 size-10 animate-spin text-blue-500"}),t("p",Xe,n(e(s)("seoRest.competitors.runningAnalysis")),1),t("p",Ze,n(e(s)("seoRest.competitors.runningAnalysisDescription")),1)])):W.value.length===0?(a(),c("div",et,[i(e(J),{class:"mx-auto mb-4 size-10 text-foreground/25"}),t("p",tt,n(e(s)("seoRest.competitors.noCompetitorsYet")),1),t("p",st,n(e(s)("seoRest.competitors.noCompetitorsYetDescription")),1)])):(a(),c("div",ot,[(a(!0),c(x,null,T(W.value,(l,N)=>(a(),h($,{key:l.url+":"+N},{default:d(()=>[i(ue,null,{default:d(()=>[t("div",at,[t("div",nt,[t("div",it,[i(e(Se),{class:"size-4 text-purple-500"})]),t("div",null,[i(K,{class:"text-main"},{default:d(()=>[_(n(l.url),1)]),_:2},1024),i(de,null,{default:d(()=>[_(n(e(s)("seoRest.competitors.contentAnalysis")),1)]),_:1})])]),i(m,{variant:"outline",size:"sm",class:"shrink-0",disabled:z.value.has(R(l.url)),onClick:u=>ie(l.url)},{default:d(()=>[z.value.has(R(l.url))?(a(),h(e(I),{key:0,class:"mr-1.5 size-3.5 animate-spin"})):A("",!0),_(" "+n(l.gap?e(s)("seoRest.common.reanalyze"):e(s)("seoRest.common.analyze")),1)]),_:2},1032,["disabled","onClick"])])]),_:2},1024),i(C,null,{default:d(()=>[l.gap?l.gap&&l.gapIndex!==null?(a(),c(x,{key:1},[l.gap.top_pages&&l.gap.top_pages.length>0?(a(),c("div",ct,[t("p",dt,n(e(s)("seoRest.competitors.topRankingPages")),1),t("div",ut,[t("table",pt,[t("thead",null,[t("tr",mt,[t("th",_t,n(e(s)("seoRest.common.page")),1),t("th",ft,n(e(s)("seoRest.common.keyword")),1),t("th",gt,n(e(s)("seoRest.common.estTraffic")),1
1)])]),t("tbody",null,[(a(!0),c(x,null,T(l.gap.top_pages,(u,L)=>(a(),c("tr",{key:L,class:"border-b border-border/30 last:border-0"},[t("td",ht,[t("a",{href:u.url,target:"_blank",rel:"noopener noreferrer",class:"group flex items-center gap-1.5 text-helper text-primary hover:underline"},[t("span",yt,n(u.title),1),i(e(je),{class:"size-3 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity"})],8,vt)]),t("td",xt,[i(e(B),{variant:"secondary",class:"text-[11px]"},{default:d(()=>[_(n(u.keyword),1)]),_:2},1024)]),t("td",bt,[t("div",kt,[i(e(Ee),{class:"size-3 text-foreground/40"}),t("span",wt,n(u.estimated_traffic),1)])])]))),128))])])])])):A("",!0),l.gap.top_topics.length>0?(a(),c("div",Rt,[t("p",zt,n(e(s)("seoRest.competitors.topicsTheyCover")),1),t("div",Ct,[(a(!0),c(x,null,T(l.gap.top_topics,u=>(a(),h(e(B),{key:u,variant:"secondary",class:"text-[11px]"},{default:d(()=>[_(n(u),1)]),_:2},1024))),128))])])):A("",!0),l.gap.missing_topics.length>0?(a(),c("div",At,[t("p",$t,n(e(s)("seoRest.competitors.topicsYoureMissing")),1),t("ul",It,[(a(!0),c(x,null,T(l.gap.missing_topics,u=>(a(),c("li",{key:u,class:"flex items-center gap-2 text-helper"},[i(e(Le),{class:"size-3.5 shrink-0 text-amber-500"}),t("span",Tt,n(u),1)]))),128))])])):A("",!0),t("div",null,[t("div",Dt,[t("p",St,n(e(s)("seoRest.competitors.suggestedArticles")),1),i(m,{variant:"ghost",size:"sm",class:"shrink-0",disabled:E.value.has(l.gapIndex),onClick:u=>ce(l.gapIndex)},{default:d(()=>[E.value.has(l.gapIndex)?(a(),h(e(I),{key:0,class:"mr-1.5 size-3.5 animate-spin"})):(a(),h(e(ee),{key:1,class:"mr-1.5 size-3.5"})),_(" "+n(e(s)("seoRest.competitors.addMoreSuggestions")),1)]),_:2},1032,["disabled","onClick"])]),l.gap.suggested_articles.length>0?(a(),c("div",Ut,[(a(!0),c(x,null,T(l.gap.suggested_articles,(u,L)=>(a(),c("div",{key:L,class:te(["flex items-center justify-between gap-3 rounded-lg border border-border/50 p-3",j(u)?"opacity-60":""])},[t("div",jt,[i(e(Fe),{"model-value":j(u),disabled:H.value.has(`${l.gapIndex}:${L}`),class:"size-4 shrink-0 rounded-full","aria-label":e(s)("seoRest.competitors.markWritten"),"onUpdate:modelValue":X=>re(l.gapIndex,L,X===!0)},null,8,["model-value","disabled","aria-label","onUpdate:modelValue"]),i(e(Ve),{class:"size-3.5 shrink-0 text-blue-500"}),t("span",{class:te(["text-helper truncate",j(u)?"text-foreground/50 line-through":"text-foreground/75"])},n(G(u)),3)]),t("div",Et,[j(u)?(a(),h(e(B),{key:0,class:"bg-emerald-500/10 text-[11px] text-emerald-600 dark:text-emerald-400"},{default:d(()=>[_(n(e(s)("seoRest.competitors.written")),1)]),_:1})):(a(),h(m,{key:1,variant:"outline",size:"sm",onClick:X=>o.$router.push(`/app/posts/new?title=${encodeURIComponent(G(u))}&ai=write`)},{default:d(()=>[_(n(e(s)("seoRest.competitors.generateArticle"))+" ",1),i(e(Z),{class:"ml-1.5 size-3.5"})]),_:1},8,["onClick"]))])],2))),128))])):(a(),c("p",Lt,n(e(s)("seoRest.competitors.noSuggestions")),1))])],64)):A("",!0):(a(),c("div",lt,[z.value.has(R(l.url))?(a(),h(e(I),{key:0,class:"mb-3 size-6 animate-spin text-blue-500"})):(a(),h(e(J),{key:1,class:"mb-3 size-8 text-foreground/25"})),t("p",rt,n(z.value.has(R(l.url))?e(s)("seoRest.competitors.analyzingThis"):e(s)("seoRest.competitors.notAnalyzedYet")),1)]))]),_:2},1024)]),_:2},1024))),128))]))],64)):(a(),c("div",Me,[t("div",Ye,[i(e(J),{class:"size-8 text-white"})]),t("p",Ge,n(e(s)("seoRest.competitors.runAnalysisFirst")),1),t("p",He,n(e(s)("seoRest.competitors.runAnalysisFirstDescription")),1),i(v,{to:"/app/seo/overview",class:"mt-4"},{default:d(()=>[i(m,{variant:"outline",size:"sm"},{default:d(()=>[_(n(e(s)("seoRest.competitors.goToOverview"))+" ",1),i(e(Z),{class:"ml-1.5 size-3.5"})]),_:1})]),_:1})]))])}}});export{Pt as default};

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.