@redapollos/storm-form 0.2.2 → 0.2.3

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 CHANGED
@@ -29,12 +29,11 @@ The package uses this default API URL if no override is provided:
29
29
  You can override it from the consuming app using one of these environment variables:
30
30
 
31
31
  - `STORM_FORM_API_URL`
32
-
33
- This is the only runtime env var checked from consuming apps.
32
+ - `NEXT_PUBLIC_STORM_FORM_API_URL`
34
33
 
35
34
  Resolution order is:
36
35
 
37
- 1. Runtime env var from the consuming app
36
+ 1. Runtime env var from the consuming app (`STORM_FORM_API_URL`, then `NEXT_PUBLIC_STORM_FORM_API_URL`)
38
37
  2. Build-time `VITE_WEBAPI_URL` from this package build
39
38
  3. Default URL above
40
39
 
@@ -6,7 +6,8 @@ import G from "axios";
6
6
  import de from "dayjs";
7
7
  const xt = {}, _t = "https://storm-api.azurewebsites.net";
8
8
  function Tt() {
9
- return (typeof globalThis < "u" ? globalThis.process?.env : void 0)?.STORM_FORM_API_URL;
9
+ const e = typeof globalThis < "u" ? globalThis.process?.env : void 0;
10
+ return e?.STORM_FORM_API_URL || e?.NEXT_PUBLIC_STORM_FORM_API_URL;
10
11
  }
11
12
  function It() {
12
13
  return xt?.VITE_WEBAPI_URL;
@@ -256,11 +257,11 @@ function Ye(e) {
256
257
  } else for (n in e) e[n] && (r && (r += " "), r += n);
257
258
  return r;
258
259
  }
259
- function $t() {
260
+ function Ot() {
260
261
  for (var e, t, n = 0, r = "", a = arguments.length; n < a; n++) (e = arguments[n]) && (t = Ye(e)) && (r && (r += " "), r += t);
261
262
  return r;
262
263
  }
263
- const Ot = {
264
+ const $t = {
264
265
  aliceblue: "9ehhb",
265
266
  antiquewhite: "9sgk7",
266
267
  aqua: "1ekf",
@@ -409,7 +410,7 @@ const Ot = {
409
410
  whitesmoke: "9lhpx",
410
411
  yellow: "9zl6o",
411
412
  yellowgreen: "61fzm"
412
- }, $ = Math.round;
413
+ }, O = Math.round;
413
414
  function fe(e, t) {
414
415
  const n = e.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [], r = n.map((a) => parseFloat(a));
415
416
  for (let a = 0; a < 3; a += 1)
@@ -470,7 +471,7 @@ class ee {
470
471
  else if (a("hsv") || a("hsb"))
471
472
  this.fromHsvString(r);
472
473
  else {
473
- const s = Ot[r.toLowerCase()];
474
+ const s = $t[r.toLowerCase()];
474
475
  s && this.fromHexString(
475
476
  // Convert 36 hex to 16 hex
476
477
  parseInt(s, 36).toString(16).padStart(6, "0")
@@ -520,7 +521,7 @@ class ee {
520
521
  getHue() {
521
522
  if (typeof this._h > "u") {
522
523
  const t = this.getMax() - this.getMin();
523
- t === 0 ? this._h = 0 : this._h = $(60 * (this.r === this.getMax() ? (this.g - this.b) / t + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / t + 2 : (this.r - this.g) / t + 4));
524
+ t === 0 ? this._h = 0 : this._h = O(60 * (this.r === this.getMax() ? (this.g - this.b) / t + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / t + 2 : (this.r - this.g) / t + 4));
524
525
  }
525
526
  return this._h;
526
527
  }
@@ -590,10 +591,10 @@ class ee {
590
591
  */
591
592
  mix(t, n = 50) {
592
593
  const r = this._c(t), a = n / 100, s = (d) => (r[d] - this[d]) * a + this[d], l = {
593
- r: $(s("r")),
594
- g: $(s("g")),
595
- b: $(s("b")),
596
- a: $(s("a") * 100) / 100
594
+ r: O(s("r")),
595
+ g: O(s("g")),
596
+ b: O(s("b")),
597
+ a: O(s("a") * 100) / 100
597
598
  };
598
599
  return this._c(l);
599
600
  }
@@ -622,7 +623,7 @@ class ee {
622
623
  }, t);
623
624
  }
624
625
  onBackground(t) {
625
- const n = this._c(t), r = this.a + n.a * (1 - this.a), a = (s) => $((this[s] * this.a + n[s] * n.a * (1 - this.a)) / r);
626
+ const n = this._c(t), r = this.a + n.a * (1 - this.a), a = (s) => O((this[s] * this.a + n[s] * n.a * (1 - this.a)) / r);
626
627
  return this._c({
627
628
  r: a("r"),
628
629
  g: a("g"),
@@ -653,7 +654,7 @@ class ee {
653
654
  t += r.length === 2 ? r : "0" + r;
654
655
  const a = (this.b || 0).toString(16);
655
656
  if (t += a.length === 2 ? a : "0" + a, typeof this.a == "number" && this.a >= 0 && this.a < 1) {
656
- const s = $(this.a * 255).toString(16);
657
+ const s = O(this.a * 255).toString(16);
657
658
  t += s.length === 2 ? s : "0" + s;
658
659
  }
659
660
  return t;
@@ -669,7 +670,7 @@ class ee {
669
670
  }
670
671
  /** CSS support color pattern */
671
672
  toHslString() {
672
- const t = this.getHue(), n = $(this.getHSLSaturation() * 100), r = $(this.getLightness() * 100);
673
+ const t = this.getHue(), n = O(this.getHSLSaturation() * 100), r = O(this.getLightness() * 100);
673
674
  return this.a !== 1 ? `hsla(${t},${n}%,${r}%,${this.a})` : `hsl(${t},${n}%,${r}%)`;
674
675
  }
675
676
  /** Same as toHsb */
@@ -725,7 +726,7 @@ class ee {
725
726
  }) {
726
727
  const s = (t % 360 + 360) % 360;
727
728
  if (this._h = s, this._hsl_s = n, this._l = r, this.a = typeof a == "number" ? a : 1, n <= 0) {
728
- const p = $(r * 255);
729
+ const p = O(r * 255);
729
730
  this.r = p, this.g = p, this.b = p;
730
731
  return;
731
732
  }
@@ -733,7 +734,7 @@ class ee {
733
734
  const h = s / 60, u = (1 - Math.abs(2 * r - 1)) * n, f = u * (1 - Math.abs(h % 2 - 1));
734
735
  h >= 0 && h < 1 ? (l = u, d = f) : h >= 1 && h < 2 ? (l = f, d = u) : h >= 2 && h < 3 ? (d = u, g = f) : h >= 3 && h < 4 ? (d = f, g = u) : h >= 4 && h < 5 ? (l = f, g = u) : h >= 5 && h < 6 && (l = u, g = f);
735
736
  const S = r - u / 2;
736
- this.r = $((l + S) * 255), this.g = $((d + S) * 255), this.b = $((g + S) * 255);
737
+ this.r = O((l + S) * 255), this.g = O((d + S) * 255), this.b = O((g + S) * 255);
737
738
  }
738
739
  fromHsv({
739
740
  h: t,
@@ -743,10 +744,10 @@ class ee {
743
744
  }) {
744
745
  const s = (t % 360 + 360) % 360;
745
746
  this._h = s, this._hsv_s = n, this._v = r, this.a = typeof a == "number" ? a : 1;
746
- const l = $(r * 255);
747
+ const l = O(r * 255);
747
748
  if (this.r = l, this.g = l, this.b = l, n <= 0)
748
749
  return;
749
- const d = s / 60, g = Math.floor(d), h = d - g, u = $(r * (1 - n) * 255), f = $(r * (1 - n * h) * 255), S = $(r * (1 - n * (1 - h)) * 255);
750
+ const d = s / 60, g = Math.floor(d), h = d - g, u = O(r * (1 - n) * 255), f = O(r * (1 - n * h) * 255), S = O(r * (1 - n * (1 - h)) * 255);
750
751
  switch (g) {
751
752
  case 0:
752
753
  this.g = S, this.b = u;
@@ -789,7 +790,7 @@ class ee {
789
790
  fromRgbString(t) {
790
791
  const n = fe(t, (r, a) => (
791
792
  // Convert percentage to number. e.g. 50% -> 128
792
- a.includes("%") ? $(r / 100 * 255) : r
793
+ a.includes("%") ? O(r / 100 * 255) : r
793
794
  ));
794
795
  this.r = n[0], this.g = n[1], this.b = n[2], this.a = n[3];
795
796
  }
@@ -829,13 +830,13 @@ function qe(e, t, n) {
829
830
  let r;
830
831
  return Math.round(e.h) >= 60 && Math.round(e.h) <= 240 ? r = n ? Math.round(e.h) - ue * t : Math.round(e.h) + ue * t : r = n ? Math.round(e.h) + ue * t : Math.round(e.h) - ue * t, r < 0 ? r += 360 : r >= 360 && (r -= 360), r;
831
832
  }
832
- function $e(e, t, n) {
833
+ function Oe(e, t, n) {
833
834
  if (e.h === 0 && e.s === 0)
834
835
  return e.s;
835
836
  let r;
836
837
  return n ? r = e.s - ze * t : t === We ? r = e.s + ze : r = e.s + Dt * t, r > 1 && (r = 1), n && t === Je && r > 0.1 && (r = 0.1), r < 0.06 && (r = 0.06), Math.round(r * 100) / 100;
837
838
  }
838
- function Oe(e, t, n) {
839
+ function $e(e, t, n) {
839
840
  let r;
840
841
  return n ? r = e.v + Ft * t : r = e.v - Ht * t, r = Math.max(0, Math.min(1, r)), Math.round(r * 100) / 100;
841
842
  }
@@ -844,8 +845,8 @@ function jt(e, t = {}) {
844
845
  for (let s = Je; s > 0; s -= 1) {
845
846
  const l = new ee({
846
847
  h: qe(a, s, !0),
847
- s: $e(a, s, !0),
848
- v: Oe(a, s, !0)
848
+ s: Oe(a, s, !0),
849
+ v: $e(a, s, !0)
849
850
  });
850
851
  n.push(l);
851
852
  }
@@ -853,8 +854,8 @@ function jt(e, t = {}) {
853
854
  for (let s = 1; s <= We; s += 1) {
854
855
  const l = new ee({
855
856
  h: qe(a, s),
856
- s: $e(a, s),
857
- v: Oe(a, s)
857
+ s: Oe(a, s),
858
+ v: $e(a, s)
858
859
  });
859
860
  n.push(l);
860
861
  }
@@ -1176,7 +1177,7 @@ const le = /* @__PURE__ */ B.forwardRef((e, t) => {
1176
1177
  } = e, {
1177
1178
  prefixCls: u = "anticon",
1178
1179
  rootClassName: f
1179
- } = B.useContext(Ke), S = $t(f, u, {
1180
+ } = B.useContext(Ke), S = Ot(f, u, {
1180
1181
  [`${u}-${r.name}`]: !!r.name,
1181
1182
  [`${u}-spin`]: !!a || r.name === "loading"
1182
1183
  }, n);
@@ -1315,8 +1316,8 @@ const Ie = {
1315
1316
  timeToRead: Mn,
1316
1317
  timeDiffMinutes: zn,
1317
1318
  startEndDateTime: qn,
1318
- dateFormat: $n,
1319
- getDateFromString: On
1319
+ dateFormat: On,
1320
+ getDateFromString: $n
1320
1321
  };
1321
1322
  function Cn(e, t) {
1322
1323
  return e ? e.indexOf("?") > -1 ? `${e}&${t}` : `${e}?${t}` : "";
@@ -1361,7 +1362,7 @@ function qn(e, t = "", n = !0) {
1361
1362
  n && /* @__PURE__ */ i("br", {})
1362
1363
  ] });
1363
1364
  }
1364
- function $n(e, t = "medium", n = !1) {
1365
+ function On(e, t = "medium", n = !1) {
1365
1366
  const r = { weekday: "long", year: "numeric", month: "long", day: "numeric" }, a = { year: "numeric", month: "long", day: "numeric" }, s = { year: "numeric", month: "short", day: "numeric" }, l = { year: "numeric", month: "long", day: "numeric", hour: "numeric", minute: "numeric", timeZoneName: "short" }, d = { hour: "numeric", minute: "numeric", timeZoneName: "short" }, g = new Intl.DateTimeFormat("en", r), h = new Intl.DateTimeFormat("en", s), u = new Intl.DateTimeFormat("en", l), f = new Intl.DateTimeFormat("en", a), S = new Intl.DateTimeFormat("en", d);
1366
1367
  if (!e) return "";
1367
1368
  const p = e && typeof e == "object" ? e : Date.parse(e.replace(" ", "T"));
@@ -1374,14 +1375,14 @@ function $n(e, t = "medium", n = !1) {
1374
1375
  n && /* @__PURE__ */ i("br", {})
1375
1376
  ] });
1376
1377
  }
1377
- function On(e) {
1378
+ function $n(e) {
1378
1379
  if (!e) return null;
1379
1380
  const t = Date.parse(e.replace(" ", "T"));
1380
1381
  return Number.isNaN(t) ? null : t;
1381
1382
  }
1382
1383
  const { Search: Dn } = V;
1383
1384
  function Fn({ fileTypes: e, contentId: t, isMany: n, onSuccess: r, hideScopeFilter: a = !0, showResizer: s = !1 }) {
1384
- const [l, d] = v(!1), [g, h] = v([]), [u, f] = v([]), [S, p] = v(0), [M, N] = v([]), [c, m] = v(""), [z, C] = v("content"), [b, D] = v(a ? 1 : 0), [J, ne] = v({ id: "createdOn", desc: !0 }), [E, F] = v({ current: 1, pageSize: 20, total: 0, position: ["topRight", "bottomRight"], showSizeChanger: !0 }), [q, O] = v([]), [T, I] = v(null), [j, L] = v(null);
1385
+ const [l, d] = v(!1), [g, h] = v([]), [u, f] = v([]), [S, p] = v(0), [M, N] = v([]), [c, m] = v(""), [z, C] = v("content"), [b, D] = v(a ? 1 : 0), [J, ne] = v({ id: "createdOn", desc: !0 }), [E, F] = v({ current: 1, pageSize: 20, total: 0, position: ["topRight", "bottomRight"], showSizeChanger: !0 }), [q, $] = v([]), [T, I] = v(null), [j, L] = v(null);
1385
1386
  Y(() => {
1386
1387
  d(!1);
1387
1388
  let w = {
@@ -1406,7 +1407,7 @@ function Fn({ fileTypes: e, contentId: t, isMany: n, onSuccess: r, hideScopeFilt
1406
1407
  Z.pageSize !== w.pageSize ? (Z.pageSize = w.pageSize, Z.current = 1) : Z.current = w.current, P.field && (ce = { id: P.field, desc: P.order === "descend" }), F(Z), ne(ce), p(S + 1);
1407
1408
  }, ot = (w, y) => {
1408
1409
  let P = w.filter((ce) => g.find((Z) => Z.id === ce));
1409
- O(P);
1410
+ $(P);
1410
1411
  }, lt = (w) => {
1411
1412
  const y = { ...E };
1412
1413
  y.current = 1, F(y), N(w);
@@ -1419,7 +1420,7 @@ function Fn({ fileTypes: e, contentId: t, isMany: n, onSuccess: r, hideScopeFilt
1419
1420
  s && w.mediaType === 0 ? I(w) : r([w]);
1420
1421
  return;
1421
1422
  }
1422
- r(g.filter((y) => q.find((P) => P === y.id))), O([]);
1423
+ r(g.filter((y) => q.find((P) => P === y.id))), $([]);
1423
1424
  }
1424
1425
  }, ut = (w) => {
1425
1426
  let y = u.concat(w);
@@ -1754,8 +1755,8 @@ function Yn({ contentTypes: e, isMany: t, isEcommerce: n, onSuccess: r, showDeta
1754
1755
  r(h.filter((I) => D.find((j) => j === I.id))), J([]);
1755
1756
  }
1756
1757
  };
1757
- let O = [{ title: "Title", dataIndex: "title", sorter: !0 }];
1758
- return a && (O.push({ title: "Type", dataIndex: "contentType", sorter: !0 }), O.push({
1758
+ let $ = [{ title: "Title", dataIndex: "title", sorter: !0 }];
1759
+ return a && ($.push({ title: "Type", dataIndex: "contentType", sorter: !0 }), $.push({
1759
1760
  title: "Status",
1760
1761
  render: (T, I) => /* @__PURE__ */ x("span", { children: [
1761
1762
  I.status === 0 && /* @__PURE__ */ i(R, { color: "blue", children: "Published" }),
@@ -1799,7 +1800,7 @@ function Yn({ contentTypes: e, isMany: t, isEcommerce: n, onSuccess: r, showDeta
1799
1800
  !t && q(T);
1800
1801
  }
1801
1802
  }),
1802
- columns: O
1803
+ columns: $
1803
1804
  }
1804
1805
  )
1805
1806
  ] });
@@ -1827,16 +1828,16 @@ const Jn = ({
1827
1828
  throw Error("ReferenceInput property: slug required");
1828
1829
  !t && h && h[e] && (t = h[e]), !u && f && f[e] && (u = f[e]);
1829
1830
  const J = (F) => {
1830
- const q = F.filter((T) => !N.some((I) => T.id === I.id)), O = N.concat(q);
1831
- c(O), E(O), z(!1);
1831
+ const q = F.filter((T) => !N.some((I) => T.id === I.id)), $ = N.concat(q);
1832
+ c($), E($), z(!1);
1832
1833
  }, ne = (F) => {
1833
- var q = N.findIndex((O) => O.id === F.id);
1834
+ var q = N.findIndex(($) => $.id === F.id);
1834
1835
  if (q > -1) {
1835
- let O = [...N];
1836
- O.splice(q, 1), c(O), E(O);
1836
+ let $ = [...N];
1837
+ $.splice(q, 1), c($), E($);
1837
1838
  }
1838
1839
  }, E = (F) => {
1839
- const q = F.map((O, T) => O.id).join(",");
1840
+ const q = F.map(($, T) => $.id).join(",");
1840
1841
  a.setFieldsValue({ [e]: q }), s && s(e, q);
1841
1842
  };
1842
1843
  return Y(() => {
@@ -1,5 +1,5 @@
1
- (function(s,g){typeof exports=="object"&&typeof module<"u"?module.exports=g(require("react/jsx-runtime"),require("react"),require("antd"),require("axios"),require("dayjs")):typeof define=="function"&&define.amd?define(["react/jsx-runtime","react","antd","axios","dayjs"],g):(s=typeof globalThis<"u"?globalThis:s||self,s.StormForm=g(s.jsxRuntime,s.React,s.antd,s.axios,s.dayjs))})(this,(function(s,g,l,j,X){"use strict";function Ue(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const P=Ue(g),Ke={},Ye="https://storm-api.azurewebsites.net";function Je(){return(typeof globalThis<"u"?globalThis.process?.env:void 0)?.STORM_FORM_API_URL}function We(){return Ke?.VITE_WEBAPI_URL}function Ge(){return Je()||We()||Ye}j.defaults.baseURL=Ge(),j.defaults.timeout=1e3*60*10;const x=j.create({responseType:"json"});x.getData=(e,t)=>{const r={headers:J(t)};return new Promise((n,a)=>{j.get(e,r).then(i=>{n(i.data)}).catch(i=>{a(Y(i))})})},x.upsertData=(e,t,r,n)=>e==null||e===0||e===""?x.postData(t,r,n):x.putData(`${t}/${e}`,r,n),x.postData=(e,t,r)=>{const n={headers:J(r)};return new Promise((a,i)=>{j.post(e,t,n).then(c=>{a(c.data)}).catch(c=>{i(Y(c))})})},x.putData=(e,t,r)=>{const n={headers:J(r)};return new Promise((a,i)=>{j.put(e,t,n).then(c=>{a(c.data)}).catch(c=>{i(Y(c))})})},x.deleteData=(e,t)=>{const r={headers:J(!0)};return t&&(r.data={...t}),new Promise((n,a)=>{j.delete(e,r).then(i=>{n(i.data)}).catch(i=>{a(Y(i))})})},x.deleteMultipleData=(e,t)=>{const r={headers:J(!0),data:{ids:t}};return new Promise((n,a)=>{j.delete(e,r).then(i=>{n(i.data)}).catch(i=>{a(Y(i))})})};function Y(e){return e===null?"error":e.response?Array.isArray(e.response.data)?e.response.data.map(r=>r.description).join(`
2
- `):e.response.data:e.request?"network error":"error"}function J(e){var t=e===!0||e===void 0;const r=typeof window<"u"&&typeof localStorage<"u";let n=r?localStorage.getItem("token"):null;const a=r?localStorage.getItem("appKey"):"";return t&&n?{AppKey:a,"Content-Type":"application/json"}:{AppKey:a,"Content-Type":"application/json"}}const Ze={getSystemList:Qe};function Qe(e){return x.getData(`/api/system/list/${e}`,!0)}const Xe=({slug:e,value:t,label:r,opts:n,isRequired:a,values:i,error:c,errors:d,placeholder:p})=>{const[f,h]=g.useState([]),[b,v]=g.useState(!1);if(!e)throw Error("ListInput property: slug required");return!t&&i&&i[e]&&(t=i[e]),!c&&d&&d[e]&&(c=d[e]),g.useEffect(()=>{if(n.listSource==="static list")h(n.listOptions),v(!0);else if(n.listSource.indexOf("list_")>-1){let y=n.listSource.split("_")[1];Ze.getSystemList(y).then(F=>{let k=F.items.map(u=>({label:u.label,value:u.value}));h(k),v(!0)}).catch(()=>{})}},[n.listSource]),s.jsxs(s.Fragment,{children:[n.fieldStyle==="select"&&s.jsx(l.Form.Item,{label:r,name:e,initialValue:t,rules:[{required:a,message:"Required"}],children:s.jsxs(l.Select,{showSearch:!0,optionFilterProp:"children",filterOption:(y,F)=>F.children&&F.children.toLowerCase().indexOf(y.toLowerCase())>=0,children:[s.jsx(l.Select.Option,{value:"",children:p}),f.map((y,F)=>s.jsx(l.Select.Option,{children:y.label},y.value))]})}),b&&n.fieldStyle==="checkboxes"&&s.jsx(l.Form.Item,{label:r,name:e,initialValue:t,rules:[{required:a,message:"Required"}],children:s.jsx(l.Checkbox.Group,{children:s.jsx(l.Space,{direction:"vertical",children:f.map((y,F)=>s.jsx(l.Checkbox,{value:y.value,children:y.label},y.value))})})}),b&&n.fieldStyle==="radios"&&s.jsx(l.Form.Item,{label:r,name:e,initialValue:t,className:"column-vertical",rules:[{required:a,message:"Required"}],children:s.jsx(l.Radio.Group,{options:f})})]})},pe=e=>{let{slug:t,value:r,label:n,opts:a,type:i,isRequired:c,error:d,className:p,placeholder:f}=e;if(!t)throw Error("NumberInput property: slug required");return s.jsx(l.Form.Item,{validateStatus:d?"error":"",name:t,help:d||"",label:n,className:p,initialValue:r,rules:[{required:c,message:"Required"}],children:s.jsx(l.InputNumber,{min:a.minNumber||0,max:a.maxNumber||9999999999,placeholder:f,formatter:h=>i==="currency"?`$ ${h}`:h,parser:h=>h.replace("$","")})})};function re(e){let{slug:t,value:r,fieldType:n,label:a,disableDates:i,showTime:c,disabled:d,isRequired:p}=e;if(!t)throw Error("DatePickerInput property: slug required");return s.jsxs(l.Form.Item,{label:a,children:[n===9&&s.jsx(l.Form.Item,{name:t,initialValue:r,children:s.jsx(l.TimePicker,{name:t,use12Hours:!0,rules:[{required:o.isRequired,message:"Required"}]})}),n!==9&&s.jsx(l.Form.Item,{name:t,initialValue:r,help:Intl.DateTimeFormat().resolvedOptions().timeZone,rules:[{required:o.isRequired,message:"Required"}],children:s.jsx(l.DatePicker,{name:t,disabled:d,disabledDate:i,showToday:!1,use12Hours:!0,showTime:c?{use12Hours:!0,format:"HH:mm a"}:!1,format:c?"MM-DD-YYYY h:mm a":"MM-DD-YYYY"})})]})}const Re=e=>{let{slug:t,value:r,label:n,opts:a,error:i,className:c}=e;if(!t)throw Error("YesNoInput property: slug required");const d=[{label:"Yes",value:!0},{label:"No",value:!1}];return s.jsxs(l.Form.Item,{validateStatus:i?"error":"",name:t,help:i||"",label:n,className:c,initialValue:r,children:[a.fieldStyle==="switch"&&s.jsx(l.Form.Item,{name:t,initialValue:r,children:s.jsx(l.Switch,{})}),a.fieldStyle==="radio"&&s.jsx(l.Form.Item,{name:t,initialValue:r,rules:[{required:o.isRequired,message:"Required"}],children:s.jsx(l.Radio.Group,{options:d})})]})};function et(e){let{slug:t,value:r,label:n,debug:a,className:i}=e;return a?s.jsx(l.Form.Item,{name:t,label:n,className:i,children:s.jsx(l.Input,{value:r})}):s.jsx(l.Form.Item,{label:n,className:i,children:r})}const tt=e=>{let{slug:t,value:r,label:n,className:a}=e;if(!t)throw Error("OptInInput property: slug required");return s.jsx(l.Form.Item,{name:t,initialValue:r,valuePropName:"checked",className:a,label:n,rules:[{validator:async(i,c)=>{if(!c)return Promise.reject(new Error("Required"))}}],children:s.jsx(l.Checkbox,{children:"I Agree"})})},be=g.createContext({});function ye(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=ye(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function rt(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=ye(e))&&(n&&(n+=" "),n+=t);return n}const nt={aliceblue:"9ehhb",antiquewhite:"9sgk7",aqua:"1ekf",aquamarine:"4zsno",azure:"9eiv3",beige:"9lhp8",bisque:"9zg04",black:"0",blanchedalmond:"9zhe5",blue:"73",blueviolet:"5e31e",brown:"6g016",burlywood:"8ouiv",cadetblue:"3qba8",chartreuse:"4zshs",chocolate:"87k0u",coral:"9yvyo",cornflowerblue:"3xael",cornsilk:"9zjz0",crimson:"8l4xo",cyan:"1ekf",darkblue:"3v",darkcyan:"rkb",darkgoldenrod:"776yz",darkgray:"6mbhl",darkgreen:"jr4",darkgrey:"6mbhl",darkkhaki:"7ehkb",darkmagenta:"5f91n",darkolivegreen:"3bzfz",darkorange:"9yygw",darkorchid:"5z6x8",darkred:"5f8xs",darksalmon:"9441m",darkseagreen:"5lwgf",darkslateblue:"2th1n",darkslategray:"1ugcv",darkslategrey:"1ugcv",darkturquoise:"14up",darkviolet:"5rw7n",deeppink:"9yavn",deepskyblue:"11xb",dimgray:"442g9",dimgrey:"442g9",dodgerblue:"16xof",firebrick:"6y7tu",floralwhite:"9zkds",forestgreen:"1cisi",fuchsia:"9y70f",gainsboro:"8m8kc",ghostwhite:"9pq0v",goldenrod:"8j4f4",gold:"9zda8",gray:"50i2o",green:"pa8",greenyellow:"6senj",grey:"50i2o",honeydew:"9eiuo",hotpink:"9yrp0",indianred:"80gnw",indigo:"2xcoy",ivory:"9zldc",khaki:"9edu4",lavenderblush:"9ziet",lavender:"90c8q",lawngreen:"4vk74",lemonchiffon:"9zkct",lightblue:"6s73a",lightcoral:"9dtog",lightcyan:"8s1rz",lightgoldenrodyellow:"9sjiq",lightgray:"89jo3",lightgreen:"5nkwg",lightgrey:"89jo3",lightpink:"9z6wx",lightsalmon:"9z2ii",lightseagreen:"19xgq",lightskyblue:"5arju",lightslategray:"4nwk9",lightslategrey:"4nwk9",lightsteelblue:"6wau6",lightyellow:"9zlcw",lime:"1edc",limegreen:"1zcxe",linen:"9shk6",magenta:"9y70f",maroon:"4zsow",mediumaquamarine:"40eju",mediumblue:"5p",mediumorchid:"79qkz",mediumpurple:"5r3rv",mediumseagreen:"2d9ip",mediumslateblue:"4tcku",mediumspringgreen:"1di2",mediumturquoise:"2uabw",mediumvioletred:"7rn9h",midnightblue:"z980",mintcream:"9ljp6",mistyrose:"9zg0x",moccasin:"9zfzp",navajowhite:"9zest",navy:"3k",oldlace:"9wq92",olive:"50hz4",olivedrab:"472ub",orange:"9z3eo",orangered:"9ykg0",orchid:"8iu3a",palegoldenrod:"9bl4a",palegreen:"5yw0o",paleturquoise:"6v4ku",palevioletred:"8k8lv",papayawhip:"9zi6t",peachpuff:"9ze0p",peru:"80oqn",pink:"9z8wb",plum:"8nba5",powderblue:"6wgdi",purple:"4zssg",rebeccapurple:"3zk49",red:"9y6tc",rosybrown:"7cv4f",royalblue:"2jvtt",saddlebrown:"5fmkz",salmon:"9rvci",sandybrown:"9jn1c",seagreen:"1tdnb",seashell:"9zje6",sienna:"6973h",silver:"7ir40",skyblue:"5arjf",slateblue:"45e4t",slategray:"4e100",slategrey:"4e100",snow:"9zke2",springgreen:"1egv",steelblue:"2r1kk",tan:"87yx8",teal:"pds",thistle:"8ggk8",tomato:"9yqfb",turquoise:"2j4r4",violet:"9b10u",wheat:"9ld4j",white:"9zldr",whitesmoke:"9lhpx",yellow:"9zl6o",yellowgreen:"61fzm"},M=Math.round;function ne(e,t){const r=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],n=r.map(a=>parseFloat(a));for(let a=0;a<3;a+=1)n[a]=t(n[a]||0,r[a]||"",a);return r[3]?n[3]=r[3].includes("%")?n[3]/100:n[3]:n[3]=1,n}const Se=(e,t,r)=>r===0?e:e/100;function W(e,t){const r=t||255;return e>r?r:e<0?0:e}class U{isValid=!0;r=0;g=0;b=0;a=1;_h;_hsl_s;_hsv_s;_l;_v;_max;_min;_brightness;constructor(t){function r(n){return n[0]in t&&n[1]in t&&n[2]in t}if(t)if(typeof t=="string"){let a=function(i){return n.startsWith(i)};const n=t.trim();if(/^#?[A-F\d]{3,8}$/i.test(n))this.fromHexString(n);else if(a("rgb"))this.fromRgbString(n);else if(a("hsl"))this.fromHslString(n);else if(a("hsv")||a("hsb"))this.fromHsvString(n);else{const i=nt[n.toLowerCase()];i&&this.fromHexString(parseInt(i,36).toString(16).padStart(6,"0"))}}else if(t instanceof U)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._hsl_s=t._hsl_s,this._hsv_s=t._hsv_s,this._l=t._l,this._v=t._v;else if(r("rgb"))this.r=W(t.r),this.g=W(t.g),this.b=W(t.b),this.a=typeof t.a=="number"?W(t.a,1):1;else if(r("hsl"))this.fromHsl(t);else if(r("hsv"))this.fromHsv(t);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t))}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const r=this.toHsv();return r.h=t,this._c(r)}getLuminance(){function t(i){const c=i/255;return c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4)}const r=t(this.r),n=t(this.g),a=t(this.b);return .2126*r+.7152*n+.0722*a}getHue(){if(typeof this._h>"u"){const t=this.getMax()-this.getMin();t===0?this._h=0:this._h=M(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/t+2:(this.r-this.g)/t+4))}return this._h}getSaturation(){return this.getHSVSaturation()}getHSVSaturation(){if(typeof this._hsv_s>"u"){const t=this.getMax()-this.getMin();t===0?this._hsv_s=0:this._hsv_s=t/this.getMax()}return this._hsv_s}getHSLSaturation(){if(typeof this._hsl_s>"u"){const t=this.getMax()-this.getMin();if(t===0)this._hsl_s=0;else{const r=this.getLightness();this._hsl_s=t/255/(1-Math.abs(2*r-1))}}return this._hsl_s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(t=10){const r=this.getHue(),n=this.getSaturation();let a=this.getLightness()-t/100;return a<0&&(a=0),this._c({h:r,s:n,l:a,a:this.a})}lighten(t=10){const r=this.getHue(),n=this.getSaturation();let a=this.getLightness()+t/100;return a>1&&(a=1),this._c({h:r,s:n,l:a,a:this.a})}mix(t,r=50){const n=this._c(t),a=r/100,i=d=>(n[d]-this[d])*a+this[d],c={r:M(i("r")),g:M(i("g")),b:M(i("b")),a:M(i("a")*100)/100};return this._c(c)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const r=this._c(t),n=this.a+r.a*(1-this.a),a=i=>M((this[i]*this.a+r[i]*r.a*(1-this.a))/n);return this._c({r:a("r"),g:a("g"),b:a("b"),a:n})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const r=(this.r||0).toString(16);t+=r.length===2?r:"0"+r;const n=(this.g||0).toString(16);t+=n.length===2?n:"0"+n;const a=(this.b||0).toString(16);if(t+=a.length===2?a:"0"+a,typeof this.a=="number"&&this.a>=0&&this.a<1){const i=M(this.a*255).toString(16);t+=i.length===2?i:"0"+i}return t}toHsl(){return{h:this.getHue(),s:this.getHSLSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),r=M(this.getHSLSaturation()*100),n=M(this.getLightness()*100);return this.a!==1?`hsla(${t},${r}%,${n}%,${this.a})`:`hsl(${t},${r}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getHSVSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(t,r,n){const a=this.clone();return a[t]=W(r,n),a}_c(t){return new this.constructor(t)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(t){const r=t.replace("#","");function n(a,i){return parseInt(r[a]+r[i||a],16)}r.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=r[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=r[6]?n(6,7)/255:1)}fromHsl({h:t,s:r,l:n,a}){const i=(t%360+360)%360;if(this._h=i,this._hsl_s=r,this._l=n,this.a=typeof a=="number"?a:1,r<=0){const y=M(n*255);this.r=y,this.g=y,this.b=y;return}let c=0,d=0,p=0;const f=i/60,h=(1-Math.abs(2*n-1))*r,b=h*(1-Math.abs(f%2-1));f>=0&&f<1?(c=h,d=b):f>=1&&f<2?(c=b,d=h):f>=2&&f<3?(d=h,p=b):f>=3&&f<4?(d=b,p=h):f>=4&&f<5?(c=b,p=h):f>=5&&f<6&&(c=h,p=b);const v=n-h/2;this.r=M((c+v)*255),this.g=M((d+v)*255),this.b=M((p+v)*255)}fromHsv({h:t,s:r,v:n,a}){const i=(t%360+360)%360;this._h=i,this._hsv_s=r,this._v=n,this.a=typeof a=="number"?a:1;const c=M(n*255);if(this.r=c,this.g=c,this.b=c,r<=0)return;const d=i/60,p=Math.floor(d),f=d-p,h=M(n*(1-r)*255),b=M(n*(1-r*f)*255),v=M(n*(1-r*(1-f))*255);switch(p){case 0:this.g=v,this.b=h;break;case 1:this.r=b,this.b=h;break;case 2:this.r=h,this.b=v;break;case 3:this.r=h,this.g=b;break;case 4:this.r=v,this.g=h;break;default:this.g=h,this.b=b;break}}fromHsvString(t){const r=ne(t,Se);this.fromHsv({h:r[0],s:r[1],v:r[2],a:r[3]})}fromHslString(t){const r=ne(t,Se);this.fromHsl({h:r[0],s:r[1],l:r[2],a:r[3]})}fromRgbString(t){const r=ne(t,(n,a)=>a.includes("%")?M(n/100*255):n);this.r=r[0],this.g=r[1],this.b=r[2],this.a=r[3]}}const R=2,we=.16,st=.05,at=.05,ot=.15,ve=5,Te=4,it=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function Ie(e,t,r){let n;return Math.round(e.h)>=60&&Math.round(e.h)<=240?n=r?Math.round(e.h)-R*t:Math.round(e.h)+R*t:n=r?Math.round(e.h)+R*t:Math.round(e.h)-R*t,n<0?n+=360:n>=360&&(n-=360),n}function _e(e,t,r){if(e.h===0&&e.s===0)return e.s;let n;return r?n=e.s-we*t:t===Te?n=e.s+we:n=e.s+st*t,n>1&&(n=1),r&&t===ve&&n>.1&&(n=.1),n<.06&&(n=.06),Math.round(n*100)/100}function xe(e,t,r){let n;return r?n=e.v+at*t:n=e.v-ot*t,n=Math.max(0,Math.min(1,n)),Math.round(n*100)/100}function lt(e,t={}){const r=[],n=new U(e),a=n.toHsv();for(let i=ve;i>0;i-=1){const c=new U({h:Ie(a,i,!0),s:_e(a,i,!0),v:xe(a,i,!0)});r.push(c)}r.push(n);for(let i=1;i<=Te;i+=1){const c=new U({h:Ie(a,i),s:_e(a,i),v:xe(a,i)});r.push(c)}return t.theme==="dark"?it.map(({index:i,amount:c})=>new U(t.backgroundColor||"#141414").mix(r[i],c).toHexString()):r.map(i=>i.toHexString())}const se=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];se.primary=se[5];function ct(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function ut(e,t){if(!e)return!1;if(e.contains)return e.contains(t);let r=t;for(;r;){if(r===e)return!0;r=r.parentNode}return!1}const Ce="data-rc-order",ke="data-rc-priority",ht="rc-util-key",ae=new Map;function Fe({mark:e}={}){return e?e.startsWith("data-")?e:`data-${e}`:ht}function oe(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function dt(e){return e==="queue"?"prependQueue":e?"prepend":"append"}function ie(e){return Array.from((ae.get(e)||e).children).filter(t=>t.tagName==="STYLE")}function Ne(e,t={}){if(!ct())return null;const{csp:r,prepend:n,priority:a=0}=t,i=dt(n),c=i==="prependQueue",d=document.createElement("style");d.setAttribute(Ce,i),c&&a&&d.setAttribute(ke,`${a}`),r?.nonce&&(d.nonce=r?.nonce),d.innerHTML=e;const p=oe(t),{firstChild:f}=p;if(n){if(c){const h=(t.styles||ie(p)).filter(b=>{if(!["prepend","prependQueue"].includes(b.getAttribute(Ce)))return!1;const v=Number(b.getAttribute(ke)||0);return a>=v});if(h.length)return p.insertBefore(d,h[h.length-1].nextSibling),d}p.insertBefore(d,f)}else p.appendChild(d);return d}function gt(e,t={}){let{styles:r}=t;return r||=ie(oe(t)),r.find(n=>n.getAttribute(Fe(t))===e)}function ft(e,t){const r=ae.get(e);if(!r||!ut(document,r)){const n=Ne("",t),{parentNode:a}=n;ae.set(e,a),e.removeChild(n)}}function mt(e,t,r={}){const n=oe(r),a=ie(n),i={...r,styles:a};ft(n,i);const c=gt(t,i);if(c)return i.csp?.nonce&&c.nonce!==i.csp?.nonce&&(c.nonce=i.csp?.nonce),c.innerHTML!==e&&(c.innerHTML=e),c;const d=Ne(e,i);return d.setAttribute(Fe(i),t),d}function qe(e){return e?.getRootNode?.()}function pt(e){return qe(e)instanceof ShadowRoot}function bt(e){return pt(e)?qe(e):null}let le={};const yt=e=>{};function St(e,t){}function wt(e,t){}function vt(){le={}}function Me(e,t,r){!t&&!le[r]&&(e(!1,r),le[r]=!0)}function ee(e,t){Me(St,e,t)}function Tt(e,t){Me(wt,e,t)}ee.preMessage=yt,ee.resetWarned=vt,ee.noteOnce=Tt;function It(e){return e.replace(/-(.)/g,(t,r)=>r.toUpperCase())}function _t(e,t){ee(e,`[@ant-design/icons] ${t}`)}function ze(e){return typeof e=="object"&&typeof e.name=="string"&&typeof e.theme=="string"&&(typeof e.icon=="object"||typeof e.icon=="function")}function Oe(e={}){return Object.keys(e).reduce((t,r)=>{const n=e[r];return r==="class"?(t.className=n,delete t.class):(delete t[r],t[It(r)]=n),t},{})}function ce(e,t,r){return r?g.createElement(e.tag,{key:t,...Oe(e.attrs),...r},(e.children||[]).map((n,a)=>ce(n,`${t}-${e.tag}-${a}`))):g.createElement(e.tag,{key:t,...Oe(e.attrs)},(e.children||[]).map((n,a)=>ce(n,`${t}-${e.tag}-${a}`)))}function $e(e){return lt(e)[0]}function De(e){return e?Array.isArray(e)?e:[e]:[]}const xt=`
1
+ (function(s,g){typeof exports=="object"&&typeof module<"u"?module.exports=g(require("react/jsx-runtime"),require("react"),require("antd"),require("axios"),require("dayjs")):typeof define=="function"&&define.amd?define(["react/jsx-runtime","react","antd","axios","dayjs"],g):(s=typeof globalThis<"u"?globalThis:s||self,s.StormForm=g(s.jsxRuntime,s.React,s.antd,s.axios,s.dayjs))})(this,(function(s,g,l,j,X){"use strict";function Ue(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const P=Ue(g),Ke={},Ye="https://storm-api.azurewebsites.net";function Je(){const e=typeof globalThis<"u"?globalThis.process?.env:void 0;return e?.STORM_FORM_API_URL||e?.NEXT_PUBLIC_STORM_FORM_API_URL}function We(){return Ke?.VITE_WEBAPI_URL}function Ge(){return Je()||We()||Ye}j.defaults.baseURL=Ge(),j.defaults.timeout=1e3*60*10;const x=j.create({responseType:"json"});x.getData=(e,t)=>{const r={headers:J(t)};return new Promise((n,a)=>{j.get(e,r).then(i=>{n(i.data)}).catch(i=>{a(Y(i))})})},x.upsertData=(e,t,r,n)=>e==null||e===0||e===""?x.postData(t,r,n):x.putData(`${t}/${e}`,r,n),x.postData=(e,t,r)=>{const n={headers:J(r)};return new Promise((a,i)=>{j.post(e,t,n).then(c=>{a(c.data)}).catch(c=>{i(Y(c))})})},x.putData=(e,t,r)=>{const n={headers:J(r)};return new Promise((a,i)=>{j.put(e,t,n).then(c=>{a(c.data)}).catch(c=>{i(Y(c))})})},x.deleteData=(e,t)=>{const r={headers:J(!0)};return t&&(r.data={...t}),new Promise((n,a)=>{j.delete(e,r).then(i=>{n(i.data)}).catch(i=>{a(Y(i))})})},x.deleteMultipleData=(e,t)=>{const r={headers:J(!0),data:{ids:t}};return new Promise((n,a)=>{j.delete(e,r).then(i=>{n(i.data)}).catch(i=>{a(Y(i))})})};function Y(e){return e===null?"error":e.response?Array.isArray(e.response.data)?e.response.data.map(r=>r.description).join(`
2
+ `):e.response.data:e.request?"network error":"error"}function J(e){var t=e===!0||e===void 0;const r=typeof window<"u"&&typeof localStorage<"u";let n=r?localStorage.getItem("token"):null;const a=r?localStorage.getItem("appKey"):"";return t&&n?{AppKey:a,"Content-Type":"application/json"}:{AppKey:a,"Content-Type":"application/json"}}const Ze={getSystemList:Qe};function Qe(e){return x.getData(`/api/system/list/${e}`,!0)}const Xe=({slug:e,value:t,label:r,opts:n,isRequired:a,values:i,error:c,errors:d,placeholder:p})=>{const[f,h]=g.useState([]),[b,v]=g.useState(!1);if(!e)throw Error("ListInput property: slug required");return!t&&i&&i[e]&&(t=i[e]),!c&&d&&d[e]&&(c=d[e]),g.useEffect(()=>{if(n.listSource==="static list")h(n.listOptions),v(!0);else if(n.listSource.indexOf("list_")>-1){let y=n.listSource.split("_")[1];Ze.getSystemList(y).then(F=>{let k=F.items.map(u=>({label:u.label,value:u.value}));h(k),v(!0)}).catch(()=>{})}},[n.listSource]),s.jsxs(s.Fragment,{children:[n.fieldStyle==="select"&&s.jsx(l.Form.Item,{label:r,name:e,initialValue:t,rules:[{required:a,message:"Required"}],children:s.jsxs(l.Select,{showSearch:!0,optionFilterProp:"children",filterOption:(y,F)=>F.children&&F.children.toLowerCase().indexOf(y.toLowerCase())>=0,children:[s.jsx(l.Select.Option,{value:"",children:p}),f.map((y,F)=>s.jsx(l.Select.Option,{children:y.label},y.value))]})}),b&&n.fieldStyle==="checkboxes"&&s.jsx(l.Form.Item,{label:r,name:e,initialValue:t,rules:[{required:a,message:"Required"}],children:s.jsx(l.Checkbox.Group,{children:s.jsx(l.Space,{direction:"vertical",children:f.map((y,F)=>s.jsx(l.Checkbox,{value:y.value,children:y.label},y.value))})})}),b&&n.fieldStyle==="radios"&&s.jsx(l.Form.Item,{label:r,name:e,initialValue:t,className:"column-vertical",rules:[{required:a,message:"Required"}],children:s.jsx(l.Radio.Group,{options:f})})]})},pe=e=>{let{slug:t,value:r,label:n,opts:a,type:i,isRequired:c,error:d,className:p,placeholder:f}=e;if(!t)throw Error("NumberInput property: slug required");return s.jsx(l.Form.Item,{validateStatus:d?"error":"",name:t,help:d||"",label:n,className:p,initialValue:r,rules:[{required:c,message:"Required"}],children:s.jsx(l.InputNumber,{min:a.minNumber||0,max:a.maxNumber||9999999999,placeholder:f,formatter:h=>i==="currency"?`$ ${h}`:h,parser:h=>h.replace("$","")})})};function re(e){let{slug:t,value:r,fieldType:n,label:a,disableDates:i,showTime:c,disabled:d,isRequired:p}=e;if(!t)throw Error("DatePickerInput property: slug required");return s.jsxs(l.Form.Item,{label:a,children:[n===9&&s.jsx(l.Form.Item,{name:t,initialValue:r,children:s.jsx(l.TimePicker,{name:t,use12Hours:!0,rules:[{required:o.isRequired,message:"Required"}]})}),n!==9&&s.jsx(l.Form.Item,{name:t,initialValue:r,help:Intl.DateTimeFormat().resolvedOptions().timeZone,rules:[{required:o.isRequired,message:"Required"}],children:s.jsx(l.DatePicker,{name:t,disabled:d,disabledDate:i,showToday:!1,use12Hours:!0,showTime:c?{use12Hours:!0,format:"HH:mm a"}:!1,format:c?"MM-DD-YYYY h:mm a":"MM-DD-YYYY"})})]})}const Re=e=>{let{slug:t,value:r,label:n,opts:a,error:i,className:c}=e;if(!t)throw Error("YesNoInput property: slug required");const d=[{label:"Yes",value:!0},{label:"No",value:!1}];return s.jsxs(l.Form.Item,{validateStatus:i?"error":"",name:t,help:i||"",label:n,className:c,initialValue:r,children:[a.fieldStyle==="switch"&&s.jsx(l.Form.Item,{name:t,initialValue:r,children:s.jsx(l.Switch,{})}),a.fieldStyle==="radio"&&s.jsx(l.Form.Item,{name:t,initialValue:r,rules:[{required:o.isRequired,message:"Required"}],children:s.jsx(l.Radio.Group,{options:d})})]})};function et(e){let{slug:t,value:r,label:n,debug:a,className:i}=e;return a?s.jsx(l.Form.Item,{name:t,label:n,className:i,children:s.jsx(l.Input,{value:r})}):s.jsx(l.Form.Item,{label:n,className:i,children:r})}const tt=e=>{let{slug:t,value:r,label:n,className:a}=e;if(!t)throw Error("OptInInput property: slug required");return s.jsx(l.Form.Item,{name:t,initialValue:r,valuePropName:"checked",className:a,label:n,rules:[{validator:async(i,c)=>{if(!c)return Promise.reject(new Error("Required"))}}],children:s.jsx(l.Checkbox,{children:"I Agree"})})},be=g.createContext({});function ye(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=ye(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function rt(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=ye(e))&&(n&&(n+=" "),n+=t);return n}const nt={aliceblue:"9ehhb",antiquewhite:"9sgk7",aqua:"1ekf",aquamarine:"4zsno",azure:"9eiv3",beige:"9lhp8",bisque:"9zg04",black:"0",blanchedalmond:"9zhe5",blue:"73",blueviolet:"5e31e",brown:"6g016",burlywood:"8ouiv",cadetblue:"3qba8",chartreuse:"4zshs",chocolate:"87k0u",coral:"9yvyo",cornflowerblue:"3xael",cornsilk:"9zjz0",crimson:"8l4xo",cyan:"1ekf",darkblue:"3v",darkcyan:"rkb",darkgoldenrod:"776yz",darkgray:"6mbhl",darkgreen:"jr4",darkgrey:"6mbhl",darkkhaki:"7ehkb",darkmagenta:"5f91n",darkolivegreen:"3bzfz",darkorange:"9yygw",darkorchid:"5z6x8",darkred:"5f8xs",darksalmon:"9441m",darkseagreen:"5lwgf",darkslateblue:"2th1n",darkslategray:"1ugcv",darkslategrey:"1ugcv",darkturquoise:"14up",darkviolet:"5rw7n",deeppink:"9yavn",deepskyblue:"11xb",dimgray:"442g9",dimgrey:"442g9",dodgerblue:"16xof",firebrick:"6y7tu",floralwhite:"9zkds",forestgreen:"1cisi",fuchsia:"9y70f",gainsboro:"8m8kc",ghostwhite:"9pq0v",goldenrod:"8j4f4",gold:"9zda8",gray:"50i2o",green:"pa8",greenyellow:"6senj",grey:"50i2o",honeydew:"9eiuo",hotpink:"9yrp0",indianred:"80gnw",indigo:"2xcoy",ivory:"9zldc",khaki:"9edu4",lavenderblush:"9ziet",lavender:"90c8q",lawngreen:"4vk74",lemonchiffon:"9zkct",lightblue:"6s73a",lightcoral:"9dtog",lightcyan:"8s1rz",lightgoldenrodyellow:"9sjiq",lightgray:"89jo3",lightgreen:"5nkwg",lightgrey:"89jo3",lightpink:"9z6wx",lightsalmon:"9z2ii",lightseagreen:"19xgq",lightskyblue:"5arju",lightslategray:"4nwk9",lightslategrey:"4nwk9",lightsteelblue:"6wau6",lightyellow:"9zlcw",lime:"1edc",limegreen:"1zcxe",linen:"9shk6",magenta:"9y70f",maroon:"4zsow",mediumaquamarine:"40eju",mediumblue:"5p",mediumorchid:"79qkz",mediumpurple:"5r3rv",mediumseagreen:"2d9ip",mediumslateblue:"4tcku",mediumspringgreen:"1di2",mediumturquoise:"2uabw",mediumvioletred:"7rn9h",midnightblue:"z980",mintcream:"9ljp6",mistyrose:"9zg0x",moccasin:"9zfzp",navajowhite:"9zest",navy:"3k",oldlace:"9wq92",olive:"50hz4",olivedrab:"472ub",orange:"9z3eo",orangered:"9ykg0",orchid:"8iu3a",palegoldenrod:"9bl4a",palegreen:"5yw0o",paleturquoise:"6v4ku",palevioletred:"8k8lv",papayawhip:"9zi6t",peachpuff:"9ze0p",peru:"80oqn",pink:"9z8wb",plum:"8nba5",powderblue:"6wgdi",purple:"4zssg",rebeccapurple:"3zk49",red:"9y6tc",rosybrown:"7cv4f",royalblue:"2jvtt",saddlebrown:"5fmkz",salmon:"9rvci",sandybrown:"9jn1c",seagreen:"1tdnb",seashell:"9zje6",sienna:"6973h",silver:"7ir40",skyblue:"5arjf",slateblue:"45e4t",slategray:"4e100",slategrey:"4e100",snow:"9zke2",springgreen:"1egv",steelblue:"2r1kk",tan:"87yx8",teal:"pds",thistle:"8ggk8",tomato:"9yqfb",turquoise:"2j4r4",violet:"9b10u",wheat:"9ld4j",white:"9zldr",whitesmoke:"9lhpx",yellow:"9zl6o",yellowgreen:"61fzm"},q=Math.round;function ne(e,t){const r=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],n=r.map(a=>parseFloat(a));for(let a=0;a<3;a+=1)n[a]=t(n[a]||0,r[a]||"",a);return r[3]?n[3]=r[3].includes("%")?n[3]/100:n[3]:n[3]=1,n}const Se=(e,t,r)=>r===0?e:e/100;function W(e,t){const r=t||255;return e>r?r:e<0?0:e}class U{isValid=!0;r=0;g=0;b=0;a=1;_h;_hsl_s;_hsv_s;_l;_v;_max;_min;_brightness;constructor(t){function r(n){return n[0]in t&&n[1]in t&&n[2]in t}if(t)if(typeof t=="string"){let a=function(i){return n.startsWith(i)};const n=t.trim();if(/^#?[A-F\d]{3,8}$/i.test(n))this.fromHexString(n);else if(a("rgb"))this.fromRgbString(n);else if(a("hsl"))this.fromHslString(n);else if(a("hsv")||a("hsb"))this.fromHsvString(n);else{const i=nt[n.toLowerCase()];i&&this.fromHexString(parseInt(i,36).toString(16).padStart(6,"0"))}}else if(t instanceof U)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._hsl_s=t._hsl_s,this._hsv_s=t._hsv_s,this._l=t._l,this._v=t._v;else if(r("rgb"))this.r=W(t.r),this.g=W(t.g),this.b=W(t.b),this.a=typeof t.a=="number"?W(t.a,1):1;else if(r("hsl"))this.fromHsl(t);else if(r("hsv"))this.fromHsv(t);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t))}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const r=this.toHsv();return r.h=t,this._c(r)}getLuminance(){function t(i){const c=i/255;return c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4)}const r=t(this.r),n=t(this.g),a=t(this.b);return .2126*r+.7152*n+.0722*a}getHue(){if(typeof this._h>"u"){const t=this.getMax()-this.getMin();t===0?this._h=0:this._h=q(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/t+2:(this.r-this.g)/t+4))}return this._h}getSaturation(){return this.getHSVSaturation()}getHSVSaturation(){if(typeof this._hsv_s>"u"){const t=this.getMax()-this.getMin();t===0?this._hsv_s=0:this._hsv_s=t/this.getMax()}return this._hsv_s}getHSLSaturation(){if(typeof this._hsl_s>"u"){const t=this.getMax()-this.getMin();if(t===0)this._hsl_s=0;else{const r=this.getLightness();this._hsl_s=t/255/(1-Math.abs(2*r-1))}}return this._hsl_s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(t=10){const r=this.getHue(),n=this.getSaturation();let a=this.getLightness()-t/100;return a<0&&(a=0),this._c({h:r,s:n,l:a,a:this.a})}lighten(t=10){const r=this.getHue(),n=this.getSaturation();let a=this.getLightness()+t/100;return a>1&&(a=1),this._c({h:r,s:n,l:a,a:this.a})}mix(t,r=50){const n=this._c(t),a=r/100,i=d=>(n[d]-this[d])*a+this[d],c={r:q(i("r")),g:q(i("g")),b:q(i("b")),a:q(i("a")*100)/100};return this._c(c)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const r=this._c(t),n=this.a+r.a*(1-this.a),a=i=>q((this[i]*this.a+r[i]*r.a*(1-this.a))/n);return this._c({r:a("r"),g:a("g"),b:a("b"),a:n})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const r=(this.r||0).toString(16);t+=r.length===2?r:"0"+r;const n=(this.g||0).toString(16);t+=n.length===2?n:"0"+n;const a=(this.b||0).toString(16);if(t+=a.length===2?a:"0"+a,typeof this.a=="number"&&this.a>=0&&this.a<1){const i=q(this.a*255).toString(16);t+=i.length===2?i:"0"+i}return t}toHsl(){return{h:this.getHue(),s:this.getHSLSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),r=q(this.getHSLSaturation()*100),n=q(this.getLightness()*100);return this.a!==1?`hsla(${t},${r}%,${n}%,${this.a})`:`hsl(${t},${r}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getHSVSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(t,r,n){const a=this.clone();return a[t]=W(r,n),a}_c(t){return new this.constructor(t)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(t){const r=t.replace("#","");function n(a,i){return parseInt(r[a]+r[i||a],16)}r.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=r[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=r[6]?n(6,7)/255:1)}fromHsl({h:t,s:r,l:n,a}){const i=(t%360+360)%360;if(this._h=i,this._hsl_s=r,this._l=n,this.a=typeof a=="number"?a:1,r<=0){const y=q(n*255);this.r=y,this.g=y,this.b=y;return}let c=0,d=0,p=0;const f=i/60,h=(1-Math.abs(2*n-1))*r,b=h*(1-Math.abs(f%2-1));f>=0&&f<1?(c=h,d=b):f>=1&&f<2?(c=b,d=h):f>=2&&f<3?(d=h,p=b):f>=3&&f<4?(d=b,p=h):f>=4&&f<5?(c=b,p=h):f>=5&&f<6&&(c=h,p=b);const v=n-h/2;this.r=q((c+v)*255),this.g=q((d+v)*255),this.b=q((p+v)*255)}fromHsv({h:t,s:r,v:n,a}){const i=(t%360+360)%360;this._h=i,this._hsv_s=r,this._v=n,this.a=typeof a=="number"?a:1;const c=q(n*255);if(this.r=c,this.g=c,this.b=c,r<=0)return;const d=i/60,p=Math.floor(d),f=d-p,h=q(n*(1-r)*255),b=q(n*(1-r*f)*255),v=q(n*(1-r*(1-f))*255);switch(p){case 0:this.g=v,this.b=h;break;case 1:this.r=b,this.b=h;break;case 2:this.r=h,this.b=v;break;case 3:this.r=h,this.g=b;break;case 4:this.r=v,this.g=h;break;default:this.g=h,this.b=b;break}}fromHsvString(t){const r=ne(t,Se);this.fromHsv({h:r[0],s:r[1],v:r[2],a:r[3]})}fromHslString(t){const r=ne(t,Se);this.fromHsl({h:r[0],s:r[1],l:r[2],a:r[3]})}fromRgbString(t){const r=ne(t,(n,a)=>a.includes("%")?q(n/100*255):n);this.r=r[0],this.g=r[1],this.b=r[2],this.a=r[3]}}const R=2,we=.16,st=.05,at=.05,ot=.15,ve=5,Te=4,it=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function _e(e,t,r){let n;return Math.round(e.h)>=60&&Math.round(e.h)<=240?n=r?Math.round(e.h)-R*t:Math.round(e.h)+R*t:n=r?Math.round(e.h)+R*t:Math.round(e.h)-R*t,n<0?n+=360:n>=360&&(n-=360),n}function Ie(e,t,r){if(e.h===0&&e.s===0)return e.s;let n;return r?n=e.s-we*t:t===Te?n=e.s+we:n=e.s+st*t,n>1&&(n=1),r&&t===ve&&n>.1&&(n=.1),n<.06&&(n=.06),Math.round(n*100)/100}function xe(e,t,r){let n;return r?n=e.v+at*t:n=e.v-ot*t,n=Math.max(0,Math.min(1,n)),Math.round(n*100)/100}function lt(e,t={}){const r=[],n=new U(e),a=n.toHsv();for(let i=ve;i>0;i-=1){const c=new U({h:_e(a,i,!0),s:Ie(a,i,!0),v:xe(a,i,!0)});r.push(c)}r.push(n);for(let i=1;i<=Te;i+=1){const c=new U({h:_e(a,i),s:Ie(a,i),v:xe(a,i)});r.push(c)}return t.theme==="dark"?it.map(({index:i,amount:c})=>new U(t.backgroundColor||"#141414").mix(r[i],c).toHexString()):r.map(i=>i.toHexString())}const se=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];se.primary=se[5];function ct(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function ut(e,t){if(!e)return!1;if(e.contains)return e.contains(t);let r=t;for(;r;){if(r===e)return!0;r=r.parentNode}return!1}const Ce="data-rc-order",ke="data-rc-priority",ht="rc-util-key",ae=new Map;function Fe({mark:e}={}){return e?e.startsWith("data-")?e:`data-${e}`:ht}function oe(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function dt(e){return e==="queue"?"prependQueue":e?"prepend":"append"}function ie(e){return Array.from((ae.get(e)||e).children).filter(t=>t.tagName==="STYLE")}function Ne(e,t={}){if(!ct())return null;const{csp:r,prepend:n,priority:a=0}=t,i=dt(n),c=i==="prependQueue",d=document.createElement("style");d.setAttribute(Ce,i),c&&a&&d.setAttribute(ke,`${a}`),r?.nonce&&(d.nonce=r?.nonce),d.innerHTML=e;const p=oe(t),{firstChild:f}=p;if(n){if(c){const h=(t.styles||ie(p)).filter(b=>{if(!["prepend","prependQueue"].includes(b.getAttribute(Ce)))return!1;const v=Number(b.getAttribute(ke)||0);return a>=v});if(h.length)return p.insertBefore(d,h[h.length-1].nextSibling),d}p.insertBefore(d,f)}else p.appendChild(d);return d}function gt(e,t={}){let{styles:r}=t;return r||=ie(oe(t)),r.find(n=>n.getAttribute(Fe(t))===e)}function ft(e,t){const r=ae.get(e);if(!r||!ut(document,r)){const n=Ne("",t),{parentNode:a}=n;ae.set(e,a),e.removeChild(n)}}function mt(e,t,r={}){const n=oe(r),a=ie(n),i={...r,styles:a};ft(n,i);const c=gt(t,i);if(c)return i.csp?.nonce&&c.nonce!==i.csp?.nonce&&(c.nonce=i.csp?.nonce),c.innerHTML!==e&&(c.innerHTML=e),c;const d=Ne(e,i);return d.setAttribute(Fe(i),t),d}function Me(e){return e?.getRootNode?.()}function pt(e){return Me(e)instanceof ShadowRoot}function bt(e){return pt(e)?Me(e):null}let le={};const yt=e=>{};function St(e,t){}function wt(e,t){}function vt(){le={}}function qe(e,t,r){!t&&!le[r]&&(e(!1,r),le[r]=!0)}function ee(e,t){qe(St,e,t)}function Tt(e,t){qe(wt,e,t)}ee.preMessage=yt,ee.resetWarned=vt,ee.noteOnce=Tt;function _t(e){return e.replace(/-(.)/g,(t,r)=>r.toUpperCase())}function It(e,t){ee(e,`[@ant-design/icons] ${t}`)}function ze(e){return typeof e=="object"&&typeof e.name=="string"&&typeof e.theme=="string"&&(typeof e.icon=="object"||typeof e.icon=="function")}function Oe(e={}){return Object.keys(e).reduce((t,r)=>{const n=e[r];return r==="class"?(t.className=n,delete t.class):(delete t[r],t[_t(r)]=n),t},{})}function ce(e,t,r){return r?g.createElement(e.tag,{key:t,...Oe(e.attrs),...r},(e.children||[]).map((n,a)=>ce(n,`${t}-${e.tag}-${a}`))):g.createElement(e.tag,{key:t,...Oe(e.attrs)},(e.children||[]).map((n,a)=>ce(n,`${t}-${e.tag}-${a}`)))}function $e(e){return lt(e)[0]}function De(e){return e?Array.isArray(e)?e:[e]:[]}const xt=`
3
3
  .anticon {
4
4
  display: inline-flex;
5
5
  align-items: center;
@@ -57,5 +57,5 @@
57
57
  }
58
58
  `,Ct=e=>{const{csp:t,prefixCls:r,layer:n}=g.useContext(be);let a=xt;r&&(a=a.replace(/anticon/g,r)),n&&(a=`@layer ${n} {
59
59
  ${a}
60
- }`),g.useEffect(()=>{const i=e.current,c=bt(i);mt(a,"@ant-design-icons",{prepend:!n,csp:t,attachTo:c})},[])},G={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};function kt({primaryColor:e,secondaryColor:t}){G.primaryColor=e,G.secondaryColor=t||$e(e),G.calculated=!!t}function Ft(){return{...G}}const K=e=>{const{icon:t,className:r,onClick:n,style:a,primaryColor:i,secondaryColor:c,...d}=e,p=P.useRef(null);let f=G;if(i&&(f={primaryColor:i,secondaryColor:c||$e(i)}),Ct(p),_t(ze(t),`icon should be icon definiton, but got ${t}`),!ze(t))return null;let h=t;return h&&typeof h.icon=="function"&&(h={...h,icon:h.icon(f.primaryColor,f.secondaryColor)}),ce(h.icon,`svg-${h.name}`,{className:r,onClick:n,style:a,"data-icon":h.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",...d,ref:p})};K.displayName="IconReact",K.getTwoToneColors=Ft,K.setTwoToneColors=kt;function Ee(e){const[t,r]=De(e);return K.setTwoToneColors({primaryColor:t,secondaryColor:r})}function Nt(){const e=K.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor}function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ue.apply(this,arguments)}Ee(se.primary);const Z=P.forwardRef((e,t)=>{const{className:r,icon:n,spin:a,rotate:i,tabIndex:c,onClick:d,twoToneColor:p,...f}=e,{prefixCls:h="anticon",rootClassName:b}=P.useContext(be),v=rt(b,h,{[`${h}-${n.name}`]:!!n.name,[`${h}-spin`]:!!a||n.name==="loading"},r);let y=c;y===void 0&&d&&(y=-1);const F=i?{msTransform:`rotate(${i}deg)`,transform:`rotate(${i}deg)`}:void 0,[k,u]=De(p);return P.createElement("span",ue({role:"img","aria-label":n.name},f,{ref:t,tabIndex:y,onClick:d,className:v}),P.createElement(K,{icon:n,primaryColor:k,secondaryColor:u,style:F}))});Z.getTwoToneColor=Nt,Z.setTwoToneColor=Ee;var qt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"};function he(){return he=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},he.apply(this,arguments)}const Mt=(e,t)=>P.createElement(Z,he({},e,{ref:t,icon:qt})),He=P.forwardRef(Mt);var zt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM544 472c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v108H372c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h108v108c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V644h108c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V472z"}}]},name:"file-add",theme:"outlined"};function de(){return de=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},de.apply(this,arguments)}const Ot=(e,t)=>P.createElement(Z,de({},e,{ref:t,icon:zt})),$t=P.forwardRef(Ot);var Dt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"}}]},name:"info-circle",theme:"outlined"};function ge(){return ge=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ge.apply(this,arguments)}const Et=(e,t)=>P.createElement(Z,ge({},e,{ref:t,icon:Dt})),Ht=P.forwardRef(Et),Le={get:Lt,getByIdOrSlug:Pt,getMedias:At,download:jt,downloadFromUrl:Vt};function Lt(e){return x.postData("/api/media/search",e,!0)}function Pt(e){return x.getData(`/api/media/${e}`,!0)}function At(e){return x.postData("/api/media/medias",e,!0)}function jt(e){return x.postData("/api/media/download",e)}function Vt(e){return x.postData("/api/media/download/url",e,!0)}const Pe={success:Bt,error:Ut};function Bt(e){l.notification.success({message:Ae[Math.floor(Math.random()*Ae.length)],description:e,duration:3})}function Ut(e){l.notification.error({message:je[Math.floor(Math.random()*je.length)],description:e,duration:3})}let Ae=["Success","Good Job","Excellent","Way to go!","Nice!","That'll do!","That worked!","Ok","Bingo"],je=["Bummer","Something didn't work","Error","Nope","Shucks"];const{Dragger:Kt}=l.Upload;function Yt(e){const t=e.size/1024/1024<200;return t||Pe.error("File must smaller than 200MB"),t}function Jt({onUploaded:e,accept:t,addToMediaLibrary:r,contentId:n,showUploadList:a=!0,multiple:i=!1}){const c=typeof globalThis<"u"?globalThis.process?.env:void 0,d=typeof window<"u",p=d&&typeof localStorage<"u"?localStorage.getItem("gatsbyUser"):null,f=p!==null&&d?JSON.parse(window.atob(p)):null,h=y=>{y.file.status!=="uploading"&&(y.file.status==="done"?e&&e(y.file.response):y.file.status==="error"&&Pe.error(`${y.file.name} file upload failed.`))},b={Authorization:f?.token?"Bearer "+f.token:"",AppKey:c?.STORM_APPKEY};let v=`https://${c?.REACT_APP_WEBAPI_URL_FULL_ACCESS}/api/media/files`;return r&&(v+="?addToMediaLibrary=true",n&&(v+=`&contentId=${n}`)),s.jsx("div",{children:s.jsx(Kt,{name:"files",accept:t,multiple:i,beforeUpload:Yt,action:v,headers:b,showUploadList:a,onChange:h,children:s.jsxs("div",{className:"p-5 m-5",children:[s.jsx("p",{className:"ant-upload-drag-icon",children:s.jsx($t,{})}),s.jsx("p",{className:"ant-upload-text",children:"Click or drag files to this area to upload"}),t!==void 0&&s.jsx("p",{className:"ant-upload-hint",children:`must be only ${t} files`})]})})})}const fe={image:Wt,currency:Gt,numWithComma:Zt,phone:Qt,timeToRead:Xt,timeDiffMinutes:Rt,startEndDateTime:er,dateFormat:tr,getDateFromString:rr};function Wt(e,t){return e?e.indexOf("?")>-1?`${e}&${t}`:`${e}?${t}`:""}function Gt(e){var t=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"});return t.format(e)}function Zt(e){return e.toLocaleString()}function Qt(e){return e=e.toString().replace(/[^0-9]/g,""),e.length===10?e.substring(0,3)+"."+e.substring(3,6)+"."+e.substring(6):e}function Xt(e){return e?Math.ceil(e.split(" ").length/210):0}function Rt(e,t){console.log(e,t);const r=e&&typeof e=="object"?e:Date.parse(e.replace(" ","T")),n=t&&typeof t=="object"?t:Date.parse(t.replace(" ","T")),a=Math.abs(n-r);return Math.floor(a/1e3/60)}function er(e,t="",r=!0){const n={year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"},a={hour:"numeric",minute:"numeric",timeZoneName:"short"},i={year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",timeZoneName:"short"},c=new Intl.DateTimeFormat("en",n),d=new Intl.DateTimeFormat("en",a),p=new Intl.DateTimeFormat("en",i);if(!e)return"";const f=e&&typeof e=="object"?e:Date.parse(e.replace(" ","T")),h=t&&typeof t=="object"?t:Date.parse(t.replace(" ","T"));return!Number.isNaN(f)&&!Number.isNaN(h)?s.jsxs("span",{children:[c.format(f)," - ",d.format(h),r&&s.jsx("br",{})]}):Number.isNaN(f)?Number.isNaN(h)?"":s.jsxs("span",{children:[" ",p.format(h),r&&s.jsx("br",{})]}):s.jsxs("span",{children:[" ",p.format(f),r&&s.jsx("br",{})]})}function tr(e,t="medium",r=!1){const n={weekday:"long",year:"numeric",month:"long",day:"numeric"},a={year:"numeric",month:"long",day:"numeric"},i={year:"numeric",month:"short",day:"numeric"},c={year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",timeZoneName:"short"},d={hour:"numeric",minute:"numeric",timeZoneName:"short"},p=new Intl.DateTimeFormat("en",n),f=new Intl.DateTimeFormat("en",i),h=new Intl.DateTimeFormat("en",c),b=new Intl.DateTimeFormat("en",a),v=new Intl.DateTimeFormat("en",d);if(!e)return"";const y=e&&typeof e=="object"?e:Date.parse(e.replace(" ","T"));return Number.isNaN(y)?"":s.jsxs(s.Fragment,{children:[t==="long"&&p.format(y),t==="short"&&f.format(y),t==="medium"&&b.format(y),t==="datetime"&&h.format(y),t==="time"&&v.format(y),r&&s.jsx("br",{})]})}function rr(e){if(!e)return null;const t=Date.parse(e.replace(" ","T"));return Number.isNaN(t)?null:t}const{Search:nr}=l.Input;function sr({fileTypes:e,contentId:t,isMany:r,onSuccess:n,hideScopeFilter:a=!0,showResizer:i=!1}){const[c,d]=g.useState(!1),[p,f]=g.useState([]),[h,b]=g.useState([]),[v,y]=g.useState(0),[F,k]=g.useState([]),[u,m]=g.useState(""),[N,C]=g.useState("content"),[w,O]=g.useState(a?1:0),[V,Q]=g.useState({id:"createdOn",desc:!0}),[L,$]=g.useState({current:1,pageSize:20,total:0,position:["topRight","bottomRight"],showSizeChanger:!0}),[q,z]=g.useState([]),[I,_]=g.useState(null),[E,D]=g.useState(null);g.useEffect(()=>{d(!1);let T={keyword:u,mediaTypes:F,orderBy:V,pagination:{pageNum:L.current,pageSize:L.pageSize}};T.mediaPurposes=[1],T.contentId=t,Le.get(T).then(S=>{const H={...L};H.total=S.totalRecords,f(S.media),$(H)}).catch(S=>console.log(S)).finally(()=>{d(!1)})},[v,F,N]);const A=(T,S,H)=>{let te={...V};const B={...L};B.pageSize!==T.pageSize?(B.pageSize=T.pageSize,B.current=1):B.current=T.current,H.field&&(te={id:H.field,desc:H.order==="descend"}),$(B),Q(te),y(v+1)},Ir=(T,S)=>{let H=T.filter(te=>p.find(B=>B.id===te));z(H)},_r=T=>{const S={...L};S.current=1,$(S),k(T)},xr=T=>{const S={...L};S.current=1,$(S),C(T.target.value)},me=T=>{if(n){if(T){i&&T.mediaType===0?_(T):n([T]);return}n(p.filter(S=>q.find(H=>H===S.id))),z([])}},Cr=T=>{let S=h.concat(T);b(S)};return s.jsx(l.Tabs,{items:[{label:"Search",key:"1",children:s.jsxs(s.Fragment,{children:[s.jsxs(l.Row,{gutter:[16,16],className:"mb-3",children:[s.jsx(l.Col,{xs:6,children:s.jsxs(l.Select,{mode:"multiple",placeholder:"Select Type",value:F,onChange:_r,className:"mr-2 w-100",children:[s.jsx(l.Select.Option,{value:0,children:"Image"}),s.jsx(l.Select.Option,{value:1,children:"File"}),s.jsx(l.Select.Option,{value:2,children:"Video"}),s.jsx(l.Select.Option,{value:3,children:"Audio"}),s.jsx(l.Select.Option,{value:4,children:"Embedded"})]})}),s.jsx(l.Col,{xs:6,children:!a&&s.jsxs(l.Radio.Group,{buttonStyle:"solid",value:N,onChange:xr,children:[s.jsx(l.Radio.Button,{value:"global",children:"Global"}),s.jsx(l.Radio.Button,{value:"both",children:"Both"}),s.jsx(l.Radio.Button,{value:"content",children:"Content"})]})}),s.jsx(l.Col,{xs:12,children:s.jsx(nr,{id:"keyword",placeholder:"search",onSearch:()=>y(v+1),enterButton:!0,className:"w-100",value:u,onChange:T=>m(T.target.value),loading:c})}),r&&s.jsx(l.Col,{xs:24,children:s.jsx(l.Button,{type:"primary",className:"mr-2",disabled:q.length===0,onClick:()=>me(),children:"Select"})})]}),s.jsx(l.Table,{dataSource:p,rowKey:T=>T.id,pagination:L,loading:c,size:"middle",className:"clear-both pointer",onChange:A,rowSelection:r&&{type:"checkbox",onChange:Ir,selectedRowKeys:q,hideSelectAll:!0},onRow:(T,S)=>({onClick:H=>{!r&&me(T)}}),columns:[{title:"",dataIndex:"thumbnail",width:"6%",responsive:["lg"],render:(T,S)=>s.jsx("img",{src:S.thumbnail,alt:"Thumbnail",className:"img-fluid avatar-50"})},{title:"Title",dataIndex:"title",sorter:!0},{title:"Type",dataIndex:"lastName",sorter:!0,render:(T,S)=>s.jsxs("span",{children:[S.mediaType===0&&s.jsx(l.Tag,{color:"blue",children:"Image"}),S.mediaType===1&&s.jsx(l.Tag,{color:"gold",children:"File"}),S.mediaType===2&&s.jsx(l.Tag,{color:"cyan",children:"Video"}),S.mediaType===3&&s.jsx(l.Tag,{color:"magenta",children:"Audio"}),S.mediaType===4&&s.jsx(l.Tag,{color:"volcano",children:"Embedded"})]})},{title:"Created",dataIndex:"createdOn",sorter:!0,responsive:["xl"],render:(T,S)=>s.jsx("span",{children:fe.dateFormat(S.createdOn)})},{title:"Info",responsive:["lg"],align:"center",render:(T,S)=>s.jsx(l.Button,{type:"secondary",onClick:H=>{H.stopPropagation(),D(S)},children:s.jsx(Ht,{})})}]})]})},{label:"Upload",key:"2",children:s.jsxs(s.Fragment,{children:[s.jsx(Jt,{onUploaded:Cr,multiple:!0,showUploadList:!1,addToMediaLibrary:!0,contentId:w===1?t:0}),s.jsx(l.Table,{dataSource:h,rowKey:T=>T.id,pagination:!1,loading:c,size:"middle",className:"clear-both pointer",onRow:(T,S)=>({onClick:H=>{me(T)}}),columns:[{title:"",dataIndex:"thumbnail",width:"6%",responsive:["md"],render:(T,S)=>s.jsx("img",{src:S.url,alt:"Thumbnail",className:"img-fluid"})},{title:"Title",dataIndex:"title",sorter:!0},{title:"Type",dataIndex:"lastName",sorter:!0,render:(T,S)=>s.jsxs("span",{children:[S.mediaType===0&&s.jsx(l.Tag,{color:"blue",children:"Image"}),S.mediaType===1&&s.jsx(l.Tag,{color:"gold",children:"File"}),S.mediaType===2&&s.jsx(l.Tag,{color:"cyan",children:"Video"}),S.mediaType===3&&s.jsx(l.Tag,{color:"magenta",children:"Audio"}),S.mediaType===4&&s.jsx(l.Tag,{color:"volcano",children:"Embedded"})]})},{title:"Created",dataIndex:"createdOn",sorter:!0,responsive:["xl"],render:(T,S)=>s.jsx("span",{children:fe.dateFormat(S.createdOn)})}]})]})}]})}const ar=({slug:e,value:t,label:r,opts:n,form:a,onChange:i,media:c,debug:d,isRequired:p,contentId:f,className:h})=>{n=n||{uploadLimit:"1",fileTypes:null};const[b,v]=g.useState(c||[]),[y,F]=g.useState(!1),k=n.uploadLimit!=="1";if(!e)throw Error("MediaInput property: slug required");g.useEffect(()=>{if(c?.length>0?v(c):v([]),t&&!c){const C=t.split(",").filter(w=>!isNaN(w)).map(w=>parseInt(w,10));Le.getMedias({ids:C}).then(w=>{v(w)})}},[c]);const u=C=>{const w=b.concat(C);v(w),N(w),F(!1)},m=C=>{var w=b.findIndex(O=>O.id===C.id);if(w>-1){let O=[...b];O.splice(w,1),v(O),N(O)}},N=C=>{const w=C.map((O,V)=>O.id).join(",");a.setFieldsValue({[e]:w}),i&&i(e,w)};return s.jsxs(l.Form.Item,{label:r,className:h,children:[s.jsxs("div",{className:"text-center",children:[(k||!k&&b.length===0)&&s.jsx(l.Button,{type:"primary",className:"my-2",onClick:()=>F(!0),children:"Select"}),b.length>0&&s.jsx(l.Table,{dataSource:b,rowKey:C=>C.id,pagination:!1,size:"middle",className:"clear-both mt-3",columns:[{title:"",dataIndex:"url",render:(C,w)=>s.jsxs("span",{children:[w.mediaType===0&&s.jsx("img",{src:w.url,alt:"Thumbnail",className:"img-fluid avatar-50"}),w.mediaType===1&&s.jsx("img",{src:w.thumbnail,alt:"Thumbnail",className:"img-fluid avatar-50"}),w.mediaType===2&&s.jsx(s.Fragment,{}),w.mediaType===3&&s.jsx(s.Fragment,{}),w.mediaType===4&&s.jsx(s.Fragment,{})]})},{title:"Title",dataIndex:"title",render:(C,w)=>s.jsxs("span",{children:[w.title,w.credit?.length>0&&s.jsx("div",{dangerouslySetInnerHTML:{__html:w.credit},className:"credit"})]})},{title:"Type",dataIndex:"lastName",sorter:!0,render:(C,w)=>s.jsxs("span",{children:[w.mediaType===0&&s.jsx(l.Tag,{color:"blue",children:"Image"}),w.mediaType===1&&s.jsx(l.Tag,{color:"gold",children:"File"}),w.mediaType===2&&s.jsx(l.Tag,{color:"cyan",children:"Video"}),w.mediaType===3&&s.jsx(l.Tag,{color:"magenta",children:"Audio"}),w.mediaType===4&&s.jsx(l.Tag,{color:"volcano",children:"Embedded"})]})},{title:"",width:"50px",render:(C,w)=>s.jsx(l.Popconfirm,{title:"Are you sure you want to delete this?",onConfirm:()=>m(w),okText:"Yes",cancelText:"No",children:s.jsx(l.Button,{type:"primary",danger:!0,children:s.jsx(He,{})})})}]})]}),s.jsx(l.Form.Item,{name:e,initialValue:t,hidden:!d,rules:[{required:p,message:"Required"}],children:s.jsx(l.Input,{})}),s.jsx(l.Drawer,{open:y,title:"Search Media",height:"85%",placement:"bottom",onClose:()=>F(!1),children:s.jsx(sr,{mediaTypes:n.referenceTypes,isMany:k,onSuccess:u,hideScopeFilter:!0,contentId:f})})]})},or={siteSearch:ir,get:lr,search:cr,getForm:ur,getUserContent:hr,getByIdOrSlug:dr,getContentTypeById:gr};function ir(e){return x.postData("/api/content/sitesearch",e,!1)}function lr(e){return x.getData(`/api/content/${e}`,!1)}function cr(e){return x.postData("/api/content/search",e,!0)}function ur(e,t){return x.getData(`/api/content/form/${e}/${t}`,!1)}function hr(e,t){return x.getData(`/api/content/usercontent/?status=${t}&page=${e}`,!0)}function dr(e){return x.getData(`/api/content/${e}`,!0)}function gr(e,t){let r=`/api/content/contenttype/${e}`;return t&&(r+=`/${t}`),x.getData(r,!0)}const{Search:fr}=l.Input;function mr({contentTypes:e,isMany:t,isEcommerce:r,onSuccess:n,showDetails:a=!0,isPreviewable:i=!1,initialStatus:c=[0]}){const[d,p]=g.useState(!1),[f,h]=g.useState([]),[b,v]=g.useState(0),[y,F]=g.useState(""),[k,u]=g.useState({id:"title",desc:!1}),[m,N]=g.useState({current:1,pageSize:20,total:0,position:["topRight","bottomRight"],showSizeChanger:!0}),[C,w]=g.useState(c),[O,V]=g.useState([]);g.useEffect(()=>{p(!1);let I={keyword:y,contentType:e||[],isPreviewable:i,status:C,orderBy:k,pagination:{pageNum:m.current,pageSize:m.pageSize},isEcommerce:r};or.search(I).then(_=>{const E={...m};E.total=_.totalRecords,h(_.content),N(E)}).catch(_=>console.log(_)).finally(()=>{p(!1)})},[b]);const Q=(I,_,E)=>{let D={...k};const A={...m};A.pageSize!==I.pageSize?(A.pageSize=I.pageSize,A.current=1):A.current=I.current,E.field&&(D={id:E.field,desc:E.order==="descend"}),N(A),u(D),v(b+1)},L=()=>{const I={...m};I.current=1,N(I),v(b+1)},$=(I,_)=>{let E=I.filter(D=>f.find(A=>A.id===D));V(E)},q=I=>{if(n){if(I){n([I]);return}n(f.filter(_=>O.find(E=>E===_.id))),V([])}};let z=[{title:"Title",dataIndex:"title",sorter:!0}];return a&&(z.push({title:"Type",dataIndex:"contentType",sorter:!0}),z.push({title:"Status",render:(I,_)=>s.jsxs("span",{children:[_.status===0&&s.jsx(l.Tag,{color:"blue",children:"Published"}),_.status===1&&s.jsx(l.Tag,{color:"gold",children:"Draft"}),_.status===2&&s.jsx(l.Tag,{color:"magenta",children:"Trashed"}),_.status===3&&s.jsx(l.Tag,{color:"purple",children:"Published with Pending Updates"})]})})),s.jsxs("div",{children:[s.jsxs(l.Row,{gutter:[16,16],className:"mb-3",children:[s.jsx(l.Col,{xs:12}),s.jsx(l.Col,{xs:12,children:s.jsx(fr,{id:"keyword",placeholder:"search",onSearch:L,enterButton:!0,className:"w-100",value:y,onChange:I=>F(I.target.value),loading:d})}),t&&s.jsx(l.Col,{xs:24,children:s.jsx(l.Button,{type:"primary",className:"mr-2",disabled:O.length===0,onClick:()=>q(),children:"Select"})})]}),s.jsx(l.Table,{dataSource:f,rowKey:I=>I.id,pagination:m,loading:d,size:"middle",className:"clear-both pointer",onChange:Q,expandable:{expandedRowRender:I=>s.jsx("table",{children:s.jsx("tbody",{children:I.meta.values.filter(_=>_.label.toLowerCase().indexOf("url")>-1).map((_,E)=>{let D=_.fullValue??_.value;return D=D?.indexOf("Z")>-1&&X(D).isValid()?fe.dateFormat(D):D,D=D?.replace(/(<([^>]+)>)/gi,"",""),s.jsxs("tr",{children:[s.jsx("td",{style:{verticalAlign:"top",minWidth:150},children:_.label}),s.jsx("td",{children:s.jsx("span",{children:D||""})})]},E)})})})},rowSelection:t&&{type:"checkbox",onChange:$,selectedRowKeys:O,hideSelectAll:!0},onRow:(I,_)=>({onClick:E=>{!t&&q(I)}}),columns:z})]})}const pr=({slug:e,value:t,label:r,opts:n,form:a,onChange:i,references:c,debug:d,isRequired:p,values:f,error:h,errors:b,className:v,placeholder:y,disabled:F})=>{const[k,u]=g.useState(c||[]),[m,N]=g.useState(!1),[C,w]=g.useState(null),O=n.referenceAmount!=="1";if(!e)throw Error("ReferenceInput property: slug required");!t&&f&&f[e]&&(t=f[e]),!h&&b&&b[e]&&(h=b[e]);const V=$=>{const q=$.filter(I=>!k.some(_=>I.id===_.id)),z=k.concat(q);u(z),L(z),N(!1)},Q=$=>{var q=k.findIndex(z=>z.id===$.id);if(q>-1){let z=[...k];z.splice(q,1),u(z),L(z)}},L=$=>{const q=$.map((z,I)=>z.id).join(",");a.setFieldsValue({[e]:q}),i&&i(e,q)};return g.useEffect(()=>{u(c||[])},[c]),g.useEffect(()=>{C&&setShowEdit(!0)},[C]),s.jsxs(l.Form.Item,{label:r,className:v,children:[s.jsxs("div",{className:"text-center",children:[(O||!O&&k.length===0)&&s.jsx(s.Fragment,{children:s.jsx(l.Button,{type:"primary",className:"my-2",onClick:()=>N(!0),children:"Select"})}),k.length>0&&s.jsx(l.Table,{dataSource:k,rowKey:$=>$.id,pagination:!1,size:"middle",className:"clear-both mt-3",columns:[{title:"Title",dataIndex:"title"},{title:"Type",dataIndex:"contentType"},{title:"Status",render:($,q)=>s.jsxs("span",{children:[q.status===0&&s.jsx(l.Tag,{color:"blue",children:"Published"}),q.status===1&&s.jsx(l.Tag,{color:"gold",children:"Draft"}),q.status===2&&s.jsx(l.Tag,{color:"magenta",children:"Trashed"})]})},{title:"",width:"50px",render:($,q)=>s.jsx(l.Popconfirm,{title:"Are you sure you want to delete this?",onConfirm:()=>Q(q),okText:"Yes",cancelText:"No",children:s.jsx(l.Button,{type:"primary",danger:!0,children:s.jsx(He,{})})})}]})]}),s.jsx(l.Form.Item,{name:e,initialValue:t,hidden:!d,rules:[{required:p,message:"Required"}],children:s.jsx(l.Input,{})}),s.jsx(l.Drawer,{open:m,title:"Search References",height:"90%",placement:"bottom",onClose:()=>N(!1),children:s.jsx(mr,{contentTypes:n.referenceTypes,isMany:O,onSuccess:V})})]})},br={hasJsonStructure:Ve,parseJson:yr};function Ve(e){if(typeof e!="string")return!1;try{const t=JSON.parse(e),r=Object.prototype.toString.call(t);return r==="[object Object]"||r==="[object Array]"}catch{return!1}}function yr(e){return Ve(e)?JSON.parse(e):JSON.parse("{}")}const Sr=(e,t)=>{let{properties:r,loading:n,onSubmit:a,hideSubmit:i,onFieldsChange:c,layout:d,entityId:p,debug:f=!1}=e;const[h]=l.Form.useForm(),b=d==="vertical"?24:4,v=d==="vertical"?24:20,y=d==="vertical"?0:4;g.useImperativeHandle(t,()=>({validate(u){h.validateFields().then(m=>{u([])}).catch(m=>{console.log(m),u(m.errorFields)})}})),g.useEffect(()=>{let u=r.reduce((N,C)=>({...N,[C.slug]:C.value}),{});h.setFieldsValue({...u});const m=new URLSearchParams(window.location.search);m.get("utm_source")&&localStorage.setItem("utm_source",m.get("utm_source")),m.get("utm_medium")&&localStorage.setItem("utm_medium",m.get("utm_medium")),m.get("utm_campaign")&&localStorage.setItem("utm_campaign",m.get("utm_campaign")),m.get("utm_term")&&localStorage.setItem("utm_term",m.get("utm_term")),m.get("utm_content")&&localStorage.setItem("utm_content",m.get("utm_content"))},[r]);const F=u=>{for(let N in u)u[N]=Array.isArray(u[N])?JSON.stringify(u[N]):u[N];let m={};localStorage.getItem("utm_source")&&(m.source=localStorage.getItem("utm_source")),localStorage.getItem("utm_medium")&&(m.medium=localStorage.getItem("utm_medium")),localStorage.getItem("utm_campaign")&&(m.campaign=localStorage.getItem("utm_campaign")),localStorage.getItem("utm_term")&&(m.term=localStorage.getItem("utm_term")),localStorage.getItem("utm_content")&&(m.content=localStorage.getItem("utm_content")),a(u,m)},k=u=>{c&&c(u[0].name[0],u[0].value)};return r.length===0?i?s.jsx(s.Fragment,{}):s.jsx("div",{children:"There are no properties at this time."}):s.jsx("div",{children:s.jsxs(l.Form,{form:h,labelCol:{span:b},wrapperCol:{span:v},onFinish:F,onFieldsChange:k,layout:d,children:[r.map((u,m)=>{switch(u.opts=br.parseJson(u.options),u.fieldType){case 1:return s.jsx(l.Form.Item,{label:u.label,name:u.slug,rules:[{required:u.isRequired,message:"Required"},{type:"email",message:"Email is not valid"}],initialValue:u.value?.replaceAll(`
60
+ }`),g.useEffect(()=>{const i=e.current,c=bt(i);mt(a,"@ant-design-icons",{prepend:!n,csp:t,attachTo:c})},[])},G={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};function kt({primaryColor:e,secondaryColor:t}){G.primaryColor=e,G.secondaryColor=t||$e(e),G.calculated=!!t}function Ft(){return{...G}}const K=e=>{const{icon:t,className:r,onClick:n,style:a,primaryColor:i,secondaryColor:c,...d}=e,p=P.useRef(null);let f=G;if(i&&(f={primaryColor:i,secondaryColor:c||$e(i)}),Ct(p),It(ze(t),`icon should be icon definiton, but got ${t}`),!ze(t))return null;let h=t;return h&&typeof h.icon=="function"&&(h={...h,icon:h.icon(f.primaryColor,f.secondaryColor)}),ce(h.icon,`svg-${h.name}`,{className:r,onClick:n,style:a,"data-icon":h.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",...d,ref:p})};K.displayName="IconReact",K.getTwoToneColors=Ft,K.setTwoToneColors=kt;function Ee(e){const[t,r]=De(e);return K.setTwoToneColors({primaryColor:t,secondaryColor:r})}function Nt(){const e=K.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor}function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ue.apply(this,arguments)}Ee(se.primary);const Z=P.forwardRef((e,t)=>{const{className:r,icon:n,spin:a,rotate:i,tabIndex:c,onClick:d,twoToneColor:p,...f}=e,{prefixCls:h="anticon",rootClassName:b}=P.useContext(be),v=rt(b,h,{[`${h}-${n.name}`]:!!n.name,[`${h}-spin`]:!!a||n.name==="loading"},r);let y=c;y===void 0&&d&&(y=-1);const F=i?{msTransform:`rotate(${i}deg)`,transform:`rotate(${i}deg)`}:void 0,[k,u]=De(p);return P.createElement("span",ue({role:"img","aria-label":n.name},f,{ref:t,tabIndex:y,onClick:d,className:v}),P.createElement(K,{icon:n,primaryColor:k,secondaryColor:u,style:F}))});Z.getTwoToneColor=Nt,Z.setTwoToneColor=Ee;var Mt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"};function he(){return he=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},he.apply(this,arguments)}const qt=(e,t)=>P.createElement(Z,he({},e,{ref:t,icon:Mt})),He=P.forwardRef(qt);var zt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM544 472c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v108H372c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h108v108c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V644h108c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V472z"}}]},name:"file-add",theme:"outlined"};function de(){return de=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},de.apply(this,arguments)}const Ot=(e,t)=>P.createElement(Z,de({},e,{ref:t,icon:zt})),$t=P.forwardRef(Ot);var Dt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"}}]},name:"info-circle",theme:"outlined"};function ge(){return ge=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ge.apply(this,arguments)}const Et=(e,t)=>P.createElement(Z,ge({},e,{ref:t,icon:Dt})),Ht=P.forwardRef(Et),Le={get:Lt,getByIdOrSlug:Pt,getMedias:At,download:jt,downloadFromUrl:Vt};function Lt(e){return x.postData("/api/media/search",e,!0)}function Pt(e){return x.getData(`/api/media/${e}`,!0)}function At(e){return x.postData("/api/media/medias",e,!0)}function jt(e){return x.postData("/api/media/download",e)}function Vt(e){return x.postData("/api/media/download/url",e,!0)}const Pe={success:Bt,error:Ut};function Bt(e){l.notification.success({message:Ae[Math.floor(Math.random()*Ae.length)],description:e,duration:3})}function Ut(e){l.notification.error({message:je[Math.floor(Math.random()*je.length)],description:e,duration:3})}let Ae=["Success","Good Job","Excellent","Way to go!","Nice!","That'll do!","That worked!","Ok","Bingo"],je=["Bummer","Something didn't work","Error","Nope","Shucks"];const{Dragger:Kt}=l.Upload;function Yt(e){const t=e.size/1024/1024<200;return t||Pe.error("File must smaller than 200MB"),t}function Jt({onUploaded:e,accept:t,addToMediaLibrary:r,contentId:n,showUploadList:a=!0,multiple:i=!1}){const c=typeof globalThis<"u"?globalThis.process?.env:void 0,d=typeof window<"u",p=d&&typeof localStorage<"u"?localStorage.getItem("gatsbyUser"):null,f=p!==null&&d?JSON.parse(window.atob(p)):null,h=y=>{y.file.status!=="uploading"&&(y.file.status==="done"?e&&e(y.file.response):y.file.status==="error"&&Pe.error(`${y.file.name} file upload failed.`))},b={Authorization:f?.token?"Bearer "+f.token:"",AppKey:c?.STORM_APPKEY};let v=`https://${c?.REACT_APP_WEBAPI_URL_FULL_ACCESS}/api/media/files`;return r&&(v+="?addToMediaLibrary=true",n&&(v+=`&contentId=${n}`)),s.jsx("div",{children:s.jsx(Kt,{name:"files",accept:t,multiple:i,beforeUpload:Yt,action:v,headers:b,showUploadList:a,onChange:h,children:s.jsxs("div",{className:"p-5 m-5",children:[s.jsx("p",{className:"ant-upload-drag-icon",children:s.jsx($t,{})}),s.jsx("p",{className:"ant-upload-text",children:"Click or drag files to this area to upload"}),t!==void 0&&s.jsx("p",{className:"ant-upload-hint",children:`must be only ${t} files`})]})})})}const fe={image:Wt,currency:Gt,numWithComma:Zt,phone:Qt,timeToRead:Xt,timeDiffMinutes:Rt,startEndDateTime:er,dateFormat:tr,getDateFromString:rr};function Wt(e,t){return e?e.indexOf("?")>-1?`${e}&${t}`:`${e}?${t}`:""}function Gt(e){var t=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"});return t.format(e)}function Zt(e){return e.toLocaleString()}function Qt(e){return e=e.toString().replace(/[^0-9]/g,""),e.length===10?e.substring(0,3)+"."+e.substring(3,6)+"."+e.substring(6):e}function Xt(e){return e?Math.ceil(e.split(" ").length/210):0}function Rt(e,t){console.log(e,t);const r=e&&typeof e=="object"?e:Date.parse(e.replace(" ","T")),n=t&&typeof t=="object"?t:Date.parse(t.replace(" ","T")),a=Math.abs(n-r);return Math.floor(a/1e3/60)}function er(e,t="",r=!0){const n={year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"},a={hour:"numeric",minute:"numeric",timeZoneName:"short"},i={year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",timeZoneName:"short"},c=new Intl.DateTimeFormat("en",n),d=new Intl.DateTimeFormat("en",a),p=new Intl.DateTimeFormat("en",i);if(!e)return"";const f=e&&typeof e=="object"?e:Date.parse(e.replace(" ","T")),h=t&&typeof t=="object"?t:Date.parse(t.replace(" ","T"));return!Number.isNaN(f)&&!Number.isNaN(h)?s.jsxs("span",{children:[c.format(f)," - ",d.format(h),r&&s.jsx("br",{})]}):Number.isNaN(f)?Number.isNaN(h)?"":s.jsxs("span",{children:[" ",p.format(h),r&&s.jsx("br",{})]}):s.jsxs("span",{children:[" ",p.format(f),r&&s.jsx("br",{})]})}function tr(e,t="medium",r=!1){const n={weekday:"long",year:"numeric",month:"long",day:"numeric"},a={year:"numeric",month:"long",day:"numeric"},i={year:"numeric",month:"short",day:"numeric"},c={year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",timeZoneName:"short"},d={hour:"numeric",minute:"numeric",timeZoneName:"short"},p=new Intl.DateTimeFormat("en",n),f=new Intl.DateTimeFormat("en",i),h=new Intl.DateTimeFormat("en",c),b=new Intl.DateTimeFormat("en",a),v=new Intl.DateTimeFormat("en",d);if(!e)return"";const y=e&&typeof e=="object"?e:Date.parse(e.replace(" ","T"));return Number.isNaN(y)?"":s.jsxs(s.Fragment,{children:[t==="long"&&p.format(y),t==="short"&&f.format(y),t==="medium"&&b.format(y),t==="datetime"&&h.format(y),t==="time"&&v.format(y),r&&s.jsx("br",{})]})}function rr(e){if(!e)return null;const t=Date.parse(e.replace(" ","T"));return Number.isNaN(t)?null:t}const{Search:nr}=l.Input;function sr({fileTypes:e,contentId:t,isMany:r,onSuccess:n,hideScopeFilter:a=!0,showResizer:i=!1}){const[c,d]=g.useState(!1),[p,f]=g.useState([]),[h,b]=g.useState([]),[v,y]=g.useState(0),[F,k]=g.useState([]),[u,m]=g.useState(""),[N,C]=g.useState("content"),[w,O]=g.useState(a?1:0),[V,Q]=g.useState({id:"createdOn",desc:!0}),[L,$]=g.useState({current:1,pageSize:20,total:0,position:["topRight","bottomRight"],showSizeChanger:!0}),[M,z]=g.useState([]),[_,I]=g.useState(null),[E,D]=g.useState(null);g.useEffect(()=>{d(!1);let T={keyword:u,mediaTypes:F,orderBy:V,pagination:{pageNum:L.current,pageSize:L.pageSize}};T.mediaPurposes=[1],T.contentId=t,Le.get(T).then(S=>{const H={...L};H.total=S.totalRecords,f(S.media),$(H)}).catch(S=>console.log(S)).finally(()=>{d(!1)})},[v,F,N]);const A=(T,S,H)=>{let te={...V};const B={...L};B.pageSize!==T.pageSize?(B.pageSize=T.pageSize,B.current=1):B.current=T.current,H.field&&(te={id:H.field,desc:H.order==="descend"}),$(B),Q(te),y(v+1)},_r=(T,S)=>{let H=T.filter(te=>p.find(B=>B.id===te));z(H)},Ir=T=>{const S={...L};S.current=1,$(S),k(T)},xr=T=>{const S={...L};S.current=1,$(S),C(T.target.value)},me=T=>{if(n){if(T){i&&T.mediaType===0?I(T):n([T]);return}n(p.filter(S=>M.find(H=>H===S.id))),z([])}},Cr=T=>{let S=h.concat(T);b(S)};return s.jsx(l.Tabs,{items:[{label:"Search",key:"1",children:s.jsxs(s.Fragment,{children:[s.jsxs(l.Row,{gutter:[16,16],className:"mb-3",children:[s.jsx(l.Col,{xs:6,children:s.jsxs(l.Select,{mode:"multiple",placeholder:"Select Type",value:F,onChange:Ir,className:"mr-2 w-100",children:[s.jsx(l.Select.Option,{value:0,children:"Image"}),s.jsx(l.Select.Option,{value:1,children:"File"}),s.jsx(l.Select.Option,{value:2,children:"Video"}),s.jsx(l.Select.Option,{value:3,children:"Audio"}),s.jsx(l.Select.Option,{value:4,children:"Embedded"})]})}),s.jsx(l.Col,{xs:6,children:!a&&s.jsxs(l.Radio.Group,{buttonStyle:"solid",value:N,onChange:xr,children:[s.jsx(l.Radio.Button,{value:"global",children:"Global"}),s.jsx(l.Radio.Button,{value:"both",children:"Both"}),s.jsx(l.Radio.Button,{value:"content",children:"Content"})]})}),s.jsx(l.Col,{xs:12,children:s.jsx(nr,{id:"keyword",placeholder:"search",onSearch:()=>y(v+1),enterButton:!0,className:"w-100",value:u,onChange:T=>m(T.target.value),loading:c})}),r&&s.jsx(l.Col,{xs:24,children:s.jsx(l.Button,{type:"primary",className:"mr-2",disabled:M.length===0,onClick:()=>me(),children:"Select"})})]}),s.jsx(l.Table,{dataSource:p,rowKey:T=>T.id,pagination:L,loading:c,size:"middle",className:"clear-both pointer",onChange:A,rowSelection:r&&{type:"checkbox",onChange:_r,selectedRowKeys:M,hideSelectAll:!0},onRow:(T,S)=>({onClick:H=>{!r&&me(T)}}),columns:[{title:"",dataIndex:"thumbnail",width:"6%",responsive:["lg"],render:(T,S)=>s.jsx("img",{src:S.thumbnail,alt:"Thumbnail",className:"img-fluid avatar-50"})},{title:"Title",dataIndex:"title",sorter:!0},{title:"Type",dataIndex:"lastName",sorter:!0,render:(T,S)=>s.jsxs("span",{children:[S.mediaType===0&&s.jsx(l.Tag,{color:"blue",children:"Image"}),S.mediaType===1&&s.jsx(l.Tag,{color:"gold",children:"File"}),S.mediaType===2&&s.jsx(l.Tag,{color:"cyan",children:"Video"}),S.mediaType===3&&s.jsx(l.Tag,{color:"magenta",children:"Audio"}),S.mediaType===4&&s.jsx(l.Tag,{color:"volcano",children:"Embedded"})]})},{title:"Created",dataIndex:"createdOn",sorter:!0,responsive:["xl"],render:(T,S)=>s.jsx("span",{children:fe.dateFormat(S.createdOn)})},{title:"Info",responsive:["lg"],align:"center",render:(T,S)=>s.jsx(l.Button,{type:"secondary",onClick:H=>{H.stopPropagation(),D(S)},children:s.jsx(Ht,{})})}]})]})},{label:"Upload",key:"2",children:s.jsxs(s.Fragment,{children:[s.jsx(Jt,{onUploaded:Cr,multiple:!0,showUploadList:!1,addToMediaLibrary:!0,contentId:w===1?t:0}),s.jsx(l.Table,{dataSource:h,rowKey:T=>T.id,pagination:!1,loading:c,size:"middle",className:"clear-both pointer",onRow:(T,S)=>({onClick:H=>{me(T)}}),columns:[{title:"",dataIndex:"thumbnail",width:"6%",responsive:["md"],render:(T,S)=>s.jsx("img",{src:S.url,alt:"Thumbnail",className:"img-fluid"})},{title:"Title",dataIndex:"title",sorter:!0},{title:"Type",dataIndex:"lastName",sorter:!0,render:(T,S)=>s.jsxs("span",{children:[S.mediaType===0&&s.jsx(l.Tag,{color:"blue",children:"Image"}),S.mediaType===1&&s.jsx(l.Tag,{color:"gold",children:"File"}),S.mediaType===2&&s.jsx(l.Tag,{color:"cyan",children:"Video"}),S.mediaType===3&&s.jsx(l.Tag,{color:"magenta",children:"Audio"}),S.mediaType===4&&s.jsx(l.Tag,{color:"volcano",children:"Embedded"})]})},{title:"Created",dataIndex:"createdOn",sorter:!0,responsive:["xl"],render:(T,S)=>s.jsx("span",{children:fe.dateFormat(S.createdOn)})}]})]})}]})}const ar=({slug:e,value:t,label:r,opts:n,form:a,onChange:i,media:c,debug:d,isRequired:p,contentId:f,className:h})=>{n=n||{uploadLimit:"1",fileTypes:null};const[b,v]=g.useState(c||[]),[y,F]=g.useState(!1),k=n.uploadLimit!=="1";if(!e)throw Error("MediaInput property: slug required");g.useEffect(()=>{if(c?.length>0?v(c):v([]),t&&!c){const C=t.split(",").filter(w=>!isNaN(w)).map(w=>parseInt(w,10));Le.getMedias({ids:C}).then(w=>{v(w)})}},[c]);const u=C=>{const w=b.concat(C);v(w),N(w),F(!1)},m=C=>{var w=b.findIndex(O=>O.id===C.id);if(w>-1){let O=[...b];O.splice(w,1),v(O),N(O)}},N=C=>{const w=C.map((O,V)=>O.id).join(",");a.setFieldsValue({[e]:w}),i&&i(e,w)};return s.jsxs(l.Form.Item,{label:r,className:h,children:[s.jsxs("div",{className:"text-center",children:[(k||!k&&b.length===0)&&s.jsx(l.Button,{type:"primary",className:"my-2",onClick:()=>F(!0),children:"Select"}),b.length>0&&s.jsx(l.Table,{dataSource:b,rowKey:C=>C.id,pagination:!1,size:"middle",className:"clear-both mt-3",columns:[{title:"",dataIndex:"url",render:(C,w)=>s.jsxs("span",{children:[w.mediaType===0&&s.jsx("img",{src:w.url,alt:"Thumbnail",className:"img-fluid avatar-50"}),w.mediaType===1&&s.jsx("img",{src:w.thumbnail,alt:"Thumbnail",className:"img-fluid avatar-50"}),w.mediaType===2&&s.jsx(s.Fragment,{}),w.mediaType===3&&s.jsx(s.Fragment,{}),w.mediaType===4&&s.jsx(s.Fragment,{})]})},{title:"Title",dataIndex:"title",render:(C,w)=>s.jsxs("span",{children:[w.title,w.credit?.length>0&&s.jsx("div",{dangerouslySetInnerHTML:{__html:w.credit},className:"credit"})]})},{title:"Type",dataIndex:"lastName",sorter:!0,render:(C,w)=>s.jsxs("span",{children:[w.mediaType===0&&s.jsx(l.Tag,{color:"blue",children:"Image"}),w.mediaType===1&&s.jsx(l.Tag,{color:"gold",children:"File"}),w.mediaType===2&&s.jsx(l.Tag,{color:"cyan",children:"Video"}),w.mediaType===3&&s.jsx(l.Tag,{color:"magenta",children:"Audio"}),w.mediaType===4&&s.jsx(l.Tag,{color:"volcano",children:"Embedded"})]})},{title:"",width:"50px",render:(C,w)=>s.jsx(l.Popconfirm,{title:"Are you sure you want to delete this?",onConfirm:()=>m(w),okText:"Yes",cancelText:"No",children:s.jsx(l.Button,{type:"primary",danger:!0,children:s.jsx(He,{})})})}]})]}),s.jsx(l.Form.Item,{name:e,initialValue:t,hidden:!d,rules:[{required:p,message:"Required"}],children:s.jsx(l.Input,{})}),s.jsx(l.Drawer,{open:y,title:"Search Media",height:"85%",placement:"bottom",onClose:()=>F(!1),children:s.jsx(sr,{mediaTypes:n.referenceTypes,isMany:k,onSuccess:u,hideScopeFilter:!0,contentId:f})})]})},or={siteSearch:ir,get:lr,search:cr,getForm:ur,getUserContent:hr,getByIdOrSlug:dr,getContentTypeById:gr};function ir(e){return x.postData("/api/content/sitesearch",e,!1)}function lr(e){return x.getData(`/api/content/${e}`,!1)}function cr(e){return x.postData("/api/content/search",e,!0)}function ur(e,t){return x.getData(`/api/content/form/${e}/${t}`,!1)}function hr(e,t){return x.getData(`/api/content/usercontent/?status=${t}&page=${e}`,!0)}function dr(e){return x.getData(`/api/content/${e}`,!0)}function gr(e,t){let r=`/api/content/contenttype/${e}`;return t&&(r+=`/${t}`),x.getData(r,!0)}const{Search:fr}=l.Input;function mr({contentTypes:e,isMany:t,isEcommerce:r,onSuccess:n,showDetails:a=!0,isPreviewable:i=!1,initialStatus:c=[0]}){const[d,p]=g.useState(!1),[f,h]=g.useState([]),[b,v]=g.useState(0),[y,F]=g.useState(""),[k,u]=g.useState({id:"title",desc:!1}),[m,N]=g.useState({current:1,pageSize:20,total:0,position:["topRight","bottomRight"],showSizeChanger:!0}),[C,w]=g.useState(c),[O,V]=g.useState([]);g.useEffect(()=>{p(!1);let _={keyword:y,contentType:e||[],isPreviewable:i,status:C,orderBy:k,pagination:{pageNum:m.current,pageSize:m.pageSize},isEcommerce:r};or.search(_).then(I=>{const E={...m};E.total=I.totalRecords,h(I.content),N(E)}).catch(I=>console.log(I)).finally(()=>{p(!1)})},[b]);const Q=(_,I,E)=>{let D={...k};const A={...m};A.pageSize!==_.pageSize?(A.pageSize=_.pageSize,A.current=1):A.current=_.current,E.field&&(D={id:E.field,desc:E.order==="descend"}),N(A),u(D),v(b+1)},L=()=>{const _={...m};_.current=1,N(_),v(b+1)},$=(_,I)=>{let E=_.filter(D=>f.find(A=>A.id===D));V(E)},M=_=>{if(n){if(_){n([_]);return}n(f.filter(I=>O.find(E=>E===I.id))),V([])}};let z=[{title:"Title",dataIndex:"title",sorter:!0}];return a&&(z.push({title:"Type",dataIndex:"contentType",sorter:!0}),z.push({title:"Status",render:(_,I)=>s.jsxs("span",{children:[I.status===0&&s.jsx(l.Tag,{color:"blue",children:"Published"}),I.status===1&&s.jsx(l.Tag,{color:"gold",children:"Draft"}),I.status===2&&s.jsx(l.Tag,{color:"magenta",children:"Trashed"}),I.status===3&&s.jsx(l.Tag,{color:"purple",children:"Published with Pending Updates"})]})})),s.jsxs("div",{children:[s.jsxs(l.Row,{gutter:[16,16],className:"mb-3",children:[s.jsx(l.Col,{xs:12}),s.jsx(l.Col,{xs:12,children:s.jsx(fr,{id:"keyword",placeholder:"search",onSearch:L,enterButton:!0,className:"w-100",value:y,onChange:_=>F(_.target.value),loading:d})}),t&&s.jsx(l.Col,{xs:24,children:s.jsx(l.Button,{type:"primary",className:"mr-2",disabled:O.length===0,onClick:()=>M(),children:"Select"})})]}),s.jsx(l.Table,{dataSource:f,rowKey:_=>_.id,pagination:m,loading:d,size:"middle",className:"clear-both pointer",onChange:Q,expandable:{expandedRowRender:_=>s.jsx("table",{children:s.jsx("tbody",{children:_.meta.values.filter(I=>I.label.toLowerCase().indexOf("url")>-1).map((I,E)=>{let D=I.fullValue??I.value;return D=D?.indexOf("Z")>-1&&X(D).isValid()?fe.dateFormat(D):D,D=D?.replace(/(<([^>]+)>)/gi,"",""),s.jsxs("tr",{children:[s.jsx("td",{style:{verticalAlign:"top",minWidth:150},children:I.label}),s.jsx("td",{children:s.jsx("span",{children:D||""})})]},E)})})})},rowSelection:t&&{type:"checkbox",onChange:$,selectedRowKeys:O,hideSelectAll:!0},onRow:(_,I)=>({onClick:E=>{!t&&M(_)}}),columns:z})]})}const pr=({slug:e,value:t,label:r,opts:n,form:a,onChange:i,references:c,debug:d,isRequired:p,values:f,error:h,errors:b,className:v,placeholder:y,disabled:F})=>{const[k,u]=g.useState(c||[]),[m,N]=g.useState(!1),[C,w]=g.useState(null),O=n.referenceAmount!=="1";if(!e)throw Error("ReferenceInput property: slug required");!t&&f&&f[e]&&(t=f[e]),!h&&b&&b[e]&&(h=b[e]);const V=$=>{const M=$.filter(_=>!k.some(I=>_.id===I.id)),z=k.concat(M);u(z),L(z),N(!1)},Q=$=>{var M=k.findIndex(z=>z.id===$.id);if(M>-1){let z=[...k];z.splice(M,1),u(z),L(z)}},L=$=>{const M=$.map((z,_)=>z.id).join(",");a.setFieldsValue({[e]:M}),i&&i(e,M)};return g.useEffect(()=>{u(c||[])},[c]),g.useEffect(()=>{C&&setShowEdit(!0)},[C]),s.jsxs(l.Form.Item,{label:r,className:v,children:[s.jsxs("div",{className:"text-center",children:[(O||!O&&k.length===0)&&s.jsx(s.Fragment,{children:s.jsx(l.Button,{type:"primary",className:"my-2",onClick:()=>N(!0),children:"Select"})}),k.length>0&&s.jsx(l.Table,{dataSource:k,rowKey:$=>$.id,pagination:!1,size:"middle",className:"clear-both mt-3",columns:[{title:"Title",dataIndex:"title"},{title:"Type",dataIndex:"contentType"},{title:"Status",render:($,M)=>s.jsxs("span",{children:[M.status===0&&s.jsx(l.Tag,{color:"blue",children:"Published"}),M.status===1&&s.jsx(l.Tag,{color:"gold",children:"Draft"}),M.status===2&&s.jsx(l.Tag,{color:"magenta",children:"Trashed"})]})},{title:"",width:"50px",render:($,M)=>s.jsx(l.Popconfirm,{title:"Are you sure you want to delete this?",onConfirm:()=>Q(M),okText:"Yes",cancelText:"No",children:s.jsx(l.Button,{type:"primary",danger:!0,children:s.jsx(He,{})})})}]})]}),s.jsx(l.Form.Item,{name:e,initialValue:t,hidden:!d,rules:[{required:p,message:"Required"}],children:s.jsx(l.Input,{})}),s.jsx(l.Drawer,{open:m,title:"Search References",height:"90%",placement:"bottom",onClose:()=>N(!1),children:s.jsx(mr,{contentTypes:n.referenceTypes,isMany:O,onSuccess:V})})]})},br={hasJsonStructure:Ve,parseJson:yr};function Ve(e){if(typeof e!="string")return!1;try{const t=JSON.parse(e),r=Object.prototype.toString.call(t);return r==="[object Object]"||r==="[object Array]"}catch{return!1}}function yr(e){return Ve(e)?JSON.parse(e):JSON.parse("{}")}const Sr=(e,t)=>{let{properties:r,loading:n,onSubmit:a,hideSubmit:i,onFieldsChange:c,layout:d,entityId:p,debug:f=!1}=e;const[h]=l.Form.useForm(),b=d==="vertical"?24:4,v=d==="vertical"?24:20,y=d==="vertical"?0:4;g.useImperativeHandle(t,()=>({validate(u){h.validateFields().then(m=>{u([])}).catch(m=>{console.log(m),u(m.errorFields)})}})),g.useEffect(()=>{let u=r.reduce((N,C)=>({...N,[C.slug]:C.value}),{});h.setFieldsValue({...u});const m=new URLSearchParams(window.location.search);m.get("utm_source")&&localStorage.setItem("utm_source",m.get("utm_source")),m.get("utm_medium")&&localStorage.setItem("utm_medium",m.get("utm_medium")),m.get("utm_campaign")&&localStorage.setItem("utm_campaign",m.get("utm_campaign")),m.get("utm_term")&&localStorage.setItem("utm_term",m.get("utm_term")),m.get("utm_content")&&localStorage.setItem("utm_content",m.get("utm_content"))},[r]);const F=u=>{for(let N in u)u[N]=Array.isArray(u[N])?JSON.stringify(u[N]):u[N];let m={};localStorage.getItem("utm_source")&&(m.source=localStorage.getItem("utm_source")),localStorage.getItem("utm_medium")&&(m.medium=localStorage.getItem("utm_medium")),localStorage.getItem("utm_campaign")&&(m.campaign=localStorage.getItem("utm_campaign")),localStorage.getItem("utm_term")&&(m.term=localStorage.getItem("utm_term")),localStorage.getItem("utm_content")&&(m.content=localStorage.getItem("utm_content")),a(u,m)},k=u=>{c&&c(u[0].name[0],u[0].value)};return r.length===0?i?s.jsx(s.Fragment,{}):s.jsx("div",{children:"There are no properties at this time."}):s.jsx("div",{children:s.jsxs(l.Form,{form:h,labelCol:{span:b},wrapperCol:{span:v},onFinish:F,onFieldsChange:k,layout:d,children:[r.map((u,m)=>{switch(u.opts=br.parseJson(u.options),u.fieldType){case 1:return s.jsx(l.Form.Item,{label:u.label,name:u.slug,rules:[{required:u.isRequired,message:"Required"},{type:"email",message:"Email is not valid"}],initialValue:u.value?.replaceAll(`
61
61
  `,"\\n"),children:s.jsx(l.Input,{placeholder:u.opts?.placeholder||""})},m);case 2:return s.jsx(l.Form.Item,{label:u.label,name:u.slug,rules:[{required:u.isRequired,message:"Required"},{type:"url",message:"URL is not valid"}],initialValue:u.value,children:s.jsx(l.Input,{placeholder:u.opts?.placeholder||""})},m);case 3:return s.jsx(l.Form.Item,{label:u.label,name:u.slug,rules:[{required:u.isRequired,message:"Required"},{pattern:/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/,message:"Phone is not valid"}],initialValue:u.value,children:s.jsx(l.Input,{placeholder:u.opts?.placeholder||""})},m);case 4:return s.jsx(l.Form.Item,{label:u.label,name:u.slug,initialValue:u.value,rules:[{required:u.isRequired,message:"Required"}],children:s.jsx(l.Input.Password,{placeholder:u.opts?.placeholder||""})},m);case 5:case 6:return s.jsx(l.Form.Item,{label:u.label,name:u.slug,initialValue:u.value,rules:[{required:u.isRequired,message:"Required"}],children:s.jsx(l.Input.TextArea,{placeholder:u.opts?.placeholder||""})},m);case 7:return u.value=u.value?X(u.value):"",g.createElement(re,{...u,key:m,showTime:!0});case 8:return u.value=u.value?X(u.value):"",g.createElement(re,{...u,key:m});case 9:return u.value=u.value?X(u.value):"",g.createElement(re,{...u,key:m});case 10:return g.createElement(pe,{...u,key:m});case 11:return g.createElement(pe,{...u,key:m,type:"currency"});case 12:return g.createElement(ar,{...u,form:h,onChange:c,key:m,debug:f,contentId:p});case 13:return g.createElement(pr,{...u,form:h,onChange:c,key:m,debug:f});case 14:return s.jsx(s.Fragment,{});case 15:return g.createElement(Re,{...u,key:m});case 16:return g.createElement(Xe,{...u,key:m});case 17:return s.jsx(s.Fragment,{});case 18:return s.jsx(l.Form.Item,{children:s.jsx("div",{dangerouslySetInnerHTML:{__html:u.label}})},m);case 19:return g.createElement(tt,{...u,key:m,debug:f});case 20:return s.jsx(s.Fragment,{});case 21:return s.jsx(s.Fragment,{});case 22:return s.jsx(s.Fragment,{});case 23:return g.createElement(et,{...u,key:m,debug:f});case 24:return s.jsx(l.Form.Item,{label:s.jsx("strong",{className:"mt-3",children:u.label}),name:u.slug,children:s.jsx("hr",{})},m);default:return s.jsx(l.Form.Item,{label:u.label,name:u.slug,initialValue:u.value,rules:[{required:u.isRequired,message:"Required"}],children:s.jsx(l.Input,{placeholder:u.opts?.placeholder||""})},m)}}),!i&&s.jsx(l.Form.Item,{wrapperCol:{span:b,offset:y},children:s.jsx(l.Button,{type:"primary",htmlType:"submit",loading:n,children:"Submit"})})]})})},wr=g.forwardRef(Sr),Be={getForm:vr,submitForm:Tr};function vr(e){return x.getData(`/v1/form/${e}`,!1)}function Tr(e,t=!1){return x.postData("/v1/form/submission",e,t)}return({formId:e,appKey:t})=>{const[r,n]=g.useState(null),[a,i]=g.useState("");g.useEffect(()=>{if(!e){console.log("formId is required to use the StormForm component");return}if(!t){console.log("appKey is required to use the StormForm component");return}localStorage.setItem("appKey",t),Be.getForm(e).then(d=>{n(d)}).catch(d=>{console.error(d)})},[e,t]);const c=(d,p)=>{const f={formId:e,props:d,utmValues:p};Be.submitForm(f).then(h=>{h.type==="redirect"?window.location.href=h.value:i(h.value)}).catch(h=>{console.error(h)})};return r?s.jsxs(s.Fragment,{children:[!a&&s.jsx(wr,{properties:r.properties,onSubmit:c}),a&&s.jsx("div",{className:"text-center",children:s.jsx("div",{dangerouslySetInnerHTML:{__html:a}})})]}):s.jsx(s.Fragment,{})}}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@redapollos/storm-form",
3
3
  "private": false,
4
- "version": "0.2.2",
4
+ "version": "0.2.3",
5
5
  "description": "A form library for StormCMS",
6
6
  "author": "redapollos",
7
7
  "type": "module",