@react-stately/color 3.0.0-beta.2 → 3.0.0-beta.6

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