@opentiny/tiny-robot 0.3.0-alpha.2 → 0.3.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index2.js CHANGED
@@ -1,117 +1,167 @@
1
- import { onMounted as ne, nextTick as ce, watch as L, getCurrentScope as ae, onScopeDispose as de, isRef as fe, getCurrentInstance as B, toValue as g, hasInjectionContext as oe, inject as ve, shallowRef as y, computed as _, reactive as K, unref as he, watchEffect as me } from "vue";
2
- function N(e) {
3
- return ae() ? (de(e), !0) : !1;
1
+ import { onMounted as re, nextTick as he, watch as k, getCurrentScope as me, onScopeDispose as ge, getCurrentInstance as j, isRef as ie, toValue as w, hasInjectionContext as le, inject as we, toRefs as be, customRef as ye, shallowRef as y, computed as P, reactive as Z, unref as Oe, watchEffect as se, ref as Se, readonly as Te } from "vue";
2
+ function z(e) {
3
+ return me() ? (ge(e), !0) : !1;
4
4
  }
5
- const H = /* @__PURE__ */ new WeakMap(), pe = (...e) => {
5
+ // @__NO_SIDE_EFFECTS__
6
+ function ee() {
7
+ const e = /* @__PURE__ */ new Set(), t = (i) => {
8
+ e.delete(i);
9
+ };
10
+ return {
11
+ on: (i) => {
12
+ e.add(i);
13
+ const a = () => t(i);
14
+ return z(a), {
15
+ off: a
16
+ };
17
+ },
18
+ off: t,
19
+ trigger: (...i) => Promise.all(Array.from(e).map((a) => a(...i))),
20
+ clear: () => {
21
+ e.clear();
22
+ }
23
+ };
24
+ }
25
+ const B = /* @__PURE__ */ new WeakMap(), Ee = /* @__NO_SIDE_EFFECTS__ */ (...e) => {
6
26
  var t;
7
- const o = e[0], n = (t = B()) == null ? void 0 : t.proxy;
8
- if (n == null && !oe())
27
+ const o = e[0], n = (t = j()) == null ? void 0 : t.proxy;
28
+ if (n == null && !le())
9
29
  throw new Error("injectLocal must be called in setup");
10
- return n && H.has(n) && o in H.get(n) ? H.get(n)[o] : ve(...e);
11
- }, ie = typeof window < "u" && typeof document < "u";
30
+ return n && B.has(n) && o in B.get(n) ? B.get(n)[o] : we(...e);
31
+ }, $ = typeof window < "u" && typeof document < "u";
12
32
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
13
- const be = (e) => e != null, we = Object.prototype.toString, ge = (e) => we.call(e) === "[object Object]", M = () => {
14
- }, ye = /* @__PURE__ */ Se();
15
- function Se() {
33
+ const xe = (e) => e != null, We = Object.prototype.toString, Me = (e) => We.call(e) === "[object Object]", W = () => {
34
+ }, Ie = (e, t) => Object.prototype.hasOwnProperty.call(e, t), Pe = /* @__PURE__ */ Ae();
35
+ function Ae() {
16
36
  var e, t;
17
- return ie && ((e = window == null ? void 0 : window.navigator) == null ? void 0 : e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window == null ? void 0 : window.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
37
+ return $ && ((e = window == null ? void 0 : window.navigator) == null ? void 0 : e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window == null ? void 0 : window.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
18
38
  }
19
- function $(e, t) {
39
+ function Y(e, t) {
20
40
  function o(...n) {
21
- return new Promise((f, a) => {
22
- Promise.resolve(e(() => t.apply(this, n), { fn: t, thisArg: this, args: n })).then(f).catch(a);
41
+ return new Promise((u, i) => {
42
+ Promise.resolve(e(() => t.apply(this, n), { fn: t, thisArg: this, args: n })).then(u).catch(i);
23
43
  });
24
44
  }
25
45
  return o;
26
46
  }
27
- const Ee = (e) => e();
28
- function re(e, t = {}) {
29
- let o, n, f = M;
30
- const a = (r) => {
31
- clearTimeout(r), f(), f = M;
47
+ const Fe = (e) => e();
48
+ function ue(e, t = {}) {
49
+ let o, n, u = W;
50
+ const i = (s) => {
51
+ clearTimeout(s), u(), u = W;
32
52
  };
33
- let d;
34
- return (r) => {
35
- const c = g(e), u = g(t.maxWait);
36
- return o && a(o), c <= 0 || u !== void 0 && u <= 0 ? (n && (a(n), n = void 0), Promise.resolve(r())) : new Promise((s, v) => {
37
- f = t.rejectOnCancel ? v : s, d = r, u && !n && (n = setTimeout(() => {
38
- o && a(o), n = void 0, s(d());
39
- }, u)), o = setTimeout(() => {
40
- n && a(n), n = void 0, s(r());
41
- }, c);
53
+ let a;
54
+ return (s) => {
55
+ const d = w(e), v = w(t.maxWait);
56
+ return o && i(o), d <= 0 || v !== void 0 && v <= 0 ? (n && (i(n), n = void 0), Promise.resolve(s())) : new Promise((l, c) => {
57
+ u = t.rejectOnCancel ? c : l, a = s, v && !n && (n = setTimeout(() => {
58
+ o && i(o), n = void 0, l(a());
59
+ }, v)), o = setTimeout(() => {
60
+ n && i(n), n = void 0, l(s());
61
+ }, d);
42
62
  });
43
63
  };
44
64
  }
45
- function Te(...e) {
46
- let t = 0, o, n = !0, f = M, a, d, i, r, c;
47
- !fe(e[0]) && typeof e[0] == "object" ? { delay: d, trailing: i = !0, leading: r = !0, rejectOnCancel: c = !1 } = e[0] : [d, i = !0, r = !0, c = !1] = e;
48
- const u = () => {
49
- o && (clearTimeout(o), o = void 0, f(), f = M);
65
+ function ce(...e) {
66
+ let t = 0, o, n = !0, u = W, i, a, r, s, d;
67
+ !ie(e[0]) && typeof e[0] == "object" ? { delay: a, trailing: r = !0, leading: s = !0, rejectOnCancel: d = !1 } = e[0] : [a, r = !0, s = !0, d = !1] = e;
68
+ const v = () => {
69
+ o && (clearTimeout(o), o = void 0, u(), u = W);
50
70
  };
51
- return (v) => {
52
- const h = g(d), b = Date.now() - t, S = () => a = v();
53
- return u(), h <= 0 ? (t = Date.now(), S()) : (b > h && (r || !n) ? (t = Date.now(), S()) : i && (a = new Promise((l, m) => {
54
- f = c ? m : l, o = setTimeout(() => {
55
- t = Date.now(), n = !0, l(S()), u();
56
- }, Math.max(0, h - b));
57
- })), !r && !o && (o = setTimeout(() => n = !0, h)), n = !1, a);
71
+ return (c) => {
72
+ const p = w(a), h = Date.now() - t, O = () => i = c();
73
+ return v(), p <= 0 ? (t = Date.now(), O()) : (h > p && (s || !n) ? (t = Date.now(), O()) : r && (i = new Promise((f, m) => {
74
+ u = d ? m : f, o = setTimeout(() => {
75
+ t = Date.now(), n = !0, f(O()), v();
76
+ }, Math.max(0, p - h));
77
+ })), !s && !o && (o = setTimeout(() => n = !0, p)), n = !1, i);
58
78
  };
59
79
  }
60
- function Z(e) {
80
+ function te(e) {
61
81
  return e.endsWith("rem") ? Number.parseFloat(e) * 16 : Number.parseFloat(e);
62
82
  }
63
- function D(e) {
83
+ function _e(e, t, o = !1) {
84
+ return t.reduce((n, u) => (u in e && (!o || e[u] !== void 0) && (n[u] = e[u]), n), {});
85
+ }
86
+ function C(e) {
64
87
  return Array.isArray(e) ? e : [e];
65
88
  }
66
- function xe(e) {
67
- return B();
89
+ function Le(e) {
90
+ return j();
68
91
  }
69
- function We(e, t = 200, o = {}) {
70
- return $(
71
- re(t, o),
92
+ // @__NO_SIDE_EFFECTS__
93
+ function ke(e, t = 200, o = {}) {
94
+ return Y(
95
+ ue(t, o),
72
96
  e
73
97
  );
74
98
  }
75
- function Me(e, t = 200, o = !1, n = !0, f = !1) {
76
- return $(
77
- Te(t, o, n, f),
99
+ // @__NO_SIDE_EFFECTS__
100
+ function De(e, t = 200, o = !1, n = !0, u = !1) {
101
+ return Y(
102
+ ce(t, o, n, u),
78
103
  e
79
104
  );
80
105
  }
81
- function Oe(e, t, o = {}) {
106
+ function ae(e, t, o = {}) {
82
107
  const {
83
- eventFilter: n = Ee,
84
- ...f
108
+ eventFilter: n = Fe,
109
+ ...u
85
110
  } = o;
86
- return L(
111
+ return k(
87
112
  e,
88
- $(
113
+ Y(
89
114
  n,
90
115
  t
91
116
  ),
92
- f
117
+ u
93
118
  );
94
119
  }
95
- function z(e, t = !0, o) {
96
- xe() ? ne(e, o) : t ? e() : ce(e);
120
+ function Re(e, t = {}) {
121
+ if (!ie(e))
122
+ return be(e);
123
+ const o = Array.isArray(e.value) ? Array.from({ length: e.value.length }) : {};
124
+ for (const n in e.value)
125
+ o[n] = ye(() => ({
126
+ get() {
127
+ return e.value[n];
128
+ },
129
+ set(u) {
130
+ var i;
131
+ if ((i = w(t.replaceRef)) != null ? i : !0)
132
+ if (Array.isArray(e.value)) {
133
+ const r = [...e.value];
134
+ r[n] = u, e.value = r;
135
+ } else {
136
+ const r = { ...e.value, [n]: u };
137
+ Object.setPrototypeOf(r, Object.getPrototypeOf(e.value)), e.value = r;
138
+ }
139
+ else
140
+ e.value[n] = u;
141
+ }
142
+ }));
143
+ return o;
144
+ }
145
+ function N(e, t = !0, o) {
146
+ Le() ? re(e, o) : t ? e() : he(e);
97
147
  }
98
- function Le(e, t, o = {}) {
148
+ function Xe(e, t, o = {}) {
99
149
  const {
100
150
  debounce: n = 0,
101
- maxWait: f = void 0,
102
- ...a
151
+ maxWait: u = void 0,
152
+ ...i
103
153
  } = o;
104
- return Oe(
154
+ return ae(
105
155
  e,
106
156
  t,
107
157
  {
108
- ...a,
109
- eventFilter: re(n, { maxWait: f })
158
+ ...i,
159
+ eventFilter: ue(n, { maxWait: u })
110
160
  }
111
161
  );
112
162
  }
113
- function Ie(e, t, o) {
114
- return L(
163
+ function Ce(e, t, o) {
164
+ return k(
115
165
  e,
116
166
  t,
117
167
  {
@@ -120,433 +170,541 @@ function Ie(e, t, o) {
120
170
  }
121
171
  );
122
172
  }
123
- const P = ie ? window : void 0;
124
- function E(e) {
173
+ function Qe(e, t, o = {}) {
174
+ const {
175
+ throttle: n = 0,
176
+ trailing: u = !0,
177
+ leading: i = !0,
178
+ ...a
179
+ } = o;
180
+ return ae(
181
+ e,
182
+ t,
183
+ {
184
+ ...a,
185
+ eventFilter: ce(n, u, i)
186
+ }
187
+ );
188
+ }
189
+ const A = $ ? window : void 0, Ve = $ ? window.document : void 0;
190
+ function S(e) {
125
191
  var t;
126
- const o = g(e);
192
+ const o = w(e);
127
193
  return (t = o == null ? void 0 : o.$el) != null ? t : o;
128
194
  }
129
- function I(...e) {
195
+ function M(...e) {
130
196
  const t = [], o = () => {
131
- t.forEach((i) => i()), t.length = 0;
132
- }, n = (i, r, c, u) => (i.addEventListener(r, c, u), () => i.removeEventListener(r, c, u)), f = _(() => {
133
- const i = D(g(e[0])).filter((r) => r != null);
134
- return i.every((r) => typeof r != "string") ? i : void 0;
135
- }), a = Ie(
197
+ t.forEach((r) => r()), t.length = 0;
198
+ }, n = (r, s, d, v) => (r.addEventListener(s, d, v), () => r.removeEventListener(s, d, v)), u = P(() => {
199
+ const r = C(w(e[0])).filter((s) => s != null);
200
+ return r.every((s) => typeof s != "string") ? r : void 0;
201
+ }), i = Ce(
136
202
  () => {
137
- var i, r;
203
+ var r, s;
138
204
  return [
139
- (r = (i = f.value) == null ? void 0 : i.map((c) => E(c))) != null ? r : [P].filter((c) => c != null),
140
- D(g(f.value ? e[1] : e[0])),
141
- D(he(f.value ? e[2] : e[1])),
205
+ (s = (r = u.value) == null ? void 0 : r.map((d) => S(d))) != null ? s : [A].filter((d) => d != null),
206
+ C(w(u.value ? e[1] : e[0])),
207
+ C(Oe(u.value ? e[2] : e[1])),
142
208
  // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
143
- g(f.value ? e[3] : e[2])
209
+ w(u.value ? e[3] : e[2])
144
210
  ];
145
211
  },
146
- ([i, r, c, u]) => {
147
- if (o(), !(i != null && i.length) || !(r != null && r.length) || !(c != null && c.length))
212
+ ([r, s, d, v]) => {
213
+ if (o(), !(r != null && r.length) || !(s != null && s.length) || !(d != null && d.length))
148
214
  return;
149
- const s = ge(u) ? { ...u } : u;
215
+ const l = Me(v) ? { ...v } : v;
150
216
  t.push(
151
- ...i.flatMap(
152
- (v) => r.flatMap(
153
- (h) => c.map((b) => n(v, h, b, s))
217
+ ...r.flatMap(
218
+ (c) => s.flatMap(
219
+ (p) => d.map((h) => n(c, p, h, l))
154
220
  )
155
221
  )
156
222
  );
157
223
  },
158
224
  { flush: "post" }
159
- ), d = () => {
160
- a(), o();
225
+ ), a = () => {
226
+ i(), o();
161
227
  };
162
- return N(o), d;
228
+ return z(o), a;
163
229
  }
164
- let ee = !1;
165
- function Ce(e, t, o = {}) {
166
- const { window: n = P, ignore: f = [], capture: a = !0, detectIframe: d = !1, controls: i = !1 } = o;
230
+ let ne = !1;
231
+ function Ue(e, t, o = {}) {
232
+ const { window: n = A, ignore: u = [], capture: i = !0, detectIframe: a = !1, controls: r = !1 } = o;
167
233
  if (!n)
168
- return i ? { stop: M, cancel: M, trigger: M } : M;
169
- if (ye && !ee) {
170
- ee = !0;
171
- const l = { passive: !0 };
172
- Array.from(n.document.body.children).forEach((m) => m.addEventListener("click", M, l)), n.document.documentElement.addEventListener("click", M, l);
234
+ return r ? { stop: W, cancel: W, trigger: W } : W;
235
+ if (Pe && !ne) {
236
+ ne = !0;
237
+ const f = { passive: !0 };
238
+ Array.from(n.document.body.children).forEach((m) => m.addEventListener("click", W, f)), n.document.documentElement.addEventListener("click", W, f);
173
239
  }
174
- let r = !0;
175
- const c = (l) => g(f).some((m) => {
240
+ let s = !0;
241
+ const d = (f) => w(u).some((m) => {
176
242
  if (typeof m == "string")
177
- return Array.from(n.document.querySelectorAll(m)).some((w) => w === l.target || l.composedPath().includes(w));
243
+ return Array.from(n.document.querySelectorAll(m)).some((b) => b === f.target || f.composedPath().includes(b));
178
244
  {
179
- const w = E(m);
180
- return w && (l.target === w || l.composedPath().includes(w));
245
+ const b = S(m);
246
+ return b && (f.target === b || f.composedPath().includes(b));
181
247
  }
182
248
  });
183
- function u(l) {
184
- const m = g(l);
249
+ function v(f) {
250
+ const m = w(f);
185
251
  return m && m.$.subTree.shapeFlag === 16;
186
252
  }
187
- function s(l, m) {
188
- const w = g(l), T = w.$.subTree && w.$.subTree.children;
189
- return T == null || !Array.isArray(T) ? !1 : T.some((x) => x.el === m.target || m.composedPath().includes(x.el));
253
+ function l(f, m) {
254
+ const b = w(f), T = b.$.subTree && b.$.subTree.children;
255
+ return T == null || !Array.isArray(T) ? !1 : T.some((E) => E.el === m.target || m.composedPath().includes(E.el));
190
256
  }
191
- const v = (l) => {
192
- const m = E(e);
193
- if (l.target != null && !(!(m instanceof Element) && u(e) && s(e, l)) && !(!m || m === l.target || l.composedPath().includes(m))) {
194
- if ("detail" in l && l.detail === 0 && (r = !c(l)), !r) {
195
- r = !0;
257
+ const c = (f) => {
258
+ const m = S(e);
259
+ if (f.target != null && !(!(m instanceof Element) && v(e) && l(e, f)) && !(!m || m === f.target || f.composedPath().includes(m))) {
260
+ if ("detail" in f && f.detail === 0 && (s = !d(f)), !s) {
261
+ s = !0;
196
262
  return;
197
263
  }
198
- t(l);
264
+ t(f);
199
265
  }
200
266
  };
201
- let h = !1;
202
- const b = [
203
- I(n, "click", (l) => {
204
- h || (h = !0, setTimeout(() => {
205
- h = !1;
206
- }, 0), v(l));
207
- }, { passive: !0, capture: a }),
208
- I(n, "pointerdown", (l) => {
209
- const m = E(e);
210
- r = !c(l) && !!(m && !l.composedPath().includes(m));
267
+ let p = !1;
268
+ const h = [
269
+ M(n, "click", (f) => {
270
+ p || (p = !0, setTimeout(() => {
271
+ p = !1;
272
+ }, 0), c(f));
273
+ }, { passive: !0, capture: i }),
274
+ M(n, "pointerdown", (f) => {
275
+ const m = S(e);
276
+ s = !d(f) && !!(m && !f.composedPath().includes(m));
211
277
  }, { passive: !0 }),
212
- d && I(n, "blur", (l) => {
278
+ a && M(n, "blur", (f) => {
213
279
  setTimeout(() => {
214
280
  var m;
215
- const w = E(e);
216
- ((m = n.document.activeElement) == null ? void 0 : m.tagName) === "IFRAME" && !(w != null && w.contains(n.document.activeElement)) && t(l);
281
+ const b = S(e);
282
+ ((m = n.document.activeElement) == null ? void 0 : m.tagName) === "IFRAME" && !(b != null && b.contains(n.document.activeElement)) && t(f);
217
283
  }, 0);
218
284
  }, { passive: !0 })
219
- ].filter(Boolean), S = () => b.forEach((l) => l());
220
- return i ? {
221
- stop: S,
285
+ ].filter(Boolean), O = () => h.forEach((f) => f());
286
+ return r ? {
287
+ stop: O,
222
288
  cancel: () => {
223
- r = !1;
289
+ s = !1;
224
290
  },
225
- trigger: (l) => {
226
- r = !0, v(l), r = !1;
291
+ trigger: (f) => {
292
+ s = !0, c(f), s = !1;
227
293
  }
228
- } : S;
294
+ } : O;
229
295
  }
230
- function Re() {
231
- const e = y(!1), t = B();
232
- return t && ne(() => {
296
+ // @__NO_SIDE_EFFECTS__
297
+ function He() {
298
+ const e = y(!1), t = j();
299
+ return t && re(() => {
233
300
  e.value = !0;
234
301
  }, t), e;
235
302
  }
303
+ // @__NO_SIDE_EFFECTS__
236
304
  function G(e) {
237
- const t = Re();
238
- return _(() => (t.value, !!e()));
305
+ const t = /* @__PURE__ */ He();
306
+ return P(() => (t.value, !!e()));
239
307
  }
240
- function se(e, t, o = {}) {
241
- const { window: n = P, ...f } = o;
242
- let a;
243
- const d = G(() => n && "MutationObserver" in n), i = () => {
244
- a && (a.disconnect(), a = void 0);
245
- }, r = _(() => {
246
- const v = g(e), h = D(v).map(E).filter(be);
247
- return new Set(h);
248
- }), c = L(
249
- () => r.value,
250
- (v) => {
251
- i(), d.value && v.size && (a = new MutationObserver(t), v.forEach((h) => a.observe(h, f)));
308
+ function fe(e, t, o = {}) {
309
+ const { window: n = A, ...u } = o;
310
+ let i;
311
+ const a = /* @__PURE__ */ G(() => n && "MutationObserver" in n), r = () => {
312
+ i && (i.disconnect(), i = void 0);
313
+ }, s = P(() => {
314
+ const c = w(e), p = C(c).map(S).filter(xe);
315
+ return new Set(p);
316
+ }), d = k(
317
+ s,
318
+ (c) => {
319
+ r(), a.value && c.size && (i = new MutationObserver(t), c.forEach((p) => i.observe(p, u)));
252
320
  },
253
321
  { immediate: !0, flush: "post" }
254
- ), u = () => a == null ? void 0 : a.takeRecords(), s = () => {
255
- c(), i();
322
+ ), v = () => i == null ? void 0 : i.takeRecords(), l = () => {
323
+ d(), r();
256
324
  };
257
- return N(s), {
258
- isSupported: d,
259
- stop: s,
260
- takeRecords: u
325
+ return z(l), {
326
+ isSupported: a,
327
+ stop: l,
328
+ takeRecords: v
261
329
  };
262
330
  }
263
- const _e = Symbol("vueuse-ssr-width");
264
- function Pe() {
265
- const e = oe() ? pe(_e, null) : null;
331
+ const ze = Symbol("vueuse-ssr-width");
332
+ // @__NO_SIDE_EFFECTS__
333
+ function Ne() {
334
+ const e = le() ? /* @__PURE__ */ Ee(ze, null) : null;
266
335
  return typeof e == "number" ? e : void 0;
267
336
  }
268
- function Ae(e, t = {}) {
269
- const { window: o = P, ssrWidth: n = Pe() } = t, f = G(() => o && "matchMedia" in o && typeof o.matchMedia == "function"), a = y(typeof n == "number"), d = y(), i = y(!1), r = (c) => {
270
- i.value = c.matches;
337
+ function Be(e, t = {}) {
338
+ const { window: o = A, ssrWidth: n = /* @__PURE__ */ Ne() } = t, u = /* @__PURE__ */ G(() => o && "matchMedia" in o && typeof o.matchMedia == "function"), i = y(typeof n == "number"), a = y(), r = y(!1), s = (d) => {
339
+ r.value = d.matches;
271
340
  };
272
- return me(() => {
273
- if (a.value) {
274
- a.value = !f.value;
275
- const c = g(e).split(",");
276
- i.value = c.some((u) => {
277
- const s = u.includes("not all"), v = u.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), h = u.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
278
- let b = !!(v || h);
279
- return v && b && (b = n >= Z(v[1])), h && b && (b = n <= Z(h[1])), s ? !b : b;
341
+ return se(() => {
342
+ if (i.value) {
343
+ i.value = !u.value;
344
+ const d = w(e).split(",");
345
+ r.value = d.some((v) => {
346
+ const l = v.includes("not all"), c = v.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), p = v.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
347
+ let h = !!(c || p);
348
+ return c && h && (h = n >= te(c[1])), p && h && (h = n <= te(p[1])), l ? !h : h;
280
349
  });
281
350
  return;
282
351
  }
283
- f.value && (d.value = o.matchMedia(g(e)), i.value = d.value.matches);
284
- }), I(d, "change", r, { passive: !0 }), _(() => i.value);
352
+ u.value && (a.value = o.matchMedia(w(e)), r.value = a.value.matches);
353
+ }), M(a, "change", s, { passive: !0 }), P(() => r.value);
285
354
  }
286
- function le(e, t, o = {}) {
287
- const { window: n = P, ...f } = o;
288
- let a;
289
- const d = G(() => n && "ResizeObserver" in n), i = () => {
290
- a && (a.disconnect(), a = void 0);
291
- }, r = _(() => {
292
- const s = g(e);
293
- return Array.isArray(s) ? s.map((v) => E(v)) : [E(s)];
294
- }), c = L(
295
- r,
296
- (s) => {
297
- if (i(), d.value && n) {
298
- a = new ResizeObserver(t);
299
- for (const v of s)
300
- v && a.observe(v, f);
355
+ function de(e, t, o = {}) {
356
+ const { window: n = A, ...u } = o;
357
+ let i;
358
+ const a = /* @__PURE__ */ G(() => n && "ResizeObserver" in n), r = () => {
359
+ i && (i.disconnect(), i = void 0);
360
+ }, s = P(() => {
361
+ const l = w(e);
362
+ return Array.isArray(l) ? l.map((c) => S(c)) : [S(l)];
363
+ }), d = k(
364
+ s,
365
+ (l) => {
366
+ if (r(), a.value && n) {
367
+ i = new ResizeObserver(t);
368
+ for (const c of l)
369
+ c && i.observe(c, u);
301
370
  }
302
371
  },
303
372
  { immediate: !0, flush: "post" }
304
- ), u = () => {
305
- i(), c();
373
+ ), v = () => {
374
+ r(), d();
306
375
  };
307
- return N(u), {
308
- isSupported: d,
309
- stop: u
376
+ return z(v), {
377
+ isSupported: a,
378
+ stop: v
310
379
  };
311
380
  }
312
- function ke(e, t = {}) {
381
+ function qe(e, t = {}) {
313
382
  const {
314
383
  reset: o = !0,
315
384
  windowResize: n = !0,
316
- windowScroll: f = !0,
317
- immediate: a = !0,
318
- updateTiming: d = "sync"
319
- } = t, i = y(0), r = y(0), c = y(0), u = y(0), s = y(0), v = y(0), h = y(0), b = y(0);
320
- function S() {
321
- const m = E(e);
385
+ windowScroll: u = !0,
386
+ immediate: i = !0,
387
+ updateTiming: a = "sync"
388
+ } = t, r = y(0), s = y(0), d = y(0), v = y(0), l = y(0), c = y(0), p = y(0), h = y(0);
389
+ function O() {
390
+ const m = S(e);
322
391
  if (!m) {
323
- o && (i.value = 0, r.value = 0, c.value = 0, u.value = 0, s.value = 0, v.value = 0, h.value = 0, b.value = 0);
392
+ o && (r.value = 0, s.value = 0, d.value = 0, v.value = 0, l.value = 0, c.value = 0, p.value = 0, h.value = 0);
324
393
  return;
325
394
  }
326
- const w = m.getBoundingClientRect();
327
- i.value = w.height, r.value = w.bottom, c.value = w.left, u.value = w.right, s.value = w.top, v.value = w.width, h.value = w.x, b.value = w.y;
395
+ const b = m.getBoundingClientRect();
396
+ r.value = b.height, s.value = b.bottom, d.value = b.left, v.value = b.right, l.value = b.top, c.value = b.width, p.value = b.x, h.value = b.y;
328
397
  }
329
- function l() {
330
- d === "sync" ? S() : d === "next-frame" && requestAnimationFrame(() => S());
398
+ function f() {
399
+ a === "sync" ? O() : a === "next-frame" && requestAnimationFrame(() => O());
331
400
  }
332
- return le(e, l), L(() => E(e), (m) => !m && l()), se(e, l, {
401
+ return de(e, f), k(() => S(e), (m) => !m && f()), fe(e, f, {
333
402
  attributeFilter: ["style", "class"]
334
- }), f && I("scroll", l, { capture: !0, passive: !0 }), n && I("resize", l, { passive: !0 }), z(() => {
335
- a && l();
403
+ }), u && M("scroll", f, { capture: !0, passive: !0 }), n && M("resize", f, { passive: !0 }), N(() => {
404
+ i && f();
336
405
  }), {
337
- height: i,
338
- bottom: r,
339
- left: c,
340
- right: u,
341
- top: s,
342
- width: v,
343
- x: h,
344
- y: b,
345
- update: l
406
+ height: r,
407
+ bottom: s,
408
+ left: d,
409
+ right: v,
410
+ top: l,
411
+ width: c,
412
+ x: p,
413
+ y: h,
414
+ update: f
346
415
  };
347
416
  }
348
- function De(e, t = { width: 0, height: 0 }, o = {}) {
349
- const { window: n = P, box: f = "content-box" } = o, a = _(() => {
350
- var s, v;
351
- return (v = (s = E(e)) == null ? void 0 : s.namespaceURI) == null ? void 0 : v.includes("svg");
352
- }), d = y(t.width), i = y(t.height), { stop: r } = le(
417
+ function Je(e, t = { width: 0, height: 0 }, o = {}) {
418
+ const { window: n = A, box: u = "content-box" } = o, i = P(() => {
419
+ var l, c;
420
+ return (c = (l = S(e)) == null ? void 0 : l.namespaceURI) == null ? void 0 : c.includes("svg");
421
+ }), a = y(t.width), r = y(t.height), { stop: s } = de(
353
422
  e,
354
- ([s]) => {
355
- const v = f === "border-box" ? s.borderBoxSize : f === "content-box" ? s.contentBoxSize : s.devicePixelContentBoxSize;
356
- if (n && a.value) {
357
- const h = E(e);
358
- if (h) {
359
- const b = h.getBoundingClientRect();
360
- d.value = b.width, i.value = b.height;
423
+ ([l]) => {
424
+ const c = u === "border-box" ? l.borderBoxSize : u === "content-box" ? l.contentBoxSize : l.devicePixelContentBoxSize;
425
+ if (n && i.value) {
426
+ const p = S(e);
427
+ if (p) {
428
+ const h = p.getBoundingClientRect();
429
+ a.value = h.width, r.value = h.height;
361
430
  }
362
- } else if (v) {
363
- const h = D(v);
364
- d.value = h.reduce((b, { inlineSize: S }) => b + S, 0), i.value = h.reduce((b, { blockSize: S }) => b + S, 0);
431
+ } else if (c) {
432
+ const p = C(c);
433
+ a.value = p.reduce((h, { inlineSize: O }) => h + O, 0), r.value = p.reduce((h, { blockSize: O }) => h + O, 0);
365
434
  } else
366
- d.value = s.contentRect.width, i.value = s.contentRect.height;
435
+ a.value = l.contentRect.width, r.value = l.contentRect.height;
367
436
  },
368
437
  o
369
438
  );
370
- z(() => {
371
- const s = E(e);
372
- s && (d.value = "offsetWidth" in s ? s.offsetWidth : t.width, i.value = "offsetHeight" in s ? s.offsetHeight : t.height);
439
+ N(() => {
440
+ const l = S(e);
441
+ l && (a.value = "offsetWidth" in l ? l.offsetWidth : t.width, r.value = "offsetHeight" in l ? l.offsetHeight : t.height);
373
442
  });
374
- const c = L(
375
- () => E(e),
376
- (s) => {
377
- d.value = s ? t.width : 0, i.value = s ? t.height : 0;
443
+ const d = k(
444
+ () => S(e),
445
+ (l) => {
446
+ a.value = l ? t.width : 0, r.value = l ? t.height : 0;
378
447
  }
379
448
  );
380
- function u() {
381
- r(), c();
449
+ function v() {
450
+ s(), d();
382
451
  }
383
452
  return {
384
- width: d,
385
- height: i,
386
- stop: u
453
+ width: a,
454
+ height: r,
455
+ stop: v
456
+ };
457
+ }
458
+ const je = {
459
+ multiple: !0,
460
+ accept: "*",
461
+ reset: !1,
462
+ directory: !1
463
+ };
464
+ function $e(e) {
465
+ if (!e)
466
+ return null;
467
+ if (e instanceof FileList)
468
+ return e;
469
+ const t = new DataTransfer();
470
+ for (const o of e)
471
+ t.items.add(o);
472
+ return t.files;
473
+ }
474
+ function Ke(e = {}) {
475
+ const {
476
+ document: t = Ve
477
+ } = e, o = Se($e(e.initialFiles)), { on: n, trigger: u } = /* @__PURE__ */ ee(), { on: i, trigger: a } = /* @__PURE__ */ ee(), r = P(() => {
478
+ var l;
479
+ const c = (l = S(e.input)) != null ? l : t ? t.createElement("input") : void 0;
480
+ return c && (c.type = "file", c.onchange = (p) => {
481
+ const h = p.target;
482
+ o.value = h.files, u(o.value);
483
+ }, c.oncancel = () => {
484
+ a();
485
+ }), c;
486
+ }), s = () => {
487
+ o.value = null, r.value && r.value.value && (r.value.value = "", u(null));
488
+ }, d = (l) => {
489
+ const c = r.value;
490
+ c && (c.multiple = w(l.multiple), c.accept = w(l.accept), c.webkitdirectory = w(l.directory), Ie(l, "capture") && (c.capture = w(l.capture)));
491
+ }, v = (l) => {
492
+ const c = r.value;
493
+ if (!c)
494
+ return;
495
+ const p = {
496
+ ...je,
497
+ ...e,
498
+ ...l
499
+ };
500
+ d(p), w(p.reset) && s(), c.click();
501
+ };
502
+ return se(() => {
503
+ d(e);
504
+ }), {
505
+ files: Te(o),
506
+ open: v,
507
+ reset: s,
508
+ onCancel: i,
509
+ onChange: n
387
510
  };
388
511
  }
389
- const te = 1;
390
- function je(e, t = {}) {
512
+ const oe = 1;
513
+ function Ze(e, t = {}) {
391
514
  const {
392
515
  throttle: o = 0,
393
516
  idle: n = 200,
394
- onStop: f = M,
395
- onScroll: a = M,
396
- offset: d = {
517
+ onStop: u = W,
518
+ onScroll: i = W,
519
+ offset: a = {
397
520
  left: 0,
398
521
  right: 0,
399
522
  top: 0,
400
523
  bottom: 0
401
524
  },
402
- observe: i = {
525
+ observe: r = {
403
526
  mutation: !1
404
527
  },
405
- eventListenerOptions: r = {
528
+ eventListenerOptions: s = {
406
529
  capture: !1,
407
530
  passive: !0
408
531
  },
409
- behavior: c = "auto",
410
- window: u = P,
411
- onError: s = (p) => {
412
- console.error(p);
532
+ behavior: d = "auto",
533
+ window: v = A,
534
+ onError: l = (g) => {
535
+ console.error(g);
413
536
  }
414
- } = t, v = typeof i == "boolean" ? {
415
- mutation: i
416
- } : i, h = y(0), b = y(0), S = _({
537
+ } = t, c = typeof r == "boolean" ? {
538
+ mutation: r
539
+ } : r, p = y(0), h = y(0), O = P({
417
540
  get() {
418
- return h.value;
541
+ return p.value;
419
542
  },
420
- set(p) {
421
- m(p, void 0);
543
+ set(g) {
544
+ m(g, void 0);
422
545
  }
423
- }), l = _({
546
+ }), f = P({
424
547
  get() {
425
- return b.value;
548
+ return h.value;
426
549
  },
427
- set(p) {
428
- m(void 0, p);
550
+ set(g) {
551
+ m(void 0, g);
429
552
  }
430
553
  });
431
- function m(p, A) {
432
- var W, C, k, V;
433
- if (!u)
554
+ function m(g, _) {
555
+ var x, D, R, H;
556
+ if (!v)
434
557
  return;
435
- const O = g(e);
436
- if (!O)
558
+ const I = w(e);
559
+ if (!I)
437
560
  return;
438
- (k = O instanceof Document ? u.document.body : O) == null || k.scrollTo({
439
- top: (W = g(A)) != null ? W : l.value,
440
- left: (C = g(p)) != null ? C : S.value,
441
- behavior: g(c)
561
+ (R = I instanceof Document ? v.document.body : I) == null || R.scrollTo({
562
+ top: (x = w(_)) != null ? x : f.value,
563
+ left: (D = w(g)) != null ? D : O.value,
564
+ behavior: w(d)
442
565
  });
443
- const R = ((V = O == null ? void 0 : O.document) == null ? void 0 : V.documentElement) || (O == null ? void 0 : O.documentElement) || O;
444
- S != null && (h.value = R.scrollLeft), l != null && (b.value = R.scrollTop);
566
+ const F = ((H = I == null ? void 0 : I.document) == null ? void 0 : H.documentElement) || (I == null ? void 0 : I.documentElement) || I;
567
+ O != null && (p.value = F.scrollLeft), f != null && (h.value = F.scrollTop);
445
568
  }
446
- const w = y(!1), T = K({
569
+ const b = y(!1), T = Z({
447
570
  left: !0,
448
571
  right: !1,
449
572
  top: !0,
450
573
  bottom: !1
451
- }), x = K({
574
+ }), E = Z({
452
575
  left: !1,
453
576
  right: !1,
454
577
  top: !1,
455
578
  bottom: !1
456
- }), Y = (p) => {
457
- w.value && (w.value = !1, x.left = !1, x.right = !1, x.top = !1, x.bottom = !1, f(p));
458
- }, ue = We(Y, o + n), j = (p) => {
459
- var A;
460
- if (!u)
579
+ }), X = (g) => {
580
+ b.value && (b.value = !1, E.left = !1, E.right = !1, E.top = !1, E.bottom = !1, u(g));
581
+ }, pe = /* @__PURE__ */ ke(X, o + n), V = (g) => {
582
+ var _;
583
+ if (!v)
461
584
  return;
462
- const W = ((A = p == null ? void 0 : p.document) == null ? void 0 : A.documentElement) || (p == null ? void 0 : p.documentElement) || E(p), { display: C, flexDirection: k, direction: V } = getComputedStyle(W), O = V === "rtl" ? -1 : 1, R = W.scrollLeft;
463
- x.left = R < h.value, x.right = R > h.value;
464
- const X = Math.abs(R * O) <= (d.left || 0), U = Math.abs(R * O) + W.clientWidth >= W.scrollWidth - (d.right || 0) - te;
465
- C === "flex" && k === "row-reverse" ? (T.left = U, T.right = X) : (T.left = X, T.right = U), h.value = R;
466
- let F = W.scrollTop;
467
- p === u.document && !F && (F = u.document.body.scrollTop), x.top = F < b.value, x.bottom = F > b.value;
468
- const q = Math.abs(F) <= (d.top || 0), J = Math.abs(F) + W.clientHeight >= W.scrollHeight - (d.bottom || 0) - te;
469
- C === "flex" && k === "column-reverse" ? (T.top = J, T.bottom = q) : (T.top = q, T.bottom = J), b.value = F;
470
- }, Q = (p) => {
471
- var A;
472
- if (!u)
585
+ const x = ((_ = g == null ? void 0 : g.document) == null ? void 0 : _.documentElement) || (g == null ? void 0 : g.documentElement) || S(g), { display: D, flexDirection: R, direction: H } = getComputedStyle(x), I = H === "rtl" ? -1 : 1, F = x.scrollLeft;
586
+ E.left = F < p.value, E.right = F > p.value;
587
+ const U = Math.abs(F * I) <= (a.left || 0), q = Math.abs(F * I) + x.clientWidth >= x.scrollWidth - (a.right || 0) - oe;
588
+ D === "flex" && R === "row-reverse" ? (T.left = q, T.right = U) : (T.left = U, T.right = q), p.value = F;
589
+ let L = x.scrollTop;
590
+ g === v.document && !L && (L = v.document.body.scrollTop), E.top = L < h.value, E.bottom = L > h.value;
591
+ const J = Math.abs(L) <= (a.top || 0), K = Math.abs(L) + x.clientHeight >= x.scrollHeight - (a.bottom || 0) - oe;
592
+ D === "flex" && R === "column-reverse" ? (T.top = K, T.bottom = J) : (T.top = J, T.bottom = K), h.value = L;
593
+ }, Q = (g) => {
594
+ var _;
595
+ if (!v)
473
596
  return;
474
- const W = (A = p.target.documentElement) != null ? A : p.target;
475
- j(W), w.value = !0, ue(p), a(p);
597
+ const x = (_ = g.target.documentElement) != null ? _ : g.target;
598
+ V(x), b.value = !0, pe(g), i(g);
476
599
  };
477
- return I(
600
+ return M(
478
601
  e,
479
602
  "scroll",
480
- o ? Me(Q, o, !0, !1) : Q,
481
- r
482
- ), z(() => {
603
+ o ? /* @__PURE__ */ De(Q, o, !0, !1) : Q,
604
+ s
605
+ ), N(() => {
483
606
  try {
484
- const p = g(e);
485
- if (!p)
607
+ const g = w(e);
608
+ if (!g)
486
609
  return;
487
- j(p);
488
- } catch (p) {
489
- s(p);
610
+ V(g);
611
+ } catch (g) {
612
+ l(g);
490
613
  }
491
- }), v != null && v.mutation && e != null && e !== u && e !== document && se(
614
+ }), c != null && c.mutation && e != null && e !== v && e !== document && fe(
492
615
  e,
493
616
  () => {
494
- const p = g(e);
495
- p && j(p);
617
+ const g = w(e);
618
+ g && V(g);
496
619
  },
497
620
  {
498
621
  attributes: !0,
499
622
  childList: !0,
500
623
  subtree: !0
501
624
  }
502
- ), I(
625
+ ), M(
503
626
  e,
504
627
  "scrollend",
505
- Y,
506
- r
628
+ X,
629
+ s
507
630
  ), {
508
- x: S,
509
- y: l,
510
- isScrolling: w,
631
+ x: O,
632
+ y: f,
633
+ isScrolling: b,
511
634
  arrivedState: T,
512
- directions: x,
635
+ directions: E,
513
636
  measure() {
514
- const p = g(e);
515
- u && p && j(p);
637
+ const g = w(e);
638
+ v && g && V(g);
516
639
  }
517
640
  };
518
641
  }
519
- function Ve(e = {}) {
642
+ const ve = {
643
+ x: 0,
644
+ y: 0,
645
+ pointerId: 0,
646
+ pressure: 0,
647
+ tiltX: 0,
648
+ tiltY: 0,
649
+ width: 0,
650
+ height: 0,
651
+ twist: 0,
652
+ pointerType: null
653
+ }, Ye = /* @__PURE__ */ Object.keys(ve);
654
+ function et(e = {}) {
655
+ const {
656
+ target: t = A
657
+ } = e, o = y(!1), n = y(e.initialValue || {});
658
+ Object.assign(n.value, ve, n.value);
659
+ const u = (i) => {
660
+ o.value = !0, !(e.pointerTypes && !e.pointerTypes.includes(i.pointerType)) && (n.value = _e(i, Ye, !1));
661
+ };
662
+ if (t) {
663
+ const i = { passive: !0 };
664
+ M(t, ["pointerdown", "pointermove", "pointerup"], u, i), M(t, "pointerleave", () => o.value = !1, i);
665
+ }
666
+ return {
667
+ ...Re(n),
668
+ isInside: o
669
+ };
670
+ }
671
+ // @__NO_SIDE_EFFECTS__
672
+ function tt(e = {}) {
520
673
  const {
521
- window: t = P,
674
+ window: t = A,
522
675
  initialWidth: o = Number.POSITIVE_INFINITY,
523
676
  initialHeight: n = Number.POSITIVE_INFINITY,
524
- listenOrientation: f = !0,
525
- includeScrollbar: a = !0,
526
- type: d = "inner"
527
- } = e, i = y(o), r = y(n), c = () => {
677
+ listenOrientation: u = !0,
678
+ includeScrollbar: i = !0,
679
+ type: a = "inner"
680
+ } = e, r = y(o), s = y(n), d = () => {
528
681
  if (t)
529
- if (d === "outer")
530
- i.value = t.outerWidth, r.value = t.outerHeight;
531
- else if (d === "visual" && t.visualViewport) {
532
- const { width: s, height: v, scale: h } = t.visualViewport;
533
- i.value = Math.round(s * h), r.value = Math.round(v * h);
534
- } else a ? (i.value = t.innerWidth, r.value = t.innerHeight) : (i.value = t.document.documentElement.clientWidth, r.value = t.document.documentElement.clientHeight);
682
+ if (a === "outer")
683
+ r.value = t.outerWidth, s.value = t.outerHeight;
684
+ else if (a === "visual" && t.visualViewport) {
685
+ const { width: l, height: c, scale: p } = t.visualViewport;
686
+ r.value = Math.round(l * p), s.value = Math.round(c * p);
687
+ } else i ? (r.value = t.innerWidth, s.value = t.innerHeight) : (r.value = t.document.documentElement.clientWidth, s.value = t.document.documentElement.clientHeight);
535
688
  };
536
- c(), z(c);
537
- const u = { passive: !0 };
538
- if (I("resize", c, u), t && d === "visual" && t.visualViewport && I(t.visualViewport, "resize", c, u), f) {
539
- const s = Ae("(orientation: portrait)");
540
- L(s, () => c());
689
+ d(), N(d);
690
+ const v = { passive: !0 };
691
+ if (M("resize", d, v), t && a === "visual" && t.visualViewport && M(t.visualViewport, "resize", d, v), u) {
692
+ const l = Be("(orientation: portrait)");
693
+ k(l, () => d());
541
694
  }
542
- return { width: i, height: r };
695
+ return { width: r, height: s };
543
696
  }
544
697
  export {
545
- Ve as a,
546
- De as b,
547
- ke as c,
548
- Ae as d,
549
- Ce as o,
550
- je as u,
551
- Le as w
698
+ qe as a,
699
+ S as b,
700
+ tt as c,
701
+ Ke as d,
702
+ Je as e,
703
+ Xe as f,
704
+ M as g,
705
+ Be as h,
706
+ et as i,
707
+ Ue as o,
708
+ Ze as u,
709
+ Qe as w
552
710
  };