@artinstack/migrator 0.1.13 → 0.1.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.
@@ -2,10 +2,10 @@ import {
2
2
  WORDPRESS_BUILDER_REGISTRY,
3
3
  WORDPRESS_WIDGET_REGISTRY,
4
4
  WP_WIDGET_PLACEHOLDER
5
- } from "./chunk-HUSXCKPI.js";
5
+ } from "./chunk-LQFNO26V.js";
6
6
  import {
7
7
  normalizeAssetUrl
8
- } from "./chunk-S4GMDRGX.js";
8
+ } from "./chunk-DZI5C6KR.js";
9
9
 
10
10
  // src/parsers/wordpress/builders/flatten.ts
11
11
  function escapeRegExp(value) {
@@ -68,12 +68,96 @@ function parseRowLayoutCols(layout) {
68
68
  const parts = layout.split("+").map((part) => part.trim()).filter(Boolean);
69
69
  return parts.length > 1 ? parts.length : void 0;
70
70
  }
71
- function openSectionDiv(params, bgParamName) {
72
- const attrs = ['data-layout="section"'];
73
- const bgImage = extractQuotedParam(params, bgParamName ?? "bg_image");
74
- if (bgImage?.startsWith("http")) {
71
+ var activeTatsuContext;
72
+ function isBlankShortcodeAttr(value) {
73
+ return !value?.trim();
74
+ }
75
+ function resolveTatsuJsonScalar(value) {
76
+ if (typeof value === "string") {
77
+ const trimmed = value.trim();
78
+ return trimmed || void 0;
79
+ }
80
+ if (typeof value === "number" && Number.isFinite(value)) return String(value);
81
+ if (value && typeof value === "object" && "d" in value) {
82
+ return resolveTatsuJsonScalar(value.d);
83
+ }
84
+ return void 0;
85
+ }
86
+ function normalizeHttpMediaUrl(url) {
87
+ if (!url?.trim()) return void 0;
88
+ const trimmed = url.trim();
89
+ if (trimmed.startsWith("http")) return trimmed;
90
+ if (trimmed.startsWith("//")) return `https:${trimmed}`;
91
+ return void 0;
92
+ }
93
+ function mergeTatsuLayoutAttrs(params, moduleKey, context) {
94
+ const jsonAtts = moduleKey ? context?.modulesByKey.get(moduleKey) : void 0;
95
+ const pick = (name, jsonName = name) => {
96
+ const fromShortcode = extractBareOrQuotedParam(params, name);
97
+ if (!isBlankShortcodeAttr(fromShortcode)) return fromShortcode.trim();
98
+ return jsonAtts ? resolveTatsuJsonScalar(jsonAtts[jsonName]) : void 0;
99
+ };
100
+ const bgVideoMp4 = pick("bg_video_mp4_src");
101
+ const bgVideoWebm = pick("bg_video_webm_src");
102
+ const bgImage = pick("bg_image");
103
+ const overlayColor = pick("overlay_color");
104
+ const sectionHeight = pick("section_height_type");
105
+ const fullScreen = pick("full_screen");
106
+ const customHeight = pick("custom_height");
107
+ const fullscreen = sectionHeight?.toLowerCase() === "full_screen" || fullScreen === "1" || (customHeight?.includes("100vh") ?? false);
108
+ const builderLayout = jsonAtts ? resolveTatsuJsonScalar(jsonAtts.builderLayout) : void 0;
109
+ return { bgImage, bgVideoMp4, bgVideoWebm, overlayColor, fullscreen, builderLayout };
110
+ }
111
+ function appendSectionHeroAttrs(attrs, merged, params, bgParamName) {
112
+ const paramName = bgParamName ?? "bg_image";
113
+ const bgImage = normalizeHttpMediaUrl(merged.bgImage) ?? normalizeHttpMediaUrl(extractBareOrQuotedParam(params, paramName)) ?? normalizeHttpMediaUrl(extractQuotedParam(params, paramName));
114
+ if (bgImage) {
75
115
  attrs.push(`data-bg-image="${escapeLayoutAttr(bgImage)}"`);
76
116
  }
117
+ const videoUrl = normalizeHttpMediaUrl(merged.bgVideoMp4) ?? normalizeHttpMediaUrl(merged.bgVideoWebm);
118
+ if (videoUrl) {
119
+ attrs.push('data-wp-hero-type="video"');
120
+ attrs.push(`data-video-url="${escapeLayoutAttr(videoUrl)}"`);
121
+ }
122
+ if (merged.fullscreen) {
123
+ attrs.push('data-layout-mode="fullscreen"');
124
+ }
125
+ if (merged.overlayColor) {
126
+ attrs.push(`data-overlay-color="${escapeLayoutAttr(merged.overlayColor)}"`);
127
+ }
128
+ }
129
+ function buildTatsuPageContext(jsonText) {
130
+ try {
131
+ const parsed = JSON.parse(jsonText);
132
+ const modulesByKey = /* @__PURE__ */ new Map();
133
+ walkTatsuModules(parsed, modulesByKey);
134
+ return modulesByKey.size > 0 ? { modulesByKey } : void 0;
135
+ } catch {
136
+ return void 0;
137
+ }
138
+ }
139
+ function walkTatsuModules(node, index) {
140
+ if (!node) return;
141
+ if (Array.isArray(node)) {
142
+ for (const child of node) walkTatsuModules(child, index);
143
+ return;
144
+ }
145
+ if (typeof node !== "object") return;
146
+ const obj = node;
147
+ const atts = obj.atts;
148
+ const keyFromAtts = atts && typeof atts === "object" ? resolveTatsuJsonScalar(atts.key) : void 0;
149
+ const keyFromId = typeof obj.id === "string" ? obj.id.trim() : void 0;
150
+ const key = keyFromAtts || keyFromId;
151
+ if (key && atts && typeof atts === "object") {
152
+ index.set(key, atts);
153
+ }
154
+ if (obj.inner) walkTatsuModules(obj.inner, index);
155
+ }
156
+ function openSectionDiv(params, bgParamName) {
157
+ const attrs = ['data-layout="section"'];
158
+ const moduleKey = extractBareOrQuotedParam(params, "key");
159
+ const merged = mergeTatsuLayoutAttrs(params, moduleKey, activeTatsuContext);
160
+ appendSectionHeroAttrs(attrs, merged, params, bgParamName);
77
161
  return `<div ${attrs.join(" ")}>`;
78
162
  }
79
163
  function openRowDiv(params, colsParamName) {
@@ -543,10 +627,19 @@ function normalizeShortcodeCount(raw) {
543
627
  }
544
628
  function inferBlogListingLayout(params) {
545
629
  const raw = extractBareOrQuotedParam(params, "builderLayout") ?? extractBareOrQuotedParam(params, "layout") ?? extractBareOrQuotedParam(params, "style");
546
- if (!raw) return "grid";
547
- const normalized = raw.trim().toLowerCase();
548
- if (normalized === "list" || normalized === "grid" || normalized === "featured" || normalized === "sidebar") {
549
- return normalized;
630
+ if (raw) {
631
+ const normalized = raw.trim().toLowerCase();
632
+ if (normalized === "list" || normalized === "grid" || normalized === "featured" || normalized === "sidebar") {
633
+ return normalized;
634
+ }
635
+ }
636
+ const moduleKey = extractBareOrQuotedParam(params, "key");
637
+ if (moduleKey && activeTatsuContext) {
638
+ const merged = mergeTatsuLayoutAttrs(params, moduleKey, activeTatsuContext);
639
+ const fromJson = merged.builderLayout?.trim().toLowerCase();
640
+ if (fromJson === "list" || fromJson === "grid" || fromJson === "featured" || fromJson === "sidebar") {
641
+ return fromJson;
642
+ }
550
643
  }
551
644
  return "grid";
552
645
  }
@@ -790,42 +883,47 @@ function flattenWordPressBuilders(content, options = {}) {
790
883
  if (!content.trim()) {
791
884
  return { html: content, detectedThemes: [] };
792
885
  }
793
- const registry = options.registry ?? WORDPRESS_BUILDER_REGISTRY;
794
- const themes = detectThemes(content, registry);
795
- const widgetRegistry = options.widgetRegistry ?? WORDPRESS_WIDGET_REGISTRY;
796
- let html = flattenWordPressWidgets(content, widgetRegistry);
797
- for (const theme of themes) {
798
- for (const rule of theme.wrapperRules ?? []) {
799
- html = convertWrapperRule(html, rule);
800
- }
801
- for (const rule of theme.textRules ?? []) {
802
- html = convertTextRule(html, rule);
803
- }
804
- for (const rule of theme.urlRules ?? []) {
805
- html = convertUrlRule(html, rule);
806
- }
807
- for (const rule of theme.placeholderRules ?? []) {
808
- html = convertPlaceholderRule(html, rule);
809
- }
810
- for (const rule of theme.iconImageRules ?? []) {
811
- html = convertIconImageRule(html, rule);
812
- }
813
- for (const layoutMap of collectLayoutMaps(theme)) {
814
- html = applyStructuralLayoutMap(html, layoutMap);
815
- }
816
- for (const prefix of theme.scaffoldingPrefixes ?? []) {
817
- html = stripScaffoldingPrefix(html, prefix);
818
- }
819
- if (theme.legacyScaffoldingTokens?.length) {
820
- html = stripLegacyTokens(html, theme.legacyScaffoldingTokens);
886
+ activeTatsuContext = options.tatsuPageContent ? buildTatsuPageContext(options.tatsuPageContent) : void 0;
887
+ try {
888
+ const registry = options.registry ?? WORDPRESS_BUILDER_REGISTRY;
889
+ const themes = detectThemes(content, registry);
890
+ const widgetRegistry = options.widgetRegistry ?? WORDPRESS_WIDGET_REGISTRY;
891
+ let html = flattenWordPressWidgets(content, widgetRegistry);
892
+ for (const theme of themes) {
893
+ for (const rule of theme.wrapperRules ?? []) {
894
+ html = convertWrapperRule(html, rule);
895
+ }
896
+ for (const rule of theme.textRules ?? []) {
897
+ html = convertTextRule(html, rule);
898
+ }
899
+ for (const rule of theme.urlRules ?? []) {
900
+ html = convertUrlRule(html, rule);
901
+ }
902
+ for (const rule of theme.placeholderRules ?? []) {
903
+ html = convertPlaceholderRule(html, rule);
904
+ }
905
+ for (const rule of theme.iconImageRules ?? []) {
906
+ html = convertIconImageRule(html, rule);
907
+ }
908
+ for (const layoutMap of collectLayoutMaps(theme)) {
909
+ html = applyStructuralLayoutMap(html, layoutMap);
910
+ }
911
+ for (const prefix of theme.scaffoldingPrefixes ?? []) {
912
+ html = stripScaffoldingPrefix(html, prefix);
913
+ }
914
+ if (theme.legacyScaffoldingTokens?.length) {
915
+ html = stripLegacyTokens(html, theme.legacyScaffoldingTokens);
916
+ }
821
917
  }
918
+ html = flattenWordPressWidgets(html, widgetRegistry);
919
+ html = html.replace(/\n{3,}/g, "\n\n").trim();
920
+ return {
921
+ html,
922
+ detectedThemes: themes.map((theme) => theme.id)
923
+ };
924
+ } finally {
925
+ activeTatsuContext = void 0;
822
926
  }
823
- html = flattenWordPressWidgets(html, widgetRegistry);
824
- html = html.replace(/\n{3,}/g, "\n\n").trim();
825
- return {
826
- html,
827
- detectedThemes: themes.map((theme) => theme.id)
828
- };
829
927
  }
830
928
 
831
929
  export {
@@ -834,4 +932,4 @@ export {
834
932
  normalizeVideoEmbedUrl,
835
933
  flattenWordPressBuilders
836
934
  };
837
- //# sourceMappingURL=chunk-4XZK55RW.js.map
935
+ //# sourceMappingURL=chunk-ZK3LH7PO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/parsers/wordpress/builders/flatten.ts"],"sourcesContent":["import { normalizeAssetUrl } from \"../../../lib/media-urls.js\";\nimport type {\n BuilderIconImageRule,\n BuilderPlaceholderRule,\n BuilderTextRule,\n BuilderThemeConfig,\n BuilderUrlRule,\n BuilderWrapperRule,\n FractionalLayoutMap,\n ExtendedPrefixedLayoutMap,\n PrefixedLayoutMap,\n StructuralLayoutMap,\n TextHtmlTag,\n BuilderHtmlTag,\n} from \"./registry.js\";\nimport {\n WORDPRESS_BUILDER_REGISTRY,\n WORDPRESS_WIDGET_REGISTRY,\n WP_WIDGET_PLACEHOLDER,\n type WordPressWidgetRegistry,\n} from \"./registry.js\";\n\nexport interface FlattenWordPressBuildersOptions {\n registry?: BuilderThemeConfig[];\n widgetRegistry?: WordPressWidgetRegistry;\n /** Serialized `_tatsu_page_content` JSON — fills blank section/column attrs (OSS-28). */\n tatsuPageContent?: string;\n}\n\nexport interface TatsuPageContext {\n modulesByKey: Map<string, Record<string, unknown>>;\n}\n\nexport interface FlattenWordPressBuildersResult {\n html: string;\n detectedThemes: string[];\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\n/** Read a quoted shortcode attribute value (supports multiline). */\nexport function extractQuotedParam(params: string, name: string): string | undefined {\n const pattern = new RegExp(`\\\\b${escapeRegExp(name)}\\\\s*=\\\\s*`, \"i\");\n const match = pattern.exec(params);\n if (!match) return undefined;\n\n let index = match.index + match[0].length;\n while (index < params.length && /\\s/.test(params[index]!)) index += 1;\n\n if (params.slice(index, index + 6) === \"&quot;\") {\n index += 6;\n let value = \"\";\n while (index < params.length) {\n if (params.slice(index, index + 6) === \"&quot;\") break;\n value += params[index]!;\n index += 1;\n }\n const trimmed = value.trim();\n return trimmed || undefined;\n }\n\n const quote = params[index];\n if (quote !== '\"' && quote !== \"'\") return undefined;\n index += 1;\n\n let value = \"\";\n while (index < params.length) {\n const char = params[index]!;\n if (char === \"\\\\\" && index + 1 < params.length) {\n value += params[index + 1];\n index += 2;\n continue;\n }\n if (char === quote) break;\n value += char;\n index += 1;\n }\n\n const trimmed = value.trim();\n return trimmed || undefined;\n}\n\nfunction escapeLayoutAttr(value: string): string {\n return value\n .replace(/&/g, \"&amp;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/</g, \"&lt;\");\n}\n\n/** Parse `width=\"1/2\"` / `columns=\"1/3+1/3+1/3\"` style strings → percentage or column count. */\nexport function parseFractionWidth(fraction: string | undefined): string | undefined {\n if (!fraction?.trim()) return undefined;\n const trimmed = fraction.trim();\n const match = trimmed.match(/^(\\d+)\\s*\\/\\s*(\\d+)$/);\n if (!match) return undefined;\n const numerator = Number(match[1]);\n const denominator = Number(match[2]);\n if (!Number.isFinite(numerator) || !Number.isFinite(denominator) || denominator <= 0) {\n return undefined;\n }\n const percent = (numerator / denominator) * 100;\n const rounded = Math.round(percent * 100) / 100;\n return `${rounded % 1 === 0 ? rounded.toFixed(0) : rounded}%`;\n}\n\n/** Parse row `layout=\"1/2+1/2\"` style strings → column count. */\nexport function parseRowLayoutCols(layout: string | undefined): number | undefined {\n if (!layout?.trim()) return undefined;\n const parts = layout.split(\"+\").map((part) => part.trim()).filter(Boolean);\n return parts.length > 1 ? parts.length : undefined;\n}\n\nlet activeTatsuContext: TatsuPageContext | undefined;\n\nfunction isBlankShortcodeAttr(value: string | undefined): boolean {\n return !value?.trim();\n}\n\nfunction resolveTatsuJsonScalar(value: unknown): string | undefined {\n if (typeof value === \"string\") {\n const trimmed = value.trim();\n return trimmed || undefined;\n }\n if (typeof value === \"number\" && Number.isFinite(value)) return String(value);\n if (value && typeof value === \"object\" && \"d\" in value) {\n return resolveTatsuJsonScalar((value as Record<string, unknown>).d);\n }\n return undefined;\n}\n\nfunction normalizeHttpMediaUrl(url: string | undefined): string | undefined {\n if (!url?.trim()) return undefined;\n const trimmed = url.trim();\n if (trimmed.startsWith(\"http\")) return trimmed;\n if (trimmed.startsWith(\"//\")) return `https:${trimmed}`;\n return undefined;\n}\n\ninterface MergedTatsuLayoutAttrs {\n bgImage?: string;\n bgVideoMp4?: string;\n bgVideoWebm?: string;\n overlayColor?: string;\n fullscreen?: boolean;\n builderLayout?: string;\n}\n\nfunction mergeTatsuLayoutAttrs(\n params: string,\n moduleKey: string | undefined,\n context: TatsuPageContext | undefined,\n): MergedTatsuLayoutAttrs {\n const jsonAtts = moduleKey ? context?.modulesByKey.get(moduleKey) : undefined;\n\n const pick = (name: string, jsonName = name): string | undefined => {\n const fromShortcode = extractBareOrQuotedParam(params, name);\n if (!isBlankShortcodeAttr(fromShortcode)) return fromShortcode!.trim();\n return jsonAtts ? resolveTatsuJsonScalar(jsonAtts[jsonName]) : undefined;\n };\n\n const bgVideoMp4 = pick(\"bg_video_mp4_src\");\n const bgVideoWebm = pick(\"bg_video_webm_src\");\n const bgImage = pick(\"bg_image\");\n const overlayColor = pick(\"overlay_color\");\n\n const sectionHeight = pick(\"section_height_type\");\n const fullScreen = pick(\"full_screen\");\n const customHeight = pick(\"custom_height\");\n const fullscreen =\n sectionHeight?.toLowerCase() === \"full_screen\" ||\n fullScreen === \"1\" ||\n (customHeight?.includes(\"100vh\") ?? false);\n\n const builderLayout = jsonAtts ? resolveTatsuJsonScalar(jsonAtts.builderLayout) : undefined;\n\n return { bgImage, bgVideoMp4, bgVideoWebm, overlayColor, fullscreen, builderLayout };\n}\n\nfunction appendSectionHeroAttrs(attrs: string[], merged: MergedTatsuLayoutAttrs, params: string, bgParamName?: string): void {\n const paramName = bgParamName ?? \"bg_image\";\n const bgImage =\n normalizeHttpMediaUrl(merged.bgImage) ??\n normalizeHttpMediaUrl(extractBareOrQuotedParam(params, paramName)) ??\n normalizeHttpMediaUrl(extractQuotedParam(params, paramName));\n if (bgImage) {\n attrs.push(`data-bg-image=\"${escapeLayoutAttr(bgImage)}\"`);\n }\n\n const videoUrl =\n normalizeHttpMediaUrl(merged.bgVideoMp4) ?? normalizeHttpMediaUrl(merged.bgVideoWebm);\n if (videoUrl) {\n attrs.push('data-wp-hero-type=\"video\"');\n attrs.push(`data-video-url=\"${escapeLayoutAttr(videoUrl)}\"`);\n }\n\n if (merged.fullscreen) {\n attrs.push('data-layout-mode=\"fullscreen\"');\n }\n\n if (merged.overlayColor) {\n attrs.push(`data-overlay-color=\"${escapeLayoutAttr(merged.overlayColor)}\"`);\n }\n}\n\n/** Index Tatsu modules by `key` / `id` for shortcode ↔ JSON merge (OSS-28). */\nexport function buildTatsuPageContext(jsonText: string): TatsuPageContext | undefined {\n try {\n const parsed = JSON.parse(jsonText) as unknown;\n const modulesByKey = new Map<string, Record<string, unknown>>();\n walkTatsuModules(parsed, modulesByKey);\n return modulesByKey.size > 0 ? { modulesByKey } : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction walkTatsuModules(node: unknown, index: Map<string, Record<string, unknown>>): void {\n if (!node) return;\n if (Array.isArray(node)) {\n for (const child of node) walkTatsuModules(child, index);\n return;\n }\n if (typeof node !== \"object\") return;\n\n const obj = node as Record<string, unknown>;\n const atts = obj.atts;\n const keyFromAtts =\n atts && typeof atts === \"object\"\n ? resolveTatsuJsonScalar((atts as Record<string, unknown>).key)\n : undefined;\n const keyFromId = typeof obj.id === \"string\" ? obj.id.trim() : undefined;\n const key = keyFromAtts || keyFromId;\n\n if (key && atts && typeof atts === \"object\") {\n index.set(key, atts as Record<string, unknown>);\n }\n\n if (obj.inner) walkTatsuModules(obj.inner, index);\n}\n\nfunction openSectionDiv(params: string, bgParamName?: string): string {\n const attrs = ['data-layout=\"section\"'];\n const moduleKey = extractBareOrQuotedParam(params, \"key\");\n const merged = mergeTatsuLayoutAttrs(params, moduleKey, activeTatsuContext);\n appendSectionHeroAttrs(attrs, merged, params, bgParamName);\n return `<div ${attrs.join(\" \")}>`;\n}\n\nfunction openRowDiv(params: string, colsParamName?: string): string {\n const attrs = ['data-layout=\"row\"'];\n const cols = parseRowLayoutCols(extractQuotedParam(params, colsParamName ?? \"layout\"));\n if (cols) attrs.push(`data-cols=\"${cols}\"`);\n return `<div ${attrs.join(\" \")}>`;\n}\n\nfunction openColumnDiv(params: string, widthParamName?: string): string {\n const attrs = ['data-layout=\"column\"'];\n const width = parseFractionWidth(extractQuotedParam(params, widthParamName ?? \"width\"));\n if (width) attrs.push(`data-col-width=\"${width}\"`);\n return `<div ${attrs.join(\" \")}>`;\n}\n\nfunction applyPrefixedLayoutMap(content: string, map: PrefixedLayoutMap): string {\n let html = content;\n html = html.replace(map.sectionRegex, (_, params: string) => openSectionDiv(params, map.bgParamName));\n html = html.replace(map.sectionCloseRegex, \"</div>\");\n html = html.replace(map.rowRegex, (_, params: string) => openRowDiv(params, map.colsParamName));\n html = html.replace(map.rowCloseRegex, \"</div>\");\n html = html.replace(map.columnRegex, '<div data-layout=\"column\">');\n html = html.replace(map.columnCloseRegex, \"</div>\");\n return html;\n}\n\nfunction applyFractionalLayoutMap(content: string, map: FractionalLayoutMap): string {\n let html = content;\n html = html.replace(map.sectionRegex, (_, params: string) => openSectionDiv(params, map.bgParamName));\n html = html.replace(map.sectionCloseRegex, \"</div>\");\n html = html.replace(map.rowRegex, (_, params: string) => openRowDiv(params));\n html = html.replace(map.rowCloseRegex, \"</div>\");\n\n for (let index = 0; index < map.columnTokens.length; index += 1) {\n const token = map.columnTokens[index]!;\n const width = map.columnWidths[token];\n const openRegex = map.columnOpenRegexes[index]!;\n const closeRegex = map.columnCloseRegexes[index]!;\n html = html.replace(openRegex, () => {\n const attrs = ['data-layout=\"column\"'];\n if (width) attrs.push(`data-col-width=\"${width}\"`);\n return `<div ${attrs.join(\" \")}>`;\n });\n html = html.replace(closeRegex, \"</div>\");\n }\n return html;\n}\n\nfunction applyExtendedPrefixedLayoutMap(content: string, map: ExtendedPrefixedLayoutMap): string {\n let html = content;\n const levels = [...map.levels].sort((left, right) => {\n const leftMax = Math.max(...left.tokens.map((token) => token.length));\n const rightMax = Math.max(...right.tokens.map((token) => token.length));\n return rightMax - leftMax;\n });\n\n for (const level of levels) {\n const tokens = [...level.tokens].sort((left, right) => right.length - left.length);\n for (const token of tokens) {\n const openRegex = new RegExp(`\\\\[${escapeRegExp(token)}\\\\b([^\\\\]]*)\\\\]`, \"gi\");\n const closeRegex = new RegExp(`\\\\[\\\\/${escapeRegExp(token)}\\\\b[^\\\\]]*\\\\]`, \"gi\");\n\n html = html.replace(openRegex, (_, params: string) => {\n switch (level.role) {\n case \"section\":\n return openSectionDiv(params, level.bgParamName);\n case \"row\":\n return openRowDiv(params, level.colsParamName);\n case \"column\":\n return openColumnDiv(params, level.widthParamName);\n }\n });\n html = html.replace(closeRegex, \"</div>\");\n }\n }\n\n return html;\n}\n\n/** Map builder layout shortcodes → editor-neutral `data-layout` HTML. */\nexport function applyStructuralLayoutMap(content: string, map: StructuralLayoutMap): string {\n switch (map.kind) {\n case \"prefixed\":\n return applyPrefixedLayoutMap(content, map);\n case \"fractional\":\n return applyFractionalLayoutMap(content, map);\n case \"extended-prefixed\":\n return applyExtendedPrefixedLayoutMap(content, map);\n }\n}\n\nfunction collectLayoutMaps(theme: BuilderThemeConfig): StructuralLayoutMap[] {\n const maps: StructuralLayoutMap[] = [];\n if (theme.layoutMap) maps.push(theme.layoutMap);\n if (theme.layoutMaps?.length) maps.push(...theme.layoutMaps);\n return maps;\n}\n\nfunction extractShortcodeParam(params: string, names: string[]): string | undefined {\n for (const name of names) {\n const value = extractQuotedParam(params, name);\n if (value) return value;\n }\n return undefined;\n}\n\nfunction escapeHtmlText(text: string): string {\n return text\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\");\n}\n\nfunction textToHtml(text: string, tag: TextHtmlTag): string {\n const paragraphs = text.split(/\\n{2,}/).map((part) => part.trim()).filter(Boolean);\n if (paragraphs.length === 0) return \"\";\n\n return paragraphs\n .map((paragraph) => {\n const inner = escapeHtmlText(paragraph).replace(/\\n/g, \"<br />\");\n return `<${tag}>${inner}</${tag}>`;\n })\n .join(\"\\n\");\n}\n\nfunction emitHtmlTag(tag: BuilderHtmlTag, url: string): string {\n const normalized = normalizeAssetUrl(url) ?? url;\n const escaped = normalized\n .replace(/&/g, \"&amp;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/</g, \"&lt;\");\n\n switch (tag) {\n case \"img\":\n return `<img src=\"${escaped}\" alt=\"\" />`;\n case \"video\":\n return `<video src=\"${escaped}\" controls></video>`;\n case \"iframe\":\n return `<iframe src=\"${escaped}\" loading=\"lazy\"></iframe>`;\n }\n}\n\nfunction convertUrlRule(content: string, rule: BuilderUrlRule): string {\n const prefix = escapeRegExp(rule.shortcodePrefix);\n const pattern = new RegExp(\n `\\\\[${prefix}\\\\b([^\\\\]]*)\\\\]\\\\s*(?:\\\\[\\\\/${prefix}\\\\b[^\\\\]]*\\\\])?`,\n \"gi\",\n );\n\n return content.replace(pattern, (block, params: string) => {\n const url = extractShortcodeParam(params, rule.urlParams);\n if (!url) return block;\n return emitHtmlTag(rule.tag, url);\n });\n}\n\nfunction convertTextRule(content: string, rule: BuilderTextRule): string {\n const prefix = escapeRegExp(rule.shortcodePrefix);\n const pattern = new RegExp(\n `\\\\[${prefix}\\\\b([^\\\\]]*)\\\\]\\\\s*(?:\\\\[\\\\/${prefix}\\\\b[^\\\\]]*\\\\])?`,\n \"gis\",\n );\n\n return content.replace(pattern, (block, params: string) => {\n const parts: string[] = [];\n for (const field of rule.fields) {\n const text = extractQuotedParam(params, field.param);\n if (!text) continue;\n const html = textToHtml(text, field.tag);\n if (html) parts.push(html);\n }\n return parts.length > 0 ? parts.join(\"\\n\") : block;\n });\n}\n\nfunction convertWrapperRule(content: string, rule: BuilderWrapperRule): string {\n const prefix = escapeRegExp(rule.shortcodePrefix);\n const pattern = new RegExp(\n `\\\\[${prefix}\\\\b([^\\\\]]*)\\\\]([\\\\s\\\\S]*?)\\\\[\\\\/${prefix}\\\\b[^\\\\]]*\\\\]`,\n \"gi\",\n );\n\n return content.replace(pattern, (_, params: string, inner: string) => {\n const parts: string[] = [];\n if (rule.urlParams?.length) {\n const url = extractShortcodeParam(params, rule.urlParams);\n if (url) parts.push(emitHtmlTag(\"img\", url));\n }\n parts.push(inner.trim());\n return parts.filter(Boolean).join(\"\\n\");\n });\n}\n\nfunction isPlaceholderImageUrl(url: string): boolean {\n return /placehold\\.it|placeholder\\.com|via\\.placeholder/i.test(url);\n}\n\nfunction convertIconImageRule(content: string, rule: BuilderIconImageRule): string {\n const prefix = escapeRegExp(rule.shortcodePrefix);\n const pattern = new RegExp(\n `\\\\[${prefix}\\\\b([^\\\\]]*)\\\\]\\\\s*(?:\\\\[\\\\/${prefix}\\\\b[^\\\\]]*\\\\])?`,\n \"gi\",\n );\n\n return content.replace(pattern, (_, params: string) => {\n const iconImage =\n extractQuotedParam(params, rule.imageParam) ?? extractQuotedParam(params, \"image\");\n if (!iconImage?.startsWith(\"http\") || isPlaceholderImageUrl(iconImage)) {\n return \"\";\n }\n const img = emitHtmlTag(\"img\", iconImage);\n if (rule.hrefParam) {\n const href = extractQuotedParam(params, rule.hrefParam);\n if (href?.startsWith(\"http\")) {\n const escapedHref = href\n .replace(/&/g, \"&amp;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/</g, \"&lt;\");\n return `<a href=\"${escapedHref}\">${img}</a>`;\n }\n }\n return img;\n });\n}\n\nfunction convertPlaceholderRule(content: string, rule: BuilderPlaceholderRule): string {\n const prefix = escapeRegExp(rule.shortcodePrefix);\n const pattern = new RegExp(\n `\\\\[${prefix}\\\\b([^\\\\]]*)\\\\]\\\\s*(?:\\\\[\\\\/${prefix}\\\\b[^\\\\]]*\\\\])?`,\n \"gi\",\n );\n return content.replace(pattern, rule.html);\n}\n\nfunction stripScaffoldingPrefix(content: string, prefix: string): string {\n const escaped = escapeRegExp(prefix);\n const opener = new RegExp(`\\\\[${escaped}[a-z0-9_-]*[^\\\\]]*\\\\]`, \"gi\");\n const closer = new RegExp(`\\\\[\\\\/${escaped}[a-z0-9_-]*[^\\\\]]*\\\\]`, \"gi\");\n return content.replace(opener, \"\").replace(closer, \"\");\n}\n\nfunction stripLegacyTokens(content: string, tokens: string[]): string {\n let result = content;\n for (const token of tokens) {\n const escaped = escapeRegExp(token);\n const opener = new RegExp(`\\\\[${escaped}\\\\b[^\\\\]]*\\\\]`, \"gi\");\n const closer = new RegExp(`\\\\[\\\\/${escaped}\\\\b[^\\\\]]*\\\\]`, \"gi\");\n result = result.replace(opener, \"\").replace(closer, \"\");\n }\n return result;\n}\n\nfunction detectThemes(content: string, registry: BuilderThemeConfig[]): BuilderThemeConfig[] {\n return registry.filter((theme) => theme.detect.test(content));\n}\n\nfunction extractBareOrQuotedParam(params: string, name: string): string | undefined {\n const quoted = extractQuotedParam(params, name);\n if (quoted) return quoted;\n const pattern = new RegExp(`\\\\b${escapeRegExp(name)}\\\\s*=\\\\s*([^\\\\s\"'\\\\]]+)`, \"i\");\n const match = pattern.exec(params);\n return match?.[1]?.trim() || undefined;\n}\n\nexport type SliderPluginId = \"revslider\" | \"masterslider\";\n\nexport interface ParsedSliderReference {\n plugin: SliderPluginId;\n alias: string;\n slidertitle?: string;\n}\n\n/** Parse `[rev_slider …]` / `[masterslider …]` markup (OSS-27 meta + in-body stubs). */\nexport function parseSliderShortcodeMarkup(markup: string): ParsedSliderReference | undefined {\n const trimmed = markup.trim();\n if (!trimmed) return undefined;\n\n const revMatch = trimmed.match(/\\[rev_slider\\b([^\\]]*)\\]/i);\n if (revMatch) {\n const params = revMatch[1] ?? \"\";\n const alias = extractBareOrQuotedParam(params, \"alias\");\n if (alias) {\n return {\n plugin: \"revslider\",\n alias,\n slidertitle: extractBareOrQuotedParam(params, \"slidertitle\"),\n };\n }\n }\n\n const masterMatch = trimmed.match(/\\[masterslider\\b([^\\]]*)\\]/i);\n if (masterMatch) {\n const params = masterMatch[1] ?? \"\";\n const alias = extractBareOrQuotedParam(params, \"alias\");\n if (alias) return { plugin: \"masterslider\", alias };\n }\n\n return undefined;\n}\n\n/** Parse Oshine `_slider` meta (`revslider_alias`, `masterslider_alias`, or `none`). */\nexport function parseSliderMetaValue(value: string): ParsedSliderReference | undefined {\n const trimmed = value.trim();\n if (!trimmed || trimmed.toLowerCase() === \"none\") return undefined;\n\n const lower = trimmed.toLowerCase();\n if (lower.startsWith(\"revslider_\")) {\n const alias = trimmed.slice(\"revslider_\".length).trim();\n if (alias) return { plugin: \"revslider\", alias };\n }\n if (lower.startsWith(\"masterslider_\")) {\n const alias = trimmed.slice(\"masterslider_\".length).trim();\n if (alias) return { plugin: \"masterslider\", alias };\n }\n\n return undefined;\n}\n\nfunction emitWidgetStub(\n widget: string,\n attrs: Record<string, string | undefined>,\n tag: \"div\" | \"section\" = \"div\",\n): string {\n const parts = [`data-wp-widget=\"${escapeLayoutAttr(widget)}\"`];\n for (const [key, value] of Object.entries(attrs)) {\n if (value) parts.push(`${key}=\"${escapeLayoutAttr(value)}\"`);\n }\n return `<${tag} ${parts.join(\" \")}>${WP_WIDGET_PLACEHOLDER}</${tag}>`;\n}\n\n/** Normalize YouTube/Vimeo share URLs to canonical embed URLs. */\nexport function normalizeVideoEmbedUrl(\n raw: string,\n): { provider: \"youtube\" | \"vimeo\" | \"external\"; embedUrl: string } | undefined {\n const trimmed = raw.trim();\n if (!trimmed || trimmed.startsWith(\"data:\")) return undefined;\n\n try {\n const url = new URL(trimmed.startsWith(\"//\") ? `https:${trimmed}` : trimmed);\n const host = url.hostname.replace(/^www\\./, \"\").replace(/^m\\./, \"\");\n\n if (host === \"youtu.be\") {\n const id = url.pathname.split(\"/\").filter(Boolean)[0];\n if (id) {\n return { provider: \"youtube\", embedUrl: `https://www.youtube-nocookie.com/embed/${id}` };\n }\n }\n\n if (host === \"youtube.com\" || host === \"youtube-nocookie.com\") {\n const embedMatch = url.pathname.match(/\\/embed\\/([^/?#]+)/);\n if (embedMatch?.[1]) {\n const start = url.searchParams.get(\"start\");\n const suffix = start ? `?start=${start}` : \"\";\n return {\n provider: \"youtube\",\n embedUrl: `https://www.youtube-nocookie.com/embed/${embedMatch[1]}${suffix}`,\n };\n }\n const videoId = url.searchParams.get(\"v\");\n if (videoId) {\n const t = url.searchParams.get(\"t\") ?? url.searchParams.get(\"start\");\n const startSeconds = t?.endsWith(\"s\") ? t.slice(0, -1) : t;\n const suffix = startSeconds ? `?start=${startSeconds}` : \"\";\n return {\n provider: \"youtube\",\n embedUrl: `https://www.youtube-nocookie.com/embed/${videoId}${suffix}`,\n };\n }\n }\n\n if (host === \"vimeo.com\") {\n const segments = url.pathname.split(\"/\").filter(Boolean);\n const id = segments[segments.length - 1];\n if (id && /^\\d+$/.test(id)) {\n return { provider: \"vimeo\", embedUrl: `https://player.vimeo.com/video/${id}` };\n }\n }\n\n if (host === \"player.vimeo.com\") {\n const match = url.pathname.match(/\\/video\\/(\\d+)/);\n if (match?.[1]) {\n return { provider: \"vimeo\", embedUrl: `https://player.vimeo.com/video/${match[1]}` };\n }\n }\n } catch {\n return undefined;\n }\n\n return undefined;\n}\n\nfunction emitVideoWidgetFromParams(params: string, inner: string): string {\n const url =\n extractShortcodeParam(params, [\"url\", \"src\", \"video\", \"link\", \"youtube_url\", \"vimeo_url\"]) ??\n inner.trim().match(/^https?:\\/\\/\\S+/)?.[0];\n\n if (!url) {\n return emitWidgetStub(\"video\", { \"data-video-provider\": \"external\" });\n }\n\n const normalized = normalizeVideoEmbedUrl(url);\n if (normalized) {\n return emitWidgetStub(\"video\", {\n \"data-video-provider\": normalized.provider,\n \"data-embed-url\": normalized.embedUrl,\n });\n }\n\n if (/\\.(mp4|webm|ogg)(\\?|#|$)/i.test(url)) {\n return emitHtmlTag(\"video\", url);\n }\n\n return emitWidgetStub(\"video\", {\n \"data-video-provider\": \"external\",\n \"data-embed-url\": url,\n });\n}\n\n/** Build a Google Maps iframe embed URL from map shortcode params. */\nexport function buildGoogleMapsEmbedUrlFromMapParams(params: string): {\n embedUrl?: string;\n lat?: string;\n lng?: string;\n query?: string;\n} {\n const direct = extractShortcodeParam(params, [\n \"embed_url\",\n \"url\",\n \"src\",\n \"map_url\",\n \"iframe_url\",\n \"embed\",\n ]);\n if (direct && /google\\.com\\/maps|maps\\.google\\.com/i.test(direct)) {\n return { embedUrl: direct.trim() };\n }\n\n const lat =\n extractBareOrQuotedParam(params, \"lat\") ??\n extractBareOrQuotedParam(params, \"latitude\") ??\n extractBareOrQuotedParam(params, \"map_lat\");\n const lng =\n extractBareOrQuotedParam(params, \"lng\") ??\n extractBareOrQuotedParam(params, \"longitude\") ??\n extractBareOrQuotedParam(params, \"map_lng\");\n const address =\n extractBareOrQuotedParam(params, \"address\") ??\n extractBareOrQuotedParam(params, \"map_address\") ??\n extractBareOrQuotedParam(params, \"location\") ??\n extractBareOrQuotedParam(params, \"map_location\") ??\n extractBareOrQuotedParam(params, \"q\");\n\n if (lat && lng) {\n const zoom = extractBareOrQuotedParam(params, \"zoom\") ?? \"14\";\n return {\n embedUrl: `https://maps.google.com/maps?q=${encodeURIComponent(`${lat},${lng}`)}&z=${zoom}&output=embed`,\n lat,\n lng,\n };\n }\n\n if (address) {\n return {\n embedUrl: `https://maps.google.com/maps?q=${encodeURIComponent(address)}&output=embed`,\n query: address,\n };\n }\n\n return {};\n}\n\nfunction flattenMapShortcodes(content: string, widgetRegistry: WordPressWidgetRegistry): string {\n let html = content;\n for (const prefix of widgetRegistry.mapShortcodePrefixes) {\n const pattern = new RegExp(\n `\\\\[${escapeRegExp(prefix)}\\\\b([^\\\\]]*)\\\\]\\\\s*(?:\\\\[\\\\/${escapeRegExp(prefix)}\\\\b[^\\\\]]*\\\\])?`,\n \"gi\",\n );\n html = html.replace(pattern, (_, params: string) => {\n const resolved = buildGoogleMapsEmbedUrlFromMapParams(params);\n return emitWidgetStub(\"map\", {\n ...(resolved.embedUrl ? { \"data-embed-url\": resolved.embedUrl } : {}),\n ...(resolved.lat ? { \"data-wp-map-lat\": resolved.lat } : {}),\n ...(resolved.lng ? { \"data-wp-map-lng\": resolved.lng } : {}),\n ...(resolved.query ? { \"data-wp-map-query\": resolved.query } : {}),\n });\n });\n }\n return html;\n}\n\nfunction flattenContactFormShortcodes(content: string, widgetRegistry: WordPressWidgetRegistry): string {\n let html = content;\n for (const rule of widgetRegistry.contactFormRules) {\n const pattern = new RegExp(\n `\\\\[${escapeRegExp(rule.tag)}\\\\b([^\\\\]]*)\\\\]\\\\s*(?:\\\\[\\\\/${escapeRegExp(rule.tag)}\\\\b[^\\\\]]*\\\\])?`,\n \"gi\",\n );\n html = html.replace(pattern, (_, params: string) => {\n const id = extractBareOrQuotedParam(params, rule.idParam);\n return emitWidgetStub(\n \"contact-form\",\n {\n \"data-wp-form-source\": rule.source,\n ...(id ? { \"data-wp-form-id\": id } : {}),\n },\n \"section\",\n );\n });\n }\n return html;\n}\n\nfunction emitInlineGalleryFromIds(idList: string[]): string {\n const images = idList\n .map((id) => `<img data-wp-attachment-id=\"${escapeLayoutAttr(id)}\" alt=\"\" />`)\n .join(\"\");\n return `<figure data-wp-inline-gallery>${images}</figure>`;\n}\n\nfunction parseGalleryAttachmentIds(params: string): string[] | undefined {\n const ids = extractBareOrQuotedParam(params, \"ids\");\n const idList = ids\n ?.split(\",\")\n .map((part) => part.trim())\n .filter((part) => /^\\d+$/.test(part));\n return idList?.length ? idList : undefined;\n}\n\nfunction flattenIdGalleryShortcode(content: string, tag: string): string {\n const escaped = escapeRegExp(tag);\n const pattern = new RegExp(`\\\\[${escaped}\\\\b([^\\\\]]*)\\\\](?:\\\\s*\\\\[\\\\/${escaped}\\\\])?`, \"gi\");\n return content.replace(pattern, (fullMatch, params: string) => {\n const idList = parseGalleryAttachmentIds(params);\n if (idList?.length) {\n return emitInlineGalleryFromIds(idList);\n }\n return fullMatch;\n });\n}\n\nfunction flattenGalleryShortcodes(content: string, widgetRegistry: WordPressWidgetRegistry): string {\n const tag = escapeRegExp(widgetRegistry.galleryShortcode);\n const pattern = new RegExp(`\\\\[${tag}\\\\b([^\\\\]]*)\\\\](?:\\\\s*\\\\[\\\\/${tag}\\\\])?`, \"gi\");\n return content.replace(pattern, (_, params: string) => {\n const idList = parseGalleryAttachmentIds(params);\n\n if (idList?.length) {\n return emitInlineGalleryFromIds(idList);\n }\n\n const category = extractBareOrQuotedParam(params, \"category\") ?? extractBareOrQuotedParam(params, \"type\");\n return emitWidgetStub(\"portfolio\", {\n \"data-wp-gallery-dynamic\": \"1\",\n ...(category ? { \"data-wp-portfolio-category\": category } : {}),\n });\n });\n}\n\nfunction flattenIdBasedGalleryShortcodes(\n content: string,\n widgetRegistry: WordPressWidgetRegistry,\n): string {\n let html = content;\n for (const tag of widgetRegistry.idGalleryShortcodes) {\n html = flattenIdGalleryShortcode(html, tag);\n }\n return html;\n}\n\nconst SHORTCODE_WORD_COUNTS: Record<string, string> = {\n one: \"1\",\n two: \"2\",\n three: \"3\",\n four: \"4\",\n five: \"5\",\n six: \"6\",\n seven: \"7\",\n eight: \"8\",\n nine: \"9\",\n ten: \"10\",\n};\n\nfunction normalizeShortcodeCount(raw: string | undefined): string | undefined {\n if (!raw?.trim()) return undefined;\n const trimmed = raw.trim().toLowerCase();\n if (/^\\d+$/.test(trimmed)) return trimmed;\n return SHORTCODE_WORD_COUNTS[trimmed];\n}\n\nfunction inferBlogListingLayout(params: string): string {\n const raw =\n extractBareOrQuotedParam(params, \"builderLayout\") ??\n extractBareOrQuotedParam(params, \"layout\") ??\n extractBareOrQuotedParam(params, \"style\");\n if (raw) {\n const normalized = raw.trim().toLowerCase();\n if (normalized === \"list\" || normalized === \"grid\" || normalized === \"featured\" || normalized === \"sidebar\") {\n return normalized;\n }\n }\n\n const moduleKey = extractBareOrQuotedParam(params, \"key\");\n if (moduleKey && activeTatsuContext) {\n const merged = mergeTatsuLayoutAttrs(params, moduleKey, activeTatsuContext);\n const fromJson = merged.builderLayout?.trim().toLowerCase();\n if (fromJson === \"list\" || fromJson === \"grid\" || fromJson === \"featured\" || fromJson === \"sidebar\") {\n return fromJson;\n }\n }\n\n return \"grid\";\n}\n\nfunction decodeBasicHtmlEntities(text: string): string {\n return text\n .replace(/&quot;/g, '\"')\n .replace(/&apos;/g, \"'\")\n .replace(/&lt;/g, \"<\")\n .replace(/&gt;/g, \">\")\n .replace(/&amp;/g, \"&\");\n}\n\nfunction stripHtmlTags(html: string): string {\n return html.replace(/<[^>]+>/g, \" \").replace(/\\s+/g, \" \").trim();\n}\n\nfunction extractTestimonialQuoteFromInner(inner: string): string | undefined {\n const trimmed = inner.trim();\n if (!trimmed) return undefined;\n\n const paragraphMatch = trimmed.match(/<p[^>]*>([\\s\\S]*?)<\\/p>/i);\n if (paragraphMatch?.[1]) {\n const quote = decodeBasicHtmlEntities(stripHtmlTags(paragraphMatch[1])).trim();\n return quote || undefined;\n }\n\n const blockquoteMatch = trimmed.match(/<blockquote[^>]*>([\\s\\S]*?)<\\/blockquote>/i);\n if (blockquoteMatch?.[1]) {\n const quote = decodeBasicHtmlEntities(stripHtmlTags(blockquoteMatch[1])).trim();\n return quote || undefined;\n }\n\n const plain = decodeBasicHtmlEntities(stripHtmlTags(trimmed)).trim();\n return plain || undefined;\n}\n\nfunction parseTestimonialItemAttrs(\n params: string,\n inner: string,\n): Record<string, string | undefined> | null {\n const author =\n extractBareOrQuotedParam(params, \"author\") ??\n extractBareOrQuotedParam(params, \"name\");\n const role =\n extractBareOrQuotedParam(params, \"author_role\") ??\n extractBareOrQuotedParam(params, \"role\") ??\n extractBareOrQuotedParam(params, \"title\");\n const image =\n extractBareOrQuotedParam(params, \"author_image\") ??\n extractBareOrQuotedParam(params, \"image\") ??\n extractBareOrQuotedParam(params, \"avatar\");\n const quote =\n extractBareOrQuotedParam(params, \"quote\") ??\n extractBareOrQuotedParam(params, \"content\") ??\n extractTestimonialQuoteFromInner(inner);\n const rating =\n extractBareOrQuotedParam(params, \"rating\") ??\n extractBareOrQuotedParam(params, \"stars\");\n\n if (!author && !quote) return null;\n\n return {\n \"data-wp-testimonial-author\": author,\n \"data-wp-testimonial-role\": role,\n \"data-wp-testimonial-image\": image,\n \"data-wp-testimonial-quote\": quote,\n ...(rating ? { \"data-wp-testimonial-rating\": rating } : {}),\n };\n}\n\nfunction emitTestimonialItemStub(attrs: Record<string, string | undefined>): string {\n const parts: string[] = [];\n for (const [key, value] of Object.entries(attrs)) {\n if (value) parts.push(`${key}=\"${escapeLayoutAttr(value)}\"`);\n }\n return `<div ${parts.join(\" \")}>${WP_WIDGET_PLACEHOLDER}</div>`;\n}\n\nfunction emitTestimonialsWidgetStub(\n sectionAttrs: Record<string, string | undefined>,\n items: Array<Record<string, string | undefined>>,\n): string {\n const sectionParts = ['data-wp-widget=\"testimonials\"'];\n for (const [key, value] of Object.entries(sectionAttrs)) {\n if (value) sectionParts.push(`${key}=\"${escapeLayoutAttr(value)}\"`);\n }\n const children = items.map((item) => emitTestimonialItemStub(item)).join(\"\");\n return `<section ${sectionParts.join(\" \")}>${children}</section>`;\n}\n\nfunction inferTestimonialColumns(\n wrapperParams: string,\n itemCount: number,\n): string {\n const explicit =\n normalizeShortcodeCount(extractBareOrQuotedParam(wrapperParams, \"columns\")) ??\n normalizeShortcodeCount(extractBareOrQuotedParam(wrapperParams, \"col\"));\n if (explicit) return explicit;\n if (itemCount <= 1) return \"1\";\n if (itemCount === 2) return \"2\";\n if (itemCount >= 4) return \"4\";\n return \"3\";\n}\n\nfunction collectTestimonialItemsFromInner(\n inner: string,\n itemTag: string,\n): Array<Record<string, string | undefined>> {\n const escaped = escapeRegExp(itemTag);\n const pattern = new RegExp(\n `\\\\[${escaped}\\\\b([^\\\\]]*)\\\\]([\\\\s\\\\S]*?)\\\\[\\\\/${escaped}\\\\b[^\\\\]]*\\\\]`,\n \"gi\",\n );\n const items: Array<Record<string, string | undefined>> = [];\n inner.replace(pattern, (_, params: string, itemInner: string) => {\n const item = parseTestimonialItemAttrs(params, itemInner);\n if (item) items.push(item);\n return \"\";\n });\n return items;\n}\n\nfunction flattenTestimonialsShortcodes(\n content: string,\n widgetRegistry: WordPressWidgetRegistry,\n): string {\n const itemTag = widgetRegistry.testimonialItemTag;\n let html = content;\n\n for (const wrapperTag of widgetRegistry.testimonialsWrapperTags) {\n const escaped = escapeRegExp(wrapperTag);\n const pattern = new RegExp(\n `\\\\[${escaped}\\\\b([^\\\\]]*)\\\\]([\\\\s\\\\S]*?)\\\\[\\\\/${escaped}\\\\b[^\\\\]]*\\\\]`,\n \"gi\",\n );\n html = html.replace(pattern, (fullMatch, wrapperParams: string, inner: string) => {\n const items = collectTestimonialItemsFromInner(inner, itemTag);\n if (items.length === 0) return fullMatch;\n\n return emitTestimonialsWidgetStub(\n {\n \"data-wp-testimonial-columns\": inferTestimonialColumns(wrapperParams, items.length),\n \"data-wp-testimonial-show-stars\": items.some((item) => item[\"data-wp-testimonial-rating\"])\n ? \"true\"\n : \"false\",\n },\n items,\n );\n });\n }\n\n const itemPattern = new RegExp(\n `\\\\[${escapeRegExp(itemTag)}\\\\b([^\\\\]]*)\\\\]([\\\\s\\\\S]*?)\\\\[\\\\/${escapeRegExp(itemTag)}\\\\b[^\\\\]]*\\\\]`,\n \"gi\",\n );\n return html.replace(itemPattern, (fullMatch, params: string, inner: string) => {\n const item = parseTestimonialItemAttrs(params, inner);\n if (!item) return fullMatch;\n return emitTestimonialsWidgetStub(\n {\n \"data-wp-testimonial-columns\": \"1\",\n \"data-wp-testimonial-show-stars\": item[\"data-wp-testimonial-rating\"] ? \"true\" : \"false\",\n },\n [item],\n );\n });\n}\n\nfunction flattenSliderShortcodes(content: string, widgetRegistry: WordPressWidgetRegistry): string {\n let html = content;\n for (const tag of widgetRegistry.sliderShortcodeTags) {\n const escaped = escapeRegExp(tag);\n const plugin: SliderPluginId = tag.toLowerCase() === \"masterslider\" ? \"masterslider\" : \"revslider\";\n const pattern = new RegExp(`\\\\[${escaped}\\\\b([^\\\\]]*)\\\\](?:\\\\s*\\\\[\\\\/${escaped}\\\\b[^\\\\]]*\\\\])?`, \"gi\");\n html = html.replace(pattern, (_, params: string) => {\n const alias = extractBareOrQuotedParam(params, \"alias\");\n const slidertitle = extractBareOrQuotedParam(params, \"slidertitle\");\n return emitWidgetStub(\"slider\", {\n \"data-wp-slider-plugin\": plugin,\n ...(alias ? { \"data-wp-slider-alias\": alias } : {}),\n ...(slidertitle ? { \"data-wp-slider-title\": slidertitle } : {}),\n });\n });\n }\n return html;\n}\n\nfunction flattenBlogListingShortcodes(\n content: string,\n widgetRegistry: WordPressWidgetRegistry,\n): string {\n let html = content;\n for (const tag of widgetRegistry.blogShortcodeTags) {\n const escaped = escapeRegExp(tag);\n const pattern = new RegExp(`\\\\[${escaped}\\\\b([^\\\\]]*)\\\\](?:\\\\s*\\\\[\\\\/${escaped}\\\\])?`, \"gi\");\n html = html.replace(pattern, (_, params: string) => {\n const limit =\n normalizeShortcodeCount(extractBareOrQuotedParam(params, \"number_of_posts\")) ??\n normalizeShortcodeCount(extractBareOrQuotedParam(params, \"count\")) ??\n normalizeShortcodeCount(extractBareOrQuotedParam(params, \"posts_per_page\")) ??\n normalizeShortcodeCount(extractBareOrQuotedParam(params, \"number\"));\n const filterBy = extractBareOrQuotedParam(params, \"filter_by\")?.toLowerCase();\n const categories = extractBareOrQuotedParam(params, \"categories\");\n const tags = extractBareOrQuotedParam(params, \"tags\");\n const col = extractBareOrQuotedParam(params, \"col\");\n\n return emitWidgetStub(\n \"blog-listing\",\n {\n \"data-wp-blog-layout\": inferBlogListingLayout(params),\n ...(limit ? { \"data-wp-blog-limit\": limit } : {}),\n ...(col ? { \"data-wp-blog-columns\": col } : {}),\n ...(filterBy === \"category\" && categories ? { \"data-wp-blog-category\": categories } : {}),\n ...(filterBy === \"tag\" && tags ? { \"data-wp-blog-tags\": tags } : {}),\n },\n \"section\",\n );\n });\n }\n return html;\n}\n\nfunction flattenPortfolioShortcodes(content: string, widgetRegistry: WordPressWidgetRegistry): string {\n const tag = escapeRegExp(widgetRegistry.portfolioShortcode);\n const pattern = new RegExp(`\\\\[${tag}\\\\b([^\\\\]]*)\\\\](?:\\\\s*\\\\[\\\\/${tag}\\\\])?`, \"gi\");\n return content.replace(pattern, (_, params: string) => {\n const category = extractBareOrQuotedParam(params, \"category\");\n const slug = extractBareOrQuotedParam(params, \"slug\");\n return emitWidgetStub(\"portfolio\", {\n ...(category ? { \"data-wp-portfolio-category\": category } : {}),\n ...(slug ? { \"data-wp-portfolio-slug\": slug } : {}),\n });\n });\n}\n\nfunction flattenVideoShortcodes(content: string, widgetRegistry: WordPressWidgetRegistry): string {\n let html = content;\n for (const prefix of widgetRegistry.videoShortcodePrefixes) {\n const wrapped = new RegExp(\n `\\\\[${escapeRegExp(prefix)}\\\\b([^\\\\]]*)\\\\]([\\\\s\\\\S]*?)\\\\[\\\\/${escapeRegExp(prefix)}\\\\b[^\\\\]]*\\\\]`,\n \"gi\",\n );\n html = html.replace(wrapped, (_, params: string, inner: string) =>\n emitVideoWidgetFromParams(params, inner),\n );\n\n const selfClosing = new RegExp(\n `\\\\[${escapeRegExp(prefix)}\\\\b([^\\\\]]*)\\\\]`,\n \"gi\",\n );\n html = html.replace(selfClosing, (_, params: string) => emitVideoWidgetFromParams(params, \"\"));\n }\n return html;\n}\n\n/** Detect embedded HTML contact forms (e.g. Tatsu `[tatsu_code]` with `<form>`). */\nexport function looksLikeContactFormHtml(formHtml: string): boolean {\n if (!/<form\\b/i.test(formHtml)) return false;\n\n const lower = formHtml.toLowerCase();\n if (/searchform|wp-login-form|loginform|lostpasswordform/i.test(lower)) return false;\n if (/type\\s*=\\s*[\"']search[\"']/i.test(formHtml)) return false;\n if (/newsletter|subscribe/i.test(lower) && !/<textarea\\b/i.test(formHtml)) return false;\n\n const hasEmailField =\n /type\\s*=\\s*[\"']email[\"']/i.test(formHtml) ||\n /name\\s*=\\s*[\"'][^\"']*email/i.test(formHtml) ||\n /class\\s*=\\s*[\"'][^\"']*email/i.test(formHtml);\n const hasMessageField =\n /<textarea\\b/i.test(formHtml) ||\n /name\\s*=\\s*[\"'][^\"']*(message|comment|body|enquiry|inquiry)/i.test(formHtml);\n const hasContactHint =\n /contact|serverless-contact|get-in-touch|request-quote|quote-request/i.test(lower);\n\n if (hasEmailField && hasMessageField) return true;\n if (hasContactHint && hasEmailField) return true;\n if (hasContactHint && hasMessageField) return true;\n\n return false;\n}\n\nfunction stripContactFormHelperScripts(html: string): string {\n return html.replace(\n /<script\\b[^>]*\\bsrc\\s*=\\s*[\"'][^\"']*(?:recaptcha|contact_form|contact-form)[^\"']*[\"'][^>]*>\\s*<\\/script>\\s*/gi,\n \"\",\n );\n}\n\nfunction flattenCustomHtmlContactForms(content: string): string {\n let html = content.replace(/<form\\b[^>]*>[\\s\\S]*?<\\/form>/gi, (formHtml) => {\n if (!looksLikeContactFormHtml(formHtml)) return formHtml;\n\n const formId =\n formHtml.match(/\\bid\\s*=\\s*[\"']([^\"']+)[\"']/i)?.[1]?.trim() ||\n formHtml.match(/\\bname\\s*=\\s*[\"']([^\"']+)[\"']/i)?.[1]?.trim();\n\n return emitWidgetStub(\n \"contact-form\",\n {\n \"data-wp-form-source\": \"custom-html\",\n ...(formId ? { \"data-wp-form-id\": formId } : {}),\n },\n \"section\",\n );\n });\n\n html = stripContactFormHelperScripts(html);\n return html;\n}\n\n/** Cross-builder widget + video stubs (before scaffolding strip). */\nfunction flattenWordPressWidgets(\n content: string,\n widgetRegistry: WordPressWidgetRegistry = WORDPRESS_WIDGET_REGISTRY,\n): string {\n let html = content;\n html = flattenGalleryShortcodes(html, widgetRegistry);\n html = flattenIdBasedGalleryShortcodes(html, widgetRegistry);\n html = flattenPortfolioShortcodes(html, widgetRegistry);\n html = flattenSliderShortcodes(html, widgetRegistry);\n html = flattenBlogListingShortcodes(html, widgetRegistry);\n html = flattenTestimonialsShortcodes(html, widgetRegistry);\n html = flattenMapShortcodes(html, widgetRegistry);\n html = flattenContactFormShortcodes(html, widgetRegistry);\n html = flattenVideoShortcodes(html, widgetRegistry);\n html = flattenCustomHtmlContactForms(html);\n return html;\n}\n\n/**\n * Pre-DTO WordPress builder flattening — Bucket 1 (asset/text shortcodes → HTML) then\n * Bucket 2 (layout scaffolding stripped). Decoupled from sink-time rewriteInlineImages.\n */\nexport function flattenWordPressBuilders(\n content: string,\n options: FlattenWordPressBuildersOptions = {},\n): FlattenWordPressBuildersResult {\n if (!content.trim()) {\n return { html: content, detectedThemes: [] };\n }\n\n activeTatsuContext = options.tatsuPageContent\n ? buildTatsuPageContext(options.tatsuPageContent)\n : undefined;\n\n try {\n const registry = options.registry ?? WORDPRESS_BUILDER_REGISTRY;\n const themes = detectThemes(content, registry);\n\n const widgetRegistry = options.widgetRegistry ?? WORDPRESS_WIDGET_REGISTRY;\n // Widget stubs before scaffolding strips (e.g. blox_gmap, tatsu_video, portfolio).\n let html = flattenWordPressWidgets(content, widgetRegistry);\n for (const theme of themes) {\n for (const rule of theme.wrapperRules ?? []) {\n html = convertWrapperRule(html, rule);\n }\n for (const rule of theme.textRules ?? []) {\n html = convertTextRule(html, rule);\n }\n for (const rule of theme.urlRules ?? []) {\n html = convertUrlRule(html, rule);\n }\n for (const rule of theme.placeholderRules ?? []) {\n html = convertPlaceholderRule(html, rule);\n }\n for (const rule of theme.iconImageRules ?? []) {\n html = convertIconImageRule(html, rule);\n }\n for (const layoutMap of collectLayoutMaps(theme)) {\n html = applyStructuralLayoutMap(html, layoutMap);\n }\n for (const prefix of theme.scaffoldingPrefixes ?? []) {\n html = stripScaffoldingPrefix(html, prefix);\n }\n if (theme.legacyScaffoldingTokens?.length) {\n html = stripLegacyTokens(html, theme.legacyScaffoldingTokens);\n }\n }\n\n // Catch widget shortcodes revealed after wrapper unwrap (e.g. blox_gmap inside tatsu_text_with_shortcodes).\n html = flattenWordPressWidgets(html, widgetRegistry);\n\n html = html.replace(/\\n{3,}/g, \"\\n\\n\").trim();\n\n return {\n html,\n detectedThemes: themes.map((theme) => theme.id),\n };\n } finally {\n activeTatsuContext = undefined;\n }\n}\n"],"mappings":";;;;;;;;;;AAsCA,SAAS,aAAa,OAAuB;AAC3C,SAAO,MAAM,QAAQ,uBAAuB,MAAM;AACpD;AAGO,SAAS,mBAAmB,QAAgB,MAAkC;AACnF,QAAM,UAAU,IAAI,OAAO,MAAM,aAAa,IAAI,CAAC,aAAa,GAAG;AACnE,QAAM,QAAQ,QAAQ,KAAK,MAAM;AACjC,MAAI,CAAC,MAAO,QAAO;AAEnB,MAAI,QAAQ,MAAM,QAAQ,MAAM,CAAC,EAAE;AACnC,SAAO,QAAQ,OAAO,UAAU,KAAK,KAAK,OAAO,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kB,KAAK,GAAG;AAChD,eAAO,yBAAyB,MAAM,SAAS;AAAA,MACjD;AACA,iBAAW,UAAU,MAAM,uBAAuB,CAAC,GAAG;AACpD,eAAO,uBAAuB,MAAM,MAAM;AAAA,MAC5C;AACA,UAAI,MAAM,yBAAyB,QAAQ;AACzC,eAAO,kBAAkB,MAAM,MAAM,uBAAuB;AAAA,MAC9D;AAAA,IACF;AAGA,WAAO,wBAAwB,MAAM,cAAc;AAEnD,WAAO,KAAK,QAAQ,WAAW,MAAM,EAAE,KAAK;AAE5C,WAAO;AAAA,MACL;AAAA,MACA,gBAAgB,OAAO,IAAI,CAAC,UAAU,MAAM,EAAE;AAAA,IAChD;AAAA,EACF,UAAE;AACA,yBAAqB;AAAA,EACvB;AACF;","names":["value","trimmed"]}
package/dist/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  getAdapter
4
- } from "../chunk-53VXTXGM.js";
4
+ } from "../chunk-TCAZ73UK.js";
5
5
  import {
6
6
  analyzeConflicts,
7
7
  buildMigrationReport,
@@ -17,16 +17,16 @@ import {
17
17
  runMigration,
18
18
  staleUrlsFromEstimate,
19
19
  writeFilesystemExport
20
- } from "../chunk-5TRCJONX.js";
20
+ } from "../chunk-GVAKKEWX.js";
21
21
  import {
22
22
  collectEntities
23
23
  } from "../chunk-PD5AZX3B.js";
24
- import "../chunk-4XZK55RW.js";
25
- import "../chunk-HUSXCKPI.js";
24
+ import "../chunk-ZK3LH7PO.js";
25
+ import "../chunk-LQFNO26V.js";
26
26
  import "../chunk-XRCF73DA.js";
27
27
  import {
28
28
  createWpContentGatewayRewrite
29
- } from "../chunk-S4GMDRGX.js";
29
+ } from "../chunk-DZI5C6KR.js";
30
30
 
31
31
  // src/cli/index.ts
32
32
  import { writeFile } from "fs/promises";
package/dist/index.d.ts CHANGED
@@ -3,9 +3,9 @@ export { A as AdapterContext, E as EntityKey, h as EntityType, i as MigrationCur
3
3
  export { EntityState, MigrationCheckpoint, TrackedEntity, buildPortfolioMediaLinks, isTerminalState, normalizedAssetExifSchema, normalizedAssetSchema, normalizedCategorySchema, normalizedEntitySchema, normalizedPageSchema, normalizedPortfolioSchema, normalizedPostSchema, normalizedTagSchema, shouldProcessEntity, sourceMetadataSchema, validateNormalizedAsset, validateNormalizedCategory, validateNormalizedEntity, validateNormalizedPage, validateNormalizedPortfolio, validateNormalizedPost, validateNormalizedTag } from './normalizer/index.js';
4
4
  export { B as BundleCounts, E as EntityBundle, b as bundleCounts, c as collectEntities, e as emptyBundle } from './bundle-BgoXkWMy.js';
5
5
  export { AssetDiscoverySummary, ConflictReport, DryRunOptions, DryRunResult, FALLBACK_ASSET_BYTES, FilesystemMigrationSink, MIGRATION_WRITE_STAGES, MigrationRedirect, MigrationReport, MigrationRunMode, MigrationRunOptions, MigrationRunResult, MigrationSink, MigrationWriteStage, StorageEstimate, UploadAssetInput, UploadAssetResult, WriteFilesystemOptions, analyzeConflicts, buildMigrationReport, buildRedirectMap, bundleToCombinedJson, createFilesystemMigrationSink, detectRedirectLoops, emptyConflictReport, estimateStorage, hasBlockingConflicts, hasWarnings, portfolioMediaMatchesBundle, resolveAdapterImportSummary, runDryRun, runMigration, runMigrationFromBundle, staleUrlsFromEstimate, summarizeAssetDiscovery, writeFilesystemExport } from './sinks/index.js';
6
- export { R as RewriteInlineImageRef, a as RewriteInlineImagesOptions, b as RewriteInlineImagesResult, S as StampMigrationMediaRefsOptions, U as UploadedAssetRef, r as rewriteInlineImages, s as stampMigrationMediaRefs } from './rewrite-inline-images-BsgSquzV.js';
6
+ export { R as RewriteInlineImageRef, a as RewriteInlineImagesOptions, b as RewriteInlineImagesResult, S as StampMigrationMediaRefsOptions, U as UploadedAssetRef, r as rewriteInlineImages, s as stampMigrationMediaRefs } from './rewrite-inline-images-escjz3gT.js';
7
7
  export { ExpandMigrationMediaRefsResult, GrapesComponent, GrapesProjectSnapshot, GrapesStyleRule, HtmlToGrapesOptions, HtmlToTiptapOptions, LayoutKind, LayoutTypeMap, TiptapDoc, TiptapMark, TiptapNode, ValidateGrapesProjectSnapshotOptions, ValidateTiptapDocOptions, cssToStyles, expandMigrationMediaRefs, grapesComponentSchema, grapesProjectSnapshotSchema, grapesStyleRuleSchema, htmlToGrapes, htmlToTiptap, tiptapDocSchema, tiptapMarkSchema, tiptapNodeSchema, validateGrapesProjectSnapshot, validateTiptapDoc } from './transformers/index.js';
8
- export { C as CanonicalInlineAssetUrl, a as ContentAssetDiscovery, M as MIGRATION_MEDIA_REF_SCHEME, O as OriginUrlRewriteConfig, b as OriginUrlRewriteRule, c as buildContentMediaUrlIndex, d as buildMigrationMediaUrlIndex, e as canonicalizeInlineAssetUrl, f as createMigrationMediaRefReplaceWith, g as createWpContentGatewayRewrite, h as discoverContentAssetUrls, i as discoverContentAssets, j as discoverFeaturedAssetCandidateUrls, k as discoverRawImgSrcs, l as extractInlineImageSrcs, m as formatMigrationMediaRef, n as isLikelyImageUrl, o as isMigrationMediaRef, p as normalizeAssetUrl, q as parseMigrationMediaRef, r as resolveFeaturedContentAssetUrl, s as resolveMigrationMediaSourceId, t as rewriteOriginUrlsInText } from './media-urls-u49RCyPn.js';
8
+ export { C as CanonicalInlineAssetUrl, a as ContentAssetDiscovery, M as MIGRATION_MEDIA_REF_SCHEME, O as OriginUrlRewriteConfig, b as OriginUrlRewriteRule, c as buildContentMediaUrlIndex, d as buildMigrationMediaUrlIndex, e as canonicalizeInlineAssetUrl, f as createMigrationMediaRefReplaceWith, g as createWpContentGatewayRewrite, h as discoverContentAssetUrls, i as discoverContentAssets, j as discoverFeaturedAssetCandidateUrls, k as discoverRawImgSrcs, l as extractInlineImageSrcs, m as formatMigrationMediaRef, n as isLikelyContentAssetUrl, o as isLikelyImageUrl, p as isLikelyVideoUrl, q as isMigrationMediaRef, r as normalizeAssetUrl, s as parseMigrationMediaRef, t as resolveFeaturedContentAssetUrl, u as resolveMigrationMediaSourceId, v as rewriteOriginUrlsInText } from './media-urls-ScJvYI7b.js';
9
9
  export { linkToPath, sanitizeSlug } from './lib/index.js';
10
10
  import { z } from 'zod';
11
11
  import 'node:stream';
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  squarespaceAdapter,
14
14
  wixAdapter,
15
15
  wordpressAdapter
16
- } from "./chunk-53VXTXGM.js";
16
+ } from "./chunk-TCAZ73UK.js";
17
17
  import {
18
18
  normalizedAssetExifSchema,
19
19
  normalizedAssetSchema,
@@ -58,7 +58,7 @@ import {
58
58
  staleUrlsFromEstimate,
59
59
  summarizeAssetDiscovery,
60
60
  writeFilesystemExport
61
- } from "./chunk-5TRCJONX.js";
61
+ } from "./chunk-GVAKKEWX.js";
62
62
  import {
63
63
  buildPortfolioMediaLinks,
64
64
  bundleCounts,
@@ -81,12 +81,12 @@ import {
81
81
  tiptapNodeSchema,
82
82
  validateGrapesProjectSnapshot,
83
83
  validateTiptapDoc
84
- } from "./chunk-VQ5HKNYP.js";
85
- import "./chunk-4XZK55RW.js";
84
+ } from "./chunk-BM7HUMZM.js";
85
+ import "./chunk-ZK3LH7PO.js";
86
86
  import {
87
87
  rewriteInlineImages,
88
88
  stampMigrationMediaRefs
89
- } from "./chunk-HUSXCKPI.js";
89
+ } from "./chunk-LQFNO26V.js";
90
90
  import "./chunk-EJTWYEAX.js";
91
91
  import {
92
92
  linkToPath,
@@ -105,14 +105,16 @@ import {
105
105
  discoverRawImgSrcs,
106
106
  extractInlineImageSrcs,
107
107
  formatMigrationMediaRef,
108
+ isLikelyContentAssetUrl,
108
109
  isLikelyImageUrl,
110
+ isLikelyVideoUrl,
109
111
  isMigrationMediaRef,
110
112
  normalizeAssetUrl,
111
113
  parseMigrationMediaRef,
112
114
  resolveFeaturedContentAssetUrl,
113
115
  resolveMigrationMediaSourceId,
114
116
  rewriteOriginUrlsInText
115
- } from "./chunk-S4GMDRGX.js";
117
+ } from "./chunk-DZI5C6KR.js";
116
118
  export {
117
119
  FALLBACK_ASSET_BYTES,
118
120
  FilesystemMigrationSink,
@@ -161,7 +163,9 @@ export {
161
163
  hasWarnings,
162
164
  htmlToGrapes,
163
165
  htmlToTiptap,
166
+ isLikelyContentAssetUrl,
164
167
  isLikelyImageUrl,
168
+ isLikelyVideoUrl,
165
169
  isMigrationMediaRef,
166
170
  isTerminalState,
167
171
  linkToPath,
@@ -1,4 +1,4 @@
1
- export { C as CanonicalInlineAssetUrl, a as ContentAssetDiscovery, M as MIGRATION_MEDIA_REF_SCHEME, O as OriginUrlRewriteConfig, b as OriginUrlRewriteRule, c as buildContentMediaUrlIndex, d as buildMigrationMediaUrlIndex, e as canonicalizeInlineAssetUrl, f as createMigrationMediaRefReplaceWith, g as createWpContentGatewayRewrite, h as discoverContentAssetUrls, i as discoverContentAssets, j as discoverFeaturedAssetCandidateUrls, k as discoverRawImgSrcs, l as extractInlineImageSrcs, m as formatMigrationMediaRef, n as isLikelyImageUrl, o as isMigrationMediaRef, p as normalizeAssetUrl, q as parseMigrationMediaRef, r as resolveFeaturedContentAssetUrl, s as resolveMigrationMediaSourceId, t as rewriteOriginUrlsInText } from '../media-urls-u49RCyPn.js';
1
+ export { C as CanonicalInlineAssetUrl, a as ContentAssetDiscovery, M as MIGRATION_MEDIA_REF_SCHEME, O as OriginUrlRewriteConfig, b as OriginUrlRewriteRule, c as buildContentMediaUrlIndex, d as buildMigrationMediaUrlIndex, e as canonicalizeInlineAssetUrl, f as createMigrationMediaRefReplaceWith, g as createWpContentGatewayRewrite, h as discoverContentAssetUrls, i as discoverContentAssets, j as discoverFeaturedAssetCandidateUrls, k as discoverRawImgSrcs, l as extractInlineImageSrcs, m as formatMigrationMediaRef, n as isLikelyContentAssetUrl, o as isLikelyImageUrl, p as isLikelyVideoUrl, q as isMigrationMediaRef, r as normalizeAssetUrl, s as parseMigrationMediaRef, t as resolveFeaturedContentAssetUrl, u as resolveMigrationMediaSourceId, v as rewriteOriginUrlsInText } from '../media-urls-ScJvYI7b.js';
2
2
 
3
3
  /** Lowercase URL-safe slug from WordPress post_name or title. */
4
4
  declare function sanitizeSlug(raw: string): string;
package/dist/lib/index.js CHANGED
@@ -16,14 +16,16 @@ import {
16
16
  discoverRawImgSrcs,
17
17
  extractInlineImageSrcs,
18
18
  formatMigrationMediaRef,
19
+ isLikelyContentAssetUrl,
19
20
  isLikelyImageUrl,
21
+ isLikelyVideoUrl,
20
22
  isMigrationMediaRef,
21
23
  normalizeAssetUrl,
22
24
  parseMigrationMediaRef,
23
25
  resolveFeaturedContentAssetUrl,
24
26
  resolveMigrationMediaSourceId,
25
27
  rewriteOriginUrlsInText
26
- } from "../chunk-S4GMDRGX.js";
28
+ } from "../chunk-DZI5C6KR.js";
27
29
  export {
28
30
  MIGRATION_MEDIA_REF_SCHEME,
29
31
  buildContentMediaUrlIndex,
@@ -37,7 +39,9 @@ export {
37
39
  discoverRawImgSrcs,
38
40
  extractInlineImageSrcs,
39
41
  formatMigrationMediaRef,
42
+ isLikelyContentAssetUrl,
40
43
  isLikelyImageUrl,
44
+ isLikelyVideoUrl,
41
45
  isMigrationMediaRef,
42
46
  linkToPath,
43
47
  normalizeAssetUrl,
@@ -11,7 +11,7 @@ declare function rewriteOriginUrlsInText(text: string, config: OriginUrlRewriteC
11
11
  /** Build a rule that rewrites API-gateway `/prod/wp-content/` paths to a public origin. */
12
12
  declare function createWpContentGatewayRewrite(gatewayBase: string, publicOrigin: string): OriginUrlRewriteConfig;
13
13
  interface ContentAssetDiscovery {
14
- /** Network-resolvable image paths (`<img>`, backgrounds, shortcode `image=` attrs, …). */
14
+ /** Network-resolvable image and self-hosted video paths (`<img>`, `<video>`, `data-video-url`, …). */
15
15
  urls: string[];
16
16
  /**
17
17
  * WordPress attachment post ids referenced in content without an inline URL in this
@@ -25,6 +25,10 @@ declare function discoverRawImgSrcs(content: string): string[];
25
25
  declare function normalizeAssetUrl(raw: string): string | undefined;
26
26
  /** Heuristic: URL likely points at a raster/vector image asset, not a page link. */
27
27
  declare function isLikelyImageUrl(url: string): boolean;
28
+ /** Heuristic: URL likely points at a self-hosted video asset (mp4/webm/ogg/mov), not a page or embed. */
29
+ declare function isLikelyVideoUrl(url: string): boolean;
30
+ /** Image or self-hosted video URL suitable for vault ingest (not oEmbed / page links). */
31
+ declare function isLikelyContentAssetUrl(url: string): boolean;
28
32
  /**
29
33
  * Ordered featured-image candidates when `_thumbnail_id` is missing — heroes
30
34
  * (`data-bg-image`, CSS backgrounds, `bg_image=`) before inline assets; within
@@ -35,15 +39,15 @@ declare function discoverFeaturedAssetCandidateUrls(content: string): string[];
35
39
  /** Best featured-image URL from post/page HTML when attachment id is unavailable. */
36
40
  declare function resolveFeaturedContentAssetUrl(content: string): string | undefined;
37
41
  /**
38
- * Generic content-discovery pass: collect resolvable image URLs and attachment ids
42
+ * Generic content-discovery pass: collect resolvable image/video URLs and attachment ids
39
43
  * that still need an index / REST / crawl resolution step.
40
44
  */
41
45
  declare function discoverContentAssets(content: string): ContentAssetDiscovery;
42
46
  /**
43
- * Generic content-discovery pass: collect image URLs from HTML `<img>` tags,
44
- * section hero markers (`data-bg-image`), inline CSS backgrounds, and common
45
- * shortcode/builder attributes (`src=`, `image=`, `bg_image=`, …) without
46
- * parsing builder-specific structure (Tatsu, Elementor, etc.).
47
+ * Generic content-discovery pass: collect image and self-hosted video URLs from HTML
48
+ * `<img>` / `<video>` / `<source>`, section hero markers (`data-bg-image`, `data-video-url`),
49
+ * inline CSS backgrounds, and common shortcode/builder attributes without parsing
50
+ * builder-specific structure (Tatsu, Elementor, etc.).
47
51
  */
48
52
  declare function discoverContentAssetUrls(content: string): string[];
49
53
  /** @deprecated Use discoverContentAssetUrls — kept for call-site clarity during transition. */
@@ -85,4 +89,4 @@ declare function buildContentMediaUrlIndex(entries: Iterable<{
85
89
  sourceId: string;
86
90
  }>, originUrlRewrite?: OriginUrlRewriteConfig): Map<string, string>;
87
91
 
88
- export { type CanonicalInlineAssetUrl as C, MIGRATION_MEDIA_REF_SCHEME as M, type OriginUrlRewriteConfig as O, type ContentAssetDiscovery as a, type OriginUrlRewriteRule as b, buildContentMediaUrlIndex as c, buildMigrationMediaUrlIndex as d, canonicalizeInlineAssetUrl as e, createMigrationMediaRefReplaceWith as f, createWpContentGatewayRewrite as g, discoverContentAssetUrls as h, discoverContentAssets as i, discoverFeaturedAssetCandidateUrls as j, discoverRawImgSrcs as k, extractInlineImageSrcs as l, formatMigrationMediaRef as m, isLikelyImageUrl as n, isMigrationMediaRef as o, normalizeAssetUrl as p, parseMigrationMediaRef as q, resolveFeaturedContentAssetUrl as r, resolveMigrationMediaSourceId as s, rewriteOriginUrlsInText as t };
92
+ export { type CanonicalInlineAssetUrl as C, MIGRATION_MEDIA_REF_SCHEME as M, type OriginUrlRewriteConfig as O, type ContentAssetDiscovery as a, type OriginUrlRewriteRule as b, buildContentMediaUrlIndex as c, buildMigrationMediaUrlIndex as d, canonicalizeInlineAssetUrl as e, createMigrationMediaRefReplaceWith as f, createWpContentGatewayRewrite as g, discoverContentAssetUrls as h, discoverContentAssets as i, discoverFeaturedAssetCandidateUrls as j, discoverRawImgSrcs as k, extractInlineImageSrcs as l, formatMigrationMediaRef as m, isLikelyContentAssetUrl as n, isLikelyImageUrl as o, isLikelyVideoUrl as p, isMigrationMediaRef as q, normalizeAssetUrl as r, parseMigrationMediaRef as s, resolveFeaturedContentAssetUrl as t, resolveMigrationMediaSourceId as u, rewriteOriginUrlsInText as v };
@@ -1,4 +1,4 @@
1
- import { O as OriginUrlRewriteConfig } from './media-urls-u49RCyPn.js';
1
+ import { O as OriginUrlRewriteConfig } from './media-urls-ScJvYI7b.js';
2
2
 
3
3
  interface RewriteInlineImageRef {
4
4
  originalSrc: string;
@@ -26,7 +26,7 @@ interface RewriteInlineImagesResult {
26
26
  referencedSources: string[];
27
27
  unresolved: string[];
28
28
  }
29
- /** Rewrite `<img src>` / `srcset`, `data-bg-image`, and inline CSS backgrounds using uploaded asset targets. */
29
+ /** Rewrite `<img src>` / `srcset`, `data-bg-image`, `data-video-url`, `<video>` / `<source src>`, and inline CSS backgrounds. */
30
30
  declare function rewriteInlineImages(html: string, options: RewriteInlineImagesOptions, uploadedBySourceId: Map<string, UploadedAssetRef>): RewriteInlineImagesResult;
31
31
  interface StampMigrationMediaRefsOptions {
32
32
  /** Pre-built url/pathname → sourceId map (from attachments + inline assets). */
@@ -1,9 +1,9 @@
1
1
  import { d as NormalizedCategory, e as NormalizedTag, b as NormalizedAsset, c as NormalizedPortfolio, N as NormalizedPost, a as NormalizedPage, l as PortfolioMediaLink, E as EntityKey, f as NormalizedEntity, g as MigrationPlatform, W as WxrImportSummary, M as MigrationAdapter } from '../types-Bicgdp4Z.js';
2
2
  import { Readable } from 'node:stream';
3
- import { a as RewriteInlineImagesOptions } from '../rewrite-inline-images-BsgSquzV.js';
4
- export { b as RewriteInlineImagesResult, r as rewriteInlineImages } from '../rewrite-inline-images-BsgSquzV.js';
3
+ import { a as RewriteInlineImagesOptions } from '../rewrite-inline-images-escjz3gT.js';
4
+ export { b as RewriteInlineImagesResult, r as rewriteInlineImages } from '../rewrite-inline-images-escjz3gT.js';
5
5
  import { E as EntityBundle } from '../bundle-BgoXkWMy.js';
6
- import '../media-urls-u49RCyPn.js';
6
+ import '../media-urls-ScJvYI7b.js';
7
7
 
8
8
  interface CreatePostResult {
9
9
  targetId: string;