@canonry/canonry 5.34.0 → 6.1.1

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 (39) hide show
  1. package/assets/agent-workspace/skills/aero/references/portfolio-analysis.md +15 -3
  2. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +4 -8
  3. package/assets/assets/{AuditHistoryPanel-Ddg6JIi3.js → AuditHistoryPanel-Dtt7cbYo.js} +1 -1
  4. package/assets/assets/{BacklinksPage-DI9BmaYt.js → BacklinksPage-h25kHk3u.js} +1 -1
  5. package/assets/assets/{HistoryPage-CACIL005.js → HistoryPage-70YWNYBU.js} +1 -1
  6. package/assets/assets/{MeasurementPropertyPage-D_i3t0DT.js → MeasurementPropertyPage-CBPQ3A99.js} +1 -1
  7. package/assets/assets/ProjectPage-Dbbxf8yl.js +8 -0
  8. package/assets/assets/RunsPage-B6LqcDRg.js +1 -0
  9. package/assets/assets/SettingsPage-DNV6Is27.js +1 -0
  10. package/assets/assets/SiteHealthSection-CWEIYXut.js +4 -0
  11. package/assets/assets/TrafficPage-ZZqGgMyL.js +40 -0
  12. package/assets/assets/{TrafficSourceDetailPage-BPqNmuws.js → TrafficSourceDetailPage-_RMyqM86.js} +1 -1
  13. package/assets/assets/{extract-error-message-B7OeWj0x.js → extract-error-message-D-AaTlPU.js} +1 -1
  14. package/assets/assets/index-BCKrocfL.js +86 -0
  15. package/assets/assets/index-C17E5ZcA.css +1 -0
  16. package/assets/assets/{react-sigma_core.esm.min-jiMNkILi.js → react-sigma_core.esm.min-CaRTZKvV.js} +1 -1
  17. package/assets/assets/{v2-overview-adapter-Caj3bHQE.js → v2-overview-adapter-C16fKgpq.js} +1 -1
  18. package/assets/index.html +2 -2
  19. package/dist/{chunk-G2K5KCUY.js → chunk-B5W7HDCG.js} +49 -24
  20. package/dist/{chunk-25H4K7KL.js → chunk-DMU3SFC4.js} +8 -8
  21. package/dist/{chunk-NZCKJMLC.js → chunk-HTTYBQN4.js} +2 -2
  22. package/dist/{chunk-NOIK3FUO.js → chunk-LXHE4DVO.js} +68 -17
  23. package/dist/{chunk-VHPGBX4P.js → chunk-MJ3QINUW.js} +3 -3
  24. package/dist/{chunk-QTETJEHI.js → chunk-PDOMOHOP.js} +6 -3
  25. package/dist/{chunk-AIAVZY6L.js → chunk-QFI47QVP.js} +36 -135
  26. package/dist/cli.js +22 -12
  27. package/dist/{demo-server-UI24OAHX.js → demo-server-VP6CP33U.js} +4 -4
  28. package/dist/index.js +6 -6
  29. package/dist/{intelligence-service-ZKFLGJ23.js → intelligence-service-6F63MYQ5.js} +2 -2
  30. package/dist/mcp.js +4 -4
  31. package/package.json +15 -15
  32. package/assets/assets/ProjectPage-d1djqfh3.js +0 -8
  33. package/assets/assets/RunRow-CjhvvA6g.js +0 -1
  34. package/assets/assets/RunsPage-DuBhw2uc.js +0 -1
  35. package/assets/assets/SettingsPage-MUpfB0HH.js +0 -1
  36. package/assets/assets/SiteHealthSection-6qdXlFcO.js +0 -4
  37. package/assets/assets/TrafficPage--nGSOgqn.js +0 -40
  38. package/assets/assets/index-C4lreGwR.js +0 -86
  39. package/assets/assets/index-DX5M4MHr.css +0 -1
@@ -1,4 +1,4 @@
1
- import{g as Bt,t as S,r as C}from"./vendor-tanstack-ZXXkndVj.js";import{e as Ht,G as Wt}from"./SiteHealthSection-6qdXlFcO.js";import"./index-C4lreGwR.js";import"./vendor-radix-twS1M3FF.js";import"./vendor-recharts-llkUFBGR.js";import"./vendor-lucide-N6vOpZmh.js";import"./vendor-markdown-B4giJcws.js";import"./vendor-yaml-GWJz5H2G.js";import"./ChartPrimitives-B5okB5g-.js";function Vt(r,n){if(typeof r!="object"||!r)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var e=i.call(r,n);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function ae(r){var n=Vt(r,"string");return typeof n=="symbol"?n:n+""}function A(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}function He(r,n){for(var i=0;i<n.length;i++){var e=n[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(r,ae(e.key),e)}}function L(r,n,i){return n&&He(r.prototype,n),i&&He(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r}function Q(r){return Q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Q(r)}function yt(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yt=function(){return!!r})()}function jt(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Zt(r,n){if(n&&(typeof n=="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jt(r)}function I(r,n,i){return n=Q(n),Zt(r,yt()?Reflect.construct(n,i||[],Q(r).constructor):n.apply(r,i))}function xe(r,n){return xe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,e){return i.__proto__=e,i},xe(r,n)}function G(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(n&&n.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),n&&xe(r,n)}function qt(r){if(Array.isArray(r))return r}function Yt(r,n){var i=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(i!=null){var e,t,a,o,s=[],l=!0,h=!1;try{if(a=(i=i.call(r)).next,n===0){if(Object(i)!==i)return;l=!1}else for(;!(l=(e=a.call(i)).done)&&(s.push(e.value),s.length!==n);l=!0);}catch(u){h=!0,t=u}finally{try{if(!l&&i.return!=null&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw t}}return s}}function Se(r,n){(n==null||n>r.length)&&(n=r.length);for(var i=0,e=Array(n);i<n;i++)e[i]=r[i];return e}function Tt(r,n){if(r){if(typeof r=="string")return Se(r,n);var i={}.toString.call(r).slice(8,-1);return i==="Object"&&r.constructor&&(i=r.constructor.name),i==="Map"||i==="Set"?Array.from(r):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Se(r,n):void 0}}function Xt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{g as Bt,t as S,r as C}from"./vendor-tanstack-ZXXkndVj.js";import{e as Ht,G as Wt}from"./SiteHealthSection-CWEIYXut.js";import"./index-BCKrocfL.js";import"./vendor-radix-twS1M3FF.js";import"./vendor-recharts-llkUFBGR.js";import"./vendor-lucide-N6vOpZmh.js";import"./vendor-markdown-B4giJcws.js";import"./vendor-yaml-GWJz5H2G.js";import"./ChartPrimitives-B5okB5g-.js";function Vt(r,n){if(typeof r!="object"||!r)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var e=i.call(r,n);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function ae(r){var n=Vt(r,"string");return typeof n=="symbol"?n:n+""}function A(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}function He(r,n){for(var i=0;i<n.length;i++){var e=n[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(r,ae(e.key),e)}}function L(r,n,i){return n&&He(r.prototype,n),i&&He(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r}function Q(r){return Q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Q(r)}function yt(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yt=function(){return!!r})()}function jt(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Zt(r,n){if(n&&(typeof n=="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jt(r)}function I(r,n,i){return n=Q(n),Zt(r,yt()?Reflect.construct(n,i||[],Q(r).constructor):n.apply(r,i))}function xe(r,n){return xe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,e){return i.__proto__=e,i},xe(r,n)}function G(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(n&&n.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),n&&xe(r,n)}function qt(r){if(Array.isArray(r))return r}function Yt(r,n){var i=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(i!=null){var e,t,a,o,s=[],l=!0,h=!1;try{if(a=(i=i.call(r)).next,n===0){if(Object(i)!==i)return;l=!1}else for(;!(l=(e=a.call(i)).done)&&(s.push(e.value),s.length!==n);l=!0);}catch(u){h=!0,t=u}finally{try{if(!l&&i.return!=null&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw t}}return s}}function Se(r,n){(n==null||n>r.length)&&(n=r.length);for(var i=0,e=Array(n);i<n;i++)e[i]=r[i];return e}function Tt(r,n){if(r){if(typeof r=="string")return Se(r,n);var i={}.toString.call(r).slice(8,-1);return i==="Object"&&r.constructor&&(i=r.constructor.name),i==="Map"||i==="Set"?Array.from(r):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Se(r,n):void 0}}function Xt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ee(r,n){return qt(r)||Yt(r,n)||Tt(r,n)||Xt()}var pe={black:"#000000",silver:"#C0C0C0",gray:"#808080",grey:"#808080",white:"#FFFFFF",maroon:"#800000",red:"#FF0000",purple:"#800080",fuchsia:"#FF00FF",green:"#008000",lime:"#00FF00",olive:"#808000",yellow:"#FFFF00",navy:"#000080",blue:"#0000FF",teal:"#008080",aqua:"#00FFFF",darkblue:"#00008B",mediumblue:"#0000CD",darkgreen:"#006400",darkcyan:"#008B8B",deepskyblue:"#00BFFF",darkturquoise:"#00CED1",mediumspringgreen:"#00FA9A",springgreen:"#00FF7F",cyan:"#00FFFF",midnightblue:"#191970",dodgerblue:"#1E90FF",lightseagreen:"#20B2AA",forestgreen:"#228B22",seagreen:"#2E8B57",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",limegreen:"#32CD32",mediumseagreen:"#3CB371",turquoise:"#40E0D0",royalblue:"#4169E1",steelblue:"#4682B4",darkslateblue:"#483D8B",mediumturquoise:"#48D1CC",indigo:"#4B0082",darkolivegreen:"#556B2F",cadetblue:"#5F9EA0",cornflowerblue:"#6495ED",rebeccapurple:"#663399",mediumaquamarine:"#66CDAA",dimgray:"#696969",dimgrey:"#696969",slateblue:"#6A5ACD",olivedrab:"#6B8E23",slategray:"#708090",slategrey:"#708090",lightslategray:"#778899",lightslategrey:"#778899",mediumslateblue:"#7B68EE",lawngreen:"#7CFC00",chartreuse:"#7FFF00",aquamarine:"#7FFFD4",skyblue:"#87CEEB",lightskyblue:"#87CEFA",blueviolet:"#8A2BE2",darkred:"#8B0000",darkmagenta:"#8B008B",saddlebrown:"#8B4513",darkseagreen:"#8FBC8F",lightgreen:"#90EE90",mediumpurple:"#9370DB",darkviolet:"#9400D3",palegreen:"#98FB98",darkorchid:"#9932CC",yellowgreen:"#9ACD32",sienna:"#A0522D",brown:"#A52A2A",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",lightblue:"#ADD8E6",greenyellow:"#ADFF2F",paleturquoise:"#AFEEEE",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",firebrick:"#B22222",darkgoldenrod:"#B8860B",mediumorchid:"#BA55D3",rosybrown:"#BC8F8F",darkkhaki:"#BDB76B",mediumvioletred:"#C71585",indianred:"#CD5C5C",peru:"#CD853F",chocolate:"#D2691E",tan:"#D2B48C",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",thistle:"#D8BFD8",orchid:"#DA70D6",goldenrod:"#DAA520",palevioletred:"#DB7093",crimson:"#DC143C",gainsboro:"#DCDCDC",plum:"#DDA0DD",burlywood:"#DEB887",lightcyan:"#E0FFFF",lavender:"#E6E6FA",darksalmon:"#E9967A",violet:"#EE82EE",palegoldenrod:"#EEE8AA",lightcoral:"#F08080",khaki:"#F0E68C",aliceblue:"#F0F8FF",honeydew:"#F0FFF0",azure:"#F0FFFF",sandybrown:"#F4A460",wheat:"#F5DEB3",beige:"#F5F5DC",whitesmoke:"#F5F5F5",mintcream:"#F5FFFA",ghostwhite:"#F8F8FF",salmon:"#FA8072",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lightgoldenrodyellow:"#FAFAD2",oldlace:"#FDF5E6",magenta:"#FF00FF",deeppink:"#FF1493",orangered:"#FF4500",tomato:"#FF6347",hotpink:"#FF69B4",coral:"#FF7F50",darkorange:"#FF8C00",lightsalmon:"#FFA07A",orange:"#FFA500",lightpink:"#FFB6C1",pink:"#FFC0CB",gold:"#FFD700",peachpuff:"#FFDAB9",navajowhite:"#FFDEAD",moccasin:"#FFE4B5",bisque:"#FFE4C4",mistyrose:"#FFE4E1",blanchedalmond:"#FFEBCD",papayawhip:"#FFEFD5",lavenderblush:"#FFF0F5",seashell:"#FFF5EE",cornsilk:"#FFF8DC",lemonchiffon:"#FFFACD",floralwhite:"#FFFAF0",snow:"#FFFAFA",lightyellow:"#FFFFE0",ivory:"#FFFFF0"},Ct=new Int8Array(4),be=new Int32Array(Ct.buffer,0,1),$t=new Float32Array(Ct.buffer,0,1),Kt=/^\s*rgba?\s*\(/,Jt=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function Qt(r){var n=0,i=0,e=0,t=1;if(r[0]==="#")r.length===4?(n=parseInt(r.charAt(1)+r.charAt(1),16),i=parseInt(r.charAt(2)+r.charAt(2),16),e=parseInt(r.charAt(3)+r.charAt(3),16)):(n=parseInt(r.charAt(1)+r.charAt(2),16),i=parseInt(r.charAt(3)+r.charAt(4),16),e=parseInt(r.charAt(5)+r.charAt(6),16)),r.length===9&&(t=parseInt(r.charAt(7)+r.charAt(8),16)/255);else if(Kt.test(r)){var a=r.match(Jt);a&&(n=+a[1],i=+a[2],e=+a[3],a[4]&&(t=+a[4]))}return{r:n,g:i,b:e,a:t}}var J={};for(var le in pe)J[le]=oe(pe[le]),J[pe[le]]=J[le];function Rt(r,n,i,e,t){return be[0]=e<<24|i<<16|n<<8|r,be[0]=be[0]&4278190079,$t[0]}function oe(r){if(r=r.toLowerCase(),typeof J[r]<"u")return J[r];var n=Qt(r),i=n.r,e=n.g,t=n.b,a=n.a;a=a*255|0;var o=Rt(i,e,t,a);return J[r]=o,o}var Ee={};function _t(r){if(typeof Ee[r]<"u")return Ee[r];var n=(r&16711680)>>>16,i=(r&65280)>>>8,e=r&255,t=255,a=Rt(n,i,e,t);return Ee[r]=a,a}function We(r,n,i,e){return i+(n<<8)+(r<<16)}function Ve(r,n,i,e,t,a){var o=Math.floor(i/a*t),s=Math.floor(r.drawingBufferHeight/a-e/a*t),l=new Uint8Array(4);r.bindFramebuffer(r.FRAMEBUFFER,n),r.readPixels(o,s,1,1,r.RGBA,r.UNSIGNED_BYTE,l);var h=ee(l,4),u=h[0],d=h[1],f=h[2],g=h[3];return[u,d,f,g]}function c(r,n,i){return(n=ae(n))in r?Object.defineProperty(r,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[n]=i,r}function je(r,n){var i=Object.keys(r);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(r);n&&(e=e.filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})),i.push.apply(i,e)}return i}function b(r){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?je(Object(i),!0).forEach(function(e){c(r,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):je(Object(i)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))})}return r}function ei(r,n){for(;!{}.hasOwnProperty.call(r,n)&&(r=Q(r))!==null;);return r}function Ae(){return Ae=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(r,n,i){var e=ei(r,n);if(e){var t=Object.getOwnPropertyDescriptor(e,n);return t.get?t.get.call(arguments.length<3?r:i):t.value}},Ae.apply(null,arguments)}function wt(r,n,i,e){var t=Ae(Q(r.prototype),n,i);return typeof t=="function"?function(a){return t.apply(i,a)}:t}function ti(r){return r.normalized?1:r.size}function ye(r){var n=0;return r.forEach(function(i){return n+=ti(i)}),n}function xt(r,n,i){var e=r==="VERTEX"?n.VERTEX_SHADER:n.FRAGMENT_SHADER,t=n.createShader(e);if(t===null)throw new Error("loadShader: error while creating the shader");n.shaderSource(t,i),n.compileShader(t);var a=n.getShaderParameter(t,n.COMPILE_STATUS);if(!a){var o=n.getShaderInfoLog(t);throw n.deleteShader(t),new Error(`loadShader: error while compiling the shader:
3
3
  `.concat(o,`
4
4
  `).concat(i))}return t}function ii(r,n){return xt("VERTEX",r,n)}function ri(r,n){return xt("FRAGMENT",r,n)}function ni(r,n){var i=r.createProgram();if(i===null)throw new Error("loadProgram: error while creating the program.");var e,t;for(e=0,t=n.length;e<t;e++)r.attachShader(i,n[e]);r.linkProgram(i);var a=r.getProgramParameter(i,r.LINK_STATUS);if(!a){var o=r.getProgramInfoLog(i);throw r.deleteProgram(i),new Error("loadProgram: error while linking the program: ".concat(o))}return i}function Ze(r){var n=r.gl,i=r.buffer,e=r.program,t=r.vertexShader,a=r.fragmentShader;n.deleteShader(t),n.deleteShader(a),n.deleteProgram(e),n.deleteBuffer(i)}var qe=`#define PICKING_MODE
@@ -1 +1 @@
1
- import{r as j,j as a}from"./vendor-tanstack-ZXXkndVj.js";import{K as ie,fB as oe,B as le,aV as ue}from"./index-C4lreGwR.js";import{M as ce}from"./vendor-markdown-B4giJcws.js";import{C as de,$ as pe,g as J}from"./vendor-lucide-N6vOpZmh.js";const Ke="Sources",B={copy:"Copy answer",copying:"Copying…",copied:"Copied",failed:"Could not copy. Select and copy the answer above."};function me({previewLength:e,highlight:r}){return o=>{if(e!==void 0&&Number.isFinite(e)){let c=Math.max(0,Math.floor(e));const d={field:"value",omitted:!1},p=n=>{if(n.type==="definition")return!0;if(n.children)return n.children=n.children.filter(p),n.children.length>0;const s=n.type==="image"||n.type==="imageReference"?"alt":"value",f=n[s];if(f===void 0)return c>0;const b=Array.from(f);if(b.length===0)return c>0;if(c===0)return d.omitted=!0,!1;const N=b.length>c,k=b.slice(0,c);if(N&&!/\s/.test(b[c])){let g=k.length-1;for(;g>=0&&!/\s/.test(k[g]);)g--;g>=0&&g>c-40&&(k.length=g)}return d.omitted||=N,n[s]=k.join(""),c=N?0:c-k.length,k.length===0?!1:(d.lastNode=n,d.field=s,!0)};p(o),d.omitted&&(d.lastNode?d.lastNode[d.field]=`${d.lastNode[d.field].trimEnd()}…`:o.children?.push({type:"paragraph",children:[{type:"text",value:"…"}]}))}if(r){const c=d=>{["link","linkReference","code","inlineCode"].includes(d.type)||(d.type==="text"&&(d.data={...d.data,hName:"span"}),d.children?.forEach(c))};c(o)}}}function fe({headingLevel:e}){return r=>{const o=[],c=p=>{p.type==="heading"&&p.depth&&o.push(p),p.children?.forEach(c)};c(r);const d=o.reduce((p,n)=>Math.min(p,n.depth),6);for(const p of o){const n=p.depth-d;p.depth=Math.min(6,e+n),p.data={...p.data,hProperties:{...p.data?.hProperties,"data-answer-heading-level":n+1}}}}}function ge({answer:e}){const[r,o]=j.useState("idle"),c=j.useRef(!1),d=async()=>{if(!c.current){c.current=!0,o("copying");try{await navigator.clipboard.writeText(e),o("copied")}catch{o("failed")}finally{c.current=!1}}};return a.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-3",children:[a.jsx(le,{type:"button",variant:"ghost",className:"min-h-11 px-2","aria-disabled":r==="copying","aria-busy":r==="copying",onClick:()=>{d()},children:r==="copying"?B.copying:B.copy}),a.jsx("span",{role:"status",className:"text-sm text-secondary",children:r==="copied"?B.copied:r==="failed"?B.failed:""})]})}const Ae=j.memo(function({children:r,headingLevel:o=4,copyable:c=!1,highlightGroups:d,previewLength:p}){return a.jsxs("div",{className:"answer-markdown",children:[a.jsx(ce,{remarkPlugins:[[fe,{headingLevel:o}],[me,{previewLength:p,highlight:!!d?.length}]],components:{p:({children:n})=>a.jsx("p",{className:"mb-3 whitespace-pre-wrap last:mb-0",children:n}),ul:({children:n})=>a.jsx("ul",{className:"mb-3 ml-5 list-disc space-y-1",children:n}),ol:({children:n,start:s})=>a.jsx("ol",{start:s,className:"mb-3 ml-5 list-decimal space-y-1",children:n}),pre:({children:n})=>a.jsx("pre",{className:"mb-3 overflow-x-auto whitespace-pre-wrap",children:n}),span:({children:n})=>a.jsx("span",{children:typeof n=="string"&&d?n.split(/(https?:\/\/[^\s<>]+)/i).map((s,f)=>f%2?s:a.jsx(j.Fragment,{children:oe(s,d)},f)):n}),a:({children:n,href:s})=>{const f=ie(s);return f?a.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"text-link underline",children:n}):a.jsx("span",{children:n})},img:({alt:n})=>a.jsx("span",{children:n})},children:r}),c&&r.trim()?a.jsx(ge,{answer:r},r):null]})}),X="min-h-11 w-full rounded-md border border-default bg-surface px-3 py-2 text-sm text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",D="flex min-h-11 w-full items-center justify-between gap-3 rounded px-2 text-left text-sm text-primary hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",E=e=>e.kind==="project"?"Whole site":e.label,R={allMarkets:"All markets",browse:e=>`Browse ${e}`,select:e=>`Select ${e}`,browseAll:"Browse all properties"},he=e=>e?.kind==="group"&&e.marketKeys?.length===1?e.marketKeys[0]:void 0,ee=e=>`${e} ${e===1?"property":"properties"}`;function Se({options:e,selected:r,onSelect:o,marketKey:c,label:d="Measurement scope",labelVisibility:p="visible",allowGroupSelect:n=!0}){const s=[...e].sort((t,u)=>t.label.localeCompare(u.label,void 0,{numeric:!0})||t.id.localeCompare(u.id)),[f,b]=j.useState(""),[N,k]=j.useState([]),[g,$]=j.useState(!1),C=j.useRef(null),I=j.useRef(null),i=j.useId(),y=s.filter(t=>t.kind==="group"),h=new Map(y.map(t=>[t.id,t])),l=h.get(N.at(-1)??""),F=h.get(N.at(-2)??""),x=f.trim().toLocaleLowerCase(),ne=y.filter(t=>!t.parentGroupIds?.some(u=>h.has(u))),_=s.filter(t=>t.kind==="property"),O=t=>(t.parentGroupIds??[]).map(u=>h.get(u)?.label).filter(Boolean).join(" · "),T=t=>`${E(t)} ${O(t)}`.toLocaleLowerCase().includes(x),U=t=>{const u=[...t.parentGroupIds??[]],m=new Set;for(;u.length;){const v=u.pop();if(v===l?.id)return!0;m.has(v)||(m.add(v),u.push(...h.get(v)?.parentGroupIds??[]))}return!1},K=(g?[]:l?y.filter(t=>x?U(t):t.parentGroupIds?.includes(l.id)):x?y:ne).filter(T),A=s.find(t=>t.kind==="market"&&t.id===(c??(r.kind==="market"?r.id:void 0))),H=l&&A&&(l.marketKeys?.includes(A.id)||A.parentGroupIds?.includes(l.id))?A.id:void 0,L=n?H??he(l):void 0,V=(l?_.filter(t=>t.parentGroupIds?.includes(l.id)&&(!L||t.marketKeys?.includes(L))):x||g||y.length===0?_:[]).filter(T),W=s.filter(t=>t.kind!=="market"||g||!n&&!l&&!x&&y.length>0||n&&l?.marketKeys?.length===1&&!x?!1:(l?x?U(t):t.parentGroupIds?.includes(l.id):x||!t.parentGroupIds?.some(m=>h.has(m)))&&T(t)),z=l||g?[]:s.filter(t=>t.kind==="project"&&T(t));j.useEffect(()=>{const t=u=>{C.current?.open&&u.target instanceof Node&&!C.current.contains(u.target)&&(C.current.open=!1)};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[]);const se=t=>{C.current&&(C.current.open=!1,C.current.querySelector("summary")?.focus());const u=n?t.kind==="property"?L:t.kind==="group"&&t.id===l?.id?H:void 0:void 0;u?o(t,u):o(t)},q=t=>{const u=[];let m=h.get(t.parentGroupIds?.[0]??"");for(;m&&!u.includes(m.id)&&m.id!==t.id;)u.unshift(m.id),m=h.get(m.parentGroupIds?.[0]??"");return[...u,t.id]},ae=()=>{const t=r.kind==="group"?h.get(r.id):void 0,u=h.get(A?.parentGroupIds?.[0]??""),m=(r.parentGroupIds??[]).flatMap(S=>{const w=h.get(S);return w?[q(w)]:[]}),v=m.find(S=>S.at(-1)===l?.id)??m.sort((S,w)=>w.length-S.length)[0]??[],Z=u?q(u):r.marketKeys?.length?[]:v;k(t?q(t):Z),$(r.kind==="property"&&Z.length===0&&y.length>0),b("")},Y=t=>{k(q(t)),$(!1),b(""),I.current?.focus()},P=(t,u=E(t))=>a.jsxs("div",{className:"flex items-stretch",children:[a.jsxs("button",{type:"button",className:D,"aria-label":t.kind==="group"&&!n?R.browse(E(t)):R.select(E(t)),"aria-current":r.kind===t.kind&&r.id===t.id?"true":void 0,onClick:()=>t.kind==="group"&&!n?Y(t):se(t),children:[a.jsxs("span",{className:"min-w-0 break-words",children:[u,x&&O(t)?a.jsx("span",{className:"block text-[13px] text-secondary",children:O(t)}):null]}),a.jsx("span",{className:"shrink-0 text-right text-[13px] text-secondary",children:t.kind==="market"?n?"Query context":"Market":t.kind==="property"?"Property":ee(t.targetCount)})]}),n&&t.kind==="group"&&t.id!==l?.id&&s.some(m=>m.parentGroupIds?.includes(t.id))?a.jsx("button",{type:"button","aria-label":R.browse(t.label),title:`Browse ${t.label}`,className:"flex min-h-11 min-w-11 items-center justify-center rounded text-secondary hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",onClick:()=>Y(t),children:a.jsx(J,{size:18,"aria-hidden":"true"})}):null]},`${t.kind}:${t.id}`),G=(t,u)=>u.length>0?a.jsxs("section",{"aria-label":t,className:"mt-2",children:[a.jsx("h3",{className:"px-2 py-2 text-[13px] font-medium text-secondary",children:t}),u.map(m=>P(m))]}):null,Q=(t,u,m)=>u.length>0?a.jsxs("details",{open:m,className:"mt-2 border-y border-default",children:[a.jsxs("summary",{className:"min-h-11 cursor-pointer px-2 py-3 text-sm text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",children:[t," (",u.length,")"]}),u.map(v=>P(v))]},`${l?.id??"root"}:${t}`):null;return a.jsxs("div",{className:"min-w-0",children:[a.jsx("span",{id:`${i}-label`,className:p==="sr-only"?"sr-only":"mb-1 block text-sm font-medium text-heading",children:d}),a.jsxs("details",{ref:C,className:"relative",onToggle:t=>{t.target===t.currentTarget&&t.currentTarget.open&&I.current?.focus()},onKeyDown:t=>{t.key==="Escape"&&(t.preventDefault(),t.currentTarget.open=!1,t.currentTarget.querySelector("summary")?.focus())},children:[a.jsxs("summary",{id:`${i}-value`,"aria-labelledby":`${i}-label ${i}-value`,className:`${X} visibility-scope-trigger`,onClick:()=>{C.current?.open||ae()},children:[`${E(r)}${r.kind==="group"?` · ${ee(r.targetCount)}`:r.kind==="property"?` · ${s.find(t=>t.kind==="market"&&t.id===c)?.label??(r.marketKeys?.length?R.allMarkets:"Property")}`:r.kind==="market"?" · Market":""}`,a.jsx(de,{size:16,"aria-hidden":"true",className:"shrink-0 text-secondary"})]}),a.jsxs("div",{className:"visibility-scope-menu",children:[l||g?a.jsxs("div",{className:"mb-2 border-b border-default pb-2",children:[a.jsx("button",{type:"button",className:D,"aria-label":`Back to ${F?.label??"all groups"}`,onClick:()=>{k(N.slice(0,-1)),$(!1),b(""),I.current?.focus()},children:a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(pe,{size:16,"aria-hidden":"true"}),F?.label??"All groups"]})}),a.jsx("p",{className:"px-2 py-1 text-sm font-medium text-heading","aria-live":"polite",children:l?.label??"All properties"})]}):null,a.jsx("input",{ref:I,type:"search","aria-label":"Search scopes",className:X,placeholder:l?"Search within this group":g?"Search properties":"Search groups or properties",value:f,onChange:t=>b(t.target.value)}),a.jsxs("div",{className:"mt-2 max-h-80 overflow-y-auto",children:[n&&l&&!x?P(l,"All properties in this group"):null,z.map(t=>P(t)),l&&!x?Q("Subgroups",K,!0):G(l?"Subgroups":"Groups",K),x?G("Properties",V):Q(l&&K.length>0?"All properties":"Properties",V,!l||K.length===0),G("Markets",W),!l&&!g&&!x&&y.length>0&&_.length>0?a.jsxs("button",{type:"button",className:`${D} mt-2 border-t border-default`,"aria-label":R.browseAll,onClick:()=>{$(!0),I.current?.focus()},children:[a.jsx("span",{children:"All properties"}),a.jsx(J,{size:18,"aria-hidden":"true"})]}):null,x&&K.length+V.length+W.length+z.length===0?a.jsx("p",{className:"py-3 text-sm text-secondary",children:"No matching scopes."}):null]})]})]})]})}function Ee(e){const r=e[0];return r?e.every(o=>o.mode===r.mode&&o.scope.kind===r.scope.kind&&o.scope.key===r.scope.key&&o.queryClass===r.queryClass&&o.measurement.displayedRunId===r.measurement.displayedRunId):!0}function M(e){return e.state==="unavailable"?{numerator:null,denominator:null,reason:e.reason}:e.numerator===void 0||e.denominator===void 0||e.denominator<=0?{numerator:null,denominator:null,reason:"not_applicable"}:{numerator:e.numerator,denominator:e.denominator,...e.unattributed===void 0?{}:{unattributed:e.unattributed}}}function ye(e){return e.kind==="exact"?e.url:e.kind==="prefix"?`https://${e.host}${e.pathPrefix}/*`:`https://${e.host}/*`}function be(e){return e==="assigned"?"this-property":e==="sibling"?"another-property":e==="ownedUnmapped"?"owned-unassigned":e==="external"?"external":e==="ambiguous"?"multiple-properties":"invalid-url"}function xe(e){return e==="assigned"?"positive":e==="external"?"neutral":e==="invalid"?"negative":"caution"}function te(e){return`target:${e.targetKey}:${e.queryId}:${e.executionNodeKey}`}function ke(e,r,o){const c=new Map;if(!r)return c;const d=new Map(e.usageEdges.map(s=>[te(s),s.targetKey])),p=new Map(e.assignments.map(s=>[`${s.targetKey}:${s.queryId}`,s.queryClass])),n=new Map(e.usageEdges.map(s=>[te(s),p.get(`${s.targetKey}:${s.queryId}`)]));for(const s of r.evidence){if(o&&n.get(s.usageEdgeId)!==o)continue;const f=d.get(s.usageEdgeId);if(!f)continue;const b=c.get(f)??[];b.push({id:`${s.observationId}:${s.expectedSlotId}:${s.usageEdgeId}:${s.sourceUrl}`,kind:be(s.classification),query:s.queryText,provider:s.provider,location:s.location,url:s.sourceUrl,tone:xe(s.classification),historical:s.historical||s.bridged}),c.set(f,b)}return c}function Ce(e){if(e.flags>0)return{label:"Review",tone:"caution"};const r=[e.mentionCoverage,e.citationCoverage].filter(o=>o.state==="unavailable").map(o=>o.reason);return r.includes("no_completed_run")?{label:"Not measured",tone:"neutral"}:r.includes("plan_v1")?{label:"Update setup",tone:"caution"}:r.includes("evidence_incomplete")?{label:"Evidence incomplete",tone:"caution"}:r.includes("identity_ambiguous")?{label:ue.ambiguous,tone:"caution"}:r.includes("no_population")?{label:"No queries",tone:"neutral"}:r.includes("not_applicable")?{label:"Not applicable",tone:"neutral"}:{label:"Complete",tone:"positive"}}function je(e){return e==="complete"?{label:"Complete",tone:"positive"}:e==="partial"?{label:"Partial",tone:"caution"}:e==="queued"?{label:"Queued",tone:"neutral"}:e==="running"?{label:"Running",tone:"neutral"}:e==="failed"?{label:"Failed",tone:"negative"}:{label:"Not measured",tone:"neutral"}}function Ne(e){if(!e)return"";const r=new Date(e);return Number.isFinite(r.getTime())?r.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):""}function re(e){const r=e.nextAction.count??e.flags.total;if(e.nextAction.kind==="review_flags")return`${r} flagged ${r===1?"result needs":"results need"} review.`;if(e.nextAction.kind==="complete_setup")return"Finish setup.";if(e.nextAction.kind==="republish_setup")return"Setup update required.";if(e.nextAction.kind==="run_measurement")return"Ready to measure."}function Re({overview:e,activePlan:r,report:o,reportState:c=o?"ready":"loading",sort:d}){if(r.plan.schemaVersion!==2||e.mode!=="active-v2")throw new Error("The current overview requires an active version-two setup.");if(e.scope.kind!=="all"&&e.scope.kind!=="group")throw new Error("The current overview requires an All Properties or group scope.");const p=r.plan,n=new Map(p.targets.map(i=>[i.stableKey,i])),s=new Map(p.querySnapshots.map(i=>[i.queryId,i.queryText])),f=new Map;for(const i of p.assignments){if(e.queryClass!=="all"&&i.queryClass!==e.queryClass)continue;const y=s.get(i.queryId);if(!y)continue;const h=f.get(i.targetKey)??new Set;h.add(y),f.set(i.targetKey,h)}const b=o?.revision===r.revision&&o.run?.id===e.measurement.displayedRunId?o:null,N=e.measurement.displayedRunId===void 0||b?"ready":c==="error"||o!=null?"error":"loading",k=ke(p,b,e.queryClass==="all"?void 0:e.queryClass),g=new Map;for(const i of p.groups)for(const y of i.targetKeys)g.has(y)||g.set(y,i.label);const $=e.properties.items.map(i=>{const y=n.get(i.targetKey),h=k.get(i.targetKey)??[];return{id:i.targetKey,name:i.label,mentionCoverage:M(i.mentionCoverage),citationCoverage:M(i.citationCoverage),status:Ce(i),providers:i.providers?.map(l=>({provider:l.provider,mentionCoverage:M(l.mentionCoverage),citationCoverage:M(l.citationCoverage)})),market:g.get(i.targetKey),assignedQueries:[...f.get(i.targetKey)??[]],urls:y?.urlMatchers.map(ye)??[],evidence:h,evidenceState:N,historical:h.some(l=>l.historical)}}),C=e.namedShareOfVoice?.entries.map(i=>({name:i.label,coverage:{numerator:i.credits,denominator:e.namedShareOfVoice.denominator}})),I=e.properties.items.flatMap(i=>i.flags>0?[{id:`property:${i.targetKey}`,property:i.label,summary:`${i.flags} ${i.flags===1?"result needs":"results need"} review.`,tone:"caution",count:i.flags}]:[]);return{classReporting:"available",latestMeasurement:{status:je(e.measurement.state),completedSlots:e.measurement.completed,totalSlots:e.measurement.expected,date:Ne(e.measurement.completedAt),includesBridgedHistory:e.measurement.includesHistoricalData===!0},currentView:{scope:e.scope.kind==="group"?{kind:"group",...e.scope.key?{key:e.scope.key}:{}}:{kind:"all"},queryClass:e.queryClass,aggregate:{metrics:{propertiesMentioned:M(e.metrics.propertiesMentioned),mentionCoverage:M(e.metrics.mentionCoverage),citationCoverage:M(e.metrics.citationCoverage)},properties:$,...C?{shareOfVoice:C}:{}},propertyTotal:e.properties.totalEstimate??$.length,outcomes:e.outcomes,nextCursor:e.properties.nextCursor,...d?{sort:d}:{}},availableGroups:p.groups.map(i=>({id:i.stableKey,label:i.label})),...re(e)?{nextActionText:re(e)}:{},flaggedResultsTotal:e.flags.total,flaggedResults:I}}export{Ae as A,R as M,Se as V,Ke as a,Ee as b,Re as c,ye as m};
1
+ import{r as j,j as a}from"./vendor-tanstack-ZXXkndVj.js";import{P as ie,fH as oe,B as le,aZ as ue}from"./index-BCKrocfL.js";import{M as ce}from"./vendor-markdown-B4giJcws.js";import{C as de,$ as pe,g as J}from"./vendor-lucide-N6vOpZmh.js";const Ae="Sources",B={copy:"Copy answer",copying:"Copying…",copied:"Copied",failed:"Could not copy. Select and copy the answer above."};function me({previewLength:e,highlight:r}){return o=>{if(e!==void 0&&Number.isFinite(e)){let c=Math.max(0,Math.floor(e));const d={field:"value",omitted:!1},p=n=>{if(n.type==="definition")return!0;if(n.children)return n.children=n.children.filter(p),n.children.length>0;const s=n.type==="image"||n.type==="imageReference"?"alt":"value",f=n[s];if(f===void 0)return c>0;const b=Array.from(f);if(b.length===0)return c>0;if(c===0)return d.omitted=!0,!1;const N=b.length>c,k=b.slice(0,c);if(N&&!/\s/.test(b[c])){let g=k.length-1;for(;g>=0&&!/\s/.test(k[g]);)g--;g>=0&&g>c-40&&(k.length=g)}return d.omitted||=N,n[s]=k.join(""),c=N?0:c-k.length,k.length===0?!1:(d.lastNode=n,d.field=s,!0)};p(o),d.omitted&&(d.lastNode?d.lastNode[d.field]=`${d.lastNode[d.field].trimEnd()}…`:o.children?.push({type:"paragraph",children:[{type:"text",value:"…"}]}))}if(r){const c=d=>{["link","linkReference","code","inlineCode"].includes(d.type)||(d.type==="text"&&(d.data={...d.data,hName:"span"}),d.children?.forEach(c))};c(o)}}}function fe({headingLevel:e}){return r=>{const o=[],c=p=>{p.type==="heading"&&p.depth&&o.push(p),p.children?.forEach(c)};c(r);const d=o.reduce((p,n)=>Math.min(p,n.depth),6);for(const p of o){const n=p.depth-d;p.depth=Math.min(6,e+n),p.data={...p.data,hProperties:{...p.data?.hProperties,"data-answer-heading-level":n+1}}}}}function ge({answer:e}){const[r,o]=j.useState("idle"),c=j.useRef(!1),d=async()=>{if(!c.current){c.current=!0,o("copying");try{await navigator.clipboard.writeText(e),o("copied")}catch{o("failed")}finally{c.current=!1}}};return a.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-3",children:[a.jsx(le,{type:"button",variant:"ghost",className:"min-h-11 px-2","aria-disabled":r==="copying","aria-busy":r==="copying",onClick:()=>{d()},children:r==="copying"?B.copying:B.copy}),a.jsx("span",{role:"status",className:"text-sm text-secondary",children:r==="copied"?B.copied:r==="failed"?B.failed:""})]})}const Ke=j.memo(function({children:r,headingLevel:o=4,copyable:c=!1,highlightGroups:d,previewLength:p}){return a.jsxs("div",{className:"answer-markdown",children:[a.jsx(ce,{remarkPlugins:[[fe,{headingLevel:o}],[me,{previewLength:p,highlight:!!d?.length}]],components:{p:({children:n})=>a.jsx("p",{className:"mb-3 whitespace-pre-wrap last:mb-0",children:n}),ul:({children:n})=>a.jsx("ul",{className:"mb-3 ml-5 list-disc space-y-1",children:n}),ol:({children:n,start:s})=>a.jsx("ol",{start:s,className:"mb-3 ml-5 list-decimal space-y-1",children:n}),pre:({children:n})=>a.jsx("pre",{className:"mb-3 overflow-x-auto whitespace-pre-wrap",children:n}),span:({children:n})=>a.jsx("span",{children:typeof n=="string"&&d?n.split(/(https?:\/\/[^\s<>]+)/i).map((s,f)=>f%2?s:a.jsx(j.Fragment,{children:oe(s,d)},f)):n}),a:({children:n,href:s})=>{const f=ie(s);return f?a.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"text-link underline",children:n}):a.jsx("span",{children:n})},img:({alt:n})=>a.jsx("span",{children:n})},children:r}),c&&r.trim()?a.jsx(ge,{answer:r},r):null]})}),X="min-h-11 w-full rounded-md border border-default bg-surface px-3 py-2 text-sm text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",D="flex min-h-11 w-full items-center justify-between gap-3 rounded px-2 text-left text-sm text-primary hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",E=e=>e.kind==="project"?"Whole site":e.label,P={allMarkets:"All markets",browse:e=>`Browse ${e}`,select:e=>`Select ${e}`,browseAll:"Browse all properties"},he=e=>e?.kind==="group"&&e.marketKeys?.length===1?e.marketKeys[0]:void 0,ee=e=>`${e} ${e===1?"property":"properties"}`;function Se({options:e,selected:r,onSelect:o,marketKey:c,label:d="Measurement scope",labelVisibility:p="visible",allowGroupSelect:n=!0}){const s=[...e].sort((t,u)=>t.label.localeCompare(u.label,void 0,{numeric:!0})||t.id.localeCompare(u.id)),[f,b]=j.useState(""),[N,k]=j.useState([]),[g,$]=j.useState(!1),C=j.useRef(null),I=j.useRef(null),i=j.useId(),y=s.filter(t=>t.kind==="group"),h=new Map(y.map(t=>[t.id,t])),l=h.get(N.at(-1)??""),F=h.get(N.at(-2)??""),x=f.trim().toLocaleLowerCase(),ne=y.filter(t=>!t.parentGroupIds?.some(u=>h.has(u))),_=s.filter(t=>t.kind==="property"),O=t=>(t.parentGroupIds??[]).map(u=>h.get(u)?.label).filter(Boolean).join(" · "),R=t=>`${E(t)} ${O(t)}`.toLocaleLowerCase().includes(x),U=t=>{const u=[...t.parentGroupIds??[]],m=new Set;for(;u.length;){const v=u.pop();if(v===l?.id)return!0;m.has(v)||(m.add(v),u.push(...h.get(v)?.parentGroupIds??[]))}return!1},A=(g?[]:l?y.filter(t=>x?U(t):t.parentGroupIds?.includes(l.id)):x?y:ne).filter(R),K=s.find(t=>t.kind==="market"&&t.id===(c??(r.kind==="market"?r.id:void 0))),H=l&&K&&(l.marketKeys?.includes(K.id)||K.parentGroupIds?.includes(l.id))?K.id:void 0,L=n?H??he(l):void 0,V=(l?_.filter(t=>t.parentGroupIds?.includes(l.id)&&(!L||t.marketKeys?.includes(L))):x||g||y.length===0?_:[]).filter(R),W=s.filter(t=>t.kind!=="market"||g||!n&&!l&&!x&&y.length>0||n&&l?.marketKeys?.length===1&&!x?!1:(l?x?U(t):t.parentGroupIds?.includes(l.id):x||!t.parentGroupIds?.some(m=>h.has(m)))&&R(t)),z=l||g?[]:s.filter(t=>t.kind==="project"&&R(t));j.useEffect(()=>{const t=u=>{C.current?.open&&u.target instanceof Node&&!C.current.contains(u.target)&&(C.current.open=!1)};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[]);const se=t=>{C.current&&(C.current.open=!1,C.current.querySelector("summary")?.focus());const u=n?t.kind==="property"?L:t.kind==="group"&&t.id===l?.id?H:void 0:void 0;u?o(t,u):o(t)},T=t=>{const u=[];let m=h.get(t.parentGroupIds?.[0]??"");for(;m&&!u.includes(m.id)&&m.id!==t.id;)u.unshift(m.id),m=h.get(m.parentGroupIds?.[0]??"");return[...u,t.id]},ae=()=>{const t=r.kind==="group"?h.get(r.id):void 0,u=h.get(K?.parentGroupIds?.[0]??""),m=(r.parentGroupIds??[]).flatMap(S=>{const w=h.get(S);return w?[T(w)]:[]}),v=m.find(S=>S.at(-1)===l?.id)??m.sort((S,w)=>w.length-S.length)[0]??[],Z=u?T(u):r.marketKeys?.length?[]:v;k(t?T(t):Z),$(r.kind==="property"&&Z.length===0&&y.length>0),b("")},Y=t=>{k(T(t)),$(!1),b(""),I.current?.focus()},q=(t,u=E(t))=>a.jsxs("div",{className:"flex items-stretch",children:[a.jsxs("button",{type:"button",className:D,"aria-label":t.kind==="group"&&!n?P.browse(E(t)):P.select(E(t)),"aria-current":r.kind===t.kind&&r.id===t.id?"true":void 0,onClick:()=>t.kind==="group"&&!n?Y(t):se(t),children:[a.jsxs("span",{className:"min-w-0 break-words",children:[u,x&&O(t)?a.jsx("span",{className:"block text-[13px] text-secondary",children:O(t)}):null]}),a.jsx("span",{className:"shrink-0 text-right text-[13px] text-secondary",children:t.kind==="market"?n?"Query context":"Market":t.kind==="property"?"Property":ee(t.targetCount)})]}),n&&t.kind==="group"&&t.id!==l?.id&&s.some(m=>m.parentGroupIds?.includes(t.id))?a.jsx("button",{type:"button","aria-label":P.browse(t.label),title:`Browse ${t.label}`,className:"flex min-h-11 min-w-11 items-center justify-center rounded text-secondary hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",onClick:()=>Y(t),children:a.jsx(J,{size:18,"aria-hidden":"true"})}):null]},`${t.kind}:${t.id}`),G=(t,u)=>u.length>0?a.jsxs("section",{"aria-label":t,className:"mt-2",children:[a.jsx("h3",{className:"px-2 py-2 text-[13px] font-medium text-secondary",children:t}),u.map(m=>q(m))]}):null,Q=(t,u,m)=>u.length>0?a.jsxs("details",{open:m,className:"mt-2 border-y border-default",children:[a.jsxs("summary",{className:"min-h-11 cursor-pointer px-2 py-3 text-sm text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",children:[t," (",u.length,")"]}),u.map(v=>q(v))]},`${l?.id??"root"}:${t}`):null;return a.jsxs("div",{className:"min-w-0",children:[a.jsx("span",{id:`${i}-label`,className:p==="sr-only"?"sr-only":"mb-1 block text-sm font-medium text-heading",children:d}),a.jsxs("details",{ref:C,className:"relative",onToggle:t=>{t.target===t.currentTarget&&t.currentTarget.open&&I.current?.focus()},onKeyDown:t=>{t.key==="Escape"&&(t.preventDefault(),t.currentTarget.open=!1,t.currentTarget.querySelector("summary")?.focus())},children:[a.jsxs("summary",{id:`${i}-value`,"aria-labelledby":`${i}-label ${i}-value`,className:`${X} visibility-scope-trigger`,onClick:()=>{C.current?.open||ae()},children:[`${E(r)}${r.kind==="group"?` · ${ee(r.targetCount)}`:r.kind==="property"?` · ${s.find(t=>t.kind==="market"&&t.id===c)?.label??(r.marketKeys?.length?P.allMarkets:"Property")}`:r.kind==="market"?" · Market":""}`,a.jsx(de,{size:16,"aria-hidden":"true",className:"shrink-0 text-secondary"})]}),a.jsxs("div",{className:"visibility-scope-menu",children:[l||g?a.jsxs("div",{className:"mb-2 border-b border-default pb-2",children:[a.jsx("button",{type:"button",className:D,"aria-label":`Back to ${F?.label??"all groups"}`,onClick:()=>{k(N.slice(0,-1)),$(!1),b(""),I.current?.focus()},children:a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(pe,{size:16,"aria-hidden":"true"}),F?.label??"All groups"]})}),a.jsx("p",{className:"px-2 py-1 text-sm font-medium text-heading","aria-live":"polite",children:l?.label??"All properties"})]}):null,a.jsx("input",{ref:I,type:"search","aria-label":"Search scopes",className:X,placeholder:l?"Search within this group":g?"Search properties":"Search groups or properties",value:f,onChange:t=>b(t.target.value)}),a.jsxs("div",{className:"mt-2 max-h-80 overflow-y-auto",children:[n&&l&&!x?q(l,"All properties in this group"):null,z.map(t=>q(t)),l&&!x?Q("Subgroups",A,!0):G(l?"Subgroups":"Groups",A),x?G("Properties",V):Q(l&&A.length>0?"All properties":"Properties",V,!l||A.length===0),G("Markets",W),!l&&!g&&!x&&y.length>0&&_.length>0?a.jsxs("button",{type:"button",className:`${D} mt-2 border-t border-default`,"aria-label":P.browseAll,onClick:()=>{$(!0),I.current?.focus()},children:[a.jsx("span",{children:"All properties"}),a.jsx(J,{size:18,"aria-hidden":"true"})]}):null,x&&A.length+V.length+W.length+z.length===0?a.jsx("p",{className:"py-3 text-sm text-secondary",children:"No matching scopes."}):null]})]})]})]})}function Ee(e){const r=e[0];return r?e.every(o=>o.mode===r.mode&&o.scope.kind===r.scope.kind&&o.scope.key===r.scope.key&&o.queryClass===r.queryClass&&o.measurement.displayedRunId===r.measurement.displayedRunId):!0}function M(e){return e.state==="unavailable"?{numerator:null,denominator:null,reason:e.reason}:e.numerator===void 0||e.denominator===void 0||e.denominator<=0?{numerator:null,denominator:null,reason:"not_applicable"}:{numerator:e.numerator,denominator:e.denominator,...e.unattributed===void 0?{}:{unattributed:e.unattributed}}}function ye(e){return e.kind==="exact"?e.url:e.kind==="prefix"?`https://${e.host}${e.pathPrefix}/*`:`https://${e.host}/*`}function be(e){return e==="assigned"?"this-property":e==="sibling"?"another-property":e==="ownedUnmapped"?"owned-unassigned":e==="external"?"external":e==="ambiguous"?"multiple-properties":"invalid-url"}function xe(e){return e==="assigned"?"positive":e==="external"?"neutral":e==="invalid"?"negative":"caution"}function te(e){return`target:${e.targetKey}:${e.queryId}:${e.executionNodeKey}`}function ke(e,r,o){const c=new Map;if(!r)return c;const d=new Map(e.usageEdges.map(s=>[te(s),s.targetKey])),p=new Map(e.assignments.map(s=>[`${s.targetKey}:${s.queryId}`,s.queryClass])),n=new Map(e.usageEdges.map(s=>[te(s),p.get(`${s.targetKey}:${s.queryId}`)]));for(const s of r.evidence){if(o&&n.get(s.usageEdgeId)!==o)continue;const f=d.get(s.usageEdgeId);if(!f)continue;const b=c.get(f)??[];b.push({id:`${s.observationId}:${s.expectedSlotId}:${s.usageEdgeId}:${s.sourceUrl}`,kind:be(s.classification),query:s.queryText,provider:s.provider,location:s.location,url:s.sourceUrl,tone:xe(s.classification),historical:s.historical||s.bridged}),c.set(f,b)}return c}function Ce(e){if(e.flags>0)return{label:"Review",tone:"caution"};const r=[e.mentionCoverage,e.citationCoverage].filter(o=>o.state==="unavailable").map(o=>o.reason);return r.includes("no_completed_run")?{label:"Not measured",tone:"neutral"}:r.includes("plan_v1")?{label:"Update setup",tone:"caution"}:r.includes("evidence_incomplete")?{label:"Evidence incomplete",tone:"caution"}:r.includes("identity_ambiguous")?{label:ue.ambiguous,tone:"caution"}:r.includes("no_population")?{label:"No queries",tone:"neutral"}:r.includes("not_applicable")?{label:"Not applicable",tone:"neutral"}:{label:"Complete",tone:"positive"}}function je(e){return e==="complete"?{label:"Complete",tone:"positive"}:e==="partial"?{label:"Partial",tone:"caution"}:e==="queued"?{label:"Queued",tone:"neutral"}:e==="running"?{label:"Running",tone:"neutral"}:e==="failed"?{label:"Failed",tone:"negative"}:{label:"Not measured",tone:"neutral"}}function Ne(e){if(!e)return"";const r=new Date(e);return Number.isFinite(r.getTime())?r.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):""}function re(e){const r=e.nextAction.count??e.flags.total;if(e.nextAction.kind==="review_flags")return`${r} flagged ${r===1?"result needs":"results need"} review.`;if(e.nextAction.kind==="complete_setup")return"Finish setup.";if(e.nextAction.kind==="republish_setup")return"Setup update required.";if(e.nextAction.kind==="run_measurement")return"Ready to measure."}function Pe({overview:e,activePlan:r,report:o,reportState:c=o?"ready":"loading",sort:d}){if(r.plan.schemaVersion!==2||e.mode!=="active-v2")throw new Error("The current overview requires an active version-two setup.");if(e.scope.kind!=="all"&&e.scope.kind!=="group")throw new Error("The current overview requires an All Properties or group scope.");const p=r.plan,n=new Map(p.targets.map(i=>[i.stableKey,i])),s=new Map(p.querySnapshots.map(i=>[i.queryId,i.queryText])),f=new Map;for(const i of p.assignments){if(e.queryClass!=="all"&&i.queryClass!==e.queryClass)continue;const y=s.get(i.queryId);if(!y)continue;const h=f.get(i.targetKey)??new Set;h.add(y),f.set(i.targetKey,h)}const b=o?.revision===r.revision&&o.run?.id===e.measurement.displayedRunId?o:null,N=e.measurement.displayedRunId===void 0||b?"ready":c==="error"||o!=null?"error":"loading",k=ke(p,b,e.queryClass==="all"?void 0:e.queryClass),g=new Map;for(const i of p.groups)for(const y of i.targetKeys)g.has(y)||g.set(y,i.label);const $=e.properties.items.map(i=>{const y=n.get(i.targetKey),h=k.get(i.targetKey)??[];return{id:i.targetKey,name:i.label,mentionCoverage:M(i.mentionCoverage),citationCoverage:M(i.citationCoverage),status:Ce(i),providers:i.providers?.map(l=>({provider:l.provider,mentionCoverage:M(l.mentionCoverage),citationCoverage:M(l.citationCoverage)})),market:g.get(i.targetKey),assignedQueries:[...f.get(i.targetKey)??[]],urls:y?.urlMatchers.map(ye)??[],evidence:h,evidenceState:N,historical:h.some(l=>l.historical)}}),C=e.namedShareOfVoice?.entries.map(i=>({name:i.label,coverage:{numerator:i.credits,denominator:e.namedShareOfVoice.denominator}})),I=e.properties.items.flatMap(i=>i.flags>0?[{id:`property:${i.targetKey}`,property:i.label,summary:`${i.flags} ${i.flags===1?"result needs":"results need"} review.`,tone:"caution",count:i.flags}]:[]);return{classReporting:"available",latestMeasurement:{status:je(e.measurement.state),completedSlots:e.measurement.completed,totalSlots:e.measurement.expected,date:Ne(e.measurement.completedAt),includesBridgedHistory:e.measurement.includesHistoricalData===!0},currentView:{scope:e.scope.kind==="group"?{kind:"group",...e.scope.key?{key:e.scope.key}:{}}:{kind:"all"},queryClass:e.queryClass,aggregate:{metrics:{propertiesMentioned:M(e.metrics.propertiesMentioned),mentionCoverage:M(e.metrics.mentionCoverage),citationCoverage:M(e.metrics.citationCoverage)},properties:$,...C?{shareOfVoice:C}:{}},propertyTotal:e.properties.totalEstimate??$.length,outcomes:e.outcomes,nextCursor:e.properties.nextCursor,...d?{sort:d}:{}},availableGroups:p.groups.map(i=>({id:i.stableKey,label:i.label})),...re(e)?{nextActionText:re(e)}:{},flaggedResultsTotal:e.flags.total,flaggedResults:I}}export{Ke as A,P as M,Se as V,Ae as a,Ee as b,Pe as c,ye as m};
package/assets/index.html CHANGED
@@ -12,14 +12,14 @@
12
12
  <link rel="icon" type="image/png" sizes="32x32" href="./favicon-32.png" />
13
13
  <link rel="apple-touch-icon" href="./apple-touch-icon.png" />
14
14
  <title>Canonry</title>
15
- <script type="module" crossorigin src="./assets/index-C4lreGwR.js"></script>
15
+ <script type="module" crossorigin src="./assets/index-BCKrocfL.js"></script>
16
16
  <link rel="modulepreload" crossorigin href="./assets/vendor-tanstack-ZXXkndVj.js">
17
17
  <link rel="modulepreload" crossorigin href="./assets/vendor-radix-twS1M3FF.js">
18
18
  <link rel="modulepreload" crossorigin href="./assets/vendor-recharts-llkUFBGR.js">
19
19
  <link rel="modulepreload" crossorigin href="./assets/vendor-lucide-N6vOpZmh.js">
20
20
  <link rel="modulepreload" crossorigin href="./assets/vendor-markdown-B4giJcws.js">
21
21
  <link rel="modulepreload" crossorigin href="./assets/vendor-yaml-GWJz5H2G.js">
22
- <link rel="stylesheet" crossorigin href="./assets/index-DX5M4MHr.css">
22
+ <link rel="stylesheet" crossorigin href="./assets/index-C17E5ZcA.css">
23
23
  </head>
24
24
  <body>
25
25
  <div id="root"></div>
@@ -869,7 +869,7 @@ import {
869
869
  wordpressSchemaDeployResultDtoSchema,
870
870
  wordpressSchemaStatusResultDtoSchema,
871
871
  wordpressStatusDtoSchema
872
- } from "./chunk-NOIK3FUO.js";
872
+ } from "./chunk-LXHE4DVO.js";
873
873
 
874
874
  // src/intelligence-service.ts
875
875
  import { eq as eq82, desc as desc36, asc as asc15, and as and69, ne as ne14, or as or20, inArray as inArray32, gte as gte22, lte as lte20, isNull as isNull16, sql as sql31, exists } from "drizzle-orm";
@@ -11294,7 +11294,7 @@ function gapTone(gapCount, totalCount) {
11294
11294
 
11295
11295
  // ../intelligence/src/visibility-score.ts
11296
11296
  function buildVisibilityScore(snapshots, options) {
11297
- const tooltip = "An LLM used a page on your domain as a source for its answer.";
11297
+ const tooltip = "An AI engine used a page on your domain as a source for its answer.";
11298
11298
  if (snapshots.length === 0) {
11299
11299
  return {
11300
11300
  label: "Citation Coverage",
@@ -11326,13 +11326,13 @@ function buildVisibilityScore(snapshots, options) {
11326
11326
  tooltip,
11327
11327
  trend: [],
11328
11328
  progress: score,
11329
- providerCoverage: isPartialProviderRun ? `${runApiProviderCount} of ${options.configuredApiProviders.length} providers` : void 0
11329
+ providerCoverage: isPartialProviderRun ? `${runApiProviderCount} of ${options.configuredApiProviders.length} engines` : void 0
11330
11330
  };
11331
11331
  }
11332
11332
 
11333
11333
  // ../intelligence/src/mention-coverage.ts
11334
11334
  function buildMentionCoverage(snapshots, options) {
11335
- const tooltip = "Your domain or company name was in the answer returned by the LLM.";
11335
+ const tooltip = "Your domain or company name was in the answer returned by the AI engine.";
11336
11336
  if (snapshots.length === 0) {
11337
11337
  return {
11338
11338
  label: "Mention Coverage",
@@ -11364,7 +11364,7 @@ function buildMentionCoverage(snapshots, options) {
11364
11364
  tooltip,
11365
11365
  trend: [],
11366
11366
  progress: score,
11367
- providerCoverage: isPartialProviderRun ? `${runApiProviderCount} of ${options.configuredApiProviders.length} providers` : void 0
11367
+ providerCoverage: isPartialProviderRun ? `${runApiProviderCount} of ${options.configuredApiProviders.length} engines` : void 0
11368
11368
  };
11369
11369
  }
11370
11370
 
@@ -11398,7 +11398,7 @@ function buildGapQueryScore(snapshots) {
11398
11398
  return {
11399
11399
  label: "Citation Gaps",
11400
11400
  value: `${gapCount}`,
11401
- delta: `${gapCount} of ${totalCount} queries at risk`,
11401
+ delta: `${gapCount} of ${totalCount} ${totalCount === 1 ? "query" : "queries"}`,
11402
11402
  tone: gapTone(gapCount, totalCount),
11403
11403
  description: gapCount > 0 ? `${gapCount} tracked ${gapQueryLabel} currently cite competitors without citing your domain.` : "No competitive citation gaps detected in the latest visibility run.",
11404
11404
  tooltip,
@@ -11435,7 +11435,7 @@ function buildMentionGapScore(snapshots) {
11435
11435
  return {
11436
11436
  label: "Mention Gaps",
11437
11437
  value: `${gapCount}`,
11438
- delta: `${gapCount} of ${totalCount} queries at risk`,
11438
+ delta: `${gapCount} of ${totalCount} ${totalCount === 1 ? "query" : "queries"}`,
11439
11439
  tone: gapTone(gapCount, totalCount),
11440
11440
  description: gapCount > 0 ? `${gapCount} tracked ${gapQueryLabel} mention competitors but never your brand.` : "No competitive mention gaps detected in the latest visibility run.",
11441
11441
  tooltip,
@@ -13868,6 +13868,7 @@ var DISCLOSURE = "Experimental English sentiment classification. Enabling sends
13868
13868
  var FULL_ROWS = { include: /* @__PURE__ */ new Set(["assessments", "locations"]), limit: null, after: null };
13869
13869
  var COMPACT_ROWS = { include: /* @__PURE__ */ new Set(), limit: null, after: null };
13870
13870
  var OPERATIONAL_OUTCOMES = /* @__PURE__ */ new Set([SentimentOutcomes.pending, SentimentOutcomes.running, SentimentOutcomes["waiting-to-retry"], SentimentOutcomes.failed, SentimentOutcomes.canceled]);
13871
+ var RATED_OUTCOMES = /* @__PURE__ */ new Set([SentimentOutcomes.favorable, SentimentOutcomes.mixed, SentimentOutcomes.unfavorable]);
13871
13872
  var SentimentService = class {
13872
13873
  constructor(db, options) {
13873
13874
  this.db = db;
@@ -14108,10 +14109,15 @@ var SentimentService = class {
14108
14109
  return [{ ...item2, input, evidence }];
14109
14110
  });
14110
14111
  }
14111
- aggregate(selection, items, source, settings, rows) {
14112
+ /**
14113
+ * `ratedPopulation` is the stored items whose rated assessments count toward every row's Rated
14114
+ * share. It defaults to `items`; a comparison scores only its matched units but passes the whole
14115
+ * period, so each period's Rated share is the one its own summary read shows.
14116
+ */
14117
+ aggregate(selection, items, source, settings, rows, ratedPopulation = items) {
14112
14118
  const definition = selection.evaluationDefinitionId ? this.definition(selection.evaluationDefinitionId) : null;
14113
14119
  const disabled = !settings.enabled || !settings.installEnabled;
14114
- const options = { disabled, incomplete: Boolean(source.skipped["incomplete-run"]) };
14120
+ const options = { disabled, incomplete: Boolean(source.skipped["incomplete-run"]), rated: ratedAssessments(ratedPopulation) };
14115
14121
  const base = { ...scoreAssessments(items, source.assessments, { ...options, slots: source.sourceCoverage }), configured: settings.enabled && settings.installEnabled, selection, evaluationDefinition: definition };
14116
14122
  if (!rows) return { summary: { ...base, breakdowns: [] }, queries: [], total: 0, next: null };
14117
14123
  const filter = sourceFilter(selection);
@@ -14265,8 +14271,8 @@ var SentimentService = class {
14265
14271
  const fromUnits = units(fromItems), toUnits = units(toItems);
14266
14272
  const common = new Set([...fromUnits.byUnit.keys()].filter((key) => toUnits.byUnit.has(key)));
14267
14273
  const settings = this.settings(projectId);
14268
- const fromSummary = withoutNodeKeys(this.aggregate(from.selection, fromItems.filter((item2) => common.has(fromUnits.byItem.get(item2))), from.source, settings, COMPACT_ROWS));
14269
- const toSummary = withoutNodeKeys(this.aggregate(to.selection, toItems.filter((item2) => common.has(toUnits.byItem.get(item2))), to.source, settings, COMPACT_ROWS));
14274
+ const fromSummary = withoutNodeKeys(this.aggregate(from.selection, fromItems.filter((item2) => common.has(fromUnits.byItem.get(item2))), from.source, settings, COMPACT_ROWS, fromItems));
14275
+ const toSummary = withoutNodeKeys(this.aggregate(to.selection, toItems.filter((item2) => common.has(toUnits.byItem.get(item2))), to.source, settings, COMPACT_ROWS, toItems));
14270
14276
  const refusalReasons = [];
14271
14277
  const expectedFrom = from.source.assessments.length, expectedTo = to.source.assessments.length;
14272
14278
  if (fromItems.length < expectedFrom || toItems.length < expectedTo) refusalReasons.push("classification-coverage-gap");
@@ -14315,7 +14321,6 @@ function incompatibleSelectionReason(selections, assessments, filter) {
14315
14321
  return reason;
14316
14322
  }
14317
14323
  function overallSentiment(reads, disabled) {
14318
- const assessmentKey = (item2) => JSON.stringify([item2.snapshotId, item2.subject.key]);
14319
14324
  const assessments = reads.flatMap((read) => read.source.assessments);
14320
14325
  const eligible = [...new Map(assessments.map((item2) => [assessmentKey(item2), item2])).values()];
14321
14326
  const selected = [...new Map(reads.flatMap((read) => read.items).map((item2) => [assessmentKey(item2.member), item2])).values()];
@@ -14353,12 +14358,20 @@ function compareRows(left, right) {
14353
14358
  function withheldCounts(counts2) {
14354
14359
  return Object.fromEntries(Object.entries(counts2).map(([key, value]) => [key, OPERATIONAL_OUTCOMES.has(key) ? value : 0]));
14355
14360
  }
14361
+ function assessmentKey(item2) {
14362
+ return JSON.stringify([item2.snapshotId, item2.subject.key]);
14363
+ }
14364
+ function ratedAssessments(items) {
14365
+ return new Set(items.filter((item2) => RATED_OUTCOMES.has(item2.outcome)).map((item2) => assessmentKey(item2.member)));
14366
+ }
14356
14367
  function scoreAssessments(selected, eligible, options) {
14357
- const distinct = new Set(eligible.map((item2) => item2.snapshotId)).size;
14358
- const slots = options.slots ?? { expected: distinct, completed: distinct };
14359
- const result = aggregateSentiment(selected.map((item2) => ({ assessmentId: item2.work.id, sourceSnapshotId: item2.work.snapshotId, outcome: item2.outcome })), { disabled: options.disabled, eligibleAssessments: eligible.length, expectedProviderSlots: slots.expected, completedProviderSlots: slots.completed });
14368
+ const eligibleAnswers = new Set(eligible.map((item2) => item2.snapshotId)).size;
14369
+ const rated = options.rated ?? ratedAssessments(selected);
14370
+ const ratedAnswers = new Set(eligible.filter((item2) => rated.has(assessmentKey(item2))).map((item2) => item2.snapshotId)).size;
14371
+ const slots = options.slots ?? { expected: eligibleAnswers, completed: eligibleAnswers };
14372
+ const result = aggregateSentiment(selected.map((item2) => ({ assessmentId: item2.work.id, sourceSnapshotId: item2.work.snapshotId, outcome: item2.outcome })), { disabled: options.disabled, eligibleAssessments: eligible.length, eligibleAnswers, ratedAnswers, expectedProviderSlots: slots.expected, completedProviderSlots: slots.completed });
14360
14373
  const gap = selected.length > 0 && selected.length < eligible.length;
14361
- const coverage = options.disabled ? { ...result.coverage, judged: 0, counts: withheldCounts(result.coverage.counts) } : result.coverage;
14374
+ const coverage = options.disabled ? { ...result.coverage, judged: 0, ratedAnswers: 0, counts: withheldCounts(result.coverage.counts) } : result.coverage;
14362
14375
  return { ...result, coverage, ...(gap || options.incomplete) && !options.disabled ? { state: selected.length ? "partial" : "not-measured", provisional: true } : {}, reason: options.disabled ? "Sentiment is disabled." : options.incomplete ? "Source sweep is incomplete." : gap ? "classification-coverage-gap: some source assessments have not been admitted." : null };
14363
14376
  }
14364
14377
  function jobReceipt(row, tally, attempts) {
@@ -25735,7 +25748,7 @@ function mentionRanking(rows, limit) {
25735
25748
  truncated: eligible.length > limit
25736
25749
  };
25737
25750
  }
25738
- function portfolioResponse(db, active, plan, query) {
25751
+ function portfolioResponse(db, active, plan, query, ownDomains) {
25739
25752
  const group = query.groupKey === void 0 ? void 0 : requireGroup2(plan, query.groupKey);
25740
25753
  const run = selectMeasurementQuestionRun(db, active.version.projectId, active, query.runId);
25741
25754
  const requestedTargetKeys = group?.targetKeys ?? plan.targets.map((target) => target.stableKey);
@@ -25831,7 +25844,7 @@ function portfolioResponse(db, active, plan, query) {
25831
25844
  },
25832
25845
  weakestProperties: rows,
25833
25846
  tiedAtWeakest: tie.summary,
25834
- weakestAnswerSources: weakestAnswerSources([...displayed, ...tie.rows]),
25847
+ weakestAnswerSources: weakestAnswerSources([...displayed, ...tie.rows], ownDomains),
25835
25848
  mentionRanking: mentionRanking(ranked, limit),
25836
25849
  ...marketRollup(plan, { run, evaluator }, group, includeNestedMarkets),
25837
25850
  totalProperties: ranked.length,
@@ -25892,7 +25905,7 @@ function tieNamedInstead(rows) {
25892
25905
  const counted = [...grouped.values()].map((row) => ({ name: row.name, answers: row.answers.size })).sort((left, right) => right.answers - left.answers || compareText13(left.name, right.name));
25893
25906
  return { rows: counted.slice(0, MEASUREMENT_PORTFOLIO_TIE_NAMED_INSTEAD_LIMIT), total: counted.length };
25894
25907
  }
25895
- function weakestAnswerSources(rows) {
25908
+ function weakestAnswerSources(rows, ownDomains) {
25896
25909
  const properties = /* @__PURE__ */ new Set();
25897
25910
  const answers = /* @__PURE__ */ new Map();
25898
25911
  for (const row of rows) {
@@ -25900,7 +25913,11 @@ function weakestAnswerSources(rows) {
25900
25913
  for (const answer of row.population.sourceAnswers) answers.set(answer.snapshot.id, answer);
25901
25914
  }
25902
25915
  const domains = domainRows([...answers.values()], MEASUREMENT_PORTFOLIO_ANSWER_SOURCES_LIMIT);
25903
- return { properties: properties.size, answers: answers.size, domains: domains.rows, domainTotal: domains.total };
25916
+ let ownDomainAnswers = 0;
25917
+ for (const answer of answers.values()) {
25918
+ if ([...answerDomains(answer)].some((host) => hostMatchesAnyDomain(host, ownDomains))) ownDomainAnswers++;
25919
+ }
25920
+ return { properties: properties.size, answers: answers.size, domains: domains.rows, domainTotal: domains.total, ownDomainAnswers };
25904
25921
  }
25905
25922
  function propertyCompetitorsResponse(db, active, plan, query) {
25906
25923
  const target = requireTarget3(plan, query.targetKey);
@@ -26112,11 +26129,14 @@ function classifyPropertyMove(mention, citation) {
26112
26129
  const down = directions.some((move) => move < 0);
26113
26130
  bucket = up && down ? "mixed" : up ? "improved" : "declined";
26114
26131
  }
26132
+ const signalWithinNoise = (move) => move === null ? null : Math.abs(move) <= MEASUREMENT_CHANGES_NOISE_ANSWERS;
26115
26133
  return {
26116
26134
  mentionAnswersDelta: answersDelta(mention),
26117
26135
  citationAnswersDelta: answersDelta(citation),
26118
26136
  denominatorChanged: baseChanged(mention) || baseChanged(citation),
26119
26137
  withinNoise: changed && withinNoise,
26138
+ mentionWithinNoise: signalWithinNoise(mentionMove),
26139
+ citationWithinNoise: signalWithinNoise(citationMove),
26120
26140
  bucket,
26121
26141
  mentionSize: mentionMove === null ? -1 : Math.abs(mentionMove),
26122
26142
  citationSize: citationMove === null ? -1 : Math.abs(citationMove)
@@ -26205,7 +26225,9 @@ function changesResponse(db, active, plan, query) {
26205
26225
  mentionAnswersDelta: move.mentionAnswersDelta,
26206
26226
  citationAnswersDelta: move.citationAnswersDelta,
26207
26227
  denominatorChanged: move.denominatorChanged,
26208
- withinNoise: move.withinNoise
26228
+ withinNoise: move.withinNoise,
26229
+ mentionWithinNoise: move.mentionWithinNoise,
26230
+ citationWithinNoise: move.citationWithinNoise
26209
26231
  },
26210
26232
  move
26211
26233
  }];
@@ -26386,7 +26408,7 @@ async function measurementPortfolioReadRoutes(app) {
26386
26408
  const raw = nested === "true" || nested === "false" ? { ...request.query, includeNestedMarkets: nested === "true" } : request.query;
26387
26409
  const query = parseLimitQuery(raw, measurementPortfolioSummaryQuerySchema, "Invalid measurement portfolio summary query");
26388
26410
  const { active, plan } = activeV2Plan2(app.db, project.id, "Portfolio summary");
26389
- return portfolioResponse(app.db, active, plan, query);
26411
+ return portfolioResponse(app.db, active, plan, query, effectiveDomains(project));
26390
26412
  }
26391
26413
  );
26392
26414
  app.get(
@@ -31366,8 +31388,11 @@ function buildRankedList(domains, limit, answerTotal, answersWithSources) {
31366
31388
  const domainTotal = all.length;
31367
31389
  all.sort((a, b) => b.count - a.count || a.domain.localeCompare(b.domain));
31368
31390
  const shownEntries = limit != null && limit < all.length ? all.slice(0, limit) : all;
31369
- const entries = shownEntries.map((d) => ({
31391
+ let rank = 0;
31392
+ const ranks = all.map((d, i) => rank = i > 0 && d.count === all[i - 1].count ? rank : i + 1);
31393
+ const entries = shownEntries.map((d, i) => ({
31370
31394
  domain: d.domain,
31395
+ rank: ranks[i],
31371
31396
  count: d.count,
31372
31397
  percentage: totalCitedSlots > 0 ? roundRatio(d.count / totalCitedSlots, RatioUnits.fraction) : 0,
31373
31398
  answerShare: answerTotal > 0 ? roundRatio(d.count / answerTotal, RatioUnits.fraction) : 0,
@@ -86104,7 +86129,7 @@ var agentProvidersConfiguredCheck = {
86104
86129
  status: CheckStatuses.warn,
86105
86130
  code: "agent-providers.none-configured",
86106
86131
  summary: "No agent LLM provider has credentials configured \u2014 the built-in Aero agent cannot run.",
86107
- remediation: "Add a key for one of the agent providers (claude, openai, gemini, zai, deepinfra) under `providers.<name>.apiKey` in ~/.canonry/config.yaml, or export its env var (e.g. ANTHROPIC_API_KEY, OPENAI_API_KEY, DEEPINFRA_TOKEN).",
86132
+ remediation: "Add a key for one of the agent providers (claude, openai, gemini, zai) under `providers.<name>.apiKey` in ~/.canonry/config.yaml, or export its env var (e.g. ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY).",
86108
86133
  details
86109
86134
  };
86110
86135
  }
@@ -128,7 +128,7 @@ import {
128
128
  trafficSeriesGranularitySchema,
129
129
  visibilityCompareSelectionSchema,
130
130
  visibilityReportRequestSchema
131
- } from "./chunk-NOIK3FUO.js";
131
+ } from "./chunk-LXHE4DVO.js";
132
132
 
133
133
  // src/cli-error.ts
134
134
  function isMachineFormat(format) {
@@ -456,7 +456,7 @@ var MEASUREMENT_CHANGES_AGENT_ROWS = 20;
456
456
  var measurementChangesInputSchema = measurementChangesQuerySchema.safeExtend({
457
457
  project: projectNameSchema,
458
458
  queryClass: measurementQueryClassFilterSchema.default(AGENT_DEFAULT_QUERY_CLASS).describe("Defaults to non-brand. Call once per class; all pools both classes in rows and distribution."),
459
- limit: z3.number().int().positive().max(MEASUREMENT_CHANGES_AGENT_ROWS).optional().describe(`Changed rows, largest move first. Default 10, at most ${MEASUREMENT_CHANGES_AGENT_ROWS}; distribution counts every Property whatever the limit.`)
459
+ limit: z3.number().int().positive().max(MEASUREMENT_CHANGES_AGENT_ROWS).optional().describe(`Changed rows, largest move first, every move beyond noise before any within it. Default and maximum ${MEASUREMENT_CHANGES_AGENT_ROWS}; distribution counts every Property whatever the limit.`)
460
460
  }).strict();
461
461
  var measurementDataQualityInputSchema = measurementDataQualityQuerySchema.extend({
462
462
  project: projectNameSchema
@@ -948,7 +948,7 @@ var contentTargetsInputSchema = z3.object({
948
948
  var contentBriefInputSchema = z3.object({
949
949
  project: projectNameSchema,
950
950
  targetRef: z3.string().min(1).describe("Stable target ref from canonry_content_targets. The target must be ownable; ceded targets are rejected."),
951
- provider: z3.string().optional().describe("Optional provider override (claude|openai|gemini|zai|deepinfra)."),
951
+ provider: z3.string().optional().describe("Optional provider override (claude|openai|gemini|zai)."),
952
952
  model: z3.string().optional().describe("Optional model override within the chosen provider."),
953
953
  forceRefresh: z3.boolean().optional().describe("Force a fresh synthesis even if a cached brief exists.")
954
954
  });
@@ -1263,7 +1263,7 @@ var canonryMcpTools = [
1263
1263
  defineTool({
1264
1264
  name: "canonry_sentiment",
1265
1265
  title: "Read sentiment and per-query scores",
1266
- description: 'Read stored model-classified language about frozen Simple identities or Advanced Properties. Returns headline and per-query favorable/mixed/unfavorable rates, judged and selected counts, distinct answers, exclusions, intervals and method limitations. Favorable % is favorable / (favorable + mixed + unfavorable); factual and unjudged answers do not enter that denominator. Select branded or non-brand explicitly and keep their metrics separate; the default is branded. Optional queryId selects one frozen query. Query rows are compact and paged: queryLimit (default 25) rows per page, then pass queryPage.nextCursor as queryCursor. Per-engine assessment verdicts and per-location scores are opt-in with include=["assessments","locations"], or come by default when queryId names one query. Advanced rows are per executionNodeKey; pass it to narrow evidence to that node. Optional runIds selects the exact grouped location runs instead of runId. A known subject absent from a non-brand answer is not unfavorable. Partial values are provisional. Never starts a classifier. Preserve the resolved evaluationDefinitionId and complete selection for later evidence reads.',
1266
+ description: 'Read stored model-classified language about frozen Simple identities or Advanced Properties. Returns headline and per-query favorable/mixed/unfavorable rates, judged and selected assessment counts, rated and eligible answers with their share (ratedAnswerRate: answers with a favorable, mixed or unfavorable rating over every eligible answer, admitted or not; each answer counts once), exclusions, intervals and method limitations. Favorable % is favorable / (favorable + mixed + unfavorable); factual and unjudged answers do not enter that denominator. Select branded or non-brand explicitly and keep their metrics separate; the default is branded. Optional queryId selects one frozen query. Query rows are compact and paged: queryLimit (default 25) rows per page, then pass queryPage.nextCursor as queryCursor. Per-engine assessment verdicts and per-location scores are opt-in with include=["assessments","locations"], or come by default when queryId names one query. Advanced rows are per executionNodeKey; pass it to narrow evidence to that node. Optional runIds selects the exact grouped location runs instead of runId. A known subject absent from a non-brand answer is not unfavorable. Partial values are provisional. Never starts a classifier. Preserve the resolved evaluationDefinitionId and complete selection for later evidence reads.',
1267
1267
  access: "read",
1268
1268
  tier: "monitoring",
1269
1269
  inputSchema: sentimentInputSchema,
@@ -1515,7 +1515,7 @@ var canonryMcpTools = [
1515
1515
  defineTool({
1516
1516
  name: "canonry_analytics_sources",
1517
1517
  title: "Get cited-source rankings",
1518
- description: "Where AI engines cite from for a project: cited domains ranked by how many answers cite them, each tagged with a category and a surface class (own / direct-competitor / ota-aggregator / editorial-media / other), plus a surface-class roll-up and a per-provider breakdown. Project-wide: without `queryClass` it pools branded and non-brand answers, where branded queries inflate your own domain. With `queryClass` set and neither `runId` nor `window`, this tool reads the latest sweep (`runId` latest); pass `window` to pool every sweep in it. `pooledAcrossRuns` true (`runCount` above 1) means the counts sum several runs and `runIds` is their scope; the legacy `runId` field is then only the newest run in the window. On a v2 measurement plan the class comes from the plan, the same answers as canonry_competitor_landscape with scope=all-markets. `countUnits` says what each count counts: `domainTotal` is distinct domains, never answers or citations. Compare engines by answer count or `answerShare`, never by rank position. Counts come from each answer's stored source list, so every engine is included, Gemini too. A domain counts at most once per answer; `answerShare` is the share of all answers in scope that cite it. `providersWithoutSources` names engines that answered but cited nothing. `limit` caps each ranked list (default 10 for this tool, which keeps each engine list whole); a long-tail rollup keeps the totals. The per-query breakdown is omitted unless `includeByQuery` is true. No LLM calls; probe runs excluded.",
1518
+ description: "Where AI engines cite from for a project: cited domains ranked by how many answers cite them, each tagged with a category and a surface class (own / direct-competitor / ota-aggregator / editorial-media / other), plus a surface-class roll-up and a per-provider breakdown. Every entry carries rank, its position by count in that list over the whole scope (equal counts share a rank); state where a domain places only from its rank, never by counting rows. Project-wide: without `queryClass` it pools branded and non-brand answers, where branded queries inflate your own domain. With `queryClass` set and neither `runId` nor `window`, this tool reads the latest sweep (`runId` latest); pass `window` to pool every sweep in it. `pooledAcrossRuns` true (`runCount` above 1) means the counts sum several runs and `runIds` is their scope; the legacy `runId` field is then only the newest run in the window. On a v2 measurement plan the class comes from the plan, the same answers as canonry_competitor_landscape with scope=all-markets. `countUnits` says what each count counts: `domainTotal` is distinct domains, never answers or citations. Compare engines by answer count or `answerShare`, never by rank position. Counts come from each answer's stored source list, so every engine is included, Gemini too. A domain counts at most once per answer; `answerShare` is the share of all answers in scope that cite it. `providersWithoutSources` names engines that answered but cited nothing. `limit` caps each ranked list (default 10 for this tool, which keeps each engine list whole); a long-tail rollup keeps the totals. The per-query breakdown is omitted unless `includeByQuery` is true. No LLM calls; probe runs excluded.",
1519
1519
  access: "read",
1520
1520
  tier: "monitoring",
1521
1521
  inputSchema: z3.object({
@@ -2842,7 +2842,7 @@ var canonryMcpTools = [
2842
2842
  defineTool({
2843
2843
  name: "canonry_measurement_portfolio_summary",
2844
2844
  title: "Summarize measured Properties",
2845
- description: "Start here for best and worst Properties. One call returns the weakest Properties, the names answers wrote instead of them, and the domains engines cited for them. Defaults to non-brand queries; state the returned queryClass and never pool branded with non-brand. Returns at most 4 Property rows per list, the most that fit one result; a larger limit is lowered and limitNote says so. For other rows pass groupKey (one metro's weakest), or page canonry_measurement_overview. Mention (answer text names the Property) and citation (a source URL on its page) are separate: report each as numerator/denominator, with any unattributed count beside mention. Denominators count answers, one per query per engine (queries x engines = answers). Group Properties only by each row's metro and submarkets, never by label. namedInsteadInAnswerText lists names written in the answer text of answers that neither named nor cited the Property, counted by answer: they are not citations, and namedInsteadInAnswerTextTotal counts distinct names, not answers. citedDomains and weakestAnswerSources count answers citing each domain, every engine included; weakestAnswerSources pools the weakest rows plus every tied Property, each answer once, and its domainTotal counts distinct domains, not citations. When tiedAtWeakest is set, tiedAtWeakest.count Properties share the weakest rates and the rows are the first of them by name, not a rank: report the count, tiedAtWeakest.byMetro (tied Properties per metro over the whole tie; a Property in two metros counts in both) and tiedAtWeakest.namedInstead (names written instead across the whole tie, counted by distinct answer; namedInsteadTotal is distinct names), and call the rows examples. mentionRanking.strongest/.weakest rank every Property with an available mention rate; .excluded lists the rest with reasons. markets lists every market at one level, worst-first (every metro, or a groupKey's submarkets), whatever the limit. Markets may share Properties and never sum to portfolio totals. Reads stored data only; never starts provider work.",
2845
+ description: "Start here for best and worst Properties. One call returns the weakest Properties, the names answers wrote instead of them, and the domains engines cited for them. Defaults to non-brand queries; state the returned queryClass and never pool branded with non-brand. Returns at most 4 Property rows per list, the most that fit one result; a larger limit is lowered and limitNote says so. For other rows pass groupKey (one metro's weakest), or page canonry_measurement_overview. Mention (answer text names the Property) and citation (a source URL on its page) are separate: report each as numerator/denominator, with any unattributed count beside mention. Denominators count answers, one per query per engine (queries x engines = answers). Group Properties only by each row's metro and submarkets, never by label. namedInsteadInAnswerText lists names written in the answer text of answers that neither named nor cited the Property, counted by answer: they are not citations, and namedInsteadInAnswerTextTotal counts distinct names, not answers. citedDomains and weakestAnswerSources count answers citing each domain, every engine included; weakestAnswerSources pools the weakest rows plus every tied Property, each answer once, and its domainTotal counts distinct domains, not citations. weakestAnswerSources.ownDomainAnswers counts those answers that cite any of your own domains. A Property's citationCoverage counts only answers citing that Property's own page, so 0% citation does not mean your domain went uncited; use ownDomainAnswers for that. When tiedAtWeakest is set, tiedAtWeakest.count Properties share the weakest rates and the rows are the first of them by name, not a rank: report the count, tiedAtWeakest.byMetro (tied Properties per metro over the whole tie; a Property in two metros counts in both) and tiedAtWeakest.namedInstead (names written instead across the whole tie, counted by distinct answer; namedInsteadTotal is distinct names), and call the rows examples. mentionRanking.strongest/.weakest rank every Property with an available mention rate; .excluded lists the rest with reasons. markets lists every market at one level, worst-first (every metro, or a groupKey's submarkets), whatever the limit. Markets may share Properties and never sum to portfolio totals. Reads stored data only; never starts provider work.",
2846
2846
  access: "read",
2847
2847
  tier: "monitoring",
2848
2848
  inputSchema: measurementPortfolioSummaryInputSchema,
@@ -2902,7 +2902,7 @@ var canonryMcpTools = [
2902
2902
  defineTool({
2903
2903
  name: "canonry_measurement_changes",
2904
2904
  title: "Compare stored measurement changes",
2905
- description: "What changed since the previous sweep: compares the displayed run with the previous run of the same plan revision and execution identity; an incompatible pair returns unavailable with a reason, never a trend. Defaults to non-brand queries: call once per class (queryClass branded for the branded move) and never report one class as the whole. queryClass all pools both classes in rows and distribution and adds metricsByClass, the headline metrics per class; report those per class, never the pooled metrics alone. changedProperties come largest move first (answers that named the Property, then answers that cited it; sort label for alphabetical), default 10 and at most 20 rows; totalProperties above the rows returned means rows you did not see. distribution counts every Property in scope: improved, declined, mixed, withinNoise, unchanged, notComparable. mentionAnswersDelta and citationAnswersDelta are signed answer counts; denominatorChanged true means a rate was taken over a different number of answers, so those counts are not like for like and the coverage rates give the direction. A move is the rate change times the larger answer count (the count change when the denominator held). withinNoise true means every move was 2 answers or fewer: within noise, never a gain, loss, trend or regression. Reads stored data only; it never starts provider work.",
2905
+ description: "What changed since the previous sweep: compares the displayed run with the previous run of the same plan revision and execution identity; an incompatible pair returns unavailable with a reason, never a trend. Defaults to non-brand queries: call once per class (queryClass branded for the branded move) and never report one class as the whole. queryClass all pools both classes in rows and distribution and adds metricsByClass, the headline metrics per class; report those per class, never the pooled metrics alone. changedProperties come largest move first (answers that named the Property, then answers that cited it; sort label for alphabetical), every move beyond noise before any within it, 20 rows by default and at most; totalProperties above the rows returned means rows you did not see. distribution counts every Property in scope: improved, declined, mixed, withinNoise, unchanged, notComparable. mentionAnswersDelta and citationAnswersDelta are signed answer counts; denominatorChanged true means a rate was taken over a different number of answers, so those counts are not like for like and the coverage rates give the direction. A move is the rate change times the larger answer count (the count change when the denominator held). withinNoise true means every move was 2 answers or fewer: within noise, never a gain, loss, trend or regression. mentionWithinNoise and citationWithinNoise apply the same rule to each signal alone: a Property beyond noise can still have one signal within noise, and that signal is not a gain or loss. Report every headline metric, branded included, as previous numerator/denominator to current numerator/denominator. Reads stored data only; it never starts provider work.",
2906
2906
  access: "read",
2907
2907
  tier: "monitoring",
2908
2908
  inputSchema: measurementChangesInputSchema,
@@ -2910,7 +2910,7 @@ var canonryMcpTools = [
2910
2910
  openApiOperations: ["GET /api/v1/projects/{name}/measurement-changes"],
2911
2911
  handler: (client, input) => {
2912
2912
  const { project, ...query } = input;
2913
- return client.getMeasurementChanges(project, { ...query, queryClass: agentQueryClass(query.queryClass) });
2913
+ return client.getMeasurementChanges(project, { ...query, limit: query.limit ?? MEASUREMENT_CHANGES_AGENT_ROWS, queryClass: agentQueryClass(query.queryClass) });
2914
2914
  }
2915
2915
  }),
2916
2916
  defineTool({
@@ -5,7 +5,7 @@ import {
5
5
  siteCrawlGraphNodes,
6
6
  siteCrawlPages,
7
7
  siteCrawlSnapshots
8
- } from "./chunk-G2K5KCUY.js";
8
+ } from "./chunk-B5W7HDCG.js";
9
9
  import {
10
10
  SITE_CRAWL_GRAPH_MAX_EDGES,
11
11
  SITE_CRAWL_GRAPH_MAX_NODES,
@@ -13,7 +13,7 @@ import {
13
13
  TEMPLATE_LINK_RATIO_THRESHOLD,
14
14
  factorStatusFromScore,
15
15
  roundPreservingTotal
16
- } from "./chunk-NOIK3FUO.js";
16
+ } from "./chunk-LXHE4DVO.js";
17
17
 
18
18
  // src/site-audit-factors.ts
19
19
  function recordedSharePct(factor) {