@canonry/canonry 7.87.2 → 7.88.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 (134) hide show
  1. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +31 -5
  2. package/assets/assets/{AgentSetupPage-_ZP3F_zA.js → AgentSetupPage-DV06oPTd.js} +1 -1
  3. package/assets/assets/{AuditHistoryPanel-9B0XpYsN.js → AuditHistoryPanel-C1JnxBFK.js} +1 -1
  4. package/assets/assets/{BacklinksPage-CsvVgXTZ.js → BacklinksPage-Dw0wgYlg.js} +1 -1
  5. package/assets/assets/{HistoryPage-BCxpCul0.js → HistoryPage-DsDx15am.js} +1 -1
  6. package/assets/assets/{MeasurementPropertyPage-BObvWjVx.js → MeasurementPropertyPage-Bkxt3QcY.js} +1 -1
  7. package/assets/assets/{ProjectPage-y378tOaT.js → ProjectPage-CzrD1lpf.js} +1 -1
  8. package/assets/assets/{RunsPage-CfQ_kqlu.js → RunsPage-BggqKbOG.js} +1 -1
  9. package/assets/assets/{SettingsPage-PIgRvqJc.js → SettingsPage-B7ns_ECx.js} +1 -1
  10. package/assets/assets/{SiteHealthSection-DuUE1cB0.js → SiteHealthSection-B2YibqCs.js} +2 -2
  11. package/assets/assets/{ToneBadge-BgTLSTKp.js → ToneBadge-B8hKcr8p.js} +1 -1
  12. package/assets/assets/{TrafficPage-B_YunwjH.js → TrafficPage-DRTbgzKI.js} +1 -1
  13. package/assets/assets/{TrafficSourceDetailPage-C51W87fU.js → TrafficSourceDetailPage-sgLE2gdJ.js} +1 -1
  14. package/assets/assets/{account-context-CVjb3ZSn.js → account-context-pzV-boTi.js} +1 -1
  15. package/assets/assets/{agent-trust-copy-BlpC8jo5.js → agent-trust-copy-DBtiOpFu.js} +1 -1
  16. package/assets/assets/{card-BnVez9nG.js → card-Mu_5i5fM.js} +1 -1
  17. package/assets/assets/{extract-error-message-Dqirbrl0.js → extract-error-message-D_ptq0tW.js} +1 -1
  18. package/assets/assets/{format-helpers-DVXZD864.js → format-helpers-C8QYorwm.js} +1 -1
  19. package/assets/assets/{index-CsvEqhK4.js → index-fN5qDR8H.js} +6 -6
  20. package/assets/assets/{query-client-CVc7wMKJ.js → query-client-CdG4DC3B.js} +1 -1
  21. package/assets/assets/{react-query-CSlTSOjz.js → react-query-CxeygwoL.js} +1 -1
  22. package/assets/assets/{react-sigma_core.esm.min-CVfGIEIE.js → react-sigma_core.esm.min-BfnfPCis.js} +1 -1
  23. package/assets/assets/{service-BGqeyqhZ.js → service-B85wjZQP.js} +1 -1
  24. package/assets/index.html +7 -7
  25. package/dist/{ads-ZUZWSIBV.js → ads-4TAIMWZC.js} +3 -3
  26. package/dist/{agent-YDS3WY7B.js → agent-C7NKP2TO.js} +7 -7
  27. package/dist/{agent-ask-7VUPXTXL.js → agent-ask-EPH5FDM6.js} +3 -3
  28. package/dist/{agent-conversations-WPEBK3BS.js → agent-conversations-LPBBVRKK.js} +3 -3
  29. package/dist/{agent-journeys-H5CCYLNB.js → agent-journeys-MBORINJA.js} +3 -3
  30. package/dist/{agent-memory-CNPKPIWD.js → agent-memory-NJIZO75R.js} +3 -3
  31. package/dist/{agent-providers-U7FLJO5I.js → agent-providers-ZQVUOCX6.js} +3 -3
  32. package/dist/{agent-transcript-VY3BQNPU.js → agent-transcript-67HFY5GT.js} +3 -3
  33. package/dist/{analytics-PYUNO7C2.js → analytics-TUO6BVB6.js} +3 -3
  34. package/dist/{apply-YNBEYC2G.js → apply-V7A5O7YS.js} +3 -3
  35. package/dist/{backfill-6AYHWEQX.js → backfill-PGKYR6NA.js} +10 -10
  36. package/dist/{backlinks-LVHZ2MQ7.js → backlinks-5GGPQNR4.js} +3 -3
  37. package/dist/bing-PQOLIW2X.js +759 -0
  38. package/dist/{bootstrap-27NOBWTP.js → bootstrap-IH3XX6PI.js} +10 -10
  39. package/dist/{cdp-HCYY4SXR.js → cdp-B3PFQ5RB.js} +7 -7
  40. package/dist/{chunk-TFB2S6TQ.js → chunk-2KL2XHS6.js} +4 -4
  41. package/dist/{chunk-DOPUEXMC.js → chunk-4A4X7VXE.js} +2 -2
  42. package/dist/{chunk-2AXFKYJU.js → chunk-4T2VZPDG.js} +2 -2
  43. package/dist/{chunk-AI75KS7G.js → chunk-4VMHN5LL.js} +2497 -1577
  44. package/dist/{chunk-2FJB3CSS.js → chunk-5KDJJO2N.js} +1 -1
  45. package/dist/{chunk-BJHHD7VE.js → chunk-5WWEZ26Y.js} +2 -2
  46. package/dist/{chunk-ZCNKGBIV.js → chunk-6DIDDYG6.js} +5 -5
  47. package/dist/{chunk-IBGZ6D6R.js → chunk-BDLC3DFM.js} +2 -2
  48. package/dist/{chunk-IK7QEKKD.js → chunk-CYQCO5NY.js} +1 -1
  49. package/dist/{chunk-FAMCDCVK.js → chunk-D354CQ6T.js} +1 -1
  50. package/dist/{chunk-3KK6FWDF.js → chunk-DILCH7RL.js} +1 -1
  51. package/dist/{chunk-IVGVPPQT.js → chunk-DVWAA3ES.js} +1088 -646
  52. package/dist/{chunk-T2MGGW6Y.js → chunk-E4DUE2PW.js} +6 -6
  53. package/dist/{chunk-TEQF4ZJA.js → chunk-EGUJNHAZ.js} +162 -2
  54. package/dist/{chunk-JDTKG7KJ.js → chunk-EL4HRIID.js} +3 -3
  55. package/dist/{chunk-LYTBHEID.js → chunk-EYSQMZ6L.js} +530 -342
  56. package/dist/{chunk-MNLAIB67.js → chunk-FL76YWYN.js} +1 -1
  57. package/dist/{chunk-INH773FB.js → chunk-FLJVGHTQ.js} +3 -3
  58. package/dist/{chunk-4LNZTL7M.js → chunk-FNQFM3TK.js} +3 -3
  59. package/dist/{chunk-GBWCEOZR.js → chunk-IPOYH4WE.js} +1 -1
  60. package/dist/{chunk-POMLL2OZ.js → chunk-IR3MYKIA.js} +1 -1
  61. package/dist/{chunk-IE4D47JE.js → chunk-LBZYPZAA.js} +7 -7
  62. package/dist/{chunk-4FWDITQG.js → chunk-MCQK432C.js} +1 -1
  63. package/dist/{chunk-CBWGUGME.js → chunk-MEN27RAJ.js} +18 -2
  64. package/dist/{chunk-BVJA3TV2.js → chunk-N6AWKBLY.js} +5 -5
  65. package/dist/{chunk-TN53B5AB.js → chunk-O7OZVZWR.js} +210 -3
  66. package/dist/{chunk-6F5ULQDY.js → chunk-OKLDBQYW.js} +4 -4
  67. package/dist/{chunk-ZJVQ72VC.js → chunk-PBOIN52J.js} +2 -2
  68. package/dist/{chunk-GXTCDNX7.js → chunk-PZLEKWYA.js} +1 -1
  69. package/dist/{chunk-F643WELJ.js → chunk-Q2SJRZA3.js} +297 -5
  70. package/dist/{chunk-ICS2WJ7H.js → chunk-R7K24KY7.js} +3 -3
  71. package/dist/{chunk-3FHBPJ5R.js → chunk-TAQHHXBC.js} +4 -4
  72. package/dist/{chunk-JAYUWQAV.js → chunk-TL52ELES.js} +1 -1
  73. package/dist/{chunk-GDU6IMGB.js → chunk-UVXQQZB5.js} +2 -2
  74. package/dist/{chunk-AYYZ4HKJ.js → chunk-ZQGWB7VJ.js} +230 -1
  75. package/dist/{citations-3EZTHA65.js → citations-J3IGPX4L.js} +3 -3
  76. package/dist/{cli-catalog-CBTM3JKP.js → cli-catalog-2PCRGKPH.js} +3 -3
  77. package/dist/{cli-commands-H7BFVUGC.js → cli-commands-4MUJZCZO.js} +7 -7
  78. package/dist/cli.js +13 -13
  79. package/dist/{competitor-VH4TXJLT.js → competitor-X7Q2AZGL.js} +3 -3
  80. package/dist/{content-TSMNHXJZ.js → content-HTR3PJPX.js} +3 -3
  81. package/dist/{dashboard-KT2ACPI5.js → dashboard-LSO57ZEE.js} +6 -6
  82. package/dist/{demo-LWSLULEZ.js → demo-P25N4SKK.js} +1 -1
  83. package/dist/{demo-server-UENMDVMG.js → demo-server-6Z5XSHFS.js} +12 -12
  84. package/dist/{discover-XTJXTKCI.js → discover-KE6TQPOC.js} +3 -3
  85. package/dist/{discover-eval-IVQI5YEW.js → discover-eval-XKOYGCRW.js} +3 -3
  86. package/dist/{doctor-SJ4SHSQO.js → doctor-RL2J54I3.js} +3 -3
  87. package/dist/{evidence-C6T556YH.js → evidence-CYJ4AKUZ.js} +3 -3
  88. package/dist/{export-cmd-JQZ5ZRSI.js → export-cmd-2YM3PXCW.js} +3 -3
  89. package/dist/{ga-W2WHVRHN.js → ga-XAB66MJO.js} +3 -3
  90. package/dist/{gbp-3AZIV5WF.js → gbp-CDGBLRVV.js} +3 -3
  91. package/dist/{google-3CKWPZT7.js → google-XHCUKQ3J.js} +4 -4
  92. package/dist/{google-marketing-PJBGQYYW.js → google-marketing-ZR6NTWEY.js} +1 -1
  93. package/dist/{health-cmd-4JTQMCXM.js → health-cmd-VS3EIFJD.js} +3 -3
  94. package/dist/{history-TXUJFEO2.js → history-YIGYYNZJ.js} +3 -3
  95. package/dist/index.d.ts +1893 -401
  96. package/dist/index.js +25 -25
  97. package/dist/{init-TF3OPCEC.js → init-ST3BXHQF.js} +12 -12
  98. package/dist/{insights-XZQO4B45.js → insights-KZS6TYYL.js} +3 -3
  99. package/dist/intelligence-service-LCTP5BC7.js +16 -0
  100. package/dist/{journeys-VFIV5JYV.js → journeys-USOPWGW5.js} +3 -3
  101. package/dist/{keys-PV23G4LW.js → keys-XY7LSM3S.js} +3 -3
  102. package/dist/{keyword-D76KBIV5.js → keyword-PKBFHHF5.js} +3 -3
  103. package/dist/{logs-DYDZ6IEJ.js → logs-PROW5TQJ.js} +3 -3
  104. package/dist/{mcp-GAR5LDQD.js → mcp-OQGC62QU.js} +4 -4
  105. package/dist/mcp.js +9 -9
  106. package/dist/{measurement-plan-K24EOGMI.js → measurement-plan-AI4NNBTO.js} +5 -5
  107. package/dist/{notify-XQHMPDQQ.js → notify-6HRPNJZ5.js} +3 -3
  108. package/dist/{organic-evidence-UHHE7AO4.js → organic-evidence-IXCSUGGY.js} +3 -3
  109. package/dist/{overview-AUZ3XRS5.js → overview-2WS3CFHK.js} +4 -4
  110. package/dist/{project-FUCPU2BD.js → project-ENUZG62V.js} +3 -3
  111. package/dist/{query-HRMSXDKL.js → query-WE3ZWTIB.js} +3 -3
  112. package/dist/{research-R23XLZJ3.js → research-DZSD5UZ2.js} +3 -3
  113. package/dist/{results-export-N6IV3KG4.js → results-export-JMUMYNUE.js} +3 -3
  114. package/dist/{run-CJLG5EXH.js → run-QXOO7CRK.js} +4 -4
  115. package/dist/{schedule-IPDCQ2I5.js → schedule-3RJKGUDN.js} +3 -3
  116. package/dist/{search-ZU4AKJ76.js → search-SGS4H7I4.js} +3 -3
  117. package/dist/{serve-LLIUILD2.js → serve-T24QKEUY.js} +26 -26
  118. package/dist/{session-2NQKSF2N.js → session-HPH2A4AZ.js} +13 -13
  119. package/dist/{settings-4FS5NRKP.js → settings-K44RK2TW.js} +3 -3
  120. package/dist/{skills-GSFHACGN.js → skills-HGPPGBXG.js} +2 -2
  121. package/dist/{snapshot-4NUVPDK3.js → snapshot-FEHHQRY3.js} +3 -3
  122. package/dist/{src-JQYZ2TP6.js → src-4PAYI7GE.js} +16 -2
  123. package/dist/{status-ASBLMFP2.js → status-L5HVFWTS.js} +4 -4
  124. package/dist/{technical-aeo-QXHRBGYY.js → technical-aeo-Z43UCW6E.js} +3 -3
  125. package/dist/{telemetry-J2I577I3.js → telemetry-D47SSSG7.js} +4 -4
  126. package/dist/{tools-UPJRW4DN.js → tools-WCWUY2ZJ.js} +11 -11
  127. package/dist/{traffic-GWBZKYR5.js → traffic-5KH62P43.js} +5 -5
  128. package/dist/{trends-YOLCJBNM.js → trends-RMAXZKRO.js} +3 -3
  129. package/dist/{users-LPSCZV3M.js → users-WT54XNEI.js} +3 -3
  130. package/dist/{visibility-stats-JJQTZSSK.js → visibility-stats-HU62U5MA.js} +3 -3
  131. package/dist/{wordpress-4IKDT5KT.js → wordpress-BDAKQ4MU.js} +3 -3
  132. package/package.json +1 -1
  133. package/dist/bing-A2MUG6AV.js +0 -418
  134. package/dist/intelligence-service-LEH5UVIC.js +0 -16
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SiteHealthSection-DuUE1cB0.js","./rolldown-runtime-XKyaHtl9.js","./vendor-lucide-CoTHJwai.js","./vendor-markdown-cQgSk2i0.js","./vendor-tanstack-q5SvZtcv.js","./vendor-recharts-AnNqECZW.js","./vendor-radix-wS8sWIWE.js","./ToneBadge-BgTLSTKp.js","./account-context-CVjb3ZSn.js","./query-client-CVc7wMKJ.js","./react-query-CSlTSOjz.js","./ChartPrimitives-4D5wgAn5.js","./InfoTooltip-DrBIPuSU.js","./card-BnVez9nG.js","./ProjectPage-y378tOaT.js","./format-helpers-DVXZD864.js","./async-handler-Bj3TnIRw.js","./Hint-CfeZmZig.js","./AuditHistoryPanel-9B0XpYsN.js","./service-BGqeyqhZ.js","./extract-error-message-Dqirbrl0.js","./agent-trust-copy-BlpC8jo5.js","./RunsPage-CfQ_kqlu.js","./HistoryPage-BCxpCul0.js","./SettingsPage-PIgRvqJc.js","./AgentSetupPage-_ZP3F_zA.js","./BacklinksPage-CsvVgXTZ.js","./TrafficPage-B_YunwjH.js","./TrafficSourceDetailPage-C51W87fU.js","./MeasurementPropertyPage-BObvWjVx.js"])))=>i.map(i=>d[i]);
2
- import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{A as n,B as r,C as i,D as a,E as o,F as s,H as c,I as l,L as u,M as d,N as f,O as p,P as m,Q as h,S as g,T as _,U as v,X as y,Y as b,Z as x,_ as S,b as C,c as w,et as T,g as E,it as D,j as O,l as k,m as A,n as ee,nt as j,o as te,p as ne,q as M,rt as re,st as ie,t as N,tt as P,u as ae,v as oe,x as se,z as ce}from"./vendor-lucide-CoTHJwai.js";import{a as le,c as ue,i as F,n as de,o as fe,r as I,s as L,t as pe,u as me}from"./vendor-radix-wS8sWIWE.js";import{n as he,r as R,t as ge}from"./vendor-markdown-cQgSk2i0.js";import{E as _e,T as ve,_ as ye,a as be,b as z,c as xe,d as Se,f as Ce,h as we,i as Te,l as B,m as Ee,n as De,o as Oe,r as ke,s as Ae,u as V,x as je}from"./vendor-tanstack-q5SvZtcv.js";import{$ as Me,$i as Ne,$r as Pe,$t as Fe,An as Ie,At as Le,Bi as Re,Bn as ze,Bt as Be,Cn as Ve,Ct as He,D as Ue,Di as H,Dn as We,E as Ge,Ei as U,En as Ke,Et as qe,Fn as Je,Gi as Ye,Gt as Xe,Hi as Ze,Hr as Qe,Hs as $e,In as et,J as tt,Jt as nt,K as rt,Ln as it,M as at,Mn as ot,Mt as st,Nn as ct,O as lt,Oi as ut,Ot as dt,Pi as ft,Pn as pt,Q as mt,Qi as ht,Qr as gt,Qt as _t,Rn as vt,Si as yt,Sn as bt,St as xt,T as St,Ti as Ct,Tn as wt,Tr as Tt,Tt as Et,Ur as Dt,Vi as Ot,Vn as kt,Vr as At,W as jt,Wr as Mt,X as Nt,Xi as Pt,Xt as Ft,Y as It,Yi as Lt,Yt as Rt,Z as zt,Zr as Bt,Zt as Vt,_n as Ht,a as Ut,aa as Wt,at as Gt,bn as Kt,bt as qt,cn as Jt,ct as Yt,d as Xt,dn as Zt,ea as Qt,en as $t,et as en,fi as tn,ft as nn,i as rn,ia as an,in as on,jn as sn,ki as cn,kt as ln,ln as un,lr as dn,mn as fn,mt as W,n as pn,na as mn,nt as hn,oa as gn,ot as _n,pt as vn,qi as yn,qt as bn,r as G,ra as xn,rn as Sn,rt as Cn,si as wn,st as Tn,t as En,ta as Dn,tn as On,tt as kn,u as An,v as jn,vn as Mn,w as Nn,wi as Pn,wn as Fn,wt as In,xi as Ln,xn as Rn,xt as zn,yn as Bn,z as Vn,zi as Hn,zn as Un}from"./ToneBadge-BgTLSTKp.js";import{d as Wn,f as Gn,l as Kn,s as qn,u as Jn,v as Yn,y as Xn}from"./format-helpers-DVXZD864.js";import{n as Zn,r as Qn,t as $n}from"./account-context-CVjb3ZSn.js";import{t as er}from"./async-handler-Bj3TnIRw.js";import{a as tr,c as nr,d as rr,f as ir,i as ar,l as or,m as sr,o as cr,p as lr,r as ur}from"./query-client-CVc7wMKJ.js";import{An as dr,a as fr,an as pr,bt as mr,cn as hr,dn as gr,dt as _r,ft as vr,in as yr,ln as br,lt as xr,on as Sr,r as Cr,sn as wr,un as Tr,ut as Er,yt as Dr}from"./react-query-CSlTSOjz.js";import{h as Or}from"./ChartPrimitives-4D5wgAn5.js";import{t as kr}from"./InfoTooltip-DrBIPuSU.js";import{a as Ar,i as jr,n as Mr,r as Nr,t as Pr}from"./card-BnVez9nG.js";import{t as Fr}from"./vendor-yaml-Y43rmNgW.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Ir=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ee(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ee(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Lr=t(((e,t)=>{t.exports=Ir()})),Rr=t((e=>{var t=Lr(),n=ie(),r=me();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var v=null,y=null;function b(e,t,n){return e===n||e===t&&(v=e,!0)}function x(e,t,n){return e===n?(y=e,!1):e===t&&(y!==null&&(v=e),!0)}function S(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function C(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var w=Object.assign,T=Symbol.for(`react.element`),E=Symbol.for(`react.transitional.element`),D=Symbol.for(`react.portal`),O=Symbol.for(`react.fragment`),k=Symbol.for(`react.strict_mode`),A=Symbol.for(`react.profiler`),ee=Symbol.for(`react.consumer`),j=Symbol.for(`react.context`),te=Symbol.for(`react.forward_ref`),ne=Symbol.for(`react.suspense`),M=Symbol.for(`react.suspense_list`),re=Symbol.for(`react.memo`),N=Symbol.for(`react.lazy`),P=Symbol.for(`react.activity`),ae=Symbol.for(`react.legacy_hidden`),oe=Symbol.for(`react.memo_cache_sentinel`),se=Symbol.for(`react.view_transition`),ce=Symbol.for(`react.recoverable`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var F=Symbol.for(`react.client.reference`);function de(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===F?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case O:return`Fragment`;case A:return`Profiler`;case k:return`StrictMode`;case ne:return`Suspense`;case M:return`SuspenseList`;case P:return`Activity`;case se:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case D:return`Portal`;case j:return e.displayName||`Context`;case ee:return(e._context.displayName||`Context`)+`.Consumer`;case te:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case re:return t=e.displayName||null,t===null?de(e.type)||`Memo`:t;case N:t=e._payload,e=e._init;try{return de(e(t))}catch{}}return null}var fe=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe={pending:!1,data:null,method:null,action:null},he=[],R=-1;function ge(e){return{current:e}}function _e(e){0>R||(e.current=he[R],he[R]=null,R--)}function ve(e,t){R++,he[R]=e.current,e.current=t}var ye=ge(null),be=ge(null),z=ge(null),xe=ge(null);function Se(e,t){switch(ve(z,t),ve(be,e),ve(ye,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}_e(ye),ve(ye,e)}function Ce(){_e(ye),_e(be),_e(z)}function we(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,ve(xe,e)),t=ye.current;var n=dp(t,e.type);t!==n&&(ve(be,e),ve(ye,n))}function Te(e){be.current===e&&(_e(ye),_e(be)),xe.current===e&&(_e(xe),sh._currentValue=pe)}var B,Ee;function De(e){if(B===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);B=t&&t[1]||``,Ee=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SiteHealthSection-B2YibqCs.js","./rolldown-runtime-XKyaHtl9.js","./vendor-lucide-CoTHJwai.js","./vendor-markdown-cQgSk2i0.js","./vendor-tanstack-q5SvZtcv.js","./vendor-recharts-AnNqECZW.js","./vendor-radix-wS8sWIWE.js","./ToneBadge-B8hKcr8p.js","./account-context-pzV-boTi.js","./query-client-CdG4DC3B.js","./react-query-CxeygwoL.js","./ChartPrimitives-4D5wgAn5.js","./InfoTooltip-DrBIPuSU.js","./card-Mu_5i5fM.js","./ProjectPage-CzrD1lpf.js","./format-helpers-C8QYorwm.js","./async-handler-Bj3TnIRw.js","./Hint-CfeZmZig.js","./AuditHistoryPanel-C1JnxBFK.js","./service-B85wjZQP.js","./extract-error-message-D_ptq0tW.js","./agent-trust-copy-DBtiOpFu.js","./RunsPage-BggqKbOG.js","./HistoryPage-DsDx15am.js","./SettingsPage-B7ns_ECx.js","./AgentSetupPage-DV06oPTd.js","./BacklinksPage-Dw0wgYlg.js","./TrafficPage-DRTbgzKI.js","./TrafficSourceDetailPage-sgLE2gdJ.js","./MeasurementPropertyPage-Bkxt3QcY.js"])))=>i.map(i=>d[i]);
2
+ import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{A as n,B as r,C as i,D as a,E as o,F as s,H as c,I as l,L as u,M as d,N as f,O as p,P as m,Q as h,S as g,T as _,U as v,X as y,Y as b,Z as x,_ as S,b as C,c as w,et as T,g as E,it as D,j as O,l as k,m as A,n as ee,nt as j,o as te,p as ne,q as M,rt as re,st as ie,t as N,tt as P,u as ae,v as oe,x as se,z as ce}from"./vendor-lucide-CoTHJwai.js";import{a as le,c as ue,i as F,n as de,o as fe,r as I,s as L,t as pe,u as me}from"./vendor-radix-wS8sWIWE.js";import{n as he,r as R,t as ge}from"./vendor-markdown-cQgSk2i0.js";import{E as _e,T as ve,_ as ye,a as be,b as z,c as xe,d as Se,f as Ce,h as we,i as Te,l as B,m as Ee,n as De,o as Oe,r as ke,s as Ae,u as V,x as je}from"./vendor-tanstack-q5SvZtcv.js";import{$ as Me,$i as Ne,$r as Pe,$t as Fe,An as Ie,At as Le,Bi as Re,Bn as ze,Bt as Be,Cn as Ve,Ct as He,D as Ue,Di as H,Dn as We,E as Ge,Ei as U,En as Ke,Et as qe,Fn as Je,Gi as Ye,Gt as Xe,Hi as Ze,Hr as Qe,Hs as $e,In as et,J as tt,Jt as nt,K as rt,Ln as it,M as at,Mn as ot,Mt as st,Nn as ct,O as lt,Oi as ut,Ot as dt,Pi as ft,Pn as pt,Q as mt,Qi as ht,Qr as gt,Qt as _t,Rn as vt,Si as yt,Sn as bt,St as xt,T as St,Ti as Ct,Tn as wt,Tr as Tt,Tt as Et,Ur as Dt,Vi as Ot,Vn as kt,Vr as At,W as jt,Wr as Mt,X as Nt,Xi as Pt,Xt as Ft,Y as It,Yi as Lt,Yt as Rt,Z as zt,Zr as Bt,Zt as Vt,_n as Ht,a as Ut,aa as Wt,at as Gt,bn as Kt,bt as qt,cn as Jt,ct as Yt,d as Xt,dn as Zt,ea as Qt,en as $t,et as en,fi as tn,ft as nn,i as rn,ia as an,in as on,jn as sn,ki as cn,kt as ln,ln as un,lr as dn,mn as fn,mt as W,n as pn,na as mn,nt as hn,oa as gn,ot as _n,pt as vn,qi as yn,qt as bn,r as G,ra as xn,rn as Sn,rt as Cn,si as wn,st as Tn,t as En,ta as Dn,tn as On,tt as kn,u as An,v as jn,vn as Mn,w as Nn,wi as Pn,wn as Fn,wt as In,xi as Ln,xn as Rn,xt as zn,yn as Bn,z as Vn,zi as Hn,zn as Un}from"./ToneBadge-B8hKcr8p.js";import{d as Wn,f as Gn,l as Kn,s as qn,u as Jn,v as Yn,y as Xn}from"./format-helpers-C8QYorwm.js";import{n as Zn,r as Qn,t as $n}from"./account-context-pzV-boTi.js";import{t as er}from"./async-handler-Bj3TnIRw.js";import{a as tr,c as nr,d as rr,f as ir,i as ar,l as or,m as sr,o as cr,p as lr,r as ur}from"./query-client-CdG4DC3B.js";import{An as dr,a as fr,an as pr,bt as mr,cn as hr,dn as gr,dt as _r,ft as vr,in as yr,ln as br,lt as xr,on as Sr,r as Cr,sn as wr,un as Tr,ut as Er,yt as Dr}from"./react-query-CxeygwoL.js";import{h as Or}from"./ChartPrimitives-4D5wgAn5.js";import{t as kr}from"./InfoTooltip-DrBIPuSU.js";import{a as Ar,i as jr,n as Mr,r as Nr,t as Pr}from"./card-Mu_5i5fM.js";import{t as Fr}from"./vendor-yaml-Y43rmNgW.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Ir=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ee(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ee(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Lr=t(((e,t)=>{t.exports=Ir()})),Rr=t((e=>{var t=Lr(),n=ie(),r=me();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var v=null,y=null;function b(e,t,n){return e===n||e===t&&(v=e,!0)}function x(e,t,n){return e===n?(y=e,!1):e===t&&(y!==null&&(v=e),!0)}function S(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function C(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var w=Object.assign,T=Symbol.for(`react.element`),E=Symbol.for(`react.transitional.element`),D=Symbol.for(`react.portal`),O=Symbol.for(`react.fragment`),k=Symbol.for(`react.strict_mode`),A=Symbol.for(`react.profiler`),ee=Symbol.for(`react.consumer`),j=Symbol.for(`react.context`),te=Symbol.for(`react.forward_ref`),ne=Symbol.for(`react.suspense`),M=Symbol.for(`react.suspense_list`),re=Symbol.for(`react.memo`),N=Symbol.for(`react.lazy`),P=Symbol.for(`react.activity`),ae=Symbol.for(`react.legacy_hidden`),oe=Symbol.for(`react.memo_cache_sentinel`),se=Symbol.for(`react.view_transition`),ce=Symbol.for(`react.recoverable`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var F=Symbol.for(`react.client.reference`);function de(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===F?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case O:return`Fragment`;case A:return`Profiler`;case k:return`StrictMode`;case ne:return`Suspense`;case M:return`SuspenseList`;case P:return`Activity`;case se:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case D:return`Portal`;case j:return e.displayName||`Context`;case ee:return(e._context.displayName||`Context`)+`.Consumer`;case te:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case re:return t=e.displayName||null,t===null?de(e.type)||`Memo`:t;case N:t=e._payload,e=e._init;try{return de(e(t))}catch{}}return null}var fe=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe={pending:!1,data:null,method:null,action:null},he=[],R=-1;function ge(e){return{current:e}}function _e(e){0>R||(e.current=he[R],he[R]=null,R--)}function ve(e,t){R++,he[R]=e.current,e.current=t}var ye=ge(null),be=ge(null),z=ge(null),xe=ge(null);function Se(e,t){switch(ve(z,t),ve(be,e),ve(ye,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}_e(ye),ve(ye,e)}function Ce(){_e(ye),_e(be),_e(z)}function we(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,ve(xe,e)),t=ye.current;var n=dp(t,e.type);t!==n&&(ve(be,e),ve(ye,n))}function Te(e){be.current===e&&(_e(ye),_e(be)),xe.current===e&&(_e(xe),sh._currentValue=pe)}var B,Ee;function De(e){if(B===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);B=t&&t[1]||``,Ee=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+B+e+Ee}var Oe=!1;function ke(e,t){if(!e||Oe)return``;Oe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
5
  `),l=s.split(`
@@ -10,12 +10,12 @@ Error generating stack: `+e.message+`
10
10
  `).replace(Zf,``)}function $f(e,t){return t=Qf(t),Qf(e)===t}function ep(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||an(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&an(e,``+r);else return;break;case`className`:Ut(e,`class`,r);break;case`tabIndex`:Ut(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ut(e,n,r);break;case`style`:cn(e,r,o);return;case`data`:if(t!==`object`){Ut(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=fn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&ep(e,t,`name`,a.name,a,null),ep(e,t,`formEncType`,a.formEncType,a,null),ep(e,t,`formMethod`,a.formMethod,a,null),ep(e,t,`formTarget`,a.formTarget,a,null)):(ep(e,t,`encType`,a.encType,a,null),ep(e,t,`method`,a.method,a,null),ep(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=fn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=W);return;case`onScroll`:r!=null&&$(`scroll`,e);return;case`onScrollEnd`:r!=null&&$(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=fn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:$(`beforetoggle`,e),$(`toggle`,e),Ht(e,`popover`,r);break;case`xlinkActuate`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ht(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=un.get(n)||n,Ht(e,n,r);else return}Bt=!0}function tp(e,t,n,r,a,o){switch(n){case`style`:cn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)an(e,r);else if(typeof r==`number`||typeof r==`bigint`)an(e,``+r);else return;break;case`onScroll`:r!=null&&$(`scroll`,e);return;case`onScrollEnd`:r!=null&&$(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=W);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Nt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[_t]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}Bt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ht(e,n,r)}return}Bt=!0}function np(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ep(e,t,o,s,n,null)}}a&&ep(e,t,`srcSet`,n.srcSet,n,null),r&&ep(e,t,`src`,n.src,n,null);return;case`input`:$(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:ep(e,t,r,d,n,null)}}$t(e,o,c,l,u,s,a,!1);return;case`select`:for(a in $(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:ep(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&tn(e,!!r,n,!0):tn(e,!!r,t,!1);return;case`textarea`:for(s in $(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:ep(e,t,s,c,n,null)}rn(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:ep(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<Rf.length;r++)$(Rf[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ep(e,t,u,r,n,null)}return;default:if(ln(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&tp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&ep(e,t,c,r,n,null))}var rp={};function ip(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||ep(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(Bt=!0),o=m;break;case`name`:m!==f&&(Bt=!0),a=m;break;case`checked`:m!==f&&(Bt=!0),u=m;break;case`defaultChecked`:m!==f&&(Bt=!0),d=m;break;case`value`:m!==f&&(Bt=!0),s=m;break;case`defaultValue`:m!==f&&(Bt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&ep(e,t,p,m,r,f)}}Qt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||ep(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(Bt=!0),p=o;break;case`defaultValue`:o!==l&&(Bt=!0),c=o;break;case`multiple`:o!==l&&(Bt=!0),s=o;default:o!==l&&ep(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?tn(e,!!n,n?[]:``,!1):tn(e,!!n,t,!0)):tn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:ep(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(Bt=!0),p=a;break;case`defaultValue`:a!==o&&(Bt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&ep(e,t,s,a,r,o)}nn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:ep(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(Bt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:ep(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&ep(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:ep(e,t,u,p,r,m)}return;default:if(ln(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&tp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||tp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&ep(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||ep(e,t,f,p,r,m)}function ap(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function op(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&ap(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var sp=null,cp=null;function lp(e){return e.nodeType===9?e:e.ownerDocument}function up(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function dp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function fp(e,t,n,r){return n=lp(n).createElement(e),n[gt]=r,n[_t]=t,np(n,e,t),At(n),n}function pp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var mp=null;function hp(){var e=window.event;return e&&e.type===`popstate`?e!==mp&&(mp=e,!0):(mp=null,!1)}var gp=typeof setTimeout==`function`?setTimeout:void 0,_p=typeof clearTimeout==`function`?clearTimeout:void 0,vp=typeof Promise==`function`?Promise:void 0,yp=typeof requestAnimationFrame==`function`?requestAnimationFrame:gp,bp=typeof queueMicrotask==`function`?queueMicrotask:vp===void 0?gp:function(e){return vp.resolve(null).then(e).catch(xp)};function xp(e){setTimeout(function(){throw e})}function Sp(e){return e===`head`}function Cp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Hh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_m(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_m(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Ct]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_m(e.ownerDocument.body)}n=i}while(n);Hh(t)}function wp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Tp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ep(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Dp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Op(e){return Dp(e.getBoundingClientRect(),getComputedStyle(e),e)}function kp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Dp(t,n,e)}function Ap(e){return e.documentElement.clientHeight}function jp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Mp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Ap(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Xm(f),u>$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Np(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Np.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:w({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Np.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Np.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Pp(e){return{name:e,group:new Np(`group`,e),imagePair:new Np(`image-pair`,e),old:new Np(`old`,e),new:new Np(`new`,e)}}function Fp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Fp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Bp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Rp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),f(this._fragmentFiber.child,!1,Ip,e,s,r)}this._eventListeners=a}};function Ip(e,t,n,r){return _(e).addEventListener(t,n,r),!1}Fp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Bp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Rp(i.optionsOrUseCapture),f(this._fragmentFiber.child,!1,Lp,e,n,i),r.splice(t,1),a!==null&&a()}};function Lp(e,t,n,r){return _(e).removeEventListener(t,n,r),!1}function Rp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function zp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Bp(e,t,n,r){if(e.length===0)return-1;r=zp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&zp(a.optionsOrUseCapture)===r)return i}return-1}Fp.prototype.dispatchEvent=function(e){var t=p(this._fragmentFiber);if(t===null)return!0;t=_(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Fp.prototype.focus=function(e){f(this._fragmentFiber.child,!0,Vp,e,void 0,void 0)};function Vp(e,t){return e.tag!==6&&(e=_(e),pm(e,t))}Fp.prototype.focusLast=function(e){var t=[];f(this._fragmentFiber.child,!0,Hp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Vp(t[n],e);n--);};function Hp(e,t){return t.push(e),!1}Fp.prototype.blur=function(){var e=p(this._fragmentFiber);e!==null&&(e=_(e),e=lp(e).activeElement,e!==null&&f(this._fragmentFiber.child,!1,Up,e,void 0,void 0))};function Up(e,t){return e.tag!==6&&(e=_(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Fp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),f(this._fragmentFiber.child,!1,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag===6||(e=_(e),t.observe(e)),!1}Fp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),f(this._fragmentFiber.child,!1,Gp,e,void 0,void 0);for(var n=t=0;n<Kp.length;n++){var r=Kp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Kp[t++]=r}Kp.length=t}};function Gp(e,t){return e.tag===6||(e=_(e),t.unobserve(e)),!1}var Kp=[],qp=!1;function Jp(e,t,n){Kp.push({fragmentInstance:e,observer:t,instance:n}),qp||(qp=!0,mm(function(){qp=!1;var e=Kp;Kp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Fp.prototype.getClientRects=function(){var e=[];return f(this._fragmentFiber.child,!1,Yp,e,void 0,void 0),e};function Yp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=_(e),t.push.apply(t,e.getClientRects());return!1}Fp.prototype.getRootNode=function(e){var t=p(this._fragmentFiber);return t===null?this:_(t).getRootNode(e)},Fp.prototype.compareDocumentPosition=function(e){var t=p(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];f(this._fragmentFiber.child,!1,Hp,n,void 0,void 0);var r=_(t);if(n.length===0){if(n=r,m(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=h(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=_(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=_(n[0]),i=_(n[n.length-1]);var a=m(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Xp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Xp(e,t,n,r,i){var a=Et(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=p(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=C(n,a,S),t===null?t=!1:(f(t,!0,b,a,n),a=v,v=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=C(r,a,S),t===null?t=!1:(f(t,!0,x,a,r),a=v,y=v=null,t=a!==null)),t):!1}function Zp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Fp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];f(this._fragmentFiber.child,!1,Hp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=h(this._fragmentFiber);if(r=n?r[1]||r[0]||p(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=_(r),Zp(e,n);return}if(r=_(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=_(a),Zp(a,n)):_(a).scrollIntoView(e),r+=n?-1:1}};function Qp(e,t){return e=_(e),$p(e,t),!1}function $p(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function em(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Kp.length;i++){var a=Kp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Kp[r++]=a)}Kp.length=r,n.observe(e)}),$p(e,t))}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Jp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function nm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nm(n),Tt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Ct])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=lm(e.nextSibling),e===null)break}return null}function im(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lm(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lm(e.nextSibling),e===null))return null;return e}function om(e){return e.data===`$?`||e.data===`$~`}function sm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function lm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var um=null;function dm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function fm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function pm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function mm(e){yp(function(){yp(function(t){return e(t)})})}function hm(e,t,n){switch(t=lp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function gm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&ep(e,t,r,null,rp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===W&&(e.onclick=null),Tt(e)}function _m(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Tt(e)}var vm=new Map,ym=new Set;function bm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var xm=L.d;L.d={f:Sm,r:Cm,D:Em,C:Dm,L:Om,m:km,X:jm,S:Am,M:Mm};function Sm(){var e=xm.f(),t=Ld();return e||t}function Cm(e){var t=Dt(e);t!==null&&t.tag===5&&t.type===`form`?Ys(t):xm.r(e)}var wm=typeof document>`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=Zt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),At(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+Zt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Zt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Zt(n.imageSizes)+`"]`)):i+=`[href="`+Zt(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=w({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[wt]=!0,o.onload=o.onerror=function(){jt(o)}),At(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Zt(r)+`"][href="`+Zt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=w({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),At(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=kt(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=w({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);At(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=kt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=w({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),At(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=kt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=w({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),At(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var a=(a=z.current)?bm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=kt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var o=kt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Fm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=vm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,o)),Lm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=kt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Pm(e){return`href="`+Zt(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[wt]){r.loading=1;return}}else t=e.createElement(`link`),t[wt]=!0,t.onload=t.onerror=jt.bind(null,t),np(t,`link`,n),At(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+Zt(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Zt(n.href)+`"]`);if(r)return t.instance=r,At(r),r;var a=w({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),At(r),np(r,`style`,a),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pm(n.href);var o=e.querySelector(Fm(a));if(o)return t.state.loading|=4,t.instance=o,At(o),o;r=Im(n),(a=vm.get(a))&&Hm(r,a),o=(e.ownerDocument||e).createElement(`link`),At(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(o,`link`,r),t.state.loading|=4,Vm(o,n.precedence,e),t.instance=o;case`script`:return o=Rm(n.src),(a=e.querySelector(zm(o)))?(t.instance=a,At(a),a):(r=n,(a=vm.get(o))&&(r=w({},n),Um(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),At(a),np(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wm=null;function Gm(e,t,n){if(Wm===null){var r=new Map,i=Wm=new Map;i.set(n,r)}else i=Wm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Ct]||a[gt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Km(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,At(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),At(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$m===0&&($m=62500*op());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=nh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var sh={$$typeof:j,Provider:null,Consumer:null,_currentValue:pe,_currentValue2:pe,_threadCount:0};function ch(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=at(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=at(0),this.hiddenUpdates=at(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function lh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ch(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=wi(3,null,null,t),e.current=a,a.stateNode=e,t=Ca(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},ao(a),e}function uh(e){return e?(e=Si,e):Si}function dh(e,t,n,r,i,a){i=uh(i),r.context===null?r.context=i:r.pendingContext=i,r=so(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=co(e,r,t),n!==null&&(Md(n,e,t),lo(n,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ph(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function mh(e){if(e.tag===13||e.tag===31){var t=yi(e,67108864);t!==null&&Md(t,e,67108864),ph(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=kd();t=dt(t);var n=yi(e,t);n!==null&&Md(n,e,t),ph(e,t)}}var gh=!0;function _h(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,yh(e,t,n,r)}finally{L.p=a,I.T=i}}function vh(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,yh(e,t,n,r)}finally{L.p=a,I.T=i}}function yh(e,t,n,r){if(gh){var i=bh(r);if(i===null)Gf(e,t,r,xh,n),Mh(e,r);else if(Ph(i,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<jh.indexOf(e)){for(;i!==null;){var a=Dt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=$e(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ke(o);s.entanglements[1]|=c,o&=~c}Tf(a),!(Ju&6)&&(md=Ie()+500,Ef(0,!1))}}break;case 31:case 13:s=yi(a,2),s!==null&&Md(s,a,2),Ld(),ph(a,2)}if(a=bh(r),a===null&&Gf(e,t,r,xh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Gf(e,t,r,null,n)}}function bh(e){return e=mn(e),Sh(e)}var xh=null;function Sh(e){if(xh=null,e=Et(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xh=e,null}function Ch(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Le()){case Re:return 2;case ze:return 8;case Be:case Ve:return 32;case He:return 268435456;default:return 32}default:return 32}}var wh=!1,Th=null,Eh=null,Dh=null,Oh=new Map,kh=new Map,Ah=[],jh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Mh(e,t){switch(e){case`focusin`:case`focusout`:Th=null;break;case`dragenter`:case`dragleave`:Eh=null;break;case`mouseover`:case`mouseout`:Dh=null;break;case`pointerover`:case`pointerout`:Oh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kh.delete(t.pointerId)}}function Nh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Dt(t),t!==null&&mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ph(e,t,n,r,i){switch(t){case`focusin`:return Th=Nh(Th,e,t,n,r,i),!0;case`dragenter`:return Eh=Nh(Eh,e,t,n,r,i),!0;case`mouseover`:return Dh=Nh(Dh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Oh.set(a,Nh(Oh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kh.set(a,Nh(kh.get(a)||null,e,t,n,r,i)),!0}return!1}function Fh(e){var t=Et(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,mt(e.priority,function(){hh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,mt(e.priority,function(){hh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);pn=r,n.target.dispatchEvent(r),pn=null}else return t=Dt(n),t!==null&&mh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ih(e)&&n.delete(t)}function Rh(){wh=!1,Th!==null&&Ih(Th)&&(Th=null),Eh!==null&&Ih(Eh)&&(Eh=null),Dh!==null&&Ih(Dh)&&(Dh=null),Oh.forEach(Lh),kh.forEach(Lh)}function zh(e,n){e.blockedOn===n&&(e.blockedOn=null,wh||(wh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rh)))}var Bh=null;function Vh(e){Bh!==e&&(Bh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bh===e&&(Bh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sh(r||n)===null)continue;break}var a=Dt(n);a!==null&&(e.splice(t,3),t-=3,qs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hh(e){function t(t){return zh(t,e)}Th!==null&&zh(Th,e),Eh!==null&&zh(Eh,e),Dh!==null&&zh(Dh,e),Oh.forEach(t),kh.forEach(t);for(var n=0;n<Ah.length;n++){var r=Ah[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ah.length&&(n=Ah[0],n.blockedOn===null);)Fh(n),n.blockedOn===null&&Ah.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[_t]||null;if(typeof a==`function`)o||Vh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[_t]||null)s=o.formAction;else if(Sh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vh(n)}}}function Uh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Wh(e){this._internalRoot=e}Gh.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;dh(n,kd(),e,t,null,null)},Gh.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dh(e.current,2,null,e,null,null),Ld(),t[vt]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=pt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ah.length&&t!==0&&t<Ah[n].priority;n++);Ah.splice(n,0,e),n===0&&Fh(e)}};var Kh=n.version;if(Kh!==`19.3.1`)throw Error(i(527,Kh,`19.3.1`));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{We=Jh.inject(qh),Ge=Jh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=gc,s=_c,c=vc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=lh(e,1,!1,null,null,n,r,null,o,s,c,Uh),e[vt]=t.current,Uf(e),new Wh(t)}})),zr=t(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Rr()})),K=e(ie(),1),Br=zr();function Vr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Hr(e){if(e?.some(e=>e.trim().toLowerCase()===`report`))return`The report embed tab has been retired. Remove report from the allowed tabs; explicitly configure overview to display AI Visibility.`}function Ur(e){return e.length<4}function Wr(e){return e!==``&&/^[\w./:@%+=,-]+$/.test(e)?e:`'${e.replace(/'/g,`'\\''`)}'`}var q=R(),Gr=(0,K.createContext)({view:null,publish:()=>()=>{}});function Kr({children:e}){let[t,n]=(0,K.useState)(null),r=(0,K.useCallback)(e=>(n(e),()=>n(t=>t===e?null:t)),[]);return(0,q.jsx)(Gr.Provider,{value:(0,K.useMemo)(()=>({view:t,publish:r}),[t,r]),children:e})}function qr(e,t){let{publish:n}=(0,K.useContext)(Gr),r=JSON.stringify(t);(0,K.useEffect)(()=>n({project:e,context:JSON.parse(r)}),[n,e,r])}function Jr(e,t){let{view:n}=(0,K.useContext)(Gr);return n?.project===e&&n.context.view===t.view?n.context:t}function Yr(e){let t=e.replace(/\/+$/,``)||`/`;return t===`/`?`overview`:t===`/projects`?`projects`:t.startsWith(`/projects/`)?`project`:t===`/runs`?`runs`:t===`/traffic`||t.startsWith(`/traffic/`)?`traffic`:t===`/backlinks`?`backlinks`:t===`/settings`?`settings`:t===`/setup`?`setup`:`other`}function Xr(e,t){return!t||t.includes(e)}var Zr=[`overview`,`search-console`,`seo-data`,`local`,`activity`,`backlinks`,`technical-aeo`,`history`,`settings`],Qr=new Set(Zr);function $r(e){if(Hr(e))return[];let t=[...new Set((e??Zr).filter(e=>Qr.has(e)))];return t.length>0?t:[`overview`]}function ei(e){return e?$r(e.projectTabs):void 0}function ti(e,t){return Xr(e,t)||!t?e:t.includes(`overview`)?`overview`:t[0]??`overview`}function ni(e){let t=e?.queries?.limit;return typeof t==`number`&&Number.isInteger(t)&&t>0?t:void 0}function ri(e,t){return e===`client-queries`?ni(t)===void 0?t?ti(`overview`,ei(t)):`queries`:e:ti(e,ei(t))}var ii=`canonry:embed-project-tab`;function ai(e){let t=e.replace(/\/+$/,``);return/^\/projects\/[^/]+\/[a-z-]+$/.test(t)?t:null}function oi(e,t){let n=e.replace(/\/+$/,``);return!t||!/^\/projects\/[^/]+$/.test(n)?null:t.startsWith(`${n}/`)&&ai(t)===t?t:null}function si(){try{return window.sessionStorage.getItem(ii)}catch{return null}}function ci(e){try{e?window.sessionStorage.setItem(ii,e):window.sessionStorage.removeItem(ii)}catch{}}var li={bg:`--canonry-embed-bg`,fg:`--canonry-embed-fg`,accent:`--color-link`},ui=/^(?:#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\([0-9.,%\s/]+\)|hsla?\([0-9.,%\s/a-z]+\))$/i;function di(e){let t=e?.mode?.trim();return t===`light`||t===`dark`?t:void 0}function fi(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e)){let e=Object.hasOwn(li,n)?li[n]:void 0;if(!e||typeof r!=`string`)continue;let i=r.trim();ui.test(i)&&(t[e]=i)}return t}function pi(e){return e.state===`ok`?`positive`:e.state===`checking`||e.state===`disabled`?`neutral`:`negative`}function mi(e){switch(e){case`completed`:return`positive`;case`partial`:return`caution`;case`failed`:return`negative`;case`cancelled`:return`caution`;case`queued`:case`running`:return`neutral`;default:return`neutral`}}function hi(e){switch(e){case`cited`:return`positive`;case`emerging`:return`caution`;case`not-cited`:return`caution`;case`lost`:return`negative`;case`pending`:return`neutral`;default:return`neutral`}}var gi={positive:`text-positive-400`,caution:`text-caution-400`,negative:`text-negative-400`,neutral:`text-secondary`};function _i(e){return e>=50?`positive`:e>=25?`caution`:`negative`}function vi(e){return e.state===`ready`&&Mt(e)}function yi(e){return e.displayName??e.name.charAt(0).toUpperCase()+e.name.slice(1)}function bi(e){let t=[e.detail,e.hint].filter(Boolean);return t.length>0?t.join(`
11
11
  `):void 0}function xi(e,t,n){let r=e.filter(e=>e.id!==`mcp`).map(e=>{if(e.id===`api`)return{...e,tone:pi(t.apiStatus),detail:t.apiStatus.state===`ok`?`Healthy`:`Needs attention`,meta:t.apiStatus.detail};if(e.id===`worker`)return{...e,tone:pi(t.workerStatus),detail:t.workerStatus.state===`ok`?`Healthy`:t.workerStatus.state===`disabled`?`Disabled`:`Needs attention`,meta:t.workerStatus.detail};let r=n.providerStatuses.filter(e=>e.state===`ready`).length,i=n.providerStatuses.length,a=n.providerStatuses.some(vi),o=n.providerStatuses.filter(e=>e.state===`ready`).map(e=>yi(e)).join(` · `);return{...e,label:`Providers`,tone:a?`positive`:`caution`,detail:`${r} of ${i} configured`,meta:o||`None configured`}}),i=t.apiStatus.mcp,a={id:`mcp`,label:`MCP`,tone:`neutral`,detail:`Unknown`,meta:`MCP status is not available from this server.`};return t.apiStatus.state===`checking`?(a.detail=`Checking`,a.meta=`Checking MCP availability.`):t.apiStatus.state===`ok`&&i&&(i.status===`available`?(a.tone=`positive`,a.detail=`Available`,a.meta=`MCP is available for agent connections. This checks the server transport, not an individual client connection.`):i.status===`unavailable`?(a.tone=`negative`,a.detail=`Unavailable`,a.meta=`The MCP transport is not fully available. Contact your Canonry team.`):(a.detail=`Not enabled`,a.meta=`This server does not provide an MCP endpoint.`)),r.splice(Math.max(0,r.findIndex(e=>e.id===`api`)+1),0,a),r}function Si(e,t){if(e.apiStatus.state!==`ok`)return`Launch is blocked until the API responds cleanly.`;if(e.apiStatus.databaseConfigured===!1)return`Launch is blocked until the API has a database connection configured.`;if(e.workerStatus.state!==`ok`)return`Launch is blocked until the worker is healthy and heartbeats are current.`;if(!t.providerStatuses.some(vi))return`Launch is blocked until at least one provider is configured.`}function Ci(e,t,n){let r=Si(t,n),i=structuredClone(e);return i.healthChecks=i.healthChecks.map(e=>{if(e.id===`api`)return{...e,detail:t.apiStatus.detail,state:t.apiStatus.state===`ok`?`ready`:`attention`};if(e.id===`worker`)return{...e,detail:t.workerStatus.detail,state:t.workerStatus.state===`ok`?`ready`:`attention`};let r=n.providerStatuses.some(vi);return{...e,detail:r?`At least one provider configured.`:`No providers configured.`,state:r?`ready`:`attention`}}),i.launchState.enabled=r===void 0,i.launchState.blockedReason=r,i.launchState.summary=r??`Queue an AI Visibility check first, then follow with a Technical AEO audit to explain movement.`,i}var wi=`canonry.run-tracker`,Ti=new Set,Ei=!1,Di=0,Oi={runs:{},batches:{}};function ki(){let e=Pi();for(let t of Ti)t(e)}function Ai(e){if(!e)return{runs:{},batches:{}};try{let t=JSON.parse(e);return{runs:t.runs??{},batches:t.batches??{}}}catch{return{runs:{},batches:{}}}}function ji(){typeof window<`u`&&window.sessionStorage.setItem(wi,JSON.stringify(Oi))}function Mi(){Ei||(Ei=!0,typeof window<`u`&&(Oi=Ai(window.sessionStorage.getItem(wi))))}function Ni(e){Oi=e,ji(),ki()}function Pi(){return Mi(),Oi}function Fi(e){return Mi(),Ti.add(e),()=>{Ti.delete(e)}}function Ii(e){let t=Pi();Ni({...t,runs:{...t.runs,[e.id]:{runId:e.id,projectId:e.projectId,projectLabel:e.projectLabel,kind:e.kind,sourceAction:e.sourceAction,lastAnnouncedStatus:e.lastAnnouncedStatus??`queued`,trackedAt:e.trackedAt??Date.now()}}})}function Li(e){let t=Pi();if(!t.runs[e])return;let{[e]:n,...r}=t.runs;Ni({...t,runs:r})}function Ri(e){let t=Pi(),n=`batch_${Date.now()}_${++Di}`;return Ni({...t,batches:{...t.batches,[n]:{batchId:n,runIds:e.runIds,queuedCount:e.queuedCount,skippedCount:e.skippedCount}}}),n}function zi(e){let t=Pi();if(!t.batches[e])return;let{[e]:n,...r}=t.batches;Ni({...t,batches:r})}function Bi(e){return e===`completed`||e===`partial`||e===`failed`||e===`cancelled`}var Vi=6e5;function Hi(e,t,n,r){return e.filter(e=>!t.has(e.runId)&&n-(e.trackedAt??0)>=r)}function Ui(e,t){let n=0,r=0,i=0,a=0,o=0;for(let s of e){let e=t[s]?.status;e===`completed`?n+=1:e===`partial`?r+=1:e===`failed`?i+=1:e===`cancelled`?a+=1:o+=1}return{completed:n,partial:r,failed:i,cancelled:a,pending:o,finished:o===0}}var Wi=220;function Gi({className:e}){let t=Ue();return(0,q.jsx)(`img`,{className:t?`${e} brand-icon-tile`:e,src:t?`./canonry-icon.svg`:`./favicon.svg`,alt:``,"aria-hidden":`true`})}function Ki({compact:e=!1,version:t,updateAvailable:n,onDismissUpdate:r}){let i=!e&&t&&t!==`unknown`,[a,o]=(0,K.useState)(!1),s=!e&&n&&r;return e?(0,q.jsxs)(V,{to:`/`,className:`brand-lockup brand-lockup-compact`,"aria-label":`Canonry home`,children:[(0,q.jsx)(Gi,{className:`brand-icon`}),(0,q.jsx)(`span`,{className:`brand-copy`,children:(0,q.jsx)(`span`,{className:`brand-mark`,children:`Canonry`})})]}):(0,q.jsxs)(`div`,{className:`brand-lockup brand-lockup-wrapper`,children:[(0,q.jsx)(V,{to:`/`,className:`brand-icon-link`,"aria-label":`Canonry home`,tabIndex:-1,children:(0,q.jsx)(Gi,{className:`brand-icon`})}),(0,q.jsxs)(`div`,{className:`brand-copy`,children:[(0,q.jsx)(V,{to:`/`,className:`brand-mark`,children:`Canonry`}),!s&&i?(0,q.jsxs)(`span`,{className:`brand-version`,children:[`v`,t]}):null]}),s?(0,q.jsxs)(`span`,{className:`brand-update-bubble ${a?`brand-update-bubble-closing`:``}`,role:`status`,"aria-live":`polite`,children:[(0,q.jsxs)(`a`,{className:`brand-update-bubble-link`,href:n.url,target:`_blank`,rel:`noopener noreferrer`,title:`Open release: ${n.upgradeCommand}`,"aria-label":`New version v${n.latest} available — open release page`,children:[(0,q.jsxs)(`span`,{className:`brand-update-bubble-from`,children:[`v`,n.current]}),(0,q.jsx)(D,{className:`brand-update-bubble-arrow size-3`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{className:`brand-update-bubble-to`,children:[`v`,n.latest]})]}),(0,q.jsx)(`button`,{type:`button`,className:`brand-update-bubble-dismiss`,onClick:()=>{o(!0),window.setTimeout(()=>{r?.(),o(!1)},Wi)},"aria-label":`Dismiss update notification for v${n.latest}`,children:(0,q.jsx)(N,{className:`size-3`,"aria-hidden":`true`})})]}):null]})}var qi=`__cited__`,Ji=`__mentioned__`,Yi=`__mentionShare__`;function Xi(e){let t=e,{dataStartDate:n,dataEndDate:r}=t;return typeof n!=`string`||typeof r!=`string`?null:{start:Or(n),end:Or(r),sweepCount:t.sweepCount??1}}function J(e,t=new Date){return Jn(e,t)}function Zi(e,t=new Date){let n=Xi(e);if(!n)return null;let r=J(n.start,t),i=J(n.end,t);return r===i?r:`${r} to ${i}`}function Qi(e,t=new Date){let n=Xi(e),r=Zi(e,t);return!n||!r?`Check date unavailable`:`${r} · ${n.sweepCount} ${n.sweepCount===1?`check`:`checks`}`}function $i(e){let t=Xi(e);return t?Kn(t.start):``}function ea(e){return e.trim().toLowerCase()}function ta(e,t={}){return e.map(e=>{let n=e.trim().toLowerCase(),r=(t[e]??[]).map(e=>e.trim().toLowerCase()).filter(Boolean).sort();return n&&r.length>0?`${n}=${r.join(`|`)}`:n}).filter(Boolean).sort().join(`
12
12
  `)}var na={claude:`Claude`,openai:`OpenAI`,gemini:`Gemini`,perplexity:`Perplexity`,muse:`Muse`,local:`Local`,openrouter:`OpenRouter`};function ra(e,t){let n=t?.find(t=>t.name===e)?.displayName?.trim();if(n)return n;let r=ht(e);return r?`${r} via OpenRouter`:na[ea(e)]??e.charAt(0).toUpperCase()+e.slice(1)}function ia(e){return Math.round(e*1e3)/10}function aa(e){return e.byProvider??{}}function oa(e,t,n){let r=e.buckets.length>0,i=e.buckets.length===1;if(n===`overall`){let n=t===`cited`?qi:Ji,a=t===`cited`?`citationRate`:`mentionRate`;return{rows:e.buckets.map(e=>({date:e.startDate,[n]:ia(e[a])})),series:[n],hasData:r,singleBucket:i}}let a=t===`mentioned`?`mentionRate`:`citationRate`,o=[...new Set(e.buckets.flatMap(e=>Object.keys(aa(e))))].sort();return{rows:e.buckets.map(e=>{let t={date:e.startDate},n=aa(e);for(let e of o){let r=n[e];t[e]=r?ia(r[a]):null}return t}),series:o,hasData:r,singleBucket:i}}function sa(e){let t=e;return Object.hasOwn(t,`modelEvidenceByProvider`)?t.modelEvidenceByProvider??{}:null}function ca(e){let t=e;return Object.hasOwn(t,`modelAttribution`)?t.modelAttribution??{}:null}function la(e){return e.servedModelAttribution??{}}function ua(e){return e.modelServiceMismatch??{}}function da(e){return e.modelPointerChanges??{}}function fa(e){return e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`}function pa(e){switch(e.status){case`known`:return e.model;case`unknown`:return`Unknown model`;case`mixed`:return e.models.length===0?`Unknown model`:`${e.models.join(`, `)}${e.includesUnknown?` and an unknown model`:``}`}}function ma(e){return fa([...e.models,...e.includesUnknown?[`an unknown model`]:[]])}function ha(e){let t=new Map;for(let[n,r]of Object.entries(e))for(let e of r.events){let r=t.get(e.bucketStartDate)??[];r.push({provider:n,event:e}),t.set(e.bucketStartDate,r)}return[...t.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({bucketStartDate:e,events:[...t].sort((e,t)=>e.provider.localeCompare(t.provider)||e.event.observedAt.localeCompare(t.event.observedAt))}))}function ga(e){let t={},n=[];for(let[r,i]of Object.entries(e)){let e=i.events.filter(e=>!e.fromPreWindowAnchor);for(let e of i.events)e.fromPreWindowAnchor&&n.push({provider:r,event:e});e.length>0&&(t[r]={...i,events:e})}return{buckets:ha(t),beforeWindow:n.sort((e,t)=>e.event.observedAt.localeCompare(t.event.observedAt)||e.provider.localeCompare(t.provider))}}function _a(e){let t=[];for(let[n,r]of Object.entries(e)){let e=r.eventTotal??r.events.length;e>r.events.length&&t.push({provider:n,shown:r.events.length,total:e})}return t.sort((e,t)=>e.provider.localeCompare(t.provider))}function va(e){let t=e.buckets.map(e=>{let t=e.mentionShare;return{date:e.startDate,[Yi]:t?.rate==null?null:ia(t.rate)}}),n=t.map(e=>e[Yi]).filter(e=>typeof e==`number`&&Number.isFinite(e));return{rows:t,series:[Yi],hasData:n.length>0,singleBucket:n.length===1}}function ya(e,t,n){return t===`mentionShare`?va(e):oa(e,t,n)}function ba(e,t){if(t===`mentionShare`)return e.buckets.flatMap(e=>{let t=e.mentionShare?.rate;return typeof t==`number`&&Number.isFinite(t)?[t]:[]});let n=t===`cited`?`citationRate`:`mentionRate`;return e.buckets.map(e=>e[n])}function xa(e,t){let n=e.windowChange;if(!n)return null;switch(t){case`cited`:return n.citationRate;case`mentioned`:return n.mentionRate;case`mentionShare`:return n.mentionShare}}function Sa(e,t,n){let r=n===`mentioned`?`mentionRate`:`citationRate`;for(let n=e.buckets.length-1;n>=0;n--){let i=aa(e.buckets[n])[t];if(i)return i[r]}return null}function Y(e){return Date.parse(e)}function Ca(e,t){let n=Xi(e);if(!n)return!1;let r=Y(t);return r>=Y(n.start)&&r<=Y(n.end)}function wa(e){return e.basketChanges??[]}function Ta(e,t){return t.filter(t=>Ca(e,t.at)).sort((e,t)=>Y(e.at)-Y(t.at))}function Ea(e,t){return ea(e)===`perplexity`&&t.status===`known`&&!t.model.includes(`/`)}function Da(e){return Object.entries(e).filter(([e,t])=>!Ea(e,t.configured)).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({provider:e,mismatch:t}))}function Oa(e){return[...wa(e)].sort((e,t)=>Y(t.at)-Y(e.at)).map(e=>({at:Or(e.at),added:e.added,removed:e.removed}))}function ka(e,t){let n=[...e.events].sort((e,t)=>Y(e.observedAt)-Y(t.observedAt)),r=n[0]?.from??e.latestObservation.state;for(let e of n)Y(e.observedAt)<=Y(t)&&(r=e.to);return r}function Aa(e,t,n,r){return{provider:e,at:Or(t.observedAt),onOrBefore:t.fromPreWindowAnchor===!0,anchorAt:t.anchorObservedAt?Or(t.anchorObservedAt):null,from:t.from,to:t.to,served:n,reroute:r}}function ja(e,t){let n=[];for(let[r,i]of Object.entries(e)){let e=t[r]?.events??[],a=new Set(i.events.map(e=>e.observedAt));for(let t of i.events){let i=Ea(r,t.to)?e.find(e=>e.observedAt===t.observedAt):void 0;n.push(Aa(r,t,i?{from:i.from,to:i.to}:null,!1))}for(let t of e)a.has(t.observedAt)||Ea(r,ka(i,t.observedAt))&&n.push(Aa(r,t,null,!0))}return n.sort((e,t)=>Y(t.at)-Y(e.at)||e.provider.localeCompare(t.provider))}function Ma({latest:e,queryChanges:t,modelRows:n,now:r=new Date}){let i=[...t.map(e=>e.at),...n.map(e=>e.at)];if(i.length===0)return null;let a=t=>e!==void 0&&Ca(e,t),o=t.filter(e=>a(e.at)),s=o.reduce((e,t)=>e+t.added.length,0),c=o.reduce((e,t)=>e+t.removed.length,0),l=n.filter(e=>a(e.at)).length,u=e?Zi(e,r):null;if(u===null||s+c+l===0)return`No changes since ${J(i.reduce((e,t)=>Y(t)>Y(e)?t:e),r)}`;let d=[u];return s>0&&d.push(`${s} ${s===1?`query`:`queries`} added`),c>0&&d.push(`${c} ${c===1?`query`:`queries`} removed`),l>0&&d.push(`${l} new ${l===1?`model`:`models`}`),d.join(` · `)}function Na(e,t,n,r=null){let i=Y(e);if(!Number.isFinite(i))return null;let a=t.filter(e=>Y(e)<i);if(a.length>0)return Or(a.reduce((e,t)=>Y(t)>Y(e)?t:e));let o=n.map(e=>Xi(e)).filter(e=>e!==null).sort((e,t)=>Y(e.start)-Y(t.start)),s=o.findIndex(e=>Y(e.start)<=i&&i<=Y(e.end));if(s===-1)return null;let c=o[s];return Y(c.start)===i?s>0?o[s-1].end:r&&Y(r)<i?Or(r):null:c.sweepCount===2&&Y(c.end)===i?c.start:null}function Pa(e){let t=new Map,n=(e,n)=>{let r=t.get(e);r?r.push(n):t.set(e,[n])};for(let t of[...e].sort((e,t)=>e.revision-t.revision)){let e=Y(t.at);for(let r of t.removed)n(r,{at:e,member:!1});for(let r of t.added)n(r,{at:e,member:!0})}return new Map([...t].filter(([,e])=>e.at(-1).member))}function Fa(e,t){let n=!e[0].member;for(let r of e)r.at<=t&&(n=r.member);return n}function Ia(e,t,n){return e.some(e=>e.at>t&&e.at<=n)}function La(e,t){let n=Y(t.start),r=Y(t.end);return t.sweepCount>2?Ia(e,n,r):Fa(e,n)!==Fa(e,r)}function Ra(e,t,n,r){let i=Y(t),a=Y(n),o={added:[],removed:[],removedAndAddedBack:[],addedAndRemovedAgain:[]},s=new Set;for(let[t,n]of Pa(e)){if(!r(n))continue;s.add(t);let e=Fa(n,i),c=Fa(n,a);e===c?(e?o.removedAndAddedBack:o.addedAndRemovedAgain).push(t):(c?o.added:o.removed).push(t)}if(s.size===0)return null;let c=e=>[...e.added,...e.removed].some(e=>s.has(e)),l=e.filter(e=>Y(e.at)>i&&Y(e.at)<=a&&c(e)).sort((e,t)=>Y(e.at)-Y(t.at));return{changes:l,keys:[...new Set(l.flatMap(e=>[...e.added,...e.removed]))].filter(e=>s.has(e)),moves:o}}function za(e,t){if(e.length<2)return null;let n=e[0],r=e.at(-1),i=Xi(n),a=Xi(r),o=i?.start??n.startDate,s=a?.end??r.endDate,c=Ra(t,o,s,e=>Fa(e,Y(o))!==Fa(e,Y(s))||i!==null&&La(e,i)||a!==null&&La(e,a));return!c&&n.queryCount===r.queryCount?null:{...c??{changes:[],keys:[],moves:{added:[],removed:[],removedAndAddedBack:[],addedAndRemovedAgain:[]}},firstCount:n.queryCount,latestCount:r.queryCount}}function Ba(e,t){let n=Xi(e);if(!n)return null;let r=Ra(t,n.start,n.end,e=>La(e,n));return r?{...r,firstCount:e.queryCount,latestCount:e.queryCount}:null}function Va(e){return`${e} ${e===1?`query`:`queries`}`}function Ha(e){let t=[],n=e=>t.length===0?Va(e):String(e);return e.added.length>0&&t.push(`${n(e.added.length)} added`),e.removed.length>0&&t.push(`${n(e.removed.length)} removed`),e.removedAndAddedBack.length>0&&t.push(`${Va(e.removedAndAddedBack.length)} removed and added back`),e.addedAndRemovedAgain.length>0&&t.push(`${Va(e.addedAndRemovedAgain.length)} added and removed again`),fa(t)}function Ua(e,t,n,r){return e?t!==`mentionShare`||n!==`non-brand`||!r?!1:e.keys.length>0&&e.keys.every(e=>r(e)===`branded`):!0}var Wa=new Set([`gemini`,`openai`,`claude`,`perplexity`,`muse`,`local`]);function Ga({provider:e}){let t=Wa.has(e)?`provider-badge--${e}`:`border-neutral bg-neutral-soft text-neutral`;return(0,q.jsx)(`span`,{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-label-12-strong normal-case ${t}`,children:Pt(e)?ra(e):e})}var Ka=`canonry:theme`,qa=(0,K.createContext)(null);function Ja(e){return e===`light`||e===`system`?e:`dark`}function Ya(){try{return Ja(window.localStorage.getItem(Ka))}catch{return`dark`}}function Xa({children:e}){let[t,n]=(0,K.useState)(Ya),[r,i]=(0,K.useState)(()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches),a=_n(),o=a?di(a.theme)??`dark`:t===`system`?r?`dark`:`light`:t;(0,K.useLayoutEffect)(()=>{document.documentElement.dataset.theme=o,document.documentElement.style.colorScheme=o,document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,o===`light`?`#ffffff`:`#0a0a0a`)},[o]),(0,K.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>i(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,K.useEffect)(()=>{let e=e=>{if(e.key===Ka||e.key===null){try{if(e.storageArea&&e.storageArea!==window.localStorage)return}catch{return}n(Ja(e.newValue))}};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]);let s=(0,K.useCallback)(e=>{n(e);try{window.localStorage.setItem(Ka,e)}catch{}},[]),c=(0,K.useMemo)(()=>({preference:t,setPreference:s}),[t,s]);return(0,q.jsx)(qa.Provider,{value:c,children:e})}function Za(){return(0,K.useContext)(qa)}function Qa({options:e,value:t,onChange:n,label:r,className:i=``}){let a=(0,K.useId)();function o(r){let i=e.findIndex(e=>e.value===t),a=null;r.key===`ArrowRight`||r.key===`ArrowDown`?a=(i+1)%e.length:r.key===`ArrowLeft`||r.key===`ArrowUp`?a=(i-1+e.length)%e.length:r.key===`Home`?a=0:r.key===`End`&&(a=e.length-1),a!==null&&(r.preventDefault(),n(e[a].value),r.currentTarget.querySelectorAll(`[role="radio"]`)[a].focus())}return(0,q.jsx)(`div`,{role:`radiogroup`,"aria-label":r,className:`segmented ${i}`.trim(),onKeyDown:o,children:e.map(e=>{let r=e.value===t,i=e.description?`${a}-${e.value}`:void 0;return(0,q.jsxs)(K.Fragment,{children:[(0,q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":r,"aria-describedby":i,title:e.icon?e.label:void 0,tabIndex:r?0:-1,onClick:()=>n(e.value),className:`segmented-option pointer-coarse:min-h-11 ${r?`segmented-option-active`:``}`,children:e.icon?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:e.icon}),(0,q.jsx)(`span`,{className:`sr-only`,children:e.label})]}):e.label}),e.description?(0,q.jsx)(`span`,{id:i,className:`sr-only`,children:e.description}):null]},e.value)})})}var $a=[{value:`light`,label:`Light`,icon:(0,q.jsx)(k,{className:`size-3.5`})},{value:`dark`,label:`Dark`,icon:(0,q.jsx)(a,{className:`size-3.5`})},{value:`system`,label:`System`,icon:(0,q.jsx)(p,{className:`size-3.5`})}];function eo(){let e=Za();return e?(0,q.jsx)(Qa,{label:`Color theme`,options:$a,value:e.preference,onChange:e.setPreference,className:`theme-toggle`}):null}function to({status:e}){return(0,q.jsx)(En,{tone:mi(e),children:Xn(e)})}var no=pe,ro=fe,io=K.forwardRef(({className:e,...t},n)=>(0,q.jsx)(le,{ref:n,className:rn(`fixed inset-0 z-50 bg-overlay-scrim/70 backdrop-blur-sm`,e),...t}));io.displayName=le.displayName;var ao=400,oo=1200,so=720,co=K.forwardRef(({className:e,children:t,...n},r)=>{let[i,a]=K.useState(so),o=K.useRef(!1),s=K.useRef(0),c=K.useRef(0),l=K.useCallback(e=>{o.current=!0,s.current=e.clientX,c.current=i,e.target.setPointerCapture(e.pointerId),e.preventDefault()},[i]),u=K.useCallback(e=>{if(!o.current)return;let t=s.current-e.clientX,n=Math.min(oo,Math.max(ao,c.current+t));a(n)},[]),d=K.useCallback(()=>{o.current=!1},[]);return(0,q.jsxs)(ro,{children:[(0,q.jsx)(io,{}),(0,q.jsxs)(I,{ref:r,className:rn(`material-modal fixed z-50 flex flex-col px-5 py-4 overflow-hidden`,`max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-h-[88vh] max-md:rounded-b-none`,`md:inset-y-0 md:right-0 md:h-full md:rounded-none`,e),style:{width:`min(${i}px, 100vw)`},...n,children:[(0,q.jsx)(`div`,{className:`absolute inset-y-0 left-0 w-1.5 cursor-col-resize hover:bg-mono-700/50 active:bg-mono-600/50 transition-colors max-md:hidden`,onPointerDown:l,onPointerMove:u,onPointerUp:d}),t,(0,q.jsxs)(de,{className:`absolute right-4 top-4 inline-flex size-8 items-center justify-center rounded-md text-muted transition hover:bg-bg-elevated hover:text-heading focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,q.jsx)(N,{className:`size-4`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})});co.displayName=I.displayName;var lo=({className:e,...t})=>(0,q.jsx)(`div`,{className:rn(`flex flex-col gap-1.5 pr-10`,e),...t}),uo=K.forwardRef(({className:e,...t},n)=>(0,q.jsx)(L,{ref:n,className:rn(`text-heading-20 text-primary`,e),...t}));uo.displayName=L.displayName;var fo=K.forwardRef(({className:e,...t},n)=>(0,q.jsx)(F,{ref:n,className:rn(`text-copy-14 text-secondary`,e),...t}));fo.displayName=F.displayName;function po({title:e,subtitle:t,children:n,open:r,onClose:i}){return(0,q.jsx)(no,{open:r,onOpenChange:e=>e?void 0:i(),children:(0,q.jsxs)(co,{children:[(0,q.jsxs)(lo,{className:`drawer-head`,children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:t}),(0,q.jsx)(uo,{id:`drawer-title`,children:e}),(0,q.jsx)(fo,{className:`sr-only`,children:t})]}),(0,q.jsx)(`div`,{className:`drawer-body`,children:n})]})})}var mo={label:`Different subject`,project:`The answer uses your name, but sentiment found it is about something else, so it does not count as a mention.`,property:`The answer uses this Property’s name, but sentiment found it is about something else, so it does not count as a mention.`};function ho(e){let t=(e??``).trim();return t&&(t.startsWith(`/`)||/^https?:\/\//i.test(t)||/^mailto:/i.test(t))?t:null}function go({url:e,title:t}){let n=ho(e),r=n&&/^https?:\/\//i.test(n)?n:null;return(0,q.jsxs)(`span`,{className:`block min-w-0 text-label-14 [overflow-wrap:anywhere]`,children:[t&&t!==e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`mb-1 block text-label-14-strong text-heading`,children:t}),` `]}):null,r?(0,q.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,className:`text-link underline underline-offset-2 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:e}):(0,q.jsx)(`span`,{className:`text-secondary`,children:e})]})}function _o(e){return[...e.mentionedCompetitorTerms??(e.mentionedCompetitorDomains??[]).flatMap(e=>{let t=Ze(e);return t.length>=4?[t]:[]}),...e.recommendedCompetitors??[]].filter(e=>e.trim().length>2)}var vo=/[\s\-_]+/;function yo(e){let t=e.split(vo).filter(Boolean);return t.length===0?null:t.map(Vr).join(`[\\s\\-_]*`)}function bo(e,t){let n=xo(t),r=e.split(/(\*\*[^*]+\*\*)/).filter(Boolean).map(e=>e.startsWith(`**`)&&e.endsWith(`**`)?{type:`bold`,value:e.slice(2,-2)}:{type:`text`,value:e}),i=n.flatMap(e=>e.terms).filter(e=>e.trim().length>1);if(i.length===0)return r.map((e,t)=>e.type===`bold`?K.createElement(`strong`,{key:`b-${t}`,className:`text-strong`},e.value):e.value).filter(Boolean);let a=[...i].sort((e,t)=>t.length-e.length).map(yo).filter(e=>!!e);if(a.length===0)return r.map((e,t)=>e.type===`bold`?K.createElement(`strong`,{key:`b-${t}`,className:`text-strong`},e.value):e.value).filter(Boolean);let o=RegExp(`(${a.join(`|`)})`,`gi`),s=new Map;for(let e of n)for(let t of e.terms){let n=Hn(t);n&&!s.has(n)&&s.set(n,e.className)}return r.flatMap((e,t)=>e.value.split(o).map((n,r)=>{if(!n)return null;if(r%2==1){let i=s.get(Hn(n))??`answer-highlight`;return e.type===`bold`?K.createElement(`mark`,{key:`hl-${t}-${r}`,className:i},K.createElement(`strong`,{className:`text-strong`},n)):K.createElement(`mark`,{key:`hl-${t}-${r}`,className:i},n)}return e.type===`bold`?K.createElement(`strong`,{key:`b-${t}-${r}`,className:`text-strong`},n):n})).filter(Boolean)}function xo(e){return e.length===0?[]:typeof e[0]==`string`?[{terms:e,className:`answer-highlight`}]:e}function So(e,t){let n=e.mentionedCompetitorDomains===void 0?t:e,r=n?.mentionedCompetitorTerms;return{citedCompetitorDomains:[...e.citedCompetitorDomains??t?.citedCompetitorDomains??[]],mentionedCompetitorDomains:[...n?.mentionedCompetitorDomains??[]],...r===void 0?{}:{mentionedCompetitorTerms:[...r]}}}function Co(e,t){switch(e){case`new`:return`First observation`;case`emerging`:return`First mention`;case`lost`:return`Lost since last run`;default:return t===`mentioned`||t===`visible`?`Mentioned in latest run`:t===`pending`?`Awaiting first run`:`Not mentioned in latest run`}}function wo({evidence:e,project:t,onClose:n}){let[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(`mentions`),[s,c]=(0,K.useState)(-1),[l,u]=(0,K.useState)(null),[d,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)({}),h=Pe(t.project),g=new Set(h.map(Ye)),_=e.runHistory,v=_.length>1,[y,b]=(0,K.useState)(null),x=(0,K.useRef)(!1);(0,K.useEffect)(()=>{if(x.current||e.answerSnippet&&(e.visibilityState!=null||e.answerMentioned!=null))return;let t=_.at(-1);t&&(x.current=!0,tt(t.runId).then(n=>{let r=n.snapshots?.find(t=>t.query===e.query&&t.provider===e.provider);r&&b({citationState:r.citationState,answerMentioned:r.answerMentioned,visibilityState:r.visibilityState,visibilityTransition:t.visibilityTransition,provider:r.provider,model:r.model??e.model,answerSnippet:r.answerText??e.answerSnippet,citedDomains:r.citedDomains??e.citedDomains,...So(r,e),recommendedCompetitors:r.recommendedCompetitors??e.recommendedCompetitors??[],matchedTerms:r.matchedTerms??e.matchedTerms??[],mentionIdentity:r.mentionIdentity??null,groundingSources:r.groundingSources??e.groundingSources,searchQueries:r.searchQueries,evidenceUrls:r.citedUrls??[],changeLabel:e.visibilityChangeLabel??e.changeLabel,summary:e.summary})}).catch(()=>{}))},[e,_]);let S=s>=0&&l!==null,C=S?l:y||{citationState:e.citationState,answerMentioned:e.answerMentioned,visibilityState:e.visibilityState,visibilityTransition:_.at(-1)?.visibilityTransition,provider:e.provider,model:e.model,answerSnippet:e.answerSnippet,citedDomains:e.citedDomains,...So(e),recommendedCompetitors:e.recommendedCompetitors??[],matchedTerms:e.matchedTerms??[],mentionIdentity:e.mentionIdentity??null,groundingSources:e.groundingSources,searchQueries:e.searchQueries??[],evidenceUrls:e.evidenceUrls,changeLabel:e.visibilityChangeLabel??e.changeLabel,summary:e.summary},w=C.visibilityState===`pending`||C.citationState===`pending`,T=w?!1:C.visibilityState==null?C.answerMentioned==null?C.citationState===Ct.cited||C.citationState===`emerging`:C.answerMentioned:C.visibilityState===`visible`,E=C.answerMentioned!=null||C.visibilityState!=null||C.mentionedCompetitorDomains.length>0||C.recommendedCompetitors.length>0,D=C.citedDomains.length>0||C.citedCompetitorDomains.length>0||C.groundingSources.length>0||C.evidenceUrls.length>0,O=t.project.displayName||t.project.name,k=[...h.map(Ye),O,O.split(` `).slice(0,2).join(` `),...C.matchedTerms].filter(e=>e.trim().length>2),ee=_o(C),j=[{terms:k,className:`answer-highlight-brand`},...ee.length>0?[{terms:ee,className:`answer-highlight-competitor`}]:[]],te=w?`pending`:C.visibilityTransition===`lost`?`lost`:T?`mentioned`:`not-mentioned`,ne=(0,K.useRef)(0),M=(0,K.useCallback)(async t=>{let n=++ne.current;if(t===-1||t===_.length-1){c(-1),u(null),i(!1);return}c(t),i(!1);let r=_[t],a=`${r.runId}::${e.query}::${e.provider}`;if(p[a])u(p[a]);else{f(!0);try{let t=await tt(r.runId);if(n!==ne.current)return;let i=t.snapshots?.find(t=>t.query===e.query&&t.provider===e.provider)??t.snapshots?.find(t=>t.query===e.query),o=i?{citationState:i.citationState,answerMentioned:i.answerMentioned,visibilityState:i.visibilityState,visibilityTransition:r.visibilityTransition,provider:i.provider,model:i.model??null,answerSnippet:i.answerText??``,citedDomains:i.citedDomains,...So(i),recommendedCompetitors:i.recommendedCompetitors??[],matchedTerms:i.matchedTerms??[],mentionIdentity:i.mentionIdentity??null,groundingSources:i.groundingSources,searchQueries:i.searchQueries,evidenceUrls:i.citedUrls??[],changeLabel:Co(r.mentionTransition??r.visibilityTransition,r.mentionState??r.visibilityState),summary:``}:{citationState:r.citationState,answerMentioned:r.answerMentioned,visibilityState:r.visibilityState,visibilityTransition:r.visibilityTransition,provider:e.provider,model:r.model??null,answerSnippet:``,citedDomains:[],citedCompetitorDomains:[],mentionedCompetitorDomains:[],recommendedCompetitors:[],matchedTerms:[],groundingSources:[],searchQueries:[],evidenceUrls:[],changeLabel:Co(r.mentionTransition??r.visibilityTransition,r.mentionState??r.visibilityState),summary:`Snapshot data not available for this run.`};m(e=>({...e,[a]:o})),u(o)}catch{if(n!==ne.current)return;u({citationState:r.citationState,answerMentioned:r.answerMentioned,visibilityState:r.visibilityState,visibilityTransition:r.visibilityTransition,provider:e.provider,model:r.model??null,answerSnippet:``,citedDomains:[],citedCompetitorDomains:[],mentionedCompetitorDomains:[],recommendedCompetitors:[],matchedTerms:[],groundingSources:[],searchQueries:[],evidenceUrls:[],changeLabel:Co(r.mentionTransition??r.visibilityTransition,r.mentionState??r.visibilityState),summary:`Failed to load historical run data.`})}finally{n===ne.current&&f(!1)}}},[_,e.query,e.provider,p]),re=(S||e.historyScope!==`provider`)&&C.model?`${ra(C.provider)} (${C.model}) \u00b7 ${C.changeLabel.toLowerCase()}`:`${ra(C.provider)} \u00b7 ${C.changeLabel.toLowerCase()}`,ie=!S&&e.historyScope===`provider`?[e.model?`Current model: ${e.model}`:null,e.modelsSeen&&e.modelsSeen.length>1?`History spans ${e.modelsSeen.length} models`:null].filter(Boolean).join(` · `):``,P=T?{label:`Mentioned in answer`,title:`Your brand or domain is mentioned in this answer`,meta:re}:!w&&C.mentionIdentity===`wrong-subject`?{label:mo.label,title:mo.project,meta:re}:C.visibilityTransition===`lost`?{label:`Mention lost`,title:`Your brand no longer appears in this answer`,meta:re}:w?{label:`Pending`,title:`Awaiting first run`,meta:`No provider data yet`}:{label:`Not mentioned in answer`,title:`Your brand or domain was not mentioned in this answer`,meta:re};return(0,q.jsx)(pe,{open:!0,onOpenChange:e=>{e||n()},children:(0,q.jsxs)(fe,{children:[(0,q.jsx)(le,{className:`fixed inset-0 z-50 bg-overlay-scrim/80 backdrop-blur-sm`}),(0,q.jsxs)(I,{className:`evidence-modal`,"aria-describedby":void 0,children:[(0,q.jsxs)(`div`,{className:`evidence-modal-header`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`p`,{className:`eyebrow eyebrow-soft`,children:[t.project.name,` `,`·`,` `,C.provider||`All providers`]}),(0,q.jsx)(L,{className:`text-heading-20 text-primary truncate`,children:e.query})]}),(0,q.jsxs)(de,{className:`inline-flex size-8 items-center justify-center rounded-md text-muted transition hover:bg-mono-800 hover:text-heading focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400 shrink-0`,children:[(0,q.jsx)(N,{className:`size-4`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]}),v&&(0,q.jsxs)(`div`,{className:`evidence-modal-timeline`,children:[(0,q.jsx)(`p`,{className:`drawer-section-label mb-1.5`,children:`Run history`}),(0,q.jsx)(`div`,{className:`flex items-center gap-1 overflow-x-auto pb-1`,children:_.map((e,t)=>{let n=s===-1&&t===_.length-1||s===t,r=e.visibilityState??(e.answerMentioned?`visible`:`not-visible`),i=e.visibilityTransition??r,a=r===`visible`?`bg-positive-400`:i===`emerging`?`bg-caution-400`:i===`lost`?`bg-negative-400`:`bg-mono-600`,o=new Date(e.createdAt).toLocaleDateString(void 0,{month:`short`,day:`numeric`}),c=!!(e.model&&t>0&&_[t-1]?.model&&_[t-1].model!==e.model);return(0,q.jsxs)(`button`,{type:`button`,className:`evidence-run-dot ${n?`evidence-run-dot--selected`:``}`,onClick:()=>{M(t===_.length-1?-1:t)},"aria-label":[`Run ${o}: ${r}`,e.model?`model ${e.model}`:null,c?`model changed`:null].filter(Boolean).join(` — `),"aria-pressed":n,children:[(0,q.jsx)(`span`,{className:`size-2 rounded-full ${a} ${c?`ring-1 ring-caution-300/80 ring-offset-2 ring-offset-bg`:``}`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`text-label-12 text-muted`,children:o})]},t)})}),s>=0&&s<_.length&&(0,q.jsxs)(`p`,{className:`text-copy-13 text-muted mt-1`,children:[`Viewing run from `,new Date(_[s].createdAt).toLocaleString(),` `,`—`,` `,(0,q.jsx)(`span`,{className:`capitalize`,children:_[s].visibilityState??(_[s].answerMentioned?`visible`:`not-visible`)}),(0,q.jsxs)(`button`,{type:`button`,className:`text-secondary hover:text-strong ml-2`,onClick:()=>{M(-1)},children:[`←`,` Back to latest`]})]}),!S&&(e.modelTransitions?.length??0)>0&&(0,q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:e.modelTransitions.map(e=>(0,q.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-caution-400/30 bg-caution-400/10 px-2 py-1 text-label-12 text-caution-100`,children:`${e.fromModel??`unknown`} -> ${e.toModel??`unknown`} on ${new Date(e.createdAt).toLocaleDateString()}`},`${e.runId}:${e.toModel??`unknown`}`))})]}),(0,q.jsxs)(`div`,{className:`evidence-modal-body`,children:[d&&(0,q.jsxs)(`div`,{className:`md:col-span-2 flex items-center justify-center py-12 text-muted text-label-14`,children:[`Loading historical run data`,`…`]}),!d&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`evidence-modal-main`,children:[(0,q.jsxs)(`div`,{className:`evidence-position-hero evidence-position-hero--${te}`,children:[(0,q.jsx)(`p`,{className:`evidence-position-label evidence-position-label--${te}`,children:P.label}),(0,q.jsx)(`p`,{className:`evidence-position-title evidence-position-title--${te}`,children:P.title}),(0,q.jsx)(`p`,{className:`evidence-position-meta`,children:P.meta}),ie&&(0,q.jsx)(`p`,{className:`mt-1 text-copy-13 text-muted`,children:ie})]}),C.answerSnippet&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`drawer-section-label`,children:`What the AI said`}),(0,q.jsx)(`div`,{className:`answer-snippet-block ${r?`evidence-answer-expanded`:`evidence-answer-collapsed`}`,children:(()=>{if(!C.answerSnippet)return null;let e=C.answerSnippet.split(`
13
- `),t=[],n=[],r=0,i=()=>{if(n.length===0)return;let e=n.join(` `).trim();e&&t.push((0,q.jsx)(`p`,{className:t.length>0?`mt-2.5`:``,children:bo(e,j)},r++)),n=[]};for(let a of e){let e=a.trim();if(/^[-\u2013\u2014]{3,}$/.test(e)){i(),t.push((0,q.jsx)(`hr`,{className:`border-default my-3`},r++));continue}let o=e.match(/^(#{1,3})\s+(\S.*)$/);if(o){i();let e=o[1].length,n=o[2].replace(/^[\p{Emoji}\p{Emoji_Component}\s]+/u,``).trim()||o[2],a=e===1?`text-label-13-strong text-heading mt-4 mb-1`:e===2?`text-label-12-strong text-strong mt-3 mb-0.5`:`text-label-12-strong text-neutral mt-2`;t.push((0,q.jsx)(`p`,{className:a,children:bo(n,j)},r++))}else e===``?i():n.push(e)}return i(),t})()}),C.answerSnippet.length>280&&(0,q.jsx)(`button`,{type:`button`,className:`mt-1.5 text-button-14 text-muted hover:text-neutral transition-colors`,onClick:()=>i(!r),children:r?`↑ Collapse`:`↓ Show full answer`})]}),!C.answerSnippet&&!d&&(0,q.jsx)(`div`,{className:`material-base px-4 py-8 text-center text-faint text-label-14`,children:`No answer text recorded for this run`}),C.searchQueries.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`drawer-section-label flex items-center`,children:[(0,q.jsx)(`span`,{children:`Web searches the model ran`}),(0,q.jsx)(kr,{text:`The search queries this AI model issued while researching your prompt. They reveal how the model reformulated your query — the phrasings worth optimizing your content for. Distinct from grounding sources (what it found) and citations (what it linked).`})]}),(0,q.jsx)(`ul`,{className:`grid gap-1`,children:C.searchQueries.map((e,t)=>(0,q.jsxs)(`li`,{className:`flex items-start gap-2 text-label-14 text-neutral`,children:[(0,q.jsx)(A,{className:`size-3.5 mt-0.5 shrink-0 text-faint`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`break-words`,children:e})]},`${t}-${e}`))})]}),!S&&e.relatedTechnicalSignals.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`drawer-section-label`,children:T?`Why you're visible`:`What to fix`}),(0,q.jsx)(`div`,{className:`action-items-list`,children:e.relatedTechnicalSignals.map((e,t)=>(0,q.jsxs)(`div`,{className:`action-item`,children:[(0,q.jsx)(`svg`,{className:`action-item-icon ${T?`text-positive-400`:`text-caution-400`}`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:T?(0,q.jsx)(`path`,{d:`M3 8l3.5 3.5L13 4.5`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`circle`,{cx:`8`,cy:`8`,r:`7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,q.jsx)(`path`,{d:`M8 5v3.5M8 10.5v0`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})]})}),(0,q.jsx)(`span`,{className:`action-item-text`,children:e})]},t))})]}),C.summary&&(0,q.jsx)(`p`,{className:`text-copy-13 text-faint border-t border-subtle pt-3 mt-1`,children:C.summary})]}),(0,q.jsxs)(`div`,{className:`evidence-modal-sidebar`,children:[(E||D)&&(0,q.jsxs)(`div`,{className:`sidebar-tabs`,children:[(0,q.jsx)(`button`,{className:`sidebar-tab ${a===`mentions`?`sidebar-tab--active`:``}`,onClick:()=>o(`mentions`),type:`button`,title:`Canonry's answer-level visibility assessment and any company names extracted from the answer text.`,children:`Mentions`}),(0,q.jsx)(`button`,{className:`sidebar-tab ${a===`sources`?`sidebar-tab--active`:``}`,onClick:()=>o(`sources`),type:`button`,title:`Grounding links the model used to build the answer. These are supporting sources, not the primary visibility signal.`,children:`Sources`})]}),a===`mentions`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`drawer-section-label flex items-center`,children:[(0,q.jsx)(`span`,{children:`Mention in answer`}),(0,q.jsx)(kr,{text:`Canonry scans the AI answer for your owned domains and project name. This is independent from grounding or citation sources.`})]}),(0,q.jsxs)(`div`,{className:`mention-status mention-status--${T?`mentioned`:`not-mentioned`}`,children:[(0,q.jsx)(`span`,{className:`mention-status-icon`,children:w?`…`:T?`✓`:`—`}),(0,q.jsx)(`span`,{className:`mention-status-label`,children:w?`Pending`:T?`Mentioned`:`Not mentioned`})]}),!w&&!T&&C.mentionIdentity===`wrong-subject`&&(0,q.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1 text-label-12 text-muted`,children:[(0,q.jsx)(`span`,{children:mo.label}),(0,q.jsx)(kr,{text:mo.project})]}),C.matchedTerms.length>0&&(0,q.jsxs)(`div`,{className:`mt-2`,children:[(0,q.jsx)(`p`,{className:`text-label-12 normal-case text-muted mb-1.5`,children:`Matched in answer`}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:C.matchedTerms.map(e=>(0,q.jsx)(`span`,{className:`mention-chip mention-chip--brand`,children:e},e))})]}),!w&&!T&&C.matchedTerms.length===0&&(0,q.jsxs)(`div`,{className:`mt-2`,children:[(0,q.jsx)(`p`,{className:`text-label-12 normal-case text-muted mb-1.5`,children:`Searched for`}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:k.map(e=>(0,q.jsx)(`span`,{className:`mention-chip mention-chip--muted`,children:e},e))}),(0,q.jsx)(`p`,{className:`text-copy-13 text-faint mt-1.5`,children:`None of these appear in the answer text.`})]})]}),(C.recommendedCompetitors.length>0||C.mentionedCompetitorDomains.length>0)&&(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`drawer-section-label flex items-center`,children:[(0,q.jsx)(`span`,{children:`Competitors in answer`}),(0,q.jsx)(kr,{text:`Competitors detected in the answer text. Includes tracked competitor brands and names extracted by Canonry; source-link competitors stay in the Sources tab.`})]}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(()=>{let e=C.mentionedCompetitorDomains.map(e=>e.replace(/^www\./,``)),t=new Set(e.map(e=>Hn(e.replace(/\.[^.]+$/,``))));return[...C.recommendedCompetitors.filter(e=>!t.has(Hn(e))),...e].map(e=>(0,q.jsx)(`span`,{className:`mention-chip mention-chip--competitor`,children:e},e))})()})]})]}),a===`sources`&&(0,q.jsxs)(q.Fragment,{children:[C.citedDomains.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`drawer-section-label flex items-center`,children:[(0,q.jsx)(`span`,{children:`Domains from source links`}),(0,q.jsx)(kr,{text:`These domains were extracted from grounding or citation URLs. They are supporting-source metadata, not proof that the answer text mentioned them.`})]}),(0,q.jsx)(`div`,{className:`citation-leaderboard`,children:C.citedDomains.map((e,t)=>{let n=e.toLowerCase().replace(/^www\./,``),r=g.has(n),i=!r&&C.citedCompetitorDomains.some(e=>e.toLowerCase().replace(/^www\./,``)===n);return(0,q.jsxs)(`div`,{className:`citation-leaderboard-item citation-leaderboard-item--${r?`you`:i?`competitor`:`other`}`,children:[(0,q.jsxs)(`span`,{className:`citation-leaderboard-rank`,children:[`#`,t+1]}),(0,q.jsx)(`span`,{className:`citation-leaderboard-domain`,children:e}),r&&(0,q.jsx)(`span`,{className:`citation-leaderboard-tag`,children:`You`}),i&&(0,q.jsx)(`span`,{className:`citation-leaderboard-tag`,children:`Competitor`})]},e)})})]}),C.groundingSources.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`drawer-section-label flex items-center`,children:[(0,q.jsxs)(`span`,{children:[`Grounding source links (`,C.groundingSources.length,`)`]}),(0,q.jsx)(kr,{text:`Links the model used as grounding or supporting context while producing the answer. These are not the same thing as answer visibility.`})]}),(0,q.jsx)(`ul`,{className:`grid min-w-0 gap-3`,children:C.groundingSources.map((e,t)=>(0,q.jsx)(`li`,{className:`min-w-0`,children:(0,q.jsx)(go,{url:e.uri,title:e.title})},t))})]}),C.evidenceUrls.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`drawer-section-label`,children:`Evidence URLs`}),(0,q.jsx)(`ul`,{className:`grid min-w-0 gap-3`,children:C.evidenceUrls.map(e=>(0,q.jsx)(`li`,{className:`min-w-0`,children:(0,q.jsx)(go,{url:e})},e))})]}),C.citedDomains.length===0&&C.groundingSources.length===0&&C.evidenceUrls.length===0&&(0,q.jsxs)(`div`,{className:`flex items-center justify-center h-24 text-faint text-label-14`,children:[`No source data `,S?`for this run`:`yet`]})]}),!E&&!D&&(0,q.jsxs)(`div`,{className:`flex items-center justify-center h-24 text-faint text-label-14`,children:[`No answer visibility data `,S?`for this run`:`yet`]})]})]})]})]})]})})}function To(e){let t=e.match(/^\/projects\/([^/]+)/);if(!t)return null;try{return decodeURIComponent(t[1])}catch{return t[1]}}function Eo(e,t){return e?(t?.projects.find(t=>t.project.name===e||t.project.id===e))?.project.name??e:null}function Do(e,t){return Eo(To(e),t)}function Oo(e){let t=new Date(`2026-02-20`);return e.map((e,n)=>({runId:`run_mock_${n+1}`,citationState:e,createdAt:new Date(t.getTime()+n*2*24*60*60*1e3).toISOString()}))}var ko=[{id:`project_citypoint`,name:`Citypoint Dental NYC`,canonicalDomain:`citypointdental.com`,ownedDomains:[],aliases:[],qualifiedAliases:[],country:`US`,language:`en`,tags:[`local intent`,`priority`],labels:{},providers:[],providerModels:{},providerDispatchModes:{},measurement:Re,locations:[],defaultLocation:null,autoExtractBacklinks:!1,siteAuditMaxPages:null,configSource:`cli`,configRevision:1},{id:`project_harbor`,name:`Harbor Legal Group`,canonicalDomain:`harborlegal.com`,ownedDomains:[],aliases:[],qualifiedAliases:[],country:`US`,language:`en`,tags:[`lead gen`],labels:{},providers:[],providerModels:{},providerDispatchModes:{},measurement:Re,locations:[],defaultLocation:null,autoExtractBacklinks:!1,siteAuditMaxPages:null,configSource:`cli`,configRevision:1},{id:`project_northstar`,name:`Northstar Orthopedics`,canonicalDomain:`northstarortho.com`,ownedDomains:[],aliases:[],qualifiedAliases:[],country:`US`,language:`en`,tags:[`multi-location`],labels:{},providers:[],providerModels:{},providerDispatchModes:{},measurement:Re,locations:[],defaultLocation:null,autoExtractBacklinks:!1,siteAuditMaxPages:null,configSource:`cli`,configRevision:1}];function Ao(e){return{id:e.id,projectId:e.projectId,projectName:e.projectName,kind:e.kind,kindLabel:e.kindLabel,status:e.status,trigger:e.trigger??`manual`,createdAt:e.createdAt,startedAt:e.startedAt,duration:e.duration,statusDetail:e.statusDetail,summary:e.summary,triggerLabel:e.triggerLabel,opensSeoWorkspace:!1}}Ao({id:`run_citypoint_visibility_20260308`,projectId:`project_citypoint`,projectName:`Citypoint Dental NYC`,kind:`answer-visibility`,kindLabel:`AI Visibility check`,status:`completed`,createdAt:`2026-03-08T12:15:00.000Z`,startedAt:`Mar 8, 12:15 PM`,duration:`6 minutes 12 seconds`,statusDetail:`18 tracked queries checked; 3 citation losses detected on emergency-intent prompts.`,summary:`Citation losses on emergency-intent prompts`,triggerLabel:`Scheduled`}),Ao({id:`run_citypoint_queued_20260309`,projectId:`project_citypoint`,projectName:`Citypoint Dental NYC`,kind:`answer-visibility`,kindLabel:`AI Visibility check`,status:`queued`,createdAt:`2026-03-09T08:05:00.000Z`,startedAt:`Mar 9, 8:05 AM`,duration:`Waiting`,statusDetail:`Ready to enqueue after the next provider rate window clears.`,summary:`Queued follow-up after local ranking movement`,triggerLabel:`Manual`}),Ao({id:`run_harbor_visibility_20260308`,projectId:`project_harbor`,projectName:`Harbor Legal Group`,kind:`answer-visibility`,kindLabel:`AI Visibility check`,status:`completed`,createdAt:`2026-03-08T11:05:00.000Z`,startedAt:`Mar 8, 11:05 AM`,duration:`5 minutes 7 seconds`,statusDetail:`12 tracked queries checked; local-intent visibility held steady across branded prompts.`,summary:`Branded prompts remain stable`,triggerLabel:`Scheduled`}),Ao({id:`run_northstar_visibility_20260308`,projectId:`project_northstar`,projectName:`Northstar Orthopedics`,kind:`answer-visibility`,kindLabel:`AI Visibility check`,status:`running`,createdAt:`2026-03-08T13:40:00.000Z`,startedAt:`Mar 8, 1:40 PM`,duration:`Running`,statusDetail:`Provider responses still in flight for 9 multi-location prompts.`,summary:`Mid-run on treatment-location prompts`,triggerLabel:`Manual`}),Oo([`cited`,`cited`,`cited`,`cited`,`cited`,`cited`,`cited`,`not-cited`,`not-cited`]),Oo([`not-cited`,`cited`,`cited`,`cited`,`cited`,`cited`,`cited`]),Oo([`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`]),Oo([`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`cited`]),Oo([`cited`,`cited`,`cited`,`cited`,`cited`,`cited`,`cited`,`cited`]),Oo([`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`]),Oo([`not-cited`,`not-cited`,`not-cited`,`not-cited`]),Oo([`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`]),Oo([`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`cited`]),ko[0],ko[1],Oo([`cited`,`cited`,`cited`,`cited`,`cited`]),ko[2],Oo([`not-cited`,`not-cited`,`not-cited`,`cited`]),ko[0],ko[1],ko[2];function jo(e,t){return e.runs.find(e=>e.id===t)}function Mo(e,t){for(let n of e.projects){let e=n.visibilityEvidence.find(e=>e.id===t);if(e)return{project:n,evidence:e}}}function No(e,t,n){if(e){let t=e.visibilityEvidence.find(e=>e.id===n);if(t)return{project:e,evidence:t}}if(t)return Mo(t,n)}var X={regression:`negative`,gain:`positive`,opportunity:`caution`,"first-citation":`positive`,"provider-pickup":`positive`,"persistent-gap":`caution`,"competitor-gained":`negative`,"competitor-lost":`neutral`,"gbp-lodging-gap":`negative`,"gbp-listing-discrepancy":`negative`,"gbp-cta-gap":`caution`,"gbp-description-missing":`caution`,"gbp-metric-drop":`negative`,"gbp-keyword-drop":`negative`},Po={regression:`lost`,gain:`emerging`,opportunity:`not-cited`,"first-citation":`emerging`,"provider-pickup":`emerging`,"persistent-gap":`not-cited`,"competitor-gained":`cited`,"competitor-lost":`not-cited`,"gbp-lodging-gap":`not-cited`,"gbp-listing-discrepancy":`not-cited`,"gbp-cta-gap":`not-cited`,"gbp-description-missing":`not-cited`,"gbp-metric-drop":`lost`,"gbp-keyword-drop":`lost`},Fo={regression:!0,gain:!0,opportunity:!0,"first-citation":!0,"provider-pickup":!0,"persistent-gap":!0,"competitor-gained":!1,"competitor-lost":!1,"gbp-lodging-gap":!1,"gbp-listing-discrepancy":!1,"gbp-cta-gap":!1,"gbp-description-missing":!1,"gbp-metric-drop":!1,"gbp-keyword-drop":!1},Io={regression:`Regression`,gain:`Gain`,opportunity:`Opportunity`,"first-citation":`First citation`,"provider-pickup":`Pickup`,"persistent-gap":`Gap`,"competitor-gained":`Competitor`,"competitor-lost":`Competitor`,"gbp-lodging-gap":`Lodging gap`,"gbp-listing-discrepancy":`Listing gap`,"gbp-cta-gap":`Booking CTA`,"gbp-description-missing":`Description gap`,"gbp-metric-drop":`Metric drop`,"gbp-keyword-drop":`Keyword drop`};function Lo(e){return{id:e.id,tone:X[e.type],title:e.title,detail:e.cause?.details??e.cause?.cause??``,actionLabel:e.recommendation?.action??Io[e.type],actionGroup:Tt[e.type],affectedPhrases:[{query:e.query,evidenceId:``,provider:e.provider,citationState:Po[e.type],siteCitation:Fo[e.type]}]}}function Ro(e){return e.filter(e=>!e.dismissed).map(Lo)}function zo(e){return{id:e.id,name:e.name,displayName:e.displayName,canonicalDomain:e.canonicalDomain,ownedDomains:e.ownedDomains??[],aliases:e.aliases??[],qualifiedAliases:e.qualifiedAliases,country:e.country,language:e.language,tags:e.tags,labels:e.labels,providers:e.providers??[],providerModels:e.providerModels??{},providerDispatchModes:e.providerDispatchModes??{},measurement:e.measurement,locations:e.locations??[],defaultLocation:e.defaultLocation??null,autoExtractBacklinks:e.autoExtractBacklinks??!1,siteAuditMaxPages:e.siteAuditMaxPages??null,configSource:e.configSource,configRevision:e.configRevision,createdAt:e.createdAt,updatedAt:e.updatedAt}}function Bo(e,t){return`${e} ${t}${e===1?``:`s`}`}function Vo(e,t){if(!e)return`Waiting`;if(!t)return`Running`;let n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return`under 1 second`;let r=Math.floor(n/1e3),i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60;return i>0?a>0?`${Bo(i,`hour`)} ${Bo(a,`minute`)}`:Bo(i,`hour`):a>0?o>0?`${Bo(a,`minute`)} ${Bo(o,`second`)}`:Bo(a,`minute`):Bo(o,`second`)}function Ho(e){switch(e){case U[`answer-visibility`]:return`AI Visibility check`;case U[`gsc-sync`]:return`GSC sync`;case U[`inspect-sitemap`]:return`Sitemap inspection`;case U[`ga-sync`]:return`GA sync`;case U[`traffic-sync`]:return`Traffic sync`;case U[`bing-inspect`]:return`Bing URL inspection`;case U[`bing-inspect-sitemap`]:return`Bing sitemap inspection`;case U[`site-audit`]:return`Technical AEO audit`;case U[`backlink-extract`]:return`Backlink extract`;case U[`aeo-discover-seed`]:return`Discovery (seed phase)`;case U[`aeo-discover-probe`]:return`Discovery (probe phase)`;case U[`gbp-sync`]:return`Business Profile sync`;case U[`ads-sync`]:return`ChatGPT ads sync`;case U[`google-ads-sync`]:return`Google Ads sync`;case U[`gtm-sync`]:return`Tag Manager sync`;case U[`seo-sync`]:return`SEO data refresh`;default:return`Unknown job type`}}function Uo(e){switch(e){case ut.manual:return`Manual`;case ut.scheduled:return`Scheduled`;case ut[`config-apply`]:return`Config apply`;case ut.probe:return`Spot check`;default:return e}}function Wo(e,t){return{id:e.id,projectId:e.projectId,projectName:t,kind:e.kind,kindLabel:Ho(e.kind),status:e.status,trigger:e.trigger??`manual`,location:e.location??null,createdAt:e.createdAt,startedAt:Wn(e.startedAt||e.createdAt),duration:Vo(e.startedAt??null,e.finishedAt??null),statusDetail:e.error?Go(e.error):Ko(e),summary:qo(e),triggerLabel:Uo(e.trigger),opensSeoWorkspace:e.kind===U[`seo-sync`]&&!(e.status===H.failed&&!e.startedAt)}}function Go(e){let t=cn(e);return t.length>200?t.slice(0,200)+`…`:t}function Ko(e){if(e.kind===U[`seo-sync`])return`View the saved scope and task results in SEO.`;switch(e.status){case H.queued:return`Waiting for execution slot.`;case H.running:return`Provider queries in progress.`;case H.completed:return`All queries checked.`;case H.partial:return`Run completed with some queries skipped.`;case H.failed:return e.error?Go(e.error):`Run failed.`;case H.cancelled:return`Run was cancelled.`;default:return``}}function qo(e){let t=Ho(e.kind);switch(e.status){case H.queued:return`${t} queued`;case H.running:return`${t} in progress`;case H.completed:return`${t} completed`;case H.partial:return`${t} partially completed`;case H.failed:return`${t} failed`;case H.cancelled:return`${t} cancelled`;default:return e.status}}function Jo(e,t,n,r,i){let a=[],o=0,s=new Set;if(n.length>0){let r=n.flatMap(e=>e.snapshots??[]),c=new Map;for(let e of r)if(e.query){let t=`${e.query}::${e.provider}::${e.location??``}`;c.set(t,e)}let l=new Set(r.map(e=>e.location??null));l.size===0&&l.add(null);let u=new Set(r.map(e=>e.provider)),d=new Set(t.flatMap(e=>Object.keys(e.providerRuns??{}))),f=[...new Set([...u,...d])].sort(),p=f.length>0?f:[`gemini`],m=new Set(r.flatMap(e=>e.query?[e.query]:[]));for(let n of t){if(n.runs.length===0&&!m.has(n.query))continue;s.add(n.query);let t=n.runs.at(-1),r=t?.transition??`not-cited`;for(let s of p){let u=[...l].filter(e=>c.has(`${n.query}::${s}::${e??``}`)),d=(n.providerRuns?.[s]?.length??0)>0,f=u.length>0?u:d?[null]:[];for(let l of f){let d=l??``,f=c.get(`${n.query}::${s}::${d}`),p=f?.model??null,m=p?`${s}:${p}`:null,h=n.providerRuns?.[s],g=m?n.modelRuns?.[m]:void 0,_=e=>e?.filter(e=>(e.location??null)===l),v=u.length>0?_(h):h,y=u.length>0?_(g):g,b=(v?.length?v:null)??(y?.length?y:null),x=v?.length?`provider`:y?.length?`model`:`query`,S=f&&b?b.findIndex(e=>e.runId===f.runId):-1,C=f?S>=0?b.slice(0,S+1):null:b,w=f!==void 0&&C===null,T=C?C.at(-1).transition:w?f.citationState===Ct.cited?`cited`:`not-cited`:r,E=C?C.at(-1).visibilityTransition??(C.at(-1).visibilityState===`visible`?`visible`:`not-visible`):w?f.visibilityState===`visible`?`visible`:`not-visible`:t?.visibilityTransition??(t?.visibilityState===`visible`?`visible`:`not-visible`),D=b?.at(-1)?.citationState,O=b?.at(-1)?.visibilityState,k=f?T===`lost`?`lost`:T===`emerging`?`emerging`:f.citationState===Ct.cited?`cited`:`not-cited`:D===Ct.cited?`cited`:`not-cited`,A=f?.visibilityState??(O===`visible`?`visible`:O===`pending`?`pending`:`not-visible`),ee=C?Qo(C):w?1:Qo(n.runs),j=C?$o(C):w?1:$o(n.runs),te=Yo(n,s),ne=(b??n.runs).map(e=>({runId:e.runId,citationState:e.citationState,createdAt:e.createdAt,model:te.get(e.runId)??null,answerMentioned:e.answerMentioned,visibilityState:e.visibilityState,visibilityTransition:e.visibilityTransition,mentionState:e.mentionState,mentionTransition:e.mentionTransition})),M=Xo(ne),re=x===`provider`&&M.length<=1?`model`:x,ie=Zo(ne),N=f?.citedCompetitorDomains??[],P=f?.mentionedCompetitorDomains??[],ae=[...new Set([...N,...P,...f?.competitorOverlap??[]])];a.push({id:`evidence_${e}_${o++}`,query:n.query,queryId:f?.queryId??null,sourceSnapshotId:f?.id??null,sourceRunId:f?.runId??null,queryClass:i?.classify(n.query)??null,provider:f?.provider??s,model:f?.model??null,location:f?.location??l,citationState:k,answerMentioned:f?.answerMentioned,visibilityState:A,visibilityChangeLabel:es(E,j,{positive:`visible`,negative:`not visible`,first:`first visibility`}),changeLabel:es(T,ee),answerSnippet:f?.answerText??``,citedDomains:f?.citedDomains??[],evidenceUrls:f?.citedUrls??[],citedCompetitorDomains:N,mentionedCompetitorDomains:P,mentionedCompetitorTerms:f?.mentionedCompetitorTerms??[],competitorDomains:ae,recommendedCompetitors:f?.recommendedCompetitors??[],matchedTerms:f?.matchedTerms??[],mentionIdentity:f?.mentionIdentity??null,relatedTechnicalSignals:[],groundingSources:f?.groundingSources??[],searchQueries:f?.searchQueries??[],summary:ns(A,E,n.query),runHistory:ne,historyScope:re,modelsSeen:M,modelTransitions:ie})}}}}for(let t of r)s.has(t.query)||a.push({id:`evidence_${e}_${o++}`,query:t.query,queryId:t.id,sourceSnapshotId:null,sourceRunId:null,queryClass:i?.classify(t.query)??null,provider:``,model:null,location:null,citationState:`pending`,visibilityState:`pending`,visibilityChangeLabel:`Awaiting first run`,changeLabel:`Awaiting first run`,answerSnippet:``,citedDomains:[],evidenceUrls:[],citedCompetitorDomains:[],mentionedCompetitorDomains:[],mentionedCompetitorTerms:[],competitorDomains:[],recommendedCompetitors:[],matchedTerms:[],relatedTechnicalSignals:[],groundingSources:[],searchQueries:[],summary:`"${t.query}" has been added but no visibility run has been triggered yet.`,runHistory:[],historyScope:`query`,modelsSeen:[],modelTransitions:[]});return a}function Yo(e,t){let n=new Map,r=`${t}:`;for(let[t,i]of Object.entries(e.modelRuns??{})){if(!t.startsWith(r))continue;let e=t.slice(r.length),a=e===`unknown`?null:e;for(let e of i)n.set(e.runId,a)}return n}function Xo(e){let t=new Set;for(let n of e)n.model&&t.add(n.model);return[...t]}function Zo(e){let t=[],n=null;for(let r of e){let e=r.model??null;e!==n&&n!==null&&t.push({runId:r.runId,createdAt:r.createdAt,fromModel:n,toModel:e}),n=e}return t}function Qo(e){if(e.length===0)return 0;let t=e[e.length-1].citationState,n=0;for(let r=e.length-1;r>=0&&e[r].citationState===t;r--)n++;return n}function $o(e){if(e.length===0)return 0;let t=e[e.length-1].visibilityState??`not-visible`,n=0;for(let r=e.length-1;r>=0&&(e[r].visibilityState??`not-visible`)===t;r--)n++;return n}function es(e,t,n){let r={positive:n?.positive??`cited`,negative:n?.negative??`not cited`,first:n?.first??`first citation`};switch(e){case`new`:return`First observation`;case`cited`:case`visible`:return t<=1?`${ts(r.positive)} in latest run`:`${ts(r.positive)} for ${t} runs`;case`lost`:return`Lost since last run`;case`emerging`:return ts(r.first);case`not-cited`:case`not-visible`:return t<=1?`${ts(r.negative)} in latest run`:`${ts(r.negative)} across ${t} runs`;default:return e}}function ts(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ns(e,t,n){switch(t){case`lost`:return`Mention was lost for "${n}". Your brand no longer appeared in the latest answer.`;case`emerging`:return`Your brand started appearing in AI answers for "${n}".`}switch(e){case`visible`:return`Your brand or domain is mentioned in AI answers for "${n}".`;case`pending`:return`"${n}" has been added but no run has been triggered yet.`;default:return`Your brand or domain was not mentioned in AI answers for "${n}".`}}function rs(e){let t=zo(e.project),n=ft(gt(e.project)),r=Jo(t.name,e.timeline,e.latestRunDetails,e.queries,n),i=[...e.runs].sort((e,t)=>t.createdAt.localeCompare(e.createdAt)).map(t=>Wo(t,e.project.displayName||e.project.name));return e.overview?as(t,e.overview,r,i):ss(t,r,i)}function is(e){return e.filter(e=>e.kind===U[`answer-visibility`]&&e.trigger!==ut.probe&&(e.status===H.completed||e.status===H.partial))}function as(e,t,n,r){let i=Ro(t.topInsights);for(let e of t.attentionItems)e.id.startsWith(`insight_`)||i.push({id:e.id,tone:e.tone,title:e.title,detail:e.detail,actionLabel:e.actionLabel,actionGroup:`investigate`,affectedPhrases:[]});return{project:e,contextLabel:t.contextLabel,mentionSummary:t.scores.mention,visibilitySummary:t.scores.visibility,mentionShareSummary:t.scores.mentionShare,queryCounts:{cited:t.queryCounts.citedQueries,total:t.queryCounts.totalQueries},gapQueries:t.scores.gapQueries,mentionGaps:t.scores.mentionGaps,indexCoverage:t.scores.indexCoverage,providerScores:t.providerScores,competitorPressure:t.scores.competitorPressure,runStatus:t.scores.runStatus,movementComparison:t.movementComparison,insights:i,visibilityEvidence:n,competitors:t.competitors.map(e=>({id:e.id,domain:e.domain,aliases:e.aliases??[],autoAliases:e.autoAliasNames??[],citationCount:e.citationCount,totalQueries:e.totalQueries,pressureLabel:e.pressureLabel,citedQueries:e.citedQueries,movement:``,notes:``})),recentRuns:r.slice(0,5),visibilitySweeps:is(r),suggestedQueries:t.suggestedQueries}}function os(){return{projectMentionSnapshots:0,competitorMentionSnapshots:0,combinedMentionSnapshots:0,perCompetitor:[],ranking:[],snapshotsWithAnswerText:0,snapshotsTotal:0,score:null}}function ss(e,t,n){let r={label:``,value:`No data`,delta:`Loading…`,tone:`neutral`,description:``,tooltip:``,trend:[]};return{project:e,contextLabel:`${e.country} / ${e.language.toUpperCase()}`,mentionSummary:{...r,label:`Mention Coverage`},visibilitySummary:{...r,label:`Citation Coverage`},mentionShareSummary:{...r,label:`Mention Share`,scope:`non-brand`,unavailable:!0,breakdown:os(),branded:os()},queryCounts:{cited:0,total:0},gapQueries:{...r,label:`Citation Gaps`},mentionGaps:{...r,label:`Mention Gaps`},indexCoverage:{...r,label:`Index Coverage`},providerScores:[],competitorPressure:{...r,label:`Competitor Pressure`},runStatus:{...r,label:`Run Status`},movementComparison:{hasPreviousRun:!1,comparable:!1,querySetChanged:!1,previousRunAt:null,currentQueryCount:0,previousQueryCount:0,comparableQueryCount:0,addedQueryCount:0,removedQueryCount:0,addedQueries:[],removedQueries:[]},insights:[],visibilityEvidence:t,competitors:[],recentRuns:n.slice(0,5),visibilitySweeps:is(n),suggestedQueries:{rows:[],totalCandidates:0,skippedAlreadyTracked:0}}}function cs(e){let t=zo(e.project),n=[...e.runs].sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),r=n.find(e=>e.kind===U[`answer-visibility`])??n[0]??e.overview?.latestRun?.run??void 0,i=e.project.displayName||e.project.name,a=r?Wo(r,i):ls(e.project.id,i),o=e.overview;if(!o)return{project:t,hasMeasurement:!1,mentionScore:0,mentionDelta:`No data`,mentionTone:`neutral`,lastRun:a,insight:`No runs completed yet.`,trend:[],competitorPressureLabel:`None`};let s=o.scores.mention,c=s.progress??0,l=o.queryCounts.mentionedQueries,u=o.queryCounts.totalQueries,d=o.providers.length;return{project:t,hasMeasurement:u>0&&s.progress!=null,mentionScore:c,mentionDelta:u>0?`${l} of ${u} queries`:`No data`,mentionTone:s.tone,providerCoverage:s.providerCoverage,lastRun:a,insight:u>0?`${l} of ${u} queries mentioned across ${d} provider${d===1?``:`s`}.`:`No runs completed yet.`,trend:s.trend??[],competitorPressureLabel:o.scores.competitorPressure.value,sentiment:o.sentiment}}function ls(e,t){return{id:`none`,projectId:e,projectName:t,kind:U[`answer-visibility`],kindLabel:`No runs yet`,status:H.queued,trigger:ut.manual,createdAt:``,startedAt:``,duration:``,statusDetail:``,summary:`No runs yet`,triggerLabel:``,opensSeoWorkspace:!1}}function us(e,t){let n=[],r=[],i=[];for(let t of e){r.push(rs(t)),i.push(cs(t));let e=[...t.runs].sort((e,t)=>t.createdAt.localeCompare(e.createdAt));for(let r of e)n.push(Wo(r,t.project.displayName||t.project.name))}n.sort((e,t)=>t.createdAt.localeCompare(e.createdAt));let a=e.length>0;return{portfolioOverview:{projects:i,attentionItems:a?ds(r):[{id:`attention_setup`,tone:`neutral`,title:`No projects yet`,detail:`Create your first project using the setup wizard, CLI, or API.`,actionLabel:`Open setup`,href:`/setup`}],recentRuns:n.slice(0,5),systemHealth:[{id:`api`,label:`API`,tone:`positive`,detail:`Connected`,meta:`Real-time data`},{id:`provider`,label:`Gemini`,tone:`positive`,detail:`Configured`,meta:`Provider active`}],...a?{}:{emptyState:{title:`No projects yet`,detail:`Canonry becomes useful after one project, a small query set, and one competitor list are in place.`,ctaLabel:`Launch setup`,ctaHref:`/setup`}}},projects:r,runs:n,setup:{healthChecks:[{id:`api`,label:`API reachable`,detail:`API is responding.`,state:`ready`,guidance:`Required for project creation and run history.`},{id:`provider`,label:`Provider configured`,detail:`Gemini key is configured.`,state:`ready`,guidance:`Required for AI Visibility checks.`}],projectDraft:{name:``,canonicalDomain:``,country:`US`,language:`en`},queryImportState:{mode:`paste`,queryCount:0,preview:[]},competitorDraft:{domains:[],notes:`Use the CLI to add competitors.`},launchState:{enabled:a,ctaLabel:a?`Trigger run`:`Create a project first`,summary:a?`Ready to run.`:`Create a project first to launch a run.`}},settings:{providerStatuses:(t?.providers??[]).map(e=>({name:e.name,displayName:e.displayName,...e.kind?{kind:e.kind}:{},keyUrl:e.keyUrl,modelHint:e.modelHint,model:e.model,defaultModel:e.defaultModel,state:e.configured?`ready`:`needs-config`,detail:e.configured?`Provider is configured.`:e.name.toLowerCase()===`local`?`Base URL is missing.`:`API key is missing.`,quota:e.quota})),google:{state:t?.google?.configured?`ready`:`needs-config`,detail:t?.google?.configured?`Google OAuth app credentials are configured. Project-level GSC connections can be created from the dashboard.`:`Google OAuth client ID and client secret are not configured yet.`},bing:{state:t?.bing?.configured?`ready`:`needs-config`,detail:t?.bing?.configured?`Bing Webmaster Tools API key is configured. Project-level Bing connections can be created from the dashboard.`:`Bing Webmaster Tools API key is not configured yet.`},selfHostNotes:[`Configuration is stored in ~/.canonry/config.yaml.`,`The local config file is the source of truth for authentication credentials.`,`Google OAuth app credentials and per-domain Google tokens are stored in local config, not the database.`,`Database is SQLite at ~/.canonry/data.db.`,`API key was auto-generated during canonry init.`],bootstrapNote:`Use the UI, CLI, or ~/.canonry/config.yaml to manage settings. Authentication credentials persist to local config.`}}}function ds(e){let t=[];for(let n of e){let e=n.visibilityEvidence.filter(e=>e.citationState===`lost`);e.length>0&&t.push({id:`attention_${n.project.id}_lost`,tone:`negative`,title:`${n.project.displayName||n.project.name} lost citations`,detail:`${e.length} quer${e.length>1?`ies`:`y`} lost citation.`,actionLabel:`Open project`,href:`/projects/${encodeURIComponent(n.project.name)}`});let r=n.recentRuns.filter(e=>e.status===H.running||e.status===H.queued);r.length>0&&t.push({id:`attention_${n.project.id}_active`,tone:`neutral`,title:`${n.project.displayName||n.project.name} has active runs`,detail:`${r.length} run${r.length>1?`s`:``} in progress.`,actionLabel:`View runs`,href:`/runs`})}return t.length===0&&t.push({id:`attention_stable`,tone:`positive`,title:`All projects stable`,detail:`No citation losses or active runs to flag.`}),t}var fs=(0,K.createContext)(null);fs.Provider;function ps(){return(0,K.useContext)(fs)}function ms(e,t={}){let n=ps(),r=e??n?.dashboard??null,i=t.includeSettings??!0,a=t.includeOverviews??!0,o=t.pauseProjectPolling??!1,{isAdmin:s}=Qn(),c=!r&&a&&!In(),l=z({...wr({client:W,query:{kind:`answer-visibility`}}),enabled:!r,staleTime:tr,refetchInterval:e=>e.state.data?.some(e=>e.status===`running`||e.status===`queued`)?3e3:tr}),u=z({...wr({client:W,query:{excludeKinds:[U[`bing-inspect`],U[`traffic-sync`]],limit:5}}),enabled:c,staleTime:tr,refetchInterval:e=>e.state.data?.some(e=>e.status===H.running||e.status===H.queued)?3e3:tr}),d=z({...yr({client:W}),enabled:!r,refetchInterval:o?!1:e=>{let t=e.state.data,n=l.data?.some(e=>e.status===`running`||e.status===`queued`);return(t?.length??0)===0||n?ar:ur}}),f=z({...br({client:W}),enabled:!r&&i&&s}),p=d.data??[],m=l.data??[],h=je({queries:p.map(e=>{let t=m.filter(t=>t.projectId===e.id),n=t.filter(e=>(e.status===`completed`||e.status===`partial`)&&e.kind===`answer-visibility`&&e.trigger!==`probe`).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),i=n.length>0?n[0].id:`no-run`;return{queryKey:[`project-overview-slim`,e.id,i],queryFn:async()=>{let n=await jt(e.name).catch(()=>null);return{project:e,runs:t,queries:[],competitors:[],timeline:[],latestRunDetails:[],previousRunDetails:[],gscCoverage:null,bingCoverage:null,dbInsights:null,overview:n}},enabled:!r&&a&&d.isSuccess&&l.isSuccess,staleTime:cr}})}),g=!a||h.every(e=>e.isSuccess),_=(0,K.useMemo)(()=>{if(r)return r;if(!d.data||!l.data||p.length>0&&!g)return null;let e=new Map(p.map(e=>[e.id,e])),t=us(a?h.map(t=>{if(!t.data)return null;let n=e.get(t.data.project.id);return n?{...t.data,project:n,runs:m.filter(e=>e.projectId===n.id)}:null}).filter(e=>e!=null):p.map((e,t)=>{let n=h[t]?.data;return{project:e,runs:m.filter(t=>t.projectId===e.id),queries:[],competitors:[],timeline:[],latestRunDetails:[],previousRunDetails:[],gscCoverage:null,bingCoverage:null,dbInsights:null,overview:n?.overview??null}}),f.data??null);return c&&(t.portfolioOverview.recentRuns=(u.data??[]).filter(t=>t.trigger!==ut.probe&&e.has(t.projectId)).map(t=>{let n=e.get(t.projectId);return Wo(t,n.displayName||n.name)})),t},[r,d.data,l.data,f.data,a,g,h,p,m,c,u.data]),v=!r&&(d.isError||l.isError),y=!r&&!_&&!v,b=(0,K.useCallback)(async()=>{let e=[d.refetch(),l.refetch(),...c?[u.refetch()]:[],...a?h.map(e=>e.refetch()):[]];i&&s&&e.push(f.refetch()),await Promise.all(e)},[i,s,a,c,u.refetch,h,d.refetch,l.refetch,f.refetch]);return{dashboard:_,isLoading:y,isError:v,activityLoading:c&&u.isPending,activityError:c&&u.isError,refetch:b}}function hs(e){return JSON.stringify(e.filter(e=>e.kind===`answer-visibility`&&e.trigger!==`probe`&&(e.status===`completed`||e.status===`partial`)).map(e=>[e.id,e.status]).sort(([e],[t])=>e.localeCompare(t)))}async function gs(e,t,n=`active`){let r=e=>{let n=e.queryKey[0];return n?._id===`getApiV1ProjectsByNameAnalyticsCompetitors`&&n.path?.name===t};return n===`active`&&await e.cancelQueries({predicate:r}),e.invalidateQueries({predicate:r,refetchType:n})}function _s(e,t,n){let r=_e(),i=(0,K.useRef)({projectName:e,revision:t,enabled:n});(0,K.useEffect)(()=>{let a=i.current;i.current={projectName:e,revision:t,enabled:n},n&&a.enabled&&a.projectName===e&&a.revision!==t&&gs(r,e)},[n,e,r,t])}var vs=20;function ys(e,t={}){let n=_e(),r=ps(),i=(0,K.useMemo)(()=>!r||!e?null:r.dashboard.projects.find(t=>t.project.name===e)??null,[r,e]),a=z({...Er({client:W,path:{name:e??``}}),enabled:!!e&&!i,staleTime:cr,refetchOnWindowFocus:`always`}),o=z({...Dr({client:W,path:{name:e??``},query:{kind:`answer-visibility`}}),enabled:!!e,staleTime:tr,refetchOnWindowFocus:`always`,refetchInterval:e=>e.state.data?.some(e=>e.projectId===a.data?.id&&(e.status===`running`||e.status===`queued`))?3e3:tr}),s=a.data??null,c=(0,K.useMemo)(()=>s?(o.data??[]).filter(e=>e.projectId===s.id):[],[s,o.data]),{latestRunIds:l,latestRunIdsKey:u,latestVisibilityRevision:d}=(0,K.useMemo)(()=>{let e=c.filter(e=>(e.status===`completed`||e.status===`partial`)&&e.kind===`answer-visibility`&&e.trigger!==`probe`).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),t=e[0]?.createdAt??null,n=t?e.filter(e=>e.createdAt===t).map(e=>e.id):[];return{latestRunIds:n,latestRunIdsKey:[...n].sort().join(`,`),latestVisibilityRevision:t?`${t}:${[...n].sort().join(`,`)}`:`none`}},[c]),f=!!s&&!!e&&o.isSuccess,p=z({queryKey:[`project-dashboard-full`,s?.id??null,u||`none`,`overview`],queryFn:async()=>({project:s,overview:await jt(e)}),enabled:f&&t.overview===!0,staleTime:cr,refetchOnWindowFocus:`always`}),m=z({queryKey:[`project-dashboard-full`,s?.id??null,u||`none`,`evidence`],queryFn:async()=>{let[t,n,r]=await Promise.all([rt(e),Cn(e,void 0,vs),Promise.all(l.map(e=>tt(e)))]);return{project:s,queries:t,timeline:n,latestRunDetails:r}},enabled:f&&t.evidence===!0,staleTime:cr,refetchOnWindowFocus:`always`}),h=(0,K.useMemo)(()=>{if(!s||!o.data)return i;let e=t.evidence?m.data:void 0,n=rs({project:s,runs:c,queries:e?.queries??[],timeline:e?.timeline??[],latestRunDetails:e?.latestRunDetails??[],previousRunDetails:[],competitors:[],overview:t.overview?p.data?.overview??null:null});return i&&!(t.overview&&p.data)?{...i,project:n.project,recentRuns:n.recentRuns,visibilitySweeps:n.visibilitySweeps,visibilityEvidence:e?n.visibilityEvidence:i.visibilityEvidence}:n},[s,c,m.data,p.data,i,t.evidence,t.overview,o.data]),g=(0,K.useCallback)(async()=>{await Promise.all([a.refetch(),o.refetch(),n.invalidateQueries({queryKey:[`project-dashboard-full`,s?.id??null]})])},[a.refetch,o.refetch,n,s?.id]),_=a.isError||o.isError,v=!i&&(a.isLoading||o.isLoading),y=!!e&&t.overview===!0&&!i&&!_&&p.isPending,b=!!e&&t.evidence===!0&&!i&&!_&&m.isPending;return{commandCenter:h,project:s,isLoading:v,isError:_,overviewLoading:y,overviewError:t.overview===!0&&p.isError&&!p.data,evidenceLoading:b,evidenceError:t.evidence===!0&&m.isError&&!m.data,latestVisibilityRevision:d,competitorHistoryRevision:hs(c),refetch:g}}var bs=[`health`];async function xs(){let e=await en(`/health`,`API`);return{apiStatus:e,workerStatus:Et()&&e.state===`ok`?{label:`Worker`,state:`disabled`,detail:`Background execution is disabled in this public demo.`}:e.state===`ok`?{label:`Worker`,state:`ok`,detail:`In-process job runner`}:{label:`Worker`,state:e.state,detail:`Depends on API health check · ${e.detail}`,statusCode:e.statusCode,hint:e.hint?`Worker status is inferred from API health in this deployment mode. ${e.hint}`:`Worker status is inferred from API health in this deployment mode.`}}}function Ss(e,t){return z({queryKey:bs,queryFn:xs,enabled:e,refetchInterval:15e3,initialData:t})}function Cs(e){return z({...Sr({client:W,path:{id:e??``}}),enabled:!!e,refetchInterval:e=>{let t=e.state.data?.status;return t===`running`||t===`queued`?3e3:!1}})}function ws(){let e=Se(),t=Ce({strict:!1}),n=ke({select:e=>e.location.pathname});return{runId:t.runId??null,evidenceId:t.evidenceId??null,openRun:t=>{e({to:n,from:_p.to,search:e=>({...e,runId:t,evidenceId:void 0})})},openEvidence:t=>{e({to:n,from:_p.to,search:e=>({...e,evidenceId:t,runId:void 0})})},closeDrawer:()=>{e({to:n,from:_p.to,search:e=>({...e,runId:void 0,evidenceId:void 0})})}}}var Ts={negative:`toast-card-negative`,caution:`toast-card-caution`,positive:`toast-card-positive`,neutral:`toast-card-neutral`};function Es(e){if(e.cta)return`${e.cta.label}: ${e.title}`}function Ds(){let e=(0,K.useSyncExternalStore)(sr,lr,lr),t=Se(),{openRun:n}=ws(),r=(0,K.useCallback)(e=>{ir(e)},[]),i=(0,K.useCallback)(e=>{e.cta&&(e.cta.intent===`open-run-drawer`?n(e.cta.runId):t({to:`/runs`}),ir(e.id))},[t,n]);return e.length===0?null:(0,q.jsx)(`div`,{className:`toast-viewport`,"aria-label":`Notifications`,children:e.map(e=>(0,q.jsxs)(`section`,{role:e.tone===`negative`?`alert`:`status`,"aria-live":e.tone===`negative`?`assertive`:`polite`,"data-state":e.state,className:`toast-card ${Ts[e.tone]}`,children:[(0,q.jsxs)(`div`,{className:`toast-copy`,children:[(0,q.jsx)(`p`,{className:`toast-title`,children:e.title}),e.detail?(0,q.jsx)(`p`,{className:`toast-detail`,children:e.detail}):null,e.cta?(0,q.jsx)(`button`,{type:`button`,className:`toast-action`,onClick:()=>i(e),"aria-label":Es(e),children:e.cta.label}):null]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:`toast-dismiss`,"aria-label":`Dismiss`,children:(0,q.jsx)(N,{className:`size-3.5`})})]},e.id))})}var Os=`https://github.com/Canonry/canonry`,ks=`https://canonry.ai`,As=`Run it from your agent with the MCP server, API, CLI, and plugins for Claude Code and Codex.`,js=[{title:`Visibility`,links:[[`AI visibility`,`/projects/summit-roofing`],[`Search engines`,`/projects/summit-roofing/search-console`],[`Traffic & conversions`,`/projects/summit-roofing/conversions`]]},{title:`Portfolio`,links:[[`Properties & markets`,`/projects/harbor-resorts`],[`Queries & research`,`/projects/harbor-resorts/queries`],[`Activity`,`/projects/harbor-resorts/activity`]]},{title:`Website`,links:[[`Site health`,`/projects/summit-roofing/technical-aeo`],[`Local presence`,`/projects/summit-roofing/local`],[`Backlinks`,`/projects/summit-roofing/backlinks`]]}];function Ms(){let e=(0,K.useId)();if(!Et())return null;let t=Yt(),n=`${e}-new-tab`,r={target:`_blank`,rel:`noopener noreferrer`,"aria-describedby":n};return(0,q.jsxs)(`aside`,{className:`demo-banner`,"aria-label":`Public demo`,children:[(0,q.jsx)(`p`,{className:`demo-banner-name`,children:`Canonry demo`}),(0,q.jsx)(`p`,{className:`demo-banner-facts`,children:`View only. Fictional data.`}),(0,q.jsx)(`p`,{className:`demo-banner-agent`,children:As}),(0,q.jsxs)(`div`,{className:`demo-banner-actions`,children:[(0,q.jsxs)(`a`,{className:`demo-banner-primary`,href:ks,...r,children:[`canonry.ai`,(0,q.jsx)(re,{"aria-hidden":`true`,size:14})]}),(0,q.jsxs)(`a`,{className:`demo-banner-secondary`,href:Os,...r,children:[(0,q.jsx)(v,{"aria-hidden":`true`,size:15}),`GitHub`]}),(0,q.jsxs)(`details`,{onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.open=!1,e.currentTarget.querySelector(`summary`)?.focus())},children:[(0,q.jsxs)(`summary`,{children:[`Explore `,(0,q.jsx)(b,{"aria-hidden":`true`,size:14})]}),(0,q.jsxs)(`div`,{className:`demo-banner-panel`,children:[(0,q.jsx)(`p`,{className:`demo-banner-panel-agent`,children:As}),(0,q.jsxs)(`nav`,{className:`demo-banner-examples`,"aria-label":`Demo examples`,children:[(0,q.jsx)(`a`,{href:`${t}/projects/summit-roofing`,children:`Standard business`}),(0,q.jsx)(`a`,{href:`${t}/projects/harbor-resorts`,children:`Property portfolio`})]}),(0,q.jsx)(`nav`,{className:`demo-banner-features`,"aria-label":`Demo feature directory`,children:js.map(({title:e,links:n})=>(0,q.jsxs)(`section`,{"aria-label":e,children:[(0,q.jsx)(`h2`,{children:e}),(0,q.jsx)(`ul`,{children:n.map(([e,n])=>(0,q.jsx)(`li`,{children:(0,q.jsx)(`a`,{href:`${t}${n}`,children:e})},n))})]},e))})]})]})]}),(0,q.jsx)(`span`,{id:n,hidden:!0,children:`Opens in a new tab`})]})}function Ns(e){switch(e){case U[`answer-visibility`]:return`AI Visibility check`;case U[`gsc-sync`]:return`GSC sync`;case U[`inspect-sitemap`]:return`Sitemap inspection`;case U[`ga-sync`]:return`GA sync`;case U[`traffic-sync`]:return`Traffic sync`;case U[`bing-inspect`]:return`Bing URL inspection`;case U[`bing-inspect-sitemap`]:return`Bing sitemap inspection`;case U[`site-audit`]:return`Technical AEO audit`;case U[`backlink-extract`]:return`Backlink extract`;case U[`aeo-discover-seed`]:return`Discovery (seed phase)`;case U[`aeo-discover-probe`]:return`Discovery (probe phase)`;case U[`gbp-sync`]:return`Business Profile sync`;case U[`ads-sync`]:return`ChatGPT ads sync`;case U[`google-ads-sync`]:return`Google Ads sync`;case U[`gtm-sync`]:return`Tag Manager sync`;case U[`seo-sync`]:return`SEO data refresh`}}function Ps(e){return e===`running`?`Running`:e===`queued`?`Queued`:e===`partial`?`Partial`:e===`completed`?`Completed`:e===`failed`?`Failed`:e===`cancelled`?`Cancelled`:`Starting`}function Fs(){let e=(0,K.useSyncExternalStore)(Fi,Pi,Pi),t=(0,K.useMemo)(()=>Object.values(e.runs),[e.runs]),n=t.length>0,r=z({...wr({client:W}),enabled:n,staleTime:tr}),i=(0,K.useMemo)(()=>new Map((r.data??[]).map(e=>[e.id,e.status])),[r.data]);if(!n)return null;let a=t.map(e=>({...e,status:i.get(e.runId)??e.lastAnnouncedStatus})),o=a.length===1?Ns(a[0].kind):`${a.length} active tasks`;return(0,q.jsxs)(`div`,{className:`task-center`,children:[(0,q.jsxs)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:[a.length,` active `,a.length===1?`task`:`tasks`,`.`,` `,a.map(e=>`${Ns(e.kind)} ${Ps(e.status)}`).join(`. `),`.`]}),(0,q.jsxs)(`details`,{className:`task-center-details`,children:[(0,q.jsxs)(`summary`,{className:`task-center-trigger`,children:[(0,q.jsx)(m,{className:`size-3.5 shrink-0 motion-safe:animate-spin`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`task-center-summary`,children:o}),(0,q.jsx)(`span`,{className:`task-center-count`,"aria-hidden":`true`,children:a.length}),(0,q.jsx)(b,{className:`task-center-chevron size-3.5 shrink-0`,"aria-hidden":`true`})]}),(0,q.jsxs)(`div`,{className:`task-center-panel`,children:[(0,q.jsxs)(`div`,{className:`task-center-heading`,children:[(0,q.jsx)(`span`,{children:`Active tasks`}),(0,q.jsx)(`span`,{className:`tabular-nums text-faint`,children:a.length})]}),(0,q.jsx)(`ul`,{className:`task-center-list`,children:a.map(e=>(0,q.jsxs)(`li`,{className:`task-center-item`,children:[(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`truncate text-copy-13-strong text-strong`,children:Ns(e.kind)}),(0,q.jsx)(`p`,{className:`mt-0.5 truncate text-copy-13 text-muted`,children:e.projectLabel??e.projectId})]}),(0,q.jsx)(En,{tone:e.status===`failed`?`negative`:e.status===`partial`?`caution`:`neutral`,children:Ps(e.status)})]},e.runId))}),(0,q.jsx)(V,{to:`/runs`,className:`task-center-footer-link`,children:`View all runs`})]})]})]})}var Is={scope:`all`,queryClass:`all`},Ls=[`all`,`non-brand`,`branded`];function Rs(e){return typeof e==`string`&&Ls.includes(e)}function zs(e){let t=Rs(e.class)?e.class:Is.queryClass,n=e.scope;if(typeof n!=`string`||n===`all`||n.length===0)return{scope:`all`,queryClass:t};let r=n.startsWith(`group:`)?n.slice(6):``;return r?{scope:`group`,groupKey:r,queryClass:t}:{scope:`all`,queryClass:t}}function Bs(e,t){return t===null||e===null?!1:e!==t}function Vs(e){return{scope:e.scope===`group`&&e.groupKey?`group:${e.groupKey}`:void 0,class:e.queryClass===Is.queryClass?void 0:e.queryClass}}function Hs(e,t){if(!(typeof e!=`string`||e.length>16384||!t))try{let n=JSON.parse(e);if(typeof n!=`object`||!n||Array.isArray(n))return;let r=n,i=e=>typeof e==`string`&&e.trim().length>0,a=e=>e===null||i(e);return r.queryKey!==t||!i(r.provider)||r.queryClass!==`branded`&&r.queryClass!==`non-brand`&&r.queryClass!==`unknown`||!a(r.model)||!a(r.location)||!a(r.runId)||r.revision!==null&&(typeof r.revision!=`number`||!Number.isSafeInteger(r.revision)||r.revision<=0)?void 0:{queryKey:t,queryClass:r.queryClass,provider:r.provider,model:r.model,location:r.location,runId:r.runId,revision:r.revision}}catch{return}}function Us(e){let t=t=>typeof e[t]==`string`&&e[t]!==``?e[t]:void 0,n=zs({scope:t(`scope`),class:t(`class`)}),r=t(`measurementScope`)??(n.scope===`group`?`group`:`project`),i=t(`measurementScopeKey`)??(t(`measurementScope`)?void 0:n.groupKey),a=t(`queryClass`)??t(`class`),o={measurementScope:i&&(r===`group`||r===`market`||r===`property`)?r:`project`,queryClass:a===`unknown`||Rs(a)?a:Is.queryClass};o.measurementScope!==`project`&&(o.measurementScopeKey=i);for(let[e,n]of[[`measurementMarketKey`,`marketKey`],[`measurementProvider`,`provider`],[`measurementModel`,`model`],[`measurementLocation`,`location`],[`measurementFrom`,`from`],[`measurementTo`,`to`],[`measurementRunId`,`measurementRunId`],[`measurementQueryKey`,`queryKey`]]){let r=t(e);r!==void 0&&(o[n]=r)}let s=Number(e.measurementRevision);Number.isSafeInteger(s)&&s>0&&(o.revision=s);let c=Hs(e.measurementAnswer,o.queryKey);return c&&(o.answer=c),o}function Ws(e){return{scope:e.measurementScope,scopeKey:e.measurementScopeKey,marketKey:e.marketKey,queryClass:e.queryClass,provider:e.provider,model:e.model,location:e.location,from:e.from,to:e.to,revision:e.revision,runId:e.measurementRunId,limit:25}}function Gs(e,t){let n={...e,...t};return[`measurementScope`,`measurementScopeKey`,`measurementMarketKey`,`queryClass`,`measurementProvider`,`measurementModel`,`measurementLocation`,`measurementFrom`,`measurementTo`,`measurementRevision`,`measurementRunId`].some(e=>e in t)?(n.measurementQueryKey=t.measurementQueryKey,n.measurementAnswer=t.measurementAnswer):`measurementQueryKey`in t&&!(`measurementAnswer`in t)&&(n.measurementAnswer=void 0),`measurementScope`in t&&(n.scope=void 0,`measurementMarketKey`in t||(n.measurementMarketKey=void 0),n.measurementQueryKey=void 0,t.measurementScope===`project`&&(n.measurementScopeKey=void 0)),`queryClass`in t&&(n.class=void 0),n}function Ks(e){return{...e,onboarding:void 0,manageQueries:void 0,siteHealthRunId:void 0,siteScan:void 0,setupProject:void 0}}function qs(e,t){let n=/\/properties\/([^/]+)/.exec(e),r=Us(t);if(n)return{view:`property`,selection:Bt.parse({scope:`property`,scopeKey:decodeURIComponent(n[1]),queryClass:r.queryClass,limit:10})};if(e.endsWith(`/technical-aeo`))return{view:`site-health`};if(e.endsWith(`/seo-data`)){let e=e=>{let n=t[e];return typeof n==`string`&&n?n:void 0},[n,r,i,a]=[e(`seoProfileId`),e(`seoRunId`),e(`seoRegion`),e(`seoMarket`)];return{view:`seo`,...n?{seoProfileId:n}:{},...r?{seoRunId:r}:{},...i?{seoRegionKey:i}:{},...a?{seoMarketKey:a}:{}}}if(e.endsWith(`/queries`)&&t.queryWorkspace===`research`)return{view:`project`};let i=/^\/projects\/[^/]+\/?$/.test(e);if(i||e.endsWith(`/queries`)){let t=Bt.safeParse(Ws(e.endsWith(`/queries`)?{measurementScope:r.measurementScope,measurementScopeKey:r.measurementScopeKey,queryClass:r.queryClass}:r));return{view:i?`visibility`:`queries`,...t.success?{selection:t.data}:{unavailableReason:`The current measurement filters are invalid. Correct them before asking Aero about this view.`}}}return{view:`project`}}var Js=e(me(),1);function Ys(e,t={}){let{threshold:n=80}=t,r=(0,K.useRef)(null),i=(0,K.useRef)({scrollHeight:0,wasAtEnd:!0});function a(e){return e.scrollHeight-e.scrollTop-e.clientHeight}function o(){let e=r.current;return!e||a(e)<=n}function s(){let e=r.current;e&&(e.scrollTop=e.scrollHeight,i.current.wasAtEnd=!0,i.current.scrollHeight=e.scrollHeight)}return(0,K.useEffect)(()=>{let e=r.current;if(!e)return;let t=()=>{i.current.wasAtEnd=a(e)<=n};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[n]),(0,K.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=e.scrollHeight;t>i.current.scrollHeight&&i.current.wasAtEnd&&(e.scrollTop=t),i.current.scrollHeight=t},e),(0,K.useEffect)(()=>{let e=r.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{let t=e.scrollHeight;t>i.current.scrollHeight&&i.current.wasAtEnd&&(e.scrollTop=t),i.current.scrollHeight=t});return t.observe(e),e.firstElementChild&&t.observe(e.firstElementChild),()=>t.disconnect()},[]),{ref:r,scrollToEnd:s,isAtEnd:o}}var Xs=`AI Visibility checks are run by your Canonry team`,Zs=`Scans are run by your Canonry team`,Qs=`Next check unavailable`,$s=`Check running…`,ec=`Next check:`;function tc(e,t){try{return new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,timeZone:t??`UTC`}).format(new Date(e))}catch{return null}}function nc({projectName:e,kind:t=U[`answer-visibility`],running:n=!1,loadSchedule:r=!0}){let i=t===U[`site-audit`],a=z({...mr({client:W,path:{name:e},query:{kind:t}}),enabled:r&&!!e,retry:!1,refetchInterval:6e4}),o=a.isError?void 0:a.data,s=o?.enabled&&o.nextRunAt?new Date(o.nextRunAt):null,c=s&&Number.isFinite(s.getTime())?i?s.toLocaleString(`en-GB`,{weekday:`long`,day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`,timeZone:`UTC`,hourCycle:`h23`}):tc(s.toISOString(),o?.timezone):null,l=(a.error instanceof Ut?a.error.code:a.error?.error?.code)===`NOT_FOUND`,u=!c||l||!o?.enabled;return(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,role:`status`,children:i?(0,q.jsxs)(q.Fragment,{children:[n&&(0,q.jsx)(`span`,{className:`text-neutral`,children:`Scan running… · `}),c&&s?(0,q.jsxs)(q.Fragment,{children:[`Next scan `,(0,q.jsxs)(`time`,{dateTime:s.toISOString(),children:[c,` UTC`]}),` · managed by your Canonry team`]}):Zs]}):n?$s:u?Qs:c&&s?(0,q.jsxs)(q.Fragment,{children:[ec,` `,(0,q.jsx)(`time`,{dateTime:s.toISOString(),children:c})]}):Qs})}var rc=300,ic=400,ac=900,oc=32,sc=28,cc=0;function lc(){return new DOMException(`Preview stopped`,`AbortError`)}function uc(e,t){return t?.aborted?Promise.reject(lc()):new Promise((n,r)=>{let i=()=>{clearTimeout(a),r(lc())},a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e);t?.addEventListener(`abort`,i,{once:!0})})}function dc(e){let t=e.match(/\S+\s*|\s+/g)??[];if(t.length<2)return[];let n=Math.ceil(t.length/oc),r=[];for(let e=n;e<t.length;e+=n)r.push(t.slice(0,e).join(``));return r}function fc(e){return typeof e==`string`?e:JSON.stringify(e??null)}async function pc({starter:e,signal:t,onEvent:n,reducedMotion:r=!1}){let i=async e=>{if(t?.aborted)throw lc();r||await uc(e,t)},a=Date.now(),o=++cc;await i(rc);for(let[t,r]of e.steps.entries()){let{name:a,label:s,arguments:c,result:l,durationMs:u}=r.tool,d=`preview-${e.id}-${o}-${t}`;n({type:`message_end`,message:{role:`assistant`,timestamp:Date.now(),stopReason:`toolUse`,content:[...r.text?[{type:`text`,text:r.text}]:[],{type:`toolCall`,id:d,name:a,arguments:c}]}}),n({type:`tool_execution_start`,toolCallId:d,toolName:a,label:s,args:c}),await i(Math.min(ac,Math.max(ic,u))),n({type:`tool_execution_end`,toolCallId:d,toolName:a,result:l,isError:!1}),n({type:`message_end`,message:{role:`toolResult`,toolCallId:d,timestamp:Date.now(),isError:!1,aeroToolLabel:s,aeroDurationMs:u,content:[{type:`text`,text:fc(l)}]}})}if(!r){for(let t of dc(e.answer))await i(sc),n({type:`message_update`,message:{role:`assistant`,content:[{type:`text`,text:t}]},assistantMessageEvent:{}});await i(sc)}n({type:`message_end`,message:{role:`assistant`,timestamp:Date.now(),stopReason:`stop`,content:[{type:`text`,text:e.answer}]}}),n({type:`aero_turn_status`,status:{reason:`completed`,toolCalls:e.steps.length,modelCalls:e.steps.length+1,durationMs:Date.now()-a}})}function mc(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}async function hc(e){try{return await e.json()}catch{return{}}}function gc(){return typeof window<`u`&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath.replace(/\/$/,``)+`/api/v1`:`/api/v1`}var _c=gc();function vc(e){e===401&&nn()}async function yc(e){let t=await fetch(`${_c}/projects/${encodeURIComponent(e)}/agent/transcript`,{credentials:`include`});if(!t.ok){vc(t.status);let e=await hc(t);throw new Ut(e.error?.message??`transcript fetch failed: ${t.status}`,t.status,e.error?.code)}return await t.json()}async function bc(e){let t=await fetch(`${_c}/projects/${encodeURIComponent(e)}/agent/preview`,{credentials:`include`});if(!t.ok){vc(t.status);let e=await hc(t);throw new Ut(e.error?.message??`preview fetch failed: ${t.status}`,t.status,e.error?.code)}return await t.json()}async function xc(e){let t=await fetch(`${_c}/projects/${encodeURIComponent(e)}/agent/transcript`,{method:`DELETE`,credentials:`include`});if(!t.ok){vc(t.status);let e=await hc(t);throw new Ut(e.error?.message??`reset failed: ${t.status}`,t.status,e.error?.code)}}async function Sc({project:e,prompt:t,conversationId:n,provider:r,modelId:i,scope:a,profile:o,context:s,limits:c,signal:l,onEvent:u}){let d={prompt:t};n!==void 0&&(d.conversationId=n),r&&(d.provider=r),i&&(d.modelId=i),a&&(d.scope=a),o&&(d.profile=o),s&&(d.context=s),c&&(d.limits=c);let f=await fetch(`${_c}/projects/${encodeURIComponent(e)}/agent/prompt`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify(d),signal:l});if(!f.ok||!f.body){vc(f.status),bt({method:`POST`,route:`/api/v1/projects/{name}/agent/prompt`,status:f.status});let e=await hc(f);throw new Ut(e.error?.message??`prompt failed: ${f.status}`,f.status,e.error?.code)}We(`aero.send`);let p=!1,m=f.body.getReader(),h=new TextDecoder,g=``,_=()=>{m.cancel().catch(()=>{})};l?.addEventListener(`abort`,_,{once:!0}),l?.aborted&&_();try{for(;;){let{value:e,done:t}=await m.read();if(t)break;g+=h.decode(e,{stream:!0});let n=g.indexOf(`
13
+ `),t=[],n=[],r=0,i=()=>{if(n.length===0)return;let e=n.join(` `).trim();e&&t.push((0,q.jsx)(`p`,{className:t.length>0?`mt-2.5`:``,children:bo(e,j)},r++)),n=[]};for(let a of e){let e=a.trim();if(/^[-\u2013\u2014]{3,}$/.test(e)){i(),t.push((0,q.jsx)(`hr`,{className:`border-default my-3`},r++));continue}let o=e.match(/^(#{1,3})\s+(\S.*)$/);if(o){i();let e=o[1].length,n=o[2].replace(/^[\p{Emoji}\p{Emoji_Component}\s]+/u,``).trim()||o[2],a=e===1?`text-label-13-strong text-heading mt-4 mb-1`:e===2?`text-label-12-strong text-strong mt-3 mb-0.5`:`text-label-12-strong text-neutral mt-2`;t.push((0,q.jsx)(`p`,{className:a,children:bo(n,j)},r++))}else e===``?i():n.push(e)}return i(),t})()}),C.answerSnippet.length>280&&(0,q.jsx)(`button`,{type:`button`,className:`mt-1.5 text-button-14 text-muted hover:text-neutral transition-colors`,onClick:()=>i(!r),children:r?`↑ Collapse`:`↓ Show full answer`})]}),!C.answerSnippet&&!d&&(0,q.jsx)(`div`,{className:`material-base px-4 py-8 text-center text-faint text-label-14`,children:`No answer text recorded for this run`}),C.searchQueries.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`drawer-section-label flex items-center`,children:[(0,q.jsx)(`span`,{children:`Web searches the model ran`}),(0,q.jsx)(kr,{text:`The search queries this AI model issued while researching your prompt. They reveal how the model reformulated your query — the phrasings worth optimizing your content for. Distinct from grounding sources (what it found) and citations (what it linked).`})]}),(0,q.jsx)(`ul`,{className:`grid gap-1`,children:C.searchQueries.map((e,t)=>(0,q.jsxs)(`li`,{className:`flex items-start gap-2 text-label-14 text-neutral`,children:[(0,q.jsx)(A,{className:`size-3.5 mt-0.5 shrink-0 text-faint`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`break-words`,children:e})]},`${t}-${e}`))})]}),!S&&e.relatedTechnicalSignals.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`drawer-section-label`,children:T?`Why you're visible`:`What to fix`}),(0,q.jsx)(`div`,{className:`action-items-list`,children:e.relatedTechnicalSignals.map((e,t)=>(0,q.jsxs)(`div`,{className:`action-item`,children:[(0,q.jsx)(`svg`,{className:`action-item-icon ${T?`text-positive-400`:`text-caution-400`}`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:T?(0,q.jsx)(`path`,{d:`M3 8l3.5 3.5L13 4.5`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`circle`,{cx:`8`,cy:`8`,r:`7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,q.jsx)(`path`,{d:`M8 5v3.5M8 10.5v0`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})]})}),(0,q.jsx)(`span`,{className:`action-item-text`,children:e})]},t))})]}),C.summary&&(0,q.jsx)(`p`,{className:`text-copy-13 text-faint border-t border-subtle pt-3 mt-1`,children:C.summary})]}),(0,q.jsxs)(`div`,{className:`evidence-modal-sidebar`,children:[(E||D)&&(0,q.jsxs)(`div`,{className:`sidebar-tabs`,children:[(0,q.jsx)(`button`,{className:`sidebar-tab ${a===`mentions`?`sidebar-tab--active`:``}`,onClick:()=>o(`mentions`),type:`button`,title:`Canonry's answer-level visibility assessment and any company names extracted from the answer text.`,children:`Mentions`}),(0,q.jsx)(`button`,{className:`sidebar-tab ${a===`sources`?`sidebar-tab--active`:``}`,onClick:()=>o(`sources`),type:`button`,title:`Grounding links the model used to build the answer. These are supporting sources, not the primary visibility signal.`,children:`Sources`})]}),a===`mentions`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`drawer-section-label flex items-center`,children:[(0,q.jsx)(`span`,{children:`Mention in answer`}),(0,q.jsx)(kr,{text:`Canonry scans the AI answer for your owned domains and project name. This is independent from grounding or citation sources.`})]}),(0,q.jsxs)(`div`,{className:`mention-status mention-status--${T?`mentioned`:`not-mentioned`}`,children:[(0,q.jsx)(`span`,{className:`mention-status-icon`,children:w?`…`:T?`✓`:`—`}),(0,q.jsx)(`span`,{className:`mention-status-label`,children:w?`Pending`:T?`Mentioned`:`Not mentioned`})]}),!w&&!T&&C.mentionIdentity===`wrong-subject`&&(0,q.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1 text-label-12 text-muted`,children:[(0,q.jsx)(`span`,{children:mo.label}),(0,q.jsx)(kr,{text:mo.project})]}),C.matchedTerms.length>0&&(0,q.jsxs)(`div`,{className:`mt-2`,children:[(0,q.jsx)(`p`,{className:`text-label-12 normal-case text-muted mb-1.5`,children:`Matched in answer`}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:C.matchedTerms.map(e=>(0,q.jsx)(`span`,{className:`mention-chip mention-chip--brand`,children:e},e))})]}),!w&&!T&&C.matchedTerms.length===0&&(0,q.jsxs)(`div`,{className:`mt-2`,children:[(0,q.jsx)(`p`,{className:`text-label-12 normal-case text-muted mb-1.5`,children:`Searched for`}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:k.map(e=>(0,q.jsx)(`span`,{className:`mention-chip mention-chip--muted`,children:e},e))}),(0,q.jsx)(`p`,{className:`text-copy-13 text-faint mt-1.5`,children:`None of these appear in the answer text.`})]})]}),(C.recommendedCompetitors.length>0||C.mentionedCompetitorDomains.length>0)&&(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`drawer-section-label flex items-center`,children:[(0,q.jsx)(`span`,{children:`Competitors in answer`}),(0,q.jsx)(kr,{text:`Competitors detected in the answer text. Includes tracked competitor brands and names extracted by Canonry; source-link competitors stay in the Sources tab.`})]}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(()=>{let e=C.mentionedCompetitorDomains.map(e=>e.replace(/^www\./,``)),t=new Set(e.map(e=>Hn(e.replace(/\.[^.]+$/,``))));return[...C.recommendedCompetitors.filter(e=>!t.has(Hn(e))),...e].map(e=>(0,q.jsx)(`span`,{className:`mention-chip mention-chip--competitor`,children:e},e))})()})]})]}),a===`sources`&&(0,q.jsxs)(q.Fragment,{children:[C.citedDomains.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`drawer-section-label flex items-center`,children:[(0,q.jsx)(`span`,{children:`Domains from source links`}),(0,q.jsx)(kr,{text:`These domains were extracted from grounding or citation URLs. They are supporting-source metadata, not proof that the answer text mentioned them.`})]}),(0,q.jsx)(`div`,{className:`citation-leaderboard`,children:C.citedDomains.map((e,t)=>{let n=e.toLowerCase().replace(/^www\./,``),r=g.has(n),i=!r&&C.citedCompetitorDomains.some(e=>e.toLowerCase().replace(/^www\./,``)===n);return(0,q.jsxs)(`div`,{className:`citation-leaderboard-item citation-leaderboard-item--${r?`you`:i?`competitor`:`other`}`,children:[(0,q.jsxs)(`span`,{className:`citation-leaderboard-rank`,children:[`#`,t+1]}),(0,q.jsx)(`span`,{className:`citation-leaderboard-domain`,children:e}),r&&(0,q.jsx)(`span`,{className:`citation-leaderboard-tag`,children:`You`}),i&&(0,q.jsx)(`span`,{className:`citation-leaderboard-tag`,children:`Competitor`})]},e)})})]}),C.groundingSources.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`drawer-section-label flex items-center`,children:[(0,q.jsxs)(`span`,{children:[`Grounding source links (`,C.groundingSources.length,`)`]}),(0,q.jsx)(kr,{text:`Links the model used as grounding or supporting context while producing the answer. These are not the same thing as answer visibility.`})]}),(0,q.jsx)(`ul`,{className:`grid min-w-0 gap-3`,children:C.groundingSources.map((e,t)=>(0,q.jsx)(`li`,{className:`min-w-0`,children:(0,q.jsx)(go,{url:e.uri,title:e.title})},t))})]}),C.evidenceUrls.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`drawer-section-label`,children:`Evidence URLs`}),(0,q.jsx)(`ul`,{className:`grid min-w-0 gap-3`,children:C.evidenceUrls.map(e=>(0,q.jsx)(`li`,{className:`min-w-0`,children:(0,q.jsx)(go,{url:e})},e))})]}),C.citedDomains.length===0&&C.groundingSources.length===0&&C.evidenceUrls.length===0&&(0,q.jsxs)(`div`,{className:`flex items-center justify-center h-24 text-faint text-label-14`,children:[`No source data `,S?`for this run`:`yet`]})]}),!E&&!D&&(0,q.jsxs)(`div`,{className:`flex items-center justify-center h-24 text-faint text-label-14`,children:[`No answer visibility data `,S?`for this run`:`yet`]})]})]})]})]})]})})}function To(e){let t=e.match(/^\/projects\/([^/]+)/);if(!t)return null;try{return decodeURIComponent(t[1])}catch{return t[1]}}function Eo(e,t){return e?(t?.projects.find(t=>t.project.name===e||t.project.id===e))?.project.name??e:null}function Do(e,t){return Eo(To(e),t)}function Oo(e){let t=new Date(`2026-02-20`);return e.map((e,n)=>({runId:`run_mock_${n+1}`,citationState:e,createdAt:new Date(t.getTime()+n*2*24*60*60*1e3).toISOString()}))}var ko=[{id:`project_citypoint`,name:`Citypoint Dental NYC`,canonicalDomain:`citypointdental.com`,ownedDomains:[],aliases:[],qualifiedAliases:[],country:`US`,language:`en`,tags:[`local intent`,`priority`],labels:{},providers:[],providerModels:{},providerDispatchModes:{},measurement:Re,locations:[],defaultLocation:null,autoExtractBacklinks:!1,siteAuditMaxPages:null,configSource:`cli`,configRevision:1},{id:`project_harbor`,name:`Harbor Legal Group`,canonicalDomain:`harborlegal.com`,ownedDomains:[],aliases:[],qualifiedAliases:[],country:`US`,language:`en`,tags:[`lead gen`],labels:{},providers:[],providerModels:{},providerDispatchModes:{},measurement:Re,locations:[],defaultLocation:null,autoExtractBacklinks:!1,siteAuditMaxPages:null,configSource:`cli`,configRevision:1},{id:`project_northstar`,name:`Northstar Orthopedics`,canonicalDomain:`northstarortho.com`,ownedDomains:[],aliases:[],qualifiedAliases:[],country:`US`,language:`en`,tags:[`multi-location`],labels:{},providers:[],providerModels:{},providerDispatchModes:{},measurement:Re,locations:[],defaultLocation:null,autoExtractBacklinks:!1,siteAuditMaxPages:null,configSource:`cli`,configRevision:1}];function Ao(e){return{id:e.id,projectId:e.projectId,projectName:e.projectName,kind:e.kind,kindLabel:e.kindLabel,status:e.status,trigger:e.trigger??`manual`,createdAt:e.createdAt,startedAt:e.startedAt,duration:e.duration,statusDetail:e.statusDetail,summary:e.summary,triggerLabel:e.triggerLabel,opensSeoWorkspace:!1}}Ao({id:`run_citypoint_visibility_20260308`,projectId:`project_citypoint`,projectName:`Citypoint Dental NYC`,kind:`answer-visibility`,kindLabel:`AI Visibility check`,status:`completed`,createdAt:`2026-03-08T12:15:00.000Z`,startedAt:`Mar 8, 12:15 PM`,duration:`6 minutes 12 seconds`,statusDetail:`18 tracked queries checked; 3 citation losses detected on emergency-intent prompts.`,summary:`Citation losses on emergency-intent prompts`,triggerLabel:`Scheduled`}),Ao({id:`run_citypoint_queued_20260309`,projectId:`project_citypoint`,projectName:`Citypoint Dental NYC`,kind:`answer-visibility`,kindLabel:`AI Visibility check`,status:`queued`,createdAt:`2026-03-09T08:05:00.000Z`,startedAt:`Mar 9, 8:05 AM`,duration:`Waiting`,statusDetail:`Ready to enqueue after the next provider rate window clears.`,summary:`Queued follow-up after local ranking movement`,triggerLabel:`Manual`}),Ao({id:`run_harbor_visibility_20260308`,projectId:`project_harbor`,projectName:`Harbor Legal Group`,kind:`answer-visibility`,kindLabel:`AI Visibility check`,status:`completed`,createdAt:`2026-03-08T11:05:00.000Z`,startedAt:`Mar 8, 11:05 AM`,duration:`5 minutes 7 seconds`,statusDetail:`12 tracked queries checked; local-intent visibility held steady across branded prompts.`,summary:`Branded prompts remain stable`,triggerLabel:`Scheduled`}),Ao({id:`run_northstar_visibility_20260308`,projectId:`project_northstar`,projectName:`Northstar Orthopedics`,kind:`answer-visibility`,kindLabel:`AI Visibility check`,status:`running`,createdAt:`2026-03-08T13:40:00.000Z`,startedAt:`Mar 8, 1:40 PM`,duration:`Running`,statusDetail:`Provider responses still in flight for 9 multi-location prompts.`,summary:`Mid-run on treatment-location prompts`,triggerLabel:`Manual`}),Oo([`cited`,`cited`,`cited`,`cited`,`cited`,`cited`,`cited`,`not-cited`,`not-cited`]),Oo([`not-cited`,`cited`,`cited`,`cited`,`cited`,`cited`,`cited`]),Oo([`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`]),Oo([`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`cited`]),Oo([`cited`,`cited`,`cited`,`cited`,`cited`,`cited`,`cited`,`cited`]),Oo([`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`]),Oo([`not-cited`,`not-cited`,`not-cited`,`not-cited`]),Oo([`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`]),Oo([`not-cited`,`not-cited`,`not-cited`,`not-cited`,`not-cited`,`cited`]),ko[0],ko[1],Oo([`cited`,`cited`,`cited`,`cited`,`cited`]),ko[2],Oo([`not-cited`,`not-cited`,`not-cited`,`cited`]),ko[0],ko[1],ko[2];function jo(e,t){return e.runs.find(e=>e.id===t)}function Mo(e,t){for(let n of e.projects){let e=n.visibilityEvidence.find(e=>e.id===t);if(e)return{project:n,evidence:e}}}function No(e,t,n){if(e){let t=e.visibilityEvidence.find(e=>e.id===n);if(t)return{project:e,evidence:t}}if(t)return Mo(t,n)}var X={regression:`negative`,gain:`positive`,opportunity:`caution`,"first-citation":`positive`,"provider-pickup":`positive`,"persistent-gap":`caution`,"competitor-gained":`negative`,"competitor-lost":`neutral`,"gbp-lodging-gap":`negative`,"gbp-listing-discrepancy":`negative`,"gbp-cta-gap":`caution`,"gbp-description-missing":`caution`,"gbp-metric-drop":`negative`,"gbp-keyword-drop":`negative`},Po={regression:`lost`,gain:`emerging`,opportunity:`not-cited`,"first-citation":`emerging`,"provider-pickup":`emerging`,"persistent-gap":`not-cited`,"competitor-gained":`cited`,"competitor-lost":`not-cited`,"gbp-lodging-gap":`not-cited`,"gbp-listing-discrepancy":`not-cited`,"gbp-cta-gap":`not-cited`,"gbp-description-missing":`not-cited`,"gbp-metric-drop":`lost`,"gbp-keyword-drop":`lost`},Fo={regression:!0,gain:!0,opportunity:!0,"first-citation":!0,"provider-pickup":!0,"persistent-gap":!0,"competitor-gained":!1,"competitor-lost":!1,"gbp-lodging-gap":!1,"gbp-listing-discrepancy":!1,"gbp-cta-gap":!1,"gbp-description-missing":!1,"gbp-metric-drop":!1,"gbp-keyword-drop":!1},Io={regression:`Regression`,gain:`Gain`,opportunity:`Opportunity`,"first-citation":`First citation`,"provider-pickup":`Pickup`,"persistent-gap":`Gap`,"competitor-gained":`Competitor`,"competitor-lost":`Competitor`,"gbp-lodging-gap":`Lodging gap`,"gbp-listing-discrepancy":`Listing gap`,"gbp-cta-gap":`Booking CTA`,"gbp-description-missing":`Description gap`,"gbp-metric-drop":`Metric drop`,"gbp-keyword-drop":`Keyword drop`};function Lo(e){return{id:e.id,tone:X[e.type],title:e.title,detail:e.cause?.details??e.cause?.cause??``,actionLabel:e.recommendation?.action??Io[e.type],actionGroup:Tt[e.type],affectedPhrases:[{query:e.query,evidenceId:``,provider:e.provider,citationState:Po[e.type],siteCitation:Fo[e.type]}]}}function Ro(e){return e.filter(e=>!e.dismissed).map(Lo)}function zo(e){return{id:e.id,name:e.name,displayName:e.displayName,canonicalDomain:e.canonicalDomain,ownedDomains:e.ownedDomains??[],aliases:e.aliases??[],qualifiedAliases:e.qualifiedAliases,country:e.country,language:e.language,tags:e.tags,labels:e.labels,providers:e.providers??[],providerModels:e.providerModels??{},providerDispatchModes:e.providerDispatchModes??{},measurement:e.measurement,locations:e.locations??[],defaultLocation:e.defaultLocation??null,autoExtractBacklinks:e.autoExtractBacklinks??!1,siteAuditMaxPages:e.siteAuditMaxPages??null,configSource:e.configSource,configRevision:e.configRevision,createdAt:e.createdAt,updatedAt:e.updatedAt}}function Bo(e,t){return`${e} ${t}${e===1?``:`s`}`}function Vo(e,t){if(!e)return`Waiting`;if(!t)return`Running`;let n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return`under 1 second`;let r=Math.floor(n/1e3),i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60;return i>0?a>0?`${Bo(i,`hour`)} ${Bo(a,`minute`)}`:Bo(i,`hour`):a>0?o>0?`${Bo(a,`minute`)} ${Bo(o,`second`)}`:Bo(a,`minute`):Bo(o,`second`)}function Ho(e){switch(e){case U[`answer-visibility`]:return`AI Visibility check`;case U[`gsc-sync`]:return`GSC sync`;case U[`inspect-sitemap`]:return`Sitemap inspection`;case U[`ga-sync`]:return`GA sync`;case U[`traffic-sync`]:return`Traffic sync`;case U[`bing-inspect`]:return`Bing URL inspection`;case U[`bing-inspect-sitemap`]:return`Bing sitemap inspection`;case U[`bing-sync`]:return`Bing data sync`;case U[`site-audit`]:return`Technical AEO audit`;case U[`backlink-extract`]:return`Backlink extract`;case U[`aeo-discover-seed`]:return`Discovery (seed phase)`;case U[`aeo-discover-probe`]:return`Discovery (probe phase)`;case U[`gbp-sync`]:return`Business Profile sync`;case U[`ads-sync`]:return`ChatGPT ads sync`;case U[`google-ads-sync`]:return`Google Ads sync`;case U[`gtm-sync`]:return`Tag Manager sync`;case U[`seo-sync`]:return`SEO data refresh`;default:return`Unknown job type`}}function Uo(e){switch(e){case ut.manual:return`Manual`;case ut.scheduled:return`Scheduled`;case ut[`config-apply`]:return`Config apply`;case ut.probe:return`Spot check`;default:return e}}function Wo(e,t){return{id:e.id,projectId:e.projectId,projectName:t,kind:e.kind,kindLabel:Ho(e.kind),status:e.status,trigger:e.trigger??`manual`,location:e.location??null,createdAt:e.createdAt,startedAt:Wn(e.startedAt||e.createdAt),duration:Vo(e.startedAt??null,e.finishedAt??null),statusDetail:e.error?Go(e.error):Ko(e),summary:qo(e),triggerLabel:Uo(e.trigger),opensSeoWorkspace:e.kind===U[`seo-sync`]&&!(e.status===H.failed&&!e.startedAt)}}function Go(e){let t=cn(e);return t.length>200?t.slice(0,200)+`…`:t}function Ko(e){if(e.kind===U[`seo-sync`])return`View the saved scope and task results in SEO.`;switch(e.status){case H.queued:return`Waiting for execution slot.`;case H.running:return`Provider queries in progress.`;case H.completed:return`All queries checked.`;case H.partial:return`Run completed with some queries skipped.`;case H.failed:return e.error?Go(e.error):`Run failed.`;case H.cancelled:return`Run was cancelled.`;default:return``}}function qo(e){let t=Ho(e.kind);switch(e.status){case H.queued:return`${t} queued`;case H.running:return`${t} in progress`;case H.completed:return`${t} completed`;case H.partial:return`${t} partially completed`;case H.failed:return`${t} failed`;case H.cancelled:return`${t} cancelled`;default:return e.status}}function Jo(e,t,n,r,i){let a=[],o=0,s=new Set;if(n.length>0){let r=n.flatMap(e=>e.snapshots??[]),c=new Map;for(let e of r)if(e.query){let t=`${e.query}::${e.provider}::${e.location??``}`;c.set(t,e)}let l=new Set(r.map(e=>e.location??null));l.size===0&&l.add(null);let u=new Set(r.map(e=>e.provider)),d=new Set(t.flatMap(e=>Object.keys(e.providerRuns??{}))),f=[...new Set([...u,...d])].sort(),p=f.length>0?f:[`gemini`],m=new Set(r.flatMap(e=>e.query?[e.query]:[]));for(let n of t){if(n.runs.length===0&&!m.has(n.query))continue;s.add(n.query);let t=n.runs.at(-1),r=t?.transition??`not-cited`;for(let s of p){let u=[...l].filter(e=>c.has(`${n.query}::${s}::${e??``}`)),d=(n.providerRuns?.[s]?.length??0)>0,f=u.length>0?u:d?[null]:[];for(let l of f){let d=l??``,f=c.get(`${n.query}::${s}::${d}`),p=f?.model??null,m=p?`${s}:${p}`:null,h=n.providerRuns?.[s],g=m?n.modelRuns?.[m]:void 0,_=e=>e?.filter(e=>(e.location??null)===l),v=u.length>0?_(h):h,y=u.length>0?_(g):g,b=(v?.length?v:null)??(y?.length?y:null),x=v?.length?`provider`:y?.length?`model`:`query`,S=f&&b?b.findIndex(e=>e.runId===f.runId):-1,C=f?S>=0?b.slice(0,S+1):null:b,w=f!==void 0&&C===null,T=C?C.at(-1).transition:w?f.citationState===Ct.cited?`cited`:`not-cited`:r,E=C?C.at(-1).visibilityTransition??(C.at(-1).visibilityState===`visible`?`visible`:`not-visible`):w?f.visibilityState===`visible`?`visible`:`not-visible`:t?.visibilityTransition??(t?.visibilityState===`visible`?`visible`:`not-visible`),D=b?.at(-1)?.citationState,O=b?.at(-1)?.visibilityState,k=f?T===`lost`?`lost`:T===`emerging`?`emerging`:f.citationState===Ct.cited?`cited`:`not-cited`:D===Ct.cited?`cited`:`not-cited`,A=f?.visibilityState??(O===`visible`?`visible`:O===`pending`?`pending`:`not-visible`),ee=C?Qo(C):w?1:Qo(n.runs),j=C?$o(C):w?1:$o(n.runs),te=Yo(n,s),ne=(b??n.runs).map(e=>({runId:e.runId,citationState:e.citationState,createdAt:e.createdAt,model:te.get(e.runId)??null,answerMentioned:e.answerMentioned,visibilityState:e.visibilityState,visibilityTransition:e.visibilityTransition,mentionState:e.mentionState,mentionTransition:e.mentionTransition})),M=Xo(ne),re=x===`provider`&&M.length<=1?`model`:x,ie=Zo(ne),N=f?.citedCompetitorDomains??[],P=f?.mentionedCompetitorDomains??[],ae=[...new Set([...N,...P,...f?.competitorOverlap??[]])];a.push({id:`evidence_${e}_${o++}`,query:n.query,queryId:f?.queryId??null,sourceSnapshotId:f?.id??null,sourceRunId:f?.runId??null,queryClass:i?.classify(n.query)??null,provider:f?.provider??s,model:f?.model??null,location:f?.location??l,citationState:k,answerMentioned:f?.answerMentioned,visibilityState:A,visibilityChangeLabel:es(E,j,{positive:`visible`,negative:`not visible`,first:`first visibility`}),changeLabel:es(T,ee),answerSnippet:f?.answerText??``,citedDomains:f?.citedDomains??[],evidenceUrls:f?.citedUrls??[],citedCompetitorDomains:N,mentionedCompetitorDomains:P,mentionedCompetitorTerms:f?.mentionedCompetitorTerms??[],competitorDomains:ae,recommendedCompetitors:f?.recommendedCompetitors??[],matchedTerms:f?.matchedTerms??[],mentionIdentity:f?.mentionIdentity??null,relatedTechnicalSignals:[],groundingSources:f?.groundingSources??[],searchQueries:f?.searchQueries??[],summary:ns(A,E,n.query),runHistory:ne,historyScope:re,modelsSeen:M,modelTransitions:ie})}}}}for(let t of r)s.has(t.query)||a.push({id:`evidence_${e}_${o++}`,query:t.query,queryId:t.id,sourceSnapshotId:null,sourceRunId:null,queryClass:i?.classify(t.query)??null,provider:``,model:null,location:null,citationState:`pending`,visibilityState:`pending`,visibilityChangeLabel:`Awaiting first run`,changeLabel:`Awaiting first run`,answerSnippet:``,citedDomains:[],evidenceUrls:[],citedCompetitorDomains:[],mentionedCompetitorDomains:[],mentionedCompetitorTerms:[],competitorDomains:[],recommendedCompetitors:[],matchedTerms:[],relatedTechnicalSignals:[],groundingSources:[],searchQueries:[],summary:`"${t.query}" has been added but no visibility run has been triggered yet.`,runHistory:[],historyScope:`query`,modelsSeen:[],modelTransitions:[]});return a}function Yo(e,t){let n=new Map,r=`${t}:`;for(let[t,i]of Object.entries(e.modelRuns??{})){if(!t.startsWith(r))continue;let e=t.slice(r.length),a=e===`unknown`?null:e;for(let e of i)n.set(e.runId,a)}return n}function Xo(e){let t=new Set;for(let n of e)n.model&&t.add(n.model);return[...t]}function Zo(e){let t=[],n=null;for(let r of e){let e=r.model??null;e!==n&&n!==null&&t.push({runId:r.runId,createdAt:r.createdAt,fromModel:n,toModel:e}),n=e}return t}function Qo(e){if(e.length===0)return 0;let t=e[e.length-1].citationState,n=0;for(let r=e.length-1;r>=0&&e[r].citationState===t;r--)n++;return n}function $o(e){if(e.length===0)return 0;let t=e[e.length-1].visibilityState??`not-visible`,n=0;for(let r=e.length-1;r>=0&&(e[r].visibilityState??`not-visible`)===t;r--)n++;return n}function es(e,t,n){let r={positive:n?.positive??`cited`,negative:n?.negative??`not cited`,first:n?.first??`first citation`};switch(e){case`new`:return`First observation`;case`cited`:case`visible`:return t<=1?`${ts(r.positive)} in latest run`:`${ts(r.positive)} for ${t} runs`;case`lost`:return`Lost since last run`;case`emerging`:return ts(r.first);case`not-cited`:case`not-visible`:return t<=1?`${ts(r.negative)} in latest run`:`${ts(r.negative)} across ${t} runs`;default:return e}}function ts(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ns(e,t,n){switch(t){case`lost`:return`Mention was lost for "${n}". Your brand no longer appeared in the latest answer.`;case`emerging`:return`Your brand started appearing in AI answers for "${n}".`}switch(e){case`visible`:return`Your brand or domain is mentioned in AI answers for "${n}".`;case`pending`:return`"${n}" has been added but no run has been triggered yet.`;default:return`Your brand or domain was not mentioned in AI answers for "${n}".`}}function rs(e){let t=zo(e.project),n=ft(gt(e.project)),r=Jo(t.name,e.timeline,e.latestRunDetails,e.queries,n),i=[...e.runs].sort((e,t)=>t.createdAt.localeCompare(e.createdAt)).map(t=>Wo(t,e.project.displayName||e.project.name));return e.overview?as(t,e.overview,r,i):ss(t,r,i)}function is(e){return e.filter(e=>e.kind===U[`answer-visibility`]&&e.trigger!==ut.probe&&(e.status===H.completed||e.status===H.partial))}function as(e,t,n,r){let i=Ro(t.topInsights);for(let e of t.attentionItems)e.id.startsWith(`insight_`)||i.push({id:e.id,tone:e.tone,title:e.title,detail:e.detail,actionLabel:e.actionLabel,actionGroup:`investigate`,affectedPhrases:[]});return{project:e,contextLabel:t.contextLabel,mentionSummary:t.scores.mention,visibilitySummary:t.scores.visibility,mentionShareSummary:t.scores.mentionShare,queryCounts:{cited:t.queryCounts.citedQueries,total:t.queryCounts.totalQueries},gapQueries:t.scores.gapQueries,mentionGaps:t.scores.mentionGaps,indexCoverage:t.scores.indexCoverage,providerScores:t.providerScores,competitorPressure:t.scores.competitorPressure,runStatus:t.scores.runStatus,movementComparison:t.movementComparison,insights:i,visibilityEvidence:n,competitors:t.competitors.map(e=>({id:e.id,domain:e.domain,aliases:e.aliases??[],autoAliases:e.autoAliasNames??[],citationCount:e.citationCount,totalQueries:e.totalQueries,pressureLabel:e.pressureLabel,citedQueries:e.citedQueries,movement:``,notes:``})),recentRuns:r.slice(0,5),visibilitySweeps:is(r),suggestedQueries:t.suggestedQueries}}function os(){return{projectMentionSnapshots:0,competitorMentionSnapshots:0,combinedMentionSnapshots:0,perCompetitor:[],ranking:[],snapshotsWithAnswerText:0,snapshotsTotal:0,score:null}}function ss(e,t,n){let r={label:``,value:`No data`,delta:`Loading…`,tone:`neutral`,description:``,tooltip:``,trend:[]};return{project:e,contextLabel:`${e.country} / ${e.language.toUpperCase()}`,mentionSummary:{...r,label:`Mention Coverage`},visibilitySummary:{...r,label:`Citation Coverage`},mentionShareSummary:{...r,label:`Mention Share`,scope:`non-brand`,unavailable:!0,breakdown:os(),branded:os()},queryCounts:{cited:0,total:0},gapQueries:{...r,label:`Citation Gaps`},mentionGaps:{...r,label:`Mention Gaps`},indexCoverage:{...r,label:`Index Coverage`},providerScores:[],competitorPressure:{...r,label:`Competitor Pressure`},runStatus:{...r,label:`Run Status`},movementComparison:{hasPreviousRun:!1,comparable:!1,querySetChanged:!1,previousRunAt:null,currentQueryCount:0,previousQueryCount:0,comparableQueryCount:0,addedQueryCount:0,removedQueryCount:0,addedQueries:[],removedQueries:[]},insights:[],visibilityEvidence:t,competitors:[],recentRuns:n.slice(0,5),visibilitySweeps:is(n),suggestedQueries:{rows:[],totalCandidates:0,skippedAlreadyTracked:0}}}function cs(e){let t=zo(e.project),n=[...e.runs].sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),r=n.find(e=>e.kind===U[`answer-visibility`])??n[0]??e.overview?.latestRun?.run??void 0,i=e.project.displayName||e.project.name,a=r?Wo(r,i):ls(e.project.id,i),o=e.overview;if(!o)return{project:t,hasMeasurement:!1,mentionScore:0,mentionDelta:`No data`,mentionTone:`neutral`,lastRun:a,insight:`No runs completed yet.`,trend:[],competitorPressureLabel:`None`};let s=o.scores.mention,c=s.progress??0,l=o.queryCounts.mentionedQueries,u=o.queryCounts.totalQueries,d=o.providers.length;return{project:t,hasMeasurement:u>0&&s.progress!=null,mentionScore:c,mentionDelta:u>0?`${l} of ${u} queries`:`No data`,mentionTone:s.tone,providerCoverage:s.providerCoverage,lastRun:a,insight:u>0?`${l} of ${u} queries mentioned across ${d} provider${d===1?``:`s`}.`:`No runs completed yet.`,trend:s.trend??[],competitorPressureLabel:o.scores.competitorPressure.value,sentiment:o.sentiment}}function ls(e,t){return{id:`none`,projectId:e,projectName:t,kind:U[`answer-visibility`],kindLabel:`No runs yet`,status:H.queued,trigger:ut.manual,createdAt:``,startedAt:``,duration:``,statusDetail:``,summary:`No runs yet`,triggerLabel:``,opensSeoWorkspace:!1}}function us(e,t){let n=[],r=[],i=[];for(let t of e){r.push(rs(t)),i.push(cs(t));let e=[...t.runs].sort((e,t)=>t.createdAt.localeCompare(e.createdAt));for(let r of e)n.push(Wo(r,t.project.displayName||t.project.name))}n.sort((e,t)=>t.createdAt.localeCompare(e.createdAt));let a=e.length>0;return{portfolioOverview:{projects:i,attentionItems:a?ds(r):[{id:`attention_setup`,tone:`neutral`,title:`No projects yet`,detail:`Create your first project using the setup wizard, CLI, or API.`,actionLabel:`Open setup`,href:`/setup`}],recentRuns:n.slice(0,5),systemHealth:[{id:`api`,label:`API`,tone:`positive`,detail:`Connected`,meta:`Real-time data`},{id:`provider`,label:`Gemini`,tone:`positive`,detail:`Configured`,meta:`Provider active`}],...a?{}:{emptyState:{title:`No projects yet`,detail:`Canonry becomes useful after one project, a small query set, and one competitor list are in place.`,ctaLabel:`Launch setup`,ctaHref:`/setup`}}},projects:r,runs:n,setup:{healthChecks:[{id:`api`,label:`API reachable`,detail:`API is responding.`,state:`ready`,guidance:`Required for project creation and run history.`},{id:`provider`,label:`Provider configured`,detail:`Gemini key is configured.`,state:`ready`,guidance:`Required for AI Visibility checks.`}],projectDraft:{name:``,canonicalDomain:``,country:`US`,language:`en`},queryImportState:{mode:`paste`,queryCount:0,preview:[]},competitorDraft:{domains:[],notes:`Use the CLI to add competitors.`},launchState:{enabled:a,ctaLabel:a?`Trigger run`:`Create a project first`,summary:a?`Ready to run.`:`Create a project first to launch a run.`}},settings:{providerStatuses:(t?.providers??[]).map(e=>({name:e.name,displayName:e.displayName,...e.kind?{kind:e.kind}:{},keyUrl:e.keyUrl,modelHint:e.modelHint,model:e.model,defaultModel:e.defaultModel,state:e.configured?`ready`:`needs-config`,detail:e.configured?`Provider is configured.`:e.name.toLowerCase()===`local`?`Base URL is missing.`:`API key is missing.`,quota:e.quota})),google:{state:t?.google?.configured?`ready`:`needs-config`,detail:t?.google?.configured?`Google OAuth app credentials are configured. Project-level GSC connections can be created from the dashboard.`:`Google OAuth client ID and client secret are not configured yet.`},bing:{state:t?.bing?.configured?`ready`:`needs-config`,detail:t?.bing?.configured?`Bing Webmaster Tools API key is configured. Project-level Bing connections can be created from the dashboard.`:`Bing Webmaster Tools API key is not configured yet.`},selfHostNotes:[`Configuration is stored in ~/.canonry/config.yaml.`,`The local config file is the source of truth for authentication credentials.`,`Google OAuth app credentials and per-domain Google tokens are stored in local config, not the database.`,`Database is SQLite at ~/.canonry/data.db.`,`API key was auto-generated during canonry init.`],bootstrapNote:`Use the UI, CLI, or ~/.canonry/config.yaml to manage settings. Authentication credentials persist to local config.`}}}function ds(e){let t=[];for(let n of e){let e=n.visibilityEvidence.filter(e=>e.citationState===`lost`);e.length>0&&t.push({id:`attention_${n.project.id}_lost`,tone:`negative`,title:`${n.project.displayName||n.project.name} lost citations`,detail:`${e.length} quer${e.length>1?`ies`:`y`} lost citation.`,actionLabel:`Open project`,href:`/projects/${encodeURIComponent(n.project.name)}`});let r=n.recentRuns.filter(e=>e.status===H.running||e.status===H.queued);r.length>0&&t.push({id:`attention_${n.project.id}_active`,tone:`neutral`,title:`${n.project.displayName||n.project.name} has active runs`,detail:`${r.length} run${r.length>1?`s`:``} in progress.`,actionLabel:`View runs`,href:`/runs`})}return t.length===0&&t.push({id:`attention_stable`,tone:`positive`,title:`All projects stable`,detail:`No citation losses or active runs to flag.`}),t}var fs=(0,K.createContext)(null);fs.Provider;function ps(){return(0,K.useContext)(fs)}function ms(e,t={}){let n=ps(),r=e??n?.dashboard??null,i=t.includeSettings??!0,a=t.includeOverviews??!0,o=t.pauseProjectPolling??!1,{isAdmin:s}=Qn(),c=!r&&a&&!In(),l=z({...wr({client:W,query:{kind:`answer-visibility`}}),enabled:!r,staleTime:tr,refetchInterval:e=>e.state.data?.some(e=>e.status===`running`||e.status===`queued`)?3e3:tr}),u=z({...wr({client:W,query:{excludeKinds:[U[`bing-inspect`],U[`traffic-sync`]],limit:5}}),enabled:c,staleTime:tr,refetchInterval:e=>e.state.data?.some(e=>e.status===H.running||e.status===H.queued)?3e3:tr}),d=z({...yr({client:W}),enabled:!r,refetchInterval:o?!1:e=>{let t=e.state.data,n=l.data?.some(e=>e.status===`running`||e.status===`queued`);return(t?.length??0)===0||n?ar:ur}}),f=z({...br({client:W}),enabled:!r&&i&&s}),p=d.data??[],m=l.data??[],h=je({queries:p.map(e=>{let t=m.filter(t=>t.projectId===e.id),n=t.filter(e=>(e.status===`completed`||e.status===`partial`)&&e.kind===`answer-visibility`&&e.trigger!==`probe`).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),i=n.length>0?n[0].id:`no-run`;return{queryKey:[`project-overview-slim`,e.id,i],queryFn:async()=>{let n=await jt(e.name).catch(()=>null);return{project:e,runs:t,queries:[],competitors:[],timeline:[],latestRunDetails:[],previousRunDetails:[],gscCoverage:null,bingCoverage:null,dbInsights:null,overview:n}},enabled:!r&&a&&d.isSuccess&&l.isSuccess,staleTime:cr}})}),g=!a||h.every(e=>e.isSuccess),_=(0,K.useMemo)(()=>{if(r)return r;if(!d.data||!l.data||p.length>0&&!g)return null;let e=new Map(p.map(e=>[e.id,e])),t=us(a?h.map(t=>{if(!t.data)return null;let n=e.get(t.data.project.id);return n?{...t.data,project:n,runs:m.filter(e=>e.projectId===n.id)}:null}).filter(e=>e!=null):p.map((e,t)=>{let n=h[t]?.data;return{project:e,runs:m.filter(t=>t.projectId===e.id),queries:[],competitors:[],timeline:[],latestRunDetails:[],previousRunDetails:[],gscCoverage:null,bingCoverage:null,dbInsights:null,overview:n?.overview??null}}),f.data??null);return c&&(t.portfolioOverview.recentRuns=(u.data??[]).filter(t=>t.trigger!==ut.probe&&e.has(t.projectId)).map(t=>{let n=e.get(t.projectId);return Wo(t,n.displayName||n.name)})),t},[r,d.data,l.data,f.data,a,g,h,p,m,c,u.data]),v=!r&&(d.isError||l.isError),y=!r&&!_&&!v,b=(0,K.useCallback)(async()=>{let e=[d.refetch(),l.refetch(),...c?[u.refetch()]:[],...a?h.map(e=>e.refetch()):[]];i&&s&&e.push(f.refetch()),await Promise.all(e)},[i,s,a,c,u.refetch,h,d.refetch,l.refetch,f.refetch]);return{dashboard:_,isLoading:y,isError:v,activityLoading:c&&u.isPending,activityError:c&&u.isError,refetch:b}}function hs(e){return JSON.stringify(e.filter(e=>e.kind===`answer-visibility`&&e.trigger!==`probe`&&(e.status===`completed`||e.status===`partial`)).map(e=>[e.id,e.status]).sort(([e],[t])=>e.localeCompare(t)))}async function gs(e,t,n=`active`){let r=e=>{let n=e.queryKey[0];return n?._id===`getApiV1ProjectsByNameAnalyticsCompetitors`&&n.path?.name===t};return n===`active`&&await e.cancelQueries({predicate:r}),e.invalidateQueries({predicate:r,refetchType:n})}function _s(e,t,n){let r=_e(),i=(0,K.useRef)({projectName:e,revision:t,enabled:n});(0,K.useEffect)(()=>{let a=i.current;i.current={projectName:e,revision:t,enabled:n},n&&a.enabled&&a.projectName===e&&a.revision!==t&&gs(r,e)},[n,e,r,t])}var vs=20;function ys(e,t={}){let n=_e(),r=ps(),i=(0,K.useMemo)(()=>!r||!e?null:r.dashboard.projects.find(t=>t.project.name===e)??null,[r,e]),a=z({...Er({client:W,path:{name:e??``}}),enabled:!!e&&!i,staleTime:cr,refetchOnWindowFocus:`always`}),o=z({...Dr({client:W,path:{name:e??``},query:{kind:`answer-visibility`}}),enabled:!!e,staleTime:tr,refetchOnWindowFocus:`always`,refetchInterval:e=>e.state.data?.some(e=>e.projectId===a.data?.id&&(e.status===`running`||e.status===`queued`))?3e3:tr}),s=a.data??null,c=(0,K.useMemo)(()=>s?(o.data??[]).filter(e=>e.projectId===s.id):[],[s,o.data]),{latestRunIds:l,latestRunIdsKey:u,latestVisibilityRevision:d}=(0,K.useMemo)(()=>{let e=c.filter(e=>(e.status===`completed`||e.status===`partial`)&&e.kind===`answer-visibility`&&e.trigger!==`probe`).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),t=e[0]?.createdAt??null,n=t?e.filter(e=>e.createdAt===t).map(e=>e.id):[];return{latestRunIds:n,latestRunIdsKey:[...n].sort().join(`,`),latestVisibilityRevision:t?`${t}:${[...n].sort().join(`,`)}`:`none`}},[c]),f=!!s&&!!e&&o.isSuccess,p=z({queryKey:[`project-dashboard-full`,s?.id??null,u||`none`,`overview`],queryFn:async()=>({project:s,overview:await jt(e)}),enabled:f&&t.overview===!0,staleTime:cr,refetchOnWindowFocus:`always`}),m=z({queryKey:[`project-dashboard-full`,s?.id??null,u||`none`,`evidence`],queryFn:async()=>{let[t,n,r]=await Promise.all([rt(e),Cn(e,void 0,vs),Promise.all(l.map(e=>tt(e)))]);return{project:s,queries:t,timeline:n,latestRunDetails:r}},enabled:f&&t.evidence===!0,staleTime:cr,refetchOnWindowFocus:`always`}),h=(0,K.useMemo)(()=>{if(!s||!o.data)return i;let e=t.evidence?m.data:void 0,n=rs({project:s,runs:c,queries:e?.queries??[],timeline:e?.timeline??[],latestRunDetails:e?.latestRunDetails??[],previousRunDetails:[],competitors:[],overview:t.overview?p.data?.overview??null:null});return i&&!(t.overview&&p.data)?{...i,project:n.project,recentRuns:n.recentRuns,visibilitySweeps:n.visibilitySweeps,visibilityEvidence:e?n.visibilityEvidence:i.visibilityEvidence}:n},[s,c,m.data,p.data,i,t.evidence,t.overview,o.data]),g=(0,K.useCallback)(async()=>{await Promise.all([a.refetch(),o.refetch(),n.invalidateQueries({queryKey:[`project-dashboard-full`,s?.id??null]})])},[a.refetch,o.refetch,n,s?.id]),_=a.isError||o.isError,v=!i&&(a.isLoading||o.isLoading),y=!!e&&t.overview===!0&&!i&&!_&&p.isPending,b=!!e&&t.evidence===!0&&!i&&!_&&m.isPending;return{commandCenter:h,project:s,isLoading:v,isError:_,overviewLoading:y,overviewError:t.overview===!0&&p.isError&&!p.data,evidenceLoading:b,evidenceError:t.evidence===!0&&m.isError&&!m.data,latestVisibilityRevision:d,competitorHistoryRevision:hs(c),refetch:g}}var bs=[`health`];async function xs(){let e=await en(`/health`,`API`);return{apiStatus:e,workerStatus:Et()&&e.state===`ok`?{label:`Worker`,state:`disabled`,detail:`Background execution is disabled in this public demo.`}:e.state===`ok`?{label:`Worker`,state:`ok`,detail:`In-process job runner`}:{label:`Worker`,state:e.state,detail:`Depends on API health check · ${e.detail}`,statusCode:e.statusCode,hint:e.hint?`Worker status is inferred from API health in this deployment mode. ${e.hint}`:`Worker status is inferred from API health in this deployment mode.`}}}function Ss(e,t){return z({queryKey:bs,queryFn:xs,enabled:e,refetchInterval:15e3,initialData:t})}function Cs(e){return z({...Sr({client:W,path:{id:e??``}}),enabled:!!e,refetchInterval:e=>{let t=e.state.data?.status;return t===`running`||t===`queued`?3e3:!1}})}function ws(){let e=Se(),t=Ce({strict:!1}),n=ke({select:e=>e.location.pathname});return{runId:t.runId??null,evidenceId:t.evidenceId??null,openRun:t=>{e({to:n,from:_p.to,search:e=>({...e,runId:t,evidenceId:void 0})})},openEvidence:t=>{e({to:n,from:_p.to,search:e=>({...e,evidenceId:t,runId:void 0})})},closeDrawer:()=>{e({to:n,from:_p.to,search:e=>({...e,runId:void 0,evidenceId:void 0})})}}}var Ts={negative:`toast-card-negative`,caution:`toast-card-caution`,positive:`toast-card-positive`,neutral:`toast-card-neutral`};function Es(e){if(e.cta)return`${e.cta.label}: ${e.title}`}function Ds(){let e=(0,K.useSyncExternalStore)(sr,lr,lr),t=Se(),{openRun:n}=ws(),r=(0,K.useCallback)(e=>{ir(e)},[]),i=(0,K.useCallback)(e=>{e.cta&&(e.cta.intent===`open-run-drawer`?n(e.cta.runId):t({to:`/runs`}),ir(e.id))},[t,n]);return e.length===0?null:(0,q.jsx)(`div`,{className:`toast-viewport`,"aria-label":`Notifications`,children:e.map(e=>(0,q.jsxs)(`section`,{role:e.tone===`negative`?`alert`:`status`,"aria-live":e.tone===`negative`?`assertive`:`polite`,"data-state":e.state,className:`toast-card ${Ts[e.tone]}`,children:[(0,q.jsxs)(`div`,{className:`toast-copy`,children:[(0,q.jsx)(`p`,{className:`toast-title`,children:e.title}),e.detail?(0,q.jsx)(`p`,{className:`toast-detail`,children:e.detail}):null,e.cta?(0,q.jsx)(`button`,{type:`button`,className:`toast-action`,onClick:()=>i(e),"aria-label":Es(e),children:e.cta.label}):null]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:`toast-dismiss`,"aria-label":`Dismiss`,children:(0,q.jsx)(N,{className:`size-3.5`})})]},e.id))})}var Os=`https://github.com/Canonry/canonry`,ks=`https://canonry.ai`,As=`Run it from your agent with the MCP server, API, CLI, and plugins for Claude Code and Codex.`,js=[{title:`Visibility`,links:[[`AI visibility`,`/projects/summit-roofing`],[`Search engines`,`/projects/summit-roofing/search-console`],[`Traffic & conversions`,`/projects/summit-roofing/conversions`]]},{title:`Portfolio`,links:[[`Properties & markets`,`/projects/harbor-resorts`],[`Queries & research`,`/projects/harbor-resorts/queries`],[`Activity`,`/projects/harbor-resorts/activity`]]},{title:`Website`,links:[[`Site health`,`/projects/summit-roofing/technical-aeo`],[`Local presence`,`/projects/summit-roofing/local`],[`Backlinks`,`/projects/summit-roofing/backlinks`]]}];function Ms(){let e=(0,K.useId)();if(!Et())return null;let t=Yt(),n=`${e}-new-tab`,r={target:`_blank`,rel:`noopener noreferrer`,"aria-describedby":n};return(0,q.jsxs)(`aside`,{className:`demo-banner`,"aria-label":`Public demo`,children:[(0,q.jsx)(`p`,{className:`demo-banner-name`,children:`Canonry demo`}),(0,q.jsx)(`p`,{className:`demo-banner-facts`,children:`View only. Fictional data.`}),(0,q.jsx)(`p`,{className:`demo-banner-agent`,children:As}),(0,q.jsxs)(`div`,{className:`demo-banner-actions`,children:[(0,q.jsxs)(`a`,{className:`demo-banner-primary`,href:ks,...r,children:[`canonry.ai`,(0,q.jsx)(re,{"aria-hidden":`true`,size:14})]}),(0,q.jsxs)(`a`,{className:`demo-banner-secondary`,href:Os,...r,children:[(0,q.jsx)(v,{"aria-hidden":`true`,size:15}),`GitHub`]}),(0,q.jsxs)(`details`,{onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.open=!1,e.currentTarget.querySelector(`summary`)?.focus())},children:[(0,q.jsxs)(`summary`,{children:[`Explore `,(0,q.jsx)(b,{"aria-hidden":`true`,size:14})]}),(0,q.jsxs)(`div`,{className:`demo-banner-panel`,children:[(0,q.jsx)(`p`,{className:`demo-banner-panel-agent`,children:As}),(0,q.jsxs)(`nav`,{className:`demo-banner-examples`,"aria-label":`Demo examples`,children:[(0,q.jsx)(`a`,{href:`${t}/projects/summit-roofing`,children:`Standard business`}),(0,q.jsx)(`a`,{href:`${t}/projects/harbor-resorts`,children:`Property portfolio`})]}),(0,q.jsx)(`nav`,{className:`demo-banner-features`,"aria-label":`Demo feature directory`,children:js.map(({title:e,links:n})=>(0,q.jsxs)(`section`,{"aria-label":e,children:[(0,q.jsx)(`h2`,{children:e}),(0,q.jsx)(`ul`,{children:n.map(([e,n])=>(0,q.jsx)(`li`,{children:(0,q.jsx)(`a`,{href:`${t}${n}`,children:e})},n))})]},e))})]})]})]}),(0,q.jsx)(`span`,{id:n,hidden:!0,children:`Opens in a new tab`})]})}function Ns(e){switch(e){case U[`answer-visibility`]:return`AI Visibility check`;case U[`gsc-sync`]:return`GSC sync`;case U[`inspect-sitemap`]:return`Sitemap inspection`;case U[`ga-sync`]:return`GA sync`;case U[`traffic-sync`]:return`Traffic sync`;case U[`bing-inspect`]:return`Bing URL inspection`;case U[`bing-inspect-sitemap`]:return`Bing sitemap inspection`;case U[`bing-sync`]:return`Bing data sync`;case U[`site-audit`]:return`Technical AEO audit`;case U[`backlink-extract`]:return`Backlink extract`;case U[`aeo-discover-seed`]:return`Discovery (seed phase)`;case U[`aeo-discover-probe`]:return`Discovery (probe phase)`;case U[`gbp-sync`]:return`Business Profile sync`;case U[`ads-sync`]:return`ChatGPT ads sync`;case U[`google-ads-sync`]:return`Google Ads sync`;case U[`gtm-sync`]:return`Tag Manager sync`;case U[`seo-sync`]:return`SEO data refresh`}}function Ps(e){return e===`running`?`Running`:e===`queued`?`Queued`:e===`partial`?`Partial`:e===`completed`?`Completed`:e===`failed`?`Failed`:e===`cancelled`?`Cancelled`:`Starting`}function Fs(){let e=(0,K.useSyncExternalStore)(Fi,Pi,Pi),t=(0,K.useMemo)(()=>Object.values(e.runs),[e.runs]),n=t.length>0,r=z({...wr({client:W}),enabled:n,staleTime:tr}),i=(0,K.useMemo)(()=>new Map((r.data??[]).map(e=>[e.id,e.status])),[r.data]);if(!n)return null;let a=t.map(e=>({...e,status:i.get(e.runId)??e.lastAnnouncedStatus})),o=a.length===1?Ns(a[0].kind):`${a.length} active tasks`;return(0,q.jsxs)(`div`,{className:`task-center`,children:[(0,q.jsxs)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:[a.length,` active `,a.length===1?`task`:`tasks`,`.`,` `,a.map(e=>`${Ns(e.kind)} ${Ps(e.status)}`).join(`. `),`.`]}),(0,q.jsxs)(`details`,{className:`task-center-details`,children:[(0,q.jsxs)(`summary`,{className:`task-center-trigger`,children:[(0,q.jsx)(m,{className:`size-3.5 shrink-0 motion-safe:animate-spin`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`task-center-summary`,children:o}),(0,q.jsx)(`span`,{className:`task-center-count`,"aria-hidden":`true`,children:a.length}),(0,q.jsx)(b,{className:`task-center-chevron size-3.5 shrink-0`,"aria-hidden":`true`})]}),(0,q.jsxs)(`div`,{className:`task-center-panel`,children:[(0,q.jsxs)(`div`,{className:`task-center-heading`,children:[(0,q.jsx)(`span`,{children:`Active tasks`}),(0,q.jsx)(`span`,{className:`tabular-nums text-faint`,children:a.length})]}),(0,q.jsx)(`ul`,{className:`task-center-list`,children:a.map(e=>(0,q.jsxs)(`li`,{className:`task-center-item`,children:[(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`truncate text-copy-13-strong text-strong`,children:Ns(e.kind)}),(0,q.jsx)(`p`,{className:`mt-0.5 truncate text-copy-13 text-muted`,children:e.projectLabel??e.projectId})]}),(0,q.jsx)(En,{tone:e.status===`failed`?`negative`:e.status===`partial`?`caution`:`neutral`,children:Ps(e.status)})]},e.runId))}),(0,q.jsx)(V,{to:`/runs`,className:`task-center-footer-link`,children:`View all runs`})]})]})]})}var Is={scope:`all`,queryClass:`all`},Ls=[`all`,`non-brand`,`branded`];function Rs(e){return typeof e==`string`&&Ls.includes(e)}function zs(e){let t=Rs(e.class)?e.class:Is.queryClass,n=e.scope;if(typeof n!=`string`||n===`all`||n.length===0)return{scope:`all`,queryClass:t};let r=n.startsWith(`group:`)?n.slice(6):``;return r?{scope:`group`,groupKey:r,queryClass:t}:{scope:`all`,queryClass:t}}function Bs(e,t){return t===null||e===null?!1:e!==t}function Vs(e){return{scope:e.scope===`group`&&e.groupKey?`group:${e.groupKey}`:void 0,class:e.queryClass===Is.queryClass?void 0:e.queryClass}}function Hs(e,t){if(!(typeof e!=`string`||e.length>16384||!t))try{let n=JSON.parse(e);if(typeof n!=`object`||!n||Array.isArray(n))return;let r=n,i=e=>typeof e==`string`&&e.trim().length>0,a=e=>e===null||i(e);return r.queryKey!==t||!i(r.provider)||r.queryClass!==`branded`&&r.queryClass!==`non-brand`&&r.queryClass!==`unknown`||!a(r.model)||!a(r.location)||!a(r.runId)||r.revision!==null&&(typeof r.revision!=`number`||!Number.isSafeInteger(r.revision)||r.revision<=0)?void 0:{queryKey:t,queryClass:r.queryClass,provider:r.provider,model:r.model,location:r.location,runId:r.runId,revision:r.revision}}catch{return}}function Us(e){let t=t=>typeof e[t]==`string`&&e[t]!==``?e[t]:void 0,n=zs({scope:t(`scope`),class:t(`class`)}),r=t(`measurementScope`)??(n.scope===`group`?`group`:`project`),i=t(`measurementScopeKey`)??(t(`measurementScope`)?void 0:n.groupKey),a=t(`queryClass`)??t(`class`),o={measurementScope:i&&(r===`group`||r===`market`||r===`property`)?r:`project`,queryClass:a===`unknown`||Rs(a)?a:Is.queryClass};o.measurementScope!==`project`&&(o.measurementScopeKey=i);for(let[e,n]of[[`measurementMarketKey`,`marketKey`],[`measurementProvider`,`provider`],[`measurementModel`,`model`],[`measurementLocation`,`location`],[`measurementFrom`,`from`],[`measurementTo`,`to`],[`measurementRunId`,`measurementRunId`],[`measurementQueryKey`,`queryKey`]]){let r=t(e);r!==void 0&&(o[n]=r)}let s=Number(e.measurementRevision);Number.isSafeInteger(s)&&s>0&&(o.revision=s);let c=Hs(e.measurementAnswer,o.queryKey);return c&&(o.answer=c),o}function Ws(e){return{scope:e.measurementScope,scopeKey:e.measurementScopeKey,marketKey:e.marketKey,queryClass:e.queryClass,provider:e.provider,model:e.model,location:e.location,from:e.from,to:e.to,revision:e.revision,runId:e.measurementRunId,limit:25}}function Gs(e,t){let n={...e,...t};return[`measurementScope`,`measurementScopeKey`,`measurementMarketKey`,`queryClass`,`measurementProvider`,`measurementModel`,`measurementLocation`,`measurementFrom`,`measurementTo`,`measurementRevision`,`measurementRunId`].some(e=>e in t)?(n.measurementQueryKey=t.measurementQueryKey,n.measurementAnswer=t.measurementAnswer):`measurementQueryKey`in t&&!(`measurementAnswer`in t)&&(n.measurementAnswer=void 0),`measurementScope`in t&&(n.scope=void 0,`measurementMarketKey`in t||(n.measurementMarketKey=void 0),n.measurementQueryKey=void 0,t.measurementScope===`project`&&(n.measurementScopeKey=void 0)),`queryClass`in t&&(n.class=void 0),n}function Ks(e){return{...e,onboarding:void 0,manageQueries:void 0,siteHealthRunId:void 0,siteScan:void 0,setupProject:void 0}}function qs(e,t){let n=/\/properties\/([^/]+)/.exec(e),r=Us(t);if(n)return{view:`property`,selection:Bt.parse({scope:`property`,scopeKey:decodeURIComponent(n[1]),queryClass:r.queryClass,limit:10})};if(e.endsWith(`/technical-aeo`))return{view:`site-health`};if(e.endsWith(`/seo-data`)){let e=e=>{let n=t[e];return typeof n==`string`&&n?n:void 0},[n,r,i,a]=[e(`seoProfileId`),e(`seoRunId`),e(`seoRegion`),e(`seoMarket`)];return{view:`seo`,...n?{seoProfileId:n}:{},...r?{seoRunId:r}:{},...i?{seoRegionKey:i}:{},...a?{seoMarketKey:a}:{}}}if(e.endsWith(`/queries`)&&t.queryWorkspace===`research`)return{view:`project`};let i=/^\/projects\/[^/]+\/?$/.test(e);if(i||e.endsWith(`/queries`)){let t=Bt.safeParse(Ws(e.endsWith(`/queries`)?{measurementScope:r.measurementScope,measurementScopeKey:r.measurementScopeKey,queryClass:r.queryClass}:r));return{view:i?`visibility`:`queries`,...t.success?{selection:t.data}:{unavailableReason:`The current measurement filters are invalid. Correct them before asking Aero about this view.`}}}return{view:`project`}}var Js=e(me(),1);function Ys(e,t={}){let{threshold:n=80}=t,r=(0,K.useRef)(null),i=(0,K.useRef)({scrollHeight:0,wasAtEnd:!0});function a(e){return e.scrollHeight-e.scrollTop-e.clientHeight}function o(){let e=r.current;return!e||a(e)<=n}function s(){let e=r.current;e&&(e.scrollTop=e.scrollHeight,i.current.wasAtEnd=!0,i.current.scrollHeight=e.scrollHeight)}return(0,K.useEffect)(()=>{let e=r.current;if(!e)return;let t=()=>{i.current.wasAtEnd=a(e)<=n};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[n]),(0,K.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=e.scrollHeight;t>i.current.scrollHeight&&i.current.wasAtEnd&&(e.scrollTop=t),i.current.scrollHeight=t},e),(0,K.useEffect)(()=>{let e=r.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{let t=e.scrollHeight;t>i.current.scrollHeight&&i.current.wasAtEnd&&(e.scrollTop=t),i.current.scrollHeight=t});return t.observe(e),e.firstElementChild&&t.observe(e.firstElementChild),()=>t.disconnect()},[]),{ref:r,scrollToEnd:s,isAtEnd:o}}var Xs=`AI Visibility checks are run by your Canonry team`,Zs=`Scans are run by your Canonry team`,Qs=`Next check unavailable`,$s=`Check running…`,ec=`Next check:`;function tc(e,t){try{return new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,timeZone:t??`UTC`}).format(new Date(e))}catch{return null}}function nc({projectName:e,kind:t=U[`answer-visibility`],running:n=!1,loadSchedule:r=!0}){let i=t===U[`site-audit`],a=z({...mr({client:W,path:{name:e},query:{kind:t}}),enabled:r&&!!e,retry:!1,refetchInterval:6e4}),o=a.isError?void 0:a.data,s=o?.enabled&&o.nextRunAt?new Date(o.nextRunAt):null,c=s&&Number.isFinite(s.getTime())?i?s.toLocaleString(`en-GB`,{weekday:`long`,day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`,timeZone:`UTC`,hourCycle:`h23`}):tc(s.toISOString(),o?.timezone):null,l=(a.error instanceof Ut?a.error.code:a.error?.error?.code)===`NOT_FOUND`,u=!c||l||!o?.enabled;return(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,role:`status`,children:i?(0,q.jsxs)(q.Fragment,{children:[n&&(0,q.jsx)(`span`,{className:`text-neutral`,children:`Scan running… · `}),c&&s?(0,q.jsxs)(q.Fragment,{children:[`Next scan `,(0,q.jsxs)(`time`,{dateTime:s.toISOString(),children:[c,` UTC`]}),` · managed by your Canonry team`]}):Zs]}):n?$s:u?Qs:c&&s?(0,q.jsxs)(q.Fragment,{children:[ec,` `,(0,q.jsx)(`time`,{dateTime:s.toISOString(),children:c})]}):Qs})}var rc=300,ic=400,ac=900,oc=32,sc=28,cc=0;function lc(){return new DOMException(`Preview stopped`,`AbortError`)}function uc(e,t){return t?.aborted?Promise.reject(lc()):new Promise((n,r)=>{let i=()=>{clearTimeout(a),r(lc())},a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e);t?.addEventListener(`abort`,i,{once:!0})})}function dc(e){let t=e.match(/\S+\s*|\s+/g)??[];if(t.length<2)return[];let n=Math.ceil(t.length/oc),r=[];for(let e=n;e<t.length;e+=n)r.push(t.slice(0,e).join(``));return r}function fc(e){return typeof e==`string`?e:JSON.stringify(e??null)}async function pc({starter:e,signal:t,onEvent:n,reducedMotion:r=!1}){let i=async e=>{if(t?.aborted)throw lc();r||await uc(e,t)},a=Date.now(),o=++cc;await i(rc);for(let[t,r]of e.steps.entries()){let{name:a,label:s,arguments:c,result:l,durationMs:u}=r.tool,d=`preview-${e.id}-${o}-${t}`;n({type:`message_end`,message:{role:`assistant`,timestamp:Date.now(),stopReason:`toolUse`,content:[...r.text?[{type:`text`,text:r.text}]:[],{type:`toolCall`,id:d,name:a,arguments:c}]}}),n({type:`tool_execution_start`,toolCallId:d,toolName:a,label:s,args:c}),await i(Math.min(ac,Math.max(ic,u))),n({type:`tool_execution_end`,toolCallId:d,toolName:a,result:l,isError:!1}),n({type:`message_end`,message:{role:`toolResult`,toolCallId:d,timestamp:Date.now(),isError:!1,aeroToolLabel:s,aeroDurationMs:u,content:[{type:`text`,text:fc(l)}]}})}if(!r){for(let t of dc(e.answer))await i(sc),n({type:`message_update`,message:{role:`assistant`,content:[{type:`text`,text:t}]},assistantMessageEvent:{}});await i(sc)}n({type:`message_end`,message:{role:`assistant`,timestamp:Date.now(),stopReason:`stop`,content:[{type:`text`,text:e.answer}]}}),n({type:`aero_turn_status`,status:{reason:`completed`,toolCalls:e.steps.length,modelCalls:e.steps.length+1,durationMs:Date.now()-a}})}function mc(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}async function hc(e){try{return await e.json()}catch{return{}}}function gc(){return typeof window<`u`&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath.replace(/\/$/,``)+`/api/v1`:`/api/v1`}var _c=gc();function vc(e){e===401&&nn()}async function yc(e){let t=await fetch(`${_c}/projects/${encodeURIComponent(e)}/agent/transcript`,{credentials:`include`});if(!t.ok){vc(t.status);let e=await hc(t);throw new Ut(e.error?.message??`transcript fetch failed: ${t.status}`,t.status,e.error?.code)}return await t.json()}async function bc(e){let t=await fetch(`${_c}/projects/${encodeURIComponent(e)}/agent/preview`,{credentials:`include`});if(!t.ok){vc(t.status);let e=await hc(t);throw new Ut(e.error?.message??`preview fetch failed: ${t.status}`,t.status,e.error?.code)}return await t.json()}async function xc(e){let t=await fetch(`${_c}/projects/${encodeURIComponent(e)}/agent/transcript`,{method:`DELETE`,credentials:`include`});if(!t.ok){vc(t.status);let e=await hc(t);throw new Ut(e.error?.message??`reset failed: ${t.status}`,t.status,e.error?.code)}}async function Sc({project:e,prompt:t,conversationId:n,provider:r,modelId:i,scope:a,profile:o,context:s,limits:c,signal:l,onEvent:u}){let d={prompt:t};n!==void 0&&(d.conversationId=n),r&&(d.provider=r),i&&(d.modelId=i),a&&(d.scope=a),o&&(d.profile=o),s&&(d.context=s),c&&(d.limits=c);let f=await fetch(`${_c}/projects/${encodeURIComponent(e)}/agent/prompt`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify(d),signal:l});if(!f.ok||!f.body){vc(f.status),bt({method:`POST`,route:`/api/v1/projects/{name}/agent/prompt`,status:f.status});let e=await hc(f);throw new Ut(e.error?.message??`prompt failed: ${f.status}`,f.status,e.error?.code)}We(`aero.send`);let p=!1,m=f.body.getReader(),h=new TextDecoder,g=``,_=()=>{m.cancel().catch(()=>{})};l?.addEventListener(`abort`,_,{once:!0}),l?.aborted&&_();try{for(;;){let{value:e,done:t}=await m.read();if(t)break;g+=h.decode(e,{stream:!0});let n=g.indexOf(`
14
14
 
15
15
  `);for(;n!==-1;){let e=g.slice(0,n);g=g.slice(n+2);for(let t of e.split(`
16
16
  `)){if(!t.startsWith(`data:`))continue;let e=t.slice(5).trim();if(!e)continue;let n;try{n=JSON.parse(e)}catch{continue}n.type===`stream_close`&&(p=!0),u(n)}n=g.indexOf(`
17
17
 
18
- `)}}if(l?.aborted)throw new DOMException(`Turn stopped`,`AbortError`);if(!p)throw Error(`Connection ended before Aero finished. Review the partial answer before retrying.`)}finally{l?.removeEventListener(`abort`,_);try{m.releaseLock()}catch{}}}function Cc(e){return!e||e.role!==`assistant`?``:e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``)}var wc=[{id:`status`,label:`Status`,prompt:`Give me a quick status: the latest check, which engines answered, and anything that needs attention.`},{id:`changes`,label:`What changed`,prompt:`Compare the latest complete check with the one before it. Lead with mentions, then citations. Keep branded and non-brand queries separate if the project splits them, and say which changes are bigger than normal run-to-run noise.`},{id:`gaps`,label:`Biggest gaps`,prompt:`Which tracked queries does no engine mention us on, and who gets named instead? Group them by topic or market.`},{id:`insights`,label:`Top insights`,prompt:`Walk me through the 3 most severe active insights and what to do about each.`}],Tc=`https://canonry.ai`,Ec=`This demo plays sample answers only. Pick a starting point, or type / to choose one.`,Dc=`Stopped. The sample answer so far is kept.`;function Oc(e){return{queryKey:[`aero-preview`,e],queryFn:()=>bc(e),staleTime:1/0,gcTime:1/0}}var kc=[{command:`/status`,label:`Status`,prompt:`Give me a quick status: the latest check, which engines answered, and anything that needs attention.`},{command:`/changes`,label:`What changed`,prompt:`Compare the latest complete check with the one before it. Lead with mentions, then citations. Keep branded and non-brand queries separate if the project splits them, and say which changes are bigger than normal run-to-run noise.`},{command:`/gaps`,label:`Biggest gaps`,prompt:`Which tracked queries does no engine mention us on, and who gets named instead? Group them by topic or market.`},{command:`/insights`,label:`Top insights`,prompt:`Walk me through the 3 most severe active insights and what to do about each.`},{command:`/last-run`,label:`Last run`,prompt:`Summarize the latest run for this project: which engines answered, what moved in mentions and citations, and anything that failed.`},{command:`/run-sweep`,label:`Run check now`,prompt:`Run a new AI Visibility check for this project now and tell me when it lands.`},{command:`/queries`,label:`Queries`,prompt:`List the tracked queries for this project and flag any that are obvious duplicates or underperformers.`},{command:`/competitors`,label:`Competitors`,prompt:`Which competitors do engines name most often on queries where we are not named, and on which engines?`},{command:`/new`,label:`New conversation (save current)`,action:`new`}],Ac=e=>`canonry:aero:provider:${e}`,jc=(e,t)=>`canonry:aero:model:${e}:${t}`,Mc=e=>`canonry:aero:openrouter-model:${e}`;function Nc(e){let t={};for(let n of Object.values(At)){let r=Fc(jc(e,n))??(n===At.openrouter?Fc(Mc(e)):null);r&&(t[n]=r)}return t}var Pc=e=>`canonry:aero:scope:${e}`;function Fc(e){if(typeof window>`u`)return null;try{return window.localStorage.getItem(e)}catch{return null}}function Ic(e,t){if(typeof window<`u`)try{window.localStorage.setItem(e,t)}catch{}}function Lc(e){if(typeof window<`u`)try{window.localStorage.removeItem(e)}catch{}}function Rc({projectName:e,context:t,preview:r=zn()}){let i=He(),{canWrite:a,account:o}=Qn(),s=_e(),c=o?.role===`viewer`,[l,u]=(0,K.useState)(!1),[f,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)([]),[_,v]=(0,K.useState)(void 0),y=(0,K.useRef)(!1),[b,x]=(0,K.useState)(!1),[w,T]=(0,K.useState)(!1),[E,D]=(0,K.useState)(null),[O,k]=(0,K.useState)(!1),[A,ee]=(0,K.useState)(!1),[te,ne]=(0,K.useState)(null),M=(0,K.useRef)(!1),[ie,P]=(0,K.useState)(``),[oe,se]=(0,K.useState)(!1),[ce,le]=(0,K.useState)(!1),[ue,F]=(0,K.useState)([]),[de,fe]=(0,K.useState)(``),[I,L]=(0,K.useState)(null),[pe,me]=(0,K.useState)(null),[he,R]=(0,K.useState)(null),ge=(0,K.useRef)(!0),[ve,ye]=(0,K.useState)(()=>Fc(Ac(e))??null),be=i||c||r?null:ve,[xe,Se]=(0,K.useState)(()=>Nc(e)),[Ce,we]=(0,K.useState)(null),[Te]=(0,K.useState)(()=>Fc(Pc(e))===`all`?`all`:`read-only`),B=i||c||r?`read-only`:Te,Ee=(0,K.useRef)(null),De=(0,K.useRef)(null),Oe=(0,K.useRef)(null),ke=(0,K.useRef)(null),{ref:Ae}=Ys([m,de,ue]),je=(0,K.useRef)(null);(0,K.useLayoutEffect)(()=>{let e=je.current;if(!e)return;e.style.height=`auto`;let t=f?Uc:Hc;e.scrollHeight>0&&(e.style.height=`${Math.min(e.scrollHeight,t)}px`)},[ie,f,l]);let[Me,Ne]=(0,K.useState)(0),Pe=(0,K.useMemo)(()=>{let e=ie.trimStart();if(!e.startsWith(`/`)||/\s/.test(e))return[];let t=e.toLowerCase();return kc.filter(e=>(!(i||c)||e.command!==`/run-sweep`)&&(!c||e.action!==`new`)&&(!r||wc.some(t=>t.prompt===e.prompt))&&(e.command.startsWith(t)||e.label.toLowerCase().includes(t.slice(1))))},[ie,i,c,r]);(0,K.useEffect)(()=>{Ne(e=>Pe.length===0?0:Math.min(e,Pe.length-1))},[Pe.length]);let Fe=z({...fr({client:W,path:{name:e}}),enabled:!c&&!r,staleTime:6e4}),Ie=(0,K.useMemo)(()=>{let e=Fe.data?.providers??[];if(be){let t=e.find(e=>e.id===be&&e.configured);if(t)return t}let t=Ce?e.find(e=>e.id===Ce.provider&&e.configured):void 0;if(t)return t;let n=Fe.data?.defaultProvider;return n?e.find(e=>e.id===n)??null:null},[be,Fe.data,Ce]),Le=c||r||Ie!==null,Re=Ie?xe[Ie.id]??``:``,ze=!be&&Ie&&Ce?.provider===Ie.id?Ce.modelId:void 0,Ve=!i&&!c&&!r&&Ie&&Re.trim()?Re.trim():void 0,Ue=(Ve?Ie?.id:void 0)??be??void 0,H=(0,K.useCallback)((t,n)=>{let r=n.trim();Se(e=>({...e,[t]:n})),r?Ic(jc(e,t),r):Lc(jc(e,t)),t===At.openrouter&&Lc(Mc(e))},[e]);z({...Oc(e),enabled:r&&l}),(0,K.useEffect)(()=>{Fe.data&&be&&(Fe.data.providers.find(e=>e.id===be&&e.configured)||(ye(null),Lc(Ac(e))))},[Fe.data,be,e]);let Ge=(0,K.useCallback)(t=>{ye(t),t?Ic(Ac(e),t):Lc(Ac(e))},[e]);(0,K.useEffect)(()=>{if(!l)return;let e=e=>{e.key===`Escape`&&(w?T(!1):f?p(!1):u(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l,f,w]);let U=(0,K.useRef)(null);(0,K.useEffect)(()=>{l||(U.current=null)},[l]),(0,K.useEffect)(()=>{if(!l||!Le||r)return;let t=!1;U.current!==e&&(U.current=e,L(null));let n=()=>{t||oe||M.current||yc(e).then(e=>{t||M.current||(ee(e.isStreaming??!1),v(e.conversationId??null),we(e.nextTurn??null),!t&&!e.isStreaming&&(De.current===null||e.updatedAt&&e.updatedAt!==De.current.previous)&&(h(e.messages),Ee.current=e.updatedAt,De.current=null))}).catch(e=>{t||L(yn(e))})};n();let i=window.setInterval(n,15e3);return()=>{t=!0,window.clearInterval(i)}},[l,e,oe,Le,O,r]),(0,K.useEffect)(()=>(ge.current=!0,()=>{ge.current=!1,ke.current?.abort()}),[e]);async function Ke(n,a=t){let o=n.trim();if(!o||w||oe||O||M.current||A||!Le)return;if(r){await Je(o);return}if(i&&/^\/run-sweep(?:\s|$)/i.test(o)){L(Xs);return}L(null),me(null),R({prompt:o,context:a}),P(``),se(!0),le(!1),fe(``),Oe.current=null,F([]),De.current={previous:Ee.current};let s={role:`user`,content:o,timestamp:Date.now(),aeroContext:a};h(e=>[...e,s]);let l=new AbortController;ke.current=l;try{await Sc({project:e,prompt:o,conversationId:_,provider:Ue,modelId:Ve,scope:B,context:a,signal:l.signal,onEvent:Ye});let t=await yc(e);ge.current&&!t.isStreaming&&(v(t.conversationId??null),we(t.nextTurn??null),h(t.messages),Ee.current=t.updatedAt,De.current=null)}catch(e){if(!ge.current)return;c&&(De.current=null);let t=Oe.current;t&&Cc(t).trim()&&h(e=>[...e,t]),l.signal.aborted?me(`Stopped. Partial response preserved. An action already dispatched may still finish.`):L(yn(e))}finally{ge.current&&(se(!1),fe(``),F(e=>e.map(e=>e.endedAt===void 0?{...e,interrupted:!0}:e))),ke.current=null}}async function Je(t){let n=kc.find(e=>e.command===t.toLowerCase())?.prompt??t,r=wc.find(e=>e.prompt===n)?.id;if(!r){L(null),R(null),me(Ec);return}L(null),me(null),R({prompt:n}),P(``),se(!0),le(!1),fe(``),Oe.current=null,F([]),h(e=>[...e,{role:`user`,content:n,timestamp:Date.now()}]);let i=new AbortController;ke.current=i;try{let t=await s.ensureQueryData(Oc(e));if(i.signal.aborted)throw new DOMException(`Preview stopped`,`AbortError`);let n=t.starters.find(e=>e.id===r);if(!n)throw Error(`This demo has no sample answer for that starting point.`);await pc({starter:n,signal:i.signal,onEvent:Ye,reducedMotion:mc()})}catch(e){if(!ge.current)return;let t=Oe.current;t&&Cc(t).trim()&&h(e=>[...e,t]),i.signal.aborted?me(Dc):L(yn(e))}finally{ge.current&&(se(!1),fe(``),F(e=>e.map(e=>e.endedAt===void 0?{...e,interrupted:!0}:e))),ke.current=null}}function Ye(e){if(ge.current)switch(e.type){case`message_update`:e.message.role===`assistant`&&(Oe.current=e.message),fe(Cc(e.message));break;case`message_end`:if(e.message.role!==`user`){let t=e.message;h(e=>[...e,t])}e.message.role===`assistant`&&(Oe.current=null,fe(``),e.message.errorMessage&&L(e.message.errorMessage));break;case`aero_turn_status`:le(!0),e.status?.reason===`tool-limit`?me(`Tool-call limit reached. Partial response preserved.`):e.status?.reason===`time-limit`?me(`Time limit reached. Partial response preserved.`):e.status?.reason===`completed`?R(null):e.status?.reason===`error`&&L(e=>e??`Aero could not finish this answer. Retry to ask again.`);break;case`agent_end`:le(!0);break;case`tool_execution_start`:F(t=>[...t,{id:e.toolCallId,name:e.toolName,label:e.label,args:e.args,startedAt:Date.now()}]);break;case`tool_execution_end`:F(t=>t.map(t=>t.id===e.toolCallId?{...t,endedAt:Date.now(),isError:e.isError,result:e.result}:t));break;case`error`:le(!0),L(e.message)}}async function Xe(t,n=!1){if(!(oe||A||M.current)){M.current=!0,k(!0),L(null);try{await t();let r=await yc(e);if(!ge.current)return;De.current=null,Ee.current=r.updatedAt,v(r.conversationId??null),we(r.nextTurn??null),h(r.messages),F([]),fe(``),me(null),R(null),ne(null),T(n),D(n?await qe(e):null),je.current?.focus()}catch(e){ge.current&&L(yn(e))}finally{M.current=!1,ge.current&&k(!1)}}}async function Ze(){if(r){if(oe)return;h([]),F([]),fe(``),L(null),me(null),R(null),je.current?.focus()}else await Xe(()=>c?xc(e):Nn(e,crypto.randomUUID()))}async function Qe(t=!1){if(!(M.current||y.current)){y.current=!0,x(!0),T(!0),L(null);try{let n=await qe(e,{offset:t?E?.nextOffset??0:0});ge.current&&D(e=>t&&e?{...n,conversations:[...e.conversations,...n.conversations]}:n)}catch(e){ge.current&&L(yn(e))}finally{y.current=!1,ge.current&&x(!1)}}}let $e=m.length===0,et=!(c||r);if(et&&Fe.isPending)return null;if(et&&Fe.isError)return(0,q.jsx)(`div`,{className:`pointer-events-none fixed inset-x-0 bottom-0 z-40 flex justify-center p-3`,children:(0,q.jsxs)(`div`,{role:`status`,className:`flex w-full max-w-3xl flex-wrap items-center gap-x-2 gap-y-1 material-base px-4 py-2 text-label-14`,children:[(0,q.jsx)(C,{className:`h-4 w-4 text-muted`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`text-label-14-strong text-strong`,children:`Aero could not check provider availability.`}),(0,q.jsx)(G,{variant:`outline`,size:`sm`,className:`pointer-events-auto ml-auto`,onClick:()=>{Fe.refetch()},children:`Try again`})]})});let tt=Ie&&!Ie.configured?Ie:null;if(et&&(!Ie||tt))return(0,q.jsx)(`div`,{className:`pointer-events-none fixed inset-x-0 bottom-0 z-40 flex justify-center p-3`,children:(0,q.jsxs)(`div`,{role:`status`,className:`flex w-full max-w-3xl flex-wrap items-center gap-x-2 gap-y-1 material-base px-4 py-2 text-label-14`,children:[(0,q.jsx)(C,{className:`h-4 w-4 text-muted`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-label-14-strong text-strong`,children:[tt?`Aero is set to ${tt.label.replace(/\s+\(.+\)$/,``)}, which has no API key.`:`Aero needs an answer-engine provider.`,(0,q.jsx)(kr,{text:tt?`Set ${qc(tt.id)} on the server, or providers.${tt.id}.apiKey in its config.yaml.`:`Aero is the built-in AEO analyst. It reads your Canonry data with you once a provider is connected.`})]}),tt?null:a?(0,q.jsx)(G,{asChild:!0,variant:`outline`,size:`sm`,className:`pointer-events-auto ml-auto`,children:(0,q.jsx)(V,{to:`/settings`,children:`Open Settings`})}):(0,q.jsx)(`span`,{className:`ml-auto text-secondary`,children:`Ask an administrator to configure one.`})]})});let nt=l&&f?`pointer-events-auto fixed inset-0 z-40 flex items-stretch justify-center bg-bg/70 p-4 sm:p-8 backdrop-blur-sm`:`pointer-events-none fixed inset-x-0 bottom-0 z-40 flex justify-center p-3`,rt=f?`material-fullscreen pointer-events-auto flex h-full w-full max-w-5xl flex-col overflow-hidden`:`pointer-events-auto w-full max-w-3xl`,it=f?`flex-1 overflow-y-auto px-6 py-5 text-copy-14 text-strong`:`max-h-[40vh] min-h-[120px] overflow-y-auto px-4 py-3 text-copy-14 text-strong`;return(0,q.jsx)(`div`,{className:nt,onClick:e=>{f&&e.target===e.currentTarget&&p(!1)},children:(0,q.jsx)(`div`,{className:rt,children:l?(0,q.jsxs)(`div`,{"data-aero-panel":!0,className:f?`flex h-full flex-col`:`material-menu flex flex-col overflow-hidden`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-mono-800/70 px-4 py-2.5`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(C,{className:`h-4 w-4 shrink-0 text-positive-400`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:`Aero`}),(0,q.jsx)(`span`,{className:`hidden min-w-0 truncate text-label-12 normal-case text-muted sm:inline`,children:oe||A?`working…`:e})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[!i&&!c&&!r&&(0,q.jsx)(Bc,{providers:Fe.data?.providers??[],active:Ie,override:be,onPick:Ge,modelId:Re,fallbackModel:ze,onModelChange:e=>{Ie&&H(Ie.id,e)},disabled:oe}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>p(e=>!e),className:`shrink-0 rounded-md p-1.5 text-muted transition hover:bg-surface-inset hover:text-strong`,"aria-label":f?`Collapse`:`Expand`,title:f?`Collapse`:`Expand`,children:f?(0,q.jsx)(n,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}):(0,q.jsx)(d,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>{p(!1),u(!1)},className:`shrink-0 rounded-md p-1.5 text-muted transition hover:bg-surface-inset hover:text-strong`,"aria-label":`Close Aero`,children:(0,q.jsx)(N,{className:`h-4 w-4`,"aria-hidden":`true`})})]})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-subtle px-4 py-2`,children:[(0,q.jsxs)(G,{variant:`outline`,size:`sm`,disabled:oe||A||O,onClick:er(Ze),title:c||r?`Clear this conversation and start fresh.`:`Save this conversation and start fresh. Shared project notes are kept.`,children:[(0,q.jsx)(g,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),` New conversation`]}),!c&&!r&&(0,q.jsxs)(G,{variant:`ghost`,size:`sm`,"aria-expanded":w,"aria-controls":`aero-history`,disabled:O,onClick:()=>{w?T(!1):Qe()},children:[(0,q.jsx)(S,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),` History`]})]}),w?(0,q.jsxs)(`div`,{id:`aero-history`,className:it,"aria-label":`Conversation history`,children:[(0,q.jsxs)(`h3`,{className:`mb-2 text-heading-14 text-heading`,children:[`Conversations in `,e]}),E?E.conversations.length===0?(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`No saved conversations yet. Your conversations will appear here.`}):(0,q.jsx)(`ul`,{className:`divide-y divide-default`,children:E.conversations.map(t=>(0,q.jsxs)(`li`,{className:`py-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`button`,{className:`min-w-0 flex-1 rounded-md px-2 py-1 text-left hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-positive-500`,disabled:oe||A||O,onClick:()=>{t.active?T(!1):Xe(()=>Be(e,t.id))},children:[(0,q.jsx)(`span`,{className:`block truncate text-label-14 text-heading`,children:t.title}),(0,q.jsxs)(`span`,{className:`text-label-12 text-secondary`,children:[t.active?`Current · `:``,new Date(t.updatedAt).toLocaleString()]})]}),(0,q.jsx)(G,{variant:`ghost`,size:`sm`,disabled:oe||A||O,"aria-label":`Delete conversation: ${t.title}`,onClick:()=>ne(t.id),children:`Delete`})]}),te===t.id&&(0,q.jsxs)(`div`,{role:`group`,"aria-label":`Confirm conversation deletion`,className:`mt-2 rounded-md border border-default p-3 text-label-14 text-secondary`,children:[(0,q.jsx)(`p`,{children:`Delete this conversation permanently? Shared project notes will be kept.`}),(0,q.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,q.jsx)(G,{variant:`destructive`,size:`sm`,disabled:O,onClick:()=>{Xe(async()=>{await lt(e,t.id)},!0)},children:`Delete conversation`}),(0,q.jsx)(G,{variant:`ghost`,size:`sm`,disabled:O,onClick:()=>ne(null),children:`Cancel`})]})]})]},t.id))}):(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:b?`Loading history…`:`History could not be loaded. Close and reopen History to retry.`}),E?.nextOffset!=null&&(0,q.jsx)(G,{variant:`ghost`,size:`sm`,disabled:b,onClick:()=>{Qe(!0)},children:b?`Loading…`:`Load more`})]}):(0,q.jsxs)(`div`,{ref:Ae,className:it,children:[$e&&!oe&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 py-2`,children:[(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:r?(0,q.jsxs)(q.Fragment,{children:[`See how Aero answers about `,(0,q.jsx)(`span`,{className:`text-strong`,children:e}),`. Choose a starting point.`]}):(0,q.jsxs)(q.Fragment,{children:[`Ask about `,(0,q.jsx)(`span`,{className:`text-strong`,children:e}),` or choose a starting point.`]})}),(0,q.jsx)(Kc,{onPick:e=>{Ke(e)}})]}),Yc(m,e,Ue??null,B,ue,oe&&!ce,!!de.trim(),!c&&!r,Ve),oe&&de.trim()&&(0,q.jsxs)(`div`,{className:`mt-3`,children:[(0,q.jsx)(`div`,{className:`mb-0.5 text-label-12 normal-case text-positive-400`,children:`Aero`}),(0,q.jsx)(hl,{content:de})]}),r&&!$e&&!oe&&(0,q.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 border-t border-subtle pt-3`,children:[(0,q.jsx)(`p`,{className:`text-copy-13 text-secondary`,children:`Try another starting point.`}),(0,q.jsx)(Kc,{onPick:e=>{Ke(e)}})]})]}),(I||pe)&&(0,q.jsxs)(`div`,{role:I?`alert`:`status`,className:`mx-3 my-2 flex flex-wrap items-center gap-2 material-base px-3 py-2 text-label-14 text-secondary`,children:[(0,q.jsx)(`span`,{className:`flex-1`,children:I??pe}),he&&!oe&&(0,q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>{B===`all`?(P(he.prompt),je.current?.focus()):Ke(he.prompt,he.context)},children:B===`all`?`Review prompt`:`Retry`})]}),r&&(0,q.jsxs)(`p`,{className:`border-t border-subtle px-4 py-2 text-copy-13 text-secondary`,children:[`Sample answers on demo data.`,` `,(0,q.jsxs)(`a`,{href:Tc,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-positive-400 underline decoration-positive-700 hover:decoration-positive-400`,children:[`Aero answers from your own Canonry data.`,(0,q.jsx)(re,{className:`h-3 w-3`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`sr-only`,children:` (opens in a new tab)`})]})]}),(0,q.jsxs)(`div`,{className:`relative`,children:[!w&&Pe.length>0&&(0,q.jsx)(Gc,{title:r?`Starting points`:`Commands`,matches:Pe,selectedIndex:Me,onHover:Ne,onPick:e=>{P(``),je.current?.focus(),e.action===`new`?Ze():Ke(e.prompt)}}),(0,q.jsxs)(`form`,{className:`flex items-end gap-2 border-t border-mono-800/70 bg-bg/80 px-3 py-2.5`,onSubmit:e=>{if(e.preventDefault(),Pe.length>0){let e=Pe[Me];P(``),e.action===`new`?Ze():Ke(e.prompt)}else Ke(ie)},children:[(0,q.jsx)(`textarea`,{ref:je,value:ie,onChange:e=>P(e.target.value),onKeyDown:e=>{if(Pe.length>0){if(e.key===`ArrowDown`){e.preventDefault(),Ne(e=>(e+1)%Pe.length);return}if(e.key===`ArrowUp`){e.preventDefault(),Ne(e=>(e-1+Pe.length)%Pe.length);return}if(e.key===`Tab`){e.preventDefault();let t=Pe[Me];P(`${t.command} `);return}if(e.key===`Escape`){e.preventDefault(),P(``);return}}if(e.key===`Enter`&&!e.shiftKey){if(e.preventDefault(),Pe.length>0){let e=Pe[Me];P(``),e.action===`new`?Ze():Ke(e.prompt)}else Ke(ie)}},disabled:w||O,placeholder:w?`Open a conversation to continue…`:r?`Type / for a starting point`:`Ask Aero, or / for commands…`,"aria-label":`Message Aero`,rows:f?3:1,className:`flex-1 resize-none overflow-y-auto bg-transparent text-copy-14 text-heading placeholder:text-mono-600 focus:outline-none disabled:opacity-60`}),oe?(0,q.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>ke.current?.abort(),"aria-label":`Stop Aero`,children:[(0,q.jsx)(ae,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),` Stop`]}):(0,q.jsx)(G,{type:`submit`,size:`sm`,disabled:!ie.trim()||w||O||A,"aria-label":`Send`,children:(0,q.jsx)(j,{className:`h-4 w-4`,"aria-hidden":`true`})})]})]})]}):(0,q.jsx)(`button`,{type:`button`,onClick:()=>{u(!0),We(`aero.open`)},className:`material-small flex w-full items-center justify-between px-4 py-2 text-left text-button-14 text-secondary transition hover:bg-bg-elevated hover:text-strong`,children:(0,q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(C,{className:`h-4 w-4 text-positive-400`,"aria-hidden":`true`}),`Ask Aero about `,e,`…`]})})})})}function zc(e,t){return/\s/.test(t)?`Model IDs have no spaces.`:e===At.openrouter&&!Dn.test(t)?`Use publisher/model, for example openai/gpt-6-luna.`:null}function Bc({providers:e,active:t,override:n,onPick:r,modelId:i,fallbackModel:a,onModelChange:o,disabled:s}){let[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(null),[f,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(``),[g,_]=(0,K.useState)(null),v=(0,K.useRef)(null),x=(0,K.useRef)(null),S=(0,K.useRef)(null),C=(0,K.useId)(),w=(0,K.useId)(),T=(0,K.useId)(),E=(0,K.useCallback)(e=>{l(!1),d(null),p(!1),_(null),e&&v.current?.focus()},[]),D=(0,K.useCallback)(()=>{let e=v.current?.getBoundingClientRect();if(!e)return;let t=window.innerHeight-e.bottom-8,n=e.top-8,r=Math.max(8,window.innerWidth-e.right);d(t>=n?{top:e.bottom+4,right:r,maxHeight:t-4}:{bottom:window.innerHeight-e.top+4,right:r,maxHeight:n-4})},[]);(0,K.useLayoutEffect)(()=>{c&&D()},[c,D]);let O=u!==null;if((0,K.useEffect)(()=>{if(!c||!O)return;let e=Vc(x.current);(e.find(e=>e.getAttribute(`aria-checked`)===`true`&&e.closest(`[data-menu-group="model"]`))??e[0])?.focus()},[c,O]),(0,K.useEffect)(()=>{f&&S.current?.focus()},[f]),(0,K.useEffect)(()=>{if(!c)return;let e=e=>{let t=e.target;v.current?.contains(t)||x.current?.contains(t)||E(!1)},t=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),E(!0))};return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,t,!0),window.addEventListener(`resize`,D),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,t,!0),window.removeEventListener(`resize`,D)}},[c,E,D]),e.length===0)return null;let k=e.filter(e=>e.configured),A=k.length<e.length,ee=t?.configured?t.models??[]:[],j=i.trim()||a||t?.defaultModel||``,te=ee.find(e=>e.id===j)?.displayName??j,ne=!!(t?.configured&&j&&!ee.some(e=>e.id===j)),M=t?t.label.replace(/\s+\(.+\)$/,``):`No provider`,re=e=>{let t=e.target;if(e.key===`Tab`){let n=t.closest(`[data-other-model-form]`),r=t.tagName===`INPUT`;if(n&&(r&&!e.shiftKey||!r&&e.shiftKey))return;e.preventDefault(),E(!0);return}if(!t.matches(`[role^="menuitem"]`))return;let n=Vc(x.current),r=n.indexOf(t),i=e.key===`ArrowDown`?n[(r+1)%n.length]:e.key===`ArrowUp`?n[(r-1+n.length)%n.length]:e.key===`Home`?n[0]:e.key===`End`?n[n.length-1]:void 0;i&&(e.preventDefault(),i.focus())},ie=()=>{if(!t)return;let e=m.trim();if(!e){_(`Enter a model ID.`);return}let n=zc(t.id,e);n?_(n):(o(e),E(!0))},N=`flex min-h-10 w-full items-center gap-2 px-3 py-2 text-left text-label-14 text-heading transition outline-none hover:bg-bg-elevated focus-visible:bg-bg-elevated focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-mono-400 disabled:opacity-60`,P=e=>(0,q.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center`,children:e?(0,q.jsx)(y,{className:`h-3.5 w-3.5 text-positive-400`,"aria-hidden":`true`}):null});return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{ref:v,type:`button`,onClick:()=>c?E(!1):l(!0),onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),l(!0))},disabled:s,className:`flex min-h-8 min-w-0 items-center gap-1 rounded-md px-2 py-1 text-button-14 text-secondary transition hover:bg-surface-inset hover:text-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400 disabled:opacity-50`,"aria-haspopup":`menu`,"aria-expanded":c,"aria-controls":c?C:void 0,title:t?`${t.label} · ${j}`:`Pick a provider`,children:[(0,q.jsx)(`span`,{className:`sr-only`,children:`Aero model: `}),(0,q.jsx)(`span`,{className:`min-w-0 truncate text-button-14 text-strong`,children:t?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`hidden sm:inline`,children:[M,` · `]}),te]}):M}),(0,q.jsx)(b,{className:`h-3 w-3 shrink-0`,"aria-hidden":`true`})]}),c&&u&&(0,Js.createPortal)((0,q.jsxs)(`div`,{ref:x,id:C,role:`menu`,"aria-label":`Aero model`,onKeyDown:re,style:{position:`fixed`,top:u.top,bottom:u.bottom,right:u.right,maxHeight:u.maxHeight},className:`z-50 w-72 max-w-[calc(100vw-1rem)] overflow-y-auto material-menu py-1`,children:[(0,q.jsxs)(`div`,{role:`group`,"aria-labelledby":w,children:[(0,q.jsx)(`div`,{id:w,className:`px-3 pb-1 pt-2 text-label-14-strong text-secondary`,children:`Provider`}),k.map(e=>{let n=t?.id===e.id;return(0,q.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":n,tabIndex:-1,onClick:()=>{n||r(e.id),E(!0)},className:N,children:[P(n),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label.replace(/\s+\(.+\)$/,``)})]},e.id)}),n&&(0,q.jsxs)(`button`,{type:`button`,role:`menuitem`,tabIndex:-1,onClick:()=>{r(null),E(!0)},className:`${N} text-secondary`,children:[P(!1),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Use default provider`})]}),A&&(0,q.jsxs)(V,{to:`/settings`,role:`menuitem`,tabIndex:-1,onClick:()=>E(!1),className:`${N} text-secondary`,children:[P(!1),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Connect another provider`})]})]}),t?.configured&&(0,q.jsxs)(`div`,{role:`group`,"aria-labelledby":T,"data-menu-group":`model`,className:`mt-1 border-t border-default`,children:[(0,q.jsx)(`div`,{id:T,className:`px-3 pb-1 pt-2 text-label-14-strong text-secondary`,children:`Model`}),ee.map(e=>{let n=e.id===j,r=e.id===t.defaultModel;return(0,q.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":n,tabIndex:-1,onClick:()=>{o(e.id),E(!0)},className:N,title:e.id,children:[P(n),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.displayName}),r&&(0,q.jsx)(`span`,{className:`shrink-0 text-label-14 text-secondary`,children:`Default`})]},e.id)}),ne&&(0,q.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":!0,tabIndex:-1,onClick:()=>E(!0),className:N,title:j,children:[P(!0),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-label-13-mono`,children:j})]}),(0,q.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-expanded":f,tabIndex:-1,onClick:()=>{h(ne?j:``),_(null),p(e=>!e)},className:`${N} text-secondary`,children:[P(!1),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Other model…`})]}),f&&(0,q.jsxs)(`form`,{"data-other-model-form":!0,className:`px-3 pb-2 pt-1`,onSubmit:e=>{e.preventDefault(),ie()},children:[(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(`input`,{ref:S,className:`setup-input min-w-0 flex-1`,"aria-label":`Other model ID`,"aria-invalid":g?!0:void 0,"aria-describedby":g?`${C}-other-error`:void 0,value:m,placeholder:t.id===At.openrouter?`publisher/model`:`Model ID`,autoComplete:`off`,spellCheck:!1,onChange:e=>{h(e.target.value),_(null)}}),(0,q.jsx)(G,{type:`submit`,variant:`secondary`,size:`sm`,className:`h-auto self-stretch md:h-auto`,children:`Use`})]}),g&&(0,q.jsx)(`p`,{id:`${C}-other-error`,role:`alert`,className:`mt-1.5 text-copy-14 text-negative-400`,children:g})]}),(0,q.jsx)(`p`,{className:`px-3 pb-2 pt-1 text-copy-14 text-secondary`,children:`Applies to Aero only.`})]})]}),document.body)]})}function Vc(e){return Array.from(e?.querySelectorAll(`[role^="menuitem"]`)??[])}var Hc=144,Uc=288,Wc=288;function Gc({title:e,matches:t,selectedIndex:n,onHover:r,onPick:i}){let a=(0,K.useRef)(null),o=(0,K.useRef)(null),s=(0,K.useRef)(null),[c,l]=(0,K.useState)(Wc);return(0,K.useLayoutEffect)(()=>{let e=a.current,t=e?.closest(`[data-aero-panel]`),n=e?.parentElement;if(!e||!t||!n)return;let r=n.getBoundingClientRect().top-t.getBoundingClientRect().top-16-(o.current?.getBoundingClientRect().height??0);l(r>0?Math.min(Wc,Math.floor(r)):Wc)},[t.length]),(0,K.useEffect)(()=>{(s.current?.querySelector(`[aria-selected="true"]`))?.scrollIntoView?.({block:`nearest`})},[n]),(0,q.jsxs)(`div`,{ref:a,className:`absolute inset-x-3 bottom-full mb-2 overflow-hidden material-menu`,children:[(0,q.jsx)(`div`,{ref:o,className:`border-b border-default px-3 py-1.5 text-label-12 normal-case text-muted`,children:e}),(0,q.jsx)(`ul`,{ref:s,role:`listbox`,className:`overflow-y-auto py-1`,style:{maxHeight:c},children:t.map((e,t)=>{let a=t===n;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":a,onMouseEnter:()=>r(t),onClick:()=>i(e),className:`flex w-full items-center gap-3 px-3 py-2 text-left text-button-14 transition ${a?`bg-bg-elevated text-heading`:`text-neutral hover:bg-bg-elevated/60`}`,children:[(0,q.jsx)(`span`,{className:`text-button-14`,children:e.label}),(0,q.jsx)(`span`,{className:`ml-auto text-label-12-mono text-secondary`,children:e.command})]})},e.command)})})]})}function Kc({onPick:e}){return(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:wc.map(t=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>e(t.prompt),className:`rounded-md border border-base bg-bg-elevated/70 px-3 py-1.5 text-button-14 text-neutral transition hover:border-strong hover:bg-mono-800/70 hover:text-heading`,children:t.label},t.label))})}function qc(e){switch(e){case At.claude:return`ANTHROPIC_API_KEY`;case At.openai:return`OPENAI_API_KEY`;case At.gemini:return`GEMINI_API_KEY`;case At.zai:return`ZAI_API_KEY`;case At.openrouter:return`OPENROUTER_API_KEY`}}function Jc(e,t){let n=e.timestamp??0;return`${e.role}:${n}:${t}`}function Yc(e,t,n,r,i,a,o,s=!0,c){let l=[],u=[],d=e.at(-1),f=d?.role===`assistant`&&d.stopReason===`stop`,p=a&&!o&&!f,m=0;for(let t=e.length-1;t>=0;t--)if(e[t].role===`user`){m=t+1;break}let h=(e=!1)=>{u.length!==0&&(l.push((0,q.jsx)(dl,{trails:u,betweenSteps:e&&p},`tools:${u[0].id}`)),u=[])};for(let o=0;o<e.length;o++){let d=e[o],f=Jc(d,o);if(d.role===`user`){h();let e=typeof d.content==`string`?d.content:JSON.stringify(d.content);if(e.startsWith(`[system]`))continue;l.push((0,q.jsx)(Xc,{text:e,projectName:t,providerOverride:n,modelOverride:c,scope:r,context:d.aeroContext,cliCopy:s},f))}else if(d.role===`assistant`){let t=new Map,n=o+1;for(;n<e.length&&e[n].role===`toolResult`;){let r=e[n];t.set(r.toolCallId,r),n++}let r=a&&o>=m,s=Qc(d,t).map(e=>{let t=i.find(t=>t.id===e.id),n={...e,...t,label:e.label??t?.label};return{...n,interrupted:n.endedAt===void 0&&(!r||n.interrupted)}}),c=Cc(d);c.trim()&&(h(),l.push((0,q.jsxs)(`div`,{className:`mt-3`,children:[(0,q.jsx)(`div`,{className:`mb-0.5 text-label-12 normal-case text-positive-400`,children:`Aero`}),(0,q.jsx)(hl,{content:c})]},f))),u.push(...s),o=n-1}}return u.length===0&&p&&l.push((0,q.jsx)(gl,{},`thinking`)),h(!0),l}function Xc({text:e,projectName:t,providerOverride:n,modelOverride:r,scope:i,context:a,cliCopy:o=!0}){let[s,l]=(0,K.useState)(!1),u=(0,K.useMemo)(()=>Zc(t,e,n,i,a,r),[t,e,n,i,a,r]);async function d(){try{await navigator.clipboard.writeText(u),l(!0),window.setTimeout(()=>l(!1),1500)}catch{}}return(0,q.jsxs)(`div`,{className:`group relative mt-3 rounded-md bg-bg-elevated/60 px-3 py-2 text-strong`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`div`,{className:`text-label-12 normal-case text-muted`,children:`You`}),o&&(0,q.jsx)(`button`,{type:`button`,onClick:er(d),className:`inline-flex items-center gap-1 rounded border border-mono-800/70 bg-bg/60 px-1.5 py-0.5 text-button-14 text-secondary opacity-0 transition hover:border-strong hover:text-heading group-hover:opacity-100 focus:opacity-100`,"aria-label":`Copy as CLI command`,title:u,children:s?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(y,{className:`h-2.5 w-2.5 text-positive-400`,"aria-hidden":`true`}),`Copied`]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(c,{className:`h-2.5 w-2.5`,"aria-hidden":`true`}),`Copy as CLI`]})})]}),(0,q.jsx)(`div`,{className:`whitespace-pre-wrap`,children:e})]})}function Zc(e,t,n,r,i,a){let o=[`canonry`,`agent`,`ask`,Wr(e),Wr(t)];return n&&o.push(`--provider`,n),a&&o.push(`--model`,Wr(a)),r===`read-only`&&o.push(`--scope`,`read-only`),i&&o.push(`--context`,Wr(JSON.stringify(i))),o.join(` `)}function Qc(e,t){let n=[];for(let r of e.content){if(r.type!==`toolCall`)continue;let e=r,i=t.get(e.id);n.push({id:e.id,name:e.name,args:e.arguments,label:i?.aeroToolLabel,durationMs:i?.aeroDurationMs,endedAt:i?.timestamp,isError:i?.isError,result:i?.content})}return n}var $c=new Set([`aero_list_toolkits`,`aero_load_toolkit`]),el=new Map([[`Read`,`Reading`],[`List`,`Listing`],[`Get`,`Getting`],[`Load`,`Loading`],[`Find`,`Finding`],[`Check`,`Checking`],[`Compare`,`Comparing`],[`Inspect`,`Inspecting`],[`Preview`,`Previewing`],[`Search`,`Searching`],[`Show`,`Showing`],[`Run`,`Running`]]);function tl(e){return e.endedAt===void 0&&!e.interrupted}function nl(e){return e.label??e.name.replace(/^(?:canonry|aero)_/,``).replace(/_/g,` `)}function rl(e){let t=e.durationMs??(e.endedAt!=null&&e.startedAt!=null?e.endedAt-e.startedAt:null);return t==null||t<0?null:t}function il(e){let t=null;for(let n of e){let e=rl(n);e!=null&&(t=(t??0)+e)}return t}function al(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function ol(e){let t=Math.floor(Math.max(0,e)/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function sl(e,t,n){return`${e} ${e===1?t:n}`}function cl(e=``){return el.get(e.charAt(0).toUpperCase()+e.slice(1))}function ll(e){let[t,...n]=e.trim().split(/\s+/),r=cl(t);if(!r)return`Working…`;if(n[0]===`or`||n[0]===`and`){let e=cl(n[1]);return e?`${[r,n[0],e.toLowerCase(),...n.slice(2)].join(` `)}…`:`Working…`}return`${[r,...n].join(` `)}…`}function ul(e){let[t,n]=(0,K.useState)(()=>Date.now());return(0,K.useEffect)(()=>{if(!e)return;let t=()=>n(Date.now()),r=window.setTimeout(t,0),i=window.setInterval(t,1e3);return()=>{window.clearTimeout(r),window.clearInterval(i)}},[e]),t}function dl({trails:e,betweenSteps:t}){let[n,r]=(0,K.useState)(!1),i=(0,K.useId)(),a=e.filter(e=>!$c.has(e.name)),o=e.filter(e=>$c.has(e.name)),s=a.filter(tl),c=s.length>0?s[s.length-1]:void 0,l=o.some(tl),u=c!==void 0||l||t,d=a.length>0?a:o,f=d.filter(e=>!tl(e)&&e.isError===!0).length,p=e.some(e=>e.interrupted),h=e.flatMap(e=>e.startedAt===void 0?[]:[e.startedAt]),g=h.length>0?Math.min(...h):void 0,_=ul(u),v=il(d),b=u?c?ll(nl(c)):l?`Loading tools…`:a.length>0?`Reviewing results…`:`Preparing next step…`:a.length>0?sl(a.length,`step`,`steps`):sl(o.length,`setup step`,`setup steps`),x=new Map;for(let e of a){let t=nl(e),n=x.get(t);n?n.push(e):x.set(t,[e])}return(0,q.jsxs)(`div`,{className:`mt-3 material-base`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left`,"aria-expanded":n,"aria-controls":i,children:[(0,q.jsx)(`span`,{className:`flex h-3.5 w-3.5 shrink-0 items-center justify-center`,children:u?(0,q.jsx)(m,{className:`h-3 w-3 animate-spin text-positive-400 motion-reduce:animate-none`,"aria-hidden":`true`}):f>0?(0,q.jsx)(te,{className:`h-3 w-3 text-negative-400`,"aria-hidden":`true`}):p?(0,q.jsx)(ae,{className:`h-3 w-3 text-muted`,"aria-hidden":`true`}):(0,q.jsx)(y,{className:`h-3 w-3 text-muted`,"aria-hidden":`true`})}),(0,q.jsx)(`span`,{role:u?`status`:void 0,className:`min-w-0 truncate text-label-14-strong text-heading`,children:b}),f>0&&(0,q.jsxs)(`span`,{className:`shrink-0 rounded-md border border-negative-800/50 bg-negative-950/20 px-1.5 py-0.5 text-label-12 text-negative-400`,children:[f,` failed`]}),p&&(0,q.jsx)(`span`,{className:`shrink-0 rounded-md border border-mono-800/70 px-1.5 py-0.5 text-label-12 text-muted`,children:`interrupted`}),(0,q.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 text-label-12 text-muted`,children:[u?(0,q.jsxs)(q.Fragment,{children:[c&&(0,q.jsxs)(`span`,{children:[`step `,a.indexOf(c)+1]}),g!==void 0&&(0,q.jsx)(`span`,{className:`tabular-nums`,"aria-hidden":`true`,children:ol(_-g)})]}):v!=null&&(0,q.jsx)(`span`,{className:`tabular-nums`,children:al(v)}),(0,q.jsx)(M,{className:`h-3 w-3 transition-transform ${n?`rotate-90`:``}`,"aria-hidden":`true`})]})]}),n&&(0,q.jsxs)(`div`,{id:i,className:`space-y-1.5 border-t border-default px-2.5 py-2`,children:[[...x].map(([e,t])=>(0,q.jsx)(fl,{trails:t,title:e},`label:${e}`)),o.length>0&&(0,q.jsx)(fl,{trails:o,title:`+ ${sl(o.length,`setup step`,`setup steps`)}`,muted:!0},`setup`)]})]})}function fl({trails:e,title:t,muted:n=!1}){let[r,i]=(0,K.useState)(!1),a=(0,K.useId)(),o=!n&&e.length===1,s=e.some(tl),c=e.filter(e=>!tl(e)&&e.isError===!0).length,l=e.some(e=>e.interrupted),u=il(e),d=o?()=>i(!0):void 0;return(0,q.jsxs)(`div`,{className:o?void 0:n?`rounded-md`:`material-base`,onFocus:d,onClick:d,children:[!o&&(0,q.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left`,"aria-expanded":r,"aria-controls":a,children:[!n&&(0,q.jsx)(`span`,{className:`flex h-3.5 w-3.5 shrink-0 items-center justify-center`,children:s?(0,q.jsx)(m,{className:`h-3 w-3 animate-spin text-positive-400 motion-reduce:animate-none`,"aria-hidden":`true`}):c>0?(0,q.jsx)(te,{className:`h-3 w-3 text-negative-400`,"aria-hidden":`true`}):(0,q.jsx)(ee,{className:`h-3 w-3 text-muted`,"aria-hidden":`true`})}),(0,q.jsx)(`span`,{className:n?`text-label-12 text-muted`:`text-label-14-strong text-heading`,children:t}),!n&&(0,q.jsxs)(`span`,{className:`text-label-12 text-muted`,children:[`×`,e.length]}),(0,q.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-label-12 text-muted`,children:[s?(0,q.jsx)(`span`,{className:`text-positive-400`,children:`running…`}):(0,q.jsxs)(q.Fragment,{children:[c>0?(0,q.jsxs)(`span`,{className:`text-negative-400`,children:[c,` failed`]}):(0,q.jsx)(`span`,{children:l?`interrupted`:`done`}),u!=null&&(0,q.jsx)(`span`,{className:`tabular-nums`,children:al(u)})]}),(0,q.jsx)(M,{className:`h-3 w-3 transition-transform ${r?`rotate-90`:``}`,"aria-hidden":`true`})]})]}),(o||r)&&(0,q.jsx)(`div`,{id:a,className:o?void 0:`space-y-1.5 px-2.5 pb-2`,children:e.map(e=>(0,q.jsx)(pl,{trail:e},e.id))})]})}function pl({trail:e}){let[t,n]=(0,K.useState)(!1),r=tl(e),i=!r&&e.isError===!0,a=rl(e),o=a==null?null:al(a);return(0,q.jsxs)(`div`,{className:`rounded-md border ${i?`border-negative-800/50`:r?`border-positive-800/50`:`border-mono-800/70`} ${i?`bg-negative-950/20`:r?`bg-positive-950/20`:`bg-surface-hover`}`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left`,"aria-expanded":t,children:[(0,q.jsx)(`span`,{className:`flex h-3.5 w-3.5 shrink-0 items-center justify-center`,children:r?(0,q.jsx)(m,{className:`h-3 w-3 animate-spin text-positive-400`,"aria-hidden":`true`}):i?(0,q.jsx)(te,{className:`h-3 w-3 text-negative-400`,"aria-hidden":`true`}):(0,q.jsx)(ee,{className:`h-3 w-3 text-muted`,"aria-hidden":`true`})}),(0,q.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:nl(e)}),(0,q.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-label-12 text-muted`,children:[r?(0,q.jsx)(`span`,{className:`text-positive-400`,children:`running…`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{children:e.interrupted?`interrupted`:i?`failed`:`done`}),o&&(0,q.jsx)(`span`,{children:o})]}),(0,q.jsx)(M,{className:`h-3 w-3 transition-transform ${t?`rotate-90`:``}`,"aria-hidden":`true`})]})]}),t&&(0,q.jsxs)(`div`,{className:`border-t border-default px-2.5 py-2 text-label-12 text-secondary`,children:[(0,q.jsx)(`div`,{className:`mb-2 text-label-12 text-secondary`,children:e.name}),(0,q.jsx)(`div`,{className:`mb-1 text-label-12 text-secondary`,children:`Inputs`}),(0,q.jsx)(`pre`,{className:`mb-2 overflow-x-auto whitespace-pre-wrap break-all text-copy-13 text-neutral`,children:ml(e.args)}),!r&&e.result!==void 0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`mb-1 text-label-12 normal-case text-faint`,children:i?`Error`:`Result`}),(0,q.jsx)(`pre`,{className:`overflow-x-auto whitespace-pre-wrap break-all text-copy-13 text-neutral`,children:ml(e.result)})]})]})]})}function ml(e){try{let t=typeof e==`string`?e:JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}\n… (${t.length-2e3} more chars)`:t}catch{return String(e)}}function hl({content:e}){return(0,q.jsx)(`div`,{className:`text-heading`,children:(0,q.jsx)(he,{remarkPlugins:[ge],components:{h1:e=>(0,q.jsx)(`h1`,{...e,className:`mt-3 mb-2 text-heading-16 text-primary`}),h2:e=>(0,q.jsx)(`h2`,{...e,className:`mt-3 mb-2 text-heading-14 text-primary`}),h3:e=>(0,q.jsx)(`h3`,{...e,className:`mt-3 mb-1.5 text-heading-14 text-heading`}),h4:e=>(0,q.jsx)(`h4`,{...e,className:`mt-2 mb-1 text-heading-14 normal-case text-neutral`}),p:e=>(0,q.jsx)(`p`,{...e,className:`mb-2 text-copy-14`}),ul:e=>(0,q.jsx)(`ul`,{...e,className:`mb-2 ml-4 list-disc space-y-1`}),ol:e=>(0,q.jsx)(`ol`,{...e,className:`mb-2 ml-4 list-decimal space-y-1`}),li:e=>(0,q.jsx)(`li`,{...e,className:`marker:text-mono-600`}),strong:e=>(0,q.jsx)(`strong`,{...e,className:`text-primary`}),em:e=>(0,q.jsx)(`em`,{...e,className:`text-strong`}),code:({children:e,...t})=>(0,q.jsx)(`code`,{...t,className:`rounded bg-mono-800/70 px-1 py-0.5 text-label-12-mono text-positive-200`,children:e}),pre:e=>(0,q.jsx)(`pre`,{...e,className:`mb-2 overflow-x-auto material-base p-3 text-copy-13-mono text-strong`}),a:e=>(0,q.jsx)(`a`,{...e,className:`text-positive-400 underline decoration-positive-700 hover:decoration-positive-400`,target:`_blank`,rel:`noopener noreferrer`}),table:e=>(0,q.jsx)(`div`,{className:`mb-2 overflow-x-auto`,children:(0,q.jsx)(`table`,{...e,className:`w-full border-collapse text-label-12`})}),thead:e=>(0,q.jsx)(`thead`,{...e,className:`border-b border-base`}),th:e=>(0,q.jsx)(`th`,{...e,className:`px-2 py-1 text-left text-label-14-strong text-neutral`}),tr:e=>(0,q.jsx)(`tr`,{...e,className:`border-b border-mono-900`}),td:e=>(0,q.jsx)(`td`,{...e,className:`px-2 py-1 text-strong`}),blockquote:e=>(0,q.jsx)(`blockquote`,{...e,className:`mb-2 border-l-2 border-strong pl-3 italic text-secondary`}),hr:()=>(0,q.jsx)(`hr`,{className:`my-3 border-base`})},children:e})})}function gl(){return(0,q.jsxs)(`div`,{role:`status`,className:`mt-3 flex items-center gap-2 py-1.5 text-label-14 text-secondary`,children:[(0,q.jsx)(m,{className:`h-3 w-3 shrink-0 animate-spin motion-reduce:animate-none`,"aria-hidden":`true`}),`Thinking…`]})}function _l({isAdmin:e,account:t}){return e||t?.role===`viewer`&&qt()}function vl(){let{isAdmin:e,account:t}=Qn(),n=De(),r=/^\/projects\/([^/]+)/.exec(n.pathname),i=r?decodeURIComponent(r[1]):null,a=z({...yr({client:W}),enabled:i!==null,staleTime:6e4}),o=qs(n.pathname,n.search),s=a.data??[],c=s.find(e=>e.id===i)??s.find(e=>e.name===i),l=Jr(c?.name??i??``,o),u=zn(),d=u||_l({isAdmin:e,account:t});return!i||!d||!c?null:(0,q.jsx)(Rc,{projectName:c.name,context:l,preview:u},c.name)}function yl(e,t,n){switch(e.invalidateQueries({queryKey:hr({client:W})}),e.invalidateQueries({queryKey:pr({client:W})}),or(e,`runs`),t){case U[`answer-visibility`]:gs(e,n,`none`),or(e,`visibilityReport`),or(e,`queryTracking`);return;case U[`backlink-extract`]:return;case U[`seo-sync`]:or(e,`seo`,{projectName:n});return;case U[`site-audit`]:or(e,`technicalAeo`),or(e,`trends`,{projectName:n});return;case U[`gsc-sync`]:case U[`inspect-sitemap`]:or(e,`gsc`),or(e,`trends`,{projectName:n});return;case U[`ga-sync`]:or(e,`ga`);return;case U[`traffic-sync`]:or(e,`ga`),or(e,`traffic`);return;case U[`bing-inspect`]:case U[`bing-inspect-sitemap`]:or(e,`bing`),or(e,`trends`,{projectName:n});return;case U[`aeo-discover-seed`]:case U[`aeo-discover-probe`]:gs(e,n);return;case U[`gbp-sync`]:or(e,`gbp`);return;case U[`ads-sync`]:or(e,`ads`);return;case U[`google-ads-sync`]:or(e,`googleAds`),or(e,`conversionTracking`);return;case U[`gtm-sync`]:or(e,`gtm`),or(e,`conversionTracking`);return;default:return t}}var bl=[{label:`GitHub`,href:`https://github.com/Canonry/canonry`,Icon:v},{label:`Docs`,href:`https://github.com/Canonry/canonry/tree/main/docs`,Icon:T},{label:`Changelog`,href:`https://github.com/Canonry/canonry/releases`,Icon:ce}],xl=e=>({label:e,state:`checking`,detail:`Checking service health`}),Sl={apiStatus:xl(`API`),workerStatus:xl(`Worker`)};function Cl(e){return e===`completed`?`positive`:e===`partial`?`caution`:`negative`}function wl(e){let t=Ns(e.kind);return e.status===`completed`?`${t} completed`:e.status===`partial`?`${t} completed with partial results`:e.status===`cancelled`?`${t} cancelled`:`${t} failed`}function Tl(e,t){return e.error?`${t}: ${cn(e.error)}`:e.location?`${t} · ${e.location}`:t}function El(e,t,n){if(t)return t;let r=n.find(t=>t.id===e);return r?.displayName||r?.name||e}function Dl(e,t){return[e.completed>0?`${e.completed} completed`:null,e.partial>0?`${e.partial} partial`:null,e.failed>0?`${e.failed} failed`:null,e.cancelled>0?`${e.cancelled} cancelled`:null,t>0?`${t} skipped at queue time`:null].filter(Boolean).join(`, `)}function Ol(e){return e.failed>0||e.cancelled>0?`negative`:e.partial>0?`caution`:`positive`}function kl(){let e=_e(),t=(0,K.useSyncExternalStore)(Fi,Pi,Pi),n=Object.keys(t.runs).length>0||Object.keys(t.batches).length>0,r=z({...wr({client:W}),enabled:n,staleTime:tr,refetchInterval:3e3}),i=z({...yr({client:W}),enabled:n}),a=(0,K.useRef)({}),o=(0,K.useCallback)(()=>{r.refetch()},[r.refetch]);return(0,K.useEffect)(()=>{n&&o()},[n,o]),(0,K.useEffect)(()=>{if(!n||typeof window>`u`)return;let e=()=>{document.visibilityState===`visible`&&o()};return window.addEventListener(`focus`,o),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,o),document.removeEventListener(`visibilitychange`,e)}},[n,o]),(0,K.useEffect)(()=>{let n=r.data??[],o=i.data??[],s=Object.fromEntries(n.map(e=>[e.id,e])),c=Object.fromEntries(n.map(e=>[e.id,e.status]));for(let n of Object.values(t.runs)){let t=s[n.runId];if(!t||!Bi(t.status)||(a.current[t.id]??n.lastAnnouncedStatus)===t.status)continue;let r=o.find(e=>e.id===t.projectId);if(r&&yl(e,t.kind,r.name),n.sourceAction===`run-all`){Li(t.id);continue}let i=El(t.projectId,n.projectLabel,o);rr({title:wl(t),detail:Tl(t,i),tone:Cl(t.status),dedupeKey:`run:${t.id}`,dedupeMode:`replace`,cta:{label:`View run`,intent:`open-run-drawer`,runId:t.id}}),Li(t.id)}if(r.data!==void 0){let r=new Set(n.map(e=>e.id)),i=Hi(Object.values(t.runs),r,Date.now(),Vi);for(let t of i){let n=o.find(e=>e.id===t.projectId);n&&yl(e,t.kind,n.name),t.sourceAction!==`run-all`&&rr({title:`${Ns(t.kind)} status unavailable`,detail:El(t.projectId,t.projectLabel,o),tone:`neutral`,dedupeKey:`run-stale:${t.runId}`,dedupeMode:`replace`}),Li(t.runId)}}for(let e of Object.values(t.batches)){let t=Ui(e.runIds,s);t.finished&&(rr({title:`Run-all batch finished`,detail:Dl(t,e.skippedCount),tone:Ol(t),dedupeKey:`batch:${e.batchId}`,dedupeMode:`replace`,cta:{label:`View runs`,intent:`go-to-runs`}}),zi(e.batchId))}a.current=c},[i.data,r.data,t,e]),null}function Al(){let{account:e,isAdmin:t}=Qn(),n=ps(),r=(0,K.useMemo)(()=>_n(),[]),a=(0,K.useMemo)(_t,[]),c=(0,K.useMemo)(Ft,[]),d=zn()||c&&_l({isAdmin:t,account:e}),f=(0,K.useMemo)(Fe,[]),p=De(),m=Se(),h=(0,K.useRef)(!1);(0,K.useEffect)(()=>{if(r){if(!h.current){h.current=!0;let e=oi(p.pathname,si());if(e){m({to:e,replace:!0});return}}ci(ai(p.pathname))}},[r,p.pathname,m]);let{dashboard:g,isLoading:v,refetch:y}=ms(void 0,{includeSettings:!r,includeOverviews:!1,pauseProjectPolling:p.pathname===`/setup`}),b=Ss(!n,n?.health).data??n?.health??Sl,{runId:x,evidenceId:C,closeDrawer:T}=ws(),[E,D]=(0,K.useState)(!1),[k,A]=(0,K.useState)(()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(`canonry:sidebarHidden`)===`true`}catch{return!1}}),[ee,j]=(0,K.useState)(()=>{if(typeof window>`u`)return null;try{return window.localStorage.getItem(`canonry:dismissedUpdateVersion`)}catch{return null}}),[te]=(0,K.useState)(()=>typeof window>`u`?null:new URLSearchParams(window.location.search).get(`force-update`)),re=te?{current:b.apiStatus.version??`0.0.0`,latest:te,url:`https://www.npmjs.com/package/@canonry/canonry`,upgradeCommand:`npm install -g @canonry/canonry`}:b.apiStatus.updateAvailable,ie=f&&re&&re.latest!==ee,P=()=>{if(re){try{window.localStorage.setItem(`canonry:dismissedUpdateVersion`,re.latest)}catch{}j(re.latest)}},ae=()=>{let e=!k;try{e?window.localStorage.setItem(`canonry:sidebarHidden`,`true`):window.localStorage.removeItem(`canonry:sidebarHidden`)}catch{}A(e)},ce=Cs(x),F=ce.data??null,me=ce.isLoading;(0,K.useEffect)(()=>{F&&F.status!==`running`&&F.status!==`queued`&&y()},[F?.status,y]),(0,K.useEffect)(()=>{D(!1)},[p.pathname]),(0,K.useEffect)(()=>{if(typeof window>`u`||E||!x&&!C)return;let e=e=>{e.key===`Escape`&&T()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[x,C,T,E]);let he=g??n?.dashboard??null,R=p.pathname===`/setup`,ge=R&&he!==null&&he.portfolioOverview.projects.length===0,_e=R&&(p.search.onboarding===`site-health`||p.search.onboarding===`first-run`||p.search.onboarding===`complete`),[ve,ye]=(0,K.useState)(ge);(0,K.useEffect)(()=>{R?ge&&ye(!0):ye(!1)},[ge,R]);let be=R&&(_e||ge||ve||R&&he===null),z=be?`app-shell-focus`:k?`app-shell-sidebar-hidden`:``,xe=x?(he?jo(he,x):void 0)??(F?Wo(F,he?.projects.find(e=>e.project.id===F.projectId)?.project.displayName??he?.projects.find(e=>e.project.id===F.projectId)?.project.name??`Unknown project`):void 0):void 0,Ce=(0,K.useMemo)(()=>Do(p.pathname,he),[p.pathname,he]),{commandCenter:we,evidenceLoading:Te,evidenceError:B,isError:Ee,refetch:ke}=ys(C?Ce:null,{evidence:!0}),Ae=(0,K.useMemo)(()=>{if(C)return No(we,he,C)},[C,we,he]),je=(()=>{let e=p.pathname;if(e===`/`)return`All projects`;if(e===`/projects`)return`Projects`;if(e===`/runs`)return`Runs`;if(e===`/history`)return`History`;if(e===`/settings`)return`Settings`;if(e===`/setup`)return`Setup`;if(e===`/agent-setup`)return`Agent setup`;if(e===`/backlinks`)return`Backlink data`;if(e===`/traffic`||e.startsWith(`/traffic/`))return`Traffic sources`;if(e.startsWith(`/projects/`)){let e=he?.projects.find(e=>e.project.name===Ce);return e?.project.displayName||e?.project.name||Ce||`Projects`}return`Not found`})();if(r){let e=Hr(r.projectTabs),t=!r.views||r.views.includes(Yr(p.pathname));return(0,q.jsxs)(`div`,{className:`app-shell app-shell-embed`,"data-theme":di(r.theme),style:fi(r.theme),children:[(0,q.jsx)(`a`,{className:`skip-link`,href:`#content`,children:`Skip to content`}),(0,q.jsx)(`main`,{id:`content`,className:`page-shell`,children:e?(0,q.jsx)(`div`,{className:`embed-view-unavailable`,role:`status`,children:`This embed uses the retired Report tab. Update its allowed tabs to show AI Visibility.`}):t?(0,q.jsx)(Oe,{}):(0,q.jsx)(`div`,{className:`embed-view-unavailable`,role:`status`,children:`This view is not available in embed mode.`})})]})}let Me=(0,q.jsxs)(`footer`,{className:`footer`,children:[(0,q.jsxs)(`span`,{className:`footer-brand`,children:[(0,q.jsx)(`span`,{children:(0,q.jsx)(`a`,{href:`https://canonry.ai`,children:`Canonry`})}),b.apiStatus.version&&b.apiStatus.version!==`unknown`?(0,q.jsxs)(`span`,{className:`footer-version`,children:[`v`,b.apiStatus.version]}):null]}),a?(0,q.jsx)(`div`,{className:`footer-links`,children:bl.map(({label:e,href:t,Icon:n})=>(0,q.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,title:e,"aria-label":e,className:`footer-icon`,children:(0,q.jsx)(n,{className:`size-3.5`})},t))}):null]});return(0,q.jsxs)(pe,{open:E,onOpenChange:D,children:[(0,q.jsx)(`a`,{className:`skip-link`,href:`#content`,children:`Skip to content`}),(0,q.jsx)(Ms,{}),(0,q.jsxs)(`div`,{className:`app-shell ${z}${Et()?` app-shell-demo`:``}`,children:[!be&&!k&&(0,q.jsxs)(`aside`,{id:`desktop-sidebar`,className:`sidebar`,"aria-label":`Primary navigation`,children:[(0,q.jsx)(`div`,{className:`sidebar-brand`,children:(0,q.jsx)(Ki,{version:b.apiStatus.version,updateAvailable:ie?re:null,onDismissUpdate:P})}),(0,q.jsxs)(`nav`,{className:`sidebar-nav`,children:[(0,q.jsxs)(V,{to:`/`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!0},children:[(0,q.jsx)(l,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`All projects`})]}),(0,q.jsxs)(V,{to:`/projects`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!1},children:[(0,q.jsx)(u,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`Projects`})]}),(0,q.jsxs)(V,{to:`/runs`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!0},children:[(0,q.jsx)(i,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`Runs`})]}),(0,q.jsxs)(V,{to:`/history`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!0},children:[(0,q.jsx)(S,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`History`})]}),(0,q.jsxs)(V,{to:`/traffic`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!1},children:[(0,q.jsx)(se,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`Traffic sources`})]}),!Et()&&(0,q.jsxs)(V,{to:`/backlinks`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!0},children:[(0,q.jsx)(s,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`Backlink data`})]}),!Et()&&(0,q.jsxs)(V,{to:`/agent-setup`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!0},children:[(0,q.jsx)(w,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`Agent setup`})]}),t&&(0,q.jsxs)(V,{to:`/settings`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!0},children:[(0,q.jsx)(ne,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`Settings`})]}),v?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`sidebar-section-title`,children:`Tracked projects`}),[1,2,3].map(e=>(0,q.jsxs)(`div`,{className:`sidebar-skeleton-item`,children:[(0,q.jsx)(`span`,{className:`skeleton-circle size-2`}),(0,q.jsx)(`span`,{className:`skeleton-text flex-1`,style:{width:`${50+e*15}%`}})]},e))]}):he&&he.projects.length>0?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`sidebar-section-title`,children:`Tracked projects`}),he.projects.map(e=>{let t=e.visibilitySummary.tone;return(0,q.jsxs)(V,{to:`/projects/$projectName`,params:{projectName:e.project.name},className:`sidebar-project`,activeProps:{className:`sidebar-project sidebar-project-active`},children:[(0,q.jsx)(`span`,{className:`sidebar-dot sidebar-dot-${t}`}),(0,q.jsx)(`span`,{children:e.project.displayName||e.project.name})]},e.project.id)})]}):v?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`sidebar-section-title`,children:`Resources`}),t&&(0,q.jsxs)(V,{to:`/setup`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!0},children:[(0,q.jsx)(oe,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`Setup`})]})]})]}),e&&(0,q.jsxs)(`div`,{className:`sidebar-account`,children:[(0,q.jsxs)(`div`,{className:`sidebar-account-identity`,children:[(0,q.jsx)(`span`,{className:`sidebar-account-name`,children:e.name}),e.role===`viewer`?(0,q.jsx)(`span`,{className:`sidebar-account-role`,children:Kt()}):null]}),(0,q.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:er(async()=>{await On(),window.location.reload()}),children:`Sign out`})]}),Me]}),(0,q.jsxs)(`div`,{className:`main-area ${d&&Ce?`main-area-agent-bar`:``}`.trim(),children:[(0,q.jsxs)(`header`,{className:`topbar`,children:[(0,q.jsxs)(`div`,{className:`topbar-left`,children:[!be&&(0,q.jsx)(G,{className:`sidebar-privacy-toggle`,variant:`ghost`,size:`icon`,type:`button`,"aria-label":k?`Show sidebar`:`Hide sidebar`,"aria-controls":k?void 0:`desktop-sidebar`,"aria-expanded":!k,title:k?`Show sidebar`:`Hide sidebar`,onClick:ae,children:k?(0,q.jsx)(_,{className:`size-4`}):(0,q.jsx)(o,{className:`size-4`})}),(0,q.jsx)(`div`,{className:`topbar-brand-mobile`,children:(0,q.jsx)(Ki,{compact:!0})}),(0,q.jsxs)(`nav`,{className:`breadcrumb`,"aria-label":`Breadcrumb`,children:[(0,q.jsx)(V,{to:`/`,children:`Home`}),(0,q.jsx)(M,{className:`breadcrumb-sep size-3`}),(0,q.jsx)(`span`,{className:`breadcrumb-current`,children:je})]})]}),(0,q.jsxs)(`div`,{className:`topbar-actions`,children:[(0,q.jsx)(eo,{}),(0,q.jsx)(Fs,{}),(0,q.jsxs)(`div`,{className:`health-pill-row`,children:[(0,q.jsxs)(`span`,{className:`health-pill health-pill-${b.apiStatus.state}`,title:bi(b.apiStatus),children:[`API `,b.apiStatus.state===`ok`?`ok`:b.apiStatus.state]}),(0,q.jsx)(`span`,{className:`health-pill health-pill-${b.workerStatus.state}`,title:bi(b.workerStatus),children:`Worker ${b.workerStatus.state===`ok`?`ok`:b.workerStatus.state}`})]}),be?null:(0,q.jsx)(ue,{asChild:!0,children:(0,q.jsxs)(G,{className:`nav-toggle`,variant:`secondary`,size:`icon`,type:`button`,children:[(0,q.jsx)(O,{className:`size-4`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Open navigation`})]})})]})]}),be?null:(0,q.jsxs)(fe,{children:[(0,q.jsx)(le,{className:`fixed inset-0 z-40`}),(0,q.jsxs)(I,{className:`mobile-nav mobile-nav-open`,"aria-describedby":void 0,children:[(0,q.jsx)(L,{className:`sr-only`,children:`Navigation`}),(0,q.jsx)(de,{asChild:!0,children:(0,q.jsxs)(G,{className:`mobile-nav-close`,variant:`ghost`,size:`icon`,type:`button`,children:[(0,q.jsx)(N,{className:`size-5`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Close navigation`})]})}),(0,q.jsx)(V,{to:`/`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!0},children:`All projects`}),(0,q.jsx)(V,{to:`/projects`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!1},children:`Projects`}),(0,q.jsx)(V,{to:`/runs`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!0},children:`Runs`}),(0,q.jsx)(V,{to:`/history`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!0},children:`History`}),(0,q.jsx)(V,{to:`/traffic`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!1},children:`Traffic sources`}),!Et()&&(0,q.jsx)(V,{to:`/backlinks`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!0},children:`Backlink data`}),!Et()&&(0,q.jsx)(V,{to:`/agent-setup`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!0},children:`Agent setup`}),t&&(0,q.jsx)(V,{to:`/settings`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!0},children:`Settings`}),he&&he.projects.length>0?(0,q.jsxs)(`div`,{className:`mobile-nav-section`,children:[(0,q.jsx)(`p`,{className:`mobile-nav-section-title`,children:`Tracked projects`}),he.projects.map(e=>(0,q.jsx)(V,{to:`/projects/$projectName`,params:{projectName:e.project.name},className:`mobile-nav-link`,children:e.project.name},e.project.id))]}):null,e&&(0,q.jsxs)(`div`,{className:`mobile-nav-section`,children:[(0,q.jsx)(`p`,{className:`mobile-nav-section-title`,children:`Signed in`}),(0,q.jsxs)(`div`,{className:`sidebar-account`,children:[(0,q.jsxs)(`div`,{className:`sidebar-account-identity`,children:[(0,q.jsx)(`span`,{className:`sidebar-account-name`,children:e.name}),e.role===`viewer`?(0,q.jsx)(`span`,{className:`sidebar-account-role`,children:Kt()}):null]}),(0,q.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`mobile-sign-out`,onClick:er(async()=>{await On(),window.location.reload()}),children:`Sign out`})]})]}),Me]})]}),(0,q.jsx)(`main`,{id:`content`,className:`page-shell`,children:v&&!n?(0,q.jsxs)(`div`,{className:`page-skeleton`,children:[(0,q.jsxs)(`div`,{className:`page-skeleton-header`,children:[(0,q.jsx)(`div`,{className:`skeleton-text h-6 w-40`}),(0,q.jsx)(`div`,{className:`skeleton-text-sm w-72`})]}),(0,q.jsx)(`div`,{className:`page-skeleton-grid`,children:[1,2,3].map(e=>(0,q.jsxs)(`div`,{className:`page-skeleton-card`,children:[(0,q.jsx)(`div`,{className:`skeleton-text w-24`}),(0,q.jsx)(`div`,{className:`skeleton-text w-full`}),(0,q.jsx)(`div`,{className:`skeleton-text-sm w-3/4`})]},e))}),(0,q.jsx)(`div`,{className:`page-skeleton-grid`,style:{gridTemplateColumns:`1fr 1fr`},children:[1,2].map(e=>(0,q.jsxs)(`div`,{className:`page-skeleton-card`,children:[(0,q.jsx)(`div`,{className:`skeleton-text w-20`}),(0,q.jsx)(`div`,{className:`space-y-2`,children:[1,2,3].map(e=>(0,q.jsx)(`div`,{className:`skeleton-text-sm w-full`},e))})]},e))})]}):(0,q.jsx)(Oe,{})})]}),x&&!xe&&me?(0,q.jsx)(po,{open:!0,title:`Loading run details`,subtitle:`Fetching the durable run record`,onClose:T,children:(0,q.jsx)(`p`,{className:`text-copy-14 text-muted`,role:`status`,children:`Loading run details…`})}):null,x&&!xe&&ce.isError?(0,q.jsx)(po,{open:!0,title:`Run unavailable`,subtitle:`The run could not be loaded`,onClose:T,children:(0,q.jsx)(`p`,{className:`text-copy-14 text-negative`,children:ce.error instanceof Error?ce.error.message:`Run details are unavailable.`})}):null,xe?(0,q.jsxs)(po,{open:!0,title:xe.summary,subtitle:`${xe.projectName} \u00b7 ${xe.kindLabel}`,onClose:T,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-5 gap-y-1 text-label-14`,children:[(0,q.jsx)(to,{status:xe.status}),(0,q.jsx)(`span`,{className:`text-secondary`,children:xe.startedAt}),(0,q.jsx)(`span`,{className:`text-muted`,children:xe.duration}),(0,q.jsx)(`span`,{className:`text-faint`,children:xe.triggerLabel})]}),xe.status===`failed`&&xe.statusDetail&&(0,q.jsx)(`p`,{className:`mt-2 text-copy-14 text-negative`,children:xe.statusDetail}),(0,q.jsxs)(`div`,{className:`mt-4`,children:[(0,q.jsx)(`p`,{className:`text-label-12-strong normal-case text-muted mb-2`,children:`Activity Log`}),me?(0,q.jsx)(`p`,{className:`text-copy-14 text-muted`,children:`Loading run details...`}):F?.snapshots&&F.snapshots.length>0?(0,q.jsxs)(`div`,{className:`space-y-2`,children:[F.snapshots.map(e=>(0,q.jsxs)(`div`,{className:`material-base p-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,q.jsx)(`p`,{className:`text-copy-14-strong text-strong truncate`,children:e.query??`Unknown query`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(Ga,{provider:e.provider}),(0,q.jsx)(pn,{variant:e.citationState===Ct.cited?`success`:`neutral`,children:e.citationState})]})]}),e.model&&(0,q.jsx)(`p`,{className:`text-copy-13-mono text-muted`,children:e.model}),e.citedDomains.length>0&&(0,q.jsxs)(`p`,{className:`text-copy-13 text-muted mt-1`,children:[(0,q.jsx)(`span`,{className:`text-secondary`,children:`Sources:`}),` `,e.citedDomains.join(`, `)]}),e.citedCompetitorDomains.length>0&&(0,q.jsxs)(`p`,{className:`text-copy-13 text-negative-400/80 mt-0.5`,children:[`Competitor cited: `,e.citedCompetitorDomains.join(`, `)]}),e.mentionedCompetitorDomains.length>0&&(0,q.jsxs)(`p`,{className:`text-copy-13 text-negative-400/80 mt-0.5`,children:[`Competitor mentioned: `,e.mentionedCompetitorDomains.join(`, `)]}),e.groundingSources&&e.groundingSources.length>0&&(0,q.jsxs)(`details`,{className:`mt-2`,children:[(0,q.jsxs)(`summary`,{className:`text-label-12 text-muted cursor-pointer hover:text-secondary`,children:[e.groundingSources.length,` grounding source`,e.groundingSources.length===1?``:`s`]}),(0,q.jsx)(`ul`,{className:`mt-2 space-y-3`,children:e.groundingSources.map((e,t)=>(0,q.jsx)(`li`,{className:`min-w-0`,children:(0,q.jsx)(go,{url:e.uri,title:e.title})},t))})]}),e.answerText&&(0,q.jsxs)(`details`,{className:`mt-1`,children:[(0,q.jsx)(`summary`,{className:`text-label-12 text-muted cursor-pointer hover:text-secondary`,children:`Answer preview`}),(0,q.jsx)(`p`,{className:`mt-1 text-copy-13 text-secondary whitespace-pre-wrap`,children:e.answerText})]})]},e.id)),F.status===`running`&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2 p-3 text-label-14 text-muted`,children:[(0,q.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-caution-500 animate-pulse`}),`Running remaining queries...`]})]}):F&&F.status===H.running?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 p-3 text-label-14 text-muted`,children:[(0,q.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-caution-500 animate-pulse`}),F.kind===U[`answer-visibility`]?`Waiting for first query result...`:`Run is in progress...`]}):F&&F.status===H.queued?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 p-3 text-label-14 text-muted`,children:[(0,q.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-mono-500 animate-pulse`}),`Run queued, waiting for execution slot...`]}):F&&F.error?(0,q.jsxs)(`div`,{className:`rounded-md border border-negative-800/40 bg-negative-950/20 p-3`,children:[(0,q.jsx)(`p`,{className:`text-copy-14-strong text-negative mb-2`,children:`Run failed`}),(0,q.jsx)(`pre`,{className:`max-h-48 overflow-y-auto whitespace-pre-wrap break-words text-copy-13-mono text-negative`,children:qn(F.error)})]}):xe.kind===U[`answer-visibility`]?(0,q.jsx)(`p`,{className:`text-copy-14 text-muted`,children:`No snapshot data available.`}):(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:xe.status===H.completed?`Run completed.`:xe.status===H.partial?`Run completed with partial results.`:xe.status===H.cancelled?`Run cancelled.`:xe.status===H.failed?`Run failed.`:`No run details available.`})]})]}):null,C&&!Ae?(0,q.jsx)(po,{open:!0,title:Te?`Loading answer`:`Answer unavailable`,subtitle:`Query evidence`,onClose:T,children:Te?(0,q.jsx)(`p`,{role:`status`,className:`text-copy-14 text-secondary`,children:`Loading answer…`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{role:`alert`,className:`text-copy-14 text-secondary`,children:B||Ee?`Could not load this answer.`:`This answer is not in the available query evidence.`}),(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:()=>{ke()},children:`Retry`})]})}):null,Ae?(0,q.jsx)(wo,{evidence:Ae.evidence,project:Ae.project,onClose:T}):null,(0,q.jsx)(kl,{}),(0,q.jsx)(Ds,{}),d?(0,q.jsx)(vl,{}):null]})]})}var jl=class extends K.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[ErrorBoundary]`,e,t.componentStack),Ve({kind:`render`,error:e,component:this.props.name??`root`})}handleReset=()=>{this.setState({error:null})};render(){return this.state.error?(0,q.jsx)(`div`,{className:`page-container`,children:(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-4 py-20 text-center`,children:[(0,q.jsx)(`div`,{className:`rounded-full bg-negative-950/40 p-3`,children:(0,q.jsx)(te,{className:`size-6 text-negative-400`})}),(0,q.jsx)(`h2`,{className:`text-heading-20 text-heading`,children:`Something went wrong`}),(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary max-w-md`,children:this.state.error.message||`An unexpected error occurred while rendering this page.`}),(0,q.jsxs)(`div`,{className:`flex gap-3 mt-2`,children:[(0,q.jsxs)(G,{variant:`secondary`,size:`sm`,onClick:this.handleReset,children:[(0,q.jsx)(E,{className:`size-3.5 mr-1.5`}),`Try again`]}),(0,q.jsx)(G,{variant:`secondary`,size:`sm`,onClick:()=>{let e=window.__CANONRY_CONFIG__?.basePath?.replace(/\/$/,``)??``;window.location.href=e||`/`},children:`Go home`})]})]})}):this.props.children}};function Ml({disabled:e,title:t,...n}){let{canWrite:r}=Qn();return r?(0,q.jsx)(G,{disabled:e,title:t,...n}):(0,q.jsx)(G,{...n,disabled:!0,title:Zn})}function Nl({title:e,children:t}){let{isAdmin:n}=Qn();return n?(0,q.jsx)(q.Fragment,{children:t}):(0,q.jsxs)(Pr,{className:`surface-card mx-auto mt-8 max-w-lg`,children:[(0,q.jsxs)(jr,{children:[(0,q.jsxs)(Ar,{children:[e,` is for administrators`]}),(0,q.jsx)(Nr,{children:`Your account has view-only access. You can read everything this install has measured; changing how it is set up needs an administrator account.`})]}),(0,q.jsx)(Mr,{children:(0,q.jsx)(`p`,{className:`supporting-copy`,children:`If you need to make a change here, ask an administrator on this install.`})})]})}var Pl=`Sources`,Fl={copy:`Copy answer`,copying:`Copying…`,copied:`Copied`,failed:`Could not copy. Select and copy the answer above.`};function Il({previewLength:e,highlight:t}){return n=>{if(e!==void 0&&Number.isFinite(e)){let t=Math.max(0,Math.floor(e)),r={field:`value`,omitted:!1},i=e=>{if(e.type===`definition`)return!0;if(e.children)return e.children=e.children.filter(i),e.children.length>0;let n=e.type===`image`||e.type===`imageReference`?`alt`:`value`,a=e[n];if(a===void 0)return t>0;let o=Array.from(a);if(o.length===0)return t>0;if(t===0)return r.omitted=!0,!1;let s=o.length>t,c=o.slice(0,t);if(s&&!/\s/.test(o[t])){let e=c.length-1;for(;e>=0&&!/\s/.test(c[e]);)e--;e>=0&&e>t-40&&(c.length=e)}return r.omitted||=s,e[n]=c.join(``),t=s?0:t-c.length,c.length!==0&&(r.lastNode=e,r.field=n,!0)};i(n),r.omitted&&(r.lastNode?r.lastNode[r.field]=`${r.lastNode[r.field].trimEnd()}…`:n.children?.push({type:`paragraph`,children:[{type:`text`,value:`…`}]}))}if(t){let e=t=>{[`link`,`linkReference`,`code`,`inlineCode`].includes(t.type)||(t.type===`text`&&(t.data={...t.data,hName:`span`}),t.children?.forEach(e))};e(n)}}}function Ll({headingLevel:e}){return t=>{let n=[],r=e=>{e.type===`heading`&&e.depth&&n.push(e),e.children?.forEach(r)};r(t);let i=n.reduce((e,t)=>Math.min(e,t.depth),6);for(let t of n){let n=t.depth-i;t.depth=Math.min(6,e+n),t.data={...t.data,hProperties:{...t.data?.hProperties,"data-answer-heading-level":n+1}}}}}function Rl({answer:e}){let[t,n]=(0,K.useState)(`idle`),r=(0,K.useRef)(!1),i=async()=>{if(!r.current){r.current=!0,n(`copying`);try{await navigator.clipboard.writeText(e),n(`copied`)}catch{n(`failed`)}finally{r.current=!1}}};return(0,q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3`,children:[(0,q.jsx)(G,{type:`button`,variant:`ghost`,className:`pointer-coarse:min-h-11 px-2`,"aria-disabled":t===`copying`,"aria-busy":t===`copying`,onClick:()=>{i()},children:t===`copying`?Fl.copying:Fl.copy}),(0,q.jsx)(`span`,{role:`status`,className:`text-label-14 text-secondary`,children:t===`copied`?Fl.copied:t===`failed`?Fl.failed:``})]})}var zl=(0,K.memo)(function({children:e,headingLevel:t=4,copyable:n=!1,highlightGroups:r,previewLength:i}){return(0,q.jsxs)(`div`,{className:`answer-markdown`,children:[(0,q.jsx)(he,{remarkPlugins:[[Ll,{headingLevel:t}],[Il,{previewLength:i,highlight:!!r?.length}]],components:{p:({children:e})=>(0,q.jsx)(`p`,{className:`mb-3 whitespace-pre-wrap last:mb-0`,children:e}),ul:({children:e})=>(0,q.jsx)(`ul`,{className:`mb-3 ml-5 list-disc space-y-1`,children:e}),ol:({children:e,start:t})=>(0,q.jsx)(`ol`,{start:t,className:`mb-3 ml-5 list-decimal space-y-1`,children:e}),pre:({children:e})=>(0,q.jsx)(`pre`,{className:`mb-3 overflow-x-auto whitespace-pre-wrap`,children:e}),span:({children:e})=>(0,q.jsx)(`span`,{children:typeof e==`string`&&r?e.split(/(https?:\/\/[^\s<>]+)/i).map((e,t)=>t%2?e:(0,q.jsx)(K.Fragment,{children:bo(e,r)},t)):e}),a:({children:e,href:t})=>{let n=ho(t);return n?(0,q.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`text-link underline`,children:e}):(0,q.jsx)(`span`,{children:e})},img:({alt:e})=>(0,q.jsx)(`span`,{children:e})},children:e}),n&&e.trim()?(0,q.jsx)(Rl,{answer:e},e):null]})});function Bl(e,t,n){return{mode:t,scope:e.measurementScope,scopeKey:e.measurementScopeKey,marketKey:e.marketKey,queryClass:e.queryClass===`non-brand`?`non-brand`:`branded`,provider:e.provider,model:e.model,location:e.location,runId:e.measurementRunId,revision:e.revision,evaluationDefinitionId:n}}function Vl(e,t,n){let r=[...new Set(t.filter(e=>!n||e.provider===n).map(e=>e.sourceRunId).filter(e=>!!e))].sort();return{...e,mode:`simple`,scope:`project`,scopeKey:void 0,marketKey:void 0,provider:n||void 0,model:void 0,revision:void 0,runId:r.length===1?r[0]:void 0,runIds:r.length>1?r:void 0}}function Hl(e,t,n,r){return[`sentiment`,e,t,n??null,r??null]}var Ul=5e3,Wl=new Set([`pending`,`running`,`waiting-to-retry`]);function Gl(e){return Wl.has(e.state)}function Kl(e){let t=e?.coverage.counts;return!!(t&&t.pending+t.running+t[`waiting-to-retry`]>0)}function ql(e,t){return Kl(e)||t?Ul:!1}function Jl(e,t,n=!0){let r=z({queryKey:Hl(e,`settings`),queryFn:()=>Me(e),retry:!1,staleTime:0,refetchOnWindowFocus:`always`}),i=z({queryKey:Hl(e,`jobs`),queryFn:()=>mt(e),enabled:!!r.data?.actions.configure,retry:!1,refetchOnWindowFocus:`always`,refetchInterval:e=>e.state.data?.jobs.some(Gl)?Ul:!1}),a=!!i.data?.jobs.some(Gl),o=i=>{let o={...t,queryClass:i};return{queryKey:Hl(e,`summary`,o),queryFn:()=>It(e,o),enabled:n&&!!(r.data?.enabled&&r.data.installEnabled),retry:!1,staleTime:0,refetchOnWindowFocus:`always`,refetchInterval:e=>ql(e.state.data,a)}};return{settings:r,branded:z(o(`branded`)),nonBrand:z(o(`non-brand`)),jobs:i}}var Yl={branded:`Branded`,"non-brand":`Non-brand`};function Xl(e){return e>=10}var Z={states:{disabled:`Sentiment is off.`,"not-measured":`No ratings yet.`,processing:`Analyzing sentiment…`,canceled:`Analysis canceled.`,partial:`Partial results.`,failed:`Analysis failed.`,complete:`Analysis complete.`,unsupported:`Sentiment unavailable.`},noJudgments:`No ratings available.`,tooFew:`too few`,minRated:`Shown from 10 ratings`,partial:`Partial results`,columns:{favorable:`Favorable`,rated:`With opinion`},title:`Sentiment`,subtitle:`How AI answers describe you in queries that name you`,rated:`Share of answers that give an opinion (favorable, mixed or unfavorable) about who they name`,noAnswers:`No answers yet`,ratedUnavailable:`Unavailable`,details:{ratedAnswers:`Answers with an opinion`,unadmitted:`Checks not yet analyzed`,checksCaption:`Not counted in the favorable share:`,interval:`Likely range (95%)`},nonBrand:{label:`Non-brand queries`,none:`No unfavorable or mixed answers in non-brand queries.`,noneSoFar:`No unfavorable or mixed answers in non-brand queries so far.`,notRated:`Non-brand answers are not rated yet.`,view:`View answers`,evidence:`Non-brand queries, unfavorable and mixed`,rowNone:`No unfavorable or mixed answers`,rowLabel:`Unfavorable or mixed`,help:`A non-brand answer almost always names you to recommend you, so its favorable share is near 100% and says little. Sentiment is measured on branded queries; unfavorable or mixed answers to non-brand queries are listed here when they happen.`},properties:{title:`Most criticized properties`,evidence:`unfavorable and mixed`,viewAll:`View all unfavorable and mixed answers`,allEvidence:`Branded queries, unfavorable and mixed`},overall:`Favorable share of ratings in answers to branded queries. Each saved answer-subject assessment counts once. Answers with no opinion, or where it is unclear who they name, are left out.`,favorable:`The favorable share of favorable, mixed and unfavorable ratings in answers to branded queries. Each rating covers one subject named in an answer; answers with no opinion are left out.`},Zl=`—`,Ql={factual:`Named, no opinion`,"subject-not-mentioned":`Not named in the answer`,"wrong-subject":`Named someone else`,"ambiguous-subject":`Unclear which one was meant`,"ambiguous-judgment":`Opinion unclear`,"subject-not-applicable":`Not applicable`,"unsupported-language":`Not in English`,"missing-source-text":`No answer text`,"input-too-large":`Answer too long to rate`,"invalid-conclusion-evidence":`Rating set aside`,pending:`Waiting to be rated`,running:`Being rated`,"waiting-to-retry":`Retrying`};function $l(e){return Ql[e]??e.replaceAll(`-`,` `).replace(/^./,e=>e.toUpperCase())}var eu=[`favorable`,`mixed`,`unfavorable`];function tu(e){return e===`favorable`?`positive`:e===`unfavorable`?`negative`:e===`mixed`?`caution`:`neutral`}var nu=[`mixed`,`unfavorable`];function ru(e){return e.interval?`${wn(e.interval.low,Ot.fraction)} to ${wn(e.interval.high,Ot.fraction)}`:null}var iu={favorable:`progress-fill-info`,mixed:`progress-fill-caution`,unfavorable:`progress-fill-negative`};function au(e){return`${e} ${e===1?`rating`:`ratings`}`}function ou(e){return e.score.favorableRate!==null&&e.coverage.judged>0}function su(e){return e.state===`complete`&&!e.provisional&&e.coverage.unadmittedAssessments===0}function cu(e){return e.state===`complete`?Z.partial:Z.states[e.state]}function lu(e){return e?ou(e)&&Xl(e.coverage.judged):!1}function uu({value:e,label:t}){let{counts:n,judged:r}=e.coverage;if(!ou(e))return(0,q.jsx)(`div`,{className:`sentiment-bar sentiment-bar-track`,"data-sentiment-bar":`empty`,"aria-hidden":`true`});let i=eu.map(e=>`${n[e]} ${e}`).join(`, `);return lu(e)?(0,q.jsx)(`div`,{role:`img`,"aria-label":`${t}: ${i}, ${e.score.favorableDisplay} favorable of ${au(r)}`,className:`sentiment-bar`,"data-sentiment-bar":`rated`,children:eu.filter(e=>n[e]>0).map(e=>(0,q.jsx)(`span`,{"data-outcome":e,className:`sentiment-bar-segment ${iu[e]}`,style:{flexGrow:n[e]},title:`${$l(e)}: ${n[e]} of ${au(r)}`},e))}):(0,q.jsx)(`div`,{role:`img`,"aria-label":`${t}: ${i}, ${au(r)}, favorable share ${Z.minRated.toLowerCase()}`,className:`sentiment-bar sentiment-bar-track`,"data-sentiment-bar":`too-few`})}function du({value:e,label:t}){let{counts:n,judged:r}=e.coverage;return(0,q.jsx)(`div`,{role:`img`,"aria-label":`${t}: ${eu.map(e=>`${n[e]} ${e}`).join(`, `)}, ${au(r)}`,className:`sentiment-property-bar`,children:eu.filter(e=>n[e]>0).map(e=>(0,q.jsx)(`span`,{"data-outcome":e,className:`sentiment-bar-segment ${iu[e]}`,style:{flexGrow:n[e]}},e))})}function fu(e){let t=new Map(e.breakdowns.filter(e=>e.dimension===`property`).map(e=>[e.key,e]));return(e.criticizedProperties?.keys??[]).flatMap(e=>t.get(e)??[])}function pu({value:e,label:t}){return(0,q.jsx)(`div`,{role:`group`,"aria-label":`${t} favorable share`,className:`sentiment-class-favorable`,children:lu(e)?(0,q.jsx)(`span`,{className:`sentiment-class-share`,children:e.score.favorableDisplay}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`sentiment-class-empty`,title:Z.minRated,children:Zl}),(0,q.jsx)(`span`,{className:`sr-only`,children:Z.minRated})]})})}function mu({ratedAnswers:e=0,eligibleAnswers:t=0}){return`${e} of ${t} ${t===1?`answer`:`answers`} rated`}function hu(e){let{eligibleAnswers:t}=e;return t===void 0?{display:Zl,detail:Z.ratedUnavailable,empty:!0}:t<=0?{display:Zl,detail:Z.noAnswers,empty:!0}:e.ratedAnswerRate===null||e.ratedAnswerRate===void 0?{display:Zl,detail:Z.states.disabled,empty:!0}:{display:wn(e.ratedAnswerRate,Ot.fraction),detail:mu(e),empty:!1}}function gu({coverage:e,label:t}){let{display:n,detail:r,empty:i}=hu(e);return(0,q.jsxs)(`div`,{role:`group`,"aria-label":`${t} share rated`,className:`sentiment-class-ratings`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:i?`sentiment-class-empty`:void 0,title:r,children:n}),(0,q.jsx)(`span`,{className:`sr-only`,children:i?r:`${n}, ${r}`})]})}function _u({value:e}){return ou(e)?e.provisional?(0,q.jsx)(`p`,{className:`sentiment-class-note text-caution`,children:Z.partial}):null:(0,q.jsx)(`p`,{className:`sentiment-class-note`,children:e.state===`complete`?Z.noJudgments:Z.states[e.state]})}function vu(e){return!!(e.coverage.selected||e.coverage.eligibleAssessments||e.reason)}function yu({value:e,queryClass:t,open:n,setOpenClass:r}){let i=(0,K.useContext)(Su),a=(0,K.useId)(),o=(0,K.useId)(),s=(0,K.useId)(),c=(0,K.useRef)(null),l=(0,K.useRef)(null),u=(0,K.useCallback)(()=>r(e=>e===t?null:e),[r,t]);(0,K.useEffect)(()=>{if(!n)return;let e=e=>e instanceof Node&&!!(c.current?.contains(e)||l.current?.contains(e)),t=t=>{e(t.target)||u()},r=t=>{e(t.target)||u()},i=e=>{e.key===`Escape`&&(u(),c.current?.focus())};return document.addEventListener(`pointerdown`,t),document.addEventListener(`focusin`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`pointerdown`,t),document.removeEventListener(`focusin`,r),document.removeEventListener(`keydown`,i)}},[n,u]);let{coverage:d,score:f}=e,p=ru(f),m=d.judged>0&&!Xl(d.judged),h=t===`branded`?fu(e):[];return vu(e)?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{ref:c,type:`button`,className:`sentiment-class-details-toggle`,"aria-label":`${Yl[t]} details`,"aria-expanded":n,"aria-controls":a,onClick:()=>r(e=>e===t?null:t),children:(0,q.jsx)(b,{className:`sentiment-class-details-chevron`,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{ref:l,id:a,role:`group`,"aria-labelledby":o,className:`sentiment-class-details`,hidden:!n,children:[(0,q.jsx)(`p`,{id:o,className:`sentiment-class-details-title`,children:Yl[t]}),(0,q.jsxs)(`dl`,{className:`sentiment-details-list`,children:[(d.eligibleAnswers??0)>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:Z.details.ratedAnswers}),(0,q.jsxs)(`dd`,{children:[d.ratedAnswers??0,` of `,d.eligibleAnswers]})]}),m&&eu.filter(e=>d.counts[e]>0).map(e=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:$l(e)}),(0,q.jsx)(`dd`,{children:d.counts[e]})]},e)),m&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Favorable share`}),(0,q.jsx)(`dd`,{children:Z.minRated})]}),p&&(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`dt`,{children:[Z.details.interval,` `,(0,q.jsx)(kr,{text:f.limitation,placement:`bottom`})]}),(0,q.jsx)(`dd`,{children:p})]})]}),i&&h.length>0&&(0,q.jsxs)(`div`,{className:`sentiment-details-properties`,role:`group`,"aria-labelledby":s,children:[(0,q.jsxs)(`p`,{id:s,className:`sentiment-details-subtitle`,children:[Z.properties.title,e.criticizedProperties&&e.criticizedProperties.total>h.length?(0,q.jsxs)(`span`,{className:`sentiment-details-subtitle-count`,children:[` · `,h.length,` of `,e.criticizedProperties.total]}):null]}),(0,q.jsx)(`ul`,{children:h.map(n=>(0,q.jsxs)(`li`,{className:`sentiment-property`,children:[(0,q.jsx)(`button`,{type:`button`,className:`sentiment-property-name`,"aria-label":`View ${Z.properties.evidence} answers for ${n.label}`,onClick:()=>{if(!c.current)return;let r=Cu(i,e);i.openEvidence({...r,queryClass:t,scope:`property`,scopeKey:n.key,marketKey:r.scope===`market`?r.scopeKey:r.marketKey,outcome:nu},`${n.label}, ${Z.properties.evidence}`,c.current)},children:n.label}),(0,q.jsxs)(`span`,{className:`sentiment-property-count`,children:[n.coverage.counts.favorable,` of `,n.coverage.judged,` favorable`]}),(0,q.jsx)(du,{value:n,label:n.label})]},n.key))}),(0,q.jsx)(`button`,{type:`button`,className:`sentiment-property-name sentiment-details-view-all`,onClick:()=>{c.current&&i.openEvidence({...Cu(i,e),queryClass:t,outcome:nu},Z.properties.allEvidence,c.current)},children:Z.properties.viewAll})]}),(d.unadmittedAssessments>0||Object.entries(d.counts).some(([e,t])=>t>0&&!eu.includes(e)))&&(0,q.jsx)(`p`,{className:`sentiment-details-caption`,children:Z.details.checksCaption}),(0,q.jsxs)(`dl`,{className:`sentiment-details-list`,children:[d.unadmittedAssessments>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:Z.details.unadmitted}),(0,q.jsx)(`dd`,{children:d.unadmittedAssessments})]}),Object.entries(d.counts).filter(([e,t])=>t>0&&![`favorable`,`mixed`,`unfavorable`].includes(e)).map(([e,t])=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:$l(e)}),(0,q.jsx)(`dd`,{children:t})]},e))]}),e.reason&&(0,q.jsx)(`p`,{className:`sentiment-class-details-reason`,children:e.reason})]})]}):null}function bu(e){return!!(e?.configured&&e.branded.coverage.judged>0&&e.branded.score.favorableRate!==null)&&!In()}function xu({value:e}){if(!bu(e))return null;let t=e.branded,n=t.coverage.judged,r=ru(t.score),i=`${Z.overall} ${n} of ${t.coverage.selected} judged${r?`, 95% interval ${r}`:``}. ${t.provisional?`Provisional. `:``}${Z.states[t.state]}${t.reason?` ${t.reason}`:``}`;return(0,q.jsx)(`div`,{className:`project-row-stat`,"data-sentiment-score":!0,children:(0,q.jsxs)(`div`,{className:`metric-inline-block`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`p`,{className:`metric-inline-label`,children:`Sentiment`}),(0,q.jsx)(`span`,{className:`relative z-10`,children:(0,q.jsx)(kr,{text:i,placement:`bottom`})})]}),Xl(n)?(0,q.jsxs)(`p`,{className:`metric-inline-value`,children:[t.score.favorableDisplay,(0,q.jsx)(`span`,{className:`sr-only`,children:` favorable judgments, branded queries`})]}):(0,q.jsxs)(`p`,{className:`metric-inline-value text-secondary`,children:[Z.tooFew,(0,q.jsxs)(`span`,{className:`sr-only`,children:[` ratings for a favorable share, `,n,` of `,10,` needed, branded queries`]})]}),(0,q.jsx)(`p`,{className:`metric-inline-caption`,"aria-hidden":`true`})]})})}var Su=(0,K.createContext)(null);function Cu(e,t){let{selection:n}=t;return{...e.selection,...n,runId:n.runId??void 0,runIds:n.runId?void 0:n.runIds,revision:n.revision??void 0,evaluationDefinitionId:n.evaluationDefinitionId??void 0}}function wu(){return(0,K.useContext)(Su)?.configured??!1}function Tu({projectName:e,selection:t,runOptions:n=[],waitForResolvedRun:r=!1,evidenceReady:i=!0,hasSourceEvidence:a=!0,children:o}){return(0,q.jsx)(Eu,{projectName:e,selection:t,runOptions:n,waitForResolvedRun:r,evidenceReady:i,hasSourceEvidence:a,children:o})}function Eu({projectName:e,selection:t,runOptions:n,waitForResolvedRun:r,evidenceReady:i,hasSourceEvidence:a,children:o}){let s=JSON.stringify([e,t]),[c,l]=(0,K.useState)(null),u=(0,K.useCallback)(e=>l(t=>t?.key===s&&t?.runId===e?.runId&&t?.revision===e?.revision?t:e?{...e,key:s}:null),[s]),d=i&&(!r||c?.key===s),f=r&&d&&c?{...t,runId:c.runId,revision:c.revision}:t,p=JSON.stringify([e,f]),{settings:m,branded:h,nonBrand:g,jobs:_}=Jl(e,f,d&&a),[v,y]=(0,K.useState)(!1),[b,x]=(0,K.useState)(null),S=(0,K.useRef)(null);(0,K.useEffect)(()=>{y(!1),x(null)},[p]);let C=d&&!!(m.data?.enabled&&m.data.installEnabled),w=(t.queryClass===`non-brand`?g.data:h.data)?.selection,T={...f,...w?{...w,runId:w.runId??void 0,runIds:w.runId?void 0:w.runIds,revision:w.revision??void 0,evaluationDefinitionId:w.evaluationDefinitionId??void 0}:{}},E=T.runId&&!n.some(e=>e.id===T.runId)?[{id:T.runId,label:`Displayed check`},...n]:n,D=e=>{e.preventDefault(),S.current?.focus()};return(0,q.jsxs)(Su.Provider,{value:{projectName:e,selection:f,resolveSource:u,settings:m,summaries:{branded:h,"non-brand":g},configured:C,hasSourceEvidence:a,openManage:e=>{S.current=e,y(!0)},openEvidence:(e,t,n)=>{S.current=n,x({selection:e,label:t})}},children:[o,(0,q.jsx)(no,{open:v&&!!m.data?.actions.configure,onOpenChange:y,children:(0,q.jsxs)(co,{onCloseAutoFocus:D,className:`overflow-y-auto`,children:[(0,q.jsxs)(lo,{children:[(0,q.jsx)(uo,{children:`Manage sentiment`}),(0,q.jsx)(fo,{children:`Classify saved answers and review the cost before submitting a backfill.`})]}),m.data?.actions.configure&&(0,q.jsx)(Ku,{projectName:e,settings:m.data,selection:T,runOptions:E},JSON.stringify([m.data.evaluationDefinitionId,m.data.enabled,m.data.enablementEpoch])),_.data&&(0,q.jsx)(Bu,{projectName:e,jobs:_.data.jobs})]})}),(0,q.jsx)(no,{open:b!==null,onOpenChange:e=>{e||x(null)},children:(0,q.jsxs)(co,{onCloseAutoFocus:D,className:`overflow-y-auto`,children:[(0,q.jsxs)(lo,{children:[(0,q.jsxs)(uo,{children:[`Sentiment evidence`,b?`: ${b.label}`:``]}),(0,q.jsx)(fo,{children:`Stored judgments and exact quotations for the selected query and scope.`})]}),b&&(0,q.jsx)(Lu,{projectName:e,selection:b.selection},JSON.stringify(b.selection))]})})]})}function Du(e,t){let n=(0,K.useContext)(Su)?.resolveSource;(0,K.useEffect)(()=>{n?.(e?{runId:e,revision:t??void 0}:null)},[n,e,t])}function Ou(){let e=(0,K.useContext)(Su);return e?.settings.data?.actions.configure?(0,q.jsx)(Ml,{type:`button`,variant:`outline`,size:`sm`,onClick:t=>e.openManage(t.currentTarget),children:e.settings.data.enabled?`Manage sentiment`:`Enable sentiment`}):null}function ku(e,t){return!e?.configured||t===`unknown`||t===`unclassified`?null:[`branded`]}function Au({queryClass:e=`all`}){let t=(0,K.useContext)(Su),n=ku(t,e);return!t?.hasSourceEvidence||!n?.some(e=>lu(t.summaries[e].data))?null:(0,q.jsx)(`ul`,{className:`sentiment-legend`,"aria-hidden":`true`,children:eu.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`span`,{className:`sentiment-legend-swatch ${iu[e]}`}),$l(e)]},e))})}function ju({queryClass:e}){let t=(0,K.useContext)(Su);if(!t?.hasSourceEvidence)return null;let n=t.summaries[`non-brand`],r=n.data,i=e===`non-brand`;if(!r)return i?n.isError?(0,q.jsxs)(`p`,{role:`alert`,className:`sentiment-nonbrand-note`,children:[`Couldn’t load non-brand sentiment. `,(0,q.jsx)(G,{variant:`ghost`,onClick:()=>{n.refetch()},children:`Retry`})]}):(0,q.jsx)(`p`,{role:`status`,className:`sentiment-nonbrand-note`,children:`Loading non-brand sentiment…`}):null;let a=r.coverage.counts;return a.unfavorable===0&&a.mixed===0?i?su(r)?(0,q.jsx)(`p`,{className:`sentiment-nonbrand-note`,children:Z.nonBrand.none}):ou(r)?(0,q.jsx)(`p`,{className:`sentiment-nonbrand-note`,children:Z.nonBrand.noneSoFar}):(0,q.jsx)(`p`,{className:`sentiment-nonbrand-note`,children:r.state===`not-measured`?Z.nonBrand.notRated:`${Z.nonBrand.label}: ${cu(r)}`}):null:(0,q.jsx)(`div`,{className:`sentiment-nonbrand`,role:`group`,"aria-label":Z.nonBrand.label,children:(0,q.jsxs)(`div`,{className:`sentiment-nonbrand-line`,children:[(0,q.jsxs)(`span`,{className:`sentiment-nonbrand-label`,children:[Z.nonBrand.label,(0,q.jsx)(kr,{text:Z.nonBrand.help})]}),(0,q.jsxs)(`span`,{className:`sentiment-nonbrand-counts`,children:[nu.slice().reverse().filter(e=>a[e]>0).map(e=>(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`sentiment-legend-swatch ${iu[e]}`}),a[e],` `,e]},e)),!su(r)&&(0,q.jsx)(`span`,{className:`text-caution`,children:Z.partial})]}),(0,q.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:e=>t.openEvidence({...Cu(t,r),queryClass:`non-brand`,outcome:nu},Z.nonBrand.evidence,e.currentTarget),children:Z.nonBrand.view})]})})}function Mu({queryClass:e=`all`,legend:t=!0,manage:n=!1}){let r=(0,K.useContext)(Su),i=ku(r,e),[a,o]=(0,K.useState)(null);if(!r)return null;if(!i){let e=r.settings.data;return!n||!e?.actions.configure?null:(0,q.jsxs)(`div`,{className:`sentiment-headlines-title`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`sentiment-headlines-heading`,children:Z.title}),!(e.enabled&&e.installEnabled)&&(0,q.jsx)(`p`,{className:`sentiment-headlines-subtitle`,children:Z.states.disabled})]}),(0,q.jsx)(Ou,{})]})}let s=r.hasSourceEvidence&&i.some(e=>r.summaries[e].data);return(0,q.jsxs)(`div`,{className:`sentiment-headlines`,role:`group`,"aria-label":`Favorable answer scores`,children:[(0,q.jsxs)(`div`,{className:`sentiment-headlines-title`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`sentiment-headlines-heading`,children:Z.title}),(0,q.jsx)(`p`,{className:`sentiment-headlines-subtitle`,children:Z.subtitle})]}),n&&(0,q.jsx)(Ou,{})]}),t&&(0,q.jsx)(Au,{queryClass:e}),s&&(0,q.jsxs)(`div`,{className:`sentiment-headlines-columns`,"aria-hidden":`true`,children:[(0,q.jsx)(`span`,{className:`sentiment-headlines-favorable`,children:Z.columns.favorable}),(0,q.jsx)(`span`,{className:`sentiment-headlines-ratings`,title:Z.rated,children:Z.columns.rated})]}),i.map(e=>{let t=r.summaries[e];return(0,q.jsxs)(`div`,{className:`sentiment-class`,"data-query-class":e,children:[(0,q.jsxs)(`div`,{className:`sentiment-class-label`,children:[(0,q.jsx)(`span`,{children:Yl[e]}),(0,q.jsx)(kr,{text:Z.favorable})]}),r.hasSourceEvidence?t.data?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(uu,{value:t.data,label:Yl[e]}),(0,q.jsx)(pu,{value:t.data,label:Yl[e]}),(0,q.jsx)(gu,{coverage:t.data.coverage,label:Yl[e]}),(0,q.jsx)(_u,{value:t.data}),(0,q.jsx)(yu,{value:t.data,queryClass:e,open:a===e,setOpenClass:o})]}):t.isError?(0,q.jsxs)(`p`,{role:`alert`,className:`sentiment-class-status`,children:[`Couldn’t load sentiment. `,(0,q.jsx)(G,{variant:`ghost`,onClick:()=>{t.refetch()},children:`Retry`})]}):(0,q.jsx)(`p`,{role:`status`,className:`sentiment-class-status`,children:`Loading sentiment…`}):(0,q.jsx)(`p`,{className:`sentiment-class-status`,children:`No saved answers.`})]},e)}),e!==`branded`&&(0,q.jsx)(ju,{queryClass:e})]})}function Nu({queryId:e,sourceSnapshotIds:t=[],queryClass:n,location:r,showLabel:i=!1}){let a=(0,K.useContext)(Su);if(!a?.configured)return null;let o=n?a.summaries[n]:void 0,s=a.hasSourceEvidence?o?.data:void 0,c=s?.queries.filter(r=>r.queryClass===n&&(e?r.queryId===e:t.length>0)&&t.every(e=>r.sourceSnapshotIds.includes(e)))??[],l=c.length===1?c[0]:void 0,u=r===void 0?l:l?.locations.find(e=>e.location===r);if(!l||!u)return(0,q.jsx)(`span`,{className:`text-label-14 text-secondary`,children:a.hasSourceEvidence&&o?.isPending&&(e||t.length)?`Loading…`:`Unavailable`});let d={...a.selection,...s.selection,runId:s.selection.runId??void 0,runIds:s.selection.runId?void 0:s.selection.runIds,revision:s.selection.revision??void 0,evaluationDefinitionId:s.selection.evaluationDefinitionId??void 0,queryClass:l.queryClass,queryId:l.queryId,executionNodeKey:l.executionNodeKey??void 0,...r===void 0?{}:{location:r??`none`}};if(l.queryClass===`non-brand`){if(u.state===`unsupported`)return(0,q.jsx)(`span`,{className:`text-label-14 text-secondary`,children:`Unavailable`});let{unfavorable:e,mixed:t}=u.coverage.counts;if(e===0&&t===0){let e=i&&(0,q.jsx)(`span`,{className:`block text-label-14 text-secondary`,children:Z.nonBrand.rowLabel});return su(u)?(0,q.jsxs)(`span`,{className:`text-label-14 text-muted`,children:[e,(0,q.jsx)(`span`,{"aria-hidden":`true`,title:Z.nonBrand.rowNone,children:Zl}),(0,q.jsx)(`span`,{className:`sr-only`,children:Z.nonBrand.rowNone})]}):(0,q.jsxs)(`span`,{className:`text-label-14 text-secondary`,children:[e,(0,q.jsx)(`span`,{children:cu(u)})]})}return(0,q.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-auto pointer-coarse:min-h-11 flex-col items-start gap-0 px-1`,"aria-label":`View unfavorable and mixed answers for ${l.queryText}`,onKeyDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),a.openEvidence({...d,outcome:nu},`${l.queryText}, unfavorable and mixed`,e.currentTarget)},children:[i&&(0,q.jsx)(`span`,{className:`text-label-14 text-secondary`,children:Z.nonBrand.rowLabel}),e>0&&(0,q.jsxs)(`span`,{className:`text-label-14 text-negative`,children:[e,` unfavorable`]}),t>0&&(0,q.jsxs)(`span`,{className:`text-label-14 text-caution`,children:[t,` mixed`]}),u.provisional&&(0,q.jsx)(`span`,{className:`text-label-12 text-caution`,children:`Provisional`})]})}return(0,q.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-auto pointer-coarse:min-h-11 flex-col items-start gap-0 px-1`,"aria-label":`View ${Yl[l.queryClass]} sentiment evidence for ${l.queryText}`,onKeyDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),a.openEvidence(d,l.queryText,e.currentTarget)},children:[i&&(0,q.jsx)(`span`,{className:`text-label-14 text-secondary`,children:`Favorable`}),(0,q.jsx)(`span`,{className:`font-mono text-primary`,children:u.score.favorableDisplay}),(0,q.jsxs)(`span`,{className:`text-label-14 text-secondary`,children:[u.coverage.judged,` judged`]}),u.provisional&&(0,q.jsx)(`span`,{className:`text-label-12 text-caution`,children:`Provisional`})]})}function Pu(e){return e.outcome===`subject-not-mentioned`?`Not mentioned`:e.outcome===`running`?`Classifying`:e.outcome===`waiting-to-retry`?`Retrying`:e.outcome?$l(e.outcome):e.state===`not-measured`?`Not classified`:e.state===`processing`?`Classifying`:e.state===`failed`?`Failed`:e.state===`canceled`?`Canceled`:`Unavailable`}function Fu({queryId:e,sourceSnapshotIds:t,queryClass:n,provider:r,model:i,location:a,showSubjects:o=!1,showLabel:s=!1}){let c=(0,K.useContext)(Su);if(!c?.configured)return null;let l=n?c.summaries[n]:void 0,u=c.hasSourceEvidence?l?.data:void 0,d=u?.queries.filter(r=>r.queryClass===n&&(!e||r.queryId===e)&&t.length>0&&t.every(e=>r.sourceSnapshotIds.includes(e)))??[],f=d.length===1?d[0]:void 0,p=f?.assessments?.filter(e=>t.includes(e.sourceSnapshotId)&&e.provider===r&&e.location===a&&(i===void 0||e.servedModel===i))??[];return(0,q.jsxs)(`div`,{role:`group`,className:`text-label-14 text-secondary`,"aria-label":`${r||`Saved answer`} sentiment`,children:[s&&(0,q.jsx)(`span`,{className:`block text-label-14 text-secondary`,children:`Sentiment`}),p.length?p.map(e=>{let t=Pu(e),n=tu(e.outcome),r=(0,q.jsxs)(q.Fragment,{children:[o&&(0,q.jsxs)(`span`,{children:[e.subjectLabel,` · `]}),(0,q.jsx)(En,{tone:n,className:`max-w-full shrink-0 rounded-none border-0 bg-transparent p-0 text-label-14 [overflow-wrap:normal]`,children:t})]}),i={...c.selection,...u.selection,runId:u.selection.runId??void 0,runIds:u.selection.runId?void 0:u.selection.runIds,revision:u.selection.revision??void 0,evaluationDefinitionId:u.selection.evaluationDefinitionId??void 0,queryClass:f.queryClass,queryId:f.queryId,executionNodeKey:f.executionNodeKey??void 0,assessmentId:e.assessmentId??void 0};return(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.assessmentId?(0,q.jsx)(G,{type:`button`,variant:`ghost`,className:`h-auto pointer-coarse:min-h-11 flex-wrap justify-start whitespace-normal px-1 text-left text-button-14`,"aria-label":`View ${e.provider} sentiment evidence for ${e.subjectLabel}: ${t}`,onKeyDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),c.openEvidence(i,`${f.queryText} · ${e.provider} · ${e.subjectLabel}`,t.currentTarget)},children:r}):(0,q.jsx)(`span`,{children:r}),e.reason&&(0,q.jsx)(kr,{text:e.reason})]},JSON.stringify([e.sourceSnapshotId,e.subjectId,e.assessmentId]))}):(0,q.jsx)(`span`,{children:c.hasSourceEvidence&&l?.isPending&&t.length?`Loading…`:`Unavailable`})]})}function Iu({item:e}){let t=ra(e.context.provider);return(0,q.jsxs)(`article`,{className:`space-y-4 border-b border-default py-5 text-label-14 text-secondary`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`strong`,{className:`text-primary`,children:e.subject.displayName}),(0,q.jsx)(En,{tone:tu(e.outcome),children:$l(e.outcome)}),(0,q.jsx)(`span`,{children:Yl[e.context.queryClass]}),(0,q.jsxs)(`span`,{children:[`Answered by `,(0,q.jsx)(`span`,{className:`text-primary`,children:t}),e.context.servedModel?` (${e.context.servedModel})`:``]}),(0,q.jsx)(`span`,{children:e.context.location??`No location`})]}),e.reason&&(0,q.jsx)(`p`,{children:e.reason}),(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h3`,{className:`mb-2 text-heading`,children:`Conclusion evidence`}),e.conclusion.length?e.conclusion.map(e=>(0,q.jsx)(`blockquote`,{className:`mb-2 border-l border-strong pl-3 text-primary`,children:e.text},`${e.id}:${e.start}`)):(0,q.jsx)(`p`,{children:`No valid conclusion evidence is available.`})]}),(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h3`,{className:`mb-2 text-heading`,children:`Complaint evidence`}),e.complaint?.length?e.complaint.map(e=>(0,q.jsx)(`blockquote`,{className:`mb-2 border-l border-strong pl-3 text-primary`,children:e.text},`${e.id}:${e.start}`)):(0,q.jsx)(`p`,{children:`No complaint was identified.`})]}),(0,q.jsxs)(`details`,{children:[(0,q.jsxs)(`summary`,{className:`cursor-pointer`,children:[`Original answer from `,t]}),(0,q.jsx)(`div`,{className:`mt-2 break-words text-primary`,children:(0,q.jsx)(zl,{headingLevel:4,children:e.sourceText})})]}),(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{className:`cursor-pointer`,children:`Assessment provenance`}),(0,q.jsxs)(`dl`,{className:`mt-3 space-y-2 break-all`,children:[(0,q.jsx)(`dt`,{children:`Query`}),(0,q.jsx)(`dd`,{children:e.context.queryText}),(0,q.jsx)(`dt`,{children:`Subject`}),(0,q.jsxs)(`dd`,{children:[e.subject.displayName,` (`,e.subject.id,`)`]}),(0,q.jsx)(`dt`,{children:`Run`}),(0,q.jsx)(`dd`,{children:e.runId}),(0,q.jsx)(`dt`,{children:`Revision`}),(0,q.jsx)(`dd`,{children:e.context.revision??`Unavailable`}),(0,q.jsx)(`dt`,{children:`Evaluator`}),(0,q.jsx)(`dd`,{children:e.returnedModel??`Unavailable`}),(0,q.jsx)(`dt`,{children:`Evaluation definition`}),(0,q.jsx)(`dd`,{children:e.evaluationDefinitionId}),(0,q.jsx)(`dt`,{children:`Source snapshot`}),(0,q.jsx)(`dd`,{children:e.sourceSnapshotId}),(0,q.jsx)(`dt`,{children:`Source hash`}),(0,q.jsx)(`dd`,{children:e.sourceTextHash}),e.context.usageEdges.map((e,t)=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Assignment`}),(0,q.jsxs)(`dd`,{children:[`Target `,e.targetId,`; Property `,e.propertyId??`None`,`; market `,e.marketId??`None`,`; `,e.queryClass]})]},t))]})]})]})}function Lu({projectName:e,selection:t}){let[n,r]=(0,K.useState)(),i=z({queryKey:Hl(e,`evidence`,t,n),queryFn:()=>Nt(e,t,n),retry:!1});return i.isPending?(0,q.jsx)(`p`,{role:`status`,className:`mt-4 text-copy-14 text-secondary`,children:`Loading sentiment evidence…`}):i.isError?(0,q.jsxs)(`p`,{role:`alert`,className:`mt-4 text-copy-14 text-secondary`,children:[`Could not load sentiment evidence. `,(0,q.jsx)(G,{variant:`outline`,onClick:()=>{i.refetch()},children:`Retry evidence`})]}):(0,q.jsxs)(q.Fragment,{children:[i.data.items.length?i.data.items.map(e=>(0,q.jsx)(Iu,{item:e},e.assessmentId)):(0,q.jsx)(`p`,{className:`mt-4 text-copy-14 text-secondary`,children:`No stored sentiment evidence for this query and scope.`}),(0,q.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[n&&(0,q.jsx)(G,{variant:`outline`,onClick:()=>r(void 0),children:`First evidence page`}),i.data.nextCursor&&(0,q.jsx)(G,{variant:`outline`,onClick:()=>r(i.data.nextCursor??void 0),children:`Next evidence page`})]})]})}function Ru({projectName:e,jobId:t}){let[n,r]=(0,K.useState)(),i=z({queryKey:Hl(e,`job:${t}`,void 0,n),queryFn:()=>zt(e,t,n),retry:!1});return i.isPending?(0,q.jsx)(`p`,{role:`status`,children:`Loading attempts…`}):i.isError?(0,q.jsxs)(`p`,{role:`alert`,children:[`Could not load attempts. `,(0,q.jsx)(G,{variant:`outline`,onClick:()=>{i.refetch()},children:`Retry attempts`})]}):(0,q.jsxs)(q.Fragment,{children:[i.data.attempts.map(e=>(0,q.jsxs)(`p`,{children:[e.errorCode??`Request complete`,`; `,e.usage.kind===`unknown`?`Usage unknown`:`${e.usage.inputTokens??`Unknown`} input tokens (${e.usage.kind})`]},e.id)),(0,q.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[n&&(0,q.jsx)(G,{variant:`outline`,onClick:()=>r(void 0),children:`Newest attempts`}),i.data.nextAttemptCursor&&(0,q.jsx)(G,{variant:`outline`,onClick:()=>r(i.data.nextAttemptCursor??void 0),children:`Older attempts`})]})]})}function zu({projectName:e,job:t}){let[n,r]=(0,K.useState)(!1);return(0,q.jsxs)(`details`,{onToggle:e=>r(e.currentTarget.open),children:[(0,q.jsx)(`summary`,{children:`Job details`}),t.cancellationReason&&(0,q.jsx)(`p`,{children:t.cancellationReason}),Object.entries(t.counts).filter(([,e])=>e>0).map(([e,t])=>(0,q.jsxs)(`p`,{children:[$l(e),`: `,t]},e)),(0,q.jsxs)(`p`,{children:[`Attempts: `,t.attemptCount]}),n&&t.attemptCount>0&&(0,q.jsx)(Ru,{projectName:e,jobId:t.id})]})}function Bu({projectName:e,jobs:t}){return(0,q.jsxs)(`details`,{className:`mt-6 text-label-14 text-secondary`,children:[(0,q.jsx)(`summary`,{className:`cursor-pointer`,children:`Recent sentiment jobs`}),t.length===0?(0,q.jsx)(`p`,{className:`mt-2`,children:`No sentiment jobs have been submitted.`}):(0,q.jsx)(`div`,{className:`data-table-wrapper mt-3`,children:(0,q.jsxs)(`table`,{className:`data-table`,"aria-label":`Sentiment jobs`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:`Submitted`}),(0,q.jsx)(`th`,{children:`State`}),(0,q.jsx)(`th`,{children:`Selected`}),(0,q.jsx)(`th`,{children:`Details`})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:Gn(t.createdAt)}),(0,q.jsx)(`td`,{children:$l(t.state)}),(0,q.jsx)(`td`,{children:t.selected}),(0,q.jsx)(`td`,{children:(0,q.jsx)(zu,{projectName:e,job:t})})]},t.id))})]})})]})}var Vu={probe:`Probe checks`,"unsupported-run-kind":`Not an AI Visibility check`,"failed-run":`Failed check`,"incomplete-run":`Incomplete check`,"legacy-missing-provenance":`Saved without its frozen query and subject record`,"legacy-missing-language":`Saved before the answer language was recorded`,"excluded-branded":`Branded answers (backfill that class separately)`,"excluded-non-brand":`Non-brand answers (backfill that class separately)`};function Hu(e){return Vu[e]??$l(e)}function Uu(e){return[e.provider&&`engine ${e.provider}`,e.model&&`model ${e.model}`,e.location&&(e.location===`none`?`no location`:`location ${e.location}`),e.scope!==`project`&&e.scopeKey&&`${e.scope} ${e.scopeKey}`,e.marketKey&&`market ${e.marketKey}`,e.queryId&&`query ${e.queryId}`,e.revision!==void 0&&`revision ${e.revision}`].filter(e=>!!e)}function Wu(e){let t=Uu(e);return[`${Yl[e.queryClass]} queries`,...t.length?t:[`whole check`]].join(` · `)}function Gu(e,t,n,r){return r?{...e,queryClass:n,queryId:void 0,runIds:void 0,runId:t}:{mode:`auto`,scope:`project`,queryClass:n,runId:t}}function Ku({projectName:e,settings:t,selection:n,runOptions:r}){let i=_e(),[a,o]=(0,K.useState)(t.enabled),[s,c]=(0,K.useState)(n.runId??``),[l,u]=(0,K.useState)(n.queryClass),[d,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)(null),h=(0,K.useRef)(null),g=Uu({...n,queryId:void 0}),_=()=>i.invalidateQueries({queryKey:[`sentiment`,e]}),v=()=>{m(null),h.current=null},y=ye({mutationFn:async()=>{if(!(await Me(e)).actions.configure)throw Error(`Administrator permission is required to configure sentiment.`);return Bn(e,{enabled:a})},onSuccess:async()=>{v(),await _(),await i.invalidateQueries({queryKey:[`project-overview-slim`]})},onError:_}),b=ye({mutationFn:async()=>{if(!(await Me(e)).actions.backfill)throw Error(`Administrator permission is required to backfill sentiment.`);return Le(e,Gu(n,s,l,d&&g.length>0))},onSuccess:e=>{m(e),h.current=crypto.randomUUID()},onError:_}),x=ye({mutationFn:async()=>{if(!p?.previewToken||!h.current)throw Error(`Create and review a backfill preview first.`);if(!(await Me(e)).actions.backfill)throw Error(`Administrator permission is required to backfill sentiment.`);return Sn(e,p.previewToken,h.current)},onSuccess:async()=>{v(),await _()},onError:_}),S=y.isPending||b.isPending||x.isPending;return(0,q.jsxs)(`div`,{className:`mt-5 space-y-5 text-label-14 text-secondary`,children:[(0,q.jsx)(`dl`,{className:`definition-list`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Evaluator`}),(0,q.jsxs)(`dd`,{children:[t.model,` · `,t.provider===`openrouter`?`OpenRouter`:`TypeSafe`]})]})}),(0,q.jsx)(`p`,{children:t.disclosure}),!t.ready&&(0,q.jsx)(`p`,{children:t.readinessReasons.join(`; `)||`An operator must configure sentiment on this installation.`}),(0,q.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),y.mutate()},children:[(0,q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:a,disabled:S,onChange:e=>{o(e.target.checked),v()}}),`Enable project sentiment`]}),(0,q.jsx)(`p`,{children:`Enabling applies to future completed checks. Past checks require an explicit backfill.`}),(0,q.jsx)(Ml,{type:`submit`,disabled:S,children:y.isPending?`Saving…`:`Save sentiment settings`}),y.isError&&(0,q.jsx)(`p`,{role:`alert`,children:yn(y.error)}),y.isSuccess&&(0,q.jsx)(`p`,{role:`status`,children:`Sentiment settings saved.`})]}),t.actions.backfill&&(0,q.jsxs)(`section`,{className:`space-y-3`,children:[(0,q.jsx)(`h3`,{children:`Backfill a saved check`}),(0,q.jsxs)(`label`,{className:`block`,children:[`Saved check`,(0,q.jsxs)(`select`,{className:`mt-1 block w-full rounded-md border border-default bg-bg p-2 text-primary`,value:s,disabled:S,onChange:e=>{c(e.target.value),v()},children:[(0,q.jsx)(`option`,{value:``,children:`Select a saved check`}),r.map(e=>(0,q.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]}),(0,q.jsxs)(`label`,{className:`block`,children:[`Query class`,(0,q.jsxs)(`select`,{className:`mt-1 block w-full rounded-md border border-default bg-bg p-2 text-primary`,value:l,disabled:S,onChange:e=>{u(e.target.value),v()},children:[(0,q.jsx)(`option`,{value:`non-brand`,children:`Non-brand`}),(0,q.jsx)(`option`,{value:`branded`,children:`Branded`})]})]}),(0,q.jsx)(`p`,{children:`The backfill covers every engine, location and query of the chosen check for this query class.`}),g.length>0&&(0,q.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:d,disabled:S,onChange:e=>{f(e.target.checked),v()}}),(0,q.jsxs)(`span`,{children:[`Limit to the current view`,(0,q.jsx)(`span`,{className:`block`,children:g.join(` · `)})]})]}),(0,q.jsx)(G,{variant:`outline`,disabled:S||!s||!t.enabled||!t.ready,onClick:()=>{v(),b.mutate()},children:b.isPending?`Preparing preview…`:`Preview sentiment backfill`}),b.isError&&(0,q.jsx)(`p`,{role:`alert`,children:yn(b.error)}),p&&(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsxs)(`dl`,{className:`grid grid-cols-[1fr_auto] gap-2`,children:[(0,q.jsx)(`dt`,{children:`Selection`}),(0,q.jsx)(`dd`,{className:`text-right`,children:Wu(p.selection)}),(0,q.jsx)(`dt`,{children:`Eligible assessments`}),(0,q.jsx)(`dd`,{children:p.eligibleAssessments}),(0,q.jsx)(`dt`,{children:`Already classified`}),(0,q.jsx)(`dd`,{children:p.alreadyClassified}),(0,q.jsx)(`dt`,{children:`Estimated input tokens`}),(0,q.jsx)(`dd`,{children:p.estimatedInputTokens}),(0,q.jsx)(`dt`,{children:`Estimated cost (USD)`}),(0,q.jsx)(`dd`,{children:p.estimatedCostUsd??`Unavailable`})]}),(0,q.jsx)(kr,{text:p.estimateMethod}),p.eligibleAssessments===0&&(0,q.jsx)(`p`,{children:`No saved answers in this selection can be classified.`}),p.skipped.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{children:`Not included:`}),(0,q.jsx)(`ul`,{"aria-label":`Skipped assessments`,className:`list-disc pl-5`,children:p.skipped.map(e=>(0,q.jsxs)(`li`,{children:[Hu(e.reason),`: `,e.count]},`${e.runId}:${e.reason}`))})]}),(0,q.jsx)(Ml,{disabled:S||!p.previewToken||p.eligibleAssessments===0,onClick:()=>x.mutate(),children:x.isPending?`Submitting…`:`Confirm sentiment backfill`})]}),x.isError&&(0,q.jsxs)(`p`,{role:`alert`,children:[yn(x.error),` Retry uses the same request key.`]}),x.isSuccess&&(0,q.jsx)(`p`,{role:`status`,children:`Backfill submitted. Progress is available in Recent jobs.`})]})]})}var qu=20;function Ju({points:e,tone:t}){let n=(0,K.useId)();if(e.length===0)return null;let r=t=>5+t/Math.max(e.length-1,1)*122,i=Ur(e),a=Math.min(...e),o=Math.max(...e),s=Math.max(o-a,qu),c=(o+a)/2-s/2,l=e.map((e,t)=>({x:r(t),y:5+(1-(e-c)/s)*26}));return(0,q.jsxs)(`svg`,{className:`sparkline sparkline-${t}${i?` sparkline-provisional`:``}`,viewBox:`0 0 132 42`,"aria-hidden":`true`,children:[(0,q.jsx)(`defs`,{children:(0,q.jsx)(`clipPath`,{id:n,children:(0,q.jsx)(`rect`,{x:5,y:5,width:122,height:32,rx:`8`})})}),(0,q.jsx)(`line`,{className:`sparkline-guide`,x1:5,x2:127,y1:37,y2:37}),l.length===1?(0,q.jsx)(`circle`,{className:`sparkline-point`,cx:l[0].x,cy:l[0].y,r:`3`}):(0,q.jsx)(`polyline`,{clipPath:`url(#${n})`,points:l.map(e=>`${e.x},${e.y}`).join(` `),vectorEffect:`non-scaling-stroke`})]})}function Yu({run:e,projectName:t,children:n,className:r,label:i}){let{openRun:a}=ws();return e.kind===U[`seo-sync`]&&e.opensSeoWorkspace!==!1?t?(0,q.jsx)(V,{to:`/projects/$projectName/seo-data`,params:{projectName:t},search:t=>({...t,seoRunId:e.id,seoProfileId:void 0,seoRegion:void 0,seoMarket:void 0,seoShow:void 0,seoSort:void 0,seoQ:void 0,runId:void 0,evidenceId:void 0}),className:r,"aria-label":i,children:n}):(0,q.jsx)(`button`,{type:`button`,disabled:!0,className:r,"aria-label":i,title:`Project unavailable`,children:n}):(0,q.jsx)(`button`,{type:`button`,className:r,"aria-label":i,onClick:()=>a(e.id),children:n})}function Q({project:e,sentimentColumn:t}){return(0,q.jsxs)(`div`,{className:`project-row relative${t?` project-row-with-sentiment`:``}`,children:[(0,q.jsx)(`div`,{className:`project-row-chart`,children:(0,q.jsx)(Ju,{points:e.trend,tone:mi(e.lastRun.status)})}),(0,q.jsxs)(`div`,{className:`project-row-primary`,children:[(0,q.jsxs)(V,{to:`/projects/$projectName`,params:{projectName:e.project.name},className:`after:absolute after:inset-0 after:rounded-md focus-visible:outline-none focus-visible:after:ring-2 focus-visible:after:ring-mono-400`,children:[(0,q.jsx)(`p`,{className:`project-name`,children:e.project.name}),(0,q.jsx)(`p`,{className:`project-domain`,children:e.project.canonicalDomain})]}),(0,q.jsx)(`p`,{className:`project-insight`,children:e.insight})]}),(0,q.jsx)(`div`,{className:`project-row-stat`,children:(0,q.jsxs)(`div`,{className:`metric-inline-block`,children:[(0,q.jsx)(`p`,{className:`metric-inline-label`,children:`Mentioned`}),(0,q.jsx)(`p`,{className:`metric-inline-value ${e.mentionTone===`caution`?`text-caution-400`:``}`,children:e.hasMeasurement===!1?`Not measured`:wn(e.mentionScore,Ot.percent)}),(0,q.jsx)(`p`,{className:`metric-inline-caption${e.providerCoverage?` text-caution`:``}`,title:e.providerCoverage,children:e.providerCoverage?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`sr-only`,children:`Partial check: `}),e.providerCoverage]}):e.mentionDelta})]})}),(0,q.jsx)(`div`,{className:`project-row-stat`,children:(0,q.jsxs)(`div`,{className:`metric-inline-block`,children:[(0,q.jsxs)(`p`,{className:`metric-inline-label`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`Pressure`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Competitor pressure`})]}),(0,q.jsx)(`p`,{className:`metric-inline-value`,children:e.hasMeasurement===!1?`Not measured`:e.competitorPressureLabel}),(0,q.jsx)(`p`,{className:`metric-inline-caption`,"aria-hidden":`true`})]})}),bu(e.sentiment)?(0,q.jsx)(xu,{value:e.sentiment}):t&&(0,q.jsx)(`div`,{className:`project-row-stat`,"aria-hidden":`true`,"data-sentiment-placeholder":!0}),(0,q.jsx)(`span`,{className:`project-row-link`,children:(0,q.jsx)(M,{className:`h-4 w-4 text-muted`})})]})}function Xu(){let{isAdmin:e}=Qn(),t=ps(),{dashboard:n,isLoading:r,isError:i,activityLoading:a,activityError:o,refetch:s}=ms(),c=n??t?.dashboard,l=Ss(!t,t?.health);if(i&&!c)return(0,q.jsxs)(`div`,{className:`page-container`,children:[(0,q.jsx)(`div`,{className:`page-header`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`All projects unavailable`}),(0,q.jsx)(`p`,{className:`page-subtitle`,children:`Canonry could not load the project list.`})]})}),(0,q.jsxs)(`div`,{className:`max-w-xl rounded-md border border-negative bg-negative-soft p-4`,role:`alert`,children:[(0,q.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:`Your projects have not been changed.`}),(0,q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:`Check the connection or sign in again, then retry.`}),(0,q.jsx)(G,{type:`button`,variant:`secondary`,className:`mt-4`,onClick:()=>{s()},children:`Retry loading projects`})]})]});if(!c||r)return(0,q.jsxs)(`div`,{className:`page-skeleton`,children:[(0,q.jsxs)(`div`,{className:`page-skeleton-header`,children:[(0,q.jsx)(`div`,{className:`skeleton-text h-6 w-32`}),(0,q.jsx)(`div`,{className:`skeleton-text-sm w-64`})]}),(0,q.jsx)(`div`,{className:`space-y-3`,children:[1,2,3].map(e=>(0,q.jsxs)(`div`,{className:`material-base p-4 flex items-center gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,q.jsx)(`div`,{className:`skeleton-text w-36`}),(0,q.jsx)(`div`,{className:`skeleton-text-sm w-48`})]}),(0,q.jsx)(`div`,{className:`skeleton-text w-16`}),(0,q.jsx)(`div`,{className:`skeleton-text w-16`}),(0,q.jsx)(`div`,{className:`skeleton h-8 w-20 rounded`})]},e))})]});let u=c.portfolioOverview,d=u.projects.length>0&&u.projects.every(e=>e.hasMeasurement===!1),f=u.projects.some(e=>bu(e.sentiment)),p=u.attentionItems.map(e=>d&&e.id===`attention_stable`?{...e,tone:`neutral`,title:`Awaiting first measurement`,detail:`Visibility results will appear after the first check.`}:e),m=l.data??t?.health??{apiStatus:{label:`API`,state:`checking`,detail:`Checking service health`},workerStatus:{label:`Worker`,state:`checking`,detail:`Checking service health`}},h=xi(u.systemHealth.filter(t=>e||t.id===`api`||t.id===`worker`),m,c.settings);return(0,q.jsxs)(`div`,{className:`page-container`,children:[(0,q.jsx)(`div`,{className:`page-header`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`All projects`}),(0,q.jsx)(`p`,{className:`page-subtitle`,children:`Visibility across all projects.`})]})}),u.projects.length>0?(0,q.jsx)(`div`,{className:`project-list project-list-scrollable`,children:u.projects.map(e=>(0,q.jsx)(Q,{project:e,sentimentColumn:f},e.project.id))}):(0,q.jsxs)(Pr,{className:`surface-card empty-card`,children:[(0,q.jsx)(`h3`,{children:u.emptyState?.title??`No projects yet`}),(0,q.jsx)(`p`,{className:`supporting-copy`,children:u.emptyState?.detail}),(0,q.jsx)(G,{size:`sm`,asChild:!0,children:(0,q.jsx)(V,{to:u.emptyState?.ctaHref===`/setup`||!u.emptyState?.ctaHref?`/setup`:`/`,children:u.emptyState?.ctaLabel??`Launch setup`})})]}),(0,q.jsxs)(`div`,{className:`overview-secondary-grid`,children:[p.length>0&&(0,q.jsxs)(`section`,{className:`overview-secondary-section`,children:[(0,q.jsx)(`div`,{className:`section-head section-head-inline`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Needs attention`}),(0,q.jsx)(`h2`,{className:`section-title-sm`,children:`What changed`})]})}),(0,q.jsx)(`div`,{className:`attention-list attention-list-scrollable`,children:p.map(e=>e.href?(0,q.jsxs)(V,{to:e.href,className:`attention-item attention-item-${e.tone}`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`attention-title`,children:e.title}),(0,q.jsx)(`p`,{className:`attention-detail`,children:e.detail})]}),e.actionLabel&&(0,q.jsx)(`span`,{className:`attention-action`,children:e.actionLabel})]},e.id):(0,q.jsxs)(`div`,{className:`attention-item attention-item-static attention-item-${e.tone}`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`attention-title`,children:e.title}),(0,q.jsx)(`p`,{className:`attention-detail`,children:e.detail})]}),e.actionLabel&&(0,q.jsx)(`span`,{className:`attention-action`,children:e.actionLabel})]},e.id))})]}),(0,q.jsxs)(`section`,{className:`overview-secondary-section`,children:[(0,q.jsx)(`div`,{className:`section-head section-head-inline`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Recent runs`}),(0,q.jsx)(`h2`,{className:`section-title-sm`,children:`Activity`})]})}),(0,q.jsx)(`div`,{className:`compact-stack compact-stack-scrollable`,children:o?(0,q.jsxs)(`div`,{role:`alert`,children:[(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`Recent jobs could not be loaded.`}),(0,q.jsx)(G,{type:`button`,variant:`secondary`,className:`mt-3`,onClick:()=>{s()},children:`Retry loading activity`})]}):a?(0,q.jsx)(`p`,{className:`supporting-copy`,role:`status`,children:`Loading recent jobs…`}):u.recentRuns.length>0?u.recentRuns.map(e=>(0,q.jsxs)(Yu,{run:e,projectName:u.projects.find(t=>t.project.id===e.projectId)?.project.name,className:`compact-run`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`compact-run-title`,children:e.projectName}),(0,q.jsx)(`p`,{className:`compact-run-detail`,children:e.summary})]}),(0,q.jsx)(to,{status:e.status})]},e.id)):(0,q.jsx)(`p`,{className:`supporting-copy`,children:`Run history appears here after the first launch.`})})]})]}),(0,q.jsxs)(`section`,{className:`page-section`,children:[(0,q.jsx)(`div`,{className:`section-head section-head-inline`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`System health`}),(0,q.jsx)(`h2`,{className:`section-title-sm`,children:`Infrastructure`})]})}),(0,q.jsx)(`div`,{className:`divide-y divide-default border-y border-default`,children:h.map(e=>{let t=e.id===`api`?m.apiStatus:e.id===`worker`?m.workerStatus:void 0,n=t?t.state===`ok`?void 0:bi(t):e.tone===`positive`?void 0:e.meta;return(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:e.label}),n&&(0,q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:n})]}),(0,q.jsx)(En,{tone:e.tone,title:t?bi(t):e.meta,children:e.detail})]},e.id)})})]})]})}var Zu=`a, button, input, select, textarea, label, [role="button"], [role="link"], [role="checkbox"], [role="menuitem"]`;function Qu(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return!1;let t=e.target;if(t&&typeof t.closest==`function`&&t.closest(Zu))return!1;let n=typeof window<`u`?window.getSelection():null;return!(n&&!n.isCollapsed&&n.toString().trim()!==``)}function $u({onApplied:e}){let{canWrite:t}=Qn(),[n,r]=(0,K.useState)(``),[i,a]=(0,K.useState)(!1),[o,s]=(0,K.useState)([]),[c,l]=(0,K.useState)([]);return In()||!t?null:(0,q.jsxs)(`section`,{className:`mt-8`,children:[(0,q.jsx)(`div`,{className:`page-section-divider`}),(0,q.jsx)(`div`,{className:`section-head mt-6`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Config as code`}),(0,q.jsx)(`h2`,{className:`text-heading-14 text-strong`,children:`Apply YAML`})]})}),(0,q.jsxs)(`p`,{className:`text-muted text-copy-14 mb-3`,children:[`Paste a `,(0,q.jsx)(`code`,{className:`text-secondary`,children:`canonry.yaml`}),` config (multi-document YAML with `,(0,q.jsx)(`code`,{className:`text-secondary`,children:`---`}),` separators supported).`]}),(0,q.jsx)(`textarea`,{className:`setup-input w-full text-copy-13-mono`,rows:10,placeholder:`apiVersion: canonry/v1
18
+ `)}}if(l?.aborted)throw new DOMException(`Turn stopped`,`AbortError`);if(!p)throw Error(`Connection ended before Aero finished. Review the partial answer before retrying.`)}finally{l?.removeEventListener(`abort`,_);try{m.releaseLock()}catch{}}}function Cc(e){return!e||e.role!==`assistant`?``:e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``)}var wc=[{id:`status`,label:`Status`,prompt:`Give me a quick status: the latest check, which engines answered, and anything that needs attention.`},{id:`changes`,label:`What changed`,prompt:`Compare the latest complete check with the one before it. Lead with mentions, then citations. Keep branded and non-brand queries separate if the project splits them, and say which changes are bigger than normal run-to-run noise.`},{id:`gaps`,label:`Biggest gaps`,prompt:`Which tracked queries does no engine mention us on, and who gets named instead? Group them by topic or market.`},{id:`insights`,label:`Top insights`,prompt:`Walk me through the 3 most severe active insights and what to do about each.`}],Tc=`https://canonry.ai`,Ec=`This demo plays sample answers only. Pick a starting point, or type / to choose one.`,Dc=`Stopped. The sample answer so far is kept.`;function Oc(e){return{queryKey:[`aero-preview`,e],queryFn:()=>bc(e),staleTime:1/0,gcTime:1/0}}var kc=[{command:`/status`,label:`Status`,prompt:`Give me a quick status: the latest check, which engines answered, and anything that needs attention.`},{command:`/changes`,label:`What changed`,prompt:`Compare the latest complete check with the one before it. Lead with mentions, then citations. Keep branded and non-brand queries separate if the project splits them, and say which changes are bigger than normal run-to-run noise.`},{command:`/gaps`,label:`Biggest gaps`,prompt:`Which tracked queries does no engine mention us on, and who gets named instead? Group them by topic or market.`},{command:`/insights`,label:`Top insights`,prompt:`Walk me through the 3 most severe active insights and what to do about each.`},{command:`/last-run`,label:`Last run`,prompt:`Summarize the latest run for this project: which engines answered, what moved in mentions and citations, and anything that failed.`},{command:`/run-sweep`,label:`Run check now`,prompt:`Run a new AI Visibility check for this project now and tell me when it lands.`},{command:`/queries`,label:`Queries`,prompt:`List the tracked queries for this project and flag any that are obvious duplicates or underperformers.`},{command:`/competitors`,label:`Competitors`,prompt:`Which competitors do engines name most often on queries where we are not named, and on which engines?`},{command:`/new`,label:`New conversation (save current)`,action:`new`}],Ac=e=>`canonry:aero:provider:${e}`,jc=(e,t)=>`canonry:aero:model:${e}:${t}`,Mc=e=>`canonry:aero:openrouter-model:${e}`;function Nc(e){let t={};for(let n of Object.values(At)){let r=Fc(jc(e,n))??(n===At.openrouter?Fc(Mc(e)):null);r&&(t[n]=r)}return t}var Pc=e=>`canonry:aero:scope:${e}`;function Fc(e){if(typeof window>`u`)return null;try{return window.localStorage.getItem(e)}catch{return null}}function Ic(e,t){if(typeof window<`u`)try{window.localStorage.setItem(e,t)}catch{}}function Lc(e){if(typeof window<`u`)try{window.localStorage.removeItem(e)}catch{}}function Rc({projectName:e,context:t,preview:r=zn()}){let i=He(),{canWrite:a,account:o}=Qn(),s=_e(),c=o?.role===`viewer`,[l,u]=(0,K.useState)(!1),[f,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)([]),[_,v]=(0,K.useState)(void 0),y=(0,K.useRef)(!1),[b,x]=(0,K.useState)(!1),[w,T]=(0,K.useState)(!1),[E,D]=(0,K.useState)(null),[O,k]=(0,K.useState)(!1),[A,ee]=(0,K.useState)(!1),[te,ne]=(0,K.useState)(null),M=(0,K.useRef)(!1),[ie,P]=(0,K.useState)(``),[oe,se]=(0,K.useState)(!1),[ce,le]=(0,K.useState)(!1),[ue,F]=(0,K.useState)([]),[de,fe]=(0,K.useState)(``),[I,L]=(0,K.useState)(null),[pe,me]=(0,K.useState)(null),[he,R]=(0,K.useState)(null),ge=(0,K.useRef)(!0),[ve,ye]=(0,K.useState)(()=>Fc(Ac(e))??null),be=i||c||r?null:ve,[xe,Se]=(0,K.useState)(()=>Nc(e)),[Ce,we]=(0,K.useState)(null),[Te]=(0,K.useState)(()=>Fc(Pc(e))===`all`?`all`:`read-only`),B=i||c||r?`read-only`:Te,Ee=(0,K.useRef)(null),De=(0,K.useRef)(null),Oe=(0,K.useRef)(null),ke=(0,K.useRef)(null),{ref:Ae}=Ys([m,de,ue]),je=(0,K.useRef)(null);(0,K.useLayoutEffect)(()=>{let e=je.current;if(!e)return;e.style.height=`auto`;let t=f?Uc:Hc;e.scrollHeight>0&&(e.style.height=`${Math.min(e.scrollHeight,t)}px`)},[ie,f,l]);let[Me,Ne]=(0,K.useState)(0),Pe=(0,K.useMemo)(()=>{let e=ie.trimStart();if(!e.startsWith(`/`)||/\s/.test(e))return[];let t=e.toLowerCase();return kc.filter(e=>(!(i||c)||e.command!==`/run-sweep`)&&(!c||e.action!==`new`)&&(!r||wc.some(t=>t.prompt===e.prompt))&&(e.command.startsWith(t)||e.label.toLowerCase().includes(t.slice(1))))},[ie,i,c,r]);(0,K.useEffect)(()=>{Ne(e=>Pe.length===0?0:Math.min(e,Pe.length-1))},[Pe.length]);let Fe=z({...fr({client:W,path:{name:e}}),enabled:!c&&!r,staleTime:6e4}),Ie=(0,K.useMemo)(()=>{let e=Fe.data?.providers??[];if(be){let t=e.find(e=>e.id===be&&e.configured);if(t)return t}let t=Ce?e.find(e=>e.id===Ce.provider&&e.configured):void 0;if(t)return t;let n=Fe.data?.defaultProvider;return n?e.find(e=>e.id===n)??null:null},[be,Fe.data,Ce]),Le=c||r||Ie!==null,Re=Ie?xe[Ie.id]??``:``,ze=!be&&Ie&&Ce?.provider===Ie.id?Ce.modelId:void 0,Ve=!i&&!c&&!r&&Ie&&Re.trim()?Re.trim():void 0,Ue=(Ve?Ie?.id:void 0)??be??void 0,H=(0,K.useCallback)((t,n)=>{let r=n.trim();Se(e=>({...e,[t]:n})),r?Ic(jc(e,t),r):Lc(jc(e,t)),t===At.openrouter&&Lc(Mc(e))},[e]);z({...Oc(e),enabled:r&&l}),(0,K.useEffect)(()=>{Fe.data&&be&&(Fe.data.providers.find(e=>e.id===be&&e.configured)||(ye(null),Lc(Ac(e))))},[Fe.data,be,e]);let Ge=(0,K.useCallback)(t=>{ye(t),t?Ic(Ac(e),t):Lc(Ac(e))},[e]);(0,K.useEffect)(()=>{if(!l)return;let e=e=>{e.key===`Escape`&&(w?T(!1):f?p(!1):u(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l,f,w]);let U=(0,K.useRef)(null);(0,K.useEffect)(()=>{l||(U.current=null)},[l]),(0,K.useEffect)(()=>{if(!l||!Le||r)return;let t=!1;U.current!==e&&(U.current=e,L(null));let n=()=>{t||oe||M.current||yc(e).then(e=>{t||M.current||(ee(e.isStreaming??!1),v(e.conversationId??null),we(e.nextTurn??null),!t&&!e.isStreaming&&(De.current===null||e.updatedAt&&e.updatedAt!==De.current.previous)&&(h(e.messages),Ee.current=e.updatedAt,De.current=null))}).catch(e=>{t||L(yn(e))})};n();let i=window.setInterval(n,15e3);return()=>{t=!0,window.clearInterval(i)}},[l,e,oe,Le,O,r]),(0,K.useEffect)(()=>(ge.current=!0,()=>{ge.current=!1,ke.current?.abort()}),[e]);async function Ke(n,a=t){let o=n.trim();if(!o||w||oe||O||M.current||A||!Le)return;if(r){await Je(o);return}if(i&&/^\/run-sweep(?:\s|$)/i.test(o)){L(Xs);return}L(null),me(null),R({prompt:o,context:a}),P(``),se(!0),le(!1),fe(``),Oe.current=null,F([]),De.current={previous:Ee.current};let s={role:`user`,content:o,timestamp:Date.now(),aeroContext:a};h(e=>[...e,s]);let l=new AbortController;ke.current=l;try{await Sc({project:e,prompt:o,conversationId:_,provider:Ue,modelId:Ve,scope:B,context:a,signal:l.signal,onEvent:Ye});let t=await yc(e);ge.current&&!t.isStreaming&&(v(t.conversationId??null),we(t.nextTurn??null),h(t.messages),Ee.current=t.updatedAt,De.current=null)}catch(e){if(!ge.current)return;c&&(De.current=null);let t=Oe.current;t&&Cc(t).trim()&&h(e=>[...e,t]),l.signal.aborted?me(`Stopped. Partial response preserved. An action already dispatched may still finish.`):L(yn(e))}finally{ge.current&&(se(!1),fe(``),F(e=>e.map(e=>e.endedAt===void 0?{...e,interrupted:!0}:e))),ke.current=null}}async function Je(t){let n=kc.find(e=>e.command===t.toLowerCase())?.prompt??t,r=wc.find(e=>e.prompt===n)?.id;if(!r){L(null),R(null),me(Ec);return}L(null),me(null),R({prompt:n}),P(``),se(!0),le(!1),fe(``),Oe.current=null,F([]),h(e=>[...e,{role:`user`,content:n,timestamp:Date.now()}]);let i=new AbortController;ke.current=i;try{let t=await s.ensureQueryData(Oc(e));if(i.signal.aborted)throw new DOMException(`Preview stopped`,`AbortError`);let n=t.starters.find(e=>e.id===r);if(!n)throw Error(`This demo has no sample answer for that starting point.`);await pc({starter:n,signal:i.signal,onEvent:Ye,reducedMotion:mc()})}catch(e){if(!ge.current)return;let t=Oe.current;t&&Cc(t).trim()&&h(e=>[...e,t]),i.signal.aborted?me(Dc):L(yn(e))}finally{ge.current&&(se(!1),fe(``),F(e=>e.map(e=>e.endedAt===void 0?{...e,interrupted:!0}:e))),ke.current=null}}function Ye(e){if(ge.current)switch(e.type){case`message_update`:e.message.role===`assistant`&&(Oe.current=e.message),fe(Cc(e.message));break;case`message_end`:if(e.message.role!==`user`){let t=e.message;h(e=>[...e,t])}e.message.role===`assistant`&&(Oe.current=null,fe(``),e.message.errorMessage&&L(e.message.errorMessage));break;case`aero_turn_status`:le(!0),e.status?.reason===`tool-limit`?me(`Tool-call limit reached. Partial response preserved.`):e.status?.reason===`time-limit`?me(`Time limit reached. Partial response preserved.`):e.status?.reason===`completed`?R(null):e.status?.reason===`error`&&L(e=>e??`Aero could not finish this answer. Retry to ask again.`);break;case`agent_end`:le(!0);break;case`tool_execution_start`:F(t=>[...t,{id:e.toolCallId,name:e.toolName,label:e.label,args:e.args,startedAt:Date.now()}]);break;case`tool_execution_end`:F(t=>t.map(t=>t.id===e.toolCallId?{...t,endedAt:Date.now(),isError:e.isError,result:e.result}:t));break;case`error`:le(!0),L(e.message)}}async function Xe(t,n=!1){if(!(oe||A||M.current)){M.current=!0,k(!0),L(null);try{await t();let r=await yc(e);if(!ge.current)return;De.current=null,Ee.current=r.updatedAt,v(r.conversationId??null),we(r.nextTurn??null),h(r.messages),F([]),fe(``),me(null),R(null),ne(null),T(n),D(n?await qe(e):null),je.current?.focus()}catch(e){ge.current&&L(yn(e))}finally{M.current=!1,ge.current&&k(!1)}}}async function Ze(){if(r){if(oe)return;h([]),F([]),fe(``),L(null),me(null),R(null),je.current?.focus()}else await Xe(()=>c?xc(e):Nn(e,crypto.randomUUID()))}async function Qe(t=!1){if(!(M.current||y.current)){y.current=!0,x(!0),T(!0),L(null);try{let n=await qe(e,{offset:t?E?.nextOffset??0:0});ge.current&&D(e=>t&&e?{...n,conversations:[...e.conversations,...n.conversations]}:n)}catch(e){ge.current&&L(yn(e))}finally{y.current=!1,ge.current&&x(!1)}}}let $e=m.length===0,et=!(c||r);if(et&&Fe.isPending)return null;if(et&&Fe.isError)return(0,q.jsx)(`div`,{className:`pointer-events-none fixed inset-x-0 bottom-0 z-40 flex justify-center p-3`,children:(0,q.jsxs)(`div`,{role:`status`,className:`flex w-full max-w-3xl flex-wrap items-center gap-x-2 gap-y-1 material-base px-4 py-2 text-label-14`,children:[(0,q.jsx)(C,{className:`h-4 w-4 text-muted`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`text-label-14-strong text-strong`,children:`Aero could not check provider availability.`}),(0,q.jsx)(G,{variant:`outline`,size:`sm`,className:`pointer-events-auto ml-auto`,onClick:()=>{Fe.refetch()},children:`Try again`})]})});let tt=Ie&&!Ie.configured?Ie:null;if(et&&(!Ie||tt))return(0,q.jsx)(`div`,{className:`pointer-events-none fixed inset-x-0 bottom-0 z-40 flex justify-center p-3`,children:(0,q.jsxs)(`div`,{role:`status`,className:`flex w-full max-w-3xl flex-wrap items-center gap-x-2 gap-y-1 material-base px-4 py-2 text-label-14`,children:[(0,q.jsx)(C,{className:`h-4 w-4 text-muted`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-label-14-strong text-strong`,children:[tt?`Aero is set to ${tt.label.replace(/\s+\(.+\)$/,``)}, which has no API key.`:`Aero needs an answer-engine provider.`,(0,q.jsx)(kr,{text:tt?`Set ${qc(tt.id)} on the server, or providers.${tt.id}.apiKey in its config.yaml.`:`Aero is the built-in AEO analyst. It reads your Canonry data with you once a provider is connected.`})]}),tt?null:a?(0,q.jsx)(G,{asChild:!0,variant:`outline`,size:`sm`,className:`pointer-events-auto ml-auto`,children:(0,q.jsx)(V,{to:`/settings`,children:`Open Settings`})}):(0,q.jsx)(`span`,{className:`ml-auto text-secondary`,children:`Ask an administrator to configure one.`})]})});let nt=l&&f?`pointer-events-auto fixed inset-0 z-40 flex items-stretch justify-center bg-bg/70 p-4 sm:p-8 backdrop-blur-sm`:`pointer-events-none fixed inset-x-0 bottom-0 z-40 flex justify-center p-3`,rt=f?`material-fullscreen pointer-events-auto flex h-full w-full max-w-5xl flex-col overflow-hidden`:`pointer-events-auto w-full max-w-3xl`,it=f?`flex-1 overflow-y-auto px-6 py-5 text-copy-14 text-strong`:`max-h-[40vh] min-h-[120px] overflow-y-auto px-4 py-3 text-copy-14 text-strong`;return(0,q.jsx)(`div`,{className:nt,onClick:e=>{f&&e.target===e.currentTarget&&p(!1)},children:(0,q.jsx)(`div`,{className:rt,children:l?(0,q.jsxs)(`div`,{"data-aero-panel":!0,className:f?`flex h-full flex-col`:`material-menu flex flex-col overflow-hidden`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-mono-800/70 px-4 py-2.5`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(C,{className:`h-4 w-4 shrink-0 text-positive-400`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:`Aero`}),(0,q.jsx)(`span`,{className:`hidden min-w-0 truncate text-label-12 normal-case text-muted sm:inline`,children:oe||A?`working…`:e})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[!i&&!c&&!r&&(0,q.jsx)(Bc,{providers:Fe.data?.providers??[],active:Ie,override:be,onPick:Ge,modelId:Re,fallbackModel:ze,onModelChange:e=>{Ie&&H(Ie.id,e)},disabled:oe}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>p(e=>!e),className:`shrink-0 rounded-md p-1.5 text-muted transition hover:bg-surface-inset hover:text-strong`,"aria-label":f?`Collapse`:`Expand`,title:f?`Collapse`:`Expand`,children:f?(0,q.jsx)(n,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}):(0,q.jsx)(d,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>{p(!1),u(!1)},className:`shrink-0 rounded-md p-1.5 text-muted transition hover:bg-surface-inset hover:text-strong`,"aria-label":`Close Aero`,children:(0,q.jsx)(N,{className:`h-4 w-4`,"aria-hidden":`true`})})]})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-subtle px-4 py-2`,children:[(0,q.jsxs)(G,{variant:`outline`,size:`sm`,disabled:oe||A||O,onClick:er(Ze),title:c||r?`Clear this conversation and start fresh.`:`Save this conversation and start fresh. Shared project notes are kept.`,children:[(0,q.jsx)(g,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),` New conversation`]}),!c&&!r&&(0,q.jsxs)(G,{variant:`ghost`,size:`sm`,"aria-expanded":w,"aria-controls":`aero-history`,disabled:O,onClick:()=>{w?T(!1):Qe()},children:[(0,q.jsx)(S,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),` History`]})]}),w?(0,q.jsxs)(`div`,{id:`aero-history`,className:it,"aria-label":`Conversation history`,children:[(0,q.jsxs)(`h3`,{className:`mb-2 text-heading-14 text-heading`,children:[`Conversations in `,e]}),E?E.conversations.length===0?(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`No saved conversations yet. Your conversations will appear here.`}):(0,q.jsx)(`ul`,{className:`divide-y divide-default`,children:E.conversations.map(t=>(0,q.jsxs)(`li`,{className:`py-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`button`,{className:`min-w-0 flex-1 rounded-md px-2 py-1 text-left hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-positive-500`,disabled:oe||A||O,onClick:()=>{t.active?T(!1):Xe(()=>Be(e,t.id))},children:[(0,q.jsx)(`span`,{className:`block truncate text-label-14 text-heading`,children:t.title}),(0,q.jsxs)(`span`,{className:`text-label-12 text-secondary`,children:[t.active?`Current · `:``,new Date(t.updatedAt).toLocaleString()]})]}),(0,q.jsx)(G,{variant:`ghost`,size:`sm`,disabled:oe||A||O,"aria-label":`Delete conversation: ${t.title}`,onClick:()=>ne(t.id),children:`Delete`})]}),te===t.id&&(0,q.jsxs)(`div`,{role:`group`,"aria-label":`Confirm conversation deletion`,className:`mt-2 rounded-md border border-default p-3 text-label-14 text-secondary`,children:[(0,q.jsx)(`p`,{children:`Delete this conversation permanently? Shared project notes will be kept.`}),(0,q.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,q.jsx)(G,{variant:`destructive`,size:`sm`,disabled:O,onClick:()=>{Xe(async()=>{await lt(e,t.id)},!0)},children:`Delete conversation`}),(0,q.jsx)(G,{variant:`ghost`,size:`sm`,disabled:O,onClick:()=>ne(null),children:`Cancel`})]})]})]},t.id))}):(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:b?`Loading history…`:`History could not be loaded. Close and reopen History to retry.`}),E?.nextOffset!=null&&(0,q.jsx)(G,{variant:`ghost`,size:`sm`,disabled:b,onClick:()=>{Qe(!0)},children:b?`Loading…`:`Load more`})]}):(0,q.jsxs)(`div`,{ref:Ae,className:it,children:[$e&&!oe&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 py-2`,children:[(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:r?(0,q.jsxs)(q.Fragment,{children:[`See how Aero answers about `,(0,q.jsx)(`span`,{className:`text-strong`,children:e}),`. Choose a starting point.`]}):(0,q.jsxs)(q.Fragment,{children:[`Ask about `,(0,q.jsx)(`span`,{className:`text-strong`,children:e}),` or choose a starting point.`]})}),(0,q.jsx)(Kc,{onPick:e=>{Ke(e)}})]}),Yc(m,e,Ue??null,B,ue,oe&&!ce,!!de.trim(),!c&&!r,Ve),oe&&de.trim()&&(0,q.jsxs)(`div`,{className:`mt-3`,children:[(0,q.jsx)(`div`,{className:`mb-0.5 text-label-12 normal-case text-positive-400`,children:`Aero`}),(0,q.jsx)(hl,{content:de})]}),r&&!$e&&!oe&&(0,q.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 border-t border-subtle pt-3`,children:[(0,q.jsx)(`p`,{className:`text-copy-13 text-secondary`,children:`Try another starting point.`}),(0,q.jsx)(Kc,{onPick:e=>{Ke(e)}})]})]}),(I||pe)&&(0,q.jsxs)(`div`,{role:I?`alert`:`status`,className:`mx-3 my-2 flex flex-wrap items-center gap-2 material-base px-3 py-2 text-label-14 text-secondary`,children:[(0,q.jsx)(`span`,{className:`flex-1`,children:I??pe}),he&&!oe&&(0,q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>{B===`all`?(P(he.prompt),je.current?.focus()):Ke(he.prompt,he.context)},children:B===`all`?`Review prompt`:`Retry`})]}),r&&(0,q.jsxs)(`p`,{className:`border-t border-subtle px-4 py-2 text-copy-13 text-secondary`,children:[`Sample answers on demo data.`,` `,(0,q.jsxs)(`a`,{href:Tc,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-positive-400 underline decoration-positive-700 hover:decoration-positive-400`,children:[`Aero answers from your own Canonry data.`,(0,q.jsx)(re,{className:`h-3 w-3`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`sr-only`,children:` (opens in a new tab)`})]})]}),(0,q.jsxs)(`div`,{className:`relative`,children:[!w&&Pe.length>0&&(0,q.jsx)(Gc,{title:r?`Starting points`:`Commands`,matches:Pe,selectedIndex:Me,onHover:Ne,onPick:e=>{P(``),je.current?.focus(),e.action===`new`?Ze():Ke(e.prompt)}}),(0,q.jsxs)(`form`,{className:`flex items-end gap-2 border-t border-mono-800/70 bg-bg/80 px-3 py-2.5`,onSubmit:e=>{if(e.preventDefault(),Pe.length>0){let e=Pe[Me];P(``),e.action===`new`?Ze():Ke(e.prompt)}else Ke(ie)},children:[(0,q.jsx)(`textarea`,{ref:je,value:ie,onChange:e=>P(e.target.value),onKeyDown:e=>{if(Pe.length>0){if(e.key===`ArrowDown`){e.preventDefault(),Ne(e=>(e+1)%Pe.length);return}if(e.key===`ArrowUp`){e.preventDefault(),Ne(e=>(e-1+Pe.length)%Pe.length);return}if(e.key===`Tab`){e.preventDefault();let t=Pe[Me];P(`${t.command} `);return}if(e.key===`Escape`){e.preventDefault(),P(``);return}}if(e.key===`Enter`&&!e.shiftKey){if(e.preventDefault(),Pe.length>0){let e=Pe[Me];P(``),e.action===`new`?Ze():Ke(e.prompt)}else Ke(ie)}},disabled:w||O,placeholder:w?`Open a conversation to continue…`:r?`Type / for a starting point`:`Ask Aero, or / for commands…`,"aria-label":`Message Aero`,rows:f?3:1,className:`flex-1 resize-none overflow-y-auto bg-transparent text-copy-14 text-heading placeholder:text-mono-600 focus:outline-none disabled:opacity-60`}),oe?(0,q.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>ke.current?.abort(),"aria-label":`Stop Aero`,children:[(0,q.jsx)(ae,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),` Stop`]}):(0,q.jsx)(G,{type:`submit`,size:`sm`,disabled:!ie.trim()||w||O||A,"aria-label":`Send`,children:(0,q.jsx)(j,{className:`h-4 w-4`,"aria-hidden":`true`})})]})]})]}):(0,q.jsx)(`button`,{type:`button`,onClick:()=>{u(!0),We(`aero.open`)},className:`material-small flex w-full items-center justify-between px-4 py-2 text-left text-button-14 text-secondary transition hover:bg-bg-elevated hover:text-strong`,children:(0,q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(C,{className:`h-4 w-4 text-positive-400`,"aria-hidden":`true`}),`Ask Aero about `,e,`…`]})})})})}function zc(e,t){return/\s/.test(t)?`Model IDs have no spaces.`:e===At.openrouter&&!Dn.test(t)?`Use publisher/model, for example openai/gpt-6-luna.`:null}function Bc({providers:e,active:t,override:n,onPick:r,modelId:i,fallbackModel:a,onModelChange:o,disabled:s}){let[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(null),[f,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(``),[g,_]=(0,K.useState)(null),v=(0,K.useRef)(null),x=(0,K.useRef)(null),S=(0,K.useRef)(null),C=(0,K.useId)(),w=(0,K.useId)(),T=(0,K.useId)(),E=(0,K.useCallback)(e=>{l(!1),d(null),p(!1),_(null),e&&v.current?.focus()},[]),D=(0,K.useCallback)(()=>{let e=v.current?.getBoundingClientRect();if(!e)return;let t=window.innerHeight-e.bottom-8,n=e.top-8,r=Math.max(8,window.innerWidth-e.right);d(t>=n?{top:e.bottom+4,right:r,maxHeight:t-4}:{bottom:window.innerHeight-e.top+4,right:r,maxHeight:n-4})},[]);(0,K.useLayoutEffect)(()=>{c&&D()},[c,D]);let O=u!==null;if((0,K.useEffect)(()=>{if(!c||!O)return;let e=Vc(x.current);(e.find(e=>e.getAttribute(`aria-checked`)===`true`&&e.closest(`[data-menu-group="model"]`))??e[0])?.focus()},[c,O]),(0,K.useEffect)(()=>{f&&S.current?.focus()},[f]),(0,K.useEffect)(()=>{if(!c)return;let e=e=>{let t=e.target;v.current?.contains(t)||x.current?.contains(t)||E(!1)},t=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),E(!0))};return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,t,!0),window.addEventListener(`resize`,D),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,t,!0),window.removeEventListener(`resize`,D)}},[c,E,D]),e.length===0)return null;let k=e.filter(e=>e.configured),A=k.length<e.length,ee=t?.configured?t.models??[]:[],j=i.trim()||a||t?.defaultModel||``,te=ee.find(e=>e.id===j)?.displayName??j,ne=!!(t?.configured&&j&&!ee.some(e=>e.id===j)),M=t?t.label.replace(/\s+\(.+\)$/,``):`No provider`,re=e=>{let t=e.target;if(e.key===`Tab`){let n=t.closest(`[data-other-model-form]`),r=t.tagName===`INPUT`;if(n&&(r&&!e.shiftKey||!r&&e.shiftKey))return;e.preventDefault(),E(!0);return}if(!t.matches(`[role^="menuitem"]`))return;let n=Vc(x.current),r=n.indexOf(t),i=e.key===`ArrowDown`?n[(r+1)%n.length]:e.key===`ArrowUp`?n[(r-1+n.length)%n.length]:e.key===`Home`?n[0]:e.key===`End`?n[n.length-1]:void 0;i&&(e.preventDefault(),i.focus())},ie=()=>{if(!t)return;let e=m.trim();if(!e){_(`Enter a model ID.`);return}let n=zc(t.id,e);n?_(n):(o(e),E(!0))},N=`flex min-h-10 w-full items-center gap-2 px-3 py-2 text-left text-label-14 text-heading transition outline-none hover:bg-bg-elevated focus-visible:bg-bg-elevated focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-mono-400 disabled:opacity-60`,P=e=>(0,q.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center`,children:e?(0,q.jsx)(y,{className:`h-3.5 w-3.5 text-positive-400`,"aria-hidden":`true`}):null});return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{ref:v,type:`button`,onClick:()=>c?E(!1):l(!0),onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),l(!0))},disabled:s,className:`flex min-h-8 min-w-0 items-center gap-1 rounded-md px-2 py-1 text-button-14 text-secondary transition hover:bg-surface-inset hover:text-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400 disabled:opacity-50`,"aria-haspopup":`menu`,"aria-expanded":c,"aria-controls":c?C:void 0,title:t?`${t.label} · ${j}`:`Pick a provider`,children:[(0,q.jsx)(`span`,{className:`sr-only`,children:`Aero model: `}),(0,q.jsx)(`span`,{className:`min-w-0 truncate text-button-14 text-strong`,children:t?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`hidden sm:inline`,children:[M,` · `]}),te]}):M}),(0,q.jsx)(b,{className:`h-3 w-3 shrink-0`,"aria-hidden":`true`})]}),c&&u&&(0,Js.createPortal)((0,q.jsxs)(`div`,{ref:x,id:C,role:`menu`,"aria-label":`Aero model`,onKeyDown:re,style:{position:`fixed`,top:u.top,bottom:u.bottom,right:u.right,maxHeight:u.maxHeight},className:`z-50 w-72 max-w-[calc(100vw-1rem)] overflow-y-auto material-menu py-1`,children:[(0,q.jsxs)(`div`,{role:`group`,"aria-labelledby":w,children:[(0,q.jsx)(`div`,{id:w,className:`px-3 pb-1 pt-2 text-label-14-strong text-secondary`,children:`Provider`}),k.map(e=>{let n=t?.id===e.id;return(0,q.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":n,tabIndex:-1,onClick:()=>{n||r(e.id),E(!0)},className:N,children:[P(n),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label.replace(/\s+\(.+\)$/,``)})]},e.id)}),n&&(0,q.jsxs)(`button`,{type:`button`,role:`menuitem`,tabIndex:-1,onClick:()=>{r(null),E(!0)},className:`${N} text-secondary`,children:[P(!1),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Use default provider`})]}),A&&(0,q.jsxs)(V,{to:`/settings`,role:`menuitem`,tabIndex:-1,onClick:()=>E(!1),className:`${N} text-secondary`,children:[P(!1),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Connect another provider`})]})]}),t?.configured&&(0,q.jsxs)(`div`,{role:`group`,"aria-labelledby":T,"data-menu-group":`model`,className:`mt-1 border-t border-default`,children:[(0,q.jsx)(`div`,{id:T,className:`px-3 pb-1 pt-2 text-label-14-strong text-secondary`,children:`Model`}),ee.map(e=>{let n=e.id===j,r=e.id===t.defaultModel;return(0,q.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":n,tabIndex:-1,onClick:()=>{o(e.id),E(!0)},className:N,title:e.id,children:[P(n),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.displayName}),r&&(0,q.jsx)(`span`,{className:`shrink-0 text-label-14 text-secondary`,children:`Default`})]},e.id)}),ne&&(0,q.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":!0,tabIndex:-1,onClick:()=>E(!0),className:N,title:j,children:[P(!0),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-label-13-mono`,children:j})]}),(0,q.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-expanded":f,tabIndex:-1,onClick:()=>{h(ne?j:``),_(null),p(e=>!e)},className:`${N} text-secondary`,children:[P(!1),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Other model…`})]}),f&&(0,q.jsxs)(`form`,{"data-other-model-form":!0,className:`px-3 pb-2 pt-1`,onSubmit:e=>{e.preventDefault(),ie()},children:[(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(`input`,{ref:S,className:`setup-input min-w-0 flex-1`,"aria-label":`Other model ID`,"aria-invalid":g?!0:void 0,"aria-describedby":g?`${C}-other-error`:void 0,value:m,placeholder:t.id===At.openrouter?`publisher/model`:`Model ID`,autoComplete:`off`,spellCheck:!1,onChange:e=>{h(e.target.value),_(null)}}),(0,q.jsx)(G,{type:`submit`,variant:`secondary`,size:`sm`,className:`h-auto self-stretch md:h-auto`,children:`Use`})]}),g&&(0,q.jsx)(`p`,{id:`${C}-other-error`,role:`alert`,className:`mt-1.5 text-copy-14 text-negative-400`,children:g})]}),(0,q.jsx)(`p`,{className:`px-3 pb-2 pt-1 text-copy-14 text-secondary`,children:`Applies to Aero only.`})]})]}),document.body)]})}function Vc(e){return Array.from(e?.querySelectorAll(`[role^="menuitem"]`)??[])}var Hc=144,Uc=288,Wc=288;function Gc({title:e,matches:t,selectedIndex:n,onHover:r,onPick:i}){let a=(0,K.useRef)(null),o=(0,K.useRef)(null),s=(0,K.useRef)(null),[c,l]=(0,K.useState)(Wc);return(0,K.useLayoutEffect)(()=>{let e=a.current,t=e?.closest(`[data-aero-panel]`),n=e?.parentElement;if(!e||!t||!n)return;let r=n.getBoundingClientRect().top-t.getBoundingClientRect().top-16-(o.current?.getBoundingClientRect().height??0);l(r>0?Math.min(Wc,Math.floor(r)):Wc)},[t.length]),(0,K.useEffect)(()=>{(s.current?.querySelector(`[aria-selected="true"]`))?.scrollIntoView?.({block:`nearest`})},[n]),(0,q.jsxs)(`div`,{ref:a,className:`absolute inset-x-3 bottom-full mb-2 overflow-hidden material-menu`,children:[(0,q.jsx)(`div`,{ref:o,className:`border-b border-default px-3 py-1.5 text-label-12 normal-case text-muted`,children:e}),(0,q.jsx)(`ul`,{ref:s,role:`listbox`,className:`overflow-y-auto py-1`,style:{maxHeight:c},children:t.map((e,t)=>{let a=t===n;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":a,onMouseEnter:()=>r(t),onClick:()=>i(e),className:`flex w-full items-center gap-3 px-3 py-2 text-left text-button-14 transition ${a?`bg-bg-elevated text-heading`:`text-neutral hover:bg-bg-elevated/60`}`,children:[(0,q.jsx)(`span`,{className:`text-button-14`,children:e.label}),(0,q.jsx)(`span`,{className:`ml-auto text-label-12-mono text-secondary`,children:e.command})]})},e.command)})})]})}function Kc({onPick:e}){return(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:wc.map(t=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>e(t.prompt),className:`rounded-md border border-base bg-bg-elevated/70 px-3 py-1.5 text-button-14 text-neutral transition hover:border-strong hover:bg-mono-800/70 hover:text-heading`,children:t.label},t.label))})}function qc(e){switch(e){case At.claude:return`ANTHROPIC_API_KEY`;case At.openai:return`OPENAI_API_KEY`;case At.gemini:return`GEMINI_API_KEY`;case At.zai:return`ZAI_API_KEY`;case At.openrouter:return`OPENROUTER_API_KEY`}}function Jc(e,t){let n=e.timestamp??0;return`${e.role}:${n}:${t}`}function Yc(e,t,n,r,i,a,o,s=!0,c){let l=[],u=[],d=e.at(-1),f=d?.role===`assistant`&&d.stopReason===`stop`,p=a&&!o&&!f,m=0;for(let t=e.length-1;t>=0;t--)if(e[t].role===`user`){m=t+1;break}let h=(e=!1)=>{u.length!==0&&(l.push((0,q.jsx)(dl,{trails:u,betweenSteps:e&&p},`tools:${u[0].id}`)),u=[])};for(let o=0;o<e.length;o++){let d=e[o],f=Jc(d,o);if(d.role===`user`){h();let e=typeof d.content==`string`?d.content:JSON.stringify(d.content);if(e.startsWith(`[system]`))continue;l.push((0,q.jsx)(Xc,{text:e,projectName:t,providerOverride:n,modelOverride:c,scope:r,context:d.aeroContext,cliCopy:s},f))}else if(d.role===`assistant`){let t=new Map,n=o+1;for(;n<e.length&&e[n].role===`toolResult`;){let r=e[n];t.set(r.toolCallId,r),n++}let r=a&&o>=m,s=Qc(d,t).map(e=>{let t=i.find(t=>t.id===e.id),n={...e,...t,label:e.label??t?.label};return{...n,interrupted:n.endedAt===void 0&&(!r||n.interrupted)}}),c=Cc(d);c.trim()&&(h(),l.push((0,q.jsxs)(`div`,{className:`mt-3`,children:[(0,q.jsx)(`div`,{className:`mb-0.5 text-label-12 normal-case text-positive-400`,children:`Aero`}),(0,q.jsx)(hl,{content:c})]},f))),u.push(...s),o=n-1}}return u.length===0&&p&&l.push((0,q.jsx)(gl,{},`thinking`)),h(!0),l}function Xc({text:e,projectName:t,providerOverride:n,modelOverride:r,scope:i,context:a,cliCopy:o=!0}){let[s,l]=(0,K.useState)(!1),u=(0,K.useMemo)(()=>Zc(t,e,n,i,a,r),[t,e,n,i,a,r]);async function d(){try{await navigator.clipboard.writeText(u),l(!0),window.setTimeout(()=>l(!1),1500)}catch{}}return(0,q.jsxs)(`div`,{className:`group relative mt-3 rounded-md bg-bg-elevated/60 px-3 py-2 text-strong`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`div`,{className:`text-label-12 normal-case text-muted`,children:`You`}),o&&(0,q.jsx)(`button`,{type:`button`,onClick:er(d),className:`inline-flex items-center gap-1 rounded border border-mono-800/70 bg-bg/60 px-1.5 py-0.5 text-button-14 text-secondary opacity-0 transition hover:border-strong hover:text-heading group-hover:opacity-100 focus:opacity-100`,"aria-label":`Copy as CLI command`,title:u,children:s?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(y,{className:`h-2.5 w-2.5 text-positive-400`,"aria-hidden":`true`}),`Copied`]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(c,{className:`h-2.5 w-2.5`,"aria-hidden":`true`}),`Copy as CLI`]})})]}),(0,q.jsx)(`div`,{className:`whitespace-pre-wrap`,children:e})]})}function Zc(e,t,n,r,i,a){let o=[`canonry`,`agent`,`ask`,Wr(e),Wr(t)];return n&&o.push(`--provider`,n),a&&o.push(`--model`,Wr(a)),r===`read-only`&&o.push(`--scope`,`read-only`),i&&o.push(`--context`,Wr(JSON.stringify(i))),o.join(` `)}function Qc(e,t){let n=[];for(let r of e.content){if(r.type!==`toolCall`)continue;let e=r,i=t.get(e.id);n.push({id:e.id,name:e.name,args:e.arguments,label:i?.aeroToolLabel,durationMs:i?.aeroDurationMs,endedAt:i?.timestamp,isError:i?.isError,result:i?.content})}return n}var $c=new Set([`aero_list_toolkits`,`aero_load_toolkit`]),el=new Map([[`Read`,`Reading`],[`List`,`Listing`],[`Get`,`Getting`],[`Load`,`Loading`],[`Find`,`Finding`],[`Check`,`Checking`],[`Compare`,`Comparing`],[`Inspect`,`Inspecting`],[`Preview`,`Previewing`],[`Search`,`Searching`],[`Show`,`Showing`],[`Run`,`Running`]]);function tl(e){return e.endedAt===void 0&&!e.interrupted}function nl(e){return e.label??e.name.replace(/^(?:canonry|aero)_/,``).replace(/_/g,` `)}function rl(e){let t=e.durationMs??(e.endedAt!=null&&e.startedAt!=null?e.endedAt-e.startedAt:null);return t==null||t<0?null:t}function il(e){let t=null;for(let n of e){let e=rl(n);e!=null&&(t=(t??0)+e)}return t}function al(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function ol(e){let t=Math.floor(Math.max(0,e)/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function sl(e,t,n){return`${e} ${e===1?t:n}`}function cl(e=``){return el.get(e.charAt(0).toUpperCase()+e.slice(1))}function ll(e){let[t,...n]=e.trim().split(/\s+/),r=cl(t);if(!r)return`Working…`;if(n[0]===`or`||n[0]===`and`){let e=cl(n[1]);return e?`${[r,n[0],e.toLowerCase(),...n.slice(2)].join(` `)}…`:`Working…`}return`${[r,...n].join(` `)}…`}function ul(e){let[t,n]=(0,K.useState)(()=>Date.now());return(0,K.useEffect)(()=>{if(!e)return;let t=()=>n(Date.now()),r=window.setTimeout(t,0),i=window.setInterval(t,1e3);return()=>{window.clearTimeout(r),window.clearInterval(i)}},[e]),t}function dl({trails:e,betweenSteps:t}){let[n,r]=(0,K.useState)(!1),i=(0,K.useId)(),a=e.filter(e=>!$c.has(e.name)),o=e.filter(e=>$c.has(e.name)),s=a.filter(tl),c=s.length>0?s[s.length-1]:void 0,l=o.some(tl),u=c!==void 0||l||t,d=a.length>0?a:o,f=d.filter(e=>!tl(e)&&e.isError===!0).length,p=e.some(e=>e.interrupted),h=e.flatMap(e=>e.startedAt===void 0?[]:[e.startedAt]),g=h.length>0?Math.min(...h):void 0,_=ul(u),v=il(d),b=u?c?ll(nl(c)):l?`Loading tools…`:a.length>0?`Reviewing results…`:`Preparing next step…`:a.length>0?sl(a.length,`step`,`steps`):sl(o.length,`setup step`,`setup steps`),x=new Map;for(let e of a){let t=nl(e),n=x.get(t);n?n.push(e):x.set(t,[e])}return(0,q.jsxs)(`div`,{className:`mt-3 material-base`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left`,"aria-expanded":n,"aria-controls":i,children:[(0,q.jsx)(`span`,{className:`flex h-3.5 w-3.5 shrink-0 items-center justify-center`,children:u?(0,q.jsx)(m,{className:`h-3 w-3 animate-spin text-positive-400 motion-reduce:animate-none`,"aria-hidden":`true`}):f>0?(0,q.jsx)(te,{className:`h-3 w-3 text-negative-400`,"aria-hidden":`true`}):p?(0,q.jsx)(ae,{className:`h-3 w-3 text-muted`,"aria-hidden":`true`}):(0,q.jsx)(y,{className:`h-3 w-3 text-muted`,"aria-hidden":`true`})}),(0,q.jsx)(`span`,{role:u?`status`:void 0,className:`min-w-0 truncate text-label-14-strong text-heading`,children:b}),f>0&&(0,q.jsxs)(`span`,{className:`shrink-0 rounded-md border border-negative-800/50 bg-negative-950/20 px-1.5 py-0.5 text-label-12 text-negative-400`,children:[f,` failed`]}),p&&(0,q.jsx)(`span`,{className:`shrink-0 rounded-md border border-mono-800/70 px-1.5 py-0.5 text-label-12 text-muted`,children:`interrupted`}),(0,q.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 text-label-12 text-muted`,children:[u?(0,q.jsxs)(q.Fragment,{children:[c&&(0,q.jsxs)(`span`,{children:[`step `,a.indexOf(c)+1]}),g!==void 0&&(0,q.jsx)(`span`,{className:`tabular-nums`,"aria-hidden":`true`,children:ol(_-g)})]}):v!=null&&(0,q.jsx)(`span`,{className:`tabular-nums`,children:al(v)}),(0,q.jsx)(M,{className:`h-3 w-3 transition-transform ${n?`rotate-90`:``}`,"aria-hidden":`true`})]})]}),n&&(0,q.jsxs)(`div`,{id:i,className:`space-y-1.5 border-t border-default px-2.5 py-2`,children:[[...x].map(([e,t])=>(0,q.jsx)(fl,{trails:t,title:e},`label:${e}`)),o.length>0&&(0,q.jsx)(fl,{trails:o,title:`+ ${sl(o.length,`setup step`,`setup steps`)}`,muted:!0},`setup`)]})]})}function fl({trails:e,title:t,muted:n=!1}){let[r,i]=(0,K.useState)(!1),a=(0,K.useId)(),o=!n&&e.length===1,s=e.some(tl),c=e.filter(e=>!tl(e)&&e.isError===!0).length,l=e.some(e=>e.interrupted),u=il(e),d=o?()=>i(!0):void 0;return(0,q.jsxs)(`div`,{className:o?void 0:n?`rounded-md`:`material-base`,onFocus:d,onClick:d,children:[!o&&(0,q.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left`,"aria-expanded":r,"aria-controls":a,children:[!n&&(0,q.jsx)(`span`,{className:`flex h-3.5 w-3.5 shrink-0 items-center justify-center`,children:s?(0,q.jsx)(m,{className:`h-3 w-3 animate-spin text-positive-400 motion-reduce:animate-none`,"aria-hidden":`true`}):c>0?(0,q.jsx)(te,{className:`h-3 w-3 text-negative-400`,"aria-hidden":`true`}):(0,q.jsx)(ee,{className:`h-3 w-3 text-muted`,"aria-hidden":`true`})}),(0,q.jsx)(`span`,{className:n?`text-label-12 text-muted`:`text-label-14-strong text-heading`,children:t}),!n&&(0,q.jsxs)(`span`,{className:`text-label-12 text-muted`,children:[`×`,e.length]}),(0,q.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-label-12 text-muted`,children:[s?(0,q.jsx)(`span`,{className:`text-positive-400`,children:`running…`}):(0,q.jsxs)(q.Fragment,{children:[c>0?(0,q.jsxs)(`span`,{className:`text-negative-400`,children:[c,` failed`]}):(0,q.jsx)(`span`,{children:l?`interrupted`:`done`}),u!=null&&(0,q.jsx)(`span`,{className:`tabular-nums`,children:al(u)})]}),(0,q.jsx)(M,{className:`h-3 w-3 transition-transform ${r?`rotate-90`:``}`,"aria-hidden":`true`})]})]}),(o||r)&&(0,q.jsx)(`div`,{id:a,className:o?void 0:`space-y-1.5 px-2.5 pb-2`,children:e.map(e=>(0,q.jsx)(pl,{trail:e},e.id))})]})}function pl({trail:e}){let[t,n]=(0,K.useState)(!1),r=tl(e),i=!r&&e.isError===!0,a=rl(e),o=a==null?null:al(a);return(0,q.jsxs)(`div`,{className:`rounded-md border ${i?`border-negative-800/50`:r?`border-positive-800/50`:`border-mono-800/70`} ${i?`bg-negative-950/20`:r?`bg-positive-950/20`:`bg-surface-hover`}`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left`,"aria-expanded":t,children:[(0,q.jsx)(`span`,{className:`flex h-3.5 w-3.5 shrink-0 items-center justify-center`,children:r?(0,q.jsx)(m,{className:`h-3 w-3 animate-spin text-positive-400`,"aria-hidden":`true`}):i?(0,q.jsx)(te,{className:`h-3 w-3 text-negative-400`,"aria-hidden":`true`}):(0,q.jsx)(ee,{className:`h-3 w-3 text-muted`,"aria-hidden":`true`})}),(0,q.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:nl(e)}),(0,q.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-label-12 text-muted`,children:[r?(0,q.jsx)(`span`,{className:`text-positive-400`,children:`running…`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{children:e.interrupted?`interrupted`:i?`failed`:`done`}),o&&(0,q.jsx)(`span`,{children:o})]}),(0,q.jsx)(M,{className:`h-3 w-3 transition-transform ${t?`rotate-90`:``}`,"aria-hidden":`true`})]})]}),t&&(0,q.jsxs)(`div`,{className:`border-t border-default px-2.5 py-2 text-label-12 text-secondary`,children:[(0,q.jsx)(`div`,{className:`mb-2 text-label-12 text-secondary`,children:e.name}),(0,q.jsx)(`div`,{className:`mb-1 text-label-12 text-secondary`,children:`Inputs`}),(0,q.jsx)(`pre`,{className:`mb-2 overflow-x-auto whitespace-pre-wrap break-all text-copy-13 text-neutral`,children:ml(e.args)}),!r&&e.result!==void 0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`mb-1 text-label-12 normal-case text-faint`,children:i?`Error`:`Result`}),(0,q.jsx)(`pre`,{className:`overflow-x-auto whitespace-pre-wrap break-all text-copy-13 text-neutral`,children:ml(e.result)})]})]})]})}function ml(e){try{let t=typeof e==`string`?e:JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}\n… (${t.length-2e3} more chars)`:t}catch{return String(e)}}function hl({content:e}){return(0,q.jsx)(`div`,{className:`text-heading`,children:(0,q.jsx)(he,{remarkPlugins:[ge],components:{h1:e=>(0,q.jsx)(`h1`,{...e,className:`mt-3 mb-2 text-heading-16 text-primary`}),h2:e=>(0,q.jsx)(`h2`,{...e,className:`mt-3 mb-2 text-heading-14 text-primary`}),h3:e=>(0,q.jsx)(`h3`,{...e,className:`mt-3 mb-1.5 text-heading-14 text-heading`}),h4:e=>(0,q.jsx)(`h4`,{...e,className:`mt-2 mb-1 text-heading-14 normal-case text-neutral`}),p:e=>(0,q.jsx)(`p`,{...e,className:`mb-2 text-copy-14`}),ul:e=>(0,q.jsx)(`ul`,{...e,className:`mb-2 ml-4 list-disc space-y-1`}),ol:e=>(0,q.jsx)(`ol`,{...e,className:`mb-2 ml-4 list-decimal space-y-1`}),li:e=>(0,q.jsx)(`li`,{...e,className:`marker:text-mono-600`}),strong:e=>(0,q.jsx)(`strong`,{...e,className:`text-primary`}),em:e=>(0,q.jsx)(`em`,{...e,className:`text-strong`}),code:({children:e,...t})=>(0,q.jsx)(`code`,{...t,className:`rounded bg-mono-800/70 px-1 py-0.5 text-label-12-mono text-positive-200`,children:e}),pre:e=>(0,q.jsx)(`pre`,{...e,className:`mb-2 overflow-x-auto material-base p-3 text-copy-13-mono text-strong`}),a:e=>(0,q.jsx)(`a`,{...e,className:`text-positive-400 underline decoration-positive-700 hover:decoration-positive-400`,target:`_blank`,rel:`noopener noreferrer`}),table:e=>(0,q.jsx)(`div`,{className:`mb-2 overflow-x-auto`,children:(0,q.jsx)(`table`,{...e,className:`w-full border-collapse text-label-12`})}),thead:e=>(0,q.jsx)(`thead`,{...e,className:`border-b border-base`}),th:e=>(0,q.jsx)(`th`,{...e,className:`px-2 py-1 text-left text-label-14-strong text-neutral`}),tr:e=>(0,q.jsx)(`tr`,{...e,className:`border-b border-mono-900`}),td:e=>(0,q.jsx)(`td`,{...e,className:`px-2 py-1 text-strong`}),blockquote:e=>(0,q.jsx)(`blockquote`,{...e,className:`mb-2 border-l-2 border-strong pl-3 italic text-secondary`}),hr:()=>(0,q.jsx)(`hr`,{className:`my-3 border-base`})},children:e})})}function gl(){return(0,q.jsxs)(`div`,{role:`status`,className:`mt-3 flex items-center gap-2 py-1.5 text-label-14 text-secondary`,children:[(0,q.jsx)(m,{className:`h-3 w-3 shrink-0 animate-spin motion-reduce:animate-none`,"aria-hidden":`true`}),`Thinking…`]})}function _l({isAdmin:e,account:t}){return e||t?.role===`viewer`&&qt()}function vl(){let{isAdmin:e,account:t}=Qn(),n=De(),r=/^\/projects\/([^/]+)/.exec(n.pathname),i=r?decodeURIComponent(r[1]):null,a=z({...yr({client:W}),enabled:i!==null,staleTime:6e4}),o=qs(n.pathname,n.search),s=a.data??[],c=s.find(e=>e.id===i)??s.find(e=>e.name===i),l=Jr(c?.name??i??``,o),u=zn(),d=u||_l({isAdmin:e,account:t});return!i||!d||!c?null:(0,q.jsx)(Rc,{projectName:c.name,context:l,preview:u},c.name)}function yl(e,t,n){switch(e.invalidateQueries({queryKey:hr({client:W})}),e.invalidateQueries({queryKey:pr({client:W})}),or(e,`runs`),t){case U[`answer-visibility`]:gs(e,n,`none`),or(e,`visibilityReport`),or(e,`queryTracking`);return;case U[`backlink-extract`]:return;case U[`seo-sync`]:or(e,`seo`,{projectName:n});return;case U[`site-audit`]:or(e,`technicalAeo`),or(e,`trends`,{projectName:n});return;case U[`gsc-sync`]:case U[`inspect-sitemap`]:or(e,`gsc`),or(e,`trends`,{projectName:n});return;case U[`ga-sync`]:or(e,`ga`);return;case U[`traffic-sync`]:or(e,`ga`),or(e,`traffic`);return;case U[`bing-inspect`]:case U[`bing-inspect-sitemap`]:case U[`bing-sync`]:or(e,`bing`),or(e,`trends`,{projectName:n});return;case U[`aeo-discover-seed`]:case U[`aeo-discover-probe`]:gs(e,n);return;case U[`gbp-sync`]:or(e,`gbp`);return;case U[`ads-sync`]:or(e,`ads`);return;case U[`google-ads-sync`]:or(e,`googleAds`),or(e,`conversionTracking`);return;case U[`gtm-sync`]:or(e,`gtm`),or(e,`conversionTracking`);return;default:return t}}var bl=[{label:`GitHub`,href:`https://github.com/Canonry/canonry`,Icon:v},{label:`Docs`,href:`https://github.com/Canonry/canonry/tree/main/docs`,Icon:T},{label:`Changelog`,href:`https://github.com/Canonry/canonry/releases`,Icon:ce}],xl=e=>({label:e,state:`checking`,detail:`Checking service health`}),Sl={apiStatus:xl(`API`),workerStatus:xl(`Worker`)};function Cl(e){return e===`completed`?`positive`:e===`partial`?`caution`:`negative`}function wl(e){let t=Ns(e.kind);return e.status===`completed`?`${t} completed`:e.status===`partial`?`${t} completed with partial results`:e.status===`cancelled`?`${t} cancelled`:`${t} failed`}function Tl(e,t){return e.error?`${t}: ${cn(e.error)}`:e.location?`${t} · ${e.location}`:t}function El(e,t,n){if(t)return t;let r=n.find(t=>t.id===e);return r?.displayName||r?.name||e}function Dl(e,t){return[e.completed>0?`${e.completed} completed`:null,e.partial>0?`${e.partial} partial`:null,e.failed>0?`${e.failed} failed`:null,e.cancelled>0?`${e.cancelled} cancelled`:null,t>0?`${t} skipped at queue time`:null].filter(Boolean).join(`, `)}function Ol(e){return e.failed>0||e.cancelled>0?`negative`:e.partial>0?`caution`:`positive`}function kl(){let e=_e(),t=(0,K.useSyncExternalStore)(Fi,Pi,Pi),n=Object.keys(t.runs).length>0||Object.keys(t.batches).length>0,r=z({...wr({client:W}),enabled:n,staleTime:tr,refetchInterval:3e3}),i=z({...yr({client:W}),enabled:n}),a=(0,K.useRef)({}),o=(0,K.useCallback)(()=>{r.refetch()},[r.refetch]);return(0,K.useEffect)(()=>{n&&o()},[n,o]),(0,K.useEffect)(()=>{if(!n||typeof window>`u`)return;let e=()=>{document.visibilityState===`visible`&&o()};return window.addEventListener(`focus`,o),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,o),document.removeEventListener(`visibilitychange`,e)}},[n,o]),(0,K.useEffect)(()=>{let n=r.data??[],o=i.data??[],s=Object.fromEntries(n.map(e=>[e.id,e])),c=Object.fromEntries(n.map(e=>[e.id,e.status]));for(let n of Object.values(t.runs)){let t=s[n.runId];if(!t||!Bi(t.status)||(a.current[t.id]??n.lastAnnouncedStatus)===t.status)continue;let r=o.find(e=>e.id===t.projectId);if(r&&yl(e,t.kind,r.name),n.sourceAction===`run-all`){Li(t.id);continue}let i=El(t.projectId,n.projectLabel,o);rr({title:wl(t),detail:Tl(t,i),tone:Cl(t.status),dedupeKey:`run:${t.id}`,dedupeMode:`replace`,cta:{label:`View run`,intent:`open-run-drawer`,runId:t.id}}),Li(t.id)}if(r.data!==void 0){let r=new Set(n.map(e=>e.id)),i=Hi(Object.values(t.runs),r,Date.now(),Vi);for(let t of i){let n=o.find(e=>e.id===t.projectId);n&&yl(e,t.kind,n.name),t.sourceAction!==`run-all`&&rr({title:`${Ns(t.kind)} status unavailable`,detail:El(t.projectId,t.projectLabel,o),tone:`neutral`,dedupeKey:`run-stale:${t.runId}`,dedupeMode:`replace`}),Li(t.runId)}}for(let e of Object.values(t.batches)){let t=Ui(e.runIds,s);t.finished&&(rr({title:`Run-all batch finished`,detail:Dl(t,e.skippedCount),tone:Ol(t),dedupeKey:`batch:${e.batchId}`,dedupeMode:`replace`,cta:{label:`View runs`,intent:`go-to-runs`}}),zi(e.batchId))}a.current=c},[i.data,r.data,t,e]),null}function Al(){let{account:e,isAdmin:t}=Qn(),n=ps(),r=(0,K.useMemo)(()=>_n(),[]),a=(0,K.useMemo)(_t,[]),c=(0,K.useMemo)(Ft,[]),d=zn()||c&&_l({isAdmin:t,account:e}),f=(0,K.useMemo)(Fe,[]),p=De(),m=Se(),h=(0,K.useRef)(!1);(0,K.useEffect)(()=>{if(r){if(!h.current){h.current=!0;let e=oi(p.pathname,si());if(e){m({to:e,replace:!0});return}}ci(ai(p.pathname))}},[r,p.pathname,m]);let{dashboard:g,isLoading:v,refetch:y}=ms(void 0,{includeSettings:!r,includeOverviews:!1,pauseProjectPolling:p.pathname===`/setup`}),b=Ss(!n,n?.health).data??n?.health??Sl,{runId:x,evidenceId:C,closeDrawer:T}=ws(),[E,D]=(0,K.useState)(!1),[k,A]=(0,K.useState)(()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(`canonry:sidebarHidden`)===`true`}catch{return!1}}),[ee,j]=(0,K.useState)(()=>{if(typeof window>`u`)return null;try{return window.localStorage.getItem(`canonry:dismissedUpdateVersion`)}catch{return null}}),[te]=(0,K.useState)(()=>typeof window>`u`?null:new URLSearchParams(window.location.search).get(`force-update`)),re=te?{current:b.apiStatus.version??`0.0.0`,latest:te,url:`https://www.npmjs.com/package/@canonry/canonry`,upgradeCommand:`npm install -g @canonry/canonry`}:b.apiStatus.updateAvailable,ie=f&&re&&re.latest!==ee,P=()=>{if(re){try{window.localStorage.setItem(`canonry:dismissedUpdateVersion`,re.latest)}catch{}j(re.latest)}},ae=()=>{let e=!k;try{e?window.localStorage.setItem(`canonry:sidebarHidden`,`true`):window.localStorage.removeItem(`canonry:sidebarHidden`)}catch{}A(e)},ce=Cs(x),F=ce.data??null,me=ce.isLoading;(0,K.useEffect)(()=>{F&&F.status!==`running`&&F.status!==`queued`&&y()},[F?.status,y]),(0,K.useEffect)(()=>{D(!1)},[p.pathname]),(0,K.useEffect)(()=>{if(typeof window>`u`||E||!x&&!C)return;let e=e=>{e.key===`Escape`&&T()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[x,C,T,E]);let he=g??n?.dashboard??null,R=p.pathname===`/setup`,ge=R&&he!==null&&he.portfolioOverview.projects.length===0,_e=R&&(p.search.onboarding===`site-health`||p.search.onboarding===`first-run`||p.search.onboarding===`complete`),[ve,ye]=(0,K.useState)(ge);(0,K.useEffect)(()=>{R?ge&&ye(!0):ye(!1)},[ge,R]);let be=R&&(_e||ge||ve||R&&he===null),z=be?`app-shell-focus`:k?`app-shell-sidebar-hidden`:``,xe=x?(he?jo(he,x):void 0)??(F?Wo(F,he?.projects.find(e=>e.project.id===F.projectId)?.project.displayName??he?.projects.find(e=>e.project.id===F.projectId)?.project.name??`Unknown project`):void 0):void 0,Ce=(0,K.useMemo)(()=>Do(p.pathname,he),[p.pathname,he]),{commandCenter:we,evidenceLoading:Te,evidenceError:B,isError:Ee,refetch:ke}=ys(C?Ce:null,{evidence:!0}),Ae=(0,K.useMemo)(()=>{if(C)return No(we,he,C)},[C,we,he]),je=(()=>{let e=p.pathname;if(e===`/`)return`All projects`;if(e===`/projects`)return`Projects`;if(e===`/runs`)return`Runs`;if(e===`/history`)return`History`;if(e===`/settings`)return`Settings`;if(e===`/setup`)return`Setup`;if(e===`/agent-setup`)return`Agent setup`;if(e===`/backlinks`)return`Backlink data`;if(e===`/traffic`||e.startsWith(`/traffic/`))return`Traffic sources`;if(e.startsWith(`/projects/`)){let e=he?.projects.find(e=>e.project.name===Ce);return e?.project.displayName||e?.project.name||Ce||`Projects`}return`Not found`})();if(r){let e=Hr(r.projectTabs),t=!r.views||r.views.includes(Yr(p.pathname));return(0,q.jsxs)(`div`,{className:`app-shell app-shell-embed`,"data-theme":di(r.theme),style:fi(r.theme),children:[(0,q.jsx)(`a`,{className:`skip-link`,href:`#content`,children:`Skip to content`}),(0,q.jsx)(`main`,{id:`content`,className:`page-shell`,children:e?(0,q.jsx)(`div`,{className:`embed-view-unavailable`,role:`status`,children:`This embed uses the retired Report tab. Update its allowed tabs to show AI Visibility.`}):t?(0,q.jsx)(Oe,{}):(0,q.jsx)(`div`,{className:`embed-view-unavailable`,role:`status`,children:`This view is not available in embed mode.`})})]})}let Me=(0,q.jsxs)(`footer`,{className:`footer`,children:[(0,q.jsxs)(`span`,{className:`footer-brand`,children:[(0,q.jsx)(`span`,{children:(0,q.jsx)(`a`,{href:`https://canonry.ai`,children:`Canonry`})}),b.apiStatus.version&&b.apiStatus.version!==`unknown`?(0,q.jsxs)(`span`,{className:`footer-version`,children:[`v`,b.apiStatus.version]}):null]}),a?(0,q.jsx)(`div`,{className:`footer-links`,children:bl.map(({label:e,href:t,Icon:n})=>(0,q.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,title:e,"aria-label":e,className:`footer-icon`,children:(0,q.jsx)(n,{className:`size-3.5`})},t))}):null]});return(0,q.jsxs)(pe,{open:E,onOpenChange:D,children:[(0,q.jsx)(`a`,{className:`skip-link`,href:`#content`,children:`Skip to content`}),(0,q.jsx)(Ms,{}),(0,q.jsxs)(`div`,{className:`app-shell ${z}${Et()?` app-shell-demo`:``}`,children:[!be&&!k&&(0,q.jsxs)(`aside`,{id:`desktop-sidebar`,className:`sidebar`,"aria-label":`Primary navigation`,children:[(0,q.jsx)(`div`,{className:`sidebar-brand`,children:(0,q.jsx)(Ki,{version:b.apiStatus.version,updateAvailable:ie?re:null,onDismissUpdate:P})}),(0,q.jsxs)(`nav`,{className:`sidebar-nav`,children:[(0,q.jsxs)(V,{to:`/`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!0},children:[(0,q.jsx)(l,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`All projects`})]}),(0,q.jsxs)(V,{to:`/projects`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!1},children:[(0,q.jsx)(u,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`Projects`})]}),(0,q.jsxs)(V,{to:`/runs`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!0},children:[(0,q.jsx)(i,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`Runs`})]}),(0,q.jsxs)(V,{to:`/history`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!0},children:[(0,q.jsx)(S,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`History`})]}),(0,q.jsxs)(V,{to:`/traffic`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!1},children:[(0,q.jsx)(se,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`Traffic sources`})]}),!Et()&&(0,q.jsxs)(V,{to:`/backlinks`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!0},children:[(0,q.jsx)(s,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`Backlink data`})]}),!Et()&&(0,q.jsxs)(V,{to:`/agent-setup`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!0},children:[(0,q.jsx)(w,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`Agent setup`})]}),t&&(0,q.jsxs)(V,{to:`/settings`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!0},children:[(0,q.jsx)(ne,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`Settings`})]}),v?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`sidebar-section-title`,children:`Tracked projects`}),[1,2,3].map(e=>(0,q.jsxs)(`div`,{className:`sidebar-skeleton-item`,children:[(0,q.jsx)(`span`,{className:`skeleton-circle size-2`}),(0,q.jsx)(`span`,{className:`skeleton-text flex-1`,style:{width:`${50+e*15}%`}})]},e))]}):he&&he.projects.length>0?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`sidebar-section-title`,children:`Tracked projects`}),he.projects.map(e=>{let t=e.visibilitySummary.tone;return(0,q.jsxs)(V,{to:`/projects/$projectName`,params:{projectName:e.project.name},className:`sidebar-project`,activeProps:{className:`sidebar-project sidebar-project-active`},children:[(0,q.jsx)(`span`,{className:`sidebar-dot sidebar-dot-${t}`}),(0,q.jsx)(`span`,{children:e.project.displayName||e.project.name})]},e.project.id)})]}):v?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`sidebar-section-title`,children:`Resources`}),t&&(0,q.jsxs)(V,{to:`/setup`,className:`sidebar-link`,activeProps:{className:`sidebar-link sidebar-link-active`},activeOptions:{exact:!0},children:[(0,q.jsx)(oe,{className:`sidebar-icon`}),(0,q.jsx)(`span`,{children:`Setup`})]})]})]}),e&&(0,q.jsxs)(`div`,{className:`sidebar-account`,children:[(0,q.jsxs)(`div`,{className:`sidebar-account-identity`,children:[(0,q.jsx)(`span`,{className:`sidebar-account-name`,children:e.name}),e.role===`viewer`?(0,q.jsx)(`span`,{className:`sidebar-account-role`,children:Kt()}):null]}),(0,q.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:er(async()=>{await On(),window.location.reload()}),children:`Sign out`})]}),Me]}),(0,q.jsxs)(`div`,{className:`main-area ${d&&Ce?`main-area-agent-bar`:``}`.trim(),children:[(0,q.jsxs)(`header`,{className:`topbar`,children:[(0,q.jsxs)(`div`,{className:`topbar-left`,children:[!be&&(0,q.jsx)(G,{className:`sidebar-privacy-toggle`,variant:`ghost`,size:`icon`,type:`button`,"aria-label":k?`Show sidebar`:`Hide sidebar`,"aria-controls":k?void 0:`desktop-sidebar`,"aria-expanded":!k,title:k?`Show sidebar`:`Hide sidebar`,onClick:ae,children:k?(0,q.jsx)(_,{className:`size-4`}):(0,q.jsx)(o,{className:`size-4`})}),(0,q.jsx)(`div`,{className:`topbar-brand-mobile`,children:(0,q.jsx)(Ki,{compact:!0})}),(0,q.jsxs)(`nav`,{className:`breadcrumb`,"aria-label":`Breadcrumb`,children:[(0,q.jsx)(V,{to:`/`,children:`Home`}),(0,q.jsx)(M,{className:`breadcrumb-sep size-3`}),(0,q.jsx)(`span`,{className:`breadcrumb-current`,children:je})]})]}),(0,q.jsxs)(`div`,{className:`topbar-actions`,children:[(0,q.jsx)(eo,{}),(0,q.jsx)(Fs,{}),(0,q.jsxs)(`div`,{className:`health-pill-row`,children:[(0,q.jsxs)(`span`,{className:`health-pill health-pill-${b.apiStatus.state}`,title:bi(b.apiStatus),children:[`API `,b.apiStatus.state===`ok`?`ok`:b.apiStatus.state]}),(0,q.jsx)(`span`,{className:`health-pill health-pill-${b.workerStatus.state}`,title:bi(b.workerStatus),children:`Worker ${b.workerStatus.state===`ok`?`ok`:b.workerStatus.state}`})]}),be?null:(0,q.jsx)(ue,{asChild:!0,children:(0,q.jsxs)(G,{className:`nav-toggle`,variant:`secondary`,size:`icon`,type:`button`,children:[(0,q.jsx)(O,{className:`size-4`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Open navigation`})]})})]})]}),be?null:(0,q.jsxs)(fe,{children:[(0,q.jsx)(le,{className:`fixed inset-0 z-40`}),(0,q.jsxs)(I,{className:`mobile-nav mobile-nav-open`,"aria-describedby":void 0,children:[(0,q.jsx)(L,{className:`sr-only`,children:`Navigation`}),(0,q.jsx)(de,{asChild:!0,children:(0,q.jsxs)(G,{className:`mobile-nav-close`,variant:`ghost`,size:`icon`,type:`button`,children:[(0,q.jsx)(N,{className:`size-5`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Close navigation`})]})}),(0,q.jsx)(V,{to:`/`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!0},children:`All projects`}),(0,q.jsx)(V,{to:`/projects`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!1},children:`Projects`}),(0,q.jsx)(V,{to:`/runs`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!0},children:`Runs`}),(0,q.jsx)(V,{to:`/history`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!0},children:`History`}),(0,q.jsx)(V,{to:`/traffic`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!1},children:`Traffic sources`}),!Et()&&(0,q.jsx)(V,{to:`/backlinks`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!0},children:`Backlink data`}),!Et()&&(0,q.jsx)(V,{to:`/agent-setup`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!0},children:`Agent setup`}),t&&(0,q.jsx)(V,{to:`/settings`,className:`mobile-nav-link`,activeProps:{className:`mobile-nav-link mobile-nav-link-active`},activeOptions:{exact:!0},children:`Settings`}),he&&he.projects.length>0?(0,q.jsxs)(`div`,{className:`mobile-nav-section`,children:[(0,q.jsx)(`p`,{className:`mobile-nav-section-title`,children:`Tracked projects`}),he.projects.map(e=>(0,q.jsx)(V,{to:`/projects/$projectName`,params:{projectName:e.project.name},className:`mobile-nav-link`,children:e.project.name},e.project.id))]}):null,e&&(0,q.jsxs)(`div`,{className:`mobile-nav-section`,children:[(0,q.jsx)(`p`,{className:`mobile-nav-section-title`,children:`Signed in`}),(0,q.jsxs)(`div`,{className:`sidebar-account`,children:[(0,q.jsxs)(`div`,{className:`sidebar-account-identity`,children:[(0,q.jsx)(`span`,{className:`sidebar-account-name`,children:e.name}),e.role===`viewer`?(0,q.jsx)(`span`,{className:`sidebar-account-role`,children:Kt()}):null]}),(0,q.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`mobile-sign-out`,onClick:er(async()=>{await On(),window.location.reload()}),children:`Sign out`})]})]}),Me]})]}),(0,q.jsx)(`main`,{id:`content`,className:`page-shell`,children:v&&!n?(0,q.jsxs)(`div`,{className:`page-skeleton`,children:[(0,q.jsxs)(`div`,{className:`page-skeleton-header`,children:[(0,q.jsx)(`div`,{className:`skeleton-text h-6 w-40`}),(0,q.jsx)(`div`,{className:`skeleton-text-sm w-72`})]}),(0,q.jsx)(`div`,{className:`page-skeleton-grid`,children:[1,2,3].map(e=>(0,q.jsxs)(`div`,{className:`page-skeleton-card`,children:[(0,q.jsx)(`div`,{className:`skeleton-text w-24`}),(0,q.jsx)(`div`,{className:`skeleton-text w-full`}),(0,q.jsx)(`div`,{className:`skeleton-text-sm w-3/4`})]},e))}),(0,q.jsx)(`div`,{className:`page-skeleton-grid`,style:{gridTemplateColumns:`1fr 1fr`},children:[1,2].map(e=>(0,q.jsxs)(`div`,{className:`page-skeleton-card`,children:[(0,q.jsx)(`div`,{className:`skeleton-text w-20`}),(0,q.jsx)(`div`,{className:`space-y-2`,children:[1,2,3].map(e=>(0,q.jsx)(`div`,{className:`skeleton-text-sm w-full`},e))})]},e))})]}):(0,q.jsx)(Oe,{})})]}),x&&!xe&&me?(0,q.jsx)(po,{open:!0,title:`Loading run details`,subtitle:`Fetching the durable run record`,onClose:T,children:(0,q.jsx)(`p`,{className:`text-copy-14 text-muted`,role:`status`,children:`Loading run details…`})}):null,x&&!xe&&ce.isError?(0,q.jsx)(po,{open:!0,title:`Run unavailable`,subtitle:`The run could not be loaded`,onClose:T,children:(0,q.jsx)(`p`,{className:`text-copy-14 text-negative`,children:ce.error instanceof Error?ce.error.message:`Run details are unavailable.`})}):null,xe?(0,q.jsxs)(po,{open:!0,title:xe.summary,subtitle:`${xe.projectName} \u00b7 ${xe.kindLabel}`,onClose:T,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-5 gap-y-1 text-label-14`,children:[(0,q.jsx)(to,{status:xe.status}),(0,q.jsx)(`span`,{className:`text-secondary`,children:xe.startedAt}),(0,q.jsx)(`span`,{className:`text-muted`,children:xe.duration}),(0,q.jsx)(`span`,{className:`text-faint`,children:xe.triggerLabel})]}),xe.status===`failed`&&xe.statusDetail&&(0,q.jsx)(`p`,{className:`mt-2 text-copy-14 text-negative`,children:xe.statusDetail}),(0,q.jsxs)(`div`,{className:`mt-4`,children:[(0,q.jsx)(`p`,{className:`text-label-12-strong normal-case text-muted mb-2`,children:`Activity Log`}),me?(0,q.jsx)(`p`,{className:`text-copy-14 text-muted`,children:`Loading run details...`}):F?.snapshots&&F.snapshots.length>0?(0,q.jsxs)(`div`,{className:`space-y-2`,children:[F.snapshots.map(e=>(0,q.jsxs)(`div`,{className:`material-base p-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,q.jsx)(`p`,{className:`text-copy-14-strong text-strong truncate`,children:e.query??`Unknown query`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(Ga,{provider:e.provider}),(0,q.jsx)(pn,{variant:e.citationState===Ct.cited?`success`:`neutral`,children:e.citationState})]})]}),e.model&&(0,q.jsx)(`p`,{className:`text-copy-13-mono text-muted`,children:e.model}),e.citedDomains.length>0&&(0,q.jsxs)(`p`,{className:`text-copy-13 text-muted mt-1`,children:[(0,q.jsx)(`span`,{className:`text-secondary`,children:`Sources:`}),` `,e.citedDomains.join(`, `)]}),e.citedCompetitorDomains.length>0&&(0,q.jsxs)(`p`,{className:`text-copy-13 text-negative-400/80 mt-0.5`,children:[`Competitor cited: `,e.citedCompetitorDomains.join(`, `)]}),e.mentionedCompetitorDomains.length>0&&(0,q.jsxs)(`p`,{className:`text-copy-13 text-negative-400/80 mt-0.5`,children:[`Competitor mentioned: `,e.mentionedCompetitorDomains.join(`, `)]}),e.groundingSources&&e.groundingSources.length>0&&(0,q.jsxs)(`details`,{className:`mt-2`,children:[(0,q.jsxs)(`summary`,{className:`text-label-12 text-muted cursor-pointer hover:text-secondary`,children:[e.groundingSources.length,` grounding source`,e.groundingSources.length===1?``:`s`]}),(0,q.jsx)(`ul`,{className:`mt-2 space-y-3`,children:e.groundingSources.map((e,t)=>(0,q.jsx)(`li`,{className:`min-w-0`,children:(0,q.jsx)(go,{url:e.uri,title:e.title})},t))})]}),e.answerText&&(0,q.jsxs)(`details`,{className:`mt-1`,children:[(0,q.jsx)(`summary`,{className:`text-label-12 text-muted cursor-pointer hover:text-secondary`,children:`Answer preview`}),(0,q.jsx)(`p`,{className:`mt-1 text-copy-13 text-secondary whitespace-pre-wrap`,children:e.answerText})]})]},e.id)),F.status===`running`&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2 p-3 text-label-14 text-muted`,children:[(0,q.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-caution-500 animate-pulse`}),`Running remaining queries...`]})]}):F&&F.status===H.running?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 p-3 text-label-14 text-muted`,children:[(0,q.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-caution-500 animate-pulse`}),F.kind===U[`answer-visibility`]?`Waiting for first query result...`:`Run is in progress...`]}):F&&F.status===H.queued?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 p-3 text-label-14 text-muted`,children:[(0,q.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-mono-500 animate-pulse`}),`Run queued, waiting for execution slot...`]}):F&&F.error?(0,q.jsxs)(`div`,{className:`rounded-md border border-negative-800/40 bg-negative-950/20 p-3`,children:[(0,q.jsx)(`p`,{className:`text-copy-14-strong text-negative mb-2`,children:`Run failed`}),(0,q.jsx)(`pre`,{className:`max-h-48 overflow-y-auto whitespace-pre-wrap break-words text-copy-13-mono text-negative`,children:qn(F.error)})]}):xe.kind===U[`answer-visibility`]?(0,q.jsx)(`p`,{className:`text-copy-14 text-muted`,children:`No snapshot data available.`}):(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:xe.status===H.completed?`Run completed.`:xe.status===H.partial?`Run completed with partial results.`:xe.status===H.cancelled?`Run cancelled.`:xe.status===H.failed?`Run failed.`:`No run details available.`})]})]}):null,C&&!Ae?(0,q.jsx)(po,{open:!0,title:Te?`Loading answer`:`Answer unavailable`,subtitle:`Query evidence`,onClose:T,children:Te?(0,q.jsx)(`p`,{role:`status`,className:`text-copy-14 text-secondary`,children:`Loading answer…`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{role:`alert`,className:`text-copy-14 text-secondary`,children:B||Ee?`Could not load this answer.`:`This answer is not in the available query evidence.`}),(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:()=>{ke()},children:`Retry`})]})}):null,Ae?(0,q.jsx)(wo,{evidence:Ae.evidence,project:Ae.project,onClose:T}):null,(0,q.jsx)(kl,{}),(0,q.jsx)(Ds,{}),d?(0,q.jsx)(vl,{}):null]})]})}var jl=class extends K.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[ErrorBoundary]`,e,t.componentStack),Ve({kind:`render`,error:e,component:this.props.name??`root`})}handleReset=()=>{this.setState({error:null})};render(){return this.state.error?(0,q.jsx)(`div`,{className:`page-container`,children:(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-4 py-20 text-center`,children:[(0,q.jsx)(`div`,{className:`rounded-full bg-negative-950/40 p-3`,children:(0,q.jsx)(te,{className:`size-6 text-negative-400`})}),(0,q.jsx)(`h2`,{className:`text-heading-20 text-heading`,children:`Something went wrong`}),(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary max-w-md`,children:this.state.error.message||`An unexpected error occurred while rendering this page.`}),(0,q.jsxs)(`div`,{className:`flex gap-3 mt-2`,children:[(0,q.jsxs)(G,{variant:`secondary`,size:`sm`,onClick:this.handleReset,children:[(0,q.jsx)(E,{className:`size-3.5 mr-1.5`}),`Try again`]}),(0,q.jsx)(G,{variant:`secondary`,size:`sm`,onClick:()=>{let e=window.__CANONRY_CONFIG__?.basePath?.replace(/\/$/,``)??``;window.location.href=e||`/`},children:`Go home`})]})]})}):this.props.children}};function Ml({disabled:e,title:t,...n}){let{canWrite:r}=Qn();return r?(0,q.jsx)(G,{disabled:e,title:t,...n}):(0,q.jsx)(G,{...n,disabled:!0,title:Zn})}function Nl({title:e,children:t}){let{isAdmin:n}=Qn();return n?(0,q.jsx)(q.Fragment,{children:t}):(0,q.jsxs)(Pr,{className:`surface-card mx-auto mt-8 max-w-lg`,children:[(0,q.jsxs)(jr,{children:[(0,q.jsxs)(Ar,{children:[e,` is for administrators`]}),(0,q.jsx)(Nr,{children:`Your account has view-only access. You can read everything this install has measured; changing how it is set up needs an administrator account.`})]}),(0,q.jsx)(Mr,{children:(0,q.jsx)(`p`,{className:`supporting-copy`,children:`If you need to make a change here, ask an administrator on this install.`})})]})}var Pl=`Sources`,Fl={copy:`Copy answer`,copying:`Copying…`,copied:`Copied`,failed:`Could not copy. Select and copy the answer above.`};function Il({previewLength:e,highlight:t}){return n=>{if(e!==void 0&&Number.isFinite(e)){let t=Math.max(0,Math.floor(e)),r={field:`value`,omitted:!1},i=e=>{if(e.type===`definition`)return!0;if(e.children)return e.children=e.children.filter(i),e.children.length>0;let n=e.type===`image`||e.type===`imageReference`?`alt`:`value`,a=e[n];if(a===void 0)return t>0;let o=Array.from(a);if(o.length===0)return t>0;if(t===0)return r.omitted=!0,!1;let s=o.length>t,c=o.slice(0,t);if(s&&!/\s/.test(o[t])){let e=c.length-1;for(;e>=0&&!/\s/.test(c[e]);)e--;e>=0&&e>t-40&&(c.length=e)}return r.omitted||=s,e[n]=c.join(``),t=s?0:t-c.length,c.length!==0&&(r.lastNode=e,r.field=n,!0)};i(n),r.omitted&&(r.lastNode?r.lastNode[r.field]=`${r.lastNode[r.field].trimEnd()}…`:n.children?.push({type:`paragraph`,children:[{type:`text`,value:`…`}]}))}if(t){let e=t=>{[`link`,`linkReference`,`code`,`inlineCode`].includes(t.type)||(t.type===`text`&&(t.data={...t.data,hName:`span`}),t.children?.forEach(e))};e(n)}}}function Ll({headingLevel:e}){return t=>{let n=[],r=e=>{e.type===`heading`&&e.depth&&n.push(e),e.children?.forEach(r)};r(t);let i=n.reduce((e,t)=>Math.min(e,t.depth),6);for(let t of n){let n=t.depth-i;t.depth=Math.min(6,e+n),t.data={...t.data,hProperties:{...t.data?.hProperties,"data-answer-heading-level":n+1}}}}}function Rl({answer:e}){let[t,n]=(0,K.useState)(`idle`),r=(0,K.useRef)(!1),i=async()=>{if(!r.current){r.current=!0,n(`copying`);try{await navigator.clipboard.writeText(e),n(`copied`)}catch{n(`failed`)}finally{r.current=!1}}};return(0,q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3`,children:[(0,q.jsx)(G,{type:`button`,variant:`ghost`,className:`pointer-coarse:min-h-11 px-2`,"aria-disabled":t===`copying`,"aria-busy":t===`copying`,onClick:()=>{i()},children:t===`copying`?Fl.copying:Fl.copy}),(0,q.jsx)(`span`,{role:`status`,className:`text-label-14 text-secondary`,children:t===`copied`?Fl.copied:t===`failed`?Fl.failed:``})]})}var zl=(0,K.memo)(function({children:e,headingLevel:t=4,copyable:n=!1,highlightGroups:r,previewLength:i}){return(0,q.jsxs)(`div`,{className:`answer-markdown`,children:[(0,q.jsx)(he,{remarkPlugins:[[Ll,{headingLevel:t}],[Il,{previewLength:i,highlight:!!r?.length}]],components:{p:({children:e})=>(0,q.jsx)(`p`,{className:`mb-3 whitespace-pre-wrap last:mb-0`,children:e}),ul:({children:e})=>(0,q.jsx)(`ul`,{className:`mb-3 ml-5 list-disc space-y-1`,children:e}),ol:({children:e,start:t})=>(0,q.jsx)(`ol`,{start:t,className:`mb-3 ml-5 list-decimal space-y-1`,children:e}),pre:({children:e})=>(0,q.jsx)(`pre`,{className:`mb-3 overflow-x-auto whitespace-pre-wrap`,children:e}),span:({children:e})=>(0,q.jsx)(`span`,{children:typeof e==`string`&&r?e.split(/(https?:\/\/[^\s<>]+)/i).map((e,t)=>t%2?e:(0,q.jsx)(K.Fragment,{children:bo(e,r)},t)):e}),a:({children:e,href:t})=>{let n=ho(t);return n?(0,q.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`text-link underline`,children:e}):(0,q.jsx)(`span`,{children:e})},img:({alt:e})=>(0,q.jsx)(`span`,{children:e})},children:e}),n&&e.trim()?(0,q.jsx)(Rl,{answer:e},e):null]})});function Bl(e,t,n){return{mode:t,scope:e.measurementScope,scopeKey:e.measurementScopeKey,marketKey:e.marketKey,queryClass:e.queryClass===`non-brand`?`non-brand`:`branded`,provider:e.provider,model:e.model,location:e.location,runId:e.measurementRunId,revision:e.revision,evaluationDefinitionId:n}}function Vl(e,t,n){let r=[...new Set(t.filter(e=>!n||e.provider===n).map(e=>e.sourceRunId).filter(e=>!!e))].sort();return{...e,mode:`simple`,scope:`project`,scopeKey:void 0,marketKey:void 0,provider:n||void 0,model:void 0,revision:void 0,runId:r.length===1?r[0]:void 0,runIds:r.length>1?r:void 0}}function Hl(e,t,n,r){return[`sentiment`,e,t,n??null,r??null]}var Ul=5e3,Wl=new Set([`pending`,`running`,`waiting-to-retry`]);function Gl(e){return Wl.has(e.state)}function Kl(e){let t=e?.coverage.counts;return!!(t&&t.pending+t.running+t[`waiting-to-retry`]>0)}function ql(e,t){return Kl(e)||t?Ul:!1}function Jl(e,t,n=!0){let r=z({queryKey:Hl(e,`settings`),queryFn:()=>Me(e),retry:!1,staleTime:0,refetchOnWindowFocus:`always`}),i=z({queryKey:Hl(e,`jobs`),queryFn:()=>mt(e),enabled:!!r.data?.actions.configure,retry:!1,refetchOnWindowFocus:`always`,refetchInterval:e=>e.state.data?.jobs.some(Gl)?Ul:!1}),a=!!i.data?.jobs.some(Gl),o=i=>{let o={...t,queryClass:i};return{queryKey:Hl(e,`summary`,o),queryFn:()=>It(e,o),enabled:n&&!!(r.data?.enabled&&r.data.installEnabled),retry:!1,staleTime:0,refetchOnWindowFocus:`always`,refetchInterval:e=>ql(e.state.data,a)}};return{settings:r,branded:z(o(`branded`)),nonBrand:z(o(`non-brand`)),jobs:i}}var Yl={branded:`Branded`,"non-brand":`Non-brand`};function Xl(e){return e>=10}var Z={states:{disabled:`Sentiment is off.`,"not-measured":`No ratings yet.`,processing:`Analyzing sentiment…`,canceled:`Analysis canceled.`,partial:`Partial results.`,failed:`Analysis failed.`,complete:`Analysis complete.`,unsupported:`Sentiment unavailable.`},noJudgments:`No ratings available.`,tooFew:`too few`,minRated:`Shown from 10 ratings`,partial:`Partial results`,columns:{favorable:`Favorable`,rated:`With opinion`},title:`Sentiment`,subtitle:`How AI answers describe you in queries that name you`,rated:`Share of answers that give an opinion (favorable, mixed or unfavorable) about who they name`,noAnswers:`No answers yet`,ratedUnavailable:`Unavailable`,details:{ratedAnswers:`Answers with an opinion`,unadmitted:`Checks not yet analyzed`,checksCaption:`Not counted in the favorable share:`,interval:`Likely range (95%)`},nonBrand:{label:`Non-brand queries`,none:`No unfavorable or mixed answers in non-brand queries.`,noneSoFar:`No unfavorable or mixed answers in non-brand queries so far.`,notRated:`Non-brand answers are not rated yet.`,view:`View answers`,evidence:`Non-brand queries, unfavorable and mixed`,rowNone:`No unfavorable or mixed answers`,rowLabel:`Unfavorable or mixed`,help:`A non-brand answer almost always names you to recommend you, so its favorable share is near 100% and says little. Sentiment is measured on branded queries; unfavorable or mixed answers to non-brand queries are listed here when they happen.`},properties:{title:`Most criticized properties`,evidence:`unfavorable and mixed`,viewAll:`View all unfavorable and mixed answers`,allEvidence:`Branded queries, unfavorable and mixed`},overall:`Favorable share of ratings in answers to branded queries. Each saved answer-subject assessment counts once. Answers with no opinion, or where it is unclear who they name, are left out.`,favorable:`The favorable share of favorable, mixed and unfavorable ratings in answers to branded queries. Each rating covers one subject named in an answer; answers with no opinion are left out.`},Zl=`—`,Ql={factual:`Named, no opinion`,"subject-not-mentioned":`Not named in the answer`,"wrong-subject":`Named someone else`,"ambiguous-subject":`Unclear which one was meant`,"ambiguous-judgment":`Opinion unclear`,"subject-not-applicable":`Not applicable`,"unsupported-language":`Not in English`,"missing-source-text":`No answer text`,"input-too-large":`Answer too long to rate`,"invalid-conclusion-evidence":`Rating set aside`,pending:`Waiting to be rated`,running:`Being rated`,"waiting-to-retry":`Retrying`};function $l(e){return Ql[e]??e.replaceAll(`-`,` `).replace(/^./,e=>e.toUpperCase())}var eu=[`favorable`,`mixed`,`unfavorable`];function tu(e){return e===`favorable`?`positive`:e===`unfavorable`?`negative`:e===`mixed`?`caution`:`neutral`}var nu=[`mixed`,`unfavorable`];function ru(e){return e.interval?`${wn(e.interval.low,Ot.fraction)} to ${wn(e.interval.high,Ot.fraction)}`:null}var iu={favorable:`progress-fill-info`,mixed:`progress-fill-caution`,unfavorable:`progress-fill-negative`};function au(e){return`${e} ${e===1?`rating`:`ratings`}`}function ou(e){return e.score.favorableRate!==null&&e.coverage.judged>0}function su(e){return e.state===`complete`&&!e.provisional&&e.coverage.unadmittedAssessments===0}function cu(e){return e.state===`complete`?Z.partial:Z.states[e.state]}function lu(e){return e?ou(e)&&Xl(e.coverage.judged):!1}function uu({value:e,label:t}){let{counts:n,judged:r}=e.coverage;if(!ou(e))return(0,q.jsx)(`div`,{className:`sentiment-bar sentiment-bar-track`,"data-sentiment-bar":`empty`,"aria-hidden":`true`});let i=eu.map(e=>`${n[e]} ${e}`).join(`, `);return lu(e)?(0,q.jsx)(`div`,{role:`img`,"aria-label":`${t}: ${i}, ${e.score.favorableDisplay} favorable of ${au(r)}`,className:`sentiment-bar`,"data-sentiment-bar":`rated`,children:eu.filter(e=>n[e]>0).map(e=>(0,q.jsx)(`span`,{"data-outcome":e,className:`sentiment-bar-segment ${iu[e]}`,style:{flexGrow:n[e]},title:`${$l(e)}: ${n[e]} of ${au(r)}`},e))}):(0,q.jsx)(`div`,{role:`img`,"aria-label":`${t}: ${i}, ${au(r)}, favorable share ${Z.minRated.toLowerCase()}`,className:`sentiment-bar sentiment-bar-track`,"data-sentiment-bar":`too-few`})}function du({value:e,label:t}){let{counts:n,judged:r}=e.coverage;return(0,q.jsx)(`div`,{role:`img`,"aria-label":`${t}: ${eu.map(e=>`${n[e]} ${e}`).join(`, `)}, ${au(r)}`,className:`sentiment-property-bar`,children:eu.filter(e=>n[e]>0).map(e=>(0,q.jsx)(`span`,{"data-outcome":e,className:`sentiment-bar-segment ${iu[e]}`,style:{flexGrow:n[e]}},e))})}function fu(e){let t=new Map(e.breakdowns.filter(e=>e.dimension===`property`).map(e=>[e.key,e]));return(e.criticizedProperties?.keys??[]).flatMap(e=>t.get(e)??[])}function pu({value:e,label:t}){return(0,q.jsx)(`div`,{role:`group`,"aria-label":`${t} favorable share`,className:`sentiment-class-favorable`,children:lu(e)?(0,q.jsx)(`span`,{className:`sentiment-class-share`,children:e.score.favorableDisplay}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`sentiment-class-empty`,title:Z.minRated,children:Zl}),(0,q.jsx)(`span`,{className:`sr-only`,children:Z.minRated})]})})}function mu({ratedAnswers:e=0,eligibleAnswers:t=0}){return`${e} of ${t} ${t===1?`answer`:`answers`} rated`}function hu(e){let{eligibleAnswers:t}=e;return t===void 0?{display:Zl,detail:Z.ratedUnavailable,empty:!0}:t<=0?{display:Zl,detail:Z.noAnswers,empty:!0}:e.ratedAnswerRate===null||e.ratedAnswerRate===void 0?{display:Zl,detail:Z.states.disabled,empty:!0}:{display:wn(e.ratedAnswerRate,Ot.fraction),detail:mu(e),empty:!1}}function gu({coverage:e,label:t}){let{display:n,detail:r,empty:i}=hu(e);return(0,q.jsxs)(`div`,{role:`group`,"aria-label":`${t} share rated`,className:`sentiment-class-ratings`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:i?`sentiment-class-empty`:void 0,title:r,children:n}),(0,q.jsx)(`span`,{className:`sr-only`,children:i?r:`${n}, ${r}`})]})}function _u({value:e}){return ou(e)?e.provisional?(0,q.jsx)(`p`,{className:`sentiment-class-note text-caution`,children:Z.partial}):null:(0,q.jsx)(`p`,{className:`sentiment-class-note`,children:e.state===`complete`?Z.noJudgments:Z.states[e.state]})}function vu(e){return!!(e.coverage.selected||e.coverage.eligibleAssessments||e.reason)}function yu({value:e,queryClass:t,open:n,setOpenClass:r}){let i=(0,K.useContext)(Su),a=(0,K.useId)(),o=(0,K.useId)(),s=(0,K.useId)(),c=(0,K.useRef)(null),l=(0,K.useRef)(null),u=(0,K.useCallback)(()=>r(e=>e===t?null:e),[r,t]);(0,K.useEffect)(()=>{if(!n)return;let e=e=>e instanceof Node&&!!(c.current?.contains(e)||l.current?.contains(e)),t=t=>{e(t.target)||u()},r=t=>{e(t.target)||u()},i=e=>{e.key===`Escape`&&(u(),c.current?.focus())};return document.addEventListener(`pointerdown`,t),document.addEventListener(`focusin`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`pointerdown`,t),document.removeEventListener(`focusin`,r),document.removeEventListener(`keydown`,i)}},[n,u]);let{coverage:d,score:f}=e,p=ru(f),m=d.judged>0&&!Xl(d.judged),h=t===`branded`?fu(e):[];return vu(e)?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{ref:c,type:`button`,className:`sentiment-class-details-toggle`,"aria-label":`${Yl[t]} details`,"aria-expanded":n,"aria-controls":a,onClick:()=>r(e=>e===t?null:t),children:(0,q.jsx)(b,{className:`sentiment-class-details-chevron`,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{ref:l,id:a,role:`group`,"aria-labelledby":o,className:`sentiment-class-details`,hidden:!n,children:[(0,q.jsx)(`p`,{id:o,className:`sentiment-class-details-title`,children:Yl[t]}),(0,q.jsxs)(`dl`,{className:`sentiment-details-list`,children:[(d.eligibleAnswers??0)>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:Z.details.ratedAnswers}),(0,q.jsxs)(`dd`,{children:[d.ratedAnswers??0,` of `,d.eligibleAnswers]})]}),m&&eu.filter(e=>d.counts[e]>0).map(e=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:$l(e)}),(0,q.jsx)(`dd`,{children:d.counts[e]})]},e)),m&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Favorable share`}),(0,q.jsx)(`dd`,{children:Z.minRated})]}),p&&(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`dt`,{children:[Z.details.interval,` `,(0,q.jsx)(kr,{text:f.limitation,placement:`bottom`})]}),(0,q.jsx)(`dd`,{children:p})]})]}),i&&h.length>0&&(0,q.jsxs)(`div`,{className:`sentiment-details-properties`,role:`group`,"aria-labelledby":s,children:[(0,q.jsxs)(`p`,{id:s,className:`sentiment-details-subtitle`,children:[Z.properties.title,e.criticizedProperties&&e.criticizedProperties.total>h.length?(0,q.jsxs)(`span`,{className:`sentiment-details-subtitle-count`,children:[` · `,h.length,` of `,e.criticizedProperties.total]}):null]}),(0,q.jsx)(`ul`,{children:h.map(n=>(0,q.jsxs)(`li`,{className:`sentiment-property`,children:[(0,q.jsx)(`button`,{type:`button`,className:`sentiment-property-name`,"aria-label":`View ${Z.properties.evidence} answers for ${n.label}`,onClick:()=>{if(!c.current)return;let r=Cu(i,e);i.openEvidence({...r,queryClass:t,scope:`property`,scopeKey:n.key,marketKey:r.scope===`market`?r.scopeKey:r.marketKey,outcome:nu},`${n.label}, ${Z.properties.evidence}`,c.current)},children:n.label}),(0,q.jsxs)(`span`,{className:`sentiment-property-count`,children:[n.coverage.counts.favorable,` of `,n.coverage.judged,` favorable`]}),(0,q.jsx)(du,{value:n,label:n.label})]},n.key))}),(0,q.jsx)(`button`,{type:`button`,className:`sentiment-property-name sentiment-details-view-all`,onClick:()=>{c.current&&i.openEvidence({...Cu(i,e),queryClass:t,outcome:nu},Z.properties.allEvidence,c.current)},children:Z.properties.viewAll})]}),(d.unadmittedAssessments>0||Object.entries(d.counts).some(([e,t])=>t>0&&!eu.includes(e)))&&(0,q.jsx)(`p`,{className:`sentiment-details-caption`,children:Z.details.checksCaption}),(0,q.jsxs)(`dl`,{className:`sentiment-details-list`,children:[d.unadmittedAssessments>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:Z.details.unadmitted}),(0,q.jsx)(`dd`,{children:d.unadmittedAssessments})]}),Object.entries(d.counts).filter(([e,t])=>t>0&&![`favorable`,`mixed`,`unfavorable`].includes(e)).map(([e,t])=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:$l(e)}),(0,q.jsx)(`dd`,{children:t})]},e))]}),e.reason&&(0,q.jsx)(`p`,{className:`sentiment-class-details-reason`,children:e.reason})]})]}):null}function bu(e){return!!(e?.configured&&e.branded.coverage.judged>0&&e.branded.score.favorableRate!==null)&&!In()}function xu({value:e}){if(!bu(e))return null;let t=e.branded,n=t.coverage.judged,r=ru(t.score),i=`${Z.overall} ${n} of ${t.coverage.selected} judged${r?`, 95% interval ${r}`:``}. ${t.provisional?`Provisional. `:``}${Z.states[t.state]}${t.reason?` ${t.reason}`:``}`;return(0,q.jsx)(`div`,{className:`project-row-stat`,"data-sentiment-score":!0,children:(0,q.jsxs)(`div`,{className:`metric-inline-block`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`p`,{className:`metric-inline-label`,children:`Sentiment`}),(0,q.jsx)(`span`,{className:`relative z-10`,children:(0,q.jsx)(kr,{text:i,placement:`bottom`})})]}),Xl(n)?(0,q.jsxs)(`p`,{className:`metric-inline-value`,children:[t.score.favorableDisplay,(0,q.jsx)(`span`,{className:`sr-only`,children:` favorable judgments, branded queries`})]}):(0,q.jsxs)(`p`,{className:`metric-inline-value text-secondary`,children:[Z.tooFew,(0,q.jsxs)(`span`,{className:`sr-only`,children:[` ratings for a favorable share, `,n,` of `,10,` needed, branded queries`]})]}),(0,q.jsx)(`p`,{className:`metric-inline-caption`,"aria-hidden":`true`})]})})}var Su=(0,K.createContext)(null);function Cu(e,t){let{selection:n}=t;return{...e.selection,...n,runId:n.runId??void 0,runIds:n.runId?void 0:n.runIds,revision:n.revision??void 0,evaluationDefinitionId:n.evaluationDefinitionId??void 0}}function wu(){return(0,K.useContext)(Su)?.configured??!1}function Tu({projectName:e,selection:t,runOptions:n=[],waitForResolvedRun:r=!1,evidenceReady:i=!0,hasSourceEvidence:a=!0,children:o}){return(0,q.jsx)(Eu,{projectName:e,selection:t,runOptions:n,waitForResolvedRun:r,evidenceReady:i,hasSourceEvidence:a,children:o})}function Eu({projectName:e,selection:t,runOptions:n,waitForResolvedRun:r,evidenceReady:i,hasSourceEvidence:a,children:o}){let s=JSON.stringify([e,t]),[c,l]=(0,K.useState)(null),u=(0,K.useCallback)(e=>l(t=>t?.key===s&&t?.runId===e?.runId&&t?.revision===e?.revision?t:e?{...e,key:s}:null),[s]),d=i&&(!r||c?.key===s),f=r&&d&&c?{...t,runId:c.runId,revision:c.revision}:t,p=JSON.stringify([e,f]),{settings:m,branded:h,nonBrand:g,jobs:_}=Jl(e,f,d&&a),[v,y]=(0,K.useState)(!1),[b,x]=(0,K.useState)(null),S=(0,K.useRef)(null);(0,K.useEffect)(()=>{y(!1),x(null)},[p]);let C=d&&!!(m.data?.enabled&&m.data.installEnabled),w=(t.queryClass===`non-brand`?g.data:h.data)?.selection,T={...f,...w?{...w,runId:w.runId??void 0,runIds:w.runId?void 0:w.runIds,revision:w.revision??void 0,evaluationDefinitionId:w.evaluationDefinitionId??void 0}:{}},E=T.runId&&!n.some(e=>e.id===T.runId)?[{id:T.runId,label:`Displayed check`},...n]:n,D=e=>{e.preventDefault(),S.current?.focus()};return(0,q.jsxs)(Su.Provider,{value:{projectName:e,selection:f,resolveSource:u,settings:m,summaries:{branded:h,"non-brand":g},configured:C,hasSourceEvidence:a,openManage:e=>{S.current=e,y(!0)},openEvidence:(e,t,n)=>{S.current=n,x({selection:e,label:t})}},children:[o,(0,q.jsx)(no,{open:v&&!!m.data?.actions.configure,onOpenChange:y,children:(0,q.jsxs)(co,{onCloseAutoFocus:D,className:`overflow-y-auto`,children:[(0,q.jsxs)(lo,{children:[(0,q.jsx)(uo,{children:`Manage sentiment`}),(0,q.jsx)(fo,{children:`Classify saved answers and review the cost before submitting a backfill.`})]}),m.data?.actions.configure&&(0,q.jsx)(Ku,{projectName:e,settings:m.data,selection:T,runOptions:E},JSON.stringify([m.data.evaluationDefinitionId,m.data.enabled,m.data.enablementEpoch])),_.data&&(0,q.jsx)(Bu,{projectName:e,jobs:_.data.jobs})]})}),(0,q.jsx)(no,{open:b!==null,onOpenChange:e=>{e||x(null)},children:(0,q.jsxs)(co,{onCloseAutoFocus:D,className:`overflow-y-auto`,children:[(0,q.jsxs)(lo,{children:[(0,q.jsxs)(uo,{children:[`Sentiment evidence`,b?`: ${b.label}`:``]}),(0,q.jsx)(fo,{children:`Stored judgments and exact quotations for the selected query and scope.`})]}),b&&(0,q.jsx)(Lu,{projectName:e,selection:b.selection},JSON.stringify(b.selection))]})})]})}function Du(e,t){let n=(0,K.useContext)(Su)?.resolveSource;(0,K.useEffect)(()=>{n?.(e?{runId:e,revision:t??void 0}:null)},[n,e,t])}function Ou(){let e=(0,K.useContext)(Su);return e?.settings.data?.actions.configure?(0,q.jsx)(Ml,{type:`button`,variant:`outline`,size:`sm`,onClick:t=>e.openManage(t.currentTarget),children:e.settings.data.enabled?`Manage sentiment`:`Enable sentiment`}):null}function ku(e,t){return!e?.configured||t===`unknown`||t===`unclassified`?null:[`branded`]}function Au({queryClass:e=`all`}){let t=(0,K.useContext)(Su),n=ku(t,e);return!t?.hasSourceEvidence||!n?.some(e=>lu(t.summaries[e].data))?null:(0,q.jsx)(`ul`,{className:`sentiment-legend`,"aria-hidden":`true`,children:eu.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`span`,{className:`sentiment-legend-swatch ${iu[e]}`}),$l(e)]},e))})}function ju({queryClass:e}){let t=(0,K.useContext)(Su);if(!t?.hasSourceEvidence)return null;let n=t.summaries[`non-brand`],r=n.data,i=e===`non-brand`;if(!r)return i?n.isError?(0,q.jsxs)(`p`,{role:`alert`,className:`sentiment-nonbrand-note`,children:[`Couldn’t load non-brand sentiment. `,(0,q.jsx)(G,{variant:`ghost`,onClick:()=>{n.refetch()},children:`Retry`})]}):(0,q.jsx)(`p`,{role:`status`,className:`sentiment-nonbrand-note`,children:`Loading non-brand sentiment…`}):null;let a=r.coverage.counts;return a.unfavorable===0&&a.mixed===0?i?su(r)?(0,q.jsx)(`p`,{className:`sentiment-nonbrand-note`,children:Z.nonBrand.none}):ou(r)?(0,q.jsx)(`p`,{className:`sentiment-nonbrand-note`,children:Z.nonBrand.noneSoFar}):(0,q.jsx)(`p`,{className:`sentiment-nonbrand-note`,children:r.state===`not-measured`?Z.nonBrand.notRated:`${Z.nonBrand.label}: ${cu(r)}`}):null:(0,q.jsx)(`div`,{className:`sentiment-nonbrand`,role:`group`,"aria-label":Z.nonBrand.label,children:(0,q.jsxs)(`div`,{className:`sentiment-nonbrand-line`,children:[(0,q.jsxs)(`span`,{className:`sentiment-nonbrand-label`,children:[Z.nonBrand.label,(0,q.jsx)(kr,{text:Z.nonBrand.help})]}),(0,q.jsxs)(`span`,{className:`sentiment-nonbrand-counts`,children:[nu.slice().reverse().filter(e=>a[e]>0).map(e=>(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`sentiment-legend-swatch ${iu[e]}`}),a[e],` `,e]},e)),!su(r)&&(0,q.jsx)(`span`,{className:`text-caution`,children:Z.partial})]}),(0,q.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:e=>t.openEvidence({...Cu(t,r),queryClass:`non-brand`,outcome:nu},Z.nonBrand.evidence,e.currentTarget),children:Z.nonBrand.view})]})})}function Mu({queryClass:e=`all`,legend:t=!0,manage:n=!1}){let r=(0,K.useContext)(Su),i=ku(r,e),[a,o]=(0,K.useState)(null);if(!r)return null;if(!i){let e=r.settings.data;return!n||!e?.actions.configure?null:(0,q.jsxs)(`div`,{className:`sentiment-headlines-title`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`sentiment-headlines-heading`,children:Z.title}),!(e.enabled&&e.installEnabled)&&(0,q.jsx)(`p`,{className:`sentiment-headlines-subtitle`,children:Z.states.disabled})]}),(0,q.jsx)(Ou,{})]})}let s=r.hasSourceEvidence&&i.some(e=>r.summaries[e].data);return(0,q.jsxs)(`div`,{className:`sentiment-headlines`,role:`group`,"aria-label":`Favorable answer scores`,children:[(0,q.jsxs)(`div`,{className:`sentiment-headlines-title`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`sentiment-headlines-heading`,children:Z.title}),(0,q.jsx)(`p`,{className:`sentiment-headlines-subtitle`,children:Z.subtitle})]}),n&&(0,q.jsx)(Ou,{})]}),t&&(0,q.jsx)(Au,{queryClass:e}),s&&(0,q.jsxs)(`div`,{className:`sentiment-headlines-columns`,"aria-hidden":`true`,children:[(0,q.jsx)(`span`,{className:`sentiment-headlines-favorable`,children:Z.columns.favorable}),(0,q.jsx)(`span`,{className:`sentiment-headlines-ratings`,title:Z.rated,children:Z.columns.rated})]}),i.map(e=>{let t=r.summaries[e];return(0,q.jsxs)(`div`,{className:`sentiment-class`,"data-query-class":e,children:[(0,q.jsxs)(`div`,{className:`sentiment-class-label`,children:[(0,q.jsx)(`span`,{children:Yl[e]}),(0,q.jsx)(kr,{text:Z.favorable})]}),r.hasSourceEvidence?t.data?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(uu,{value:t.data,label:Yl[e]}),(0,q.jsx)(pu,{value:t.data,label:Yl[e]}),(0,q.jsx)(gu,{coverage:t.data.coverage,label:Yl[e]}),(0,q.jsx)(_u,{value:t.data}),(0,q.jsx)(yu,{value:t.data,queryClass:e,open:a===e,setOpenClass:o})]}):t.isError?(0,q.jsxs)(`p`,{role:`alert`,className:`sentiment-class-status`,children:[`Couldn’t load sentiment. `,(0,q.jsx)(G,{variant:`ghost`,onClick:()=>{t.refetch()},children:`Retry`})]}):(0,q.jsx)(`p`,{role:`status`,className:`sentiment-class-status`,children:`Loading sentiment…`}):(0,q.jsx)(`p`,{className:`sentiment-class-status`,children:`No saved answers.`})]},e)}),e!==`branded`&&(0,q.jsx)(ju,{queryClass:e})]})}function Nu({queryId:e,sourceSnapshotIds:t=[],queryClass:n,location:r,showLabel:i=!1}){let a=(0,K.useContext)(Su);if(!a?.configured)return null;let o=n?a.summaries[n]:void 0,s=a.hasSourceEvidence?o?.data:void 0,c=s?.queries.filter(r=>r.queryClass===n&&(e?r.queryId===e:t.length>0)&&t.every(e=>r.sourceSnapshotIds.includes(e)))??[],l=c.length===1?c[0]:void 0,u=r===void 0?l:l?.locations.find(e=>e.location===r);if(!l||!u)return(0,q.jsx)(`span`,{className:`text-label-14 text-secondary`,children:a.hasSourceEvidence&&o?.isPending&&(e||t.length)?`Loading…`:`Unavailable`});let d={...a.selection,...s.selection,runId:s.selection.runId??void 0,runIds:s.selection.runId?void 0:s.selection.runIds,revision:s.selection.revision??void 0,evaluationDefinitionId:s.selection.evaluationDefinitionId??void 0,queryClass:l.queryClass,queryId:l.queryId,executionNodeKey:l.executionNodeKey??void 0,...r===void 0?{}:{location:r??`none`}};if(l.queryClass===`non-brand`){if(u.state===`unsupported`)return(0,q.jsx)(`span`,{className:`text-label-14 text-secondary`,children:`Unavailable`});let{unfavorable:e,mixed:t}=u.coverage.counts;if(e===0&&t===0){let e=i&&(0,q.jsx)(`span`,{className:`block text-label-14 text-secondary`,children:Z.nonBrand.rowLabel});return su(u)?(0,q.jsxs)(`span`,{className:`text-label-14 text-muted`,children:[e,(0,q.jsx)(`span`,{"aria-hidden":`true`,title:Z.nonBrand.rowNone,children:Zl}),(0,q.jsx)(`span`,{className:`sr-only`,children:Z.nonBrand.rowNone})]}):(0,q.jsxs)(`span`,{className:`text-label-14 text-secondary`,children:[e,(0,q.jsx)(`span`,{children:cu(u)})]})}return(0,q.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-auto pointer-coarse:min-h-11 flex-col items-start gap-0 px-1`,"aria-label":`View unfavorable and mixed answers for ${l.queryText}`,onKeyDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),a.openEvidence({...d,outcome:nu},`${l.queryText}, unfavorable and mixed`,e.currentTarget)},children:[i&&(0,q.jsx)(`span`,{className:`text-label-14 text-secondary`,children:Z.nonBrand.rowLabel}),e>0&&(0,q.jsxs)(`span`,{className:`text-label-14 text-negative`,children:[e,` unfavorable`]}),t>0&&(0,q.jsxs)(`span`,{className:`text-label-14 text-caution`,children:[t,` mixed`]}),u.provisional&&(0,q.jsx)(`span`,{className:`text-label-12 text-caution`,children:`Provisional`})]})}return(0,q.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-auto pointer-coarse:min-h-11 flex-col items-start gap-0 px-1`,"aria-label":`View ${Yl[l.queryClass]} sentiment evidence for ${l.queryText}`,onKeyDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),a.openEvidence(d,l.queryText,e.currentTarget)},children:[i&&(0,q.jsx)(`span`,{className:`text-label-14 text-secondary`,children:`Favorable`}),(0,q.jsx)(`span`,{className:`font-mono text-primary`,children:u.score.favorableDisplay}),(0,q.jsxs)(`span`,{className:`text-label-14 text-secondary`,children:[u.coverage.judged,` judged`]}),u.provisional&&(0,q.jsx)(`span`,{className:`text-label-12 text-caution`,children:`Provisional`})]})}function Pu(e){return e.outcome===`subject-not-mentioned`?`Not mentioned`:e.outcome===`running`?`Classifying`:e.outcome===`waiting-to-retry`?`Retrying`:e.outcome?$l(e.outcome):e.state===`not-measured`?`Not classified`:e.state===`processing`?`Classifying`:e.state===`failed`?`Failed`:e.state===`canceled`?`Canceled`:`Unavailable`}function Fu({queryId:e,sourceSnapshotIds:t,queryClass:n,provider:r,model:i,location:a,showSubjects:o=!1,showLabel:s=!1}){let c=(0,K.useContext)(Su);if(!c?.configured)return null;let l=n?c.summaries[n]:void 0,u=c.hasSourceEvidence?l?.data:void 0,d=u?.queries.filter(r=>r.queryClass===n&&(!e||r.queryId===e)&&t.length>0&&t.every(e=>r.sourceSnapshotIds.includes(e)))??[],f=d.length===1?d[0]:void 0,p=f?.assessments?.filter(e=>t.includes(e.sourceSnapshotId)&&e.provider===r&&e.location===a&&(i===void 0||e.servedModel===i))??[];return(0,q.jsxs)(`div`,{role:`group`,className:`text-label-14 text-secondary`,"aria-label":`${r||`Saved answer`} sentiment`,children:[s&&(0,q.jsx)(`span`,{className:`block text-label-14 text-secondary`,children:`Sentiment`}),p.length?p.map(e=>{let t=Pu(e),n=tu(e.outcome),r=(0,q.jsxs)(q.Fragment,{children:[o&&(0,q.jsxs)(`span`,{children:[e.subjectLabel,` · `]}),(0,q.jsx)(En,{tone:n,className:`max-w-full shrink-0 rounded-none border-0 bg-transparent p-0 text-label-14 [overflow-wrap:normal]`,children:t})]}),i={...c.selection,...u.selection,runId:u.selection.runId??void 0,runIds:u.selection.runId?void 0:u.selection.runIds,revision:u.selection.revision??void 0,evaluationDefinitionId:u.selection.evaluationDefinitionId??void 0,queryClass:f.queryClass,queryId:f.queryId,executionNodeKey:f.executionNodeKey??void 0,assessmentId:e.assessmentId??void 0};return(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.assessmentId?(0,q.jsx)(G,{type:`button`,variant:`ghost`,className:`h-auto pointer-coarse:min-h-11 flex-wrap justify-start whitespace-normal px-1 text-left text-button-14`,"aria-label":`View ${e.provider} sentiment evidence for ${e.subjectLabel}: ${t}`,onKeyDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),c.openEvidence(i,`${f.queryText} · ${e.provider} · ${e.subjectLabel}`,t.currentTarget)},children:r}):(0,q.jsx)(`span`,{children:r}),e.reason&&(0,q.jsx)(kr,{text:e.reason})]},JSON.stringify([e.sourceSnapshotId,e.subjectId,e.assessmentId]))}):(0,q.jsx)(`span`,{children:c.hasSourceEvidence&&l?.isPending&&t.length?`Loading…`:`Unavailable`})]})}function Iu({item:e}){let t=ra(e.context.provider);return(0,q.jsxs)(`article`,{className:`space-y-4 border-b border-default py-5 text-label-14 text-secondary`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`strong`,{className:`text-primary`,children:e.subject.displayName}),(0,q.jsx)(En,{tone:tu(e.outcome),children:$l(e.outcome)}),(0,q.jsx)(`span`,{children:Yl[e.context.queryClass]}),(0,q.jsxs)(`span`,{children:[`Answered by `,(0,q.jsx)(`span`,{className:`text-primary`,children:t}),e.context.servedModel?` (${e.context.servedModel})`:``]}),(0,q.jsx)(`span`,{children:e.context.location??`No location`})]}),e.reason&&(0,q.jsx)(`p`,{children:e.reason}),(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h3`,{className:`mb-2 text-heading`,children:`Conclusion evidence`}),e.conclusion.length?e.conclusion.map(e=>(0,q.jsx)(`blockquote`,{className:`mb-2 border-l border-strong pl-3 text-primary`,children:e.text},`${e.id}:${e.start}`)):(0,q.jsx)(`p`,{children:`No valid conclusion evidence is available.`})]}),(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h3`,{className:`mb-2 text-heading`,children:`Complaint evidence`}),e.complaint?.length?e.complaint.map(e=>(0,q.jsx)(`blockquote`,{className:`mb-2 border-l border-strong pl-3 text-primary`,children:e.text},`${e.id}:${e.start}`)):(0,q.jsx)(`p`,{children:`No complaint was identified.`})]}),(0,q.jsxs)(`details`,{children:[(0,q.jsxs)(`summary`,{className:`cursor-pointer`,children:[`Original answer from `,t]}),(0,q.jsx)(`div`,{className:`mt-2 break-words text-primary`,children:(0,q.jsx)(zl,{headingLevel:4,children:e.sourceText})})]}),(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{className:`cursor-pointer`,children:`Assessment provenance`}),(0,q.jsxs)(`dl`,{className:`mt-3 space-y-2 break-all`,children:[(0,q.jsx)(`dt`,{children:`Query`}),(0,q.jsx)(`dd`,{children:e.context.queryText}),(0,q.jsx)(`dt`,{children:`Subject`}),(0,q.jsxs)(`dd`,{children:[e.subject.displayName,` (`,e.subject.id,`)`]}),(0,q.jsx)(`dt`,{children:`Run`}),(0,q.jsx)(`dd`,{children:e.runId}),(0,q.jsx)(`dt`,{children:`Revision`}),(0,q.jsx)(`dd`,{children:e.context.revision??`Unavailable`}),(0,q.jsx)(`dt`,{children:`Evaluator`}),(0,q.jsx)(`dd`,{children:e.returnedModel??`Unavailable`}),(0,q.jsx)(`dt`,{children:`Evaluation definition`}),(0,q.jsx)(`dd`,{children:e.evaluationDefinitionId}),(0,q.jsx)(`dt`,{children:`Source snapshot`}),(0,q.jsx)(`dd`,{children:e.sourceSnapshotId}),(0,q.jsx)(`dt`,{children:`Source hash`}),(0,q.jsx)(`dd`,{children:e.sourceTextHash}),e.context.usageEdges.map((e,t)=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Assignment`}),(0,q.jsxs)(`dd`,{children:[`Target `,e.targetId,`; Property `,e.propertyId??`None`,`; market `,e.marketId??`None`,`; `,e.queryClass]})]},t))]})]})]})}function Lu({projectName:e,selection:t}){let[n,r]=(0,K.useState)(),i=z({queryKey:Hl(e,`evidence`,t,n),queryFn:()=>Nt(e,t,n),retry:!1});return i.isPending?(0,q.jsx)(`p`,{role:`status`,className:`mt-4 text-copy-14 text-secondary`,children:`Loading sentiment evidence…`}):i.isError?(0,q.jsxs)(`p`,{role:`alert`,className:`mt-4 text-copy-14 text-secondary`,children:[`Could not load sentiment evidence. `,(0,q.jsx)(G,{variant:`outline`,onClick:()=>{i.refetch()},children:`Retry evidence`})]}):(0,q.jsxs)(q.Fragment,{children:[i.data.items.length?i.data.items.map(e=>(0,q.jsx)(Iu,{item:e},e.assessmentId)):(0,q.jsx)(`p`,{className:`mt-4 text-copy-14 text-secondary`,children:`No stored sentiment evidence for this query and scope.`}),(0,q.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[n&&(0,q.jsx)(G,{variant:`outline`,onClick:()=>r(void 0),children:`First evidence page`}),i.data.nextCursor&&(0,q.jsx)(G,{variant:`outline`,onClick:()=>r(i.data.nextCursor??void 0),children:`Next evidence page`})]})]})}function Ru({projectName:e,jobId:t}){let[n,r]=(0,K.useState)(),i=z({queryKey:Hl(e,`job:${t}`,void 0,n),queryFn:()=>zt(e,t,n),retry:!1});return i.isPending?(0,q.jsx)(`p`,{role:`status`,children:`Loading attempts…`}):i.isError?(0,q.jsxs)(`p`,{role:`alert`,children:[`Could not load attempts. `,(0,q.jsx)(G,{variant:`outline`,onClick:()=>{i.refetch()},children:`Retry attempts`})]}):(0,q.jsxs)(q.Fragment,{children:[i.data.attempts.map(e=>(0,q.jsxs)(`p`,{children:[e.errorCode??`Request complete`,`; `,e.usage.kind===`unknown`?`Usage unknown`:`${e.usage.inputTokens??`Unknown`} input tokens (${e.usage.kind})`]},e.id)),(0,q.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[n&&(0,q.jsx)(G,{variant:`outline`,onClick:()=>r(void 0),children:`Newest attempts`}),i.data.nextAttemptCursor&&(0,q.jsx)(G,{variant:`outline`,onClick:()=>r(i.data.nextAttemptCursor??void 0),children:`Older attempts`})]})]})}function zu({projectName:e,job:t}){let[n,r]=(0,K.useState)(!1);return(0,q.jsxs)(`details`,{onToggle:e=>r(e.currentTarget.open),children:[(0,q.jsx)(`summary`,{children:`Job details`}),t.cancellationReason&&(0,q.jsx)(`p`,{children:t.cancellationReason}),Object.entries(t.counts).filter(([,e])=>e>0).map(([e,t])=>(0,q.jsxs)(`p`,{children:[$l(e),`: `,t]},e)),(0,q.jsxs)(`p`,{children:[`Attempts: `,t.attemptCount]}),n&&t.attemptCount>0&&(0,q.jsx)(Ru,{projectName:e,jobId:t.id})]})}function Bu({projectName:e,jobs:t}){return(0,q.jsxs)(`details`,{className:`mt-6 text-label-14 text-secondary`,children:[(0,q.jsx)(`summary`,{className:`cursor-pointer`,children:`Recent sentiment jobs`}),t.length===0?(0,q.jsx)(`p`,{className:`mt-2`,children:`No sentiment jobs have been submitted.`}):(0,q.jsx)(`div`,{className:`data-table-wrapper mt-3`,children:(0,q.jsxs)(`table`,{className:`data-table`,"aria-label":`Sentiment jobs`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:`Submitted`}),(0,q.jsx)(`th`,{children:`State`}),(0,q.jsx)(`th`,{children:`Selected`}),(0,q.jsx)(`th`,{children:`Details`})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:Gn(t.createdAt)}),(0,q.jsx)(`td`,{children:$l(t.state)}),(0,q.jsx)(`td`,{children:t.selected}),(0,q.jsx)(`td`,{children:(0,q.jsx)(zu,{projectName:e,job:t})})]},t.id))})]})})]})}var Vu={probe:`Probe checks`,"unsupported-run-kind":`Not an AI Visibility check`,"failed-run":`Failed check`,"incomplete-run":`Incomplete check`,"legacy-missing-provenance":`Saved without its frozen query and subject record`,"legacy-missing-language":`Saved before the answer language was recorded`,"excluded-branded":`Branded answers (backfill that class separately)`,"excluded-non-brand":`Non-brand answers (backfill that class separately)`};function Hu(e){return Vu[e]??$l(e)}function Uu(e){return[e.provider&&`engine ${e.provider}`,e.model&&`model ${e.model}`,e.location&&(e.location===`none`?`no location`:`location ${e.location}`),e.scope!==`project`&&e.scopeKey&&`${e.scope} ${e.scopeKey}`,e.marketKey&&`market ${e.marketKey}`,e.queryId&&`query ${e.queryId}`,e.revision!==void 0&&`revision ${e.revision}`].filter(e=>!!e)}function Wu(e){let t=Uu(e);return[`${Yl[e.queryClass]} queries`,...t.length?t:[`whole check`]].join(` · `)}function Gu(e,t,n,r){return r?{...e,queryClass:n,queryId:void 0,runIds:void 0,runId:t}:{mode:`auto`,scope:`project`,queryClass:n,runId:t}}function Ku({projectName:e,settings:t,selection:n,runOptions:r}){let i=_e(),[a,o]=(0,K.useState)(t.enabled),[s,c]=(0,K.useState)(n.runId??``),[l,u]=(0,K.useState)(n.queryClass),[d,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)(null),h=(0,K.useRef)(null),g=Uu({...n,queryId:void 0}),_=()=>i.invalidateQueries({queryKey:[`sentiment`,e]}),v=()=>{m(null),h.current=null},y=ye({mutationFn:async()=>{if(!(await Me(e)).actions.configure)throw Error(`Administrator permission is required to configure sentiment.`);return Bn(e,{enabled:a})},onSuccess:async()=>{v(),await _(),await i.invalidateQueries({queryKey:[`project-overview-slim`]})},onError:_}),b=ye({mutationFn:async()=>{if(!(await Me(e)).actions.backfill)throw Error(`Administrator permission is required to backfill sentiment.`);return Le(e,Gu(n,s,l,d&&g.length>0))},onSuccess:e=>{m(e),h.current=crypto.randomUUID()},onError:_}),x=ye({mutationFn:async()=>{if(!p?.previewToken||!h.current)throw Error(`Create and review a backfill preview first.`);if(!(await Me(e)).actions.backfill)throw Error(`Administrator permission is required to backfill sentiment.`);return Sn(e,p.previewToken,h.current)},onSuccess:async()=>{v(),await _()},onError:_}),S=y.isPending||b.isPending||x.isPending;return(0,q.jsxs)(`div`,{className:`mt-5 space-y-5 text-label-14 text-secondary`,children:[(0,q.jsx)(`dl`,{className:`definition-list`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Evaluator`}),(0,q.jsxs)(`dd`,{children:[t.model,` · `,t.provider===`openrouter`?`OpenRouter`:`TypeSafe`]})]})}),(0,q.jsx)(`p`,{children:t.disclosure}),!t.ready&&(0,q.jsx)(`p`,{children:t.readinessReasons.join(`; `)||`An operator must configure sentiment on this installation.`}),(0,q.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),y.mutate()},children:[(0,q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:a,disabled:S,onChange:e=>{o(e.target.checked),v()}}),`Enable project sentiment`]}),(0,q.jsx)(`p`,{children:`Enabling applies to future completed checks. Past checks require an explicit backfill.`}),(0,q.jsx)(Ml,{type:`submit`,disabled:S,children:y.isPending?`Saving…`:`Save sentiment settings`}),y.isError&&(0,q.jsx)(`p`,{role:`alert`,children:yn(y.error)}),y.isSuccess&&(0,q.jsx)(`p`,{role:`status`,children:`Sentiment settings saved.`})]}),t.actions.backfill&&(0,q.jsxs)(`section`,{className:`space-y-3`,children:[(0,q.jsx)(`h3`,{children:`Backfill a saved check`}),(0,q.jsxs)(`label`,{className:`block`,children:[`Saved check`,(0,q.jsxs)(`select`,{className:`mt-1 block w-full rounded-md border border-default bg-bg p-2 text-primary`,value:s,disabled:S,onChange:e=>{c(e.target.value),v()},children:[(0,q.jsx)(`option`,{value:``,children:`Select a saved check`}),r.map(e=>(0,q.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]}),(0,q.jsxs)(`label`,{className:`block`,children:[`Query class`,(0,q.jsxs)(`select`,{className:`mt-1 block w-full rounded-md border border-default bg-bg p-2 text-primary`,value:l,disabled:S,onChange:e=>{u(e.target.value),v()},children:[(0,q.jsx)(`option`,{value:`non-brand`,children:`Non-brand`}),(0,q.jsx)(`option`,{value:`branded`,children:`Branded`})]})]}),(0,q.jsx)(`p`,{children:`The backfill covers every engine, location and query of the chosen check for this query class.`}),g.length>0&&(0,q.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:d,disabled:S,onChange:e=>{f(e.target.checked),v()}}),(0,q.jsxs)(`span`,{children:[`Limit to the current view`,(0,q.jsx)(`span`,{className:`block`,children:g.join(` · `)})]})]}),(0,q.jsx)(G,{variant:`outline`,disabled:S||!s||!t.enabled||!t.ready,onClick:()=>{v(),b.mutate()},children:b.isPending?`Preparing preview…`:`Preview sentiment backfill`}),b.isError&&(0,q.jsx)(`p`,{role:`alert`,children:yn(b.error)}),p&&(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsxs)(`dl`,{className:`grid grid-cols-[1fr_auto] gap-2`,children:[(0,q.jsx)(`dt`,{children:`Selection`}),(0,q.jsx)(`dd`,{className:`text-right`,children:Wu(p.selection)}),(0,q.jsx)(`dt`,{children:`Eligible assessments`}),(0,q.jsx)(`dd`,{children:p.eligibleAssessments}),(0,q.jsx)(`dt`,{children:`Already classified`}),(0,q.jsx)(`dd`,{children:p.alreadyClassified}),(0,q.jsx)(`dt`,{children:`Estimated input tokens`}),(0,q.jsx)(`dd`,{children:p.estimatedInputTokens}),(0,q.jsx)(`dt`,{children:`Estimated cost (USD)`}),(0,q.jsx)(`dd`,{children:p.estimatedCostUsd??`Unavailable`})]}),(0,q.jsx)(kr,{text:p.estimateMethod}),p.eligibleAssessments===0&&(0,q.jsx)(`p`,{children:`No saved answers in this selection can be classified.`}),p.skipped.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{children:`Not included:`}),(0,q.jsx)(`ul`,{"aria-label":`Skipped assessments`,className:`list-disc pl-5`,children:p.skipped.map(e=>(0,q.jsxs)(`li`,{children:[Hu(e.reason),`: `,e.count]},`${e.runId}:${e.reason}`))})]}),(0,q.jsx)(Ml,{disabled:S||!p.previewToken||p.eligibleAssessments===0,onClick:()=>x.mutate(),children:x.isPending?`Submitting…`:`Confirm sentiment backfill`})]}),x.isError&&(0,q.jsxs)(`p`,{role:`alert`,children:[yn(x.error),` Retry uses the same request key.`]}),x.isSuccess&&(0,q.jsx)(`p`,{role:`status`,children:`Backfill submitted. Progress is available in Recent jobs.`})]})]})}var qu=20;function Ju({points:e,tone:t}){let n=(0,K.useId)();if(e.length===0)return null;let r=t=>5+t/Math.max(e.length-1,1)*122,i=Ur(e),a=Math.min(...e),o=Math.max(...e),s=Math.max(o-a,qu),c=(o+a)/2-s/2,l=e.map((e,t)=>({x:r(t),y:5+(1-(e-c)/s)*26}));return(0,q.jsxs)(`svg`,{className:`sparkline sparkline-${t}${i?` sparkline-provisional`:``}`,viewBox:`0 0 132 42`,"aria-hidden":`true`,children:[(0,q.jsx)(`defs`,{children:(0,q.jsx)(`clipPath`,{id:n,children:(0,q.jsx)(`rect`,{x:5,y:5,width:122,height:32,rx:`8`})})}),(0,q.jsx)(`line`,{className:`sparkline-guide`,x1:5,x2:127,y1:37,y2:37}),l.length===1?(0,q.jsx)(`circle`,{className:`sparkline-point`,cx:l[0].x,cy:l[0].y,r:`3`}):(0,q.jsx)(`polyline`,{clipPath:`url(#${n})`,points:l.map(e=>`${e.x},${e.y}`).join(` `),vectorEffect:`non-scaling-stroke`})]})}function Yu({run:e,projectName:t,children:n,className:r,label:i}){let{openRun:a}=ws();return e.kind===U[`seo-sync`]&&e.opensSeoWorkspace!==!1?t?(0,q.jsx)(V,{to:`/projects/$projectName/seo-data`,params:{projectName:t},search:t=>({...t,seoRunId:e.id,seoProfileId:void 0,seoRegion:void 0,seoMarket:void 0,seoShow:void 0,seoSort:void 0,seoQ:void 0,runId:void 0,evidenceId:void 0}),className:r,"aria-label":i,children:n}):(0,q.jsx)(`button`,{type:`button`,disabled:!0,className:r,"aria-label":i,title:`Project unavailable`,children:n}):(0,q.jsx)(`button`,{type:`button`,className:r,"aria-label":i,onClick:()=>a(e.id),children:n})}function Q({project:e,sentimentColumn:t}){return(0,q.jsxs)(`div`,{className:`project-row relative${t?` project-row-with-sentiment`:``}`,children:[(0,q.jsx)(`div`,{className:`project-row-chart`,children:(0,q.jsx)(Ju,{points:e.trend,tone:mi(e.lastRun.status)})}),(0,q.jsxs)(`div`,{className:`project-row-primary`,children:[(0,q.jsxs)(V,{to:`/projects/$projectName`,params:{projectName:e.project.name},className:`after:absolute after:inset-0 after:rounded-md focus-visible:outline-none focus-visible:after:ring-2 focus-visible:after:ring-mono-400`,children:[(0,q.jsx)(`p`,{className:`project-name`,children:e.project.name}),(0,q.jsx)(`p`,{className:`project-domain`,children:e.project.canonicalDomain})]}),(0,q.jsx)(`p`,{className:`project-insight`,children:e.insight})]}),(0,q.jsx)(`div`,{className:`project-row-stat`,children:(0,q.jsxs)(`div`,{className:`metric-inline-block`,children:[(0,q.jsx)(`p`,{className:`metric-inline-label`,children:`Mentioned`}),(0,q.jsx)(`p`,{className:`metric-inline-value ${e.mentionTone===`caution`?`text-caution-400`:``}`,children:e.hasMeasurement===!1?`Not measured`:wn(e.mentionScore,Ot.percent)}),(0,q.jsx)(`p`,{className:`metric-inline-caption${e.providerCoverage?` text-caution`:``}`,title:e.providerCoverage,children:e.providerCoverage?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`sr-only`,children:`Partial check: `}),e.providerCoverage]}):e.mentionDelta})]})}),(0,q.jsx)(`div`,{className:`project-row-stat`,children:(0,q.jsxs)(`div`,{className:`metric-inline-block`,children:[(0,q.jsxs)(`p`,{className:`metric-inline-label`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`Pressure`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Competitor pressure`})]}),(0,q.jsx)(`p`,{className:`metric-inline-value`,children:e.hasMeasurement===!1?`Not measured`:e.competitorPressureLabel}),(0,q.jsx)(`p`,{className:`metric-inline-caption`,"aria-hidden":`true`})]})}),bu(e.sentiment)?(0,q.jsx)(xu,{value:e.sentiment}):t&&(0,q.jsx)(`div`,{className:`project-row-stat`,"aria-hidden":`true`,"data-sentiment-placeholder":!0}),(0,q.jsx)(`span`,{className:`project-row-link`,children:(0,q.jsx)(M,{className:`h-4 w-4 text-muted`})})]})}function Xu(){let{isAdmin:e}=Qn(),t=ps(),{dashboard:n,isLoading:r,isError:i,activityLoading:a,activityError:o,refetch:s}=ms(),c=n??t?.dashboard,l=Ss(!t,t?.health);if(i&&!c)return(0,q.jsxs)(`div`,{className:`page-container`,children:[(0,q.jsx)(`div`,{className:`page-header`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`All projects unavailable`}),(0,q.jsx)(`p`,{className:`page-subtitle`,children:`Canonry could not load the project list.`})]})}),(0,q.jsxs)(`div`,{className:`max-w-xl rounded-md border border-negative bg-negative-soft p-4`,role:`alert`,children:[(0,q.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:`Your projects have not been changed.`}),(0,q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:`Check the connection or sign in again, then retry.`}),(0,q.jsx)(G,{type:`button`,variant:`secondary`,className:`mt-4`,onClick:()=>{s()},children:`Retry loading projects`})]})]});if(!c||r)return(0,q.jsxs)(`div`,{className:`page-skeleton`,children:[(0,q.jsxs)(`div`,{className:`page-skeleton-header`,children:[(0,q.jsx)(`div`,{className:`skeleton-text h-6 w-32`}),(0,q.jsx)(`div`,{className:`skeleton-text-sm w-64`})]}),(0,q.jsx)(`div`,{className:`space-y-3`,children:[1,2,3].map(e=>(0,q.jsxs)(`div`,{className:`material-base p-4 flex items-center gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,q.jsx)(`div`,{className:`skeleton-text w-36`}),(0,q.jsx)(`div`,{className:`skeleton-text-sm w-48`})]}),(0,q.jsx)(`div`,{className:`skeleton-text w-16`}),(0,q.jsx)(`div`,{className:`skeleton-text w-16`}),(0,q.jsx)(`div`,{className:`skeleton h-8 w-20 rounded`})]},e))})]});let u=c.portfolioOverview,d=u.projects.length>0&&u.projects.every(e=>e.hasMeasurement===!1),f=u.projects.some(e=>bu(e.sentiment)),p=u.attentionItems.map(e=>d&&e.id===`attention_stable`?{...e,tone:`neutral`,title:`Awaiting first measurement`,detail:`Visibility results will appear after the first check.`}:e),m=l.data??t?.health??{apiStatus:{label:`API`,state:`checking`,detail:`Checking service health`},workerStatus:{label:`Worker`,state:`checking`,detail:`Checking service health`}},h=xi(u.systemHealth.filter(t=>e||t.id===`api`||t.id===`worker`),m,c.settings);return(0,q.jsxs)(`div`,{className:`page-container`,children:[(0,q.jsx)(`div`,{className:`page-header`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`All projects`}),(0,q.jsx)(`p`,{className:`page-subtitle`,children:`Visibility across all projects.`})]})}),u.projects.length>0?(0,q.jsx)(`div`,{className:`project-list project-list-scrollable`,children:u.projects.map(e=>(0,q.jsx)(Q,{project:e,sentimentColumn:f},e.project.id))}):(0,q.jsxs)(Pr,{className:`surface-card empty-card`,children:[(0,q.jsx)(`h3`,{children:u.emptyState?.title??`No projects yet`}),(0,q.jsx)(`p`,{className:`supporting-copy`,children:u.emptyState?.detail}),(0,q.jsx)(G,{size:`sm`,asChild:!0,children:(0,q.jsx)(V,{to:u.emptyState?.ctaHref===`/setup`||!u.emptyState?.ctaHref?`/setup`:`/`,children:u.emptyState?.ctaLabel??`Launch setup`})})]}),(0,q.jsxs)(`div`,{className:`overview-secondary-grid`,children:[p.length>0&&(0,q.jsxs)(`section`,{className:`overview-secondary-section`,children:[(0,q.jsx)(`div`,{className:`section-head section-head-inline`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Needs attention`}),(0,q.jsx)(`h2`,{className:`section-title-sm`,children:`What changed`})]})}),(0,q.jsx)(`div`,{className:`attention-list attention-list-scrollable`,children:p.map(e=>e.href?(0,q.jsxs)(V,{to:e.href,className:`attention-item attention-item-${e.tone}`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`attention-title`,children:e.title}),(0,q.jsx)(`p`,{className:`attention-detail`,children:e.detail})]}),e.actionLabel&&(0,q.jsx)(`span`,{className:`attention-action`,children:e.actionLabel})]},e.id):(0,q.jsxs)(`div`,{className:`attention-item attention-item-static attention-item-${e.tone}`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`attention-title`,children:e.title}),(0,q.jsx)(`p`,{className:`attention-detail`,children:e.detail})]}),e.actionLabel&&(0,q.jsx)(`span`,{className:`attention-action`,children:e.actionLabel})]},e.id))})]}),(0,q.jsxs)(`section`,{className:`overview-secondary-section`,children:[(0,q.jsx)(`div`,{className:`section-head section-head-inline`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Recent runs`}),(0,q.jsx)(`h2`,{className:`section-title-sm`,children:`Activity`})]})}),(0,q.jsx)(`div`,{className:`compact-stack compact-stack-scrollable`,children:o?(0,q.jsxs)(`div`,{role:`alert`,children:[(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`Recent jobs could not be loaded.`}),(0,q.jsx)(G,{type:`button`,variant:`secondary`,className:`mt-3`,onClick:()=>{s()},children:`Retry loading activity`})]}):a?(0,q.jsx)(`p`,{className:`supporting-copy`,role:`status`,children:`Loading recent jobs…`}):u.recentRuns.length>0?u.recentRuns.map(e=>(0,q.jsxs)(Yu,{run:e,projectName:u.projects.find(t=>t.project.id===e.projectId)?.project.name,className:`compact-run`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`compact-run-title`,children:e.projectName}),(0,q.jsx)(`p`,{className:`compact-run-detail`,children:e.summary})]}),(0,q.jsx)(to,{status:e.status})]},e.id)):(0,q.jsx)(`p`,{className:`supporting-copy`,children:`Run history appears here after the first launch.`})})]})]}),(0,q.jsxs)(`section`,{className:`page-section`,children:[(0,q.jsx)(`div`,{className:`section-head section-head-inline`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`System health`}),(0,q.jsx)(`h2`,{className:`section-title-sm`,children:`Infrastructure`})]})}),(0,q.jsx)(`div`,{className:`divide-y divide-default border-y border-default`,children:h.map(e=>{let t=e.id===`api`?m.apiStatus:e.id===`worker`?m.workerStatus:void 0,n=t?t.state===`ok`?void 0:bi(t):e.tone===`positive`?void 0:e.meta;return(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:e.label}),n&&(0,q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:n})]}),(0,q.jsx)(En,{tone:e.tone,title:t?bi(t):e.meta,children:e.detail})]},e.id)})})]})]})}var Zu=`a, button, input, select, textarea, label, [role="button"], [role="link"], [role="checkbox"], [role="menuitem"]`;function Qu(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return!1;let t=e.target;if(t&&typeof t.closest==`function`&&t.closest(Zu))return!1;let n=typeof window<`u`?window.getSelection():null;return!(n&&!n.isCollapsed&&n.toString().trim()!==``)}function $u({onApplied:e}){let{canWrite:t}=Qn(),[n,r]=(0,K.useState)(``),[i,a]=(0,K.useState)(!1),[o,s]=(0,K.useState)([]),[c,l]=(0,K.useState)([]);return In()||!t?null:(0,q.jsxs)(`section`,{className:`mt-8`,children:[(0,q.jsx)(`div`,{className:`page-section-divider`}),(0,q.jsx)(`div`,{className:`section-head mt-6`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Config as code`}),(0,q.jsx)(`h2`,{className:`text-heading-14 text-strong`,children:`Apply YAML`})]})}),(0,q.jsxs)(`p`,{className:`text-muted text-copy-14 mb-3`,children:[`Paste a `,(0,q.jsx)(`code`,{className:`text-secondary`,children:`canonry.yaml`}),` config (multi-document YAML with `,(0,q.jsx)(`code`,{className:`text-secondary`,children:`---`}),` separators supported).`]}),(0,q.jsx)(`textarea`,{className:`setup-input w-full text-copy-13-mono`,rows:10,placeholder:`apiVersion: canonry/v1
19
19
  kind: Project
20
20
  metadata:
21
21
  name: my-project
@@ -41,7 +41,7 @@ spec:
41
41
  `);Oe(t),Ie(!0)}}catch(e){wt(e instanceof Error?e.message:`Failed to generate queries`),y({flowVersion:1,onboardingSessionId:_,event:`onboarding.blocked`,step:`queries`,action:`generate_queries`,reasonCode:vt(e,`unknown`)},`onboarding.blocked:queries:generate`)}finally{St(!1)}}},Nn=async()=>{if(!R)return;let e=Sn;if(e.length!==0){Xt(!0),Jt(null);try{await Xe(R,e),Kt(!0),await r(),y({flowVersion:1,onboardingSessionId:_,event:`onboarding.step_completed`,step:`competitors`,method:`manual`,countBucket:dn(e.length)},`onboarding.step_completed:competitors`),N(4)}catch(e){Jt(e instanceof Error?e.message:`Failed to save competitors`),y({flowVersion:1,onboardingSessionId:_,event:`onboarding.blocked`,step:`competitors`,action:`save`,reasonCode:`unknown`},`onboarding.blocked:competitors:save`)}finally{Xt(!1)}}},Pn=async()=>{let e=pn.trim();if(e){_n(!0),yn(null);try{await Mn(`gemini`,{apiKey:e}),rr({title:`Gemini configured`,detail:`Provider is ready — continuing setup.`,tone:`positive`,dedupeKey:`setup:gemini:configured`,dedupeMode:`drop`}),mn(``),await r(),_t(c.providerStatuses.find(e=>e.name.toLowerCase()===`gemini`)?.name??`gemini`),y({flowVersion:1,onboardingSessionId:_,event:`onboarding.step_completed`,step:`system`,method:`inline`},`onboarding.step_completed:system`)}catch(e){yn(e instanceof Error?e.message:`Failed to save Gemini key`),y({flowVersion:1,onboardingSessionId:_,event:`onboarding.blocked`,step:`system`,action:`configure_provider`,reasonCode:`provider_save_failed`},`onboarding.blocked:system:provider_save_failed`)}finally{_n(!1)}}},Fn=async e=>{let t=ve?.name??R;if(!t)throw Error(`Create a project before choosing models.`);let n=await Ht(t,e);ye(n),await r()},In=async()=>{if(!He()){if(!R||Tn){on(Tn??`Complete setup before launching the first check.`);let e=wn??(R?Cn===0?`no_queries`:`run_rejected`:`unknown`);Je||y({flowVersion:1,onboardingSessionId:_,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,providerCountBucket:dn(mt),queryCountBucket:dn(Cn),reasonCode:e})}else{rn(!0),on(null);try{let e=await un.mutateAsync({projectName:R,projectLabel:le||se||R,sourceAction:`setup-launch`});ln(e.id),tn(!0),it(R,e.id),$t.current=e.id,Je||y({flowVersion:1,onboardingSessionId:_,event:`run.requested`,origin:`dashboard_setup`,result:`queued`,providerCountBucket:dn(mt),queryCountBucket:dn(Cn)}),await r()}catch(e){on(e instanceof Error?e.message:`Failed to queue the AI Visibility check. Retry when the instance is ready.`),Je||y({flowVersion:1,onboardingSessionId:_,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,providerCountBucket:dn(mt),queryCountBucket:dn(Cn),reasonCode:vt(e,`run_rejected`)})}finally{rn(!1)}}}},Ln=()=>N(e=>m?2:Math.max(0,e-1)),Rn=(e,t,n)=>{y({flowVersion:1,onboardingSessionId:_,event:`onboarding.step_completed`,step:e,method:`existing`,...n===void 0?{}:{countBucket:dn(n)}},`onboarding.step_completed:${e}`),N(t)},zn=()=>{y({flowVersion:1,onboardingSessionId:_,event:`onboarding.step_completed`,step:`queries`,method:`skipped`,countBucket:`0`},`onboarding.step_completed:queries`),m?Ee():N(3)},Bn=()=>{y({flowVersion:1,onboardingSessionId:_,event:`onboarding.step_completed`,step:`competitors`,method:`skipped`,countBucket:`0`},`onboarding.step_completed:competitors`),N(4)},Vn=m?`section`:Pr,Hn=at!==!0||tt===!0?(0,q.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:hf,onClick:()=>{r(),qe&&$e.refetch(),ut&&dt.refetch()},children:`Check again`}):null,Wn=(lt||At)&&!!Rt,Gn=m&&(ie===2||ie===4)?l?(0,q.jsxs)(`section`,{"aria-labelledby":`setup-provider-heading`,className:`space-y-3 border-b border-default pb-6 mb-6`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,q.jsx)(`h2`,{id:`setup-provider-heading`,className:`text-heading-20 text-heading`,children:`AI engines`}),(0,q.jsx)(En,{tone:at===!0?`positive`:ct?`caution`:`neutral`,children:at===!0?`Ready`:ct?`Choose models`:lt?`Not connected`:`Checking`}),(0,q.jsx)(kr,{text:at===!0?H.length>0?`AI Visibility checks and Research use your provider account.`:`ChatGPT in Chrome runs AI Visibility checks. Query Research needs an API provider.`:ct?`OpenRouter is connected. Choose the models your AI Visibility checks ask. You can save queries now.`:lt?`AI Visibility checks need an AI engine. You can save queries now and connect one later.`:`Checking connected AI engines. You can choose queries meanwhile.`})]}),at===!0&&(H.length>0||tt===!0)?(0,q.jsxs)(`ul`,{"aria-label":`Connected AI engines`,className:`divide-y divide-default material-base`,children:[H.map(e=>{let t=Pt(e.name),n=e.displayName??e.name;return(0,q.jsxs)(`li`,{className:`flex min-h-11 items-center justify-between gap-3 px-3.5 py-2 text-label-14`,title:t?ht(e.name):void 0,children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate text-heading`,children:t?n.replace(/ via OpenRouter$/,``):n}),(0,q.jsx)(`span`,{className:`shrink-0 text-secondary`,children:t?`OpenRouter`:e.model??``})]},e.name)}),H.length===0?(0,q.jsx)(`li`,{className:`flex min-h-11 items-center px-3.5 py-2 text-label-14 text-heading`,children:`ChatGPT in Chrome`}):null]}):null,ut?ft?(0,q.jsx)(zd,{inline:!0,catalog:ft,selected:Le,onAdd:e=>Fn({providers:e,providerModels:{}})}):dt.isPending?(0,q.jsx)(`p`,{role:`status`,className:`text-copy-14 text-secondary`,children:`Loading OpenRouter models…`}):(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`p`,{role:`alert`,className:`text-copy-14 text-negative`,children:`Couldn't load OpenRouter's model list.`}),(0,q.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{dt.refetch()},children:`Retry`})]}):null,lt||At?Rt?(0,q.jsx)(`div`,{children:(0,q.jsx)(Od,{compact:!0,leadingField:(0,q.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,q.jsx)(`label`,{className:`block text-label-14-strong text-secondary`,htmlFor:`setup-provider`,children:`Provider to connect`}),(0,q.jsx)(`select`,{ref:Ot,id:`setup-provider`,className:`setup-input`,value:Rt.name,onChange:e=>{e.target.value!==Rt.name&&(Dt.current=document.activeElement===e.currentTarget,Et(e.target.value))},children:Lt.map(e=>(0,q.jsx)(`option`,{value:e.name,children:e.displayName??e.name},e.name))})]}),secondaryActions:Hn,offerFreeTier:lt,providerName:Rt.name,keyUrl:Rt.keyUrl,modelHint:Rt.modelHint,onSaved:()=>{jt(!1),r()}},Rt.name)}):(0,q.jsx)(`p`,{className:`max-w-prose text-copy-14 text-secondary`,children:Le.length>0?`This project's provider selection is ${Le.join(`, `)}. Configure an allowed provider in Settings, or change the selection in project Settings.`:`Provider configuration is unavailable here. Open Settings to connect an answer engine, then check again.`}):null,(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(at===!0||ct)&&!At&&Rt?(0,q.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`-ml-3 text-button-14`,onClick:()=>jt(!0),children:`Use a different provider`}):null,!Rt||tt===!0?(0,q.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsx)(V,{to:`/settings`,target:`_blank`,rel:`noopener noreferrer`,children:`Open provider settings`})}):null,!Wn&&!ut?Hn:null]})]}):(0,q.jsxs)(`section`,{"aria-labelledby":`setup-provider-heading`,className:`space-y-2 border-b border-default pb-6 mb-6`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,q.jsx)(`h2`,{id:`setup-provider-heading`,className:`text-heading-20 text-heading`,children:`AI engines`}),Qe?null:(0,q.jsxs)(`span`,{role:`status`,className:`flex items-center gap-2`,children:[(0,q.jsx)(En,{tone:at===!0?`positive`:`neutral`,children:at===!0?`Ready`:at===!1?`Not connected`:`Checking`}),(0,q.jsx)(kr,{text:at===!0?`An AI engine is available for this project. An administrator manages provider settings.`:at===!1?`Ask an administrator to connect an AI engine for this project. You can save queries now.`:`Checking for a connected AI engine. An administrator manages provider settings. You can save queries now.`})]})]}),Qe?(0,q.jsx)(`p`,{role:`alert`,className:`text-copy-14 text-negative`,children:`Provider readiness could not be checked. Try again.`}):null,(0,q.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:hf,disabled:Ye.isFetching,onClick:()=>{Ye.refetch()},children:Qe?`Retry provider check`:`Check again`})]}):null,Kn=(()=>{switch(ie){case 0:return(0,q.jsxs)(Pr,{className:`surface-card step-card`,children:[(0,q.jsx)(`div`,{className:`section-head`,children:(0,q.jsx)(`div`,{children:(0,q.jsx)(`h2`,{children:`System check`})})}),(0,q.jsx)(`p`,{className:`supporting-copy`,children:`Checking that your Canonry instance is configured and reachable.`}),(0,q.jsx)(`div`,{className:`compact-stack`,children:d.healthChecks.map(e=>(0,q.jsxs)(`div`,{className:`health-check-row`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`run-row-title`,children:e.label}),(0,q.jsx)(`p`,{className:`supporting-copy`,children:e.id===`provider`&&f?`OpenRouter connected. Choose models before your first check.`:e.detail}),e.id===`provider`&&e.state!==`ready`&&(0,q.jsxs)(`div`,{className:`mt-3 material-base p-3 space-y-2`,children:[(0,q.jsxs)(`p`,{className:`text-copy-13 text-secondary`,children:[`Paste a Gemini key to enable visibility checks (free at`,` `,(0,q.jsx)(`a`,{href:`https://aistudio.google.com/apikey`,target:`_blank`,rel:`noreferrer`,className:`text-positive-400 hover:text-positive underline underline-offset-2`,children:`aistudio.google.com`}),`).`]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`password`,value:pn,onChange:e=>mn(e.target.value),placeholder:`AI... (paste here)`,className:`flex-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-14-mono text-heading placeholder:text-faint focus:border-mono-600 focus:outline-none`,disabled:gn}),(0,q.jsx)(G,{type:`button`,size:`sm`,disabled:gn||!pn.trim(),onClick:er(Pn),children:gn?`Saving...`:`Save`})]}),vn&&(0,q.jsxs)(`div`,{role:`alert`,className:`space-y-1 text-label-12 text-negative`,children:[(0,q.jsx)(`p`,{children:vn}),(0,q.jsx)(`p`,{children:`Check that the key is complete, then retry Save.`})]}),(0,q.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[`Connect more answer engines later in`,` `,(0,q.jsx)(V,{to:`/settings`,className:`text-link hover:underline`,children:`Settings`}),`.`]}),c.providerStatuses.some(e=>e.name===`openrouter`)&&(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{className:`min-h-11 cursor-pointer py-3 text-label-14 text-link`,children:`Connect OpenRouter`}),(0,q.jsx)(Od,{providerName:`openrouter`,compact:!0,keyUrl:c.providerStatuses.find(e=>e.name===`openrouter`)?.keyUrl,onSaved:()=>{r()}})]})]})]}),(0,q.jsx)(En,{tone:e.state===`ready`?`positive`:`caution`,title:e.id===`api`?bi(u.apiStatus):e.id===`worker`?bi(u.workerStatus):e.detail,children:e.state===`ready`?`Ready`:`Attention`})]},e.id))}),(0,q.jsxs)(`div`,{className:`setup-nav`,children:[d.launchState.blockedReason?(0,q.jsx)(`p`,{role:`status`,className:`supporting-copy text-negative`,children:d.launchState.blockedReason}):(0,q.jsx)(`span`,{}),(0,q.jsx)(G,{type:`button`,disabled:!p,title:d.launchState.blockedReason,onClick:()=>{y({flowVersion:1,onboardingSessionId:_,event:`onboarding.step_completed`,step:`system`,method:`automatic`},`onboarding.step_completed:system`),N(ne)},children:`Continue`})]})]});case 1:return(0,q.jsxs)(Pr,{className:`surface-card step-card`,children:[(0,q.jsxs)(`div`,{className:`section-head`,children:[(0,q.jsx)(`div`,{children:(0,q.jsx)(`h2`,{children:`Create project`})}),R?(0,q.jsx)(En,{tone:`positive`,children:`Created`}):null]}),R?(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsxs)(`p`,{className:`text-neutral`,children:[`Project `,(0,q.jsx)(`span`,{className:`text-heading text-label-14-strong`,children:R}),` created successfully.`]}),(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:Ln,children:`Back`}),(0,q.jsx)(G,{type:`button`,onClick:()=>Rn(`project`,2),children:`Continue`})]})]}):(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsxs)(`div`,{className:`setup-field`,children:[(0,q.jsx)(`label`,{className:`setup-label`,htmlFor:`project-name`,children:`Project name`}),(0,q.jsx)(`input`,{id:`project-name`,className:`setup-input`,type:`text`,placeholder:`my-website`,value:se,onChange:e=>ce(e.target.value)}),bn&&bn!==se?(0,q.jsxs)(`p`,{className:`supporting-copy`,children:[`Slug: `,bn]}):null]}),(0,q.jsxs)(`div`,{className:`setup-field`,children:[(0,q.jsx)(`label`,{className:`setup-label`,htmlFor:`display-name`,children:`Display name (optional)`}),(0,q.jsx)(`input`,{id:`display-name`,className:`setup-input`,type:`text`,placeholder:`My Website`,value:le,onChange:e=>ue(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`setup-field`,children:[(0,q.jsx)(`label`,{className:`setup-label`,htmlFor:`domain`,children:`Canonical domain`}),(0,q.jsx)(`input`,{id:`domain`,className:`setup-input`,type:`text`,placeholder:`example.com`,value:F,onChange:e=>de(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`setup-field-row`,children:[(0,q.jsxs)(`div`,{className:`setup-field`,children:[(0,q.jsx)(`label`,{className:`setup-label`,htmlFor:`country`,children:`Country`}),(0,q.jsx)(`input`,{id:`country`,className:`setup-input`,type:`text`,placeholder:`US`,maxLength:2,value:fe,onChange:e=>I(e.target.value.toUpperCase())})]}),(0,q.jsxs)(`div`,{className:`setup-field`,children:[(0,q.jsx)(`label`,{className:`setup-label`,htmlFor:`language`,children:`Language`}),(0,q.jsx)(`input`,{id:`language`,className:`setup-input`,type:`text`,placeholder:`en`,maxLength:5,value:L,onChange:e=>pe(e.target.value.toLowerCase())})]})]}),(0,q.jsxs)(`label`,{className:`flex items-start gap-3 rounded-md border border-default bg-surface p-3 cursor-pointer hover:border-strong`,children:[(0,q.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 h-4 w-4 rounded border-strong bg-bg`,checked:me,onChange:e=>he(e.target.checked)}),(0,q.jsxs)(`span`,{className:`flex-1`,children:[(0,q.jsx)(`span`,{className:`block text-label-14 text-heading`,children:`Auto-extract backlinks`}),(0,q.jsxs)(`span`,{className:`block text-label-12 text-muted mt-0.5`,children:[`When a new Common Crawl release syncs, automatically extract backlinks for this project.`,` `,(0,q.jsx)(V,{to:`/backlinks`,className:`text-positive-400 hover:text-positive underline underline-offset-2`,children:`Manage backlinks`})]})]})]}),be?(0,q.jsx)(`p`,{className:`text-negative-400 text-copy-14`,children:be}):null,(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:Ln,children:`Back`}),(0,q.jsx)(G,{type:`button`,disabled:!bn||!F||Ce,onClick:er(kn),children:Ce?`Creating...`:`Create project`})]})]})]});case 2:return(0,q.jsxs)(Vn,{className:m?`visibility-setup-section step-card`:`surface-card step-card`,"aria-labelledby":`setup-queries-heading`,children:[(0,q.jsxs)(`div`,{className:`section-head`,children:[(0,q.jsx)(`div`,{children:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`h2`,{id:`setup-queries-heading`,children:`Add queries`}),(0,q.jsx)(kr,{text:`Queries your customers ask AI assistants, one per line. You can refine the list later.`})]})}),oe?(0,q.jsx)(En,{tone:`neutral`,children:`Loading`}):E.isError?(0,q.jsx)(En,{tone:`negative`,children:`Load failed`}):ke?(0,q.jsxs)(En,{tone:`positive`,children:[xn.length,` saved`]}):(0,q.jsxs)(En,{tone:`neutral`,children:[xn.length,` quer`,xn.length===1?`y`:`ies`]})]}),(0,q.jsxs)(`div`,{className:`space-y-2 border-b border-default pb-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsx)(`div`,{className:`min-w-0 space-y-1`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`h3`,{className:`text-heading-14 text-heading`,children:`Research queries with your agent`}),(0,q.jsx)(kr,{text:`Ask your agent to compare answers and available sources with Canonry Research, then recommend queries. Research does not change your tracked queries.`})]})}),(0,q.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,className:`shrink-0 self-start ${hf}`,onClick:er(Bt),children:Mt?`Research prompt copied`:`Copy research prompt`})]}),(0,q.jsxs)(`details`,{open:Ft||void 0,className:`text-label-14 text-secondary`,children:[(0,q.jsx)(`summary`,{className:`min-h-9 cursor-pointer py-2 text-link pointer-coarse:py-3 max-md:py-3 ${hf}`,children:`View agent prompt`}),(0,q.jsx)(`textarea`,{"aria-label":`Agent query research prompt`,readOnly:!0,className:`setup-textarea mt-2 w-full`,rows:8,value:zt})]}),Ft?(0,q.jsx)(`p`,{role:`alert`,className:`text-copy-14 text-negative`,children:`Could not copy. Select and copy the prompt above.`}):null]}),oe?(0,q.jsx)(`div`,{className:`material-base p-4 text-label-14 text-secondary`,role:`status`,children:`Loading saved queries…`}):E.isError?(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsx)(`div`,{role:`alert`,className:`rounded-md border border-negative bg-negative-soft p-3 text-label-14 text-negative`,children:`Saved queries could not be loaded. Retry before changing the query basket.`}),(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:m?Te:Ln,children:`Back`}),(0,q.jsx)(G,{type:`button`,onClick:()=>{E.refetch()},children:`Retry loading queries`})]})]}):ke?(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsx)(`ul`,{className:`detail-list`,children:xn.map(e=>(0,q.jsx)(`li`,{children:e},e))}),(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:m?Te:Ln,children:`Back`}),(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:()=>Ae(!1),children:`Edit queries`}),(0,q.jsx)(G,{type:`button`,onClick:()=>Rn(`queries`,m?4:3,xn.length),children:`Continue`})]})]}):(0,q.jsxs)(`div`,{className:`compact-stack`,children:[H.length>0?(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-muted text-label-12 normal-case`,children:[(0,q.jsx)(`span`,{className:`flex-1 border-t border-base`}),`auto-generate`,(0,q.jsx)(`span`,{className:`flex-1 border-t border-base`})]}),(0,q.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,q.jsxs)(`div`,{className:`setup-field flex-1`,children:[(0,q.jsx)(`label`,{className:`setup-label`,htmlFor:`gen-provider`,children:`Provider`}),(0,q.jsx)(`select`,{id:`gen-provider`,className:`setup-input`,value:gt,onChange:e=>_t(e.target.value),children:H.map(e=>(0,q.jsxs)(`option`,{value:e.name,children:[e.displayName??e.name,e.model&&!Pt(e.name)?` (${e.model})`:``]},e.name))})]}),(0,q.jsxs)(`div`,{className:`setup-field`,children:[(0,q.jsx)(`label`,{className:`setup-label`,htmlFor:`gen-count`,children:`Count`}),(0,q.jsx)(`select`,{id:`gen-count`,className:`setup-input`,value:yt,onChange:e=>bt(Number(e.target.value)),children:[3,5,10,15,20].map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))})]}),(0,q.jsx)(G,{type:`button`,variant:`outline`,disabled:xt||!gt,onClick:er(jn),children:xt?`Analyzing site...`:`Generate`})]}),Ct?(0,q.jsx)(`p`,{className:`text-negative-400 text-copy-14`,children:Ct}):null]}):null,m?null:(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-muted text-label-12 normal-case`,children:[(0,q.jsx)(`span`,{className:`flex-1 border-t border-base`}),`or type manually`,(0,q.jsx)(`span`,{className:`flex-1 border-t border-base`})]}),(0,q.jsxs)(`div`,{className:`setup-field`,children:[(0,q.jsx)(`label`,{className:`setup-label`,htmlFor:`queries`,children:`Queries (one per line)`}),(0,q.jsx)(`textarea`,{id:`queries`,className:`setup-textarea`,rows:6,placeholder:`emergency dentist brooklyn
42
42
  best invisalign downtown brooklyn
43
43
  pediatric dentist brooklyn heights`,value:De,onChange:e=>Oe(e.target.value)})]}),je?(0,q.jsx)(`p`,{className:`text-negative-400 text-copy-14`,children:je}):null,(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:m?Te:Ln,children:`Back`}),(0,q.jsx)(G,{type:`button`,variant:`ghost`,onClick:zn,children:m?`Finish without AI Visibility`:`Skip for now`}),(0,q.jsx)(G,{type:`button`,disabled:xn.length===0||Ne,onClick:er(An),children:Ne?`Saving...`:`Save ${xn.length} quer${xn.length===1?`y`:`ies`}`})]})]})]});case 3:return(0,q.jsxs)(Pr,{className:`surface-card step-card`,children:[(0,q.jsxs)(`div`,{className:`section-head`,children:[(0,q.jsx)(`div`,{children:(0,q.jsx)(`h2`,{children:`Add competitors`})}),Wt?(0,q.jsx)(En,{tone:`positive`,children:`Saved`}):null]}),(0,q.jsx)(`p`,{className:`supporting-copy`,children:`Optional. Domains that compete for the same queries, one per line. You can add them later from the project.`}),Wt?(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsx)(`ul`,{className:`detail-list`,children:Sn.map(e=>(0,q.jsx)(`li`,{children:e},e))}),(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:Ln,children:`Back`}),(0,q.jsx)(G,{type:`button`,onClick:()=>Rn(`competitors`,4,Sn.length),children:`Continue`})]})]}):(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsxs)(`div`,{className:`setup-field`,children:[(0,q.jsx)(`label`,{className:`setup-label`,htmlFor:`competitors`,children:`Competitor domains (one per line)`}),(0,q.jsx)(`textarea`,{id:`competitors`,className:`setup-textarea`,rows:4,placeholder:`competitor1.com
44
- competitor2.com`,value:Vt,onChange:e=>Ut(e.target.value)})]}),qt?(0,q.jsx)(`p`,{className:`text-negative-400 text-copy-14`,children:qt}):null,(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:Ln,children:`Back`}),(0,q.jsx)(`div`,{className:`flex gap-2`,children:Sn.length===0?(0,q.jsx)(G,{type:`button`,onClick:Bn,children:`Continue without competitors`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:Bn,children:`Skip`}),(0,q.jsx)(G,{type:`button`,disabled:Yt,onClick:er(Nn),children:Yt?`Saving...`:`Save ${Sn.length} competitor${Sn.length===1?``:`s`}`})]})})]})]})]});case 4:{let e=fn.data,t=e?.status??(cn===A?.id?A.status:void 0),n=t===`completed`||t===`partial`||t===`failed`||t===`cancelled`,r=e?.snapshots??[],i=e?.queryCounts,a=t?vf(t,r.length):!1,c=ee&&!en,u=an??(e?.error?Yn(e.error):t===`cancelled`?`The check was cancelled before it produced a baseline.`:(t===`completed`||t===`partial`)&&r.length===0?`The check finished without producing any snapshots.`:A?.statusDetail||`The check did not produce a baseline.`),d=null;return c||a?d=(0,q.jsx)(En,{tone:`positive`,children:`Complete`}):an&&!en?d=(0,q.jsx)(En,{tone:`negative`,children:`Failed`}):n?d=(0,q.jsx)(En,{tone:`negative`,children:t===`cancelled`?`Cancelled`:`Failed`}):en&&(d=(0,q.jsx)(En,{tone:`caution`,children:`Running`})),(0,q.jsxs)(Pr,{className:`surface-card step-card`,children:[(0,q.jsxs)(`div`,{className:`section-head`,children:[(0,q.jsx)(`div`,{children:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`h2`,{children:He()?`AI Visibility`:`Run your first AI Visibility check`}),He()?null:(0,q.jsx)(kr,{text:`Asks each AI engine your queries and records whether ${R??`your site`} is mentioned and cited. It uses your provider account. You can also finish now and run it later from the project.`})]})}),d]}),c?(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsxs)(`p`,{className:`text-secondary`,children:[`Setup is complete. `,(0,q.jsx)(`span`,{className:`text-strong text-label-14-strong`,children:R}),` already has a successful answer-visibility baseline.`]}),(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(`span`,{}),(0,q.jsx)(G,{type:`button`,onClick:()=>B(),children:o?`Finish setup`:`Open project dashboard →`})]})]}):!en&&He()?(0,q.jsxs)(`div`,{className:`compact-stack`,children:[R?(0,q.jsx)(nc,{projectName:R}):(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:Xs}),an&&(0,q.jsx)(`p`,{role:`alert`,className:`text-copy-14 text-negative`,children:an}),(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(`span`,{}),(0,q.jsx)(G,{type:`button`,onClick:Te,children:`Open project dashboard →`})]})]}):en?n?a?(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsxs)(`p`,{className:`text-neutral`,children:[`Check complete. Your first AI Visibility snapshot for`,` `,(0,q.jsx)(`span`,{className:`text-heading text-label-14-strong`,children:R}),`:`]}),(0,q.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 mt-1`,children:[(0,q.jsxs)(`div`,{className:`material-base p-3`,children:[(0,q.jsx)(`p`,{className:`text-copy-13-strong text-secondary`,children:`Mentioned`}),(0,q.jsx)(`p`,{className:`text-copy-24-strong tabular-nums text-primary mt-1`,children:i?(0,q.jsxs)(q.Fragment,{children:[i.mentionedQueries,(0,q.jsxs)(`span`,{className:`text-faint text-label-18`,children:[` / `,i.totalQueries]})]}):`Unavailable`}),(0,q.jsx)(`p`,{className:`mt-0.5 text-copy-14 text-secondary`,children:`queries naming your brand`})]}),(0,q.jsxs)(`div`,{className:`material-base p-3`,children:[(0,q.jsx)(`p`,{className:`text-copy-13-strong text-secondary`,children:`Cited`}),(0,q.jsx)(`p`,{className:`text-copy-24-strong tabular-nums text-primary mt-1`,children:i?(0,q.jsxs)(q.Fragment,{children:[i.citedQueries,(0,q.jsxs)(`span`,{className:`text-faint text-label-18`,children:[` / `,i.totalQueries]})]}):`Unavailable`}),(0,q.jsx)(`p`,{className:`mt-0.5 text-copy-14 text-secondary`,children:`queries citing your site`})]}),(0,q.jsxs)(`div`,{className:`material-base p-3`,children:[(0,q.jsx)(`p`,{className:`text-copy-13-strong text-secondary`,children:`Results`}),(0,q.jsx)(`p`,{className:`text-copy-24-strong tabular-nums text-primary mt-1`,children:r.length}),(0,q.jsx)(`p`,{className:`mt-0.5 text-copy-14 text-secondary`,children:`completed engine checks`})]})]}),!s&&R?(0,q.jsx)(Dd,{projectName:R}):null,(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(`span`,{}),(0,q.jsx)(G,{type:`button`,onClick:()=>B(),children:o?`Finish setup`:`Open project dashboard →`})]})]}):(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-negative bg-negative-soft p-3 text-label-14 text-negative`,children:[(0,q.jsx)(`p`,{children:u}),(0,q.jsx)(`p`,{className:`mt-1 text-copy-13 text-secondary`,children:He()?Xs:l?`Fix provider or query configuration if needed, then retry without leaving setup.`:`Ask an administrator to review the provider and query configuration.`})]}),(0,q.jsxs)(`div`,{className:`setup-nav`,children:[l&&!He()?(0,q.jsx)(G,{type:`button`,variant:`outline`,asChild:!0,children:(0,q.jsx)(V,{to:`/settings`,children:`Configure providers`})}):(0,q.jsx)(`span`,{}),He()||!l?(0,q.jsx)(G,{type:`button`,onClick:Te,children:`Open project dashboard →`}):(0,q.jsx)(G,{type:`button`,disabled:nn||!!Tn,onClick:er(In),children:nn?`Retrying…`:`Retry check`})]})]}):(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsx)(`p`,{className:`text-neutral`,children:`Check running. This usually takes 30 to 60 seconds.`}),(0,q.jsx)(`div`,{className:`material-base p-3 text-label-12 text-muted`,children:(0,q.jsxs)(`p`,{children:[`Status: `,(0,q.jsx)(`span`,{className:`text-neutral`,children:t??`queued`})]})}),fn.isError&&(0,q.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-negative bg-negative-soft p-3 text-label-14 text-negative`,children:[(0,q.jsx)(`p`,{children:fn.error instanceof Error?fn.error.message:`Could not refresh the check status.`}),(0,q.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,className:`mt-2`,onClick:()=>{fn.refetch()},children:`Retry status check`})]}),(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(`span`,{}),(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:o?()=>B():Te,children:o?`Finish setup`:`Watch on project page`})]})]}):(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[(0,q.jsx)(`span`,{className:`font-mono tabular-nums text-heading`,children:xn.length}),` `,xn.length===1?`query`:`queries`,mt>0?(0,q.jsxs)(q.Fragment,{children:[` · `,(0,q.jsx)(`span`,{className:`font-mono tabular-nums text-heading`,children:mt}),` `,mt===1?`engine`:`engines`]}):null]}),(Tn||an)&&(0,q.jsx)(`div`,{role:`alert`,className:`rounded-md border border-negative bg-negative-soft p-3 text-label-14 text-negative`,children:(0,q.jsx)(`p`,{children:an??Tn})}),(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:Ln,children:`Back`}),(0,q.jsx)(G,{type:`button`,variant:`ghost`,onClick:Ee,children:`Finish without running`}),wn===`no_provider`&&!m?(0,q.jsx)(G,{type:`button`,asChild:!0,children:(0,q.jsx)(V,{to:`/settings`,children:`Configure a provider`})}):(0,q.jsx)(G,{type:`button`,disabled:nn||!!Tn,title:Tn,onClick:er(In),children:nn?`Starting…`:an?`Retry check`:`Run check`})]})]})]})}default:return null}})();return(0,q.jsxs)(`div`,{className:m?`page-container visibility-setup`:`page-container`,children:[o?(0,q.jsx)(Td,{current:`visibility`,outcomes:{site:T,fixes:T}}):null,(0,q.jsxs)(`div`,{className:`page-header`,children:[(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{ref:i?a:void 0,tabIndex:i?-1:void 0,className:`page-title outline-none`,children:i?`Set up AI Visibility`:`Setup`}),(0,q.jsx)(`p`,{className:`page-subtitle`,children:i?`Connect an AI engine, then choose queries for your first check.`:`Create a project and run its first visibility check.`})]}),o?(0,q.jsx)(`div`,{className:`page-header-right`,children:(0,q.jsx)(G,{type:`button`,variant:`outline`,className:hf,onClick:Ee,children:`Skip AI Visibility`})}):null]}),o?null:(0,q.jsx)(Sf,{current:m?+(ie===4):ie,labels:m?_f:gf}),(0,q.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-2 text-label-13 text-secondary`,children:[(0,q.jsx)(`p`,{children:`Draft fields use tab storage when available. Credentials are excluded from drafts.`}),(0,q.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:!!C&&!E.isSuccess||Ce||Ne||Yt||nn,onClick:Zt,children:`Reset unsaved fields`})]}),(0,q.jsxs)(`section`,{className:`setup-wizard`,children:[Gn,ie===4&&!en&&l&&f&&ve&&!ut&&(0,q.jsx)(qd,{project:ve,onSave:Fn}),Kn]})]})}var Ef=`modulepreload`,Df=function(e,t){return new URL(e,t).href},Of={},kf=function(e){return e.pathname.endsWith(`.css`)},Af=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},jf=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Df(t,n);let r=s(t),i=kf(r);return Af(Of,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Ef,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Mf=(0,K.lazy)(async()=>({default:(await jf(()=>import(`./SiteHealthSection-DuUE1cB0.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url)).SiteHealthSection})),Nf=`Public pages only, crawled from this computer and stored locally. The first scan reads up to 100 pages, then stops.`,Pf=1800,Ff=`https://github.com/Canonry/canonry#or-use-any-shell-capable-coding-agent`,If=`Use the official Canonry docs:
44
+ competitor2.com`,value:Vt,onChange:e=>Ut(e.target.value)})]}),qt?(0,q.jsx)(`p`,{className:`text-negative-400 text-copy-14`,children:qt}):null,(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:Ln,children:`Back`}),(0,q.jsx)(`div`,{className:`flex gap-2`,children:Sn.length===0?(0,q.jsx)(G,{type:`button`,onClick:Bn,children:`Continue without competitors`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:Bn,children:`Skip`}),(0,q.jsx)(G,{type:`button`,disabled:Yt,onClick:er(Nn),children:Yt?`Saving...`:`Save ${Sn.length} competitor${Sn.length===1?``:`s`}`})]})})]})]})]});case 4:{let e=fn.data,t=e?.status??(cn===A?.id?A.status:void 0),n=t===`completed`||t===`partial`||t===`failed`||t===`cancelled`,r=e?.snapshots??[],i=e?.queryCounts,a=t?vf(t,r.length):!1,c=ee&&!en,u=an??(e?.error?Yn(e.error):t===`cancelled`?`The check was cancelled before it produced a baseline.`:(t===`completed`||t===`partial`)&&r.length===0?`The check finished without producing any snapshots.`:A?.statusDetail||`The check did not produce a baseline.`),d=null;return c||a?d=(0,q.jsx)(En,{tone:`positive`,children:`Complete`}):an&&!en?d=(0,q.jsx)(En,{tone:`negative`,children:`Failed`}):n?d=(0,q.jsx)(En,{tone:`negative`,children:t===`cancelled`?`Cancelled`:`Failed`}):en&&(d=(0,q.jsx)(En,{tone:`caution`,children:`Running`})),(0,q.jsxs)(Pr,{className:`surface-card step-card`,children:[(0,q.jsxs)(`div`,{className:`section-head`,children:[(0,q.jsx)(`div`,{children:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`h2`,{children:He()?`AI Visibility`:`Run your first AI Visibility check`}),He()?null:(0,q.jsx)(kr,{text:`Asks each AI engine your queries and records whether ${R??`your site`} is mentioned and cited. It uses your provider account. You can also finish now and run it later from the project.`})]})}),d]}),c?(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsxs)(`p`,{className:`text-secondary`,children:[`Setup is complete. `,(0,q.jsx)(`span`,{className:`text-strong text-label-14-strong`,children:R}),` already has a successful answer-visibility baseline.`]}),(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(`span`,{}),(0,q.jsx)(G,{type:`button`,onClick:()=>B(),children:o?`Finish setup`:`Open project dashboard →`})]})]}):!en&&He()?(0,q.jsxs)(`div`,{className:`compact-stack`,children:[R?(0,q.jsx)(nc,{projectName:R}):(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:Xs}),an&&(0,q.jsx)(`p`,{role:`alert`,className:`text-copy-14 text-negative`,children:an}),(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(`span`,{}),(0,q.jsx)(G,{type:`button`,onClick:Te,children:`Open project dashboard →`})]})]}):en?n?a?(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsxs)(`p`,{className:`text-neutral`,children:[`Check complete. Your first AI Visibility snapshot for`,` `,(0,q.jsx)(`span`,{className:`text-heading text-label-14-strong`,children:R}),`:`]}),(0,q.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 mt-1`,children:[(0,q.jsxs)(`div`,{className:`material-base p-3`,children:[(0,q.jsx)(`p`,{className:`text-copy-13-strong text-secondary`,children:`Mentioned`}),(0,q.jsx)(`p`,{className:`text-copy-24-strong tabular-nums text-primary mt-1`,children:i?(0,q.jsxs)(q.Fragment,{children:[i.mentionedQueries,(0,q.jsxs)(`span`,{className:`text-faint text-label-18`,children:[` / `,i.totalQueries]})]}):`Unavailable`}),(0,q.jsx)(`p`,{className:`mt-0.5 text-copy-14 text-secondary`,children:`queries naming your brand`})]}),(0,q.jsxs)(`div`,{className:`material-base p-3`,children:[(0,q.jsx)(`p`,{className:`text-copy-13-strong text-secondary`,children:`Cited`}),(0,q.jsx)(`p`,{className:`text-copy-24-strong tabular-nums text-primary mt-1`,children:i?(0,q.jsxs)(q.Fragment,{children:[i.citedQueries,(0,q.jsxs)(`span`,{className:`text-faint text-label-18`,children:[` / `,i.totalQueries]})]}):`Unavailable`}),(0,q.jsx)(`p`,{className:`mt-0.5 text-copy-14 text-secondary`,children:`queries citing your site`})]}),(0,q.jsxs)(`div`,{className:`material-base p-3`,children:[(0,q.jsx)(`p`,{className:`text-copy-13-strong text-secondary`,children:`Results`}),(0,q.jsx)(`p`,{className:`text-copy-24-strong tabular-nums text-primary mt-1`,children:r.length}),(0,q.jsx)(`p`,{className:`mt-0.5 text-copy-14 text-secondary`,children:`completed engine checks`})]})]}),!s&&R?(0,q.jsx)(Dd,{projectName:R}):null,(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(`span`,{}),(0,q.jsx)(G,{type:`button`,onClick:()=>B(),children:o?`Finish setup`:`Open project dashboard →`})]})]}):(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-negative bg-negative-soft p-3 text-label-14 text-negative`,children:[(0,q.jsx)(`p`,{children:u}),(0,q.jsx)(`p`,{className:`mt-1 text-copy-13 text-secondary`,children:He()?Xs:l?`Fix provider or query configuration if needed, then retry without leaving setup.`:`Ask an administrator to review the provider and query configuration.`})]}),(0,q.jsxs)(`div`,{className:`setup-nav`,children:[l&&!He()?(0,q.jsx)(G,{type:`button`,variant:`outline`,asChild:!0,children:(0,q.jsx)(V,{to:`/settings`,children:`Configure providers`})}):(0,q.jsx)(`span`,{}),He()||!l?(0,q.jsx)(G,{type:`button`,onClick:Te,children:`Open project dashboard →`}):(0,q.jsx)(G,{type:`button`,disabled:nn||!!Tn,onClick:er(In),children:nn?`Retrying…`:`Retry check`})]})]}):(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsx)(`p`,{className:`text-neutral`,children:`Check running. This usually takes 30 to 60 seconds.`}),(0,q.jsx)(`div`,{className:`material-base p-3 text-label-12 text-muted`,children:(0,q.jsxs)(`p`,{children:[`Status: `,(0,q.jsx)(`span`,{className:`text-neutral`,children:t??`queued`})]})}),fn.isError&&(0,q.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-negative bg-negative-soft p-3 text-label-14 text-negative`,children:[(0,q.jsx)(`p`,{children:fn.error instanceof Error?fn.error.message:`Could not refresh the check status.`}),(0,q.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,className:`mt-2`,onClick:()=>{fn.refetch()},children:`Retry status check`})]}),(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(`span`,{}),(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:o?()=>B():Te,children:o?`Finish setup`:`Watch on project page`})]})]}):(0,q.jsxs)(`div`,{className:`compact-stack`,children:[(0,q.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[(0,q.jsx)(`span`,{className:`font-mono tabular-nums text-heading`,children:xn.length}),` `,xn.length===1?`query`:`queries`,mt>0?(0,q.jsxs)(q.Fragment,{children:[` · `,(0,q.jsx)(`span`,{className:`font-mono tabular-nums text-heading`,children:mt}),` `,mt===1?`engine`:`engines`]}):null]}),(Tn||an)&&(0,q.jsx)(`div`,{role:`alert`,className:`rounded-md border border-negative bg-negative-soft p-3 text-label-14 text-negative`,children:(0,q.jsx)(`p`,{children:an??Tn})}),(0,q.jsxs)(`div`,{className:`setup-nav`,children:[(0,q.jsx)(G,{type:`button`,variant:`outline`,onClick:Ln,children:`Back`}),(0,q.jsx)(G,{type:`button`,variant:`ghost`,onClick:Ee,children:`Finish without running`}),wn===`no_provider`&&!m?(0,q.jsx)(G,{type:`button`,asChild:!0,children:(0,q.jsx)(V,{to:`/settings`,children:`Configure a provider`})}):(0,q.jsx)(G,{type:`button`,disabled:nn||!!Tn,title:Tn,onClick:er(In),children:nn?`Starting…`:an?`Retry check`:`Run check`})]})]})]})}default:return null}})();return(0,q.jsxs)(`div`,{className:m?`page-container visibility-setup`:`page-container`,children:[o?(0,q.jsx)(Td,{current:`visibility`,outcomes:{site:T,fixes:T}}):null,(0,q.jsxs)(`div`,{className:`page-header`,children:[(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{ref:i?a:void 0,tabIndex:i?-1:void 0,className:`page-title outline-none`,children:i?`Set up AI Visibility`:`Setup`}),(0,q.jsx)(`p`,{className:`page-subtitle`,children:i?`Connect an AI engine, then choose queries for your first check.`:`Create a project and run its first visibility check.`})]}),o?(0,q.jsx)(`div`,{className:`page-header-right`,children:(0,q.jsx)(G,{type:`button`,variant:`outline`,className:hf,onClick:Ee,children:`Skip AI Visibility`})}):null]}),o?null:(0,q.jsx)(Sf,{current:m?+(ie===4):ie,labels:m?_f:gf}),(0,q.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-2 text-label-13 text-secondary`,children:[(0,q.jsx)(`p`,{children:`Draft fields use tab storage when available. Credentials are excluded from drafts.`}),(0,q.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:!!C&&!E.isSuccess||Ce||Ne||Yt||nn,onClick:Zt,children:`Reset unsaved fields`})]}),(0,q.jsxs)(`section`,{className:`setup-wizard`,children:[Gn,ie===4&&!en&&l&&f&&ve&&!ut&&(0,q.jsx)(qd,{project:ve,onSave:Fn}),Kn]})]})}var Ef=`modulepreload`,Df=function(e,t){return new URL(e,t).href},Of={},kf=function(e){return e.pathname.endsWith(`.css`)},Af=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},jf=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Df(t,n);let r=s(t),i=kf(r);return Af(Of,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Ef,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Mf=(0,K.lazy)(async()=>({default:(await jf(()=>import(`./SiteHealthSection-B2YibqCs.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url)).SiteHealthSection})),Nf=`Public pages only, crawled from this computer and stored locally. The first scan reads up to 100 pages, then stops.`,Pf=1800,Ff=`https://github.com/Canonry/canonry#or-use-any-shell-capable-coding-agent`,If=`Use the official Canonry docs:
45
45
  - Agent quickstart: https://github.com/Canonry/canonry#or-use-any-shell-capable-coding-agent
46
46
  - CLI reference: https://github.com/Canonry/canonry/blob/main/skills/canonry/references/canonry-cli.md
47
47
  - Plugin setup: https://github.com/Canonry/canonry/blob/main/docs/plugins.md
@@ -57,4 +57,4 @@ ${If}Pick one path and stay on it. Use connected Canonry tools (plugin or MCP) o
57
57
  4. List projects with the connected project tool or \`cnry project list --format json\`, and reuse one whose domain matches. Confirm the proposed name is not already assigned to a different domain. To find out whether a project has already been scanned, run \`cnry technical-aeo score <project> --format json\` with no \`--run-id\`, which reports the latest run. Read the \`hasData\` field, not the score: this command exits 0 and reports \`aggregateScore: 0\` for a project that has never been scanned, so reading the score alone would have you tell me my site scored zero. If \`hasData\` is true and \`runStatus\` is \`completed\` or \`partial\`, read that scan instead of starting a new one. If no project matches, show the exact create operation and wait for approval.
58
58
  5. Propose a bounded Site Health scan: \`--max-pages 100\` for a first look, plus whether dead-link checking is on (it is off unless you pass \`--check-dead-links\`). Show the connected operation or the exact \`cnry technical-aeo run <project> --max-pages 100 --wait --format json\` command with the project name filled in, and wait for separate approval before scanning. \`--wait\` polls for up to 15 minutes and returns only the run id and status. If the status it returns is still \`queued\` or \`running\`, the scan has not finished: do not rerun it or report results, poll \`cnry technical-aeo progress <project> --run-id <run-id> --format json\` until it is terminal. If \`--wait\` outruns your own tool timeout first, recover the run id with \`cnry technical-aeo score <project> --format json\` and poll the same way.
59
59
  6. When the run is \`completed\` or \`partial\`, read \`cnry technical-aeo crawl <project> --run-id <run-id> --format json\` first. It is the only one of these commands that carries \`termination\` and \`complete\`; the score and pages commands do not. Then read \`cnry technical-aeo score <project> --run-id <run-id> --format json\` and \`cnry technical-aeo pages <project> --run-id <run-id> --sort score-asc --limit 10 --format jsonl\`. Tell me the termination reason in plain words and whether the scan covered the whole site or stopped at a page, link, depth, or time limit. A \`partial\` run scored the pages it reached and not my site, so never present it as a full-site result. If it stopped early, the fix depends on the reason, so say which: a page or depth limit needs a larger budget, a time limit needs a smaller scan (a lower \`--max-pages\` or \`--max-depth\`). If the run failed or was cancelled, inspect the run error and stop.
60
- 7. Summarize only completed evidence, then propose AI Visibility setup. Ask before you add queries, connect providers, start a provider-backed or quota-consuming run, edit files, or publish.`;function Rf(e,t){return e===`legacy`?`legacy`:e===`platform`?`platform`:t.state===`success`?t.projectCount===0?`platform`:`legacy`:t.state===`error`?`retry`:`loading`}var zf=`pointer-coarse:min-h-11 max-md:min-h-11`,Bf=`2000-01-01T00:00:00.000Z`,$=5e3;function Vf(e,t){let n=new Set,r=new Map;for(let e of t)e.trigger!==ut.probe&&(r.has(e.projectId)||r.set(e.projectId,e.id),(e.status===H.completed||e.status===H.partial)&&n.add(e.projectId));let i=(e.every(e=>e.createdAt)?[...e].sort((e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.name.localeCompare(t.name)):e).find(e=>!n.has(e.id));return i?{projectName:i.name,runId:r.get(i.id)}:null}var Hf=[{value:`US`,label:`United States`},{value:`CA`,label:`Canada`},{value:`GB`,label:`United Kingdom`},{value:`AU`,label:`Australia`},{value:`NZ`,label:`New Zealand`},{value:`IE`,label:`Ireland`},{value:`DE`,label:`Germany`},{value:`FR`,label:`France`},{value:`ES`,label:`Spain`},{value:`IT`,label:`Italy`},{value:`NL`,label:`Netherlands`},{value:`BR`,label:`Brazil`},{value:`MX`,label:`Mexico`},{value:`IN`,label:`India`},{value:`SG`,label:`Singapore`},{value:`JP`,label:`Japan`}],Uf=[{value:`en`,label:`English`},{value:`es`,label:`Spanish`},{value:`fr`,label:`French`},{value:`de`,label:`German`},{value:`it`,label:`Italian`},{value:`pt`,label:`Portuguese`},{value:`nl`,label:`Dutch`},{value:`ja`,label:`Japanese`}];function Wf(e,t){try{let n=new Intl.DisplayNames([`en`],{type:`region`}),r=new Intl.DisplayNames([`en`],{type:`language`}),i=e.length===2?n.of(e.toUpperCase()):void 0,a=t?r.of(t.toLowerCase()):void 0;return`${i??(e||`Country`)} · ${a??(t||`Language`)}`}catch{return`${e||`Country`} · ${t||`Language`}`}}function Gf(e,t){let n=e.trim().toUpperCase(),r=t.trim().toLowerCase();return{countryValid:Hf.some(e=>e.value===n),languageValid:Uf.some(e=>e.value===r)}}function Kf(e){let t=e.replace(/^\[|\]$/g,``);return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(t)||t.includes(`:`)}function qf(e){let t=e.trim();if(!t)return null;let n=/^[a-z][a-z\d+.-]*:\/\//i.test(t)?t:`https://${t}`,r;try{r=new URL(n)}catch{return null}if(r.protocol!==`http:`&&r.protocol!==`https:`)return null;let i=r.hostname.toLowerCase().replace(/^www\./,``);if(!i||i===`localhost`||Kf(i)||!i.includes(`.`))return null;let a=i.replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);return a?{canonicalDomain:i,projectName:a,displayName:i}:null}async function Jf(e,t=Pf){let n,r=new Promise(e=>{n=setTimeout(()=>e({state:`timed-out`}),t)}),i=await Promise.race([e.then(e=>({state:`queued`,run:e})),r]);return n&&clearTimeout(n),i}function Yf(e,t){e.catch(()=>{rr({title:`Site Health scan did not start`,detail:`The project is safe. Choose Run scan in Site Health to retry.`,tone:`negative`,dedupeKey:`site-health-dispatch:${t}`})})}function Xf(e){let t=(0,K.useRef)(ot()).current,n=(0,K.useRef)(new Set);return{onboardingSessionId:t,emit:(0,K.useCallback)((t,r)=>{if(r){if(n.current.has(r))return;n.current.add(r)}st({...t,surface:e,eventId:sn()})},[e])}}function Zf(e,t){return e instanceof Ut&&e.statusCode===409?`A project with this name already exists. Change the project name, or open the existing project.`:e instanceof Error&&e.message?e.message:t}function Qf(){return(0,q.jsxs)(`div`,{className:`page-container max-w-3xl`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,q.jsx)(`div`,{className:`page-header`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`Preparing setup`}),(0,q.jsx)(`p`,{className:`page-subtitle`,children:`Checking the projects already on this install.`})]})}),(0,q.jsxs)(`div`,{className:`flex items-center gap-3 material-base p-4 text-label-14 text-secondary`,role:`status`,children:[(0,q.jsx)(m,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),`Loading projects…`]})]})}function $f({onRetry:e}){return(0,q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,q.jsx)(`div`,{className:`page-header`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`Can’t load projects`}),(0,q.jsx)(`p`,{className:`page-subtitle`,children:`Canonry could not confirm whether this install already has a project.`})]})}),(0,q.jsxs)(`div`,{className:`rounded-md border border-negative bg-negative-soft p-4`,role:`alert`,tabIndex:-1,children:[(0,q.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:`Setup is paused to protect existing projects.`}),(0,q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:`Check the connection or sign in again, then retry.`}),(0,q.jsx)(G,{type:`button`,className:`mt-4`,variant:`secondary`,onClick:e,children:`Retry project check`})]})]})}function ep({projectName:e,initialRunId:t}){return(0,q.jsx)(Nl,{title:`Site Health setup`,children:(0,q.jsx)(tp,{projectName:e,initialRunId:t})})}function tp({projectName:e,initialRunId:t}){let n=Se(),r=z({...yr({client:W}),enabled:!!e,retry:!1,refetchOnMount:`always`}),{onboardingSessionId:i,emit:a}=Xf(`site_health`),[o]=(0,K.useState)(()=>ct(t));(0,K.useEffect)(()=>{o&&Ie()},[o]),(0,K.useEffect)(()=>{e&&a({flowVersion:1,onboardingSessionId:i,event:`onboarding.started`,step:`run`,resumed:!!t&&!o},`onboarding.started`)},[a,o,t,i,e]),(0,K.useEffect)(()=>{e&&t&&kt(e)?.runId!==t&&it(e,t)},[t,e]);let s=z({...Sr({client:W,path:{id:t??``}}),enabled:!!t,refetchInterval:({state:e})=>{let t=e.data?.status;return t===`completed`||t===`partial`||t===`failed`||t===`cancelled`?!1:2e3},refetchIntervalInBackground:!0}).data?.status;if((0,K.useEffect)(()=>{if(!e||!t||!s)return;if(s===`completed`||s===`partial`){a({flowVersion:1,onboardingSessionId:i,event:`onboarding.step_completed`,step:`run`,method:`automatic`},`onboarding.step_completed:run`),et(t);return}if(s!==`failed`&&s!==`cancelled`)return;let n=s===`cancelled`?`run_cancelled`:`run_failed`;a({flowVersion:1,onboardingSessionId:i,event:`onboarding.blocked`,step:`run`,action:`retry_run`,reasonCode:n},`onboarding.blocked:run:${n}`),et(t)},[a,t,i,e,s]),!e)return(0,q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,q.jsx)(`div`,{className:`page-header`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`Project not found`}),(0,q.jsx)(`p`,{className:`page-subtitle`,children:`This setup link does not identify a project.`})]})}),(0,q.jsx)(G,{type:`button`,variant:`secondary`,onClick:()=>{n({to:`/projects`})},children:`View projects`})]});if(r.isPending)return(0,q.jsxs)(`div`,{className:`page-container max-w-3xl`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,q.jsx)(Td,{current:`site`}),(0,q.jsxs)(`div`,{className:`mt-8 flex items-center gap-3 text-label-14 text-secondary`,role:`status`,children:[(0,q.jsx)(m,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),`Loading Site Health setup…`]})]});if(r.isError)return(0,q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,q.jsx)(`div`,{className:`page-header`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`Can’t resume setup`}),(0,q.jsx)(`p`,{className:`page-subtitle`,children:`Canonry could not load the project for this Site Health scan.`})]})}),(0,q.jsxs)(`div`,{className:`rounded-md border border-negative bg-negative-soft p-4`,role:`alert`,children:[(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`Check the connection or sign in again, then retry.`}),(0,q.jsx)(G,{type:`button`,className:`mt-4`,variant:`secondary`,onClick:()=>{r.refetch()},children:`Retry project check`})]})]});let c=r.data.find(t=>t.name===e);return c?(0,q.jsxs)(`div`,{className:`page-container max-w-7xl py-8 md:py-10`,children:[(0,q.jsx)(`h1`,{className:`sr-only`,children:`Set up Canonry`}),(0,q.jsx)(K.Suspense,{fallback:(0,q.jsxs)(`div`,{className:`space-y-5`,children:[(0,q.jsx)(Td,{current:`site`}),(0,q.jsxs)(`div`,{className:`flex min-h-72 items-center justify-center gap-3 text-label-14 text-secondary`,role:`status`,children:[(0,q.jsx)(m,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),`Loading Site Health…`]})]}),children:(0,q.jsx)(Mf,{projectName:c.name,projectId:c.id,initialRunId:t,onReleaseInitialRun:()=>{n({to:`/setup`,search:{onboarding:`site-health`,setupProject:c.name},replace:!0})},showOnboardingActions:!0,onContinueOnboarding:()=>{t||od(c.name),n({to:`/setup`,search:{experience:`legacy`,onboarding:`site-health`,setupProject:c.name},replace:!0})},onSkipOnboarding:()=>{t||od(c.name),a({flowVersion:1,onboardingSessionId:i,event:`onboarding.step_completed`,step:`run`,method:`skipped`},`onboarding.step_completed:run`),n({to:`/setup`,search:{onboarding:`complete`,setupProject:c.name,skipped:`visibility`},replace:!0})}})})]}):(0,q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,q.jsx)(`div`,{className:`page-header`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`Project not found`}),(0,q.jsxs)(`p`,{className:`page-subtitle`,children:[`Canonry could not find `,e,`. It will not open a different project.`]})]})}),(0,q.jsx)(G,{type:`button`,variant:`secondary`,onClick:()=>{n({to:`/projects`})},children:`View projects`})]})}function np(){let e=Ce({from:`/setup`}),t=e.onboarding===`site-health`&&!e.setupProject,n=e.onboarding===`site-health`&&e.experience!==`legacy`,r=Tn(),i=e.experience===`legacy`?`legacy`:e.experience===`platform`?`platform`:r,[a,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(void 0),l=z({...yr({client:W}),enabled:i===`auto`,retry:!1,refetchOnMount:`always`}),u=z({...wr({client:W,query:{kind:U[`site-audit`],since:Bf,limit:$}}),enabled:i===`auto`,retry:!1,refetchOnMount:`always`}),d=i===`auto`&&l.isSuccess&&l.isFetchedAfterMount&&l.data.length===0;(0,K.useEffect)(()=>{d&&o(!0)},[d]);let f=i===`auto`?l.isSuccess&&l.isFetchedAfterMount?{state:`success`,projectCount:l.data.length}:l.isError?{state:`error`}:{state:`loading`}:{state:`idle`},p=i===`legacy`?`legacy`:a||d?`platform`:Rf(i,f);if(e.onboarding===`complete`&&e.setupProject)return(0,q.jsx)(nf,{projectName:e.setupProject,skippedVisibility:e.skipped===`visibility`});if(t||n)return(0,q.jsx)(ep,{projectName:e.setupProject,initialRunId:e.siteHealthRunId});let m=i===`auto`&&p===`legacy`&&!e.setupProject&&l.isSuccess;if(m&&s===void 0)return u.isError?c(null):u.isSuccess&&u.isFetchedAfterMount&&c(Vf(l.data,u.data)),(0,q.jsx)(Qf,{});let h=m?s:null;return h?(0,q.jsx)(rp,{projectName:h.projectName,runId:h.runId}):p===`legacy`?(0,q.jsx)(Cf,{visibilityProjectName:e.setupProject,siteHealthOnboarding:e.onboarding===`site-health`,onboardingFinish:e.onboarding===`site-health`||e.onboarding===`first-run`}):p===`loading`?(0,q.jsx)(Qf,{}):p===`retry`?(0,q.jsx)($f,{onRetry:()=>{l.refetch()}}):(0,q.jsx)(ip,{onActivationStarted:()=>o(!0),skipSiteScan:e.siteScan===`skip`})}function rp({projectName:e,runId:t}){let n=Se();return(0,K.useEffect)(()=>{n({to:`/setup`,search:{onboarding:`site-health`,setupProject:e,...t?{siteHealthRunId:t}:{}},replace:!0})},[n,e,t]),(0,q.jsx)(Qf,{})}function ip({onActivationStarted:e,skipSiteScan:t}){return(0,q.jsx)(Nl,{title:`Site Health setup`,children:(0,q.jsx)(ap,{onActivationStarted:e,skipSiteScan:t})})}function ap({onActivationStarted:e,skipSiteScan:t}){let n=Se(),i=_e(),a=vd(),o=z({...Tr({client:W}),retry:!1}),s=ye(dr()),[l]=(0,K.useState)(()=>rd(`platform`)),[u,d]=(0,K.useState)(l.domain??``),[f,p]=(0,K.useState)(l.projectName??``),[h,g]=(0,K.useState)(l.displayName??``),[_,v]=(0,K.useState)(l.country??`US`),[x,S]=(0,K.useState)(l.language??`en`),[C,w]=(0,K.useState)(!1),[T,E]=(0,K.useState)(`idle`),[D,O]=(0,K.useState)(null),[k,A]=(0,K.useState)(null),[ee,j]=(0,K.useState)(!1),[te,ne]=(0,K.useState)(null),[M,re]=(0,K.useState)(!1),ie=Vt(),N=_t(),P=o.isError?void 0:o.data,ae=typeof P?.enabled==`boolean`?P.enabled:null,oe=s.isPending?s.variables.body.enabled:ae,[se,ce]=(0,K.useState)(null),le=(0,K.useRef)(null),{onboardingSessionId:ue,emit:F}=Xf(`platform`);(0,K.useEffect)(()=>{F({flowVersion:1,onboardingSessionId:ue,event:`onboarding.started`,step:`project`,resumed:!1},`onboarding.started`)},[F,ue]),(0,K.useEffect)(()=>{D||id(`platform`,{domain:u,projectName:f,displayName:h,country:_,language:x})},[D,u,f,h,_,x]);let de=()=>{ad(`platform`),d(``),p(``),g(``),v(`US`),S(`en`),w(!1),A(null),j(!1)},fe=qf(u),I=f||fe?.projectName||``,L=h||fe?.displayName||``,pe=T===`creating`||T===`dispatching`,me=k??te,he=Wf(_,x),{countryValid:R,languageValid:ge}=Gf(_,x),ve=R&&ge;(0,K.useEffect)(()=>{me&&le.current?.focus()},[me]);let be=(e,t)=>n({to:`/setup`,search:{...t?{siteHealthRunId:t}:{},onboarding:`site-health`,setupProject:e.name},replace:!0}),xe=async e=>{E(`dispatching`),ne(null);try{let t=a.mutateAsync({projectName:e.name,projectId:e.id,projectLabel:e.displayName||e.name,suppressErrorToast:!0,body:{checkDeadLinks:!0,maxPages:100}}),n=await Jf(t);if(n.state===`queued`){F({flowVersion:1,onboardingSessionId:ue,event:`run.requested`,origin:`dashboard_setup`,result:`queued`,kind:`site_health`,providerCountBucket:`0`,queryCountBucket:`0`}),Je(n.run.runId),await be(e,n.run.runId);return}t.then(()=>{F({flowVersion:1,onboardingSessionId:ue,event:`run.requested`,origin:`dashboard_setup`,result:`queued`,kind:`site_health`,providerCountBucket:`0`,queryCountBucket:`0`})},e=>{F({flowVersion:1,onboardingSessionId:ue,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,kind:`site_health`,providerCountBucket:`0`,queryCountBucket:`0`,reasonCode:vt(e,`run_rejected`)})}),Yf(t,e.id),await be(e)}catch(e){E(`recovery`),ne(Zf(e,`The project was created, but the Site Health scan could not be started.`));let t=vt(e,`run_rejected`);F({flowVersion:1,onboardingSessionId:ue,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,kind:`site_health`,providerCountBucket:`0`,queryCountBucket:`0`,reasonCode:t}),F({flowVersion:1,onboardingSessionId:ue,event:`onboarding.blocked`,step:`run`,action:`retry_run`,reasonCode:t},`onboarding.blocked:run:${t}`)}},Ce=async r=>{if(r.preventDefault(),fe&&(t||C)&&ve&&!pe){E(`creating`),A(null),j(!1),ne(null);try{let r=await St({name:I,displayName:L,canonicalDomain:fe.canonicalDomain,country:_,language:x});if(e(),O(r),ad(`platform`),F({flowVersion:1,onboardingSessionId:ue,event:`onboarding.step_completed`,step:`project`,method:`manual`},`onboarding.step_completed:project`),await i.invalidateQueries({queryKey:pr({client:W})}),t){od(r.name),await n({to:`/setup`,search:{experience:`legacy`,onboarding:`first-run`,setupProject:r.name},replace:!0});return}await xe(r)}catch(t){E(`idle`);let n=t instanceof Ut&&t.statusCode===409;j(n),A(Zf(t,`Could not create the project. Try again.`)),F({flowVersion:1,onboardingSessionId:ue,event:`onboarding.blocked`,step:`project`,action:`save`,reasonCode:vt(t,`project_create_failed`)},`onboarding.blocked:project`),n&&(e(),i.invalidateQueries({queryKey:pr({client:W})}))}}},we=()=>{D&&!pe&&xe(D)},Te=()=>{pe||n({to:`/projects`})},B=async()=>{try{await navigator.clipboard.writeText(N?Lf:Lf.replace(If,``)),re(!0)}catch{rr({tone:`negative`,title:`Could not copy setup request`,detail:N?`Open the agent quickstart to continue with the CLI instead.`:`Check your browser’s clipboard permission and try again.`})}},Ee=async e=>{ce(null);try{let t=await s.mutateAsync({client:W,body:{enabled:e}});i.setQueryData(gr({client:W}),t),t.enabled!==e&&ce(`The server kept telemetry ${t.enabled?`on`:`off`}. Check its telemetry settings.`)}catch{ce(`Could not update telemetry. Try again.`)}};return D&&T===`recovery`?(0,q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,q.jsx)(Td,{current:`site`}),(0,q.jsx)(`div`,{className:`page-header mt-8`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`Project created`}),(0,q.jsxs)(`p`,{className:`page-subtitle`,children:[D.displayName||D.name,` is ready. The Site Health scan needs another try.`]})]})}),(0,q.jsxs)(`div`,{ref:le,className:`rounded-md border border-negative bg-negative-soft p-4`,role:`alert`,tabIndex:-1,children:[(0,q.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:te}),(0,q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:`You can retry the scan or continue setup and retry from Site Health.`}),(0,q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:[(0,q.jsx)(G,{type:`button`,onClick:we,children:`Retry Site Health scan`}),(0,q.jsx)(G,{type:`button`,variant:`secondary`,onClick:()=>{be(D)},children:`Continue setup`})]})]})]}):(0,q.jsxs)(`div`,{className:`page-container max-w-xl py-8 md:py-12`,children:[t?null:(0,q.jsx)(Td,{current:`site`}),(0,q.jsxs)(`header`,{className:`mb-8 ${t?``:`mt-8`}`,children:[(0,q.jsx)(`h1`,{id:`site-map-setup-title`,className:`text-heading-24 text-heading`,children:t?`Create a project`:`Scan your site`}),(0,q.jsx)(`p`,{className:`mt-2 max-w-lg text-copy-14 text-secondary`,children:t?`Add a public domain, then choose the queries you want to track. No site scan will run.`:`Enter your public website to see its pages, structure, internal links, and Technical AEO scores.`})]}),(0,q.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-2 text-label-13 text-secondary`,children:[(0,q.jsx)(`p`,{children:`Draft fields use tab storage when available. Scan permission resets on reload.`}),(0,q.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:pe,onClick:de,children:`Reset draft`})]}),(0,q.jsxs)(`form`,{"aria-labelledby":`site-map-setup-title`,className:`space-y-6`,onSubmit:er(Ce),noValidate:!0,children:[(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(`label`,{className:`text-label-14-strong text-heading`,htmlFor:`launchpad-domain`,children:`Website URL`}),(0,q.jsx)(`input`,{id:`launchpad-domain`,className:`h-10 w-full rounded-md border border-strong bg-bg-elevated/50 px-3 text-label-16 text-heading outline-none transition placeholder:text-muted focus:border-mono-500 focus:ring-1 focus:ring-mono-500 md:h-9 md:text-label-14 ${zf}`,type:`text`,inputMode:`url`,autoComplete:`url`,autoCapitalize:`none`,spellCheck:!1,required:!0,"aria-invalid":!(!u||fe),"aria-describedby":u&&!fe?`launchpad-domain-hint launchpad-domain-error`:`launchpad-domain-hint`,placeholder:`https://example.com`,value:u,onChange:e=>{d(e.target.value),A(null),j(!1)}}),(0,q.jsx)(`p`,{id:`launchpad-domain-hint`,className:`text-copy-14 text-secondary`,children:t?(0,q.jsxs)(q.Fragment,{children:[`A public domain is still required.`,` `,(0,q.jsx)(V,{to:`/setup`,search:{experience:`platform`},className:`text-copy-14-strong text-link underline-offset-4 hover:underline`,children:`Map with Site Health instead`})]}):(0,q.jsxs)(q.Fragment,{children:[`Only public pages are scanned.`,` `,(0,q.jsx)(V,{to:`/setup`,search:{experience:`platform`,onboarding:`first-run`,siteScan:`skip`},className:`text-copy-14-strong text-link underline-offset-4 hover:underline`,children:`Set up without a site scan`})]})}),u&&!fe?(0,q.jsx)(`p`,{id:`launchpad-domain-error`,className:`text-copy-14 text-negative`,role:`alert`,children:`Enter a public domain, such as example.com.`}):null]}),(0,q.jsxs)(`details`,{className:`group border-y border-default`,children:[(0,q.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center justify-between gap-4 py-2 text-label-14 [&::-webkit-details-marker]:hidden ${zf}`,children:[(0,q.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:`Project name and locale`}),(0,q.jsxs)(`span`,{className:`flex items-center gap-2 text-secondary`,children:[he,(0,q.jsx)(b,{className:`size-4 transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":`true`})]})]}),(0,q.jsxs)(`div`,{className:`space-y-5 border-t border-default py-4`,children:[fe?(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`mb-3 text-copy-14-strong text-heading`,children:`Project`}),(0,q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-project-name`,children:`Project name`}),(0,q.jsx)(`input`,{id:`launchpad-project-name`,className:`setup-input h-10`,type:`text`,value:I,onChange:e=>p(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-display-name`,children:`Display name`}),(0,q.jsx)(`input`,{id:`launchpad-display-name`,className:`setup-input h-10`,type:`text`,value:L,onChange:e=>g(e.target.value)})]})]})]}):null,(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`mb-3 text-copy-14-strong text-heading`,children:`Locale`}),(0,q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-country`,children:`Country`}),(0,q.jsx)(`select`,{id:`launchpad-country`,className:`setup-input h-10`,value:_,onChange:e=>v(e.target.value),children:Hf.map(e=>(0,q.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-language`,children:`Language`}),(0,q.jsx)(`select`,{id:`launchpad-language`,className:`setup-input h-10`,value:x,onChange:e=>S(e.target.value),children:Uf.map(e=>(0,q.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})]})]})]}),t?null:(0,q.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[`First scan: up to `,100,` pages. A limited scan describes the pages reached, not the whole site.`]}),t?null:(0,q.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-start gap-3 py-2`,children:[(0,q.jsx)(`input`,{className:`mt-0.5 size-4 shrink-0 rounded border-strong bg-bg`,type:`checkbox`,checked:C,onChange:e=>w(e.target.checked),"aria-label":`Allow Canonry to scan this public site.`}),(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`span`,{className:`text-label-14 text-heading`,children:`Allow Canonry to scan this public site.`}),(0,q.jsx)(kr,{text:Nf})]})]}),me?(0,q.jsxs)(`div`,{ref:le,className:`rounded-md border border-negative bg-negative-soft p-3`,role:`alert`,tabIndex:-1,children:[(0,q.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:me}),ee?(0,q.jsx)(G,{type:`button`,variant:`secondary`,size:`sm`,className:`mt-3`,onClick:Te,children:`View projects`}):null]}):null,(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(G,{className:`w-full ${zf}`,type:`submit`,disabled:!fe||!t&&!C||!ve||pe,children:T===`creating`||T===`dispatching`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(m,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),` `,t?`Creating project…`:`Mapping site…`]}):t?`Create project`:`Scan site`}),T===`dispatching`?(0,q.jsx)(`span`,{className:`text-center text-label-14 text-secondary`,role:`status`,children:`Opening Site Health when the scan is ready.`}):null]})]}),(0,q.jsxs)(`section`,{className:`mt-8 border-t border-default pt-6`,"aria-labelledby":`agent-setup-title`,children:[(0,q.jsx)(`p`,{id:`agent-setup-title`,className:`text-copy-14-strong text-heading`,children:`Use your agent instead`}),(0,q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:ie?`Connect your agent to this instance, or copy a request for a new local installation.`:`Connect ChatGPT or Claude Desktop to this instance.`}),(0,q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1`,children:[(0,q.jsx)(G,{asChild:!0,variant:`secondary`,size:`sm`,children:(0,q.jsx)(V,{to:`/agent-setup`,children:`Agent setup`})}),ie?(0,q.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:er(B),children:[M?(0,q.jsx)(y,{className:`size-3.5`,"aria-hidden":`true`}):(0,q.jsx)(c,{className:`size-3.5`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{"aria-live":`polite`,children:M?`Copied new-install request`:`Copy new-install request`})]}):null,ie&&N?(0,q.jsx)(G,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,q.jsxs)(`a`,{href:Ff,target:`_blank`,rel:`noopener noreferrer`,children:[`Agent quickstart`,(0,q.jsx)(r,{className:`size-3.5`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`sr-only`,children:` (opens in a new tab)`})]})}):null]})]}),ae===null?null:(0,q.jsxs)(`section`,{className:`mt-6 border-t border-default pt-5`,"aria-labelledby":`telemetry-title`,children:[(0,q.jsxs)(`label`,{className:`flex min-h-11 items-start gap-3 py-2 ${s.isPending?`cursor-wait`:`cursor-pointer`}`,children:[(0,q.jsx)(`input`,{className:`mt-0.5 size-4 shrink-0 rounded border-strong bg-bg accent-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-mono-500 disabled:cursor-wait`,type:`checkbox`,checked:oe??!1,disabled:s.isPending,onChange:e=>{Ee(e.target.checked)},"aria-describedby":`telemetry-detail`}),(0,q.jsxs)(`span`,{className:`grid gap-0.5`,children:[(0,q.jsx)(`span`,{id:`telemetry-title`,className:`text-label-14 text-heading`,children:`Share anonymous product telemetry`}),(0,q.jsx)(`span`,{id:`telemetry-detail`,className:`max-w-[70ch] text-label-14 text-secondary`,children:`Helps prioritize improvements. Canonry does not send raw domains, URLs, queries, answer content, or credentials.`})]})]}),s.isPending?(0,q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,role:`status`,children:`Saving preference…`}):null,se?(0,q.jsx)(`p`,{className:`mt-1 text-copy-14 text-negative`,role:`alert`,children:se}):null]})]})}function op(){return(0,q.jsx)(`div`,{className:`page-container`,children:(0,q.jsx)(`section`,{className:`page-section`,children:(0,q.jsxs)(Pr,{className:`surface-card empty-card`,children:[(0,q.jsx)(`h1`,{children:`Route not found`}),(0,q.jsx)(`p`,{children:`The current path does not map to a dashboard view.`}),(0,q.jsx)(G,{asChild:!0,children:(0,q.jsx)(V,{to:`/`,children:`Return to overview`})})]})})})}var sp=Ae(()=>jf(()=>import(`./ProjectPage-y378tOaT.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,15,8,16,9,10,11,12,13,0,17,18,19,20,21]),import.meta.url),`ProjectPage`),cp=Ae(()=>jf(()=>import(`./RunsPage-CfQ_kqlu.js`),__vite__mapDeps([22,1,2,3,4,5,6,7,15,9,10,13]),import.meta.url),`RunsPage`),lp=Ae(()=>jf(()=>import(`./HistoryPage-BCxpCul0.js`),__vite__mapDeps([23,3,1,2,18,4,5,6,7,10,13]),import.meta.url),`HistoryPage`),up=Ae(()=>jf(()=>import(`./SettingsPage-PIgRvqJc.js`),__vite__mapDeps([24,1,2,3,4,5,6,7,16,9,13]),import.meta.url),`SettingsPage`),dp=Ae(()=>jf(()=>import(`./AgentSetupPage-_ZP3F_zA.js`),__vite__mapDeps([25,1,2,3,7,6,5,8,16]),import.meta.url),`AgentSetupPage`),fp=Ae(()=>jf(()=>import(`./BacklinksPage-CsvVgXTZ.js`),__vite__mapDeps([26,1,2,3,7,6,5,16,13,17]),import.meta.url),`BacklinksPage`),pp=Ae(()=>jf(()=>import(`./TrafficPage-B_YunwjH.js`),__vite__mapDeps([27,1,2,3,4,5,6,7,16,9,10,12,13,20]),import.meta.url),`TrafficPage`),mp=Ae(()=>jf(()=>import(`./TrafficSourceDetailPage-C51W87fU.js`),__vite__mapDeps([28,1,2,3,4,5,6,7,15,11,12,13,20,9,10,21]),import.meta.url),`TrafficSourceDetailPage`),hp=Ae(()=>jf(()=>import(`./MeasurementPropertyPage-BObvWjVx.js`),__vite__mapDeps([29,1,2,3,4,5,6,7,15,8,10,11,12,19]),import.meta.url),`MeasurementPropertyPage`);function gp(){return(0,q.jsx)(jl,{children:(0,q.jsx)(Kr,{children:(0,q.jsx)(Al,{})})})}var _p=xe()({component:gp,validateSearch:e=>({manageQueries:e.manageQueries===!0||e.manageQueries===`true`||void 0,runId:typeof e.runId==`string`?e.runId:void 0,siteHealthRunId:typeof e.siteHealthRunId==`string`?e.siteHealthRunId:void 0,seoProfileId:typeof e.seoProfileId==`string`?e.seoProfileId:void 0,seoRunId:typeof e.seoRunId==`string`?e.seoRunId:void 0,seoRegion:typeof e.seoRegion==`string`&&e.seoRegion?e.seoRegion:void 0,seoMarket:typeof e.seoMarket==`string`&&e.seoMarket?e.seoMarket:void 0,seoShow:typeof e.seoShow==`string`&&e.seoShow?e.seoShow:void 0,seoSort:typeof e.seoSort==`string`&&e.seoSort?e.seoSort:void 0,seoQ:typeof e.seoQ==`string`&&e.seoQ?e.seoQ:void 0,evidenceId:typeof e.evidenceId==`string`?e.evidenceId:void 0,runStatus:typeof e.runStatus==`string`?e.runStatus:void 0,runKind:typeof e.runKind==`string`?e.runKind:void 0,runProject:typeof e.runProject==`string`?e.runProject:void 0,runWindow:typeof e.runWindow==`string`?e.runWindow:void 0,runQuery:typeof e.runQuery==`string`?e.runQuery:void 0,onboarding:e.onboarding===`site-health`||e.onboarding===`first-run`||e.onboarding===`complete`?e.onboarding:void 0,experience:e.experience===`legacy`||e.experience===`platform`?e.experience:void 0,siteScan:e.siteScan===`skip`?`skip`:void 0,skipped:e.skipped===`visibility`?`visibility`:void 0,setupProject:typeof e.setupProject==`string`?e.setupProject:void 0,scope:typeof e.scope==`string`?e.scope:void 0,class:typeof e.class==`string`?e.class:void 0,...Object.fromEntries([`queryWorkspace`,`researchMode`,`trackingQueryId`,`measurementScope`,`measurementScopeKey`,`measurementMarketKey`,`queryClass`,`measurementProvider`,`measurementModel`,`measurementLocation`,`measurementFrom`,`measurementTo`,`measurementRevision`,`measurementRunId`,`measurementQueryKey`,`measurementAnswer`,`journeyView`,`journeyDays`,`journeyVisitor`,`journeyEngine`,`journeyReturned`,`journeyOffset`,`agentHours`].map(t=>[t,typeof e[t]==`string`&&e[t]?e[t]:void 0]))})}),vp=B({getParentRoute:()=>_p,path:`/`,component:Xu,beforeLoad:async({context:e})=>{let t=e.queryClient.getQueryData(pr({client:W}));if(t===void 0)try{t=await e.queryClient.ensureQueryData(yr({client:W}))}catch{return}if(t.length===0)throw we({to:`/setup`})}}),yp=B({getParentRoute:()=>_p,path:`/projects`,component:ed}),bp=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,xp=B({getParentRoute:()=>_p,path:`/projects/$projectName`,component:()=>(0,q.jsx)(Oe,{}),beforeLoad:async({context:e,params:t,location:n})=>{let r=t.projectName;if(!bp.test(r))return;let i=e.queryClient.getQueryData(pr({client:W}));if(!i)try{i=await e.queryClient.ensureQueryData(yr({client:W}))}catch{return}let a=i.find(e=>e.id===r);if(a)throw we({to:n.pathname.replace(`/projects/${r}`,`/projects/${encodeURIComponent(a.name)}`),replace:!0})}}),Sp=B({getParentRoute:()=>xp,path:`/`,component:()=>(0,q.jsx)(sp,{tab:`overview`})}),Cp=B({getParentRoute:()=>xp,path:`/portfolio`,component:()=>(0,q.jsx)(sp,{tab:`portfolio`})}),wp=B({getParentRoute:()=>xp,path:`/search-console`,component:()=>(0,q.jsx)(sp,{tab:`search-console`})}),Tp=B({getParentRoute:()=>xp,path:`/seo-data`,component:()=>(0,q.jsx)(sp,{tab:`seo-data`})}),Ep=B({getParentRoute:()=>xp,path:`/journeys`,component:()=>(0,q.jsx)(sp,{tab:`journeys`})}),Dp=B({getParentRoute:()=>xp,path:`/conversions`,component:()=>(0,q.jsx)(sp,{tab:`conversions`})}),Op=B({getParentRoute:()=>xp,path:`/local`,component:()=>(0,q.jsx)(sp,{tab:`local`})}),kp=B({getParentRoute:()=>xp,path:`/discovery`,component:()=>(0,q.jsx)(sp,{tab:`discovery`})}),Ap=B({getParentRoute:()=>xp,path:`/queries`,component:()=>(0,q.jsx)(sp,{tab:`queries`})}),jp=B({getParentRoute:()=>xp,path:`/client-queries`,component:()=>(0,q.jsx)(sp,{tab:`client-queries`})}),Mp=B({getParentRoute:()=>xp,path:`/properties/$targetKey`,component:()=>(0,q.jsx)(hp,{})}),Np=B({getParentRoute:()=>xp,path:`/report`,beforeLoad:({params:e})=>{throw we({to:`/projects/$projectName`,params:e,replace:!0})}}),Pp=B({getParentRoute:()=>xp,path:`/activity`,component:()=>(0,q.jsx)(sp,{tab:`activity`})}),Fp=B({getParentRoute:()=>xp,path:`/backlinks`,component:()=>(0,q.jsx)(sp,{tab:`backlinks`})}),Ip=B({getParentRoute:()=>xp,path:`/technical-aeo`,component:()=>(0,q.jsx)(sp,{tab:`technical-aeo`})}),Lp=B({getParentRoute:()=>xp,path:`/history`,component:()=>(0,q.jsx)(sp,{tab:`history`})}),Rp=B({getParentRoute:()=>xp,path:`/settings`,component:()=>(0,q.jsx)(sp,{tab:`settings`})}),zp=B({getParentRoute:()=>_p,path:`/runs`,component:cp}),Bp=B({getParentRoute:()=>_p,path:`/history`,component:lp}),Vp=B({getParentRoute:()=>_p,path:`/settings`,component:up,beforeLoad:({context:e})=>{}}),Hp=B({getParentRoute:()=>_p,path:`/setup`,component:np}),Up=B({getParentRoute:()=>_p,path:`/agent-setup`,component:dp}),Wp=B({getParentRoute:()=>_p,path:`/backlinks`,component:fp}),Gp=B({getParentRoute:()=>_p,path:`/traffic`,component:pp}),Kp=B({getParentRoute:()=>_p,path:`/traffic/$projectName/$sourceId`,component:mp}),qp=B({getParentRoute:()=>_p,path:`*`,component:op}),Jp=_p.addChildren([vp,yp,xp.addChildren([Sp,Cp,wp,Tp,Ep,Dp,Op,kp,Ap,jp,Mp,Np,Pp,Fp,Ip,Lp,Rp]),zp,Bp,Vp,Hp,Up,Wp,Gp,Kp,qp]);function Yp(){return typeof window<`u`&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:`/`}var Xp=Yp(),Zp=Xp===`/`?``:Xp.replace(/\/$/,``);function Qp(e,t){return be({routeTree:Jp,basepath:Zp||`/`,context:{queryClient:e},...t?.initialEntries&&{history:Ee({initialEntries:t.initialEntries})}})}var $p=!1;async function em(e){return(await $e({client:W,body:e,keepalive:!0})).data}function tm(){$p||typeof window>`u`||($p=!0,!(In()||Et())&&(Rn({send:em}),W.interceptors.request.use((e,t)=>{let n=t.fetch??globalThis.fetch,r=typeof t.url==`string`?t.url:void 0;return t.fetch=async(t,i)=>{try{return await n(t,i)}catch(t){throw t instanceof DOMException&&t.name===`AbortError`||bt({method:e.method,route:r,network:!0}),t}},e}),W.interceptors.response.use((e,t,n)=>(bt({method:t.method,route:typeof n.url==`string`?n.url:void 0,path:rm(t.url),status:e.status}),e)),window.addEventListener(`error`,e=>{Ve({kind:`unhandled`,error:e.error})}),window.addEventListener(`unhandledrejection`,e=>{Ve({kind:`unhandled`,error:e.reason})}),cm()))}function nm(e){let t=null,n=()=>{let n=e.state.matches.at(-1);if(!n)return;Ke(n.fullPath);let r=e.state.location;if(!r)return;let i=r.search&&typeof r.search==`object`?r.search:{};t&&t.pathname===r.pathname&&Fn(t.search,i),t={pathname:r.pathname,search:i}};return n(),e.subscribe(`onResolved`,n)}function rm(e){try{return new URL(e,window.location.origin).pathname}catch{return}}var im={LCP:[2500,4e3],INP:[200,500],CLS:[.1,.25],FCP:[1800,3e3],TTFB:[800,1800]};function am(e,t){let[n,r]=im[e];return t<=n?`good`:t<=r?`needs-improvement`:`poor`}function om(){let e=0,t=0,n=-1/0,r=-1/0;return{add(i){i.hadRecentInput||(i.startTime-r<1e3&&i.startTime-n<5e3?t+=i.value:(t=i.value,n=i.startTime),r=i.startTime,e=Math.max(e,t))},value:()=>e}}function sm(){let e=0;return{add(t){t.interactionId&&(e=Math.max(e,t.duration))},value:()=>e}}function cm(){if(typeof PerformanceObserver>`u`)return;let e=new Set,t=(t,n)=>{!e.has(t)&&Number.isFinite(n)&&(e.add(t),wt(t,am(t,n)))},n=(e,t,n={})=>{try{new PerformanceObserver(e=>t(e.getEntries())).observe({type:e,buffered:!0,...n})}catch{}};try{let e=performance.getEntriesByType(`navigation`)[0];e&&e.responseStart>0&&t(`TTFB`,e.responseStart)}catch{}n(`paint`,e=>{let n=e.find(e=>e.name===`first-contentful-paint`);n&&t(`FCP`,n.startTime)});let r=0;n(`largest-contentful-paint`,e=>{let t=e.at(-1);t&&(r=t.startTime)});let i=om();n(`layout-shift`,e=>{for(let t of e)i.add({startTime:t.startTime,value:t.value??0,hadRecentInput:t.hadRecentInput===!0})});let a=sm();n(`event`,e=>{for(let t of e)a.add(t)},{durationThreshold:40});let o=()=>{r>0&&t(`LCP`,r),t(`CLS`,i.value()),a.value()>0&&t(`INP`,a.value())};document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&o()}),window.addEventListener(`pagehide`,o)}var lm=6e4,um=`Anyone with this password can sign in to this dashboard.`,dm={label:`Root API key`,help:`To create the password from here, enter the root API key (apiKey in config.yaml). It is used once and not saved.`,missing:`Enter the root API key.`,rejected:`That is not the root API key for this install.`,show:`Show passwords and key`},fm={id:`embed`,scopes:[`read`,`embed`],projectId:`embed`,readOnly:!0};function pm(){let e=(0,K.useRef)(vn()).current,[t,n]=(0,K.useState)(e?`ready`:`checking`),[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(null),[s,c]=(0,K.useState)(e),[l,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(``),[p,m]=(0,K.useState)(``),[h,g]=(0,K.useState)(``),[_,v]=(0,K.useState)(!1),[y,b]=(0,K.useState)(`password`),[x,S]=(0,K.useState)(!1),[C,w]=(0,K.useState)(``),[T,E]=(0,K.useState)(null),[D,O]=(0,K.useState)(!1),[k,A]=(0,K.useState)(!1),ee=(0,K.useRef)(null),j=(0,K.useRef)(null),te=(0,K.useRef)(null),ne=()=>{let t=r?`${r.name}:${r.role}`:e?`api-key:explicit`:a?`api-key:${a.id}`:`no-accounts`;if(!ee.current||te.current!==t){j.current?.clear();let e=nr();j.current=e,ee.current=Qp(e),nm(ee.current),te.current=t}return{queryClient:j.current,router:ee.current}},M=e=>e.authRequired?(u(!0),i(e.user),o(null),c(!1),n(e.user?`ready`:`account-login`),!0):!1;(0,K.useEffect)(()=>{let t=!1,r=async(e,r=!1)=>{try{let e=await Vn();if(t)return;o(e),c(!1),n(`ready`)}catch(i){if(t)return;if(r&&i instanceof Ut&&i.statusCode===401)return jn().then(()=>{t||(E(null),o(null),c(!1),A(!0),n(`login`))}).catch(r=>{t||(E(r instanceof Error?r.message:`Could not clear the invalid session`),n(e))});E(i instanceof Error?i.message:`Could not verify API key access`),n(e)}};return e?(r(`api-key-error`),()=>{t=!0}):(Promise.allSettled([at(),kn()]).then(([e,i])=>{if(t||e.status===`fulfilled`&&M(e.value))return;if(i.status===`rejected`){let e=i.reason;E(e instanceof Error?e.message:`Failed to reach the Canonry API`),n(`login`);return}let a=i.value;a.authenticated&&In()?(o(fm),c(!1),n(`ready`)):a.authenticated?(c(!0),r(`api-key-error`,!0)):(o(null),c(!1),n(a.setupRequired?`setup`:`login`))}),()=>{t=!0})},[]),(0,K.useEffect)(()=>{if(t!==`ready`||e)return;let r=setInterval(()=>{l?at().then(e=>{e.authRequired&&!e.user&&(A(!0),i(null),o(null),n(`account-login`))}).catch(()=>{}):kn().then(e=>{e.authenticated||(A(!0),o(null),n(e.setupRequired?`setup`:`login`))}).catch(()=>{})},lm);return bn(()=>{A(!0),i(null),o(null),c(!1),n(l?`account-login`:`login`)}),()=>{clearInterval(r),bn(null)}},[t,l,e]);let re=async e=>{if(e.preventDefault(),!p.trim()||p.trim().length<8){E(`Password must be at least 8 characters`);return}if(p!==h){E(`Passwords do not match`);return}let t=C.trim();if(x&&!t)E(dm.missing);else{O(!0),E(null);try{if(!(await Rt(p.trim(),x?t:void 0)).authenticated){E(`Setup failed`);return}m(``),g(``),w(``),S(!1),v(!1),A(!1),o(null),c(!0),n(`checking`);try{let e=await Vn();o(e),c(!1),n(`ready`)}catch(e){E(e instanceof Error?e.message:`Could not verify API key access`),n(`api-key-error`)}}catch(e){if(e instanceof Ut&&e.statusCode===401&&e.code===`AUTH_REQUIRED`){E(x?dm.rejected:null),S(!0);return}E(e instanceof Ut||e instanceof Error?e.message:`Setup failed`)}finally{O(!1)}}},ie=e=>{m(e),E(null)},N=e=>{w(e),E(null)},P=e=>{g(e),E(null)},ae=async e=>{if(e.preventDefault(),p.trim()){O(!0),E(null);try{if(!(y===`api-key`?await dt(p.trim()):await ln(p.trim())).authenticated){E(y===`api-key`?`Invalid API key`:`Incorrect password`);return}let e=await Vn();o(e),c(!1),m(``),v(!1),A(!1),n(`ready`)}catch(e){E(e instanceof Ut||e instanceof Error?e.message:`Authentication failed`)}finally{O(!1)}}},oe=e=>{b(e),m(``),v(!1),E(null)},se=async e=>{if(e.preventDefault(),d.trim()&&p){O(!0),E(null);try{let e=await $t(d.trim(),p);if(!e.user){E(`Incorrect name or password.`);return}m(``),A(!1),i(e.user),o(null),c(!1),n(`ready`)}catch(e){E(e instanceof Ut?e.message:`Incorrect name or password.`)}finally{O(!1)}}};if(t===`ready`){let{queryClient:e,router:t}=ne();return(0,q.jsx)($n,{account:r,apiKey:a,apiKeyPending:s,children:(0,q.jsx)(ve,{client:e,children:(0,q.jsx)(Te,{router:t})})})}let ce=p.trim(),le=p.length>0&&ce.length<8,ue=h.length>0&&p!==h,F=ce.length>=8&&p===h&&(!x||C.trim().length>0);return(0,q.jsx)(`div`,{className:`min-h-screen bg-bg px-4 py-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto flex min-h-[calc(100vh-4rem)] max-w-md flex-col items-center justify-center gap-5`,children:[(0,q.jsxs)(`div`,{"data-testid":`auth-brand`,className:`flex items-center gap-2.5`,children:[(0,q.jsx)(Gi,{className:`size-7`}),(0,q.jsx)(`span`,{className:`text-label-18-strong text-heading`,children:`Canonry`})]}),(0,q.jsx)(Pr,{className:`surface-card w-full`,children:t===`checking`?(0,q.jsx)(Mr,{className:`py-8`,children:(0,q.jsx)(`p`,{className:`supporting-copy text-center`,children:`Connecting to Canonry…`})}):t===`api-key-error`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(jr,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Dashboard access`}),(0,q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Could not verify API key access`})]}),(0,q.jsxs)(Mr,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`supporting-copy`,children:T??`Canonry could not verify this session’s access, so the dashboard stayed locked.`}),(0,q.jsx)(G,{type:`button`,className:`w-full`,onClick:()=>{window.location.reload()},children:`Try again`})]})]}):t===`account-login`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(jr,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Dashboard access`}),(0,q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Sign in to Canonry`})]}),(0,q.jsxs)(Mr,{children:[k?(0,q.jsx)(`p`,{className:`mb-4 rounded-md border border-caution bg-caution-soft px-3 py-2 text-copy-14 text-caution`,children:`You were signed out — please sign in again.`}):null,(0,q.jsxs)(`form`,{className:`space-y-4`,onSubmit:er(se),children:[(0,q.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`account-name`,children:[(0,q.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:`Name`}),(0,q.jsx)(`input`,{autoFocus:!0,id:`account-name`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:`text`,name:`username`,autoComplete:`username`,value:d,onChange:e=>{f(e.target.value),E(null)},"aria-invalid":!!T,"aria-describedby":T?`account-login-error`:void 0})]}),(0,q.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`account-password`,children:[(0,q.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:`Password`}),(0,q.jsx)(`input`,{id:`account-password`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:`password`,name:`password`,autoComplete:`current-password`,value:p,onChange:e=>ie(e.target.value),"aria-invalid":!!T,"aria-describedby":T?`account-login-error`:void 0})]}),T?(0,q.jsx)(`p`,{id:`account-login-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:T}):null,(0,q.jsx)(G,{type:`submit`,disabled:D||!d.trim()||!p,children:D?`Signing in…`:`Sign in`})]})]})]}):t===`setup`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(jr,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`First-time setup`}),(0,q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Create a dashboard password`}),(0,q.jsx)(Nr,{children:um})]}),(0,q.jsx)(Mr,{children:(0,q.jsxs)(`form`,{className:`space-y-4`,onSubmit:er(re),children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-password-new`,children:`Password`}),(0,q.jsx)(`input`,{autoFocus:!0,id:`dashboard-password-new`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:_?`text`:`password`,name:`new-password`,autoComplete:`new-password`,minLength:8,required:!0,value:p,onChange:e=>ie(e.target.value),"aria-invalid":le,"aria-describedby":`dashboard-password-new-help`}),(0,q.jsx)(`span`,{id:`dashboard-password-new-help`,"aria-live":`polite`,className:le?`block text-label-14 text-negative-400`:`block text-label-14 text-secondary`,children:le?`Enter at least 8 characters.`:`Use at least 8 characters.`})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-password-confirm`,children:`Confirm password`}),(0,q.jsx)(`input`,{id:`dashboard-password-confirm`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:_?`text`:`password`,name:`confirm-password`,autoComplete:`new-password`,minLength:8,required:!0,value:h,onChange:e=>P(e.target.value),"aria-invalid":ue,"aria-describedby":`dashboard-password-confirm-help`}),(0,q.jsx)(`span`,{id:`dashboard-password-confirm-help`,"aria-live":`polite`,className:ue?`block text-label-14 text-negative-400`:`block text-label-14 text-secondary`,children:ue?`Passwords do not match.`:`Enter the same password again.`})]}),x?(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-setup-root-key`,children:dm.label}),(0,q.jsx)(`input`,{autoFocus:!0,id:`dashboard-setup-root-key`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:_?`text`:`password`,name:`apiKey`,autoComplete:`off`,spellCheck:!1,required:!0,value:C,onChange:e=>N(e.target.value),"aria-invalid":T===dm.rejected,"aria-describedby":`dashboard-setup-root-key-help`}),(0,q.jsx)(`span`,{id:`dashboard-setup-root-key-help`,"aria-live":`polite`,className:`block text-label-14 text-secondary`,children:dm.help})]}):null,(0,q.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-2 text-label-14 text-secondary`,htmlFor:`dashboard-password-show`,children:[(0,q.jsx)(`input`,{id:`dashboard-password-show`,type:`checkbox`,checked:_,onChange:e=>v(e.target.checked)}),x?dm.show:`Show passwords`]}),T?(0,q.jsx)(`p`,{id:`dashboard-password-setup-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:T}):null,(0,q.jsx)(G,{type:`submit`,disabled:D||!F,children:D?`Creating password…`:`Create password and continue`})]})})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(jr,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Dashboard access`}),(0,q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Sign in to Canonry`}),(0,q.jsx)(Nr,{children:y===`api-key`?`Enter an API key from this Canonry install. This opens the dashboard with that key’s access and does not change the password.`:`Enter your dashboard password to continue.`})]}),(0,q.jsxs)(Mr,{children:[k?(0,q.jsx)(`p`,{className:`mb-4 rounded-md border border-caution bg-caution-soft px-3 py-2 text-copy-14 text-caution`,children:`Your session expired — please sign in again.`}):null,(0,q.jsxs)(`form`,{className:`space-y-4`,onSubmit:er(ae),children:[(0,q.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`dashboard-password-current`,children:[(0,q.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:y===`api-key`?`Canonry API key`:`Password`}),(0,q.jsx)(`input`,{autoFocus:!0,id:`dashboard-password-current`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:_?`text`:`password`,name:y===`api-key`?`apiKey`:`password`,autoComplete:y===`api-key`?`off`:`current-password`,spellCheck:!1,required:!0,value:p,onChange:e=>ie(e.target.value),"aria-invalid":!!T,"aria-describedby":T?`dashboard-password-login-error`:void 0})]}),(0,q.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-2 text-label-14 text-secondary`,htmlFor:`dashboard-login-password-show`,children:[(0,q.jsx)(`input`,{id:`dashboard-login-password-show`,type:`checkbox`,checked:_,onChange:e=>v(e.target.checked)}),y===`api-key`?`Show API key`:`Show password`]}),T?(0,q.jsx)(`p`,{id:`dashboard-password-login-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:T}):null,(0,q.jsx)(G,{type:`submit`,disabled:D||!p.trim(),children:D?`Signing in…`:`Open dashboard`}),(0,q.jsx)(G,{type:`button`,variant:`ghost`,onClick:()=>oe(y===`api-key`?`password`:`api-key`),children:y===`api-key`?`Use dashboard password instead`:`Forgot password? Use API key`})]})]})]})})]})})}var mm=document.getElementById(`root`);if(!mm)throw Error(`Expected #root element for web app bootstrap.`);tm(),(0,Br.createRoot)(mm).render((0,q.jsx)(K.StrictMode,{children:(0,q.jsx)(Xa,{children:(0,q.jsx)(pm,{})})}));export{Ss as $,Ma as $t,Nu as A,fa as At,mc as B,Ha as Bt,ld as C,Qi as Ct,Fu as D,pa as Dt,Yu as E,ma as Et,Bl as F,ga as Ft,Ks as G,ca as Gt,Xs as H,wa as Ht,Pl as I,ba as It,Us as J,la as Jt,Vs as K,da as Kt,zl as L,Ba as Lt,wu as M,xa as Mt,Du as N,ja as Nt,Ou as O,J as Ot,Vl as P,ea as Pt,ws as Q,_a as Qt,Nl as R,ra as Rt,vd as S,ta as St,Qu as T,Zi as Tt,nc as U,sa as Ut,Zs as V,za as Vt,tc as W,Xi as Wt,Bs as X,Da as Xt,Gs as Y,Ua as Yt,Ws as Z,Na as Zt,Sd as _,qi as _t,qd as a,gi as an,_o as at,bd as b,Ta as bt,Bd as c,pi as cn,mo as ct,Ad as d,Xr as dn,fo as dt,Pi as en,ys as et,Nd as f,ri as fn,lo as ft,Td as g,Ga as gt,Od as h,Qa as ht,mf as i,bi as in,Wo as it,Tu as j,Sa as jt,Mu as k,Ea as kt,Hd as l,ei as ln,no as lt,Fd as m,Wr as mn,to as mt,ff as n,Fi as nn,ms as nt,ef as o,_i as on,go as ot,Id as p,qr as pn,uo as pt,zs as q,ua as qt,pf as r,Ii as rn,ps as rt,Wd as s,hi as sn,ho as st,jf as t,Bi as tn,_s as tt,Vd as u,ni as un,co as ut,_d as v,Ji as vt,sd as w,$i as wt,gd as x,ya as xt,yd as y,Yi as yt,Ml as z,Oa as zt};
60
+ 7. Summarize only completed evidence, then propose AI Visibility setup. Ask before you add queries, connect providers, start a provider-backed or quota-consuming run, edit files, or publish.`;function Rf(e,t){return e===`legacy`?`legacy`:e===`platform`?`platform`:t.state===`success`?t.projectCount===0?`platform`:`legacy`:t.state===`error`?`retry`:`loading`}var zf=`pointer-coarse:min-h-11 max-md:min-h-11`,Bf=`2000-01-01T00:00:00.000Z`,$=5e3;function Vf(e,t){let n=new Set,r=new Map;for(let e of t)e.trigger!==ut.probe&&(r.has(e.projectId)||r.set(e.projectId,e.id),(e.status===H.completed||e.status===H.partial)&&n.add(e.projectId));let i=(e.every(e=>e.createdAt)?[...e].sort((e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.name.localeCompare(t.name)):e).find(e=>!n.has(e.id));return i?{projectName:i.name,runId:r.get(i.id)}:null}var Hf=[{value:`US`,label:`United States`},{value:`CA`,label:`Canada`},{value:`GB`,label:`United Kingdom`},{value:`AU`,label:`Australia`},{value:`NZ`,label:`New Zealand`},{value:`IE`,label:`Ireland`},{value:`DE`,label:`Germany`},{value:`FR`,label:`France`},{value:`ES`,label:`Spain`},{value:`IT`,label:`Italy`},{value:`NL`,label:`Netherlands`},{value:`BR`,label:`Brazil`},{value:`MX`,label:`Mexico`},{value:`IN`,label:`India`},{value:`SG`,label:`Singapore`},{value:`JP`,label:`Japan`}],Uf=[{value:`en`,label:`English`},{value:`es`,label:`Spanish`},{value:`fr`,label:`French`},{value:`de`,label:`German`},{value:`it`,label:`Italian`},{value:`pt`,label:`Portuguese`},{value:`nl`,label:`Dutch`},{value:`ja`,label:`Japanese`}];function Wf(e,t){try{let n=new Intl.DisplayNames([`en`],{type:`region`}),r=new Intl.DisplayNames([`en`],{type:`language`}),i=e.length===2?n.of(e.toUpperCase()):void 0,a=t?r.of(t.toLowerCase()):void 0;return`${i??(e||`Country`)} · ${a??(t||`Language`)}`}catch{return`${e||`Country`} · ${t||`Language`}`}}function Gf(e,t){let n=e.trim().toUpperCase(),r=t.trim().toLowerCase();return{countryValid:Hf.some(e=>e.value===n),languageValid:Uf.some(e=>e.value===r)}}function Kf(e){let t=e.replace(/^\[|\]$/g,``);return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(t)||t.includes(`:`)}function qf(e){let t=e.trim();if(!t)return null;let n=/^[a-z][a-z\d+.-]*:\/\//i.test(t)?t:`https://${t}`,r;try{r=new URL(n)}catch{return null}if(r.protocol!==`http:`&&r.protocol!==`https:`)return null;let i=r.hostname.toLowerCase().replace(/^www\./,``);if(!i||i===`localhost`||Kf(i)||!i.includes(`.`))return null;let a=i.replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);return a?{canonicalDomain:i,projectName:a,displayName:i}:null}async function Jf(e,t=Pf){let n,r=new Promise(e=>{n=setTimeout(()=>e({state:`timed-out`}),t)}),i=await Promise.race([e.then(e=>({state:`queued`,run:e})),r]);return n&&clearTimeout(n),i}function Yf(e,t){e.catch(()=>{rr({title:`Site Health scan did not start`,detail:`The project is safe. Choose Run scan in Site Health to retry.`,tone:`negative`,dedupeKey:`site-health-dispatch:${t}`})})}function Xf(e){let t=(0,K.useRef)(ot()).current,n=(0,K.useRef)(new Set);return{onboardingSessionId:t,emit:(0,K.useCallback)((t,r)=>{if(r){if(n.current.has(r))return;n.current.add(r)}st({...t,surface:e,eventId:sn()})},[e])}}function Zf(e,t){return e instanceof Ut&&e.statusCode===409?`A project with this name already exists. Change the project name, or open the existing project.`:e instanceof Error&&e.message?e.message:t}function Qf(){return(0,q.jsxs)(`div`,{className:`page-container max-w-3xl`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,q.jsx)(`div`,{className:`page-header`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`Preparing setup`}),(0,q.jsx)(`p`,{className:`page-subtitle`,children:`Checking the projects already on this install.`})]})}),(0,q.jsxs)(`div`,{className:`flex items-center gap-3 material-base p-4 text-label-14 text-secondary`,role:`status`,children:[(0,q.jsx)(m,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),`Loading projects…`]})]})}function $f({onRetry:e}){return(0,q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,q.jsx)(`div`,{className:`page-header`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`Can’t load projects`}),(0,q.jsx)(`p`,{className:`page-subtitle`,children:`Canonry could not confirm whether this install already has a project.`})]})}),(0,q.jsxs)(`div`,{className:`rounded-md border border-negative bg-negative-soft p-4`,role:`alert`,tabIndex:-1,children:[(0,q.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:`Setup is paused to protect existing projects.`}),(0,q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:`Check the connection or sign in again, then retry.`}),(0,q.jsx)(G,{type:`button`,className:`mt-4`,variant:`secondary`,onClick:e,children:`Retry project check`})]})]})}function ep({projectName:e,initialRunId:t}){return(0,q.jsx)(Nl,{title:`Site Health setup`,children:(0,q.jsx)(tp,{projectName:e,initialRunId:t})})}function tp({projectName:e,initialRunId:t}){let n=Se(),r=z({...yr({client:W}),enabled:!!e,retry:!1,refetchOnMount:`always`}),{onboardingSessionId:i,emit:a}=Xf(`site_health`),[o]=(0,K.useState)(()=>ct(t));(0,K.useEffect)(()=>{o&&Ie()},[o]),(0,K.useEffect)(()=>{e&&a({flowVersion:1,onboardingSessionId:i,event:`onboarding.started`,step:`run`,resumed:!!t&&!o},`onboarding.started`)},[a,o,t,i,e]),(0,K.useEffect)(()=>{e&&t&&kt(e)?.runId!==t&&it(e,t)},[t,e]);let s=z({...Sr({client:W,path:{id:t??``}}),enabled:!!t,refetchInterval:({state:e})=>{let t=e.data?.status;return t===`completed`||t===`partial`||t===`failed`||t===`cancelled`?!1:2e3},refetchIntervalInBackground:!0}).data?.status;if((0,K.useEffect)(()=>{if(!e||!t||!s)return;if(s===`completed`||s===`partial`){a({flowVersion:1,onboardingSessionId:i,event:`onboarding.step_completed`,step:`run`,method:`automatic`},`onboarding.step_completed:run`),et(t);return}if(s!==`failed`&&s!==`cancelled`)return;let n=s===`cancelled`?`run_cancelled`:`run_failed`;a({flowVersion:1,onboardingSessionId:i,event:`onboarding.blocked`,step:`run`,action:`retry_run`,reasonCode:n},`onboarding.blocked:run:${n}`),et(t)},[a,t,i,e,s]),!e)return(0,q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,q.jsx)(`div`,{className:`page-header`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`Project not found`}),(0,q.jsx)(`p`,{className:`page-subtitle`,children:`This setup link does not identify a project.`})]})}),(0,q.jsx)(G,{type:`button`,variant:`secondary`,onClick:()=>{n({to:`/projects`})},children:`View projects`})]});if(r.isPending)return(0,q.jsxs)(`div`,{className:`page-container max-w-3xl`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,q.jsx)(Td,{current:`site`}),(0,q.jsxs)(`div`,{className:`mt-8 flex items-center gap-3 text-label-14 text-secondary`,role:`status`,children:[(0,q.jsx)(m,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),`Loading Site Health setup…`]})]});if(r.isError)return(0,q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,q.jsx)(`div`,{className:`page-header`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`Can’t resume setup`}),(0,q.jsx)(`p`,{className:`page-subtitle`,children:`Canonry could not load the project for this Site Health scan.`})]})}),(0,q.jsxs)(`div`,{className:`rounded-md border border-negative bg-negative-soft p-4`,role:`alert`,children:[(0,q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`Check the connection or sign in again, then retry.`}),(0,q.jsx)(G,{type:`button`,className:`mt-4`,variant:`secondary`,onClick:()=>{r.refetch()},children:`Retry project check`})]})]});let c=r.data.find(t=>t.name===e);return c?(0,q.jsxs)(`div`,{className:`page-container max-w-7xl py-8 md:py-10`,children:[(0,q.jsx)(`h1`,{className:`sr-only`,children:`Set up Canonry`}),(0,q.jsx)(K.Suspense,{fallback:(0,q.jsxs)(`div`,{className:`space-y-5`,children:[(0,q.jsx)(Td,{current:`site`}),(0,q.jsxs)(`div`,{className:`flex min-h-72 items-center justify-center gap-3 text-label-14 text-secondary`,role:`status`,children:[(0,q.jsx)(m,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),`Loading Site Health…`]})]}),children:(0,q.jsx)(Mf,{projectName:c.name,projectId:c.id,initialRunId:t,onReleaseInitialRun:()=>{n({to:`/setup`,search:{onboarding:`site-health`,setupProject:c.name},replace:!0})},showOnboardingActions:!0,onContinueOnboarding:()=>{t||od(c.name),n({to:`/setup`,search:{experience:`legacy`,onboarding:`site-health`,setupProject:c.name},replace:!0})},onSkipOnboarding:()=>{t||od(c.name),a({flowVersion:1,onboardingSessionId:i,event:`onboarding.step_completed`,step:`run`,method:`skipped`},`onboarding.step_completed:run`),n({to:`/setup`,search:{onboarding:`complete`,setupProject:c.name,skipped:`visibility`},replace:!0})}})})]}):(0,q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,q.jsx)(`div`,{className:`page-header`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`Project not found`}),(0,q.jsxs)(`p`,{className:`page-subtitle`,children:[`Canonry could not find `,e,`. It will not open a different project.`]})]})}),(0,q.jsx)(G,{type:`button`,variant:`secondary`,onClick:()=>{n({to:`/projects`})},children:`View projects`})]})}function np(){let e=Ce({from:`/setup`}),t=e.onboarding===`site-health`&&!e.setupProject,n=e.onboarding===`site-health`&&e.experience!==`legacy`,r=Tn(),i=e.experience===`legacy`?`legacy`:e.experience===`platform`?`platform`:r,[a,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(void 0),l=z({...yr({client:W}),enabled:i===`auto`,retry:!1,refetchOnMount:`always`}),u=z({...wr({client:W,query:{kind:U[`site-audit`],since:Bf,limit:$}}),enabled:i===`auto`,retry:!1,refetchOnMount:`always`}),d=i===`auto`&&l.isSuccess&&l.isFetchedAfterMount&&l.data.length===0;(0,K.useEffect)(()=>{d&&o(!0)},[d]);let f=i===`auto`?l.isSuccess&&l.isFetchedAfterMount?{state:`success`,projectCount:l.data.length}:l.isError?{state:`error`}:{state:`loading`}:{state:`idle`},p=i===`legacy`?`legacy`:a||d?`platform`:Rf(i,f);if(e.onboarding===`complete`&&e.setupProject)return(0,q.jsx)(nf,{projectName:e.setupProject,skippedVisibility:e.skipped===`visibility`});if(t||n)return(0,q.jsx)(ep,{projectName:e.setupProject,initialRunId:e.siteHealthRunId});let m=i===`auto`&&p===`legacy`&&!e.setupProject&&l.isSuccess;if(m&&s===void 0)return u.isError?c(null):u.isSuccess&&u.isFetchedAfterMount&&c(Vf(l.data,u.data)),(0,q.jsx)(Qf,{});let h=m?s:null;return h?(0,q.jsx)(rp,{projectName:h.projectName,runId:h.runId}):p===`legacy`?(0,q.jsx)(Cf,{visibilityProjectName:e.setupProject,siteHealthOnboarding:e.onboarding===`site-health`,onboardingFinish:e.onboarding===`site-health`||e.onboarding===`first-run`}):p===`loading`?(0,q.jsx)(Qf,{}):p===`retry`?(0,q.jsx)($f,{onRetry:()=>{l.refetch()}}):(0,q.jsx)(ip,{onActivationStarted:()=>o(!0),skipSiteScan:e.siteScan===`skip`})}function rp({projectName:e,runId:t}){let n=Se();return(0,K.useEffect)(()=>{n({to:`/setup`,search:{onboarding:`site-health`,setupProject:e,...t?{siteHealthRunId:t}:{}},replace:!0})},[n,e,t]),(0,q.jsx)(Qf,{})}function ip({onActivationStarted:e,skipSiteScan:t}){return(0,q.jsx)(Nl,{title:`Site Health setup`,children:(0,q.jsx)(ap,{onActivationStarted:e,skipSiteScan:t})})}function ap({onActivationStarted:e,skipSiteScan:t}){let n=Se(),i=_e(),a=vd(),o=z({...Tr({client:W}),retry:!1}),s=ye(dr()),[l]=(0,K.useState)(()=>rd(`platform`)),[u,d]=(0,K.useState)(l.domain??``),[f,p]=(0,K.useState)(l.projectName??``),[h,g]=(0,K.useState)(l.displayName??``),[_,v]=(0,K.useState)(l.country??`US`),[x,S]=(0,K.useState)(l.language??`en`),[C,w]=(0,K.useState)(!1),[T,E]=(0,K.useState)(`idle`),[D,O]=(0,K.useState)(null),[k,A]=(0,K.useState)(null),[ee,j]=(0,K.useState)(!1),[te,ne]=(0,K.useState)(null),[M,re]=(0,K.useState)(!1),ie=Vt(),N=_t(),P=o.isError?void 0:o.data,ae=typeof P?.enabled==`boolean`?P.enabled:null,oe=s.isPending?s.variables.body.enabled:ae,[se,ce]=(0,K.useState)(null),le=(0,K.useRef)(null),{onboardingSessionId:ue,emit:F}=Xf(`platform`);(0,K.useEffect)(()=>{F({flowVersion:1,onboardingSessionId:ue,event:`onboarding.started`,step:`project`,resumed:!1},`onboarding.started`)},[F,ue]),(0,K.useEffect)(()=>{D||id(`platform`,{domain:u,projectName:f,displayName:h,country:_,language:x})},[D,u,f,h,_,x]);let de=()=>{ad(`platform`),d(``),p(``),g(``),v(`US`),S(`en`),w(!1),A(null),j(!1)},fe=qf(u),I=f||fe?.projectName||``,L=h||fe?.displayName||``,pe=T===`creating`||T===`dispatching`,me=k??te,he=Wf(_,x),{countryValid:R,languageValid:ge}=Gf(_,x),ve=R&&ge;(0,K.useEffect)(()=>{me&&le.current?.focus()},[me]);let be=(e,t)=>n({to:`/setup`,search:{...t?{siteHealthRunId:t}:{},onboarding:`site-health`,setupProject:e.name},replace:!0}),xe=async e=>{E(`dispatching`),ne(null);try{let t=a.mutateAsync({projectName:e.name,projectId:e.id,projectLabel:e.displayName||e.name,suppressErrorToast:!0,body:{checkDeadLinks:!0,maxPages:100}}),n=await Jf(t);if(n.state===`queued`){F({flowVersion:1,onboardingSessionId:ue,event:`run.requested`,origin:`dashboard_setup`,result:`queued`,kind:`site_health`,providerCountBucket:`0`,queryCountBucket:`0`}),Je(n.run.runId),await be(e,n.run.runId);return}t.then(()=>{F({flowVersion:1,onboardingSessionId:ue,event:`run.requested`,origin:`dashboard_setup`,result:`queued`,kind:`site_health`,providerCountBucket:`0`,queryCountBucket:`0`})},e=>{F({flowVersion:1,onboardingSessionId:ue,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,kind:`site_health`,providerCountBucket:`0`,queryCountBucket:`0`,reasonCode:vt(e,`run_rejected`)})}),Yf(t,e.id),await be(e)}catch(e){E(`recovery`),ne(Zf(e,`The project was created, but the Site Health scan could not be started.`));let t=vt(e,`run_rejected`);F({flowVersion:1,onboardingSessionId:ue,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,kind:`site_health`,providerCountBucket:`0`,queryCountBucket:`0`,reasonCode:t}),F({flowVersion:1,onboardingSessionId:ue,event:`onboarding.blocked`,step:`run`,action:`retry_run`,reasonCode:t},`onboarding.blocked:run:${t}`)}},Ce=async r=>{if(r.preventDefault(),fe&&(t||C)&&ve&&!pe){E(`creating`),A(null),j(!1),ne(null);try{let r=await St({name:I,displayName:L,canonicalDomain:fe.canonicalDomain,country:_,language:x});if(e(),O(r),ad(`platform`),F({flowVersion:1,onboardingSessionId:ue,event:`onboarding.step_completed`,step:`project`,method:`manual`},`onboarding.step_completed:project`),await i.invalidateQueries({queryKey:pr({client:W})}),t){od(r.name),await n({to:`/setup`,search:{experience:`legacy`,onboarding:`first-run`,setupProject:r.name},replace:!0});return}await xe(r)}catch(t){E(`idle`);let n=t instanceof Ut&&t.statusCode===409;j(n),A(Zf(t,`Could not create the project. Try again.`)),F({flowVersion:1,onboardingSessionId:ue,event:`onboarding.blocked`,step:`project`,action:`save`,reasonCode:vt(t,`project_create_failed`)},`onboarding.blocked:project`),n&&(e(),i.invalidateQueries({queryKey:pr({client:W})}))}}},we=()=>{D&&!pe&&xe(D)},Te=()=>{pe||n({to:`/projects`})},B=async()=>{try{await navigator.clipboard.writeText(N?Lf:Lf.replace(If,``)),re(!0)}catch{rr({tone:`negative`,title:`Could not copy setup request`,detail:N?`Open the agent quickstart to continue with the CLI instead.`:`Check your browser’s clipboard permission and try again.`})}},Ee=async e=>{ce(null);try{let t=await s.mutateAsync({client:W,body:{enabled:e}});i.setQueryData(gr({client:W}),t),t.enabled!==e&&ce(`The server kept telemetry ${t.enabled?`on`:`off`}. Check its telemetry settings.`)}catch{ce(`Could not update telemetry. Try again.`)}};return D&&T===`recovery`?(0,q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,q.jsx)(Td,{current:`site`}),(0,q.jsx)(`div`,{className:`page-header mt-8`,children:(0,q.jsxs)(`div`,{className:`page-header-left`,children:[(0,q.jsx)(`h1`,{className:`page-title`,children:`Project created`}),(0,q.jsxs)(`p`,{className:`page-subtitle`,children:[D.displayName||D.name,` is ready. The Site Health scan needs another try.`]})]})}),(0,q.jsxs)(`div`,{ref:le,className:`rounded-md border border-negative bg-negative-soft p-4`,role:`alert`,tabIndex:-1,children:[(0,q.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:te}),(0,q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:`You can retry the scan or continue setup and retry from Site Health.`}),(0,q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:[(0,q.jsx)(G,{type:`button`,onClick:we,children:`Retry Site Health scan`}),(0,q.jsx)(G,{type:`button`,variant:`secondary`,onClick:()=>{be(D)},children:`Continue setup`})]})]})]}):(0,q.jsxs)(`div`,{className:`page-container max-w-xl py-8 md:py-12`,children:[t?null:(0,q.jsx)(Td,{current:`site`}),(0,q.jsxs)(`header`,{className:`mb-8 ${t?``:`mt-8`}`,children:[(0,q.jsx)(`h1`,{id:`site-map-setup-title`,className:`text-heading-24 text-heading`,children:t?`Create a project`:`Scan your site`}),(0,q.jsx)(`p`,{className:`mt-2 max-w-lg text-copy-14 text-secondary`,children:t?`Add a public domain, then choose the queries you want to track. No site scan will run.`:`Enter your public website to see its pages, structure, internal links, and Technical AEO scores.`})]}),(0,q.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-2 text-label-13 text-secondary`,children:[(0,q.jsx)(`p`,{children:`Draft fields use tab storage when available. Scan permission resets on reload.`}),(0,q.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:pe,onClick:de,children:`Reset draft`})]}),(0,q.jsxs)(`form`,{"aria-labelledby":`site-map-setup-title`,className:`space-y-6`,onSubmit:er(Ce),noValidate:!0,children:[(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(`label`,{className:`text-label-14-strong text-heading`,htmlFor:`launchpad-domain`,children:`Website URL`}),(0,q.jsx)(`input`,{id:`launchpad-domain`,className:`h-10 w-full rounded-md border border-strong bg-bg-elevated/50 px-3 text-label-16 text-heading outline-none transition placeholder:text-muted focus:border-mono-500 focus:ring-1 focus:ring-mono-500 md:h-9 md:text-label-14 ${zf}`,type:`text`,inputMode:`url`,autoComplete:`url`,autoCapitalize:`none`,spellCheck:!1,required:!0,"aria-invalid":!(!u||fe),"aria-describedby":u&&!fe?`launchpad-domain-hint launchpad-domain-error`:`launchpad-domain-hint`,placeholder:`https://example.com`,value:u,onChange:e=>{d(e.target.value),A(null),j(!1)}}),(0,q.jsx)(`p`,{id:`launchpad-domain-hint`,className:`text-copy-14 text-secondary`,children:t?(0,q.jsxs)(q.Fragment,{children:[`A public domain is still required.`,` `,(0,q.jsx)(V,{to:`/setup`,search:{experience:`platform`},className:`text-copy-14-strong text-link underline-offset-4 hover:underline`,children:`Map with Site Health instead`})]}):(0,q.jsxs)(q.Fragment,{children:[`Only public pages are scanned.`,` `,(0,q.jsx)(V,{to:`/setup`,search:{experience:`platform`,onboarding:`first-run`,siteScan:`skip`},className:`text-copy-14-strong text-link underline-offset-4 hover:underline`,children:`Set up without a site scan`})]})}),u&&!fe?(0,q.jsx)(`p`,{id:`launchpad-domain-error`,className:`text-copy-14 text-negative`,role:`alert`,children:`Enter a public domain, such as example.com.`}):null]}),(0,q.jsxs)(`details`,{className:`group border-y border-default`,children:[(0,q.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center justify-between gap-4 py-2 text-label-14 [&::-webkit-details-marker]:hidden ${zf}`,children:[(0,q.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:`Project name and locale`}),(0,q.jsxs)(`span`,{className:`flex items-center gap-2 text-secondary`,children:[he,(0,q.jsx)(b,{className:`size-4 transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":`true`})]})]}),(0,q.jsxs)(`div`,{className:`space-y-5 border-t border-default py-4`,children:[fe?(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`mb-3 text-copy-14-strong text-heading`,children:`Project`}),(0,q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-project-name`,children:`Project name`}),(0,q.jsx)(`input`,{id:`launchpad-project-name`,className:`setup-input h-10`,type:`text`,value:I,onChange:e=>p(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-display-name`,children:`Display name`}),(0,q.jsx)(`input`,{id:`launchpad-display-name`,className:`setup-input h-10`,type:`text`,value:L,onChange:e=>g(e.target.value)})]})]})]}):null,(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`mb-3 text-copy-14-strong text-heading`,children:`Locale`}),(0,q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-country`,children:`Country`}),(0,q.jsx)(`select`,{id:`launchpad-country`,className:`setup-input h-10`,value:_,onChange:e=>v(e.target.value),children:Hf.map(e=>(0,q.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-language`,children:`Language`}),(0,q.jsx)(`select`,{id:`launchpad-language`,className:`setup-input h-10`,value:x,onChange:e=>S(e.target.value),children:Uf.map(e=>(0,q.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})]})]})]}),t?null:(0,q.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[`First scan: up to `,100,` pages. A limited scan describes the pages reached, not the whole site.`]}),t?null:(0,q.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-start gap-3 py-2`,children:[(0,q.jsx)(`input`,{className:`mt-0.5 size-4 shrink-0 rounded border-strong bg-bg`,type:`checkbox`,checked:C,onChange:e=>w(e.target.checked),"aria-label":`Allow Canonry to scan this public site.`}),(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`span`,{className:`text-label-14 text-heading`,children:`Allow Canonry to scan this public site.`}),(0,q.jsx)(kr,{text:Nf})]})]}),me?(0,q.jsxs)(`div`,{ref:le,className:`rounded-md border border-negative bg-negative-soft p-3`,role:`alert`,tabIndex:-1,children:[(0,q.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:me}),ee?(0,q.jsx)(G,{type:`button`,variant:`secondary`,size:`sm`,className:`mt-3`,onClick:Te,children:`View projects`}):null]}):null,(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(G,{className:`w-full ${zf}`,type:`submit`,disabled:!fe||!t&&!C||!ve||pe,children:T===`creating`||T===`dispatching`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(m,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),` `,t?`Creating project…`:`Mapping site…`]}):t?`Create project`:`Scan site`}),T===`dispatching`?(0,q.jsx)(`span`,{className:`text-center text-label-14 text-secondary`,role:`status`,children:`Opening Site Health when the scan is ready.`}):null]})]}),(0,q.jsxs)(`section`,{className:`mt-8 border-t border-default pt-6`,"aria-labelledby":`agent-setup-title`,children:[(0,q.jsx)(`p`,{id:`agent-setup-title`,className:`text-copy-14-strong text-heading`,children:`Use your agent instead`}),(0,q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:ie?`Connect your agent to this instance, or copy a request for a new local installation.`:`Connect ChatGPT or Claude Desktop to this instance.`}),(0,q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1`,children:[(0,q.jsx)(G,{asChild:!0,variant:`secondary`,size:`sm`,children:(0,q.jsx)(V,{to:`/agent-setup`,children:`Agent setup`})}),ie?(0,q.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:er(B),children:[M?(0,q.jsx)(y,{className:`size-3.5`,"aria-hidden":`true`}):(0,q.jsx)(c,{className:`size-3.5`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{"aria-live":`polite`,children:M?`Copied new-install request`:`Copy new-install request`})]}):null,ie&&N?(0,q.jsx)(G,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,q.jsxs)(`a`,{href:Ff,target:`_blank`,rel:`noopener noreferrer`,children:[`Agent quickstart`,(0,q.jsx)(r,{className:`size-3.5`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`sr-only`,children:` (opens in a new tab)`})]})}):null]})]}),ae===null?null:(0,q.jsxs)(`section`,{className:`mt-6 border-t border-default pt-5`,"aria-labelledby":`telemetry-title`,children:[(0,q.jsxs)(`label`,{className:`flex min-h-11 items-start gap-3 py-2 ${s.isPending?`cursor-wait`:`cursor-pointer`}`,children:[(0,q.jsx)(`input`,{className:`mt-0.5 size-4 shrink-0 rounded border-strong bg-bg accent-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-mono-500 disabled:cursor-wait`,type:`checkbox`,checked:oe??!1,disabled:s.isPending,onChange:e=>{Ee(e.target.checked)},"aria-describedby":`telemetry-detail`}),(0,q.jsxs)(`span`,{className:`grid gap-0.5`,children:[(0,q.jsx)(`span`,{id:`telemetry-title`,className:`text-label-14 text-heading`,children:`Share anonymous product telemetry`}),(0,q.jsx)(`span`,{id:`telemetry-detail`,className:`max-w-[70ch] text-label-14 text-secondary`,children:`Helps prioritize improvements. Canonry does not send raw domains, URLs, queries, answer content, or credentials.`})]})]}),s.isPending?(0,q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,role:`status`,children:`Saving preference…`}):null,se?(0,q.jsx)(`p`,{className:`mt-1 text-copy-14 text-negative`,role:`alert`,children:se}):null]})]})}function op(){return(0,q.jsx)(`div`,{className:`page-container`,children:(0,q.jsx)(`section`,{className:`page-section`,children:(0,q.jsxs)(Pr,{className:`surface-card empty-card`,children:[(0,q.jsx)(`h1`,{children:`Route not found`}),(0,q.jsx)(`p`,{children:`The current path does not map to a dashboard view.`}),(0,q.jsx)(G,{asChild:!0,children:(0,q.jsx)(V,{to:`/`,children:`Return to overview`})})]})})})}var sp=Ae(()=>jf(()=>import(`./ProjectPage-CzrD1lpf.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,15,8,16,9,10,11,12,13,0,17,18,19,20,21]),import.meta.url),`ProjectPage`),cp=Ae(()=>jf(()=>import(`./RunsPage-BggqKbOG.js`),__vite__mapDeps([22,1,2,3,4,5,6,7,15,9,10,13]),import.meta.url),`RunsPage`),lp=Ae(()=>jf(()=>import(`./HistoryPage-DsDx15am.js`),__vite__mapDeps([23,3,1,2,18,4,5,6,7,10,13]),import.meta.url),`HistoryPage`),up=Ae(()=>jf(()=>import(`./SettingsPage-B7ns_ECx.js`),__vite__mapDeps([24,1,2,3,4,5,6,7,16,9,13]),import.meta.url),`SettingsPage`),dp=Ae(()=>jf(()=>import(`./AgentSetupPage-DV06oPTd.js`),__vite__mapDeps([25,1,2,3,7,6,5,8,16]),import.meta.url),`AgentSetupPage`),fp=Ae(()=>jf(()=>import(`./BacklinksPage-Dw0wgYlg.js`),__vite__mapDeps([26,1,2,3,7,6,5,16,13,17]),import.meta.url),`BacklinksPage`),pp=Ae(()=>jf(()=>import(`./TrafficPage-DRTbgzKI.js`),__vite__mapDeps([27,1,2,3,4,5,6,7,16,9,10,12,13,20]),import.meta.url),`TrafficPage`),mp=Ae(()=>jf(()=>import(`./TrafficSourceDetailPage-sgLE2gdJ.js`),__vite__mapDeps([28,1,2,3,4,5,6,7,15,11,12,13,20,9,10,21]),import.meta.url),`TrafficSourceDetailPage`),hp=Ae(()=>jf(()=>import(`./MeasurementPropertyPage-Bkxt3QcY.js`),__vite__mapDeps([29,1,2,3,4,5,6,7,15,8,10,11,12,19]),import.meta.url),`MeasurementPropertyPage`);function gp(){return(0,q.jsx)(jl,{children:(0,q.jsx)(Kr,{children:(0,q.jsx)(Al,{})})})}var _p=xe()({component:gp,validateSearch:e=>({manageQueries:e.manageQueries===!0||e.manageQueries===`true`||void 0,runId:typeof e.runId==`string`?e.runId:void 0,siteHealthRunId:typeof e.siteHealthRunId==`string`?e.siteHealthRunId:void 0,seoProfileId:typeof e.seoProfileId==`string`?e.seoProfileId:void 0,seoRunId:typeof e.seoRunId==`string`?e.seoRunId:void 0,seoRegion:typeof e.seoRegion==`string`&&e.seoRegion?e.seoRegion:void 0,seoMarket:typeof e.seoMarket==`string`&&e.seoMarket?e.seoMarket:void 0,seoShow:typeof e.seoShow==`string`&&e.seoShow?e.seoShow:void 0,seoSort:typeof e.seoSort==`string`&&e.seoSort?e.seoSort:void 0,seoQ:typeof e.seoQ==`string`&&e.seoQ?e.seoQ:void 0,evidenceId:typeof e.evidenceId==`string`?e.evidenceId:void 0,runStatus:typeof e.runStatus==`string`?e.runStatus:void 0,runKind:typeof e.runKind==`string`?e.runKind:void 0,runProject:typeof e.runProject==`string`?e.runProject:void 0,runWindow:typeof e.runWindow==`string`?e.runWindow:void 0,runQuery:typeof e.runQuery==`string`?e.runQuery:void 0,onboarding:e.onboarding===`site-health`||e.onboarding===`first-run`||e.onboarding===`complete`?e.onboarding:void 0,experience:e.experience===`legacy`||e.experience===`platform`?e.experience:void 0,siteScan:e.siteScan===`skip`?`skip`:void 0,skipped:e.skipped===`visibility`?`visibility`:void 0,setupProject:typeof e.setupProject==`string`?e.setupProject:void 0,scope:typeof e.scope==`string`?e.scope:void 0,class:typeof e.class==`string`?e.class:void 0,...Object.fromEntries([`queryWorkspace`,`researchMode`,`trackingQueryId`,`measurementScope`,`measurementScopeKey`,`measurementMarketKey`,`queryClass`,`measurementProvider`,`measurementModel`,`measurementLocation`,`measurementFrom`,`measurementTo`,`measurementRevision`,`measurementRunId`,`measurementQueryKey`,`measurementAnswer`,`journeyView`,`journeyDays`,`journeyVisitor`,`journeyEngine`,`journeyReturned`,`journeyOffset`,`agentHours`].map(t=>[t,typeof e[t]==`string`&&e[t]?e[t]:void 0]))})}),vp=B({getParentRoute:()=>_p,path:`/`,component:Xu,beforeLoad:async({context:e})=>{let t=e.queryClient.getQueryData(pr({client:W}));if(t===void 0)try{t=await e.queryClient.ensureQueryData(yr({client:W}))}catch{return}if(t.length===0)throw we({to:`/setup`})}}),yp=B({getParentRoute:()=>_p,path:`/projects`,component:ed}),bp=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,xp=B({getParentRoute:()=>_p,path:`/projects/$projectName`,component:()=>(0,q.jsx)(Oe,{}),beforeLoad:async({context:e,params:t,location:n})=>{let r=t.projectName;if(!bp.test(r))return;let i=e.queryClient.getQueryData(pr({client:W}));if(!i)try{i=await e.queryClient.ensureQueryData(yr({client:W}))}catch{return}let a=i.find(e=>e.id===r);if(a)throw we({to:n.pathname.replace(`/projects/${r}`,`/projects/${encodeURIComponent(a.name)}`),replace:!0})}}),Sp=B({getParentRoute:()=>xp,path:`/`,component:()=>(0,q.jsx)(sp,{tab:`overview`})}),Cp=B({getParentRoute:()=>xp,path:`/portfolio`,component:()=>(0,q.jsx)(sp,{tab:`portfolio`})}),wp=B({getParentRoute:()=>xp,path:`/search-console`,component:()=>(0,q.jsx)(sp,{tab:`search-console`})}),Tp=B({getParentRoute:()=>xp,path:`/seo-data`,component:()=>(0,q.jsx)(sp,{tab:`seo-data`})}),Ep=B({getParentRoute:()=>xp,path:`/journeys`,component:()=>(0,q.jsx)(sp,{tab:`journeys`})}),Dp=B({getParentRoute:()=>xp,path:`/conversions`,component:()=>(0,q.jsx)(sp,{tab:`conversions`})}),Op=B({getParentRoute:()=>xp,path:`/local`,component:()=>(0,q.jsx)(sp,{tab:`local`})}),kp=B({getParentRoute:()=>xp,path:`/discovery`,component:()=>(0,q.jsx)(sp,{tab:`discovery`})}),Ap=B({getParentRoute:()=>xp,path:`/queries`,component:()=>(0,q.jsx)(sp,{tab:`queries`})}),jp=B({getParentRoute:()=>xp,path:`/client-queries`,component:()=>(0,q.jsx)(sp,{tab:`client-queries`})}),Mp=B({getParentRoute:()=>xp,path:`/properties/$targetKey`,component:()=>(0,q.jsx)(hp,{})}),Np=B({getParentRoute:()=>xp,path:`/report`,beforeLoad:({params:e})=>{throw we({to:`/projects/$projectName`,params:e,replace:!0})}}),Pp=B({getParentRoute:()=>xp,path:`/activity`,component:()=>(0,q.jsx)(sp,{tab:`activity`})}),Fp=B({getParentRoute:()=>xp,path:`/backlinks`,component:()=>(0,q.jsx)(sp,{tab:`backlinks`})}),Ip=B({getParentRoute:()=>xp,path:`/technical-aeo`,component:()=>(0,q.jsx)(sp,{tab:`technical-aeo`})}),Lp=B({getParentRoute:()=>xp,path:`/history`,component:()=>(0,q.jsx)(sp,{tab:`history`})}),Rp=B({getParentRoute:()=>xp,path:`/settings`,component:()=>(0,q.jsx)(sp,{tab:`settings`})}),zp=B({getParentRoute:()=>_p,path:`/runs`,component:cp}),Bp=B({getParentRoute:()=>_p,path:`/history`,component:lp}),Vp=B({getParentRoute:()=>_p,path:`/settings`,component:up,beforeLoad:({context:e})=>{}}),Hp=B({getParentRoute:()=>_p,path:`/setup`,component:np}),Up=B({getParentRoute:()=>_p,path:`/agent-setup`,component:dp}),Wp=B({getParentRoute:()=>_p,path:`/backlinks`,component:fp}),Gp=B({getParentRoute:()=>_p,path:`/traffic`,component:pp}),Kp=B({getParentRoute:()=>_p,path:`/traffic/$projectName/$sourceId`,component:mp}),qp=B({getParentRoute:()=>_p,path:`*`,component:op}),Jp=_p.addChildren([vp,yp,xp.addChildren([Sp,Cp,wp,Tp,Ep,Dp,Op,kp,Ap,jp,Mp,Np,Pp,Fp,Ip,Lp,Rp]),zp,Bp,Vp,Hp,Up,Wp,Gp,Kp,qp]);function Yp(){return typeof window<`u`&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:`/`}var Xp=Yp(),Zp=Xp===`/`?``:Xp.replace(/\/$/,``);function Qp(e,t){return be({routeTree:Jp,basepath:Zp||`/`,context:{queryClient:e},...t?.initialEntries&&{history:Ee({initialEntries:t.initialEntries})}})}var $p=!1;async function em(e){return(await $e({client:W,body:e,keepalive:!0})).data}function tm(){$p||typeof window>`u`||($p=!0,!(In()||Et())&&(Rn({send:em}),W.interceptors.request.use((e,t)=>{let n=t.fetch??globalThis.fetch,r=typeof t.url==`string`?t.url:void 0;return t.fetch=async(t,i)=>{try{return await n(t,i)}catch(t){throw t instanceof DOMException&&t.name===`AbortError`||bt({method:e.method,route:r,network:!0}),t}},e}),W.interceptors.response.use((e,t,n)=>(bt({method:t.method,route:typeof n.url==`string`?n.url:void 0,path:rm(t.url),status:e.status}),e)),window.addEventListener(`error`,e=>{Ve({kind:`unhandled`,error:e.error})}),window.addEventListener(`unhandledrejection`,e=>{Ve({kind:`unhandled`,error:e.reason})}),cm()))}function nm(e){let t=null,n=()=>{let n=e.state.matches.at(-1);if(!n)return;Ke(n.fullPath);let r=e.state.location;if(!r)return;let i=r.search&&typeof r.search==`object`?r.search:{};t&&t.pathname===r.pathname&&Fn(t.search,i),t={pathname:r.pathname,search:i}};return n(),e.subscribe(`onResolved`,n)}function rm(e){try{return new URL(e,window.location.origin).pathname}catch{return}}var im={LCP:[2500,4e3],INP:[200,500],CLS:[.1,.25],FCP:[1800,3e3],TTFB:[800,1800]};function am(e,t){let[n,r]=im[e];return t<=n?`good`:t<=r?`needs-improvement`:`poor`}function om(){let e=0,t=0,n=-1/0,r=-1/0;return{add(i){i.hadRecentInput||(i.startTime-r<1e3&&i.startTime-n<5e3?t+=i.value:(t=i.value,n=i.startTime),r=i.startTime,e=Math.max(e,t))},value:()=>e}}function sm(){let e=0;return{add(t){t.interactionId&&(e=Math.max(e,t.duration))},value:()=>e}}function cm(){if(typeof PerformanceObserver>`u`)return;let e=new Set,t=(t,n)=>{!e.has(t)&&Number.isFinite(n)&&(e.add(t),wt(t,am(t,n)))},n=(e,t,n={})=>{try{new PerformanceObserver(e=>t(e.getEntries())).observe({type:e,buffered:!0,...n})}catch{}};try{let e=performance.getEntriesByType(`navigation`)[0];e&&e.responseStart>0&&t(`TTFB`,e.responseStart)}catch{}n(`paint`,e=>{let n=e.find(e=>e.name===`first-contentful-paint`);n&&t(`FCP`,n.startTime)});let r=0;n(`largest-contentful-paint`,e=>{let t=e.at(-1);t&&(r=t.startTime)});let i=om();n(`layout-shift`,e=>{for(let t of e)i.add({startTime:t.startTime,value:t.value??0,hadRecentInput:t.hadRecentInput===!0})});let a=sm();n(`event`,e=>{for(let t of e)a.add(t)},{durationThreshold:40});let o=()=>{r>0&&t(`LCP`,r),t(`CLS`,i.value()),a.value()>0&&t(`INP`,a.value())};document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&o()}),window.addEventListener(`pagehide`,o)}var lm=6e4,um=`Anyone with this password can sign in to this dashboard.`,dm={label:`Root API key`,help:`To create the password from here, enter the root API key (apiKey in config.yaml). It is used once and not saved.`,missing:`Enter the root API key.`,rejected:`That is not the root API key for this install.`,show:`Show passwords and key`},fm={id:`embed`,scopes:[`read`,`embed`],projectId:`embed`,readOnly:!0};function pm(){let e=(0,K.useRef)(vn()).current,[t,n]=(0,K.useState)(e?`ready`:`checking`),[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(null),[s,c]=(0,K.useState)(e),[l,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(``),[p,m]=(0,K.useState)(``),[h,g]=(0,K.useState)(``),[_,v]=(0,K.useState)(!1),[y,b]=(0,K.useState)(`password`),[x,S]=(0,K.useState)(!1),[C,w]=(0,K.useState)(``),[T,E]=(0,K.useState)(null),[D,O]=(0,K.useState)(!1),[k,A]=(0,K.useState)(!1),ee=(0,K.useRef)(null),j=(0,K.useRef)(null),te=(0,K.useRef)(null),ne=()=>{let t=r?`${r.name}:${r.role}`:e?`api-key:explicit`:a?`api-key:${a.id}`:`no-accounts`;if(!ee.current||te.current!==t){j.current?.clear();let e=nr();j.current=e,ee.current=Qp(e),nm(ee.current),te.current=t}return{queryClient:j.current,router:ee.current}},M=e=>e.authRequired?(u(!0),i(e.user),o(null),c(!1),n(e.user?`ready`:`account-login`),!0):!1;(0,K.useEffect)(()=>{let t=!1,r=async(e,r=!1)=>{try{let e=await Vn();if(t)return;o(e),c(!1),n(`ready`)}catch(i){if(t)return;if(r&&i instanceof Ut&&i.statusCode===401)return jn().then(()=>{t||(E(null),o(null),c(!1),A(!0),n(`login`))}).catch(r=>{t||(E(r instanceof Error?r.message:`Could not clear the invalid session`),n(e))});E(i instanceof Error?i.message:`Could not verify API key access`),n(e)}};return e?(r(`api-key-error`),()=>{t=!0}):(Promise.allSettled([at(),kn()]).then(([e,i])=>{if(t||e.status===`fulfilled`&&M(e.value))return;if(i.status===`rejected`){let e=i.reason;E(e instanceof Error?e.message:`Failed to reach the Canonry API`),n(`login`);return}let a=i.value;a.authenticated&&In()?(o(fm),c(!1),n(`ready`)):a.authenticated?(c(!0),r(`api-key-error`,!0)):(o(null),c(!1),n(a.setupRequired?`setup`:`login`))}),()=>{t=!0})},[]),(0,K.useEffect)(()=>{if(t!==`ready`||e)return;let r=setInterval(()=>{l?at().then(e=>{e.authRequired&&!e.user&&(A(!0),i(null),o(null),n(`account-login`))}).catch(()=>{}):kn().then(e=>{e.authenticated||(A(!0),o(null),n(e.setupRequired?`setup`:`login`))}).catch(()=>{})},lm);return bn(()=>{A(!0),i(null),o(null),c(!1),n(l?`account-login`:`login`)}),()=>{clearInterval(r),bn(null)}},[t,l,e]);let re=async e=>{if(e.preventDefault(),!p.trim()||p.trim().length<8){E(`Password must be at least 8 characters`);return}if(p!==h){E(`Passwords do not match`);return}let t=C.trim();if(x&&!t)E(dm.missing);else{O(!0),E(null);try{if(!(await Rt(p.trim(),x?t:void 0)).authenticated){E(`Setup failed`);return}m(``),g(``),w(``),S(!1),v(!1),A(!1),o(null),c(!0),n(`checking`);try{let e=await Vn();o(e),c(!1),n(`ready`)}catch(e){E(e instanceof Error?e.message:`Could not verify API key access`),n(`api-key-error`)}}catch(e){if(e instanceof Ut&&e.statusCode===401&&e.code===`AUTH_REQUIRED`){E(x?dm.rejected:null),S(!0);return}E(e instanceof Ut||e instanceof Error?e.message:`Setup failed`)}finally{O(!1)}}},ie=e=>{m(e),E(null)},N=e=>{w(e),E(null)},P=e=>{g(e),E(null)},ae=async e=>{if(e.preventDefault(),p.trim()){O(!0),E(null);try{if(!(y===`api-key`?await dt(p.trim()):await ln(p.trim())).authenticated){E(y===`api-key`?`Invalid API key`:`Incorrect password`);return}let e=await Vn();o(e),c(!1),m(``),v(!1),A(!1),n(`ready`)}catch(e){E(e instanceof Ut||e instanceof Error?e.message:`Authentication failed`)}finally{O(!1)}}},oe=e=>{b(e),m(``),v(!1),E(null)},se=async e=>{if(e.preventDefault(),d.trim()&&p){O(!0),E(null);try{let e=await $t(d.trim(),p);if(!e.user){E(`Incorrect name or password.`);return}m(``),A(!1),i(e.user),o(null),c(!1),n(`ready`)}catch(e){E(e instanceof Ut?e.message:`Incorrect name or password.`)}finally{O(!1)}}};if(t===`ready`){let{queryClient:e,router:t}=ne();return(0,q.jsx)($n,{account:r,apiKey:a,apiKeyPending:s,children:(0,q.jsx)(ve,{client:e,children:(0,q.jsx)(Te,{router:t})})})}let ce=p.trim(),le=p.length>0&&ce.length<8,ue=h.length>0&&p!==h,F=ce.length>=8&&p===h&&(!x||C.trim().length>0);return(0,q.jsx)(`div`,{className:`min-h-screen bg-bg px-4 py-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto flex min-h-[calc(100vh-4rem)] max-w-md flex-col items-center justify-center gap-5`,children:[(0,q.jsxs)(`div`,{"data-testid":`auth-brand`,className:`flex items-center gap-2.5`,children:[(0,q.jsx)(Gi,{className:`size-7`}),(0,q.jsx)(`span`,{className:`text-label-18-strong text-heading`,children:`Canonry`})]}),(0,q.jsx)(Pr,{className:`surface-card w-full`,children:t===`checking`?(0,q.jsx)(Mr,{className:`py-8`,children:(0,q.jsx)(`p`,{className:`supporting-copy text-center`,children:`Connecting to Canonry…`})}):t===`api-key-error`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(jr,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Dashboard access`}),(0,q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Could not verify API key access`})]}),(0,q.jsxs)(Mr,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`supporting-copy`,children:T??`Canonry could not verify this session’s access, so the dashboard stayed locked.`}),(0,q.jsx)(G,{type:`button`,className:`w-full`,onClick:()=>{window.location.reload()},children:`Try again`})]})]}):t===`account-login`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(jr,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Dashboard access`}),(0,q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Sign in to Canonry`})]}),(0,q.jsxs)(Mr,{children:[k?(0,q.jsx)(`p`,{className:`mb-4 rounded-md border border-caution bg-caution-soft px-3 py-2 text-copy-14 text-caution`,children:`You were signed out — please sign in again.`}):null,(0,q.jsxs)(`form`,{className:`space-y-4`,onSubmit:er(se),children:[(0,q.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`account-name`,children:[(0,q.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:`Name`}),(0,q.jsx)(`input`,{autoFocus:!0,id:`account-name`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:`text`,name:`username`,autoComplete:`username`,value:d,onChange:e=>{f(e.target.value),E(null)},"aria-invalid":!!T,"aria-describedby":T?`account-login-error`:void 0})]}),(0,q.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`account-password`,children:[(0,q.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:`Password`}),(0,q.jsx)(`input`,{id:`account-password`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:`password`,name:`password`,autoComplete:`current-password`,value:p,onChange:e=>ie(e.target.value),"aria-invalid":!!T,"aria-describedby":T?`account-login-error`:void 0})]}),T?(0,q.jsx)(`p`,{id:`account-login-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:T}):null,(0,q.jsx)(G,{type:`submit`,disabled:D||!d.trim()||!p,children:D?`Signing in…`:`Sign in`})]})]})]}):t===`setup`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(jr,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`First-time setup`}),(0,q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Create a dashboard password`}),(0,q.jsx)(Nr,{children:um})]}),(0,q.jsx)(Mr,{children:(0,q.jsxs)(`form`,{className:`space-y-4`,onSubmit:er(re),children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-password-new`,children:`Password`}),(0,q.jsx)(`input`,{autoFocus:!0,id:`dashboard-password-new`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:_?`text`:`password`,name:`new-password`,autoComplete:`new-password`,minLength:8,required:!0,value:p,onChange:e=>ie(e.target.value),"aria-invalid":le,"aria-describedby":`dashboard-password-new-help`}),(0,q.jsx)(`span`,{id:`dashboard-password-new-help`,"aria-live":`polite`,className:le?`block text-label-14 text-negative-400`:`block text-label-14 text-secondary`,children:le?`Enter at least 8 characters.`:`Use at least 8 characters.`})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-password-confirm`,children:`Confirm password`}),(0,q.jsx)(`input`,{id:`dashboard-password-confirm`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:_?`text`:`password`,name:`confirm-password`,autoComplete:`new-password`,minLength:8,required:!0,value:h,onChange:e=>P(e.target.value),"aria-invalid":ue,"aria-describedby":`dashboard-password-confirm-help`}),(0,q.jsx)(`span`,{id:`dashboard-password-confirm-help`,"aria-live":`polite`,className:ue?`block text-label-14 text-negative-400`:`block text-label-14 text-secondary`,children:ue?`Passwords do not match.`:`Enter the same password again.`})]}),x?(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-setup-root-key`,children:dm.label}),(0,q.jsx)(`input`,{autoFocus:!0,id:`dashboard-setup-root-key`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:_?`text`:`password`,name:`apiKey`,autoComplete:`off`,spellCheck:!1,required:!0,value:C,onChange:e=>N(e.target.value),"aria-invalid":T===dm.rejected,"aria-describedby":`dashboard-setup-root-key-help`}),(0,q.jsx)(`span`,{id:`dashboard-setup-root-key-help`,"aria-live":`polite`,className:`block text-label-14 text-secondary`,children:dm.help})]}):null,(0,q.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-2 text-label-14 text-secondary`,htmlFor:`dashboard-password-show`,children:[(0,q.jsx)(`input`,{id:`dashboard-password-show`,type:`checkbox`,checked:_,onChange:e=>v(e.target.checked)}),x?dm.show:`Show passwords`]}),T?(0,q.jsx)(`p`,{id:`dashboard-password-setup-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:T}):null,(0,q.jsx)(G,{type:`submit`,disabled:D||!F,children:D?`Creating password…`:`Create password and continue`})]})})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(jr,{children:[(0,q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Dashboard access`}),(0,q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Sign in to Canonry`}),(0,q.jsx)(Nr,{children:y===`api-key`?`Enter an API key from this Canonry install. This opens the dashboard with that key’s access and does not change the password.`:`Enter your dashboard password to continue.`})]}),(0,q.jsxs)(Mr,{children:[k?(0,q.jsx)(`p`,{className:`mb-4 rounded-md border border-caution bg-caution-soft px-3 py-2 text-copy-14 text-caution`,children:`Your session expired — please sign in again.`}):null,(0,q.jsxs)(`form`,{className:`space-y-4`,onSubmit:er(ae),children:[(0,q.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`dashboard-password-current`,children:[(0,q.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:y===`api-key`?`Canonry API key`:`Password`}),(0,q.jsx)(`input`,{autoFocus:!0,id:`dashboard-password-current`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:_?`text`:`password`,name:y===`api-key`?`apiKey`:`password`,autoComplete:y===`api-key`?`off`:`current-password`,spellCheck:!1,required:!0,value:p,onChange:e=>ie(e.target.value),"aria-invalid":!!T,"aria-describedby":T?`dashboard-password-login-error`:void 0})]}),(0,q.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-2 text-label-14 text-secondary`,htmlFor:`dashboard-login-password-show`,children:[(0,q.jsx)(`input`,{id:`dashboard-login-password-show`,type:`checkbox`,checked:_,onChange:e=>v(e.target.checked)}),y===`api-key`?`Show API key`:`Show password`]}),T?(0,q.jsx)(`p`,{id:`dashboard-password-login-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:T}):null,(0,q.jsx)(G,{type:`submit`,disabled:D||!p.trim(),children:D?`Signing in…`:`Open dashboard`}),(0,q.jsx)(G,{type:`button`,variant:`ghost`,onClick:()=>oe(y===`api-key`?`password`:`api-key`),children:y===`api-key`?`Use dashboard password instead`:`Forgot password? Use API key`})]})]})]})})]})})}var mm=document.getElementById(`root`);if(!mm)throw Error(`Expected #root element for web app bootstrap.`);tm(),(0,Br.createRoot)(mm).render((0,q.jsx)(K.StrictMode,{children:(0,q.jsx)(Xa,{children:(0,q.jsx)(pm,{})})}));export{Ss as $,Ma as $t,Nu as A,fa as At,mc as B,Ha as Bt,ld as C,Qi as Ct,Fu as D,pa as Dt,Yu as E,ma as Et,Bl as F,ga as Ft,Ks as G,ca as Gt,Xs as H,wa as Ht,Pl as I,ba as It,Us as J,la as Jt,Vs as K,da as Kt,zl as L,Ba as Lt,wu as M,xa as Mt,Du as N,ja as Nt,Ou as O,J as Ot,Vl as P,ea as Pt,ws as Q,_a as Qt,Nl as R,ra as Rt,vd as S,ta as St,Qu as T,Zi as Tt,nc as U,sa as Ut,Zs as V,za as Vt,tc as W,Xi as Wt,Bs as X,Da as Xt,Gs as Y,Ua as Yt,Ws as Z,Na as Zt,Sd as _,qi as _t,qd as a,gi as an,_o as at,bd as b,Ta as bt,Bd as c,pi as cn,mo as ct,Ad as d,Xr as dn,fo as dt,Pi as en,ys as et,Nd as f,ri as fn,lo as ft,Td as g,Ga as gt,Od as h,Qa as ht,mf as i,bi as in,Wo as it,Tu as j,Sa as jt,Mu as k,Ea as kt,Hd as l,ei as ln,no as lt,Fd as m,Wr as mn,to as mt,ff as n,Fi as nn,ms as nt,ef as o,_i as on,go as ot,Id as p,qr as pn,uo as pt,zs as q,ua as qt,pf as r,Ii as rn,ps as rt,Wd as s,hi as sn,ho as st,jf as t,Bi as tn,_s as tt,Vd as u,ni as un,co as ut,_d as v,Ji as vt,sd as w,$i as wt,gd as x,ya as xt,yd as y,Yi as yt,Ml as z,Oa as zt};