@react-stately/color 3.0.0-beta.0 → 3.0.0-beta.11

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/main.js CHANGED
@@ -1,986 +1,1146 @@
1
- var {
2
- useRef,
3
- useState,
4
- useMemo,
5
- useEffect
6
- } = require("react");
7
-
8
- var {
9
- useControlledState
10
- } = require("@react-stately/utils");
11
-
12
- var {
13
- useSliderState
14
- } = require("@react-stately/slider");
15
-
16
- var _babelRuntimeHelpersObjectWithoutPropertiesLoose = $parcel$interopDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
17
-
18
- var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
19
-
20
- var {
21
- NumberFormatter
22
- } = require("@internationalized/number");
23
-
24
- var {
25
- MessageDictionary
26
- } = require("@internationalized/message");
27
-
28
- var {
29
- clamp
30
- } = require("@react-aria/utils");
1
+ var $4tN2K$reactstatelyutils = require("@react-stately/utils");
2
+ var $4tN2K$internationalizedmessage = require("@internationalized/message");
3
+ var $4tN2K$internationalizednumber = require("@internationalized/number");
4
+ var $4tN2K$react = require("react");
5
+ var $4tN2K$reactstatelyslider = require("@react-stately/slider");
6
+
7
+ function $parcel$export(e, n, v, s) {
8
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
9
+ }
10
+ function $parcel$exportWildcard(dest, source) {
11
+ Object.keys(source).forEach(function(key) {
12
+ if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
13
+ return;
14
+ }
31
15
 
32
- var _babelRuntimeHelpersInteropRequireDefault = $parcel$interopDefault(require("@babel/runtime/helpers/interopRequireDefault"));
16
+ Object.defineProperty(dest, key, {
17
+ enumerable: true,
18
+ get: function get() {
19
+ return source[key];
20
+ }
21
+ });
22
+ });
33
23
 
24
+ return dest;
25
+ }
34
26
  function $parcel$interopDefault(a) {
35
27
  return a && a.__esModule ? a.default : a;
36
28
  }
37
29
 
38
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ar-AE.json
39
- var $bfb76047ec406c0239c2b8064c9b3ca$exports = {};
40
- $bfb76047ec406c0239c2b8064c9b3ca$exports = JSON.parse("{\"alpha\":\"ألفا\",\"blue\":\"أزرق\",\"brightness\":\"السطوع\",\"green\":\"أخضر\",\"hue\":\"درجة اللون\",\"lightness\":\"الإضاءة\",\"red\":\"أحمر\",\"saturation\":\"التشبع\"}");
41
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/bg-BG.json
42
- var $daebde84800f5aeee9aa172172d5b6f$exports = {};
43
- $daebde84800f5aeee9aa172172d5b6f$exports = JSON.parse("{\"alpha\":\"Алфа\",\"blue\":\"Синьо\",\"brightness\":\"Яркост\",\"green\":\"Зелено\",\"hue\":\"Оттенък\",\"lightness\":\"Лекота\",\"red\":\"Червено\",\"saturation\":\"Наситеност\"}");
44
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/cs-CZ.json
45
- var $a4cfde59be1b5dcb6fbb06fb09589d$exports = {};
46
- $a4cfde59be1b5dcb6fbb06fb09589d$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odstín\",\"lightness\":\"Světlost\",\"red\":\"Červená\",\"saturation\":\"Sytost\"}");
47
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/da-DK.json
48
- var $db43cffdd303de8bb2de21feafa35b91$exports = {};
49
- $db43cffdd303de8bb2de21feafa35b91$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grøn\",\"hue\":\"Tone\",\"lightness\":\"Lyshed\",\"red\":\"Rød\",\"saturation\":\"Farvemætning\"}");
50
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/de-DE.json
51
- var $be2be3d81ee825501b843aad02cb$exports = {};
52
- $be2be3d81ee825501b843aad02cb$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Blau\",\"brightness\":\"Helligkeit\",\"green\":\"Grün\",\"hue\":\"Farbton\",\"lightness\":\"Leuchtkraft\",\"red\":\"Rot\",\"saturation\":\"Sättigung\"}");
53
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/el-GR.json
54
- var $c2fbd942c20b23aa5adc2f3f98bd779$exports = {};
55
- $c2fbd942c20b23aa5adc2f3f98bd779$exports = JSON.parse("{\"alpha\":\"Άλφα\",\"blue\":\"Μπλε\",\"brightness\":\"Φωτεινότητα\",\"green\":\"Πράσινο\",\"hue\":\"Τόνος\",\"lightness\":\"Φωτεινότητα\",\"red\":\"Κόκκινο\",\"saturation\":\"Κορεσμός\"}");
56
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/en-US.json
57
- var $abdeb3eeac24b96ea1b32ebcdc8bf175$exports = {};
58
- $abdeb3eeac24b96ea1b32ebcdc8bf175$exports = JSON.parse("{\"hue\":\"Hue\",\"saturation\":\"Saturation\",\"lightness\":\"Lightness\",\"brightness\":\"Brightness\",\"red\":\"Red\",\"green\":\"Green\",\"blue\":\"Blue\",\"alpha\":\"Alpha\"}");
59
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/es-ES.json
60
- var $b59ba9c40583ad49816c29f93cd734c9$exports = {};
61
- $b59ba9c40583ad49816c29f93cd734c9$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Azul\",\"brightness\":\"Brillo\",\"green\":\"Verde\",\"hue\":\"Tono\",\"lightness\":\"Luminosidad\",\"red\":\"Rojo\",\"saturation\":\"Saturación\"}");
62
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/et-EE.json
63
- var $c3d8ff3bd33905ba4a85bc554a90f3c6$exports = {};
64
- $c3d8ff3bd33905ba4a85bc554a90f3c6$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Sinine\",\"brightness\":\"Heledus\",\"green\":\"Roheline\",\"hue\":\"Värv\",\"lightness\":\"Valgus\",\"red\":\"Punane\",\"saturation\":\"Küllastus\"}");
65
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/fi-FI.json
66
- var $ccab754253a026877ee47cbc1cb03ca4$exports = {};
67
- $ccab754253a026877ee47cbc1cb03ca4$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Sininen\",\"brightness\":\"Kirkkaus\",\"green\":\"Vihreä\",\"hue\":\"Sävy\",\"lightness\":\"Valomäärä\",\"red\":\"Punainen\",\"saturation\":\"Värikylläisyys\"}");
68
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/fr-FR.json
69
- var $ad0191b1c7bbd0c718e613a5db93445d$exports = {};
70
- $ad0191b1c7bbd0c718e613a5db93445d$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Bleu\",\"brightness\":\"Luminosité\",\"green\":\"Vert\",\"hue\":\"Teinte\",\"lightness\":\"Luminosité\",\"red\":\"Rouge\",\"saturation\":\"Saturation\"}");
71
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/he-IL.json
72
- var $b4ea486bd9841aabeecd5373b70dace5$exports = {};
73
- $b4ea486bd9841aabeecd5373b70dace5$exports = JSON.parse("{\"alpha\":\"אלפא\",\"blue\":\"כחול\",\"brightness\":\"בהירות\",\"green\":\"ירוק\",\"hue\":\"גוון\",\"lightness\":\"כמות אור\",\"red\":\"אדום\",\"saturation\":\"רוויה\"}");
74
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/hr-HR.json
75
- var $b99897eafdd92c74120ae6b4e0248b94$exports = {};
76
- $b99897eafdd92c74120ae6b4e0248b94$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Svjetlina\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvijetljenost\",\"red\":\"Crvena\",\"saturation\":\"Zasićenost\"}");
77
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/hu-HU.json
78
- var $a2609a148daf4c3ca1d5b0ce5ec6aa$exports = {};
79
- $a2609a148daf4c3ca1d5b0ce5ec6aa$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Kék\",\"brightness\":\"Fényesség\",\"green\":\"Zöld\",\"hue\":\"Színárnyalat\",\"lightness\":\"Világosság\",\"red\":\"Piros\",\"saturation\":\"Telítettség\"}");
80
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/it-IT.json
81
- var $da5b478c1fd01a35d72944d9cb71a34e$exports = {};
82
- $da5b478c1fd01a35d72944d9cb71a34e$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blu\",\"brightness\":\"Luminosità\",\"green\":\"Verde\",\"hue\":\"Tonalità\",\"lightness\":\"Luminosità\",\"red\":\"Rosso\",\"saturation\":\"Saturazione\"}");
83
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ja-JP.json
84
- var $dc461c55c88305a012147cc9fb7$exports = {};
85
- $dc461c55c88305a012147cc9fb7$exports = JSON.parse("{\"alpha\":\"アルファ\",\"blue\":\"青\",\"brightness\":\"明るさ\",\"green\":\"緑\",\"hue\":\"色相\",\"lightness\":\"明度\",\"red\":\"赤\",\"saturation\":\"彩度\"}");
86
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ko-KR.json
87
- var $b4684c3a5d9d860ab05adffe33fceab3$exports = {};
88
- $b4684c3a5d9d860ab05adffe33fceab3$exports = JSON.parse("{\"alpha\":\"알파\",\"blue\":\"파랑\",\"brightness\":\"명도\",\"green\":\"초록\",\"hue\":\"색조\",\"lightness\":\"밝기\",\"red\":\"빨강\",\"saturation\":\"채도\"}");
89
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/lt-LT.json
90
- var $be917ddab49d0b151b9f62b823bba50$exports = {};
91
- $be917ddab49d0b151b9f62b823bba50$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mėlyna\",\"brightness\":\"Ryškumas\",\"green\":\"Žalia\",\"hue\":\"Atspalvis\",\"lightness\":\"Šviesumas\",\"red\":\"Raudona\",\"saturation\":\"Įsotinimas\"}");
92
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/lv-LV.json
93
- var $f17c13ae26a2d4d99928424c79$exports = {};
94
- $f17c13ae26a2d4d99928424c79$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Zila\",\"brightness\":\"Spilgtums\",\"green\":\"Zaļa\",\"hue\":\"Nokrāsa\",\"lightness\":\"Gaišums\",\"red\":\"Sarkana\",\"saturation\":\"Piesātinājums\"}");
95
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/nb-NO.json
96
- var $e4b8847de3ab9d1344d713259cef878$exports = {};
97
- $e4b8847de3ab9d1344d713259cef878$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grønn\",\"hue\":\"Fargetone\",\"lightness\":\"Lyshet\",\"red\":\"Rød\",\"saturation\":\"Metning\"}");
98
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/nl-NL.json
99
- var $f077195d9918fb9d3561710aae4a62cc$exports = {};
100
- $f077195d9918fb9d3561710aae4a62cc$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blauw\",\"brightness\":\"Helderheid\",\"green\":\"Groen\",\"hue\":\"Kleurtoon\",\"lightness\":\"Lichtsterkte\",\"red\":\"Rood\",\"saturation\":\"Verzadiging\"}");
101
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/pl-PL.json
102
- var $d24a27ab79addeeea85ff5eb95318b06$exports = {};
103
- $d24a27ab79addeeea85ff5eb95318b06$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Niebieski\",\"brightness\":\"Jasność\",\"green\":\"Zielony\",\"hue\":\"Odcień\",\"lightness\":\"Jaskrawość\",\"red\":\"Czerwony\",\"saturation\":\"Nasycenie\"}");
104
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/pt-BR.json
105
- var $ceb70a725fde80d49dd1138e8ca9e306$exports = {};
106
- $ceb70a725fde80d49dd1138e8ca9e306$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Brilho\",\"green\":\"Verde\",\"hue\":\"Matiz\",\"lightness\":\"Luminosidade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
107
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/pt-PT.json
108
- var $c6257abacc4cefb22bbd8081edc05$exports = {};
109
- $c6257abacc4cefb22bbd8081edc05$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Luminosidade\",\"green\":\"Verde\",\"hue\":\"Tonalidade\",\"lightness\":\"Claridade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
110
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ro-RO.json
111
- var $f25ae63965bcad80a86787e16972$exports = {};
112
- $f25ae63965bcad80a86787e16972$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Albastru\",\"brightness\":\"Luminozitate\",\"green\":\"Verde\",\"hue\":\"Nuanță\",\"lightness\":\"Luminozitate\",\"red\":\"Roșu\",\"saturation\":\"Saturație\"}");
113
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ru-RU.json
114
- var $d131f7f35da9efbf3e5c4c90d88523$exports = {};
115
- $d131f7f35da9efbf3e5c4c90d88523$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синий\",\"brightness\":\"Яркость\",\"green\":\"Зеленый\",\"hue\":\"Оттенок\",\"lightness\":\"Освещенность\",\"red\":\"Красный\",\"saturation\":\"Насыщенность\"}");
116
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sk-SK.json
117
- var $bc31c73edcf6a69405580806e86a1580$exports = {};
118
- $bc31c73edcf6a69405580806e86a1580$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odtieň\",\"lightness\":\"Svetlosť\",\"red\":\"Červená\",\"saturation\":\"Sýtosť\"}");
119
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sl-SI.json
120
- var $df72c407396964a6c780d567792cdd2$exports = {};
121
- $df72c407396964a6c780d567792cdd2$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modra\",\"brightness\":\"Svetlost\",\"green\":\"Zelena\",\"hue\":\"Barva\",\"lightness\":\"Lahkost\",\"red\":\"Rdeča\",\"saturation\":\"Nasičenost\"}");
122
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sr-SP.json
123
- var $cad65e4825dd66e0bd6c1ff51bb48a91$exports = {};
124
- $cad65e4825dd66e0bd6c1ff51bb48a91$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Osvetljenost\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvetljenje\",\"red\":\"Crvena\",\"saturation\":\"Zasićenje\"}");
125
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sv-SE.json
126
- var $d7c0d1f1dc8ea1aa86708102c79a$exports = {};
127
- $d7c0d1f1dc8ea1aa86708102c79a$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blått\",\"brightness\":\"Ljusstyrka\",\"green\":\"Grönt\",\"hue\":\"Nyans\",\"lightness\":\"Ljushet\",\"red\":\"Rött\",\"saturation\":\"Mättnad\"}");
128
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/tr-TR.json
129
- var $a0d6a531d06c52db2f4cd7c96356300e$exports = {};
130
- $a0d6a531d06c52db2f4cd7c96356300e$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mavi\",\"brightness\":\"Parlaklık\",\"green\":\"Yeşil\",\"hue\":\"Ton\",\"lightness\":\"Canlılık\",\"red\":\"Kırmızı\",\"saturation\":\"Doygunluk\"}");
131
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/uk-UA.json
132
- var $a70877667b8705b2c85173d23d$exports = {};
133
- $a70877667b8705b2c85173d23d$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синій\",\"brightness\":\"Яскравість\",\"green\":\"Зелений\",\"hue\":\"Тон\",\"lightness\":\"Освітленість\",\"red\":\"Червоний\",\"saturation\":\"Насиченість\"}");
134
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/zh-CN.json
135
- var $c38ee15e302a37d9225987d335ad869e$exports = {};
136
- $c38ee15e302a37d9225987d335ad869e$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"蓝色\",\"brightness\":\"亮度\",\"green\":\"绿色\",\"hue\":\"色相\",\"lightness\":\"明亮度\",\"red\":\"红色\",\"saturation\":\"饱和度\"}");
137
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/zh-TW.json
138
- var $d2a1fa8d41cf433c2df57cdf8eba52a3$exports = {};
139
- $d2a1fa8d41cf433c2df57cdf8eba52a3$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"藍色\",\"brightness\":\"亮度\",\"green\":\"綠色\",\"hue\":\"色相\",\"lightness\":\"明亮\",\"red\":\"紅色\",\"saturation\":\"飽和度\"}");
140
- // @ts-ignore
141
- const $b54655da051f787a04029ec3711$var$intlMessages = {
142
- "ar-AE": _babelRuntimeHelpersInteropRequireDefault($bfb76047ec406c0239c2b8064c9b3ca$exports).default,
143
- "bg-BG": _babelRuntimeHelpersInteropRequireDefault($daebde84800f5aeee9aa172172d5b6f$exports).default,
144
- "cs-CZ": _babelRuntimeHelpersInteropRequireDefault($a4cfde59be1b5dcb6fbb06fb09589d$exports).default,
145
- "da-DK": _babelRuntimeHelpersInteropRequireDefault($db43cffdd303de8bb2de21feafa35b91$exports).default,
146
- "de-DE": _babelRuntimeHelpersInteropRequireDefault($be2be3d81ee825501b843aad02cb$exports).default,
147
- "el-GR": _babelRuntimeHelpersInteropRequireDefault($c2fbd942c20b23aa5adc2f3f98bd779$exports).default,
148
- "en-US": _babelRuntimeHelpersInteropRequireDefault($abdeb3eeac24b96ea1b32ebcdc8bf175$exports).default,
149
- "es-ES": _babelRuntimeHelpersInteropRequireDefault($b59ba9c40583ad49816c29f93cd734c9$exports).default,
150
- "et-EE": _babelRuntimeHelpersInteropRequireDefault($c3d8ff3bd33905ba4a85bc554a90f3c6$exports).default,
151
- "fi-FI": _babelRuntimeHelpersInteropRequireDefault($ccab754253a026877ee47cbc1cb03ca4$exports).default,
152
- "fr-FR": _babelRuntimeHelpersInteropRequireDefault($ad0191b1c7bbd0c718e613a5db93445d$exports).default,
153
- "he-IL": _babelRuntimeHelpersInteropRequireDefault($b4ea486bd9841aabeecd5373b70dace5$exports).default,
154
- "hr-HR": _babelRuntimeHelpersInteropRequireDefault($b99897eafdd92c74120ae6b4e0248b94$exports).default,
155
- "hu-HU": _babelRuntimeHelpersInteropRequireDefault($a2609a148daf4c3ca1d5b0ce5ec6aa$exports).default,
156
- "it-IT": _babelRuntimeHelpersInteropRequireDefault($da5b478c1fd01a35d72944d9cb71a34e$exports).default,
157
- "ja-JP": _babelRuntimeHelpersInteropRequireDefault($dc461c55c88305a012147cc9fb7$exports).default,
158
- "ko-KR": _babelRuntimeHelpersInteropRequireDefault($b4684c3a5d9d860ab05adffe33fceab3$exports).default,
159
- "lt-LT": _babelRuntimeHelpersInteropRequireDefault($be917ddab49d0b151b9f62b823bba50$exports).default,
160
- "lv-LV": _babelRuntimeHelpersInteropRequireDefault($f17c13ae26a2d4d99928424c79$exports).default,
161
- "nb-NO": _babelRuntimeHelpersInteropRequireDefault($e4b8847de3ab9d1344d713259cef878$exports).default,
162
- "nl-NL": _babelRuntimeHelpersInteropRequireDefault($f077195d9918fb9d3561710aae4a62cc$exports).default,
163
- "pl-PL": _babelRuntimeHelpersInteropRequireDefault($d24a27ab79addeeea85ff5eb95318b06$exports).default,
164
- "pt-BR": _babelRuntimeHelpersInteropRequireDefault($ceb70a725fde80d49dd1138e8ca9e306$exports).default,
165
- "pt-PT": _babelRuntimeHelpersInteropRequireDefault($c6257abacc4cefb22bbd8081edc05$exports).default,
166
- "ro-RO": _babelRuntimeHelpersInteropRequireDefault($f25ae63965bcad80a86787e16972$exports).default,
167
- "ru-RU": _babelRuntimeHelpersInteropRequireDefault($d131f7f35da9efbf3e5c4c90d88523$exports).default,
168
- "sk-SK": _babelRuntimeHelpersInteropRequireDefault($bc31c73edcf6a69405580806e86a1580$exports).default,
169
- "sl-SI": _babelRuntimeHelpersInteropRequireDefault($df72c407396964a6c780d567792cdd2$exports).default,
170
- "sr-SP": _babelRuntimeHelpersInteropRequireDefault($cad65e4825dd66e0bd6c1ff51bb48a91$exports).default,
171
- "sv-SE": _babelRuntimeHelpersInteropRequireDefault($d7c0d1f1dc8ea1aa86708102c79a$exports).default,
172
- "tr-TR": _babelRuntimeHelpersInteropRequireDefault($a0d6a531d06c52db2f4cd7c96356300e$exports).default,
173
- "uk-UA": _babelRuntimeHelpersInteropRequireDefault($a70877667b8705b2c85173d23d$exports).default,
174
- "zh-CN": _babelRuntimeHelpersInteropRequireDefault($c38ee15e302a37d9225987d335ad869e$exports).default,
175
- "zh-TW": _babelRuntimeHelpersInteropRequireDefault($d2a1fa8d41cf433c2df57cdf8eba52a3$exports).default
176
- };
177
- const $b54655da051f787a04029ec3711$var$messages = new MessageDictionary($b54655da051f787a04029ec3711$var$intlMessages);
178
- /** Parses a color from a string value. Throws an error if the string could not be parsed. */
30
+ $parcel$export(module.exports, "parseColor", () => $83fe1a57d631223b$export$6e865ea70d7724f);
179
31
 
180
- function parseColor(value) {
181
- let res = $b54655da051f787a04029ec3711$var$RGBColor.parse(value) || $b54655da051f787a04029ec3711$var$HSBColor.parse(value) || $b54655da051f787a04029ec3711$var$HSLColor.parse(value);
32
+ var $c0b600cf8eafdee9$exports = {};
33
+ var $b044e7150534af04$exports = {};
34
+ $b044e7150534af04$exports = JSON.parse("{\"alpha\":\"ألفا\",\"blue\":\"أزرق\",\"brightness\":\"السطوع\",\"green\":\"أخضر\",\"hue\":\"درجة اللون\",\"lightness\":\"الإضاءة\",\"red\":\"أحمر\",\"saturation\":\"التشبع\"}");
182
35
 
183
- if (res) {
184
- return res;
185
- }
186
36
 
187
- throw new Error('Invalid color value: ' + value);
188
- }
37
+ var $c8bf89547a4a9b3f$exports = {};
38
+ $c8bf89547a4a9b3f$exports = JSON.parse("{\"alpha\":\"Алфа\",\"blue\":\"Синьо\",\"brightness\":\"Яркост\",\"green\":\"Зелено\",\"hue\":\"Оттенък\",\"lightness\":\"Лекота\",\"red\":\"Червено\",\"saturation\":\"Наситеност\"}");
189
39
 
190
- exports.parseColor = parseColor;
191
40
 
192
- class $b54655da051f787a04029ec3711$var$Color {
193
- toHexInt() {
194
- return this.toFormat('rgb').toHexInt();
195
- }
41
+ var $8365d8dfc7e4c985$exports = {};
42
+ $8365d8dfc7e4c985$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odstín\",\"lightness\":\"Světlost\",\"red\":\"Červená\",\"saturation\":\"Sytost\"}");
196
43
 
197
- getChannelValue(channel) {
198
- if (channel in this) {
199
- return this[channel];
200
- }
201
44
 
202
- throw new Error('Unsupported color channel: ' + channel);
203
- }
45
+ var $8d95eeaa73699e56$exports = {};
46
+ $8d95eeaa73699e56$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grøn\",\"hue\":\"Tone\",\"lightness\":\"Lyshed\",\"red\":\"Rød\",\"saturation\":\"Farvemætning\"}");
204
47
 
205
- withChannelValue(channel, value) {
206
- if (channel in this) {
207
- let x = this.clone();
208
- x[channel] = value;
209
- return x;
210
- }
211
48
 
212
- throw new Error('Unsupported color channel: ' + channel);
213
- }
49
+ var $2dbbd166053d6d10$exports = {};
50
+ $2dbbd166053d6d10$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Blau\",\"brightness\":\"Helligkeit\",\"green\":\"Grün\",\"hue\":\"Farbton\",\"lightness\":\"Leuchtkraft\",\"red\":\"Rot\",\"saturation\":\"Sättigung\"}");
214
51
 
215
- getChannelName(channel, locale) {
216
- return $b54655da051f787a04029ec3711$var$messages.getStringForLocale(channel, locale);
217
- }
218
52
 
219
- }
53
+ var $1fcbdf9eaf6cc074$exports = {};
54
+ $1fcbdf9eaf6cc074$exports = JSON.parse("{\"alpha\":\"Άλφα\",\"blue\":\"Μπλε\",\"brightness\":\"Φωτεινότητα\",\"green\":\"Πράσινο\",\"hue\":\"Τόνος\",\"lightness\":\"Φωτεινότητα\",\"red\":\"Κόκκινο\",\"saturation\":\"Κορεσμός\"}");
220
55
 
221
- const $b54655da051f787a04029ec3711$var$HEX_REGEX = /^#(?:([0-9a-f]{3})|([0-9a-f]{6}))$/i; // X = <negative/positive number with/without decimal places>
222
- // before/after a comma, 0 or more whitespaces are allowed
223
- // - rgb(X, X, X)
224
- // - rgba(X, X, X, X)
225
56
 
226
- const $b54655da051f787a04029ec3711$var$RGB_REGEX = /rgb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?)\)|rgba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d(.\d+)?)\)/;
227
-
228
- class $b54655da051f787a04029ec3711$var$RGBColor extends $b54655da051f787a04029ec3711$var$Color {
229
- constructor(red, green, blue, alpha) {
230
- super();
231
- this.red = red;
232
- this.green = green;
233
- this.blue = blue;
234
- this.alpha = alpha;
235
- }
236
-
237
- static parse(value) {
238
- let m;
239
-
240
- if (m = value.match($b54655da051f787a04029ec3711$var$HEX_REGEX)) {
241
- if (m[1]) {
242
- let r = parseInt(m[1][0] + m[1][0], 16);
243
- let g = parseInt(m[1][1] + m[1][1], 16);
244
- let b = parseInt(m[1][2] + m[1][2], 16);
245
- return new $b54655da051f787a04029ec3711$var$RGBColor(r, g, b, 1);
246
- } else if (m[2]) {
247
- let r = parseInt(m[2][0] + m[2][1], 16);
248
- let g = parseInt(m[2][2] + m[2][3], 16);
249
- let b = parseInt(m[2][4] + m[2][5], 16);
250
- return new $b54655da051f787a04029ec3711$var$RGBColor(r, g, b, 1);
251
- }
252
- }
57
+ var $42d54be461715959$exports = {};
58
+ $42d54be461715959$exports = JSON.parse("{\"hue\":\"Hue\",\"saturation\":\"Saturation\",\"lightness\":\"Lightness\",\"brightness\":\"Brightness\",\"red\":\"Red\",\"green\":\"Green\",\"blue\":\"Blue\",\"alpha\":\"Alpha\"}");
253
59
 
254
- if (m = value.match($b54655da051f787a04029ec3711$var$RGB_REGEX)) {
255
- var _m$;
256
60
 
257
- const [r, g, b, a] = ((_m$ = m[1]) != null ? _m$ : m[2]).split(',').map(n => Number(n.trim()));
258
- return new $b54655da051f787a04029ec3711$var$RGBColor(clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255), clamp(a != null ? a : 1, 0, 1));
259
- }
260
- }
61
+ var $911646bd5662c33d$exports = {};
62
+ $911646bd5662c33d$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Azul\",\"brightness\":\"Brillo\",\"green\":\"Verde\",\"hue\":\"Tono\",\"lightness\":\"Luminosidad\",\"red\":\"Rojo\",\"saturation\":\"Saturación\"}");
261
63
 
262
- toString(format) {
263
- switch (format) {
264
- case 'hex':
265
- return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0')).toUpperCase();
266
64
 
267
- case 'hexa':
268
- return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0') + Math.round(this.alpha * 255).toString(16).padStart(2, '0')).toUpperCase();
65
+ var $6e8998796901e680$exports = {};
66
+ $6e8998796901e680$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Sinine\",\"brightness\":\"Heledus\",\"green\":\"Roheline\",\"hue\":\"Värv\",\"lightness\":\"Valgus\",\"red\":\"Punane\",\"saturation\":\"Küllastus\"}");
269
67
 
270
- case 'rgb':
271
- return "rgb(" + this.red + ", " + this.green + ", " + this.blue + ")";
272
68
 
273
- case 'css':
274
- case 'rgba':
275
- return "rgba(" + this.red + ", " + this.green + ", " + this.blue + ", " + this.alpha + ")";
69
+ var $4503b4001036be6d$exports = {};
70
+ $4503b4001036be6d$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Sininen\",\"brightness\":\"Kirkkaus\",\"green\":\"Vihreä\",\"hue\":\"Sävy\",\"lightness\":\"Valomäärä\",\"red\":\"Punainen\",\"saturation\":\"Värikylläisyys\"}");
276
71
 
277
- default:
278
- return this.toFormat(format).toString(format);
279
- }
280
- }
281
72
 
282
- toFormat(format) {
283
- switch (format) {
284
- case 'hex':
285
- case 'hexa':
286
- case 'rgb':
287
- case 'rgba':
288
- return this;
73
+ var $721e7016769a7a7f$exports = {};
74
+ $721e7016769a7a7f$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Bleu\",\"brightness\":\"Luminosité\",\"green\":\"Vert\",\"hue\":\"Teinte\",\"lightness\":\"Luminosité\",\"red\":\"Rouge\",\"saturation\":\"Saturation\"}");
289
75
 
290
- default:
291
- throw new Error('Unsupported color conversion: rgb -> ' + format);
292
- }
293
- }
294
76
 
295
- toHexInt() {
296
- return this.red << 16 | this.green << 8 | this.blue;
297
- }
77
+ var $dcc290e5792f9bab$exports = {};
78
+ $dcc290e5792f9bab$exports = JSON.parse("{\"alpha\":\"אלפא\",\"blue\":\"כחול\",\"brightness\":\"בהירות\",\"green\":\"ירוק\",\"hue\":\"גוון\",\"lightness\":\"כמות אור\",\"red\":\"אדום\",\"saturation\":\"רוויה\"}");
298
79
 
299
- clone() {
300
- return new $b54655da051f787a04029ec3711$var$RGBColor(this.red, this.green, this.blue, this.alpha);
301
- }
302
80
 
303
- getChannelRange(channel) {
304
- switch (channel) {
305
- case 'red':
306
- case 'green':
307
- case 'blue':
308
- return {
309
- minValue: 0,
310
- maxValue: 255,
311
- step: 1
312
- };
81
+ var $d93d5aebdd12334c$exports = {};
82
+ $d93d5aebdd12334c$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Svjetlina\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvijetljenost\",\"red\":\"Crvena\",\"saturation\":\"Zasićenost\"}");
313
83
 
314
- case 'alpha':
315
- return {
316
- minValue: 0,
317
- maxValue: 1,
318
- step: 0.01
319
- };
320
84
 
321
- default:
322
- throw new Error('Unknown color channel: ' + channel);
323
- }
324
- }
85
+ var $a3749e0ee87dbebc$exports = {};
86
+ $a3749e0ee87dbebc$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Kék\",\"brightness\":\"Fényesség\",\"green\":\"Zöld\",\"hue\":\"Színárnyalat\",\"lightness\":\"Világosság\",\"red\":\"Piros\",\"saturation\":\"Telítettség\"}");
325
87
 
326
- formatChannelValue(channel, locale) {
327
- let options;
328
- let value = this.getChannelValue(channel);
329
88
 
330
- switch (channel) {
331
- case 'red':
332
- case 'green':
333
- case 'blue':
334
- options = {
335
- style: 'decimal'
336
- };
337
- break;
89
+ var $2fdb931b6c9652b9$exports = {};
90
+ $2fdb931b6c9652b9$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blu\",\"brightness\":\"Luminosità\",\"green\":\"Verde\",\"hue\":\"Tonalità\",\"lightness\":\"Luminosità\",\"red\":\"Rosso\",\"saturation\":\"Saturazione\"}");
338
91
 
339
- case 'alpha':
340
- options = {
341
- style: 'percent'
342
- };
343
- break;
344
92
 
345
- default:
346
- throw new Error('Unknown color channel: ' + channel);
347
- }
93
+ var $219c839b59015b4f$exports = {};
94
+ $219c839b59015b4f$exports = JSON.parse("{\"alpha\":\"アルファ\",\"blue\":\"青\",\"brightness\":\"明るさ\",\"green\":\"緑\",\"hue\":\"色相\",\"lightness\":\"明度\",\"red\":\"赤\",\"saturation\":\"彩度\"}");
348
95
 
349
- return new NumberFormatter(locale, options).format(value);
350
- }
351
96
 
352
- } // X = <negative/positive number with/without decimal places>
353
- // before/after a comma, 0 or more whitespaces are allowed
354
- // - hsb(X, X%, X%)
355
- // - hsba(X, X%, X%, X)
97
+ var $b7f67f414086d976$exports = {};
98
+ $b7f67f414086d976$exports = JSON.parse("{\"alpha\":\"알파\",\"blue\":\"파랑\",\"brightness\":\"명도\",\"green\":\"초록\",\"hue\":\"색조\",\"lightness\":\"밝기\",\"red\":\"빨강\",\"saturation\":\"채도\"}");
356
99
 
357
100
 
358
- const $b54655da051f787a04029ec3711$var$HSB_REGEX = /hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;
101
+ var $f27b2ac7d517417c$exports = {};
102
+ $f27b2ac7d517417c$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mėlyna\",\"brightness\":\"Ryškumas\",\"green\":\"Žalia\",\"hue\":\"Atspalvis\",\"lightness\":\"Šviesumas\",\"red\":\"Raudona\",\"saturation\":\"Įsotinimas\"}");
359
103
 
360
- class $b54655da051f787a04029ec3711$var$HSBColor extends $b54655da051f787a04029ec3711$var$Color {
361
- constructor(hue, saturation, brightness, alpha) {
362
- super();
363
- this.hue = hue;
364
- this.saturation = saturation;
365
- this.brightness = brightness;
366
- this.alpha = alpha;
367
- }
368
104
 
369
- static parse(value) {
370
- let m;
105
+ var $e92168db3cbe2797$exports = {};
106
+ $e92168db3cbe2797$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Zila\",\"brightness\":\"Spilgtums\",\"green\":\"Zaļa\",\"hue\":\"Nokrāsa\",\"lightness\":\"Gaišums\",\"red\":\"Sarkana\",\"saturation\":\"Piesātinājums\"}");
371
107
 
372
- if (m = value.match($b54655da051f787a04029ec3711$var$HSB_REGEX)) {
373
- var _m$2;
374
108
 
375
- const [h, s, b, a] = ((_m$2 = m[1]) != null ? _m$2 : m[2]).split(',').map(n => Number(n.trim().replace('%', '')));
376
- return new $b54655da051f787a04029ec3711$var$HSBColor($b54655da051f787a04029ec3711$var$mod(h, 360), clamp(s, 0, 100), clamp(b, 0, 100), clamp(a != null ? a : 1, 0, 1));
377
- }
378
- }
109
+ var $44b012e02982e825$exports = {};
110
+ $44b012e02982e825$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grønn\",\"hue\":\"Fargetone\",\"lightness\":\"Lyshet\",\"red\":\"Rød\",\"saturation\":\"Metning\"}");
379
111
 
380
- toString(format) {
381
- switch (format) {
382
- case 'css':
383
- return this.toHSL().toString('css');
384
112
 
385
- case 'hsb':
386
- return "hsb(" + this.hue + ", " + this.saturation + "%, " + this.brightness + "%)";
113
+ var $64fbd91459613d8b$exports = {};
114
+ $64fbd91459613d8b$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blauw\",\"brightness\":\"Helderheid\",\"green\":\"Groen\",\"hue\":\"Kleurtoon\",\"lightness\":\"Lichtsterkte\",\"red\":\"Rood\",\"saturation\":\"Verzadiging\"}");
387
115
 
388
- case 'hsba':
389
- return "hsba(" + this.hue + ", " + this.saturation + "%, " + this.brightness + "%, " + this.alpha + ")";
390
116
 
391
- default:
392
- return this.toFormat(format).toString(format);
393
- }
394
- }
117
+ var $83fabdc4e0df6af9$exports = {};
118
+ $83fabdc4e0df6af9$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Niebieski\",\"brightness\":\"Jasność\",\"green\":\"Zielony\",\"hue\":\"Odcień\",\"lightness\":\"Jaskrawość\",\"red\":\"Czerwony\",\"saturation\":\"Nasycenie\"}");
395
119
 
396
- toFormat(format) {
397
- switch (format) {
398
- case 'hsb':
399
- case 'hsba':
400
- return this;
401
120
 
402
- case 'hsl':
403
- case 'hsla':
404
- return this.toHSL();
121
+ var $30b915257fa66ccf$exports = {};
122
+ $30b915257fa66ccf$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Brilho\",\"green\":\"Verde\",\"hue\":\"Matiz\",\"lightness\":\"Luminosidade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
405
123
 
406
- default:
407
- throw new Error('Unsupported color conversion: hsb -> ' + format);
408
- }
409
- }
410
124
 
411
- toHSL() {
412
- // determine the lightness in the range [0,100]
413
- var l = (2 - this.saturation / 100) * this.brightness / 2; // store the HSL components
125
+ var $ce75e45ccbc92491$exports = {};
126
+ $ce75e45ccbc92491$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Luminosidade\",\"green\":\"Verde\",\"hue\":\"Tonalidade\",\"lightness\":\"Claridade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
414
127
 
415
- let hue = this.hue;
416
- let saturation = this.saturation * this.brightness / (l < 50 ? l * 2 : 200 - l * 2);
417
- let lightness = l; // correct a division-by-zero error
418
128
 
419
- if (isNaN(saturation)) {
420
- saturation = 0;
421
- }
129
+ var $225440ee53a1fecd$exports = {};
130
+ $225440ee53a1fecd$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Albastru\",\"brightness\":\"Luminozitate\",\"green\":\"Verde\",\"hue\":\"Nuanță\",\"lightness\":\"Luminozitate\",\"red\":\"Roșu\",\"saturation\":\"Saturație\"}");
422
131
 
423
- return new $b54655da051f787a04029ec3711$var$HSLColor(hue, saturation, lightness, this.alpha);
424
- }
425
132
 
426
- clone() {
427
- return new $b54655da051f787a04029ec3711$var$HSBColor(this.hue, this.saturation, this.brightness, this.alpha);
428
- }
133
+ var $cbc60c1dd4e689ff$exports = {};
134
+ $cbc60c1dd4e689ff$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синий\",\"brightness\":\"Яркость\",\"green\":\"Зеленый\",\"hue\":\"Оттенок\",\"lightness\":\"Освещенность\",\"red\":\"Красный\",\"saturation\":\"Насыщенность\"}");
429
135
 
430
- getChannelRange(channel) {
431
- switch (channel) {
432
- case 'hue':
433
- return {
434
- minValue: 0,
435
- maxValue: 360,
436
- step: 1
437
- };
438
136
 
439
- case 'saturation':
440
- case 'brightness':
441
- return {
442
- minValue: 0,
443
- maxValue: 100,
444
- step: 1
445
- };
137
+ var $8612080ab5efe0cf$exports = {};
138
+ $8612080ab5efe0cf$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odtieň\",\"lightness\":\"Svetlosť\",\"red\":\"Červená\",\"saturation\":\"Sýtosť\"}");
446
139
 
447
- case 'alpha':
448
- return {
449
- minValue: 0,
450
- maxValue: 1,
451
- step: 0.01
452
- };
453
140
 
454
- default:
455
- throw new Error('Unknown color channel: ' + channel);
456
- }
457
- }
141
+ var $99cc034ddd2b7d86$exports = {};
142
+ $99cc034ddd2b7d86$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modra\",\"brightness\":\"Svetlost\",\"green\":\"Zelena\",\"hue\":\"Barva\",\"lightness\":\"Lahkost\",\"red\":\"Rdeča\",\"saturation\":\"Nasičenost\"}");
458
143
 
459
- formatChannelValue(channel, locale) {
460
- let options;
461
- let value = this.getChannelValue(channel);
462
144
 
463
- switch (channel) {
464
- case 'hue':
465
- options = {
466
- style: 'unit',
467
- unit: 'degree',
468
- unitDisplay: 'narrow'
469
- };
470
- break;
145
+ var $dc671800d61be83e$exports = {};
146
+ $dc671800d61be83e$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Osvetljenost\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvetljenje\",\"red\":\"Crvena\",\"saturation\":\"Zasićenje\"}");
471
147
 
472
- case 'saturation':
473
- case 'brightness':
474
- options = {
475
- style: 'percent'
476
- };
477
- value /= 100;
478
- break;
479
-
480
- case 'alpha':
481
- options = {
482
- style: 'percent'
483
- };
484
- break;
485
148
 
486
- default:
487
- throw new Error('Unknown color channel: ' + channel);
488
- }
149
+ var $0f4790e2f696e63f$exports = {};
150
+ $0f4790e2f696e63f$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blått\",\"brightness\":\"Ljusstyrka\",\"green\":\"Grönt\",\"hue\":\"Nyans\",\"lightness\":\"Ljushet\",\"red\":\"Rött\",\"saturation\":\"Mättnad\"}");
489
151
 
490
- return new NumberFormatter(locale, options).format(value);
491
- }
492
152
 
493
- } // X = <negative/positive number with/without decimal places>
494
- // before/after a comma, 0 or more whitespaces are allowed
495
- // - hsl(X, X%, X%)
496
- // - hsla(X, X%, X%, X)
153
+ var $deb5f82eb1998a3c$exports = {};
154
+ $deb5f82eb1998a3c$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mavi\",\"brightness\":\"Parlaklık\",\"green\":\"Yeşil\",\"hue\":\"Ton\",\"lightness\":\"Canlılık\",\"red\":\"Kırmızı\",\"saturation\":\"Doygunluk\"}");
497
155
 
498
156
 
499
- const $b54655da051f787a04029ec3711$var$HSL_REGEX = /hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;
157
+ var $99530e1782ca02cc$exports = {};
158
+ $99530e1782ca02cc$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синій\",\"brightness\":\"Яскравість\",\"green\":\"Зелений\",\"hue\":\"Тон\",\"lightness\":\"Освітленість\",\"red\":\"Червоний\",\"saturation\":\"Насиченість\"}");
500
159
 
501
- function $b54655da051f787a04029ec3711$var$mod(n, m) {
502
- return (n % m + m) % m;
503
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
504
160
 
161
+ var $a6e8f490b423d65e$exports = {};
162
+ $a6e8f490b423d65e$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"蓝色\",\"brightness\":\"亮度\",\"green\":\"绿色\",\"hue\":\"色相\",\"lightness\":\"明亮度\",\"red\":\"红色\",\"saturation\":\"饱和度\"}");
505
163
 
506
- class $b54655da051f787a04029ec3711$var$HSLColor extends $b54655da051f787a04029ec3711$var$Color {
507
- constructor(hue, saturation, lightness, alpha) {
508
- super();
509
- this.hue = hue;
510
- this.saturation = saturation;
511
- this.lightness = lightness;
512
- this.alpha = alpha;
513
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
514
164
 
165
+ var $eba443dcc93cab9a$exports = {};
166
+ $eba443dcc93cab9a$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"藍色\",\"brightness\":\"亮度\",\"green\":\"綠色\",\"hue\":\"色相\",\"lightness\":\"明亮\",\"red\":\"紅色\",\"saturation\":\"飽和度\"}");
515
167
 
516
- static parse(value) {
517
- let m;
518
168
 
519
- if (m = value.match($b54655da051f787a04029ec3711$var$HSL_REGEX)) {
520
- var _m$3;
169
+ $c0b600cf8eafdee9$exports = {
170
+ "ar-AE": $b044e7150534af04$exports,
171
+ "bg-BG": $c8bf89547a4a9b3f$exports,
172
+ "cs-CZ": $8365d8dfc7e4c985$exports,
173
+ "da-DK": $8d95eeaa73699e56$exports,
174
+ "de-DE": $2dbbd166053d6d10$exports,
175
+ "el-GR": $1fcbdf9eaf6cc074$exports,
176
+ "en-US": $42d54be461715959$exports,
177
+ "es-ES": $911646bd5662c33d$exports,
178
+ "et-EE": $6e8998796901e680$exports,
179
+ "fi-FI": $4503b4001036be6d$exports,
180
+ "fr-FR": $721e7016769a7a7f$exports,
181
+ "he-IL": $dcc290e5792f9bab$exports,
182
+ "hr-HR": $d93d5aebdd12334c$exports,
183
+ "hu-HU": $a3749e0ee87dbebc$exports,
184
+ "it-IT": $2fdb931b6c9652b9$exports,
185
+ "ja-JP": $219c839b59015b4f$exports,
186
+ "ko-KR": $b7f67f414086d976$exports,
187
+ "lt-LT": $f27b2ac7d517417c$exports,
188
+ "lv-LV": $e92168db3cbe2797$exports,
189
+ "nb-NO": $44b012e02982e825$exports,
190
+ "nl-NL": $64fbd91459613d8b$exports,
191
+ "pl-PL": $83fabdc4e0df6af9$exports,
192
+ "pt-BR": $30b915257fa66ccf$exports,
193
+ "pt-PT": $ce75e45ccbc92491$exports,
194
+ "ro-RO": $225440ee53a1fecd$exports,
195
+ "ru-RU": $cbc60c1dd4e689ff$exports,
196
+ "sk-SK": $8612080ab5efe0cf$exports,
197
+ "sl-SI": $99cc034ddd2b7d86$exports,
198
+ "sr-SP": $dc671800d61be83e$exports,
199
+ "sv-SE": $0f4790e2f696e63f$exports,
200
+ "tr-TR": $deb5f82eb1998a3c$exports,
201
+ "uk-UA": $99530e1782ca02cc$exports,
202
+ "zh-CN": $a6e8f490b423d65e$exports,
203
+ "zh-TW": $eba443dcc93cab9a$exports
204
+ };
521
205
 
522
- const [h, s, l, a] = ((_m$3 = m[1]) != null ? _m$3 : m[2]).split(',').map(n => Number(n.trim().replace('%', '')));
523
- return new $b54655da051f787a04029ec3711$var$HSLColor($b54655da051f787a04029ec3711$var$mod(h, 360), clamp(s, 0, 100), clamp(l, 0, 100), clamp(a != null ? a : 1, 0, 1));
524
- }
525
- }
526
206
 
527
- toString(format) {
528
- switch (format) {
529
- case 'hsl':
530
- return "hsl(" + this.hue + ", " + this.saturation + "%, " + this.lightness + "%)";
531
207
 
532
- case 'css':
533
- case 'hsla':
534
- return "hsla(" + this.hue + ", " + this.saturation + "%, " + this.lightness + "%, " + this.alpha + ")";
535
208
 
536
- default:
537
- return this.toFormat(format).toString(format);
209
+ const $83fe1a57d631223b$var$messages = new $4tN2K$internationalizedmessage.MessageDictionary((/*@__PURE__*/$parcel$interopDefault($c0b600cf8eafdee9$exports)));
210
+ function $83fe1a57d631223b$export$6e865ea70d7724f(value) {
211
+ let res = $83fe1a57d631223b$var$RGBColor.parse(value) || $83fe1a57d631223b$var$HSBColor.parse(value) || $83fe1a57d631223b$var$HSLColor.parse(value);
212
+ if (res) return res;
213
+ throw new Error('Invalid color value: ' + value);
214
+ }
215
+ function $83fe1a57d631223b$export$4cde5df63f53f473(v) {
216
+ if (typeof v === 'string') return $83fe1a57d631223b$export$6e865ea70d7724f(v);
217
+ else return v;
218
+ }
219
+ class $83fe1a57d631223b$var$Color {
220
+ toHexInt() {
221
+ return this.toFormat('rgb').toHexInt();
538
222
  }
539
- }
540
-
541
- toFormat(format) {
542
- switch (format) {
543
- case 'hsl':
544
- case 'hsla':
545
- return this;
546
-
547
- default:
548
- throw new Error('Unsupported color conversion: hsl -> ' + format);
223
+ getChannelValue(channel) {
224
+ if (channel in this) return this[channel];
225
+ throw new Error('Unsupported color channel: ' + channel);
549
226
  }
550
- }
551
-
552
- clone() {
553
- return new $b54655da051f787a04029ec3711$var$HSLColor(this.hue, this.saturation, this.lightness, this.alpha);
554
- }
555
-
556
- getChannelRange(channel) {
557
- switch (channel) {
558
- case 'hue':
559
- return {
560
- minValue: 0,
561
- maxValue: 360,
562
- step: 1
563
- };
564
-
565
- case 'saturation':
566
- case 'lightness':
567
- return {
568
- minValue: 0,
569
- maxValue: 100,
570
- step: 1
571
- };
572
-
573
- case 'alpha':
227
+ withChannelValue(channel, value) {
228
+ if (channel in this) {
229
+ let x = this.clone();
230
+ x[channel] = value;
231
+ return x;
232
+ }
233
+ throw new Error('Unsupported color channel: ' + channel);
234
+ }
235
+ getChannelName(channel, locale) {
236
+ return $83fe1a57d631223b$var$messages.getStringForLocale(channel, locale);
237
+ }
238
+ getColorSpaceAxes(xyChannels) {
239
+ let { xChannel: xChannel , yChannel: yChannel } = xyChannels;
240
+ let xCh = xChannel || this.getColorChannels().find((c)=>c !== yChannel
241
+ );
242
+ let yCh = yChannel || this.getColorChannels().find((c)=>c !== xCh
243
+ );
244
+ let zCh = this.getColorChannels().find((c)=>c !== xCh && c !== yCh
245
+ );
574
246
  return {
575
- minValue: 0,
576
- maxValue: 1,
577
- step: 0.01
247
+ xChannel: xCh,
248
+ yChannel: yCh,
249
+ zChannel: zCh
578
250
  };
579
-
580
- default:
581
- throw new Error('Unknown color channel: ' + channel);
582
251
  }
583
- }
584
-
585
- formatChannelValue(channel, locale) {
586
- let options;
587
- let value = this.getChannelValue(channel);
588
-
589
- switch (channel) {
590
- case 'hue':
591
- options = {
592
- style: 'unit',
593
- unit: 'degree',
594
- unitDisplay: 'narrow'
595
- };
596
- break;
597
-
598
- case 'saturation':
599
- case 'lightness':
600
- options = {
601
- style: 'percent'
602
- };
603
- value /= 100;
604
- break;
605
-
606
- case 'alpha':
607
- options = {
608
- style: 'percent'
609
- };
610
- break;
611
-
612
- default:
613
- throw new Error('Unknown color channel: ' + channel);
252
+ }
253
+ const $83fe1a57d631223b$var$HEX_REGEX = /^#(?:([0-9a-f]{3})|([0-9a-f]{6}))$/i;
254
+ // X = <negative/positive number with/without decimal places>
255
+ // before/after a comma, 0 or more whitespaces are allowed
256
+ // - rgb(X, X, X)
257
+ // - rgba(X, X, X, X)
258
+ const $83fe1a57d631223b$var$RGB_REGEX = /rgb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?)\)|rgba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d(.\d+)?)\)/;
259
+ class $83fe1a57d631223b$var$RGBColor extends $83fe1a57d631223b$var$Color {
260
+ static parse(value) {
261
+ let m;
262
+ if (m = value.match($83fe1a57d631223b$var$HEX_REGEX)) {
263
+ if (m[1]) {
264
+ let r = parseInt(m[1][0] + m[1][0], 16);
265
+ let g = parseInt(m[1][1] + m[1][1], 16);
266
+ let b = parseInt(m[1][2] + m[1][2], 16);
267
+ return new $83fe1a57d631223b$var$RGBColor(r, g, b, 1);
268
+ } else if (m[2]) {
269
+ let r = parseInt(m[2][0] + m[2][1], 16);
270
+ let g = parseInt(m[2][2] + m[2][3], 16);
271
+ let b = parseInt(m[2][4] + m[2][5], 16);
272
+ return new $83fe1a57d631223b$var$RGBColor(r, g, b, 1);
273
+ }
274
+ }
275
+ if (m = value.match($83fe1a57d631223b$var$RGB_REGEX)) {
276
+ var ref;
277
+ const [r, g, b, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim())
278
+ );
279
+ return new $83fe1a57d631223b$var$RGBColor($4tN2K$reactstatelyutils.clamp(r, 0, 255), $4tN2K$reactstatelyutils.clamp(g, 0, 255), $4tN2K$reactstatelyutils.clamp(b, 0, 255), $4tN2K$reactstatelyutils.clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
280
+ }
281
+ }
282
+ toString(format) {
283
+ switch(format){
284
+ case 'hex':
285
+ return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0')).toUpperCase();
286
+ case 'hexa':
287
+ return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0') + Math.round(this.alpha * 255).toString(16).padStart(2, '0')).toUpperCase();
288
+ case 'rgb':
289
+ return `rgb(${this.red}, ${this.green}, ${this.blue})`;
290
+ case 'css':
291
+ case 'rgba':
292
+ return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;
293
+ default:
294
+ return this.toFormat(format).toString(format);
295
+ }
296
+ }
297
+ toFormat(format) {
298
+ switch(format){
299
+ case 'hex':
300
+ case 'hexa':
301
+ case 'rgb':
302
+ case 'rgba':
303
+ return this;
304
+ case 'hsb':
305
+ case 'hsba':
306
+ return this.toHSB();
307
+ case 'hsl':
308
+ case 'hsla':
309
+ return this.toHSL();
310
+ default:
311
+ throw new Error('Unsupported color conversion: rgb -> ' + format);
312
+ }
313
+ }
314
+ toHexInt() {
315
+ return this.red << 16 | this.green << 8 | this.blue;
316
+ }
317
+ /**
318
+ * Converts an RGB color value to HSB.
319
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
320
+ * @returns An HSBColor object.
321
+ */ toHSB() {
322
+ const red = this.red / 255;
323
+ const green = this.green / 255;
324
+ const blue = this.blue / 255;
325
+ const min = Math.min(red, green, blue);
326
+ const brightness = Math.max(red, green, blue);
327
+ const chroma = brightness - min;
328
+ const saturation = brightness === 0 ? 0 : chroma / brightness;
329
+ let hue = 0; // achromatic
330
+ if (chroma !== 0) {
331
+ switch(brightness){
332
+ case red:
333
+ hue = (green - blue) / chroma + (green < blue ? 6 : 0);
334
+ break;
335
+ case green:
336
+ hue = (blue - red) / chroma + 2;
337
+ break;
338
+ case blue:
339
+ hue = (red - green) / chroma + 4;
340
+ break;
341
+ }
342
+ hue /= 6;
343
+ }
344
+ return new $83fe1a57d631223b$var$HSBColor($4tN2K$reactstatelyutils.toFixedNumber(hue * 360, 2), $4tN2K$reactstatelyutils.toFixedNumber(saturation * 100, 2), $4tN2K$reactstatelyutils.toFixedNumber(brightness * 100, 2), this.alpha);
345
+ }
346
+ /**
347
+ * Converts an RGB color value to HSL.
348
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
349
+ * @returns An HSLColor object.
350
+ */ toHSL() {
351
+ const red = this.red / 255;
352
+ const green = this.green / 255;
353
+ const blue = this.blue / 255;
354
+ const min = Math.min(red, green, blue);
355
+ const max = Math.max(red, green, blue);
356
+ const lightness = (max + min) / 2;
357
+ const chroma = max - min;
358
+ let hue;
359
+ let saturation;
360
+ if (chroma === 0) hue = saturation = 0; // achromatic
361
+ else {
362
+ saturation = chroma / (lightness < 0.5 ? max + min : 2 - max - min);
363
+ switch(max){
364
+ case red:
365
+ hue = (green - blue) / chroma + (green < blue ? 6 : 0);
366
+ break;
367
+ case green:
368
+ hue = (blue - red) / chroma + 2;
369
+ break;
370
+ case blue:
371
+ hue = (red - green) / chroma + 4;
372
+ break;
373
+ }
374
+ hue /= 6;
375
+ }
376
+ return new $83fe1a57d631223b$var$HSLColor($4tN2K$reactstatelyutils.toFixedNumber(hue * 360, 2), $4tN2K$reactstatelyutils.toFixedNumber(saturation * 100, 2), $4tN2K$reactstatelyutils.toFixedNumber(lightness * 100, 2), this.alpha);
377
+ }
378
+ clone() {
379
+ return new $83fe1a57d631223b$var$RGBColor(this.red, this.green, this.blue, this.alpha);
380
+ }
381
+ getChannelRange(channel) {
382
+ switch(channel){
383
+ case 'red':
384
+ case 'green':
385
+ case 'blue':
386
+ return {
387
+ minValue: 0,
388
+ maxValue: 255,
389
+ step: 1,
390
+ pageSize: 17
391
+ };
392
+ case 'alpha':
393
+ return {
394
+ minValue: 0,
395
+ maxValue: 1,
396
+ step: 0.01,
397
+ pageSize: 0.1
398
+ };
399
+ default:
400
+ throw new Error('Unknown color channel: ' + channel);
401
+ }
402
+ }
403
+ formatChannelValue(channel, locale) {
404
+ let options;
405
+ let value = this.getChannelValue(channel);
406
+ switch(channel){
407
+ case 'red':
408
+ case 'green':
409
+ case 'blue':
410
+ options = {
411
+ style: 'decimal'
412
+ };
413
+ break;
414
+ case 'alpha':
415
+ options = {
416
+ style: 'percent'
417
+ };
418
+ break;
419
+ default:
420
+ throw new Error('Unknown color channel: ' + channel);
421
+ }
422
+ return new $4tN2K$internationalizednumber.NumberFormatter(locale, options).format(value);
423
+ }
424
+ getColorSpace() {
425
+ return 'rgb';
426
+ }
427
+ getColorChannels() {
428
+ return $83fe1a57d631223b$var$RGBColor.colorChannels;
429
+ }
430
+ constructor(red, green, blue, alpha){
431
+ super();
432
+ this.red = red;
433
+ this.green = green;
434
+ this.blue = blue;
435
+ this.alpha = alpha;
614
436
  }
615
-
616
- return new NumberFormatter(locale, options).format(value);
617
- }
618
-
619
437
  }
620
-
621
- function $d78e953dd1c924c8b48953f9b24957b7$var$normalizeColor(v) {
622
- if (typeof v === 'string') {
623
- return parseColor(v);
624
- } else {
625
- return v;
626
- }
438
+ $83fe1a57d631223b$var$RGBColor.colorChannels = [
439
+ 'red',
440
+ 'green',
441
+ 'blue'
442
+ ];
443
+ // X = <negative/positive number with/without decimal places>
444
+ // before/after a comma, 0 or more whitespaces are allowed
445
+ // - hsb(X, X%, X%)
446
+ // - hsba(X, X%, X%, X)
447
+ const $83fe1a57d631223b$var$HSB_REGEX = /hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;
448
+ class $83fe1a57d631223b$var$HSBColor extends $83fe1a57d631223b$var$Color {
449
+ static parse(value) {
450
+ let m;
451
+ if (m = value.match($83fe1a57d631223b$var$HSB_REGEX)) {
452
+ var ref;
453
+ const [h, s, b, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim().replace('%', ''))
454
+ );
455
+ return new $83fe1a57d631223b$var$HSBColor($83fe1a57d631223b$var$mod(h, 360), $4tN2K$reactstatelyutils.clamp(s, 0, 100), $4tN2K$reactstatelyutils.clamp(b, 0, 100), $4tN2K$reactstatelyutils.clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
456
+ }
457
+ }
458
+ toString(format) {
459
+ switch(format){
460
+ case 'css':
461
+ return this.toHSL().toString('css');
462
+ case 'hex':
463
+ return this.toRGB().toString('hex');
464
+ case 'hexa':
465
+ return this.toRGB().toString('hexa');
466
+ case 'hsb':
467
+ return `hsb(${this.hue}, ${$4tN2K$reactstatelyutils.toFixedNumber(this.saturation, 2)}%, ${$4tN2K$reactstatelyutils.toFixedNumber(this.brightness, 2)}%)`;
468
+ case 'hsba':
469
+ return `hsba(${this.hue}, ${$4tN2K$reactstatelyutils.toFixedNumber(this.saturation, 2)}%, ${$4tN2K$reactstatelyutils.toFixedNumber(this.brightness, 2)}%, ${this.alpha})`;
470
+ default:
471
+ return this.toFormat(format).toString(format);
472
+ }
473
+ }
474
+ toFormat(format) {
475
+ switch(format){
476
+ case 'hsb':
477
+ case 'hsba':
478
+ return this;
479
+ case 'hsl':
480
+ case 'hsla':
481
+ return this.toHSL();
482
+ case 'rgb':
483
+ case 'rgba':
484
+ return this.toRGB();
485
+ default:
486
+ throw new Error('Unsupported color conversion: hsb -> ' + format);
487
+ }
488
+ }
489
+ /**
490
+ * Converts a HSB color to HSL.
491
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_HSL.
492
+ * @returns An HSLColor object.
493
+ */ toHSL() {
494
+ let saturation = this.saturation / 100;
495
+ let brightness = this.brightness / 100;
496
+ let lightness = brightness * (1 - saturation / 2);
497
+ saturation = lightness === 0 || lightness === 1 ? 0 : (brightness - lightness) / Math.min(lightness, 1 - lightness);
498
+ return new $83fe1a57d631223b$var$HSLColor($4tN2K$reactstatelyutils.toFixedNumber(this.hue, 2), $4tN2K$reactstatelyutils.toFixedNumber(saturation * 100, 2), $4tN2K$reactstatelyutils.toFixedNumber(lightness * 100, 2), this.alpha);
499
+ }
500
+ /**
501
+ * Converts a HSV color value to RGB.
502
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB_alternative.
503
+ * @returns An RGBColor object.
504
+ */ toRGB() {
505
+ let hue = this.hue;
506
+ let saturation = this.saturation / 100;
507
+ let brightness = this.brightness / 100;
508
+ let fn = (n, k = (n + hue / 60) % 6)=>brightness - saturation * brightness * Math.max(Math.min(k, 4 - k, 1), 0)
509
+ ;
510
+ return new $83fe1a57d631223b$var$RGBColor(Math.round(fn(5) * 255), Math.round(fn(3) * 255), Math.round(fn(1) * 255), this.alpha);
511
+ }
512
+ clone() {
513
+ return new $83fe1a57d631223b$var$HSBColor(this.hue, this.saturation, this.brightness, this.alpha);
514
+ }
515
+ getChannelRange(channel) {
516
+ switch(channel){
517
+ case 'hue':
518
+ return {
519
+ minValue: 0,
520
+ maxValue: 360,
521
+ step: 1,
522
+ pageSize: 15
523
+ };
524
+ case 'saturation':
525
+ case 'brightness':
526
+ return {
527
+ minValue: 0,
528
+ maxValue: 100,
529
+ step: 1,
530
+ pageSize: 10
531
+ };
532
+ case 'alpha':
533
+ return {
534
+ minValue: 0,
535
+ maxValue: 1,
536
+ step: 0.01,
537
+ pageSize: 0.1
538
+ };
539
+ default:
540
+ throw new Error('Unknown color channel: ' + channel);
541
+ }
542
+ }
543
+ formatChannelValue(channel, locale) {
544
+ let options;
545
+ let value = this.getChannelValue(channel);
546
+ switch(channel){
547
+ case 'hue':
548
+ options = {
549
+ style: 'unit',
550
+ unit: 'degree',
551
+ unitDisplay: 'narrow'
552
+ };
553
+ break;
554
+ case 'saturation':
555
+ case 'brightness':
556
+ options = {
557
+ style: 'percent'
558
+ };
559
+ value /= 100;
560
+ break;
561
+ case 'alpha':
562
+ options = {
563
+ style: 'percent'
564
+ };
565
+ break;
566
+ default:
567
+ throw new Error('Unknown color channel: ' + channel);
568
+ }
569
+ return new $4tN2K$internationalizednumber.NumberFormatter(locale, options).format(value);
570
+ }
571
+ getColorSpace() {
572
+ return 'hsb';
573
+ }
574
+ getColorChannels() {
575
+ return $83fe1a57d631223b$var$HSBColor.colorChannels;
576
+ }
577
+ constructor(hue, saturation, brightness, alpha){
578
+ super();
579
+ this.hue = hue;
580
+ this.saturation = saturation;
581
+ this.brightness = brightness;
582
+ this.alpha = alpha;
583
+ }
627
584
  }
628
- /**
629
- * Provides state management for a color slider component.
630
- * Color sliders allow users to adjust an individual channel of a color value.
631
- */
632
-
633
-
634
- function useColorSliderState(props) {
635
- let {
636
- channel,
637
- value,
638
- defaultValue,
639
- onChange,
640
- locale
641
- } = props,
642
- otherProps = _babelRuntimeHelpersObjectWithoutPropertiesLoose(props, ["channel", "value", "defaultValue", "onChange", "locale"]);
643
-
644
- if (value == null && defaultValue == null) {
645
- throw new Error('useColorSliderState requires a value or defaultValue');
646
- }
647
-
648
- let [color, setColor] = useControlledState(value && $d78e953dd1c924c8b48953f9b24957b7$var$normalizeColor(value), defaultValue && $d78e953dd1c924c8b48953f9b24957b7$var$normalizeColor(defaultValue), onChange);
649
- let sliderState = useSliderState(_babelRuntimeHelpersExtends({}, color.getChannelRange(channel), otherProps, {
650
- // Unused except in getThumbValueLabel, which is overridden below. null to appease TypeScript.
651
- numberFormatter: null,
652
- value: [color.getChannelValue(channel)],
653
-
654
- onChange(_ref) {
655
- let [v] = _ref;
656
- setColor(color.withChannelValue(channel, v));
657
- },
658
-
659
- onChangeEnd(_ref2) {
660
- let [v] = _ref2;
661
-
662
- // onChange will have already been called with the right value, this is just to trigger onChangEnd
663
- if (props.onChangeEnd) {
664
- props.onChangeEnd(color.withChannelValue(channel, v));
665
- }
585
+ $83fe1a57d631223b$var$HSBColor.colorChannels = [
586
+ 'hue',
587
+ 'saturation',
588
+ 'brightness'
589
+ ];
590
+ // X = <negative/positive number with/without decimal places>
591
+ // before/after a comma, 0 or more whitespaces are allowed
592
+ // - hsl(X, X%, X%)
593
+ // - hsla(X, X%, X%, X)
594
+ const $83fe1a57d631223b$var$HSL_REGEX = /hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;
595
+ function $83fe1a57d631223b$var$mod(n, m) {
596
+ return (n % m + m) % m;
597
+ }
598
+ class $83fe1a57d631223b$var$HSLColor extends $83fe1a57d631223b$var$Color {
599
+ static parse(value) {
600
+ let m;
601
+ if (m = value.match($83fe1a57d631223b$var$HSL_REGEX)) {
602
+ var ref;
603
+ const [h, s, l, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim().replace('%', ''))
604
+ );
605
+ return new $83fe1a57d631223b$var$HSLColor($83fe1a57d631223b$var$mod(h, 360), $4tN2K$reactstatelyutils.clamp(s, 0, 100), $4tN2K$reactstatelyutils.clamp(l, 0, 100), $4tN2K$reactstatelyutils.clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
606
+ }
607
+ }
608
+ toString(format) {
609
+ switch(format){
610
+ case 'hex':
611
+ return this.toRGB().toString('hex');
612
+ case 'hexa':
613
+ return this.toRGB().toString('hexa');
614
+ case 'hsl':
615
+ return `hsl(${this.hue}, ${$4tN2K$reactstatelyutils.toFixedNumber(this.saturation, 2)}%, ${$4tN2K$reactstatelyutils.toFixedNumber(this.lightness, 2)}%)`;
616
+ case 'css':
617
+ case 'hsla':
618
+ return `hsla(${this.hue}, ${$4tN2K$reactstatelyutils.toFixedNumber(this.saturation, 2)}%, ${$4tN2K$reactstatelyutils.toFixedNumber(this.lightness, 2)}%, ${this.alpha})`;
619
+ default:
620
+ return this.toFormat(format).toString(format);
621
+ }
622
+ }
623
+ toFormat(format) {
624
+ switch(format){
625
+ case 'hsl':
626
+ case 'hsla':
627
+ return this;
628
+ case 'hsb':
629
+ case 'hsba':
630
+ return this.toHSB();
631
+ case 'rgb':
632
+ case 'rgba':
633
+ return this.toRGB();
634
+ default:
635
+ throw new Error('Unsupported color conversion: hsl -> ' + format);
636
+ }
637
+ }
638
+ /**
639
+ * Converts a HSL color to HSB.
640
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_HSV.
641
+ * @returns An HSBColor object.
642
+ */ toHSB() {
643
+ let saturation = this.saturation / 100;
644
+ let lightness = this.lightness / 100;
645
+ let brightness = lightness + saturation * Math.min(lightness, 1 - lightness);
646
+ saturation = brightness === 0 ? 0 : 2 * (1 - lightness / brightness);
647
+ return new $83fe1a57d631223b$var$HSBColor($4tN2K$reactstatelyutils.toFixedNumber(this.hue, 2), $4tN2K$reactstatelyutils.toFixedNumber(saturation * 100, 2), $4tN2K$reactstatelyutils.toFixedNumber(brightness * 100, 2), this.alpha);
666
648
  }
649
+ /**
650
+ * Converts a HSL color to RGB.
651
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_RGB_alternative.
652
+ * @returns An RGBColor object.
653
+ */ toRGB() {
654
+ let hue = this.hue;
655
+ let saturation = this.saturation / 100;
656
+ let lightness = this.lightness / 100;
657
+ let a = saturation * Math.min(lightness, 1 - lightness);
658
+ let fn = (n, k = (n + hue / 30) % 12)=>lightness - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)
659
+ ;
660
+ return new $83fe1a57d631223b$var$RGBColor(Math.round(fn(0) * 255), Math.round(fn(8) * 255), Math.round(fn(4) * 255), this.alpha);
661
+ }
662
+ clone() {
663
+ return new $83fe1a57d631223b$var$HSLColor(this.hue, this.saturation, this.lightness, this.alpha);
664
+ }
665
+ getChannelRange(channel) {
666
+ switch(channel){
667
+ case 'hue':
668
+ return {
669
+ minValue: 0,
670
+ maxValue: 360,
671
+ step: 1,
672
+ pageSize: 15
673
+ };
674
+ case 'saturation':
675
+ case 'lightness':
676
+ return {
677
+ minValue: 0,
678
+ maxValue: 100,
679
+ step: 1,
680
+ pageSize: 10
681
+ };
682
+ case 'alpha':
683
+ return {
684
+ minValue: 0,
685
+ maxValue: 1,
686
+ step: 0.01,
687
+ pageSize: 0.1
688
+ };
689
+ default:
690
+ throw new Error('Unknown color channel: ' + channel);
691
+ }
692
+ }
693
+ formatChannelValue(channel, locale) {
694
+ let options;
695
+ let value = this.getChannelValue(channel);
696
+ switch(channel){
697
+ case 'hue':
698
+ options = {
699
+ style: 'unit',
700
+ unit: 'degree',
701
+ unitDisplay: 'narrow'
702
+ };
703
+ break;
704
+ case 'saturation':
705
+ case 'lightness':
706
+ options = {
707
+ style: 'percent'
708
+ };
709
+ value /= 100;
710
+ break;
711
+ case 'alpha':
712
+ options = {
713
+ style: 'percent'
714
+ };
715
+ break;
716
+ default:
717
+ throw new Error('Unknown color channel: ' + channel);
718
+ }
719
+ return new $4tN2K$internationalizednumber.NumberFormatter(locale, options).format(value);
720
+ }
721
+ getColorSpace() {
722
+ return 'hsl';
723
+ }
724
+ getColorChannels() {
725
+ return $83fe1a57d631223b$var$HSLColor.colorChannels;
726
+ }
727
+ constructor(hue, saturation, lightness, alpha){
728
+ super();
729
+ this.hue = hue;
730
+ this.saturation = saturation;
731
+ this.lightness = lightness;
732
+ this.alpha = alpha;
733
+ }
734
+ }
735
+ $83fe1a57d631223b$var$HSLColor.colorChannels = [
736
+ 'hue',
737
+ 'saturation',
738
+ 'lightness'
739
+ ];
740
+
741
+
742
+ var $af2d7ac9990cfee2$exports = {};
743
+
744
+ $parcel$export($af2d7ac9990cfee2$exports, "useColorAreaState", () => $af2d7ac9990cfee2$export$6df7f0e2cabc7eef);
745
+
746
+
747
+
748
+ const $af2d7ac9990cfee2$var$DEFAULT_COLOR = $83fe1a57d631223b$export$6e865ea70d7724f('#ffffff');
749
+ function $af2d7ac9990cfee2$export$6df7f0e2cabc7eef(props) {
750
+ let { value: value1 , defaultValue: defaultValue , xChannel: xChannel , yChannel: yChannel , onChange: onChange , onChangeEnd: onChangeEnd } = props;
751
+ if (!value1 && !defaultValue) defaultValue = $af2d7ac9990cfee2$var$DEFAULT_COLOR;
752
+ let [color, setColor] = $4tN2K$reactstatelyutils.useControlledState(value1 && $83fe1a57d631223b$export$4cde5df63f53f473(value1), defaultValue && $83fe1a57d631223b$export$4cde5df63f53f473(defaultValue), onChange);
753
+ let valueRef = $4tN2K$react.useRef(color);
754
+ valueRef.current = color;
755
+ let channels = $4tN2K$react.useMemo(()=>valueRef.current.getColorSpaceAxes({
756
+ xChannel: xChannel,
757
+ yChannel: yChannel
758
+ })
759
+ , [
760
+ xChannel,
761
+ yChannel
762
+ ]);
763
+ let xChannelRange = color.getChannelRange(channels.xChannel);
764
+ let yChannelRange = color.getChannelRange(channels.yChannel);
765
+ let { minValue: minValueX , maxValue: maxValueX , step: stepX , pageSize: pageSizeX } = xChannelRange;
766
+ let { minValue: minValueY , maxValue: maxValueY , step: stepY , pageSize: pageSizeY } = yChannelRange;
767
+ let [isDragging1, setDragging] = $4tN2K$react.useState(false);
768
+ let isDraggingRef = $4tN2K$react.useRef(false).current;
769
+ let xValue = color.getChannelValue(channels.xChannel);
770
+ let yValue = color.getChannelValue(channels.yChannel);
771
+ let setXValue = (v)=>{
772
+ if (v === xValue) return;
773
+ valueRef.current = color.withChannelValue(channels.xChannel, v);
774
+ setColor(valueRef.current);
775
+ };
776
+ let setYValue = (v)=>{
777
+ if (v === yValue) return;
778
+ valueRef.current = color.withChannelValue(channels.yChannel, v);
779
+ setColor(valueRef.current);
780
+ };
781
+ return {
782
+ channels: channels,
783
+ xChannelStep: stepX,
784
+ yChannelStep: stepY,
785
+ xChannelPageStep: pageSizeX,
786
+ yChannelPageStep: pageSizeY,
787
+ value: color,
788
+ setValue (value) {
789
+ let c = $83fe1a57d631223b$export$4cde5df63f53f473(value);
790
+ valueRef.current = c;
791
+ setColor(c);
792
+ },
793
+ xValue: xValue,
794
+ setXValue: setXValue,
795
+ yValue: yValue,
796
+ setYValue: setYValue,
797
+ setColorFromPoint (x, y) {
798
+ let newXValue = minValueX + $4tN2K$reactstatelyutils.clamp(x, 0, 1) * (maxValueX - minValueX);
799
+ let newYValue = minValueY + (1 - $4tN2K$reactstatelyutils.clamp(y, 0, 1)) * (maxValueY - minValueY);
800
+ let newColor;
801
+ if (newXValue !== xValue) {
802
+ // Round new value to multiple of step, clamp value between min and max
803
+ newXValue = $4tN2K$reactstatelyutils.snapValueToStep(newXValue, minValueX, maxValueX, stepX);
804
+ newColor = color.withChannelValue(channels.xChannel, newXValue);
805
+ }
806
+ if (newYValue !== yValue) {
807
+ // Round new value to multiple of step, clamp value between min and max
808
+ newYValue = $4tN2K$reactstatelyutils.snapValueToStep(newYValue, minValueY, maxValueY, stepY);
809
+ newColor = (newColor || color).withChannelValue(channels.yChannel, newYValue);
810
+ }
811
+ if (newColor) setColor(newColor);
812
+ },
813
+ getThumbPosition () {
814
+ let x = (xValue - minValueX) / (maxValueX - minValueX);
815
+ let y = 1 - (yValue - minValueY) / (maxValueY - minValueY);
816
+ return {
817
+ x: x,
818
+ y: y
819
+ };
820
+ },
821
+ incrementX (stepSize) {
822
+ setXValue(xValue + stepSize > maxValueX ? maxValueX : $4tN2K$reactstatelyutils.snapValueToStep(xValue + stepSize, minValueX, maxValueX, stepX));
823
+ },
824
+ incrementY (stepSize) {
825
+ setYValue(yValue + stepSize > maxValueY ? maxValueY : $4tN2K$reactstatelyutils.snapValueToStep(yValue + stepSize, minValueY, maxValueY, stepY));
826
+ },
827
+ decrementX (stepSize) {
828
+ setXValue($4tN2K$reactstatelyutils.snapValueToStep(xValue - stepSize, minValueX, maxValueX, stepX));
829
+ },
830
+ decrementY (stepSize) {
831
+ setYValue($4tN2K$reactstatelyutils.snapValueToStep(yValue - stepSize, minValueY, maxValueY, stepY));
832
+ },
833
+ setDragging (isDragging) {
834
+ let wasDragging = isDraggingRef;
835
+ isDraggingRef = isDragging;
836
+ if (onChangeEnd && !isDragging && wasDragging) onChangeEnd(valueRef.current);
837
+ setDragging(isDragging);
838
+ },
839
+ isDragging: isDragging1,
840
+ getDisplayColor () {
841
+ return color.withChannelValue('alpha', 1);
842
+ }
843
+ };
844
+ }
667
845
 
668
- }));
669
- return _babelRuntimeHelpersExtends({}, sliderState, {
670
- value: color,
671
846
 
672
- setValue(value) {
673
- setColor($d78e953dd1c924c8b48953f9b24957b7$var$normalizeColor(value));
674
- },
847
+ var $5386a492cfd3234c$exports = {};
675
848
 
676
- getDisplayColor() {
677
- switch (channel) {
678
- case 'hue':
679
- return parseColor("hsl(" + color.getChannelValue('hue') + ", 100%, 50%)");
849
+ $parcel$export($5386a492cfd3234c$exports, "useColorSliderState", () => $5386a492cfd3234c$export$57bc203e1c9c6d44);
680
850
 
681
- case 'lightness':
682
- case 'brightness':
683
- case 'saturation':
684
- case 'red':
685
- case 'green':
686
- case 'blue':
687
- return color.withChannelValue('alpha', 1);
688
851
 
689
- case 'alpha':
690
- {
691
- return color;
692
- }
693
852
 
694
- default:
695
- throw new Error('Unknown color channel: ' + channel);
696
- }
697
- },
853
+ function $5386a492cfd3234c$export$57bc203e1c9c6d44(props) {
854
+ let { channel: channel , value: value1 , defaultValue: defaultValue , onChange: onChange , locale: locale , ...otherProps } = props;
855
+ if (value1 == null && defaultValue == null) throw new Error('useColorSliderState requires a value or defaultValue');
856
+ let [color, setColor] = $4tN2K$reactstatelyutils.useControlledState(value1 && $83fe1a57d631223b$export$4cde5df63f53f473(value1), defaultValue && $83fe1a57d631223b$export$4cde5df63f53f473(defaultValue), onChange);
857
+ let sliderState = $4tN2K$reactstatelyslider.useSliderState({
858
+ ...color.getChannelRange(channel),
859
+ ...otherProps,
860
+ // Unused except in getThumbValueLabel, which is overridden below. null to appease TypeScript.
861
+ numberFormatter: null,
862
+ value: [
863
+ color.getChannelValue(channel)
864
+ ],
865
+ onChange ([v]) {
866
+ setColor(color.withChannelValue(channel, v));
867
+ },
868
+ onChangeEnd ([v]) {
869
+ // onChange will have already been called with the right value, this is just to trigger onChangeEnd
870
+ if (props.onChangeEnd) props.onChangeEnd(color.withChannelValue(channel, v));
871
+ }
872
+ });
873
+ let { step: step , pageSize: pageSize } = color.getChannelRange(channel);
874
+ return {
875
+ ...sliderState,
876
+ value: color,
877
+ setValue (value) {
878
+ setColor($83fe1a57d631223b$export$4cde5df63f53f473(value));
879
+ },
880
+ getDisplayColor () {
881
+ switch(channel){
882
+ case 'hue':
883
+ return $83fe1a57d631223b$export$6e865ea70d7724f(`hsl(${color.getChannelValue('hue')}, 100%, 50%)`);
884
+ case 'lightness':
885
+ case 'brightness':
886
+ case 'saturation':
887
+ case 'red':
888
+ case 'green':
889
+ case 'blue':
890
+ return color.withChannelValue('alpha', 1);
891
+ case 'alpha':
892
+ return color;
893
+ default:
894
+ throw new Error('Unknown color channel: ' + channel);
895
+ }
896
+ },
897
+ getThumbValueLabel () {
898
+ return color.formatChannelValue(channel, locale);
899
+ },
900
+ step: step,
901
+ pageSize: pageSize
902
+ };
903
+ }
698
904
 
699
- getThumbValueLabel() {
700
- return color.formatChannelValue(channel, locale);
701
- }
702
905
 
703
- });
704
- }
906
+ var $9d7d8736d45f74b8$exports = {};
705
907
 
706
- exports.useColorSliderState = useColorSliderState;
908
+ $parcel$export($9d7d8736d45f74b8$exports, "useColorWheelState", () => $9d7d8736d45f74b8$export$f4301076d9336137);
707
909
 
708
- function $dba59c0b8a82682c07fa6f5c72e73481$var$normalizeColor(v) {
709
- if (typeof v === 'string') {
710
- return parseColor(v);
711
- } else {
712
- return v;
713
- }
714
- }
715
910
 
716
- const $dba59c0b8a82682c07fa6f5c72e73481$var$DEFAULT_COLOR = parseColor('hsl(0, 100%, 50%)');
717
911
 
718
- function $dba59c0b8a82682c07fa6f5c72e73481$var$roundToStep(value, step) {
719
- return Math.round(value / step) * step;
912
+ const $9d7d8736d45f74b8$var$DEFAULT_COLOR = $83fe1a57d631223b$export$6e865ea70d7724f('hsl(0, 100%, 50%)');
913
+ function $9d7d8736d45f74b8$var$roundToStep(value, step) {
914
+ return Math.round(value / step) * step;
720
915
  }
721
-
722
- function $dba59c0b8a82682c07fa6f5c72e73481$var$mod(n, m) {
723
- return (n % m + m) % m;
916
+ function $9d7d8736d45f74b8$var$mod(n, m) {
917
+ return (n % m + m) % m;
724
918
  }
725
-
726
- function $dba59c0b8a82682c07fa6f5c72e73481$var$roundDown(v) {
727
- let r = Math.floor(v);
728
-
729
- if (r === v) {
730
- return v - 1;
731
- } else {
732
- return r;
733
- }
919
+ function $9d7d8736d45f74b8$var$roundDown(v) {
920
+ let r = Math.floor(v);
921
+ if (r === v) return v - 1;
922
+ else return r;
734
923
  }
735
-
736
- function $dba59c0b8a82682c07fa6f5c72e73481$var$degToRad(deg) {
737
- return deg * Math.PI / 180;
924
+ function $9d7d8736d45f74b8$var$degToRad(deg) {
925
+ return deg * Math.PI / 180;
738
926
  }
739
-
740
- function $dba59c0b8a82682c07fa6f5c72e73481$var$radToDeg(rad) {
741
- return rad * 180 / Math.PI;
742
- } // 0deg = 3 o'clock. increases clockwise
743
-
744
-
745
- function $dba59c0b8a82682c07fa6f5c72e73481$var$angleToCartesian(angle, radius) {
746
- let rad = $dba59c0b8a82682c07fa6f5c72e73481$var$degToRad(360 - angle + 90);
747
- let x = Math.sin(rad) * radius;
748
- let y = Math.cos(rad) * radius;
749
- return {
750
- x,
751
- y
752
- };
927
+ function $9d7d8736d45f74b8$var$radToDeg(rad) {
928
+ return rad * 180 / Math.PI;
753
929
  }
754
-
755
- function $dba59c0b8a82682c07fa6f5c72e73481$var$cartesianToAngle(x, y, radius) {
756
- let deg = $dba59c0b8a82682c07fa6f5c72e73481$var$radToDeg(Math.atan2(y / radius, x / radius));
757
- return (deg + 360) % 360;
930
+ // 0deg = 3 o'clock. increases clockwise
931
+ function $9d7d8736d45f74b8$var$angleToCartesian(angle, radius) {
932
+ let rad = $9d7d8736d45f74b8$var$degToRad(360 - angle + 90);
933
+ let x = Math.sin(rad) * radius;
934
+ let y = Math.cos(rad) * radius;
935
+ return {
936
+ x: x,
937
+ y: y
938
+ };
758
939
  }
759
- /**
760
- * Provides state management for a color wheel component.
761
- * Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.
762
- */
763
-
764
-
765
- function useColorWheelState(props) {
766
- let {
767
- defaultValue,
768
- onChange,
769
- onChangeEnd,
770
- step = 1
771
- } = props;
772
-
773
- if (!props.value && !defaultValue) {
774
- defaultValue = $dba59c0b8a82682c07fa6f5c72e73481$var$DEFAULT_COLOR;
775
- }
776
-
777
- let [value, setValue] = useControlledState($dba59c0b8a82682c07fa6f5c72e73481$var$normalizeColor(props.value), $dba59c0b8a82682c07fa6f5c72e73481$var$normalizeColor(defaultValue), onChange);
778
- let valueRef = useRef(value);
779
- valueRef.current = value;
780
- let [isDragging, setDragging] = useState(false);
781
- let hue = value.getChannelValue('hue');
782
-
783
- function setHue(v) {
784
- if (v > 360) {
785
- // Make sure you can always get back to 0.
786
- v = 0;
787
- }
788
-
789
- v = $dba59c0b8a82682c07fa6f5c72e73481$var$roundToStep($dba59c0b8a82682c07fa6f5c72e73481$var$mod(v, 360), step);
790
-
791
- if (hue !== v) {
792
- setValue(value.withChannelValue('hue', v));
793
- }
794
- }
795
-
796
- return {
797
- value,
798
-
799
- setValue(v) {
800
- let color = $dba59c0b8a82682c07fa6f5c72e73481$var$normalizeColor(v);
801
- valueRef.current = color;
802
- setValue(color);
803
- },
804
-
805
- hue,
806
- setHue,
807
-
808
- setHueFromPoint(x, y, radius) {
809
- setHue($dba59c0b8a82682c07fa6f5c72e73481$var$cartesianToAngle(x, y, radius));
810
- },
811
-
812
- getThumbPosition(radius) {
813
- return $dba59c0b8a82682c07fa6f5c72e73481$var$angleToCartesian(value.getChannelValue('hue'), radius);
814
- },
815
-
816
- increment(minStepSize) {
817
- if (minStepSize === void 0) {
818
- minStepSize = 0;
819
- }
820
-
821
- let newValue = hue + Math.max(minStepSize, step);
822
-
823
- if (newValue > 360) {
824
- // Make sure you can always get back to 0.
825
- newValue = 0;
826
- }
827
-
828
- setHue(newValue);
829
- },
830
-
831
- decrement(minStepSize) {
832
- if (minStepSize === void 0) {
833
- minStepSize = 0;
834
- }
835
-
836
- let s = Math.max(minStepSize, step);
837
-
838
- if (hue === 0) {
839
- // We can't just subtract step because this might be the case:
840
- // |(previous step) - 0| < step size
841
- setHue($dba59c0b8a82682c07fa6f5c72e73481$var$roundDown(360 / s) * s);
842
- } else {
843
- setHue(hue - s);
844
- }
845
- },
846
-
847
- setDragging(isDragging) {
848
- setDragging(wasDragging => {
849
- if (onChangeEnd && !isDragging && wasDragging) {
850
- onChangeEnd(valueRef.current);
940
+ function $9d7d8736d45f74b8$var$cartesianToAngle(x, y, radius) {
941
+ let deg = $9d7d8736d45f74b8$var$radToDeg(Math.atan2(y / radius, x / radius));
942
+ return (deg + 360) % 360;
943
+ }
944
+ function $9d7d8736d45f74b8$export$f4301076d9336137(props) {
945
+ let { defaultValue: defaultValue , onChange: onChange , onChangeEnd: onChangeEnd } = props;
946
+ if (!props.value && !defaultValue) defaultValue = $9d7d8736d45f74b8$var$DEFAULT_COLOR;
947
+ let [value, setValue] = $4tN2K$reactstatelyutils.useControlledState($83fe1a57d631223b$export$4cde5df63f53f473(props.value), $83fe1a57d631223b$export$4cde5df63f53f473(defaultValue), onChange);
948
+ let valueRef = $4tN2K$react.useRef(value);
949
+ valueRef.current = value;
950
+ let channelRange = value.getChannelRange('hue');
951
+ let { minValue: minValueX , maxValue: maxValueX , step: step , pageSize: pageStep } = channelRange;
952
+ let [isDragging1, setDragging] = $4tN2K$react.useState(false);
953
+ let isDraggingRef = $4tN2K$react.useRef(false).current;
954
+ let hue = value.getChannelValue('hue');
955
+ function setHue(v) {
956
+ if (v > 360) // Make sure you can always get back to 0.
957
+ v = 0;
958
+ v = $9d7d8736d45f74b8$var$roundToStep($9d7d8736d45f74b8$var$mod(v, 360), step);
959
+ if (hue !== v) {
960
+ let color = value.withChannelValue('hue', v);
961
+ valueRef.current = color;
962
+ setValue(color);
851
963
  }
852
-
853
- return isDragging;
854
- });
855
- },
856
-
857
- isDragging,
858
-
859
- getDisplayColor() {
860
- return value.withChannelValue('saturation', 100).withChannelValue('lightness', 50);
861
964
  }
862
-
863
- };
965
+ return {
966
+ value: value,
967
+ step: step,
968
+ pageStep: pageStep,
969
+ setValue (v) {
970
+ let color = $83fe1a57d631223b$export$4cde5df63f53f473(v);
971
+ valueRef.current = color;
972
+ setValue(color);
973
+ },
974
+ hue: hue,
975
+ setHue: setHue,
976
+ setHueFromPoint (x, y, radius) {
977
+ setHue($9d7d8736d45f74b8$var$cartesianToAngle(x, y, radius));
978
+ },
979
+ getThumbPosition (radius) {
980
+ return $9d7d8736d45f74b8$var$angleToCartesian(value.getChannelValue('hue'), radius);
981
+ },
982
+ increment (stepSize = 1) {
983
+ let s = Math.max(stepSize, step);
984
+ let newValue = hue + s;
985
+ if (newValue >= maxValueX) // Make sure you can always get back to 0.
986
+ newValue = minValueX;
987
+ setHue($9d7d8736d45f74b8$var$roundToStep($9d7d8736d45f74b8$var$mod(newValue, 360), s));
988
+ },
989
+ decrement (stepSize = 1) {
990
+ let s = Math.max(stepSize, step);
991
+ if (hue === 0) // We can't just subtract step because this might be the case:
992
+ // |(previous step) - 0| < step size
993
+ setHue($9d7d8736d45f74b8$var$roundDown(360 / s) * s);
994
+ else setHue($9d7d8736d45f74b8$var$roundToStep($9d7d8736d45f74b8$var$mod(hue - s, 360), s));
995
+ },
996
+ setDragging (isDragging) {
997
+ let wasDragging = isDraggingRef;
998
+ isDraggingRef = isDragging;
999
+ if (onChangeEnd && !isDragging && wasDragging) onChangeEnd(valueRef.current);
1000
+ setDragging(isDragging);
1001
+ },
1002
+ isDragging: isDragging1,
1003
+ getDisplayColor () {
1004
+ return value.toFormat('hsl').withChannelValue('saturation', 100).withChannelValue('lightness', 50);
1005
+ }
1006
+ };
864
1007
  }
865
1008
 
866
- exports.useColorWheelState = useColorWheelState;
867
1009
 
868
- function $b3b9a125af848b3d936c7c032125859$export$useColor(value) {
869
- return useMemo(() => {
870
- if (typeof value === 'string') {
871
- try {
872
- return parseColor(value);
873
- } catch (err) {
874
- return undefined;
875
- }
876
- }
1010
+ var $d59d0c2b2ce1568f$exports = {};
877
1011
 
878
- return value;
879
- }, [value]);
880
- }
1012
+ $parcel$export($d59d0c2b2ce1568f$exports, "useColorFieldState", () => $d59d0c2b2ce1568f$export$d52a01683abdfcd6);
881
1013
 
882
- const $f59de409cf55723659fabb2f46aaa7a$var$MIN_COLOR = parseColor('#000000');
883
- const $f59de409cf55723659fabb2f46aaa7a$var$MAX_COLOR = parseColor('#FFFFFF');
884
- const $f59de409cf55723659fabb2f46aaa7a$var$MIN_COLOR_INT = $f59de409cf55723659fabb2f46aaa7a$var$MIN_COLOR.toHexInt();
885
- const $f59de409cf55723659fabb2f46aaa7a$var$MAX_COLOR_INT = $f59de409cf55723659fabb2f46aaa7a$var$MAX_COLOR.toHexInt();
886
- /**
887
- * Provides state management for a color field component. Color fields allow
888
- * users to enter and adjust a hex color value.
889
- */
890
-
891
- function useColorFieldState(props) {
892
- let {
893
- step = 1,
894
- value,
895
- defaultValue,
896
- onChange
897
- } = props;
898
- let initialValue = $b3b9a125af848b3d936c7c032125859$export$useColor(value);
899
- let initialDefaultValue = $b3b9a125af848b3d936c7c032125859$export$useColor(defaultValue);
900
- let [colorValue, setColorValue] = useControlledState(initialValue, initialDefaultValue, onChange);
901
- let initialInputValue = (value || defaultValue) && colorValue ? colorValue.toString('hex') : '';
902
- let [inputValue, setInputValue] = useState(initialInputValue);
903
- useEffect(() => {
904
- setInputValue(inputValue => {
905
- // Parse color from current inputValue.
906
- // Only update the input value if the parseColorValue is not equivalent.
907
- if (!inputValue.length && colorValue) {
908
- return colorValue.toString('hex');
909
- }
910
1014
 
911
- try {
912
- let currentColor = parseColor(inputValue.startsWith('#') ? inputValue : "#" + inputValue);
913
1015
 
914
- if (currentColor.toHexInt() !== (colorValue == null ? void 0 : colorValue.toHexInt())) {
915
- return colorValue ? colorValue.toString('hex') : '';
1016
+ function $f8b3be23ba4462b1$export$5aadd9c0606af5c2(value) {
1017
+ return $4tN2K$react.useMemo(()=>{
1018
+ if (typeof value === 'string') try {
1019
+ return $83fe1a57d631223b$export$6e865ea70d7724f(value);
1020
+ } catch (err) {
1021
+ return undefined;
916
1022
  }
917
- } catch (err) {// ignore
918
- }
919
-
920
- return inputValue;
921
- });
922
- }, [inputValue, colorValue, setInputValue]);
923
-
924
- let increment = () => setColorValue(prevColor => $f59de409cf55723659fabb2f46aaa7a$var$addColorValue(prevColor, step));
925
-
926
- let decrement = () => setColorValue(prevColor => $f59de409cf55723659fabb2f46aaa7a$var$addColorValue(prevColor, -step));
927
-
928
- let incrementToMax = () => setColorValue(prevColor => $f59de409cf55723659fabb2f46aaa7a$var$addColorValue(prevColor, $f59de409cf55723659fabb2f46aaa7a$var$MAX_COLOR_INT));
929
-
930
- let decrementToMin = () => setColorValue(prevColor => $f59de409cf55723659fabb2f46aaa7a$var$addColorValue(prevColor, -$f59de409cf55723659fabb2f46aaa7a$var$MAX_COLOR_INT));
1023
+ return value;
1024
+ }, [
1025
+ value
1026
+ ]);
1027
+ }
931
1028
 
932
- let setFieldInputValue = value => {
933
- var _value$match;
934
1029
 
935
- value = (_value$match = value.match(/^#?[0-9a-f]{0,6}$/i)) == null ? void 0 : _value$match[0];
936
1030
 
937
- if (value !== undefined) {
938
- if (!value.length && colorValue) {
939
- setColorValue(null);
940
- return;
941
- }
942
1031
 
943
- try {
944
- let newColor = parseColor(value.startsWith('#') ? value : "#" + value);
945
- setColorValue(prevColor => {
946
- setInputValue(value);
947
- return prevColor && prevColor.toHexInt() === newColor.toHexInt() ? prevColor : newColor;
948
- });
949
- } catch (err) {
950
- setInputValue(value);
951
- }
1032
+ const $d59d0c2b2ce1568f$var$MIN_COLOR = $83fe1a57d631223b$export$6e865ea70d7724f('#000000');
1033
+ const $d59d0c2b2ce1568f$var$MAX_COLOR = $83fe1a57d631223b$export$6e865ea70d7724f('#FFFFFF');
1034
+ const $d59d0c2b2ce1568f$var$MIN_COLOR_INT = $d59d0c2b2ce1568f$var$MIN_COLOR.toHexInt();
1035
+ const $d59d0c2b2ce1568f$var$MAX_COLOR_INT = $d59d0c2b2ce1568f$var$MAX_COLOR.toHexInt();
1036
+ function $d59d0c2b2ce1568f$export$d52a01683abdfcd6(props) {
1037
+ let { value: value1 , defaultValue: defaultValue , onChange: onChange } = props;
1038
+ let { step: step } = $d59d0c2b2ce1568f$var$MIN_COLOR.getChannelRange('red');
1039
+ let initialValue = $f8b3be23ba4462b1$export$5aadd9c0606af5c2(value1);
1040
+ let initialDefaultValue = $f8b3be23ba4462b1$export$5aadd9c0606af5c2(defaultValue);
1041
+ let [colorValue, setColorValue] = $4tN2K$reactstatelyutils.useControlledState(initialValue, initialDefaultValue, onChange);
1042
+ let [inputValue, setInputValue] = $4tN2K$react.useState(()=>(value1 || defaultValue) && colorValue ? colorValue.toString('hex') : ''
1043
+ );
1044
+ let safelySetColorValue = (newColor)=>{
1045
+ if (!colorValue || !newColor) {
1046
+ setColorValue(newColor);
1047
+ return;
1048
+ }
1049
+ if (newColor.toHexInt() !== colorValue.toHexInt()) {
1050
+ setColorValue(newColor);
1051
+ return;
1052
+ }
1053
+ };
1054
+ let prevValue = $4tN2K$react.useRef(colorValue);
1055
+ if (prevValue.current !== colorValue) {
1056
+ setInputValue(colorValue ? colorValue.toString('hex') : '');
1057
+ prevValue.current = colorValue;
952
1058
  }
953
- };
954
-
955
- let commit = () => {
956
- setInputValue(colorValue ? colorValue.toString('hex') : '');
957
- };
958
-
959
- return {
960
- colorValue,
961
- inputValue,
962
- setInputValue: setFieldInputValue,
963
- commit,
964
- increment,
965
- incrementToMax,
966
- decrement,
967
- decrementToMin
968
- };
1059
+ let parsedValue = $4tN2K$react.useMemo(()=>{
1060
+ let color;
1061
+ try {
1062
+ color = $83fe1a57d631223b$export$6e865ea70d7724f(inputValue.startsWith('#') ? inputValue : `#${inputValue}`);
1063
+ } catch (err) {
1064
+ color = null;
1065
+ }
1066
+ return color;
1067
+ }, [
1068
+ inputValue
1069
+ ]);
1070
+ let parsed = $4tN2K$react.useRef(null);
1071
+ parsed.current = parsedValue;
1072
+ let commit = ()=>{
1073
+ // Set to empty state if input value is empty
1074
+ if (!inputValue.length) {
1075
+ safelySetColorValue(null);
1076
+ setInputValue(value1 === undefined ? '' : colorValue.toString('hex'));
1077
+ return;
1078
+ }
1079
+ // if it failed to parse, then reset input to formatted version of current number
1080
+ if (parsed.current == null) {
1081
+ setInputValue(colorValue ? colorValue.toString('hex') : '');
1082
+ return;
1083
+ }
1084
+ safelySetColorValue(parsed.current);
1085
+ // in a controlled state, the numberValue won't change, so we won't go back to our old input without help
1086
+ let newColorValue = '';
1087
+ if (colorValue) newColorValue = colorValue.toString('hex');
1088
+ setInputValue(newColorValue);
1089
+ };
1090
+ let increment = ()=>{
1091
+ let newValue = $d59d0c2b2ce1568f$var$addColorValue(parsed.current, step);
1092
+ // if we've arrived at the same value that was previously in the state, the
1093
+ // input value should be updated to match
1094
+ // ex type 4, press increment, highlight the number in the input, type 4 again, press increment
1095
+ // you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
1096
+ if (newValue === colorValue) setInputValue(newValue.toString('hex'));
1097
+ safelySetColorValue(newValue);
1098
+ };
1099
+ let decrement = ()=>{
1100
+ let newValue = $d59d0c2b2ce1568f$var$addColorValue(parsed.current, -step);
1101
+ // if we've arrived at the same value that was previously in the state, the
1102
+ // input value should be updated to match
1103
+ // ex type 4, press increment, highlight the number in the input, type 4 again, press increment
1104
+ // you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
1105
+ if (newValue === colorValue) setInputValue(newValue.toString('hex'));
1106
+ safelySetColorValue(newValue);
1107
+ };
1108
+ let incrementToMax = ()=>safelySetColorValue($d59d0c2b2ce1568f$var$MAX_COLOR)
1109
+ ;
1110
+ let decrementToMin = ()=>safelySetColorValue($d59d0c2b2ce1568f$var$MIN_COLOR)
1111
+ ;
1112
+ let validate = (value)=>{
1113
+ var ref;
1114
+ return value === '' || !!((ref = value.match(/^#?[0-9a-f]{0,6}$/i)) === null || ref === void 0 ? void 0 : ref[0]);
1115
+ };
1116
+ return {
1117
+ validate: validate,
1118
+ colorValue: colorValue,
1119
+ inputValue: inputValue,
1120
+ setInputValue: setInputValue,
1121
+ commit: commit,
1122
+ increment: increment,
1123
+ incrementToMax: incrementToMax,
1124
+ decrement: decrement,
1125
+ decrementToMin: decrementToMin
1126
+ };
1127
+ }
1128
+ function $d59d0c2b2ce1568f$var$addColorValue(color, step) {
1129
+ let newColor = color ? color : $d59d0c2b2ce1568f$var$MIN_COLOR;
1130
+ let colorInt = newColor.toHexInt();
1131
+ let clampInt = Math.min(Math.max(colorInt + step, $d59d0c2b2ce1568f$var$MIN_COLOR_INT), $d59d0c2b2ce1568f$var$MAX_COLOR_INT);
1132
+ if (clampInt !== colorInt) {
1133
+ let newColorString = `#${clampInt.toString(16).padStart(6, '0').toUpperCase()}`;
1134
+ newColor = $83fe1a57d631223b$export$6e865ea70d7724f(newColorString);
1135
+ }
1136
+ return newColor;
969
1137
  }
970
1138
 
971
- exports.useColorFieldState = useColorFieldState;
972
1139
 
973
- function $f59de409cf55723659fabb2f46aaa7a$var$addColorValue(color, step) {
974
- let newColor = color ? color : $f59de409cf55723659fabb2f46aaa7a$var$MIN_COLOR;
975
- let colorInt = newColor.toHexInt();
976
- let newColorString = color ? color.toString('hex') : '';
977
- let clampInt = Math.min(Math.max(colorInt + step, $f59de409cf55723659fabb2f46aaa7a$var$MIN_COLOR_INT), $f59de409cf55723659fabb2f46aaa7a$var$MAX_COLOR_INT);
1140
+ $parcel$exportWildcard(module.exports, $af2d7ac9990cfee2$exports);
1141
+ $parcel$exportWildcard(module.exports, $5386a492cfd3234c$exports);
1142
+ $parcel$exportWildcard(module.exports, $9d7d8736d45f74b8$exports);
1143
+ $parcel$exportWildcard(module.exports, $d59d0c2b2ce1568f$exports);
978
1144
 
979
- if (clampInt !== colorInt) {
980
- newColorString = "#" + clampInt.toString(16).padStart(6, '0').toUpperCase();
981
- newColor = parseColor(newColorString);
982
- }
983
1145
 
984
- return newColor;
985
- }
986
1146
  //# sourceMappingURL=main.js.map