react-magma-dom 4.8.0-next.14 → 4.8.0-next.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -2706,66 +2706,67 @@ var I18nContext = /*#__PURE__*/createContext(defaultI18n);
2706
2706
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
2707
2707
  // require the crypto API and do not support built-in fallback to lower quality random number
2708
2708
  // generators (like Math.random()).
2709
- let getRandomValues;
2710
- const rnds8 = new Uint8Array(16);
2709
+ var getRandomValues;
2710
+ var rnds8 = /*#__PURE__*/new Uint8Array(16);
2711
2711
  function rng() {
2712
2712
  // lazy load so that environments that need to polyfill have a chance to do so
2713
2713
  if (!getRandomValues) {
2714
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
2715
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
2716
-
2714
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
2715
+ // find the complete implementation of crypto (msCrypto) on IE11.
2716
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
2717
2717
  if (!getRandomValues) {
2718
2718
  throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
2719
2719
  }
2720
2720
  }
2721
-
2722
2721
  return getRandomValues(rnds8);
2723
2722
  }
2724
2723
 
2724
+ var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
2725
+
2726
+ function validate(uuid) {
2727
+ return typeof uuid === 'string' && REGEX.test(uuid);
2728
+ }
2729
+
2725
2730
  /**
2726
2731
  * Convert array of 16 byte values to UUID string format of the form:
2727
2732
  * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
2728
2733
  */
2729
2734
 
2730
- const byteToHex = [];
2731
-
2732
- for (let i = 0; i < 256; ++i) {
2733
- byteToHex.push((i + 0x100).toString(16).slice(1));
2735
+ var byteToHex = [];
2736
+ for (var i = 0; i < 256; ++i) {
2737
+ byteToHex.push((i + 0x100).toString(16).substr(1));
2734
2738
  }
2735
-
2736
- function unsafeStringify(arr, offset = 0) {
2739
+ function stringify(arr) {
2740
+ var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2737
2741
  // Note: Be careful editing this code! It's been tuned for performance
2738
2742
  // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
2739
- return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
2740
- }
2743
+ var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
2744
+ // of the following:
2745
+ // - One or more input array values don't map to a hex octet (leading to
2746
+ // "undefined" in the uuid)
2747
+ // - Invalid input values for the RFC `version` or `variant` fields
2741
2748
 
2742
- const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
2743
- var native = {
2744
- randomUUID
2745
- };
2746
-
2747
- function v4(options, buf, offset) {
2748
- if (native.randomUUID && !buf && !options) {
2749
- return native.randomUUID();
2749
+ if (!validate(uuid)) {
2750
+ throw TypeError('Stringified UUID is invalid');
2750
2751
  }
2752
+ return uuid;
2753
+ }
2751
2754
 
2755
+ function v4(options, buf, offset) {
2752
2756
  options = options || {};
2753
- const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
2757
+ var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
2754
2758
 
2755
2759
  rnds[6] = rnds[6] & 0x0f | 0x40;
2756
2760
  rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
2757
2761
 
2758
2762
  if (buf) {
2759
2763
  offset = offset || 0;
2760
-
2761
- for (let i = 0; i < 16; ++i) {
2764
+ for (var i = 0; i < 16; ++i) {
2762
2765
  buf[offset + i] = rnds[i];
2763
2766
  }
2764
-
2765
2767
  return buf;
2766
2768
  }
2767
-
2768
- return unsafeStringify(rnds);
2769
+ return stringify(rnds);
2769
2770
  }
2770
2771
 
2771
2772
  function generateId(id) {