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

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