@compill/admin 1.0.92 → 1.0.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.cjs.js +311 -477
  2. package/index.esm.js +246 -404
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var tslib = require('tslib');
6
4
  var jsxRuntime = require('@soperio/jsx-runtime');
7
5
  var api = require('@compill/api');
@@ -28,12 +26,6 @@ var reactQuery = require('@tanstack/react-query');
28
26
  var Image = require('next/image');
29
27
  var auth = require('@compill/auth');
30
28
 
31
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
32
-
33
- var Link__default = /*#__PURE__*/_interopDefaultLegacy(Link);
34
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
35
- var Image__default = /*#__PURE__*/_interopDefaultLegacy(Image);
36
-
37
29
  function SectionTitle(_a) {
38
30
  var {
39
31
  children
@@ -70,20 +62,8 @@ var mdiPublish = "M5,4V6H19V4H5M5,14H9V20H15V14H19L12,7L5,14Z";
70
62
  var mdiPublishOff = "M20.8 22.7L15 16.9V20H9V14H5L8.6 10.4L1.1 3L2.4 1.7L22.1 21.4L20.8 22.7M19 6V4H7.2L9.2 6H19M17.2 14H19L12 7L11.1 7.9L17.2 14Z";
71
63
  var mdiRefresh = "M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z";
72
64
 
73
- function noop() { }
74
-
75
- function isPlainObject(value) {
76
- if (!value || typeof value !== 'object') {
77
- return false;
78
- }
79
- const proto = Object.getPrototypeOf(value);
80
- const hasObjectPrototype = proto === null ||
81
- proto === Object.prototype ||
82
- Object.getPrototypeOf(proto) === null;
83
- if (!hasObjectPrototype) {
84
- return false;
85
- }
86
- return Object.prototype.toString.call(value) === '[object Object]';
65
+ function eq(value, other) {
66
+ return value === other || (Number.isNaN(value) && Number.isNaN(other));
87
67
  }
88
68
 
89
69
  function getSymbols(object) {
@@ -124,8 +104,22 @@ const bigInt64ArrayTag = '[object BigInt64Array]';
124
104
  const float32ArrayTag = '[object Float32Array]';
125
105
  const float64ArrayTag = '[object Float64Array]';
126
106
 
127
- function eq(value, other) {
128
- return value === other || (Number.isNaN(value) && Number.isNaN(other));
107
+ function isArray(value) {
108
+ return Array.isArray(value);
109
+ }
110
+
111
+ function isPlainObject(value) {
112
+ if (!value || typeof value !== 'object') {
113
+ return false;
114
+ }
115
+ const proto = Object.getPrototypeOf(value);
116
+ const hasObjectPrototype = proto === null ||
117
+ proto === Object.prototype ||
118
+ Object.getPrototypeOf(proto) === null;
119
+ if (!hasObjectPrototype) {
120
+ return false;
121
+ }
122
+ return Object.prototype.toString.call(value) === '[object Object]';
129
123
  }
130
124
 
131
125
  function isEqualWith(a, b, areValuesEqual) {
@@ -306,6 +300,8 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
306
300
  }
307
301
  }
308
302
 
303
+ function noop() { }
304
+
309
305
  function isEqual(a, b) {
310
306
  return isEqualWith(a, b, noop);
311
307
  }
@@ -314,10 +310,6 @@ function capitalize(str) {
314
310
  return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());
315
311
  }
316
312
 
317
- function isArray(value) {
318
- return Array.isArray(value);
319
- }
320
-
321
313
  function Breadcrumbs(_a) {
322
314
  var {
323
315
  breadcrumbs
@@ -391,7 +383,7 @@ function BreadcrumbItem({
391
383
  children: [showSeparator && jsxRuntime.jsx(ui.Icon, {
392
384
  path: mdiCircleSmall,
393
385
  mx: "1"
394
- }), jsxRuntime.jsx(Link__default["default"], {
386
+ }), jsxRuntime.jsx(Link, {
395
387
  href: `/${breadcrumb.path || "#"}`,
396
388
  children: jsxRuntime.jsx("span", {
397
389
  // onClick={breadcrumb.path ? handleClick : undefined}
@@ -408,13 +400,13 @@ function DialogButton(_a) {
408
400
  buildDialog
409
401
  } = _a,
410
402
  props = tslib.__rest(_a, ["buildDialog"]);
411
- const [showDialog, setShowDialog] = React__default["default"].useState(false);
412
- const onShowDialog = React__default["default"].useCallback(event => {
403
+ const [showDialog, setShowDialog] = React.useState(false);
404
+ const onShowDialog = React.useCallback(event => {
413
405
  event === null || event === void 0 ? void 0 : event.preventDefault();
414
406
  event === null || event === void 0 ? void 0 : event.stopPropagation();
415
407
  setShowDialog(true);
416
408
  }, [setShowDialog]);
417
- const onCloseDialog = React__default["default"].useCallback(() => {
409
+ const onCloseDialog = React.useCallback(() => {
418
410
  setShowDialog(false);
419
411
  }, [setShowDialog]);
420
412
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
@@ -441,7 +433,7 @@ function ButtonBar(_a) {
441
433
  children: children
442
434
  }));
443
435
  }
444
- const ButtonBarButton = /*#__PURE__*/React__default["default"].forwardRef(function (_a, ref) {
436
+ const ButtonBarButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
445
437
  var {
446
438
  icon,
447
439
  children
@@ -464,7 +456,7 @@ const ButtonBarButton = /*#__PURE__*/React__default["default"].forwardRef(functi
464
456
  }), children]
465
457
  }));
466
458
  });
467
- const ButtonBarSubmitButton = /*#__PURE__*/React__default["default"].forwardRef(function (_a, ref) {
459
+ const ButtonBarSubmitButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
468
460
  var _b;
469
461
  var {
470
462
  useDirty,
@@ -478,10 +470,8 @@ const ButtonBarSubmitButton = /*#__PURE__*/React__default["default"].forwardRef(
478
470
  handleSubmit
479
471
  } = (_b = formik.useFormikContext()) !== null && _b !== void 0 ? _b : {
480
472
  dirty: false,
481
- handleSubmit: undefined,
482
- values: {}
483
- };
484
- const onSubmit = React__default["default"].useCallback(() => handleSubmit(), [handleSubmit]);
473
+ handleSubmit: undefined};
474
+ const onSubmit = React.useCallback(() => handleSubmit(), [handleSubmit]);
485
475
  return jsxRuntime.jsxs(ui.Button, Object.assign({
486
476
  scheme: "dark",
487
477
  size: "sm",
@@ -548,7 +538,7 @@ function NavigateButton(_a) {
548
538
  } = _a,
549
539
  props = tslib.__rest(_a, ["path"]);
550
540
  const navigate = reactRouterDom.useNavigate();
551
- const handleClick = React__default["default"].useCallback(() => {
541
+ const handleClick = React.useCallback(() => {
552
542
  navigate(path);
553
543
  }, [navigate, path]);
554
544
  return jsxRuntime.jsx(ui.Button, Object.assign({
@@ -577,7 +567,7 @@ function PublishButton(_a) {
577
567
  const mutation = api.useInvalidateMutation(isDraft ? api$1.publish : api$1.unpublish, api$1.queryKey, queryId, {
578
568
  networkMode: "always"
579
569
  });
580
- const publish = React__default["default"].useCallback(() => {
570
+ const publish = React.useCallback(() => {
581
571
  mutation.reset();
582
572
  mutation.mutateAsync(queryId).then(() => reactToastify.toast.success(isDraft ? "Published!" : "Unpublished!")).catch(error => reactToastify.toast.error(`Error: ${error}`));
583
573
  }, [mutation, queryId]);
@@ -590,391 +580,238 @@ function PublishButton(_a) {
590
580
  }));
591
581
  }
592
582
 
593
- function _extends() {
594
- _extends = Object.assign ? Object.assign.bind() : function (target) {
595
- for (var i = 1; i < arguments.length; i++) {
596
- var source = arguments[i];
597
- for (var key in source) {
598
- if (Object.prototype.hasOwnProperty.call(source, key)) {
599
- target[key] = source[key];
600
- }
601
- }
602
- }
603
- return target;
604
- };
605
- return _extends.apply(this, arguments);
606
- }
607
-
608
- var reservedModifierKeywords = ['shift', 'alt', 'meta', 'mod', 'ctrl'];
609
- var mappedKeys = {
610
- esc: 'escape',
611
- "return": 'enter',
612
- '.': 'period',
613
- ',': 'comma',
614
- '-': 'slash',
615
- ' ': 'space',
616
- '`': 'backquote',
617
- '#': 'backslash',
618
- '+': 'bracketright',
619
- ShiftLeft: 'shift',
620
- ShiftRight: 'shift',
621
- AltLeft: 'alt',
622
- AltRight: 'alt',
623
- MetaLeft: 'meta',
624
- MetaRight: 'meta',
625
- OSLeft: 'meta',
626
- OSRight: 'meta',
627
- ControlLeft: 'ctrl',
628
- ControlRight: 'ctrl'
583
+ const j = ["shift", "alt", "meta", "mod", "ctrl", "control"], Q = {
584
+ esc: "escape",
585
+ return: "enter",
586
+ left: "arrowleft",
587
+ right: "arrowright",
588
+ up: "arrowup",
589
+ down: "arrowdown",
590
+ ShiftLeft: "shift",
591
+ ShiftRight: "shift",
592
+ AltLeft: "alt",
593
+ AltRight: "alt",
594
+ MetaLeft: "meta",
595
+ MetaRight: "meta",
596
+ OSLeft: "meta",
597
+ OSRight: "meta",
598
+ ControlLeft: "ctrl",
599
+ ControlRight: "ctrl"
629
600
  };
630
- function mapKey(key) {
631
- return (mappedKeys[key] || key).trim().toLowerCase().replace(/key|digit|numpad|arrow/, '');
632
- }
633
- function isHotkeyModifier(key) {
634
- return reservedModifierKeywords.includes(key);
635
- }
636
- function parseKeysHookInput(keys, splitKey) {
637
- if (splitKey === void 0) {
638
- splitKey = ',';
639
- }
640
- return keys.split(splitKey);
641
- }
642
- function parseHotkey(hotkey, combinationKey, description) {
643
- if (combinationKey === void 0) {
644
- combinationKey = '+';
645
- }
646
- var keys = hotkey.toLocaleLowerCase().split(combinationKey).map(function (k) {
647
- return mapKey(k);
648
- });
649
- var modifiers = {
650
- alt: keys.includes('alt'),
651
- ctrl: keys.includes('ctrl') || keys.includes('control'),
652
- shift: keys.includes('shift'),
653
- meta: keys.includes('meta'),
654
- mod: keys.includes('mod')
601
+ function K(e) {
602
+ return (Q[e.trim()] || e.trim()).toLowerCase().replace(/key|digit|numpad/, "");
603
+ }
604
+ function D(e) {
605
+ return j.includes(e);
606
+ }
607
+ function H(e, r = ",") {
608
+ return e.toLowerCase().split(r);
609
+ }
610
+ function P(e, r = "+", o = ">", i = false, u) {
611
+ let n = [], c = false;
612
+ e = e.trim(), e.includes(o) ? (c = true, n = e.toLocaleLowerCase().split(o).map((f) => K(f))) : n = e.toLocaleLowerCase().split(r).map((f) => K(f));
613
+ const y = {
614
+ alt: n.includes("alt"),
615
+ ctrl: n.includes("ctrl") || n.includes("control"),
616
+ shift: n.includes("shift"),
617
+ meta: n.includes("meta"),
618
+ mod: n.includes("mod"),
619
+ useKey: i
620
+ }, d = n.filter((f) => !j.includes(f));
621
+ return {
622
+ ...y,
623
+ keys: d,
624
+ description: u,
625
+ isSequence: c,
626
+ hotkey: e
655
627
  };
656
- var singleCharKeys = keys.filter(function (k) {
657
- return !reservedModifierKeywords.includes(k);
658
- });
659
- return _extends({}, modifiers, {
660
- keys: singleCharKeys,
661
- description: description
662
- });
663
- }
664
-
665
- (function () {
666
- if (typeof document !== 'undefined') {
667
- document.addEventListener('keydown', function (e) {
668
- if (e.key === undefined) {
669
- // Synthetic event (e.g., Chrome autofill). Ignore.
670
- return;
671
- }
672
- pushToCurrentlyPressedKeys([mapKey(e.key), mapKey(e.code)]);
673
- });
674
- document.addEventListener('keyup', function (e) {
675
- if (e.key === undefined) {
676
- // Synthetic event (e.g., Chrome autofill). Ignore.
677
- return;
678
- }
679
- removeFromCurrentlyPressedKeys([mapKey(e.key), mapKey(e.code)]);
680
- });
681
- }
682
- if (typeof window !== 'undefined') {
683
- window.addEventListener('blur', function () {
684
- currentlyPressedKeys.clear();
685
- });
686
- }
687
- })();
688
- var currentlyPressedKeys = /*#__PURE__*/new Set();
689
- // https://github.com/microsoft/TypeScript/issues/17002
690
- function isReadonlyArray(value) {
691
- return Array.isArray(value);
692
- }
693
- function isHotkeyPressed(key, splitKey) {
694
- if (splitKey === void 0) {
695
- splitKey = ',';
696
- }
697
- var hotkeyArray = isReadonlyArray(key) ? key : key.split(splitKey);
698
- return hotkeyArray.every(function (hotkey) {
699
- return currentlyPressedKeys.has(hotkey.trim().toLowerCase());
700
- });
701
- }
702
- function pushToCurrentlyPressedKeys(key) {
703
- var hotkeyArray = Array.isArray(key) ? key : [key];
704
- /*
705
- Due to a weird behavior on macOS we need to clear the set if the user pressed down the meta key and presses another key.
706
- https://stackoverflow.com/questions/11818637/why-does-javascript-drop-keyup-events-when-the-metakey-is-pressed-on-mac-browser
707
- Otherwise the set will hold all ever pressed keys while the meta key is down which leads to wrong results.
708
- */
709
- if (currentlyPressedKeys.has('meta')) {
710
- currentlyPressedKeys.forEach(function (key) {
711
- return !isHotkeyModifier(key) && currentlyPressedKeys["delete"](key.toLowerCase());
712
- });
713
- }
714
- hotkeyArray.forEach(function (hotkey) {
715
- return currentlyPressedKeys.add(hotkey.toLowerCase());
716
- });
717
- }
718
- function removeFromCurrentlyPressedKeys(key) {
719
- var hotkeyArray = Array.isArray(key) ? key : [key];
720
- /*
721
- Due to a weird behavior on macOS we need to clear the set if the user pressed down the meta key and presses another key.
722
- https://stackoverflow.com/questions/11818637/why-does-javascript-drop-keyup-events-when-the-metakey-is-pressed-on-mac-browser
723
- Otherwise the set will hold all ever pressed keys while the meta key is down which leads to wrong results.
724
- */
725
- if (key === 'meta') {
726
- currentlyPressedKeys.clear();
727
- } else {
728
- hotkeyArray.forEach(function (hotkey) {
729
- return currentlyPressedKeys["delete"](hotkey.toLowerCase());
730
- });
731
- }
732
- }
733
-
734
- function maybePreventDefault(e, hotkey, preventDefault) {
735
- if (typeof preventDefault === 'function' && preventDefault(e, hotkey) || preventDefault === true) {
736
- e.preventDefault();
737
- }
738
628
  }
739
- function isHotkeyEnabled(e, hotkey, enabled) {
740
- if (typeof enabled === 'function') {
741
- return enabled(e, hotkey);
742
- }
743
- return enabled === true || enabled === undefined;
744
- }
745
- function isKeyboardEventTriggeredByInput(ev) {
746
- return isHotkeyEnabledOnTag(ev, ['input', 'textarea', 'select']);
747
- }
748
- function isHotkeyEnabledOnTag(_ref, enabledOnTags) {
749
- var target = _ref.target;
750
- if (enabledOnTags === void 0) {
751
- enabledOnTags = false;
752
- }
753
- var targetTagName = target && target.tagName;
754
- if (isReadonlyArray(enabledOnTags)) {
755
- return Boolean(targetTagName && enabledOnTags && enabledOnTags.some(function (tag) {
756
- return tag.toLowerCase() === targetTagName.toLowerCase();
757
- }));
758
- }
759
- return Boolean(targetTagName && enabledOnTags && enabledOnTags === true);
760
- }
761
- function isScopeActive(activeScopes, scopes) {
762
- if (activeScopes.length === 0 && scopes) {
763
- console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>');
629
+ typeof document < "u" && (document.addEventListener("keydown", (e) => {
630
+ e.code !== void 0 && I([K(e.code)]);
631
+ }), document.addEventListener("keyup", (e) => {
632
+ e.code !== void 0 && _([K(e.code)]);
633
+ })), typeof window < "u" && (window.addEventListener("blur", () => {
634
+ L.clear();
635
+ }), window.addEventListener("contextmenu", () => {
636
+ setTimeout(() => {
637
+ L.clear();
638
+ }, 0);
639
+ }));
640
+ const L = /* @__PURE__ */ new Set();
641
+ function R(e) {
642
+ return Array.isArray(e);
643
+ }
644
+ function U(e, r = ",") {
645
+ return (R(e) ? e : e.split(r)).every((i) => L.has(i.trim().toLowerCase()));
646
+ }
647
+ function I(e) {
648
+ const r = Array.isArray(e) ? e : [e];
649
+ L.has("meta") && L.forEach((o) => !D(o) && L.delete(o.toLowerCase())), r.forEach((o) => L.add(o.toLowerCase()));
650
+ }
651
+ function _(e) {
652
+ const r = Array.isArray(e) ? e : [e];
653
+ e === "meta" ? L.clear() : r.forEach((o) => L.delete(o.toLowerCase()));
654
+ }
655
+ function V(e, r, o) {
656
+ (typeof o == "function" && o(e, r) || o === true) && e.preventDefault();
657
+ }
658
+ function X(e, r, o) {
659
+ return typeof o == "function" ? o(e, r) : o === true || o === void 0;
660
+ }
661
+ const Y = [
662
+ "input",
663
+ "textarea",
664
+ "select",
665
+ "searchbox",
666
+ "slider",
667
+ "spinbutton",
668
+ "menuitem",
669
+ "menuitemcheckbox",
670
+ "menuitemradio",
671
+ "option",
672
+ "radio",
673
+ "textbox"
674
+ ];
675
+ function Z(e) {
676
+ return F(e, Y);
677
+ }
678
+ function F(e, r = false) {
679
+ const { target: o, composed: i } = e;
680
+ let u, n;
681
+ return ee(o) && i ? (u = e.composedPath()[0] && e.composedPath()[0].tagName, n = e.composedPath()[0] && e.composedPath()[0].role) : (u = o && o.tagName, n = o && o.role), R(r) ? !!(u && r && r.some((c) => c.toLowerCase() === u.toLowerCase() || c === n)) : !!(u && r && r);
682
+ }
683
+ function ee(e) {
684
+ return !!e.tagName && !e.tagName.startsWith("-") && e.tagName.includes("-");
685
+ }
686
+ function te(e, r) {
687
+ return e.length === 0 && r ? (console.warn(
688
+ 'A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'
689
+ ), true) : r ? e.some((o) => r.includes(o)) || e.includes("*") : true;
690
+ }
691
+ const re = (e, r, o = false) => {
692
+ const { alt: i, meta: u, mod: n, shift: c, ctrl: y, keys: d, useKey: f } = r, { code: p, key: t, ctrlKey: a, metaKey: l, shiftKey: g, altKey: k } = e, m = K(p);
693
+ if (f && d?.length === 1 && d.includes(t))
764
694
  return true;
765
- }
766
- if (!scopes) {
767
- return true;
768
- }
769
- return activeScopes.some(function (scope) {
770
- return scopes.includes(scope);
771
- }) || activeScopes.includes('*');
772
- }
773
- var isHotkeyMatchingKeyboardEvent = function isHotkeyMatchingKeyboardEvent(e, hotkey, ignoreModifiers) {
774
- if (ignoreModifiers === void 0) {
775
- ignoreModifiers = false;
776
- }
777
- var alt = hotkey.alt,
778
- meta = hotkey.meta,
779
- mod = hotkey.mod,
780
- shift = hotkey.shift,
781
- ctrl = hotkey.ctrl,
782
- keys = hotkey.keys;
783
- var pressedKeyUppercase = e.key,
784
- code = e.code,
785
- ctrlKey = e.ctrlKey,
786
- metaKey = e.metaKey,
787
- shiftKey = e.shiftKey,
788
- altKey = e.altKey;
789
- var keyCode = mapKey(code);
790
- var pressedKey = pressedKeyUppercase.toLowerCase();
791
- if (!(keys != null && keys.includes(keyCode)) && !(keys != null && keys.includes(pressedKey)) && !['ctrl', 'control', 'unknown', 'meta', 'alt', 'shift', 'os'].includes(keyCode)) {
695
+ if (!d?.includes(m) && !["ctrl", "control", "unknown", "meta", "alt", "shift", "os"].includes(m))
792
696
  return false;
793
- }
794
- if (!ignoreModifiers) {
795
- // We check the pressed keys for compatibility with the keyup event. In keyup events the modifier flags are not set.
796
- if (alt === !altKey && pressedKey !== 'alt') {
797
- return false;
798
- }
799
- if (shift === !shiftKey && pressedKey !== 'shift') {
697
+ if (!o) {
698
+ if (i !== k && m !== "alt" || c !== g && m !== "shift")
800
699
  return false;
801
- }
802
- // Mod is a special key name that is checking for meta on macOS and ctrl on other platforms
803
- if (mod) {
804
- if (!metaKey && !ctrlKey) {
805
- return false;
806
- }
807
- } else {
808
- if (meta === !metaKey && pressedKey !== 'meta' && pressedKey !== 'os') {
700
+ if (n) {
701
+ if (!l && !a)
809
702
  return false;
810
- }
811
- if (ctrl === !ctrlKey && pressedKey !== 'ctrl' && pressedKey !== 'control') {
812
- return false;
813
- }
814
- }
815
- }
816
- // All modifiers are correct, now check the key
817
- // If the key is set, we check for the key
818
- if (keys && keys.length === 1 && (keys.includes(pressedKey) || keys.includes(keyCode))) {
819
- return true;
820
- } else if (keys) {
821
- // Check if all keys are present in pressedDownKeys set
822
- return isHotkeyPressed(keys);
823
- } else if (!keys) {
824
- // If the key is not set, we only listen for modifiers, that check went alright, so we return true
825
- return true;
703
+ } else if (u !== l && m !== "meta" && m !== "os" || y !== a && m !== "ctrl" && m !== "control")
704
+ return false;
826
705
  }
827
- // There is nothing that matches.
828
- return false;
829
- };
830
-
831
- var BoundHotkeysProxyProvider = /*#__PURE__*/React.createContext(undefined);
832
- var useBoundHotkeysProxy = function useBoundHotkeysProxy() {
833
- return React.useContext(BoundHotkeysProxyProvider);
834
- };
835
-
836
- function deepEqual(x, y) {
837
- //@ts-ignore
838
- return x && y && typeof x === 'object' && typeof y === 'object' ? Object.keys(x).length === Object.keys(y).length &&
839
- //@ts-ignore
840
- Object.keys(x).reduce(function (isEqual, key) {
841
- return isEqual && deepEqual(x[key], y[key]);
842
- }, true) : x === y;
706
+ return d && d.length === 1 && d.includes(m) ? true : d ? U(d) : !d;
707
+ }, $ = React.createContext(void 0), oe = () => React.useContext($);
708
+ function x(e, r) {
709
+ return e && r && typeof e == "object" && typeof r == "object" ? Object.keys(e).length === Object.keys(r).length && // @ts-expect-error TS7053
710
+ Object.keys(e).reduce((o, i) => o && x(e[i], r[i]), true) : e === r;
843
711
  }
844
-
845
- var HotkeysContext = /*#__PURE__*/React.createContext({
712
+ const W = React.createContext({
846
713
  hotkeys: [],
847
- enabledScopes: [],
848
- toggleScope: function toggleScope() {},
849
- enableScope: function enableScope() {},
850
- disableScope: function disableScope() {}
851
- });
852
- var useHotkeysContext = function useHotkeysContext() {
853
- return React.useContext(HotkeysContext);
854
- };
855
-
856
- function useDeepEqualMemo(value) {
857
- var ref = React.useRef(undefined);
858
- if (!deepEqual(ref.current, value)) {
859
- ref.current = value;
860
- }
861
- return ref.current;
862
- }
863
-
864
- var stopPropagation = function stopPropagation(e) {
865
- e.stopPropagation();
866
- e.preventDefault();
867
- e.stopImmediatePropagation();
868
- };
869
- var useSafeLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
870
- function useHotkeys(keys, callback, options, dependencies) {
871
- var ref = React.useRef(null);
872
- var hasTriggeredRef = React.useRef(false);
873
- var _options = !(options instanceof Array) ? options : !(dependencies instanceof Array) ? dependencies : undefined;
874
- var _keys = isReadonlyArray(keys) ? keys.join(_options == null ? void 0 : _options.splitKey) : keys;
875
- var _deps = options instanceof Array ? options : dependencies instanceof Array ? dependencies : undefined;
876
- var memoisedCB = React.useCallback(callback, _deps != null ? _deps : []);
877
- var cbRef = React.useRef(memoisedCB);
878
- if (_deps) {
879
- cbRef.current = memoisedCB;
880
- } else {
881
- cbRef.current = callback;
714
+ activeScopes: [],
715
+ // This array has to be empty instead of containing '*' as default, to check if the provider is set or not
716
+ toggleScope: () => {
717
+ },
718
+ enableScope: () => {
719
+ },
720
+ disableScope: () => {
882
721
  }
883
- var memoisedOptions = useDeepEqualMemo(_options);
884
- var _useHotkeysContext = useHotkeysContext(),
885
- enabledScopes = _useHotkeysContext.enabledScopes;
886
- var proxy = useBoundHotkeysProxy();
887
- useSafeLayoutEffect(function () {
888
- if ((memoisedOptions == null ? void 0 : memoisedOptions.enabled) === false || !isScopeActive(enabledScopes, memoisedOptions == null ? void 0 : memoisedOptions.scopes)) {
722
+ }), se = () => React.useContext(W);
723
+ function ie(e) {
724
+ const r = React.useRef(void 0);
725
+ return x(r.current, e) || (r.current = e), r.current;
726
+ }
727
+ const N = (e) => {
728
+ e.stopPropagation(), e.preventDefault(), e.stopImmediatePropagation();
729
+ }, ue = typeof window < "u" ? React.useLayoutEffect : React.useEffect;
730
+ function fe(e, r, o, i) {
731
+ const u = React.useRef(null), n = React.useRef(false), c = Array.isArray(o) ? Array.isArray(i) ? void 0 : i : o, y = R(e) ? e.join(c?.delimiter) : e, d = Array.isArray(o) ? o : Array.isArray(i) ? i : void 0, f = React.useCallback(r, d ?? []), p = React.useRef(f);
732
+ d ? p.current = f : p.current = r;
733
+ const t = ie(c), { activeScopes: a } = se(), l = oe();
734
+ return ue(() => {
735
+ if (t?.enabled === false || !te(a, t?.scopes))
889
736
  return;
890
- }
891
- var listener = function listener(e, isKeyUp) {
892
- var _e$target;
893
- if (isKeyUp === void 0) {
894
- isKeyUp = false;
895
- }
896
- if (isKeyboardEventTriggeredByInput(e) && !isHotkeyEnabledOnTag(e, memoisedOptions == null ? void 0 : memoisedOptions.enableOnFormTags)) {
897
- return;
898
- }
899
- // TODO: SINCE THE EVENT IS NOW ATTACHED TO THE REF, THE ACTIVE ELEMENT CAN NEVER BE INSIDE THE REF. THE HOTKEY ONLY TRIGGERS IF THE
900
- // REF IS THE ACTIVE ELEMENT. THIS IS A PROBLEM SINCE FOCUSED SUB COMPONENTS WON'T TRIGGER THE HOTKEY.
901
- if (ref.current !== null) {
902
- var rootNode = ref.current.getRootNode();
903
- if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement !== ref.current && !ref.current.contains(rootNode.activeElement)) {
904
- stopPropagation(e);
905
- return;
906
- }
907
- }
908
- if ((_e$target = e.target) != null && _e$target.isContentEditable && !(memoisedOptions != null && memoisedOptions.enableOnContentEditable)) {
909
- return;
910
- }
911
- parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) {
912
- var _hotkey$keys;
913
- var hotkey = parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey);
914
- if (isHotkeyMatchingKeyboardEvent(e, hotkey, memoisedOptions == null ? void 0 : memoisedOptions.ignoreModifiers) || (_hotkey$keys = hotkey.keys) != null && _hotkey$keys.includes('*')) {
915
- if (memoisedOptions != null && memoisedOptions.ignoreEventWhen != null && memoisedOptions.ignoreEventWhen(e)) {
737
+ let g = [], k;
738
+ const m = (s, B = false) => {
739
+ if (!(Z(s) && !F(s, t?.enableOnFormTags))) {
740
+ if (u.current !== null) {
741
+ const v = u.current.getRootNode();
742
+ if ((v instanceof Document || v instanceof ShadowRoot) && v.activeElement !== u.current && !u.current.contains(v.activeElement)) {
743
+ N(s);
916
744
  return;
917
745
  }
918
- if (isKeyUp && hasTriggeredRef.current) {
919
- return;
920
- }
921
- maybePreventDefault(e, hotkey, memoisedOptions == null ? void 0 : memoisedOptions.preventDefault);
922
- if (!isHotkeyEnabled(e, hotkey, memoisedOptions == null ? void 0 : memoisedOptions.enabled)) {
923
- stopPropagation(e);
746
+ }
747
+ s.target?.isContentEditable && !t?.enableOnContentEditable || H(y, t?.delimiter).forEach((v) => {
748
+ if (v.includes(t?.splitKey ?? "+") && v.includes(t?.sequenceSplitKey ?? ">")) {
749
+ console.warn(
750
+ `Hotkey ${v} contains both ${t?.splitKey ?? "+"} and ${t?.sequenceSplitKey ?? ">"} which is not supported.`
751
+ );
924
752
  return;
925
753
  }
926
- // Execute the user callback for that hotkey
927
- cbRef.current(e, hotkey);
928
- if (!isKeyUp) {
929
- hasTriggeredRef.current = true;
754
+ const h = P(
755
+ v,
756
+ t?.splitKey,
757
+ t?.sequenceSplitKey,
758
+ t?.useKey,
759
+ t?.description
760
+ );
761
+ if (h.isSequence) {
762
+ k = setTimeout(() => {
763
+ g = [];
764
+ }, t?.sequenceTimeoutMs ?? 1e3);
765
+ const C = h.useKey ? s.key : K(s.code);
766
+ if (D(C.toLowerCase()))
767
+ return;
768
+ g.push(C);
769
+ const G = h.keys?.[g.length - 1];
770
+ if (C !== G) {
771
+ g = [], k && clearTimeout(k);
772
+ return;
773
+ }
774
+ g.length === h.keys?.length && (p.current(s, h), k && clearTimeout(k), g = []);
775
+ } else if (re(s, h, t?.ignoreModifiers) || h.keys?.includes("*")) {
776
+ if (t?.ignoreEventWhen?.(s) || B && n.current)
777
+ return;
778
+ if (V(s, h, t?.preventDefault), !X(s, h, t?.enabled)) {
779
+ N(s);
780
+ return;
781
+ }
782
+ p.current(s, h), B || (n.current = true);
930
783
  }
931
- }
932
- });
933
- };
934
- var handleKeyDown = function handleKeyDown(event) {
935
- if (event.key === undefined) {
936
- // Synthetic event (e.g., Chrome autofill). Ignore.
937
- return;
938
- }
939
- pushToCurrentlyPressedKeys(mapKey(event.code));
940
- if ((memoisedOptions == null ? void 0 : memoisedOptions.keydown) === undefined && (memoisedOptions == null ? void 0 : memoisedOptions.keyup) !== true || memoisedOptions != null && memoisedOptions.keydown) {
941
- listener(event);
942
- }
943
- };
944
- var handleKeyUp = function handleKeyUp(event) {
945
- if (event.key === undefined) {
946
- // Synthetic event (e.g., Chrome autofill). Ignore.
947
- return;
948
- }
949
- removeFromCurrentlyPressedKeys(mapKey(event.code));
950
- hasTriggeredRef.current = false;
951
- if (memoisedOptions != null && memoisedOptions.keyup) {
952
- listener(event, true);
953
- }
954
- };
955
- var domNode = ref.current || (_options == null ? void 0 : _options.document) || document;
956
- // @ts-ignore
957
- domNode.addEventListener('keyup', handleKeyUp);
958
- // @ts-ignore
959
- domNode.addEventListener('keydown', handleKeyDown);
960
- if (proxy) {
961
- parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) {
962
- return proxy.addHotkey(parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey, memoisedOptions == null ? void 0 : memoisedOptions.description));
963
- });
964
- }
965
- return function () {
966
- // @ts-ignore
967
- domNode.removeEventListener('keyup', handleKeyUp);
968
- // @ts-ignore
969
- domNode.removeEventListener('keydown', handleKeyDown);
970
- if (proxy) {
971
- parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) {
972
- return proxy.removeHotkey(parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey, memoisedOptions == null ? void 0 : memoisedOptions.description));
973
784
  });
974
785
  }
786
+ }, O = (s) => {
787
+ s.code !== void 0 && (I(K(s.code)), (t?.keydown === void 0 && t?.keyup !== true || t?.keydown) && m(s));
788
+ }, q = (s) => {
789
+ s.code !== void 0 && (_(K(s.code)), n.current = false, t?.keyup && m(s, true));
790
+ }, E = u.current || c?.document || document;
791
+ return E.addEventListener("keyup", q, c?.eventListenerOptions), E.addEventListener("keydown", O, c?.eventListenerOptions), l && H(y, t?.delimiter).forEach(
792
+ (s) => l.addHotkey(
793
+ P(
794
+ s,
795
+ t?.splitKey,
796
+ t?.sequenceSplitKey,
797
+ t?.useKey,
798
+ t?.description
799
+ )
800
+ )
801
+ ), () => {
802
+ E.removeEventListener("keyup", q, c?.eventListenerOptions), E.removeEventListener("keydown", O, c?.eventListenerOptions), l && H(y, t?.delimiter).forEach(
803
+ (s) => l.removeHotkey(
804
+ P(
805
+ s,
806
+ t?.splitKey,
807
+ t?.sequenceSplitKey,
808
+ t?.useKey,
809
+ t?.description
810
+ )
811
+ )
812
+ ), g = [], k && clearTimeout(k);
975
813
  };
976
- }, [_keys, memoisedOptions, enabledScopes]);
977
- return ref;
814
+ }, [y, t, a]), u;
978
815
  }
979
816
 
980
817
  function UpdateButton(_a) {
@@ -985,10 +822,8 @@ function UpdateButton(_a) {
985
822
  handleSubmit
986
823
  } = (_b = formik.useFormikContext()) !== null && _b !== void 0 ? _b : {
987
824
  dirty: false,
988
- handleSubmit: undefined,
989
- values: {}
990
- };
991
- useHotkeys('ctrl+s', () => {
825
+ handleSubmit: undefined};
826
+ fe('ctrl+s', () => {
992
827
  if (dirty && !props.disabled) handleSubmit();
993
828
  }, {
994
829
  preventDefault: true
@@ -1007,14 +842,10 @@ function ViewButton(_a) {
1007
842
  icon
1008
843
  } = _a,
1009
844
  props = tslib.__rest(_a, ["label", "path", "icon"]);
1010
- const openPage = React__default["default"].useCallback(() => {
845
+ const openPage = React.useCallback(() => {
1011
846
  window.open(path, '_blank');
1012
847
  }, [path]);
1013
848
  return jsxRuntime.jsx(admin.ButtonBarButton, Object.assign({
1014
- type: "submit",
1015
- scheme: "dark",
1016
- variant: "glass",
1017
- size: "md",
1018
849
  onClick: openPage,
1019
850
  dflex: true,
1020
851
  alignItems: "center",
@@ -1035,13 +866,13 @@ function OrderCell({
1035
866
  }) {
1036
867
  const mutationDown = api.useInvalidateMutation(api$1.moveDown, api$1.queryKey);
1037
868
  const mutationUp = api.useInvalidateMutation(api$1.moveUp, api$1.queryKey);
1038
- const moveDown = React__default["default"].useCallback(e => {
869
+ const moveDown = React.useCallback(e => {
1039
870
  e.stopPropagation();
1040
871
  mutationDown.mutateAsync(postId).catch(error => {
1041
872
  reactToastify.toast.error(`Error: ${error}`);
1042
873
  });
1043
874
  }, [mutationDown, postId]);
1044
- const moveUp = React__default["default"].useCallback(e => {
875
+ const moveUp = React.useCallback(e => {
1045
876
  e.stopPropagation();
1046
877
  mutationUp.mutateAsync(postId).catch(error => {
1047
878
  reactToastify.toast.error(`Error: ${error}`);
@@ -1147,7 +978,7 @@ function PageQueryStateContainerInner(_a) {
1147
978
  children: apiFn == "get" ? children(data) : children(data)
1148
979
  }));
1149
980
  }
1150
- const PageQueryStateContainer = /*#__PURE__*/React__default["default"].forwardRef(PageQueryStateContainerInner);
981
+ const PageQueryStateContainer = /*#__PURE__*/React.forwardRef(PageQueryStateContainerInner);
1151
982
 
1152
983
  function PageSidebar(_a) {
1153
984
  var {
@@ -1217,7 +1048,7 @@ const [CP, usePageTabbedTopBarContext] = react.createContext();
1217
1048
  function PageTabbedTopBarProvider({
1218
1049
  children
1219
1050
  }) {
1220
- const [containerEl, setContainerEl] = React__default["default"].useState(null);
1051
+ const [containerEl, setContainerEl] = React.useState(null);
1221
1052
  return jsxRuntime.jsx(CP, {
1222
1053
  value: {
1223
1054
  containerEl,
@@ -1233,12 +1064,12 @@ function PageTabbedTopBar(_a) {
1233
1064
  children
1234
1065
  } = _a,
1235
1066
  props = tslib.__rest(_a, ["title", "breadcrumbs", "children"]);
1236
- const ref = /*#__PURE__*/React__default["default"].createRef();
1067
+ const ref = /*#__PURE__*/React.createRef();
1237
1068
  const {
1238
1069
  setContainerEl
1239
1070
  } = usePageTabbedTopBarContext();
1240
- const [isSet, setIsSet] = React__default["default"].useState(false);
1241
- React__default["default"].useEffect(() => {
1071
+ const [isSet, setIsSet] = React.useState(false);
1072
+ React.useEffect(() => {
1242
1073
  if (!isSet && ref.current) {
1243
1074
  setContainerEl(ref.current);
1244
1075
  setIsSet(true);
@@ -1272,14 +1103,14 @@ function PageTopBarToolbar({
1272
1103
  const {
1273
1104
  containerEl
1274
1105
  } = usePageTabbedTopBarContext();
1275
- const [visible, setVisible] = React__default["default"].useState(false);
1276
- const portal = React__default["default"].useMemo(() => {
1106
+ const [visible, setVisible] = React.useState(false);
1107
+ const portal = React.useMemo(() => {
1277
1108
  const node = containerEl; //?.ownerDocument.createElement("div")
1278
1109
  // if (node) node.className = PORTAL_CLASSNAME
1279
1110
  return node;
1280
1111
  }, [containerEl]);
1281
1112
  const host = containerEl !== null && containerEl !== void 0 ? containerEl : typeof window !== "undefined" ? document.body : undefined;
1282
- React__default["default"].useLayoutEffect(() => {
1113
+ React.useLayoutEffect(() => {
1283
1114
  if (!portal || !host) return;
1284
1115
  try {
1285
1116
  if (visible) host.appendChild(portal);else host.removeChild(portal);
@@ -1290,11 +1121,11 @@ function PageTopBarToolbar({
1290
1121
  } catch (e) {}
1291
1122
  };
1292
1123
  }, [visible, portal, host]);
1293
- const callback = React__default["default"].useCallback(entries => {
1124
+ const callback = React.useCallback(entries => {
1294
1125
  // @ts-ignore
1295
1126
  setVisible(entries[0].isVisible);
1296
1127
  }, [children]);
1297
- React__default["default"].useEffect(() => {
1128
+ React.useEffect(() => {
1298
1129
  const opts = {
1299
1130
  root: null,
1300
1131
  rootMargin: '0px',
@@ -1348,7 +1179,7 @@ function Buttons$1({
1348
1179
  }) {
1349
1180
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
1350
1181
  children: [buttonBar && buttonBar.length > 0 && jsxRuntime.jsx(admin.ButtonBar, {
1351
- children: buttonBar.map((button, index) => jsxRuntime.jsxs(React__default["default"].Fragment, {
1182
+ children: buttonBar.map((button, index) => jsxRuntime.jsxs(React.Fragment, {
1352
1183
  children: [button.type === "link" && jsxRuntime.jsx(ViewButton, {
1353
1184
  label: button.label,
1354
1185
  path: button.path,
@@ -1391,7 +1222,7 @@ function DetailsView(_a) {
1391
1222
  } = _a,
1392
1223
  props = tslib.__rest(_a, ["queryField", "api", "useNextRouter", "processInput", "screen", "tabbed"]);
1393
1224
  const id = useQueryField(queryField, useNextRouter);
1394
- const ref = React__default["default"].useRef(null);
1225
+ const ref = React.useRef(null);
1395
1226
  return jsxRuntime.jsx(PageQueryStateContainer, Object.assign({
1396
1227
  api: api,
1397
1228
  apiFn: "get",
@@ -1565,7 +1396,7 @@ function QueryWrapper(_a) {
1565
1396
  const {
1566
1397
  data
1567
1398
  } = api.useApiQuery(mApi.queryKey, fn === "get" || fn === "getTransformed" ? mApi.get : mApi.getAll, react.isFunction(api$1) ? undefined : id);
1568
- const transformedData = React__default["default"].useMemo(() => {
1399
+ const transformedData = React.useMemo(() => {
1569
1400
  if (data && (fn === "getTransformed" || fn === "getAllTransformed")) {
1570
1401
  if (!transformFn) console.warn(`QueryWrapperDialog: you forgot to pass transformFn as parameter for fn ${fn}`);
1571
1402
  return transformFn === null || transformFn === void 0 ? void 0 : transformFn(data);
@@ -1641,11 +1472,11 @@ function TableContainerContextProvider({
1641
1472
  children
1642
1473
  }) {
1643
1474
  var _a, _b;
1644
- const [showFilters, setShowFilters] = React__default["default"].useState(false);
1645
- const [showMassActions, setShowMassActions] = React__default["default"].useState(false);
1646
- const [visibleColumnIds, setVisibleColumnIds] = React__default["default"].useState((_a = initialVisibleColumns !== null && initialVisibleColumns !== void 0 ? initialVisibleColumns : columns === null || columns === void 0 ? void 0 : columns.map(col => getColId(col))) !== null && _a !== void 0 ? _a : []);
1475
+ const [showFilters, setShowFilters] = React.useState(false);
1476
+ const [showMassActions, setShowMassActions] = React.useState(false);
1477
+ const [visibleColumnIds, setVisibleColumnIds] = React.useState((_a = initialVisibleColumns !== null && initialVisibleColumns !== void 0 ? initialVisibleColumns : columns === null || columns === void 0 ? void 0 : columns.map(col => getColId(col))) !== null && _a !== void 0 ? _a : []);
1647
1478
  const filteredColumns = (_b = columns === null || columns === void 0 ? void 0 : columns.filter(col => visibleColumnIds.includes(getColId(col)))) !== null && _b !== void 0 ? _b : [];
1648
- const toggleColumnVisibility = React__default["default"].useCallback(id => {
1479
+ const toggleColumnVisibility = React.useCallback(id => {
1649
1480
  const index = visibleColumnIds.indexOf(id);
1650
1481
  if (index > -1) {
1651
1482
  const newIds = visibleColumnIds.concat();
@@ -1655,7 +1486,7 @@ function TableContainerContextProvider({
1655
1486
  setVisibleColumnIds(visibleColumnIds.concat(id));
1656
1487
  }
1657
1488
  }, [visibleColumnIds, setVisibleColumnIds]);
1658
- const isColumnVisible = React__default["default"].useCallback(id => {
1489
+ const isColumnVisible = React.useCallback(id => {
1659
1490
  return visibleColumnIds.includes(id);
1660
1491
  }, [visibleColumnIds]);
1661
1492
  const Provider = provider$1;
@@ -1833,18 +1664,18 @@ function TableFilters({
1833
1664
  getFilters,
1834
1665
  setFilters
1835
1666
  } = table.useTableContext();
1836
- const handleSubmit = React__default["default"].useCallback((values, actions) => {
1667
+ const handleSubmit = React.useCallback((values, actions) => {
1837
1668
  var _a;
1838
1669
  const params = (_a = processInput === null || processInput === void 0 ? void 0 : processInput(values)) !== null && _a !== void 0 ? _a : values;
1839
1670
  if (!isEqual(params, getFilters())) setFilters(params);
1840
1671
  // setFilters(processInput?.(values) ?? values)
1841
1672
  actions.setSubmitting(false);
1842
1673
  }, [setFilters, processInput]);
1843
- const handleReset = React__default["default"].useCallback(resetForm => {
1674
+ const handleReset = React.useCallback(resetForm => {
1844
1675
  setFilters(initialValues);
1845
1676
  resetForm();
1846
1677
  }, [setFilters, initialValues]);
1847
- React__default["default"].useEffect(() => setFilters(initialValues), []);
1678
+ React.useEffect(() => setFilters(initialValues), []);
1848
1679
  return jsxRuntime.jsx(ui.Collapse, {
1849
1680
  in: showFilters,
1850
1681
  style: {
@@ -2012,14 +1843,14 @@ function ItemEditDialog(_a) {
2012
1843
  error /*, error*/,
2013
1844
  refetch
2014
1845
  } = api.useApiQuery(api$1.queryKey, api$1.get, queryId, Object.assign({
2015
- enabled: !( /*queryId == 0 || */queryId == "" || queryId == null || queryId == undefined),
1846
+ enabled: !(/*queryId == 0 || */queryId == "" || queryId == null || queryId == undefined),
2016
1847
  onError: onFetchError
2017
1848
  }, queryFetchOptions));
2018
1849
  // const [activeTab, setActiveTab] = React.useState(form && Array.isArray(form) ? form[0].key : "");
2019
1850
  // const [showTab, setShowTab] = React.useState(true);
2020
1851
  const mutation = invalidateQueriesOnSuccess ? api.useInvalidateParentMutation(api$1.upsert, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey, querySaveOptions) : api.useApiMutation(api$1.upsert, api$1.queryKey, queryId, querySaveOptions);
2021
- const retry = React__default["default"].useCallback(() => refetch(), [refetch]);
2022
- const saveItem = React__default["default"].useCallback((item, actions) => tslib.__awaiter(this, void 0, void 0, function* () {
1852
+ const retry = React.useCallback(() => refetch(), [refetch]);
1853
+ const saveItem = React.useCallback((item, actions) => tslib.__awaiter(this, void 0, void 0, function* () {
2023
1854
  // Clear mutation error if any
2024
1855
  mutation.reset();
2025
1856
  const formItem = formToQueryData ? formToQueryData(item) : Object.assign({}, item);
@@ -2089,7 +1920,7 @@ function ItemEditDialog(_a) {
2089
1920
  children: [jsxRuntime.jsx(ui.Modal.Body, {
2090
1921
  pb: "6",
2091
1922
  children: jsxRuntime.jsxs(formik.Form, {
2092
- children: [/*#__PURE__*/React__default["default"].isValidElement(form$1) && form$1, Array.isArray(form$1) && jsxRuntime.jsx(form.FormRenderer, {
1923
+ children: [/*#__PURE__*/React.isValidElement(form$1) && form$1, Array.isArray(form$1) && jsxRuntime.jsx(form.FormRenderer, {
2093
1924
  form: form$1
2094
1925
  }), react.isFunction(form$1) && jsxRuntime.jsx(form.FormRenderer, {
2095
1926
  form: form$1(data !== null && data !== void 0 ? data : values)
@@ -2135,7 +1966,7 @@ function QueryWrapperDialog({
2135
1966
  refetchOnMount: false,
2136
1967
  refetchOnWindowFocus: false
2137
1968
  });
2138
- const transformedData = React__default["default"].useMemo(() => {
1969
+ const transformedData = React.useMemo(() => {
2139
1970
  if (data && (fn === "getTransformed" || fn === "getAllTransformed")) {
2140
1971
  if (!transformFn) console.warn(`QueryWrapperDialog: you forgot to pass transformFn as parameter for fn ${fn}`);
2141
1972
  // @ts-ignore
@@ -2172,7 +2003,7 @@ function MultiQueryWrapperDialog({
2172
2003
  staleTime: q.cache === false ? 0 : undefined
2173
2004
  }
2174
2005
  })));
2175
- const transformedData = React__default["default"].useMemo(() => {
2006
+ const transformedData = React.useMemo(() => {
2176
2007
  return data === null || data === void 0 ? void 0 : data.map((d, index) => {
2177
2008
  var _a, _b;
2178
2009
  return queries[index].transformFn ? (_b = (_a = queries[index]) === null || _a === void 0 ? void 0 : _a.transformFn) === null || _b === void 0 ? void 0 : _b.call(_a, d) : d;
@@ -2199,7 +2030,10 @@ function DialogRenderer({
2199
2030
  invalidateQueryKey,
2200
2031
  queryId
2201
2032
  }) {
2202
- const props = tslib.__rest(config, ["type"]);
2033
+ const {
2034
+ type
2035
+ } = config,
2036
+ props = tslib.__rest(config, ["type"]);
2203
2037
  if (config.type === "dialog") return jsxRuntime.jsx(ItemEditDialog, Object.assign({}, props, {
2204
2038
  queryId: queryId,
2205
2039
  invalidateQueryKey: invalidateQueryKey,
@@ -2223,7 +2057,7 @@ function RefreshButton({
2223
2057
  queryKey
2224
2058
  }) {
2225
2059
  const invalidate = api.useInvalidateQuery(queryKey);
2226
- useHotkeys('ctrl+r', () => invalidate(), {
2060
+ fe('ctrl+r', () => invalidate(), {
2227
2061
  preventDefault: true
2228
2062
  }, [invalidate]);
2229
2063
  return jsxRuntime.jsx(ButtonBarButton, {
@@ -2260,7 +2094,7 @@ function ItemDeleteDialog(_a) {
2260
2094
  const mutate = api.useMutate(mutation, {
2261
2095
  onSuccess: () => onClose === null || onClose === void 0 ? void 0 : onClose()
2262
2096
  });
2263
- const handleDelete = React__default["default"].useCallback(() => mutate(queryId), [mutate, queryId]);
2097
+ const handleDelete = React.useCallback(() => mutate(queryId), [mutate, queryId]);
2264
2098
  return jsxRuntime.jsxs(ui.Modal, Object.assign({
2265
2099
  size: size,
2266
2100
  show: show,
@@ -2304,9 +2138,9 @@ function TableViewProvider({
2304
2138
  }) {
2305
2139
  const openLink = hooks.useOpenLink();
2306
2140
  const navigate = reactRouterDom.useNavigate();
2307
- const [dialog, setDialog] = React__default["default"].useState(null);
2308
- const onCloseDialog = React__default["default"].useCallback(() => setDialog(null), [setDialog]);
2309
- const onAction = React__default["default"].useCallback((action, item) => {
2141
+ const [dialog, setDialog] = React.useState(null);
2142
+ const onCloseDialog = React.useCallback(() => setDialog(null), [setDialog]);
2143
+ const onAction = React.useCallback((action, item) => {
2310
2144
  switch (action.type) {
2311
2145
  case "view":
2312
2146
  {
@@ -2447,7 +2281,7 @@ function TableRowPublishPostButton$1(_a) {
2447
2281
  const mutation = api.useInvalidateParentMutation(isDraft ? api$1.publish : api$1.unpublish, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey, {
2448
2282
  networkMode: "always"
2449
2283
  });
2450
- const publish = React__default["default"].useCallback(event => {
2284
+ const publish = React.useCallback(event => {
2451
2285
  event === null || event === void 0 ? void 0 : event.preventDefault();
2452
2286
  event === null || event === void 0 ? void 0 : event.stopPropagation();
2453
2287
  mutation.reset();
@@ -2481,7 +2315,7 @@ function TableRowActionsView({
2481
2315
  alignItems: "stretch",
2482
2316
  placeContent: "end",
2483
2317
  h: "full",
2484
- children: (_a = react.runIfFn(rowActions, item)) === null || _a === void 0 ? void 0 : _a.map((action, index) => jsxRuntime.jsxs(React__default["default"].Fragment, {
2318
+ children: (_a = react.runIfFn(rowActions, item)) === null || _a === void 0 ? void 0 : _a.map((action, index) => jsxRuntime.jsxs(React.Fragment, {
2485
2319
  children: [action.type === "publish" && jsxRuntime.jsx(TableRowPublishPostButton$1, {
2486
2320
  id: item.id,
2487
2321
  api: api,
@@ -2505,7 +2339,7 @@ function ActionButton(_a) {
2505
2339
  onClick
2506
2340
  } = _a,
2507
2341
  props = tslib.__rest(_a, ["onClick"]);
2508
- const handleClick = React__default["default"].useCallback(event => {
2342
+ const handleClick = React.useCallback(event => {
2509
2343
  event === null || event === void 0 ? void 0 : event.preventDefault();
2510
2344
  event === null || event === void 0 ? void 0 : event.stopPropagation();
2511
2345
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
@@ -2543,7 +2377,7 @@ function useTableProps(api, table, rowActions, queryParams) {
2543
2377
  columns: c
2544
2378
  } = table,
2545
2379
  props = tslib.__rest(table, ["onRowClick", "columns"]);
2546
- const onRowClickHandler = React__default["default"].useCallback(item => {
2380
+ const onRowClickHandler = React.useCallback(item => {
2547
2381
  var _a;
2548
2382
  const config = react.runIfFn(onRowClick, item);
2549
2383
  if (config) {
@@ -2566,7 +2400,7 @@ function useTableProps(api, table, rowActions, queryParams) {
2566
2400
  }
2567
2401
  }
2568
2402
  }, [navigate, onRowClick]);
2569
- const columns = React__default["default"].useMemo(() => {
2403
+ const columns = React.useMemo(() => {
2570
2404
  const columns = table.columns.concat([]);
2571
2405
  if (rowActions) {
2572
2406
  columns.push(createColumnHelper().display({
@@ -2691,7 +2525,7 @@ function TableButtonBar({
2691
2525
  api,
2692
2526
  children
2693
2527
  }) {
2694
- const createDialogFn = React__default["default"].useCallback(data => {
2528
+ const createDialogFn = React.useCallback(data => {
2695
2529
  return onClose => {
2696
2530
  var _a;
2697
2531
  const view = (_a = react.runIfFn(createView, data)) !== null && _a !== void 0 ? _a : react.runIfFn(editView, null);
@@ -2708,7 +2542,7 @@ function TableButtonBar({
2708
2542
  return jsxRuntime.jsxs(ButtonBar, {
2709
2543
  children: [jsxRuntime.jsx(RefreshButton, {
2710
2544
  queryKey: queryKey
2711
- }), buttonBar && buttonBar.map((button, index) => jsxRuntime.jsxs(React__default["default"].Fragment, {
2545
+ }), buttonBar && buttonBar.map((button, index) => jsxRuntime.jsxs(React.Fragment, {
2712
2546
  children: [button.type === "create" && editView && jsxRuntime.jsx(TableCreateButton, {
2713
2547
  buildDialog: createDialogFn(button.data),
2714
2548
  icon: button.icon,
@@ -2727,7 +2561,7 @@ function TableWrapper({
2727
2561
  queryParams
2728
2562
  }) {
2729
2563
  const tableProps = useTableProps(api, table$1, rowActions, queryParams);
2730
- const _subtitle = React__default["default"].useMemo(() => {
2564
+ const _subtitle = React.useMemo(() => {
2731
2565
  if (!subtitle) return undefined;
2732
2566
  return data => {
2733
2567
  return jsxRuntime.jsx("div", {
@@ -2789,7 +2623,7 @@ function useQueries(queries) {
2789
2623
  function useInvalidate(queries) {
2790
2624
  const queryClient = reactQuery.useQueryClient();
2791
2625
  const params = reactRouterDom.useParams();
2792
- const invalidate = React__default["default"].useCallback(() => {
2626
+ const invalidate = React.useCallback(() => {
2793
2627
  const queryKeys = [];
2794
2628
  queries.forEach(q => {
2795
2629
  if (!q.queryField || !react.isFunction(q.api)) {
@@ -2972,7 +2806,7 @@ function NextMenuItem(_a) {
2972
2806
  const selected = path == "/" ? pathname == "/" : pathname.startsWith(path.startsWith("/") ? path : `/${path}`);
2973
2807
  const match = path == "/" ? pathname == "/" : pathname == (path.startsWith("/") ? path : `/${path}`);
2974
2808
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
2975
- children: [jsxRuntime.jsxs(Link__default["default"], {
2809
+ children: [jsxRuntime.jsxs(Link, {
2976
2810
  href: path,
2977
2811
  style: {
2978
2812
  position: "relative"
@@ -3048,13 +2882,13 @@ function UserBlock({
3048
2882
  menuConfig,
3049
2883
  path
3050
2884
  }) {
3051
- var _a, _b, _c, _d;
2885
+ var _a, _b;
3052
2886
  const {
3053
2887
  isLoading,
3054
2888
  user
3055
2889
  } = auth.useSessionUser();
3056
2890
  const navigate = reactRouterDom.useNavigate();
3057
- const handleClick = React__default["default"].useCallback(() => navigate(path), [navigate, path]);
2891
+ const handleClick = React.useCallback(() => navigate(path), [navigate, path]);
3058
2892
  if (isLoading) return null;
3059
2893
  return jsxRuntime.jsxs("div", {
3060
2894
  dflex: true,
@@ -3076,7 +2910,7 @@ function UserBlock({
3076
2910
  }), jsxRuntime.jsx("span", {
3077
2911
  flexGrow: true,
3078
2912
  ms: "2",
3079
- children: `${capitalize((_d = (_c = user === null || user === void 0 ? void 0 : user.firstname) !== null && _c !== void 0 ? _c : user === null || user === void 0 ? void 0 : user.lastname) !== null && _d !== void 0 ? _d : "Jonathan")}`
2913
+ children: `${capitalize((user === null || user === void 0 ? void 0 : user.firstname) || (user === null || user === void 0 ? void 0 : user.lastname) || "")}`
3080
2914
  }), jsxRuntime.jsx(ui.IconButton, {
3081
2915
  variant: "borderless",
3082
2916
  corners: "pill",
@@ -3098,7 +2932,7 @@ function OverflowMenu({
3098
2932
  darkMode,
3099
2933
  menuConfig
3100
2934
  }) {
3101
- const [showPopup, setShowPopup] = React__default["default"].useState(false);
2935
+ const [showPopup, setShowPopup] = React.useState(false);
3102
2936
  const navigate = reactRouterDom.useNavigate();
3103
2937
  const logout = auth.useSessionLogout(false);
3104
2938
  return jsxRuntime.jsx(jsxRuntime.Fragment, {
@@ -3156,7 +2990,7 @@ function MenuItem(_a) {
3156
2990
  children
3157
2991
  } = _a,
3158
2992
  props = tslib.__rest(_a, ["icon", "onClick", "children"]);
3159
- const handleClick = React__default["default"].useCallback(e => {
2993
+ const handleClick = React.useCallback(e => {
3160
2994
  e.preventDefault();
3161
2995
  e.stopPropagation();
3162
2996
  onClick === null || onClick === void 0 ? void 0 : onClick(e);
@@ -3216,7 +3050,7 @@ function Sidebar(_a) {
3216
3050
  darkMode: darkMode
3217
3051
  }), jsxRuntime.jsx("h1", {
3218
3052
  textSize: "md",
3219
- children: title !== null && title !== void 0 ? title : env.AppEnv.appName()
3053
+ children: title || env.AppEnv.appName()
3220
3054
  })]
3221
3055
  }), jsxRuntime.jsx(Menu, {
3222
3056
  overflowY: "auto",
@@ -3243,7 +3077,7 @@ function Logo(_a) {
3243
3077
  } = _a,
3244
3078
  props = tslib.__rest(_a, ["width", "height", "darkMode"]);
3245
3079
  return jsxRuntime.jsx("div", Object.assign({}, props, {
3246
- children: jsxRuntime.jsx(Image__default["default"], {
3080
+ children: jsxRuntime.jsx(Image, {
3247
3081
  src: `/logo_${darkMode ? "light" : "dark"}.png`,
3248
3082
  alt: env.AppEnv.appName(),
3249
3083
  width: width,
@@ -3302,7 +3136,7 @@ function LeftPanel({
3302
3136
  userSettingsPath
3303
3137
  }) {
3304
3138
  const [isOpen, __, toggle] = hooks.useBoolean(true);
3305
- useHotkeys('ctrl+t', () => toggle(), [toggle]);
3139
+ fe('ctrl+t', () => toggle(), [toggle]);
3306
3140
  return jsxRuntime.jsxs("div", {
3307
3141
  ms: isOpen ? "0" : "-14.5rem",
3308
3142
  transition: "all",
@@ -3376,11 +3210,11 @@ function AttachDialog(_a) {
3376
3210
  refetch: refetchAll,
3377
3211
  error: errorAll
3378
3212
  } = api.useApiQuery(queryFetchAllKey, queryFetchAllFn);
3379
- const [selectedResources, setSelectedResources] = React__default["default"].useState([]);
3213
+ const [selectedResources, setSelectedResources] = React.useState([]);
3380
3214
  const isLoading = fetchLoading || fetchAllLoading;
3381
3215
  const isError = fetchError || fetchAllError;
3382
3216
  const mutation = api.useApiMutation(querySaveFn, queryKey, queryId);
3383
- const handleClick = React__default["default"].useCallback(event => {
3217
+ const handleClick = React.useCallback(event => {
3384
3218
  var _a;
3385
3219
  const id = (_a = event === null || event === void 0 ? void 0 : event.currentTarget.dataset.id) !== null && _a !== void 0 ? _a : "";
3386
3220
  const arr = selectedResources.concat([]);
@@ -3388,11 +3222,11 @@ function AttachDialog(_a) {
3388
3222
  if (i != -1) arr.splice(i, 1);else arr.push(id);
3389
3223
  setSelectedResources(arr);
3390
3224
  }, [selectedResources, setSelectedResources]);
3391
- const retry = React__default["default"].useCallback(() => {
3225
+ const retry = React.useCallback(() => {
3392
3226
  if (fetchError) refetch();
3393
3227
  if (fetchAllError) refetchAll();
3394
3228
  }, [refetch, refetchAll, fetchError, fetchAllError]);
3395
- const saveItem = React__default["default"].useCallback(() => {
3229
+ const saveItem = React.useCallback(() => {
3396
3230
  // Clear mutation error if any
3397
3231
  mutation.reset();
3398
3232
  mutation.mutateAsync({
@@ -3409,7 +3243,7 @@ function AttachDialog(_a) {
3409
3243
  if (onSaveError) onSaveError();else reactToastify.toast.error(`Error adding ${itemLabel}`);
3410
3244
  });
3411
3245
  }, [mutation, queryId, onSuccess, queryClient, onSaveError, onClose]);
3412
- const resources = React__default["default"].useMemo(() => {
3246
+ const resources = React.useMemo(() => {
3413
3247
  let r = [];
3414
3248
  if (attached && data) {
3415
3249
  r = [].concat(data);
@@ -3557,7 +3391,7 @@ function FormActionDialog(_a) {
3557
3391
  }, formikProps, {
3558
3392
  children: [jsxRuntime.jsxs(ui.Modal.Body, {
3559
3393
  pb: "6",
3560
- children: [/*#__PURE__*/React__default["default"].isValidElement(form$1) && form$1, Array.isArray(form$1) && jsxRuntime.jsx(form.FormRenderer, {
3394
+ children: [/*#__PURE__*/React.isValidElement(form$1) && form$1, Array.isArray(form$1) && jsxRuntime.jsx(form.FormRenderer, {
3561
3395
  form: form$1
3562
3396
  })]
3563
3397
  }), jsxRuntime.jsxs(ui.Modal.Footer, {
@@ -3592,7 +3426,7 @@ function PageSectionTitle(_a) {
3592
3426
  }));
3593
3427
  }
3594
3428
 
3595
- const PageStateContainer = /*#__PURE__*/React__default["default"].forwardRef((_a, ref) => {
3429
+ const PageStateContainer = /*#__PURE__*/React.forwardRef((_a, ref) => {
3596
3430
  var {
3597
3431
  loading = false,
3598
3432
  children
@@ -3691,7 +3525,7 @@ function TableRowViewButton(_a) {
3691
3525
  path
3692
3526
  } = _a,
3693
3527
  props = tslib.__rest(_a, ["path"]);
3694
- const openPage = React__default["default"].useCallback(event => {
3528
+ const openPage = React.useCallback(event => {
3695
3529
  event === null || event === void 0 ? void 0 : event.preventDefault();
3696
3530
  event === null || event === void 0 ? void 0 : event.stopPropagation();
3697
3531
  window.open(`${env.AppEnv.websiteUrl()}/${path}`, '_blank');
@@ -3708,7 +3542,7 @@ function TableRowNavigateButton(_a) {
3708
3542
  } = _a,
3709
3543
  props = tslib.__rest(_a, ["path"]);
3710
3544
  const navigate = reactRouterDom.useNavigate();
3711
- const handleClick = React__default["default"].useCallback(event => {
3545
+ const handleClick = React.useCallback(event => {
3712
3546
  event === null || event === void 0 ? void 0 : event.preventDefault();
3713
3547
  event === null || event === void 0 ? void 0 : event.stopPropagation();
3714
3548
  navigate(`${path}`);
@@ -3807,7 +3641,7 @@ function TableRowPublishPostButton(_a) {
3807
3641
  const mutation = api.useInvalidateParentMutation(isDraft ? api$1.publish : api$1.unpublish, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey, {
3808
3642
  networkMode: "always"
3809
3643
  });
3810
- const publish = React__default["default"].useCallback(event => {
3644
+ const publish = React.useCallback(event => {
3811
3645
  event === null || event === void 0 ? void 0 : event.preventDefault();
3812
3646
  event === null || event === void 0 ? void 0 : event.stopPropagation();
3813
3647
  mutation.reset();