gesturx 1.8.1 → 1.8.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/index.js CHANGED
@@ -1,28 +1,28 @@
1
- var se = Object.defineProperty;
2
- var pe = (t, n, e) => n in t ? se(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
- var $ = (t, n, e) => pe(t, typeof n != "symbol" ? n + "" : n, e);
4
- import { filter as h, fromEvent as I, mergeMap as S, defer as oe, of as T, merge as y, takeWhile as V, scan as U, map as c, BehaviorSubject as q, switchMap as g, distinctUntilChanged as re, startWith as H, shareReplay as M, combineLatest as W, exhaustMap as J, first as F, share as P, timer as K, withLatestFrom as L, takeUntil as b, skip as ae, tap as Q, ignoreElements as le, buffer as he, debounceTime as ce, pairwise as $e } from "rxjs";
5
- function ue(t, n) {
1
+ var ie = Object.defineProperty;
2
+ var se = (t, n, e) => n in t ? ie(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
+ var u = (t, n, e) => se(t, typeof n != "symbol" ? n + "" : n, e);
4
+ import { filter as c, fromEvent as T, mergeMap as b, defer as pe, of as S, merge as v, takeWhile as V, scan as U, map as h, BehaviorSubject as q, switchMap as f, distinctUntilChanged as oe, startWith as re, shareReplay as E, combineLatest as j, exhaustMap as H, first as R, share as P, timer as J, withLatestFrom as z, takeUntil as I, skip as ae, tap as K, ignoreElements as le, buffer as he, debounceTime as ce, NEVER as $e, defaultIfEmpty as ue } from "rxjs";
5
+ function de(t, n) {
6
6
  return Math.sqrt(
7
7
  Math.pow(n.x - t.x, 2) + Math.pow(n.y - t.y, 2)
8
8
  );
9
9
  }
10
- function de(t) {
10
+ function ve(t) {
11
11
  const n = t.length;
12
12
  if (n < 2) return 0;
13
- const e = t.reduce((s, p, a) => s + t.slice(a + 1).reduce((o, r) => o + ue(p, r), 0), 0), i = n * (n - 1) / 2;
14
- return e / i;
13
+ const e = t.reduce((i, p, a) => i + t.slice(a + 1).reduce((o, r) => o + de(p, r), 0), 0), s = n * (n - 1) / 2;
14
+ return e / s;
15
15
  }
16
16
  function N(t, n) {
17
- const e = n.x - t.x, i = n.y - t.y;
18
- return Math.atan2(i, e);
17
+ const e = n.x - t.x, s = n.y - t.y;
18
+ return Math.atan2(s, e);
19
19
  }
20
- function ve(t, n) {
20
+ function ge(t, n) {
21
21
  return N(t, n) * (180 / Math.PI);
22
22
  }
23
- function R(t) {
23
+ function k(t) {
24
24
  const n = t.reduce(
25
- (i, s) => (i.x += s.x, i.y += s.y, i),
25
+ (s, i) => (s.x += i.x, s.y += i.y, s),
26
26
  { x: 0, y: 0 }
27
27
  ), e = t.length || 1;
28
28
  return {
@@ -30,87 +30,87 @@ function R(t) {
30
30
  y: n.y / e
31
31
  };
32
32
  }
33
- function ge(t, n) {
33
+ function ye(t, n) {
34
34
  if (t.length !== n.length)
35
35
  throw new Error("Initial and new points arrays must have the same length.");
36
- const e = R(t), i = R(n);
37
- let s = 0;
36
+ const e = k(t), s = k(n);
37
+ let i = 0;
38
38
  for (let o = 0; o < t.length; o++) {
39
39
  const r = N(
40
40
  e,
41
41
  t[o]
42
42
  );
43
- let u = N(
44
- i,
43
+ let $ = N(
44
+ s,
45
45
  n[o]
46
46
  ) - r;
47
- u > Math.PI ? u -= 2 * Math.PI : u < -Math.PI && (u += 2 * Math.PI), s += u;
47
+ $ > Math.PI ? $ -= 2 * Math.PI : $ < -Math.PI && ($ += 2 * Math.PI), i += $;
48
48
  }
49
- const p = s / t.length, a = p * (180 / Math.PI);
49
+ const p = i / t.length, a = p * (180 / Math.PI);
50
50
  return { radianDelta: p, degreesDelta: a };
51
51
  }
52
- function ye(t) {
52
+ function fe(t) {
53
53
  return t != null;
54
54
  }
55
- const me = (t) => t.length > 0, fe = (t) => t.pipe(h(me));
56
- function Z(t, n, e) {
57
- const i = R([t]), s = R([n]);
58
- return Math.abs(s.x - i.x) >= e || Math.abs(s.y - i.y) >= e;
55
+ const me = (t) => t.length > 0, Ae = (t) => t.pipe(c(me));
56
+ function Q(t, n, e) {
57
+ const s = k([t]), i = k([n]);
58
+ return Math.abs(i.x - s.x) >= e || Math.abs(i.y - s.y) >= e;
59
59
  }
60
- const Ae = (t, n, e) => {
61
- const i = t > 0 ? n / t : 0, s = t > 0 ? e / t : 0;
60
+ const De = (t, n, e) => {
61
+ const s = t > 0 ? n / t : 0, i = t > 0 ? e / t : 0;
62
62
  return {
63
- velocityX: i,
64
- velocityY: s
63
+ velocityX: s,
64
+ velocityY: i
65
65
  };
66
66
  };
67
- function X(t) {
67
+ function W(t) {
68
68
  return (n) => n.pipe(
69
- h((e) => e.pointerId === t.pointerId)
69
+ c((e) => e.pointerId === t.pointerId)
70
70
  );
71
71
  }
72
- const ee = (t) => t.type === "pointerleave" || t.type === "pointercancel" || t.type === "pointerup", De = ({
72
+ const Z = (t) => t.type === "pointerleave" || t.type === "pointercancel" || t.type === "pointerup", Pe = ({
73
73
  container: t,
74
74
  afterEventReceived: n = (e) => e
75
- }) => I(t, "pointerdown").pipe(
76
- c(n)
77
- ), te = ({
75
+ }) => T(t, "pointerdown").pipe(
76
+ h(n)
77
+ ), ee = ({
78
78
  pointerEvent$: t
79
79
  }) => (n) => {
80
80
  const e = t.pipe(
81
- h((r) => r.type === "pointerup")
82
- ), i = t.pipe(
83
- h((r) => r.type === "pointerleave")
81
+ c((r) => r.type === "pointerup")
84
82
  ), s = t.pipe(
85
- h((r) => r.type === "pointercancel")
83
+ c((r) => r.type === "pointerleave")
84
+ ), i = t.pipe(
85
+ c((r) => r.type === "pointercancel")
86
86
  ), p = t.pipe(
87
- h((r) => r.type === "pointermove")
88
- ), a = I(window, "contextmenu"), o = (r) => ["pointercancel", "pointerleave", "pointerup", "contextmenu"].includes(
87
+ c((r) => r.type === "pointermove")
88
+ ), a = T(window, "contextmenu"), o = (r) => ["pointercancel", "pointerleave", "pointerup", "contextmenu"].includes(
89
89
  r.type
90
90
  );
91
91
  return n.pipe(
92
- S((r) => {
93
- const l = oe(() => T(r));
94
- return y(
92
+ b((r) => {
93
+ const l = pe(() => S(r));
94
+ return v(
95
95
  l,
96
- y(
96
+ v(
97
97
  p,
98
- s,
99
98
  i,
99
+ s,
100
100
  e,
101
101
  a
102
102
  )
103
103
  ).pipe(
104
- X(r),
105
- V((f) => !o(f), !0)
104
+ W(r),
105
+ V((m) => !o(m), !0)
106
106
  );
107
107
  }),
108
108
  U((r, l) => {
109
109
  if (o(l)) {
110
- const { [l.pointerId]: u, ...f } = (r == null ? void 0 : r.pointers) ?? {};
110
+ const { [l.pointerId]: $, ...m } = (r == null ? void 0 : r.pointers) ?? {};
111
111
  return {
112
112
  event: l,
113
- pointers: f
113
+ pointers: m
114
114
  };
115
115
  }
116
116
  return {
@@ -121,261 +121,261 @@ const ee = (t) => t.type === "pointerleave" || t.type === "pointercancel" || t.t
121
121
  }
122
122
  };
123
123
  }, void 0),
124
- c(({ event: r, pointers: l }) => ({
124
+ h(({ event: r, pointers: l }) => ({
125
125
  event: r,
126
- pointers: Object.values(l).filter(ye)
126
+ pointers: Object.values(l).filter(fe)
127
127
  }))
128
128
  );
129
- }, _ = (t, n, e, i) => {
130
- const s = t.x - n.x + e, p = t.y - n.y + i;
129
+ }, _ = (t, n, e, s) => {
130
+ const i = t.x - n.x + e, p = t.y - n.y + s;
131
131
  return {
132
- deltaX: s,
132
+ deltaX: i,
133
133
  deltaY: p
134
134
  };
135
- }, ne = (t) => {
136
- const n = (e) => R(
135
+ }, te = (t) => {
136
+ const n = (e) => k(
137
137
  e.latestActivePointers.length ? e.latestActivePointers : [e.event]
138
138
  );
139
139
  return t.pipe(
140
- U((e, i) => {
141
- var m, D;
142
- const s = n(i), p = (e == null ? void 0 : e.center) ?? s, a = (e == null ? void 0 : e.deltaX) ?? 0, o = (e == null ? void 0 : e.deltaY) ?? 0, r = ((m = e == null ? void 0 : e.latestActivePointers) == null ? void 0 : m.length) ?? 1, l = ((D = i.latestActivePointers) == null ? void 0 : D.length) ?? 1, u = ["pointerdown", "pointercancel", "pointerleave", "pointerup"].includes(
143
- i.event.type
144
- ) && r !== l, f = l > 0, { deltaX: d, deltaY: E } = u && f ? _(s, s, a, o) : _(s, p, a, o), { degreesDelta: A } = r === l && r >= 2 && l >= 2 ? ge(
140
+ U((e, s) => {
141
+ var y, w;
142
+ const i = n(s), p = (e == null ? void 0 : e.center) ?? i, a = (e == null ? void 0 : e.deltaX) ?? 0, o = (e == null ? void 0 : e.deltaY) ?? 0, r = ((y = e == null ? void 0 : e.latestActivePointers) == null ? void 0 : y.length) ?? 1, l = ((w = s.latestActivePointers) == null ? void 0 : w.length) ?? 1, $ = ["pointerdown", "pointercancel", "pointerleave", "pointerup"].includes(
143
+ s.event.type
144
+ ) && r !== l, m = l > 0, { deltaX: g, deltaY: A } = $ && m ? _(i, i, a, o) : _(i, p, a, o), { degreesDelta: D } = r === l && r >= 2 && l >= 2 ? ye(
145
145
  (e == null ? void 0 : e.latestActivePointers) ?? [],
146
- i.latestActivePointers ?? []
146
+ s.latestActivePointers ?? []
147
147
  ) : { degreesDelta: 0 };
148
148
  return {
149
149
  startTime: (/* @__PURE__ */ new Date()).getTime(),
150
150
  ...e,
151
- ...i,
152
- center: s,
153
- deltaX: d,
154
- deltaY: E,
155
- deltaPointersAngle: A
151
+ ...s,
152
+ center: i,
153
+ deltaX: g,
154
+ deltaY: A,
155
+ deltaPointersAngle: D
156
156
  };
157
157
  }, void 0),
158
- c((e) => {
158
+ h((e) => {
159
159
  const {
160
- deltaX: i,
161
- deltaY: s,
160
+ deltaX: s,
161
+ deltaY: i,
162
162
  latestActivePointers: p,
163
163
  startTime: a,
164
164
  center: o,
165
165
  event: r,
166
166
  deltaPointersAngle: l
167
- } = e, u = p ?? [], d = Date.now() - a, { velocityX: E, velocityY: A } = Ae(d, i, s), m = de(p);
167
+ } = e, $ = p ?? [], g = Date.now() - a, { velocityX: A, velocityY: D } = De(g, s, i), y = ve(p);
168
168
  return {
169
- deltaX: i,
170
- deltaY: s,
171
- velocityX: E,
172
- velocityY: A,
173
- delay: d,
169
+ deltaX: s,
170
+ deltaY: i,
171
+ velocityX: A,
172
+ velocityY: D,
173
+ delay: g,
174
174
  center: o,
175
- pointers: u,
175
+ pointers: $,
176
176
  startTime: a,
177
177
  event: r,
178
178
  deltaPointersAngle: l,
179
- pointersAverageDistance: m
179
+ pointersAverageDistance: y
180
180
  };
181
181
  })
182
182
  );
183
183
  }, G = (t) => t.pipe(
184
- h(
184
+ c(
185
185
  (n) => !!n.container
186
186
  )
187
- ), ie = (t) => t.pipe(h(ee)), Pe = ({
187
+ ), ne = (t) => t.pipe(c(Z)), we = ({
188
188
  container: t,
189
189
  afterEventReceived: n = (e) => e
190
190
  }) => {
191
- const e = De({ afterEventReceived: n, container: t }), i = I(t, "pointerup").pipe(
192
- c(n)
193
- ), s = I(t, "pointermove").pipe(
194
- c(n)
195
- ), p = I(t, "pointerleave").pipe(
196
- c(n)
197
- ), a = I(
191
+ const e = Pe({ afterEventReceived: n, container: t }), s = T(t, "pointerup").pipe(
192
+ h(n)
193
+ ), i = T(t, "pointermove").pipe(
194
+ h(n)
195
+ ), p = T(t, "pointerleave").pipe(
196
+ h(n)
197
+ ), a = T(
198
198
  t,
199
199
  "pointercancel"
200
- ).pipe(c(n));
201
- return y(
200
+ ).pipe(h(n));
201
+ return v(
202
202
  e,
203
203
  a,
204
204
  p,
205
- i,
206
- s
205
+ s,
206
+ i
207
207
  );
208
208
  };
209
- class z {
209
+ class F {
210
210
  constructor(n, e) {
211
- $(this, "configSubject", new q({}));
212
- $(this, "pan$");
213
- $(this, "panStart$");
214
- $(this, "panMove$");
215
- $(this, "panEnd$");
216
- $(this, "pointerEvent$");
217
- $(this, "pointerDown$");
218
- $(this, "pointerUp$");
219
- $(this, "pointerCancel$");
220
- $(this, "pointerMove$");
221
- $(this, "pointerOff$");
222
- $(this, "state$");
223
- $(this, "config$", this.configSubject.pipe(G));
211
+ u(this, "configSubject", new q({}));
212
+ u(this, "pan$");
213
+ u(this, "panStart$");
214
+ u(this, "panMove$");
215
+ u(this, "panEnd$");
216
+ u(this, "pointerEvent$");
217
+ u(this, "pointerDown$");
218
+ u(this, "pointerUp$");
219
+ u(this, "pointerCancel$");
220
+ u(this, "pointerMove$");
221
+ u(this, "pointerOff$");
222
+ u(this, "state$");
223
+ u(this, "config$", this.configSubject.pipe(G));
224
224
  /**
225
225
  * Track active running failWith recognizers
226
226
  */
227
- $(this, "failWithActive$");
228
- const i = new q({
227
+ u(this, "failWithActive$");
228
+ const s = new q({
229
229
  fingers: 0
230
230
  });
231
231
  this.pointerEvent$ = this.config$.pipe(
232
- g(
233
- ({ container: p, afterEventReceived: a }) => Pe({
232
+ f(
233
+ ({ container: p, afterEventReceived: a }) => we({
234
234
  container: p,
235
235
  afterEventReceived: a
236
236
  })
237
237
  )
238
238
  ), this.pointerDown$ = this.pointerEvent$.pipe(
239
- h((p) => p.type === "pointerdown")
239
+ c((p) => p.type === "pointerdown")
240
240
  ), this.pointerUp$ = this.pointerEvent$.pipe(
241
- h((p) => p.type === "pointerup")
241
+ c((p) => p.type === "pointerup")
242
242
  ), this.pointerMove$ = this.pointerEvent$.pipe(
243
- h((p) => p.type === "pointermove")
243
+ c((p) => p.type === "pointermove")
244
244
  ), this.pointerCancel$ = this.pointerEvent$.pipe(
245
- h((p) => p.type === "pointercancel")
246
- ), this.pointerOff$ = this.pointerEvent$.pipe(ie);
247
- const s = this.config$.pipe(
248
- c(({ failWith: p }) => p),
249
- re()
245
+ c((p) => p.type === "pointercancel")
246
+ ), this.pointerOff$ = this.pointerEvent$.pipe(ne);
247
+ const i = this.config$.pipe(
248
+ h(({ failWith: p }) => p),
249
+ oe()
250
250
  );
251
- this.failWithActive$ = s.pipe(
252
- g((p) => {
251
+ this.failWithActive$ = i.pipe(
252
+ f((p) => {
253
253
  const a = p == null ? void 0 : p.map((o) => {
254
- const r = o.start$.pipe(c(() => !0)), l = o.end$.pipe(c(() => !1));
255
- return y(r, l).pipe(
256
- H(!1),
257
- M(1)
254
+ const r = o.start$.pipe(h(() => !0)), l = o.end$.pipe(h(() => !1));
255
+ return v(r, l).pipe(
256
+ re(!1),
257
+ E(1)
258
258
  );
259
259
  });
260
- return a != null && a.length ? W(a) : W([T(!1)]);
260
+ return a != null && a.length ? j(a) : j([S(!1)]);
261
261
  }),
262
- c((p) => p.some((a) => a)),
263
- M(1)
262
+ h((p) => p.some((a) => a)),
263
+ E(1)
264
264
  ), this.pan$ = this.configSubject.pipe(
265
265
  G,
266
- g((p) => {
267
- var d, E, A;
268
- const a = Math.max(1, ((d = p.panConfig) == null ? void 0 : d.numInputs) ?? 1), o = Math.max(0, ((E = p.panConfig) == null ? void 0 : E.posThreshold) ?? 0), r = Math.max(0, ((A = p.panConfig) == null ? void 0 : A.delay) ?? 0), l = this.pointerDown$.pipe(
269
- te({
266
+ f((p) => {
267
+ var g, A, D;
268
+ const a = Math.max(1, ((g = p.panConfig) == null ? void 0 : g.numInputs) ?? 1), o = Math.max(0, ((A = p.panConfig) == null ? void 0 : A.posThreshold) ?? 0), r = Math.max(0, ((D = p.panConfig) == null ? void 0 : D.delay) ?? 0), l = this.pointerDown$.pipe(
269
+ ee({
270
270
  pointerEvent$: this.pointerEvent$,
271
271
  trackMove: !0
272
272
  }),
273
- M(1)
274
- ), u = (m) => m.pipe(
275
- h(
276
- (D) => D.pointers.length >= a
273
+ E(1)
274
+ ), $ = (y) => y.pipe(
275
+ c(
276
+ (w) => w.pointers.length >= a
277
277
  )
278
- ), f = (m) => m.pipe(h((D) => D.pointers.length < a));
278
+ ), m = (y) => y.pipe(c((w) => w.pointers.length < a));
279
279
  return l.pipe(
280
- u,
281
- J(({ pointers: m }) => {
282
- const D = l.pipe(
283
- f,
284
- F(),
280
+ $,
281
+ H(({ pointers: y }) => {
282
+ const w = l.pipe(
283
+ m,
284
+ R(),
285
285
  P()
286
- ), Y = K(r), C = y(
287
- ...m.map((v) => T(v)),
286
+ ), X = J(r), C = v(
287
+ ...y.map((d) => S(d)),
288
288
  this.pointerDown$
289
289
  ).pipe(
290
- S(
291
- (v) => y(this.pointerMove$, T(v)).pipe(
292
- X(v),
293
- h(
294
- (x) => Z(
295
- v,
290
+ b(
291
+ (d) => v(this.pointerMove$, S(d)).pipe(
292
+ W(d),
293
+ c(
294
+ (x) => Q(
295
+ d,
296
296
  x,
297
297
  o
298
298
  )
299
299
  )
300
300
  )
301
301
  ),
302
- F()
302
+ R()
303
303
  ).pipe(
304
- g(() => Y),
305
- L(l),
306
- c(([, { event: v, pointers: x }]) => ({
304
+ f(() => X),
305
+ z(l),
306
+ h(([, { event: d, pointers: x }]) => ({
307
307
  type: "start",
308
- event: v,
308
+ event: d,
309
309
  latestActivePointers: x
310
310
  })),
311
- M({
311
+ E({
312
312
  bufferSize: 1,
313
313
  refCount: !1
314
314
  }),
315
- b(D)
316
- ), k = C.pipe(
317
- S(
315
+ I(w)
316
+ ), O = C.pipe(
317
+ b(
318
318
  () => l.pipe(
319
319
  ae(1),
320
- c(({ event: v, pointers: x }) => ({
320
+ h(({ event: d, pointers: x }) => ({
321
321
  type: "move",
322
- event: v,
322
+ event: d,
323
323
  latestActivePointers: x
324
324
  }))
325
325
  )
326
326
  ),
327
- b(D)
328
- ), w = C.pipe(
329
- S(
330
- () => D.pipe(
331
- c(({ event: v, pointers: x }) => ({
327
+ I(w)
328
+ ), M = C.pipe(
329
+ b(
330
+ () => w.pipe(
331
+ h(({ event: d, pointers: x }) => ({
332
332
  type: "end",
333
- event: v,
333
+ event: d,
334
334
  latestActivePointers: x
335
335
  }))
336
336
  )
337
337
  )
338
- ), O = y(C, k, w).pipe(
339
- M(1)
338
+ ), L = v(C, O, M).pipe(
339
+ E(1)
340
340
  );
341
- return O.pipe(
342
- ne,
343
- L(O),
344
- c(([v, { type: x }]) => ({
345
- ...v,
341
+ return L.pipe(
342
+ te,
343
+ z(L),
344
+ h(([d, { type: x }]) => ({
345
+ ...d,
346
346
  type: x
347
347
  }))
348
348
  );
349
349
  })
350
350
  );
351
351
  }),
352
- Q((p) => {
353
- i.next({
352
+ K((p) => {
353
+ s.next({
354
354
  fingers: p.pointers.length
355
355
  });
356
356
  }),
357
357
  P()
358
358
  ), this.panStart$ = this.pan$.pipe(
359
- h((p) => p.type === "start"),
360
- c(({ type: p, ...a }) => a)
359
+ c((p) => p.type === "start"),
360
+ h(({ type: p, ...a }) => a)
361
361
  ), this.panMove$ = this.pan$.pipe(
362
- h((p) => p.type === "move"),
363
- c(({ type: p, ...a }) => a)
362
+ c((p) => p.type === "move"),
363
+ h(({ type: p, ...a }) => a)
364
364
  ), this.panEnd$ = this.pan$.pipe(
365
- h((p) => p.type === "end"),
366
- c(({ type: p, ...a }) => a)
367
- ), this.state$ = i.asObservable(), this.updateInternal(n ?? {}, e);
365
+ c((p) => p.type === "end"),
366
+ h(({ type: p, ...a }) => a)
367
+ ), this.state$ = s.asObservable(), this.updateInternal(n ?? {}, e);
368
368
  }
369
369
  updateInternal(n, e) {
370
- const i = this.configSubject.getValue();
370
+ const s = this.configSubject.getValue();
371
371
  this.configSubject.next({
372
- ...i,
372
+ ...s,
373
373
  ...n,
374
374
  ...n.options && {
375
- options: { ...i.options, ...n.options }
375
+ options: { ...s.options, ...n.options }
376
376
  },
377
377
  panConfig: {
378
- ...i.panConfig,
378
+ ...s.panConfig,
379
379
  ...e
380
380
  }
381
381
  });
@@ -384,85 +384,85 @@ class z {
384
384
  this.updateInternal(n, e);
385
385
  }
386
386
  }
387
- class Ie extends z {
387
+ class Te extends F {
388
388
  constructor(e) {
389
389
  var a;
390
390
  super(e, {
391
391
  ...e,
392
392
  posThreshold: ((a = e == null ? void 0 : e.options) == null ? void 0 : a.posThreshold) ?? 15
393
393
  });
394
- $(this, "events$");
395
- $(this, "start$");
396
- $(this, "end$");
397
- const i = this.panStart$.pipe(
398
- c((o) => ({
394
+ u(this, "events$");
395
+ u(this, "start$");
396
+ u(this, "end$");
397
+ const s = this.panStart$.pipe(
398
+ h((o) => ({
399
399
  type: "panStart",
400
400
  ...o
401
401
  })),
402
- L(this.failWithActive$),
403
- h(([, o]) => !o),
404
- c(([o]) => o),
402
+ z(this.failWithActive$),
403
+ c(([, o]) => !o),
404
+ h(([o]) => o),
405
405
  P()
406
- ), s = this.panEnd$.pipe(
407
- c((o) => ({
406
+ ), i = this.panEnd$.pipe(
407
+ h((o) => ({
408
408
  type: "panEnd",
409
409
  ...o
410
410
  })),
411
411
  P()
412
412
  ), p = this.panMove$.pipe(
413
- c((o) => ({
413
+ h((o) => ({
414
414
  type: "panMove",
415
415
  ...o
416
416
  }))
417
417
  );
418
- this.events$ = i.pipe(
419
- g((o) => {
418
+ this.events$ = s.pipe(
419
+ f((o) => {
420
420
  let r = o;
421
- const l = this.failWithActive$.pipe(
422
- h((d) => d),
423
- F()
424
- ), u = y(T(o), p, s).pipe(
425
- Q((d) => {
426
- r = d;
421
+ const l = S(o), $ = this.failWithActive$.pipe(
422
+ c((A) => A),
423
+ R()
424
+ ), m = v(l, p, i).pipe(
425
+ K((A) => {
426
+ r = A;
427
427
  }),
428
- b(l)
429
- ), f = l.pipe(
430
- c(() => ({
428
+ I($)
429
+ ), g = $.pipe(
430
+ h(() => ({
431
431
  ...r,
432
432
  type: "panEnd"
433
433
  })),
434
- b(s)
434
+ I(i)
435
435
  );
436
- return y(u, f);
436
+ return v(m, g);
437
437
  }),
438
438
  P()
439
439
  ), this.start$ = this.events$.pipe(
440
- h((o) => o.type === "panStart")
441
- ), this.end$ = this.events$.pipe(h((o) => o.type === "panEnd"));
440
+ c((o) => o.type === "panStart")
441
+ ), this.end$ = this.events$.pipe(c((o) => o.type === "panEnd"));
442
442
  }
443
443
  update(e) {
444
444
  super.update(e, e.options);
445
445
  }
446
446
  }
447
- const we = (t) => (n) => n.pipe(
448
- h((e) => Math.abs(e.velocityX) >= t || Math.abs(e.velocityY) >= t)
447
+ const Me = (t) => (n) => n.pipe(
448
+ c((e) => Math.abs(e.velocityX) >= t || Math.abs(e.velocityY) >= t)
449
449
  );
450
- class Se extends z {
450
+ class be extends F {
451
451
  constructor(e) {
452
452
  super(e, {
453
453
  posThreshold: 0,
454
454
  numInputs: 1
455
455
  });
456
- $(this, "events$");
456
+ u(this, "events$");
457
457
  this.events$ = this.config$.pipe(
458
- g((i) => {
459
- const { escapeVelocity: s = 0.9 } = i.options ?? {};
458
+ f((s) => {
459
+ const { escapeVelocity: i = 0.9 } = s.options ?? {};
460
460
  return this.panStart$.pipe(
461
- g((p) => this.panEnd$.pipe(
462
- we(s),
463
- c((a) => ({
461
+ f((p) => this.panEnd$.pipe(
462
+ Me(i),
463
+ h((a) => ({
464
464
  type: "swipe",
465
- angle: ve(
465
+ angle: ge(
466
466
  p.event,
467
467
  a.event
468
468
  ),
@@ -478,96 +478,96 @@ class Se extends z {
478
478
  super.update(e);
479
479
  }
480
480
  }
481
- const Me = ({
481
+ const Ee = ({
482
482
  timeout: t,
483
483
  pointerEvent$: n
484
484
  }) => (e) => e.pipe(
485
- S(
486
- (i) => K(t).pipe(
487
- b(
488
- n.pipe(ie, X(i))
485
+ b(
486
+ (s) => J(t).pipe(
487
+ I(
488
+ n.pipe(ne, W(s))
489
489
  )
490
490
  )
491
491
  )
492
- ), Ee = ({
492
+ ), xe = ({
493
493
  initialPointerEvent: t,
494
494
  pointerEvent$: n,
495
495
  tolerance: e
496
- }) => (i) => i.pipe(
497
- S(
498
- (s) => n.pipe(
499
- X(s),
500
- V((p) => !ee(p), !0),
501
- h(
502
- (p) => Z(t, p, e)
496
+ }) => (s) => s.pipe(
497
+ b(
498
+ (i) => n.pipe(
499
+ W(i),
500
+ V((p) => !Z(p), !0),
501
+ c(
502
+ (p) => Q(t, p, e)
503
503
  )
504
504
  )
505
505
  )
506
506
  );
507
- class be extends z {
507
+ class Ce extends F {
508
508
  constructor(e) {
509
509
  super(e);
510
- $(this, "events$");
510
+ u(this, "events$");
511
511
  this.events$ = this.config$.pipe(
512
- g((i) => {
513
- var d, E;
514
- const s = ((d = i.options) == null ? void 0 : d.maxTaps) ?? 1, p = ((E = i.options) == null ? void 0 : E.multiTapThreshold) ?? 100 * (s - 1), { maximumPressTime: a = 150, tolerance: o = 10 } = i.options ?? {}, r = this.pointerDown$.pipe(
515
- te({
512
+ f((s) => {
513
+ var g, A;
514
+ const i = ((g = s.options) == null ? void 0 : g.maxTaps) ?? 1, p = ((A = s.options) == null ? void 0 : A.multiTapThreshold) ?? 100 * (i - 1), { maximumPressTime: a = 150, tolerance: o = 10 } = s.options ?? {}, r = this.pointerDown$.pipe(
515
+ ee({
516
516
  pointerEvent$: this.pointerEvent$,
517
517
  trackMove: !0
518
518
  }),
519
- M(1)
519
+ E(1)
520
520
  ), l = r.pipe(
521
- h(({ pointers: A }) => A.length > 1)
522
- ), u = (A) => A.pipe(
521
+ c(({ pointers: D }) => D.length > 1)
522
+ ), $ = (D) => D.pipe(
523
523
  he(this.pointerUp$.pipe(ce(p))),
524
- F()
524
+ R()
525
525
  );
526
- return y(
526
+ return v(
527
527
  this.pointerDown$,
528
528
  r.pipe(le())
529
529
  ).pipe(
530
- J((A) => {
531
- const m = y(
532
- T(A),
530
+ H((D) => {
531
+ const y = v(
532
+ S(D),
533
533
  this.pointerDown$
534
- ).pipe(M(1)), D = m.pipe(u), Y = m.pipe(
535
- Ee({
536
- initialPointerEvent: A,
534
+ ).pipe(E(1)), w = y.pipe($), X = y.pipe(
535
+ xe({
536
+ initialPointerEvent: D,
537
537
  pointerEvent$: this.pointerEvent$,
538
538
  tolerance: o
539
539
  })
540
- ), B = m.pipe(
541
- Me({
540
+ ), B = y.pipe(
541
+ Ee({
542
542
  pointerEvent$: this.pointerEvent$,
543
543
  timeout: a
544
544
  })
545
- ), C = y(
546
- this.failWithActive$.pipe(h((w) => w)),
545
+ ), C = v(
546
+ this.failWithActive$.pipe(c((M) => M)),
547
547
  this.pointerCancel$,
548
548
  l,
549
- Y,
549
+ X,
550
550
  B
551
- ), k = D.pipe(
552
- fe,
553
- h((w) => w.length <= s),
554
- c((w) => ({
551
+ ), O = w.pipe(
552
+ Ae,
553
+ c((M) => M.length <= i),
554
+ h((M) => ({
555
555
  type: "tap",
556
- taps: w.length,
557
- latestActivePointers: w,
558
- event: w[0]
556
+ taps: M.length,
557
+ latestActivePointers: M,
558
+ event: M[0]
559
559
  })),
560
- M(1)
560
+ E(1)
561
561
  );
562
- return k.pipe(
563
- ne,
564
- L(k),
565
- c(([w, { type: O, taps: v }]) => ({
566
- ...w,
567
- type: O,
568
- taps: v
562
+ return O.pipe(
563
+ te,
564
+ z(O),
565
+ h(([M, { type: L, taps: d }]) => ({
566
+ ...M,
567
+ type: L,
568
+ taps: d
569
569
  })),
570
- b(C)
570
+ I(C)
571
571
  );
572
572
  })
573
573
  );
@@ -579,26 +579,26 @@ class be extends z {
579
579
  super.update(e);
580
580
  }
581
581
  }
582
- class Ce extends z {
582
+ class Re extends F {
583
583
  constructor(e = {}) {
584
584
  super(e, {
585
585
  numInputs: 2,
586
586
  posThreshold: 15,
587
587
  ...e.options
588
588
  });
589
- $(this, "events$");
589
+ u(this, "events$");
590
590
  this.events$ = this.config$.pipe(
591
- g(() => {
592
- const i = this.panStart$.pipe(
593
- c((o) => ({
591
+ f(() => {
592
+ const s = this.panStart$.pipe(
593
+ h((o) => ({
594
594
  ...o,
595
595
  type: "rotateStart",
596
596
  angle: 0,
597
597
  deltaAngle: 0
598
598
  })),
599
- M(1)
600
- ), s = i.pipe(
601
- g(
599
+ E(1)
600
+ ), i = s.pipe(
601
+ f(
602
602
  () => this.pan$.pipe(
603
603
  U((o, r) => {
604
604
  const l = ((o == null ? void 0 : o.angle) ?? 0) + r.deltaPointersAngle;
@@ -612,14 +612,14 @@ class Ce extends z {
612
612
  )
613
613
  ),
614
614
  P()
615
- ), p = s.pipe(
616
- h((o) => o.type === "move"),
617
- c((o) => ({ ...o, type: "rotateMove" }))
618
- ), a = s.pipe(
619
- h((o) => o.type === "end"),
620
- c((o) => ({ ...o, type: "rotateEnd" }))
615
+ ), p = i.pipe(
616
+ c((o) => o.type === "move"),
617
+ h((o) => ({ ...o, type: "rotateMove" }))
618
+ ), a = i.pipe(
619
+ c((o) => o.type === "end"),
620
+ h((o) => ({ ...o, type: "rotateEnd" }))
621
621
  );
622
- return y(i, p, a);
622
+ return v(s, p, a);
623
623
  }),
624
624
  P()
625
625
  );
@@ -628,97 +628,100 @@ class Ce extends z {
628
628
  super.update(e, e.options);
629
629
  }
630
630
  }
631
- const j = ({
631
+ const Y = ({
632
632
  type: t,
633
633
  initialEvent: n
634
634
  }) => (e) => e.pipe(
635
- U((i, s) => {
636
- const a = ((i == null ? void 0 : i.pointers.length) ?? 0) !== s.pointers.length, o = (i == null ? void 0 : i.pointersAverageDistance) ?? s.pointersAverageDistance, r = a ? s.pointersAverageDistance : i && "initialPointersAverageDistance" in i ? i.initialPointersAverageDistance : s.pointersAverageDistance, l = r === 0 ? 1 : s.pointersAverageDistance / r, u = s.pointersAverageDistance - r, f = s.pointersAverageDistance - r, d = a || o === 0 ? 1 : s.pointersAverageDistance / o;
635
+ U((s, i) => {
636
+ const a = ((s == null ? void 0 : s.pointers.length) ?? 0) !== i.pointers.length, o = (s == null ? void 0 : s.pointersAverageDistance) ?? i.pointersAverageDistance, r = a ? i.pointersAverageDistance : s && "initialPointersAverageDistance" in s ? s.initialPointersAverageDistance : i.pointersAverageDistance, l = r === 0 ? 1 : i.pointersAverageDistance / r, $ = i.pointersAverageDistance - r, m = i.pointersAverageDistance - r, g = a || o === 0 ? 1 : i.pointersAverageDistance / o;
637
637
  return {
638
- ...i,
639
638
  ...s,
639
+ ...i,
640
640
  type: t,
641
641
  initialPointersAverageDistance: r,
642
642
  scale: l,
643
- distance: u,
644
- deltaDistance: f,
645
- deltaDistanceScale: d
643
+ distance: $,
644
+ deltaDistance: m,
645
+ deltaDistanceScale: g
646
646
  };
647
647
  }, n),
648
- c(({ initialPointersAverageDistance: i, ...s }) => s)
648
+ h(({ initialPointersAverageDistance: s, ...i }) => i)
649
649
  );
650
- class Re extends z {
650
+ class ze extends F {
651
651
  constructor(e) {
652
652
  super(e, {
653
653
  ...e == null ? void 0 : e.options,
654
654
  numInputs: 2
655
655
  });
656
- $(this, "events$");
657
- $(this, "start$");
658
- $(this, "end$");
659
- const i = this.panStart$.pipe(
660
- g(
661
- (s) => T(s).pipe(
662
- j({
663
- type: "pinchStart",
664
- initialEvent: void 0
665
- })
666
- )
667
- ),
656
+ u(this, "events$");
657
+ u(this, "start$");
658
+ u(this, "end$");
659
+ const s = this.panStart$.pipe(
660
+ z(this.failWithActive$),
661
+ c(([, i]) => !i),
662
+ h(([i]) => i),
663
+ Y({
664
+ type: "pinchStart",
665
+ initialEvent: void 0
666
+ }),
668
667
  P()
669
668
  );
670
669
  this.events$ = this.config$.pipe(
671
- g(() => {
672
- const s = i.pipe(M(1)), p = s.pipe(
673
- g((o) => this.pan$.pipe(
674
- V((r) => r.type !== "end"),
675
- j({
670
+ f(() => {
671
+ const i = s.pipe(E(1)), p = this.failWithActive$.pipe(
672
+ c((r) => r),
673
+ R()
674
+ ), a = i.pipe(
675
+ f((r) => this.pan$.pipe(
676
+ V((l) => l.type !== "end"),
677
+ Y({
676
678
  type: "pinchMove",
677
- initialEvent: o
679
+ initialEvent: r
678
680
  })
679
- ))
680
- ), a = s.pipe(
681
- g(
682
- (o) => this.pan$.pipe(
683
- // we cannot have a panEnd without a previous event so it will always emit
684
- H(o),
685
- $e(),
686
- h(([, r]) => r.type === "end"),
687
- g(
688
- ([r, l]) => T(l).pipe(
689
- j({
690
- type: "pinchEnd",
691
- initialEvent: r
692
- })
693
- )
694
- )
695
- )
696
- )
681
+ )),
682
+ I(p)
683
+ ), o = i.pipe(
684
+ f((r) => {
685
+ let l = r;
686
+ return this.pan$.pipe(
687
+ f(($) => $.type === "end" ? S($) : (l = $, $e)),
688
+ I(p),
689
+ ue(null),
690
+ h(
691
+ ($) => $ || l
692
+ ),
693
+ Y({
694
+ type: "pinchEnd",
695
+ initialEvent: l
696
+ }),
697
+ P()
698
+ );
699
+ })
697
700
  );
698
- return y(s, p, a);
701
+ return v(i, a, o);
699
702
  }),
700
703
  P()
701
704
  ), this.start$ = this.events$.pipe(
702
- h((s) => s.type === "pinchStart")
703
- ), this.end$ = this.events$.pipe(h((s) => s.type === "pinchEnd"));
705
+ c((i) => i.type === "pinchStart")
706
+ ), this.end$ = this.events$.pipe(c((i) => i.type === "pinchEnd"));
704
707
  }
705
708
  update(e) {
706
709
  super.update(e, e.options);
707
710
  }
708
711
  }
709
- class ze {
712
+ class ke {
710
713
  constructor(n) {
711
- $(this, "events$");
712
- $(this, "recognizers");
713
- $(this, "state$");
714
- this.options = n, this.recognizers = n.recognizers, this.events$ = y(
714
+ u(this, "events$");
715
+ u(this, "recognizers");
716
+ u(this, "state$");
717
+ this.options = n, this.recognizers = n.recognizers, this.events$ = v(
715
718
  ...n.recognizers.map((e) => e.events$)
716
- ).pipe(P()), this.state$ = W(
719
+ ).pipe(P()), this.state$ = j(
717
720
  this.recognizers.map((e) => e.state$)
718
721
  ).pipe(
719
- c(
720
- (e) => e.reduce((i, s) => ({
721
- fingers: Math.max(i.fingers, s.fingers)
722
+ h(
723
+ (e) => e.reduce((s, i) => ({
724
+ fingers: Math.max(s.fingers, i.fingers)
722
725
  }))
723
726
  )
724
727
  ), this.update(n);
@@ -730,12 +733,12 @@ class ze {
730
733
  }
731
734
  }
732
735
  export {
733
- Ie as PanRecognizer,
734
- Re as PinchRecognizer,
735
- ze as Recognizable,
736
- z as Recognizer,
737
- Ce as RotateRecognizer,
738
- Se as SwipeRecognizer,
739
- be as TapRecognizer
736
+ Te as PanRecognizer,
737
+ ze as PinchRecognizer,
738
+ ke as Recognizable,
739
+ F as Recognizer,
740
+ Re as RotateRecognizer,
741
+ be as SwipeRecognizer,
742
+ Ce as TapRecognizer
740
743
  };
741
744
  //# sourceMappingURL=index.js.map