@canonry/canonry 7.91.2 → 7.92.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +1 -1
  2. package/assets/assets/{AgentSetupPage-DpBlChWi.js → AgentSetupPage-Dr5ZoPYi.js} +1 -1
  3. package/assets/assets/{AuditHistoryPanel-DAotR_zD.js → AuditHistoryPanel-Dc8pGeZT.js} +1 -1
  4. package/assets/assets/{BacklinksPage-CFoi9mrt.js → BacklinksPage-zEaP7G6s.js} +1 -1
  5. package/assets/assets/{HistoryPage-DIGmY4wi.js → HistoryPage-9OaxBSY8.js} +1 -1
  6. package/assets/assets/{MeasurementPropertyPage-C6o9U2R6.js → MeasurementPropertyPage-k_mqkoWn.js} +1 -1
  7. package/assets/assets/{ProjectPage-00Vsnxv4.js → ProjectPage-vgHaFT7S.js} +1 -1
  8. package/assets/assets/{RunsPage-ChSbIrF9.js → RunsPage-CXkefezd.js} +1 -1
  9. package/assets/assets/{SettingsPage-CIrzXeP8.js → SettingsPage-C8FUNUN5.js} +1 -1
  10. package/assets/assets/{SiteHealthSection-HZXdeAOx.js → SiteHealthSection-C94uYTE3.js} +2 -2
  11. package/assets/assets/ToneBadge-COrS2zpP.js +60 -0
  12. package/assets/assets/{TrafficPage-ZYsFSEuq.js → TrafficPage-KlGx3-bc.js} +1 -1
  13. package/assets/assets/{TrafficSourceDetailPage-D5uJZpZ4.js → TrafficSourceDetailPage-BMs9kd7S.js} +1 -1
  14. package/assets/assets/{account-context-DMLbDVNZ.js → account-context-F2VRKRtu.js} +1 -1
  15. package/assets/assets/{agent-trust-copy-DbpAXPxc.js → agent-trust-copy-Hb775a57.js} +1 -1
  16. package/assets/assets/{card-Be_eN_-Q.js → card-P1VA-JnV.js} +1 -1
  17. package/assets/assets/{format-helpers-IKCsn-Iw.js → format-helpers-COfTmLRL.js} +1 -1
  18. package/assets/assets/{index-3jdPlyTf.js → index-DHrWeA6k.js} +4 -4
  19. package/assets/assets/{query-client-CoKNm49W.js → query-client-BHtq57Sw.js} +1 -1
  20. package/assets/assets/{react-query-DIdeX4Dn.js → react-query-IhpEAOba.js} +1 -1
  21. package/assets/assets/{react-sigma_core.esm.min-De3OcL3T.js → react-sigma_core.esm.min-B4NX5_aX.js} +1 -1
  22. package/assets/assets/{server-traffic-DvN44H1n.js → server-traffic-ykAWQo0I.js} +1 -1
  23. package/assets/assets/{service-RpR2yqfP.js → service-m9l8my0x.js} +1 -1
  24. package/assets/index.html +7 -7
  25. package/dist/{ads-RC5EHP6E.js → ads-LRHVFP2J.js} +3 -3
  26. package/dist/{agent-JYG5XPUJ.js → agent-P7HWL7VX.js} +7 -7
  27. package/dist/{agent-ask-FGPGEOEI.js → agent-ask-S374MIJS.js} +3 -3
  28. package/dist/{agent-conversations-Q3EKETCC.js → agent-conversations-3SSKVUYG.js} +3 -3
  29. package/dist/{agent-journeys-IHBTU6SZ.js → agent-journeys-ZEO7Z4QR.js} +3 -3
  30. package/dist/{agent-memory-RXEPKF5K.js → agent-memory-E5YVW5WY.js} +3 -3
  31. package/dist/{agent-providers-LDMGD7TD.js → agent-providers-BWWB42XJ.js} +3 -3
  32. package/dist/{agent-transcript-NXSXOYNE.js → agent-transcript-YG7TTHWS.js} +3 -3
  33. package/dist/{analytics-4BILIAM5.js → analytics-AIKX4BUM.js} +3 -3
  34. package/dist/{apply-ENLWU4Z2.js → apply-5MPSMIKM.js} +3 -3
  35. package/dist/{backfill-HHG3Z46F.js → backfill-BUTFX4KY.js} +10 -10
  36. package/dist/{backlinks-5MMWYPFW.js → backlinks-L6BYIJIK.js} +3 -3
  37. package/dist/{bing-KO3PDNXZ.js → bing-E4ZSEVQV.js} +3 -3
  38. package/dist/{bootstrap-E76JLH63.js → bootstrap-V7OE6XXB.js} +10 -10
  39. package/dist/{cdp-BZRWX3MX.js → cdp-LWNX6UZF.js} +7 -7
  40. package/dist/{chunk-MM3OYQ53.js → chunk-3WWSOWXP.js} +2 -2
  41. package/dist/{chunk-OK6MKE4B.js → chunk-4HLR3DRQ.js} +1 -1
  42. package/dist/{chunk-V4MRQPV2.js → chunk-4QYGB5IC.js} +1 -1
  43. package/dist/{chunk-MNIQFFLL.js → chunk-73PWU5XA.js} +4 -4
  44. package/dist/{chunk-XFVB3UCE.js → chunk-7534NXSP.js} +1 -1
  45. package/dist/{chunk-7LN6QPV7.js → chunk-76KBMLPR.js} +1 -1
  46. package/dist/{chunk-B23XQ5OP.js → chunk-7PKMRO33.js} +4 -4
  47. package/dist/{chunk-SMH4FUXJ.js → chunk-AUC47DFW.js} +1 -1
  48. package/dist/{chunk-PIDL7OJ4.js → chunk-BTYOU24P.js} +2 -2
  49. package/dist/{chunk-PIOCF5GN.js → chunk-BZGAMJG2.js} +5 -5
  50. package/dist/{chunk-KVNGLXG7.js → chunk-CIP3CE2C.js} +3 -3
  51. package/dist/{chunk-JXGVPQA5.js → chunk-D2RMGUAK.js} +6 -6
  52. package/dist/{chunk-5MBZUPY3.js → chunk-DEFHTBJV.js} +1 -1
  53. package/dist/{chunk-KKVIRNFF.js → chunk-EWZOL56J.js} +3 -3
  54. package/dist/{chunk-2REKLGYS.js → chunk-FYYOX7UY.js} +18 -1
  55. package/dist/{chunk-ML3KDUHO.js → chunk-GIF3HZKN.js} +21 -21
  56. package/dist/{chunk-ZYHP6QZO.js → chunk-GNHXSSQM.js} +2 -2
  57. package/dist/{chunk-ZR4WEKEC.js → chunk-H3PWMM4K.js} +1 -1
  58. package/dist/{chunk-5DMCGBIT.js → chunk-JZVTSC2V.js} +2 -2
  59. package/dist/{chunk-JC2MAKWO.js → chunk-K7ZG6K7J.js} +1 -1
  60. package/dist/{chunk-UHCRUGI5.js → chunk-N2EWSWZD.js} +1 -1
  61. package/dist/{chunk-6SEWKBDC.js → chunk-O7D7KV75.js} +3 -3
  62. package/dist/{chunk-JKBQ3G25.js → chunk-P6ZDIVFZ.js} +1 -1
  63. package/dist/{chunk-FX5H2PD5.js → chunk-QER7MSUH.js} +7 -7
  64. package/dist/{chunk-T6ZYAUJX.js → chunk-QWEAORJG.js} +17 -7
  65. package/dist/{chunk-FYJMNYVR.js → chunk-T5DH6FEH.js} +1 -1
  66. package/dist/{chunk-SMSTXGJX.js → chunk-TY5YTNLU.js} +2 -2
  67. package/dist/{chunk-SC7WEHEK.js → chunk-U3T37P7H.js} +3 -3
  68. package/dist/{chunk-PAC5EE5X.js → chunk-UMTYAPCQ.js} +4 -4
  69. package/dist/{chunk-FLP4XMWI.js → chunk-WONUYAKB.js} +4 -4
  70. package/dist/{chunk-HMNQTF3E.js → chunk-WTZZOUOJ.js} +5 -5
  71. package/dist/{chunk-IPFSY55D.js → chunk-XYQMPYWE.js} +1 -1
  72. package/dist/{chunk-QZM44MJL.js → chunk-YX33HYHZ.js} +358 -357
  73. package/dist/{chunk-EIYNZOQA.js → chunk-ZPVJ5PVB.js} +2 -2
  74. package/dist/{chunk-QS57GCF4.js → chunk-ZTCQVHQV.js} +2 -2
  75. package/dist/{citations-UEKKVKBV.js → citations-BYSB6NON.js} +3 -3
  76. package/dist/{cli-catalog-HJOVIDG6.js → cli-catalog-CFCLMVSK.js} +3 -3
  77. package/dist/{cli-commands-5FUTLXQS.js → cli-commands-OPH4K73Q.js} +7 -7
  78. package/dist/cli.js +13 -13
  79. package/dist/{competitor-3TX3GOLA.js → competitor-DUYU7EL7.js} +3 -3
  80. package/dist/{content-BKICG6BP.js → content-OGURKOCE.js} +3 -3
  81. package/dist/{dashboard-HOCPAGFO.js → dashboard-QX4IBLGW.js} +6 -6
  82. package/dist/{demo-IXNY4QU4.js → demo-SZ5CPFPS.js} +1 -1
  83. package/dist/{demo-server-HGKXT27V.js → demo-server-JIEIMLLU.js} +12 -12
  84. package/dist/{discover-LBULUEYL.js → discover-SHUCBUDJ.js} +3 -3
  85. package/dist/{discover-eval-V7UJGWHK.js → discover-eval-3ZTYLTGU.js} +3 -3
  86. package/dist/{doctor-O45PQVTM.js → doctor-FRSV5GAR.js} +3 -3
  87. package/dist/{evidence-FCNEZ7OV.js → evidence-7UJHNILW.js} +3 -3
  88. package/dist/{export-cmd-CFC3HYWQ.js → export-cmd-2DAWSD52.js} +3 -3
  89. package/dist/{ga-V643BFQV.js → ga-K2EVI3KO.js} +3 -3
  90. package/dist/{gbp-L5PCSFCF.js → gbp-NXFINC7N.js} +3 -3
  91. package/dist/{google-TO6R7PKD.js → google-J4T52EIG.js} +4 -4
  92. package/dist/{google-marketing-BOSOBO4T.js → google-marketing-PZGKZPEB.js} +1 -1
  93. package/dist/{health-cmd-UZKM4AB7.js → health-cmd-5IHX5GRQ.js} +3 -3
  94. package/dist/{history-WRVANB63.js → history-IVO5IVH2.js} +3 -3
  95. package/dist/index.d.ts +88 -88
  96. package/dist/index.js +25 -25
  97. package/dist/{init-CYKAYU6A.js → init-EMXK7MX6.js} +12 -12
  98. package/dist/{insights-UQ76TUH7.js → insights-SPA2BVMV.js} +3 -3
  99. package/dist/intelligence-service-CJNCXI4C.js +16 -0
  100. package/dist/{journeys-6S235DIK.js → journeys-7FAHZRGP.js} +3 -3
  101. package/dist/{keys-VXQWKBDR.js → keys-PPBHRYPZ.js} +3 -3
  102. package/dist/{keyword-VM26Z6Z7.js → keyword-C4ULYIWF.js} +3 -3
  103. package/dist/{logs-B4UKUNNS.js → logs-X7NQN4UT.js} +3 -3
  104. package/dist/{mcp-NFRDBPMW.js → mcp-ERMFW6WJ.js} +4 -4
  105. package/dist/mcp.js +9 -9
  106. package/dist/{measurement-plan-PH4S4NL4.js → measurement-plan-7IPWYNIC.js} +5 -5
  107. package/dist/{notify-XCFFEECP.js → notify-AC4ZHLUK.js} +3 -3
  108. package/dist/{organic-evidence-P6YKEE5J.js → organic-evidence-GDDMNJHN.js} +3 -3
  109. package/dist/{overview-XA7WM5QI.js → overview-7VCUIYQE.js} +4 -4
  110. package/dist/{project-US5UT3TO.js → project-N4RGX5CT.js} +3 -3
  111. package/dist/{query-MVLTNGDG.js → query-Y7LGD6PG.js} +3 -3
  112. package/dist/{research-XWJOXQDW.js → research-WTZO3D7B.js} +3 -3
  113. package/dist/{results-export-QMNLDPOB.js → results-export-BYUFBWEK.js} +3 -3
  114. package/dist/{run-U7Y3UINV.js → run-SXMD6GW5.js} +4 -4
  115. package/dist/{schedule-WO72K2TA.js → schedule-UQFPQBHI.js} +3 -3
  116. package/dist/{search-VFN7HC4Q.js → search-EJUJRZEE.js} +3 -3
  117. package/dist/{serve-R5SZLLJ7.js → serve-3CD4TSE7.js} +26 -26
  118. package/dist/{session-IF7IXHSS.js → session-N77UGPQB.js} +13 -13
  119. package/dist/{settings-RTPDTKM3.js → settings-ZBP3KDJK.js} +3 -3
  120. package/dist/{sitemaps-5CCNCMM4.js → sitemaps-KVROUSLB.js} +3 -3
  121. package/dist/{skills-ZWET6NI7.js → skills-AGAHFQD5.js} +2 -2
  122. package/dist/{snapshot-CCQ62PWI.js → snapshot-WDK6ZSJA.js} +3 -3
  123. package/dist/{src-G42HKGIS.js → src-XGUBO65J.js} +2 -2
  124. package/dist/{status-YE6MWDYD.js → status-IFUJIB73.js} +4 -4
  125. package/dist/{technical-aeo-LIEMDI5R.js → technical-aeo-6KR3YH4X.js} +3 -3
  126. package/dist/{telemetry-D5OR6DKJ.js → telemetry-EZNMZMH6.js} +4 -4
  127. package/dist/{tools-R63V5YCE.js → tools-BNRDF6UZ.js} +11 -11
  128. package/dist/{traffic-6JJNWQZL.js → traffic-7OSHD23C.js} +5 -5
  129. package/dist/{trends-QZEDEIQE.js → trends-I3NWFNHX.js} +3 -3
  130. package/dist/{users-UYTKWYR6.js → users-VBLZGMML.js} +3 -3
  131. package/dist/{visibility-stats-ESDTTTAE.js → visibility-stats-6YAV2MTM.js} +18 -3
  132. package/dist/{wordpress-EJLVQNNU.js → wordpress-EM3S3NDA.js} +3 -3
  133. package/package.json +1 -1
  134. package/assets/assets/ToneBadge-ht0n6RUH.js +0 -60
  135. package/dist/intelligence-service-LVOX33SJ.js +0 -16
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{C as t,G as n,R as r,U as i,V as a,Z as o,at as s,ct as c,et as l,f as u,o as d,ot as f}from"./vendor-lucide-Bo69m9KC.js";import{r as p}from"./vendor-markdown-BiRP51B0.js";import{b as m,d as h,u as g,x as _}from"./vendor-tanstack-tBjrfzKu.js";import{mt as v,pn as ee,r as y,t as te,wt as b}from"./ToneBadge-ht0n6RUH.js";import{t as ne}from"./async-handler-Bj3TnIRw.js";import{d as re}from"./query-client-CoKNm49W.js";import{fn as x,sn as S}from"./react-query-DIdeX4Dn.js";import{t as C}from"./InfoTooltip-CNLlIWeP.js";import{t as w}from"./card-Be_eN_-Q.js";import{T as ie,dt as ae,ft as T,hn as E,mt as D,pt as O,ut as oe}from"./index-3jdPlyTf.js";import{d as k,i as A,n as se,r as ce,s as le,t as ue}from"./server-traffic-DvN44H1n.js";var j=e(c(),1),M=p();function de({open:e,onOpenChange:t,projectName:n}){let[r,i]=(0,j.useState)(`pick`);(0,j.useEffect)(()=>{e&&i(`pick`)},[e]);let a=()=>{t(!1),i(`pick`)};return(0,M.jsx)(oe,{open:e,onOpenChange:e=>{e?t(!0):a()},children:(0,M.jsx)(ae,{children:r===`pick`?(0,M.jsx)(pe,{onPick:i}):r===`cloudflare`?(0,M.jsx)(Q,{projectName:n,onBack:()=>i(`pick`),onClose:a}):r===`wordpress`?(0,M.jsx)(L,{projectName:n,onBack:()=>i(`pick`),onClose:a}):r===`vercel`?(0,M.jsx)(z,{projectName:n,onBack:()=>i(`pick`),onClose:a}):(0,M.jsx)(R,{projectName:n,onBack:()=>i(`pick`),onClose:a})})})}var fe=[{type:`cloudflare`,name:`Cloudflare`,needs:`A zone you manage. Set up from the terminal.`,icon:u},{type:`wordpress`,name:`WordPress`,needs:`wp-admin access to install a plugin`,icon:r},{type:`vercel`,name:`Vercel`,needs:`A Vercel access token`,icon:d},{type:`cloud-run`,name:`Google Cloud Run`,needs:`A service account that can read logs`,icon:n}];function pe({onPick:e}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(O,{children:[(0,M.jsx)(D,{children:`Connect a traffic source`}),(0,M.jsx)(T,{children:`Pick where your site runs. Canonry reads AI crawler visits and AI referrals from there.`})]}),(0,M.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:fe.map(({type:t,name:n,needs:r,icon:i})=>(0,M.jsxs)(`button`,{type:`button`,onClick:()=>e(t),className:`group flex items-center gap-3 rounded-md border border-base bg-bg-elevated/30 px-3 py-3 text-left transition-colors hover:border-mono-600 hover:bg-bg-elevated/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,M.jsx)(`span`,{className:`mt-0.5 inline-flex size-9 shrink-0 items-center justify-center rounded-md border border-base bg-bg text-neutral group-hover:text-heading`,children:(0,M.jsx)(i,{className:`size-4`})}),(0,M.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,M.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:n}),(0,M.jsx)(`span`,{className:`text-label-13 text-secondary`,children:r})]})]},t))}),(0,M.jsx)(`p`,{className:`mt-6 text-copy-13 text-secondary`,children:`Your agent can set up any of these for you. Pick a source to copy instructions for it.`})]})}function N({title:e,description:t,onBack:n}){return(0,M.jsxs)(O,{children:[(0,M.jsxs)(`button`,{type:`button`,onClick:n,className:`mb-1 inline-flex w-fit items-center gap-1 rounded text-button-14 text-secondary transition-colors hover:text-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,M.jsx)(f,{className:`size-3`}),`Choose a different source`]}),(0,M.jsx)(D,{children:e}),(0,M.jsx)(T,{children:t})]})}function P(e,t){let n=h();return async(r,i)=>{i.startInitialBackfill&&await ee(e,r),i.afterConnected?.(),t(),n({to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:r}})}}function F(e,t){let[n,r]=(0,j.useState)(null),i=P(e,t);return{error:n,runConnect:async e=>{r(null);let t=e.validate();if(t){r(t);return}let n;try{n=await e.mutate()}catch(e){r(k(e));return}try{await i(n.id,{startInitialBackfill:e.startInitialBackfill??!0,afterConnected:e.onConnected})}catch(e){r(`Source connected, but starting the initial backfill failed: ${k(e)}`)}}}}function I({title:e,description:t,projectName:n,onBack:r,onClose:i,onSubmit:a,isPending:o,error:s,guide:c,children:l}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{title:e,description:t,onBack:r}),(0,M.jsxs)(`div`,{className:`-mr-1 mt-6 min-h-0 flex-1 overflow-y-auto pr-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,M.jsx)(Y,{request:c.agentRequest,docsUrl:c.docsUrl}),(0,M.jsx)(X,{steps:c.steps})]}),(0,M.jsxs)(`form`,{onSubmit:ne(async e=>{e.preventDefault(),await a()}),className:`mt-6 flex flex-col gap-5 border-t border-default pt-5`,children:[(0,M.jsxs)(`p`,{className:`text-copy-14-strong text-heading`,children:[`Then connect it to `,(0,M.jsx)(`span`,{className:`text-label-13-mono`,children:n})]}),l,s?(0,M.jsx)(`p`,{className:`rounded-md border border-negative-800/50 bg-negative-950/30 px-3 py-2 text-copy-13 text-negative-200`,children:s}):null,(0,M.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-2 border-t border-default pt-4`,children:[(0,M.jsx)(y,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,children:`Close`}),(0,M.jsx)(y,{type:`submit`,disabled:o,size:`sm`,children:o?`Connecting…`:`Connect`})]})]})]})]})}function L({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),d=A(e||null),{error:f,runConnect:p}=F(e,n);return(0,M.jsxs)(I,{title:`Connect a WordPress site`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from the Canonry Traffic Logger plugin.`,(0,M.jsx)(C,{text:`${K(`Application Password`)} Pages served from a full-page cache never reach the plugin, so exclude AI crawlers from your cache. The docs list the user agents.`})]}),guide:me(e,r),projectName:e,onBack:t,onClose:n,onSubmit:()=>p({validate:()=>r.trim()?a.trim()?s.trim()?null:`Application Password is required.`:`Username is required.`:`WordPress site URL is required.`,mutate:()=>d.mutateAsync({baseUrl:r.trim(),username:a.trim(),applicationPassword:s.trim(),displayName:l.trim()||void 0}),onConnected:()=>c(``)}),isPending:d.isPending,error:f,children:[(0,M.jsx)(B,{label:`WordPress site URL`,description:`Base URL of the site running the Canonry Traffic Logger plugin.`,required:!0,children:(0,M.jsx)(`input`,{type:`url`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`url`,placeholder:`https://example.com`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Username`,description:`WordPress user that owns the Application Password.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),required:!0,autoComplete:`username`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Application Password`,description:`Create one in wp-admin under Users -> Profile -> Application Passwords.`,required:!0,children:(0,M.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),required:!0,autoComplete:`new-password`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(Z,{children:(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the WordPress host.`,children:(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})})]})}function R({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(``),p=se(e||null),{error:m,runConnect:h}=F(e,n),g=()=>h({validate:()=>r.trim()?d.trim()?null:`Service-account JSON content is required.`:`GCP project ID is required.`,mutate:()=>p.mutateAsync({gcpProjectId:r.trim(),serviceName:a.trim()||void 0,location:s.trim()||void 0,displayName:l.trim()||void 0,keyJson:d.trim()}),onConnected:()=>f(``)}),_=async e=>{if(!e)return;let t=await e.text();f(t)};return(0,M.jsxs)(I,{title:`Connect a Cloud Run service`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from your Cloud Run request logs.`,(0,M.jsx)(C,{text:K(`service-account private key`)})]}),guide:ge(e,r),projectName:e,onBack:t,onClose:n,onSubmit:g,isPending:p.isPending,error:m,children:[(0,M.jsx)(B,{label:`GCP project ID`,description:`The Google Cloud project hosting the Cloud Run service (e.g. my-prod-foo).`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsxs)(B,{label:`Service-account JSON`,description:`Paste the contents of the SA key (JSON). The SA needs roles/logging.viewer (or any role granting logging.logEntries.list).`,required:!0,children:[(0,M.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),rows:6,spellCheck:!1,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-copy-14-mono text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`,placeholder:`{"type":"service_account","project_id":"…","private_key":"…"}`,required:!0}),(0,M.jsxs)(`label`,{className:`mt-2 inline-flex cursor-pointer items-center gap-2 text-label-14 text-secondary hover:text-strong`,children:[(0,M.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>void _(e.target.files?.[0]??null)}),(0,M.jsx)(`span`,{className:`rounded-md border border-base px-2 py-1`,children:`Or upload a key file`})]})]}),(0,M.jsxs)(Z,{children:[(0,M.jsx)(B,{label:`Service name (optional)`,description:`Restrict log pulls to a specific Cloud Run service. Omit to pull all services in the project.`,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Location (optional)`,description:`Region of the Cloud Run service (e.g. us-central1). Helpful when multiple regions emit logs.`,children:(0,M.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the project + service combo.`,children:(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})]})]})}function z({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(`production`),[d,f]=(0,j.useState)(``),p=ce(e||null),{error:m,runConnect:h}=F(e,n);return(0,M.jsxs)(I,{title:`Connect a Vercel project`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from Vercel request logs. Nothing to install on your site.`,(0,M.jsx)(C,{text:K(`access token`)})]}),guide:he(e),projectName:e,onBack:t,onClose:n,onSubmit:()=>h({validate:()=>r.trim()?a.trim()?s.trim()?null:`Vercel personal access token is required.`:`Vercel team / account ID is required.`:`Vercel project ID is required.`,mutate:()=>p.mutateAsync({projectId:r.trim(),teamId:a.trim(),token:s.trim(),environment:l,displayName:d.trim()||void 0}),startInitialBackfill:!1,onConnected:()=>c(``)}),isPending:p.isPending,error:m,children:[(0,M.jsx)(B,{label:`Vercel project ID`,description:`The prj_… id from the Vercel dashboard or .vercel/project.json.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`off`,placeholder:`prj_…`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Vercel team / account ID`,description:`The Vercel team or personal account that owns the project. Find it as orgId in your .vercel/project.json.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),required:!0,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Personal access token`,description:`Create a Vercel personal access token under Account Settings → Tokens. Tokens can expire, so use a long-lived one.`,required:!0,children:(0,M.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),required:!0,autoComplete:`new-password`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsxs)(Z,{children:[(0,M.jsx)(B,{label:`Environment`,description:`Which deployment environment's request logs to pull.`,children:(0,M.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong focus:border-mono-500 focus:outline-none`,children:[(0,M.jsx)(`option`,{value:`production`,children:`production`}),(0,M.jsx)(`option`,{value:`preview`,children:`preview`})]})}),(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the Vercel project ID.`,children:(0,M.jsx)(`input`,{type:`text`,value:d,onChange:e=>f(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})]})]})}function B({label:e,description:t,required:n,children:r}){return(0,M.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,M.jsxs)(`span`,{className:`text-label-14-strong text-strong`,children:[e,n?(0,M.jsx)(`span`,{className:`ml-1 text-negative-400`,children:`*`}):null]}),r,(0,M.jsx)(`span`,{className:`text-label-13 text-secondary`,children:t})]})}var V=`https://github.com/Canonry/canonry/blob/main`,H=`${V}/skills/canonry/references/server-side-traffic.md`,U=`${V}/docs/cloudflare-traffic-setup.md`,W=`1.1.1`,G=`https://github.com/Canonry/canonry/releases/download/wp-traffic-logger-v${W}/canonry-traffic-logger-${W}.zip`;function K(e){return`The ${e} is stored in ~/.canonry/config.yaml on the Canonry server and never sent back to the dashboard.`}var q=`Never ask me to paste a password, token, or key into this chat. When a command needs one, give me the exact command to run myself, or read it from a file I point you to.`;function J(e,t){try{let n=new URL(e.trim());return n.protocol!==`https:`&&n.protocol!==`http:`?null:`${n.origin}${n.pathname.replace(/\/+$/,``)}/wp-admin/${t}`}catch{return null}}function me(e,t){let n=E(e),r=J(t,`plugin-install.php?tab=upload`),i=J(t,`profile.php#application-passwords-section`);return{docsUrl:`${H}#connecting-a-wordpress-source`,steps:[{title:`Download the Canonry Traffic Logger plugin`,link:{label:`Download v${W} (.zip)`,href:G}},{title:`Upload and activate it in wp-admin`,detail:`Plugins → Add New → Upload Plugin, then Activate.`,...r?{link:{label:`Open the upload page`,href:r}}:{}},{title:`Create an Application Password`,detail:`Users → Profile → Application Passwords. Name it “Canonry” and copy the password it shows once.`,...i?{link:{label:`Open your profile`,href:i}}:{}},{title:`Using a page cache or CDN? Exclude AI crawlers from it`,detail:`Cached pages never reach the plugin, so crawler visits go uncounted.`,link:{label:`User agents to exclude`,href:`${H}#connecting-a-wordpress-source`}}],agentRequest:`Help me connect my WordPress site to the Canonry project "${e}" for server-side traffic.
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{C as t,G as n,R as r,U as i,V as a,Z as o,at as s,ct as c,et as l,f as u,o as d,ot as f}from"./vendor-lucide-Bo69m9KC.js";import{r as p}from"./vendor-markdown-BiRP51B0.js";import{b as m,d as h,u as g,x as _}from"./vendor-tanstack-tBjrfzKu.js";import{mt as v,pn as ee,r as y,t as te,wt as b}from"./ToneBadge-COrS2zpP.js";import{t as ne}from"./async-handler-Bj3TnIRw.js";import{d as re}from"./query-client-BHtq57Sw.js";import{fn as x,sn as S}from"./react-query-IhpEAOba.js";import{t as C}from"./InfoTooltip-CNLlIWeP.js";import{t as w}from"./card-P1VA-JnV.js";import{T as ie,dt as ae,ft as T,hn as E,mt as D,pt as O,ut as oe}from"./index-DHrWeA6k.js";import{d as k,i as A,n as se,r as ce,s as le,t as ue}from"./server-traffic-ykAWQo0I.js";var j=e(c(),1),M=p();function de({open:e,onOpenChange:t,projectName:n}){let[r,i]=(0,j.useState)(`pick`);(0,j.useEffect)(()=>{e&&i(`pick`)},[e]);let a=()=>{t(!1),i(`pick`)};return(0,M.jsx)(oe,{open:e,onOpenChange:e=>{e?t(!0):a()},children:(0,M.jsx)(ae,{children:r===`pick`?(0,M.jsx)(pe,{onPick:i}):r===`cloudflare`?(0,M.jsx)(Q,{projectName:n,onBack:()=>i(`pick`),onClose:a}):r===`wordpress`?(0,M.jsx)(L,{projectName:n,onBack:()=>i(`pick`),onClose:a}):r===`vercel`?(0,M.jsx)(z,{projectName:n,onBack:()=>i(`pick`),onClose:a}):(0,M.jsx)(R,{projectName:n,onBack:()=>i(`pick`),onClose:a})})})}var fe=[{type:`cloudflare`,name:`Cloudflare`,needs:`A zone you manage. Set up from the terminal.`,icon:u},{type:`wordpress`,name:`WordPress`,needs:`wp-admin access to install a plugin`,icon:r},{type:`vercel`,name:`Vercel`,needs:`A Vercel access token`,icon:d},{type:`cloud-run`,name:`Google Cloud Run`,needs:`A service account that can read logs`,icon:n}];function pe({onPick:e}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(O,{children:[(0,M.jsx)(D,{children:`Connect a traffic source`}),(0,M.jsx)(T,{children:`Pick where your site runs. Canonry reads AI crawler visits and AI referrals from there.`})]}),(0,M.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:fe.map(({type:t,name:n,needs:r,icon:i})=>(0,M.jsxs)(`button`,{type:`button`,onClick:()=>e(t),className:`group flex items-center gap-3 rounded-md border border-base bg-bg-elevated/30 px-3 py-3 text-left transition-colors hover:border-mono-600 hover:bg-bg-elevated/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,M.jsx)(`span`,{className:`mt-0.5 inline-flex size-9 shrink-0 items-center justify-center rounded-md border border-base bg-bg text-neutral group-hover:text-heading`,children:(0,M.jsx)(i,{className:`size-4`})}),(0,M.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,M.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:n}),(0,M.jsx)(`span`,{className:`text-label-13 text-secondary`,children:r})]})]},t))}),(0,M.jsx)(`p`,{className:`mt-6 text-copy-13 text-secondary`,children:`Your agent can set up any of these for you. Pick a source to copy instructions for it.`})]})}function N({title:e,description:t,onBack:n}){return(0,M.jsxs)(O,{children:[(0,M.jsxs)(`button`,{type:`button`,onClick:n,className:`mb-1 inline-flex w-fit items-center gap-1 rounded text-button-14 text-secondary transition-colors hover:text-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,M.jsx)(f,{className:`size-3`}),`Choose a different source`]}),(0,M.jsx)(D,{children:e}),(0,M.jsx)(T,{children:t})]})}function P(e,t){let n=h();return async(r,i)=>{i.startInitialBackfill&&await ee(e,r),i.afterConnected?.(),t(),n({to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:r}})}}function F(e,t){let[n,r]=(0,j.useState)(null),i=P(e,t);return{error:n,runConnect:async e=>{r(null);let t=e.validate();if(t){r(t);return}let n;try{n=await e.mutate()}catch(e){r(k(e));return}try{await i(n.id,{startInitialBackfill:e.startInitialBackfill??!0,afterConnected:e.onConnected})}catch(e){r(`Source connected, but starting the initial backfill failed: ${k(e)}`)}}}}function I({title:e,description:t,projectName:n,onBack:r,onClose:i,onSubmit:a,isPending:o,error:s,guide:c,children:l}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{title:e,description:t,onBack:r}),(0,M.jsxs)(`div`,{className:`-mr-1 mt-6 min-h-0 flex-1 overflow-y-auto pr-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,M.jsx)(Y,{request:c.agentRequest,docsUrl:c.docsUrl}),(0,M.jsx)(X,{steps:c.steps})]}),(0,M.jsxs)(`form`,{onSubmit:ne(async e=>{e.preventDefault(),await a()}),className:`mt-6 flex flex-col gap-5 border-t border-default pt-5`,children:[(0,M.jsxs)(`p`,{className:`text-copy-14-strong text-heading`,children:[`Then connect it to `,(0,M.jsx)(`span`,{className:`text-label-13-mono`,children:n})]}),l,s?(0,M.jsx)(`p`,{className:`rounded-md border border-negative-800/50 bg-negative-950/30 px-3 py-2 text-copy-13 text-negative-200`,children:s}):null,(0,M.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-2 border-t border-default pt-4`,children:[(0,M.jsx)(y,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,children:`Close`}),(0,M.jsx)(y,{type:`submit`,disabled:o,size:`sm`,children:o?`Connecting…`:`Connect`})]})]})]})]})}function L({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),d=A(e||null),{error:f,runConnect:p}=F(e,n);return(0,M.jsxs)(I,{title:`Connect a WordPress site`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from the Canonry Traffic Logger plugin.`,(0,M.jsx)(C,{text:`${K(`Application Password`)} Pages served from a full-page cache never reach the plugin, so exclude AI crawlers from your cache. The docs list the user agents.`})]}),guide:me(e,r),projectName:e,onBack:t,onClose:n,onSubmit:()=>p({validate:()=>r.trim()?a.trim()?s.trim()?null:`Application Password is required.`:`Username is required.`:`WordPress site URL is required.`,mutate:()=>d.mutateAsync({baseUrl:r.trim(),username:a.trim(),applicationPassword:s.trim(),displayName:l.trim()||void 0}),onConnected:()=>c(``)}),isPending:d.isPending,error:f,children:[(0,M.jsx)(B,{label:`WordPress site URL`,description:`Base URL of the site running the Canonry Traffic Logger plugin.`,required:!0,children:(0,M.jsx)(`input`,{type:`url`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`url`,placeholder:`https://example.com`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Username`,description:`WordPress user that owns the Application Password.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),required:!0,autoComplete:`username`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Application Password`,description:`Create one in wp-admin under Users -> Profile -> Application Passwords.`,required:!0,children:(0,M.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),required:!0,autoComplete:`new-password`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(Z,{children:(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the WordPress host.`,children:(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})})]})}function R({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(``),p=se(e||null),{error:m,runConnect:h}=F(e,n),g=()=>h({validate:()=>r.trim()?d.trim()?null:`Service-account JSON content is required.`:`GCP project ID is required.`,mutate:()=>p.mutateAsync({gcpProjectId:r.trim(),serviceName:a.trim()||void 0,location:s.trim()||void 0,displayName:l.trim()||void 0,keyJson:d.trim()}),onConnected:()=>f(``)}),_=async e=>{if(!e)return;let t=await e.text();f(t)};return(0,M.jsxs)(I,{title:`Connect a Cloud Run service`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from your Cloud Run request logs.`,(0,M.jsx)(C,{text:K(`service-account private key`)})]}),guide:ge(e,r),projectName:e,onBack:t,onClose:n,onSubmit:g,isPending:p.isPending,error:m,children:[(0,M.jsx)(B,{label:`GCP project ID`,description:`The Google Cloud project hosting the Cloud Run service (e.g. my-prod-foo).`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsxs)(B,{label:`Service-account JSON`,description:`Paste the contents of the SA key (JSON). The SA needs roles/logging.viewer (or any role granting logging.logEntries.list).`,required:!0,children:[(0,M.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),rows:6,spellCheck:!1,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-copy-14-mono text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`,placeholder:`{"type":"service_account","project_id":"…","private_key":"…"}`,required:!0}),(0,M.jsxs)(`label`,{className:`mt-2 inline-flex cursor-pointer items-center gap-2 text-label-14 text-secondary hover:text-strong`,children:[(0,M.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>void _(e.target.files?.[0]??null)}),(0,M.jsx)(`span`,{className:`rounded-md border border-base px-2 py-1`,children:`Or upload a key file`})]})]}),(0,M.jsxs)(Z,{children:[(0,M.jsx)(B,{label:`Service name (optional)`,description:`Restrict log pulls to a specific Cloud Run service. Omit to pull all services in the project.`,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Location (optional)`,description:`Region of the Cloud Run service (e.g. us-central1). Helpful when multiple regions emit logs.`,children:(0,M.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the project + service combo.`,children:(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})]})]})}function z({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(`production`),[d,f]=(0,j.useState)(``),p=ce(e||null),{error:m,runConnect:h}=F(e,n);return(0,M.jsxs)(I,{title:`Connect a Vercel project`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from Vercel request logs. Nothing to install on your site.`,(0,M.jsx)(C,{text:K(`access token`)})]}),guide:he(e),projectName:e,onBack:t,onClose:n,onSubmit:()=>h({validate:()=>r.trim()?a.trim()?s.trim()?null:`Vercel personal access token is required.`:`Vercel team / account ID is required.`:`Vercel project ID is required.`,mutate:()=>p.mutateAsync({projectId:r.trim(),teamId:a.trim(),token:s.trim(),environment:l,displayName:d.trim()||void 0}),startInitialBackfill:!1,onConnected:()=>c(``)}),isPending:p.isPending,error:m,children:[(0,M.jsx)(B,{label:`Vercel project ID`,description:`The prj_… id from the Vercel dashboard or .vercel/project.json.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`off`,placeholder:`prj_…`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Vercel team / account ID`,description:`The Vercel team or personal account that owns the project. Find it as orgId in your .vercel/project.json.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),required:!0,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Personal access token`,description:`Create a Vercel personal access token under Account Settings → Tokens. Tokens can expire, so use a long-lived one.`,required:!0,children:(0,M.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),required:!0,autoComplete:`new-password`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsxs)(Z,{children:[(0,M.jsx)(B,{label:`Environment`,description:`Which deployment environment's request logs to pull.`,children:(0,M.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong focus:border-mono-500 focus:outline-none`,children:[(0,M.jsx)(`option`,{value:`production`,children:`production`}),(0,M.jsx)(`option`,{value:`preview`,children:`preview`})]})}),(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the Vercel project ID.`,children:(0,M.jsx)(`input`,{type:`text`,value:d,onChange:e=>f(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})]})]})}function B({label:e,description:t,required:n,children:r}){return(0,M.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,M.jsxs)(`span`,{className:`text-label-14-strong text-strong`,children:[e,n?(0,M.jsx)(`span`,{className:`ml-1 text-negative-400`,children:`*`}):null]}),r,(0,M.jsx)(`span`,{className:`text-label-13 text-secondary`,children:t})]})}var V=`https://github.com/Canonry/canonry/blob/main`,H=`${V}/skills/canonry/references/server-side-traffic.md`,U=`${V}/docs/cloudflare-traffic-setup.md`,W=`1.1.1`,G=`https://github.com/Canonry/canonry/releases/download/wp-traffic-logger-v${W}/canonry-traffic-logger-${W}.zip`;function K(e){return`The ${e} is stored in ~/.canonry/config.yaml on the Canonry server and never sent back to the dashboard.`}var q=`Never ask me to paste a password, token, or key into this chat. When a command needs one, give me the exact command to run myself, or read it from a file I point you to.`;function J(e,t){try{let n=new URL(e.trim());return n.protocol!==`https:`&&n.protocol!==`http:`?null:`${n.origin}${n.pathname.replace(/\/+$/,``)}/wp-admin/${t}`}catch{return null}}function me(e,t){let n=E(e),r=J(t,`plugin-install.php?tab=upload`),i=J(t,`profile.php#application-passwords-section`);return{docsUrl:`${H}#connecting-a-wordpress-source`,steps:[{title:`Download the Canonry Traffic Logger plugin`,link:{label:`Download v${W} (.zip)`,href:G}},{title:`Upload and activate it in wp-admin`,detail:`Plugins → Add New → Upload Plugin, then Activate.`,...r?{link:{label:`Open the upload page`,href:r}}:{}},{title:`Create an Application Password`,detail:`Users → Profile → Application Passwords. Name it “Canonry” and copy the password it shows once.`,...i?{link:{label:`Open your profile`,href:i}}:{}},{title:`Using a page cache or CDN? Exclude AI crawlers from it`,detail:`Cached pages never reach the plugin, so crawler visits go uncounted.`,link:{label:`User agents to exclude`,href:`${H}#connecting-a-wordpress-source`}}],agentRequest:`Help me connect my WordPress site to the Canonry project "${e}" for server-side traffic.
2
2
 
3
3
  Follow the WordPress section of the Canonry docs: ${H}#connecting-a-wordpress-source
4
4
 
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{J as t,Y as n,b as r,ct as i,n as a,ot as o}from"./vendor-lucide-Bo69m9KC.js";import{r as s}from"./vendor-markdown-BiRP51B0.js";import{p as ee,t as te,u as ne}from"./vendor-tanstack-tBjrfzKu.js";import{a as c,c as re,d as l,f as ie,i as ae,m as oe,n as se,r as ce}from"./vendor-recharts-CY6tH-r6.js";import{Sr as u,r as le,t as ue,wr as d,wt as de}from"./ToneBadge-ht0n6RUH.js";import{f as fe}from"./format-helpers-IKCsn-Iw.js";import{a as f,n as pe,r as me,s as he,t as ge}from"./ChartPrimitives-Cs2iavxU.js";import{t as p}from"./InfoTooltip-CNLlIWeP.js";import{t as m}from"./card-Be_eN_-Q.js";import{a as _e,d as ve,l as ye,o as be,t as xe}from"./server-traffic-DvN44H1n.js";import{r as Se}from"./agent-trust-copy-DbpAXPxc.js";var h=e(i(),1),Ce=[{value:`all`,label:`All status`},{value:`2xx`,label:`2xx success`},{value:`3xx`,label:`3xx redirect`},{value:`4xx`,label:`4xx client error`},{value:`5xx`,label:`5xx server error`}],we=[{value:`all`,label:`All claims`},{value:d.verified,label:`Verified`},{value:d.claimed_unverified,label:`Claimed unverified`},{value:d.unknown_ai_like,label:`Unknown AI-like`}];function g(e){return e===`all`?null:Number.parseInt(e[0],10)}function Te(e){switch(e.kind){case u.crawler:case u[`ai-user-fetch`]:return e.botId;case u[`ai-referral`]:return e.product}}function _(e){switch(e.kind){case u.crawler:case u[`ai-user-fetch`]:return e.pathNormalized;case u[`ai-referral`]:return e.landingPathNormalized}}function v(e){switch(e.kind){case u.crawler:case u[`ai-user-fetch`]:return e.verificationStatus;case u[`ai-referral`]:return null}}function y(e,t){if(t===`hour`)return e;let n=new Date(e);return`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,`0`)}-${String(n.getDate()).padStart(2,`0`)}`}function Ee(e,t,n){let r=t.pathQuery.trim().toLowerCase(),i=g(t.statusClass);return e.filter(e=>!(t.selectedBucket&&y(e.tsHour,n)!==t.selectedBucket||t.identity&&Te(e)!==t.identity||t.operator&&e.operator!==t.operator||r&&!_(e).toLowerCase().includes(r)||i!==null&&Math.floor(e.status/100)!==i||t.verification!==`all`&&v(e)!==t.verification))}function De(e,t){if(!e||typeof e!=`object`)return null;let n=e.activeTooltipIndex,r;if(typeof n==`number`)r=n;else if(typeof n==`string`&&n!==``)r=Number(n);else return null;return!Number.isInteger(r)||r<0||r>=t.length?null:t[r]?.bucket??null}var b=s(),x=[{value:60,label:`1h`,granularity:`hour`,fetchLimit:500},{value:360,label:`6h`,granularity:`hour`,fetchLimit:500},{value:1440,label:`24h`,granularity:`hour`,fetchLimit:500},{value:10080,label:`7d`,granularity:`hour`,fetchLimit:1e3},{value:43200,label:`30d`,granularity:`day`,fetchLimit:2e3},{value:129600,label:`90d`,granularity:`day`,fetchLimit:5e3}],Oe=x.find(e=>e.label===`24h`)??x[2],S=50,C=f[0],w=f[2],T=f[1],ke=fe();function E(e){let t=new Date(e);return`${t.getMonth()+1}/${t.getDate()} ${String(t.getHours()).padStart(2,`0`)}:00`}function D(e){let t=new Date(`${e}T00:00:00`);return`${t.getMonth()+1}/${t.getDate()}`}function Ae(e){if(!e)return`never`;let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function O(e){return e.size===1?[...e][0]:`all`}function je({canGoBack:e,className:t}){let n=`inline-flex items-center gap-1`;return e?(0,b.jsxs)(`button`,{type:`button`,onClick:()=>{window.history.back()},className:`${n} ${t??``}`,children:[(0,b.jsx)(o,{className:`size-3`}),` Back`]}):(0,b.jsxs)(ne,{to:`/traffic`,className:`${n} ${t??``}`,children:[(0,b.jsx)(o,{className:`size-3`}),` All sources`]})}function k(){let e=ee({strict:!1}),i=e.projectName??``,a=te(),o=e.sourceId??``,[s,ne]=(0,h.useState)(Oe.value),[d,fe]=(0,h.useState)(()=>new Set([`crawler`,`ai-user-fetch`,`ai-referral`])),[f,g]=(0,h.useState)(null),[_,v]=(0,h.useState)(``),[y,E]=(0,h.useState)(``),[D,k]=(0,h.useState)(``),[N,P]=(0,h.useState)(`all`),[F,I]=(0,h.useState)(`all`),[Ie,L]=(0,h.useState)(1),[Le,Re]=(0,h.useState)(null),[ze,Be]=(0,h.useState)(null),R=(0,h.useMemo)(()=>x.find(e=>e.value===s)??Oe,[s]),Ve=(0,h.useMemo)(()=>O(d),[d]),z=be(i||null,o||null),B=_e(i||null,{kind:Ve,sourceId:o||void 0,sinceMinutes:s,limit:R.fetchLimit,granularity:R.granularity}),V=ye(i||null,o||null),H=z.data,U=B.data?.events??[],W=B.data?.totals,G=B.data?.eventRows,K=(0,h.useMemo)(()=>U.filter(e=>{switch(e.kind){case u.crawler:return d.has(`crawler`);case u[`ai-user-fetch`]:return d.has(`ai-user-fetch`);case u[`ai-referral`]:return d.has(`ai-referral`)}}),[U,d]),He=(0,h.useMemo)(()=>{let e=new Set;for(let t of U)e.add(Te(t));return _&&e.add(_),[...e].sort((e,t)=>e.localeCompare(t))},[U,_]),Ue=(0,h.useMemo)(()=>{let e=new Set;for(let t of U)e.add(t.operator);return y&&e.add(y),[...e].sort((e,t)=>e.localeCompare(t))},[U,y]),q=(0,h.useMemo)(()=>Ee(K,{selectedBucket:f,identity:_,operator:y,pathQuery:D,statusClass:N,verification:F},R.granularity),[K,f,_,y,D,N,F,R.granularity]);(0,h.useEffect)(()=>{L(1)},[K,f,_,y,D,N,F]);let J=Math.max(1,Math.ceil(q.length/S)),Y=Math.min(Math.max(1,Ie),J),X=(Y-1)*S,We=(0,h.useMemo)(()=>q.slice(X,X+S),[q,X]),Ge=q.length>S,Ke=q.length===0?0:X+1,qe=Math.min(X+S,q.length),Z=(0,h.useMemo)(()=>f?Me(f,R.granularity):null,[f,R.granularity]),Q=(0,h.useMemo)(()=>Ne(B.data?.series.points??[],R.granularity),[B.data?.series.points,R.granularity]),$=e=>{fe(t=>{let n=new Set(t);return n.has(e)?n.size>1&&n.delete(e):n.add(e),n})},Je=e=>{let t=De(e,Q);t&&g(e=>e===t?null:t)},Ye=()=>{g(null),v(``),E(``),k(``),P(`all`),I(`all`)},Xe=!!(f||_||y||D.trim()||N!==`all`||F!==`all`),Ze=async()=>{Re(null),Be(null);try{let e=await V.mutateAsync({sinceMinutes:60});Be(`Pulled ${e.pulledEvents} entries · ${e.crawlerHits} crawler · ${e.aiUserFetchHits} AI user fetch · ${e.aiUserFetchLikelyFakeHits} likely fake agent · ${e.aiReferralHits} AI referral · ${e.unknownHits} unknown`)}catch(e){Re(ve(e))}};return!i||!o?(0,b.jsx)(`div`,{className:`page-container`,children:(0,b.jsx)(`p`,{className:`text-copy-14 text-muted`,children:`Missing project name or source id in URL.`})}):z.isLoading?(0,b.jsx)(`div`,{className:`page-container`,children:(0,b.jsx)(`p`,{className:`text-copy-14 text-muted`,children:`Loading source…`})}):z.isError||!H?(0,b.jsxs)(`div`,{className:`page-container`,children:[(0,b.jsx)(`p`,{className:`text-copy-14 text-negative`,children:`Could not load this source.`}),(0,b.jsx)(je,{canGoBack:a,className:`mt-2 text-label-12 text-secondary hover:text-strong`})]}):(0,b.jsxs)(`div`,{className:`page-container space-y-8`,children:[(0,b.jsxs)(`div`,{className:`page-header`,children:[(0,b.jsxs)(`div`,{className:`page-header-left`,children:[(0,b.jsx)(je,{canGoBack:a,className:`text-label-12 text-muted hover:text-strong`}),(0,b.jsx)(`h1`,{className:`page-title mt-2`,children:H.displayName}),(0,b.jsxs)(`p`,{className:`page-subtitle`,children:[H.sourceType,` source for `,i]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(ue,{tone:xe(H.status),children:H.status}),!de()&&(0,b.jsxs)(le,{type:`button`,variant:`outline`,size:`sm`,disabled:V.isPending,onClick:()=>void Ze(),children:[(0,b.jsx)(r,{className:`size-3.5 ${V.isPending?`animate-spin`:``}`}),V.isPending?`Syncing…`:`Sync now`]})]})]}),Le?(0,b.jsx)(`div`,{className:`rounded-md border border-negative-800/50 bg-negative-950/30 px-3 py-2 text-label-14 text-negative-200`,children:Le}):null,ze?(0,b.jsx)(`div`,{className:`rounded-md border border-positive-800/50 bg-positive-950/30 px-3 py-2 text-label-14 text-positive-200`,children:ze}):null,(0,b.jsxs)(`section`,{"aria-labelledby":`traffic-24h-heading`,children:[(0,b.jsx)(`h2`,{id:`traffic-24h-heading`,className:`mb-3 text-heading-14 text-heading`,children:`Last 24 hours`}),(0,b.jsxs)(`div`,{className:`grid grid-cols-1 divide-y divide-default border-y border-default sm:grid-cols-3 sm:divide-x sm:divide-y-0`,children:[(0,b.jsx)(M,{label:`Content crawls`,value:H.totals24h.crawlerContentHits,tooltip:`Content and document paths only. Excludes sitemap ${H.totals24h.crawlerSegments.sitemap.toLocaleString(`en-US`)}, robots ${H.totals24h.crawlerSegments.robots.toLocaleString(`en-US`)}, assets ${H.totals24h.crawlerSegments.asset.toLocaleString(`en-US`)}, and ${H.totals24h.crawlerSegments.other.toLocaleString(`en-US`)} other requests such as feeds, API paths, or downloads. Total crawler hits: ${H.totals24h.crawlerHits.toLocaleString(`en-US`)}.`}),(0,b.jsx)(M,{label:`AI user fetches`,value:H.totals24h.aiUserFetchHits,tooltip:`Requests from AI assistants fetching a page for a person (ChatGPT-User, Claude-User, Perplexity-User and others). ${Se(H.totals24h.aiUserFetchLikelyFakeHits)}`}),(0,b.jsx)(M,{label:`AI referral sessions`,value:H.totals24h.aiReferralLandedHits,tooltip:`Browser click-throughs from AI surfaces, identified by Referer or UTM evidence. Excludes ${H.totals24h.aiReferralRedirectedHits.toLocaleString(`en-US`)} request(s) answered with a redirect: a hop is not an arrival. Total including hops: ${H.totals24h.aiReferralHits.toLocaleString(`en-US`)}.`})]})]}),(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`p`,{className:`eyebrow mb-4`,children:`Latest sync run`}),H.latestRun?(0,b.jsxs)(m,{className:`p-4 text-label-14`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-1.5`,children:[(0,b.jsxs)(`span`,{className:`text-heading`,children:[`Status: `,(0,b.jsx)(`span`,{className:`text-label-14-strong`,children:H.latestRun.status})]}),(0,b.jsxs)(`span`,{className:`text-muted`,children:[`Started: `,Ae(H.latestRun.startedAt)]}),H.latestRun.finishedAt?(0,b.jsxs)(`span`,{className:`text-muted`,children:[`Finished: `,Ae(H.latestRun.finishedAt)]}):null]}),(0,b.jsxs)(`details`,{className:`mt-3`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer text-label-14 text-secondary hover:text-strong`,children:`Run details`}),(0,b.jsx)(`code`,{className:`mt-2 block text-label-12 text-muted`,children:H.latestRun.runId})]}),H.latestRun.error?(0,b.jsx)(`p`,{className:`mt-2 rounded border border-negative-900/40 bg-negative-950/30 px-3 py-2 text-copy-13 text-negative`,children:H.latestRun.error}):null]}):(0,b.jsx)(m,{className:`px-4 py-3 text-label-14 text-muted`,children:de()?`No traffic-sync runs recorded yet.`:`No traffic-sync runs recorded yet. Hit "Sync now" above to create one.`})]}),(0,b.jsxs)(`section`,{children:[(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-x-4 gap-y-3`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-label-12-strong normal-case text-muted`,children:`Events`}),(0,b.jsx)(`h2`,{className:`mt-1 text-heading-16 text-primary`,children:R.granularity===`day`?`Daily rollups`:`Hourly rollups`}),W?(0,b.jsxs)(`p`,{className:`mt-1.5 text-copy-13 text-muted`,children:[W.crawlerContentHits.toLocaleString(`en-US`),` content crawls ·`,` `,W.crawlerInfraHits.toLocaleString(`en-US`),` infra (sitemap/robots/assets) ·`,` `,W.aiUserFetchHits.toLocaleString(`en-US`),` AI user fetches ·`,` `,W.aiReferralLandedHits.toLocaleString(`en-US`),` AI referral sessions · last `,R.label,` · `,ke]}):null]}),(0,b.jsx)(`div`,{className:`inline-flex rounded-md border border-base p-0.5`,role:`toolbar`,"aria-label":`Window`,children:x.map(e=>(0,b.jsx)(`button`,{type:`button`,className:`rounded px-2.5 py-1 text-button-14 ${s===e.value?`bg-bg-elevated text-heading`:`text-secondary hover:text-strong`}`,"aria-pressed":s===e.value,onClick:()=>{ne(e.value),g(null)},children:e.label},e.value))})]}),(0,b.jsxs)(m,{className:`p-4`,children:[(0,b.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,role:`toolbar`,"aria-label":`Series`,children:[(0,b.jsx)(j,{label:`Crawler`,color:C,count:W?.crawlerHits??0,active:d.has(`crawler`),onToggle:()=>$(`crawler`)}),(0,b.jsx)(j,{label:`AI user fetches`,color:w,count:W?.aiUserFetchHits??0,active:d.has(`ai-user-fetch`),onToggle:()=>$(`ai-user-fetch`)}),(0,b.jsx)(j,{label:`AI referral sessions`,color:T,count:W?.aiReferralLandedHits??0,active:d.has(`ai-referral`),onToggle:()=>$(`ai-referral`)})]}),B.isError?(0,b.jsxs)(`p`,{className:`py-12 text-center text-copy-13 text-negative-400`,children:[`Failed to load events: `,B.error instanceof Error?B.error.message:`Unknown error`]}):B.isLoading?(0,b.jsx)(`p`,{className:`py-12 text-center text-copy-13 text-muted`,children:`Loading events…`}):Q.length===0?(0,b.jsx)(`p`,{className:`py-12 text-center text-copy-13 text-muted`,children:`No events in this window.`}):(0,b.jsx)(`div`,{className:`h-72`,children:(0,b.jsx)(oe,{children:(0,b.jsxs)(se,{data:Q,margin:{top:4,right:4,bottom:0,left:0},onClick:Je,style:{cursor:`pointer`},children:[(0,b.jsx)(re,{stroke:me,strokeDasharray:`3 3`}),(0,b.jsx)(ae,{dataKey:`label`,tick:pe,stroke:ge,interval:`preserveStartEnd`,minTickGap:R.granularity===`day`?24:32}),(0,b.jsx)(ce,{tick:pe,stroke:ge,allowDecimals:!1}),(0,b.jsx)(ie,{...he}),d.has(`crawler`)?(0,b.jsx)(c,{dataKey:`crawler`,name:`Crawler`,fill:C,stackId:`a`,children:Q.map(e=>(0,b.jsx)(l,{fillOpacity:f&&f!==e.bucket?.25:1},e.bucket))}):null,d.has(`ai-user-fetch`)?(0,b.jsx)(c,{dataKey:`aiUserFetch`,name:`AI user fetch`,fill:w,stackId:`a`,children:Q.map(e=>(0,b.jsx)(l,{fillOpacity:f&&f!==e.bucket?.25:1},e.bucket))}):null,d.has(`ai-referral`)?(0,b.jsx)(c,{dataKey:`aiReferral`,name:`AI referral`,fill:T,stackId:`a`,children:Q.map(e=>(0,b.jsx)(l,{fillOpacity:f&&f!==e.bucket?.25:1},e.bucket))}):null]})})})]})]}),(0,b.jsxs)(`section`,{children:[(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-x-4 gap-y-2`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-label-12-strong normal-case text-muted`,children:`Event rows`}),(0,b.jsxs)(`p`,{className:`mt-1 text-copy-13 text-muted`,children:[`Showing `,(0,b.jsx)(`span`,{className:`tabular-nums text-neutral`,children:q.length.toLocaleString(`en-US`)}),` of`,` `,(0,b.jsx)(`span`,{className:`tabular-nums text-muted`,children:K.length.toLocaleString(`en-US`)}),` `,G?.truncated?`loaded events`:`events`,G?.truncated?(0,b.jsxs)(b.Fragment,{children:[` `,`· loaded `,(0,b.jsx)(`span`,{className:`tabular-nums text-neutral`,children:G.returned.toLocaleString(`en-US`)}),` of`,` `,(0,b.jsx)(`span`,{className:`tabular-nums text-muted`,children:G.total.toLocaleString(`en-US`)}),` rows`]}):null,` `,`· `,ke]})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsxs)(`span`,{className:`inline-flex items-center text-secondary`,children:[(0,b.jsxs)(`select`,{"aria-label":`Filter by identity`,value:_,onChange:e=>v(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:[(0,b.jsx)(`option`,{value:``,children:`All identities`}),He.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))]}),(0,b.jsx)(p,{text:`The specific bot or AI product making the request (e.g., GPTBot, ChatGPT-User, Perplexity). One operator usually runs several identities.`})]}),(0,b.jsxs)(`span`,{className:`inline-flex items-center text-secondary`,children:[(0,b.jsxs)(`select`,{"aria-label":`Filter by operator`,value:y,onChange:e=>E(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:[(0,b.jsx)(`option`,{value:``,children:`All operators`}),Ue.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))]}),(0,b.jsx)(p,{text:`The company that runs the bot or product (e.g., OpenAI, Anthropic, Perplexity). Filtering by operator includes every identity under that company.`})]}),(0,b.jsx)(`select`,{"aria-label":`Filter by HTTP status class`,value:N,onChange:e=>P(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:Ce.map(e=>(0,b.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,b.jsx)(`select`,{"aria-label":`Filter by verification claim`,value:F,onChange:e=>I(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:we.map(e=>(0,b.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,b.jsx)(`input`,{type:`search`,"aria-label":`Filter by path`,placeholder:`path contains…`,value:D,onChange:e=>k(e.target.value),className:`w-44 rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong placeholder:text-faint focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`})]})]}),Xe?(0,b.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,children:[Z?(0,b.jsx)(A,{label:`Bucket: ${Z}`,onClear:()=>g(null)}):null,_?(0,b.jsx)(A,{label:`Identity: ${_}`,onClear:()=>v(``)}):null,y?(0,b.jsx)(A,{label:`Operator: ${y}`,onClear:()=>E(``)}):null,D.trim()?(0,b.jsx)(A,{label:`Path: ${D.trim()}`,onClear:()=>k(``)}):null,N===`all`?null:(0,b.jsx)(A,{label:`Status: ${N}`,onClear:()=>P(`all`)}),F===`all`?null:(0,b.jsx)(A,{label:`Claim: ${Pe(F)}`,onClear:()=>I(`all`)}),(0,b.jsx)(`button`,{type:`button`,onClick:Ye,className:`text-button-14 text-muted underline-offset-4 hover:text-strong hover:underline`,children:`Clear all`})]}):null,(0,b.jsx)(Fe,{events:We,truncated:G?.truncated??!1}),Ge?(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 text-label-12 text-secondary`,children:[(0,b.jsxs)(`p`,{className:`tabular-nums`,children:[`Showing `,(0,b.jsx)(`span`,{className:`text-neutral`,children:Ke.toLocaleString(`en-US`)}),`–`,(0,b.jsx)(`span`,{className:`text-neutral`,children:qe.toLocaleString(`en-US`)}),` of`,` `,(0,b.jsx)(`span`,{className:`text-neutral`,children:q.length.toLocaleString(`en-US`)}),` events`]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>L(e=>Math.max(1,e-1)),disabled:Y<=1,"aria-label":`Previous page`,className:`inline-flex items-center gap-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-strong transition hover:border-strong hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-base disabled:hover:text-strong`,children:[(0,b.jsx)(n,{className:`size-3.5`}),`Prev`]}),(0,b.jsxs)(`span`,{className:`tabular-nums`,children:[`Page `,(0,b.jsx)(`span`,{className:`text-strong`,children:Y}),` of`,` `,(0,b.jsx)(`span`,{className:`text-strong`,children:J})]}),(0,b.jsxs)(`button`,{type:`button`,onClick:()=>L(e=>Math.min(J,e+1)),disabled:Y>=J,"aria-label":`Next page`,className:`inline-flex items-center gap-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-strong transition hover:border-strong hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-base disabled:hover:text-strong`,children:[`Next`,(0,b.jsx)(t,{className:`size-3.5`})]})]})]}):null]}),(0,b.jsxs)(`details`,{className:`border-t border-default pt-4`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer text-label-14 text-secondary hover:text-strong`,children:`How traffic is classified`}),(0,b.jsx)(`p`,{className:`mt-2 max-w-3xl text-copy-14 text-secondary`,children:`Crawler requests, AI user fetches, and referrals are recorded separately. Filters expose the underlying evidence.`})]})]})}function Me(e,t){return t===`day`?D(e):E(e)}function Ne(e,t){return e.map(e=>({bucket:e.bucket,label:Me(e.bucket,t),crawler:e.crawlerHits,aiUserFetch:e.aiUserFetchHits,aiReferral:e.aiReferralLandedHits}))}function Pe(e){return we.find(t=>t.value===e)?.label??e}function A({label:e,onClear:t}){return(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded border border-strong bg-surface-inset px-2.5 py-1 text-label-14 text-strong`,children:[e,(0,b.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Clear ${e}`,className:`rounded p-0.5 text-secondary hover:bg-mono-700/60 hover:text-heading`,children:(0,b.jsx)(a,{className:`size-3`})})]})}function j({label:e,color:t,count:n,active:r,onToggle:i}){return(0,b.jsxs)(`button`,{type:`button`,onClick:i,"aria-pressed":r,className:`inline-flex items-center gap-2 rounded border px-3 py-1.5 text-button-14 transition ${r?`border-strong bg-surface-inset text-heading`:`border-base bg-transparent text-muted hover:text-neutral`}`,children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-3 items-center justify-center rounded-sm border transition-opacity ${r?`border-transparent opacity-100`:`border-strong opacity-60`}`,style:r?{backgroundColor:t}:void 0,children:r?`✓`:``}),(0,b.jsx)(`span`,{children:e}),(0,b.jsx)(`span`,{className:`tabular-nums ${r?`text-secondary`:`text-faint`}`,children:n.toLocaleString(`en-US`)})]})}function M({label:e,value:t,tooltip:n}){return(0,b.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,b.jsxs)(`p`,{className:`flex items-center gap-1 text-copy-14 text-secondary`,children:[e,n?(0,b.jsx)(p,{text:n}):null]}),(0,b.jsx)(`p`,{className:`mt-1 text-copy-24-strong tabular-nums text-heading`,children:t.toLocaleString(`en-US`)})]})}function N(e){switch(e){case u.crawler:return`Crawler`;case u[`ai-user-fetch`]:return`AI hit`;case u[`ai-referral`]:return`AI referral`}}function P(e){switch(e.kind){case u.crawler:case u[`ai-user-fetch`]:return e.botId;case u[`ai-referral`]:return e.product}}function F(e){switch(e.kind){case u.crawler:case u[`ai-user-fetch`]:return`${e.verificationStatus} · HTTP ${e.status}`;case u[`ai-referral`]:return`${e.evidenceType} · ${e.sourceDomain}`}}function Fe({events:e,truncated:t=!1}){return e.length===0?(0,b.jsx)(m,{className:`p-6 text-center text-label-14 text-muted`,children:t?`No matches in the rows loaded so far. More rows exist beyond the load limit, so narrow the time window to search them.`:`No event rows match the current filters.`}):(0,b.jsx)(`div`,{className:`material-base overflow-hidden`,children:(0,b.jsxs)(`table`,{className:`w-full text-label-14`,children:[(0,b.jsx)(`thead`,{className:`bg-bg-elevated/50 text-label-12-strong normal-case text-muted`,children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Hour`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Kind`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Identity`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Evidence / status`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Path`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-right`,children:(0,b.jsxs)(`span`,{className:`inline-flex items-center`,children:[`Hits`,(0,b.jsx)(p,{text:`Each row is one hour-bucket, not one request. Hits is the number of requests in that hour that shared the same identity, path, HTTP status, and verification claim.`})]})})]})}),(0,b.jsx)(`tbody`,{className:`divide-y divide-mono-800/60`,children:e.map((e,t)=>(0,b.jsxs)(`tr`,{className:`hover:bg-bg-elevated/40 transition-colors`,children:[(0,b.jsx)(`td`,{className:`px-4 py-2 text-label-12-mono text-neutral`,children:E(e.tsHour)}),(0,b.jsx)(`td`,{className:`px-4 py-2 text-neutral`,children:N(e.kind)}),(0,b.jsxs)(`td`,{className:`px-4 py-2 text-heading`,children:[P(e),(0,b.jsx)(`span`,{className:`ml-2 text-label-12 text-muted`,children:e.operator})]}),(0,b.jsx)(`td`,{className:`px-4 py-2 text-neutral`,children:F(e)}),(0,b.jsx)(`td`,{className:`px-4 py-2 truncate text-label-12-mono text-neutral`,children:_(e)}),(0,b.jsx)(`td`,{className:`px-4 py-2 text-right tabular-nums text-heading`,children:e.hits})]},`${e.kind}:${e.tsHour}:${t}`))})]})})}export{Fe as EventsTable,M as TrafficKpi,k as TrafficSourceDetailPage,O as trafficFetchKind};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{J as t,Y as n,b as r,ct as i,n as a,ot as o}from"./vendor-lucide-Bo69m9KC.js";import{r as s}from"./vendor-markdown-BiRP51B0.js";import{p as ee,t as te,u as ne}from"./vendor-tanstack-tBjrfzKu.js";import{a as c,c as re,d as l,f as ie,i as ae,m as oe,n as se,r as ce}from"./vendor-recharts-CY6tH-r6.js";import{Sr as u,r as le,t as ue,wr as d,wt as de}from"./ToneBadge-COrS2zpP.js";import{f as fe}from"./format-helpers-COfTmLRL.js";import{a as f,n as pe,r as me,s as he,t as ge}from"./ChartPrimitives-Cs2iavxU.js";import{t as p}from"./InfoTooltip-CNLlIWeP.js";import{t as m}from"./card-P1VA-JnV.js";import{a as _e,d as ve,l as ye,o as be,t as xe}from"./server-traffic-ykAWQo0I.js";import{r as Se}from"./agent-trust-copy-Hb775a57.js";var h=e(i(),1),Ce=[{value:`all`,label:`All status`},{value:`2xx`,label:`2xx success`},{value:`3xx`,label:`3xx redirect`},{value:`4xx`,label:`4xx client error`},{value:`5xx`,label:`5xx server error`}],we=[{value:`all`,label:`All claims`},{value:d.verified,label:`Verified`},{value:d.claimed_unverified,label:`Claimed unverified`},{value:d.unknown_ai_like,label:`Unknown AI-like`}];function g(e){return e===`all`?null:Number.parseInt(e[0],10)}function Te(e){switch(e.kind){case u.crawler:case u[`ai-user-fetch`]:return e.botId;case u[`ai-referral`]:return e.product}}function _(e){switch(e.kind){case u.crawler:case u[`ai-user-fetch`]:return e.pathNormalized;case u[`ai-referral`]:return e.landingPathNormalized}}function v(e){switch(e.kind){case u.crawler:case u[`ai-user-fetch`]:return e.verificationStatus;case u[`ai-referral`]:return null}}function y(e,t){if(t===`hour`)return e;let n=new Date(e);return`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,`0`)}-${String(n.getDate()).padStart(2,`0`)}`}function Ee(e,t,n){let r=t.pathQuery.trim().toLowerCase(),i=g(t.statusClass);return e.filter(e=>!(t.selectedBucket&&y(e.tsHour,n)!==t.selectedBucket||t.identity&&Te(e)!==t.identity||t.operator&&e.operator!==t.operator||r&&!_(e).toLowerCase().includes(r)||i!==null&&Math.floor(e.status/100)!==i||t.verification!==`all`&&v(e)!==t.verification))}function De(e,t){if(!e||typeof e!=`object`)return null;let n=e.activeTooltipIndex,r;if(typeof n==`number`)r=n;else if(typeof n==`string`&&n!==``)r=Number(n);else return null;return!Number.isInteger(r)||r<0||r>=t.length?null:t[r]?.bucket??null}var b=s(),x=[{value:60,label:`1h`,granularity:`hour`,fetchLimit:500},{value:360,label:`6h`,granularity:`hour`,fetchLimit:500},{value:1440,label:`24h`,granularity:`hour`,fetchLimit:500},{value:10080,label:`7d`,granularity:`hour`,fetchLimit:1e3},{value:43200,label:`30d`,granularity:`day`,fetchLimit:2e3},{value:129600,label:`90d`,granularity:`day`,fetchLimit:5e3}],Oe=x.find(e=>e.label===`24h`)??x[2],S=50,C=f[0],w=f[2],T=f[1],ke=fe();function E(e){let t=new Date(e);return`${t.getMonth()+1}/${t.getDate()} ${String(t.getHours()).padStart(2,`0`)}:00`}function D(e){let t=new Date(`${e}T00:00:00`);return`${t.getMonth()+1}/${t.getDate()}`}function Ae(e){if(!e)return`never`;let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function O(e){return e.size===1?[...e][0]:`all`}function je({canGoBack:e,className:t}){let n=`inline-flex items-center gap-1`;return e?(0,b.jsxs)(`button`,{type:`button`,onClick:()=>{window.history.back()},className:`${n} ${t??``}`,children:[(0,b.jsx)(o,{className:`size-3`}),` Back`]}):(0,b.jsxs)(ne,{to:`/traffic`,className:`${n} ${t??``}`,children:[(0,b.jsx)(o,{className:`size-3`}),` All sources`]})}function k(){let e=ee({strict:!1}),i=e.projectName??``,a=te(),o=e.sourceId??``,[s,ne]=(0,h.useState)(Oe.value),[d,fe]=(0,h.useState)(()=>new Set([`crawler`,`ai-user-fetch`,`ai-referral`])),[f,g]=(0,h.useState)(null),[_,v]=(0,h.useState)(``),[y,E]=(0,h.useState)(``),[D,k]=(0,h.useState)(``),[N,P]=(0,h.useState)(`all`),[F,I]=(0,h.useState)(`all`),[Ie,L]=(0,h.useState)(1),[Le,Re]=(0,h.useState)(null),[ze,Be]=(0,h.useState)(null),R=(0,h.useMemo)(()=>x.find(e=>e.value===s)??Oe,[s]),Ve=(0,h.useMemo)(()=>O(d),[d]),z=be(i||null,o||null),B=_e(i||null,{kind:Ve,sourceId:o||void 0,sinceMinutes:s,limit:R.fetchLimit,granularity:R.granularity}),V=ye(i||null,o||null),H=z.data,U=B.data?.events??[],W=B.data?.totals,G=B.data?.eventRows,K=(0,h.useMemo)(()=>U.filter(e=>{switch(e.kind){case u.crawler:return d.has(`crawler`);case u[`ai-user-fetch`]:return d.has(`ai-user-fetch`);case u[`ai-referral`]:return d.has(`ai-referral`)}}),[U,d]),He=(0,h.useMemo)(()=>{let e=new Set;for(let t of U)e.add(Te(t));return _&&e.add(_),[...e].sort((e,t)=>e.localeCompare(t))},[U,_]),Ue=(0,h.useMemo)(()=>{let e=new Set;for(let t of U)e.add(t.operator);return y&&e.add(y),[...e].sort((e,t)=>e.localeCompare(t))},[U,y]),q=(0,h.useMemo)(()=>Ee(K,{selectedBucket:f,identity:_,operator:y,pathQuery:D,statusClass:N,verification:F},R.granularity),[K,f,_,y,D,N,F,R.granularity]);(0,h.useEffect)(()=>{L(1)},[K,f,_,y,D,N,F]);let J=Math.max(1,Math.ceil(q.length/S)),Y=Math.min(Math.max(1,Ie),J),X=(Y-1)*S,We=(0,h.useMemo)(()=>q.slice(X,X+S),[q,X]),Ge=q.length>S,Ke=q.length===0?0:X+1,qe=Math.min(X+S,q.length),Z=(0,h.useMemo)(()=>f?Me(f,R.granularity):null,[f,R.granularity]),Q=(0,h.useMemo)(()=>Ne(B.data?.series.points??[],R.granularity),[B.data?.series.points,R.granularity]),$=e=>{fe(t=>{let n=new Set(t);return n.has(e)?n.size>1&&n.delete(e):n.add(e),n})},Je=e=>{let t=De(e,Q);t&&g(e=>e===t?null:t)},Ye=()=>{g(null),v(``),E(``),k(``),P(`all`),I(`all`)},Xe=!!(f||_||y||D.trim()||N!==`all`||F!==`all`),Ze=async()=>{Re(null),Be(null);try{let e=await V.mutateAsync({sinceMinutes:60});Be(`Pulled ${e.pulledEvents} entries · ${e.crawlerHits} crawler · ${e.aiUserFetchHits} AI user fetch · ${e.aiUserFetchLikelyFakeHits} likely fake agent · ${e.aiReferralHits} AI referral · ${e.unknownHits} unknown`)}catch(e){Re(ve(e))}};return!i||!o?(0,b.jsx)(`div`,{className:`page-container`,children:(0,b.jsx)(`p`,{className:`text-copy-14 text-muted`,children:`Missing project name or source id in URL.`})}):z.isLoading?(0,b.jsx)(`div`,{className:`page-container`,children:(0,b.jsx)(`p`,{className:`text-copy-14 text-muted`,children:`Loading source…`})}):z.isError||!H?(0,b.jsxs)(`div`,{className:`page-container`,children:[(0,b.jsx)(`p`,{className:`text-copy-14 text-negative`,children:`Could not load this source.`}),(0,b.jsx)(je,{canGoBack:a,className:`mt-2 text-label-12 text-secondary hover:text-strong`})]}):(0,b.jsxs)(`div`,{className:`page-container space-y-8`,children:[(0,b.jsxs)(`div`,{className:`page-header`,children:[(0,b.jsxs)(`div`,{className:`page-header-left`,children:[(0,b.jsx)(je,{canGoBack:a,className:`text-label-12 text-muted hover:text-strong`}),(0,b.jsx)(`h1`,{className:`page-title mt-2`,children:H.displayName}),(0,b.jsxs)(`p`,{className:`page-subtitle`,children:[H.sourceType,` source for `,i]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(ue,{tone:xe(H.status),children:H.status}),!de()&&(0,b.jsxs)(le,{type:`button`,variant:`outline`,size:`sm`,disabled:V.isPending,onClick:()=>void Ze(),children:[(0,b.jsx)(r,{className:`size-3.5 ${V.isPending?`animate-spin`:``}`}),V.isPending?`Syncing…`:`Sync now`]})]})]}),Le?(0,b.jsx)(`div`,{className:`rounded-md border border-negative-800/50 bg-negative-950/30 px-3 py-2 text-label-14 text-negative-200`,children:Le}):null,ze?(0,b.jsx)(`div`,{className:`rounded-md border border-positive-800/50 bg-positive-950/30 px-3 py-2 text-label-14 text-positive-200`,children:ze}):null,(0,b.jsxs)(`section`,{"aria-labelledby":`traffic-24h-heading`,children:[(0,b.jsx)(`h2`,{id:`traffic-24h-heading`,className:`mb-3 text-heading-14 text-heading`,children:`Last 24 hours`}),(0,b.jsxs)(`div`,{className:`grid grid-cols-1 divide-y divide-default border-y border-default sm:grid-cols-3 sm:divide-x sm:divide-y-0`,children:[(0,b.jsx)(M,{label:`Content crawls`,value:H.totals24h.crawlerContentHits,tooltip:`Content and document paths only. Excludes sitemap ${H.totals24h.crawlerSegments.sitemap.toLocaleString(`en-US`)}, robots ${H.totals24h.crawlerSegments.robots.toLocaleString(`en-US`)}, assets ${H.totals24h.crawlerSegments.asset.toLocaleString(`en-US`)}, and ${H.totals24h.crawlerSegments.other.toLocaleString(`en-US`)} other requests such as feeds, API paths, or downloads. Total crawler hits: ${H.totals24h.crawlerHits.toLocaleString(`en-US`)}.`}),(0,b.jsx)(M,{label:`AI user fetches`,value:H.totals24h.aiUserFetchHits,tooltip:`Requests from AI assistants fetching a page for a person (ChatGPT-User, Claude-User, Perplexity-User and others). ${Se(H.totals24h.aiUserFetchLikelyFakeHits)}`}),(0,b.jsx)(M,{label:`AI referral sessions`,value:H.totals24h.aiReferralLandedHits,tooltip:`Browser click-throughs from AI surfaces, identified by Referer or UTM evidence. Excludes ${H.totals24h.aiReferralRedirectedHits.toLocaleString(`en-US`)} request(s) answered with a redirect: a hop is not an arrival. Total including hops: ${H.totals24h.aiReferralHits.toLocaleString(`en-US`)}.`})]})]}),(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`p`,{className:`eyebrow mb-4`,children:`Latest sync run`}),H.latestRun?(0,b.jsxs)(m,{className:`p-4 text-label-14`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-1.5`,children:[(0,b.jsxs)(`span`,{className:`text-heading`,children:[`Status: `,(0,b.jsx)(`span`,{className:`text-label-14-strong`,children:H.latestRun.status})]}),(0,b.jsxs)(`span`,{className:`text-muted`,children:[`Started: `,Ae(H.latestRun.startedAt)]}),H.latestRun.finishedAt?(0,b.jsxs)(`span`,{className:`text-muted`,children:[`Finished: `,Ae(H.latestRun.finishedAt)]}):null]}),(0,b.jsxs)(`details`,{className:`mt-3`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer text-label-14 text-secondary hover:text-strong`,children:`Run details`}),(0,b.jsx)(`code`,{className:`mt-2 block text-label-12 text-muted`,children:H.latestRun.runId})]}),H.latestRun.error?(0,b.jsx)(`p`,{className:`mt-2 rounded border border-negative-900/40 bg-negative-950/30 px-3 py-2 text-copy-13 text-negative`,children:H.latestRun.error}):null]}):(0,b.jsx)(m,{className:`px-4 py-3 text-label-14 text-muted`,children:de()?`No traffic-sync runs recorded yet.`:`No traffic-sync runs recorded yet. Hit "Sync now" above to create one.`})]}),(0,b.jsxs)(`section`,{children:[(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-x-4 gap-y-3`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-label-12-strong normal-case text-muted`,children:`Events`}),(0,b.jsx)(`h2`,{className:`mt-1 text-heading-16 text-primary`,children:R.granularity===`day`?`Daily rollups`:`Hourly rollups`}),W?(0,b.jsxs)(`p`,{className:`mt-1.5 text-copy-13 text-muted`,children:[W.crawlerContentHits.toLocaleString(`en-US`),` content crawls ·`,` `,W.crawlerInfraHits.toLocaleString(`en-US`),` infra (sitemap/robots/assets) ·`,` `,W.aiUserFetchHits.toLocaleString(`en-US`),` AI user fetches ·`,` `,W.aiReferralLandedHits.toLocaleString(`en-US`),` AI referral sessions · last `,R.label,` · `,ke]}):null]}),(0,b.jsx)(`div`,{className:`inline-flex rounded-md border border-base p-0.5`,role:`toolbar`,"aria-label":`Window`,children:x.map(e=>(0,b.jsx)(`button`,{type:`button`,className:`rounded px-2.5 py-1 text-button-14 ${s===e.value?`bg-bg-elevated text-heading`:`text-secondary hover:text-strong`}`,"aria-pressed":s===e.value,onClick:()=>{ne(e.value),g(null)},children:e.label},e.value))})]}),(0,b.jsxs)(m,{className:`p-4`,children:[(0,b.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,role:`toolbar`,"aria-label":`Series`,children:[(0,b.jsx)(j,{label:`Crawler`,color:C,count:W?.crawlerHits??0,active:d.has(`crawler`),onToggle:()=>$(`crawler`)}),(0,b.jsx)(j,{label:`AI user fetches`,color:w,count:W?.aiUserFetchHits??0,active:d.has(`ai-user-fetch`),onToggle:()=>$(`ai-user-fetch`)}),(0,b.jsx)(j,{label:`AI referral sessions`,color:T,count:W?.aiReferralLandedHits??0,active:d.has(`ai-referral`),onToggle:()=>$(`ai-referral`)})]}),B.isError?(0,b.jsxs)(`p`,{className:`py-12 text-center text-copy-13 text-negative-400`,children:[`Failed to load events: `,B.error instanceof Error?B.error.message:`Unknown error`]}):B.isLoading?(0,b.jsx)(`p`,{className:`py-12 text-center text-copy-13 text-muted`,children:`Loading events…`}):Q.length===0?(0,b.jsx)(`p`,{className:`py-12 text-center text-copy-13 text-muted`,children:`No events in this window.`}):(0,b.jsx)(`div`,{className:`h-72`,children:(0,b.jsx)(oe,{children:(0,b.jsxs)(se,{data:Q,margin:{top:4,right:4,bottom:0,left:0},onClick:Je,style:{cursor:`pointer`},children:[(0,b.jsx)(re,{stroke:me,strokeDasharray:`3 3`}),(0,b.jsx)(ae,{dataKey:`label`,tick:pe,stroke:ge,interval:`preserveStartEnd`,minTickGap:R.granularity===`day`?24:32}),(0,b.jsx)(ce,{tick:pe,stroke:ge,allowDecimals:!1}),(0,b.jsx)(ie,{...he}),d.has(`crawler`)?(0,b.jsx)(c,{dataKey:`crawler`,name:`Crawler`,fill:C,stackId:`a`,children:Q.map(e=>(0,b.jsx)(l,{fillOpacity:f&&f!==e.bucket?.25:1},e.bucket))}):null,d.has(`ai-user-fetch`)?(0,b.jsx)(c,{dataKey:`aiUserFetch`,name:`AI user fetch`,fill:w,stackId:`a`,children:Q.map(e=>(0,b.jsx)(l,{fillOpacity:f&&f!==e.bucket?.25:1},e.bucket))}):null,d.has(`ai-referral`)?(0,b.jsx)(c,{dataKey:`aiReferral`,name:`AI referral`,fill:T,stackId:`a`,children:Q.map(e=>(0,b.jsx)(l,{fillOpacity:f&&f!==e.bucket?.25:1},e.bucket))}):null]})})})]})]}),(0,b.jsxs)(`section`,{children:[(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-x-4 gap-y-2`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-label-12-strong normal-case text-muted`,children:`Event rows`}),(0,b.jsxs)(`p`,{className:`mt-1 text-copy-13 text-muted`,children:[`Showing `,(0,b.jsx)(`span`,{className:`tabular-nums text-neutral`,children:q.length.toLocaleString(`en-US`)}),` of`,` `,(0,b.jsx)(`span`,{className:`tabular-nums text-muted`,children:K.length.toLocaleString(`en-US`)}),` `,G?.truncated?`loaded events`:`events`,G?.truncated?(0,b.jsxs)(b.Fragment,{children:[` `,`· loaded `,(0,b.jsx)(`span`,{className:`tabular-nums text-neutral`,children:G.returned.toLocaleString(`en-US`)}),` of`,` `,(0,b.jsx)(`span`,{className:`tabular-nums text-muted`,children:G.total.toLocaleString(`en-US`)}),` rows`]}):null,` `,`· `,ke]})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsxs)(`span`,{className:`inline-flex items-center text-secondary`,children:[(0,b.jsxs)(`select`,{"aria-label":`Filter by identity`,value:_,onChange:e=>v(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:[(0,b.jsx)(`option`,{value:``,children:`All identities`}),He.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))]}),(0,b.jsx)(p,{text:`The specific bot or AI product making the request (e.g., GPTBot, ChatGPT-User, Perplexity). One operator usually runs several identities.`})]}),(0,b.jsxs)(`span`,{className:`inline-flex items-center text-secondary`,children:[(0,b.jsxs)(`select`,{"aria-label":`Filter by operator`,value:y,onChange:e=>E(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:[(0,b.jsx)(`option`,{value:``,children:`All operators`}),Ue.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))]}),(0,b.jsx)(p,{text:`The company that runs the bot or product (e.g., OpenAI, Anthropic, Perplexity). Filtering by operator includes every identity under that company.`})]}),(0,b.jsx)(`select`,{"aria-label":`Filter by HTTP status class`,value:N,onChange:e=>P(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:Ce.map(e=>(0,b.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,b.jsx)(`select`,{"aria-label":`Filter by verification claim`,value:F,onChange:e=>I(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:we.map(e=>(0,b.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,b.jsx)(`input`,{type:`search`,"aria-label":`Filter by path`,placeholder:`path contains…`,value:D,onChange:e=>k(e.target.value),className:`w-44 rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong placeholder:text-faint focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`})]})]}),Xe?(0,b.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,children:[Z?(0,b.jsx)(A,{label:`Bucket: ${Z}`,onClear:()=>g(null)}):null,_?(0,b.jsx)(A,{label:`Identity: ${_}`,onClear:()=>v(``)}):null,y?(0,b.jsx)(A,{label:`Operator: ${y}`,onClear:()=>E(``)}):null,D.trim()?(0,b.jsx)(A,{label:`Path: ${D.trim()}`,onClear:()=>k(``)}):null,N===`all`?null:(0,b.jsx)(A,{label:`Status: ${N}`,onClear:()=>P(`all`)}),F===`all`?null:(0,b.jsx)(A,{label:`Claim: ${Pe(F)}`,onClear:()=>I(`all`)}),(0,b.jsx)(`button`,{type:`button`,onClick:Ye,className:`text-button-14 text-muted underline-offset-4 hover:text-strong hover:underline`,children:`Clear all`})]}):null,(0,b.jsx)(Fe,{events:We,truncated:G?.truncated??!1}),Ge?(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 text-label-12 text-secondary`,children:[(0,b.jsxs)(`p`,{className:`tabular-nums`,children:[`Showing `,(0,b.jsx)(`span`,{className:`text-neutral`,children:Ke.toLocaleString(`en-US`)}),`–`,(0,b.jsx)(`span`,{className:`text-neutral`,children:qe.toLocaleString(`en-US`)}),` of`,` `,(0,b.jsx)(`span`,{className:`text-neutral`,children:q.length.toLocaleString(`en-US`)}),` events`]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>L(e=>Math.max(1,e-1)),disabled:Y<=1,"aria-label":`Previous page`,className:`inline-flex items-center gap-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-strong transition hover:border-strong hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-base disabled:hover:text-strong`,children:[(0,b.jsx)(n,{className:`size-3.5`}),`Prev`]}),(0,b.jsxs)(`span`,{className:`tabular-nums`,children:[`Page `,(0,b.jsx)(`span`,{className:`text-strong`,children:Y}),` of`,` `,(0,b.jsx)(`span`,{className:`text-strong`,children:J})]}),(0,b.jsxs)(`button`,{type:`button`,onClick:()=>L(e=>Math.min(J,e+1)),disabled:Y>=J,"aria-label":`Next page`,className:`inline-flex items-center gap-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-strong transition hover:border-strong hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-base disabled:hover:text-strong`,children:[`Next`,(0,b.jsx)(t,{className:`size-3.5`})]})]})]}):null]}),(0,b.jsxs)(`details`,{className:`border-t border-default pt-4`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer text-label-14 text-secondary hover:text-strong`,children:`How traffic is classified`}),(0,b.jsx)(`p`,{className:`mt-2 max-w-3xl text-copy-14 text-secondary`,children:`Crawler requests, AI user fetches, and referrals are recorded separately. Filters expose the underlying evidence.`})]})]})}function Me(e,t){return t===`day`?D(e):E(e)}function Ne(e,t){return e.map(e=>({bucket:e.bucket,label:Me(e.bucket,t),crawler:e.crawlerHits,aiUserFetch:e.aiUserFetchHits,aiReferral:e.aiReferralLandedHits}))}function Pe(e){return we.find(t=>t.value===e)?.label??e}function A({label:e,onClear:t}){return(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded border border-strong bg-surface-inset px-2.5 py-1 text-label-14 text-strong`,children:[e,(0,b.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Clear ${e}`,className:`rounded p-0.5 text-secondary hover:bg-mono-700/60 hover:text-heading`,children:(0,b.jsx)(a,{className:`size-3`})})]})}function j({label:e,color:t,count:n,active:r,onToggle:i}){return(0,b.jsxs)(`button`,{type:`button`,onClick:i,"aria-pressed":r,className:`inline-flex items-center gap-2 rounded border px-3 py-1.5 text-button-14 transition ${r?`border-strong bg-surface-inset text-heading`:`border-base bg-transparent text-muted hover:text-neutral`}`,children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-3 items-center justify-center rounded-sm border transition-opacity ${r?`border-transparent opacity-100`:`border-strong opacity-60`}`,style:r?{backgroundColor:t}:void 0,children:r?`✓`:``}),(0,b.jsx)(`span`,{children:e}),(0,b.jsx)(`span`,{className:`tabular-nums ${r?`text-secondary`:`text-faint`}`,children:n.toLocaleString(`en-US`)})]})}function M({label:e,value:t,tooltip:n}){return(0,b.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,b.jsxs)(`p`,{className:`flex items-center gap-1 text-copy-14 text-secondary`,children:[e,n?(0,b.jsx)(p,{text:n}):null]}),(0,b.jsx)(`p`,{className:`mt-1 text-copy-24-strong tabular-nums text-heading`,children:t.toLocaleString(`en-US`)})]})}function N(e){switch(e){case u.crawler:return`Crawler`;case u[`ai-user-fetch`]:return`AI hit`;case u[`ai-referral`]:return`AI referral`}}function P(e){switch(e.kind){case u.crawler:case u[`ai-user-fetch`]:return e.botId;case u[`ai-referral`]:return e.product}}function F(e){switch(e.kind){case u.crawler:case u[`ai-user-fetch`]:return`${e.verificationStatus} · HTTP ${e.status}`;case u[`ai-referral`]:return`${e.evidenceType} · ${e.sourceDomain}`}}function Fe({events:e,truncated:t=!1}){return e.length===0?(0,b.jsx)(m,{className:`p-6 text-center text-label-14 text-muted`,children:t?`No matches in the rows loaded so far. More rows exist beyond the load limit, so narrow the time window to search them.`:`No event rows match the current filters.`}):(0,b.jsx)(`div`,{className:`material-base overflow-hidden`,children:(0,b.jsxs)(`table`,{className:`w-full text-label-14`,children:[(0,b.jsx)(`thead`,{className:`bg-bg-elevated/50 text-label-12-strong normal-case text-muted`,children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Hour`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Kind`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Identity`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Evidence / status`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Path`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-right`,children:(0,b.jsxs)(`span`,{className:`inline-flex items-center`,children:[`Hits`,(0,b.jsx)(p,{text:`Each row is one hour-bucket, not one request. Hits is the number of requests in that hour that shared the same identity, path, HTTP status, and verification claim.`})]})})]})}),(0,b.jsx)(`tbody`,{className:`divide-y divide-mono-800/60`,children:e.map((e,t)=>(0,b.jsxs)(`tr`,{className:`hover:bg-bg-elevated/40 transition-colors`,children:[(0,b.jsx)(`td`,{className:`px-4 py-2 text-label-12-mono text-neutral`,children:E(e.tsHour)}),(0,b.jsx)(`td`,{className:`px-4 py-2 text-neutral`,children:N(e.kind)}),(0,b.jsxs)(`td`,{className:`px-4 py-2 text-heading`,children:[P(e),(0,b.jsx)(`span`,{className:`ml-2 text-label-12 text-muted`,children:e.operator})]}),(0,b.jsx)(`td`,{className:`px-4 py-2 text-neutral`,children:F(e)}),(0,b.jsx)(`td`,{className:`px-4 py-2 truncate text-label-12-mono text-neutral`,children:_(e)}),(0,b.jsx)(`td`,{className:`px-4 py-2 text-right tabular-nums text-heading`,children:e.hits})]},`${e.kind}:${e.tsHour}:${t}`))})]})})}export{Fe as EventsTable,M as TrafficKpi,k as TrafficSourceDetailPage,O as trafficFetchKind};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{ct as t}from"./vendor-lucide-Bo69m9KC.js";import{r as n}from"./vendor-markdown-BiRP51B0.js";import"./ToneBadge-ht0n6RUH.js";var r=e(t(),1),i=n(),a={account:null,canWrite:!0,isAdmin:!0},o={account:null,canWrite:!1,isAdmin:!1};function s(e){let t=e.scopes.includes(`*`);return{account:null,canWrite:!e.readOnly&&t,isAdmin:e.projectId===null&&e.scopes.includes(`*`)}}var c=(0,r.createContext)(a);function l({account:e,apiKey:t,apiKeyPending:n=!1,children:r}){let l=n?o:t?s(t):e?{account:e,canWrite:e.role===`admin`,isAdmin:e.role===`admin`}:a;return(0,i.jsx)(c.Provider,{value:l,children:r})}function u(){return(0,r.useContext)(c)}var d=`View only — your account cannot change this.`;export{d as n,u as r,l as t};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{ct as t}from"./vendor-lucide-Bo69m9KC.js";import{r as n}from"./vendor-markdown-BiRP51B0.js";import"./ToneBadge-COrS2zpP.js";var r=e(t(),1),i=n(),a={account:null,canWrite:!0,isAdmin:!0},o={account:null,canWrite:!1,isAdmin:!1};function s(e){let t=e.scopes.includes(`*`);return{account:null,canWrite:!e.readOnly&&t,isAdmin:e.projectId===null&&e.scopes.includes(`*`)}}var c=(0,r.createContext)(a);function l({account:e,apiKey:t,apiKeyPending:n=!1,children:r}){let l=n?o:t?s(t):e?{account:e,canWrite:e.role===`admin`,isAdmin:e.role===`admin`}:a;return(0,i.jsx)(c.Provider,{value:l,children:r})}function u(){return(0,r.useContext)(c)}var d=`View only — your account cannot change this.`;export{d as n,u as r,l as t};
@@ -1 +1 @@
1
- import{br as e,xr as t}from"./ToneBadge-ht0n6RUH.js";var n={[e.verified]:`Verified`,[e.likely_real]:`Likely real`,[e.unknown]:`Unknown`};function r(e,n){switch(e){case t[`ip-in-published-list`]:return`IP on ${n}'s published list`;case t[`ip-outside-published-list`]:return`IP not on ${n}'s published list`;case t[`no-ip`]:return`Source gives no IP to check`;case t[`no-published-list`]:return`${n} publishes no IP list`;case t[`documented-user-agent`]:return`User agent matches ${n}'s published one`;case t[`unusual-user-agent`]:return`User agent differs from ${n}'s published one`;case t[`scanner-path`]:return`Asked for a secret or admin file`;case t[`scanner-burst`]:return`Same IP asked for secret files`}}var i=`Bots posing as an AI assistant, such as scanners looking for secret files.`;function a(e){return e===0?`No fake agent requests in this period.`:`Excludes ${e.toLocaleString(`en-US`)} fake ${e===1?`request`:`requests`} from bots posing as an AI assistant.`}export{r as i,n,a as r,i as t};
1
+ import{br as e,xr as t}from"./ToneBadge-COrS2zpP.js";var n={[e.verified]:`Verified`,[e.likely_real]:`Likely real`,[e.unknown]:`Unknown`};function r(e,n){switch(e){case t[`ip-in-published-list`]:return`IP on ${n}'s published list`;case t[`ip-outside-published-list`]:return`IP not on ${n}'s published list`;case t[`no-ip`]:return`Source gives no IP to check`;case t[`no-published-list`]:return`${n} publishes no IP list`;case t[`documented-user-agent`]:return`User agent matches ${n}'s published one`;case t[`unusual-user-agent`]:return`User agent differs from ${n}'s published one`;case t[`scanner-path`]:return`Asked for a secret or admin file`;case t[`scanner-burst`]:return`Same IP asked for secret files`}}var i=`Bots posing as an AI assistant, such as scanners looking for secret files.`;function a(e){return e===0?`No fake agent requests in this period.`:`Excludes ${e.toLocaleString(`en-US`)} fake ${e===1?`request`:`requests`} from bots posing as an AI assistant.`}export{r as i,n,a as r,i as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{ct as t}from"./vendor-lucide-Bo69m9KC.js";import{r as n}from"./vendor-markdown-BiRP51B0.js";import{i as r}from"./ToneBadge-ht0n6RUH.js";var i=e(t(),1),a=n(),o=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`material-base`,e),...t}));o.displayName=`Card`;var s=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`flex flex-col gap-1.5 p-5`,e),...t}));s.displayName=`CardHeader`;var c=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`h3`,{ref:n,className:r(`text-heading-16 text-primary`,e),...t}));c.displayName=`CardTitle`;var l=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`p`,{ref:n,className:r(`text-copy-14 text-secondary`,e),...t}));l.displayName=`CardDescription`;var u=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`p-5 pt-0`,e),...t}));u.displayName=`CardContent`;export{c as a,s as i,u as n,l as r,o as t};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{ct as t}from"./vendor-lucide-Bo69m9KC.js";import{r as n}from"./vendor-markdown-BiRP51B0.js";import{i as r}from"./ToneBadge-COrS2zpP.js";var i=e(t(),1),a=n(),o=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`material-base`,e),...t}));o.displayName=`Card`;var s=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`flex flex-col gap-1.5 p-5`,e),...t}));s.displayName=`CardHeader`;var c=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`h3`,{ref:n,className:r(`text-heading-16 text-primary`,e),...t}));c.displayName=`CardTitle`;var l=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`p`,{ref:n,className:r(`text-copy-14 text-secondary`,e),...t}));l.displayName=`CardDescription`;var u=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`p-5 pt-0`,e),...t}));u.displayName=`CardContent`;export{c as a,s as i,u as n,l as r,o as t};
@@ -1,3 +1,3 @@
1
- import{Ai as e,Ki as t}from"./ToneBadge-ht0n6RUH.js";var n={ambiguous:`Property identity unverified`},r=`No answer could be tied to one property`;function i(e){return e.denominator===null||e.denominator===void 0||e.unattributed===void 0||e.unattributed<=0?null:`${e.unattributed} of ${e.denominator+e.unattributed} answers could not be tied to one property`}function a(e){if(e.denominator===null||e.denominator===void 0||e.unchecked===void 0||e.unchecked<=0)return null;let t=e.denominator+e.unchecked;return`${e.unchecked} of ${t} ${t===1?`answer`:`answers`} had sources that could not be checked`}var o=function(e){return e.Clicks=`clicks`,e.Impressions=`impressions`,e.CTR=`ctr`,e.Position=`position`,e}({}),s={clicks:`Clicks`,impressions:`Impressions`,ctr:`CTR`,position:`Position`},c=e;function l(e){return e.endsWith(`%`)?{figure:e.slice(0,-1),sign:`%`}:{figure:e,sign:``}}function u(e,t){return t===`cited`?a(e):i(e)}function d(e,t){let n=u(e,t),r=t===`cited`?e.unchecked:e.unattributed;if(n===null||r===void 0)return null;let i=`${r} ${t===`cited`?`unchecked`:`unattributed`}`;return{label:i,text:`${i}. ${n}, so this rate leaves ${r===1?`it`:`them`} out.`}}function f(e,n){let r=t(e);switch(n){case`cited`:return`${r} cited (any page)`;case`emerging`:return`${r} newly cited (any page)`;case`lost`:return`${r} citation lost (any page)`;case`not-cited`:return`${r} not cited (any page)`;case`pending`:return`Pending`}}function p(e){let t=[];if(e.message&&t.push(e.message),e.providers)for(let[n,r]of Object.entries(e.providers)){let e=`[${n}] ${r.message}`;r.raw===void 0?t.push(e):t.push(`${e}\n\n${JSON.stringify(r.raw,null,2)}`)}return t.length>0?t.join(`
1
+ import{Ai as e,Ki as t}from"./ToneBadge-COrS2zpP.js";var n={ambiguous:`Property identity unverified`},r=`No answer could be tied to one property`;function i(e){return e.denominator===null||e.denominator===void 0||e.unattributed===void 0||e.unattributed<=0?null:`${e.unattributed} of ${e.denominator+e.unattributed} answers could not be tied to one property`}function a(e){if(e.denominator===null||e.denominator===void 0||e.unchecked===void 0||e.unchecked<=0)return null;let t=e.denominator+e.unchecked;return`${e.unchecked} of ${t} ${t===1?`answer`:`answers`} had sources that could not be checked`}var o=function(e){return e.Clicks=`clicks`,e.Impressions=`impressions`,e.CTR=`ctr`,e.Position=`position`,e}({}),s={clicks:`Clicks`,impressions:`Impressions`,ctr:`CTR`,position:`Position`},c=e;function l(e){return e.endsWith(`%`)?{figure:e.slice(0,-1),sign:`%`}:{figure:e,sign:``}}function u(e,t){return t===`cited`?a(e):i(e)}function d(e,t){let n=u(e,t),r=t===`cited`?e.unchecked:e.unattributed;if(n===null||r===void 0)return null;let i=`${r} ${t===`cited`?`unchecked`:`unattributed`}`;return{label:i,text:`${i}. ${n}, so this rate leaves ${r===1?`it`:`them`} out.`}}function f(e,n){let r=t(e);switch(n){case`cited`:return`${r} cited (any page)`;case`emerging`:return`${r} newly cited (any page)`;case`lost`:return`${r} citation lost (any page)`;case`not-cited`:return`${r} not cited (any page)`;case`pending`:return`Pending`}}function p(e){let t=[];if(e.message&&t.push(e.message),e.providers)for(let[n,r]of Object.entries(e.providers)){let e=`[${n}] ${r.message}`;r.raw===void 0?t.push(e):t.push(`${e}\n\n${JSON.stringify(r.raw,null,2)}`)}return t.length>0?t.join(`
2
2
 
3
3
  `):`Run failed.`}function m(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function h(e,t,n=new Date){let r=new Date(e);if(Number.isNaN(r.getTime()))return e;let i=r.toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`});return t&&new Date(t).toDateString()===r.toDateString()?i:`${g(e,n)}, ${i}`}function g(e,t=new Date){let n=new Date(e);return Number.isNaN(n.getTime())?e:n.getFullYear()===t.getFullYear()?_(e):n.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}function _(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function v(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function y(e){return e===null?`Unknown`:e?`Pass`:`Fail`}function b(e){return e===0?`12:00 AM`:e<12?`${e}:00 AM`:e===12?`12:00 PM`:`${e-12}:00 PM`}function x(e,t){return e===`twice-daily`?`twice-daily`:e.startsWith(`weekly@`)?`${e}@${t}`:`daily@${t}`}function S(e,t){if(!e)return{freq:`custom`,hour:6,customCron:t};if(e===`twice-daily`)return{freq:`twice-daily`,hour:6,customCron:``};let n=e.match(/^daily(?:@(\d+))?$/);if(n)return{freq:`daily`,hour:n[1]?parseInt(n[1]):6,customCron:``};let r=e.match(/^(weekly@(?:mon|tue|wed|thu|fri|sat|sun))(?:@(\d+))?$/);return r?{freq:r[1],hour:r[2]?parseInt(r[2]):6,customCron:``}:{freq:`custom`,hour:6,customCron:t}}function C(e,t,n){let r=n===`UTC`?`UTC`:n.split(`/`).pop()?.replace(/_/g,` `)??n;if(!e)return`Custom: ${t} · ${r}`;if(e===`twice-daily`)return`Twice a day (6am & 6pm) · ${r}`;let i=e.match(/^daily(?:@(\d+))?$/);if(i)return`Every day at ${b(i[1]?parseInt(i[1]):6)} · ${r}`;let a=e.match(/^weekly@(mon|tue|wed|thu|fri|sat|sun)(?:@(\d+))?$/);if(a){let e={mon:`Monday`,tue:`Tuesday`,wed:`Wednesday`,thu:`Thursday`,fri:`Friday`,sat:`Saturday`,sun:`Sunday`},t=a[2]?parseInt(a[2]):6;return`Every ${e[a[1]]} at ${b(t)} · ${r}`}return`${e} · ${r}`}function w(e,t){return t&&t!==e?`${e} · ${t}`:e}function T(){let e=Intl.DateTimeFormat().resolvedOptions().timeZone,t=new Intl.DateTimeFormat(`en-US`,{timeZoneName:`short`}).formatToParts().find(e=>e.type===`timeZoneName`)?.value;return w(e,t)}export{c as _,y as a,n as b,_ as c,v as d,T as f,l as g,f as h,d as i,g as l,C as m,o as n,p as o,S as p,x as r,b as s,s as t,h as u,m as v,r as y};