@devcabs/folio-engine 0.1.1 → 0.1.2

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.
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ export interface AccentValidationResult {
3
+ valid: boolean;
4
+ warnings: string[];
5
+ }
6
+ /**
7
+ * Validates accent text syntax (e.g. *word* or **word**).
8
+ * Detects unclosed delimiters, empty tags, or malformed syntax.
9
+ */
10
+ export declare function validateAccentedText(text: string): AccentValidationResult;
11
+ export interface ParseAccentedTextOptions {
12
+ accentClassName?: string;
13
+ onWarn?: (warning: string) => void;
14
+ }
15
+ /**
16
+ * Parses a string containing *accent* or **accent** tags into React elements.
17
+ * Unaccented segments remain plain text.
18
+ * Accented segments are wrapped in a span with `accentClassName`.
19
+ *
20
+ * If delimiters are unclosed or malformed:
21
+ * - Emits a warning via `options.onWarn` or console.warn in dev mode
22
+ * - Gracefully falls back to rendering as plain text so the UI never crashes
23
+ */
24
+ export declare function parseAccentedText(input: string | React.ReactNode, options?: ParseAccentedTextOptions): React.ReactNode;
@@ -0,0 +1,172 @@
1
+ import { o as h, s as o, n as y, b as p, c as w, d as T, P as $ } from "./edge-DziUDALF.js";
2
+ import { jsx as E, Fragment as A } from "react/jsx-runtime";
3
+ const C = h({
4
+ appName: o().min(1, "appName is required"),
5
+ tagline: o().optional(),
6
+ logoText: o().optional(),
7
+ markSides: y().int().min(3).max(32).optional(),
8
+ markWaviness: y().min(0).max(1).optional(),
9
+ heroKicker: o().optional(),
10
+ heroTitle: o().optional(),
11
+ heroSubtitle: o().optional(),
12
+ orgName: o().optional()
13
+ }), N = h({
14
+ appId: o().min(1, "appId is required"),
15
+ appNamespace: o().min(1, "appNamespace is required"),
16
+ basePath: o().optional(),
17
+ nodes: w(T()).default([]),
18
+ branding: C,
19
+ securitySalt: o().optional(),
20
+ expectedPinHash: o().optional(),
21
+ features: h({
22
+ enableChartDrawer: p().optional(),
23
+ enableEditorMode: p().optional(),
24
+ enableHistoryLedger: p().optional()
25
+ }).optional()
26
+ });
27
+ function m(e) {
28
+ return {
29
+ appId: "default-app",
30
+ appNamespace: "folio",
31
+ branding: {
32
+ appName: "Folio Engine",
33
+ tagline: "Parametric Stepped Sequence & Document AST Platform",
34
+ logoText: "FOLIO",
35
+ markSides: 8,
36
+ markWaviness: 0.15
37
+ },
38
+ nodes: [],
39
+ securitySalt: void 0,
40
+ expectedPinHash: void 0,
41
+ features: {
42
+ enableChartDrawer: !0,
43
+ enableEditorMode: !0,
44
+ enableHistoryLedger: !0
45
+ },
46
+ ...e
47
+ };
48
+ }
49
+ let u = m();
50
+ function S() {
51
+ return u;
52
+ }
53
+ function I(e) {
54
+ return u = m({ ...u, ...e }), u;
55
+ }
56
+ function F() {
57
+ u = m();
58
+ }
59
+ function P() {
60
+ return u.appNamespace || "folio";
61
+ }
62
+ function W(e, t) {
63
+ return (t || P()) + "_" + e;
64
+ }
65
+ function b(e) {
66
+ const t = [];
67
+ return !e || typeof e != "string" ? { valid: !0, warnings: t } : ((e.match(/\*/g) || []).length % 2 !== 0 && t.push(
68
+ `Unclosed asterisk delimiter detected in "${e}". Expected matching opening and closing '*'.`
69
+ ), (/\*{4}/.test(e) || /\*{2}\s+\*{2}/.test(e) || /\*\s+\*/.test(e)) && t.push(
70
+ `Empty accent delimiter detected in "${e}". Accent delimiters must wrap non-empty text.`
71
+ ), {
72
+ valid: t.length === 0,
73
+ warnings: t
74
+ });
75
+ }
76
+ function j(e, t) {
77
+ if (typeof e != "string" || !e.includes("*"))
78
+ return e;
79
+ const { valid: a, warnings: r } = b(e);
80
+ !a && r.length > 0 && r.forEach((n) => {
81
+ var d;
82
+ t != null && t.onWarn ? t.onWarn(n) : typeof console < "u" && typeof console.warn == "function" && ((typeof import.meta < "u" && !1) ?? (typeof process < "u" && ((d = process.env) == null ? void 0 : d.NODE_ENV) !== "production")) && console.warn(`⚠️ [Folio Engine] ${n}`);
83
+ });
84
+ const l = /(\*{1,2})([^\s*](?:[^*]*?[^\s*])?)\1/g, s = [];
85
+ let i = 0, c;
86
+ for (; (c = l.exec(e)) !== null; ) {
87
+ const [n, , d] = c, f = c.index;
88
+ f > i && s.push(e.substring(i, f)), s.push(
89
+ /* @__PURE__ */ E(
90
+ "span",
91
+ {
92
+ className: t == null ? void 0 : t.accentClassName,
93
+ children: d
94
+ },
95
+ `accent-${f}`
96
+ )
97
+ ), i = f + n.length;
98
+ }
99
+ return i < e.length && s.push(e.substring(i)), s.length === 0 ? e : s.length === 1 ? s[0] : /* @__PURE__ */ E(A, { children: s });
100
+ }
101
+ function q(e) {
102
+ const t = [], a = [], r = $.safeParse(e);
103
+ if (!r.success)
104
+ return r.error.issues.forEach((n) => {
105
+ t.push(`[Schema] ${n.path.join(".")}: ${n.message}`);
106
+ }), { ok: !1, errors: t, warnings: a };
107
+ const l = r.data, s = l.chartDatasets || {}, i = /* @__PURE__ */ new Set();
108
+ function c(n, d) {
109
+ n.id ? i.has(n.id) ? t.push(`[AST] Duplicate element id detected: "${n.id}".`) : i.add(n.id) : t.push(`[AST] Element in "${d}" is missing an 'id'.`), n.type === "chart" && (n.chartId ? s[n.chartId] || a.push(
110
+ `[Chart] Chart "${n.chartId}" is referenced in canvas section "${d}" but not found in chartDatasets.`
111
+ ) : t.push(`[Chart] Chart element "${n.id}" is missing 'chartId'.`));
112
+ }
113
+ return l.canvas && Array.isArray(l.canvas.sections) && l.canvas.sections.forEach((n, d) => {
114
+ n.id ? i.has(n.id) ? t.push(`[AST] Duplicate section id detected: "${n.id}".`) : i.add(n.id) : t.push(`[AST] Section at index ${d} is missing an 'id'.`), (!n.title || n.title.trim().length === 0) && a.push(`[AST] Section "${n.id || d}" has an empty title.`), Array.isArray(n.elements) && n.elements.forEach((f) => {
115
+ if (f.type === "subsection") {
116
+ const g = f;
117
+ g.id ? i.has(g.id) ? t.push(`[AST] Duplicate subsection id detected: "${g.id}".`) : i.add(g.id) : t.push(`[AST] Subsection in "${n.title || n.id}" is missing an 'id'.`), Array.isArray(g.elements) && g.elements.forEach((v) => c(v, `${n.title} > ${g.title}`));
118
+ } else
119
+ c(f, n.title);
120
+ });
121
+ }), {
122
+ ok: t.length === 0,
123
+ errors: t,
124
+ warnings: a
125
+ };
126
+ }
127
+ function k(e) {
128
+ var s;
129
+ const t = [], a = [], r = e ? { ...S(), ...e } : S(), l = N.safeParse(r);
130
+ if (l.success || l.error.issues.forEach((i) => {
131
+ t.push(`[Config] ${i.path.join(".")}: ${i.message}`);
132
+ }), (s = r.branding) != null && s.heroTitle) {
133
+ const i = b(r.branding.heroTitle);
134
+ !i.valid && i.warnings.length > 0 && i.warnings.forEach((c) => {
135
+ a.push(`[Branding] heroTitle accent syntax warning: ${c}`);
136
+ });
137
+ }
138
+ if (typeof window < "u" && typeof document < "u") {
139
+ const i = window.getComputedStyle(document.documentElement), c = i.getPropertyValue("--canvas-bg").trim(), n = i.getPropertyValue("--font-mono").trim();
140
+ !c && !n && a.push(
141
+ "[Styles] Folio Engine stylesheet not detected! Ensure you import '@devcabs/folio-engine/style.css' in your main entry point."
142
+ );
143
+ }
144
+ return {
145
+ ok: t.length === 0,
146
+ errors: t,
147
+ warnings: a
148
+ };
149
+ }
150
+ function H() {
151
+ const e = k();
152
+ return typeof console < "u" && (e.ok || console.error(`❌ [Folio Engine] Wiring verification failed:
153
+ ` + e.errors.join(`
154
+ `)), e.warnings.length > 0 && console.warn(`⚠️ [Folio Engine] Wiring warnings:
155
+ ` + e.warnings.join(`
156
+ `)), e.ok && e.warnings.length === 0 && console.log("✅ [Folio Engine] Configuration and stylesheet wiring verified successfully.")), e.ok;
157
+ }
158
+ export {
159
+ C as E,
160
+ N as a,
161
+ k as b,
162
+ S as c,
163
+ W as d,
164
+ m as e,
165
+ F as f,
166
+ P as g,
167
+ b as h,
168
+ j as p,
169
+ H as r,
170
+ I as s,
171
+ q as v
172
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";const i=require("./edge-1WCVZ0J7.cjs"),h=require("react/jsx-runtime");var m=typeof document<"u"?document.currentScript:null;const E=i.objectType({appName:i.stringType().min(1,"appName is required"),tagline:i.stringType().optional(),logoText:i.stringType().optional(),markSides:i.numberType().int().min(3).max(32).optional(),markWaviness:i.numberType().min(0).max(1).optional(),heroKicker:i.stringType().optional(),heroTitle:i.stringType().optional(),heroSubtitle:i.stringType().optional(),orgName:i.stringType().optional()}),S=i.objectType({appId:i.stringType().min(1,"appId is required"),appNamespace:i.stringType().min(1,"appNamespace is required"),basePath:i.stringType().optional(),nodes:i.arrayType(i.anyType()).default([]),branding:E,securitySalt:i.stringType().optional(),expectedPinHash:i.stringType().optional(),features:i.objectType({enableChartDrawer:i.booleanType().optional(),enableEditorMode:i.booleanType().optional(),enableHistoryLedger:i.booleanType().optional()}).optional()});function p(e){return{appId:"default-app",appNamespace:"folio",branding:{appName:"Folio Engine",tagline:"Parametric Stepped Sequence & Document AST Platform",logoText:"FOLIO",markSides:8,markWaviness:.15},nodes:[],securitySalt:void 0,expectedPinHash:void 0,features:{enableChartDrawer:!0,enableEditorMode:!0,enableHistoryLedger:!0},...e}}let u=p();function y(){return u}function w(e){return u=p({...u,...e}),u}function A(){u=p()}function b(){return u.appNamespace||"folio"}function $(e,t){return(t||b())+"_"+e}function T(e){const t=[];return!e||typeof e!="string"?{valid:!0,warnings:t}:((e.match(/\*/g)||[]).length%2!==0&&t.push(`Unclosed asterisk delimiter detected in "${e}". Expected matching opening and closing '*'.`),(/\*{4}/.test(e)||/\*{2}\s+\*{2}/.test(e)||/\*\s+\*/.test(e))&&t.push(`Empty accent delimiter detected in "${e}". Accent delimiters must wrap non-empty text.`),{valid:t.length===0,warnings:t})}function N(e,t){if(typeof e!="string"||!e.includes("*"))return e;const{valid:r,warnings:s}=T(e);!r&&s.length>0&&s.forEach(n=>{var d;t!=null&&t.onWarn?t.onWarn(n):typeof console<"u"&&typeof console.warn=="function"&&((typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:m&&m.tagName.toUpperCase()==="SCRIPT"&&m.src||new URL("verifyEngineSetup-DeUzt_yx.cjs",document.baseURI).href}<"u"&&!1)??(typeof process<"u"&&((d=process.env)==null?void 0:d.NODE_ENV)!=="production"))&&console.warn(`⚠️ [Folio Engine] ${n}`)});const l=/(\*{1,2})([^\s*](?:[^*]*?[^\s*])?)\1/g,o=[];let a=0,c;for(;(c=l.exec(e))!==null;){const[n,,d]=c,g=c.index;g>a&&o.push(e.substring(a,g)),o.push(h.jsx("span",{className:t==null?void 0:t.accentClassName,children:d},`accent-${g}`)),a=g+n.length}return a<e.length&&o.push(e.substring(a)),o.length===0?e:o.length===1?o[0]:h.jsx(h.Fragment,{children:o})}function P(e){const t=[],r=[],s=i.PublicNodePayloadSchema.safeParse(e);if(!s.success)return s.error.issues.forEach(n=>{t.push(`[Schema] ${n.path.join(".")}: ${n.message}`)}),{ok:!1,errors:t,warnings:r};const l=s.data,o=l.chartDatasets||{},a=new Set;function c(n,d){n.id?a.has(n.id)?t.push(`[AST] Duplicate element id detected: "${n.id}".`):a.add(n.id):t.push(`[AST] Element in "${d}" is missing an 'id'.`),n.type==="chart"&&(n.chartId?o[n.chartId]||r.push(`[Chart] Chart "${n.chartId}" is referenced in canvas section "${d}" but not found in chartDatasets.`):t.push(`[Chart] Chart element "${n.id}" is missing 'chartId'.`))}return l.canvas&&Array.isArray(l.canvas.sections)&&l.canvas.sections.forEach((n,d)=>{n.id?a.has(n.id)?t.push(`[AST] Duplicate section id detected: "${n.id}".`):a.add(n.id):t.push(`[AST] Section at index ${d} is missing an 'id'.`),(!n.title||n.title.trim().length===0)&&r.push(`[AST] Section "${n.id||d}" has an empty title.`),Array.isArray(n.elements)&&n.elements.forEach(g=>{if(g.type==="subsection"){const f=g;f.id?a.has(f.id)?t.push(`[AST] Duplicate subsection id detected: "${f.id}".`):a.add(f.id):t.push(`[AST] Subsection in "${n.title||n.id}" is missing an 'id'.`),Array.isArray(f.elements)&&f.elements.forEach(C=>c(C,`${n.title} > ${f.title}`))}else c(g,n.title)})}),{ok:t.length===0,errors:t,warnings:r}}function v(e){var o;const t=[],r=[],s=e?{...y(),...e}:y(),l=S.safeParse(s);if(l.success||l.error.issues.forEach(a=>{t.push(`[Config] ${a.path.join(".")}: ${a.message}`)}),(o=s.branding)!=null&&o.heroTitle){const a=T(s.branding.heroTitle);!a.valid&&a.warnings.length>0&&a.warnings.forEach(c=>{r.push(`[Branding] heroTitle accent syntax warning: ${c}`)})}if(typeof window<"u"&&typeof document<"u"){const a=window.getComputedStyle(document.documentElement),c=a.getPropertyValue("--canvas-bg").trim(),n=a.getPropertyValue("--font-mono").trim();!c&&!n&&r.push("[Styles] Folio Engine stylesheet not detected! Ensure you import '@devcabs/folio-engine/style.css' in your main entry point.")}return{ok:t.length===0,errors:t,warnings:r}}function k(){const e=v();return typeof console<"u"&&(e.ok||console.error(`❌ [Folio Engine] Wiring verification failed:
2
+ `+e.errors.join(`
3
+ `)),e.warnings.length>0&&console.warn(`⚠️ [Folio Engine] Wiring warnings:
4
+ `+e.warnings.join(`
5
+ `)),e.ok&&e.warnings.length===0&&console.log("✅ [Folio Engine] Configuration and stylesheet wiring verified successfully.")),e.ok}exports.EngineBrandingConfigSchema=E;exports.EngineConfigSchema=S;exports.createDefaultEngineConfig=p;exports.getEngineConfig=y;exports.getStorageKey=$;exports.getStorageNamespace=b;exports.parseAccentedText=N;exports.resetEngineConfig=A;exports.runEngineSelfAudit=k;exports.setEngineConfig=w;exports.validateAccentedText=T;exports.validateNodePayload=P;exports.verifyEngineWiring=v;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devcabs/folio-engine",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "main": "./dist/folio.cjs",
6
6
  "module": "./dist/folio.js",
@@ -1,126 +0,0 @@
1
- import { o as m, s as t, n as y, b as g, a as b, c as T, P as v } from "./edge-CSjifIhA.js";
2
- const w = m({
3
- appName: t().min(1, "appName is required"),
4
- tagline: t().optional(),
5
- logoText: t().optional(),
6
- markSides: y().int().min(3).max(32).optional(),
7
- markWaviness: y().min(0).max(1).optional(),
8
- heroKicker: t().optional(),
9
- heroTitle: t().optional(),
10
- heroSubtitle: t().optional(),
11
- orgName: t().optional()
12
- }), $ = m({
13
- appId: t().min(1, "appId is required"),
14
- appNamespace: t().min(1, "appNamespace is required"),
15
- basePath: t().optional(),
16
- nodes: b(T()).default([]),
17
- branding: w,
18
- securitySalt: t().optional(),
19
- expectedPinHash: t().optional(),
20
- features: m({
21
- enableChartDrawer: g().optional(),
22
- enableEditorMode: g().optional(),
23
- enableHistoryLedger: g().optional()
24
- }).optional()
25
- });
26
- function h(n) {
27
- return {
28
- appId: "default-app",
29
- appNamespace: "folio",
30
- branding: {
31
- appName: "Folio Engine",
32
- tagline: "Parametric Stepped Sequence & Document AST Platform",
33
- logoText: "FOLIO",
34
- markSides: 8,
35
- markWaviness: 0.15
36
- },
37
- nodes: [],
38
- securitySalt: void 0,
39
- expectedPinHash: void 0,
40
- features: {
41
- enableChartDrawer: !0,
42
- enableEditorMode: !0,
43
- enableHistoryLedger: !0
44
- },
45
- ...n
46
- };
47
- }
48
- let c = h();
49
- function S() {
50
- return c;
51
- }
52
- function k(n) {
53
- return c = h({ ...c, ...n }), c;
54
- }
55
- function N() {
56
- c = h();
57
- }
58
- function A() {
59
- return c.appNamespace || "folio";
60
- }
61
- function D(n, i) {
62
- return (i || A()) + "_" + n;
63
- }
64
- function I(n) {
65
- const i = [], a = [], l = v.safeParse(n);
66
- if (!l.success)
67
- return l.error.issues.forEach((e) => {
68
- i.push(`[Schema] ${e.path.join(".")}: ${e.message}`);
69
- }), { ok: !1, errors: i, warnings: a };
70
- const s = l.data, r = s.chartDatasets || {}, o = /* @__PURE__ */ new Set();
71
- function f(e, p) {
72
- e.id ? o.has(e.id) ? i.push(`[AST] Duplicate element id detected: "${e.id}".`) : o.add(e.id) : i.push(`[AST] Element in "${p}" is missing an 'id'.`), e.type === "chart" && (e.chartId ? r[e.chartId] || a.push(
73
- `[Chart] Chart "${e.chartId}" is referenced in canvas section "${p}" but not found in chartDatasets.`
74
- ) : i.push(`[Chart] Chart element "${e.id}" is missing 'chartId'.`));
75
- }
76
- return s.canvas && Array.isArray(s.canvas.sections) && s.canvas.sections.forEach((e, p) => {
77
- e.id ? o.has(e.id) ? i.push(`[AST] Duplicate section id detected: "${e.id}".`) : o.add(e.id) : i.push(`[AST] Section at index ${p} is missing an 'id'.`), (!e.title || e.title.trim().length === 0) && a.push(`[AST] Section "${e.id || p}" has an empty title.`), Array.isArray(e.elements) && e.elements.forEach((u) => {
78
- if (u.type === "subsection") {
79
- const d = u;
80
- d.id ? o.has(d.id) ? i.push(`[AST] Duplicate subsection id detected: "${d.id}".`) : o.add(d.id) : i.push(`[AST] Subsection in "${e.title || e.id}" is missing an 'id'.`), Array.isArray(d.elements) && d.elements.forEach((E) => f(E, `${e.title} > ${d.title}`));
81
- } else
82
- f(u, e.title);
83
- });
84
- }), {
85
- ok: i.length === 0,
86
- errors: i,
87
- warnings: a
88
- };
89
- }
90
- function C(n) {
91
- const i = [], a = [], l = n ? { ...S(), ...n } : S(), s = $.safeParse(l);
92
- if (s.success || s.error.issues.forEach((r) => {
93
- i.push(`[Config] ${r.path.join(".")}: ${r.message}`);
94
- }), typeof window < "u" && typeof document < "u") {
95
- const r = window.getComputedStyle(document.documentElement), o = r.getPropertyValue("--canvas-bg").trim(), f = r.getPropertyValue("--font-mono").trim();
96
- !o && !f && a.push(
97
- "[Styles] Folio Engine stylesheet not detected! Ensure you import '@devcabs/folio-engine/style.css' in your main entry point."
98
- );
99
- }
100
- return {
101
- ok: i.length === 0,
102
- errors: i,
103
- warnings: a
104
- };
105
- }
106
- function x() {
107
- const n = C();
108
- return typeof console < "u" && (n.ok || console.error(`❌ [Folio Engine] Wiring verification failed:
109
- ` + n.errors.join(`
110
- `)), n.warnings.length > 0 && console.warn(`⚠️ [Folio Engine] Wiring warnings:
111
- ` + n.warnings.join(`
112
- `)), n.ok && n.warnings.length === 0 && console.log("✅ [Folio Engine] Configuration and stylesheet wiring verified successfully.")), n.ok;
113
- }
114
- export {
115
- w as E,
116
- S as a,
117
- D as b,
118
- $ as c,
119
- h as d,
120
- x as e,
121
- C as f,
122
- A as g,
123
- N as r,
124
- k as s,
125
- I as v
126
- };
@@ -1,5 +0,0 @@
1
- "use strict";const n=require("./edge-1WCVZ0J7.cjs"),m=n.objectType({appName:n.stringType().min(1,"appName is required"),tagline:n.stringType().optional(),logoText:n.stringType().optional(),markSides:n.numberType().int().min(3).max(32).optional(),markWaviness:n.numberType().min(0).max(1).optional(),heroKicker:n.stringType().optional(),heroTitle:n.stringType().optional(),heroSubtitle:n.stringType().optional(),orgName:n.stringType().optional()}),h=n.objectType({appId:n.stringType().min(1,"appId is required"),appNamespace:n.stringType().min(1,"appNamespace is required"),basePath:n.stringType().optional(),nodes:n.arrayType(n.anyType()).default([]),branding:m,securitySalt:n.stringType().optional(),expectedPinHash:n.stringType().optional(),features:n.objectType({enableChartDrawer:n.booleanType().optional(),enableEditorMode:n.booleanType().optional(),enableHistoryLedger:n.booleanType().optional()}).optional()});function f(i){return{appId:"default-app",appNamespace:"folio",branding:{appName:"Folio Engine",tagline:"Parametric Stepped Sequence & Document AST Platform",logoText:"FOLIO",markSides:8,markWaviness:.15},nodes:[],securitySalt:void 0,expectedPinHash:void 0,features:{enableChartDrawer:!0,enableEditorMode:!0,enableHistoryLedger:!0},...i}}let d=f();function y(){return d}function b(i){return d=f({...d,...i}),d}function C(){d=f()}function T(){return d.appNamespace||"folio"}function v(i,t){return(t||T())+"_"+i}function w(i){const t=[],o=[],p=n.PublicNodePayloadSchema.safeParse(i);if(!p.success)return p.error.issues.forEach(e=>{t.push(`[Schema] ${e.path.join(".")}: ${e.message}`)}),{ok:!1,errors:t,warnings:o};const r=p.data,s=r.chartDatasets||{},a=new Set;function l(e,c){e.id?a.has(e.id)?t.push(`[AST] Duplicate element id detected: "${e.id}".`):a.add(e.id):t.push(`[AST] Element in "${c}" is missing an 'id'.`),e.type==="chart"&&(e.chartId?s[e.chartId]||o.push(`[Chart] Chart "${e.chartId}" is referenced in canvas section "${c}" but not found in chartDatasets.`):t.push(`[Chart] Chart element "${e.id}" is missing 'chartId'.`))}return r.canvas&&Array.isArray(r.canvas.sections)&&r.canvas.sections.forEach((e,c)=>{e.id?a.has(e.id)?t.push(`[AST] Duplicate section id detected: "${e.id}".`):a.add(e.id):t.push(`[AST] Section at index ${c} is missing an 'id'.`),(!e.title||e.title.trim().length===0)&&o.push(`[AST] Section "${e.id||c}" has an empty title.`),Array.isArray(e.elements)&&e.elements.forEach(u=>{if(u.type==="subsection"){const g=u;g.id?a.has(g.id)?t.push(`[AST] Duplicate subsection id detected: "${g.id}".`):a.add(g.id):t.push(`[AST] Subsection in "${e.title||e.id}" is missing an 'id'.`),Array.isArray(g.elements)&&g.elements.forEach(S=>l(S,`${e.title} > ${g.title}`))}else l(u,e.title)})}),{ok:t.length===0,errors:t,warnings:o}}function E(i){const t=[],o=[],p=i?{...y(),...i}:y(),r=h.safeParse(p);if(r.success||r.error.issues.forEach(s=>{t.push(`[Config] ${s.path.join(".")}: ${s.message}`)}),typeof window<"u"&&typeof document<"u"){const s=window.getComputedStyle(document.documentElement),a=s.getPropertyValue("--canvas-bg").trim(),l=s.getPropertyValue("--font-mono").trim();!a&&!l&&o.push("[Styles] Folio Engine stylesheet not detected! Ensure you import '@devcabs/folio-engine/style.css' in your main entry point.")}return{ok:t.length===0,errors:t,warnings:o}}function A(){const i=E();return typeof console<"u"&&(i.ok||console.error(`❌ [Folio Engine] Wiring verification failed:
2
- `+i.errors.join(`
3
- `)),i.warnings.length>0&&console.warn(`⚠️ [Folio Engine] Wiring warnings:
4
- `+i.warnings.join(`
5
- `)),i.ok&&i.warnings.length===0&&console.log("✅ [Folio Engine] Configuration and stylesheet wiring verified successfully.")),i.ok}exports.EngineBrandingConfigSchema=m;exports.EngineConfigSchema=h;exports.createDefaultEngineConfig=f;exports.getEngineConfig=y;exports.getStorageKey=v;exports.getStorageNamespace=T;exports.resetEngineConfig=C;exports.runEngineSelfAudit=A;exports.setEngineConfig=b;exports.validateNodePayload=w;exports.verifyEngineWiring=E;