@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260704091052 → 0.8.1-dev.20260706114046

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.
Files changed (43) hide show
  1. package/dist/CopyButton-UPJPMJUB.mjs +57 -0
  2. package/dist/DateTimeViewClient-R3M6ISVK.mjs +16 -0
  3. package/dist/DateViewClient-VLTRN47D.mjs +9 -0
  4. package/dist/{chunk-SDNYBQSI.mjs → HlsPlayer-57543DTW.mjs} +3 -2
  5. package/dist/HlsPlayer-5AWFZ2P6.mjs +601 -0
  6. package/dist/IframeClient-RGJFZ5P2.mjs +98 -0
  7. package/dist/InputControlClient-NJV6B65M.mjs +604 -0
  8. package/dist/InputControlClient-OQDLYA4S.mjs +604 -0
  9. package/dist/InputControlClient-TW664WIJ.mjs +602 -0
  10. package/dist/{LinkNodeButton-WDDPNYWI.mjs → LinkNodeButton-FUL3J5HR.mjs} +6 -5
  11. package/dist/LinkNodeButton-IGJOGOKI.mjs +362 -0
  12. package/dist/LinkNodeButton-ZONM74OO.mjs +174 -0
  13. package/dist/Pagination-6OFACRMQ.mjs +229 -0
  14. package/dist/Pagination-FSYLYKUA.mjs +181 -0
  15. package/dist/Pagination-YCD5CU2L.mjs +183 -0
  16. package/dist/Slider-554BKC7N.mjs +322 -0
  17. package/dist/Slider-PEIVH6A5.mjs +320 -0
  18. package/dist/chunk-2GSYECIS.mjs +109 -0
  19. package/dist/chunk-3GWLDT7C.mjs +204 -0
  20. package/dist/chunk-3R4VVVNK.mjs +903 -0
  21. package/dist/chunk-47HD7QP7.mjs +199 -0
  22. package/dist/chunk-56HSDML5.mjs +22 -0
  23. package/dist/chunk-67IG5NBU.mjs +200 -0
  24. package/dist/chunk-7ZFZLN56.mjs +903 -0
  25. package/dist/chunk-CM7LUGCH.mjs +107 -0
  26. package/dist/chunk-IKIXEQPV.mjs +198 -0
  27. package/dist/chunk-IMNQO57B.mjs +25 -0
  28. package/dist/chunk-R2HV35IB.mjs +201 -0
  29. package/dist/chunk-SPRVN5IM.mjs +118 -0
  30. package/dist/chunk-TVL6KVD5.mjs +229 -0
  31. package/dist/chunk-WEV5U33G.mjs +207 -0
  32. package/dist/chunk-YG6FKKQJ.mjs +900 -0
  33. package/dist/index.d.mts +56 -169
  34. package/dist/index.d.ts +56 -169
  35. package/dist/index.js +3940 -3807
  36. package/dist/index.mjs +591 -2923
  37. package/dist/server.d.mts +72 -0
  38. package/dist/server.d.ts +72 -0
  39. package/dist/server.js +5126 -0
  40. package/dist/server.mjs +2698 -0
  41. package/package.json +18 -4
  42. package/dist/HlsPlayer-DZNDKG2P.mjs +0 -7
  43. package/dist/chunk-DOKQUUH3.mjs +0 -414
@@ -0,0 +1,2698 @@
1
+ import {
2
+ ServiceClient_default
3
+ } from "./chunk-3GWLDT7C.mjs";
4
+ import {
5
+ Hyperlink,
6
+ OdataBuilder
7
+ } from "./chunk-TVL6KVD5.mjs";
8
+ import "./chunk-56HSDML5.mjs";
9
+
10
+ // src/components/pageRenderingEngine/PageBodyRenderer.tsx
11
+ import React20 from "react";
12
+
13
+ // src/components/pageRenderingEngine/nodes/ParagraphNode.tsx
14
+ import React12 from "react";
15
+
16
+ // src/components/pageRenderingEngine/nodes/TextNode.tsx
17
+ import { jsx, jsxs } from "react/jsx-runtime";
18
+ var TextNode = (props) => {
19
+ function cssStringToJson(cssString) {
20
+ const styleObject = {};
21
+ const matches = cssString?.match(/([\w-]+)\s*:\s*([^;]+)\s*;/g);
22
+ if (matches) {
23
+ matches.forEach((match) => {
24
+ const parts = match.match(/([\w-]+)\s*:\s*([^;]+)\s*;/);
25
+ if (parts && parts.length === 3) {
26
+ const property = parts[1].trim();
27
+ const value = parts[2].trim();
28
+ styleObject[property] = value;
29
+ }
30
+ });
31
+ }
32
+ return styleObject;
33
+ }
34
+ function toCamelCase2(str) {
35
+ return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
36
+ }
37
+ function convertKeysToCamelCase2(obj) {
38
+ if (Array.isArray(obj)) {
39
+ return obj.map(convertKeysToCamelCase2);
40
+ } else if (obj !== null && typeof obj === "object") {
41
+ return Object.fromEntries(
42
+ Object.entries(obj).filter(([_, value]) => value !== "").map(([key, value]) => [
43
+ toCamelCase2(key),
44
+ convertKeysToCamelCase2(value)
45
+ ])
46
+ );
47
+ }
48
+ return obj;
49
+ }
50
+ function getFormatClass(format) {
51
+ const classes = [];
52
+ if (format & 1) classes.push("font-medium");
53
+ if (format & 2) classes.push("italic");
54
+ if (format & 4) classes.push("line-through");
55
+ if (format & 8) classes.push("underline");
56
+ if (format & 256) classes.push("lowercase");
57
+ if (format & 512) classes.push("uppercase");
58
+ if (format & 1024) classes.push("capitalize");
59
+ return classes.join(" ");
60
+ }
61
+ const styles = convertKeysToCamelCase2(cssStringToJson(props.node.style));
62
+ function replacePlaceholders(template, dataItem) {
63
+ {
64
+ }
65
+ return template.replace(/{(\w+)}/g, (_, key) => {
66
+ {
67
+ }
68
+ return key in dataItem ? dataItem[key] : `{${key}}`;
69
+ });
70
+ }
71
+ function renderWithLineBreaks(text) {
72
+ return text.split("\n").map((line, index, arr) => /* @__PURE__ */ jsxs("span", { children: [
73
+ line,
74
+ index < arr.length - 1 && /* @__PURE__ */ jsx("br", {})
75
+ ] }, index));
76
+ }
77
+ const displayText = props.linkText ? props.linkText : props.node.text;
78
+ const finalText = props.dataitem && props.linkText ? displayText : props.dataitem ? replacePlaceholders(props.node.text, props.dataitem) : props.node.text;
79
+ const content = typeof finalText === "string" ? renderWithLineBreaks(finalText) : finalText;
80
+ const formattedContent = props.node.format & 64 ? /* @__PURE__ */ jsx("sup", { children: content }) : props.node.format & 32 ? /* @__PURE__ */ jsx("sub", { children: content }) : content;
81
+ return (
82
+ // @ts-expect-error custom code
83
+ /* @__PURE__ */ jsx("span", { style: { ...styles }, className: getFormatClass(props.node.format), children: formattedContent })
84
+ );
85
+ };
86
+ var TextNode_default = TextNode;
87
+
88
+ // src/components/pageRenderingEngine/nodes/LineBreakNode.tsx
89
+ import { jsx as jsx2 } from "react/jsx-runtime";
90
+ var LineBreakNode = () => {
91
+ return /* @__PURE__ */ jsx2("div", { className: "py-0.5 lg:py-1.5" });
92
+ };
93
+ var LineBreakNode_default = LineBreakNode;
94
+
95
+ // src/components/pageRenderingEngine/nodes/LinkNode.tsx
96
+ import React from "react";
97
+
98
+ // src/components/utilities/AssetUtility.tsx
99
+ var AssetUtility = class {
100
+ constructor() {
101
+ }
102
+ static resolveUrl(assetBaseUrl, url) {
103
+ if (!url) return void 0;
104
+ if (url.startsWith("http")) return url;
105
+ if (!assetBaseUrl) return url;
106
+ return `${assetBaseUrl}/${url}`;
107
+ }
108
+ // // static getAssetUrl(apiBaseUrl: string) {
109
+ // // let domainName = apiBaseUrl.replace("https://", "");
110
+ // // return `https://cdn.g-assets.com/${domainName}`;
111
+ // // }
112
+ // static getAssetFullPath(apiBaseUrl: string, relativePath: string) {
113
+ // const domainName = apiBaseUrl.replace("https://", "");
114
+ // return `https://cdn.g-assets.com/${domainName}/${relativePath}`;
115
+ // }
116
+ };
117
+ var AssetUtility_default = AssetUtility;
118
+
119
+ // src/components/pageRenderingEngine/nodes/ImageNode.tsx
120
+ import dynamic2 from "next/dynamic";
121
+
122
+ // src/components/DeviceAssetSelector.tsx
123
+ import dynamic from "next/dynamic";
124
+ import { jsx as jsx3 } from "react/jsx-runtime";
125
+ var HlsPlayer = dynamic(() => import("./HlsPlayer-57543DTW.mjs"), { ssr: false });
126
+ var FORMAT_CLASSES = {
127
+ center: "justify-center",
128
+ left: "justify-start",
129
+ right: "justify-end"
130
+ };
131
+ var DeviceAssetSelector = ({
132
+ assets,
133
+ assetBaseUrl,
134
+ session,
135
+ width,
136
+ tag,
137
+ nodeProps,
138
+ device
139
+ }) => {
140
+ const targetTag = tag || nodeProps?.tag;
141
+ const selectAssetByDevice = (assets2, currentDevice) => assets2.find((a) => a.device === currentDevice) ?? assets2.find((a) => !a.device || a.device === "");
142
+ const selectAsset = () => {
143
+ if (!assets?.length) return void 0;
144
+ if (targetTag) {
145
+ const tagged = assets.filter((a) => a.tag === targetTag);
146
+ if (tagged.length) {
147
+ return tagged.find((a) => a.device === device) ?? tagged.find((a) => !a.device || a.device === "");
148
+ }
149
+ }
150
+ return selectAssetByDevice(assets, device);
151
+ };
152
+ const selectedAsset = selectAsset();
153
+ if (!selectedAsset) return null;
154
+ const resolvedAssetUrl = AssetUtility_default.resolveUrl(assetBaseUrl, selectedAsset.assetUrl);
155
+ const resolvedThumbnailUrl = selectedAsset.posterUrl ? AssetUtility_default.resolveUrl(assetBaseUrl, selectedAsset.posterUrl) : void 0;
156
+ const title = selectedAsset.title || nodeProps?.title;
157
+ const isHls = resolvedAssetUrl?.endsWith(".m3u8");
158
+ const showControls = nodeProps?.showControls === "true";
159
+ const loop = nodeProps?.loop === "true";
160
+ const styles = {
161
+ ...nodeProps?.borderRadius && { borderRadius: nodeProps.borderRadius },
162
+ ...nodeProps?.width && { width: nodeProps.width },
163
+ ...nodeProps?.height && { height: nodeProps.height }
164
+ };
165
+ const renderMedia = () => isHls ? /* @__PURE__ */ jsx3(
166
+ HlsPlayer,
167
+ {
168
+ assetUrl: resolvedAssetUrl,
169
+ posterUrl: resolvedThumbnailUrl,
170
+ intrinsicWidth: selectedAsset.intrinsicWidth?.toString(),
171
+ intrinsicHeight: selectedAsset.intrinsicHeight?.toString(),
172
+ showControls,
173
+ loop,
174
+ playOptions: nodeProps?.playOptions,
175
+ apiBaseUrl: assetBaseUrl,
176
+ session
177
+ }
178
+ ) : /* @__PURE__ */ jsx3(
179
+ "img",
180
+ {
181
+ style: styles,
182
+ loading: "lazy",
183
+ className: "object-cover w-full",
184
+ src: resolvedAssetUrl,
185
+ width: selectedAsset.intrinsicWidth,
186
+ height: selectedAsset.intrinsicHeight,
187
+ alt: title || "Asset image"
188
+ }
189
+ );
190
+ if (width) return /* @__PURE__ */ jsx3("div", { style: { width }, children: renderMedia() });
191
+ if (nodeProps?.format) {
192
+ return /* @__PURE__ */ jsx3("div", { className: `flex ${FORMAT_CLASSES[nodeProps.format] ?? ""}`, children: renderMedia() });
193
+ }
194
+ return renderMedia();
195
+ };
196
+ var DeviceAssetSelector_default = DeviceAssetSelector;
197
+
198
+ // src/components/pageRenderingEngine/nodes/ImageNode.tsx
199
+ import { jsx as jsx4 } from "react/jsx-runtime";
200
+ var HlsPlayer2 = dynamic2(() => import("./HlsPlayer-57543DTW.mjs"), { ssr: false });
201
+ var getNestedValue = (obj, path) => {
202
+ if (!obj || !path) return void 0;
203
+ return path.split(".").reduce((current, key) => {
204
+ return current && current[key] !== void 0 ? current[key] : void 0;
205
+ }, obj);
206
+ };
207
+ var ImageNode = (props) => {
208
+ let assets;
209
+ let imageUrl;
210
+ let posterUrl;
211
+ const currentDevice = props.device;
212
+ if (props.node.device) {
213
+ const nodeDevice = props.node.device;
214
+ if (nodeDevice !== currentDevice) return null;
215
+ }
216
+ if (props.node.imageUrl.startsWith("http")) {
217
+ imageUrl = props.node.imageUrl;
218
+ posterUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, props.node.posterUrl);
219
+ } else if (props.dataitem && props.node.datafield) {
220
+ const image = getNestedValue(props.dataitem, props.node.datafield);
221
+ if (typeof image === "string") {
222
+ const trimmed = image.trim();
223
+ if (trimmed) {
224
+ assets = JSON.parse(trimmed);
225
+ }
226
+ } else if (Array.isArray(image)) {
227
+ assets = image;
228
+ } else if (image && typeof image === "object") {
229
+ assets = [image];
230
+ }
231
+ if (assets && assets.length > 0) {
232
+ return /* @__PURE__ */ jsx4(
233
+ DeviceAssetSelector_default,
234
+ {
235
+ device: props.device,
236
+ assets,
237
+ assetBaseUrl: props.assetBaseUrl,
238
+ session: props.session,
239
+ nodeProps: {
240
+ title: props.node.title,
241
+ showControls: props.node.showControls,
242
+ loop: props.node.loop,
243
+ playOptions: props.node.playOptions,
244
+ borderRadius: props.node.borderRadius,
245
+ width: props.node.width,
246
+ height: props.node.height,
247
+ format: props.node.format,
248
+ tag: props.node.tag,
249
+ placementCode: props.node.placementCode
250
+ }
251
+ }
252
+ );
253
+ } else {
254
+ imageUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, props.node.imageUrl);
255
+ posterUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, props.node.posterUrl);
256
+ }
257
+ } else {
258
+ imageUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, props.node.imageUrl);
259
+ posterUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, props.node.posterUrl);
260
+ }
261
+ if (!imageUrl) return null;
262
+ const styles = {
263
+ ...props.node.height && { height: props.node.height },
264
+ ...props.node.borderRadius && { borderRadius: props.node.borderRadius },
265
+ ...props.node.width && { width: props.node.width }
266
+ };
267
+ const FORMAT_CLASSES2 = {
268
+ center: "justify-center",
269
+ left: "justify-start",
270
+ right: "justify-end"
271
+ };
272
+ const isHls = imageUrl.endsWith(".m3u8");
273
+ const renderMedia = () => isHls ? /* @__PURE__ */ jsx4(
274
+ HlsPlayer2,
275
+ {
276
+ assetUrl: imageUrl,
277
+ posterUrl,
278
+ intrinsicWidth: props.node.intrinsicWidth,
279
+ intrinsicHeight: props.node.intrinsicHeight,
280
+ showControls: props.node.showControls === "true",
281
+ loop: props.node.loop === "true",
282
+ playOptions: props.node.playOptions,
283
+ apiBaseUrl: props.apiBaseUrl,
284
+ session: props.session
285
+ }
286
+ ) : /* @__PURE__ */ jsx4(
287
+ "img",
288
+ {
289
+ style: styles,
290
+ loading: "lazy",
291
+ className: "object-cover",
292
+ src: imageUrl,
293
+ width: props.node.intrinsicWidth,
294
+ alt: props.node.title,
295
+ height: props.node.intrinsicHeight
296
+ }
297
+ );
298
+ if (props.node.width) {
299
+ return /* @__PURE__ */ jsx4("div", { className: `flex ${FORMAT_CLASSES2[props.node.format] ?? ""}`, children: renderMedia() });
300
+ }
301
+ return renderMedia();
302
+ };
303
+ var ImageNode_default = ImageNode;
304
+
305
+ // src/components/pageRenderingEngine/nodes/LinkNode.tsx
306
+ import dynamic3 from "next/dynamic";
307
+ import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
308
+ var LinkNodeButton = dynamic3(() => import("./LinkNodeButton-IGJOGOKI.mjs"), {
309
+ ssr: false
310
+ });
311
+ function getNestedValue2(obj, path) {
312
+ if (!obj || !path) return void 0;
313
+ return path.split(".").reduce((current, key) => {
314
+ return current && current[key] !== void 0 ? current[key] : void 0;
315
+ }, obj);
316
+ }
317
+ var LinkNode = (props) => {
318
+ const NodeTypes2 = {
319
+ text: TextNode_default,
320
+ image: ImageNode_default
321
+ };
322
+ const { node, dataitem } = props;
323
+ let linkUrl = node.url;
324
+ if (node.datafield_link_url && dataitem) {
325
+ const dynamicUrl = getNestedValue2(dataitem, node.datafield_link_url);
326
+ if (dynamicUrl && typeof dynamicUrl === "string") {
327
+ linkUrl = dynamicUrl;
328
+ }
329
+ }
330
+ if (props.routeParameters && linkUrl && linkUrl.includes("{")) {
331
+ Object.keys(props.routeParameters).forEach((param) => {
332
+ const value = props.routeParameters[param];
333
+ if (value !== void 0 && value !== null) {
334
+ linkUrl = linkUrl.replace(
335
+ new RegExp(`\\{${param}\\}`, "gi"),
336
+ encodeURIComponent(String(value))
337
+ );
338
+ }
339
+ });
340
+ }
341
+ let linkText = null;
342
+ if (node.datafield_link_text && dataitem) {
343
+ const dynamicText = dataitem[node.datafield_link_text];
344
+ if (dynamicText && typeof dynamicText === "string") {
345
+ linkText = dynamicText;
346
+ }
347
+ }
348
+ const getLinkTypeFromCssClass = (cssClass) => {
349
+ const classToTypeMap = {
350
+ Primary: "Primary" /* Solid */,
351
+ PrimaryHollow: "PrimaryHollow" /* Hollow */,
352
+ Link: "Link" /* Link */
353
+ };
354
+ return classToTypeMap[cssClass];
355
+ };
356
+ const linkType = node.cssClass ? getLinkTypeFromCssClass(node.cssClass) : void 0;
357
+ const isButton = node.isButton === true;
358
+ const renderChildren = () => {
359
+ if (!node.children || node.children.length === 0) return null;
360
+ return /* @__PURE__ */ jsx5(Fragment, { children: node.children.map((childNode, index) => {
361
+ const SelectedNode = NodeTypes2[childNode.type];
362
+ if (!SelectedNode) {
363
+ console.warn("Unknown node type:", childNode.type);
364
+ return null;
365
+ }
366
+ return /* @__PURE__ */ jsx5(React.Fragment, { children: /* @__PURE__ */ jsx5(
367
+ SelectedNode,
368
+ {
369
+ node: childNode,
370
+ dataitem,
371
+ linkText,
372
+ routeParameters: props.routeParameters
373
+ }
374
+ ) }, index);
375
+ }) });
376
+ };
377
+ const renderFallback = () => {
378
+ if ((!node.children || node.children.length === 0) && linkText) {
379
+ return /* @__PURE__ */ jsx5("span", { children: linkText });
380
+ }
381
+ if ((!node.children || node.children.length === 0) && !linkText) {
382
+ return /* @__PURE__ */ jsx5("br", {});
383
+ }
384
+ return null;
385
+ };
386
+ if (isButton) {
387
+ return /* @__PURE__ */ jsxs2(
388
+ LinkNodeButton,
389
+ {
390
+ node,
391
+ dataitem,
392
+ routeParameters: props.routeParameters,
393
+ session: props.session,
394
+ apiBaseUrl: props.apiBaseUrl || "",
395
+ linkText,
396
+ linkType,
397
+ linkUrl,
398
+ children: [
399
+ renderChildren(),
400
+ renderFallback()
401
+ ]
402
+ }
403
+ );
404
+ }
405
+ return /* @__PURE__ */ jsxs2(
406
+ Hyperlink,
407
+ {
408
+ href: linkUrl || "#",
409
+ linkType,
410
+ alt: linkText || node.title || "",
411
+ children: [
412
+ renderChildren(),
413
+ renderFallback()
414
+ ]
415
+ }
416
+ );
417
+ };
418
+ var LinkNode_default = LinkNode;
419
+
420
+ // src/components/pageRenderingEngine/nodes/SVGIconNode.tsx
421
+ import { jsx as jsx6 } from "react/jsx-runtime";
422
+ var SVGIconNode = ({ node }) => {
423
+ if (!node?.svgCode) return null;
424
+ return /* @__PURE__ */ jsx6(
425
+ "span",
426
+ {
427
+ style: {
428
+ display: "flex",
429
+ width: node.width,
430
+ height: node.height,
431
+ color: node.color
432
+ },
433
+ dangerouslySetInnerHTML: { __html: node.svgCode }
434
+ }
435
+ );
436
+ };
437
+ var SVGIconNode_default = SVGIconNode;
438
+
439
+ // src/components/pageRenderingEngine/nodes/EquationNode.tsx
440
+ import katex from "katex";
441
+ import { jsx as jsx7 } from "react/jsx-runtime";
442
+ var EquationNode = ({ node }) => {
443
+ const { equation, inline } = node;
444
+ let html = "";
445
+ try {
446
+ html = katex.renderToString(equation, {
447
+ displayMode: !inline,
448
+ throwOnError: false
449
+ });
450
+ } catch (error) {
451
+ html = katex.renderToString(`\\text{Invalid equation}`, {
452
+ throwOnError: false
453
+ });
454
+ }
455
+ if (inline) {
456
+ return /* @__PURE__ */ jsx7(
457
+ "span",
458
+ {
459
+ className: "katex-inline",
460
+ dangerouslySetInnerHTML: { __html: html }
461
+ }
462
+ );
463
+ }
464
+ return /* @__PURE__ */ jsx7(
465
+ "div",
466
+ {
467
+ className: "katex-block my-3 text-center",
468
+ dangerouslySetInnerHTML: { __html: html }
469
+ }
470
+ );
471
+ };
472
+ var EquationNode_default = EquationNode;
473
+
474
+ // src/components/controls/view/ViewControl.tsx
475
+ import React11 from "react";
476
+
477
+ // src/components/controls/view/ViewControlTypes.tsx
478
+ var ViewControlTypes = {
479
+ lineText: "lineText",
480
+ asset: "asset",
481
+ multilineTextBullets: "multilineTextBullets",
482
+ boolean: "boolean",
483
+ money: "money",
484
+ date: "date",
485
+ time: "time",
486
+ datetime: "datetime",
487
+ number: "number",
488
+ multilineText: "multilineText",
489
+ moneyText: "moneyText",
490
+ percentage: "percentage",
491
+ statusBg: "statusBg",
492
+ progressIndicator: "progressIndicator",
493
+ timeUntilStarts: "timeUntilStarts",
494
+ timeUntilStartsStyled: "timeUntilStartsStyled",
495
+ aiGeneratedSummary: "aiGeneratedSummary"
496
+ };
497
+ var ViewControlTypes_default = ViewControlTypes;
498
+
499
+ // src/components/controls/view/NumberView.tsx
500
+ import React2 from "react";
501
+ import { jsx as jsx8 } from "react/jsx-runtime";
502
+ var NumberView = (props) => {
503
+ return /* @__PURE__ */ jsx8(React2.Fragment, { children: props.value });
504
+ };
505
+ var NumberView_default = NumberView;
506
+
507
+ // src/components/controls/view/DateView.tsx
508
+ import dynamic4 from "next/dynamic";
509
+ var DateView = dynamic4(() => import("./DateViewClient-ELEHLGWS.mjs"), {
510
+ ssr: false
511
+ });
512
+ var DateView_default = DateView;
513
+
514
+ // src/components/controls/view/BooleanView.tsx
515
+ import React3 from "react";
516
+ import { jsx as jsx9 } from "react/jsx-runtime";
517
+ var BooleanView = (props) => {
518
+ const { value, customProps } = props;
519
+ const showOnlyTrueIcon = customProps?.showOnlyTrueIcon;
520
+ console.log("BooleanView Debug:", {
521
+ value,
522
+ type: typeof value,
523
+ customProps,
524
+ showOnlyTrueIcon
525
+ });
526
+ const booleanValue = (() => {
527
+ if (typeof value === "boolean") return value;
528
+ if (typeof value === "string") {
529
+ return value.toLowerCase() === "true";
530
+ }
531
+ if (typeof value === "number") {
532
+ return value === 1;
533
+ }
534
+ return false;
535
+ })();
536
+ if (showOnlyTrueIcon) {
537
+ return /* @__PURE__ */ jsx9(React3.Fragment, { children: booleanValue === true && /* @__PURE__ */ jsx9(
538
+ "svg",
539
+ {
540
+ className: "w-15 h-8 text-green-600",
541
+ fill: "currentColor",
542
+ viewBox: "0 0 20 20",
543
+ children: /* @__PURE__ */ jsx9(
544
+ "path",
545
+ {
546
+ fillRule: "evenodd",
547
+ d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
548
+ clipRule: "evenodd"
549
+ }
550
+ )
551
+ }
552
+ ) });
553
+ }
554
+ return /* @__PURE__ */ jsx9(React3.Fragment, { children: booleanValue ? "true" : "false" });
555
+ };
556
+ var BooleanView_default = BooleanView;
557
+
558
+ // src/components/controls/view/Asset.tsx
559
+ import React4 from "react";
560
+ import { jsx as jsx10 } from "react/jsx-runtime";
561
+ var MediaAsset = (props) => {
562
+ let assets;
563
+ if (props.value != void 0 && props.value != null && props.value != "") {
564
+ try {
565
+ assets = JSON.parse(props.value);
566
+ console.log("Parsed Assets: ", assets);
567
+ } catch (error) {
568
+ console.error("Error parsing assets:", error);
569
+ }
570
+ }
571
+ if (!assets || assets.length === 0) {
572
+ return null;
573
+ }
574
+ console.log(props.customProps?.tag, "Tag in MediaAsset");
575
+ return /* @__PURE__ */ jsx10(React4.Fragment, { children: /* @__PURE__ */ jsx10(
576
+ DeviceAssetSelector_default,
577
+ {
578
+ assets,
579
+ apiBaseUrl: props.apiBaseUrl,
580
+ assetBaseUrl: props.assetBaseUrl ? props.assetBaseUrl : props.apiBaseUrl,
581
+ session: props,
582
+ width: props.width,
583
+ customProps: props.customProps,
584
+ tag: props.customProps?.tag
585
+ }
586
+ ) });
587
+ };
588
+ var Asset_default = MediaAsset;
589
+
590
+ // src/components/controls/view/LineTextView.tsx
591
+ import React5 from "react";
592
+ import { jsx as jsx11 } from "react/jsx-runtime";
593
+ var LineText = (props) => {
594
+ return /* @__PURE__ */ jsx11(React5.Fragment, { children: props.value });
595
+ };
596
+ var LineTextView_default = LineText;
597
+
598
+ // src/components/controls/view/MoneyView.tsx
599
+ import React6 from "react";
600
+
601
+ // src/components/utilities/CurrencyUtility.tsx
602
+ var CurrencyUtility = class {
603
+ static getCurrencySymbol(currencyCode) {
604
+ switch (currencyCode) {
605
+ case "USD":
606
+ return "$";
607
+ case "INR":
608
+ return "\u20B9";
609
+ case "EUR":
610
+ return "\u20AC";
611
+ // Add more cases for other currency codes as needed
612
+ default:
613
+ return currencyCode;
614
+ }
615
+ }
616
+ };
617
+ var CurrencyUtility_default = CurrencyUtility;
618
+
619
+ // src/components/controls/view/MoneyView.tsx
620
+ import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
621
+ var Money = (props) => {
622
+ const parsedNumber = parseFloat(props.value);
623
+ return /* @__PURE__ */ jsx12(React6.Fragment, { children: !Number.isNaN(parsedNumber) && /* @__PURE__ */ jsxs3(React6.Fragment, { children: [
624
+ /* @__PURE__ */ jsx12("span", { className: "mr-0.5", children: CurrencyUtility_default.getCurrencySymbol(props.unit) }),
625
+ parsedNumber.toLocaleString()
626
+ ] }) });
627
+ };
628
+ var MoneyView_default = Money;
629
+
630
+ // src/components/controls/view/MultilineTextBulletsView.tsx
631
+ import React7 from "react";
632
+ import { jsx as jsx13 } from "react/jsx-runtime";
633
+ var MultilineTextBullets = (props) => {
634
+ const lines = props.value?.split("\\n");
635
+ return /* @__PURE__ */ jsx13(React7.Fragment, { children: /* @__PURE__ */ jsx13("ul", { className: "list-disc", children: lines && lines.map((line, index) => {
636
+ return /* @__PURE__ */ jsx13("li", { children: line }, index);
637
+ }) }) });
638
+ };
639
+ var MultilineTextBulletsView_default = MultilineTextBullets;
640
+
641
+ // src/components/controls/view/MultilineTextView.tsx
642
+ import React8 from "react";
643
+ import { jsx as jsx14 } from "react/jsx-runtime";
644
+ var MultilineText = (props) => {
645
+ return /* @__PURE__ */ jsx14(React8.Fragment, { children: /* @__PURE__ */ jsx14("span", { className: "whitespace-pre-line", children: props.value }) });
646
+ };
647
+ var MultilineTextView_default = MultilineText;
648
+
649
+ // src/components/controls/view/PercentageView.tsx
650
+ import React9 from "react";
651
+ import { jsxs as jsxs4 } from "react/jsx-runtime";
652
+ var PercentageView = (props) => {
653
+ return /* @__PURE__ */ jsxs4(React9.Fragment, { children: [
654
+ props.value,
655
+ "%"
656
+ ] });
657
+ };
658
+ var PercentageView_default = PercentageView;
659
+
660
+ // src/components/controls/view/ProgressIndicator.tsx
661
+ import React10 from "react";
662
+ import { jsx as jsx15, jsxs as jsxs5 } from "react/jsx-runtime";
663
+ var ProgressIndicator = (props) => {
664
+ const percentage = 100;
665
+ const circumference = Math.PI * 56;
666
+ const offset = circumference * (1 - percentage / 100);
667
+ return /* @__PURE__ */ jsx15(React10.Fragment, { children: /* @__PURE__ */ jsxs5("div", { className: "relative w-48 h-48", children: [
668
+ /* @__PURE__ */ jsx15("div", { className: "absolute top-0 left-0 w-full h-full rounded-full border border-gray-200" }),
669
+ /* @__PURE__ */ jsx15("div", { className: "absolute top-0 left-0 w-full h-full rounded-full overflow-hidden", children: /* @__PURE__ */ jsx15("div", { className: "w-full h-full rounded-full border-t-8 border-green-500", style: { transform: `rotate(-90deg)`, clipPath: `inset(0px ${offset}px 0px 0px)` } }) }),
670
+ /* @__PURE__ */ jsx15("div", { className: "absolute top-0 left-0 w-full h-full flex items-center justify-center text-lg font-bold text-gray-800", children: /* @__PURE__ */ jsxs5("span", { children: [
671
+ percentage,
672
+ "%"
673
+ ] }) })
674
+ ] }) });
675
+ };
676
+ var ProgressIndicator_default = ProgressIndicator;
677
+
678
+ // src/components/controls/view/AiGeneratedSummary.tsx
679
+ import { jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
680
+ var AiGeneratedSummary = (props) => {
681
+ const lines = props.value?.split("\n").filter((line) => line.trim() !== "") || [];
682
+ return /* @__PURE__ */ jsxs6("details", { className: "group rounded-xl border-2 bg-white shadow-sm border-p overflow-hidden", children: [
683
+ /* @__PURE__ */ jsx16("summary", { className: "flex items-start justify-between cursor-pointer list-none", children: /* @__PURE__ */ jsxs6("div", { className: "flex items-start gap-3 ", children: [
684
+ /* @__PURE__ */ jsx16("div", { className: "bg-primary-base bg-transparent rounded mt-1 p-1", children: /* @__PURE__ */ jsx16("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5", children: /* @__PURE__ */ jsx16("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z" }) }) }),
685
+ /* @__PURE__ */ jsxs6("div", { children: [
686
+ /* @__PURE__ */ jsx16("h3", { className: "text-lg font-semibold ", children: "Quick Read" }),
687
+ /* @__PURE__ */ jsx16("p", { className: "text-sm text-gray-500 mb-0", children: "Summary is AI-generated, author-reviewed" })
688
+ ] })
689
+ ] }) }),
690
+ /* @__PURE__ */ jsx16("div", { children: /* @__PURE__ */ jsx16("ul", { className: "list-disc pl-6 space-y-3 text-gray-700 ps-4 pl-4", children: lines.map((line, index) => /* @__PURE__ */ jsx16("li", { className: "m-0", children: line }, index)) }) })
691
+ ] });
692
+ };
693
+ var AiGeneratedSummary_default = AiGeneratedSummary;
694
+
695
+ // src/components/controls/view/DateTimeVew.tsx
696
+ import dynamic5 from "next/dynamic";
697
+ var DateTimeView = dynamic5(() => import("./DateTimeViewClient-22GW4AD7.mjs"), {
698
+ ssr: false
699
+ });
700
+ var DateTimeVew_default = DateTimeView;
701
+
702
+ // src/components/controls/view/ViewControl.tsx
703
+ import { jsx as jsx17 } from "react/jsx-runtime";
704
+ var ViewControl = (props) => {
705
+ const ControlComponents = {
706
+ [ViewControlTypes_default.lineText]: LineTextView_default,
707
+ [ViewControlTypes_default.asset]: Asset_default,
708
+ [ViewControlTypes_default.multilineTextBullets]: MultilineTextBulletsView_default,
709
+ [ViewControlTypes_default.boolean]: BooleanView_default,
710
+ // [ViewControlTypes.timeUntilStarts]: TimeUntilStarts,
711
+ [ViewControlTypes_default.money]: MoneyView_default,
712
+ [ViewControlTypes_default.date]: DateView_default,
713
+ [ViewControlTypes_default.time]: DateView_default,
714
+ [ViewControlTypes_default.datetime]: DateTimeVew_default,
715
+ [ViewControlTypes_default.number]: NumberView_default,
716
+ [ViewControlTypes_default.multilineText]: MultilineTextView_default,
717
+ [ViewControlTypes_default.moneyText]: MoneyView_default,
718
+ [ViewControlTypes_default.percentage]: PercentageView_default,
719
+ // [ViewControlTypes.statusBg]: StatusBg,
720
+ [ViewControlTypes_default.progressIndicator]: ProgressIndicator_default,
721
+ // [ViewControlTypes.timeUntilStarts]: TimeUntilStarts,
722
+ // [ViewControlTypes.timeUntilStartsStyled]: TimeUntilStartsStyled,
723
+ [ViewControlTypes_default.aiGeneratedSummary]: AiGeneratedSummary_default
724
+ };
725
+ const SelectedControlComponent = props.controlType ? ControlComponents[props.controlType] : void 0;
726
+ return /* @__PURE__ */ jsx17(React11.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx17(SelectedControlComponent, { ...props }) : "Control not found:" + props.controlType });
727
+ };
728
+ var ViewControl_default = ViewControl;
729
+
730
+ // src/components/pageRenderingEngine/nodes/DatafieldNode.tsx
731
+ import { jsx as jsx18 } from "react/jsx-runtime";
732
+ function getNestedProperty(obj, path) {
733
+ if (!obj || !path) return null;
734
+ if (path.includes(".")) {
735
+ return path.split(".").reduce((prev, curr) => {
736
+ if (prev && typeof prev === "object") {
737
+ return prev[curr];
738
+ }
739
+ return null;
740
+ }, obj);
741
+ }
742
+ const value = obj[path];
743
+ if (Array.isArray(value)) {
744
+ return value.map((item, index) => /* @__PURE__ */ jsx18("div", { children: String(item) }, index));
745
+ }
746
+ return value;
747
+ }
748
+ var DatafieldNode = (props) => {
749
+ function cssStringToJson(cssString) {
750
+ const styleObject = {};
751
+ const matches = cssString?.match(/([\w-]+)\s*:\s*([^;]+)\s*;/g);
752
+ if (matches) {
753
+ matches.forEach((match) => {
754
+ const parts = match.match(/([\w-]+)\s*:\s*([^;]+)\s*;/);
755
+ if (parts && parts.length === 3) {
756
+ styleObject[parts[1].trim()] = parts[2].trim();
757
+ }
758
+ });
759
+ }
760
+ return styleObject;
761
+ }
762
+ function toCamelCase2(str) {
763
+ return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
764
+ }
765
+ function convertKeysToCamelCase2(obj) {
766
+ return Object.fromEntries(
767
+ Object.entries(obj).map(([key, value2]) => [
768
+ toCamelCase2(key),
769
+ value2
770
+ ])
771
+ );
772
+ }
773
+ const Formats = [
774
+ "",
775
+ "font-medium",
776
+ "italic",
777
+ "font-medium italic",
778
+ "",
779
+ "",
780
+ "",
781
+ "",
782
+ "underline",
783
+ "font-medium underline",
784
+ "italic underline",
785
+ "italic underline font-medium"
786
+ ];
787
+ const styles = convertKeysToCamelCase2(
788
+ cssStringToJson(props.node.style)
789
+ );
790
+ const fieldName = props.node.fieldName ?? "";
791
+ const value = props.dataitem ? getNestedProperty(props.dataitem, fieldName) : null;
792
+ const isEmptyValue = value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0 || typeof value === "object" && value !== null && Object.keys(value).length === 0;
793
+ const maxLines = props.node.maxLines;
794
+ if (maxLines && Number(maxLines) > 0) {
795
+ Object.assign(styles, {
796
+ display: "-webkit-box",
797
+ overflow: "hidden",
798
+ WebkitBoxOrient: "vertical",
799
+ WebkitLineClamp: String(maxLines)
800
+ });
801
+ }
802
+ const dataType = props.node.dataType;
803
+ if (isEmptyValue) return null;
804
+ if (dataType === "rawContent") {
805
+ return /* @__PURE__ */ jsx18(
806
+ PageBodyRenderer_default,
807
+ {
808
+ rawBody: String(value ?? `@databound[${fieldName}]`),
809
+ routeParameters: props.routeParameters,
810
+ query: props.query,
811
+ session: props.session,
812
+ host: props.host,
813
+ path: props.path,
814
+ apiBaseUrl: props.apiBaseUrl,
815
+ breadcrumb: props.breadcrumb,
816
+ donotApplyContainerClass: true,
817
+ widgetRenderer: props.widgetRenderer
818
+ }
819
+ );
820
+ }
821
+ return /* @__PURE__ */ jsx18(
822
+ "span",
823
+ {
824
+ className: `datafield-node ${props.node.format < Formats.length ? Formats[props.node.format] : ""}`,
825
+ style: styles,
826
+ children: /* @__PURE__ */ jsx18(
827
+ ViewControl_default,
828
+ {
829
+ controlType: dataType,
830
+ value: value ?? `@databound[${fieldName}]`
831
+ }
832
+ )
833
+ }
834
+ );
835
+ };
836
+ var DatafieldNode_default = DatafieldNode;
837
+
838
+ // src/components/pageRenderingEngine/nodes/ParagraphNode.tsx
839
+ import { Fragment as Fragment2, jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
840
+ var ParagraphNode = (props) => {
841
+ const NodeTypes2 = {
842
+ ["text"]: TextNode_default,
843
+ ["linebreak"]: LineBreakNode_default,
844
+ ["link"]: LinkNode_default,
845
+ ["datafield"]: DatafieldNode_default,
846
+ ["equation"]: EquationNode_default,
847
+ ["svg-icon"]: SVGIconNode_default
848
+ };
849
+ const FormatClass = {
850
+ "center": "text-center",
851
+ "right": "text-right"
852
+ };
853
+ {
854
+ }
855
+ const formatClasses = FormatClass[props.node.format] || "";
856
+ const isInlineOnlyParent = props.parentTag === "summary";
857
+ const hasChildren = props.node.children && props.node.children.length > 0;
858
+ if (isInlineOnlyParent) {
859
+ return /* @__PURE__ */ jsx19(Fragment2, { children: hasChildren && props.node.children.map((node, index) => {
860
+ const SelectedNode = NodeTypes2[node.type];
861
+ return /* @__PURE__ */ jsx19(React12.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx19(
862
+ SelectedNode,
863
+ {
864
+ node,
865
+ dataitem: props.dataitem,
866
+ session: props.session,
867
+ apiBaseUrl: props.apiBaseUrl,
868
+ routeParameters: props.routeParameters
869
+ }
870
+ ) }, index);
871
+ }) });
872
+ }
873
+ return /* @__PURE__ */ jsxs7("div", { className: " " + formatClasses, children: [
874
+ hasChildren && props.node.children.map((node, index) => {
875
+ const SelectedNode = NodeTypes2[node.type];
876
+ return /* @__PURE__ */ jsx19(React12.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx19(
877
+ SelectedNode,
878
+ {
879
+ node,
880
+ dataitem: props.dataitem,
881
+ session: props.session,
882
+ apiBaseUrl: props.apiBaseUrl,
883
+ routeParameters: props.routeParameters
884
+ }
885
+ ) }, index);
886
+ }),
887
+ !hasChildren && /* @__PURE__ */ jsx19("div", { className: "py-1.5 lg:py-2" })
888
+ ] });
889
+ };
890
+ var ParagraphNode_default = ParagraphNode;
891
+
892
+ // src/components/pageRenderingEngine/nodes/HeadingNode.tsx
893
+ import React13 from "react";
894
+ import { Fragment as Fragment3, jsx as jsx20 } from "react/jsx-runtime";
895
+ var HeadingNode = (props) => {
896
+ const NodeTypes2 = {
897
+ ["text"]: TextNode_default,
898
+ ["link"]: LinkNode_default,
899
+ ["svg-icon"]: SVGIconNode_default,
900
+ ["linebreak"]: LineBreakNode_default,
901
+ ["datafield"]: DatafieldNode_default
902
+ };
903
+ const HeadingTag = `${props.node.tag}`;
904
+ const FormatClass = {
905
+ "center": "text-center"
906
+ };
907
+ {
908
+ }
909
+ const formatClasses = FormatClass[props.node.format] || "";
910
+ return /* @__PURE__ */ jsx20(Fragment3, { children: React13.createElement(
911
+ HeadingTag,
912
+ { className: formatClasses },
913
+ props.node.children && props.node.children.map((childNode, index) => {
914
+ const SelectedNode = NodeTypes2[childNode.type];
915
+ return /* @__PURE__ */ jsx20(React13.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx20(SelectedNode, { node: childNode, dataitem: props.dataitem, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
916
+ })
917
+ ) });
918
+ };
919
+ var HeadingNode_default = HeadingNode;
920
+
921
+ // src/components/pageRenderingEngine/nodes/ListNode.tsx
922
+ import React15 from "react";
923
+
924
+ // src/components/pageRenderingEngine/nodes/ListItemNode.tsx
925
+ import React14 from "react";
926
+ import { jsx as jsx21 } from "react/jsx-runtime";
927
+ var ListItemNode = (props) => {
928
+ const NodeTypes2 = {
929
+ text: TextNode_default,
930
+ linebreak: LineBreakNode_default,
931
+ link: LinkNode_default,
932
+ list: ListNode_default
933
+ };
934
+ let foundFirstBreak = false;
935
+ const firstTextChild = props.node.children?.find((c) => c.type === "text");
936
+ let liStyle = {};
937
+ if (firstTextChild?.style) {
938
+ const match = firstTextChild.style.match(/font-size\s*:\s*([^;]+);?/);
939
+ if (match) {
940
+ liStyle.fontSize = match[1].trim();
941
+ }
942
+ }
943
+ return /* @__PURE__ */ jsx21("li", { style: liStyle, children: props.node.children && props.node.children.map((node, index) => {
944
+ const SelectedNode = NodeTypes2[node.type];
945
+ if (node.type === "linebreak") {
946
+ if (!foundFirstBreak) {
947
+ foundFirstBreak = true;
948
+ return /* @__PURE__ */ jsx21("div", {}, index);
949
+ } else {
950
+ return /* @__PURE__ */ jsx21("div", { className: "py-1 lg:py-2" }, index);
951
+ }
952
+ } else {
953
+ foundFirstBreak = false;
954
+ return /* @__PURE__ */ jsx21(React14.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx21(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
955
+ }
956
+ }) });
957
+ };
958
+ var ListItemNode_default = ListItemNode;
959
+
960
+ // src/components/pageRenderingEngine/nodes/ListNode.tsx
961
+ import { jsx as jsx22, jsxs as jsxs8 } from "react/jsx-runtime";
962
+ var ListNode = (props) => {
963
+ const NodeTypes2 = {
964
+ listitem: ListItemNode_default
965
+ };
966
+ return /* @__PURE__ */ jsxs8(React15.Fragment, { children: [
967
+ props.node.listType == "bullet" && /* @__PURE__ */ jsx22("ul", { children: props.node.children && props.node.children.map((node, index) => {
968
+ const SelectedNode = NodeTypes2[node.type];
969
+ return /* @__PURE__ */ jsx22(React15.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx22(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
970
+ }) }),
971
+ props.node.listType == "number" && /* @__PURE__ */ jsx22("ol", { children: props.node.children && props.node.children.map((node, index) => {
972
+ const SelectedNode = NodeTypes2[node.type];
973
+ return /* @__PURE__ */ jsx22(React15.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx22(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
974
+ }) })
975
+ ] });
976
+ };
977
+ var ListNode_default = ListNode;
978
+
979
+ // src/components/pageRenderingEngine/nodes/QuoteNode.tsx
980
+ import React16 from "react";
981
+ import { jsx as jsx23 } from "react/jsx-runtime";
982
+ var QuoteNode = (props) => {
983
+ const NodeTypes2 = {
984
+ ["text"]: TextNode_default,
985
+ ["linebreak"]: LineBreakNode_default,
986
+ ["link"]: LinkNode_default
987
+ };
988
+ return /* @__PURE__ */ jsx23("blockquote", { children: props.node.children && props.node.children.map((node, index) => {
989
+ const SelectedNode = NodeTypes2[node.type];
990
+ return /* @__PURE__ */ jsx23(React16.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx23(SelectedNode, { node, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
991
+ }) });
992
+ };
993
+ var QuoteNode_default = QuoteNode;
994
+
995
+ // src/components/pageRenderingEngine/nodes/CodeNode.tsx
996
+ import React17 from "react";
997
+ import dynamic6 from "next/dynamic";
998
+ import { jsx as jsx24, jsxs as jsxs9 } from "react/jsx-runtime";
999
+ var CopyButton = dynamic6(() => import("./CopyButton-XONTQQW7.mjs"), {
1000
+ ssr: false,
1001
+ // optional: fallback UI while loading
1002
+ loading: () => /* @__PURE__ */ jsx24("span", { className: "text-gray-400 text-xs", children: "Copy" })
1003
+ });
1004
+ var CodeNode = (props) => {
1005
+ const NodeTypes2 = {
1006
+ text: TextNode_default,
1007
+ linebreak: LineBreakNode_default,
1008
+ link: LinkNode_default
1009
+ };
1010
+ const textContent = props.node?.children?.map((node) => {
1011
+ if (node.type === "text") return node.text || "";
1012
+ if (node.type === "linebreak") return "\n";
1013
+ if (node.type === "link") return node.text || node.url || "";
1014
+ return "";
1015
+ }).join("") ?? "";
1016
+ return /* @__PURE__ */ jsxs9("div", { children: [
1017
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center relative bg-neutral-strong px-4 py-3 text-xs font-sans justify-between rounded-t-md ", children: [
1018
+ /* @__PURE__ */ jsx24("span", { children: "Code Snippet" }),
1019
+ /* @__PURE__ */ jsx24(CopyButton, { text: textContent })
1020
+ ] }),
1021
+ /* @__PURE__ */ jsx24("code", { className: "bg-neutral-soft p-4 text-sm whitespace-pre-wrap border border-2 block", children: props.node.children && props.node.children.map((node, index) => {
1022
+ const SelectedNode = NodeTypes2[node.type];
1023
+ return /* @__PURE__ */ jsx24(React17.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx24(
1024
+ SelectedNode,
1025
+ {
1026
+ node,
1027
+ session: props.session,
1028
+ apiBaseUrl: props.apiBaseUrl,
1029
+ routeParameters: props.routeParameters
1030
+ }
1031
+ ) }, index);
1032
+ }) })
1033
+ ] });
1034
+ };
1035
+ var CodeNode_default = CodeNode;
1036
+
1037
+ // src/components/pageRenderingEngine/nodes/HorizontalRuleNode.tsx
1038
+ import { jsx as jsx25 } from "react/jsx-runtime";
1039
+ var HorizontalRuleNode = () => {
1040
+ return /* @__PURE__ */ jsx25("hr", {});
1041
+ };
1042
+ var HorizontalRuleNode_default = HorizontalRuleNode;
1043
+
1044
+ // src/components/pageRenderingEngine/nodes/WidgetNode.tsx
1045
+ import React18 from "react";
1046
+ import { Fragment as Fragment4, jsx as jsx26 } from "react/jsx-runtime";
1047
+ var WidgetNode = (props) => {
1048
+ const getWidgetParameters = () => {
1049
+ const widgetInputParameters = {
1050
+ ...props.routeParameters ?? {}
1051
+ };
1052
+ const rawWidgetParams = props.node.widgetParameters ?? props.node.widgetParams;
1053
+ let widgetParameters = {};
1054
+ const isJSON = (str) => {
1055
+ const s = str.trim();
1056
+ return s.startsWith("{") && s.endsWith("}") || s.startsWith("[") && s.endsWith("]");
1057
+ };
1058
+ if (rawWidgetParams) {
1059
+ if (typeof rawWidgetParams === "string" && isJSON(rawWidgetParams)) {
1060
+ try {
1061
+ widgetParameters = JSON.parse(rawWidgetParams);
1062
+ } catch {
1063
+ widgetParameters = {};
1064
+ }
1065
+ } else if (typeof rawWidgetParams === "object") {
1066
+ widgetParameters = rawWidgetParams;
1067
+ }
1068
+ }
1069
+ if (props.dataitem && typeof props.dataitem === "object") {
1070
+ Object.keys(widgetParameters).forEach((key) => {
1071
+ if (props.dataitem[key] !== void 0 && props.dataitem[key] !== null) {
1072
+ widgetParameters[key] = props.dataitem[key];
1073
+ }
1074
+ });
1075
+ }
1076
+ const resolveValue = (val) => {
1077
+ if (typeof val === "string") {
1078
+ const m = /^\{(.+)\}$/.exec(val);
1079
+ if (m) {
1080
+ const actualKey = m[1];
1081
+ return props.routeParameters?.[actualKey] ?? val;
1082
+ }
1083
+ return val;
1084
+ }
1085
+ if (Array.isArray(val)) {
1086
+ return val.map(resolveValue);
1087
+ }
1088
+ if (val && typeof val === "object") {
1089
+ const out = {};
1090
+ for (const k of Object.keys(val)) {
1091
+ out[k] = resolveValue(val[k]);
1092
+ }
1093
+ return out;
1094
+ }
1095
+ return val;
1096
+ };
1097
+ for (const key of Object.keys(widgetParameters)) {
1098
+ const rawVal = widgetParameters[key];
1099
+ if (rawVal === "route") {
1100
+ widgetInputParameters[key] = key === "itemPath" ? props.path : widgetInputParameters[key] ?? null;
1101
+ } else {
1102
+ widgetInputParameters[key] = resolveValue(rawVal);
1103
+ }
1104
+ }
1105
+ widgetInputParameters["widgetTitle"] = props.node.widgetTitle;
1106
+ return widgetInputParameters;
1107
+ };
1108
+ const widgetCode = props.node?.widgetCode;
1109
+ if (!widgetCode) {
1110
+ return /* @__PURE__ */ jsx26(Fragment4, { children: "Invalid widget" });
1111
+ }
1112
+ const widgetParams = getWidgetParameters();
1113
+ const WidgetRenderer = props.widgetRenderer;
1114
+ if (!WidgetRenderer) {
1115
+ return null;
1116
+ }
1117
+ return (
1118
+ // eslint-disable-next-line react-hooks/static-components
1119
+ /* @__PURE__ */ jsx26(React18.Fragment, { children: /* @__PURE__ */ jsx26(
1120
+ WidgetRenderer,
1121
+ {
1122
+ params: widgetParams,
1123
+ query: props.query,
1124
+ session: props.session,
1125
+ host: props.host,
1126
+ path: props.path,
1127
+ apiBaseUrl: props.apiBaseUrl,
1128
+ widgetCode
1129
+ }
1130
+ ) })
1131
+ );
1132
+ };
1133
+ var WidgetNode_default = WidgetNode;
1134
+
1135
+ // src/components/pageRenderingEngine/nodes/DivContainer.tsx
1136
+ import React19 from "react";
1137
+
1138
+ // src/components/pageRenderingEngine/nodes/EmbedNode.tsx
1139
+ import dynamic7 from "next/dynamic";
1140
+ import { jsx as jsx27 } from "react/jsx-runtime";
1141
+ var IframeClient = dynamic7(() => import("./IframeClient-J22NMEVY.mjs"), {
1142
+ ssr: false
1143
+ });
1144
+ var EmbedNode = (props) => {
1145
+ let src;
1146
+ if (props.node.provider == "youtube") {
1147
+ src = `https://www.youtube-nocookie.com/embed/${props.node.embedSrc}`;
1148
+ } else if (props.node.provider == "bunny") {
1149
+ src = `https://iframe.mediadelivery.net/embed/${props.node.embedSrc}?autoplay=false&loop=false&muted=false&preload=true&responsive=true`;
1150
+ } else {
1151
+ src = props.node.embedSrc;
1152
+ }
1153
+ return /* @__PURE__ */ jsx27("div", { className: "aspect-video", children: src && /* @__PURE__ */ jsx27(IframeClient, { src }) });
1154
+ };
1155
+ var EmbedNode_default = EmbedNode;
1156
+
1157
+ // src/components/utilities/AnimationUtility.tsx
1158
+ var AnimationUtility = class {
1159
+ static generateAnimationCSS(config, guid) {
1160
+ const {
1161
+ duration = 700,
1162
+ delay = 0,
1163
+ easing = "ease-out",
1164
+ distance = 30,
1165
+ scaleStart = 1,
1166
+ scaleEnd = 1.2,
1167
+ repeat = 1,
1168
+ intensity = 20,
1169
+ speedPerChar = 100,
1170
+ cursor = true,
1171
+ mode = "enter",
1172
+ direction = "left"
1173
+ // Default direction
1174
+ } = config;
1175
+ let base = "", visible = "", keyframes = "";
1176
+ switch (config.animation) {
1177
+ case "Fade":
1178
+ base = `opacity:0; transition:opacity ${duration}ms ${easing} ${delay}ms;`;
1179
+ visible = `opacity:1;`;
1180
+ break;
1181
+ case "FadeInUp":
1182
+ base = `opacity:0; transform:translateY(${distance}px); transition:all ${duration}ms ${easing} ${delay}ms;`;
1183
+ visible = `opacity:1; transform:translateY(0);`;
1184
+ break;
1185
+ case "Slide":
1186
+ const slideTransform = this.getSlideTransform(direction, distance);
1187
+ base = `opacity:0; transform:${slideTransform.start}; transition:all ${duration}ms ${easing} ${delay}ms; will-change: transform, opacity;`;
1188
+ visible = `opacity:1; transform:${slideTransform.end}; will-change: unset;`;
1189
+ break;
1190
+ case "ZoomIn":
1191
+ if (mode === "enter") {
1192
+ base = `opacity:0; transform:scale(${scaleStart}); transition:all ${duration}ms ${easing} ${delay}ms;`;
1193
+ visible = `opacity:1; transform:scale(${scaleEnd});`;
1194
+ } else {
1195
+ base = `transform:scale(${scaleStart}); transition:transform ${duration / 1e3}s ${easing} ${delay / 1e3}s;`;
1196
+ visible = `transform:scale(${scaleEnd});`;
1197
+ }
1198
+ break;
1199
+ case "Bounce":
1200
+ keyframes = `
1201
+ @keyframes bounce {
1202
+ 0%,20%,50%,80%,100% { transform: translateY(0); }
1203
+ 40% { transform: translateY(-${intensity}px); }
1204
+ 60% { transform: translateY(-${intensity / 2}px); }
1205
+ }
1206
+ `;
1207
+ if (mode === "enter") {
1208
+ base = `opacity:0;`;
1209
+ visible = `opacity:1; animation:bounce ${duration}ms ${easing} ${delay}ms ${repeat};`;
1210
+ } else {
1211
+ base = ``;
1212
+ visible = `animation:bounce ${duration / 1e3}s ${easing} ${delay / 1e3}s ${repeat};`;
1213
+ }
1214
+ break;
1215
+ case "Typewriter":
1216
+ keyframes = `
1217
+ @keyframes typewriter { from { width: 0 } to { width: 100% } }
1218
+ @keyframes blink { 50% { border-color: transparent } }
1219
+ `;
1220
+ base = `
1221
+ overflow:hidden;
1222
+ border-right:${cursor ? "2px solid black" : "none"};
1223
+ white-space:nowrap;
1224
+ width:0;
1225
+ margin:0 auto;
1226
+ `;
1227
+ visible = `
1228
+ animation:typewriter ${speedPerChar * 30}ms steps(30,end) ${delay}ms forwards
1229
+ ${cursor ? ", blink .75s step-end infinite" : ""};
1230
+ `;
1231
+ break;
1232
+ }
1233
+ if (mode === "hover") {
1234
+ return `
1235
+ ${keyframes}
1236
+ ${guid} { ${base} }
1237
+ ${guid}:hover { ${visible} }
1238
+ `;
1239
+ } else {
1240
+ return `
1241
+ ${keyframes}
1242
+ ${guid} { ${base} }
1243
+ ${guid}.visible { ${visible} }
1244
+ `;
1245
+ }
1246
+ }
1247
+ // Helper method to generate slide transforms based on direction
1248
+ static getSlideTransform(direction, distance) {
1249
+ switch (direction) {
1250
+ case "left":
1251
+ return { start: `translateX(${distance}px)`, end: `translateX(0)` };
1252
+ case "right":
1253
+ return { start: `translateX(-${distance}px)`, end: `translateX(0)` };
1254
+ case "up":
1255
+ return { start: `translateY(${distance}px)`, end: `translateY(0)` };
1256
+ case "down":
1257
+ return { start: `translateY(-${distance}px)`, end: `translateY(0)` };
1258
+ default:
1259
+ return { start: `translateX(${distance}px)`, end: `translateX(0)` };
1260
+ }
1261
+ }
1262
+ };
1263
+ var AnimationUtility_default = AnimationUtility;
1264
+
1265
+ // src/components/utilities/PathUtility.tsx
1266
+ var PathUtility = class {
1267
+ constructor() {
1268
+ }
1269
+ normalizePath(path) {
1270
+ if (path == null) {
1271
+ return "/";
1272
+ }
1273
+ const trimmedPath = path.replace(/^\/|\/$/g, "");
1274
+ return trimmedPath === "" ? "/" : "/" + trimmedPath + "/";
1275
+ }
1276
+ joinAndNormalizePaths(path1, path2) {
1277
+ path1 = path1.replace(/\/$/, "");
1278
+ path2 = path2.replace(/^\//, "");
1279
+ const joinedPath = `${path1}/${path2}`;
1280
+ const normalizedPath = joinedPath.replace(/\/{2,}/g, "/");
1281
+ return normalizedPath === "" ? "/" : "/" + normalizedPath;
1282
+ }
1283
+ removeLeadingAndTrailingSlashes(path) {
1284
+ if (path == null) {
1285
+ return "/";
1286
+ }
1287
+ const trimmedPath = path.replace(/^\/|\/$/g, "");
1288
+ return trimmedPath;
1289
+ }
1290
+ removeTrailingSlash(path) {
1291
+ if (path == null) {
1292
+ return "/";
1293
+ }
1294
+ const trimmedPath = path.replace(/\/$/, "");
1295
+ return trimmedPath;
1296
+ }
1297
+ joinPaths(path1, path2) {
1298
+ if (!path1.endsWith("/") && !path2.startsWith("/")) {
1299
+ return `${path1}/${path2}`;
1300
+ } else if (path1.endsWith("/") && path2.startsWith("/")) {
1301
+ return `${path1}${path2.substr(1)}`;
1302
+ } else {
1303
+ return `${path1}${path2}`;
1304
+ }
1305
+ }
1306
+ getFirstSegment(path) {
1307
+ if (!path || path === "/") {
1308
+ return "";
1309
+ }
1310
+ const segments = path.split("/").filter(Boolean);
1311
+ return segments.length > 0 ? segments[0] : "";
1312
+ }
1313
+ getFileNameFromUrl(url) {
1314
+ if (!url || url.indexOf("/") === -1) {
1315
+ return url;
1316
+ }
1317
+ const parts = url.split("/");
1318
+ const filename = parts[parts.length - 1];
1319
+ return filename;
1320
+ }
1321
+ };
1322
+ var PathUtility_default = new PathUtility();
1323
+
1324
+ // src/components/NoDataFound.tsx
1325
+ import { jsx as jsx28, jsxs as jsxs10 } from "react/jsx-runtime";
1326
+ var NoDataFound = () => {
1327
+ return /* @__PURE__ */ jsxs10("div", { className: "flex flex-col items-center justify-center py-12 px-4 text-center bg-neutral-weak", children: [
1328
+ /* @__PURE__ */ jsx28("div", { className: "mb-5", children: /* @__PURE__ */ jsx28("div", { className: "mx-auto w-20 h-20 rounded-full flex items-center justify-center bg-neutral-soft", children: /* @__PURE__ */ jsx28(
1329
+ "svg",
1330
+ {
1331
+ className: "w-10 h-10",
1332
+ fill: "none",
1333
+ stroke: "currentColor",
1334
+ viewBox: "0 0 24 24",
1335
+ xmlns: "http://www.w3.org/2000/svg",
1336
+ children: /* @__PURE__ */ jsx28(
1337
+ "path",
1338
+ {
1339
+ strokeLinecap: "round",
1340
+ strokeLinejoin: "round",
1341
+ strokeWidth: "1.5",
1342
+ d: "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"
1343
+ }
1344
+ )
1345
+ }
1346
+ ) }) }),
1347
+ /* @__PURE__ */ jsx28("h3", { className: "text-lg font-medium mb-2", children: "No data available" }),
1348
+ /* @__PURE__ */ jsx28("p", { className: " max-w-sm mb-0", children: "No records found. Data may be empty or not available at the moment." })
1349
+ ] });
1350
+ };
1351
+ var NoDataFound_default = NoDataFound;
1352
+
1353
+ // src/components/pageRenderingEngine/nodes/DivContainer.tsx
1354
+ import dynamic9 from "next/dynamic";
1355
+
1356
+ // src/components/pageRenderingEngine/nodes/ImageGalleryNode.tsx
1357
+ import dynamic8 from "next/dynamic";
1358
+ import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs11 } from "react/jsx-runtime";
1359
+ var HlsPlayer3 = dynamic8(() => import("./HlsPlayer-57543DTW.mjs"), { ssr: false });
1360
+ var deviceToMediaQuery = (device) => {
1361
+ switch (device) {
1362
+ case "lg":
1363
+ return "(min-width: 769px)";
1364
+ case "md":
1365
+ return "(min-width: 481px) and (max-width: 768px)";
1366
+ case "sm":
1367
+ return "(max-width: 480px)";
1368
+ default:
1369
+ return null;
1370
+ }
1371
+ };
1372
+ var DEVICE_ORDER = ["lg", "md", "sm", "tv"];
1373
+ var parseMaybeNumber = (value) => {
1374
+ if (typeof value === "number")
1375
+ return Number.isFinite(value) ? value : void 0;
1376
+ if (typeof value !== "string") return void 0;
1377
+ const n = Number(value);
1378
+ return Number.isFinite(n) ? n : void 0;
1379
+ };
1380
+ function resolveAssetUrl(fieldValue, tag) {
1381
+ if (!fieldValue) {
1382
+ return void 0;
1383
+ }
1384
+ if (typeof fieldValue === "string") {
1385
+ const trimmed = fieldValue.trim();
1386
+ if (trimmed.startsWith("itemassets/") || trimmed.startsWith("/itemassets/") || trimmed.startsWith("http")) {
1387
+ return trimmed;
1388
+ }
1389
+ try {
1390
+ const parsed = JSON.parse(trimmed);
1391
+ return resolveAssetUrl(parsed, tag);
1392
+ } catch {
1393
+ return void 0;
1394
+ }
1395
+ }
1396
+ if (Array.isArray(fieldValue)) {
1397
+ const asset = tag ? fieldValue.find(
1398
+ (x) => x?.tag?.toLowerCase() === tag?.toLowerCase()
1399
+ ) : fieldValue[0];
1400
+ return asset?.assetUrl;
1401
+ }
1402
+ if (typeof fieldValue === "object" && fieldValue !== null) {
1403
+ const assetObject = fieldValue;
1404
+ if (assetObject.assetUrl) {
1405
+ return assetObject.assetUrl;
1406
+ }
1407
+ }
1408
+ return void 0;
1409
+ }
1410
+ var getNestedValue3 = (obj, path) => {
1411
+ if (!obj || !path) {
1412
+ return void 0;
1413
+ }
1414
+ return path.split(".").reduce((current, key) => {
1415
+ return current?.[key];
1416
+ }, obj);
1417
+ };
1418
+ var ImageGalleryNode = (props) => {
1419
+ const resolveImageUrl = (image) => {
1420
+ let imageUrl = image.imageUrl;
1421
+ if (image.datafield && props.dataitem) {
1422
+ const fieldValue = getNestedValue3(props.dataitem, image.datafield);
1423
+ const resolvedAsset = resolveAssetUrl(fieldValue, image.tag);
1424
+ if (resolvedAsset) {
1425
+ imageUrl = resolvedAsset;
1426
+ }
1427
+ }
1428
+ if (!imageUrl) {
1429
+ return "";
1430
+ }
1431
+ if (imageUrl.startsWith("http")) {
1432
+ return imageUrl;
1433
+ }
1434
+ const base = props.assetBaseUrl.replace(/\/$/, "");
1435
+ const path = imageUrl.replace(/^\//, "");
1436
+ return `${base}/${path}`;
1437
+ };
1438
+ const resolvePosterUrl = (posterUrl) => {
1439
+ if (!posterUrl) return void 0;
1440
+ return AssetUtility_default.resolveUrl(props.assetBaseUrl, posterUrl);
1441
+ };
1442
+ const rawImages = Array.isArray(props.node.images) ? props.node.images : [];
1443
+ const hlsImages = rawImages.filter(
1444
+ (img) => resolveImageUrl(img).endsWith(".m3u8")
1445
+ );
1446
+ const staticImages = rawImages.filter(
1447
+ (img) => !resolveImageUrl(img).endsWith(".m3u8")
1448
+ );
1449
+ const hlsSources = [
1450
+ ...DEVICE_ORDER.flatMap((deviceKey) => {
1451
+ const img = hlsImages.find((i) => i.device === deviceKey);
1452
+ if (!img) return [];
1453
+ const src = resolveImageUrl(img);
1454
+ if (!src) return [];
1455
+ const media = deviceToMediaQuery(img.device);
1456
+ const posterUrl = resolvePosterUrl(img.posterUrl);
1457
+ return [
1458
+ {
1459
+ src,
1460
+ ...media ? { media } : {},
1461
+ ...posterUrl ? { posterUrl } : {}
1462
+ }
1463
+ ];
1464
+ }),
1465
+ ...hlsImages.filter((img) => !img.device).map((img) => {
1466
+ const src = resolveImageUrl(img);
1467
+ const posterUrl = resolvePosterUrl(img.posterUrl);
1468
+ return { src, ...posterUrl ? { posterUrl } : {} };
1469
+ }).filter((s) => !!s.src)
1470
+ ];
1471
+ const primaryHls = hlsImages.find((img) => !img.device) ?? hlsImages[0];
1472
+ const hlsIntrinsicWidth = primaryHls ? parseMaybeNumber(primaryHls.intrinsicWidth)?.toString() : void 0;
1473
+ const hlsIntrinsicHeight = primaryHls ? parseMaybeNumber(primaryHls.intrinsicHeight)?.toString() : void 0;
1474
+ const hlsStyles = {};
1475
+ if (primaryHls?.height) hlsStyles.height = primaryHls.height;
1476
+ if (primaryHls?.width) hlsStyles.width = primaryHls.width;
1477
+ if (primaryHls?.borderRadius)
1478
+ hlsStyles.borderRadius = primaryHls.borderRadius;
1479
+ const staticSources = staticImages.filter((img) => !!img.device);
1480
+ const staticFallback = staticImages.find((img) => !img.device) ?? null;
1481
+ const FormatClass = {
1482
+ center: "justify-center",
1483
+ left: "justify-start",
1484
+ right: "justify-end"
1485
+ };
1486
+ const formatClasses = FormatClass[props.node.format || ""] || "";
1487
+ return /* @__PURE__ */ jsxs11(Fragment5, { children: [
1488
+ hlsSources.length > 0 && /* @__PURE__ */ jsx29(Fragment5, { children: /* @__PURE__ */ jsx29(
1489
+ HlsPlayer3,
1490
+ {
1491
+ sources: hlsSources,
1492
+ intrinsicWidth: hlsIntrinsicWidth,
1493
+ intrinsicHeight: hlsIntrinsicHeight,
1494
+ showControls: primaryHls?.showControls ?? false,
1495
+ loop: primaryHls?.loop ?? false,
1496
+ playOptions: primaryHls?.playOptions ?? "",
1497
+ placementCode: primaryHls?.placementCode ?? "",
1498
+ apiBaseUrl: props.apiBaseUrl,
1499
+ session: props.session,
1500
+ styles: hlsStyles
1501
+ }
1502
+ ) }),
1503
+ (staticFallback || staticSources.length > 0) && /* @__PURE__ */ jsx29(Fragment5, { children: staticFallback ? /* @__PURE__ */ jsxs11("picture", { children: [
1504
+ DEVICE_ORDER.map((deviceKey) => {
1505
+ const match = staticSources.find(
1506
+ (img) => img.device === deviceKey
1507
+ );
1508
+ if (!match) {
1509
+ return null;
1510
+ }
1511
+ const srcUrl = resolveImageUrl(match);
1512
+ if (!srcUrl) {
1513
+ return null;
1514
+ }
1515
+ return /* @__PURE__ */ jsx29(
1516
+ "source",
1517
+ {
1518
+ media: deviceToMediaQuery(match.device),
1519
+ srcSet: srcUrl,
1520
+ width: parseMaybeNumber(match.intrinsicWidth),
1521
+ height: parseMaybeNumber(match.intrinsicHeight)
1522
+ },
1523
+ deviceKey
1524
+ );
1525
+ }),
1526
+ (() => {
1527
+ const img = staticFallback;
1528
+ const imageUrl = resolveImageUrl(img);
1529
+ if (!imageUrl) {
1530
+ return null;
1531
+ }
1532
+ const styles = {
1533
+ width: img.width || "auto",
1534
+ height: img.height || "auto"
1535
+ };
1536
+ if (img.borderRadius) {
1537
+ styles.borderRadius = img.borderRadius;
1538
+ }
1539
+ return /* @__PURE__ */ jsx29(
1540
+ "img",
1541
+ {
1542
+ loading: "lazy",
1543
+ style: styles,
1544
+ className: "object-cover max-w-full",
1545
+ src: imageUrl,
1546
+ width: parseMaybeNumber(img.intrinsicWidth),
1547
+ height: parseMaybeNumber(img.intrinsicHeight),
1548
+ alt: img.title ?? "Gallery image"
1549
+ }
1550
+ );
1551
+ })()
1552
+ ] }) : (
1553
+ /* Case 2: Only device-specific images exist */
1554
+ /* @__PURE__ */ jsx29(Fragment5, { children: staticSources.map((img, index) => {
1555
+ const imageUrl = resolveImageUrl(img);
1556
+ if (!imageUrl) {
1557
+ return null;
1558
+ }
1559
+ const styles = {
1560
+ width: img.width || "auto",
1561
+ height: img.height || "auto"
1562
+ };
1563
+ if (img.borderRadius) {
1564
+ styles.borderRadius = img.borderRadius;
1565
+ }
1566
+ let display = "none";
1567
+ switch (img.device) {
1568
+ case "sm":
1569
+ display = props.device === "sm" ? "block" : "none";
1570
+ break;
1571
+ case "md":
1572
+ display = props.device === "md" ? "block" : "none";
1573
+ break;
1574
+ case "lg":
1575
+ display = props.device === "lg" ? "block" : "none";
1576
+ break;
1577
+ default:
1578
+ display = "block";
1579
+ }
1580
+ return /* @__PURE__ */ jsx29(
1581
+ "img",
1582
+ {
1583
+ loading: "lazy",
1584
+ src: imageUrl,
1585
+ style: {
1586
+ ...styles,
1587
+ display
1588
+ },
1589
+ className: "object-cover max-w-full",
1590
+ width: parseMaybeNumber(img.intrinsicWidth),
1591
+ height: parseMaybeNumber(img.intrinsicHeight),
1592
+ alt: img.title ?? "Gallery image"
1593
+ },
1594
+ index
1595
+ );
1596
+ }) })
1597
+ ) })
1598
+ ] });
1599
+ };
1600
+ var ImageGalleryNode_default = ImageGalleryNode;
1601
+
1602
+ // src/components/pageRenderingEngine/nodes/DivContainer.tsx
1603
+ import Link from "next/link";
1604
+
1605
+ // src/utilities/RoleUtility.tsx
1606
+ var decodeJWT = (token) => {
1607
+ if (!token) return null;
1608
+ try {
1609
+ const cleanToken = token.replace(/^Bearer\s+/i, "");
1610
+ const parts = cleanToken.split(".");
1611
+ if (parts.length !== 3) {
1612
+ console.warn("Invalid JWT token format");
1613
+ return null;
1614
+ }
1615
+ const payload = parts[1];
1616
+ const decoded = JSON.parse(atob(payload));
1617
+ return decoded;
1618
+ } catch (error) {
1619
+ console.warn("Failed to decode JWT token:", error);
1620
+ return null;
1621
+ }
1622
+ };
1623
+ var extractRolesFromToken = (decodedPayload) => {
1624
+ if (!decodedPayload) return [];
1625
+ const roles = [];
1626
+ if (decodedPayload.role && typeof decodedPayload.role === "string") {
1627
+ roles.push(decodedPayload.role);
1628
+ }
1629
+ if (decodedPayload.rolecode && typeof decodedPayload.rolecode === "string") {
1630
+ roles.push(decodedPayload.rolecode);
1631
+ }
1632
+ if (decodedPayload.roles && Array.isArray(decodedPayload.roles)) {
1633
+ roles.push(...decodedPayload.roles);
1634
+ }
1635
+ if (decodedPayload.realm_access?.roles && Array.isArray(decodedPayload.realm_access.roles)) {
1636
+ roles.push(...decodedPayload.realm_access.roles);
1637
+ }
1638
+ if (decodedPayload.resource_access && typeof decodedPayload.resource_access === "object") {
1639
+ Object.values(decodedPayload.resource_access).forEach((resource) => {
1640
+ if (resource?.roles && Array.isArray(resource.roles)) {
1641
+ roles.push(...resource.roles);
1642
+ }
1643
+ });
1644
+ }
1645
+ return [...new Set(roles)];
1646
+ };
1647
+ var getUserRoles = (oAuthToken) => {
1648
+ const decodedPayload = decodeJWT(oAuthToken);
1649
+ return extractRolesFromToken(decodedPayload);
1650
+ };
1651
+ var hasRole = (userRoles, requiredRole) => {
1652
+ if (!requiredRole || !userRoles) return false;
1653
+ return userRoles.some(
1654
+ (role) => role.toLowerCase() === requiredRole.toLowerCase()
1655
+ );
1656
+ };
1657
+ var shouldRenderByRole = (roleCode, userRoles) => {
1658
+ if (!roleCode || roleCode.trim() === "") {
1659
+ return true;
1660
+ }
1661
+ const trimmedRoleCode = roleCode.trim();
1662
+ if (trimmedRoleCode.startsWith("!")) {
1663
+ const requiredRole = trimmedRoleCode.substring(1);
1664
+ return !hasRole(userRoles, requiredRole);
1665
+ }
1666
+ return hasRole(userRoles, trimmedRoleCode);
1667
+ };
1668
+ var validateRoleVisibility = (roleCode, oAuthToken) => {
1669
+ const userRoles = getUserRoles(oAuthToken);
1670
+ return shouldRenderByRole(roleCode, userRoles);
1671
+ };
1672
+
1673
+ // src/utilities/VisibilityUtility.tsx
1674
+ var getNestedValue4 = (obj, path) => {
1675
+ if (!obj || !path) return void 0;
1676
+ return path.split(".").reduce((current, key) => {
1677
+ return current && current[key] !== void 0 ? current[key] : void 0;
1678
+ }, obj);
1679
+ };
1680
+ var shouldRenderByFieldVisibility = (fieldVisibleOnTrue, dataItem) => {
1681
+ if (!fieldVisibleOnTrue) {
1682
+ return true;
1683
+ }
1684
+ const condition = fieldVisibleOnTrue.trim();
1685
+ const isNegated = condition.startsWith("!");
1686
+ const fieldName = isNegated ? condition.substring(1).trim() : condition;
1687
+ const fieldValue = getNestedValue4(dataItem, fieldName);
1688
+ if (fieldValue == null || fieldValue === 0) {
1689
+ return false;
1690
+ }
1691
+ return isNegated ? fieldValue !== true : fieldValue !== false;
1692
+ };
1693
+ var shouldRenderByRole2 = (roleCode, oAuthToken) => {
1694
+ if (!roleCode || roleCode.trim() === "") {
1695
+ return true;
1696
+ }
1697
+ return validateRoleVisibility(roleCode, oAuthToken ?? void 0);
1698
+ };
1699
+ var shouldRenderByVisibility = (visibility, session) => {
1700
+ const normalizedVisibility = visibility?.trim().toLowerCase();
1701
+ const hasAuthToken = Boolean(session?.oAuthToken?.trim());
1702
+ switch (normalizedVisibility) {
1703
+ case "authorized":
1704
+ return hasAuthToken;
1705
+ case "anonymous":
1706
+ return !hasAuthToken;
1707
+ case "all":
1708
+ case "":
1709
+ case null:
1710
+ case void 0:
1711
+ default:
1712
+ return true;
1713
+ }
1714
+ };
1715
+ var shouldRenderContainer = (node, dataItem, session) => {
1716
+ return shouldRenderByVisibility(node.visibility, session) && shouldRenderByRole2(node.roleCode, session?.oAuthToken) && shouldRenderByFieldVisibility(node.fieldVisibleOnTrue, dataItem);
1717
+ };
1718
+
1719
+ // src/components/pageRenderingEngine/nodes/DocumentNode.tsx
1720
+ import { Fragment as Fragment6, jsx as jsx30, jsxs as jsxs12 } from "react/jsx-runtime";
1721
+ var getNestedValue5 = (obj, path) => {
1722
+ if (!obj || !path) return void 0;
1723
+ return path.split(".").reduce((current, key) => {
1724
+ return current && current[key] !== void 0 ? current[key] : void 0;
1725
+ }, obj);
1726
+ };
1727
+ var PdfIcon = () => /* @__PURE__ */ jsxs12(
1728
+ "svg",
1729
+ {
1730
+ xmlns: "http://www.w3.org/2000/svg",
1731
+ viewBox: "0 0 48 48",
1732
+ className: "w-10 h-10",
1733
+ children: [
1734
+ /* @__PURE__ */ jsx30(
1735
+ "path",
1736
+ {
1737
+ fill: "#e53935",
1738
+ d: "M38,42H10c-2.209,0-4-1.791-4-4V10c0-2.209,1.791-4,4-4h28c2.209,0,4,1.791,4,4v28 C42,40.209,40.209,42,38,42z"
1739
+ }
1740
+ ),
1741
+ /* @__PURE__ */ jsx30(
1742
+ "path",
1743
+ {
1744
+ fill: "#fff",
1745
+ d: "M34.841,26.799c-1.692-1.757-6.314-1.041-7.42-0.911c-1.627-1.562-2.734-3.45-3.124-4.101 c0.586-1.757,0.976-3.515,1.041-5.402c0-1.627-0.651-3.385-2.473-3.385c-0.651,0-1.237,0.391-1.562,0.911 c-0.781,1.367-0.456,4.101,0.781,6.899c-0.716,2.018-1.367,3.97-3.189,7.42c-1.888,0.781-5.858,2.604-6.183,4.556 c-0.13,0.586,0.065,1.172,0.521,1.627C13.688,34.805,14.273,35,14.859,35c2.408,0,4.751-3.32,6.379-6.118 c1.367-0.456,3.515-1.107,5.663-1.497c2.538,2.213,4.751,2.538,5.923,2.538c1.562,0,2.148-0.651,2.343-1.237 C35.492,28.036,35.297,27.32,34.841,26.799z M33.214,27.905c-0.065,0.456-0.651,0.911-1.692,0.651 c-1.237-0.325-2.343-0.911-3.32-1.692c0.846-0.13,2.734-0.325,4.101-0.065C32.824,26.929,33.344,27.254,33.214,27.905z M22.344,14.497c0.13-0.195,0.325-0.325,0.521-0.325c0.586,0,0.716,0.716,0.716,1.302c-0.065,1.367-0.325,2.734-0.781,4.036 C21.824,16.905,22.019,15.083,22.344,14.497z M22.214,27.124c0.521-1.041,1.237-2.864,1.497-3.645 c0.586,0.976,1.562,2.148,2.083,2.669C25.794,26.213,23.776,26.604,22.214,27.124z M18.374,29.728 c-1.497,2.473-3.059,4.036-3.905,4.036c-0.13,0-0.26-0.065-0.391-0.13c-0.195-0.13-0.26-0.325-0.195-0.586 C14.078,32.136,15.77,30.899,18.374,29.728z"
1746
+ }
1747
+ )
1748
+ ]
1749
+ }
1750
+ );
1751
+ var ExcelIcon = () => /* @__PURE__ */ jsxs12(
1752
+ "svg",
1753
+ {
1754
+ xmlns: "http://www.w3.org/2000/svg",
1755
+ viewBox: "0 0 48 48",
1756
+ className: "w-10 h-10",
1757
+ children: [
1758
+ /* @__PURE__ */ jsx30(
1759
+ "path",
1760
+ {
1761
+ fill: "#169154",
1762
+ d: "M29,6H15.744C14.781,6,14,6.781,14,7.744v7.259h15V6z"
1763
+ }
1764
+ ),
1765
+ /* @__PURE__ */ jsx30(
1766
+ "path",
1767
+ {
1768
+ fill: "#18482a",
1769
+ d: "M14,33.054v7.202C14,41.219,14.781,42,15.743,42H29v-8.946H14z"
1770
+ }
1771
+ ),
1772
+ /* @__PURE__ */ jsx30("path", { fill: "#0c8045", d: "M14 15.003H29V24.005000000000003H14z" }),
1773
+ /* @__PURE__ */ jsx30("path", { fill: "#17472a", d: "M14 24.005H29V33.055H14z" }),
1774
+ /* @__PURE__ */ jsxs12("g", { children: [
1775
+ /* @__PURE__ */ jsx30(
1776
+ "path",
1777
+ {
1778
+ fill: "#29c27f",
1779
+ d: "M42.256,6H29v9.003h15V7.744C44,6.781,43.219,6,42.256,6z"
1780
+ }
1781
+ ),
1782
+ /* @__PURE__ */ jsx30(
1783
+ "path",
1784
+ {
1785
+ fill: "#27663f",
1786
+ d: "M29,33.054V42h13.257C43.219,42,44,41.219,44,40.257v-7.202H29z"
1787
+ }
1788
+ ),
1789
+ /* @__PURE__ */ jsx30("path", { fill: "#19ac65", d: "M29 15.003H44V24.005000000000003H29z" }),
1790
+ /* @__PURE__ */ jsx30("path", { fill: "#129652", d: "M29 24.005H44V33.055H29z" })
1791
+ ] }),
1792
+ /* @__PURE__ */ jsx30(
1793
+ "path",
1794
+ {
1795
+ fill: "#0c7238",
1796
+ d: "M22.319,34H5.681C4.753,34,4,33.247,4,32.319V15.681C4,14.753,4.753,14,5.681,14h16.638 C23.247,14,24,14.753,24,15.681v16.638C24,33.247,23.247,34,22.319,34z"
1797
+ }
1798
+ ),
1799
+ /* @__PURE__ */ jsx30(
1800
+ "path",
1801
+ {
1802
+ fill: "#fff",
1803
+ d: "M9.807 19L12.193 19 14.129 22.754 16.175 19 18.404 19 15.333 24 18.474 29 16.123 29 14.013 25.07 11.912 29 9.526 29 12.719 23.982z"
1804
+ }
1805
+ )
1806
+ ]
1807
+ }
1808
+ );
1809
+ var WordIcon = () => /* @__PURE__ */ jsxs12(
1810
+ "svg",
1811
+ {
1812
+ xmlns: "http://www.w3.org/2000/svg",
1813
+ viewBox: "0 0 48 48",
1814
+ className: "w-10 h-10",
1815
+ baseProfile: "basic",
1816
+ children: [
1817
+ /* @__PURE__ */ jsx30(
1818
+ "path",
1819
+ {
1820
+ fill: "#283593",
1821
+ d: "M9,33.595l14.911-18.706L41,26v13.306C41,41.346,39.346,43,37.306,43H15.332 C11.835,43,9,40.164,9,36.667C9,36.667,9,33.595,9,33.595z"
1822
+ }
1823
+ ),
1824
+ /* @__PURE__ */ jsxs12(
1825
+ "linearGradient",
1826
+ {
1827
+ id: "qh2LT5tehRDFkLLfb-odWa",
1828
+ x1: "9",
1829
+ x2: "33.506",
1830
+ y1: "364.445",
1831
+ y2: "364.445",
1832
+ gradientTransform: "translate(0 -339.89)",
1833
+ gradientUnits: "userSpaceOnUse",
1834
+ children: [
1835
+ /* @__PURE__ */ jsx30("stop", { offset: "0", "stop-color": "#66c0ff" }),
1836
+ /* @__PURE__ */ jsx30("stop", { offset: ".26", "stop-color": "#0094f0" })
1837
+ ]
1838
+ }
1839
+ ),
1840
+ /* @__PURE__ */ jsx30(
1841
+ "path",
1842
+ {
1843
+ fill: "url(#qh2LT5tehRDFkLLfb-odWa)",
1844
+ d: "M9,20.208c0-2.624,2.126-4.75,4.749-4.75h21.857L41,12.778v13.527 C41,28.346,39.346,30,37.306,30H15.332C11.835,30,9,32.836,9,36.333L9,20.208L9,20.208z"
1845
+ }
1846
+ ),
1847
+ /* @__PURE__ */ jsx30(
1848
+ "path",
1849
+ {
1850
+ fill: "#1e88e5",
1851
+ "fill-opacity": ".6",
1852
+ d: "M9,20.208c0-2.624,2.126-4.75,4.749-4.75h21.857L41,12.778v13.527 C41,28.346,39.346,30,37.306,30H15.332C11.835,30,9,32.836,9,36.333L9,20.208L9,20.208z"
1853
+ }
1854
+ ),
1855
+ /* @__PURE__ */ jsx30(
1856
+ "path",
1857
+ {
1858
+ fill: "#00e5ff",
1859
+ d: "M9,10.333C9,6.836,11.835,4,15.332,4h21.975C39.346,4,41,5.654,41,7.694v5.611 C41,15.346,39.346,17,37.306,17H15.332C11.835,17,9,19.836,9,23.333C9,23.333,9,10.333,9,10.333z"
1860
+ }
1861
+ ),
1862
+ /* @__PURE__ */ jsx30(
1863
+ "path",
1864
+ {
1865
+ fill: "#1565c0",
1866
+ d: "M7.5,23h10c1.933,0,3.5,1.567,3.5,3.5v10c0,1.933-1.567,3.5-3.5,3.5h-10C5.567,40,4,38.433,4,36.5 v-10C4,24.567,5.567,23,7.5,23z"
1867
+ }
1868
+ ),
1869
+ /* @__PURE__ */ jsx30(
1870
+ "path",
1871
+ {
1872
+ fill: "#fff",
1873
+ d: "M18.327,26.643l-2.092,9.713l-2.501,0.002L12.5,30.529l-1.293,5.829H8.683l-2.01-9.713h2.062 l1.24,6.41l1.232-6.41h2.528l1.291,6.41l1.21-6.41L18.327,26.643L18.327,26.643z"
1874
+ }
1875
+ )
1876
+ ]
1877
+ }
1878
+ );
1879
+ var StandardIcon = () => /* @__PURE__ */ jsxs12(
1880
+ "svg",
1881
+ {
1882
+ xmlns: "http://www.w3.org/2000/svg",
1883
+ viewBox: "0 0 48 48",
1884
+ className: "w-10 h-10",
1885
+ children: [
1886
+ /* @__PURE__ */ jsx30("path", { fill: "#90CAF9", d: "M40 45L8 45 8 3 30 3 40 13z" }),
1887
+ /* @__PURE__ */ jsx30("path", { fill: "#E1F5FE", d: "M38.5 14L29 14 29 4.5z" })
1888
+ ]
1889
+ }
1890
+ );
1891
+ var PowerPointIcon = () => /* @__PURE__ */ jsxs12(
1892
+ "svg",
1893
+ {
1894
+ xmlns: "http://www.w3.org/2000/svg",
1895
+ viewBox: "0 0 48 48",
1896
+ className: "w-10 h-10",
1897
+ children: [
1898
+ /* @__PURE__ */ jsx30(
1899
+ "path",
1900
+ {
1901
+ fill: "#dc4c2c",
1902
+ d: "M8,24c0,9.941,8.059,18,18,18s18-8.059,18-18H26H8z"
1903
+ }
1904
+ ),
1905
+ /* @__PURE__ */ jsx30("path", { fill: "#f7a278", d: "M26,6v18h18C44,14.059,35.941,6,26,6z" }),
1906
+ /* @__PURE__ */ jsx30("path", { fill: "#c06346", d: "M26,6C16.059,6,8,14.059,8,24h18V6z" }),
1907
+ /* @__PURE__ */ jsx30(
1908
+ "path",
1909
+ {
1910
+ fill: "#9b341f",
1911
+ d: "M22.319,34H5.681C4.753,34,4,33.247,4,32.319V15.681C4,14.753,4.753,14,5.681,14h16.638 C23.247,14,24,14.753,24,15.681v16.638C24,33.247,23.247,34,22.319,34z"
1912
+ }
1913
+ ),
1914
+ /* @__PURE__ */ jsx30(
1915
+ "path",
1916
+ {
1917
+ fill: "#fff",
1918
+ d: "M14.673,19.012H10v10h2.024v-3.521H14.3c1.876,0,3.397-1.521,3.397-3.397v-0.058 C17.697,20.366,16.343,19.012,14.673,19.012z M15.57,22.358c0,0.859-0.697,1.556-1.556,1.556h-1.99v-3.325h1.99 c0.859,0,1.556,0.697,1.556,1.556V22.358z"
1919
+ }
1920
+ )
1921
+ ]
1922
+ }
1923
+ );
1924
+ var TextIcon = () => /* @__PURE__ */ jsxs12(
1925
+ "svg",
1926
+ {
1927
+ xmlns: "http://www.w3.org/2000/svg",
1928
+ viewBox: "0 0 48 48",
1929
+ className: "w-10 h-10",
1930
+ children: [
1931
+ /* @__PURE__ */ jsx30("path", { fill: "#90CAF9", d: "M40 45L8 45 8 3 30 3 40 13z" }),
1932
+ /* @__PURE__ */ jsx30("path", { fill: "#E1F5FE", d: "M38.5 14L29 14 29 4.5z" }),
1933
+ /* @__PURE__ */ jsx30(
1934
+ "path",
1935
+ {
1936
+ fill: "#1976D2",
1937
+ d: "M16 21H33V23H16zM16 25H29V27H16zM16 29H33V31H16zM16 33H29V35H16z"
1938
+ }
1939
+ )
1940
+ ]
1941
+ }
1942
+ );
1943
+ var ArchiveIcon = () => /* @__PURE__ */ jsxs12(
1944
+ "svg",
1945
+ {
1946
+ xmlns: "http://www.w3.org/2000/svg",
1947
+ zoomAndPan: "magnify",
1948
+ viewBox: "0 0 75 74.999997",
1949
+ preserveAspectRatio: "xMidYMid meet",
1950
+ version: "1.0",
1951
+ className: "w-10 h-10",
1952
+ children: [
1953
+ /* @__PURE__ */ jsx30("defs", { children: /* @__PURE__ */ jsx30("clipPath", { id: "273d29c8a6", children: /* @__PURE__ */ jsx30(
1954
+ "path",
1955
+ {
1956
+ d: "M 8.90625 0 L 65.90625 0 L 65.90625 75 L 8.90625 75 Z M 8.90625 0 ",
1957
+ "clip-rule": "nonzero"
1958
+ }
1959
+ ) }) }),
1960
+ /* @__PURE__ */ jsx30("g", { "clip-path": "url(#273d29c8a6)", children: /* @__PURE__ */ jsx30(
1961
+ "path",
1962
+ {
1963
+ fill: "#ff9100",
1964
+ d: "M 65.882812 75 L 8.929688 75 L 8.929688 0 L 48.085938 0 L 65.882812 17.855469 Z M 65.882812 75 ",
1965
+ "fill-opacity": "1",
1966
+ "fill-rule": "nonzero"
1967
+ }
1968
+ ) }),
1969
+ /* @__PURE__ */ jsx30(
1970
+ "path",
1971
+ {
1972
+ fill: "#fbe9e7",
1973
+ d: "M 63.214844 19.644531 L 46.304688 19.644531 L 46.304688 2.679688 Z M 63.214844 19.644531 ",
1974
+ "fill-opacity": "1",
1975
+ "fill-rule": "nonzero"
1976
+ }
1977
+ ),
1978
+ /* @__PURE__ */ jsx30(
1979
+ "path",
1980
+ {
1981
+ fill: "#ffe0b2",
1982
+ d: "M 26.523438 50.59375 L 33.824219 50.59375 L 33.824219 53.570312 L 22.339844 53.570312 L 22.339844 51.410156 L 29.566406 38.789062 L 22.265625 38.789062 L 22.265625 35.796875 L 33.691406 35.796875 L 33.691406 37.910156 Z M 26.523438 50.59375 ",
1983
+ "fill-opacity": "1",
1984
+ "fill-rule": "nonzero"
1985
+ }
1986
+ ),
1987
+ /* @__PURE__ */ jsx30(
1988
+ "path",
1989
+ {
1990
+ fill: "#ffe0b2",
1991
+ d: "M 36.183594 35.796875 L 39.757812 35.796875 L 39.757812 53.570312 L 36.183594 53.570312 Z M 36.183594 35.796875 ",
1992
+ "fill-opacity": "1",
1993
+ "fill-rule": "nonzero"
1994
+ }
1995
+ ),
1996
+ /* @__PURE__ */ jsx30(
1997
+ "path",
1998
+ {
1999
+ fill: "#ffe0b2",
2000
+ d: "M 46.34375 47.320312 L 46.34375 53.570312 L 42.765625 53.570312 L 42.765625 35.796875 L 48.800781 35.796875 C 50.550781 35.796875 51.953125 36.34375 52.992188 37.433594 C 54.035156 38.523438 54.554688 39.9375 54.554688 41.683594 C 54.554688 43.425781 54.039062 44.796875 53.011719 45.808594 C 51.980469 46.820312 50.550781 47.320312 48.726562 47.320312 Z M 46.34375 44.332031 L 48.800781 44.332031 C 49.484375 44.332031 50.007812 44.105469 50.382812 43.660156 C 50.757812 43.210938 50.941406 42.5625 50.941406 41.707031 C 50.941406 40.816406 50.753906 40.113281 50.371094 39.585938 C 49.988281 39.0625 49.476562 38.796875 48.839844 38.789062 L 46.34375 38.789062 Z M 46.34375 44.332031 ",
2001
+ "fill-opacity": "1",
2002
+ "fill-rule": "nonzero"
2003
+ }
2004
+ )
2005
+ ]
2006
+ }
2007
+ );
2008
+ var getFileDetails = (url) => {
2009
+ const extMatch = url.match(/\.([a-zA-Z0-9]+)(?:[\?#]|$)/);
2010
+ const ext = extMatch ? extMatch[1].toLowerCase() : "";
2011
+ let Icon = StandardIcon;
2012
+ let extLabel = "FILE";
2013
+ if (ext === "pdf") {
2014
+ Icon = PdfIcon;
2015
+ extLabel = "PDF";
2016
+ } else if (["xls", "xlsx", "csv"].includes(ext)) {
2017
+ Icon = ExcelIcon;
2018
+ extLabel = "Excel";
2019
+ } else if (["doc", "docx"].includes(ext)) {
2020
+ Icon = WordIcon;
2021
+ extLabel = "Word";
2022
+ } else if (["ppt", "pptx"].includes(ext)) {
2023
+ Icon = PowerPointIcon;
2024
+ extLabel = "PowerPoint";
2025
+ } else if (["txt", "rtf"].includes(ext)) {
2026
+ Icon = TextIcon;
2027
+ extLabel = "Text";
2028
+ } else if (["zip", "rar", "7z"].includes(ext)) {
2029
+ Icon = ArchiveIcon;
2030
+ extLabel = "Archive";
2031
+ } else if (ext) {
2032
+ extLabel = ext.toUpperCase();
2033
+ }
2034
+ return { Icon, extLabel };
2035
+ };
2036
+ var DocumentNode = (props) => {
2037
+ console.log("DocumentNode rendered");
2038
+ console.log("props", props);
2039
+ console.log("dataitem", props.dataitem);
2040
+ console.log("node", props.node);
2041
+ let documents = [];
2042
+ if (props.dataitem && props.node.documentKey) {
2043
+ const docData = getNestedValue5(props.dataitem, props.node.documentKey);
2044
+ if (typeof docData === "string") {
2045
+ const trimmed = docData.trim();
2046
+ if (trimmed.startsWith("[") || trimmed.startsWith("{")) {
2047
+ try {
2048
+ const parsed = JSON.parse(trimmed);
2049
+ if (Array.isArray(parsed)) {
2050
+ documents = parsed.filter(
2051
+ (item) => item && item.assetUrl
2052
+ );
2053
+ } else if (parsed?.assetUrl) {
2054
+ documents = [parsed];
2055
+ }
2056
+ } catch {
2057
+ }
2058
+ } else {
2059
+ documents = [
2060
+ {
2061
+ assetUrl: docData
2062
+ }
2063
+ ];
2064
+ }
2065
+ } else if (Array.isArray(docData)) {
2066
+ documents = docData.filter((item) => item && item.assetUrl);
2067
+ } else if (docData && typeof docData === "object" && docData.assetUrl) {
2068
+ documents = [docData];
2069
+ }
2070
+ }
2071
+ if (documents.length === 0) {
2072
+ return /* @__PURE__ */ jsx30(Fragment6, { children: /* @__PURE__ */ jsxs12("div", { className: "py-4 px-2 bg-neutral-weak border rounded text-center flex flex-col gap-2", children: [
2073
+ /* @__PURE__ */ jsx30("div", { className: "mx-auto w-10 h-10 rounded-full flex items-center justify-center bg-neutral-soft", children: /* @__PURE__ */ jsx30(
2074
+ "svg",
2075
+ {
2076
+ className: "w-5 h-5",
2077
+ fill: "none",
2078
+ stroke: "currentColor",
2079
+ viewBox: "0 0 24 24",
2080
+ xmlns: "http://www.w3.org/2000/svg",
2081
+ children: /* @__PURE__ */ jsx30(
2082
+ "path",
2083
+ {
2084
+ strokeLinecap: "round",
2085
+ strokeLinejoin: "round",
2086
+ strokeWidth: "1.5",
2087
+ d: "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"
2088
+ }
2089
+ )
2090
+ }
2091
+ ) }),
2092
+ /* @__PURE__ */ jsx30("div", { className: "text-sm font-medium", children: "No documents found" }),
2093
+ /* @__PURE__ */ jsx30("div", { className: "text-xs", children: "No records found. Data may be empty or not available at the moment." })
2094
+ ] }) });
2095
+ }
2096
+ return /* @__PURE__ */ jsx30("div", { className: "", children: documents.map((doc, index) => {
2097
+ const documentUrl = AssetUtility_default.resolveUrl(
2098
+ props.assetBaseUrl,
2099
+ doc.assetUrl
2100
+ );
2101
+ let documentTitle = doc.title;
2102
+ if (!documentUrl) {
2103
+ return null;
2104
+ }
2105
+ if (!documentTitle) {
2106
+ try {
2107
+ const pathName = new URL(documentUrl).pathname;
2108
+ documentTitle = pathName.split("/").pop()?.replace(/\.[^/.]+$/, "") || "Document";
2109
+ } catch {
2110
+ documentTitle = documentUrl.split("/").pop()?.replace(/\.[^/.]+$/, "") || "Document";
2111
+ }
2112
+ }
2113
+ const { Icon, extLabel } = getFileDetails(documentUrl);
2114
+ return /* @__PURE__ */ jsxs12(
2115
+ "div",
2116
+ {
2117
+ className: `flex items-center justify-between py-4 bg-default gap-4 ${index !== 0 ? "border-t" : ""}`,
2118
+ children: [
2119
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center space-x-4", children: [
2120
+ /* @__PURE__ */ jsx30("div", { className: "flex items-center justify-center p-2 rounded bg-neutral-soft", children: /* @__PURE__ */ jsx30(Icon, {}) }),
2121
+ /* @__PURE__ */ jsx30("div", { className: "flex items-baseline space-x-2", children: /* @__PURE__ */ jsx30("h4", { className: "text-base font-semibold", children: documentTitle }) })
2122
+ ] }),
2123
+ /* @__PURE__ */ jsxs12(
2124
+ "a",
2125
+ {
2126
+ href: documentUrl,
2127
+ target: "_blank",
2128
+ rel: "noopener noreferrer",
2129
+ className: "inline-flex items-center px-4 py-2 text-sm font-medium bg-default border rounded focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors",
2130
+ children: [
2131
+ /* @__PURE__ */ jsxs12(
2132
+ "svg",
2133
+ {
2134
+ className: "w-4 h-4 mr-2",
2135
+ fill: "none",
2136
+ stroke: "currentColor",
2137
+ viewBox: "0 0 24 24",
2138
+ children: [
2139
+ /* @__PURE__ */ jsx30(
2140
+ "path",
2141
+ {
2142
+ strokeLinecap: "round",
2143
+ strokeLinejoin: "round",
2144
+ strokeWidth: "2",
2145
+ d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
2146
+ }
2147
+ ),
2148
+ /* @__PURE__ */ jsx30(
2149
+ "path",
2150
+ {
2151
+ strokeLinecap: "round",
2152
+ strokeLinejoin: "round",
2153
+ strokeWidth: "2",
2154
+ d: "M12 12v5m0 0l-3-3m3 3l3-3M12 8v4"
2155
+ }
2156
+ )
2157
+ ]
2158
+ }
2159
+ ),
2160
+ "Download"
2161
+ ]
2162
+ }
2163
+ )
2164
+ ]
2165
+ },
2166
+ `${documentUrl}-${index}`
2167
+ );
2168
+ }) });
2169
+ };
2170
+ var DocumentNode_default = DocumentNode;
2171
+
2172
+ // src/components/pageRenderingEngine/nodes/DivContainer.tsx
2173
+ import { jsx as jsx31, jsxs as jsxs13 } from "react/jsx-runtime";
2174
+ var Pagination = dynamic9(() => import("./Pagination-6OFACRMQ.mjs"), { ssr: true });
2175
+ var Slider = dynamic9(() => import("./Slider-PEIVH6A5.mjs"), {
2176
+ ssr: false
2177
+ });
2178
+ function toCamelCase(str) {
2179
+ return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
2180
+ }
2181
+ function convertKeysToCamelCase(obj) {
2182
+ if (!obj || typeof obj !== "object") return obj;
2183
+ if (Array.isArray(obj)) return obj.map(convertKeysToCamelCase);
2184
+ return Object.fromEntries(
2185
+ Object.entries(obj).filter(([_, value]) => value !== "" && value !== void 0).map(([key, value]) => [toCamelCase(key), convertKeysToCamelCase(value)])
2186
+ );
2187
+ }
2188
+ var getNestedValue6 = (obj, path) => {
2189
+ if (!obj || !path) return void 0;
2190
+ return path.split(".").reduce((current, key) => {
2191
+ {
2192
+ }
2193
+ return current && current[key] !== void 0 ? current[key] : void 0;
2194
+ }, obj);
2195
+ };
2196
+ function resolveAssetUrl2(fieldValue, tag) {
2197
+ if (!fieldValue) {
2198
+ return void 0;
2199
+ }
2200
+ if (typeof fieldValue === "string") {
2201
+ const trimmed = fieldValue.trim();
2202
+ if (trimmed.startsWith("itemassets/") || trimmed.startsWith("/itemassets/") || trimmed.startsWith("http")) {
2203
+ return trimmed;
2204
+ }
2205
+ try {
2206
+ const parsed = JSON.parse(trimmed);
2207
+ return resolveAssetUrl2(parsed, tag);
2208
+ } catch {
2209
+ return void 0;
2210
+ }
2211
+ }
2212
+ if (Array.isArray(fieldValue)) {
2213
+ const asset = tag ? fieldValue.find(
2214
+ (x) => x?.tag?.toLowerCase() === tag?.toLowerCase()
2215
+ ) : fieldValue[0];
2216
+ return asset?.assetUrl;
2217
+ }
2218
+ if (typeof fieldValue === "object" && fieldValue !== null) {
2219
+ const assetObject = fieldValue;
2220
+ if (assetObject.assetUrl) {
2221
+ return assetObject.assetUrl;
2222
+ }
2223
+ }
2224
+ return void 0;
2225
+ }
2226
+ function generateCompleteBackgroundString(layers, apiBaseUrl, dataItem) {
2227
+ if (!layers || !Array.isArray(layers)) return "";
2228
+ return layers.filter((layer) => layer && layer.type && layer.value).map((layer) => {
2229
+ if (layer.type === "image" && typeof layer.value === "object") {
2230
+ const imageValue = layer.value;
2231
+ let assetUrl = imageValue.assetUrl || "";
2232
+ if (layer.datafield && dataItem) {
2233
+ const fieldValue = getNestedValue6(dataItem, layer.datafield);
2234
+ const resolvedAssetUrl = resolveAssetUrl2(fieldValue, layer.tag);
2235
+ if (resolvedAssetUrl) {
2236
+ assetUrl = resolvedAssetUrl;
2237
+ }
2238
+ }
2239
+ if (!assetUrl) {
2240
+ return "";
2241
+ }
2242
+ const url = `url('${AssetUtility_default.resolveUrl(apiBaseUrl, assetUrl)}')`;
2243
+ const repeat = layer.repeat || "no-repeat";
2244
+ const position = layer.position || "center";
2245
+ const size = layer.size || "auto";
2246
+ const attachment = layer.attachment || "scroll";
2247
+ return `${url} ${position} / ${size} ${repeat} ${attachment}`;
2248
+ }
2249
+ if (layer.type === "gradient" && typeof layer.value === "object") {
2250
+ const gradient = layer.value;
2251
+ if (!gradient.colors || !gradient.direction) {
2252
+ return "";
2253
+ }
2254
+ const colors = gradient.colors.map(
2255
+ (colorStop) => `color-mix(in srgb, ${colorStop.color}, transparent ${colorStop.transparency ?? 0}%) ${colorStop.start || "0%"}`
2256
+ ).join(", ");
2257
+ return `linear-gradient(${gradient.direction}, ${colors})`;
2258
+ }
2259
+ return "";
2260
+ }).filter((bg) => bg.trim() !== "").join(", ");
2261
+ }
2262
+ var generateCssString = (guid, stylesObject, tabletStylesObject, mobileStylesObject) => {
2263
+ const gridColumns = stylesObject?.gridTemplateColumns ? String(stylesObject.gridTemplateColumns).match(/\d+/g) ?? [] : [];
2264
+ const hasGridProperties = (gridColumns?.length ?? 0) > 0;
2265
+ const largeCols = hasGridProperties ? parseInt(gridColumns[0]) : 4;
2266
+ const tabletColumns = hasGridProperties ? Math.ceil(parseInt(gridColumns[0]) / 2) : 2;
2267
+ const mobileColumns = 1;
2268
+ const cssRules = Object.entries(stylesObject || {}).filter(([_, value]) => value !== void 0 && value !== "").map(([key, value]) => {
2269
+ const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
2270
+ return `${cssKey}: ${value};`;
2271
+ });
2272
+ let css = `#${guid} {
2273
+ ${cssRules.join(
2274
+ "\n"
2275
+ )}
2276
+ transition: all 0.3s ease-in-out; }`;
2277
+ if (tabletStylesObject) {
2278
+ const tabletCssRules = Object.entries(tabletStylesObject).filter(([_, value]) => value !== void 0 && value !== "").map(([key, value]) => {
2279
+ const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
2280
+ return `${cssKey}: ${value};`;
2281
+ });
2282
+ if (tabletCssRules.length > 0) {
2283
+ css += `
2284
+ @media (max-width: 768px) {
2285
+ #${guid} {
2286
+ ${tabletCssRules.join("\n")}
2287
+ }
2288
+ }`;
2289
+ }
2290
+ }
2291
+ if (mobileStylesObject) {
2292
+ const mobileCssRules = Object.entries(mobileStylesObject).filter(([_, value]) => value !== void 0 && value !== "").map(([key, value]) => {
2293
+ const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
2294
+ return `${cssKey}: ${value};`;
2295
+ });
2296
+ if (mobileCssRules.length > 0) {
2297
+ css += `
2298
+ @media (max-width: 480px) {
2299
+ #${guid} {
2300
+ ${mobileCssRules.join("\n")}
2301
+ }
2302
+ }`;
2303
+ }
2304
+ }
2305
+ const updatedTabletStyles = convertKeysToCamelCase(
2306
+ tabletStylesObject
2307
+ );
2308
+ const updatedMobileStyles = convertKeysToCamelCase(
2309
+ mobileStylesObject
2310
+ );
2311
+ if (hasGridProperties) {
2312
+ const tabletHasGrid = tabletStylesObject?.gridTemplateColumns !== void 0 || tabletStylesObject?.["grid-template-columns"] !== void 0;
2313
+ const mobileHasGrid = mobileStylesObject?.gridTemplateColumns !== void 0 || mobileStylesObject?.["grid-template-columns"] !== void 0;
2314
+ if (!tabletHasGrid) {
2315
+ css += `
2316
+ @media (max-width: 768px) {
2317
+ #${guid} {
2318
+ grid-template-columns: repeat(${tabletColumns}, minmax(0, 1fr));
2319
+ }
2320
+ }`;
2321
+ }
2322
+ if (!mobileHasGrid) {
2323
+ css += `
2324
+ @media (max-width: 480px) {
2325
+ #${guid} {
2326
+ grid-template-columns: repeat(${mobileColumns}, minmax(0, 1fr));
2327
+ grid-column: unset;
2328
+ column-gap: unset;
2329
+ }
2330
+ }`;
2331
+ }
2332
+ }
2333
+ return {
2334
+ css,
2335
+ gridColsLarge: largeCols,
2336
+ gridColsMedium: tabletColumns,
2337
+ gridColsSmall: mobileColumns
2338
+ };
2339
+ };
2340
+ var DivContainer = async (props) => {
2341
+ const NodeTypes2 = {
2342
+ paragraph: ParagraphNode_default,
2343
+ heading: HeadingNode_default,
2344
+ list: ListNode_default,
2345
+ quote: QuoteNode_default,
2346
+ code: CodeNode_default,
2347
+ image: ImageNode_default,
2348
+ "image-gallery": ImageGalleryNode_default,
2349
+ horizontalrule: HorizontalRuleNode_default,
2350
+ widget: WidgetNode_default,
2351
+ embed: EmbedNode_default,
2352
+ "div-container": DivContainer,
2353
+ text: TextNode_default,
2354
+ datafield: DatafieldNode_default,
2355
+ "svg-icon": SVGIconNode_default,
2356
+ document: DocumentNode_default
2357
+ };
2358
+ const styles = props.node.cssProperties;
2359
+ const mobileStyles = props.node.mobileCssProperties;
2360
+ const tabletStyles = props.node.tabletCssProperties;
2361
+ const dataBindingProperties = props.node.dataBinding;
2362
+ const updatedStyles = convertKeysToCamelCase(styles);
2363
+ let containerPaddingClass = "";
2364
+ if (props.node.containerPadding == "small") {
2365
+ containerPaddingClass = "container-small";
2366
+ } else if (props.node.containerPadding == "large") {
2367
+ containerPaddingClass = "container-large";
2368
+ }
2369
+ {
2370
+ }
2371
+ const updatedStyle = { ...updatedStyles };
2372
+ const guid = "css" + crypto.randomUUID().toLocaleLowerCase();
2373
+ const { enterAnimation, exitAnimation, hoverAnimation } = props.node;
2374
+ let animationCSS = "";
2375
+ if (enterAnimation?.name) {
2376
+ animationCSS += AnimationUtility_default.generateAnimationCSS(
2377
+ {
2378
+ animation: enterAnimation.name,
2379
+ mode: "enter",
2380
+ ...enterAnimation.properties
2381
+ },
2382
+ `#${guid}`
2383
+ );
2384
+ }
2385
+ if (hoverAnimation?.name) {
2386
+ animationCSS += AnimationUtility_default.generateAnimationCSS(
2387
+ {
2388
+ animation: hoverAnimation.name,
2389
+ mode: "hover",
2390
+ ...hoverAnimation.properties
2391
+ },
2392
+ `#${guid}`
2393
+ );
2394
+ }
2395
+ const isHidden = !shouldRenderContainer(
2396
+ {
2397
+ visibility: props.node.visibility,
2398
+ roleCode: props.node.roleCode,
2399
+ fieldVisibleOnTrue: props.node.fieldVisibleOnTrue
2400
+ },
2401
+ props.dataitem,
2402
+ props.session
2403
+ );
2404
+ let odataString = void 0;
2405
+ let endpoint = void 0;
2406
+ let result = null;
2407
+ let response = null;
2408
+ let childCollectionData = null;
2409
+ if (dataBindingProperties) {
2410
+ const serviceClient = new ServiceClient_default(props.apiBaseUrl, props.session);
2411
+ endpoint = dataBindingProperties.dataSource;
2412
+ {
2413
+ }
2414
+ endpoint = endpoint.replace(/\{(\w+)\}/g, (_, key) => {
2415
+ return props.routeParameters?.[key] ?? `{${key}}`;
2416
+ });
2417
+ if (dataBindingProperties.applyODataParams) {
2418
+ odataString = OdataBuilder.getOdataQueryString(props.query);
2419
+ if (odataString) {
2420
+ const separator = endpoint.includes("?") ? "&" : "?";
2421
+ endpoint += separator + odataString;
2422
+ }
2423
+ }
2424
+ response = await serviceClient.get(endpoint);
2425
+ result = response?.result;
2426
+ if (dataBindingProperties.showNoResultsMessage && (result === void 0 || result.length == 0)) {
2427
+ return /* @__PURE__ */ jsx31(NoDataFound_default, {});
2428
+ }
2429
+ if (dataBindingProperties.childCollectionName && props.dataitem) {
2430
+ childCollectionData = getNestedValue6(
2431
+ props.dataitem,
2432
+ dataBindingProperties.childCollectionName
2433
+ );
2434
+ }
2435
+ }
2436
+ const cssResult = generateCssString(
2437
+ guid,
2438
+ updatedStyle,
2439
+ tabletStyles,
2440
+ mobileStyles
2441
+ );
2442
+ function renderNode(node, props2, dataitem, key, href) {
2443
+ {
2444
+ }
2445
+ const SelectedNode = NodeTypes2[node.type];
2446
+ if (!SelectedNode) return null;
2447
+ return /* @__PURE__ */ jsx31(React19.Fragment, { children: /* @__PURE__ */ jsx31(
2448
+ SelectedNode,
2449
+ {
2450
+ node,
2451
+ parentTag: Wrapper,
2452
+ routeParameters: props2.routeParameters,
2453
+ query: props2.query,
2454
+ session: props2.session,
2455
+ host: props2.host,
2456
+ path: props2.path,
2457
+ apiBaseUrl: props2.apiBaseUrl,
2458
+ breadcrumb: props2.breadcrumb,
2459
+ dataitem,
2460
+ href,
2461
+ assetBaseUrl: props2.assetBaseUrl,
2462
+ device: props2.device,
2463
+ widgetRenderer: props2.widgetRenderer
2464
+ }
2465
+ ) }, key);
2466
+ }
2467
+ function renderChildren(nodes, props2, data, key, href) {
2468
+ if (!nodes) return null;
2469
+ const childNodes = nodes.map((node, index) => {
2470
+ if (
2471
+ // @ts-expect-error custom code
2472
+ node.type === "div-container" && node.dataBinding?.childCollectionName && data
2473
+ ) {
2474
+ return renderNode(node, props2, data, index, href);
2475
+ }
2476
+ return renderNode(node, props2, data, index, href);
2477
+ });
2478
+ return childNodes;
2479
+ }
2480
+ function queryObjectToString(query) {
2481
+ if (!query) return "";
2482
+ return Object.entries(query).map(
2483
+ ([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
2484
+ ).join("&");
2485
+ }
2486
+ function resolveHrefTemplate(template, dataItem) {
2487
+ return template.replace(/\{([^}]+)\}/g, (match, key) => {
2488
+ return dataItem[key] !== void 0 ? dataItem[key] : match;
2489
+ });
2490
+ }
2491
+ const dataToRender = (() => {
2492
+ if (childCollectionData && Array.isArray(childCollectionData)) {
2493
+ return childCollectionData;
2494
+ }
2495
+ if (result && props.node.dataBinding?.responseType === "array") {
2496
+ return result;
2497
+ }
2498
+ if (result && props.node.dataBinding?.responseType === "object") {
2499
+ return [result];
2500
+ }
2501
+ return [props.dataitem];
2502
+ })();
2503
+ const backgroundDataItem = dataToRender.length > 0 ? dataToRender[0] : props.dataitem;
2504
+ const background = generateCompleteBackgroundString(
2505
+ props.node.backgroundLayers,
2506
+ props.assetBaseUrl,
2507
+ backgroundDataItem
2508
+ );
2509
+ const backgroundStyle = background && background !== "" ? { background } : {};
2510
+ const combinedStyles = {
2511
+ ...backgroundStyle
2512
+ };
2513
+ if (props.node.enableBackgroundClipText) {
2514
+ combinedStyles.WebkitBackgroundClip = "text";
2515
+ combinedStyles.backgroundClip = "text";
2516
+ }
2517
+ const renderLink = result && props.node.dataBinding?.responseType === "array" ? true : false;
2518
+ {
2519
+ }
2520
+ let Wrapper;
2521
+ let wrapperProps;
2522
+ let noLinkColor = false;
2523
+ switch (true) {
2524
+ case props.node.componentProperties?.type === "slider":
2525
+ Wrapper = Slider;
2526
+ const largeCols = props.node.componentProperties?.columns || 4;
2527
+ const slidesToShow = {
2528
+ large: largeCols,
2529
+ medium: Math.ceil(largeCols / 2),
2530
+ small: 1
2531
+ };
2532
+ wrapperProps = {
2533
+ ...props.node.componentProperties,
2534
+ slidesToShow
2535
+ };
2536
+ break;
2537
+ case !!(props.node.href || props.href):
2538
+ Wrapper = Link;
2539
+ let href = props.node.href || props.href;
2540
+ if (href?.includes("{")) {
2541
+ href = resolveHrefTemplate(href, props.dataitem);
2542
+ }
2543
+ const currentPath = decodeURIComponent(
2544
+ PathUtility_default.removeTrailingSlash(props.path) + "?" + queryObjectToString(props.query)
2545
+ );
2546
+ const resolvedHref = decodeURIComponent(href || "");
2547
+ const isSelected = currentPath === resolvedHref;
2548
+ noLinkColor = true;
2549
+ wrapperProps = {
2550
+ href,
2551
+ "data-isSelected": isSelected,
2552
+ "data-path": currentPath,
2553
+ "data-href": resolvedHref
2554
+ };
2555
+ break;
2556
+ default: {
2557
+ const replacementTag = props.node.replaceDivTagWith;
2558
+ const allowedTags = ["div", "section", "article", "details", "summary"];
2559
+ if (replacementTag && allowedTags.includes(replacementTag)) {
2560
+ {
2561
+ }
2562
+ Wrapper = replacementTag;
2563
+ } else {
2564
+ Wrapper = "div";
2565
+ }
2566
+ wrapperProps = {};
2567
+ break;
2568
+ }
2569
+ }
2570
+ if (isHidden) {
2571
+ return null;
2572
+ }
2573
+ const classNames = [
2574
+ containerPaddingClass,
2575
+ props.node.autoFormat && "auto-format",
2576
+ props.node.bgClass,
2577
+ noLinkColor && "no-link-color"
2578
+ ].filter(Boolean).join(" ");
2579
+ return /* @__PURE__ */ jsxs13(React19.Fragment, { children: [
2580
+ /* @__PURE__ */ jsx31(
2581
+ "style",
2582
+ {
2583
+ dangerouslySetInnerHTML: { __html: cssResult.css + animationCSS }
2584
+ }
2585
+ ),
2586
+ /* @__PURE__ */ jsx31(React19.Fragment, { children: /* @__PURE__ */ jsx31(
2587
+ Wrapper,
2588
+ {
2589
+ id: guid,
2590
+ style: combinedStyles,
2591
+ className: classNames || void 0,
2592
+ ...wrapperProps,
2593
+ children: dataToRender.map(
2594
+ (item, idx) => item?.links?.view && renderLink ? renderChildren(
2595
+ props.node.children,
2596
+ props,
2597
+ item,
2598
+ idx,
2599
+ props.href ? void 0 : item?.links?.view
2600
+ )?.map((child, i) => /* @__PURE__ */ jsx31(React19.Fragment, { children: child }, i)) : renderChildren(props.node.children, props, item, idx)
2601
+ )
2602
+ }
2603
+ ) }),
2604
+ dataBindingProperties && props.node.dataBinding.enablePagination && /* @__PURE__ */ jsx31("div", { children: /* @__PURE__ */ jsx31(
2605
+ Pagination,
2606
+ {
2607
+ path: props.path,
2608
+ query: props.query,
2609
+ dataset: response
2610
+ }
2611
+ ) })
2612
+ ] });
2613
+ };
2614
+ var DivContainer_default = DivContainer;
2615
+
2616
+ // src/components/pageRenderingEngine/PageBodyRenderer.tsx
2617
+ import { jsx as jsx32 } from "react/jsx-runtime";
2618
+ var NodeTypes = {
2619
+ ["paragraph"]: ParagraphNode_default,
2620
+ ["heading"]: HeadingNode_default,
2621
+ ["list"]: ListNode_default,
2622
+ ["quote"]: QuoteNode_default,
2623
+ ["code"]: CodeNode_default,
2624
+ ["image"]: ImageNode_default,
2625
+ ["image-gallery"]: ImageGalleryNode_default,
2626
+ ["horizontalrule"]: HorizontalRuleNode_default,
2627
+ ["widget"]: WidgetNode_default,
2628
+ // ["form-container"]: FormContainerNode,
2629
+ ["div-container"]: DivContainer_default,
2630
+ ["svg-icon"]: SVGIconNode_default,
2631
+ ["embed"]: EmbedNode_default,
2632
+ ["document"]: DocumentNode_default
2633
+ };
2634
+ var PageBodyRenderer = (props) => {
2635
+ let pageBodyTree;
2636
+ if (props.rawBody != void 0 && props.rawBody != null && props.rawBody != "") {
2637
+ try {
2638
+ pageBodyTree = JSON.parse(props.rawBody.toString());
2639
+ } catch (error) {
2640
+ }
2641
+ }
2642
+ let rootNode;
2643
+ if (pageBodyTree && pageBodyTree.root) {
2644
+ rootNode = pageBodyTree.root;
2645
+ }
2646
+ const shouldRenderNode = (node) => {
2647
+ {
2648
+ }
2649
+ if (node.type === "div-container" && node.roleCode) {
2650
+ return validateRoleVisibility(node.roleCode, props.session?.oAuthToken);
2651
+ }
2652
+ return true;
2653
+ };
2654
+ return /* @__PURE__ */ jsx32(React20.Fragment, { children: rootNode && rootNode?.children?.map((node, index) => {
2655
+ {
2656
+ }
2657
+ const SelectedNode = NodeTypes[node.type];
2658
+ if (!shouldRenderNode(node)) {
2659
+ return null;
2660
+ }
2661
+ return /* @__PURE__ */ jsx32(React20.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx32(React20.Fragment, { children: node.type == "layout-container" ? /* @__PURE__ */ jsx32(React20.Fragment, { children: /* @__PURE__ */ jsx32(
2662
+ SelectedNode,
2663
+ {
2664
+ node,
2665
+ firstNode: true,
2666
+ routeParameters: props.routeParameters,
2667
+ query: props.query,
2668
+ session: props.session,
2669
+ host: props.host,
2670
+ path: props.path,
2671
+ apiBaseUrl: props.apiBaseUrl,
2672
+ serviceClient: props.serviceClient,
2673
+ assetBaseUrl: props.assetBaseUrl,
2674
+ device: props.device,
2675
+ widgetRenderer: props.widgetRenderer
2676
+ }
2677
+ ) }) : /* @__PURE__ */ jsx32(React20.Fragment, { children: /* @__PURE__ */ jsx32(
2678
+ SelectedNode,
2679
+ {
2680
+ node,
2681
+ routeParameters: props.routeParameters,
2682
+ query: props.query,
2683
+ session: props.session,
2684
+ host: props.host,
2685
+ path: props.path,
2686
+ apiBaseUrl: props.apiBaseUrl,
2687
+ serviceClient: props.serviceClient,
2688
+ assetBaseUrl: props.assetBaseUrl,
2689
+ device: props.device,
2690
+ widgetRenderer: props.widgetRenderer
2691
+ }
2692
+ ) }) }) }, index);
2693
+ }) });
2694
+ };
2695
+ var PageBodyRenderer_default = PageBodyRenderer;
2696
+ export {
2697
+ PageBodyRenderer_default as PageBodyRenderer
2698
+ };