@platforma-sdk/ui-vue 1.42.2 → 1.42.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
   WARN  Issue while reading "/home/runner/_work/platforma/platforma/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @platforma-sdk/ui-vue@1.42.2 build /home/runner/_work/platforma/platforma/sdk/ui-vue
3
+ > @platforma-sdk/ui-vue@1.42.3 build /home/runner/_work/platforma/platforma/sdk/ui-vue
4
4
  > vite build
5
5
 
6
6
  vite v6.3.5 building for production...
@@ -10,7 +10,7 @@ rendering chunks...
10
10
 
11
11
  [vite:dts] Start generate declaration files...
12
12
  computing gzip size...
13
- [vite:dts] Declaration files built in 5831ms.
13
+ [vite:dts] Declaration files built in 5269ms.
14
14
 
15
15
  dist/_virtual/re.js  0.08 kB │ gzip: 0.10 kB │ map: 0.09 kB
16
16
  dist/lib/ui/uikit/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/constant.js  0.09 kB │ gzip: 0.10 kB │ map: 0.32 kB
@@ -151,8 +151,8 @@ computing gzip size...
151
151
  dist/lib/ui/uikit/dist/components/PlRadio/PlRadio.vue.js  0.27 kB │ gzip: 0.21 kB │ map: 0.10 kB
152
152
  dist/_virtual/index.js  0.27 kB │ gzip: 0.21 kB │ map: 0.09 kB
153
153
  dist/components/PlMultiSequenceAlignment/Toolbar.vue.js  0.27 kB │ gzip: 0.21 kB │ map: 0.10 kB
154
- dist/lib/ui/uikit/dist/components/PlChartStackedBar/Legends.vue.js  0.27 kB │ gzip: 0.21 kB │ map: 0.10 kB
155
154
  dist/lib/ui/uikit/dist/assets/icons/icon-assets-min/24_linetype-longdash.svg.js  0.27 kB │ gzip: 0.23 kB │ map: 0.50 kB
155
+ dist/lib/ui/uikit/dist/components/PlChartStackedBar/Legends.vue.js  0.27 kB │ gzip: 0.21 kB │ map: 0.10 kB
156
156
  dist/lib/ui/uikit/dist/assets/icons/icon-assets-min/16_chevron-first.svg.js  0.28 kB │ gzip: 0.23 kB │ map: 0.48 kB
157
157
  dist/lib/ui/uikit/dist/components/PlIcon16/PlIcon16.vue.js  0.28 kB │ gzip: 0.22 kB │ map: 0.10 kB
158
158
  dist/lib/ui/uikit/dist/components/PlIcon24/PlIcon24.vue.js  0.28 kB │ gzip: 0.22 kB │ map: 0.10 kB
@@ -759,7 +759,6 @@ computing gzip size...
759
759
  dist/lib/util/helpers/dist/index.js  2.55 kB │ gzip: 1.06 kB │ map: 25.73 kB
760
760
  dist/plugins/Monetization/LimitCard.vue3.js  2.55 kB │ gzip: 0.92 kB │ map: 0.11 kB
761
761
  dist/lib/ui/uikit/dist/components/PlAccordion/PlAccordionSection.vue2.js  2.57 kB │ gzip: 1.15 kB │ map: 2.90 kB
762
- dist/node_modules/.pnpm/@vueuse_shared@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/shared/index.js  2.57 kB │ gzip: 1.13 kB │ map: 50.11 kB
763
762
  dist/components/PlTableFilters/PlTableFiltersV2.vue3.js  2.58 kB │ gzip: 0.94 kB │ map: 0.12 kB
764
763
  dist/plugins/Monetization/LimitCard.vue2.js  2.61 kB │ gzip: 0.88 kB │ map: 4.83 kB
765
764
  dist/lib/ui/uikit/dist/components/DataTable/TdCell.vue.js  2.61 kB │ gzip: 1.04 kB │ map: 4.63 kB
@@ -801,6 +800,7 @@ computing gzip size...
801
800
  dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.vue.js  3.59 kB │ gzip: 1.43 kB │ map: 2.78 kB
802
801
  dist/components/PlMultiSequenceAlignment/Consensus.vue2.js  3.59 kB │ gzip: 1.42 kB │ map: 6.62 kB
803
802
  dist/lib/ui/uikit/dist/components/PlBtnPrimary/PlBtnPrimary.vue.js  3.61 kB │ gzip: 1.35 kB │ map: 1.24 kB
803
+ dist/node_modules/.pnpm/@vueuse_shared@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/shared/index.js  3.61 kB │ gzip: 1.45 kB │ map: 51.57 kB
804
804
  dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.js  3.67 kB │ gzip: 1.01 kB │ map: 5.45 kB
805
805
  dist/lib/ui/uikit/dist/composition/useSortable.js  3.68 kB │ gzip: 1.32 kB │ map: 10.93 kB
806
806
  dist/lib/ui/uikit/dist/components/PlElementList/PlElementListItem.vue2.js  3.80 kB │ gzip: 1.15 kB │ map: 6.62 kB
@@ -817,10 +817,10 @@ computing gzip size...
817
817
  dist/components/PlAnnotations/components/DynamicForm.vue2.js  4.81 kB │ gzip: 1.43 kB │ map: 6.96 kB
818
818
  dist/components/PlAnnotations/components/FilterSidebar.vue2.js  4.88 kB │ gzip: 1.74 kB │ map: 6.15 kB
819
819
  dist/components/BlockLayout.vue2.js  4.96 kB │ gzip: 1.83 kB │ map: 2.95 kB
820
- dist/node_modules/.pnpm/@vueuse_core@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/core/index.js  5.11 kB │ gzip: 1.97 kB │ map: 252.41 kB
821
820
  dist/plugins/Monetization/MonetizationSidebar.vue.js  5.12 kB │ gzip: 1.79 kB │ map: 5.01 kB
822
821
  dist/lib/ui/uikit/dist/components/PlBtnGroup/PlBtnGroup.vue.js  5.18 kB │ gzip: 1.94 kB │ map: 3.19 kB
823
822
  dist/lib/ui/uikit/dist/components/PlTooltip/PlTooltip.vue.js  5.23 kB │ gzip: 1.93 kB │ map: 5.49 kB
823
+ dist/node_modules/.pnpm/@vueuse_core@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/core/index.js  5.24 kB │ gzip: 2.02 kB │ map: 252.41 kB
824
824
  dist/lib/ui/uikit/dist/components/Slider.vue.js  5.51 kB │ gzip: 1.92 kB │ map: 8.17 kB
825
825
  dist/components/PlAnnotations/components/FilterSidebar.vue3.js  5.58 kB │ gzip: 1.63 kB │ map: 0.11 kB
826
826
  dist/lib/ui/uikit/dist/components/PlSidebar/PlSidebarGroup.vue3.js  5.60 kB │ gzip: 1.65 kB │ map: 0.12 kB
@@ -828,11 +828,11 @@ computing gzip size...
828
828
  dist/internal/createAppV1.js  5.80 kB │ gzip: 1.89 kB │ map: 15.32 kB
829
829
  dist/lib/ui/uikit/dist/components/PlDialogModal/PlDialogModal.vue.js  5.80 kB │ gzip: 2.01 kB │ map: 5.33 kB
830
830
  dist/lib/ui/uikit/dist/components/PlSidebar/PlSidebarItem.vue3.js  5.87 kB │ gzip: 1.77 kB │ map: 0.12 kB
831
- dist/internal/createAppV2.js  6.49 kB │ gzip: 2.29 kB │ map: 18.40 kB
832
831
  dist/lib/ui/uikit/dist/components/PlLogView/PlLogView.vue.js  6.50 kB │ gzip: 2.32 kB │ map: 5.68 kB
833
832
  dist/components/PlTableFilters/PlTableFiltersV2.vue2.js  6.57 kB │ gzip: 2.06 kB │ map: 9.28 kB
834
833
  dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js  6.70 kB │ gzip: 1.86 kB │ map: 15.20 kB
835
834
  dist/lib/ui/uikit/dist/components/PlTextArea/PlTextArea.vue.js  6.71 kB │ gzip: 2.37 kB │ map: 5.76 kB
835
+ dist/internal/createAppV2.js  6.83 kB │ gzip: 2.41 kB │ map: 18.93 kB
836
836
  dist/lib/ui/uikit/dist/components/PlCheckbox/PlCheckboxBase.vue.js  6.88 kB │ gzip: 1.35 kB │ map: 0.85 kB
837
837
  dist/lib/ui/uikit/dist/components/SliderRange.vue.js  6.99 kB │ gzip: 2.19 kB │ map: 11.71 kB
838
838
  dist/lib/ui/uikit/dist/components/PlBtnSplit/PlBtnSplit.vue.js  7.12 kB │ gzip: 2.57 kB │ map: 8.61 kB
@@ -879,4 +879,4 @@ computing gzip size...
879
879
  dist/lib/ui/uikit/dist/index.js 497.77 kB │ gzip: 191.75 kB │ map: 0.18 kB
880
880
  dist/lib/ui/uikit/dist/components/PlSlideModal/PlPureSlideModal.vue.js 601.12 kB │ gzip: 204.71 kB │ map: 0.21 kB
881
881
  dist/lib/ui/uikit/dist/components/DataTable/TableComponent.vue.js 603.01 kB │ gzip: 205.56 kB │ map: 0.27 kB
882
- ✓ built in 9.90s
882
+ ✓ built in 8.94s
@@ -1,5 +1,5 @@
1
1
   WARN  Issue while reading "/home/runner/_work/platforma/platforma/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @platforma-sdk/ui-vue@1.42.2 type-check /home/runner/_work/platforma/platforma/sdk/ui-vue
3
+ > @platforma-sdk/ui-vue@1.42.3 type-check /home/runner/_work/platforma/platforma/sdk/ui-vue
4
4
  > vue-tsc --noEmit --project ./tsconfig.json
5
5
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @platforma-sdk/ui-vue
2
2
 
3
+ ## 1.42.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 6310c08: Use watch ignorable in createApp2
8
+
3
9
  ## 1.42.2
4
10
 
5
11
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"createAppV2.d.ts","sourceRoot":"","sources":["../../src/internal/createAppV2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIpI,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAO1G,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,eAAO,MAAM,sBAAsB,WAAY,YAAY,GAAG,SAAS,KAAG,YAGxE,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CACzB,IAAI,GAAG,OAAO,EACd,OAAO,SAAS,gBAAgB,GAAG,gBAAgB,EACnD,OAAO,GAAG,OA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pC,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,KAAG,OAAO,CAAC,OAAO,CAAC;uBAY9C,IAAI;;;;cAlNf,IAAI;iBACD,OAAO,CAAC,OAAO,CAAC;YACrB,OAAO;yBACM,eAAe,CAAC,IAAI,CAAC;;;;;EAmOzC;AAED,MAAM,MAAM,SAAS,CACnB,IAAI,GAAG,OAAO,EACd,OAAO,SAAS,gBAAgB,GAAG,gBAAgB,EACnD,OAAO,GAAG,OAAO,EACjB,IAAI,SAAS,IAAI,MAAM,EAAE,GAAG,IAAI,MAAM,EAAE,IACtC,UAAU,CAAC,OAAO,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC"}
@@ -1,77 +1,86 @@
1
- import { deepClone as l, uniqueId as V, delay as L } from "../lib/util/helpers/dist/index.js";
1
+ import { deepClone as i, uniqueId as V, delay as L } from "../lib/util/helpers/dist/index.js";
2
2
  import "../sdk/model/dist/index.js";
3
- import { ref as A, computed as p, reactive as P, watch as W } from "vue";
4
- import { createModel as B } from "../createModel.js";
5
- import { parseQuery as F } from "../urls.js";
3
+ import { ref as w, computed as g, reactive as N } from "vue";
4
+ import { createModel as P } from "../createModel.js";
5
+ import { parseQuery as W } from "../urls.js";
6
6
  import { MultiError as G, unwrapValueOrErrors as H } from "../utils.js";
7
7
  import "../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/index.js";
8
- import { UpdateSerializer as m } from "./UpdateSerializer.js";
9
- import { unwrapResult as c, hasAbortError as K } from "../lib/model/common/dist/index.js";
10
- import { applyPatch as O } from "../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/core.js";
11
- const Q = 100, X = (n) => ({
8
+ import { UpdateSerializer as v } from "./UpdateSerializer.js";
9
+ import { ignorableWatch as K } from "../node_modules/.pnpm/@vueuse_shared@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/shared/index.js";
10
+ import { unwrapResult as c, hasAbortError as X } from "../lib/model/common/dist/index.js";
11
+ import { applyPatch as B } from "../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/core.js";
12
+ const O = 100, Y = (n) => ({
12
13
  authorId: (n == null ? void 0 : n.authorId) ?? V(),
13
14
  localVersion: ((n == null ? void 0 : n.localVersion) ?? 0) + 1
14
- });
15
- function se(n, d, h) {
15
+ }), Q = (n) => {
16
+ try {
17
+ return JSON.stringify(n, null, 2);
18
+ } catch (u) {
19
+ return u instanceof Error ? u.message : String(u);
20
+ }
21
+ };
22
+ function ie(n, u, A) {
16
23
  const r = (e, ...t) => {
17
- h.debug && console.log(`%c>>> %c${e}`, "color: orange; font-weight: bold", "color: orange", h.appId, ...t);
24
+ A.debug && console.log(`%c>>> %c${e}`, "color: orange; font-weight: bold", "color: orange", ...t.map((a) => Q(a)));
18
25
  }, b = (e, ...t) => {
19
- console.error(`%c>>> %c${e}`, "color: red; font-weight: bold", "color: red", h.appId, ...t);
20
- }, u = {
26
+ console.error(`%c>>> %c${e}`, "color: red; font-weight: bold", "color: red", ...t.map((a) => Q(a)));
27
+ }, s = {
21
28
  isExternalSnapshot: !1,
22
29
  author: {
23
30
  authorId: V(),
24
31
  localVersion: 0
25
32
  }
26
- }, f = () => (u.author = X(u.author), r("nextAuthorMarker", u.author), u.author), g = A(!1), S = A(n.uTag), v = h.debounceSpan ?? 200, y = new m({ debounceSpan: v }), M = new m({ debounceSpan: v }), U = new m({ debounceSpan: v }), R = new m({ debounceSpan: v }), o = A(n.value), T = async (e) => d.setBlockArgs(e, f()), x = async (e) => d.setBlockUiState(e, f()), k = async (e, t) => d.setBlockArgsAndUiState(e, t, f()), q = async (e) => d.setNavigationState(e), C = p(() => {
33
+ }, m = () => (s.author = Y(s.author), r("nextAuthorMarker", s.author), s.author), h = w(!1), f = w(n.uTag), p = A.debounceSpan ?? 200, y = new v({ debounceSpan: p }), U = new v({ debounceSpan: p }), M = new v({ debounceSpan: p }), R = new v({ debounceSpan: p }), o = w(n.value), T = async (e) => u.setBlockArgs(e, m()), E = async (e) => u.setBlockUiState(e, m()), D = async (e, t) => u.setBlockArgsAndUiState(e, t, m()), k = async (e) => u.setNavigationState(e), q = g(() => {
27
34
  const e = Object.entries(o.value.outputs).map(([t, a]) => [t, a.ok && a.value !== void 0 ? a.value : void 0]);
28
35
  return Object.fromEntries(e);
29
- }), D = p(() => {
36
+ }), C = g(() => {
30
37
  const e = Object.entries(o.value.outputs).map(([t, a]) => [t, a && !a.ok ? new G(a.errors) : void 0]);
31
38
  return Object.fromEntries(e);
32
- }), s = P({
39
+ }), l = N({
33
40
  error: "",
34
41
  model: {
35
- args: l(o.value.args),
36
- ui: l(o.value.ui),
37
- outputs: C,
38
- outputErrors: D
42
+ args: i(o.value.args),
43
+ ui: i(o.value.ui),
44
+ outputs: q,
45
+ outputErrors: C
39
46
  }
40
- }), E = W(
41
- () => s.model,
47
+ }), { ignoreUpdates: $ } = K(
48
+ () => l.model,
42
49
  (e) => {
43
- const t = l(e);
44
- r("appModel.model", t), U.run(() => k(t.args, t.ui).then(c));
50
+ const t = i(e);
51
+ r("setArgsAndUiStateQueue appModel.model", t), M.run(() => D(t.args, t.ui).then(c));
45
52
  },
46
53
  { deep: !0 }
47
- ), $ = (e) => {
48
- r("updateAppModelSilently", e), E.pause(), s.model.args = l(e.args), s.model.ui = l(e.ui), E.resume();
54
+ ), z = (e) => {
55
+ r("updateAppModel", e), l.model.args = i(e.args), l.model.ui = i(e.ui);
49
56
  };
50
57
  (async () => {
51
58
  var e, t;
52
59
  for (window.addEventListener("beforeunload", () => {
53
- g.value = !0, d.dispose().then(c).catch((a) => {
60
+ h.value = !0, u.dispose().then(c).catch((a) => {
54
61
  b("error in dispose", a);
55
62
  });
56
- }); !g.value; )
63
+ }); !h.value; )
57
64
  try {
58
- const a = await d.getPatches(S.value).then(c);
59
- if (r("patches.length", a.value.length), r("uTagRef.value", S.value), r("patches.uTag", a.uTag), r("patches.author", a.author), r("data.author", u.author), S.value = a.uTag, a.value.length === 0) {
60
- await new Promise((w) => setTimeout(w, Q));
65
+ const a = await u.getPatches(f.value).then(c);
66
+ if (r("patches.length", a.value.length), r("uTagRef.value", f.value), r("patches.uTag", a.uTag), r("patches.author", a.author), r("data.author", s.author), f.value = a.uTag, a.value.length === 0) {
67
+ await new Promise((S) => setTimeout(S, O));
61
68
  continue;
62
69
  }
63
- const i = ((e = u.author) == null ? void 0 : e.authorId) !== ((t = a.author) == null ? void 0 : t.authorId);
64
- i || u.isExternalSnapshot ? (r("got external changes, applying them to the snapshot", JSON.stringify(o.value, null, 2)), o.value = O(o.value, a.value, !1, !1).newDocument, $(o.value), u.isExternalSnapshot = i) : o.value = O(o.value, a.value).newDocument, await new Promise((w) => setTimeout(w, Q));
70
+ const d = ((e = s.author) == null ? void 0 : e.authorId) !== ((t = a.author) == null ? void 0 : t.authorId);
71
+ d || s.isExternalSnapshot ? (r("got external changes, applying them to the snapshot", o.value), $(() => {
72
+ o.value = B(o.value, a.value, !1, !1).newDocument, z({ args: o.value.args, ui: o.value.ui }), s.isExternalSnapshot = d;
73
+ })) : o.value = B(o.value, a.value).newDocument, await new Promise((S) => setTimeout(S, O));
65
74
  } catch (a) {
66
- K(a) ? (r("patches loop aborted"), g.value = !0) : (b("error in patches loop", a), await new Promise((i) => setTimeout(i, 1e3)));
75
+ X(a) ? (r("patches loop aborted"), h.value = !0) : (b("error in patches loop", a), await new Promise((d) => setTimeout(d, 1e3)));
67
76
  }
68
77
  })();
69
- const I = () => l(s.model.args), j = () => l(s.model.ui), N = () => l(o.value.navigationState), z = {
70
- cloneArgs: I,
78
+ const x = () => i(l.model.args), j = () => i(l.model.ui), I = () => i(o.value.navigationState), F = {
79
+ cloneArgs: x,
71
80
  cloneUiState: j,
72
- cloneNavigationState: N,
81
+ cloneNavigationState: I,
73
82
  createArgsModel(e = {}) {
74
- return B({
83
+ return P({
75
84
  get() {
76
85
  return e.transform ? e.transform(o.value.args) : o.value.args;
77
86
  },
@@ -86,14 +95,14 @@ function se(n, d, h) {
86
95
  * defaultUiState is temporarily here, remove it after implementing initialUiState
87
96
  */
88
97
  createUiModel(e = {}, t) {
89
- return B({
98
+ return P({
90
99
  get() {
91
100
  return e.transform ? e.transform(o.value.ui) : o.value.ui ?? t();
92
101
  },
93
102
  validate: e.validate,
94
103
  autoSave: !0,
95
104
  onSave(a) {
96
- M.run(() => x(a).then(c));
105
+ U.run(() => E(a).then(c));
97
106
  }
98
107
  });
99
108
  },
@@ -106,7 +115,7 @@ function se(n, d, h) {
106
115
  * @returns An object with unwrapped output values.
107
116
  */
108
117
  unwrapOutputs(...e) {
109
- const t = o.value.outputs, a = e.map((i) => [i, H(t[i])]);
118
+ const t = o.value.outputs, a = e.map((d) => [d, H(t[d])]);
110
119
  return Object.fromEntries(a);
111
120
  },
112
121
  /**
@@ -116,8 +125,8 @@ function se(n, d, h) {
116
125
  * @returns A promise resolving after the update is applied.
117
126
  */
118
127
  updateArgs(e) {
119
- const t = I();
120
- return e(t), r("updateArgs", t), s.model.args = t, y.run(() => T(t).then(c));
128
+ const t = x();
129
+ return e(t), r("updateArgs", t), l.model.args = t, y.run(() => T(t).then(c));
121
130
  },
122
131
  /**
123
132
  * Updates the UI state by applying a callback.
@@ -128,7 +137,7 @@ function se(n, d, h) {
128
137
  */
129
138
  updateUiState(e) {
130
139
  const t = e(j());
131
- return r("updateUiState", t), s.model.ui = t, M.run(() => x(t).then(c));
140
+ return r("updateUiState", t), l.model.ui = t, U.run(() => E(t).then(c));
132
141
  },
133
142
  /**
134
143
  * Navigates to a specific href by updating the navigation state.
@@ -137,24 +146,24 @@ function se(n, d, h) {
137
146
  * @returns A promise resolving after the navigation state is updated.
138
147
  */
139
148
  navigateTo(e) {
140
- const t = N();
141
- return t.href = e, R.run(() => q(t).then(c));
149
+ const t = I();
150
+ return t.href = e, R.run(() => k(t).then(c));
142
151
  },
143
152
  async allSettled() {
144
- return await L(0), U.allSettled();
153
+ return await L(0), M.allSettled();
145
154
  }
146
155
  }, J = {
147
- closedRef: g,
156
+ closedRef: h,
148
157
  snapshot: o,
149
- queryParams: p(() => F(o.value.navigationState.href)),
150
- href: p(() => o.value.navigationState.href),
151
- hasErrors: p(() => Object.values(o.value.outputs).some((e) => !(e != null && e.ok)))
158
+ queryParams: g(() => W(o.value.navigationState.href)),
159
+ href: g(() => o.value.navigationState.href),
160
+ hasErrors: g(() => Object.values(o.value.outputs).some((e) => !(e != null && e.ok)))
152
161
  };
153
- return P(Object.assign(s, z, J));
162
+ return N(Object.assign(l, F, J));
154
163
  }
155
164
  export {
156
- se as createAppV2,
157
- X as createNextAuthorMarker,
158
- Q as patchPoolingDelay
165
+ ie as createAppV2,
166
+ Y as createNextAuthorMarker,
167
+ O as patchPoolingDelay
159
168
  };
160
169
  //# sourceMappingURL=createAppV2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createAppV2.js","sources":["../../src/internal/createAppV2.ts"],"sourcesContent":["import { deepClone, delay, uniqueId } from '@milaboratories/helpers';\nimport type { Mutable } from '@milaboratories/helpers';\nimport type { NavigationState, BlockOutputsBase, BlockState, PlatformaV2, ValueWithUTag, AuthorMarker } from '@platforma-sdk/model';\nimport { hasAbortError, unwrapResult } from '@platforma-sdk/model';\nimport type { Ref } from 'vue';\nimport { reactive, computed, ref, watch } from 'vue';\nimport type { StateModelOptions, UnwrapOutputs, OutputValues, OutputErrors, AppSettings } from '../types';\nimport { createModel } from '../createModel';\nimport { parseQuery } from '../urls';\nimport { MultiError, unwrapValueOrErrors } from '../utils';\nimport { applyPatch } from 'fast-json-patch';\nimport { UpdateSerializer } from './UpdateSerializer';\n\nexport const patchPoolingDelay = 100;\n\nexport const createNextAuthorMarker = (marker: AuthorMarker | undefined): AuthorMarker => ({\n authorId: marker?.authorId ?? uniqueId(),\n localVersion: (marker?.localVersion ?? 0) + 1,\n});\n\n/**\n * Creates an application instance with reactive state management, outputs, and methods for state updates and navigation.\n *\n * @template Args - The type of arguments used in the application.\n * @template Outputs - The type of block outputs extending `BlockOutputsBase`.\n * @template UiState - The type of the UI state.\n * @template Href - The type of navigation href, defaulting to a string starting with `/`.\n *\n * @param state - Initial state of the application, including args, outputs, UI state, and navigation state.\n * @param platforma - A platform interface for interacting with block states.\n * @param settings - Application settings, such as debug flags.\n *\n * @returns A reactive application object with methods, getters, and state.\n */\nexport function createAppV2<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n>(\n state: ValueWithUTag<BlockState<Args, Outputs, UiState, Href>>,\n platforma: PlatformaV2<Args, Outputs, UiState, Href>,\n settings: AppSettings,\n) {\n const debug = (msg: string, ...rest: unknown[]) => {\n if (settings.debug) {\n console.log(`%c>>> %c${msg}`, 'color: orange; font-weight: bold', 'color: orange', settings.appId, ...rest);\n }\n };\n\n const error = (msg: string, ...rest: unknown[]) => {\n console.error(`%c>>> %c${msg}`, 'color: red; font-weight: bold', 'color: red', settings.appId, ...rest);\n };\n\n const data = {\n isExternalSnapshot: false,\n author: {\n authorId: uniqueId(),\n localVersion: 0,\n },\n };\n\n const nextAuthorMarker = () => {\n data.author = createNextAuthorMarker(data.author);\n debug('nextAuthorMarker', data.author);\n return data.author;\n };\n\n const closedRef = ref(false);\n\n const uTagRef = ref(state.uTag);\n\n const debounceSpan = settings.debounceSpan ?? 200;\n\n const setArgsQueue = new UpdateSerializer({ debounceSpan });\n const setUiStateQueue = new UpdateSerializer({ debounceSpan });\n const setArgsAndUiStateQueue = new UpdateSerializer({ debounceSpan });\n const setNavigationStateQueue = new UpdateSerializer({ debounceSpan });\n /**\n * Reactive snapshot of the application state, including args, outputs, UI state, and navigation state.\n */\n const snapshot = ref<{\n args: Args;\n outputs: Partial<Outputs>;\n ui: UiState;\n navigationState: NavigationState<Href>;\n }>(state.value) as Ref<{\n args: Args;\n outputs: Partial<Outputs>;\n ui: UiState;\n navigationState: NavigationState<Href>;\n }>;\n\n const setBlockArgs = async (args: Args) => {\n return platforma.setBlockArgs(args, nextAuthorMarker());\n };\n\n const setBlockUiState = async (ui: UiState) => {\n return platforma.setBlockUiState(ui, nextAuthorMarker());\n };\n\n const setBlockArgsAndUiState = async (args: Args, ui: UiState) => {\n return platforma.setBlockArgsAndUiState(args, ui, nextAuthorMarker());\n };\n\n const setNavigationState = async (state: NavigationState<Href>) => {\n return platforma.setNavigationState(state);\n };\n\n const outputs = computed<OutputValues<Outputs>>(() => {\n const entries = Object.entries(snapshot.value.outputs as Partial<Readonly<Outputs>>).map(([k, vOrErr]) => [k, vOrErr.ok && vOrErr.value !== undefined ? vOrErr.value : undefined]);\n return Object.fromEntries(entries);\n });\n\n const outputErrors = computed<OutputErrors<Outputs>>(() => {\n const entries = Object.entries(snapshot.value.outputs as Partial<Readonly<Outputs>>).map(([k, vOrErr]) => [k, vOrErr && !vOrErr.ok ? new MultiError(vOrErr.errors) : undefined]);\n return Object.fromEntries(entries);\n });\n\n const appModel = reactive({\n error: '',\n model: {\n args: deepClone(snapshot.value.args) as Args,\n ui: deepClone(snapshot.value.ui) as UiState,\n outputs,\n outputErrors,\n },\n }) as {\n error: string;\n model: {\n args: Args;\n ui: UiState;\n outputs: OutputValues<Outputs>;\n outputErrors: OutputErrors<Outputs>;\n };\n };\n\n const appModelWatch = watch(\n () => appModel.model,\n (_newData) => {\n const newData = deepClone(_newData);\n debug('appModel.model', newData);\n setArgsAndUiStateQueue.run(() => setBlockArgsAndUiState(newData.args, newData.ui).then(unwrapResult));\n },\n { deep: true },\n );\n\n const updateAppModelSilently = (newData: {\n args: Args;\n ui: UiState;\n }) => {\n debug('updateAppModelSilently', newData);\n appModelWatch.pause();\n appModel.model.args = deepClone(newData.args) as Args;\n appModel.model.ui = deepClone(newData.ui) as UiState;\n appModelWatch.resume();\n };\n\n (async () => {\n window.addEventListener('beforeunload', () => {\n closedRef.value = true;\n platforma.dispose().then(unwrapResult).catch((err) => {\n error('error in dispose', err);\n });\n });\n\n while (!closedRef.value) {\n try {\n const patches = await platforma.getPatches(uTagRef.value).then(unwrapResult);\n\n debug('patches.length', patches.value.length);\n debug('uTagRef.value', uTagRef.value);\n debug('patches.uTag', patches.uTag);\n debug('patches.author', patches.author);\n debug('data.author', data.author);\n\n uTagRef.value = patches.uTag;\n\n if (patches.value.length === 0) {\n await new Promise((resolve) => setTimeout(resolve, patchPoolingDelay));\n continue;\n }\n\n const isAuthorChanged = data.author?.authorId !== patches.author?.authorId;\n\n // Immutable behavior, apply external changes to the snapshot\n if (isAuthorChanged || data.isExternalSnapshot) {\n debug('got external changes, applying them to the snapshot', JSON.stringify(snapshot.value, null, 2));\n snapshot.value = applyPatch(snapshot.value, patches.value, false, false).newDocument;\n updateAppModelSilently(snapshot.value);\n data.isExternalSnapshot = isAuthorChanged;\n } else {\n // Mutable behavior\n snapshot.value = applyPatch(snapshot.value, patches.value).newDocument;\n }\n\n await new Promise((resolve) => setTimeout(resolve, patchPoolingDelay));\n } catch (err) {\n if (hasAbortError(err)) {\n debug('patches loop aborted');\n closedRef.value = true;\n } else {\n error('error in patches loop', err);\n await new Promise((resolve) => setTimeout(resolve, 1000));\n }\n }\n }\n })();\n\n const cloneArgs = () => deepClone(appModel.model.args) as Args;\n const cloneUiState = () => deepClone(appModel.model.ui) as UiState;\n const cloneNavigationState = () => deepClone(snapshot.value.navigationState) as Mutable<NavigationState<Href>>;\n\n const methods = {\n cloneArgs,\n cloneUiState,\n cloneNavigationState,\n createArgsModel<T extends Args = Args>(options: StateModelOptions<Args, T> = {}) {\n return createModel<T, Args>({\n get() {\n if (options.transform) {\n return options.transform(snapshot.value.args as Args);\n }\n\n return snapshot.value.args as T;\n },\n validate: options.validate,\n autoSave: true,\n onSave(newArgs) {\n setArgsQueue.run(() => setBlockArgs(newArgs).then(unwrapResult));\n },\n });\n },\n /**\n * defaultUiState is temporarily here, remove it after implementing initialUiState\n */\n createUiModel<T extends UiState = UiState>(options: StateModelOptions<UiState, T> = {}, defaultUiState: () => UiState) {\n return createModel<T, UiState>({\n get() {\n if (options.transform) {\n return options.transform(snapshot.value.ui as UiState);\n }\n\n return (snapshot.value.ui ?? defaultUiState()) as T;\n },\n validate: options.validate,\n autoSave: true,\n onSave(newData) {\n setUiStateQueue.run(() => setBlockUiState(newData).then(unwrapResult));\n },\n });\n },\n /**\n * Retrieves the unwrapped values of outputs for the given keys.\n *\n * @template K - Keys of the outputs to unwrap.\n * @param keys - List of output names.\n * @throws Error if the outputs contain errors.\n * @returns An object with unwrapped output values.\n */\n unwrapOutputs<K extends keyof Outputs>(...keys: K[]): UnwrapOutputs<Outputs, K> {\n const outputs = snapshot.value.outputs as Partial<Readonly<Outputs>>;\n const entries = keys.map((key) => [key, unwrapValueOrErrors(outputs[key])]);\n return Object.fromEntries(entries);\n },\n /**\n * Updates the arguments state by applying a callback.\n *\n * @param cb - Callback to modify the current arguments.\n * @returns A promise resolving after the update is applied.\n */\n updateArgs(cb: (args: Args) => void): Promise<boolean> {\n const newArgs = cloneArgs();\n cb(newArgs);\n debug('updateArgs', newArgs);\n appModel.model.args = newArgs;\n return setArgsQueue.run(() => setBlockArgs(newArgs).then(unwrapResult));\n },\n /**\n * Updates the UI state by applying a callback.\n *\n * @param cb - Callback to modify the current UI state.\n * @returns A promise resolving after the update is applied.\n * @todo Make it mutable since there is already an initial one\n */\n updateUiState(cb: (args: UiState) => UiState): Promise<boolean> {\n const newUiState = cb(cloneUiState());\n debug('updateUiState', newUiState);\n appModel.model.ui = newUiState;\n return setUiStateQueue.run(() => setBlockUiState(newUiState).then(unwrapResult));\n },\n /**\n * Navigates to a specific href by updating the navigation state.\n *\n * @param href - The target href to navigate to.\n * @returns A promise resolving after the navigation state is updated.\n */\n navigateTo(href: Href) {\n const newState = cloneNavigationState();\n newState.href = href;\n return setNavigationStateQueue.run(() => setNavigationState(newState).then(unwrapResult));\n },\n async allSettled() {\n await delay(0);\n return setArgsAndUiStateQueue.allSettled();\n },\n };\n\n const getters = {\n closedRef,\n snapshot,\n queryParams: computed(() => parseQuery<Href>(snapshot.value.navigationState.href as Href)),\n href: computed(() => snapshot.value.navigationState.href),\n hasErrors: computed(() => Object.values(snapshot.value.outputs as Partial<Readonly<Outputs>>).some((v) => !v?.ok)),\n };\n\n return reactive(Object.assign(appModel, methods, getters));\n}\n\nexport type BaseAppV2<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n> = ReturnType<typeof createAppV2<Args, Outputs, UiState, Href>>;\n"],"names":["patchPoolingDelay","createNextAuthorMarker","marker","uniqueId","createAppV2","state","platforma","settings","debug","msg","rest","error","data","nextAuthorMarker","closedRef","ref","uTagRef","debounceSpan","setArgsQueue","UpdateSerializer","setUiStateQueue","setArgsAndUiStateQueue","setNavigationStateQueue","snapshot","setBlockArgs","args","setBlockUiState","ui","setBlockArgsAndUiState","setNavigationState","outputs","computed","entries","k","vOrErr","outputErrors","MultiError","appModel","reactive","deepClone","appModelWatch","watch","_newData","newData","unwrapResult","updateAppModelSilently","err","patches","resolve","isAuthorChanged","_a","_b","applyPatch","hasAbortError","cloneArgs","cloneUiState","cloneNavigationState","methods","options","createModel","newArgs","defaultUiState","keys","key","unwrapValueOrErrors","cb","newUiState","href","newState","delay","getters","parseQuery","v"],"mappings":";;;;;;;;;;AAaO,MAAMA,IAAoB,KAEpBC,IAAyB,CAACC,OAAoD;AAAA,EACzF,WAAUA,KAAA,gBAAAA,EAAQ,aAAYC,EAAS;AAAA,EACvC,gBAAeD,KAAA,gBAAAA,EAAQ,iBAAgB,KAAK;AAC9C;AAgBgB,SAAAE,GAMdC,GACAC,GACAC,GACA;AACM,QAAAC,IAAQ,CAACC,MAAgBC,MAAoB;AACjD,IAAIH,EAAS,SACH,QAAA,IAAI,WAAWE,CAAG,IAAI,oCAAoC,iBAAiBF,EAAS,OAAO,GAAGG,CAAI;AAAA,EAE9G,GAEMC,IAAQ,CAACF,MAAgBC,MAAoB;AACzC,YAAA,MAAM,WAAWD,CAAG,IAAI,iCAAiC,cAAcF,EAAS,OAA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,GAAkD;AACxD,YAAAC,IAAaD,EAAGV,GAAc;AACpC,aAAA/C,EAAM,iBAAiB0D,CAAU,GACjC7B,EAAS,MAAM,KAAK6B,GACb9C,EAAgB,IAAI,MAAMM,EAAgBwC,CAAU,EAAE,KAAKtB,CAAY,CAAC;AAAA,IACjF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,WAAWuB,GAAY;AACrB,YAAMC,IAAWZ,EAAqB;AACtC,aAAAY,EAAS,OAAOD,GACT7C,EAAwB,IAAI,MAAMO,EAAmBuC,CAAQ,EAAE,KAAKxB,CAAY,CAAC;AAAA,IAC1F;AAAA,IACA,MAAM,aAAa;AACjB,mBAAMyB,EAAM,CAAC,GACNhD,EAAuB,WAAW;AAAA,IAAA;AAAA,EAE7C,GAEMiD,IAAU;AAAA,IACd,WAAAxD;AAAA,IACA,UAAAS;AAAA,IACA,aAAaQ,EAAS,MAAMwC,EAAiBhD,EAAS,MAAM,gBAAgB,IAAY,CAAC;AAAA,IACzF,MAAMQ,EAAS,MAAMR,EAAS,MAAM,gBAAgB,IAAI;AAAA,IACxD,WAAWQ,EAAS,MAAM,OAAO,OAAOR,EAAS,MAAM,OAAqC,EAAE,KAAK,CAACiD,MAAM,EAACA,KAAA,QAAAA,EAAG,GAAE,CAAC;AAAA,EACnH;AAEA,SAAOlC,EAAS,OAAO,OAAOD,GAAUoB,GAASa,CAAO,CAAC;AAC3D;"}
1
+ {"version":3,"file":"createAppV2.js","sources":["../../src/internal/createAppV2.ts"],"sourcesContent":["import { deepClone, delay, uniqueId } from '@milaboratories/helpers';\nimport type { Mutable } from '@milaboratories/helpers';\nimport type { NavigationState, BlockOutputsBase, BlockState, PlatformaV2, ValueWithUTag, AuthorMarker } from '@platforma-sdk/model';\nimport { hasAbortError, unwrapResult } from '@platforma-sdk/model';\nimport type { Ref } from 'vue';\nimport { reactive, computed, ref } from 'vue';\nimport type { StateModelOptions, UnwrapOutputs, OutputValues, OutputErrors, AppSettings } from '../types';\nimport { createModel } from '../createModel';\nimport { parseQuery } from '../urls';\nimport { MultiError, unwrapValueOrErrors } from '../utils';\nimport { applyPatch } from 'fast-json-patch';\nimport { UpdateSerializer } from './UpdateSerializer';\nimport { watchIgnorable } from '@vueuse/core';\n\nexport const patchPoolingDelay = 100;\n\nexport const createNextAuthorMarker = (marker: AuthorMarker | undefined): AuthorMarker => ({\n authorId: marker?.authorId ?? uniqueId(),\n localVersion: (marker?.localVersion ?? 0) + 1,\n});\n\nconst stringifyForDebug = (v: unknown) => {\n try {\n return JSON.stringify(v, null, 2);\n } catch (err) {\n return err instanceof Error ? err.message : String(err);\n }\n};\n\n/**\n * Creates an application instance with reactive state management, outputs, and methods for state updates and navigation.\n *\n * @template Args - The type of arguments used in the application.\n * @template Outputs - The type of block outputs extending `BlockOutputsBase`.\n * @template UiState - The type of the UI state.\n * @template Href - The type of navigation href, defaulting to a string starting with `/`.\n *\n * @param state - Initial state of the application, including args, outputs, UI state, and navigation state.\n * @param platforma - A platform interface for interacting with block states.\n * @param settings - Application settings, such as debug flags.\n *\n * @returns A reactive application object with methods, getters, and state.\n */\nexport function createAppV2<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n>(\n state: ValueWithUTag<BlockState<Args, Outputs, UiState, Href>>,\n platforma: PlatformaV2<Args, Outputs, UiState, Href>,\n settings: AppSettings,\n) {\n const debug = (msg: string, ...rest: unknown[]) => {\n if (settings.debug) {\n console.log(`%c>>> %c${msg}`, 'color: orange; font-weight: bold', 'color: orange', ...rest.map((r) => stringifyForDebug(r)));\n }\n };\n\n const error = (msg: string, ...rest: unknown[]) => {\n console.error(`%c>>> %c${msg}`, 'color: red; font-weight: bold', 'color: red', ...rest.map((r) => stringifyForDebug(r)));\n };\n\n const data = {\n isExternalSnapshot: false,\n author: {\n authorId: uniqueId(),\n localVersion: 0,\n },\n };\n\n const nextAuthorMarker = () => {\n data.author = createNextAuthorMarker(data.author);\n debug('nextAuthorMarker', data.author);\n return data.author;\n };\n\n const closedRef = ref(false);\n\n const uTagRef = ref(state.uTag);\n\n const debounceSpan = settings.debounceSpan ?? 200;\n\n const setArgsQueue = new UpdateSerializer({ debounceSpan });\n const setUiStateQueue = new UpdateSerializer({ debounceSpan });\n const setArgsAndUiStateQueue = new UpdateSerializer({ debounceSpan });\n const setNavigationStateQueue = new UpdateSerializer({ debounceSpan });\n /**\n * Reactive snapshot of the application state, including args, outputs, UI state, and navigation state.\n */\n const snapshot = ref<{\n args: Args;\n outputs: Partial<Outputs>;\n ui: UiState;\n navigationState: NavigationState<Href>;\n }>(state.value) as Ref<{\n args: Args;\n outputs: Partial<Outputs>;\n ui: UiState;\n navigationState: NavigationState<Href>;\n }>;\n\n const setBlockArgs = async (args: Args) => {\n return platforma.setBlockArgs(args, nextAuthorMarker());\n };\n\n const setBlockUiState = async (ui: UiState) => {\n return platforma.setBlockUiState(ui, nextAuthorMarker());\n };\n\n const setBlockArgsAndUiState = async (args: Args, ui: UiState) => {\n return platforma.setBlockArgsAndUiState(args, ui, nextAuthorMarker());\n };\n\n const setNavigationState = async (state: NavigationState<Href>) => {\n return platforma.setNavigationState(state);\n };\n\n const outputs = computed<OutputValues<Outputs>>(() => {\n const entries = Object.entries(snapshot.value.outputs as Partial<Readonly<Outputs>>).map(([k, vOrErr]) => [k, vOrErr.ok && vOrErr.value !== undefined ? vOrErr.value : undefined]);\n return Object.fromEntries(entries);\n });\n\n const outputErrors = computed<OutputErrors<Outputs>>(() => {\n const entries = Object.entries(snapshot.value.outputs as Partial<Readonly<Outputs>>).map(([k, vOrErr]) => [k, vOrErr && !vOrErr.ok ? new MultiError(vOrErr.errors) : undefined]);\n return Object.fromEntries(entries);\n });\n\n const appModel = reactive({\n error: '',\n model: {\n args: deepClone(snapshot.value.args) as Args,\n ui: deepClone(snapshot.value.ui) as UiState,\n outputs,\n outputErrors,\n },\n }) as {\n error: string;\n model: {\n args: Args;\n ui: UiState;\n outputs: OutputValues<Outputs>;\n outputErrors: OutputErrors<Outputs>;\n };\n };\n\n const { ignoreUpdates } = watchIgnorable(\n () => appModel.model,\n (_newData) => {\n const newData = deepClone(_newData);\n debug('setArgsAndUiStateQueue appModel.model', newData);\n setArgsAndUiStateQueue.run(() => setBlockArgsAndUiState(newData.args, newData.ui).then(unwrapResult));\n },\n { deep: true },\n );\n\n const updateAppModel = (newData: {\n args: Args;\n ui: UiState;\n }) => {\n debug('updateAppModel', newData);\n appModel.model.args = deepClone(newData.args) as Args;\n appModel.model.ui = deepClone(newData.ui) as UiState;\n };\n\n (async () => {\n window.addEventListener('beforeunload', () => {\n closedRef.value = true;\n platforma.dispose().then(unwrapResult).catch((err) => {\n error('error in dispose', err);\n });\n });\n\n while (!closedRef.value) {\n try {\n const patches = await platforma.getPatches(uTagRef.value).then(unwrapResult);\n\n debug('patches.length', patches.value.length);\n debug('uTagRef.value', uTagRef.value);\n debug('patches.uTag', patches.uTag);\n debug('patches.author', patches.author);\n debug('data.author', data.author);\n\n uTagRef.value = patches.uTag;\n\n if (patches.value.length === 0) {\n await new Promise((resolve) => setTimeout(resolve, patchPoolingDelay));\n continue;\n }\n\n const isAuthorChanged = data.author?.authorId !== patches.author?.authorId;\n\n // Immutable behavior, apply external changes to the snapshot\n if (isAuthorChanged || data.isExternalSnapshot) {\n debug('got external changes, applying them to the snapshot', snapshot.value);\n ignoreUpdates(() => {\n snapshot.value = applyPatch(snapshot.value, patches.value, false, false).newDocument;\n updateAppModel({ args: snapshot.value.args, ui: snapshot.value.ui });\n data.isExternalSnapshot = isAuthorChanged;\n });\n } else {\n // Mutable behavior\n snapshot.value = applyPatch(snapshot.value, patches.value).newDocument;\n }\n\n await new Promise((resolve) => setTimeout(resolve, patchPoolingDelay));\n } catch (err) {\n if (hasAbortError(err)) {\n debug('patches loop aborted');\n closedRef.value = true;\n } else {\n error('error in patches loop', err);\n await new Promise((resolve) => setTimeout(resolve, 1000));\n }\n }\n }\n })();\n\n const cloneArgs = () => deepClone(appModel.model.args) as Args;\n const cloneUiState = () => deepClone(appModel.model.ui) as UiState;\n const cloneNavigationState = () => deepClone(snapshot.value.navigationState) as Mutable<NavigationState<Href>>;\n\n const methods = {\n cloneArgs,\n cloneUiState,\n cloneNavigationState,\n createArgsModel<T extends Args = Args>(options: StateModelOptions<Args, T> = {}) {\n return createModel<T, Args>({\n get() {\n if (options.transform) {\n return options.transform(snapshot.value.args as Args);\n }\n\n return snapshot.value.args as T;\n },\n validate: options.validate,\n autoSave: true,\n onSave(newArgs) {\n setArgsQueue.run(() => setBlockArgs(newArgs).then(unwrapResult));\n },\n });\n },\n /**\n * defaultUiState is temporarily here, remove it after implementing initialUiState\n */\n createUiModel<T extends UiState = UiState>(options: StateModelOptions<UiState, T> = {}, defaultUiState: () => UiState) {\n return createModel<T, UiState>({\n get() {\n if (options.transform) {\n return options.transform(snapshot.value.ui as UiState);\n }\n\n return (snapshot.value.ui ?? defaultUiState()) as T;\n },\n validate: options.validate,\n autoSave: true,\n onSave(newData) {\n setUiStateQueue.run(() => setBlockUiState(newData).then(unwrapResult));\n },\n });\n },\n /**\n * Retrieves the unwrapped values of outputs for the given keys.\n *\n * @template K - Keys of the outputs to unwrap.\n * @param keys - List of output names.\n * @throws Error if the outputs contain errors.\n * @returns An object with unwrapped output values.\n */\n unwrapOutputs<K extends keyof Outputs>(...keys: K[]): UnwrapOutputs<Outputs, K> {\n const outputs = snapshot.value.outputs as Partial<Readonly<Outputs>>;\n const entries = keys.map((key) => [key, unwrapValueOrErrors(outputs[key])]);\n return Object.fromEntries(entries);\n },\n /**\n * Updates the arguments state by applying a callback.\n *\n * @param cb - Callback to modify the current arguments.\n * @returns A promise resolving after the update is applied.\n */\n updateArgs(cb: (args: Args) => void): Promise<boolean> {\n const newArgs = cloneArgs();\n cb(newArgs);\n debug('updateArgs', newArgs);\n appModel.model.args = newArgs;\n return setArgsQueue.run(() => setBlockArgs(newArgs).then(unwrapResult));\n },\n /**\n * Updates the UI state by applying a callback.\n *\n * @param cb - Callback to modify the current UI state.\n * @returns A promise resolving after the update is applied.\n * @todo Make it mutable since there is already an initial one\n */\n updateUiState(cb: (args: UiState) => UiState): Promise<boolean> {\n const newUiState = cb(cloneUiState());\n debug('updateUiState', newUiState);\n appModel.model.ui = newUiState;\n return setUiStateQueue.run(() => setBlockUiState(newUiState).then(unwrapResult));\n },\n /**\n * Navigates to a specific href by updating the navigation state.\n *\n * @param href - The target href to navigate to.\n * @returns A promise resolving after the navigation state is updated.\n */\n navigateTo(href: Href) {\n const newState = cloneNavigationState();\n newState.href = href;\n return setNavigationStateQueue.run(() => setNavigationState(newState).then(unwrapResult));\n },\n async allSettled() {\n await delay(0);\n return setArgsAndUiStateQueue.allSettled();\n },\n };\n\n const getters = {\n closedRef,\n snapshot,\n queryParams: computed(() => parseQuery<Href>(snapshot.value.navigationState.href as Href)),\n href: computed(() => snapshot.value.navigationState.href),\n hasErrors: computed(() => Object.values(snapshot.value.outputs as Partial<Readonly<Outputs>>).some((v) => !v?.ok)),\n };\n\n return reactive(Object.assign(appModel, methods, getters));\n}\n\nexport type BaseAppV2<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n> = ReturnType<typeof createAppV2<Args, Outputs, UiState, Href>>;\n"],"names":["patchPoolingDelay","createNextAuthorMarker","marker","uniqueId","stringifyForDebug","v","err","createAppV2","state","platforma","settings","debug","msg","rest","r","error","data","nextAuthorMarker","closedRef","ref","uTagRef","debounceSpan","setArgsQueue","UpdateSerializer","setUiStateQueue","setArgsAndUiStateQueue","setNavigationStateQueue","snapshot","setBlockArgs","args","setBlockUiState","ui","setBlockArgsAndUiState","setNavigationState","outputs","computed","entries","k","vOrErr","outputErrors","MultiError","appModel","reactive","deepClone","ignoreUpdates","watchIgnorable","_newData","newData","unwrapResult","updateAppModel","patches","resolve","isAuthorChanged","_a","_b","applyPatch","hasAbortError","cloneArgs","cloneUiState","cloneNavigationState","methods","options","createModel","newArgs","defaultUiState","keys","key","unwrapValueOrErrors","cb","newUiState","href","newState","delay","getters","parseQuery"],"mappings":";;;;;;;;;;;AAcO,MAAMA,IAAoB,KAEpBC,IAAyB,CAACC,OAAoD;AAAA,EACzF,WAAUA,KAAA,gBAAAA,EAAQ,aAAYC,EAAS;AAAA,EACvC,gBAAeD,KAAA,gBAAAA,EAAQ,iBAAgB,KAAK;AAC9C,IAEME,IAAoB,CAACC,MAAe;AACpC,MAAA;AACF,WAAO,KAAK,UAAUA,GAAG,MAAM,CAAC;AAAA,WACzBC,GAAK;AACZ,WAAOA,aAAe,QAAQA,EAAI,UAAU,OAAOA,CAAG;AAAA,EAAA;AAE1D;AAgBgB,SAAAC,GAMdC,GACAC,GACAC,GACA;AACM,QAAAC,IAAQ,CAACC,MAAgBC,MAAoB;AACjD,IAAIH,EAAS,SACX,QAAQ,IAAI,WAAWE,CAAG,IAAI,oCAAoC,iBAAiB,GAAGC,EAAK,IAAI,CAACC,MAAMV,EAAkBU,CAAC,CAAC,CAAC;AAAA,EAE/H,GAEMC,IAAQ,CAACH,MAAgBC,MAAoB;AACjD,YAAQ,MAAM,WAAWD,CAAG,IAAI,iCAAiC,cAAc,GAAGC,EAAK,IAAI,CAACC,MAAMV,EAAkBU,CAAC,CAAC,CAAC;AAAA,EACzH,GAEME,IAAO;AAAA,IACX,oBAAoB;AAAA,IACpB,QAAQ;AAAA,MACN,UAAUb,EAAS;AAAA,MACnB,cAAc;AAAA,IAAA;AAAA,EAElB,GAEMc,IAAmB,OAClBD,EAAA,SAASf,EAAuBe,EAAK,MAAM,GAC1CL,EAAA,oBAAoBK,EAAK,MAAM,GAC9BA,EAAK,SAGRE,IAAYC,EAAI,EAAK,GAErBC,IAAUD,EAAIX,EAAM,IAAI,GAExBa,IAAeX,EAAS,gBAAgB,KAExCY,IAAe,IAAIC,EAAiB,EAAE,cAAAF,GAAc,GACpDG,IAAkB,IAAID,EAAiB,EAAE,cAAAF,GAAc,GACvDI,IAAyB,IA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MwB,EAAM,CAAC,GACN/C,EAAuB,WAAW;AAAA,IAAA;AAAA,EAE7C,GAEMgD,IAAU;AAAA,IACd,WAAAvD;AAAA,IACA,UAAAS;AAAA,IACA,aAAaQ,EAAS,MAAMuC,EAAiB/C,EAAS,MAAM,gBAAgB,IAAY,CAAC;AAAA,IACzF,MAAMQ,EAAS,MAAMR,EAAS,MAAM,gBAAgB,IAAI;AAAA,IACxD,WAAWQ,EAAS,MAAM,OAAO,OAAOR,EAAS,MAAM,OAAqC,EAAE,KAAK,CAACtB,MAAM,EAACA,KAAA,QAAAA,EAAG,GAAE,CAAC;AAAA,EACnH;AAEA,SAAOqC,EAAS,OAAO,OAAOD,GAAUmB,GAASa,CAAO,CAAC;AAC3D;"}
@@ -1,25 +1,25 @@
1
- import { tryOnMounted as x, tryOnScopeDispose as M, toArray as w, notNullish as C, watchImmediate as U, isClient as W, isObject as A } from "../../../../@vueuse_shared@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/shared/index.js";
2
- import { createFilterWrapper as J, debounceFilter as K, getLifeCycleTarget as Q, noop as X, useDebounceFn as Y, useIntervalFn as Z, whenever as _ } from "../../../../@vueuse_shared@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/shared/index.js";
3
- import { shallowRef as d, watch as g, toValue as b, readonly as j, computed as L, getCurrentInstance as k, onMounted as B, unref as I } from "vue";
4
- const E = W ? window : void 0;
1
+ import { tryOnMounted as S, tryOnScopeDispose as R, toArray as w, notNullish as x, watchImmediate as C, isClient as U, isObject as A } from "../../../../@vueuse_shared@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/shared/index.js";
2
+ import { bypassFilter as J, createFilterWrapper as K, debounceFilter as Q, getLifeCycleTarget as X, ignorableWatch as Y, noop as Z, useDebounceFn as _, useIntervalFn as ee, ignorableWatch as te, whenever as ne } from "../../../../@vueuse_shared@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/shared/index.js";
3
+ import { shallowRef as d, watch as M, toValue as b, readonly as I, computed as L, getCurrentInstance as j, onMounted as k, unref as B } from "vue";
4
+ const E = U ? window : void 0;
5
5
  function y(e) {
6
6
  var n;
7
7
  const s = b(e);
8
8
  return (n = s == null ? void 0 : s.$el) != null ? n : s;
9
9
  }
10
- function F(...e) {
10
+ function W(...e) {
11
11
  const n = [], s = () => {
12
12
  n.forEach((t) => t()), n.length = 0;
13
13
  }, a = (t, o, u, i) => (t.addEventListener(o, u, i), () => t.removeEventListener(o, u, i)), v = L(() => {
14
14
  const t = w(b(e[0])).filter((o) => o != null);
15
15
  return t.every((o) => typeof o != "string") ? t : void 0;
16
- }), r = U(
16
+ }), r = C(
17
17
  () => {
18
18
  var t, o;
19
19
  return [
20
20
  (o = (t = v.value) == null ? void 0 : t.map((u) => y(u))) != null ? o : [E].filter((u) => u != null),
21
21
  w(b(v.value ? e[1] : e[0])),
22
- w(I(v.value ? e[2] : e[1])),
22
+ w(B(v.value ? e[2] : e[1])),
23
23
  // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
24
24
  b(v.value ? e[3] : e[2])
25
25
  ];
@@ -40,27 +40,27 @@ function F(...e) {
40
40
  ), f = () => {
41
41
  r(), s();
42
42
  };
43
- return M(s), f;
43
+ return R(s), f;
44
44
  }
45
45
  function T() {
46
- const e = d(!1), n = k();
47
- return n && B(() => {
46
+ const e = d(!1), n = j();
47
+ return n && k(() => {
48
48
  e.value = !0;
49
49
  }, n), e;
50
50
  }
51
- function S(e) {
51
+ function z(e) {
52
52
  const n = T();
53
53
  return L(() => (n.value, !!e()));
54
54
  }
55
55
  function D(e, n, s = {}) {
56
56
  const { window: a = E, ...v } = s;
57
57
  let r;
58
- const f = S(() => a && "MutationObserver" in a), t = () => {
58
+ const f = z(() => a && "MutationObserver" in a), t = () => {
59
59
  r && (r.disconnect(), r = void 0);
60
60
  }, o = L(() => {
61
- const l = b(e), p = w(l).map(y).filter(C);
61
+ const l = b(e), p = w(l).map(y).filter(x);
62
62
  return new Set(p);
63
- }), u = g(
63
+ }), u = M(
64
64
  () => o.value,
65
65
  (l) => {
66
66
  t(), f.value && l.size && (r = new MutationObserver(n), l.forEach((p) => r.observe(p, v)));
@@ -69,7 +69,7 @@ function D(e, n, s = {}) {
69
69
  ), i = () => r == null ? void 0 : r.takeRecords(), c = () => {
70
70
  u(), t();
71
71
  };
72
- return M(c), {
72
+ return R(c), {
73
73
  isSupported: f,
74
74
  stop: c,
75
75
  takeRecords: i
@@ -78,12 +78,12 @@ function D(e, n, s = {}) {
78
78
  function q(e, n, s = {}) {
79
79
  const { window: a = E, ...v } = s;
80
80
  let r;
81
- const f = S(() => a && "ResizeObserver" in a), t = () => {
81
+ const f = z(() => a && "ResizeObserver" in a), t = () => {
82
82
  r && (r.disconnect(), r = void 0);
83
83
  }, o = L(() => {
84
84
  const c = b(e);
85
85
  return Array.isArray(c) ? c.map((l) => y(l)) : [y(c)];
86
- }), u = g(
86
+ }), u = M(
87
87
  o,
88
88
  (c) => {
89
89
  if (t(), f.value && a) {
@@ -96,7 +96,7 @@ function q(e, n, s = {}) {
96
96
  ), i = () => {
97
97
  t(), u();
98
98
  };
99
- return M(i), {
99
+ return R(i), {
100
100
  isSupported: f,
101
101
  stop: i
102
102
  };
@@ -109,21 +109,21 @@ function V(e, n = {}) {
109
109
  immediate: r = !0,
110
110
  updateTiming: f = "sync"
111
111
  } = n, t = d(0), o = d(0), u = d(0), i = d(0), c = d(0), l = d(0), p = d(0), O = d(0);
112
- function z() {
113
- const R = y(e);
114
- if (!R) {
112
+ function F() {
113
+ const g = y(e);
114
+ if (!g) {
115
115
  s && (t.value = 0, o.value = 0, u.value = 0, i.value = 0, c.value = 0, l.value = 0, p.value = 0, O.value = 0);
116
116
  return;
117
117
  }
118
- const m = R.getBoundingClientRect();
118
+ const m = g.getBoundingClientRect();
119
119
  t.value = m.height, o.value = m.bottom, u.value = m.left, i.value = m.right, c.value = m.top, l.value = m.width, p.value = m.x, O.value = m.y;
120
120
  }
121
121
  function h() {
122
- f === "sync" ? z() : f === "next-frame" && requestAnimationFrame(() => z());
122
+ f === "sync" ? F() : f === "next-frame" && requestAnimationFrame(() => F());
123
123
  }
124
- return q(e, h), g(() => y(e), (R) => !R && h()), D(e, h, {
124
+ return q(e, h), M(() => y(e), (g) => !g && h()), D(e, h, {
125
125
  attributeFilter: ["style", "class"]
126
- }), v && F("scroll", h, { capture: !0, passive: !0 }), a && F("resize", h, { passive: !0 }), x(() => {
126
+ }), v && W("scroll", h, { capture: !0, passive: !0 }), a && W("resize", h, { passive: !0 }), S(() => {
127
127
  r && h();
128
128
  }), {
129
129
  height: t,
@@ -141,37 +141,40 @@ function $(e) {
141
141
  const n = d(), s = () => {
142
142
  n.value && URL.revokeObjectURL(n.value), n.value = void 0;
143
143
  };
144
- return g(
144
+ return M(
145
145
  () => b(e),
146
146
  (a) => {
147
147
  s(), a && (n.value = URL.createObjectURL(a));
148
148
  },
149
149
  { immediate: !0 }
150
- ), M(s), j(n);
150
+ ), R(s), I(n);
151
151
  }
152
152
  export {
153
- J as createFilterWrapper,
154
- K as debounceFilter,
153
+ J as bypassFilter,
154
+ K as createFilterWrapper,
155
+ Q as debounceFilter,
155
156
  E as defaultWindow,
156
- Q as getLifeCycleTarget,
157
- W as isClient,
157
+ X as getLifeCycleTarget,
158
+ Y as ignorableWatch,
159
+ U as isClient,
158
160
  A as isObject,
159
- X as noop,
160
- C as notNullish,
161
+ Z as noop,
162
+ x as notNullish,
161
163
  w as toArray,
162
- x as tryOnMounted,
163
- M as tryOnScopeDispose,
164
+ S as tryOnMounted,
165
+ R as tryOnScopeDispose,
164
166
  y as unrefElement,
165
- Y as useDebounceFn,
167
+ _ as useDebounceFn,
166
168
  V as useElementBounding,
167
- F as useEventListener,
168
- Z as useIntervalFn,
169
+ W as useEventListener,
170
+ ee as useIntervalFn,
169
171
  T as useMounted,
170
172
  D as useMutationObserver,
171
173
  $ as useObjectUrl,
172
174
  q as useResizeObserver,
173
- S as useSupported,
174
- U as watchImmediate,
175
- _ as whenever
175
+ z as useSupported,
176
+ te as watchIgnorable,
177
+ C as watchImmediate,
178
+ ne as whenever
176
179
  };
177
180
  //# sourceMappingURL=index.js.map
@@ -1,82 +1,134 @@
1
- import { shallowRef as b, isRef as g, watch as p, shallowReadonly as T, onMounted as S, nextTick as j, getCurrentScope as A, onScopeDispose as C, toValue as m, getCurrentInstance as I } from "vue";
2
- function d(e) {
3
- return A() ? (C(e), !0) : !1;
1
+ import { shallowRef as d, isRef as C, watch as m, shallowReadonly as T, onMounted as A, nextTick as I, getCurrentScope as O, onScopeDispose as S, toValue as h, getCurrentInstance as j } from "vue";
2
+ function y(e) {
3
+ return O() ? (S(e), !0) : !1;
4
4
  }
5
- const h = typeof window < "u" && typeof document < "u";
5
+ const g = typeof window < "u" && typeof document < "u";
6
6
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
7
- const F = (e) => e != null, O = Object.prototype.toString, P = (e) => O.call(e) === "[object Object]", y = () => {
7
+ const R = (e) => e != null, F = Object.prototype.toString, k = (e) => F.call(e) === "[object Object]", b = () => {
8
8
  };
9
- function v(e, t) {
10
- function n(...o) {
11
- return new Promise((i, r) => {
12
- Promise.resolve(e(() => t.apply(this, o), { fn: t, thisArg: this, args: o })).then(i).catch(r);
9
+ function w(e, t) {
10
+ function n(...r) {
11
+ return new Promise((u, i) => {
12
+ Promise.resolve(e(() => t.apply(this, r), { fn: t, thisArg: this, args: r })).then(u).catch(i);
13
13
  });
14
14
  }
15
15
  return n;
16
16
  }
17
- function x(e, t = {}) {
18
- let n, o, i = y;
19
- const r = (l) => {
20
- clearTimeout(l), i(), i = y;
17
+ const P = (e) => e();
18
+ function W(e, t = {}) {
19
+ let n, r, u = b;
20
+ const i = (c) => {
21
+ clearTimeout(c), u(), u = b;
21
22
  };
22
- let c;
23
- return (l) => {
24
- const s = m(e), u = m(t.maxWait);
25
- return n && r(n), s <= 0 || u !== void 0 && u <= 0 ? (o && (r(o), o = null), Promise.resolve(l())) : new Promise((f, w) => {
26
- i = t.rejectOnCancel ? w : f, c = l, u && !o && (o = setTimeout(() => {
27
- n && r(n), o = null, f(c());
28
- }, u)), n = setTimeout(() => {
29
- o && r(o), o = null, f(l());
23
+ let l;
24
+ return (c) => {
25
+ const s = h(e), o = h(t.maxWait);
26
+ return n && i(n), s <= 0 || o !== void 0 && o <= 0 ? (r && (i(r), r = null), Promise.resolve(c())) : new Promise((a, p) => {
27
+ u = t.rejectOnCancel ? p : a, l = c, o && !r && (r = setTimeout(() => {
28
+ n && i(n), r = null, a(l());
29
+ }, o)), n = setTimeout(() => {
30
+ r && i(r), r = null, a(c());
30
31
  }, s);
31
32
  });
32
33
  };
33
34
  }
34
- function R(e) {
35
+ function G(e) {
35
36
  return Array.isArray(e) ? e : [e];
36
37
  }
37
- function W(e) {
38
- return I();
38
+ function x(e) {
39
+ return j();
39
40
  }
40
- function k(e, t = 200, n = {}) {
41
- return v(
42
- x(t, n),
41
+ function M(e, t = 200, n = {}) {
42
+ return w(
43
+ W(t, n),
43
44
  e
44
45
  );
45
46
  }
46
- function G(e, t = !0, n) {
47
- W() ? S(e, n) : t ? e() : j(e);
47
+ function U(e, t = !0, n) {
48
+ x() ? A(e, n) : t ? e() : I(e);
48
49
  }
49
- function M(e, t = 1e3, n = {}) {
50
+ function V(e, t = 1e3, n = {}) {
50
51
  const {
51
- immediate: o = !0,
52
- immediateCallback: i = !1
52
+ immediate: r = !0,
53
+ immediateCallback: u = !1
53
54
  } = n;
54
- let r = null;
55
- const c = b(!1);
56
- function a() {
57
- r && (clearInterval(r), r = null);
55
+ let i = null;
56
+ const l = d(!1);
57
+ function f() {
58
+ i && (clearInterval(i), i = null);
58
59
  }
59
- function l() {
60
- c.value = !1, a();
60
+ function c() {
61
+ l.value = !1, f();
61
62
  }
62
63
  function s() {
63
- const u = m(t);
64
- u <= 0 || (c.value = !0, i && e(), a(), c.value && (r = setInterval(e, u)));
64
+ const o = h(t);
65
+ o <= 0 || (l.value = !0, u && e(), f(), l.value && (i = setInterval(e, o)));
65
66
  }
66
- if (o && h && s(), g(t) || typeof t == "function") {
67
- const u = p(t, () => {
68
- c.value && h && s();
67
+ if (r && g && s(), C(t) || typeof t == "function") {
68
+ const o = m(t, () => {
69
+ l.value && g && s();
69
70
  });
70
- d(u);
71
+ y(o);
71
72
  }
72
- return d(l), {
73
- isActive: T(c),
74
- pause: l,
73
+ return y(c), {
74
+ isActive: T(l),
75
+ pause: c,
75
76
  resume: s
76
77
  };
77
78
  }
78
- function V(e, t, n) {
79
- return p(
79
+ function E(e, t, n = {}) {
80
+ const {
81
+ eventFilter: r = P,
82
+ ...u
83
+ } = n, i = w(
84
+ r,
85
+ t
86
+ );
87
+ let l, f, c;
88
+ if (u.flush === "sync") {
89
+ const s = d(!1);
90
+ f = () => {
91
+ }, l = (o) => {
92
+ s.value = !0, o(), s.value = !1;
93
+ }, c = m(
94
+ e,
95
+ (...o) => {
96
+ s.value || i(...o);
97
+ },
98
+ u
99
+ );
100
+ } else {
101
+ const s = [], o = d(0), a = d(0);
102
+ f = () => {
103
+ o.value = a.value;
104
+ }, s.push(
105
+ m(
106
+ e,
107
+ () => {
108
+ a.value++;
109
+ },
110
+ { ...u, flush: "sync" }
111
+ )
112
+ ), l = (p) => {
113
+ const v = a.value;
114
+ p(), o.value += a.value - v;
115
+ }, s.push(
116
+ m(
117
+ e,
118
+ (...p) => {
119
+ const v = o.value > 0 && o.value === a.value;
120
+ o.value = 0, a.value = 0, !v && i(...p);
121
+ },
122
+ u
123
+ )
124
+ ), c = () => {
125
+ s.forEach((p) => p());
126
+ };
127
+ }
128
+ return { stop: c, ignoreUpdates: l, ignorePrevAsyncUpdates: f };
129
+ }
130
+ function L(e, t, n) {
131
+ return m(
80
132
  e,
81
133
  t,
82
134
  {
@@ -85,11 +137,11 @@ function V(e, t, n) {
85
137
  }
86
138
  );
87
139
  }
88
- function L(e, t, n) {
89
- return p(
140
+ function N(e, t, n) {
141
+ return m(
90
142
  e,
91
- (i, r, c) => {
92
- i && t(i, r, c);
143
+ (u, i, l) => {
144
+ u && t(u, i, l);
93
145
  },
94
146
  {
95
147
  ...n,
@@ -98,19 +150,22 @@ function L(e, t, n) {
98
150
  );
99
151
  }
100
152
  export {
101
- v as createFilterWrapper,
102
- x as debounceFilter,
103
- W as getLifeCycleTarget,
104
- h as isClient,
105
- P as isObject,
106
- y as noop,
107
- F as notNullish,
108
- R as toArray,
109
- G as tryOnMounted,
110
- d as tryOnScopeDispose,
111
- k as useDebounceFn,
112
- M as useIntervalFn,
113
- V as watchImmediate,
114
- L as whenever
153
+ P as bypassFilter,
154
+ w as createFilterWrapper,
155
+ W as debounceFilter,
156
+ x as getLifeCycleTarget,
157
+ E as ignorableWatch,
158
+ g as isClient,
159
+ k as isObject,
160
+ b as noop,
161
+ R as notNullish,
162
+ G as toArray,
163
+ U as tryOnMounted,
164
+ y as tryOnScopeDispose,
165
+ M as useDebounceFn,
166
+ V as useIntervalFn,
167
+ E as watchIgnorable,
168
+ L as watchImmediate,
169
+ N as whenever
115
170
  };
116
171
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../../../../node_modules/.pnpm/@vueuse+shared@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/shared/index.mjs"],"sourcesContent":["import { shallowRef, watchEffect, readonly, watch, customRef, getCurrentScope, onScopeDispose, effectScope, getCurrentInstance, hasInjectionContext, inject, provide, ref, isRef, unref, toValue as toValue$1, computed, reactive, toRefs as toRefs$1, toRef as toRef$1, shallowReadonly, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue';\n\nfunction computedEager(fn, options) {\n var _a;\n const result = shallowRef();\n watchEffect(() => {\n result.value = fn();\n }, {\n ...options,\n flush: (_a = options == null ? void 0 : options.flush) != null ? _a : \"sync\"\n });\n return readonly(result);\n}\n\nfunction computedWithControl(source, fn) {\n let v = void 0;\n let track;\n let trigger;\n const dirty = shallowRef(true);\n const update = () => {\n dirty.value = true;\n trigger();\n };\n watch(source, update, { flush: \"sync\" });\n const get = typeof fn === \"function\" ? fn : fn.get;\n const set = typeof fn === \"function\" ? void 0 : fn.set;\n const result = customRef((_track, _trigger) => {\n track = _track;\n trigger = _trigger;\n return {\n get() {\n if (dirty.value) {\n v = get(v);\n dirty.value = false;\n }\n track();\n return v;\n },\n set(v2) {\n set == null ? void 0 : set(v2);\n }\n };\n });\n if (Object.isExtensible(result))\n result.trigger = update;\n return result;\n}\n\nfunction tryOnScopeDispose(fn) {\n if (getCurrentScope()) {\n onScopeDispose(fn);\n return true;\n }\n return false;\n}\n\nfunction createEventHook() {\n const fns = /* @__PURE__ */ new Set();\n const off = (fn) => {\n fns.delete(fn);\n };\n const clear = () => {\n fns.clear();\n };\n const on = (fn) => {\n fns.add(fn);\n const offFn = () => off(fn);\n tryOnScopeDispose(offFn);\n return {\n off: offFn\n };\n };\n const trigger = (...args) => {\n return Promise.all(Array.from(fns).map((fn) => fn(...args)));\n };\n return {\n on,\n off,\n trigger,\n clear\n };\n}\n\nfunction createGlobalState(stateFactory) {\n let initialized = false;\n let state;\n const scope = effectScope(true);\n return (...args) => {\n if (!initialized) {\n state = scope.run(() => stateFactory(...args));\n initialized = true;\n }\n return state;\n };\n}\n\nconst localProvidedStateMap = /* @__PURE__ */ new WeakMap();\n\nconst injectLocal = (...args) => {\n var _a;\n const key = args[0];\n const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;\n if (instance == null && !hasInjectionContext())\n throw new Error(\"injectLocal must be called in setup\");\n if (instance && localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))\n return localProvidedStateMap.get(instance)[key];\n return inject(...args);\n};\n\nfunction provideLocal(key, value) {\n var _a;\n const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;\n if (instance == null)\n throw new Error(\"provideLocal must be called in setup\");\n if (!localProvidedStateMap.has(instance))\n localProvidedStateMap.set(instance, /* @__PURE__ */ Object.create(null));\n const localProvidedState = localProvidedStateMap.get(instance);\n localProvidedState[key] = value;\n return provide(key, value);\n}\n\nfunction createInjectionState(composable, options) {\n const key = (options == null ? void 0 : options.injectionKey) || Symbol(composable.name || \"InjectionState\");\n const defaultValue = options == null ? void 0 : options.defaultValue;\n const useProvidingState = (...args) => {\n const state = composable(...args);\n provideLocal(key, state);\n return state;\n };\n const useInjectedState = () => injectLocal(key, defaultValue);\n return [useProvidingState, useInjectedState];\n}\n\nfunction createRef(value, deep) {\n if (deep === true) {\n return ref(value);\n } else {\n return shallowRef(value);\n }\n}\n\nfunction createSharedComposable(composable) {\n let subscribers = 0;\n let state;\n let scope;\n const dispose = () => {\n subscribers -= 1;\n if (scope && subscribers <= 0) {\n scope.stop();\n state = void 0;\n scope = void 0;\n }\n };\n return (...args) => {\n subscribers += 1;\n if (!scope) {\n scope = effectScope(true);\n state = scope.run(() => composable(...args));\n }\n tryOnScopeDispose(dispose);\n return state;\n };\n}\n\nfunction extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) {\n for (const [key, value] of Object.entries(extend)) {\n if (key === \"value\")\n continue;\n if (isRef(value) && unwrap) {\n Object.defineProperty(ref, key, {\n get() {\n return value.value;\n },\n set(v) {\n value.value = v;\n },\n enumerable\n });\n } else {\n Object.defineProperty(ref, key, { value, enumerable });\n }\n }\n return ref;\n}\n\nfunction get(obj, key) {\n if (key == null)\n return unref(obj);\n return unref(obj)[key];\n}\n\nfunction isDefined(v) {\n return unref(v) != null;\n}\n\nfunction makeDestructurable(obj, arr) {\n if (typeof Symbol !== \"undefined\") {\n const clone = { ...obj };\n Object.defineProperty(clone, Symbol.iterator, {\n enumerable: false,\n value() {\n let index = 0;\n return {\n next: () => ({\n value: arr[index++],\n done: index > arr.length\n })\n };\n }\n });\n return clone;\n } else {\n return Object.assign([...arr], obj);\n }\n}\n\nfunction reactify(fn, options) {\n const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? unref : toValue$1;\n return function(...args) {\n return computed(() => fn.apply(this, args.map((i) => unrefFn(i))));\n };\n}\n\nfunction reactifyObject(obj, optionsOrKeys = {}) {\n let keys = [];\n let options;\n if (Array.isArray(optionsOrKeys)) {\n keys = optionsOrKeys;\n } else {\n options = optionsOrKeys;\n const { includeOwnProperties = true } = optionsOrKeys;\n keys.push(...Object.keys(obj));\n if (includeOwnProperties)\n keys.push(...Object.getOwnPropertyNames(obj));\n }\n return Object.fromEntries(\n keys.map((key) => {\n const value = obj[key];\n return [\n key,\n typeof value === \"function\" ? reactify(value.bind(obj), options) : value\n ];\n })\n );\n}\n\nfunction toReactive(objectRef) {\n if (!isRef(objectRef))\n return reactive(objectRef);\n const proxy = new Proxy({}, {\n get(_, p, receiver) {\n return unref(Reflect.get(objectRef.value, p, receiver));\n },\n set(_, p, value) {\n if (isRef(objectRef.value[p]) && !isRef(value))\n objectRef.value[p].value = value;\n else\n objectRef.value[p] = value;\n return true;\n },\n deleteProperty(_, p) {\n return Reflect.deleteProperty(objectRef.value, p);\n },\n has(_, p) {\n return Reflect.has(objectRef.value, p);\n },\n ownKeys() {\n return Object.keys(objectRef.value);\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true\n };\n }\n });\n return reactive(proxy);\n}\n\nfunction reactiveComputed(fn) {\n return toReactive(computed(fn));\n}\n\nfunction reactiveOmit(obj, ...keys) {\n const flatKeys = keys.flat();\n const predicate = flatKeys[0];\n return reactiveComputed(() => typeof predicate === \"function\" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => !predicate(toValue$1(v), k))) : Object.fromEntries(Object.entries(toRefs$1(obj)).filter((e) => !flatKeys.includes(e[0]))));\n}\n\nconst isClient = typeof window !== \"undefined\" && typeof document !== \"undefined\";\nconst isWorker = typeof WorkerGlobalScope !== \"undefined\" && globalThis instanceof WorkerGlobalScope;\nconst isDef = (val) => typeof val !== \"undefined\";\nconst notNullish = (val) => val != null;\nconst assert = (condition, ...infos) => {\n if (!condition)\n console.warn(...infos);\n};\nconst toString = Object.prototype.toString;\nconst isObject = (val) => toString.call(val) === \"[object Object]\";\nconst now = () => Date.now();\nconst timestamp = () => +Date.now();\nconst clamp = (n, min, max) => Math.min(max, Math.max(min, n));\nconst noop = () => {\n};\nconst rand = (min, max) => {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1)) + min;\n};\nconst hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);\nconst isIOS = /* @__PURE__ */ getIsIOS();\nfunction getIsIOS() {\n var _a, _b;\n return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));\n}\n\nfunction toRef(...args) {\n if (args.length !== 1)\n return toRef$1(...args);\n const r = args[0];\n return typeof r === \"function\" ? readonly(customRef(() => ({ get: r, set: noop }))) : ref(r);\n}\nconst resolveRef = toRef;\n\nfunction reactivePick(obj, ...keys) {\n const flatKeys = keys.flat();\n const predicate = flatKeys[0];\n return reactiveComputed(() => typeof predicate === \"function\" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => predicate(toValue$1(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));\n}\n\nfunction refAutoReset(defaultValue, afterMs = 1e4) {\n return customRef((track, trigger) => {\n let value = toValue$1(defaultValue);\n let timer;\n const resetAfter = () => setTimeout(() => {\n value = toValue$1(defaultValue);\n trigger();\n }, toValue$1(afterMs));\n tryOnScopeDispose(() => {\n clearTimeout(timer);\n });\n return {\n get() {\n track();\n return value;\n },\n set(newValue) {\n value = newValue;\n trigger();\n clearTimeout(timer);\n timer = resetAfter();\n }\n };\n });\n}\n\nfunction createFilterWrapper(filter, fn) {\n function wrapper(...args) {\n return new Promise((resolve, reject) => {\n Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve).catch(reject);\n });\n }\n return wrapper;\n}\nconst bypassFilter = (invoke) => {\n return invoke();\n};\nfunction debounceFilter(ms, options = {}) {\n let timer;\n let maxTimer;\n let lastRejector = noop;\n const _clearTimeout = (timer2) => {\n clearTimeout(timer2);\n lastRejector();\n lastRejector = noop;\n };\n let lastInvoker;\n const filter = (invoke) => {\n const duration = toValue$1(ms);\n const maxDuration = toValue$1(options.maxWait);\n if (timer)\n _clearTimeout(timer);\n if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {\n if (maxTimer) {\n _clearTimeout(maxTimer);\n maxTimer = null;\n }\n return Promise.resolve(invoke());\n }\n return new Promise((resolve, reject) => {\n lastRejector = options.rejectOnCancel ? reject : resolve;\n lastInvoker = invoke;\n if (maxDuration && !maxTimer) {\n maxTimer = setTimeout(() => {\n if (timer)\n _clearTimeout(timer);\n maxTimer = null;\n resolve(lastInvoker());\n }, maxDuration);\n }\n timer = setTimeout(() => {\n if (maxTimer)\n _clearTimeout(maxTimer);\n maxTimer = null;\n resolve(invoke());\n }, duration);\n });\n };\n return filter;\n}\nfunction throttleFilter(...args) {\n let lastExec = 0;\n let timer;\n let isLeading = true;\n let lastRejector = noop;\n let lastValue;\n let ms;\n let trailing;\n let leading;\n let rejectOnCancel;\n if (!isRef(args[0]) && typeof args[0] === \"object\")\n ({ delay: ms, trailing = true, leading = true, rejectOnCancel = false } = args[0]);\n else\n [ms, trailing = true, leading = true, rejectOnCancel = false] = args;\n const clear = () => {\n if (timer) {\n clearTimeout(timer);\n timer = void 0;\n lastRejector();\n lastRejector = noop;\n }\n };\n const filter = (_invoke) => {\n const duration = toValue$1(ms);\n const elapsed = Date.now() - lastExec;\n const invoke = () => {\n return lastValue = _invoke();\n };\n clear();\n if (duration <= 0) {\n lastExec = Date.now();\n return invoke();\n }\n if (elapsed > duration && (leading || !isLeading)) {\n lastExec = Date.now();\n invoke();\n } else if (trailing) {\n lastValue = new Promise((resolve, reject) => {\n lastRejector = rejectOnCancel ? reject : resolve;\n timer = setTimeout(() => {\n lastExec = Date.now();\n isLeading = true;\n resolve(invoke());\n clear();\n }, Math.max(0, duration - elapsed));\n });\n }\n if (!leading && !timer)\n timer = setTimeout(() => isLeading = true, duration);\n isLeading = false;\n return lastValue;\n };\n return filter;\n}\nfunction pausableFilter(extendFilter = bypassFilter, options = {}) {\n const {\n initialState = \"active\"\n } = options;\n const isActive = toRef(initialState === \"active\");\n function pause() {\n isActive.value = false;\n }\n function resume() {\n isActive.value = true;\n }\n const eventFilter = (...args) => {\n if (isActive.value)\n extendFilter(...args);\n };\n return { isActive: readonly(isActive), pause, resume, eventFilter };\n}\n\nfunction promiseTimeout(ms, throwOnTimeout = false, reason = \"Timeout\") {\n return new Promise((resolve, reject) => {\n if (throwOnTimeout)\n setTimeout(() => reject(reason), ms);\n else\n setTimeout(resolve, ms);\n });\n}\nfunction identity(arg) {\n return arg;\n}\nfunction createSingletonPromise(fn) {\n let _promise;\n function wrapper() {\n if (!_promise)\n _promise = fn();\n return _promise;\n }\n wrapper.reset = async () => {\n const _prev = _promise;\n _promise = void 0;\n if (_prev)\n await _prev;\n };\n return wrapper;\n}\nfunction invoke(fn) {\n return fn();\n}\nfunction containsProp(obj, ...props) {\n return props.some((k) => k in obj);\n}\nfunction increaseWithUnit(target, delta) {\n var _a;\n if (typeof target === \"number\")\n return target + delta;\n const value = ((_a = target.match(/^-?\\d+\\.?\\d*/)) == null ? void 0 : _a[0]) || \"\";\n const unit = target.slice(value.length);\n const result = Number.parseFloat(value) + delta;\n if (Number.isNaN(result))\n return target;\n return result + unit;\n}\nfunction pxValue(px) {\n return px.endsWith(\"rem\") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);\n}\nfunction objectPick(obj, keys, omitUndefined = false) {\n return keys.reduce((n, k) => {\n if (k in obj) {\n if (!omitUndefined || obj[k] !== void 0)\n n[k] = obj[k];\n }\n return n;\n }, {});\n}\nfunction objectOmit(obj, keys, omitUndefined = false) {\n return Object.fromEntries(Object.entries(obj).filter(([key, value]) => {\n return (!omitUndefined || value !== void 0) && !keys.includes(key);\n }));\n}\nfunction objectEntries(obj) {\n return Object.entries(obj);\n}\nfunction toArray(value) {\n return Array.isArray(value) ? value : [value];\n}\n\nfunction cacheStringFunction(fn) {\n const cache = /* @__PURE__ */ Object.create(null);\n return (str) => {\n const hit = cache[str];\n return hit || (cache[str] = fn(str));\n };\n}\nconst hyphenateRE = /\\B([A-Z])/g;\nconst hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, \"-$1\").toLowerCase());\nconst camelizeRE = /-(\\w)/g;\nconst camelize = cacheStringFunction((str) => {\n return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : \"\");\n});\n\nfunction getLifeCycleTarget(target) {\n return target || getCurrentInstance();\n}\n\nfunction useDebounceFn(fn, ms = 200, options = {}) {\n return createFilterWrapper(\n debounceFilter(ms, options),\n fn\n );\n}\n\nfunction refDebounced(value, ms = 200, options = {}) {\n const debounced = ref(toValue$1(value));\n const updater = useDebounceFn(() => {\n debounced.value = value.value;\n }, ms, options);\n watch(value, () => updater());\n return shallowReadonly(debounced);\n}\n\nfunction refDefault(source, defaultValue) {\n return computed({\n get() {\n var _a;\n return (_a = source.value) != null ? _a : defaultValue;\n },\n set(value) {\n source.value = value;\n }\n });\n}\n\nfunction useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnCancel = false) {\n return createFilterWrapper(\n throttleFilter(ms, trailing, leading, rejectOnCancel),\n fn\n );\n}\n\nfunction refThrottled(value, delay = 200, trailing = true, leading = true) {\n if (delay <= 0)\n return value;\n const throttled = ref(toValue$1(value));\n const updater = useThrottleFn(() => {\n throttled.value = value.value;\n }, delay, trailing, leading);\n watch(value, () => updater());\n return throttled;\n}\n\nfunction refWithControl(initial, options = {}) {\n let source = initial;\n let track;\n let trigger;\n const ref = customRef((_track, _trigger) => {\n track = _track;\n trigger = _trigger;\n return {\n get() {\n return get();\n },\n set(v) {\n set(v);\n }\n };\n });\n function get(tracking = true) {\n if (tracking)\n track();\n return source;\n }\n function set(value, triggering = true) {\n var _a, _b;\n if (value === source)\n return;\n const old = source;\n if (((_a = options.onBeforeChange) == null ? void 0 : _a.call(options, value, old)) === false)\n return;\n source = value;\n (_b = options.onChanged) == null ? void 0 : _b.call(options, value, old);\n if (triggering)\n trigger();\n }\n const untrackedGet = () => get(false);\n const silentSet = (v) => set(v, false);\n const peek = () => get(false);\n const lay = (v) => set(v, false);\n return extendRef(\n ref,\n {\n get,\n set,\n untrackedGet,\n silentSet,\n peek,\n lay\n },\n { enumerable: true }\n );\n}\nconst controlledRef = refWithControl;\n\nfunction set(...args) {\n if (args.length === 2) {\n const [ref, value] = args;\n ref.value = value;\n }\n if (args.length === 3) {\n const [target, key, value] = args;\n target[key] = value;\n }\n}\n\nfunction watchWithFilter(source, cb, options = {}) {\n const {\n eventFilter = bypassFilter,\n ...watchOptions\n } = options;\n return watch(\n source,\n createFilterWrapper(\n eventFilter,\n cb\n ),\n watchOptions\n );\n}\n\nfunction watchPausable(source, cb, options = {}) {\n const {\n eventFilter: filter,\n initialState = \"active\",\n ...watchOptions\n } = options;\n const { eventFilter, pause, resume, isActive } = pausableFilter(filter, { initialState });\n const stop = watchWithFilter(\n source,\n cb,\n {\n ...watchOptions,\n eventFilter\n }\n );\n return { stop, pause, resume, isActive };\n}\n\nfunction syncRef(left, right, ...[options]) {\n const {\n flush = \"sync\",\n deep = false,\n immediate = true,\n direction = \"both\",\n transform = {}\n } = options || {};\n const watchers = [];\n const transformLTR = \"ltr\" in transform && transform.ltr || ((v) => v);\n const transformRTL = \"rtl\" in transform && transform.rtl || ((v) => v);\n if (direction === \"both\" || direction === \"ltr\") {\n watchers.push(watchPausable(\n left,\n (newValue) => {\n watchers.forEach((w) => w.pause());\n right.value = transformLTR(newValue);\n watchers.forEach((w) => w.resume());\n },\n { flush, deep, immediate }\n ));\n }\n if (direction === \"both\" || direction === \"rtl\") {\n watchers.push(watchPausable(\n right,\n (newValue) => {\n watchers.forEach((w) => w.pause());\n left.value = transformRTL(newValue);\n watchers.forEach((w) => w.resume());\n },\n { flush, deep, immediate }\n ));\n }\n const stop = () => {\n watchers.forEach((w) => w.stop());\n };\n return stop;\n}\n\nfunction syncRefs(source, targets, options = {}) {\n const {\n flush = \"sync\",\n deep = false,\n immediate = true\n } = options;\n const targetsArray = toArray(targets);\n return watch(\n source,\n (newValue) => targetsArray.forEach((target) => target.value = newValue),\n { flush, deep, immediate }\n );\n}\n\nfunction toRefs(objectRef, options = {}) {\n if (!isRef(objectRef))\n return toRefs$1(objectRef);\n const result = Array.isArray(objectRef.value) ? Array.from({ length: objectRef.value.length }) : {};\n for (const key in objectRef.value) {\n result[key] = customRef(() => ({\n get() {\n return objectRef.value[key];\n },\n set(v) {\n var _a;\n const replaceRef = (_a = toValue$1(options.replaceRef)) != null ? _a : true;\n if (replaceRef) {\n if (Array.isArray(objectRef.value)) {\n const copy = [...objectRef.value];\n copy[key] = v;\n objectRef.value = copy;\n } else {\n const newObject = { ...objectRef.value, [key]: v };\n Object.setPrototypeOf(newObject, Object.getPrototypeOf(objectRef.value));\n objectRef.value = newObject;\n }\n } else {\n objectRef.value[key] = v;\n }\n }\n }));\n }\n return result;\n}\n\nconst toValue = toValue$1;\nconst resolveUnref = toValue$1;\n\nfunction tryOnBeforeMount(fn, sync = true, target) {\n const instance = getLifeCycleTarget(target);\n if (instance)\n onBeforeMount(fn, target);\n else if (sync)\n fn();\n else\n nextTick(fn);\n}\n\nfunction tryOnBeforeUnmount(fn, target) {\n const instance = getLifeCycleTarget(target);\n if (instance)\n onBeforeUnmount(fn, target);\n}\n\nfunction tryOnMounted(fn, sync = true, target) {\n const instance = getLifeCycleTarget(target);\n if (instance)\n onMounted(fn, target);\n else if (sync)\n fn();\n else\n nextTick(fn);\n}\n\nfunction tryOnUnmounted(fn, target) {\n const instance = getLifeCycleTarget(target);\n if (instance)\n onUnmounted(fn, target);\n}\n\nfunction createUntil(r, isNot = false) {\n function toMatch(condition, { flush = \"sync\", deep = false, timeout, throwOnTimeout } = {}) {\n let stop = null;\n const watcher = new Promise((resolve) => {\n stop = watch(\n r,\n (v) => {\n if (condition(v) !== isNot) {\n if (stop)\n stop();\n else\n nextTick(() => stop == null ? void 0 : stop());\n resolve(v);\n }\n },\n {\n flush,\n deep,\n immediate: true\n }\n );\n });\n const promises = [watcher];\n if (timeout != null) {\n promises.push(\n promiseTimeout(timeout, throwOnTimeout).then(() => toValue$1(r)).finally(() => stop == null ? void 0 : stop())\n );\n }\n return Promise.race(promises);\n }\n function toBe(value, options) {\n if (!isRef(value))\n return toMatch((v) => v === value, options);\n const { flush = \"sync\", deep = false, timeout, throwOnTimeout } = options != null ? options : {};\n let stop = null;\n const watcher = new Promise((resolve) => {\n stop = watch(\n [r, value],\n ([v1, v2]) => {\n if (isNot !== (v1 === v2)) {\n if (stop)\n stop();\n else\n nextTick(() => stop == null ? void 0 : stop());\n resolve(v1);\n }\n },\n {\n flush,\n deep,\n immediate: true\n }\n );\n });\n const promises = [watcher];\n if (timeout != null) {\n promises.push(\n promiseTimeout(timeout, throwOnTimeout).then(() => toValue$1(r)).finally(() => {\n stop == null ? void 0 : stop();\n return toValue$1(r);\n })\n );\n }\n return Promise.race(promises);\n }\n function toBeTruthy(options) {\n return toMatch((v) => Boolean(v), options);\n }\n function toBeNull(options) {\n return toBe(null, options);\n }\n function toBeUndefined(options) {\n return toBe(void 0, options);\n }\n function toBeNaN(options) {\n return toMatch(Number.isNaN, options);\n }\n function toContains(value, options) {\n return toMatch((v) => {\n const array = Array.from(v);\n return array.includes(value) || array.includes(toValue$1(value));\n }, options);\n }\n function changed(options) {\n return changedTimes(1, options);\n }\n function changedTimes(n = 1, options) {\n let count = -1;\n return toMatch(() => {\n count += 1;\n return count >= n;\n }, options);\n }\n if (Array.isArray(toValue$1(r))) {\n const instance = {\n toMatch,\n toContains,\n changed,\n changedTimes,\n get not() {\n return createUntil(r, !isNot);\n }\n };\n return instance;\n } else {\n const instance = {\n toMatch,\n toBe,\n toBeTruthy,\n toBeNull,\n toBeNaN,\n toBeUndefined,\n changed,\n changedTimes,\n get not() {\n return createUntil(r, !isNot);\n }\n };\n return instance;\n }\n}\nfunction until(r) {\n return createUntil(r);\n}\n\nfunction defaultComparator(value, othVal) {\n return value === othVal;\n}\nfunction useArrayDifference(...args) {\n var _a, _b;\n const list = args[0];\n const values = args[1];\n let compareFn = (_a = args[2]) != null ? _a : defaultComparator;\n const {\n symmetric = false\n } = (_b = args[3]) != null ? _b : {};\n if (typeof compareFn === \"string\") {\n const key = compareFn;\n compareFn = (value, othVal) => value[key] === othVal[key];\n }\n const diff1 = computed(() => toValue$1(list).filter((x) => toValue$1(values).findIndex((y) => compareFn(x, y)) === -1));\n if (symmetric) {\n const diff2 = computed(() => toValue$1(values).filter((x) => toValue$1(list).findIndex((y) => compareFn(x, y)) === -1));\n return computed(() => symmetric ? [...toValue$1(diff1), ...toValue$1(diff2)] : toValue$1(diff1));\n } else {\n return diff1;\n }\n}\n\nfunction useArrayEvery(list, fn) {\n return computed(() => toValue$1(list).every((element, index, array) => fn(toValue$1(element), index, array)));\n}\n\nfunction useArrayFilter(list, fn) {\n return computed(() => toValue$1(list).map((i) => toValue$1(i)).filter(fn));\n}\n\nfunction useArrayFind(list, fn) {\n return computed(() => toValue$1(\n toValue$1(list).find((element, index, array) => fn(toValue$1(element), index, array))\n ));\n}\n\nfunction useArrayFindIndex(list, fn) {\n return computed(() => toValue$1(list).findIndex((element, index, array) => fn(toValue$1(element), index, array)));\n}\n\nfunction findLast(arr, cb) {\n let index = arr.length;\n while (index-- > 0) {\n if (cb(arr[index], index, arr))\n return arr[index];\n }\n return void 0;\n}\nfunction useArrayFindLast(list, fn) {\n return computed(() => toValue$1(\n !Array.prototype.findLast ? findLast(toValue$1(list), (element, index, array) => fn(toValue$1(element), index, array)) : toValue$1(list).findLast((element, index, array) => fn(toValue$1(element), index, array))\n ));\n}\n\nfunction isArrayIncludesOptions(obj) {\n return isObject(obj) && containsProp(obj, \"formIndex\", \"comparator\");\n}\nfunction useArrayIncludes(...args) {\n var _a;\n const list = args[0];\n const value = args[1];\n let comparator = args[2];\n let formIndex = 0;\n if (isArrayIncludesOptions(comparator)) {\n formIndex = (_a = comparator.fromIndex) != null ? _a : 0;\n comparator = comparator.comparator;\n }\n if (typeof comparator === \"string\") {\n const key = comparator;\n comparator = (element, value2) => element[key] === toValue$1(value2);\n }\n comparator = comparator != null ? comparator : (element, value2) => element === toValue$1(value2);\n return computed(() => toValue$1(list).slice(formIndex).some((element, index, array) => comparator(\n toValue$1(element),\n toValue$1(value),\n index,\n toValue$1(array)\n )));\n}\n\nfunction useArrayJoin(list, separator) {\n return computed(() => toValue$1(list).map((i) => toValue$1(i)).join(toValue$1(separator)));\n}\n\nfunction useArrayMap(list, fn) {\n return computed(() => toValue$1(list).map((i) => toValue$1(i)).map(fn));\n}\n\nfunction useArrayReduce(list, reducer, ...args) {\n const reduceCallback = (sum, value, index) => reducer(toValue$1(sum), toValue$1(value), index);\n return computed(() => {\n const resolved = toValue$1(list);\n return args.length ? resolved.reduce(reduceCallback, typeof args[0] === \"function\" ? toValue$1(args[0]()) : toValue$1(args[0])) : resolved.reduce(reduceCallback);\n });\n}\n\nfunction useArraySome(list, fn) {\n return computed(() => toValue$1(list).some((element, index, array) => fn(toValue$1(element), index, array)));\n}\n\nfunction uniq(array) {\n return Array.from(new Set(array));\n}\nfunction uniqueElementsBy(array, fn) {\n return array.reduce((acc, v) => {\n if (!acc.some((x) => fn(v, x, array)))\n acc.push(v);\n return acc;\n }, []);\n}\nfunction useArrayUnique(list, compareFn) {\n return computed(() => {\n const resolvedList = toValue$1(list).map((element) => toValue$1(element));\n return compareFn ? uniqueElementsBy(resolvedList, compareFn) : uniq(resolvedList);\n });\n}\n\nfunction useCounter(initialValue = 0, options = {}) {\n let _initialValue = unref(initialValue);\n const count = shallowRef(initialValue);\n const {\n max = Number.POSITIVE_INFINITY,\n min = Number.NEGATIVE_INFINITY\n } = options;\n const inc = (delta = 1) => count.value = Math.max(Math.min(max, count.value + delta), min);\n const dec = (delta = 1) => count.value = Math.min(Math.max(min, count.value - delta), max);\n const get = () => count.value;\n const set = (val) => count.value = Math.max(min, Math.min(max, val));\n const reset = (val = _initialValue) => {\n _initialValue = val;\n return set(val);\n };\n return { count: shallowReadonly(count), inc, dec, get, set, reset };\n}\n\nconst REGEX_PARSE = /^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[T\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/i;\nconst REGEX_FORMAT = /[YMDHhms]o|\\[([^\\]]+)\\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|z{1,4}|SSS/g;\nfunction defaultMeridiem(hours, minutes, isLowercase, hasPeriod) {\n let m = hours < 12 ? \"AM\" : \"PM\";\n if (hasPeriod)\n m = m.split(\"\").reduce((acc, curr) => acc += `${curr}.`, \"\");\n return isLowercase ? m.toLowerCase() : m;\n}\nfunction formatOrdinal(num) {\n const suffixes = [\"th\", \"st\", \"nd\", \"rd\"];\n const v = num % 100;\n return num + (suffixes[(v - 20) % 10] || suffixes[v] || suffixes[0]);\n}\nfunction formatDate(date, formatStr, options = {}) {\n var _a;\n const years = date.getFullYear();\n const month = date.getMonth();\n const days = date.getDate();\n const hours = date.getHours();\n const minutes = date.getMinutes();\n const seconds = date.getSeconds();\n const milliseconds = date.getMilliseconds();\n const day = date.getDay();\n const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;\n const stripTimeZone = (dateString) => {\n var _a2;\n return (_a2 = dateString.split(\" \")[1]) != null ? _a2 : \"\";\n };\n const matches = {\n Yo: () => formatOrdinal(years),\n YY: () => String(years).slice(-2),\n YYYY: () => years,\n M: () => month + 1,\n Mo: () => formatOrdinal(month + 1),\n MM: () => `${month + 1}`.padStart(2, \"0\"),\n MMM: () => date.toLocaleDateString(toValue$1(options.locales), { month: \"short\" }),\n MMMM: () => date.toLocaleDateString(toValue$1(options.locales), { month: \"long\" }),\n D: () => String(days),\n Do: () => formatOrdinal(days),\n DD: () => `${days}`.padStart(2, \"0\"),\n H: () => String(hours),\n Ho: () => formatOrdinal(hours),\n HH: () => `${hours}`.padStart(2, \"0\"),\n h: () => `${hours % 12 || 12}`.padStart(1, \"0\"),\n ho: () => formatOrdinal(hours % 12 || 12),\n hh: () => `${hours % 12 || 12}`.padStart(2, \"0\"),\n m: () => String(minutes),\n mo: () => formatOrdinal(minutes),\n mm: () => `${minutes}`.padStart(2, \"0\"),\n s: () => String(seconds),\n so: () => formatOrdinal(seconds),\n ss: () => `${seconds}`.padStart(2, \"0\"),\n SSS: () => `${milliseconds}`.padStart(3, \"0\"),\n d: () => day,\n dd: () => date.toLocaleDateString(toValue$1(options.locales), { weekday: \"narrow\" }),\n ddd: () => date.toLocaleDateString(toValue$1(options.locales), { weekday: \"short\" }),\n dddd: () => date.toLocaleDateString(toValue$1(options.locales), { weekday: \"long\" }),\n A: () => meridiem(hours, minutes),\n AA: () => meridiem(hours, minutes, false, true),\n a: () => meridiem(hours, minutes, true),\n aa: () => meridiem(hours, minutes, true, true),\n z: () => stripTimeZone(date.toLocaleDateString(toValue$1(options.locales), { timeZoneName: \"shortOffset\" })),\n zz: () => stripTimeZone(date.toLocaleDateString(toValue$1(options.locales), { timeZoneName: \"shortOffset\" })),\n zzz: () => stripTimeZone(date.toLocaleDateString(toValue$1(options.locales), { timeZoneName: \"shortOffset\" })),\n zzzz: () => stripTimeZone(date.toLocaleDateString(toValue$1(options.locales), { timeZoneName: \"longOffset\" }))\n };\n return formatStr.replace(REGEX_FORMAT, (match, $1) => {\n var _a2, _b;\n return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ? void 0 : _a2.call(matches)) != null ? _b : match;\n });\n}\nfunction normalizeDate(date) {\n if (date === null)\n return new Date(Number.NaN);\n if (date === void 0)\n return /* @__PURE__ */ new Date();\n if (date instanceof Date)\n return new Date(date);\n if (typeof date === \"string\" && !/Z$/i.test(date)) {\n const d = date.match(REGEX_PARSE);\n if (d) {\n const m = d[2] - 1 || 0;\n const ms = (d[7] || \"0\").substring(0, 3);\n return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms);\n }\n }\n return new Date(date);\n}\nfunction useDateFormat(date, formatStr = \"HH:mm:ss\", options = {}) {\n return computed(() => formatDate(normalizeDate(toValue$1(date)), toValue$1(formatStr), options));\n}\n\nfunction useIntervalFn(cb, interval = 1e3, options = {}) {\n const {\n immediate = true,\n immediateCallback = false\n } = options;\n let timer = null;\n const isActive = shallowRef(false);\n function clean() {\n if (timer) {\n clearInterval(timer);\n timer = null;\n }\n }\n function pause() {\n isActive.value = false;\n clean();\n }\n function resume() {\n const intervalValue = toValue$1(interval);\n if (intervalValue <= 0)\n return;\n isActive.value = true;\n if (immediateCallback)\n cb();\n clean();\n if (isActive.value)\n timer = setInterval(cb, intervalValue);\n }\n if (immediate && isClient)\n resume();\n if (isRef(interval) || typeof interval === \"function\") {\n const stopWatch = watch(interval, () => {\n if (isActive.value && isClient)\n resume();\n });\n tryOnScopeDispose(stopWatch);\n }\n tryOnScopeDispose(pause);\n return {\n isActive: shallowReadonly(isActive),\n pause,\n resume\n };\n}\n\nfunction useInterval(interval = 1e3, options = {}) {\n const {\n controls: exposeControls = false,\n immediate = true,\n callback\n } = options;\n const counter = shallowRef(0);\n const update = () => counter.value += 1;\n const reset = () => {\n counter.value = 0;\n };\n const controls = useIntervalFn(\n callback ? () => {\n update();\n callback(counter.value);\n } : update,\n interval,\n { immediate }\n );\n if (exposeControls) {\n return {\n counter: shallowReadonly(counter),\n reset,\n ...controls\n };\n } else {\n return shallowReadonly(counter);\n }\n}\n\nfunction useLastChanged(source, options = {}) {\n var _a;\n const ms = shallowRef((_a = options.initialValue) != null ? _a : null);\n watch(\n source,\n () => ms.value = timestamp(),\n options\n );\n return shallowReadonly(ms);\n}\n\nfunction useTimeoutFn(cb, interval, options = {}) {\n const {\n immediate = true,\n immediateCallback = false\n } = options;\n const isPending = shallowRef(false);\n let timer = null;\n function clear() {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n }\n function stop() {\n isPending.value = false;\n clear();\n }\n function start(...args) {\n if (immediateCallback)\n cb();\n clear();\n isPending.value = true;\n timer = setTimeout(() => {\n isPending.value = false;\n timer = null;\n cb(...args);\n }, toValue$1(interval));\n }\n if (immediate) {\n isPending.value = true;\n if (isClient)\n start();\n }\n tryOnScopeDispose(stop);\n return {\n isPending: shallowReadonly(isPending),\n start,\n stop\n };\n}\n\nfunction useTimeout(interval = 1e3, options = {}) {\n const {\n controls: exposeControls = false,\n callback\n } = options;\n const controls = useTimeoutFn(\n callback != null ? callback : noop,\n interval,\n options\n );\n const ready = computed(() => !controls.isPending.value);\n if (exposeControls) {\n return {\n ready,\n ...controls\n };\n } else {\n return ready;\n }\n}\n\nfunction useToNumber(value, options = {}) {\n const {\n method = \"parseFloat\",\n radix,\n nanToZero\n } = options;\n return computed(() => {\n let resolved = toValue$1(value);\n if (typeof method === \"function\")\n resolved = method(resolved);\n else if (typeof resolved === \"string\")\n resolved = Number[method](resolved, radix);\n if (nanToZero && Number.isNaN(resolved))\n resolved = 0;\n return resolved;\n });\n}\n\nfunction useToString(value) {\n return computed(() => `${toValue$1(value)}`);\n}\n\nfunction useToggle(initialValue = false, options = {}) {\n const {\n truthyValue = true,\n falsyValue = false\n } = options;\n const valueIsRef = isRef(initialValue);\n const _value = shallowRef(initialValue);\n function toggle(value) {\n if (arguments.length) {\n _value.value = value;\n return _value.value;\n } else {\n const truthy = toValue$1(truthyValue);\n _value.value = _value.value === truthy ? toValue$1(falsyValue) : truthy;\n return _value.value;\n }\n }\n if (valueIsRef)\n return toggle;\n else\n return [_value, toggle];\n}\n\nfunction watchArray(source, cb, options) {\n let oldList = (options == null ? void 0 : options.immediate) ? [] : [...typeof source === \"function\" ? source() : Array.isArray(source) ? source : toValue$1(source)];\n return watch(source, (newList, _, onCleanup) => {\n const oldListRemains = Array.from({ length: oldList.length });\n const added = [];\n for (const obj of newList) {\n let found = false;\n for (let i = 0; i < oldList.length; i++) {\n if (!oldListRemains[i] && obj === oldList[i]) {\n oldListRemains[i] = true;\n found = true;\n break;\n }\n }\n if (!found)\n added.push(obj);\n }\n const removed = oldList.filter((_2, i) => !oldListRemains[i]);\n cb(newList, oldList, added, removed, onCleanup);\n oldList = [...newList];\n }, options);\n}\n\nfunction watchAtMost(source, cb, options) {\n const {\n count,\n ...watchOptions\n } = options;\n const current = shallowRef(0);\n const stop = watchWithFilter(\n source,\n (...args) => {\n current.value += 1;\n if (current.value >= toValue$1(count))\n nextTick(() => stop());\n cb(...args);\n },\n watchOptions\n );\n return { count: current, stop };\n}\n\nfunction watchDebounced(source, cb, options = {}) {\n const {\n debounce = 0,\n maxWait = void 0,\n ...watchOptions\n } = options;\n return watchWithFilter(\n source,\n cb,\n {\n ...watchOptions,\n eventFilter: debounceFilter(debounce, { maxWait })\n }\n );\n}\n\nfunction watchDeep(source, cb, options) {\n return watch(\n source,\n cb,\n {\n ...options,\n deep: true\n }\n );\n}\n\nfunction watchIgnorable(source, cb, options = {}) {\n const {\n eventFilter = bypassFilter,\n ...watchOptions\n } = options;\n const filteredCb = createFilterWrapper(\n eventFilter,\n cb\n );\n let ignoreUpdates;\n let ignorePrevAsyncUpdates;\n let stop;\n if (watchOptions.flush === \"sync\") {\n const ignore = shallowRef(false);\n ignorePrevAsyncUpdates = () => {\n };\n ignoreUpdates = (updater) => {\n ignore.value = true;\n updater();\n ignore.value = false;\n };\n stop = watch(\n source,\n (...args) => {\n if (!ignore.value)\n filteredCb(...args);\n },\n watchOptions\n );\n } else {\n const disposables = [];\n const ignoreCounter = shallowRef(0);\n const syncCounter = shallowRef(0);\n ignorePrevAsyncUpdates = () => {\n ignoreCounter.value = syncCounter.value;\n };\n disposables.push(\n watch(\n source,\n () => {\n syncCounter.value++;\n },\n { ...watchOptions, flush: \"sync\" }\n )\n );\n ignoreUpdates = (updater) => {\n const syncCounterPrev = syncCounter.value;\n updater();\n ignoreCounter.value += syncCounter.value - syncCounterPrev;\n };\n disposables.push(\n watch(\n source,\n (...args) => {\n const ignore = ignoreCounter.value > 0 && ignoreCounter.value === syncCounter.value;\n ignoreCounter.value = 0;\n syncCounter.value = 0;\n if (ignore)\n return;\n filteredCb(...args);\n },\n watchOptions\n )\n );\n stop = () => {\n disposables.forEach((fn) => fn());\n };\n }\n return { stop, ignoreUpdates, ignorePrevAsyncUpdates };\n}\n\nfunction watchImmediate(source, cb, options) {\n return watch(\n source,\n cb,\n {\n ...options,\n immediate: true\n }\n );\n}\n\nfunction watchOnce(source, cb, options) {\n return watch(\n source,\n cb,\n {\n ...options,\n once: true\n }\n );\n}\n\nfunction watchThrottled(source, cb, options = {}) {\n const {\n throttle = 0,\n trailing = true,\n leading = true,\n ...watchOptions\n } = options;\n return watchWithFilter(\n source,\n cb,\n {\n ...watchOptions,\n eventFilter: throttleFilter(throttle, trailing, leading)\n }\n );\n}\n\nfunction watchTriggerable(source, cb, options = {}) {\n let cleanupFn;\n function onEffect() {\n if (!cleanupFn)\n return;\n const fn = cleanupFn;\n cleanupFn = void 0;\n fn();\n }\n function onCleanup(callback) {\n cleanupFn = callback;\n }\n const _cb = (value, oldValue) => {\n onEffect();\n return cb(value, oldValue, onCleanup);\n };\n const res = watchIgnorable(source, _cb, options);\n const { ignoreUpdates } = res;\n const trigger = () => {\n let res2;\n ignoreUpdates(() => {\n res2 = _cb(getWatchSources(source), getOldValue(source));\n });\n return res2;\n };\n return {\n ...res,\n trigger\n };\n}\nfunction getWatchSources(sources) {\n if (isReactive(sources))\n return sources;\n if (Array.isArray(sources))\n return sources.map((item) => toValue$1(item));\n return toValue$1(sources);\n}\nfunction getOldValue(source) {\n return Array.isArray(source) ? source.map(() => void 0) : void 0;\n}\n\nfunction whenever(source, cb, options) {\n const stop = watch(\n source,\n (v, ov, onInvalidate) => {\n if (v) {\n if (options == null ? void 0 : options.once)\n nextTick(() => stop());\n cb(v, ov, onInvalidate);\n }\n },\n {\n ...options,\n once: false\n }\n );\n return stop;\n}\n\nexport { assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createRef, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, computedEager as eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, pxValue, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toArray, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };\n"],"names":["tryOnScopeDispose","fn","getCurrentScope","onScopeDispose","isClient","notNullish","val","toString","isObject","noop","createFilterWrapper","filter","wrapper","args","resolve","reject","debounceFilter","ms","options","timer","maxTimer","lastRejector","_clearTimeout","timer2","lastInvoker","invoke","duration","toValue$1","maxDuration","toArray","value","getLifeCycleTarget","target","getCurrentInstance","useDebounceFn","tryOnMounted","sync","onMounted","nextTick","useIntervalFn","cb","interval","immediate","immediateCallback","isActive","shallowRef","clean","pause","resume","intervalValue","isRef","stopWatch","watch","shallowReadonly","watchImmediate","source","whenever","v","ov","onInvalidate"],"mappings":";AAgDA,SAASA,EAAkBC,GAAI;AAC7B,SAAIC,EAAe,KACjBC,EAAeF,CAAE,GACV,MAEF;AACT;AA2OK,MAACG,IAAW,OAAO,SAAW,OAAe,OAAO,WAAa;AACrD,OAAO,oBAAsB,OAAe,sBAAsB;AAE9E,MAACC,IAAa,CAACC,MAAQA,KAAO,MAK7BC,IAAW,OAAO,UAAU,UAC5BC,IAAW,CAACF,MAAQC,EAAS,KAAKD,CAAG,MAAM,mBAI3CG,IAAO,MAAM;AACnB;AAqDA,SAASC,EAAoBC,GAAQV,GAAI;AACvC,WAASW,KAAWC,GAAM;AACxB,WAAO,IAAI,QAAQ,CAACC,GAASC,MAAW;AACtC,cAAQ,QAAQJ,EAAO,MAAMV,EAAG,MAAM,MAAMY,CAAI,GAAG,EAAE,IAAAZ,GAAI,SAAS,MAAM,MAAAY,EAAI,CAAE,CAAC,EAAE,KAAKC,CAAO,EAAE,MAAMC,CAAM;AAAA,IACjH,CAAK;AAAA,EACL;AACE,SAAOH;AACT;AAIA,SAASI,EAAeC,GAAIC,IAAU,IAAI;AACxC,MAAIC,GACAC,GACAC,IAAeZ;AACnB,QAAMa,IAAgB,CAACC,MAAW;AAChC,iBAAaA,CAAM,GACnBF,EAAc,GACdA,IAAeZ;AAAA,EAChB;AACD,MAAIe;AAgCJ,SA/Be,CAACC,MAAW;AACzB,UAAMC,IAAWC,EAAUV,CAAE,GACvBW,IAAcD,EAAUT,EAAQ,OAAO;AAG7C,WAFIC,KACFG,EAAcH,CAAK,GACjBO,KAAY,KAAKE,MAAgB,UAAUA,KAAe,K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AO;AAAA,EACX;AACE,WAASE,IAAS;AAChB,UAAMC,IAAgBtB,EAAUc,CAAQ;AACxC,IAAIQ,KAAiB,MAErBL,EAAS,QAAQ,IACbD,KACFH,EAAI,GACNM,EAAO,GACHF,EAAS,UACXzB,IAAQ,YAAYqB,GAAIS,CAAa;AAAA,EAC3C;AAGE,MAFIP,KAAatC,KACf4C,EAAQ,GACNE,EAAMT,CAAQ,KAAK,OAAOA,KAAa,YAAY;AACrD,UAAMU,IAAYC,EAAMX,GAAU,MAAM;AACtC,MAAIG,EAAS,SAASxC,KACpB4C,EAAQ;AAAA,IAChB,CAAK;AACD,IAAAhD,EAAkBmD,CAAS;AAAA,EAC/B;AACE,SAAAnD,EAAkB+C,CAAK,GAChB;AAAA,IACL,UAAUM,EAAgBT,CAAQ;AAAA,IAClC,OAAAG;AAAA,IACA,QAAAC;AAAA,EACD;AACH;AAkSA,SAASM,EAAeC,GAAQf,GAAItB,GAAS;AAC3C,SAAOkC;AAAA,IACLG;AAAA,IACAf;AAAA,IACA;AAAA,MACE,GAAGtB;AAAA,MACH,WAAW;AAAA,IACjB;AAAA,EACG;AACH;AAuEA,SAASsC,EAASD,GAAQf,GAAItB,GAAS;AAerC,SAdakC;AAAA,IACXG;AAAA,IACA,CAACE,GAAGC,GAAIC,MAAiB;AACvB,MAAIF,KAGFjB,EAAGiB,GAAGC,GAAIC,CAAY;AAAA,IAEzB;AAAA,IACD;AAAA,MACE,GAAGzC;AAAA,MACH,MAAM;AAAA,IACZ;AAAA,EACG;AAEH;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.js","sources":["../../../../../../../../../node_modules/.pnpm/@vueuse+shared@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/shared/index.mjs"],"sourcesContent":["import { shallowRef, watchEffect, readonly, watch, customRef, getCurrentScope, onScopeDispose, effectScope, getCurrentInstance, hasInjectionContext, inject, provide, ref, isRef, unref, toValue as toValue$1, computed, reactive, toRefs as toRefs$1, toRef as toRef$1, shallowReadonly, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue';\n\nfunction computedEager(fn, options) {\n var _a;\n const result = shallowRef();\n watchEffect(() => {\n result.value = fn();\n }, {\n ...options,\n flush: (_a = options == null ? void 0 : options.flush) != null ? _a : \"sync\"\n });\n return readonly(result);\n}\n\nfunction computedWithControl(source, fn) {\n let v = void 0;\n let track;\n let trigger;\n const dirty = shallowRef(true);\n const update = () => {\n dirty.value = true;\n trigger();\n };\n watch(source, update, { flush: \"sync\" });\n const get = typeof fn === \"function\" ? fn : fn.get;\n const set = typeof fn === \"function\" ? void 0 : fn.set;\n const result = customRef((_track, _trigger) => {\n track = _track;\n trigger = _trigger;\n return {\n get() {\n if (dirty.value) {\n v = get(v);\n dirty.value = false;\n }\n track();\n return v;\n },\n set(v2) {\n set == null ? void 0 : set(v2);\n }\n };\n });\n if (Object.isExtensible(result))\n result.trigger = update;\n return result;\n}\n\nfunction tryOnScopeDispose(fn) {\n if (getCurrentScope()) {\n onScopeDispose(fn);\n return true;\n }\n return false;\n}\n\nfunction createEventHook() {\n const fns = /* @__PURE__ */ new Set();\n const off = (fn) => {\n fns.delete(fn);\n };\n const clear = () => {\n fns.clear();\n };\n const on = (fn) => {\n fns.add(fn);\n const offFn = () => off(fn);\n tryOnScopeDispose(offFn);\n return {\n off: offFn\n };\n };\n const trigger = (...args) => {\n return Promise.all(Array.from(fns).map((fn) => fn(...args)));\n };\n return {\n on,\n off,\n trigger,\n clear\n };\n}\n\nfunction createGlobalState(stateFactory) {\n let initialized = false;\n let state;\n const scope = effectScope(true);\n return (...args) => {\n if (!initialized) {\n state = scope.run(() => stateFactory(...args));\n initialized = true;\n }\n return state;\n };\n}\n\nconst localProvidedStateMap = /* @__PURE__ */ new WeakMap();\n\nconst injectLocal = (...args) => {\n var _a;\n const key = args[0];\n const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;\n if (instance == null && !hasInjectionContext())\n throw new Error(\"injectLocal must be called in setup\");\n if (instance && localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))\n return localProvidedStateMap.get(instance)[key];\n return inject(...args);\n};\n\nfunction provideLocal(key, value) {\n var _a;\n const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;\n if (instance == null)\n throw new Error(\"provideLocal must be called in setup\");\n if (!localProvidedStateMap.has(instance))\n localProvidedStateMap.set(instance, /* @__PURE__ */ Object.create(null));\n const localProvidedState = localProvidedStateMap.get(instance);\n localProvidedState[key] = value;\n return provide(key, value);\n}\n\nfunction createInjectionState(composable, options) {\n const key = (options == null ? void 0 : options.injectionKey) || Symbol(composable.name || \"InjectionState\");\n const defaultValue = options == null ? void 0 : options.defaultValue;\n const useProvidingState = (...args) => {\n const state = composable(...args);\n provideLocal(key, state);\n return state;\n };\n const useInjectedState = () => injectLocal(key, defaultValue);\n return [useProvidingState, useInjectedState];\n}\n\nfunction createRef(value, deep) {\n if (deep === true) {\n return ref(value);\n } else {\n return shallowRef(value);\n }\n}\n\nfunction createSharedComposable(composable) {\n let subscribers = 0;\n let state;\n let scope;\n const dispose = () => {\n subscribers -= 1;\n if (scope && subscribers <= 0) {\n scope.stop();\n state = void 0;\n scope = void 0;\n }\n };\n return (...args) => {\n subscribers += 1;\n if (!scope) {\n scope = effectScope(true);\n state = scope.run(() => composable(...args));\n }\n tryOnScopeDispose(dispose);\n return state;\n };\n}\n\nfunction extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) {\n for (const [key, value] of Object.entries(extend)) {\n if (key === \"value\")\n continue;\n if (isRef(value) && unwrap) {\n Object.defineProperty(ref, key, {\n get() {\n return value.value;\n },\n set(v) {\n value.value = v;\n },\n enumerable\n });\n } else {\n Object.defineProperty(ref, key, { value, enumerable });\n }\n }\n return ref;\n}\n\nfunction get(obj, key) {\n if (key == null)\n return unref(obj);\n return unref(obj)[key];\n}\n\nfunction isDefined(v) {\n return unref(v) != null;\n}\n\nfunction makeDestructurable(obj, arr) {\n if (typeof Symbol !== \"undefined\") {\n const clone = { ...obj };\n Object.defineProperty(clone, Symbol.iterator, {\n enumerable: false,\n value() {\n let index = 0;\n return {\n next: () => ({\n value: arr[index++],\n done: index > arr.length\n })\n };\n }\n });\n return clone;\n } else {\n return Object.assign([...arr], obj);\n }\n}\n\nfunction reactify(fn, options) {\n const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? unref : toValue$1;\n return function(...args) {\n return computed(() => fn.apply(this, args.map((i) => unrefFn(i))));\n };\n}\n\nfunction reactifyObject(obj, optionsOrKeys = {}) {\n let keys = [];\n let options;\n if (Array.isArray(optionsOrKeys)) {\n keys = optionsOrKeys;\n } else {\n options = optionsOrKeys;\n const { includeOwnProperties = true } = optionsOrKeys;\n keys.push(...Object.keys(obj));\n if (includeOwnProperties)\n keys.push(...Object.getOwnPropertyNames(obj));\n }\n return Object.fromEntries(\n keys.map((key) => {\n const value = obj[key];\n return [\n key,\n typeof value === \"function\" ? reactify(value.bind(obj), options) : value\n ];\n })\n );\n}\n\nfunction toReactive(objectRef) {\n if (!isRef(objectRef))\n return reactive(objectRef);\n const proxy = new Proxy({}, {\n get(_, p, receiver) {\n return unref(Reflect.get(objectRef.value, p, receiver));\n },\n set(_, p, value) {\n if (isRef(objectRef.value[p]) && !isRef(value))\n objectRef.value[p].value = value;\n else\n objectRef.value[p] = value;\n return true;\n },\n deleteProperty(_, p) {\n return Reflect.deleteProperty(objectRef.value, p);\n },\n has(_, p) {\n return Reflect.has(objectRef.value, p);\n },\n ownKeys() {\n return Object.keys(objectRef.value);\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true\n };\n }\n });\n return reactive(proxy);\n}\n\nfunction reactiveComputed(fn) {\n return toReactive(computed(fn));\n}\n\nfunction reactiveOmit(obj, ...keys) {\n const flatKeys = keys.flat();\n const predicate = flatKeys[0];\n return reactiveComputed(() => typeof predicate === \"function\" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => !predicate(toValue$1(v), k))) : Object.fromEntries(Object.entries(toRefs$1(obj)).filter((e) => !flatKeys.includes(e[0]))));\n}\n\nconst isClient = typeof window !== \"undefined\" && typeof document !== \"undefined\";\nconst isWorker = typeof WorkerGlobalScope !== \"undefined\" && globalThis instanceof WorkerGlobalScope;\nconst isDef = (val) => typeof val !== \"undefined\";\nconst notNullish = (val) => val != null;\nconst assert = (condition, ...infos) => {\n if (!condition)\n console.warn(...infos);\n};\nconst toString = Object.prototype.toString;\nconst isObject = (val) => toString.call(val) === \"[object Object]\";\nconst now = () => Date.now();\nconst timestamp = () => +Date.now();\nconst clamp = (n, min, max) => Math.min(max, Math.max(min, n));\nconst noop = () => {\n};\nconst rand = (min, max) => {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1)) + min;\n};\nconst hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);\nconst isIOS = /* @__PURE__ */ getIsIOS();\nfunction getIsIOS() {\n var _a, _b;\n return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));\n}\n\nfunction toRef(...args) {\n if (args.length !== 1)\n return toRef$1(...args);\n const r = args[0];\n return typeof r === \"function\" ? readonly(customRef(() => ({ get: r, set: noop }))) : ref(r);\n}\nconst resolveRef = toRef;\n\nfunction reactivePick(obj, ...keys) {\n const flatKeys = keys.flat();\n const predicate = flatKeys[0];\n return reactiveComputed(() => typeof predicate === \"function\" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => predicate(toValue$1(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));\n}\n\nfunction refAutoReset(defaultValue, afterMs = 1e4) {\n return customRef((track, trigger) => {\n let value = toValue$1(defaultValue);\n let timer;\n const resetAfter = () => setTimeout(() => {\n value = toValue$1(defaultValue);\n trigger();\n }, toValue$1(afterMs));\n tryOnScopeDispose(() => {\n clearTimeout(timer);\n });\n return {\n get() {\n track();\n return value;\n },\n set(newValue) {\n value = newValue;\n trigger();\n clearTimeout(timer);\n timer = resetAfter();\n }\n };\n });\n}\n\nfunction createFilterWrapper(filter, fn) {\n function wrapper(...args) {\n return new Promise((resolve, reject) => {\n Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve).catch(reject);\n });\n }\n return wrapper;\n}\nconst bypassFilter = (invoke) => {\n return invoke();\n};\nfunction debounceFilter(ms, options = {}) {\n let timer;\n let maxTimer;\n let lastRejector = noop;\n const _clearTimeout = (timer2) => {\n clearTimeout(timer2);\n lastRejector();\n lastRejector = noop;\n };\n let lastInvoker;\n const filter = (invoke) => {\n const duration = toValue$1(ms);\n const maxDuration = toValue$1(options.maxWait);\n if (timer)\n _clearTimeout(timer);\n if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {\n if (maxTimer) {\n _clearTimeout(maxTimer);\n maxTimer = null;\n }\n return Promise.resolve(invoke());\n }\n return new Promise((resolve, reject) => {\n lastRejector = options.rejectOnCancel ? reject : resolve;\n lastInvoker = invoke;\n if (maxDuration && !maxTimer) {\n maxTimer = setTimeout(() => {\n if (timer)\n _clearTimeout(timer);\n maxTimer = null;\n resolve(lastInvoker());\n }, maxDuration);\n }\n timer = setTimeout(() => {\n if (maxTimer)\n _clearTimeout(maxTimer);\n maxTimer = null;\n resolve(invoke());\n }, duration);\n });\n };\n return filter;\n}\nfunction throttleFilter(...args) {\n let lastExec = 0;\n let timer;\n let isLeading = true;\n let lastRejector = noop;\n let lastValue;\n let ms;\n let trailing;\n let leading;\n let rejectOnCancel;\n if (!isRef(args[0]) && typeof args[0] === \"object\")\n ({ delay: ms, trailing = true, leading = true, rejectOnCancel = false } = args[0]);\n else\n [ms, trailing = true, leading = true, rejectOnCancel = false] = args;\n const clear = () => {\n if (timer) {\n clearTimeout(timer);\n timer = void 0;\n lastRejector();\n lastRejector = noop;\n }\n };\n const filter = (_invoke) => {\n const duration = toValue$1(ms);\n const elapsed = Date.now() - lastExec;\n const invoke = () => {\n return lastValue = _invoke();\n };\n clear();\n if (duration <= 0) {\n lastExec = Date.now();\n return invoke();\n }\n if (elapsed > duration && (leading || !isLeading)) {\n lastExec = Date.now();\n invoke();\n } else if (trailing) {\n lastValue = new Promise((resolve, reject) => {\n lastRejector = rejectOnCancel ? reject : resolve;\n timer = setTimeout(() => {\n lastExec = Date.now();\n isLeading = true;\n resolve(invoke());\n clear();\n }, Math.max(0, duration - elapsed));\n });\n }\n if (!leading && !timer)\n timer = setTimeout(() => isLeading = true, duration);\n isLeading = false;\n return lastValue;\n };\n return filter;\n}\nfunction pausableFilter(extendFilter = bypassFilter, options = {}) {\n const {\n initialState = \"active\"\n } = options;\n const isActive = toRef(initialState === \"active\");\n function pause() {\n isActive.value = false;\n }\n function resume() {\n isActive.value = true;\n }\n const eventFilter = (...args) => {\n if (isActive.value)\n extendFilter(...args);\n };\n return { isActive: readonly(isActive), pause, resume, eventFilter };\n}\n\nfunction promiseTimeout(ms, throwOnTimeout = false, reason = \"Timeout\") {\n return new Promise((resolve, reject) => {\n if (throwOnTimeout)\n setTimeout(() => reject(reason), ms);\n else\n setTimeout(resolve, ms);\n });\n}\nfunction identity(arg) {\n return arg;\n}\nfunction createSingletonPromise(fn) {\n let _promise;\n function wrapper() {\n if (!_promise)\n _promise = fn();\n return _promise;\n }\n wrapper.reset = async () => {\n const _prev = _promise;\n _promise = void 0;\n if (_prev)\n await _prev;\n };\n return wrapper;\n}\nfunction invoke(fn) {\n return fn();\n}\nfunction containsProp(obj, ...props) {\n return props.some((k) => k in obj);\n}\nfunction increaseWithUnit(target, delta) {\n var _a;\n if (typeof target === \"number\")\n return target + delta;\n const value = ((_a = target.match(/^-?\\d+\\.?\\d*/)) == null ? void 0 : _a[0]) || \"\";\n const unit = target.slice(value.length);\n const result = Number.parseFloat(value) + delta;\n if (Number.isNaN(result))\n return target;\n return result + unit;\n}\nfunction pxValue(px) {\n return px.endsWith(\"rem\") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);\n}\nfunction objectPick(obj, keys, omitUndefined = false) {\n return keys.reduce((n, k) => {\n if (k in obj) {\n if (!omitUndefined || obj[k] !== void 0)\n n[k] = obj[k];\n }\n return n;\n }, {});\n}\nfunction objectOmit(obj, keys, omitUndefined = false) {\n return Object.fromEntries(Object.entries(obj).filter(([key, value]) => {\n return (!omitUndefined || value !== void 0) && !keys.includes(key);\n }));\n}\nfunction objectEntries(obj) {\n return Object.entries(obj);\n}\nfunction toArray(value) {\n return Array.isArray(value) ? value : [value];\n}\n\nfunction cacheStringFunction(fn) {\n const cache = /* @__PURE__ */ Object.create(null);\n return (str) => {\n const hit = cache[str];\n return hit || (cache[str] = fn(str));\n };\n}\nconst hyphenateRE = /\\B([A-Z])/g;\nconst hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, \"-$1\").toLowerCase());\nconst camelizeRE = /-(\\w)/g;\nconst camelize = cacheStringFunction((str) => {\n return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : \"\");\n});\n\nfunction getLifeCycleTarget(target) {\n return target || getCurrentInstance();\n}\n\nfunction useDebounceFn(fn, ms = 200, options = {}) {\n return createFilterWrapper(\n debounceFilter(ms, options),\n fn\n );\n}\n\nfunction refDebounced(value, ms = 200, options = {}) {\n const debounced = ref(toValue$1(value));\n const updater = useDebounceFn(() => {\n debounced.value = value.value;\n }, ms, options);\n watch(value, () => updater());\n return shallowReadonly(debounced);\n}\n\nfunction refDefault(source, defaultValue) {\n return computed({\n get() {\n var _a;\n return (_a = source.value) != null ? _a : defaultValue;\n },\n set(value) {\n source.value = value;\n }\n });\n}\n\nfunction useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnCancel = false) {\n return createFilterWrapper(\n throttleFilter(ms, trailing, leading, rejectOnCancel),\n fn\n );\n}\n\nfunction refThrottled(value, delay = 200, trailing = true, leading = true) {\n if (delay <= 0)\n return value;\n const throttled = ref(toValue$1(value));\n const updater = useThrottleFn(() => {\n throttled.value = value.value;\n }, delay, trailing, leading);\n watch(value, () => updater());\n return throttled;\n}\n\nfunction refWithControl(initial, options = {}) {\n let source = initial;\n let track;\n let trigger;\n const ref = customRef((_track, _trigger) => {\n track = _track;\n trigger = _trigger;\n return {\n get() {\n return get();\n },\n set(v) {\n set(v);\n }\n };\n });\n function get(tracking = true) {\n if (tracking)\n track();\n return source;\n }\n function set(value, triggering = true) {\n var _a, _b;\n if (value === source)\n return;\n const old = source;\n if (((_a = options.onBeforeChange) == null ? void 0 : _a.call(options, value, old)) === false)\n return;\n source = value;\n (_b = options.onChanged) == null ? void 0 : _b.call(options, value, old);\n if (triggering)\n trigger();\n }\n const untrackedGet = () => get(false);\n const silentSet = (v) => set(v, false);\n const peek = () => get(false);\n const lay = (v) => set(v, false);\n return extendRef(\n ref,\n {\n get,\n set,\n untrackedGet,\n silentSet,\n peek,\n lay\n },\n { enumerable: true }\n );\n}\nconst controlledRef = refWithControl;\n\nfunction set(...args) {\n if (args.length === 2) {\n const [ref, value] = args;\n ref.value = value;\n }\n if (args.length === 3) {\n const [target, key, value] = args;\n target[key] = value;\n }\n}\n\nfunction watchWithFilter(source, cb, options = {}) {\n const {\n eventFilter = bypassFilter,\n ...watchOptions\n } = options;\n return watch(\n source,\n createFilterWrapper(\n eventFilter,\n cb\n ),\n watchOptions\n );\n}\n\nfunction watchPausable(source, cb, options = {}) {\n const {\n eventFilter: filter,\n initialState = \"active\",\n ...watchOptions\n } = options;\n const { eventFilter, pause, resume, isActive } = pausableFilter(filter, { initialState });\n const stop = watchWithFilter(\n source,\n cb,\n {\n ...watchOptions,\n eventFilter\n }\n );\n return { stop, pause, resume, isActive };\n}\n\nfunction syncRef(left, right, ...[options]) {\n const {\n flush = \"sync\",\n deep = false,\n immediate = true,\n direction = \"both\",\n transform = {}\n } = options || {};\n const watchers = [];\n const transformLTR = \"ltr\" in transform && transform.ltr || ((v) => v);\n const transformRTL = \"rtl\" in transform && transform.rtl || ((v) => v);\n if (direction === \"both\" || direction === \"ltr\") {\n watchers.push(watchPausable(\n left,\n (newValue) => {\n watchers.forEach((w) => w.pause());\n right.value = transformLTR(newValue);\n watchers.forEach((w) => w.resume());\n },\n { flush, deep, immediate }\n ));\n }\n if (direction === \"both\" || direction === \"rtl\") {\n watchers.push(watchPausable(\n right,\n (newValue) => {\n watchers.forEach((w) => w.pause());\n left.value = transformRTL(newValue);\n watchers.forEach((w) => w.resume());\n },\n { flush, deep, immediate }\n ));\n }\n const stop = () => {\n watchers.forEach((w) => w.stop());\n };\n return stop;\n}\n\nfunction syncRefs(source, targets, options = {}) {\n const {\n flush = \"sync\",\n deep = false,\n immediate = true\n } = options;\n const targetsArray = toArray(targets);\n return watch(\n source,\n (newValue) => targetsArray.forEach((target) => target.value = newValue),\n { flush, deep, immediate }\n );\n}\n\nfunction toRefs(objectRef, options = {}) {\n if (!isRef(objectRef))\n return toRefs$1(objectRef);\n const result = Array.isArray(objectRef.value) ? Array.from({ length: objectRef.value.length }) : {};\n for (const key in objectRef.value) {\n result[key] = customRef(() => ({\n get() {\n return objectRef.value[key];\n },\n set(v) {\n var _a;\n const replaceRef = (_a = toValue$1(options.replaceRef)) != null ? _a : true;\n if (replaceRef) {\n if (Array.isArray(objectRef.value)) {\n const copy = [...objectRef.value];\n copy[key] = v;\n objectRef.value = copy;\n } else {\n const newObject = { ...objectRef.value, [key]: v };\n Object.setPrototypeOf(newObject, Object.getPrototypeOf(objectRef.value));\n objectRef.value = newObject;\n }\n } else {\n objectRef.value[key] = v;\n }\n }\n }));\n }\n return result;\n}\n\nconst toValue = toValue$1;\nconst resolveUnref = toValue$1;\n\nfunction tryOnBeforeMount(fn, sync = true, target) {\n const instance = getLifeCycleTarget(target);\n if (instance)\n onBeforeMount(fn, target);\n else if (sync)\n fn();\n else\n nextTick(fn);\n}\n\nfunction tryOnBeforeUnmount(fn, target) {\n const instance = getLifeCycleTarget(target);\n if (instance)\n onBeforeUnmount(fn, target);\n}\n\nfunction tryOnMounted(fn, sync = true, target) {\n const instance = getLifeCycleTarget(target);\n if (instance)\n onMounted(fn, target);\n else if (sync)\n fn();\n else\n nextTick(fn);\n}\n\nfunction tryOnUnmounted(fn, target) {\n const instance = getLifeCycleTarget(target);\n if (instance)\n onUnmounted(fn, target);\n}\n\nfunction createUntil(r, isNot = false) {\n function toMatch(condition, { flush = \"sync\", deep = false, timeout, throwOnTimeout } = {}) {\n let stop = null;\n const watcher = new Promise((resolve) => {\n stop = watch(\n r,\n (v) => {\n if (condition(v) !== isNot) {\n if (stop)\n stop();\n else\n nextTick(() => stop == null ? void 0 : stop());\n resolve(v);\n }\n },\n {\n flush,\n deep,\n immediate: true\n }\n );\n });\n const promises = [watcher];\n if (timeout != null) {\n promises.push(\n promiseTimeout(timeout, throwOnTimeout).then(() => toValue$1(r)).finally(() => stop == null ? void 0 : stop())\n );\n }\n return Promise.race(promises);\n }\n function toBe(value, options) {\n if (!isRef(value))\n return toMatch((v) => v === value, options);\n const { flush = \"sync\", deep = false, timeout, throwOnTimeout } = options != null ? options : {};\n let stop = null;\n const watcher = new Promise((resolve) => {\n stop = watch(\n [r, value],\n ([v1, v2]) => {\n if (isNot !== (v1 === v2)) {\n if (stop)\n stop();\n else\n nextTick(() => stop == null ? void 0 : stop());\n resolve(v1);\n }\n },\n {\n flush,\n deep,\n immediate: true\n }\n );\n });\n const promises = [watcher];\n if (timeout != null) {\n promises.push(\n promiseTimeout(timeout, throwOnTimeout).then(() => toValue$1(r)).finally(() => {\n stop == null ? void 0 : stop();\n return toValue$1(r);\n })\n );\n }\n return Promise.race(promises);\n }\n function toBeTruthy(options) {\n return toMatch((v) => Boolean(v), options);\n }\n function toBeNull(options) {\n return toBe(null, options);\n }\n function toBeUndefined(options) {\n return toBe(void 0, options);\n }\n function toBeNaN(options) {\n return toMatch(Number.isNaN, options);\n }\n function toContains(value, options) {\n return toMatch((v) => {\n const array = Array.from(v);\n return array.includes(value) || array.includes(toValue$1(value));\n }, options);\n }\n function changed(options) {\n return changedTimes(1, options);\n }\n function changedTimes(n = 1, options) {\n let count = -1;\n return toMatch(() => {\n count += 1;\n return count >= n;\n }, options);\n }\n if (Array.isArray(toValue$1(r))) {\n const instance = {\n toMatch,\n toContains,\n changed,\n changedTimes,\n get not() {\n return createUntil(r, !isNot);\n }\n };\n return instance;\n } else {\n const instance = {\n toMatch,\n toBe,\n toBeTruthy,\n toBeNull,\n toBeNaN,\n toBeUndefined,\n changed,\n changedTimes,\n get not() {\n return createUntil(r, !isNot);\n }\n };\n return instance;\n }\n}\nfunction until(r) {\n return createUntil(r);\n}\n\nfunction defaultComparator(value, othVal) {\n return value === othVal;\n}\nfunction useArrayDifference(...args) {\n var _a, _b;\n const list = args[0];\n const values = args[1];\n let compareFn = (_a = args[2]) != null ? _a : defaultComparator;\n const {\n symmetric = false\n } = (_b = args[3]) != null ? _b : {};\n if (typeof compareFn === \"string\") {\n const key = compareFn;\n compareFn = (value, othVal) => value[key] === othVal[key];\n }\n const diff1 = computed(() => toValue$1(list).filter((x) => toValue$1(values).findIndex((y) => compareFn(x, y)) === -1));\n if (symmetric) {\n const diff2 = computed(() => toValue$1(values).filter((x) => toValue$1(list).findIndex((y) => compareFn(x, y)) === -1));\n return computed(() => symmetric ? [...toValue$1(diff1), ...toValue$1(diff2)] : toValue$1(diff1));\n } else {\n return diff1;\n }\n}\n\nfunction useArrayEvery(list, fn) {\n return computed(() => toValue$1(list).every((element, index, array) => fn(toValue$1(element), index, array)));\n}\n\nfunction useArrayFilter(list, fn) {\n return computed(() => toValue$1(list).map((i) => toValue$1(i)).filter(fn));\n}\n\nfunction useArrayFind(list, fn) {\n return computed(() => toValue$1(\n toValue$1(list).find((element, index, array) => fn(toValue$1(element), index, array))\n ));\n}\n\nfunction useArrayFindIndex(list, fn) {\n return computed(() => toValue$1(list).findIndex((element, index, array) => fn(toValue$1(element), index, array)));\n}\n\nfunction findLast(arr, cb) {\n let index = arr.length;\n while (index-- > 0) {\n if (cb(arr[index], index, arr))\n return arr[index];\n }\n return void 0;\n}\nfunction useArrayFindLast(list, fn) {\n return computed(() => toValue$1(\n !Array.prototype.findLast ? findLast(toValue$1(list), (element, index, array) => fn(toValue$1(element), index, array)) : toValue$1(list).findLast((element, index, array) => fn(toValue$1(element), index, array))\n ));\n}\n\nfunction isArrayIncludesOptions(obj) {\n return isObject(obj) && containsProp(obj, \"formIndex\", \"comparator\");\n}\nfunction useArrayIncludes(...args) {\n var _a;\n const list = args[0];\n const value = args[1];\n let comparator = args[2];\n let formIndex = 0;\n if (isArrayIncludesOptions(comparator)) {\n formIndex = (_a = comparator.fromIndex) != null ? _a : 0;\n comparator = comparator.comparator;\n }\n if (typeof comparator === \"string\") {\n const key = comparator;\n comparator = (element, value2) => element[key] === toValue$1(value2);\n }\n comparator = comparator != null ? comparator : (element, value2) => element === toValue$1(value2);\n return computed(() => toValue$1(list).slice(formIndex).some((element, index, array) => comparator(\n toValue$1(element),\n toValue$1(value),\n index,\n toValue$1(array)\n )));\n}\n\nfunction useArrayJoin(list, separator) {\n return computed(() => toValue$1(list).map((i) => toValue$1(i)).join(toValue$1(separator)));\n}\n\nfunction useArrayMap(list, fn) {\n return computed(() => toValue$1(list).map((i) => toValue$1(i)).map(fn));\n}\n\nfunction useArrayReduce(list, reducer, ...args) {\n const reduceCallback = (sum, value, index) => reducer(toValue$1(sum), toValue$1(value), index);\n return computed(() => {\n const resolved = toValue$1(list);\n return args.length ? resolved.reduce(reduceCallback, typeof args[0] === \"function\" ? toValue$1(args[0]()) : toValue$1(args[0])) : resolved.reduce(reduceCallback);\n });\n}\n\nfunction useArraySome(list, fn) {\n return computed(() => toValue$1(list).some((element, index, array) => fn(toValue$1(element), index, array)));\n}\n\nfunction uniq(array) {\n return Array.from(new Set(array));\n}\nfunction uniqueElementsBy(array, fn) {\n return array.reduce((acc, v) => {\n if (!acc.some((x) => fn(v, x, array)))\n acc.push(v);\n return acc;\n }, []);\n}\nfunction useArrayUnique(list, compareFn) {\n return computed(() => {\n const resolvedList = toValue$1(list).map((element) => toValue$1(element));\n return compareFn ? uniqueElementsBy(resolvedList, compareFn) : uniq(resolvedList);\n });\n}\n\nfunction useCounter(initialValue = 0, options = {}) {\n let _initialValue = unref(initialValue);\n const count = shallowRef(initialValue);\n const {\n max = Number.POSITIVE_INFINITY,\n min = Number.NEGATIVE_INFINITY\n } = options;\n const inc = (delta = 1) => count.value = Math.max(Math.min(max, count.value + delta), min);\n const dec = (delta = 1) => count.value = Math.min(Math.max(min, count.value - delta), max);\n const get = () => count.value;\n const set = (val) => count.value = Math.max(min, Math.min(max, val));\n const reset = (val = _initialValue) => {\n _initialValue = val;\n return set(val);\n };\n return { count: shallowReadonly(count), inc, dec, get, set, reset };\n}\n\nconst REGEX_PARSE = /^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[T\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/i;\nconst REGEX_FORMAT = /[YMDHhms]o|\\[([^\\]]+)\\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|z{1,4}|SSS/g;\nfunction defaultMeridiem(hours, minutes, isLowercase, hasPeriod) {\n let m = hours < 12 ? \"AM\" : \"PM\";\n if (hasPeriod)\n m = m.split(\"\").reduce((acc, curr) => acc += `${curr}.`, \"\");\n return isLowercase ? m.toLowerCase() : m;\n}\nfunction formatOrdinal(num) {\n const suffixes = [\"th\", \"st\", \"nd\", \"rd\"];\n const v = num % 100;\n return num + (suffixes[(v - 20) % 10] || suffixes[v] || suffixes[0]);\n}\nfunction formatDate(date, formatStr, options = {}) {\n var _a;\n const years = date.getFullYear();\n const month = date.getMonth();\n const days = date.getDate();\n const hours = date.getHours();\n const minutes = date.getMinutes();\n const seconds = date.getSeconds();\n const milliseconds = date.getMilliseconds();\n const day = date.getDay();\n const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;\n const stripTimeZone = (dateString) => {\n var _a2;\n return (_a2 = dateString.split(\" \")[1]) != null ? _a2 : \"\";\n };\n const matches = {\n Yo: () => formatOrdinal(years),\n YY: () => String(years).slice(-2),\n YYYY: () => years,\n M: () => month + 1,\n Mo: () => formatOrdinal(month + 1),\n MM: () => `${month + 1}`.padStart(2, \"0\"),\n MMM: () => date.toLocaleDateString(toValue$1(options.locales), { month: \"short\" }),\n MMMM: () => date.toLocaleDateString(toValue$1(options.locales), { month: \"long\" }),\n D: () => String(days),\n Do: () => formatOrdinal(days),\n DD: () => `${days}`.padStart(2, \"0\"),\n H: () => String(hours),\n Ho: () => formatOrdinal(hours),\n HH: () => `${hours}`.padStart(2, \"0\"),\n h: () => `${hours % 12 || 12}`.padStart(1, \"0\"),\n ho: () => formatOrdinal(hours % 12 || 12),\n hh: () => `${hours % 12 || 12}`.padStart(2, \"0\"),\n m: () => String(minutes),\n mo: () => formatOrdinal(minutes),\n mm: () => `${minutes}`.padStart(2, \"0\"),\n s: () => String(seconds),\n so: () => formatOrdinal(seconds),\n ss: () => `${seconds}`.padStart(2, \"0\"),\n SSS: () => `${milliseconds}`.padStart(3, \"0\"),\n d: () => day,\n dd: () => date.toLocaleDateString(toValue$1(options.locales), { weekday: \"narrow\" }),\n ddd: () => date.toLocaleDateString(toValue$1(options.locales), { weekday: \"short\" }),\n dddd: () => date.toLocaleDateString(toValue$1(options.locales), { weekday: \"long\" }),\n A: () => meridiem(hours, minutes),\n AA: () => meridiem(hours, minutes, false, true),\n a: () => meridiem(hours, minutes, true),\n aa: () => meridiem(hours, minutes, true, true),\n z: () => stripTimeZone(date.toLocaleDateString(toValue$1(options.locales), { timeZoneName: \"shortOffset\" })),\n zz: () => stripTimeZone(date.toLocaleDateString(toValue$1(options.locales), { timeZoneName: \"shortOffset\" })),\n zzz: () => stripTimeZone(date.toLocaleDateString(toValue$1(options.locales), { timeZoneName: \"shortOffset\" })),\n zzzz: () => stripTimeZone(date.toLocaleDateString(toValue$1(options.locales), { timeZoneName: \"longOffset\" }))\n };\n return formatStr.replace(REGEX_FORMAT, (match, $1) => {\n var _a2, _b;\n return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ? void 0 : _a2.call(matches)) != null ? _b : match;\n });\n}\nfunction normalizeDate(date) {\n if (date === null)\n return new Date(Number.NaN);\n if (date === void 0)\n return /* @__PURE__ */ new Date();\n if (date instanceof Date)\n return new Date(date);\n if (typeof date === \"string\" && !/Z$/i.test(date)) {\n const d = date.match(REGEX_PARSE);\n if (d) {\n const m = d[2] - 1 || 0;\n const ms = (d[7] || \"0\").substring(0, 3);\n return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms);\n }\n }\n return new Date(date);\n}\nfunction useDateFormat(date, formatStr = \"HH:mm:ss\", options = {}) {\n return computed(() => formatDate(normalizeDate(toValue$1(date)), toValue$1(formatStr), options));\n}\n\nfunction useIntervalFn(cb, interval = 1e3, options = {}) {\n const {\n immediate = true,\n immediateCallback = false\n } = options;\n let timer = null;\n const isActive = shallowRef(false);\n function clean() {\n if (timer) {\n clearInterval(timer);\n timer = null;\n }\n }\n function pause() {\n isActive.value = false;\n clean();\n }\n function resume() {\n const intervalValue = toValue$1(interval);\n if (intervalValue <= 0)\n return;\n isActive.value = true;\n if (immediateCallback)\n cb();\n clean();\n if (isActive.value)\n timer = setInterval(cb, intervalValue);\n }\n if (immediate && isClient)\n resume();\n if (isRef(interval) || typeof interval === \"function\") {\n const stopWatch = watch(interval, () => {\n if (isActive.value && isClient)\n resume();\n });\n tryOnScopeDispose(stopWatch);\n }\n tryOnScopeDispose(pause);\n return {\n isActive: shallowReadonly(isActive),\n pause,\n resume\n };\n}\n\nfunction useInterval(interval = 1e3, options = {}) {\n const {\n controls: exposeControls = false,\n immediate = true,\n callback\n } = options;\n const counter = shallowRef(0);\n const update = () => counter.value += 1;\n const reset = () => {\n counter.value = 0;\n };\n const controls = useIntervalFn(\n callback ? () => {\n update();\n callback(counter.value);\n } : update,\n interval,\n { immediate }\n );\n if (exposeControls) {\n return {\n counter: shallowReadonly(counter),\n reset,\n ...controls\n };\n } else {\n return shallowReadonly(counter);\n }\n}\n\nfunction useLastChanged(source, options = {}) {\n var _a;\n const ms = shallowRef((_a = options.initialValue) != null ? _a : null);\n watch(\n source,\n () => ms.value = timestamp(),\n options\n );\n return shallowReadonly(ms);\n}\n\nfunction useTimeoutFn(cb, interval, options = {}) {\n const {\n immediate = true,\n immediateCallback = false\n } = options;\n const isPending = shallowRef(false);\n let timer = null;\n function clear() {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n }\n function stop() {\n isPending.value = false;\n clear();\n }\n function start(...args) {\n if (immediateCallback)\n cb();\n clear();\n isPending.value = true;\n timer = setTimeout(() => {\n isPending.value = false;\n timer = null;\n cb(...args);\n }, toValue$1(interval));\n }\n if (immediate) {\n isPending.value = true;\n if (isClient)\n start();\n }\n tryOnScopeDispose(stop);\n return {\n isPending: shallowReadonly(isPending),\n start,\n stop\n };\n}\n\nfunction useTimeout(interval = 1e3, options = {}) {\n const {\n controls: exposeControls = false,\n callback\n } = options;\n const controls = useTimeoutFn(\n callback != null ? callback : noop,\n interval,\n options\n );\n const ready = computed(() => !controls.isPending.value);\n if (exposeControls) {\n return {\n ready,\n ...controls\n };\n } else {\n return ready;\n }\n}\n\nfunction useToNumber(value, options = {}) {\n const {\n method = \"parseFloat\",\n radix,\n nanToZero\n } = options;\n return computed(() => {\n let resolved = toValue$1(value);\n if (typeof method === \"function\")\n resolved = method(resolved);\n else if (typeof resolved === \"string\")\n resolved = Number[method](resolved, radix);\n if (nanToZero && Number.isNaN(resolved))\n resolved = 0;\n return resolved;\n });\n}\n\nfunction useToString(value) {\n return computed(() => `${toValue$1(value)}`);\n}\n\nfunction useToggle(initialValue = false, options = {}) {\n const {\n truthyValue = true,\n falsyValue = false\n } = options;\n const valueIsRef = isRef(initialValue);\n const _value = shallowRef(initialValue);\n function toggle(value) {\n if (arguments.length) {\n _value.value = value;\n return _value.value;\n } else {\n const truthy = toValue$1(truthyValue);\n _value.value = _value.value === truthy ? toValue$1(falsyValue) : truthy;\n return _value.value;\n }\n }\n if (valueIsRef)\n return toggle;\n else\n return [_value, toggle];\n}\n\nfunction watchArray(source, cb, options) {\n let oldList = (options == null ? void 0 : options.immediate) ? [] : [...typeof source === \"function\" ? source() : Array.isArray(source) ? source : toValue$1(source)];\n return watch(source, (newList, _, onCleanup) => {\n const oldListRemains = Array.from({ length: oldList.length });\n const added = [];\n for (const obj of newList) {\n let found = false;\n for (let i = 0; i < oldList.length; i++) {\n if (!oldListRemains[i] && obj === oldList[i]) {\n oldListRemains[i] = true;\n found = true;\n break;\n }\n }\n if (!found)\n added.push(obj);\n }\n const removed = oldList.filter((_2, i) => !oldListRemains[i]);\n cb(newList, oldList, added, removed, onCleanup);\n oldList = [...newList];\n }, options);\n}\n\nfunction watchAtMost(source, cb, options) {\n const {\n count,\n ...watchOptions\n } = options;\n const current = shallowRef(0);\n const stop = watchWithFilter(\n source,\n (...args) => {\n current.value += 1;\n if (current.value >= toValue$1(count))\n nextTick(() => stop());\n cb(...args);\n },\n watchOptions\n );\n return { count: current, stop };\n}\n\nfunction watchDebounced(source, cb, options = {}) {\n const {\n debounce = 0,\n maxWait = void 0,\n ...watchOptions\n } = options;\n return watchWithFilter(\n source,\n cb,\n {\n ...watchOptions,\n eventFilter: debounceFilter(debounce, { maxWait })\n }\n );\n}\n\nfunction watchDeep(source, cb, options) {\n return watch(\n source,\n cb,\n {\n ...options,\n deep: true\n }\n );\n}\n\nfunction watchIgnorable(source, cb, options = {}) {\n const {\n eventFilter = bypassFilter,\n ...watchOptions\n } = options;\n const filteredCb = createFilterWrapper(\n eventFilter,\n cb\n );\n let ignoreUpdates;\n let ignorePrevAsyncUpdates;\n let stop;\n if (watchOptions.flush === \"sync\") {\n const ignore = shallowRef(false);\n ignorePrevAsyncUpdates = () => {\n };\n ignoreUpdates = (updater) => {\n ignore.value = true;\n updater();\n ignore.value = false;\n };\n stop = watch(\n source,\n (...args) => {\n if (!ignore.value)\n filteredCb(...args);\n },\n watchOptions\n );\n } else {\n const disposables = [];\n const ignoreCounter = shallowRef(0);\n const syncCounter = shallowRef(0);\n ignorePrevAsyncUpdates = () => {\n ignoreCounter.value = syncCounter.value;\n };\n disposables.push(\n watch(\n source,\n () => {\n syncCounter.value++;\n },\n { ...watchOptions, flush: \"sync\" }\n )\n );\n ignoreUpdates = (updater) => {\n const syncCounterPrev = syncCounter.value;\n updater();\n ignoreCounter.value += syncCounter.value - syncCounterPrev;\n };\n disposables.push(\n watch(\n source,\n (...args) => {\n const ignore = ignoreCounter.value > 0 && ignoreCounter.value === syncCounter.value;\n ignoreCounter.value = 0;\n syncCounter.value = 0;\n if (ignore)\n return;\n filteredCb(...args);\n },\n watchOptions\n )\n );\n stop = () => {\n disposables.forEach((fn) => fn());\n };\n }\n return { stop, ignoreUpdates, ignorePrevAsyncUpdates };\n}\n\nfunction watchImmediate(source, cb, options) {\n return watch(\n source,\n cb,\n {\n ...options,\n immediate: true\n }\n );\n}\n\nfunction watchOnce(source, cb, options) {\n return watch(\n source,\n cb,\n {\n ...options,\n once: true\n }\n );\n}\n\nfunction watchThrottled(source, cb, options = {}) {\n const {\n throttle = 0,\n trailing = true,\n leading = true,\n ...watchOptions\n } = options;\n return watchWithFilter(\n source,\n cb,\n {\n ...watchOptions,\n eventFilter: throttleFilter(throttle, trailing, leading)\n }\n );\n}\n\nfunction watchTriggerable(source, cb, options = {}) {\n let cleanupFn;\n function onEffect() {\n if (!cleanupFn)\n return;\n const fn = cleanupFn;\n cleanupFn = void 0;\n fn();\n }\n function onCleanup(callback) {\n cleanupFn = callback;\n }\n const _cb = (value, oldValue) => {\n onEffect();\n return cb(value, oldValue, onCleanup);\n };\n const res = watchIgnorable(source, _cb, options);\n const { ignoreUpdates } = res;\n const trigger = () => {\n let res2;\n ignoreUpdates(() => {\n res2 = _cb(getWatchSources(source), getOldValue(source));\n });\n return res2;\n };\n return {\n ...res,\n trigger\n };\n}\nfunction getWatchSources(sources) {\n if (isReactive(sources))\n return sources;\n if (Array.isArray(sources))\n return sources.map((item) => toValue$1(item));\n return toValue$1(sources);\n}\nfunction getOldValue(source) {\n return Array.isArray(source) ? source.map(() => void 0) : void 0;\n}\n\nfunction whenever(source, cb, options) {\n const stop = watch(\n source,\n (v, ov, onInvalidate) => {\n if (v) {\n if (options == null ? void 0 : options.once)\n nextTick(() => stop());\n cb(v, ov, onInvalidate);\n }\n },\n {\n ...options,\n once: false\n }\n );\n return stop;\n}\n\nexport { assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createRef, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, computedEager as eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, pxValue, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toArray, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };\n"],"names":["tryOnScopeDispose","fn","getCurrentScope","onScopeDispose","isClient","notNullish","val","toString","isObject","noop","createFilterWrapper","filter","wrapper","args","resolve","reject","bypassFilter","invoke","debounceFilter","ms","options","timer","maxTimer","lastRejector","_clearTimeout","timer2","lastInvoker","duration","toValue$1","maxDuration","toArray","value","getLifeCycleTarget","target","getCurrentInstance","useDebounceFn","tryOnMounted","sync","onMounted","nextTick","useIntervalFn","cb","interval","immediate","immediateCallback","isActive","shallowRef","clean","pause","resume","intervalValue","isRef","stopWatch","watch","shallowReadonly","watchIgnorable","source","eventFilter","watchOptions","filteredCb","ignoreUpdates","ignorePrevAsyncUpdates","stop","ignore","updater","disposables","ignoreCounter","syncCounter","syncCounterPrev","watchImmediate","whenever","v","ov","onInvalidate"],"mappings":";AAgDA,SAASA,EAAkBC,GAAI;AAC7B,SAAIC,EAAe,KACjBC,EAAeF,CAAE,GACV,MAEF;AACT;AA2OK,MAACG,IAAW,OAAO,SAAW,OAAe,OAAO,WAAa;AACrD,OAAO,oBAAsB,OAAe,sBAAsB;AAE9E,MAACC,IAAa,CAACC,MAAQA,KAAO,MAK7BC,IAAW,OAAO,UAAU,UAC5BC,IAAW,CAACF,MAAQC,EAAS,KAAKD,CAAG,MAAM,mBAI3CG,IAAO,MAAM;AACnB;AAqDA,SAASC,EAAoBC,GAAQV,GAAI;AACvC,WAASW,KAAWC,GAAM;AACxB,WAAO,IAAI,QAAQ,CAACC,GAASC,MAAW;AACtC,cAAQ,QAAQJ,EAAO,MAAMV,EAAG,MAAM,MAAMY,CAAI,GAAG,EAAE,IAAAZ,GAAI,SAAS,MAAM,MAAAY,EAAI,CAAE,CAAC,EAAE,KAAKC,CAAO,EAAE,MAAMC,CAAM;AAA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,IACA;AAAA,MACE,GAAGrB;AAAA,MACH,WAAW;AAAA,IACjB;AAAA,EACG;AACH;AAuEA,SAASkD,EAASd,GAAQf,GAAIrB,GAAS;AAerC,SAdaiC;AAAA,IACXG;AAAA,IACA,CAACe,GAAGC,GAAIC,MAAiB;AACvB,MAAIF,KAGF9B,EAAG8B,GAAGC,GAAIC,CAAY;AAAA,IAEzB;AAAA,IACD;AAAA,MACE,GAAGrD;AAAA,MACH,MAAM;AAAA,IACZ;AAAA,EACG;AAEH;","x_google_ignoreList":[0]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/ui-vue",
3
- "version": "1.42.2",
3
+ "version": "1.42.3",
4
4
  "type": "module",
5
5
  "main": "dist/lib.js",
6
6
  "styles": "dist/lib.js",
@@ -43,9 +43,9 @@
43
43
  "yarpm": "^1.2.0",
44
44
  "fast-json-patch": "^3.1.1",
45
45
  "@faker-js/faker": "^9.2.0",
46
+ "@milaboratories/build-configs": "1.0.5",
46
47
  "@milaboratories/ts-configs": "1.0.5",
47
48
  "@milaboratories/eslint-config": "^1.0.4",
48
- "@milaboratories/build-configs": "1.0.5",
49
49
  "@milaboratories/helpers": "^1.6.19"
50
50
  },
51
51
  "scripts": {
@@ -3,13 +3,14 @@ import type { Mutable } from '@milaboratories/helpers';
3
3
  import type { NavigationState, BlockOutputsBase, BlockState, PlatformaV2, ValueWithUTag, AuthorMarker } from '@platforma-sdk/model';
4
4
  import { hasAbortError, unwrapResult } from '@platforma-sdk/model';
5
5
  import type { Ref } from 'vue';
6
- import { reactive, computed, ref, watch } from 'vue';
6
+ import { reactive, computed, ref } from 'vue';
7
7
  import type { StateModelOptions, UnwrapOutputs, OutputValues, OutputErrors, AppSettings } from '../types';
8
8
  import { createModel } from '../createModel';
9
9
  import { parseQuery } from '../urls';
10
10
  import { MultiError, unwrapValueOrErrors } from '../utils';
11
11
  import { applyPatch } from 'fast-json-patch';
12
12
  import { UpdateSerializer } from './UpdateSerializer';
13
+ import { watchIgnorable } from '@vueuse/core';
13
14
 
14
15
  export const patchPoolingDelay = 100;
15
16
 
@@ -18,6 +19,14 @@ export const createNextAuthorMarker = (marker: AuthorMarker | undefined): Author
18
19
  localVersion: (marker?.localVersion ?? 0) + 1,
19
20
  });
20
21
 
22
+ const stringifyForDebug = (v: unknown) => {
23
+ try {
24
+ return JSON.stringify(v, null, 2);
25
+ } catch (err) {
26
+ return err instanceof Error ? err.message : String(err);
27
+ }
28
+ };
29
+
21
30
  /**
22
31
  * Creates an application instance with reactive state management, outputs, and methods for state updates and navigation.
23
32
  *
@@ -44,12 +53,12 @@ export function createAppV2<
44
53
  ) {
45
54
  const debug = (msg: string, ...rest: unknown[]) => {
46
55
  if (settings.debug) {
47
- console.log(`%c>>> %c${msg}`, 'color: orange; font-weight: bold', 'color: orange', settings.appId, ...rest);
56
+ console.log(`%c>>> %c${msg}`, 'color: orange; font-weight: bold', 'color: orange', ...rest.map((r) => stringifyForDebug(r)));
48
57
  }
49
58
  };
50
59
 
51
60
  const error = (msg: string, ...rest: unknown[]) => {
52
- console.error(`%c>>> %c${msg}`, 'color: red; font-weight: bold', 'color: red', settings.appId, ...rest);
61
+ console.error(`%c>>> %c${msg}`, 'color: red; font-weight: bold', 'color: red', ...rest.map((r) => stringifyForDebug(r)));
53
62
  };
54
63
 
55
64
  const data = {
@@ -135,25 +144,23 @@ export function createAppV2<
135
144
  };
136
145
  };
137
146
 
138
- const appModelWatch = watch(
147
+ const { ignoreUpdates } = watchIgnorable(
139
148
  () => appModel.model,
140
149
  (_newData) => {
141
150
  const newData = deepClone(_newData);
142
- debug('appModel.model', newData);
151
+ debug('setArgsAndUiStateQueue appModel.model', newData);
143
152
  setArgsAndUiStateQueue.run(() => setBlockArgsAndUiState(newData.args, newData.ui).then(unwrapResult));
144
153
  },
145
154
  { deep: true },
146
155
  );
147
156
 
148
- const updateAppModelSilently = (newData: {
157
+ const updateAppModel = (newData: {
149
158
  args: Args;
150
159
  ui: UiState;
151
160
  }) => {
152
- debug('updateAppModelSilently', newData);
153
- appModelWatch.pause();
161
+ debug('updateAppModel', newData);
154
162
  appModel.model.args = deepClone(newData.args) as Args;
155
163
  appModel.model.ui = deepClone(newData.ui) as UiState;
156
- appModelWatch.resume();
157
164
  };
158
165
 
159
166
  (async () => {
@@ -185,10 +192,12 @@ export function createAppV2<
185
192
 
186
193
  // Immutable behavior, apply external changes to the snapshot
187
194
  if (isAuthorChanged || data.isExternalSnapshot) {
188
- debug('got external changes, applying them to the snapshot', JSON.stringify(snapshot.value, null, 2));
189
- snapshot.value = applyPatch(snapshot.value, patches.value, false, false).newDocument;
190
- updateAppModelSilently(snapshot.value);
191
- data.isExternalSnapshot = isAuthorChanged;
195
+ debug('got external changes, applying them to the snapshot', snapshot.value);
196
+ ignoreUpdates(() => {
197
+ snapshot.value = applyPatch(snapshot.value, patches.value, false, false).newDocument;
198
+ updateAppModel({ args: snapshot.value.args, ui: snapshot.value.ui });
199
+ data.isExternalSnapshot = isAuthorChanged;
200
+ });
192
201
  } else {
193
202
  // Mutable behavior
194
203
  snapshot.value = applyPatch(snapshot.value, patches.value).newDocument;