sanity-plugin-seo-copilot 0.2.13 → 0.2.15

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.js CHANGED
@@ -33,14 +33,14 @@ __export(index_exports, {
33
33
  seoCopilot: () => seoCopilot
34
34
  });
35
35
  module.exports = __toCommonJS(index_exports);
36
- var import_sanity4 = require("sanity");
36
+ var import_sanity5 = require("sanity");
37
37
 
38
38
  // src/inspector.ts
39
- var import_react19 = require("react");
39
+ var import_react20 = require("react");
40
40
 
41
41
  // src/components/SEOCopilotPanel.tsx
42
- var import_react18 = require("react");
43
- var import_sanity3 = require("sanity");
42
+ var import_react19 = require("react");
43
+ var import_sanity4 = require("sanity");
44
44
  var import_react_dom = require("react-dom");
45
45
 
46
46
  // src/hooks/useDocumentContent.ts
@@ -84,30 +84,83 @@ function extractHeadingsDetailed(blocks) {
84
84
  }
85
85
  return out;
86
86
  }
87
- function extractBodyLinks(blocks) {
88
- const urls = /* @__PURE__ */ new Set();
87
+ function normalizeLink(raw) {
88
+ const s = raw.trim().replace(/[.,;:!?]+$/, "");
89
+ if (!s) return null;
90
+ if (/^https?:\/\//i.test(s)) return s;
91
+ if (/^www\.\S+\.\S+/i.test(s) || /^[a-z0-9-]+(\.[a-z0-9-]+)+(\/|$)/i.test(s)) return `https://${s}`;
92
+ return null;
93
+ }
94
+ var UNSTYLED_HEADING_SCAN_CAP = 600;
95
+ function extractUnstyledHeadings(blocks) {
96
+ if (!Array.isArray(blocks)) return [];
97
+ const items = blocks.slice(0, UNSTYLED_HEADING_SCAN_CAP).map((b) => {
98
+ if (!b || b._type !== "block") return null;
99
+ const style = b.style || "normal";
100
+ const text = (b.children || []).map((c) => c.text || "").join("").trim();
101
+ return {
102
+ isHeading: /^h[1-6]$/.test(style),
103
+ isPlain: style === "normal",
104
+ isList: typeof b.listItem === "string" && b.listItem.length > 0,
105
+ text,
106
+ words: text ? text.split(/\s+/).filter(Boolean).length : 0
107
+ };
108
+ });
109
+ const out = [];
110
+ for (let i = 0; i < items.length; i++) {
111
+ const it = items[i];
112
+ if (!it || it.isHeading || it.isList || !it.isPlain) continue;
113
+ if (it.words < 2 || it.words > 9) continue;
114
+ if (/[.!?]$/.test(it.text)) continue;
115
+ if (!/[A-Za-z]/.test(it.text)) continue;
116
+ if (/https?:\/\/|doi:|\baccessed\b|image credit|stock\.adobe|^figure\b|^table\b|^source[:s]?\b|^references?\b/i.test(it.text)) continue;
117
+ let next = null;
118
+ for (let j = i + 1; j < items.length; j++) {
119
+ if (items[j] && items[j].text) {
120
+ next = items[j];
121
+ break;
122
+ }
123
+ }
124
+ if (!next || next.isHeading || next.words < 12) continue;
125
+ out.push(it.text);
126
+ if (out.length >= 8) break;
127
+ }
128
+ return out;
129
+ }
130
+ function extractBodyLinksDetailed(blocks) {
131
+ const linked = /* @__PURE__ */ new Set();
132
+ const all = /* @__PURE__ */ new Set();
133
+ const anchorByUrl = /* @__PURE__ */ new Map();
89
134
  if (Array.isArray(blocks)) {
90
135
  for (const block of blocks) {
91
136
  if (block._type === "block" && Array.isArray(block.markDefs)) {
92
137
  for (const md of block.markDefs) {
93
138
  const href = md.href || md.url;
94
- if (typeof href === "string" && /^https?:\/\//i.test(href)) {
95
- urls.add(href.trim());
96
- }
139
+ if (typeof href !== "string") continue;
140
+ const n = normalizeLink(href);
141
+ if (!n) continue;
142
+ linked.add(n);
143
+ all.add(n);
144
+ const anchor = (block.children || []).filter((c) => Array.isArray(c.marks) && md._key && c.marks.includes(md._key)).map((c) => c.text || "").join("").trim();
145
+ if (anchor && !anchorByUrl.has(n)) anchorByUrl.set(n, anchor);
97
146
  }
98
147
  }
99
148
  }
100
- }
101
- if (Array.isArray(blocks)) {
102
149
  for (const block of blocks) {
103
150
  if (block._type === "block" && Array.isArray(block.children)) {
104
151
  const blockText = block.children.map((c) => c.text || "").join(" ");
105
- const matches = blockText.match(/https?:\/\/[^\s"'<>)\]]+/g);
106
- if (matches) matches.forEach((u) => urls.add(u.replace(/[.,;:!?]+$/, "")));
152
+ const matches = blockText.match(/(?:https?:\/\/|www\.)[^\s"'<>)\]]+/gi);
153
+ if (matches) for (const u of matches) {
154
+ const n = normalizeLink(u);
155
+ if (n) all.add(n);
156
+ }
107
157
  }
108
158
  }
109
159
  }
110
- return Array.from(urls);
160
+ return [...all].map((url) => ({ url, hyperlinked: linked.has(url), anchorText: anchorByUrl.get(url) }));
161
+ }
162
+ function extractBodyLinks(blocks) {
163
+ return extractBodyLinksDetailed(blocks).map((l) => l.url);
111
164
  }
112
165
  function detectSlug(val) {
113
166
  if (!val) return void 0;
@@ -182,6 +235,86 @@ function detectAuthor(val) {
182
235
  }
183
236
  return { authorIsReference: false };
184
237
  }
238
+ var FACT_CHECK_STATUS_WORDS = /* @__PURE__ */ new Set([
239
+ "pending",
240
+ "approved",
241
+ "rejected",
242
+ "done",
243
+ "complete",
244
+ "completed",
245
+ "in review",
246
+ "in progress",
247
+ "not started",
248
+ "draft",
249
+ "review",
250
+ "reviewed",
251
+ "unreviewed",
252
+ "checked",
253
+ "unchecked",
254
+ "verified",
255
+ "unverified",
256
+ "true",
257
+ "false",
258
+ "yes",
259
+ "no",
260
+ "n/a",
261
+ "na",
262
+ "none",
263
+ "tbd",
264
+ "todo",
265
+ "to do"
266
+ ]);
267
+ function isLikelyPersonName(s) {
268
+ const t = s.trim().toLowerCase();
269
+ if (!t || FACT_CHECK_STATUS_WORDS.has(t)) return false;
270
+ return /[a-z]/i.test(s);
271
+ }
272
+ function detectFactChecker(val) {
273
+ if (!val) return { factCheckerIsReference: false };
274
+ const candidateFields = [
275
+ "factChecker",
276
+ "factCheckers",
277
+ "factCheckedBy",
278
+ "reviewer",
279
+ "reviewers",
280
+ "reviewedBy",
281
+ "medicalReviewer",
282
+ "medicallyReviewedBy"
283
+ ];
284
+ const dynamic = Object.keys(val).filter(
285
+ (k) => (
286
+ // Require "checker"/"checked by"/"reviewer"/"reviewed by" - NOT a bare "check" flag.
287
+ /factchecker|fact.?checked.?by|reviewer|reviewed.?by/i.test(k) && // never date/timestamp fields (lastReviewedAt, medicallyReviewedAt, reviewedDate),
288
+ // free-text/status/flag sidecars (reviewerNotes, reviewStatus), nor image/url/id fields.
289
+ !/at$|date$|on$|url|link|count|note|comment|status|flag|bool|photo|image|avatar|picture|id$/i.test(k)
290
+ )
291
+ );
292
+ const fields = Array.from(/* @__PURE__ */ new Set([...candidateFields, ...dynamic]));
293
+ for (const f of fields) {
294
+ const raw = val[f];
295
+ if (!raw) continue;
296
+ if (Array.isArray(raw)) {
297
+ const names = raw.filter((x) => typeof x === "string" && isLikelyPersonName(x)).map((x) => x.trim());
298
+ if (names.length > 0) return { factCheckerName: names.slice(0, 3).join(", "), factCheckerIsReference: false };
299
+ }
300
+ const first = Array.isArray(raw) ? raw[0] : raw;
301
+ if (!first) continue;
302
+ if (typeof first === "string") {
303
+ const trimmed = first.trim();
304
+ if (trimmed && isLikelyPersonName(trimmed)) return { factCheckerName: trimmed, factCheckerIsReference: false };
305
+ continue;
306
+ }
307
+ if (typeof first === "object" && first !== null) {
308
+ const o = first;
309
+ const name = [o.name, o.fullName, o.displayName].find((v) => typeof v === "string" && isLikelyPersonName(v));
310
+ if (name) return { factCheckerName: name, factCheckerIsReference: false };
311
+ if (typeof o._ref === "string" || o._type === "reference") {
312
+ return { factCheckerIsReference: true };
313
+ }
314
+ }
315
+ }
316
+ return { factCheckerIsReference: false };
317
+ }
185
318
  function extractImageMeta(value) {
186
319
  const names = [];
187
320
  const titles = [];
@@ -220,6 +353,7 @@ function buildDocumentFields(value) {
220
353
  const title = typeof val?.title === "string" ? val.title : void 0;
221
354
  const body = val?.body;
222
355
  const { authorName, authorCredentials, authorBioUrl, authorIsReference } = detectAuthor(val);
356
+ const { factCheckerName, factCheckerIsReference } = detectFactChecker(val);
223
357
  const imageMeta = val ? extractImageMeta(val) : { names: [], titles: [], count: 0 };
224
358
  return {
225
359
  title: title || void 0,
@@ -231,13 +365,17 @@ function buildDocumentFields(value) {
231
365
  imageCount: imageMeta.count,
232
366
  headings: extractHeadings(body),
233
367
  headingsDetailed: extractHeadingsDetailed(body),
368
+ unstyledHeadings: extractUnstyledHeadings(body),
234
369
  bodyLinks: extractBodyLinks(body),
370
+ bodyLinksDetailed: extractBodyLinksDetailed(body),
235
371
  contentCategory: typeof val?.contentCategory === "string" ? val.contentCategory : typeof val?.category === "string" ? val.category : void 0,
236
372
  contentPlacement: Array.isArray(val?.contentPlacement) ? val.contentPlacement : void 0,
237
373
  authorName,
238
374
  authorCredentials,
239
375
  authorBioUrl,
240
376
  authorIsReference,
377
+ factCheckerName,
378
+ factCheckerIsReference,
241
379
  // `published` is MJH's date field; `publishedAt`/`publishDate` cover other schemas
242
380
  publishedAt: [val?.publishedAt, val?.publishDate, val?.published, val?._createdAt].find((v) => typeof v === "string" && v.trim().length > 0),
243
381
  // `updatedOn` is MJH's "Updated On" field. `updatedAt` is the standard Sanity convention.
@@ -285,6 +423,15 @@ function useDocumentContent() {
285
423
  // src/hooks/useKeywordAnalysis.ts
286
424
  var import_react2 = require("react");
287
425
 
426
+ // src/lib/apiKey.ts
427
+ var SHARED_CLIENT_KEY = "seo-copilot-public-client-key-v1";
428
+ function authHeaders() {
429
+ return { "x-api-key": SHARED_CLIENT_KEY };
430
+ }
431
+ function jsonHeaders() {
432
+ return { "Content-Type": "application/json", ...authHeaders() };
433
+ }
434
+
288
435
  // src/lib/api.ts
289
436
  function safeParseJson(text) {
290
437
  try {
@@ -305,7 +452,7 @@ function safeParseJson(text) {
305
452
  async function fetchAnalysis(apiUrl, content, mode, publication, seedKeywords, documentFields, focusKeyword, secondaryKeyword, signal) {
306
453
  const response = await fetch(`${apiUrl}/api/seo-copilot/analyze`, {
307
454
  method: "POST",
308
- headers: { "Content-Type": "application/json" },
455
+ headers: jsonHeaders(),
309
456
  body: JSON.stringify({ content, mode, publication, seedKeywords, documentFields, focusKeyword, secondaryKeyword }),
310
457
  signal
311
458
  });
@@ -320,7 +467,7 @@ async function fetchAnalysis(apiUrl, content, mode, publication, seedKeywords, d
320
467
  async function fetchChatStream(apiUrl, messages, documentContext, publication, keywordPanelData, signal) {
321
468
  const response = await fetch(`${apiUrl}/api/seo-copilot/chat`, {
322
469
  method: "POST",
323
- headers: { "Content-Type": "application/json" },
470
+ headers: jsonHeaders(),
324
471
  body: JSON.stringify({ messages, documentContext, publication, keywordPanelData }),
325
472
  signal
326
473
  });
@@ -332,16 +479,17 @@ async function fetchChatStream(apiUrl, messages, documentContext, publication, k
332
479
  return response.body;
333
480
  }
334
481
  async function submitFeedback(apiUrl, data) {
335
- await fetch(`${apiUrl}/api/seo-copilot/feedback`, {
482
+ const res = await fetch(`${apiUrl}/api/seo-copilot/feedback`, {
336
483
  method: "POST",
337
- headers: { "Content-Type": "application/json" },
484
+ headers: jsonHeaders(),
338
485
  body: JSON.stringify(data)
339
486
  });
487
+ if (!res.ok) throw new Error(`Feedback submit failed: HTTP ${res.status}`);
340
488
  }
341
489
  async function lookupKeywords(apiUrl, keywords, signal) {
342
490
  const response = await fetch(`${apiUrl}/api/seo-copilot/keywords`, {
343
491
  method: "POST",
344
- headers: { "Content-Type": "application/json" },
492
+ headers: jsonHeaders(),
345
493
  body: JSON.stringify({ keywords }),
346
494
  signal
347
495
  });
@@ -355,7 +503,8 @@ async function lookupKeywords(apiUrl, keywords, signal) {
355
503
  async function loadChatHistory(apiUrl, userId, documentId) {
356
504
  try {
357
505
  const res = await fetch(
358
- `${apiUrl}/api/seo-copilot/chat-history?userId=${encodeURIComponent(userId)}&documentId=${encodeURIComponent(documentId)}`
506
+ `${apiUrl}/api/seo-copilot/chat-history?userId=${encodeURIComponent(userId)}&documentId=${encodeURIComponent(documentId)}`,
507
+ { headers: authHeaders() }
359
508
  );
360
509
  if (!res.ok) return [];
361
510
  const data = await res.json();
@@ -369,7 +518,7 @@ async function fetchContentSuggestions(apiUrl, content, primaryKeyword, publicat
369
518
  try {
370
519
  const res = await fetch(`${apiUrl}/api/seo-copilot/content-suggestions`, {
371
520
  method: "POST",
372
- headers: { "Content-Type": "application/json" },
521
+ headers: jsonHeaders(),
373
522
  body: JSON.stringify({ content, primaryKeyword, publication }),
374
523
  signal
375
524
  });
@@ -390,7 +539,7 @@ async function fetchLinkingSuggestions(apiUrl, content, primaryKeyword, supporti
390
539
  try {
391
540
  const res = await fetch(`${apiUrl}/api/seo-copilot/linking-suggestions`, {
392
541
  method: "POST",
393
- headers: { "Content-Type": "application/json" },
542
+ headers: jsonHeaders(),
394
543
  body: JSON.stringify({ content, primaryKeyword, supportingKeywords, currentDocumentId, publication }),
395
544
  signal
396
545
  });
@@ -407,7 +556,7 @@ async function checkLinks(apiUrl, urls) {
407
556
  try {
408
557
  const res = await fetch(`${apiUrl}/api/seo-copilot/check-links`, {
409
558
  method: "POST",
410
- headers: { "Content-Type": "application/json" },
559
+ headers: jsonHeaders(),
411
560
  body: JSON.stringify({ urls })
412
561
  });
413
562
  if (!res.ok) return [];
@@ -422,7 +571,7 @@ async function saveChatHistory(apiUrl, userId, documentId, messages, publication
422
571
  try {
423
572
  await fetch(`${apiUrl}/api/seo-copilot/chat-history`, {
424
573
  method: "POST",
425
- headers: { "Content-Type": "application/json" },
574
+ headers: jsonHeaders(),
426
575
  body: JSON.stringify({ userId, documentId, messages, publication })
427
576
  });
428
577
  } catch {
@@ -1836,7 +1985,7 @@ function SuggestedKeywordsCard({
1836
1985
  const previousSuggestions = forceRegenerate && helpData[term] ? helpData[term].map((s) => s.revised || s.sentence || "").filter(Boolean) : void 0;
1837
1986
  const res = await fetch(`${apiUrl}/api/seo-copilot/keyword-help`, {
1838
1987
  method: "POST",
1839
- headers: { "Content-Type": "application/json" },
1988
+ headers: jsonHeaders(),
1840
1989
  // Clip to 5,000 chars: the backend only reads the first 4,000 anyway, so sending
1841
1990
  // the full article needlessly bloats the request on long pieces.
1842
1991
  body: JSON.stringify({ keyword: term, content: text.slice(0, 5e3), publication, previousSuggestions })
@@ -1864,7 +2013,7 @@ function SuggestedKeywordsCard({
1864
2013
  try {
1865
2014
  const res = await fetch(`${apiUrl}/api/seo-copilot/keywords`, {
1866
2015
  method: "POST",
1867
- headers: { "Content-Type": "application/json" },
2016
+ headers: jsonHeaders(),
1868
2017
  body: JSON.stringify({ keywords: [trimmed] })
1869
2018
  });
1870
2019
  if (res.ok) {
@@ -1945,7 +2094,7 @@ function SuggestedKeywordsCard({
1945
2094
  const existingTerms = allKeywords.map((kw) => kw.term);
1946
2095
  const res = await fetch(`${apiUrl}/api/seo-copilot/more-keywords`, {
1947
2096
  method: "POST",
1948
- headers: { "Content-Type": "application/json" },
2097
+ headers: jsonHeaders(),
1949
2098
  body: JSON.stringify({ content: text, existingKeywords: existingTerms, publication })
1950
2099
  });
1951
2100
  if (res.ok) {
@@ -3153,12 +3302,219 @@ function OnboardingCard({ onDismiss, closing }) {
3153
3302
  ] });
3154
3303
  }
3155
3304
 
3305
+ // src/components/ReportProblemButton.tsx
3306
+ var import_react12 = require("react");
3307
+ var import_sanity3 = require("sanity");
3308
+ var import_jsx_runtime9 = require("react/jsx-runtime");
3309
+ function ReportProblemButton({ activeTab, publication, documentId, documentType, primaryKeyword }) {
3310
+ const { apiUrl } = useConfig();
3311
+ const sanityUser = (0, import_sanity3.useCurrentUser)();
3312
+ const [open, setOpen] = (0, import_react12.useState)(false);
3313
+ const [text, setText] = (0, import_react12.useState)("");
3314
+ const [submitting, setSubmitting] = (0, import_react12.useState)(false);
3315
+ const [submitted, setSubmitted] = (0, import_react12.useState)(false);
3316
+ const [failed, setFailed] = (0, import_react12.useState)(false);
3317
+ const popRef = (0, import_react12.useRef)(null);
3318
+ const textareaRef = (0, import_react12.useRef)(null);
3319
+ const closeTimer = (0, import_react12.useRef)(null);
3320
+ const mounted = (0, import_react12.useRef)(true);
3321
+ (0, import_react12.useEffect)(() => () => {
3322
+ mounted.current = false;
3323
+ if (closeTimer.current) clearTimeout(closeTimer.current);
3324
+ }, []);
3325
+ (0, import_react12.useEffect)(() => {
3326
+ if (!open) return;
3327
+ const handler = (e) => {
3328
+ if (popRef.current && !popRef.current.contains(e.target)) setOpen(false);
3329
+ };
3330
+ document.addEventListener("mousedown", handler);
3331
+ return () => document.removeEventListener("mousedown", handler);
3332
+ }, [open]);
3333
+ (0, import_react12.useEffect)(() => {
3334
+ if (open) setTimeout(() => textareaRef.current?.focus(), 50);
3335
+ }, [open]);
3336
+ const handleSubmit = async () => {
3337
+ const trimmed = text.trim();
3338
+ if (!trimmed || submitting) return;
3339
+ setFailed(false);
3340
+ setSubmitting(true);
3341
+ try {
3342
+ await submitFeedback(apiUrl, {
3343
+ suggestion_type: "bug_report",
3344
+ suggestion_text: trimmed.slice(0, 1e4),
3345
+ vote: "down",
3346
+ document_id: documentId,
3347
+ publication,
3348
+ user_id: sanityUser?.id,
3349
+ context: {
3350
+ surface: "sanity-plugin",
3351
+ activeTab,
3352
+ primaryKeyword: primaryKeyword || void 0,
3353
+ documentType,
3354
+ url: typeof window !== "undefined" && /^https?:\/\//i.test(window.location.href) ? window.location.href.slice(0, 500) : void 0,
3355
+ userAgent: typeof navigator !== "undefined" ? navigator.userAgent.slice(0, 500) : void 0,
3356
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
3357
+ }
3358
+ });
3359
+ } catch (e) {
3360
+ console.error("[SEO Copilot] failed to send problem report:", e);
3361
+ if (mounted.current) {
3362
+ setSubmitting(false);
3363
+ setFailed(true);
3364
+ }
3365
+ return;
3366
+ }
3367
+ if (!mounted.current) return;
3368
+ setSubmitting(false);
3369
+ setSubmitted(true);
3370
+ closeTimer.current = setTimeout(() => {
3371
+ if (!mounted.current) return;
3372
+ setOpen(false);
3373
+ setSubmitted(false);
3374
+ setText("");
3375
+ }, 1500);
3376
+ };
3377
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { position: "relative", display: "flex" }, children: [
3378
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3379
+ "button",
3380
+ {
3381
+ type: "button",
3382
+ onClick: (e) => {
3383
+ e.stopPropagation();
3384
+ if (closeTimer.current) {
3385
+ clearTimeout(closeTimer.current);
3386
+ closeTimer.current = null;
3387
+ }
3388
+ setOpen((o) => !o);
3389
+ },
3390
+ onMouseDown: (e) => e.stopPropagation(),
3391
+ "aria-label": "Report a problem",
3392
+ title: "Report a problem",
3393
+ style: {
3394
+ display: "inline-flex",
3395
+ alignItems: "center",
3396
+ gap: 4,
3397
+ padding: "3px 8px",
3398
+ borderRadius: 99,
3399
+ border: `1px solid ${open ? MJH_BLUE : "#d1d5db"}`,
3400
+ background: open ? "rgba(0,93,172,0.08)" : "rgba(255,255,255,0.6)",
3401
+ cursor: "pointer",
3402
+ fontSize: 10,
3403
+ fontWeight: 600,
3404
+ color: open ? MJH_BLUE : "#6b7280",
3405
+ whiteSpace: "nowrap",
3406
+ transition: "all 150ms"
3407
+ },
3408
+ children: [
3409
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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" }) }),
3410
+ "Report a problem"
3411
+ ]
3412
+ }
3413
+ ),
3414
+ open && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3415
+ "div",
3416
+ {
3417
+ ref: popRef,
3418
+ onMouseDown: (e) => e.stopPropagation(),
3419
+ style: {
3420
+ position: "absolute",
3421
+ top: "100%",
3422
+ right: 0,
3423
+ marginTop: 6,
3424
+ width: 260,
3425
+ padding: 12,
3426
+ borderRadius: 10,
3427
+ background: "#ffffff",
3428
+ boxShadow: "0 6px 22px rgba(0,0,0,0.16), 0 1px 4px rgba(0,0,0,0.1)",
3429
+ border: "1px solid #e5e7eb",
3430
+ zIndex: 100
3431
+ },
3432
+ children: submitted ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { fontSize: 12, color: "#16a34a", textAlign: "center", padding: "6px 0", fontWeight: 600 }, children: "Thanks - we got it." }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
3433
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 3 }, children: "Report a problem" }),
3434
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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." }),
3435
+ failed && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { fontSize: 10.5, color: "#dc2626", marginBottom: 8, lineHeight: 1.45, fontWeight: 600 }, children: "Couldn't send - please try again." }),
3436
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3437
+ "textarea",
3438
+ {
3439
+ ref: textareaRef,
3440
+ value: text,
3441
+ onChange: (e) => setText(e.target.value),
3442
+ onKeyDown: (e) => {
3443
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
3444
+ e.preventDefault();
3445
+ handleSubmit();
3446
+ }
3447
+ },
3448
+ placeholder: "What happened? The more detail, the better.",
3449
+ rows: 4,
3450
+ maxLength: 4e3,
3451
+ style: {
3452
+ width: "100%",
3453
+ padding: "6px 8px",
3454
+ fontSize: 11,
3455
+ borderRadius: 6,
3456
+ border: "1px solid #e5e7eb",
3457
+ outline: "none",
3458
+ fontFamily: "inherit",
3459
+ resize: "vertical",
3460
+ boxSizing: "border-box",
3461
+ lineHeight: 1.5
3462
+ }
3463
+ }
3464
+ ),
3465
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { display: "flex", justifyContent: "flex-end", marginTop: 8, gap: 6 }, children: [
3466
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3467
+ "button",
3468
+ {
3469
+ type: "button",
3470
+ onClick: () => {
3471
+ setOpen(false);
3472
+ setText("");
3473
+ },
3474
+ style: {
3475
+ padding: "4px 10px",
3476
+ fontSize: 10.5,
3477
+ borderRadius: 5,
3478
+ border: "1px solid #e5e7eb",
3479
+ background: "#ffffff",
3480
+ color: "#4b5563",
3481
+ cursor: "pointer"
3482
+ },
3483
+ children: "Cancel"
3484
+ }
3485
+ ),
3486
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3487
+ "button",
3488
+ {
3489
+ type: "button",
3490
+ onClick: handleSubmit,
3491
+ disabled: !text.trim() || submitting,
3492
+ style: {
3493
+ padding: "4px 12px",
3494
+ fontSize: 10.5,
3495
+ borderRadius: 5,
3496
+ border: "none",
3497
+ background: !text.trim() || submitting ? "#cbd5e1" : MJH_BLUE,
3498
+ color: "#ffffff",
3499
+ cursor: !text.trim() || submitting ? "default" : "pointer",
3500
+ fontWeight: 700
3501
+ },
3502
+ children: submitting ? "Sending..." : "Send"
3503
+ }
3504
+ )
3505
+ ] })
3506
+ ] })
3507
+ }
3508
+ )
3509
+ ] });
3510
+ }
3511
+
3156
3512
  // src/components/tabs/SummaryTab.tsx
3157
- var import_react13 = require("react");
3513
+ var import_react14 = require("react");
3158
3514
 
3159
3515
  // src/components/ShimmerLoader.tsx
3160
- var import_react12 = require("react");
3161
- var import_jsx_runtime9 = require("react/jsx-runtime");
3516
+ var import_react13 = require("react");
3517
+ var import_jsx_runtime10 = require("react/jsx-runtime");
3162
3518
  var keyframesInjected = false;
3163
3519
  var KEYFRAMES = `
3164
3520
  @keyframes seo-copilot-text-shimmer {
@@ -3167,13 +3523,13 @@ var KEYFRAMES = `
3167
3523
  }
3168
3524
  `;
3169
3525
  function LoaderBars({ color = MJH_GOLD }) {
3170
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3526
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3171
3527
  "div",
3172
3528
  {
3173
3529
  role: "status",
3174
3530
  "aria-label": "Loading",
3175
3531
  style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: 14, flexShrink: 0 },
3176
- children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3532
+ children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3177
3533
  "div",
3178
3534
  {
3179
3535
  style: {
@@ -3195,8 +3551,8 @@ function ShimmerLoader({
3195
3551
  textSize = 14,
3196
3552
  iconColor = MJH_GOLD
3197
3553
  }) {
3198
- const [idx, setIdx] = (0, import_react12.useState)(0);
3199
- (0, import_react12.useEffect)(() => {
3554
+ const [idx, setIdx] = (0, import_react13.useState)(0);
3555
+ (0, import_react13.useEffect)(() => {
3200
3556
  if (typeof window !== "undefined" && !keyframesInjected) {
3201
3557
  keyframesInjected = true;
3202
3558
  const style = document.createElement("style");
@@ -3205,7 +3561,7 @@ function ShimmerLoader({
3205
3561
  document.head.appendChild(style);
3206
3562
  }
3207
3563
  }, []);
3208
- (0, import_react12.useEffect)(() => {
3564
+ (0, import_react13.useEffect)(() => {
3209
3565
  if (messages.length <= 1) return;
3210
3566
  const id = setInterval(() => {
3211
3567
  setIdx((i) => (i + 1) % messages.length);
@@ -3213,7 +3569,7 @@ function ShimmerLoader({
3213
3569
  return () => clearInterval(id);
3214
3570
  }, [messages.length, intervalMs]);
3215
3571
  const text = messages[idx] || messages[0] || "";
3216
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3572
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3217
3573
  "div",
3218
3574
  {
3219
3575
  style: {
@@ -3225,8 +3581,8 @@ function ShimmerLoader({
3225
3581
  letterSpacing: "0.01em"
3226
3582
  },
3227
3583
  children: [
3228
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LoaderBars, { color: iconColor }),
3229
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3584
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LoaderBars, { color: iconColor }),
3585
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3230
3586
  "span",
3231
3587
  {
3232
3588
  style: {
@@ -3304,9 +3660,9 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
3304
3660
  detail = `Primary keyword over-used at ${density.toFixed(2)}% density - reduce to 0.5-2.5%`;
3305
3661
  }
3306
3662
  }
3307
- components.push({ label: "Primary keyword", points: pts, max: 25, detail });
3663
+ components.push({ label: "Primary keyword usage", points: pts, max: 25, detail });
3308
3664
  } else {
3309
- components.push({ label: "Primary keyword", points: 0, max: 25, detail: "No primary keyword identified yet" });
3665
+ components.push({ label: "Primary keyword usage", points: 0, max: 25, detail: "No primary keyword identified yet" });
3310
3666
  }
3311
3667
  const supportingKws = analysis.supportingKeywords || [];
3312
3668
  if (supportingKws.length > 0) {
@@ -3314,13 +3670,13 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
3314
3670
  const coverageRatio = inContentCount / supportingKws.length;
3315
3671
  const pts = Math.round(coverageRatio * 25);
3316
3672
  components.push({
3317
- label: "Supporting keywords",
3673
+ label: "Supporting keyword coverage",
3318
3674
  points: pts,
3319
3675
  max: 25,
3320
3676
  detail: `${inContentCount} of ${supportingKws.length} supporting keywords present (${Math.round(coverageRatio * 100)}%)`
3321
3677
  });
3322
3678
  } else {
3323
- components.push({ label: "Supporting keywords", points: 0, max: 25, detail: "No supporting keywords yet" });
3679
+ components.push({ label: "Supporting keyword coverage", points: 0, max: 25, detail: "No supporting keywords yet" });
3324
3680
  }
3325
3681
  let wcPts = 0;
3326
3682
  let wcDetail;
@@ -3630,18 +3986,6 @@ function buildSummaryItems(input) {
3630
3986
  });
3631
3987
  }
3632
3988
  if (headingsDetailed) {
3633
- const bodyH1 = headingsDetailed.filter((h) => h.level === 1).length;
3634
- if (bodyH1 > 0) {
3635
- items.push({
3636
- id: "headings-h1-in-body",
3637
- category: "headings",
3638
- severity: "warning",
3639
- label: "H1 inside the body",
3640
- description: `${bodyH1} H1 heading${bodyH1 === 1 ? "" : "s"} in the body of the article.`,
3641
- howToFix: "The article title is your H1. Body headings should start at H2 so the outline isn't ambiguous.",
3642
- jumpTo: { tab: "technical", anchorId: "anchor-headings-structure" }
3643
- });
3644
- }
3645
3989
  let prevLevel = 0;
3646
3990
  let skips = 0;
3647
3991
  for (const h of headingsDetailed) {
@@ -3671,6 +4015,23 @@ function buildSummaryItems(input) {
3671
4015
  jumpTo: { tab: "technical", anchorId: "anchor-headings-structure" }
3672
4016
  });
3673
4017
  }
4018
+ const subheads = headingsDetailed.filter((h) => h.level >= 2);
4019
+ if (subheads.length > 0 && (primaryKeyword || secondaryKeyword)) {
4020
+ const subText = subheads.map((h) => h.text).join(" ");
4021
+ const hasP = primaryKeyword ? containsKeywordTokens(subText, primaryKeyword) : false;
4022
+ const hasS = secondaryKeyword ? containsKeywordTokens(subText, secondaryKeyword) : false;
4023
+ if (!hasP && !hasS) {
4024
+ items.push({
4025
+ id: "headings-keyword-missing",
4026
+ category: "headings",
4027
+ severity: "opportunity",
4028
+ label: "Keyword missing from subheadings",
4029
+ description: "No H2/H3 subheading uses your primary or secondary keyword.",
4030
+ howToFix: "Work your primary or secondary keyword into at least one subheading - keywords in headers reinforce relevance for readers and search.",
4031
+ jumpTo: { tab: "technical", anchorId: "anchor-headings-keyword" }
4032
+ });
4033
+ }
4034
+ }
3674
4035
  }
3675
4036
  const images = documentFields?.imageNames || [];
3676
4037
  if (images.length === 0 && wordCount2 > 300) {
@@ -3923,7 +4284,7 @@ function buildSummaryItems(input) {
3923
4284
  }
3924
4285
 
3925
4286
  // src/components/tabs/SummaryTab.tsx
3926
- var import_jsx_runtime10 = require("react/jsx-runtime");
4287
+ var import_jsx_runtime11 = require("react/jsx-runtime");
3927
4288
  var cardStyle2 = {
3928
4289
  borderRadius: 14,
3929
4290
  background: "rgba(255,255,255,0.55)",
@@ -3945,11 +4306,16 @@ function scoreColors(score) {
3945
4306
  if (score >= 40) return { bg: "rgba(230,192,27,0.15)", text: "#8B7310", label: "Decent" };
3946
4307
  return { bg: "rgba(220,38,38,0.08)", text: "#dc2626", label: "Needs work" };
3947
4308
  }
4309
+ function componentTier(pct) {
4310
+ if (pct >= 75) return { label: "Strong", color: "#16a34a", bar: "#16a34a" };
4311
+ if (pct >= 40) return { label: "OK", color: "#8B7310", bar: "#E6C01B" };
4312
+ return { label: "Low", color: "#dc2626", bar: "#dc2626" };
4313
+ }
3948
4314
  function ScoreBadge({ score, breakdown }) {
3949
4315
  const c = scoreColors(score);
3950
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: cardStyle2, children: [
3951
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 14 }, children: [
3952
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4316
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: cardStyle2, children: [
4317
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 14 }, children: [
4318
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3953
4319
  "div",
3954
4320
  {
3955
4321
  style: {
@@ -3958,37 +4324,28 @@ function ScoreBadge({ score, breakdown }) {
3958
4324
  borderRadius: "50%",
3959
4325
  background: c.bg,
3960
4326
  display: "flex",
3961
- flexDirection: "column",
3962
4327
  alignItems: "center",
3963
4328
  justifyContent: "center",
3964
- flexShrink: 0,
3965
- lineHeight: 1
4329
+ flexShrink: 0
3966
4330
  },
3967
- children: [
3968
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 20, fontWeight: 700, color: c.text }, children: score }),
3969
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 8, fontWeight: 700, color: c.text, opacity: 0.7, letterSpacing: "0.06em", marginTop: 2 }, children: "/ 100" })
3970
- ]
4331
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { width: 22, height: 22, borderRadius: "50%", background: c.text, opacity: 0.9 } })
3971
4332
  }
3972
4333
  ),
3973
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
3974
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, marginBottom: 2 }, children: "Content Score" }),
3975
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 14, fontWeight: 700, color: c.text }, children: c.label })
4334
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
4335
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, marginBottom: 2 }, children: "Content Score" }),
4336
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 16, fontWeight: 700, color: c.text }, children: c.label })
3976
4337
  ] })
3977
4338
  ] }),
3978
- breakdown.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 8 }, children: breakdown.map((comp, i) => {
4339
+ breakdown.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 8 }, children: breakdown.map((comp, i) => {
3979
4340
  const pct = comp.max > 0 ? comp.points / comp.max * 100 : 0;
3980
- const barColor = pct >= 75 ? "#16a34a" : pct >= 40 ? "#E6C01B" : "#dc2626";
3981
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3982
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 3 }, children: [
3983
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: comp.label }),
3984
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { style: { fontSize: 11, color: "#4b5563", fontVariantNumeric: "tabular-nums" }, children: [
3985
- comp.points,
3986
- " / ",
3987
- comp.max
3988
- ] })
4341
+ const tier = componentTier(pct);
4342
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
4343
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 3 }, children: [
4344
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: comp.label }),
4345
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 9.5, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.04em", color: tier.color }, children: tier.label })
3989
4346
  ] }),
3990
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { height: 4, background: "#f1f5f9", borderRadius: 99, overflow: "hidden", marginBottom: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { width: `${pct}%`, height: "100%", background: barColor, transition: "width 200ms" } }) }),
3991
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 10.5, color: "#4b5563", lineHeight: 1.4 }, children: comp.detail })
4347
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { height: 4, background: "#f1f5f9", borderRadius: 99, overflow: "hidden", marginBottom: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { width: `${pct}%`, height: "100%", background: tier.bar, transition: "width 200ms" } }) }),
4348
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10.5, color: "#4b5563", lineHeight: 1.4 }, children: comp.detail })
3992
4349
  ] }, i);
3993
4350
  }) })
3994
4351
  ] });
@@ -4002,7 +4359,7 @@ function ItemCard({ item, onClick }) {
4002
4359
  const v = severityVisual(item.severity);
4003
4360
  const tab = item.jumpTo.tab;
4004
4361
  const tabLabel = TAB_LABEL[tab] ?? tab.charAt(0).toUpperCase() + tab.slice(1);
4005
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4362
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4006
4363
  "div",
4007
4364
  {
4008
4365
  onClick,
@@ -4019,8 +4376,8 @@ function ItemCard({ item, onClick }) {
4019
4376
  cursor: "pointer"
4020
4377
  },
4021
4378
  children: [
4022
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", gap: 9 }, children: [
4023
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4379
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", gap: 9 }, children: [
4380
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4024
4381
  "div",
4025
4382
  {
4026
4383
  style: {
@@ -4033,12 +4390,12 @@ function ItemCard({ item, onClick }) {
4033
4390
  }
4034
4391
  }
4035
4392
  ),
4036
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
4037
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 2 }, children: item.label }),
4038
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 11, color: "#374151", lineHeight: 1.5 }, children: item.description })
4393
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
4394
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 2 }, children: item.label }),
4395
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 11, color: "#374151", lineHeight: 1.5 }, children: item.description })
4039
4396
  ] })
4040
4397
  ] }),
4041
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4398
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4042
4399
  "div",
4043
4400
  {
4044
4401
  style: {
@@ -4050,12 +4407,12 @@ function ItemCard({ item, onClick }) {
4050
4407
  lineHeight: 1.55
4051
4408
  },
4052
4409
  children: [
4053
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontWeight: 700, color: "#4b5563", letterSpacing: "0.04em", fontSize: 9.5, textTransform: "uppercase", marginRight: 6 }, children: "Fix" }),
4410
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontWeight: 700, color: "#4b5563", letterSpacing: "0.04em", fontSize: 9.5, textTransform: "uppercase", marginRight: 6 }, children: "Fix" }),
4054
4411
  item.howToFix
4055
4412
  ]
4056
4413
  }
4057
4414
  ),
4058
- item.jumpTo.tab !== "summary" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { style: { fontSize: 10, fontWeight: 700, color: MJH_BLUE }, children: [
4415
+ item.jumpTo.tab !== "summary" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { style: { fontSize: 10, fontWeight: 700, color: MJH_BLUE }, children: [
4059
4416
  "Go to ",
4060
4417
  tabLabel,
4061
4418
  " \u203A"
@@ -4071,7 +4428,7 @@ function FilterChip({
4071
4428
  count,
4072
4429
  dotColor
4073
4430
  }) {
4074
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4431
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4075
4432
  "button",
4076
4433
  {
4077
4434
  onClick,
@@ -4090,9 +4447,9 @@ function FilterChip({
4090
4447
  transition: "all 150ms"
4091
4448
  },
4092
4449
  children: [
4093
- dotColor && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { width: 6, height: 6, borderRadius: "50%", background: dotColor, display: "inline-block" } }),
4094
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: label }),
4095
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 10, opacity: 0.8 }, children: count })
4450
+ dotColor && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { width: 6, height: 6, borderRadius: "50%", background: dotColor, display: "inline-block" } }),
4451
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: label }),
4452
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 10, opacity: 0.8 }, children: count })
4096
4453
  ]
4097
4454
  }
4098
4455
  );
@@ -4110,13 +4467,13 @@ function SummaryTab({
4110
4467
  onGenerateAll,
4111
4468
  onItemClick
4112
4469
  }) {
4113
- const scoreDetail = (0, import_react13.useMemo)(() => {
4470
+ const scoreDetail = (0, import_react14.useMemo)(() => {
4114
4471
  if (!analysis) return null;
4115
4472
  const scored = primaryKeyword && analysis.primaryKeyword && primaryKeyword !== analysis.primaryKeyword.term ? { ...analysis, primaryKeyword: { ...analysis.primaryKeyword, term: primaryKeyword } } : analysis;
4116
4473
  return calculateContentScoreDetailed(text, scored, documentFields);
4117
4474
  }, [text, analysis, documentFields, primaryKeyword]);
4118
4475
  const score = scoreDetail?.total ?? null;
4119
- const items = (0, import_react13.useMemo)(
4476
+ const items = (0, import_react14.useMemo)(
4120
4477
  () => buildSummaryItems({
4121
4478
  analysis,
4122
4479
  deepAnalysis,
@@ -4130,8 +4487,8 @@ function SummaryTab({
4130
4487
  }),
4131
4488
  [analysis, deepAnalysis, documentFields, score, linkingSuggestions, linkCheckResults, text, primaryKeyword, secondaryKeyword]
4132
4489
  );
4133
- const [filter, setFilter] = (0, import_react13.useState)("all");
4134
- const counts = (0, import_react13.useMemo)(
4490
+ const [filter, setFilter] = (0, import_react14.useState)("all");
4491
+ const counts = (0, import_react14.useMemo)(
4135
4492
  () => ({
4136
4493
  all: items.length,
4137
4494
  error: items.filter((i) => i.severity === "error").length,
@@ -4142,15 +4499,15 @@ function SummaryTab({
4142
4499
  );
4143
4500
  const filtered = filter === "all" ? items : items.filter((i) => i.severity === filter);
4144
4501
  if (!analysis) {
4145
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
4146
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Start with the Keywords tab" }),
4147
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Once keywords are analyzed, the summary appears here." })
4502
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
4503
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Start with the Keywords tab" }),
4504
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Once keywords are analyzed, the summary appears here." })
4148
4505
  ] });
4149
4506
  }
4150
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
4151
- score != null && scoreDetail && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScoreBadge, { score, breakdown: scoreDetail.components }),
4152
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: cardStyle2, children: [
4153
- isAnyLoading ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", padding: "4px 0" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ShimmerLoader, { messages: DEFAULT_GENERATE_ALL_MESSAGES }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4507
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
4508
+ score != null && scoreDetail && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ScoreBadge, { score, breakdown: scoreDetail.components }),
4509
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: cardStyle2, children: [
4510
+ isAnyLoading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", padding: "4px 0" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ShimmerLoader, { messages: DEFAULT_GENERATE_ALL_MESSAGES }) }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4154
4511
  "button",
4155
4512
  {
4156
4513
  onClick: onGenerateAll,
@@ -4178,24 +4535,24 @@ function SummaryTab({
4178
4535
  children: "Run all analyses"
4179
4536
  }
4180
4537
  ),
4181
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { fontSize: 10.5, color: "#4b5563", marginTop: 8, lineHeight: 1.5 }, children: [
4538
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { fontSize: 10.5, color: "#4b5563", marginTop: 8, lineHeight: 1.5 }, children: [
4182
4539
  "Runs the analyses that fill the ",
4183
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: "AEO/GEO" }),
4540
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: "AEO/GEO" }),
4184
4541
  ", ",
4185
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: "Linking" }),
4542
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: "Linking" }),
4186
4543
  ", and ",
4187
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: "Other Recs" }),
4544
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: "Other Recs" }),
4188
4545
  " tabs. New issues they find appear in this Summary as each one finishes."
4189
4546
  ] })
4190
4547
  ] }),
4191
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: [
4192
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FilterChip, { active: filter === "all", onClick: () => setFilter("all"), label: "All", count: counts.all }),
4193
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FilterChip, { active: filter === "error", onClick: () => setFilter("error"), label: "Errors", count: counts.error, dotColor: "#dc2626" }),
4194
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FilterChip, { active: filter === "warning", onClick: () => setFilter("warning"), label: "Warnings", count: counts.warning, dotColor: "#E6C01B" }),
4195
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FilterChip, { active: filter === "opportunity", onClick: () => setFilter("opportunity"), label: "Opportunities", count: counts.opportunity, dotColor: MJH_BLUE })
4548
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: [
4549
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FilterChip, { active: filter === "all", onClick: () => setFilter("all"), label: "All", count: counts.all }),
4550
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FilterChip, { active: filter === "error", onClick: () => setFilter("error"), label: "Errors", count: counts.error, dotColor: "#dc2626" }),
4551
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FilterChip, { active: filter === "warning", onClick: () => setFilter("warning"), label: "Warnings", count: counts.warning, dotColor: "#E6C01B" }),
4552
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FilterChip, { active: filter === "opportunity", onClick: () => setFilter("opportunity"), label: "Opportunities", count: counts.opportunity, dotColor: MJH_BLUE })
4196
4553
  ] }),
4197
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { id: "anchor-summary-issues", style: { display: "flex", flexDirection: "column", gap: 8 }, children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { ...cardStyle2, textAlign: "center", padding: "20px 14px" }, children: items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
4198
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4554
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { id: "anchor-summary-issues", style: { display: "flex", flexDirection: "column", gap: 8 }, children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { ...cardStyle2, textAlign: "center", padding: "20px 14px" }, children: items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
4555
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4199
4556
  "div",
4200
4557
  {
4201
4558
  style: {
@@ -4208,21 +4565,21 @@ function SummaryTab({
4208
4565
  justifyContent: "center",
4209
4566
  margin: "0 auto 8px"
4210
4567
  },
4211
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "#16a34a", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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" }) })
4568
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "#16a34a", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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" }) })
4212
4569
  }
4213
4570
  ),
4214
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 13, color: "#16a34a", fontWeight: 700 }, children: "Looking good" }),
4215
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 2 }, children: "No issues found for this article." })
4216
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 12, color: "#4b5563" }, children: "Nothing in this category." }) }) : filtered.map((item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ItemCard, { item, onClick: () => onItemClick(item) }, item.id)) }),
4217
- isAnyLoading && items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 6, padding: "4px 0" }, children: [
4218
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LoadingBars, { size: "xs", color: MJH_BLUE }),
4219
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 10, color: "#4b5563" }, children: "Still checking..." })
4571
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 13, color: "#16a34a", fontWeight: 700 }, children: "Looking good" }),
4572
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 2 }, children: "No issues found for this article." })
4573
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 12, color: "#4b5563" }, children: "Nothing in this category." }) }) : filtered.map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ItemCard, { item, onClick: () => onItemClick(item) }, item.id)) }),
4574
+ isAnyLoading && items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 6, padding: "4px 0" }, children: [
4575
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LoadingBars, { size: "xs", color: MJH_BLUE }),
4576
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 10, color: "#4b5563" }, children: "Still checking..." })
4220
4577
  ] })
4221
4578
  ] });
4222
4579
  }
4223
4580
 
4224
4581
  // src/components/tabs/AEOTab.tsx
4225
- var import_react14 = require("react");
4582
+ var import_react15 = require("react");
4226
4583
 
4227
4584
  // src/lib/geoAnalysis.ts
4228
4585
  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;
@@ -4296,7 +4653,7 @@ function analyzeGEO(text, headings) {
4296
4653
  }
4297
4654
 
4298
4655
  // src/components/tabs/AEOTab.tsx
4299
- var import_jsx_runtime11 = require("react/jsx-runtime");
4656
+ var import_jsx_runtime12 = require("react/jsx-runtime");
4300
4657
  var AEO_PURPLE = "#005DAC";
4301
4658
  var GEO_TEAL = "#C9A716";
4302
4659
  var cardStyle3 = {
@@ -4308,7 +4665,7 @@ var cardStyle3 = {
4308
4665
  padding: "14px"
4309
4666
  };
4310
4667
  function AiPill() {
4311
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4668
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4312
4669
  "span",
4313
4670
  {
4314
4671
  style: {
@@ -4327,16 +4684,16 @@ function AiPill() {
4327
4684
  );
4328
4685
  }
4329
4686
  function SectionHeader2({ label, iconColor, ai }) {
4330
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 4 }, children: [
4331
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
4332
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
4333
- ai && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AiPill, {})
4687
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 4 }, children: [
4688
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
4689
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
4690
+ ai && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AiPill, {})
4334
4691
  ] });
4335
4692
  }
4336
4693
  function CopyButton({ text }) {
4337
- const [copied, setCopied] = (0, import_react14.useState)(false);
4338
- const copyTimerRef = (0, import_react14.useRef)(null);
4339
- (0, import_react14.useEffect)(() => {
4694
+ const [copied, setCopied] = (0, import_react15.useState)(false);
4695
+ const copyTimerRef = (0, import_react15.useRef)(null);
4696
+ (0, import_react15.useEffect)(() => {
4340
4697
  return () => {
4341
4698
  if (copyTimerRef.current) clearTimeout(copyTimerRef.current);
4342
4699
  };
@@ -4349,7 +4706,7 @@ function CopyButton({ text }) {
4349
4706
  } catch {
4350
4707
  }
4351
4708
  };
4352
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4709
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4353
4710
  "button",
4354
4711
  {
4355
4712
  onClick: handleCopy,
@@ -4368,9 +4725,9 @@ function CopyButton({ text }) {
4368
4725
  transition: "color 150ms"
4369
4726
  },
4370
4727
  title: copied ? "Copied!" : "Copy to clipboard",
4371
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: [
4372
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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" }),
4373
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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" })
4728
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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__ */ (0, import_jsx_runtime12.jsxs)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: [
4729
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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" }),
4730
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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" })
4374
4731
  ] })
4375
4732
  }
4376
4733
  );
@@ -4385,13 +4742,13 @@ function GEOCard({ geo, publication }) {
4385
4742
  const fdBg = effectiveStatus === "strong" ? "rgba(22,163,74,0.1)" : effectiveStatus === "moderate" ? "rgba(230,192,27,0.15)" : "rgba(220,38,38,0.08)";
4386
4743
  const goodCount = geo.headingAudit.filter((h) => h.status === "good").length;
4387
4744
  const totalHeadings = geo.headingAudit.length;
4388
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: cardStyle3, children: [
4389
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 4 }, children: [
4390
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SectionHeader2, { label: "AI Citation Readiness", iconColor: GEO_TEAL }),
4391
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FeedbackButton, { suggestionType: "geo_summary", suggestionText: `facts/1k: ${fd.factsPerThousandWords}; short-answer headings: ${goodCount}/${totalHeadings}`, publication })
4745
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: cardStyle3, children: [
4746
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 4 }, children: [
4747
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SectionHeader2, { label: "AI Citation Readiness", iconColor: GEO_TEAL }),
4748
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FeedbackButton, { suggestionType: "geo_summary", suggestionText: `facts/1k: ${fd.factsPerThousandWords}; short-answer headings: ${goodCount}/${totalHeadings}`, publication })
4392
4749
  ] }),
4393
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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." }),
4394
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4750
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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." }),
4751
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4395
4752
  "div",
4396
4753
  {
4397
4754
  style: {
@@ -4404,7 +4761,7 @@ function GEOCard({ geo, publication }) {
4404
4761
  marginBottom: 8
4405
4762
  },
4406
4763
  children: [
4407
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4764
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4408
4765
  "div",
4409
4766
  {
4410
4767
  style: {
@@ -4420,17 +4777,17 @@ function GEOCard({ geo, publication }) {
4420
4777
  boxShadow: "0 1px 2px rgba(0,0,0,0.06)"
4421
4778
  },
4422
4779
  children: [
4423
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 18, fontWeight: 700, color: fdColor, lineHeight: 1 }, children: fd.factsPerThousandWords }),
4424
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 7.5, fontWeight: 700, color: fdColor, opacity: 0.75, letterSpacing: "0.05em", marginTop: 2 }, children: "PER 1K" })
4780
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 18, fontWeight: 700, color: fdColor, lineHeight: 1 }, children: fd.factsPerThousandWords }),
4781
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 7.5, fontWeight: 700, color: fdColor, opacity: 0.75, letterSpacing: "0.05em", marginTop: 2 }, children: "PER 1K" })
4425
4782
  ]
4426
4783
  }
4427
4784
  ),
4428
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
4429
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { fontSize: 11, fontWeight: 700, color: fdColor, marginBottom: 2 }, children: [
4785
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
4786
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { fontSize: 11, fontWeight: 700, color: fdColor, marginBottom: 2 }, children: [
4430
4787
  "Fact density: ",
4431
4788
  fdLabel
4432
4789
  ] }),
4433
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.45 }, children: [
4790
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.45 }, children: [
4434
4791
  fd.factCount,
4435
4792
  " specific stat",
4436
4793
  fd.factCount === 1 ? "" : "s",
@@ -4446,7 +4803,7 @@ function GEOCard({ geo, publication }) {
4446
4803
  ]
4447
4804
  }
4448
4805
  ),
4449
- fd.driftPassages > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4806
+ fd.driftPassages > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4450
4807
  "div",
4451
4808
  {
4452
4809
  style: {
@@ -4460,15 +4817,15 @@ function GEOCard({ geo, publication }) {
4460
4817
  lineHeight: 1.45
4461
4818
  },
4462
4819
  children: [
4463
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: fd.driftPassages }),
4820
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: fd.driftPassages }),
4464
4821
  " passage",
4465
4822
  fd.driftPassages === 1 ? "" : "s",
4466
4823
  " over 200 words with no specific stats or citations. AI engines tend to skip these."
4467
4824
  ]
4468
4825
  }
4469
4826
  ),
4470
- totalHeadings > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { marginTop: 4 }, children: [
4471
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4827
+ totalHeadings > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { marginTop: 4 }, children: [
4828
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4472
4829
  "button",
4473
4830
  {
4474
4831
  onClick: () => setShowDetails((v) => !v),
@@ -4487,22 +4844,22 @@ function GEOCard({ geo, publication }) {
4487
4844
  color: GEO_TEAL
4488
4845
  },
4489
4846
  children: [
4490
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
4847
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
4491
4848
  "Short-answer paragraphs: ",
4492
4849
  goodCount,
4493
4850
  "/",
4494
4851
  totalHeadings,
4495
4852
  " headings have one"
4496
4853
  ] }),
4497
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: showDetails ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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" }) })
4854
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: showDetails ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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" }) })
4498
4855
  ]
4499
4856
  }
4500
4857
  ),
4501
- showDetails && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { marginTop: 6, display: "flex", flexDirection: "column", gap: 4 }, children: [
4502
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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." }),
4858
+ showDetails && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { marginTop: 6, display: "flex", flexDirection: "column", gap: 4 }, children: [
4859
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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." }),
4503
4860
  geo.headingAudit.map((h, i) => {
4504
4861
  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" };
4505
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4862
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4506
4863
  "div",
4507
4864
  {
4508
4865
  style: {
@@ -4516,8 +4873,8 @@ function GEOCard({ geo, publication }) {
4516
4873
  gap: 8
4517
4874
  },
4518
4875
  children: [
4519
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { flex: 1, minWidth: 0, color: "#1f2937", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: h.heading }),
4520
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 10, fontWeight: 600, color: c.color, flexShrink: 0 }, children: c.label })
4876
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { flex: 1, minWidth: 0, color: "#1f2937", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: h.heading }),
4877
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 10, fontWeight: 600, color: c.color, flexShrink: 0 }, children: c.label })
4521
4878
  ]
4522
4879
  },
4523
4880
  i
@@ -4540,7 +4897,7 @@ function AEOTab({
4540
4897
  csError,
4541
4898
  loadContentSuggestions
4542
4899
  }) {
4543
- const geo = (0, import_react14.useMemo)(() => analyzeGEO(text, headings), [text, headings]);
4900
+ const geo = (0, import_react15.useMemo)(() => analyzeGEO(text, headings), [text, headings]);
4544
4901
  const geoWordCount = text ? text.trim().split(/\s+/).filter(Boolean).length : 0;
4545
4902
  const hasEnoughTextForGEO = geoWordCount >= 150;
4546
4903
  const hasEnoughText = text && text.trim().length >= 50;
@@ -4554,8 +4911,8 @@ function AEOTab({
4554
4911
  originalHeading: void 0,
4555
4912
  rationale: h.rationale
4556
4913
  })) ?? [];
4557
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
4558
- aeoContentChanged && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4914
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
4915
+ aeoContentChanged && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4559
4916
  "div",
4560
4917
  {
4561
4918
  onClick: runDeepAnalysis,
@@ -4578,30 +4935,30 @@ function AEOTab({
4578
4935
  cursor: "pointer"
4579
4936
  },
4580
4937
  children: [
4581
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 11, color: "#92400e" }, children: "Content has changed since this was generated." }),
4582
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 11, fontWeight: 600, color: AEO_PURPLE, textDecoration: "underline" }, children: "Update" })
4938
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 11, color: "#92400e" }, children: "Content has changed since this was generated." }),
4939
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 11, fontWeight: 600, color: AEO_PURPLE, textDecoration: "underline" }, children: "Update" })
4583
4940
  ]
4584
4941
  }
4585
4942
  ),
4586
- hasEnoughTextForGEO && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GEOCard, { geo, publication }),
4587
- hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: [
4588
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { style: { color: "#C9A716" }, children: "AI citation analysis" }),
4943
+ hasEnoughTextForGEO && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(GEOCard, { geo, publication }),
4944
+ hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: [
4945
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { style: { color: "#C9A716" }, children: "AI citation analysis" }),
4589
4946
  " needs at least 150 words to read fact density.",
4590
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("br", {}),
4591
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { style: { color: "#4b5563" }, children: [
4947
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("br", {}),
4948
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: { color: "#4b5563" }, children: [
4592
4949
  "Current: ",
4593
4950
  geoWordCount,
4594
4951
  " word",
4595
4952
  geoWordCount === 1 ? "" : "s"
4596
4953
  ] })
4597
4954
  ] }) }),
4598
- !deepAnalysis && isDeepLoading && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { ...cardStyle3, display: "flex", alignItems: "center", justifyContent: "center", gap: 8 }, children: [
4599
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LoadingBars, { size: "xs", color: AEO_PURPLE }),
4600
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Generating AEO insights..." })
4955
+ !deepAnalysis && isDeepLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { ...cardStyle3, display: "flex", alignItems: "center", justifyContent: "center", gap: 8 }, children: [
4956
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LoadingBars, { size: "xs", color: AEO_PURPLE }),
4957
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Generating AEO insights..." })
4601
4958
  ] }),
4602
- !deepAnalysis && !isDeepLoading && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { ...cardStyle3, textAlign: "center" }, children: [
4603
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 12, color: "#4b5563" }, children: "AI citation readiness and question-style heading suggestions appear here once analysis runs." }),
4604
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4959
+ !deepAnalysis && !isDeepLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { ...cardStyle3, textAlign: "center" }, children: [
4960
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontSize: 12, color: "#4b5563" }, children: "AI citation readiness and question-style heading suggestions appear here once analysis runs." }),
4961
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4605
4962
  "button",
4606
4963
  {
4607
4964
  onClick: runDeepAnalysis,
@@ -4621,11 +4978,11 @@ function AEOTab({
4621
4978
  }
4622
4979
  )
4623
4980
  ] }),
4624
- deepAnalysis && !aeo && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 12, color: "#4b5563" }, children: "No insights came back. Try again - the analysis may have timed out." }) }),
4625
- questionHeadings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: cardStyle3, children: [
4626
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SectionHeader2, { label: "Question-Style Headings", iconColor: AEO_PURPLE }),
4627
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 8 }, children: "Rewrites of your existing headings as questions. Google often pulls these into featured snippets." }),
4628
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: questionHeadings.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4981
+ deepAnalysis && !aeo && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 12, color: "#4b5563" }, children: "No insights came back. Try again - the analysis may have timed out." }) }),
4982
+ questionHeadings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: cardStyle3, children: [
4983
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SectionHeader2, { label: "Question-Style Headings", iconColor: AEO_PURPLE }),
4984
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 8 }, children: "Rewrites of your existing headings as questions. Google often pulls these into featured snippets." }),
4985
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: questionHeadings.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4629
4986
  "div",
4630
4987
  {
4631
4988
  style: {
@@ -4635,26 +4992,26 @@ function AEOTab({
4635
4992
  borderLeft: `3px solid ${AEO_PURPLE}`
4636
4993
  },
4637
4994
  children: [
4638
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4639
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { flex: 1 }, children: [
4640
- h.originalHeading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 11, color: "#4b5563", textDecoration: "line-through", marginBottom: 2 }, children: h.originalHeading }),
4641
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE, lineHeight: 1.5 }, children: h.heading })
4995
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4996
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { flex: 1 }, children: [
4997
+ h.originalHeading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontSize: 11, color: "#4b5563", textDecoration: "line-through", marginBottom: 2 }, children: h.originalHeading }),
4998
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE, lineHeight: 1.5 }, children: h.heading })
4642
4999
  ] }),
4643
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4644
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CopyButton, { text: h.heading }),
4645
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FeedbackButton, { suggestionType: "aeo_heading", suggestionText: h.heading, publication })
5000
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
5001
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CopyButton, { text: h.heading }),
5002
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FeedbackButton, { suggestionType: "aeo_heading", suggestionText: h.heading, publication })
4646
5003
  ] })
4647
5004
  ] }),
4648
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 4, fontStyle: "italic" }, children: h.rationale })
5005
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 4, fontStyle: "italic" }, children: h.rationale })
4649
5006
  ]
4650
5007
  },
4651
5008
  i
4652
5009
  )) })
4653
5010
  ] }),
4654
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: cardStyle3, children: [
4655
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SectionHeader2, { label: "Content Block Suggestions", iconColor: AEO_PURPLE }),
4656
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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." }),
4657
- !contentSuggestions && !isCSLoading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
5011
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: cardStyle3, children: [
5012
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SectionHeader2, { label: "Content Block Suggestions", iconColor: AEO_PURPLE }),
5013
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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." }),
5014
+ !contentSuggestions && !isCSLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4658
5015
  "button",
4659
5016
  {
4660
5017
  onClick: loadContentSuggestions,
@@ -4678,15 +5035,15 @@ function AEOTab({
4678
5035
  children: "Generate suggestions"
4679
5036
  }
4680
5037
  ),
4681
- isCSLoading && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "8px 0" }, children: [
4682
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LoadingBars, { size: "xs", color: AEO_PURPLE }),
4683
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Generating content suggestions..." })
5038
+ isCSLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "8px 0" }, children: [
5039
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LoadingBars, { size: "xs", color: AEO_PURPLE }),
5040
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Generating content suggestions..." })
4684
5041
  ] }),
4685
- csError && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { marginTop: 6, fontSize: 11, color: "#dc2626" }, children: csError }),
4686
- contentSuggestions && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 14, marginTop: 8 }, children: [
4687
- contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
4688
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Key Takeaways" }),
4689
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.keyTakeaways.map((kt, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
5042
+ csError && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { marginTop: 6, fontSize: 11, color: "#dc2626" }, children: csError }),
5043
+ contentSuggestions && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 14, marginTop: 8 }, children: [
5044
+ contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
5045
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Key Takeaways" }),
5046
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.keyTakeaways.map((kt, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4690
5047
  "div",
4691
5048
  {
4692
5049
  style: {
@@ -4699,19 +5056,19 @@ function AEOTab({
4699
5056
  alignItems: "flex-start"
4700
5057
  },
4701
5058
  children: [
4702
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, flex: 1 }, children: kt }),
4703
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4704
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CopyButton, { text: kt }),
4705
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FeedbackButton, { suggestionType: "aeo_takeaway", suggestionText: kt, publication })
5059
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, flex: 1 }, children: kt }),
5060
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
5061
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CopyButton, { text: kt }),
5062
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FeedbackButton, { suggestionType: "aeo_takeaway", suggestionText: kt, publication })
4706
5063
  ] })
4707
5064
  ]
4708
5065
  },
4709
5066
  i
4710
5067
  )) })
4711
5068
  ] }),
4712
- contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
4713
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Infographic Ideas" }),
4714
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.infographicOpportunities.map((io, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
5069
+ contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
5070
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Infographic Ideas" }),
5071
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.infographicOpportunities.map((io, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4715
5072
  "div",
4716
5073
  {
4717
5074
  style: {
@@ -4721,23 +5078,23 @@ function AEOTab({
4721
5078
  borderLeft: `2px solid ${AEO_PURPLE}`
4722
5079
  },
4723
5080
  children: [
4724
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4725
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE }, children: io.concept }),
4726
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FeedbackButton, { suggestionType: "aeo_infographic", suggestionText: io.concept, publication })
5081
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
5082
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE }, children: io.concept }),
5083
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FeedbackButton, { suggestionType: "aeo_infographic", suggestionText: io.concept, publication })
4727
5084
  ] }),
4728
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginTop: 3 }, children: io.description })
5085
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginTop: 3 }, children: io.description })
4729
5086
  ]
4730
5087
  },
4731
5088
  i
4732
5089
  )) })
4733
5090
  ] }),
4734
- contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
4735
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Bullets for Featured Snippets" }),
4736
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4737
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { style: { margin: 0, paddingLeft: 18, flex: 1 }, children: contentSuggestions.bulletListItems.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, marginBottom: 4 }, children: b }, i)) }),
4738
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4739
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CopyButton, { text: contentSuggestions.bulletListItems.map((b) => "- " + b).join("\n") }),
4740
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
5091
+ contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
5092
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Bullets for Featured Snippets" }),
5093
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
5094
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { style: { margin: 0, paddingLeft: 18, flex: 1 }, children: contentSuggestions.bulletListItems.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("li", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, marginBottom: 4 }, children: b }, i)) }),
5095
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
5096
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CopyButton, { text: contentSuggestions.bulletListItems.map((b) => "- " + b).join("\n") }),
5097
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4741
5098
  FeedbackButton,
4742
5099
  {
4743
5100
  suggestionType: "aeo_bullets",
@@ -4748,7 +5105,7 @@ function AEOTab({
4748
5105
  ] })
4749
5106
  ] })
4750
5107
  ] }),
4751
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
5108
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4752
5109
  "button",
4753
5110
  {
4754
5111
  onClick: loadContentSuggestions,
@@ -4777,8 +5134,8 @@ function AEOTab({
4777
5134
  }
4778
5135
 
4779
5136
  // src/components/ScoreDonut.tsx
4780
- var import_react15 = require("react");
4781
- var import_jsx_runtime12 = require("react/jsx-runtime");
5137
+ var import_react16 = require("react");
5138
+ var import_jsx_runtime13 = require("react/jsx-runtime");
4782
5139
  var W = { topic: 0.6, freshness: 0.25, sectionFit: 0.15 };
4783
5140
  var COLORS = { topic: MJH_BLUE, freshness: MJH_GOLD, sectionFit: "#9B59B6" };
4784
5141
  var TRACK = "#eef2f7";
@@ -4790,7 +5147,7 @@ function ScoreDonut({
4790
5147
  sectionFit,
4791
5148
  composite
4792
5149
  }) {
4793
- const [hovered, setHovered] = (0, import_react15.useState)(false);
5150
+ const [hovered, setHovered] = (0, import_react16.useState)(false);
4794
5151
  const radius = (size - strokeWidth) / 2;
4795
5152
  const circumference = 2 * Math.PI * radius;
4796
5153
  const cTopic = topic * W.topic;
@@ -4803,7 +5160,7 @@ function ScoreDonut({
4803
5160
  const topicLen = seg(cTopic);
4804
5161
  const freshLen = seg(cFresh);
4805
5162
  const sectionLen = seg(cSection);
4806
- const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
5163
+ const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4807
5164
  "circle",
4808
5165
  {
4809
5166
  cx: size / 2,
@@ -4817,20 +5174,20 @@ function ScoreDonut({
4817
5174
  strokeDashoffset: -offset
4818
5175
  }
4819
5176
  );
4820
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
5177
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4821
5178
  "div",
4822
5179
  {
4823
5180
  style: { position: "relative", width: size, height: size, flexShrink: 0 },
4824
5181
  onMouseEnter: () => setHovered(true),
4825
5182
  onMouseLeave: () => setHovered(false),
4826
5183
  children: [
4827
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, style: { transform: "rotate(-90deg)" }, children: [
4828
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("circle", { cx: size / 2, cy: size / 2, r: radius, fill: "none", stroke: TRACK, strokeWidth }),
4829
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Slice, { color: COLORS.topic, fullLen: topicLen, offset: 0 }),
4830
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Slice, { color: COLORS.freshness, fullLen: freshLen, offset: topicLen }),
4831
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Slice, { color: COLORS.sectionFit, fullLen: sectionLen, offset: topicLen + freshLen })
5184
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, style: { transform: "rotate(-90deg)" }, children: [
5185
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("circle", { cx: size / 2, cy: size / 2, r: radius, fill: "none", stroke: TRACK, strokeWidth }),
5186
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Slice, { color: COLORS.topic, fullLen: topicLen, offset: 0 }),
5187
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Slice, { color: COLORS.freshness, fullLen: freshLen, offset: topicLen }),
5188
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Slice, { color: COLORS.sectionFit, fullLen: sectionLen, offset: topicLen + freshLen })
4832
5189
  ] }),
4833
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
5190
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4834
5191
  "div",
4835
5192
  {
4836
5193
  style: {
@@ -4844,15 +5201,15 @@ function ScoreDonut({
4844
5201
  lineHeight: 1
4845
5202
  },
4846
5203
  children: [
4847
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: { fontSize: Math.max(11, size / 5.5), fontWeight: 700, color: "#1f2937" }, children: [
5204
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { style: { fontSize: Math.max(11, size / 5.5), fontWeight: 700, color: "#1f2937" }, children: [
4848
5205
  compositeValue,
4849
5206
  "%"
4850
5207
  ] }),
4851
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: Math.max(7, size / 11), fontWeight: 700, color: "#4b5563", letterSpacing: "0.05em", marginTop: 1 }, children: "MATCH" })
5208
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: Math.max(7, size / 11), fontWeight: 700, color: "#4b5563", letterSpacing: "0.05em", marginTop: 1 }, children: "MATCH" })
4852
5209
  ]
4853
5210
  }
4854
5211
  ),
4855
- hovered && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
5212
+ hovered && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4856
5213
  "div",
4857
5214
  {
4858
5215
  role: "tooltip",
@@ -4873,9 +5230,9 @@ function ScoreDonut({
4873
5230
  pointerEvents: "none"
4874
5231
  },
4875
5232
  children: [
4876
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SubScoreRow, { color: COLORS.topic, label: "Topic", value: topic }),
4877
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SubScoreRow, { color: COLORS.freshness, label: "Freshness", value: freshness }),
4878
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SubScoreRow, { color: COLORS.sectionFit, label: "Section fit", value: sectionFit })
5233
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SubScoreRow, { color: COLORS.topic, label: "Topic", value: topic }),
5234
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SubScoreRow, { color: COLORS.freshness, label: "Freshness", value: freshness }),
5235
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SubScoreRow, { color: COLORS.sectionFit, label: "Section fit", value: sectionFit })
4879
5236
  ]
4880
5237
  }
4881
5238
  )
@@ -4884,31 +5241,31 @@ function ScoreDonut({
4884
5241
  );
4885
5242
  }
4886
5243
  function SubScoreRow({ color, label, value }) {
4887
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
4888
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block", flexShrink: 0 } }),
4889
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { flex: 1 }, children: label }),
4890
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: { fontWeight: 700, fontVariantNumeric: "tabular-nums" }, children: [
5244
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
5245
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block", flexShrink: 0 } }),
5246
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { flex: 1 }, children: label }),
5247
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { style: { fontWeight: 700, fontVariantNumeric: "tabular-nums" }, children: [
4891
5248
  Math.round(value),
4892
5249
  "/100"
4893
5250
  ] })
4894
5251
  ] });
4895
5252
  }
4896
5253
  function ScoreDonutLegend() {
4897
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", gap: 10, fontSize: 9, color: "rgba(0,0,0,0.55)", alignItems: "center", flexWrap: "wrap" }, children: [
4898
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LegendDot, { color: COLORS.topic, label: "Topic match (60% of score)" }),
4899
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LegendDot, { color: COLORS.freshness, label: "Freshness (25%)" }),
4900
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LegendDot, { color: COLORS.sectionFit, label: "Section fit (15%)" })
5254
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", gap: 10, fontSize: 9, color: "rgba(0,0,0,0.55)", alignItems: "center", flexWrap: "wrap" }, children: [
5255
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LegendDot, { color: COLORS.topic, label: "Topic match (60% of score)" }),
5256
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LegendDot, { color: COLORS.freshness, label: "Freshness (25%)" }),
5257
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LegendDot, { color: COLORS.sectionFit, label: "Section fit (15%)" })
4901
5258
  ] });
4902
5259
  }
4903
5260
  function LegendDot({ color, label }) {
4904
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
4905
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block" } }),
5261
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
5262
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block" } }),
4906
5263
  label
4907
5264
  ] });
4908
5265
  }
4909
5266
 
4910
5267
  // src/components/tabs/LinkingTab.tsx
4911
- var import_jsx_runtime13 = require("react/jsx-runtime");
5268
+ var import_jsx_runtime14 = require("react/jsx-runtime");
4912
5269
  function buildLiveUrl(publication, slug) {
4913
5270
  if (!slug) return null;
4914
5271
  const pub = (publication || "").trim().toLowerCase();
@@ -4924,7 +5281,7 @@ function buildSanityUrl(baseUrl, id, type) {
4924
5281
  return `${base}/intent/edit/id=${encodeURIComponent(cleanId)}${typePart}/`;
4925
5282
  }
4926
5283
  function LinkChip({ href, label, color }) {
4927
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
5284
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
4928
5285
  "a",
4929
5286
  {
4930
5287
  href,
@@ -4946,14 +5303,38 @@ function LinkChip({ href, label, color }) {
4946
5303
  },
4947
5304
  children: [
4948
5305
  label,
4949
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("svg", { width: "9", height: "9", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
4950
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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" }),
4951
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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" })
5306
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { width: "9", height: "9", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
5307
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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" }),
5308
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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" })
4952
5309
  ] })
4953
5310
  ]
4954
5311
  }
4955
5312
  );
4956
5313
  }
5314
+ function ClickableBadge({ clickable }) {
5315
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5316
+ "span",
5317
+ {
5318
+ style: {
5319
+ fontSize: 9,
5320
+ fontWeight: 700,
5321
+ textTransform: "uppercase",
5322
+ letterSpacing: "0.04em",
5323
+ padding: "2px 7px",
5324
+ borderRadius: 99,
5325
+ display: "inline-flex",
5326
+ alignItems: "center",
5327
+ gap: 4,
5328
+ background: clickable ? "rgba(22,163,74,0.12)" : "rgba(0,0,0,0.05)",
5329
+ color: clickable ? "#16a34a" : "#9ca3af"
5330
+ },
5331
+ children: [
5332
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { width: 5, height: 5, borderRadius: "50%", background: "currentColor" } }),
5333
+ clickable ? "Clickable link" : "No live link"
5334
+ ]
5335
+ }
5336
+ );
5337
+ }
4957
5338
  var cardStyle4 = {
4958
5339
  borderRadius: 14,
4959
5340
  background: "rgba(255,255,255,0.55)",
@@ -4963,7 +5344,7 @@ var cardStyle4 = {
4963
5344
  padding: "14px"
4964
5345
  };
4965
5346
  function AiPill2() {
4966
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5347
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4967
5348
  "span",
4968
5349
  {
4969
5350
  style: {
@@ -4987,10 +5368,10 @@ function SectionHeader3({
4987
5368
  ai,
4988
5369
  action
4989
5370
  }) {
4990
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 8 }, children: [
4991
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
4992
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
4993
- ai && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AiPill2, {}),
5371
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 8 }, children: [
5372
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
5373
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
5374
+ ai && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AiPill2, {}),
4994
5375
  action
4995
5376
  ] });
4996
5377
  }
@@ -5011,7 +5392,7 @@ function freshnessChip(label, score) {
5011
5392
  };
5012
5393
  const c = map[label];
5013
5394
  if (!c) return null;
5014
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5395
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5015
5396
  "span",
5016
5397
  {
5017
5398
  style: {
@@ -5031,8 +5412,8 @@ function freshnessChip(label, score) {
5031
5412
  );
5032
5413
  }
5033
5414
  function RefreshIcon({ spinning }) {
5034
- if (spinning) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LoadingBars, { size: "xs", color: "#9ca3af" });
5035
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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" }) });
5415
+ if (spinning) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LoadingBars, { size: "xs", color: "#9ca3af" });
5416
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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" }) });
5036
5417
  }
5037
5418
  function LinkingTab({
5038
5419
  analysis,
@@ -5048,21 +5429,21 @@ function LinkingTab({
5048
5429
  documentType
5049
5430
  }) {
5050
5431
  if (!analysis) {
5051
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
5052
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Waiting for keyword analysis" }),
5053
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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." })
5432
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
5433
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Waiting for keyword analysis" }),
5434
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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." })
5054
5435
  ] });
5055
5436
  }
5056
5437
  const wordCount2 = text ? text.split(/\s+/).filter(Boolean).length : 0;
5057
5438
  const recommendedMin = Math.max(1, Math.round(wordCount2 / 1e3 * 2));
5058
5439
  const recommendedMax = Math.max(2, Math.round(wordCount2 / 1e3 * 5));
5059
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { id: "anchor-linking-suggestions", style: cardStyle4, children: [
5060
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5440
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { id: "anchor-linking-suggestions", style: cardStyle4, children: [
5441
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5061
5442
  SectionHeader3,
5062
5443
  {
5063
5444
  label: "Suggested Links",
5064
5445
  iconColor: MJH_BLUE,
5065
- action: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5446
+ action: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5066
5447
  "button",
5067
5448
  {
5068
5449
  onClick: onRefresh,
@@ -5077,20 +5458,20 @@ function LinkingTab({
5077
5458
  fontSize: 10
5078
5459
  },
5079
5460
  title: "Refresh",
5080
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RefreshIcon, { spinning: isLoading })
5461
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RefreshIcon, { spinning: isLoading })
5081
5462
  }
5082
5463
  )
5083
5464
  }
5084
5465
  ),
5085
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 8, lineHeight: 1.55 }, children: [
5466
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 8, lineHeight: 1.55 }, children: [
5086
5467
  "Other articles on this site that fit this topic.",
5087
- wordCount2 > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
5468
+ wordCount2 > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
5088
5469
  " ",
5089
5470
  "For a ",
5090
5471
  wordCount2.toLocaleString(),
5091
5472
  "-word article, aim for",
5092
5473
  " ",
5093
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("strong", { children: [
5474
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("strong", { children: [
5094
5475
  recommendedMin,
5095
5476
  "-",
5096
5477
  recommendedMax,
@@ -5099,17 +5480,17 @@ function LinkingTab({
5099
5480
  "."
5100
5481
  ] })
5101
5482
  ] }),
5102
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 6, lineHeight: 1.5 }, children: [
5483
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 6, lineHeight: 1.5 }, children: [
5103
5484
  "Each suggestion gets a 0-100% match score from three signals - ",
5104
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "topic match" }),
5485
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { children: "topic match" }),
5105
5486
  ", ",
5106
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "freshness" }),
5487
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { children: "freshness" }),
5107
5488
  ", and ",
5108
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "section fit" }),
5489
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { children: "section fit" }),
5109
5490
  " (where in your article the link belongs). The percentage on each card is the weighted total:"
5110
5491
  ] }),
5111
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { marginBottom: 10 }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ScoreDonutLegend, {}) }),
5112
- isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
5492
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { marginBottom: 10 }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ScoreDonutLegend, {}) }),
5493
+ isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5113
5494
  "div",
5114
5495
  {
5115
5496
  role: "button",
@@ -5134,16 +5515,16 @@ function LinkingTab({
5134
5515
  cursor: "pointer"
5135
5516
  },
5136
5517
  children: [
5137
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 11, color: "#92400e" }, children: "Your article changed since these were generated." }),
5138
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 11, fontWeight: 700, color: "#8B7310", textDecoration: "underline", flexShrink: 0 }, children: "Refresh" })
5518
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: 11, color: "#92400e" }, children: "Your article changed since these were generated." }),
5519
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: 11, fontWeight: 700, color: "#8B7310", textDecoration: "underline", flexShrink: 0 }, children: "Refresh" })
5139
5520
  ]
5140
5521
  }
5141
5522
  ),
5142
- isLoading && suggestions.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
5143
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LoadingBars, { size: "xs", color: MJH_BLUE }),
5144
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Ranking candidates..." })
5523
+ isLoading && suggestions.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
5524
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LoadingBars, { size: "xs", color: MJH_BLUE }),
5525
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Ranking candidates..." })
5145
5526
  ] }),
5146
- !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
5527
+ !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5147
5528
  "div",
5148
5529
  {
5149
5530
  style: {
@@ -5154,9 +5535,9 @@ function LinkingTab({
5154
5535
  textAlign: "center"
5155
5536
  },
5156
5537
  children: [
5157
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 11.5, color: "#b91c1c", fontWeight: 600, marginBottom: 2 }, children: "Couldn't load suggestions" }),
5158
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 10.5, color: "#4b5563", marginBottom: 8 }, children: error }),
5159
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5538
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 11.5, color: "#b91c1c", fontWeight: 600, marginBottom: 2 }, children: "Couldn't load suggestions" }),
5539
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 10.5, color: "#4b5563", marginBottom: 8 }, children: error }),
5540
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5160
5541
  "button",
5161
5542
  {
5162
5543
  onClick: onRefresh,
@@ -5176,104 +5557,162 @@ function LinkingTab({
5176
5557
  ]
5177
5558
  }
5178
5559
  ),
5179
- !isLoading && !error && suggestions.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("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: [
5180
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontWeight: 700, marginBottom: 4, color: "#1f2937" }, children: "No closely related articles found." }),
5181
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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." })
5560
+ !isLoading && !error && suggestions.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("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: [
5561
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontWeight: 700, marginBottom: 4, color: "#1f2937" }, children: "No closely related articles found." }),
5562
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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." })
5182
5563
  ] }),
5183
- suggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: suggestions.map((s) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
5184
- "div",
5185
- {
5186
- style: {
5187
- padding: "10px 12px",
5188
- background: "rgba(0,93,172,0.03)",
5189
- borderRadius: 10,
5190
- borderLeft: `2px solid ${MJH_BLUE}`,
5191
- display: "flex",
5192
- gap: 12,
5193
- alignItems: "flex-start"
5194
- },
5195
- children: [
5196
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5197
- ScoreDonut,
5198
- {
5199
- size: 64,
5200
- topic: Math.max(0, Math.min(100, s.topicScore)),
5201
- freshness: Math.max(0, Math.min(100, s.freshnessScore)),
5202
- sectionFit: Math.max(0, Math.min(100, s.sectionFitScore)),
5203
- composite: Math.max(0, Math.min(100, s.compositeScore))
5204
- }
5205
- ),
5206
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
5207
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3, flexWrap: "wrap" }, children: [
5208
- freshnessChip(s.freshnessLabel, s.freshnessScore),
5209
- s.publishedAt && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 10, color: "#4b5563" }, children: formatDate(s.publishedAt) })
5210
- ] }),
5211
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", lineHeight: 1.4, marginBottom: 2 }, children: s.title }),
5212
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", marginBottom: 6 }, children: [
5213
- "/",
5214
- s.slug
5215
- ] }),
5216
- (() => {
5217
- const liveUrl = buildLiveUrl(publication, s.slug);
5218
- const sanityUrl = buildSanityUrl(sanityBaseUrl, s._id);
5219
- if (!liveUrl && !sanityUrl) return null;
5220
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginBottom: 6 }, children: [
5221
- sanityUrl && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LinkChip, { href: sanityUrl, label: "Inside Sanity", color: MJH_BLUE }),
5222
- liveUrl && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LinkChip, { href: liveUrl, label: "Live site", color: "#4b5563" })
5223
- ] });
5224
- })(),
5225
- s.relevanceReason && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 6, lineHeight: 1.45 }, children: [
5226
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontWeight: 700, color: "#4b5563" }, children: "Why it fits:" }),
5227
- " ",
5228
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontStyle: "italic" }, children: s.relevanceReason })
5564
+ suggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: suggestions.map((s) => {
5565
+ const liveUrl = buildLiveUrl(publication, s.slug);
5566
+ const sanityUrl = buildSanityUrl(sanityBaseUrl, s._id);
5567
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5568
+ "div",
5569
+ {
5570
+ style: {
5571
+ padding: "10px 12px",
5572
+ background: "rgba(0,93,172,0.03)",
5573
+ borderRadius: 10,
5574
+ borderLeft: `2px solid ${MJH_BLUE}`,
5575
+ display: "flex",
5576
+ gap: 12,
5577
+ alignItems: "flex-start"
5578
+ },
5579
+ children: [
5580
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5581
+ ScoreDonut,
5582
+ {
5583
+ size: 64,
5584
+ topic: Math.max(0, Math.min(100, s.topicScore)),
5585
+ freshness: Math.max(0, Math.min(100, s.freshnessScore)),
5586
+ sectionFit: Math.max(0, Math.min(100, s.sectionFitScore)),
5587
+ composite: Math.max(0, Math.min(100, s.compositeScore))
5588
+ }
5589
+ ),
5590
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
5591
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3, flexWrap: "wrap" }, children: [
5592
+ freshnessChip(s.freshnessLabel, s.freshnessScore),
5593
+ s.publishedAt && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: 10, color: "#4b5563" }, children: formatDate(s.publishedAt) }),
5594
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ClickableBadge, { clickable: !!liveUrl })
5595
+ ] }),
5596
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", lineHeight: 1.4, marginBottom: 2 }, children: s.title }),
5597
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", marginBottom: 6 }, children: [
5598
+ "/",
5599
+ s.slug
5600
+ ] }),
5601
+ (liveUrl || sanityUrl) && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginBottom: 6 }, children: [
5602
+ sanityUrl && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LinkChip, { href: sanityUrl, label: "Inside Sanity", color: MJH_BLUE }),
5603
+ liveUrl && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LinkChip, { href: liveUrl, label: "Live site", color: "#4b5563" })
5604
+ ] }),
5605
+ s.relevanceReason && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 6, lineHeight: 1.45 }, children: [
5606
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontWeight: 700, color: "#4b5563" }, children: "Why it fits:" }),
5607
+ " ",
5608
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontStyle: "italic" }, children: s.relevanceReason })
5609
+ ] }),
5610
+ s.anchorQuote && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5611
+ "div",
5612
+ {
5613
+ style: {
5614
+ marginTop: 4,
5615
+ padding: "6px 9px",
5616
+ background: "rgba(0,0,0,0.025)",
5617
+ borderRadius: 6,
5618
+ borderLeft: "2px solid #cbd5e1",
5619
+ fontSize: 11,
5620
+ color: "#1f2937",
5621
+ lineHeight: 1.5
5622
+ },
5623
+ children: [
5624
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 3 }, children: [
5625
+ "Where to link from - paragraph ",
5626
+ s.anchorParagraph
5627
+ ] }),
5628
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { fontStyle: "italic" }, children: [
5629
+ '"',
5630
+ s.anchorQuote,
5631
+ '"'
5632
+ ] }),
5633
+ s.anchorReason && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 3, lineHeight: 1.45 }, children: s.anchorReason })
5634
+ ]
5635
+ }
5636
+ )
5229
5637
  ] }),
5230
- s.anchorQuote && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
5231
- "div",
5638
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5639
+ FeedbackButton,
5232
5640
  {
5233
- style: {
5234
- marginTop: 4,
5235
- padding: "6px 9px",
5236
- background: "rgba(0,0,0,0.025)",
5237
- borderRadius: 6,
5238
- borderLeft: "2px solid #cbd5e1",
5239
- fontSize: 11,
5240
- color: "#1f2937",
5241
- lineHeight: 1.5
5242
- },
5243
- children: [
5244
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 3 }, children: [
5245
- "Where to link from - paragraph ",
5246
- s.anchorParagraph
5247
- ] }),
5248
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontStyle: "italic" }, children: [
5249
- '"',
5250
- s.anchorQuote,
5251
- '"'
5252
- ] }),
5253
- s.anchorReason && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 3, lineHeight: 1.45 }, children: s.anchorReason })
5254
- ]
5641
+ suggestionType: "internal_link",
5642
+ suggestionText: s.title,
5643
+ publication,
5644
+ documentId
5255
5645
  }
5256
- )
5257
- ] }),
5258
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5259
- FeedbackButton,
5260
- {
5261
- suggestionType: "internal_link",
5262
- suggestionText: s.title,
5263
- publication,
5264
- documentId
5265
- }
5266
- ) })
5267
- ]
5268
- },
5269
- s._id
5270
- )) })
5646
+ ) })
5647
+ ]
5648
+ },
5649
+ s._id
5650
+ );
5651
+ }) })
5271
5652
  ] }) });
5272
5653
  }
5273
5654
 
5274
5655
  // src/components/tabs/MetaTab.tsx
5275
- var import_react16 = require("react");
5276
- var import_jsx_runtime14 = require("react/jsx-runtime");
5656
+ var import_react17 = require("react");
5657
+ var import_jsx_runtime15 = require("react/jsx-runtime");
5658
+ var GOOGLE_EEAT_URL = "https://developers.google.com/search/docs/fundamentals/creating-helpful-content#eat";
5659
+ function ExternalLinkChip({ href, label }) {
5660
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5661
+ "a",
5662
+ {
5663
+ href,
5664
+ target: "_blank",
5665
+ rel: "noopener noreferrer",
5666
+ style: {
5667
+ display: "inline-flex",
5668
+ alignItems: "center",
5669
+ gap: 4,
5670
+ marginTop: 8,
5671
+ padding: "3px 9px",
5672
+ borderRadius: 99,
5673
+ fontSize: 10.5,
5674
+ fontWeight: 700,
5675
+ color: MJH_BLUE,
5676
+ background: "rgba(255,255,255,0.7)",
5677
+ border: `1px solid ${MJH_BLUE}33`,
5678
+ textDecoration: "none",
5679
+ lineHeight: 1.2
5680
+ },
5681
+ children: [
5682
+ label,
5683
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("svg", { width: "9", height: "9", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
5684
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" }),
5685
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" })
5686
+ ] })
5687
+ ]
5688
+ }
5689
+ );
5690
+ }
5691
+ function FreshnessNotice() {
5692
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5693
+ "div",
5694
+ {
5695
+ style: {
5696
+ padding: "9px 12px",
5697
+ background: "rgba(0,93,172,0.05)",
5698
+ border: "1px solid rgba(0,93,172,0.15)",
5699
+ borderLeft: `3px solid ${MJH_BLUE}`,
5700
+ borderRadius: 8,
5701
+ fontSize: 11,
5702
+ color: "#1f2937",
5703
+ lineHeight: 1.5
5704
+ },
5705
+ children: [
5706
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontWeight: 700, color: MJH_BLUE }, children: "Keep it fresh. " }),
5707
+ "Planning to update this article after it's published? Set the ",
5708
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: "Updated on" }),
5709
+ " date in Sanity (e.g. \u201CUpdated: February 19, 2026\u201D). It surfaces the article in ",
5710
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: "Latest Updated Articles" }),
5711
+ " and increases its visibility in search engine results."
5712
+ ]
5713
+ }
5714
+ );
5715
+ }
5277
5716
  var cardStyle5 = {
5278
5717
  borderRadius: 14,
5279
5718
  background: "rgba(255,255,255,0.55)",
@@ -5289,7 +5728,7 @@ function StatusBadge({ status }) {
5289
5728
  error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
5290
5729
  };
5291
5730
  const c = map[status];
5292
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5731
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5293
5732
  "span",
5294
5733
  {
5295
5734
  style: {
@@ -5308,12 +5747,12 @@ function StatusBadge({ status }) {
5308
5747
  );
5309
5748
  }
5310
5749
  function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
5311
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { id: anchorId, style: cardStyle5, children: [
5312
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5313
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
5314
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StatusBadge, { status })
5750
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { id: anchorId, style: cardStyle5, children: [
5751
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5752
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
5753
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatusBadge, { status })
5315
5754
  ] }),
5316
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5755
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5317
5756
  "div",
5318
5757
  {
5319
5758
  style: {
@@ -5326,7 +5765,7 @@ function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
5326
5765
  children: value
5327
5766
  }
5328
5767
  ),
5329
- recommendation && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5768
+ recommendation && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5330
5769
  "div",
5331
5770
  {
5332
5771
  style: {
@@ -5452,13 +5891,13 @@ function formatDateShort(iso) {
5452
5891
  return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
5453
5892
  }
5454
5893
  function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }) {
5455
- const audits = (0, import_react16.useMemo)(() => {
5894
+ const audits = (0, import_react17.useMemo)(() => {
5456
5895
  const list = [];
5457
5896
  list.push(titleAudit(documentFields?.title, primaryKeyword));
5458
5897
  list.push(metaDescriptionAudit(documentFields?.metaDescription, primaryKeyword, secondaryKeyword));
5459
5898
  return list;
5460
5899
  }, [documentFields, primaryKeyword, secondaryKeyword]);
5461
- const eeatItems = (0, import_react16.useMemo)(() => {
5900
+ const eeatItems = (0, import_react17.useMemo)(() => {
5462
5901
  const items = [];
5463
5902
  const author = documentFields?.authorName;
5464
5903
  const creds = documentFields?.authorCredentials;
@@ -5475,41 +5914,66 @@ function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }
5475
5914
  } else {
5476
5915
  items.push({ label: "Author Byline", value: `${author}, ${creds}`, status: "good" });
5477
5916
  }
5478
- const published = documentFields?.publishedAt;
5479
- const updated = documentFields?.updatedAt;
5480
- const reviewed = documentFields?.lastReviewedAt;
5481
- const daysPub = daysSince(published);
5482
- const daysUpd = daysSince(updated);
5483
- const daysRev = daysSince(reviewed);
5484
- const freshness = Math.min(...[daysUpd, daysRev, daysPub].filter((d) => d !== null));
5485
- if (!published) {
5486
- 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." });
5487
- } else if (daysPub === null) {
5488
- 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." });
5917
+ items[0].footer = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ExternalLinkChip, { href: GOOGLE_EEAT_URL, label: "Google's E-E-A-T guidelines" });
5918
+ const factChecker = documentFields?.factCheckerName;
5919
+ const factCheckerRef = documentFields?.factCheckerIsReference;
5920
+ if (factChecker) {
5921
+ items.push({ label: "Fact-Checker", value: factChecker, status: "good" });
5922
+ } else if (factCheckerRef) {
5923
+ 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." });
5489
5924
  } else {
5490
- items.push({ label: "Publish Date", value: formatDateShort(published), status: "good" });
5925
+ 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.' });
5491
5926
  }
5492
- if (Number.isFinite(freshness)) {
5493
- if (freshness <= 14) {
5494
- items.push({ label: "Last Updated", value: `${freshness} day${freshness === 1 ? "" : "s"} ago`, status: "good" });
5495
- } else if (freshness <= 90) {
5496
- 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." });
5927
+ const dated = [];
5928
+ const addDate = (verb, days) => {
5929
+ if (days !== null) dated.push({ verb, days });
5930
+ };
5931
+ addDate("Updated", daysSince(documentFields?.updatedAt));
5932
+ addDate("Reviewed", daysSince(documentFields?.lastReviewedAt));
5933
+ addDate("Published", daysSince(documentFields?.publishedAt));
5934
+ if (dated.length > 0) {
5935
+ const freshest = dated.reduce((a, b) => b.days < a.days ? b : a);
5936
+ const days = freshest.days;
5937
+ const ago = days <= 0 ? "today" : days === 1 ? "1 day ago" : `${days} days ago`;
5938
+ const value = `${freshest.verb} ${ago}`;
5939
+ if (days <= 14) {
5940
+ 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." });
5941
+ } else if (days <= 90) {
5942
+ 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." });
5497
5943
  } else {
5498
- 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." });
5944
+ 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." });
5499
5945
  }
5500
5946
  }
5501
5947
  return items;
5502
5948
  }, [documentFields]);
5949
+ const publishDateItem = (0, import_react17.useMemo)(() => {
5950
+ const published = documentFields?.publishedAt;
5951
+ const daysPub = daysSince(published);
5952
+ 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." };
5953
+ 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." };
5954
+ return { label: "Publish Date", value: formatDateShort(published), status: "good" };
5955
+ }, [documentFields]);
5503
5956
  const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.metaDescription !== void 0 || documentFields.slug !== void 0);
5504
5957
  if (isLoading && !hasAnyField) {
5505
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
5506
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
5507
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
5958
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
5959
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
5960
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
5508
5961
  ] });
5509
5962
  }
5510
5963
  const auditAnchors = ["anchor-meta-title", "anchor-meta-description"];
5511
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
5512
- audits.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5964
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
5965
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FreshnessNotice, {}),
5966
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5967
+ AuditCard,
5968
+ {
5969
+ anchorId: "anchor-publish-date",
5970
+ label: publishDateItem.label,
5971
+ value: publishDateItem.value,
5972
+ status: publishDateItem.status,
5973
+ recommendation: publishDateItem.recommendation
5974
+ }
5975
+ ),
5976
+ audits.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5513
5977
  AuditCard,
5514
5978
  {
5515
5979
  anchorId: auditAnchors[i],
@@ -5520,20 +5984,21 @@ function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }
5520
5984
  },
5521
5985
  i
5522
5986
  )),
5523
- eeatItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
5524
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 8, margin: "6px 4px 0" }, children: [
5525
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } }),
5526
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Author & Freshness" }),
5527
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } })
5987
+ eeatItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
5988
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 8, margin: "6px 4px 0" }, children: [
5989
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } }),
5990
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Author & Freshness" }),
5991
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } })
5528
5992
  ] }),
5529
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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." }),
5530
- eeatItems.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5993
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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." }),
5994
+ eeatItems.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5531
5995
  AuditCard,
5532
5996
  {
5533
5997
  label: item.label,
5534
5998
  value: item.value,
5535
5999
  status: item.status,
5536
- recommendation: item.recommendation
6000
+ recommendation: item.recommendation,
6001
+ footer: item.footer
5537
6002
  },
5538
6003
  `eeat-${i}`
5539
6004
  ))
@@ -5542,8 +6007,8 @@ function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }
5542
6007
  }
5543
6008
 
5544
6009
  // src/components/tabs/TechnicalTab.tsx
5545
- var import_react17 = require("react");
5546
- var import_jsx_runtime15 = require("react/jsx-runtime");
6010
+ var import_react18 = require("react");
6011
+ var import_jsx_runtime16 = require("react/jsx-runtime");
5547
6012
  function urlAudit(slug, primaryKeyword, secondaryKeyword) {
5548
6013
  const SHORT_DESC = "Keep the URL short and descriptive - concise URLs are easier to read - and avoid trailing, duplicate, or excessive spaces.";
5549
6014
  if (!slug) {
@@ -5578,28 +6043,28 @@ function urlAudit(slug, primaryKeyword, secondaryKeyword) {
5578
6043
  return { label: "URL Slug", value: `/${slug}`, status: "good" };
5579
6044
  }
5580
6045
  function SlugRedirectNotice() {
5581
- const [expanded, setExpanded] = (0, import_react17.useState)(false);
5582
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { marginTop: 10, paddingTop: 10, borderTop: "1px solid rgba(0,0,0,0.07)" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: "8px 10px", background: "rgba(245,158,11,0.08)", borderLeft: "2px solid #f59e0b", borderRadius: 6 }, children: [
5583
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
5584
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "#f59e0b", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" }) }),
5585
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: 10.5, fontWeight: 700, color: "#b45309", textTransform: "uppercase", letterSpacing: "0.06em" }, children: "Changing a URL?" })
6046
+ const [expanded, setExpanded] = (0, import_react18.useState)(false);
6047
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { marginTop: 10, paddingTop: 10, borderTop: "1px solid rgba(0,0,0,0.07)" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { padding: "8px 10px", background: "rgba(245,158,11,0.08)", borderLeft: "2px solid #f59e0b", borderRadius: 6 }, children: [
6048
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
6049
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "#f59e0b", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }) }),
6050
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { fontSize: 10.5, fontWeight: 700, color: "#b45309", textTransform: "uppercase", letterSpacing: "0.06em" }, children: "Changing a URL?" })
5586
6051
  ] }),
5587
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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." }),
5588
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
6052
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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." }),
6053
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
5589
6054
  "button",
5590
6055
  {
5591
6056
  onClick: () => setExpanded((v) => !v),
5592
6057
  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" },
5593
6058
  children: [
5594
6059
  expanded ? "Show less" : "Learn more",
5595
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: expanded ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" }) })
6060
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: expanded ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }) })
5596
6061
  ]
5597
6062
  }
5598
6063
  ),
5599
- expanded && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("ul", { style: { margin: "6px 0 0", paddingLeft: 16, fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: [
5600
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: "Without the 301, the page loses every search ranking and every external link to it breaks." }),
5601
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: "A 301 preserves the rankings and link equity built up on the old URL." }),
5602
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: "Set this up using vanity redirects in Sanity." })
6064
+ expanded && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("ul", { style: { margin: "6px 0 0", paddingLeft: 16, fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: [
6065
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { children: "Without the 301, the page loses every search ranking and every external link to it breaks." }),
6066
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { children: "A 301 preserves the rankings and link equity built up on the old URL." }),
6067
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { children: "Set this up using vanity redirects in Sanity." })
5603
6068
  ] })
5604
6069
  ] }) });
5605
6070
  }
@@ -5618,7 +6083,7 @@ function StatusBadge2({ status }) {
5618
6083
  error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
5619
6084
  };
5620
6085
  const c = map[status];
5621
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6086
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5622
6087
  "span",
5623
6088
  {
5624
6089
  style: {
@@ -5644,12 +6109,12 @@ function AuditCard2({
5644
6109
  anchorId,
5645
6110
  footer
5646
6111
  }) {
5647
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { id: anchorId, style: cardStyle6, children: [
5648
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5649
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
5650
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatusBadge2, { status })
6112
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { id: anchorId, style: cardStyle6, children: [
6113
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
6114
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
6115
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(StatusBadge2, { status })
5651
6116
  ] }),
5652
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6117
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5653
6118
  "div",
5654
6119
  {
5655
6120
  style: {
@@ -5662,7 +6127,7 @@ function AuditCard2({
5662
6127
  children: value
5663
6128
  }
5664
6129
  ),
5665
- recommendation && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6130
+ recommendation && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5666
6131
  "div",
5667
6132
  {
5668
6133
  style: {
@@ -5794,7 +6259,7 @@ function imageTitleAudit(titles, imageCount) {
5794
6259
  status: "good"
5795
6260
  };
5796
6261
  }
5797
- function computeHeadingStructureAudits(headings, wordCount2) {
6262
+ function computeHeadingStructureAudits(headings, wordCount2, primaryKeyword, secondaryKeyword, unstyledHeadings) {
5798
6263
  const audits = [];
5799
6264
  const sectionCount = headings.filter((h) => h.level === 2 || h.level === 3).length;
5800
6265
  let densityFired = false;
@@ -5823,26 +6288,27 @@ function computeHeadingStructureAudits(headings, wordCount2) {
5823
6288
  });
5824
6289
  densityFired = true;
5825
6290
  }
6291
+ if (unstyledHeadings && unstyledHeadings.length > 0) {
6292
+ const n = unstyledHeadings.length;
6293
+ const examples = unstyledHeadings.slice(0, 2).map((t) => `"${t}"`).join(", ");
6294
+ audits.push({
6295
+ label: "Looks Like a Heading",
6296
+ value: `${n} line${n === 1 ? "" : "s"} read${n === 1 ? "s" : ""} like a heading but ${n === 1 ? "isn't" : "aren't"} styled`,
6297
+ status: "warning",
6298
+ 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.`
6299
+ });
6300
+ }
5826
6301
  if (headings.length === 0) {
5827
6302
  if (!densityFired) {
5828
6303
  audits.push({
5829
6304
  label: "Heading Structure",
5830
6305
  value: "No headings in body",
5831
6306
  status: "warning",
5832
- recommendation: "Add H2 headings to break the article into scannable sections."
6307
+ recommendation: "Consider adding H2-H6 subheadings to structure the article into scannable sections."
5833
6308
  });
5834
6309
  }
5835
6310
  return audits;
5836
6311
  }
5837
- const h1s = headings.filter((h) => h.level === 1);
5838
- if (h1s.length > 0) {
5839
- audits.push({
5840
- label: "H1 in body",
5841
- value: `${h1s.length} H1 heading${h1s.length === 1 ? "" : "s"} in the body`,
5842
- status: "warning",
5843
- recommendation: "The article title is your H1. Body headings should start at H2 so the outline isn't ambiguous."
5844
- });
5845
- }
5846
6312
  let prevLevel = 0;
5847
6313
  const skips = [];
5848
6314
  for (const h of headings) {
@@ -5876,266 +6342,171 @@ function computeHeadingStructureAudits(headings, wordCount2) {
5876
6342
  status: "good"
5877
6343
  });
5878
6344
  }
6345
+ const subheads = headings.filter((h) => h.level >= 2);
6346
+ const subheadingText = subheads.map((h) => h.text).join(" ");
6347
+ const hasPrimaryInHeads = primaryKeyword ? containsKeywordTokens(subheadingText, primaryKeyword) : false;
6348
+ const hasSecondaryInHeads = secondaryKeyword ? containsKeywordTokens(subheadingText, secondaryKeyword) : false;
6349
+ if (subheads.length > 0 && (primaryKeyword || secondaryKeyword) && !hasPrimaryInHeads && !hasSecondaryInHeads) {
6350
+ const kw = [
6351
+ primaryKeyword ? `primary keyword "${primaryKeyword}"` : "",
6352
+ secondaryKeyword ? `secondary keyword "${secondaryKeyword}"` : ""
6353
+ ].filter(Boolean).join(" or ");
6354
+ audits.push({
6355
+ label: "Keywords in Headings",
6356
+ value: "No subheading uses your target keyword",
6357
+ status: "warning",
6358
+ recommendation: `Work your ${kw} into at least one H2 or H3. Keywords in headers reinforce relevance for readers and search engines.`
6359
+ });
6360
+ }
5879
6361
  return audits;
5880
6362
  }
6363
+ function HealthBadge({ result }) {
6364
+ const map = {
6365
+ ok: { color: "#16a34a", label: "OK" },
6366
+ redirect: { color: "#8B7310", label: result.status > 0 ? String(result.status) : "REDIR" },
6367
+ broken: { color: "#dc2626", label: result.status > 0 ? String(result.status) : "404" },
6368
+ unverified: { color: "#b45309", label: result.status > 0 ? String(result.status) : "BLOCKED" },
6369
+ error: { color: "#dc2626", label: "ERR" }
6370
+ };
6371
+ const c = map[result.category];
6372
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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 });
6373
+ }
5881
6374
  function LinkCheckCard({
5882
6375
  urls,
6376
+ linksDetailed,
5883
6377
  results,
5884
6378
  isLoading,
5885
6379
  error,
5886
6380
  hasRun,
5887
6381
  onCheck
5888
6382
  }) {
5889
- const counts = (0, import_react17.useMemo)(() => {
5890
- const total = results.length;
5891
- const valid = results.filter((r) => r.category === "ok").length;
5892
- const redirects = results.filter((r) => r.category === "redirect").length;
5893
- const broken = results.filter((r) => r.category === "broken").length;
5894
- const errored = results.filter((r) => r.category === "error").length;
5895
- const unverified = results.filter((r) => r.category === "unverified").length;
5896
- const issues = results.filter((r) => r.category !== "ok");
5897
- return { total, valid, redirects, broken, errored, unverified, issues };
5898
- }, [results]);
5899
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { id: "anchor-link-check", style: cardStyle6, children: [
5900
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5901
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: "Link Health" }),
5902
- hasRun && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5903
- "button",
5904
- {
5905
- onClick: onCheck,
5906
- style: {
5907
- background: "none",
5908
- border: "none",
5909
- fontSize: 10,
5910
- fontWeight: 600,
5911
- color: MJH_BLUE,
5912
- cursor: "pointer",
5913
- padding: "2px 4px"
5914
- },
5915
- title: "Run again",
5916
- children: "Re-check"
5917
- }
5918
- )
5919
- ] }),
5920
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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.` }),
5921
- urls.length > 0 && !hasRun && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5922
- "button",
6383
+ const [openBucket, setOpenBucket] = (0, import_react18.useState)(null);
6384
+ const haveTypes = !!linksDetailed;
6385
+ const detailByUrl = (0, import_react18.useMemo)(
6386
+ () => new Map((linksDetailed || []).map((d) => [d.url, d])),
6387
+ [linksDetailed]
6388
+ );
6389
+ const resultByUrl = (0, import_react18.useMemo)(() => new Map(results.map((r) => [r.url, r])), [results]);
6390
+ const blockedUrls = results.filter((r) => r.category === "unverified").map((r) => r.url);
6391
+ const tiles = (0, import_react18.useMemo)(() => {
6392
+ const hyper = (linksDetailed || []).filter((l) => l.hyperlinked).map((l) => l.url);
6393
+ const plain = (linksDetailed || []).filter((l) => !l.hyperlinked).map((l) => l.url);
6394
+ const working = results.filter((r) => r.category === "ok" || r.category === "redirect").map((r) => r.url);
6395
+ const broken = results.filter((r) => r.category === "broken" || r.category === "error").map((r) => r.url);
6396
+ const t = [];
6397
+ if (hasRun) t.push({ key: "working", label: "Working", color: "#16a34a", urls: working });
6398
+ if (haveTypes) t.push({ key: "linked", label: "Linked", color: "#16a34a", urls: hyper });
6399
+ if (hasRun) t.push({ key: "broken", label: "Broken", color: "#dc2626", urls: broken });
6400
+ 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." });
6401
+ return t;
6402
+ }, [haveTypes, linksDetailed, hasRun, results]);
6403
+ const open = tiles.find((t) => t.key === openBucket) || null;
6404
+ const renderLinkRow = (url) => {
6405
+ const d = detailByUrl.get(url);
6406
+ const r = resultByUrl.get(url);
6407
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
6408
+ "a",
5923
6409
  {
5924
- onClick: onCheck,
5925
- style: {
5926
- width: "100%",
5927
- padding: "8px 12px",
5928
- fontSize: 11,
5929
- fontWeight: 700,
5930
- color: "#1f2937",
5931
- background: MJH_GOLD,
5932
- border: "none",
5933
- borderRadius: 6,
5934
- cursor: "pointer",
5935
- letterSpacing: "0.01em"
5936
- },
6410
+ href: url,
6411
+ target: "_blank",
6412
+ rel: "noopener noreferrer",
6413
+ style: { display: "flex", gap: 8, alignItems: "flex-start", padding: "6px 8px", background: "rgba(0,0,0,0.025)", borderRadius: 6, textDecoration: "none", marginTop: 4 },
5937
6414
  children: [
5938
- "Check ",
5939
- urls.length,
5940
- " link",
5941
- urls.length === 1 ? "" : "s",
5942
- " for 404s"
6415
+ r && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(HealthBadge, { result: r }),
6416
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { minWidth: 0, flex: 1 }, children: [
6417
+ d?.anchorText && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", fontWeight: 600, lineHeight: 1.3, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
6418
+ "\u201C",
6419
+ d.anchorText,
6420
+ "\u201D"
6421
+ ] }),
6422
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", wordBreak: "break-all", lineHeight: 1.35 }, children: url })
6423
+ ] })
5943
6424
  ]
5944
- }
5945
- ),
5946
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
5947
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(LoadingBars, { size: "xs", color: MJH_BLUE }),
5948
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { style: { fontSize: 11, color: "#4b5563" }, children: [
5949
- "Checking ",
6425
+ },
6426
+ url
6427
+ );
6428
+ };
6429
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { id: "anchor-link-check", style: cardStyle6, children: [
6430
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
6431
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: "Link Health" }),
6432
+ hasRun && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" })
6433
+ ] }),
6434
+ urls.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: "No links found in the body." }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
6435
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5, marginBottom: 10 }, children: [
5950
6436
  urls.length,
5951
6437
  " link",
5952
6438
  urls.length === 1 ? "" : "s",
5953
- "..."
5954
- ] })
5955
- ] }),
5956
- error && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5957
- "div",
5958
- {
5959
- style: {
5960
- padding: "10px 12px",
5961
- background: "rgba(220,38,38,0.04)",
5962
- border: "1px solid rgba(220,38,38,0.18)",
5963
- borderRadius: 8,
5964
- fontSize: 11,
5965
- color: "#b91c1c",
5966
- lineHeight: 1.5
5967
- },
5968
- children: [
5969
- error,
5970
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5971
- "button",
5972
- {
5973
- onClick: onCheck,
5974
- style: {
5975
- display: "block",
5976
- marginTop: 6,
5977
- padding: "4px 10px",
5978
- fontSize: 11,
5979
- fontWeight: 700,
5980
- color: "#ffffff",
5981
- background: "#dc2626",
5982
- border: "none",
5983
- borderRadius: 5,
5984
- cursor: "pointer"
5985
- },
5986
- children: "Try again"
5987
- }
5988
- )
5989
- ]
5990
- }
5991
- ),
5992
- hasRun && !isLoading && !error && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
5993
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "grid", gridTemplateColumns: counts.unverified > 0 ? "repeat(5, 1fr)" : "repeat(4, 1fr)", gap: 6 }, children: [
5994
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatTile, { label: "Checked", value: counts.total, color: "#475569" }),
5995
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatTile, { label: "Valid", value: counts.valid, color: "#16a34a" }),
5996
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatTile, { label: "Redirects", value: counts.redirects, color: "#8B7310" }),
5997
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatTile, { label: "Broken", value: counts.broken + counts.errored, color: "#dc2626" }),
5998
- counts.unverified > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatTile, { label: "Blocked", value: counts.unverified, color: "#b45309" })
6439
+ " in the body.",
6440
+ tiles.length > 0 ? " Tap a box to see which." : ""
5999
6441
  ] }),
6000
- counts.unverified > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
6001
- "div",
6002
- {
6003
- style: {
6004
- marginTop: 8,
6005
- padding: "6px 10px",
6006
- background: "rgba(245,158,11,0.08)",
6007
- border: "1px solid rgba(245,158,11,0.25)",
6008
- borderRadius: 6,
6009
- fontSize: 10.5,
6010
- color: "#92400e",
6011
- lineHeight: 1.45
6442
+ tiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: 6 }, children: tiles.map((t) => {
6443
+ const empty = t.urls.length === 0;
6444
+ const active = openBucket === t.key && !empty;
6445
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
6446
+ "button",
6447
+ {
6448
+ type: "button",
6449
+ onClick: () => !empty && setOpenBucket(active ? null : t.key),
6450
+ "aria-expanded": active,
6451
+ "aria-label": `${t.urls.length} ${t.label} links`,
6452
+ style: {
6453
+ padding: "8px 4px",
6454
+ background: active ? "rgba(0,93,172,0.08)" : "rgba(0,0,0,0.025)",
6455
+ border: active ? `1px solid ${MJH_BLUE}55` : "1px solid transparent",
6456
+ borderRadius: 8,
6457
+ textAlign: "center",
6458
+ cursor: empty ? "default" : "pointer",
6459
+ opacity: empty ? 0.5 : 1
6460
+ },
6461
+ children: [
6462
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontSize: 18, fontWeight: 700, color: t.color, fontVariantNumeric: "tabular-nums", lineHeight: 1 }, children: t.urls.length }),
6463
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginTop: 4 }, children: t.label })
6464
+ ]
6012
6465
  },
6466
+ t.key
6467
+ );
6468
+ }) }),
6469
+ open && open.urls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { marginTop: 8 }, children: [
6470
+ open.note && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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 }),
6471
+ open.urls.map(renderLinkRow)
6472
+ ] }),
6473
+ hasRun && blockedUrls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("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: [
6474
+ blockedUrls.length,
6475
+ " link",
6476
+ blockedUrls.length === 1 ? "" : "s",
6477
+ " couldn't be auto-checked (the destination blocks our checker) - open them to confirm."
6478
+ ] }),
6479
+ !hasRun && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
6480
+ "button",
6481
+ {
6482
+ onClick: onCheck,
6483
+ 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" },
6013
6484
  children: [
6014
- counts.unverified,
6485
+ "Check ",
6486
+ urls.length,
6015
6487
  " link",
6016
- counts.unverified === 1 ? "" : "s",
6017
- " 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."
6488
+ urls.length === 1 ? "" : "s",
6489
+ " for broken / redirects"
6018
6490
  ]
6019
6491
  }
6020
6492
  ),
6021
- counts.issues.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 6 }, children: [
6022
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em" }, children: [
6023
- counts.issues.length,
6493
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
6494
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LoadingBars, { size: "xs", color: MJH_BLUE }),
6495
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { style: { fontSize: 11, color: "#4b5563" }, children: [
6496
+ "Checking ",
6497
+ urls.length,
6024
6498
  " link",
6025
- counts.issues.length === 1 ? "" : "s",
6026
- " need",
6027
- counts.issues.length === 1 ? "s" : "",
6028
- " attention"
6029
- ] }),
6030
- counts.issues.map((r) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(LinkIssueRow, { result: r }, r.url))
6031
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
6032
- "div",
6033
- {
6034
- style: {
6035
- marginTop: 12,
6036
- padding: "8px 10px",
6037
- background: "rgba(22,163,74,0.05)",
6038
- border: "1px solid rgba(22,163,74,0.15)",
6039
- borderRadius: 8,
6040
- fontSize: 11,
6041
- color: "#16a34a",
6042
- fontWeight: 600,
6043
- textAlign: "center"
6044
- },
6045
- children: [
6046
- "All ",
6047
- counts.total,
6048
- " link",
6049
- counts.total === 1 ? "" : "s",
6050
- " resolve cleanly."
6051
- ]
6052
- }
6053
- )
6499
+ urls.length === 1 ? "" : "s",
6500
+ "..."
6501
+ ] })
6502
+ ] }),
6503
+ error && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("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: [
6504
+ error,
6505
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" })
6506
+ ] })
6054
6507
  ] })
6055
6508
  ] });
6056
6509
  }
6057
- function StatTile({ label, value, color }) {
6058
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
6059
- "div",
6060
- {
6061
- style: {
6062
- padding: "8px 4px",
6063
- background: "rgba(0,0,0,0.025)",
6064
- borderRadius: 8,
6065
- textAlign: "center"
6066
- },
6067
- children: [
6068
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 18, fontWeight: 700, color, fontVariantNumeric: "tabular-nums", lineHeight: 1 }, children: value }),
6069
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", marginTop: 4 }, children: label })
6070
- ]
6071
- }
6072
- );
6073
- }
6074
- function LinkIssueRow({ result }) {
6075
- const map = {
6076
- ok: { bg: "rgba(22,163,74,0.06)", color: "#16a34a", label: "OK" },
6077
- redirect: { bg: "rgba(230,192,27,0.12)", color: "#8B7310", label: result.status > 0 ? String(result.status) : "REDIR" },
6078
- broken: { bg: "rgba(220,38,38,0.06)", color: "#dc2626", label: result.status > 0 ? String(result.status) : "404" },
6079
- // Amber for unverified - the link may work fine, our server just couldn't confirm.
6080
- unverified: { bg: "rgba(245,158,11,0.10)", color: "#b45309", label: result.status > 0 ? String(result.status) : "BLOCKED" },
6081
- error: { bg: "rgba(220,38,38,0.06)", color: "#dc2626", label: "ERR" }
6082
- };
6083
- const c = map[result.category];
6084
- 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;
6085
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
6086
- "a",
6087
- {
6088
- href: result.url,
6089
- target: "_blank",
6090
- rel: "noopener noreferrer",
6091
- style: {
6092
- display: "flex",
6093
- alignItems: "center",
6094
- gap: 8,
6095
- padding: "6px 10px",
6096
- background: c.bg,
6097
- borderRadius: 6,
6098
- textDecoration: "none"
6099
- },
6100
- children: [
6101
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6102
- "span",
6103
- {
6104
- style: {
6105
- fontSize: 9,
6106
- fontWeight: 700,
6107
- letterSpacing: "0.04em",
6108
- padding: "2px 6px",
6109
- borderRadius: 99,
6110
- background: "#ffffff",
6111
- color: c.color,
6112
- fontVariantNumeric: "tabular-nums",
6113
- flexShrink: 0
6114
- },
6115
- children: c.label
6116
- }
6117
- ),
6118
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6119
- "span",
6120
- {
6121
- style: {
6122
- fontSize: 11,
6123
- color: "#1f2937",
6124
- fontFamily: "ui-monospace, SFMono-Regular, monospace",
6125
- flex: 1,
6126
- minWidth: 0,
6127
- overflow: "hidden",
6128
- textOverflow: "ellipsis",
6129
- whiteSpace: "nowrap"
6130
- },
6131
- title: tooltip,
6132
- children: result.url
6133
- }
6134
- )
6135
- ]
6136
- }
6137
- );
6138
- }
6139
6510
  function TechnicalTab({
6140
6511
  text,
6141
6512
  documentFields,
@@ -6148,37 +6519,37 @@ function TechnicalTab({
6148
6519
  hasRunLinkCheck,
6149
6520
  onCheckLinks
6150
6521
  }) {
6151
- const urlSlugAudit = (0, import_react17.useMemo)(
6522
+ const urlSlugAudit = (0, import_react18.useMemo)(
6152
6523
  () => urlAudit(documentFields?.slug, primaryKeyword, secondaryKeyword),
6153
6524
  [documentFields?.slug, primaryKeyword, secondaryKeyword]
6154
6525
  );
6155
6526
  const headings = documentFields?.headings || [];
6156
6527
  const headingsDetailed = documentFields?.headingsDetailed;
6157
- const headingsForStructure = (0, import_react17.useMemo)(
6528
+ const headingsForStructure = (0, import_react18.useMemo)(
6158
6529
  () => headingsDetailed ? headingsDetailed : headings.map((text2) => ({ text: text2, level: 2 })),
6159
6530
  [headingsDetailed, headings]
6160
6531
  );
6161
6532
  const wordCount2 = text ? text.split(/\s+/).filter(Boolean).length : 0;
6162
- const structureAudits = (0, import_react17.useMemo)(
6163
- () => computeHeadingStructureAudits(headingsForStructure, wordCount2),
6164
- [headingsForStructure, wordCount2]
6533
+ const structureAudits = (0, import_react18.useMemo)(
6534
+ () => computeHeadingStructureAudits(headingsForStructure, wordCount2, primaryKeyword, secondaryKeyword, documentFields?.unstyledHeadings),
6535
+ [headingsForStructure, wordCount2, primaryKeyword, secondaryKeyword, documentFields?.unstyledHeadings]
6165
6536
  );
6166
6537
  const imageNames = documentFields?.imageNames || [];
6167
- const { filenames: imageFilenames, altTexts: imageAltTexts } = (0, import_react17.useMemo)(
6538
+ const { filenames: imageFilenames, altTexts: imageAltTexts } = (0, import_react18.useMemo)(
6168
6539
  () => classifyImageNames(imageNames),
6169
6540
  [imageNames]
6170
6541
  );
6171
- const filenameAudit = (0, import_react17.useMemo)(
6542
+ const filenameAudit = (0, import_react18.useMemo)(
6172
6543
  () => imageFilenameAudit(imageFilenames),
6173
6544
  [imageFilenames]
6174
6545
  );
6175
- const altTextAudit = (0, import_react17.useMemo)(
6546
+ const altTextAudit = (0, import_react18.useMemo)(
6176
6547
  () => imageAltTextAudit(imageAltTexts),
6177
6548
  [imageAltTexts]
6178
6549
  );
6179
6550
  const imageTitles = documentFields?.imageTitles || [];
6180
6551
  const imageCount = documentFields?.imageCount ?? 0;
6181
- const imgTitleAudit = (0, import_react17.useMemo)(
6552
+ const imgTitleAudit = (0, import_react18.useMemo)(
6182
6553
  () => imageTitleAudit(imageTitles, imageCount),
6183
6554
  [imageTitles, imageCount]
6184
6555
  );
@@ -6202,15 +6573,16 @@ function TechnicalTab({
6202
6573
  recommendation: "Above the 450-word floor. For competitive clinical content, push past 1,500 words."
6203
6574
  } : { label: "Word Count", value: `${wordCount2} words`, status: "good" };
6204
6575
  const bodyLinks = documentFields?.bodyLinks || [];
6576
+ const bodyLinksDetailed = documentFields?.bodyLinksDetailed;
6205
6577
  const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.headings && documentFields.headings.length > 0 || documentFields.imageNames && documentFields.imageNames.length > 0 || wordCount2 > 0);
6206
6578
  if (isLoading && !hasAnyField) {
6207
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
6208
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
6209
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
6579
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
6580
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
6581
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
6210
6582
  ] });
6211
6583
  }
6212
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
6213
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6584
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
6585
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6214
6586
  AuditCard2,
6215
6587
  {
6216
6588
  anchorId: "anchor-url-slug",
@@ -6218,10 +6590,22 @@ function TechnicalTab({
6218
6590
  value: urlSlugAudit.value,
6219
6591
  status: urlSlugAudit.status,
6220
6592
  recommendation: urlSlugAudit.recommendation,
6221
- footer: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SlugRedirectNotice, {})
6593
+ footer: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SlugRedirectNotice, {})
6594
+ }
6595
+ ),
6596
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6597
+ LinkCheckCard,
6598
+ {
6599
+ urls: bodyLinks,
6600
+ linksDetailed: bodyLinksDetailed,
6601
+ results: linkCheckResults,
6602
+ isLoading: isLinkCheckLoading,
6603
+ error: linkCheckError,
6604
+ hasRun: hasRunLinkCheck,
6605
+ onCheck: onCheckLinks
6222
6606
  }
6223
6607
  ),
6224
- wordAudit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6608
+ wordAudit && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6225
6609
  AuditCard2,
6226
6610
  {
6227
6611
  anchorId: "anchor-word-count",
@@ -6231,48 +6615,63 @@ function TechnicalTab({
6231
6615
  recommendation: wordAudit.recommendation
6232
6616
  }
6233
6617
  ),
6234
- structureAudits.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6235
- AuditCard2,
6236
- {
6237
- anchorId: i === 0 ? "anchor-headings-structure" : void 0,
6238
- label: a.label,
6239
- value: a.value,
6240
- status: a.status,
6241
- recommendation: a.recommendation
6242
- },
6243
- `structure-${i}`
6244
- )),
6245
- headings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { id: "anchor-headings-outline", style: { ...cardStyle6, padding: "8px 14px" }, children: [
6246
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 10, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", fontWeight: 600, marginBottom: 6 }, children: "Heading Outline" }),
6247
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
6248
- (headingsDetailed ? headingsDetailed.slice(0, 12) : headings.slice(0, 12).map((h) => ({ text: h, level: 2 }))).map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
6249
- "div",
6250
- {
6251
- style: {
6252
- fontSize: 11,
6253
- color: h.text ? "#4b5563" : "#dc2626",
6254
- fontStyle: h.text ? "normal" : "italic",
6255
- lineHeight: 1.4,
6256
- paddingLeft: Math.max(0, (h.level - 2) * 12)
6618
+ (() => {
6619
+ const structIdx = structureAudits.findIndex(
6620
+ (a) => a.label !== "Keywords in Headings" && a.label !== "Looks Like a Heading"
6621
+ );
6622
+ return structureAudits.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6623
+ AuditCard2,
6624
+ {
6625
+ 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,
6626
+ label: a.label,
6627
+ value: a.value,
6628
+ status: a.status,
6629
+ recommendation: a.recommendation
6630
+ },
6631
+ `structure-${i}`
6632
+ ));
6633
+ })(),
6634
+ (headings.length > 0 || !!documentFields?.title) && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { id: "anchor-headings-outline", style: { ...cardStyle6, padding: "8px 14px" }, children: [
6635
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontSize: 10, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", fontWeight: 600, marginBottom: 6 }, children: "Heading Outline" }),
6636
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
6637
+ documentFields?.title && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { fontSize: 11, color: MJH_BLUE, fontWeight: 700, lineHeight: 1.4 }, children: [
6638
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { fontSize: 9, fontWeight: 700, color: MJH_BLUE, marginRight: 6 }, children: "H1" }),
6639
+ documentFields.title,
6640
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { fontSize: 9, color: "#6b7280", fontWeight: 500, marginLeft: 6 }, children: "(article title)" })
6641
+ ] }),
6642
+ (headingsDetailed ? headingsDetailed.slice(0, 12) : headings.slice(0, 12).map((h) => ({ text: h, level: 2 }))).map((h, i) => {
6643
+ const isH1 = h.level === 1;
6644
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
6645
+ "div",
6646
+ {
6647
+ style: {
6648
+ fontSize: 11,
6649
+ color: !h.text ? "#dc2626" : isH1 ? MJH_BLUE : "#4b5563",
6650
+ fontWeight: isH1 ? 700 : 400,
6651
+ fontStyle: h.text ? "normal" : "italic",
6652
+ lineHeight: 1.4,
6653
+ paddingLeft: Math.max(0, (h.level - 2) * 12)
6654
+ },
6655
+ children: [
6656
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { style: { fontSize: 9, fontWeight: 700, color: isH1 ? MJH_BLUE : "#4b5563", marginRight: 6 }, children: [
6657
+ "H",
6658
+ h.level
6659
+ ] }),
6660
+ h.text || "(empty)"
6661
+ ]
6257
6662
  },
6258
- children: [
6259
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", marginRight: 6 }, children: [
6260
- "H",
6261
- h.level
6262
- ] }),
6263
- h.text || "(empty)"
6264
- ]
6265
- },
6266
- i
6267
- )),
6268
- (headingsDetailed ?? headings).length > 12 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { fontSize: 10, color: "#4b5563" }, children: [
6663
+ i
6664
+ );
6665
+ }),
6666
+ (headingsDetailed ?? headings).length > 12 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { fontSize: 10, color: "#4b5563" }, children: [
6269
6667
  "+ ",
6270
6668
  (headingsDetailed ?? headings).length - 12,
6271
6669
  " more"
6272
6670
  ] })
6273
- ] })
6671
+ ] }),
6672
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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." })
6274
6673
  ] }),
6275
- imagesAudit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6674
+ imagesAudit && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6276
6675
  AuditCard2,
6277
6676
  {
6278
6677
  anchorId: "anchor-images",
@@ -6282,7 +6681,7 @@ function TechnicalTab({
6282
6681
  recommendation: imagesAudit.recommendation
6283
6682
  }
6284
6683
  ),
6285
- filenameAudit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6684
+ filenameAudit && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6286
6685
  AuditCard2,
6287
6686
  {
6288
6687
  anchorId: "anchor-image-filenames",
@@ -6292,7 +6691,7 @@ function TechnicalTab({
6292
6691
  recommendation: filenameAudit.recommendation
6293
6692
  }
6294
6693
  ),
6295
- altTextAudit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6694
+ altTextAudit && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6296
6695
  AuditCard2,
6297
6696
  {
6298
6697
  anchorId: "anchor-image-alt",
@@ -6302,7 +6701,7 @@ function TechnicalTab({
6302
6701
  recommendation: altTextAudit.recommendation
6303
6702
  }
6304
6703
  ),
6305
- imgTitleAudit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6704
+ imgTitleAudit && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6306
6705
  AuditCard2,
6307
6706
  {
6308
6707
  anchorId: "anchor-image-titles",
@@ -6311,28 +6710,17 @@ function TechnicalTab({
6311
6710
  status: imgTitleAudit.status,
6312
6711
  recommendation: imgTitleAudit.recommendation
6313
6712
  }
6314
- ),
6315
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6316
- LinkCheckCard,
6317
- {
6318
- urls: bodyLinks,
6319
- results: linkCheckResults,
6320
- isLoading: isLinkCheckLoading,
6321
- error: linkCheckError,
6322
- hasRun: hasRunLinkCheck,
6323
- onCheck: onCheckLinks
6324
- }
6325
6713
  )
6326
6714
  ] });
6327
6715
  }
6328
6716
 
6329
6717
  // src/components/SEOCopilotPanel.tsx
6330
- var import_jsx_runtime16 = require("react/jsx-runtime");
6718
+ var import_jsx_runtime17 = require("react/jsx-runtime");
6331
6719
  function LogoIcon2() {
6332
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
6333
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "1", y: "3", width: "4", height: "10", rx: "1", fill: MJH_GOLD, opacity: "1" }),
6334
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "6", y: "1", width: "4", height: "14", rx: "1", fill: MJH_GOLD, opacity: "0.85" }),
6335
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "11", y: "5", width: "4", height: "8", rx: "1", fill: MJH_GOLD, opacity: "0.6" })
6720
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
6721
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "1", y: "3", width: "4", height: "10", rx: "1", fill: MJH_GOLD, opacity: "1" }),
6722
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "6", y: "1", width: "4", height: "14", rx: "1", fill: MJH_GOLD, opacity: "0.85" }),
6723
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "11", y: "5", width: "4", height: "8", rx: "1", fill: MJH_GOLD, opacity: "0.6" })
6336
6724
  ] });
6337
6725
  }
6338
6726
  function PanelContent({
@@ -6374,14 +6762,14 @@ function PanelContent({
6374
6762
  const keywordAnalysisState = externalAnalysis;
6375
6763
  const effectivePrimary = selectedPrimary || externalAnalysis.analysis?.primaryKeyword?.term || "";
6376
6764
  const effectiveSecondary = selectedSecondary || "";
6377
- const containerRef = (0, import_react18.useRef)(null);
6378
- const dragging = (0, import_react18.useRef)(false);
6379
- const onMouseDown = (0, import_react18.useCallback)(() => {
6765
+ const containerRef = (0, import_react19.useRef)(null);
6766
+ const dragging = (0, import_react19.useRef)(false);
6767
+ const onMouseDown = (0, import_react19.useCallback)(() => {
6380
6768
  dragging.current = true;
6381
6769
  document.body.style.cursor = "row-resize";
6382
6770
  document.body.style.userSelect = "none";
6383
6771
  }, []);
6384
- (0, import_react18.useEffect)(() => {
6772
+ (0, import_react19.useEffect)(() => {
6385
6773
  const onMouseMove = (e) => {
6386
6774
  if (!dragging.current || !containerRef.current) return;
6387
6775
  const rect = containerRef.current.getBoundingClientRect();
@@ -6404,11 +6792,11 @@ function PanelContent({
6404
6792
  const onboardSite = publication || "default";
6405
6793
  const onboardKey = `seo-copilot-onboarded-${onboardSite}`;
6406
6794
  const onboardSessionKey = `seo-copilot-onboard-shown-${onboardSite}`;
6407
- const [popupMode, setPopupMode] = (0, import_react18.useState)("hidden");
6408
- const [popupClosing, setPopupClosing] = (0, import_react18.useState)(false);
6409
- const onboardTimerRef = (0, import_react18.useRef)(null);
6410
- const onboardFadeRef = (0, import_react18.useRef)(null);
6411
- (0, import_react18.useEffect)(() => {
6795
+ const [popupMode, setPopupMode] = (0, import_react19.useState)("hidden");
6796
+ const [popupClosing, setPopupClosing] = (0, import_react19.useState)(false);
6797
+ const onboardTimerRef = (0, import_react19.useRef)(null);
6798
+ const onboardFadeRef = (0, import_react19.useRef)(null);
6799
+ (0, import_react19.useEffect)(() => {
6412
6800
  let onboarded = false;
6413
6801
  let shownThisSession = false;
6414
6802
  try {
@@ -6438,13 +6826,13 @@ function PanelContent({
6438
6826
  if (onboardFadeRef.current) clearTimeout(onboardFadeRef.current);
6439
6827
  };
6440
6828
  }, [onboardKey, onboardSessionKey]);
6441
- const markOnboarded = (0, import_react18.useCallback)(() => {
6829
+ const markOnboarded = (0, import_react19.useCallback)(() => {
6442
6830
  try {
6443
6831
  localStorage.setItem(onboardKey, "1");
6444
6832
  } catch {
6445
6833
  }
6446
6834
  }, [onboardKey]);
6447
- const dismissPopup = (0, import_react18.useCallback)(() => {
6835
+ const dismissPopup = (0, import_react19.useCallback)(() => {
6448
6836
  if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
6449
6837
  if (onboardFadeRef.current) clearTimeout(onboardFadeRef.current);
6450
6838
  markOnboarded();
@@ -6454,14 +6842,14 @@ function PanelContent({
6454
6842
  setPopupClosing(false);
6455
6843
  }, 180);
6456
6844
  }, [markOnboarded]);
6457
- const openPopupPersistent = (0, import_react18.useCallback)(() => {
6845
+ const openPopupPersistent = (0, import_react19.useCallback)(() => {
6458
6846
  if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
6459
6847
  if (onboardFadeRef.current) clearTimeout(onboardFadeRef.current);
6460
6848
  markOnboarded();
6461
6849
  setPopupClosing(false);
6462
6850
  setPopupMode("persistent");
6463
6851
  }, [markOnboarded]);
6464
- const handleTabChange = (0, import_react18.useCallback)((id) => {
6852
+ const handleTabChange = (0, import_react19.useCallback)((id) => {
6465
6853
  markOnboarded();
6466
6854
  if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
6467
6855
  if (onboardFadeRef.current) clearTimeout(onboardFadeRef.current);
@@ -6480,7 +6868,7 @@ function PanelContent({
6480
6868
  { id: "meta", label: "Meta", beta: true },
6481
6869
  { id: "technical", label: "Other Recs", beta: true, loading: technicalOps.isLinkCheckLoading }
6482
6870
  ];
6483
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
6871
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6484
6872
  "div",
6485
6873
  {
6486
6874
  className: "seo-copilot-panel",
@@ -6495,9 +6883,9 @@ function PanelContent({
6495
6883
  position: "relative"
6496
6884
  },
6497
6885
  children: [
6498
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("style", { dangerouslySetInnerHTML: { __html: INJECTED_CSS } }),
6499
- popupMode !== "hidden" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(OnboardingCard, { onDismiss: dismissPopup, closing: popupClosing }),
6500
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
6886
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("style", { dangerouslySetInnerHTML: { __html: INJECTED_CSS } }),
6887
+ popupMode !== "hidden" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(OnboardingCard, { onDismiss: dismissPopup, closing: popupClosing }),
6888
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6501
6889
  "div",
6502
6890
  {
6503
6891
  onMouseDown: isFloating ? onDragStart : void 0,
@@ -6515,16 +6903,26 @@ function PanelContent({
6515
6903
  flexShrink: 0
6516
6904
  },
6517
6905
  children: [
6518
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
6519
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LogoIcon2, {}),
6520
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { style: { fontWeight: 700, fontSize: 15, letterSpacing: "-0.01em" }, children: [
6521
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { color: MJH_GOLD }, children: "SEO" }),
6522
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { color: MJH_SLATE }, children: " copilot" })
6906
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
6907
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LogoIcon2, {}),
6908
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { style: { fontWeight: 700, fontSize: 15, letterSpacing: "-0.01em" }, children: [
6909
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { color: MJH_GOLD }, children: "SEO" }),
6910
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { color: MJH_SLATE }, children: " copilot" })
6523
6911
  ] })
6524
6912
  ] }),
6525
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: isFloating ? 4 : 6 }, children: [
6526
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(OnboardingInfoButton, { onClick: openPopupPersistent }),
6527
- isFloating && onToggleFullscreen && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6913
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: isFloating ? 4 : 6 }, children: [
6914
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(OnboardingInfoButton, { onClick: openPopupPersistent }),
6915
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6916
+ ReportProblemButton,
6917
+ {
6918
+ activeTab,
6919
+ publication,
6920
+ documentId,
6921
+ documentType,
6922
+ primaryKeyword: effectivePrimary
6923
+ }
6924
+ ),
6925
+ isFloating && onToggleFullscreen && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6528
6926
  "button",
6529
6927
  {
6530
6928
  onClick: (e) => {
@@ -6546,16 +6944,16 @@ function PanelContent({
6546
6944
  fontWeight: 600,
6547
6945
  transition: "all 150ms"
6548
6946
  },
6549
- children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
6550
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }) }),
6947
+ children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
6948
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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" }) }),
6551
6949
  "Exit fullscreen"
6552
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
6553
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }) }),
6950
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
6951
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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" }) }),
6554
6952
  "Fullscreen"
6555
6953
  ] })
6556
6954
  }
6557
6955
  ),
6558
- isFloating && onToggleFloat && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
6956
+ isFloating && onToggleFloat && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6559
6957
  "button",
6560
6958
  {
6561
6959
  onClick: (e) => {
@@ -6578,7 +6976,7 @@ function PanelContent({
6578
6976
  transition: "all 150ms"
6579
6977
  },
6580
6978
  children: [
6581
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6979
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6582
6980
  "path",
6583
6981
  {
6584
6982
  fillRule: "evenodd",
@@ -6590,7 +6988,7 @@ function PanelContent({
6590
6988
  ]
6591
6989
  }
6592
6990
  ),
6593
- !isFloating && onToggleFloat && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6991
+ !isFloating && onToggleFloat && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6594
6992
  "button",
6595
6993
  {
6596
6994
  onClick: (e) => {
@@ -6609,13 +7007,13 @@ function PanelContent({
6609
7007
  transition: "color 150ms"
6610
7008
  },
6611
7009
  title: "Pop out",
6612
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: [
6613
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }),
6614
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" })
7010
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: [
7011
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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" }),
7012
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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" })
6615
7013
  ] })
6616
7014
  }
6617
7015
  ),
6618
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7016
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6619
7017
  "div",
6620
7018
  {
6621
7019
  style: {
@@ -6627,7 +7025,7 @@ function PanelContent({
6627
7025
  }
6628
7026
  }
6629
7027
  ),
6630
- onClose && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7028
+ onClose && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6631
7029
  "button",
6632
7030
  {
6633
7031
  onClick: (e) => {
@@ -6646,11 +7044,11 @@ function PanelContent({
6646
7044
  transition: "color 150ms"
6647
7045
  },
6648
7046
  title: "Close",
6649
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }) })
7047
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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" }) })
6650
7048
  }
6651
7049
  )
6652
7050
  ] }),
6653
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7051
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6654
7052
  "div",
6655
7053
  {
6656
7054
  style: {
@@ -6669,8 +7067,8 @@ function PanelContent({
6669
7067
  ]
6670
7068
  }
6671
7069
  ),
6672
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TabBar, { tabs: tabDefs, activeTab, onTabChange: handleTabChange }),
6673
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7070
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TabBar, { tabs: tabDefs, activeTab, onTabChange: handleTabChange }),
7071
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6674
7072
  "div",
6675
7073
  {
6676
7074
  style: {
@@ -6686,8 +7084,8 @@ function PanelContent({
6686
7084
  children: "Recommendations are generated by AI. Verify details before publishing."
6687
7085
  }
6688
7086
  ),
6689
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { ref: containerRef, style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
6690
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
7087
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { ref: containerRef, style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
7088
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6691
7089
  "div",
6692
7090
  {
6693
7091
  style: {
@@ -6698,7 +7096,7 @@ function PanelContent({
6698
7096
  background: RECS_ZONE_BG
6699
7097
  },
6700
7098
  children: [
6701
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "keywords" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7099
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { display: activeTab === "keywords" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6702
7100
  KeywordPanel,
6703
7101
  {
6704
7102
  text,
@@ -6714,7 +7112,7 @@ function PanelContent({
6714
7112
  },
6715
7113
  documentId || "default"
6716
7114
  ) }),
6717
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "summary" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7115
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { display: activeTab === "summary" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6718
7116
  SummaryTab,
6719
7117
  {
6720
7118
  text,
@@ -6730,7 +7128,7 @@ function PanelContent({
6730
7128
  onItemClick: summaryOps.onItemClick
6731
7129
  }
6732
7130
  ) }),
6733
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "aeo" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7131
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { display: activeTab === "aeo" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6734
7132
  AEOTab,
6735
7133
  {
6736
7134
  text,
@@ -6746,7 +7144,7 @@ function PanelContent({
6746
7144
  loadContentSuggestions: aeoOps.loadContentSuggestions
6747
7145
  }
6748
7146
  ) }),
6749
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "linking" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7147
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { display: activeTab === "linking" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6750
7148
  LinkingTab,
6751
7149
  {
6752
7150
  analysis: keywordAnalysisState.analysis,
@@ -6762,8 +7160,8 @@ function PanelContent({
6762
7160
  documentType
6763
7161
  }
6764
7162
  ) }),
6765
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "meta" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MetaTab, { documentFields, primaryKeyword: effectivePrimary, secondaryKeyword: effectiveSecondary, isLoading: docLoading }) }),
6766
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "technical" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7163
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { display: activeTab === "meta" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MetaTab, { documentFields, primaryKeyword: effectivePrimary, secondaryKeyword: effectiveSecondary, isLoading: docLoading }) }),
7164
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { display: activeTab === "technical" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6767
7165
  TechnicalTab,
6768
7166
  {
6769
7167
  text,
@@ -6781,7 +7179,7 @@ function PanelContent({
6781
7179
  ]
6782
7180
  }
6783
7181
  ),
6784
- chatOpen && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7182
+ chatOpen && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6785
7183
  "div",
6786
7184
  {
6787
7185
  onMouseDown,
@@ -6794,10 +7192,10 @@ function PanelContent({
6794
7192
  justifyContent: "center",
6795
7193
  flexShrink: 0
6796
7194
  },
6797
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { width: 32, height: 2, borderRadius: 1, background: "#d1d5db" } })
7195
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { width: 32, height: 2, borderRadius: 1, background: "#d1d5db" } })
6798
7196
  }
6799
7197
  ),
6800
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
7198
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6801
7199
  "div",
6802
7200
  {
6803
7201
  style: {
@@ -6810,7 +7208,7 @@ function PanelContent({
6810
7208
  background: CHAT_ZONE_BG
6811
7209
  },
6812
7210
  children: [
6813
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
7211
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6814
7212
  "button",
6815
7213
  {
6816
7214
  onClick: () => onChatOpenChange(!chatOpen),
@@ -6831,7 +7229,7 @@ function PanelContent({
6831
7229
  flexShrink: 0
6832
7230
  },
6833
7231
  children: [
6834
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7232
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6835
7233
  "span",
6836
7234
  {
6837
7235
  style: {
@@ -6844,7 +7242,7 @@ function PanelContent({
6844
7242
  children: "Chat"
6845
7243
  }
6846
7244
  ),
6847
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7245
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6848
7246
  "svg",
6849
7247
  {
6850
7248
  width: "12",
@@ -6852,7 +7250,7 @@ function PanelContent({
6852
7250
  viewBox: "0 0 20 20",
6853
7251
  fill: "rgba(0,0,0,0.55)",
6854
7252
  style: { transform: chatOpen ? "rotate(0deg)" : "rotate(-90deg)", transition: "transform 200ms" },
6855
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7253
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6856
7254
  "path",
6857
7255
  {
6858
7256
  fillRule: "evenodd",
@@ -6865,7 +7263,7 @@ function PanelContent({
6865
7263
  ]
6866
7264
  }
6867
7265
  ),
6868
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7266
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6869
7267
  "div",
6870
7268
  {
6871
7269
  style: {
@@ -6875,7 +7273,7 @@ function PanelContent({
6875
7273
  flexDirection: "column",
6876
7274
  minHeight: 0
6877
7275
  },
6878
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7276
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6879
7277
  ChatPanel,
6880
7278
  {
6881
7279
  messages: chatState.messages,
@@ -6906,21 +7304,21 @@ function SEOCopilotInner({ config, onClose }) {
6906
7304
  "seo-copilot-ui-float-size",
6907
7305
  { width: 380, height: typeof window !== "undefined" ? Math.round(window.innerHeight * 0.8) : 600 }
6908
7306
  );
6909
- const dragOffset = (0, import_react18.useRef)(null);
6910
- const resizeStart = (0, import_react18.useRef)(null);
6911
- const activeDragCleanupRef = (0, import_react18.useRef)(null);
6912
- const activeResizeCleanupRef = (0, import_react18.useRef)(null);
7307
+ const dragOffset = (0, import_react19.useRef)(null);
7308
+ const resizeStart = (0, import_react19.useRef)(null);
7309
+ const activeDragCleanupRef = (0, import_react19.useRef)(null);
7310
+ const activeResizeCleanupRef = (0, import_react19.useRef)(null);
6913
7311
  const { text, isLoading: docLoading, documentFields, documentId, documentType } = useDocumentContent();
6914
7312
  const { apiUrl } = useConfig();
6915
- const workspace = (0, import_sanity3.useWorkspace)();
7313
+ const workspace = (0, import_sanity4.useWorkspace)();
6916
7314
  const effectivePublication = config.publication || workspace?.dataset;
6917
- const sanityBaseUrl = (0, import_react18.useMemo)(() => {
7315
+ const sanityBaseUrl = (0, import_react19.useMemo)(() => {
6918
7316
  if (typeof window === "undefined") return void 0;
6919
7317
  const basePath = (workspace?.basePath || "/").replace(/\/+$/, "");
6920
7318
  return `${window.location.origin}${basePath}`;
6921
7319
  }, [workspace?.basePath]);
6922
7320
  const seedCacheKey = documentId ? `seo-copilot-cache-${documentId}` : "seo-copilot-cache-v2";
6923
- const loadSeedsFromCache = (0, import_react18.useCallback)(() => {
7321
+ const loadSeedsFromCache = (0, import_react19.useCallback)(() => {
6924
7322
  try {
6925
7323
  const c = localStorage.getItem(seedCacheKey);
6926
7324
  if (c) return JSON.parse(c).seeds || [];
@@ -6928,8 +7326,8 @@ function SEOCopilotInner({ config, onClose }) {
6928
7326
  }
6929
7327
  return [];
6930
7328
  }, [seedCacheKey]);
6931
- const [seedKeywords, setSeedKeywordsRaw] = (0, import_react18.useState)(loadSeedsFromCache);
6932
- const setSeedKeywords = (0, import_react18.useCallback)(
7329
+ const [seedKeywords, setSeedKeywordsRaw] = (0, import_react19.useState)(loadSeedsFromCache);
7330
+ const setSeedKeywords = (0, import_react19.useCallback)(
6933
7331
  (seeds) => {
6934
7332
  setSeedKeywordsRaw(seeds);
6935
7333
  try {
@@ -6944,25 +7342,25 @@ function SEOCopilotInner({ config, onClose }) {
6944
7342
  const [selectedPrimary, setSelectedPrimary] = usePersistentState(selectedPrimaryKey, void 0);
6945
7343
  const selectedSecondaryKey = documentId ? `seo-copilot-secondary-${documentId}` : "seo-copilot-secondary-default";
6946
7344
  const [selectedSecondary, setSelectedSecondary] = usePersistentState(selectedSecondaryKey, "");
6947
- const seedsInitializedRef = (0, import_react18.useRef)(false);
6948
- (0, import_react18.useEffect)(() => {
7345
+ const seedsInitializedRef = (0, import_react19.useRef)(false);
7346
+ (0, import_react19.useEffect)(() => {
6949
7347
  if (!seedsInitializedRef.current) {
6950
7348
  seedsInitializedRef.current = true;
6951
7349
  return;
6952
7350
  }
6953
7351
  setSeedKeywordsRaw(loadSeedsFromCache());
6954
7352
  }, [documentId, loadSeedsFromCache]);
6955
- const [activeTab, setActiveTab] = (0, import_react18.useState)("keywords");
7353
+ const [activeTab, setActiveTab] = (0, import_react19.useState)("keywords");
6956
7354
  const [chatOpen, setChatOpen] = usePersistentState("seo-copilot-ui-chat-open-v35", false);
6957
7355
  const [splitPercent, setSplitPercent] = usePersistentState("seo-copilot-ui-split", 70);
6958
7356
  const keywordAnalysisState = useKeywordAnalysis(text, apiUrl, effectivePublication, seedKeywords, documentFields, selectedPrimary, documentId, selectedSecondary);
6959
7357
  const effectivePrimary = selectedPrimary || keywordAnalysisState.analysis?.primaryKeyword?.term || "";
6960
- (0, import_react18.useEffect)(() => {
7358
+ (0, import_react19.useEffect)(() => {
6961
7359
  if (selectedSecondary && effectivePrimary && selectedSecondary.toLowerCase() === effectivePrimary.toLowerCase()) {
6962
7360
  setSelectedSecondary("");
6963
7361
  }
6964
7362
  }, [effectivePrimary, selectedSecondary, setSelectedSecondary]);
6965
- const keywordPanelData = (0, import_react18.useMemo)(() => {
7363
+ const keywordPanelData = (0, import_react19.useMemo)(() => {
6966
7364
  const analysis = keywordAnalysisState.analysis;
6967
7365
  if (!analysis) return void 0;
6968
7366
  return {
@@ -6980,12 +7378,12 @@ function SEOCopilotInner({ config, onClose }) {
6980
7378
  const chatHookState = useSEOChat(apiUrl, text, effectivePublication, keywordPanelData, documentId);
6981
7379
  const contentSuggestionsKey = documentId ? `seo-copilot-content-suggestions-${documentId}` : "seo-copilot-content-suggestions-default";
6982
7380
  const [contentSuggestions, setContentSuggestions] = usePersistentState(contentSuggestionsKey, null);
6983
- const [isCSLoading, setIsCSLoading] = (0, import_react18.useState)(false);
6984
- const [csError, setCsError] = (0, import_react18.useState)(null);
6985
- const aeoOpVersionRef = (0, import_react18.useRef)(0);
6986
- const csAbortRef = (0, import_react18.useRef)(null);
6987
- const didInitAeoRef = (0, import_react18.useRef)(false);
6988
- (0, import_react18.useEffect)(() => {
7381
+ const [isCSLoading, setIsCSLoading] = (0, import_react19.useState)(false);
7382
+ const [csError, setCsError] = (0, import_react19.useState)(null);
7383
+ const aeoOpVersionRef = (0, import_react19.useRef)(0);
7384
+ const csAbortRef = (0, import_react19.useRef)(null);
7385
+ const didInitAeoRef = (0, import_react19.useRef)(false);
7386
+ (0, import_react19.useEffect)(() => {
6989
7387
  if (!didInitAeoRef.current) {
6990
7388
  didInitAeoRef.current = true;
6991
7389
  return;
@@ -6994,7 +7392,7 @@ function SEOCopilotInner({ config, onClose }) {
6994
7392
  setIsCSLoading(false);
6995
7393
  setCsError(null);
6996
7394
  }, [documentId]);
6997
- const loadContentSuggestions = (0, import_react18.useCallback)(async () => {
7395
+ const loadContentSuggestions = (0, import_react19.useCallback)(async () => {
6998
7396
  const myVersion = aeoOpVersionRef.current;
6999
7397
  setIsCSLoading(true);
7000
7398
  setCsError(null);
@@ -7019,14 +7417,14 @@ function SEOCopilotInner({ config, onClose }) {
7019
7417
  }, [apiUrl, text, effectivePrimary, effectivePublication]);
7020
7418
  const linkingKey = documentId ? `seo-copilot-linking-${documentId}` : "seo-copilot-linking-default";
7021
7419
  const [linkingSuggestions, setLinkingSuggestions] = usePersistentState(linkingKey, []);
7022
- const [isLinkingLoading, setIsLinkingLoading] = (0, import_react18.useState)(false);
7023
- const [linkingError, setLinkingError] = (0, import_react18.useState)(null);
7024
- const [linkingFetchedText, setLinkingFetchedText] = (0, import_react18.useState)("");
7025
- const linkingVersionRef = (0, import_react18.useRef)(0);
7026
- const linkingAbortRef = (0, import_react18.useRef)(null);
7027
- const didInitLinkingRef = (0, import_react18.useRef)(false);
7028
- const lastLinkingFetchKey = (0, import_react18.useRef)("");
7029
- (0, import_react18.useEffect)(() => {
7420
+ const [isLinkingLoading, setIsLinkingLoading] = (0, import_react19.useState)(false);
7421
+ const [linkingError, setLinkingError] = (0, import_react19.useState)(null);
7422
+ const [linkingFetchedText, setLinkingFetchedText] = (0, import_react19.useState)("");
7423
+ const linkingVersionRef = (0, import_react19.useRef)(0);
7424
+ const linkingAbortRef = (0, import_react19.useRef)(null);
7425
+ const didInitLinkingRef = (0, import_react19.useRef)(false);
7426
+ const lastLinkingFetchKey = (0, import_react19.useRef)("");
7427
+ (0, import_react19.useEffect)(() => {
7030
7428
  if (!didInitLinkingRef.current) {
7031
7429
  didInitLinkingRef.current = true;
7032
7430
  return;
@@ -7036,12 +7434,12 @@ function SEOCopilotInner({ config, onClose }) {
7036
7434
  setLinkingError(null);
7037
7435
  lastLinkingFetchKey.current = "";
7038
7436
  }, [documentId]);
7039
- const supportingKeywordsForLinking = (0, import_react18.useMemo)(() => {
7437
+ const supportingKeywordsForLinking = (0, import_react19.useMemo)(() => {
7040
7438
  const base = (keywordAnalysisState.analysis?.supportingKeywords || []).map((kw) => kw.term).filter(Boolean);
7041
7439
  const merged = selectedSecondary ? [selectedSecondary, ...base.filter((t) => t.toLowerCase() !== selectedSecondary.toLowerCase())] : base;
7042
7440
  return merged.slice(0, 5);
7043
7441
  }, [keywordAnalysisState.analysis, selectedSecondary]);
7044
- const refreshLinkingSuggestions = (0, import_react18.useCallback)(async () => {
7442
+ const refreshLinkingSuggestions = (0, import_react19.useCallback)(async () => {
7045
7443
  if (!text || text.trim().length < 50) return;
7046
7444
  if (!effectivePrimary) return;
7047
7445
  const myVersion = linkingVersionRef.current;
@@ -7071,12 +7469,12 @@ function SEOCopilotInner({ config, onClose }) {
7071
7469
  if (linkingVersionRef.current !== myVersion) return;
7072
7470
  setIsLinkingLoading(false);
7073
7471
  }, [apiUrl, text, effectivePrimary, supportingKeywordsForLinking, documentId, effectivePublication]);
7074
- const isLinkingStale = (0, import_react18.useMemo)(() => {
7472
+ const isLinkingStale = (0, import_react19.useMemo)(() => {
7075
7473
  if (!linkingFetchedText || linkingSuggestions.length === 0) return false;
7076
7474
  if (Math.abs(text.length - linkingFetchedText.length) > 150) return true;
7077
7475
  return text.slice(0, 300) !== linkingFetchedText.slice(0, 300);
7078
7476
  }, [text, linkingFetchedText, linkingSuggestions.length]);
7079
- (0, import_react18.useEffect)(() => {
7477
+ (0, import_react19.useEffect)(() => {
7080
7478
  if (!text || text.trim().length < 50 || !effectivePrimary) return;
7081
7479
  const fetchKey = `${documentId || "_"}|${effectivePrimary}|${supportingKeywordsForLinking.join(",")}`;
7082
7480
  if (fetchKey === lastLinkingFetchKey.current) return;
@@ -7090,11 +7488,11 @@ function SEOCopilotInner({ config, onClose }) {
7090
7488
  const linkCheckKey = documentId ? `seo-copilot-link-check-${documentId}` : "seo-copilot-link-check-default";
7091
7489
  const [linkCheckResults, setLinkCheckResults] = usePersistentState(linkCheckKey, []);
7092
7490
  const [hasRunLinkCheck, setHasRunLinkCheck] = usePersistentState(`${linkCheckKey}-ran`, false);
7093
- const [isLinkCheckLoading, setIsLinkCheckLoading] = (0, import_react18.useState)(false);
7094
- const [linkCheckError, setLinkCheckError] = (0, import_react18.useState)(null);
7095
- const linkCheckVersionRef = (0, import_react18.useRef)(0);
7096
- const didInitLinkCheckRef = (0, import_react18.useRef)(false);
7097
- (0, import_react18.useEffect)(() => {
7491
+ const [isLinkCheckLoading, setIsLinkCheckLoading] = (0, import_react19.useState)(false);
7492
+ const [linkCheckError, setLinkCheckError] = (0, import_react19.useState)(null);
7493
+ const linkCheckVersionRef = (0, import_react19.useRef)(0);
7494
+ const didInitLinkCheckRef = (0, import_react19.useRef)(false);
7495
+ (0, import_react19.useEffect)(() => {
7098
7496
  if (!didInitLinkCheckRef.current) {
7099
7497
  didInitLinkCheckRef.current = true;
7100
7498
  return;
@@ -7103,7 +7501,7 @@ function SEOCopilotInner({ config, onClose }) {
7103
7501
  setIsLinkCheckLoading(false);
7104
7502
  setLinkCheckError(null);
7105
7503
  }, [documentId]);
7106
- const runLinkCheck = (0, import_react18.useCallback)(async () => {
7504
+ const runLinkCheck = (0, import_react19.useCallback)(async () => {
7107
7505
  const urls = documentFields?.bodyLinks || [];
7108
7506
  if (urls.length === 0) {
7109
7507
  setHasRunLinkCheck(true);
@@ -7129,7 +7527,7 @@ function SEOCopilotInner({ config, onClose }) {
7129
7527
  if (linkCheckVersionRef.current !== myVersion) return;
7130
7528
  setIsLinkCheckLoading(false);
7131
7529
  }, [apiUrl, documentFields?.bodyLinks, setHasRunLinkCheck, setLinkCheckResults]);
7132
- (0, import_react18.useEffect)(() => {
7530
+ (0, import_react19.useEffect)(() => {
7133
7531
  return () => {
7134
7532
  activeDragCleanupRef.current?.();
7135
7533
  activeResizeCleanupRef.current?.();
@@ -7143,10 +7541,10 @@ function SEOCopilotInner({ config, onClose }) {
7143
7541
  if (text && text.trim().length >= 50 && effectivePrimary) refreshLinkingSuggestions();
7144
7542
  if ((documentFields?.bodyLinks || []).length > 0) runLinkCheck();
7145
7543
  };
7146
- const runAllRef = (0, import_react18.useRef)(runAllAnalyses);
7544
+ const runAllRef = (0, import_react19.useRef)(runAllAnalyses);
7147
7545
  runAllRef.current = runAllAnalyses;
7148
- const secAutoRunRef = (0, import_react18.useRef)({ doc: documentId, sec: selectedSecondary, init: true });
7149
- (0, import_react18.useEffect)(() => {
7546
+ const secAutoRunRef = (0, import_react19.useRef)({ doc: documentId, sec: selectedSecondary, init: true });
7547
+ (0, import_react19.useEffect)(() => {
7150
7548
  const prev = secAutoRunRef.current;
7151
7549
  const docChanged = prev.doc !== documentId;
7152
7550
  const secChanged = prev.sec !== selectedSecondary;
@@ -7155,7 +7553,7 @@ function SEOCopilotInner({ config, onClose }) {
7155
7553
  const t = setTimeout(() => runAllRef.current(), 1500);
7156
7554
  return () => clearTimeout(t);
7157
7555
  }, [selectedSecondary, documentId]);
7158
- const handleDragStart = (0, import_react18.useCallback)(
7556
+ const handleDragStart = (0, import_react19.useCallback)(
7159
7557
  (e) => {
7160
7558
  dragOffset.current = {
7161
7559
  dx: e.clientX - floatPos.x,
@@ -7189,7 +7587,7 @@ function SEOCopilotInner({ config, onClose }) {
7189
7587
  },
7190
7588
  [floatPos]
7191
7589
  );
7192
- const handleResizeStart = (0, import_react18.useCallback)(
7590
+ const handleResizeStart = (0, import_react19.useCallback)(
7193
7591
  (e) => {
7194
7592
  e.preventDefault();
7195
7593
  e.stopPropagation();
@@ -7221,7 +7619,7 @@ function SEOCopilotInner({ config, onClose }) {
7221
7619
  },
7222
7620
  [floatSize]
7223
7621
  );
7224
- const panelContent = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7622
+ const panelContent = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
7225
7623
  PanelContent,
7226
7624
  {
7227
7625
  initialPublication: effectivePublication,
@@ -7303,7 +7701,7 @@ function SEOCopilotInner({ config, onClose }) {
7303
7701
  }
7304
7702
  }
7305
7703
  );
7306
- const floatingPanel = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
7704
+ const floatingPanel = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
7307
7705
  "div",
7308
7706
  {
7309
7707
  style: {
@@ -7321,7 +7719,7 @@ function SEOCopilotInner({ config, onClose }) {
7321
7719
  },
7322
7720
  children: [
7323
7721
  panelContent,
7324
- !isFullscreen && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7722
+ !isFullscreen && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
7325
7723
  "div",
7326
7724
  {
7327
7725
  onMouseDown: handleResizeStart,
@@ -7336,9 +7734,9 @@ function SEOCopilotInner({ config, onClose }) {
7336
7734
  alignItems: "center",
7337
7735
  justifyContent: "center"
7338
7736
  },
7339
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "#9ca3af", children: [
7340
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M9 1v8H1", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" }),
7341
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M9 5v4H5", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" })
7737
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "#9ca3af", children: [
7738
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M9 1v8H1", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" }),
7739
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M9 5v4H5", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" })
7342
7740
  ] })
7343
7741
  }
7344
7742
  )
@@ -7346,8 +7744,8 @@ function SEOCopilotInner({ config, onClose }) {
7346
7744
  }
7347
7745
  );
7348
7746
  if (isFloating) {
7349
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
7350
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7747
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
7748
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
7351
7749
  "div",
7352
7750
  {
7353
7751
  style: {
@@ -7357,30 +7755,30 @@ function SEOCopilotInner({ config, onClose }) {
7357
7755
  alignItems: "center",
7358
7756
  justifyContent: "center"
7359
7757
  },
7360
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { fontSize: 12, color: "rgba(0,0,0,0.5)" }, children: "SEO Copilot is floating" })
7758
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontSize: 12, color: "rgba(0,0,0,0.5)" }, children: "SEO Copilot is floating" })
7361
7759
  }
7362
7760
  ),
7363
7761
  typeof document !== "undefined" && (0, import_react_dom.createPortal)(floatingPanel, document.body)
7364
7762
  ] });
7365
7763
  }
7366
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { height: "100%", background: PANEL_BG, position: "relative", zIndex: 1 }, children: panelContent });
7764
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { height: "100%", background: PANEL_BG, position: "relative", zIndex: 1 }, children: panelContent });
7367
7765
  }
7368
7766
  function SEOCopilotPanel({ config, onClose }) {
7369
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7370
- import_react18.Suspense,
7767
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
7768
+ import_react19.Suspense,
7371
7769
  {
7372
- fallback: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { padding: 16, display: "flex", alignItems: "center", gap: 12 }, children: [
7373
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LoadingBars, {}),
7374
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Loading SEO Copilot..." })
7770
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { padding: 16, display: "flex", alignItems: "center", gap: 12 }, children: [
7771
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LoadingBars, {}),
7772
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Loading SEO Copilot..." })
7375
7773
  ] }),
7376
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ConfigProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SEOCopilotInner, { config, onClose }) })
7774
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ConfigProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SEOCopilotInner, { config, onClose }) })
7377
7775
  }
7378
7776
  );
7379
7777
  }
7380
7778
  function LoadingBars({ size = "sm", color = MJH_GOLD }) {
7381
7779
  const barWidth = size === "xs" ? 4 : 6;
7382
7780
  const containerHeight = size === "xs" ? 10 : 14;
7383
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: containerHeight }, children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7781
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: containerHeight }, children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
7384
7782
  "div",
7385
7783
  {
7386
7784
  style: {
@@ -7397,11 +7795,11 @@ function LoadingBars({ size = "sm", color = MJH_GOLD }) {
7397
7795
 
7398
7796
  // src/inspector.ts
7399
7797
  function SEOIcon() {
7400
- return (0, import_react19.createElement)(
7798
+ return (0, import_react20.createElement)(
7401
7799
  "svg",
7402
7800
  { viewBox: "0 0 25 25", width: "1em", height: "1em", fill: "none" },
7403
- (0, import_react19.createElement)("circle", { cx: "12.5", cy: "12.5", r: "11.5", fill: "#E6C01B" }),
7404
- (0, import_react19.createElement)("text", {
7801
+ (0, import_react20.createElement)("circle", { cx: "12.5", cy: "12.5", r: "11.5", fill: "#E6C01B" }),
7802
+ (0, import_react20.createElement)("text", {
7405
7803
  x: "12.5",
7406
7804
  y: "7.5",
7407
7805
  textAnchor: "middle",
@@ -7411,7 +7809,7 @@ function SEOIcon() {
7411
7809
  fontWeight: "900",
7412
7810
  fontFamily: "Arial Black, Impact, sans-serif"
7413
7811
  }, "S"),
7414
- (0, import_react19.createElement)("text", {
7812
+ (0, import_react20.createElement)("text", {
7415
7813
  x: "12.5",
7416
7814
  y: "12.8",
7417
7815
  textAnchor: "middle",
@@ -7421,7 +7819,7 @@ function SEOIcon() {
7421
7819
  fontWeight: "900",
7422
7820
  fontFamily: "Arial Black, Impact, sans-serif"
7423
7821
  }, "E"),
7424
- (0, import_react19.createElement)("text", {
7822
+ (0, import_react20.createElement)("text", {
7425
7823
  x: "12.5",
7426
7824
  y: "18",
7427
7825
  textAnchor: "middle",
@@ -7449,20 +7847,22 @@ function seoCopilotInspector(config) {
7449
7847
  tone: "default"
7450
7848
  }),
7451
7849
  component: function SEOCopilotInspector(props) {
7452
- return (0, import_react19.createElement)(SEOCopilotPanel, { ...props, config });
7850
+ return (0, import_react20.createElement)(SEOCopilotPanel, { ...props, config });
7453
7851
  }
7454
7852
  };
7455
7853
  }
7456
7854
 
7457
7855
  // src/index.ts
7458
- var seoCopilot = (0, import_sanity4.definePlugin)((config) => ({
7459
- name: "seo-copilot",
7460
- document: {
7461
- inspectors: (prev) => {
7462
- return [...prev, seoCopilotInspector(config)];
7856
+ var seoCopilot = (0, import_sanity5.definePlugin)((config) => {
7857
+ return {
7858
+ name: "seo-copilot",
7859
+ document: {
7860
+ inspectors: (prev) => {
7861
+ return [...prev, seoCopilotInspector(config)];
7862
+ }
7463
7863
  }
7464
- }
7465
- }));
7864
+ };
7865
+ });
7466
7866
  // Annotate the CommonJS export names for ESM import in node:
7467
7867
  0 && (module.exports = {
7468
7868
  seoCopilot