1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[15251],{5910:(e,t,r)=>{r.d(t,{O:()=>a});var s=r(95155);function a(){return(0,s.jsxs)("div",{role:"status",className:"flex min-h-0 flex-1 flex-col",children:[(0,s.jsx)("span",{className:"sr-only",children:"Loading records..."}),(0,s.jsx)("div",{"aria-hidden":"true",className:"space-y-4 p-6 motion-safe:animate-pulse",children:Array.from({length:8},(e,t)=>(0,s.jsx)("div",{className:"h-12 rounded bg-muted"},t))})]})}},15251:(e,t,r)=>{r.r(t),r.d(t,{default:()=>U});var s=r(95155),a=r(20063),n=r(89761),i=r(67909),l=r(12115),o=r(58051),c=r(19332),u=r(37152),d=r(57102),m=r(55209),p=r(77962),g=r(99531),h=r(96678),f=r(95573),b=r(21693),v=r(70439),y=r(69777),x=r(62642),w=r(4053),j=r(86872),k=r(56152),N=r(86695),A=r(69019),q=r(5910),S=r(97379);function P(e){let{report:t}=e;return(0,s.jsxs)("section",{"aria-busy":"true",className:"flex min-w-0 flex-col gap-8",children:[(0,s.jsxs)("div",{"aria-hidden":"true",className:"flex flex-col gap-3 motion-safe:animate-pulse sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[(0,s.jsx)("div",{className:"flex h-8 items-center",children:(0,s.jsx)("div",{className:"h-4 w-20 rounded bg-muted"})}),(0,s.jsxs)("div",{className:"ml-auto flex max-w-full flex-wrap justify-end gap-2",children:[(0,s.jsx)("div",{className:"h-8 w-40 rounded-lg bg-muted"}),(0,s.jsx)("div",{className:"h-8 w-48 rounded-lg bg-muted"})]})]}),"feedback"===t?(0,s.jsx)(S.f,{}):(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,s.jsx)(A.f,{}),(0,s.jsxs)("div",{className:"overflow-hidden rounded-3xl border border-stone-200 bg-card shadow-sm dark:border-stone-800",children:[(0,s.jsxs)("div",{"aria-hidden":"true",className:"flex flex-wrap items-center gap-2 border-b border-border/60 px-5 py-4 motion-safe:animate-pulse sm:px-6",children:[(0,s.jsx)("div",{className:"h-9 w-full rounded-md bg-muted sm:w-60"}),(0,s.jsx)("div",{className:"h-9 w-20 rounded-md bg-muted"}),(0,s.jsx)("div",{className:"h-9 w-24 rounded-md bg-muted"}),(0,s.jsxs)("div",{className:"contents sm:ml-auto sm:flex sm:gap-2",children:[(0,s.jsx)("div",{className:"h-9 w-24 rounded-md bg-muted"}),(0,s.jsx)("div",{className:"size-9 rounded-md bg-muted"}),(0,s.jsx)("div",{className:"size-9 rounded-md bg-muted"})]})]}),(0,s.jsx)(q.O,{})]})]})]})}var E=r(38754);let R=(0,i.default)(()=>Promise.all([r.e(37738),r.e(20887),r.e(41850),r.e(77568),r.e(32382),r.e(86458),r.e(81805),r.e(59638)]).then(r.bind(r,59638)),{loadableGenerated:{webpack:()=>[59638]},loading:function(){let[e]=(0,n.ZA)("report",m._5);return(0,s.jsx)(P,{report:e})}}),I=(0,i.default)(()=>Promise.all([r.e(37738),r.e(20887),r.e(47555),r.e(86458),r.e(81805),r.e(37756),r.e(44079)]).then(r.bind(r,44079)),{loadableGenerated:{webpack:()=>[44079]},loading:()=>(0,s.jsx)(k.eL,{})}),C=(0,i.default)(()=>Promise.all([r.e(37738),r.e(20887),r.e(47555),r.e(94043),r.e(81805),r.e(37756),r.e(36857)]).then(r.bind(r,98026)),{loadableGenerated:{webpack:()=>[98026]},loading:()=>(0,s.jsx)(N.J,{})});function _(e){let{teamspaceId:t,open:r,site:a,sitesError:i}=e,[{report:o,docs7Days:u,docs7Previews:p},g]=(0,n.ab)({report:m._5,docs7Days:d.HA,docs7Previews:d.z7}),h=function(e){let t=(0,l.useRef)(null),r=(0,l.useRef)(e);return(0,l.useEffect)(()=>{let s=r.current&&!e;if(r.current=e,!s||!t.current)return;let a=t.current;t.current=null;let n=requestAnimationFrame(()=>{var e;null==(e=document.querySelector('[data-docs-report-link="'.concat(CSS.escape(a),'"]')))||e.focus()});return()=>cancelAnimationFrame(n)},[e]),e=>{var r;if(0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||!(e.target instanceof Element))return;let s=e.target.closest("[data-docs-report-link]");s&&(t.current=null!=(r=s.dataset.docsReportLink)?r:null)}}(o),{selectedProject:f}=(0,c.KT)(),b=(null==f?void 0:f.docs7_pro_enabled)===!0;if("analytics"!==r&&"ai-visibility"!==r)return null;let v=(null==a?void 0:a.hosting)==="off",y=o&&m.dn[o].section===r&&(!v||a.analyticsUrl&&"page-views"===m.dn[o].dataset)?o:null;return(0,s.jsxs)("div",{className:"contents",onClickCapture:h,children:[y&&!a?i?(0,s.jsx)(E.Fx,{children:"Could not load your sites. Refresh the page to try again."}):(0,s.jsx)(P,{report:y}):null,y&&a?(0,s.jsx)(R,{teamspaceId:t,siteId:a.id,siteHost:v&&a.analyticsUrl?new URL(a.analyticsUrl).host:a.platformHostname,report:y,days:(0,j.aF)(u,b),previews:!v&&b&&p,hasPreviews:!v&&b,docs7ProEnabled:b,onDaysChange:e=>void g({docs7Days:e}),onPreviewsChange:e=>void g({docs7Previews:e||null}),onBack:()=>void g({report:null},{history:"replace"})},"".concat(t,":").concat(a.id,":").concat(b,":").concat(y)):null,!y&&"anal
1ytics"===r&&(0,s.jsx)(C,{teamspaceId:t,active:"analytics"===r},null==a?void 0:a.id),!y&&"ai-visibility"===r&&(0,s.jsx)(I,{teamspaceId:t,active:"ai-visibility"===r})]})}var M=r(12746),F=r(53054),O=r(69588);function $(e){let{teamspaceId:t,isOwner:r}=e,[a,n]=(0,l.useState)(!1);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(M.A,{title:"Docs7 Pro plan",description:"Downgrade to Free to remove the paid add-on. You can keep one public site.",headerActions:(0,s.jsx)(E.$n,{variant:"ghostDanger",size:"md",disabled:!r,onClick:()=>n(!0),children:"Downgrade to Free"}),children:!r&&(0,s.jsx)(O.A,{children:"Only the teamspace owner can change the Docs7 plan."})}),(0,s.jsx)(F.A,{teamspaceId:t,isOpen:a,onClose:()=>n(!1)})]})}var B=r(65075);let D=(0,i.default)(()=>Promise.all([r.e(92451),r.e(15239),r.e(76784),r.e(29801),r.e(96342),r.e(94043),r.e(73429),r.e(81805),r.e(42029),r.e(24759),r.e(43019)]).then(r.bind(r,43019)),{loadableGenerated:{webpack:()=>[43019]},loading:()=>(0,s.jsx)(b.t,{})}),T=(0,i.default)(()=>Promise.all([r.e(37738),r.e(92451),r.e(87992),r.e(41850),r.e(20655),r.e(94043),r.e(73429),r.e(75107)]).then(r.bind(r,75107)),{loadableGenerated:{webpack:()=>[75107]},loading:()=>(0,s.jsx)(v.P,{})}),L=(0,i.default)(()=>Promise.all([r.e(37738),r.e(20887),r.e(92451),r.e(47555),r.e(56530),r.e(87992),r.e(41850),r.e(89925),r.e(94043),r.e(97725),r.e(35721),r.e(34571),r.e(71752)]).then(r.bind(r,71752)),{loadableGenerated:{webpack:()=>[71752]},loading:()=>(0,s.jsx)(x.I,{})}),G=(0,i.default)(()=>Promise.all([r.e(92451),r.e(87992),r.e(73429),r.e(29810)]).then(r.bind(r,99613)),{loadableGenerated:{webpack:()=>[99613]},loading:()=>(0,s.jsx)(y.V,{})}),V=(0,i.default)(()=>Promise.all([r.e(15239),r.e(96342),r.e(94043),r.e(24759),r.e(88207)]).then(r.bind(r,69782)),{loadableGenerated:{webpack:()=>[69782]},loading:()=>(0,s.jsx)(w.j,{})});function U(e){let{teamspaceId:t}=e;return(0,s.jsx)(h.t,{children:(0,s.jsx)(H,{teamspaceId:t})})}function H(e){let{teamspaceId:t}=e,r=(0,a.useRouter)(),[{tab:i},h]=(0,n.ab)({tab:d.pu,report:m._5}),{selectedProject:b}=(0,c.KT)(),{isOwner:v}=(0,c.Q4)(),y=(0,u._m)(t,!0),{selected:x}=(0,u.w9)(t,!0),w=y.isSuccess&&0===y.data.sites.length&&0===y.data.localSites.length,j=(null==b?void 0:b.docs7_pro_enabled)===!0,k=(null==x?void 0:x.hosting)==="off"?g.Gf:x&&(0,p.Qs)(x)?g.CA:g.M9,N=k.some(e=>e.key===i)?i:"overview";return((0,l.useEffect)(()=>{w&&r.replace("/docs7/overview")},[w,r]),w)?(0,s.jsx)(f.f,{}):(0,s.jsxs)("div",{className:"flex w-full flex-col",children:[(0,s.jsx)(o.t,{tabs:k,activeTab:N,ariaLabel:"Docs7 sections",accent:"orange",onTabClick:e=>void h({tab:e,report:null},{history:"replace"})}),(0,s.jsxs)("div",{className:"mx-auto mt-6 flex w-full min-w-0 max-w-[1060px] flex-col gap-8 sm:mt-8",children:["overview"===N&&(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[j||(null==x?void 0:x.hosting)!=="on"||(0,p.Qs)(x)?null:(0,s.jsx)(B.A,{reason:"previews"}),(0,s.jsx)(D,{teamspaceId:t,active:"overview"===N})]}),(0,s.jsx)(_,{teamspaceId:t,open:N,site:x,sitesError:y.isError}),"agent"===N&&(0,s.jsx)(T,{teamspaceId:t,active:!0}),"activity"===N&&(0,s.jsx)(V,{teamspaceId:t,active:"activity"===N}),"library"===N&&(0,s.jsx)(L,{teamspaceId:t,active:"library"===N}),"settings"===N&&(0,s.jsx)(G,{teamspaceId:t,active:"settings"===N}),j&&!w&&"settings"===N?(0,s.jsx)($,{teamspaceId:t,isOwner:v}):null]})]})}},33626:(e,t,r)=>{r.d(t,{Pd:()=>b,zH:()=>f,qf:()=>v,Hj:()=>x,Br:()=>k,Xk:()=>g,J6:()=>y,L:()=>w,_J:()=>j,B:()=>o,gx:()=>N});var s=r(3611);let a={time:s.string(),host:s.string(),path:s.string(),country:s.string()},n=s.number().int().nonnegative(),i={searches:s.strictObject({kind:s.literal("searches"),...a,query:s.string(),source:s.enum(["Website","WebMCP"]),results:s.number().int().min(-1),language:s.string(),version:s.string()}),questions:s.strictObject({kind:s.literal("questions"),...a,query:s.string(),category:s.string(),turn:n,conversationId:s.string()}),"ai-requests":s.strictObject({kind:s.literal("ai-requests"),...a,company:s.string(),bot:s.string(),verified:s.boolean(),method:s.string()}),"page-views":s.strictObject({kind:s.literal("page-views"),...a,referrer:s.string(),browser:s.string(),os:s.string(),device:s.string()}),groups:s.strictObject({kind:s.literal("groups"),value:s.string(),count:n}),"visitor-groups":s.strictObject({kind:s.literal("visitor-groups"),value:s.string(),count:n,visitors:n}
1)},l=s.discriminatedUnion("kind",[i.searches,i.questions,i["ai-requests"],i["page-views"],i.groups,i["visitor-groups"]]);function o(e,t){return e[t]}let c={kind:"groups",schema:i.groups,columns:[{field:"value",label:"Group"},{field:"count",label:"Records"}],select:"toUInt32(count()) AS count"},u={kind:"visitor-groups",schema:i["visitor-groups"],columns:[{field:"value",label:"Group"},{field:"count",label:"Page views"},{field:"visitors",label:"Visitors"}],select:"toUInt32(count()) AS count, toUInt32(uniqExact(visitor_hash)) AS visitors"},d=["path","host","country","query","language","version","category","company","bot","method","referrer","browser","os","device","source"],m=["results","turn"],p=["verified"],g=s.enum([...d,...m,...p]),h=s.enum(["searches","questions","ai-requests","page-views"]),f={source:{label:"Source",type:"text"},path:{label:"Page",type:"text"},host:{label:"Host",type:"text"},country:{label:"Country",type:"text"},query:{label:"Query",type:"text"},language:{label:"Language",type:"text"},version:{label:"Version",type:"text"},category:{label:"Topic",type:"text"},company:{label:"Bot",type:"text"},bot:{label:"Crawler",type:"text"},method:{label:"Method",type:"text"},referrer:{label:"Referrer",type:"text"},browser:{label:"Browser",type:"text"},os:{label:"Operating system",type:"text"},device:{label:"Device",type:"text"},results:{label:"Results",type:"number"},turn:{label:"Question number",type:"number"},verified:{label:"Verified",type:"boolean"}},b={searches:{label:"Search activity",summaryLabel:{one:"search",other:"searches"},searchPlaceholder:"Search queries or pagesâ¦",rowSchema:i.searches,groups:()=>c,detailFields:["path","country","language","version"],columnLabels:{},groupFields:["query","path","source"],rowAction:null,fields:["query","path","source","results","language","version","country","host"],columns:["query","source","results"],searchFields:["query","path"],defaultGroup:null},questions:{label:"Assistant questions",summaryLabel:{one:"question",other:"questions"},searchPlaceholder:"Search questions or pagesâ¦",rowSchema:i.questions,groups:()=>c,detailFields:[],columnLabels:{query:"Question"},groupFields:["category","path"],rowAction:e=>"questions"===e.kind&&e.conversationId?{kind:"conversation",row:e,label:"View conversation"}:null,fields:["query","category","path","turn","country","host"],columns:["query","category"],searchFields:["query","path"],defaultGroup:null},"ai-requests":{label:"AI requests",summaryLabel:{one:"request",other:"requests"},searchPlaceholder:"Search agents or pagesâ¦",rowSchema:i["ai-requests"],groups:()=>c,detailFields:[],columnLabels:{},groupFields:["company","path","country","verified"],rowAction:null,fields:["company","verified","path","country","host","method"],columns:["path","company","verified"],searchFields:["bot","company","path"],defaultGroup:null},"page-views":{label:"Page views",summaryLabel:{one:"page view",other:"page views"},searchPlaceholder:"Search pages or referrersâ¦",rowSchema:i["page-views"],groups:()=>u,detailFields:["browser","os","device"],columnLabels:{},groupFields:["path","referrer","country","device","browser"],rowAction:null,fields:["path","referrer","country","browser","os","device","host"],columns:["path","referrer","country"],searchFields:["path","referrer"],defaultGroup:null}},v=2048,y=s.discriminatedUnion("field",[s.object({field:s.enum(d),operator:s.enum(["eq","neq","contains","notContains","startsWith"]),value:s.string().max(v)}),s.object({field:s.enum(m),operator:s.enum(["eq","neq","gt","gte","lt","lte"]),value:s.number().int().min(0).max(0x7fffffff)}),s.object({field:s.enum(p),operator:s.literal("eq"),value:s.boolean()})]),x=50,w=s.object({dataset:h,from:s.iso.datetime(),to:s.iso.datetime(),search:s.string().trim().max(512),filters:s.array(y).max(8),groupBy:g.nullable(),order:s.enum(["newest","oldest"]),page:s.number().int().min(1).max(2e4)}).superRefine((e,t)=>{let r=Date.parse(e.from),s=Date.parse(e.to);(r>=s||s-r>7776e6)&&t.addIssue({code:"custom",path:["from"],message:"Select a range of up to 90 days."});let{fields:a,groupFields:n}=b[e.dataset];
1e.filters.forEach((e,r)=>{a.includes(e.field)||t.addIssue({code:"custom",path:["filters",r],message:"This field is not available for these records."})}),null===e.groupBy||n.includes(e.groupBy)||t.addIssue({code:"custom",path:["groupBy"],message:"This group is not available for these records."})});function j(e){let t=b[e.dataset];return e.groupBy?t.groups(e.groupBy).schema:t.rowSchema}s.object({siteId:s.uuid(),previews:s.boolean(),query:w});let k=s.object({rows:s.array(l),totalRows:s.number().int().nonnegative(),totalEvents:s.number().int().nonnegative(),series:s.array(s.object({date:s.string(),group:s.string().nullable(),count:s.number().int().nonnegative()})),from:s.iso.datetime(),to:s.iso.datetime()});function N(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Date;return{dataset:e,from:new Date(r.getTime()-864e5*t).toISOString(),to:r.toISOString(),search:"",filters:[],groupBy:b[e].defaultGroup,order:"newest",page:1}}},42848:(e,t,r)=>{r.d(t,{A:()=>s});var s=(0,r(30313).A)("outline","git-pull-request","IconGitPullRequest",[["path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M6 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M18 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M6 8l0 8",key:"svg-3"}],["path",{d:"M11 6h5a2 2 0 0 1 2 2v8",key:"svg-4"}],["path",{d:"M14 9l-3 -3l3 -3",key:"svg-5"}]])},44542:(e,t,r)=>{r.d(t,{A:()=>s});var s=(0,r(30313).A)("outline","world","IconWorld",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M3.6 9h16.8",key:"svg-1"}],["path",{d:"M3.6 15h16.8",key:"svg-2"}],["path",{d:"M11.5 3a17 17 0 0 0 0 18",key:"svg-3"}],["path",{d:"M12.5 3a17 17 0 0 1 0 18",key:"svg-4"}]])},55209:(e,t,r)=>{r.d(t,{_5:()=>n,dn:()=>i,gJ:()=>l});var s=r(89761),a=r(33626);let n=(0,s.M1)(["visitors","traffic","searches","conversations","pages","referrers","feedback","agents","requests","agent-searches","ai-pages"]).withOptions({history:"push"}),i={visitors:{title:"Visitors",link:"View countries",fixedFilters:[],section:"analytics",dataset:"page-views",groupBy:"country"},traffic:{title:"Visitor activity",link:"View visitor activity",fixedFilters:[],section:"analytics",dataset:"page-views",groupBy:null},searches:{title:"Searches",link:"View searches",fixedFilters:[{field:"source",operator:"eq",value:"Website"}],section:"analytics",dataset:"searches",groupBy:null},conversations:{title:"Conversations",link:"View conversations",fixedFilters:[],section:"analytics",dataset:"questions",groupBy:null},pages:{title:"Page traffic",link:"View page traffic",fixedFilters:[],section:"analytics",dataset:"page-views",groupBy:"path"},referrers:{title:"Referrers",link:"View referrers",fixedFilters:[],section:"analytics",dataset:"page-views",groupBy:"referrer"},feedback:{title:"Page feedback",link:"View page feedback",fixedFilters:[],section:"analytics",dataset:null,groupBy:null},agents:{title:"AI agents",link:"View AI agents",fixedFilters:[],section:"ai-visibility",dataset:"ai-requests",groupBy:"company"},requests:{title:"AI requests",link:"View AI requests",fixedFilters:[],section:"ai-visibility",dataset:"ai-requests",groupBy:null},"agent-searches":{title:"WebMCP searches",link:"View agent searches",fixedFilters:[{field:"source",operator:"eq",value:"WebMCP"}],section:"ai-visibility",dataset:"searches",groupBy:null},"ai-pages":{title:"Pages read by AI",link:"View crawled pages",fixedFilters:[],section:"ai-visibility",dataset:"ai-requests",groupBy:"path"}};function l(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Date,s=i[e];return{...(0,a.gx)(s.dataset,t,r),groupBy:s.groupBy,filters:s.fixedFilters}}},65075:(e,t,r)=>{r.d(t,{A:()=>d});var s=r(95155),a=r(95200),n=r(52619),i=r.n(n),l=r(42848),o=r(44542),c=r(5869);let u={previews:{title:"Preview every pull request",description:"for automatic preview deployments.",icon:l.A},sites:{title:"Docs7 Free includes one repository",description:"to add more repositories at $".concat(a.bP.DOCS7_PER_MONTH,"/month each."),icon:o.A}};function d(e){let{reason:t}=e,r=u[t],a=r.icon;return(0,s.jsxs)(c.A,{variant:"upgrade",title:r.title,icon:(0,s.jsx)(a,{size:24,stroke:1.5}),children:[(0,s.jsx)(i(),{href:"/docs7/overview#pricing",className:"focus-orange focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Upgrade to Docs7 Pro"})," ",r.description]})}},69019:(e,t,r)=>{r.d(t,{f:()=>a});var s=r(95155);function a(){return(0,s.jsxs)("div",{"aria-hidden":"true",className:"rounded-3xl border border-stone-200 bg-card p-5 shadow-sm motion-safe:animate-pulse dark:border-stone-800 sm:p-6",children:[(0,s.jsxs)("div",{className:"mb-4 space-y-1",children:[(0,s.jsx)("div",{className:"h-4 w-16 rounded bg-muted"}),(0,s.jsx)("div",{className:"h-9 w-40 rounded bg-muted"})]}),(0,s.jsx)("div",{className:"h-44 rounded bg-muted"})]})}},69588:(e,t,r)=>{r.d(t,{A:()=>i});var s=r(95155),a=r(29080),n=r(5869);function i(e){let{children:t}=e;return(0,s.jsx)(n.A,{variant:"warning",icon:(0,s.jsx)(a.A,{size:24,stroke:1.5,className:"text-amber-800 dark:text-amber-200"}),children:t})}},77962:(e,t,r)=>{r.d(t,{KB:()=>o,Qs:()=>l,pY:()=>i});var s=r(3611),a=r(9516),n=r(92690);s.union([a.Kt,n.bX]);let i=s.union([a.Ei,n.pS]);function l(e){return"source"in e}function o(e){return"source"in e}},84414:(e,t,r)=>{r.d(t,{Ay$:()=>a,bpZ:()=>s.safeParseAsync,blZ:()=>s.toJSONSchema,z:()=>s});var s=r(3611);let a=s},95200:(e,t,r)=>{r.d(t,{bP:()=>s});let s={PARSE_TOKENS_PER_MILLION:5,PRO_MEMBER_PER_MONTH:10,ENTERPRISE_MEMBER_PER_MONTH:30,EXCESS_PER_1000:10,DAYS_PER_MONTH:30,DOCS7_PER_MONTH:200,DOCS7_INCLUDED_MEMBERS:10}},96678:(e,t,r)=>{r.d(t,{t:()=>u,x:()=>d});var s=r(12115),a=r(84414);let n=a.Ay$.discriminatedUnion("type",[a.Ay$.object({type:a.Ay$.literal("connected"),channel:a.Ay$.
1string(),cursor:a.Ay$.string().optional()}),a.Ay$.object({type:a.Ay$.literal("reconnect"),timestamp:a.Ay$.number()}),a.Ay$.object({type:a.Ay$.literal("error"),error:a.Ay$.string()}),a.Ay$.object({type:a.Ay$.literal("disconnected"),channels:a.Ay$.array(a.Ay$.string())}),a.Ay$.object({type:a.Ay$.literal("ping"),timestamp:a.Ay$.number()})]),i=a.Ay$.string().regex(/^\d+-\d+$/).brand(),l=a.Ay$.object({id:i,data:a.Ay$.unknown(),event:a.Ay$.string(),channel:a.Ay$.string()});var o=r(95155);let c=(0,s.createContext)(null);function u({children:e,api:t={url:"/api/realtime",withCredentials:!1},maxReconnectAttempts:r=3}){let[a,i]=(0,s.useState)("disconnected"),u=(0,s.useRef)(new Map),d=(0,s.useRef)(null),m=(0,s.useRef)(null),p=(0,s.useRef)(null),g=(0,s.useRef)(0),h=(0,s.useRef)(new Map),f=(0,s.useRef)(null),b=(0,s.useRef)(null),v=(0,s.useRef)(null),y=(0,s.useCallback)(()=>{let e=new Set;return u.current.forEach(t=>{t.channels.forEach(t=>e.add(t))}),e},[]),x=()=>{d.current&&(d.current.close(),d.current=null),m.current&&(clearTimeout(m.current),m.current=null),p.current&&(clearTimeout(p.current),p.current=null),b.current&&(clearTimeout(b.current),b.current=null),g.current=0,i("disconnected")},w=(0,s.useCallback)(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{console.warn("Connection timed out, reconnecting..."),j()},75e3)},[]),j=e=>{let{replayEventsSince:s}=e??{replayEventsSince:f.current??Date.now()};f.current=s??null;let a=Array.from(y());if(0!==a.length){if(g.current>=r){console.log("Max reconnection attempts reached."),i("error");return}x(),i("connecting");try{let e=a.map(e=>`channel=${encodeURIComponent(e)}`).join("&"),l=a.map(e=>{let t=h.current.get(e)??String(s);return`last_ack_${encodeURIComponent(e)}=${encodeURIComponent(t)}`}).join("&"),o=t.url+"?"+e+"&"+l,c=new EventSource(o,{withCredentials:t.withCredentials??!1});d.current=c,c.onopen=()=>{g.current=0,f.current=null,i("connected"),w()},c.onmessage=e=>{try{let t=JSON.parse(e.data);w(),N(t);let r=n.safeParse(t);r.success&&"reconnect"===r.data.type&&j({replayEventsSince:r.data.timestamp})}catch(e){console.warn("Error parsing message:",e)}},c.onerror=()=>{if(c!==d.current)return;let e=d.current?.readyState;e!==EventSource.CONNECTING&&(e===EventSource.CLOSED&&console.log("Connection closed, reconnecting..."),i("disconnected"),g.current<r?(g.current++,m.current=setTimeout(()=>{j()},Math.min(1e3*g.current,1e4))):i("error"))}}catch(e){i("error")}}},k=(0,s.useCallback)(()=>{v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{j(),v.current=null},25)},[j]),N=e=>{let t=n.safeParse(e);if(t.success){let e=t.data;"connected"===e.type&&e.cursor&&h.current.set(e.channel,e.cursor);return}let r=l.safeParse(e);r.success&&(h.current.set(r.data.channel,r.data.id),u.current.forEach(t=>{t.channels.has(r.data.channel)&&t.cb(e)}))};return(0,s.useEffect)(()=>()=>x(),[]),(0,o.jsx)(c.Provider,{value:{status:a,register:(e,t,r)=>{u.current.set(e,{channels:new Set(t),cb:r}),k()},unregister:e=>{let t=Array.from(u.current.get(e)?.channels??[]);u.current.delete(e);let r=y();if(t.forEach(e=>{r.has(e)||h.current.delete(e)}),0===u.current.size){x(),v.current&&(clearTimeout(v.current),v.current=null);return}k()}},children:e})}let{useRealtime:d}={useRealtime:e=>(function(e){let{channels:t=["default"],events:r,onData:a,enabled:n}=e,i=(0,s.useContext)(c);if(!i)throw Error("useRealtime: No RealtimeProvider found. Wrap your app in <RealtimeProvider> to use Upstash Realtime.");let o=(0,s.useRef)(Math.random().toString(36).substring(2)).current,u=(0,s.useRef)(a);return u.current=a,(0,s.useEffect)(()=>{if(!1===n)return void i.unregister(o);let e=t.filter(e=>!!e);if(0!==e.length)return i.register(o,e,e=>{let t=l.safeParse(e);if(t.success){let{event:e,channel:s,data:a}=t.data;if(r&&r.length>0&&!r.some(t=>t===e))return;u.current?.({event:e,data:a,channel:s})}}),()=>{i.unregister(o)}},[JSON.stringify(t),n,JSON.stringify(r)]),{status:i.status}})(e)}},97379:(e,t,r)=>{r.d(t,{f:()=>a});var s=r(95155);function a(){return(0,s.jsxs)("div",{role:"status",className:"flex min-w-0 flex-col gap-6",children:[(0,s.jsx)("span",{className:"sr-only",children:"Loading feedback..."}),(0,s.jsxs)("div",{"aria-hidden":"true",className:"space-y-6 motion-safe:animate-pulse",children:[(0,s.jsx)("div",{className:"flex flex-wrap gap-x-12 gap-y-5 border-b border-border/60 pb-5",children:Array.from({length:4},(e,t)=>(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("div",{className:"h-4 w-20 rounded bg-muted"}),(0,s.jsx)("div",{className:"h-9 w-16 rounded bg-muted"})]},t))}),(0,s.jsxs)("div",{className:"overflow-hidden rounded-3xl border border-stone-200 bg-card shadow-sm dark:border-stone-800",children:[(0,s.jsxs)("div",{className:"flex gap-3 border-b border-border/60 px-5 py-4 sm:px-6",children:[(0,s.jsx)("div",{className:"h-10 flex-1 rounded-md bg-muted"}),(0,s.jsx)("div",{className:"h-10 w-24 rounded-md bg-muted"})]}),(0,s.jsx)("div",{className:"h-10 border-b border-border/60 bg-muted"}),Array.from({length:5},(e,t)=>(0,s.jsxs)("div",{className:"flex gap-5 border-b border-border/60 px-5 py-4 sm:px-6",children:[(0,s.jsx)("div",{className:"h-4 flex-1 rounded bg-muted"}),(0,s.jsx)("div",{className:"h-4 w-12 rounded bg-muted"}),(0,s.jsx)("div",{className:"h-4 w-12 rounded bg-muted"}),(0,s.jsx)("div",{className:"h-4 w-12 rounded bg-muted"})]},t))]})]})]})}}}]);
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.