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