@canonry/canonry 5.14.0 → 5.15.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 (28) hide show
  1. package/assets/assets/{AuditHistoryPanel-DWDOPf8c.js → AuditHistoryPanel-BZJn-wvp.js} +1 -1
  2. package/assets/assets/{BacklinksPage-DGxq-iU6.js → BacklinksPage-DsQAKO31.js} +1 -1
  3. package/assets/assets/{HistoryPage-DR91m-gT.js → HistoryPage-DWn459Gu.js} +1 -1
  4. package/assets/assets/{MeasurementPropertyPage-a8poltfM.js → MeasurementPropertyPage-D6pUcBiT.js} +1 -1
  5. package/assets/assets/{ProjectPage-CCCJE7rA.js → ProjectPage-D-lDBpPV.js} +1 -1
  6. package/assets/assets/{RunRow-Xe63DyPK.js → RunRow-BJxx50Ar.js} +1 -1
  7. package/assets/assets/{RunsPage-DK119ZZw.js → RunsPage-DvoNDx6z.js} +1 -1
  8. package/assets/assets/{SettingsPage-G461foD-.js → SettingsPage-DXbhM5Lv.js} +1 -1
  9. package/assets/assets/{SiteHealthSection-CJnHkGM2.js → SiteHealthSection-4mMfc6Rb.js} +3 -3
  10. package/assets/assets/{TrafficPage-AsWgc7Ot.js → TrafficPage-EYSxLxkQ.js} +1 -1
  11. package/assets/assets/{TrafficSourceDetailPage-D10yBQoD.js → TrafficSourceDetailPage-DY4sV_BX.js} +1 -1
  12. package/assets/assets/{extract-error-message-PP4HD_Dp.js → extract-error-message-BMpWRqf9.js} +1 -1
  13. package/assets/assets/{index-CCIeAE4J.js → index-KCAlcuMN.js} +22 -22
  14. package/assets/assets/{react-sigma_core.esm.min-CkyyYkKU.js → react-sigma_core.esm.min-CHepSGqZ.js} +1 -1
  15. package/assets/assets/{v2-overview-adapter-DW-In1hp.js → v2-overview-adapter-CpM-FjB_.js} +1 -1
  16. package/assets/index.html +1 -1
  17. package/dist/{chunk-RGMUT5KY.js → chunk-3YAPVVFN.js} +106 -39
  18. package/dist/{chunk-4LPV6ZZY.js → chunk-CDQDPUY4.js} +2 -2
  19. package/dist/{chunk-SOLFOKZF.js → chunk-JO5HHEJV.js} +2 -2
  20. package/dist/{chunk-45EGDRVF.js → chunk-L36TC6LB.js} +62 -7
  21. package/dist/{chunk-S6LJSUZO.js → chunk-SJ7ZOFL5.js} +74 -29
  22. package/dist/{chunk-2W6GCJ3O.js → chunk-ZGZSROSR.js} +1 -1
  23. package/dist/cli.js +7 -7
  24. package/dist/{demo-server-H4ZFIIIB.js → demo-server-QLQUVMKJ.js} +3 -3
  25. package/dist/index.js +5 -5
  26. package/dist/{intelligence-service-CJKOXPOP.js → intelligence-service-EAUKUVVM.js} +2 -2
  27. package/dist/mcp.js +3 -3
  28. package/package.json +11 -11
@@ -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-CJnHkGM2.js";import"./index-CCIeAE4J.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-BQC2VH0O.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-4mMfc6Rb.js";import"./index-KCAlcuMN.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-BQC2VH0O.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{j as s,r as C}from"./vendor-tanstack-ZXXkndVj.js";import{A as ie,B as oe}from"./index-CCIeAE4J.js";import{M as le}from"./vendor-markdown-B4giJcws.js";import{C as ue,$ as ce,g as J}from"./vendor-lucide-N6vOpZmh.js";const $e="Sources",B={copy:"Copy answer",copying:"Copying…",copied:"Copied",failed:"Could not copy. Select and copy the answer above."};function de({headingLevel:e}){return n=>{const l=[],u=c=>{c.type==="heading"&&c.depth&&l.push(c),c.children?.forEach(u)};u(n);const f=l.reduce((c,p)=>Math.min(c,p.depth),6);for(const c of l){const p=c.depth-f;c.depth=Math.min(6,e+p),c.data={...c.data,hProperties:{...c.data?.hProperties,"data-answer-heading-level":p+1}}}}}function pe({answer:e}){const[n,l]=C.useState("idle"),u=C.useRef(!1),f=async()=>{if(!u.current){u.current=!0,l("copying");try{await navigator.clipboard.writeText(e),l("copied")}catch{l("failed")}finally{u.current=!1}}};return s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-3",children:[s.jsx(oe,{type:"button",variant:"ghost",className:"min-h-11 px-2","aria-disabled":n==="copying","aria-busy":n==="copying",onClick:()=>{f()},children:n==="copying"?B.copying:B.copy}),s.jsx("span",{role:"status",className:"text-sm text-secondary",children:n==="copied"?B.copied:n==="failed"?B.failed:""})]})}function Me({children:e,headingLevel:n=4,copyable:l=!1}){return s.jsxs("div",{className:"answer-markdown",children:[s.jsx(le,{remarkPlugins:[[de,{headingLevel:n}]],components:{p:({children:u})=>s.jsx("p",{className:"mb-3 whitespace-pre-wrap last:mb-0",children:u}),ul:({children:u})=>s.jsx("ul",{className:"mb-3 ml-5 list-disc space-y-1",children:u}),ol:({children:u,start:f})=>s.jsx("ol",{start:f,className:"mb-3 ml-5 list-decimal space-y-1",children:u}),pre:({children:u})=>s.jsx("pre",{className:"mb-3 overflow-x-auto whitespace-pre-wrap",children:u}),a:({children:u,href:f})=>{const c=ie(f);return c?s.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-link underline",children:u}):s.jsx("span",{children:u})},img:({alt:u})=>s.jsx("span",{children:u})},children:e}),l&&e.trim()?s.jsx(pe,{answer:e},e):null]})}const 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",q=e=>e.kind==="project"?"Whole site":e.label,E={allMarkets:"All markets",browse:e=>`Browse ${e}`,select:e=>`Select ${e}`,browseAll:"Browse all properties"},me=e=>e?.kind==="group"&&e.marketKeys?.length===1?e.marketKeys[0]:void 0,ee=e=>`${e} ${e===1?"property":"properties"}`;function Ie({options:e,selected:n,onSelect:l,marketKey:u,label:f="Measurement scope",labelVisibility:c="visible",allowGroupSelect:p=!0}){const a=[...e].sort((t,o)=>t.label.localeCompare(o.label,void 0,{numeric:!0})||t.id.localeCompare(o.id)),[x,k]=C.useState(""),[M,I]=C.useState([]),[y,N]=C.useState(!1),b=C.useRef(null),v=C.useRef(null),r=C.useId(),g=a.filter(t=>t.kind==="group"),m=new Map(g.map(t=>[t.id,t])),i=m.get(M.at(-1)??""),U=m.get(M.at(-2)??""),h=x.trim().toLocaleLowerCase(),re=g.filter(t=>!t.parentGroupIds?.some(o=>m.has(o))),_=a.filter(t=>t.kind==="property"),L=t=>(t.parentGroupIds??[]).map(o=>m.get(o)?.label).filter(Boolean).join(" · "),R=t=>`${q(t)} ${L(t)}`.toLocaleLowerCase().includes(h),F=t=>{const o=[...t.parentGroupIds??[]],d=new Set;for(;o.length;){const j=o.pop();if(j===i?.id)return!0;d.has(j)||(d.add(j),o.push(...m.get(j)?.parentGroupIds??[]))}return!1},K=(y?[]:i?g.filter(t=>h?F(t):t.parentGroupIds?.includes(i.id)):h?g:re).filter(R),S=a.find(t=>t.kind==="market"&&t.id===(u??(n.kind==="market"?n.id:void 0))),H=i&&S&&(i.marketKeys?.includes(S.id)||S.parentGroupIds?.includes(i.id))?S.id:void 0,O=p?H??me(i):void 0,G=(i?_.filter(t=>t.parentGroupIds?.includes(i.id)&&(!O||t.marketKeys?.includes(O))):h||y||g.length===0?_:[]).filter(R),W=a.filter(t=>t.kind!=="market"||y||!p&&!i&&!h&&g.length>0||p&&i?.marketKeys?.length===1&&!h?!1:(i?h?F(t):t.parentGroupIds?.includes(i.id):h||!t.parentGroupIds?.some(d=>m.has(d)))&&R(t)),z=i||y?[]:a.filter(t=>t.kind==="project"&&R(t));C.useEffect(()=>{const t=o=>{b.current?.open&&o.target instanceof Node&&!b.current.contains(o.target)&&(b.current.open=!1)};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[]);const se=t=>{b.current&&(b.current.open=!1,b.current.querySelector("summary")?.focus());const o=p?t.kind==="property"?O:t.kind==="group"&&t.id===i?.id?H:void 0:void 0;o?l(t,o):l(t)},T=t=>{const o=[];let d=m.get(t.parentGroupIds?.[0]??"");for(;d&&!o.includes(d.id)&&d.id!==t.id;)o.unshift(d.id),d=m.get(d.parentGroupIds?.[0]??"");return[...o,t.id]},ae=()=>{const t=n.kind==="group"?m.get(n.id):void 0,o=m.get(S?.parentGroupIds?.[0]??""),d=(n.parentGroupIds??[]).flatMap(A=>{const w=m.get(A);return w?[T(w)]:[]}),j=d.find(A=>A.at(-1)===i?.id)??d.sort((A,w)=>w.length-A.length)[0]??[],Z=o?T(o):n.marketKeys?.length?[]:j;I(t?T(t):Z),N(n.kind==="property"&&Z.length===0&&g.length>0),k("")},Q=t=>{I(T(t)),N(!1),k(""),v.current?.focus()},P=(t,o=q(t))=>s.jsxs("div",{className:"flex items-stretch",children:[s.jsxs("button",{type:"button",className:D,"aria-label":t.kind==="group"&&!p?E.browse(q(t)):E.select(q(t)),"aria-current":n.kind===t.kind&&n.id===t.id?"true":void 0,onClick:()=>t.kind==="group"&&!p?Q(t):se(t),children:[s.jsxs("span",{className:"min-w-0 break-words",children:[o,h&&L(t)?s.jsx("span",{className:"block text-[13px] text-secondary",children:L(t)}):null]}),s.jsx("span",{className:"shrink-0 text-right text-[13px] text-secondary",children:t.kind==="market"?p?"Query context":"Market":t.kind==="property"?"Property":ee(t.targetCount)})]}),p&&t.kind==="group"&&t.id!==i?.id&&a.some(d=>d.parentGroupIds?.includes(t.id))?s.jsx("button",{type:"button","aria-label":E.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:()=>Q(t),children:s.jsx(J,{size:18,"aria-hidden":"true"})}):null]},`${t.kind}:${t.id}`),V=(t,o)=>o.length>0?s.jsxs("section",{"aria-label":t,className:"mt-2",children:[s.jsx("h3",{className:"px-2 py-2 text-[13px] font-medium text-secondary",children:t}),o.map(d=>P(d))]}):null,Y=(t,o,d)=>o.length>0?s.jsxs("details",{open:d,className:"mt-2 border-y border-default",children:[s.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," (",o.length,")"]}),o.map(j=>P(j))]},`${i?.id??"root"}:${t}`):null;return s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{id:`${r}-label`,className:c==="sr-only"?"sr-only":"mb-1 block text-sm font-medium text-heading",children:f}),s.jsxs("details",{ref:b,className:"relative",onToggle:t=>{t.target===t.currentTarget&&t.currentTarget.open&&v.current?.focus()},onKeyDown:t=>{t.key==="Escape"&&(t.preventDefault(),t.currentTarget.open=!1,t.currentTarget.querySelector("summary")?.focus())},children:[s.jsxs("summary",{id:`${r}-value`,"aria-labelledby":`${r}-label ${r}-value`,className:`${X} visibility-scope-trigger`,onClick:()=>{b.current?.open||ae()},children:[`${q(n)}${n.kind==="group"?` · ${ee(n.targetCount)}`:n.kind==="property"?` · ${a.find(t=>t.kind==="market"&&t.id===u)?.label??(n.marketKeys?.length?E.allMarkets:"Property")}`:n.kind==="market"?" · Market":""}`,s.jsx(ue,{size:16,"aria-hidden":"true",className:"shrink-0 text-secondary"})]}),s.jsxs("div",{className:"visibility-scope-menu",children:[i||y?s.jsxs("div",{className:"mb-2 border-b border-default pb-2",children:[s.jsx("button",{type:"button",className:D,"aria-label":`Back to ${U?.label??"all groups"}`,onClick:()=>{I(M.slice(0,-1)),N(!1),k(""),v.current?.focus()},children:s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ce,{size:16,"aria-hidden":"true"}),U?.label??"All groups"]})}),s.jsx("p",{className:"px-2 py-1 text-sm font-medium text-heading","aria-live":"polite",children:i?.label??"All properties"})]}):null,s.jsx("input",{ref:v,type:"search","aria-label":"Search scopes",className:X,placeholder:i?"Search within this group":y?"Search properties":"Search groups or properties",value:x,onChange:t=>k(t.target.value)}),s.jsxs("div",{className:"mt-2 max-h-80 overflow-y-auto",children:[p&&i&&!h?P(i,"All properties in this group"):null,z.map(t=>P(t)),i&&!h?Y("Subgroups",K,!0):V(i?"Subgroups":"Groups",K),h?V("Properties",G):Y(i&&K.length>0?"All properties":"Properties",G,!i||K.length===0),V("Markets",W),!i&&!y&&!h&&g.length>0&&_.length>0?s.jsxs("button",{type:"button",className:`${D} mt-2 border-t border-default`,"aria-label":E.browseAll,onClick:()=>{N(!0),v.current?.focus()},children:[s.jsx("span",{children:"All properties"}),s.jsx(J,{size:18,"aria-hidden":"true"})]}):null,h&&K.length+G.length+W.length+z.length===0?s.jsx("p",{className:"py-3 text-sm text-secondary",children:"No matching scopes."}):null]})]})]})]})}function Ke(e){const n=e[0];return n?e.every(l=>l.mode===n.mode&&l.scope.kind===n.scope.kind&&l.scope.key===n.scope.key&&l.queryClass===n.queryClass&&l.measurement.displayedRunId===n.measurement.displayedRunId):!0}function $(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}}function ge(e){return e.kind==="exact"?e.url:e.kind==="prefix"?`https://${e.host}${e.pathPrefix}/*`:`https://${e.host}/*`}function fe(e){return e==="assigned"?"this-property":e==="sibling"?"another-property":e==="ownedUnmapped"?"owned-unassigned":e==="external"?"external":e==="ambiguous"?"multiple-properties":"invalid-url"}function he(e){return e==="assigned"?"positive":e==="external"?"neutral":e==="invalid"?"negative":"caution"}function te(e){return`target:${e.targetKey}:${e.queryId}:${e.executionNodeKey}`}function ye(e,n,l){const u=new Map;if(!n)return u;const f=new Map(e.usageEdges.map(a=>[te(a),a.targetKey])),c=new Map(e.assignments.map(a=>[`${a.targetKey}:${a.queryId}`,a.queryClass])),p=new Map(e.usageEdges.map(a=>[te(a),c.get(`${a.targetKey}:${a.queryId}`)]));for(const a of n.evidence){if(l&&p.get(a.usageEdgeId)!==l)continue;const x=f.get(a.usageEdgeId);if(!x)continue;const k=u.get(x)??[];k.push({id:`${a.observationId}:${a.expectedSlotId}:${a.usageEdgeId}:${a.sourceUrl}`,kind:fe(a.classification),query:a.queryText,provider:a.provider,location:a.location,url:a.sourceUrl,tone:he(a.classification),historical:a.historical||a.bridged}),u.set(x,k)}return u}function be(e){if(e.flags>0)return{label:"Review",tone:"caution"};const n=[e.mentionCoverage,e.citationCoverage].filter(l=>l.state==="unavailable").map(l=>l.reason);return n.includes("no_completed_run")?{label:"Not measured",tone:"neutral"}:n.includes("plan_v1")?{label:"Update setup",tone:"caution"}:n.includes("evidence_incomplete")?{label:"Evidence incomplete",tone:"caution"}:n.includes("no_population")?{label:"No queries",tone:"neutral"}:n.includes("not_applicable")?{label:"Not applicable",tone:"neutral"}:{label:"Complete",tone:"positive"}}function xe(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 ke(e){if(!e)return"";const n=new Date(e);return Number.isFinite(n.getTime())?n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):""}function ne(e){const n=e.nextAction.count??e.flags.total;if(e.nextAction.kind==="review_flags")return`${n} flagged ${n===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 Se({overview:e,activePlan:n,report:l,reportState:u=l?"ready":"loading",sort:f}){if(n.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 c=n.plan,p=new Map(c.targets.map(r=>[r.stableKey,r])),a=new Map(c.querySnapshots.map(r=>[r.queryId,r.queryText])),x=new Map;for(const r of c.assignments){if(e.queryClass!=="all"&&r.queryClass!==e.queryClass)continue;const g=a.get(r.queryId);if(!g)continue;const m=x.get(r.targetKey)??new Set;m.add(g),x.set(r.targetKey,m)}const k=l?.revision===n.revision&&l.run?.id===e.measurement.displayedRunId?l:null,M=e.measurement.displayedRunId===void 0||k?"ready":u==="error"||l!=null?"error":"loading",I=ye(c,k,e.queryClass==="all"?void 0:e.queryClass),y=new Map;for(const r of c.groups)for(const g of r.targetKeys)y.has(g)||y.set(g,r.label);const N=e.properties.items.map(r=>{const g=p.get(r.targetKey),m=I.get(r.targetKey)??[];return{id:r.targetKey,name:r.label,mentionCoverage:$(r.mentionCoverage),citationCoverage:$(r.citationCoverage),status:be(r),providers:r.providers?.map(i=>({provider:i.provider,mentionCoverage:$(i.mentionCoverage),citationCoverage:$(i.citationCoverage)})),market:y.get(r.targetKey),assignedQueries:[...x.get(r.targetKey)??[]],urls:g?.urlMatchers.map(ge)??[],evidence:m,evidenceState:M,historical:m.some(i=>i.historical)}}),b=e.namedShareOfVoice?.entries.map(r=>({name:r.label,coverage:{numerator:r.credits,denominator:e.namedShareOfVoice.denominator}})),v=e.properties.items.flatMap(r=>r.flags>0?[{id:`property:${r.targetKey}`,property:r.label,summary:`${r.flags} ${r.flags===1?"result needs":"results need"} review.`,tone:"caution",count:r.flags}]:[]);return{classReporting:"available",latestMeasurement:{status:xe(e.measurement.state),completedSlots:e.measurement.completed,totalSlots:e.measurement.expected,date:ke(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:$(e.metrics.propertiesMentioned),mentionCoverage:$(e.metrics.mentionCoverage),citationCoverage:$(e.metrics.citationCoverage)},properties:N,...b?{shareOfVoice:b}:{}},propertyTotal:e.properties.totalEstimate??N.length,outcomes:e.outcomes,nextCursor:e.properties.nextCursor,...f?{sort:f}:{}},availableGroups:c.groups.map(r=>({id:r.stableKey,label:r.label})),...ne(e)?{nextActionText:ne(e)}:{},flaggedResultsTotal:e.flags.total,flaggedResults:v}}export{Me as A,E as M,Ie as V,$e as a,Ke as b,Se as c,ge as m};
1
+ import{j as s,r as C}from"./vendor-tanstack-ZXXkndVj.js";import{A as ie,B as oe}from"./index-KCAlcuMN.js";import{M as le}from"./vendor-markdown-B4giJcws.js";import{C as ue,$ as ce,g as J}from"./vendor-lucide-N6vOpZmh.js";const $e="Sources",B={copy:"Copy answer",copying:"Copying…",copied:"Copied",failed:"Could not copy. Select and copy the answer above."};function de({headingLevel:e}){return n=>{const l=[],u=c=>{c.type==="heading"&&c.depth&&l.push(c),c.children?.forEach(u)};u(n);const f=l.reduce((c,p)=>Math.min(c,p.depth),6);for(const c of l){const p=c.depth-f;c.depth=Math.min(6,e+p),c.data={...c.data,hProperties:{...c.data?.hProperties,"data-answer-heading-level":p+1}}}}}function pe({answer:e}){const[n,l]=C.useState("idle"),u=C.useRef(!1),f=async()=>{if(!u.current){u.current=!0,l("copying");try{await navigator.clipboard.writeText(e),l("copied")}catch{l("failed")}finally{u.current=!1}}};return s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-3",children:[s.jsx(oe,{type:"button",variant:"ghost",className:"min-h-11 px-2","aria-disabled":n==="copying","aria-busy":n==="copying",onClick:()=>{f()},children:n==="copying"?B.copying:B.copy}),s.jsx("span",{role:"status",className:"text-sm text-secondary",children:n==="copied"?B.copied:n==="failed"?B.failed:""})]})}function Me({children:e,headingLevel:n=4,copyable:l=!1}){return s.jsxs("div",{className:"answer-markdown",children:[s.jsx(le,{remarkPlugins:[[de,{headingLevel:n}]],components:{p:({children:u})=>s.jsx("p",{className:"mb-3 whitespace-pre-wrap last:mb-0",children:u}),ul:({children:u})=>s.jsx("ul",{className:"mb-3 ml-5 list-disc space-y-1",children:u}),ol:({children:u,start:f})=>s.jsx("ol",{start:f,className:"mb-3 ml-5 list-decimal space-y-1",children:u}),pre:({children:u})=>s.jsx("pre",{className:"mb-3 overflow-x-auto whitespace-pre-wrap",children:u}),a:({children:u,href:f})=>{const c=ie(f);return c?s.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-link underline",children:u}):s.jsx("span",{children:u})},img:({alt:u})=>s.jsx("span",{children:u})},children:e}),l&&e.trim()?s.jsx(pe,{answer:e},e):null]})}const 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",q=e=>e.kind==="project"?"Whole site":e.label,E={allMarkets:"All markets",browse:e=>`Browse ${e}`,select:e=>`Select ${e}`,browseAll:"Browse all properties"},me=e=>e?.kind==="group"&&e.marketKeys?.length===1?e.marketKeys[0]:void 0,ee=e=>`${e} ${e===1?"property":"properties"}`;function Ie({options:e,selected:n,onSelect:l,marketKey:u,label:f="Measurement scope",labelVisibility:c="visible",allowGroupSelect:p=!0}){const a=[...e].sort((t,o)=>t.label.localeCompare(o.label,void 0,{numeric:!0})||t.id.localeCompare(o.id)),[x,k]=C.useState(""),[M,I]=C.useState([]),[y,N]=C.useState(!1),b=C.useRef(null),v=C.useRef(null),r=C.useId(),g=a.filter(t=>t.kind==="group"),m=new Map(g.map(t=>[t.id,t])),i=m.get(M.at(-1)??""),U=m.get(M.at(-2)??""),h=x.trim().toLocaleLowerCase(),re=g.filter(t=>!t.parentGroupIds?.some(o=>m.has(o))),_=a.filter(t=>t.kind==="property"),L=t=>(t.parentGroupIds??[]).map(o=>m.get(o)?.label).filter(Boolean).join(" · "),R=t=>`${q(t)} ${L(t)}`.toLocaleLowerCase().includes(h),F=t=>{const o=[...t.parentGroupIds??[]],d=new Set;for(;o.length;){const j=o.pop();if(j===i?.id)return!0;d.has(j)||(d.add(j),o.push(...m.get(j)?.parentGroupIds??[]))}return!1},K=(y?[]:i?g.filter(t=>h?F(t):t.parentGroupIds?.includes(i.id)):h?g:re).filter(R),S=a.find(t=>t.kind==="market"&&t.id===(u??(n.kind==="market"?n.id:void 0))),H=i&&S&&(i.marketKeys?.includes(S.id)||S.parentGroupIds?.includes(i.id))?S.id:void 0,O=p?H??me(i):void 0,G=(i?_.filter(t=>t.parentGroupIds?.includes(i.id)&&(!O||t.marketKeys?.includes(O))):h||y||g.length===0?_:[]).filter(R),W=a.filter(t=>t.kind!=="market"||y||!p&&!i&&!h&&g.length>0||p&&i?.marketKeys?.length===1&&!h?!1:(i?h?F(t):t.parentGroupIds?.includes(i.id):h||!t.parentGroupIds?.some(d=>m.has(d)))&&R(t)),z=i||y?[]:a.filter(t=>t.kind==="project"&&R(t));C.useEffect(()=>{const t=o=>{b.current?.open&&o.target instanceof Node&&!b.current.contains(o.target)&&(b.current.open=!1)};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[]);const se=t=>{b.current&&(b.current.open=!1,b.current.querySelector("summary")?.focus());const o=p?t.kind==="property"?O:t.kind==="group"&&t.id===i?.id?H:void 0:void 0;o?l(t,o):l(t)},T=t=>{const o=[];let d=m.get(t.parentGroupIds?.[0]??"");for(;d&&!o.includes(d.id)&&d.id!==t.id;)o.unshift(d.id),d=m.get(d.parentGroupIds?.[0]??"");return[...o,t.id]},ae=()=>{const t=n.kind==="group"?m.get(n.id):void 0,o=m.get(S?.parentGroupIds?.[0]??""),d=(n.parentGroupIds??[]).flatMap(A=>{const w=m.get(A);return w?[T(w)]:[]}),j=d.find(A=>A.at(-1)===i?.id)??d.sort((A,w)=>w.length-A.length)[0]??[],Z=o?T(o):n.marketKeys?.length?[]:j;I(t?T(t):Z),N(n.kind==="property"&&Z.length===0&&g.length>0),k("")},Q=t=>{I(T(t)),N(!1),k(""),v.current?.focus()},P=(t,o=q(t))=>s.jsxs("div",{className:"flex items-stretch",children:[s.jsxs("button",{type:"button",className:D,"aria-label":t.kind==="group"&&!p?E.browse(q(t)):E.select(q(t)),"aria-current":n.kind===t.kind&&n.id===t.id?"true":void 0,onClick:()=>t.kind==="group"&&!p?Q(t):se(t),children:[s.jsxs("span",{className:"min-w-0 break-words",children:[o,h&&L(t)?s.jsx("span",{className:"block text-[13px] text-secondary",children:L(t)}):null]}),s.jsx("span",{className:"shrink-0 text-right text-[13px] text-secondary",children:t.kind==="market"?p?"Query context":"Market":t.kind==="property"?"Property":ee(t.targetCount)})]}),p&&t.kind==="group"&&t.id!==i?.id&&a.some(d=>d.parentGroupIds?.includes(t.id))?s.jsx("button",{type:"button","aria-label":E.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:()=>Q(t),children:s.jsx(J,{size:18,"aria-hidden":"true"})}):null]},`${t.kind}:${t.id}`),V=(t,o)=>o.length>0?s.jsxs("section",{"aria-label":t,className:"mt-2",children:[s.jsx("h3",{className:"px-2 py-2 text-[13px] font-medium text-secondary",children:t}),o.map(d=>P(d))]}):null,Y=(t,o,d)=>o.length>0?s.jsxs("details",{open:d,className:"mt-2 border-y border-default",children:[s.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," (",o.length,")"]}),o.map(j=>P(j))]},`${i?.id??"root"}:${t}`):null;return s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{id:`${r}-label`,className:c==="sr-only"?"sr-only":"mb-1 block text-sm font-medium text-heading",children:f}),s.jsxs("details",{ref:b,className:"relative",onToggle:t=>{t.target===t.currentTarget&&t.currentTarget.open&&v.current?.focus()},onKeyDown:t=>{t.key==="Escape"&&(t.preventDefault(),t.currentTarget.open=!1,t.currentTarget.querySelector("summary")?.focus())},children:[s.jsxs("summary",{id:`${r}-value`,"aria-labelledby":`${r}-label ${r}-value`,className:`${X} visibility-scope-trigger`,onClick:()=>{b.current?.open||ae()},children:[`${q(n)}${n.kind==="group"?` · ${ee(n.targetCount)}`:n.kind==="property"?` · ${a.find(t=>t.kind==="market"&&t.id===u)?.label??(n.marketKeys?.length?E.allMarkets:"Property")}`:n.kind==="market"?" · Market":""}`,s.jsx(ue,{size:16,"aria-hidden":"true",className:"shrink-0 text-secondary"})]}),s.jsxs("div",{className:"visibility-scope-menu",children:[i||y?s.jsxs("div",{className:"mb-2 border-b border-default pb-2",children:[s.jsx("button",{type:"button",className:D,"aria-label":`Back to ${U?.label??"all groups"}`,onClick:()=>{I(M.slice(0,-1)),N(!1),k(""),v.current?.focus()},children:s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ce,{size:16,"aria-hidden":"true"}),U?.label??"All groups"]})}),s.jsx("p",{className:"px-2 py-1 text-sm font-medium text-heading","aria-live":"polite",children:i?.label??"All properties"})]}):null,s.jsx("input",{ref:v,type:"search","aria-label":"Search scopes",className:X,placeholder:i?"Search within this group":y?"Search properties":"Search groups or properties",value:x,onChange:t=>k(t.target.value)}),s.jsxs("div",{className:"mt-2 max-h-80 overflow-y-auto",children:[p&&i&&!h?P(i,"All properties in this group"):null,z.map(t=>P(t)),i&&!h?Y("Subgroups",K,!0):V(i?"Subgroups":"Groups",K),h?V("Properties",G):Y(i&&K.length>0?"All properties":"Properties",G,!i||K.length===0),V("Markets",W),!i&&!y&&!h&&g.length>0&&_.length>0?s.jsxs("button",{type:"button",className:`${D} mt-2 border-t border-default`,"aria-label":E.browseAll,onClick:()=>{N(!0),v.current?.focus()},children:[s.jsx("span",{children:"All properties"}),s.jsx(J,{size:18,"aria-hidden":"true"})]}):null,h&&K.length+G.length+W.length+z.length===0?s.jsx("p",{className:"py-3 text-sm text-secondary",children:"No matching scopes."}):null]})]})]})]})}function Ke(e){const n=e[0];return n?e.every(l=>l.mode===n.mode&&l.scope.kind===n.scope.kind&&l.scope.key===n.scope.key&&l.queryClass===n.queryClass&&l.measurement.displayedRunId===n.measurement.displayedRunId):!0}function $(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}}function ge(e){return e.kind==="exact"?e.url:e.kind==="prefix"?`https://${e.host}${e.pathPrefix}/*`:`https://${e.host}/*`}function fe(e){return e==="assigned"?"this-property":e==="sibling"?"another-property":e==="ownedUnmapped"?"owned-unassigned":e==="external"?"external":e==="ambiguous"?"multiple-properties":"invalid-url"}function he(e){return e==="assigned"?"positive":e==="external"?"neutral":e==="invalid"?"negative":"caution"}function te(e){return`target:${e.targetKey}:${e.queryId}:${e.executionNodeKey}`}function ye(e,n,l){const u=new Map;if(!n)return u;const f=new Map(e.usageEdges.map(a=>[te(a),a.targetKey])),c=new Map(e.assignments.map(a=>[`${a.targetKey}:${a.queryId}`,a.queryClass])),p=new Map(e.usageEdges.map(a=>[te(a),c.get(`${a.targetKey}:${a.queryId}`)]));for(const a of n.evidence){if(l&&p.get(a.usageEdgeId)!==l)continue;const x=f.get(a.usageEdgeId);if(!x)continue;const k=u.get(x)??[];k.push({id:`${a.observationId}:${a.expectedSlotId}:${a.usageEdgeId}:${a.sourceUrl}`,kind:fe(a.classification),query:a.queryText,provider:a.provider,location:a.location,url:a.sourceUrl,tone:he(a.classification),historical:a.historical||a.bridged}),u.set(x,k)}return u}function be(e){if(e.flags>0)return{label:"Review",tone:"caution"};const n=[e.mentionCoverage,e.citationCoverage].filter(l=>l.state==="unavailable").map(l=>l.reason);return n.includes("no_completed_run")?{label:"Not measured",tone:"neutral"}:n.includes("plan_v1")?{label:"Update setup",tone:"caution"}:n.includes("evidence_incomplete")?{label:"Evidence incomplete",tone:"caution"}:n.includes("no_population")?{label:"No queries",tone:"neutral"}:n.includes("not_applicable")?{label:"Not applicable",tone:"neutral"}:{label:"Complete",tone:"positive"}}function xe(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 ke(e){if(!e)return"";const n=new Date(e);return Number.isFinite(n.getTime())?n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):""}function ne(e){const n=e.nextAction.count??e.flags.total;if(e.nextAction.kind==="review_flags")return`${n} flagged ${n===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 Se({overview:e,activePlan:n,report:l,reportState:u=l?"ready":"loading",sort:f}){if(n.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 c=n.plan,p=new Map(c.targets.map(r=>[r.stableKey,r])),a=new Map(c.querySnapshots.map(r=>[r.queryId,r.queryText])),x=new Map;for(const r of c.assignments){if(e.queryClass!=="all"&&r.queryClass!==e.queryClass)continue;const g=a.get(r.queryId);if(!g)continue;const m=x.get(r.targetKey)??new Set;m.add(g),x.set(r.targetKey,m)}const k=l?.revision===n.revision&&l.run?.id===e.measurement.displayedRunId?l:null,M=e.measurement.displayedRunId===void 0||k?"ready":u==="error"||l!=null?"error":"loading",I=ye(c,k,e.queryClass==="all"?void 0:e.queryClass),y=new Map;for(const r of c.groups)for(const g of r.targetKeys)y.has(g)||y.set(g,r.label);const N=e.properties.items.map(r=>{const g=p.get(r.targetKey),m=I.get(r.targetKey)??[];return{id:r.targetKey,name:r.label,mentionCoverage:$(r.mentionCoverage),citationCoverage:$(r.citationCoverage),status:be(r),providers:r.providers?.map(i=>({provider:i.provider,mentionCoverage:$(i.mentionCoverage),citationCoverage:$(i.citationCoverage)})),market:y.get(r.targetKey),assignedQueries:[...x.get(r.targetKey)??[]],urls:g?.urlMatchers.map(ge)??[],evidence:m,evidenceState:M,historical:m.some(i=>i.historical)}}),b=e.namedShareOfVoice?.entries.map(r=>({name:r.label,coverage:{numerator:r.credits,denominator:e.namedShareOfVoice.denominator}})),v=e.properties.items.flatMap(r=>r.flags>0?[{id:`property:${r.targetKey}`,property:r.label,summary:`${r.flags} ${r.flags===1?"result needs":"results need"} review.`,tone:"caution",count:r.flags}]:[]);return{classReporting:"available",latestMeasurement:{status:xe(e.measurement.state),completedSlots:e.measurement.completed,totalSlots:e.measurement.expected,date:ke(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:$(e.metrics.propertiesMentioned),mentionCoverage:$(e.metrics.mentionCoverage),citationCoverage:$(e.metrics.citationCoverage)},properties:N,...b?{shareOfVoice:b}:{}},propertyTotal:e.properties.totalEstimate??N.length,outcomes:e.outcomes,nextCursor:e.properties.nextCursor,...f?{sort:f}:{}},availableGroups:c.groups.map(r=>({id:r.stableKey,label:r.label})),...ne(e)?{nextActionText:ne(e)}:{},flaggedResultsTotal:e.flags.total,flaggedResults:v}}export{Me as A,E as M,Ie as V,$e as a,Ke as b,Se as c,ge 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-CCIeAE4J.js"></script>
15
+ <script type="module" crossorigin src="./assets/index-KCAlcuMN.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">
@@ -784,7 +784,7 @@ import {
784
784
  wordpressSchemaDeployResultDtoSchema,
785
785
  wordpressSchemaStatusResultDtoSchema,
786
786
  wordpressStatusDtoSchema
787
- } from "./chunk-45EGDRVF.js";
787
+ } from "./chunk-L36TC6LB.js";
788
788
 
789
789
  // src/intelligence-service.ts
790
790
  import { eq as eq71, desc as desc32, asc as asc12, and as and60, ne as ne11, or as or18, inArray as inArray27, gte as gte18, lte as lte15, isNull as isNull13, sql as sql28, exists } from "drizzle-orm";
@@ -3297,6 +3297,7 @@ var adsCampaigns = sqliteTable("ads_campaigns", {
3297
3297
  lifetimeSpendLimitMicros: integer("lifetime_spend_limit_micros"),
3298
3298
  conversionEventSettingIds: text("conversion_event_setting_ids", { mode: "json" }).$type().notNull().default([]),
3299
3299
  targeting: text("targeting", { mode: "json" }).$type(),
3300
+ landingPageQueryStringTemplate: text("landing_page_query_string_template"),
3300
3301
  upstreamCreatedAt: integer("upstream_created_at"),
3301
3302
  upstreamUpdatedAt: integer("upstream_updated_at"),
3302
3303
  syncRunId: text("sync_run_id").references(() => runs.id, { onDelete: "set null" }),
@@ -3314,6 +3315,7 @@ var adsAdGroups = sqliteTable("ads_ad_groups", {
3314
3315
  billingEventType: text("billing_event_type"),
3315
3316
  maxBidMicros: integer("max_bid_micros"),
3316
3317
  contextHints: text("context_hints", { mode: "json" }).$type().notNull().default([]),
3318
+ landingPageQueryStringTemplate: text("landing_page_query_string_template"),
3317
3319
  upstreamCreatedAt: integer("upstream_created_at"),
3318
3320
  upstreamUpdatedAt: integer("upstream_updated_at"),
3319
3321
  syncRunId: text("sync_run_id").references(() => runs.id, { onDelete: "set null" }),
@@ -3330,6 +3332,7 @@ var adsAds = sqliteTable("ads_ads", {
3330
3332
  status: text("status").notNull(),
3331
3333
  creative: text("creative", { mode: "json" }).$type(),
3332
3334
  reviewStatus: text("review_status"),
3335
+ landingPageQueryStringTemplate: text("landing_page_query_string_template"),
3333
3336
  upstreamCreatedAt: integer("upstream_created_at"),
3334
3337
  upstreamUpdatedAt: integer("upstream_updated_at"),
3335
3338
  syncRunId: text("sync_run_id").references(() => runs.id, { onDelete: "set null" }),
@@ -7516,6 +7519,19 @@ var MIGRATION_VERSIONS = [
7516
7519
  `CREATE INDEX IF NOT EXISTS idx_run_fills_run ON run_fills(run_id, created_at)`,
7517
7520
  `CREATE INDEX IF NOT EXISTS idx_run_fills_project_status ON run_fills(project_id, status)`
7518
7521
  ]
7522
+ },
7523
+ {
7524
+ // Ad URL tracking parameters (`landing_page_configuration.
7525
+ // query_string_template` upstream): the provider appends them to every
7526
+ // click URL under the entity. Stored per level because campaign, ad group,
7527
+ // and ad each carry their own, and upstream combines them.
7528
+ version: 161,
7529
+ name: "ads-landing-page-tracking-template",
7530
+ statements: [
7531
+ `ALTER TABLE ads_campaigns ADD COLUMN landing_page_query_string_template TEXT`,
7532
+ `ALTER TABLE ads_ad_groups ADD COLUMN landing_page_query_string_template TEXT`,
7533
+ `ALTER TABLE ads_ads ADD COLUMN landing_page_query_string_template TEXT`
7534
+ ]
7519
7535
  }
7520
7536
  ];
7521
7537
  function addRunsMeasurementPlanVersionForeignKey(tx) {
@@ -40584,7 +40600,8 @@ var routeCatalog = [
40584
40600
  uniqueItems: true,
40585
40601
  items: stringSchema,
40586
40602
  description: "Optional conversion events to optimize delivery toward. Independent of biddingType: a clicks campaign may omit these."
40587
- }
40603
+ },
40604
+ landingPageQueryStringTemplate: { type: "string", minLength: 1, maxLength: 1e3, description: "Tracking parameters appended to click URLs under this entity, as a bare query string (utm_source=chatgpt&utm_medium=cpc). Supports the {campaign_id}, {ad_group_id}, {ad_id}, {ad_account_id} and {oppref} macros. Levels combine; on a duplicate key the destination URL wins, then ad, ad group, campaign." }
40588
40605
  }
40589
40606
  } } }
40590
40607
  },
@@ -40616,7 +40633,8 @@ var routeCatalog = [
40616
40633
  description: stringSchema,
40617
40634
  contextHints: { type: "array", minItems: 1, maxItems: 100, items: stringSchema },
40618
40635
  maxBidMicros: { type: "integer", minimum: 1, maximum: 1e8 },
40619
- billingEventType: { type: "string", enum: Object.values(AdsAdGroupBillingEventTypes) }
40636
+ billingEventType: { type: "string", enum: Object.values(AdsAdGroupBillingEventTypes) },
40637
+ landingPageQueryStringTemplate: { type: "string", minLength: 1, maxLength: 1e3, description: "Tracking parameters appended to click URLs under this entity, as a bare query string (utm_source=chatgpt&utm_medium=cpc). Supports the {campaign_id}, {ad_group_id}, {ad_id}, {ad_account_id} and {oppref} macros. Levels combine; on a duplicate key the destination URL wins, then ad, ad group, campaign." }
40620
40638
  }
40621
40639
  } } }
40622
40640
  },
@@ -40645,7 +40663,8 @@ var routeCatalog = [
40645
40663
  operationKey: adsOperationKeySchema,
40646
40664
  adGroupId: stringSchema,
40647
40665
  name: { type: "string", minLength: 3, maxLength: 1e3 },
40648
- creative: adsCreativeRequestSchema
40666
+ creative: adsCreativeRequestSchema,
40667
+ landingPageQueryStringTemplate: { type: "string", minLength: 1, maxLength: 1e3, description: "Tracking parameters appended to click URLs under this entity, as a bare query string (utm_source=chatgpt&utm_medium=cpc). Supports the {campaign_id}, {ad_group_id}, {ad_id}, {ad_account_id} and {oppref} macros. Levels combine; on a duplicate key the destination URL wins, then ad, ad group, campaign." }
40649
40668
  }
40650
40669
  } } }
40651
40670
  },
@@ -40678,7 +40697,8 @@ var routeCatalog = [
40678
40697
  startTime: { type: "integer", nullable: true },
40679
40698
  endTime: { type: "integer", nullable: true },
40680
40699
  lifetimeSpendLimitMicros: { type: "integer", minimum: 1e6 },
40681
- locationIds: { type: "array", minItems: 1, maxItems: 100, items: stringSchema }
40700
+ locationIds: { type: "array", minItems: 1, maxItems: 100, items: stringSchema },
40701
+ landingPageQueryStringTemplate: { type: "string", minLength: 1, maxLength: 1e3, nullable: true, description: "Tracking parameters appended to click URLs under this entity, as a bare query string. Null clears them." }
40682
40702
  }
40683
40703
  } } }
40684
40704
  },
@@ -40709,7 +40729,8 @@ var routeCatalog = [
40709
40729
  name: { type: "string", minLength: 3, maxLength: 1e3 },
40710
40730
  description: { type: "string", nullable: true },
40711
40731
  contextHints: { type: "array", minItems: 1, maxItems: 100, items: stringSchema },
40712
- maxBidMicros: { type: "integer", minimum: 1, maximum: 1e8 }
40732
+ maxBidMicros: { type: "integer", minimum: 1, maximum: 1e8 },
40733
+ landingPageQueryStringTemplate: { type: "string", minLength: 1, maxLength: 1e3, nullable: true, description: "Tracking parameters appended to click URLs under this entity, as a bare query string. Null clears them." }
40713
40734
  }
40714
40735
  } } }
40715
40736
  },
@@ -40738,7 +40759,8 @@ var routeCatalog = [
40738
40759
  operationKey: adsOperationKeySchema,
40739
40760
  expectedUpdatedAt: integerSchema,
40740
40761
  name: { type: "string", minLength: 3, maxLength: 1e3 },
40741
- creative: adsCreativeRequestSchema
40762
+ creative: adsCreativeRequestSchema,
40763
+ landingPageQueryStringTemplate: { type: "string", minLength: 1, maxLength: 1e3, nullable: true, description: "Tracking parameters appended to click URLs under this entity, as a bare query string. Null clears them." }
40742
40764
  }
40743
40765
  } } }
40744
40766
  },
@@ -52445,7 +52467,8 @@ function campaignCreateReconcileFields(input) {
52445
52467
  lifetimeSpendLimitMicros: input.lifetimeSpendLimitMicros,
52446
52468
  locationIds: normalizeStringSet(input.locationIds),
52447
52469
  biddingType: input.biddingType,
52448
- conversionEventSettingIds: normalizeStringSet(input.conversionEventSettingIds ?? [])
52470
+ conversionEventSettingIds: normalizeStringSet(input.conversionEventSettingIds ?? []),
52471
+ ...input.landingPageQueryStringTemplate === void 0 ? {} : { landingPageQueryStringTemplate: input.landingPageQueryStringTemplate }
52449
52472
  };
52450
52473
  }
52451
52474
  function adGroupCreateReconcileFields(input) {
@@ -52456,7 +52479,8 @@ function adGroupCreateReconcileFields(input) {
52456
52479
  status: AdsEntityStatuses.paused,
52457
52480
  contextHints: normalizeStringSet(input.contextHints),
52458
52481
  maxBidMicros: input.maxBidMicros,
52459
- billingEventType: input.billingEventType
52482
+ billingEventType: input.billingEventType,
52483
+ ...input.landingPageQueryStringTemplate === void 0 ? {} : { landingPageQueryStringTemplate: input.landingPageQueryStringTemplate }
52460
52484
  };
52461
52485
  }
52462
52486
  function adCreateReconcileFields(input) {
@@ -52464,7 +52488,8 @@ function adCreateReconcileFields(input) {
52464
52488
  adGroupId: input.adGroupId,
52465
52489
  name: normalizeString(input.name),
52466
52490
  status: AdsEntityStatuses.paused,
52467
- creativeFingerprint: creativeFingerprint(input.creative)
52491
+ creativeFingerprint: creativeFingerprint(input.creative),
52492
+ ...input.landingPageQueryStringTemplate === void 0 ? {} : { landingPageQueryStringTemplate: input.landingPageQueryStringTemplate }
52468
52493
  };
52469
52494
  }
52470
52495
  function updateReconcileFields(entityType, update) {
@@ -52472,6 +52497,10 @@ function updateReconcileFields(entityType, update) {
52472
52497
  if (typeof update.name === "string") fields.name = normalizeString(update.name);
52473
52498
  if (update.description === null) fields.description = null;
52474
52499
  else if (typeof update.description === "string") fields.description = normalizeString(update.description);
52500
+ if (update.landingPageQueryStringTemplate === null) fields.landingPageQueryStringTemplate = null;
52501
+ else if (typeof update.landingPageQueryStringTemplate === "string") {
52502
+ fields.landingPageQueryStringTemplate = update.landingPageQueryStringTemplate;
52503
+ }
52475
52504
  if (entityType === AdsEntityTypes.campaign) {
52476
52505
  if (update.startTime === null || typeof update.startTime === "number") fields.startTime = update.startTime;
52477
52506
  if (update.endTime === null || typeof update.endTime === "number") fields.endTime = update.endTime;
@@ -52513,6 +52542,10 @@ function entityReconcileFields(entity) {
52513
52542
  } else if (Array.isArray(entity.conversionEventSettingIds)) {
52514
52543
  fields.conversionEventSettingIds = normalizeStringSet(entity.conversionEventSettingIds);
52515
52544
  }
52545
+ if (entity.landingPageQueryStringTemplate === null) fields.landingPageQueryStringTemplate = null;
52546
+ else if (typeof entity.landingPageQueryStringTemplate === "string") {
52547
+ fields.landingPageQueryStringTemplate = entity.landingPageQueryStringTemplate;
52548
+ }
52516
52549
  if (typeof entity.campaignId === "string") fields.campaignId = entity.campaignId;
52517
52550
  if (Array.isArray(entity.contextHints)) fields.contextHints = normalizeStringSet(entity.contextHints);
52518
52551
  if (typeof entity.maxBidMicros === "number") fields.maxBidMicros = entity.maxBidMicros;
@@ -54056,6 +54089,7 @@ async function adsRoutes(app, opts) {
54056
54089
  status: ad.status,
54057
54090
  reviewStatus: ad.reviewStatus,
54058
54091
  creative: creativeDto(ad.creative),
54092
+ landingPageQueryStringTemplate: ad.landingPageQueryStringTemplate,
54059
54093
  upstreamUpdatedAt: ad.upstreamUpdatedAt,
54060
54094
  syncedAt: ad.syncedAt
54061
54095
  };
@@ -54075,6 +54109,7 @@ async function adsRoutes(app, opts) {
54075
54109
  maxBidMicros: group.maxBidMicros,
54076
54110
  contextHints: group.contextHints,
54077
54111
  ads: adsByGroup.get(group.id) ?? [],
54112
+ landingPageQueryStringTemplate: group.landingPageQueryStringTemplate,
54078
54113
  upstreamUpdatedAt: group.upstreamUpdatedAt,
54079
54114
  syncedAt: group.syncedAt
54080
54115
  };
@@ -54095,6 +54130,7 @@ async function adsRoutes(app, opts) {
54095
54130
  lifetimeSpendLimitMicros: campaign.lifetimeSpendLimitMicros,
54096
54131
  locationIds: locationIdsDto(campaign.targeting),
54097
54132
  adGroups: groupsByCampaign.get(campaign.id) ?? [],
54133
+ landingPageQueryStringTemplate: campaign.landingPageQueryStringTemplate,
54098
54134
  upstreamUpdatedAt: campaign.upstreamUpdatedAt,
54099
54135
  syncedAt: campaign.syncedAt
54100
54136
  }));
@@ -85600,48 +85636,79 @@ function utcDayBounds(now) {
85600
85636
  // ../api-routes/src/plan-competitors.ts
85601
85637
  import { eq as eq69 } from "drizzle-orm";
85602
85638
  function competitorKey(value) {
85603
- const host = hostOf(value) ?? value.trim().toLowerCase();
85604
- return registrableDomain(host) ?? host;
85639
+ const host = (hostOf(value) ?? value).trim().toLowerCase().replace(/\.$/, "");
85640
+ return host.startsWith("www.") ? host.slice(4) : host;
85641
+ }
85642
+ function merge(into, domain, names) {
85643
+ const key = competitorKey(domain);
85644
+ if (!key) return;
85645
+ const set = into.get(key) ?? /* @__PURE__ */ new Set();
85646
+ for (const name of names) if (name.trim()) set.add(name.trim());
85647
+ into.set(key, set);
85605
85648
  }
85606
- function measurementPlanCompetitors(db, versionId) {
85607
- if (!versionId) return [];
85649
+ function toList(merged) {
85650
+ return [...merged].sort(([left], [right]) => left.localeCompare(right)).map(([domain, names]) => ({ domain, aliases: [...names] }));
85651
+ }
85652
+ function readScope(db, versionId) {
85608
85653
  const row = db.select({ canonicalJson: measurementPlanVersions.canonicalJson }).from(measurementPlanVersions).where(eq69(measurementPlanVersions.id, versionId)).get();
85609
- if (!row) return [];
85610
- let raw;
85654
+ if (!row) return null;
85655
+ let groups;
85656
+ let edges;
85611
85657
  try {
85612
85658
  const plan = parseStoredMeasurementPlanAnyVersion(row.canonicalJson);
85613
- raw = plan.schemaVersion === MEASUREMENT_PLAN_V2_SCHEMA_VERSION ? plan.groups.flatMap((group) => group.competitors.map((competitor) => ({ domain: competitor.domain, names: [competitor.label, ...competitor.aliases] }))) : plan.groups.flatMap((group) => (group.competitors ?? []).map((domain) => ({ domain, names: [] })));
85659
+ if (plan.schemaVersion === MEASUREMENT_PLAN_V2_SCHEMA_VERSION) {
85660
+ groups = plan.groups.map((group) => ({
85661
+ targetKeys: group.targetKeys,
85662
+ competitors: group.competitors.map((competitor) => ({ domain: competitor.domain, names: [competitor.label, ...competitor.aliases] }))
85663
+ }));
85664
+ edges = plan.usageEdges;
85665
+ } else {
85666
+ groups = plan.groups.map((group) => ({
85667
+ targetKeys: group.targetKeys,
85668
+ competitors: (group.competitors ?? []).map((domain) => ({ domain, names: [] }))
85669
+ }));
85670
+ edges = plan.usageEdges.flatMap((edge) => edge.kind === "target" ? [edge] : []);
85671
+ }
85614
85672
  } catch {
85615
- return [];
85673
+ return null;
85616
85674
  }
85617
- const merged = /* @__PURE__ */ new Map();
85618
- for (const { domain, names } of raw) {
85619
- const key = competitorKey(domain);
85620
- if (!key) continue;
85621
- const set = merged.get(key) ?? /* @__PURE__ */ new Set();
85622
- for (const name of names) if (name.trim()) set.add(name.trim());
85623
- merged.set(key, set);
85675
+ const all = /* @__PURE__ */ new Map();
85676
+ const groupsByTarget = /* @__PURE__ */ new Map();
85677
+ groups.forEach((group, index2) => {
85678
+ for (const competitor of group.competitors) merge(all, competitor.domain, competitor.names);
85679
+ for (const target of group.targetKeys) groupsByTarget.set(target, [...groupsByTarget.get(target) ?? [], index2]);
85680
+ });
85681
+ const nodeGroups = /* @__PURE__ */ new Map();
85682
+ for (const edge of edges) {
85683
+ const set = nodeGroups.get(edge.executionNodeKey) ?? /* @__PURE__ */ new Set();
85684
+ for (const index2 of groupsByTarget.get(edge.targetKey) ?? []) set.add(index2);
85685
+ nodeGroups.set(edge.executionNodeKey, set);
85624
85686
  }
85625
- return [...merged].sort(([left], [right]) => left.localeCompare(right)).map(([domain, names]) => ({ domain, aliases: [...names] }));
85687
+ const byNode = /* @__PURE__ */ new Map();
85688
+ for (const [node, indexes] of nodeGroups) {
85689
+ const merged = /* @__PURE__ */ new Map();
85690
+ for (const index2 of indexes) for (const competitor of groups[index2].competitors) merge(merged, competitor.domain, competitor.names);
85691
+ byNode.set(node, toList(merged));
85692
+ }
85693
+ return { all: toList(all), byNode };
85626
85694
  }
85627
85695
  function createRunCompetitorResolver(db, projectCompetitorDomains) {
85628
- const byVersion = /* @__PURE__ */ new Map();
85696
+ const scopes = /* @__PURE__ */ new Map();
85629
85697
  const listOnly = () => ({ domains: [...new Set(projectCompetitorDomains)], aliases: /* @__PURE__ */ new Map() });
85630
- return (versionId) => {
85631
- if (!versionId) return listOnly();
85632
- const cached = byVersion.get(versionId);
85633
- if (cached) return cached;
85634
- const domains = /* @__PURE__ */ new Map();
85635
- for (const domain of projectCompetitorDomains) domains.set(competitorKey(domain), domain);
85698
+ return (versionId, executionId) => {
85699
+ if (!versionId || !executionId) return listOnly();
85700
+ if (!scopes.has(versionId)) scopes.set(versionId, readScope(db, versionId));
85701
+ const pinned = scopes.get(versionId)?.byNode.get(executionId) ?? [];
85702
+ if (pinned.length === 0) return listOnly();
85703
+ const byKey = /* @__PURE__ */ new Map();
85704
+ for (const domain of projectCompetitorDomains) if (!byKey.has(competitorKey(domain))) byKey.set(competitorKey(domain), domain);
85636
85705
  const aliases = /* @__PURE__ */ new Map();
85637
- for (const competitor of measurementPlanCompetitors(db, versionId)) {
85638
- const domain = domains.get(competitor.domain) ?? competitor.domain;
85639
- domains.set(competitor.domain, domain);
85706
+ for (const competitor of pinned) {
85707
+ const domain = byKey.get(competitor.domain) ?? competitor.domain;
85708
+ byKey.set(competitor.domain, domain);
85640
85709
  if (competitor.aliases.length) aliases.set(domain, competitor.aliases);
85641
85710
  }
85642
- const resolved = { domains: [...new Set(domains.values())], aliases };
85643
- byVersion.set(versionId, resolved);
85644
- return resolved;
85711
+ return { domains: [.../* @__PURE__ */ new Set([...projectCompetitorDomains, ...byKey.values()])], aliases };
85645
85712
  };
85646
85713
  }
85647
85714
 
@@ -5,12 +5,12 @@ import {
5
5
  siteCrawlGraphNodes,
6
6
  siteCrawlPages,
7
7
  siteCrawlSnapshots
8
- } from "./chunk-RGMUT5KY.js";
8
+ } from "./chunk-3YAPVVFN.js";
9
9
  import {
10
10
  SITE_CRAWL_GRAPH_MAX_EDGES,
11
11
  SITE_CRAWL_GRAPH_MAX_NODES,
12
12
  TEMPLATE_LINK_RATIO_THRESHOLD
13
- } from "./chunk-45EGDRVF.js";
13
+ } from "./chunk-L36TC6LB.js";
14
14
 
15
15
  // src/site-crawl-graph-layout.ts
16
16
  import crypto from "crypto";
@@ -4,14 +4,14 @@ import {
4
4
  installSkills,
5
5
  loadConfigRaw,
6
6
  saveConfigPatch
7
- } from "./chunk-2W6GCJ3O.js";
7
+ } from "./chunk-ZGZSROSR.js";
8
8
  import {
9
9
  PACKAGE_VERSION
10
10
  } from "./chunk-AOJU5LKX.js";
11
11
  import {
12
12
  SKILL_MANIFEST_FILENAME,
13
13
  SkillsClients
14
- } from "./chunk-45EGDRVF.js";
14
+ } from "./chunk-L36TC6LB.js";
15
15
 
16
16
  // src/skills-autosync.ts
17
17
  import fs from "fs";
@@ -17034,6 +17034,42 @@ var adsSyncResponseSchema = z59.object({
17034
17034
  runId: z59.string(),
17035
17035
  status: z59.string()
17036
17036
  });
17037
+ var ADS_QUERY_STRING_TEMPLATE_MACROS = [
17038
+ "campaign_id",
17039
+ "ad_group_id",
17040
+ "ad_id",
17041
+ "ad_account_id",
17042
+ "oppref"
17043
+ ];
17044
+ var ADS_QUERY_STRING_PAIR = /^[\w.-]+=[^&#\s]*$/;
17045
+ var ADS_QUERY_STRING_MACRO = /\{([^}]*)\}/g;
17046
+ var adsQueryStringTemplateSchema = z59.string().min(1).max(1e3).superRefine((value, ctx) => {
17047
+ const fail = (message) => ctx.addIssue({ code: "custom", message });
17048
+ if (value.startsWith("?") || value.startsWith("&")) {
17049
+ fail("Tracking template must not start with ? or &");
17050
+ return;
17051
+ }
17052
+ const seen = /* @__PURE__ */ new Set();
17053
+ for (const pair of value.split("&")) {
17054
+ if (!ADS_QUERY_STRING_PAIR.test(pair)) {
17055
+ fail(`Tracking template pair '${pair}' must be key=value without whitespace, # or &`);
17056
+ return;
17057
+ }
17058
+ const key = pair.slice(0, pair.indexOf("="));
17059
+ if (seen.has(key)) {
17060
+ fail(`Tracking template repeats the parameter '${key}'`);
17061
+ return;
17062
+ }
17063
+ seen.add(key);
17064
+ }
17065
+ for (const match of value.matchAll(ADS_QUERY_STRING_MACRO)) {
17066
+ const macro = match[1];
17067
+ if (!ADS_QUERY_STRING_TEMPLATE_MACROS.includes(macro)) {
17068
+ fail(`Tracking template macro '{${macro}}' is not supported`);
17069
+ return;
17070
+ }
17071
+ }
17072
+ });
17037
17073
  var adsCreativeDtoSchema = z59.object({
17038
17074
  type: z59.string().nullable().optional(),
17039
17075
  title: z59.string().nullable().optional(),
@@ -17052,6 +17088,8 @@ var adsAdDtoSchema = z59.object({
17052
17088
  status: z59.string(),
17053
17089
  reviewStatus: z59.string().nullable().optional(),
17054
17090
  creative: adsCreativeDtoSchema.nullable().optional(),
17091
+ /** Provider tracking parameters appended to this entity's click URLs. */
17092
+ landingPageQueryStringTemplate: z59.string().nullable().optional(),
17055
17093
  upstreamUpdatedAt: z59.number().int().nullable().optional(),
17056
17094
  syncedAt: z59.string().optional()
17057
17095
  });
@@ -17069,6 +17107,8 @@ var adsAdGroupDtoSchema = z59.object({
17069
17107
  */
17070
17108
  contextHints: z59.array(z59.string()).default([]),
17071
17109
  ads: z59.array(adsAdDtoSchema).default([]),
17110
+ /** Provider tracking parameters appended to this entity's click URLs. */
17111
+ landingPageQueryStringTemplate: z59.string().nullable().optional(),
17072
17112
  upstreamUpdatedAt: z59.number().int().nullable().optional(),
17073
17113
  syncedAt: z59.string().optional()
17074
17114
  });
@@ -17085,6 +17125,8 @@ var adsCampaignDtoSchema = z59.object({
17085
17125
  conversionEventSettingIds: z59.array(z59.string()).default([]),
17086
17126
  locationIds: z59.array(z59.string()).optional(),
17087
17127
  adGroups: z59.array(adsAdGroupDtoSchema).default([]),
17128
+ /** Provider tracking parameters appended to this entity's click URLs. */
17129
+ landingPageQueryStringTemplate: z59.string().nullable().optional(),
17088
17130
  upstreamUpdatedAt: z59.number().int().nullable().optional(),
17089
17131
  syncedAt: z59.string().optional()
17090
17132
  });
@@ -17395,7 +17437,8 @@ var adsReconcileFieldsSchema = z59.object({
17395
17437
  maxBidMicros: adsMicrosSchema.max(1e8).optional(),
17396
17438
  billingEventType: adsAdGroupBillingEventTypeSchema.optional(),
17397
17439
  adGroupId: adsEntityIdSchema.optional(),
17398
- creativeFingerprint: adsSha256Schema.optional()
17440
+ creativeFingerprint: adsSha256Schema.optional(),
17441
+ landingPageQueryStringTemplate: adsQueryStringTemplateSchema.nullable().optional()
17399
17442
  }).strict();
17400
17443
  var adsImageUploadRequestSchema = z59.object({
17401
17444
  operationKey: adsOperationKeySchema,
@@ -17415,7 +17458,9 @@ var adsCampaignCreateRequestSchema = z59.object({
17415
17458
  // and the provider accepts a clicks campaign carrying no conversion event
17416
17459
  // settings, so neither field is conditioned on the other here.
17417
17460
  biddingType: adsCampaignBiddingTypeSchema.optional(),
17418
- conversionEventSettingIds: adsConversionEventSettingIdsSchema.optional()
17461
+ conversionEventSettingIds: adsConversionEventSettingIdsSchema.optional(),
17462
+ /** Optional tracking parameters applied to click URLs under this entity. */
17463
+ landingPageQueryStringTemplate: adsQueryStringTemplateSchema.optional()
17419
17464
  }).superRefine((value, ctx) => {
17420
17465
  if (value.startTime !== void 0 && value.endTime !== void 0 && value.endTime <= value.startTime) {
17421
17466
  ctx.addIssue({ code: "custom", path: ["endTime"], message: "endTime must be after startTime" });
@@ -17428,7 +17473,9 @@ var adsAdGroupCreateRequestSchema = z59.object({
17428
17473
  description: z59.string().max(4e3).optional(),
17429
17474
  contextHints: z59.array(z59.string().min(1).max(1e3)).min(1).max(100),
17430
17475
  maxBidMicros: adsMicrosSchema.max(1e8),
17431
- billingEventType: adsAdGroupBillingEventTypeSchema.optional()
17476
+ billingEventType: adsAdGroupBillingEventTypeSchema.optional(),
17477
+ /** Optional tracking parameters applied to click URLs under this entity. */
17478
+ landingPageQueryStringTemplate: adsQueryStringTemplateSchema.optional()
17432
17479
  });
17433
17480
  var adsChatCardCreativeRequestSchema = z59.object({
17434
17481
  title: z59.string().min(3).max(50),
@@ -17440,7 +17487,9 @@ var adsAdCreateRequestSchema = z59.object({
17440
17487
  operationKey: adsOperationKeySchema,
17441
17488
  adGroupId: adsEntityIdSchema,
17442
17489
  name: adsNameSchema,
17443
- creative: adsChatCardCreativeRequestSchema
17490
+ creative: adsChatCardCreativeRequestSchema,
17491
+ /** Optional tracking parameters applied to click URLs under this entity. */
17492
+ landingPageQueryStringTemplate: adsQueryStringTemplateSchema.optional()
17444
17493
  });
17445
17494
  function hasMutationField(value) {
17446
17495
  return Object.keys(value).some((key) => key !== "operationKey" && key !== "expectedUpdatedAt");
@@ -17453,7 +17502,9 @@ var adsCampaignUpdateRequestSchema = z59.object({
17453
17502
  startTime: adsTimestampSchema.nullable().optional(),
17454
17503
  endTime: adsTimestampSchema.nullable().optional(),
17455
17504
  lifetimeSpendLimitMicros: adsMicrosSchema.min(1e6).optional(),
17456
- locationIds: z59.array(adsEntityIdSchema).min(1).max(100).optional()
17505
+ locationIds: z59.array(adsEntityIdSchema).min(1).max(100).optional(),
17506
+ /** Tracking parameters for this entity's click URLs; null clears them. */
17507
+ landingPageQueryStringTemplate: adsQueryStringTemplateSchema.nullable().optional()
17457
17508
  }).refine(hasMutationField, { message: "At least one campaign field must be updated" });
17458
17509
  var adsAdGroupUpdateRequestSchema = z59.object({
17459
17510
  operationKey: adsOperationKeySchema,
@@ -17461,13 +17512,17 @@ var adsAdGroupUpdateRequestSchema = z59.object({
17461
17512
  name: adsNameSchema.optional(),
17462
17513
  description: z59.string().max(4e3).nullable().optional(),
17463
17514
  contextHints: z59.array(z59.string().min(1).max(1e3)).min(1).max(100).optional(),
17464
- maxBidMicros: adsMicrosSchema.max(1e8).optional()
17515
+ maxBidMicros: adsMicrosSchema.max(1e8).optional(),
17516
+ /** Tracking parameters for this entity's click URLs; null clears them. */
17517
+ landingPageQueryStringTemplate: adsQueryStringTemplateSchema.nullable().optional()
17465
17518
  }).refine(hasMutationField, { message: "At least one ad group field must be updated" });
17466
17519
  var adsAdUpdateRequestSchema = z59.object({
17467
17520
  operationKey: adsOperationKeySchema,
17468
17521
  expectedUpdatedAt: z59.number().int().nonnegative(),
17469
17522
  name: adsNameSchema.optional(),
17470
- creative: adsChatCardCreativeRequestSchema.optional()
17523
+ creative: adsChatCardCreativeRequestSchema.optional(),
17524
+ /** Tracking parameters for this entity's click URLs; null clears them. */
17525
+ landingPageQueryStringTemplate: adsQueryStringTemplateSchema.nullable().optional()
17471
17526
  }).refine(hasMutationField, { message: "At least one ad field must be updated" });
17472
17527
  var adsPauseRequestSchema = z59.object({
17473
17528
  operationKey: adsOperationKeySchema