@elementor/editor-audits 4.3.2 → 4.3.4

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
@@ -52,18 +52,18 @@ var import_editor_floating_panels2 = require("@elementor/editor-floating-panels"
52
52
 
53
53
  // src/components/audit-panel.tsx
54
54
  var React25 = __toESM(require("react"));
55
- var import_editor_elements5 = require("@elementor/editor-elements");
55
+ var import_editor_elements6 = require("@elementor/editor-elements");
56
56
  var import_editor_floating_panels = require("@elementor/editor-floating-panels");
57
57
  var import_ui24 = require("@elementor/ui");
58
58
  var import_i18n23 = require("@wordpress/i18n");
59
59
 
60
60
  // src/hooks/use-audit-report.ts
61
61
  var import_react = require("react");
62
- var import_editor_elements2 = require("@elementor/editor-elements");
62
+ var import_editor_elements3 = require("@elementor/editor-elements");
63
63
  var import_store2 = require("@elementor/store");
64
64
 
65
65
  // src/runner.ts
66
- var import_editor_elements = require("@elementor/editor-elements");
66
+ var import_editor_elements2 = require("@elementor/editor-elements");
67
67
 
68
68
  // src/api/page-context-client.ts
69
69
  var import_http_client = require("@elementor/http-client");
@@ -115,17 +115,17 @@ async function requestFreshNonce() {
115
115
  }
116
116
 
117
117
  // src/api/page-context-client.ts
118
- async function fetchPageContext(documentId, attachmentIds) {
119
- return requestPageContext(documentId, attachmentIds, true);
118
+ async function fetchPageContext(documentId, imageSizeRequests) {
119
+ return requestPageContext(documentId, imageSizeRequests, true);
120
120
  }
121
- async function requestPageContext(documentId, attachmentIds, allowNonceRetry) {
121
+ async function requestPageContext(documentId, imageSizeRequests, allowNonceRetry) {
122
122
  const { restNamespace, nonce } = getWindowConfig();
123
123
  const url = `${restNamespace}/audits/page-context`;
124
124
  try {
125
125
  const response = await (0, import_http_client.httpService)().get(url, {
126
126
  params: {
127
127
  document_id: documentId,
128
- attachment_ids: attachmentIds
128
+ image_size_requests: imageSizeRequests
129
129
  },
130
130
  headers: { "X-WP-Nonce": nonce }
131
131
  });
@@ -135,14 +135,14 @@ async function requestPageContext(documentId, attachmentIds, allowNonceRetry) {
135
135
  throw error;
136
136
  }
137
137
  await refreshAuditsNonce();
138
- return requestPageContext(documentId, attachmentIds, false);
138
+ return requestPageContext(documentId, imageSizeRequests, false);
139
139
  }
140
140
  }
141
141
 
142
142
  // src/registry.ts
143
143
  var registry = /* @__PURE__ */ new Map();
144
- function registerAudit(audit23) {
145
- registry.set(audit23.id, audit23);
144
+ function registerAudit(audit26) {
145
+ registry.set(audit26.id, audit26);
146
146
  }
147
147
  function getRegisteredAudits() {
148
148
  return Array.from(registry.values());
@@ -179,8 +179,8 @@ var CATEGORY_LABELS = {
179
179
  var import_i18n2 = require("@wordpress/i18n");
180
180
 
181
181
  // src/utils/is-scored-audit.ts
182
- function isScoredAudit(audit23) {
183
- return audit23.weight > 0;
182
+ function isScoredAudit(audit26) {
183
+ return audit26.weight > 0;
184
184
  }
185
185
 
186
186
  // src/utils/sort-failed-audits.ts
@@ -236,8 +236,8 @@ function auditStatusDisplayCounts(report) {
236
236
  let pass = 0;
237
237
  let skipped = 0;
238
238
  let totalViolations = 0;
239
- for (const { audit: audit23, result } of report.auditResults) {
240
- if (!isScoredAudit(audit23)) {
239
+ for (const { audit: audit26, result } of report.auditResults) {
240
+ if (!isScoredAudit(audit26)) {
241
241
  continue;
242
242
  }
243
243
  switch (result.status) {
@@ -287,16 +287,16 @@ function computeReport(documentId, results) {
287
287
  const accumulators = Object.fromEntries(
288
288
  ALL_CATEGORIES.map((c) => [c, { totalWeight: 0, passedWeight: 0, total: 0, failed: 0 }])
289
289
  );
290
- for (const { audit: audit23, result } of results) {
290
+ for (const { audit: audit26, result } of results) {
291
291
  if (result.status === "skipped") {
292
292
  continue;
293
293
  }
294
- for (const category of audit23.categories) {
294
+ for (const category of audit26.categories) {
295
295
  const acc = accumulators[category];
296
296
  acc.total++;
297
- acc.totalWeight += audit23.weight;
297
+ acc.totalWeight += audit26.weight;
298
298
  if (result.status === "pass") {
299
- acc.passedWeight += audit23.weight;
299
+ acc.passedWeight += audit26.weight;
300
300
  } else {
301
301
  acc.failed++;
302
302
  }
@@ -320,6 +320,34 @@ function computeReport(documentId, results) {
320
320
  };
321
321
  }
322
322
 
323
+ // src/utils/fetch-rendered-html.ts
324
+ var FETCH_TIMEOUT_MS = 1e4;
325
+ async function fetchRenderedHtml(url) {
326
+ if (!url) {
327
+ return null;
328
+ }
329
+ const timeoutController = new AbortController();
330
+ const timeoutId = setTimeout(() => timeoutController.abort(), FETCH_TIMEOUT_MS);
331
+ try {
332
+ const response = await fetch(url, { credentials: "omit", signal: timeoutController.signal });
333
+ if (!response.ok) {
334
+ return null;
335
+ }
336
+ return await response.text();
337
+ } catch {
338
+ return null;
339
+ } finally {
340
+ clearTimeout(timeoutId);
341
+ }
342
+ }
343
+
344
+ // src/utils/atomic-background-image-sources.ts
345
+ var import_editor_elements = require("@elementor/editor-elements");
346
+ var import_editor_props2 = require("@elementor/editor-props");
347
+
348
+ // src/utils/atomic-image-sources.ts
349
+ var import_editor_props = require("@elementor/editor-props");
350
+
323
351
  // src/utils/walk.ts
324
352
  function walkElements(tree, visit) {
325
353
  const parents = [];
@@ -334,6 +362,89 @@ function recurse(nodes, parents, visit) {
334
362
  }
335
363
  }
336
364
 
365
+ // src/utils/atomic-image-sources.ts
366
+ var ATOMIC_IMAGE_PROP_KEYS = ["image", "poster"];
367
+ function walkAtomicImageSources(tree, visit) {
368
+ walkElements(tree, (node) => {
369
+ if (node.elType !== "widget") {
370
+ return;
371
+ }
372
+ for (const key of ATOMIC_IMAGE_PROP_KEYS) {
373
+ const media = extractAtomicImageMedia(node.settings[key]);
374
+ if (media) {
375
+ visit({ node, media });
376
+ }
377
+ }
378
+ });
379
+ }
380
+ function extractAtomicImageMedia(imageProp) {
381
+ const image = import_editor_props.imagePropTypeUtil.extract(imageProp);
382
+ if (!image) {
383
+ return null;
384
+ }
385
+ const src = import_editor_props.imageSrcPropTypeUtil.extract(image.src);
386
+ if (!src) {
387
+ return null;
388
+ }
389
+ const id = import_editor_props.imageAttachmentIdPropType.extract(src.id) ?? void 0;
390
+ const url = import_editor_props.urlPropTypeUtil.extract(src.url) ?? void 0;
391
+ if (!id && !url) {
392
+ return null;
393
+ }
394
+ const size = import_editor_props.stringPropTypeUtil.extract(image.size) ?? void 0;
395
+ return { id, url, size };
396
+ }
397
+
398
+ // src/utils/atomic-background-image-sources.ts
399
+ function walkAtomicBackgroundImageSources(tree, visit) {
400
+ walkElements(tree, (node) => {
401
+ const styles = (0, import_editor_elements.getElementStyles)(node.id);
402
+ if (!styles) {
403
+ return;
404
+ }
405
+ for (const media of extractBackgroundImageMedia(styles)) {
406
+ visit({ node, media });
407
+ }
408
+ });
409
+ }
410
+ function extractBackgroundImageMedia(styles) {
411
+ const sources = [];
412
+ for (const style of Object.values(styles)) {
413
+ for (const variant of style.variants) {
414
+ const background = import_editor_props2.backgroundPropTypeUtil.extract(variant.props.background);
415
+ const overlays = import_editor_props2.backgroundOverlayPropTypeUtil.extract(background?.["background-overlay"]) ?? [];
416
+ for (const overlay of overlays) {
417
+ const imageOverlay = import_editor_props2.backgroundImageOverlayPropTypeUtil.extract(overlay);
418
+ const media = extractAtomicImageMedia(imageOverlay?.image);
419
+ if (media) {
420
+ sources.push(media);
421
+ }
422
+ }
423
+ }
424
+ }
425
+ return sources;
426
+ }
427
+
428
+ // src/utils/background-image-sources.ts
429
+ var BACKGROUND_IMAGE_SETTING_KEYS = [
430
+ "background_image",
431
+ "background_hover_image",
432
+ "background_overlay_image",
433
+ "background_overlay_hover_image",
434
+ "_background_image",
435
+ "_background_hover_image"
436
+ ];
437
+ function walkBackgroundImageSources(tree, visit) {
438
+ walkElements(tree, (node) => {
439
+ for (const key of BACKGROUND_IMAGE_SETTING_KEYS) {
440
+ const media = node.settings[key];
441
+ if (media?.id || media?.url) {
442
+ visit({ node, media });
443
+ }
444
+ }
445
+ });
446
+ }
447
+
337
448
  // src/utils/image-like-sources.ts
338
449
  var IMAGE_LIKE_WIDGETS = /* @__PURE__ */ new Set(["image", "image-box", "image-carousel", "gallery", "image-gallery"]);
339
450
  function hasPageImages(tree) {
@@ -362,28 +473,38 @@ function collectMediaFromNode(node) {
362
473
  const sources = [];
363
474
  const image = node.settings.image;
364
475
  if (image?.id || image?.url) {
365
- sources.push(image);
476
+ sources.push({ ...image, size: node.settings.image_size });
366
477
  }
367
478
  const gallery = node.settings.carousel ?? node.settings.gallery ?? node.settings.wp_gallery;
368
479
  if (Array.isArray(gallery)) {
480
+ const gallerySize = node.settings.thumbnail_size;
369
481
  for (const item of gallery) {
370
482
  if (item?.id || item?.url) {
371
- sources.push(item);
483
+ sources.push({ ...item, size: gallerySize });
372
484
  }
373
485
  }
374
486
  }
375
487
  return sources;
376
488
  }
377
489
 
490
+ // src/utils/image-size-key.ts
491
+ function buildImageSizeKey({ id, size }) {
492
+ return `${id}:${size || "full"}`;
493
+ }
494
+
378
495
  // src/utils/page-attachments.ts
379
- function extractAttachmentIds(tree) {
380
- const ids = /* @__PURE__ */ new Set();
381
- walkImageLikeSources(tree, ({ media }) => {
496
+ function extractImageSizeRequests(tree) {
497
+ const keys = /* @__PURE__ */ new Set();
498
+ const collect = (media) => {
382
499
  if (media.id) {
383
- ids.add(media.id);
500
+ keys.add(buildImageSizeKey({ id: media.id, size: media.size }));
384
501
  }
385
- });
386
- return Array.from(ids).sort((a, b) => a - b);
502
+ };
503
+ walkImageLikeSources(tree, ({ media }) => collect(media));
504
+ walkBackgroundImageSources(tree, ({ media }) => collect(media));
505
+ walkAtomicImageSources(tree, ({ media }) => collect(media));
506
+ walkAtomicBackgroundImageSources(tree, ({ media }) => collect(media));
507
+ return Array.from(keys).sort();
387
508
  }
388
509
 
389
510
  // src/utils/read-kit-snapshot.ts
@@ -477,18 +598,21 @@ function toSnapshot(element) {
477
598
 
478
599
  // src/runner.ts
479
600
  async function runPageAudit(documentId) {
480
- const tree = buildSnapshotTree((0, import_editor_elements.getElements)());
481
- const attachmentIds = extractAttachmentIds(tree);
482
- const pageContext = await fetchPageContext(documentId, attachmentIds);
601
+ const tree = buildSnapshotTree((0, import_editor_elements2.getElements)());
602
+ const imageSizeRequests = extractImageSizeRequests(tree);
603
+ const pageContext = await fetchPageContext(documentId, imageSizeRequests);
483
604
  const elements = { documentId, tree };
484
- const kit = await readKitSnapshot(pageContext.kit_id);
485
- const ctx = { documentId, elements, pageContext, kit };
605
+ const [kit, renderedHtml] = await Promise.all([
606
+ readKitSnapshot(pageContext.kit_id),
607
+ fetchRenderedHtml(pageContext.frontend_url)
608
+ ]);
609
+ const ctx = { documentId, elements, pageContext, kit, renderedHtml };
486
610
  const registered = getRegisteredAudits();
487
611
  const auditResults = await Promise.all(
488
- registered.map(async (audit23) => {
489
- const { evaluate: _evaluate, ...meta } = audit23;
612
+ registered.map(async (audit26) => {
613
+ const { evaluate: _evaluate, ...meta } = audit26;
490
614
  try {
491
- const result = await audit23.evaluate(ctx);
615
+ const result = await audit26.evaluate(ctx);
492
616
  return { audit: meta, result };
493
617
  } catch (error) {
494
618
  const reason = error instanceof Error ? error.message : "unknown-error";
@@ -563,7 +687,7 @@ function useAuditReport() {
563
687
  const report = (0, import_store2.__useSelector)((state) => selectReport(state));
564
688
  const error = (0, import_store2.__useSelector)((state) => selectError(state));
565
689
  const dispatch = (0, import_store2.__useDispatch)();
566
- const documentId = (0, import_editor_elements2.getCurrentDocumentId)() ?? 0;
690
+ const documentId = (0, import_editor_elements3.getCurrentDocumentId)() ?? 0;
567
691
  (0, import_react.useEffect)(() => {
568
692
  if (!documentId || report?.documentId === documentId) {
569
693
  return;
@@ -820,20 +944,20 @@ function SubpageHeader({ title, onBack, backLabel, icon }) {
820
944
  // src/components/violation-row.tsx
821
945
  var React11 = __toESM(require("react"));
822
946
  var import_react4 = require("react");
823
- var import_editor_elements4 = require("@elementor/editor-elements");
947
+ var import_editor_elements5 = require("@elementor/editor-elements");
824
948
  var import_icons7 = require("@elementor/icons");
825
949
  var import_ui10 = require("@elementor/ui");
826
950
  var import_i18n11 = require("@wordpress/i18n");
827
951
 
828
952
  // src/hooks/focus-violation.ts
829
- var import_editor_elements3 = require("@elementor/editor-elements");
953
+ var import_editor_elements4 = require("@elementor/editor-elements");
830
954
  var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
831
955
  var SCROLL_TO_VIEW_DELAY_MS = 200;
832
956
  function focusViolation(violation) {
833
957
  if (violation.elementId) {
834
- const container = (0, import_editor_elements3.getContainer)(violation.elementId);
958
+ const container = (0, import_editor_elements4.getContainer)(violation.elementId);
835
959
  if (container) {
836
- (0, import_editor_elements3.selectElement)(violation.elementId);
960
+ (0, import_editor_elements4.selectElement)(violation.elementId);
837
961
  const domElement = container.view?.getDomElement?.();
838
962
  if (domElement) {
839
963
  window.elementor?.helpers?.scrollToView?.(domElement, SCROLL_TO_VIEW_DELAY_MS);
@@ -938,13 +1062,13 @@ function SeverityIcon({ severity }) {
938
1062
  // src/components/violation-cta-button.tsx
939
1063
  var React9 = __toESM(require("react"));
940
1064
  var import_ui8 = require("@elementor/ui");
941
- function ViolationCtaButton({ ctaLabel, externalUrl }) {
1065
+ function ViolationCtaButton({ ctaLabel, externalUrl, variant = "outlined" }) {
942
1066
  const handleClick = (event) => {
943
1067
  event.stopPropagation();
944
1068
  event.preventDefault();
945
1069
  window.open(externalUrl, "_blank", "noopener");
946
1070
  };
947
- return /* @__PURE__ */ React9.createElement(import_ui8.Button, { variant: "outlined", color: "secondary", size: "small", onClick: handleClick }, ctaLabel);
1071
+ return /* @__PURE__ */ React9.createElement(import_ui8.Button, { variant, color: "secondary", size: "small", onClick: handleClick }, ctaLabel);
948
1072
  }
949
1073
 
950
1074
  // src/components/violation-icons.tsx
@@ -976,13 +1100,13 @@ function ViolationIcon({ violation, widgetIcon }) {
976
1100
  function SkipReasonTooltip({ reason }) {
977
1101
  return /* @__PURE__ */ React11.createElement(import_ui10.Tooltip, { title: reason, placement: "top" }, /* @__PURE__ */ React11.createElement(import_ui10.Box, { "aria-label": reason, component: "span", sx: { display: "inline-flex", alignItems: "center" } }, /* @__PURE__ */ React11.createElement(import_icons7.HelpIcon, { fontSize: "small", color: "action" })));
978
1102
  }
979
- function StatusIndicator({ audit: audit23, violations }) {
1103
+ function StatusIndicator({ audit: audit26, violations }) {
980
1104
  if (violations) {
981
- return /* @__PURE__ */ React11.createElement(React11.Fragment, null, isScoredAudit(audit23) && /* @__PURE__ */ React11.createElement(import_ui10.Typography, { variant: "caption", color: "text.secondary", fontWeight: "bold" }, violations.length), /* @__PURE__ */ React11.createElement(SeverityIcon, { severity: audit23.severity }));
1105
+ return /* @__PURE__ */ React11.createElement(React11.Fragment, null, isScoredAudit(audit26) && /* @__PURE__ */ React11.createElement(import_ui10.Typography, { variant: "caption", color: "text.secondary", fontWeight: "bold" }, violations.length), /* @__PURE__ */ React11.createElement(SeverityIcon, { severity: audit26.severity }));
982
1106
  }
983
1107
  return /* @__PURE__ */ React11.createElement(import_icons7.CheckIcon, { fontSize: "small", color: "success" });
984
1108
  }
985
- function ViolationRow({ audit: audit23, skipReason, violations }) {
1109
+ function ViolationRow({ audit: audit26, skipReason, violations }) {
986
1110
  const [expanded, setExpanded] = (0, import_react4.useState)(false);
987
1111
  const toggleExpanded = () => setExpanded((value) => !value);
988
1112
  return /* @__PURE__ */ React11.createElement(import_ui10.Box, { sx: { borderBottom: 1, borderColor: "divider", paddingBlock: 0.5 } }, /* @__PURE__ */ React11.createElement(import_ui10.Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React11.createElement(
@@ -998,8 +1122,8 @@ function ViolationRow({ audit: audit23, skipReason, violations }) {
998
1122
  },
999
1123
  onClick: toggleExpanded
1000
1124
  },
1001
- /* @__PURE__ */ React11.createElement(import_ui10.Typography, { variant: "body2", sx: { flex: 1 } }, audit23.title),
1002
- !skipReason && /* @__PURE__ */ React11.createElement(StatusIndicator, { audit: audit23, violations })
1125
+ /* @__PURE__ */ React11.createElement(import_ui10.Typography, { variant: "body2", sx: { flex: 1 } }, audit26.title),
1126
+ !skipReason && /* @__PURE__ */ React11.createElement(StatusIndicator, { audit: audit26, violations })
1003
1127
  ), skipReason && /* @__PURE__ */ React11.createElement(SkipReasonTooltip, { reason: skipReason }), /* @__PURE__ */ React11.createElement(
1004
1128
  import_ui10.IconButton,
1005
1129
  {
@@ -1025,7 +1149,7 @@ function ViolationRow({ audit: audit23, skipReason, violations }) {
1025
1149
  icon: /* @__PURE__ */ React11.createElement(import_icons7.AlertCircleIcon, { fontSize: "small", color: "secondary", "aria-hidden": true })
1026
1150
  },
1027
1151
  /* @__PURE__ */ React11.createElement(import_ui10.AlertTitle, null, /* @__PURE__ */ React11.createElement(import_ui10.Typography, { variant: "caption", component: "p", color: "text.primary", fontWeight: "bold" }, (0, import_i18n11.__)("What's the issue", "elementor"))),
1028
- /* @__PURE__ */ React11.createElement(import_ui10.Typography, { variant: "caption", component: "p", color: "text.secondary" }, audit23.description)
1152
+ /* @__PURE__ */ React11.createElement(import_ui10.Typography, { variant: "caption", component: "p", color: "text.secondary" }, audit26.description)
1029
1153
  ), /* @__PURE__ */ React11.createElement(
1030
1154
  import_ui10.Alert,
1031
1155
  {
@@ -1034,10 +1158,10 @@ function ViolationRow({ audit: audit23, skipReason, violations }) {
1034
1158
  icon: /* @__PURE__ */ React11.createElement(import_icons7.BulbIcon, { fontSize: "small", color: "info", "aria-hidden": true })
1035
1159
  },
1036
1160
  /* @__PURE__ */ React11.createElement(import_ui10.AlertTitle, null, /* @__PURE__ */ React11.createElement(import_ui10.Typography, { variant: "caption", component: "p", color: "text.primary", fontWeight: "bold" }, (0, import_i18n11.__)("How to resolve", "elementor"))),
1037
- /* @__PURE__ */ React11.createElement(import_ui10.Typography, { variant: "caption", component: "p", color: "text.secondary" }, audit23.fixHint)
1161
+ /* @__PURE__ */ React11.createElement(import_ui10.Typography, { variant: "caption", component: "p", color: "text.secondary" }, audit26.fixHint)
1038
1162
  )), violations && violations.length > 0 && /* @__PURE__ */ React11.createElement(import_ui10.Box, { role: "list", sx: { paddingBlockEnd: 1, paddingInlineStart: 2 } }, violations.map((violation, idx) => {
1039
- const widgetIcon = violation.elementId ? (0, import_editor_elements4.getElementIcon)(violation.elementId) : null;
1040
- const elementTitle = violation.elementId ? (0, import_editor_elements4.getElementTitle)(violation.elementId) : null;
1163
+ const widgetIcon = violation.elementId ? (0, import_editor_elements5.getElementIcon)(violation.elementId) : null;
1164
+ const elementTitle = violation.elementId ? (0, import_editor_elements5.getElementTitle)(violation.elementId) : null;
1041
1165
  const rowLabel = elementTitle ? `${elementTitle} - ${violation.label}` : violation.label;
1042
1166
  return /* @__PURE__ */ React11.createElement(
1043
1167
  import_ui10.Box,
@@ -1064,14 +1188,26 @@ function ViolationRow({ audit: audit23, skipReason, violations }) {
1064
1188
  },
1065
1189
  /* @__PURE__ */ React11.createElement(ViolationIcon, { violation, widgetIcon }),
1066
1190
  /* @__PURE__ */ React11.createElement(import_ui10.Box, { sx: { flex: 1 } }, /* @__PURE__ */ React11.createElement(import_ui10.Typography, { variant: "caption" }, rowLabel), violation.detail && /* @__PURE__ */ React11.createElement(import_ui10.Typography, { variant: "caption", color: "text.secondary" }, violation.detail)),
1067
- violation.angieFix && /* @__PURE__ */ React11.createElement(FixViolationWithAngie, { prompt: buildAngiePrompt(rowLabel) }),
1068
- violation.ctaLabel && violation.externalUrl ? /* @__PURE__ */ React11.createElement(
1191
+ violation.angieFix && /* @__PURE__ */ React11.createElement(
1192
+ FixViolationWithAngie,
1193
+ {
1194
+ prompt: violation.angiePrompt ?? buildAngiePrompt(rowLabel)
1195
+ }
1196
+ ),
1197
+ violation.ctaLabel && violation.externalUrl ? /* @__PURE__ */ React11.createElement(import_ui10.Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React11.createElement(
1069
1198
  ViolationCtaButton,
1070
1199
  {
1071
1200
  ctaLabel: violation.ctaLabel,
1072
1201
  externalUrl: violation.externalUrl
1073
1202
  }
1074
- ) : /* @__PURE__ */ React11.createElement(
1203
+ ), violation.secondaryCtaLabel && violation.secondaryCtaUrl && /* @__PURE__ */ React11.createElement(
1204
+ ViolationCtaButton,
1205
+ {
1206
+ ctaLabel: violation.secondaryCtaLabel,
1207
+ externalUrl: violation.secondaryCtaUrl,
1208
+ variant: "text"
1209
+ }
1210
+ )) : /* @__PURE__ */ React11.createElement(
1075
1211
  import_icons7.EyeIcon,
1076
1212
  {
1077
1213
  className: "violation-hover-icon",
@@ -1169,17 +1305,17 @@ var import_i18n14 = require("@wordpress/i18n");
1169
1305
  var ALL_SEVERITIES = ["error", "warning", "info"];
1170
1306
  function countSeverities(report, category) {
1171
1307
  const counts = { error: 0, warning: 0, info: 0 };
1172
- for (const { audit: audit23, result } of report.auditResults) {
1308
+ for (const { audit: audit26, result } of report.auditResults) {
1173
1309
  if (result.status !== "fail") {
1174
1310
  continue;
1175
1311
  }
1176
- if (category && !audit23.categories.includes(category)) {
1312
+ if (category && !audit26.categories.includes(category)) {
1177
1313
  continue;
1178
1314
  }
1179
- if (!isScoredAudit(audit23)) {
1315
+ if (!isScoredAudit(audit26)) {
1180
1316
  continue;
1181
1317
  }
1182
- counts[audit23.severity] += result.violations.length;
1318
+ counts[audit26.severity] += result.violations.length;
1183
1319
  }
1184
1320
  return counts;
1185
1321
  }
@@ -1482,6 +1618,26 @@ var PROMOTIONS = [
1482
1618
  );
1483
1619
  },
1484
1620
  getCtaUrl: firstFailExternalUrl
1621
+ },
1622
+ {
1623
+ auditId: "audits/images-inefficient-format",
1624
+ icon: import_icons10.ShieldHalfFilledIcon,
1625
+ ctaLabel: (0, import_i18n19.__)("Optimize all", "elementor"),
1626
+ formatSubtitle: (run) => {
1627
+ if (run.result.status !== "fail") {
1628
+ return null;
1629
+ }
1630
+ const count = run.result.metadata?.inefficientImageFormatCount ?? 0;
1631
+ if (count === 0) {
1632
+ return null;
1633
+ }
1634
+ return (0, import_i18n19.sprintf)(
1635
+ /* translators: %d: number of images served in an inefficient format. */
1636
+ (0, import_i18n19._n)("%d image", "%d images", count, "elementor"),
1637
+ count
1638
+ );
1639
+ },
1640
+ getCtaUrl: firstFailExternalUrl
1485
1641
  }
1486
1642
  ];
1487
1643
 
@@ -1763,7 +1919,7 @@ function ReportShell({ report }) {
1763
1919
  // src/components/audit-panel.tsx
1764
1920
  function AuditPanel() {
1765
1921
  const { status, report, error, run } = useAuditReport();
1766
- const currentDocumentId = (0, import_editor_elements5.getCurrentDocumentId)() ?? 0;
1922
+ const currentDocumentId = (0, import_editor_elements6.getCurrentDocumentId)() ?? 0;
1767
1923
  const onRun = () => run(currentDocumentId);
1768
1924
  const lastScanLabel = report ? new Date(report.runAt).toLocaleTimeString() : null;
1769
1925
  return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(
@@ -1863,16 +2019,93 @@ var audit = {
1863
2019
  }
1864
2020
  };
1865
2021
 
1866
- // src/audits/cookie-policy.ts
2022
+ // src/audits/accessibility-statement.ts
1867
2023
  var import_i18n26 = require("@wordpress/i18n");
1868
2024
  var audit2 = {
1869
- id: "audits/cookie-policy",
1870
- title: (0, import_i18n26.__)("Cookie policy", "elementor"),
2025
+ id: "audits/accessibility-statement",
2026
+ title: (0, import_i18n26.__)("Create an accessibility statement", "elementor"),
1871
2027
  description: (0, import_i18n26.__)(
2028
+ "An accessibility statement showcases your efforts to create an inclusive online space, highlighting helpful features and a commitment to accessibility.",
2029
+ "elementor"
2030
+ ),
2031
+ fixHint: (0, import_i18n26.__)("Use Ally to create and publish an accessibility statement for your site.", "elementor"),
2032
+ categories: ["accessibility"],
2033
+ severity: "info",
2034
+ weight: 1,
2035
+ evaluate: (ctx) => {
2036
+ const isReady = ctx.pageContext.ally_plugin_active;
2037
+ if (isReady && ctx.pageContext.ally_accessibility_statement_created) {
2038
+ return { status: "pass" };
2039
+ }
2040
+ return {
2041
+ status: "fail",
2042
+ violations: [
2043
+ {
2044
+ auditId: audit2.id,
2045
+ label: (0, import_i18n26.__)("No accessibility statement has been created for this site.", "elementor"),
2046
+ externalUrl: isReady ? ctx.pageContext.ally_accessibility_statement_url : ctx.pageContext.ally_plugin_url,
2047
+ ctaLabel: isReady ? (0, import_i18n26.__)("Create", "elementor") : void 0,
2048
+ secondaryCtaLabel: (0, import_i18n26.__)("Learn more", "elementor"),
2049
+ secondaryCtaUrl: "https://go.elementor.com/acc-plg-learn-more"
2050
+ }
2051
+ ]
2052
+ };
2053
+ }
2054
+ };
2055
+
2056
+ // src/audits/accessibility-widget.ts
2057
+ var import_i18n27 = require("@wordpress/i18n");
2058
+
2059
+ // src/utils/scan-accessibility-widgets.ts
2060
+ var ACCESSIBILITY_WIDGET_SCRIPT_SOURCES = ["cdn.elementor.com/a11y/widget.js"];
2061
+ function hasAccessibilityWidgetScript(html) {
2062
+ return ACCESSIBILITY_WIDGET_SCRIPT_SOURCES.some((src) => html.includes(src));
2063
+ }
2064
+
2065
+ // src/audits/accessibility-widget.ts
2066
+ var audit3 = {
2067
+ id: "audits/accessibility-widget",
2068
+ title: (0, import_i18n27.__)("Add an accessibility widget", "elementor"),
2069
+ description: (0, import_i18n27.__)("Make your site more inclusive by adding an accessibility widget.", "elementor"),
2070
+ fixHint: (0, import_i18n27.__)("Activate Ally\u2019s accessibility widget to give visitors on-page accessibility tools.", "elementor"),
2071
+ categories: ["accessibility"],
2072
+ severity: "info",
2073
+ weight: 1,
2074
+ evaluate: (ctx) => {
2075
+ if (!ctx.pageContext.frontend_url) {
2076
+ return { status: "skipped", reason: (0, import_i18n27.__)("Page is not published.", "elementor") };
2077
+ }
2078
+ if (!ctx.renderedHtml) {
2079
+ return { status: "skipped", reason: (0, import_i18n27.__)("Could not fetch the published page.", "elementor") };
2080
+ }
2081
+ if (hasAccessibilityWidgetScript(ctx.renderedHtml)) {
2082
+ return { status: "pass" };
2083
+ }
2084
+ const isReady = ctx.pageContext.ally_plugin_active;
2085
+ return {
2086
+ status: "fail",
2087
+ violations: [
2088
+ {
2089
+ auditId: audit3.id,
2090
+ label: (0, import_i18n27.__)("No accessibility widget is active on this site.", "elementor"),
2091
+ externalUrl: isReady ? ctx.pageContext.ally_widget_settings_url : ctx.pageContext.ally_plugin_url,
2092
+ ctaLabel: (0, import_i18n27.__)("Activate", "elementor")
2093
+ }
2094
+ ]
2095
+ };
2096
+ }
2097
+ };
2098
+
2099
+ // src/audits/cookie-policy.ts
2100
+ var import_i18n28 = require("@wordpress/i18n");
2101
+ var audit4 = {
2102
+ id: "audits/cookie-policy",
2103
+ title: (0, import_i18n28.__)("Cookie policy", "elementor"),
2104
+ description: (0, import_i18n28.__)(
1872
2105
  "A cookie policy is required by privacy regulations such as GDPR (EU) or CCPA (US) to inform visitors about tracking and data collection.",
1873
2106
  "elementor"
1874
2107
  ),
1875
- fixHint: (0, import_i18n26.__)("Install the Cookiez plugin to add a cookie policy to your website.", "elementor"),
2108
+ fixHint: (0, import_i18n28.__)("Install the Cookiez plugin to add a cookie policy to your website.", "elementor"),
1876
2109
  categories: ["compliance"],
1877
2110
  severity: "info",
1878
2111
  weight: 1,
@@ -1884,8 +2117,8 @@ var audit2 = {
1884
2117
  status: "fail",
1885
2118
  violations: [
1886
2119
  {
1887
- auditId: audit2.id,
1888
- label: (0, import_i18n26.__)("Cookiez plugin is not installed or active.", "elementor"),
2120
+ auditId: audit4.id,
2121
+ label: (0, import_i18n28.__)("Cookiez plugin is not installed or active.", "elementor"),
1889
2122
  externalUrl: ctx.pageContext.cookiez_plugin_url
1890
2123
  }
1891
2124
  ]
@@ -1894,8 +2127,8 @@ var audit2 = {
1894
2127
  };
1895
2128
 
1896
2129
  // src/audits/deep-nesting.ts
1897
- var import_editor_elements6 = require("@elementor/editor-elements");
1898
- var import_i18n27 = require("@wordpress/i18n");
2130
+ var import_editor_elements7 = require("@elementor/editor-elements");
2131
+ var import_i18n29 = require("@wordpress/i18n");
1899
2132
  var MAX_NESTING_DEPTH = 6;
1900
2133
  function isNestingElement(node, widgetsCache) {
1901
2134
  if (node.elType === "container") {
@@ -1903,22 +2136,22 @@ function isNestingElement(node, widgetsCache) {
1903
2136
  }
1904
2137
  return !!widgetsCache?.[node.elType]?.meta?.is_container;
1905
2138
  }
1906
- var audit3 = {
2139
+ var audit5 = {
1907
2140
  id: "audits/deep-nesting",
1908
- title: (0, import_i18n27.__)("Deep container nesting", "elementor"),
1909
- description: (0, import_i18n27.__)(
2141
+ title: (0, import_i18n29.__)("Deep container nesting", "elementor"),
2142
+ description: (0, import_i18n29.__)(
1910
2143
  "Container nesting exceeds the recommended depth. Deep DOM trees hurt rendering performance and readability.",
1911
2144
  "elementor"
1912
2145
  ),
1913
- fixHint: (0, import_i18n27.__)("Flatten the layout by removing unnecessary wrapper containers.", "elementor"),
2146
+ fixHint: (0, import_i18n29.__)("Flatten the layout by removing unnecessary wrapper containers.", "elementor"),
1914
2147
  categories: ["performance", "best-practices"],
1915
2148
  severity: "warning",
1916
2149
  weight: 5,
1917
2150
  evaluate: (ctx) => {
1918
2151
  if (ctx.elements.tree.length === 0) {
1919
- return { status: "skipped", reason: (0, import_i18n27.__)("No elements", "elementor") };
2152
+ return { status: "skipped", reason: (0, import_i18n29.__)("No elements", "elementor") };
1920
2153
  }
1921
- const widgetsCache = (0, import_editor_elements6.getWidgetsCache)();
2154
+ const widgetsCache = (0, import_editor_elements7.getWidgetsCache)();
1922
2155
  const violations = [];
1923
2156
  walkElements(ctx.elements.tree, (node, parents) => {
1924
2157
  if (!isNestingElement(node, widgetsCache)) {
@@ -1927,10 +2160,10 @@ var audit3 = {
1927
2160
  const depth = parents.filter((parent) => isNestingElement(parent, widgetsCache)).length + 1;
1928
2161
  if (depth > MAX_NESTING_DEPTH) {
1929
2162
  violations.push({
1930
- auditId: audit3.id,
2163
+ auditId: audit5.id,
1931
2164
  elementId: node.id,
1932
2165
  targetHint: "element-settings",
1933
- label: (0, import_i18n27.__)("Container nesting is too deep.", "elementor")
2166
+ label: (0, import_i18n29.__)("Container nesting is too deep.", "elementor")
1934
2167
  });
1935
2168
  }
1936
2169
  });
@@ -1939,15 +2172,15 @@ var audit3 = {
1939
2172
  };
1940
2173
 
1941
2174
  // src/audits/default-design-system.ts
1942
- var import_i18n28 = require("@wordpress/i18n");
1943
- var audit4 = {
2175
+ var import_i18n30 = require("@wordpress/i18n");
2176
+ var audit6 = {
1944
2177
  id: "audits/default-design-system",
1945
- title: (0, import_i18n28.__)("Default website kit", "elementor"),
1946
- description: (0, import_i18n28.__)(
2178
+ title: (0, import_i18n30.__)("Default website kit", "elementor"),
2179
+ description: (0, import_i18n30.__)(
1947
2180
  "Your website is using the default design system colors and fonts. Custom branding makes the website feel uniquely yours.",
1948
2181
  "elementor"
1949
2182
  ),
1950
- fixHint: (0, import_i18n28.__)("Open Site Settings and customize your kit (colors, fonts, layout).", "elementor"),
2183
+ fixHint: (0, import_i18n30.__)("Open Site Settings and customize your kit (colors, fonts, layout).", "elementor"),
1951
2184
  categories: ["best-practices"],
1952
2185
  severity: "info",
1953
2186
  weight: 1,
@@ -1959,8 +2192,8 @@ var audit4 = {
1959
2192
  status: "fail",
1960
2193
  violations: [
1961
2194
  {
1962
- auditId: audit4.id,
1963
- label: (0, import_i18n28.__)("Kit appears unchanged from default.", "elementor"),
2195
+ auditId: audit6.id,
2196
+ label: (0, import_i18n30.__)("Kit appears unchanged from default.", "elementor"),
1964
2197
  targetHint: "site-settings"
1965
2198
  }
1966
2199
  ]
@@ -1969,22 +2202,22 @@ var audit4 = {
1969
2202
  };
1970
2203
 
1971
2204
  // src/audits/deprecated-widgets.ts
1972
- var import_editor_elements7 = require("@elementor/editor-elements");
1973
- var import_i18n29 = require("@wordpress/i18n");
2205
+ var import_editor_elements8 = require("@elementor/editor-elements");
2206
+ var import_i18n31 = require("@wordpress/i18n");
1974
2207
  var DEPRECATION_CONTROL_NAME = "deprecation_message";
1975
- var audit5 = {
2208
+ var audit7 = {
1976
2209
  id: "audits/deprecated-widgets",
1977
- title: (0, import_i18n29.__)("Deprecated widgets", "elementor"),
1978
- description: (0, import_i18n29.__)(
2210
+ title: (0, import_i18n31.__)("Deprecated widgets", "elementor"),
2211
+ description: (0, import_i18n31.__)(
1979
2212
  "Deprecated widgets should not be used. For better capabilities use the recommended replacement.",
1980
2213
  "elementor"
1981
2214
  ),
1982
- fixHint: (0, import_i18n29.__)("Replace each deprecated widget with the recommended new widget shown in its panel.", "elementor"),
2215
+ fixHint: (0, import_i18n31.__)("Replace each deprecated widget with the recommended new widget shown in its panel.", "elementor"),
1983
2216
  categories: ["best-practices", "performance"],
1984
2217
  severity: "warning",
1985
2218
  weight: 7,
1986
2219
  evaluate: (ctx) => {
1987
- const widgetsCache = (0, import_editor_elements7.getWidgetsCache)();
2220
+ const widgetsCache = (0, import_editor_elements8.getWidgetsCache)();
1988
2221
  if (!widgetsCache) {
1989
2222
  return { status: "skipped", reason: "widgets-cache-unavailable" };
1990
2223
  }
@@ -2003,10 +2236,10 @@ var audit5 = {
2003
2236
  return;
2004
2237
  }
2005
2238
  violations.push({
2006
- auditId: audit5.id,
2239
+ auditId: audit7.id,
2007
2240
  elementId: node.id,
2008
2241
  targetHint: "element-settings",
2009
- label: (0, import_i18n29.__)("Using deprecated widget.", "elementor")
2242
+ label: (0, import_i18n31.__)("Using deprecated widget.", "elementor")
2010
2243
  });
2011
2244
  });
2012
2245
  return violations.length === 0 ? { status: "pass" } : { status: "fail", violations };
@@ -2014,28 +2247,7 @@ var audit5 = {
2014
2247
  };
2015
2248
 
2016
2249
  // src/audits/google-consent-mode.ts
2017
- var import_i18n30 = require("@wordpress/i18n");
2018
-
2019
- // src/utils/fetch-rendered-html.ts
2020
- var FETCH_TIMEOUT_MS = 1e4;
2021
- async function fetchRenderedHtml(url) {
2022
- if (!url) {
2023
- return null;
2024
- }
2025
- const timeoutController = new AbortController();
2026
- const timeoutId = setTimeout(() => timeoutController.abort(), FETCH_TIMEOUT_MS);
2027
- try {
2028
- const response = await fetch(url, { credentials: "omit", signal: timeoutController.signal });
2029
- if (!response.ok) {
2030
- return null;
2031
- }
2032
- return await response.text();
2033
- } catch {
2034
- return null;
2035
- } finally {
2036
- clearTimeout(timeoutId);
2037
- }
2038
- }
2250
+ var import_i18n32 = require("@wordpress/i18n");
2039
2251
 
2040
2252
  // src/utils/scan-consent-signals.ts
2041
2253
  var GOOGLE_TRACKING_PATTERNS = [
@@ -2056,44 +2268,43 @@ function hasConsentDefaultCall(html) {
2056
2268
  }
2057
2269
 
2058
2270
  // src/audits/google-consent-mode.ts
2059
- var audit6 = {
2271
+ var audit8 = {
2060
2272
  id: "audits/google-consent-mode",
2061
- title: (0, import_i18n30.__)("Google Consent Mode", "elementor"),
2062
- description: (0, import_i18n30.__)(
2273
+ title: (0, import_i18n32.__)("Google Consent Mode", "elementor"),
2274
+ description: (0, import_i18n32.__)(
2063
2275
  "Google Analytics, Ads, or Tag Manager are running on this site and may not receive a consent signal, which risks losing conversion/analytics data and compliance exposure.",
2064
2276
  "elementor"
2065
2277
  ),
2066
- fixHint: (0, import_i18n30.__)(
2278
+ fixHint: (0, import_i18n32.__)(
2067
2279
  "Turn on Google Consent Mode in your cookie consent plugin so Google tags respect visitor consent choices.",
2068
2280
  "elementor"
2069
2281
  ),
2070
2282
  categories: ["compliance"],
2071
2283
  severity: "warning",
2072
2284
  weight: 1,
2073
- evaluate: async (ctx) => {
2285
+ evaluate: (ctx) => {
2074
2286
  if (!ctx.pageContext.frontend_url) {
2075
- return { status: "skipped", reason: (0, import_i18n30.__)("Page is not published.", "elementor") };
2287
+ return { status: "skipped", reason: (0, import_i18n32.__)("Page is not published.", "elementor") };
2076
2288
  }
2077
- const html = await fetchRenderedHtml(ctx.pageContext.frontend_url);
2078
- if (!html) {
2079
- return { status: "skipped", reason: (0, import_i18n30.__)("Could not fetch the published page.", "elementor") };
2289
+ if (!ctx.renderedHtml) {
2290
+ return { status: "skipped", reason: (0, import_i18n32.__)("Could not fetch the published page.", "elementor") };
2080
2291
  }
2081
- if (!hasGoogleTracking(html)) {
2082
- return { status: "skipped", reason: (0, import_i18n30.__)("No Google tracking product detected.", "elementor") };
2292
+ if (!hasGoogleTracking(ctx.renderedHtml)) {
2293
+ return { status: "skipped", reason: (0, import_i18n32.__)("No Google tracking product detected.", "elementor") };
2083
2294
  }
2084
- if (hasConsentDefaultCall(html)) {
2295
+ if (hasConsentDefaultCall(ctx.renderedHtml)) {
2085
2296
  return { status: "pass" };
2086
2297
  }
2087
- const label = (0, import_i18n30.__)("No Google Consent Mode signal was found on the page.", "elementor");
2298
+ const label = (0, import_i18n32.__)("No Google Consent Mode signal was found on the page.", "elementor");
2088
2299
  const isCookiezReady = ctx.pageContext.cookiez_plugin_installed && ctx.pageContext.cookiez_plugin_active;
2089
2300
  if (isCookiezReady) {
2090
2301
  return {
2091
2302
  status: "fail",
2092
2303
  violations: [
2093
2304
  {
2094
- auditId: audit6.id,
2305
+ auditId: audit8.id,
2095
2306
  label,
2096
- ctaLabel: (0, import_i18n30.__)("Enable", "elementor"),
2307
+ ctaLabel: (0, import_i18n32.__)("Enable", "elementor"),
2097
2308
  externalUrl: ctx.pageContext.cookiez_consent_mode_settings_url
2098
2309
  }
2099
2310
  ]
@@ -2103,7 +2314,7 @@ var audit6 = {
2103
2314
  status: "fail",
2104
2315
  violations: [
2105
2316
  {
2106
- auditId: audit6.id,
2317
+ auditId: audit8.id,
2107
2318
  label,
2108
2319
  externalUrl: ctx.pageContext.cookiez_plugin_action_url
2109
2320
  }
@@ -2113,7 +2324,7 @@ var audit6 = {
2113
2324
  };
2114
2325
 
2115
2326
  // src/audits/heading-structure.ts
2116
- var import_i18n31 = require("@wordpress/i18n");
2327
+ var import_i18n33 = require("@wordpress/i18n");
2117
2328
  var HEADING_LEVELS = ["h1", "h2", "h3", "h4", "h5", "h6"];
2118
2329
  var HEADING_CONTROLS_REGISTRY = {
2119
2330
  // Core
@@ -2289,47 +2500,47 @@ function extractPageHeadings(tree) {
2289
2500
  });
2290
2501
  return headings;
2291
2502
  }
2292
- var audit7 = {
2503
+ var audit9 = {
2293
2504
  id: "audits/heading-structure",
2294
- title: (0, import_i18n31.__)("Heading structure", "elementor"),
2295
- description: (0, import_i18n31.__)("Pages should have exactly one H1 and a non-skipping heading order.", "elementor"),
2296
- fixHint: (0, import_i18n31.__)("Ensure your page has one H1 and that heading levels do not skip (no H2 \u2192 H4).", "elementor"),
2505
+ title: (0, import_i18n33.__)("Heading structure", "elementor"),
2506
+ description: (0, import_i18n33.__)("Pages should have exactly one H1 and a non-skipping heading order.", "elementor"),
2507
+ fixHint: (0, import_i18n33.__)("Ensure your page has one H1 and that heading levels do not skip (no H2 \u2192 H4).", "elementor"),
2297
2508
  categories: ["seo", "accessibility"],
2298
2509
  severity: "error",
2299
2510
  weight: 10,
2300
2511
  evaluate: (ctx) => {
2301
2512
  if (ctx.elements.tree.length === 0) {
2302
- return { status: "skipped", reason: (0, import_i18n31.__)("No elements", "elementor") };
2513
+ return { status: "skipped", reason: (0, import_i18n33.__)("No elements", "elementor") };
2303
2514
  }
2304
2515
  const headings = extractPageHeadings(ctx.elements.tree);
2305
2516
  const violations = [];
2306
2517
  if (headings.length === 0) {
2307
2518
  violations.push({
2308
- auditId: audit7.id,
2309
- label: (0, import_i18n31.__)("No headings found on the page.", "elementor")
2519
+ auditId: audit9.id,
2520
+ label: (0, import_i18n33.__)("No headings found on the page.", "elementor")
2310
2521
  });
2311
2522
  } else {
2312
2523
  const h1Count = headings.filter((h) => h.level === 1).length;
2313
2524
  if (h1Count === 0) {
2314
- violations.push({ auditId: audit7.id, label: (0, import_i18n31.__)("No H1 on the page.", "elementor") });
2525
+ violations.push({ auditId: audit9.id, label: (0, import_i18n33.__)("No H1 on the page.", "elementor") });
2315
2526
  }
2316
2527
  if (h1Count > 1) {
2317
2528
  headings.filter((h) => h.level === 1).slice(1).forEach(
2318
2529
  (h) => violations.push({
2319
- auditId: audit7.id,
2530
+ auditId: audit9.id,
2320
2531
  elementId: h.elementId,
2321
2532
  targetHint: "element-settings",
2322
- label: (0, import_i18n31.__)("More than one H1 on the page.", "elementor")
2533
+ label: (0, import_i18n33.__)("More than one H1 on the page.", "elementor")
2323
2534
  })
2324
2535
  );
2325
2536
  }
2326
2537
  for (let i = 1; i < headings.length; i++) {
2327
2538
  if (headings[i].level - headings[i - 1].level > 1) {
2328
2539
  violations.push({
2329
- auditId: audit7.id,
2540
+ auditId: audit9.id,
2330
2541
  elementId: headings[i].elementId,
2331
2542
  targetHint: "element-settings",
2332
- label: (0, import_i18n31.__)("Heading level skipped.", "elementor")
2543
+ label: (0, import_i18n33.__)("Heading level skipped.", "elementor")
2333
2544
  });
2334
2545
  }
2335
2546
  }
@@ -2339,33 +2550,33 @@ var audit7 = {
2339
2550
  };
2340
2551
 
2341
2552
  // src/audits/hidden-elements.ts
2342
- var import_i18n32 = require("@wordpress/i18n");
2553
+ var import_i18n34 = require("@wordpress/i18n");
2343
2554
  function isHiddenOnAllDevices(settings) {
2344
2555
  return Boolean(settings.hide_desktop) && Boolean(settings.hide_tablet) && Boolean(settings.hide_mobile);
2345
2556
  }
2346
- var audit8 = {
2557
+ var audit10 = {
2347
2558
  id: "audits/hidden-elements",
2348
- title: (0, import_i18n32.__)("Hidden elements", "elementor"),
2349
- description: (0, import_i18n32.__)(
2559
+ title: (0, import_i18n34.__)("Hidden elements", "elementor"),
2560
+ description: (0, import_i18n34.__)(
2350
2561
  "Elements hidden on all devices simultaneously are effectively dead code in the page tree.",
2351
2562
  "elementor"
2352
2563
  ),
2353
- fixHint: (0, import_i18n32.__)("Remove the element or make it visible on at least one device breakpoint.", "elementor"),
2564
+ fixHint: (0, import_i18n34.__)("Remove the element or make it visible on at least one device breakpoint.", "elementor"),
2354
2565
  categories: ["best-practices", "performance"],
2355
2566
  severity: "info",
2356
2567
  weight: 3,
2357
2568
  evaluate: (ctx) => {
2358
2569
  if (ctx.elements.tree.length === 0) {
2359
- return { status: "skipped", reason: (0, import_i18n32.__)("No elements", "elementor") };
2570
+ return { status: "skipped", reason: (0, import_i18n34.__)("No elements", "elementor") };
2360
2571
  }
2361
2572
  const violations = [];
2362
2573
  walkElements(ctx.elements.tree, (node) => {
2363
2574
  if (isHiddenOnAllDevices(node.settings)) {
2364
2575
  violations.push({
2365
- auditId: audit8.id,
2576
+ auditId: audit10.id,
2366
2577
  elementId: node.id,
2367
2578
  targetHint: "element-settings",
2368
- label: (0, import_i18n32.__)("Element is hidden on all devices.", "elementor")
2579
+ label: (0, import_i18n34.__)("Element is hidden on all devices.", "elementor")
2369
2580
  });
2370
2581
  }
2371
2582
  });
@@ -2374,7 +2585,7 @@ var audit8 = {
2374
2585
  };
2375
2586
 
2376
2587
  // src/audits/images-alt-text.ts
2377
- var import_i18n33 = require("@wordpress/i18n");
2588
+ var import_i18n35 = require("@wordpress/i18n");
2378
2589
 
2379
2590
  // src/utils/image-alt.ts
2380
2591
  function hasMeaningfulAlt(media, pageContext) {
@@ -2382,7 +2593,8 @@ function hasMeaningfulAlt(media, pageContext) {
2382
2593
  return true;
2383
2594
  }
2384
2595
  if (media.id) {
2385
- const alt = pageContext.image_sizes[media.id]?.alt ?? "";
2596
+ const key = buildImageSizeKey({ id: media.id, size: media.size });
2597
+ const alt = pageContext.image_sizes[key]?.alt ?? "";
2386
2598
  return alt.trim().length > 0;
2387
2599
  }
2388
2600
  return (media.alt ?? "").trim().length > 0;
@@ -2392,17 +2604,17 @@ function isImageSourcePresent(media) {
2392
2604
  }
2393
2605
 
2394
2606
  // src/audits/images-alt-text.ts
2395
- var audit9 = {
2607
+ var audit11 = {
2396
2608
  id: "audits/images-alt-text",
2397
- title: (0, import_i18n33.__)("Images alt text", "elementor"),
2398
- description: (0, import_i18n33.__)("Every image needs a meaningful alt attribute for screen readers and image-search.", "elementor"),
2399
- fixHint: (0, import_i18n33.__)("Open the image's settings and add an Alt Text describing the image.", "elementor"),
2609
+ title: (0, import_i18n35.__)("Images alt text", "elementor"),
2610
+ description: (0, import_i18n35.__)("Every image needs a meaningful alt attribute for screen readers and image-search.", "elementor"),
2611
+ fixHint: (0, import_i18n35.__)("Open the image's settings and add an Alt Text describing the image.", "elementor"),
2400
2612
  categories: ["seo", "accessibility"],
2401
2613
  severity: "error",
2402
2614
  weight: 10,
2403
2615
  evaluate: (ctx) => {
2404
2616
  if (!hasPageImages(ctx.elements.tree)) {
2405
- return { status: "skipped", reason: (0, import_i18n33.__)("No images", "elementor") };
2617
+ return { status: "skipped", reason: (0, import_i18n35.__)("No images", "elementor") };
2406
2618
  }
2407
2619
  const violations = [];
2408
2620
  const failedWidgetIds = /* @__PURE__ */ new Set();
@@ -2415,10 +2627,10 @@ var audit9 = {
2415
2627
  if (!failedWidgetIds.has(node.id)) {
2416
2628
  failedWidgetIds.add(node.id);
2417
2629
  violations.push({
2418
- auditId: audit9.id,
2630
+ auditId: audit11.id,
2419
2631
  elementId: node.id,
2420
2632
  targetHint: "element-settings",
2421
- label: (0, import_i18n33.__)("Image is missing alt text.", "elementor"),
2633
+ label: (0, import_i18n35.__)("Image is missing alt text.", "elementor"),
2422
2634
  externalUrl: ctx.pageContext.ally_plugin_url
2423
2635
  });
2424
2636
  }
@@ -2427,30 +2639,79 @@ var audit9 = {
2427
2639
  }
2428
2640
  };
2429
2641
 
2642
+ // src/audits/images-inefficient-format.ts
2643
+ var import_i18n36 = require("@wordpress/i18n");
2644
+ var LEGACY_RASTER_MIME_TYPES = /* @__PURE__ */ new Set(["image/jpeg", "image/png", "image/gif", "image/bmp", "image/tiff"]);
2645
+ var audit12 = {
2646
+ id: "audits/images-inefficient-format",
2647
+ title: (0, import_i18n36.__)("Inefficient image format", "elementor"),
2648
+ description: (0, import_i18n36.__)("Image isn't served in a modern, efficient format like WebP or AVIF.", "elementor"),
2649
+ fixHint: (0, import_i18n36.__)("Convert the image to a modern format like WebP or AVIF, or enable image optimization.", "elementor"),
2650
+ categories: ["performance"],
2651
+ severity: "info",
2652
+ weight: 1,
2653
+ evaluate: (ctx) => {
2654
+ const offendingElementIds = /* @__PURE__ */ new Set();
2655
+ let hasAnyImage = false;
2656
+ let inefficientImageFormatCount = 0;
2657
+ const evaluateSource = (node, media) => {
2658
+ if (media.id || media.url) {
2659
+ hasAnyImage = true;
2660
+ }
2661
+ const id = media.id;
2662
+ if (!id) {
2663
+ return;
2664
+ }
2665
+ const mime = ctx.pageContext.image_sizes[buildImageSizeKey({ id, size: media.size })]?.mime;
2666
+ if (!mime || !LEGACY_RASTER_MIME_TYPES.has(mime)) {
2667
+ return;
2668
+ }
2669
+ inefficientImageFormatCount++;
2670
+ offendingElementIds.add(node.id);
2671
+ };
2672
+ walkImageLikeSources(ctx.elements.tree, ({ node, media }) => evaluateSource(node, media));
2673
+ walkBackgroundImageSources(ctx.elements.tree, ({ node, media }) => evaluateSource(node, media));
2674
+ walkAtomicImageSources(ctx.elements.tree, ({ node, media }) => evaluateSource(node, media));
2675
+ walkAtomicBackgroundImageSources(ctx.elements.tree, ({ node, media }) => evaluateSource(node, media));
2676
+ if (!hasAnyImage) {
2677
+ return { status: "skipped", reason: (0, import_i18n36.__)("No images", "elementor") };
2678
+ }
2679
+ const violations = Array.from(offendingElementIds).map((elementId) => ({
2680
+ auditId: audit12.id,
2681
+ elementId,
2682
+ targetHint: "element-settings",
2683
+ label: (0, import_i18n36.__)("Image isn't served in a modern format like WebP or AVIF.", "elementor"),
2684
+ externalUrl: ctx.pageContext.image_optimization_plugin_url
2685
+ }));
2686
+ return violations.length === 0 ? { status: "pass" } : { status: "fail", violations, metadata: { inefficientImageFormatCount } };
2687
+ }
2688
+ };
2689
+
2430
2690
  // src/audits/images-too-large.ts
2431
- var import_i18n34 = require("@wordpress/i18n");
2691
+ var import_i18n37 = require("@wordpress/i18n");
2432
2692
  var SIZE_THRESHOLD_BYTES = 500 * 1024;
2433
2693
  var BYTES_PER_KB = 1024;
2434
- var audit10 = {
2694
+ var audit13 = {
2435
2695
  id: "audits/images-too-large",
2436
- title: (0, import_i18n34.__)("Oversized images", "elementor"),
2437
- description: (0, import_i18n34.__)("Large image files slow down the page.", "elementor"),
2438
- fixHint: (0, import_i18n34.__)("Replace the image with a smaller version or enable image optimization.", "elementor"),
2696
+ title: (0, import_i18n37.__)("Oversized images", "elementor"),
2697
+ description: (0, import_i18n37.__)("Large image files slow down the page.", "elementor"),
2698
+ fixHint: (0, import_i18n37.__)("Replace the image with a smaller version or enable image optimization.", "elementor"),
2439
2699
  categories: ["performance"],
2440
2700
  severity: "warning",
2441
2701
  weight: 7,
2442
2702
  evaluate: (ctx) => {
2443
- if (!hasPageImages(ctx.elements.tree)) {
2444
- return { status: "skipped", reason: (0, import_i18n34.__)("No images", "elementor") };
2445
- }
2446
2703
  const widgetMaxKb = /* @__PURE__ */ new Map();
2447
2704
  let oversizedImageCount = 0;
2448
- walkImageLikeSources(ctx.elements.tree, ({ node, media }) => {
2705
+ let hasAnyImage = false;
2706
+ const evaluateSource = (node, media) => {
2707
+ if (media.id || media.url) {
2708
+ hasAnyImage = true;
2709
+ }
2449
2710
  const id = media.id;
2450
2711
  if (!id) {
2451
2712
  return;
2452
2713
  }
2453
- const size = ctx.pageContext.image_sizes[id];
2714
+ const size = ctx.pageContext.image_sizes[buildImageSizeKey({ id, size: media.size })];
2454
2715
  if (!size || size.filesize_bytes <= SIZE_THRESHOLD_BYTES) {
2455
2716
  return;
2456
2717
  }
@@ -2458,14 +2719,21 @@ var audit10 = {
2458
2719
  const kb = Math.round(size.filesize_bytes / BYTES_PER_KB);
2459
2720
  const currentMax = widgetMaxKb.get(node.id) ?? 0;
2460
2721
  widgetMaxKb.set(node.id, Math.max(currentMax, kb));
2461
- });
2722
+ };
2723
+ walkImageLikeSources(ctx.elements.tree, ({ node, media }) => evaluateSource(node, media));
2724
+ walkBackgroundImageSources(ctx.elements.tree, ({ node, media }) => evaluateSource(node, media));
2725
+ walkAtomicImageSources(ctx.elements.tree, ({ node, media }) => evaluateSource(node, media));
2726
+ walkAtomicBackgroundImageSources(ctx.elements.tree, ({ node, media }) => evaluateSource(node, media));
2727
+ if (!hasAnyImage) {
2728
+ return { status: "skipped", reason: (0, import_i18n37.__)("No images", "elementor") };
2729
+ }
2462
2730
  const violations = Array.from(widgetMaxKb.entries()).map(([elementId, kb]) => ({
2463
- auditId: audit10.id,
2731
+ auditId: audit13.id,
2464
2732
  elementId,
2465
2733
  targetHint: "element-settings",
2466
- label: (0, import_i18n34.sprintf)(
2734
+ label: (0, import_i18n37.sprintf)(
2467
2735
  /* translators: %d is the image file size in kilobytes. */
2468
- (0, import_i18n34.__)("Image is %d KB (over 500 KB).", "elementor"),
2736
+ (0, import_i18n37.__)("Image is %d KB (over 500 KB).", "elementor"),
2469
2737
  kb
2470
2738
  ),
2471
2739
  externalUrl: ctx.pageContext.image_optimization_plugin_url
@@ -2475,21 +2743,21 @@ var audit10 = {
2475
2743
  };
2476
2744
 
2477
2745
  // src/audits/nested-boxed-containers.ts
2478
- var import_i18n35 = require("@wordpress/i18n");
2746
+ var import_i18n38 = require("@wordpress/i18n");
2479
2747
  function isBoxed(settings) {
2480
2748
  return settings.content_width === "boxed";
2481
2749
  }
2482
- var audit11 = {
2750
+ var audit14 = {
2483
2751
  id: "audits/nested-boxed-containers",
2484
- title: (0, import_i18n35.__)("Boxed container nested inside a boxed parent", "elementor"),
2485
- description: (0, import_i18n35.__)("An inner container does not need to be boxed when its parent already is.", "elementor"),
2486
- fixHint: (0, import_i18n35.__)("Change the inner container's content width to Full Width.", "elementor"),
2752
+ title: (0, import_i18n38.__)("Boxed container nested inside a boxed parent", "elementor"),
2753
+ description: (0, import_i18n38.__)("An inner container does not need to be boxed when its parent already is.", "elementor"),
2754
+ fixHint: (0, import_i18n38.__)("Change the inner container's content width to Full Width.", "elementor"),
2487
2755
  categories: ["best-practices", "performance"],
2488
2756
  severity: "info",
2489
2757
  weight: 5,
2490
2758
  evaluate: (ctx) => {
2491
2759
  if (ctx.elements.tree.length === 0) {
2492
- return { status: "skipped", reason: (0, import_i18n35.__)("No elements", "elementor") };
2760
+ return { status: "skipped", reason: (0, import_i18n38.__)("No elements", "elementor") };
2493
2761
  }
2494
2762
  const violations = [];
2495
2763
  walkElements(ctx.elements.tree, (node, parents) => {
@@ -2499,10 +2767,10 @@ var audit11 = {
2499
2767
  const nearestContainerAncestor = [...parents].reverse().find((p) => p.elType === "container");
2500
2768
  if (nearestContainerAncestor && isBoxed(nearestContainerAncestor.settings)) {
2501
2769
  violations.push({
2502
- auditId: audit11.id,
2770
+ auditId: audit14.id,
2503
2771
  elementId: node.id,
2504
2772
  targetHint: "element-settings",
2505
- label: (0, import_i18n35.__)("Nested boxed container.", "elementor")
2773
+ label: (0, import_i18n38.__)("Nested boxed container.", "elementor")
2506
2774
  });
2507
2775
  }
2508
2776
  });
@@ -2511,12 +2779,12 @@ var audit11 = {
2511
2779
  };
2512
2780
 
2513
2781
  // src/audits/page-excerpt.ts
2514
- var import_i18n36 = require("@wordpress/i18n");
2515
- var audit12 = {
2782
+ var import_i18n39 = require("@wordpress/i18n");
2783
+ var audit15 = {
2516
2784
  id: "audits/page-excerpt",
2517
- title: (0, import_i18n36.__)("Page excerpt", "elementor"),
2518
- description: (0, import_i18n36.__)("A descriptive excerpt helps search engines and previews summarize the page.", "elementor"),
2519
- fixHint: (0, import_i18n36.__)("Open Page Settings and write a short excerpt.", "elementor"),
2785
+ title: (0, import_i18n39.__)("Page excerpt", "elementor"),
2786
+ description: (0, import_i18n39.__)("A descriptive excerpt helps search engines and previews summarize the page.", "elementor"),
2787
+ fixHint: (0, import_i18n39.__)("Open Page Settings and write a short excerpt.", "elementor"),
2520
2788
  categories: ["seo"],
2521
2789
  severity: "warning",
2522
2790
  weight: 5,
@@ -2528,8 +2796,8 @@ var audit12 = {
2528
2796
  status: "fail",
2529
2797
  violations: [
2530
2798
  {
2531
- auditId: audit12.id,
2532
- label: (0, import_i18n36.__)("Page has no excerpt.", "elementor"),
2799
+ auditId: audit15.id,
2800
+ label: (0, import_i18n39.__)("Page has no excerpt.", "elementor"),
2533
2801
  targetHint: "page-settings",
2534
2802
  angieFix: true
2535
2803
  }
@@ -2539,12 +2807,12 @@ var audit12 = {
2539
2807
  };
2540
2808
 
2541
2809
  // src/audits/page-featured-image.ts
2542
- var import_i18n37 = require("@wordpress/i18n");
2543
- var audit13 = {
2810
+ var import_i18n40 = require("@wordpress/i18n");
2811
+ var audit16 = {
2544
2812
  id: "audits/page-featured-image",
2545
- title: (0, import_i18n37.__)("Page featured image", "elementor"),
2546
- description: (0, import_i18n37.__)("Featured images are used by social shares and many themes for hero visuals.", "elementor"),
2547
- fixHint: (0, import_i18n37.__)("Open Page Settings and set a featured image.", "elementor"),
2813
+ title: (0, import_i18n40.__)("Page featured image", "elementor"),
2814
+ description: (0, import_i18n40.__)("Featured images are used by social shares and many themes for hero visuals.", "elementor"),
2815
+ fixHint: (0, import_i18n40.__)("Open Page Settings and set a featured image.", "elementor"),
2548
2816
  categories: ["seo"],
2549
2817
  severity: "info",
2550
2818
  weight: 5,
@@ -2556,8 +2824,8 @@ var audit13 = {
2556
2824
  status: "fail",
2557
2825
  violations: [
2558
2826
  {
2559
- auditId: audit13.id,
2560
- label: (0, import_i18n37.__)("No featured image set.", "elementor"),
2827
+ auditId: audit16.id,
2828
+ label: (0, import_i18n40.__)("No featured image set.", "elementor"),
2561
2829
  targetHint: "page-settings"
2562
2830
  }
2563
2831
  ]
@@ -2566,13 +2834,13 @@ var audit13 = {
2566
2834
  };
2567
2835
 
2568
2836
  // src/audits/page-title.ts
2569
- var import_i18n38 = require("@wordpress/i18n");
2837
+ var import_i18n41 = require("@wordpress/i18n");
2570
2838
  var MAX_TITLE_LENGTH = 60;
2571
- var audit14 = {
2839
+ var audit17 = {
2572
2840
  id: "audits/page-title",
2573
- title: (0, import_i18n38.__)("Page title", "elementor"),
2574
- description: (0, import_i18n38.__)("Pages need a clear title for SEO and screen-reader navigation.", "elementor"),
2575
- fixHint: (0, import_i18n38.__)("Open Page Settings and add a title.", "elementor"),
2841
+ title: (0, import_i18n41.__)("Page title", "elementor"),
2842
+ description: (0, import_i18n41.__)("Pages need a clear title for SEO and screen-reader navigation.", "elementor"),
2843
+ fixHint: (0, import_i18n41.__)("Open Page Settings and add a title.", "elementor"),
2576
2844
  categories: ["seo"],
2577
2845
  severity: "error",
2578
2846
  weight: 10,
@@ -2583,10 +2851,14 @@ var audit14 = {
2583
2851
  status: "fail",
2584
2852
  violations: [
2585
2853
  {
2586
- auditId: audit14.id,
2587
- label: (0, import_i18n38.__)("Page has no title.", "elementor"),
2854
+ auditId: audit17.id,
2855
+ label: (0, import_i18n41.__)("Page has no title.", "elementor"),
2588
2856
  targetHint: "page-settings",
2589
- angieFix: true
2857
+ angieFix: true,
2858
+ angiePrompt: (0, import_i18n41.__)(
2859
+ "Based on this page's contents, generate a title for this page.",
2860
+ "elementor"
2861
+ )
2590
2862
  }
2591
2863
  ]
2592
2864
  };
@@ -2596,8 +2868,8 @@ var audit14 = {
2596
2868
  status: "fail",
2597
2869
  violations: [
2598
2870
  {
2599
- auditId: audit14.id,
2600
- label: (0, import_i18n38.__)("Page title is too long.", "elementor"),
2871
+ auditId: audit17.id,
2872
+ label: (0, import_i18n41.__)("Page title is too long.", "elementor"),
2601
2873
  targetHint: "page-settings",
2602
2874
  angieFix: true
2603
2875
  }
@@ -2609,7 +2881,7 @@ var audit14 = {
2609
2881
  };
2610
2882
 
2611
2883
  // src/audits/prefer-global-colors.ts
2612
- var import_i18n39 = require("@wordpress/i18n");
2884
+ var import_i18n42 = require("@wordpress/i18n");
2613
2885
 
2614
2886
  // src/utils/collect-hardcoded-colors.ts
2615
2887
  var RESERVED_SETTING_KEYS = /* @__PURE__ */ new Set(["__globals__", "__dynamic__"]);
@@ -2675,20 +2947,20 @@ function findMatchingGlobalByValue(value, globals) {
2675
2947
  }
2676
2948
 
2677
2949
  // src/audits/prefer-global-colors.ts
2678
- var audit15 = {
2950
+ var audit18 = {
2679
2951
  id: "audits/prefer-global-colors",
2680
- title: (0, import_i18n39.__)("Prefer global colors", "elementor"),
2681
- description: (0, import_i18n39.__)("Global colors make the design consistent and easy to update site-wide.", "elementor"),
2682
- fixHint: (0, import_i18n39.__)("Replace the hard-coded value with the matching global color.", "elementor"),
2952
+ title: (0, import_i18n42.__)("Prefer global colors", "elementor"),
2953
+ description: (0, import_i18n42.__)("Global colors make the design consistent and easy to update site-wide.", "elementor"),
2954
+ fixHint: (0, import_i18n42.__)("Replace the hard-coded value with the matching global color.", "elementor"),
2683
2955
  categories: ["best-practices"],
2684
2956
  severity: "info",
2685
2957
  weight: 3,
2686
2958
  evaluate: (ctx) => {
2687
2959
  if (ctx.elements.tree.length === 0) {
2688
- return { status: "skipped", reason: (0, import_i18n39.__)("No elements", "elementor") };
2960
+ return { status: "skipped", reason: (0, import_i18n42.__)("No elements", "elementor") };
2689
2961
  }
2690
2962
  if (ctx.kit.globals.colors.length === 0) {
2691
- return { status: "skipped", reason: (0, import_i18n39.__)("No global colors", "elementor") };
2963
+ return { status: "skipped", reason: (0, import_i18n42.__)("No global colors", "elementor") };
2692
2964
  }
2693
2965
  const violations = [];
2694
2966
  walkElements(ctx.elements.tree, (node) => {
@@ -2698,13 +2970,13 @@ var audit15 = {
2698
2970
  continue;
2699
2971
  }
2700
2972
  violations.push({
2701
- auditId: audit15.id,
2973
+ auditId: audit18.id,
2702
2974
  elementId: node.id,
2703
2975
  targetHint: "element-settings",
2704
2976
  angieFix: true,
2705
- label: (0, import_i18n39.sprintf)(
2977
+ label: (0, import_i18n42.sprintf)(
2706
2978
  /* translators: 1: hard-coded color value, 2: global color title. */
2707
- (0, import_i18n39.__)('replace "%1$s" with "%2$s" global color', "elementor"),
2979
+ (0, import_i18n42.__)('replace "%1$s" with "%2$s" global color', "elementor"),
2708
2980
  value,
2709
2981
  global.title
2710
2982
  )
@@ -2716,7 +2988,7 @@ var audit15 = {
2716
2988
  };
2717
2989
 
2718
2990
  // src/audits/prefer-global-fonts.ts
2719
- var import_i18n40 = require("@wordpress/i18n");
2991
+ var import_i18n43 = require("@wordpress/i18n");
2720
2992
 
2721
2993
  // src/utils/collect-hardcoded-fonts.ts
2722
2994
  var RESERVED_SETTING_KEYS2 = /* @__PURE__ */ new Set(["__globals__", "__dynamic__"]);
@@ -2774,20 +3046,20 @@ function collectHardcodedFonts(settings, pathPrefix = "") {
2774
3046
  }
2775
3047
 
2776
3048
  // src/audits/prefer-global-fonts.ts
2777
- var audit16 = {
3049
+ var audit19 = {
2778
3050
  id: "audits/prefer-global-fonts",
2779
- title: (0, import_i18n40.__)("Prefer global fonts", "elementor"),
2780
- description: (0, import_i18n40.__)("Global fonts make the design consistent and easy to update site-wide.", "elementor"),
2781
- fixHint: (0, import_i18n40.__)("Replace the hard-coded value with the matching global font.", "elementor"),
3051
+ title: (0, import_i18n43.__)("Prefer global fonts", "elementor"),
3052
+ description: (0, import_i18n43.__)("Global fonts make the design consistent and easy to update site-wide.", "elementor"),
3053
+ fixHint: (0, import_i18n43.__)("Replace the hard-coded value with the matching global font.", "elementor"),
2782
3054
  categories: ["best-practices", "performance"],
2783
3055
  severity: "info",
2784
3056
  weight: 3,
2785
3057
  evaluate: (ctx) => {
2786
3058
  if (ctx.elements.tree.length === 0) {
2787
- return { status: "skipped", reason: (0, import_i18n40.__)("No elements", "elementor") };
3059
+ return { status: "skipped", reason: (0, import_i18n43.__)("No elements", "elementor") };
2788
3060
  }
2789
3061
  if (ctx.kit.globals.fonts.length === 0) {
2790
- return { status: "skipped", reason: (0, import_i18n40.__)("No global fonts", "elementor") };
3062
+ return { status: "skipped", reason: (0, import_i18n43.__)("No global fonts", "elementor") };
2791
3063
  }
2792
3064
  const violations = [];
2793
3065
  walkElements(ctx.elements.tree, (node) => {
@@ -2797,12 +3069,12 @@ var audit16 = {
2797
3069
  continue;
2798
3070
  }
2799
3071
  violations.push({
2800
- auditId: audit16.id,
3072
+ auditId: audit19.id,
2801
3073
  elementId: node.id,
2802
3074
  targetHint: "element-settings",
2803
- label: (0, import_i18n40.sprintf)(
3075
+ label: (0, import_i18n43.sprintf)(
2804
3076
  /* translators: %s: global font title. */
2805
- (0, import_i18n40.__)('replace hardcoded typography with "%s" global font', "elementor"),
3077
+ (0, import_i18n43.__)('replace hardcoded typography with "%s" global font', "elementor"),
2806
3078
  global.title
2807
3079
  )
2808
3080
  });
@@ -2813,15 +3085,15 @@ var audit16 = {
2813
3085
  };
2814
3086
 
2815
3087
  // src/audits/privacy-policy.ts
2816
- var import_i18n41 = require("@wordpress/i18n");
2817
- var audit17 = {
3088
+ var import_i18n44 = require("@wordpress/i18n");
3089
+ var audit20 = {
2818
3090
  id: "audits/privacy-policy",
2819
- title: (0, import_i18n41.__)("Privacy policy", "elementor"),
2820
- description: (0, import_i18n41.__)(
3091
+ title: (0, import_i18n44.__)("Privacy policy", "elementor"),
3092
+ description: (0, import_i18n44.__)(
2821
3093
  "A privacy policy page is required by privacy regulations such as GDPR (EU) and CCPA (US).",
2822
3094
  "elementor"
2823
3095
  ),
2824
- fixHint: (0, import_i18n41.__)(
3096
+ fixHint: (0, import_i18n44.__)(
2825
3097
  "Go to Settings > Privacy in the WordPress admin and assign a published privacy policy page.",
2826
3098
  "elementor"
2827
3099
  ),
@@ -2836,10 +3108,10 @@ var audit17 = {
2836
3108
  status: "fail",
2837
3109
  violations: [
2838
3110
  {
2839
- auditId: audit17.id,
2840
- label: (0, import_i18n41.__)("No privacy policy page is set.", "elementor"),
3111
+ auditId: audit20.id,
3112
+ label: (0, import_i18n44.__)("No privacy policy page is set.", "elementor"),
2841
3113
  externalUrl: ctx.pageContext.privacy_settings_url,
2842
- ctaLabel: (0, import_i18n41.__)("Create", "elementor")
3114
+ ctaLabel: (0, import_i18n44.__)("Create", "elementor")
2843
3115
  }
2844
3116
  ]
2845
3117
  };
@@ -2847,15 +3119,15 @@ var audit17 = {
2847
3119
  };
2848
3120
 
2849
3121
  // src/audits/robots-noindex.ts
2850
- var import_i18n42 = require("@wordpress/i18n");
2851
- var audit18 = {
3122
+ var import_i18n45 = require("@wordpress/i18n");
3123
+ var audit21 = {
2852
3124
  id: "audits/robots-noindex",
2853
- title: (0, import_i18n42.__)("Search engine visibility", "elementor"),
2854
- description: (0, import_i18n42.__)(
3125
+ title: (0, import_i18n45.__)("Search engine visibility", "elementor"),
3126
+ description: (0, import_i18n45.__)(
2855
3127
  "When search engine visibility is checked in WordPress Settings -> Reading -> Search Engine Visibility, search engines are discouraged from indexing the website.",
2856
3128
  "elementor"
2857
3129
  ),
2858
- fixHint: (0, import_i18n42.__)(
3130
+ fixHint: (0, import_i18n45.__)(
2859
3131
  'Go to Settings \u2192 Reading in the WordPress admin and uncheck "Discourage search engines from indexing this site" when the website should be indexed.',
2860
3132
  "elementor"
2861
3133
  ),
@@ -2870,8 +3142,8 @@ var audit18 = {
2870
3142
  status: "fail",
2871
3143
  violations: [
2872
3144
  {
2873
- auditId: audit18.id,
2874
- label: (0, import_i18n42.__)("Search engines are discouraged from indexing this website.", "elementor"),
3145
+ auditId: audit21.id,
3146
+ label: (0, import_i18n45.__)("Search engines are discouraged from indexing this website.", "elementor"),
2875
3147
  externalUrl: ctx.pageContext.reading_settings_url
2876
3148
  }
2877
3149
  ]
@@ -2880,15 +3152,15 @@ var audit18 = {
2880
3152
  };
2881
3153
 
2882
3154
  // src/audits/scan-for-cookies.ts
2883
- var import_i18n43 = require("@wordpress/i18n");
2884
- var audit19 = {
3155
+ var import_i18n46 = require("@wordpress/i18n");
3156
+ var audit22 = {
2885
3157
  id: "audits/scan-for-cookies",
2886
- title: (0, import_i18n43.__)("Scan for cookies", "elementor"),
2887
- description: (0, import_i18n43.__)(
3158
+ title: (0, import_i18n46.__)("Scan for cookies", "elementor"),
3159
+ description: (0, import_i18n46.__)(
2888
3160
  "Your site may be setting cookies you haven't disclosed. Some countries require a banner even without a full consent policy. Scan to see what needs disclosure.",
2889
3161
  "elementor"
2890
3162
  ),
2891
- fixHint: (0, import_i18n43.__)("Run a Cookiez scan on this page to see which cookies need disclosure.", "elementor"),
3163
+ fixHint: (0, import_i18n46.__)("Run a Cookiez scan on this page to see which cookies need disclosure.", "elementor"),
2892
3164
  categories: ["compliance"],
2893
3165
  severity: "info",
2894
3166
  weight: 0,
@@ -2898,8 +3170,8 @@ var audit19 = {
2898
3170
  status: "fail",
2899
3171
  violations: [
2900
3172
  {
2901
- auditId: audit19.id,
2902
- label: (0, import_i18n43.__)("This page has not been scanned for cookies yet.", "elementor"),
3173
+ auditId: audit22.id,
3174
+ label: (0, import_i18n46.__)("This page has not been scanned for cookies yet.", "elementor"),
2903
3175
  externalUrl: isReady ? ctx.pageContext.cookiez_scan_url : ctx.pageContext.cookiez_plugin_action_url
2904
3176
  }
2905
3177
  ]
@@ -2908,29 +3180,29 @@ var audit19 = {
2908
3180
  };
2909
3181
 
2910
3182
  // src/audits/sections-and-columns.ts
2911
- var import_i18n44 = require("@wordpress/i18n");
2912
- var audit20 = {
3183
+ var import_i18n47 = require("@wordpress/i18n");
3184
+ var audit23 = {
2913
3185
  id: "audits/sections-and-columns",
2914
- title: (0, import_i18n44.__)("Sections and columns", "elementor"),
2915
- description: (0, import_i18n44.__)(
3186
+ title: (0, import_i18n47.__)("Sections and columns", "elementor"),
3187
+ description: (0, import_i18n47.__)(
2916
3188
  "Sections and columns are legacy elements. Containers render fewer DOM nodes and are more flexible.",
2917
3189
  "elementor"
2918
3190
  ),
2919
- fixHint: (0, import_i18n44.__)("Use the Container Converter to replace each section/column with a container.", "elementor"),
3191
+ fixHint: (0, import_i18n47.__)("Use the Container Converter to replace each section/column with a container.", "elementor"),
2920
3192
  categories: ["best-practices", "performance"],
2921
3193
  severity: "warning",
2922
3194
  weight: 7,
2923
3195
  evaluate: (ctx) => {
2924
3196
  if (ctx.elements.tree.length === 0) {
2925
- return { status: "skipped", reason: (0, import_i18n44.__)("No elements", "elementor") };
3197
+ return { status: "skipped", reason: (0, import_i18n47.__)("No elements", "elementor") };
2926
3198
  }
2927
3199
  const violations = [];
2928
3200
  walkElements(ctx.elements.tree, (node) => {
2929
3201
  if (node.elType === "section" || node.elType === "column") {
2930
3202
  violations.push({
2931
- auditId: audit20.id,
3203
+ auditId: audit23.id,
2932
3204
  elementId: node.id,
2933
- label: node.elType === "section" ? (0, import_i18n44.__)("Section element", "elementor") : (0, import_i18n44.__)("Column element", "elementor")
3205
+ label: node.elType === "section" ? (0, import_i18n47.__)("Section element", "elementor") : (0, import_i18n47.__)("Column element", "elementor")
2934
3206
  });
2935
3207
  }
2936
3208
  });
@@ -2939,15 +3211,15 @@ var audit20 = {
2939
3211
  };
2940
3212
 
2941
3213
  // src/audits/site-identity.ts
2942
- var import_i18n45 = require("@wordpress/i18n");
2943
- var audit21 = {
3214
+ var import_i18n48 = require("@wordpress/i18n");
3215
+ var audit24 = {
2944
3216
  id: "audits/site-identity",
2945
- title: (0, import_i18n45.__)("Site identity", "elementor"),
2946
- description: (0, import_i18n45.__)(
3217
+ title: (0, import_i18n48.__)("Site identity", "elementor"),
3218
+ description: (0, import_i18n48.__)(
2947
3219
  "Site name, description, logo, and favicon establish your brand and appear in search results and browser tabs.",
2948
3220
  "elementor"
2949
3221
  ),
2950
- fixHint: (0, import_i18n45.__)("Open Site Settings \u2192 Site Identity and complete all the missing fields.", "elementor"),
3222
+ fixHint: (0, import_i18n48.__)("Open Site Settings \u2192 Site Identity and complete all the missing fields.", "elementor"),
2951
3223
  categories: ["best-practices", "seo"],
2952
3224
  severity: "info",
2953
3225
  weight: 7,
@@ -2956,30 +3228,30 @@ var audit21 = {
2956
3228
  const violations = [];
2957
3229
  if (!identity.site_name_set) {
2958
3230
  violations.push({
2959
- auditId: audit21.id,
2960
- label: (0, import_i18n45.__)("Site name is missing or still uses the default.", "elementor"),
3231
+ auditId: audit24.id,
3232
+ label: (0, import_i18n48.__)("Site name is missing or still uses the default.", "elementor"),
2961
3233
  targetHint: "site-identity-settings"
2962
3234
  });
2963
3235
  }
2964
3236
  if (!identity.site_description_set) {
2965
3237
  violations.push({
2966
- auditId: audit21.id,
2967
- label: (0, import_i18n45.__)("Site description is missing or still uses the default.", "elementor"),
3238
+ auditId: audit24.id,
3239
+ label: (0, import_i18n48.__)("Site description is missing or still uses the default.", "elementor"),
2968
3240
  targetHint: "site-identity-settings",
2969
3241
  angieFix: true
2970
3242
  });
2971
3243
  }
2972
3244
  if (!identity.site_logo_set) {
2973
3245
  violations.push({
2974
- auditId: audit21.id,
2975
- label: (0, import_i18n45.__)("Site logo is not set.", "elementor"),
3246
+ auditId: audit24.id,
3247
+ label: (0, import_i18n48.__)("Site logo is not set.", "elementor"),
2976
3248
  targetHint: "site-identity-settings"
2977
3249
  });
2978
3250
  }
2979
3251
  if (!identity.site_favicon_set) {
2980
3252
  violations.push({
2981
- auditId: audit21.id,
2982
- label: (0, import_i18n45.__)("Site favicon is not set.", "elementor"),
3253
+ auditId: audit24.id,
3254
+ label: (0, import_i18n48.__)("Site favicon is not set.", "elementor"),
2983
3255
  targetHint: "site-identity-settings"
2984
3256
  });
2985
3257
  }
@@ -2994,8 +3266,8 @@ var audit21 = {
2994
3266
  };
2995
3267
 
2996
3268
  // src/audits/too-many-widgets.ts
2997
- var import_editor_elements8 = require("@elementor/editor-elements");
2998
- var import_i18n46 = require("@wordpress/i18n");
3269
+ var import_editor_elements9 = require("@elementor/editor-elements");
3270
+ var import_i18n49 = require("@wordpress/i18n");
2999
3271
  var WIDGET_COUNT_THRESHOLD = 100;
3000
3272
  function isCountableWidget(node, widgetsCache) {
3001
3273
  if (node.elType === "widget") {
@@ -3003,19 +3275,19 @@ function isCountableWidget(node, widgetsCache) {
3003
3275
  }
3004
3276
  return !!widgetsCache?.[node.elType]?.meta?.is_compound;
3005
3277
  }
3006
- var audit22 = {
3278
+ var audit25 = {
3007
3279
  id: "audits/too-many-widgets",
3008
- title: (0, import_i18n46.__)("Too many widgets", "elementor"),
3009
- description: (0, import_i18n46.__)("Excessive DOM size caused by too many widgets degrades rendering performance.", "elementor"),
3010
- fixHint: (0, import_i18n46.__)("Reduce the number of widgets on the page by removing or combining elements.", "elementor"),
3280
+ title: (0, import_i18n49.__)("Too many widgets", "elementor"),
3281
+ description: (0, import_i18n49.__)("Excessive DOM size caused by too many widgets degrades rendering performance.", "elementor"),
3282
+ fixHint: (0, import_i18n49.__)("Reduce the number of widgets on the page by removing or combining elements.", "elementor"),
3011
3283
  categories: ["best-practices", "performance"],
3012
3284
  severity: "warning",
3013
3285
  weight: 5,
3014
3286
  evaluate: (ctx) => {
3015
3287
  if (ctx.elements.tree.length === 0) {
3016
- return { status: "skipped", reason: (0, import_i18n46.__)("No elements", "elementor") };
3288
+ return { status: "skipped", reason: (0, import_i18n49.__)("No elements", "elementor") };
3017
3289
  }
3018
- const widgetsCache = (0, import_editor_elements8.getWidgetsCache)();
3290
+ const widgetsCache = (0, import_editor_elements9.getWidgetsCache)();
3019
3291
  let widgetCount = 0;
3020
3292
  walkElements(ctx.elements.tree, (node) => {
3021
3293
  if (isCountableWidget(node, widgetsCache)) {
@@ -3029,8 +3301,8 @@ var audit22 = {
3029
3301
  status: "fail",
3030
3302
  violations: [
3031
3303
  {
3032
- auditId: audit22.id,
3033
- label: (0, import_i18n46.__)("Page has too many widgets.", "elementor")
3304
+ auditId: audit25.id,
3305
+ label: (0, import_i18n49.__)("Page has too many widgets.", "elementor")
3034
3306
  }
3035
3307
  ]
3036
3308
  };
@@ -3039,32 +3311,35 @@ var audit22 = {
3039
3311
 
3040
3312
  // src/register-audits.ts
3041
3313
  var AUDITS = [
3042
- audit14,
3043
- audit12,
3044
- audit13,
3045
- audit8,
3046
- audit5,
3047
- audit22,
3048
- audit20,
3049
- audit3,
3050
- audit11,
3051
- audit4,
3052
- audit21,
3314
+ audit17,
3053
3315
  audit15,
3054
3316
  audit16,
3055
- audit7,
3056
- audit9,
3057
3317
  audit10,
3318
+ audit7,
3319
+ audit25,
3320
+ audit23,
3321
+ audit5,
3322
+ audit14,
3323
+ audit6,
3324
+ audit24,
3058
3325
  audit18,
3059
- audit17,
3326
+ audit19,
3327
+ audit9,
3328
+ audit11,
3329
+ audit13,
3330
+ audit12,
3331
+ audit21,
3332
+ audit20,
3060
3333
  audit,
3061
3334
  audit2,
3062
- audit19,
3063
- audit6
3335
+ audit3,
3336
+ audit4,
3337
+ audit22,
3338
+ audit8
3064
3339
  ];
3065
3340
  function registerAllAudits() {
3066
- for (const audit23 of AUDITS) {
3067
- registerAudit(audit23);
3341
+ for (const audit26 of AUDITS) {
3342
+ registerAudit(audit26);
3068
3343
  }
3069
3344
  }
3070
3345