@canonry/canonry 4.180.2 → 4.180.3
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.
- package/assets/assets/{AuditHistoryPanel-Cf-jEEKZ.js → AuditHistoryPanel-CRtw07lK.js} +1 -1
- package/assets/assets/{BacklinksPage-oMcS6Hc_.js → BacklinksPage-DURChJhG.js} +1 -1
- package/assets/assets/{HistoryPage-CDQOpxi0.js → HistoryPage-DsSSJmOs.js} +1 -1
- package/assets/assets/{MeasurementPropertyPage-MoKFTmrS.js → MeasurementPropertyPage-DalkH9IT.js} +1 -1
- package/assets/assets/{ProjectPage-CtD1AwXE.js → ProjectPage-CXLK_E8n.js} +1 -1
- package/assets/assets/{RunRow-CPekiscK.js → RunRow-DDwwyIxg.js} +1 -1
- package/assets/assets/{RunsPage-hn05ImCv.js → RunsPage-DCgaTijO.js} +1 -1
- package/assets/assets/{SettingsPage-BOTYXtfF.js → SettingsPage-DwQqOC3_.js} +1 -1
- package/assets/assets/{SiteHealthSection-FwMZ11F8.js → SiteHealthSection-Fg2-UL0h.js} +3 -3
- package/assets/assets/{TrafficPage-f2v6A_uk.js → TrafficPage-CefISwhk.js} +1 -1
- package/assets/assets/{TrafficSourceDetailPage-nhWRLHiu.js → TrafficSourceDetailPage-Rotzu2tN.js} +1 -1
- package/assets/assets/{extract-error-message-Cp1YeVEr.js → extract-error-message-D6lzT2hr.js} +1 -1
- package/assets/assets/{index-VmxEHABq.js → index-BuZ_xmnc.js} +17 -17
- package/assets/assets/{react-sigma_core.esm.min-fnm2MkMi.js → react-sigma_core.esm.min-D-IM5qRE.js} +1 -1
- package/assets/index.html +1 -1
- package/dist/{chunk-4XHQ2GCN.js → chunk-CKGWOYPO.js} +2 -2
- package/dist/{chunk-6IR32MIH.js → chunk-JWPN6RU7.js} +9 -1
- package/dist/{chunk-44LVINXQ.js → chunk-OJDH2F6I.js} +164 -12
- package/dist/{chunk-665YENL2.js → chunk-W3YSGMYK.js} +23 -5
- package/dist/{chunk-DA25LOTW.js → chunk-YPDKZ73I.js} +1 -1
- package/dist/cli.js +5 -5
- package/dist/index.js +4 -4
- package/dist/{intelligence-service-RNBODYMZ.js → intelligence-service-DSYYBDR2.js} +2 -2
- package/dist/mcp.js +3 -3
- package/package.json +10 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./react-sigma_core.esm.min-
|
|
2
|
-
import{r as y,j as s,u as fe,D as En}from"./vendor-tanstack-Dock0eH1.js";import{dg as Ns,dh as js,B as O,di as Ue,dj as ks,T as J,dk as Ss,dl as Es,dm as As,aL as _s,a7 as sn,dn as An,a9 as $s,aa as an,L as $t,f as Ls,j as Dt,ac as Rt,I as we,i as ie,dp as rn,dq as Ts,dr as Gs,ds as Cs,dt as Ds,du as Rs,dv as Ps,dw as Is,dx as Ms,dy as on,dz as Os,dA as zs,dB as Fs,dC as Us,dD as Bs,dE as Ke,dF as Hs,dG as Ks}from"./index-VmxEHABq.js";import{S as Ut,p as Ws,u as qs,b as Vs,e as kt,X as Ys,z as Qs,L as ve,T as Pt,q as Lt,I as dn,P as It,C as _n,J as Xs,E as Zs}from"./vendor-lucide-nYKv-BB7.js";import{C as Js,a as ln,b as cn,d as ei,h as un,i as ti,j as ni,o as $n}from"./ChartPrimitives-DG35TyhH.js";import{R as si,C as ii,a as ai,X as ri,Y as oi,T as di,d as li}from"./vendor-recharts-D8rt5lKn.js";const ci=/^www\./i;function Ln(n){if(!n)return null;try{return new URL(n).hostname}catch{return null}}function hn(n){return n.trim().toLowerCase().replace(ci,"")}function ui(n,e){if(!e)return!1;try{return hn(new URL(n).hostname)===hn(e)}catch{return!1}}function Tn(n,e){if(!n)return"";if(!ui(n,e))return n;const t=new URL(n),i=`${t.pathname}${t.search}${t.hash}`;return i===""?"/":i}function hi(n,e){return Tn(n.url,e)||n.path||"/"}var bt={exports:{}},pn;function pi(){if(pn)return bt.exports;pn=1;var n=typeof Reflect=="object"?Reflect:null,e=n&&typeof n.apply=="function"?n.apply:function(g,f,v){return Function.prototype.apply.call(g,f,v)},t;n&&typeof n.ownKeys=="function"?t=n.ownKeys:Object.getOwnPropertySymbols?t=function(g){return Object.getOwnPropertyNames(g).concat(Object.getOwnPropertySymbols(g))}:t=function(g){return Object.getOwnPropertyNames(g)};function i(x){console&&console.warn&&console.warn(x)}var a=Number.isNaN||function(g){return g!==g};function r(){r.init.call(this)}bt.exports=r,bt.exports.once=T,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var o=10;function d(x){if(typeof x!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof x)}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(x){if(typeof x!="number"||x<0||a(x))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+x+".");o=x}}),r.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(g){if(typeof g!="number"||g<0||a(g))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+g+".");return this._maxListeners=g,this};function c(x){return x._maxListeners===void 0?r.defaultMaxListeners:x._maxListeners}r.prototype.getMaxListeners=function(){return c(this)},r.prototype.emit=function(g){for(var f=[],v=1;v<arguments.length;v++)f.push(arguments[v]);var $=g==="error",G=this._events;if(G!==void 0)$=$&&G.error===void 0;else if(!$)return!1;if($){var A;if(f.length>0&&(A=f[0]),A instanceof Error)throw A;var I=new Error("Unhandled error."+(A?" ("+A.message+")":""));throw I.context=A,I}var le=G[g];if(le===void 0)return!1;if(typeof le=="function")e(le,this,f);else for(var W=le.length,Se=S(le,W),v=0;v<W;++v)e(Se[v],this,f);return!0};function l(x,g,f,v){var $,G,A;if(d(f),G=x._events,G===void 0?(G=x._events=Object.create(null),x._eventsCount=0):(G.newListener!==void 0&&(x.emit("newListener",g,f.listener?f.listener:f),G=x._events),A=G[g]),A===void 0)A=G[g]=f,++x._eventsCount;else if(typeof A=="function"?A=G[g]=v?[f,A]:[A,f]:v?A.unshift(f):A.push(f),$=c(x),$>0&&A.length>$&&!A.warned){A.warned=!0;var I=new Error("Possible EventEmitter memory leak detected. "+A.length+" "+String(g)+" listeners added. Use emitter.setMaxListeners() to increase limit");I.name="MaxListenersExceededWarning",I.emitter=x,I.type=g,I.count=A.length,i(I)}return x}r.prototype.addListener=function(g,f){return l(this,g,f,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(g,f){return l(this,g,f,!0)};function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(x,g,f){var v={fired:!1,wrapFn:void 0,target:x,type:g,listener:f},$=p.bind(v);return $.listener=f,v.wrapFn=$,$}r.prototype.once=function(g,f){return d(f),this.on(g,u(this,g,f)),this},r.prototype.prependOnceListener=function(g,f){return d(f),this.prependListener(g,u(this,g,f)),this},r.prototype.removeListener=function(g,f){var v,$,G,A,I;if(d(f),$=this._events,$===void 0)return this;if(v=$[g],v===void 0)return this;if(v===f||v.listener===f)--this._eventsCount===0?this._events=Object.create(null):(delete $[g],$.removeListener&&this.emit("removeListener",g,v.listener||f));else if(typeof v!="function"){for(G=-1,A=v.length-1;A>=0;A--)if(v[A]===f||v[A].listener===f){I=v[A].listener,G=A;break}if(G<0)return this;G===0?v.shift():k(v,G),v.length===1&&($[g]=v[0]),$.removeListener!==void 0&&this.emit("removeListener",g,I||f)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(g){var f,v,$;if(v=this._events,v===void 0)return this;if(v.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):v[g]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete v[g]),this;if(arguments.length===0){var G=Object.keys(v),A;for($=0;$<G.length;++$)A=G[$],A!=="removeListener"&&this.removeAllListeners(A);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(f=v[g],typeof f=="function")this.removeListener(g,f);else if(f!==void 0)for($=f.length-1;$>=0;$--)this.removeListener(g,f[$]);return this};function h(x,g,f){var v=x._events;if(v===void 0)return[];var $=v[g];return $===void 0?[]:typeof $=="function"?f?[$.listener||$]:[$]:f?D($):S($,$.length)}r.prototype.listeners=function(g){return h(this,g,!0)},r.prototype.rawListeners=function(g){return h(this,g,!1)},r.listenerCount=function(x,g){return typeof x.listenerCount=="function"?x.listenerCount(g):b.call(x,g)},r.prototype.listenerCount=b;function b(x){var g=this._events;if(g!==void 0){var f=g[x];if(typeof f=="function")return 1;if(f!==void 0)return f.length}return 0}r.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function S(x,g){for(var f=new Array(g),v=0;v<g;++v)f[v]=x[v];return f}function k(x,g){for(;g+1<x.length;g++)x[g]=x[g+1];x.pop()}function D(x){for(var g=new Array(x.length),f=0;f<g.length;++f)g[f]=x[f].listener||x[f];return g}function T(x,g){return new Promise(function(f,v){function $(A){x.removeListener(g,G),v(A)}function G(){typeof x.removeListener=="function"&&x.removeListener("error",$),f([].slice.call(arguments))}C(x,g,G,{once:!0}),g!=="error"&&z(x,$,{once:!0})})}function z(x,g,f){typeof x.on=="function"&&C(x,"error",g,f)}function C(x,g,f,v){if(typeof x.on=="function")v.once?x.once(g,f):x.on(g,f);else if(typeof x.addEventListener=="function")x.addEventListener(g,function $(G){v.once&&x.removeEventListener(g,$),f(G)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof x)}return bt.exports}var fi=pi();function mi(){const n=arguments[0];for(let e=1,t=arguments.length;e<t;e++)if(arguments[e])for(const i in arguments[e])n[i]=arguments[e][i];return n}let Y=mi;typeof Object.assign=="function"&&(Y=Object.assign);function je(n,e,t,i){const a=n._nodes.get(e);let r=null;return a&&(i==="mixed"?r=a.out&&a.out[t]||a.undirected&&a.undirected[t]:i==="directed"?r=a.out&&a.out[t]:r=a.undirected&&a.undirected[t]),r}function ee(n){return typeof n=="object"&&n!==null}function Gn(n){let e;for(e in n)return!1;return!0}function ye(n,e,t){Object.defineProperty(n,e,{enumerable:!1,configurable:!1,writable:!0,value:t})}function ke(n,e,t){const i={enumerable:!0,configurable:!0};typeof t=="function"?i.get=t:(i.value=t,i.writable=!1),Object.defineProperty(n,e,i)}function fn(n){return!(!ee(n)||n.attributes&&!Array.isArray(n.attributes))}function gi(){let n=Math.floor(Math.random()*256)&255;return()=>n++}function Ge(){const n=arguments;let e=null,t=-1;return{[Symbol.iterator](){return this},next(){let i=null;do{if(e===null){if(t++,t>=n.length)return{done:!0};e=n[t][Symbol.iterator]()}if(i=e.next(),i.done){e=null;continue}break}while(!0);return i}}}function Je(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class Bt extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class j extends Bt{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,j.prototype.constructor)}}class w extends Bt{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,w.prototype.constructor)}}class L extends Bt{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,L.prototype.constructor)}}function Cn(n,e){this.key=n,this.attributes=e,this.clear()}Cn.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function Dn(n,e){this.key=n,this.attributes=e,this.clear()}Dn.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Rn(n,e){this.key=n,this.attributes=e,this.clear()}Rn.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function et(n,e,t,i,a){this.key=e,this.attributes=a,this.undirected=n,this.source=t,this.target=i}et.prototype.attach=function(){let n="out",e="in";this.undirected&&(n=e="undirected");const t=this.source.key,i=this.target.key;this.source[n][i]=this,!(this.undirected&&t===i)&&(this.target[e][t]=this)};et.prototype.attachMulti=function(){let n="out",e="in";const t=this.source.key,i=this.target.key;this.undirected&&(n=e="undirected");const a=this.source[n],r=a[i];if(typeof r>"u"){a[i]=this,this.undirected&&t===i||(this.target[e][t]=this);return}r.previous=this,this.next=r,a[i]=this,this.target[e][t]=this};et.prototype.detach=function(){const n=this.source.key,e=this.target.key;let t="out",i="in";this.undirected&&(t=i="undirected"),delete this.source[t][e],delete this.target[i][n]};et.prototype.detachMulti=function(){const n=this.source.key,e=this.target.key;let t="out",i="in";this.undirected&&(t=i="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][e],delete this.target[i][n]):(this.next.previous=void 0,this.source[t][e]=this.next,this.target[i][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const Pn=0,In=1,xi=2,Mn=3;function Ce(n,e,t,i,a,r,o){let d,c,l,p;if(i=""+i,t===Pn){if(d=n._nodes.get(i),!d)throw new w(`Graph.${e}: could not find the "${i}" node in the graph.`);l=a,p=r}else if(t===Mn){if(a=""+a,c=n._edges.get(a),!c)throw new w(`Graph.${e}: could not find the "${a}" edge in the graph.`);const u=c.source.key,h=c.target.key;if(i===u)d=c.target;else if(i===h)d=c.source;else throw new w(`Graph.${e}: the "${i}" node is not attached to the "${a}" edge (${u}, ${h}).`);l=r,p=o}else{if(c=n._edges.get(i),!c)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`);t===In?d=c.source:d=c.target,l=a,p=r}return[d,l,p]}function bi(n,e,t){n.prototype[e]=function(i,a,r){const[o,d]=Ce(this,e,t,i,a,r);return o.attributes[d]}}function yi(n,e,t){n.prototype[e]=function(i,a){const[r]=Ce(this,e,t,i,a);return r.attributes}}function wi(n,e,t){n.prototype[e]=function(i,a,r){const[o,d]=Ce(this,e,t,i,a,r);return o.attributes.hasOwnProperty(d)}}function vi(n,e,t){n.prototype[e]=function(i,a,r,o){const[d,c,l]=Ce(this,e,t,i,a,r,o);return d.attributes[c]=l,this.emit("nodeAttributesUpdated",{key:d.key,type:"set",attributes:d.attributes,name:c}),this}}function Ni(n,e,t){n.prototype[e]=function(i,a,r,o){const[d,c,l]=Ce(this,e,t,i,a,r,o);if(typeof l!="function")throw new j(`Graph.${e}: updater should be a function.`);const p=d.attributes,u=l(p[c]);return p[c]=u,this.emit("nodeAttributesUpdated",{key:d.key,type:"set",attributes:d.attributes,name:c}),this}}function ji(n,e,t){n.prototype[e]=function(i,a,r){const[o,d]=Ce(this,e,t,i,a,r);return delete o.attributes[d],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:d}),this}}function ki(n,e,t){n.prototype[e]=function(i,a,r){const[o,d]=Ce(this,e,t,i,a,r);if(!ee(d))throw new j(`Graph.${e}: provided attributes are not a plain object.`);return o.attributes=d,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function Si(n,e,t){n.prototype[e]=function(i,a,r){const[o,d]=Ce(this,e,t,i,a,r);if(!ee(d))throw new j(`Graph.${e}: provided attributes are not a plain object.`);return Y(o.attributes,d),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:d}),this}}function Ei(n,e,t){n.prototype[e]=function(i,a,r){const[o,d]=Ce(this,e,t,i,a,r);if(typeof d!="function")throw new j(`Graph.${e}: provided updater is not a function.`);return o.attributes=d(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const Ai=[{name:n=>`get${n}Attribute`,attacher:bi},{name:n=>`get${n}Attributes`,attacher:yi},{name:n=>`has${n}Attribute`,attacher:wi},{name:n=>`set${n}Attribute`,attacher:vi},{name:n=>`update${n}Attribute`,attacher:Ni},{name:n=>`remove${n}Attribute`,attacher:ji},{name:n=>`replace${n}Attributes`,attacher:ki},{name:n=>`merge${n}Attributes`,attacher:Si},{name:n=>`update${n}Attributes`,attacher:Ei}];function _i(n){Ai.forEach(function({name:e,attacher:t}){t(n,e("Node"),Pn),t(n,e("Source"),In),t(n,e("Target"),xi),t(n,e("Opposite"),Mn)})}function $i(n,e,t){n.prototype[e]=function(i,a){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,d=""+a;if(a=arguments[2],r=je(this,o,d,t),!r)throw new w(`Graph.${e}: could not find an edge for the given path ("${o}" - "${d}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,r=this._edges.get(i),!r)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return r.attributes[a]}}function Li(n,e,t){n.prototype[e]=function(i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const r=""+i,o=""+arguments[1];if(a=je(this,r,o,t),!a)throw new w(`Graph.${e}: could not find an edge for the given path ("${r}" - "${o}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,a=this._edges.get(i),!a)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return a.attributes}}function Ti(n,e,t){n.prototype[e]=function(i,a){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,d=""+a;if(a=arguments[2],r=je(this,o,d,t),!r)throw new w(`Graph.${e}: could not find an edge for the given path ("${o}" - "${d}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,r=this._edges.get(i),!r)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return r.attributes.hasOwnProperty(a)}}function Gi(n,e,t){n.prototype[e]=function(i,a,r){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const d=""+i,c=""+a;if(a=arguments[2],r=arguments[3],o=je(this,d,c,t),!o)throw new w(`Graph.${e}: could not find an edge for the given path ("${d}" - "${c}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,o=this._edges.get(i),!o)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return o.attributes[a]=r,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:a}),this}}function Ci(n,e,t){n.prototype[e]=function(i,a,r){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const d=""+i,c=""+a;if(a=arguments[2],r=arguments[3],o=je(this,d,c,t),!o)throw new w(`Graph.${e}: could not find an edge for the given path ("${d}" - "${c}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,o=this._edges.get(i),!o)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(typeof r!="function")throw new j(`Graph.${e}: updater should be a function.`);return o.attributes[a]=r(o.attributes[a]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:a}),this}}function Di(n,e,t){n.prototype[e]=function(i,a){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,d=""+a;if(a=arguments[2],r=je(this,o,d,t),!r)throw new w(`Graph.${e}: could not find an edge for the given path ("${o}" - "${d}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,r=this._edges.get(i),!r)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return delete r.attributes[a],this.emit("edgeAttributesUpdated",{key:r.key,type:"remove",attributes:r.attributes,name:a}),this}}function Ri(n,e,t){n.prototype[e]=function(i,a){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,d=""+a;if(a=arguments[2],r=je(this,o,d,t),!r)throw new w(`Graph.${e}: could not find an edge for the given path ("${o}" - "${d}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,r=this._edges.get(i),!r)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(!ee(a))throw new j(`Graph.${e}: provided attributes are not a plain object.`);return r.attributes=a,this.emit("edgeAttributesUpdated",{key:r.key,type:"replace",attributes:r.attributes}),this}}function Pi(n,e,t){n.prototype[e]=function(i,a){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,d=""+a;if(a=arguments[2],r=je(this,o,d,t),!r)throw new w(`Graph.${e}: could not find an edge for the given path ("${o}" - "${d}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,r=this._edges.get(i),!r)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(!ee(a))throw new j(`Graph.${e}: provided attributes are not a plain object.`);return Y(r.attributes,a),this.emit("edgeAttributesUpdated",{key:r.key,type:"merge",attributes:r.attributes,data:a}),this}}function Ii(n,e,t){n.prototype[e]=function(i,a){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,d=""+a;if(a=arguments[2],r=je(this,o,d,t),!r)throw new w(`Graph.${e}: could not find an edge for the given path ("${o}" - "${d}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,r=this._edges.get(i),!r)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(typeof a!="function")throw new j(`Graph.${e}: provided updater is not a function.`);return r.attributes=a(r.attributes),this.emit("edgeAttributesUpdated",{key:r.key,type:"update",attributes:r.attributes}),this}}const Mi=[{name:n=>`get${n}Attribute`,attacher:$i},{name:n=>`get${n}Attributes`,attacher:Li},{name:n=>`has${n}Attribute`,attacher:Ti},{name:n=>`set${n}Attribute`,attacher:Gi},{name:n=>`update${n}Attribute`,attacher:Ci},{name:n=>`remove${n}Attribute`,attacher:Di},{name:n=>`replace${n}Attributes`,attacher:Ri},{name:n=>`merge${n}Attributes`,attacher:Pi},{name:n=>`update${n}Attributes`,attacher:Ii}];function Oi(n){Mi.forEach(function({name:e,attacher:t}){t(n,e("Edge"),"mixed"),t(n,e("DirectedEdge"),"directed"),t(n,e("UndirectedEdge"),"undirected")})}const zi=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function Fi(n,e,t,i){let a=!1;for(const r in e){if(r===i)continue;const o=e[r];if(a=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),n&&a)return o.key}}function Ui(n,e,t,i){let a,r,o,d=!1;for(const c in e)if(c!==i){a=e[c];do{if(r=a.source,o=a.target,d=t(a.key,a.attributes,r.key,o.key,r.attributes,o.attributes,a.undirected),n&&d)return a.key;a=a.next}while(a!==void 0)}}function Tt(n,e){const t=Object.keys(n),i=t.length;let a,r=0;return{[Symbol.iterator](){return this},next(){do if(a)a=a.next;else{if(r>=i)return{done:!0};const o=t[r++];if(o===e){a=void 0;continue}a=n[o]}while(!a);return{done:!1,value:{edge:a.key,attributes:a.attributes,source:a.source.key,target:a.target.key,sourceAttributes:a.source.attributes,targetAttributes:a.target.attributes,undirected:a.undirected}}}}}function Bi(n,e,t,i){const a=e[t];if(!a)return;const r=a.source,o=a.target;if(i(a.key,a.attributes,r.key,o.key,r.attributes,o.attributes,a.undirected)&&n)return a.key}function Hi(n,e,t,i){let a=e[t];if(!a)return;let r=!1;do{if(r=i(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),n&&r)return a.key;a=a.next}while(a!==void 0)}function Gt(n,e){let t=n[e];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const a={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:a}}};let i=!1;return{[Symbol.iterator](){return this},next(){return i===!0?{done:!0}:(i=!0,{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}})}}}function Ki(n,e){if(n.size===0)return[];if(e==="mixed"||e===n.type)return Array.from(n._edges.keys());const t=e==="undirected"?n.undirectedSize:n.directedSize,i=new Array(t),a=e==="undirected",r=n._edges.values();let o=0,d,c;for(;d=r.next(),d.done!==!0;)c=d.value,c.undirected===a&&(i[o++]=c.key);return i}function On(n,e,t,i){if(e.size===0)return;const a=t!=="mixed"&&t!==e.type,r=t==="undirected";let o,d,c=!1;const l=e._edges.values();for(;o=l.next(),o.done!==!0;){if(d=o.value,a&&d.undirected!==r)continue;const{key:p,attributes:u,source:h,target:b}=d;if(c=i(p,u,h.key,b.key,h.attributes,b.attributes,d.undirected),n&&c)return p}}function Wi(n,e){if(n.size===0)return Je();const t=e!=="mixed"&&e!==n.type,i=e==="undirected",a=n._edges.values();return{[Symbol.iterator](){return this},next(){let r,o;for(;;){if(r=a.next(),r.done)return r;if(o=r.value,!(t&&o.undirected!==i))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}}}}function Ht(n,e,t,i,a,r){const o=e?Ui:Fi;let d;if(t!=="undirected"&&(i!=="out"&&(d=o(n,a.in,r),n&&d)||i!=="in"&&(d=o(n,a.out,r,i?void 0:a.key),n&&d))||t!=="directed"&&(d=o(n,a.undirected,r),n&&d))return d}function qi(n,e,t,i){const a=[];return Ht(!1,n,e,t,i,function(r){a.push(r)}),a}function Vi(n,e,t){let i=Je();return n!=="undirected"&&(e!=="out"&&typeof t.in<"u"&&(i=Ge(i,Tt(t.in))),e!=="in"&&typeof t.out<"u"&&(i=Ge(i,Tt(t.out,e?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(i=Ge(i,Tt(t.undirected))),i}function Kt(n,e,t,i,a,r,o){const d=t?Hi:Bi;let c;if(e!=="undirected"&&(typeof a.in<"u"&&i!=="out"&&(c=d(n,a.in,r,o),n&&c)||typeof a.out<"u"&&i!=="in"&&(i||a.key!==r)&&(c=d(n,a.out,r,o),n&&c))||e!=="directed"&&typeof a.undirected<"u"&&(c=d(n,a.undirected,r,o),n&&c))return c}function Yi(n,e,t,i,a){const r=[];return Kt(!1,n,e,t,i,a,function(o){r.push(o)}),r}function Qi(n,e,t,i){let a=Je();return n!=="undirected"&&(typeof t.in<"u"&&e!=="out"&&i in t.in&&(a=Ge(a,Gt(t.in,i))),typeof t.out<"u"&&e!=="in"&&i in t.out&&(e||t.key!==i)&&(a=Ge(a,Gt(t.out,i)))),n!=="directed"&&typeof t.undirected<"u"&&i in t.undirected&&(a=Ge(a,Gt(t.undirected,i))),a}function Xi(n,e){const{name:t,type:i,direction:a}=e;n.prototype[t]=function(r,o){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return[];if(!arguments.length)return Ki(this,i);if(arguments.length===1){r=""+r;const d=this._nodes.get(r);if(typeof d>"u")throw new w(`Graph.${t}: could not find the "${r}" node in the graph.`);return qi(this.multi,i==="mixed"?this.type:i,a,d)}if(arguments.length===2){r=""+r,o=""+o;const d=this._nodes.get(r);if(!d)throw new w(`Graph.${t}: could not find the "${r}" source node in the graph.`);if(!this._nodes.has(o))throw new w(`Graph.${t}: could not find the "${o}" target node in the graph.`);return Yi(i,this.multi,a,d,o)}throw new j(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Zi(n,e){const{name:t,type:i,direction:a}=e,r="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[r]=function(l,p,u){if(!(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)){if(arguments.length===1)return u=l,On(!1,this,i,u);if(arguments.length===2){l=""+l,u=p;const h=this._nodes.get(l);if(typeof h>"u")throw new w(`Graph.${r}: could not find the "${l}" node in the graph.`);return Ht(!1,this.multi,i==="mixed"?this.type:i,a,h,u)}if(arguments.length===3){l=""+l,p=""+p;const h=this._nodes.get(l);if(!h)throw new w(`Graph.${r}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(p))throw new w(`Graph.${r}: could not find the "${p}" target node in the graph.`);return Kt(!1,i,this.multi,a,h,p,u)}throw new j(`Graph.${r}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(){const l=Array.prototype.slice.call(arguments),p=l.pop();let u;if(l.length===0){let h=0;i!=="directed"&&(h+=this.undirectedSize),i!=="undirected"&&(h+=this.directedSize),u=new Array(h);let b=0;l.push((S,k,D,T,z,C,x)=>{u[b++]=p(S,k,D,T,z,C,x)})}else u=[],l.push((h,b,S,k,D,T,z)=>{u.push(p(h,b,S,k,D,T,z))});return this[r].apply(this,l),u};const d="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[d]=function(){const l=Array.prototype.slice.call(arguments),p=l.pop(),u=[];return l.push((h,b,S,k,D,T,z)=>{p(h,b,S,k,D,T,z)&&u.push(h)}),this[r].apply(this,l),u};const c="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[c]=function(){let l=Array.prototype.slice.call(arguments);if(l.length<2||l.length>4)throw new j(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${l.length}).`);if(typeof l[l.length-1]=="function"&&typeof l[l.length-2]!="function")throw new j(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let p,u;l.length===2?(p=l[0],u=l[1],l=[]):l.length===3?(p=l[1],u=l[2],l=[l[0]]):l.length===4&&(p=l[2],u=l[3],l=[l[0],l[1]]);let h=u;return l.push((b,S,k,D,T,z,C)=>{h=p(h,b,S,k,D,T,z,C)}),this[r].apply(this,l),h}}function Ji(n,e){const{name:t,type:i,direction:a}=e,r="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[r]=function(c,l,p){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return!1;if(arguments.length===1)return p=c,On(!0,this,i,p);if(arguments.length===2){c=""+c,p=l;const u=this._nodes.get(c);if(typeof u>"u")throw new w(`Graph.${r}: could not find the "${c}" node in the graph.`);return Ht(!0,this.multi,i==="mixed"?this.type:i,a,u,p)}if(arguments.length===3){c=""+c,l=""+l;const u=this._nodes.get(c);if(!u)throw new w(`Graph.${r}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(l))throw new w(`Graph.${r}: could not find the "${l}" target node in the graph.`);return Kt(!0,i,this.multi,a,u,l,p)}throw new j(`Graph.${r}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(){const c=Array.prototype.slice.call(arguments),l=c.pop();return c.push((u,h,b,S,k,D,T)=>l(u,h,b,S,k,D,T)),!!this[r].apply(this,c)};const d="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[d]=function(){const c=Array.prototype.slice.call(arguments),l=c.pop();return c.push((u,h,b,S,k,D,T)=>!l(u,h,b,S,k,D,T)),!this[r].apply(this,c)}}function ea(n,e){const{name:t,type:i,direction:a}=e,r=t.slice(0,-1)+"Entries";n.prototype[r]=function(o,d){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return Je();if(!arguments.length)return Wi(this,i);if(arguments.length===1){o=""+o;const c=this._nodes.get(o);if(!c)throw new w(`Graph.${r}: could not find the "${o}" node in the graph.`);return Vi(i,a,c)}if(arguments.length===2){o=""+o,d=""+d;const c=this._nodes.get(o);if(!c)throw new w(`Graph.${r}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(d))throw new w(`Graph.${r}: could not find the "${d}" target node in the graph.`);return Qi(i,a,c,d)}throw new j(`Graph.${r}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function ta(n){zi.forEach(e=>{Xi(n,e),Zi(n,e),Ji(n,e),ea(n,e)})}const na=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function St(){this.A=null,this.B=null}St.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};St.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function rt(n,e,t,i,a){for(const r in i){const o=i[r],d=o.source,c=o.target,l=d===t?c:d;if(e&&e.has(l.key))continue;const p=a(l.key,l.attributes);if(n&&p)return l.key}}function Wt(n,e,t,i,a){if(e!=="mixed"){if(e==="undirected")return rt(n,null,i,i.undirected,a);if(typeof t=="string")return rt(n,null,i,i[t],a)}const r=new St;let o;if(e!=="undirected"){if(t!=="out"){if(o=rt(n,null,i,i.in,a),n&&o)return o;r.wrap(i.in)}if(t!=="in"){if(o=rt(n,r,i,i.out,a),n&&o)return o;r.wrap(i.out)}}if(e!=="directed"&&(o=rt(n,r,i,i.undirected,a),n&&o))return o}function sa(n,e,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof e=="string")return Object.keys(t[e])}const i=[];return Wt(!1,n,e,t,function(a){i.push(a)}),i}function ot(n,e,t){const i=Object.keys(t),a=i.length;let r=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(r>=a)return n&&n.wrap(t),{done:!0};const d=t[i[r++]],c=d.source,l=d.target;if(o=c===e?l:c,n&&n.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function ia(n,e,t){if(n!=="mixed"){if(n==="undirected")return ot(null,t,t.undirected);if(typeof e=="string")return ot(null,t,t[e])}let i=Je();const a=new St;return n!=="undirected"&&(e!=="out"&&(i=Ge(i,ot(a,t,t.in))),e!=="in"&&(i=Ge(i,ot(a,t,t.out)))),n!=="directed"&&(i=Ge(i,ot(a,t,t.undirected))),i}function aa(n,e){const{name:t,type:i,direction:a}=e;n.prototype[t]=function(r){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return[];r=""+r;const o=this._nodes.get(r);if(typeof o>"u")throw new w(`Graph.${t}: could not find the "${r}" node in the graph.`);return sa(i==="mixed"?this.type:i,a,o)}}function ra(n,e){const{name:t,type:i,direction:a}=e,r="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[r]=function(l,p){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return;l=""+l;const u=this._nodes.get(l);if(typeof u>"u")throw new w(`Graph.${r}: could not find the "${l}" node in the graph.`);Wt(!1,i==="mixed"?this.type:i,a,u,p)};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(l,p){const u=[];return this[r](l,(h,b)=>{u.push(p(h,b))}),u};const d="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[d]=function(l,p){const u=[];return this[r](l,(h,b)=>{p(h,b)&&u.push(h)}),u};const c="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[c]=function(l,p,u){if(arguments.length<3)throw new j(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let h=u;return this[r](l,(b,S)=>{h=p(h,b,S)}),h}}function oa(n,e){const{name:t,type:i,direction:a}=e,r=t[0].toUpperCase()+t.slice(1,-1),o="find"+r;n.prototype[o]=function(l,p){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return;l=""+l;const u=this._nodes.get(l);if(typeof u>"u")throw new w(`Graph.${o}: could not find the "${l}" node in the graph.`);return Wt(!0,i==="mixed"?this.type:i,a,u,p)};const d="some"+r;n.prototype[d]=function(l,p){return!!this[o](l,p)};const c="every"+r;n.prototype[c]=function(l,p){return!this[o](l,(h,b)=>!p(h,b))}}function da(n,e){const{name:t,type:i,direction:a}=e,r=t.slice(0,-1)+"Entries";n.prototype[r]=function(o){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return Je();o=""+o;const d=this._nodes.get(o);if(typeof d>"u")throw new w(`Graph.${r}: could not find the "${o}" node in the graph.`);return ia(i==="mixed"?this.type:i,a,d)}}function la(n){na.forEach(e=>{aa(n,e),ra(n,e),oa(n,e),da(n,e)})}function yt(n,e,t,i,a){const r=i._nodes.values(),o=i.type;let d,c,l,p,u,h;for(;d=r.next(),d.done!==!0;){let b=!1;if(c=d.value,o!=="undirected"){p=c.out;for(l in p){u=p[l];do h=u.target,b=!0,a(c.key,h.key,c.attributes,h.attributes,u.key,u.attributes,u.undirected),u=u.next;while(u)}}if(o!=="directed"){p=c.undirected;for(l in p)if(!(e&&c.key>l)){u=p[l];do h=u.target,h.key!==l&&(h=u.source),b=!0,a(c.key,h.key,c.attributes,h.attributes,u.key,u.attributes,u.undirected),u=u.next;while(u)}}t&&!b&&a(c.key,null,c.attributes,null,null,null,null)}}function ca(n,e){const t={key:n};return Gn(e.attributes)||(t.attributes=Y({},e.attributes)),t}function ua(n,e,t){const i={key:e,source:t.source.key,target:t.target.key};return Gn(t.attributes)||(i.attributes=Y({},t.attributes)),n==="mixed"&&t.undirected&&(i.undirected=!0),i}function ha(n){if(!ee(n))throw new j('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new j("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!ee(n.attributes)||n.attributes===null))throw new j("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function pa(n){if(!ee(n))throw new j('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new j("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new j("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!ee(n.attributes)||n.attributes===null))throw new j("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new j("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const fa=gi(),ma=new Set(["directed","undirected","mixed"]),mn=new Set(["domain","_events","_eventsCount","_maxListeners"]),ga=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],xa={allowSelfLoops:!0,multi:!1,type:"mixed"};function ba(n,e,t){if(t&&!ee(t))throw new j(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(e=""+e,t=t||{},n._nodes.has(e))throw new L(`Graph.addNode: the "${e}" node already exist in the graph.`);const i=new n.NodeDataClass(e,t);return n._nodes.set(e,i),n.emit("nodeAdded",{key:e,attributes:t}),i}function gn(n,e,t){const i=new n.NodeDataClass(e,t);return n._nodes.set(e,i),n.emit("nodeAdded",{key:e,attributes:t}),i}function zn(n,e,t,i,a,r,o,d){if(!i&&n.type==="undirected")throw new L(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(i&&n.type==="directed")throw new L(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(d&&!ee(d))throw new j(`Graph.${e}: invalid attributes. Expecting an object but got "${d}"`);if(r=""+r,o=""+o,d=d||{},!n.allowSelfLoops&&r===o)throw new L(`Graph.${e}: source & target are the same ("${r}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const c=n._nodes.get(r),l=n._nodes.get(o);if(!c)throw new w(`Graph.${e}: source node "${r}" not found.`);if(!l)throw new w(`Graph.${e}: target node "${o}" not found.`);const p={key:null,undirected:i,source:r,target:o,attributes:d};if(t)a=n._edgeKeyGenerator();else if(a=""+a,n._edges.has(a))throw new L(`Graph.${e}: the "${a}" edge already exists in the graph.`);if(!n.multi&&(i?typeof c.undirected[o]<"u":typeof c.out[o]<"u"))throw new L(`Graph.${e}: an edge linking "${r}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const u=new et(i,a,c,l,d);n._edges.set(a,u);const h=r===o;return i?(c.undirectedDegree++,l.undirectedDegree++,h&&(c.undirectedLoops++,n._undirectedSelfLoopCount++)):(c.outDegree++,l.inDegree++,h&&(c.directedLoops++,n._directedSelfLoopCount++)),n.multi?u.attachMulti():u.attach(),i?n._undirectedSize++:n._directedSize++,p.key=a,n.emit("edgeAdded",p),a}function ya(n,e,t,i,a,r,o,d,c){if(!i&&n.type==="undirected")throw new L(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(i&&n.type==="directed")throw new L(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(d){if(c){if(typeof d!="function")throw new j(`Graph.${e}: invalid updater function. Expecting a function but got "${d}"`)}else if(!ee(d))throw new j(`Graph.${e}: invalid attributes. Expecting an object but got "${d}"`)}r=""+r,o=""+o;let l;if(c&&(l=d,d=void 0),!n.allowSelfLoops&&r===o)throw new L(`Graph.${e}: source & target are the same ("${r}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let p=n._nodes.get(r),u=n._nodes.get(o),h,b;if(!t&&(h=n._edges.get(a),h)){if((h.source.key!==r||h.target.key!==o)&&(!i||h.source.key!==o||h.target.key!==r))throw new L(`Graph.${e}: inconsistency detected when attempting to merge the "${a}" edge with "${r}" source & "${o}" target vs. ("${h.source.key}", "${h.target.key}").`);b=h}if(!b&&!n.multi&&p&&(b=i?p.undirected[o]:p.out[o]),b){const z=[b.key,!1,!1,!1];if(c?!l:!d)return z;if(c){const C=b.attributes;b.attributes=l(C),n.emit("edgeAttributesUpdated",{type:"replace",key:b.key,attributes:b.attributes})}else Y(b.attributes,d),n.emit("edgeAttributesUpdated",{type:"merge",key:b.key,attributes:b.attributes,data:d});return z}d=d||{},c&&l&&(d=l(d));const S={key:null,undirected:i,source:r,target:o,attributes:d};if(t)a=n._edgeKeyGenerator();else if(a=""+a,n._edges.has(a))throw new L(`Graph.${e}: the "${a}" edge already exists in the graph.`);let k=!1,D=!1;p||(p=gn(n,r,{}),k=!0,r===o&&(u=p,D=!0)),u||(u=gn(n,o,{}),D=!0),h=new et(i,a,p,u,d),n._edges.set(a,h);const T=r===o;return i?(p.undirectedDegree++,u.undirectedDegree++,T&&(p.undirectedLoops++,n._undirectedSelfLoopCount++)):(p.outDegree++,u.inDegree++,T&&(p.directedLoops++,n._directedSelfLoopCount++)),n.multi?h.attachMulti():h.attach(),i?n._undirectedSize++:n._directedSize++,S.key=a,n.emit("edgeAdded",S),[a,!0,k,D]}function We(n,e){n._edges.delete(e.key);const{source:t,target:i,attributes:a}=e,r=e.undirected,o=t===i;r?(t.undirectedDegree--,i.undirectedDegree--,o&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,i.inDegree--,o&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?e.detachMulti():e.detach(),r?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:e.key,attributes:a,source:t.key,target:i.key,undirected:r})}class F extends fi.EventEmitter{constructor(e){if(super(),e=Y({},xa,e),typeof e.multi!="boolean")throw new j(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!ma.has(e.type))throw new j(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new j(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const t=e.type==="mixed"?Cn:e.type==="directed"?Dn:Rn;ye(this,"NodeDataClass",t);const i="geid_"+fa()+"_";let a=0;const r=()=>{let o;do o=i+a++;while(this._edges.has(o));return o};ye(this,"_attributes",{}),ye(this,"_nodes",new Map),ye(this,"_edges",new Map),ye(this,"_directedSize",0),ye(this,"_undirectedSize",0),ye(this,"_directedSelfLoopCount",0),ye(this,"_undirectedSelfLoopCount",0),ye(this,"_edgeKeyGenerator",r),ye(this,"_options",e),mn.forEach(o=>ye(this,o,this[o])),ke(this,"order",()=>this._nodes.size),ke(this,"size",()=>this._edges.size),ke(this,"directedSize",()=>this._directedSize),ke(this,"undirectedSize",()=>this._undirectedSize),ke(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),ke(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),ke(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),ke(this,"multi",this._options.multi),ke(this,"type",this._options.type),ke(this,"allowSelfLoops",this._options.allowSelfLoops),ke(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,t){if(this.type==="undirected")return!1;if(arguments.length===1){const i=""+e,a=this._edges.get(i);return!!a&&!a.undirected}else if(arguments.length===2){e=""+e,t=""+t;const i=this._nodes.get(e);return i?i.out.hasOwnProperty(t):!1}throw new j(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type==="directed")return!1;if(arguments.length===1){const i=""+e,a=this._edges.get(i);return!!a&&a.undirected}else if(arguments.length===2){e=""+e,t=""+t;const i=this._nodes.get(e);return i?i.undirected.hasOwnProperty(t):!1}throw new j(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){const i=""+e;return this._edges.has(i)}else if(arguments.length===2){e=""+e,t=""+t;const i=this._nodes.get(e);return i?typeof i.out<"u"&&i.out.hasOwnProperty(t)||typeof i.undirected<"u"&&i.undirected.hasOwnProperty(t):!1}throw new j(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type==="undirected")return;if(e=""+e,t=""+t,this.multi)throw new L("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const i=this._nodes.get(e);if(!i)throw new w(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new w(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const a=i.out&&i.out[t]||void 0;if(a)return a.key}undirectedEdge(e,t){if(this.type==="directed")return;if(e=""+e,t=""+t,this.multi)throw new L("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const i=this._nodes.get(e);if(!i)throw new w(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new w(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const a=i.undirected&&i.undirected[t]||void 0;if(a)return a.key}edge(e,t){if(this.multi)throw new L("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new w(`Graph.edge: could not find the "${t}" target node in the graph.`);const a=i.out&&i.out[t]||i.undirected&&i.undirected[t]||void 0;if(a)return a.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in i.in||t in i.out}areOutNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in i.out}areInNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in i.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:t in i.undirected}areNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(t in i.in||t in i.out)||this.type!=="directed"&&t in i.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in i.in||this.type!=="directed"&&t in i.undirected}areOutboundNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in i.out||this.type!=="directed"&&t in i.undirected}inDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.inDegree),i}outboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.outDegree),i}degree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.degree: could not find the "${e}" node in the graph.`);let i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.inDegree+t.outDegree),i}inDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,a=0;return this.type!=="directed"&&(i+=t.undirectedDegree,a+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.inDegree,a+=t.directedLoops),i-a}outboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,a=0;return this.type!=="directed"&&(i+=t.undirectedDegree,a+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.outDegree,a+=t.directedLoops),i-a}degreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,a=0;return this.type!=="directed"&&(i+=t.undirectedDegree,a+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.inDegree+t.outDegree,a+=t.directedLoops*2),i-a}source(e){e=""+e;const t=this._edges.get(e);if(!t)throw new w(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;const t=this._edges.get(e);if(!t)throw new w(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;const t=this._edges.get(e);if(!t)throw new w(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=""+e,t=""+t;const i=this._edges.get(t);if(!i)throw new w(`Graph.opposite: could not find the "${t}" edge in the graph.`);const a=i.source.key,r=i.target.key;if(e===a)return r;if(e===r)return a;throw new w(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${a}, ${r}).`)}hasExtremity(e,t){e=""+e,t=""+t;const i=this._edges.get(e);if(!i)throw new w(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return i.source.key===t||i.target.key===t}isUndirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new w(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new w(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;const t=this._edges.get(e);if(!t)throw new w(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return ba(this,e,t).key}mergeNode(e,t){if(t&&!ee(t))throw new j(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let i=this._nodes.get(e);return i?(t&&(Y(i.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:i.attributes,data:t})),[e,!1]):(i=new this.NodeDataClass(e,t),this._nodes.set(e,i),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!="function")throw new j(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let i=this._nodes.get(e);if(i){if(t){const r=i.attributes;i.attributes=t(r),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:i.attributes})}return[e,!1]}const a=t?t({}):{};return i=new this.NodeDataClass(e,a),this._nodes.set(e,i),this.emit("nodeAdded",{key:e,attributes:a}),[e,!0]}dropNode(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.dropNode: could not find the "${e}" node in the graph.`);let i;if(this.type!=="undirected"){for(const a in t.out){i=t.out[a];do We(this,i),i=i.next;while(i)}for(const a in t.in){i=t.in[a];do We(this,i),i=i.next;while(i)}}if(this.type!=="directed")for(const a in t.undirected){i=t.undirected[a];do We(this,i),i=i.next;while(i)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){const i=""+arguments[0],a=""+arguments[1];if(t=je(this,i,a,this.type),!t)throw new w(`Graph.dropEdge: could not find the "${i}" -> "${a}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new w(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return We(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new L("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new L("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");e=""+e,t=""+t;const i=je(this,e,t,"directed");if(!i)throw new w(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return We(this,i),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new L("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new L("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const i=je(this,e,t,"undirected");if(!i)throw new w(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return We(this,i),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const e=this._nodes.values();let t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!="function")throw new j("Graph.updateAttribute: updater should be a function.");const i=this._attributes[e];return this._attributes[e]=t(i),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!ee(e))throw new j("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!ee(e))throw new j("Graph.mergeAttributes: provided attributes are not a plain object.");return Y(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")throw new j("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!="function")throw new j("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!fn(t))throw new j("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const i=this._nodes.values();let a,r;for(;a=i.next(),a.done!==!0;)r=a.value,r.attributes=e(r.key,r.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!="function")throw new j("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!fn(t))throw new j("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const i=this._edges.values();let a,r,o,d;for(;a=i.next(),a.done!==!0;)r=a.value,o=r.source,d=r.target,r.attributes=e(r.key,r.attributes,o.key,d.key,o.attributes,d.attributes,r.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new j("Graph.forEachAdjacencyEntry: expecting a callback.");yt(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new j("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");yt(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new j("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");yt(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new j("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");yt(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!="function")throw new j("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let i,a;for(;i=t.next(),i.done!==!0;)a=i.value,e(a.key,a.attributes)}findNode(e){if(typeof e!="function")throw new j("Graph.findNode: expecting a callback.");const t=this._nodes.values();let i,a;for(;i=t.next(),i.done!==!0;)if(a=i.value,e(a.key,a.attributes))return a.key}mapNodes(e){if(typeof e!="function")throw new j("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let i,a;const r=new Array(this.order);let o=0;for(;i=t.next(),i.done!==!0;)a=i.value,r[o++]=e(a.key,a.attributes);return r}someNode(e){if(typeof e!="function")throw new j("Graph.someNode: expecting a callback.");const t=this._nodes.values();let i,a;for(;i=t.next(),i.done!==!0;)if(a=i.value,e(a.key,a.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new j("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let i,a;for(;i=t.next(),i.done!==!0;)if(a=i.value,!e(a.key,a.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new j("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let i,a;const r=[];for(;i=t.next(),i.done!==!0;)a=i.value,e(a.key,a.attributes)&&r.push(a.key);return r}reduceNodes(e,t){if(typeof e!="function")throw new j("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new j("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let i=t;const a=this._nodes.values();let r,o;for(;r=a.next(),r.done!==!0;)o=r.value,i=e(i,o.key,o.attributes);return i}nodeEntries(){const e=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=e.next();if(t.done)return t;const i=t.value;return{value:{node:i.key,attributes:i.attributes},done:!1}}}}export(){const e=new Array(this._nodes.size);let t=0;this._nodes.forEach((a,r)=>{e[t++]=ca(r,a)});const i=new Array(this._edges.size);return t=0,this._edges.forEach((a,r)=>{i[t++]=ua(this.type,r,a)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:i}}import(e,t=!1){if(e instanceof F)return e.forEachNode((c,l)=>{t?this.mergeNode(c,l):this.addNode(c,l)}),e.forEachEdge((c,l,p,u,h,b,S)=>{t?S?this.mergeUndirectedEdgeWithKey(c,p,u,l):this.mergeDirectedEdgeWithKey(c,p,u,l):S?this.addUndirectedEdgeWithKey(c,p,u,l):this.addDirectedEdgeWithKey(c,p,u,l)}),this;if(!ee(e))throw new j("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!ee(e.attributes))throw new j("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let i,a,r,o,d;if(e.nodes){if(r=e.nodes,!Array.isArray(r))throw new j("Graph.import: invalid nodes. Expecting an array.");for(i=0,a=r.length;i<a;i++){o=r[i],ha(o);const{key:c,attributes:l}=o;t?this.mergeNode(c,l):this.addNode(c,l)}}if(e.edges){let c=!1;if(this.type==="undirected"&&(c=!0),r=e.edges,!Array.isArray(r))throw new j("Graph.import: invalid edges. Expecting an array.");for(i=0,a=r.length;i<a;i++){d=r[i],pa(d);const{source:l,target:p,attributes:u,undirected:h=c}=d;let b;"key"in d?(b=t?h?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:h?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,b.call(this,d.key,l,p,u)):(b=t?h?this.mergeUndirectedEdge:this.mergeDirectedEdge:h?this.addUndirectedEdge:this.addDirectedEdge,b.call(this,l,p,u))}}return this}nullCopy(e){const t=new F(Y({},this._options,e));return t.replaceAttributes(Y({},this.getAttributes())),t}emptyCopy(e){const t=this.nullCopy(e);return this._nodes.forEach((i,a)=>{const r=Y({},i.attributes);i=new t.NodeDataClass(a,r),t._nodes.set(a,i)}),t}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new L(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi=="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new L("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof e.allowSelfLoops=="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new L("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(e),i=this._edges.values();let a,r;for(;a=i.next(),a.done!==!0;)r=a.value,zn(t,"copy",!1,r.undirected,r.key,r.source.key,r.target.key,Y({},r.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((r,o)=>{e[o]=r.attributes});const t={},i={};this._edges.forEach((r,o)=>{const d=r.undirected?"--":"->";let c="",l=r.source.key,p=r.target.key,u;r.undirected&&l>p&&(u=l,l=p,p=u);const h=`(${l})${d}(${p})`;o.startsWith("geid_")?this.multi&&(typeof i[h]>"u"?i[h]=0:i[h]++,c+=`${i[h]}. `):c+=`[${o}]: `,c+=h,t[c]=r.attributes});const a={};for(const r in this)this.hasOwnProperty(r)&&!mn.has(r)&&typeof this[r]!="function"&&typeof r!="symbol"&&(a[r]=this[r]);return a.attributes=this._attributes,a.nodes=e,a.edges=t,ye(a,"constructor",this.constructor),a}}typeof Symbol<"u"&&(F.prototype[Symbol.for("nodejs.util.inspect.custom")]=F.prototype.inspect);ga.forEach(n=>{["add","merge","update"].forEach(e=>{const t=n.name(e),i=e==="add"?zn:ya;n.generateKey?F.prototype[t]=function(a,r,o){return i(this,t,!0,(n.type||this.type)==="undirected",null,a,r,o,e==="update")}:F.prototype[t]=function(a,r,o,d){return i(this,t,!1,(n.type||this.type)==="undirected",a,r,o,d,e==="update")}})});_i(F);Oi(F);ta(F);la(F);class Fn extends F{constructor(e){const t=Y({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new j("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new j('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Un extends F{constructor(e){const t=Y({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new j("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new j('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Bn extends F{constructor(e){const t=Y({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new j("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class qt extends F{constructor(e){const t=Y({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new j("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new j('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Hn extends F{constructor(e){const t=Y({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new j("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new j('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function tt(n){n.from=function(e,t){const i=Y({},e.options,t),a=new n(i);return a.import(e),a}}tt(F);tt(Fn);tt(Un);tt(Bn);tt(qt);tt(Hn);F.Graph=F;F.DirectedGraph=Fn;F.UndirectedGraph=Un;F.MultiGraph=Bn;F.MultiDirectedGraph=qt;F.MultiUndirectedGraph=Hn;F.InvalidArgumentsGraphError=j;F.NotFoundGraphError=w;F.UsageGraphError=L;const ze={eligible:{property:"--chart-site-health-eligible",fallback:"#56b4e9"},hidden:{property:"--chart-site-health-hidden",fallback:"#e69f00"},resource:{property:"--chart-site-health-resource",fallback:"#d4d4d8"},redirect:{property:"--chart-site-health-redirect",fallback:"#9aa7b8"},failed:{property:"--chart-site-health-failed",fallback:"#d55e00"},unchecked:{property:"--chart-site-health-unchecked",fallback:"#a1a1aa"}},wa={property:"--chart-neutral-text-dim",fallback:"#71717a"},xn=2.5,va=9,bn=200,Na=3,ja=1.6;function Kn(n){const e=bn/Math.max(bn,n);return Math.max(Na,va*e**.25)}function ka(n){return Kn(n)*ja}const Sa={eligible:ze.eligible,hidden:ze.hidden,resource:ze.resource,redirect:ze.redirect,failed:ze.failed,unchecked:ze.unchecked,dimmedNode:{property:"--chart-neutral-text-dim",fallback:"#71717a"},edge:wa,edgeDimmed:{property:"--chart-neutral-text-faint",fallback:"#52525b"},edgeActive:{property:"--chart-neutral-text",fallback:"#a1a1aa"},label:{property:"--chart-tooltip-label",fallback:"#e4e4e7"},background:{property:"--chart-tooltip-bg",fallback:"#18181b"}},Ea=/^#(?:[\da-f]{3}|[\da-f]{4}|[\da-f]{6}|[\da-f]{8})$/i,Aa=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}(?:\s*,\s*(?:0|1|0?\.\d+))?\s*\)$/;function yn(n){return Ea.test(n)||Aa.test(n)}const wn=50,_a=8,ct=.75,$a=[{maxRatio:.2,budget:Number.POSITIVE_INFINITY},{maxRatio:.45,budget:60},{maxRatio:ct,budget:24}],La=10;function Mt(n){for(const e of $a)if(n<=e.maxRatio)return e.budget;return La}function Ze(n,e){return n<e?-1:n>e?1:0}function Ta(n){return Math.max(0,Math.min(1,n.linkScoreNormalized??0))}function Qe(n){return n.healthState?n.healthState:Ns(n)}function Ot(n){switch(n){case"eligible":return"Indexable";case"hidden":return"Hidden";case"resource":return"Not a page";case"redirect":return"Moved";case"failed":return"Broken";case"unchecked":return"Not checked"}}function Ga(n){switch(n){case"eligible":return"Indexable";case"hidden":return"Hidden or points elsewhere";case"resource":return"Not a page";case"redirect":return"Moved";case"failed":return"Broken";case"unchecked":return"Not checked"}}function Xe(n){switch(n){case"eligible":return"AI and search engines are allowed to index this page";case"hidden":return"This page tells them not to index it, or points them to another page";case"resource":return"A file rather than a page, such as a text file or a PDF. Answer engines can still read it";case"redirect":return"This address sends visitors to another page";case"failed":return"This page could not be loaded";case"unchecked":return"This page was found but not checked"}}function zt(n){switch(n){case"eligible":return"●";case"hidden":return"◆";case"resource":return"▪";case"redirect":return"↗";case"failed":return"×";case"unchecked":return"○"}}function Ca(n,e){return!!e&&n.nodeKey===e}function Da(n,e=!1,t=1){const i=Kn(t),a=xn+Math.sqrt(Ta(n))*(i-xn);return e?Math.max(ka(t),a):a}function Ra(n,e){switch(n){case"eligible":return e.eligible;case"hidden":return e.hidden;case"resource":return e.resource;case"redirect":return e.redirect;case"failed":return e.failed;case"unchecked":return e.unchecked}}function Pa(n){return .35+Math.min(1.65,Math.log2(Math.max(1,n)+1)*.28)}function Wn(n){return Number.isFinite(n.x)&&Number.isFinite(n.y)}function Ia(n,e,t,i=null){const a=new qt({allowSelfLoops:!0}),r=new Map;for(const d of n)r.has(d.nodeKey)||r.set(d.nodeKey,d);for(const d of[...r.values()].sort((c,l)=>Ze(c.nodeKey,l.nodeKey))){if(!Wn(d))continue;const c=Qe(d),l=Ra(c,t),p=zt(c),u=Ca(d,i);a.addNode(d.nodeKey,{x:d.x,y:d.y,size:Da(d,u,r.size),color:l,baseColor:l,label:`${p} ${d.path||"/"}`,nodeKey:d.nodeKey,url:d.url,path:d.path,depth:d.depth,status:c,glyph:p,forceLabel:u||d.depth===0||d.path.trim()==="/",zIndex:u?2:d.depth===0?1:0,isRoot:u})}const o=new Set;for(const d of[...e].sort((c,l)=>Ze(c.edgeKey,l.edgeKey)))o.has(d.edgeKey)||!d.targetNodeKey||!a.hasNode(d.sourceNodeKey)||!a.hasNode(d.targetNodeKey)||(o.add(d.edgeKey),a.addDirectedEdgeWithKey(d.edgeKey,d.sourceNodeKey,d.targetNodeKey,{size:Pa(d.occurrences),color:t.edge,baseColor:t.edge,followable:d.followable,occurrences:d.occurrences,isTemplate:d.isTemplate===!0,type:"line",zIndex:0}));return{graph:a,layoutAvailable:n.length===0||a.order>0,omittedNodes:Math.max(0,n.length-a.order),omittedEdges:Math.max(0,e.length-a.size)}}function Ma(n,e,t=wn){const i=e.trim().toLocaleLowerCase(),a=Math.max(0,Math.min(wn,Math.floor(t)));return[...n].sort((r,o)=>Ze(r.path||r.url,o.path||o.url)||Ze(r.nodeKey,o.nodeKey)).filter(r=>Wn(r)?i?`${r.path}
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./react-sigma_core.esm.min-D-IM5qRE.js","./vendor-tanstack-Dock0eH1.js","./index-BuZ_xmnc.js","./vendor-radix-4UOaVWza.js","./vendor-recharts-D8rt5lKn.js","./vendor-lucide-nYKv-BB7.js","./vendor-markdown-Bn7fRwrx.js","./vendor-yaml-GWJz5H2G.js","./index-BD8hYPvq.css","./ChartPrimitives-DG35TyhH.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as y,j as s,u as fe,D as En}from"./vendor-tanstack-Dock0eH1.js";import{dg as Ns,dh as js,B as O,di as Ue,dj as ks,T as J,dk as Ss,dl as Es,dm as As,aL as _s,a7 as sn,dn as An,a9 as $s,aa as an,L as $t,f as Ls,j as Dt,ac as Rt,I as we,i as ie,dp as rn,dq as Ts,dr as Gs,ds as Cs,dt as Ds,du as Rs,dv as Ps,dw as Is,dx as Ms,dy as on,dz as Os,dA as zs,dB as Fs,dC as Us,dD as Bs,dE as Ke,dF as Hs,dG as Ks}from"./index-BuZ_xmnc.js";import{S as Ut,p as Ws,u as qs,b as Vs,e as kt,X as Ys,z as Qs,L as ve,T as Pt,q as Lt,I as dn,P as It,C as _n,J as Xs,E as Zs}from"./vendor-lucide-nYKv-BB7.js";import{C as Js,a as ln,b as cn,d as ei,h as un,i as ti,j as ni,o as $n}from"./ChartPrimitives-DG35TyhH.js";import{R as si,C as ii,a as ai,X as ri,Y as oi,T as di,d as li}from"./vendor-recharts-D8rt5lKn.js";const ci=/^www\./i;function Ln(n){if(!n)return null;try{return new URL(n).hostname}catch{return null}}function hn(n){return n.trim().toLowerCase().replace(ci,"")}function ui(n,e){if(!e)return!1;try{return hn(new URL(n).hostname)===hn(e)}catch{return!1}}function Tn(n,e){if(!n)return"";if(!ui(n,e))return n;const t=new URL(n),i=`${t.pathname}${t.search}${t.hash}`;return i===""?"/":i}function hi(n,e){return Tn(n.url,e)||n.path||"/"}var bt={exports:{}},pn;function pi(){if(pn)return bt.exports;pn=1;var n=typeof Reflect=="object"?Reflect:null,e=n&&typeof n.apply=="function"?n.apply:function(g,f,v){return Function.prototype.apply.call(g,f,v)},t;n&&typeof n.ownKeys=="function"?t=n.ownKeys:Object.getOwnPropertySymbols?t=function(g){return Object.getOwnPropertyNames(g).concat(Object.getOwnPropertySymbols(g))}:t=function(g){return Object.getOwnPropertyNames(g)};function i(x){console&&console.warn&&console.warn(x)}var a=Number.isNaN||function(g){return g!==g};function r(){r.init.call(this)}bt.exports=r,bt.exports.once=T,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var o=10;function d(x){if(typeof x!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof x)}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(x){if(typeof x!="number"||x<0||a(x))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+x+".");o=x}}),r.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(g){if(typeof g!="number"||g<0||a(g))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+g+".");return this._maxListeners=g,this};function c(x){return x._maxListeners===void 0?r.defaultMaxListeners:x._maxListeners}r.prototype.getMaxListeners=function(){return c(this)},r.prototype.emit=function(g){for(var f=[],v=1;v<arguments.length;v++)f.push(arguments[v]);var $=g==="error",G=this._events;if(G!==void 0)$=$&&G.error===void 0;else if(!$)return!1;if($){var A;if(f.length>0&&(A=f[0]),A instanceof Error)throw A;var I=new Error("Unhandled error."+(A?" ("+A.message+")":""));throw I.context=A,I}var le=G[g];if(le===void 0)return!1;if(typeof le=="function")e(le,this,f);else for(var W=le.length,Se=S(le,W),v=0;v<W;++v)e(Se[v],this,f);return!0};function l(x,g,f,v){var $,G,A;if(d(f),G=x._events,G===void 0?(G=x._events=Object.create(null),x._eventsCount=0):(G.newListener!==void 0&&(x.emit("newListener",g,f.listener?f.listener:f),G=x._events),A=G[g]),A===void 0)A=G[g]=f,++x._eventsCount;else if(typeof A=="function"?A=G[g]=v?[f,A]:[A,f]:v?A.unshift(f):A.push(f),$=c(x),$>0&&A.length>$&&!A.warned){A.warned=!0;var I=new Error("Possible EventEmitter memory leak detected. "+A.length+" "+String(g)+" listeners added. Use emitter.setMaxListeners() to increase limit");I.name="MaxListenersExceededWarning",I.emitter=x,I.type=g,I.count=A.length,i(I)}return x}r.prototype.addListener=function(g,f){return l(this,g,f,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(g,f){return l(this,g,f,!0)};function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(x,g,f){var v={fired:!1,wrapFn:void 0,target:x,type:g,listener:f},$=p.bind(v);return $.listener=f,v.wrapFn=$,$}r.prototype.once=function(g,f){return d(f),this.on(g,u(this,g,f)),this},r.prototype.prependOnceListener=function(g,f){return d(f),this.prependListener(g,u(this,g,f)),this},r.prototype.removeListener=function(g,f){var v,$,G,A,I;if(d(f),$=this._events,$===void 0)return this;if(v=$[g],v===void 0)return this;if(v===f||v.listener===f)--this._eventsCount===0?this._events=Object.create(null):(delete $[g],$.removeListener&&this.emit("removeListener",g,v.listener||f));else if(typeof v!="function"){for(G=-1,A=v.length-1;A>=0;A--)if(v[A]===f||v[A].listener===f){I=v[A].listener,G=A;break}if(G<0)return this;G===0?v.shift():k(v,G),v.length===1&&($[g]=v[0]),$.removeListener!==void 0&&this.emit("removeListener",g,I||f)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(g){var f,v,$;if(v=this._events,v===void 0)return this;if(v.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):v[g]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete v[g]),this;if(arguments.length===0){var G=Object.keys(v),A;for($=0;$<G.length;++$)A=G[$],A!=="removeListener"&&this.removeAllListeners(A);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(f=v[g],typeof f=="function")this.removeListener(g,f);else if(f!==void 0)for($=f.length-1;$>=0;$--)this.removeListener(g,f[$]);return this};function h(x,g,f){var v=x._events;if(v===void 0)return[];var $=v[g];return $===void 0?[]:typeof $=="function"?f?[$.listener||$]:[$]:f?D($):S($,$.length)}r.prototype.listeners=function(g){return h(this,g,!0)},r.prototype.rawListeners=function(g){return h(this,g,!1)},r.listenerCount=function(x,g){return typeof x.listenerCount=="function"?x.listenerCount(g):b.call(x,g)},r.prototype.listenerCount=b;function b(x){var g=this._events;if(g!==void 0){var f=g[x];if(typeof f=="function")return 1;if(f!==void 0)return f.length}return 0}r.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function S(x,g){for(var f=new Array(g),v=0;v<g;++v)f[v]=x[v];return f}function k(x,g){for(;g+1<x.length;g++)x[g]=x[g+1];x.pop()}function D(x){for(var g=new Array(x.length),f=0;f<g.length;++f)g[f]=x[f].listener||x[f];return g}function T(x,g){return new Promise(function(f,v){function $(A){x.removeListener(g,G),v(A)}function G(){typeof x.removeListener=="function"&&x.removeListener("error",$),f([].slice.call(arguments))}C(x,g,G,{once:!0}),g!=="error"&&z(x,$,{once:!0})})}function z(x,g,f){typeof x.on=="function"&&C(x,"error",g,f)}function C(x,g,f,v){if(typeof x.on=="function")v.once?x.once(g,f):x.on(g,f);else if(typeof x.addEventListener=="function")x.addEventListener(g,function $(G){v.once&&x.removeEventListener(g,$),f(G)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof x)}return bt.exports}var fi=pi();function mi(){const n=arguments[0];for(let e=1,t=arguments.length;e<t;e++)if(arguments[e])for(const i in arguments[e])n[i]=arguments[e][i];return n}let Y=mi;typeof Object.assign=="function"&&(Y=Object.assign);function je(n,e,t,i){const a=n._nodes.get(e);let r=null;return a&&(i==="mixed"?r=a.out&&a.out[t]||a.undirected&&a.undirected[t]:i==="directed"?r=a.out&&a.out[t]:r=a.undirected&&a.undirected[t]),r}function ee(n){return typeof n=="object"&&n!==null}function Gn(n){let e;for(e in n)return!1;return!0}function ye(n,e,t){Object.defineProperty(n,e,{enumerable:!1,configurable:!1,writable:!0,value:t})}function ke(n,e,t){const i={enumerable:!0,configurable:!0};typeof t=="function"?i.get=t:(i.value=t,i.writable=!1),Object.defineProperty(n,e,i)}function fn(n){return!(!ee(n)||n.attributes&&!Array.isArray(n.attributes))}function gi(){let n=Math.floor(Math.random()*256)&255;return()=>n++}function Ge(){const n=arguments;let e=null,t=-1;return{[Symbol.iterator](){return this},next(){let i=null;do{if(e===null){if(t++,t>=n.length)return{done:!0};e=n[t][Symbol.iterator]()}if(i=e.next(),i.done){e=null;continue}break}while(!0);return i}}}function Je(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class Bt extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class j extends Bt{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,j.prototype.constructor)}}class w extends Bt{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,w.prototype.constructor)}}class L extends Bt{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,L.prototype.constructor)}}function Cn(n,e){this.key=n,this.attributes=e,this.clear()}Cn.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function Dn(n,e){this.key=n,this.attributes=e,this.clear()}Dn.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Rn(n,e){this.key=n,this.attributes=e,this.clear()}Rn.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function et(n,e,t,i,a){this.key=e,this.attributes=a,this.undirected=n,this.source=t,this.target=i}et.prototype.attach=function(){let n="out",e="in";this.undirected&&(n=e="undirected");const t=this.source.key,i=this.target.key;this.source[n][i]=this,!(this.undirected&&t===i)&&(this.target[e][t]=this)};et.prototype.attachMulti=function(){let n="out",e="in";const t=this.source.key,i=this.target.key;this.undirected&&(n=e="undirected");const a=this.source[n],r=a[i];if(typeof r>"u"){a[i]=this,this.undirected&&t===i||(this.target[e][t]=this);return}r.previous=this,this.next=r,a[i]=this,this.target[e][t]=this};et.prototype.detach=function(){const n=this.source.key,e=this.target.key;let t="out",i="in";this.undirected&&(t=i="undirected"),delete this.source[t][e],delete this.target[i][n]};et.prototype.detachMulti=function(){const n=this.source.key,e=this.target.key;let t="out",i="in";this.undirected&&(t=i="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][e],delete this.target[i][n]):(this.next.previous=void 0,this.source[t][e]=this.next,this.target[i][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const Pn=0,In=1,xi=2,Mn=3;function Ce(n,e,t,i,a,r,o){let d,c,l,p;if(i=""+i,t===Pn){if(d=n._nodes.get(i),!d)throw new w(`Graph.${e}: could not find the "${i}" node in the graph.`);l=a,p=r}else if(t===Mn){if(a=""+a,c=n._edges.get(a),!c)throw new w(`Graph.${e}: could not find the "${a}" edge in the graph.`);const u=c.source.key,h=c.target.key;if(i===u)d=c.target;else if(i===h)d=c.source;else throw new w(`Graph.${e}: the "${i}" node is not attached to the "${a}" edge (${u}, ${h}).`);l=r,p=o}else{if(c=n._edges.get(i),!c)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`);t===In?d=c.source:d=c.target,l=a,p=r}return[d,l,p]}function bi(n,e,t){n.prototype[e]=function(i,a,r){const[o,d]=Ce(this,e,t,i,a,r);return o.attributes[d]}}function yi(n,e,t){n.prototype[e]=function(i,a){const[r]=Ce(this,e,t,i,a);return r.attributes}}function wi(n,e,t){n.prototype[e]=function(i,a,r){const[o,d]=Ce(this,e,t,i,a,r);return o.attributes.hasOwnProperty(d)}}function vi(n,e,t){n.prototype[e]=function(i,a,r,o){const[d,c,l]=Ce(this,e,t,i,a,r,o);return d.attributes[c]=l,this.emit("nodeAttributesUpdated",{key:d.key,type:"set",attributes:d.attributes,name:c}),this}}function Ni(n,e,t){n.prototype[e]=function(i,a,r,o){const[d,c,l]=Ce(this,e,t,i,a,r,o);if(typeof l!="function")throw new j(`Graph.${e}: updater should be a function.`);const p=d.attributes,u=l(p[c]);return p[c]=u,this.emit("nodeAttributesUpdated",{key:d.key,type:"set",attributes:d.attributes,name:c}),this}}function ji(n,e,t){n.prototype[e]=function(i,a,r){const[o,d]=Ce(this,e,t,i,a,r);return delete o.attributes[d],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:d}),this}}function ki(n,e,t){n.prototype[e]=function(i,a,r){const[o,d]=Ce(this,e,t,i,a,r);if(!ee(d))throw new j(`Graph.${e}: provided attributes are not a plain object.`);return o.attributes=d,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function Si(n,e,t){n.prototype[e]=function(i,a,r){const[o,d]=Ce(this,e,t,i,a,r);if(!ee(d))throw new j(`Graph.${e}: provided attributes are not a plain object.`);return Y(o.attributes,d),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:d}),this}}function Ei(n,e,t){n.prototype[e]=function(i,a,r){const[o,d]=Ce(this,e,t,i,a,r);if(typeof d!="function")throw new j(`Graph.${e}: provided updater is not a function.`);return o.attributes=d(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const Ai=[{name:n=>`get${n}Attribute`,attacher:bi},{name:n=>`get${n}Attributes`,attacher:yi},{name:n=>`has${n}Attribute`,attacher:wi},{name:n=>`set${n}Attribute`,attacher:vi},{name:n=>`update${n}Attribute`,attacher:Ni},{name:n=>`remove${n}Attribute`,attacher:ji},{name:n=>`replace${n}Attributes`,attacher:ki},{name:n=>`merge${n}Attributes`,attacher:Si},{name:n=>`update${n}Attributes`,attacher:Ei}];function _i(n){Ai.forEach(function({name:e,attacher:t}){t(n,e("Node"),Pn),t(n,e("Source"),In),t(n,e("Target"),xi),t(n,e("Opposite"),Mn)})}function $i(n,e,t){n.prototype[e]=function(i,a){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,d=""+a;if(a=arguments[2],r=je(this,o,d,t),!r)throw new w(`Graph.${e}: could not find an edge for the given path ("${o}" - "${d}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,r=this._edges.get(i),!r)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return r.attributes[a]}}function Li(n,e,t){n.prototype[e]=function(i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const r=""+i,o=""+arguments[1];if(a=je(this,r,o,t),!a)throw new w(`Graph.${e}: could not find an edge for the given path ("${r}" - "${o}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,a=this._edges.get(i),!a)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return a.attributes}}function Ti(n,e,t){n.prototype[e]=function(i,a){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,d=""+a;if(a=arguments[2],r=je(this,o,d,t),!r)throw new w(`Graph.${e}: could not find an edge for the given path ("${o}" - "${d}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,r=this._edges.get(i),!r)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return r.attributes.hasOwnProperty(a)}}function Gi(n,e,t){n.prototype[e]=function(i,a,r){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const d=""+i,c=""+a;if(a=arguments[2],r=arguments[3],o=je(this,d,c,t),!o)throw new w(`Graph.${e}: could not find an edge for the given path ("${d}" - "${c}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,o=this._edges.get(i),!o)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return o.attributes[a]=r,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:a}),this}}function Ci(n,e,t){n.prototype[e]=function(i,a,r){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const d=""+i,c=""+a;if(a=arguments[2],r=arguments[3],o=je(this,d,c,t),!o)throw new w(`Graph.${e}: could not find an edge for the given path ("${d}" - "${c}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,o=this._edges.get(i),!o)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(typeof r!="function")throw new j(`Graph.${e}: updater should be a function.`);return o.attributes[a]=r(o.attributes[a]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:a}),this}}function Di(n,e,t){n.prototype[e]=function(i,a){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,d=""+a;if(a=arguments[2],r=je(this,o,d,t),!r)throw new w(`Graph.${e}: could not find an edge for the given path ("${o}" - "${d}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,r=this._edges.get(i),!r)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return delete r.attributes[a],this.emit("edgeAttributesUpdated",{key:r.key,type:"remove",attributes:r.attributes,name:a}),this}}function Ri(n,e,t){n.prototype[e]=function(i,a){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,d=""+a;if(a=arguments[2],r=je(this,o,d,t),!r)throw new w(`Graph.${e}: could not find an edge for the given path ("${o}" - "${d}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,r=this._edges.get(i),!r)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(!ee(a))throw new j(`Graph.${e}: provided attributes are not a plain object.`);return r.attributes=a,this.emit("edgeAttributesUpdated",{key:r.key,type:"replace",attributes:r.attributes}),this}}function Pi(n,e,t){n.prototype[e]=function(i,a){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,d=""+a;if(a=arguments[2],r=je(this,o,d,t),!r)throw new w(`Graph.${e}: could not find an edge for the given path ("${o}" - "${d}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,r=this._edges.get(i),!r)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(!ee(a))throw new j(`Graph.${e}: provided attributes are not a plain object.`);return Y(r.attributes,a),this.emit("edgeAttributesUpdated",{key:r.key,type:"merge",attributes:r.attributes,data:a}),this}}function Ii(n,e,t){n.prototype[e]=function(i,a){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new L(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,d=""+a;if(a=arguments[2],r=je(this,o,d,t),!r)throw new w(`Graph.${e}: could not find an edge for the given path ("${o}" - "${d}").`)}else{if(t!=="mixed")throw new L(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,r=this._edges.get(i),!r)throw new w(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(typeof a!="function")throw new j(`Graph.${e}: provided updater is not a function.`);return r.attributes=a(r.attributes),this.emit("edgeAttributesUpdated",{key:r.key,type:"update",attributes:r.attributes}),this}}const Mi=[{name:n=>`get${n}Attribute`,attacher:$i},{name:n=>`get${n}Attributes`,attacher:Li},{name:n=>`has${n}Attribute`,attacher:Ti},{name:n=>`set${n}Attribute`,attacher:Gi},{name:n=>`update${n}Attribute`,attacher:Ci},{name:n=>`remove${n}Attribute`,attacher:Di},{name:n=>`replace${n}Attributes`,attacher:Ri},{name:n=>`merge${n}Attributes`,attacher:Pi},{name:n=>`update${n}Attributes`,attacher:Ii}];function Oi(n){Mi.forEach(function({name:e,attacher:t}){t(n,e("Edge"),"mixed"),t(n,e("DirectedEdge"),"directed"),t(n,e("UndirectedEdge"),"undirected")})}const zi=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function Fi(n,e,t,i){let a=!1;for(const r in e){if(r===i)continue;const o=e[r];if(a=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),n&&a)return o.key}}function Ui(n,e,t,i){let a,r,o,d=!1;for(const c in e)if(c!==i){a=e[c];do{if(r=a.source,o=a.target,d=t(a.key,a.attributes,r.key,o.key,r.attributes,o.attributes,a.undirected),n&&d)return a.key;a=a.next}while(a!==void 0)}}function Tt(n,e){const t=Object.keys(n),i=t.length;let a,r=0;return{[Symbol.iterator](){return this},next(){do if(a)a=a.next;else{if(r>=i)return{done:!0};const o=t[r++];if(o===e){a=void 0;continue}a=n[o]}while(!a);return{done:!1,value:{edge:a.key,attributes:a.attributes,source:a.source.key,target:a.target.key,sourceAttributes:a.source.attributes,targetAttributes:a.target.attributes,undirected:a.undirected}}}}}function Bi(n,e,t,i){const a=e[t];if(!a)return;const r=a.source,o=a.target;if(i(a.key,a.attributes,r.key,o.key,r.attributes,o.attributes,a.undirected)&&n)return a.key}function Hi(n,e,t,i){let a=e[t];if(!a)return;let r=!1;do{if(r=i(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),n&&r)return a.key;a=a.next}while(a!==void 0)}function Gt(n,e){let t=n[e];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const a={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:a}}};let i=!1;return{[Symbol.iterator](){return this},next(){return i===!0?{done:!0}:(i=!0,{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}})}}}function Ki(n,e){if(n.size===0)return[];if(e==="mixed"||e===n.type)return Array.from(n._edges.keys());const t=e==="undirected"?n.undirectedSize:n.directedSize,i=new Array(t),a=e==="undirected",r=n._edges.values();let o=0,d,c;for(;d=r.next(),d.done!==!0;)c=d.value,c.undirected===a&&(i[o++]=c.key);return i}function On(n,e,t,i){if(e.size===0)return;const a=t!=="mixed"&&t!==e.type,r=t==="undirected";let o,d,c=!1;const l=e._edges.values();for(;o=l.next(),o.done!==!0;){if(d=o.value,a&&d.undirected!==r)continue;const{key:p,attributes:u,source:h,target:b}=d;if(c=i(p,u,h.key,b.key,h.attributes,b.attributes,d.undirected),n&&c)return p}}function Wi(n,e){if(n.size===0)return Je();const t=e!=="mixed"&&e!==n.type,i=e==="undirected",a=n._edges.values();return{[Symbol.iterator](){return this},next(){let r,o;for(;;){if(r=a.next(),r.done)return r;if(o=r.value,!(t&&o.undirected!==i))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}}}}function Ht(n,e,t,i,a,r){const o=e?Ui:Fi;let d;if(t!=="undirected"&&(i!=="out"&&(d=o(n,a.in,r),n&&d)||i!=="in"&&(d=o(n,a.out,r,i?void 0:a.key),n&&d))||t!=="directed"&&(d=o(n,a.undirected,r),n&&d))return d}function qi(n,e,t,i){const a=[];return Ht(!1,n,e,t,i,function(r){a.push(r)}),a}function Vi(n,e,t){let i=Je();return n!=="undirected"&&(e!=="out"&&typeof t.in<"u"&&(i=Ge(i,Tt(t.in))),e!=="in"&&typeof t.out<"u"&&(i=Ge(i,Tt(t.out,e?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(i=Ge(i,Tt(t.undirected))),i}function Kt(n,e,t,i,a,r,o){const d=t?Hi:Bi;let c;if(e!=="undirected"&&(typeof a.in<"u"&&i!=="out"&&(c=d(n,a.in,r,o),n&&c)||typeof a.out<"u"&&i!=="in"&&(i||a.key!==r)&&(c=d(n,a.out,r,o),n&&c))||e!=="directed"&&typeof a.undirected<"u"&&(c=d(n,a.undirected,r,o),n&&c))return c}function Yi(n,e,t,i,a){const r=[];return Kt(!1,n,e,t,i,a,function(o){r.push(o)}),r}function Qi(n,e,t,i){let a=Je();return n!=="undirected"&&(typeof t.in<"u"&&e!=="out"&&i in t.in&&(a=Ge(a,Gt(t.in,i))),typeof t.out<"u"&&e!=="in"&&i in t.out&&(e||t.key!==i)&&(a=Ge(a,Gt(t.out,i)))),n!=="directed"&&typeof t.undirected<"u"&&i in t.undirected&&(a=Ge(a,Gt(t.undirected,i))),a}function Xi(n,e){const{name:t,type:i,direction:a}=e;n.prototype[t]=function(r,o){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return[];if(!arguments.length)return Ki(this,i);if(arguments.length===1){r=""+r;const d=this._nodes.get(r);if(typeof d>"u")throw new w(`Graph.${t}: could not find the "${r}" node in the graph.`);return qi(this.multi,i==="mixed"?this.type:i,a,d)}if(arguments.length===2){r=""+r,o=""+o;const d=this._nodes.get(r);if(!d)throw new w(`Graph.${t}: could not find the "${r}" source node in the graph.`);if(!this._nodes.has(o))throw new w(`Graph.${t}: could not find the "${o}" target node in the graph.`);return Yi(i,this.multi,a,d,o)}throw new j(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Zi(n,e){const{name:t,type:i,direction:a}=e,r="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[r]=function(l,p,u){if(!(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)){if(arguments.length===1)return u=l,On(!1,this,i,u);if(arguments.length===2){l=""+l,u=p;const h=this._nodes.get(l);if(typeof h>"u")throw new w(`Graph.${r}: could not find the "${l}" node in the graph.`);return Ht(!1,this.multi,i==="mixed"?this.type:i,a,h,u)}if(arguments.length===3){l=""+l,p=""+p;const h=this._nodes.get(l);if(!h)throw new w(`Graph.${r}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(p))throw new w(`Graph.${r}: could not find the "${p}" target node in the graph.`);return Kt(!1,i,this.multi,a,h,p,u)}throw new j(`Graph.${r}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(){const l=Array.prototype.slice.call(arguments),p=l.pop();let u;if(l.length===0){let h=0;i!=="directed"&&(h+=this.undirectedSize),i!=="undirected"&&(h+=this.directedSize),u=new Array(h);let b=0;l.push((S,k,D,T,z,C,x)=>{u[b++]=p(S,k,D,T,z,C,x)})}else u=[],l.push((h,b,S,k,D,T,z)=>{u.push(p(h,b,S,k,D,T,z))});return this[r].apply(this,l),u};const d="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[d]=function(){const l=Array.prototype.slice.call(arguments),p=l.pop(),u=[];return l.push((h,b,S,k,D,T,z)=>{p(h,b,S,k,D,T,z)&&u.push(h)}),this[r].apply(this,l),u};const c="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[c]=function(){let l=Array.prototype.slice.call(arguments);if(l.length<2||l.length>4)throw new j(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${l.length}).`);if(typeof l[l.length-1]=="function"&&typeof l[l.length-2]!="function")throw new j(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let p,u;l.length===2?(p=l[0],u=l[1],l=[]):l.length===3?(p=l[1],u=l[2],l=[l[0]]):l.length===4&&(p=l[2],u=l[3],l=[l[0],l[1]]);let h=u;return l.push((b,S,k,D,T,z,C)=>{h=p(h,b,S,k,D,T,z,C)}),this[r].apply(this,l),h}}function Ji(n,e){const{name:t,type:i,direction:a}=e,r="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[r]=function(c,l,p){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return!1;if(arguments.length===1)return p=c,On(!0,this,i,p);if(arguments.length===2){c=""+c,p=l;const u=this._nodes.get(c);if(typeof u>"u")throw new w(`Graph.${r}: could not find the "${c}" node in the graph.`);return Ht(!0,this.multi,i==="mixed"?this.type:i,a,u,p)}if(arguments.length===3){c=""+c,l=""+l;const u=this._nodes.get(c);if(!u)throw new w(`Graph.${r}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(l))throw new w(`Graph.${r}: could not find the "${l}" target node in the graph.`);return Kt(!0,i,this.multi,a,u,l,p)}throw new j(`Graph.${r}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(){const c=Array.prototype.slice.call(arguments),l=c.pop();return c.push((u,h,b,S,k,D,T)=>l(u,h,b,S,k,D,T)),!!this[r].apply(this,c)};const d="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[d]=function(){const c=Array.prototype.slice.call(arguments),l=c.pop();return c.push((u,h,b,S,k,D,T)=>!l(u,h,b,S,k,D,T)),!this[r].apply(this,c)}}function ea(n,e){const{name:t,type:i,direction:a}=e,r=t.slice(0,-1)+"Entries";n.prototype[r]=function(o,d){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return Je();if(!arguments.length)return Wi(this,i);if(arguments.length===1){o=""+o;const c=this._nodes.get(o);if(!c)throw new w(`Graph.${r}: could not find the "${o}" node in the graph.`);return Vi(i,a,c)}if(arguments.length===2){o=""+o,d=""+d;const c=this._nodes.get(o);if(!c)throw new w(`Graph.${r}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(d))throw new w(`Graph.${r}: could not find the "${d}" target node in the graph.`);return Qi(i,a,c,d)}throw new j(`Graph.${r}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function ta(n){zi.forEach(e=>{Xi(n,e),Zi(n,e),Ji(n,e),ea(n,e)})}const na=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function St(){this.A=null,this.B=null}St.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};St.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function rt(n,e,t,i,a){for(const r in i){const o=i[r],d=o.source,c=o.target,l=d===t?c:d;if(e&&e.has(l.key))continue;const p=a(l.key,l.attributes);if(n&&p)return l.key}}function Wt(n,e,t,i,a){if(e!=="mixed"){if(e==="undirected")return rt(n,null,i,i.undirected,a);if(typeof t=="string")return rt(n,null,i,i[t],a)}const r=new St;let o;if(e!=="undirected"){if(t!=="out"){if(o=rt(n,null,i,i.in,a),n&&o)return o;r.wrap(i.in)}if(t!=="in"){if(o=rt(n,r,i,i.out,a),n&&o)return o;r.wrap(i.out)}}if(e!=="directed"&&(o=rt(n,r,i,i.undirected,a),n&&o))return o}function sa(n,e,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof e=="string")return Object.keys(t[e])}const i=[];return Wt(!1,n,e,t,function(a){i.push(a)}),i}function ot(n,e,t){const i=Object.keys(t),a=i.length;let r=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(r>=a)return n&&n.wrap(t),{done:!0};const d=t[i[r++]],c=d.source,l=d.target;if(o=c===e?l:c,n&&n.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function ia(n,e,t){if(n!=="mixed"){if(n==="undirected")return ot(null,t,t.undirected);if(typeof e=="string")return ot(null,t,t[e])}let i=Je();const a=new St;return n!=="undirected"&&(e!=="out"&&(i=Ge(i,ot(a,t,t.in))),e!=="in"&&(i=Ge(i,ot(a,t,t.out)))),n!=="directed"&&(i=Ge(i,ot(a,t,t.undirected))),i}function aa(n,e){const{name:t,type:i,direction:a}=e;n.prototype[t]=function(r){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return[];r=""+r;const o=this._nodes.get(r);if(typeof o>"u")throw new w(`Graph.${t}: could not find the "${r}" node in the graph.`);return sa(i==="mixed"?this.type:i,a,o)}}function ra(n,e){const{name:t,type:i,direction:a}=e,r="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[r]=function(l,p){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return;l=""+l;const u=this._nodes.get(l);if(typeof u>"u")throw new w(`Graph.${r}: could not find the "${l}" node in the graph.`);Wt(!1,i==="mixed"?this.type:i,a,u,p)};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(l,p){const u=[];return this[r](l,(h,b)=>{u.push(p(h,b))}),u};const d="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[d]=function(l,p){const u=[];return this[r](l,(h,b)=>{p(h,b)&&u.push(h)}),u};const c="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[c]=function(l,p,u){if(arguments.length<3)throw new j(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let h=u;return this[r](l,(b,S)=>{h=p(h,b,S)}),h}}function oa(n,e){const{name:t,type:i,direction:a}=e,r=t[0].toUpperCase()+t.slice(1,-1),o="find"+r;n.prototype[o]=function(l,p){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return;l=""+l;const u=this._nodes.get(l);if(typeof u>"u")throw new w(`Graph.${o}: could not find the "${l}" node in the graph.`);return Wt(!0,i==="mixed"?this.type:i,a,u,p)};const d="some"+r;n.prototype[d]=function(l,p){return!!this[o](l,p)};const c="every"+r;n.prototype[c]=function(l,p){return!this[o](l,(h,b)=>!p(h,b))}}function da(n,e){const{name:t,type:i,direction:a}=e,r=t.slice(0,-1)+"Entries";n.prototype[r]=function(o){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return Je();o=""+o;const d=this._nodes.get(o);if(typeof d>"u")throw new w(`Graph.${r}: could not find the "${o}" node in the graph.`);return ia(i==="mixed"?this.type:i,a,d)}}function la(n){na.forEach(e=>{aa(n,e),ra(n,e),oa(n,e),da(n,e)})}function yt(n,e,t,i,a){const r=i._nodes.values(),o=i.type;let d,c,l,p,u,h;for(;d=r.next(),d.done!==!0;){let b=!1;if(c=d.value,o!=="undirected"){p=c.out;for(l in p){u=p[l];do h=u.target,b=!0,a(c.key,h.key,c.attributes,h.attributes,u.key,u.attributes,u.undirected),u=u.next;while(u)}}if(o!=="directed"){p=c.undirected;for(l in p)if(!(e&&c.key>l)){u=p[l];do h=u.target,h.key!==l&&(h=u.source),b=!0,a(c.key,h.key,c.attributes,h.attributes,u.key,u.attributes,u.undirected),u=u.next;while(u)}}t&&!b&&a(c.key,null,c.attributes,null,null,null,null)}}function ca(n,e){const t={key:n};return Gn(e.attributes)||(t.attributes=Y({},e.attributes)),t}function ua(n,e,t){const i={key:e,source:t.source.key,target:t.target.key};return Gn(t.attributes)||(i.attributes=Y({},t.attributes)),n==="mixed"&&t.undirected&&(i.undirected=!0),i}function ha(n){if(!ee(n))throw new j('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new j("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!ee(n.attributes)||n.attributes===null))throw new j("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function pa(n){if(!ee(n))throw new j('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new j("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new j("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!ee(n.attributes)||n.attributes===null))throw new j("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new j("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const fa=gi(),ma=new Set(["directed","undirected","mixed"]),mn=new Set(["domain","_events","_eventsCount","_maxListeners"]),ga=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],xa={allowSelfLoops:!0,multi:!1,type:"mixed"};function ba(n,e,t){if(t&&!ee(t))throw new j(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(e=""+e,t=t||{},n._nodes.has(e))throw new L(`Graph.addNode: the "${e}" node already exist in the graph.`);const i=new n.NodeDataClass(e,t);return n._nodes.set(e,i),n.emit("nodeAdded",{key:e,attributes:t}),i}function gn(n,e,t){const i=new n.NodeDataClass(e,t);return n._nodes.set(e,i),n.emit("nodeAdded",{key:e,attributes:t}),i}function zn(n,e,t,i,a,r,o,d){if(!i&&n.type==="undirected")throw new L(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(i&&n.type==="directed")throw new L(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(d&&!ee(d))throw new j(`Graph.${e}: invalid attributes. Expecting an object but got "${d}"`);if(r=""+r,o=""+o,d=d||{},!n.allowSelfLoops&&r===o)throw new L(`Graph.${e}: source & target are the same ("${r}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const c=n._nodes.get(r),l=n._nodes.get(o);if(!c)throw new w(`Graph.${e}: source node "${r}" not found.`);if(!l)throw new w(`Graph.${e}: target node "${o}" not found.`);const p={key:null,undirected:i,source:r,target:o,attributes:d};if(t)a=n._edgeKeyGenerator();else if(a=""+a,n._edges.has(a))throw new L(`Graph.${e}: the "${a}" edge already exists in the graph.`);if(!n.multi&&(i?typeof c.undirected[o]<"u":typeof c.out[o]<"u"))throw new L(`Graph.${e}: an edge linking "${r}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const u=new et(i,a,c,l,d);n._edges.set(a,u);const h=r===o;return i?(c.undirectedDegree++,l.undirectedDegree++,h&&(c.undirectedLoops++,n._undirectedSelfLoopCount++)):(c.outDegree++,l.inDegree++,h&&(c.directedLoops++,n._directedSelfLoopCount++)),n.multi?u.attachMulti():u.attach(),i?n._undirectedSize++:n._directedSize++,p.key=a,n.emit("edgeAdded",p),a}function ya(n,e,t,i,a,r,o,d,c){if(!i&&n.type==="undirected")throw new L(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(i&&n.type==="directed")throw new L(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(d){if(c){if(typeof d!="function")throw new j(`Graph.${e}: invalid updater function. Expecting a function but got "${d}"`)}else if(!ee(d))throw new j(`Graph.${e}: invalid attributes. Expecting an object but got "${d}"`)}r=""+r,o=""+o;let l;if(c&&(l=d,d=void 0),!n.allowSelfLoops&&r===o)throw new L(`Graph.${e}: source & target are the same ("${r}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let p=n._nodes.get(r),u=n._nodes.get(o),h,b;if(!t&&(h=n._edges.get(a),h)){if((h.source.key!==r||h.target.key!==o)&&(!i||h.source.key!==o||h.target.key!==r))throw new L(`Graph.${e}: inconsistency detected when attempting to merge the "${a}" edge with "${r}" source & "${o}" target vs. ("${h.source.key}", "${h.target.key}").`);b=h}if(!b&&!n.multi&&p&&(b=i?p.undirected[o]:p.out[o]),b){const z=[b.key,!1,!1,!1];if(c?!l:!d)return z;if(c){const C=b.attributes;b.attributes=l(C),n.emit("edgeAttributesUpdated",{type:"replace",key:b.key,attributes:b.attributes})}else Y(b.attributes,d),n.emit("edgeAttributesUpdated",{type:"merge",key:b.key,attributes:b.attributes,data:d});return z}d=d||{},c&&l&&(d=l(d));const S={key:null,undirected:i,source:r,target:o,attributes:d};if(t)a=n._edgeKeyGenerator();else if(a=""+a,n._edges.has(a))throw new L(`Graph.${e}: the "${a}" edge already exists in the graph.`);let k=!1,D=!1;p||(p=gn(n,r,{}),k=!0,r===o&&(u=p,D=!0)),u||(u=gn(n,o,{}),D=!0),h=new et(i,a,p,u,d),n._edges.set(a,h);const T=r===o;return i?(p.undirectedDegree++,u.undirectedDegree++,T&&(p.undirectedLoops++,n._undirectedSelfLoopCount++)):(p.outDegree++,u.inDegree++,T&&(p.directedLoops++,n._directedSelfLoopCount++)),n.multi?h.attachMulti():h.attach(),i?n._undirectedSize++:n._directedSize++,S.key=a,n.emit("edgeAdded",S),[a,!0,k,D]}function We(n,e){n._edges.delete(e.key);const{source:t,target:i,attributes:a}=e,r=e.undirected,o=t===i;r?(t.undirectedDegree--,i.undirectedDegree--,o&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,i.inDegree--,o&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?e.detachMulti():e.detach(),r?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:e.key,attributes:a,source:t.key,target:i.key,undirected:r})}class F extends fi.EventEmitter{constructor(e){if(super(),e=Y({},xa,e),typeof e.multi!="boolean")throw new j(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!ma.has(e.type))throw new j(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new j(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const t=e.type==="mixed"?Cn:e.type==="directed"?Dn:Rn;ye(this,"NodeDataClass",t);const i="geid_"+fa()+"_";let a=0;const r=()=>{let o;do o=i+a++;while(this._edges.has(o));return o};ye(this,"_attributes",{}),ye(this,"_nodes",new Map),ye(this,"_edges",new Map),ye(this,"_directedSize",0),ye(this,"_undirectedSize",0),ye(this,"_directedSelfLoopCount",0),ye(this,"_undirectedSelfLoopCount",0),ye(this,"_edgeKeyGenerator",r),ye(this,"_options",e),mn.forEach(o=>ye(this,o,this[o])),ke(this,"order",()=>this._nodes.size),ke(this,"size",()=>this._edges.size),ke(this,"directedSize",()=>this._directedSize),ke(this,"undirectedSize",()=>this._undirectedSize),ke(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),ke(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),ke(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),ke(this,"multi",this._options.multi),ke(this,"type",this._options.type),ke(this,"allowSelfLoops",this._options.allowSelfLoops),ke(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,t){if(this.type==="undirected")return!1;if(arguments.length===1){const i=""+e,a=this._edges.get(i);return!!a&&!a.undirected}else if(arguments.length===2){e=""+e,t=""+t;const i=this._nodes.get(e);return i?i.out.hasOwnProperty(t):!1}throw new j(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type==="directed")return!1;if(arguments.length===1){const i=""+e,a=this._edges.get(i);return!!a&&a.undirected}else if(arguments.length===2){e=""+e,t=""+t;const i=this._nodes.get(e);return i?i.undirected.hasOwnProperty(t):!1}throw new j(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){const i=""+e;return this._edges.has(i)}else if(arguments.length===2){e=""+e,t=""+t;const i=this._nodes.get(e);return i?typeof i.out<"u"&&i.out.hasOwnProperty(t)||typeof i.undirected<"u"&&i.undirected.hasOwnProperty(t):!1}throw new j(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type==="undirected")return;if(e=""+e,t=""+t,this.multi)throw new L("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const i=this._nodes.get(e);if(!i)throw new w(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new w(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const a=i.out&&i.out[t]||void 0;if(a)return a.key}undirectedEdge(e,t){if(this.type==="directed")return;if(e=""+e,t=""+t,this.multi)throw new L("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const i=this._nodes.get(e);if(!i)throw new w(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new w(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const a=i.undirected&&i.undirected[t]||void 0;if(a)return a.key}edge(e,t){if(this.multi)throw new L("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new w(`Graph.edge: could not find the "${t}" target node in the graph.`);const a=i.out&&i.out[t]||i.undirected&&i.undirected[t]||void 0;if(a)return a.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in i.in||t in i.out}areOutNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in i.out}areInNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in i.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:t in i.undirected}areNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(t in i.in||t in i.out)||this.type!=="directed"&&t in i.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in i.in||this.type!=="directed"&&t in i.undirected}areOutboundNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new w(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in i.out||this.type!=="directed"&&t in i.undirected}inDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.inDegree),i}outboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.outDegree),i}degree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.degree: could not find the "${e}" node in the graph.`);let i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.inDegree+t.outDegree),i}inDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,a=0;return this.type!=="directed"&&(i+=t.undirectedDegree,a+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.inDegree,a+=t.directedLoops),i-a}outboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,a=0;return this.type!=="directed"&&(i+=t.undirectedDegree,a+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.outDegree,a+=t.directedLoops),i-a}degreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,a=0;return this.type!=="directed"&&(i+=t.undirectedDegree,a+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.inDegree+t.outDegree,a+=t.directedLoops*2),i-a}source(e){e=""+e;const t=this._edges.get(e);if(!t)throw new w(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;const t=this._edges.get(e);if(!t)throw new w(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;const t=this._edges.get(e);if(!t)throw new w(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=""+e,t=""+t;const i=this._edges.get(t);if(!i)throw new w(`Graph.opposite: could not find the "${t}" edge in the graph.`);const a=i.source.key,r=i.target.key;if(e===a)return r;if(e===r)return a;throw new w(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${a}, ${r}).`)}hasExtremity(e,t){e=""+e,t=""+t;const i=this._edges.get(e);if(!i)throw new w(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return i.source.key===t||i.target.key===t}isUndirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new w(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new w(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;const t=this._edges.get(e);if(!t)throw new w(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return ba(this,e,t).key}mergeNode(e,t){if(t&&!ee(t))throw new j(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let i=this._nodes.get(e);return i?(t&&(Y(i.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:i.attributes,data:t})),[e,!1]):(i=new this.NodeDataClass(e,t),this._nodes.set(e,i),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!="function")throw new j(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let i=this._nodes.get(e);if(i){if(t){const r=i.attributes;i.attributes=t(r),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:i.attributes})}return[e,!1]}const a=t?t({}):{};return i=new this.NodeDataClass(e,a),this._nodes.set(e,i),this.emit("nodeAdded",{key:e,attributes:a}),[e,!0]}dropNode(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new w(`Graph.dropNode: could not find the "${e}" node in the graph.`);let i;if(this.type!=="undirected"){for(const a in t.out){i=t.out[a];do We(this,i),i=i.next;while(i)}for(const a in t.in){i=t.in[a];do We(this,i),i=i.next;while(i)}}if(this.type!=="directed")for(const a in t.undirected){i=t.undirected[a];do We(this,i),i=i.next;while(i)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){const i=""+arguments[0],a=""+arguments[1];if(t=je(this,i,a,this.type),!t)throw new w(`Graph.dropEdge: could not find the "${i}" -> "${a}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new w(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return We(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new L("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new L("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");e=""+e,t=""+t;const i=je(this,e,t,"directed");if(!i)throw new w(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return We(this,i),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new L("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new L("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const i=je(this,e,t,"undirected");if(!i)throw new w(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return We(this,i),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const e=this._nodes.values();let t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!="function")throw new j("Graph.updateAttribute: updater should be a function.");const i=this._attributes[e];return this._attributes[e]=t(i),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!ee(e))throw new j("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!ee(e))throw new j("Graph.mergeAttributes: provided attributes are not a plain object.");return Y(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")throw new j("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!="function")throw new j("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!fn(t))throw new j("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const i=this._nodes.values();let a,r;for(;a=i.next(),a.done!==!0;)r=a.value,r.attributes=e(r.key,r.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!="function")throw new j("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!fn(t))throw new j("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const i=this._edges.values();let a,r,o,d;for(;a=i.next(),a.done!==!0;)r=a.value,o=r.source,d=r.target,r.attributes=e(r.key,r.attributes,o.key,d.key,o.attributes,d.attributes,r.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new j("Graph.forEachAdjacencyEntry: expecting a callback.");yt(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new j("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");yt(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new j("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");yt(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new j("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");yt(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!="function")throw new j("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let i,a;for(;i=t.next(),i.done!==!0;)a=i.value,e(a.key,a.attributes)}findNode(e){if(typeof e!="function")throw new j("Graph.findNode: expecting a callback.");const t=this._nodes.values();let i,a;for(;i=t.next(),i.done!==!0;)if(a=i.value,e(a.key,a.attributes))return a.key}mapNodes(e){if(typeof e!="function")throw new j("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let i,a;const r=new Array(this.order);let o=0;for(;i=t.next(),i.done!==!0;)a=i.value,r[o++]=e(a.key,a.attributes);return r}someNode(e){if(typeof e!="function")throw new j("Graph.someNode: expecting a callback.");const t=this._nodes.values();let i,a;for(;i=t.next(),i.done!==!0;)if(a=i.value,e(a.key,a.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new j("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let i,a;for(;i=t.next(),i.done!==!0;)if(a=i.value,!e(a.key,a.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new j("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let i,a;const r=[];for(;i=t.next(),i.done!==!0;)a=i.value,e(a.key,a.attributes)&&r.push(a.key);return r}reduceNodes(e,t){if(typeof e!="function")throw new j("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new j("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let i=t;const a=this._nodes.values();let r,o;for(;r=a.next(),r.done!==!0;)o=r.value,i=e(i,o.key,o.attributes);return i}nodeEntries(){const e=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=e.next();if(t.done)return t;const i=t.value;return{value:{node:i.key,attributes:i.attributes},done:!1}}}}export(){const e=new Array(this._nodes.size);let t=0;this._nodes.forEach((a,r)=>{e[t++]=ca(r,a)});const i=new Array(this._edges.size);return t=0,this._edges.forEach((a,r)=>{i[t++]=ua(this.type,r,a)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:i}}import(e,t=!1){if(e instanceof F)return e.forEachNode((c,l)=>{t?this.mergeNode(c,l):this.addNode(c,l)}),e.forEachEdge((c,l,p,u,h,b,S)=>{t?S?this.mergeUndirectedEdgeWithKey(c,p,u,l):this.mergeDirectedEdgeWithKey(c,p,u,l):S?this.addUndirectedEdgeWithKey(c,p,u,l):this.addDirectedEdgeWithKey(c,p,u,l)}),this;if(!ee(e))throw new j("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!ee(e.attributes))throw new j("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let i,a,r,o,d;if(e.nodes){if(r=e.nodes,!Array.isArray(r))throw new j("Graph.import: invalid nodes. Expecting an array.");for(i=0,a=r.length;i<a;i++){o=r[i],ha(o);const{key:c,attributes:l}=o;t?this.mergeNode(c,l):this.addNode(c,l)}}if(e.edges){let c=!1;if(this.type==="undirected"&&(c=!0),r=e.edges,!Array.isArray(r))throw new j("Graph.import: invalid edges. Expecting an array.");for(i=0,a=r.length;i<a;i++){d=r[i],pa(d);const{source:l,target:p,attributes:u,undirected:h=c}=d;let b;"key"in d?(b=t?h?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:h?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,b.call(this,d.key,l,p,u)):(b=t?h?this.mergeUndirectedEdge:this.mergeDirectedEdge:h?this.addUndirectedEdge:this.addDirectedEdge,b.call(this,l,p,u))}}return this}nullCopy(e){const t=new F(Y({},this._options,e));return t.replaceAttributes(Y({},this.getAttributes())),t}emptyCopy(e){const t=this.nullCopy(e);return this._nodes.forEach((i,a)=>{const r=Y({},i.attributes);i=new t.NodeDataClass(a,r),t._nodes.set(a,i)}),t}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new L(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi=="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new L("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof e.allowSelfLoops=="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new L("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(e),i=this._edges.values();let a,r;for(;a=i.next(),a.done!==!0;)r=a.value,zn(t,"copy",!1,r.undirected,r.key,r.source.key,r.target.key,Y({},r.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((r,o)=>{e[o]=r.attributes});const t={},i={};this._edges.forEach((r,o)=>{const d=r.undirected?"--":"->";let c="",l=r.source.key,p=r.target.key,u;r.undirected&&l>p&&(u=l,l=p,p=u);const h=`(${l})${d}(${p})`;o.startsWith("geid_")?this.multi&&(typeof i[h]>"u"?i[h]=0:i[h]++,c+=`${i[h]}. `):c+=`[${o}]: `,c+=h,t[c]=r.attributes});const a={};for(const r in this)this.hasOwnProperty(r)&&!mn.has(r)&&typeof this[r]!="function"&&typeof r!="symbol"&&(a[r]=this[r]);return a.attributes=this._attributes,a.nodes=e,a.edges=t,ye(a,"constructor",this.constructor),a}}typeof Symbol<"u"&&(F.prototype[Symbol.for("nodejs.util.inspect.custom")]=F.prototype.inspect);ga.forEach(n=>{["add","merge","update"].forEach(e=>{const t=n.name(e),i=e==="add"?zn:ya;n.generateKey?F.prototype[t]=function(a,r,o){return i(this,t,!0,(n.type||this.type)==="undirected",null,a,r,o,e==="update")}:F.prototype[t]=function(a,r,o,d){return i(this,t,!1,(n.type||this.type)==="undirected",a,r,o,d,e==="update")}})});_i(F);Oi(F);ta(F);la(F);class Fn extends F{constructor(e){const t=Y({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new j("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new j('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Un extends F{constructor(e){const t=Y({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new j("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new j('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Bn extends F{constructor(e){const t=Y({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new j("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class qt extends F{constructor(e){const t=Y({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new j("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new j('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Hn extends F{constructor(e){const t=Y({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new j("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new j('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function tt(n){n.from=function(e,t){const i=Y({},e.options,t),a=new n(i);return a.import(e),a}}tt(F);tt(Fn);tt(Un);tt(Bn);tt(qt);tt(Hn);F.Graph=F;F.DirectedGraph=Fn;F.UndirectedGraph=Un;F.MultiGraph=Bn;F.MultiDirectedGraph=qt;F.MultiUndirectedGraph=Hn;F.InvalidArgumentsGraphError=j;F.NotFoundGraphError=w;F.UsageGraphError=L;const ze={eligible:{property:"--chart-site-health-eligible",fallback:"#56b4e9"},hidden:{property:"--chart-site-health-hidden",fallback:"#e69f00"},resource:{property:"--chart-site-health-resource",fallback:"#d4d4d8"},redirect:{property:"--chart-site-health-redirect",fallback:"#9aa7b8"},failed:{property:"--chart-site-health-failed",fallback:"#d55e00"},unchecked:{property:"--chart-site-health-unchecked",fallback:"#a1a1aa"}},wa={property:"--chart-neutral-text-dim",fallback:"#71717a"},xn=2.5,va=9,bn=200,Na=3,ja=1.6;function Kn(n){const e=bn/Math.max(bn,n);return Math.max(Na,va*e**.25)}function ka(n){return Kn(n)*ja}const Sa={eligible:ze.eligible,hidden:ze.hidden,resource:ze.resource,redirect:ze.redirect,failed:ze.failed,unchecked:ze.unchecked,dimmedNode:{property:"--chart-neutral-text-dim",fallback:"#71717a"},edge:wa,edgeDimmed:{property:"--chart-neutral-text-faint",fallback:"#52525b"},edgeActive:{property:"--chart-neutral-text",fallback:"#a1a1aa"},label:{property:"--chart-tooltip-label",fallback:"#e4e4e7"},background:{property:"--chart-tooltip-bg",fallback:"#18181b"}},Ea=/^#(?:[\da-f]{3}|[\da-f]{4}|[\da-f]{6}|[\da-f]{8})$/i,Aa=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}(?:\s*,\s*(?:0|1|0?\.\d+))?\s*\)$/;function yn(n){return Ea.test(n)||Aa.test(n)}const wn=50,_a=8,ct=.75,$a=[{maxRatio:.2,budget:Number.POSITIVE_INFINITY},{maxRatio:.45,budget:60},{maxRatio:ct,budget:24}],La=10;function Mt(n){for(const e of $a)if(n<=e.maxRatio)return e.budget;return La}function Ze(n,e){return n<e?-1:n>e?1:0}function Ta(n){return Math.max(0,Math.min(1,n.linkScoreNormalized??0))}function Qe(n){return n.healthState?n.healthState:Ns(n)}function Ot(n){switch(n){case"eligible":return"Indexable";case"hidden":return"Hidden";case"resource":return"Not a page";case"redirect":return"Moved";case"failed":return"Broken";case"unchecked":return"Not checked"}}function Ga(n){switch(n){case"eligible":return"Indexable";case"hidden":return"Hidden or points elsewhere";case"resource":return"Not a page";case"redirect":return"Moved";case"failed":return"Broken";case"unchecked":return"Not checked"}}function Xe(n){switch(n){case"eligible":return"AI and search engines are allowed to index this page";case"hidden":return"This page tells them not to index it, or points them to another page";case"resource":return"A file rather than a page, such as a text file or a PDF. Answer engines can still read it";case"redirect":return"This address sends visitors to another page";case"failed":return"This page could not be loaded";case"unchecked":return"This page was found but not checked"}}function zt(n){switch(n){case"eligible":return"●";case"hidden":return"◆";case"resource":return"▪";case"redirect":return"↗";case"failed":return"×";case"unchecked":return"○"}}function Ca(n,e){return!!e&&n.nodeKey===e}function Da(n,e=!1,t=1){const i=Kn(t),a=xn+Math.sqrt(Ta(n))*(i-xn);return e?Math.max(ka(t),a):a}function Ra(n,e){switch(n){case"eligible":return e.eligible;case"hidden":return e.hidden;case"resource":return e.resource;case"redirect":return e.redirect;case"failed":return e.failed;case"unchecked":return e.unchecked}}function Pa(n){return .35+Math.min(1.65,Math.log2(Math.max(1,n)+1)*.28)}function Wn(n){return Number.isFinite(n.x)&&Number.isFinite(n.y)}function Ia(n,e,t,i=null){const a=new qt({allowSelfLoops:!0}),r=new Map;for(const d of n)r.has(d.nodeKey)||r.set(d.nodeKey,d);for(const d of[...r.values()].sort((c,l)=>Ze(c.nodeKey,l.nodeKey))){if(!Wn(d))continue;const c=Qe(d),l=Ra(c,t),p=zt(c),u=Ca(d,i);a.addNode(d.nodeKey,{x:d.x,y:d.y,size:Da(d,u,r.size),color:l,baseColor:l,label:`${p} ${d.path||"/"}`,nodeKey:d.nodeKey,url:d.url,path:d.path,depth:d.depth,status:c,glyph:p,forceLabel:u||d.depth===0||d.path.trim()==="/",zIndex:u?2:d.depth===0?1:0,isRoot:u})}const o=new Set;for(const d of[...e].sort((c,l)=>Ze(c.edgeKey,l.edgeKey)))o.has(d.edgeKey)||!d.targetNodeKey||!a.hasNode(d.sourceNodeKey)||!a.hasNode(d.targetNodeKey)||(o.add(d.edgeKey),a.addDirectedEdgeWithKey(d.edgeKey,d.sourceNodeKey,d.targetNodeKey,{size:Pa(d.occurrences),color:t.edge,baseColor:t.edge,followable:d.followable,occurrences:d.occurrences,isTemplate:d.isTemplate===!0,type:"line",zIndex:0}));return{graph:a,layoutAvailable:n.length===0||a.order>0,omittedNodes:Math.max(0,n.length-a.order),omittedEdges:Math.max(0,e.length-a.size)}}function Ma(n,e,t=wn){const i=e.trim().toLocaleLowerCase(),a=Math.max(0,Math.min(wn,Math.floor(t)));return[...n].sort((r,o)=>Ze(r.path||r.url,o.path||o.url)||Ze(r.nodeKey,o.nodeKey)).filter(r=>Wn(r)?i?`${r.path}
|
|
3
3
|
${r.url}
|
|
4
|
-
${r.nodeKey}`.toLocaleLowerCase().includes(i):!0:!1).slice(0,a)}function Oa(n,e,t,i,a=!0){const o=!!(e&&n.hasNode(e))?e:null,d=typeof t=="function"?t:()=>t,c=n.nodes().sort((u,h)=>{const b=n.getNodeAttributes(u),S=n.getNodeAttributes(h);return Number(S.isRoot)-Number(b.isRoot)||S.size-b.size||(b.depth??Number.MAX_SAFE_INTEGER)-(S.depth??Number.MAX_SAFE_INTEGER)||Ze(b.path,S.path)||Ze(u,h)}),l=new Map(c.map((u,h)=>[u,h])),p=new Set(o?n.neighbors(o).filter(u=>u!==o).sort((u,h)=>(l.get(u)??0)-(l.get(h)??0)).slice(0,_a):[]);return{nodeReducer:(u,h)=>{const b=d(),S=b>ct;if(h.isRoot)return u===o?{...h,size:h.size*1.35,forceLabel:!0,zIndex:3}:{...h,forceLabel:!0};if(o)return u===o?{...h,size:h.size*1.35,forceLabel:!0,zIndex:3}:n.areNeighbors(u,o)?S?p.has(u)?{...h,forceLabel:!1}:{...h,forceLabel:!1,label:""}:h:{...h,color:i.dimmedNode,forceLabel:!1,label:"",zIndex:0};const k=Mt(b);return k===Number.POSITIVE_INFINITY?h:(l.get(u)??Number.MAX_SAFE_INTEGER)<k?{...h,forceLabel:!0}:{...h,forceLabel:!1,label:""}},edgeReducer:(u,h)=>{if(h.isTemplate&&!a)return{...h,hidden:!0};const b=d()>ct,[S,k]=n.extremities(u);return o&&(S===o||k===o)?{...h,color:i.edgeActive,size:Math.max(1.4,h.size),zIndex:2}:b?{...h,hidden:!0}:o?{...h,color:i.edgeDimmed,size:Math.min(.45,h.size),zIndex:0}:h}}}const vn={"layout-failed":{heading:"Map could not be built",detail:"The map could not be created for this scan. Run a new scan to try again."},"no-crawl":{heading:"No map yet",detail:"This scan has no map yet. Run a new scan to create one."},"legacy-snapshot":{heading:"No map yet",detail:"This scan has no map yet. Run a new scan to create one."},"details-unavailable":{heading:"No map yet",detail:"This scan has no map yet. Run a new scan to create one."},"empty-crawl":{heading:"No pages to map",detail:"This scan found no pages to put on a map. Run a new scan to try again."}};function za(n){return(n&&vn[n])??vn["no-crawl"]}class Fa extends y.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){console.error("[SiteGraphSigma] the map failed to render",e,t.componentStack)}componentDidUpdate(e){this.state.failed&&e.resetToken!==this.props.resetToken&&this.setState({failed:!1})}render(){return this.state.failed?this.props.fallback:this.props.children}}const Ua=220;function Ba(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches?0:Ua}function dt(n,e,t=`${e}s`){return`${n.toLocaleString()} ${n===1?e:t}`}function Ha(n,e,t){const a=window.getComputedStyle(n).getPropertyValue(e).trim();if(a&&!a.includes("var(")&&yn(a))return a;const r=document.createElement("span");r.style.position="absolute",r.style.visibility="hidden",r.style.color=`var(${e})`,n.appendChild(r);const o=window.getComputedStyle(r).color.trim();return r.remove(),o&&!o.includes("var(")&&yn(o)?o:t}function Ka(n){const e=t=>{const i=Sa[t];return Ha(n,i.property,i.fallback)};return{eligible:e("eligible"),hidden:e("hidden"),resource:e("resource"),redirect:e("redirect"),failed:e("failed"),unchecked:e("unchecked"),dimmedNode:e("dimmedNode"),edge:e("edge"),edgeDimmed:e("edgeDimmed"),edgeActive:e("edgeActive"),label:e("label"),background:e("background")}}function Wa(n){return(e,t,i)=>{t.label&&(e.save(),e.fillStyle=i.labelColor.color??n.label,e.font=`${i.labelWeight} ${i.labelSize}px ${i.labelFont}`,e.fillText(t.label,t.x+t.size+3,t.y+i.labelSize/3),e.restore())}}function qa(n,e,t,i,a,r){const o=Math.min(r,i/2,a/2);n.beginPath(),n.moveTo(e+o,t),n.lineTo(e+i-o,t),n.arcTo(e+i,t,e+i,t+o,o),n.lineTo(e+i,t+a-o),n.arcTo(e+i,t+a,e+i-o,t+a,o),n.lineTo(e+o,t+a),n.arcTo(e,t+a,e,t+a-o,o),n.lineTo(e,t+o),n.arcTo(e,t,e+o,t,o),n.closePath()}function Va(n){return(e,t,i)=>{const a=typeof t.label=="string"?t.label:null,r=i.labelSize+10,o=t.x+t.size+7,d=t.y-r/2;if(e.save(),e.font=`${i.labelWeight} ${i.labelSize}px ${i.labelFont}`,e.fillStyle=n.background,e.strokeStyle=n.edgeActive,e.lineWidth=1.5,e.beginPath(),e.arc(t.x,t.y,t.size+3,0,Math.PI*2),e.fill(),e.stroke(),e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,t.size,0,Math.PI*2),e.fill(),a){const c=Math.ceil(e.measureText(a).width)+16;qa(e,o,d,c,r,5),e.fillStyle=n.background,e.fill(),e.strokeStyle=n.edgeActive,e.lineWidth=1,e.stroke(),e.fillStyle=n.label,e.textBaseline="middle",e.fillText(a,o+8,t.y)}e.restore()}}function Ya(){if(typeof document>"u")return!1;try{const n=document.createElement("canvas");return!!(n.getContext("webgl2")||n.getContext("webgl"))}catch{return!1}}function Qa({onOpenInventory:n}){return s.jsx("div",{className:"flex h-full min-h-80 items-center justify-center px-6 text-center",children:s.jsxs("div",{className:"max-w-md",children:[s.jsx("p",{className:"text-sm font-medium text-heading",children:"Interactive map unavailable"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"This browser could not start WebGL. The page inventory remains available for the complete crawl."}),n&&s.jsx(O,{type:"button",variant:"secondary",size:"sm",className:"mt-4",onClick:n,children:"Open page inventory"})]})})}function Xa({onRetry:n}){return s.jsx("div",{className:"flex h-full min-h-80 items-center justify-center px-6 text-center",role:"alert",children:s.jsxs("div",{className:"max-w-md",children:[s.jsx("p",{className:"text-sm font-medium text-heading",children:"The map could not be drawn"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Something went wrong while drawing this map. The page inventory below is unaffected."}),s.jsx(O,{variant:"secondary",size:"sm",className:"mt-4",onClick:n,children:"Try again"})]})})}function Za({reactSigma:n,graph:e,theme:t,selectedNodeKey:i,showTemplateLinks:a,onSelectNodeKey:r,onHoverNode:o,onCameraReady:d}){const{useSigma:c,useRegisterEvents:l,useCamera:p}=n,u=c(),h=l(),{zoomIn:b,zoomOut:S,reset:k,gotoNode:D}=p(),[T,z]=y.useState(null),C=T??i,x=y.useRef(null),g=y.useRef({overview:!0,budget:Number.NaN});return y.useEffect(()=>()=>{x.current!==null&&cancelAnimationFrame(x.current)},[]),y.useEffect(()=>{const f=Ba();return d({zoomIn:()=>b({duration:f}),zoomOut:()=>S({duration:f}),reset:()=>k({duration:f}),gotoNode:v=>D(v,{duration:f})}),()=>d(null)},[D,d,k,b,S]),y.useEffect(()=>{h({enterNode:({node:f,event:v})=>{z(f),o({nodeKey:f,left:Number.isFinite(v.x)?v.x+14:20,top:Number.isFinite(v.y)?v.y+14:20})},leaveNode:()=>{z(null),o(null)},clickNode:({node:f})=>r(f),clickStage:()=>o(null),updated:()=>{x.current===null&&(x.current=requestAnimationFrame(()=>{x.current=null;const f=u.getCamera().getState().ratio>ct,v=Mt(u.getCamera().getState().ratio);f===g.current.overview&&v===g.current.budget||(g.current={overview:f,budget:v},u.refresh())}))}})},[o,r,h,u]),y.useEffect(()=>{if(u.getGraph()!==e)return;const f=Oa(e,C,()=>u.getCamera().getState().ratio,t,a);u.setSetting("nodeReducer",f.nodeReducer),u.setSetting("edgeReducer",f.edgeReducer);const v=u.getCamera().getState().ratio;g.current={overview:v>ct,budget:Mt(v)},u.refresh()},[C,e,a,u,t]),null}function Ja({nodes:n,edges:e,layoutState:t="ready",layoutUnavailableReason:i,rootNodeKey:a=null,showTemplateLinks:r=!0,selectedNodeKey:o,onSelectNode:d,onOpenInventory:c,ariaLabel:l,className:p}){const u=y.useRef(null),h=y.useRef(null),b=y.useRef(null),S=y.useId(),k=y.useId(),D=y.useId(),[T,z]=y.useState(null),[C,x]=y.useState(null),[g,f]=y.useState("checking"),[v,$]=y.useState(!1),[G,A]=y.useState(null),[I,le]=y.useState(null),[W,Se]=y.useState(""),[X,te]=y.useState(!1),[_,ae]=y.useState(0),[me,U]=y.useState(""),[Ae,ne]=y.useState(0),ce=y.useRef(null),_e=y.useDeferredValue(W),$e=o===void 0?G:o,ge=y.useMemo(()=>new Map(n.map(E=>[E.nodeKey,E])),[n]),De=y.useMemo(()=>Ln(a?ge.get(a)?.url:null),[ge,a]),re=y.useCallback(E=>hi(E,De),[De]),Re=$e?ge.get($e)??null:null,oe=I?ge.get(I.nodeKey)??null:null,ue=y.useMemo(()=>Ma(n,_e),[_e,n]),P=n.some(E=>Number.isFinite(E.x)&&Number.isFinite(E.y)),se=y.useMemo(()=>T?Ia(n,e,T,a):null,[e,n,a,T]),m=y.useMemo(()=>T?{allowInvalidContainer:!0,defaultNodeColor:T.unchecked,defaultEdgeColor:T.edge,defaultEdgeType:"line",enableCameraPanning:!0,enableCameraZooming:!0,enableCameraRotation:!1,enableEdgeEvents:!1,hideEdgesOnMove:!0,hideLabelsOnMove:!0,itemSizesReference:"screen",defaultDrawNodeHover:Va(T),defaultDrawNodeLabel:Wa(T),labelColor:{color:T.label},labelDensity:.07,labelGridCellSize:140,labelFont:"Geist Variable, Geist, sans-serif",labelRenderedSizeThreshold:8,labelSize:13,labelWeight:"600",maxCameraRatio:12,minCameraRatio:.04,minEdgeThickness:.35,renderEdgeLabels:!1,renderLabels:!0,stagePadding:42,zIndex:!0}:null,[T]);y.useEffect(()=>{const E=u.current;if(!E)return;const V=()=>z(Ka(E));if(V(),typeof MutationObserver>"u")return;const K=new MutationObserver(V);return K.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","style"]}),()=>K.disconnect()},[]),y.useEffect(()=>{if(n.length===0||t==="unavailable"||!P){f("checking");return}f(Ya()?"ready":"unavailable")},[P,t,n.length]),y.useEffect(()=>{if(g!=="ready"){x(null);return}let E=!0;return js(()=>import("./react-sigma_core.esm.min-fnm2MkMi.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url).then(V=>{E&&x(V)}).catch(()=>{E&&f("unavailable")}),()=>{E=!1}},[g]),y.useEffect(()=>{ae(0)},[_e]);const H=y.useCallback(E=>{b.current=E,$(!!E)},[]),B=y.useCallback(E=>{le(E)},[]),R=y.useCallback((E,V)=>{const K=ge.get(E);K&&(o===void 0&&A(E),d?.(K),V&&b.current?.gotoNode(E),U(`Focused ${re(K)}`))},[ge,d,re,o]),Z=y.useCallback(E=>{R(E,!1)},[R]);y.useEffect(()=>{if(!v||!o||!ge.has(o)){o||(ce.current=null);return}ce.current!==o&&(b.current?.gotoNode(o),ce.current=o)},[v,ge,o]);const Le=E=>{R(E.nodeKey,!0),Se(re(E)),te(!1)},he=()=>{window.setTimeout(()=>{document.activeElement!==h.current&&te(!1)},0)},Pe=`Interactive site map showing ${dt(n.length,"page")} and ${dt(e.length,"internal link")}`,de=E=>`${k}-${E.replaceAll(/[^\w-]/g,"-")}`,xe=za(i);if(t==="unavailable")return s.jsx("section",{ref:u,role:"group","aria-label":l??Pe,className:Ue("flex min-h-80 items-center justify-center rounded-lg border border-default bg-surface-inset px-6 text-center",p),children:s.jsxs("div",{className:"max-w-md",children:[s.jsx("p",{className:"text-sm font-medium text-heading",children:xe.heading}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:xe.detail}),c&&s.jsx(O,{type:"button",variant:"secondary",size:"sm",className:"mt-4",onClick:c,children:"Open page inventory"})]})});if(n.length===0)return s.jsx("section",{ref:u,role:"group","aria-label":l??Pe,className:Ue("flex min-h-80 items-center justify-center rounded-lg border border-default bg-surface-inset px-6 text-center",p),children:s.jsxs("div",{className:"max-w-md",children:[s.jsx("p",{className:"text-sm text-secondary",children:"No page graph is available for this scan."}),c&&s.jsx(O,{type:"button",variant:"secondary",size:"sm",className:"mt-4",onClick:c,children:"Open page inventory"})]})});if(!P)return s.jsx("section",{ref:u,role:"group","aria-label":l??Pe,className:Ue("flex min-h-80 items-center justify-center rounded-lg border border-default bg-surface-inset px-6 text-center",p),children:s.jsxs("div",{className:"max-w-md",children:[s.jsx("p",{className:"text-sm font-medium text-heading",children:xe.heading}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:xe.detail}),c&&s.jsx(O,{type:"button",variant:"secondary",size:"sm",className:"mt-4",onClick:c,children:"Open page inventory"})]})});const Be=ue.at(_),Ee=s.jsx(Xa,{onRetry:()=>ne(E=>E+1)}),nt=C?.SigmaContainer;return s.jsxs("section",{ref:u,role:"group","aria-label":l??Pe,"aria-describedby":D,className:Ue("flex h-[clamp(460px,62vh,680px)] min-h-[460px] flex-col overflow-hidden rounded-lg border border-default bg-surface-inset",p),children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-subtle bg-bg-elevated/70 px-3 py-2",children:[s.jsx("label",{htmlFor:S,className:"sr-only",children:"Focus a page in the site map"}),s.jsxs("div",{className:"relative min-w-56 max-w-lg flex-1",children:[s.jsx(Ut,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted","aria-hidden":"true"}),s.jsx("input",{id:S,ref:h,role:"combobox",type:"search",autoComplete:"off","aria-label":"Focus a page in the site map","aria-autocomplete":"list","aria-controls":k,"aria-expanded":X,"aria-activedescendant":X&&Be?de(Be.nodeKey):void 0,value:W,placeholder:Re?`Focused: ${re(Re)}`:"Find a page",className:"h-10 w-full rounded-md border border-base bg-bg py-2 pl-9 pr-3 text-sm text-primary placeholder-mono-600 outline-none focus-visible:ring-2 focus-visible:ring-mono-400",onFocus:()=>te(!0),onBlur:he,onChange:E=>{Se(E.target.value),te(!0)},onKeyDown:E=>{E.key==="ArrowDown"?(E.preventDefault(),te(!0),ae(V=>Math.max(0,Math.min(ue.length-1,V+1)))):E.key==="ArrowUp"?(E.preventDefault(),ae(V=>Math.max(0,V-1))):E.key==="Enter"&&X&&Be?(E.preventDefault(),Le(Be)):E.key==="Escape"&&te(!1)}}),X&&s.jsxs("div",{className:"absolute left-0 right-0 top-[calc(100%+0.25rem)] z-30 overflow-hidden rounded-md border border-base bg-bg shadow-lg",children:[s.jsx("div",{id:k,role:"listbox","aria-label":"Matching pages",className:"max-h-72 overflow-auto py-1",children:ue.length>0?ue.map((E,V)=>{const K=Qe(E);return s.jsxs("button",{id:de(E.nodeKey),type:"button",role:"option","aria-selected":V===_,tabIndex:-1,className:Ue("flex min-h-11 w-full items-center justify-between gap-3 px-3 py-2 text-left text-sm outline-none",V===_?"bg-surface-active text-primary":"text-secondary hover:bg-surface-hover hover:text-primary"),onPointerDown:st=>st.preventDefault(),onMouseDown:st=>st.preventDefault(),onMouseEnter:()=>ae(V),onClick:()=>Le(E),children:[s.jsx("span",{className:"min-w-0 truncate font-mono",children:re(E)}),s.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[13px] text-muted",children:[s.jsx("span",{className:"font-mono font-semibold",style:{color:`var(${ze[K].property})`},"aria-hidden":"true",children:zt(K)}),s.jsx("span",{title:Xe(K),children:Ot(K)})]})]},E.nodeKey)}):s.jsx("p",{className:"px-3 py-4 text-sm text-secondary",children:"No rendered pages match."})}),ue.length===50&&s.jsx("p",{className:"border-t border-subtle px-3 py-2 text-[13px] text-muted",children:"First 50 matches. Refine the search or use the full page inventory."})]})]}),s.jsxs("span",{className:"text-[13px] tabular-nums text-muted",children:[dt(n.length,"page")," · ",dt(e.length,"link")]})]}),s.jsx("div",{className:"relative min-h-0 flex-1 overflow-hidden",children:g==="unavailable"?s.jsx(Qa,{onOpenInventory:c}):g==="checking"||!T||!se||!m||!C||!nt?s.jsx("div",{className:"flex h-full min-h-80 items-center justify-center px-6 text-center",role:"status",children:s.jsx("p",{className:"text-sm text-secondary",children:"Preparing the interactive site map..."})}):s.jsxs(Fa,{fallback:Ee,resetToken:Ae,children:[s.jsx("div",{"aria-hidden":"true",className:"absolute inset-0",children:s.jsx(nt,{graph:se.graph,className:"relative size-full bg-bg [&_.sigma-container]:size-full",style:{width:"100%",height:"100%",background:T.background},settings:m,children:s.jsx(Za,{reactSigma:C,graph:se.graph,theme:T,selectedNodeKey:$e,showTemplateLinks:r,onSelectNodeKey:Z,onHoverNode:B,onCameraReady:H})})}),s.jsxs("div",{className:"absolute right-3 top-3 z-20 flex flex-col overflow-hidden rounded-md border border-base bg-bg shadow-lg",children:[s.jsx(O,{type:"button",variant:"ghost",size:"icon",className:"rounded-none border-b border-subtle","aria-label":"Zoom in",disabled:!v,onClick:()=>b.current?.zoomIn(),children:s.jsx(Ws,{className:"size-4","aria-hidden":"true"})}),s.jsx(O,{type:"button",variant:"ghost",size:"icon",className:"rounded-none border-b border-subtle","aria-label":"Zoom out",disabled:!v,onClick:()=>b.current?.zoomOut(),children:s.jsx(qs,{className:"size-4","aria-hidden":"true"})}),s.jsx(O,{type:"button",variant:"ghost",size:"icon",className:"rounded-none","aria-label":"Fit site map",disabled:!v,onClick:()=>b.current?.reset(),children:s.jsx(Vs,{className:"size-4","aria-hidden":"true"})})]}),oe&&I&&s.jsxs("div",{role:"tooltip",className:"pointer-events-none absolute z-20 max-w-64 rounded-md border border-base bg-bg/95 px-3 py-2 shadow-lg",style:{left:I.left,top:I.top},children:[s.jsx("p",{className:"truncate font-mono text-[13px] font-medium text-heading",children:re(oe)}),s.jsx("p",{className:"mt-1 text-[13px] font-medium text-heading",children:Ot(Qe(oe))}),s.jsx("p",{className:"mt-0.5 text-[13px] text-secondary",children:Xe(Qe(oe))}),oe.depth!=null&&s.jsxs("p",{className:"mt-1 text-[13px] text-secondary",children:[dt(oe.depth,"click")," from home"]}),oe.auditScore!=null&&s.jsxs("p",{className:"mt-1 text-[13px] tabular-nums text-heading",children:["Score ",Math.round(oe.auditScore),"/100"]})]})]})}),s.jsxs("div",{"aria-label":"Site map legend",className:"flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-subtle bg-bg-elevated/50 px-3 py-2 text-[13px] text-secondary",children:[ks.map(E=>s.jsxs("span",{className:"inline-flex items-center gap-1.5",title:Xe(E),children:[s.jsx("span",{className:"w-3 text-center font-mono text-[15px] font-semibold leading-none",style:{color:`var(${ze[E].property})`},"aria-hidden":"true",children:zt(E)}),Ga(E)]},E)),s.jsx("span",{className:"ml-auto",children:"Bigger = more linked"}),se&&(se.omittedNodes>0||se.omittedEdges>0)&&s.jsx("span",{className:"text-caution",children:"Some records lacked valid layout data."})]}),s.jsx("p",{id:D,className:"sr-only",children:"The WebGL map supports pointer, wheel, and touch navigation. Use the page search to focus a rendered page. Use the full page inventory for an accessible list of every crawled page and its links."}),s.jsx("p",{role:"status","aria-live":"polite",className:"sr-only",children:me})]})}function er(n){return n>=70?"positive":n>=40?"caution":"negative"}function tr(n){return n>=70?"pass":n>=40?"partial":"fail"}function nr(n){return n==="pass"?"positive":n==="partial"?"caution":"negative"}function Nn(n){return n==="pass"?"Pass":n==="partial"?"Partial":"Fail"}function sr({audit:n,isLoading:e,error:t,onRetry:i}){return s.jsxs("section",{className:"border-t border-default pt-5","aria-labelledby":"site-health-page-audit-heading",children:[s.jsx("div",{children:s.jsx("h3",{id:"site-health-page-audit-heading",className:"text-base font-semibold text-heading",children:"Findings and fixes"})}),e?s.jsx("p",{className:"mt-4 text-sm text-secondary",role:"status",children:"Loading findings..."}):t?s.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3 border-y border-negative bg-negative-soft px-4 py-3",role:"alert",children:[s.jsx("p",{className:"text-sm text-negative",children:"Findings could not be loaded."}),s.jsx(O,{type:"button",variant:"secondary",size:"sm",onClick:i,children:"Try again"})]}):n?n.state==="no-crawl"?s.jsx("p",{className:"mt-4 text-sm text-secondary",children:"No Site Health scan is available."}):n.state==="details-unavailable"?s.jsx("p",{className:"mt-4 text-sm text-secondary",children:"This scan saved its summary, but not the findings for each page."}):n.state==="not-found"?s.jsx("p",{className:"mt-4 text-sm text-secondary",children:"This page is not present in the selected scan."}):n.state==="not-audited"?s.jsx("p",{className:"mt-4 text-sm text-secondary",children:"This page was found, but it was not scored."}):s.jsx(ir,{audit:n}):s.jsx("p",{className:"mt-4 text-sm text-secondary",children:"No findings are available for this page."})]})}function ir({audit:n}){const e=n.factors.filter(t=>t.applicable!==!1&&(t.status!=="pass"||t.findings.some(i=>i.type==="missing"||i.type==="timeout"||i.type==="unreachable")));return s.jsxs("div",{className:"mt-4",children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[s.jsxs("span",{"aria-label":`Score ${Math.round(n.auditScore)} out of 100`,className:"text-2xl font-semibold tabular-nums text-heading",children:[Math.round(n.auditScore),s.jsx("span",{className:"text-sm text-muted",children:"/100"})]}),s.jsx(J,{tone:er(n.auditScore),children:Nn(tr(n.auditScore))})]}),n.evidenceState==="scores-only"&&s.jsx("p",{className:"mt-3 border border-caution bg-caution-soft px-3 py-2 text-sm text-caution",children:"This older scan saved only the scores, not the findings or fixes."}),n.criticalDefects.length>0&&s.jsxs("section",{className:"mt-5","aria-labelledby":"site-health-critical-defects-heading",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h4",{id:"site-health-critical-defects-heading",className:"text-sm font-semibold text-heading",children:"Problems outside the score"}),s.jsx(J,{tone:n.criticalDefects.some(t=>t.severity==="critical")?"negative":"caution",children:n.criticalDefects.length}),s.jsx("span",{className:"text-xs text-muted",children:"Not counted in the score"})]}),s.jsx("ul",{className:"mt-2 divide-y divide-default border-y border-default",children:n.criticalDefects.map(t=>s.jsxs("li",{className:"py-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("p",{className:"text-sm font-medium text-heading",children:t.detail}),s.jsx(J,{tone:t.severity==="critical"?"negative":"caution",children:t.severity==="critical"?"Critical":"Warning"})]}),s.jsxs("p",{className:"mt-1 text-sm text-secondary",children:[s.jsx("span",{className:"font-medium text-heading",children:"Fix:"})," ",t.recommendation]})]},t.id))})]}),e.length>0?s.jsx("div",{className:"mt-5 divide-y divide-default border-y border-default",children:e.map(t=>s.jsxs("details",{className:"group py-1",children:[s.jsxs("summary",{className:"flex min-h-12 cursor-pointer list-none items-center justify-between gap-3 rounded-sm px-1 py-2 outline-none marker:hidden focus-visible:ring-2 focus-visible:ring-mono-400 [&::-webkit-details-marker]:hidden",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-sm font-medium text-heading",children:[s.jsx(kt,{className:"size-4 shrink-0 text-muted transition-transform group-open:rotate-90","aria-hidden":"true"}),t.name]}),s.jsxs("span",{className:"flex shrink-0 items-center gap-2",children:[s.jsxs("span",{className:"text-sm tabular-nums text-heading",children:[Math.round(t.score),"/100"]}),s.jsx(J,{tone:nr(t.status),children:Nn(t.status)})]})]}),s.jsxs("div",{className:"grid gap-4 px-1 pb-4 pt-1 md:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx("h5",{className:"text-xs font-semibold uppercase tracking-wide text-muted",children:"Evidence"}),t.findings.length>0?s.jsx("ul",{className:"mt-2 space-y-1.5 text-sm text-secondary",children:t.findings.map((i,a)=>s.jsx("li",{children:i.message},`${i.code}:${a}`))}):s.jsx("p",{className:"mt-2 text-sm text-secondary",children:n.evidenceState==="scores-only"?"This scan did not save the findings here.":"Nothing to report here."})]}),s.jsxs("div",{children:[s.jsx("h5",{className:"text-xs font-semibold uppercase tracking-wide text-muted",children:"Recommended fix"}),t.recommendations.length>0?s.jsx("ol",{className:"mt-2 list-decimal space-y-1.5 pl-5 text-sm text-secondary marker:text-muted",children:t.recommendations.map(i=>s.jsx("li",{children:i},i))}):s.jsx("p",{className:"mt-2 text-sm text-secondary",children:n.evidenceState==="scores-only"?"This scan did not save a fix here.":"No fix suggested here."}),s.jsxs("p",{className:"mt-3 text-xs text-muted",children:["Worth ",t.weight,"% of the page score"]})]})]})]},t.id))}):n.criticalDefects.length===0&&n.evidenceState==="complete"?s.jsx("p",{className:"mt-4 border-y border-positive bg-positive-soft px-4 py-3 text-sm text-positive",children:"Nothing needs attention on this page."}):n.criticalDefects.length===0?s.jsx("p",{className:"mt-4 border-y border-default px-4 py-3 text-sm text-secondary",children:"This scan saved only the score. Run a new scan to see findings."}):null]})}const qn=25;function ar(n){return n.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function rr(n){let e=n;try{e=decodeURIComponent(n.replace(/\+/g," "))}catch{}let t="";const i=n.indexOf("?");return i>=0&&new URLSearchParams(n.slice(i+1)).forEach((r,o)=>{t+=` ${o} ${r}`}),`${n} ${e}${t}`}function or(n,e=36,t=18){const i=[...n];return i.length<=e+t+1?n:`${i.slice(0,e).join("")}…${i.slice(-t).join("")}`}function dr({value:n,headLength:e,tailLength:t,className:i,title:a}){const r=or(n,e,t);return s.jsx("span",{className:i,title:a??n,children:r===n?n:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"sr-only",children:n}),s.jsx("span",{"aria-hidden":"true",children:r})]})})}function lr({rows:n,getSearchText:e,pageSize:t=qn}){const[i,a]=y.useState(""),[r,o]=y.useState(1),d=y.useMemo(()=>ar(i),[i]),c=y.useMemo(()=>d.length===0||!e?n:n.filter(k=>{const D=e(k).toLocaleLowerCase();return d.every(T=>D.includes(T))}),[e,n,d]),l=Math.max(1,Math.ceil(c.length/t)),p=Math.min(Math.max(1,r),l),u=(p-1)*t,h=y.useMemo(()=>c.slice(u,u+t),[c,t,u]),b=y.useCallback(k=>{a(k),o(1)},[]),S=y.useCallback(k=>{o(Math.max(1,k))},[]);return{query:i,setQuery:b,page:p,setPage:S,rows:h,filteredRows:c,totalRows:c.length,totalPages:l,pageSize:t,rangeStart:c.length===0?0:u+1,rangeEnd:u+h.length,hasQuery:i.trim().length>0}}function cr({value:n,onChange:e,label:t,placeholder:i="Filter rows",className:a}){return s.jsxs("div",{className:`relative ${a??""}`,children:[s.jsx(Ut,{"aria-hidden":"true",className:"pointer-events-none absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted"}),s.jsx("input",{type:"search",value:n,onChange:r=>e(r.target.value),"aria-label":t,placeholder:i,autoComplete:"off",spellCheck:!1,className:"h-9 w-full rounded-md border border-default bg-surface/50 pl-9 pr-9 text-sm text-strong placeholder:text-muted outline-none transition focus:border-mono-500 focus:ring-1 focus:ring-mono-500 [&::-webkit-search-cancel-button]:appearance-none"}),n.trim().length>0?s.jsx("button",{type:"button",onClick:()=>e(""),"aria-label":`Clear ${t.toLocaleLowerCase()}`,className:"absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded text-muted transition-colors hover:bg-surface-hover hover:text-strong focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-mono-500",children:s.jsx(Ys,{"aria-hidden":"true",className:"size-3.5"})}):null]})}function ur({page:n,pageSize:e=qn,visibleRows:t,totalRows:i,hasNextPage:a,onPageChange:r,itemLabel:o="rows",className:d,disabled:c=!1}){if(t===0)return null;const l=(n-1)*e+1,p=l+t-1,u=i===void 0?void 0:Math.max(1,Math.ceil(i/e)),h=a??(u!==void 0&&n<u),b=n>1||h;return s.jsxs("div",{className:`mt-3 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 text-xs text-secondary ${d??""}`,children:[s.jsxs("p",{className:"tabular-nums",children:[l.toLocaleString("en-US"),"–",p.toLocaleString("en-US"),i===void 0?`${h?"+":""} ${o}`:` of ${i.toLocaleString("en-US")} ${o}`]}),b?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>r(n-1),disabled:c||n<=1,className:"inline-flex items-center gap-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-strong transition hover:border-strong hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-base disabled:hover:text-strong",children:[s.jsx(Qs,{"aria-hidden":"true",className:"size-3.5"}),"Previous"]}),s.jsx("span",{className:"tabular-nums",children:u===void 0?`Page ${n}`:`Page ${n} of ${u}`}),s.jsxs("button",{type:"button",onClick:()=>r(n+1),disabled:c||!h,className:"inline-flex items-center gap-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-strong transition hover:border-strong hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-base disabled:hover:text-strong",children:["Next",s.jsx(kt,{"aria-hidden":"true",className:"size-3.5"})]})]}):null]})}const hr=100,Ct=12,pr=[];function fr(n){return rr(n.url)}function wt(n){return n>=70?"positive":n>=40?"caution":"negative"}function vt(n){return n>=70?"text-positive-400":n>=40?"text-caution-400":"text-negative-400"}function mr(n){return n==="pass"?"positive":n==="partial"?"caution":"negative"}function lt(n){return n>=70?"Pass":n>=40?"Partial":"Fail"}function gr(n){return ti($n(String(n)))}function xr(n){return ni($n(String(n)))}function br({projectName:n,projectId:e,runId:t,integrated:i=!1,compactCopy:a=!1,footer:r,unavailableFooter:o}){const[d,c]=y.useState(!1),[l,p]=y.useState(null),[u,h]=y.useState(null),b=t===void 0?u:t,[S,k]=y.useState(!1),D=y.useRef(null),T=fe(Ss({client:ie,path:{name:n},...b?{query:{runId:b}}:{}})),z=fe({...Es({client:ie,path:{name:n},query:{limit:30}}),enabled:!i}),C=fe(As({client:ie,path:{name:n},query:{limit:hr,sort:"score-asc",...b?{runId:b}:{}}})),x=fe({..._s({client:ie,path:{name:n},query:{kind:sn["site-audit"],limit:10}}),enabled:!i,refetchOnWindowFocus:"always",refetchInterval:m=>m.state.data?.some(B=>B.status==="queued"||B.status==="running")?3e3:1e4}),g=An(),f=y.useSyncExternalStore($s,an,an),v=Object.values(f.runs).find(m=>m.kind===sn["site-audit"]&&m.projectId===e),$=x.data??[],G=$.find(m=>m.status==="queued"||m.status==="running"),A=$.at(-1),I=g.isPending||!!v||!!G,le=g.isPending?"starting":G?.status??v?.lastAnnouncedStatus,W=y.useCallback(async()=>{const m=await Promise.all([T.refetch(),C.refetch(),...i?[]:[z.refetch()]]),H=m.find(B=>B.error);if(H?.error)throw H.error;return m[0]},[i,C.refetch,T.refetch,z.refetch]);y.useEffect(()=>{i||b||!A||A.status!=="completed"&&A.status!=="partial"||T.data?.runId===A.id||D.current===A.id||(D.current=A.id,W().catch(m=>{$t({title:"Technical AEO auto-refresh failed",detail:m instanceof Error?m.message:"Could not load the completed audit.",tone:"negative",dedupeKey:`technical-aeo:auto-refresh:${n}`,dedupeMode:"replace"})}))},[b,i,A?.id,A?.status,n,W,T.data?.runId]);const Se=async()=>{k(!0);try{const m=await W();$t({title:"Technical AEO refreshed",detail:I?"The audit is still running. This view will refresh again when it finishes.":m.data?.hasData?`Latest score is ${m.data.aggregateScore}/100 from ${m.data.pagesAudited} audited page${m.data.pagesAudited===1?"":"s"}.`:"No audit data yet. Run an audit to crawl the sitemap.",tone:m.data?.hasData?"positive":"caution",dedupeKey:`technical-aeo:refresh:${n}`,dedupeMode:"replace"})}catch(m){$t({title:"Technical AEO refresh failed",detail:m instanceof Error?m.message:"Could not reload technical audit data.",tone:"negative",dedupeKey:`technical-aeo:refresh:${n}`,dedupeMode:"replace"})}finally{k(!1)}},X=()=>g.mutate({projectName:n,projectId:e}),te=le==="running"?"Audit running":le==="queued"?"Audit queued":"Starting audit",_=T.data,ae=C.data?.pages??pr,me=(_?.pagesErrored??0)>0,U=d&&me,Ae=y.useMemo(()=>U?ae.filter(m=>m.status==="error"):ae,[ae,U]),ne=lr({rows:Ae,getSearchText:fr}),ce=_?_.pagesAudited>ae.length:!1,_e=_?.crossCuttingIssues[0]?.factorId??_?.factors.find(m=>m.pagesPartial+m.pagesFailing>0)?.id??null;if(y.useEffect(()=>{c(!1),p(i?_e:null)},[b,i,_e]),T.isLoading)return s.jsxs("div",{className:`flex min-h-40 items-center justify-center gap-2 text-sm text-secondary ${i?"":"mt-6"}`,role:"status",children:[s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading page health..."]});if(T.error)return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:`flex flex-col gap-4 rounded-lg border border-negative bg-negative-soft px-5 py-5 sm:flex-row sm:items-center sm:justify-between ${i?"":"mt-6"}`,role:"alert",children:[s.jsxs("div",{className:"flex min-w-0 gap-3",children:[s.jsx(Pt,{className:"mt-0.5 size-4 shrink-0 text-negative","aria-hidden":"true"}),s.jsxs("div",{children:[i?s.jsx("h3",{className:"font-semibold text-negative",children:"Page health could not load"}):s.jsx("h2",{className:"font-semibold text-negative",children:"Page health could not load"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"The saved audit could not be read. Try loading it again."})]})]}),s.jsxs(O,{type:"button",variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{Se()},disabled:S,children:[s.jsx(Lt,{className:`size-4 ${S?"motion-safe:animate-spin":""}`,"aria-hidden":"true"}),S?"Trying again...":"Try again"]})]}),o]});if(!_||!_.hasData)return i?s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"rounded-lg border border-default bg-surface-subtle px-5 py-7 text-center",children:[s.jsx(dn,{className:"mx-auto size-7 text-muted","aria-hidden":"true"}),s.jsx("h2",{className:"mt-3 text-base font-semibold text-heading",children:"Page health unavailable"}),s.jsx("p",{className:"mx-auto mt-2 max-w-md text-sm text-secondary",children:"Run a new Site Health scan to calculate page-level technical findings."})]}),o]}):s.jsxs(Ls,{className:"surface-card mt-6 p-8 text-center",children:[s.jsx(dn,{className:"mx-auto mb-3 h-8 w-8 text-muted","aria-hidden":"true"}),s.jsx("h2",{className:"text-base font-semibold text-heading",children:"No technical audit yet"}),s.jsx("p",{className:"supporting-copy mx-auto mt-2 max-w-md",children:"A technical AEO audit crawls your sitemap and scores every page for structured data, AI-readable content, crawler access, freshness, and more, then rolls it up into one site score."}),!Dt()&&s.jsx("div",{className:"mt-5 flex items-center justify-center gap-3",children:s.jsxs(Rt,{type:"button",onClick:X,disabled:I,children:[I?s.jsx(ve,{className:"mr-1.5 h-4 w-4 motion-safe:animate-spin","aria-hidden":"true"}):s.jsx(It,{className:"mr-1.5 h-4 w-4","aria-hidden":"true"}),I?te:"Run first audit"]})}),I?s.jsx("p",{className:"mt-3 text-xs text-muted",role:"status","aria-live":"polite",children:"The dashboard will refresh automatically when the audit finishes."}):null]});const $e=_.deltaScore==null?null:`${_.deltaScore>=0?"+":""}${_.deltaScore} vs previous`,ge=_.trend==="up"?"positive":_.trend==="down"?"negative":"neutral",De=z.data?.points??[],re=De.map(m=>({runId:m.runId,date:m.auditedAt,score:m.aggregateScore})),Re=t===void 0&&u!==null,oe=ae.filter(m=>m.status==="success"),ue=_.factors.filter(m=>m.pagesPartial+m.pagesFailing>0).length,P=_.crossCuttingIssues.some(m=>m.topRecommendations.length>0);function se(m){const H=[];for(const B of oe){const R=B.factors.find(Z=>Z.id===m);R&&R.score<70&&H.push({url:B.url,score:R.score})}return H.sort((B,R)=>B.score-R.score)}return s.jsxs("div",{className:i?"":"mt-6",children:[i?s.jsxs("section",{className:"flex flex-col gap-3 border-b border-default pb-5 sm:flex-row sm:items-end sm:justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-secondary",children:"Site score"}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[s.jsxs("span",{"aria-label":`Site score ${_.aggregateScore} out of 100`,className:`inline-flex items-baseline gap-1 font-mono tabular-nums ${vt(_.aggregateScore)}`,children:[s.jsx("span",{className:"text-3xl font-semibold",children:_.aggregateScore}),s.jsx("span",{className:"text-sm text-muted",children:"/100"})]}),s.jsx(J,{tone:wt(_.aggregateScore),children:lt(_.aggregateScore)}),$e?s.jsx(J,{tone:ge,children:$e}):null]})]}),s.jsxs("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm tabular-nums text-secondary",children:[s.jsxs("span",{children:[_.pagesAudited," page",_.pagesAudited===1?"":"s"," checked"]}),s.jsx("span",{"aria-hidden":"true",className:"text-faint",children:"·"}),s.jsxs("span",{children:[ue," check",ue===1?"":"s"," need",ue===1?"s":""," attention"]}),_.pagesErrored>0?s.jsxs(s.Fragment,{children:[s.jsx("span",{"aria-hidden":"true",className:"text-faint",children:"·"}),s.jsxs("span",{className:"text-negative",children:[_.pagesErrored," crawl error",_.pagesErrored===1?"":"s"]})]}):null]})]}):s.jsxs("section",{className:"surface-card flex flex-wrap items-start justify-between gap-6 rounded-lg border border-default bg-surface p-6",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:Re?"Technical AEO history":"Technical AEO"}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-baseline gap-3",children:[s.jsx("span",{className:`text-4xl font-semibold tabular-nums ${vt(_.aggregateScore)}`,children:_.aggregateScore}),s.jsx("span",{className:"text-lg text-muted",children:"/ 100"}),s.jsx(J,{tone:wt(_.aggregateScore),children:lt(_.aggregateScore)}),$e?s.jsx(J,{tone:ge,children:$e}):null,I?s.jsx(J,{tone:"neutral",children:te}):null]}),s.jsxs("p",{className:"supporting-copy mt-2 tabular-nums",children:[_.pagesDiscovered," URL",_.pagesDiscovered===1?"":"s"," in sitemap · ",_.pagesAudited," audited · ",_.pagesSkipped," skipped · ",_.pagesErrored," errored"]}),s.jsxs("p",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 text-xs text-muted",children:[s.jsx("span",{className:"text-faint",children:"Sitemap:"}),s.jsx("a",{href:_.sitemapUrl??"#",target:"_blank",rel:"noreferrer",className:"max-w-[22rem] truncate text-secondary underline decoration-mono-700 underline-offset-2 hover:text-strong",children:_.sitemapUrl}),s.jsx(we,{text:"Every audit re-reads this sitemap, so pages you add or remove are picked up on the next run. Discovered/audited counts and the score reflect the sitemap at the time of the latest run. Override it with `canonry technical-aeo run <project> --sitemap-url <url>`."})]}),_.auditedAt?s.jsxs("p",{className:"mt-0.5 text-xs text-faint",children:["Audited ",new Date(_.auditedAt).toLocaleString()]}):null,I?s.jsx("p",{className:"mt-1 text-xs text-muted",role:"status","aria-live":"polite",children:"Results refresh automatically when this audit finishes."}):null]}),s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[t===void 0&&De.length>1?s.jsxs("select",{"aria-label":"View a Technical AEO audit",value:u??"",onChange:m=>h(m.target.value||null),className:"min-h-11 rounded-md border border-base bg-bg px-3 text-sm text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600",children:[s.jsx("option",{value:"",children:"Latest audit"}),[...De].reverse().slice(1).map(m=>s.jsxs("option",{value:m.runId,children:[new Date(m.auditedAt).toLocaleDateString()," · ",m.aggregateScore,"/100"]},m.runId))]}):null,s.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>{Se()},disabled:S,children:[s.jsx(Lt,{className:`mr-1.5 h-4 w-4 ${S?"motion-safe:animate-spin":""}`,"aria-hidden":"true"}),S?"Refreshing…":"Refresh"]}),!Dt()&&s.jsxs(Rt,{type:"button",size:"sm",onClick:X,disabled:I,children:[I?s.jsx(ve,{className:"mr-1.5 h-4 w-4 motion-safe:animate-spin","aria-hidden":"true"}):s.jsx(It,{className:"mr-1.5 h-4 w-4","aria-hidden":"true"}),I?te:"Re-run audit"]})]})]}),!i&&re.length>=2?s.jsxs("section",{className:"page-section-divider",children:[s.jsxs("div",{className:"section-head",children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:"Trend"}),s.jsx("h2",{children:"Site score over time"})]}),s.jsxs("div",{className:"mt-3 h-56",children:[s.jsxs("p",{className:"sr-only",children:["Technical AEO scores range from ",Math.min(...re.map(m=>m.score))," to ",Math.max(...re.map(m=>m.score))," across ",re.length," audits. Use the audit selector to inspect a previous scorecard."]}),s.jsx("div",{className:"h-full","aria-hidden":"true",children:s.jsx(si,{width:"100%",height:"100%",children:s.jsxs(ii,{data:re,margin:{top:8,right:8,bottom:0,left:0},children:[s.jsx(ai,{stroke:Js,vertical:!1}),s.jsx(ri,{dataKey:"date",tick:cn,tickLine:!1,axisLine:{stroke:ln},tickFormatter:gr,minTickGap:24}),s.jsx(oi,{domain:[0,100],ticks:[0,25,50,75,100],tick:cn,tickLine:!1,axisLine:!1,width:32}),s.jsx(di,{...ei,cursor:{stroke:ln,strokeWidth:1},labelFormatter:xr,formatter:m=>[`${m}/100`,"Site score"]}),s.jsx(li,{type:"monotone",dataKey:"score",name:"score",stroke:un.positive,strokeWidth:2.5,dot:{r:2.5,fill:un.positive,strokeWidth:0},isAnimationActive:!1})]})})})]})]}):null,s.jsxs("section",{className:i?"pt-5":"page-section-divider",children:[i?s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold text-heading",children:a?"Checks":"Technical findings"}),s.jsx("p",{className:"mt-1 max-w-2xl text-sm text-secondary",children:a?"Open a check to see affected pages and fixes.":P?"Select a check to see affected pages and recommended fixes.":"Select a check to see affected pages and score details."})]}):s.jsxs("div",{className:"section-head",children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:"Scorecard"}),s.jsxs("h2",{className:"inline-flex items-center gap-1.5",children:["Ranking factors",s.jsx(we,{text:"Each factor is scored 0–100 per page (via the aeo-audit engine), then averaged across all successfully-audited pages. Pass ≥70, partial 40–69, fail <40. Expand a row to see which pages fall short and how to fix it."})]})]}),s.jsx("div",{className:"evidence-table-wrap mt-3",children:s.jsxs("table",{className:`evidence-table ${i?"min-w-[42rem]":""}`,children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:i?"Technical check":"Factor"}),i?null:s.jsx("th",{className:"text-right",children:"Weight"}),s.jsx("th",{className:"text-right",children:i?"Score":"Avg"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:i?"Pages affected":"Pass / Partial / Fail"})]})}),s.jsx("tbody",{children:_.factors.map(m=>{const H=l===m.id,B=_.crossCuttingIssues.find(de=>de.factorId===m.id),R=H?se(m.id):[],Z=m.pagesPartial+m.pagesFailing,Le=m.pagesPassing+Z,he=!!B?.topRecommendations.length,Pe=he&&Z>0;return s.jsxs(y.Fragment,{children:[s.jsxs("tr",{className:H?"bg-surface-subtle":void 0,children:[s.jsx("td",{children:s.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2 text-left font-medium text-strong outline-none hover:text-primary focus-visible:text-primary focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-mono-400","aria-expanded":H,onClick:()=>p(H?null:m.id),children:[H?s.jsx(_n,{className:"size-4 shrink-0 text-muted","aria-hidden":"true"}):s.jsx(kt,{className:"size-4 shrink-0 text-muted","aria-hidden":"true"}),m.name]})}),i?null:s.jsxs("td",{className:"text-right tabular-nums text-muted",children:[m.weight,"%"]}),s.jsxs("td",{className:"text-right font-mono tabular-nums text-strong",children:[m.avgScore,i?s.jsx("span",{className:"text-muted",children:"/100"}):null]}),s.jsx("td",{children:s.jsx(J,{tone:mr(m.status),children:lt(m.avgScore)})}),i?s.jsxs("td",{className:`tabular-nums ${Z>0?"text-strong":"text-muted"}`,children:[Z," of ",Le]}):s.jsxs("td",{className:"tabular-nums text-secondary",children:[s.jsx("span",{className:"text-positive-400",children:m.pagesPassing})," / ",s.jsx("span",{className:"text-caution-400",children:m.pagesPartial})," / ",s.jsx("span",{className:"text-negative-400",children:m.pagesFailing})]})]}),H?s.jsx("tr",{className:"bg-surface-subtle",children:s.jsx("td",{colSpan:i?4:5,className:"px-4 pb-5 pt-0",children:s.jsxs("div",{className:`grid gap-5 border-t border-subtle pt-4 ${Pe?"lg:grid-cols-2":""}`,children:[he&&B?s.jsxs("section",{"aria-labelledby":`technical-finding-${m.id}-fixes`,children:[s.jsx("h4",{id:`technical-finding-${m.id}-fixes`,className:"text-sm font-semibold text-heading",children:"Recommended fixes"}),s.jsx("ol",{className:"mt-2 list-decimal space-y-1.5 pl-5 marker:text-muted",children:B.topRecommendations.map((de,xe)=>s.jsx("li",{className:"pl-1 text-sm text-secondary",children:de},xe))}),i?s.jsxs("p",{className:"mt-3 text-xs text-muted",children:["Weight: ",m.weight,"% of the site score"]}):null]}):Z===0?s.jsx("p",{className:"text-sm text-secondary",children:"Every audited page passes this check."}):null,Z>0?s.jsxs("section",{"aria-labelledby":`technical-finding-${m.id}-pages`,children:[s.jsxs("h4",{id:`technical-finding-${m.id}-pages`,className:"text-sm font-semibold text-heading",children:["Affected pages (",Z,")"]}),i&&C.isLoading?s.jsxs("div",{className:"mt-3 flex items-center gap-2 text-sm text-secondary",role:"status",children:[s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading affected pages..."]}):i&&C.error?s.jsxs("div",{className:"mt-3",role:"alert",children:[s.jsx("p",{className:"text-sm font-medium text-negative",children:"Affected pages could not load"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Try the page-level audit read again."}),s.jsxs(O,{type:"button",variant:"secondary",size:"sm",className:"mt-3",onClick:()=>{C.refetch()},disabled:C.isFetching,children:[C.isFetching?s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}):s.jsx(Lt,{className:"size-4","aria-hidden":"true"}),C.isFetching?"Retrying affected pages...":"Retry affected pages"]})]}):R.length>0?s.jsx("ul",{className:"mt-2 space-y-1.5",children:R.slice(0,Ct).map(de=>s.jsxs("li",{className:"flex min-w-0 items-center gap-2 text-sm",children:[s.jsx("span",{className:`w-8 shrink-0 text-right font-mono tabular-nums ${vt(de.score)}`,children:de.score}),s.jsx("a",{href:de.url,target:"_blank",rel:"noreferrer",className:"min-w-0 truncate text-link outline-none hover:text-heading focus-visible:ring-2 focus-visible:ring-mono-400",title:de.url,children:de.url})]},de.url))}):s.jsx("p",{className:"mt-2 text-sm text-secondary",children:"Page details are not available in the loaded audit sample."}),R.length>Ct?s.jsxs("p",{className:"mt-2 text-xs text-muted",children:["+ ",R.length-Ct," more below pass"]}):null,ce&&(!i||!C.isLoading&&!C.error)?s.jsxs("p",{className:"mt-2 text-xs text-muted",children:["Showing the worst ",ae.length," audited pages."]}):null]}):null]})})}):null]},m.id)})})]})})]}),!i&&_.crossCuttingIssues.length>0?s.jsxs("section",{className:"page-section-divider",children:[s.jsxs("div",{className:"section-head",children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:"Opportunities"}),s.jsxs("h2",{className:"inline-flex items-center gap-1.5",children:["Prioritized fixes",s.jsx(we,{text:"Factors scoring below pass across the most pages, ranked by site-wide impact. Fixing one of these typically lifts many pages at once."})]})]}),s.jsx("div",{className:"mt-3 divide-y divide-mono-800/60 overflow-hidden rounded-lg border border-default",children:_.crossCuttingIssues.map(m=>s.jsxs("div",{className:"p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[s.jsx("span",{className:"text-sm font-medium text-heading",children:m.factorName}),s.jsx(J,{tone:wt(m.avgScore),children:lt(m.avgScore)}),s.jsxs("span",{className:"text-xs tabular-nums text-muted",children:["avg ",m.avgScore," · affects ",m.affectedPages," of ",m.totalPages," pages (",m.affectedPct,"%)"]})]}),m.topRecommendations.length>0?s.jsx("ul",{className:"mt-2 space-y-1",children:m.topRecommendations.map((H,B)=>s.jsxs("li",{className:"flex gap-2 text-sm text-secondary",children:[s.jsx("span",{className:"select-none text-faint",children:"→"}),s.jsx("span",{children:H})]},B))}):null]},m.factorId))})]}):null,i?null:s.jsxs("section",{className:"page-section-divider",children:[s.jsxs("div",{className:"section-head section-head-inline",children:[s.jsxs("div",{children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:"Pages"}),s.jsx("h2",{children:"Per-page breakdown"})]}),me?s.jsxs("div",{className:"segmented",role:"group","aria-label":"Filter pages",children:[s.jsxs("button",{type:"button",onClick:()=>{c(!1),ne.setPage(1)},"aria-pressed":!U,className:`segmented-option min-h-11 tabular-nums ${U?"":"segmented-option-active"}`,children:["All ",_.pagesAudited]}),s.jsxs("button",{type:"button",onClick:()=>{c(!0),ne.setPage(1)},"aria-pressed":U,className:`segmented-option min-h-11 tabular-nums ${U?"segmented-option-active text-negative":""}`,children:["Errors ",_.pagesErrored]})]}):null]}),ae.length>0?s.jsx(cr,{value:ne.query,onChange:ne.setQuery,label:"Filter audited page URLs",placeholder:"Filter page URL or query parameters",className:"mt-3 max-w-md"}):null,ne.totalRows===0?s.jsx("p",{className:"supporting-copy mt-3",children:ne.hasQuery?"No pages match this filter.":"No pages recorded."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"evidence-table-wrap mt-3",children:s.jsxs("table",{className:"evidence-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-right",children:"Score"}),s.jsx("th",{children:"Status"}),s.jsx("th",{className:"w-full",children:"URL"})]})}),s.jsx("tbody",{children:ne.rows.map(m=>s.jsxs("tr",{children:[s.jsx("td",{className:"text-right tabular-nums",children:m.status==="error"?s.jsxs("span",{className:"inline-flex items-center gap-1 text-negative-400",children:[s.jsx(Pt,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"err"]}):s.jsx("span",{className:vt(m.overallScore),children:m.overallScore})}),s.jsx("td",{children:m.status==="error"?s.jsx(J,{tone:"negative",children:"Error"}):s.jsx(J,{tone:wt(m.overallScore),children:lt(m.overallScore)})}),s.jsx("td",{className:"w-full max-w-0",children:s.jsx("a",{href:m.url,target:"_blank",rel:"noreferrer",className:"block truncate text-neutral hover:text-heading",title:m.status==="error"?m.error??m.url:m.url,children:s.jsx(dr,{value:m.url,headLength:54,tailLength:20,title:m.status==="error"?m.error??m.url:m.url})})})]},m.url))})]})}),s.jsx(ur,{page:ne.page,pageSize:ne.pageSize,visibleRows:ne.rows.length,totalRows:ne.totalRows,onPageChange:ne.setPage,itemLabel:ne.hasQuery?"matches":"rows"}),ce?s.jsxs("p",{className:"mt-2 text-xs text-faint",children:["Showing the worst ",ae.length," of ",_.pagesAudited," audited pages."]}):null]})]}),r]})}const qe=[{id:"map",label:"Map"},{id:"inventory",label:"Pages"},{id:"technical",label:"Page health"}],Vn={map:"Explore how pages, site sections, and internal links fit together.",inventory:"Review discovered pages and the links that shape their visibility.",technical:"Prioritize audit findings and inspect the pages that need work."},Yn=[{id:"all",label:"All",healthState:void 0},{id:"hidden",label:"Hidden pages",healthState:Ps.hidden}],yr={[Ke.metaRobotsNoindex]:"Hidden by meta robots tag",[Ke.xRobotsNoindex]:"Hidden by X-Robots-Tag header",[Ke.robotsDisallow]:"Blocked by robots.txt",[Ke.redirectTerminal]:"Redirects to another page",[Ke.canonicalToOther]:"Points to another page as canonical",[Ke.notHtmlOrUnavailable]:"Not an HTML page, so it was not scored"},wr=new Map(Object.entries(yr));function vr(n){return wr.get(n)??n}const Nr=20,jr=200,kr=100,Qn=100,Sr=50,Er=Ks,Ar=Hs,_r=2e4,$r=3,Ne=new Intl.NumberFormat,Lr=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}),Tr={eligible:"positive",hidden:"caution",resource:"neutral",redirect:"neutral",failed:"negative",unchecked:"neutral"};function Xn(n){if(!n)return"Date unavailable";const e=new Date(n);return Number.isNaN(e.getTime())?"Date unavailable":Lr.format(e)}function Gr(n){return n.replaceAll("_"," ").replaceAll("-"," ").replace(/\b\w/g,e=>e.toUpperCase())}function Zn(n){const e=Qe(n);return{label:Ot(e),tone:Tr[e]}}function Jn(n){if(n==null)return"Not scored";const e=n<=1?n*100:n;return`${Math.round(e)}%`}function Cr(n){return n.auditScore==null?"Not checked":`${Math.round(n.auditScore)}/100`}function M(n){return n==null?"Not available":Ne.format(n)}const Dr={clicksFromHome:"How many clicks it takes to reach this page from the home page, following links.",linksIn:"How many other pages link to this page.",linksOut:"How many other pages this page links to.",linkImportance:"How much link value flows to this page, based on how many pages link to it and how important those pages are. Shown relative to the highest page on this site, which is 100%.",technicalScore:"How well this page is set up for AI and search engines to read, from 0 to 100. Open a page to see what it is marked down for.",linkTimes:"How many times this link appears on the page it comes from.",pagesFound:"How many pages this scan discovered, whether or not it could load them.",pagesChecked:"How many of the pages it found this scan actually loaded.",internalLinks:"How many links between pages on this site the scan recorded."},Rr=new Set(["clicksFromHome","linkImportance","internalLinks","pagesFound","pagesChecked"]);function Te(n,e){const t=Dr[n];return Rr.has(n)?`${t} This always counts every link, including menu and footer.`:n==="technicalScore"||n==="linkTimes"?t:e?`${t} Right now this counts only links written in your page text. Menu and footer links are hidden.`:`${t} This counts every link, including menu and footer.`}function es(n,e){return`${Ne.format(n)} ${e}${n===1?"":"s"}`}function Pr(n,e){if(!n||!e)return null;try{const t=new URL(n),i=new URL(e),a=r=>r.hostname.toLowerCase().replace(/\.$/,"").replace(/^www\./,"");return a(t)!==a(i)?{requested:t.host,effective:i.host}:null}catch{return null}}function Ir(n){return n==="completed"?"positive":n==="partial"||n==="queued"||n==="running"?"caution":n==="failed"||n==="cancelled"?"negative":"neutral"}function Mr(n){const e=Xn(n.finishedAt??n.startedAt??n.createdAt),t=n.hasCrawlData?"":" · Score only";return`${e} · ${Gr(n.status)}${t}`}const Or={complete:"This scan finished on its own.",unknown:"This scan stopped before it checked every page it found.","max-pages":"This scan stopped at the page limit, so some pages were not checked.","max-edges":"This scan stopped at the link limit, so some links are missing.","max-fetches":"This scan stopped after checking as many pages as it could.","max-duration":"This scan ran out of time, so some pages were not checked.","max-bytes":"This scan stopped at the data limit, so some pages were not checked.","max-page-bytes":"This scan skipped a page that was too large to read.","max-depth":"This scan stopped at the depth limit, so deeper pages were not checked.","max-links-per-page":"This scan stopped reading links on pages that had too many.","max-query-variants":"This scan stopped at the limit for pages that differ only by a query string.","max-sitemap-fanout":"This scan stopped at the sitemap limit, so some sitemaps were not read.","max-sitemap-urls":"This scan stopped at the sitemap page limit, so some pages were not found.","root-host-redirect":"The site moved to another address during this scan."},zr=new Map(Object.entries(Or));function Fr(n){return n?zr.get(n)??`This scan stopped early: ${n}.`:"This scan stopped before it checked every page it found."}const Vt={applied:"This scan told menu and footer links apart by how often the same link repeats across pages. It cannot spot a link written into the page text when its wording matches the menu. Run a new scan to read the page layout instead.","applied-placement":"This scan read where each link sits in the page, so links in the page text are separated from the menu, header, and footer even when they use the same wording.","applied-placement-with-ubiquity":"This scan read where each link sits in the page. Some pages mark out no menu or main area, so those links fall back to how often the link repeats across pages, which can miss a link written into the page text.","applied-placement-partial":`This scan read where each link sits in the page. Some pages mark out no menu or main area, and this scan found fewer than ${rn} pages, so nothing could tell those links apart. They are counted as links in your page text, which is what a link no rule marked as menu, header, or footer means here.`,"unavailable-too-few-pages":`This scan found fewer than ${rn} pages and did not read where each link sits in the page. On a site that small every link is on most pages, so menu and footer links cannot be told apart from the rest.`,"unavailable-legacy-scan":"This scan ran before menu and footer links were separated. Run a new scan to split them out."},Ur=new Map(Object.entries(Vt));function ts(n){return n===null?"":Ur.get(n)??Vt["unavailable-legacy-scan"]}const ns="Scroll to zoom. Click a page to inspect it.",ss="Observed links to and from this page in the selected scan.",is="Page positions on this map were set before menu and footer links were separated. Run a new scan to update them.";function as(n){if(n.filterUnavailable)return`All ${es(n.totalEdgeCount,"link")} shown.`;const e=`${Ne.format(n.contentEdgeCount)} link${n.contentEdgeCount===1?"":"s"} in your page text`,t=Ne.format(n.templateEdgeCount);return n.showTemplateLinks?`${e}, ${t} menu and footer.`:`${e}. ${t} menu and footer link${n.templateEdgeCount===1?"":"s"} hidden.`}const rs="Menu, header, and footer links repeat on every page, so they say nothing about which pages relate to each other. Links written in your page text do.";function os(n,e){const t=[rs,ts(n)];return e.staleLayout&&t.push(is),t.filter(Boolean).join(" ")}function Br(n,e,t){if(n==="disabled")return{label:"Broken links: not checked",tone:"neutral"};const i=t??0,a=i>0?`, ${Ne.format(i)} unchecked`:"";return n==="complete"?e?{label:`Broken links: ${Ne.format(e)} found${a}`,tone:"negative"}:i>0?{label:`Broken links: none found, ${Ne.format(i)} unchecked`,tone:"caution"}:{label:"Broken links: none found",tone:"positive"}:n==="partial"?{label:`Broken links: ${Ne.format(e??0)} found so far${a}`,tone:"caution"}:{label:"Broken links: not checked",tone:"neutral"}}function Ft(n){return n.showTemplateLinks||!n.known?{value:M(n.total),hiddenNote:null,filtered:!1}:{filtered:!0,value:n.truncated?`${M(n.visible)}+`:M(n.visible),hiddenNote:n.hidden===0?null:n.truncated?`At least ${M(n.hidden)} menu and footer hidden`:`${M(n.hidden)} menu and footer hidden`}}function Nt({label:n,value:e,hiddenNote:t,help:i}){return s.jsxs("div",{className:"px-4 py-3",children:[s.jsxs("dt",{className:"flex items-center gap-1 text-xs text-muted",children:[n,s.jsx(we,{text:i})]}),s.jsx("dd",{className:"mt-1 text-sm font-medium tabular-nums text-heading",children:e}),t&&s.jsx("dd",{className:"mt-0.5 text-xs text-muted",children:t})]})}function Hr({page:n,inbound:e,outbound:t}){return s.jsx(s.Fragment,{children:s.jsxs("dl",{className:"grid grid-cols-2 divide-x divide-y divide-default rounded-lg border border-default sm:grid-cols-4 sm:divide-y-0",children:[s.jsx(Nt,{label:"Clicks from home",value:String(n.depth??"Not reached"),help:Te("clicksFromHome",!1)}),s.jsx(Nt,{label:"Links in",value:e.value,hiddenNote:e.hiddenNote,help:Te("linksIn",e.filtered)}),s.jsx(Nt,{label:"Links out",value:t.value,hiddenNote:t.hiddenNote,help:Te("linksOut",t.filtered)}),s.jsx(Nt,{label:"Link importance",value:Jn(n.linkScoreNormalized),help:Te("linkImportance",!1)})]})})}function ds(n,e,t){if(e===0)return n==="inbound"?"Nothing links to this page.":"This page links to nothing.";const i=n==="inbound"?"No links in the page text point here.":"No links in the page text lead away from here.",a=t?`At least ${M(e)} menu and footer links hidden.`:`${es(e,"menu and footer link")} hidden.`;return`${i} ${a}`}function Ye({label:n,metric:e}){return s.jsxs("span",{className:"inline-flex items-center gap-1",children:[n,s.jsx(we,{text:Te(e,!1)})]})}function jn({direction:n,edges:e,truncated:t,rootHost:i,hiddenTemplateCount:a}){const r=n==="inbound"?"Links in":"Links out";return s.jsxs("section",{className:"min-w-0","aria-labelledby":`site-health-${n}-heading`,children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[s.jsxs("h4",{id:`site-health-${n}-heading`,className:"text-sm font-medium text-heading",children:[r," (",M(e.length),")"]}),t&&s.jsxs("span",{className:"text-xs text-muted",children:["First ",Qn]})]}),e.length===0?s.jsx("p",{className:"rounded-lg border border-subtle bg-surface-subtle px-3 py-4 text-sm text-secondary",children:ds(n,a,t)}):s.jsx("div",{className:"evidence-table-wrap max-h-64 overflow-auto",children:s.jsxs("table",{className:"evidence-table site-health-table min-w-[420px]",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{scope:"col",children:"Page"}),s.jsx("th",{scope:"col",children:"Anchor text"}),s.jsx("th",{scope:"col",children:s.jsx(Ye,{label:"Times",metric:"linkTimes"})})]})}),s.jsx("tbody",{children:e.map(o=>{const d=n==="inbound"?o.sourceUrl:o.targetUrl;return s.jsxs("tr",{children:[s.jsx("td",{className:"max-w-64 truncate font-mono",title:d,children:Tn(d,i)}),s.jsx("td",{className:"max-w-52 truncate",title:o.anchors.join(", ")||void 0,children:o.anchors.join(", ")||"No anchor text"}),s.jsx("td",{className:"tabular-nums",children:M(o.occurrences)})]},o.edgeKey)})})]})})]})}function Kr(n){return n&&"indexabilityReasons"in n?n.indexabilityReasons:[]}function kn({page:n,isLoading:e,error:t,inbound:i,outbound:a,inboundTruncated:r,outboundTruncated:o,audit:d,auditLoading:c,auditError:l,onRetryAudit:p,rootHost:u,reasonSource:h,reasonsState:b,onRetryReasons:S,showTemplateLinks:k}){if(!n)return s.jsxs("section",{className:"border-t border-default pt-5","aria-label":"Selected page details",children:[s.jsx("h3",{className:"text-base font-medium text-heading",children:"Page links"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Select a page to inspect its internal links and crawl signals."})]});const D=Zn(n),T=Kr(h??n),z=k?i:i.filter(G=>!G.isTemplate),C=k?a:a.filter(G=>!G.isTemplate),x=!e&&!t,g=i.length-z.length,f=a.length-C.length,v=Ft({total:n.inboundUniqueEdges,visible:z.length,hidden:g,truncated:r,showTemplateLinks:k,known:x}),$=Ft({total:n.outboundUniqueEdges,visible:C.length,hidden:f,truncated:o,showTemplateLinks:k,known:x});return s.jsxs("section",{className:"border-t border-default pt-5","aria-labelledby":"site-health-page-inspector-title",children:[s.jsxs("div",{className:"flex flex-col justify-between gap-3 sm:flex-row sm:items-start",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h3",{id:"site-health-page-inspector-title",className:"break-words font-mono text-base font-semibold text-heading",children:n.path}),s.jsx(J,{tone:D.tone,children:D.label})]}),s.jsx("p",{className:"mt-1 break-all text-sm text-secondary",children:n.url}),b==="loading"?s.jsx("p",{className:"mt-2 text-sm text-secondary",role:"status",children:"Loading page details..."}):b==="error"?s.jsxs("p",{className:"mt-2 flex flex-wrap items-center gap-2 text-sm text-negative",role:"alert",children:["Page details could not be loaded, so any reason this page is hidden is unknown.",s.jsx(O,{type:"button",variant:"secondary",size:"sm",onClick:S,children:"Try again"})]}):T.length>0?s.jsx("ul",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-sm text-secondary","aria-label":"Why this page is hidden",children:T.map(G=>s.jsx("li",{children:vr(G)},G))}):null]}),s.jsx(O,{asChild:!0,variant:"secondary",size:"sm",children:s.jsxs("a",{href:n.url,target:"_blank",rel:"noreferrer",children:["Open page ",s.jsx(Zs,{className:"size-3.5","aria-hidden":"true"})]})})]}),s.jsx("div",{className:"mt-4",children:s.jsx(sr,{audit:d,isLoading:c,error:l,onRetry:p})}),s.jsxs("section",{className:"mt-5 border-t border-default pt-5","aria-labelledby":"site-health-page-links-heading",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("h3",{id:"site-health-page-links-heading",className:"text-base font-semibold text-heading",children:"Internal links"}),s.jsx(we,{text:ss})]}),s.jsx("div",{className:"mt-4",children:s.jsx(Hr,{page:n,inbound:v,outbound:$})}),s.jsx("div",{className:"mt-5",children:e?s.jsxs("div",{className:"flex items-center gap-2 py-6 text-sm text-secondary",children:[s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading page links..."]}):t?s.jsx("p",{className:"rounded-lg border border-negative bg-negative-soft px-4 py-3 text-sm text-negative",role:"alert",children:"Page links could not be loaded."}):s.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[s.jsx(jn,{direction:"inbound",edges:z,truncated:r,rootHost:u,hiddenTemplateCount:g}),s.jsx(jn,{direction:"outbound",edges:C,truncated:o,rootHost:u,hiddenTemplateCount:f})]})})]})]})}function Wr({pages:n,total:e,selectedNodeKey:t,onSelect:i,hasNextPage:a,isFetchingNextPage:r,onLoadMore:o,filter:d,onFilterChange:c,filterUnavailable:l}){const[p,u]=y.useState(""),h=p.trim().toLowerCase(),b=y.useMemo(()=>h?n.filter(k=>`${k.path} ${k.url}`.toLowerCase().includes(h)):n,[h,n]),S=h.length>0&&(a||n.length<e);return s.jsxs("section",{"aria-labelledby":"site-health-inventory-heading",children:[s.jsxs("div",{className:"mb-3 flex flex-col justify-between gap-3 sm:flex-row sm:items-end",children:[s.jsxs("div",{children:[s.jsx("h2",{id:"site-health-inventory-heading",className:"text-base font-semibold text-heading",children:"Pages"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:d==="all"?`Showing ${M(n.length)} of ${M(e)} pages found.`:`Showing ${M(n.length)} of ${M(e)} hidden pages.`})]}),s.jsxs("label",{className:"relative block w-full sm:w-72",children:[s.jsx("span",{className:"sr-only",children:"Search loaded pages"}),s.jsx(Ut,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted","aria-hidden":"true"}),s.jsx("input",{type:"search",value:p,onChange:k=>u(k.target.value),placeholder:"Search loaded pages",className:"h-9 w-full rounded-md border border-base bg-bg pl-9 pr-3 text-sm text-primary outline-none placeholder-mono-600 focus:border-strong focus:ring-2 focus:ring-mono-600"})]})]}),s.jsx("div",{className:"mb-3 flex flex-wrap gap-2",role:"group","aria-label":"Filter pages",children:Yn.map(k=>s.jsx("button",{type:"button","aria-pressed":d===k.id,onClick:()=>c(k.id),className:`filter-chip ${d===k.id?"filter-chip-active":""}`,children:k.label},k.id))}),s.jsx("div",{className:"evidence-table-wrap",children:s.jsxs("table",{className:"evidence-table site-health-table min-w-[800px]",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{scope:"col",children:"Page"}),s.jsx("th",{scope:"col",title:Xe("eligible"),children:"Status"}),s.jsx("th",{scope:"col",children:s.jsx(Ye,{label:"Clicks from home",metric:"clicksFromHome"})}),s.jsx("th",{scope:"col",children:s.jsx(Ye,{label:"Links in",metric:"linksIn"})}),s.jsx("th",{scope:"col",children:s.jsx(Ye,{label:"Links out",metric:"linksOut"})}),s.jsx("th",{scope:"col",children:s.jsx(Ye,{label:"Link importance",metric:"linkImportance"})}),s.jsx("th",{scope:"col",children:s.jsx(Ye,{label:"Score",metric:"technicalScore"})})]})}),s.jsx("tbody",{children:b.map(k=>{const D=Zn(k);return s.jsxs("tr",{className:t===k.nodeKey?"bg-surface-active":void 0,children:[s.jsx("td",{className:"max-w-80",children:s.jsx("button",{type:"button",onClick:()=>i(k.nodeKey),className:"block max-w-full truncate rounded-sm font-mono text-sm font-medium text-link outline-none focus-visible:ring-2 focus-visible:ring-mono-400",title:k.url,children:k.path})}),s.jsx("td",{title:Xe(Qe(k)),children:s.jsx(J,{tone:D.tone,children:D.label})}),s.jsx("td",{className:"tabular-nums",children:k.depth??"Not reached"}),s.jsx("td",{className:"tabular-nums",children:M(k.inboundUniqueEdges)}),s.jsx("td",{className:"tabular-nums",children:M(k.outboundUniqueEdges)}),s.jsx("td",{className:"tabular-nums",children:Jn(k.linkScoreNormalized)}),s.jsx("td",{className:"tabular-nums",children:Cr(k)})]},k.nodeKey)})})]})}),b.length===0&&s.jsx("p",{className:"border-x border-b border-default px-4 py-8 text-center text-sm text-secondary",children:h.length===0?l?"This scan cannot be filtered. Run a new scan to filter its pages.":d==="hidden"?"No hidden pages were found in this scan.":"No pages are available.":S?`No matches in the ${M(n.length)} loaded pages. Load more pages to continue searching.`:"No pages match this search."}),a&&s.jsx("div",{className:"flex justify-center border-x border-b border-default px-4 py-3",children:s.jsxs(O,{variant:"secondary",size:"sm",disabled:r,onClick:o,children:[r&&s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),r?"Loading more pages":"Load more pages"]})})]})}function qr({projectName:n,runId:e,section:t,onSelect:i}){const[a,r]=y.useState(!1),d=t.pageCount-(t.hasPage?1:0)>0;return s.jsxs("li",{children:[s.jsxs("div",{className:"flex min-h-11 items-center gap-1 px-2 py-1",children:[d?s.jsx("button",{type:"button","aria-label":`${a?"Collapse":"Expand"} ${t.path}`,"aria-expanded":a,onClick:()=>r(c=>!c),className:"flex size-8 shrink-0 items-center justify-center rounded-sm text-muted outline-none hover:bg-surface-hover hover:text-heading focus-visible:ring-2 focus-visible:ring-mono-400",children:a?s.jsx(_n,{className:"size-3.5","aria-hidden":"true"}):s.jsx(kt,{className:"size-3.5","aria-hidden":"true"})}):s.jsx("span",{className:"block size-8 shrink-0","aria-hidden":"true"}),s.jsx("button",{type:"button",onClick:()=>i(t.path),className:"min-w-0 flex-1 break-all rounded-sm py-2 text-left font-mono text-sm text-heading outline-none hover:text-link focus-visible:ring-2 focus-visible:ring-mono-400",children:t.path}),s.jsx("span",{className:"shrink-0 px-2 font-mono text-xs text-muted",children:M(t.pageCount)})]}),a&&s.jsx("div",{className:"ml-6 border-l border-default pl-1",children:s.jsx(ls,{projectName:n,runId:e,parentPath:t.path,onSelect:i})})]})}function Vr({page:n,onSelect:e}){return s.jsx("li",{className:"bg-surface-subtle",children:s.jsxs("div",{className:"flex min-h-11 items-center gap-1 px-2 py-1",children:[s.jsx("span",{className:"block size-8 shrink-0","aria-hidden":"true"}),s.jsx("button",{type:"button",onClick:()=>e(n.nodeKey),className:"min-w-0 flex-1 break-all rounded-sm py-2 text-left font-mono text-sm font-semibold text-heading outline-none hover:text-link focus-visible:ring-2 focus-visible:ring-mono-400",children:n.path||"/"}),s.jsx("span",{className:"shrink-0 px-2 font-mono text-xs text-muted",children:M(1)})]})})}function ls({projectName:n,runId:e,parentPath:t,onSelect:i,rootPage:a,onSelectRootPage:r}){const o={client:ie,path:{name:n},query:{runId:e,parentPath:t,limit:kr}},d=En({...Bs(o),initialPageParam:o,getNextPageParam:l=>l.nextCursor?{path:o.path,query:{...o.query,cursor:l.nextCursor}}:void 0}),c=d.data?.pages.flatMap(l=>l.children)??[];return d.isLoading?s.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-sm text-secondary",role:"status",children:[s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"})," Loading sections..."]}):d.error?s.jsx("p",{className:"px-3 py-4 text-sm text-negative",role:"alert",children:"Site sections could not be loaded."}):c.length===0&&!a?s.jsx("p",{className:"px-3 py-4 text-sm text-secondary",children:"No nested sections were found."}):s.jsxs(s.Fragment,{children:[s.jsxs("ul",{className:"divide-y divide-default",children:[a&&r&&s.jsx(Vr,{page:a,onSelect:r}),c.map(l=>s.jsx(qr,{projectName:n,runId:e,section:l,onSelect:i},l.path))]}),d.hasNextPage&&s.jsx("div",{className:"px-3 py-2",children:s.jsx(O,{variant:"ghost",size:"sm",disabled:d.isFetchingNextPage,onClick:()=>{d.fetchNextPage()},children:d.isFetchingNextPage?"Loading more sections":"Load more sections"})})]})}function Yr(){return s.jsx("div",{role:"status",className:"flex min-h-[420px] items-center justify-center rounded-lg border border-default bg-surface-inset px-6 text-center lg:min-h-[520px]",children:s.jsxs("div",{className:"max-w-sm",children:[s.jsx(ve,{className:"mx-auto size-5 motion-safe:animate-spin text-muted","aria-hidden":"true"}),s.jsx("p",{className:"mt-3 text-sm font-medium text-heading",children:"Preparing the interactive site map"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Page and link data is ready for the graph renderer."})]})})}function Sn(n){return n==="discovering"?"Discovering pages":n==="checking"?"Checking pages":n==="arranging-map"?"Arranging map":n==="queued"?"Waiting to start":"Preparing scan"}function Qr(n){return n!=="completed"&&n!=="partial"&&n!=="failed"&&n!=="cancelled"}function Xr(n){return n==="queued"||n==="discovering"||n==="checking"||n==="arranging-map"}function Zr(n){return n==="completed"||n==="partial"||n==="failed"||n==="cancelled"}function Jr(n){if(!n||typeof n!="object")return null;const e=n;if(typeof e.code=="string")return e.code;if(e.error&&typeof e.error=="object"){const t=e.error;return typeof t.code=="string"?t.code:null}return null}function eo(n){if(!n)return null;const e=Date.parse(n);return!Number.isFinite(e)||e>Date.now()?null:e+_r}function to({active:n,runId:e,createdAt:t}){const i=eo(t),[a,r]=y.useState(null);return y.useEffect(()=>{if(!n||!e||i==null){r(null);return}const o=i-Date.now();if(o<=0){r({runId:e,deadline:i});return}r(null);const d=window.setTimeout(()=>r({runId:e,deadline:i}),o);return()=>window.clearTimeout(d)},[n,i,e]),n&&e!=null&&i!=null&&(Date.now()>=i||a?.runId===e&&a.deadline===i)}function no({onContinueOnboarding:n,onSkipOnboarding:e}){return s.jsxs("section",{"aria-labelledby":"site-health-continuation-heading",className:"mt-5 flex flex-col gap-3 border-t border-default pt-5 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{children:[s.jsx("h3",{id:"site-health-continuation-heading",className:"text-base font-semibold text-heading",children:"Continue while Site Health finishes"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Canonry will finish this scan locally. Saved results will appear in Site Health."})]}),s.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2",children:[s.jsx(O,{type:"button",onClick:n,children:"Set up AI Visibility"}),s.jsx(O,{type:"button",variant:"secondary",onClick:e,children:"Skip for now"})]})]})}function Ve({view:n,tabbed:e=!0,children:t}){return s.jsx("div",{id:e?`site-health-${n}-panel`:void 0,role:e?"tabpanel":void 0,"aria-labelledby":e?`site-health-${n}-tab`:void 0,className:"min-w-0",children:t})}function so({status:n,progress:e,progressError:t,onRetryProgress:i,pageHealthDestination:a=!1,livePageHealthPreview:r,livePageHealthError:o=!1,livePageHealthRunId:d=null,continuation:c}){const l=e?.attempt??null,p=e?.phase??n,u=p==="arranging-map";return s.jsxs("section",{"aria-label":"Current scan progress",className:"rounded-lg border border-caution bg-caution-soft px-5 py-6",children:[s.jsx("h2",{className:"min-h-6 text-base font-semibold text-heading",children:u&&a?"Preparing page health":u?"Preparing site map":"Scanning site"}),s.jsx("p",{"aria-atomic":"true","aria-label":"Current scan progress","aria-live":"polite",role:"status",className:"mt-1 min-h-[4.5rem] text-sm text-secondary sm:min-h-10",children:a?u?"Finalizing page health. The scan is complete and its findings are being published.":`${Sn(p)}. Page health appears after the scan finishes.`:u?"Arranging map. The scan is complete and its map is being published.":`${Sn(p)}. The map appears after the scan finishes.`}),s.jsxs("dl",{"aria-label":"Live scan counters",className:"mt-5 grid grid-cols-2 divide-x divide-y divide-default rounded-lg border border-default bg-surface-subtle sm:grid-cols-4 sm:divide-y-0",children:[s.jsxs("div",{className:"px-4 py-3",children:[s.jsx("dt",{className:"text-sm text-secondary",children:"Pages found"}),s.jsx("dd",{className:"mt-1 font-mono text-lg font-semibold tabular-nums text-heading",children:l?M(l.pagesDiscovered):"—"})]}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsx("dt",{className:"text-sm text-secondary",children:"Pages checked"}),s.jsx("dd",{className:"mt-1 font-mono text-lg font-semibold tabular-nums text-heading",children:l?M(l.pagesFetched):"—"})]}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsx("dt",{className:"text-sm text-secondary",children:"Links found"}),s.jsx("dd",{className:"mt-1 font-mono text-lg font-semibold tabular-nums text-heading",children:l?M(l.edgesDiscovered):"—"})]}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsx("dt",{className:"text-sm text-secondary",children:"Pages failed"}),s.jsx("dd",{className:"mt-1 font-mono text-lg font-semibold tabular-nums text-heading",children:l?M(l.pagesErrored):"—"})]})]}),t&&s.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3 text-sm text-secondary",children:[s.jsx("span",{children:u?a?"Page health publishing status could not load.":"Map publishing status could not load.":"Live scan counts could not load. The scan is still running."}),i&&s.jsx(O,{type:"button",variant:"secondary",size:"sm",onClick:i,children:"Retry progress"})]}),a?s.jsx(cs,{runId:d,preview:r,error:o}):null,c]})}function jt(){return Array.from({length:$r},()=>null)}function io(n,e){return n===e||n!=null&&e!=null&&n.nodeKey===e.nodeKey&&n.url===e.url&&n.auditScore===e.auditScore&&n.checksNeedingAttention===e.checksNeedingAttention}function ao(n,e){return n.length===e.length&&n.every((t,i)=>io(t,e[i]??null))}function ro(n,e){const t=[...n];for(const i of e){const a=t.findIndex(o=>o?.nodeKey===i.nodeKey);if(a>=0){t[a]=i;continue}const r=t.findIndex(o=>o==null);if(r<0)break;t[r]=i}return t}function cs({runId:n,preview:e,error:t=!1}){const[i,a]=y.useState(()=>({runId:n,slots:jt()})),r=e?.state==="terminal",o=r||i.runId!==n?jt():i.slots;y.useEffect(()=>{a(l=>{const p=l.runId===n?l.slots:jt(),u=r?jt():ro(p,e?.examples??[]);return l.runId===n&&ao(l.slots,u)?l:{runId:n,slots:u}})},[e?.examples,n,r]);const d=e?.pagesAudited??0,c=o.some(l=>l!=null);return s.jsxs("section",{"aria-labelledby":"live-page-health-findings-heading",className:"mt-5 border-t border-default pt-5",children:[s.jsx("h3",{id:"live-page-health-findings-heading",className:"text-base font-semibold text-heading",children:"Findings so far"}),s.jsxs("div",{className:"relative mt-1 min-h-[5.25rem] text-sm text-secondary sm:min-h-[3.5rem]",children:[s.jsxs("p",{children:["Based on ",Ne.format(d)," audited pages. Results may change until the scan finishes."]}),s.jsx("p",{className:Ue("absolute bottom-0 text-caution",t?"visible":"invisible"),children:"Live findings paused. The scan is still running."})]}),s.jsx("ul",{"aria-label":"Live Page Health findings",className:"mt-3 grid h-[10.5rem] grid-rows-3 divide-y divide-default overflow-hidden rounded-lg border border-default bg-surface-subtle",children:o.map((l,p)=>{const u=l==null&&p===0&&!c,h=l==null&&!u;return s.jsx("li",{"aria-hidden":h||void 0,"data-testid":"live-page-health-slot",className:"grid h-14 min-h-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-2 px-4 sm:gap-4",children:l?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-strong",title:l.url,children:l.url}),s.jsxs("span",{className:"shrink-0 whitespace-nowrap text-sm tabular-nums text-secondary",children:[s.jsxs("span",{"aria-hidden":"true",className:"sm:hidden",children:[Ne.format(l.checksNeedingAttention)," checks"]}),s.jsxs("span",{className:"hidden sm:inline",children:[Ne.format(l.checksNeedingAttention)," checks need attention"]}),s.jsxs("span",{className:"sr-only sm:hidden",children:[Ne.format(l.checksNeedingAttention)," checks need attention"]})]})]}):u?s.jsx("span",{className:"text-sm text-secondary",children:"Checks that need attention will appear here."}):null},`live-page-health-slot-${p}`)})})]})}function oo({phase:n,progress:e,onRunAgain:t,pageHealthDestination:i=!1}){const a=n==="cancelled",r=e?.error??e?.attempt?.error;return s.jsxs("section",{"aria-label":"Site scan recovery",role:"alert",className:"rounded-lg border border-negative bg-negative-soft px-5 py-6",children:[s.jsx("h2",{className:"text-base font-semibold text-negative",children:a?"Scan cancelled":"Scan failed"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:i?a?"The scan was cancelled before Canonry could publish page health results.":"The scan did not complete, so page health results are unavailable.":a?"The scan was cancelled before Canonry could publish a site map.":"The scan did not complete, so there is no site map for this run."}),r&&s.jsx("p",{className:"mt-3 text-sm text-negative",children:r}),s.jsx(O,{type:"button",className:"mt-4",onClick:t,children:"Run scan again"})]})}function lo({projectName:n,projectId:e,initialRunId:t,onReleaseInitialRun:i,showOnboardingActions:a=!1,onContinueOnboarding:r,onSkipOnboarding:o}){const[d,c]=y.useState("map"),l=y.useRef([]),[p,u]=y.useState(()=>t??null),h=y.useRef(t),[b,S]=y.useState(null),[k,D]=y.useState(!1),[T,z]=y.useState("all"),[C,x]=y.useState(!1),g=Dt(),f=a&&!g,v=An();y.useEffect(()=>{const N=h.current;N!==t&&(h.current=t,u(Q=>t??(Q===N?null:Q)),S(null))},[t]);const G=fe({...Ts({client:ie,path:{name:n},query:{limit:Nr}}),refetchOnWindowFocus:"always",refetchInterval:N=>N.state.data?.scans.some(Q=>Q.status==="queued"||Q.status==="running")?3e3:15e3}).data?.scans??[],A=G.find(N=>N.status==="queued"||N.status==="running"),I=G.find(N=>N.status==="completed"||N.status==="partial"),le=f?v.data?.runId??null:null,W=p??(f?le??A?.runId??I?.runId:I?.runId??A?.runId)??null,Se=A?.runId===W?A:null,X=W?G.find(N=>N.runId===W):void 0,te=!!(t&&W===t),_=!!(le&&W===le),ae=_&&!X,me=Se?.runId??(te||ae?W:null),U=fe({...Gs({client:ie,path:{name:n,runId:me??""}}),enabled:!!me,refetchInterval:N=>Qr(N.state.data?.phase)?3e3:!1});y.useEffect(()=>{!te||!U.isError||Jr(U.error)==="NOT_FOUND"&&(u(null),S(null),i?.())},[U.error,U.isError,te,i]);const Ae=Xr(U.data?.phase),ce=Zr(U.data?.phase)?null:Se,_e=!!(me&&U.isPending),ge=!!(!!((te||_)&&!X)&&U.isError),De=!!(f&&me&&(ce?.runId===me||Ae)),re=fe({...Cs({client:ie,path:{name:n,runId:me??""}}),enabled:De,refetchInterval:N=>N.state.data?.state==="terminal"?!1:3e3,refetchIntervalInBackground:!0}),Re=!!(ce||Ae||_e||ge),oe=U.data?.phase==="failed"||U.data?.phase==="cancelled"?U.data.phase:(te||_)&&(X?.status==="failed"||X?.status==="cancelled")?X.status:null,ue=fe({...Ds({client:ie,path:{name:n},...W?{query:{runId:W}}:{}}),enabled:!Re}),P=ue.data,se=W??P?.runId??null,m=!!(se&&P?.hasCrawlData&&P.detailsAvailable),H=m&&!f,B=se?{runId:se}:{},R=fe({...Rs({client:ie,path:{name:n},query:{...B,maxNodes:Er,maxEdges:Ar}}),enabled:H&&!Re}),Z=Yn.find(N=>N.id===T)?.healthState,Le={client:ie,path:{name:n},query:{...B,...Z?{healthState:Z}:{},limit:jr,sort:"path"}},he=En({...Is(Le),enabled:H,initialPageParam:Le,getNextPageParam:N=>N.nextCursor?{path:Le.path,query:{...Le.query,cursor:N.nextCursor}}:void 0}),Pe=H&&(P?.deadLinks.state==="complete"||P?.deadLinks.state==="partial"),de=fe({...Ms({client:ie,path:{name:n},query:{...B,limit:Sr}}),enabled:Pe}),xe=R.data?.nodes??[],Be=R.data?.layout.state==="ready"?R.data.totalEdges:null,Ee=R.data?.edges??[],nt=y.useMemo(()=>Ee.filter(N=>N.isTemplate).length,[Ee]),E=Ee.length-nt,V=R.data?.templateDetection??null,K=V===null||!Us(V),st=y.useMemo(()=>C||K?Ee:Ee.filter(N=>!N.isTemplate),[Ee,C,K]),us=R.data?.layout.state==="ready"&&!R.data.layout.templateLinksExcluded,ut=y.useMemo(()=>he.data?.pages.flatMap(N=>N.pages)??[],[he.data]),hs=he.data?.pages[0]?.total??ut.length,Yt=y.useMemo(()=>ut.find(N=>N.nodeKey===b)??null,[ut,b]),Et=!!(m&&b&&!Yt),Ie=fe({...on({client:ie,path:{name:n},query:{...B,...Z?{healthState:Z}:{},nodeKey:b??void 0,limit:1}}),enabled:Et}),it=Yt??Ie.data?.pages[0]??null,ht=!!(b&&Z&&Et&&Ie.isSuccess&&Ie.data.healthStateFilter==="applied"&&Ie.data.pages.length===0);y.useEffect(()=>{ht&&S(null)},[ht]);const Me=y.useMemo(()=>ht?null:xe.find(N=>N.nodeKey===b)??it,[xe,it,b,ht]),He=Me?.nodeKey??null,Qt=Me?it?"ready":Ie.isError?"error":Et&&Ie.isLoading?"loading":"ready":"idle",be=fe({...Os({client:ie,path:{name:n},query:{...B,nodeKey:He??void 0,limit:Qn}}),enabled:H&&!!He}),Oe=fe({...zs({client:ie,path:{name:n},query:{...B,nodeKey:He??void 0}}),enabled:H&&!!He}),ps=y.useMemo(()=>{const N=G.filter(q=>q.status==="completed"||q.status==="partial"),Q=p?G.find(q=>q.runId===p):void 0;return Q&&!N.some(q=>q.runId===Q.runId)?[Q,...N]:N},[G,p]),fs=G[0]?.status??null,pt=se?X:void 0,Fe=ce?ce.status:Ae?U.data?.status??null:oe??P?.runStatus??pt?.status??null,ms=Fe==="running"?"Scan running":Fe==="queued"?"Scan queued":Fe==="partial"?"Partial scan":Fe==="completed"?"Complete":Fe==="failed"?"Scan failed":Fe==="cancelled"?"Scan cancelled":"No scan",ft=de.data,Xt=ft&&"found"in ft?ft:P?.deadLinks&&"found"in P.deadLinks?P.deadLinks:void 0,Zt=Br(ft?.state??P?.deadLinks?.state??"unavailable",Xt?.found,Xt?.unverified),At=Pr(P?.requestedRootUrl??null,P?.rootUrl??null),Jt=Ln(P?.rootUrl??null),mt=R.data?.rootNodeKey??null,en=fe({...on({client:ie,path:{name:n},query:{...B,nodeKey:mt??void 0,limit:1}}),enabled:!!(m&&mt)}),gs=y.useMemo(()=>xe.find(N=>N.nodeKey===mt)??en.data?.pages[0]??null,[xe,mt,en.data]),gt=v.isPending||!!ce||Ae||_e,_t=Re||f&&v.isPending,xs=X?.status==="queued"||X?.status==="running",bs=to({active:f&&_t&&!!(r&&o)&&!!(xs||me===W&&Ae),runId:W,createdAt:X?.createdAt}),xt=!!(P?.hasCrawlData&&!_t&&!oe),pe=f?xt?"technical":"map":d,tn=pe==="technical"?"map":pe,ys=N=>{u(N||null),S(null)},at=()=>{u(null),S(null),t&&i?.(),v.mutate({projectName:n,projectId:e,body:{checkDeadLinks:f||k}})},ws=N=>{const Q=xe.find(q=>q.path===N||q.path.startsWith(`${N}/`));Q&&S(Q.nodeKey)},nn=N=>c(N),vs=(N,Q)=>{let q=null;N.key==="ArrowRight"||N.key==="ArrowDown"?q=(Q+1)%qe.length:N.key==="ArrowLeft"||N.key==="ArrowUp"?q=(Q-1+qe.length)%qe.length:N.key==="Home"?q=0:N.key==="End"&&(q=qe.length-1),q!=null&&(N.preventDefault(),nn(qe[q].id),l.current[q]?.focus())};return s.jsxs("div",{className:"space-y-5",children:[f?s.jsx(Fs,{current:xt?"fixes":"site"}):null,!f&&s.jsxs("header",{className:"flex flex-col justify-between gap-4 lg:flex-row lg:items-start",children:[s.jsx("div",{children:s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("h2",{className:"text-xl font-semibold tracking-tight text-heading",children:"Site Health"}),s.jsx(we,{text:Vn[pe]}),s.jsx(J,{tone:Ir(Fe),children:ms}),pt&&s.jsx("span",{className:"text-xs text-muted",children:Xn(pt.finishedAt??pt.startedAt)})]})}),s.jsxs("div",{className:"flex flex-wrap items-start gap-2",children:[s.jsxs("label",{className:"grid gap-1 text-xs text-muted",children:["Scan history",s.jsxs("select",{"aria-label":"View a Site Health scan",value:p??"",onChange:N=>ys(N.target.value),className:"h-9 min-w-48 rounded-md border border-base bg-bg px-3 text-sm text-primary outline-none focus:border-strong focus:ring-2 focus:ring-mono-600",children:[s.jsx("option",{value:"",children:"Latest scan"}),ps.map(N=>s.jsx("option",{value:N.runId,children:Mr(N)},N.runId))]})]}),!g&&s.jsxs("div",{className:"flex items-end gap-2 pt-5",children:[s.jsxs("details",{className:"group relative",children:[s.jsxs("summary",{className:"flex h-9 cursor-pointer list-none items-center gap-2 rounded-md border border-base bg-bg px-3 text-sm font-medium text-heading outline-none hover:bg-bg-elevated focus-visible:ring-2 focus-visible:ring-mono-400",children:[s.jsx(Xs,{className:"size-4","aria-hidden":"true"}),"Scan settings"]}),s.jsx("div",{className:"absolute right-0 z-20 mt-2 w-72 rounded-lg border border-strong bg-bg-elevated p-4 shadow-[0_12px_32px_var(--color-shadow-panel)]",children:s.jsxs("label",{className:"flex cursor-pointer items-start gap-3 text-sm text-heading",children:[s.jsx("input",{type:"checkbox","aria-label":"Check dead links",checked:k,disabled:gt,onChange:N=>D(N.target.checked),className:"mt-0.5 size-4 rounded border-base accent-mono-200 focus:ring-2 focus:ring-mono-400"}),s.jsxs("span",{children:[s.jsx("span",{className:"font-medium",children:"Check dead links"}),s.jsx("span",{className:"mt-1 block text-sm text-secondary",children:"Adds dead-link analysis to this scan."})]})]})})]}),s.jsxs(Rt,{onClick:at,disabled:gt,children:[gt?s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}):s.jsx(It,{className:"size-4","aria-hidden":"true"}),A?.status==="running"?"Scan running":A?.status==="queued"?"Scan queued":"Run scan"]})]})]})]}),P?.hasCrawlData&&pe!=="technical"&&s.jsxs("div",{className:"grid grid-cols-2 divide-x divide-y divide-default rounded-lg border border-default bg-surface-subtle sm:grid-cols-4 sm:divide-y-0",children:[s.jsxs("div",{className:"px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted",children:["Pages found",s.jsx(we,{text:Te("pagesFound",!1)})]}),s.jsx("div",{className:"mt-1 text-xl font-semibold tabular-nums text-heading",children:M(P.counts.pagesDiscovered)})]}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted",children:["Pages checked",s.jsx(we,{text:Te("pagesChecked",!1)})]}),s.jsx("div",{className:"mt-1 text-xl font-semibold tabular-nums text-heading",children:M(P.counts.pagesFetched)})]}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsx("div",{className:"text-xs text-muted",title:Xe("eligible"),children:"Indexable"}),s.jsx("div",{className:"mt-1 text-xl font-semibold tabular-nums text-heading",children:M(P.counts.pagesEligible)})]}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted",children:["Internal links",s.jsx(we,{text:Te("internalLinks",!1)})]}),s.jsx("div",{className:"mt-1 text-xl font-semibold tabular-nums text-heading",children:M(Be)})]})]}),f&&xt&&s.jsxs("section",{"aria-labelledby":"ai-visibility-next-heading",className:"flex flex-col gap-3 border-b border-default pb-5 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{children:[s.jsx("h2",{id:"ai-visibility-next-heading",className:"text-base font-semibold text-heading",children:"Next: Set up AI Visibility"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"See whether answer engines mention your brand and cite your pages."})]}),s.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2",children:[s.jsx(O,{type:"button",onClick:r,children:"Set up AI Visibility"}),s.jsx(O,{type:"button",variant:"secondary",onClick:o,children:"Skip for now"})]})]}),!f&&s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-default",children:[s.jsx("div",{role:"tablist","aria-label":"Site Health views","aria-orientation":"horizontal",className:"flex min-w-0 gap-5",children:qe.map((N,Q)=>s.jsx("button",{type:"button",role:"tab",id:`site-health-${N.id}-tab`,"aria-selected":pe===N.id,"aria-controls":`site-health-${N.id}-panel`,tabIndex:pe===N.id?0:-1,ref:q=>{l.current[Q]=q},onClick:()=>nn(N.id),onKeyDown:q=>vs(q,Q),className:`min-h-11 border-b-2 px-0.5 text-sm font-medium outline-none transition-colors focus-visible:ring-2 focus-visible:ring-mono-400 disabled:cursor-not-allowed disabled:opacity-50 ${pe===N.id?"border-strong text-heading":"border-transparent text-secondary hover:border-base hover:text-primary"}`,children:N.label},N.id))}),P?.hasCrawlData&&pe!=="technical"&&s.jsxs("div",{className:"flex items-center gap-2 pb-2",children:[s.jsx("span",{className:"text-xs text-muted",children:"Dead-link check"}),s.jsx(J,{tone:Zt.tone,children:Zt.label})]})]}),!p&&A&&!ce&&s.jsx("div",{className:"rounded-lg border border-caution bg-caution-soft px-4 py-3 text-sm text-caution",role:"status",children:"A newer scan is running. The latest published result remains available until it finishes."}),At&&s.jsxs("div",{className:"rounded-lg border border-base bg-surface-subtle px-4 py-3 text-sm text-secondary",role:"status",children:[s.jsx("span",{className:"font-medium text-heading",children:"Site address changed during this scan."})," ","The scan started at ",s.jsx("span",{className:"font-mono text-primary",children:At.requested})," and continued at"," ",s.jsx("span",{className:"font-mono text-primary",children:At.effective}),"."," ",f?"Page health uses the new address.":"The map and inventory use the new address."]}),P?.hasCrawlData&&!P.complete&&s.jsx("div",{className:"rounded-lg border border-caution bg-caution-soft px-4 py-3 text-sm text-caution",role:"status",children:Fr(P.termination)}),!A&&fs==="failed"&&!p&&s.jsxs("div",{className:"flex gap-3 rounded-lg border border-negative bg-negative-soft px-4 py-3 text-sm text-negative",role:"alert",children:[s.jsx(Pt,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:"The latest scan failed. The previous completed results remain available."})]}),oe?s.jsx(Ve,{view:tn,tabbed:!f,children:s.jsx(oo,{phase:oe,progress:U.data,onRunAgain:at,pageHealthDestination:f})}):_t?s.jsx(Ve,{view:tn,tabbed:!f,children:s.jsx(so,{status:U.data?.phase??(ce?.status==="running"?"running":"queued"),progress:U.data,progressError:U.isError,onRetryProgress:()=>{U.refetch()},pageHealthDestination:f,livePageHealthPreview:re.data,livePageHealthError:re.isError,livePageHealthRunId:me,continuation:bs?s.jsx(no,{onContinueOnboarding:r,onSkipOnboarding:o}):null})}):pe==="technical"?s.jsxs("div",{id:"site-health-technical-panel",role:f?void 0:"tabpanel","aria-labelledby":f?void 0:"site-health-technical-tab",className:"min-w-0 space-y-6",children:[f?s.jsx("h2",{className:"text-xl font-semibold tracking-tight text-heading",children:"Page health"}):null,s.jsx(br,{projectName:n,projectId:e,runId:se,integrated:!0,compactCopy:f,unavailableFooter:f&&xt?s.jsx("section",{"aria-label":"Page health recovery",className:"mt-4",children:s.jsx(O,{type:"button",disabled:gt,onClick:()=>{c("map"),at()},children:"Run site audit again"})}):void 0})]}):ue.isLoading?s.jsx(Ve,{view:pe,tabbed:!f,children:s.jsxs("div",{className:"flex min-h-72 items-center justify-center gap-2 text-sm text-secondary",role:"status",children:[s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading site health..."]})}):ue.error?s.jsx(Ve,{view:pe,tabbed:!f,children:s.jsxs("section",{className:"rounded-lg border border-negative bg-negative-soft px-5 py-6",role:"alert",children:[s.jsx("h2",{className:"font-semibold text-negative",children:"Site Health could not load"}),s.jsx("p",{className:"mt-1 text-sm text-negative",children:"Try loading the crawl again."}),s.jsx(O,{variant:"secondary",size:"sm",className:"mt-4",onClick:()=>{ue.refetch()},children:"Try again"})]})}):P?.hasCrawlData?P.detailsAvailable?pe==="inventory"?s.jsxs("div",{id:"site-health-inventory-panel",role:"tabpanel","aria-labelledby":"site-health-inventory-tab",className:"space-y-5",children:[he.isLoading?s.jsxs("div",{className:"flex min-h-56 items-center justify-center gap-2 text-sm text-secondary",role:"status",children:[s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading page inventory..."]}):he.error?s.jsx("p",{className:"rounded-lg border border-negative bg-negative-soft px-4 py-3 text-sm text-negative",role:"alert",children:"The page inventory could not be loaded."}):s.jsx(Wr,{pages:ut,total:hs,filterUnavailable:he.data?.pages[0]?.healthStateFilter==="unavailable-legacy-scan",selectedNodeKey:He,onSelect:S,hasNextPage:!!he.hasNextPage,isFetchingNextPage:he.isFetchingNextPage,onLoadMore:()=>{he.fetchNextPage()},filter:T,onFilterChange:z}),s.jsx(kn,{page:Me,isLoading:be.isLoading&&!!Me,error:be.error,inbound:be.data?.inbound??[],outbound:be.data?.outbound??[],inboundTruncated:be.data?.inboundTruncated??!1,outboundTruncated:be.data?.outboundTruncated??!1,audit:Oe.data,auditLoading:Oe.isLoading&&!!Me,auditError:Oe.error,onRetryAudit:()=>{Oe.refetch()},rootHost:Jt,reasonSource:it,reasonsState:Qt,onRetryReasons:()=>{Ie.refetch()},showTemplateLinks:C||K})]}):s.jsxs("div",{id:"site-health-map-panel",role:"tabpanel","aria-labelledby":"site-health-map-tab",className:"space-y-5",children:[s.jsxs("section",{"aria-labelledby":"site-map-heading",children:[s.jsxs("div",{className:"mb-3 flex flex-col justify-between gap-2 sm:flex-row sm:items-end",children:[s.jsx("div",{children:s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("h2",{id:"site-map-heading",className:"text-base font-semibold text-heading",children:"Site map"}),s.jsx(we,{text:ns})]})}),R.data?.sampled&&s.jsxs("span",{className:"text-xs text-muted",children:["Showing ",M(R.data.nodes.length)," of ",M(R.data.totalNodes)," pages"," · ",M(R.data.edges.length)," of ",M(R.data.totalEdges)," links"]})]}),R.data?.layout.state==="ready"&&s.jsxs("div",{className:"mb-3 flex flex-col gap-1.5 rounded-lg border border-default bg-surface-subtle px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("p",{className:"flex items-center gap-1 text-sm text-secondary","data-testid":"site-map-link-counts",children:[as({filterUnavailable:K,showTemplateLinks:C,contentEdgeCount:E,templateEdgeCount:nt,totalEdgeCount:Ee.length}),s.jsx(we,{text:os(V,{staleLayout:us&&!K})})]}),s.jsxs("label",{className:Ue("flex shrink-0 items-center gap-2 text-sm",K?"cursor-not-allowed text-muted":"cursor-pointer text-heading"),title:K?ts(V):"Menu and footer links are drawn on top. Pages do not move, because the map was laid out from the links in your page text.",children:[s.jsx("input",{type:"checkbox",checked:C&&!K,disabled:K,onChange:N=>x(N.target.checked),className:"size-4 rounded border-base accent-mono-200 focus:ring-2 focus:ring-mono-400"}),"Show menu and footer links"]})]}),s.jsxs("div",{id:"site-health-map-explorer",className:"grid gap-4 lg:grid-cols-[minmax(14rem,18rem)_minmax(0,1fr)]",children:[s.jsxs("aside",{className:"rounded-lg border border-default bg-surface-subtle","aria-labelledby":"site-sections-heading",children:[s.jsxs("div",{className:"border-b border-default px-4 py-3",children:[s.jsx("h3",{id:"site-sections-heading",className:"text-sm font-semibold text-heading",children:"Site sections"}),s.jsx("p",{className:"mt-1 text-xs text-muted",children:"Folders in this scan"})]}),s.jsx("div",{className:"max-h-[468px] overflow-auto",children:se&&s.jsx(ls,{projectName:n,runId:se,parentPath:"/",onSelect:ws,rootPage:gs,onSelectRootPage:S})})]}),s.jsx("div",{className:"min-w-0",children:R.isLoading?s.jsx(Yr,{}):R.error?s.jsx("div",{className:"flex min-h-[420px] items-center justify-center rounded-lg border border-negative bg-negative-soft px-6 text-center lg:min-h-[520px]",role:"alert",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-negative",children:"The interactive map could not be loaded."}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"The page inventory and technical findings remain available."}),s.jsx(O,{variant:"secondary",size:"sm",className:"mt-4",onClick:()=>c("inventory"),children:"Open page inventory"})]})}):s.jsx(Ja,{nodes:R.data?.nodes??[],edges:Ee,showTemplateLinks:C||K,layoutState:R.data?.layout.state??"unavailable",layoutUnavailableReason:R.data?.layout.state==="unavailable"?R.data.layout.reason:null,rootNodeKey:R.data?.rootNodeKey??null,selectedNodeKey:He,onSelectNode:N=>S(N.nodeKey),onOpenInventory:()=>c("inventory"),ariaLabel:`Interactive site map showing ${M(R.data?.nodes.length??0)} pages and ${M(st.length)} internal links`})})]})]}),s.jsx(kn,{page:Me,isLoading:be.isLoading&&!!Me,error:be.error,inbound:be.data?.inbound??[],outbound:be.data?.outbound??[],inboundTruncated:be.data?.inboundTruncated??!1,outboundTruncated:be.data?.outboundTruncated??!1,audit:Oe.data,auditLoading:Oe.isLoading&&!!Me,auditError:Oe.error,onRetryAudit:()=>{Oe.refetch()},rootHost:Jt,reasonSource:it,reasonsState:Qt,onRetryReasons:()=>{Ie.refetch()},showTemplateLinks:C||K})]}):s.jsx(Ve,{view:pe,tabbed:!f,children:s.jsxs("section",{className:"rounded-lg border border-caution bg-caution-soft px-5 py-6",children:[s.jsx("h2",{className:"font-semibold text-caution",children:f?"Page health results unavailable":"Page details unavailable"}),s.jsx("p",{className:"mt-1 text-sm text-caution",children:f?"This scan did not publish page-level results. Run it again to continue setup.":"Summary metrics are preserved for this scan, but its page graph cannot be opened."}),f?s.jsx(O,{type:"button",size:"sm",className:"mt-4",onClick:at,children:"Run scan again"}):null]})}):s.jsx(Ve,{view:pe,tabbed:!f,children:s.jsxs("section",{className:"rounded-lg border border-default bg-surface-subtle px-5 py-8 text-center",children:[s.jsx("h2",{className:"text-base font-semibold text-heading",children:f?"Page health results unavailable":"Full-site map not available"}),s.jsx("p",{className:"mx-auto mt-2 max-w-xl text-sm text-secondary",children:f?"This scan did not produce page health results. Run it again to continue setup.":P?.legacyAuditAvailable?"Existing page health results are preserved. Run a new scan to build the page and internal-link map.":g?"A full-site scan has not been run for this project.":"Run a scan to discover pages, site sections, and internal links."}),(P?.legacyAuditAvailable||f)&&s.jsxs("div",{className:"mt-4 flex flex-wrap justify-center gap-2",children:[P?.legacyAuditAvailable&&!f&&s.jsx(O,{variant:"secondary",size:"sm",onClick:()=>c("technical"),children:"View page health"}),f&&s.jsx(O,{type:"button",size:"sm",onClick:at,children:"Run scan again"})]})]})})]})}const go=Object.freeze(Object.defineProperty({__proto__:null,LivePageHealthFindings:cs,PAGE_INTERNAL_LINKS_HELP:ss,SITE_HEALTH_VIEW_DESCRIPTIONS:Vn,SITE_MAP_HELP:ns,SITE_MAP_LINK_SPLIT_COPY:rs,SITE_MAP_STALE_LAYOUT_COPY:is,SiteHealthSection:lo,TEMPLATE_DETECTION_COPY:Vt,emptyLinkCopy:ds,linkTileCount:Ft,siteHealthMetricHelp:Te,siteMapLinkCountsLabel:as,siteMapLinkRuleHelp:os},Symbol.toStringTag,{value:"Module"}));export{cr as D,F as G,dr as M,lo as S,ur as a,rr as b,qn as c,go as d,fi as e,lr as u};
|
|
4
|
+
${r.nodeKey}`.toLocaleLowerCase().includes(i):!0:!1).slice(0,a)}function Oa(n,e,t,i,a=!0){const o=!!(e&&n.hasNode(e))?e:null,d=typeof t=="function"?t:()=>t,c=n.nodes().sort((u,h)=>{const b=n.getNodeAttributes(u),S=n.getNodeAttributes(h);return Number(S.isRoot)-Number(b.isRoot)||S.size-b.size||(b.depth??Number.MAX_SAFE_INTEGER)-(S.depth??Number.MAX_SAFE_INTEGER)||Ze(b.path,S.path)||Ze(u,h)}),l=new Map(c.map((u,h)=>[u,h])),p=new Set(o?n.neighbors(o).filter(u=>u!==o).sort((u,h)=>(l.get(u)??0)-(l.get(h)??0)).slice(0,_a):[]);return{nodeReducer:(u,h)=>{const b=d(),S=b>ct;if(h.isRoot)return u===o?{...h,size:h.size*1.35,forceLabel:!0,zIndex:3}:{...h,forceLabel:!0};if(o)return u===o?{...h,size:h.size*1.35,forceLabel:!0,zIndex:3}:n.areNeighbors(u,o)?S?p.has(u)?{...h,forceLabel:!1}:{...h,forceLabel:!1,label:""}:h:{...h,color:i.dimmedNode,forceLabel:!1,label:"",zIndex:0};const k=Mt(b);return k===Number.POSITIVE_INFINITY?h:(l.get(u)??Number.MAX_SAFE_INTEGER)<k?{...h,forceLabel:!0}:{...h,forceLabel:!1,label:""}},edgeReducer:(u,h)=>{if(h.isTemplate&&!a)return{...h,hidden:!0};const b=d()>ct,[S,k]=n.extremities(u);return o&&(S===o||k===o)?{...h,color:i.edgeActive,size:Math.max(1.4,h.size),zIndex:2}:b?{...h,hidden:!0}:o?{...h,color:i.edgeDimmed,size:Math.min(.45,h.size),zIndex:0}:h}}}const vn={"layout-failed":{heading:"Map could not be built",detail:"The map could not be created for this scan. Run a new scan to try again."},"no-crawl":{heading:"No map yet",detail:"This scan has no map yet. Run a new scan to create one."},"legacy-snapshot":{heading:"No map yet",detail:"This scan has no map yet. Run a new scan to create one."},"details-unavailable":{heading:"No map yet",detail:"This scan has no map yet. Run a new scan to create one."},"empty-crawl":{heading:"No pages to map",detail:"This scan found no pages to put on a map. Run a new scan to try again."}};function za(n){return(n&&vn[n])??vn["no-crawl"]}class Fa extends y.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){console.error("[SiteGraphSigma] the map failed to render",e,t.componentStack)}componentDidUpdate(e){this.state.failed&&e.resetToken!==this.props.resetToken&&this.setState({failed:!1})}render(){return this.state.failed?this.props.fallback:this.props.children}}const Ua=220;function Ba(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches?0:Ua}function dt(n,e,t=`${e}s`){return`${n.toLocaleString()} ${n===1?e:t}`}function Ha(n,e,t){const a=window.getComputedStyle(n).getPropertyValue(e).trim();if(a&&!a.includes("var(")&&yn(a))return a;const r=document.createElement("span");r.style.position="absolute",r.style.visibility="hidden",r.style.color=`var(${e})`,n.appendChild(r);const o=window.getComputedStyle(r).color.trim();return r.remove(),o&&!o.includes("var(")&&yn(o)?o:t}function Ka(n){const e=t=>{const i=Sa[t];return Ha(n,i.property,i.fallback)};return{eligible:e("eligible"),hidden:e("hidden"),resource:e("resource"),redirect:e("redirect"),failed:e("failed"),unchecked:e("unchecked"),dimmedNode:e("dimmedNode"),edge:e("edge"),edgeDimmed:e("edgeDimmed"),edgeActive:e("edgeActive"),label:e("label"),background:e("background")}}function Wa(n){return(e,t,i)=>{t.label&&(e.save(),e.fillStyle=i.labelColor.color??n.label,e.font=`${i.labelWeight} ${i.labelSize}px ${i.labelFont}`,e.fillText(t.label,t.x+t.size+3,t.y+i.labelSize/3),e.restore())}}function qa(n,e,t,i,a,r){const o=Math.min(r,i/2,a/2);n.beginPath(),n.moveTo(e+o,t),n.lineTo(e+i-o,t),n.arcTo(e+i,t,e+i,t+o,o),n.lineTo(e+i,t+a-o),n.arcTo(e+i,t+a,e+i-o,t+a,o),n.lineTo(e+o,t+a),n.arcTo(e,t+a,e,t+a-o,o),n.lineTo(e,t+o),n.arcTo(e,t,e+o,t,o),n.closePath()}function Va(n){return(e,t,i)=>{const a=typeof t.label=="string"?t.label:null,r=i.labelSize+10,o=t.x+t.size+7,d=t.y-r/2;if(e.save(),e.font=`${i.labelWeight} ${i.labelSize}px ${i.labelFont}`,e.fillStyle=n.background,e.strokeStyle=n.edgeActive,e.lineWidth=1.5,e.beginPath(),e.arc(t.x,t.y,t.size+3,0,Math.PI*2),e.fill(),e.stroke(),e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,t.size,0,Math.PI*2),e.fill(),a){const c=Math.ceil(e.measureText(a).width)+16;qa(e,o,d,c,r,5),e.fillStyle=n.background,e.fill(),e.strokeStyle=n.edgeActive,e.lineWidth=1,e.stroke(),e.fillStyle=n.label,e.textBaseline="middle",e.fillText(a,o+8,t.y)}e.restore()}}function Ya(){if(typeof document>"u")return!1;try{const n=document.createElement("canvas");return!!(n.getContext("webgl2")||n.getContext("webgl"))}catch{return!1}}function Qa({onOpenInventory:n}){return s.jsx("div",{className:"flex h-full min-h-80 items-center justify-center px-6 text-center",children:s.jsxs("div",{className:"max-w-md",children:[s.jsx("p",{className:"text-sm font-medium text-heading",children:"Interactive map unavailable"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"This browser could not start WebGL. The page inventory remains available for the complete crawl."}),n&&s.jsx(O,{type:"button",variant:"secondary",size:"sm",className:"mt-4",onClick:n,children:"Open page inventory"})]})})}function Xa({onRetry:n}){return s.jsx("div",{className:"flex h-full min-h-80 items-center justify-center px-6 text-center",role:"alert",children:s.jsxs("div",{className:"max-w-md",children:[s.jsx("p",{className:"text-sm font-medium text-heading",children:"The map could not be drawn"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Something went wrong while drawing this map. The page inventory below is unaffected."}),s.jsx(O,{variant:"secondary",size:"sm",className:"mt-4",onClick:n,children:"Try again"})]})})}function Za({reactSigma:n,graph:e,theme:t,selectedNodeKey:i,showTemplateLinks:a,onSelectNodeKey:r,onHoverNode:o,onCameraReady:d}){const{useSigma:c,useRegisterEvents:l,useCamera:p}=n,u=c(),h=l(),{zoomIn:b,zoomOut:S,reset:k,gotoNode:D}=p(),[T,z]=y.useState(null),C=T??i,x=y.useRef(null),g=y.useRef({overview:!0,budget:Number.NaN});return y.useEffect(()=>()=>{x.current!==null&&cancelAnimationFrame(x.current)},[]),y.useEffect(()=>{const f=Ba();return d({zoomIn:()=>b({duration:f}),zoomOut:()=>S({duration:f}),reset:()=>k({duration:f}),gotoNode:v=>D(v,{duration:f})}),()=>d(null)},[D,d,k,b,S]),y.useEffect(()=>{h({enterNode:({node:f,event:v})=>{z(f),o({nodeKey:f,left:Number.isFinite(v.x)?v.x+14:20,top:Number.isFinite(v.y)?v.y+14:20})},leaveNode:()=>{z(null),o(null)},clickNode:({node:f})=>r(f),clickStage:()=>o(null),updated:()=>{x.current===null&&(x.current=requestAnimationFrame(()=>{x.current=null;const f=u.getCamera().getState().ratio>ct,v=Mt(u.getCamera().getState().ratio);f===g.current.overview&&v===g.current.budget||(g.current={overview:f,budget:v},u.refresh())}))}})},[o,r,h,u]),y.useEffect(()=>{if(u.getGraph()!==e)return;const f=Oa(e,C,()=>u.getCamera().getState().ratio,t,a);u.setSetting("nodeReducer",f.nodeReducer),u.setSetting("edgeReducer",f.edgeReducer);const v=u.getCamera().getState().ratio;g.current={overview:v>ct,budget:Mt(v)},u.refresh()},[C,e,a,u,t]),null}function Ja({nodes:n,edges:e,layoutState:t="ready",layoutUnavailableReason:i,rootNodeKey:a=null,showTemplateLinks:r=!0,selectedNodeKey:o,onSelectNode:d,onOpenInventory:c,ariaLabel:l,className:p}){const u=y.useRef(null),h=y.useRef(null),b=y.useRef(null),S=y.useId(),k=y.useId(),D=y.useId(),[T,z]=y.useState(null),[C,x]=y.useState(null),[g,f]=y.useState("checking"),[v,$]=y.useState(!1),[G,A]=y.useState(null),[I,le]=y.useState(null),[W,Se]=y.useState(""),[X,te]=y.useState(!1),[_,ae]=y.useState(0),[me,U]=y.useState(""),[Ae,ne]=y.useState(0),ce=y.useRef(null),_e=y.useDeferredValue(W),$e=o===void 0?G:o,ge=y.useMemo(()=>new Map(n.map(E=>[E.nodeKey,E])),[n]),De=y.useMemo(()=>Ln(a?ge.get(a)?.url:null),[ge,a]),re=y.useCallback(E=>hi(E,De),[De]),Re=$e?ge.get($e)??null:null,oe=I?ge.get(I.nodeKey)??null:null,ue=y.useMemo(()=>Ma(n,_e),[_e,n]),P=n.some(E=>Number.isFinite(E.x)&&Number.isFinite(E.y)),se=y.useMemo(()=>T?Ia(n,e,T,a):null,[e,n,a,T]),m=y.useMemo(()=>T?{allowInvalidContainer:!0,defaultNodeColor:T.unchecked,defaultEdgeColor:T.edge,defaultEdgeType:"line",enableCameraPanning:!0,enableCameraZooming:!0,enableCameraRotation:!1,enableEdgeEvents:!1,hideEdgesOnMove:!0,hideLabelsOnMove:!0,itemSizesReference:"screen",defaultDrawNodeHover:Va(T),defaultDrawNodeLabel:Wa(T),labelColor:{color:T.label},labelDensity:.07,labelGridCellSize:140,labelFont:"Geist Variable, Geist, sans-serif",labelRenderedSizeThreshold:8,labelSize:13,labelWeight:"600",maxCameraRatio:12,minCameraRatio:.04,minEdgeThickness:.35,renderEdgeLabels:!1,renderLabels:!0,stagePadding:42,zIndex:!0}:null,[T]);y.useEffect(()=>{const E=u.current;if(!E)return;const V=()=>z(Ka(E));if(V(),typeof MutationObserver>"u")return;const K=new MutationObserver(V);return K.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","style"]}),()=>K.disconnect()},[]),y.useEffect(()=>{if(n.length===0||t==="unavailable"||!P){f("checking");return}f(Ya()?"ready":"unavailable")},[P,t,n.length]),y.useEffect(()=>{if(g!=="ready"){x(null);return}let E=!0;return js(()=>import("./react-sigma_core.esm.min-D-IM5qRE.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url).then(V=>{E&&x(V)}).catch(()=>{E&&f("unavailable")}),()=>{E=!1}},[g]),y.useEffect(()=>{ae(0)},[_e]);const H=y.useCallback(E=>{b.current=E,$(!!E)},[]),B=y.useCallback(E=>{le(E)},[]),R=y.useCallback((E,V)=>{const K=ge.get(E);K&&(o===void 0&&A(E),d?.(K),V&&b.current?.gotoNode(E),U(`Focused ${re(K)}`))},[ge,d,re,o]),Z=y.useCallback(E=>{R(E,!1)},[R]);y.useEffect(()=>{if(!v||!o||!ge.has(o)){o||(ce.current=null);return}ce.current!==o&&(b.current?.gotoNode(o),ce.current=o)},[v,ge,o]);const Le=E=>{R(E.nodeKey,!0),Se(re(E)),te(!1)},he=()=>{window.setTimeout(()=>{document.activeElement!==h.current&&te(!1)},0)},Pe=`Interactive site map showing ${dt(n.length,"page")} and ${dt(e.length,"internal link")}`,de=E=>`${k}-${E.replaceAll(/[^\w-]/g,"-")}`,xe=za(i);if(t==="unavailable")return s.jsx("section",{ref:u,role:"group","aria-label":l??Pe,className:Ue("flex min-h-80 items-center justify-center rounded-lg border border-default bg-surface-inset px-6 text-center",p),children:s.jsxs("div",{className:"max-w-md",children:[s.jsx("p",{className:"text-sm font-medium text-heading",children:xe.heading}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:xe.detail}),c&&s.jsx(O,{type:"button",variant:"secondary",size:"sm",className:"mt-4",onClick:c,children:"Open page inventory"})]})});if(n.length===0)return s.jsx("section",{ref:u,role:"group","aria-label":l??Pe,className:Ue("flex min-h-80 items-center justify-center rounded-lg border border-default bg-surface-inset px-6 text-center",p),children:s.jsxs("div",{className:"max-w-md",children:[s.jsx("p",{className:"text-sm text-secondary",children:"No page graph is available for this scan."}),c&&s.jsx(O,{type:"button",variant:"secondary",size:"sm",className:"mt-4",onClick:c,children:"Open page inventory"})]})});if(!P)return s.jsx("section",{ref:u,role:"group","aria-label":l??Pe,className:Ue("flex min-h-80 items-center justify-center rounded-lg border border-default bg-surface-inset px-6 text-center",p),children:s.jsxs("div",{className:"max-w-md",children:[s.jsx("p",{className:"text-sm font-medium text-heading",children:xe.heading}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:xe.detail}),c&&s.jsx(O,{type:"button",variant:"secondary",size:"sm",className:"mt-4",onClick:c,children:"Open page inventory"})]})});const Be=ue.at(_),Ee=s.jsx(Xa,{onRetry:()=>ne(E=>E+1)}),nt=C?.SigmaContainer;return s.jsxs("section",{ref:u,role:"group","aria-label":l??Pe,"aria-describedby":D,className:Ue("flex h-[clamp(460px,62vh,680px)] min-h-[460px] flex-col overflow-hidden rounded-lg border border-default bg-surface-inset",p),children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-subtle bg-bg-elevated/70 px-3 py-2",children:[s.jsx("label",{htmlFor:S,className:"sr-only",children:"Focus a page in the site map"}),s.jsxs("div",{className:"relative min-w-56 max-w-lg flex-1",children:[s.jsx(Ut,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted","aria-hidden":"true"}),s.jsx("input",{id:S,ref:h,role:"combobox",type:"search",autoComplete:"off","aria-label":"Focus a page in the site map","aria-autocomplete":"list","aria-controls":k,"aria-expanded":X,"aria-activedescendant":X&&Be?de(Be.nodeKey):void 0,value:W,placeholder:Re?`Focused: ${re(Re)}`:"Find a page",className:"h-10 w-full rounded-md border border-base bg-bg py-2 pl-9 pr-3 text-sm text-primary placeholder-mono-600 outline-none focus-visible:ring-2 focus-visible:ring-mono-400",onFocus:()=>te(!0),onBlur:he,onChange:E=>{Se(E.target.value),te(!0)},onKeyDown:E=>{E.key==="ArrowDown"?(E.preventDefault(),te(!0),ae(V=>Math.max(0,Math.min(ue.length-1,V+1)))):E.key==="ArrowUp"?(E.preventDefault(),ae(V=>Math.max(0,V-1))):E.key==="Enter"&&X&&Be?(E.preventDefault(),Le(Be)):E.key==="Escape"&&te(!1)}}),X&&s.jsxs("div",{className:"absolute left-0 right-0 top-[calc(100%+0.25rem)] z-30 overflow-hidden rounded-md border border-base bg-bg shadow-lg",children:[s.jsx("div",{id:k,role:"listbox","aria-label":"Matching pages",className:"max-h-72 overflow-auto py-1",children:ue.length>0?ue.map((E,V)=>{const K=Qe(E);return s.jsxs("button",{id:de(E.nodeKey),type:"button",role:"option","aria-selected":V===_,tabIndex:-1,className:Ue("flex min-h-11 w-full items-center justify-between gap-3 px-3 py-2 text-left text-sm outline-none",V===_?"bg-surface-active text-primary":"text-secondary hover:bg-surface-hover hover:text-primary"),onPointerDown:st=>st.preventDefault(),onMouseDown:st=>st.preventDefault(),onMouseEnter:()=>ae(V),onClick:()=>Le(E),children:[s.jsx("span",{className:"min-w-0 truncate font-mono",children:re(E)}),s.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[13px] text-muted",children:[s.jsx("span",{className:"font-mono font-semibold",style:{color:`var(${ze[K].property})`},"aria-hidden":"true",children:zt(K)}),s.jsx("span",{title:Xe(K),children:Ot(K)})]})]},E.nodeKey)}):s.jsx("p",{className:"px-3 py-4 text-sm text-secondary",children:"No rendered pages match."})}),ue.length===50&&s.jsx("p",{className:"border-t border-subtle px-3 py-2 text-[13px] text-muted",children:"First 50 matches. Refine the search or use the full page inventory."})]})]}),s.jsxs("span",{className:"text-[13px] tabular-nums text-muted",children:[dt(n.length,"page")," · ",dt(e.length,"link")]})]}),s.jsx("div",{className:"relative min-h-0 flex-1 overflow-hidden",children:g==="unavailable"?s.jsx(Qa,{onOpenInventory:c}):g==="checking"||!T||!se||!m||!C||!nt?s.jsx("div",{className:"flex h-full min-h-80 items-center justify-center px-6 text-center",role:"status",children:s.jsx("p",{className:"text-sm text-secondary",children:"Preparing the interactive site map..."})}):s.jsxs(Fa,{fallback:Ee,resetToken:Ae,children:[s.jsx("div",{"aria-hidden":"true",className:"absolute inset-0",children:s.jsx(nt,{graph:se.graph,className:"relative size-full bg-bg [&_.sigma-container]:size-full",style:{width:"100%",height:"100%",background:T.background},settings:m,children:s.jsx(Za,{reactSigma:C,graph:se.graph,theme:T,selectedNodeKey:$e,showTemplateLinks:r,onSelectNodeKey:Z,onHoverNode:B,onCameraReady:H})})}),s.jsxs("div",{className:"absolute right-3 top-3 z-20 flex flex-col overflow-hidden rounded-md border border-base bg-bg shadow-lg",children:[s.jsx(O,{type:"button",variant:"ghost",size:"icon",className:"rounded-none border-b border-subtle","aria-label":"Zoom in",disabled:!v,onClick:()=>b.current?.zoomIn(),children:s.jsx(Ws,{className:"size-4","aria-hidden":"true"})}),s.jsx(O,{type:"button",variant:"ghost",size:"icon",className:"rounded-none border-b border-subtle","aria-label":"Zoom out",disabled:!v,onClick:()=>b.current?.zoomOut(),children:s.jsx(qs,{className:"size-4","aria-hidden":"true"})}),s.jsx(O,{type:"button",variant:"ghost",size:"icon",className:"rounded-none","aria-label":"Fit site map",disabled:!v,onClick:()=>b.current?.reset(),children:s.jsx(Vs,{className:"size-4","aria-hidden":"true"})})]}),oe&&I&&s.jsxs("div",{role:"tooltip",className:"pointer-events-none absolute z-20 max-w-64 rounded-md border border-base bg-bg/95 px-3 py-2 shadow-lg",style:{left:I.left,top:I.top},children:[s.jsx("p",{className:"truncate font-mono text-[13px] font-medium text-heading",children:re(oe)}),s.jsx("p",{className:"mt-1 text-[13px] font-medium text-heading",children:Ot(Qe(oe))}),s.jsx("p",{className:"mt-0.5 text-[13px] text-secondary",children:Xe(Qe(oe))}),oe.depth!=null&&s.jsxs("p",{className:"mt-1 text-[13px] text-secondary",children:[dt(oe.depth,"click")," from home"]}),oe.auditScore!=null&&s.jsxs("p",{className:"mt-1 text-[13px] tabular-nums text-heading",children:["Score ",Math.round(oe.auditScore),"/100"]})]})]})}),s.jsxs("div",{"aria-label":"Site map legend",className:"flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-subtle bg-bg-elevated/50 px-3 py-2 text-[13px] text-secondary",children:[ks.map(E=>s.jsxs("span",{className:"inline-flex items-center gap-1.5",title:Xe(E),children:[s.jsx("span",{className:"w-3 text-center font-mono text-[15px] font-semibold leading-none",style:{color:`var(${ze[E].property})`},"aria-hidden":"true",children:zt(E)}),Ga(E)]},E)),s.jsx("span",{className:"ml-auto",children:"Bigger = more linked"}),se&&(se.omittedNodes>0||se.omittedEdges>0)&&s.jsx("span",{className:"text-caution",children:"Some records lacked valid layout data."})]}),s.jsx("p",{id:D,className:"sr-only",children:"The WebGL map supports pointer, wheel, and touch navigation. Use the page search to focus a rendered page. Use the full page inventory for an accessible list of every crawled page and its links."}),s.jsx("p",{role:"status","aria-live":"polite",className:"sr-only",children:me})]})}function er(n){return n>=70?"positive":n>=40?"caution":"negative"}function tr(n){return n>=70?"pass":n>=40?"partial":"fail"}function nr(n){return n==="pass"?"positive":n==="partial"?"caution":"negative"}function Nn(n){return n==="pass"?"Pass":n==="partial"?"Partial":"Fail"}function sr({audit:n,isLoading:e,error:t,onRetry:i}){return s.jsxs("section",{className:"border-t border-default pt-5","aria-labelledby":"site-health-page-audit-heading",children:[s.jsx("div",{children:s.jsx("h3",{id:"site-health-page-audit-heading",className:"text-base font-semibold text-heading",children:"Findings and fixes"})}),e?s.jsx("p",{className:"mt-4 text-sm text-secondary",role:"status",children:"Loading findings..."}):t?s.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3 border-y border-negative bg-negative-soft px-4 py-3",role:"alert",children:[s.jsx("p",{className:"text-sm text-negative",children:"Findings could not be loaded."}),s.jsx(O,{type:"button",variant:"secondary",size:"sm",onClick:i,children:"Try again"})]}):n?n.state==="no-crawl"?s.jsx("p",{className:"mt-4 text-sm text-secondary",children:"No Site Health scan is available."}):n.state==="details-unavailable"?s.jsx("p",{className:"mt-4 text-sm text-secondary",children:"This scan saved its summary, but not the findings for each page."}):n.state==="not-found"?s.jsx("p",{className:"mt-4 text-sm text-secondary",children:"This page is not present in the selected scan."}):n.state==="not-audited"?s.jsx("p",{className:"mt-4 text-sm text-secondary",children:"This page was found, but it was not scored."}):s.jsx(ir,{audit:n}):s.jsx("p",{className:"mt-4 text-sm text-secondary",children:"No findings are available for this page."})]})}function ir({audit:n}){const e=n.factors.filter(t=>t.applicable!==!1&&(t.status!=="pass"||t.findings.some(i=>i.type==="missing"||i.type==="timeout"||i.type==="unreachable")));return s.jsxs("div",{className:"mt-4",children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[s.jsxs("span",{"aria-label":`Score ${Math.round(n.auditScore)} out of 100`,className:"text-2xl font-semibold tabular-nums text-heading",children:[Math.round(n.auditScore),s.jsx("span",{className:"text-sm text-muted",children:"/100"})]}),s.jsx(J,{tone:er(n.auditScore),children:Nn(tr(n.auditScore))})]}),n.evidenceState==="scores-only"&&s.jsx("p",{className:"mt-3 border border-caution bg-caution-soft px-3 py-2 text-sm text-caution",children:"This older scan saved only the scores, not the findings or fixes."}),n.criticalDefects.length>0&&s.jsxs("section",{className:"mt-5","aria-labelledby":"site-health-critical-defects-heading",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h4",{id:"site-health-critical-defects-heading",className:"text-sm font-semibold text-heading",children:"Problems outside the score"}),s.jsx(J,{tone:n.criticalDefects.some(t=>t.severity==="critical")?"negative":"caution",children:n.criticalDefects.length}),s.jsx("span",{className:"text-xs text-muted",children:"Not counted in the score"})]}),s.jsx("ul",{className:"mt-2 divide-y divide-default border-y border-default",children:n.criticalDefects.map(t=>s.jsxs("li",{className:"py-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("p",{className:"text-sm font-medium text-heading",children:t.detail}),s.jsx(J,{tone:t.severity==="critical"?"negative":"caution",children:t.severity==="critical"?"Critical":"Warning"})]}),s.jsxs("p",{className:"mt-1 text-sm text-secondary",children:[s.jsx("span",{className:"font-medium text-heading",children:"Fix:"})," ",t.recommendation]})]},t.id))})]}),e.length>0?s.jsx("div",{className:"mt-5 divide-y divide-default border-y border-default",children:e.map(t=>s.jsxs("details",{className:"group py-1",children:[s.jsxs("summary",{className:"flex min-h-12 cursor-pointer list-none items-center justify-between gap-3 rounded-sm px-1 py-2 outline-none marker:hidden focus-visible:ring-2 focus-visible:ring-mono-400 [&::-webkit-details-marker]:hidden",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-sm font-medium text-heading",children:[s.jsx(kt,{className:"size-4 shrink-0 text-muted transition-transform group-open:rotate-90","aria-hidden":"true"}),t.name]}),s.jsxs("span",{className:"flex shrink-0 items-center gap-2",children:[s.jsxs("span",{className:"text-sm tabular-nums text-heading",children:[Math.round(t.score),"/100"]}),s.jsx(J,{tone:nr(t.status),children:Nn(t.status)})]})]}),s.jsxs("div",{className:"grid gap-4 px-1 pb-4 pt-1 md:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx("h5",{className:"text-xs font-semibold uppercase tracking-wide text-muted",children:"Evidence"}),t.findings.length>0?s.jsx("ul",{className:"mt-2 space-y-1.5 text-sm text-secondary",children:t.findings.map((i,a)=>s.jsx("li",{children:i.message},`${i.code}:${a}`))}):s.jsx("p",{className:"mt-2 text-sm text-secondary",children:n.evidenceState==="scores-only"?"This scan did not save the findings here.":"Nothing to report here."})]}),s.jsxs("div",{children:[s.jsx("h5",{className:"text-xs font-semibold uppercase tracking-wide text-muted",children:"Recommended fix"}),t.recommendations.length>0?s.jsx("ol",{className:"mt-2 list-decimal space-y-1.5 pl-5 text-sm text-secondary marker:text-muted",children:t.recommendations.map(i=>s.jsx("li",{children:i},i))}):s.jsx("p",{className:"mt-2 text-sm text-secondary",children:n.evidenceState==="scores-only"?"This scan did not save a fix here.":"No fix suggested here."}),s.jsxs("p",{className:"mt-3 text-xs text-muted",children:["Worth ",t.weight,"% of the page score"]})]})]})]},t.id))}):n.criticalDefects.length===0&&n.evidenceState==="complete"?s.jsx("p",{className:"mt-4 border-y border-positive bg-positive-soft px-4 py-3 text-sm text-positive",children:"Nothing needs attention on this page."}):n.criticalDefects.length===0?s.jsx("p",{className:"mt-4 border-y border-default px-4 py-3 text-sm text-secondary",children:"This scan saved only the score. Run a new scan to see findings."}):null]})}const qn=25;function ar(n){return n.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function rr(n){let e=n;try{e=decodeURIComponent(n.replace(/\+/g," "))}catch{}let t="";const i=n.indexOf("?");return i>=0&&new URLSearchParams(n.slice(i+1)).forEach((r,o)=>{t+=` ${o} ${r}`}),`${n} ${e}${t}`}function or(n,e=36,t=18){const i=[...n];return i.length<=e+t+1?n:`${i.slice(0,e).join("")}…${i.slice(-t).join("")}`}function dr({value:n,headLength:e,tailLength:t,className:i,title:a}){const r=or(n,e,t);return s.jsx("span",{className:i,title:a??n,children:r===n?n:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"sr-only",children:n}),s.jsx("span",{"aria-hidden":"true",children:r})]})})}function lr({rows:n,getSearchText:e,pageSize:t=qn}){const[i,a]=y.useState(""),[r,o]=y.useState(1),d=y.useMemo(()=>ar(i),[i]),c=y.useMemo(()=>d.length===0||!e?n:n.filter(k=>{const D=e(k).toLocaleLowerCase();return d.every(T=>D.includes(T))}),[e,n,d]),l=Math.max(1,Math.ceil(c.length/t)),p=Math.min(Math.max(1,r),l),u=(p-1)*t,h=y.useMemo(()=>c.slice(u,u+t),[c,t,u]),b=y.useCallback(k=>{a(k),o(1)},[]),S=y.useCallback(k=>{o(Math.max(1,k))},[]);return{query:i,setQuery:b,page:p,setPage:S,rows:h,filteredRows:c,totalRows:c.length,totalPages:l,pageSize:t,rangeStart:c.length===0?0:u+1,rangeEnd:u+h.length,hasQuery:i.trim().length>0}}function cr({value:n,onChange:e,label:t,placeholder:i="Filter rows",className:a}){return s.jsxs("div",{className:`relative ${a??""}`,children:[s.jsx(Ut,{"aria-hidden":"true",className:"pointer-events-none absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted"}),s.jsx("input",{type:"search",value:n,onChange:r=>e(r.target.value),"aria-label":t,placeholder:i,autoComplete:"off",spellCheck:!1,className:"h-9 w-full rounded-md border border-default bg-surface/50 pl-9 pr-9 text-sm text-strong placeholder:text-muted outline-none transition focus:border-mono-500 focus:ring-1 focus:ring-mono-500 [&::-webkit-search-cancel-button]:appearance-none"}),n.trim().length>0?s.jsx("button",{type:"button",onClick:()=>e(""),"aria-label":`Clear ${t.toLocaleLowerCase()}`,className:"absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded text-muted transition-colors hover:bg-surface-hover hover:text-strong focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-mono-500",children:s.jsx(Ys,{"aria-hidden":"true",className:"size-3.5"})}):null]})}function ur({page:n,pageSize:e=qn,visibleRows:t,totalRows:i,hasNextPage:a,onPageChange:r,itemLabel:o="rows",className:d,disabled:c=!1}){if(t===0)return null;const l=(n-1)*e+1,p=l+t-1,u=i===void 0?void 0:Math.max(1,Math.ceil(i/e)),h=a??(u!==void 0&&n<u),b=n>1||h;return s.jsxs("div",{className:`mt-3 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 text-xs text-secondary ${d??""}`,children:[s.jsxs("p",{className:"tabular-nums",children:[l.toLocaleString("en-US"),"–",p.toLocaleString("en-US"),i===void 0?`${h?"+":""} ${o}`:` of ${i.toLocaleString("en-US")} ${o}`]}),b?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>r(n-1),disabled:c||n<=1,className:"inline-flex items-center gap-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-strong transition hover:border-strong hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-base disabled:hover:text-strong",children:[s.jsx(Qs,{"aria-hidden":"true",className:"size-3.5"}),"Previous"]}),s.jsx("span",{className:"tabular-nums",children:u===void 0?`Page ${n}`:`Page ${n} of ${u}`}),s.jsxs("button",{type:"button",onClick:()=>r(n+1),disabled:c||!h,className:"inline-flex items-center gap-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-strong transition hover:border-strong hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-base disabled:hover:text-strong",children:["Next",s.jsx(kt,{"aria-hidden":"true",className:"size-3.5"})]})]}):null]})}const hr=100,Ct=12,pr=[];function fr(n){return rr(n.url)}function wt(n){return n>=70?"positive":n>=40?"caution":"negative"}function vt(n){return n>=70?"text-positive-400":n>=40?"text-caution-400":"text-negative-400"}function mr(n){return n==="pass"?"positive":n==="partial"?"caution":"negative"}function lt(n){return n>=70?"Pass":n>=40?"Partial":"Fail"}function gr(n){return ti($n(String(n)))}function xr(n){return ni($n(String(n)))}function br({projectName:n,projectId:e,runId:t,integrated:i=!1,compactCopy:a=!1,footer:r,unavailableFooter:o}){const[d,c]=y.useState(!1),[l,p]=y.useState(null),[u,h]=y.useState(null),b=t===void 0?u:t,[S,k]=y.useState(!1),D=y.useRef(null),T=fe(Ss({client:ie,path:{name:n},...b?{query:{runId:b}}:{}})),z=fe({...Es({client:ie,path:{name:n},query:{limit:30}}),enabled:!i}),C=fe(As({client:ie,path:{name:n},query:{limit:hr,sort:"score-asc",...b?{runId:b}:{}}})),x=fe({..._s({client:ie,path:{name:n},query:{kind:sn["site-audit"],limit:10}}),enabled:!i,refetchOnWindowFocus:"always",refetchInterval:m=>m.state.data?.some(B=>B.status==="queued"||B.status==="running")?3e3:1e4}),g=An(),f=y.useSyncExternalStore($s,an,an),v=Object.values(f.runs).find(m=>m.kind===sn["site-audit"]&&m.projectId===e),$=x.data??[],G=$.find(m=>m.status==="queued"||m.status==="running"),A=$.at(-1),I=g.isPending||!!v||!!G,le=g.isPending?"starting":G?.status??v?.lastAnnouncedStatus,W=y.useCallback(async()=>{const m=await Promise.all([T.refetch(),C.refetch(),...i?[]:[z.refetch()]]),H=m.find(B=>B.error);if(H?.error)throw H.error;return m[0]},[i,C.refetch,T.refetch,z.refetch]);y.useEffect(()=>{i||b||!A||A.status!=="completed"&&A.status!=="partial"||T.data?.runId===A.id||D.current===A.id||(D.current=A.id,W().catch(m=>{$t({title:"Technical AEO auto-refresh failed",detail:m instanceof Error?m.message:"Could not load the completed audit.",tone:"negative",dedupeKey:`technical-aeo:auto-refresh:${n}`,dedupeMode:"replace"})}))},[b,i,A?.id,A?.status,n,W,T.data?.runId]);const Se=async()=>{k(!0);try{const m=await W();$t({title:"Technical AEO refreshed",detail:I?"The audit is still running. This view will refresh again when it finishes.":m.data?.hasData?`Latest score is ${m.data.aggregateScore}/100 from ${m.data.pagesAudited} audited page${m.data.pagesAudited===1?"":"s"}.`:"No audit data yet. Run an audit to crawl the sitemap.",tone:m.data?.hasData?"positive":"caution",dedupeKey:`technical-aeo:refresh:${n}`,dedupeMode:"replace"})}catch(m){$t({title:"Technical AEO refresh failed",detail:m instanceof Error?m.message:"Could not reload technical audit data.",tone:"negative",dedupeKey:`technical-aeo:refresh:${n}`,dedupeMode:"replace"})}finally{k(!1)}},X=()=>g.mutate({projectName:n,projectId:e}),te=le==="running"?"Audit running":le==="queued"?"Audit queued":"Starting audit",_=T.data,ae=C.data?.pages??pr,me=(_?.pagesErrored??0)>0,U=d&&me,Ae=y.useMemo(()=>U?ae.filter(m=>m.status==="error"):ae,[ae,U]),ne=lr({rows:Ae,getSearchText:fr}),ce=_?_.pagesAudited>ae.length:!1,_e=_?.crossCuttingIssues[0]?.factorId??_?.factors.find(m=>m.pagesPartial+m.pagesFailing>0)?.id??null;if(y.useEffect(()=>{c(!1),p(i?_e:null)},[b,i,_e]),T.isLoading)return s.jsxs("div",{className:`flex min-h-40 items-center justify-center gap-2 text-sm text-secondary ${i?"":"mt-6"}`,role:"status",children:[s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading page health..."]});if(T.error)return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:`flex flex-col gap-4 rounded-lg border border-negative bg-negative-soft px-5 py-5 sm:flex-row sm:items-center sm:justify-between ${i?"":"mt-6"}`,role:"alert",children:[s.jsxs("div",{className:"flex min-w-0 gap-3",children:[s.jsx(Pt,{className:"mt-0.5 size-4 shrink-0 text-negative","aria-hidden":"true"}),s.jsxs("div",{children:[i?s.jsx("h3",{className:"font-semibold text-negative",children:"Page health could not load"}):s.jsx("h2",{className:"font-semibold text-negative",children:"Page health could not load"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"The saved audit could not be read. Try loading it again."})]})]}),s.jsxs(O,{type:"button",variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{Se()},disabled:S,children:[s.jsx(Lt,{className:`size-4 ${S?"motion-safe:animate-spin":""}`,"aria-hidden":"true"}),S?"Trying again...":"Try again"]})]}),o]});if(!_||!_.hasData)return i?s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"rounded-lg border border-default bg-surface-subtle px-5 py-7 text-center",children:[s.jsx(dn,{className:"mx-auto size-7 text-muted","aria-hidden":"true"}),s.jsx("h2",{className:"mt-3 text-base font-semibold text-heading",children:"Page health unavailable"}),s.jsx("p",{className:"mx-auto mt-2 max-w-md text-sm text-secondary",children:"Run a new Site Health scan to calculate page-level technical findings."})]}),o]}):s.jsxs(Ls,{className:"surface-card mt-6 p-8 text-center",children:[s.jsx(dn,{className:"mx-auto mb-3 h-8 w-8 text-muted","aria-hidden":"true"}),s.jsx("h2",{className:"text-base font-semibold text-heading",children:"No technical audit yet"}),s.jsx("p",{className:"supporting-copy mx-auto mt-2 max-w-md",children:"A technical AEO audit crawls your sitemap and scores every page for structured data, AI-readable content, crawler access, freshness, and more, then rolls it up into one site score."}),!Dt()&&s.jsx("div",{className:"mt-5 flex items-center justify-center gap-3",children:s.jsxs(Rt,{type:"button",onClick:X,disabled:I,children:[I?s.jsx(ve,{className:"mr-1.5 h-4 w-4 motion-safe:animate-spin","aria-hidden":"true"}):s.jsx(It,{className:"mr-1.5 h-4 w-4","aria-hidden":"true"}),I?te:"Run first audit"]})}),I?s.jsx("p",{className:"mt-3 text-xs text-muted",role:"status","aria-live":"polite",children:"The dashboard will refresh automatically when the audit finishes."}):null]});const $e=_.deltaScore==null?null:`${_.deltaScore>=0?"+":""}${_.deltaScore} vs previous`,ge=_.trend==="up"?"positive":_.trend==="down"?"negative":"neutral",De=z.data?.points??[],re=De.map(m=>({runId:m.runId,date:m.auditedAt,score:m.aggregateScore})),Re=t===void 0&&u!==null,oe=ae.filter(m=>m.status==="success"),ue=_.factors.filter(m=>m.pagesPartial+m.pagesFailing>0).length,P=_.crossCuttingIssues.some(m=>m.topRecommendations.length>0);function se(m){const H=[];for(const B of oe){const R=B.factors.find(Z=>Z.id===m);R&&R.score<70&&H.push({url:B.url,score:R.score})}return H.sort((B,R)=>B.score-R.score)}return s.jsxs("div",{className:i?"":"mt-6",children:[i?s.jsxs("section",{className:"flex flex-col gap-3 border-b border-default pb-5 sm:flex-row sm:items-end sm:justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-secondary",children:"Site score"}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[s.jsxs("span",{"aria-label":`Site score ${_.aggregateScore} out of 100`,className:`inline-flex items-baseline gap-1 font-mono tabular-nums ${vt(_.aggregateScore)}`,children:[s.jsx("span",{className:"text-3xl font-semibold",children:_.aggregateScore}),s.jsx("span",{className:"text-sm text-muted",children:"/100"})]}),s.jsx(J,{tone:wt(_.aggregateScore),children:lt(_.aggregateScore)}),$e?s.jsx(J,{tone:ge,children:$e}):null]})]}),s.jsxs("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm tabular-nums text-secondary",children:[s.jsxs("span",{children:[_.pagesAudited," page",_.pagesAudited===1?"":"s"," checked"]}),s.jsx("span",{"aria-hidden":"true",className:"text-faint",children:"·"}),s.jsxs("span",{children:[ue," check",ue===1?"":"s"," need",ue===1?"s":""," attention"]}),_.pagesErrored>0?s.jsxs(s.Fragment,{children:[s.jsx("span",{"aria-hidden":"true",className:"text-faint",children:"·"}),s.jsxs("span",{className:"text-negative",children:[_.pagesErrored," crawl error",_.pagesErrored===1?"":"s"]})]}):null]})]}):s.jsxs("section",{className:"surface-card flex flex-wrap items-start justify-between gap-6 rounded-lg border border-default bg-surface p-6",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:Re?"Technical AEO history":"Technical AEO"}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-baseline gap-3",children:[s.jsx("span",{className:`text-4xl font-semibold tabular-nums ${vt(_.aggregateScore)}`,children:_.aggregateScore}),s.jsx("span",{className:"text-lg text-muted",children:"/ 100"}),s.jsx(J,{tone:wt(_.aggregateScore),children:lt(_.aggregateScore)}),$e?s.jsx(J,{tone:ge,children:$e}):null,I?s.jsx(J,{tone:"neutral",children:te}):null]}),s.jsxs("p",{className:"supporting-copy mt-2 tabular-nums",children:[_.pagesDiscovered," URL",_.pagesDiscovered===1?"":"s"," in sitemap · ",_.pagesAudited," audited · ",_.pagesSkipped," skipped · ",_.pagesErrored," errored"]}),s.jsxs("p",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 text-xs text-muted",children:[s.jsx("span",{className:"text-faint",children:"Sitemap:"}),s.jsx("a",{href:_.sitemapUrl??"#",target:"_blank",rel:"noreferrer",className:"max-w-[22rem] truncate text-secondary underline decoration-mono-700 underline-offset-2 hover:text-strong",children:_.sitemapUrl}),s.jsx(we,{text:"Every audit re-reads this sitemap, so pages you add or remove are picked up on the next run. Discovered/audited counts and the score reflect the sitemap at the time of the latest run. Override it with `canonry technical-aeo run <project> --sitemap-url <url>`."})]}),_.auditedAt?s.jsxs("p",{className:"mt-0.5 text-xs text-faint",children:["Audited ",new Date(_.auditedAt).toLocaleString()]}):null,I?s.jsx("p",{className:"mt-1 text-xs text-muted",role:"status","aria-live":"polite",children:"Results refresh automatically when this audit finishes."}):null]}),s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[t===void 0&&De.length>1?s.jsxs("select",{"aria-label":"View a Technical AEO audit",value:u??"",onChange:m=>h(m.target.value||null),className:"min-h-11 rounded-md border border-base bg-bg px-3 text-sm text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600",children:[s.jsx("option",{value:"",children:"Latest audit"}),[...De].reverse().slice(1).map(m=>s.jsxs("option",{value:m.runId,children:[new Date(m.auditedAt).toLocaleDateString()," · ",m.aggregateScore,"/100"]},m.runId))]}):null,s.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>{Se()},disabled:S,children:[s.jsx(Lt,{className:`mr-1.5 h-4 w-4 ${S?"motion-safe:animate-spin":""}`,"aria-hidden":"true"}),S?"Refreshing…":"Refresh"]}),!Dt()&&s.jsxs(Rt,{type:"button",size:"sm",onClick:X,disabled:I,children:[I?s.jsx(ve,{className:"mr-1.5 h-4 w-4 motion-safe:animate-spin","aria-hidden":"true"}):s.jsx(It,{className:"mr-1.5 h-4 w-4","aria-hidden":"true"}),I?te:"Re-run audit"]})]})]}),!i&&re.length>=2?s.jsxs("section",{className:"page-section-divider",children:[s.jsxs("div",{className:"section-head",children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:"Trend"}),s.jsx("h2",{children:"Site score over time"})]}),s.jsxs("div",{className:"mt-3 h-56",children:[s.jsxs("p",{className:"sr-only",children:["Technical AEO scores range from ",Math.min(...re.map(m=>m.score))," to ",Math.max(...re.map(m=>m.score))," across ",re.length," audits. Use the audit selector to inspect a previous scorecard."]}),s.jsx("div",{className:"h-full","aria-hidden":"true",children:s.jsx(si,{width:"100%",height:"100%",children:s.jsxs(ii,{data:re,margin:{top:8,right:8,bottom:0,left:0},children:[s.jsx(ai,{stroke:Js,vertical:!1}),s.jsx(ri,{dataKey:"date",tick:cn,tickLine:!1,axisLine:{stroke:ln},tickFormatter:gr,minTickGap:24}),s.jsx(oi,{domain:[0,100],ticks:[0,25,50,75,100],tick:cn,tickLine:!1,axisLine:!1,width:32}),s.jsx(di,{...ei,cursor:{stroke:ln,strokeWidth:1},labelFormatter:xr,formatter:m=>[`${m}/100`,"Site score"]}),s.jsx(li,{type:"monotone",dataKey:"score",name:"score",stroke:un.positive,strokeWidth:2.5,dot:{r:2.5,fill:un.positive,strokeWidth:0},isAnimationActive:!1})]})})})]})]}):null,s.jsxs("section",{className:i?"pt-5":"page-section-divider",children:[i?s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold text-heading",children:a?"Checks":"Technical findings"}),s.jsx("p",{className:"mt-1 max-w-2xl text-sm text-secondary",children:a?"Open a check to see affected pages and fixes.":P?"Select a check to see affected pages and recommended fixes.":"Select a check to see affected pages and score details."})]}):s.jsxs("div",{className:"section-head",children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:"Scorecard"}),s.jsxs("h2",{className:"inline-flex items-center gap-1.5",children:["Ranking factors",s.jsx(we,{text:"Each factor is scored 0–100 per page (via the aeo-audit engine), then averaged across all successfully-audited pages. Pass ≥70, partial 40–69, fail <40. Expand a row to see which pages fall short and how to fix it."})]})]}),s.jsx("div",{className:"evidence-table-wrap mt-3",children:s.jsxs("table",{className:`evidence-table ${i?"min-w-[42rem]":""}`,children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:i?"Technical check":"Factor"}),i?null:s.jsx("th",{className:"text-right",children:"Weight"}),s.jsx("th",{className:"text-right",children:i?"Score":"Avg"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:i?"Pages affected":"Pass / Partial / Fail"})]})}),s.jsx("tbody",{children:_.factors.map(m=>{const H=l===m.id,B=_.crossCuttingIssues.find(de=>de.factorId===m.id),R=H?se(m.id):[],Z=m.pagesPartial+m.pagesFailing,Le=m.pagesPassing+Z,he=!!B?.topRecommendations.length,Pe=he&&Z>0;return s.jsxs(y.Fragment,{children:[s.jsxs("tr",{className:H?"bg-surface-subtle":void 0,children:[s.jsx("td",{children:s.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2 text-left font-medium text-strong outline-none hover:text-primary focus-visible:text-primary focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-mono-400","aria-expanded":H,onClick:()=>p(H?null:m.id),children:[H?s.jsx(_n,{className:"size-4 shrink-0 text-muted","aria-hidden":"true"}):s.jsx(kt,{className:"size-4 shrink-0 text-muted","aria-hidden":"true"}),m.name]})}),i?null:s.jsxs("td",{className:"text-right tabular-nums text-muted",children:[m.weight,"%"]}),s.jsxs("td",{className:"text-right font-mono tabular-nums text-strong",children:[m.avgScore,i?s.jsx("span",{className:"text-muted",children:"/100"}):null]}),s.jsx("td",{children:s.jsx(J,{tone:mr(m.status),children:lt(m.avgScore)})}),i?s.jsxs("td",{className:`tabular-nums ${Z>0?"text-strong":"text-muted"}`,children:[Z," of ",Le]}):s.jsxs("td",{className:"tabular-nums text-secondary",children:[s.jsx("span",{className:"text-positive-400",children:m.pagesPassing})," / ",s.jsx("span",{className:"text-caution-400",children:m.pagesPartial})," / ",s.jsx("span",{className:"text-negative-400",children:m.pagesFailing})]})]}),H?s.jsx("tr",{className:"bg-surface-subtle",children:s.jsx("td",{colSpan:i?4:5,className:"px-4 pb-5 pt-0",children:s.jsxs("div",{className:`grid gap-5 border-t border-subtle pt-4 ${Pe?"lg:grid-cols-2":""}`,children:[he&&B?s.jsxs("section",{"aria-labelledby":`technical-finding-${m.id}-fixes`,children:[s.jsx("h4",{id:`technical-finding-${m.id}-fixes`,className:"text-sm font-semibold text-heading",children:"Recommended fixes"}),s.jsx("ol",{className:"mt-2 list-decimal space-y-1.5 pl-5 marker:text-muted",children:B.topRecommendations.map((de,xe)=>s.jsx("li",{className:"pl-1 text-sm text-secondary",children:de},xe))}),i?s.jsxs("p",{className:"mt-3 text-xs text-muted",children:["Weight: ",m.weight,"% of the site score"]}):null]}):Z===0?s.jsx("p",{className:"text-sm text-secondary",children:"Every audited page passes this check."}):null,Z>0?s.jsxs("section",{"aria-labelledby":`technical-finding-${m.id}-pages`,children:[s.jsxs("h4",{id:`technical-finding-${m.id}-pages`,className:"text-sm font-semibold text-heading",children:["Affected pages (",Z,")"]}),i&&C.isLoading?s.jsxs("div",{className:"mt-3 flex items-center gap-2 text-sm text-secondary",role:"status",children:[s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading affected pages..."]}):i&&C.error?s.jsxs("div",{className:"mt-3",role:"alert",children:[s.jsx("p",{className:"text-sm font-medium text-negative",children:"Affected pages could not load"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Try the page-level audit read again."}),s.jsxs(O,{type:"button",variant:"secondary",size:"sm",className:"mt-3",onClick:()=>{C.refetch()},disabled:C.isFetching,children:[C.isFetching?s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}):s.jsx(Lt,{className:"size-4","aria-hidden":"true"}),C.isFetching?"Retrying affected pages...":"Retry affected pages"]})]}):R.length>0?s.jsx("ul",{className:"mt-2 space-y-1.5",children:R.slice(0,Ct).map(de=>s.jsxs("li",{className:"flex min-w-0 items-center gap-2 text-sm",children:[s.jsx("span",{className:`w-8 shrink-0 text-right font-mono tabular-nums ${vt(de.score)}`,children:de.score}),s.jsx("a",{href:de.url,target:"_blank",rel:"noreferrer",className:"min-w-0 truncate text-link outline-none hover:text-heading focus-visible:ring-2 focus-visible:ring-mono-400",title:de.url,children:de.url})]},de.url))}):s.jsx("p",{className:"mt-2 text-sm text-secondary",children:"Page details are not available in the loaded audit sample."}),R.length>Ct?s.jsxs("p",{className:"mt-2 text-xs text-muted",children:["+ ",R.length-Ct," more below pass"]}):null,ce&&(!i||!C.isLoading&&!C.error)?s.jsxs("p",{className:"mt-2 text-xs text-muted",children:["Showing the worst ",ae.length," audited pages."]}):null]}):null]})})}):null]},m.id)})})]})})]}),!i&&_.crossCuttingIssues.length>0?s.jsxs("section",{className:"page-section-divider",children:[s.jsxs("div",{className:"section-head",children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:"Opportunities"}),s.jsxs("h2",{className:"inline-flex items-center gap-1.5",children:["Prioritized fixes",s.jsx(we,{text:"Factors scoring below pass across the most pages, ranked by site-wide impact. Fixing one of these typically lifts many pages at once."})]})]}),s.jsx("div",{className:"mt-3 divide-y divide-mono-800/60 overflow-hidden rounded-lg border border-default",children:_.crossCuttingIssues.map(m=>s.jsxs("div",{className:"p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[s.jsx("span",{className:"text-sm font-medium text-heading",children:m.factorName}),s.jsx(J,{tone:wt(m.avgScore),children:lt(m.avgScore)}),s.jsxs("span",{className:"text-xs tabular-nums text-muted",children:["avg ",m.avgScore," · affects ",m.affectedPages," of ",m.totalPages," pages (",m.affectedPct,"%)"]})]}),m.topRecommendations.length>0?s.jsx("ul",{className:"mt-2 space-y-1",children:m.topRecommendations.map((H,B)=>s.jsxs("li",{className:"flex gap-2 text-sm text-secondary",children:[s.jsx("span",{className:"select-none text-faint",children:"→"}),s.jsx("span",{children:H})]},B))}):null]},m.factorId))})]}):null,i?null:s.jsxs("section",{className:"page-section-divider",children:[s.jsxs("div",{className:"section-head section-head-inline",children:[s.jsxs("div",{children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:"Pages"}),s.jsx("h2",{children:"Per-page breakdown"})]}),me?s.jsxs("div",{className:"segmented",role:"group","aria-label":"Filter pages",children:[s.jsxs("button",{type:"button",onClick:()=>{c(!1),ne.setPage(1)},"aria-pressed":!U,className:`segmented-option min-h-11 tabular-nums ${U?"":"segmented-option-active"}`,children:["All ",_.pagesAudited]}),s.jsxs("button",{type:"button",onClick:()=>{c(!0),ne.setPage(1)},"aria-pressed":U,className:`segmented-option min-h-11 tabular-nums ${U?"segmented-option-active text-negative":""}`,children:["Errors ",_.pagesErrored]})]}):null]}),ae.length>0?s.jsx(cr,{value:ne.query,onChange:ne.setQuery,label:"Filter audited page URLs",placeholder:"Filter page URL or query parameters",className:"mt-3 max-w-md"}):null,ne.totalRows===0?s.jsx("p",{className:"supporting-copy mt-3",children:ne.hasQuery?"No pages match this filter.":"No pages recorded."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"evidence-table-wrap mt-3",children:s.jsxs("table",{className:"evidence-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-right",children:"Score"}),s.jsx("th",{children:"Status"}),s.jsx("th",{className:"w-full",children:"URL"})]})}),s.jsx("tbody",{children:ne.rows.map(m=>s.jsxs("tr",{children:[s.jsx("td",{className:"text-right tabular-nums",children:m.status==="error"?s.jsxs("span",{className:"inline-flex items-center gap-1 text-negative-400",children:[s.jsx(Pt,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"err"]}):s.jsx("span",{className:vt(m.overallScore),children:m.overallScore})}),s.jsx("td",{children:m.status==="error"?s.jsx(J,{tone:"negative",children:"Error"}):s.jsx(J,{tone:wt(m.overallScore),children:lt(m.overallScore)})}),s.jsx("td",{className:"w-full max-w-0",children:s.jsx("a",{href:m.url,target:"_blank",rel:"noreferrer",className:"block truncate text-neutral hover:text-heading",title:m.status==="error"?m.error??m.url:m.url,children:s.jsx(dr,{value:m.url,headLength:54,tailLength:20,title:m.status==="error"?m.error??m.url:m.url})})})]},m.url))})]})}),s.jsx(ur,{page:ne.page,pageSize:ne.pageSize,visibleRows:ne.rows.length,totalRows:ne.totalRows,onPageChange:ne.setPage,itemLabel:ne.hasQuery?"matches":"rows"}),ce?s.jsxs("p",{className:"mt-2 text-xs text-faint",children:["Showing the worst ",ae.length," of ",_.pagesAudited," audited pages."]}):null]})]}),r]})}const qe=[{id:"map",label:"Map"},{id:"inventory",label:"Pages"},{id:"technical",label:"Page health"}],Vn={map:"Explore how pages, site sections, and internal links fit together.",inventory:"Review discovered pages and the links that shape their visibility.",technical:"Prioritize audit findings and inspect the pages that need work."},Yn=[{id:"all",label:"All",healthState:void 0},{id:"hidden",label:"Hidden pages",healthState:Ps.hidden}],yr={[Ke.metaRobotsNoindex]:"Hidden by meta robots tag",[Ke.xRobotsNoindex]:"Hidden by X-Robots-Tag header",[Ke.robotsDisallow]:"Blocked by robots.txt",[Ke.redirectTerminal]:"Redirects to another page",[Ke.canonicalToOther]:"Points to another page as canonical",[Ke.notHtmlOrUnavailable]:"Not an HTML page, so it was not scored"},wr=new Map(Object.entries(yr));function vr(n){return wr.get(n)??n}const Nr=20,jr=200,kr=100,Qn=100,Sr=50,Er=Ks,Ar=Hs,_r=2e4,$r=3,Ne=new Intl.NumberFormat,Lr=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}),Tr={eligible:"positive",hidden:"caution",resource:"neutral",redirect:"neutral",failed:"negative",unchecked:"neutral"};function Xn(n){if(!n)return"Date unavailable";const e=new Date(n);return Number.isNaN(e.getTime())?"Date unavailable":Lr.format(e)}function Gr(n){return n.replaceAll("_"," ").replaceAll("-"," ").replace(/\b\w/g,e=>e.toUpperCase())}function Zn(n){const e=Qe(n);return{label:Ot(e),tone:Tr[e]}}function Jn(n){if(n==null)return"Not scored";const e=n<=1?n*100:n;return`${Math.round(e)}%`}function Cr(n){return n.auditScore==null?"Not checked":`${Math.round(n.auditScore)}/100`}function M(n){return n==null?"Not available":Ne.format(n)}const Dr={clicksFromHome:"How many clicks it takes to reach this page from the home page, following links.",linksIn:"How many other pages link to this page.",linksOut:"How many other pages this page links to.",linkImportance:"How much link value flows to this page, based on how many pages link to it and how important those pages are. Shown relative to the highest page on this site, which is 100%.",technicalScore:"How well this page is set up for AI and search engines to read, from 0 to 100. Open a page to see what it is marked down for.",linkTimes:"How many times this link appears on the page it comes from.",pagesFound:"How many pages this scan discovered, whether or not it could load them.",pagesChecked:"How many of the pages it found this scan actually loaded.",internalLinks:"How many links between pages on this site the scan recorded."},Rr=new Set(["clicksFromHome","linkImportance","internalLinks","pagesFound","pagesChecked"]);function Te(n,e){const t=Dr[n];return Rr.has(n)?`${t} This always counts every link, including menu and footer.`:n==="technicalScore"||n==="linkTimes"?t:e?`${t} Right now this counts only links written in your page text. Menu and footer links are hidden.`:`${t} This counts every link, including menu and footer.`}function es(n,e){return`${Ne.format(n)} ${e}${n===1?"":"s"}`}function Pr(n,e){if(!n||!e)return null;try{const t=new URL(n),i=new URL(e),a=r=>r.hostname.toLowerCase().replace(/\.$/,"").replace(/^www\./,"");return a(t)!==a(i)?{requested:t.host,effective:i.host}:null}catch{return null}}function Ir(n){return n==="completed"?"positive":n==="partial"||n==="queued"||n==="running"?"caution":n==="failed"||n==="cancelled"?"negative":"neutral"}function Mr(n){const e=Xn(n.finishedAt??n.startedAt??n.createdAt),t=n.hasCrawlData?"":" · Score only";return`${e} · ${Gr(n.status)}${t}`}const Or={complete:"This scan finished on its own.",unknown:"This scan stopped before it checked every page it found.","max-pages":"This scan stopped at the page limit, so some pages were not checked.","max-edges":"This scan stopped at the link limit, so some links are missing.","max-fetches":"This scan stopped after checking as many pages as it could.","max-duration":"This scan ran out of time, so some pages were not checked.","max-bytes":"This scan stopped at the data limit, so some pages were not checked.","max-page-bytes":"This scan skipped a page that was too large to read.","max-depth":"This scan stopped at the depth limit, so deeper pages were not checked.","max-links-per-page":"This scan stopped reading links on pages that had too many.","max-query-variants":"This scan stopped at the limit for pages that differ only by a query string.","max-sitemap-fanout":"This scan stopped at the sitemap limit, so some sitemaps were not read.","max-sitemap-urls":"This scan stopped at the sitemap page limit, so some pages were not found.","root-host-redirect":"The site moved to another address during this scan."},zr=new Map(Object.entries(Or));function Fr(n){return n?zr.get(n)??`This scan stopped early: ${n}.`:"This scan stopped before it checked every page it found."}const Vt={applied:"This scan told menu and footer links apart by how often the same link repeats across pages. It cannot spot a link written into the page text when its wording matches the menu. Run a new scan to read the page layout instead.","applied-placement":"This scan read where each link sits in the page, so links in the page text are separated from the menu, header, and footer even when they use the same wording.","applied-placement-with-ubiquity":"This scan read where each link sits in the page. Some pages mark out no menu or main area, so those links fall back to how often the link repeats across pages, which can miss a link written into the page text.","applied-placement-partial":`This scan read where each link sits in the page. Some pages mark out no menu or main area, and this scan found fewer than ${rn} pages, so nothing could tell those links apart. They are counted as links in your page text, which is what a link no rule marked as menu, header, or footer means here.`,"unavailable-too-few-pages":`This scan found fewer than ${rn} pages and did not read where each link sits in the page. On a site that small every link is on most pages, so menu and footer links cannot be told apart from the rest.`,"unavailable-legacy-scan":"This scan ran before menu and footer links were separated. Run a new scan to split them out."},Ur=new Map(Object.entries(Vt));function ts(n){return n===null?"":Ur.get(n)??Vt["unavailable-legacy-scan"]}const ns="Scroll to zoom. Click a page to inspect it.",ss="Observed links to and from this page in the selected scan.",is="Page positions on this map were set before menu and footer links were separated. Run a new scan to update them.";function as(n){if(n.filterUnavailable)return`All ${es(n.totalEdgeCount,"link")} shown.`;const e=`${Ne.format(n.contentEdgeCount)} link${n.contentEdgeCount===1?"":"s"} in your page text`,t=Ne.format(n.templateEdgeCount);return n.showTemplateLinks?`${e}, ${t} menu and footer.`:`${e}. ${t} menu and footer link${n.templateEdgeCount===1?"":"s"} hidden.`}const rs="Menu, header, and footer links repeat on every page, so they say nothing about which pages relate to each other. Links written in your page text do.";function os(n,e){const t=[rs,ts(n)];return e.staleLayout&&t.push(is),t.filter(Boolean).join(" ")}function Br(n,e,t){if(n==="disabled")return{label:"Broken links: not checked",tone:"neutral"};const i=t??0,a=i>0?`, ${Ne.format(i)} unchecked`:"";return n==="complete"?e?{label:`Broken links: ${Ne.format(e)} found${a}`,tone:"negative"}:i>0?{label:`Broken links: none found, ${Ne.format(i)} unchecked`,tone:"caution"}:{label:"Broken links: none found",tone:"positive"}:n==="partial"?{label:`Broken links: ${Ne.format(e??0)} found so far${a}`,tone:"caution"}:{label:"Broken links: not checked",tone:"neutral"}}function Ft(n){return n.showTemplateLinks||!n.known?{value:M(n.total),hiddenNote:null,filtered:!1}:{filtered:!0,value:n.truncated?`${M(n.visible)}+`:M(n.visible),hiddenNote:n.hidden===0?null:n.truncated?`At least ${M(n.hidden)} menu and footer hidden`:`${M(n.hidden)} menu and footer hidden`}}function Nt({label:n,value:e,hiddenNote:t,help:i}){return s.jsxs("div",{className:"px-4 py-3",children:[s.jsxs("dt",{className:"flex items-center gap-1 text-xs text-muted",children:[n,s.jsx(we,{text:i})]}),s.jsx("dd",{className:"mt-1 text-sm font-medium tabular-nums text-heading",children:e}),t&&s.jsx("dd",{className:"mt-0.5 text-xs text-muted",children:t})]})}function Hr({page:n,inbound:e,outbound:t}){return s.jsx(s.Fragment,{children:s.jsxs("dl",{className:"grid grid-cols-2 divide-x divide-y divide-default rounded-lg border border-default sm:grid-cols-4 sm:divide-y-0",children:[s.jsx(Nt,{label:"Clicks from home",value:String(n.depth??"Not reached"),help:Te("clicksFromHome",!1)}),s.jsx(Nt,{label:"Links in",value:e.value,hiddenNote:e.hiddenNote,help:Te("linksIn",e.filtered)}),s.jsx(Nt,{label:"Links out",value:t.value,hiddenNote:t.hiddenNote,help:Te("linksOut",t.filtered)}),s.jsx(Nt,{label:"Link importance",value:Jn(n.linkScoreNormalized),help:Te("linkImportance",!1)})]})})}function ds(n,e,t){if(e===0)return n==="inbound"?"Nothing links to this page.":"This page links to nothing.";const i=n==="inbound"?"No links in the page text point here.":"No links in the page text lead away from here.",a=t?`At least ${M(e)} menu and footer links hidden.`:`${es(e,"menu and footer link")} hidden.`;return`${i} ${a}`}function Ye({label:n,metric:e}){return s.jsxs("span",{className:"inline-flex items-center gap-1",children:[n,s.jsx(we,{text:Te(e,!1)})]})}function jn({direction:n,edges:e,truncated:t,rootHost:i,hiddenTemplateCount:a}){const r=n==="inbound"?"Links in":"Links out";return s.jsxs("section",{className:"min-w-0","aria-labelledby":`site-health-${n}-heading`,children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[s.jsxs("h4",{id:`site-health-${n}-heading`,className:"text-sm font-medium text-heading",children:[r," (",M(e.length),")"]}),t&&s.jsxs("span",{className:"text-xs text-muted",children:["First ",Qn]})]}),e.length===0?s.jsx("p",{className:"rounded-lg border border-subtle bg-surface-subtle px-3 py-4 text-sm text-secondary",children:ds(n,a,t)}):s.jsx("div",{className:"evidence-table-wrap max-h-64 overflow-auto",children:s.jsxs("table",{className:"evidence-table site-health-table min-w-[420px]",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{scope:"col",children:"Page"}),s.jsx("th",{scope:"col",children:"Anchor text"}),s.jsx("th",{scope:"col",children:s.jsx(Ye,{label:"Times",metric:"linkTimes"})})]})}),s.jsx("tbody",{children:e.map(o=>{const d=n==="inbound"?o.sourceUrl:o.targetUrl;return s.jsxs("tr",{children:[s.jsx("td",{className:"max-w-64 truncate font-mono",title:d,children:Tn(d,i)}),s.jsx("td",{className:"max-w-52 truncate",title:o.anchors.join(", ")||void 0,children:o.anchors.join(", ")||"No anchor text"}),s.jsx("td",{className:"tabular-nums",children:M(o.occurrences)})]},o.edgeKey)})})]})})]})}function Kr(n){return n&&"indexabilityReasons"in n?n.indexabilityReasons:[]}function kn({page:n,isLoading:e,error:t,inbound:i,outbound:a,inboundTruncated:r,outboundTruncated:o,audit:d,auditLoading:c,auditError:l,onRetryAudit:p,rootHost:u,reasonSource:h,reasonsState:b,onRetryReasons:S,showTemplateLinks:k}){if(!n)return s.jsxs("section",{className:"border-t border-default pt-5","aria-label":"Selected page details",children:[s.jsx("h3",{className:"text-base font-medium text-heading",children:"Page links"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Select a page to inspect its internal links and crawl signals."})]});const D=Zn(n),T=Kr(h??n),z=k?i:i.filter(G=>!G.isTemplate),C=k?a:a.filter(G=>!G.isTemplate),x=!e&&!t,g=i.length-z.length,f=a.length-C.length,v=Ft({total:n.inboundUniqueEdges,visible:z.length,hidden:g,truncated:r,showTemplateLinks:k,known:x}),$=Ft({total:n.outboundUniqueEdges,visible:C.length,hidden:f,truncated:o,showTemplateLinks:k,known:x});return s.jsxs("section",{className:"border-t border-default pt-5","aria-labelledby":"site-health-page-inspector-title",children:[s.jsxs("div",{className:"flex flex-col justify-between gap-3 sm:flex-row sm:items-start",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h3",{id:"site-health-page-inspector-title",className:"break-words font-mono text-base font-semibold text-heading",children:n.path}),s.jsx(J,{tone:D.tone,children:D.label})]}),s.jsx("p",{className:"mt-1 break-all text-sm text-secondary",children:n.url}),b==="loading"?s.jsx("p",{className:"mt-2 text-sm text-secondary",role:"status",children:"Loading page details..."}):b==="error"?s.jsxs("p",{className:"mt-2 flex flex-wrap items-center gap-2 text-sm text-negative",role:"alert",children:["Page details could not be loaded, so any reason this page is hidden is unknown.",s.jsx(O,{type:"button",variant:"secondary",size:"sm",onClick:S,children:"Try again"})]}):T.length>0?s.jsx("ul",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-sm text-secondary","aria-label":"Why this page is hidden",children:T.map(G=>s.jsx("li",{children:vr(G)},G))}):null]}),s.jsx(O,{asChild:!0,variant:"secondary",size:"sm",children:s.jsxs("a",{href:n.url,target:"_blank",rel:"noreferrer",children:["Open page ",s.jsx(Zs,{className:"size-3.5","aria-hidden":"true"})]})})]}),s.jsx("div",{className:"mt-4",children:s.jsx(sr,{audit:d,isLoading:c,error:l,onRetry:p})}),s.jsxs("section",{className:"mt-5 border-t border-default pt-5","aria-labelledby":"site-health-page-links-heading",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("h3",{id:"site-health-page-links-heading",className:"text-base font-semibold text-heading",children:"Internal links"}),s.jsx(we,{text:ss})]}),s.jsx("div",{className:"mt-4",children:s.jsx(Hr,{page:n,inbound:v,outbound:$})}),s.jsx("div",{className:"mt-5",children:e?s.jsxs("div",{className:"flex items-center gap-2 py-6 text-sm text-secondary",children:[s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading page links..."]}):t?s.jsx("p",{className:"rounded-lg border border-negative bg-negative-soft px-4 py-3 text-sm text-negative",role:"alert",children:"Page links could not be loaded."}):s.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[s.jsx(jn,{direction:"inbound",edges:z,truncated:r,rootHost:u,hiddenTemplateCount:g}),s.jsx(jn,{direction:"outbound",edges:C,truncated:o,rootHost:u,hiddenTemplateCount:f})]})})]})]})}function Wr({pages:n,total:e,selectedNodeKey:t,onSelect:i,hasNextPage:a,isFetchingNextPage:r,onLoadMore:o,filter:d,onFilterChange:c,filterUnavailable:l}){const[p,u]=y.useState(""),h=p.trim().toLowerCase(),b=y.useMemo(()=>h?n.filter(k=>`${k.path} ${k.url}`.toLowerCase().includes(h)):n,[h,n]),S=h.length>0&&(a||n.length<e);return s.jsxs("section",{"aria-labelledby":"site-health-inventory-heading",children:[s.jsxs("div",{className:"mb-3 flex flex-col justify-between gap-3 sm:flex-row sm:items-end",children:[s.jsxs("div",{children:[s.jsx("h2",{id:"site-health-inventory-heading",className:"text-base font-semibold text-heading",children:"Pages"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:d==="all"?`Showing ${M(n.length)} of ${M(e)} pages found.`:`Showing ${M(n.length)} of ${M(e)} hidden pages.`})]}),s.jsxs("label",{className:"relative block w-full sm:w-72",children:[s.jsx("span",{className:"sr-only",children:"Search loaded pages"}),s.jsx(Ut,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted","aria-hidden":"true"}),s.jsx("input",{type:"search",value:p,onChange:k=>u(k.target.value),placeholder:"Search loaded pages",className:"h-9 w-full rounded-md border border-base bg-bg pl-9 pr-3 text-sm text-primary outline-none placeholder-mono-600 focus:border-strong focus:ring-2 focus:ring-mono-600"})]})]}),s.jsx("div",{className:"mb-3 flex flex-wrap gap-2",role:"group","aria-label":"Filter pages",children:Yn.map(k=>s.jsx("button",{type:"button","aria-pressed":d===k.id,onClick:()=>c(k.id),className:`filter-chip ${d===k.id?"filter-chip-active":""}`,children:k.label},k.id))}),s.jsx("div",{className:"evidence-table-wrap",children:s.jsxs("table",{className:"evidence-table site-health-table min-w-[800px]",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{scope:"col",children:"Page"}),s.jsx("th",{scope:"col",title:Xe("eligible"),children:"Status"}),s.jsx("th",{scope:"col",children:s.jsx(Ye,{label:"Clicks from home",metric:"clicksFromHome"})}),s.jsx("th",{scope:"col",children:s.jsx(Ye,{label:"Links in",metric:"linksIn"})}),s.jsx("th",{scope:"col",children:s.jsx(Ye,{label:"Links out",metric:"linksOut"})}),s.jsx("th",{scope:"col",children:s.jsx(Ye,{label:"Link importance",metric:"linkImportance"})}),s.jsx("th",{scope:"col",children:s.jsx(Ye,{label:"Score",metric:"technicalScore"})})]})}),s.jsx("tbody",{children:b.map(k=>{const D=Zn(k);return s.jsxs("tr",{className:t===k.nodeKey?"bg-surface-active":void 0,children:[s.jsx("td",{className:"max-w-80",children:s.jsx("button",{type:"button",onClick:()=>i(k.nodeKey),className:"block max-w-full truncate rounded-sm font-mono text-sm font-medium text-link outline-none focus-visible:ring-2 focus-visible:ring-mono-400",title:k.url,children:k.path})}),s.jsx("td",{title:Xe(Qe(k)),children:s.jsx(J,{tone:D.tone,children:D.label})}),s.jsx("td",{className:"tabular-nums",children:k.depth??"Not reached"}),s.jsx("td",{className:"tabular-nums",children:M(k.inboundUniqueEdges)}),s.jsx("td",{className:"tabular-nums",children:M(k.outboundUniqueEdges)}),s.jsx("td",{className:"tabular-nums",children:Jn(k.linkScoreNormalized)}),s.jsx("td",{className:"tabular-nums",children:Cr(k)})]},k.nodeKey)})})]})}),b.length===0&&s.jsx("p",{className:"border-x border-b border-default px-4 py-8 text-center text-sm text-secondary",children:h.length===0?l?"This scan cannot be filtered. Run a new scan to filter its pages.":d==="hidden"?"No hidden pages were found in this scan.":"No pages are available.":S?`No matches in the ${M(n.length)} loaded pages. Load more pages to continue searching.`:"No pages match this search."}),a&&s.jsx("div",{className:"flex justify-center border-x border-b border-default px-4 py-3",children:s.jsxs(O,{variant:"secondary",size:"sm",disabled:r,onClick:o,children:[r&&s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),r?"Loading more pages":"Load more pages"]})})]})}function qr({projectName:n,runId:e,section:t,onSelect:i}){const[a,r]=y.useState(!1),d=t.pageCount-(t.hasPage?1:0)>0;return s.jsxs("li",{children:[s.jsxs("div",{className:"flex min-h-11 items-center gap-1 px-2 py-1",children:[d?s.jsx("button",{type:"button","aria-label":`${a?"Collapse":"Expand"} ${t.path}`,"aria-expanded":a,onClick:()=>r(c=>!c),className:"flex size-8 shrink-0 items-center justify-center rounded-sm text-muted outline-none hover:bg-surface-hover hover:text-heading focus-visible:ring-2 focus-visible:ring-mono-400",children:a?s.jsx(_n,{className:"size-3.5","aria-hidden":"true"}):s.jsx(kt,{className:"size-3.5","aria-hidden":"true"})}):s.jsx("span",{className:"block size-8 shrink-0","aria-hidden":"true"}),s.jsx("button",{type:"button",onClick:()=>i(t.path),className:"min-w-0 flex-1 break-all rounded-sm py-2 text-left font-mono text-sm text-heading outline-none hover:text-link focus-visible:ring-2 focus-visible:ring-mono-400",children:t.path}),s.jsx("span",{className:"shrink-0 px-2 font-mono text-xs text-muted",children:M(t.pageCount)})]}),a&&s.jsx("div",{className:"ml-6 border-l border-default pl-1",children:s.jsx(ls,{projectName:n,runId:e,parentPath:t.path,onSelect:i})})]})}function Vr({page:n,onSelect:e}){return s.jsx("li",{className:"bg-surface-subtle",children:s.jsxs("div",{className:"flex min-h-11 items-center gap-1 px-2 py-1",children:[s.jsx("span",{className:"block size-8 shrink-0","aria-hidden":"true"}),s.jsx("button",{type:"button",onClick:()=>e(n.nodeKey),className:"min-w-0 flex-1 break-all rounded-sm py-2 text-left font-mono text-sm font-semibold text-heading outline-none hover:text-link focus-visible:ring-2 focus-visible:ring-mono-400",children:n.path||"/"}),s.jsx("span",{className:"shrink-0 px-2 font-mono text-xs text-muted",children:M(1)})]})})}function ls({projectName:n,runId:e,parentPath:t,onSelect:i,rootPage:a,onSelectRootPage:r}){const o={client:ie,path:{name:n},query:{runId:e,parentPath:t,limit:kr}},d=En({...Bs(o),initialPageParam:o,getNextPageParam:l=>l.nextCursor?{path:o.path,query:{...o.query,cursor:l.nextCursor}}:void 0}),c=d.data?.pages.flatMap(l=>l.children)??[];return d.isLoading?s.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-sm text-secondary",role:"status",children:[s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"})," Loading sections..."]}):d.error?s.jsx("p",{className:"px-3 py-4 text-sm text-negative",role:"alert",children:"Site sections could not be loaded."}):c.length===0&&!a?s.jsx("p",{className:"px-3 py-4 text-sm text-secondary",children:"No nested sections were found."}):s.jsxs(s.Fragment,{children:[s.jsxs("ul",{className:"divide-y divide-default",children:[a&&r&&s.jsx(Vr,{page:a,onSelect:r}),c.map(l=>s.jsx(qr,{projectName:n,runId:e,section:l,onSelect:i},l.path))]}),d.hasNextPage&&s.jsx("div",{className:"px-3 py-2",children:s.jsx(O,{variant:"ghost",size:"sm",disabled:d.isFetchingNextPage,onClick:()=>{d.fetchNextPage()},children:d.isFetchingNextPage?"Loading more sections":"Load more sections"})})]})}function Yr(){return s.jsx("div",{role:"status",className:"flex min-h-[420px] items-center justify-center rounded-lg border border-default bg-surface-inset px-6 text-center lg:min-h-[520px]",children:s.jsxs("div",{className:"max-w-sm",children:[s.jsx(ve,{className:"mx-auto size-5 motion-safe:animate-spin text-muted","aria-hidden":"true"}),s.jsx("p",{className:"mt-3 text-sm font-medium text-heading",children:"Preparing the interactive site map"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Page and link data is ready for the graph renderer."})]})})}function Sn(n){return n==="discovering"?"Discovering pages":n==="checking"?"Checking pages":n==="arranging-map"?"Arranging map":n==="queued"?"Waiting to start":"Preparing scan"}function Qr(n){return n!=="completed"&&n!=="partial"&&n!=="failed"&&n!=="cancelled"}function Xr(n){return n==="queued"||n==="discovering"||n==="checking"||n==="arranging-map"}function Zr(n){return n==="completed"||n==="partial"||n==="failed"||n==="cancelled"}function Jr(n){if(!n||typeof n!="object")return null;const e=n;if(typeof e.code=="string")return e.code;if(e.error&&typeof e.error=="object"){const t=e.error;return typeof t.code=="string"?t.code:null}return null}function eo(n){if(!n)return null;const e=Date.parse(n);return!Number.isFinite(e)||e>Date.now()?null:e+_r}function to({active:n,runId:e,createdAt:t}){const i=eo(t),[a,r]=y.useState(null);return y.useEffect(()=>{if(!n||!e||i==null){r(null);return}const o=i-Date.now();if(o<=0){r({runId:e,deadline:i});return}r(null);const d=window.setTimeout(()=>r({runId:e,deadline:i}),o);return()=>window.clearTimeout(d)},[n,i,e]),n&&e!=null&&i!=null&&(Date.now()>=i||a?.runId===e&&a.deadline===i)}function no({onContinueOnboarding:n,onSkipOnboarding:e}){return s.jsxs("section",{"aria-labelledby":"site-health-continuation-heading",className:"mt-5 flex flex-col gap-3 border-t border-default pt-5 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{children:[s.jsx("h3",{id:"site-health-continuation-heading",className:"text-base font-semibold text-heading",children:"Continue while Site Health finishes"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Canonry will finish this scan locally. Saved results will appear in Site Health."})]}),s.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2",children:[s.jsx(O,{type:"button",onClick:n,children:"Set up AI Visibility"}),s.jsx(O,{type:"button",variant:"secondary",onClick:e,children:"Skip for now"})]})]})}function Ve({view:n,tabbed:e=!0,children:t}){return s.jsx("div",{id:e?`site-health-${n}-panel`:void 0,role:e?"tabpanel":void 0,"aria-labelledby":e?`site-health-${n}-tab`:void 0,className:"min-w-0",children:t})}function so({status:n,progress:e,progressError:t,onRetryProgress:i,pageHealthDestination:a=!1,livePageHealthPreview:r,livePageHealthError:o=!1,livePageHealthRunId:d=null,continuation:c}){const l=e?.attempt??null,p=e?.phase??n,u=p==="arranging-map";return s.jsxs("section",{"aria-label":"Current scan progress",className:"rounded-lg border border-caution bg-caution-soft px-5 py-6",children:[s.jsx("h2",{className:"min-h-6 text-base font-semibold text-heading",children:u&&a?"Preparing page health":u?"Preparing site map":"Scanning site"}),s.jsx("p",{"aria-atomic":"true","aria-label":"Current scan progress","aria-live":"polite",role:"status",className:"mt-1 min-h-[4.5rem] text-sm text-secondary sm:min-h-10",children:a?u?"Finalizing page health. The scan is complete and its findings are being published.":`${Sn(p)}. Page health appears after the scan finishes.`:u?"Arranging map. The scan is complete and its map is being published.":`${Sn(p)}. The map appears after the scan finishes.`}),s.jsxs("dl",{"aria-label":"Live scan counters",className:"mt-5 grid grid-cols-2 divide-x divide-y divide-default rounded-lg border border-default bg-surface-subtle sm:grid-cols-4 sm:divide-y-0",children:[s.jsxs("div",{className:"px-4 py-3",children:[s.jsx("dt",{className:"text-sm text-secondary",children:"Pages found"}),s.jsx("dd",{className:"mt-1 font-mono text-lg font-semibold tabular-nums text-heading",children:l?M(l.pagesDiscovered):"—"})]}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsx("dt",{className:"text-sm text-secondary",children:"Pages checked"}),s.jsx("dd",{className:"mt-1 font-mono text-lg font-semibold tabular-nums text-heading",children:l?M(l.pagesFetched):"—"})]}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsx("dt",{className:"text-sm text-secondary",children:"Links found"}),s.jsx("dd",{className:"mt-1 font-mono text-lg font-semibold tabular-nums text-heading",children:l?M(l.edgesDiscovered):"—"})]}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsx("dt",{className:"text-sm text-secondary",children:"Pages failed"}),s.jsx("dd",{className:"mt-1 font-mono text-lg font-semibold tabular-nums text-heading",children:l?M(l.pagesErrored):"—"})]})]}),t&&s.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3 text-sm text-secondary",children:[s.jsx("span",{children:u?a?"Page health publishing status could not load.":"Map publishing status could not load.":"Live scan counts could not load. The scan is still running."}),i&&s.jsx(O,{type:"button",variant:"secondary",size:"sm",onClick:i,children:"Retry progress"})]}),a?s.jsx(cs,{runId:d,preview:r,error:o}):null,c]})}function jt(){return Array.from({length:$r},()=>null)}function io(n,e){return n===e||n!=null&&e!=null&&n.nodeKey===e.nodeKey&&n.url===e.url&&n.auditScore===e.auditScore&&n.checksNeedingAttention===e.checksNeedingAttention}function ao(n,e){return n.length===e.length&&n.every((t,i)=>io(t,e[i]??null))}function ro(n,e){const t=[...n];for(const i of e){const a=t.findIndex(o=>o?.nodeKey===i.nodeKey);if(a>=0){t[a]=i;continue}const r=t.findIndex(o=>o==null);if(r<0)break;t[r]=i}return t}function cs({runId:n,preview:e,error:t=!1}){const[i,a]=y.useState(()=>({runId:n,slots:jt()})),r=e?.state==="terminal",o=r||i.runId!==n?jt():i.slots;y.useEffect(()=>{a(l=>{const p=l.runId===n?l.slots:jt(),u=r?jt():ro(p,e?.examples??[]);return l.runId===n&&ao(l.slots,u)?l:{runId:n,slots:u}})},[e?.examples,n,r]);const d=e?.pagesAudited??0,c=o.some(l=>l!=null);return s.jsxs("section",{"aria-labelledby":"live-page-health-findings-heading",className:"mt-5 border-t border-default pt-5",children:[s.jsx("h3",{id:"live-page-health-findings-heading",className:"text-base font-semibold text-heading",children:"Findings so far"}),s.jsxs("div",{className:"relative mt-1 min-h-[5.25rem] text-sm text-secondary sm:min-h-[3.5rem]",children:[s.jsxs("p",{children:["Based on ",Ne.format(d)," audited pages. Results may change until the scan finishes."]}),s.jsx("p",{className:Ue("absolute bottom-0 text-caution",t?"visible":"invisible"),children:"Live findings paused. The scan is still running."})]}),s.jsx("ul",{"aria-label":"Live Page Health findings",className:"mt-3 grid h-[10.5rem] grid-rows-3 divide-y divide-default overflow-hidden rounded-lg border border-default bg-surface-subtle",children:o.map((l,p)=>{const u=l==null&&p===0&&!c,h=l==null&&!u;return s.jsx("li",{"aria-hidden":h||void 0,"data-testid":"live-page-health-slot",className:"grid h-14 min-h-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-2 px-4 sm:gap-4",children:l?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-strong",title:l.url,children:l.url}),s.jsxs("span",{className:"shrink-0 whitespace-nowrap text-sm tabular-nums text-secondary",children:[s.jsxs("span",{"aria-hidden":"true",className:"sm:hidden",children:[Ne.format(l.checksNeedingAttention)," checks"]}),s.jsxs("span",{className:"hidden sm:inline",children:[Ne.format(l.checksNeedingAttention)," checks need attention"]}),s.jsxs("span",{className:"sr-only sm:hidden",children:[Ne.format(l.checksNeedingAttention)," checks need attention"]})]})]}):u?s.jsx("span",{className:"text-sm text-secondary",children:"Checks that need attention will appear here."}):null},`live-page-health-slot-${p}`)})})]})}function oo({phase:n,progress:e,onRunAgain:t,pageHealthDestination:i=!1}){const a=n==="cancelled",r=e?.error??e?.attempt?.error;return s.jsxs("section",{"aria-label":"Site scan recovery",role:"alert",className:"rounded-lg border border-negative bg-negative-soft px-5 py-6",children:[s.jsx("h2",{className:"text-base font-semibold text-negative",children:a?"Scan cancelled":"Scan failed"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:i?a?"The scan was cancelled before Canonry could publish page health results.":"The scan did not complete, so page health results are unavailable.":a?"The scan was cancelled before Canonry could publish a site map.":"The scan did not complete, so there is no site map for this run."}),r&&s.jsx("p",{className:"mt-3 text-sm text-negative",children:r}),s.jsx(O,{type:"button",className:"mt-4",onClick:t,children:"Run scan again"})]})}function lo({projectName:n,projectId:e,initialRunId:t,onReleaseInitialRun:i,showOnboardingActions:a=!1,onContinueOnboarding:r,onSkipOnboarding:o}){const[d,c]=y.useState("map"),l=y.useRef([]),[p,u]=y.useState(()=>t??null),h=y.useRef(t),[b,S]=y.useState(null),[k,D]=y.useState(!1),[T,z]=y.useState("all"),[C,x]=y.useState(!1),g=Dt(),f=a&&!g,v=An();y.useEffect(()=>{const N=h.current;N!==t&&(h.current=t,u(Q=>t??(Q===N?null:Q)),S(null))},[t]);const G=fe({...Ts({client:ie,path:{name:n},query:{limit:Nr}}),refetchOnWindowFocus:"always",refetchInterval:N=>N.state.data?.scans.some(Q=>Q.status==="queued"||Q.status==="running")?3e3:15e3}).data?.scans??[],A=G.find(N=>N.status==="queued"||N.status==="running"),I=G.find(N=>N.status==="completed"||N.status==="partial"),le=f?v.data?.runId??null:null,W=p??(f?le??A?.runId??I?.runId:I?.runId??A?.runId)??null,Se=A?.runId===W?A:null,X=W?G.find(N=>N.runId===W):void 0,te=!!(t&&W===t),_=!!(le&&W===le),ae=_&&!X,me=Se?.runId??(te||ae?W:null),U=fe({...Gs({client:ie,path:{name:n,runId:me??""}}),enabled:!!me,refetchInterval:N=>Qr(N.state.data?.phase)?3e3:!1});y.useEffect(()=>{!te||!U.isError||Jr(U.error)==="NOT_FOUND"&&(u(null),S(null),i?.())},[U.error,U.isError,te,i]);const Ae=Xr(U.data?.phase),ce=Zr(U.data?.phase)?null:Se,_e=!!(me&&U.isPending),ge=!!(!!((te||_)&&!X)&&U.isError),De=!!(f&&me&&(ce?.runId===me||Ae)),re=fe({...Cs({client:ie,path:{name:n,runId:me??""}}),enabled:De,refetchInterval:N=>N.state.data?.state==="terminal"?!1:3e3,refetchIntervalInBackground:!0}),Re=!!(ce||Ae||_e||ge),oe=U.data?.phase==="failed"||U.data?.phase==="cancelled"?U.data.phase:(te||_)&&(X?.status==="failed"||X?.status==="cancelled")?X.status:null,ue=fe({...Ds({client:ie,path:{name:n},...W?{query:{runId:W}}:{}}),enabled:!Re}),P=ue.data,se=W??P?.runId??null,m=!!(se&&P?.hasCrawlData&&P.detailsAvailable),H=m&&!f,B=se?{runId:se}:{},R=fe({...Rs({client:ie,path:{name:n},query:{...B,maxNodes:Er,maxEdges:Ar}}),enabled:H&&!Re}),Z=Yn.find(N=>N.id===T)?.healthState,Le={client:ie,path:{name:n},query:{...B,...Z?{healthState:Z}:{},limit:jr,sort:"path"}},he=En({...Is(Le),enabled:H,initialPageParam:Le,getNextPageParam:N=>N.nextCursor?{path:Le.path,query:{...Le.query,cursor:N.nextCursor}}:void 0}),Pe=H&&(P?.deadLinks.state==="complete"||P?.deadLinks.state==="partial"),de=fe({...Ms({client:ie,path:{name:n},query:{...B,limit:Sr}}),enabled:Pe}),xe=R.data?.nodes??[],Be=R.data?.layout.state==="ready"?R.data.totalEdges:null,Ee=R.data?.edges??[],nt=y.useMemo(()=>Ee.filter(N=>N.isTemplate).length,[Ee]),E=Ee.length-nt,V=R.data?.templateDetection??null,K=V===null||!Us(V),st=y.useMemo(()=>C||K?Ee:Ee.filter(N=>!N.isTemplate),[Ee,C,K]),us=R.data?.layout.state==="ready"&&!R.data.layout.templateLinksExcluded,ut=y.useMemo(()=>he.data?.pages.flatMap(N=>N.pages)??[],[he.data]),hs=he.data?.pages[0]?.total??ut.length,Yt=y.useMemo(()=>ut.find(N=>N.nodeKey===b)??null,[ut,b]),Et=!!(m&&b&&!Yt),Ie=fe({...on({client:ie,path:{name:n},query:{...B,...Z?{healthState:Z}:{},nodeKey:b??void 0,limit:1}}),enabled:Et}),it=Yt??Ie.data?.pages[0]??null,ht=!!(b&&Z&&Et&&Ie.isSuccess&&Ie.data.healthStateFilter==="applied"&&Ie.data.pages.length===0);y.useEffect(()=>{ht&&S(null)},[ht]);const Me=y.useMemo(()=>ht?null:xe.find(N=>N.nodeKey===b)??it,[xe,it,b,ht]),He=Me?.nodeKey??null,Qt=Me?it?"ready":Ie.isError?"error":Et&&Ie.isLoading?"loading":"ready":"idle",be=fe({...Os({client:ie,path:{name:n},query:{...B,nodeKey:He??void 0,limit:Qn}}),enabled:H&&!!He}),Oe=fe({...zs({client:ie,path:{name:n},query:{...B,nodeKey:He??void 0}}),enabled:H&&!!He}),ps=y.useMemo(()=>{const N=G.filter(q=>q.status==="completed"||q.status==="partial"),Q=p?G.find(q=>q.runId===p):void 0;return Q&&!N.some(q=>q.runId===Q.runId)?[Q,...N]:N},[G,p]),fs=G[0]?.status??null,pt=se?X:void 0,Fe=ce?ce.status:Ae?U.data?.status??null:oe??P?.runStatus??pt?.status??null,ms=Fe==="running"?"Scan running":Fe==="queued"?"Scan queued":Fe==="partial"?"Partial scan":Fe==="completed"?"Complete":Fe==="failed"?"Scan failed":Fe==="cancelled"?"Scan cancelled":"No scan",ft=de.data,Xt=ft&&"found"in ft?ft:P?.deadLinks&&"found"in P.deadLinks?P.deadLinks:void 0,Zt=Br(ft?.state??P?.deadLinks?.state??"unavailable",Xt?.found,Xt?.unverified),At=Pr(P?.requestedRootUrl??null,P?.rootUrl??null),Jt=Ln(P?.rootUrl??null),mt=R.data?.rootNodeKey??null,en=fe({...on({client:ie,path:{name:n},query:{...B,nodeKey:mt??void 0,limit:1}}),enabled:!!(m&&mt)}),gs=y.useMemo(()=>xe.find(N=>N.nodeKey===mt)??en.data?.pages[0]??null,[xe,mt,en.data]),gt=v.isPending||!!ce||Ae||_e,_t=Re||f&&v.isPending,xs=X?.status==="queued"||X?.status==="running",bs=to({active:f&&_t&&!!(r&&o)&&!!(xs||me===W&&Ae),runId:W,createdAt:X?.createdAt}),xt=!!(P?.hasCrawlData&&!_t&&!oe),pe=f?xt?"technical":"map":d,tn=pe==="technical"?"map":pe,ys=N=>{u(N||null),S(null)},at=()=>{u(null),S(null),t&&i?.(),v.mutate({projectName:n,projectId:e,body:{checkDeadLinks:f||k}})},ws=N=>{const Q=xe.find(q=>q.path===N||q.path.startsWith(`${N}/`));Q&&S(Q.nodeKey)},nn=N=>c(N),vs=(N,Q)=>{let q=null;N.key==="ArrowRight"||N.key==="ArrowDown"?q=(Q+1)%qe.length:N.key==="ArrowLeft"||N.key==="ArrowUp"?q=(Q-1+qe.length)%qe.length:N.key==="Home"?q=0:N.key==="End"&&(q=qe.length-1),q!=null&&(N.preventDefault(),nn(qe[q].id),l.current[q]?.focus())};return s.jsxs("div",{className:"space-y-5",children:[f?s.jsx(Fs,{current:xt?"fixes":"site"}):null,!f&&s.jsxs("header",{className:"flex flex-col justify-between gap-4 lg:flex-row lg:items-start",children:[s.jsx("div",{children:s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("h2",{className:"text-xl font-semibold tracking-tight text-heading",children:"Site Health"}),s.jsx(we,{text:Vn[pe]}),s.jsx(J,{tone:Ir(Fe),children:ms}),pt&&s.jsx("span",{className:"text-xs text-muted",children:Xn(pt.finishedAt??pt.startedAt)})]})}),s.jsxs("div",{className:"flex flex-wrap items-start gap-2",children:[s.jsxs("label",{className:"grid gap-1 text-xs text-muted",children:["Scan history",s.jsxs("select",{"aria-label":"View a Site Health scan",value:p??"",onChange:N=>ys(N.target.value),className:"h-9 min-w-48 rounded-md border border-base bg-bg px-3 text-sm text-primary outline-none focus:border-strong focus:ring-2 focus:ring-mono-600",children:[s.jsx("option",{value:"",children:"Latest scan"}),ps.map(N=>s.jsx("option",{value:N.runId,children:Mr(N)},N.runId))]})]}),!g&&s.jsxs("div",{className:"flex items-end gap-2 pt-5",children:[s.jsxs("details",{className:"group relative",children:[s.jsxs("summary",{className:"flex h-9 cursor-pointer list-none items-center gap-2 rounded-md border border-base bg-bg px-3 text-sm font-medium text-heading outline-none hover:bg-bg-elevated focus-visible:ring-2 focus-visible:ring-mono-400",children:[s.jsx(Xs,{className:"size-4","aria-hidden":"true"}),"Scan settings"]}),s.jsx("div",{className:"absolute right-0 z-20 mt-2 w-72 rounded-lg border border-strong bg-bg-elevated p-4 shadow-[0_12px_32px_var(--color-shadow-panel)]",children:s.jsxs("label",{className:"flex cursor-pointer items-start gap-3 text-sm text-heading",children:[s.jsx("input",{type:"checkbox","aria-label":"Check dead links",checked:k,disabled:gt,onChange:N=>D(N.target.checked),className:"mt-0.5 size-4 rounded border-base accent-mono-200 focus:ring-2 focus:ring-mono-400"}),s.jsxs("span",{children:[s.jsx("span",{className:"font-medium",children:"Check dead links"}),s.jsx("span",{className:"mt-1 block text-sm text-secondary",children:"Adds dead-link analysis to this scan."})]})]})})]}),s.jsxs(Rt,{onClick:at,disabled:gt,children:[gt?s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}):s.jsx(It,{className:"size-4","aria-hidden":"true"}),A?.status==="running"?"Scan running":A?.status==="queued"?"Scan queued":"Run scan"]})]})]})]}),P?.hasCrawlData&&pe!=="technical"&&s.jsxs("div",{className:"grid grid-cols-2 divide-x divide-y divide-default rounded-lg border border-default bg-surface-subtle sm:grid-cols-4 sm:divide-y-0",children:[s.jsxs("div",{className:"px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted",children:["Pages found",s.jsx(we,{text:Te("pagesFound",!1)})]}),s.jsx("div",{className:"mt-1 text-xl font-semibold tabular-nums text-heading",children:M(P.counts.pagesDiscovered)})]}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted",children:["Pages checked",s.jsx(we,{text:Te("pagesChecked",!1)})]}),s.jsx("div",{className:"mt-1 text-xl font-semibold tabular-nums text-heading",children:M(P.counts.pagesFetched)})]}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsx("div",{className:"text-xs text-muted",title:Xe("eligible"),children:"Indexable"}),s.jsx("div",{className:"mt-1 text-xl font-semibold tabular-nums text-heading",children:M(P.counts.pagesEligible)})]}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted",children:["Internal links",s.jsx(we,{text:Te("internalLinks",!1)})]}),s.jsx("div",{className:"mt-1 text-xl font-semibold tabular-nums text-heading",children:M(Be)})]})]}),f&&xt&&s.jsxs("section",{"aria-labelledby":"ai-visibility-next-heading",className:"flex flex-col gap-3 border-b border-default pb-5 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{children:[s.jsx("h2",{id:"ai-visibility-next-heading",className:"text-base font-semibold text-heading",children:"Next: Set up AI Visibility"}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"See whether answer engines mention your brand and cite your pages."})]}),s.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2",children:[s.jsx(O,{type:"button",onClick:r,children:"Set up AI Visibility"}),s.jsx(O,{type:"button",variant:"secondary",onClick:o,children:"Skip for now"})]})]}),!f&&s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-default",children:[s.jsx("div",{role:"tablist","aria-label":"Site Health views","aria-orientation":"horizontal",className:"flex min-w-0 gap-5",children:qe.map((N,Q)=>s.jsx("button",{type:"button",role:"tab",id:`site-health-${N.id}-tab`,"aria-selected":pe===N.id,"aria-controls":`site-health-${N.id}-panel`,tabIndex:pe===N.id?0:-1,ref:q=>{l.current[Q]=q},onClick:()=>nn(N.id),onKeyDown:q=>vs(q,Q),className:`min-h-11 border-b-2 px-0.5 text-sm font-medium outline-none transition-colors focus-visible:ring-2 focus-visible:ring-mono-400 disabled:cursor-not-allowed disabled:opacity-50 ${pe===N.id?"border-strong text-heading":"border-transparent text-secondary hover:border-base hover:text-primary"}`,children:N.label},N.id))}),P?.hasCrawlData&&pe!=="technical"&&s.jsxs("div",{className:"flex items-center gap-2 pb-2",children:[s.jsx("span",{className:"text-xs text-muted",children:"Dead-link check"}),s.jsx(J,{tone:Zt.tone,children:Zt.label})]})]}),!p&&A&&!ce&&s.jsx("div",{className:"rounded-lg border border-caution bg-caution-soft px-4 py-3 text-sm text-caution",role:"status",children:"A newer scan is running. The latest published result remains available until it finishes."}),At&&s.jsxs("div",{className:"rounded-lg border border-base bg-surface-subtle px-4 py-3 text-sm text-secondary",role:"status",children:[s.jsx("span",{className:"font-medium text-heading",children:"Site address changed during this scan."})," ","The scan started at ",s.jsx("span",{className:"font-mono text-primary",children:At.requested})," and continued at"," ",s.jsx("span",{className:"font-mono text-primary",children:At.effective}),"."," ",f?"Page health uses the new address.":"The map and inventory use the new address."]}),P?.hasCrawlData&&!P.complete&&s.jsx("div",{className:"rounded-lg border border-caution bg-caution-soft px-4 py-3 text-sm text-caution",role:"status",children:Fr(P.termination)}),!A&&fs==="failed"&&!p&&s.jsxs("div",{className:"flex gap-3 rounded-lg border border-negative bg-negative-soft px-4 py-3 text-sm text-negative",role:"alert",children:[s.jsx(Pt,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:"The latest scan failed. The previous completed results remain available."})]}),oe?s.jsx(Ve,{view:tn,tabbed:!f,children:s.jsx(oo,{phase:oe,progress:U.data,onRunAgain:at,pageHealthDestination:f})}):_t?s.jsx(Ve,{view:tn,tabbed:!f,children:s.jsx(so,{status:U.data?.phase??(ce?.status==="running"?"running":"queued"),progress:U.data,progressError:U.isError,onRetryProgress:()=>{U.refetch()},pageHealthDestination:f,livePageHealthPreview:re.data,livePageHealthError:re.isError,livePageHealthRunId:me,continuation:bs?s.jsx(no,{onContinueOnboarding:r,onSkipOnboarding:o}):null})}):pe==="technical"?s.jsxs("div",{id:"site-health-technical-panel",role:f?void 0:"tabpanel","aria-labelledby":f?void 0:"site-health-technical-tab",className:"min-w-0 space-y-6",children:[f?s.jsx("h2",{className:"text-xl font-semibold tracking-tight text-heading",children:"Page health"}):null,s.jsx(br,{projectName:n,projectId:e,runId:se,integrated:!0,compactCopy:f,unavailableFooter:f&&xt?s.jsx("section",{"aria-label":"Page health recovery",className:"mt-4",children:s.jsx(O,{type:"button",disabled:gt,onClick:()=>{c("map"),at()},children:"Run site audit again"})}):void 0})]}):ue.isLoading?s.jsx(Ve,{view:pe,tabbed:!f,children:s.jsxs("div",{className:"flex min-h-72 items-center justify-center gap-2 text-sm text-secondary",role:"status",children:[s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading site health..."]})}):ue.error?s.jsx(Ve,{view:pe,tabbed:!f,children:s.jsxs("section",{className:"rounded-lg border border-negative bg-negative-soft px-5 py-6",role:"alert",children:[s.jsx("h2",{className:"font-semibold text-negative",children:"Site Health could not load"}),s.jsx("p",{className:"mt-1 text-sm text-negative",children:"Try loading the crawl again."}),s.jsx(O,{variant:"secondary",size:"sm",className:"mt-4",onClick:()=>{ue.refetch()},children:"Try again"})]})}):P?.hasCrawlData?P.detailsAvailable?pe==="inventory"?s.jsxs("div",{id:"site-health-inventory-panel",role:"tabpanel","aria-labelledby":"site-health-inventory-tab",className:"space-y-5",children:[he.isLoading?s.jsxs("div",{className:"flex min-h-56 items-center justify-center gap-2 text-sm text-secondary",role:"status",children:[s.jsx(ve,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading page inventory..."]}):he.error?s.jsx("p",{className:"rounded-lg border border-negative bg-negative-soft px-4 py-3 text-sm text-negative",role:"alert",children:"The page inventory could not be loaded."}):s.jsx(Wr,{pages:ut,total:hs,filterUnavailable:he.data?.pages[0]?.healthStateFilter==="unavailable-legacy-scan",selectedNodeKey:He,onSelect:S,hasNextPage:!!he.hasNextPage,isFetchingNextPage:he.isFetchingNextPage,onLoadMore:()=>{he.fetchNextPage()},filter:T,onFilterChange:z}),s.jsx(kn,{page:Me,isLoading:be.isLoading&&!!Me,error:be.error,inbound:be.data?.inbound??[],outbound:be.data?.outbound??[],inboundTruncated:be.data?.inboundTruncated??!1,outboundTruncated:be.data?.outboundTruncated??!1,audit:Oe.data,auditLoading:Oe.isLoading&&!!Me,auditError:Oe.error,onRetryAudit:()=>{Oe.refetch()},rootHost:Jt,reasonSource:it,reasonsState:Qt,onRetryReasons:()=>{Ie.refetch()},showTemplateLinks:C||K})]}):s.jsxs("div",{id:"site-health-map-panel",role:"tabpanel","aria-labelledby":"site-health-map-tab",className:"space-y-5",children:[s.jsxs("section",{"aria-labelledby":"site-map-heading",children:[s.jsxs("div",{className:"mb-3 flex flex-col justify-between gap-2 sm:flex-row sm:items-end",children:[s.jsx("div",{children:s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("h2",{id:"site-map-heading",className:"text-base font-semibold text-heading",children:"Site map"}),s.jsx(we,{text:ns})]})}),R.data?.sampled&&s.jsxs("span",{className:"text-xs text-muted",children:["Showing ",M(R.data.nodes.length)," of ",M(R.data.totalNodes)," pages"," · ",M(R.data.edges.length)," of ",M(R.data.totalEdges)," links"]})]}),R.data?.layout.state==="ready"&&s.jsxs("div",{className:"mb-3 flex flex-col gap-1.5 rounded-lg border border-default bg-surface-subtle px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("p",{className:"flex items-center gap-1 text-sm text-secondary","data-testid":"site-map-link-counts",children:[as({filterUnavailable:K,showTemplateLinks:C,contentEdgeCount:E,templateEdgeCount:nt,totalEdgeCount:Ee.length}),s.jsx(we,{text:os(V,{staleLayout:us&&!K})})]}),s.jsxs("label",{className:Ue("flex shrink-0 items-center gap-2 text-sm",K?"cursor-not-allowed text-muted":"cursor-pointer text-heading"),title:K?ts(V):"Menu and footer links are drawn on top. Pages do not move, because the map was laid out from the links in your page text.",children:[s.jsx("input",{type:"checkbox",checked:C&&!K,disabled:K,onChange:N=>x(N.target.checked),className:"size-4 rounded border-base accent-mono-200 focus:ring-2 focus:ring-mono-400"}),"Show menu and footer links"]})]}),s.jsxs("div",{id:"site-health-map-explorer",className:"grid gap-4 lg:grid-cols-[minmax(14rem,18rem)_minmax(0,1fr)]",children:[s.jsxs("aside",{className:"rounded-lg border border-default bg-surface-subtle","aria-labelledby":"site-sections-heading",children:[s.jsxs("div",{className:"border-b border-default px-4 py-3",children:[s.jsx("h3",{id:"site-sections-heading",className:"text-sm font-semibold text-heading",children:"Site sections"}),s.jsx("p",{className:"mt-1 text-xs text-muted",children:"Folders in this scan"})]}),s.jsx("div",{className:"max-h-[468px] overflow-auto",children:se&&s.jsx(ls,{projectName:n,runId:se,parentPath:"/",onSelect:ws,rootPage:gs,onSelectRootPage:S})})]}),s.jsx("div",{className:"min-w-0",children:R.isLoading?s.jsx(Yr,{}):R.error?s.jsx("div",{className:"flex min-h-[420px] items-center justify-center rounded-lg border border-negative bg-negative-soft px-6 text-center lg:min-h-[520px]",role:"alert",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-negative",children:"The interactive map could not be loaded."}),s.jsx("p",{className:"mt-1 text-sm text-secondary",children:"The page inventory and technical findings remain available."}),s.jsx(O,{variant:"secondary",size:"sm",className:"mt-4",onClick:()=>c("inventory"),children:"Open page inventory"})]})}):s.jsx(Ja,{nodes:R.data?.nodes??[],edges:Ee,showTemplateLinks:C||K,layoutState:R.data?.layout.state??"unavailable",layoutUnavailableReason:R.data?.layout.state==="unavailable"?R.data.layout.reason:null,rootNodeKey:R.data?.rootNodeKey??null,selectedNodeKey:He,onSelectNode:N=>S(N.nodeKey),onOpenInventory:()=>c("inventory"),ariaLabel:`Interactive site map showing ${M(R.data?.nodes.length??0)} pages and ${M(st.length)} internal links`})})]})]}),s.jsx(kn,{page:Me,isLoading:be.isLoading&&!!Me,error:be.error,inbound:be.data?.inbound??[],outbound:be.data?.outbound??[],inboundTruncated:be.data?.inboundTruncated??!1,outboundTruncated:be.data?.outboundTruncated??!1,audit:Oe.data,auditLoading:Oe.isLoading&&!!Me,auditError:Oe.error,onRetryAudit:()=>{Oe.refetch()},rootHost:Jt,reasonSource:it,reasonsState:Qt,onRetryReasons:()=>{Ie.refetch()},showTemplateLinks:C||K})]}):s.jsx(Ve,{view:pe,tabbed:!f,children:s.jsxs("section",{className:"rounded-lg border border-caution bg-caution-soft px-5 py-6",children:[s.jsx("h2",{className:"font-semibold text-caution",children:f?"Page health results unavailable":"Page details unavailable"}),s.jsx("p",{className:"mt-1 text-sm text-caution",children:f?"This scan did not publish page-level results. Run it again to continue setup.":"Summary metrics are preserved for this scan, but its page graph cannot be opened."}),f?s.jsx(O,{type:"button",size:"sm",className:"mt-4",onClick:at,children:"Run scan again"}):null]})}):s.jsx(Ve,{view:pe,tabbed:!f,children:s.jsxs("section",{className:"rounded-lg border border-default bg-surface-subtle px-5 py-8 text-center",children:[s.jsx("h2",{className:"text-base font-semibold text-heading",children:f?"Page health results unavailable":"Full-site map not available"}),s.jsx("p",{className:"mx-auto mt-2 max-w-xl text-sm text-secondary",children:f?"This scan did not produce page health results. Run it again to continue setup.":P?.legacyAuditAvailable?"Existing page health results are preserved. Run a new scan to build the page and internal-link map.":g?"A full-site scan has not been run for this project.":"Run a scan to discover pages, site sections, and internal links."}),(P?.legacyAuditAvailable||f)&&s.jsxs("div",{className:"mt-4 flex flex-wrap justify-center gap-2",children:[P?.legacyAuditAvailable&&!f&&s.jsx(O,{variant:"secondary",size:"sm",onClick:()=>c("technical"),children:"View page health"}),f&&s.jsx(O,{type:"button",size:"sm",onClick:at,children:"Run scan again"})]})]})})]})}const go=Object.freeze(Object.defineProperty({__proto__:null,LivePageHealthFindings:cs,PAGE_INTERNAL_LINKS_HELP:ss,SITE_HEALTH_VIEW_DESCRIPTIONS:Vn,SITE_MAP_HELP:ns,SITE_MAP_LINK_SPLIT_COPY:rs,SITE_MAP_STALE_LAYOUT_COPY:is,SiteHealthSection:lo,TEMPLATE_DETECTION_COPY:Vt,emptyLinkCopy:ds,linkTileCount:Ft,siteHealthMetricHelp:Te,siteMapLinkCountsLabel:as,siteMapLinkRuleHelp:os},Symbol.toStringTag,{value:"Module"}));export{cr as D,F as G,dr as M,lo as S,ur as a,rr as b,qn as c,go as d,fi as e,lr as u};
|