sanity-plugin-seo-copilot 0.2.13 → 0.2.14

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/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { definePlugin } from "sanity";
5
5
  import { createElement } from "react";
6
6
 
7
7
  // src/components/SEOCopilotPanel.tsx
8
- import { useState as useState16, useRef as useRef11, useCallback as useCallback5, useEffect as useEffect11, useMemo as useMemo5, Suspense } from "react";
8
+ import { useState as useState17, useRef as useRef12, useCallback as useCallback5, useEffect as useEffect12, useMemo as useMemo5, Suspense } from "react";
9
9
  import { useWorkspace } from "sanity";
10
10
  import { createPortal } from "react-dom";
11
11
 
@@ -50,30 +50,83 @@ function extractHeadingsDetailed(blocks) {
50
50
  }
51
51
  return out;
52
52
  }
53
- function extractBodyLinks(blocks) {
54
- const urls = /* @__PURE__ */ new Set();
53
+ function normalizeLink(raw) {
54
+ const s = raw.trim().replace(/[.,;:!?]+$/, "");
55
+ if (!s) return null;
56
+ if (/^https?:\/\//i.test(s)) return s;
57
+ if (/^www\.\S+\.\S+/i.test(s) || /^[a-z0-9-]+(\.[a-z0-9-]+)+(\/|$)/i.test(s)) return `https://${s}`;
58
+ return null;
59
+ }
60
+ var UNSTYLED_HEADING_SCAN_CAP = 600;
61
+ function extractUnstyledHeadings(blocks) {
62
+ if (!Array.isArray(blocks)) return [];
63
+ const items = blocks.slice(0, UNSTYLED_HEADING_SCAN_CAP).map((b) => {
64
+ if (!b || b._type !== "block") return null;
65
+ const style = b.style || "normal";
66
+ const text = (b.children || []).map((c) => c.text || "").join("").trim();
67
+ return {
68
+ isHeading: /^h[1-6]$/.test(style),
69
+ isPlain: style === "normal",
70
+ isList: typeof b.listItem === "string" && b.listItem.length > 0,
71
+ text,
72
+ words: text ? text.split(/\s+/).filter(Boolean).length : 0
73
+ };
74
+ });
75
+ const out = [];
76
+ for (let i = 0; i < items.length; i++) {
77
+ const it = items[i];
78
+ if (!it || it.isHeading || it.isList || !it.isPlain) continue;
79
+ if (it.words < 2 || it.words > 9) continue;
80
+ if (/[.!?]$/.test(it.text)) continue;
81
+ if (!/[A-Za-z]/.test(it.text)) continue;
82
+ if (/https?:\/\/|doi:|\baccessed\b|image credit|stock\.adobe|^figure\b|^table\b|^source[:s]?\b|^references?\b/i.test(it.text)) continue;
83
+ let next = null;
84
+ for (let j = i + 1; j < items.length; j++) {
85
+ if (items[j] && items[j].text) {
86
+ next = items[j];
87
+ break;
88
+ }
89
+ }
90
+ if (!next || next.isHeading || next.words < 12) continue;
91
+ out.push(it.text);
92
+ if (out.length >= 8) break;
93
+ }
94
+ return out;
95
+ }
96
+ function extractBodyLinksDetailed(blocks) {
97
+ const linked = /* @__PURE__ */ new Set();
98
+ const all = /* @__PURE__ */ new Set();
99
+ const anchorByUrl = /* @__PURE__ */ new Map();
55
100
  if (Array.isArray(blocks)) {
56
101
  for (const block of blocks) {
57
102
  if (block._type === "block" && Array.isArray(block.markDefs)) {
58
103
  for (const md of block.markDefs) {
59
104
  const href = md.href || md.url;
60
- if (typeof href === "string" && /^https?:\/\//i.test(href)) {
61
- urls.add(href.trim());
62
- }
105
+ if (typeof href !== "string") continue;
106
+ const n = normalizeLink(href);
107
+ if (!n) continue;
108
+ linked.add(n);
109
+ all.add(n);
110
+ const anchor = (block.children || []).filter((c) => Array.isArray(c.marks) && md._key && c.marks.includes(md._key)).map((c) => c.text || "").join("").trim();
111
+ if (anchor && !anchorByUrl.has(n)) anchorByUrl.set(n, anchor);
63
112
  }
64
113
  }
65
114
  }
66
- }
67
- if (Array.isArray(blocks)) {
68
115
  for (const block of blocks) {
69
116
  if (block._type === "block" && Array.isArray(block.children)) {
70
117
  const blockText = block.children.map((c) => c.text || "").join(" ");
71
- const matches = blockText.match(/https?:\/\/[^\s"'<>)\]]+/g);
72
- if (matches) matches.forEach((u) => urls.add(u.replace(/[.,;:!?]+$/, "")));
118
+ const matches = blockText.match(/(?:https?:\/\/|www\.)[^\s"'<>)\]]+/gi);
119
+ if (matches) for (const u of matches) {
120
+ const n = normalizeLink(u);
121
+ if (n) all.add(n);
122
+ }
73
123
  }
74
124
  }
75
125
  }
76
- return Array.from(urls);
126
+ return [...all].map((url) => ({ url, hyperlinked: linked.has(url), anchorText: anchorByUrl.get(url) }));
127
+ }
128
+ function extractBodyLinks(blocks) {
129
+ return extractBodyLinksDetailed(blocks).map((l) => l.url);
77
130
  }
78
131
  function detectSlug(val) {
79
132
  if (!val) return void 0;
@@ -148,6 +201,86 @@ function detectAuthor(val) {
148
201
  }
149
202
  return { authorIsReference: false };
150
203
  }
204
+ var FACT_CHECK_STATUS_WORDS = /* @__PURE__ */ new Set([
205
+ "pending",
206
+ "approved",
207
+ "rejected",
208
+ "done",
209
+ "complete",
210
+ "completed",
211
+ "in review",
212
+ "in progress",
213
+ "not started",
214
+ "draft",
215
+ "review",
216
+ "reviewed",
217
+ "unreviewed",
218
+ "checked",
219
+ "unchecked",
220
+ "verified",
221
+ "unverified",
222
+ "true",
223
+ "false",
224
+ "yes",
225
+ "no",
226
+ "n/a",
227
+ "na",
228
+ "none",
229
+ "tbd",
230
+ "todo",
231
+ "to do"
232
+ ]);
233
+ function isLikelyPersonName(s) {
234
+ const t = s.trim().toLowerCase();
235
+ if (!t || FACT_CHECK_STATUS_WORDS.has(t)) return false;
236
+ return /[a-z]/i.test(s);
237
+ }
238
+ function detectFactChecker(val) {
239
+ if (!val) return { factCheckerIsReference: false };
240
+ const candidateFields = [
241
+ "factChecker",
242
+ "factCheckers",
243
+ "factCheckedBy",
244
+ "reviewer",
245
+ "reviewers",
246
+ "reviewedBy",
247
+ "medicalReviewer",
248
+ "medicallyReviewedBy"
249
+ ];
250
+ const dynamic = Object.keys(val).filter(
251
+ (k) => (
252
+ // Require "checker"/"checked by"/"reviewer"/"reviewed by" - NOT a bare "check" flag.
253
+ /factchecker|fact.?checked.?by|reviewer|reviewed.?by/i.test(k) && // never date/timestamp fields (lastReviewedAt, medicallyReviewedAt, reviewedDate),
254
+ // free-text/status/flag sidecars (reviewerNotes, reviewStatus), nor image/url/id fields.
255
+ !/at$|date$|on$|url|link|count|note|comment|status|flag|bool|photo|image|avatar|picture|id$/i.test(k)
256
+ )
257
+ );
258
+ const fields = Array.from(/* @__PURE__ */ new Set([...candidateFields, ...dynamic]));
259
+ for (const f of fields) {
260
+ const raw = val[f];
261
+ if (!raw) continue;
262
+ if (Array.isArray(raw)) {
263
+ const names = raw.filter((x) => typeof x === "string" && isLikelyPersonName(x)).map((x) => x.trim());
264
+ if (names.length > 0) return { factCheckerName: names.slice(0, 3).join(", "), factCheckerIsReference: false };
265
+ }
266
+ const first = Array.isArray(raw) ? raw[0] : raw;
267
+ if (!first) continue;
268
+ if (typeof first === "string") {
269
+ const trimmed = first.trim();
270
+ if (trimmed && isLikelyPersonName(trimmed)) return { factCheckerName: trimmed, factCheckerIsReference: false };
271
+ continue;
272
+ }
273
+ if (typeof first === "object" && first !== null) {
274
+ const o = first;
275
+ const name = [o.name, o.fullName, o.displayName].find((v) => typeof v === "string" && isLikelyPersonName(v));
276
+ if (name) return { factCheckerName: name, factCheckerIsReference: false };
277
+ if (typeof o._ref === "string" || o._type === "reference") {
278
+ return { factCheckerIsReference: true };
279
+ }
280
+ }
281
+ }
282
+ return { factCheckerIsReference: false };
283
+ }
151
284
  function extractImageMeta(value) {
152
285
  const names = [];
153
286
  const titles = [];
@@ -186,6 +319,7 @@ function buildDocumentFields(value) {
186
319
  const title = typeof val?.title === "string" ? val.title : void 0;
187
320
  const body = val?.body;
188
321
  const { authorName, authorCredentials, authorBioUrl, authorIsReference } = detectAuthor(val);
322
+ const { factCheckerName, factCheckerIsReference } = detectFactChecker(val);
189
323
  const imageMeta = val ? extractImageMeta(val) : { names: [], titles: [], count: 0 };
190
324
  return {
191
325
  title: title || void 0,
@@ -197,13 +331,17 @@ function buildDocumentFields(value) {
197
331
  imageCount: imageMeta.count,
198
332
  headings: extractHeadings(body),
199
333
  headingsDetailed: extractHeadingsDetailed(body),
334
+ unstyledHeadings: extractUnstyledHeadings(body),
200
335
  bodyLinks: extractBodyLinks(body),
336
+ bodyLinksDetailed: extractBodyLinksDetailed(body),
201
337
  contentCategory: typeof val?.contentCategory === "string" ? val.contentCategory : typeof val?.category === "string" ? val.category : void 0,
202
338
  contentPlacement: Array.isArray(val?.contentPlacement) ? val.contentPlacement : void 0,
203
339
  authorName,
204
340
  authorCredentials,
205
341
  authorBioUrl,
206
342
  authorIsReference,
343
+ factCheckerName,
344
+ factCheckerIsReference,
207
345
  // `published` is MJH's date field; `publishedAt`/`publishDate` cover other schemas
208
346
  publishedAt: [val?.publishedAt, val?.publishDate, val?.published, val?._createdAt].find((v) => typeof v === "string" && v.trim().length > 0),
209
347
  // `updatedOn` is MJH's "Updated On" field. `updatedAt` is the standard Sanity convention.
@@ -298,11 +436,12 @@ async function fetchChatStream(apiUrl, messages, documentContext, publication, k
298
436
  return response.body;
299
437
  }
300
438
  async function submitFeedback(apiUrl, data) {
301
- await fetch(`${apiUrl}/api/seo-copilot/feedback`, {
439
+ const res = await fetch(`${apiUrl}/api/seo-copilot/feedback`, {
302
440
  method: "POST",
303
441
  headers: { "Content-Type": "application/json" },
304
442
  body: JSON.stringify(data)
305
443
  });
444
+ if (!res.ok) throw new Error(`Feedback submit failed: HTTP ${res.status}`);
306
445
  }
307
446
  async function lookupKeywords(apiUrl, keywords, signal) {
308
447
  const response = await fetch(`${apiUrl}/api/seo-copilot/keywords`, {
@@ -3119,12 +3258,219 @@ function OnboardingCard({ onDismiss, closing }) {
3119
3258
  ] });
3120
3259
  }
3121
3260
 
3261
+ // src/components/ReportProblemButton.tsx
3262
+ import { useState as useState11, useRef as useRef10, useEffect as useEffect9 } from "react";
3263
+ import { useCurrentUser as useCurrentUser3 } from "sanity";
3264
+ import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
3265
+ function ReportProblemButton({ activeTab, publication, documentId, documentType, primaryKeyword }) {
3266
+ const { apiUrl } = useConfig();
3267
+ const sanityUser = useCurrentUser3();
3268
+ const [open, setOpen] = useState11(false);
3269
+ const [text, setText] = useState11("");
3270
+ const [submitting, setSubmitting] = useState11(false);
3271
+ const [submitted, setSubmitted] = useState11(false);
3272
+ const [failed, setFailed] = useState11(false);
3273
+ const popRef = useRef10(null);
3274
+ const textareaRef = useRef10(null);
3275
+ const closeTimer = useRef10(null);
3276
+ const mounted = useRef10(true);
3277
+ useEffect9(() => () => {
3278
+ mounted.current = false;
3279
+ if (closeTimer.current) clearTimeout(closeTimer.current);
3280
+ }, []);
3281
+ useEffect9(() => {
3282
+ if (!open) return;
3283
+ const handler = (e) => {
3284
+ if (popRef.current && !popRef.current.contains(e.target)) setOpen(false);
3285
+ };
3286
+ document.addEventListener("mousedown", handler);
3287
+ return () => document.removeEventListener("mousedown", handler);
3288
+ }, [open]);
3289
+ useEffect9(() => {
3290
+ if (open) setTimeout(() => textareaRef.current?.focus(), 50);
3291
+ }, [open]);
3292
+ const handleSubmit = async () => {
3293
+ const trimmed = text.trim();
3294
+ if (!trimmed || submitting) return;
3295
+ setFailed(false);
3296
+ setSubmitting(true);
3297
+ try {
3298
+ await submitFeedback(apiUrl, {
3299
+ suggestion_type: "bug_report",
3300
+ suggestion_text: trimmed.slice(0, 1e4),
3301
+ vote: "down",
3302
+ document_id: documentId,
3303
+ publication,
3304
+ user_id: sanityUser?.id,
3305
+ context: {
3306
+ surface: "sanity-plugin",
3307
+ activeTab,
3308
+ primaryKeyword: primaryKeyword || void 0,
3309
+ documentType,
3310
+ url: typeof window !== "undefined" && /^https?:\/\//i.test(window.location.href) ? window.location.href.slice(0, 500) : void 0,
3311
+ userAgent: typeof navigator !== "undefined" ? navigator.userAgent.slice(0, 500) : void 0,
3312
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
3313
+ }
3314
+ });
3315
+ } catch (e) {
3316
+ console.error("[SEO Copilot] failed to send problem report:", e);
3317
+ if (mounted.current) {
3318
+ setSubmitting(false);
3319
+ setFailed(true);
3320
+ }
3321
+ return;
3322
+ }
3323
+ if (!mounted.current) return;
3324
+ setSubmitting(false);
3325
+ setSubmitted(true);
3326
+ closeTimer.current = setTimeout(() => {
3327
+ if (!mounted.current) return;
3328
+ setOpen(false);
3329
+ setSubmitted(false);
3330
+ setText("");
3331
+ }, 1500);
3332
+ };
3333
+ return /* @__PURE__ */ jsxs8("div", { style: { position: "relative", display: "flex" }, children: [
3334
+ /* @__PURE__ */ jsxs8(
3335
+ "button",
3336
+ {
3337
+ type: "button",
3338
+ onClick: (e) => {
3339
+ e.stopPropagation();
3340
+ if (closeTimer.current) {
3341
+ clearTimeout(closeTimer.current);
3342
+ closeTimer.current = null;
3343
+ }
3344
+ setOpen((o) => !o);
3345
+ },
3346
+ onMouseDown: (e) => e.stopPropagation(),
3347
+ "aria-label": "Report a problem",
3348
+ title: "Report a problem",
3349
+ style: {
3350
+ display: "inline-flex",
3351
+ alignItems: "center",
3352
+ gap: 4,
3353
+ padding: "3px 8px",
3354
+ borderRadius: 99,
3355
+ border: `1px solid ${open ? MJH_BLUE : "#d1d5db"}`,
3356
+ background: open ? "rgba(0,93,172,0.08)" : "rgba(255,255,255,0.6)",
3357
+ cursor: "pointer",
3358
+ fontSize: 10,
3359
+ fontWeight: 600,
3360
+ color: open ? MJH_BLUE : "#6b7280",
3361
+ whiteSpace: "nowrap",
3362
+ transition: "all 150ms"
3363
+ },
3364
+ children: [
3365
+ /* @__PURE__ */ jsx9("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx9("path", { d: "M3 2.75a.75.75 0 00-1.5 0v14.5a.75.75 0 001.5 0v-4.392l1.657-.348a6.449 6.449 0 014.271.572 7.948 7.948 0 005.965.524l2.078-.64A.75.75 0 0017.5 12.25v-8.5a.75.75 0 00-.904-.734l-1.74.348a7.948 7.948 0 01-5.965-.524 6.449 6.449 0 00-4.271-.572L3 2.842V2.75z" }) }),
3366
+ "Report a problem"
3367
+ ]
3368
+ }
3369
+ ),
3370
+ open && /* @__PURE__ */ jsx9(
3371
+ "div",
3372
+ {
3373
+ ref: popRef,
3374
+ onMouseDown: (e) => e.stopPropagation(),
3375
+ style: {
3376
+ position: "absolute",
3377
+ top: "100%",
3378
+ right: 0,
3379
+ marginTop: 6,
3380
+ width: 260,
3381
+ padding: 12,
3382
+ borderRadius: 10,
3383
+ background: "#ffffff",
3384
+ boxShadow: "0 6px 22px rgba(0,0,0,0.16), 0 1px 4px rgba(0,0,0,0.1)",
3385
+ border: "1px solid #e5e7eb",
3386
+ zIndex: 100
3387
+ },
3388
+ children: submitted ? /* @__PURE__ */ jsx9("div", { style: { fontSize: 12, color: "#16a34a", textAlign: "center", padding: "6px 0", fontWeight: 600 }, children: "Thanks - we got it." }) : /* @__PURE__ */ jsxs8(Fragment5, { children: [
3389
+ /* @__PURE__ */ jsx9("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 3 }, children: "Report a problem" }),
3390
+ /* @__PURE__ */ jsx9("div", { style: { fontSize: 10.5, color: "#6b7280", marginBottom: 8, lineHeight: 1.45 }, children: "Beta - tell us what went wrong. We also note which tab you're on to help us track it down." }),
3391
+ failed && /* @__PURE__ */ jsx9("div", { style: { fontSize: 10.5, color: "#dc2626", marginBottom: 8, lineHeight: 1.45, fontWeight: 600 }, children: "Couldn't send - please try again." }),
3392
+ /* @__PURE__ */ jsx9(
3393
+ "textarea",
3394
+ {
3395
+ ref: textareaRef,
3396
+ value: text,
3397
+ onChange: (e) => setText(e.target.value),
3398
+ onKeyDown: (e) => {
3399
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
3400
+ e.preventDefault();
3401
+ handleSubmit();
3402
+ }
3403
+ },
3404
+ placeholder: "What happened? The more detail, the better.",
3405
+ rows: 4,
3406
+ maxLength: 4e3,
3407
+ style: {
3408
+ width: "100%",
3409
+ padding: "6px 8px",
3410
+ fontSize: 11,
3411
+ borderRadius: 6,
3412
+ border: "1px solid #e5e7eb",
3413
+ outline: "none",
3414
+ fontFamily: "inherit",
3415
+ resize: "vertical",
3416
+ boxSizing: "border-box",
3417
+ lineHeight: 1.5
3418
+ }
3419
+ }
3420
+ ),
3421
+ /* @__PURE__ */ jsxs8("div", { style: { display: "flex", justifyContent: "flex-end", marginTop: 8, gap: 6 }, children: [
3422
+ /* @__PURE__ */ jsx9(
3423
+ "button",
3424
+ {
3425
+ type: "button",
3426
+ onClick: () => {
3427
+ setOpen(false);
3428
+ setText("");
3429
+ },
3430
+ style: {
3431
+ padding: "4px 10px",
3432
+ fontSize: 10.5,
3433
+ borderRadius: 5,
3434
+ border: "1px solid #e5e7eb",
3435
+ background: "#ffffff",
3436
+ color: "#4b5563",
3437
+ cursor: "pointer"
3438
+ },
3439
+ children: "Cancel"
3440
+ }
3441
+ ),
3442
+ /* @__PURE__ */ jsx9(
3443
+ "button",
3444
+ {
3445
+ type: "button",
3446
+ onClick: handleSubmit,
3447
+ disabled: !text.trim() || submitting,
3448
+ style: {
3449
+ padding: "4px 12px",
3450
+ fontSize: 10.5,
3451
+ borderRadius: 5,
3452
+ border: "none",
3453
+ background: !text.trim() || submitting ? "#cbd5e1" : MJH_BLUE,
3454
+ color: "#ffffff",
3455
+ cursor: !text.trim() || submitting ? "default" : "pointer",
3456
+ fontWeight: 700
3457
+ },
3458
+ children: submitting ? "Sending..." : "Send"
3459
+ }
3460
+ )
3461
+ ] })
3462
+ ] })
3463
+ }
3464
+ )
3465
+ ] });
3466
+ }
3467
+
3122
3468
  // src/components/tabs/SummaryTab.tsx
3123
- import { useMemo, useState as useState12 } from "react";
3469
+ import { useMemo, useState as useState13 } from "react";
3124
3470
 
3125
3471
  // src/components/ShimmerLoader.tsx
3126
- import { useEffect as useEffect9, useState as useState11 } from "react";
3127
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
3472
+ import { useEffect as useEffect10, useState as useState12 } from "react";
3473
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
3128
3474
  var keyframesInjected = false;
3129
3475
  var KEYFRAMES = `
3130
3476
  @keyframes seo-copilot-text-shimmer {
@@ -3133,13 +3479,13 @@ var KEYFRAMES = `
3133
3479
  }
3134
3480
  `;
3135
3481
  function LoaderBars({ color = MJH_GOLD }) {
3136
- return /* @__PURE__ */ jsx9(
3482
+ return /* @__PURE__ */ jsx10(
3137
3483
  "div",
3138
3484
  {
3139
3485
  role: "status",
3140
3486
  "aria-label": "Loading",
3141
3487
  style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: 14, flexShrink: 0 },
3142
- children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx9(
3488
+ children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx10(
3143
3489
  "div",
3144
3490
  {
3145
3491
  style: {
@@ -3161,8 +3507,8 @@ function ShimmerLoader({
3161
3507
  textSize = 14,
3162
3508
  iconColor = MJH_GOLD
3163
3509
  }) {
3164
- const [idx, setIdx] = useState11(0);
3165
- useEffect9(() => {
3510
+ const [idx, setIdx] = useState12(0);
3511
+ useEffect10(() => {
3166
3512
  if (typeof window !== "undefined" && !keyframesInjected) {
3167
3513
  keyframesInjected = true;
3168
3514
  const style = document.createElement("style");
@@ -3171,7 +3517,7 @@ function ShimmerLoader({
3171
3517
  document.head.appendChild(style);
3172
3518
  }
3173
3519
  }, []);
3174
- useEffect9(() => {
3520
+ useEffect10(() => {
3175
3521
  if (messages.length <= 1) return;
3176
3522
  const id = setInterval(() => {
3177
3523
  setIdx((i) => (i + 1) % messages.length);
@@ -3179,7 +3525,7 @@ function ShimmerLoader({
3179
3525
  return () => clearInterval(id);
3180
3526
  }, [messages.length, intervalMs]);
3181
3527
  const text = messages[idx] || messages[0] || "";
3182
- return /* @__PURE__ */ jsxs8(
3528
+ return /* @__PURE__ */ jsxs9(
3183
3529
  "div",
3184
3530
  {
3185
3531
  style: {
@@ -3191,8 +3537,8 @@ function ShimmerLoader({
3191
3537
  letterSpacing: "0.01em"
3192
3538
  },
3193
3539
  children: [
3194
- /* @__PURE__ */ jsx9(LoaderBars, { color: iconColor }),
3195
- /* @__PURE__ */ jsx9(
3540
+ /* @__PURE__ */ jsx10(LoaderBars, { color: iconColor }),
3541
+ /* @__PURE__ */ jsx10(
3196
3542
  "span",
3197
3543
  {
3198
3544
  style: {
@@ -3270,9 +3616,9 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
3270
3616
  detail = `Primary keyword over-used at ${density.toFixed(2)}% density - reduce to 0.5-2.5%`;
3271
3617
  }
3272
3618
  }
3273
- components.push({ label: "Primary keyword", points: pts, max: 25, detail });
3619
+ components.push({ label: "Primary keyword usage", points: pts, max: 25, detail });
3274
3620
  } else {
3275
- components.push({ label: "Primary keyword", points: 0, max: 25, detail: "No primary keyword identified yet" });
3621
+ components.push({ label: "Primary keyword usage", points: 0, max: 25, detail: "No primary keyword identified yet" });
3276
3622
  }
3277
3623
  const supportingKws = analysis.supportingKeywords || [];
3278
3624
  if (supportingKws.length > 0) {
@@ -3280,13 +3626,13 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
3280
3626
  const coverageRatio = inContentCount / supportingKws.length;
3281
3627
  const pts = Math.round(coverageRatio * 25);
3282
3628
  components.push({
3283
- label: "Supporting keywords",
3629
+ label: "Supporting keyword coverage",
3284
3630
  points: pts,
3285
3631
  max: 25,
3286
3632
  detail: `${inContentCount} of ${supportingKws.length} supporting keywords present (${Math.round(coverageRatio * 100)}%)`
3287
3633
  });
3288
3634
  } else {
3289
- components.push({ label: "Supporting keywords", points: 0, max: 25, detail: "No supporting keywords yet" });
3635
+ components.push({ label: "Supporting keyword coverage", points: 0, max: 25, detail: "No supporting keywords yet" });
3290
3636
  }
3291
3637
  let wcPts = 0;
3292
3638
  let wcDetail;
@@ -3596,18 +3942,6 @@ function buildSummaryItems(input) {
3596
3942
  });
3597
3943
  }
3598
3944
  if (headingsDetailed) {
3599
- const bodyH1 = headingsDetailed.filter((h) => h.level === 1).length;
3600
- if (bodyH1 > 0) {
3601
- items.push({
3602
- id: "headings-h1-in-body",
3603
- category: "headings",
3604
- severity: "warning",
3605
- label: "H1 inside the body",
3606
- description: `${bodyH1} H1 heading${bodyH1 === 1 ? "" : "s"} in the body of the article.`,
3607
- howToFix: "The article title is your H1. Body headings should start at H2 so the outline isn't ambiguous.",
3608
- jumpTo: { tab: "technical", anchorId: "anchor-headings-structure" }
3609
- });
3610
- }
3611
3945
  let prevLevel = 0;
3612
3946
  let skips = 0;
3613
3947
  for (const h of headingsDetailed) {
@@ -3637,6 +3971,23 @@ function buildSummaryItems(input) {
3637
3971
  jumpTo: { tab: "technical", anchorId: "anchor-headings-structure" }
3638
3972
  });
3639
3973
  }
3974
+ const subheads = headingsDetailed.filter((h) => h.level >= 2);
3975
+ if (subheads.length > 0 && (primaryKeyword || secondaryKeyword)) {
3976
+ const subText = subheads.map((h) => h.text).join(" ");
3977
+ const hasP = primaryKeyword ? containsKeywordTokens(subText, primaryKeyword) : false;
3978
+ const hasS = secondaryKeyword ? containsKeywordTokens(subText, secondaryKeyword) : false;
3979
+ if (!hasP && !hasS) {
3980
+ items.push({
3981
+ id: "headings-keyword-missing",
3982
+ category: "headings",
3983
+ severity: "opportunity",
3984
+ label: "Keyword missing from subheadings",
3985
+ description: "No H2/H3 subheading uses your primary or secondary keyword.",
3986
+ howToFix: "Work your primary or secondary keyword into at least one subheading - keywords in headers reinforce relevance for readers and search.",
3987
+ jumpTo: { tab: "technical", anchorId: "anchor-headings-keyword" }
3988
+ });
3989
+ }
3990
+ }
3640
3991
  }
3641
3992
  const images = documentFields?.imageNames || [];
3642
3993
  if (images.length === 0 && wordCount2 > 300) {
@@ -3889,7 +4240,7 @@ function buildSummaryItems(input) {
3889
4240
  }
3890
4241
 
3891
4242
  // src/components/tabs/SummaryTab.tsx
3892
- import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
4243
+ import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
3893
4244
  var cardStyle2 = {
3894
4245
  borderRadius: 14,
3895
4246
  background: "rgba(255,255,255,0.55)",
@@ -3911,11 +4262,16 @@ function scoreColors(score) {
3911
4262
  if (score >= 40) return { bg: "rgba(230,192,27,0.15)", text: "#8B7310", label: "Decent" };
3912
4263
  return { bg: "rgba(220,38,38,0.08)", text: "#dc2626", label: "Needs work" };
3913
4264
  }
4265
+ function componentTier(pct) {
4266
+ if (pct >= 75) return { label: "Strong", color: "#16a34a", bar: "#16a34a" };
4267
+ if (pct >= 40) return { label: "OK", color: "#8B7310", bar: "#E6C01B" };
4268
+ return { label: "Low", color: "#dc2626", bar: "#dc2626" };
4269
+ }
3914
4270
  function ScoreBadge({ score, breakdown }) {
3915
4271
  const c = scoreColors(score);
3916
- return /* @__PURE__ */ jsxs9("div", { style: cardStyle2, children: [
3917
- /* @__PURE__ */ jsxs9("div", { style: { display: "flex", alignItems: "center", gap: 14 }, children: [
3918
- /* @__PURE__ */ jsxs9(
4272
+ return /* @__PURE__ */ jsxs10("div", { style: cardStyle2, children: [
4273
+ /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 14 }, children: [
4274
+ /* @__PURE__ */ jsx11(
3919
4275
  "div",
3920
4276
  {
3921
4277
  style: {
@@ -3924,37 +4280,28 @@ function ScoreBadge({ score, breakdown }) {
3924
4280
  borderRadius: "50%",
3925
4281
  background: c.bg,
3926
4282
  display: "flex",
3927
- flexDirection: "column",
3928
4283
  alignItems: "center",
3929
4284
  justifyContent: "center",
3930
- flexShrink: 0,
3931
- lineHeight: 1
4285
+ flexShrink: 0
3932
4286
  },
3933
- children: [
3934
- /* @__PURE__ */ jsx10("span", { style: { fontSize: 20, fontWeight: 700, color: c.text }, children: score }),
3935
- /* @__PURE__ */ jsx10("span", { style: { fontSize: 8, fontWeight: 700, color: c.text, opacity: 0.7, letterSpacing: "0.06em", marginTop: 2 }, children: "/ 100" })
3936
- ]
4287
+ children: /* @__PURE__ */ jsx11("div", { style: { width: 22, height: 22, borderRadius: "50%", background: c.text, opacity: 0.9 } })
3937
4288
  }
3938
4289
  ),
3939
- /* @__PURE__ */ jsxs9("div", { style: { flex: 1, minWidth: 0 }, children: [
3940
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, marginBottom: 2 }, children: "Content Score" }),
3941
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 14, fontWeight: 700, color: c.text }, children: c.label })
4290
+ /* @__PURE__ */ jsxs10("div", { style: { flex: 1, minWidth: 0 }, children: [
4291
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, marginBottom: 2 }, children: "Content Score" }),
4292
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 16, fontWeight: 700, color: c.text }, children: c.label })
3942
4293
  ] })
3943
4294
  ] }),
3944
- breakdown.length > 0 && /* @__PURE__ */ jsx10("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 8 }, children: breakdown.map((comp, i) => {
4295
+ breakdown.length > 0 && /* @__PURE__ */ jsx11("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 8 }, children: breakdown.map((comp, i) => {
3945
4296
  const pct = comp.max > 0 ? comp.points / comp.max * 100 : 0;
3946
- const barColor = pct >= 75 ? "#16a34a" : pct >= 40 ? "#E6C01B" : "#dc2626";
3947
- return /* @__PURE__ */ jsxs9("div", { children: [
3948
- /* @__PURE__ */ jsxs9("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 3 }, children: [
3949
- /* @__PURE__ */ jsx10("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: comp.label }),
3950
- /* @__PURE__ */ jsxs9("span", { style: { fontSize: 11, color: "#4b5563", fontVariantNumeric: "tabular-nums" }, children: [
3951
- comp.points,
3952
- " / ",
3953
- comp.max
3954
- ] })
4297
+ const tier = componentTier(pct);
4298
+ return /* @__PURE__ */ jsxs10("div", { children: [
4299
+ /* @__PURE__ */ jsxs10("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 3 }, children: [
4300
+ /* @__PURE__ */ jsx11("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: comp.label }),
4301
+ /* @__PURE__ */ jsx11("span", { style: { fontSize: 9.5, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.04em", color: tier.color }, children: tier.label })
3955
4302
  ] }),
3956
- /* @__PURE__ */ jsx10("div", { style: { height: 4, background: "#f1f5f9", borderRadius: 99, overflow: "hidden", marginBottom: 4 }, children: /* @__PURE__ */ jsx10("div", { style: { width: `${pct}%`, height: "100%", background: barColor, transition: "width 200ms" } }) }),
3957
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 10.5, color: "#4b5563", lineHeight: 1.4 }, children: comp.detail })
4303
+ /* @__PURE__ */ jsx11("div", { style: { height: 4, background: "#f1f5f9", borderRadius: 99, overflow: "hidden", marginBottom: 4 }, children: /* @__PURE__ */ jsx11("div", { style: { width: `${pct}%`, height: "100%", background: tier.bar, transition: "width 200ms" } }) }),
4304
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 10.5, color: "#4b5563", lineHeight: 1.4 }, children: comp.detail })
3958
4305
  ] }, i);
3959
4306
  }) })
3960
4307
  ] });
@@ -3968,7 +4315,7 @@ function ItemCard({ item, onClick }) {
3968
4315
  const v = severityVisual(item.severity);
3969
4316
  const tab = item.jumpTo.tab;
3970
4317
  const tabLabel = TAB_LABEL[tab] ?? tab.charAt(0).toUpperCase() + tab.slice(1);
3971
- return /* @__PURE__ */ jsxs9(
4318
+ return /* @__PURE__ */ jsxs10(
3972
4319
  "div",
3973
4320
  {
3974
4321
  onClick,
@@ -3985,8 +4332,8 @@ function ItemCard({ item, onClick }) {
3985
4332
  cursor: "pointer"
3986
4333
  },
3987
4334
  children: [
3988
- /* @__PURE__ */ jsxs9("div", { style: { display: "flex", alignItems: "flex-start", gap: 9 }, children: [
3989
- /* @__PURE__ */ jsx10(
4335
+ /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "flex-start", gap: 9 }, children: [
4336
+ /* @__PURE__ */ jsx11(
3990
4337
  "div",
3991
4338
  {
3992
4339
  style: {
@@ -3999,12 +4346,12 @@ function ItemCard({ item, onClick }) {
3999
4346
  }
4000
4347
  }
4001
4348
  ),
4002
- /* @__PURE__ */ jsxs9("div", { style: { flex: 1, minWidth: 0 }, children: [
4003
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 2 }, children: item.label }),
4004
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 11, color: "#374151", lineHeight: 1.5 }, children: item.description })
4349
+ /* @__PURE__ */ jsxs10("div", { style: { flex: 1, minWidth: 0 }, children: [
4350
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 2 }, children: item.label }),
4351
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#374151", lineHeight: 1.5 }, children: item.description })
4005
4352
  ] })
4006
4353
  ] }),
4007
- /* @__PURE__ */ jsxs9(
4354
+ /* @__PURE__ */ jsxs10(
4008
4355
  "div",
4009
4356
  {
4010
4357
  style: {
@@ -4016,12 +4363,12 @@ function ItemCard({ item, onClick }) {
4016
4363
  lineHeight: 1.55
4017
4364
  },
4018
4365
  children: [
4019
- /* @__PURE__ */ jsx10("span", { style: { fontWeight: 700, color: "#4b5563", letterSpacing: "0.04em", fontSize: 9.5, textTransform: "uppercase", marginRight: 6 }, children: "Fix" }),
4366
+ /* @__PURE__ */ jsx11("span", { style: { fontWeight: 700, color: "#4b5563", letterSpacing: "0.04em", fontSize: 9.5, textTransform: "uppercase", marginRight: 6 }, children: "Fix" }),
4020
4367
  item.howToFix
4021
4368
  ]
4022
4369
  }
4023
4370
  ),
4024
- item.jumpTo.tab !== "summary" && /* @__PURE__ */ jsx10("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ jsxs9("span", { style: { fontSize: 10, fontWeight: 700, color: MJH_BLUE }, children: [
4371
+ item.jumpTo.tab !== "summary" && /* @__PURE__ */ jsx11("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ jsxs10("span", { style: { fontSize: 10, fontWeight: 700, color: MJH_BLUE }, children: [
4025
4372
  "Go to ",
4026
4373
  tabLabel,
4027
4374
  " \u203A"
@@ -4037,7 +4384,7 @@ function FilterChip({
4037
4384
  count,
4038
4385
  dotColor
4039
4386
  }) {
4040
- return /* @__PURE__ */ jsxs9(
4387
+ return /* @__PURE__ */ jsxs10(
4041
4388
  "button",
4042
4389
  {
4043
4390
  onClick,
@@ -4056,9 +4403,9 @@ function FilterChip({
4056
4403
  transition: "all 150ms"
4057
4404
  },
4058
4405
  children: [
4059
- dotColor && /* @__PURE__ */ jsx10("span", { style: { width: 6, height: 6, borderRadius: "50%", background: dotColor, display: "inline-block" } }),
4060
- /* @__PURE__ */ jsx10("span", { children: label }),
4061
- /* @__PURE__ */ jsx10("span", { style: { fontSize: 10, opacity: 0.8 }, children: count })
4406
+ dotColor && /* @__PURE__ */ jsx11("span", { style: { width: 6, height: 6, borderRadius: "50%", background: dotColor, display: "inline-block" } }),
4407
+ /* @__PURE__ */ jsx11("span", { children: label }),
4408
+ /* @__PURE__ */ jsx11("span", { style: { fontSize: 10, opacity: 0.8 }, children: count })
4062
4409
  ]
4063
4410
  }
4064
4411
  );
@@ -4096,7 +4443,7 @@ function SummaryTab({
4096
4443
  }),
4097
4444
  [analysis, deepAnalysis, documentFields, score, linkingSuggestions, linkCheckResults, text, primaryKeyword, secondaryKeyword]
4098
4445
  );
4099
- const [filter, setFilter] = useState12("all");
4446
+ const [filter, setFilter] = useState13("all");
4100
4447
  const counts = useMemo(
4101
4448
  () => ({
4102
4449
  all: items.length,
@@ -4108,15 +4455,15 @@ function SummaryTab({
4108
4455
  );
4109
4456
  const filtered = filter === "all" ? items : items.filter((i) => i.severity === filter);
4110
4457
  if (!analysis) {
4111
- return /* @__PURE__ */ jsxs9("div", { style: { padding: 24, textAlign: "center" }, children: [
4112
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Start with the Keywords tab" }),
4113
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Once keywords are analyzed, the summary appears here." })
4458
+ return /* @__PURE__ */ jsxs10("div", { style: { padding: 24, textAlign: "center" }, children: [
4459
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Start with the Keywords tab" }),
4460
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Once keywords are analyzed, the summary appears here." })
4114
4461
  ] });
4115
4462
  }
4116
- return /* @__PURE__ */ jsxs9("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
4117
- score != null && scoreDetail && /* @__PURE__ */ jsx10(ScoreBadge, { score, breakdown: scoreDetail.components }),
4118
- /* @__PURE__ */ jsxs9("div", { style: cardStyle2, children: [
4119
- isAnyLoading ? /* @__PURE__ */ jsx10("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", padding: "4px 0" }, children: /* @__PURE__ */ jsx10(ShimmerLoader, { messages: DEFAULT_GENERATE_ALL_MESSAGES }) }) : /* @__PURE__ */ jsx10(
4463
+ return /* @__PURE__ */ jsxs10("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
4464
+ score != null && scoreDetail && /* @__PURE__ */ jsx11(ScoreBadge, { score, breakdown: scoreDetail.components }),
4465
+ /* @__PURE__ */ jsxs10("div", { style: cardStyle2, children: [
4466
+ isAnyLoading ? /* @__PURE__ */ jsx11("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", padding: "4px 0" }, children: /* @__PURE__ */ jsx11(ShimmerLoader, { messages: DEFAULT_GENERATE_ALL_MESSAGES }) }) : /* @__PURE__ */ jsx11(
4120
4467
  "button",
4121
4468
  {
4122
4469
  onClick: onGenerateAll,
@@ -4144,24 +4491,24 @@ function SummaryTab({
4144
4491
  children: "Run all analyses"
4145
4492
  }
4146
4493
  ),
4147
- /* @__PURE__ */ jsxs9("div", { style: { fontSize: 10.5, color: "#4b5563", marginTop: 8, lineHeight: 1.5 }, children: [
4494
+ /* @__PURE__ */ jsxs10("div", { style: { fontSize: 10.5, color: "#4b5563", marginTop: 8, lineHeight: 1.5 }, children: [
4148
4495
  "Runs the analyses that fill the ",
4149
- /* @__PURE__ */ jsx10("strong", { children: "AEO/GEO" }),
4496
+ /* @__PURE__ */ jsx11("strong", { children: "AEO/GEO" }),
4150
4497
  ", ",
4151
- /* @__PURE__ */ jsx10("strong", { children: "Linking" }),
4498
+ /* @__PURE__ */ jsx11("strong", { children: "Linking" }),
4152
4499
  ", and ",
4153
- /* @__PURE__ */ jsx10("strong", { children: "Other Recs" }),
4500
+ /* @__PURE__ */ jsx11("strong", { children: "Other Recs" }),
4154
4501
  " tabs. New issues they find appear in this Summary as each one finishes."
4155
4502
  ] })
4156
4503
  ] }),
4157
- /* @__PURE__ */ jsxs9("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: [
4158
- /* @__PURE__ */ jsx10(FilterChip, { active: filter === "all", onClick: () => setFilter("all"), label: "All", count: counts.all }),
4159
- /* @__PURE__ */ jsx10(FilterChip, { active: filter === "error", onClick: () => setFilter("error"), label: "Errors", count: counts.error, dotColor: "#dc2626" }),
4160
- /* @__PURE__ */ jsx10(FilterChip, { active: filter === "warning", onClick: () => setFilter("warning"), label: "Warnings", count: counts.warning, dotColor: "#E6C01B" }),
4161
- /* @__PURE__ */ jsx10(FilterChip, { active: filter === "opportunity", onClick: () => setFilter("opportunity"), label: "Opportunities", count: counts.opportunity, dotColor: MJH_BLUE })
4504
+ /* @__PURE__ */ jsxs10("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: [
4505
+ /* @__PURE__ */ jsx11(FilterChip, { active: filter === "all", onClick: () => setFilter("all"), label: "All", count: counts.all }),
4506
+ /* @__PURE__ */ jsx11(FilterChip, { active: filter === "error", onClick: () => setFilter("error"), label: "Errors", count: counts.error, dotColor: "#dc2626" }),
4507
+ /* @__PURE__ */ jsx11(FilterChip, { active: filter === "warning", onClick: () => setFilter("warning"), label: "Warnings", count: counts.warning, dotColor: "#E6C01B" }),
4508
+ /* @__PURE__ */ jsx11(FilterChip, { active: filter === "opportunity", onClick: () => setFilter("opportunity"), label: "Opportunities", count: counts.opportunity, dotColor: MJH_BLUE })
4162
4509
  ] }),
4163
- /* @__PURE__ */ jsx10("div", { id: "anchor-summary-issues", style: { display: "flex", flexDirection: "column", gap: 8 }, children: filtered.length === 0 ? /* @__PURE__ */ jsx10("div", { style: { ...cardStyle2, textAlign: "center", padding: "20px 14px" }, children: items.length === 0 ? /* @__PURE__ */ jsxs9(Fragment5, { children: [
4164
- /* @__PURE__ */ jsx10(
4510
+ /* @__PURE__ */ jsx11("div", { id: "anchor-summary-issues", style: { display: "flex", flexDirection: "column", gap: 8 }, children: filtered.length === 0 ? /* @__PURE__ */ jsx11("div", { style: { ...cardStyle2, textAlign: "center", padding: "20px 14px" }, children: items.length === 0 ? /* @__PURE__ */ jsxs10(Fragment6, { children: [
4511
+ /* @__PURE__ */ jsx11(
4165
4512
  "div",
4166
4513
  {
4167
4514
  style: {
@@ -4174,21 +4521,21 @@ function SummaryTab({
4174
4521
  justifyContent: "center",
4175
4522
  margin: "0 auto 8px"
4176
4523
  },
4177
- children: /* @__PURE__ */ jsx10("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "#16a34a", children: /* @__PURE__ */ jsx10("path", { fillRule: "evenodd", d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z", clipRule: "evenodd" }) })
4524
+ children: /* @__PURE__ */ jsx11("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "#16a34a", children: /* @__PURE__ */ jsx11("path", { fillRule: "evenodd", d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z", clipRule: "evenodd" }) })
4178
4525
  }
4179
4526
  ),
4180
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 13, color: "#16a34a", fontWeight: 700 }, children: "Looking good" }),
4181
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 2 }, children: "No issues found for this article." })
4182
- ] }) : /* @__PURE__ */ jsx10("div", { style: { fontSize: 12, color: "#4b5563" }, children: "Nothing in this category." }) }) : filtered.map((item) => /* @__PURE__ */ jsx10(ItemCard, { item, onClick: () => onItemClick(item) }, item.id)) }),
4183
- isAnyLoading && items.length > 0 && /* @__PURE__ */ jsxs9("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 6, padding: "4px 0" }, children: [
4184
- /* @__PURE__ */ jsx10(LoadingBars, { size: "xs", color: MJH_BLUE }),
4185
- /* @__PURE__ */ jsx10("span", { style: { fontSize: 10, color: "#4b5563" }, children: "Still checking..." })
4527
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 13, color: "#16a34a", fontWeight: 700 }, children: "Looking good" }),
4528
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 2 }, children: "No issues found for this article." })
4529
+ ] }) : /* @__PURE__ */ jsx11("div", { style: { fontSize: 12, color: "#4b5563" }, children: "Nothing in this category." }) }) : filtered.map((item) => /* @__PURE__ */ jsx11(ItemCard, { item, onClick: () => onItemClick(item) }, item.id)) }),
4530
+ isAnyLoading && items.length > 0 && /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 6, padding: "4px 0" }, children: [
4531
+ /* @__PURE__ */ jsx11(LoadingBars, { size: "xs", color: MJH_BLUE }),
4532
+ /* @__PURE__ */ jsx11("span", { style: { fontSize: 10, color: "#4b5563" }, children: "Still checking..." })
4186
4533
  ] })
4187
4534
  ] });
4188
4535
  }
4189
4536
 
4190
4537
  // src/components/tabs/AEOTab.tsx
4191
- import { useEffect as useEffect10, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
4538
+ import { useEffect as useEffect11, useMemo as useMemo2, useRef as useRef11, useState as useState14 } from "react";
4192
4539
 
4193
4540
  // src/lib/geoAnalysis.ts
4194
4541
  var FACT_PATTERN = /\d+(?:\.\d+)?\s*%|\b\d{1,3}(?:,\d{3})+\b|\bn\s*=\s*\d+\b|\bp\s*[<=]\s*0?\.\d+\b|\b\d+(?:\.\d+)?\s*(?:patients|participants|subjects|cases|deaths|adverse events|mg|mcg|hours|days|weeks|months|years|fold|x)\b|\b(?:NEJM|JAMA|FDA|EMA|CDC|WHO|NIH|ACC|ASCO|ASH|ESMO|AHA|ACS)\b|\bet al\.?\b|\b(?:phase|stage)\s+(?:I{1,3}V?|1|2|3|4)\b/i;
@@ -4262,7 +4609,7 @@ function analyzeGEO(text, headings) {
4262
4609
  }
4263
4610
 
4264
4611
  // src/components/tabs/AEOTab.tsx
4265
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
4612
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
4266
4613
  var AEO_PURPLE = "#005DAC";
4267
4614
  var GEO_TEAL = "#C9A716";
4268
4615
  var cardStyle3 = {
@@ -4274,7 +4621,7 @@ var cardStyle3 = {
4274
4621
  padding: "14px"
4275
4622
  };
4276
4623
  function AiPill() {
4277
- return /* @__PURE__ */ jsx11(
4624
+ return /* @__PURE__ */ jsx12(
4278
4625
  "span",
4279
4626
  {
4280
4627
  style: {
@@ -4293,16 +4640,16 @@ function AiPill() {
4293
4640
  );
4294
4641
  }
4295
4642
  function SectionHeader2({ label, iconColor, ai }) {
4296
- return /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 4 }, children: [
4297
- /* @__PURE__ */ jsx11("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
4298
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
4299
- ai && /* @__PURE__ */ jsx11(AiPill, {})
4643
+ return /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 4 }, children: [
4644
+ /* @__PURE__ */ jsx12("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
4645
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
4646
+ ai && /* @__PURE__ */ jsx12(AiPill, {})
4300
4647
  ] });
4301
4648
  }
4302
4649
  function CopyButton({ text }) {
4303
- const [copied, setCopied] = useState13(false);
4304
- const copyTimerRef = useRef10(null);
4305
- useEffect10(() => {
4650
+ const [copied, setCopied] = useState14(false);
4651
+ const copyTimerRef = useRef11(null);
4652
+ useEffect11(() => {
4306
4653
  return () => {
4307
4654
  if (copyTimerRef.current) clearTimeout(copyTimerRef.current);
4308
4655
  };
@@ -4315,7 +4662,7 @@ function CopyButton({ text }) {
4315
4662
  } catch {
4316
4663
  }
4317
4664
  };
4318
- return /* @__PURE__ */ jsx11(
4665
+ return /* @__PURE__ */ jsx12(
4319
4666
  "button",
4320
4667
  {
4321
4668
  onClick: handleCopy,
@@ -4334,9 +4681,9 @@ function CopyButton({ text }) {
4334
4681
  transition: "color 150ms"
4335
4682
  },
4336
4683
  title: copied ? "Copied!" : "Copy to clipboard",
4337
- children: copied ? /* @__PURE__ */ jsx11("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx11("path", { fillRule: "evenodd", d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z", clipRule: "evenodd" }) }) : /* @__PURE__ */ jsxs10("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: [
4338
- /* @__PURE__ */ jsx11("path", { d: "M7 3.5A1.5 1.5 0 018.5 2h3.879a1.5 1.5 0 011.06.44l3.122 3.12A1.5 1.5 0 0117 6.622V12.5a1.5 1.5 0 01-1.5 1.5h-1v-3.379a3 3 0 00-.879-2.121L10.5 5.379A3 3 0 008.379 4.5H7v-1z" }),
4339
- /* @__PURE__ */ jsx11("path", { d: "M4.5 6A1.5 1.5 0 003 7.5v9A1.5 1.5 0 004.5 18h7a1.5 1.5 0 001.5-1.5v-5.879a1.5 1.5 0 00-.44-1.06L9.44 6.439A1.5 1.5 0 008.378 6H4.5z" })
4684
+ children: copied ? /* @__PURE__ */ jsx12("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx12("path", { fillRule: "evenodd", d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z", clipRule: "evenodd" }) }) : /* @__PURE__ */ jsxs11("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: [
4685
+ /* @__PURE__ */ jsx12("path", { d: "M7 3.5A1.5 1.5 0 018.5 2h3.879a1.5 1.5 0 011.06.44l3.122 3.12A1.5 1.5 0 0117 6.622V12.5a1.5 1.5 0 01-1.5 1.5h-1v-3.379a3 3 0 00-.879-2.121L10.5 5.379A3 3 0 008.379 4.5H7v-1z" }),
4686
+ /* @__PURE__ */ jsx12("path", { d: "M4.5 6A1.5 1.5 0 003 7.5v9A1.5 1.5 0 004.5 18h7a1.5 1.5 0 001.5-1.5v-5.879a1.5 1.5 0 00-.44-1.06L9.44 6.439A1.5 1.5 0 008.378 6H4.5z" })
4340
4687
  ] })
4341
4688
  }
4342
4689
  );
@@ -4351,13 +4698,13 @@ function GEOCard({ geo, publication }) {
4351
4698
  const fdBg = effectiveStatus === "strong" ? "rgba(22,163,74,0.1)" : effectiveStatus === "moderate" ? "rgba(230,192,27,0.15)" : "rgba(220,38,38,0.08)";
4352
4699
  const goodCount = geo.headingAudit.filter((h) => h.status === "good").length;
4353
4700
  const totalHeadings = geo.headingAudit.length;
4354
- return /* @__PURE__ */ jsxs10("div", { style: cardStyle3, children: [
4355
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 4 }, children: [
4356
- /* @__PURE__ */ jsx11(SectionHeader2, { label: "AI Citation Readiness", iconColor: GEO_TEAL }),
4357
- /* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "geo_summary", suggestionText: `facts/1k: ${fd.factsPerThousandWords}; short-answer headings: ${goodCount}/${totalHeadings}`, publication })
4701
+ return /* @__PURE__ */ jsxs11("div", { style: cardStyle3, children: [
4702
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 4 }, children: [
4703
+ /* @__PURE__ */ jsx12(SectionHeader2, { label: "AI Citation Readiness", iconColor: GEO_TEAL }),
4704
+ /* @__PURE__ */ jsx12(FeedbackButton, { suggestionType: "geo_summary", suggestionText: `facts/1k: ${fd.factsPerThousandWords}; short-answer headings: ${goodCount}/${totalHeadings}`, publication })
4358
4705
  ] }),
4359
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 10, lineHeight: 1.5 }, children: "How easy this article is for ChatGPT, Perplexity, Gemini, and Google's AI Overviews to cite." }),
4360
- /* @__PURE__ */ jsxs10(
4706
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 10, lineHeight: 1.5 }, children: "How easy this article is for ChatGPT, Perplexity, Gemini, and Google's AI Overviews to cite." }),
4707
+ /* @__PURE__ */ jsxs11(
4361
4708
  "div",
4362
4709
  {
4363
4710
  style: {
@@ -4370,7 +4717,7 @@ function GEOCard({ geo, publication }) {
4370
4717
  marginBottom: 8
4371
4718
  },
4372
4719
  children: [
4373
- /* @__PURE__ */ jsxs10(
4720
+ /* @__PURE__ */ jsxs11(
4374
4721
  "div",
4375
4722
  {
4376
4723
  style: {
@@ -4386,17 +4733,17 @@ function GEOCard({ geo, publication }) {
4386
4733
  boxShadow: "0 1px 2px rgba(0,0,0,0.06)"
4387
4734
  },
4388
4735
  children: [
4389
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 18, fontWeight: 700, color: fdColor, lineHeight: 1 }, children: fd.factsPerThousandWords }),
4390
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 7.5, fontWeight: 700, color: fdColor, opacity: 0.75, letterSpacing: "0.05em", marginTop: 2 }, children: "PER 1K" })
4736
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 18, fontWeight: 700, color: fdColor, lineHeight: 1 }, children: fd.factsPerThousandWords }),
4737
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 7.5, fontWeight: 700, color: fdColor, opacity: 0.75, letterSpacing: "0.05em", marginTop: 2 }, children: "PER 1K" })
4391
4738
  ]
4392
4739
  }
4393
4740
  ),
4394
- /* @__PURE__ */ jsxs10("div", { style: { flex: 1, minWidth: 0 }, children: [
4395
- /* @__PURE__ */ jsxs10("div", { style: { fontSize: 11, fontWeight: 700, color: fdColor, marginBottom: 2 }, children: [
4741
+ /* @__PURE__ */ jsxs11("div", { style: { flex: 1, minWidth: 0 }, children: [
4742
+ /* @__PURE__ */ jsxs11("div", { style: { fontSize: 11, fontWeight: 700, color: fdColor, marginBottom: 2 }, children: [
4396
4743
  "Fact density: ",
4397
4744
  fdLabel
4398
4745
  ] }),
4399
- /* @__PURE__ */ jsxs10("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.45 }, children: [
4746
+ /* @__PURE__ */ jsxs11("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.45 }, children: [
4400
4747
  fd.factCount,
4401
4748
  " specific stat",
4402
4749
  fd.factCount === 1 ? "" : "s",
@@ -4412,7 +4759,7 @@ function GEOCard({ geo, publication }) {
4412
4759
  ]
4413
4760
  }
4414
4761
  ),
4415
- fd.driftPassages > 0 && /* @__PURE__ */ jsxs10(
4762
+ fd.driftPassages > 0 && /* @__PURE__ */ jsxs11(
4416
4763
  "div",
4417
4764
  {
4418
4765
  style: {
@@ -4426,15 +4773,15 @@ function GEOCard({ geo, publication }) {
4426
4773
  lineHeight: 1.45
4427
4774
  },
4428
4775
  children: [
4429
- /* @__PURE__ */ jsx11("strong", { children: fd.driftPassages }),
4776
+ /* @__PURE__ */ jsx12("strong", { children: fd.driftPassages }),
4430
4777
  " passage",
4431
4778
  fd.driftPassages === 1 ? "" : "s",
4432
4779
  " over 200 words with no specific stats or citations. AI engines tend to skip these."
4433
4780
  ]
4434
4781
  }
4435
4782
  ),
4436
- totalHeadings > 0 && /* @__PURE__ */ jsxs10("div", { style: { marginTop: 4 }, children: [
4437
- /* @__PURE__ */ jsxs10(
4783
+ totalHeadings > 0 && /* @__PURE__ */ jsxs11("div", { style: { marginTop: 4 }, children: [
4784
+ /* @__PURE__ */ jsxs11(
4438
4785
  "button",
4439
4786
  {
4440
4787
  onClick: () => setShowDetails((v) => !v),
@@ -4453,22 +4800,22 @@ function GEOCard({ geo, publication }) {
4453
4800
  color: GEO_TEAL
4454
4801
  },
4455
4802
  children: [
4456
- /* @__PURE__ */ jsxs10("span", { children: [
4803
+ /* @__PURE__ */ jsxs11("span", { children: [
4457
4804
  "Short-answer paragraphs: ",
4458
4805
  goodCount,
4459
4806
  "/",
4460
4807
  totalHeadings,
4461
4808
  " headings have one"
4462
4809
  ] }),
4463
- /* @__PURE__ */ jsx11("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: showDetails ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx11("path", { fillRule: "evenodd", d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z", clipRule: "evenodd" }) })
4810
+ /* @__PURE__ */ jsx12("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: showDetails ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx12("path", { fillRule: "evenodd", d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z", clipRule: "evenodd" }) })
4464
4811
  ]
4465
4812
  }
4466
4813
  ),
4467
- showDetails && /* @__PURE__ */ jsxs10("div", { style: { marginTop: 6, display: "flex", flexDirection: "column", gap: 4 }, children: [
4468
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 4 }, children: "Aim for a 40-60 word answer right after each heading. That's the chunk AI engines extract." }),
4814
+ showDetails && /* @__PURE__ */ jsxs11("div", { style: { marginTop: 6, display: "flex", flexDirection: "column", gap: 4 }, children: [
4815
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 4 }, children: "Aim for a 40-60 word answer right after each heading. That's the chunk AI engines extract." }),
4469
4816
  geo.headingAudit.map((h, i) => {
4470
4817
  const c = h.status === "good" ? { bg: "rgba(22,163,74,0.08)", color: "#16a34a", label: `${h.words} words \u2713` } : h.status === "too-short" ? { bg: "rgba(230,192,27,0.12)", color: "#8B7310", label: `${h.words} words - too short` } : h.status === "too-long" ? { bg: "rgba(230,192,27,0.12)", color: "#8B7310", label: `${h.words} words - condense to 40-60` } : { bg: "rgba(220,38,38,0.06)", color: "#dc2626", label: "no body content" };
4471
- return /* @__PURE__ */ jsxs10(
4818
+ return /* @__PURE__ */ jsxs11(
4472
4819
  "div",
4473
4820
  {
4474
4821
  style: {
@@ -4482,8 +4829,8 @@ function GEOCard({ geo, publication }) {
4482
4829
  gap: 8
4483
4830
  },
4484
4831
  children: [
4485
- /* @__PURE__ */ jsx11("span", { style: { flex: 1, minWidth: 0, color: "#1f2937", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: h.heading }),
4486
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 10, fontWeight: 600, color: c.color, flexShrink: 0 }, children: c.label })
4832
+ /* @__PURE__ */ jsx12("span", { style: { flex: 1, minWidth: 0, color: "#1f2937", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: h.heading }),
4833
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 10, fontWeight: 600, color: c.color, flexShrink: 0 }, children: c.label })
4487
4834
  ]
4488
4835
  },
4489
4836
  i
@@ -4520,8 +4867,8 @@ function AEOTab({
4520
4867
  originalHeading: void 0,
4521
4868
  rationale: h.rationale
4522
4869
  })) ?? [];
4523
- return /* @__PURE__ */ jsxs10("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
4524
- aeoContentChanged && /* @__PURE__ */ jsxs10(
4870
+ return /* @__PURE__ */ jsxs11("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
4871
+ aeoContentChanged && /* @__PURE__ */ jsxs11(
4525
4872
  "div",
4526
4873
  {
4527
4874
  onClick: runDeepAnalysis,
@@ -4544,30 +4891,30 @@ function AEOTab({
4544
4891
  cursor: "pointer"
4545
4892
  },
4546
4893
  children: [
4547
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 11, color: "#92400e" }, children: "Content has changed since this was generated." }),
4548
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 11, fontWeight: 600, color: AEO_PURPLE, textDecoration: "underline" }, children: "Update" })
4894
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 11, color: "#92400e" }, children: "Content has changed since this was generated." }),
4895
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 11, fontWeight: 600, color: AEO_PURPLE, textDecoration: "underline" }, children: "Update" })
4549
4896
  ]
4550
4897
  }
4551
4898
  ),
4552
- hasEnoughTextForGEO && /* @__PURE__ */ jsx11(GEOCard, { geo, publication }),
4553
- hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */ jsx11("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ jsxs10("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: [
4554
- /* @__PURE__ */ jsx11("strong", { style: { color: "#C9A716" }, children: "AI citation analysis" }),
4899
+ hasEnoughTextForGEO && /* @__PURE__ */ jsx12(GEOCard, { geo, publication }),
4900
+ hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */ jsx12("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ jsxs11("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: [
4901
+ /* @__PURE__ */ jsx12("strong", { style: { color: "#C9A716" }, children: "AI citation analysis" }),
4555
4902
  " needs at least 150 words to read fact density.",
4556
- /* @__PURE__ */ jsx11("br", {}),
4557
- /* @__PURE__ */ jsxs10("span", { style: { color: "#4b5563" }, children: [
4903
+ /* @__PURE__ */ jsx12("br", {}),
4904
+ /* @__PURE__ */ jsxs11("span", { style: { color: "#4b5563" }, children: [
4558
4905
  "Current: ",
4559
4906
  geoWordCount,
4560
4907
  " word",
4561
4908
  geoWordCount === 1 ? "" : "s"
4562
4909
  ] })
4563
4910
  ] }) }),
4564
- !deepAnalysis && isDeepLoading && /* @__PURE__ */ jsxs10("div", { style: { ...cardStyle3, display: "flex", alignItems: "center", justifyContent: "center", gap: 8 }, children: [
4565
- /* @__PURE__ */ jsx11(LoadingBars, { size: "xs", color: AEO_PURPLE }),
4566
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Generating AEO insights..." })
4911
+ !deepAnalysis && isDeepLoading && /* @__PURE__ */ jsxs11("div", { style: { ...cardStyle3, display: "flex", alignItems: "center", justifyContent: "center", gap: 8 }, children: [
4912
+ /* @__PURE__ */ jsx12(LoadingBars, { size: "xs", color: AEO_PURPLE }),
4913
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Generating AEO insights..." })
4567
4914
  ] }),
4568
- !deepAnalysis && !isDeepLoading && /* @__PURE__ */ jsxs10("div", { style: { ...cardStyle3, textAlign: "center" }, children: [
4569
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 12, color: "#4b5563" }, children: "AI citation readiness and question-style heading suggestions appear here once analysis runs." }),
4570
- /* @__PURE__ */ jsx11(
4915
+ !deepAnalysis && !isDeepLoading && /* @__PURE__ */ jsxs11("div", { style: { ...cardStyle3, textAlign: "center" }, children: [
4916
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 12, color: "#4b5563" }, children: "AI citation readiness and question-style heading suggestions appear here once analysis runs." }),
4917
+ /* @__PURE__ */ jsx12(
4571
4918
  "button",
4572
4919
  {
4573
4920
  onClick: runDeepAnalysis,
@@ -4587,11 +4934,11 @@ function AEOTab({
4587
4934
  }
4588
4935
  )
4589
4936
  ] }),
4590
- deepAnalysis && !aeo && /* @__PURE__ */ jsx11("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ jsx11("span", { style: { fontSize: 12, color: "#4b5563" }, children: "No insights came back. Try again - the analysis may have timed out." }) }),
4591
- questionHeadings.length > 0 && /* @__PURE__ */ jsxs10("div", { style: cardStyle3, children: [
4592
- /* @__PURE__ */ jsx11(SectionHeader2, { label: "Question-Style Headings", iconColor: AEO_PURPLE }),
4593
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 8 }, children: "Rewrites of your existing headings as questions. Google often pulls these into featured snippets." }),
4594
- /* @__PURE__ */ jsx11("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: questionHeadings.map((h, i) => /* @__PURE__ */ jsxs10(
4937
+ deepAnalysis && !aeo && /* @__PURE__ */ jsx12("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ jsx12("span", { style: { fontSize: 12, color: "#4b5563" }, children: "No insights came back. Try again - the analysis may have timed out." }) }),
4938
+ questionHeadings.length > 0 && /* @__PURE__ */ jsxs11("div", { style: cardStyle3, children: [
4939
+ /* @__PURE__ */ jsx12(SectionHeader2, { label: "Question-Style Headings", iconColor: AEO_PURPLE }),
4940
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 8 }, children: "Rewrites of your existing headings as questions. Google often pulls these into featured snippets." }),
4941
+ /* @__PURE__ */ jsx12("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: questionHeadings.map((h, i) => /* @__PURE__ */ jsxs11(
4595
4942
  "div",
4596
4943
  {
4597
4944
  style: {
@@ -4601,26 +4948,26 @@ function AEOTab({
4601
4948
  borderLeft: `3px solid ${AEO_PURPLE}`
4602
4949
  },
4603
4950
  children: [
4604
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4605
- /* @__PURE__ */ jsxs10("div", { style: { flex: 1 }, children: [
4606
- h.originalHeading && /* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#4b5563", textDecoration: "line-through", marginBottom: 2 }, children: h.originalHeading }),
4607
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE, lineHeight: 1.5 }, children: h.heading })
4951
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4952
+ /* @__PURE__ */ jsxs11("div", { style: { flex: 1 }, children: [
4953
+ h.originalHeading && /* @__PURE__ */ jsx12("div", { style: { fontSize: 11, color: "#4b5563", textDecoration: "line-through", marginBottom: 2 }, children: h.originalHeading }),
4954
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE, lineHeight: 1.5 }, children: h.heading })
4608
4955
  ] }),
4609
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4610
- /* @__PURE__ */ jsx11(CopyButton, { text: h.heading }),
4611
- /* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "aeo_heading", suggestionText: h.heading, publication })
4956
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4957
+ /* @__PURE__ */ jsx12(CopyButton, { text: h.heading }),
4958
+ /* @__PURE__ */ jsx12(FeedbackButton, { suggestionType: "aeo_heading", suggestionText: h.heading, publication })
4612
4959
  ] })
4613
4960
  ] }),
4614
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 4, fontStyle: "italic" }, children: h.rationale })
4961
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 4, fontStyle: "italic" }, children: h.rationale })
4615
4962
  ]
4616
4963
  },
4617
4964
  i
4618
4965
  )) })
4619
4966
  ] }),
4620
- /* @__PURE__ */ jsxs10("div", { style: cardStyle3, children: [
4621
- /* @__PURE__ */ jsx11(SectionHeader2, { label: "Content Block Suggestions", iconColor: AEO_PURPLE }),
4622
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 10 }, children: "Short, citable blocks to use inside or alongside the article - takeaways, infographic ideas, and bullet points." }),
4623
- !contentSuggestions && !isCSLoading && /* @__PURE__ */ jsx11(
4967
+ /* @__PURE__ */ jsxs11("div", { style: cardStyle3, children: [
4968
+ /* @__PURE__ */ jsx12(SectionHeader2, { label: "Content Block Suggestions", iconColor: AEO_PURPLE }),
4969
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 10 }, children: "Short, citable blocks to use inside or alongside the article - takeaways, infographic ideas, and bullet points." }),
4970
+ !contentSuggestions && !isCSLoading && /* @__PURE__ */ jsx12(
4624
4971
  "button",
4625
4972
  {
4626
4973
  onClick: loadContentSuggestions,
@@ -4644,15 +4991,15 @@ function AEOTab({
4644
4991
  children: "Generate suggestions"
4645
4992
  }
4646
4993
  ),
4647
- isCSLoading && /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "8px 0" }, children: [
4648
- /* @__PURE__ */ jsx11(LoadingBars, { size: "xs", color: AEO_PURPLE }),
4649
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Generating content suggestions..." })
4994
+ isCSLoading && /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "8px 0" }, children: [
4995
+ /* @__PURE__ */ jsx12(LoadingBars, { size: "xs", color: AEO_PURPLE }),
4996
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Generating content suggestions..." })
4650
4997
  ] }),
4651
- csError && /* @__PURE__ */ jsx11("div", { style: { marginTop: 6, fontSize: 11, color: "#dc2626" }, children: csError }),
4652
- contentSuggestions && /* @__PURE__ */ jsxs10("div", { style: { display: "flex", flexDirection: "column", gap: 14, marginTop: 8 }, children: [
4653
- contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */ jsxs10("div", { children: [
4654
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Key Takeaways" }),
4655
- /* @__PURE__ */ jsx11("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.keyTakeaways.map((kt, i) => /* @__PURE__ */ jsxs10(
4998
+ csError && /* @__PURE__ */ jsx12("div", { style: { marginTop: 6, fontSize: 11, color: "#dc2626" }, children: csError }),
4999
+ contentSuggestions && /* @__PURE__ */ jsxs11("div", { style: { display: "flex", flexDirection: "column", gap: 14, marginTop: 8 }, children: [
5000
+ contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */ jsxs11("div", { children: [
5001
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Key Takeaways" }),
5002
+ /* @__PURE__ */ jsx12("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.keyTakeaways.map((kt, i) => /* @__PURE__ */ jsxs11(
4656
5003
  "div",
4657
5004
  {
4658
5005
  style: {
@@ -4665,19 +5012,19 @@ function AEOTab({
4665
5012
  alignItems: "flex-start"
4666
5013
  },
4667
5014
  children: [
4668
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, flex: 1 }, children: kt }),
4669
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4670
- /* @__PURE__ */ jsx11(CopyButton, { text: kt }),
4671
- /* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "aeo_takeaway", suggestionText: kt, publication })
5015
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, flex: 1 }, children: kt }),
5016
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
5017
+ /* @__PURE__ */ jsx12(CopyButton, { text: kt }),
5018
+ /* @__PURE__ */ jsx12(FeedbackButton, { suggestionType: "aeo_takeaway", suggestionText: kt, publication })
4672
5019
  ] })
4673
5020
  ]
4674
5021
  },
4675
5022
  i
4676
5023
  )) })
4677
5024
  ] }),
4678
- contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */ jsxs10("div", { children: [
4679
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Infographic Ideas" }),
4680
- /* @__PURE__ */ jsx11("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.infographicOpportunities.map((io, i) => /* @__PURE__ */ jsxs10(
5025
+ contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */ jsxs11("div", { children: [
5026
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Infographic Ideas" }),
5027
+ /* @__PURE__ */ jsx12("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.infographicOpportunities.map((io, i) => /* @__PURE__ */ jsxs11(
4681
5028
  "div",
4682
5029
  {
4683
5030
  style: {
@@ -4687,23 +5034,23 @@ function AEOTab({
4687
5034
  borderLeft: `2px solid ${AEO_PURPLE}`
4688
5035
  },
4689
5036
  children: [
4690
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4691
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE }, children: io.concept }),
4692
- /* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "aeo_infographic", suggestionText: io.concept, publication })
5037
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
5038
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE }, children: io.concept }),
5039
+ /* @__PURE__ */ jsx12(FeedbackButton, { suggestionType: "aeo_infographic", suggestionText: io.concept, publication })
4693
5040
  ] }),
4694
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginTop: 3 }, children: io.description })
5041
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginTop: 3 }, children: io.description })
4695
5042
  ]
4696
5043
  },
4697
5044
  i
4698
5045
  )) })
4699
5046
  ] }),
4700
- contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */ jsxs10("div", { children: [
4701
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Bullets for Featured Snippets" }),
4702
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4703
- /* @__PURE__ */ jsx11("ul", { style: { margin: 0, paddingLeft: 18, flex: 1 }, children: contentSuggestions.bulletListItems.map((b, i) => /* @__PURE__ */ jsx11("li", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, marginBottom: 4 }, children: b }, i)) }),
4704
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4705
- /* @__PURE__ */ jsx11(CopyButton, { text: contentSuggestions.bulletListItems.map((b) => "- " + b).join("\n") }),
4706
- /* @__PURE__ */ jsx11(
5047
+ contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */ jsxs11("div", { children: [
5048
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Bullets for Featured Snippets" }),
5049
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
5050
+ /* @__PURE__ */ jsx12("ul", { style: { margin: 0, paddingLeft: 18, flex: 1 }, children: contentSuggestions.bulletListItems.map((b, i) => /* @__PURE__ */ jsx12("li", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, marginBottom: 4 }, children: b }, i)) }),
5051
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
5052
+ /* @__PURE__ */ jsx12(CopyButton, { text: contentSuggestions.bulletListItems.map((b) => "- " + b).join("\n") }),
5053
+ /* @__PURE__ */ jsx12(
4707
5054
  FeedbackButton,
4708
5055
  {
4709
5056
  suggestionType: "aeo_bullets",
@@ -4714,7 +5061,7 @@ function AEOTab({
4714
5061
  ] })
4715
5062
  ] })
4716
5063
  ] }),
4717
- /* @__PURE__ */ jsx11(
5064
+ /* @__PURE__ */ jsx12(
4718
5065
  "button",
4719
5066
  {
4720
5067
  onClick: loadContentSuggestions,
@@ -4743,8 +5090,8 @@ function AEOTab({
4743
5090
  }
4744
5091
 
4745
5092
  // src/components/ScoreDonut.tsx
4746
- import { useState as useState14 } from "react";
4747
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
5093
+ import { useState as useState15 } from "react";
5094
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
4748
5095
  var W = { topic: 0.6, freshness: 0.25, sectionFit: 0.15 };
4749
5096
  var COLORS = { topic: MJH_BLUE, freshness: MJH_GOLD, sectionFit: "#9B59B6" };
4750
5097
  var TRACK = "#eef2f7";
@@ -4756,7 +5103,7 @@ function ScoreDonut({
4756
5103
  sectionFit,
4757
5104
  composite
4758
5105
  }) {
4759
- const [hovered, setHovered] = useState14(false);
5106
+ const [hovered, setHovered] = useState15(false);
4760
5107
  const radius = (size - strokeWidth) / 2;
4761
5108
  const circumference = 2 * Math.PI * radius;
4762
5109
  const cTopic = topic * W.topic;
@@ -4769,7 +5116,7 @@ function ScoreDonut({
4769
5116
  const topicLen = seg(cTopic);
4770
5117
  const freshLen = seg(cFresh);
4771
5118
  const sectionLen = seg(cSection);
4772
- const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */ jsx12(
5119
+ const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */ jsx13(
4773
5120
  "circle",
4774
5121
  {
4775
5122
  cx: size / 2,
@@ -4783,20 +5130,20 @@ function ScoreDonut({
4783
5130
  strokeDashoffset: -offset
4784
5131
  }
4785
5132
  );
4786
- return /* @__PURE__ */ jsxs11(
5133
+ return /* @__PURE__ */ jsxs12(
4787
5134
  "div",
4788
5135
  {
4789
5136
  style: { position: "relative", width: size, height: size, flexShrink: 0 },
4790
5137
  onMouseEnter: () => setHovered(true),
4791
5138
  onMouseLeave: () => setHovered(false),
4792
5139
  children: [
4793
- /* @__PURE__ */ jsxs11("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, style: { transform: "rotate(-90deg)" }, children: [
4794
- /* @__PURE__ */ jsx12("circle", { cx: size / 2, cy: size / 2, r: radius, fill: "none", stroke: TRACK, strokeWidth }),
4795
- /* @__PURE__ */ jsx12(Slice, { color: COLORS.topic, fullLen: topicLen, offset: 0 }),
4796
- /* @__PURE__ */ jsx12(Slice, { color: COLORS.freshness, fullLen: freshLen, offset: topicLen }),
4797
- /* @__PURE__ */ jsx12(Slice, { color: COLORS.sectionFit, fullLen: sectionLen, offset: topicLen + freshLen })
5140
+ /* @__PURE__ */ jsxs12("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, style: { transform: "rotate(-90deg)" }, children: [
5141
+ /* @__PURE__ */ jsx13("circle", { cx: size / 2, cy: size / 2, r: radius, fill: "none", stroke: TRACK, strokeWidth }),
5142
+ /* @__PURE__ */ jsx13(Slice, { color: COLORS.topic, fullLen: topicLen, offset: 0 }),
5143
+ /* @__PURE__ */ jsx13(Slice, { color: COLORS.freshness, fullLen: freshLen, offset: topicLen }),
5144
+ /* @__PURE__ */ jsx13(Slice, { color: COLORS.sectionFit, fullLen: sectionLen, offset: topicLen + freshLen })
4798
5145
  ] }),
4799
- /* @__PURE__ */ jsxs11(
5146
+ /* @__PURE__ */ jsxs12(
4800
5147
  "div",
4801
5148
  {
4802
5149
  style: {
@@ -4810,15 +5157,15 @@ function ScoreDonut({
4810
5157
  lineHeight: 1
4811
5158
  },
4812
5159
  children: [
4813
- /* @__PURE__ */ jsxs11("span", { style: { fontSize: Math.max(11, size / 5.5), fontWeight: 700, color: "#1f2937" }, children: [
5160
+ /* @__PURE__ */ jsxs12("span", { style: { fontSize: Math.max(11, size / 5.5), fontWeight: 700, color: "#1f2937" }, children: [
4814
5161
  compositeValue,
4815
5162
  "%"
4816
5163
  ] }),
4817
- /* @__PURE__ */ jsx12("span", { style: { fontSize: Math.max(7, size / 11), fontWeight: 700, color: "#4b5563", letterSpacing: "0.05em", marginTop: 1 }, children: "MATCH" })
5164
+ /* @__PURE__ */ jsx13("span", { style: { fontSize: Math.max(7, size / 11), fontWeight: 700, color: "#4b5563", letterSpacing: "0.05em", marginTop: 1 }, children: "MATCH" })
4818
5165
  ]
4819
5166
  }
4820
5167
  ),
4821
- hovered && /* @__PURE__ */ jsxs11(
5168
+ hovered && /* @__PURE__ */ jsxs12(
4822
5169
  "div",
4823
5170
  {
4824
5171
  role: "tooltip",
@@ -4839,9 +5186,9 @@ function ScoreDonut({
4839
5186
  pointerEvents: "none"
4840
5187
  },
4841
5188
  children: [
4842
- /* @__PURE__ */ jsx12(SubScoreRow, { color: COLORS.topic, label: "Topic", value: topic }),
4843
- /* @__PURE__ */ jsx12(SubScoreRow, { color: COLORS.freshness, label: "Freshness", value: freshness }),
4844
- /* @__PURE__ */ jsx12(SubScoreRow, { color: COLORS.sectionFit, label: "Section fit", value: sectionFit })
5189
+ /* @__PURE__ */ jsx13(SubScoreRow, { color: COLORS.topic, label: "Topic", value: topic }),
5190
+ /* @__PURE__ */ jsx13(SubScoreRow, { color: COLORS.freshness, label: "Freshness", value: freshness }),
5191
+ /* @__PURE__ */ jsx13(SubScoreRow, { color: COLORS.sectionFit, label: "Section fit", value: sectionFit })
4845
5192
  ]
4846
5193
  }
4847
5194
  )
@@ -4850,31 +5197,31 @@ function ScoreDonut({
4850
5197
  );
4851
5198
  }
4852
5199
  function SubScoreRow({ color, label, value }) {
4853
- return /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
4854
- /* @__PURE__ */ jsx12("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block", flexShrink: 0 } }),
4855
- /* @__PURE__ */ jsx12("span", { style: { flex: 1 }, children: label }),
4856
- /* @__PURE__ */ jsxs11("span", { style: { fontWeight: 700, fontVariantNumeric: "tabular-nums" }, children: [
5200
+ return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
5201
+ /* @__PURE__ */ jsx13("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block", flexShrink: 0 } }),
5202
+ /* @__PURE__ */ jsx13("span", { style: { flex: 1 }, children: label }),
5203
+ /* @__PURE__ */ jsxs12("span", { style: { fontWeight: 700, fontVariantNumeric: "tabular-nums" }, children: [
4857
5204
  Math.round(value),
4858
5205
  "/100"
4859
5206
  ] })
4860
5207
  ] });
4861
5208
  }
4862
5209
  function ScoreDonutLegend() {
4863
- return /* @__PURE__ */ jsxs11("div", { style: { display: "flex", gap: 10, fontSize: 9, color: "rgba(0,0,0,0.55)", alignItems: "center", flexWrap: "wrap" }, children: [
4864
- /* @__PURE__ */ jsx12(LegendDot, { color: COLORS.topic, label: "Topic match (60% of score)" }),
4865
- /* @__PURE__ */ jsx12(LegendDot, { color: COLORS.freshness, label: "Freshness (25%)" }),
4866
- /* @__PURE__ */ jsx12(LegendDot, { color: COLORS.sectionFit, label: "Section fit (15%)" })
5210
+ return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", gap: 10, fontSize: 9, color: "rgba(0,0,0,0.55)", alignItems: "center", flexWrap: "wrap" }, children: [
5211
+ /* @__PURE__ */ jsx13(LegendDot, { color: COLORS.topic, label: "Topic match (60% of score)" }),
5212
+ /* @__PURE__ */ jsx13(LegendDot, { color: COLORS.freshness, label: "Freshness (25%)" }),
5213
+ /* @__PURE__ */ jsx13(LegendDot, { color: COLORS.sectionFit, label: "Section fit (15%)" })
4867
5214
  ] });
4868
5215
  }
4869
5216
  function LegendDot({ color, label }) {
4870
- return /* @__PURE__ */ jsxs11("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
4871
- /* @__PURE__ */ jsx12("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block" } }),
5217
+ return /* @__PURE__ */ jsxs12("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
5218
+ /* @__PURE__ */ jsx13("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block" } }),
4872
5219
  label
4873
5220
  ] });
4874
5221
  }
4875
5222
 
4876
5223
  // src/components/tabs/LinkingTab.tsx
4877
- import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
5224
+ import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
4878
5225
  function buildLiveUrl(publication, slug) {
4879
5226
  if (!slug) return null;
4880
5227
  const pub = (publication || "").trim().toLowerCase();
@@ -4890,7 +5237,7 @@ function buildSanityUrl(baseUrl, id, type) {
4890
5237
  return `${base}/intent/edit/id=${encodeURIComponent(cleanId)}${typePart}/`;
4891
5238
  }
4892
5239
  function LinkChip({ href, label, color }) {
4893
- return /* @__PURE__ */ jsxs12(
5240
+ return /* @__PURE__ */ jsxs13(
4894
5241
  "a",
4895
5242
  {
4896
5243
  href,
@@ -4912,14 +5259,38 @@ function LinkChip({ href, label, color }) {
4912
5259
  },
4913
5260
  children: [
4914
5261
  label,
4915
- /* @__PURE__ */ jsxs12("svg", { width: "9", height: "9", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
4916
- /* @__PURE__ */ jsx13("path", { d: "M12.5 2a.75.75 0 000 1.5h2.44l-6.97 6.97a.75.75 0 101.06 1.06L16 4.56V7a.75.75 0 001.5 0V2.75A.75.75 0 0016.75 2H12.5z" }),
4917
- /* @__PURE__ */ jsx13("path", { d: "M4.75 4.5A2.75 2.75 0 002 7.25v8A2.75 2.75 0 004.75 18h8A2.75 2.75 0 0015.5 15.25v-3a.75.75 0 00-1.5 0v3c0 .69-.56 1.25-1.25 1.25h-8c-.69 0-1.25-.56-1.25-1.25v-8c0-.69.56-1.25 1.25-1.25h3a.75.75 0 000-1.5h-3z" })
5262
+ /* @__PURE__ */ jsxs13("svg", { width: "9", height: "9", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
5263
+ /* @__PURE__ */ jsx14("path", { d: "M12.5 2a.75.75 0 000 1.5h2.44l-6.97 6.97a.75.75 0 101.06 1.06L16 4.56V7a.75.75 0 001.5 0V2.75A.75.75 0 0016.75 2H12.5z" }),
5264
+ /* @__PURE__ */ jsx14("path", { d: "M4.75 4.5A2.75 2.75 0 002 7.25v8A2.75 2.75 0 004.75 18h8A2.75 2.75 0 0015.5 15.25v-3a.75.75 0 00-1.5 0v3c0 .69-.56 1.25-1.25 1.25h-8c-.69 0-1.25-.56-1.25-1.25v-8c0-.69.56-1.25 1.25-1.25h3a.75.75 0 000-1.5h-3z" })
4918
5265
  ] })
4919
5266
  ]
4920
5267
  }
4921
5268
  );
4922
5269
  }
5270
+ function ClickableBadge({ clickable }) {
5271
+ return /* @__PURE__ */ jsxs13(
5272
+ "span",
5273
+ {
5274
+ style: {
5275
+ fontSize: 9,
5276
+ fontWeight: 700,
5277
+ textTransform: "uppercase",
5278
+ letterSpacing: "0.04em",
5279
+ padding: "2px 7px",
5280
+ borderRadius: 99,
5281
+ display: "inline-flex",
5282
+ alignItems: "center",
5283
+ gap: 4,
5284
+ background: clickable ? "rgba(22,163,74,0.12)" : "rgba(0,0,0,0.05)",
5285
+ color: clickable ? "#16a34a" : "#9ca3af"
5286
+ },
5287
+ children: [
5288
+ /* @__PURE__ */ jsx14("span", { style: { width: 5, height: 5, borderRadius: "50%", background: "currentColor" } }),
5289
+ clickable ? "Clickable link" : "No live link"
5290
+ ]
5291
+ }
5292
+ );
5293
+ }
4923
5294
  var cardStyle4 = {
4924
5295
  borderRadius: 14,
4925
5296
  background: "rgba(255,255,255,0.55)",
@@ -4929,7 +5300,7 @@ var cardStyle4 = {
4929
5300
  padding: "14px"
4930
5301
  };
4931
5302
  function AiPill2() {
4932
- return /* @__PURE__ */ jsx13(
5303
+ return /* @__PURE__ */ jsx14(
4933
5304
  "span",
4934
5305
  {
4935
5306
  style: {
@@ -4953,10 +5324,10 @@ function SectionHeader3({
4953
5324
  ai,
4954
5325
  action
4955
5326
  }) {
4956
- return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 8 }, children: [
4957
- /* @__PURE__ */ jsx13("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
4958
- /* @__PURE__ */ jsx13("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
4959
- ai && /* @__PURE__ */ jsx13(AiPill2, {}),
5327
+ return /* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 8 }, children: [
5328
+ /* @__PURE__ */ jsx14("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
5329
+ /* @__PURE__ */ jsx14("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
5330
+ ai && /* @__PURE__ */ jsx14(AiPill2, {}),
4960
5331
  action
4961
5332
  ] });
4962
5333
  }
@@ -4977,7 +5348,7 @@ function freshnessChip(label, score) {
4977
5348
  };
4978
5349
  const c = map[label];
4979
5350
  if (!c) return null;
4980
- return /* @__PURE__ */ jsx13(
5351
+ return /* @__PURE__ */ jsx14(
4981
5352
  "span",
4982
5353
  {
4983
5354
  style: {
@@ -4997,8 +5368,8 @@ function freshnessChip(label, score) {
4997
5368
  );
4998
5369
  }
4999
5370
  function RefreshIcon({ spinning }) {
5000
- if (spinning) return /* @__PURE__ */ jsx13(LoadingBars, { size: "xs", color: "#9ca3af" });
5001
- return /* @__PURE__ */ jsx13("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx13("path", { fillRule: "evenodd", d: "M15.312 11.424a5.5 5.5 0 01-9.201 2.466l-.312-.311h2.433a.75.75 0 000-1.5H4.598a.75.75 0 00-.75.75v3.634a.75.75 0 001.5 0v-2.033l.312.311a7 7 0 0011.712-3.138.75.75 0 00-1.449-.39zm-10.624-2.85a5.5 5.5 0 019.201-2.466l.312.311h-2.433a.75.75 0 000 1.5h3.634a.75.75 0 00.75-.75V3.535a.75.75 0 00-1.5 0v2.033l-.312-.311A7 7 0 002.628 8.395a.75.75 0 001.449.39z", clipRule: "evenodd" }) });
5371
+ if (spinning) return /* @__PURE__ */ jsx14(LoadingBars, { size: "xs", color: "#9ca3af" });
5372
+ return /* @__PURE__ */ jsx14("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx14("path", { fillRule: "evenodd", d: "M15.312 11.424a5.5 5.5 0 01-9.201 2.466l-.312-.311h2.433a.75.75 0 000-1.5H4.598a.75.75 0 00-.75.75v3.634a.75.75 0 001.5 0v-2.033l.312.311a7 7 0 0011.712-3.138.75.75 0 00-1.449-.39zm-10.624-2.85a5.5 5.5 0 019.201-2.466l.312.311h-2.433a.75.75 0 000 1.5h3.634a.75.75 0 00.75-.75V3.535a.75.75 0 00-1.5 0v2.033l-.312-.311A7 7 0 002.628 8.395a.75.75 0 001.449.39z", clipRule: "evenodd" }) });
5002
5373
  }
5003
5374
  function LinkingTab({
5004
5375
  analysis,
@@ -5014,21 +5385,21 @@ function LinkingTab({
5014
5385
  documentType
5015
5386
  }) {
5016
5387
  if (!analysis) {
5017
- return /* @__PURE__ */ jsxs12("div", { style: { padding: 24, textAlign: "center" }, children: [
5018
- /* @__PURE__ */ jsx13("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Waiting for keyword analysis" }),
5019
- /* @__PURE__ */ jsx13("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Linking reads the article keywords and topic to find related published articles. It starts on its own once the Keywords tab finishes." })
5388
+ return /* @__PURE__ */ jsxs13("div", { style: { padding: 24, textAlign: "center" }, children: [
5389
+ /* @__PURE__ */ jsx14("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Waiting for keyword analysis" }),
5390
+ /* @__PURE__ */ jsx14("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Linking reads the article keywords and topic to find related published articles. It starts on its own once the Keywords tab finishes." })
5020
5391
  ] });
5021
5392
  }
5022
5393
  const wordCount2 = text ? text.split(/\s+/).filter(Boolean).length : 0;
5023
5394
  const recommendedMin = Math.max(1, Math.round(wordCount2 / 1e3 * 2));
5024
5395
  const recommendedMax = Math.max(2, Math.round(wordCount2 / 1e3 * 5));
5025
- return /* @__PURE__ */ jsx13("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: /* @__PURE__ */ jsxs12("div", { id: "anchor-linking-suggestions", style: cardStyle4, children: [
5026
- /* @__PURE__ */ jsx13(
5396
+ return /* @__PURE__ */ jsx14("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: /* @__PURE__ */ jsxs13("div", { id: "anchor-linking-suggestions", style: cardStyle4, children: [
5397
+ /* @__PURE__ */ jsx14(
5027
5398
  SectionHeader3,
5028
5399
  {
5029
5400
  label: "Suggested Links",
5030
5401
  iconColor: MJH_BLUE,
5031
- action: /* @__PURE__ */ jsx13(
5402
+ action: /* @__PURE__ */ jsx14(
5032
5403
  "button",
5033
5404
  {
5034
5405
  onClick: onRefresh,
@@ -5043,20 +5414,20 @@ function LinkingTab({
5043
5414
  fontSize: 10
5044
5415
  },
5045
5416
  title: "Refresh",
5046
- children: /* @__PURE__ */ jsx13(RefreshIcon, { spinning: isLoading })
5417
+ children: /* @__PURE__ */ jsx14(RefreshIcon, { spinning: isLoading })
5047
5418
  }
5048
5419
  )
5049
5420
  }
5050
5421
  ),
5051
- /* @__PURE__ */ jsxs12("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 8, lineHeight: 1.55 }, children: [
5422
+ /* @__PURE__ */ jsxs13("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 8, lineHeight: 1.55 }, children: [
5052
5423
  "Other articles on this site that fit this topic.",
5053
- wordCount2 > 0 && /* @__PURE__ */ jsxs12(Fragment6, { children: [
5424
+ wordCount2 > 0 && /* @__PURE__ */ jsxs13(Fragment7, { children: [
5054
5425
  " ",
5055
5426
  "For a ",
5056
5427
  wordCount2.toLocaleString(),
5057
5428
  "-word article, aim for",
5058
5429
  " ",
5059
- /* @__PURE__ */ jsxs12("strong", { children: [
5430
+ /* @__PURE__ */ jsxs13("strong", { children: [
5060
5431
  recommendedMin,
5061
5432
  "-",
5062
5433
  recommendedMax,
@@ -5065,17 +5436,17 @@ function LinkingTab({
5065
5436
  "."
5066
5437
  ] })
5067
5438
  ] }),
5068
- /* @__PURE__ */ jsxs12("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 6, lineHeight: 1.5 }, children: [
5439
+ /* @__PURE__ */ jsxs13("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 6, lineHeight: 1.5 }, children: [
5069
5440
  "Each suggestion gets a 0-100% match score from three signals - ",
5070
- /* @__PURE__ */ jsx13("strong", { children: "topic match" }),
5441
+ /* @__PURE__ */ jsx14("strong", { children: "topic match" }),
5071
5442
  ", ",
5072
- /* @__PURE__ */ jsx13("strong", { children: "freshness" }),
5443
+ /* @__PURE__ */ jsx14("strong", { children: "freshness" }),
5073
5444
  ", and ",
5074
- /* @__PURE__ */ jsx13("strong", { children: "section fit" }),
5445
+ /* @__PURE__ */ jsx14("strong", { children: "section fit" }),
5075
5446
  " (where in your article the link belongs). The percentage on each card is the weighted total:"
5076
5447
  ] }),
5077
- /* @__PURE__ */ jsx13("div", { style: { marginBottom: 10 }, children: /* @__PURE__ */ jsx13(ScoreDonutLegend, {}) }),
5078
- isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */ jsxs12(
5448
+ /* @__PURE__ */ jsx14("div", { style: { marginBottom: 10 }, children: /* @__PURE__ */ jsx14(ScoreDonutLegend, {}) }),
5449
+ isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */ jsxs13(
5079
5450
  "div",
5080
5451
  {
5081
5452
  role: "button",
@@ -5100,16 +5471,16 @@ function LinkingTab({
5100
5471
  cursor: "pointer"
5101
5472
  },
5102
5473
  children: [
5103
- /* @__PURE__ */ jsx13("span", { style: { fontSize: 11, color: "#92400e" }, children: "Your article changed since these were generated." }),
5104
- /* @__PURE__ */ jsx13("span", { style: { fontSize: 11, fontWeight: 700, color: "#8B7310", textDecoration: "underline", flexShrink: 0 }, children: "Refresh" })
5474
+ /* @__PURE__ */ jsx14("span", { style: { fontSize: 11, color: "#92400e" }, children: "Your article changed since these were generated." }),
5475
+ /* @__PURE__ */ jsx14("span", { style: { fontSize: 11, fontWeight: 700, color: "#8B7310", textDecoration: "underline", flexShrink: 0 }, children: "Refresh" })
5105
5476
  ]
5106
5477
  }
5107
5478
  ),
5108
- isLoading && suggestions.length === 0 && /* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
5109
- /* @__PURE__ */ jsx13(LoadingBars, { size: "xs", color: MJH_BLUE }),
5110
- /* @__PURE__ */ jsx13("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Ranking candidates..." })
5479
+ isLoading && suggestions.length === 0 && /* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
5480
+ /* @__PURE__ */ jsx14(LoadingBars, { size: "xs", color: MJH_BLUE }),
5481
+ /* @__PURE__ */ jsx14("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Ranking candidates..." })
5111
5482
  ] }),
5112
- !isLoading && error && /* @__PURE__ */ jsxs12(
5483
+ !isLoading && error && /* @__PURE__ */ jsxs13(
5113
5484
  "div",
5114
5485
  {
5115
5486
  style: {
@@ -5120,9 +5491,9 @@ function LinkingTab({
5120
5491
  textAlign: "center"
5121
5492
  },
5122
5493
  children: [
5123
- /* @__PURE__ */ jsx13("div", { style: { fontSize: 11.5, color: "#b91c1c", fontWeight: 600, marginBottom: 2 }, children: "Couldn't load suggestions" }),
5124
- /* @__PURE__ */ jsx13("div", { style: { fontSize: 10.5, color: "#4b5563", marginBottom: 8 }, children: error }),
5125
- /* @__PURE__ */ jsx13(
5494
+ /* @__PURE__ */ jsx14("div", { style: { fontSize: 11.5, color: "#b91c1c", fontWeight: 600, marginBottom: 2 }, children: "Couldn't load suggestions" }),
5495
+ /* @__PURE__ */ jsx14("div", { style: { fontSize: 10.5, color: "#4b5563", marginBottom: 8 }, children: error }),
5496
+ /* @__PURE__ */ jsx14(
5126
5497
  "button",
5127
5498
  {
5128
5499
  onClick: onRefresh,
@@ -5142,120 +5513,178 @@ function LinkingTab({
5142
5513
  ]
5143
5514
  }
5144
5515
  ),
5145
- !isLoading && !error && suggestions.length === 0 && /* @__PURE__ */ jsxs12("div", { style: { fontSize: 11, color: "#1f2937", padding: "10px 12px", lineHeight: 1.55, background: "rgba(0,93,172,0.04)", borderRadius: 8, border: "1px solid rgba(0,93,172,0.12)" }, children: [
5146
- /* @__PURE__ */ jsx13("div", { style: { fontWeight: 700, marginBottom: 4, color: "#1f2937" }, children: "No closely related articles found." }),
5147
- /* @__PURE__ */ jsx13("div", { style: { color: "#4b5563" }, children: "Linking searched your publication for articles on this topic and did not find a strong match. As more related content is published, suggestions will appear here." })
5516
+ !isLoading && !error && suggestions.length === 0 && /* @__PURE__ */ jsxs13("div", { style: { fontSize: 11, color: "#1f2937", padding: "10px 12px", lineHeight: 1.55, background: "rgba(0,93,172,0.04)", borderRadius: 8, border: "1px solid rgba(0,93,172,0.12)" }, children: [
5517
+ /* @__PURE__ */ jsx14("div", { style: { fontWeight: 700, marginBottom: 4, color: "#1f2937" }, children: "No closely related articles found." }),
5518
+ /* @__PURE__ */ jsx14("div", { style: { color: "#4b5563" }, children: "Linking searched your publication for articles on this topic and did not find a strong match. As more related content is published, suggestions will appear here." })
5148
5519
  ] }),
5149
- suggestions.length > 0 && /* @__PURE__ */ jsx13("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: suggestions.map((s) => /* @__PURE__ */ jsxs12(
5150
- "div",
5151
- {
5152
- style: {
5153
- padding: "10px 12px",
5154
- background: "rgba(0,93,172,0.03)",
5155
- borderRadius: 10,
5156
- borderLeft: `2px solid ${MJH_BLUE}`,
5157
- display: "flex",
5158
- gap: 12,
5159
- alignItems: "flex-start"
5160
- },
5161
- children: [
5162
- /* @__PURE__ */ jsx13(
5163
- ScoreDonut,
5164
- {
5165
- size: 64,
5166
- topic: Math.max(0, Math.min(100, s.topicScore)),
5167
- freshness: Math.max(0, Math.min(100, s.freshnessScore)),
5168
- sectionFit: Math.max(0, Math.min(100, s.sectionFitScore)),
5169
- composite: Math.max(0, Math.min(100, s.compositeScore))
5170
- }
5171
- ),
5172
- /* @__PURE__ */ jsxs12("div", { style: { flex: 1, minWidth: 0 }, children: [
5173
- /* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3, flexWrap: "wrap" }, children: [
5174
- freshnessChip(s.freshnessLabel, s.freshnessScore),
5175
- s.publishedAt && /* @__PURE__ */ jsx13("span", { style: { fontSize: 10, color: "#4b5563" }, children: formatDate(s.publishedAt) })
5176
- ] }),
5177
- /* @__PURE__ */ jsx13("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", lineHeight: 1.4, marginBottom: 2 }, children: s.title }),
5178
- /* @__PURE__ */ jsxs12("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", marginBottom: 6 }, children: [
5179
- "/",
5180
- s.slug
5181
- ] }),
5182
- (() => {
5183
- const liveUrl = buildLiveUrl(publication, s.slug);
5184
- const sanityUrl = buildSanityUrl(sanityBaseUrl, s._id);
5185
- if (!liveUrl && !sanityUrl) return null;
5186
- return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginBottom: 6 }, children: [
5187
- sanityUrl && /* @__PURE__ */ jsx13(LinkChip, { href: sanityUrl, label: "Inside Sanity", color: MJH_BLUE }),
5188
- liveUrl && /* @__PURE__ */ jsx13(LinkChip, { href: liveUrl, label: "Live site", color: "#4b5563" })
5189
- ] });
5190
- })(),
5191
- s.relevanceReason && /* @__PURE__ */ jsxs12("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 6, lineHeight: 1.45 }, children: [
5192
- /* @__PURE__ */ jsx13("span", { style: { fontWeight: 700, color: "#4b5563" }, children: "Why it fits:" }),
5193
- " ",
5194
- /* @__PURE__ */ jsx13("span", { style: { fontStyle: "italic" }, children: s.relevanceReason })
5520
+ suggestions.length > 0 && /* @__PURE__ */ jsx14("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: suggestions.map((s) => {
5521
+ const liveUrl = buildLiveUrl(publication, s.slug);
5522
+ const sanityUrl = buildSanityUrl(sanityBaseUrl, s._id);
5523
+ return /* @__PURE__ */ jsxs13(
5524
+ "div",
5525
+ {
5526
+ style: {
5527
+ padding: "10px 12px",
5528
+ background: "rgba(0,93,172,0.03)",
5529
+ borderRadius: 10,
5530
+ borderLeft: `2px solid ${MJH_BLUE}`,
5531
+ display: "flex",
5532
+ gap: 12,
5533
+ alignItems: "flex-start"
5534
+ },
5535
+ children: [
5536
+ /* @__PURE__ */ jsx14(
5537
+ ScoreDonut,
5538
+ {
5539
+ size: 64,
5540
+ topic: Math.max(0, Math.min(100, s.topicScore)),
5541
+ freshness: Math.max(0, Math.min(100, s.freshnessScore)),
5542
+ sectionFit: Math.max(0, Math.min(100, s.sectionFitScore)),
5543
+ composite: Math.max(0, Math.min(100, s.compositeScore))
5544
+ }
5545
+ ),
5546
+ /* @__PURE__ */ jsxs13("div", { style: { flex: 1, minWidth: 0 }, children: [
5547
+ /* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3, flexWrap: "wrap" }, children: [
5548
+ freshnessChip(s.freshnessLabel, s.freshnessScore),
5549
+ s.publishedAt && /* @__PURE__ */ jsx14("span", { style: { fontSize: 10, color: "#4b5563" }, children: formatDate(s.publishedAt) }),
5550
+ /* @__PURE__ */ jsx14(ClickableBadge, { clickable: !!liveUrl })
5551
+ ] }),
5552
+ /* @__PURE__ */ jsx14("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", lineHeight: 1.4, marginBottom: 2 }, children: s.title }),
5553
+ /* @__PURE__ */ jsxs13("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", marginBottom: 6 }, children: [
5554
+ "/",
5555
+ s.slug
5556
+ ] }),
5557
+ (liveUrl || sanityUrl) && /* @__PURE__ */ jsxs13("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginBottom: 6 }, children: [
5558
+ sanityUrl && /* @__PURE__ */ jsx14(LinkChip, { href: sanityUrl, label: "Inside Sanity", color: MJH_BLUE }),
5559
+ liveUrl && /* @__PURE__ */ jsx14(LinkChip, { href: liveUrl, label: "Live site", color: "#4b5563" })
5560
+ ] }),
5561
+ s.relevanceReason && /* @__PURE__ */ jsxs13("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 6, lineHeight: 1.45 }, children: [
5562
+ /* @__PURE__ */ jsx14("span", { style: { fontWeight: 700, color: "#4b5563" }, children: "Why it fits:" }),
5563
+ " ",
5564
+ /* @__PURE__ */ jsx14("span", { style: { fontStyle: "italic" }, children: s.relevanceReason })
5565
+ ] }),
5566
+ s.anchorQuote && /* @__PURE__ */ jsxs13(
5567
+ "div",
5568
+ {
5569
+ style: {
5570
+ marginTop: 4,
5571
+ padding: "6px 9px",
5572
+ background: "rgba(0,0,0,0.025)",
5573
+ borderRadius: 6,
5574
+ borderLeft: "2px solid #cbd5e1",
5575
+ fontSize: 11,
5576
+ color: "#1f2937",
5577
+ lineHeight: 1.5
5578
+ },
5579
+ children: [
5580
+ /* @__PURE__ */ jsxs13("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 3 }, children: [
5581
+ "Where to link from - paragraph ",
5582
+ s.anchorParagraph
5583
+ ] }),
5584
+ /* @__PURE__ */ jsxs13("div", { style: { fontStyle: "italic" }, children: [
5585
+ '"',
5586
+ s.anchorQuote,
5587
+ '"'
5588
+ ] }),
5589
+ s.anchorReason && /* @__PURE__ */ jsx14("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 3, lineHeight: 1.45 }, children: s.anchorReason })
5590
+ ]
5591
+ }
5592
+ )
5195
5593
  ] }),
5196
- s.anchorQuote && /* @__PURE__ */ jsxs12(
5197
- "div",
5594
+ /* @__PURE__ */ jsx14("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx14(
5595
+ FeedbackButton,
5198
5596
  {
5199
- style: {
5200
- marginTop: 4,
5201
- padding: "6px 9px",
5202
- background: "rgba(0,0,0,0.025)",
5203
- borderRadius: 6,
5204
- borderLeft: "2px solid #cbd5e1",
5205
- fontSize: 11,
5206
- color: "#1f2937",
5207
- lineHeight: 1.5
5208
- },
5209
- children: [
5210
- /* @__PURE__ */ jsxs12("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 3 }, children: [
5211
- "Where to link from - paragraph ",
5212
- s.anchorParagraph
5213
- ] }),
5214
- /* @__PURE__ */ jsxs12("div", { style: { fontStyle: "italic" }, children: [
5215
- '"',
5216
- s.anchorQuote,
5217
- '"'
5218
- ] }),
5219
- s.anchorReason && /* @__PURE__ */ jsx13("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 3, lineHeight: 1.45 }, children: s.anchorReason })
5220
- ]
5597
+ suggestionType: "internal_link",
5598
+ suggestionText: s.title,
5599
+ publication,
5600
+ documentId
5221
5601
  }
5222
- )
5223
- ] }),
5224
- /* @__PURE__ */ jsx13("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx13(
5225
- FeedbackButton,
5226
- {
5227
- suggestionType: "internal_link",
5228
- suggestionText: s.title,
5229
- publication,
5230
- documentId
5231
- }
5232
- ) })
5233
- ]
5234
- },
5235
- s._id
5236
- )) })
5602
+ ) })
5603
+ ]
5604
+ },
5605
+ s._id
5606
+ );
5607
+ }) })
5237
5608
  ] }) });
5238
5609
  }
5239
5610
 
5240
5611
  // src/components/tabs/MetaTab.tsx
5241
5612
  import { useMemo as useMemo3 } from "react";
5242
- import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
5243
- var cardStyle5 = {
5244
- borderRadius: 14,
5245
- background: "rgba(255,255,255,0.55)",
5246
- backdropFilter: "blur(16px) saturate(170%)",
5247
- WebkitBackdropFilter: "blur(16px) saturate(170%)",
5248
- boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.85), inset 1.5px 2px 1px -1px rgba(255,255,255,1), inset -2px -3px 2px -1px rgba(255,255,255,0.6), 0 2px 6px rgba(0,0,0,0.07), 0 10px 26px rgba(0,0,0,0.08)",
5249
- padding: "14px"
5250
- };
5251
- function StatusBadge({ status }) {
5252
- const map = {
5253
- good: { bg: "rgba(22,163,74,0.12)", color: "#16a34a", label: "Good" },
5254
- warning: { bg: "rgba(230,192,27,0.18)", color: "#8B7310", label: "Review" },
5255
- error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
5256
- };
5257
- const c = map[status];
5258
- return /* @__PURE__ */ jsx14(
5613
+ import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
5614
+ var GOOGLE_EEAT_URL = "https://developers.google.com/search/docs/fundamentals/creating-helpful-content#eat";
5615
+ function ExternalLinkChip({ href, label }) {
5616
+ return /* @__PURE__ */ jsxs14(
5617
+ "a",
5618
+ {
5619
+ href,
5620
+ target: "_blank",
5621
+ rel: "noopener noreferrer",
5622
+ style: {
5623
+ display: "inline-flex",
5624
+ alignItems: "center",
5625
+ gap: 4,
5626
+ marginTop: 8,
5627
+ padding: "3px 9px",
5628
+ borderRadius: 99,
5629
+ fontSize: 10.5,
5630
+ fontWeight: 700,
5631
+ color: MJH_BLUE,
5632
+ background: "rgba(255,255,255,0.7)",
5633
+ border: `1px solid ${MJH_BLUE}33`,
5634
+ textDecoration: "none",
5635
+ lineHeight: 1.2
5636
+ },
5637
+ children: [
5638
+ label,
5639
+ /* @__PURE__ */ jsxs14("svg", { width: "9", height: "9", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
5640
+ /* @__PURE__ */ jsx15("path", { d: "M12.5 2a.75.75 0 000 1.5h2.44l-6.97 6.97a.75.75 0 101.06 1.06L16 4.56V7a.75.75 0 001.5 0V2.75A.75.75 0 0016.75 2H12.5z" }),
5641
+ /* @__PURE__ */ jsx15("path", { d: "M4.75 4.5A2.75 2.75 0 002 7.25v8A2.75 2.75 0 004.75 18h8A2.75 2.75 0 0015.5 15.25v-3a.75.75 0 00-1.5 0v3c0 .69-.56 1.25-1.25 1.25h-8c-.69 0-1.25-.56-1.25-1.25v-8c0-.69.56-1.25 1.25-1.25h3a.75.75 0 000-1.5h-3z" })
5642
+ ] })
5643
+ ]
5644
+ }
5645
+ );
5646
+ }
5647
+ function FreshnessNotice() {
5648
+ return /* @__PURE__ */ jsxs14(
5649
+ "div",
5650
+ {
5651
+ style: {
5652
+ padding: "9px 12px",
5653
+ background: "rgba(0,93,172,0.05)",
5654
+ border: "1px solid rgba(0,93,172,0.15)",
5655
+ borderLeft: `3px solid ${MJH_BLUE}`,
5656
+ borderRadius: 8,
5657
+ fontSize: 11,
5658
+ color: "#1f2937",
5659
+ lineHeight: 1.5
5660
+ },
5661
+ children: [
5662
+ /* @__PURE__ */ jsx15("span", { style: { fontWeight: 700, color: MJH_BLUE }, children: "Keep it fresh. " }),
5663
+ "Planning to update this article after it's published? Set the ",
5664
+ /* @__PURE__ */ jsx15("strong", { children: "Updated on" }),
5665
+ " date in Sanity (e.g. \u201CUpdated: February 19, 2026\u201D). It surfaces the article in ",
5666
+ /* @__PURE__ */ jsx15("strong", { children: "Latest Updated Articles" }),
5667
+ " and increases its visibility in search engine results."
5668
+ ]
5669
+ }
5670
+ );
5671
+ }
5672
+ var cardStyle5 = {
5673
+ borderRadius: 14,
5674
+ background: "rgba(255,255,255,0.55)",
5675
+ backdropFilter: "blur(16px) saturate(170%)",
5676
+ WebkitBackdropFilter: "blur(16px) saturate(170%)",
5677
+ boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.85), inset 1.5px 2px 1px -1px rgba(255,255,255,1), inset -2px -3px 2px -1px rgba(255,255,255,0.6), 0 2px 6px rgba(0,0,0,0.07), 0 10px 26px rgba(0,0,0,0.08)",
5678
+ padding: "14px"
5679
+ };
5680
+ function StatusBadge({ status }) {
5681
+ const map = {
5682
+ good: { bg: "rgba(22,163,74,0.12)", color: "#16a34a", label: "Good" },
5683
+ warning: { bg: "rgba(230,192,27,0.18)", color: "#8B7310", label: "Review" },
5684
+ error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
5685
+ };
5686
+ const c = map[status];
5687
+ return /* @__PURE__ */ jsx15(
5259
5688
  "span",
5260
5689
  {
5261
5690
  style: {
@@ -5274,12 +5703,12 @@ function StatusBadge({ status }) {
5274
5703
  );
5275
5704
  }
5276
5705
  function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
5277
- return /* @__PURE__ */ jsxs13("div", { id: anchorId, style: cardStyle5, children: [
5278
- /* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5279
- /* @__PURE__ */ jsx14("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
5280
- /* @__PURE__ */ jsx14(StatusBadge, { status })
5706
+ return /* @__PURE__ */ jsxs14("div", { id: anchorId, style: cardStyle5, children: [
5707
+ /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5708
+ /* @__PURE__ */ jsx15("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
5709
+ /* @__PURE__ */ jsx15(StatusBadge, { status })
5281
5710
  ] }),
5282
- /* @__PURE__ */ jsx14(
5711
+ /* @__PURE__ */ jsx15(
5283
5712
  "div",
5284
5713
  {
5285
5714
  style: {
@@ -5292,7 +5721,7 @@ function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
5292
5721
  children: value
5293
5722
  }
5294
5723
  ),
5295
- recommendation && /* @__PURE__ */ jsx14(
5724
+ recommendation && /* @__PURE__ */ jsx15(
5296
5725
  "div",
5297
5726
  {
5298
5727
  style: {
@@ -5441,41 +5870,66 @@ function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }
5441
5870
  } else {
5442
5871
  items.push({ label: "Author Byline", value: `${author}, ${creds}`, status: "good" });
5443
5872
  }
5444
- const published = documentFields?.publishedAt;
5445
- const updated = documentFields?.updatedAt;
5446
- const reviewed = documentFields?.lastReviewedAt;
5447
- const daysPub = daysSince(published);
5448
- const daysUpd = daysSince(updated);
5449
- const daysRev = daysSince(reviewed);
5450
- const freshness = Math.min(...[daysUpd, daysRev, daysPub].filter((d) => d !== null));
5451
- if (!published) {
5452
- items.push({ label: "Publish Date", value: "Missing", status: "error", recommendation: "Add a visible publish date. Required for healthcare content to be cited by Google and AI search." });
5453
- } else if (daysPub === null) {
5454
- items.push({ label: "Publish Date", value: "Unrecognized format", status: "warning", recommendation: "A publish date is set but couldn't be read as a valid date. Check the field value." });
5873
+ items[0].footer = /* @__PURE__ */ jsx15(ExternalLinkChip, { href: GOOGLE_EEAT_URL, label: "Google's E-E-A-T guidelines" });
5874
+ const factChecker = documentFields?.factCheckerName;
5875
+ const factCheckerRef = documentFields?.factCheckerIsReference;
5876
+ if (factChecker) {
5877
+ items.push({ label: "Fact-Checker", value: factChecker, status: "good" });
5878
+ } else if (factCheckerRef) {
5879
+ items.push({ label: "Fact-Checker", value: "Set (reference)", status: "good", recommendation: "A fact-checker is linked as a reference. Open the linked person to confirm the name shows on the published page." });
5455
5880
  } else {
5456
- items.push({ label: "Publish Date", value: formatDateShort(published), status: "good" });
5881
+ items.push({ label: "Fact-Checker", value: "Not set", status: "warning", recommendation: 'Add a second named person as a fact-checker, separate from the author. A visible "Fact checked by" line is a strong trust signal for healthcare content.' });
5457
5882
  }
5458
- if (Number.isFinite(freshness)) {
5459
- if (freshness <= 14) {
5460
- items.push({ label: "Last Updated", value: `${freshness} day${freshness === 1 ? "" : "s"} ago`, status: "good" });
5461
- } else if (freshness <= 90) {
5462
- items.push({ label: "Last Updated", value: `${freshness} days ago`, status: "warning", recommendation: "Articles older than two weeks get cited less by AI search. If the content is still accurate, refresh stats or add a last-reviewed date." });
5883
+ const dated = [];
5884
+ const addDate = (verb, days) => {
5885
+ if (days !== null) dated.push({ verb, days });
5886
+ };
5887
+ addDate("Updated", daysSince(documentFields?.updatedAt));
5888
+ addDate("Reviewed", daysSince(documentFields?.lastReviewedAt));
5889
+ addDate("Published", daysSince(documentFields?.publishedAt));
5890
+ if (dated.length > 0) {
5891
+ const freshest = dated.reduce((a, b) => b.days < a.days ? b : a);
5892
+ const days = freshest.days;
5893
+ const ago = days <= 0 ? "today" : days === 1 ? "1 day ago" : `${days} days ago`;
5894
+ const value = `${freshest.verb} ${ago}`;
5895
+ if (days <= 14) {
5896
+ items.push({ label: "Content Freshness", value, status: "good", recommendation: "Recent content gets cited and ranked more. Re-set the Updated-on date whenever you revise to keep it fresh." });
5897
+ } else if (days <= 90) {
5898
+ items.push({ label: "Content Freshness", value, status: "warning", recommendation: "Content older than two weeks gets cited less by AI search. If it's still accurate, refresh a stat and set the Updated-on date in Sanity." });
5463
5899
  } else {
5464
- items.push({ label: "Last Updated", value: `${freshness} days ago`, status: "error", recommendation: "Older than 90 days. Review the facts, update what's stale, and timestamp the refresh." });
5900
+ items.push({ label: "Content Freshness", value, status: "error", recommendation: "Over 90 days old. Review the facts, update what's stale, and set the Updated-on date in Sanity." });
5465
5901
  }
5466
5902
  }
5467
5903
  return items;
5468
5904
  }, [documentFields]);
5905
+ const publishDateItem = useMemo3(() => {
5906
+ const published = documentFields?.publishedAt;
5907
+ const daysPub = daysSince(published);
5908
+ if (!published) return { label: "Publish Date", value: "Missing", status: "error", recommendation: "Add a visible publish date. Required for healthcare content to be cited by Google and AI search." };
5909
+ if (daysPub === null) return { label: "Publish Date", value: "Unrecognized format", status: "warning", recommendation: "A publish date is set but couldn't be read as a valid date. Check the field value." };
5910
+ return { label: "Publish Date", value: formatDateShort(published), status: "good" };
5911
+ }, [documentFields]);
5469
5912
  const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.metaDescription !== void 0 || documentFields.slug !== void 0);
5470
5913
  if (isLoading && !hasAnyField) {
5471
- return /* @__PURE__ */ jsxs13("div", { style: { padding: 24, textAlign: "center" }, children: [
5472
- /* @__PURE__ */ jsx14("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
5473
- /* @__PURE__ */ jsx14("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
5914
+ return /* @__PURE__ */ jsxs14("div", { style: { padding: 24, textAlign: "center" }, children: [
5915
+ /* @__PURE__ */ jsx15("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
5916
+ /* @__PURE__ */ jsx15("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
5474
5917
  ] });
5475
5918
  }
5476
5919
  const auditAnchors = ["anchor-meta-title", "anchor-meta-description"];
5477
- return /* @__PURE__ */ jsxs13("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
5478
- audits.map((a, i) => /* @__PURE__ */ jsx14(
5920
+ return /* @__PURE__ */ jsxs14("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
5921
+ /* @__PURE__ */ jsx15(FreshnessNotice, {}),
5922
+ /* @__PURE__ */ jsx15(
5923
+ AuditCard,
5924
+ {
5925
+ anchorId: "anchor-publish-date",
5926
+ label: publishDateItem.label,
5927
+ value: publishDateItem.value,
5928
+ status: publishDateItem.status,
5929
+ recommendation: publishDateItem.recommendation
5930
+ }
5931
+ ),
5932
+ audits.map((a, i) => /* @__PURE__ */ jsx15(
5479
5933
  AuditCard,
5480
5934
  {
5481
5935
  anchorId: auditAnchors[i],
@@ -5486,20 +5940,21 @@ function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }
5486
5940
  },
5487
5941
  i
5488
5942
  )),
5489
- eeatItems.length > 0 && /* @__PURE__ */ jsxs13(Fragment7, { children: [
5490
- /* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", gap: 8, margin: "6px 4px 0" }, children: [
5491
- /* @__PURE__ */ jsx14("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } }),
5492
- /* @__PURE__ */ jsx14("span", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Author & Freshness" }),
5493
- /* @__PURE__ */ jsx14("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } })
5943
+ eeatItems.length > 0 && /* @__PURE__ */ jsxs14(Fragment8, { children: [
5944
+ /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", gap: 8, margin: "6px 4px 0" }, children: [
5945
+ /* @__PURE__ */ jsx15("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } }),
5946
+ /* @__PURE__ */ jsx15("span", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Author & Freshness" }),
5947
+ /* @__PURE__ */ jsx15("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } })
5494
5948
  ] }),
5495
- /* @__PURE__ */ jsx14("div", { style: { fontSize: 10, color: "#4b5563", padding: "0 4px", marginTop: -4 }, children: "Google looks for a named author with credentials and recent updates on healthcare content." }),
5496
- eeatItems.map((item, i) => /* @__PURE__ */ jsx14(
5949
+ /* @__PURE__ */ jsx15("div", { style: { fontSize: 10, color: "#4b5563", padding: "0 4px", marginTop: -4 }, children: "Google looks for a named author with credentials and recent updates on healthcare content." }),
5950
+ eeatItems.map((item, i) => /* @__PURE__ */ jsx15(
5497
5951
  AuditCard,
5498
5952
  {
5499
5953
  label: item.label,
5500
5954
  value: item.value,
5501
5955
  status: item.status,
5502
- recommendation: item.recommendation
5956
+ recommendation: item.recommendation,
5957
+ footer: item.footer
5503
5958
  },
5504
5959
  `eeat-${i}`
5505
5960
  ))
@@ -5508,8 +5963,8 @@ function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }
5508
5963
  }
5509
5964
 
5510
5965
  // src/components/tabs/TechnicalTab.tsx
5511
- import { useMemo as useMemo4, useState as useState15 } from "react";
5512
- import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
5966
+ import { useMemo as useMemo4, useState as useState16 } from "react";
5967
+ import { Fragment as Fragment9, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
5513
5968
  function urlAudit(slug, primaryKeyword, secondaryKeyword) {
5514
5969
  const SHORT_DESC = "Keep the URL short and descriptive - concise URLs are easier to read - and avoid trailing, duplicate, or excessive spaces.";
5515
5970
  if (!slug) {
@@ -5544,28 +5999,28 @@ function urlAudit(slug, primaryKeyword, secondaryKeyword) {
5544
5999
  return { label: "URL Slug", value: `/${slug}`, status: "good" };
5545
6000
  }
5546
6001
  function SlugRedirectNotice() {
5547
- const [expanded, setExpanded] = useState15(false);
5548
- return /* @__PURE__ */ jsx15("div", { style: { marginTop: 10, paddingTop: 10, borderTop: "1px solid rgba(0,0,0,0.07)" }, children: /* @__PURE__ */ jsxs14("div", { style: { padding: "8px 10px", background: "rgba(245,158,11,0.08)", borderLeft: "2px solid #f59e0b", borderRadius: 6 }, children: [
5549
- /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
5550
- /* @__PURE__ */ jsx15("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "#f59e0b", "aria-hidden": "true", children: /* @__PURE__ */ jsx15("path", { fillRule: "evenodd", d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z", clipRule: "evenodd" }) }),
5551
- /* @__PURE__ */ jsx15("span", { style: { fontSize: 10.5, fontWeight: 700, color: "#b45309", textTransform: "uppercase", letterSpacing: "0.06em" }, children: "Changing a URL?" })
6002
+ const [expanded, setExpanded] = useState16(false);
6003
+ return /* @__PURE__ */ jsx16("div", { style: { marginTop: 10, paddingTop: 10, borderTop: "1px solid rgba(0,0,0,0.07)" }, children: /* @__PURE__ */ jsxs15("div", { style: { padding: "8px 10px", background: "rgba(245,158,11,0.08)", borderLeft: "2px solid #f59e0b", borderRadius: 6 }, children: [
6004
+ /* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
6005
+ /* @__PURE__ */ jsx16("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "#f59e0b", "aria-hidden": "true", children: /* @__PURE__ */ jsx16("path", { fillRule: "evenodd", d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z", clipRule: "evenodd" }) }),
6006
+ /* @__PURE__ */ jsx16("span", { style: { fontSize: 10.5, fontWeight: 700, color: "#b45309", textTransform: "uppercase", letterSpacing: "0.06em" }, children: "Changing a URL?" })
5552
6007
  ] }),
5553
- /* @__PURE__ */ jsx15("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: "If the page has been published and indexed, you MUST add a 301 redirect from the old slug to the new one before changing it. For a brand-new page that's never been published, no redirect needed." }),
5554
- /* @__PURE__ */ jsxs14(
6008
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: "If the page has been published and indexed, you MUST add a 301 redirect from the old slug to the new one before changing it. For a brand-new page that's never been published, no redirect needed." }),
6009
+ /* @__PURE__ */ jsxs15(
5555
6010
  "button",
5556
6011
  {
5557
6012
  onClick: () => setExpanded((v) => !v),
5558
6013
  style: { display: "flex", alignItems: "center", gap: 3, marginTop: 6, padding: 0, background: "none", border: "none", cursor: "pointer", fontSize: 10.5, fontWeight: 700, color: "#b45309", fontFamily: "inherit" },
5559
6014
  children: [
5560
6015
  expanded ? "Show less" : "Learn more",
5561
- /* @__PURE__ */ jsx15("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: expanded ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx15("path", { fillRule: "evenodd", d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z", clipRule: "evenodd" }) })
6016
+ /* @__PURE__ */ jsx16("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: expanded ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx16("path", { fillRule: "evenodd", d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z", clipRule: "evenodd" }) })
5562
6017
  ]
5563
6018
  }
5564
6019
  ),
5565
- expanded && /* @__PURE__ */ jsxs14("ul", { style: { margin: "6px 0 0", paddingLeft: 16, fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: [
5566
- /* @__PURE__ */ jsx15("li", { children: "Without the 301, the page loses every search ranking and every external link to it breaks." }),
5567
- /* @__PURE__ */ jsx15("li", { children: "A 301 preserves the rankings and link equity built up on the old URL." }),
5568
- /* @__PURE__ */ jsx15("li", { children: "Set this up using vanity redirects in Sanity." })
6020
+ expanded && /* @__PURE__ */ jsxs15("ul", { style: { margin: "6px 0 0", paddingLeft: 16, fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: [
6021
+ /* @__PURE__ */ jsx16("li", { children: "Without the 301, the page loses every search ranking and every external link to it breaks." }),
6022
+ /* @__PURE__ */ jsx16("li", { children: "A 301 preserves the rankings and link equity built up on the old URL." }),
6023
+ /* @__PURE__ */ jsx16("li", { children: "Set this up using vanity redirects in Sanity." })
5569
6024
  ] })
5570
6025
  ] }) });
5571
6026
  }
@@ -5584,7 +6039,7 @@ function StatusBadge2({ status }) {
5584
6039
  error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
5585
6040
  };
5586
6041
  const c = map[status];
5587
- return /* @__PURE__ */ jsx15(
6042
+ return /* @__PURE__ */ jsx16(
5588
6043
  "span",
5589
6044
  {
5590
6045
  style: {
@@ -5610,12 +6065,12 @@ function AuditCard2({
5610
6065
  anchorId,
5611
6066
  footer
5612
6067
  }) {
5613
- return /* @__PURE__ */ jsxs14("div", { id: anchorId, style: cardStyle6, children: [
5614
- /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5615
- /* @__PURE__ */ jsx15("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
5616
- /* @__PURE__ */ jsx15(StatusBadge2, { status })
6068
+ return /* @__PURE__ */ jsxs15("div", { id: anchorId, style: cardStyle6, children: [
6069
+ /* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
6070
+ /* @__PURE__ */ jsx16("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
6071
+ /* @__PURE__ */ jsx16(StatusBadge2, { status })
5617
6072
  ] }),
5618
- /* @__PURE__ */ jsx15(
6073
+ /* @__PURE__ */ jsx16(
5619
6074
  "div",
5620
6075
  {
5621
6076
  style: {
@@ -5628,7 +6083,7 @@ function AuditCard2({
5628
6083
  children: value
5629
6084
  }
5630
6085
  ),
5631
- recommendation && /* @__PURE__ */ jsx15(
6086
+ recommendation && /* @__PURE__ */ jsx16(
5632
6087
  "div",
5633
6088
  {
5634
6089
  style: {
@@ -5760,7 +6215,7 @@ function imageTitleAudit(titles, imageCount) {
5760
6215
  status: "good"
5761
6216
  };
5762
6217
  }
5763
- function computeHeadingStructureAudits(headings, wordCount2) {
6218
+ function computeHeadingStructureAudits(headings, wordCount2, primaryKeyword, secondaryKeyword, unstyledHeadings) {
5764
6219
  const audits = [];
5765
6220
  const sectionCount = headings.filter((h) => h.level === 2 || h.level === 3).length;
5766
6221
  let densityFired = false;
@@ -5789,26 +6244,27 @@ function computeHeadingStructureAudits(headings, wordCount2) {
5789
6244
  });
5790
6245
  densityFired = true;
5791
6246
  }
6247
+ if (unstyledHeadings && unstyledHeadings.length > 0) {
6248
+ const n = unstyledHeadings.length;
6249
+ const examples = unstyledHeadings.slice(0, 2).map((t) => `"${t}"`).join(", ");
6250
+ audits.push({
6251
+ label: "Looks Like a Heading",
6252
+ value: `${n} line${n === 1 ? "" : "s"} read${n === 1 ? "s" : ""} like a heading but ${n === 1 ? "isn't" : "aren't"} styled`,
6253
+ status: "warning",
6254
+ recommendation: `${examples}${n > 2 ? ", and more," : ""} ${n === 1 ? "looks" : "look"} like a section heading typed as plain text. In Sanity, select the line and apply the "Heading 2" style so it counts as a real heading.`
6255
+ });
6256
+ }
5792
6257
  if (headings.length === 0) {
5793
6258
  if (!densityFired) {
5794
6259
  audits.push({
5795
6260
  label: "Heading Structure",
5796
6261
  value: "No headings in body",
5797
6262
  status: "warning",
5798
- recommendation: "Add H2 headings to break the article into scannable sections."
6263
+ recommendation: "Consider adding H2-H6 subheadings to structure the article into scannable sections."
5799
6264
  });
5800
6265
  }
5801
6266
  return audits;
5802
6267
  }
5803
- const h1s = headings.filter((h) => h.level === 1);
5804
- if (h1s.length > 0) {
5805
- audits.push({
5806
- label: "H1 in body",
5807
- value: `${h1s.length} H1 heading${h1s.length === 1 ? "" : "s"} in the body`,
5808
- status: "warning",
5809
- recommendation: "The article title is your H1. Body headings should start at H2 so the outline isn't ambiguous."
5810
- });
5811
- }
5812
6268
  let prevLevel = 0;
5813
6269
  const skips = [];
5814
6270
  for (const h of headings) {
@@ -5842,266 +6298,171 @@ function computeHeadingStructureAudits(headings, wordCount2) {
5842
6298
  status: "good"
5843
6299
  });
5844
6300
  }
6301
+ const subheads = headings.filter((h) => h.level >= 2);
6302
+ const subheadingText = subheads.map((h) => h.text).join(" ");
6303
+ const hasPrimaryInHeads = primaryKeyword ? containsKeywordTokens(subheadingText, primaryKeyword) : false;
6304
+ const hasSecondaryInHeads = secondaryKeyword ? containsKeywordTokens(subheadingText, secondaryKeyword) : false;
6305
+ if (subheads.length > 0 && (primaryKeyword || secondaryKeyword) && !hasPrimaryInHeads && !hasSecondaryInHeads) {
6306
+ const kw = [
6307
+ primaryKeyword ? `primary keyword "${primaryKeyword}"` : "",
6308
+ secondaryKeyword ? `secondary keyword "${secondaryKeyword}"` : ""
6309
+ ].filter(Boolean).join(" or ");
6310
+ audits.push({
6311
+ label: "Keywords in Headings",
6312
+ value: "No subheading uses your target keyword",
6313
+ status: "warning",
6314
+ recommendation: `Work your ${kw} into at least one H2 or H3. Keywords in headers reinforce relevance for readers and search engines.`
6315
+ });
6316
+ }
5845
6317
  return audits;
5846
6318
  }
6319
+ function HealthBadge({ result }) {
6320
+ const map = {
6321
+ ok: { color: "#16a34a", label: "OK" },
6322
+ redirect: { color: "#8B7310", label: result.status > 0 ? String(result.status) : "REDIR" },
6323
+ broken: { color: "#dc2626", label: result.status > 0 ? String(result.status) : "404" },
6324
+ unverified: { color: "#b45309", label: result.status > 0 ? String(result.status) : "BLOCKED" },
6325
+ error: { color: "#dc2626", label: "ERR" }
6326
+ };
6327
+ const c = map[result.category];
6328
+ return /* @__PURE__ */ jsx16("span", { style: { fontSize: 9, fontWeight: 700, letterSpacing: "0.04em", padding: "2px 6px", borderRadius: 99, background: "#ffffff", color: c.color, fontVariantNumeric: "tabular-nums", flexShrink: 0, marginTop: 1 }, children: c.label });
6329
+ }
5847
6330
  function LinkCheckCard({
5848
6331
  urls,
6332
+ linksDetailed,
5849
6333
  results,
5850
6334
  isLoading,
5851
6335
  error,
5852
6336
  hasRun,
5853
6337
  onCheck
5854
6338
  }) {
5855
- const counts = useMemo4(() => {
5856
- const total = results.length;
5857
- const valid = results.filter((r) => r.category === "ok").length;
5858
- const redirects = results.filter((r) => r.category === "redirect").length;
5859
- const broken = results.filter((r) => r.category === "broken").length;
5860
- const errored = results.filter((r) => r.category === "error").length;
5861
- const unverified = results.filter((r) => r.category === "unverified").length;
5862
- const issues = results.filter((r) => r.category !== "ok");
5863
- return { total, valid, redirects, broken, errored, unverified, issues };
5864
- }, [results]);
5865
- return /* @__PURE__ */ jsxs14("div", { id: "anchor-link-check", style: cardStyle6, children: [
5866
- /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5867
- /* @__PURE__ */ jsx15("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: "Link Health" }),
5868
- hasRun && !isLoading && /* @__PURE__ */ jsx15(
5869
- "button",
5870
- {
5871
- onClick: onCheck,
5872
- style: {
5873
- background: "none",
5874
- border: "none",
5875
- fontSize: 10,
5876
- fontWeight: 600,
5877
- color: MJH_BLUE,
5878
- cursor: "pointer",
5879
- padding: "2px 4px"
5880
- },
5881
- title: "Run again",
5882
- children: "Re-check"
5883
- }
5884
- )
5885
- ] }),
5886
- /* @__PURE__ */ jsx15("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginBottom: 10 }, children: urls.length === 0 ? "No external links found in the body." : `${urls.length} link${urls.length === 1 ? "" : "s"} found in the body.` }),
5887
- urls.length > 0 && !hasRun && !isLoading && /* @__PURE__ */ jsxs14(
5888
- "button",
6339
+ const [openBucket, setOpenBucket] = useState16(null);
6340
+ const haveTypes = !!linksDetailed;
6341
+ const detailByUrl = useMemo4(
6342
+ () => new Map((linksDetailed || []).map((d) => [d.url, d])),
6343
+ [linksDetailed]
6344
+ );
6345
+ const resultByUrl = useMemo4(() => new Map(results.map((r) => [r.url, r])), [results]);
6346
+ const blockedUrls = results.filter((r) => r.category === "unverified").map((r) => r.url);
6347
+ const tiles = useMemo4(() => {
6348
+ const hyper = (linksDetailed || []).filter((l) => l.hyperlinked).map((l) => l.url);
6349
+ const plain = (linksDetailed || []).filter((l) => !l.hyperlinked).map((l) => l.url);
6350
+ const working = results.filter((r) => r.category === "ok" || r.category === "redirect").map((r) => r.url);
6351
+ const broken = results.filter((r) => r.category === "broken" || r.category === "error").map((r) => r.url);
6352
+ const t = [];
6353
+ if (hasRun) t.push({ key: "working", label: "Working", color: "#16a34a", urls: working });
6354
+ if (haveTypes) t.push({ key: "linked", label: "Linked", color: "#16a34a", urls: hyper });
6355
+ if (hasRun) t.push({ key: "broken", label: "Broken", color: "#dc2626", urls: broken });
6356
+ if (haveTypes) t.push({ key: "notlinked", label: "Not linked", color: "#dc2626", urls: plain, note: "Not links yet - hyperlink these so readers can click them and search engines can follow them." });
6357
+ return t;
6358
+ }, [haveTypes, linksDetailed, hasRun, results]);
6359
+ const open = tiles.find((t) => t.key === openBucket) || null;
6360
+ const renderLinkRow = (url) => {
6361
+ const d = detailByUrl.get(url);
6362
+ const r = resultByUrl.get(url);
6363
+ return /* @__PURE__ */ jsxs15(
6364
+ "a",
5889
6365
  {
5890
- onClick: onCheck,
5891
- style: {
5892
- width: "100%",
5893
- padding: "8px 12px",
5894
- fontSize: 11,
5895
- fontWeight: 700,
5896
- color: "#1f2937",
5897
- background: MJH_GOLD,
5898
- border: "none",
5899
- borderRadius: 6,
5900
- cursor: "pointer",
5901
- letterSpacing: "0.01em"
5902
- },
6366
+ href: url,
6367
+ target: "_blank",
6368
+ rel: "noopener noreferrer",
6369
+ style: { display: "flex", gap: 8, alignItems: "flex-start", padding: "6px 8px", background: "rgba(0,0,0,0.025)", borderRadius: 6, textDecoration: "none", marginTop: 4 },
5903
6370
  children: [
5904
- "Check ",
5905
- urls.length,
5906
- " link",
5907
- urls.length === 1 ? "" : "s",
5908
- " for 404s"
6371
+ r && /* @__PURE__ */ jsx16(HealthBadge, { result: r }),
6372
+ /* @__PURE__ */ jsxs15("div", { style: { minWidth: 0, flex: 1 }, children: [
6373
+ d?.anchorText && /* @__PURE__ */ jsxs15("div", { style: { fontSize: 11, color: "#1f2937", fontWeight: 600, lineHeight: 1.3, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
6374
+ "\u201C",
6375
+ d.anchorText,
6376
+ "\u201D"
6377
+ ] }),
6378
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", wordBreak: "break-all", lineHeight: 1.35 }, children: url })
6379
+ ] })
5909
6380
  ]
5910
- }
5911
- ),
5912
- isLoading && /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
5913
- /* @__PURE__ */ jsx15(LoadingBars, { size: "xs", color: MJH_BLUE }),
5914
- /* @__PURE__ */ jsxs14("span", { style: { fontSize: 11, color: "#4b5563" }, children: [
5915
- "Checking ",
6381
+ },
6382
+ url
6383
+ );
6384
+ };
6385
+ return /* @__PURE__ */ jsxs15("div", { id: "anchor-link-check", style: cardStyle6, children: [
6386
+ /* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
6387
+ /* @__PURE__ */ jsx16("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: "Link Health" }),
6388
+ hasRun && !isLoading && /* @__PURE__ */ jsx16("button", { onClick: onCheck, style: { background: "none", border: "none", fontSize: 10, fontWeight: 600, color: MJH_BLUE, cursor: "pointer", padding: "2px 4px" }, title: "Run again", children: "Re-check" })
6389
+ ] }),
6390
+ urls.length === 0 ? /* @__PURE__ */ jsx16("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: "No links found in the body." }) : /* @__PURE__ */ jsxs15(Fragment9, { children: [
6391
+ /* @__PURE__ */ jsxs15("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5, marginBottom: 10 }, children: [
5916
6392
  urls.length,
5917
6393
  " link",
5918
6394
  urls.length === 1 ? "" : "s",
5919
- "..."
5920
- ] })
5921
- ] }),
5922
- error && !isLoading && /* @__PURE__ */ jsxs14(
5923
- "div",
5924
- {
5925
- style: {
5926
- padding: "10px 12px",
5927
- background: "rgba(220,38,38,0.04)",
5928
- border: "1px solid rgba(220,38,38,0.18)",
5929
- borderRadius: 8,
5930
- fontSize: 11,
5931
- color: "#b91c1c",
5932
- lineHeight: 1.5
5933
- },
5934
- children: [
5935
- error,
5936
- /* @__PURE__ */ jsx15(
5937
- "button",
5938
- {
5939
- onClick: onCheck,
5940
- style: {
5941
- display: "block",
5942
- marginTop: 6,
5943
- padding: "4px 10px",
5944
- fontSize: 11,
5945
- fontWeight: 700,
5946
- color: "#ffffff",
5947
- background: "#dc2626",
5948
- border: "none",
5949
- borderRadius: 5,
5950
- cursor: "pointer"
5951
- },
5952
- children: "Try again"
5953
- }
5954
- )
5955
- ]
5956
- }
5957
- ),
5958
- hasRun && !isLoading && !error && /* @__PURE__ */ jsxs14(Fragment8, { children: [
5959
- /* @__PURE__ */ jsxs14("div", { style: { display: "grid", gridTemplateColumns: counts.unverified > 0 ? "repeat(5, 1fr)" : "repeat(4, 1fr)", gap: 6 }, children: [
5960
- /* @__PURE__ */ jsx15(StatTile, { label: "Checked", value: counts.total, color: "#475569" }),
5961
- /* @__PURE__ */ jsx15(StatTile, { label: "Valid", value: counts.valid, color: "#16a34a" }),
5962
- /* @__PURE__ */ jsx15(StatTile, { label: "Redirects", value: counts.redirects, color: "#8B7310" }),
5963
- /* @__PURE__ */ jsx15(StatTile, { label: "Broken", value: counts.broken + counts.errored, color: "#dc2626" }),
5964
- counts.unverified > 0 && /* @__PURE__ */ jsx15(StatTile, { label: "Blocked", value: counts.unverified, color: "#b45309" })
6395
+ " in the body.",
6396
+ tiles.length > 0 ? " Tap a box to see which." : ""
5965
6397
  ] }),
5966
- counts.unverified > 0 && /* @__PURE__ */ jsxs14(
5967
- "div",
5968
- {
5969
- style: {
5970
- marginTop: 8,
5971
- padding: "6px 10px",
5972
- background: "rgba(245,158,11,0.08)",
5973
- border: "1px solid rgba(245,158,11,0.25)",
5974
- borderRadius: 6,
5975
- fontSize: 10.5,
5976
- color: "#92400e",
5977
- lineHeight: 1.45
6398
+ tiles.length > 0 && /* @__PURE__ */ jsx16("div", { style: { display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: 6 }, children: tiles.map((t) => {
6399
+ const empty = t.urls.length === 0;
6400
+ const active = openBucket === t.key && !empty;
6401
+ return /* @__PURE__ */ jsxs15(
6402
+ "button",
6403
+ {
6404
+ type: "button",
6405
+ onClick: () => !empty && setOpenBucket(active ? null : t.key),
6406
+ "aria-expanded": active,
6407
+ "aria-label": `${t.urls.length} ${t.label} links`,
6408
+ style: {
6409
+ padding: "8px 4px",
6410
+ background: active ? "rgba(0,93,172,0.08)" : "rgba(0,0,0,0.025)",
6411
+ border: active ? `1px solid ${MJH_BLUE}55` : "1px solid transparent",
6412
+ borderRadius: 8,
6413
+ textAlign: "center",
6414
+ cursor: empty ? "default" : "pointer",
6415
+ opacity: empty ? 0.5 : 1
6416
+ },
6417
+ children: [
6418
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 18, fontWeight: 700, color: t.color, fontVariantNumeric: "tabular-nums", lineHeight: 1 }, children: t.urls.length }),
6419
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginTop: 4 }, children: t.label })
6420
+ ]
5978
6421
  },
6422
+ t.key
6423
+ );
6424
+ }) }),
6425
+ open && open.urls.length > 0 && /* @__PURE__ */ jsxs15("div", { style: { marginTop: 8 }, children: [
6426
+ open.note && /* @__PURE__ */ jsx16("div", { style: { fontSize: 10.5, color: "#92400e", background: "rgba(245,158,11,0.08)", border: "1px solid rgba(245,158,11,0.25)", borderRadius: 6, padding: "6px 9px", lineHeight: 1.45, marginBottom: 2 }, children: open.note }),
6427
+ open.urls.map(renderLinkRow)
6428
+ ] }),
6429
+ hasRun && blockedUrls.length > 0 && /* @__PURE__ */ jsxs15("div", { style: { marginTop: 8, padding: "6px 10px", background: "rgba(245,158,11,0.08)", border: "1px solid rgba(245,158,11,0.25)", borderRadius: 6, fontSize: 10.5, color: "#92400e", lineHeight: 1.45 }, children: [
6430
+ blockedUrls.length,
6431
+ " link",
6432
+ blockedUrls.length === 1 ? "" : "s",
6433
+ " couldn't be auto-checked (the destination blocks our checker) - open them to confirm."
6434
+ ] }),
6435
+ !hasRun && !isLoading && /* @__PURE__ */ jsxs15(
6436
+ "button",
6437
+ {
6438
+ onClick: onCheck,
6439
+ style: { width: "100%", marginTop: 10, padding: "8px 12px", fontSize: 11, fontWeight: 700, color: "#1f2937", background: MJH_GOLD, border: "none", borderRadius: 6, cursor: "pointer", letterSpacing: "0.01em" },
5979
6440
  children: [
5980
- counts.unverified,
6441
+ "Check ",
6442
+ urls.length,
5981
6443
  " link",
5982
- counts.unverified === 1 ? "" : "s",
5983
- " were blocked from our auto-check (likely anti-bot rules on the destination site). They may still work fine for human readers - click each to confirm."
6444
+ urls.length === 1 ? "" : "s",
6445
+ " for broken / redirects"
5984
6446
  ]
5985
6447
  }
5986
6448
  ),
5987
- counts.issues.length > 0 ? /* @__PURE__ */ jsxs14("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 6 }, children: [
5988
- /* @__PURE__ */ jsxs14("div", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em" }, children: [
5989
- counts.issues.length,
6449
+ isLoading && /* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
6450
+ /* @__PURE__ */ jsx16(LoadingBars, { size: "xs", color: MJH_BLUE }),
6451
+ /* @__PURE__ */ jsxs15("span", { style: { fontSize: 11, color: "#4b5563" }, children: [
6452
+ "Checking ",
6453
+ urls.length,
5990
6454
  " link",
5991
- counts.issues.length === 1 ? "" : "s",
5992
- " need",
5993
- counts.issues.length === 1 ? "s" : "",
5994
- " attention"
5995
- ] }),
5996
- counts.issues.map((r) => /* @__PURE__ */ jsx15(LinkIssueRow, { result: r }, r.url))
5997
- ] }) : /* @__PURE__ */ jsxs14(
5998
- "div",
5999
- {
6000
- style: {
6001
- marginTop: 12,
6002
- padding: "8px 10px",
6003
- background: "rgba(22,163,74,0.05)",
6004
- border: "1px solid rgba(22,163,74,0.15)",
6005
- borderRadius: 8,
6006
- fontSize: 11,
6007
- color: "#16a34a",
6008
- fontWeight: 600,
6009
- textAlign: "center"
6010
- },
6011
- children: [
6012
- "All ",
6013
- counts.total,
6014
- " link",
6015
- counts.total === 1 ? "" : "s",
6016
- " resolve cleanly."
6017
- ]
6018
- }
6019
- )
6455
+ urls.length === 1 ? "" : "s",
6456
+ "..."
6457
+ ] })
6458
+ ] }),
6459
+ error && !isLoading && /* @__PURE__ */ jsxs15("div", { style: { marginTop: 10, padding: "10px 12px", background: "rgba(220,38,38,0.04)", border: "1px solid rgba(220,38,38,0.18)", borderRadius: 8, fontSize: 11, color: "#b91c1c", lineHeight: 1.5 }, children: [
6460
+ error,
6461
+ /* @__PURE__ */ jsx16("button", { onClick: onCheck, style: { display: "block", marginTop: 6, padding: "4px 10px", fontSize: 11, fontWeight: 700, color: "#ffffff", background: "#dc2626", border: "none", borderRadius: 5, cursor: "pointer" }, children: "Try again" })
6462
+ ] })
6020
6463
  ] })
6021
6464
  ] });
6022
6465
  }
6023
- function StatTile({ label, value, color }) {
6024
- return /* @__PURE__ */ jsxs14(
6025
- "div",
6026
- {
6027
- style: {
6028
- padding: "8px 4px",
6029
- background: "rgba(0,0,0,0.025)",
6030
- borderRadius: 8,
6031
- textAlign: "center"
6032
- },
6033
- children: [
6034
- /* @__PURE__ */ jsx15("div", { style: { fontSize: 18, fontWeight: 700, color, fontVariantNumeric: "tabular-nums", lineHeight: 1 }, children: value }),
6035
- /* @__PURE__ */ jsx15("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", marginTop: 4 }, children: label })
6036
- ]
6037
- }
6038
- );
6039
- }
6040
- function LinkIssueRow({ result }) {
6041
- const map = {
6042
- ok: { bg: "rgba(22,163,74,0.06)", color: "#16a34a", label: "OK" },
6043
- redirect: { bg: "rgba(230,192,27,0.12)", color: "#8B7310", label: result.status > 0 ? String(result.status) : "REDIR" },
6044
- broken: { bg: "rgba(220,38,38,0.06)", color: "#dc2626", label: result.status > 0 ? String(result.status) : "404" },
6045
- // Amber for unverified - the link may work fine, our server just couldn't confirm.
6046
- unverified: { bg: "rgba(245,158,11,0.10)", color: "#b45309", label: result.status > 0 ? String(result.status) : "BLOCKED" },
6047
- error: { bg: "rgba(220,38,38,0.06)", color: "#dc2626", label: "ERR" }
6048
- };
6049
- const c = map[result.category];
6050
- const tooltip = result.category === "unverified" ? `${result.url} (couldn't auto-check; likely anti-bot blocking - open manually to verify)` : result.error ? `${result.url} (${result.error})` : result.url;
6051
- return /* @__PURE__ */ jsxs14(
6052
- "a",
6053
- {
6054
- href: result.url,
6055
- target: "_blank",
6056
- rel: "noopener noreferrer",
6057
- style: {
6058
- display: "flex",
6059
- alignItems: "center",
6060
- gap: 8,
6061
- padding: "6px 10px",
6062
- background: c.bg,
6063
- borderRadius: 6,
6064
- textDecoration: "none"
6065
- },
6066
- children: [
6067
- /* @__PURE__ */ jsx15(
6068
- "span",
6069
- {
6070
- style: {
6071
- fontSize: 9,
6072
- fontWeight: 700,
6073
- letterSpacing: "0.04em",
6074
- padding: "2px 6px",
6075
- borderRadius: 99,
6076
- background: "#ffffff",
6077
- color: c.color,
6078
- fontVariantNumeric: "tabular-nums",
6079
- flexShrink: 0
6080
- },
6081
- children: c.label
6082
- }
6083
- ),
6084
- /* @__PURE__ */ jsx15(
6085
- "span",
6086
- {
6087
- style: {
6088
- fontSize: 11,
6089
- color: "#1f2937",
6090
- fontFamily: "ui-monospace, SFMono-Regular, monospace",
6091
- flex: 1,
6092
- minWidth: 0,
6093
- overflow: "hidden",
6094
- textOverflow: "ellipsis",
6095
- whiteSpace: "nowrap"
6096
- },
6097
- title: tooltip,
6098
- children: result.url
6099
- }
6100
- )
6101
- ]
6102
- }
6103
- );
6104
- }
6105
6466
  function TechnicalTab({
6106
6467
  text,
6107
6468
  documentFields,
@@ -6126,8 +6487,8 @@ function TechnicalTab({
6126
6487
  );
6127
6488
  const wordCount2 = text ? text.split(/\s+/).filter(Boolean).length : 0;
6128
6489
  const structureAudits = useMemo4(
6129
- () => computeHeadingStructureAudits(headingsForStructure, wordCount2),
6130
- [headingsForStructure, wordCount2]
6490
+ () => computeHeadingStructureAudits(headingsForStructure, wordCount2, primaryKeyword, secondaryKeyword, documentFields?.unstyledHeadings),
6491
+ [headingsForStructure, wordCount2, primaryKeyword, secondaryKeyword, documentFields?.unstyledHeadings]
6131
6492
  );
6132
6493
  const imageNames = documentFields?.imageNames || [];
6133
6494
  const { filenames: imageFilenames, altTexts: imageAltTexts } = useMemo4(
@@ -6168,15 +6529,16 @@ function TechnicalTab({
6168
6529
  recommendation: "Above the 450-word floor. For competitive clinical content, push past 1,500 words."
6169
6530
  } : { label: "Word Count", value: `${wordCount2} words`, status: "good" };
6170
6531
  const bodyLinks = documentFields?.bodyLinks || [];
6532
+ const bodyLinksDetailed = documentFields?.bodyLinksDetailed;
6171
6533
  const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.headings && documentFields.headings.length > 0 || documentFields.imageNames && documentFields.imageNames.length > 0 || wordCount2 > 0);
6172
6534
  if (isLoading && !hasAnyField) {
6173
- return /* @__PURE__ */ jsxs14("div", { style: { padding: 24, textAlign: "center" }, children: [
6174
- /* @__PURE__ */ jsx15("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
6175
- /* @__PURE__ */ jsx15("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
6535
+ return /* @__PURE__ */ jsxs15("div", { style: { padding: 24, textAlign: "center" }, children: [
6536
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
6537
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
6176
6538
  ] });
6177
6539
  }
6178
- return /* @__PURE__ */ jsxs14("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
6179
- /* @__PURE__ */ jsx15(
6540
+ return /* @__PURE__ */ jsxs15("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
6541
+ /* @__PURE__ */ jsx16(
6180
6542
  AuditCard2,
6181
6543
  {
6182
6544
  anchorId: "anchor-url-slug",
@@ -6184,10 +6546,22 @@ function TechnicalTab({
6184
6546
  value: urlSlugAudit.value,
6185
6547
  status: urlSlugAudit.status,
6186
6548
  recommendation: urlSlugAudit.recommendation,
6187
- footer: /* @__PURE__ */ jsx15(SlugRedirectNotice, {})
6549
+ footer: /* @__PURE__ */ jsx16(SlugRedirectNotice, {})
6188
6550
  }
6189
6551
  ),
6190
- wordAudit && /* @__PURE__ */ jsx15(
6552
+ /* @__PURE__ */ jsx16(
6553
+ LinkCheckCard,
6554
+ {
6555
+ urls: bodyLinks,
6556
+ linksDetailed: bodyLinksDetailed,
6557
+ results: linkCheckResults,
6558
+ isLoading: isLinkCheckLoading,
6559
+ error: linkCheckError,
6560
+ hasRun: hasRunLinkCheck,
6561
+ onCheck: onCheckLinks
6562
+ }
6563
+ ),
6564
+ wordAudit && /* @__PURE__ */ jsx16(
6191
6565
  AuditCard2,
6192
6566
  {
6193
6567
  anchorId: "anchor-word-count",
@@ -6197,48 +6571,63 @@ function TechnicalTab({
6197
6571
  recommendation: wordAudit.recommendation
6198
6572
  }
6199
6573
  ),
6200
- structureAudits.map((a, i) => /* @__PURE__ */ jsx15(
6201
- AuditCard2,
6202
- {
6203
- anchorId: i === 0 ? "anchor-headings-structure" : void 0,
6204
- label: a.label,
6205
- value: a.value,
6206
- status: a.status,
6207
- recommendation: a.recommendation
6208
- },
6209
- `structure-${i}`
6210
- )),
6211
- headings.length > 0 && /* @__PURE__ */ jsxs14("div", { id: "anchor-headings-outline", style: { ...cardStyle6, padding: "8px 14px" }, children: [
6212
- /* @__PURE__ */ jsx15("div", { style: { fontSize: 10, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", fontWeight: 600, marginBottom: 6 }, children: "Heading Outline" }),
6213
- /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
6214
- (headingsDetailed ? headingsDetailed.slice(0, 12) : headings.slice(0, 12).map((h) => ({ text: h, level: 2 }))).map((h, i) => /* @__PURE__ */ jsxs14(
6215
- "div",
6216
- {
6217
- style: {
6218
- fontSize: 11,
6219
- color: h.text ? "#4b5563" : "#dc2626",
6220
- fontStyle: h.text ? "normal" : "italic",
6221
- lineHeight: 1.4,
6222
- paddingLeft: Math.max(0, (h.level - 2) * 12)
6574
+ (() => {
6575
+ const structIdx = structureAudits.findIndex(
6576
+ (a) => a.label !== "Keywords in Headings" && a.label !== "Looks Like a Heading"
6577
+ );
6578
+ return structureAudits.map((a, i) => /* @__PURE__ */ jsx16(
6579
+ AuditCard2,
6580
+ {
6581
+ anchorId: a.label === "Keywords in Headings" ? "anchor-headings-keyword" : a.label === "Looks Like a Heading" ? "anchor-headings-unstyled" : i === structIdx ? "anchor-headings-structure" : void 0,
6582
+ label: a.label,
6583
+ value: a.value,
6584
+ status: a.status,
6585
+ recommendation: a.recommendation
6586
+ },
6587
+ `structure-${i}`
6588
+ ));
6589
+ })(),
6590
+ (headings.length > 0 || !!documentFields?.title) && /* @__PURE__ */ jsxs15("div", { id: "anchor-headings-outline", style: { ...cardStyle6, padding: "8px 14px" }, children: [
6591
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 10, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", fontWeight: 600, marginBottom: 6 }, children: "Heading Outline" }),
6592
+ /* @__PURE__ */ jsxs15("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
6593
+ documentFields?.title && /* @__PURE__ */ jsxs15("div", { style: { fontSize: 11, color: MJH_BLUE, fontWeight: 700, lineHeight: 1.4 }, children: [
6594
+ /* @__PURE__ */ jsx16("span", { style: { fontSize: 9, fontWeight: 700, color: MJH_BLUE, marginRight: 6 }, children: "H1" }),
6595
+ documentFields.title,
6596
+ /* @__PURE__ */ jsx16("span", { style: { fontSize: 9, color: "#6b7280", fontWeight: 500, marginLeft: 6 }, children: "(article title)" })
6597
+ ] }),
6598
+ (headingsDetailed ? headingsDetailed.slice(0, 12) : headings.slice(0, 12).map((h) => ({ text: h, level: 2 }))).map((h, i) => {
6599
+ const isH1 = h.level === 1;
6600
+ return /* @__PURE__ */ jsxs15(
6601
+ "div",
6602
+ {
6603
+ style: {
6604
+ fontSize: 11,
6605
+ color: !h.text ? "#dc2626" : isH1 ? MJH_BLUE : "#4b5563",
6606
+ fontWeight: isH1 ? 700 : 400,
6607
+ fontStyle: h.text ? "normal" : "italic",
6608
+ lineHeight: 1.4,
6609
+ paddingLeft: Math.max(0, (h.level - 2) * 12)
6610
+ },
6611
+ children: [
6612
+ /* @__PURE__ */ jsxs15("span", { style: { fontSize: 9, fontWeight: 700, color: isH1 ? MJH_BLUE : "#4b5563", marginRight: 6 }, children: [
6613
+ "H",
6614
+ h.level
6615
+ ] }),
6616
+ h.text || "(empty)"
6617
+ ]
6223
6618
  },
6224
- children: [
6225
- /* @__PURE__ */ jsxs14("span", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", marginRight: 6 }, children: [
6226
- "H",
6227
- h.level
6228
- ] }),
6229
- h.text || "(empty)"
6230
- ]
6231
- },
6232
- i
6233
- )),
6234
- (headingsDetailed ?? headings).length > 12 && /* @__PURE__ */ jsxs14("div", { style: { fontSize: 10, color: "#4b5563" }, children: [
6619
+ i
6620
+ );
6621
+ }),
6622
+ (headingsDetailed ?? headings).length > 12 && /* @__PURE__ */ jsxs15("div", { style: { fontSize: 10, color: "#4b5563" }, children: [
6235
6623
  "+ ",
6236
6624
  (headingsDetailed ?? headings).length - 12,
6237
6625
  " more"
6238
6626
  ] })
6239
- ] })
6627
+ ] }),
6628
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 10, color: "#6b7280", marginTop: 8, lineHeight: 1.4 }, children: headings.length > 0 ? "The title above is your H1; the tool scans the H2-H6 tags below it. Tip: work your primary and/or secondary keyword into a header where it reads naturally." : "The title above is your H1, and there are no H2-H6 subheadings yet. Tip: work your primary and/or secondary keyword into the title where it reads naturally." })
6240
6629
  ] }),
6241
- imagesAudit && /* @__PURE__ */ jsx15(
6630
+ imagesAudit && /* @__PURE__ */ jsx16(
6242
6631
  AuditCard2,
6243
6632
  {
6244
6633
  anchorId: "anchor-images",
@@ -6248,7 +6637,7 @@ function TechnicalTab({
6248
6637
  recommendation: imagesAudit.recommendation
6249
6638
  }
6250
6639
  ),
6251
- filenameAudit && /* @__PURE__ */ jsx15(
6640
+ filenameAudit && /* @__PURE__ */ jsx16(
6252
6641
  AuditCard2,
6253
6642
  {
6254
6643
  anchorId: "anchor-image-filenames",
@@ -6258,7 +6647,7 @@ function TechnicalTab({
6258
6647
  recommendation: filenameAudit.recommendation
6259
6648
  }
6260
6649
  ),
6261
- altTextAudit && /* @__PURE__ */ jsx15(
6650
+ altTextAudit && /* @__PURE__ */ jsx16(
6262
6651
  AuditCard2,
6263
6652
  {
6264
6653
  anchorId: "anchor-image-alt",
@@ -6268,7 +6657,7 @@ function TechnicalTab({
6268
6657
  recommendation: altTextAudit.recommendation
6269
6658
  }
6270
6659
  ),
6271
- imgTitleAudit && /* @__PURE__ */ jsx15(
6660
+ imgTitleAudit && /* @__PURE__ */ jsx16(
6272
6661
  AuditCard2,
6273
6662
  {
6274
6663
  anchorId: "anchor-image-titles",
@@ -6277,28 +6666,17 @@ function TechnicalTab({
6277
6666
  status: imgTitleAudit.status,
6278
6667
  recommendation: imgTitleAudit.recommendation
6279
6668
  }
6280
- ),
6281
- /* @__PURE__ */ jsx15(
6282
- LinkCheckCard,
6283
- {
6284
- urls: bodyLinks,
6285
- results: linkCheckResults,
6286
- isLoading: isLinkCheckLoading,
6287
- error: linkCheckError,
6288
- hasRun: hasRunLinkCheck,
6289
- onCheck: onCheckLinks
6290
- }
6291
6669
  )
6292
6670
  ] });
6293
6671
  }
6294
6672
 
6295
6673
  // src/components/SEOCopilotPanel.tsx
6296
- import { Fragment as Fragment9, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
6674
+ import { Fragment as Fragment10, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
6297
6675
  function LogoIcon2() {
6298
- return /* @__PURE__ */ jsxs15("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
6299
- /* @__PURE__ */ jsx16("rect", { x: "1", y: "3", width: "4", height: "10", rx: "1", fill: MJH_GOLD, opacity: "1" }),
6300
- /* @__PURE__ */ jsx16("rect", { x: "6", y: "1", width: "4", height: "14", rx: "1", fill: MJH_GOLD, opacity: "0.85" }),
6301
- /* @__PURE__ */ jsx16("rect", { x: "11", y: "5", width: "4", height: "8", rx: "1", fill: MJH_GOLD, opacity: "0.6" })
6676
+ return /* @__PURE__ */ jsxs16("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
6677
+ /* @__PURE__ */ jsx17("rect", { x: "1", y: "3", width: "4", height: "10", rx: "1", fill: MJH_GOLD, opacity: "1" }),
6678
+ /* @__PURE__ */ jsx17("rect", { x: "6", y: "1", width: "4", height: "14", rx: "1", fill: MJH_GOLD, opacity: "0.85" }),
6679
+ /* @__PURE__ */ jsx17("rect", { x: "11", y: "5", width: "4", height: "8", rx: "1", fill: MJH_GOLD, opacity: "0.6" })
6302
6680
  ] });
6303
6681
  }
6304
6682
  function PanelContent({
@@ -6340,14 +6718,14 @@ function PanelContent({
6340
6718
  const keywordAnalysisState = externalAnalysis;
6341
6719
  const effectivePrimary = selectedPrimary || externalAnalysis.analysis?.primaryKeyword?.term || "";
6342
6720
  const effectiveSecondary = selectedSecondary || "";
6343
- const containerRef = useRef11(null);
6344
- const dragging = useRef11(false);
6721
+ const containerRef = useRef12(null);
6722
+ const dragging = useRef12(false);
6345
6723
  const onMouseDown = useCallback5(() => {
6346
6724
  dragging.current = true;
6347
6725
  document.body.style.cursor = "row-resize";
6348
6726
  document.body.style.userSelect = "none";
6349
6727
  }, []);
6350
- useEffect11(() => {
6728
+ useEffect12(() => {
6351
6729
  const onMouseMove = (e) => {
6352
6730
  if (!dragging.current || !containerRef.current) return;
6353
6731
  const rect = containerRef.current.getBoundingClientRect();
@@ -6370,11 +6748,11 @@ function PanelContent({
6370
6748
  const onboardSite = publication || "default";
6371
6749
  const onboardKey = `seo-copilot-onboarded-${onboardSite}`;
6372
6750
  const onboardSessionKey = `seo-copilot-onboard-shown-${onboardSite}`;
6373
- const [popupMode, setPopupMode] = useState16("hidden");
6374
- const [popupClosing, setPopupClosing] = useState16(false);
6375
- const onboardTimerRef = useRef11(null);
6376
- const onboardFadeRef = useRef11(null);
6377
- useEffect11(() => {
6751
+ const [popupMode, setPopupMode] = useState17("hidden");
6752
+ const [popupClosing, setPopupClosing] = useState17(false);
6753
+ const onboardTimerRef = useRef12(null);
6754
+ const onboardFadeRef = useRef12(null);
6755
+ useEffect12(() => {
6378
6756
  let onboarded = false;
6379
6757
  let shownThisSession = false;
6380
6758
  try {
@@ -6446,7 +6824,7 @@ function PanelContent({
6446
6824
  { id: "meta", label: "Meta", beta: true },
6447
6825
  { id: "technical", label: "Other Recs", beta: true, loading: technicalOps.isLinkCheckLoading }
6448
6826
  ];
6449
- return /* @__PURE__ */ jsxs15(
6827
+ return /* @__PURE__ */ jsxs16(
6450
6828
  "div",
6451
6829
  {
6452
6830
  className: "seo-copilot-panel",
@@ -6461,9 +6839,9 @@ function PanelContent({
6461
6839
  position: "relative"
6462
6840
  },
6463
6841
  children: [
6464
- /* @__PURE__ */ jsx16("style", { dangerouslySetInnerHTML: { __html: INJECTED_CSS } }),
6465
- popupMode !== "hidden" && /* @__PURE__ */ jsx16(OnboardingCard, { onDismiss: dismissPopup, closing: popupClosing }),
6466
- /* @__PURE__ */ jsxs15(
6842
+ /* @__PURE__ */ jsx17("style", { dangerouslySetInnerHTML: { __html: INJECTED_CSS } }),
6843
+ popupMode !== "hidden" && /* @__PURE__ */ jsx17(OnboardingCard, { onDismiss: dismissPopup, closing: popupClosing }),
6844
+ /* @__PURE__ */ jsxs16(
6467
6845
  "div",
6468
6846
  {
6469
6847
  onMouseDown: isFloating ? onDragStart : void 0,
@@ -6481,16 +6859,26 @@ function PanelContent({
6481
6859
  flexShrink: 0
6482
6860
  },
6483
6861
  children: [
6484
- /* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
6485
- /* @__PURE__ */ jsx16(LogoIcon2, {}),
6486
- /* @__PURE__ */ jsxs15("span", { style: { fontWeight: 700, fontSize: 15, letterSpacing: "-0.01em" }, children: [
6487
- /* @__PURE__ */ jsx16("span", { style: { color: MJH_GOLD }, children: "SEO" }),
6488
- /* @__PURE__ */ jsx16("span", { style: { color: MJH_SLATE }, children: " copilot" })
6862
+ /* @__PURE__ */ jsxs16("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
6863
+ /* @__PURE__ */ jsx17(LogoIcon2, {}),
6864
+ /* @__PURE__ */ jsxs16("span", { style: { fontWeight: 700, fontSize: 15, letterSpacing: "-0.01em" }, children: [
6865
+ /* @__PURE__ */ jsx17("span", { style: { color: MJH_GOLD }, children: "SEO" }),
6866
+ /* @__PURE__ */ jsx17("span", { style: { color: MJH_SLATE }, children: " copilot" })
6489
6867
  ] })
6490
6868
  ] }),
6491
- /* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", gap: isFloating ? 4 : 6 }, children: [
6492
- /* @__PURE__ */ jsx16(OnboardingInfoButton, { onClick: openPopupPersistent }),
6493
- isFloating && onToggleFullscreen && /* @__PURE__ */ jsx16(
6869
+ /* @__PURE__ */ jsxs16("div", { style: { display: "flex", alignItems: "center", gap: isFloating ? 4 : 6 }, children: [
6870
+ /* @__PURE__ */ jsx17(OnboardingInfoButton, { onClick: openPopupPersistent }),
6871
+ /* @__PURE__ */ jsx17(
6872
+ ReportProblemButton,
6873
+ {
6874
+ activeTab,
6875
+ publication,
6876
+ documentId,
6877
+ documentType,
6878
+ primaryKeyword: effectivePrimary
6879
+ }
6880
+ ),
6881
+ isFloating && onToggleFullscreen && /* @__PURE__ */ jsx17(
6494
6882
  "button",
6495
6883
  {
6496
6884
  onClick: (e) => {
@@ -6512,16 +6900,16 @@ function PanelContent({
6512
6900
  fontWeight: 600,
6513
6901
  transition: "all 150ms"
6514
6902
  },
6515
- children: isFullscreen ? /* @__PURE__ */ jsxs15(Fragment9, { children: [
6516
- /* @__PURE__ */ jsx16("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16("path", { d: "M3.28 2.22a.75.75 0 00-1.06 1.06L5.44 6.5H3.75a.75.75 0 000 1.5h4.5A.75.75 0 009 7.25v-4.5a.75.75 0 00-1.5 0v1.69L4.28 1.22a.75.75 0 00-1 1zM16.72 17.78a.75.75 0 001.06-1.06L14.56 13.5h1.69a.75.75 0 000-1.5h-4.5a.75.75 0 00-.75.75v4.5a.75.75 0 001.5 0v-1.69l3.22 3.22z" }) }),
6903
+ children: isFullscreen ? /* @__PURE__ */ jsxs16(Fragment10, { children: [
6904
+ /* @__PURE__ */ jsx17("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx17("path", { d: "M3.28 2.22a.75.75 0 00-1.06 1.06L5.44 6.5H3.75a.75.75 0 000 1.5h4.5A.75.75 0 009 7.25v-4.5a.75.75 0 00-1.5 0v1.69L4.28 1.22a.75.75 0 00-1 1zM16.72 17.78a.75.75 0 001.06-1.06L14.56 13.5h1.69a.75.75 0 000-1.5h-4.5a.75.75 0 00-.75.75v4.5a.75.75 0 001.5 0v-1.69l3.22 3.22z" }) }),
6517
6905
  "Exit fullscreen"
6518
- ] }) : /* @__PURE__ */ jsxs15(Fragment9, { children: [
6519
- /* @__PURE__ */ jsx16("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16("path", { d: "M13.28 7.78l3.22-3.22v1.69a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h1.69l-3.22 3.22a.75.75 0 001.06 1.06zM2 17.25a.75.75 0 001.5 0v-1.69l3.22 3.22a.75.75 0 001.06-1.06L4.56 14.5h1.69a.75.75 0 000-1.5h-4.5a.75.75 0 00-.75.75v4.5z" }) }),
6906
+ ] }) : /* @__PURE__ */ jsxs16(Fragment10, { children: [
6907
+ /* @__PURE__ */ jsx17("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx17("path", { d: "M13.28 7.78l3.22-3.22v1.69a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h1.69l-3.22 3.22a.75.75 0 001.06 1.06zM2 17.25a.75.75 0 001.5 0v-1.69l3.22 3.22a.75.75 0 001.06-1.06L4.56 14.5h1.69a.75.75 0 000-1.5h-4.5a.75.75 0 00-.75.75v4.5z" }) }),
6520
6908
  "Fullscreen"
6521
6909
  ] })
6522
6910
  }
6523
6911
  ),
6524
- isFloating && onToggleFloat && /* @__PURE__ */ jsxs15(
6912
+ isFloating && onToggleFloat && /* @__PURE__ */ jsxs16(
6525
6913
  "button",
6526
6914
  {
6527
6915
  onClick: (e) => {
@@ -6544,7 +6932,7 @@ function PanelContent({
6544
6932
  transition: "all 150ms"
6545
6933
  },
6546
6934
  children: [
6547
- /* @__PURE__ */ jsx16("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16(
6935
+ /* @__PURE__ */ jsx17("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx17(
6548
6936
  "path",
6549
6937
  {
6550
6938
  fillRule: "evenodd",
@@ -6556,7 +6944,7 @@ function PanelContent({
6556
6944
  ]
6557
6945
  }
6558
6946
  ),
6559
- !isFloating && onToggleFloat && /* @__PURE__ */ jsx16(
6947
+ !isFloating && onToggleFloat && /* @__PURE__ */ jsx17(
6560
6948
  "button",
6561
6949
  {
6562
6950
  onClick: (e) => {
@@ -6575,13 +6963,13 @@ function PanelContent({
6575
6963
  transition: "color 150ms"
6576
6964
  },
6577
6965
  title: "Pop out",
6578
- children: /* @__PURE__ */ jsxs15("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: [
6579
- /* @__PURE__ */ jsx16("path", { d: "M4.25 5.5a.75.75 0 00-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 00.75-.75v-4a.75.75 0 011.5 0v4A2.25 2.25 0 0112.75 17h-8.5A2.25 2.25 0 012 14.75v-8.5A2.25 2.25 0 014.25 4h5a.75.75 0 010 1.5h-5z" }),
6580
- /* @__PURE__ */ jsx16("path", { d: "M6.194 12.753a.75.75 0 001.06.053L16.5 4.44v2.81a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h2.553l-9.056 8.194a.75.75 0 00-.053 1.06z" })
6966
+ children: /* @__PURE__ */ jsxs16("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: [
6967
+ /* @__PURE__ */ jsx17("path", { d: "M4.25 5.5a.75.75 0 00-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 00.75-.75v-4a.75.75 0 011.5 0v4A2.25 2.25 0 0112.75 17h-8.5A2.25 2.25 0 012 14.75v-8.5A2.25 2.25 0 014.25 4h5a.75.75 0 010 1.5h-5z" }),
6968
+ /* @__PURE__ */ jsx17("path", { d: "M6.194 12.753a.75.75 0 001.06.053L16.5 4.44v2.81a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h2.553l-9.056 8.194a.75.75 0 00-.053 1.06z" })
6581
6969
  ] })
6582
6970
  }
6583
6971
  ),
6584
- isLoading && /* @__PURE__ */ jsx16(
6972
+ isLoading && /* @__PURE__ */ jsx17(
6585
6973
  "div",
6586
6974
  {
6587
6975
  style: {
@@ -6593,7 +6981,7 @@ function PanelContent({
6593
6981
  }
6594
6982
  }
6595
6983
  ),
6596
- onClose && /* @__PURE__ */ jsx16(
6984
+ onClose && /* @__PURE__ */ jsx17(
6597
6985
  "button",
6598
6986
  {
6599
6987
  onClick: (e) => {
@@ -6612,11 +7000,11 @@ function PanelContent({
6612
7000
  transition: "color 150ms"
6613
7001
  },
6614
7002
  title: "Close",
6615
- children: /* @__PURE__ */ jsx16("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" }) })
7003
+ children: /* @__PURE__ */ jsx17("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx17("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" }) })
6616
7004
  }
6617
7005
  )
6618
7006
  ] }),
6619
- /* @__PURE__ */ jsx16(
7007
+ /* @__PURE__ */ jsx17(
6620
7008
  "div",
6621
7009
  {
6622
7010
  style: {
@@ -6635,8 +7023,8 @@ function PanelContent({
6635
7023
  ]
6636
7024
  }
6637
7025
  ),
6638
- /* @__PURE__ */ jsx16(TabBar, { tabs: tabDefs, activeTab, onTabChange: handleTabChange }),
6639
- /* @__PURE__ */ jsx16(
7026
+ /* @__PURE__ */ jsx17(TabBar, { tabs: tabDefs, activeTab, onTabChange: handleTabChange }),
7027
+ /* @__PURE__ */ jsx17(
6640
7028
  "div",
6641
7029
  {
6642
7030
  style: {
@@ -6652,8 +7040,8 @@ function PanelContent({
6652
7040
  children: "Recommendations are generated by AI. Verify details before publishing."
6653
7041
  }
6654
7042
  ),
6655
- /* @__PURE__ */ jsxs15("div", { ref: containerRef, style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
6656
- /* @__PURE__ */ jsxs15(
7043
+ /* @__PURE__ */ jsxs16("div", { ref: containerRef, style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
7044
+ /* @__PURE__ */ jsxs16(
6657
7045
  "div",
6658
7046
  {
6659
7047
  style: {
@@ -6664,7 +7052,7 @@ function PanelContent({
6664
7052
  background: RECS_ZONE_BG
6665
7053
  },
6666
7054
  children: [
6667
- /* @__PURE__ */ jsx16("div", { style: { display: activeTab === "keywords" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
7055
+ /* @__PURE__ */ jsx17("div", { style: { display: activeTab === "keywords" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(
6668
7056
  KeywordPanel,
6669
7057
  {
6670
7058
  text,
@@ -6680,7 +7068,7 @@ function PanelContent({
6680
7068
  },
6681
7069
  documentId || "default"
6682
7070
  ) }),
6683
- /* @__PURE__ */ jsx16("div", { style: { display: activeTab === "summary" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
7071
+ /* @__PURE__ */ jsx17("div", { style: { display: activeTab === "summary" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(
6684
7072
  SummaryTab,
6685
7073
  {
6686
7074
  text,
@@ -6696,7 +7084,7 @@ function PanelContent({
6696
7084
  onItemClick: summaryOps.onItemClick
6697
7085
  }
6698
7086
  ) }),
6699
- /* @__PURE__ */ jsx16("div", { style: { display: activeTab === "aeo" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
7087
+ /* @__PURE__ */ jsx17("div", { style: { display: activeTab === "aeo" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(
6700
7088
  AEOTab,
6701
7089
  {
6702
7090
  text,
@@ -6712,7 +7100,7 @@ function PanelContent({
6712
7100
  loadContentSuggestions: aeoOps.loadContentSuggestions
6713
7101
  }
6714
7102
  ) }),
6715
- /* @__PURE__ */ jsx16("div", { style: { display: activeTab === "linking" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
7103
+ /* @__PURE__ */ jsx17("div", { style: { display: activeTab === "linking" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(
6716
7104
  LinkingTab,
6717
7105
  {
6718
7106
  analysis: keywordAnalysisState.analysis,
@@ -6728,8 +7116,8 @@ function PanelContent({
6728
7116
  documentType
6729
7117
  }
6730
7118
  ) }),
6731
- /* @__PURE__ */ jsx16("div", { style: { display: activeTab === "meta" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(MetaTab, { documentFields, primaryKeyword: effectivePrimary, secondaryKeyword: effectiveSecondary, isLoading: docLoading }) }),
6732
- /* @__PURE__ */ jsx16("div", { style: { display: activeTab === "technical" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
7119
+ /* @__PURE__ */ jsx17("div", { style: { display: activeTab === "meta" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(MetaTab, { documentFields, primaryKeyword: effectivePrimary, secondaryKeyword: effectiveSecondary, isLoading: docLoading }) }),
7120
+ /* @__PURE__ */ jsx17("div", { style: { display: activeTab === "technical" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(
6733
7121
  TechnicalTab,
6734
7122
  {
6735
7123
  text,
@@ -6747,7 +7135,7 @@ function PanelContent({
6747
7135
  ]
6748
7136
  }
6749
7137
  ),
6750
- chatOpen && /* @__PURE__ */ jsx16(
7138
+ chatOpen && /* @__PURE__ */ jsx17(
6751
7139
  "div",
6752
7140
  {
6753
7141
  onMouseDown,
@@ -6760,10 +7148,10 @@ function PanelContent({
6760
7148
  justifyContent: "center",
6761
7149
  flexShrink: 0
6762
7150
  },
6763
- children: /* @__PURE__ */ jsx16("div", { style: { width: 32, height: 2, borderRadius: 1, background: "#d1d5db" } })
7151
+ children: /* @__PURE__ */ jsx17("div", { style: { width: 32, height: 2, borderRadius: 1, background: "#d1d5db" } })
6764
7152
  }
6765
7153
  ),
6766
- /* @__PURE__ */ jsxs15(
7154
+ /* @__PURE__ */ jsxs16(
6767
7155
  "div",
6768
7156
  {
6769
7157
  style: {
@@ -6776,7 +7164,7 @@ function PanelContent({
6776
7164
  background: CHAT_ZONE_BG
6777
7165
  },
6778
7166
  children: [
6779
- /* @__PURE__ */ jsxs15(
7167
+ /* @__PURE__ */ jsxs16(
6780
7168
  "button",
6781
7169
  {
6782
7170
  onClick: () => onChatOpenChange(!chatOpen),
@@ -6797,7 +7185,7 @@ function PanelContent({
6797
7185
  flexShrink: 0
6798
7186
  },
6799
7187
  children: [
6800
- /* @__PURE__ */ jsx16(
7188
+ /* @__PURE__ */ jsx17(
6801
7189
  "span",
6802
7190
  {
6803
7191
  style: {
@@ -6810,7 +7198,7 @@ function PanelContent({
6810
7198
  children: "Chat"
6811
7199
  }
6812
7200
  ),
6813
- /* @__PURE__ */ jsx16(
7201
+ /* @__PURE__ */ jsx17(
6814
7202
  "svg",
6815
7203
  {
6816
7204
  width: "12",
@@ -6818,7 +7206,7 @@ function PanelContent({
6818
7206
  viewBox: "0 0 20 20",
6819
7207
  fill: "rgba(0,0,0,0.55)",
6820
7208
  style: { transform: chatOpen ? "rotate(0deg)" : "rotate(-90deg)", transition: "transform 200ms" },
6821
- children: /* @__PURE__ */ jsx16(
7209
+ children: /* @__PURE__ */ jsx17(
6822
7210
  "path",
6823
7211
  {
6824
7212
  fillRule: "evenodd",
@@ -6831,7 +7219,7 @@ function PanelContent({
6831
7219
  ]
6832
7220
  }
6833
7221
  ),
6834
- /* @__PURE__ */ jsx16(
7222
+ /* @__PURE__ */ jsx17(
6835
7223
  "div",
6836
7224
  {
6837
7225
  style: {
@@ -6841,7 +7229,7 @@ function PanelContent({
6841
7229
  flexDirection: "column",
6842
7230
  minHeight: 0
6843
7231
  },
6844
- children: /* @__PURE__ */ jsx16(
7232
+ children: /* @__PURE__ */ jsx17(
6845
7233
  ChatPanel,
6846
7234
  {
6847
7235
  messages: chatState.messages,
@@ -6872,10 +7260,10 @@ function SEOCopilotInner({ config, onClose }) {
6872
7260
  "seo-copilot-ui-float-size",
6873
7261
  { width: 380, height: typeof window !== "undefined" ? Math.round(window.innerHeight * 0.8) : 600 }
6874
7262
  );
6875
- const dragOffset = useRef11(null);
6876
- const resizeStart = useRef11(null);
6877
- const activeDragCleanupRef = useRef11(null);
6878
- const activeResizeCleanupRef = useRef11(null);
7263
+ const dragOffset = useRef12(null);
7264
+ const resizeStart = useRef12(null);
7265
+ const activeDragCleanupRef = useRef12(null);
7266
+ const activeResizeCleanupRef = useRef12(null);
6879
7267
  const { text, isLoading: docLoading, documentFields, documentId, documentType } = useDocumentContent();
6880
7268
  const { apiUrl } = useConfig();
6881
7269
  const workspace = useWorkspace();
@@ -6894,7 +7282,7 @@ function SEOCopilotInner({ config, onClose }) {
6894
7282
  }
6895
7283
  return [];
6896
7284
  }, [seedCacheKey]);
6897
- const [seedKeywords, setSeedKeywordsRaw] = useState16(loadSeedsFromCache);
7285
+ const [seedKeywords, setSeedKeywordsRaw] = useState17(loadSeedsFromCache);
6898
7286
  const setSeedKeywords = useCallback5(
6899
7287
  (seeds) => {
6900
7288
  setSeedKeywordsRaw(seeds);
@@ -6910,20 +7298,20 @@ function SEOCopilotInner({ config, onClose }) {
6910
7298
  const [selectedPrimary, setSelectedPrimary] = usePersistentState(selectedPrimaryKey, void 0);
6911
7299
  const selectedSecondaryKey = documentId ? `seo-copilot-secondary-${documentId}` : "seo-copilot-secondary-default";
6912
7300
  const [selectedSecondary, setSelectedSecondary] = usePersistentState(selectedSecondaryKey, "");
6913
- const seedsInitializedRef = useRef11(false);
6914
- useEffect11(() => {
7301
+ const seedsInitializedRef = useRef12(false);
7302
+ useEffect12(() => {
6915
7303
  if (!seedsInitializedRef.current) {
6916
7304
  seedsInitializedRef.current = true;
6917
7305
  return;
6918
7306
  }
6919
7307
  setSeedKeywordsRaw(loadSeedsFromCache());
6920
7308
  }, [documentId, loadSeedsFromCache]);
6921
- const [activeTab, setActiveTab] = useState16("keywords");
7309
+ const [activeTab, setActiveTab] = useState17("keywords");
6922
7310
  const [chatOpen, setChatOpen] = usePersistentState("seo-copilot-ui-chat-open-v35", false);
6923
7311
  const [splitPercent, setSplitPercent] = usePersistentState("seo-copilot-ui-split", 70);
6924
7312
  const keywordAnalysisState = useKeywordAnalysis(text, apiUrl, effectivePublication, seedKeywords, documentFields, selectedPrimary, documentId, selectedSecondary);
6925
7313
  const effectivePrimary = selectedPrimary || keywordAnalysisState.analysis?.primaryKeyword?.term || "";
6926
- useEffect11(() => {
7314
+ useEffect12(() => {
6927
7315
  if (selectedSecondary && effectivePrimary && selectedSecondary.toLowerCase() === effectivePrimary.toLowerCase()) {
6928
7316
  setSelectedSecondary("");
6929
7317
  }
@@ -6946,12 +7334,12 @@ function SEOCopilotInner({ config, onClose }) {
6946
7334
  const chatHookState = useSEOChat(apiUrl, text, effectivePublication, keywordPanelData, documentId);
6947
7335
  const contentSuggestionsKey = documentId ? `seo-copilot-content-suggestions-${documentId}` : "seo-copilot-content-suggestions-default";
6948
7336
  const [contentSuggestions, setContentSuggestions] = usePersistentState(contentSuggestionsKey, null);
6949
- const [isCSLoading, setIsCSLoading] = useState16(false);
6950
- const [csError, setCsError] = useState16(null);
6951
- const aeoOpVersionRef = useRef11(0);
6952
- const csAbortRef = useRef11(null);
6953
- const didInitAeoRef = useRef11(false);
6954
- useEffect11(() => {
7337
+ const [isCSLoading, setIsCSLoading] = useState17(false);
7338
+ const [csError, setCsError] = useState17(null);
7339
+ const aeoOpVersionRef = useRef12(0);
7340
+ const csAbortRef = useRef12(null);
7341
+ const didInitAeoRef = useRef12(false);
7342
+ useEffect12(() => {
6955
7343
  if (!didInitAeoRef.current) {
6956
7344
  didInitAeoRef.current = true;
6957
7345
  return;
@@ -6985,14 +7373,14 @@ function SEOCopilotInner({ config, onClose }) {
6985
7373
  }, [apiUrl, text, effectivePrimary, effectivePublication]);
6986
7374
  const linkingKey = documentId ? `seo-copilot-linking-${documentId}` : "seo-copilot-linking-default";
6987
7375
  const [linkingSuggestions, setLinkingSuggestions] = usePersistentState(linkingKey, []);
6988
- const [isLinkingLoading, setIsLinkingLoading] = useState16(false);
6989
- const [linkingError, setLinkingError] = useState16(null);
6990
- const [linkingFetchedText, setLinkingFetchedText] = useState16("");
6991
- const linkingVersionRef = useRef11(0);
6992
- const linkingAbortRef = useRef11(null);
6993
- const didInitLinkingRef = useRef11(false);
6994
- const lastLinkingFetchKey = useRef11("");
6995
- useEffect11(() => {
7376
+ const [isLinkingLoading, setIsLinkingLoading] = useState17(false);
7377
+ const [linkingError, setLinkingError] = useState17(null);
7378
+ const [linkingFetchedText, setLinkingFetchedText] = useState17("");
7379
+ const linkingVersionRef = useRef12(0);
7380
+ const linkingAbortRef = useRef12(null);
7381
+ const didInitLinkingRef = useRef12(false);
7382
+ const lastLinkingFetchKey = useRef12("");
7383
+ useEffect12(() => {
6996
7384
  if (!didInitLinkingRef.current) {
6997
7385
  didInitLinkingRef.current = true;
6998
7386
  return;
@@ -7042,7 +7430,7 @@ function SEOCopilotInner({ config, onClose }) {
7042
7430
  if (Math.abs(text.length - linkingFetchedText.length) > 150) return true;
7043
7431
  return text.slice(0, 300) !== linkingFetchedText.slice(0, 300);
7044
7432
  }, [text, linkingFetchedText, linkingSuggestions.length]);
7045
- useEffect11(() => {
7433
+ useEffect12(() => {
7046
7434
  if (!text || text.trim().length < 50 || !effectivePrimary) return;
7047
7435
  const fetchKey = `${documentId || "_"}|${effectivePrimary}|${supportingKeywordsForLinking.join(",")}`;
7048
7436
  if (fetchKey === lastLinkingFetchKey.current) return;
@@ -7056,11 +7444,11 @@ function SEOCopilotInner({ config, onClose }) {
7056
7444
  const linkCheckKey = documentId ? `seo-copilot-link-check-${documentId}` : "seo-copilot-link-check-default";
7057
7445
  const [linkCheckResults, setLinkCheckResults] = usePersistentState(linkCheckKey, []);
7058
7446
  const [hasRunLinkCheck, setHasRunLinkCheck] = usePersistentState(`${linkCheckKey}-ran`, false);
7059
- const [isLinkCheckLoading, setIsLinkCheckLoading] = useState16(false);
7060
- const [linkCheckError, setLinkCheckError] = useState16(null);
7061
- const linkCheckVersionRef = useRef11(0);
7062
- const didInitLinkCheckRef = useRef11(false);
7063
- useEffect11(() => {
7447
+ const [isLinkCheckLoading, setIsLinkCheckLoading] = useState17(false);
7448
+ const [linkCheckError, setLinkCheckError] = useState17(null);
7449
+ const linkCheckVersionRef = useRef12(0);
7450
+ const didInitLinkCheckRef = useRef12(false);
7451
+ useEffect12(() => {
7064
7452
  if (!didInitLinkCheckRef.current) {
7065
7453
  didInitLinkCheckRef.current = true;
7066
7454
  return;
@@ -7095,7 +7483,7 @@ function SEOCopilotInner({ config, onClose }) {
7095
7483
  if (linkCheckVersionRef.current !== myVersion) return;
7096
7484
  setIsLinkCheckLoading(false);
7097
7485
  }, [apiUrl, documentFields?.bodyLinks, setHasRunLinkCheck, setLinkCheckResults]);
7098
- useEffect11(() => {
7486
+ useEffect12(() => {
7099
7487
  return () => {
7100
7488
  activeDragCleanupRef.current?.();
7101
7489
  activeResizeCleanupRef.current?.();
@@ -7109,10 +7497,10 @@ function SEOCopilotInner({ config, onClose }) {
7109
7497
  if (text && text.trim().length >= 50 && effectivePrimary) refreshLinkingSuggestions();
7110
7498
  if ((documentFields?.bodyLinks || []).length > 0) runLinkCheck();
7111
7499
  };
7112
- const runAllRef = useRef11(runAllAnalyses);
7500
+ const runAllRef = useRef12(runAllAnalyses);
7113
7501
  runAllRef.current = runAllAnalyses;
7114
- const secAutoRunRef = useRef11({ doc: documentId, sec: selectedSecondary, init: true });
7115
- useEffect11(() => {
7502
+ const secAutoRunRef = useRef12({ doc: documentId, sec: selectedSecondary, init: true });
7503
+ useEffect12(() => {
7116
7504
  const prev = secAutoRunRef.current;
7117
7505
  const docChanged = prev.doc !== documentId;
7118
7506
  const secChanged = prev.sec !== selectedSecondary;
@@ -7187,7 +7575,7 @@ function SEOCopilotInner({ config, onClose }) {
7187
7575
  },
7188
7576
  [floatSize]
7189
7577
  );
7190
- const panelContent = /* @__PURE__ */ jsx16(
7578
+ const panelContent = /* @__PURE__ */ jsx17(
7191
7579
  PanelContent,
7192
7580
  {
7193
7581
  initialPublication: effectivePublication,
@@ -7269,7 +7657,7 @@ function SEOCopilotInner({ config, onClose }) {
7269
7657
  }
7270
7658
  }
7271
7659
  );
7272
- const floatingPanel = /* @__PURE__ */ jsxs15(
7660
+ const floatingPanel = /* @__PURE__ */ jsxs16(
7273
7661
  "div",
7274
7662
  {
7275
7663
  style: {
@@ -7287,7 +7675,7 @@ function SEOCopilotInner({ config, onClose }) {
7287
7675
  },
7288
7676
  children: [
7289
7677
  panelContent,
7290
- !isFullscreen && /* @__PURE__ */ jsx16(
7678
+ !isFullscreen && /* @__PURE__ */ jsx17(
7291
7679
  "div",
7292
7680
  {
7293
7681
  onMouseDown: handleResizeStart,
@@ -7302,9 +7690,9 @@ function SEOCopilotInner({ config, onClose }) {
7302
7690
  alignItems: "center",
7303
7691
  justifyContent: "center"
7304
7692
  },
7305
- children: /* @__PURE__ */ jsxs15("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "#9ca3af", children: [
7306
- /* @__PURE__ */ jsx16("path", { d: "M9 1v8H1", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" }),
7307
- /* @__PURE__ */ jsx16("path", { d: "M9 5v4H5", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" })
7693
+ children: /* @__PURE__ */ jsxs16("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "#9ca3af", children: [
7694
+ /* @__PURE__ */ jsx17("path", { d: "M9 1v8H1", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" }),
7695
+ /* @__PURE__ */ jsx17("path", { d: "M9 5v4H5", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" })
7308
7696
  ] })
7309
7697
  }
7310
7698
  )
@@ -7312,8 +7700,8 @@ function SEOCopilotInner({ config, onClose }) {
7312
7700
  }
7313
7701
  );
7314
7702
  if (isFloating) {
7315
- return /* @__PURE__ */ jsxs15(Fragment9, { children: [
7316
- /* @__PURE__ */ jsx16(
7703
+ return /* @__PURE__ */ jsxs16(Fragment10, { children: [
7704
+ /* @__PURE__ */ jsx17(
7317
7705
  "div",
7318
7706
  {
7319
7707
  style: {
@@ -7323,30 +7711,30 @@ function SEOCopilotInner({ config, onClose }) {
7323
7711
  alignItems: "center",
7324
7712
  justifyContent: "center"
7325
7713
  },
7326
- children: /* @__PURE__ */ jsx16("span", { style: { fontSize: 12, color: "rgba(0,0,0,0.5)" }, children: "SEO Copilot is floating" })
7714
+ children: /* @__PURE__ */ jsx17("span", { style: { fontSize: 12, color: "rgba(0,0,0,0.5)" }, children: "SEO Copilot is floating" })
7327
7715
  }
7328
7716
  ),
7329
7717
  typeof document !== "undefined" && createPortal(floatingPanel, document.body)
7330
7718
  ] });
7331
7719
  }
7332
- return /* @__PURE__ */ jsx16("div", { style: { height: "100%", background: PANEL_BG, position: "relative", zIndex: 1 }, children: panelContent });
7720
+ return /* @__PURE__ */ jsx17("div", { style: { height: "100%", background: PANEL_BG, position: "relative", zIndex: 1 }, children: panelContent });
7333
7721
  }
7334
7722
  function SEOCopilotPanel({ config, onClose }) {
7335
- return /* @__PURE__ */ jsx16(
7723
+ return /* @__PURE__ */ jsx17(
7336
7724
  Suspense,
7337
7725
  {
7338
- fallback: /* @__PURE__ */ jsxs15("div", { style: { padding: 16, display: "flex", alignItems: "center", gap: 12 }, children: [
7339
- /* @__PURE__ */ jsx16(LoadingBars, {}),
7340
- /* @__PURE__ */ jsx16("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Loading SEO Copilot..." })
7726
+ fallback: /* @__PURE__ */ jsxs16("div", { style: { padding: 16, display: "flex", alignItems: "center", gap: 12 }, children: [
7727
+ /* @__PURE__ */ jsx17(LoadingBars, {}),
7728
+ /* @__PURE__ */ jsx17("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Loading SEO Copilot..." })
7341
7729
  ] }),
7342
- children: /* @__PURE__ */ jsx16(ConfigProvider, { config, children: /* @__PURE__ */ jsx16(SEOCopilotInner, { config, onClose }) })
7730
+ children: /* @__PURE__ */ jsx17(ConfigProvider, { config, children: /* @__PURE__ */ jsx17(SEOCopilotInner, { config, onClose }) })
7343
7731
  }
7344
7732
  );
7345
7733
  }
7346
7734
  function LoadingBars({ size = "sm", color = MJH_GOLD }) {
7347
7735
  const barWidth = size === "xs" ? 4 : 6;
7348
7736
  const containerHeight = size === "xs" ? 10 : 14;
7349
- return /* @__PURE__ */ jsx16("div", { style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: containerHeight }, children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx16(
7737
+ return /* @__PURE__ */ jsx17("div", { style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: containerHeight }, children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx17(
7350
7738
  "div",
7351
7739
  {
7352
7740
  style: {