@zealsolutions/zeal-ui 1.0.0-alpha.376 → 1.0.0-alpha.378

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.
@@ -1,7 +1,7 @@
1
- import { n as D, c as F } from "../../legacyLinks-B6y5jFPf.js";
2
- import { computed as B, openBlock as f, createElementBlock as b, createElementVNode as v, toDisplayString as x, createCommentVNode as S, Fragment as V, renderList as T, normalizeClass as U, createStaticVNode as j } from "vue";
3
- import { _ as H } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
4
- const W = (e) => e === ">", A = (e) => e === "<", P = (e) => /^\s+$/.test(e), E = (e) => /^\s*<[^>]+>\s*$/.test(e), $ = (e) => !E(e);
1
+ import { o as D, n as F, c as B } from "../../legacyLinks-DeEGprFa.js";
2
+ import { computed as V, openBlock as f, createElementBlock as b, createElementVNode as v, toDisplayString as x, createCommentVNode as S, Fragment as T, renderList as U, normalizeClass as j, createStaticVNode as H } from "vue";
3
+ import { _ as W } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
4
+ const $ = (e) => e === ">", A = (e) => e === "<", P = (e) => /^\s+$/.test(e), E = (e) => /^\s*<[^>]+>\s*$/.test(e), z = (e) => !E(e);
5
5
  class O {
6
6
  constructor(t, i, n) {
7
7
  this.start_in_before = t, this.start_in_after = i, this.length = n, this.end_in_before = t + n - 1, this.end_in_after = i + n - 1;
@@ -14,7 +14,7 @@ function N(e) {
14
14
  const l = e[r];
15
15
  switch (t) {
16
16
  case "tag":
17
- W(l) ? (i += ">", n.push(i), i = "", t = P(l) ? "whitespace" : "char") : i += l;
17
+ $(l) ? (i += ">", n.push(i), i = "", t = P(l) ? "whitespace" : "char") : i += l;
18
18
  break;
19
19
  case "char":
20
20
  A(l) ? (i && n.push(i), i = "<", t = "tag") : /\s/.test(l) ? (i && n.push(i), i = l, t = "whitespace") : /[\w#@]+/i.test(l) ? i += l : (i && n.push(i), i = l);
@@ -28,7 +28,7 @@ function N(e) {
28
28
  }
29
29
  return i && n.push(i), n;
30
30
  }
31
- function z(e, t, i, n, r, a, l) {
31
+ function Q(e, t, i, n, r, a, l) {
32
32
  let u = n, s = a, d = 0, c = {}, p;
33
33
  for (let o = n; o < r; o++) {
34
34
  const m = {}, g = e[o], y = i[g];
@@ -47,10 +47,10 @@ function z(e, t, i, n, r, a, l) {
47
47
  return d !== 0 && (p = new O(u, s, d)), p;
48
48
  }
49
49
  function C(e, t, i, n, r, a, l, u) {
50
- const s = z(e, t, i, n, r, a, l);
50
+ const s = Q(e, t, i, n, r, a, l);
51
51
  return s != null && (n < s.start_in_before && a < s.start_in_after && C(e, t, i, n, s.start_in_before, a, s.start_in_after, u), u.push(s), s.end_in_before <= r && s.end_in_after <= l && C(e, t, i, s.end_in_before + 1, r, s.end_in_after + 1, l, u)), u;
52
52
  }
53
- function Q(e) {
53
+ function Y(e) {
54
54
  if (e.find_these == null)
55
55
  throw new Error("params must have find_these key");
56
56
  if (e.in_these == null)
@@ -65,11 +65,11 @@ function Q(e) {
65
65
  }
66
66
  return t;
67
67
  }
68
- function Y(e, t) {
69
- const i = [], n = Q({ find_these: e, in_these: t });
68
+ function J(e, t) {
69
+ const i = [], n = Y({ find_these: e, in_these: t });
70
70
  return C(e, t, n, 0, e.length, 0, t.length, i);
71
71
  }
72
- function J(e, t) {
72
+ function K(e, t) {
73
73
  if (e == null)
74
74
  throw new Error("before_tokens?");
75
75
  if (t == null)
@@ -80,7 +80,7 @@ function J(e, t) {
80
80
  "true,false": "insert",
81
81
  "false,true": "delete",
82
82
  "true,true": "none"
83
- }, l = Y(e, t);
83
+ }, l = J(e, t);
84
84
  l.push(new O(e.length, t.length, 0));
85
85
  for (let c = 0, p = l.length; c < p; c++) {
86
86
  const o = l[c], m = i === o.start_in_before, g = n === o.start_in_after, y = a[[m, g].toString()];
@@ -107,7 +107,7 @@ function J(e, t) {
107
107
  }
108
108
  return u;
109
109
  }
110
- function G(e, t, i) {
110
+ function I(e, t, i) {
111
111
  t = t.slice(e, +t.length + 1 || 9e9);
112
112
  let n;
113
113
  for (let r = 0, a = t.length; r < a; r++) {
@@ -117,25 +117,25 @@ function G(e, t, i) {
117
117
  }
118
118
  return n != null ? t.slice(0, +n + 1 || 9e9) : [];
119
119
  }
120
- function I(e, t) {
120
+ function G(e, t) {
121
121
  let i = "", n = 0;
122
122
  const r = t.length;
123
123
  for (; !(n >= r); ) {
124
- const a = G(n, t, $);
124
+ const a = I(n, t, z);
125
125
  if (n += a.length, a.length !== 0 && (i += "<" + e + ">" + a.join("") + "</" + e + ">"), n >= r)
126
126
  break;
127
- const l = G(n, t, E);
127
+ const l = I(n, t, E);
128
128
  n += l.length, i += l.join("");
129
129
  }
130
130
  return i;
131
131
  }
132
132
  const _ = {
133
133
  equal: (e, t) => t.slice(e.start_in_before, +e.end_in_before + 1 || 9e9).join(""),
134
- insert: (e, t, i) => I("ins", i.slice(e.start_in_after, +e.end_in_after + 1 || 9e9)),
135
- delete: (e, t) => I("del", t.slice(e.start_in_before, +e.end_in_before + 1 || 9e9))
134
+ insert: (e, t, i) => G("ins", i.slice(e.start_in_after, +e.end_in_after + 1 || 9e9)),
135
+ delete: (e, t) => G("del", t.slice(e.start_in_before, +e.end_in_before + 1 || 9e9))
136
136
  };
137
137
  _.replace = (e, t, i) => _.delete(e, t, i) + _.insert(e, t, i);
138
- function K(e, t, i) {
138
+ function X(e, t, i) {
139
139
  let n = "";
140
140
  for (let r = 0, a = i.length; r < a; r++) {
141
141
  const l = i[r];
@@ -143,13 +143,13 @@ function K(e, t, i) {
143
143
  }
144
144
  return n;
145
145
  }
146
- function X(e, t) {
146
+ function Z(e, t) {
147
147
  if (e === t)
148
148
  return e;
149
- const i = N(e ?? ""), n = N(t ?? ""), r = J(i, n);
150
- return K(i, n, r);
149
+ const i = N(e ?? ""), n = N(t ?? ""), r = K(i, n);
150
+ return X(i, n, r);
151
151
  }
152
- const Z = {
152
+ const ee = {
153
153
  sop: {
154
154
  title: (e) => [e.SOPCode, e.Name].filter(Boolean).join(" — "),
155
155
  fields: [
@@ -346,9 +346,9 @@ function M(e) {
346
346
  const t = String(e).trim().toLowerCase();
347
347
  return t === "true" || t === "1" || t === "yes" ? "Yes" : t === "false" || t === "0" || t === "no" ? "No" : String(e);
348
348
  }
349
- const L = (e, t) => e.rich ? D(F(t)) : t;
350
- function pe(e, t, i = {}, n = null) {
351
- const r = Z[e];
349
+ const L = (e, t) => e.rich ? D(F(B(t))) : t;
350
+ function ke(e, t, i = {}, n = null) {
351
+ const r = ee[e];
352
352
  if (!r || !t)
353
353
  return { title: "", sections: [] };
354
354
  const a = { ...t, ...i }, l = n ? { ...n, ...i } : null, u = r.fields.map((s) => {
@@ -358,7 +358,7 @@ function pe(e, t, i = {}, n = null) {
358
358
  const c = s.bool ? M(l[s.key]) : L(s, l[s.key]);
359
359
  return !w(d) && !w(c) ? null : {
360
360
  label: s.label,
361
- value: X(String(d ?? ""), String(c ?? "")),
361
+ value: Z(String(d ?? ""), String(c ?? "")),
362
362
  rich: !!s.rich,
363
363
  // original field richness — the modal uses it to pre-wrap plain diffs
364
364
  diff: !0
@@ -366,25 +366,25 @@ function pe(e, t, i = {}, n = null) {
366
366
  }).filter(Boolean);
367
367
  return { title: r.title(n || t), sections: u };
368
368
  }
369
- const ee = { class: "flex flex-col h-full overflow-hidden" }, te = { class: "text-style-sub-header font-medium text-app-950 leading-[1.3]" }, ie = {
369
+ const te = { class: "flex flex-col h-full overflow-hidden" }, ie = { class: "text-style-sub-header font-medium text-app-950 leading-[1.3]" }, ne = {
370
370
  key: 0,
371
371
  "data-testid": "preview-diff-legend",
372
372
  class: "border-b-[1px] border-steel-300 dark:border-line px-6 py-[10px] flex items-center gap-[16px] text-[12px] text-[#697277] dark:text-content-muted shrink-0"
373
- }, ne = /* @__PURE__ */ j('<span class="font-semibold" data-v-6cebbfea>Unpublished draft changes</span><span class="flex items-center gap-[5px]" data-v-6cebbfea><span class="inline-block w-[14px] h-[10px] rounded-[2px]" style="background-color:#d4fcbc;" data-v-6cebbfea></span>Added</span><span class="flex items-center gap-[5px]" data-v-6cebbfea><span class="inline-block w-[14px] h-[10px] rounded-[2px]" style="background-color:#fbb6c2;" data-v-6cebbfea></span>Removed</span>', 3), re = {
373
+ }, re = /* @__PURE__ */ H('<span class="font-semibold" data-v-6cebbfea>Unpublished draft changes</span><span class="flex items-center gap-[5px]" data-v-6cebbfea><span class="inline-block w-[14px] h-[10px] rounded-[2px]" style="background-color:#d4fcbc;" data-v-6cebbfea></span>Added</span><span class="flex items-center gap-[5px]" data-v-6cebbfea><span class="inline-block w-[14px] h-[10px] rounded-[2px]" style="background-color:#fbb6c2;" data-v-6cebbfea></span>Removed</span>', 3), le = {
374
374
  key: 0,
375
375
  "data-testid": "preview-diff-loading",
376
376
  class: "italic"
377
- }, le = { class: "flex-1 min-h-0 overflow-y-auto px-6 py-5" }, ae = {
377
+ }, ae = { class: "flex-1 min-h-0 overflow-y-auto px-6 py-5" }, se = {
378
378
  key: 0,
379
379
  "data-testid": "preview-empty",
380
380
  class: "text-[14px] text-[#697277] dark:text-content-muted"
381
- }, se = {
381
+ }, oe = {
382
382
  key: 1,
383
383
  class: "flex flex-col gap-6"
384
- }, oe = { class: "font-semibold text-[13px] text-[#326d68] dark:text-proclusteal-950 leading-[1.2] mb-[6px]" }, ce = ["innerHTML"], ue = ["innerHTML"], de = {
384
+ }, ce = { class: "font-semibold text-[13px] text-[#326d68] dark:text-proclusteal-950 leading-[1.2] mb-[6px]" }, ue = ["innerHTML"], de = ["innerHTML"], fe = {
385
385
  key: 2,
386
386
  class: "text-[15px] text-black-950 dark:text-content leading-[1.5] whitespace-pre-wrap"
387
- }, fe = {
387
+ }, be = {
388
388
  __name: "SopCompare",
389
389
  props: {
390
390
  title: { type: String, default: "" },
@@ -392,38 +392,38 @@ const ee = { class: "flex flex-col h-full overflow-hidden" }, te = { class: "tex
392
392
  loading: { type: Boolean, default: !1 }
393
393
  },
394
394
  setup(e) {
395
- const t = e, i = B(() => t.sections.some((n) => n.diff));
396
- return (n, r) => (f(), b("div", ee, [
397
- v("p", te, x(e.title), 1),
398
- i.value || e.loading ? (f(), b("div", ie, [
399
- ne,
400
- e.loading ? (f(), b("span", re, "Loading changes…")) : S("", !0)
395
+ const t = e, i = V(() => t.sections.some((n) => n.diff));
396
+ return (n, r) => (f(), b("div", te, [
397
+ v("p", ie, x(e.title), 1),
398
+ i.value || e.loading ? (f(), b("div", ne, [
399
+ re,
400
+ e.loading ? (f(), b("span", le, "Loading changes…")) : S("", !0)
401
401
  ])) : S("", !0),
402
- v("div", le, [
403
- e.sections.length ? (f(), b("div", se, [
404
- (f(!0), b(V, null, T(e.sections, (a, l) => (f(), b("section", {
402
+ v("div", ae, [
403
+ e.sections.length ? (f(), b("div", oe, [
404
+ (f(!0), b(T, null, U(e.sections, (a, l) => (f(), b("section", {
405
405
  key: l,
406
406
  "data-testid": "preview-section"
407
407
  }, [
408
- v("p", oe, x(a.label), 1),
408
+ v("p", ce, x(a.label), 1),
409
409
  a.diff ? (f(), b("div", {
410
410
  key: 0,
411
- class: U(["preview-content text-[15px] text-black-950 dark:text-content leading-[1.5]", { "whitespace-pre-wrap": !a.rich }]),
411
+ class: j(["preview-content text-[15px] text-black-950 dark:text-content leading-[1.5]", { "whitespace-pre-wrap": !a.rich }]),
412
412
  innerHTML: a.value
413
- }, null, 10, ce)) : a.rich ? (f(), b("div", {
413
+ }, null, 10, ue)) : a.rich ? (f(), b("div", {
414
414
  key: 1,
415
415
  class: "preview-content text-[15px] text-black-950 dark:text-content leading-[1.5]",
416
416
  innerHTML: a.value
417
- }, null, 8, ue)) : (f(), b("p", de, x(a.value), 1))
417
+ }, null, 8, de)) : (f(), b("p", fe, x(a.value), 1))
418
418
  ]))), 128))
419
- ])) : (f(), b("p", ae, " There is no content to preview yet. "))
419
+ ])) : (f(), b("p", se, " There is no content to preview yet. "))
420
420
  ])
421
421
  ]));
422
422
  }
423
- }, ke = /* @__PURE__ */ H(fe, [["__scopeId", "data-v-6cebbfea"]]);
423
+ }, me = /* @__PURE__ */ W(be, [["__scopeId", "data-v-6cebbfea"]]);
424
424
  export {
425
- ke as SopCompare,
426
- pe as buildPreview,
425
+ me as SopCompare,
426
+ ke as buildPreview,
427
427
  w as hasContent,
428
- X as htmlDiff
428
+ Z as htmlDiff
429
429
  };
@@ -8,7 +8,7 @@ import { a as _r, _ as jr } from "../../SecondaryButton-At_I-S4K.js";
8
8
  import { _ as Ed } from "../../BaseModal-BriJhnSM.js";
9
9
  import { _ as wi } from "../../FormField-CrpT1GTF.js";
10
10
  import { _ as hs } from "../../InputField-D6bS7qJm.js";
11
- import { b as Lp, c as Pp } from "../../legacyLinks-B6y5jFPf.js";
11
+ import { b as Lp, c as Pp } from "../../legacyLinks-DeEGprFa.js";
12
12
  import qs from "../../ImageIcon-jkYGKPiB.js";
13
13
  import Ca from "../../ListTreeIcon-DMhYL_id.js";
14
14
  import Ks from "../../ListRadioIcon-gmE_fzgA.js";
@@ -0,0 +1,205 @@
1
+ const p = {
2
+ black: [0, 0, 0],
3
+ white: [255, 255, 255]
4
+ };
5
+ function E(t) {
6
+ if (!t)
7
+ return null;
8
+ const r = String(t).trim().toLowerCase();
9
+ if (p[r])
10
+ return p[r];
11
+ let e = r.match(/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)(?:\s*[,/]\s*([\d.]+)(%?))?\s*\)$/);
12
+ if (e)
13
+ return e[4] !== void 0 && parseFloat(e[4]) === 0 ? null : [Number(e[1]), Number(e[2]), Number(e[3])];
14
+ if (e = r.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/), e) {
15
+ const n = e[1].length === 3 ? e[1].replace(/./g, (o) => o + o) : e[1];
16
+ return [0, 2, 4].map((o) => parseInt(n.slice(o, o + 2), 16));
17
+ }
18
+ return null;
19
+ }
20
+ function S([t, r, e]) {
21
+ const n = (o) => {
22
+ const s = o / 255;
23
+ return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);
24
+ };
25
+ return 0.2126 * n(t) + 0.7152 * n(r) + 0.0722 * n(e);
26
+ }
27
+ const L = (t) => Math.max(...t) - Math.min(...t);
28
+ function d(t) {
29
+ const r = E(t);
30
+ return r ? L(r) <= 24 && S(r) < 0.06 || Math.max(...r) <= 40 : !1;
31
+ }
32
+ function g(t) {
33
+ const r = E(t);
34
+ return r ? L(r) <= 24 && S(r) > 0.85 : !1;
35
+ }
36
+ function k(t) {
37
+ const r = t.style && t.style.backgroundColor;
38
+ return r && r !== "transparent" && r !== "initial" && r !== "inherit" ? !0 : t.hasAttribute && t.hasAttribute("bgcolor");
39
+ }
40
+ function y(t) {
41
+ t.getAttribute("style") !== null && !t.getAttribute("style").trim() && t.removeAttribute("style");
42
+ }
43
+ function w(t, { backgroundsRendered: r }) {
44
+ t.querySelectorAll("[style], [bgcolor]").forEach((e) => {
45
+ e.style && g(e.style.backgroundColor) && (e.style.removeProperty("background-color"), y(e)), e.hasAttribute("bgcolor") && g(e.getAttribute("bgcolor")) && e.removeAttribute("bgcolor");
46
+ }), t.querySelectorAll("[style], font[color]").forEach((e) => {
47
+ if (r) {
48
+ for (let n = e; n && n !== t; n = n.parentElement)
49
+ if (k(n))
50
+ return;
51
+ }
52
+ e.style && d(e.style.color) && (e.style.removeProperty("color"), y(e)), e.tagName === "FONT" && d(e.getAttribute("color")) && e.removeAttribute("color");
53
+ });
54
+ }
55
+ const b = (t) => !t.querySelector("img") && !t.textContent.replace(/[\s ]/g, ""), I = "p, h1, h2, h3, h4, h5, h6";
56
+ function N(t) {
57
+ const r = t.ownerDocument;
58
+ O(t), Array.from(t.querySelectorAll("img")).forEach((e) => {
59
+ const n = e.closest("a[href]");
60
+ n && t.contains(n) && !e.hasAttribute("image-link") && e.setAttribute("image-link", n.getAttribute("href"));
61
+ const o = e.parentElement && e.parentElement.closest(I);
62
+ if (!o || !t.contains(o))
63
+ return;
64
+ const s = (o.style && o.style.textAlign || "").toLowerCase();
65
+ s && !e.hasAttribute("text-align") && e.setAttribute("text-align", s === "center" ? "center" : s === "right" || s === "end" ? "end" : "left");
66
+ const i = r.createRange();
67
+ i.setStart(o, 0), i.setEndBefore(e);
68
+ const a = o.cloneNode(!1);
69
+ a.appendChild(i.extractContents()), i.setStartAfter(e), i.setEnd(o, o.childNodes.length);
70
+ const c = o.cloneNode(!1);
71
+ c.appendChild(i.extractContents());
72
+ const f = o.parentNode, C = f.tagName === "LI" && f.firstElementChild === o;
73
+ (!b(a) || C) && f.insertBefore(a, o), f.insertBefore(e, o), b(c) || f.insertBefore(c, o), o.remove();
74
+ });
75
+ }
76
+ const h = /* @__PURE__ */ new Set(["P", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "DIV", "TABLE", "FIGURE", "BLOCKQUOTE", "PRE", "HR"]);
77
+ function O(t) {
78
+ const r = t.ownerDocument;
79
+ t.querySelectorAll("li").forEach((e) => {
80
+ if (!Array.from(e.querySelectorAll("img")).some((s) => {
81
+ for (let i = s.parentElement; i && i !== e; i = i.parentElement)
82
+ if (h.has(i.tagName) || i.tagName === "LI")
83
+ return !1;
84
+ return !0;
85
+ }))
86
+ return;
87
+ let o = null;
88
+ Array.from(e.childNodes).forEach((s) => {
89
+ if (s.nodeType === 1 && h.has(s.tagName)) {
90
+ o = null;
91
+ return;
92
+ }
93
+ o || (o = r.createElement("p"), e.insertBefore(o, s)), o.appendChild(s);
94
+ });
95
+ });
96
+ }
97
+ function M(t) {
98
+ const r = t.ownerDocument;
99
+ t.querySelectorAll("h3, h4, h5, h6").forEach((e) => {
100
+ const n = r.createElement("p");
101
+ for (const s of Array.from(e.attributes))
102
+ n.setAttribute(s.name, s.value);
103
+ const o = r.createElement("strong");
104
+ for (; e.firstChild; )
105
+ o.appendChild(e.firstChild);
106
+ n.appendChild(o), e.replaceWith(n);
107
+ });
108
+ }
109
+ function x(t, r) {
110
+ if (typeof t != "string" || !t || typeof DOMParser > "u")
111
+ return t;
112
+ const e = new DOMParser().parseFromString(`<body>${t}</body>`, "text/html").body;
113
+ return r(e), e.innerHTML;
114
+ }
115
+ function _(t) {
116
+ return typeof t != "string" || !/color/i.test(t) ? t : x(t, (r) => w(r, { backgroundsRendered: !0 }));
117
+ }
118
+ function F(t) {
119
+ return typeof t != "string" || !/<(img|h[3-6])\b|color/i.test(t) ? t : x(t, (r) => {
120
+ N(r), M(r), w(r, { backgroundsRendered: !1 });
121
+ });
122
+ }
123
+ const m = "/sop-front/Vue/dist/sop/by-id/", T = "/EDS/Vue/dist/eds/", l = (t) => t != null && /^\d+$/.test(t), u = (t, r, e) => (n) => {
124
+ const o = n("sopid");
125
+ if (!l(o))
126
+ return null;
127
+ const s = r && n(r);
128
+ return l(s) ? `${m}${o}/${t}/${s}` : m + o + (e ? "/" + e : "");
129
+ }, A = (t) => l(t("id")) ? T + t("id") : null, H = {
130
+ "/eds/eds-item.aspx": A,
131
+ "/sop/eds-item.aspx": A,
132
+ "/sop/overview.aspx": u(),
133
+ "/sop/overview-full.aspx": u("overview", "sopactivityid"),
134
+ "/sop/overview-category.aspx": u("overview", "sopactivityid"),
135
+ "/sop/appendix.aspx": u("appendix", "sopappendixid", "list"),
136
+ "/sop/grp.aspx": u("grp", "sopgrpid", "grp"),
137
+ "/sop/grp-check.aspx": u("grp", "sopgrpid", "grp")
138
+ }, P = /(^|\.)pro-clus\.co\.uk$/i;
139
+ function D(t) {
140
+ const r = (t || []).map((e) => e.toLowerCase());
141
+ return typeof location < "u" && location.host && r.push(location.host.toLowerCase()), r;
142
+ }
143
+ function R(t, r) {
144
+ const e = t.match(/^(?:https?:)?\/\/([^/?#]+)(.*)$/i);
145
+ if (e) {
146
+ const n = e[1].toLowerCase();
147
+ return !P.test(n) && !r.includes(n) ? null : e[2].startsWith("/") ? e[2] : "/" + e[2];
148
+ }
149
+ return /^(\.\.\/)+/.test(t) ? "/" + t.replace(/^(\.\.\/)+/, "") : t.startsWith("/") ? t : null;
150
+ }
151
+ function $(t, r) {
152
+ for (const e of t.split(/&(?:amp;)?/)) {
153
+ const n = e.indexOf("=");
154
+ if (n > 0 && e.slice(0, n).toLowerCase() === r)
155
+ return e.slice(n + 1);
156
+ }
157
+ return null;
158
+ }
159
+ function v(t, { hosts: r } = {}) {
160
+ if (typeof t != "string" || !t)
161
+ return t;
162
+ const e = R(t.trim(), D(r));
163
+ if (e === null)
164
+ return t;
165
+ const n = e.search(/[?#]/), o = n < 0 ? e : e.slice(0, n), s = H[o.toLowerCase()];
166
+ if (s) {
167
+ const i = e.includes("?") ? e.slice(e.indexOf("?") + 1).split("#")[0] : "", a = s((c) => $(i, c));
168
+ if (a)
169
+ return a;
170
+ }
171
+ return e;
172
+ }
173
+ const B = [["a[href]", "href"], ["img[src]", "src"], ["img[image-link]", "image-link"]];
174
+ function G(t, r) {
175
+ if (typeof t != "string" || !t || typeof DOMParser > "u" || !/\.\.\/|\.aspx|\/\//i.test(t))
176
+ return t;
177
+ const e = new DOMParser().parseFromString(`<body>${t}</body>`, "text/html").body;
178
+ let n = !1;
179
+ for (const [o, s] of B)
180
+ e.querySelectorAll(o).forEach((i) => {
181
+ const a = i.getAttribute(s), c = v(a, r);
182
+ c !== a && (i.setAttribute(s, c), n = !0);
183
+ });
184
+ return n ? e.innerHTML : t;
185
+ }
186
+ const q = /^\s*(#|mailto:|tel:|sms:)/i;
187
+ function U(t) {
188
+ if (typeof t != "string" || !/<a\b/i.test(t) || typeof DOMParser > "u")
189
+ return t;
190
+ const r = new DOMParser().parseFromString(`<body>${t}</body>`, "text/html").body;
191
+ let e = !1;
192
+ return r.querySelectorAll("a[href]").forEach((n) => {
193
+ q.test(n.getAttribute("href")) || (n.getAttribute("target") !== "_blank" && (n.setAttribute("target", "_blank"), e = !0), n.getAttribute("rel") !== "noopener noreferrer" && (n.setAttribute("rel", "noopener noreferrer"), e = !0));
194
+ }), e ? r.innerHTML : t;
195
+ }
196
+ export {
197
+ g as a,
198
+ F as b,
199
+ G as c,
200
+ d as i,
201
+ _ as n,
202
+ U as o,
203
+ E as p,
204
+ v as r
205
+ };
@@ -1,5 +1,5 @@
1
- import { g as C, a as D, i as L } from "../axiosHelpers-BGXP7XLq.js";
2
- import { i as k, a as x, b as I, n as M, p as T, c as _, r as b } from "../legacyLinks-B6y5jFPf.js";
1
+ import { g as y, a as A, i as C } from "../axiosHelpers-BGXP7XLq.js";
2
+ import { i as I, a as R, b as T, n as b, o as x, p as M, c as _, r as H } from "../legacyLinks-DeEGprFa.js";
3
3
  const l = 16, p = 12, u = 344, m = 180;
4
4
  function f(o, t, e = {}) {
5
5
  const {
@@ -22,15 +22,16 @@ export {
22
22
  p as CARD_GAP,
23
23
  l as CARD_MARGIN,
24
24
  u as CARD_WIDTH,
25
- C as getRequest,
26
- D as getSlotType,
27
- k as isNeutralDarkInk,
28
- x as isNeutralLightBackground,
29
- L as isValidSlotType,
30
- I as normaliseLegacyEditorHtml,
31
- M as normaliseLegacyInk,
32
- T as parseColour,
25
+ y as getRequest,
26
+ A as getSlotType,
27
+ I as isNeutralDarkInk,
28
+ R as isNeutralLightBackground,
29
+ C as isValidSlotType,
30
+ T as normaliseLegacyEditorHtml,
31
+ b as normaliseLegacyInk,
32
+ x as openLinksInNewTab,
33
+ M as parseColour,
33
34
  _ as rewriteLegacyLinks,
34
- b as rewriteLegacyUrl,
35
+ H as rewriteLegacyUrl,
35
36
  f as tourCardPosition
36
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zealsolutions/zeal-ui",
3
- "version": "1.0.0-alpha.376",
3
+ "version": "1.0.0-alpha.378",
4
4
  "description": "UI library for Zeal Solutions",
5
5
  "author": "Zeal Solutions",
6
6
  "license": "ISC",
@@ -1,190 +0,0 @@
1
- const l = {
2
- black: [0, 0, 0],
3
- white: [255, 255, 255]
4
- };
5
- function b(t) {
6
- if (!t)
7
- return null;
8
- const r = String(t).trim().toLowerCase();
9
- if (l[r])
10
- return l[r];
11
- let e = r.match(/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)(?:\s*[,/]\s*([\d.]+)(%?))?\s*\)$/);
12
- if (e)
13
- return e[4] !== void 0 && parseFloat(e[4]) === 0 ? null : [Number(e[1]), Number(e[2]), Number(e[3])];
14
- if (e = r.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/), e) {
15
- const o = e[1].length === 3 ? e[1].replace(/./g, (n) => n + n) : e[1];
16
- return [0, 2, 4].map((n) => parseInt(o.slice(n, n + 2), 16));
17
- }
18
- return null;
19
- }
20
- function A([t, r, e]) {
21
- const o = (n) => {
22
- const s = n / 255;
23
- return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);
24
- };
25
- return 0.2126 * o(t) + 0.7152 * o(r) + 0.0722 * o(e);
26
- }
27
- const E = (t) => Math.max(...t) - Math.min(...t);
28
- function p(t) {
29
- const r = b(t);
30
- return r ? E(r) <= 24 && A(r) < 0.06 || Math.max(...r) <= 40 : !1;
31
- }
32
- function d(t) {
33
- const r = b(t);
34
- return r ? E(r) <= 24 && A(r) > 0.85 : !1;
35
- }
36
- function C(t) {
37
- const r = t.style && t.style.backgroundColor;
38
- return r && r !== "transparent" && r !== "initial" && r !== "inherit" ? !0 : t.hasAttribute && t.hasAttribute("bgcolor");
39
- }
40
- function g(t) {
41
- t.getAttribute("style") !== null && !t.getAttribute("style").trim() && t.removeAttribute("style");
42
- }
43
- function L(t, { backgroundsRendered: r }) {
44
- t.querySelectorAll("[style], [bgcolor]").forEach((e) => {
45
- e.style && d(e.style.backgroundColor) && (e.style.removeProperty("background-color"), g(e)), e.hasAttribute("bgcolor") && d(e.getAttribute("bgcolor")) && e.removeAttribute("bgcolor");
46
- }), t.querySelectorAll("[style], font[color]").forEach((e) => {
47
- if (r) {
48
- for (let o = e; o && o !== t; o = o.parentElement)
49
- if (C(o))
50
- return;
51
- }
52
- e.style && p(e.style.color) && (e.style.removeProperty("color"), g(e)), e.tagName === "FONT" && p(e.getAttribute("color")) && e.removeAttribute("color");
53
- });
54
- }
55
- const y = (t) => !t.querySelector("img") && !t.textContent.replace(/[\s ]/g, ""), w = "p, h1, h2, h3, h4, h5, h6";
56
- function k(t) {
57
- const r = t.ownerDocument;
58
- N(t), Array.from(t.querySelectorAll("img")).forEach((e) => {
59
- const o = e.closest("a[href]");
60
- o && t.contains(o) && !e.hasAttribute("image-link") && e.setAttribute("image-link", o.getAttribute("href"));
61
- const n = e.parentElement && e.parentElement.closest(w);
62
- if (!n || !t.contains(n))
63
- return;
64
- const s = (n.style && n.style.textAlign || "").toLowerCase();
65
- s && !e.hasAttribute("text-align") && e.setAttribute("text-align", s === "center" ? "center" : s === "right" || s === "end" ? "end" : "left");
66
- const i = r.createRange();
67
- i.setStart(n, 0), i.setEndBefore(e);
68
- const a = n.cloneNode(!1);
69
- a.appendChild(i.extractContents()), i.setStartAfter(e), i.setEnd(n, n.childNodes.length);
70
- const c = n.cloneNode(!1);
71
- c.appendChild(i.extractContents());
72
- const f = n.parentNode, x = f.tagName === "LI" && f.firstElementChild === n;
73
- (!y(a) || x) && f.insertBefore(a, n), f.insertBefore(e, n), y(c) || f.insertBefore(c, n), n.remove();
74
- });
75
- }
76
- const h = /* @__PURE__ */ new Set(["P", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "DIV", "TABLE", "FIGURE", "BLOCKQUOTE", "PRE", "HR"]);
77
- function N(t) {
78
- const r = t.ownerDocument;
79
- t.querySelectorAll("li").forEach((e) => {
80
- if (!Array.from(e.querySelectorAll("img")).some((s) => {
81
- for (let i = s.parentElement; i && i !== e; i = i.parentElement)
82
- if (h.has(i.tagName) || i.tagName === "LI")
83
- return !1;
84
- return !0;
85
- }))
86
- return;
87
- let n = null;
88
- Array.from(e.childNodes).forEach((s) => {
89
- if (s.nodeType === 1 && h.has(s.tagName)) {
90
- n = null;
91
- return;
92
- }
93
- n || (n = r.createElement("p"), e.insertBefore(n, s)), n.appendChild(s);
94
- });
95
- });
96
- }
97
- function I(t) {
98
- const r = t.ownerDocument;
99
- t.querySelectorAll("h3, h4, h5, h6").forEach((e) => {
100
- const o = r.createElement("p");
101
- for (const s of Array.from(e.attributes))
102
- o.setAttribute(s.name, s.value);
103
- const n = r.createElement("strong");
104
- for (; e.firstChild; )
105
- n.appendChild(e.firstChild);
106
- o.appendChild(n), e.replaceWith(o);
107
- });
108
- }
109
- function S(t, r) {
110
- if (typeof t != "string" || !t || typeof DOMParser > "u")
111
- return t;
112
- const e = new DOMParser().parseFromString(`<body>${t}</body>`, "text/html").body;
113
- return r(e), e.innerHTML;
114
- }
115
- function B(t) {
116
- return typeof t != "string" || !/color/i.test(t) ? t : S(t, (r) => L(r, { backgroundsRendered: !0 }));
117
- }
118
- function P(t) {
119
- return typeof t != "string" || !/<(img|h[3-6])\b|color/i.test(t) ? t : S(t, (r) => {
120
- k(r), I(r), L(r, { backgroundsRendered: !1 });
121
- });
122
- }
123
- const u = "/sop-front/Vue/dist/sop/by-id/", m = "/EDS/Vue/dist/eds/", O = {
124
- "/eds/eds-item.aspx": ["id", (t) => m + t],
125
- "/sop/eds-item.aspx": ["id", (t) => m + t],
126
- "/sop/overview.aspx": ["sopid", (t) => u + t],
127
- // The activity / category the old page focused on has no SPA deep link yet.
128
- "/sop/overview-full.aspx": ["sopid", (t) => u + t],
129
- "/sop/overview-category.aspx": ["sopid", (t) => u + t],
130
- // The SPA's appendix route is keyed by category/SOP slugs, not ids: open the SOP's list.
131
- "/sop/appendix.aspx": ["sopid", (t) => u + t + "/list"],
132
- "/sop/grp.aspx": ["sopid", (t) => u + t + "/grp"],
133
- "/sop/grp-check.aspx": ["sopid", (t) => u + t + "/grp"]
134
- }, H = /(^|\.)pro-clus\.co\.uk$/i;
135
- function M(t) {
136
- const r = (t || []).map((e) => e.toLowerCase());
137
- return typeof location < "u" && location.host && r.push(location.host.toLowerCase()), r;
138
- }
139
- function T(t, r) {
140
- const e = t.match(/^(?:https?:)?\/\/([^/?#]+)(.*)$/i);
141
- if (e) {
142
- const o = e[1].toLowerCase();
143
- return !H.test(o) && !r.includes(o) ? null : e[2].startsWith("/") ? e[2] : "/" + e[2];
144
- }
145
- return /^(\.\.\/)+/.test(t) ? "/" + t.replace(/^(\.\.\/)+/, "") : t.startsWith("/") ? t : null;
146
- }
147
- function D(t, r) {
148
- for (const e of t.split(/&(?:amp;)?/)) {
149
- const o = e.indexOf("=");
150
- if (o > 0 && e.slice(0, o).toLowerCase() === r)
151
- return e.slice(o + 1);
152
- }
153
- return null;
154
- }
155
- function R(t, { hosts: r } = {}) {
156
- if (typeof t != "string" || !t)
157
- return t;
158
- const e = T(t.trim(), M(r));
159
- if (e === null)
160
- return t;
161
- const o = e.search(/[?#]/), n = o < 0 ? e : e.slice(0, o), s = O[n.toLowerCase()];
162
- if (s) {
163
- const i = e.includes("?") ? e.slice(e.indexOf("?") + 1).split("#")[0] : "", a = D(i, s[0]);
164
- if (a && /^\d+$/.test(a))
165
- return s[1](a);
166
- }
167
- return e;
168
- }
169
- const q = [["a[href]", "href"], ["img[src]", "src"], ["img[image-link]", "image-link"]];
170
- function F(t, r) {
171
- if (typeof t != "string" || !t || typeof DOMParser > "u" || !/\.\.\/|\.aspx|\/\//i.test(t))
172
- return t;
173
- const e = new DOMParser().parseFromString(`<body>${t}</body>`, "text/html").body;
174
- let o = !1;
175
- for (const [n, s] of q)
176
- e.querySelectorAll(n).forEach((i) => {
177
- const a = i.getAttribute(s), c = R(a, r);
178
- c !== a && (i.setAttribute(s, c), o = !0);
179
- });
180
- return o ? e.innerHTML : t;
181
- }
182
- export {
183
- d as a,
184
- P as b,
185
- F as c,
186
- p as i,
187
- B as n,
188
- b as p,
189
- R as r
190
- };