@docsvision/management-console 6.2.1 → 6.2.2-beta.1

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/index.js CHANGED
@@ -3866,10 +3866,10 @@ function mergeSlotProps$1(externalSlotProps, defaultSlotProps) {
3866
3866
  }
3867
3867
  };
3868
3868
  }
3869
- const WarningIcon = createSvgIcon$1(/* @__PURE__ */ jsx("path", {
3869
+ const WarningIcon$1 = createSvgIcon$1(/* @__PURE__ */ jsx("path", {
3870
3870
  d: "M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z"
3871
3871
  }));
3872
- const ErrorIcon$1 = createSvgIcon$1(/* @__PURE__ */ jsx("path", {
3872
+ const ErrorIcon$2 = createSvgIcon$1(/* @__PURE__ */ jsx("path", {
3873
3873
  d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"
3874
3874
  }));
3875
3875
  var AlertType = /* @__PURE__ */ ((AlertType2) => {
@@ -3882,11 +3882,11 @@ function AlertTile(props) {
3882
3882
  switch (props.type) {
3883
3883
  case 0:
3884
3884
  return /* @__PURE__ */ jsxs("span", { className: "alert-tile__icon-wrapper alert-tile__warning-wrapper", children: [
3885
- /* @__PURE__ */ jsx(WarningIcon, { fontSize: "large" }),
3885
+ /* @__PURE__ */ jsx(WarningIcon$1, { fontSize: "large" }),
3886
3886
  props.services.resources.Attention
3887
3887
  ] });
3888
3888
  case 1:
3889
- return /* @__PURE__ */ jsx("span", { className: "alert-tile__icon-wrapper alert-tile__error-wrapper", children: /* @__PURE__ */ jsx(ErrorIcon$1, { fontSize: "large", color: "error" }) });
3889
+ return /* @__PURE__ */ jsx("span", { className: "alert-tile__icon-wrapper alert-tile__error-wrapper", children: /* @__PURE__ */ jsx(ErrorIcon$2, { fontSize: "large", color: "error" }) });
3890
3890
  }
3891
3891
  }
3892
3892
  return /* @__PURE__ */ jsxs("div", { className: "alert-tile", children: [
@@ -37723,7 +37723,7 @@ const theme = createTheme$3({
37723
37723
  }
37724
37724
  }
37725
37725
  });
37726
- const InfoIcon = createSvgIcon$1(/* @__PURE__ */ jsx("path", {
37726
+ const InfoIcon$1 = createSvgIcon$1(/* @__PURE__ */ jsx("path", {
37727
37727
  d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"
37728
37728
  }));
37729
37729
  var ButtonColorModes = /* @__PURE__ */ ((ButtonColorModes2) => {
@@ -37734,11 +37734,11 @@ var ButtonColorModes = /* @__PURE__ */ ((ButtonColorModes2) => {
37734
37734
  function getIconByType(type) {
37735
37735
  switch (type) {
37736
37736
  case "error":
37737
- return /* @__PURE__ */ jsx(ErrorIcon$1, {});
37737
+ return /* @__PURE__ */ jsx(ErrorIcon$2, {});
37738
37738
  case "warning":
37739
- return /* @__PURE__ */ jsx(WarningIcon, {});
37739
+ return /* @__PURE__ */ jsx(WarningIcon$1, {});
37740
37740
  default:
37741
- return /* @__PURE__ */ jsx(InfoIcon, {});
37741
+ return /* @__PURE__ */ jsx(InfoIcon$1, {});
37742
37742
  }
37743
37743
  }
37744
37744
  function getColorByType(type, palette) {
@@ -37826,7 +37826,7 @@ function getCustomButtons(parameters) {
37826
37826
  button.id || "buttonConfirm"
37827
37827
  ));
37828
37828
  }
37829
- const CloseIcon = createSvgIcon$1(/* @__PURE__ */ jsx("path", {
37829
+ const CloseIcon$1 = createSvgIcon$1(/* @__PURE__ */ jsx("path", {
37830
37830
  d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
37831
37831
  }));
37832
37832
  function MessageWindow(props) {
@@ -37864,7 +37864,7 @@ function MessageWindow(props) {
37864
37864
  icon,
37865
37865
  title
37866
37866
  ] }),
37867
- /* @__PURE__ */ jsx(IconButton$3, { "data-testid": "message-window-close-button", onClick: onClose, className: "message-window__close-icon", children: /* @__PURE__ */ jsx(CloseIcon, {}) }),
37867
+ /* @__PURE__ */ jsx(IconButton$3, { "data-testid": "message-window-close-button", onClick: onClose, className: "message-window__close-icon", children: /* @__PURE__ */ jsx(CloseIcon$1, {}) }),
37868
37868
  /* @__PURE__ */ jsx(DialogContent$2, { style: { maxHeight: contentMaxHeight }, "data-testid": "message-window-content", children: content }),
37869
37869
  /* @__PURE__ */ jsx(DialogActions$2, { children: buttons })
37870
37870
  ]
@@ -56896,7 +56896,7 @@ function ClearButton(props) {
56896
56896
  function DeleteIcon$1({ onClick }) {
56897
56897
  return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", version: "1.1", width: "24", height: "24", viewBox: "0 0 24 24", onClick, children: /* @__PURE__ */ jsx("path", { d: "M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z", fill: "#607d8b" }) });
56898
56898
  }
56899
- function ErrorIcon() {
56899
+ function ErrorIcon$1() {
56900
56900
  return /* @__PURE__ */ jsx("svg", { width: "24px", height: "24px", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("g", { "data-name": "Layer 2", children: /* @__PURE__ */ jsxs("g", { "data-name": "close", children: [
56901
56901
  /* @__PURE__ */ jsx("rect", { width: "24", height: "24", transform: "rotate(180 12 12)", opacity: "0" }),
56902
56902
  /* @__PURE__ */ jsx("path", { d: "M13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29-4.3 4.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l4.29-4.3 4.29 4.3a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42z" })
@@ -56904,7 +56904,7 @@ function ErrorIcon() {
56904
56904
  }
56905
56905
  function ErrorBlock({ text, close }) {
56906
56906
  return /* @__PURE__ */ jsxs("div", { className: "error-block", children: [
56907
- /* @__PURE__ */ jsx("div", { className: "error-block__button_close", onClick: close, children: /* @__PURE__ */ jsx(ErrorIcon, {}) }),
56907
+ /* @__PURE__ */ jsx("div", { className: "error-block__button_close", onClick: close, children: /* @__PURE__ */ jsx(ErrorIcon$1, {}) }),
56908
56908
  /* @__PURE__ */ jsx("p", { className: "error-block__text", children: text })
56909
56909
  ] });
56910
56910
  }
@@ -59153,7 +59153,7 @@ function DatabaseSelectionModal(props) {
59153
59153
  children: [
59154
59154
  /* @__PURE__ */ jsxs(DialogTitle, { variant: "h6", className: "database-selection-modal__title", children: [
59155
59155
  resources.ConnectDatabase,
59156
- /* @__PURE__ */ jsx(IconButton$3, { onClick: onCancel, children: /* @__PURE__ */ jsx(CloseIcon, {}) })
59156
+ /* @__PURE__ */ jsx(IconButton$3, { onClick: onCancel, children: /* @__PURE__ */ jsx(CloseIcon$1, {}) })
59157
59157
  ] }),
59158
59158
  /* @__PURE__ */ jsxs(DialogContent$2, { className: "database-selection-modal__content", children: [
59159
59159
  /* @__PURE__ */ jsx(Typography$3, { variant: "body1", className: "database-selection-modal__description", children: resources.SelectDatabasesToConnect }),
@@ -62253,10 +62253,7 @@ function NumberComponent(props) {
62253
62253
  }
62254
62254
  function handleBlur(event) {
62255
62255
  if (valueRef.current) {
62256
- const clampedValue = clampValue(valueRef.current);
62257
- if (clampedValue !== valueRef.current.toString()) {
62258
- onChange(clampValue(valueRef.current));
62259
- }
62256
+ onChange(clampValue(valueRef.current));
62260
62257
  }
62261
62258
  onBlur?.(event);
62262
62259
  }
@@ -63535,6 +63532,1086 @@ function Toolbar$1() {
63535
63532
  ] })
63536
63533
  ] }) });
63537
63534
  }
63535
+ function __insertCSS(code) {
63536
+ if (typeof document == "undefined") return;
63537
+ let head = document.head || document.getElementsByTagName("head")[0];
63538
+ let style = document.createElement("style");
63539
+ style.type = "text/css";
63540
+ head.appendChild(style);
63541
+ style.styleSheet ? style.styleSheet.cssText = code : style.appendChild(document.createTextNode(code));
63542
+ }
63543
+ const getAsset = (type) => {
63544
+ switch (type) {
63545
+ case "success":
63546
+ return SuccessIcon;
63547
+ case "info":
63548
+ return InfoIcon;
63549
+ case "warning":
63550
+ return WarningIcon;
63551
+ case "error":
63552
+ return ErrorIcon;
63553
+ default:
63554
+ return null;
63555
+ }
63556
+ };
63557
+ const bars = Array(12).fill(0);
63558
+ const Loader = ({ visible, className }) => {
63559
+ return /* @__PURE__ */ React__default.createElement("div", {
63560
+ className: [
63561
+ "sonner-loading-wrapper",
63562
+ className
63563
+ ].filter(Boolean).join(" "),
63564
+ "data-visible": visible
63565
+ }, /* @__PURE__ */ React__default.createElement("div", {
63566
+ className: "sonner-spinner"
63567
+ }, bars.map((_2, i2) => /* @__PURE__ */ React__default.createElement("div", {
63568
+ className: "sonner-loading-bar",
63569
+ key: `spinner-bar-${i2}`
63570
+ }))));
63571
+ };
63572
+ const SuccessIcon = /* @__PURE__ */ React__default.createElement("svg", {
63573
+ xmlns: "http://www.w3.org/2000/svg",
63574
+ viewBox: "0 0 20 20",
63575
+ fill: "currentColor",
63576
+ height: "20",
63577
+ width: "20"
63578
+ }, /* @__PURE__ */ React__default.createElement("path", {
63579
+ fillRule: "evenodd",
63580
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
63581
+ clipRule: "evenodd"
63582
+ }));
63583
+ const WarningIcon = /* @__PURE__ */ React__default.createElement("svg", {
63584
+ xmlns: "http://www.w3.org/2000/svg",
63585
+ viewBox: "0 0 24 24",
63586
+ fill: "currentColor",
63587
+ height: "20",
63588
+ width: "20"
63589
+ }, /* @__PURE__ */ React__default.createElement("path", {
63590
+ fillRule: "evenodd",
63591
+ d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
63592
+ clipRule: "evenodd"
63593
+ }));
63594
+ const InfoIcon = /* @__PURE__ */ React__default.createElement("svg", {
63595
+ xmlns: "http://www.w3.org/2000/svg",
63596
+ viewBox: "0 0 20 20",
63597
+ fill: "currentColor",
63598
+ height: "20",
63599
+ width: "20"
63600
+ }, /* @__PURE__ */ React__default.createElement("path", {
63601
+ fillRule: "evenodd",
63602
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
63603
+ clipRule: "evenodd"
63604
+ }));
63605
+ const ErrorIcon = /* @__PURE__ */ React__default.createElement("svg", {
63606
+ xmlns: "http://www.w3.org/2000/svg",
63607
+ viewBox: "0 0 20 20",
63608
+ fill: "currentColor",
63609
+ height: "20",
63610
+ width: "20"
63611
+ }, /* @__PURE__ */ React__default.createElement("path", {
63612
+ fillRule: "evenodd",
63613
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
63614
+ clipRule: "evenodd"
63615
+ }));
63616
+ const CloseIcon = /* @__PURE__ */ React__default.createElement("svg", {
63617
+ xmlns: "http://www.w3.org/2000/svg",
63618
+ width: "12",
63619
+ height: "12",
63620
+ viewBox: "0 0 24 24",
63621
+ fill: "none",
63622
+ stroke: "currentColor",
63623
+ strokeWidth: "1.5",
63624
+ strokeLinecap: "round",
63625
+ strokeLinejoin: "round"
63626
+ }, /* @__PURE__ */ React__default.createElement("line", {
63627
+ x1: "18",
63628
+ y1: "6",
63629
+ x2: "6",
63630
+ y2: "18"
63631
+ }), /* @__PURE__ */ React__default.createElement("line", {
63632
+ x1: "6",
63633
+ y1: "6",
63634
+ x2: "18",
63635
+ y2: "18"
63636
+ }));
63637
+ const useIsDocumentHidden = () => {
63638
+ const [isDocumentHidden, setIsDocumentHidden] = React__default.useState(document.hidden);
63639
+ React__default.useEffect(() => {
63640
+ const callback = () => {
63641
+ setIsDocumentHidden(document.hidden);
63642
+ };
63643
+ document.addEventListener("visibilitychange", callback);
63644
+ return () => window.removeEventListener("visibilitychange", callback);
63645
+ }, []);
63646
+ return isDocumentHidden;
63647
+ };
63648
+ let toastsCounter = 1;
63649
+ class Observer {
63650
+ constructor() {
63651
+ this.subscribe = (subscriber) => {
63652
+ this.subscribers.push(subscriber);
63653
+ return () => {
63654
+ const index2 = this.subscribers.indexOf(subscriber);
63655
+ this.subscribers.splice(index2, 1);
63656
+ };
63657
+ };
63658
+ this.publish = (data) => {
63659
+ this.subscribers.forEach((subscriber) => subscriber(data));
63660
+ };
63661
+ this.addToast = (data) => {
63662
+ this.publish(data);
63663
+ this.toasts = [
63664
+ ...this.toasts,
63665
+ data
63666
+ ];
63667
+ };
63668
+ this.create = (data) => {
63669
+ var _data_id;
63670
+ const { message, ...rest } = data;
63671
+ const id = typeof (data == null ? void 0 : data.id) === "number" || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
63672
+ const alreadyExists = this.toasts.find((toast2) => {
63673
+ return toast2.id === id;
63674
+ });
63675
+ const dismissible = data.dismissible === void 0 ? true : data.dismissible;
63676
+ if (this.dismissedToasts.has(id)) {
63677
+ this.dismissedToasts.delete(id);
63678
+ }
63679
+ if (alreadyExists) {
63680
+ this.toasts = this.toasts.map((toast2) => {
63681
+ if (toast2.id === id) {
63682
+ this.publish({
63683
+ ...toast2,
63684
+ ...data,
63685
+ id,
63686
+ title: message
63687
+ });
63688
+ return {
63689
+ ...toast2,
63690
+ ...data,
63691
+ id,
63692
+ dismissible,
63693
+ title: message
63694
+ };
63695
+ }
63696
+ return toast2;
63697
+ });
63698
+ } else {
63699
+ this.addToast({
63700
+ title: message,
63701
+ ...rest,
63702
+ dismissible,
63703
+ id
63704
+ });
63705
+ }
63706
+ return id;
63707
+ };
63708
+ this.dismiss = (id) => {
63709
+ if (id) {
63710
+ this.dismissedToasts.add(id);
63711
+ requestAnimationFrame(() => this.subscribers.forEach((subscriber) => subscriber({
63712
+ id,
63713
+ dismiss: true
63714
+ })));
63715
+ } else {
63716
+ this.toasts.forEach((toast2) => {
63717
+ this.subscribers.forEach((subscriber) => subscriber({
63718
+ id: toast2.id,
63719
+ dismiss: true
63720
+ }));
63721
+ });
63722
+ }
63723
+ return id;
63724
+ };
63725
+ this.message = (message, data) => {
63726
+ return this.create({
63727
+ ...data,
63728
+ message
63729
+ });
63730
+ };
63731
+ this.error = (message, data) => {
63732
+ return this.create({
63733
+ ...data,
63734
+ message,
63735
+ type: "error"
63736
+ });
63737
+ };
63738
+ this.success = (message, data) => {
63739
+ return this.create({
63740
+ ...data,
63741
+ type: "success",
63742
+ message
63743
+ });
63744
+ };
63745
+ this.info = (message, data) => {
63746
+ return this.create({
63747
+ ...data,
63748
+ type: "info",
63749
+ message
63750
+ });
63751
+ };
63752
+ this.warning = (message, data) => {
63753
+ return this.create({
63754
+ ...data,
63755
+ type: "warning",
63756
+ message
63757
+ });
63758
+ };
63759
+ this.loading = (message, data) => {
63760
+ return this.create({
63761
+ ...data,
63762
+ type: "loading",
63763
+ message
63764
+ });
63765
+ };
63766
+ this.promise = (promise, data) => {
63767
+ if (!data) {
63768
+ return;
63769
+ }
63770
+ let id = void 0;
63771
+ if (data.loading !== void 0) {
63772
+ id = this.create({
63773
+ ...data,
63774
+ promise,
63775
+ type: "loading",
63776
+ message: data.loading,
63777
+ description: typeof data.description !== "function" ? data.description : void 0
63778
+ });
63779
+ }
63780
+ const p2 = Promise.resolve(promise instanceof Function ? promise() : promise);
63781
+ let shouldDismiss = id !== void 0;
63782
+ let result;
63783
+ const originalPromise = p2.then(async (response) => {
63784
+ result = [
63785
+ "resolve",
63786
+ response
63787
+ ];
63788
+ const isReactElementResponse = React__default.isValidElement(response);
63789
+ if (isReactElementResponse) {
63790
+ shouldDismiss = false;
63791
+ this.create({
63792
+ id,
63793
+ type: "default",
63794
+ message: response
63795
+ });
63796
+ } else if (isHttpResponse(response) && !response.ok) {
63797
+ shouldDismiss = false;
63798
+ const promiseData = typeof data.error === "function" ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
63799
+ const description = typeof data.description === "function" ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
63800
+ const isExtendedResult = typeof promiseData === "object" && !React__default.isValidElement(promiseData);
63801
+ const toastSettings = isExtendedResult ? promiseData : {
63802
+ message: promiseData
63803
+ };
63804
+ this.create({
63805
+ id,
63806
+ type: "error",
63807
+ description,
63808
+ ...toastSettings
63809
+ });
63810
+ } else if (response instanceof Error) {
63811
+ shouldDismiss = false;
63812
+ const promiseData = typeof data.error === "function" ? await data.error(response) : data.error;
63813
+ const description = typeof data.description === "function" ? await data.description(response) : data.description;
63814
+ const isExtendedResult = typeof promiseData === "object" && !React__default.isValidElement(promiseData);
63815
+ const toastSettings = isExtendedResult ? promiseData : {
63816
+ message: promiseData
63817
+ };
63818
+ this.create({
63819
+ id,
63820
+ type: "error",
63821
+ description,
63822
+ ...toastSettings
63823
+ });
63824
+ } else if (data.success !== void 0) {
63825
+ shouldDismiss = false;
63826
+ const promiseData = typeof data.success === "function" ? await data.success(response) : data.success;
63827
+ const description = typeof data.description === "function" ? await data.description(response) : data.description;
63828
+ const isExtendedResult = typeof promiseData === "object" && !React__default.isValidElement(promiseData);
63829
+ const toastSettings = isExtendedResult ? promiseData : {
63830
+ message: promiseData
63831
+ };
63832
+ this.create({
63833
+ id,
63834
+ type: "success",
63835
+ description,
63836
+ ...toastSettings
63837
+ });
63838
+ }
63839
+ }).catch(async (error) => {
63840
+ result = [
63841
+ "reject",
63842
+ error
63843
+ ];
63844
+ if (data.error !== void 0) {
63845
+ shouldDismiss = false;
63846
+ const promiseData = typeof data.error === "function" ? await data.error(error) : data.error;
63847
+ const description = typeof data.description === "function" ? await data.description(error) : data.description;
63848
+ const isExtendedResult = typeof promiseData === "object" && !React__default.isValidElement(promiseData);
63849
+ const toastSettings = isExtendedResult ? promiseData : {
63850
+ message: promiseData
63851
+ };
63852
+ this.create({
63853
+ id,
63854
+ type: "error",
63855
+ description,
63856
+ ...toastSettings
63857
+ });
63858
+ }
63859
+ }).finally(() => {
63860
+ if (shouldDismiss) {
63861
+ this.dismiss(id);
63862
+ id = void 0;
63863
+ }
63864
+ data.finally == null ? void 0 : data.finally.call(data);
63865
+ });
63866
+ const unwrap = () => new Promise((resolve, reject) => originalPromise.then(() => result[0] === "reject" ? reject(result[1]) : resolve(result[1])).catch(reject));
63867
+ if (typeof id !== "string" && typeof id !== "number") {
63868
+ return {
63869
+ unwrap
63870
+ };
63871
+ } else {
63872
+ return Object.assign(id, {
63873
+ unwrap
63874
+ });
63875
+ }
63876
+ };
63877
+ this.custom = (jsx2, data) => {
63878
+ const id = (data == null ? void 0 : data.id) || toastsCounter++;
63879
+ this.create({
63880
+ jsx: jsx2(id),
63881
+ id,
63882
+ ...data
63883
+ });
63884
+ return id;
63885
+ };
63886
+ this.getActiveToasts = () => {
63887
+ return this.toasts.filter((toast2) => !this.dismissedToasts.has(toast2.id));
63888
+ };
63889
+ this.subscribers = [];
63890
+ this.toasts = [];
63891
+ this.dismissedToasts = /* @__PURE__ */ new Set();
63892
+ }
63893
+ }
63894
+ const ToastState = new Observer();
63895
+ const toastFunction = (message, data) => {
63896
+ const id = (data == null ? void 0 : data.id) || toastsCounter++;
63897
+ ToastState.addToast({
63898
+ title: message,
63899
+ ...data,
63900
+ id
63901
+ });
63902
+ return id;
63903
+ };
63904
+ const isHttpResponse = (data) => {
63905
+ return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number";
63906
+ };
63907
+ const basicToast = toastFunction;
63908
+ const getHistory = () => ToastState.toasts;
63909
+ const getToasts = () => ToastState.getActiveToasts();
63910
+ const toast = Object.assign(basicToast, {
63911
+ success: ToastState.success,
63912
+ info: ToastState.info,
63913
+ warning: ToastState.warning,
63914
+ error: ToastState.error,
63915
+ custom: ToastState.custom,
63916
+ message: ToastState.message,
63917
+ promise: ToastState.promise,
63918
+ dismiss: ToastState.dismiss,
63919
+ loading: ToastState.loading
63920
+ }, {
63921
+ getHistory,
63922
+ getToasts
63923
+ });
63924
+ __insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
63925
+ function isAction(action) {
63926
+ return action.label !== void 0;
63927
+ }
63928
+ const VISIBLE_TOASTS_AMOUNT = 3;
63929
+ const VIEWPORT_OFFSET = "24px";
63930
+ const MOBILE_VIEWPORT_OFFSET = "16px";
63931
+ const TOAST_LIFETIME = 4e3;
63932
+ const TOAST_WIDTH = 356;
63933
+ const GAP = 14;
63934
+ const SWIPE_THRESHOLD = 45;
63935
+ const TIME_BEFORE_UNMOUNT = 200;
63936
+ function cn(...classes2) {
63937
+ return classes2.filter(Boolean).join(" ");
63938
+ }
63939
+ function getDefaultSwipeDirections(position) {
63940
+ const [y2, x2] = position.split("-");
63941
+ const directions2 = [];
63942
+ if (y2) {
63943
+ directions2.push(y2);
63944
+ }
63945
+ if (x2) {
63946
+ directions2.push(x2);
63947
+ }
63948
+ return directions2;
63949
+ }
63950
+ const Toast = (props) => {
63951
+ var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;
63952
+ const { invert: ToasterInvert, toast: toast2, unstyled, interacting, setHeights, visibleToasts, heights, index: index2, toasts, expanded, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style, cancelButtonStyle, actionButtonStyle, className = "", descriptionClassName = "", duration: durationFromToaster, position, gap: gap2, expandByDefault, classNames: classNames2, icons, closeButtonAriaLabel = "Close toast" } = props;
63953
+ const [swipeDirection, setSwipeDirection] = React__default.useState(null);
63954
+ const [swipeOutDirection, setSwipeOutDirection] = React__default.useState(null);
63955
+ const [mounted, setMounted] = React__default.useState(false);
63956
+ const [removed, setRemoved] = React__default.useState(false);
63957
+ const [swiping, setSwiping] = React__default.useState(false);
63958
+ const [swipeOut, setSwipeOut] = React__default.useState(false);
63959
+ const [isSwiped, setIsSwiped] = React__default.useState(false);
63960
+ const [offsetBeforeRemove, setOffsetBeforeRemove] = React__default.useState(0);
63961
+ const [initialHeight, setInitialHeight] = React__default.useState(0);
63962
+ const remainingTime = React__default.useRef(toast2.duration || durationFromToaster || TOAST_LIFETIME);
63963
+ const dragStartTime = React__default.useRef(null);
63964
+ const toastRef = React__default.useRef(null);
63965
+ const isFront = index2 === 0;
63966
+ const isVisible2 = index2 + 1 <= visibleToasts;
63967
+ const toastType = toast2.type;
63968
+ const dismissible = toast2.dismissible !== false;
63969
+ const toastClassname = toast2.className || "";
63970
+ const toastDescriptionClassname = toast2.descriptionClassName || "";
63971
+ const heightIndex = React__default.useMemo(() => heights.findIndex((height2) => height2.toastId === toast2.id) || 0, [
63972
+ heights,
63973
+ toast2.id
63974
+ ]);
63975
+ const closeButton = React__default.useMemo(() => {
63976
+ var _toast_closeButton;
63977
+ return (_toast_closeButton = toast2.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;
63978
+ }, [
63979
+ toast2.closeButton,
63980
+ closeButtonFromToaster
63981
+ ]);
63982
+ const duration2 = React__default.useMemo(() => toast2.duration || durationFromToaster || TOAST_LIFETIME, [
63983
+ toast2.duration,
63984
+ durationFromToaster
63985
+ ]);
63986
+ const closeTimerStartTimeRef = React__default.useRef(0);
63987
+ const offset2 = React__default.useRef(0);
63988
+ const lastCloseTimerStartTimeRef = React__default.useRef(0);
63989
+ const pointerStartRef = React__default.useRef(null);
63990
+ const [y2, x2] = position.split("-");
63991
+ const toastsHeightBefore = React__default.useMemo(() => {
63992
+ return heights.reduce((prev, curr, reducerIndex) => {
63993
+ if (reducerIndex >= heightIndex) {
63994
+ return prev;
63995
+ }
63996
+ return prev + curr.height;
63997
+ }, 0);
63998
+ }, [
63999
+ heights,
64000
+ heightIndex
64001
+ ]);
64002
+ const isDocumentHidden = useIsDocumentHidden();
64003
+ const invert = toast2.invert || ToasterInvert;
64004
+ const disabled = toastType === "loading";
64005
+ offset2.current = React__default.useMemo(() => heightIndex * gap2 + toastsHeightBefore, [
64006
+ heightIndex,
64007
+ toastsHeightBefore
64008
+ ]);
64009
+ React__default.useEffect(() => {
64010
+ remainingTime.current = duration2;
64011
+ }, [
64012
+ duration2
64013
+ ]);
64014
+ React__default.useEffect(() => {
64015
+ setMounted(true);
64016
+ }, []);
64017
+ React__default.useEffect(() => {
64018
+ const toastNode = toastRef.current;
64019
+ if (toastNode) {
64020
+ const height2 = toastNode.getBoundingClientRect().height;
64021
+ setInitialHeight(height2);
64022
+ setHeights((h2) => [
64023
+ {
64024
+ toastId: toast2.id,
64025
+ height: height2,
64026
+ position: toast2.position
64027
+ },
64028
+ ...h2
64029
+ ]);
64030
+ return () => setHeights((h2) => h2.filter((height3) => height3.toastId !== toast2.id));
64031
+ }
64032
+ }, [
64033
+ setHeights,
64034
+ toast2.id
64035
+ ]);
64036
+ React__default.useLayoutEffect(() => {
64037
+ if (!mounted) return;
64038
+ const toastNode = toastRef.current;
64039
+ const originalHeight = toastNode.style.height;
64040
+ toastNode.style.height = "auto";
64041
+ const newHeight = toastNode.getBoundingClientRect().height;
64042
+ toastNode.style.height = originalHeight;
64043
+ setInitialHeight(newHeight);
64044
+ setHeights((heights2) => {
64045
+ const alreadyExists = heights2.find((height2) => height2.toastId === toast2.id);
64046
+ if (!alreadyExists) {
64047
+ return [
64048
+ {
64049
+ toastId: toast2.id,
64050
+ height: newHeight,
64051
+ position: toast2.position
64052
+ },
64053
+ ...heights2
64054
+ ];
64055
+ } else {
64056
+ return heights2.map((height2) => height2.toastId === toast2.id ? {
64057
+ ...height2,
64058
+ height: newHeight
64059
+ } : height2);
64060
+ }
64061
+ });
64062
+ }, [
64063
+ mounted,
64064
+ toast2.title,
64065
+ toast2.description,
64066
+ setHeights,
64067
+ toast2.id,
64068
+ toast2.jsx,
64069
+ toast2.action,
64070
+ toast2.cancel
64071
+ ]);
64072
+ const deleteToast = React__default.useCallback(() => {
64073
+ setRemoved(true);
64074
+ setOffsetBeforeRemove(offset2.current);
64075
+ setHeights((h2) => h2.filter((height2) => height2.toastId !== toast2.id));
64076
+ setTimeout(() => {
64077
+ removeToast(toast2);
64078
+ }, TIME_BEFORE_UNMOUNT);
64079
+ }, [
64080
+ toast2,
64081
+ removeToast,
64082
+ setHeights,
64083
+ offset2
64084
+ ]);
64085
+ React__default.useEffect(() => {
64086
+ if (toast2.promise && toastType === "loading" || toast2.duration === Infinity || toast2.type === "loading") return;
64087
+ let timeoutId;
64088
+ const pauseTimer = () => {
64089
+ if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {
64090
+ const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - closeTimerStartTimeRef.current;
64091
+ remainingTime.current = remainingTime.current - elapsedTime;
64092
+ }
64093
+ lastCloseTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
64094
+ };
64095
+ const startTimer = () => {
64096
+ if (remainingTime.current === Infinity) return;
64097
+ closeTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
64098
+ timeoutId = setTimeout(() => {
64099
+ toast2.onAutoClose == null ? void 0 : toast2.onAutoClose.call(toast2, toast2);
64100
+ deleteToast();
64101
+ }, remainingTime.current);
64102
+ };
64103
+ if (expanded || interacting || isDocumentHidden) {
64104
+ pauseTimer();
64105
+ } else {
64106
+ startTimer();
64107
+ }
64108
+ return () => clearTimeout(timeoutId);
64109
+ }, [
64110
+ expanded,
64111
+ interacting,
64112
+ toast2,
64113
+ toastType,
64114
+ isDocumentHidden,
64115
+ deleteToast
64116
+ ]);
64117
+ React__default.useEffect(() => {
64118
+ if (toast2.delete) {
64119
+ deleteToast();
64120
+ toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
64121
+ }
64122
+ }, [
64123
+ deleteToast,
64124
+ toast2.delete
64125
+ ]);
64126
+ function getLoadingIcon() {
64127
+ var _toast_classNames9;
64128
+ if (icons == null ? void 0 : icons.loading) {
64129
+ var _toast_classNames12;
64130
+ return /* @__PURE__ */ React__default.createElement("div", {
64131
+ className: cn(classNames2 == null ? void 0 : classNames2.loader, toast2 == null ? void 0 : (_toast_classNames12 = toast2.classNames) == null ? void 0 : _toast_classNames12.loader, "sonner-loader"),
64132
+ "data-visible": toastType === "loading"
64133
+ }, icons.loading);
64134
+ }
64135
+ return /* @__PURE__ */ React__default.createElement(Loader, {
64136
+ className: cn(classNames2 == null ? void 0 : classNames2.loader, toast2 == null ? void 0 : (_toast_classNames9 = toast2.classNames) == null ? void 0 : _toast_classNames9.loader),
64137
+ visible: toastType === "loading"
64138
+ });
64139
+ }
64140
+ const icon = toast2.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);
64141
+ var _toast_richColors, _icons_close;
64142
+ return /* @__PURE__ */ React__default.createElement("li", {
64143
+ tabIndex: 0,
64144
+ ref: toastRef,
64145
+ className: cn(className, toastClassname, classNames2 == null ? void 0 : classNames2.toast, toast2 == null ? void 0 : (_toast_classNames = toast2.classNames) == null ? void 0 : _toast_classNames.toast, classNames2 == null ? void 0 : classNames2.default, classNames2 == null ? void 0 : classNames2[toastType], toast2 == null ? void 0 : (_toast_classNames1 = toast2.classNames) == null ? void 0 : _toast_classNames1[toastType]),
64146
+ "data-sonner-toast": "",
64147
+ "data-rich-colors": (_toast_richColors = toast2.richColors) != null ? _toast_richColors : defaultRichColors,
64148
+ "data-styled": !Boolean(toast2.jsx || toast2.unstyled || unstyled),
64149
+ "data-mounted": mounted,
64150
+ "data-promise": Boolean(toast2.promise),
64151
+ "data-swiped": isSwiped,
64152
+ "data-removed": removed,
64153
+ "data-visible": isVisible2,
64154
+ "data-y-position": y2,
64155
+ "data-x-position": x2,
64156
+ "data-index": index2,
64157
+ "data-front": isFront,
64158
+ "data-swiping": swiping,
64159
+ "data-dismissible": dismissible,
64160
+ "data-type": toastType,
64161
+ "data-invert": invert,
64162
+ "data-swipe-out": swipeOut,
64163
+ "data-swipe-direction": swipeOutDirection,
64164
+ "data-expanded": Boolean(expanded || expandByDefault && mounted),
64165
+ "data-testid": toast2.testId,
64166
+ style: {
64167
+ "--index": index2,
64168
+ "--toasts-before": index2,
64169
+ "--z-index": toasts.length - index2,
64170
+ "--offset": `${removed ? offsetBeforeRemove : offset2.current}px`,
64171
+ "--initial-height": expandByDefault ? "auto" : `${initialHeight}px`,
64172
+ ...style,
64173
+ ...toast2.style
64174
+ },
64175
+ onDragEnd: () => {
64176
+ setSwiping(false);
64177
+ setSwipeDirection(null);
64178
+ pointerStartRef.current = null;
64179
+ },
64180
+ onPointerDown: (event) => {
64181
+ if (event.button === 2) return;
64182
+ if (disabled || !dismissible) return;
64183
+ dragStartTime.current = /* @__PURE__ */ new Date();
64184
+ setOffsetBeforeRemove(offset2.current);
64185
+ event.target.setPointerCapture(event.pointerId);
64186
+ if (event.target.tagName === "BUTTON") return;
64187
+ setSwiping(true);
64188
+ pointerStartRef.current = {
64189
+ x: event.clientX,
64190
+ y: event.clientY
64191
+ };
64192
+ },
64193
+ onPointerUp: () => {
64194
+ var _toastRef_current, _toastRef_current1, _dragStartTime_current;
64195
+ if (swipeOut || !dismissible) return;
64196
+ pointerStartRef.current = null;
64197
+ const swipeAmountX = Number(((_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0);
64198
+ const swipeAmountY = Number(((_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0);
64199
+ const timeTaken = (/* @__PURE__ */ new Date()).getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime());
64200
+ const swipeAmount = swipeDirection === "x" ? swipeAmountX : swipeAmountY;
64201
+ const velocity = Math.abs(swipeAmount) / timeTaken;
64202
+ if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {
64203
+ setOffsetBeforeRemove(offset2.current);
64204
+ toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
64205
+ if (swipeDirection === "x") {
64206
+ setSwipeOutDirection(swipeAmountX > 0 ? "right" : "left");
64207
+ } else {
64208
+ setSwipeOutDirection(swipeAmountY > 0 ? "down" : "up");
64209
+ }
64210
+ deleteToast();
64211
+ setSwipeOut(true);
64212
+ return;
64213
+ } else {
64214
+ var _toastRef_current2, _toastRef_current3;
64215
+ (_toastRef_current2 = toastRef.current) == null ? void 0 : _toastRef_current2.style.setProperty("--swipe-amount-x", `0px`);
64216
+ (_toastRef_current3 = toastRef.current) == null ? void 0 : _toastRef_current3.style.setProperty("--swipe-amount-y", `0px`);
64217
+ }
64218
+ setIsSwiped(false);
64219
+ setSwiping(false);
64220
+ setSwipeDirection(null);
64221
+ },
64222
+ onPointerMove: (event) => {
64223
+ var _window_getSelection, _toastRef_current, _toastRef_current1;
64224
+ if (!pointerStartRef.current || !dismissible) return;
64225
+ const isHighlighted = ((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0;
64226
+ if (isHighlighted) return;
64227
+ const yDelta = event.clientY - pointerStartRef.current.y;
64228
+ const xDelta = event.clientX - pointerStartRef.current.x;
64229
+ var _props_swipeDirections;
64230
+ const swipeDirections = (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position);
64231
+ if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) {
64232
+ setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? "x" : "y");
64233
+ }
64234
+ let swipeAmount = {
64235
+ x: 0,
64236
+ y: 0
64237
+ };
64238
+ const getDampening = (delta) => {
64239
+ const factor = Math.abs(delta) / 20;
64240
+ return 1 / (1.5 + factor);
64241
+ };
64242
+ if (swipeDirection === "y") {
64243
+ if (swipeDirections.includes("top") || swipeDirections.includes("bottom")) {
64244
+ if (swipeDirections.includes("top") && yDelta < 0 || swipeDirections.includes("bottom") && yDelta > 0) {
64245
+ swipeAmount.y = yDelta;
64246
+ } else {
64247
+ const dampenedDelta = yDelta * getDampening(yDelta);
64248
+ swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta;
64249
+ }
64250
+ }
64251
+ } else if (swipeDirection === "x") {
64252
+ if (swipeDirections.includes("left") || swipeDirections.includes("right")) {
64253
+ if (swipeDirections.includes("left") && xDelta < 0 || swipeDirections.includes("right") && xDelta > 0) {
64254
+ swipeAmount.x = xDelta;
64255
+ } else {
64256
+ const dampenedDelta = xDelta * getDampening(xDelta);
64257
+ swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta;
64258
+ }
64259
+ }
64260
+ }
64261
+ if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) {
64262
+ setIsSwiped(true);
64263
+ }
64264
+ (_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty("--swipe-amount-x", `${swipeAmount.x}px`);
64265
+ (_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty("--swipe-amount-y", `${swipeAmount.y}px`);
64266
+ }
64267
+ }, closeButton && !toast2.jsx && toastType !== "loading" ? /* @__PURE__ */ React__default.createElement("button", {
64268
+ "aria-label": closeButtonAriaLabel,
64269
+ "data-disabled": disabled,
64270
+ "data-close-button": true,
64271
+ onClick: disabled || !dismissible ? () => {
64272
+ } : () => {
64273
+ deleteToast();
64274
+ toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
64275
+ },
64276
+ className: cn(classNames2 == null ? void 0 : classNames2.closeButton, toast2 == null ? void 0 : (_toast_classNames2 = toast2.classNames) == null ? void 0 : _toast_classNames2.closeButton)
64277
+ }, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast2.icon || toast2.promise) && toast2.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast2.icon) ? /* @__PURE__ */ React__default.createElement("div", {
64278
+ "data-icon": "",
64279
+ className: cn(classNames2 == null ? void 0 : classNames2.icon, toast2 == null ? void 0 : (_toast_classNames3 = toast2.classNames) == null ? void 0 : _toast_classNames3.icon)
64280
+ }, toast2.promise || toast2.type === "loading" && !toast2.icon ? toast2.icon || getLoadingIcon() : null, toast2.type !== "loading" ? icon : null) : null, /* @__PURE__ */ React__default.createElement("div", {
64281
+ "data-content": "",
64282
+ className: cn(classNames2 == null ? void 0 : classNames2.content, toast2 == null ? void 0 : (_toast_classNames4 = toast2.classNames) == null ? void 0 : _toast_classNames4.content)
64283
+ }, /* @__PURE__ */ React__default.createElement("div", {
64284
+ "data-title": "",
64285
+ className: cn(classNames2 == null ? void 0 : classNames2.title, toast2 == null ? void 0 : (_toast_classNames5 = toast2.classNames) == null ? void 0 : _toast_classNames5.title)
64286
+ }, toast2.jsx ? toast2.jsx : typeof toast2.title === "function" ? toast2.title() : toast2.title), toast2.description ? /* @__PURE__ */ React__default.createElement("div", {
64287
+ "data-description": "",
64288
+ className: cn(descriptionClassName, toastDescriptionClassname, classNames2 == null ? void 0 : classNames2.description, toast2 == null ? void 0 : (_toast_classNames6 = toast2.classNames) == null ? void 0 : _toast_classNames6.description)
64289
+ }, typeof toast2.description === "function" ? toast2.description() : toast2.description) : null), /* @__PURE__ */ React__default.isValidElement(toast2.cancel) ? toast2.cancel : toast2.cancel && isAction(toast2.cancel) ? /* @__PURE__ */ React__default.createElement("button", {
64290
+ "data-button": true,
64291
+ "data-cancel": true,
64292
+ style: toast2.cancelButtonStyle || cancelButtonStyle,
64293
+ onClick: (event) => {
64294
+ if (!isAction(toast2.cancel)) return;
64295
+ if (!dismissible) return;
64296
+ toast2.cancel.onClick == null ? void 0 : toast2.cancel.onClick.call(toast2.cancel, event);
64297
+ deleteToast();
64298
+ },
64299
+ className: cn(classNames2 == null ? void 0 : classNames2.cancelButton, toast2 == null ? void 0 : (_toast_classNames7 = toast2.classNames) == null ? void 0 : _toast_classNames7.cancelButton)
64300
+ }, toast2.cancel.label) : null, /* @__PURE__ */ React__default.isValidElement(toast2.action) ? toast2.action : toast2.action && isAction(toast2.action) ? /* @__PURE__ */ React__default.createElement("button", {
64301
+ "data-button": true,
64302
+ "data-action": true,
64303
+ style: toast2.actionButtonStyle || actionButtonStyle,
64304
+ onClick: (event) => {
64305
+ if (!isAction(toast2.action)) return;
64306
+ toast2.action.onClick == null ? void 0 : toast2.action.onClick.call(toast2.action, event);
64307
+ if (event.defaultPrevented) return;
64308
+ deleteToast();
64309
+ },
64310
+ className: cn(classNames2 == null ? void 0 : classNames2.actionButton, toast2 == null ? void 0 : (_toast_classNames8 = toast2.classNames) == null ? void 0 : _toast_classNames8.actionButton)
64311
+ }, toast2.action.label) : null);
64312
+ };
64313
+ function getDocumentDirection() {
64314
+ if (typeof window === "undefined") return "ltr";
64315
+ if (typeof document === "undefined") return "ltr";
64316
+ const dirAttribute = document.documentElement.getAttribute("dir");
64317
+ if (dirAttribute === "auto" || !dirAttribute) {
64318
+ return window.getComputedStyle(document.documentElement).direction;
64319
+ }
64320
+ return dirAttribute;
64321
+ }
64322
+ function assignOffset(defaultOffset, mobileOffset) {
64323
+ const styles3 = {};
64324
+ [
64325
+ defaultOffset,
64326
+ mobileOffset
64327
+ ].forEach((offset2, index2) => {
64328
+ const isMobile = index2 === 1;
64329
+ const prefix2 = isMobile ? "--mobile-offset" : "--offset";
64330
+ const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET;
64331
+ function assignAll(offset3) {
64332
+ [
64333
+ "top",
64334
+ "right",
64335
+ "bottom",
64336
+ "left"
64337
+ ].forEach((key) => {
64338
+ styles3[`${prefix2}-${key}`] = typeof offset3 === "number" ? `${offset3}px` : offset3;
64339
+ });
64340
+ }
64341
+ if (typeof offset2 === "number" || typeof offset2 === "string") {
64342
+ assignAll(offset2);
64343
+ } else if (typeof offset2 === "object") {
64344
+ [
64345
+ "top",
64346
+ "right",
64347
+ "bottom",
64348
+ "left"
64349
+ ].forEach((key) => {
64350
+ if (offset2[key] === void 0) {
64351
+ styles3[`${prefix2}-${key}`] = defaultValue;
64352
+ } else {
64353
+ styles3[`${prefix2}-${key}`] = typeof offset2[key] === "number" ? `${offset2[key]}px` : offset2[key];
64354
+ }
64355
+ });
64356
+ } else {
64357
+ assignAll(defaultValue);
64358
+ }
64359
+ });
64360
+ return styles3;
64361
+ }
64362
+ const Toaster = /* @__PURE__ */ React__default.forwardRef(function Toaster2(props, ref) {
64363
+ const { id, invert, position = "bottom-right", hotkey = [
64364
+ "altKey",
64365
+ "KeyT"
64366
+ ], expand, closeButton, className, offset: offset2, mobileOffset, theme: theme2 = "light", richColors, duration: duration2, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap: gap2 = GAP, icons, containerAriaLabel = "Notifications" } = props;
64367
+ const [toasts, setToasts] = React__default.useState([]);
64368
+ const filteredToasts = React__default.useMemo(() => {
64369
+ if (id) {
64370
+ return toasts.filter((toast2) => toast2.toasterId === id);
64371
+ }
64372
+ return toasts.filter((toast2) => !toast2.toasterId);
64373
+ }, [
64374
+ toasts,
64375
+ id
64376
+ ]);
64377
+ const possiblePositions = React__default.useMemo(() => {
64378
+ return Array.from(new Set([
64379
+ position
64380
+ ].concat(filteredToasts.filter((toast2) => toast2.position).map((toast2) => toast2.position))));
64381
+ }, [
64382
+ filteredToasts,
64383
+ position
64384
+ ]);
64385
+ const [heights, setHeights] = React__default.useState([]);
64386
+ const [expanded, setExpanded] = React__default.useState(false);
64387
+ const [interacting, setInteracting] = React__default.useState(false);
64388
+ const [actualTheme, setActualTheme] = React__default.useState(theme2 !== "system" ? theme2 : typeof window !== "undefined" ? window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "light");
64389
+ const listRef = React__default.useRef(null);
64390
+ const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
64391
+ const lastFocusedElementRef = React__default.useRef(null);
64392
+ const isFocusWithinRef = React__default.useRef(false);
64393
+ const removeToast = React__default.useCallback((toastToRemove) => {
64394
+ setToasts((toasts2) => {
64395
+ var _toasts_find;
64396
+ if (!((_toasts_find = toasts2.find((toast2) => toast2.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {
64397
+ ToastState.dismiss(toastToRemove.id);
64398
+ }
64399
+ return toasts2.filter(({ id: id2 }) => id2 !== toastToRemove.id);
64400
+ });
64401
+ }, []);
64402
+ React__default.useEffect(() => {
64403
+ return ToastState.subscribe((toast2) => {
64404
+ if (toast2.dismiss) {
64405
+ requestAnimationFrame(() => {
64406
+ setToasts((toasts2) => toasts2.map((t2) => t2.id === toast2.id ? {
64407
+ ...t2,
64408
+ delete: true
64409
+ } : t2));
64410
+ });
64411
+ return;
64412
+ }
64413
+ setTimeout(() => {
64414
+ ReactDOM__default.flushSync(() => {
64415
+ setToasts((toasts2) => {
64416
+ const indexOfExistingToast = toasts2.findIndex((t2) => t2.id === toast2.id);
64417
+ if (indexOfExistingToast !== -1) {
64418
+ return [
64419
+ ...toasts2.slice(0, indexOfExistingToast),
64420
+ {
64421
+ ...toasts2[indexOfExistingToast],
64422
+ ...toast2
64423
+ },
64424
+ ...toasts2.slice(indexOfExistingToast + 1)
64425
+ ];
64426
+ }
64427
+ return [
64428
+ toast2,
64429
+ ...toasts2
64430
+ ];
64431
+ });
64432
+ });
64433
+ });
64434
+ });
64435
+ }, [
64436
+ toasts
64437
+ ]);
64438
+ React__default.useEffect(() => {
64439
+ if (theme2 !== "system") {
64440
+ setActualTheme(theme2);
64441
+ return;
64442
+ }
64443
+ if (theme2 === "system") {
64444
+ if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
64445
+ setActualTheme("dark");
64446
+ } else {
64447
+ setActualTheme("light");
64448
+ }
64449
+ }
64450
+ if (typeof window === "undefined") return;
64451
+ const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
64452
+ try {
64453
+ darkMediaQuery.addEventListener("change", ({ matches }) => {
64454
+ if (matches) {
64455
+ setActualTheme("dark");
64456
+ } else {
64457
+ setActualTheme("light");
64458
+ }
64459
+ });
64460
+ } catch (error) {
64461
+ darkMediaQuery.addListener(({ matches }) => {
64462
+ try {
64463
+ if (matches) {
64464
+ setActualTheme("dark");
64465
+ } else {
64466
+ setActualTheme("light");
64467
+ }
64468
+ } catch (e2) {
64469
+ console.error(e2);
64470
+ }
64471
+ });
64472
+ }
64473
+ }, [
64474
+ theme2
64475
+ ]);
64476
+ React__default.useEffect(() => {
64477
+ if (toasts.length <= 1) {
64478
+ setExpanded(false);
64479
+ }
64480
+ }, [
64481
+ toasts
64482
+ ]);
64483
+ React__default.useEffect(() => {
64484
+ const handleKeyDown2 = (event) => {
64485
+ var _listRef_current;
64486
+ const isHotkeyPressed = hotkey.every((key) => event[key] || event.code === key);
64487
+ if (isHotkeyPressed) {
64488
+ var _listRef_current1;
64489
+ setExpanded(true);
64490
+ (_listRef_current1 = listRef.current) == null ? void 0 : _listRef_current1.focus();
64491
+ }
64492
+ if (event.code === "Escape" && (document.activeElement === listRef.current || ((_listRef_current = listRef.current) == null ? void 0 : _listRef_current.contains(document.activeElement)))) {
64493
+ setExpanded(false);
64494
+ }
64495
+ };
64496
+ document.addEventListener("keydown", handleKeyDown2);
64497
+ return () => document.removeEventListener("keydown", handleKeyDown2);
64498
+ }, [
64499
+ hotkey
64500
+ ]);
64501
+ React__default.useEffect(() => {
64502
+ if (listRef.current) {
64503
+ return () => {
64504
+ if (lastFocusedElementRef.current) {
64505
+ lastFocusedElementRef.current.focus({
64506
+ preventScroll: true
64507
+ });
64508
+ lastFocusedElementRef.current = null;
64509
+ isFocusWithinRef.current = false;
64510
+ }
64511
+ };
64512
+ }
64513
+ }, [
64514
+ listRef.current
64515
+ ]);
64516
+ return (
64517
+ // Remove item from normal navigation flow, only available via hotkey
64518
+ /* @__PURE__ */ React__default.createElement("section", {
64519
+ ref,
64520
+ "aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
64521
+ tabIndex: -1,
64522
+ "aria-live": "polite",
64523
+ "aria-relevant": "additions text",
64524
+ "aria-atomic": "false",
64525
+ suppressHydrationWarning: true
64526
+ }, possiblePositions.map((position2, index2) => {
64527
+ var _heights_;
64528
+ const [y2, x2] = position2.split("-");
64529
+ if (!filteredToasts.length) return null;
64530
+ return /* @__PURE__ */ React__default.createElement("ol", {
64531
+ key: position2,
64532
+ dir: dir === "auto" ? getDocumentDirection() : dir,
64533
+ tabIndex: -1,
64534
+ ref: listRef,
64535
+ className,
64536
+ "data-sonner-toaster": true,
64537
+ "data-sonner-theme": actualTheme,
64538
+ "data-y-position": y2,
64539
+ "data-x-position": x2,
64540
+ style: {
64541
+ "--front-toast-height": `${((_heights_ = heights[0]) == null ? void 0 : _heights_.height) || 0}px`,
64542
+ "--width": `${TOAST_WIDTH}px`,
64543
+ "--gap": `${gap2}px`,
64544
+ ...style,
64545
+ ...assignOffset(offset2, mobileOffset)
64546
+ },
64547
+ onBlur: (event) => {
64548
+ if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) {
64549
+ isFocusWithinRef.current = false;
64550
+ if (lastFocusedElementRef.current) {
64551
+ lastFocusedElementRef.current.focus({
64552
+ preventScroll: true
64553
+ });
64554
+ lastFocusedElementRef.current = null;
64555
+ }
64556
+ }
64557
+ },
64558
+ onFocus: (event) => {
64559
+ const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
64560
+ if (isNotDismissible) return;
64561
+ if (!isFocusWithinRef.current) {
64562
+ isFocusWithinRef.current = true;
64563
+ lastFocusedElementRef.current = event.relatedTarget;
64564
+ }
64565
+ },
64566
+ onMouseEnter: () => setExpanded(true),
64567
+ onMouseMove: () => setExpanded(true),
64568
+ onMouseLeave: () => {
64569
+ if (!interacting) {
64570
+ setExpanded(false);
64571
+ }
64572
+ },
64573
+ onDragEnd: () => setExpanded(false),
64574
+ onPointerDown: (event) => {
64575
+ const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
64576
+ if (isNotDismissible) return;
64577
+ setInteracting(true);
64578
+ },
64579
+ onPointerUp: () => setInteracting(false)
64580
+ }, filteredToasts.filter((toast2) => !toast2.position && index2 === 0 || toast2.position === position2).map((toast2, index3) => {
64581
+ var _toastOptions_duration, _toastOptions_closeButton;
64582
+ return /* @__PURE__ */ React__default.createElement(Toast, {
64583
+ key: toast2.id,
64584
+ icons,
64585
+ index: index3,
64586
+ toast: toast2,
64587
+ defaultRichColors: richColors,
64588
+ duration: (_toastOptions_duration = toastOptions == null ? void 0 : toastOptions.duration) != null ? _toastOptions_duration : duration2,
64589
+ className: toastOptions == null ? void 0 : toastOptions.className,
64590
+ descriptionClassName: toastOptions == null ? void 0 : toastOptions.descriptionClassName,
64591
+ invert,
64592
+ visibleToasts,
64593
+ closeButton: (_toastOptions_closeButton = toastOptions == null ? void 0 : toastOptions.closeButton) != null ? _toastOptions_closeButton : closeButton,
64594
+ interacting,
64595
+ position: position2,
64596
+ style: toastOptions == null ? void 0 : toastOptions.style,
64597
+ unstyled: toastOptions == null ? void 0 : toastOptions.unstyled,
64598
+ classNames: toastOptions == null ? void 0 : toastOptions.classNames,
64599
+ cancelButtonStyle: toastOptions == null ? void 0 : toastOptions.cancelButtonStyle,
64600
+ actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
64601
+ closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
64602
+ removeToast,
64603
+ toasts: filteredToasts.filter((t2) => t2.position == toast2.position),
64604
+ heights: heights.filter((h2) => h2.position == toast2.position),
64605
+ setHeights,
64606
+ expandByDefault: expand,
64607
+ gap: gap2,
64608
+ expanded,
64609
+ swipeDirections: props.swipeDirections
64610
+ });
64611
+ }));
64612
+ }))
64613
+ );
64614
+ });
63538
64615
  function ApplicationFrame(props) {
63539
64616
  const { application } = props;
63540
64617
  useDefaultRoute(application);
@@ -63551,12 +64628,15 @@ function ApplicationFrame(props) {
63551
64628
  addCssVariables(selectedTheme);
63552
64629
  return () => removeCssVariables(selectedTheme);
63553
64630
  }, [selectedTheme]);
63554
- return /* @__PURE__ */ jsx(ThemeProvider$1, { theme, children: /* @__PURE__ */ jsx(ServicesContext.Provider, { value: application, children: /* @__PURE__ */ jsxs("div", { children: [
63555
- /* @__PURE__ */ jsx(Toolbar$1, {}),
63556
- /* @__PURE__ */ jsx(Sidebar, {}),
63557
- contentComponent,
63558
- /* @__PURE__ */ jsx(Footer, {})
63559
- ] }) }) });
64631
+ return /* @__PURE__ */ jsxs(ThemeProvider$1, { theme, children: [
64632
+ /* @__PURE__ */ jsx(ServicesContext.Provider, { value: application, children: /* @__PURE__ */ jsxs("div", { children: [
64633
+ /* @__PURE__ */ jsx(Toolbar$1, {}),
64634
+ /* @__PURE__ */ jsx(Sidebar, {}),
64635
+ contentComponent,
64636
+ /* @__PURE__ */ jsx(Footer, {})
64637
+ ] }) }),
64638
+ /* @__PURE__ */ jsx(Toaster, { expand: true, closeButton: false, richColors: false, visibleToasts: 5 })
64639
+ ] });
63560
64640
  }
63561
64641
  function LineWrap(props) {
63562
64642
  const { message, required, ...divProps } = props;
@@ -65544,9 +66624,9 @@ class WorkerPanelLogic extends ComponentLogic {
65544
66624
  } finally {
65545
66625
  this.setLoading(false);
65546
66626
  }
65547
- this.openDialog(false);
65548
66627
  this.setDataNewProcess({ ...WORKER_PROCESS_EMPTY_DATA });
65549
66628
  this.setProcessUnchanged(newProcess.id);
66629
+ this.openDialog(false);
65550
66630
  return newProcess;
65551
66631
  });
65552
66632
  this.openDialog.watch((opened) => {
@@ -67896,2375 +68976,154 @@ var ILongOperationScope = /* @__PURE__ */ ((ILongOperationScope2) => {
67896
68976
  ILongOperationScope2[ILongOperationScope2["Local"] = 1] = "Local";
67897
68977
  return ILongOperationScope2;
67898
68978
  })(ILongOperationScope || {});
67899
- var noty$1 = { exports: {} };
67900
- /*
67901
- @package NOTY - Dependency-free notification library
67902
- @version version: 3.2.0-beta
67903
- @contributors https://github.com/needim/noty/graphs/contributors
67904
- @documentation Examples and Documentation - https://ned.im/noty
67905
- @license Licensed under the MIT licenses: http://www.opensource.org/licenses/mit-license.php
67906
- */
67907
- var noty = noty$1.exports;
67908
- var hasRequiredNoty;
67909
- function requireNoty() {
67910
- if (hasRequiredNoty) return noty$1.exports;
67911
- hasRequiredNoty = 1;
67912
- (function(module2, exports) {
67913
- (function webpackUniversalModuleDefinition(root, factory) {
67914
- module2.exports = factory();
67915
- })(noty, function() {
67916
- return (
67917
- /******/
67918
- function(modules) {
67919
- var installedModules = {};
67920
- function __webpack_require__2(moduleId2) {
67921
- if (installedModules[moduleId2]) {
67922
- return installedModules[moduleId2].exports;
67923
- }
67924
- var module3 = installedModules[moduleId2] = {
67925
- /******/
67926
- i: moduleId2,
67927
- /******/
67928
- l: false,
67929
- /******/
67930
- exports: {}
67931
- /******/
67932
- };
67933
- modules[moduleId2].call(module3.exports, module3, module3.exports, __webpack_require__2);
67934
- module3.l = true;
67935
- return module3.exports;
67936
- }
67937
- __webpack_require__2.m = modules;
67938
- __webpack_require__2.c = installedModules;
67939
- __webpack_require__2.i = function(value) {
67940
- return value;
67941
- };
67942
- __webpack_require__2.d = function(exports2, name, getter) {
67943
- if (!__webpack_require__2.o(exports2, name)) {
67944
- Object.defineProperty(exports2, name, {
67945
- /******/
67946
- configurable: false,
67947
- /******/
67948
- enumerable: true,
67949
- /******/
67950
- get: getter
67951
- /******/
67952
- });
67953
- }
67954
- };
67955
- __webpack_require__2.n = function(module3) {
67956
- var getter = module3 && module3.__esModule ? (
67957
- /******/
67958
- function getDefault() {
67959
- return module3["default"];
67960
- }
67961
- ) : (
67962
- /******/
67963
- function getModuleExports() {
67964
- return module3;
67965
- }
67966
- );
67967
- __webpack_require__2.d(getter, "a", getter);
67968
- return getter;
67969
- };
67970
- __webpack_require__2.o = function(object, property) {
67971
- return Object.prototype.hasOwnProperty.call(object, property);
67972
- };
67973
- __webpack_require__2.p = "";
67974
- return __webpack_require__2(__webpack_require__2.s = 6);
67975
- }([
67976
- /* 0 */
67977
- /***/
67978
- function(module3, exports2, __webpack_require__2) {
67979
- Object.defineProperty(exports2, "__esModule", {
67980
- value: true
67981
- });
67982
- exports2.css = exports2.deepExtend = exports2.animationEndEvents = void 0;
67983
- var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
67984
- return typeof obj;
67985
- } : function(obj) {
67986
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
67987
- };
67988
- exports2.inArray = inArray;
67989
- exports2.stopPropagation = stopPropagation2;
67990
- exports2.generateID = generateID;
67991
- exports2.outerHeight = outerHeight;
67992
- exports2.addListener = addListener;
67993
- exports2.hasClass = hasClass2;
67994
- exports2.addClass = addClass2;
67995
- exports2.removeClass = removeClass3;
67996
- exports2.remove = remove;
67997
- exports2.classList = classList;
67998
- exports2.visibilityChangeFlow = visibilityChangeFlow;
67999
- exports2.createAudioElements = createAudioElements;
68000
- var _api = __webpack_require__2(1);
68001
- var API = _interopRequireWildcard(_api);
68002
- function _interopRequireWildcard(obj) {
68003
- if (obj && obj.__esModule) {
68004
- return obj;
68005
- } else {
68006
- var newObj = {};
68007
- if (obj != null) {
68008
- for (var key in obj) {
68009
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
68010
- }
68011
- }
68012
- newObj.default = obj;
68013
- return newObj;
68014
- }
68015
- }
68016
- exports2.animationEndEvents = "webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend";
68017
- function inArray(needle, haystack, argStrict) {
68018
- var key = void 0;
68019
- var strict = !!argStrict;
68020
- if (strict) {
68021
- for (key in haystack) {
68022
- if (haystack.hasOwnProperty(key) && haystack[key] === needle) {
68023
- return true;
68024
- }
68025
- }
68026
- } else {
68027
- for (key in haystack) {
68028
- if (haystack.hasOwnProperty(key) && haystack[key] === needle) {
68029
- return true;
68030
- }
68031
- }
68032
- }
68033
- return false;
68034
- }
68035
- function stopPropagation2(evt) {
68036
- evt = evt || window.event;
68037
- if (typeof evt.stopPropagation !== "undefined") {
68038
- evt.stopPropagation();
68039
- } else {
68040
- evt.cancelBubble = true;
68041
- }
68042
- }
68043
- exports2.deepExtend = function deepExtend(out) {
68044
- out = out || {};
68045
- for (var i2 = 1; i2 < arguments.length; i2++) {
68046
- var obj = arguments[i2];
68047
- if (!obj) continue;
68048
- for (var key in obj) {
68049
- if (obj.hasOwnProperty(key)) {
68050
- if (Array.isArray(obj[key])) {
68051
- out[key] = obj[key];
68052
- } else if (_typeof2(obj[key]) === "object" && obj[key] !== null) {
68053
- out[key] = deepExtend(out[key], obj[key]);
68054
- } else {
68055
- out[key] = obj[key];
68056
- }
68057
- }
68058
- }
68059
- }
68060
- return out;
68061
- };
68062
- function generateID() {
68063
- var prefix2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
68064
- var id = "noty_" + prefix2 + "_";
68065
- id += "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c2) {
68066
- var r2 = Math.random() * 16 | 0;
68067
- var v2 = c2 === "x" ? r2 : r2 & 3 | 8;
68068
- return v2.toString(16);
68069
- });
68070
- return id;
68071
- }
68072
- function outerHeight(el2) {
68073
- var height2 = el2.offsetHeight;
68074
- var style = window.getComputedStyle(el2);
68075
- height2 += parseInt(style.marginTop) + parseInt(style.marginBottom);
68076
- return height2;
68077
- }
68078
- exports2.css = /* @__PURE__ */ function() {
68079
- var cssPrefixes = ["Webkit", "O", "Moz", "ms"];
68080
- var cssProps = {};
68081
- function camelCase2(string) {
68082
- return string.replace(/^-ms-/, "ms-").replace(/-([\da-z])/gi, function(match, letter) {
68083
- return letter.toUpperCase();
68084
- });
68085
- }
68086
- function getVendorProp(name) {
68087
- var style = document.body.style;
68088
- if (name in style) return name;
68089
- var i2 = cssPrefixes.length;
68090
- var capName = name.charAt(0).toUpperCase() + name.slice(1);
68091
- var vendorName = void 0;
68092
- while (i2--) {
68093
- vendorName = cssPrefixes[i2] + capName;
68094
- if (vendorName in style) return vendorName;
68095
- }
68096
- return name;
68097
- }
68098
- function getStyleProp(name) {
68099
- name = camelCase2(name);
68100
- return cssProps[name] || (cssProps[name] = getVendorProp(name));
68101
- }
68102
- function applyCss(element, prop, value) {
68103
- prop = getStyleProp(prop);
68104
- element.style[prop] = value;
68105
- }
68106
- return function(element, properties2) {
68107
- var args = arguments;
68108
- var prop = void 0;
68109
- var value = void 0;
68110
- if (args.length === 2) {
68111
- for (prop in properties2) {
68112
- if (properties2.hasOwnProperty(prop)) {
68113
- value = properties2[prop];
68114
- if (value !== void 0 && properties2.hasOwnProperty(prop)) {
68115
- applyCss(element, prop, value);
68116
- }
68117
- }
68118
- }
68119
- } else {
68120
- applyCss(element, args[1], args[2]);
68121
- }
68122
- };
68123
- }();
68124
- function addListener(el2, events, cb) {
68125
- var useCapture = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
68126
- events = events.split(" ");
68127
- for (var i2 = 0; i2 < events.length; i2++) {
68128
- if (document.addEventListener) {
68129
- el2.addEventListener(events[i2], cb, useCapture);
68130
- } else if (document.attachEvent) {
68131
- el2.attachEvent("on" + events[i2], cb);
68132
- }
68133
- }
68134
- }
68135
- function hasClass2(element, name) {
68136
- var list = typeof element === "string" ? element : classList(element);
68137
- return list.indexOf(" " + name + " ") >= 0;
68138
- }
68139
- function addClass2(element, name) {
68140
- var oldList = classList(element);
68141
- var newList = oldList + name;
68142
- if (hasClass2(oldList, name)) return;
68143
- element.className = newList.substring(1);
68144
- }
68145
- function removeClass3(element, name) {
68146
- var oldList = classList(element);
68147
- var newList = void 0;
68148
- if (!hasClass2(element, name)) return;
68149
- newList = oldList.replace(" " + name + " ", " ");
68150
- element.className = newList.substring(1, newList.length - 1);
68151
- }
68152
- function remove(element) {
68153
- if (element.parentNode) {
68154
- element.parentNode.removeChild(element);
68155
- }
68156
- }
68157
- function classList(element) {
68158
- return (" " + (element && element.className || "") + " ").replace(/\s+/gi, " ");
68159
- }
68160
- function visibilityChangeFlow() {
68161
- var hidden = void 0;
68162
- var visibilityChange = void 0;
68163
- if (typeof document.hidden !== "undefined") {
68164
- hidden = "hidden";
68165
- visibilityChange = "visibilitychange";
68166
- } else if (typeof document.msHidden !== "undefined") {
68167
- hidden = "msHidden";
68168
- visibilityChange = "msvisibilitychange";
68169
- } else if (typeof document.webkitHidden !== "undefined") {
68170
- hidden = "webkitHidden";
68171
- visibilityChange = "webkitvisibilitychange";
68172
- }
68173
- function onVisibilityChange() {
68174
- API.PageHidden = document[hidden];
68175
- handleVisibilityChange2();
68176
- }
68177
- function onBlur() {
68178
- API.PageHidden = true;
68179
- handleVisibilityChange2();
68180
- }
68181
- function onFocus() {
68182
- API.PageHidden = false;
68183
- handleVisibilityChange2();
68184
- }
68185
- function handleVisibilityChange2() {
68186
- if (API.PageHidden) stopAll();
68187
- else resumeAll();
68188
- }
68189
- function stopAll() {
68190
- setTimeout(function() {
68191
- Object.keys(API.Store).forEach(function(id) {
68192
- if (API.Store.hasOwnProperty(id)) {
68193
- if (API.Store[id].options.visibilityControl) {
68194
- API.Store[id].stop();
68195
- }
68196
- }
68197
- });
68198
- }, 100);
68199
- }
68200
- function resumeAll() {
68201
- setTimeout(function() {
68202
- Object.keys(API.Store).forEach(function(id) {
68203
- if (API.Store.hasOwnProperty(id)) {
68204
- if (API.Store[id].options.visibilityControl) {
68205
- API.Store[id].resume();
68206
- }
68207
- }
68208
- });
68209
- API.queueRenderAll();
68210
- }, 100);
68211
- }
68212
- if (visibilityChange) {
68213
- addListener(document, visibilityChange, onVisibilityChange);
68214
- }
68215
- addListener(window, "blur", onBlur);
68216
- addListener(window, "focus", onFocus);
68217
- }
68218
- function createAudioElements(ref) {
68219
- if (ref.hasSound) {
68220
- var audioElement = document.createElement("audio");
68221
- ref.options.sounds.sources.forEach(function(s2) {
68222
- var source = document.createElement("source");
68223
- source.src = s2;
68224
- source.type = "audio/" + getExtension(s2);
68225
- audioElement.appendChild(source);
68226
- });
68227
- if (ref.barDom) {
68228
- ref.barDom.appendChild(audioElement);
68229
- } else {
68230
- document.querySelector("body").appendChild(audioElement);
68231
- }
68232
- audioElement.volume = ref.options.sounds.volume;
68233
- if (!ref.soundPlayed) {
68234
- audioElement.play();
68235
- ref.soundPlayed = true;
68236
- }
68237
- audioElement.onended = function() {
68238
- remove(audioElement);
68239
- };
68240
- }
68241
- }
68242
- function getExtension(fileName) {
68243
- return fileName.match(/\.([^.]+)$/)[1];
68244
- }
68245
- },
68246
- /* 1 */
68247
- /***/
68248
- function(module3, exports2, __webpack_require__2) {
68249
- Object.defineProperty(exports2, "__esModule", {
68250
- value: true
68251
- });
68252
- exports2.Defaults = exports2.Store = exports2.Queues = exports2.DefaultMaxVisible = exports2.docTitle = exports2.DocModalCount = exports2.PageHidden = void 0;
68253
- exports2.getQueueCounts = getQueueCounts;
68254
- exports2.addToQueue = addToQueue;
68255
- exports2.removeFromQueue = removeFromQueue;
68256
- exports2.queueRender = queueRender;
68257
- exports2.queueRenderAll = queueRenderAll;
68258
- exports2.ghostFix = ghostFix;
68259
- exports2.build = build;
68260
- exports2.hasButtons = hasButtons;
68261
- exports2.handleModal = handleModal;
68262
- exports2.handleModalClose = handleModalClose;
68263
- exports2.queueClose = queueClose;
68264
- exports2.dequeueClose = dequeueClose;
68265
- exports2.fire = fire;
68266
- exports2.openFlow = openFlow;
68267
- exports2.closeFlow = closeFlow;
68268
- var _utils = __webpack_require__2(0);
68269
- var Utils = _interopRequireWildcard(_utils);
68270
- function _interopRequireWildcard(obj) {
68271
- if (obj && obj.__esModule) {
68272
- return obj;
68273
- } else {
68274
- var newObj = {};
68275
- if (obj != null) {
68276
- for (var key in obj) {
68277
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
68278
- }
68279
- }
68280
- newObj.default = obj;
68281
- return newObj;
68282
- }
68283
- }
68284
- exports2.PageHidden = false;
68285
- var DocModalCount = exports2.DocModalCount = 0;
68286
- var DocTitleProps = {
68287
- originalTitle: null,
68288
- count: 0,
68289
- changed: false
68290
- };
68291
- var docTitle = exports2.docTitle = {
68292
- increment: function increment2() {
68293
- DocTitleProps.count++;
68294
- docTitle._update();
68295
- },
68296
- decrement: function decrement() {
68297
- DocTitleProps.count--;
68298
- if (DocTitleProps.count <= 0) {
68299
- docTitle._clear();
68300
- return;
68301
- }
68302
- docTitle._update();
68303
- },
68304
- _update: function _update() {
68305
- var title = document.title;
68306
- if (!DocTitleProps.changed) {
68307
- DocTitleProps.originalTitle = title;
68308
- document.title = "(" + DocTitleProps.count + ") " + title;
68309
- DocTitleProps.changed = true;
68310
- } else {
68311
- document.title = "(" + DocTitleProps.count + ") " + DocTitleProps.originalTitle;
68312
- }
68313
- },
68314
- _clear: function _clear() {
68315
- if (DocTitleProps.changed) {
68316
- DocTitleProps.count = 0;
68317
- document.title = DocTitleProps.originalTitle;
68318
- DocTitleProps.changed = false;
68319
- }
68320
- }
68321
- };
68322
- var DefaultMaxVisible = exports2.DefaultMaxVisible = 5;
68323
- var Queues = exports2.Queues = {
68324
- global: {
68325
- maxVisible: DefaultMaxVisible,
68326
- queue: []
68327
- }
68328
- };
68329
- var Store2 = exports2.Store = {};
68330
- exports2.Defaults = {
68331
- type: "alert",
68332
- layout: "topRight",
68333
- theme: "mint",
68334
- text: "",
68335
- timeout: false,
68336
- progressBar: true,
68337
- closeWith: ["click"],
68338
- animation: {
68339
- open: "noty_effects_open",
68340
- close: "noty_effects_close"
68341
- },
68342
- id: false,
68343
- force: false,
68344
- killer: false,
68345
- queue: "global",
68346
- container: false,
68347
- buttons: [],
68348
- callbacks: {
68349
- beforeShow: null,
68350
- onShow: null,
68351
- afterShow: null,
68352
- onClose: null,
68353
- afterClose: null,
68354
- onClick: null,
68355
- onHover: null,
68356
- onTemplate: null
68357
- },
68358
- sounds: {
68359
- sources: [],
68360
- volume: 1,
68361
- conditions: []
68362
- },
68363
- titleCount: {
68364
- conditions: []
68365
- },
68366
- modal: false,
68367
- visibilityControl: false
68368
- /**
68369
- * @param {string} queueName
68370
- * @return {object}
68371
- */
68372
- };
68373
- function getQueueCounts() {
68374
- var queueName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "global";
68375
- var count = 0;
68376
- var max2 = DefaultMaxVisible;
68377
- if (Queues.hasOwnProperty(queueName)) {
68378
- max2 = Queues[queueName].maxVisible;
68379
- Object.keys(Store2).forEach(function(i2) {
68380
- if (Store2[i2].options.queue === queueName && !Store2[i2].closed) count++;
68381
- });
68382
- }
68383
- return {
68384
- current: count,
68385
- maxVisible: max2
68386
- };
68387
- }
68388
- function addToQueue(ref) {
68389
- if (!Queues.hasOwnProperty(ref.options.queue)) {
68390
- Queues[ref.options.queue] = { maxVisible: DefaultMaxVisible, queue: [] };
68391
- }
68392
- Queues[ref.options.queue].queue.push(ref);
68393
- }
68394
- function removeFromQueue(ref) {
68395
- if (Queues.hasOwnProperty(ref.options.queue)) {
68396
- var queue = [];
68397
- Object.keys(Queues[ref.options.queue].queue).forEach(function(i2) {
68398
- if (Queues[ref.options.queue].queue[i2].id !== ref.id) {
68399
- queue.push(Queues[ref.options.queue].queue[i2]);
68400
- }
68401
- });
68402
- Queues[ref.options.queue].queue = queue;
68403
- }
68404
- }
68405
- function queueRender() {
68406
- var queueName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "global";
68407
- if (Queues.hasOwnProperty(queueName)) {
68408
- var noty2 = Queues[queueName].queue.shift();
68409
- if (noty2) noty2.show();
68410
- }
68411
- }
68412
- function queueRenderAll() {
68413
- Object.keys(Queues).forEach(function(queueName) {
68414
- queueRender(queueName);
68415
- });
68416
- }
68417
- function ghostFix(ref) {
68418
- var ghostID = Utils.generateID("ghost");
68419
- var ghost = document.createElement("div");
68420
- ghost.setAttribute("id", ghostID);
68421
- Utils.css(ghost, {
68422
- height: Utils.outerHeight(ref.barDom) + "px"
68423
- });
68424
- ref.barDom.insertAdjacentHTML("afterend", ghost.outerHTML);
68425
- Utils.remove(ref.barDom);
68426
- ghost = document.getElementById(ghostID);
68427
- Utils.addClass(ghost, "noty_fix_effects_height");
68428
- Utils.addListener(ghost, Utils.animationEndEvents, function() {
68429
- Utils.remove(ghost);
68430
- });
68431
- }
68432
- function build(ref) {
68433
- findOrCreateContainer(ref);
68434
- var markup = '<div class="noty_body">' + ref.options.text + "</div>" + buildButtons(ref) + '<div class="noty_progressbar"></div>';
68435
- ref.barDom = document.createElement("div");
68436
- ref.barDom.setAttribute("id", ref.id);
68437
- Utils.addClass(ref.barDom, "noty_bar noty_type__" + ref.options.type + " noty_theme__" + ref.options.theme);
68438
- ref.barDom.innerHTML = markup;
68439
- fire(ref, "onTemplate");
68440
- }
68441
- function hasButtons(ref) {
68442
- return !!(ref.options.buttons && Object.keys(ref.options.buttons).length);
68443
- }
68444
- function buildButtons(ref) {
68445
- if (hasButtons(ref)) {
68446
- var buttons = document.createElement("div");
68447
- Utils.addClass(buttons, "noty_buttons");
68448
- Object.keys(ref.options.buttons).forEach(function(key) {
68449
- buttons.appendChild(ref.options.buttons[key].dom);
68450
- });
68451
- ref.options.buttons.forEach(function(btn) {
68452
- buttons.appendChild(btn.dom);
68453
- });
68454
- return buttons.outerHTML;
68455
- }
68456
- return "";
68457
- }
68458
- function handleModal(ref) {
68459
- if (ref.options.modal) {
68460
- if (DocModalCount === 0) {
68461
- createModal();
68462
- }
68463
- exports2.DocModalCount = DocModalCount += 1;
68464
- }
68465
- }
68466
- function handleModalClose(ref) {
68467
- if (ref.options.modal && DocModalCount > 0) {
68468
- exports2.DocModalCount = DocModalCount -= 1;
68469
- if (DocModalCount <= 0) {
68470
- var modal = document.querySelector(".noty_modal");
68471
- if (modal) {
68472
- Utils.removeClass(modal, "noty_modal_open");
68473
- Utils.addClass(modal, "noty_modal_close");
68474
- Utils.addListener(modal, Utils.animationEndEvents, function() {
68475
- Utils.remove(modal);
68476
- });
68477
- }
68478
- }
68479
- }
68480
- }
68481
- function createModal() {
68482
- var body = document.querySelector("body");
68483
- var modal = document.createElement("div");
68484
- Utils.addClass(modal, "noty_modal");
68485
- body.insertBefore(modal, body.firstChild);
68486
- Utils.addClass(modal, "noty_modal_open");
68487
- Utils.addListener(modal, Utils.animationEndEvents, function() {
68488
- Utils.removeClass(modal, "noty_modal_open");
68489
- });
68490
- }
68491
- function findOrCreateContainer(ref) {
68492
- if (ref.options.container) {
68493
- ref.layoutDom = document.querySelector(ref.options.container);
68494
- return;
68495
- }
68496
- var layoutID = "noty_layout__" + ref.options.layout;
68497
- ref.layoutDom = document.querySelector("div#" + layoutID);
68498
- if (!ref.layoutDom) {
68499
- ref.layoutDom = document.createElement("div");
68500
- ref.layoutDom.setAttribute("id", layoutID);
68501
- ref.layoutDom.setAttribute("role", "alert");
68502
- ref.layoutDom.setAttribute("aria-live", "polite");
68503
- Utils.addClass(ref.layoutDom, "noty_layout");
68504
- document.querySelector("body").appendChild(ref.layoutDom);
68505
- }
68506
- }
68507
- function queueClose(ref) {
68508
- if (ref.options.timeout) {
68509
- if (ref.options.progressBar && ref.progressDom) {
68510
- Utils.css(ref.progressDom, {
68511
- transition: "width " + ref.options.timeout + "ms linear",
68512
- width: "0%"
68513
- });
68514
- }
68515
- clearTimeout(ref.closeTimer);
68516
- ref.closeTimer = setTimeout(function() {
68517
- ref.close();
68518
- }, ref.options.timeout);
68519
- }
68520
- }
68521
- function dequeueClose(ref) {
68522
- if (ref.options.timeout && ref.closeTimer) {
68523
- clearTimeout(ref.closeTimer);
68524
- ref.closeTimer = -1;
68525
- if (ref.options.progressBar && ref.progressDom) {
68526
- Utils.css(ref.progressDom, {
68527
- transition: "width 0ms linear",
68528
- width: "100%"
68529
- });
68530
- }
68531
- }
68532
- }
68533
- function fire(ref, eventName) {
68534
- if (ref.listeners.hasOwnProperty(eventName)) {
68535
- ref.listeners[eventName].forEach(function(cb) {
68536
- if (typeof cb === "function") {
68537
- cb.apply(ref);
68538
- }
68539
- });
68540
- }
68541
- }
68542
- function openFlow(ref) {
68543
- fire(ref, "afterShow");
68544
- queueClose(ref);
68545
- Utils.addListener(ref.barDom, "mouseenter", function() {
68546
- dequeueClose(ref);
68547
- });
68548
- Utils.addListener(ref.barDom, "mouseleave", function() {
68549
- queueClose(ref);
68550
- });
68551
- }
68552
- function closeFlow(ref) {
68553
- delete Store2[ref.id];
68554
- ref.closing = false;
68555
- fire(ref, "afterClose");
68556
- Utils.remove(ref.barDom);
68557
- if (ref.layoutDom.querySelectorAll(".noty_bar").length === 0 && !ref.options.container) {
68558
- Utils.remove(ref.layoutDom);
68559
- }
68560
- if (Utils.inArray("docVisible", ref.options.titleCount.conditions) || Utils.inArray("docHidden", ref.options.titleCount.conditions)) {
68561
- docTitle.decrement();
68562
- }
68563
- queueRender(ref.options.queue);
68564
- }
68565
- },
68566
- /* 2 */
68567
- /***/
68568
- function(module3, exports2, __webpack_require__2) {
68569
- Object.defineProperty(exports2, "__esModule", {
68570
- value: true
68571
- });
68572
- exports2.NotyButton = void 0;
68573
- var _utils = __webpack_require__2(0);
68574
- var Utils = _interopRequireWildcard(_utils);
68575
- function _interopRequireWildcard(obj) {
68576
- if (obj && obj.__esModule) {
68577
- return obj;
68578
- } else {
68579
- var newObj = {};
68580
- if (obj != null) {
68581
- for (var key in obj) {
68582
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
68583
- }
68584
- }
68585
- newObj.default = obj;
68586
- return newObj;
68587
- }
68588
- }
68589
- function _classCallCheck2(instance, Constructor) {
68590
- if (!(instance instanceof Constructor)) {
68591
- throw new TypeError("Cannot call a class as a function");
68592
- }
68593
- }
68594
- exports2.NotyButton = function NotyButton(html, classes2, cb) {
68595
- var _this = this;
68596
- var attributes = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
68597
- _classCallCheck2(this, NotyButton);
68598
- this.dom = document.createElement("button");
68599
- this.dom.innerHTML = html;
68600
- this.id = attributes.id = attributes.id || Utils.generateID("button");
68601
- this.cb = cb;
68602
- Object.keys(attributes).forEach(function(propertyName) {
68603
- _this.dom.setAttribute(propertyName, attributes[propertyName]);
68604
- });
68605
- Utils.addClass(this.dom, classes2 || "noty_btn");
68606
- return this;
68607
- };
68608
- },
68609
- /* 3 */
68610
- /***/
68611
- function(module3, exports2, __webpack_require__2) {
68612
- Object.defineProperty(exports2, "__esModule", {
68613
- value: true
68614
- });
68615
- var _createClass2 = /* @__PURE__ */ function() {
68616
- function defineProperties(target, props) {
68617
- for (var i2 = 0; i2 < props.length; i2++) {
68618
- var descriptor = props[i2];
68619
- descriptor.enumerable = descriptor.enumerable || false;
68620
- descriptor.configurable = true;
68621
- if ("value" in descriptor) descriptor.writable = true;
68622
- Object.defineProperty(target, descriptor.key, descriptor);
68623
- }
68624
- }
68625
- return function(Constructor, protoProps, staticProps) {
68626
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
68627
- if (staticProps) defineProperties(Constructor, staticProps);
68628
- return Constructor;
68629
- };
68630
- }();
68631
- function _classCallCheck2(instance, Constructor) {
68632
- if (!(instance instanceof Constructor)) {
68633
- throw new TypeError("Cannot call a class as a function");
68634
- }
68635
- }
68636
- exports2.Push = function() {
68637
- function Push() {
68638
- var workerPath = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "/service-worker.js";
68639
- _classCallCheck2(this, Push);
68640
- this.subData = {};
68641
- this.workerPath = workerPath;
68642
- this.listeners = {
68643
- onPermissionGranted: [],
68644
- onPermissionDenied: [],
68645
- onSubscriptionSuccess: [],
68646
- onSubscriptionCancel: [],
68647
- onWorkerError: [],
68648
- onWorkerSuccess: [],
68649
- onWorkerNotSupported: []
68650
- };
68651
- return this;
68652
- }
68653
- _createClass2(Push, [{
68654
- key: "on",
68655
- value: function on(eventName) {
68656
- var cb = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : function() {
68657
- };
68658
- if (typeof cb === "function" && this.listeners.hasOwnProperty(eventName)) {
68659
- this.listeners[eventName].push(cb);
68660
- }
68661
- return this;
68662
- }
68663
- }, {
68664
- key: "fire",
68665
- value: function fire(eventName) {
68666
- var _this = this;
68667
- var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
68668
- if (this.listeners.hasOwnProperty(eventName)) {
68669
- this.listeners[eventName].forEach(function(cb) {
68670
- if (typeof cb === "function") {
68671
- cb.apply(_this, params);
68672
- }
68673
- });
68674
- }
68675
- }
68676
- }, {
68677
- key: "create",
68678
- value: function create2() {
68679
- console.log("NOT IMPLEMENTED YET");
68680
- }
68681
- /**
68682
- * @return {boolean}
68683
- */
68684
- }, {
68685
- key: "isSupported",
68686
- value: function isSupported() {
68687
- var result = false;
68688
- try {
68689
- result = window.Notification || window.webkitNotifications || navigator.mozNotification || window.external && window.external.msIsSiteMode() !== void 0;
68690
- } catch (e2) {
68691
- }
68692
- return result;
68693
- }
68694
- /**
68695
- * @return {string}
68696
- */
68697
- }, {
68698
- key: "getPermissionStatus",
68699
- value: function getPermissionStatus() {
68700
- var perm = "default";
68701
- if (window.Notification && window.Notification.permissionLevel) {
68702
- perm = window.Notification.permissionLevel;
68703
- } else if (window.webkitNotifications && window.webkitNotifications.checkPermission) {
68704
- switch (window.webkitNotifications.checkPermission()) {
68705
- case 1:
68706
- perm = "default";
68707
- break;
68708
- case 0:
68709
- perm = "granted";
68710
- break;
68711
- default:
68712
- perm = "denied";
68713
- }
68714
- } else if (window.Notification && window.Notification.permission) {
68715
- perm = window.Notification.permission;
68716
- } else if (navigator.mozNotification) {
68717
- perm = "granted";
68718
- } else if (window.external && window.external.msIsSiteMode() !== void 0) {
68719
- perm = window.external.msIsSiteMode() ? "granted" : "default";
68720
- }
68721
- return perm.toString().toLowerCase();
68722
- }
68723
- /**
68724
- * @return {string}
68725
- */
68726
- }, {
68727
- key: "getEndpoint",
68728
- value: function getEndpoint(subscription) {
68729
- var endpoint = subscription.endpoint;
68730
- var subscriptionId = subscription.subscriptionId;
68731
- if (subscriptionId && endpoint.indexOf(subscriptionId) === -1) {
68732
- endpoint += "/" + subscriptionId;
68733
- }
68734
- return endpoint;
68735
- }
68736
- /**
68737
- * @return {boolean}
68738
- */
68739
- }, {
68740
- key: "isSWRegistered",
68741
- value: function isSWRegistered() {
68742
- try {
68743
- return navigator.serviceWorker.controller.state === "activated";
68744
- } catch (e2) {
68745
- return false;
68746
- }
68747
- }
68748
- /**
68749
- * @return {void}
68750
- */
68751
- }, {
68752
- key: "unregisterWorker",
68753
- value: function unregisterWorker() {
68754
- var self2 = this;
68755
- if ("serviceWorker" in navigator) {
68756
- navigator.serviceWorker.getRegistrations().then(function(registrations) {
68757
- var _iteratorNormalCompletion = true;
68758
- var _didIteratorError = false;
68759
- var _iteratorError = void 0;
68760
- try {
68761
- for (var _iterator = registrations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
68762
- var registration = _step.value;
68763
- registration.unregister();
68764
- self2.fire("onSubscriptionCancel");
68765
- }
68766
- } catch (err) {
68767
- _didIteratorError = true;
68768
- _iteratorError = err;
68769
- } finally {
68770
- try {
68771
- if (!_iteratorNormalCompletion && _iterator.return) {
68772
- _iterator.return();
68773
- }
68774
- } finally {
68775
- if (_didIteratorError) {
68776
- throw _iteratorError;
68777
- }
68778
- }
68779
- }
68780
- });
68781
- }
68782
- }
68783
- /**
68784
- * @return {void}
68785
- */
68786
- }, {
68787
- key: "requestSubscription",
68788
- value: function requestSubscription() {
68789
- var _this2 = this;
68790
- var userVisibleOnly = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
68791
- var self2 = this;
68792
- var current = this.getPermissionStatus();
68793
- var cb = function cb2(result) {
68794
- if (result === "granted") {
68795
- _this2.fire("onPermissionGranted");
68796
- if ("serviceWorker" in navigator) {
68797
- navigator.serviceWorker.register(_this2.workerPath).then(function() {
68798
- navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) {
68799
- self2.fire("onWorkerSuccess");
68800
- serviceWorkerRegistration.pushManager.subscribe({
68801
- userVisibleOnly
68802
- }).then(function(subscription) {
68803
- var key = subscription.getKey("p256dh");
68804
- var token2 = subscription.getKey("auth");
68805
- self2.subData = {
68806
- endpoint: self2.getEndpoint(subscription),
68807
- p256dh: key ? window.btoa(String.fromCharCode.apply(null, new Uint8Array(key))) : null,
68808
- auth: token2 ? window.btoa(String.fromCharCode.apply(null, new Uint8Array(token2))) : null
68809
- };
68810
- self2.fire("onSubscriptionSuccess", [self2.subData]);
68811
- }).catch(function(err) {
68812
- self2.fire("onWorkerError", [err]);
68813
- });
68814
- });
68815
- });
68816
- } else {
68817
- self2.fire("onWorkerNotSupported");
68818
- }
68819
- } else if (result === "denied") {
68820
- _this2.fire("onPermissionDenied");
68821
- _this2.unregisterWorker();
68822
- }
68823
- };
68824
- if (current === "default") {
68825
- if (window.Notification && window.Notification.requestPermission) {
68826
- window.Notification.requestPermission(cb);
68827
- } else if (window.webkitNotifications && window.webkitNotifications.checkPermission) {
68828
- window.webkitNotifications.requestPermission(cb);
68829
- }
68830
- } else {
68831
- cb(current);
68832
- }
68833
- }
68834
- }]);
68835
- return Push;
68836
- }();
68837
- },
68838
- /* 4 */
68839
- /***/
68840
- function(module3, exports2, __webpack_require__2) {
68841
- (function(process2, global2) {
68842
- var require2;
68843
- /*!
68844
- * @overview es6-promise - a tiny implementation of Promises/A+.
68845
- * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
68846
- * @license Licensed under MIT license
68847
- * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
68848
- * @version 4.1.1
68849
- */
68850
- (function(global3, factory) {
68851
- module3.exports = factory();
68852
- })(this, function() {
68853
- function objectOrFunction(x2) {
68854
- var type = typeof x2;
68855
- return x2 !== null && (type === "object" || type === "function");
68856
- }
68857
- function isFunction2(x2) {
68858
- return typeof x2 === "function";
68859
- }
68860
- var _isArray = void 0;
68861
- if (Array.isArray) {
68862
- _isArray = Array.isArray;
68863
- } else {
68864
- _isArray = function(x2) {
68865
- return Object.prototype.toString.call(x2) === "[object Array]";
68866
- };
68867
- }
68868
- var isArray2 = _isArray;
68869
- var len = 0;
68870
- var vertxNext = void 0;
68871
- var customSchedulerFn = void 0;
68872
- var asap = function asap2(callback, arg) {
68873
- queue[len] = callback;
68874
- queue[len + 1] = arg;
68875
- len += 2;
68876
- if (len === 2) {
68877
- if (customSchedulerFn) {
68878
- customSchedulerFn(flush);
68879
- } else {
68880
- scheduleFlush();
68881
- }
68882
- }
68883
- };
68884
- function setScheduler(scheduleFn) {
68885
- customSchedulerFn = scheduleFn;
68886
- }
68887
- function setAsap(asapFn) {
68888
- asap = asapFn;
68889
- }
68890
- var browserWindow = typeof window !== "undefined" ? window : void 0;
68891
- var browserGlobal = browserWindow || {};
68892
- var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
68893
- var isNode = typeof self === "undefined" && typeof process2 !== "undefined" && {}.toString.call(process2) === "[object process]";
68894
- var isWorker = typeof Uint8ClampedArray !== "undefined" && typeof importScripts !== "undefined" && typeof MessageChannel !== "undefined";
68895
- function useNextTick() {
68896
- return function() {
68897
- return process2.nextTick(flush);
68898
- };
68899
- }
68900
- function useVertxTimer() {
68901
- if (typeof vertxNext !== "undefined") {
68902
- return function() {
68903
- vertxNext(flush);
68904
- };
68905
- }
68906
- return useSetTimeout();
68907
- }
68908
- function useMutationObserver() {
68909
- var iterations = 0;
68910
- var observer = new BrowserMutationObserver(flush);
68911
- var node = document.createTextNode("");
68912
- observer.observe(node, { characterData: true });
68913
- return function() {
68914
- node.data = iterations = ++iterations % 2;
68915
- };
68916
- }
68917
- function useMessageChannel() {
68918
- var channel = new MessageChannel();
68919
- channel.port1.onmessage = flush;
68920
- return function() {
68921
- return channel.port2.postMessage(0);
68922
- };
68923
- }
68924
- function useSetTimeout() {
68925
- var globalSetTimeout = setTimeout;
68926
- return function() {
68927
- return globalSetTimeout(flush, 1);
68928
- };
68929
- }
68930
- var queue = new Array(1e3);
68931
- function flush() {
68932
- for (var i2 = 0; i2 < len; i2 += 2) {
68933
- var callback = queue[i2];
68934
- var arg = queue[i2 + 1];
68935
- callback(arg);
68936
- queue[i2] = void 0;
68937
- queue[i2 + 1] = void 0;
68938
- }
68939
- len = 0;
68940
- }
68941
- function attemptVertx() {
68942
- try {
68943
- var r2 = require2;
68944
- var vertx = __webpack_require__2(9);
68945
- vertxNext = vertx.runOnLoop || vertx.runOnContext;
68946
- return useVertxTimer();
68947
- } catch (e2) {
68948
- return useSetTimeout();
68949
- }
68950
- }
68951
- var scheduleFlush = void 0;
68952
- if (isNode) {
68953
- scheduleFlush = useNextTick();
68954
- } else if (BrowserMutationObserver) {
68955
- scheduleFlush = useMutationObserver();
68956
- } else if (isWorker) {
68957
- scheduleFlush = useMessageChannel();
68958
- } else if (browserWindow === void 0 && true) {
68959
- scheduleFlush = attemptVertx();
68960
- } else {
68961
- scheduleFlush = useSetTimeout();
68962
- }
68963
- function then(onFulfillment, onRejection) {
68964
- var _arguments = arguments;
68965
- var parent = this;
68966
- var child = new this.constructor(noop2);
68967
- if (child[PROMISE_ID] === void 0) {
68968
- makePromise(child);
68969
- }
68970
- var _state = parent._state;
68971
- if (_state) {
68972
- (function() {
68973
- var callback = _arguments[_state - 1];
68974
- asap(function() {
68975
- return invokeCallback(_state, child, callback, parent._result);
68976
- });
68977
- })();
68978
- } else {
68979
- subscribe(parent, child, onFulfillment, onRejection);
68980
- }
68981
- return child;
68982
- }
68983
- function resolve$1(object) {
68984
- var Constructor = this;
68985
- if (object && typeof object === "object" && object.constructor === Constructor) {
68986
- return object;
68987
- }
68988
- var promise = new Constructor(noop2);
68989
- resolve(promise, object);
68990
- return promise;
68991
- }
68992
- var PROMISE_ID = Math.random().toString(36).substring(16);
68993
- function noop2() {
68994
- }
68995
- var PENDING = void 0;
68996
- var FULFILLED = 1;
68997
- var REJECTED = 2;
68998
- var GET_THEN_ERROR = new ErrorObject();
68999
- function selfFulfillment() {
69000
- return new TypeError("You cannot resolve a promise with itself");
69001
- }
69002
- function cannotReturnOwn() {
69003
- return new TypeError("A promises callback cannot return that same promise.");
69004
- }
69005
- function getThen(promise) {
69006
- try {
69007
- return promise.then;
69008
- } catch (error) {
69009
- GET_THEN_ERROR.error = error;
69010
- return GET_THEN_ERROR;
69011
- }
69012
- }
69013
- function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
69014
- try {
69015
- then$$1.call(value, fulfillmentHandler, rejectionHandler);
69016
- } catch (e2) {
69017
- return e2;
69018
- }
69019
- }
69020
- function handleForeignThenable(promise, thenable, then$$1) {
69021
- asap(function(promise2) {
69022
- var sealed = false;
69023
- var error = tryThen(then$$1, thenable, function(value) {
69024
- if (sealed) {
69025
- return;
69026
- }
69027
- sealed = true;
69028
- if (thenable !== value) {
69029
- resolve(promise2, value);
69030
- } else {
69031
- fulfill(promise2, value);
69032
- }
69033
- }, function(reason) {
69034
- if (sealed) {
69035
- return;
69036
- }
69037
- sealed = true;
69038
- reject(promise2, reason);
69039
- }, "Settle: " + (promise2._label || " unknown promise"));
69040
- if (!sealed && error) {
69041
- sealed = true;
69042
- reject(promise2, error);
69043
- }
69044
- }, promise);
69045
- }
69046
- function handleOwnThenable(promise, thenable) {
69047
- if (thenable._state === FULFILLED) {
69048
- fulfill(promise, thenable._result);
69049
- } else if (thenable._state === REJECTED) {
69050
- reject(promise, thenable._result);
69051
- } else {
69052
- subscribe(thenable, void 0, function(value) {
69053
- return resolve(promise, value);
69054
- }, function(reason) {
69055
- return reject(promise, reason);
69056
- });
69057
- }
69058
- }
69059
- function handleMaybeThenable(promise, maybeThenable, then$$1) {
69060
- if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
69061
- handleOwnThenable(promise, maybeThenable);
69062
- } else {
69063
- if (then$$1 === GET_THEN_ERROR) {
69064
- reject(promise, GET_THEN_ERROR.error);
69065
- GET_THEN_ERROR.error = null;
69066
- } else if (then$$1 === void 0) {
69067
- fulfill(promise, maybeThenable);
69068
- } else if (isFunction2(then$$1)) {
69069
- handleForeignThenable(promise, maybeThenable, then$$1);
69070
- } else {
69071
- fulfill(promise, maybeThenable);
69072
- }
69073
- }
69074
- }
69075
- function resolve(promise, value) {
69076
- if (promise === value) {
69077
- reject(promise, selfFulfillment());
69078
- } else if (objectOrFunction(value)) {
69079
- handleMaybeThenable(promise, value, getThen(value));
69080
- } else {
69081
- fulfill(promise, value);
69082
- }
69083
- }
69084
- function publishRejection(promise) {
69085
- if (promise._onerror) {
69086
- promise._onerror(promise._result);
69087
- }
69088
- publish(promise);
69089
- }
69090
- function fulfill(promise, value) {
69091
- if (promise._state !== PENDING) {
69092
- return;
69093
- }
69094
- promise._result = value;
69095
- promise._state = FULFILLED;
69096
- if (promise._subscribers.length !== 0) {
69097
- asap(publish, promise);
69098
- }
69099
- }
69100
- function reject(promise, reason) {
69101
- if (promise._state !== PENDING) {
69102
- return;
69103
- }
69104
- promise._state = REJECTED;
69105
- promise._result = reason;
69106
- asap(publishRejection, promise);
69107
- }
69108
- function subscribe(parent, child, onFulfillment, onRejection) {
69109
- var _subscribers = parent._subscribers;
69110
- var length = _subscribers.length;
69111
- parent._onerror = null;
69112
- _subscribers[length] = child;
69113
- _subscribers[length + FULFILLED] = onFulfillment;
69114
- _subscribers[length + REJECTED] = onRejection;
69115
- if (length === 0 && parent._state) {
69116
- asap(publish, parent);
69117
- }
69118
- }
69119
- function publish(promise) {
69120
- var subscribers = promise._subscribers;
69121
- var settled = promise._state;
69122
- if (subscribers.length === 0) {
69123
- return;
69124
- }
69125
- var child = void 0, callback = void 0, detail = promise._result;
69126
- for (var i2 = 0; i2 < subscribers.length; i2 += 3) {
69127
- child = subscribers[i2];
69128
- callback = subscribers[i2 + settled];
69129
- if (child) {
69130
- invokeCallback(settled, child, callback, detail);
69131
- } else {
69132
- callback(detail);
69133
- }
69134
- }
69135
- promise._subscribers.length = 0;
69136
- }
69137
- function ErrorObject() {
69138
- this.error = null;
69139
- }
69140
- var TRY_CATCH_ERROR = new ErrorObject();
69141
- function tryCatch(callback, detail) {
69142
- try {
69143
- return callback(detail);
69144
- } catch (e2) {
69145
- TRY_CATCH_ERROR.error = e2;
69146
- return TRY_CATCH_ERROR;
69147
- }
69148
- }
69149
- function invokeCallback(settled, promise, callback, detail) {
69150
- var hasCallback = isFunction2(callback), value = void 0, error = void 0, succeeded = void 0, failed = void 0;
69151
- if (hasCallback) {
69152
- value = tryCatch(callback, detail);
69153
- if (value === TRY_CATCH_ERROR) {
69154
- failed = true;
69155
- error = value.error;
69156
- value.error = null;
69157
- } else {
69158
- succeeded = true;
69159
- }
69160
- if (promise === value) {
69161
- reject(promise, cannotReturnOwn());
69162
- return;
69163
- }
69164
- } else {
69165
- value = detail;
69166
- succeeded = true;
69167
- }
69168
- if (promise._state !== PENDING) ;
69169
- else if (hasCallback && succeeded) {
69170
- resolve(promise, value);
69171
- } else if (failed) {
69172
- reject(promise, error);
69173
- } else if (settled === FULFILLED) {
69174
- fulfill(promise, value);
69175
- } else if (settled === REJECTED) {
69176
- reject(promise, value);
69177
- }
69178
- }
69179
- function initializePromise(promise, resolver) {
69180
- try {
69181
- resolver(function resolvePromise(value) {
69182
- resolve(promise, value);
69183
- }, function rejectPromise(reason) {
69184
- reject(promise, reason);
69185
- });
69186
- } catch (e2) {
69187
- reject(promise, e2);
69188
- }
69189
- }
69190
- var id = 0;
69191
- function nextId() {
69192
- return id++;
69193
- }
69194
- function makePromise(promise) {
69195
- promise[PROMISE_ID] = id++;
69196
- promise._state = void 0;
69197
- promise._result = void 0;
69198
- promise._subscribers = [];
69199
- }
69200
- function Enumerator$1(Constructor, input) {
69201
- this._instanceConstructor = Constructor;
69202
- this.promise = new Constructor(noop2);
69203
- if (!this.promise[PROMISE_ID]) {
69204
- makePromise(this.promise);
69205
- }
69206
- if (isArray2(input)) {
69207
- this.length = input.length;
69208
- this._remaining = input.length;
69209
- this._result = new Array(this.length);
69210
- if (this.length === 0) {
69211
- fulfill(this.promise, this._result);
69212
- } else {
69213
- this.length = this.length || 0;
69214
- this._enumerate(input);
69215
- if (this._remaining === 0) {
69216
- fulfill(this.promise, this._result);
69217
- }
69218
- }
69219
- } else {
69220
- reject(this.promise, validationError());
69221
- }
69222
- }
69223
- function validationError() {
69224
- return new Error("Array Methods must be provided an Array");
69225
- }
69226
- Enumerator$1.prototype._enumerate = function(input) {
69227
- for (var i2 = 0; this._state === PENDING && i2 < input.length; i2++) {
69228
- this._eachEntry(input[i2], i2);
69229
- }
69230
- };
69231
- Enumerator$1.prototype._eachEntry = function(entry, i2) {
69232
- var c2 = this._instanceConstructor;
69233
- var resolve$$1 = c2.resolve;
69234
- if (resolve$$1 === resolve$1) {
69235
- var _then = getThen(entry);
69236
- if (_then === then && entry._state !== PENDING) {
69237
- this._settledAt(entry._state, i2, entry._result);
69238
- } else if (typeof _then !== "function") {
69239
- this._remaining--;
69240
- this._result[i2] = entry;
69241
- } else if (c2 === Promise$2) {
69242
- var promise = new c2(noop2);
69243
- handleMaybeThenable(promise, entry, _then);
69244
- this._willSettleAt(promise, i2);
69245
- } else {
69246
- this._willSettleAt(new c2(function(resolve$$12) {
69247
- return resolve$$12(entry);
69248
- }), i2);
69249
- }
69250
- } else {
69251
- this._willSettleAt(resolve$$1(entry), i2);
69252
- }
69253
- };
69254
- Enumerator$1.prototype._settledAt = function(state, i2, value) {
69255
- var promise = this.promise;
69256
- if (promise._state === PENDING) {
69257
- this._remaining--;
69258
- if (state === REJECTED) {
69259
- reject(promise, value);
69260
- } else {
69261
- this._result[i2] = value;
69262
- }
69263
- }
69264
- if (this._remaining === 0) {
69265
- fulfill(promise, this._result);
69266
- }
69267
- };
69268
- Enumerator$1.prototype._willSettleAt = function(promise, i2) {
69269
- var enumerator = this;
69270
- subscribe(promise, void 0, function(value) {
69271
- return enumerator._settledAt(FULFILLED, i2, value);
69272
- }, function(reason) {
69273
- return enumerator._settledAt(REJECTED, i2, reason);
69274
- });
69275
- };
69276
- function all$1(entries) {
69277
- return new Enumerator$1(this, entries).promise;
69278
- }
69279
- function race$1(entries) {
69280
- var Constructor = this;
69281
- if (!isArray2(entries)) {
69282
- return new Constructor(function(_2, reject2) {
69283
- return reject2(new TypeError("You must pass an array to race."));
69284
- });
69285
- } else {
69286
- return new Constructor(function(resolve2, reject2) {
69287
- var length = entries.length;
69288
- for (var i2 = 0; i2 < length; i2++) {
69289
- Constructor.resolve(entries[i2]).then(resolve2, reject2);
69290
- }
69291
- });
69292
- }
69293
- }
69294
- function reject$1(reason) {
69295
- var Constructor = this;
69296
- var promise = new Constructor(noop2);
69297
- reject(promise, reason);
69298
- return promise;
69299
- }
69300
- function needsResolver() {
69301
- throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");
69302
- }
69303
- function needsNew() {
69304
- throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
69305
- }
69306
- function Promise$2(resolver) {
69307
- this[PROMISE_ID] = nextId();
69308
- this._result = this._state = void 0;
69309
- this._subscribers = [];
69310
- if (noop2 !== resolver) {
69311
- typeof resolver !== "function" && needsResolver();
69312
- this instanceof Promise$2 ? initializePromise(this, resolver) : needsNew();
69313
- }
69314
- }
69315
- Promise$2.all = all$1;
69316
- Promise$2.race = race$1;
69317
- Promise$2.resolve = resolve$1;
69318
- Promise$2.reject = reject$1;
69319
- Promise$2._setScheduler = setScheduler;
69320
- Promise$2._setAsap = setAsap;
69321
- Promise$2._asap = asap;
69322
- Promise$2.prototype = {
69323
- constructor: Promise$2,
69324
- /**
69325
- The primary way of interacting with a promise is through its `then` method,
69326
- which registers callbacks to receive either a promise's eventual value or the
69327
- reason why the promise cannot be fulfilled.
69328
-
69329
- ```js
69330
- findUser().then(function(user){
69331
- // user is available
69332
- }, function(reason){
69333
- // user is unavailable, and you are given the reason why
69334
- });
69335
- ```
69336
-
69337
- Chaining
69338
- --------
69339
-
69340
- The return value of `then` is itself a promise. This second, 'downstream'
69341
- promise is resolved with the return value of the first promise's fulfillment
69342
- or rejection handler, or rejected if the handler throws an exception.
69343
-
69344
- ```js
69345
- findUser().then(function (user) {
69346
- return user.name;
69347
- }, function (reason) {
69348
- return 'default name';
69349
- }).then(function (userName) {
69350
- // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
69351
- // will be `'default name'`
69352
- });
69353
-
69354
- findUser().then(function (user) {
69355
- throw new Error('Found user, but still unhappy');
69356
- }, function (reason) {
69357
- throw new Error('`findUser` rejected and we're unhappy');
69358
- }).then(function (value) {
69359
- // never reached
69360
- }, function (reason) {
69361
- // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
69362
- // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
69363
- });
69364
- ```
69365
- If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
69366
-
69367
- ```js
69368
- findUser().then(function (user) {
69369
- throw new PedagogicalException('Upstream error');
69370
- }).then(function (value) {
69371
- // never reached
69372
- }).then(function (value) {
69373
- // never reached
69374
- }, function (reason) {
69375
- // The `PedgagocialException` is propagated all the way down to here
69376
- });
69377
- ```
69378
-
69379
- Assimilation
69380
- ------------
69381
-
69382
- Sometimes the value you want to propagate to a downstream promise can only be
69383
- retrieved asynchronously. This can be achieved by returning a promise in the
69384
- fulfillment or rejection handler. The downstream promise will then be pending
69385
- until the returned promise is settled. This is called *assimilation*.
69386
-
69387
- ```js
69388
- findUser().then(function (user) {
69389
- return findCommentsByAuthor(user);
69390
- }).then(function (comments) {
69391
- // The user's comments are now available
69392
- });
69393
- ```
69394
-
69395
- If the assimliated promise rejects, then the downstream promise will also reject.
69396
-
69397
- ```js
69398
- findUser().then(function (user) {
69399
- return findCommentsByAuthor(user);
69400
- }).then(function (comments) {
69401
- // If `findCommentsByAuthor` fulfills, we'll have the value here
69402
- }, function (reason) {
69403
- // If `findCommentsByAuthor` rejects, we'll have the reason here
69404
- });
69405
- ```
69406
-
69407
- Simple Example
69408
- --------------
69409
-
69410
- Synchronous Example
69411
-
69412
- ```javascript
69413
- let result;
69414
-
69415
- try {
69416
- result = findResult();
69417
- // success
69418
- } catch(reason) {
69419
- // failure
69420
- }
69421
- ```
69422
-
69423
- Errback Example
69424
-
69425
- ```js
69426
- findResult(function(result, err){
69427
- if (err) {
69428
- // failure
69429
- } else {
69430
- // success
69431
- }
69432
- });
69433
- ```
69434
-
69435
- Promise Example;
69436
-
69437
- ```javascript
69438
- findResult().then(function(result){
69439
- // success
69440
- }, function(reason){
69441
- // failure
69442
- });
69443
- ```
69444
-
69445
- Advanced Example
69446
- --------------
69447
-
69448
- Synchronous Example
69449
-
69450
- ```javascript
69451
- let author, books;
69452
-
69453
- try {
69454
- author = findAuthor();
69455
- books = findBooksByAuthor(author);
69456
- // success
69457
- } catch(reason) {
69458
- // failure
69459
- }
69460
- ```
69461
-
69462
- Errback Example
69463
-
69464
- ```js
69465
-
69466
- function foundBooks(books) {
69467
-
69468
- }
69469
-
69470
- function failure(reason) {
69471
-
69472
- }
69473
-
69474
- findAuthor(function(author, err){
69475
- if (err) {
69476
- failure(err);
69477
- // failure
69478
- } else {
69479
- try {
69480
- findBoooksByAuthor(author, function(books, err) {
69481
- if (err) {
69482
- failure(err);
69483
- } else {
69484
- try {
69485
- foundBooks(books);
69486
- } catch(reason) {
69487
- failure(reason);
69488
- }
69489
- }
69490
- });
69491
- } catch(error) {
69492
- failure(err);
69493
- }
69494
- // success
69495
- }
69496
- });
69497
- ```
69498
-
69499
- Promise Example;
69500
-
69501
- ```javascript
69502
- findAuthor().
69503
- then(findBooksByAuthor).
69504
- then(function(books){
69505
- // found books
69506
- }).catch(function(reason){
69507
- // something went wrong
69508
- });
69509
- ```
69510
-
69511
- @method then
69512
- @param {Function} onFulfilled
69513
- @param {Function} onRejected
69514
- Useful for tooling.
69515
- @return {Promise}
69516
- */
69517
- then,
69518
- /**
69519
- `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
69520
- as the catch block of a try/catch statement.
69521
-
69522
- ```js
69523
- function findAuthor(){
69524
- throw new Error('couldn't find that author');
69525
- }
69526
-
69527
- // synchronous
69528
- try {
69529
- findAuthor();
69530
- } catch(reason) {
69531
- // something went wrong
69532
- }
69533
-
69534
- // async with promises
69535
- findAuthor().catch(function(reason){
69536
- // something went wrong
69537
- });
69538
- ```
69539
-
69540
- @method catch
69541
- @param {Function} onRejection
69542
- Useful for tooling.
69543
- @return {Promise}
69544
- */
69545
- "catch": function _catch(onRejection) {
69546
- return this.then(null, onRejection);
69547
- }
69548
- };
69549
- function polyfill$1() {
69550
- var local = void 0;
69551
- if (typeof global2 !== "undefined") {
69552
- local = global2;
69553
- } else if (typeof self !== "undefined") {
69554
- local = self;
69555
- } else {
69556
- try {
69557
- local = Function("return this")();
69558
- } catch (e2) {
69559
- throw new Error("polyfill failed because global object is unavailable in this environment");
69560
- }
69561
- }
69562
- var P2 = local.Promise;
69563
- if (P2) {
69564
- var promiseToString = null;
69565
- try {
69566
- promiseToString = Object.prototype.toString.call(P2.resolve());
69567
- } catch (e2) {
69568
- }
69569
- if (promiseToString === "[object Promise]" && !P2.cast) {
69570
- return;
69571
- }
69572
- }
69573
- local.Promise = Promise$2;
69574
- }
69575
- Promise$2.polyfill = polyfill$1;
69576
- Promise$2.Promise = Promise$2;
69577
- return Promise$2;
69578
- });
69579
- }).call(exports2, __webpack_require__2(7), __webpack_require__2(8));
69580
- },
69581
- /* 5 */
69582
- /***/
69583
- function(module3, exports2) {
69584
- },
69585
- /* 6 */
69586
- /***/
69587
- function(module3, exports2, __webpack_require__2) {
69588
- Object.defineProperty(exports2, "__esModule", {
69589
- value: true
69590
- });
69591
- var _createClass2 = /* @__PURE__ */ function() {
69592
- function defineProperties(target, props) {
69593
- for (var i2 = 0; i2 < props.length; i2++) {
69594
- var descriptor = props[i2];
69595
- descriptor.enumerable = descriptor.enumerable || false;
69596
- descriptor.configurable = true;
69597
- if ("value" in descriptor) descriptor.writable = true;
69598
- Object.defineProperty(target, descriptor.key, descriptor);
69599
- }
69600
- }
69601
- return function(Constructor, protoProps, staticProps) {
69602
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
69603
- if (staticProps) defineProperties(Constructor, staticProps);
69604
- return Constructor;
69605
- };
69606
- }();
69607
- __webpack_require__2(5);
69608
- var _es6Promise = __webpack_require__2(4);
69609
- var _es6Promise2 = _interopRequireDefault(_es6Promise);
69610
- var _utils = __webpack_require__2(0);
69611
- var Utils = _interopRequireWildcard(_utils);
69612
- var _api = __webpack_require__2(1);
69613
- var API = _interopRequireWildcard(_api);
69614
- var _button = __webpack_require__2(2);
69615
- var _push = __webpack_require__2(3);
69616
- function _interopRequireWildcard(obj) {
69617
- if (obj && obj.__esModule) {
69618
- return obj;
69619
- } else {
69620
- var newObj = {};
69621
- if (obj != null) {
69622
- for (var key in obj) {
69623
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
69624
- }
69625
- }
69626
- newObj.default = obj;
69627
- return newObj;
69628
- }
69629
- }
69630
- function _interopRequireDefault(obj) {
69631
- return obj && obj.__esModule ? obj : { default: obj };
69632
- }
69633
- function _classCallCheck2(instance, Constructor) {
69634
- if (!(instance instanceof Constructor)) {
69635
- throw new TypeError("Cannot call a class as a function");
69636
- }
69637
- }
69638
- var Noty2 = function() {
69639
- function Noty3() {
69640
- var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
69641
- _classCallCheck2(this, Noty3);
69642
- this.options = Utils.deepExtend({}, API.Defaults, options);
69643
- if (API.Store[this.options.id]) {
69644
- return API.Store[this.options.id];
69645
- }
69646
- this.id = this.options.id || Utils.generateID("bar");
69647
- this.closeTimer = -1;
69648
- this.barDom = null;
69649
- this.layoutDom = null;
69650
- this.progressDom = null;
69651
- this.showing = false;
69652
- this.shown = false;
69653
- this.closed = false;
69654
- this.closing = false;
69655
- this.killable = this.options.timeout || this.options.closeWith.length > 0;
69656
- this.hasSound = this.options.sounds.sources.length > 0;
69657
- this.soundPlayed = false;
69658
- this.listeners = {
69659
- beforeShow: [],
69660
- onShow: [],
69661
- afterShow: [],
69662
- onClose: [],
69663
- afterClose: [],
69664
- onClick: [],
69665
- onHover: [],
69666
- onTemplate: []
69667
- };
69668
- this.promises = {
69669
- show: null,
69670
- close: null
69671
- };
69672
- this.on("beforeShow", this.options.callbacks.beforeShow);
69673
- this.on("onShow", this.options.callbacks.onShow);
69674
- this.on("afterShow", this.options.callbacks.afterShow);
69675
- this.on("onClose", this.options.callbacks.onClose);
69676
- this.on("afterClose", this.options.callbacks.afterClose);
69677
- this.on("onClick", this.options.callbacks.onClick);
69678
- this.on("onHover", this.options.callbacks.onHover);
69679
- this.on("onTemplate", this.options.callbacks.onTemplate);
69680
- return this;
69681
- }
69682
- _createClass2(Noty3, [{
69683
- key: "on",
69684
- value: function on(eventName) {
69685
- var cb = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : function() {
69686
- };
69687
- if (typeof cb === "function" && this.listeners.hasOwnProperty(eventName)) {
69688
- this.listeners[eventName].push(cb);
69689
- }
69690
- return this;
69691
- }
69692
- /**
69693
- * @return {Noty}
69694
- */
69695
- }, {
69696
- key: "show",
69697
- value: function show() {
69698
- var _this = this;
69699
- if (this.showing || this.shown) {
69700
- return this;
69701
- }
69702
- if (this.options.killer === true) {
69703
- Noty3.closeAll();
69704
- } else if (typeof this.options.killer === "string") {
69705
- Noty3.closeAll(this.options.killer);
69706
- }
69707
- var queueCounts = API.getQueueCounts(this.options.queue);
69708
- if (queueCounts.current >= queueCounts.maxVisible || API.PageHidden && this.options.visibilityControl) {
69709
- API.addToQueue(this);
69710
- if (API.PageHidden && this.hasSound && Utils.inArray("docHidden", this.options.sounds.conditions)) {
69711
- Utils.createAudioElements(this);
69712
- }
69713
- if (API.PageHidden && Utils.inArray("docHidden", this.options.titleCount.conditions)) {
69714
- API.docTitle.increment();
69715
- }
69716
- return this;
69717
- }
69718
- API.Store[this.id] = this;
69719
- API.fire(this, "beforeShow");
69720
- this.showing = true;
69721
- if (this.closing) {
69722
- this.showing = false;
69723
- return this;
69724
- }
69725
- API.build(this);
69726
- API.handleModal(this);
69727
- if (this.options.force) {
69728
- this.layoutDom.insertBefore(this.barDom, this.layoutDom.firstChild);
69729
- } else {
69730
- this.layoutDom.appendChild(this.barDom);
69731
- }
69732
- if (this.hasSound && !this.soundPlayed && Utils.inArray("docVisible", this.options.sounds.conditions)) {
69733
- Utils.createAudioElements(this);
69734
- }
69735
- if (Utils.inArray("docVisible", this.options.titleCount.conditions)) {
69736
- API.docTitle.increment();
69737
- }
69738
- this.shown = true;
69739
- this.closed = false;
69740
- if (API.hasButtons(this)) {
69741
- Object.keys(this.options.buttons).forEach(function(key) {
69742
- var btn = _this.barDom.querySelector("#" + _this.options.buttons[key].id);
69743
- Utils.addListener(btn, "click", function(e2) {
69744
- Utils.stopPropagation(e2);
69745
- _this.options.buttons[key].cb(_this);
69746
- });
69747
- });
69748
- }
69749
- this.progressDom = this.barDom.querySelector(".noty_progressbar");
69750
- if (Utils.inArray("click", this.options.closeWith)) {
69751
- Utils.addClass(this.barDom, "noty_close_with_click");
69752
- Utils.addListener(this.barDom, "click", function(e2) {
69753
- Utils.stopPropagation(e2);
69754
- API.fire(_this, "onClick");
69755
- _this.close();
69756
- }, false);
69757
- }
69758
- Utils.addListener(this.barDom, "mouseenter", function() {
69759
- API.fire(_this, "onHover");
69760
- }, false);
69761
- if (this.options.timeout) Utils.addClass(this.barDom, "noty_has_timeout");
69762
- if (this.options.progressBar) {
69763
- Utils.addClass(this.barDom, "noty_has_progressbar");
69764
- }
69765
- if (Utils.inArray("button", this.options.closeWith)) {
69766
- Utils.addClass(this.barDom, "noty_close_with_button");
69767
- var closeButton = document.createElement("div");
69768
- Utils.addClass(closeButton, "noty_close_button");
69769
- closeButton.innerHTML = "×";
69770
- this.barDom.appendChild(closeButton);
69771
- Utils.addListener(closeButton, "click", function(e2) {
69772
- Utils.stopPropagation(e2);
69773
- _this.close();
69774
- }, false);
69775
- }
69776
- API.fire(this, "onShow");
69777
- if (this.options.animation.open === null) {
69778
- this.promises.show = new _es6Promise2.default(function(resolve) {
69779
- resolve();
69780
- });
69781
- } else if (typeof this.options.animation.open === "function") {
69782
- this.promises.show = new _es6Promise2.default(this.options.animation.open.bind(this));
69783
- } else {
69784
- Utils.addClass(this.barDom, this.options.animation.open);
69785
- this.promises.show = new _es6Promise2.default(function(resolve) {
69786
- Utils.addListener(_this.barDom, Utils.animationEndEvents, function() {
69787
- Utils.removeClass(_this.barDom, _this.options.animation.open);
69788
- resolve();
69789
- });
69790
- });
69791
- }
69792
- this.promises.show.then(function() {
69793
- var _t = _this;
69794
- setTimeout(function() {
69795
- API.openFlow(_t);
69796
- }, 100);
69797
- });
69798
- return this;
69799
- }
69800
- /**
69801
- * @return {Noty}
69802
- */
69803
- }, {
69804
- key: "stop",
69805
- value: function stop() {
69806
- API.dequeueClose(this);
69807
- return this;
69808
- }
69809
- /**
69810
- * @return {Noty}
69811
- */
69812
- }, {
69813
- key: "resume",
69814
- value: function resume() {
69815
- API.queueClose(this);
69816
- return this;
69817
- }
69818
- /**
69819
- * @param {int|boolean} ms
69820
- * @return {Noty}
69821
- */
69822
- }, {
69823
- key: "setTimeout",
69824
- value: function(_setTimeout) {
69825
- function setTimeout2(_x) {
69826
- return _setTimeout.apply(this, arguments);
69827
- }
69828
- setTimeout2.toString = function() {
69829
- return _setTimeout.toString();
69830
- };
69831
- return setTimeout2;
69832
- }(function(ms2) {
69833
- this.stop();
69834
- this.options.timeout = ms2;
69835
- if (this.barDom) {
69836
- if (this.options.timeout) {
69837
- Utils.addClass(this.barDom, "noty_has_timeout");
69838
- } else {
69839
- Utils.removeClass(this.barDom, "noty_has_timeout");
69840
- }
69841
- var _t = this;
69842
- setTimeout(function() {
69843
- _t.resume();
69844
- }, 100);
69845
- }
69846
- return this;
69847
- })
69848
- /**
69849
- * @param {string} html
69850
- * @param {boolean} optionsOverride
69851
- * @return {Noty}
69852
- */
69853
- }, {
69854
- key: "setText",
69855
- value: function setText(html) {
69856
- var optionsOverride = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
69857
- if (this.barDom) {
69858
- this.barDom.querySelector(".noty_body").innerHTML = html;
69859
- }
69860
- if (optionsOverride) this.options.text = html;
69861
- return this;
69862
- }
69863
- /**
69864
- * @param {string} type
69865
- * @param {boolean} optionsOverride
69866
- * @return {Noty}
69867
- */
69868
- }, {
69869
- key: "setType",
69870
- value: function setType(type) {
69871
- var _this2 = this;
69872
- var optionsOverride = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
69873
- if (this.barDom) {
69874
- var classList = Utils.classList(this.barDom).split(" ");
69875
- classList.forEach(function(c2) {
69876
- if (c2.substring(0, 11) === "noty_type__") {
69877
- Utils.removeClass(_this2.barDom, c2);
69878
- }
69879
- });
69880
- Utils.addClass(this.barDom, "noty_type__" + type);
69881
- }
69882
- if (optionsOverride) this.options.type = type;
69883
- return this;
69884
- }
69885
- /**
69886
- * @param {string} theme
69887
- * @param {boolean} optionsOverride
69888
- * @return {Noty}
69889
- */
69890
- }, {
69891
- key: "setTheme",
69892
- value: function setTheme(theme2) {
69893
- var _this3 = this;
69894
- var optionsOverride = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
69895
- if (this.barDom) {
69896
- var classList = Utils.classList(this.barDom).split(" ");
69897
- classList.forEach(function(c2) {
69898
- if (c2.substring(0, 12) === "noty_theme__") {
69899
- Utils.removeClass(_this3.barDom, c2);
69900
- }
69901
- });
69902
- Utils.addClass(this.barDom, "noty_theme__" + theme2);
69903
- }
69904
- if (optionsOverride) this.options.theme = theme2;
69905
- return this;
69906
- }
69907
- /**
69908
- * @return {Noty}
69909
- */
69910
- }, {
69911
- key: "close",
69912
- value: function close() {
69913
- var _this4 = this;
69914
- if (this.closed) return this;
69915
- if (!this.shown) {
69916
- API.removeFromQueue(this);
69917
- return this;
69918
- }
69919
- API.fire(this, "onClose");
69920
- this.closing = true;
69921
- if (this.options.animation.close === null || this.options.animation.close === false) {
69922
- this.promises.close = new _es6Promise2.default(function(resolve) {
69923
- resolve();
69924
- });
69925
- } else if (typeof this.options.animation.close === "function") {
69926
- this.promises.close = new _es6Promise2.default(this.options.animation.close.bind(this));
69927
- } else {
69928
- Utils.addClass(this.barDom, this.options.animation.close);
69929
- this.promises.close = new _es6Promise2.default(function(resolve) {
69930
- Utils.addListener(_this4.barDom, Utils.animationEndEvents, function() {
69931
- if (_this4.options.force) {
69932
- Utils.remove(_this4.barDom);
69933
- } else {
69934
- API.ghostFix(_this4);
69935
- }
69936
- resolve();
69937
- });
69938
- });
69939
- }
69940
- this.promises.close.then(function() {
69941
- API.closeFlow(_this4);
69942
- API.handleModalClose(_this4);
69943
- });
69944
- this.closed = true;
69945
- return this;
69946
- }
69947
- // API functions
69948
- /**
69949
- * @param {boolean|string} queueName
69950
- * @return {Noty}
69951
- */
69952
- }], [{
69953
- key: "closeAll",
69954
- value: function closeAll() {
69955
- var queueName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
69956
- Object.keys(API.Store).forEach(function(id) {
69957
- if (queueName) {
69958
- if (API.Store[id].options.queue === queueName && API.Store[id].killable) {
69959
- API.Store[id].close();
69960
- }
69961
- } else if (API.Store[id].killable) {
69962
- API.Store[id].close();
69963
- }
69964
- });
69965
- return this;
69966
- }
69967
- /**
69968
- * @param {string} queueName
69969
- * @return {Noty}
69970
- */
69971
- }, {
69972
- key: "clearQueue",
69973
- value: function clearQueue() {
69974
- var queueName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "global";
69975
- if (API.Queues.hasOwnProperty(queueName)) {
69976
- API.Queues[queueName].queue = [];
69977
- }
69978
- return this;
69979
- }
69980
- /**
69981
- * @return {API.Queues}
69982
- */
69983
- }, {
69984
- key: "overrideDefaults",
69985
- /**
69986
- * @param {Object} obj
69987
- * @return {Noty}
69988
- */
69989
- value: function overrideDefaults(obj) {
69990
- API.Defaults = Utils.deepExtend({}, API.Defaults, obj);
69991
- return this;
69992
- }
69993
- /**
69994
- * @param {int} amount
69995
- * @param {string} queueName
69996
- * @return {Noty}
69997
- */
69998
- }, {
69999
- key: "setMaxVisible",
70000
- value: function setMaxVisible() {
70001
- var amount = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : API.DefaultMaxVisible;
70002
- var queueName = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "global";
70003
- if (!API.Queues.hasOwnProperty(queueName)) {
70004
- API.Queues[queueName] = { maxVisible: amount, queue: [] };
70005
- }
70006
- API.Queues[queueName].maxVisible = amount;
70007
- return this;
70008
- }
70009
- /**
70010
- * @param {string} innerHtml
70011
- * @param {String} classes
70012
- * @param {Function} cb
70013
- * @param {Object} attributes
70014
- * @return {NotyButton}
70015
- */
70016
- }, {
70017
- key: "button",
70018
- value: function button(innerHtml) {
70019
- var classes2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
70020
- var cb = arguments[2];
70021
- var attributes = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
70022
- return new _button.NotyButton(innerHtml, classes2, cb, attributes);
70023
- }
70024
- /**
70025
- * @return {string}
70026
- */
70027
- }, {
70028
- key: "version",
70029
- value: function version2() {
70030
- return "3.2.0-beta";
70031
- }
70032
- /**
70033
- * @param {String} workerPath
70034
- * @return {Push}
70035
- */
70036
- }, {
70037
- key: "Push",
70038
- value: function Push(workerPath) {
70039
- return new _push.Push(workerPath);
70040
- }
70041
- }, {
70042
- key: "Queues",
70043
- get: function get3() {
70044
- return API.Queues;
70045
- }
70046
- /**
70047
- * @return {API.PageHidden}
70048
- */
70049
- }, {
70050
- key: "PageHidden",
70051
- get: function get3() {
70052
- return API.PageHidden;
70053
- }
70054
- }]);
70055
- return Noty3;
70056
- }();
70057
- exports2.default = Noty2;
70058
- if (typeof window !== "undefined") {
70059
- Utils.visibilityChangeFlow();
70060
- }
70061
- module3.exports = exports2["default"];
70062
- },
70063
- /* 7 */
70064
- /***/
70065
- function(module3, exports2) {
70066
- var process2 = module3.exports = {};
70067
- var cachedSetTimeout;
70068
- var cachedClearTimeout;
70069
- function defaultSetTimout() {
70070
- throw new Error("setTimeout has not been defined");
70071
- }
70072
- function defaultClearTimeout() {
70073
- throw new Error("clearTimeout has not been defined");
70074
- }
70075
- (function() {
70076
- try {
70077
- if (typeof setTimeout === "function") {
70078
- cachedSetTimeout = setTimeout;
70079
- } else {
70080
- cachedSetTimeout = defaultSetTimout;
70081
- }
70082
- } catch (e2) {
70083
- cachedSetTimeout = defaultSetTimout;
70084
- }
70085
- try {
70086
- if (typeof clearTimeout === "function") {
70087
- cachedClearTimeout = clearTimeout;
70088
- } else {
70089
- cachedClearTimeout = defaultClearTimeout;
70090
- }
70091
- } catch (e2) {
70092
- cachedClearTimeout = defaultClearTimeout;
70093
- }
70094
- })();
70095
- function runTimeout(fun) {
70096
- if (cachedSetTimeout === setTimeout) {
70097
- return setTimeout(fun, 0);
70098
- }
70099
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
70100
- cachedSetTimeout = setTimeout;
70101
- return setTimeout(fun, 0);
70102
- }
70103
- try {
70104
- return cachedSetTimeout(fun, 0);
70105
- } catch (e2) {
70106
- try {
70107
- return cachedSetTimeout.call(null, fun, 0);
70108
- } catch (e3) {
70109
- return cachedSetTimeout.call(this, fun, 0);
70110
- }
70111
- }
70112
- }
70113
- function runClearTimeout(marker) {
70114
- if (cachedClearTimeout === clearTimeout) {
70115
- return clearTimeout(marker);
70116
- }
70117
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
70118
- cachedClearTimeout = clearTimeout;
70119
- return clearTimeout(marker);
70120
- }
70121
- try {
70122
- return cachedClearTimeout(marker);
70123
- } catch (e2) {
70124
- try {
70125
- return cachedClearTimeout.call(null, marker);
70126
- } catch (e3) {
70127
- return cachedClearTimeout.call(this, marker);
70128
- }
70129
- }
70130
- }
70131
- var queue = [];
70132
- var draining = false;
70133
- var currentQueue;
70134
- var queueIndex = -1;
70135
- function cleanUpNextTick() {
70136
- if (!draining || !currentQueue) {
70137
- return;
70138
- }
70139
- draining = false;
70140
- if (currentQueue.length) {
70141
- queue = currentQueue.concat(queue);
70142
- } else {
70143
- queueIndex = -1;
70144
- }
70145
- if (queue.length) {
70146
- drainQueue();
70147
- }
70148
- }
70149
- function drainQueue() {
70150
- if (draining) {
70151
- return;
70152
- }
70153
- var timeout = runTimeout(cleanUpNextTick);
70154
- draining = true;
70155
- var len = queue.length;
70156
- while (len) {
70157
- currentQueue = queue;
70158
- queue = [];
70159
- while (++queueIndex < len) {
70160
- if (currentQueue) {
70161
- currentQueue[queueIndex].run();
70162
- }
70163
- }
70164
- queueIndex = -1;
70165
- len = queue.length;
70166
- }
70167
- currentQueue = null;
70168
- draining = false;
70169
- runClearTimeout(timeout);
70170
- }
70171
- process2.nextTick = function(fun) {
70172
- var args = new Array(arguments.length - 1);
70173
- if (arguments.length > 1) {
70174
- for (var i2 = 1; i2 < arguments.length; i2++) {
70175
- args[i2 - 1] = arguments[i2];
70176
- }
70177
- }
70178
- queue.push(new Item(fun, args));
70179
- if (queue.length === 1 && !draining) {
70180
- runTimeout(drainQueue);
70181
- }
70182
- };
70183
- function Item(fun, array) {
70184
- this.fun = fun;
70185
- this.array = array;
70186
- }
70187
- Item.prototype.run = function() {
70188
- this.fun.apply(null, this.array);
70189
- };
70190
- process2.title = "browser";
70191
- process2.browser = true;
70192
- process2.env = {};
70193
- process2.argv = [];
70194
- process2.version = "";
70195
- process2.versions = {};
70196
- function noop2() {
70197
- }
70198
- process2.on = noop2;
70199
- process2.addListener = noop2;
70200
- process2.once = noop2;
70201
- process2.off = noop2;
70202
- process2.removeListener = noop2;
70203
- process2.removeAllListeners = noop2;
70204
- process2.emit = noop2;
70205
- process2.prependListener = noop2;
70206
- process2.prependOnceListener = noop2;
70207
- process2.listeners = function(name) {
70208
- return [];
70209
- };
70210
- process2.binding = function(name) {
70211
- throw new Error("process.binding is not supported");
70212
- };
70213
- process2.cwd = function() {
70214
- return "/";
70215
- };
70216
- process2.chdir = function(dir) {
70217
- throw new Error("process.chdir is not supported");
70218
- };
70219
- process2.umask = function() {
70220
- return 0;
70221
- };
70222
- },
70223
- /* 8 */
70224
- /***/
70225
- function(module3, exports2) {
70226
- var g2;
70227
- g2 = /* @__PURE__ */ function() {
70228
- return this;
70229
- }();
70230
- try {
70231
- g2 = g2 || Function("return this")() || (1, eval)("this");
70232
- } catch (e2) {
70233
- if (typeof window === "object")
70234
- g2 = window;
70235
- }
70236
- module3.exports = g2;
70237
- },
70238
- /* 9 */
70239
- /***/
70240
- function(module3, exports2) {
70241
- }
70242
- /******/
70243
- ])
68979
+ const _PopupNotification = class _PopupNotification {
68980
+ constructor(options) {
68981
+ this.renderToast = (toastId) => {
68982
+ const classes2 = classNames(
68983
+ "noty_bar",
68984
+ `noty_theme__${this.options.theme}`,
68985
+ `noty_type__${this.type}`,
68986
+ this.getLayoutClass(),
68987
+ {
68988
+ noty_has_timeout: this.timeout !== false,
68989
+ noty_has_progressbar: this.showProgress(),
68990
+ noty_close_with_click: this.closeWith.includes("click")
68991
+ }
70244
68992
  );
68993
+ const handleLayoutClick = () => {
68994
+ this.callbacks.onClick?.();
68995
+ if (this.closeWith.includes("click")) {
68996
+ toast.dismiss(toastId);
68997
+ }
68998
+ };
68999
+ const handleCloseButtonClick = (e2) => {
69000
+ e2.stopPropagation();
69001
+ toast.dismiss(toastId);
69002
+ };
69003
+ return /* @__PURE__ */ jsxs("div", { "data-testid": "noty-bar", className: classes2, onMouseEnter: this.callbacks.onHover, onClick: handleLayoutClick, children: [
69004
+ this.closeWith.includes("button") && /* @__PURE__ */ jsx("div", { "data-testid": "noty-close-button", className: "noty_close_button", onClick: handleCloseButtonClick, children: "×" }),
69005
+ /* @__PURE__ */ jsx("div", { className: "noty_body", children: this.text }),
69006
+ !!this.options.buttons?.length && /* @__PURE__ */ jsx("div", { className: "noty_buttons", children: this.options.buttons.map((btn) => /* @__PURE__ */ jsx("button", { className: classNames("noty_btn", btn.className), "data-testid": btn.dataTestId, onClick: btn.onClick, children: btn.text }, btn.text)) }),
69007
+ this.showProgress() && /* @__PURE__ */ jsx("div", { className: "noty_progressbar", style: { animationDuration: `${this.timeout}ms` } }, this.timeout.toString())
69008
+ ] });
69009
+ };
69010
+ const mergedOptions = {
69011
+ ..._PopupNotification.getDefaultOptions(),
69012
+ ...options
69013
+ };
69014
+ this.options = mergedOptions;
69015
+ this.text = mergedOptions.text;
69016
+ this.type = mergedOptions.type;
69017
+ this.timeout = mergedOptions.timeout;
69018
+ this.callbacks = mergedOptions.callbacks ?? {};
69019
+ this.closeWith = mergedOptions.closeWith ?? ["click"];
69020
+ }
69021
+ static getDefaultOptions() {
69022
+ return {
69023
+ type: "alert",
69024
+ layout: "bottomRight",
69025
+ timeout: 15e3,
69026
+ theme: "dv"
69027
+ };
69028
+ }
69029
+ static create(options, show = true) {
69030
+ const popup = new _PopupNotification(options);
69031
+ if (show) {
69032
+ popup.show();
69033
+ }
69034
+ return popup;
69035
+ }
69036
+ static ensureToaster() {
69037
+ if (document.getElementById(this.containerId)) return;
69038
+ const container = document.createElement("div");
69039
+ container.id = this.containerId;
69040
+ document.body.appendChild(container);
69041
+ ReactDOM__default.render(
69042
+ /* @__PURE__ */ jsx(Toaster, { expand: true, closeButton: false, richColors: false, visibleToasts: 5 }),
69043
+ container
69044
+ );
69045
+ }
69046
+ getDuration() {
69047
+ return this.timeout === false || this.timeout === 0 ? Infinity : this.timeout;
69048
+ }
69049
+ showProgress() {
69050
+ return typeof this.timeout === "number" && this.timeout > 0;
69051
+ }
69052
+ getLayoutClass() {
69053
+ return `noty_layout__${this.options.layout}`;
69054
+ }
69055
+ show() {
69056
+ if (this.toastId) return;
69057
+ this.callbacks.beforeShow?.();
69058
+ if (this.options.killer) {
69059
+ toast.dismiss();
69060
+ }
69061
+ const toastOptions = {
69062
+ duration: this.getDuration(),
69063
+ position: _PopupNotification.mapLayout(this.options.layout)
69064
+ };
69065
+ this.toastId = toast.custom(this.renderToast, {
69066
+ ...toastOptions,
69067
+ onDismiss: () => {
69068
+ this.callbacks.onClose?.();
69069
+ this.callbacks.afterClose?.();
69070
+ this.toastId = void 0;
69071
+ },
69072
+ onAutoClose: () => {
69073
+ this.callbacks.onClose?.();
69074
+ this.callbacks.afterClose?.();
69075
+ this.toastId = void 0;
69076
+ }
70245
69077
  });
70246
- })(noty$1);
70247
- return noty$1.exports;
70248
- }
70249
- var notyExports = requireNoty();
70250
- const Noty = /* @__PURE__ */ getDefaultExportFromCjs(notyExports);
70251
- const showNote = (options) => {
70252
- const buttons = options.buttonsProps?.map(({ text, onClick, className, dataTestId }) => Noty.button(text, className, onClick, { "data-test-id": dataTestId })) || [];
70253
- const defaultOptions2 = {
70254
- type: "info",
70255
- layout: "bottomRight",
70256
- timeout: 15e3,
70257
- closeWith: ["click"],
70258
- theme: "dv"
70259
- };
70260
- const note = new Noty({ ...defaultOptions2, ...options, buttons: [...buttons, ...options.buttons ?? []] });
70261
- note.show();
70262
- return note;
70263
- };
70264
- const hideNote = (note) => {
70265
- if (!note) return;
70266
- note.close();
69078
+ this.callbacks.onShow?.();
69079
+ requestAnimationFrame(() => {
69080
+ this.callbacks.afterShow?.();
69081
+ });
69082
+ }
69083
+ update() {
69084
+ if (this.toastId === void 0) return;
69085
+ toast.custom(this.renderToast, {
69086
+ id: this.toastId,
69087
+ duration: this.getDuration()
69088
+ });
69089
+ }
69090
+ close() {
69091
+ if (this.toastId !== void 0) {
69092
+ toast.dismiss(this.toastId);
69093
+ }
69094
+ }
69095
+ setText(text) {
69096
+ this.text = text;
69097
+ this.update();
69098
+ }
69099
+ setType(type) {
69100
+ this.type = type;
69101
+ this.update();
69102
+ }
69103
+ setTimeout(timeout) {
69104
+ this.timeout = timeout;
69105
+ this.update();
69106
+ }
69107
+ on(event, handler) {
69108
+ this.callbacks[event] = handler;
69109
+ }
69110
+ static closeAll() {
69111
+ toast.dismiss();
69112
+ }
69113
+ static mapLayout(layout) {
69114
+ const map2 = {
69115
+ topLeft: "top-left",
69116
+ topCenter: "top-center",
69117
+ topRight: "top-right",
69118
+ bottomLeft: "bottom-left",
69119
+ bottomCenter: "bottom-center",
69120
+ bottomRight: "bottom-right"
69121
+ };
69122
+ return map2[layout ?? "bottomRight"];
69123
+ }
70267
69124
  };
69125
+ _PopupNotification.containerId = "popup-notification-toaster";
69126
+ let PopupNotification = _PopupNotification;
70268
69127
  function TextMessage(props) {
70269
69128
  const { content, wrapperClassName, footer, footerClassName, header, headerClassName, contentClassName } = props;
70270
69129
  const textContent = getTextContent(content, contentClassName);
@@ -70286,15 +69145,11 @@ class SettingsPageLogic extends ComponentLogic {
70286
69145
  super(...arguments);
70287
69146
  this.domain = y$1("SettingsPageLogic");
70288
69147
  this.submitFx = this.domain.effect("onSubmit");
70289
- this.$loadPageRequestId = this.domain.store(0, { name: "$loadPageRequestId" });
70290
- this.loadPage = this.domain.event("loadPage");
70291
- this.loadPageFx = this.domain.effect("loadPageFx");
70292
- this.validLoadPageFxDone = w$2({
70293
- clock: this.loadPageFx.done,
70294
- filter: ({ params }) => params.requestId === this.$loadPageRequestId.getState()
70295
- });
69148
+ this.loadPage = this.domain.effect("loadPage");
70296
69149
  this.$pageData = this.domain.store(null, { name: "pageData" });
69150
+ this.setPageData = this.domain.event("setPageData");
70297
69151
  this.$pageDataList = this.domain.store(null, { name: "pageDataList" });
69152
+ this.setPageDataList = this.domain.event("setPageDataList");
70298
69153
  this.$scrollRestored = this.domain.store(!window.sessionStorage.getItem(SESSION_STORAGE_SCROLL_KEY), { name: "$scrollRestored" });
70299
69154
  this.$scrollElement = this.domain.store(null, { name: "$scrollElement" });
70300
69155
  this.settedScrollElement = this.domain.event("setScrollElement");
@@ -70315,14 +69170,22 @@ class SettingsPageLogic extends ComponentLogic {
70315
69170
  if (isLocalScope && (!isCurrentPage || !isCurrentService)) return;
70316
69171
  const buttonsProps = isCurrentService ? [{ text: resources.RefreshPage, onClick: () => location.reload(), dataTestId: "reload-button" }] : [];
70317
69172
  const notyType = notification.status === ILongOperationCompleteStatus.Success ? "info" : "error";
70318
- const note = showNote({ type: notyType, timeout: 0, text: notification.message, buttonsProps });
69173
+ const note = PopupNotification.create({ type: notyType, timeout: 0, text: notification.message, buttons: buttonsProps });
70319
69174
  const router = routingService.getInternalRouterInstance();
70320
69175
  const cleanUpLeaveHook = router.addLeaveHook(route?.path, (done) => {
70321
- hideNote(note);
69176
+ note.close();
70322
69177
  done();
70323
69178
  cleanUpLeaveHook();
70324
69179
  });
70325
69180
  });
69181
+ v$2({
69182
+ clock: this.setPageData,
69183
+ target: this.$pageData
69184
+ });
69185
+ v$2({
69186
+ clock: this.setPageDataList,
69187
+ target: this.$pageDataList
69188
+ });
70326
69189
  this.submitFx.use(async (params) => {
70327
69190
  const savePageResponse = await layoutService.saveLayout(params.layoutId, params.serviceId, params.data, params.itemId, params.timestamp);
70328
69191
  if (savePageResponse.status === SavePageStatus.Error) {
@@ -70345,42 +69208,15 @@ class SettingsPageLogic extends ComponentLogic {
70345
69208
  fn: (pageData, { timestamp }) => ({ ...pageData, meta: { ...pageData.meta, timestamp } }),
70346
69209
  target: this.$pageData
70347
69210
  });
70348
- v$2({
70349
- clock: this.loadPage,
70350
- source: this.$loadPageRequestId,
70351
- fn: (requestId) => requestId + 1,
70352
- target: this.$loadPageRequestId
70353
- });
70354
- v$2({
70355
- clock: this.loadPage,
70356
- source: this.$loadPageRequestId,
70357
- fn: (requestId, params) => ({ ...params, requestId }),
70358
- target: this.loadPageFx
70359
- });
70360
- this.loadPageFx.use(async (params) => {
70361
- return await layoutService.getLayout(params.url, params.serviceId, params.itemId);
70362
- });
70363
- v$2({
70364
- clock: this.validLoadPageFxDone,
70365
- fn: ({ result }) => result,
70366
- target: this.$pageData
70367
- });
70368
- v$2({
70369
- clock: this.validLoadPageFxDone,
70370
- fn: ({ result }) => {
70371
- const elements = [];
70372
- result.elements.length && this.getElementsInList(elements, result.elements);
70373
- return elements;
70374
- },
70375
- target: this.$pageDataList
70376
- });
70377
- v$2({
70378
- clock: this.validLoadPageFxDone,
70379
- fn: ({ result }) => {
70380
- const { readOnly, readonlyReasonMsg } = result.meta;
70381
- if (readOnly) {
70382
- services.messageWindow.showInfo(readonlyReasonMsg || resources.ReadOnlyReasonMessage);
70383
- }
69211
+ this.loadPage.use(async (params) => {
69212
+ const pageData = await layoutService.getLayout(params.url, params.serviceId, params.itemId);
69213
+ this.setPageData(pageData);
69214
+ const result = [];
69215
+ pageData.elements.length && this.getElementsInList(result, pageData.elements);
69216
+ this.setPageDataList(result);
69217
+ const { readOnly, readonlyReasonMsg } = pageData.meta;
69218
+ if (readOnly) {
69219
+ services.messageWindow.showInfo(readonlyReasonMsg || resources.ReadOnlyReasonMessage);
70384
69220
  }
70385
69221
  });
70386
69222
  v$2({
@@ -70440,7 +69276,7 @@ function SettingsPage(props) {
70440
69276
  const menuItems = e(services.navigationMenu.$menuItems);
70441
69277
  const clearMenuItems = c(services.navigationMenu.clearMenuItems);
70442
69278
  const isSubmitButtonLoading = e(logic.submitFx.pending);
70443
- const isPageLoading = e(logic.loadPageFx.pending);
69279
+ const isPageLoading = e(logic.loadPage.pending);
70444
69280
  const formRef = useRef(null);
70445
69281
  const breadcrumbsItems = services.settingsNavigation.getBreadcrumbsItems();
70446
69282
  const readOnly = pageData?.meta.readOnly || false;
@@ -71393,7 +70229,7 @@ class ImportSettingsLogic extends ComponentLogic {
71393
70229
  }
71394
70230
  function WarningBanner(props) {
71395
70231
  return /* @__PURE__ */ jsxs("div", { className: "warning-banner", children: [
71396
- /* @__PURE__ */ jsx(WarningIcon, { className: "warning-banner__warning-icon", fontSize: "large" }),
70232
+ /* @__PURE__ */ jsx(WarningIcon$1, { className: "warning-banner__warning-icon", fontSize: "large" }),
71397
70233
  /* @__PURE__ */ jsx(Typography$3, { variant: "caption", children: props.services.resources.Attention + " " + props.text })
71398
70234
  ] });
71399
70235
  }
@@ -71413,13 +70249,12 @@ function ImportSettingsDialog(props) {
71413
70249
  const peers = e(logic.$peers);
71414
70250
  const onSubmitClick = async () => {
71415
70251
  if (selectedPeer.lastUpdated) {
71416
- const cultureName = services.applicationSettings.culture.name;
71417
- const dateFormat = cultureName === "ru-RU" ? DATE_TIME_FORMAT_RUS : DATE_TIME_FORMAT_ENG;
71418
- const dateStr = hooks(selectedPeer.lastUpdated).locale(cultureName).format(dateFormat);
70252
+ const dateFormat = services.applicationSettings.culture.name === "ru-RU" ? DATE_TIME_FORMAT_RUS : DATE_TIME_FORMAT_ENG;
70253
+ const dateStr = hooks(selectedPeer.lastUpdated).format(dateFormat);
71419
70254
  await services.messageWindow.showConfirmation(
71420
70255
  formatString$1(resources.ImportSettingsConfirmationWithDateMessage, dateStr),
71421
70256
  {
71422
- modalIcon: /* @__PURE__ */ jsx(WarningIcon, { className: "import-settings-dialog__warning-icon", fontSize: "small" }),
70257
+ modalIcon: /* @__PURE__ */ jsx(WarningIcon$1, { className: "import-settings-dialog__warning-icon", fontSize: "small" }),
71423
70258
  customCaptionText: services.resources.Attention,
71424
70259
  color: theme.palette.warning.main
71425
70260
  }
@@ -71428,14 +70263,14 @@ function ImportSettingsDialog(props) {
71428
70263
  await services.messageWindow.showConfirmation(
71429
70264
  resources.ImportSettingsConfirmationMessage,
71430
70265
  {
71431
- modalIcon: /* @__PURE__ */ jsx(WarningIcon, { className: "import-settings-dialog__warning-icon", fontSize: "small" }),
70266
+ modalIcon: /* @__PURE__ */ jsx(WarningIcon$1, { className: "import-settings-dialog__warning-icon", fontSize: "small" }),
71432
70267
  customCaptionText: services.resources.Attention,
71433
70268
  color: theme.palette.warning.main
71434
70269
  }
71435
70270
  );
71436
70271
  }
71437
70272
  await logic.copyFx({ targetServiceId: serviceId, sourceServiceId: selectedPeer.id });
71438
- showNote({ timeout: 3e3, text: formatString$1(resources.ImportSettingsCompletedMessage, selectedPeer.serverName, serverName) });
70273
+ PopupNotification.create({ timeout: 3e3, text: formatString$1(resources.ImportSettingsCompletedMessage, selectedPeer.serverName, serverName) });
71439
70274
  onClose();
71440
70275
  };
71441
70276
  return /* @__PURE__ */ jsx(ThemeProvider$1, { theme, children: /* @__PURE__ */ jsxs(
@@ -71456,7 +70291,7 @@ function ImportSettingsDialog(props) {
71456
70291
  children: [
71457
70292
  /* @__PURE__ */ jsxs(DialogTitle, { variant: "h6", className: "import-settings-dialog__title", children: [
71458
70293
  resources.ImportSettings,
71459
- /* @__PURE__ */ jsx(IconButton$3, { "aria-label": "close", onClick: onClose, children: /* @__PURE__ */ jsx(CloseIcon, {}) })
70294
+ /* @__PURE__ */ jsx(IconButton$3, { "aria-label": "close", onClick: onClose, children: /* @__PURE__ */ jsx(CloseIcon$1, {}) })
71460
70295
  ] }),
71461
70296
  /* @__PURE__ */ jsxs(DialogContent$2, { className: "import-settings-dialog__content", children: [
71462
70297
  /* @__PURE__ */ jsx(Typography$3, { variant: "subtitle2", color: "inherit", children: resources.SelectImportSettingsFrom }),
@@ -71531,7 +70366,7 @@ function ComponentMenu(props) {
71531
70366
  formatString$1(services.resources.ConfirmDeleteService, component.serviceName),
71532
70367
  {
71533
70368
  customButtonOkText: services.resources.Delete,
71534
- modalIcon: /* @__PURE__ */ jsx(WarningIcon, { className: "component-menu__warning-icon", fontSize: "medium" }),
70369
+ modalIcon: /* @__PURE__ */ jsx(WarningIcon$1, { className: "component-menu__warning-icon", fontSize: "medium" }),
71535
70370
  customCaptionText: services.resources.Attention,
71536
70371
  color: theme.palette.warning.main
71537
70372
  }
@@ -71724,6 +70559,10 @@ function ServersRouteComponent({ services }) {
71724
70559
  const routeServices = useLocalServiceContainer(ServicesContext, (s2) => s2.isPageService);
71725
70560
  return /* @__PURE__ */ jsx(ServicesContext.Provider, { value: routeServices, children: /* @__PURE__ */ jsx(ServersPage, { services }) });
71726
70561
  }
70562
+ function ServerPageRouteComponent({ services }) {
70563
+ const routeServices = useLocalServiceContainer(ServicesContext, (s2) => s2.isPageService);
70564
+ return /* @__PURE__ */ jsx(ServicesContext.Provider, { value: routeServices, children: /* @__PURE__ */ jsx(ServersPage, { services }) });
70565
+ }
71727
70566
  const serversRouteHandler = async (application) => {
71728
70567
  return /* @__PURE__ */ jsx(ServersRouteComponent, { services: application });
71729
70568
  };
@@ -71731,9 +70570,12 @@ const serversRoute = {
71731
70570
  path: SERVERS_ROUTE_PATH,
71732
70571
  handler: serversRouteHandler
71733
70572
  };
70573
+ const serverPageRouteHandler = async (application) => {
70574
+ return /* @__PURE__ */ jsx(ServerPageRouteComponent, { services: application });
70575
+ };
71734
70576
  const serverPageRoute = {
71735
70577
  path: SERVER_PAGE_ROUTE_PATH,
71736
- handler: serversRouteHandler
70578
+ handler: serverPageRouteHandler
71737
70579
  };
71738
70580
  const $ServersController = serviceName((s2) => s2.serverController);
71739
70581
  class ServersController {
@@ -71763,6 +70605,7 @@ class SettingsNavigationService {
71763
70605
  constructor(application) {
71764
70606
  this.application = application;
71765
70607
  this.serviceNamesCache = /* @__PURE__ */ new Map();
70608
+ this.serversNamesCache = /* @__PURE__ */ new Map();
71766
70609
  this.goToConfigurationPage = () => {
71767
70610
  const { params, data } = this.application.routingService.getLastRouteResolvedParams() || {};
71768
70611
  const { serverId, serviceId, layoutId } = data;
@@ -71779,6 +70622,7 @@ class SettingsNavigationService {
71779
70622
  const service = await this.application.serverController.getServiceInfo(serviceId);
71780
70623
  if (!service) return;
71781
70624
  this.rememberServiceName(service.serviceId, service.serviceName);
70625
+ this.rememberServerName(service.serviceId, service.serverName);
71782
70626
  } catch {
71783
70627
  }
71784
70628
  }
@@ -71793,6 +70637,13 @@ class SettingsNavigationService {
71793
70637
  if (!serviceId) return fallback;
71794
70638
  return this.getCachedServiceName(serviceId) ?? fallback;
71795
70639
  }
70640
+ rememberServerName(serviceId, serverName) {
70641
+ if (!serviceId || !serverName) return;
70642
+ this.serversNamesCache.set(serviceId, serverName);
70643
+ }
70644
+ getCachedServerName(serviceId) {
70645
+ return this.serversNamesCache.get(serviceId);
70646
+ }
71796
70647
  convertPathToUrl(str, ...args) {
71797
70648
  const matches = str.match(/(:\w+)/g);
71798
70649
  if (!matches) return str;
@@ -71828,8 +70679,9 @@ class SettingsNavigationService {
71828
70679
  const { serviceName: serviceName2, itemName, extendedLayoutId } = params;
71829
70680
  const breadcrumbsItems = [];
71830
70681
  if (data.serverId) {
70682
+ const serverName = this.getCachedServerName(data.serviceId) ?? data.serverId;
71831
70683
  breadcrumbsItems.push({
71832
- label: `${this.application.resources.Server}: ${data.serverId.toUpperCase()}`,
70684
+ label: `${this.application.resources.Server}: ${serverName}`,
71833
70685
  path: this.getServerPageUrl(serverId)
71834
70686
  });
71835
70687
  }
@@ -109101,7 +107953,7 @@ class EmailServerConnectionSettingsView {
109101
107953
  }
109102
107954
  function EmailServerConnectionSettings(options) {
109103
107955
  const view = useView(options, EmailServerConnectionSettingsView);
109104
- const { data, onDataChanged, mode, services, validation, validationFieldsProvider, isCurrentlyEditedSetting } = options;
107956
+ const { data, onDataChanged, mode, services, validation, validationFieldsProvider } = options;
109105
107957
  const testIdPrefix = mode === EditMode.Create ? "new-email-server" : "email-server";
109106
107958
  if (!data) {
109107
107959
  return null;
@@ -109109,10 +107961,9 @@ function EmailServerConnectionSettings(options) {
109109
107961
  const { resources } = services;
109110
107962
  const [serverType, setServerType] = useState(data.serverType);
109111
107963
  useEffect(() => {
109112
- if (mode === EditMode.Edit && !isCurrentlyEditedSetting) return;
109113
107964
  setServerType(data.serverType);
109114
107965
  updateServerTypeValidationFields(data.serverType);
109115
- }, [data.serverType, mode, isCurrentlyEditedSetting]);
107966
+ }, [data.serverType]);
109116
107967
  const labelPlacement = mode === EditMode.Create ? LabelPlacement.Top : LabelPlacement.Left;
109117
107968
  const getEmailServer = (type, data2) => {
109118
107969
  switch (type) {
@@ -109670,7 +108521,6 @@ function ConnectionPanel(props) {
109670
108521
  const $changedConnections = e(logic.$changedConnections);
109671
108522
  const $loading = e(logic.$loading);
109672
108523
  const $customValidationModel = e(logic.$customValidationModel);
109673
- const activeSettingsId = e(logic.$activeId);
109674
108524
  const dataTestIdPrefix = props.connectionType === ConnectionTypes.EmailServer ? "email-server" : "settings-panel";
109675
108525
  const dataTestIdDefault = `${dataTestIdPrefix}__checkbox-default`;
109676
108526
  const dataTestIdAddButton = `${dataTestIdPrefix}__add-button`;
@@ -109761,7 +108611,6 @@ function ConnectionPanel(props) {
109761
108611
  onDataChanged: logic.updateSettings,
109762
108612
  services: props.services,
109763
108613
  validation: $changedValidationModel,
109764
- isCurrentlyEditedSetting: connection.id === activeSettingsId,
109765
108614
  customValidationProvider: {
109766
108615
  model: $customValidationModel,
109767
108616
  set: logic.changeCustomValidationModel,
@@ -111027,7 +109876,7 @@ export {
111027
109876
  EngineType,
111028
109877
  Error$1 as Error,
111029
109878
  ErrorBlock,
111030
- ErrorIcon,
109879
+ ErrorIcon$1 as ErrorIcon,
111031
109880
  ErrorMessage,
111032
109881
  ExpandButton$1 as ExpandButton,
111033
109882
  ExpandMoreIcon,
@@ -111059,6 +109908,7 @@ export {
111059
109908
  PageTabPanel,
111060
109909
  PageTable,
111061
109910
  PageTitle,
109911
+ PopupNotification,
111062
109912
  ProcessOverlay,
111063
109913
  ResourcesManagement,
111064
109914
  RootElementService,
@@ -111115,14 +109965,12 @@ export {
111115
109965
  getThisMonthBeginAndEndDays,
111116
109966
  getWidgetsOrder,
111117
109967
  handleOnEscape,
111118
- hideNote,
111119
109968
  newGuid,
111120
109969
  parseQueryString,
111121
109970
  registerEditors,
111122
109971
  removeCssVariables,
111123
109972
  renderButtons,
111124
109973
  setDashboardPosition,
111125
- showNote,
111126
109974
  showNotification,
111127
109975
  theme,
111128
109976
  toWidgetSettings,