PageSourceSearch

https://app.kairosy.ai/assets/ScanProgress-DW600bgn.js

js kairosy.ai collected 2026-10-05 12:08:21 UTC 14,116 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/paywallBus-4dv426dl.js","assets/createLucideIcon-CK4nXoeO.js","assets/chunk-6CSD65Y2-C5ktZCKi.js","assets/rivalFilter-B14DKobI.js","assets/engines-Bo4KlVdS.js"])))=>i.map(i=>d[i]);
2import{j as n}from"./jsx-runtime-Behk3VoH.js";import{r as u}from"./chunk-6CSD65Y2-C5ktZCKi.js";import{r as H}from"./index-B6i-FfWk.js";import{u as se}from"./theme-VyyPDlNq.js";import{L as F,N as K,n as re,s as ae,u as ne,e as ie}from"./auth-DYG4wfmy.js";import{n as Y,g as Z}from"./upgradeClicks-Do9BbhrH.js";import{U as oe}from"./UpgradeModal-CgTjwlx4.js";import{L as ee}from"./loader-circle-CHHAagaY.js";import{X as ce}from"./x-wR8IJDx-.js";import{Q as le}from"./quote-DIGm1MOY.js";const de="modulepreload",ue=function(a){return"/"+a},te={},me=function(t,r,s){let o=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));o=Promise.allSettled(r.map(m=>{if(m=ue(m),m in te)return;te[m]=!0;const y=m.endsWith(".css"),N=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${N}`))return;const p=document.createElement("link");if(p.rel=y?"stylesheet":de,y||(p.as="script"),p.crossOrigin="",p.href=m,d&&p.setAttribute("nonce",d),document.head.appendChild(p),y)return new Promise((A,w)=>{p.addEventListener("load",A),p.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${m}`)))})}))}function g(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return o.then(c=>{for(const d of c||[])d.status==="rejected"&&g(d.reason);return t().catch(g)})},he="full",fe=["ChatGPT","Gemini","Claude","Perplexity"];function ge(a){const t=a.replace(/^https?:\/\//i,"").replace(/^www\./i,""),r=t.match(/^(?:youtube\.com|tiktok\.com|instagram\.com|x\.com|twitter\.com|facebook\.com|medium\.com|github\.com)\/@?([\w.\-]{2,60})/i)||t.match(/^linkedin\.com\/(?:company|in)\/([\w.\-%]{2,60})/i);if(r){let o=r[1];try{o=decodeURIComponent(o)}catch{}if(!/^(watch|channel|shorts|results|playlist|user|c|share|reel|p|pages|groups|hashtag|search|explore|about|feed|home|browse|login|signup|premium|features)$/i.test(o))return o}const s=t.replace(/\/.*$/,"");return/^[^\s]+\.[a-z]{2,}$/i.test(s)?s.split(".")[0]:a}const pe=a=>new Promise(t=>setTimeout(t,a)),be=["audience","problem","useCase","outcome","need","constraint","useCaseB","pricing"],we=a=>{const t={},r=((a==null?void 0:a.category)||"").toString().replace(/\s+/g," ").trim().slice(0,120);r&&(t.category=r);const s={};for(const o of be){const g=((a==null?void 0:a[o])||"").toString().replace(/\s+/g," ").trim().slice(0,120);g&&(s[o]=g)}return Object.keys(s).length&&(t.vars=s),t};async function ye(a,t,r,s){var $;const o=a.trim(),g=((s==null?void 0:s.competitors)||[]).map(e=>(e||"").toString().trim()).filter(Boolean),c=((s==null?void 0:s.refFor)||"").trim(),d=await F(),m=((s==null?void 0:s.brand)||"").trim().slice(0,80),y=Array.isArray(s==null?void 0:s.engines)?s.engines.map(String).filter(Boolean):[],N=we(s==null?void 0:s.questionVars),p=JSON.stringify({brand:m||ge(o),site:o,depth:he,locale:K(),market:r?Y(r):Z(),...s!=null&&s.confirm?{confirm:!0}:{},...c?{refFor:c}:{},...g.length?{competitors:g}:{},...y.length?{engines:y}:{},...s!=null&&s.newProject?{newProject:!0}:{},...s!=null&&s.onboarding?{onboarding:!0}:{},...N}),A=async e=>fetch("/api/scan-start",{method:"POST",headers:{"Content-Type":"application/json",...e?{Authorization:"Bearer "+e}:{}},body:p});let w=d,x=await A(w);if(x.status===401&&re()){const e=await F(6e3);e&&(w=e,x=await A(w))}if(!x.ok){let e=null;try{e=await x.json()}catch{}const i=((e==null?void 0:e.error)||"").toString();throw x.status===422&&(e!=null&&e.needsConfirm)?Object.assign(new Error(i||"confirm needed"),{needsConfirm:String(e.needsConfirm),host:(e.host||"").toString()}):x.status===401?Object.assign(new Error(i||"scan failed"),{authExpired:!0}):x.status===402&&(e!=null&&e.overProjects)?Object.assign(new Error(i||"project limit reached"),{overProjects:!0,projectCap:Number(e==null?void 0:e.projectCap)||0,projectsUsed:Number(e==null?void 0:e.projectsUsed)||0}):x.status===402?Object.assign(new Error(i||"scan quota reached"),{overQuota:!0,trialEnded:!!(e!=null&&e.trialEnded)}):new Error(i||"scan failed")}const C=await x.json().catch(()=>({})),{jobId:R}=C;if(!R)throw new Error("could not start scan");const h=Array.isArray(C.engines)&&C.engines.length?C.engines.map(String):fe;t==null||t({type:"start",engines:h,total:h.length});const P=Date.now();let S=0,U=!1,O=0,T=0,I="",_=!1,D=0;const M=[12e3,4e4];for(;Date.now()-P<18e4;){await pe(1500);const{data:e}=await ae.from("scan_jobs").select("status, progress, report, error").eq("id",R).maybeSingle();if(!e)continue;(e.report||e.status!=="running")&&(_=!0),!_&&D<M.length&&Date.now()-P>M[D]&&(D++,fetch("/api/scan-kick",{method:"POST",headers:{"Content-Type":"application/json",...w?{Authorization:"Bearer "+w}:{}},body:JSON.stringify({jobId:R,locale:K(),market:r?Y(r):Z(),...c?{refFor:c}:{},...g.length?{competitors:g}:{},engines:h,...s!=null&&s.onboarding?{onboarding:!0}:{}
2,...N})}).catch(()=>{}));const i=e.status==="running"?($=e.report)==null?void 0:$.__live:null;if(i){if(typeof i.answered=="number"&&i.answered>O&&(O=i.answered,t==null||t({type:"answers",answered:i.answered,total:i.total||0})),i.by&&typeof i.by=="object"){const k={};for(const[E,z]of Object.entries(i.by))typeof z=="number"&&z>0&&(k[E]=z);const Q=Array.isArray(i.done)?i.done.map(String):[],v=JSON.stringify([k,Q]);v!==I&&(I=v,t==null||t({type:"engines",by:k,done:Q}))}const j=Array.isArray(i.teasers)?i.teasers:[];for(;T<j.length;){const k=j[T++];k!=null&&k.quote&&(t==null||t({type:"teaser",engine:k.engine||"",quote:k.quote}))}}const L=Math.min(h.length,e.progress||0);for(;S<L;)t==null||t({type:"engine",engine:h[S],done:S+1,total:h.length}),S++;if(L>=h.length&&!U&&e.status==="running"&&(U=!0,t==null||t({type:"classifying"})),e.status==="done"){const j=e.report;if(!j||j.__live||typeof j.score!="number")throw new Error("scan finished without a report");return t==null||t({type:"report",report:j}),j}if(e.status==="error")throw new Error(e.error||"scan failed")}throw new Error("scan timed out")}const xe=a=>a.trim().replace(/[\s.。!!]+$/u,"");function Re(){const[a,t]=u.useState("idle"),[r,s]=u.useState([]),[o,g]=u.useState([]),[c,d]=u.useState("prompts"),[m,y]=u.useState(0),[N,p]=u.useState(0),[A,w]=u.useState([]),[x,C]=u.useState(""),[R,h]=u.useState(!1),[P,S]=u.useState(!1),[U,O]=u.useState(""),T=u.useRef(null),[I,_]=u.useState(!1),[D,M]=u.useState(0),$=u.useRef(0),e=u.useRef(0),i=u.useRef(0);u.useEffect(()=>{if(a!=="scanning")return;const v=setInterval(()=>M(Math.floor((Date.now()-$.current)/1e3)),1e3);return()=>clearInterval(v)},[a]);async function L(v,E,z=!1,q,l){var W,V,J,X;t("scanning"),C(""),h(!1),S(!1),s([]),g([]),w([]),y(0),p(0),_(!1),d("prompts"),M(0),$.current=Date.now(),e.current=0,i.current=0;try{const b=!!((W=l==null?void 0:l.engines)!=null&&W.length||l!=null&&l.brand||(V=l==null?void 0:l.competitors)!=null&&V.length),B=await ye(v,f=>{f.type==="start"?(s(f.engines),d("asking")):f.type==="engine"?g(G=>[...new Set([...G,f.engine])]):f.type==="answers"?(y(f.answered),p(f.total)):f.type==="teaser"?w(G=>[...G,{engine:f.engine,quote:f.quote}]):f.type==="classifying"&&(d("reading"),e.current=Date.now())},E,z||q||b?{...z?{confirm:!0}:{},...q?{refFor:q}:{},...(J=l==null?void 0:l.engines)!=null&&J.length?{engines:l.engines}:{},...l!=null&&l.brand?{brand:l.brand}:{},...(X=l==null?void 0:l.competitors)!=null&&X.length?{competitors:l.competitors}:{}}:void 0);return t("idle"),_(!1),B&&!q&&me(()=>import("./paywallBus-4dv426dl.js").then(f=>f.ad),__vite__mapDeps([0,1,2,3,4])).then(f=>f.requestRescanPaywall(B)).catch(()=>{}),B}catch(b){if(b!=null&&b.overQuota)return t("idle"),_(!1),S(!!b.trialEnded),h(!0),null;if(b!=null&&b.needsConfirm){t("idle"),_(!1),O(b.host||v||v);const B=await new Promise(f=>{T.current=f});return O(""),B?L(v,E,!0,q,l):null}return C(b!=null&&b.authExpired?"__session_expired__":xe((b==null?void 0:b.message)||"")||"scan failed"),t("error"),_(!1),null}}let j=4;if(c==="asking")j=6+(N?m/N*62:0);else if(c==="reading"){const v=e.current?(Date.now()-e.current)/1e3:0;j=70+25*(1-Math.exp(-v/25))}i.current=Math.max(i.current,Math.min(95,j));const k=()=>{t("idle"),_(!1),h(!1)};return{status:a,engines:r,doneEngines:o,phase:c,answered:m,total:N,teasers:A,err:x,quota:R,trialEnded:P,confirmHost:U,answerConfirm:v=>{var E;(E=T.current)==null||E.call(T,v),T.current=null},minimized:I,elapsed:D,pct:i.current,start:L,close:k,setMinimized:_,dismissQuota:()=>h(!1)}}function Ee({scan:a}){const t=se(),r=ne(),s=ie(),{status:o,engines:g,doneEngines:c,phase:d,teasers:m,err:y,quota:N,trialEnded:p,minimized:A,elapsed:w,pct:x}=a;if(N)return n.jsx(oe,{open:!0,onClose:a.dismissQuota,title:r(p?"scan.trialOverTitle":"scan.quotaTitle"),body:r(p?"scan.trialOverBody":"scan.quotaBody")});if(a.confirmHost)return H.createPortal(n.jsx("div",{className:`${t} fixed inset-0 z-[100] grid place-items-center p-4`,style:{background:"rgba(0,0,0,0.55)"},children:n.jsxs("div",{className:"w-full max-w-sm rounded-[var(--r-md)] p-5 space-y-3",style:{background:"var(--card)",border:"1px solid var(--line-2)",boxShadow:"var(--card-shadow)",color:"var(--txt)"},children:[n.jsx("div",{className:"text-[length:var(--fs-md)] font-semibold",children:r("scan.confirmTitle")}),n.jsxs("p",{className:"text-[length:var(--fs-base)] leading-[var(--lh-base)] text-[color:var(--mut)]",children:[r("scan.confirmPre")," ",n.jsx("b",{className:"text-[color:var(--txt)] break-all",children:a.confirmHost})]}),n.jsx("p",{className:"text-[length:var(--fs-base)] leading-[var(--lh-base)] text-[color:var(--mut)]",children:r("scan.confirmPost")}),n.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[n.jsx("button",{onClick:()=>a.answerConfirm(!1),className:"h-9 px-3 rounded-[var(--r-sm)] text-[length:var(--fs-base)] hover:bg-[color:var(--card-2)] transition-colors",style:{border:"1px solid var(--line-2)",color:"var(--txt)"},children:r("scan.confirmEdit")}),n.jsx("button",{onClick:()=>a.answerConfirm(!0),className:"h-9 px-3 rounded-[var(--r-sm)] text-[length:var(--fs-base)]",style:{background:"var(--brand)",color:"var(--on-accent)"},children:r("scan.confirmGo")})]})]})}),document.body);if(o==="idle")return null;if(A&&o==="scanning")return H.createPortal(n.jsxs("button",{onClick:()=>
2a.setMinimized(!1),className:`${t} fixed bottom-5 right-20 z-[100] flex items-center gap-2 rounded-[var(--r-sm)] px-3 h-8 text-[length:var(--fs-base)] text-[color:var(--txt)] hover:bg-[color:var(--card-2)] transition-colors`,style:{background:"var(--card)",border:"1px solid var(--line-2)",boxShadow:"var(--card-shadow)"},children:[n.jsx(ee,{size:16,strokeWidth:1.5,className:"animate-spin text-[color:var(--brand-ink)]"}),r("scan.minimized")]}),document.body);const C=Array.isArray(s.scan.phaseReadingSteps)&&s.scan.phaseReadingSteps.length?s.scan.phaseReadingSteps:[r("scan.phaseReading")],R=d==="prompts"?r("scan.phasePrompts"):d==="asking"?r("scan.phaseAsking"):C[Math.floor(w/5)%C.length],h=m.length?m[Math.floor(w/6)%m.length]:null;return H.createPortal(n.jsx("div",{className:`${t} fixed inset-0 z-[100] bg-black/60 flex items-center justify-center p-4`,onClick:()=>{o==="error"&&a.close()},children:n.jsxs("div",{className:"ws-card relative w-full max-w-xl p-6 md:p-7",onClick:P=>P.stopPropagation(),children:[n.jsx("button",{onClick:()=>o==="scanning"?a.setMinimized(!0):a.close(),"aria-label":r("scan.close"),className:"absolute right-3 top-3 text-[color:var(--mut)] hover:text-[color:var(--txt)]",children:n.jsx(ce,{size:16,strokeWidth:1.5})}),n.jsx("div",{className:"ws-lb-m mb-2",children:r("scan.label")}),n.jsx("h3",{className:"text-[length:var(--fs-lg)] leading-[var(--lh-lg)] font-semibold mb-1",children:r("scan.scanning")}),n.jsxs("div",{className:"text-[length:var(--fs-base)] leading-[var(--lh-base)] text-[color:var(--mut)] mb-5",children:[r("scan.expect")," · ",w,"s"]}),n.jsx("div",{className:"h-1.5 rounded-[var(--r-xs)] overflow-hidden mb-5",style:{background:"var(--card-2)"},children:n.jsx("div",{className:"h-full rounded-[var(--r-xs)] transition-[width] duration-1000 ease-linear",style:{width:`${x}%`,background:"var(--brand)"}})}),n.jsxs("div",{className:"flex items-center gap-2.5 text-[length:var(--fs-base)] leading-[var(--lh-base)] text-[color:var(--txt)] mb-6",children:[n.jsx(ee,{size:16,strokeWidth:1.5,className:"animate-spin text-[color:var(--brand-ink)] shrink-0"}),R||r("scan.working")]}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:(g.length?g:["ChatGPT","Gemini","Claude","Perplexity"]).map(P=>{const S=c.includes(P);return n.jsxs("div",{className:"rounded-[var(--r-md)] border px-3 py-2 text-[length:var(--fs-base)] flex items-center gap-2 transition-colors",style:{borderColor:S?"var(--good)":"var(--line)",color:S?"var(--txt)":"var(--mut2)"},children:[n.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${S?"":"animate-pulse"}`,style:{background:S?"var(--good)":"var(--line-2)"}}),P]},P)})}),h&&o==="scanning"&&n.jsx("div",{className:"mt-5 rounded-[var(--r-md)] border px-3.5 py-3",style:{borderColor:"var(--line)",background:"var(--card-2)"},children:n.jsxs("div",{className:"flex items-start gap-2.5",children:[n.jsx(le,{size:16,strokeWidth:1.5,className:"text-[color:var(--mut2)] shrink-0 mt-0.5"}),n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"text-[length:var(--fs-base)] leading-[var(--lh-base)] text-[color:var(--txt)] italic",children:["“",h.quote,"”"]}),n.jsxs("div",{className:"text-[length:var(--fs-xs)] leading-[var(--lh-xs)] text-[color:var(--mut2)] mt-1",children:["— ",h.engine]})]})]})},h.quote),o==="error"&&n.jsx("div",{className:"mt-6 text-[color:var(--bad-txt)] text-[length:var(--fs-base)] leading-[var(--lh-base)]",children:y==="__session_expired__"?r("scan.sessionExpired"):r("scan.failed",{err:y})})]})}),document.body)}export{Ee as S,me as _,ye as r,Re as u};

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.