@react-stately/color 3.0.0-nightly.3040 → 3.0.0-nightly.3064

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