@palmyit/elements 0.1.8 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -13
- package/dist/definitions.d.ts +15 -9
- package/dist/definitions.js +1756 -949
- package/dist/elements/article/definition.d.ts +43 -0
- package/dist/elements/article/template.d.ts +12 -0
- package/dist/elements/button/definition.d.ts +1 -0
- package/dist/elements/footer/definition.d.ts +35 -0
- package/dist/elements/footer/template.d.ts +2 -0
- package/dist/elements/heading/definition.d.ts +29 -0
- package/dist/elements/heading/template.d.ts +2 -0
- package/dist/elements/icon/definition.d.ts +11 -0
- package/dist/elements/image/definition.d.ts +47 -0
- package/dist/elements/image/template.d.ts +30 -0
- package/dist/elements/list/definition.d.ts +2 -0
- package/dist/elements/nav/definition.d.ts +39 -0
- package/dist/elements/nav/template.d.ts +17 -0
- package/dist/elements/page/definition.d.ts +41 -1
- package/dist/elements/table/definition.d.ts +2 -0
- package/dist/elements/text/definition.d.ts +2 -1
- package/dist/elements/video/definition.d.ts +39 -0
- package/dist/elements/video/template.d.ts +6 -0
- package/dist/elements/video/youtube.d.ts +4 -0
- package/dist/manifest.json +2 -2
- package/dist/plmt-elements.css +1 -1
- package/dist/render/renderHtml.d.ts +1 -1
- package/dist/render/styleToClasses.d.ts +8 -9
- package/dist/render/styleToVars.d.ts +2 -0
- package/dist/render/styleTokens.d.ts +11 -1
- package/dist/render/tags.d.ts +9 -1
- package/dist/render/types.d.ts +4 -0
- package/dist/schema/Fields/ColorField/colorText.d.ts +3 -0
- package/dist/schema/Fields/IconPicker/iconCatalog.d.ts +5 -1
- package/dist/schema/addressSchema.d.ts +2 -0
- package/dist/schema/device/devices.d.ts +8 -0
- package/dist/schema/deviceSettings.d.ts +1 -1
- package/dist/schema/elementCategories.d.ts +29 -0
- package/dist/schema/elementConfiguration.d.ts +1 -1
- package/dist/schema/elementRegistry.d.ts +25 -1
- package/dist/schema/elementStyleDefinitions.d.ts +6 -14
- package/dist/schema/elementTemplates.d.ts +3 -2
- package/dist/schema/linkSettings.d.ts +19 -2
- package/dist/schema/style/elementStyle.d.ts +1 -1
- package/dist/schema/styleItems.d.ts +18 -0
- package/dist/schema/styleTokensSchema.d.ts +34 -18
- package/dist/tags.json +5 -1
- package/dist/templates/brands/brandSpec.d.ts +5 -0
- package/dist/templates/elementSpec.d.ts +1 -1
- package/dist/templates/head.d.ts +43 -0
- package/dist/templates/heroicons/heroiconSpec.d.ts +6 -0
- package/dist/templates.d.ts +3 -0
- package/dist/templates.js +1351 -237
- package/dist/youtube-BDsE1Bz3.js +910 -0
- package/package.json +3 -3
- package/dist/styleToClasses-CZSWp6Ez.js +0 -683
|
@@ -0,0 +1,910 @@
|
|
|
1
|
+
import { z as e } from "zod";
|
|
2
|
+
// src/schema/addressSchema.ts
|
|
3
|
+
var t = "Enter an https:// address or a path that starts with /", n = "Enter an https:// address, a path that starts with /, or a mailto: or tel: link";
|
|
4
|
+
function r(e) {
|
|
5
|
+
if (e.startsWith("/")) return !e.startsWith("//") && !e.startsWith("/\\");
|
|
6
|
+
try {
|
|
7
|
+
let { protocol: t } = new URL(e);
|
|
8
|
+
return t === "https:" || t === "http:";
|
|
9
|
+
} catch {
|
|
10
|
+
return !1;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function i(e) {
|
|
14
|
+
if (e.startsWith("mailto:") || e.startsWith("tel:")) return e.length > 7;
|
|
15
|
+
if (e.startsWith("/")) return !e.startsWith("//") && !e.startsWith("/\\");
|
|
16
|
+
try {
|
|
17
|
+
return new URL(e).protocol === "https:";
|
|
18
|
+
} catch {
|
|
19
|
+
return !1;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
var ee = e.string().trim().min(1, t).refine(r, t), a = e.string().trim().min(1, n).refine(i, n), o = [
|
|
23
|
+
{
|
|
24
|
+
name: "Desktop",
|
|
25
|
+
icon: "Monitor",
|
|
26
|
+
portrait: {
|
|
27
|
+
width: 1280,
|
|
28
|
+
height: "auto"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "Tablet",
|
|
33
|
+
icon: "Tablet",
|
|
34
|
+
portrait: {
|
|
35
|
+
width: 768,
|
|
36
|
+
height: "auto"
|
|
37
|
+
},
|
|
38
|
+
landscape: {
|
|
39
|
+
width: 1024,
|
|
40
|
+
height: 768
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "Mobile",
|
|
45
|
+
icon: "Smartphone",
|
|
46
|
+
portrait: {
|
|
47
|
+
width: 360,
|
|
48
|
+
height: "auto"
|
|
49
|
+
},
|
|
50
|
+
landscape: {
|
|
51
|
+
width: 640,
|
|
52
|
+
height: 360
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
], te = {
|
|
56
|
+
mobile: "(max-width: 767px)",
|
|
57
|
+
tablet: "(max-width: 1279px)"
|
|
58
|
+
}, ne = o.map(({ portrait: e, icon: t, name: n }) => ({
|
|
59
|
+
...e,
|
|
60
|
+
icon: t,
|
|
61
|
+
label: n
|
|
62
|
+
}));
|
|
63
|
+
function s(e) {
|
|
64
|
+
return o.find((t) => t.portrait.width === e || t.landscape?.width === e) ?? o[0];
|
|
65
|
+
}
|
|
66
|
+
function c(e) {
|
|
67
|
+
return s(e).landscape?.width === e ? "landscape" : "portrait";
|
|
68
|
+
}
|
|
69
|
+
// src/schema/linkSettings.ts
|
|
70
|
+
var l = ["_self", "_blank"], u = [
|
|
71
|
+
"",
|
|
72
|
+
"nofollow",
|
|
73
|
+
"sponsored",
|
|
74
|
+
"ugc"
|
|
75
|
+
], d = {
|
|
76
|
+
href: "",
|
|
77
|
+
target: "_self",
|
|
78
|
+
description: "",
|
|
79
|
+
rel: ""
|
|
80
|
+
}, re = {
|
|
81
|
+
href: e.string().trim().pipe(e.union([e.literal(""), a])).default(d.href),
|
|
82
|
+
target: e.enum(l).default(d.target),
|
|
83
|
+
description: e.string().trim().default(d.description),
|
|
84
|
+
rel: e.enum(u).default(d.rel)
|
|
85
|
+
}, ie = {
|
|
86
|
+
href: "Link address",
|
|
87
|
+
target: "Link target",
|
|
88
|
+
description: "Link description",
|
|
89
|
+
rel: "Link rel"
|
|
90
|
+
};
|
|
91
|
+
function f(e, t = "") {
|
|
92
|
+
let n = [];
|
|
93
|
+
return e === "_blank" && n.push("noopener", "noreferrer"), t && n.push(t), n.length > 0 ? n.join(" ") : void 0;
|
|
94
|
+
}
|
|
95
|
+
function ae({ href: e, target: t = d.target, description: n = "", rel: r = "" }) {
|
|
96
|
+
return e === "" ? {} : {
|
|
97
|
+
href: e,
|
|
98
|
+
...t === d.target ? {} : { target: t },
|
|
99
|
+
...n === "" ? {} : { description: n },
|
|
100
|
+
...r === "" ? {} : { rel: r }
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
// src/render/styleTokens.ts
|
|
104
|
+
var p = /* @__PURE__ */ "0,px,0.5,1,1.5,2,2.5,3,3.5,4,5,6,7,8,9,10,11,12,14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96,auto".split(","), m = [
|
|
105
|
+
"0",
|
|
106
|
+
"1",
|
|
107
|
+
"2",
|
|
108
|
+
"4",
|
|
109
|
+
"8"
|
|
110
|
+
], h = /* @__PURE__ */ "none,sm,md,lg,xl,2xl,3xl,full,0,px,0.5,1,1.5,2,2.5,3,3.5,4,5,6,7,8,9,10,11,12,14,16".split(","), g = [
|
|
111
|
+
"xs",
|
|
112
|
+
"sm",
|
|
113
|
+
"base",
|
|
114
|
+
"lg",
|
|
115
|
+
"xl",
|
|
116
|
+
"2xl",
|
|
117
|
+
"3xl",
|
|
118
|
+
"4xl",
|
|
119
|
+
"5xl",
|
|
120
|
+
"6xl"
|
|
121
|
+
], _ = [
|
|
122
|
+
"none",
|
|
123
|
+
"tight",
|
|
124
|
+
"snug",
|
|
125
|
+
"normal",
|
|
126
|
+
"relaxed",
|
|
127
|
+
"loose",
|
|
128
|
+
"3",
|
|
129
|
+
"4",
|
|
130
|
+
"5",
|
|
131
|
+
"6",
|
|
132
|
+
"7",
|
|
133
|
+
"8",
|
|
134
|
+
"9",
|
|
135
|
+
"10"
|
|
136
|
+
], v = [
|
|
137
|
+
"tighter",
|
|
138
|
+
"tight",
|
|
139
|
+
"normal",
|
|
140
|
+
"wide",
|
|
141
|
+
"wider",
|
|
142
|
+
"widest"
|
|
143
|
+
], y = [
|
|
144
|
+
"accent",
|
|
145
|
+
"accent-50",
|
|
146
|
+
"accent-100",
|
|
147
|
+
"accent-700",
|
|
148
|
+
"accent-foreground",
|
|
149
|
+
"transparent",
|
|
150
|
+
"white",
|
|
151
|
+
"black",
|
|
152
|
+
"slate-50",
|
|
153
|
+
"slate-100",
|
|
154
|
+
"slate-200",
|
|
155
|
+
"slate-300",
|
|
156
|
+
"slate-400",
|
|
157
|
+
"slate-500",
|
|
158
|
+
"slate-600",
|
|
159
|
+
"slate-700",
|
|
160
|
+
"slate-800",
|
|
161
|
+
"slate-900",
|
|
162
|
+
"slate-950"
|
|
163
|
+
], b = [
|
|
164
|
+
0,
|
|
165
|
+
5,
|
|
166
|
+
10,
|
|
167
|
+
15,
|
|
168
|
+
20,
|
|
169
|
+
25,
|
|
170
|
+
30,
|
|
171
|
+
40,
|
|
172
|
+
50,
|
|
173
|
+
60,
|
|
174
|
+
70,
|
|
175
|
+
75,
|
|
176
|
+
80,
|
|
177
|
+
90,
|
|
178
|
+
95,
|
|
179
|
+
100
|
|
180
|
+
], oe = new Set(p), x = new Set(m), se = new Set(h), ce = new Set(g), S = new Set(_), C = new Set(v), w = new Set(y), le = new Set(b), ue = {
|
|
181
|
+
0: "0",
|
|
182
|
+
"0px": "0",
|
|
183
|
+
"0rem": "0",
|
|
184
|
+
"0em": "0",
|
|
185
|
+
"1px": "px",
|
|
186
|
+
"0.125rem": "0.5",
|
|
187
|
+
"2px": "0.5",
|
|
188
|
+
"0.25rem": "1",
|
|
189
|
+
"4px": "1",
|
|
190
|
+
"0.375rem": "1.5",
|
|
191
|
+
"6px": "1.5",
|
|
192
|
+
"0.5rem": "2",
|
|
193
|
+
"8px": "2",
|
|
194
|
+
"0.625rem": "2.5",
|
|
195
|
+
"10px": "2.5",
|
|
196
|
+
"0.75rem": "3",
|
|
197
|
+
"12px": "3",
|
|
198
|
+
"0.875rem": "3.5",
|
|
199
|
+
"14px": "3.5",
|
|
200
|
+
"1rem": "4",
|
|
201
|
+
"16px": "4",
|
|
202
|
+
"1.25rem": "5",
|
|
203
|
+
"20px": "5",
|
|
204
|
+
"1.5rem": "6",
|
|
205
|
+
"24px": "6",
|
|
206
|
+
"1.75rem": "7",
|
|
207
|
+
"28px": "7",
|
|
208
|
+
"2rem": "8",
|
|
209
|
+
"32px": "8",
|
|
210
|
+
"2.25rem": "9",
|
|
211
|
+
"36px": "9",
|
|
212
|
+
"2.5rem": "10",
|
|
213
|
+
"40px": "10",
|
|
214
|
+
"2.75rem": "11",
|
|
215
|
+
"44px": "11",
|
|
216
|
+
"3rem": "12",
|
|
217
|
+
"48px": "12",
|
|
218
|
+
"3.5rem": "14",
|
|
219
|
+
"56px": "14",
|
|
220
|
+
"4rem": "16",
|
|
221
|
+
"64px": "16",
|
|
222
|
+
"5rem": "20",
|
|
223
|
+
"80px": "20",
|
|
224
|
+
"6rem": "24",
|
|
225
|
+
"96px": "24",
|
|
226
|
+
"7rem": "28",
|
|
227
|
+
"112px": "28",
|
|
228
|
+
"8rem": "32",
|
|
229
|
+
"128px": "32",
|
|
230
|
+
"9rem": "36",
|
|
231
|
+
"144px": "36",
|
|
232
|
+
"10rem": "40",
|
|
233
|
+
"160px": "40",
|
|
234
|
+
"11rem": "44",
|
|
235
|
+
"176px": "44",
|
|
236
|
+
"12rem": "48",
|
|
237
|
+
"192px": "48",
|
|
238
|
+
"13rem": "52",
|
|
239
|
+
"208px": "52",
|
|
240
|
+
"14rem": "56",
|
|
241
|
+
"224px": "56",
|
|
242
|
+
"15rem": "60",
|
|
243
|
+
"240px": "60",
|
|
244
|
+
"16rem": "64",
|
|
245
|
+
"256px": "64",
|
|
246
|
+
"18rem": "72",
|
|
247
|
+
"288px": "72",
|
|
248
|
+
"20rem": "80",
|
|
249
|
+
"320px": "80",
|
|
250
|
+
"24rem": "96",
|
|
251
|
+
"384px": "96",
|
|
252
|
+
auto: "auto"
|
|
253
|
+
}, T = {
|
|
254
|
+
12: "xs",
|
|
255
|
+
14: "sm",
|
|
256
|
+
16: "base",
|
|
257
|
+
18: "lg",
|
|
258
|
+
20: "xl",
|
|
259
|
+
24: "2xl",
|
|
260
|
+
30: "3xl",
|
|
261
|
+
36: "4xl",
|
|
262
|
+
48: "5xl",
|
|
263
|
+
60: "6xl"
|
|
264
|
+
}, de = {
|
|
265
|
+
"#0F766E": "accent",
|
|
266
|
+
"#0F172A": "slate-900",
|
|
267
|
+
"#1E293B": "slate-800",
|
|
268
|
+
"#334155": "slate-700",
|
|
269
|
+
"#475569": "slate-600",
|
|
270
|
+
"#64748B": "slate-500",
|
|
271
|
+
"#94A3B8": "slate-400",
|
|
272
|
+
"#CBD5E1": "slate-300",
|
|
273
|
+
"#E2E8F0": "slate-200",
|
|
274
|
+
"#F1F5F9": "slate-100",
|
|
275
|
+
"#F8FAFC": "slate-50",
|
|
276
|
+
"#020617": "slate-950",
|
|
277
|
+
"#FFFFFF": "white",
|
|
278
|
+
"#000000": "black"
|
|
279
|
+
};
|
|
280
|
+
function E(e) {
|
|
281
|
+
return oe.has(e);
|
|
282
|
+
}
|
|
283
|
+
function fe(e) {
|
|
284
|
+
return x.has(e);
|
|
285
|
+
}
|
|
286
|
+
function D(e) {
|
|
287
|
+
return se.has(e);
|
|
288
|
+
}
|
|
289
|
+
function pe(e) {
|
|
290
|
+
return ce.has(e);
|
|
291
|
+
}
|
|
292
|
+
function me(e) {
|
|
293
|
+
return S.has(e);
|
|
294
|
+
}
|
|
295
|
+
function he(e) {
|
|
296
|
+
return C.has(e);
|
|
297
|
+
}
|
|
298
|
+
function O(e) {
|
|
299
|
+
if (!e || typeof e != "object") return !1;
|
|
300
|
+
let t = e;
|
|
301
|
+
return typeof t.name == "string" && w.has(t.name) && typeof t.opacity == "number" && le.has(t.opacity);
|
|
302
|
+
}
|
|
303
|
+
function k(e) {
|
|
304
|
+
if (!e || typeof e != "object" || !("hex" in e) || !("opacity" in e)) return !1;
|
|
305
|
+
let t = e;
|
|
306
|
+
return typeof t.hex == "string" && typeof t.opacity == "number" && !("name" in e);
|
|
307
|
+
}
|
|
308
|
+
function A(e) {
|
|
309
|
+
if (typeof e != "string") return;
|
|
310
|
+
let t = e.trim();
|
|
311
|
+
return E(t) ? t : ue[t.toLowerCase()];
|
|
312
|
+
}
|
|
313
|
+
function ge(e) {
|
|
314
|
+
if (typeof e == "number" && x.has(String(e))) return String(e);
|
|
315
|
+
if (typeof e != "string") return;
|
|
316
|
+
let t = e.trim();
|
|
317
|
+
return fe(t) ? t : {
|
|
318
|
+
0: "0",
|
|
319
|
+
"0px": "0",
|
|
320
|
+
"1px": "1",
|
|
321
|
+
"2px": "2",
|
|
322
|
+
"4px": "4",
|
|
323
|
+
"8px": "8"
|
|
324
|
+
}[t.toLowerCase()];
|
|
325
|
+
}
|
|
326
|
+
function _e(e) {
|
|
327
|
+
if (typeof e != "string") return;
|
|
328
|
+
let t = e.trim();
|
|
329
|
+
if (D(t)) return t;
|
|
330
|
+
let n = A(t);
|
|
331
|
+
return n && D(n) ? n : {
|
|
332
|
+
"0.125rem": "sm",
|
|
333
|
+
"2px": "sm",
|
|
334
|
+
"0.25rem": "md",
|
|
335
|
+
"4px": "md",
|
|
336
|
+
"0.375rem": "md",
|
|
337
|
+
"6px": "md",
|
|
338
|
+
"0.5rem": "lg",
|
|
339
|
+
"8px": "lg",
|
|
340
|
+
"0.75rem": "xl",
|
|
341
|
+
"12px": "xl",
|
|
342
|
+
"1rem": "2xl",
|
|
343
|
+
"16px": "2xl",
|
|
344
|
+
"1.5rem": "3xl",
|
|
345
|
+
"24px": "3xl",
|
|
346
|
+
"9999px": "full"
|
|
347
|
+
}[t.toLowerCase()];
|
|
348
|
+
}
|
|
349
|
+
function j(e) {
|
|
350
|
+
if (typeof e == "number") return T[e];
|
|
351
|
+
if (typeof e != "string") return;
|
|
352
|
+
let t = e.trim();
|
|
353
|
+
if (pe(t)) return t;
|
|
354
|
+
let n = /^(\d+(?:\.\d+)?)px$/i.exec(t);
|
|
355
|
+
if (n) return T[Number(n[1])];
|
|
356
|
+
}
|
|
357
|
+
function M(e) {
|
|
358
|
+
if (typeof e != "string") return;
|
|
359
|
+
let t = e.trim();
|
|
360
|
+
return me(t) ? t : {
|
|
361
|
+
1: "none",
|
|
362
|
+
"1.25": "tight",
|
|
363
|
+
"1.375": "snug",
|
|
364
|
+
"1.4": "snug",
|
|
365
|
+
"1.5": "normal",
|
|
366
|
+
"1.625": "relaxed",
|
|
367
|
+
2: "loose"
|
|
368
|
+
}[t.toLowerCase()];
|
|
369
|
+
}
|
|
370
|
+
function N(e) {
|
|
371
|
+
if (typeof e != "string") return;
|
|
372
|
+
let t = e.trim();
|
|
373
|
+
if (he(t)) return t;
|
|
374
|
+
}
|
|
375
|
+
function P(e) {
|
|
376
|
+
if (O(e)) return e;
|
|
377
|
+
if (!k(e)) return;
|
|
378
|
+
let t = de[e.hex.toUpperCase()];
|
|
379
|
+
if (!t) return;
|
|
380
|
+
let n = b.reduce((t, n) => Math.abs(n - e.opacity) < Math.abs(t - e.opacity) ? n : t);
|
|
381
|
+
if (!(Math.abs(n - e.opacity) > 2 && e.opacity !== 100 && ![
|
|
382
|
+
0,
|
|
383
|
+
5,
|
|
384
|
+
10,
|
|
385
|
+
15,
|
|
386
|
+
20,
|
|
387
|
+
25,
|
|
388
|
+
30,
|
|
389
|
+
40,
|
|
390
|
+
50,
|
|
391
|
+
60,
|
|
392
|
+
70,
|
|
393
|
+
75,
|
|
394
|
+
80,
|
|
395
|
+
90,
|
|
396
|
+
95,
|
|
397
|
+
100
|
|
398
|
+
].includes(e.opacity) && !b.find((t) => t === e.opacity))) return {
|
|
399
|
+
name: t,
|
|
400
|
+
opacity: b.includes(e.opacity) ? e.opacity : n
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
function F(e) {
|
|
404
|
+
return {
|
|
405
|
+
xs: "0.75rem",
|
|
406
|
+
sm: "0.875rem",
|
|
407
|
+
base: "1rem",
|
|
408
|
+
lg: "1.125rem",
|
|
409
|
+
xl: "1.25rem",
|
|
410
|
+
"2xl": "1.5rem",
|
|
411
|
+
"3xl": "1.875rem",
|
|
412
|
+
"4xl": "2.25rem",
|
|
413
|
+
"5xl": "3rem",
|
|
414
|
+
"6xl": "3.75rem"
|
|
415
|
+
}[e];
|
|
416
|
+
}
|
|
417
|
+
function I(e) {
|
|
418
|
+
if (e.name === "transparent") return "transparent";
|
|
419
|
+
let t = {
|
|
420
|
+
accent: "#0F766E",
|
|
421
|
+
"accent-50": "#F0FDFA",
|
|
422
|
+
"accent-100": "#CCFBF1",
|
|
423
|
+
"accent-700": "#0F766E",
|
|
424
|
+
"accent-foreground": "#FFFFFF",
|
|
425
|
+
white: "#FFFFFF",
|
|
426
|
+
black: "#000000",
|
|
427
|
+
"slate-50": "#F8FAFC",
|
|
428
|
+
"slate-100": "#F1F5F9",
|
|
429
|
+
"slate-200": "#E2E8F0",
|
|
430
|
+
"slate-300": "#CBD5E1",
|
|
431
|
+
"slate-400": "#94A3B8",
|
|
432
|
+
"slate-500": "#64748B",
|
|
433
|
+
"slate-600": "#475569",
|
|
434
|
+
"slate-700": "#334155",
|
|
435
|
+
"slate-800": "#1E293B",
|
|
436
|
+
"slate-900": "#0F172A",
|
|
437
|
+
"slate-950": "#020617"
|
|
438
|
+
}[e.name];
|
|
439
|
+
if (e.opacity === 100) return t;
|
|
440
|
+
let n = e.opacity / 100;
|
|
441
|
+
return `rgba(${Number.parseInt(t.slice(1, 3), 16)}, ${Number.parseInt(t.slice(3, 5), 16)}, ${Number.parseInt(t.slice(5, 7), 16)}, ${n})`;
|
|
442
|
+
}
|
|
443
|
+
function L(e) {
|
|
444
|
+
return e === "0" ? "0" : e === "px" ? "1px" : e === "auto" ? "auto" : {
|
|
445
|
+
"0.5": "0.125rem",
|
|
446
|
+
1: "0.25rem",
|
|
447
|
+
"1.5": "0.375rem",
|
|
448
|
+
2: "0.5rem",
|
|
449
|
+
"2.5": "0.625rem",
|
|
450
|
+
3: "0.75rem",
|
|
451
|
+
"3.5": "0.875rem",
|
|
452
|
+
4: "1rem",
|
|
453
|
+
5: "1.25rem",
|
|
454
|
+
6: "1.5rem",
|
|
455
|
+
7: "1.75rem",
|
|
456
|
+
8: "2rem",
|
|
457
|
+
9: "2.25rem",
|
|
458
|
+
10: "2.5rem",
|
|
459
|
+
11: "2.75rem",
|
|
460
|
+
12: "3rem",
|
|
461
|
+
14: "3.5rem",
|
|
462
|
+
16: "4rem",
|
|
463
|
+
20: "5rem",
|
|
464
|
+
24: "6rem",
|
|
465
|
+
28: "7rem",
|
|
466
|
+
32: "8rem",
|
|
467
|
+
36: "9rem",
|
|
468
|
+
40: "10rem",
|
|
469
|
+
44: "11rem",
|
|
470
|
+
48: "12rem",
|
|
471
|
+
52: "13rem",
|
|
472
|
+
56: "14rem",
|
|
473
|
+
60: "15rem",
|
|
474
|
+
64: "16rem",
|
|
475
|
+
72: "18rem",
|
|
476
|
+
80: "20rem",
|
|
477
|
+
96: "24rem"
|
|
478
|
+
}[e] ?? e;
|
|
479
|
+
}
|
|
480
|
+
function ve(e) {
|
|
481
|
+
let t = {
|
|
482
|
+
none: "0",
|
|
483
|
+
sm: "0.125rem",
|
|
484
|
+
md: "0.375rem",
|
|
485
|
+
lg: "0.5rem",
|
|
486
|
+
xl: "0.75rem",
|
|
487
|
+
"2xl": "1rem",
|
|
488
|
+
"3xl": "1.5rem",
|
|
489
|
+
full: "9999px"
|
|
490
|
+
};
|
|
491
|
+
return t[e] ? t[e] : E(e) ? L(e) : e;
|
|
492
|
+
}
|
|
493
|
+
function ye(e) {
|
|
494
|
+
return e === "0" ? "0" : `${e}px`;
|
|
495
|
+
}
|
|
496
|
+
function be(e) {
|
|
497
|
+
return {
|
|
498
|
+
none: "1",
|
|
499
|
+
tight: "1.25",
|
|
500
|
+
snug: "1.375",
|
|
501
|
+
normal: "1.5",
|
|
502
|
+
relaxed: "1.625",
|
|
503
|
+
loose: "2",
|
|
504
|
+
3: "0.75rem",
|
|
505
|
+
4: "1rem",
|
|
506
|
+
5: "1.25rem",
|
|
507
|
+
6: "1.5rem",
|
|
508
|
+
7: "1.75rem",
|
|
509
|
+
8: "2rem",
|
|
510
|
+
9: "2.25rem",
|
|
511
|
+
10: "2.5rem"
|
|
512
|
+
}[e];
|
|
513
|
+
}
|
|
514
|
+
function xe(e) {
|
|
515
|
+
return {
|
|
516
|
+
tighter: "-0.05em",
|
|
517
|
+
tight: "-0.025em",
|
|
518
|
+
normal: "0em",
|
|
519
|
+
wide: "0.025em",
|
|
520
|
+
wider: "0.05em",
|
|
521
|
+
widest: "0.1em"
|
|
522
|
+
}[e];
|
|
523
|
+
}
|
|
524
|
+
// src/elements/rich-text/richTextMarks.ts
|
|
525
|
+
var Se = /^[A-Za-z0-9][A-Za-z0-9 ]*$/;
|
|
526
|
+
function R(e) {
|
|
527
|
+
return typeof e == "string" && Se.test(e);
|
|
528
|
+
}
|
|
529
|
+
// src/render/styleToClasses.ts
|
|
530
|
+
var Ce = {
|
|
531
|
+
PButton: [
|
|
532
|
+
"inline-flex",
|
|
533
|
+
"items-center",
|
|
534
|
+
"justify-center"
|
|
535
|
+
],
|
|
536
|
+
PIcon: [
|
|
537
|
+
"inline-flex",
|
|
538
|
+
"items-center",
|
|
539
|
+
"justify-center"
|
|
540
|
+
],
|
|
541
|
+
PText: ["whitespace-pre-wrap", "break-words"],
|
|
542
|
+
PHeading: ["whitespace-pre-wrap", "break-words"],
|
|
543
|
+
PVideo: ["block", "w-full"],
|
|
544
|
+
PList: ["block"],
|
|
545
|
+
PDivider: ["block"],
|
|
546
|
+
PTable: ["block"],
|
|
547
|
+
PTextField: ["block"],
|
|
548
|
+
PTextArea: ["block"],
|
|
549
|
+
PCheckbox: ["block"],
|
|
550
|
+
PRadio: ["block"],
|
|
551
|
+
PSelect: ["block"]
|
|
552
|
+
};
|
|
553
|
+
function z(e, t, n = "") {
|
|
554
|
+
return t ? {
|
|
555
|
+
classes: [],
|
|
556
|
+
unresolved: { ...t }
|
|
557
|
+
} : {
|
|
558
|
+
classes: [],
|
|
559
|
+
unresolved: {}
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
function B(e, t) {
|
|
563
|
+
return e === "PPage" ? [] : [...Ce[e] ?? []];
|
|
564
|
+
}
|
|
565
|
+
function V(e, t) {
|
|
566
|
+
return e === "PPage" ? we(t ?? {}) : z(e, t).unresolved;
|
|
567
|
+
}
|
|
568
|
+
function we(e) {
|
|
569
|
+
let t = {};
|
|
570
|
+
if (e.backgroundColor !== void 0) {
|
|
571
|
+
let n = e.backgroundColor, r = P(n);
|
|
572
|
+
t.backgroundColor = r ? H(r, n) : n;
|
|
573
|
+
}
|
|
574
|
+
if (e.textColor !== void 0) {
|
|
575
|
+
let n = P(e.textColor);
|
|
576
|
+
t.textColor = n ? H(n, e.textColor) : e.textColor;
|
|
577
|
+
}
|
|
578
|
+
if (e.textSize !== void 0) {
|
|
579
|
+
let n = j(e.textSize);
|
|
580
|
+
t.textSize = n ? F(n) : e.textSize;
|
|
581
|
+
}
|
|
582
|
+
return t;
|
|
583
|
+
}
|
|
584
|
+
function H(e, t) {
|
|
585
|
+
let n = I(e);
|
|
586
|
+
if (n) {
|
|
587
|
+
if (k(t) && e.opacity === 100) return {
|
|
588
|
+
hex: n.startsWith("#") ? n : t.hex,
|
|
589
|
+
opacity: 100
|
|
590
|
+
};
|
|
591
|
+
if (n.startsWith("#")) return {
|
|
592
|
+
hex: n,
|
|
593
|
+
opacity: 100
|
|
594
|
+
};
|
|
595
|
+
if (n.startsWith("rgba")) return t;
|
|
596
|
+
}
|
|
597
|
+
return t;
|
|
598
|
+
}
|
|
599
|
+
function U(e) {
|
|
600
|
+
let t = {};
|
|
601
|
+
if (e.backgroundColor !== void 0) {
|
|
602
|
+
let n = P(e.backgroundColor);
|
|
603
|
+
if (n) {
|
|
604
|
+
let r = I(n);
|
|
605
|
+
if (r?.startsWith("#")) t.backgroundColor = {
|
|
606
|
+
hex: r,
|
|
607
|
+
opacity: 100
|
|
608
|
+
};
|
|
609
|
+
else if (k(e.backgroundColor)) t.backgroundColor = e.backgroundColor;
|
|
610
|
+
else if (n.opacity < 100 && r?.startsWith("rgba")) {
|
|
611
|
+
let r = I({
|
|
612
|
+
...n,
|
|
613
|
+
opacity: 100
|
|
614
|
+
});
|
|
615
|
+
t.backgroundColor = r?.startsWith("#") ? {
|
|
616
|
+
hex: r,
|
|
617
|
+
opacity: n.opacity
|
|
618
|
+
} : e.backgroundColor;
|
|
619
|
+
} else t.backgroundColor = e.backgroundColor;
|
|
620
|
+
} else t.backgroundColor = e.backgroundColor;
|
|
621
|
+
}
|
|
622
|
+
if (e.textColor !== void 0) {
|
|
623
|
+
let n = P(e.textColor);
|
|
624
|
+
if (n) {
|
|
625
|
+
let r = I({
|
|
626
|
+
...n,
|
|
627
|
+
opacity: 100
|
|
628
|
+
});
|
|
629
|
+
t.textColor = r?.startsWith("#") ? {
|
|
630
|
+
hex: r,
|
|
631
|
+
opacity: n.opacity
|
|
632
|
+
} : e.textColor;
|
|
633
|
+
} else t.textColor = e.textColor;
|
|
634
|
+
}
|
|
635
|
+
if (e.textSize !== void 0) {
|
|
636
|
+
let n = j(e.textSize);
|
|
637
|
+
t.textSize = n ? F(n) : (e.textSize, e.textSize);
|
|
638
|
+
}
|
|
639
|
+
return t;
|
|
640
|
+
}
|
|
641
|
+
// src/render/styleToVars.ts
|
|
642
|
+
var Te = /^#[0-9A-Fa-f]{6}$/;
|
|
643
|
+
function Ee(e) {
|
|
644
|
+
if (O(e)) return I(e);
|
|
645
|
+
if (!e || typeof e != "object" || !("hex" in e) || !("opacity" in e)) return;
|
|
646
|
+
let { hex: t, opacity: n } = e;
|
|
647
|
+
if (!Te.test(t) || !Number.isFinite(n)) return;
|
|
648
|
+
if (n === 100) return t.toUpperCase();
|
|
649
|
+
let r = Math.min(100, Math.max(0, n)) / 100;
|
|
650
|
+
return `rgba(${Number.parseInt(t.slice(1, 3), 16)}, ${Number.parseInt(t.slice(3, 5), 16)}, ${Number.parseInt(t.slice(5, 7), 16)}, ${r})`;
|
|
651
|
+
}
|
|
652
|
+
var W = {
|
|
653
|
+
textFont: "font-family",
|
|
654
|
+
textColor: "color",
|
|
655
|
+
textSize: "font-size",
|
|
656
|
+
fontStyle: "font-style",
|
|
657
|
+
fontWeight: "font-weight",
|
|
658
|
+
lineHeight: "line-height",
|
|
659
|
+
letterSpacing: "letter-spacing",
|
|
660
|
+
wordSpacing: "word-spacing",
|
|
661
|
+
textDecoration: "text-decoration",
|
|
662
|
+
textAlign: "text-align",
|
|
663
|
+
textTransform: "text-transform",
|
|
664
|
+
backgroundColor: "background-color",
|
|
665
|
+
backgroundGradient: "background-image",
|
|
666
|
+
borderRadiusTopLeft: "border-top-left-radius",
|
|
667
|
+
borderRadiusTopRight: "border-top-right-radius",
|
|
668
|
+
borderRadiusBottomLeft: "border-bottom-left-radius",
|
|
669
|
+
borderRadiusBottomRight: "border-bottom-right-radius",
|
|
670
|
+
gridColumns: "grid-template-columns",
|
|
671
|
+
iconGap: "gap",
|
|
672
|
+
overflowX: "overflow-x",
|
|
673
|
+
overflowY: "overflow-y"
|
|
674
|
+
}, De = (e) => e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), Oe = /^(padding|borderRadius)/, ke = /^max(Width|Height)$/;
|
|
675
|
+
function G(e, t) {
|
|
676
|
+
if (typeof t != "string" && typeof t != "number") return;
|
|
677
|
+
let n = String(t).trim(), r = n === "0" || /^-?\d+(\.\d+)?(px|rem|em|%)$/i.test(n) ? void 0 : A(n), i = r ? L(r) : n;
|
|
678
|
+
if (Oe.test(e) && i.toLowerCase() === "auto") return "0";
|
|
679
|
+
if (ke.test(e) && i.toLowerCase() === "auto") return "none";
|
|
680
|
+
if (i.toLowerCase() !== "auto" || e !== "textSize" && e !== "iconGap" && e !== "lineHeight") return i;
|
|
681
|
+
}
|
|
682
|
+
function Ae(e) {
|
|
683
|
+
if (typeof e != "string") return;
|
|
684
|
+
let t = _e(e);
|
|
685
|
+
if (t) {
|
|
686
|
+
let e = ve(t);
|
|
687
|
+
return e === "auto" ? "0" : e;
|
|
688
|
+
}
|
|
689
|
+
let n = e.trim();
|
|
690
|
+
return n.toLowerCase() === "auto" ? "0" : n;
|
|
691
|
+
}
|
|
692
|
+
function je(e) {
|
|
693
|
+
let t = ge(e);
|
|
694
|
+
if (t) return ye(t);
|
|
695
|
+
if (typeof e == "string") {
|
|
696
|
+
let t = e.trim();
|
|
697
|
+
return t.toLowerCase() === "auto" ? "0" : t;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
function Me(e) {
|
|
701
|
+
if (typeof e == "number") return Number.isFinite(e) && e > 0 ? `${e}px` : void 0;
|
|
702
|
+
if (typeof e == "string") {
|
|
703
|
+
let t = e.trim();
|
|
704
|
+
if (t.toLowerCase() === "auto") return;
|
|
705
|
+
if (/^\d+(\.\d+)?(px|rem|em)$/i.test(t)) return t;
|
|
706
|
+
let n = j(t);
|
|
707
|
+
return n ? F(n) : t;
|
|
708
|
+
}
|
|
709
|
+
let t = j(e);
|
|
710
|
+
return t ? F(t) : void 0;
|
|
711
|
+
}
|
|
712
|
+
function K(e, t) {
|
|
713
|
+
return e === "hide" || t === !1 ? "hidden" : "auto";
|
|
714
|
+
}
|
|
715
|
+
function Ne(e) {
|
|
716
|
+
let t = { ...e };
|
|
717
|
+
if (delete t.layout, delete t.backgroundType, e.backgroundType === "gradient" ? t.backgroundColor = {
|
|
718
|
+
hex: "#000000",
|
|
719
|
+
opacity: 0
|
|
720
|
+
} : delete t.backgroundGradient, "overflow" in e || "overflowHorizontal" in e || "overflowVertical" in e) {
|
|
721
|
+
let n = e.overflow ?? "show";
|
|
722
|
+
("overflow" in e || "overflowHorizontal" in e) && (t.overflowX = K(n, e.overflowHorizontal ?? !0)), ("overflow" in e || "overflowVertical" in e) && (t.overflowY = K(n, e.overflowVertical ?? !0)), delete t.overflow, delete t.overflowHorizontal, delete t.overflowVertical;
|
|
723
|
+
}
|
|
724
|
+
return t;
|
|
725
|
+
}
|
|
726
|
+
function Pe(e, t) {
|
|
727
|
+
if (t && typeof t == "object" && ("hex" in t || "name" in t) && "opacity" in t) return Ee(t);
|
|
728
|
+
if (e === "backgroundGradient" && t && typeof t == "object" && "kind" in t && "value" in t) return `${String(t.kind)}-gradient(${String(t.value)})`;
|
|
729
|
+
if (e === "gridColumns" && typeof t == "number") return `repeat(${t}, minmax(0, 1fr))`;
|
|
730
|
+
if (e === "textFont" && typeof t == "string") return R(t) ? `'${t}', var(--default-font-family)` : void 0;
|
|
731
|
+
if (e === "textSize") return Me(t);
|
|
732
|
+
if (e.startsWith("borderRadius")) return Ae(t);
|
|
733
|
+
if (e === "borderWidth") return je(t);
|
|
734
|
+
if (e === "width" || e === "height" || e.startsWith("min") || e.startsWith("max") || e.startsWith("padding") || e.startsWith("margin") || e === "rowGap" || e === "columnGap" || e === "iconGap" || e === "wordSpacing") return G(e, t);
|
|
735
|
+
if (e === "lineHeight") {
|
|
736
|
+
let n = M(t);
|
|
737
|
+
return n ? be(n) : G(e, t);
|
|
738
|
+
}
|
|
739
|
+
if (e === "letterSpacing") {
|
|
740
|
+
let n = N(t);
|
|
741
|
+
return n ? xe(n) : G(e, t);
|
|
742
|
+
}
|
|
743
|
+
return [
|
|
744
|
+
"string",
|
|
745
|
+
"number",
|
|
746
|
+
"boolean"
|
|
747
|
+
].includes(typeof t) ? String(t) : void 0;
|
|
748
|
+
}
|
|
749
|
+
function Fe(e, t) {
|
|
750
|
+
return t === "textColor" ? e === "button" ? `--palmyit-${e}-text-color` : `--palmyit-${e}-color` : `--palmyit-${e}-${W[t] ?? De(t)}`;
|
|
751
|
+
}
|
|
752
|
+
function q(e, t) {
|
|
753
|
+
if (!e) return {};
|
|
754
|
+
let n = Ne(e);
|
|
755
|
+
return Object.fromEntries(Object.entries(n).flatMap(([e, n]) => {
|
|
756
|
+
let r = Pe(e, n);
|
|
757
|
+
return r === void 0 ? [] : [[Fe(t, e), r]];
|
|
758
|
+
}));
|
|
759
|
+
}
|
|
760
|
+
// src/render/tags.ts
|
|
761
|
+
var J = {
|
|
762
|
+
PPage: "plmt-page",
|
|
763
|
+
PSection: "plmt-section",
|
|
764
|
+
PContainer: "plmt-container",
|
|
765
|
+
PNav: "plmt-nav",
|
|
766
|
+
PFooter: "plmt-footer",
|
|
767
|
+
PButton: "plmt-button",
|
|
768
|
+
PText: "plmt-text",
|
|
769
|
+
PHeading: "plmt-heading",
|
|
770
|
+
PRichText: "plmt-rich-text",
|
|
771
|
+
PImage: "plmt-image",
|
|
772
|
+
PVideo: "plmt-video",
|
|
773
|
+
PList: "plmt-list",
|
|
774
|
+
PIcon: "plmt-icon",
|
|
775
|
+
PDivider: "plmt-divider",
|
|
776
|
+
PTable: "plmt-table",
|
|
777
|
+
PTextField: "plmt-text-field",
|
|
778
|
+
PTextArea: "plmt-text-area",
|
|
779
|
+
PCheckbox: "plmt-checkbox",
|
|
780
|
+
PRadio: "plmt-radio",
|
|
781
|
+
PSelect: "plmt-select",
|
|
782
|
+
PArticle: "plmt-article"
|
|
783
|
+
};
|
|
784
|
+
// src/templates/helpers.ts
|
|
785
|
+
function Y(e, t = {}, n, r = {}) {
|
|
786
|
+
return n === void 0 ? {
|
|
787
|
+
tag: e,
|
|
788
|
+
attrs: t,
|
|
789
|
+
styleVars: r
|
|
790
|
+
} : {
|
|
791
|
+
tag: e,
|
|
792
|
+
attrs: t,
|
|
793
|
+
styleVars: r,
|
|
794
|
+
children: n
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
function Ie(e, t) {
|
|
798
|
+
let n = String(e.href ?? "");
|
|
799
|
+
if (!n) return t;
|
|
800
|
+
let r = String(e.target ?? "_self");
|
|
801
|
+
return [Y("a", {
|
|
802
|
+
href: n,
|
|
803
|
+
target: r,
|
|
804
|
+
rel: f(r, String(e.rel ?? "")),
|
|
805
|
+
"aria-description": String(e.description ?? "") || void 0
|
|
806
|
+
}, t)];
|
|
807
|
+
}
|
|
808
|
+
function X(e) {
|
|
809
|
+
return e.slice(1).replaceAll(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
810
|
+
}
|
|
811
|
+
function Z(e) {
|
|
812
|
+
return String(e.id ?? e.pageId ?? "");
|
|
813
|
+
}
|
|
814
|
+
function Le(e) {
|
|
815
|
+
return {
|
|
816
|
+
style: e.style,
|
|
817
|
+
tabletStyle: e.tabletStyle,
|
|
818
|
+
mobileStyle: e.mobileStyle,
|
|
819
|
+
tabletLandscapeStyle: e.tabletLandscapeStyle,
|
|
820
|
+
mobileLandscapeStyle: e.mobileLandscapeStyle
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
function Q(e, t, n) {
|
|
824
|
+
let r = e.style ?? {}, i = {
|
|
825
|
+
class: [t, ...n ? B(n, Le(e)) : []].filter(Boolean).join(" "),
|
|
826
|
+
"data-plmt-id": Z(e)
|
|
827
|
+
};
|
|
828
|
+
return typeof r.layout == "string" && (i["data-layout"] = r.layout), typeof r.backgroundType == "string" && (i["data-background"] = r.backgroundType), i;
|
|
829
|
+
}
|
|
830
|
+
function Re(e, t) {
|
|
831
|
+
return {
|
|
832
|
+
attrs: Q(t, J[e], e),
|
|
833
|
+
vars: q(V(e, t.style), X(e))
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
function ze(e) {
|
|
837
|
+
return q(U({
|
|
838
|
+
backgroundColor: e.backgroundColor,
|
|
839
|
+
textColor: e.textColor,
|
|
840
|
+
textSize: e.textSize
|
|
841
|
+
}), "page");
|
|
842
|
+
}
|
|
843
|
+
// src/templates/brands/brandSpec.ts
|
|
844
|
+
var Be = [
|
|
845
|
+
"facebook",
|
|
846
|
+
"x",
|
|
847
|
+
"instagram",
|
|
848
|
+
"linkedin",
|
|
849
|
+
"youtube"
|
|
850
|
+
], Ve = {
|
|
851
|
+
facebook: "M14 9h3V6h-3c-1.7 0-3 1.3-3 3v2H9v3h2v7h3v-7h2.5l.5-3H14V9z",
|
|
852
|
+
x: "M4 4l6.5 8.5L4.2 20h2.3l5-6.2L16.8 20H20l-6.7-8.8L19.6 4h-2.3l-4.7 5.8L7.2 4H4z",
|
|
853
|
+
instagram: "M7 3h10a4 4 0 014 4v10a4 4 0 01-4 4H7a4 4 0 01-4-4V7a4 4 0 014-4zm5 4.5A4.5 4.5 0 1016.5 12 4.5 4.5 0 0012 7.5zm5.2-.9a1.1 1.1 0 11-1.1-1.1 1.1 1.1 0 011.1 1.1z",
|
|
854
|
+
linkedin: "M6.5 9H3.7v11h2.8zm.2-4.2a1.7 1.7 0 11-1.7-1.6 1.7 1.7 0 011.7 1.6zM20.3 14.3c0-3.2-1.7-4.7-4-4.7a3.5 3.5 0 00-3.1 1.7V9.6h-2.8v11h2.8v-5.8c0-1.5.3-3 2.2-3s1.9 1.7 1.9 3.1V20.6h2.8z",
|
|
855
|
+
youtube: "M21.6 7.2a2.7 2.7 0 00-1.9-1.9C17.9 5 12 5 12 5s-5.9 0-7.7.3A2.7 2.7 0 002.4 7.2 28.3 28.3 0 002 12a28.3 28.3 0 00.4 4.8 2.7 2.7 0 001.9 1.9C6.1 19 12 19 12 19s5.9 0 7.7-.3a2.7 2.7 0 001.9-1.9A28.3 28.3 0 0022 12a28.3 28.3 0 00-.4-4.8zM10 15.5v-7l6 3.5z"
|
|
856
|
+
};
|
|
857
|
+
function He(e) {
|
|
858
|
+
let t = Ve[e];
|
|
859
|
+
return t ? Y("svg", {
|
|
860
|
+
viewBox: "0 0 24 24",
|
|
861
|
+
fill: "currentColor",
|
|
862
|
+
"aria-hidden": "true",
|
|
863
|
+
focusable: "false"
|
|
864
|
+
}, [Y("path", { d: t })]) : null;
|
|
865
|
+
}
|
|
866
|
+
function Ue(e) {
|
|
867
|
+
return {
|
|
868
|
+
facebook: "Facebook",
|
|
869
|
+
x: "X",
|
|
870
|
+
instagram: "Instagram",
|
|
871
|
+
linkedin: "LinkedIn",
|
|
872
|
+
youtube: "YouTube"
|
|
873
|
+
}[e];
|
|
874
|
+
}
|
|
875
|
+
// src/elements/video/youtube.ts
|
|
876
|
+
var $ = /^[\w-]{11}$/;
|
|
877
|
+
function We(e) {
|
|
878
|
+
let t = e.trim();
|
|
879
|
+
if (!t) return null;
|
|
880
|
+
if ($.test(t)) return t;
|
|
881
|
+
try {
|
|
882
|
+
let e = new URL(t), n = e.hostname.replace(/^www\./, "");
|
|
883
|
+
if (n === "youtu.be") {
|
|
884
|
+
let t = e.pathname.split("/").filter(Boolean)[0] ?? "";
|
|
885
|
+
return $.test(t) ? t : null;
|
|
886
|
+
}
|
|
887
|
+
if (n === "youtube.com" || n === "m.youtube.com" || n === "youtube-nocookie.com") {
|
|
888
|
+
let t = e.searchParams.get("v");
|
|
889
|
+
if (t && $.test(t)) return t;
|
|
890
|
+
let n = e.pathname.split("/").filter(Boolean), r = n.findIndex((e) => e === "embed" || e === "shorts" || e === "live");
|
|
891
|
+
if (r >= 0) {
|
|
892
|
+
let e = n[r + 1] ?? "";
|
|
893
|
+
return $.test(e) ? e : null;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
} catch {
|
|
897
|
+
return null;
|
|
898
|
+
}
|
|
899
|
+
return null;
|
|
900
|
+
}
|
|
901
|
+
function Ge(e, t = 0) {
|
|
902
|
+
let n = new URLSearchParams();
|
|
903
|
+
t > 0 && n.set("start", String(Math.floor(t)));
|
|
904
|
+
let r = n.toString();
|
|
905
|
+
return `https://www.youtube-nocookie.com/embed/${e}${r ? `?${r}` : ""}`;
|
|
906
|
+
}
|
|
907
|
+
function Ke(e) {
|
|
908
|
+
return `https://i.ytimg.com/vi/${e}/hqdefault.jpg`;
|
|
909
|
+
}
|
|
910
|
+
export { I as A, re as B, _ as C, g as D, p as E, u as F, te as G, o as H, l as I, a as J, c as K, d as L, P as M, A as N, v as O, j as P, ie as R, y as S, h as T, ne as U, ae as V, s as W, z as _, Ue as a, R as b, Q as c, ze as d, Y as f, U as g, q as h, Be as i, F as j, O as k, Ie as l, J as m, Ge as n, He as o, Re as p, ee as q, Ke as r, X as s, We as t, Z as u, B as v, b as w, m as x, V as y, f as z };
|