@canonry/canonry 5.33.0 → 5.34.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 (31) hide show
  1. package/assets/agent-workspace/skills/canonry/references/aeo-analysis.md +1 -1
  2. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +12 -3
  3. package/assets/assets/{AuditHistoryPanel-CcCIqJzU.js → AuditHistoryPanel-Ddg6JIi3.js} +1 -1
  4. package/assets/assets/{BacklinksPage-B4r9SLIP.js → BacklinksPage-DI9BmaYt.js} +1 -1
  5. package/assets/assets/{HistoryPage-DIpbpqWc.js → HistoryPage-CACIL005.js} +1 -1
  6. package/assets/assets/{MeasurementPropertyPage-BF93li8O.js → MeasurementPropertyPage-D_i3t0DT.js} +1 -1
  7. package/assets/assets/{ProjectPage-CjadJKsG.js → ProjectPage-d1djqfh3.js} +1 -1
  8. package/assets/assets/{RunRow-C-d8luIA.js → RunRow-CjhvvA6g.js} +1 -1
  9. package/assets/assets/{RunsPage-DEbjaNYY.js → RunsPage-DuBhw2uc.js} +1 -1
  10. package/assets/assets/{SettingsPage-B5h3wM7i.js → SettingsPage-MUpfB0HH.js} +1 -1
  11. package/assets/assets/{SiteHealthSection-Cj2lo1GY.js → SiteHealthSection-6qdXlFcO.js} +3 -3
  12. package/assets/assets/{TrafficPage-CFDh9Rx4.js → TrafficPage--nGSOgqn.js} +1 -1
  13. package/assets/assets/{TrafficSourceDetailPage-psddSEHZ.js → TrafficSourceDetailPage-BPqNmuws.js} +1 -1
  14. package/assets/assets/{extract-error-message-BbHnZTOx.js → extract-error-message-B7OeWj0x.js} +1 -1
  15. package/assets/assets/{index-CiWV331j.js → index-C4lreGwR.js} +20 -20
  16. package/assets/assets/{react-sigma_core.esm.min-6EgecOc3.js → react-sigma_core.esm.min-jiMNkILi.js} +1 -1
  17. package/assets/assets/{v2-overview-adapter-0pVxmjG8.js → v2-overview-adapter-Caj3bHQE.js} +1 -1
  18. package/assets/index.html +1 -1
  19. package/dist/{chunk-Y23FQK6O.js → chunk-25H4K7KL.js} +4 -4
  20. package/dist/{chunk-XICZEXE5.js → chunk-AIAVZY6L.js} +12 -10
  21. package/dist/{chunk-GIKWL2BQ.js → chunk-G2K5KCUY.js} +111 -7
  22. package/dist/{chunk-SJX7XJB6.js → chunk-NOIK3FUO.js} +73 -3
  23. package/dist/{chunk-AQFRQTKY.js → chunk-NZCKJMLC.js} +2 -2
  24. package/dist/{chunk-G3CMWO26.js → chunk-QTETJEHI.js} +2 -2
  25. package/dist/{chunk-UDEZZMV5.js → chunk-VHPGBX4P.js} +3 -3
  26. package/dist/cli.js +47 -13
  27. package/dist/{demo-server-G4BFXA6G.js → demo-server-UI24OAHX.js} +4 -4
  28. package/dist/index.js +6 -6
  29. package/dist/{intelligence-service-FVOFIJP3.js → intelligence-service-ZKFLGJ23.js} +2 -2
  30. package/dist/mcp.js +4 -4
  31. package/package.json +8 -8
@@ -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-Cj2lo1GY.js";import"./index-CiWV331j.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-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.
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-CiWV331j.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{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};
package/assets/index.html CHANGED
@@ -12,7 +12,7 @@
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-CiWV331j.js"></script>
15
+ <script type="module" crossorigin src="./assets/index-C4lreGwR.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">
@@ -128,7 +128,7 @@ import {
128
128
  trafficSeriesGranularitySchema,
129
129
  visibilityCompareSelectionSchema,
130
130
  visibilityReportRequestSchema
131
- } from "./chunk-SJX7XJB6.js";
131
+ } from "./chunk-NOIK3FUO.js";
132
132
 
133
133
  // src/cli-error.ts
134
134
  function isMachineFormat(format) {
@@ -1248,7 +1248,7 @@ var canonryMcpTools = [
1248
1248
  defineTool({
1249
1249
  name: "canonry_sentiment_configure",
1250
1250
  title: "Configure project sentiment",
1251
- description: "Install administrator only: explicitly enable or disable stance-and-evidence sentiment. Both install and project switches default off. Enabling processes future eligible complete runs; historical answers require explicit backfill. On dispatch TypeSafe receives the text of each answer with the frozen subject identity (name, aliases and URLs), the tracked query text and class, the answer engine with its requested and served models, the location, and internal query, subject, Property, group and market identifiers. API keys remain local install configuration and are never accepted here.",
1251
+ description: "Install administrator only: explicitly enable or disable stance-and-evidence sentiment. Both install and project switches default off. Enabling processes future eligible complete runs; historical answers require explicit backfill. On dispatch TypeSafe receives the text of each answer with the frozen subject identity (name, aliases, qualified aliases and URLs), the tracked query text and class, the answer engine with its requested and served models, the location, and internal query, subject, Property, group and market identifiers. API keys remain local install configuration and are never accepted here.",
1252
1252
  access: "write",
1253
1253
  tier: "monitoring",
1254
1254
  inputSchema: sentimentConfigureInputSchema,
@@ -2626,7 +2626,7 @@ var canonryMcpTools = [
2626
2626
  defineTool({
2627
2627
  name: "canonry_project_upsert",
2628
2628
  title: "Create or replace project",
2629
- description: "Create or replace a Canonry project. PUT semantics \u2014 fields not in the request are reset to their defaults. Provide the full intended project shape. Exception: an omitted providerDispatchModes (provider \u2192 sync|batch for scheduled sweeps) keeps the stored preference; send {} to clear it.",
2629
+ description: "Create or replace a Canonry project. PUT semantics: fields not in the request are reset to their defaults. Provide the full intended project shape. Exceptions: an omitted providerDispatchModes (provider \u2192 sync|batch for scheduled sweeps) keeps the stored preference; send {} to clear it. An omitted qualifiedAliases (the aliases Simple sentiment treats as this brand's own names) keeps the stored list, minus names that no longer qualify (a removed alias, a spelling of the display name, or a competitor's name); send [] to clear it.",
2630
2630
  access: "write",
2631
2631
  tier: "setup",
2632
2632
  inputSchema: projectUpsertInputSchema,
@@ -2637,7 +2637,7 @@ var canonryMcpTools = [
2637
2637
  defineTool({
2638
2638
  name: "canonry_apply_config",
2639
2639
  title: "Apply project config",
2640
- description: "Apply one Canonry config-as-code project document. Replaces the project to match the config \u2014 fields omitted from the spec are reset to defaults, with one exception: a spec with neither queries nor keywords leaves the tracked-query basket unchanged. To clear the basket, pass an explicit empty queries list. For multi-document YAML, call this tool once per project document.",
2640
+ description: "Apply one Canonry config-as-code project document. Replaces the project to match the config; fields omitted from the spec are reset to defaults, with these exceptions: a spec with neither queries nor keywords leaves the tracked-query basket unchanged (to clear the basket, pass an explicit empty queries list); an omitted providerDispatchModes keeps the stored preference; and an omitted qualifiedAliases keeps the stored list, minus names that no longer qualify (a removed alias, a spelling of the display name, or a competitor's name); send [] to clear it. For multi-document YAML, call this tool once per project document.",
2641
2641
  access: "write",
2642
2642
  tier: "core",
2643
2643
  inputSchema: applyConfigInputSchema,
@@ -19,21 +19,21 @@ import {
19
19
  runWithUsageTags,
20
20
  saveConfigPatch,
21
21
  sentimentInstallReadiness
22
- } from "./chunk-G3CMWO26.js";
22
+ } from "./chunk-QTETJEHI.js";
23
23
  import {
24
24
  computeFactorAverages,
25
25
  deleteSiteCrawlGraphLayout,
26
26
  persistSiteCrawlGraphLayout,
27
27
  prepareSiteCrawlGraphLayout,
28
28
  recordedSharePct
29
- } from "./chunk-AQFRQTKY.js";
29
+ } from "./chunk-NZCKJMLC.js";
30
30
  import {
31
31
  CanonryMcpToolNames,
32
32
  CliError,
33
33
  PACKAGE_VERSION,
34
34
  canonryMcpTools,
35
35
  isMachineFormat
36
- } from "./chunk-Y23FQK6O.js";
36
+ } from "./chunk-25H4K7KL.js";
37
37
  import {
38
38
  CC_CACHE_DIR,
39
39
  DUCKDB_SPEC,
@@ -214,7 +214,7 @@ import {
214
214
  siteLivenessState,
215
215
  toAlertView,
216
216
  usageCounters
217
- } from "./chunk-GIKWL2BQ.js";
217
+ } from "./chunk-G2K5KCUY.js";
218
218
  import {
219
219
  AGENT_MEMORY_VALUE_MAX_BYTES,
220
220
  AGENT_NONE,
@@ -294,7 +294,6 @@ import {
294
294
  authInvalid,
295
295
  authRequired,
296
296
  backoffDelayMs,
297
- brandLabelFromDomain,
298
297
  bucketOnboardingCount,
299
298
  buildRunErrorFromMessages,
300
299
  buildSimpleMeasurementDefinition,
@@ -309,6 +308,7 @@ import {
309
308
  classifyTemplateLinkEdge,
310
309
  cloudflareQueueNameSchema,
311
310
  compareSemver,
311
+ competitorLabelFromDomain,
312
312
  compileBrandAliases,
313
313
  computeBacklinkSummaryMetrics,
314
314
  contentActionLabel,
@@ -414,7 +414,7 @@ import {
414
414
  visibilityReportRequestSchema,
415
415
  winnabilityClassLabel,
416
416
  withRetry
417
- } from "./chunk-SJX7XJB6.js";
417
+ } from "./chunk-NOIK3FUO.js";
418
418
 
419
419
  // src/runtime-context.ts
420
420
  function cliRuntimeContext(env = process.env, stdio = process) {
@@ -7830,7 +7830,7 @@ function nonBlank(value) {
7830
7830
  return trimmed ? trimmed : void 0;
7831
7831
  }
7832
7832
  function resolveBuildCommit(env = process.env) {
7833
- const embedded = true ? "d88a56a78f778517c21d1dd190ecb3a966a76ccd" : void 0;
7833
+ const embedded = true ? "728d0070fa40d19f62082c5a4b31649a57ca2dc7" : void 0;
7834
7834
  return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
7835
7835
  }
7836
7836
  function resolveInstanceIdentity(env = process.env) {
@@ -8697,7 +8697,9 @@ var JobRunner = class {
8697
8697
  displayName: project.displayName,
8698
8698
  aliases: project.aliases,
8699
8699
  canonicalDomain: project.canonicalDomain,
8700
- ownedDomains: project.ownedDomains
8700
+ ownedDomains: project.ownedDomains,
8701
+ // Sentiment-only. The builder drops a stale entry instead of failing dispatch.
8702
+ qualifiedAliases: project.qualifiedAliases
8701
8703
  },
8702
8704
  country: project.country,
8703
8705
  language: project.language,
@@ -8710,7 +8712,7 @@ var JobRunner = class {
8710
8712
  // identity we actually dispatched with so later reporting never
8711
8713
  // borrows renamed or newly added competitors from live project state.
8712
8714
  competitors: projectCompetitors.map((competitor) => {
8713
- const label = brandLabelFromDomain(competitor.domain) || competitor.domain;
8715
+ const label = competitorLabelFromDomain(competitor.domain);
8714
8716
  return { domain: competitor.domain, label, aliases: [label] };
8715
8717
  }),
8716
8718
  queries: projectQueries.map((query) => ({
@@ -14452,7 +14454,7 @@ function readStoredGroundingSources(rawResponse) {
14452
14454
  return result2;
14453
14455
  }
14454
14456
  async function backfillInsightsCommand(project, opts) {
14455
- const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-FVOFIJP3.js");
14457
+ const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-ZKFLGJ23.js");
14456
14458
  const config = loadConfig();
14457
14459
  const db = createClient(config.database);
14458
14460
  migrate(db);
@@ -291,6 +291,7 @@ import {
291
291
  compareSemver,
292
292
  competitorBatchRequestSchema,
293
293
  competitorDtoSchema,
294
+ competitorLabelFromDomain,
294
295
  competitorLandscapeQuerySchema,
295
296
  competitorLandscapeResponseSchema,
296
297
  compileBrandAliases,
@@ -720,6 +721,7 @@ import {
720
721
  resolveMeasurementRunQueryScope,
721
722
  resolveMeasurementRunScope,
722
723
  resolveNegativeReviewMaxStars,
724
+ resolveProjectQualifiedAliases,
723
725
  resolveProviderModel,
724
726
  resolveRunDispatchModes,
725
727
  resolveSnapshotRequestQueries,
@@ -774,6 +776,7 @@ import {
774
776
  shareOfVoiceReason,
775
777
  shareOfVoiceSummary,
776
778
  shiftIsoCalendarDate,
779
+ simpleMeasurementCompetitorNames,
777
780
  simpleMeasurementDefinitionSchema,
778
781
  siteAuditLivePageHealthSchema,
779
782
  siteAuditPageFactorSchema,
@@ -866,7 +869,7 @@ import {
866
869
  wordpressSchemaDeployResultDtoSchema,
867
870
  wordpressSchemaStatusResultDtoSchema,
868
871
  wordpressStatusDtoSchema
869
- } from "./chunk-SJX7XJB6.js";
872
+ } from "./chunk-NOIK3FUO.js";
870
873
 
871
874
  // src/intelligence-service.ts
872
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";
@@ -1017,6 +1020,12 @@ var projects = sqliteTable("projects", {
1017
1020
  canonicalDomain: text("canonical_domain").notNull(),
1018
1021
  ownedDomains: text("owned_domains", { mode: "json" }).$type().notNull().default([]),
1019
1022
  aliases: text("aliases", { mode: "json" }).$type().notNull().default([]),
1023
+ /**
1024
+ * Operator-chosen subset of `aliases` that Simple sentiment tells the
1025
+ * evaluator are this brand's own names. Frozen into each Simple run's
1026
+ * sidecar at dispatch; never read by mention detection or query classes.
1027
+ */
1028
+ qualifiedAliases: text("qualified_aliases", { mode: "json" }).$type().notNull().default([]),
1020
1029
  country: text("country").notNull(),
1021
1030
  language: text("language").notNull(),
1022
1031
  tags: text("tags", { mode: "json" }).$type().notNull().default([]),
@@ -8172,6 +8181,16 @@ var MIGRATION_VERSIONS = [
8172
8181
  name: "aero-ledger-conversation-ids",
8173
8182
  statements: [],
8174
8183
  run: dropAeroLedgerConversationKeys
8184
+ },
8185
+ {
8186
+ // Sentiment-only project setting: the aliases the evaluator is told are
8187
+ // the brand's own names. Defaulted, so an older writer that omits it and
8188
+ // every existing project read as not opted in.
8189
+ version: 166,
8190
+ name: "projects-qualified-aliases",
8191
+ statements: [
8192
+ `ALTER TABLE projects ADD COLUMN qualified_aliases TEXT NOT NULL DEFAULT '[]'`
8193
+ ]
8175
8194
  }
8176
8195
  ];
8177
8196
  var AERO_LEDGER_REBUILDS = [
@@ -13638,6 +13657,7 @@ function selectSentimentSources(db, projectId, filters) {
13638
13657
  continue;
13639
13658
  }
13640
13659
  const identity = definition.identity;
13660
+ const qualifiedAliases = [...identity.qualifiedAliases ?? []].sort();
13641
13661
  const names = effectiveBrandNames(identity);
13642
13662
  const urls = [identity.canonicalDomain, ...identity.ownedDomains];
13643
13663
  const mentionNotApplicable = !names.length && !urls.some((url) => url.trim());
@@ -13659,7 +13679,7 @@ function selectSentimentSources(db, projectId, filters) {
13659
13679
  language: definition.language,
13660
13680
  queryText: query.queryText,
13661
13681
  revision: null,
13662
- subject: { key: projectId, name: identity.displayName, aliases: [...names], identityAliases: [], urls: [...urls], mentionNotApplicable },
13682
+ subject: { key: projectId, name: identity.displayName, aliases: [...names], identityAliases: [...qualifiedAliases], urls: [...urls], mentionNotApplicable },
13663
13683
  edges: [edge]
13664
13684
  });
13665
13685
  }
@@ -13844,7 +13864,7 @@ function sentimentClassifierInput(source, definition) {
13844
13864
  }
13845
13865
 
13846
13866
  // ../api-routes/src/sentiment-service.ts
13847
- var DISCLOSURE = "Experimental English sentiment classification. Enabling sends each stored answer's text to TypeSafe with the frozen subject identity (name, aliases and URLs), the tracked query text and query class, the answer engine with its requested and served models, the location, and internal query, subject, Property, group and market identifiers.";
13867
+ var DISCLOSURE = "Experimental English sentiment classification. Enabling sends each stored answer's text to TypeSafe with the frozen subject identity (name, aliases, qualified aliases and URLs), the tracked query text and query class, the answer engine with its requested and served models, the location, and internal query, subject, Property, group and market identifiers.";
13848
13868
  var FULL_ROWS = { include: /* @__PURE__ */ new Set(["assessments", "locations"]), limit: null, after: null };
13849
13869
  var COMPACT_ROWS = { include: /* @__PURE__ */ new Set(), limit: null, after: null };
13850
13870
  var OPERATIONAL_OUTCOMES = /* @__PURE__ */ new Set([SentimentOutcomes.pending, SentimentOutcomes.running, SentimentOutcomes["waiting-to-retry"], SentimentOutcomes.failed, SentimentOutcomes.canceled]);
@@ -16866,6 +16886,7 @@ async function projectRoutes(app, opts) {
16866
16886
  const id = crypto9.randomUUID();
16867
16887
  const now = (/* @__PURE__ */ new Date()).toISOString();
16868
16888
  const nextAliases = normalizeProjectAliases(body.displayName, body.aliases ?? []);
16889
+ const qualifiedAliases = body.qualifiedAliases === void 0 ? [] : requireQualifiedAliases({ displayName: body.displayName, aliases: nextAliases }, body.qualifiedAliases, []);
16869
16890
  const inserted = app.db.transaction((tx) => {
16870
16891
  const result = tx.insert(projects).values({
16871
16892
  id,
@@ -16874,6 +16895,7 @@ async function projectRoutes(app, opts) {
16874
16895
  canonicalDomain,
16875
16896
  ownedDomains: body.ownedDomains ?? [],
16876
16897
  aliases: nextAliases,
16898
+ qualifiedAliases,
16877
16899
  country: body.country,
16878
16900
  language: body.language,
16879
16901
  tags: body.tags ?? [],
@@ -16960,6 +16982,9 @@ async function projectRoutes(app, opts) {
16960
16982
  const nextNegativeReviewMaxStars = body.negativeReviewMaxStars !== void 0 ? body.negativeReviewMaxStars : existing ? readNegativeReviewMaxStars(app.db, existing.id) : null;
16961
16983
  const nextMeasurement = body.measurement ?? existing?.measurement ?? DEFAULT_MEASUREMENT_CONFIG;
16962
16984
  const nextAliases = normalizeProjectAliases(body.displayName, body.aliases ?? []);
16985
+ const nextIdentity = { displayName: body.displayName, aliases: nextAliases };
16986
+ const liveCompetitors = existing ? liveCompetitorNames(app.db, existing.id) : [];
16987
+ const nextQualifiedAliases = body.qualifiedAliases !== void 0 ? requireQualifiedAliases(nextIdentity, body.qualifiedAliases, liveCompetitors) : resolveProjectQualifiedAliases(nextIdentity, existing?.qualifiedAliases ?? [], liveCompetitors).value;
16963
16988
  if (existing) {
16964
16989
  const prevAliases = existing.aliases;
16965
16990
  const aliasesChanged = !aliasArraysEqual(prevAliases, nextAliases);
@@ -16969,6 +16994,7 @@ async function projectRoutes(app, opts) {
16969
16994
  canonicalDomain: body.canonicalDomain,
16970
16995
  ownedDomains: body.ownedDomains ?? [],
16971
16996
  aliases: nextAliases,
16997
+ qualifiedAliases: nextQualifiedAliases,
16972
16998
  country: body.country,
16973
16999
  language: body.language,
16974
17000
  tags: body.tags ?? [],
@@ -17007,6 +17033,7 @@ async function projectRoutes(app, opts) {
17007
17033
  canonicalDomain: body.canonicalDomain,
17008
17034
  ownedDomains: body.ownedDomains ?? [],
17009
17035
  aliases: nextAliases,
17036
+ qualifiedAliases: nextQualifiedAliases,
17010
17037
  country: body.country,
17011
17038
  language: body.language,
17012
17039
  tags: body.tags ?? [],
@@ -17195,6 +17222,11 @@ async function projectRoutes(app, opts) {
17195
17222
  eq15(schedules.kind, SchedulableRunKinds["answer-visibility"])
17196
17223
  )).get();
17197
17224
  const notificationRows = app.db.select().from(notifications).where(eq15(notifications.projectId, project.id)).all();
17225
+ const exportedQualifiedAliases = resolveProjectQualifiedAliases(
17226
+ project,
17227
+ project.qualifiedAliases,
17228
+ comps.map((c) => competitorLabelFromDomain(c.domain))
17229
+ ).value;
17198
17230
  const config = {
17199
17231
  apiVersion: "canonry/v1",
17200
17232
  kind: "Project",
@@ -17207,6 +17239,7 @@ async function projectRoutes(app, opts) {
17207
17239
  canonicalDomain: project.canonicalDomain,
17208
17240
  ownedDomains: project.ownedDomains,
17209
17241
  aliases: project.aliases,
17242
+ ...exportedQualifiedAliases.length ? { qualifiedAliases: exportedQualifiedAliases } : {},
17210
17243
  country: project.country,
17211
17244
  language: project.language,
17212
17245
  queries: qs.map((q) => q.query),
@@ -17246,6 +17279,32 @@ function assertProviderModelScope(request, current, next, nextProviders) {
17246
17279
  if (providerModelsEqual(effectiveCurrent, effectiveNext)) return;
17247
17280
  requireScope(request, SETTINGS_WRITE_SCOPE);
17248
17281
  }
17282
+ function requireQualifiedAliases(identity, requested, competitorNames) {
17283
+ const resolved = resolveProjectQualifiedAliases(identity, requested, competitorNames);
17284
+ if (resolved.rejected.length > 0) {
17285
+ const reasons = resolved.rejected.map((entry) => `${entry.name} (${entry.reason})`).join(", ");
17286
+ throw validationError(`Rejected qualifiedAliases: ${reasons}`, {
17287
+ rejectedQualifiedAliases: resolved.rejected
17288
+ });
17289
+ }
17290
+ return resolved.value;
17291
+ }
17292
+ function liveCompetitorNames(db, projectId) {
17293
+ return db.select({ domain: competitors.domain }).from(competitors).where(eq15(competitors.projectId, projectId)).all().map((row) => competitorLabelFromDomain(row.domain));
17294
+ }
17295
+ function pruneQualifiedAliasesForCompetitors(tx, projectId, now) {
17296
+ const project = tx.select({
17297
+ displayName: projects.displayName,
17298
+ aliases: projects.aliases,
17299
+ qualifiedAliases: projects.qualifiedAliases
17300
+ }).from(projects).where(eq15(projects.id, projectId)).get();
17301
+ if (!project?.qualifiedAliases.length) return [];
17302
+ const kept = resolveProjectQualifiedAliases(project, project.qualifiedAliases, liveCompetitorNames(tx, projectId)).value;
17303
+ const dropped = project.qualifiedAliases.filter((name) => !kept.includes(name));
17304
+ if (dropped.length === 0) return [];
17305
+ tx.update(projects).set({ qualifiedAliases: kept, updatedAt: now }).where(eq15(projects.id, projectId)).run();
17306
+ return dropped;
17307
+ }
17249
17308
  function providerModelsEqual(a, b) {
17250
17309
  const aKeys = Object.keys(a);
17251
17310
  if (aKeys.length !== Object.keys(b).length) return false;
@@ -17259,6 +17318,7 @@ function formatProject(row, negativeReviewMaxStars) {
17259
17318
  canonicalDomain: row.canonicalDomain,
17260
17319
  ownedDomains: row.ownedDomains,
17261
17320
  aliases: row.aliases,
17321
+ qualifiedAliases: row.qualifiedAliases,
17262
17322
  country: row.country,
17263
17323
  language: row.language,
17264
17324
  tags: row.tags,
@@ -17977,12 +18037,16 @@ async function competitorRoutes(app) {
17977
18037
  createdAt: now
17978
18038
  }).run();
17979
18039
  }
18040
+ const droppedQualifiedAliases = pruneQualifiedAliasesForCompetitors(tx, project.id, now);
17980
18041
  writeAuditLog(tx, {
17981
18042
  projectId: project.id,
17982
18043
  actor: "api",
17983
18044
  action: "competitors.replaced",
17984
18045
  entityType: "competitor",
17985
- diff: { competitors: normalizedCompetitors }
18046
+ diff: {
18047
+ competitors: normalizedCompetitors,
18048
+ ...droppedQualifiedAliases.length ? { droppedQualifiedAliases } : {}
18049
+ }
17986
18050
  });
17987
18051
  });
17988
18052
  const rows = app.db.select().from(competitors).where(eq19(competitors.projectId, project.id)).all();
@@ -18009,12 +18073,13 @@ async function competitorRoutes(app) {
18009
18073
  target: [competitors.projectId, competitors.domain]
18010
18074
  }).run();
18011
18075
  }
18076
+ const droppedQualifiedAliases = pruneQualifiedAliasesForCompetitors(tx, project.id, now);
18012
18077
  writeAuditLog(tx, {
18013
18078
  projectId: project.id,
18014
18079
  actor: "api",
18015
18080
  action: "competitors.appended",
18016
18081
  entityType: "competitor",
18017
- diff: { added }
18082
+ diff: { added, ...droppedQualifiedAliases.length ? { droppedQualifiedAliases } : {} }
18018
18083
  });
18019
18084
  });
18020
18085
  const rows = app.db.select().from(competitors).where(eq19(competitors.projectId, project.id)).all();
@@ -29708,6 +29773,15 @@ async function applyRoutes(app, opts) {
29708
29773
  specProviders
29709
29774
  );
29710
29775
  const specDispatchModes = config.spec.providerDispatchModes === void 0 ? void 0 : validateProviderDispatchModes(config.spec.providerDispatchModes, opts?.providerAdapters);
29776
+ const specCompetitorNames = normalizeCompetitorList2(config.spec.competitors).map(competitorLabelFromDomain);
29777
+ const specQualifiedAliases = config.spec.qualifiedAliases === void 0 ? void 0 : requireQualifiedAliases(
29778
+ {
29779
+ displayName: config.spec.displayName,
29780
+ aliases: normalizeProjectAliases(config.spec.displayName, config.spec.aliases)
29781
+ },
29782
+ config.spec.qualifiedAliases,
29783
+ specCompetitorNames
29784
+ );
29711
29785
  let resolvedSchedule = null;
29712
29786
  let deleteSchedule = false;
29713
29787
  if (config.spec.schedule) {
@@ -29766,6 +29840,11 @@ async function applyRoutes(app, opts) {
29766
29840
  }
29767
29841
  if (existing) {
29768
29842
  projectId = existing.id;
29843
+ const qualifiedAliases = specQualifiedAliases ?? resolveProjectQualifiedAliases(
29844
+ { displayName: config.spec.displayName, aliases: nextAliases },
29845
+ existing.qualifiedAliases,
29846
+ specCompetitorNames
29847
+ ).value;
29769
29848
  const providerDispatchModes = pruneProviderDispatchModes(
29770
29849
  specDispatchModes ?? existing.providerDispatchModes,
29771
29850
  specProviders,
@@ -29776,6 +29855,7 @@ async function applyRoutes(app, opts) {
29776
29855
  canonicalDomain: config.spec.canonicalDomain,
29777
29856
  ownedDomains: config.spec.ownedDomains ?? [],
29778
29857
  aliases: nextAliases,
29858
+ qualifiedAliases,
29779
29859
  country: config.spec.country,
29780
29860
  language: config.spec.language,
29781
29861
  labels: config.metadata.labels,
@@ -29807,6 +29887,7 @@ async function applyRoutes(app, opts) {
29807
29887
  canonicalDomain: config.spec.canonicalDomain,
29808
29888
  ownedDomains: config.spec.ownedDomains ?? [],
29809
29889
  aliases: nextAliases,
29890
+ qualifiedAliases: specQualifiedAliases ?? [],
29810
29891
  country: config.spec.country,
29811
29892
  language: config.spec.language,
29812
29893
  tags: [],
@@ -29951,6 +30032,7 @@ async function applyRoutes(app, opts) {
29951
30032
  canonicalDomain: project.canonicalDomain,
29952
30033
  ownedDomains: project.ownedDomains,
29953
30034
  aliases: project.aliases,
30035
+ qualifiedAliases: project.qualifiedAliases,
29954
30036
  country: project.country,
29955
30037
  language: project.language,
29956
30038
  tags: project.tags,
@@ -39426,6 +39508,7 @@ function formatProject2(row, negativeReviewMaxStars) {
39426
39508
  canonicalDomain: row.canonicalDomain,
39427
39509
  ownedDomains: row.ownedDomains,
39428
39510
  aliases: row.aliases,
39511
+ qualifiedAliases: row.qualifiedAliases,
39429
39512
  country: row.country,
39430
39513
  language: row.language,
39431
39514
  tags: row.tags,
@@ -87666,13 +87749,18 @@ async function discoveryRoutes(app, opts) {
87666
87749
  createdAt: now
87667
87750
  }).run();
87668
87751
  }
87752
+ const droppedQualifiedAliases = promotedCompetitors.length ? pruneQualifiedAliasesForCompetitors(tx, project.id, now) : [];
87669
87753
  writeAuditLog(tx, {
87670
87754
  projectId: project.id,
87671
87755
  actor: "api",
87672
87756
  action: "discovery.promoted",
87673
87757
  entityType: "discovery_session",
87674
87758
  entityId: session.id,
87675
- diff: { queries: promotedQueries, competitors: promotedCompetitors }
87759
+ diff: {
87760
+ queries: promotedQueries,
87761
+ competitors: promotedCompetitors,
87762
+ ...droppedQualifiedAliases.length ? { droppedQualifiedAliases } : {}
87763
+ }
87676
87764
  });
87677
87765
  });
87678
87766
  }
@@ -90373,12 +90461,28 @@ function captureSimpleMeasurementDefinition(db, input) {
90373
90461
  if (definition.queries.some((query) => query.queryClass !== (classifier?.classify(query.queryText) ?? null))) {
90374
90462
  throw validationError("Query classes must match the captured identity and text.");
90375
90463
  }
90464
+ if (definition.identity.qualifiedAliases !== void 0) {
90465
+ const expected = resolveProjectQualifiedAliases(
90466
+ definition.identity,
90467
+ definition.identity.qualifiedAliases,
90468
+ simpleMeasurementCompetitorNames(definition.competitors)
90469
+ ).value;
90470
+ const captured = definition.identity.qualifiedAliases;
90471
+ if (captured.length !== expected.length || captured.some((name, index2) => name !== expected[index2])) {
90472
+ throw validationError("Qualified aliases must be a sorted subset of the captured aliases.");
90473
+ }
90474
+ }
90376
90475
  const existing = tx.select().from(simpleMeasurementDefinitions).where(and68(eq81(simpleMeasurementDefinitions.projectId, input.projectId), eq81(simpleMeasurementDefinitions.runId, input.runId))).get();
90377
90476
  if (existing) {
90378
90477
  const frozen = simpleMeasurementDefinitionSchema.parse(existing.definition);
90478
+ const { qualifiedAliases: _liveQualifiedAliases, ...liveIdentity } = definition.identity;
90379
90479
  const replayDefinition = {
90380
90480
  ...definition,
90381
- capturedAt: frozen.capturedAt
90481
+ capturedAt: frozen.capturedAt,
90482
+ identity: {
90483
+ ...liveIdentity,
90484
+ ...frozen.identity.qualifiedAliases?.length ? { qualifiedAliases: frozen.identity.qualifiedAliases } : {}
90485
+ }
90382
90486
  };
90383
90487
  const replayChecksum = crypto51.createHash("sha256").update(canonicalSimpleMeasurementDefinitionJson(replayDefinition)).digest("hex");
90384
90488
  if (existing.checksum !== replayChecksum) {