@eightshift/ui-components 5.4.0 → 5.6.0
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/{Button-CQ5ZZJ2w.js → Button-BhEIfWLY.js} +1 -1
- package/dist/{Dialog-BMgMUQuN.js → Dialog-B8p4Ymh7.js} +7 -7
- package/dist/{List-BiAnh5G5.js → List-Bll1lQEW.js} +1 -1
- package/dist/{ListBox-DggfiuO_.js → ListBox-CEpKw7yC.js} +5 -5
- package/dist/{OverlayArrow-DraDOoRn.js → OverlayArrow-DDfa8khI.js} +1 -1
- package/dist/{SearchField-DWGdCvnn.js → SearchField-D6mPli0i.js} +2 -2
- package/dist/{Select-BvggcFOX.js → Select-CHzjZxXy.js} +7 -7
- package/dist/{Select-ef7c0426.esm-CmTkSxDx.js → Select-ef7c0426.esm-BJmjGGzK.js} +1 -1
- package/dist/{SelectionManager-B6-b5NM2.js → SelectionManager-D77bfEbg.js} +2 -2
- package/dist/{Separator-B-xeqOkC.js → Separator-DcqCdD4k.js} +1 -1
- package/dist/{SharedElementTransition-fML-zIv6.js → SharedElementTransition-BjRNHsjx.js} +1 -1
- package/dist/_commonjsHelpers-BhWcALO8.js +38 -0
- package/dist/assets/style-admin.css +2 -8247
- package/dist/assets/style-editor.css +2 -8247
- package/dist/assets/style.css +2 -8253
- package/dist/assets/wp-font-enhancements.css +2 -8
- package/dist/assets/wp-ui-enhancements.css +2 -387
- package/dist/components/breakpoint-preview/breakpoint-preview.js +1 -0
- package/dist/components/button/button.js +2 -2
- package/dist/components/checkbox/checkbox.js +2 -2
- package/dist/components/color-pickers/color-picker.js +1 -1
- package/dist/components/color-pickers/color-swatch.js +1 -1
- package/dist/components/color-pickers/gradient-editor.js +1 -1
- package/dist/components/color-pickers/solid-color-picker.js +2 -2
- package/dist/components/component-toggle/component-toggle.js +1 -1
- package/dist/components/draggable/draggable-handle.js +1 -1
- package/dist/components/draggable/draggable.js +2 -2
- package/dist/components/draggable-list/draggable-list-item.js +1 -1
- package/dist/components/draggable-list/draggable-list.js +2 -2
- package/dist/components/expandable/expandable.js +3 -3
- package/dist/components/index.js +2 -0
- package/dist/components/item-collection/item-collection.js +1 -1
- package/dist/components/link-input/link-input.js +11 -11
- package/dist/components/matrix-align/matrix-align.js +2 -1
- package/dist/components/menu/menu.js +3 -3
- package/dist/components/modal/modal.js +4 -4
- package/dist/components/number-picker/number-picker.js +3 -3
- package/dist/components/option-select/option-select.js +1 -1
- package/dist/components/placeholders/file-picker-shell.js +72 -39
- package/dist/components/placeholders/file-placeholder.js +1 -1
- package/dist/components/popover/popover.js +2 -2
- package/dist/components/radio/radio.js +2 -2
- package/dist/components/repeater/repeater-item.js +1 -1
- package/dist/components/repeater/repeater.js +2 -2
- package/dist/components/responsive/mini-responsive.js +2 -1
- package/dist/components/responsive/responsive-legacy.js +2 -1
- package/dist/components/responsive/responsive.js +2 -1
- package/dist/components/responsive-preview/responsive-preview.js +2 -1
- package/dist/components/select/async-multi-select.js +3 -3
- package/dist/components/select/async-single-select.js +2 -2
- package/dist/components/select/custom-select-default-components.js +1 -1
- package/dist/components/select/multi-select-components.js +1 -1
- package/dist/components/select/multi-select.js +3 -3
- package/dist/components/select/react-select-component-wrappers.js +1 -1
- package/dist/components/select/single-select.js +2 -2
- package/dist/components/select/v2/async-multi-select.js +7 -6
- package/dist/components/select/v2/async-select.js +7 -6
- package/dist/components/select/v2/multi-select.js +8 -7
- package/dist/components/select/v2/shared.js +1 -1
- package/dist/components/select/v2/single-select.js +7 -7
- package/dist/components/slider/column-config-slider.js +1 -1
- package/dist/components/slider/utils.js +1 -1
- package/dist/components/smart-image/smart-image.js +159 -0
- package/dist/components/smart-image/worker-inline.js +4 -0
- package/dist/components/tabs/tabs.js +6 -6
- package/dist/components/toggle/switch.js +1 -1
- package/dist/components/toggle-button/toggle-button.js +1 -1
- package/dist/components/tooltip/tooltip.js +2 -2
- package/dist/{default-i18n-CN_q3KUs.js → default-i18n-DBm-GqWM.js} +167 -50
- package/dist/general-6STKQIrk.js +4371 -0
- package/dist/icons/icons.js +10 -0
- package/dist/icons/index.js +2 -0
- package/dist/icons/spinner.js +18 -0
- package/dist/{index-641ee5b8.esm-DVp0njHa.js → index-641ee5b8.esm-DiwvO-RP.js} +1 -1
- package/dist/{index-D8-Zjpbd.js → index-DjyEH0Gg.js} +1 -3
- package/dist/index.js +2 -0
- package/dist/{multi-select-components-CT_W0Cy9.js → multi-select-components-B3KuDyYd.js} +1 -1
- package/dist/{react-select-async.esm-Zl1LPaPb.js → react-select-async.esm-_4pk-41v.js} +3 -3
- package/dist/{react-select.esm-Bu36HujU.js → react-select.esm-BeuAkAyY.js} +3 -3
- package/dist/sha256-C56UDWfQ.js +533 -0
- package/dist/{useButton-v9ngEj50.js → useButton-B2EaQJT_.js} +1 -1
- package/dist/{useDragAndDrop-C08ZXv4F.js → useDragAndDrop-DUXKDS0N.js} +5 -5
- package/dist/{useFilter-BlkUH1Ma.js → useFilter-BPcJ-Jzv.js} +1 -1
- package/dist/{useListState-RdLrYsMP.js → useListState-DZycqxCn.js} +1 -1
- package/dist/{useNumberField-D16dDfYF.js → useNumberField-CEA9Q4w_.js} +1 -1
- package/dist/{usePress-DJskZBH9.js → usePress-BCEPS3hl.js} +1 -1
- package/dist/{useSingleSelectListState-n0AVMr3Y.js → useSingleSelectListState-BFZEfeqI.js} +1 -1
- package/dist/{useToggle-DSBDAfdw.js → useToggle-DNoP2bvV.js} +1 -1
- package/dist/utilities/general.js +10 -0
- package/dist/utilities/index.js +14 -2
- package/dist/utilities/web-workers.js +50 -0
- package/dist/workers/image-analysis.worker.js +52 -0
- package/package.json +17 -10
package/dist/icons/icons.js
CHANGED
|
@@ -3376,6 +3376,16 @@ const icons = {
|
|
|
3376
3376
|
/* @__PURE__ */ jsx("path", { d: "m9.5.5 5 5H10a.5.5 0 0 1-.5-.5V.5Z", fill: "currentColor", fillOpacity: "0.3" }),
|
|
3377
3377
|
/* @__PURE__ */ jsx("path", { d: "m14.5 5.5-5-5m5 5H10a.5.5 0 0 1-.5-.5V.5m5 5v2m-5-7H2A1.5 1.5 0 0 0 .5 2v16A1.5 1.5 0 0 0 2 19.5h11a1.5 1.5 0 0 0 1.5-1.5v-.5", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", fill: "none" }),
|
|
3378
3378
|
/* @__PURE__ */ jsx("path", { d: "M11.236 15.5H9.499v-6h1.737s2.316 0 2.316 2.842v.316c0 2.842-2.316 2.842-2.316 2.842Zm4.263 0v-3m3.184-3H15.5v3m0 0h3.04m-15.04 3v-3m0 0v-3h1.882c.434 0 2.119 0 2.118 1.5-.001 1.5-1.566 1.5-2 1.5h-2Z", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", fill: "none" })
|
|
3379
|
+
] }),
|
|
3380
|
+
fileError: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", width: "20", height: "20", fill: "none", children: [
|
|
3381
|
+
/* @__PURE__ */ jsx("path", { d: "m16.5 5.5-5-5m5 5H12a.5.5 0 0 1-.5-.5V.5m5 5V18a1.5 1.5 0 0 1-1.5 1.5H5A1.5 1.5 0 0 1 3.5 18V2A1.5 1.5 0 0 1 5 .5h6.5", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", fill: "none" }),
|
|
3382
|
+
/* @__PURE__ */ jsx("path", { d: "m7 9.5 3 3m3 3-3-3m0 0-3 3m3-3 3-3", stroke: "currentColor", strokeLinecap: "round", fill: "none" })
|
|
3383
|
+
] }),
|
|
3384
|
+
imageError: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", width: "20", height: "20", fill: "none", children: [
|
|
3385
|
+
/* @__PURE__ */ jsx("path", { d: "M15.5 11.5V2A1.5 1.5 0 0 0 14 .5H2A1.5 1.5 0 0 0 .5 2v12A1.5 1.5 0 0 0 2 15.5h9.5", stroke: "currentColor", fill: "none" }),
|
|
3386
|
+
/* @__PURE__ */ jsx("circle", { cx: "5.25", cy: "5.25", r: "1.75", fill: "currentColor", fillOpacity: "0.5" }),
|
|
3387
|
+
/* @__PURE__ */ jsx("path", { d: "M18 11a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-5a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h5Zm-.12 2.12a.537.537 0 0 0-.76 0l-1.62 1.62-1.62-1.62a.537.537 0 1 0-.76.76l1.62 1.62-1.62 1.62a.537.537 0 1 0 .76.76l1.62-1.62 1.62 1.62a.537.537 0 1 0 .76-.76l-1.62-1.62 1.62-1.62c.21-.21.21-.55 0-.76Z", fill: "currentColor" }),
|
|
3388
|
+
/* @__PURE__ */ jsx("path", { d: "M3.475 10.705 1 12.79V15h10.5l1.5-2.5 1.241-.863-2.436-2.518a1.5 1.5 0 0 0-2.16.004l-1.78 1.854a1.5 1.5 0 0 1-2.114.05l-.278-.263a1.5 1.5 0 0 0-1.998-.059Z", fill: "currentColor", fillOpacity: "0.5" })
|
|
3379
3389
|
] })
|
|
3380
3390
|
};
|
|
3381
3391
|
const blockIcons = {
|
package/dist/icons/index.js
CHANGED
|
@@ -2,10 +2,12 @@ import { blockIcons, icons } from "./icons.js";
|
|
|
2
2
|
import { BlockIcon } from "./block-icon.js";
|
|
3
3
|
import { GenericColorSwatch } from "./generic-color-swatch.js";
|
|
4
4
|
import { JsxSvg } from "./jsx-svg.js";
|
|
5
|
+
import { Spinner } from "./spinner.js";
|
|
5
6
|
export {
|
|
6
7
|
BlockIcon,
|
|
7
8
|
GenericColorSwatch,
|
|
8
9
|
JsxSvg,
|
|
10
|
+
Spinner,
|
|
9
11
|
blockIcons,
|
|
10
12
|
icons
|
|
11
13
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple loading indicator.
|
|
3
|
+
*
|
|
4
|
+
* @component
|
|
5
|
+
* @param {ImageProps} props - Spinner props.
|
|
6
|
+
* @param {string} [props.className] - Additional classes to pass to the spinner.
|
|
7
|
+
*
|
|
8
|
+
* @returns {JSX.Element} The Spinner component.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <Spinner />
|
|
12
|
+
*
|
|
13
|
+
* @preserve
|
|
14
|
+
*/
|
|
15
|
+
const Spinner = ({ className }) => cloneElement(icons.loader, { className: clsx("es:animate-spin es:size-8 es:text-accent-600", className) });
|
|
16
|
+
export {
|
|
17
|
+
Spinner
|
|
18
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { forwardRef, useContext, useLayoutEffect, useRef, useState, useMemo, useCallback, createContext } from "react";
|
|
3
|
-
import { r as reactDomExports } from "./index-
|
|
3
|
+
import { r as reactDomExports } from "./index-DjyEH0Gg.js";
|
|
4
4
|
function _typeof(o) {
|
|
5
5
|
"@babel/helpers - typeof";
|
|
6
6
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import { a as getDefaultExportFromCjs } from "./_commonjsHelpers-BhWcALO8.js";
|
|
1
2
|
import React__default from "react";
|
|
2
|
-
function getDefaultExportFromCjs(x) {
|
|
3
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
4
|
-
}
|
|
5
3
|
var reactDom = { exports: {} };
|
|
6
4
|
var reactDom_production_min = {};
|
|
7
5
|
var scheduler = { exports: {} };
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,7 @@ import { OptionSelect } from "./components/option-select/option-select.js";
|
|
|
50
50
|
import { OptionsPanel, OptionsPanelHeader, OptionsPanelIntro, OptionsPanelSection } from "./components/options-panel/options-panel.js";
|
|
51
51
|
import { Select } from "./components/select/single-select.js";
|
|
52
52
|
import { Slider } from "./components/slider/slider.js";
|
|
53
|
+
import { SmartImage } from "./components/smart-image/smart-image.js";
|
|
53
54
|
import { SolidColorPicker } from "./components/color-pickers/solid-color-picker.js";
|
|
54
55
|
import { Spacer } from "./components/spacer/spacer.js";
|
|
55
56
|
import { Tab, TabList, TabPanel, Tabs } from "./components/tabs/tabs.js";
|
|
@@ -129,6 +130,7 @@ export {
|
|
|
129
130
|
Select,
|
|
130
131
|
SelectNext,
|
|
131
132
|
Slider,
|
|
133
|
+
SmartImage,
|
|
132
134
|
SolidColorPicker,
|
|
133
135
|
Spacer,
|
|
134
136
|
SubMenuItem,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { useLayoutEffect, useEffect, useRef, useMemo, useCallback, useState, createContext, memo, useReducer, useContext } from "react";
|
|
3
|
-
import { r as reactDomExports } from "./index-
|
|
3
|
+
import { r as reactDomExports } from "./index-DjyEH0Gg.js";
|
|
4
4
|
import { c as clsx } from "./lite-DVmmD_-j.js";
|
|
5
5
|
function useCombinedRefs() {
|
|
6
6
|
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as _objectWithoutProperties, b as _slicedToArray, h as handleInputChange, d as _objectSpread2, e as _defineProperty, _ as _extends } from "./index-641ee5b8.esm-
|
|
1
|
+
import { a as _objectWithoutProperties, b as _slicedToArray, h as handleInputChange, d as _objectSpread2, e as _defineProperty, _ as _extends } from "./index-641ee5b8.esm-DiwvO-RP.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { useRef, useState, useEffect, useCallback, forwardRef } from "react";
|
|
4
|
-
import { u as useStateManager, S as Select } from "./Select-ef7c0426.esm-
|
|
5
|
-
import "./index-
|
|
4
|
+
import { u as useStateManager, S as Select } from "./Select-ef7c0426.esm-BJmjGGzK.js";
|
|
5
|
+
import "./index-DjyEH0Gg.js";
|
|
6
6
|
var _excluded = ["defaultOptions", "cacheOptions", "loadOptions", "options", "isLoading", "onInputChange", "filterOption"];
|
|
7
7
|
function useAsync(_ref) {
|
|
8
8
|
var _ref$defaultOptions = _ref.defaultOptions, propsDefaultOptions = _ref$defaultOptions === void 0 ? false : _ref$defaultOptions, _ref$cacheOptions = _ref.cacheOptions, cacheOptions = _ref$cacheOptions === void 0 ? false : _ref$cacheOptions, propsLoadOptions = _ref.loadOptions;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { u as useStateManager, S as Select } from "./Select-ef7c0426.esm-
|
|
2
|
-
import { _ as _extends } from "./index-641ee5b8.esm-
|
|
1
|
+
import { u as useStateManager, S as Select } from "./Select-ef7c0426.esm-BJmjGGzK.js";
|
|
2
|
+
import { _ as _extends } from "./index-641ee5b8.esm-DiwvO-RP.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { forwardRef } from "react";
|
|
5
|
-
import "./index-
|
|
5
|
+
import "./index-DjyEH0Gg.js";
|
|
6
6
|
var StateManagedSelect = /* @__PURE__ */ forwardRef(function(props, ref) {
|
|
7
7
|
var baseSelectProps = useStateManager(props);
|
|
8
8
|
return /* @__PURE__ */ React.createElement(Select, _extends({
|
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
import { g as getAugmentedNamespace, c as commonjsGlobal } from "./_commonjsHelpers-BhWcALO8.js";
|
|
2
|
+
var sha256 = { exports: {} };
|
|
3
|
+
const __viteBrowserExternal = {};
|
|
4
|
+
const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5
|
+
__proto__: null,
|
|
6
|
+
default: __viteBrowserExternal
|
|
7
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
8
|
+
const require$$1 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
|
|
9
|
+
/**
|
|
10
|
+
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
11
|
+
*
|
|
12
|
+
* @version 0.11.1
|
|
13
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
14
|
+
* @copyright Chen, Yi-Cyuan 2014-2025
|
|
15
|
+
* @license MIT
|
|
16
|
+
*/
|
|
17
|
+
var hasRequiredSha256;
|
|
18
|
+
function requireSha256() {
|
|
19
|
+
if (hasRequiredSha256) return sha256.exports;
|
|
20
|
+
hasRequiredSha256 = 1;
|
|
21
|
+
(function(module) {
|
|
22
|
+
(function() {
|
|
23
|
+
var ERROR = "input is invalid type";
|
|
24
|
+
var WINDOW = typeof window === "object";
|
|
25
|
+
var root = WINDOW ? window : {};
|
|
26
|
+
if (root.JS_SHA256_NO_WINDOW) {
|
|
27
|
+
WINDOW = false;
|
|
28
|
+
}
|
|
29
|
+
var WEB_WORKER = !WINDOW && typeof self === "object";
|
|
30
|
+
var NODE_JS = !root.JS_SHA256_NO_NODE_JS && typeof process === "object" && process.versions && process.versions.node && process.type != "renderer";
|
|
31
|
+
if (NODE_JS) {
|
|
32
|
+
root = commonjsGlobal;
|
|
33
|
+
} else if (WEB_WORKER) {
|
|
34
|
+
root = self;
|
|
35
|
+
}
|
|
36
|
+
var COMMON_JS = !root.JS_SHA256_NO_COMMON_JS && true && module.exports;
|
|
37
|
+
var ARRAY_BUFFER = !root.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer !== "undefined";
|
|
38
|
+
var HEX_CHARS = "0123456789abcdef".split("");
|
|
39
|
+
var EXTRA = [-2147483648, 8388608, 32768, 128];
|
|
40
|
+
var SHIFT = [24, 16, 8, 0];
|
|
41
|
+
var K = [
|
|
42
|
+
1116352408,
|
|
43
|
+
1899447441,
|
|
44
|
+
3049323471,
|
|
45
|
+
3921009573,
|
|
46
|
+
961987163,
|
|
47
|
+
1508970993,
|
|
48
|
+
2453635748,
|
|
49
|
+
2870763221,
|
|
50
|
+
3624381080,
|
|
51
|
+
310598401,
|
|
52
|
+
607225278,
|
|
53
|
+
1426881987,
|
|
54
|
+
1925078388,
|
|
55
|
+
2162078206,
|
|
56
|
+
2614888103,
|
|
57
|
+
3248222580,
|
|
58
|
+
3835390401,
|
|
59
|
+
4022224774,
|
|
60
|
+
264347078,
|
|
61
|
+
604807628,
|
|
62
|
+
770255983,
|
|
63
|
+
1249150122,
|
|
64
|
+
1555081692,
|
|
65
|
+
1996064986,
|
|
66
|
+
2554220882,
|
|
67
|
+
2821834349,
|
|
68
|
+
2952996808,
|
|
69
|
+
3210313671,
|
|
70
|
+
3336571891,
|
|
71
|
+
3584528711,
|
|
72
|
+
113926993,
|
|
73
|
+
338241895,
|
|
74
|
+
666307205,
|
|
75
|
+
773529912,
|
|
76
|
+
1294757372,
|
|
77
|
+
1396182291,
|
|
78
|
+
1695183700,
|
|
79
|
+
1986661051,
|
|
80
|
+
2177026350,
|
|
81
|
+
2456956037,
|
|
82
|
+
2730485921,
|
|
83
|
+
2820302411,
|
|
84
|
+
3259730800,
|
|
85
|
+
3345764771,
|
|
86
|
+
3516065817,
|
|
87
|
+
3600352804,
|
|
88
|
+
4094571909,
|
|
89
|
+
275423344,
|
|
90
|
+
430227734,
|
|
91
|
+
506948616,
|
|
92
|
+
659060556,
|
|
93
|
+
883997877,
|
|
94
|
+
958139571,
|
|
95
|
+
1322822218,
|
|
96
|
+
1537002063,
|
|
97
|
+
1747873779,
|
|
98
|
+
1955562222,
|
|
99
|
+
2024104815,
|
|
100
|
+
2227730452,
|
|
101
|
+
2361852424,
|
|
102
|
+
2428436474,
|
|
103
|
+
2756734187,
|
|
104
|
+
3204031479,
|
|
105
|
+
3329325298
|
|
106
|
+
];
|
|
107
|
+
var OUTPUT_TYPES = ["hex", "array", "digest", "arrayBuffer"];
|
|
108
|
+
var blocks = [];
|
|
109
|
+
if (root.JS_SHA256_NO_NODE_JS || !Array.isArray) {
|
|
110
|
+
Array.isArray = function(obj) {
|
|
111
|
+
return Object.prototype.toString.call(obj) === "[object Array]";
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
if (ARRAY_BUFFER && (root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {
|
|
115
|
+
ArrayBuffer.isView = function(obj) {
|
|
116
|
+
return typeof obj === "object" && obj.buffer && obj.buffer.constructor === ArrayBuffer;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
var createOutputMethod = function(outputType, is224) {
|
|
120
|
+
return function(message) {
|
|
121
|
+
return new Sha256(is224, true).update(message)[outputType]();
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
var createMethod = function(is224) {
|
|
125
|
+
var method = createOutputMethod("hex", is224);
|
|
126
|
+
if (NODE_JS) {
|
|
127
|
+
method = nodeWrap(method, is224);
|
|
128
|
+
}
|
|
129
|
+
method.create = function() {
|
|
130
|
+
return new Sha256(is224);
|
|
131
|
+
};
|
|
132
|
+
method.update = function(message) {
|
|
133
|
+
return method.create().update(message);
|
|
134
|
+
};
|
|
135
|
+
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
|
|
136
|
+
var type = OUTPUT_TYPES[i];
|
|
137
|
+
method[type] = createOutputMethod(type, is224);
|
|
138
|
+
}
|
|
139
|
+
return method;
|
|
140
|
+
};
|
|
141
|
+
var nodeWrap = function(method, is224) {
|
|
142
|
+
var crypto = require$$1;
|
|
143
|
+
var Buffer = require$$1.Buffer;
|
|
144
|
+
var algorithm = is224 ? "sha224" : "sha256";
|
|
145
|
+
var bufferFrom;
|
|
146
|
+
if (Buffer.from && !root.JS_SHA256_NO_BUFFER_FROM) {
|
|
147
|
+
bufferFrom = Buffer.from;
|
|
148
|
+
} else {
|
|
149
|
+
bufferFrom = function(message) {
|
|
150
|
+
return new Buffer(message);
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
var nodeMethod = function(message) {
|
|
154
|
+
if (typeof message === "string") {
|
|
155
|
+
return crypto.createHash(algorithm).update(message, "utf8").digest("hex");
|
|
156
|
+
} else {
|
|
157
|
+
if (message === null || message === void 0) {
|
|
158
|
+
throw new Error(ERROR);
|
|
159
|
+
} else if (message.constructor === ArrayBuffer) {
|
|
160
|
+
message = new Uint8Array(message);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (Array.isArray(message) || ArrayBuffer.isView(message) || message.constructor === Buffer) {
|
|
164
|
+
return crypto.createHash(algorithm).update(bufferFrom(message)).digest("hex");
|
|
165
|
+
} else {
|
|
166
|
+
return method(message);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
return nodeMethod;
|
|
170
|
+
};
|
|
171
|
+
var createHmacOutputMethod = function(outputType, is224) {
|
|
172
|
+
return function(key, message) {
|
|
173
|
+
return new HmacSha256(key, is224, true).update(message)[outputType]();
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
var createHmacMethod = function(is224) {
|
|
177
|
+
var method = createHmacOutputMethod("hex", is224);
|
|
178
|
+
method.create = function(key) {
|
|
179
|
+
return new HmacSha256(key, is224);
|
|
180
|
+
};
|
|
181
|
+
method.update = function(key, message) {
|
|
182
|
+
return method.create(key).update(message);
|
|
183
|
+
};
|
|
184
|
+
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
|
|
185
|
+
var type = OUTPUT_TYPES[i];
|
|
186
|
+
method[type] = createHmacOutputMethod(type, is224);
|
|
187
|
+
}
|
|
188
|
+
return method;
|
|
189
|
+
};
|
|
190
|
+
function Sha256(is224, sharedMemory) {
|
|
191
|
+
if (sharedMemory) {
|
|
192
|
+
blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
|
193
|
+
this.blocks = blocks;
|
|
194
|
+
} else {
|
|
195
|
+
this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
196
|
+
}
|
|
197
|
+
if (is224) {
|
|
198
|
+
this.h0 = 3238371032;
|
|
199
|
+
this.h1 = 914150663;
|
|
200
|
+
this.h2 = 812702999;
|
|
201
|
+
this.h3 = 4144912697;
|
|
202
|
+
this.h4 = 4290775857;
|
|
203
|
+
this.h5 = 1750603025;
|
|
204
|
+
this.h6 = 1694076839;
|
|
205
|
+
this.h7 = 3204075428;
|
|
206
|
+
} else {
|
|
207
|
+
this.h0 = 1779033703;
|
|
208
|
+
this.h1 = 3144134277;
|
|
209
|
+
this.h2 = 1013904242;
|
|
210
|
+
this.h3 = 2773480762;
|
|
211
|
+
this.h4 = 1359893119;
|
|
212
|
+
this.h5 = 2600822924;
|
|
213
|
+
this.h6 = 528734635;
|
|
214
|
+
this.h7 = 1541459225;
|
|
215
|
+
}
|
|
216
|
+
this.block = this.start = this.bytes = this.hBytes = 0;
|
|
217
|
+
this.finalized = this.hashed = false;
|
|
218
|
+
this.first = true;
|
|
219
|
+
this.is224 = is224;
|
|
220
|
+
}
|
|
221
|
+
Sha256.prototype.update = function(message) {
|
|
222
|
+
if (this.finalized) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
var notString, type = typeof message;
|
|
226
|
+
if (type !== "string") {
|
|
227
|
+
if (type === "object") {
|
|
228
|
+
if (message === null) {
|
|
229
|
+
throw new Error(ERROR);
|
|
230
|
+
} else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
|
|
231
|
+
message = new Uint8Array(message);
|
|
232
|
+
} else if (!Array.isArray(message)) {
|
|
233
|
+
if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {
|
|
234
|
+
throw new Error(ERROR);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
} else {
|
|
238
|
+
throw new Error(ERROR);
|
|
239
|
+
}
|
|
240
|
+
notString = true;
|
|
241
|
+
}
|
|
242
|
+
var code, index = 0, i, length = message.length, blocks2 = this.blocks;
|
|
243
|
+
while (index < length) {
|
|
244
|
+
if (this.hashed) {
|
|
245
|
+
this.hashed = false;
|
|
246
|
+
blocks2[0] = this.block;
|
|
247
|
+
this.block = blocks2[16] = blocks2[1] = blocks2[2] = blocks2[3] = blocks2[4] = blocks2[5] = blocks2[6] = blocks2[7] = blocks2[8] = blocks2[9] = blocks2[10] = blocks2[11] = blocks2[12] = blocks2[13] = blocks2[14] = blocks2[15] = 0;
|
|
248
|
+
}
|
|
249
|
+
if (notString) {
|
|
250
|
+
for (i = this.start; index < length && i < 64; ++index) {
|
|
251
|
+
blocks2[i >>> 2] |= message[index] << SHIFT[i++ & 3];
|
|
252
|
+
}
|
|
253
|
+
} else {
|
|
254
|
+
for (i = this.start; index < length && i < 64; ++index) {
|
|
255
|
+
code = message.charCodeAt(index);
|
|
256
|
+
if (code < 128) {
|
|
257
|
+
blocks2[i >>> 2] |= code << SHIFT[i++ & 3];
|
|
258
|
+
} else if (code < 2048) {
|
|
259
|
+
blocks2[i >>> 2] |= (192 | code >>> 6) << SHIFT[i++ & 3];
|
|
260
|
+
blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
|
|
261
|
+
} else if (code < 55296 || code >= 57344) {
|
|
262
|
+
blocks2[i >>> 2] |= (224 | code >>> 12) << SHIFT[i++ & 3];
|
|
263
|
+
blocks2[i >>> 2] |= (128 | code >>> 6 & 63) << SHIFT[i++ & 3];
|
|
264
|
+
blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
|
|
265
|
+
} else {
|
|
266
|
+
code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index) & 1023);
|
|
267
|
+
blocks2[i >>> 2] |= (240 | code >>> 18) << SHIFT[i++ & 3];
|
|
268
|
+
blocks2[i >>> 2] |= (128 | code >>> 12 & 63) << SHIFT[i++ & 3];
|
|
269
|
+
blocks2[i >>> 2] |= (128 | code >>> 6 & 63) << SHIFT[i++ & 3];
|
|
270
|
+
blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
this.lastByteIndex = i;
|
|
275
|
+
this.bytes += i - this.start;
|
|
276
|
+
if (i >= 64) {
|
|
277
|
+
this.block = blocks2[16];
|
|
278
|
+
this.start = i - 64;
|
|
279
|
+
this.hash();
|
|
280
|
+
this.hashed = true;
|
|
281
|
+
} else {
|
|
282
|
+
this.start = i;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (this.bytes > 4294967295) {
|
|
286
|
+
this.hBytes += this.bytes / 4294967296 << 0;
|
|
287
|
+
this.bytes = this.bytes % 4294967296;
|
|
288
|
+
}
|
|
289
|
+
return this;
|
|
290
|
+
};
|
|
291
|
+
Sha256.prototype.finalize = function() {
|
|
292
|
+
if (this.finalized) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
this.finalized = true;
|
|
296
|
+
var blocks2 = this.blocks, i = this.lastByteIndex;
|
|
297
|
+
blocks2[16] = this.block;
|
|
298
|
+
blocks2[i >>> 2] |= EXTRA[i & 3];
|
|
299
|
+
this.block = blocks2[16];
|
|
300
|
+
if (i >= 56) {
|
|
301
|
+
if (!this.hashed) {
|
|
302
|
+
this.hash();
|
|
303
|
+
}
|
|
304
|
+
blocks2[0] = this.block;
|
|
305
|
+
blocks2[16] = blocks2[1] = blocks2[2] = blocks2[3] = blocks2[4] = blocks2[5] = blocks2[6] = blocks2[7] = blocks2[8] = blocks2[9] = blocks2[10] = blocks2[11] = blocks2[12] = blocks2[13] = blocks2[14] = blocks2[15] = 0;
|
|
306
|
+
}
|
|
307
|
+
blocks2[14] = this.hBytes << 3 | this.bytes >>> 29;
|
|
308
|
+
blocks2[15] = this.bytes << 3;
|
|
309
|
+
this.hash();
|
|
310
|
+
};
|
|
311
|
+
Sha256.prototype.hash = function() {
|
|
312
|
+
var a = this.h0, b = this.h1, c = this.h2, d = this.h3, e = this.h4, f = this.h5, g = this.h6, h = this.h7, blocks2 = this.blocks, j, s0, s1, maj, t1, t2, ch, ab, da, cd, bc;
|
|
313
|
+
for (j = 16; j < 64; ++j) {
|
|
314
|
+
t1 = blocks2[j - 15];
|
|
315
|
+
s0 = (t1 >>> 7 | t1 << 25) ^ (t1 >>> 18 | t1 << 14) ^ t1 >>> 3;
|
|
316
|
+
t1 = blocks2[j - 2];
|
|
317
|
+
s1 = (t1 >>> 17 | t1 << 15) ^ (t1 >>> 19 | t1 << 13) ^ t1 >>> 10;
|
|
318
|
+
blocks2[j] = blocks2[j - 16] + s0 + blocks2[j - 7] + s1 << 0;
|
|
319
|
+
}
|
|
320
|
+
bc = b & c;
|
|
321
|
+
for (j = 0; j < 64; j += 4) {
|
|
322
|
+
if (this.first) {
|
|
323
|
+
if (this.is224) {
|
|
324
|
+
ab = 300032;
|
|
325
|
+
t1 = blocks2[0] - 1413257819;
|
|
326
|
+
h = t1 - 150054599 << 0;
|
|
327
|
+
d = t1 + 24177077 << 0;
|
|
328
|
+
} else {
|
|
329
|
+
ab = 704751109;
|
|
330
|
+
t1 = blocks2[0] - 210244248;
|
|
331
|
+
h = t1 - 1521486534 << 0;
|
|
332
|
+
d = t1 + 143694565 << 0;
|
|
333
|
+
}
|
|
334
|
+
this.first = false;
|
|
335
|
+
} else {
|
|
336
|
+
s0 = (a >>> 2 | a << 30) ^ (a >>> 13 | a << 19) ^ (a >>> 22 | a << 10);
|
|
337
|
+
s1 = (e >>> 6 | e << 26) ^ (e >>> 11 | e << 21) ^ (e >>> 25 | e << 7);
|
|
338
|
+
ab = a & b;
|
|
339
|
+
maj = ab ^ a & c ^ bc;
|
|
340
|
+
ch = e & f ^ ~e & g;
|
|
341
|
+
t1 = h + s1 + ch + K[j] + blocks2[j];
|
|
342
|
+
t2 = s0 + maj;
|
|
343
|
+
h = d + t1 << 0;
|
|
344
|
+
d = t1 + t2 << 0;
|
|
345
|
+
}
|
|
346
|
+
s0 = (d >>> 2 | d << 30) ^ (d >>> 13 | d << 19) ^ (d >>> 22 | d << 10);
|
|
347
|
+
s1 = (h >>> 6 | h << 26) ^ (h >>> 11 | h << 21) ^ (h >>> 25 | h << 7);
|
|
348
|
+
da = d & a;
|
|
349
|
+
maj = da ^ d & b ^ ab;
|
|
350
|
+
ch = h & e ^ ~h & f;
|
|
351
|
+
t1 = g + s1 + ch + K[j + 1] + blocks2[j + 1];
|
|
352
|
+
t2 = s0 + maj;
|
|
353
|
+
g = c + t1 << 0;
|
|
354
|
+
c = t1 + t2 << 0;
|
|
355
|
+
s0 = (c >>> 2 | c << 30) ^ (c >>> 13 | c << 19) ^ (c >>> 22 | c << 10);
|
|
356
|
+
s1 = (g >>> 6 | g << 26) ^ (g >>> 11 | g << 21) ^ (g >>> 25 | g << 7);
|
|
357
|
+
cd = c & d;
|
|
358
|
+
maj = cd ^ c & a ^ da;
|
|
359
|
+
ch = g & h ^ ~g & e;
|
|
360
|
+
t1 = f + s1 + ch + K[j + 2] + blocks2[j + 2];
|
|
361
|
+
t2 = s0 + maj;
|
|
362
|
+
f = b + t1 << 0;
|
|
363
|
+
b = t1 + t2 << 0;
|
|
364
|
+
s0 = (b >>> 2 | b << 30) ^ (b >>> 13 | b << 19) ^ (b >>> 22 | b << 10);
|
|
365
|
+
s1 = (f >>> 6 | f << 26) ^ (f >>> 11 | f << 21) ^ (f >>> 25 | f << 7);
|
|
366
|
+
bc = b & c;
|
|
367
|
+
maj = bc ^ b & d ^ cd;
|
|
368
|
+
ch = f & g ^ ~f & h;
|
|
369
|
+
t1 = e + s1 + ch + K[j + 3] + blocks2[j + 3];
|
|
370
|
+
t2 = s0 + maj;
|
|
371
|
+
e = a + t1 << 0;
|
|
372
|
+
a = t1 + t2 << 0;
|
|
373
|
+
this.chromeBugWorkAround = true;
|
|
374
|
+
}
|
|
375
|
+
this.h0 = this.h0 + a << 0;
|
|
376
|
+
this.h1 = this.h1 + b << 0;
|
|
377
|
+
this.h2 = this.h2 + c << 0;
|
|
378
|
+
this.h3 = this.h3 + d << 0;
|
|
379
|
+
this.h4 = this.h4 + e << 0;
|
|
380
|
+
this.h5 = this.h5 + f << 0;
|
|
381
|
+
this.h6 = this.h6 + g << 0;
|
|
382
|
+
this.h7 = this.h7 + h << 0;
|
|
383
|
+
};
|
|
384
|
+
Sha256.prototype.hex = function() {
|
|
385
|
+
this.finalize();
|
|
386
|
+
var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3, h4 = this.h4, h5 = this.h5, h6 = this.h6, h7 = this.h7;
|
|
387
|
+
var hex = HEX_CHARS[h0 >>> 28 & 15] + HEX_CHARS[h0 >>> 24 & 15] + HEX_CHARS[h0 >>> 20 & 15] + HEX_CHARS[h0 >>> 16 & 15] + HEX_CHARS[h0 >>> 12 & 15] + HEX_CHARS[h0 >>> 8 & 15] + HEX_CHARS[h0 >>> 4 & 15] + HEX_CHARS[h0 & 15] + HEX_CHARS[h1 >>> 28 & 15] + HEX_CHARS[h1 >>> 24 & 15] + HEX_CHARS[h1 >>> 20 & 15] + HEX_CHARS[h1 >>> 16 & 15] + HEX_CHARS[h1 >>> 12 & 15] + HEX_CHARS[h1 >>> 8 & 15] + HEX_CHARS[h1 >>> 4 & 15] + HEX_CHARS[h1 & 15] + HEX_CHARS[h2 >>> 28 & 15] + HEX_CHARS[h2 >>> 24 & 15] + HEX_CHARS[h2 >>> 20 & 15] + HEX_CHARS[h2 >>> 16 & 15] + HEX_CHARS[h2 >>> 12 & 15] + HEX_CHARS[h2 >>> 8 & 15] + HEX_CHARS[h2 >>> 4 & 15] + HEX_CHARS[h2 & 15] + HEX_CHARS[h3 >>> 28 & 15] + HEX_CHARS[h3 >>> 24 & 15] + HEX_CHARS[h3 >>> 20 & 15] + HEX_CHARS[h3 >>> 16 & 15] + HEX_CHARS[h3 >>> 12 & 15] + HEX_CHARS[h3 >>> 8 & 15] + HEX_CHARS[h3 >>> 4 & 15] + HEX_CHARS[h3 & 15] + HEX_CHARS[h4 >>> 28 & 15] + HEX_CHARS[h4 >>> 24 & 15] + HEX_CHARS[h4 >>> 20 & 15] + HEX_CHARS[h4 >>> 16 & 15] + HEX_CHARS[h4 >>> 12 & 15] + HEX_CHARS[h4 >>> 8 & 15] + HEX_CHARS[h4 >>> 4 & 15] + HEX_CHARS[h4 & 15] + HEX_CHARS[h5 >>> 28 & 15] + HEX_CHARS[h5 >>> 24 & 15] + HEX_CHARS[h5 >>> 20 & 15] + HEX_CHARS[h5 >>> 16 & 15] + HEX_CHARS[h5 >>> 12 & 15] + HEX_CHARS[h5 >>> 8 & 15] + HEX_CHARS[h5 >>> 4 & 15] + HEX_CHARS[h5 & 15] + HEX_CHARS[h6 >>> 28 & 15] + HEX_CHARS[h6 >>> 24 & 15] + HEX_CHARS[h6 >>> 20 & 15] + HEX_CHARS[h6 >>> 16 & 15] + HEX_CHARS[h6 >>> 12 & 15] + HEX_CHARS[h6 >>> 8 & 15] + HEX_CHARS[h6 >>> 4 & 15] + HEX_CHARS[h6 & 15];
|
|
388
|
+
if (!this.is224) {
|
|
389
|
+
hex += HEX_CHARS[h7 >>> 28 & 15] + HEX_CHARS[h7 >>> 24 & 15] + HEX_CHARS[h7 >>> 20 & 15] + HEX_CHARS[h7 >>> 16 & 15] + HEX_CHARS[h7 >>> 12 & 15] + HEX_CHARS[h7 >>> 8 & 15] + HEX_CHARS[h7 >>> 4 & 15] + HEX_CHARS[h7 & 15];
|
|
390
|
+
}
|
|
391
|
+
return hex;
|
|
392
|
+
};
|
|
393
|
+
Sha256.prototype.toString = Sha256.prototype.hex;
|
|
394
|
+
Sha256.prototype.digest = function() {
|
|
395
|
+
this.finalize();
|
|
396
|
+
var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3, h4 = this.h4, h5 = this.h5, h6 = this.h6, h7 = this.h7;
|
|
397
|
+
var arr = [
|
|
398
|
+
h0 >>> 24 & 255,
|
|
399
|
+
h0 >>> 16 & 255,
|
|
400
|
+
h0 >>> 8 & 255,
|
|
401
|
+
h0 & 255,
|
|
402
|
+
h1 >>> 24 & 255,
|
|
403
|
+
h1 >>> 16 & 255,
|
|
404
|
+
h1 >>> 8 & 255,
|
|
405
|
+
h1 & 255,
|
|
406
|
+
h2 >>> 24 & 255,
|
|
407
|
+
h2 >>> 16 & 255,
|
|
408
|
+
h2 >>> 8 & 255,
|
|
409
|
+
h2 & 255,
|
|
410
|
+
h3 >>> 24 & 255,
|
|
411
|
+
h3 >>> 16 & 255,
|
|
412
|
+
h3 >>> 8 & 255,
|
|
413
|
+
h3 & 255,
|
|
414
|
+
h4 >>> 24 & 255,
|
|
415
|
+
h4 >>> 16 & 255,
|
|
416
|
+
h4 >>> 8 & 255,
|
|
417
|
+
h4 & 255,
|
|
418
|
+
h5 >>> 24 & 255,
|
|
419
|
+
h5 >>> 16 & 255,
|
|
420
|
+
h5 >>> 8 & 255,
|
|
421
|
+
h5 & 255,
|
|
422
|
+
h6 >>> 24 & 255,
|
|
423
|
+
h6 >>> 16 & 255,
|
|
424
|
+
h6 >>> 8 & 255,
|
|
425
|
+
h6 & 255
|
|
426
|
+
];
|
|
427
|
+
if (!this.is224) {
|
|
428
|
+
arr.push(h7 >>> 24 & 255, h7 >>> 16 & 255, h7 >>> 8 & 255, h7 & 255);
|
|
429
|
+
}
|
|
430
|
+
return arr;
|
|
431
|
+
};
|
|
432
|
+
Sha256.prototype.array = Sha256.prototype.digest;
|
|
433
|
+
Sha256.prototype.arrayBuffer = function() {
|
|
434
|
+
this.finalize();
|
|
435
|
+
var buffer = new ArrayBuffer(this.is224 ? 28 : 32);
|
|
436
|
+
var dataView = new DataView(buffer);
|
|
437
|
+
dataView.setUint32(0, this.h0);
|
|
438
|
+
dataView.setUint32(4, this.h1);
|
|
439
|
+
dataView.setUint32(8, this.h2);
|
|
440
|
+
dataView.setUint32(12, this.h3);
|
|
441
|
+
dataView.setUint32(16, this.h4);
|
|
442
|
+
dataView.setUint32(20, this.h5);
|
|
443
|
+
dataView.setUint32(24, this.h6);
|
|
444
|
+
if (!this.is224) {
|
|
445
|
+
dataView.setUint32(28, this.h7);
|
|
446
|
+
}
|
|
447
|
+
return buffer;
|
|
448
|
+
};
|
|
449
|
+
function HmacSha256(key, is224, sharedMemory) {
|
|
450
|
+
var i, type = typeof key;
|
|
451
|
+
if (type === "string") {
|
|
452
|
+
var bytes = [], length = key.length, index = 0, code;
|
|
453
|
+
for (i = 0; i < length; ++i) {
|
|
454
|
+
code = key.charCodeAt(i);
|
|
455
|
+
if (code < 128) {
|
|
456
|
+
bytes[index++] = code;
|
|
457
|
+
} else if (code < 2048) {
|
|
458
|
+
bytes[index++] = 192 | code >>> 6;
|
|
459
|
+
bytes[index++] = 128 | code & 63;
|
|
460
|
+
} else if (code < 55296 || code >= 57344) {
|
|
461
|
+
bytes[index++] = 224 | code >>> 12;
|
|
462
|
+
bytes[index++] = 128 | code >>> 6 & 63;
|
|
463
|
+
bytes[index++] = 128 | code & 63;
|
|
464
|
+
} else {
|
|
465
|
+
code = 65536 + ((code & 1023) << 10 | key.charCodeAt(++i) & 1023);
|
|
466
|
+
bytes[index++] = 240 | code >>> 18;
|
|
467
|
+
bytes[index++] = 128 | code >>> 12 & 63;
|
|
468
|
+
bytes[index++] = 128 | code >>> 6 & 63;
|
|
469
|
+
bytes[index++] = 128 | code & 63;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
key = bytes;
|
|
473
|
+
} else {
|
|
474
|
+
if (type === "object") {
|
|
475
|
+
if (key === null) {
|
|
476
|
+
throw new Error(ERROR);
|
|
477
|
+
} else if (ARRAY_BUFFER && key.constructor === ArrayBuffer) {
|
|
478
|
+
key = new Uint8Array(key);
|
|
479
|
+
} else if (!Array.isArray(key)) {
|
|
480
|
+
if (!ARRAY_BUFFER || !ArrayBuffer.isView(key)) {
|
|
481
|
+
throw new Error(ERROR);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
} else {
|
|
485
|
+
throw new Error(ERROR);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (key.length > 64) {
|
|
489
|
+
key = new Sha256(is224, true).update(key).array();
|
|
490
|
+
}
|
|
491
|
+
var oKeyPad = [], iKeyPad = [];
|
|
492
|
+
for (i = 0; i < 64; ++i) {
|
|
493
|
+
var b = key[i] || 0;
|
|
494
|
+
oKeyPad[i] = 92 ^ b;
|
|
495
|
+
iKeyPad[i] = 54 ^ b;
|
|
496
|
+
}
|
|
497
|
+
Sha256.call(this, is224, sharedMemory);
|
|
498
|
+
this.update(iKeyPad);
|
|
499
|
+
this.oKeyPad = oKeyPad;
|
|
500
|
+
this.inner = true;
|
|
501
|
+
this.sharedMemory = sharedMemory;
|
|
502
|
+
}
|
|
503
|
+
HmacSha256.prototype = new Sha256();
|
|
504
|
+
HmacSha256.prototype.finalize = function() {
|
|
505
|
+
Sha256.prototype.finalize.call(this);
|
|
506
|
+
if (this.inner) {
|
|
507
|
+
this.inner = false;
|
|
508
|
+
var innerHash = this.array();
|
|
509
|
+
Sha256.call(this, this.is224, this.sharedMemory);
|
|
510
|
+
this.update(this.oKeyPad);
|
|
511
|
+
this.update(innerHash);
|
|
512
|
+
Sha256.prototype.finalize.call(this);
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
var exports = createMethod();
|
|
516
|
+
exports.sha256 = exports;
|
|
517
|
+
exports.sha224 = createMethod(true);
|
|
518
|
+
exports.sha256.hmac = createHmacMethod();
|
|
519
|
+
exports.sha224.hmac = createHmacMethod(true);
|
|
520
|
+
if (COMMON_JS) {
|
|
521
|
+
module.exports = exports;
|
|
522
|
+
} else {
|
|
523
|
+
root.sha256 = exports.sha256;
|
|
524
|
+
root.sha224 = exports.sha224;
|
|
525
|
+
}
|
|
526
|
+
})();
|
|
527
|
+
})(sha256);
|
|
528
|
+
return sha256.exports;
|
|
529
|
+
}
|
|
530
|
+
var sha256Exports = requireSha256();
|
|
531
|
+
export {
|
|
532
|
+
sha256Exports as s
|
|
533
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { b as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "./utils-cvK1vxO7.js";
|
|
2
2
|
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-D2C6R0DK.js";
|
|
3
|
-
import { $ as $f6c31cce2adf654f$export$45712eceda6fad21 } from "./usePress-
|
|
3
|
+
import { $ as $f6c31cce2adf654f$export$45712eceda6fad21 } from "./usePress-BCEPS3hl.js";
|
|
4
4
|
import { $ as $f645667febf57a63$export$4c014de7c8940b4c } from "./useHover-BRDW3y7-.js";
|
|
5
5
|
function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
|
|
6
6
|
let { elementType = "button", isDisabled, onPress, onPressStart, onPressEnd, onPressUp, onPressChange, preventFocusOnPress, allowFocusWhenDisabled, onClick, href, target, rel, type = "button" } = props;
|