@baleada/logic 0.24.18 → 0.24.20

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.
Files changed (4) hide show
  1. package/lib/index.cjs +854 -640
  2. package/lib/index.d.ts +239 -123
  3. package/lib/index.js +847 -631
  4. package/package.json +15 -13
package/lib/index.js CHANGED
@@ -1,8 +1,5 @@
1
1
  import BezierEasing from 'bezier-easing';
2
2
  import { pipe, flatMap, unique, map, toArray, concat, filter, reduce, slice, sort, find, findIndex, at, some, includes, toLength, join, every, reverse as reverse$1, average } from 'lazy-collections';
3
- import { sortKind, Searcher } from 'fast-fuzzy';
4
- import createDOMPurify from 'dompurify';
5
- import slugify from '@sindresorhus/slugify';
6
3
  import arrayShuffle from 'array-shuffle';
7
4
  import { klona } from 'klona';
8
5
  import { dequal } from 'dequal';
@@ -11,6 +8,9 @@ import { getStroke } from 'perfect-freehand';
11
8
  import polygonClipping from 'polygon-clipping';
12
9
  import ky from 'ky';
13
10
  import clsx from 'clsx';
11
+ import { sortKind, Searcher } from 'fast-fuzzy';
12
+ import createDOMPurify from 'dompurify';
13
+ import slugify from '@sindresorhus/slugify';
14
14
 
15
15
  function createClip(content) {
16
16
  return (string) => {
@@ -45,10 +45,8 @@ function createResults(candidates, options = {}) {
45
45
  }
46
46
 
47
47
  function fromShorthandAliasToLonghandAlias(shorthand) {
48
- if (capitalLetterRE.test(shorthand))
49
- return `shift+${shorthand.toLowerCase()}`;
50
- if (shorthand in keycombosBySpecialCharacter)
51
- return keycombosBySpecialCharacter[shorthand];
48
+ if (capitalLetterRE.test(shorthand)) return `shift+${shorthand.toLowerCase()}`;
49
+ if (shorthand in keycombosBySpecialCharacter) return keycombosBySpecialCharacter[shorthand];
52
50
  return shorthand;
53
51
  }
54
52
  const capitalLetterRE = /^[A-Z]$/;
@@ -100,16 +98,11 @@ function createAliases(options = {}) {
100
98
  }
101
99
 
102
100
  function fromAliasToCode(alias) {
103
- if (alias in partialCodesByAlias)
104
- return partialCodesByAlias[alias];
105
- if (alias in keyStatusKeysByAlias)
106
- return keyStatusKeysByAlias[alias];
107
- if (letterRE.test(alias))
108
- return `Key${alias.toUpperCase()}`;
109
- if (digitRE.test(alias))
110
- return `Digit${alias}`;
111
- if (functionRE.test(alias))
112
- return alias.toUpperCase();
101
+ if (alias in partialCodesByAlias) return partialCodesByAlias[alias];
102
+ if (alias in keyStatusKeysByAlias) return keyStatusKeysByAlias[alias];
103
+ if (letterRE.test(alias)) return `Key${alias.toUpperCase()}`;
104
+ if (digitRE.test(alias)) return `Digit${alias}`;
105
+ if (functionRE.test(alias)) return alias.toUpperCase();
113
106
  return "unsupported";
114
107
  }
115
108
  const digitRE = /^[0-9]$/;
@@ -235,8 +228,7 @@ function createReverse() {
235
228
  };
236
229
  }
237
230
  function createSlice(from, to) {
238
- if (from < 0 || to && to < 0)
239
- return (array) => array.slice(from, to);
231
+ if (from < 0 || to && to < 0) return (array) => array.slice(from, to);
240
232
  const toSliced = to ? slice(from, to - 1) : slice(from);
241
233
  return (array) => {
242
234
  return from === to ? [] : pipe(
@@ -351,8 +343,7 @@ function createFindAsync(predicate) {
351
343
  return async (array) => {
352
344
  for (let i = 0; i < array.length; i++) {
353
345
  const item = array[i], is = await predicate(item, i);
354
- if (is)
355
- return item;
346
+ if (is) return item;
356
347
  }
357
348
  };
358
349
  }
@@ -360,8 +351,7 @@ function createFindIndexAsync(predicate) {
360
351
  return async (array) => {
361
352
  for (let i = 0; i < array.length; i++) {
362
353
  const item = array[i], is = await predicate(item, i);
363
- if (is)
364
- return i;
354
+ if (is) return i;
365
355
  }
366
356
  };
367
357
  }
@@ -426,11 +416,18 @@ function createBreadthPathConfig(directedAcyclic) {
426
416
  return { predicatePathable, toTraversalCandidates };
427
417
  }
428
418
 
419
+ var __defProp$i = Object.defineProperty;
420
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
421
+ var __publicField$i = (obj, key, value) => __defNormalProp$i(obj, typeof key !== "symbol" ? key + "" : key, value);
429
422
  class Recognizeable {
430
- maxSequenceLength;
431
- effects;
432
- effectApi;
433
423
  constructor(sequence, options = {}) {
424
+ __publicField$i(this, "maxSequenceLength");
425
+ __publicField$i(this, "effects");
426
+ __publicField$i(this, "effectApi");
427
+ __publicField$i(this, "computedMetadata");
428
+ __publicField$i(this, "computedStatus");
429
+ __publicField$i(this, "computedStops");
430
+ __publicField$i(this, "computedSequence");
434
431
  const defaultOptions = {
435
432
  maxSequenceLength: true,
436
433
  effects: {}
@@ -456,7 +453,6 @@ class Recognizeable {
456
453
  };
457
454
  this.ready();
458
455
  }
459
- computedMetadata;
460
456
  resetComputedMetadata() {
461
457
  this.computedMetadata = {};
462
458
  }
@@ -466,7 +462,6 @@ class Recognizeable {
466
462
  denied() {
467
463
  this.computedStatus = "denied";
468
464
  }
469
- computedStatus;
470
465
  ready() {
471
466
  this.computedStatus = "ready";
472
467
  }
@@ -476,7 +471,6 @@ class Recognizeable {
476
471
  set sequence(sequence) {
477
472
  this.setSequence(sequence);
478
473
  }
479
- computedStops;
480
474
  get stops() {
481
475
  return this.computedStops;
482
476
  }
@@ -486,7 +480,6 @@ class Recognizeable {
486
480
  get metadata() {
487
481
  return this.computedMetadata;
488
482
  }
489
- computedSequence;
490
483
  setSequence(sequence) {
491
484
  this.computedSequence = sequence;
492
485
  return this;
@@ -495,11 +488,9 @@ class Recognizeable {
495
488
  this.recognizing();
496
489
  const type = this.toType(sequenceItem), pushSequence = (sequenceItem2) => {
497
490
  newSequence.push(sequenceItem2);
498
- if (this.maxSequenceLength !== true && newSequence.length > this.maxSequenceLength)
499
- newSequence.shift();
491
+ if (this.maxSequenceLength !== true && newSequence.length > this.maxSequenceLength) newSequence.shift();
500
492
  }, newSequence = [];
501
- for (const previousSequenceItem of this.sequence)
502
- pushSequence(previousSequenceItem);
493
+ for (const previousSequenceItem of this.sequence) pushSequence(previousSequenceItem);
503
494
  pushSequence(sequenceItem);
504
495
  this.effectApi.getSequence = () => newSequence;
505
496
  this.effectApi.pushSequence = pushSequence;
@@ -558,11 +549,17 @@ function isEffectConfig(effectOrConfig) {
558
549
  return typeof effectOrConfig === "object";
559
550
  }
560
551
 
552
+ var __defProp$h = Object.defineProperty;
553
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
554
+ var __publicField$h = (obj, key, value) => __defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
561
555
  class Listenable {
562
- computedRecognizeable;
563
- recognizeableEffectsKeys;
564
- computedActive;
565
556
  constructor(type, options) {
557
+ __publicField$h(this, "computedRecognizeable");
558
+ __publicField$h(this, "recognizeableEffectsKeys");
559
+ __publicField$h(this, "computedActive");
560
+ __publicField$h(this, "computedStatus");
561
+ __publicField$h(this, "computedType");
562
+ __publicField$h(this, "implementation");
566
563
  if (type === "recognizeable") {
567
564
  this.computedRecognizeable = new Recognizeable([], options?.recognizeable);
568
565
  this.recognizeableEffectsKeys = Object.keys(options?.recognizeable?.effects);
@@ -571,7 +568,6 @@ class Listenable {
571
568
  this.setType(type);
572
569
  this.ready();
573
570
  }
574
- computedStatus;
575
571
  ready() {
576
572
  this.computedStatus = "ready";
577
573
  }
@@ -590,8 +586,6 @@ class Listenable {
590
586
  get recognizeable() {
591
587
  return this.computedRecognizeable;
592
588
  }
593
- computedType;
594
- implementation;
595
589
  setType(type) {
596
590
  this.stop();
597
591
  this.computedType = type;
@@ -668,8 +662,7 @@ class Listenable {
668
662
  sequenceItem,
669
663
  { listenInjection: { effect, optionsByType } }
670
664
  );
671
- if (this.recognizeable.status === "recognized")
672
- effect(sequenceItem);
665
+ if (this.recognizeable.status === "recognized") effect(sequenceItem);
673
666
  }, optionsByType = {};
674
667
  for (const type of this.recognizeableEffectsKeys) {
675
668
  optionsByType[type] = {
@@ -722,8 +715,7 @@ class Listenable {
722
715
  stop(stoppable);
723
716
  this.active.delete(stoppable);
724
717
  }
725
- if (shouldUpdateStatus)
726
- this.stopped();
718
+ if (shouldUpdateStatus) this.stopped();
727
719
  break;
728
720
  }
729
721
  return this;
@@ -862,7 +854,7 @@ const observerAssertionsByType = {
862
854
  resize: (observer) => observer instanceof ResizeObserver
863
855
  };
864
856
 
865
- const defaultOptions$l = {
857
+ const defaultOptions$i = {
866
858
  minDuration: 0,
867
859
  preventsDefaultUnlessDenied: true,
868
860
  toCode: (alias) => fromAliasToCode(alias),
@@ -878,7 +870,7 @@ function createKeypress(keycomboOrKeycombos, options = {}) {
878
870
  onDown,
879
871
  onUp,
880
872
  onVisibilitychange
881
- } = { ...defaultOptions$l, ...options }, {
873
+ } = { ...defaultOptions$i, ...options }, {
882
874
  matchPredicatesByKeycombo,
883
875
  getDownCombos,
884
876
  predicateValid,
@@ -895,8 +887,7 @@ function createKeypress(keycomboOrKeycombos, options = {}) {
895
887
  toAliases,
896
888
  getRequest: () => request
897
889
  }), fromComboToAliasesLength = createAliasesLength({ toLonghand }), maybeAddWindowBlurListener = () => {
898
- if (windowBlurStatus === "added")
899
- return;
890
+ if (windowBlurStatus === "added") return;
900
891
  window.addEventListener("blur", onWindowBlur);
901
892
  windowBlurStatus = "added";
902
893
  }, onWindowBlur = () => {
@@ -925,13 +916,11 @@ function createKeypress(keycomboOrKeycombos, options = {}) {
925
916
  ) {
926
917
  denied();
927
918
  localStatus = getStatus();
928
- if (includes(event.key)(unsupportedKeys))
929
- clearStatuses();
919
+ if (includes(event.key)(unsupportedKeys)) clearStatuses();
930
920
  onDown?.(toHookApi(api));
931
921
  return;
932
922
  }
933
- if (preventsDefaultUnlessDenied)
934
- event.preventDefault();
923
+ if (preventsDefaultUnlessDenied) event.preventDefault();
935
924
  const { getMetadata } = api, metadata = getMetadata();
936
925
  metadata.keycombo = downCombos[0];
937
926
  localStatus = "recognizing";
@@ -959,12 +948,9 @@ function createKeypress(keycomboOrKeycombos, options = {}) {
959
948
  const { denied } = api, key = fromEventToKeyStatusCode(event);
960
949
  if (localStatus === "denied") {
961
950
  denied();
962
- if (includes(event.key)(unsupportedKeys))
963
- clearStatuses();
964
- else
965
- deleteStatus(key);
966
- if (!predicateSomeKeyDown(statuses))
967
- localStatus = "recognizing";
951
+ if (includes(event.key)(unsupportedKeys)) clearStatuses();
952
+ else deleteStatus(key);
953
+ if (!predicateSomeKeyDown(statuses)) localStatus = "recognizing";
968
954
  onUp?.(toHookApi(api));
969
955
  return;
970
956
  }
@@ -973,8 +959,7 @@ function createKeypress(keycomboOrKeycombos, options = {}) {
973
959
  if (downCombos.length && matches) {
974
960
  const { getMetadata } = api, metadata = getMetadata();
975
961
  metadata.keycombo = downCombos[0];
976
- if (preventsDefaultUnlessDenied)
977
- event.preventDefault();
962
+ if (preventsDefaultUnlessDenied) event.preventDefault();
978
963
  localStatus = "recognizing";
979
964
  onUp?.(toHookApi(api));
980
965
  return;
@@ -984,8 +969,7 @@ function createKeypress(keycomboOrKeycombos, options = {}) {
984
969
  onUp?.(toHookApi(api));
985
970
  };
986
971
  const visibilitychange = (event, api) => {
987
- if (document.visibilityState === "hidden")
988
- onWindowBlur();
972
+ if (document.visibilityState === "hidden") onWindowBlur();
989
973
  onVisibilitychange?.(toHookApi(api));
990
974
  };
991
975
  return {
@@ -1015,7 +999,7 @@ class Keypress extends Listenable {
1015
999
  }
1016
1000
  }
1017
1001
 
1018
- const defaultOptions$k = {
1002
+ const defaultOptions$h = {
1019
1003
  minDuration: 0,
1020
1004
  preventsDefaultUnlessDenied: true,
1021
1005
  toCode: (alias) => fromAliasToCode(alias),
@@ -1031,7 +1015,7 @@ function createKeyrelease(keycomboOrKeycombos, options = {}) {
1031
1015
  onDown,
1032
1016
  onUp,
1033
1017
  onVisibilitychange
1034
- } = { ...defaultOptions$k, ...options }, {
1018
+ } = { ...defaultOptions$h, ...options }, {
1035
1019
  matchPredicatesByKeycombo,
1036
1020
  getDownCombos,
1037
1021
  predicateValid,
@@ -1048,8 +1032,7 @@ function createKeyrelease(keycomboOrKeycombos, options = {}) {
1048
1032
  toAliases,
1049
1033
  getRequest: () => request
1050
1034
  }), fromComboToAliasesLength = createAliasesLength({ toLonghand }), maybeAddWindowBlurListener = () => {
1051
- if (windowBlurStatus === "added")
1052
- return;
1035
+ if (windowBlurStatus === "added") return;
1053
1036
  window.addEventListener("blur", onWindowBlur);
1054
1037
  windowBlurStatus = "added";
1055
1038
  }, onWindowBlur = () => {
@@ -1078,13 +1061,11 @@ function createKeyrelease(keycomboOrKeycombos, options = {}) {
1078
1061
  ) {
1079
1062
  denied();
1080
1063
  localStatus = getStatus();
1081
- if (includes(event.key)(unsupportedKeys))
1082
- clearStatuses();
1064
+ if (includes(event.key)(unsupportedKeys)) clearStatuses();
1083
1065
  onDown?.(toHookApi(api));
1084
1066
  return;
1085
1067
  }
1086
- if (preventsDefaultUnlessDenied)
1087
- event.preventDefault();
1068
+ if (preventsDefaultUnlessDenied) event.preventDefault();
1088
1069
  const { getMetadata } = api;
1089
1070
  localStatus = "recognizing";
1090
1071
  stop();
@@ -1104,14 +1085,10 @@ function createKeyrelease(keycomboOrKeycombos, options = {}) {
1104
1085
  denied
1105
1086
  } = api, metadata = getMetadata(), key = fromEventToKeyStatusCode(event);
1106
1087
  if (["denied", "recognized"].includes(localStatus)) {
1107
- if (localStatus === "denied")
1108
- denied();
1109
- if (includes(event.key)(unsupportedKeys))
1110
- clearStatuses();
1111
- else
1112
- deleteStatus(key);
1113
- if (!predicateSomeKeyDown(statuses))
1114
- localStatus = "recognizing";
1088
+ if (localStatus === "denied") denied();
1089
+ if (includes(event.key)(unsupportedKeys)) clearStatuses();
1090
+ else deleteStatus(key);
1091
+ if (!predicateSomeKeyDown(statuses)) localStatus = "recognizing";
1115
1092
  onUp?.(toHookApi(api));
1116
1093
  return;
1117
1094
  }
@@ -1127,8 +1104,7 @@ function createKeyrelease(keycomboOrKeycombos, options = {}) {
1127
1104
  localStatus = status;
1128
1105
  metadata.keycombo = downCombos[0];
1129
1106
  }
1130
- if (preventsDefaultUnlessDenied)
1131
- event.preventDefault();
1107
+ if (preventsDefaultUnlessDenied) event.preventDefault();
1132
1108
  onUp?.(toHookApi(api));
1133
1109
  };
1134
1110
  const recognize = (event, api) => {
@@ -1174,7 +1150,7 @@ class Keyrelease extends Listenable {
1174
1150
  }
1175
1151
  }
1176
1152
 
1177
- const defaultOptions$j = {
1153
+ const defaultOptions$g = {
1178
1154
  minDuration: 0,
1179
1155
  maxInterval: 5e3,
1180
1156
  // VS Code default
@@ -1193,7 +1169,7 @@ function createKeychord(keycombos, options = {}) {
1193
1169
  onDown,
1194
1170
  onUp,
1195
1171
  onVisibilitychange
1196
- } = { ...defaultOptions$j, ...options }, narrowedKeycombos = keycombos.split(" "), keyStates = createMap((keycombo) => createKeyState({
1172
+ } = { ...defaultOptions$g, ...options }, narrowedKeycombos = keycombos.split(" "), keyStates = createMap((keycombo) => createKeyState({
1197
1173
  keycomboOrKeycombos: keycombo,
1198
1174
  toLonghand,
1199
1175
  toCode,
@@ -1222,8 +1198,7 @@ function createKeychord(keycombos, options = {}) {
1222
1198
  return;
1223
1199
  }
1224
1200
  const { getMetadata } = api, metadata = getMetadata(), downCombos = keyStates[playedIndex].getDownCombos();
1225
- if (playedIndex === 0)
1226
- metadata.played = [];
1201
+ if (playedIndex === 0) metadata.played = [];
1227
1202
  if (
1228
1203
  // NOT BUILDING VALID COMBO
1229
1204
  !keyStates[playedIndex].predicateValid(event) || downCombos.length > 1 && fromComboToAliasesLength(downCombos[0]) === fromComboToAliasesLength(downCombos[1]) || playedIndex > 0 && event.timeStamp - metadata.played[playedIndex - 1].times.end > maxInterval
@@ -1231,14 +1206,12 @@ function createKeychord(keycombos, options = {}) {
1231
1206
  denied();
1232
1207
  localStatuses[playedIndex] = getStatus();
1233
1208
  if (includes(event.key)(unsupportedKeys)) {
1234
- for (const { clearStatuses } of keyStates)
1235
- clearStatuses();
1209
+ for (const { clearStatuses } of keyStates) clearStatuses();
1236
1210
  }
1237
1211
  onDown?.(toHookApi(api));
1238
1212
  return;
1239
1213
  }
1240
- if (preventsDefaultUnlessDenied)
1241
- event.preventDefault();
1214
+ if (preventsDefaultUnlessDenied) event.preventDefault();
1242
1215
  localStatuses[playedIndex] = "recognizing";
1243
1216
  keyStates[playedIndex].stop();
1244
1217
  storeKeyboardTimeMetadata({
@@ -1260,21 +1233,16 @@ function createKeychord(keycombos, options = {}) {
1260
1233
  denied
1261
1234
  } = api, metadata = getMetadata(), key = fromEventToKeyStatusCode(event);
1262
1235
  if (["denied", "recognized"].includes(localStatuses[playedIndex])) {
1263
- if (localStatuses[playedIndex] === "denied")
1264
- denied();
1236
+ if (localStatuses[playedIndex] === "denied") denied();
1265
1237
  for (const { clearStatuses, deleteStatus } of keyStates) {
1266
- if (includes(event.key)(unsupportedKeys))
1267
- clearStatuses();
1268
- else
1269
- deleteStatus(key);
1238
+ if (includes(event.key)(unsupportedKeys)) clearStatuses();
1239
+ else deleteStatus(key);
1270
1240
  }
1271
1241
  if (!predicateSomeKeyDown(keyStates[playedIndex].statuses)) {
1272
1242
  if (localStatuses[playedIndex] === "denied" || playedIndex === narrowedKeycombos.length - 1 && localStatuses[playedIndex] === "recognized") {
1273
1243
  playedIndex = 0;
1274
- for (let i = 0; i < localStatuses.length; i++)
1275
- localStatuses[i] = "recognizing";
1276
- for (const { clearStatuses } of keyStates)
1277
- clearStatuses();
1244
+ for (let i = 0; i < localStatuses.length; i++) localStatuses[i] = "recognizing";
1245
+ for (const { clearStatuses } of keyStates) clearStatuses();
1278
1246
  }
1279
1247
  }
1280
1248
  onUp?.(toHookApi(api));
@@ -1294,14 +1262,11 @@ function createKeychord(keycombos, options = {}) {
1294
1262
  keycombo: downCombos[0]
1295
1263
  };
1296
1264
  }
1297
- if (preventsDefaultUnlessDenied)
1298
- event.preventDefault();
1265
+ if (preventsDefaultUnlessDenied) event.preventDefault();
1299
1266
  if (playedIndex === narrowedKeycombos.length - 1 && !predicateSomeKeyDown(keyStates[playedIndex].statuses)) {
1300
1267
  playedIndex = 0;
1301
- for (let i = 0; i < localStatuses.length; i++)
1302
- localStatuses[i] = "recognizing";
1303
- for (const { clearStatuses } of keyStates)
1304
- clearStatuses();
1268
+ for (let i = 0; i < localStatuses.length; i++) localStatuses[i] = "recognizing";
1269
+ for (const { clearStatuses } of keyStates) clearStatuses();
1305
1270
  }
1306
1271
  onUp?.(toHookApi(api));
1307
1272
  };
@@ -1320,8 +1285,7 @@ function createKeychord(keycombos, options = {}) {
1320
1285
  };
1321
1286
  const visibilitychange = (event, api) => {
1322
1287
  if (document.visibilityState === "hidden") {
1323
- for (const { clearStatuses } of keyStates)
1324
- clearStatuses();
1288
+ for (const { clearStatuses } of keyStates) clearStatuses();
1325
1289
  localStatuses[playedIndex] = "recognizing";
1326
1290
  keyStates[playedIndex].stop();
1327
1291
  playedIndex = 0;
@@ -1369,11 +1333,11 @@ class Konami extends Listenable {
1369
1333
  }
1370
1334
  }
1371
1335
 
1372
- const defaultOptions$i = {
1336
+ const defaultOptions$f = {
1373
1337
  minDuration: 0,
1374
1338
  minDistance: 0
1375
1339
  };
1376
- function createMousepress(options = {}) {
1340
+ function createPointerpress(options = {}) {
1377
1341
  const {
1378
1342
  minDuration,
1379
1343
  minDistance,
@@ -1381,31 +1345,31 @@ function createMousepress(options = {}) {
1381
1345
  onOut,
1382
1346
  onMove,
1383
1347
  onUp
1384
- } = { ...defaultOptions$i, ...options }, stop = (target) => {
1348
+ } = { ...defaultOptions$f, ...options }, stop = (target) => {
1385
1349
  window.cancelAnimationFrame(request);
1386
- target.removeEventListener("mousemove", mousemoveEffect);
1350
+ target.removeEventListener("pointermove", pointermoveEffect);
1387
1351
  };
1388
1352
  let request;
1389
- let mousemoveEffect;
1390
- let mouseStatus;
1391
- const mousedown = (event, api) => {
1392
- mouseStatus = "down";
1393
- mousemoveEffect = (event2) => mousemove(event2, api);
1353
+ let pointermoveEffect;
1354
+ let pointerStatus;
1355
+ const pointerdown = (event, api) => {
1356
+ pointerStatus = "down";
1357
+ pointermoveEffect = (event2) => pointermove(event2, api);
1394
1358
  storePointerStartMetadata({ event, api });
1395
1359
  storePointerMoveMetadata({ event, api });
1396
1360
  storePointerTimeMetadata({
1397
1361
  event,
1398
1362
  api,
1399
- getShouldStore: () => mouseStatus === "down",
1363
+ getShouldStore: () => pointerStatus === "down",
1400
1364
  setRequest: (newRequest) => request = newRequest,
1401
1365
  // @ts-expect-error
1402
1366
  recognize
1403
1367
  });
1404
- const { listenInjection: { optionsByType: { mousedown: { target } } } } = api;
1405
- target.addEventListener("mousemove", mousemoveEffect);
1368
+ const { listenInjection: { optionsByType: { pointerdown: { target } } } } = api;
1369
+ target.addEventListener("pointermove", pointermoveEffect);
1406
1370
  onDown?.(toHookApi(api));
1407
1371
  };
1408
- const mousemove = (event, api) => {
1372
+ const pointermove = (event, api) => {
1409
1373
  const { pushSequence } = api;
1410
1374
  pushSequence(event);
1411
1375
  storePointerMoveMetadata({ event, api });
@@ -1418,325 +1382,43 @@ function createMousepress(options = {}) {
1418
1382
  recognized();
1419
1383
  }
1420
1384
  };
1421
- const mouseout = (event, api) => {
1422
- const { denied, listenInjection: { optionsByType: { mouseout: { target } } } } = api;
1385
+ const pointerout = (event, api) => {
1386
+ const { denied, listenInjection: { optionsByType: { pointerout: { target } } } } = api;
1423
1387
  if (event.target !== target && target.contains?.(event.relatedTarget)) {
1424
1388
  onOut?.(toHookApi(api));
1425
1389
  return;
1426
1390
  }
1427
- if (mouseStatus === "down") {
1391
+ if (pointerStatus === "down") {
1428
1392
  denied();
1429
1393
  stop(target);
1430
- mouseStatus = "leave";
1394
+ pointerStatus = "out";
1431
1395
  }
1432
1396
  onOut?.(toHookApi(api));
1433
1397
  };
1434
- const mouseup = (event, api) => {
1435
- const { denied, listenInjection: { optionsByType: { mouseup: { target } } } } = api;
1436
- if (mouseStatus !== "down")
1437
- return;
1398
+ const pointerup = (event, api) => {
1399
+ const { denied, listenInjection: { optionsByType: { pointerup: { target } } } } = api;
1400
+ if (pointerStatus !== "down") return;
1438
1401
  denied();
1439
1402
  stop(target);
1440
- mouseStatus = "up";
1441
- onUp?.(toHookApi(api));
1442
- };
1443
- return {
1444
- mousedown: {
1445
- effect: mousedown,
1446
- stop
1447
- },
1448
- mouseout,
1449
- mouseup
1450
- };
1451
- }
1452
- class Mousepress extends Listenable {
1453
- constructor(options) {
1454
- super(
1455
- "recognizeable",
1456
- {
1457
- recognizeable: {
1458
- effects: createMousepress(options)
1459
- }
1460
- }
1461
- );
1462
- }
1463
- get metadata() {
1464
- return this.recognizeable.metadata;
1465
- }
1466
- }
1467
-
1468
- const defaultOptions$h = {
1469
- minDuration: 0,
1470
- minDistance: 0,
1471
- minVelocity: 0
1472
- };
1473
- function createMouserelease(options = {}) {
1474
- const {
1475
- minDuration,
1476
- minDistance,
1477
- minVelocity,
1478
- onDown,
1479
- onOut,
1480
- onMove,
1481
- onUp
1482
- } = { ...defaultOptions$h, ...options }, stop = (target) => {
1483
- window.cancelAnimationFrame(request);
1484
- target.removeEventListener("mousemove", mousemoveEffect);
1485
- };
1486
- let request;
1487
- let mousemoveEffect;
1488
- let mouseStatus;
1489
- const mousedown = (event, api) => {
1490
- mouseStatus = "down";
1491
- mousemoveEffect = (event2) => mousemove(event2, api);
1492
- storePointerStartMetadata({ event, api });
1493
- storePointerMoveMetadata({ event, api });
1494
- storePointerTimeMetadata({
1495
- event,
1496
- api,
1497
- getShouldStore: () => mouseStatus === "down",
1498
- setRequest: (newRequest) => request = newRequest
1499
- });
1500
- const { listenInjection: { optionsByType: { mousedown: { target } } } } = api;
1501
- target.addEventListener("mousemove", mousemoveEffect);
1502
- onDown?.(toHookApi(api));
1503
- };
1504
- const mousemove = (event, api) => {
1505
- storePointerMoveMetadata({ event, api });
1506
- onMove?.(toHookApi(api));
1507
- };
1508
- const mouseout = (event, api) => {
1509
- const { denied, listenInjection: { optionsByType: { mouseout: { target } } } } = api;
1510
- if (event.target !== target && target.contains?.(event.relatedTarget)) {
1511
- onOut?.(toHookApi(api));
1512
- return;
1513
- }
1514
- if (mouseStatus === "down") {
1515
- denied();
1516
- stop(target);
1517
- mouseStatus = "leave";
1518
- }
1519
- onOut?.(toHookApi(api));
1520
- };
1521
- const mouseup = (event, api) => {
1522
- if (mouseStatus !== "down")
1523
- return;
1524
- storePointerMoveMetadata({ event, api });
1525
- const { listenInjection: { optionsByType: { mouseup: { target } } } } = api;
1526
- stop(target);
1527
- mouseStatus = "up";
1528
- recognize(event, api);
1403
+ pointerStatus = "up";
1529
1404
  onUp?.(toHookApi(api));
1530
1405
  };
1531
- const recognize = (event, api) => {
1532
- const { getMetadata, recognized, denied } = api, metadata = getMetadata();
1533
- if (metadata.duration >= minDuration && metadata.distance.straight.fromStart >= minDistance && metadata.velocity >= minVelocity) {
1534
- recognized();
1535
- return;
1536
- }
1537
- denied();
1538
- };
1539
1406
  return {
1540
- mousedown: {
1541
- effect: mousedown,
1407
+ pointerdown: {
1408
+ effect: pointerdown,
1542
1409
  stop
1543
1410
  },
1544
- mouseout,
1545
- mouseup
1411
+ pointerout,
1412
+ pointerup
1546
1413
  };
1547
1414
  }
1548
- class Mouserelease extends Listenable {
1415
+ class Pointerpress extends Listenable {
1549
1416
  constructor(options) {
1550
1417
  super(
1551
1418
  "recognizeable",
1552
1419
  {
1553
1420
  recognizeable: {
1554
- effects: createMouserelease(options)
1555
- }
1556
- }
1557
- );
1558
- }
1559
- get metadata() {
1560
- return this.recognizeable.metadata;
1561
- }
1562
- }
1563
-
1564
- const defaultOptions$g = {
1565
- minDuration: 0,
1566
- minDistance: 0
1567
- };
1568
- function createTouchpress(options = {}) {
1569
- const {
1570
- minDuration,
1571
- minDistance,
1572
- onStart,
1573
- onCancel,
1574
- onMove,
1575
- onEnd
1576
- } = { ...defaultOptions$g, ...options }, stop = () => {
1577
- window.cancelAnimationFrame(request);
1578
- };
1579
- let request;
1580
- let totalTouches = 0;
1581
- const touchstart = (event, api) => {
1582
- const { denied } = api;
1583
- totalTouches++;
1584
- if (totalTouches > 1) {
1585
- stop();
1586
- denied();
1587
- onStart?.(toHookApi(api));
1588
- return;
1589
- }
1590
- storePointerStartMetadata({ event, api });
1591
- storePointerMoveMetadata({ event, api });
1592
- storePointerTimeMetadata({
1593
- event,
1594
- api,
1595
- getShouldStore: () => totalTouches === 1,
1596
- setRequest: (newRequest) => request = newRequest,
1597
- // @ts-expect-error
1598
- recognize
1599
- });
1600
- onStart?.(toHookApi(api));
1601
- };
1602
- const touchmove = (event, api) => {
1603
- const { getStatus } = api;
1604
- if (getStatus() !== "denied") {
1605
- storePointerMoveMetadata({ event, api });
1606
- recognize(event, api);
1607
- }
1608
- onMove?.(toHookApi(api));
1609
- };
1610
- const recognize = (event, api) => {
1611
- const { getMetadata, recognized } = api, metadata = getMetadata();
1612
- if (metadata.duration >= minDuration && metadata.distance.straight.fromStart >= minDistance) {
1613
- recognized();
1614
- }
1615
- };
1616
- const touchcancel = (event, api) => {
1617
- const { denied } = api;
1618
- stop();
1619
- denied();
1620
- totalTouches--;
1621
- onCancel?.(toHookApi(api));
1622
- };
1623
- const touchend = (event, api) => {
1624
- const { denied } = api;
1625
- stop();
1626
- denied();
1627
- totalTouches--;
1628
- onEnd?.(toHookApi(api));
1629
- };
1630
- return {
1631
- touchstart,
1632
- touchmove,
1633
- touchcancel,
1634
- touchend
1635
- };
1636
- }
1637
- class Touchpress extends Listenable {
1638
- constructor(options) {
1639
- super(
1640
- "recognizeable",
1641
- {
1642
- recognizeable: {
1643
- effects: createTouchpress(options)
1644
- }
1645
- }
1646
- );
1647
- }
1648
- get metadata() {
1649
- return this.recognizeable.metadata;
1650
- }
1651
- }
1652
-
1653
- const defaultOptions$f = {
1654
- minDuration: 0,
1655
- minDistance: 0,
1656
- minVelocity: 0
1657
- };
1658
- function createTouchrelease(options = {}) {
1659
- const {
1660
- minDuration,
1661
- minDistance,
1662
- minVelocity,
1663
- onStart,
1664
- onCancel,
1665
- onMove,
1666
- onEnd
1667
- } = { ...defaultOptions$f, ...options }, stop = () => {
1668
- window.cancelAnimationFrame(request);
1669
- };
1670
- let request;
1671
- let totalTouches = 0;
1672
- const touchstart = (event, api) => {
1673
- const { denied } = api;
1674
- totalTouches++;
1675
- if (totalTouches > 1) {
1676
- stop();
1677
- denied();
1678
- onStart?.(toHookApi(api));
1679
- return;
1680
- }
1681
- storePointerStartMetadata({ event, api });
1682
- storePointerMoveMetadata({ event, api });
1683
- storePointerTimeMetadata({
1684
- event,
1685
- api,
1686
- getShouldStore: () => totalTouches === 1,
1687
- setRequest: (newRequest) => request = newRequest
1688
- });
1689
- onStart?.(toHookApi(api));
1690
- };
1691
- const touchmove = (event, api) => {
1692
- const { getStatus } = api;
1693
- if (getStatus() !== "denied")
1694
- storePointerMoveMetadata({ event, api });
1695
- onMove?.(toHookApi(api));
1696
- };
1697
- const touchcancel = (event, api) => {
1698
- const { denied } = api;
1699
- stop();
1700
- denied();
1701
- totalTouches--;
1702
- onCancel?.(toHookApi(api));
1703
- };
1704
- const touchend = (event, api) => {
1705
- const { denied } = api;
1706
- if (totalTouches !== 1) {
1707
- stop();
1708
- denied();
1709
- onEnd?.(toHookApi(api));
1710
- return;
1711
- }
1712
- storePointerMoveMetadata({ event, api });
1713
- stop();
1714
- totalTouches--;
1715
- recognize(event, api);
1716
- onEnd?.(toHookApi(api));
1717
- };
1718
- const recognize = (event, api) => {
1719
- const { getMetadata, recognized, denied } = api, metadata = getMetadata();
1720
- if (metadata.duration >= minDuration && metadata.distance.straight.fromStart >= minDistance && metadata.velocity >= minVelocity) {
1721
- recognized();
1722
- } else {
1723
- denied();
1724
- }
1725
- };
1726
- return {
1727
- touchstart,
1728
- touchmove,
1729
- touchcancel,
1730
- touchend
1731
- };
1732
- }
1733
- class Touchrelease extends Listenable {
1734
- constructor(options) {
1735
- super(
1736
- "recognizeable",
1737
- {
1738
- recognizeable: {
1739
- effects: createTouchrelease(options)
1421
+ effects: createPointerpress(options)
1740
1422
  }
1741
1423
  }
1742
1424
  );
@@ -1749,7 +1431,7 @@ class Touchrelease extends Listenable {
1749
1431
  const defaultOptions$e = {
1750
1432
  minDuration: 0
1751
1433
  };
1752
- function createHover(options = {}) {
1434
+ function createPointerhover(options = {}) {
1753
1435
  const {
1754
1436
  minDuration,
1755
1437
  onOver,
@@ -1758,16 +1440,16 @@ function createHover(options = {}) {
1758
1440
  window.cancelAnimationFrame(request);
1759
1441
  };
1760
1442
  let request;
1761
- let mouseStatus = "exited";
1762
- const mouseover = (event, api) => {
1763
- if (mouseStatus === "exited") {
1764
- mouseStatus = "entered";
1443
+ let pointerStatus = "exited";
1444
+ const pointerover = (event, api) => {
1445
+ if (pointerStatus === "exited") {
1446
+ pointerStatus = "entered";
1765
1447
  storePointerStartMetadata({ event, api });
1766
1448
  storePointerMoveMetadata({ event, api });
1767
1449
  storePointerTimeMetadata({
1768
1450
  event,
1769
1451
  api,
1770
- getShouldStore: () => mouseStatus === "entered",
1452
+ getShouldStore: () => pointerStatus === "entered",
1771
1453
  setRequest: (newRequest) => request = newRequest,
1772
1454
  // @ts-expect-error
1773
1455
  recognize
@@ -1784,38 +1466,34 @@ function createHover(options = {}) {
1784
1466
  recognized();
1785
1467
  }
1786
1468
  };
1787
- const mouseout = (event, api) => {
1788
- const { denied, listenInjection: { optionsByType: { mouseout: { target } } } } = api;
1469
+ const pointerout = (event, api) => {
1470
+ const { denied, listenInjection: { optionsByType: { pointerout: { target } } } } = api;
1789
1471
  if (event.target !== target && target.contains?.(event.relatedTarget)) {
1790
1472
  onOut?.(toHookApi(api));
1791
1473
  return;
1792
1474
  }
1793
- if (mouseStatus === "entered") {
1475
+ if (pointerStatus === "entered") {
1794
1476
  denied();
1795
1477
  stop();
1796
- mouseStatus = "exited";
1478
+ pointerStatus = "exited";
1797
1479
  }
1798
1480
  onOut?.(toHookApi(api));
1799
1481
  };
1800
- const touchstart = (event) => {
1801
- event.preventDefault();
1802
- };
1803
1482
  return {
1804
- mouseover: {
1805
- effect: mouseover,
1483
+ pointerover: {
1484
+ effect: pointerover,
1806
1485
  stop
1807
1486
  },
1808
- mouseout,
1809
- touchstart
1487
+ pointerout
1810
1488
  };
1811
1489
  }
1812
- class Hover extends Listenable {
1490
+ class Pointerhover extends Listenable {
1813
1491
  constructor(options) {
1814
1492
  super(
1815
1493
  "recognizeable",
1816
1494
  {
1817
1495
  recognizeable: {
1818
- effects: createHover(options)
1496
+ effects: createPointerhover(options)
1819
1497
  }
1820
1498
  }
1821
1499
  );
@@ -1836,8 +1514,7 @@ function createTerminal(graph) {
1836
1514
  function createChildren(graph) {
1837
1515
  return function* (node) {
1838
1516
  const outgoing = createOutgoing(graph)(node);
1839
- for (const edge of outgoing)
1840
- yield edge.to;
1517
+ for (const edge of outgoing) yield edge.to;
1841
1518
  };
1842
1519
  }
1843
1520
  function createIndegree(graph) {
@@ -1908,11 +1585,9 @@ function createSiblings(graph) {
1908
1585
  function createFind(node) {
1909
1586
  return (tree) => {
1910
1587
  for (const treeNode of tree) {
1911
- if (treeNode.node === node)
1912
- return treeNode;
1588
+ if (treeNode.node === node) return treeNode;
1913
1589
  const found = createFind(node)(treeNode.children);
1914
- if (found)
1915
- return found;
1590
+ if (found) return found;
1916
1591
  }
1917
1592
  };
1918
1593
  }
@@ -1943,8 +1618,7 @@ function createLayers$1(options = {}) {
1943
1618
  const layers = [];
1944
1619
  for (const { path } of toSteps(directedAcyclic)) {
1945
1620
  const node = path.at(-1), depth = path.length - 1;
1946
- if (!layers[depth] && depth > 0)
1947
- yield layers[depth - 1];
1621
+ if (!layers[depth] && depth > 0) yield layers[depth - 1];
1948
1622
  (layers[depth] || (layers[depth] = [])).push(node);
1949
1623
  }
1950
1624
  yield layers.at(-1);
@@ -2036,8 +1710,7 @@ function createSteps$1(configure, options = {}) {
2036
1710
  yield { path, state: JSON.parse(JSON.stringify(state)) };
2037
1711
  function* toStep() {
2038
1712
  if (predicateExhausted(location)) {
2039
- if (includes(location)(roots))
2040
- return;
1713
+ if (includes(location)(roots)) return;
2041
1714
  state[location].status = "unset";
2042
1715
  delete state[location].value;
2043
1716
  const path3 = toPath(state);
@@ -2051,8 +1724,7 @@ function createSteps$1(configure, options = {}) {
2051
1724
  yield { path: path2, state: JSON.parse(JSON.stringify(state)) };
2052
1725
  stepFromEffect(location);
2053
1726
  const newLocation = path2.at(-1);
2054
- if (predicateSteppable(newLocation))
2055
- location = newLocation;
1727
+ if (predicateSteppable(newLocation)) location = newLocation;
2056
1728
  yield* toStep();
2057
1729
  }
2058
1730
  yield* toStep();
@@ -2062,10 +1734,8 @@ function createRoots(options = {}) {
2062
1734
  return function* (directedAcyclic) {
2063
1735
  const { nodes } = directedAcyclic, predicateRoot = createRoot(directedAcyclic);
2064
1736
  for (const node of nodes) {
2065
- if (predicateRoot(node))
2066
- yield node;
2067
- if (options.kind === "arborescence")
2068
- break;
1737
+ if (predicateRoot(node)) yield node;
1738
+ if (options.kind === "arborescence") break;
2069
1739
  }
2070
1740
  };
2071
1741
  }
@@ -2241,8 +1911,7 @@ function createSteps(configure, options = {}) {
2241
1911
  yield { path, state: JSON.parse(JSON.stringify(state)) };
2242
1912
  async function* toStep() {
2243
1913
  if (predicateExhausted(location)) {
2244
- if (includes(location)(roots))
2245
- return;
1914
+ if (includes(location)(roots)) return;
2246
1915
  state[location].status = "unset";
2247
1916
  delete state[location].value;
2248
1917
  const path3 = await toPath(state);
@@ -2256,8 +1925,7 @@ function createSteps(configure, options = {}) {
2256
1925
  yield { path: path2, state: JSON.parse(JSON.stringify(state)) };
2257
1926
  stepFromEffect(location);
2258
1927
  const newLocation = path2.at(-1);
2259
- if (predicateSteppable(newLocation))
2260
- location = newLocation;
1928
+ if (predicateSteppable(newLocation)) location = newLocation;
2261
1929
  yield* await toStep();
2262
1930
  }
2263
1931
  yield* await toStep();
@@ -2335,53 +2003,44 @@ function createFocusable(order, options = {}) {
2335
2003
  switch (order) {
2336
2004
  case "first":
2337
2005
  return (element) => {
2338
- if (predicatesElement && predicateFocusable(element))
2339
- return element;
2006
+ if (predicatesElement && predicateFocusable(element)) return element;
2340
2007
  for (let i = 0; i < element.children.length; i++) {
2341
2008
  const focusable = createFocusable(order, { predicatesElement: true })(element.children[i]);
2342
- if (focusable)
2343
- return focusable;
2009
+ if (focusable) return focusable;
2344
2010
  }
2345
2011
  };
2346
2012
  case "last":
2347
2013
  return (element) => {
2348
- if (predicatesElement && predicateFocusable(element))
2349
- return element;
2014
+ if (predicatesElement && predicateFocusable(element)) return element;
2350
2015
  for (let i = element.children.length - 1; i > -1; i--) {
2351
2016
  const focusable = createFocusable(order, { predicatesElement: true })(element.children[i]);
2352
- if (focusable)
2353
- return focusable;
2017
+ if (focusable) return focusable;
2354
2018
  }
2355
2019
  };
2356
2020
  case "next":
2357
2021
  return (element) => {
2358
- if (predicatesElement && predicateFocusable(element))
2359
- return element;
2022
+ if (predicatesElement && predicateFocusable(element)) return element;
2360
2023
  const focusable = createFocusable("first")(element);
2361
- if (focusable)
2362
- return focusable;
2024
+ if (focusable) return focusable;
2363
2025
  let current = element;
2364
2026
  while (current && current !== document.documentElement) {
2365
2027
  const nextSibling = current.nextElementSibling;
2366
2028
  if (nextSibling) {
2367
2029
  const focusable2 = createFocusable("first", { predicatesElement: true })(nextSibling);
2368
- if (focusable2)
2369
- return focusable2;
2030
+ if (focusable2) return focusable2;
2370
2031
  }
2371
2032
  current = current.nextElementSibling || current.parentElement;
2372
2033
  }
2373
2034
  };
2374
2035
  case "previous":
2375
2036
  return (element) => {
2376
- if (predicatesElement && predicateFocusable(element))
2377
- return element;
2037
+ if (predicatesElement && predicateFocusable(element)) return element;
2378
2038
  let current = element;
2379
2039
  while (current && current !== document.documentElement) {
2380
2040
  const previousSibling = current.previousElementSibling;
2381
2041
  if (previousSibling) {
2382
2042
  const focusable = createFocusable("last", { predicatesElement: true })(previousSibling);
2383
- if (focusable)
2384
- return focusable;
2043
+ if (focusable) return focusable;
2385
2044
  }
2386
2045
  current = current.previousElementSibling || current.parentElement;
2387
2046
  }
@@ -2423,19 +2082,16 @@ const createKeycomboMatch$1 = (keycombo, options = {}) => {
2423
2082
  const implicitModifier = find(
2424
2083
  (modifier) => code.includes(modifier)
2425
2084
  )(modifiers);
2426
- if (implicitModifier)
2427
- implicitModifierAliases2.push(implicitModifier.toLowerCase());
2085
+ if (implicitModifier) implicitModifierAliases2.push(implicitModifier.toLowerCase());
2428
2086
  }
2429
2087
  return implicitModifierAliases2;
2430
2088
  })();
2431
2089
  return (descriptor) => {
2432
2090
  const statuses = [];
2433
- if (descriptor.code)
2434
- createSet(fromEventToKeyStatusCode(descriptor), "down")(statuses);
2091
+ if (descriptor.code) createSet(fromEventToKeyStatusCode(descriptor), "down")(statuses);
2435
2092
  for (const modifier of modifiers) {
2436
2093
  const prefix = modifier === "Control" ? "ctrl" : modifier.toLowerCase();
2437
- if (descriptor[`${prefix}Key`])
2438
- createSet(modifier, "down")(statuses);
2094
+ if (descriptor[`${prefix}Key`]) createSet(modifier, "down")(statuses);
2439
2095
  }
2440
2096
  const descriptors = createMap(
2441
2097
  ([code]) => {
@@ -2546,8 +2202,7 @@ function createEvery(predicate) {
2546
2202
  function createSome(predicate) {
2547
2203
  return (object) => {
2548
2204
  for (const key in object) {
2549
- if (predicate(key, object[key]))
2550
- return true;
2205
+ if (predicate(key, object[key])) return true;
2551
2206
  }
2552
2207
  return false;
2553
2208
  };
@@ -2628,8 +2283,7 @@ function createDelete$2(key, options = {}) {
2628
2283
  const index = findIndex(
2629
2284
  ([candidate]) => predicateKey(candidate)
2630
2285
  )(associativeArray);
2631
- if (index === -1)
2632
- return associativeArray;
2286
+ if (index === -1) return associativeArray;
2633
2287
  associativeArray.splice(index, 1);
2634
2288
  return associativeArray;
2635
2289
  };
@@ -2699,11 +2353,9 @@ const createKeycomboDown = (keycombo, options = {}) => {
2699
2353
  };
2700
2354
 
2701
2355
  function fromKeyboardEventDescriptorToAliases(descriptor) {
2702
- if (descriptor.shiftKey && descriptor.code in aliasesByShiftCode)
2703
- return [aliasesByShiftCode[descriptor.code]];
2356
+ if (descriptor.shiftKey && descriptor.code in aliasesByShiftCode) return [aliasesByShiftCode[descriptor.code]];
2704
2357
  const withoutModifierSide = toWithoutModifierSide(descriptor.code);
2705
- if (withoutModifierSide in aliasListsByModifier)
2706
- return aliasListsByModifier[withoutModifierSide];
2358
+ if (withoutModifierSide in aliasListsByModifier) return aliasListsByModifier[withoutModifierSide];
2707
2359
  return descriptor.code in aliasesByCode ? [aliasesByCode[descriptor.code]] : [descriptor.code.match(aliasCaptureRE)?.[1].toLowerCase() || "unsupported"];
2708
2360
  }
2709
2361
  const toWithoutModifierSide = createClip(/(?:Left|Right)$/);
@@ -2874,8 +2526,7 @@ function createToIntl(_Intl) {
2874
2526
  params,
2875
2527
  { predicateKey: createDeepEqual(params) }
2876
2528
  )(intls);
2877
- if (intl)
2878
- return intl;
2529
+ if (intl) return intl;
2879
2530
  const newIntl = new _Intl(...params);
2880
2531
  createSet$2(
2881
2532
  params,
@@ -2942,7 +2593,7 @@ function toHookApi({
2942
2593
  };
2943
2594
  }
2944
2595
 
2945
- function toMousePoint(event) {
2596
+ function toPointerPoint(event) {
2946
2597
  return {
2947
2598
  x: event.clientX,
2948
2599
  y: event.clientY
@@ -2984,11 +2635,9 @@ function storeKeyboardTimeMetadata({
2984
2635
  setRequest,
2985
2636
  recognize
2986
2637
  }) {
2987
- if (!getShouldStore())
2988
- return;
2638
+ if (!getShouldStore()) return;
2989
2639
  const { getStatus, listenInjection: { effect } } = api, timeMetadata = getTimeMetadata();
2990
- if (!timeMetadata.times)
2991
- timeMetadata.times = createClone()(initialMetadata$3.times);
2640
+ if (!timeMetadata.times) timeMetadata.times = createClone()(initialMetadata$3.times);
2992
2641
  timeMetadata.times.start = Math.round(event.timeStamp);
2993
2642
  timeMetadata.times.end = Math.round(event.timeStamp);
2994
2643
  const frameEffect = (timestamp) => {
@@ -2996,18 +2645,15 @@ function storeKeyboardTimeMetadata({
2996
2645
  timeMetadata.duration = Math.max(0, timeMetadata.times.end - timeMetadata.times.start);
2997
2646
  if (recognize) {
2998
2647
  recognize(event, api);
2999
- if (getStatus() === "recognized")
3000
- effect(event);
2648
+ if (getStatus() === "recognized") effect(event);
3001
2649
  }
3002
2650
  }, storeDuration = () => {
3003
2651
  const sequence = api.getSequence();
3004
2652
  if (!document.body.contains(
3005
2653
  at(-1)(sequence).target
3006
- ))
3007
- return;
2654
+ )) return;
3008
2655
  const request = requestAnimationFrame((timestamp) => {
3009
- if (!getShouldStore())
3010
- return;
2656
+ if (!getShouldStore()) return;
3011
2657
  frameEffect(timestamp);
3012
2658
  storeDuration();
3013
2659
  });
@@ -3025,9 +2671,8 @@ const initialMetadata$2 = {
3025
2671
  };
3026
2672
  function storePointerStartMetadata({ event, api }) {
3027
2673
  const { getMetadata } = api, metadata = getMetadata();
3028
- const point = event instanceof MouseEvent ? toMousePoint(event) : toTouchMovePoint(event);
3029
- if (!metadata.points)
3030
- metadata.points = createClone()(initialMetadata$2.points);
2674
+ const point = event instanceof MouseEvent || event instanceof PointerEvent ? toPointerPoint(event) : toTouchMovePoint(event);
2675
+ if (!metadata.points) metadata.points = createClone()(initialMetadata$2.points);
3031
2676
  metadata.points.start = point;
3032
2677
  metadata.points.end = point;
3033
2678
  }
@@ -3065,7 +2710,7 @@ function storePointerMoveMetadata({ event, api }) {
3065
2710
  }
3066
2711
  const { x: previousX, y: previousY } = metadata.points.end, { x: startX, y: startY } = metadata.points.start, { x: newX, y: newY } = (() => {
3067
2712
  if (event instanceof MouseEvent) {
3068
- return toMousePoint(event);
2713
+ return toPointerPoint(event);
3069
2714
  }
3070
2715
  if (event instanceof TouchEvent) {
3071
2716
  if (event.type === "touchmove") {
@@ -3133,17 +2778,14 @@ function storePointerTimeMetadata({
3133
2778
  metadata.velocity = metadata.distance.straight.fromPrevious / durationFromPrevious || 0;
3134
2779
  const event2 = getSequence().at(-1);
3135
2780
  recognize?.(event2, api);
3136
- if (getStatus() === "recognized")
3137
- effect(event2);
2781
+ if (getStatus() === "recognized") effect(event2);
3138
2782
  }, storeDuration = () => {
3139
2783
  const sequence = api.getSequence();
3140
2784
  if (!document.contains(
3141
2785
  at(-1)(sequence).target
3142
- ))
3143
- return;
2786
+ )) return;
3144
2787
  const request = requestAnimationFrame((timestamp) => {
3145
- if (!getShouldStore())
3146
- return;
2788
+ if (!getShouldStore()) return;
3147
2789
  frameEffect(timestamp);
3148
2790
  storeDuration();
3149
2791
  });
@@ -3283,6 +2925,12 @@ function toInterpolated({ previous, next, progress }, options = {}) {
3283
2925
  }
3284
2926
  }
3285
2927
 
2928
+ var __defProp$g = Object.defineProperty;
2929
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2930
+ var __publicField$g = (obj, key, value) => __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
2931
+ function defineAnimateableKeyframes(keyframes) {
2932
+ return keyframes;
2933
+ }
3286
2934
  const defaultOptions$8 = {
3287
2935
  duration: 0,
3288
2936
  // delay not supported, because it can be effectd by delayable
@@ -3305,22 +2953,37 @@ const defaultAnimateOptions = {
3305
2953
  }
3306
2954
  };
3307
2955
  class Animateable {
3308
- initialDuration;
3309
- iterationLimit;
3310
- alternates;
3311
- controlPoints;
3312
- reversedControlPoints;
3313
- toAnimationProgress;
3314
- reversedToAnimationProgress;
3315
- playCache;
3316
- reverseCache;
3317
- pauseCache;
3318
- seekCache;
3319
- alternateCache;
3320
- visibilitychange;
3321
- getEaseables;
3322
- getReversedEaseables;
3323
2956
  constructor(keyframes, options = {}) {
2957
+ __publicField$g(this, "initialDuration");
2958
+ __publicField$g(this, "iterationLimit");
2959
+ __publicField$g(this, "alternates");
2960
+ __publicField$g(this, "controlPoints");
2961
+ __publicField$g(this, "reversedControlPoints");
2962
+ __publicField$g(this, "toAnimationProgress");
2963
+ __publicField$g(this, "reversedToAnimationProgress");
2964
+ __publicField$g(this, "playCache");
2965
+ __publicField$g(this, "reverseCache");
2966
+ __publicField$g(this, "pauseCache");
2967
+ __publicField$g(this, "seekCache");
2968
+ __publicField$g(this, "alternateCache");
2969
+ __publicField$g(this, "visibilitychange");
2970
+ __publicField$g(this, "getEaseables");
2971
+ __publicField$g(this, "getReversedEaseables");
2972
+ __publicField$g(this, "computedStatus");
2973
+ __publicField$g(this, "computedTime");
2974
+ __publicField$g(this, "computedProgress");
2975
+ __publicField$g(this, "computedIterations");
2976
+ __publicField$g(this, "computedKeyframes");
2977
+ __publicField$g(this, "reversedKeyframes");
2978
+ __publicField$g(this, "properties");
2979
+ __publicField$g(this, "easeables");
2980
+ __publicField$g(this, "reversedEaseables");
2981
+ __publicField$g(this, "computedPlaybackRate");
2982
+ __publicField$g(this, "duration");
2983
+ __publicField$g(this, "totalTimeInvisible");
2984
+ __publicField$g(this, "invisibleAt");
2985
+ __publicField$g(this, "computedRequest");
2986
+ __publicField$g(this, "startTime");
3324
2987
  this.initialDuration = options?.duration || defaultOptions$8.duration;
3325
2988
  this.controlPoints = fromTimingToControlPoints(options?.timing || defaultOptions$8.timing);
3326
2989
  this.iterationLimit = options?.iterations || defaultOptions$8.iterations;
@@ -3343,25 +3006,21 @@ class Animateable {
3343
3006
  this.resetProgress();
3344
3007
  this.resetIterations();
3345
3008
  }
3346
- computedStatus;
3347
3009
  ready() {
3348
3010
  this.computedStatus = "ready";
3349
3011
  }
3350
- computedTime;
3351
3012
  resetTime() {
3352
3013
  this.computedTime = {
3353
3014
  elapsed: 0,
3354
3015
  remaining: this.duration
3355
3016
  };
3356
3017
  }
3357
- computedProgress;
3358
3018
  resetProgress() {
3359
3019
  this.computedProgress = {
3360
3020
  time: 0,
3361
3021
  animation: 0
3362
3022
  };
3363
3023
  }
3364
- computedIterations;
3365
3024
  resetIterations() {
3366
3025
  this.computedIterations = 0;
3367
3026
  }
@@ -3392,11 +3051,6 @@ class Animateable {
3392
3051
  get progress() {
3393
3052
  return this.computedProgress;
3394
3053
  }
3395
- computedKeyframes;
3396
- reversedKeyframes;
3397
- properties;
3398
- easeables;
3399
- reversedEaseables;
3400
3054
  setKeyframes(keyframes) {
3401
3055
  this.stop();
3402
3056
  this.computedKeyframes = Array.from(keyframes).sort(({ progress: progressA }, { progress: progressB }) => progressA - progressB);
@@ -3410,9 +3064,6 @@ class Animateable {
3410
3064
  this.reversedEaseables = this.getReversedEaseables({ keyframes: this.reversedKeyframes, properties: this.properties });
3411
3065
  return this;
3412
3066
  }
3413
- computedPlaybackRate;
3414
- duration;
3415
- totalTimeInvisible;
3416
3067
  setPlaybackRate(playbackRate) {
3417
3068
  const narrowedPlaybackRate = Math.max(0, playbackRate);
3418
3069
  this.computedPlaybackRate = narrowedPlaybackRate;
@@ -3558,7 +3209,6 @@ class Animateable {
3558
3209
  reversed() {
3559
3210
  this.computedStatus = "reversed";
3560
3211
  }
3561
- invisibleAt;
3562
3212
  listenForVisibilitychange() {
3563
3213
  if (this.visibilitychange.active.size === 0) {
3564
3214
  this.totalTimeInvisible = 0;
@@ -3574,7 +3224,6 @@ class Animateable {
3574
3224
  });
3575
3225
  }
3576
3226
  }
3577
- computedRequest;
3578
3227
  createAnimate(type) {
3579
3228
  return (effect, options = {}) => {
3580
3229
  const { interpolate: interpolateOptions } = createDeepMerge(options)(defaultAnimateOptions);
@@ -3595,7 +3244,6 @@ class Animateable {
3595
3244
  return this;
3596
3245
  };
3597
3246
  }
3598
- startTime;
3599
3247
  setStartTimeAndStatus(type, timestamp) {
3600
3248
  switch (type) {
3601
3249
  case "play":
@@ -4186,17 +3834,23 @@ const easingsNetInOutBack = [
4186
3834
  1.6
4187
3835
  ];
4188
3836
 
3837
+ var __defProp$f = Object.defineProperty;
3838
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3839
+ var __publicField$f = (obj, key, value) => __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
4189
3840
  const defaultOptions$7 = {
4190
3841
  name: "baleada"
4191
3842
  };
4192
3843
  class Broadcastable {
4193
- name;
4194
3844
  constructor(state, options = {}) {
3845
+ __publicField$f(this, "name");
3846
+ __publicField$f(this, "computedStatus");
3847
+ __publicField$f(this, "computedChannel");
3848
+ __publicField$f(this, "computedError");
3849
+ __publicField$f(this, "computedState");
4195
3850
  this.setState(state);
4196
3851
  this.name = options.name ?? defaultOptions$7.name;
4197
3852
  this.ready();
4198
3853
  }
4199
- computedStatus;
4200
3854
  ready() {
4201
3855
  this.computedStatus = "ready";
4202
3856
  }
@@ -4209,15 +3863,12 @@ class Broadcastable {
4209
3863
  get status() {
4210
3864
  return this.computedStatus;
4211
3865
  }
4212
- computedChannel;
4213
3866
  get channel() {
4214
3867
  return this.computedChannel || (this.computedChannel = new BroadcastChannel(this.name));
4215
3868
  }
4216
- computedError;
4217
3869
  get error() {
4218
3870
  return this.computedError;
4219
3871
  }
4220
- computedState;
4221
3872
  setState(state) {
4222
3873
  this.computedState = state;
4223
3874
  return this;
@@ -4258,12 +3909,19 @@ function toMessageListenParams(instance, effect) {
4258
3909
  ];
4259
3910
  }
4260
3911
 
3912
+ var __defProp$e = Object.defineProperty;
3913
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3914
+ var __publicField$e = (obj, key, value) => __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
4261
3915
  const defaultOptions$6 = {
4262
3916
  locales: "en",
4263
3917
  collator: { sensitivity: "base" }
4264
3918
  };
4265
3919
  class Compareable {
4266
3920
  constructor(string, options = {}) {
3921
+ __publicField$e(this, "computedStatus");
3922
+ __publicField$e(this, "computedCollator");
3923
+ __publicField$e(this, "computedComparison");
3924
+ __publicField$e(this, "computedString");
4267
3925
  const locales = options.locales || defaultOptions$6.locales, collatorOptions = { ...defaultOptions$6.collator, ...options.collator }, key = locales + pipe(
4268
3926
  createEntries(),
4269
3927
  sort((a, b) => a[0] < b[0] ? -1 : 1),
@@ -4273,7 +3931,6 @@ class Compareable {
4273
3931
  this.setString(string);
4274
3932
  this.ready();
4275
3933
  }
4276
- computedStatus;
4277
3934
  ready() {
4278
3935
  this.computedStatus = "ready";
4279
3936
  }
@@ -4286,15 +3943,12 @@ class Compareable {
4286
3943
  get status() {
4287
3944
  return this.computedStatus;
4288
3945
  }
4289
- computedCollator;
4290
3946
  get collator() {
4291
3947
  return this.computedCollator;
4292
3948
  }
4293
- computedComparison;
4294
3949
  get comparison() {
4295
3950
  return this.computedComparison;
4296
3951
  }
4297
- computedString;
4298
3952
  setString(string) {
4299
3953
  this.computedString = string;
4300
3954
  return this;
@@ -4314,6 +3968,9 @@ class Compareable {
4314
3968
  }
4315
3969
  const cache = {};
4316
3970
 
3971
+ var __defProp$d = Object.defineProperty;
3972
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3973
+ var __publicField$d = (obj, key, value) => __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
4317
3974
  const defaultOptions$5 = {
4318
3975
  segment: {
4319
3976
  from: "start",
@@ -4326,11 +3983,14 @@ const defaultCompleteOptions = {
4326
3983
  select: "completionEnd"
4327
3984
  };
4328
3985
  class Completeable {
4329
- segmentFrom;
4330
- segmentTo;
4331
- divider;
4332
- computedDividerIndices;
4333
3986
  constructor(string, options = {}) {
3987
+ __publicField$d(this, "segmentFrom");
3988
+ __publicField$d(this, "segmentTo");
3989
+ __publicField$d(this, "divider");
3990
+ __publicField$d(this, "computedDividerIndices");
3991
+ __publicField$d(this, "computedStatus");
3992
+ __publicField$d(this, "computedString");
3993
+ __publicField$d(this, "computedSelection");
4334
3994
  this.constructing();
4335
3995
  this.segmentFrom = options?.segment?.from || defaultOptions$5.segment.from;
4336
3996
  this.segmentTo = options?.segment?.to || defaultOptions$5.segment.to;
@@ -4343,7 +4003,6 @@ class Completeable {
4343
4003
  constructing() {
4344
4004
  this.computedStatus = "constructing";
4345
4005
  }
4346
- computedStatus;
4347
4006
  ready() {
4348
4007
  this.computedStatus = "ready";
4349
4008
  }
@@ -4377,6 +4036,7 @@ class Completeable {
4377
4036
  return 0;
4378
4037
  case "selection":
4379
4038
  return this.selection.start;
4039
+ // No arithmetic needed, because the first character of the selection should be included
4380
4040
  case "divider":
4381
4041
  return this.dividerIndices.before + 1;
4382
4042
  }
@@ -4387,11 +4047,11 @@ class Completeable {
4387
4047
  return this.string.length;
4388
4048
  case "selection":
4389
4049
  return this.selection.end;
4050
+ // No arithmetic needed, because the browser sets selection end as the first character not highlighted in the selection
4390
4051
  case "divider":
4391
4052
  return this.dividerIndices.after;
4392
4053
  }
4393
4054
  }
4394
- computedString;
4395
4055
  setString(string) {
4396
4056
  this.computedString = string;
4397
4057
  switch (this.status) {
@@ -4403,7 +4063,6 @@ class Completeable {
4403
4063
  }
4404
4064
  return this;
4405
4065
  }
4406
- computedSelection;
4407
4066
  setSelection(selection) {
4408
4067
  this.computedSelection = selection;
4409
4068
  this.setDividerIndices();
@@ -4494,12 +4153,19 @@ function toNextMatch({ string, re, from }) {
4494
4153
  return indexOf;
4495
4154
  }
4496
4155
 
4156
+ var __defProp$c = Object.defineProperty;
4157
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4158
+ var __publicField$c = (obj, key, value) => __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
4497
4159
  class Copyable {
4498
- computedIsClipboardText;
4499
- copyListenable;
4500
- cutListenable;
4501
- copyAndCutEffect;
4502
4160
  constructor(string, options = {}) {
4161
+ __publicField$c(this, "computedIsClipboardText");
4162
+ __publicField$c(this, "copyListenable");
4163
+ __publicField$c(this, "cutListenable");
4164
+ __publicField$c(this, "copyAndCutEffect");
4165
+ __publicField$c(this, "computedStatus");
4166
+ __publicField$c(this, "computedString");
4167
+ __publicField$c(this, "computedResponse");
4168
+ __publicField$c(this, "computedError");
4503
4169
  this.computedIsClipboardText = false;
4504
4170
  this.copyListenable = new Listenable("copy");
4505
4171
  this.cutListenable = new Listenable("cut");
@@ -4510,7 +4176,6 @@ class Copyable {
4510
4176
  this.setString(string);
4511
4177
  this.ready();
4512
4178
  }
4513
- computedStatus;
4514
4179
  ready() {
4515
4180
  this.computedStatus = "ready";
4516
4181
  }
@@ -4532,13 +4197,10 @@ class Copyable {
4532
4197
  get error() {
4533
4198
  return this.computedError;
4534
4199
  }
4535
- computedString;
4536
4200
  setString(string) {
4537
4201
  this.computedString = string;
4538
4202
  return this;
4539
4203
  }
4540
- computedResponse;
4541
- computedError;
4542
4204
  async copy(options = { kind: "clipboard" }) {
4543
4205
  this.copying();
4544
4206
  const { kind } = options;
@@ -4586,13 +4248,19 @@ class Copyable {
4586
4248
  }
4587
4249
  }
4588
4250
 
4251
+ var __defProp$b = Object.defineProperty;
4252
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4253
+ var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
4589
4254
  const defaultOptions$4 = {
4590
4255
  delay: 0,
4591
4256
  executions: 1
4592
4257
  };
4593
4258
  class Delayable {
4594
- animateable;
4595
4259
  constructor(effect, options = {}) {
4260
+ __publicField$b(this, "animateable");
4261
+ __publicField$b(this, "computedStatus");
4262
+ __publicField$b(this, "computedEffect");
4263
+ __publicField$b(this, "frameEffect");
4596
4264
  this.animateable = new Animateable(
4597
4265
  [
4598
4266
  { progress: 0, properties: { progress: 0 } },
@@ -4606,7 +4274,6 @@ class Delayable {
4606
4274
  this.setEffect(effect);
4607
4275
  this.ready();
4608
4276
  }
4609
- computedStatus;
4610
4277
  ready() {
4611
4278
  this.computedStatus = "ready";
4612
4279
  }
@@ -4628,14 +4295,12 @@ class Delayable {
4628
4295
  get progress() {
4629
4296
  return this.animateable.progress.time;
4630
4297
  }
4631
- computedEffect;
4632
4298
  setEffect(effect) {
4633
4299
  this.stop();
4634
4300
  this.computedEffect = effect;
4635
4301
  this.setFrameEffect(effect);
4636
4302
  return this;
4637
4303
  }
4638
- frameEffect;
4639
4304
  setFrameEffect(effect) {
4640
4305
  this.frameEffect = (frame) => {
4641
4306
  const { properties: { progress }, timestamp } = frame;
@@ -4733,18 +4398,22 @@ class Delayable {
4733
4398
  }
4734
4399
  }
4735
4400
 
4401
+ var __defProp$a = Object.defineProperty;
4402
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4403
+ var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
4736
4404
  const defaultOptions$3 = {
4737
4405
  toD: (stroke) => stroke.length === 0 ? "" : toD(stroke)
4738
4406
  };
4739
4407
  class Drawable {
4740
- computedD;
4741
- toD;
4742
4408
  constructor(stroke, options = {}) {
4409
+ __publicField$a(this, "computedD");
4410
+ __publicField$a(this, "toD");
4411
+ __publicField$a(this, "computedStatus");
4412
+ __publicField$a(this, "computedStroke");
4743
4413
  this.toD = options?.toD || defaultOptions$3.toD;
4744
4414
  this.setStroke(stroke);
4745
4415
  this.ready();
4746
4416
  }
4747
- computedStatus;
4748
4417
  ready() {
4749
4418
  this.computedStatus = "ready";
4750
4419
  }
@@ -4760,7 +4429,6 @@ class Drawable {
4760
4429
  get d() {
4761
4430
  return this.computedD;
4762
4431
  }
4763
- computedStroke;
4764
4432
  setStroke(stroke) {
4765
4433
  this.computedStroke = stroke;
4766
4434
  this.computedD = this.toD(stroke);
@@ -4780,8 +4448,7 @@ class Drawable {
4780
4448
  }
4781
4449
  }
4782
4450
  function toD(stroke) {
4783
- if (stroke.length < 4)
4784
- return "";
4451
+ if (stroke.length < 4) return "";
4785
4452
  let a = stroke[0];
4786
4453
  let b = stroke[1];
4787
4454
  const c = stroke[2];
@@ -4794,8 +4461,7 @@ function toD(stroke) {
4794
4461
  return `${result}Z`;
4795
4462
  }
4796
4463
  function toFlattenedD(stroke) {
4797
- if (stroke.length === 0)
4798
- return "";
4464
+ if (stroke.length === 0) return "";
4799
4465
  const faces = polygonClipping.union([stroke]);
4800
4466
  const flattenedD = [];
4801
4467
  for (const face of faces) {
@@ -4807,12 +4473,18 @@ function toFlattenedD(stroke) {
4807
4473
  }
4808
4474
  const toSpaceSeparated = join(" ");
4809
4475
 
4476
+ var __defProp$9 = Object.defineProperty;
4477
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4478
+ var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
4810
4479
  class Resolveable {
4811
4480
  constructor(getPromise, options = {}) {
4481
+ __publicField$9(this, "computedStatus");
4482
+ __publicField$9(this, "computedGetPromise");
4483
+ __publicField$9(this, "computedValue");
4484
+ __publicField$9(this, "computedError");
4812
4485
  this.setGetPromise(getPromise);
4813
4486
  this.ready();
4814
4487
  }
4815
- computedStatus;
4816
4488
  ready() {
4817
4489
  this.computedStatus = "ready";
4818
4490
  }
@@ -4831,13 +4503,10 @@ class Resolveable {
4831
4503
  get error() {
4832
4504
  return this.computedError;
4833
4505
  }
4834
- computedGetPromise;
4835
4506
  setGetPromise(getPromise) {
4836
4507
  this.computedGetPromise = getPromise;
4837
4508
  return this;
4838
4509
  }
4839
- computedValue;
4840
- computedError;
4841
4510
  async resolve() {
4842
4511
  this.resolving();
4843
4512
  try {
@@ -4860,13 +4529,23 @@ class Resolveable {
4860
4529
  }
4861
4530
  }
4862
4531
 
4532
+ var __defProp$8 = Object.defineProperty;
4533
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4534
+ var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
4863
4535
  class Fetchable {
4864
- computedArrayBuffer;
4865
- computedBlob;
4866
- computedFormData;
4867
- computedJson;
4868
- computedText;
4869
4536
  constructor(resource, options = {}) {
4537
+ __publicField$8(this, "computedArrayBuffer");
4538
+ __publicField$8(this, "computedBlob");
4539
+ __publicField$8(this, "computedFormData");
4540
+ __publicField$8(this, "computedJson");
4541
+ __publicField$8(this, "computedText");
4542
+ __publicField$8(this, "computedStatus");
4543
+ __publicField$8(this, "computedKy");
4544
+ __publicField$8(this, "computedAbortController");
4545
+ __publicField$8(this, "computedRetryCount", 0);
4546
+ __publicField$8(this, "computedResource");
4547
+ __publicField$8(this, "computedResponse");
4548
+ __publicField$8(this, "computedError");
4870
4549
  this.setResource(resource);
4871
4550
  this.computedKy = ky.create(narrowOptions(options.ky));
4872
4551
  this.computedArrayBuffer = new Resolveable(async () => "arrayBuffer" in this.response ? await this.response.arrayBuffer() : void 0);
@@ -4876,7 +4555,6 @@ class Fetchable {
4876
4555
  this.computedText = new Resolveable(async () => "text" in this.response ? await this.response.text() : void 0);
4877
4556
  this.ready();
4878
4557
  }
4879
- computedStatus;
4880
4558
  ready() {
4881
4559
  this.computedStatus = "ready";
4882
4560
  }
@@ -4889,17 +4567,13 @@ class Fetchable {
4889
4567
  get status() {
4890
4568
  return this.computedStatus;
4891
4569
  }
4892
- computedKy;
4893
4570
  get ky() {
4894
4571
  return this.computedKy;
4895
4572
  }
4896
- computedAbortController;
4897
4573
  get abortController() {
4898
- if (!this.computedAbortController)
4899
- this.computedAbortController = new AbortController();
4574
+ if (!this.computedAbortController) this.computedAbortController = new AbortController();
4900
4575
  return this.computedAbortController;
4901
4576
  }
4902
- computedRetryCount = 0;
4903
4577
  get retryCount() {
4904
4578
  return this.computedRetryCount;
4905
4579
  }
@@ -4924,13 +4598,10 @@ class Fetchable {
4924
4598
  get text() {
4925
4599
  return this.computedText;
4926
4600
  }
4927
- computedResource;
4928
4601
  setResource(resource) {
4929
4602
  this.computedResource = resource;
4930
4603
  return this;
4931
4604
  }
4932
- computedResponse;
4933
- computedError;
4934
4605
  async fetch(options = {}) {
4935
4606
  this.fetching();
4936
4607
  try {
@@ -4954,10 +4625,8 @@ class Fetchable {
4954
4625
  this.fetched();
4955
4626
  } catch (error) {
4956
4627
  this.computedError = error;
4957
- if (error.name === "AbortError")
4958
- this.aborted();
4959
- else
4960
- this.errored();
4628
+ if (error.name === "AbortError") this.aborted();
4629
+ else this.errored();
4961
4630
  }
4962
4631
  return this;
4963
4632
  }
@@ -5006,17 +4675,21 @@ class Fetchable {
5006
4675
  }
5007
4676
  }
5008
4677
  function narrowOptions(options) {
5009
- if (!options)
5010
- return {};
4678
+ if (!options) return {};
5011
4679
  return predicateFunction(options) ? options({ stop: ky.stop }) : options;
5012
4680
  }
5013
4681
 
4682
+ var __defProp$7 = Object.defineProperty;
4683
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4684
+ var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
5014
4685
  class Fullscreenable {
5015
4686
  constructor(getElement, options = {}) {
4687
+ __publicField$7(this, "computedStatus");
4688
+ __publicField$7(this, "computedGetElement");
4689
+ __publicField$7(this, "computedError");
5016
4690
  this.setGetElement(getElement);
5017
4691
  this.ready();
5018
4692
  }
5019
- computedStatus;
5020
4693
  ready() {
5021
4694
  this.computedStatus = "ready";
5022
4695
  }
@@ -5035,7 +4708,6 @@ class Fullscreenable {
5035
4708
  get error() {
5036
4709
  return this.computedError;
5037
4710
  }
5038
- computedGetElement;
5039
4711
  setGetElement(getElement) {
5040
4712
  this.computedGetElement = () => getElement();
5041
4713
  return this;
@@ -5044,7 +4716,6 @@ class Fullscreenable {
5044
4716
  await this.fullscreen(options);
5045
4717
  return this;
5046
4718
  }
5047
- computedError;
5048
4719
  async fullscreen(options = {}) {
5049
4720
  try {
5050
4721
  await this.element.requestFullscreen(options);
@@ -5076,12 +4747,18 @@ class Fullscreenable {
5076
4747
  }
5077
4748
  }
5078
4749
 
4750
+ var __defProp$6 = Object.defineProperty;
4751
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4752
+ var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
5079
4753
  class Grantable {
5080
4754
  constructor(descriptor, options = {}) {
4755
+ __publicField$6(this, "computedStatus");
4756
+ __publicField$6(this, "computedDescriptor");
4757
+ __publicField$6(this, "computedPermission");
4758
+ __publicField$6(this, "computedError");
5081
4759
  this.setDescriptor(descriptor);
5082
4760
  this.ready();
5083
4761
  }
5084
- computedStatus;
5085
4762
  ready() {
5086
4763
  this.computedStatus = "ready";
5087
4764
  }
@@ -5100,13 +4777,10 @@ class Grantable {
5100
4777
  get status() {
5101
4778
  return this.computedStatus;
5102
4779
  }
5103
- computedDescriptor;
5104
4780
  setDescriptor(descriptor) {
5105
4781
  this.computedDescriptor = descriptor;
5106
4782
  return this;
5107
4783
  }
5108
- computedPermission;
5109
- computedError;
5110
4784
  async grant() {
5111
4785
  this.granting();
5112
4786
  try {
@@ -5129,6 +4803,9 @@ class Grantable {
5129
4803
  }
5130
4804
  }
5131
4805
 
4806
+ var __defProp$5 = Object.defineProperty;
4807
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4808
+ var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
5132
4809
  const defaultOptions$2 = {
5133
4810
  initialLocation: 0
5134
4811
  };
@@ -5139,22 +4816,22 @@ const defaultNextAndPreviousOptions = {
5139
4816
  };
5140
4817
  class Navigateable {
5141
4818
  constructor(array, options = {}) {
4819
+ __publicField$5(this, "computedStatus");
4820
+ __publicField$5(this, "computedArray");
4821
+ __publicField$5(this, "computedLocation");
5142
4822
  this.setArray(array);
5143
4823
  this.navigate(options?.initialLocation ?? defaultOptions$2.initialLocation);
5144
4824
  this.ready();
5145
4825
  }
5146
- computedStatus;
5147
4826
  ready() {
5148
4827
  this.computedStatus = "ready";
5149
4828
  }
5150
- computedArray;
5151
4829
  get array() {
5152
4830
  return this.computedArray;
5153
4831
  }
5154
4832
  set array(value) {
5155
4833
  this.setArray(value);
5156
4834
  }
5157
- computedLocation;
5158
4835
  get location() {
5159
4836
  return this.computedLocation;
5160
4837
  }
@@ -5273,6 +4950,183 @@ class Navigateable {
5273
4950
  }
5274
4951
  }
5275
4952
 
4953
+ var __defProp$4 = Object.defineProperty;
4954
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4955
+ var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
4956
+ function createDefineObjectStore() {
4957
+ return (transaction, storeName) => {
4958
+ return transaction.objectStore(storeName);
4959
+ };
4960
+ }
4961
+ class Operateable {
4962
+ constructor(objectStore, options = {}) {
4963
+ __publicField$4(this, "listenables", []);
4964
+ __publicField$4(this, "computedObjectStore");
4965
+ __publicField$4(this, "computedStatus");
4966
+ __publicField$4(this, "computedError");
4967
+ this.computedObjectStore = objectStore;
4968
+ this.ready();
4969
+ }
4970
+ ready() {
4971
+ this.computedStatus = "ready";
4972
+ }
4973
+ get objectStore() {
4974
+ return this.computedObjectStore;
4975
+ }
4976
+ set objectStore(objectStore) {
4977
+ this.setObjectStore(objectStore);
4978
+ }
4979
+ get status() {
4980
+ return this.computedStatus;
4981
+ }
4982
+ get error() {
4983
+ return this.computedError;
4984
+ }
4985
+ setObjectStore(objectStore) {
4986
+ this.stop();
4987
+ this.computedObjectStore = objectStore;
4988
+ return this;
4989
+ }
4990
+ operate(descriptors) {
4991
+ if (!descriptors.length) {
4992
+ this.operated();
4993
+ return this;
4994
+ }
4995
+ this.operating();
4996
+ const [present, ...future] = descriptors, { operation } = present, request = (() => {
4997
+ switch (operation) {
4998
+ case "add": {
4999
+ const { value, key } = present;
5000
+ return this.objectStore.add(value, key);
5001
+ }
5002
+ case "put": {
5003
+ const { value, key } = present;
5004
+ return this.objectStore.put(value, key);
5005
+ }
5006
+ case "get": {
5007
+ const { query } = present;
5008
+ return this.objectStore.get(query);
5009
+ }
5010
+ case "getKey": {
5011
+ const { query } = present;
5012
+ return this.objectStore.getKey(query);
5013
+ }
5014
+ case "getAll": {
5015
+ const { query, count } = present;
5016
+ return this.objectStore.getAll(query, count);
5017
+ }
5018
+ case "getAllKeys": {
5019
+ const { query, count } = present;
5020
+ return this.objectStore.getAllKeys(query, count);
5021
+ }
5022
+ case "getAllRecords": {
5023
+ const { query, count } = present;
5024
+ return this.objectStore.getAllRecords(query, count);
5025
+ }
5026
+ case "delete": {
5027
+ const { query } = present;
5028
+ return this.objectStore.delete(query);
5029
+ }
5030
+ case "clear":
5031
+ return this.objectStore.clear();
5032
+ case "count": {
5033
+ const { query } = present;
5034
+ return this.objectStore.count(query);
5035
+ }
5036
+ case "openCursor": {
5037
+ const { query, direction } = present;
5038
+ return this.objectStore.openCursor(query, direction);
5039
+ }
5040
+ case "openKeyCursor": {
5041
+ const { query, direction } = present;
5042
+ return this.objectStore.openKeyCursor(query, direction);
5043
+ }
5044
+ }
5045
+ })(), listenables = [
5046
+ new Listenable("success").listen(
5047
+ () => {
5048
+ if (!operation.includes("Cursor") || !request.result) stopListenables();
5049
+ if ("effect" in present) present.effect?.(request.result);
5050
+ if (!future.length) {
5051
+ this.operated();
5052
+ return;
5053
+ }
5054
+ this.operate(future);
5055
+ },
5056
+ { target: request }
5057
+ ),
5058
+ new Listenable("error").listen(
5059
+ () => {
5060
+ stopListenables();
5061
+ this.computedError = request.error;
5062
+ this.errored();
5063
+ },
5064
+ { target: request }
5065
+ )
5066
+ ], stopListenables = () => this.stopListenables(listenables);
5067
+ this.listenables.push(...listenables);
5068
+ return this;
5069
+ }
5070
+ operating() {
5071
+ this.computedStatus = "operating";
5072
+ }
5073
+ operated() {
5074
+ this.computedStatus = "operated";
5075
+ }
5076
+ errored() {
5077
+ this.computedStatus = "errored";
5078
+ }
5079
+ add(descriptor) {
5080
+ return this.operate([{ ...descriptor, operation: "add" }]);
5081
+ }
5082
+ put(descriptor) {
5083
+ return this.operate([{ ...descriptor, operation: "put" }]);
5084
+ }
5085
+ get(descriptor) {
5086
+ return this.operate([{ ...descriptor, operation: "get" }]);
5087
+ }
5088
+ getKey(descriptor) {
5089
+ return this.operate([{ ...descriptor, operation: "getKey" }]);
5090
+ }
5091
+ getAll(descriptor) {
5092
+ return this.operate([{ ...descriptor, operation: "getAll" }]);
5093
+ }
5094
+ getAllKeys(descriptor) {
5095
+ return this.operate([{ ...descriptor, operation: "getAllKeys" }]);
5096
+ }
5097
+ getAllRecords(descriptor) {
5098
+ return this.operate([{ ...descriptor, operation: "getAllRecords" }]);
5099
+ }
5100
+ delete(descriptor) {
5101
+ return this.operate([{ ...descriptor, operation: "delete" }]);
5102
+ }
5103
+ clear(descriptor) {
5104
+ return this.operate([{ ...descriptor, operation: "clear" }]);
5105
+ }
5106
+ count(descriptor) {
5107
+ return this.operate([{ ...descriptor, operation: "count" }]);
5108
+ }
5109
+ openCursor(descriptor) {
5110
+ return this.operate([{ ...descriptor, operation: "openCursor" }]);
5111
+ }
5112
+ openKeyCursor(descriptor) {
5113
+ return this.operate([{ ...descriptor, operation: "openKeyCursor" }]);
5114
+ }
5115
+ stop() {
5116
+ this.stopListenables(this.listenables);
5117
+ return this;
5118
+ }
5119
+ stopListenables(listenables) {
5120
+ for (const listenable of listenables) listenable.stop();
5121
+ this.listenables = createFilter(
5122
+ (l) => !includes(l)(listenables)
5123
+ )(this.listenables);
5124
+ }
5125
+ }
5126
+
5127
+ var __defProp$3 = Object.defineProperty;
5128
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5129
+ var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
5276
5130
  const defaultOptions$1 = {
5277
5131
  initialPicks: []
5278
5132
  };
@@ -5282,33 +5136,36 @@ const defaultPickOptions = {
5282
5136
  };
5283
5137
  class Pickable {
5284
5138
  constructor(array, options = {}) {
5139
+ __publicField$3(this, "computedStatus");
5140
+ __publicField$3(this, "computedArray");
5141
+ __publicField$3(this, "computedPicks");
5142
+ __publicField$3(this, "computedFirst");
5143
+ __publicField$3(this, "computedLast");
5144
+ __publicField$3(this, "toItems", createMap((index) => this.array[index]));
5145
+ __publicField$3(this, "computedMultiple");
5146
+ __publicField$3(this, "toPossiblePicks");
5285
5147
  this.setArray(array);
5286
5148
  this.pick(options.initialPicks ?? defaultOptions$1.initialPicks);
5287
5149
  this.ready();
5288
5150
  }
5289
- computedStatus;
5290
5151
  ready() {
5291
5152
  this.computedStatus = "ready";
5292
5153
  }
5293
- computedArray;
5294
5154
  get array() {
5295
5155
  return this.computedArray;
5296
5156
  }
5297
5157
  set array(array) {
5298
5158
  this.setArray(array);
5299
5159
  }
5300
- computedPicks;
5301
5160
  get picks() {
5302
5161
  return this.computedPicks;
5303
5162
  }
5304
5163
  set picks(indices) {
5305
5164
  this.pick(indices);
5306
5165
  }
5307
- computedFirst;
5308
5166
  get first() {
5309
5167
  return this.computedFirst;
5310
5168
  }
5311
- computedLast;
5312
5169
  get last() {
5313
5170
  return this.computedLast;
5314
5171
  }
@@ -5321,15 +5178,12 @@ class Pickable {
5321
5178
  get items() {
5322
5179
  return this.toItems(this.picks);
5323
5180
  }
5324
- toItems = createMap((index) => this.array[index]);
5325
- computedMultiple;
5326
5181
  get multiple() {
5327
5182
  return this.computedMultiple;
5328
5183
  }
5329
5184
  get status() {
5330
5185
  return this.computedStatus;
5331
5186
  }
5332
- toPossiblePicks;
5333
5187
  setArray(array) {
5334
5188
  this.computedArray = array;
5335
5189
  this.toPossiblePicks = createFilter((index) => index >= 0 && index < array.length);
@@ -5344,8 +5198,7 @@ class Pickable {
5344
5198
  narrowIndices,
5345
5199
  this.toPossiblePicks,
5346
5200
  (possiblePicks) => {
5347
- if (replace === "all")
5348
- return allowsDuplicates ? possiblePicks : toUnique(possiblePicks);
5201
+ if (replace === "all") return allowsDuplicates ? possiblePicks : toUnique(possiblePicks);
5349
5202
  const maybeWithoutDuplicates = allowsDuplicates ? possiblePicks : createFilter(
5350
5203
  (possiblePick) => typeof find((pick) => pick === possiblePick)(this.picks || []) !== "number"
5351
5204
  )(possiblePicks);
@@ -5422,12 +5275,18 @@ function narrowIndices(indexOrIndices) {
5422
5275
  }
5423
5276
  const toUnique = createUnique();
5424
5277
 
5278
+ var __defProp$2 = Object.defineProperty;
5279
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5280
+ var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
5425
5281
  class Shareable {
5426
5282
  constructor(shareData, options = {}) {
5283
+ __publicField$2(this, "computedStatus");
5284
+ __publicField$2(this, "computedCan");
5285
+ __publicField$2(this, "computedError");
5286
+ __publicField$2(this, "computedState");
5427
5287
  this.setShareData(shareData);
5428
5288
  this.ready();
5429
5289
  }
5430
- computedStatus;
5431
5290
  ready() {
5432
5291
  this.computedStatus = "ready";
5433
5292
  }
@@ -5440,15 +5299,12 @@ class Shareable {
5440
5299
  get status() {
5441
5300
  return this.computedStatus;
5442
5301
  }
5443
- computedCan;
5444
5302
  get can() {
5445
5303
  return this.computedCan;
5446
5304
  }
5447
- computedError;
5448
5305
  get error() {
5449
5306
  return this.computedError;
5450
5307
  }
5451
- computedState;
5452
5308
  setShareData(shareData) {
5453
5309
  this.computedState = shareData;
5454
5310
  this.computedCan = new Resolveable(async () => await navigator.canShare(shareData));
@@ -5476,14 +5332,22 @@ class Shareable {
5476
5332
  }
5477
5333
  }
5478
5334
 
5335
+ var __defProp$1 = Object.defineProperty;
5336
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5337
+ var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
5479
5338
  const defaultOptions = {
5480
5339
  kind: "local",
5481
5340
  statusKeySuffix: " status"
5482
5341
  };
5483
5342
  class Storeable {
5484
- kind;
5485
- statusKeySuffix;
5486
5343
  constructor(key, options = {}) {
5344
+ __publicField$1(this, "kind");
5345
+ __publicField$1(this, "statusKeySuffix");
5346
+ __publicField$1(this, "computedStatus");
5347
+ __publicField$1(this, "computedKey");
5348
+ __publicField$1(this, "computedStatusKey");
5349
+ __publicField$1(this, "computedString");
5350
+ __publicField$1(this, "computedError");
5487
5351
  this.constructing();
5488
5352
  this.kind = options.kind ?? defaultOptions.kind;
5489
5353
  this.statusKeySuffix = options.statusKeySuffix ?? defaultOptions.statusKeySuffix;
@@ -5493,7 +5357,6 @@ class Storeable {
5493
5357
  constructing() {
5494
5358
  this.computedStatus = "constructing";
5495
5359
  }
5496
- computedStatus;
5497
5360
  ready() {
5498
5361
  this.computedStatus = "ready";
5499
5362
  if (getDomAvailability() === "available") {
@@ -5531,8 +5394,6 @@ class Storeable {
5531
5394
  get error() {
5532
5395
  return this.computedError;
5533
5396
  }
5534
- computedKey;
5535
- computedStatusKey;
5536
5397
  setKey(key) {
5537
5398
  let string;
5538
5399
  switch (this.status) {
@@ -5558,8 +5419,6 @@ class Storeable {
5558
5419
  }
5559
5420
  return this;
5560
5421
  }
5561
- computedString;
5562
- computedError;
5563
5422
  store(string) {
5564
5423
  try {
5565
5424
  this.storage.setItem(this.key, string);
@@ -5597,4 +5456,361 @@ class Storeable {
5597
5456
  }
5598
5457
  }
5599
5458
 
5600
- export { Animateable, Broadcastable, Compareable, Completeable, Copyable, Delayable, Drawable, Fetchable, Fullscreenable, Grantable, Hover, Keychord, Keypress, Keyrelease, Konami, Listenable, Mousepress, Mouserelease, Navigateable, Pickable, Recognizeable, Resolveable, Shareable, Storeable, Touchpress, Touchrelease, createFormat$2 as createArrayFormat, createClear$2 as createAssociativeArrayClear, createDelete$2 as createAssociativeArrayDelete, createHas$1 as createAssociativeArrayHas, createKeys$1 as createAssociativeArrayKeys, createSet$2 as createAssociativeArraySet, createValue$2 as createAssociativeArrayValue, createValues$1 as createAssociativeArrayValues, createBreadthPathConfig, createChildren, createClamp, createClear$1 as createClear, createClip, createClone, createComputedStyle, createConcat, createFormat$1 as createDateFormat, createAncestor$1 as createDecisionTreeAncestor, createCommonAncestors$1 as createDecisionTreeCommonAncestors, createNodeDepthFirstSteps$1 as createDecisionTreeNodeDepthFirstSteps, createPath$1 as createDecisionTreePath, createDepthFirstSteps$1 as createDecisionTreeSteps, createTree$1 as createDecisionTreeTree, createDeepEqual, createDeepMerge, createDelete$1 as createDelete, createDepthPathConfig, createDetermine, createAncestor$2 as createDirectedAcyclicAncestor, createAncestor as createDirectedAcyclicAsyncAncestor, createCommonAncestors as createDirectedAcyclicAsyncCommonAncestors, createDepthFirstSteps as createDirectedAcyclicAsyncDepthFirstSteps, createLayers as createDirectedAcyclicAsyncLayers, createNodeDepthFirstSteps as createDirectedAcyclicAsyncNodeDepthFirstSteps, createPath as createDirectedAcyclicAsyncPath, createTree as createDirectedAcyclicAsyncTree, createCommonAncestors$2 as createDirectedAcyclicCommonAncestors, createDepthFirstSteps$2 as createDirectedAcyclicDepthFirstSteps, createLayers$1 as createDirectedAcyclicLayers, createNodeDepthFirstSteps$2 as createDirectedAcyclicNodeDepthFirstSteps, createPath$2 as createDirectedAcyclicPath, createRoots as createDirectedAcyclicRoots, createTree$2 as createDirectedAcyclicTree, createEntries, createEqual, createEvery, createFilter, createFilterAsync, createFindAsync, createFindIndexAsync, createFocusable, createForEachAsync, createGraph, createGreater, createGreaterOrEqual, createHas, createHover, createIncoming, createIndegree, createInsert, createKeychord, createKeycomboMatch$1 as createKeycomboMatch, createKeypress, createKeyrelease, createKeys, createKonami, createLess, createLessOrEqual, createList, createMap, createMapAsync, createMix, createMousepress, createMouserelease, createNumber, createFormat as createNumberFormat, createOmit, createOnlyChild, createOutdegree, createOutgoing, createPick, createReduce, createReduceAsync, createRemove, createReorder, createReplace, createResults, createReverse, createRoot, createSanitize, createSet$1 as createSet, createShuffle, createSiblings, createSlice, createSlug, createSome, createSort, createSwap, createTerminal, createTotalSiblings, createTouchpress, createTouchrelease, createFind as createTreeFind, createTry, createTryAsync, createUnique, createValue$1 as createValue, defineAssociativeArray, defineGraph, defineGraphAsync, defineGraphAsyncEdge, defineGraphAsyncEdges, defineGraphEdge, defineGraphEdges, defineGraphNode, defineGraphNodes, easingsNetInBack, easingsNetInCirc, easingsNetInCubic, easingsNetInExpo, easingsNetInOutBack, easingsNetInOutCirc, easingsNetInOutCubic, easingsNetInOutExpo, easingsNetInOutQuad, easingsNetInOutQuint, easingsNetInOutSine, easingsNetInQuad, easingsNetInQuart, easingsNetInQuint, easingsNetInSine, easingsNetOutBack, easingsNetOutCirc, easingsNetOutCubic, easingsNetOutExpo, easingsNetOutQuad, easingsNetOutQuint, easingsNetOutSine, fromAliasToCode, fromCodeToAliases, fromKeyboardEventDescriptorToAliases, fromShorthandAliasToLonghandAlias, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, toMessageListenParams, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };
5459
+ var __defProp = Object.defineProperty;
5460
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5461
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5462
+ class Transactable {
5463
+ constructor(name, options = {}) {
5464
+ __publicField(this, "computedStatus");
5465
+ __publicField(this, "listenables", []);
5466
+ __publicField(this, "computedDb");
5467
+ __publicField(this, "computedError");
5468
+ __publicField(this, "computedName");
5469
+ this.constructing();
5470
+ this.computedName = name;
5471
+ this.ready();
5472
+ }
5473
+ constructing() {
5474
+ this.computedStatus = "constructing";
5475
+ }
5476
+ ready() {
5477
+ this.computedStatus = "ready";
5478
+ }
5479
+ get name() {
5480
+ return this.computedName;
5481
+ }
5482
+ set name(name) {
5483
+ this.setName(name);
5484
+ }
5485
+ get db() {
5486
+ return this.computedDb;
5487
+ }
5488
+ get error() {
5489
+ return this.computedError;
5490
+ }
5491
+ get status() {
5492
+ return this.computedStatus;
5493
+ }
5494
+ setName(name) {
5495
+ this.stop();
5496
+ this.computedName = name;
5497
+ return this;
5498
+ }
5499
+ open(options = {}) {
5500
+ const { version } = options, status = this.status;
5501
+ this.opening();
5502
+ switch (status) {
5503
+ // IDB is not open-ish, IDB is not expected to open
5504
+ case "constructing":
5505
+ case "ready":
5506
+ case "openerrored":
5507
+ case "closed":
5508
+ case "deleted":
5509
+ case "closing":
5510
+ case "deleteerrored":
5511
+ case "deleting":
5512
+ this.requestOpen(options);
5513
+ return this;
5514
+ // IDB is not open-ish, IDB is expected to open
5515
+ case "opening":
5516
+ return this;
5517
+ // IDB is open-ish
5518
+ case "openblocked":
5519
+ case "opened":
5520
+ case "transacting":
5521
+ case "transacted":
5522
+ case "transacterrored":
5523
+ case "transactaborted":
5524
+ case "upgradeneeded":
5525
+ if (version ?? -1 > this.db.version) {
5526
+ this.requestOpen(options);
5527
+ return this;
5528
+ }
5529
+ this[status]();
5530
+ return this;
5531
+ }
5532
+ }
5533
+ requestOpen(options) {
5534
+ const { version, upgradeEffect } = options, request = indexedDB.open(this.computedName, version), listenables = [
5535
+ new Listenable("success").listen(
5536
+ () => {
5537
+ stopListenables();
5538
+ switch (this.status) {
5539
+ case "closing":
5540
+ request.result.close();
5541
+ this.closed();
5542
+ return;
5543
+ case "deleting":
5544
+ const db = request.result;
5545
+ db.close();
5546
+ this.requestDelete();
5547
+ return;
5548
+ default:
5549
+ this.computedDb = request.result;
5550
+ this.opened();
5551
+ return;
5552
+ }
5553
+ },
5554
+ { target: request }
5555
+ ),
5556
+ new Listenable("blocked").listen(
5557
+ () => {
5558
+ switch (this.status) {
5559
+ case "closing":
5560
+ request.result.close();
5561
+ this.closed();
5562
+ stopListenables();
5563
+ return;
5564
+ case "deleting":
5565
+ const db = request.result;
5566
+ db.close();
5567
+ this.requestDelete();
5568
+ stopListenables();
5569
+ return;
5570
+ default:
5571
+ this.openblocked();
5572
+ return;
5573
+ }
5574
+ },
5575
+ { target: request }
5576
+ ),
5577
+ new Listenable("error").listen(
5578
+ () => {
5579
+ stopListenables();
5580
+ switch (this.status) {
5581
+ case "closing":
5582
+ request.result?.close();
5583
+ this.closed();
5584
+ return;
5585
+ case "deleting":
5586
+ const db = request.result;
5587
+ db?.close();
5588
+ this.requestDelete();
5589
+ return;
5590
+ default:
5591
+ this.computedError = request.error;
5592
+ this.openerrored();
5593
+ return;
5594
+ }
5595
+ },
5596
+ { target: request }
5597
+ ),
5598
+ new Listenable("upgradeneeded").listen(
5599
+ () => {
5600
+ switch (this.status) {
5601
+ case "closing":
5602
+ request.result.close();
5603
+ return;
5604
+ case "deleting":
5605
+ const db = request.result;
5606
+ db.close();
5607
+ this.requestDelete();
5608
+ return;
5609
+ default:
5610
+ this.computedDb = request.result;
5611
+ this.upgradeneeded();
5612
+ upgradeEffect?.(request.result);
5613
+ return;
5614
+ }
5615
+ },
5616
+ { target: request }
5617
+ )
5618
+ ], stopListenables = () => this.stopListenables(listenables);
5619
+ this.listenables.push(...listenables);
5620
+ }
5621
+ opening() {
5622
+ this.computedStatus = "opening";
5623
+ }
5624
+ opened() {
5625
+ this.computedStatus = "opened";
5626
+ }
5627
+ openblocked() {
5628
+ this.computedStatus = "openblocked";
5629
+ }
5630
+ openerrored() {
5631
+ this.computedStatus = "openerrored";
5632
+ }
5633
+ upgradeneeded() {
5634
+ this.computedStatus = "upgradeneeded";
5635
+ }
5636
+ transact(effect, options = {}) {
5637
+ const {
5638
+ storeNames = [],
5639
+ mode = "readonly",
5640
+ ...transactionOptions
5641
+ } = options, transaction = this.db.transaction(storeNames, mode, transactionOptions), listenables = [
5642
+ new Listenable("complete").listen(
5643
+ () => {
5644
+ switch (this.status) {
5645
+ case "closing":
5646
+ this.closed();
5647
+ break;
5648
+ default:
5649
+ this.transacted();
5650
+ break;
5651
+ }
5652
+ stopListenables();
5653
+ },
5654
+ { target: transaction }
5655
+ ),
5656
+ new Listenable("error").listen(
5657
+ () => {
5658
+ this.transacterrored();
5659
+ this.computedError = transaction.error;
5660
+ stopListenables();
5661
+ },
5662
+ { target: transaction }
5663
+ ),
5664
+ new Listenable("abort").listen(
5665
+ () => {
5666
+ this.transactaborted();
5667
+ stopListenables();
5668
+ },
5669
+ { target: transaction }
5670
+ )
5671
+ ], stopListenables = () => this.stopListenables(listenables);
5672
+ this.listenables.push(...listenables);
5673
+ this.transacting();
5674
+ effect(transaction);
5675
+ return this;
5676
+ }
5677
+ transacted() {
5678
+ this.computedStatus = "transacted";
5679
+ }
5680
+ transacterrored() {
5681
+ this.computedStatus = "transacterrored";
5682
+ }
5683
+ transactaborted() {
5684
+ this.computedStatus = "transactaborted";
5685
+ }
5686
+ transacting() {
5687
+ this.computedStatus = "transacting";
5688
+ }
5689
+ readonly(effect, options = {}) {
5690
+ return this.transact(effect, { ...options, mode: "readonly" });
5691
+ }
5692
+ readwrite(effect, options = {}) {
5693
+ return this.transact(effect, { ...options, mode: "readwrite" });
5694
+ }
5695
+ versionchange(effect, options = {}) {
5696
+ return this.transact(effect, { ...options, mode: "versionchange" });
5697
+ }
5698
+ close() {
5699
+ const status = this.status;
5700
+ this.closing();
5701
+ switch (status) {
5702
+ // IDB is not closed, IDB is not expected to close
5703
+ case "opened":
5704
+ case "transacting":
5705
+ case "transacted":
5706
+ case "transacterrored":
5707
+ case "transactaborted":
5708
+ this.db.close();
5709
+ this.closed();
5710
+ return this;
5711
+ // IDB is not closed, IDB is expected to close & update status
5712
+ case "opening":
5713
+ case "openblocked":
5714
+ case "upgradeneeded":
5715
+ case "closing":
5716
+ return this;
5717
+ // IDB is expected to close & delete
5718
+ case "deleting":
5719
+ this.deleting();
5720
+ return this;
5721
+ // IDB is closed
5722
+ case "constructing":
5723
+ case "ready":
5724
+ case "openerrored":
5725
+ case "closed":
5726
+ case "deleted":
5727
+ case "deleteerrored":
5728
+ this.closed();
5729
+ return this;
5730
+ }
5731
+ }
5732
+ closing() {
5733
+ this.computedStatus = "closing";
5734
+ }
5735
+ closed() {
5736
+ this.computedStatus = "closed";
5737
+ }
5738
+ delete() {
5739
+ const status = this.status;
5740
+ this.deleting();
5741
+ switch (status) {
5742
+ // IDB is neither closed nor deleted, IDB is not expected to close nor delete
5743
+ case "opened":
5744
+ case "transacting":
5745
+ case "transacted":
5746
+ case "transacterrored":
5747
+ case "transactaborted":
5748
+ this.db.close();
5749
+ this.closed();
5750
+ this.requestDelete();
5751
+ return this;
5752
+ // IDB is neither closed nor deleted, IDB is expected to close & delete & update status
5753
+ case "opening":
5754
+ case "openblocked":
5755
+ case "upgradeneeded":
5756
+ case "deleting":
5757
+ return this;
5758
+ // IDB is closed, not deleted, IDB is not expected to delete
5759
+ case "constructing":
5760
+ case "ready":
5761
+ case "openerrored":
5762
+ case "closed":
5763
+ case "deleteerrored":
5764
+ this.requestDelete();
5765
+ return this;
5766
+ // IDB is closed & deleted
5767
+ case "deleted":
5768
+ this.deleted();
5769
+ return this;
5770
+ // Precluded
5771
+ case "closing":
5772
+ return this;
5773
+ }
5774
+ }
5775
+ requestDelete() {
5776
+ const request = indexedDB.deleteDatabase(this.computedName), listenables = [
5777
+ new Listenable("success").listen(
5778
+ () => {
5779
+ this.deleted();
5780
+ stopListenables();
5781
+ },
5782
+ { target: request }
5783
+ ),
5784
+ new Listenable("error").listen(
5785
+ () => {
5786
+ this.computedError = request.error;
5787
+ this.deleteerrored();
5788
+ stopListenables();
5789
+ },
5790
+ { target: request }
5791
+ )
5792
+ ], stopListenables = () => this.stopListenables(listenables);
5793
+ this.listenables.push(...listenables);
5794
+ }
5795
+ deleting() {
5796
+ this.computedStatus = "deleting";
5797
+ }
5798
+ deleteerrored() {
5799
+ this.computedStatus = "deleteerrored";
5800
+ }
5801
+ deleted() {
5802
+ this.computedStatus = "deleted";
5803
+ }
5804
+ stop() {
5805
+ this.stopListenables(this.listenables);
5806
+ return this;
5807
+ }
5808
+ stopListenables(listenables) {
5809
+ for (const listenable of listenables) listenable.stop();
5810
+ this.listenables = createFilter(
5811
+ (l) => !includes(l)(listenables)
5812
+ )(this.listenables);
5813
+ }
5814
+ }
5815
+
5816
+ export { Animateable, Broadcastable, Compareable, Completeable, Copyable, Delayable, Drawable, Fetchable, Fullscreenable, Grantable, Keychord, Keypress, Keyrelease, Konami, Listenable, Navigateable, Operateable, Pickable, Pointerhover, Pointerpress, Recognizeable, Resolveable, Shareable, Storeable, Transactable, createFormat$2 as createArrayFormat, createClear$2 as createAssociativeArrayClear, createDelete$2 as createAssociativeArrayDelete, createHas$1 as createAssociativeArrayHas, createKeys$1 as createAssociativeArrayKeys, createSet$2 as createAssociativeArraySet, createValue$2 as createAssociativeArrayValue, createValues$1 as createAssociativeArrayValues, createBreadthPathConfig, createChildren, createClamp, createClear$1 as createClear, createClip, createClone, createComputedStyle, createConcat, createFormat$1 as createDateFormat, createAncestor$1 as createDecisionTreeAncestor, createCommonAncestors$1 as createDecisionTreeCommonAncestors, createNodeDepthFirstSteps$1 as createDecisionTreeNodeDepthFirstSteps, createPath$1 as createDecisionTreePath, createDepthFirstSteps$1 as createDecisionTreeSteps, createTree$1 as createDecisionTreeTree, createDeepEqual, createDeepMerge, createDefineObjectStore, createDelete$1 as createDelete, createDepthPathConfig, createDetermine, createAncestor$2 as createDirectedAcyclicAncestor, createAncestor as createDirectedAcyclicAsyncAncestor, createCommonAncestors as createDirectedAcyclicAsyncCommonAncestors, createDepthFirstSteps as createDirectedAcyclicAsyncDepthFirstSteps, createLayers as createDirectedAcyclicAsyncLayers, createNodeDepthFirstSteps as createDirectedAcyclicAsyncNodeDepthFirstSteps, createPath as createDirectedAcyclicAsyncPath, createTree as createDirectedAcyclicAsyncTree, createCommonAncestors$2 as createDirectedAcyclicCommonAncestors, createDepthFirstSteps$2 as createDirectedAcyclicDepthFirstSteps, createLayers$1 as createDirectedAcyclicLayers, createNodeDepthFirstSteps$2 as createDirectedAcyclicNodeDepthFirstSteps, createPath$2 as createDirectedAcyclicPath, createRoots as createDirectedAcyclicRoots, createTree$2 as createDirectedAcyclicTree, createEntries, createEqual, createEvery, createFilter, createFilterAsync, createFindAsync, createFindIndexAsync, createFocusable, createForEachAsync, createGraph, createGreater, createGreaterOrEqual, createHas, createIncoming, createIndegree, createInsert, createKeychord, createKeycomboMatch$1 as createKeycomboMatch, createKeypress, createKeyrelease, createKeys, createKonami, createLess, createLessOrEqual, createList, createMap, createMapAsync, createMix, createNumber, createFormat as createNumberFormat, createOmit, createOnlyChild, createOutdegree, createOutgoing, createPick, createPointerhover, createPointerpress, createReduce, createReduceAsync, createRemove, createReorder, createReplace, createResults, createReverse, createRoot, createSanitize, createSet$1 as createSet, createShuffle, createSiblings, createSlice, createSlug, createSome, createSort, createSwap, createTerminal, createTotalSiblings, createFind as createTreeFind, createTry, createTryAsync, createUnique, createValue$1 as createValue, defineAnimateableKeyframes, defineAssociativeArray, defineGraph, defineGraphAsync, defineGraphAsyncEdge, defineGraphAsyncEdges, defineGraphEdge, defineGraphEdges, defineGraphNode, defineGraphNodes, easingsNetInBack, easingsNetInCirc, easingsNetInCubic, easingsNetInExpo, easingsNetInOutBack, easingsNetInOutCirc, easingsNetInOutCubic, easingsNetInOutExpo, easingsNetInOutQuad, easingsNetInOutQuint, easingsNetInOutSine, easingsNetInQuad, easingsNetInQuart, easingsNetInQuint, easingsNetInSine, easingsNetOutBack, easingsNetOutCirc, easingsNetOutCubic, easingsNetOutExpo, easingsNetOutQuad, easingsNetOutQuint, easingsNetOutSine, fromAliasToCode, fromCodeToAliases, fromKeyboardEventDescriptorToAliases, fromShorthandAliasToLonghandAlias, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, toMessageListenParams, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };